@curvenote/renderers 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/any/renderers.d.ts.map +1 -1
- package/dist/any/renderers.js +29 -14
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../../src/any/renderers.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../../src/any/renderers.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,2CA2G/D"}
|
package/dist/any/renderers.js
CHANGED
|
@@ -43,10 +43,12 @@ export function AnyRenderer({ node }) {
|
|
|
43
43
|
yield (maybeCleanupInitialize === null || maybeCleanupInitialize === void 0 ? void 0 : maybeCleanupInitialize());
|
|
44
44
|
}));
|
|
45
45
|
// TODO: validation for import & styles URLs
|
|
46
|
+
console.debug('AnyRenderer importing:', node.data.import);
|
|
46
47
|
import(node.data.import).then((mod) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
var _a, _b, _c, _d, _e;
|
|
48
|
+
var _a, _b, _c, _d, _e, _f;
|
|
48
49
|
if (!ref.current)
|
|
49
50
|
return;
|
|
51
|
+
console.debug('AnyRenderer imported', mod);
|
|
50
52
|
const widget = mod.default;
|
|
51
53
|
// TODO: validate the widget
|
|
52
54
|
const model = new MystAnyModel(node.data.json);
|
|
@@ -54,23 +56,36 @@ export function AnyRenderer({ node }) {
|
|
|
54
56
|
// clear current contents
|
|
55
57
|
(_b = ref.current) === null || _b === void 0 ? void 0 : _b.replaceChildren();
|
|
56
58
|
// apply container classes
|
|
57
|
-
(_c = node.data.class) === null || _c === void 0 ? void 0 : _c.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
if (((_c = node.data.class) === null || _c === void 0 ? void 0 : _c.trim().length) > 0) {
|
|
60
|
+
(_d = node.data.class) === null || _d === void 0 ? void 0 : _d.trim().split(' ').forEach((c) => {
|
|
61
|
+
var _a;
|
|
62
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.classList.add(c);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
61
65
|
// apply styles
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
shadowRoot.appendChild(shadowEl);
|
|
66
|
+
let rootEl = ref.current;
|
|
67
|
+
const shadow = true;
|
|
65
68
|
if (node.data.styles) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
if (shadow) {
|
|
70
|
+
const shadowRoot = (_e = ref.current) === null || _e === void 0 ? void 0 : _e.attachShadow({ mode: 'open' });
|
|
71
|
+
const shadowEl = document.createElement('div');
|
|
72
|
+
shadowRoot.appendChild(shadowEl);
|
|
73
|
+
const link = document.createElement('link');
|
|
74
|
+
link.rel = 'stylesheet';
|
|
75
|
+
link.href = node.data.styles;
|
|
76
|
+
shadowRoot.appendChild(link);
|
|
77
|
+
rootEl = shadowEl;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const link = document.createElement('link');
|
|
81
|
+
link.rel = 'stylesheet';
|
|
82
|
+
link.href = node.data.styles;
|
|
83
|
+
rootEl.appendChild(link);
|
|
84
|
+
}
|
|
70
85
|
}
|
|
71
|
-
maybeCleanupRender = yield ((
|
|
86
|
+
maybeCleanupRender = yield ((_f = widget.render) === null || _f === void 0 ? void 0 : _f.call(widget, {
|
|
72
87
|
model,
|
|
73
|
-
el:
|
|
88
|
+
el: rootEl,
|
|
74
89
|
}));
|
|
75
90
|
}));
|
|
76
91
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curvenote/renderers",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"build": "npm-run-all -l clean -p build:esm"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@curvenote/bridge-jupyter": "^0.5.
|
|
25
|
-
"@curvenote/ext-blog": "^0.5.
|
|
26
|
-
"@curvenote/ext-footer": "^0.5.
|
|
27
|
-
"@curvenote/ext-landing": "^0.5.
|
|
28
|
-
"@curvenote/ext-person": "^0.5.
|
|
24
|
+
"@curvenote/bridge-jupyter": "^0.5.5",
|
|
25
|
+
"@curvenote/ext-blog": "^0.5.5",
|
|
26
|
+
"@curvenote/ext-footer": "^0.5.5",
|
|
27
|
+
"@curvenote/ext-landing": "^0.5.5",
|
|
28
|
+
"@curvenote/ext-person": "^0.5.5",
|
|
29
29
|
"@heroicons/react": "^2.1.5",
|
|
30
30
|
"@myst-theme/providers": "^0.13.6",
|
|
31
31
|
"@scienceicons/myst": "^1.0.4",
|