Skip to content

Commit d698ffa

Browse files
authored
Fix: storybook (#460)
* chore: python packages * chore: python packages * fix: stories * fix: css * fix: build * chore: makefile
1 parent f9ecd94 commit d698ffa

File tree

19 files changed

+304
-156
lines changed

19 files changed

+304
-156
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = tseslint.config(
2828
'packages/*/entries.js',
2929
'packages/*/vite.config.ts',
3030
'storybook/.storybook/*.ts',
31+
'storybook/.storybook/*.tsx',
3132
],
3233
},
3334
},

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,27 @@
7676
"typescript-eslint": "^8.39.1"
7777
},
7878
"resolutions": {
79+
"@microsoft/fast-colors": "5.3.1",
80+
"@microsoft/fast-components": "2.30.6",
81+
"@microsoft/fast-element": "1.13.0",
82+
"@microsoft/fast-foundation": "2.49.6",
83+
"@microsoft/fast-react-wrapper": "0.3.24",
84+
"@microsoft/fast-web-utilities": "5.4.1",
85+
"@microsoft/load-themed-styles": "1.10.295",
7986
"@types/react": "^18.3.20",
8087
"@types/react-dom": "^18.3.6",
8188
"react": "^18.3.1",
8289
"react-dom": "^18.3.1",
8390
"typescript": "^5.8.3"
8491
},
8592
"overrides": {
93+
"@microsoft/fast-colors": "5.3.1",
94+
"@microsoft/fast-components": "2.30.6",
95+
"@microsoft/fast-element": "1.13.0",
96+
"@microsoft/fast-foundation": "2.49.6",
97+
"@microsoft/fast-react-wrapper": "0.3.24",
98+
"@microsoft/fast-web-utilities": "5.4.1",
99+
"@microsoft/load-themed-styles": "1.10.295",
86100
"@types/react": "^18.3.20",
87101
"@types/react-dom": "^18.3.6",
88102
"react": "^18.3.1",

packages/lexical/hatch_build.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (c) 2021-2023 Datalayer, Inc.
2+
#
3+
# MIT License
4+
5+
import glob
6+
import os
7+
8+
from subprocess import check_call
9+
10+
import shutil
11+
12+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
13+
14+
15+
here = os.path.abspath(os.path.dirname(__file__))
16+
17+
18+
def build_javascript():
19+
check_call(
20+
['npm', 'install'],
21+
cwd=here,
22+
)
23+
check_call(
24+
['npm', 'run', 'build:webpack', '--mode=production'],
25+
cwd=here,
26+
)
27+
for file in glob.glob(r'./dist/*.*'):
28+
shutil.copy(
29+
file,
30+
'./jupyter_lexical/static/'
31+
)
32+
33+
34+
class JupyterBuildHook(BuildHookInterface):
35+
def initialize(self, version, build_data):
36+
if self.target_name == 'editable':
37+
build_javascript()
38+
elif self.target_name == 'wheel':
39+
build_javascript()
40+
elif self.target_name == 'sdist':
41+
build_javascript()

packages/lexical/jupyter_lexical/handlers/index/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ class IndexHandler(BaseTemplateHandler):
1414
"""The handler for the index."""
1515

1616
@tornado.web.authenticated
17-
def get(self):
17+
def get(self, path = ""):
1818
"""The index page."""
1919
self.write(self.render_template("index.html"))

packages/lexical/jupyter_lexical/serverapplication.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ def initialize_templates(self):
8989
def initialize_handlers(self):
9090
self.log.debug("Jupyter Lexical Config {}".format(self.settings['jupyter_lexical_jinja2_env']))
9191
handlers = [
92-
("jupyter_lexical", IndexHandler),
93-
(url_path_join("jupyter_lexical", "config"), ConfigHandler),
92+
(url_path_join(self.name, "config"), ConfigHandler),
93+
(r"/jupyter_lexical/(.+)$", IndexHandler),
94+
(r"/jupyter_lexical/?", IndexHandler),
9495
]
9596
self.handlers.extend(handlers)
9697

packages/lexical/jupyter_lexical/templates/index.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,30 @@
99
<head>
1010
<meta charset="UTF-8" />
1111
<title>Ξ Jupyter Lexical</title>
12-
<link
13-
rel="shortcut icon"
14-
href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAC7SURBVFiF7ZU9CgIxEIXfTHbPopfYc+pJ9AALtmJnZSOIoJWFoCTzLHazxh/Ebpt5EPIxM8XXTCKTxYyMCYwJFhOYCo4JFiMuu317PZwaqEBUIar4YMmskL73DytGjgu4gAt4PDJdzkkzMBloBhqBgcu69XW+1I+rNSQESNDuaMEhdP/Fj/7oW+ACLuACHk/3F5BAfuMLBjm8/ZnxNvNtHmY4b7Ztut0bqStoVSHfWj9Z6mr8LXABF3CBB3nvkDfEVN6PAAAAAElFTkSuQmCC"
15-
type="image/x-icon"
16-
/>
12+
<script id="datalayer-config-data" type="application/json">
13+
{
14+
"jupyterServerUrl": "",
15+
"jupyterServerToken": "{{ token }}"
16+
}
17+
</script>
1718
<script id="jupyter-config-data" type="application/json">
1819
{
1920
"baseUrl": "http://localhost:8686{{ base_url }}",
2021
"wsUrl": "ws://localhost:8686{{ base_url }}",
2122
"token": "{{ token }}",
23+
"appUrl": "/lab",
24+
"themesUrl": "/lab/api/themes",
2225
"disableRTC": false,
2326
"terminalsAvailable": "false",
2427
"mathjaxUrl": "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js",
2528
"mathjaxConfig": "TeX-AMS_CHTML-full,Safe"
2629
}
2730
</script>
28-
<script id="datalayer-config-data" type="application/json">
29-
{
30-
"jupyterServerUrl": "https://oss.datalayer.run/api/jupyter-server",
31-
"jupyterServerToken": "60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6"
32-
}
33-
</script>
31+
<link
32+
rel="shortcut icon"
33+
href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAC7SURBVFiF7ZU9CgIxEIXfTHbPopfYc+pJ9AALtmJnZSOIoJWFoCTzLHazxh/Ebpt5EPIxM8XXTCKTxYyMCYwJFhOYCo4JFiMuu317PZwaqEBUIar4YMmskL73DytGjgu4gAt4PDJdzkkzMBloBhqBgcu69XW+1I+rNSQESNDuaMEhdP/Fj/7oW+ACLuACHk/3F5BAfuMLBjm8/ZnxNvNtHmY4b7Ztut0bqStoVSHfWj9Z6mr8LXABF3CBB3nvkDfEVN6PAAAAAElFTkSuQmCC"
34+
type="image/x-icon"
35+
/>
3436
<script
3537
defer
3638
src="{{ base_url }}static/jupyter_lexical/main.jupyter-lexical.js"

packages/lexical/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"build:tsc:watch": "run-p 'build:tsc:watch:*'",
3636
"build:tsc:watch:res": "gulp resources-to-lib-watch",
3737
"build:tsc:watch:tsc": "tsc --watch",
38+
"build:webpack": "webpack-cli build",
3839
"clean": "rimraf node_modules lib dist build tsconfig.tsbuildinfo",
3940
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
4041
"clean:labextension": "rimraf datalayer/labextension",

packages/lexical/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ test = [
4141
]
4242

4343
[project.scripts]
44-
ji = "jupyter_lexical.application:main"
45-
jupyter-lexical = "jupyter_lexical.application:main"
46-
jupyter-lexical-server = "jupyter_lexical.serverapplication:main"
44+
jupyter-lexical = "jupyter_lexical.serverapplication:main"
4745

4846
[tool.hatch.version]
4947
path = "jupyter_lexical/__version__.py"
@@ -54,6 +52,8 @@ artifacts = [
5452
"jupyter_lexical/templates"
5553
]
5654

55+
[tool.hatch.build.hooks.custom]
56+
5757
[tool.hatch.build.targets.sdist]
5858
exclude = [".github", "binder", ".yarn"]
5959

packages/lexical/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = {
5757
},
5858
output: {
5959
publicPath: 'http://localhost:3211/',
60-
filename: '[name].[contenthash].jupyter-lexical.js',
60+
filename: '[name].jupyter-lexical.js',
6161
},
6262
resolve: {
6363
extensions: ['.tsx', '.ts', 'jsx', '.js'],

packages/react/hatch_build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
def build_javascript():
1919
check_call(
20-
['yarn', 'install'],
20+
['npm', 'install'],
2121
cwd=here,
2222
)
2323
check_call(
24-
['yarn', 'build:webpack', '--mode=production'],
24+
['npm', 'run', 'build:webpack', '--', '--mode=production'],
2525
cwd=here,
2626
)
2727
for file in glob.glob(r'./dist/*.*'):

0 commit comments

Comments
 (0)