@selvajs/ui 6.6.0-beta.5 → 6.6.0-beta.6
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/components/compute/AppLayout.svelte +6 -3
- package/dist/components/compute/AppLayout.svelte.d.ts +5 -0
- package/dist/components/compute/ComputeApp.svelte +1 -0
- package/dist/components/preview/ChartOutput.svelte +5 -1
- package/dist/utils/loadScript.d.ts +2 -0
- package/dist/utils/loadScript.js +2 -0
- package/package.json +8 -8
- package/src/lib/components/compute/AppLayout.svelte +6 -3
- package/src/lib/components/compute/ComputeApp.svelte +1 -0
- package/src/lib/components/preview/ChartOutput.svelte +5 -1
- package/src/lib/utils/loadScript.ts +3 -0
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
|
|
27
27
|
interface Props {
|
|
28
28
|
schema: UISchema;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to draw the 3D viewer. Each host reads its own switch: the plugin's preview
|
|
31
|
+
* `viewerOptions.enableLocal`, a Rhino.Compute host `viewerOptions.enableRemote`.
|
|
32
|
+
*/
|
|
33
|
+
showViewer: boolean;
|
|
29
34
|
meshes?: any[];
|
|
30
35
|
isSolving: boolean;
|
|
31
36
|
showSolvingIndicator?: boolean;
|
|
@@ -54,6 +59,7 @@
|
|
|
54
59
|
|
|
55
60
|
let {
|
|
56
61
|
schema,
|
|
62
|
+
showViewer: hasViewer,
|
|
57
63
|
meshes = [],
|
|
58
64
|
isSolving,
|
|
59
65
|
showSolvingIndicator = false,
|
|
@@ -81,9 +87,6 @@
|
|
|
81
87
|
const hasMenu = $derived(showSaveButton || showLoadButton || panelActions.length > 0);
|
|
82
88
|
const resultIsStale = $derived(hasPendingChanges || hasNeverSolved);
|
|
83
89
|
|
|
84
|
-
const hasViewer = $derived(
|
|
85
|
-
!!(schema?.viewerOptions?.enableLocal || schema?.viewerOptions?.enableRemote)
|
|
86
|
-
);
|
|
87
90
|
const shownTabs = $derived(
|
|
88
91
|
schema.layout.type === 'tabbed'
|
|
89
92
|
? schema.layout.tabs.filter((tab) => isTabVisible(tab, values))
|
|
@@ -6,6 +6,11 @@ import type { ThreeViewer } from '@selvajs/visualization/render';
|
|
|
6
6
|
import { type ViewerConfig } from '../viewer/Viewer.svelte';
|
|
7
7
|
interface Props {
|
|
8
8
|
schema: UISchema;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to draw the 3D viewer. Each host reads its own switch: the plugin's preview
|
|
11
|
+
* `viewerOptions.enableLocal`, a Rhino.Compute host `viewerOptions.enableRemote`.
|
|
12
|
+
*/
|
|
13
|
+
showViewer: boolean;
|
|
9
14
|
meshes?: any[];
|
|
10
15
|
isSolving: boolean;
|
|
11
16
|
showSolvingIndicator?: boolean;
|
|
@@ -45,7 +45,11 @@
|
|
|
45
45
|
// @ts-expect-error — Plotly is loaded dynamically onto window
|
|
46
46
|
if (window.Plotly) return window.Plotly;
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
// Pinned by hash: the plugin's web UI runs this on the origin that holds its bridge secret.
|
|
49
|
+
await loadScript('https://cdn.plot.ly/plotly-3.4.0.min.js', {
|
|
50
|
+
crossOrigin: 'anonymous',
|
|
51
|
+
integrity: 'sha384-pFOQ7loGBChmUyS4Tszy+he8OWeYkwTFjc2xii4aJUWWiGwf2u2OEc04T5iDRpMp'
|
|
52
|
+
});
|
|
49
53
|
// @ts-expect-error — Plotly is loaded dynamically onto window
|
|
50
54
|
return window.Plotly;
|
|
51
55
|
}
|
package/dist/utils/loadScript.js
CHANGED
|
@@ -17,6 +17,8 @@ export function loadScript(src, options) {
|
|
|
17
17
|
script.src = src;
|
|
18
18
|
if (options?.crossOrigin)
|
|
19
19
|
script.crossOrigin = options.crossOrigin;
|
|
20
|
+
if (options?.integrity)
|
|
21
|
+
script.integrity = options.integrity;
|
|
20
22
|
if (options?.async !== undefined)
|
|
21
23
|
script.async = options.async;
|
|
22
24
|
if (options?.defer !== undefined)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selvajs/ui",
|
|
3
|
-
"version": "6.6.0-beta.
|
|
3
|
+
"version": "6.6.0-beta.6",
|
|
4
4
|
"description": "Shared UI components and utilities for Selva applications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "VektorNode",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"svelte": "^5",
|
|
60
60
|
"tailwind-variants": "^3.3.1",
|
|
61
61
|
"three": "^0.186.1",
|
|
62
|
-
"@selvajs/compute": "^4.
|
|
63
|
-
"@selvajs/schemas": "^5.
|
|
64
|
-
"@selvajs/
|
|
65
|
-
"@selvajs/
|
|
62
|
+
"@selvajs/compute": "^4.3.0-beta.1",
|
|
63
|
+
"@selvajs/schemas": "^5.3.0-beta.0",
|
|
64
|
+
"@selvajs/visualization": "^1.5.0",
|
|
65
|
+
"@selvajs/solve": "^1.3.0-beta.3"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"three": {
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"svelte": "5.57.1",
|
|
91
91
|
"tailwind-variants": "^3.3.1",
|
|
92
92
|
"vitest": "^5.0.2",
|
|
93
|
-
"@selvajs/compute": "4.
|
|
93
|
+
"@selvajs/compute": "4.3.0-beta.1",
|
|
94
94
|
"@selvajs/config": "0.0.4",
|
|
95
95
|
"@selvajs/visualization": "1.5.0",
|
|
96
|
-
"@selvajs/
|
|
97
|
-
"@selvajs/
|
|
96
|
+
"@selvajs/schemas": "5.3.0-beta.0",
|
|
97
|
+
"@selvajs/solve": "1.3.0-beta.3"
|
|
98
98
|
},
|
|
99
99
|
"scripts": {
|
|
100
100
|
"predev": "node ../../scripts/sync-shared-assets.js",
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
|
|
27
27
|
interface Props {
|
|
28
28
|
schema: UISchema;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to draw the 3D viewer. Each host reads its own switch: the plugin's preview
|
|
31
|
+
* `viewerOptions.enableLocal`, a Rhino.Compute host `viewerOptions.enableRemote`.
|
|
32
|
+
*/
|
|
33
|
+
showViewer: boolean;
|
|
29
34
|
meshes?: any[];
|
|
30
35
|
isSolving: boolean;
|
|
31
36
|
showSolvingIndicator?: boolean;
|
|
@@ -54,6 +59,7 @@
|
|
|
54
59
|
|
|
55
60
|
let {
|
|
56
61
|
schema,
|
|
62
|
+
showViewer: hasViewer,
|
|
57
63
|
meshes = [],
|
|
58
64
|
isSolving,
|
|
59
65
|
showSolvingIndicator = false,
|
|
@@ -81,9 +87,6 @@
|
|
|
81
87
|
const hasMenu = $derived(showSaveButton || showLoadButton || panelActions.length > 0);
|
|
82
88
|
const resultIsStale = $derived(hasPendingChanges || hasNeverSolved);
|
|
83
89
|
|
|
84
|
-
const hasViewer = $derived(
|
|
85
|
-
!!(schema?.viewerOptions?.enableLocal || schema?.viewerOptions?.enableRemote)
|
|
86
|
-
);
|
|
87
90
|
const shownTabs = $derived(
|
|
88
91
|
schema.layout.type === 'tabbed'
|
|
89
92
|
? schema.layout.tabs.filter((tab) => isTabVisible(tab, values))
|
|
@@ -45,7 +45,11 @@
|
|
|
45
45
|
// @ts-expect-error — Plotly is loaded dynamically onto window
|
|
46
46
|
if (window.Plotly) return window.Plotly;
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
// Pinned by hash: the plugin's web UI runs this on the origin that holds its bridge secret.
|
|
49
|
+
await loadScript('https://cdn.plot.ly/plotly-3.4.0.min.js', {
|
|
50
|
+
crossOrigin: 'anonymous',
|
|
51
|
+
integrity: 'sha384-pFOQ7loGBChmUyS4Tszy+he8OWeYkwTFjc2xii4aJUWWiGwf2u2OEc04T5iDRpMp'
|
|
52
|
+
});
|
|
49
53
|
// @ts-expect-error — Plotly is loaded dynamically onto window
|
|
50
54
|
return window.Plotly;
|
|
51
55
|
}
|
|
@@ -8,6 +8,8 @@ export function loadScript(
|
|
|
8
8
|
src: string,
|
|
9
9
|
options?: {
|
|
10
10
|
crossOrigin?: string;
|
|
11
|
+
/** Subresource Integrity hash. A cross-origin script also needs `crossOrigin`. */
|
|
12
|
+
integrity?: string;
|
|
11
13
|
async?: boolean;
|
|
12
14
|
defer?: boolean;
|
|
13
15
|
}
|
|
@@ -26,6 +28,7 @@ export function loadScript(
|
|
|
26
28
|
const script = document.createElement('script');
|
|
27
29
|
script.src = src;
|
|
28
30
|
if (options?.crossOrigin) script.crossOrigin = options.crossOrigin;
|
|
31
|
+
if (options?.integrity) script.integrity = options.integrity;
|
|
29
32
|
if (options?.async !== undefined) script.async = options.async;
|
|
30
33
|
if (options?.defer !== undefined) script.defer = options.defer;
|
|
31
34
|
|