@holoviz/panel 1.6.2 → 1.6.3-a.2
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/bundled/bootstraptemplate/bootstrap.css +4 -3
- package/dist/bundled/datatabulator/luxon/build/global/luxon.min.js +1 -1
- package/dist/bundled/datatabulator/luxon/build/global/luxon.min.js.map +1 -1
- package/dist/bundled/deckglplot/@deck.gl/carto@^9.0.20/dist.min.js +12 -12
- package/dist/bundled/deckglplot/maplibre-gl/dist/maplibre-gl.js +2 -2
- package/dist/bundled/deckglplot/maplibre-gl/dist/maplibre-gl.js.map +1 -1
- package/dist/bundled/notificationarea/panel/1.6.3-a.2/dist/bundled/font-awesome/css/all.min.css +2 -0
- package/dist/bundled/panel/1.6.3-a.2/dist/bundled/bootstrap5/css/bootstrap.min.css +2 -0
- package/dist/bundled/panel/1.6.3-a.2/dist/bundled/bootstrap5/js/bootstrap.bundle.min.js +2 -0
- package/dist/bundled/panel/1.6.3-a.2/dist/bundled/font-awesome/css/all.min.css +2 -0
- package/dist/bundled/panel/1.6.3-a.2/dist/bundled/jquery/jquery.min.js +2 -0
- package/dist/bundled/theme/bootstrap.css +8 -7
- package/dist/bundled/theme/bootstrap_dark.css +7 -5
- package/dist/bundled/theme/bootstrap_default.css +7 -5
- package/dist/bundled/theme/material.css +12 -0
- package/dist/css/loadingspinner.css +32 -16
- package/dist/css/markdown.css +1 -0
- package/dist/lib/models/ace.d.ts +2 -0
- package/dist/lib/models/ace.js +11 -5
- package/dist/lib/models/ace.js.map +1 -1
- package/dist/lib/models/anywidget_component.d.ts +3 -1
- package/dist/lib/models/anywidget_component.js +14 -12
- package/dist/lib/models/anywidget_component.js.map +1 -1
- package/dist/lib/models/column.d.ts +1 -0
- package/dist/lib/models/column.js +21 -0
- package/dist/lib/models/column.js.map +1 -1
- package/dist/lib/models/modal.d.ts +3 -2
- package/dist/lib/models/modal.js +9 -5
- package/dist/lib/models/modal.js.map +1 -1
- package/dist/lib/models/react_component.d.ts +3 -1
- package/dist/lib/models/react_component.js +213 -162
- package/dist/lib/models/react_component.js.map +1 -1
- package/dist/lib/models/reactive_esm.d.ts +4 -3
- package/dist/lib/models/reactive_esm.js +48 -34
- package/dist/lib/models/reactive_esm.js.map +1 -1
- package/dist/lib/styles/markdown.css.js +1 -1
- package/dist/panel.js +333 -236
- package/dist/panel.js.map +1 -1
- package/dist/panel.json +1 -1
- package/dist/panel.min.js +10 -10
- package/package.json +2 -2
- package/dist/bundled/notificationarea/panel/1.6.2/dist/bundled/font-awesome/css/all.min.css +0 -2
- package/dist/bundled/panel/1.6.2/dist/bundled/bootstrap5/css/bootstrap.min.css +0 -2
- package/dist/bundled/panel/1.6.2/dist/bundled/bootstrap5/js/bootstrap.bundle.min.js +0 -2
- package/dist/bundled/panel/1.6.2/dist/bundled/font-awesome/css/all.min.css +0 -2
- package/dist/bundled/panel/1.6.2/dist/bundled/jquery/jquery.min.js +0 -2
|
@@ -6,7 +6,7 @@ export class ReactComponentView extends ReactiveESMView {
|
|
|
6
6
|
react_root;
|
|
7
7
|
_force_update_callbacks = [];
|
|
8
8
|
render_esm() {
|
|
9
|
-
if (this.model.compiled === null || this.render_module === null) {
|
|
9
|
+
if (this.model.compiled === null || this.model.render_module === null) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
if (this.model.usesMui) {
|
|
@@ -23,8 +23,8 @@ export class ReactComponentView extends ReactiveESMView {
|
|
|
23
23
|
(this._lifecycle_handlers.get(lf) || []).splice(0);
|
|
24
24
|
}
|
|
25
25
|
this.model.disconnect_watchers(this);
|
|
26
|
-
this.render_module.then((mod) => {
|
|
27
|
-
this.react_root = mod.default.render();
|
|
26
|
+
this.model.render_module.then((mod) => {
|
|
27
|
+
this.react_root = mod.default.render(this.model.id);
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
on_force_update(cb) {
|
|
@@ -39,16 +39,51 @@ export class ReactComponentView extends ReactiveESMView {
|
|
|
39
39
|
super.remove();
|
|
40
40
|
this._force_update_callbacks = [];
|
|
41
41
|
if (this.react_root) {
|
|
42
|
-
this.react_root.unmount();
|
|
42
|
+
this.react_root.then((root) => root.unmount());
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
render() {
|
|
46
46
|
if (this.react_root) {
|
|
47
|
-
this.react_root.unmount();
|
|
47
|
+
this.react_root.then((root) => root.unmount());
|
|
48
48
|
}
|
|
49
49
|
this._force_update_callbacks = [];
|
|
50
50
|
super.render();
|
|
51
51
|
}
|
|
52
|
+
async update_children() {
|
|
53
|
+
const created_children = new Set(await this.build_child_views());
|
|
54
|
+
const all_views = this.child_views;
|
|
55
|
+
const new_views = new Map();
|
|
56
|
+
for (const child_view of this.child_views) {
|
|
57
|
+
if (!created_children.has(child_view)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const child = this._lookup_child(child_view);
|
|
61
|
+
if (!child) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (new_views.has(child)) {
|
|
65
|
+
new_views.get(child).push(child_view);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
new_views.set(child, [child_view]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
for (const view of this._child_rendered.keys()) {
|
|
72
|
+
if (!all_views.includes(view)) {
|
|
73
|
+
this._child_rendered.delete(view);
|
|
74
|
+
view.el.remove();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
for (const child of this.model.children) {
|
|
78
|
+
const callbacks = this._child_callbacks.get(child) || [];
|
|
79
|
+
const new_children = new_views.get(child) || [];
|
|
80
|
+
for (const callback of callbacks) {
|
|
81
|
+
callback(new_children);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
this._update_children();
|
|
85
|
+
this.invalidate_layout();
|
|
86
|
+
}
|
|
52
87
|
after_rendered() {
|
|
53
88
|
const handlers = (this._lifecycle_handlers.get("after_render") || []);
|
|
54
89
|
for (const cb of handlers) {
|
|
@@ -61,13 +96,26 @@ export class ReactComponentView extends ReactiveESMView {
|
|
|
61
96
|
}
|
|
62
97
|
this._rendered = true;
|
|
63
98
|
}
|
|
99
|
+
}
|
|
100
|
+
export class ReactComponent extends ReactiveESM {
|
|
101
|
+
static __name__ = "ReactComponent";
|
|
102
|
+
sucrase_transforms = ["typescript", "jsx"];
|
|
103
|
+
constructor(attrs) {
|
|
104
|
+
super(attrs);
|
|
105
|
+
}
|
|
106
|
+
get usesMui() {
|
|
107
|
+
if (this.importmap?.imports) {
|
|
108
|
+
return Object.keys(this.importmap?.imports).some(k => k.startsWith("@mui"));
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
64
112
|
_render_code() {
|
|
65
|
-
let import_code;
|
|
66
|
-
const cache_key = (this.
|
|
67
|
-
if (this.
|
|
68
|
-
|
|
69
|
-
const ns = await view._module_cache.get("${cache_key}")
|
|
70
|
-
const {React, createRoot} = ns.default`;
|
|
113
|
+
let [import_code, bundle_code] = ["", ""];
|
|
114
|
+
const cache_key = (this.bundle === "url") ? this.esm : (this.bundle || `${this.class_name}-${this.esm.length}`);
|
|
115
|
+
if (this.bundle) {
|
|
116
|
+
bundle_code = `
|
|
117
|
+
const ns = await view._module_cache.get("${cache_key}")
|
|
118
|
+
const {React, createRoot} = ns.default`;
|
|
71
119
|
}
|
|
72
120
|
else {
|
|
73
121
|
import_code = `
|
|
@@ -76,11 +124,11 @@ import { createRoot } from "react-dom/client"`;
|
|
|
76
124
|
}
|
|
77
125
|
let init_code = "";
|
|
78
126
|
let render_code = "";
|
|
79
|
-
if (this.
|
|
80
|
-
if (this.
|
|
81
|
-
|
|
82
|
-
const ns = await view._module_cache.get("${cache_key}")
|
|
83
|
-
const {CacheProvider, React, createCache, createRoot} = ns.default`;
|
|
127
|
+
if (this.usesMui) {
|
|
128
|
+
if (this.bundle) {
|
|
129
|
+
bundle_code = `
|
|
130
|
+
const ns = await view._module_cache.get("${cache_key}")
|
|
131
|
+
const {CacheProvider, React, createCache, createRoot} = ns.default`;
|
|
84
132
|
}
|
|
85
133
|
else {
|
|
86
134
|
import_code = `
|
|
@@ -88,150 +136,163 @@ ${import_code}
|
|
|
88
136
|
import createCache from "@emotion/cache"
|
|
89
137
|
import { CacheProvider } from "@emotion/react"`;
|
|
90
138
|
}
|
|
91
|
-
const css_key = this.model.id.replace("-", "").replace(/\d/g, (digit) => String.fromCharCode(digit.charCodeAt(0) + 49)).toLowerCase();
|
|
92
139
|
init_code = `
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
140
|
+
const css_key = id.replace("-", "").replace(/\d/g, (digit) => String.fromCharCode(digit.charCodeAt(0) + 49)).toLowerCase()
|
|
141
|
+
this.mui_cache = createCache({
|
|
142
|
+
key: 'css-'+css_key,
|
|
143
|
+
prepend: true,
|
|
144
|
+
container: view.style_cache,
|
|
145
|
+
})`;
|
|
98
146
|
render_code = `
|
|
99
147
|
if (rendered) {
|
|
100
148
|
rendered = React.createElement(CacheProvider, {value: this.mui_cache}, rendered)
|
|
101
149
|
}`;
|
|
102
150
|
}
|
|
103
151
|
return `
|
|
104
|
-
const view = Bokeh.index.find_one_by_id('${this.model.id}')
|
|
105
|
-
|
|
106
152
|
${import_code}
|
|
107
153
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.render_callback = null
|
|
154
|
+
async function render(id) {
|
|
155
|
+
const view = Bokeh.index.find_one_by_id(id)
|
|
156
|
+
if (view == null) {
|
|
157
|
+
return null
|
|
113
158
|
}
|
|
114
159
|
|
|
115
|
-
|
|
116
|
-
const child = this.props.parent.model.data[this.props.name]
|
|
117
|
-
const model = this.props.index == null ? child : child[this.props.index]
|
|
118
|
-
return this.props.parent.get_child_view(model)
|
|
119
|
-
}
|
|
160
|
+
${bundle_code}
|
|
120
161
|
|
|
121
|
-
|
|
122
|
-
const view = this.view
|
|
123
|
-
return view == null ? null : view.el
|
|
124
|
-
}
|
|
162
|
+
class Child extends React.PureComponent {
|
|
125
163
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
this.
|
|
137
|
-
|
|
164
|
+
constructor(props) {
|
|
165
|
+
super(props)
|
|
166
|
+
this.render_callback = null
|
|
167
|
+
this.containerRef = React.createRef()
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
updateElement() {
|
|
171
|
+
const childView = this.view
|
|
172
|
+
const el = childView?.el
|
|
173
|
+
if (el && this.containerRef.current && !this.containerRef.current.contains(el)) {
|
|
174
|
+
this.containerRef.current.innerHTML = ""
|
|
175
|
+
this.containerRef.current.appendChild(el)
|
|
138
176
|
}
|
|
139
177
|
}
|
|
140
|
-
this.props.parent.on_child_render(this.props.name, this.render_callback)
|
|
141
|
-
this.props.parent.notify_mount(this.props.name, this.view.model.id)
|
|
142
|
-
}
|
|
143
178
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
this.props.
|
|
179
|
+
get view() {
|
|
180
|
+
const child = this.props.parent.model.data[this.props.name]
|
|
181
|
+
const model = this.props.id == null ? child : child.find(item => item.id === this.props.id)
|
|
182
|
+
return this.props.parent.get_child_view(model)
|
|
147
183
|
}
|
|
148
|
-
}
|
|
149
184
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
185
|
+
get element() {
|
|
186
|
+
const view = this.view
|
|
187
|
+
return view == null ? null : view.el
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
componentDidMount() {
|
|
191
|
+
const view = this.view
|
|
192
|
+
if (view == null) { return }
|
|
193
|
+
this.updateElement()
|
|
194
|
+
this.props.parent.rerender_(view)
|
|
195
|
+
this.render_callback = (new_views) => {
|
|
196
|
+
const view = this.view
|
|
197
|
+
if (!view) {
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
this.updateElement()
|
|
201
|
+
if (new_views.includes(view)) {
|
|
202
|
+
this.props.parent.rerender_(view)
|
|
156
203
|
}
|
|
157
204
|
}
|
|
158
|
-
|
|
205
|
+
this.props.parent.on_child_render(this.props.name, this.render_callback)
|
|
206
|
+
this.props.parent.notify_mount(this.props.name, view.model.id)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
componentWillUnmount() {
|
|
210
|
+
if (this.render_callback) {
|
|
211
|
+
this.props.parent.remove_on_child_render(this.props.name, this.render_callback)
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
componentDidUpdate() {
|
|
216
|
+
this.updateElement()
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
render() {
|
|
220
|
+
return React.createElement('div', {className: "child-wrapper", ref: this.containerRef})
|
|
221
|
+
}
|
|
159
222
|
}
|
|
160
|
-
}
|
|
161
223
|
|
|
162
|
-
function react_getter(target, name) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
224
|
+
function react_getter(target, name) {
|
|
225
|
+
if (name === "useMount") {
|
|
226
|
+
return (callback) => React.useEffect(() => {
|
|
227
|
+
target.model_proxy.on('lifecycle:mounted', callback)
|
|
228
|
+
return () => target.model_proxy.off('lifecycle:mounted', callback)
|
|
229
|
+
}, [])
|
|
230
|
+
} if (name == "useState") {
|
|
231
|
+
return (prop) => {
|
|
232
|
+
const data_model = target.model.data
|
|
233
|
+
const propPath = prop.split(".")
|
|
234
|
+
let targetModel = data_model
|
|
235
|
+
let resolvedProp = null
|
|
174
236
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
237
|
+
for (let i = 0; i < propPath.length - 1; i++) {
|
|
238
|
+
if (targetModel && targetModel.properties && propPath[i] in targetModel.properties) {
|
|
239
|
+
targetModel = targetModel[propPath[i]]
|
|
240
|
+
} else {
|
|
241
|
+
// Stop if any part of the path is missing
|
|
242
|
+
targetModel = null
|
|
243
|
+
break
|
|
244
|
+
}
|
|
182
245
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const [value, setValue] = React.useState(targetModel.attributes[resolvedProp])
|
|
246
|
+
if (targetModel && targetModel.attributes && propPath[propPath.length - 1] in targetModel.attributes) {
|
|
247
|
+
resolvedProp = propPath[propPath.length - 1]
|
|
248
|
+
}
|
|
249
|
+
if (resolvedProp && targetModel) {
|
|
250
|
+
const [value, setValue] = React.useState(targetModel.attributes[resolvedProp])
|
|
189
251
|
|
|
190
|
-
|
|
252
|
+
react_proxy.on(prop, () => setValue(targetModel.attributes[resolvedProp]))
|
|
191
253
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
254
|
+
React.useEffect(() => {
|
|
255
|
+
targetModel.setv({ [resolvedProp]: value })
|
|
256
|
+
}, [value])
|
|
195
257
|
|
|
196
|
-
|
|
258
|
+
return [value, setValue]
|
|
259
|
+
}
|
|
260
|
+
throw ReferenceError("Could not resolve " + prop + " on " + target.model.class_name)
|
|
197
261
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
React.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
} else {
|
|
222
|
-
return React.createElement(Child, {parent: target, name: child})
|
|
262
|
+
} else if (name === "get_child") {
|
|
263
|
+
return (child) => {
|
|
264
|
+
const data_model = target.model.data
|
|
265
|
+
const value = data_model.attributes[child]
|
|
266
|
+
if (Array.isArray(value)) {
|
|
267
|
+
const [children_state, set_children] = React.useState(value.map((model) =>
|
|
268
|
+
React.createElement(Child, { parent: target, name: child, key: model.id, id: model.id })
|
|
269
|
+
))
|
|
270
|
+
React.useEffect(() => {
|
|
271
|
+
target.on_child_render(child, () => {
|
|
272
|
+
const current_models = data_model.attributes[child]
|
|
273
|
+
const previous_models = children_state.map(child => child.props.index)
|
|
274
|
+
if (current_models.some((model, i) => model.id !== previous_models[i])) {
|
|
275
|
+
set_children(current_models.map((model, i) => (
|
|
276
|
+
React.createElement(Child, { parent: target, name: child, key: model.id, id: model.id })
|
|
277
|
+
)))
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
}, [])
|
|
281
|
+
return children_state
|
|
282
|
+
} else {
|
|
283
|
+
return React.createElement(Child, {parent: target, name: child})
|
|
284
|
+
}
|
|
223
285
|
}
|
|
224
286
|
}
|
|
287
|
+
return target.model_getter(target, name)
|
|
225
288
|
}
|
|
226
|
-
return target.model_getter(target, name)
|
|
227
|
-
}
|
|
228
289
|
|
|
229
|
-
const react_proxy = new Proxy(view, {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
})
|
|
290
|
+
const react_proxy = new Proxy(view, {
|
|
291
|
+
get: react_getter,
|
|
292
|
+
set: view.model_setter
|
|
293
|
+
})
|
|
233
294
|
|
|
234
|
-
class ErrorBoundary extends React.Component {
|
|
295
|
+
class ErrorBoundary extends React.Component {
|
|
235
296
|
constructor(props) {
|
|
236
297
|
super(props)
|
|
237
298
|
// initialize the error state
|
|
@@ -253,35 +314,34 @@ class ErrorBoundary extends React.Component {
|
|
|
253
314
|
}
|
|
254
315
|
return React.createElement('div', {className: "error-wrapper"}, this.props.children)
|
|
255
316
|
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
class Component extends React.Component {
|
|
259
|
-
|
|
260
|
-
constructor(props) {
|
|
261
|
-
super(props)
|
|
262
|
-
${init_code}
|
|
263
317
|
}
|
|
264
318
|
|
|
265
|
-
|
|
266
|
-
|
|
319
|
+
class Component extends React.Component {
|
|
320
|
+
|
|
321
|
+
constructor(props) {
|
|
322
|
+
super(props)
|
|
267
323
|
${init_code}
|
|
268
|
-
|
|
269
|
-
})
|
|
270
|
-
this.props.view._changing = false
|
|
271
|
-
this.props.view.after_rendered()
|
|
272
|
-
}
|
|
324
|
+
}
|
|
273
325
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
326
|
+
componentDidMount() {
|
|
327
|
+
this.props.view.on_force_update(() => {
|
|
328
|
+
${init_code}
|
|
329
|
+
this.forceUpdate()
|
|
330
|
+
})
|
|
331
|
+
this.props.view._changing = false
|
|
332
|
+
this.props.view.after_rendered()
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
render() {
|
|
336
|
+
let rendered = React.createElement(this.props.view.render_fn, this.props)
|
|
337
|
+
if (this.props.view.model.dev) {
|
|
338
|
+
rendered = React.createElement(ErrorBoundary, {view}, rendered)
|
|
339
|
+
}
|
|
340
|
+
${render_code}
|
|
341
|
+
return rendered
|
|
278
342
|
}
|
|
279
|
-
${render_code}
|
|
280
|
-
return rendered
|
|
281
343
|
}
|
|
282
|
-
}
|
|
283
344
|
|
|
284
|
-
function render() {
|
|
285
345
|
const props = {view, model: react_proxy, data: view.model.data, el: view.container}
|
|
286
346
|
const rendered = React.createElement(Component, props)
|
|
287
347
|
if (rendered) {
|
|
@@ -309,19 +369,6 @@ function render() {
|
|
|
309
369
|
|
|
310
370
|
export default {render}`;
|
|
311
371
|
}
|
|
312
|
-
}
|
|
313
|
-
export class ReactComponent extends ReactiveESM {
|
|
314
|
-
static __name__ = "ReactComponent";
|
|
315
|
-
sucrase_transforms = ["typescript", "jsx"];
|
|
316
|
-
constructor(attrs) {
|
|
317
|
-
super(attrs);
|
|
318
|
-
}
|
|
319
|
-
get usesMui() {
|
|
320
|
-
if (this.importmap?.imports) {
|
|
321
|
-
return Object.keys(this.importmap?.imports).some(k => k.startsWith("@mui"));
|
|
322
|
-
}
|
|
323
|
-
return false;
|
|
324
|
-
}
|
|
325
372
|
compile() {
|
|
326
373
|
const compiled = super.compile();
|
|
327
374
|
if (this.bundle) {
|
|
@@ -335,6 +382,10 @@ import * as React from "react"
|
|
|
335
382
|
|
|
336
383
|
${compiled}`;
|
|
337
384
|
}
|
|
385
|
+
get _render_cache_key() {
|
|
386
|
+
const cache_key = (this.bundle === "url") ? this.esm : (this.bundle || `${this.class_name}-${this.esm.length}`);
|
|
387
|
+
return `react-${this.usesMui}-${cache_key}`;
|
|
388
|
+
}
|
|
338
389
|
static __module__ = "panel.models.esm";
|
|
339
390
|
static {
|
|
340
391
|
this.prototype.default_view = ReactComponentView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react_component.js","sourceRoot":"","sources":["../../../models/react_component.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,GACzD,MAAM,gBAAgB,CAAA;AAEvB,MAAM,OAAO,kBAAmB,SAAQ,eAAe;;IAGrD,YAAY,GAAG,YAAY,CAAA;IAC3B,YAAY,GAAG,YAAY,CAAA;IAC3B,UAAU,CAAK;IAEf,uBAAuB,GAAmB,EAAE,CAAA;IAEnC,UAAU;QACjB,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"react_component.js","sourceRoot":"","sources":["../../../models/react_component.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,GACzD,MAAM,gBAAgB,CAAA;AAEvB,MAAM,OAAO,kBAAmB,SAAQ,eAAe;;IAGrD,YAAY,GAAG,YAAY,CAAA;IAC3B,YAAY,GAAG,YAAY,CAAA;IAC3B,UAAU,CAAK;IAEf,uBAAuB,GAAmB,EA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AY,GAAG,kBAAkB,CAAA;QAChD,IAAI,CAAC,MAAM,CAAuB,CAAC,EAAC,QAAQ,EAAE,GAAG,EAAC,EAAE,EAAE,CAAC,CAAC;YACtD,SAAS,EAAG,CAAE,QAAQ,CAAC,GAAG,CAAC,EAAM,IAAI,CAAE;SACxC,CAAC,CAAC,CAAA;IACL,CAAC"}
|
|
@@ -23,7 +23,6 @@ export declare class ReactiveESMView extends HTMLBoxView {
|
|
|
23
23
|
accessed_children: string[];
|
|
24
24
|
compiled_module: any;
|
|
25
25
|
model_proxy: any;
|
|
26
|
-
render_module: Promise<any> | null;
|
|
27
26
|
_changing: boolean;
|
|
28
27
|
_child_callbacks: Map<string, ((new_views: UIElementView[]) => void)[]>;
|
|
29
28
|
_child_rendered: Map<UIElementView, boolean>;
|
|
@@ -34,7 +33,6 @@ export declare class ReactiveESMView extends HTMLBoxView {
|
|
|
34
33
|
_stale_children: boolean;
|
|
35
34
|
_mounted: Map<string, Set<string>>;
|
|
36
35
|
initialize(): void;
|
|
37
|
-
init_module(): void;
|
|
38
36
|
lazy_initialize(): Promise<void>;
|
|
39
37
|
stylesheets(): StyleSheetLike[];
|
|
40
38
|
connect_signals(): void;
|
|
@@ -47,7 +45,6 @@ export declare class ReactiveESMView extends HTMLBoxView {
|
|
|
47
45
|
get child_models(): LayoutDOM[];
|
|
48
46
|
render_error(error: SyntaxError): void;
|
|
49
47
|
render(): void;
|
|
50
|
-
protected _render_code(): string;
|
|
51
48
|
after_rendered(): void;
|
|
52
49
|
render_esm(): void;
|
|
53
50
|
render_children(): void;
|
|
@@ -80,6 +77,7 @@ export declare class ReactiveESM extends HTMLBox {
|
|
|
80
77
|
compiled_module: Promise<any> | null;
|
|
81
78
|
compile_error: Error | null;
|
|
82
79
|
model_proxy: any;
|
|
80
|
+
render_module: Promise<any> | null;
|
|
83
81
|
sucrase_transforms: Transform[];
|
|
84
82
|
_destroyer: any | null;
|
|
85
83
|
_esm_watchers: any;
|
|
@@ -92,6 +90,9 @@ export declare class ReactiveESM extends HTMLBox {
|
|
|
92
90
|
protected _declare_importmap(): void;
|
|
93
91
|
protected _run_initializer(initialize: (props: any) => any): void;
|
|
94
92
|
destroy(): void;
|
|
93
|
+
init_module(): void;
|
|
94
|
+
protected _render_code(): string;
|
|
95
|
+
protected get _render_cache_key(): string;
|
|
95
96
|
compile(): string | null;
|
|
96
97
|
recompile(): Promise<void>;
|
|
97
98
|
static __module__: string;
|