@iwsdk/vite-plugin-dev 0.5.0 → 0.5.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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/editor/editor-workspace.d.ts +7 -0
- package/dist/editor/editor-workspace.js +64 -2
- package/dist/editor/editor-workspace.js.map +1 -1
- package/dist/index.js +1992 -195
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/uikitml-preflight.d.ts +12 -0
- package/package.json +21 -19
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -75,6 +75,9 @@ iwsdkDev({
|
|
|
75
75
|
// Set `false` for HTTP, or pass generation options such as `domains`.
|
|
76
76
|
https: true,
|
|
77
77
|
|
|
78
|
+
// Wait for the managed browser command bridge after launch or recovery.
|
|
79
|
+
bridgeReadyTimeoutMs: 5000, // default
|
|
80
|
+
|
|
78
81
|
// Enable verbose logging
|
|
79
82
|
verbose: false, // default
|
|
80
83
|
});
|
|
@@ -27,7 +27,11 @@ export interface EditorWorkspaceSnapshot {
|
|
|
27
27
|
statusStrip: string;
|
|
28
28
|
transformMode: 'translate' | 'rotate' | 'scale';
|
|
29
29
|
transformSnapEnabled: boolean;
|
|
30
|
+
transformSnapRotationDeg: number;
|
|
31
|
+
transformSnapScale: number;
|
|
32
|
+
transformSnapTranslation: number;
|
|
30
33
|
transformSpace: 'local' | 'world';
|
|
34
|
+
viewportDrawDistance: number;
|
|
31
35
|
view: WorkspaceView;
|
|
32
36
|
}
|
|
33
37
|
export interface EditorWorkspaceController {
|
|
@@ -41,6 +45,7 @@ export interface EditorWorkspaceController {
|
|
|
41
45
|
x: number;
|
|
42
46
|
y: number;
|
|
43
47
|
}): void;
|
|
48
|
+
openRuntimeInBrowser?(): void;
|
|
44
49
|
redo?(): void;
|
|
45
50
|
reloadPage?(): void;
|
|
46
51
|
selectNode?(nodeId: string, modifiers: {
|
|
@@ -51,7 +56,9 @@ export interface EditorWorkspaceController {
|
|
|
51
56
|
selectBuiltin?(target: string): void;
|
|
52
57
|
selectRoot?(): void;
|
|
53
58
|
setTransformMode?(mode: 'translate' | 'rotate' | 'scale'): void;
|
|
59
|
+
setTransformSnap?(mode: 'translate' | 'rotate' | 'scale', value: number): void;
|
|
54
60
|
setTransformSpace?(space: 'local' | 'world'): void;
|
|
61
|
+
setViewportDrawDistance?(distance: number): void;
|
|
55
62
|
setView?(view: WorkspaceView): void;
|
|
56
63
|
toggleNodeExpanded?(nodeId: string): void;
|
|
57
64
|
toggleNodeVisibility?(nodeId: string): void;
|
|
@@ -180,6 +180,24 @@ const Earth = [
|
|
|
180
180
|
*/
|
|
181
181
|
|
|
182
182
|
|
|
183
|
+
const ExternalLink = [
|
|
184
|
+
"svg",
|
|
185
|
+
defaultAttributes,
|
|
186
|
+
[
|
|
187
|
+
["path", { d: "M15 3h6v6" }],
|
|
188
|
+
["path", { d: "M10 14 21 3" }],
|
|
189
|
+
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }]
|
|
190
|
+
]
|
|
191
|
+
];
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @license lucide v0.468.0 - ISC
|
|
195
|
+
*
|
|
196
|
+
* This source code is licensed under the ISC license.
|
|
197
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
|
|
183
201
|
const EyeOff = [
|
|
184
202
|
"svg",
|
|
185
203
|
defaultAttributes,
|
|
@@ -504,7 +522,11 @@ const DEFAULT_SNAPSHOT = {
|
|
|
504
522
|
statusStrip: 'Scene loading...',
|
|
505
523
|
transformMode: 'translate',
|
|
506
524
|
transformSnapEnabled: false,
|
|
525
|
+
transformSnapRotationDeg: 15,
|
|
526
|
+
transformSnapScale: 0.1,
|
|
527
|
+
transformSnapTranslation: 0.25,
|
|
507
528
|
transformSpace: 'local',
|
|
529
|
+
viewportDrawDistance: 5000,
|
|
508
530
|
view: 'runtime',
|
|
509
531
|
};
|
|
510
532
|
const ICONS = {
|
|
@@ -516,6 +538,7 @@ const ICONS = {
|
|
|
516
538
|
Crosshair,
|
|
517
539
|
Eye,
|
|
518
540
|
EyeOff,
|
|
541
|
+
ExternalLink,
|
|
519
542
|
Focus,
|
|
520
543
|
Gamepad2,
|
|
521
544
|
Globe2: Earth,
|
|
@@ -558,13 +581,52 @@ function useSignalValue(state) {
|
|
|
558
581
|
return value;
|
|
559
582
|
}
|
|
560
583
|
function WorkspaceViewSwitcher({ controller, snapshot, }) {
|
|
561
|
-
return (u$1("div", { class: "workspace-view-switcher", "aria-label": "Workspace view", children: [['runtime', 'editor'].map((view) => (u$1("button", { "data-active": snapshot.view === view || undefined, "data-workspace-view-button": view, onClick: () => controller.setView?.(view), children: view === 'runtime' ? 'Runtime' : 'Editor' }, view))), u$1("button", { type: "button", class: "workspace-reload-button", "data-workspace-reload-button": true, title: "Reload page", "aria-label": "Reload page", onClick: () => controller.reloadPage?.(), children: u$1(Icon, { name: "RefreshCw" }) })] }));
|
|
584
|
+
return (u$1("div", { class: "workspace-view-switcher", "aria-label": "Workspace view", children: [['runtime', 'editor'].map((view) => (u$1("button", { "data-active": snapshot.view === view || undefined, "data-workspace-view-button": view, onClick: () => controller.setView?.(view), children: view === 'runtime' ? 'Runtime' : 'Editor' }, view))), u$1("button", { type: "button", class: "workspace-icon-button workspace-reload-button", "data-workspace-reload-button": true, title: "Reload page", "aria-label": "Reload page", onClick: () => controller.reloadPage?.(), children: u$1(Icon, { name: "RefreshCw" }) }), u$1("button", { type: "button", class: "workspace-icon-button", "data-workspace-open-browser-button": true, title: "Open runtime in default browser", "aria-label": "Open runtime in default browser", onClick: () => controller.openRuntimeInBrowser?.(), children: u$1(Icon, { name: "ExternalLink" }) })] }));
|
|
562
585
|
}
|
|
563
586
|
function EditorViewport({ controller, snapshot, }) {
|
|
564
587
|
return (u$1("section", { class: "editor-viewport", children: [u$1(EditorToolbar, { snapshot: snapshot, controller: controller }), u$1("div", { id: "scene-viewport", children: [u$1("div", { id: "orientation-gizmo", "aria-label": "Interactive orientation gizmo" }), u$1("div", { class: "editor-slot viewport-overlay-slot", "data-editor-slot": "viewport.overlay" })] }), u$1("section", { id: "editor-bottom-panel", class: "editor-bottom-panel", "aria-label": "Scene diagnostics", children: [u$1("div", { class: "bottom-panel-tabs", role: "tablist", children: [u$1("button", { "data-bottom-tab": "assets", "data-active": true, children: "Assets" }), u$1("button", { "data-bottom-tab": "console", children: "Console" }), u$1("button", { "data-bottom-tab": "validation", children: "Validation" })] }), u$1(AssetBrowser, { snapshot: snapshot, controller: controller }), u$1("div", { id: "bottom-panel-content", class: "bottom-panel-content" })] }), u$1("div", { id: "editor-status-strip", "aria-live": "polite", "data-state": snapshot.dirty ? 'dirty' : 'saved', children: snapshot.statusStrip })] }));
|
|
565
588
|
}
|
|
566
589
|
function EditorToolbar({ controller, snapshot, }) {
|
|
567
|
-
|
|
590
|
+
const snapControl = snapshot.transformMode === 'rotate'
|
|
591
|
+
? {
|
|
592
|
+
label: 'Rotation snap interval',
|
|
593
|
+
max: 180,
|
|
594
|
+
min: 0.1,
|
|
595
|
+
step: 0.1,
|
|
596
|
+
suffix: '°',
|
|
597
|
+
title: 'Rotation snapping interval in degrees',
|
|
598
|
+
value: snapshot.transformSnapRotationDeg,
|
|
599
|
+
}
|
|
600
|
+
: snapshot.transformMode === 'scale'
|
|
601
|
+
? {
|
|
602
|
+
label: 'Scale snap interval',
|
|
603
|
+
max: 10,
|
|
604
|
+
min: 0.001,
|
|
605
|
+
step: 0.01,
|
|
606
|
+
suffix: '×',
|
|
607
|
+
title: 'Scale factor snapping interval (0.1× equals 10 percentage-point steps)',
|
|
608
|
+
value: snapshot.transformSnapScale,
|
|
609
|
+
}
|
|
610
|
+
: {
|
|
611
|
+
label: 'Move snap interval',
|
|
612
|
+
max: 10000,
|
|
613
|
+
min: 0.001,
|
|
614
|
+
step: 0.001,
|
|
615
|
+
suffix: 'm',
|
|
616
|
+
title: 'Movement snapping interval in meters',
|
|
617
|
+
value: snapshot.transformSnapTranslation,
|
|
618
|
+
};
|
|
619
|
+
return (u$1("div", { class: "editor-toolbar", "aria-label": "Scene editor tools", children: [u$1("div", { class: "editor-slot toolbar-slot", "data-editor-slot": "toolbar.left" }), u$1("div", { id: "transform-toolbar", class: "toolbar-group", "aria-label": "Transform controls", children: [u$1(IconButton, { active: snapshot.transformMode === 'translate', icon: "Move3D", label: "Move", data: { 'data-transform-mode': 'translate' }, onClick: () => controller.setTransformMode?.('translate') }), u$1(IconButton, { active: snapshot.transformMode === 'rotate', icon: "Rotate3D", label: "Rotate", data: { 'data-transform-mode': 'rotate' }, onClick: () => controller.setTransformMode?.('rotate') }), u$1(IconButton, { active: snapshot.transformMode === 'scale', icon: "Scale3D", label: "Scale", data: { 'data-transform-mode': 'scale' }, onClick: () => controller.setTransformMode?.('scale') })] }), u$1("div", { class: "toolbar-group", "aria-label": "Transform snapping", children: [u$1(IconButton, { active: snapshot.transformSnapEnabled, icon: "Magnet", label: "Snap", data: { 'data-transform-snap': '' }, onClick: () => controller.toggleTransformSnap?.() }), u$1("label", { class: "transform-snap-control", title: snapControl.title, children: [u$1("input", { "aria-label": snapControl.label, "data-transform-snap-interval": snapshot.transformMode, max: snapControl.max, min: snapControl.min, step: snapControl.step, type: "number", value: snapControl.value, onBlur: (event) => {
|
|
620
|
+
const value = event.currentTarget.valueAsNumber;
|
|
621
|
+
if (Number.isFinite(value)) {
|
|
622
|
+
controller.setTransformSnap?.(snapshot.transformMode, value);
|
|
623
|
+
}
|
|
624
|
+
} }), u$1("span", { children: snapControl.suffix })] })] }), u$1("div", { class: "toolbar-group", "aria-label": "Transform space", children: [u$1(IconButton, { active: snapshot.transformSpace === 'local', icon: "Box", label: "Local space", data: { 'data-transform-space': 'local' }, onClick: () => controller.setTransformSpace?.('local') }), u$1(IconButton, { active: snapshot.transformSpace === 'world', icon: "Globe2", label: "World space", data: { 'data-transform-space': 'world' }, onClick: () => controller.setTransformSpace?.('world') })] }), u$1("div", { class: "editor-slot toolbar-slot", "data-editor-slot": "toolbar.center" }), u$1("div", { class: "toolbar-group", "aria-label": "Document history", children: [u$1(IconButton, { icon: "Undo2", label: "Undo", id: "undo", onClick: () => controller.undo?.() }), u$1(IconButton, { icon: "Redo2", label: "Redo", id: "redo", onClick: () => controller.redo?.() })] }), u$1("div", { class: "toolbar-group", "aria-label": "Viewport settings", children: u$1("label", { class: "viewport-distance-control", title: "Editor viewport far clipping distance", children: [u$1("span", { children: "View" }), u$1("input", { "aria-label": "View distance", "data-viewport-draw-distance": true, min: "50", max: "100000", step: "100", type: "number", value: snapshot.viewportDrawDistance, onBlur: (event) => {
|
|
625
|
+
const distance = event.currentTarget.valueAsNumber;
|
|
626
|
+
if (Number.isFinite(distance)) {
|
|
627
|
+
controller.setViewportDrawDistance?.(distance);
|
|
628
|
+
}
|
|
629
|
+
} }), u$1("span", { children: "m" })] }) }), u$1("div", { class: "editor-slot toolbar-slot", "data-editor-slot": "toolbar.right" })] }));
|
|
568
630
|
}
|
|
569
631
|
function IconButton({ active = false, data = {}, disabled = false, icon, id, label, onClick, }) {
|
|
570
632
|
return (u$1("button", { ...data, id: id, class: "icon-button", "data-active": active || undefined, disabled: disabled, title: label, "aria-label": label, onClick: onClick, children: u$1(Icon, { name: icon }) }));
|