├── .gitignore ├── website ├── static │ ├── img │ │ ├── hero.png │ │ ├── favicon.ico │ │ ├── icon.svg │ │ ├── seamless-embedding.svg │ │ ├── background.svg │ │ └── scriptable-control.svg │ ├── fonts │ │ ├── SourceSansPro-Italic.ttf │ │ ├── SourceSansPro-Regular.ttf │ │ ├── SourceSansPro-Semibold.ttf │ │ └── SourceSansPro-SemiboldItalic.ttf │ └── css │ │ └── custom.css ├── sidebars.json ├── package.json ├── pages │ └── en │ │ ├── users.js │ │ ├── examples.js │ │ └── index.js ├── i18n │ └── en.json ├── core │ └── Footer.js ├── siteConfig.js └── README.md ├── examples ├── basic.html ├── url.html ├── expr.html ├── borders.html ├── manipulate.html ├── ssr.html └── dimensions.html ├── config └── rollup.config.js ├── CHANGELOG.md ├── LICENSE ├── package.json ├── docs ├── Troubleshooting.md ├── ContributingAgreement.md ├── Development.md ├── GettingStarted.md ├── NotebookLoadingPhases.md ├── LibraryInterface.md ├── NotebookAPI-Unsupported.md ├── ServerSideRendering.md ├── NotebookAPI-Internal.md └── NotebookAPI.md ├── CONTRIBUTING.md ├── README.md └── src └── main.js /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | examples/dist/ 3 | node_modules/ 4 | website/build/ 5 | 6 | .idea/ 7 | .vscode/ 8 | -------------------------------------------------------------------------------- /website/static/img/hero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WolframResearch/wolfram-notebook-embedder/master/website/static/img/hero.png -------------------------------------------------------------------------------- /website/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WolframResearch/wolfram-notebook-embedder/master/website/static/img/favicon.ico -------------------------------------------------------------------------------- /website/static/fonts/SourceSansPro-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WolframResearch/wolfram-notebook-embedder/master/website/static/fonts/SourceSansPro-Italic.ttf -------------------------------------------------------------------------------- /website/static/fonts/SourceSansPro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WolframResearch/wolfram-notebook-embedder/master/website/static/fonts/SourceSansPro-Regular.ttf -------------------------------------------------------------------------------- /website/static/fonts/SourceSansPro-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WolframResearch/wolfram-notebook-embedder/master/website/static/fonts/SourceSansPro-Semibold.ttf -------------------------------------------------------------------------------- /website/static/fonts/SourceSansPro-SemiboldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WolframResearch/wolfram-notebook-embedder/master/website/static/fonts/SourceSansPro-SemiboldItalic.ttf -------------------------------------------------------------------------------- /website/sidebars.json: -------------------------------------------------------------------------------- 1 | { 2 | "docs": { 3 | "Getting Started": ["GettingStarted"], 4 | "API Documentation": ["LibraryInterface", "NotebookAPI"], 5 | "More Information": ["ServerSideRendering", "NotebookLoadingPhases", "Troubleshooting"], 6 | "Contributing": ["Development", "ContributingAgreement"] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "examples": "docusaurus-examples", 4 | "start": "docusaurus-start", 5 | "build": "docusaurus-build", 6 | "publish-gh-pages": "docusaurus-publish", 7 | "write-translations": "docusaurus-write-translations", 8 | "version": "docusaurus-version", 9 | "rename-version": "docusaurus-rename-version" 10 | }, 11 | "devDependencies": { 12 | "docusaurus": "^1.11.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/basic.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Basic example 4 | 5 | 6 | 7 |

Basic example

8 |
9 | 10 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /config/rollup.config.js: -------------------------------------------------------------------------------- 1 | import babel from '@rollup/plugin-babel'; 2 | import resolve from '@rollup/plugin-node-resolve'; 3 | 4 | export default { 5 | input: 'src/main.js', 6 | output: { 7 | format: 'umd', 8 | exports: 'named', 9 | file: 'dist/wolfram-notebook-embedder.js', 10 | name: 'WolframNotebookEmbedder', 11 | sourcemap: true, 12 | strict: true 13 | }, 14 | plugins: [ 15 | babel({ 16 | sourceMap: true, 17 | exclude: 'node_modules/**', 18 | babelrc: false, 19 | comments: false, 20 | presets: [ 21 | ['@babel/env', { 22 | modules: false, 23 | loose: true, 24 | targets: { 25 | browsers: ['last 2 versions'] 26 | } 27 | }] 28 | ] 29 | }), 30 | resolve() 31 | ] 32 | }; 33 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.3 2 | 3 | * Embedding of external notebooks at a given URL (`{url: ...}`) or with a given `Notebook` expression (`{expr: ...}`) 4 | * New option `showBorder` to control whether to show a border around the embedded notebook 5 | * Officially dropped support for IE11 6 | * Add a default export, but encourage named imports 7 | 8 | ## 0.2.2 9 | 10 | * Pass through extra data from the initial server call to the cloud JS code, for better forward-compatibility 11 | 12 | ## 0.2.1 13 | 14 | * Fix issues with `useShadowDOM` when there are existing notebook-related style definitions on the page 15 | 16 | ## 0.2.0 17 | 18 | * New option `useShadowDOM` for better encapsulation of styling (still experimental and off by default) 19 | 20 | ## 0.1.5 21 | 22 | * First official release 23 | * Change the default for `allowInteract` from `false` to `true` 24 | * Improve documentation 25 | * Add website, built with [Docusaurus](https://docusaurus.io) 26 | 27 | ## 0.1.4 28 | 29 | * First proper release 30 | 31 | ## 0.1.0 32 | 33 | * Initial release 34 | -------------------------------------------------------------------------------- /examples/url.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Notebook URL example 5 | 6 | 7 | 8 |

Notebook expression example

9 |

10 | 11 | 12 | 13 | 14 | 15 |

16 |
17 | 18 | 19 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2018 Wolfram Research Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /examples/expr.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Notebook expression example 5 | 11 | 12 | 13 | 14 |

Notebook expression example

15 |

16 | 17 | 18 | 19 | 20 | 21 |

22 |
23 | 24 | 25 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /examples/borders.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Show borders example 4 | 9 | 10 | 11 | 12 |

Show borders example

13 |

14 | Enter the URL of a cloud object: 15 | 16 | 17 |

18 | 19 |

Without borders (the default)

20 |
21 | 22 |

With borders

23 |
24 | 25 | 26 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /website/pages/en/users.js: -------------------------------------------------------------------------------- 1 | const React = require('react'); 2 | 3 | const CompLibrary = require('../../core/CompLibrary.js'); 4 | 5 | const Container = CompLibrary.Container; 6 | 7 | class Users extends React.Component { 8 | render() { 9 | const {config: siteConfig} = this.props; 10 | if ((siteConfig.users || []).length === 0) { 11 | return null; 12 | } 13 | 14 | const editUrl = `${siteConfig.repoUrl}/edit/master/website/siteConfig.js`; 15 | const showcase = siteConfig.users.map(user => ( 16 | 17 | {user.caption} 18 | 19 | )); 20 | 21 | return ( 22 |
23 | 24 |
25 |
26 |

Who Is Using This?

27 |

The following sites are using Wolfram Notebook Embedder:

28 |
29 |
{showcase}
30 |

Are you using this project?

31 | 32 | Add your company 33 | 34 |
35 |
36 |
37 | ); 38 | } 39 | } 40 | 41 | module.exports = Users; 42 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "wolfram-notebook-embedder", 3 | "version": "0.3.0", 4 | "description": "Library to embed Wolfram Cloud notebooks on websites.", 5 | "main": "dist/wolfram-notebook-embedder.js", 6 | "keywords": [ 7 | "wolfram", 8 | "cloud", 9 | "notebook", 10 | "embedding" 11 | ], 12 | "license": "MIT", 13 | "files": [ 14 | "dist/", 15 | "LICENSE", 16 | "README.md" 17 | ], 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/WolframResearch/wolfram-notebook-embedder.git" 21 | }, 22 | "scripts": { 23 | "prepublishOnly": "npm-run-all build", 24 | "build": "npm-run-all transpile minify", 25 | "transpile": "rollup -c config/rollup.config.js", 26 | "copy-dist-to-examples": "cp -r ./dist ./examples", 27 | "serve-examples": "serve examples", 28 | "minify": "uglifyjs dist/wolfram-notebook-embedder.js --compress --mangle --output dist/wolfram-notebook-embedder.min.js", 29 | "run-examples": "npm-run-all build copy-dist-to-examples serve-examples" 30 | }, 31 | "devDependencies": { 32 | "@babel/core": "^7.15.5", 33 | "@babel/preset-env": "^7.15.6", 34 | "@rollup/plugin-babel": "^5.3.0", 35 | "@rollup/plugin-node-resolve": "^13.0.5", 36 | "npm-run-all": "^4.1.5", 37 | "rollup": "^2.58.0", 38 | "serve": "^12.0.1", 39 | "uglify-js": "^3.14.2" 40 | }, 41 | "dependencies": {} 42 | } 43 | -------------------------------------------------------------------------------- /docs/Troubleshooting.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: Troubleshooting 3 | title: Troubleshooting 4 | --- 5 | 6 | ## Loading 7 | 8 | **The embedded notebook does not load.** 9 | 10 | Please double-check that the embedded cloud notebook is *public*, e.g. by opening its URL in an incognito window of your browser (where you are not logged in to the Wolfram Cloud). In the Wolfram Language, you can determine permissions of a cloud object using 11 | 12 | ```wl 13 | CloudObjectInformation[CloudObject["..."], "Permissions"] 14 | ``` 15 | 16 | and you can make a cloud object public by evaluating the following: 17 | 18 | ```wl 19 | SetPermissions[CloudObject["..."], All -> {"Read", "Interact"}] 20 | ``` 21 | 22 | ## Styling 23 | 24 | **As soon as I embed a notebook, some styling on my page (outside the notebook) changes.** 25 | 26 | This might be a bug in our (notebook) CSS. We try to isolate CSS selectors as much as possible, but there might still be cases where styling "leaks out" of the notebook. Please file an issue with reproducible steps. 27 | 28 | **The styling of the notebook seems wrong.** 29 | 30 | This could be because your CSS definitions "leak into" the notebook. Since the notebook is just another DOM node on your page, it inherits any global CSS. Try to make your CSS selectors more specific so they do not affect the notebook container node. If isolating styles is a problem, you can always fall back to embedding your cloud notebook using an iframe, e.g.: 31 | 32 | ```html 33 |