architwin 1.12.5 → 1.13.1
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/CORE_FEATURES.md +35 -0
- package/lib/architwin.d.ts +96 -5
- package/lib/architwin.js +1 -1
- package/lib/atwinui/components/toolbar/collapse.d.ts +18 -0
- package/lib/atwinui/components/toolbar/collapse.js +62 -0
- package/lib/atwinui/components/toolbar/i18n.js +56 -4
- package/lib/atwinui/components/toolbar/index.js +11 -1
- package/lib/atwinui/components/toolbar/menuBar.d.ts +1 -0
- package/lib/atwinui/components/toolbar/menuBar.js +11 -0
- package/lib/atwinui/components/toolbar/pipeFormPane.d.ts +31 -0
- package/lib/atwinui/components/toolbar/pipeFormPane.js +545 -0
- package/lib/atwinui/components/toolbar/pipeListPane.d.ts +19 -0
- package/lib/atwinui/components/toolbar/pipeListPane.js +388 -0
- package/lib/atwinui/components/toolbar/spaceUserListPane.d.ts +3 -0
- package/lib/atwinui/components/toolbar/spaceUserListPane.js +95 -0
- package/lib/atwinui/components/toolbar/tagFormPane.d.ts +1 -0
- package/lib/atwinui/components/toolbar/tagFormPane.js +4 -1
- package/lib/atwinui/components/toolbar/tagIotForm.d.ts +20 -0
- package/lib/atwinui/components/toolbar/tagIotForm.js +391 -0
- package/lib/atwinui/components/toolbar/tagIotFormPane.d.ts +62 -0
- package/lib/atwinui/components/toolbar/tagIotFormPane.js +606 -0
- package/lib/atwinui/components/toolbar/tagMessagingPane.js +5 -5
- package/lib/atwinui/components/toolbar/usersPane.d.ts +14 -0
- package/lib/atwinui/components/toolbar/usersPane.js +273 -0
- package/lib/atwinui/components/toolbar/viewingRemoteSpace.d.ts +7 -0
- package/lib/atwinui/components/toolbar/viewingRemoteSpace.js +77 -0
- package/lib/atwinui/events.d.ts +4 -1
- package/lib/atwinui/events.js +96 -15
- package/lib/atwinui/helpers.d.ts +15 -0
- package/lib/atwinui/helpers.js +49 -0
- package/lib/atwinui/index.js +2 -0
- package/lib/loaders/curosrMarkerLoader.d.ts +25 -0
- package/lib/loaders/curosrMarkerLoader.js +86 -0
- package/lib/loaders/index.d.ts +2 -1
- package/lib/loaders/index.js +2 -1
- package/lib/loaders/pathLoader.d.ts +99 -0
- package/lib/loaders/pathLoader.js +451 -0
- package/lib/minimap.d.ts +4 -2
- package/lib/minimap.js +16 -3
- package/lib/types.d.ts +86 -2
- package/lib/types.js +39 -0
- package/package.json +1 -1
- package/static/atwinui.css +263 -0
- package/static/map.css +9 -1
- package/static/utility.css +81 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function waitForChange(...args) {
|
|
2
|
+
const maybeOptions = args[args.length - 1];
|
|
3
|
+
const options = typeof maybeOptions === 'object' && ('interval' in maybeOptions || 'timeout' in maybeOptions)
|
|
4
|
+
? maybeOptions
|
|
5
|
+
: {};
|
|
6
|
+
const getters = (maybeOptions === options ? args.slice(0, -1) : args);
|
|
7
|
+
const { interval = 100, timeout = 5000 } = options;
|
|
8
|
+
const initial = getters.map(fn => fn());
|
|
9
|
+
const start = Date.now();
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
const check = () => {
|
|
12
|
+
const current = getters.map(fn => fn());
|
|
13
|
+
const hasChanged = current.some((val, i) => val !== initial[i] && val != null);
|
|
14
|
+
if (hasChanged) {
|
|
15
|
+
resolve(getters.length === 1 ? current[0] : current);
|
|
16
|
+
}
|
|
17
|
+
else if (Date.now() - start >= timeout) {
|
|
18
|
+
reject(new Error('Timeout: Values did not change'));
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
setTimeout(check, interval);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
check();
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Binds an input element's value to a target object's property using input and mutation observers.
|
|
29
|
+
* @param input The input HTML element to observe
|
|
30
|
+
* @param getTarget A function returning the target object (like _selectedPipeCategory)
|
|
31
|
+
* @param key The key of the target object to update
|
|
32
|
+
*/
|
|
33
|
+
export function observeInputToUpdate(input, getTarget, key) {
|
|
34
|
+
if (!input)
|
|
35
|
+
return;
|
|
36
|
+
const update = () => {
|
|
37
|
+
const target = getTarget();
|
|
38
|
+
if (target) {
|
|
39
|
+
target[key] = input.value;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const observer = new MutationObserver(update);
|
|
43
|
+
observer.observe(input, {
|
|
44
|
+
attributes: true,
|
|
45
|
+
attributeFilter: ['value'],
|
|
46
|
+
});
|
|
47
|
+
input.addEventListener('input', update);
|
|
48
|
+
console.log("observer ==>", input);
|
|
49
|
+
}
|
package/lib/atwinui/index.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MpSdk } from "../../bundle/sdk";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
import { IMPConfig } from "../types";
|
|
4
|
+
declare class CursorMarkerLoader {
|
|
5
|
+
inputs: {
|
|
6
|
+
pointerIntersection: MpSdk.Pointer.Intersection;
|
|
7
|
+
markerTexture: string;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
offset: number;
|
|
10
|
+
scale: number;
|
|
11
|
+
};
|
|
12
|
+
outputs: Record<string, unknown> & MpSdk.Scene.PredefinedOutputs;
|
|
13
|
+
context: MpSdk.Scene.IComponentContext;
|
|
14
|
+
mesh: THREE.Mesh;
|
|
15
|
+
material: THREE.Material;
|
|
16
|
+
geometry: THREE.PlaneGeometry;
|
|
17
|
+
texture: THREE.Texture;
|
|
18
|
+
constructor(mpConfig: IMPConfig);
|
|
19
|
+
onInit: () => void;
|
|
20
|
+
onInputsUpdated: () => void;
|
|
21
|
+
onDestroy: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const cursorMarkerType = "mp.cursorMarker";
|
|
24
|
+
export declare const cursorMarkerFactory: () => CursorMarkerLoader;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { _mpConfig } from "../architwin";
|
|
2
|
+
// Default asset path (overridden if bundlePath is present in config)
|
|
3
|
+
let _staticAssetPath = '../';
|
|
4
|
+
class CursorMarkerLoader {
|
|
5
|
+
constructor(mpConfig) {
|
|
6
|
+
// === Inputs ===
|
|
7
|
+
this.inputs = {
|
|
8
|
+
pointerIntersection: null,
|
|
9
|
+
markerTexture: null,
|
|
10
|
+
visible: true,
|
|
11
|
+
offset: 0.05,
|
|
12
|
+
scale: 1 // Marker scale multiplier
|
|
13
|
+
};
|
|
14
|
+
// === Initialization ===
|
|
15
|
+
this.onInit = () => {
|
|
16
|
+
console.log('🛠️ CursorMarkerLoader on init', this.inputs.pointerIntersection);
|
|
17
|
+
const THREE = this.context.three;
|
|
18
|
+
if (!this.inputs.pointerIntersection)
|
|
19
|
+
return;
|
|
20
|
+
// Extract position and surface normal from intersection data
|
|
21
|
+
const { position: coord, normal: _normal } = this.inputs.pointerIntersection;
|
|
22
|
+
// Normalize the surface normal
|
|
23
|
+
const normal = new THREE.Vector3(_normal.x, _normal.y, _normal.z).normalize();
|
|
24
|
+
// === Generate rotation quaternion to align marker with surface ===
|
|
25
|
+
// Build a tangent-bitangent-normal (TBN) basis from surface normal
|
|
26
|
+
const up = new THREE.Vector3(0, 0, 1);
|
|
27
|
+
const tangent = new THREE.Vector3().crossVectors(new THREE.Vector3(1, 0, 0), normal).normalize();
|
|
28
|
+
const bitangent = new THREE.Vector3().crossVectors(normal, tangent).normalize();
|
|
29
|
+
const matrix = new THREE.Matrix4().makeBasis(tangent, bitangent, normal);
|
|
30
|
+
// Create quaternion from basis matrix and align Z-up to normal
|
|
31
|
+
const quaternion = new THREE.Quaternion().setFromRotationMatrix(matrix);
|
|
32
|
+
quaternion.setFromUnitVectors(up, normal);
|
|
33
|
+
// Convert to Euler angles for use with Three.js transforms
|
|
34
|
+
const euler = new THREE.Euler().setFromQuaternion(quaternion);
|
|
35
|
+
// Apply offset to position to move slightly off the surface
|
|
36
|
+
const adjustedPosition = new THREE.Vector3(coord.x + normal.x * this.inputs.offset, coord.y + normal.y * this.inputs.offset, coord.z + normal.z * this.inputs.offset);
|
|
37
|
+
// Marker texture fallback
|
|
38
|
+
const markerUrl = this.inputs.markerTexture || `${_staticAssetPath}static/objective.png`;
|
|
39
|
+
// === Load texture and build the marker plane ===
|
|
40
|
+
const loader = new THREE.TextureLoader();
|
|
41
|
+
loader.load(markerUrl, (texture) => {
|
|
42
|
+
this.texture = texture;
|
|
43
|
+
// Define geometry and material for the flat marker plane
|
|
44
|
+
this.geometry = new THREE.PlaneGeometry(0.1, 0.1);
|
|
45
|
+
this.material = new THREE.MeshBasicMaterial({
|
|
46
|
+
map: texture,
|
|
47
|
+
transparent: false,
|
|
48
|
+
opacity: 1,
|
|
49
|
+
side: THREE.DoubleSide,
|
|
50
|
+
});
|
|
51
|
+
// Create the mesh
|
|
52
|
+
this.mesh = new THREE.Mesh(this.geometry, this.material);
|
|
53
|
+
this.mesh.position.copy(adjustedPosition);
|
|
54
|
+
this.mesh.rotation.set(euler.x, euler.y, euler.z);
|
|
55
|
+
this.mesh.name = 'cursorMarker';
|
|
56
|
+
this.mesh.visible = this.inputs.visible;
|
|
57
|
+
// Register output so it can be used as a collider/interactable object
|
|
58
|
+
this.outputs.objectRoot = this.mesh;
|
|
59
|
+
this.outputs.collider = this.mesh;
|
|
60
|
+
console.log('🛠️ CursorMarkerLoader on loader.load', texture);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
// === Triggered when inputs change ===
|
|
64
|
+
this.onInputsUpdated = () => {
|
|
65
|
+
console.log('🛠️ CursorMarkerLoader inputupdated');
|
|
66
|
+
this.onInit();
|
|
67
|
+
};
|
|
68
|
+
// === Cleanup for memory management ===
|
|
69
|
+
this.onDestroy = () => {
|
|
70
|
+
var _a, _b, _c;
|
|
71
|
+
console.log('🛠️ CursorMarkerLoader destroy');
|
|
72
|
+
(_a = this.geometry) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
73
|
+
(_b = this.material) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
74
|
+
(_c = this.texture) === null || _c === void 0 ? void 0 : _c.dispose();
|
|
75
|
+
};
|
|
76
|
+
console.log('🛠️ CursorMarkerLoader constructor called');
|
|
77
|
+
this.outputs = {};
|
|
78
|
+
// Override static asset path if deployed via CDN
|
|
79
|
+
if ('bundlePath' in mpConfig) {
|
|
80
|
+
_staticAssetPath = 'https://cdn.jsdelivr.net/npm/architwin@latest/';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// === Factory and Component Type ===
|
|
85
|
+
export const cursorMarkerType = 'mp.cursorMarker';
|
|
86
|
+
export const cursorMarkerFactory = () => new CursorMarkerLoader(_mpConfig);
|
package/lib/loaders/index.d.ts
CHANGED
|
@@ -9,4 +9,5 @@ import { sweepPuckType, puckBackgroundFactory } from "./sweepPuckLoader";
|
|
|
9
9
|
import { viewpointType, viewpointFactory } from "./viewpointLoader";
|
|
10
10
|
import { tubeLineType, tubeLineFactory, verticeType, verticeFactory, bufferGeometryType, bufferGeometry } from "./polydrawerLoader";
|
|
11
11
|
import { fbxType, fbxFactory } from "./fbxLoader";
|
|
12
|
-
|
|
12
|
+
import { pathPointType, pathPointFactory, pathLineType, pathLineFactory } from "./pathLoader";
|
|
13
|
+
export { planeType, planeFactory, planeTypeImage, planeTypeVideo, planeTypePdf, setHudState, planeImageFactory, planeVideoFactory, planePdfFactory, gltfType, gltfFactory, boxType, boxFactory, textType, textFactory, css3DType, css3DFactory, hudType, hudFactory, sweepPuckType, puckBackgroundFactory, viewpointType, viewpointFactory, tubeLineType, tubeLineFactory, verticeType, verticeFactory, bufferGeometryType, bufferGeometry, fbxType, fbxFactory, pathPointType, pathPointFactory, pathLineType, pathLineFactory };
|
package/lib/loaders/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { sweepPuckType, puckBackgroundFactory } from "./sweepPuckLoader";
|
|
|
9
9
|
import { viewpointType, viewpointFactory } from "./viewpointLoader";
|
|
10
10
|
import { tubeLineType, tubeLineFactory, verticeType, verticeFactory, bufferGeometryType, bufferGeometry } from "./polydrawerLoader";
|
|
11
11
|
import { fbxType, fbxFactory } from "./fbxLoader";
|
|
12
|
+
import { pathPointType, pathPointFactory, pathLineType, pathLineFactory } from "./pathLoader";
|
|
12
13
|
export {
|
|
13
14
|
// planeType,planeFactory,
|
|
14
|
-
planeType, planeFactory, planeTypeImage, planeTypeVideo, planeTypePdf, setHudState, planeImageFactory, planeVideoFactory, planePdfFactory, gltfType, gltfFactory, boxType, boxFactory, textType, textFactory, css3DType, css3DFactory, hudType, hudFactory, sweepPuckType, puckBackgroundFactory, viewpointType, viewpointFactory, tubeLineType, tubeLineFactory, verticeType, verticeFactory, bufferGeometryType, bufferGeometry, fbxType, fbxFactory };
|
|
15
|
+
planeType, planeFactory, planeTypeImage, planeTypeVideo, planeTypePdf, setHudState, planeImageFactory, planeVideoFactory, planePdfFactory, gltfType, gltfFactory, boxType, boxFactory, textType, textFactory, css3DType, css3DFactory, hudType, hudFactory, sweepPuckType, puckBackgroundFactory, viewpointType, viewpointFactory, tubeLineType, tubeLineFactory, verticeType, verticeFactory, bufferGeometryType, bufferGeometry, fbxType, fbxFactory, pathPointType, pathPointFactory, pathLineType, pathLineFactory };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { MpSdk } from "../../bundle/sdk";
|
|
2
|
+
import { Pane } from 'tweakpane';
|
|
3
|
+
export declare class PathLine {
|
|
4
|
+
mpSdk: MpSdk;
|
|
5
|
+
mesh: THREE.Mesh;
|
|
6
|
+
material: THREE.Material;
|
|
7
|
+
geometry: THREE.BufferGeometry;
|
|
8
|
+
texture: THREE.CanvasTexture;
|
|
9
|
+
tubeGeometry: THREE.TubeGeometry;
|
|
10
|
+
time: number;
|
|
11
|
+
closed: boolean;
|
|
12
|
+
panel: Pane;
|
|
13
|
+
billboard: string;
|
|
14
|
+
hovered: boolean;
|
|
15
|
+
length: number;
|
|
16
|
+
groupedMesh: THREE.Group;
|
|
17
|
+
constructor(mpSdk: MpSdk);
|
|
18
|
+
inputs: {
|
|
19
|
+
name: string;
|
|
20
|
+
label: string;
|
|
21
|
+
description: string;
|
|
22
|
+
node: any;
|
|
23
|
+
tubes: any;
|
|
24
|
+
path: any;
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
active: boolean;
|
|
27
|
+
editMode: boolean;
|
|
28
|
+
direction: number;
|
|
29
|
+
curveType: string;
|
|
30
|
+
opacity: number;
|
|
31
|
+
tubularSegments: number;
|
|
32
|
+
radialSegments: number;
|
|
33
|
+
fillColor: string;
|
|
34
|
+
textColor: string;
|
|
35
|
+
text: string;
|
|
36
|
+
font: string;
|
|
37
|
+
radius: number;
|
|
38
|
+
scrollSpeed: number;
|
|
39
|
+
collider: boolean;
|
|
40
|
+
visible: boolean;
|
|
41
|
+
pathOptions: any;
|
|
42
|
+
};
|
|
43
|
+
outputs: Record<string, unknown> & MpSdk.Scene.PredefinedOutputs;
|
|
44
|
+
context: MpSdk.Scene.IComponentContext;
|
|
45
|
+
emits: {
|
|
46
|
+
active: boolean;
|
|
47
|
+
destroyed: boolean;
|
|
48
|
+
};
|
|
49
|
+
events: {
|
|
50
|
+
'INTERACTION.CLICK': boolean;
|
|
51
|
+
'INTERACTION.HOVER': boolean;
|
|
52
|
+
};
|
|
53
|
+
onInit: () => void;
|
|
54
|
+
onInputsUpdated: (prevInputs: any) => void;
|
|
55
|
+
renderPathLine: () => void;
|
|
56
|
+
setBillboard: (value: any) => void;
|
|
57
|
+
onEvent(eventType: any, data: any): void;
|
|
58
|
+
onTick(tickDelta: any): void;
|
|
59
|
+
renderGUI: () => void;
|
|
60
|
+
onDestroy(): void;
|
|
61
|
+
}
|
|
62
|
+
export declare const pathLineType = "pathLine";
|
|
63
|
+
export declare const pathLineFactory: (mpSdk: MpSdk) => () => PathLine;
|
|
64
|
+
export declare class PathPoint {
|
|
65
|
+
mpSdk: MpSdk;
|
|
66
|
+
mesh: THREE.Mesh;
|
|
67
|
+
material: THREE.Material;
|
|
68
|
+
geometry: THREE.BufferGeometry;
|
|
69
|
+
texture: THREE.CanvasTexture;
|
|
70
|
+
pointerSub: MpSdk.ISubscription;
|
|
71
|
+
pointerIntersection: MpSdk.Pointer.Intersection;
|
|
72
|
+
constructor(mpSdk: MpSdk);
|
|
73
|
+
inputs: {
|
|
74
|
+
index: any;
|
|
75
|
+
radius: number;
|
|
76
|
+
position: any;
|
|
77
|
+
fillColor: string;
|
|
78
|
+
hoverColor: string;
|
|
79
|
+
ringVisibility: boolean;
|
|
80
|
+
};
|
|
81
|
+
outputs: Record<string, unknown> & MpSdk.Scene.PredefinedOutputs;
|
|
82
|
+
context: MpSdk.Scene.IComponentContext;
|
|
83
|
+
emits: {
|
|
84
|
+
active: boolean;
|
|
85
|
+
changed: boolean;
|
|
86
|
+
};
|
|
87
|
+
events: {
|
|
88
|
+
'INTERACTION.DRAG': boolean;
|
|
89
|
+
'INTERACTION.DRAG_BEGIN': boolean;
|
|
90
|
+
'INTERACTION.DRAG_END': boolean;
|
|
91
|
+
'INTERACTION.HOVER': boolean;
|
|
92
|
+
};
|
|
93
|
+
onInputsUpdated: (prevInputs: any) => void;
|
|
94
|
+
onEvent(eventType: any, data: any): void;
|
|
95
|
+
onInit: () => void;
|
|
96
|
+
renderVertice: (hovered?: boolean) => void;
|
|
97
|
+
}
|
|
98
|
+
export declare const pathPointType = "pathPoint";
|
|
99
|
+
export declare const pathPointFactory: (mpSdk: any) => () => PathPoint;
|