@pascal-app/core 0.1.13 → 0.2.0
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/events/bus.d.ts +14 -2
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/hooks/scene-registry/scene-registry.d.ts +5 -1
- package/dist/hooks/scene-registry/scene-registry.d.ts.map +1 -1
- package/dist/hooks/scene-registry/scene-registry.js +10 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +8 -8
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.js +88 -36
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.js +16 -8
- package/dist/hooks/spatial-grid/spatial-grid.d.ts +3 -3
- package/dist/hooks/spatial-grid/spatial-grid.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid.js +2 -2
- package/dist/hooks/spatial-grid/use-spatial-query.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/wall-spatial-grid.d.ts +2 -2
- package/dist/hooks/spatial-grid/wall-spatial-grid.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/wall-spatial-grid.js +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/space-detection.d.ts.map +1 -1
- package/dist/lib/space-detection.js +1 -1
- package/dist/schema/collections.d.ts +11 -0
- package/dist/schema/collections.d.ts.map +1 -0
- package/dist/schema/collections.js +2 -0
- package/dist/schema/index.d.ts +11 -8
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +11 -7
- package/dist/schema/nodes/door.d.ts +78 -0
- package/dist/schema/nodes/door.d.ts.map +1 -0
- package/dist/schema/nodes/door.js +67 -0
- package/dist/schema/nodes/item.d.ts +234 -0
- package/dist/schema/nodes/item.d.ts.map +1 -1
- package/dist/schema/nodes/item.js +65 -1
- package/dist/schema/nodes/level.d.ts.map +1 -1
- package/dist/schema/nodes/level.js +11 -1
- package/dist/schema/nodes/roof-segment.d.ts +51 -0
- package/dist/schema/nodes/roof-segment.d.ts.map +1 -0
- package/dist/schema/nodes/roof-segment.js +36 -0
- package/dist/schema/nodes/roof.d.ts +1 -4
- package/dist/schema/nodes/roof.d.ts.map +1 -1
- package/dist/schema/nodes/roof.js +9 -16
- package/dist/schema/nodes/site.d.ts +46 -0
- package/dist/schema/nodes/site.d.ts.map +1 -1
- package/dist/schema/types.d.ts +191 -4
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +4 -0
- package/dist/store/actions/node-actions.d.ts.map +1 -1
- package/dist/store/actions/node-actions.js +23 -4
- package/dist/store/use-interactive.d.ts +18 -0
- package/dist/store/use-interactive.d.ts.map +1 -0
- package/dist/store/use-interactive.js +50 -0
- package/dist/store/use-scene.d.ts +10 -1
- package/dist/store/use-scene.d.ts.map +1 -1
- package/dist/store/use-scene.js +180 -57
- package/dist/systems/ceiling/ceiling-system.d.ts.map +1 -1
- package/dist/systems/ceiling/ceiling-system.js +5 -0
- package/dist/systems/door/door-system.d.ts +2 -0
- package/dist/systems/door/door-system.d.ts.map +1 -0
- package/dist/systems/door/door-system.js +211 -0
- package/dist/systems/item/item-system.js +3 -2
- package/dist/systems/roof/roof-system.d.ts +11 -3
- package/dist/systems/roof/roof-system.d.ts.map +1 -1
- package/dist/systems/roof/roof-system.js +705 -210
- package/dist/systems/slab/slab-system.js +3 -3
- package/dist/systems/wall/wall-mitering.js +2 -2
- package/dist/systems/wall/wall-system.d.ts.map +1 -1
- package/dist/systems/wall/wall-system.js +6 -6
- package/dist/systems/window/window-system.js +3 -3
- package/package.json +6 -6
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AnyNodeId } from './types';
|
|
2
|
+
export type CollectionId = `collection_${string}`;
|
|
3
|
+
export type Collection = {
|
|
4
|
+
id: CollectionId;
|
|
5
|
+
name: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
nodeIds: AnyNodeId[];
|
|
8
|
+
controlNodeId?: AnyNodeId;
|
|
9
|
+
};
|
|
10
|
+
export declare const generateCollectionId: () => CollectionId;
|
|
11
|
+
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/schema/collections.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,MAAM,MAAM,YAAY,GAAG,cAAc,MAAM,EAAE,CAAA;AAEjD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,YAAY,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,SAAS,EAAE,CAAA;IACpB,aAAa,CAAC,EAAE,SAAS,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,oBAAoB,QAAO,YAAwC,CAAA"}
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
export { BaseNode, generateId, Material, nodeType, objectId } from './base';
|
|
2
2
|
export { CameraSchema } from './camera';
|
|
3
|
-
export type
|
|
4
|
-
export {
|
|
3
|
+
export { type Collection, type CollectionId, generateCollectionId } from './collections';
|
|
4
|
+
export { BuildingNode } from './nodes/building';
|
|
5
|
+
export { CeilingNode } from './nodes/ceiling';
|
|
6
|
+
export { DoorNode, DoorSegment } from './nodes/door';
|
|
7
|
+
export { GuideNode } from './nodes/guide';
|
|
8
|
+
export type { AnimationEffect, Asset, AssetInput, Control, Effect, Interactive, LightEffect, SliderControl, TemperatureControl, ToggleControl, } from './nodes/item';
|
|
9
|
+
export { getScaledDimensions, ItemNode } from './nodes/item';
|
|
5
10
|
export { LevelNode } from './nodes/level';
|
|
11
|
+
export { RoofNode } from './nodes/roof';
|
|
12
|
+
export { RoofSegmentNode, RoofType } from './nodes/roof-segment';
|
|
13
|
+
export { ScanNode } from './nodes/scan';
|
|
6
14
|
export { SiteNode } from './nodes/site';
|
|
7
15
|
export { SlabNode } from './nodes/slab';
|
|
8
16
|
export { WallNode } from './nodes/wall';
|
|
9
|
-
export {
|
|
10
|
-
export { CeilingNode } from './nodes/ceiling';
|
|
17
|
+
export { WindowNode } from './nodes/window';
|
|
11
18
|
export { ZoneNode } from './nodes/zone';
|
|
12
|
-
export { RoofNode } from './nodes/roof';
|
|
13
|
-
export { ScanNode } from './nodes/scan';
|
|
14
|
-
export { GuideNode } from './nodes/guide';
|
|
15
19
|
export type { AnyNodeId, AnyNodeType } from './types';
|
|
16
|
-
export { WindowNode } from './nodes/window';
|
|
17
20
|
export { AnyNode } from './types';
|
|
18
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,YAAY,EACV,eAAe,EACf,KAAK,EACL,UAAU,EACV,OAAO,EACP,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,aAAa,GACd,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/schema/index.js
CHANGED
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
export { BaseNode, generateId, Material, nodeType, objectId } from './base';
|
|
3
3
|
// Camera
|
|
4
4
|
export { CameraSchema } from './camera';
|
|
5
|
-
|
|
5
|
+
// Collections
|
|
6
|
+
export { generateCollectionId } from './collections';
|
|
7
|
+
export { BuildingNode } from './nodes/building';
|
|
8
|
+
export { CeilingNode } from './nodes/ceiling';
|
|
9
|
+
export { DoorNode, DoorSegment } from './nodes/door';
|
|
10
|
+
export { GuideNode } from './nodes/guide';
|
|
11
|
+
export { getScaledDimensions, ItemNode } from './nodes/item';
|
|
6
12
|
export { LevelNode } from './nodes/level';
|
|
13
|
+
export { RoofNode } from './nodes/roof';
|
|
14
|
+
export { RoofSegmentNode, RoofType } from './nodes/roof-segment';
|
|
15
|
+
export { ScanNode } from './nodes/scan';
|
|
7
16
|
// Nodes
|
|
8
17
|
export { SiteNode } from './nodes/site';
|
|
9
18
|
export { SlabNode } from './nodes/slab';
|
|
10
19
|
export { WallNode } from './nodes/wall';
|
|
11
|
-
export { BuildingNode } from './nodes/building';
|
|
12
|
-
export { CeilingNode } from './nodes/ceiling';
|
|
13
|
-
export { ZoneNode } from './nodes/zone';
|
|
14
|
-
export { RoofNode } from './nodes/roof';
|
|
15
|
-
export { ScanNode } from './nodes/scan';
|
|
16
|
-
export { GuideNode } from './nodes/guide';
|
|
17
20
|
export { WindowNode } from './nodes/window';
|
|
21
|
+
export { ZoneNode } from './nodes/zone';
|
|
18
22
|
// Union types
|
|
19
23
|
export { AnyNode } from './types';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const DoorSegment: z.ZodObject<{
|
|
3
|
+
type: z.ZodEnum<{
|
|
4
|
+
panel: "panel";
|
|
5
|
+
glass: "glass";
|
|
6
|
+
empty: "empty";
|
|
7
|
+
}>;
|
|
8
|
+
heightRatio: z.ZodNumber;
|
|
9
|
+
columnRatios: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
10
|
+
dividerThickness: z.ZodDefault<z.ZodNumber>;
|
|
11
|
+
panelDepth: z.ZodDefault<z.ZodNumber>;
|
|
12
|
+
panelInset: z.ZodDefault<z.ZodNumber>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type DoorSegment = z.infer<typeof DoorSegment>;
|
|
15
|
+
export declare const DoorNode: z.ZodObject<{
|
|
16
|
+
object: z.ZodDefault<z.ZodLiteral<"node">>;
|
|
17
|
+
name: z.ZodOptional<z.ZodString>;
|
|
18
|
+
parentId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
19
|
+
visible: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
20
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
21
|
+
position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
22
|
+
target: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
23
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
24
|
+
perspective: "perspective";
|
|
25
|
+
orthographic: "orthographic";
|
|
26
|
+
}>>;
|
|
27
|
+
fov: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
metadata: z.ZodDefault<z.ZodOptional<z.ZodJSONSchema>>;
|
|
31
|
+
id: z.ZodDefault<z.ZodTemplateLiteral<`door_${string}`>>;
|
|
32
|
+
type: z.ZodDefault<z.ZodLiteral<"door">>;
|
|
33
|
+
position: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
34
|
+
rotation: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
35
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
36
|
+
front: "front";
|
|
37
|
+
back: "back";
|
|
38
|
+
}>>;
|
|
39
|
+
wallId: z.ZodOptional<z.ZodString>;
|
|
40
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
41
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
frameThickness: z.ZodDefault<z.ZodNumber>;
|
|
43
|
+
frameDepth: z.ZodDefault<z.ZodNumber>;
|
|
44
|
+
threshold: z.ZodDefault<z.ZodBoolean>;
|
|
45
|
+
thresholdHeight: z.ZodDefault<z.ZodNumber>;
|
|
46
|
+
hingesSide: z.ZodDefault<z.ZodEnum<{
|
|
47
|
+
left: "left";
|
|
48
|
+
right: "right";
|
|
49
|
+
}>>;
|
|
50
|
+
swingDirection: z.ZodDefault<z.ZodEnum<{
|
|
51
|
+
inward: "inward";
|
|
52
|
+
outward: "outward";
|
|
53
|
+
}>>;
|
|
54
|
+
segments: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
55
|
+
type: z.ZodEnum<{
|
|
56
|
+
panel: "panel";
|
|
57
|
+
glass: "glass";
|
|
58
|
+
empty: "empty";
|
|
59
|
+
}>;
|
|
60
|
+
heightRatio: z.ZodNumber;
|
|
61
|
+
columnRatios: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
62
|
+
dividerThickness: z.ZodDefault<z.ZodNumber>;
|
|
63
|
+
panelDepth: z.ZodDefault<z.ZodNumber>;
|
|
64
|
+
panelInset: z.ZodDefault<z.ZodNumber>;
|
|
65
|
+
}, z.core.$strip>>>;
|
|
66
|
+
handle: z.ZodDefault<z.ZodBoolean>;
|
|
67
|
+
handleHeight: z.ZodDefault<z.ZodNumber>;
|
|
68
|
+
handleSide: z.ZodDefault<z.ZodEnum<{
|
|
69
|
+
left: "left";
|
|
70
|
+
right: "right";
|
|
71
|
+
}>>;
|
|
72
|
+
contentPadding: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
73
|
+
doorCloser: z.ZodDefault<z.ZodBoolean>;
|
|
74
|
+
panicBar: z.ZodDefault<z.ZodBoolean>;
|
|
75
|
+
panicBarHeight: z.ZodDefault<z.ZodNumber>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type DoorNode = z.infer<typeof DoorNode>;
|
|
78
|
+
//# sourceMappingURL=door.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"door.d.ts","sourceRoot":"","sources":["../../../src/schema/nodes/door.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,WAAW;;;;;;;;;;;iBAWtB,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAErD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6DnB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import dedent from 'dedent';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { BaseNode, nodeType, objectId } from '../base';
|
|
4
|
+
export const DoorSegment = z.object({
|
|
5
|
+
type: z.enum(['panel', 'glass', 'empty']),
|
|
6
|
+
heightRatio: z.number(),
|
|
7
|
+
// Each segment controls its own column split
|
|
8
|
+
columnRatios: z.array(z.number()).default([1]),
|
|
9
|
+
dividerThickness: z.number().default(0.03),
|
|
10
|
+
// panel-specific
|
|
11
|
+
panelDepth: z.number().default(0.01), // + raised, - recessed
|
|
12
|
+
panelInset: z.number().default(0.04),
|
|
13
|
+
});
|
|
14
|
+
export const DoorNode = BaseNode.extend({
|
|
15
|
+
id: objectId('door'),
|
|
16
|
+
type: nodeType('door'),
|
|
17
|
+
position: z.tuple([z.number(), z.number(), z.number()]).default([0, 0, 0]),
|
|
18
|
+
rotation: z.tuple([z.number(), z.number(), z.number()]).default([0, 0, 0]),
|
|
19
|
+
side: z.enum(['front', 'back']).optional(),
|
|
20
|
+
wallId: z.string().optional(),
|
|
21
|
+
// Overall dimensions
|
|
22
|
+
width: z.number().default(0.9),
|
|
23
|
+
height: z.number().default(2.1),
|
|
24
|
+
// Frame
|
|
25
|
+
frameThickness: z.number().default(0.05),
|
|
26
|
+
frameDepth: z.number().default(0.07),
|
|
27
|
+
threshold: z.boolean().default(true),
|
|
28
|
+
thresholdHeight: z.number().default(0.02),
|
|
29
|
+
// Swing
|
|
30
|
+
hingesSide: z.enum(['left', 'right']).default('left'),
|
|
31
|
+
swingDirection: z.enum(['inward', 'outward']).default('inward'),
|
|
32
|
+
// Leaf segments — stacked top to bottom, each with its own column split
|
|
33
|
+
segments: z.array(DoorSegment).default([
|
|
34
|
+
{
|
|
35
|
+
type: 'panel',
|
|
36
|
+
heightRatio: 0.4,
|
|
37
|
+
columnRatios: [1],
|
|
38
|
+
dividerThickness: 0.03,
|
|
39
|
+
panelDepth: 0.01,
|
|
40
|
+
panelInset: 0.04,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 'panel',
|
|
44
|
+
heightRatio: 0.6,
|
|
45
|
+
columnRatios: [1],
|
|
46
|
+
dividerThickness: 0.03,
|
|
47
|
+
panelDepth: 0.01,
|
|
48
|
+
panelInset: 0.04,
|
|
49
|
+
},
|
|
50
|
+
]),
|
|
51
|
+
// Handle
|
|
52
|
+
handle: z.boolean().default(true),
|
|
53
|
+
handleHeight: z.number().default(1.05),
|
|
54
|
+
handleSide: z.enum(['left', 'right']).default('right'),
|
|
55
|
+
// Leaf inner margin — space between leaf edge and segment content area [x, y]
|
|
56
|
+
contentPadding: z.tuple([z.number(), z.number()]).default([0.04, 0.04]),
|
|
57
|
+
// Emergency / commercial hardware
|
|
58
|
+
doorCloser: z.boolean().default(false),
|
|
59
|
+
panicBar: z.boolean().default(false),
|
|
60
|
+
panicBarHeight: z.number().default(1.0),
|
|
61
|
+
}).describe(dedent `Door node - a parametric door placed on a wall
|
|
62
|
+
- position: center of the door in wall-local coordinate system (Y = height/2, always at floor)
|
|
63
|
+
- segments: rows stacked top to bottom, each defining its own columnRatios
|
|
64
|
+
- type 'empty' = flush flat fill, 'panel' = raised/recessed panel, 'glass' = glazed
|
|
65
|
+
- hingesSide/swingDirection: which way the door opens
|
|
66
|
+
- doorCloser/panicBar: commercial and emergency hardware options
|
|
67
|
+
`);
|
|
@@ -1,4 +1,143 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
declare const toggleControlSchema: z.ZodObject<{
|
|
3
|
+
kind: z.ZodLiteral<"toggle">;
|
|
4
|
+
label: z.ZodOptional<z.ZodString>;
|
|
5
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
declare const sliderControlSchema: z.ZodObject<{
|
|
8
|
+
kind: z.ZodLiteral<"slider">;
|
|
9
|
+
label: z.ZodString;
|
|
10
|
+
min: z.ZodNumber;
|
|
11
|
+
max: z.ZodNumber;
|
|
12
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
13
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
14
|
+
displayMode: z.ZodDefault<z.ZodEnum<{
|
|
15
|
+
slider: "slider";
|
|
16
|
+
stepper: "stepper";
|
|
17
|
+
dial: "dial";
|
|
18
|
+
}>>;
|
|
19
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
declare const temperatureControlSchema: z.ZodObject<{
|
|
22
|
+
kind: z.ZodLiteral<"temperature">;
|
|
23
|
+
label: z.ZodDefault<z.ZodString>;
|
|
24
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
25
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
unit: z.ZodDefault<z.ZodEnum<{
|
|
27
|
+
C: "C";
|
|
28
|
+
F: "F";
|
|
29
|
+
}>>;
|
|
30
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
declare const controlSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
33
|
+
kind: z.ZodLiteral<"toggle">;
|
|
34
|
+
label: z.ZodOptional<z.ZodString>;
|
|
35
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
kind: z.ZodLiteral<"slider">;
|
|
38
|
+
label: z.ZodString;
|
|
39
|
+
min: z.ZodNumber;
|
|
40
|
+
max: z.ZodNumber;
|
|
41
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
43
|
+
displayMode: z.ZodDefault<z.ZodEnum<{
|
|
44
|
+
slider: "slider";
|
|
45
|
+
stepper: "stepper";
|
|
46
|
+
dial: "dial";
|
|
47
|
+
}>>;
|
|
48
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
50
|
+
kind: z.ZodLiteral<"temperature">;
|
|
51
|
+
label: z.ZodDefault<z.ZodString>;
|
|
52
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
53
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
unit: z.ZodDefault<z.ZodEnum<{
|
|
55
|
+
C: "C";
|
|
56
|
+
F: "F";
|
|
57
|
+
}>>;
|
|
58
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
}, z.core.$strip>], "kind">;
|
|
60
|
+
declare const animationEffectSchema: z.ZodObject<{
|
|
61
|
+
kind: z.ZodLiteral<"animation">;
|
|
62
|
+
clips: z.ZodObject<{
|
|
63
|
+
on: z.ZodOptional<z.ZodString>;
|
|
64
|
+
off: z.ZodOptional<z.ZodString>;
|
|
65
|
+
loop: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
declare const lightEffectSchema: z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"light">;
|
|
70
|
+
color: z.ZodDefault<z.ZodString>;
|
|
71
|
+
intensityRange: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
72
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
offset: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
declare const effectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
76
|
+
kind: z.ZodLiteral<"animation">;
|
|
77
|
+
clips: z.ZodObject<{
|
|
78
|
+
on: z.ZodOptional<z.ZodString>;
|
|
79
|
+
off: z.ZodOptional<z.ZodString>;
|
|
80
|
+
loop: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
kind: z.ZodLiteral<"light">;
|
|
84
|
+
color: z.ZodDefault<z.ZodString>;
|
|
85
|
+
intensityRange: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
86
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
offset: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
88
|
+
}, z.core.$strip>], "kind">;
|
|
89
|
+
declare const interactiveSchema: z.ZodObject<{
|
|
90
|
+
controls: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
91
|
+
kind: z.ZodLiteral<"toggle">;
|
|
92
|
+
label: z.ZodOptional<z.ZodString>;
|
|
93
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
94
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
95
|
+
kind: z.ZodLiteral<"slider">;
|
|
96
|
+
label: z.ZodString;
|
|
97
|
+
min: z.ZodNumber;
|
|
98
|
+
max: z.ZodNumber;
|
|
99
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
100
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
101
|
+
displayMode: z.ZodDefault<z.ZodEnum<{
|
|
102
|
+
slider: "slider";
|
|
103
|
+
stepper: "stepper";
|
|
104
|
+
dial: "dial";
|
|
105
|
+
}>>;
|
|
106
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
108
|
+
kind: z.ZodLiteral<"temperature">;
|
|
109
|
+
label: z.ZodDefault<z.ZodString>;
|
|
110
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
111
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
112
|
+
unit: z.ZodDefault<z.ZodEnum<{
|
|
113
|
+
C: "C";
|
|
114
|
+
F: "F";
|
|
115
|
+
}>>;
|
|
116
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
}, z.core.$strip>], "kind">>>;
|
|
118
|
+
effects: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
119
|
+
kind: z.ZodLiteral<"animation">;
|
|
120
|
+
clips: z.ZodObject<{
|
|
121
|
+
on: z.ZodOptional<z.ZodString>;
|
|
122
|
+
off: z.ZodOptional<z.ZodString>;
|
|
123
|
+
loop: z.ZodOptional<z.ZodString>;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
126
|
+
kind: z.ZodLiteral<"light">;
|
|
127
|
+
color: z.ZodDefault<z.ZodString>;
|
|
128
|
+
intensityRange: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
129
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
130
|
+
offset: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
131
|
+
}, z.core.$strip>], "kind">>>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
export type ToggleControl = z.infer<typeof toggleControlSchema>;
|
|
134
|
+
export type SliderControl = z.infer<typeof sliderControlSchema>;
|
|
135
|
+
export type TemperatureControl = z.infer<typeof temperatureControlSchema>;
|
|
136
|
+
export type Control = z.infer<typeof controlSchema>;
|
|
137
|
+
export type AnimationEffect = z.infer<typeof animationEffectSchema>;
|
|
138
|
+
export type LightEffect = z.infer<typeof lightEffectSchema>;
|
|
139
|
+
export type Effect = z.infer<typeof effectSchema>;
|
|
140
|
+
export type Interactive = z.infer<typeof interactiveSchema>;
|
|
2
141
|
declare const assetSchema: z.ZodObject<{
|
|
3
142
|
id: z.ZodString;
|
|
4
143
|
category: z.ZodString;
|
|
@@ -18,6 +157,50 @@ declare const assetSchema: z.ZodObject<{
|
|
|
18
157
|
surface: z.ZodOptional<z.ZodObject<{
|
|
19
158
|
height: z.ZodNumber;
|
|
20
159
|
}, z.core.$strip>>;
|
|
160
|
+
interactive: z.ZodOptional<z.ZodObject<{
|
|
161
|
+
controls: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
162
|
+
kind: z.ZodLiteral<"toggle">;
|
|
163
|
+
label: z.ZodOptional<z.ZodString>;
|
|
164
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
kind: z.ZodLiteral<"slider">;
|
|
167
|
+
label: z.ZodString;
|
|
168
|
+
min: z.ZodNumber;
|
|
169
|
+
max: z.ZodNumber;
|
|
170
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
171
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
172
|
+
displayMode: z.ZodDefault<z.ZodEnum<{
|
|
173
|
+
slider: "slider";
|
|
174
|
+
stepper: "stepper";
|
|
175
|
+
dial: "dial";
|
|
176
|
+
}>>;
|
|
177
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
178
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
179
|
+
kind: z.ZodLiteral<"temperature">;
|
|
180
|
+
label: z.ZodDefault<z.ZodString>;
|
|
181
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
182
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
183
|
+
unit: z.ZodDefault<z.ZodEnum<{
|
|
184
|
+
C: "C";
|
|
185
|
+
F: "F";
|
|
186
|
+
}>>;
|
|
187
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
}, z.core.$strip>], "kind">>>;
|
|
189
|
+
effects: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
190
|
+
kind: z.ZodLiteral<"animation">;
|
|
191
|
+
clips: z.ZodObject<{
|
|
192
|
+
on: z.ZodOptional<z.ZodString>;
|
|
193
|
+
off: z.ZodOptional<z.ZodString>;
|
|
194
|
+
loop: z.ZodOptional<z.ZodString>;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
197
|
+
kind: z.ZodLiteral<"light">;
|
|
198
|
+
color: z.ZodDefault<z.ZodString>;
|
|
199
|
+
intensityRange: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
200
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
201
|
+
offset: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
202
|
+
}, z.core.$strip>], "kind">>>;
|
|
203
|
+
}, z.core.$strip>>;
|
|
21
204
|
}, z.core.$strip>;
|
|
22
205
|
export type AssetInput = z.input<typeof assetSchema>;
|
|
23
206
|
export type Asset = z.infer<typeof assetSchema>;
|
|
@@ -41,6 +224,7 @@ export declare const ItemNode: z.ZodObject<{
|
|
|
41
224
|
type: z.ZodDefault<z.ZodLiteral<"item">>;
|
|
42
225
|
position: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
43
226
|
rotation: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
227
|
+
scale: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
44
228
|
side: z.ZodOptional<z.ZodEnum<{
|
|
45
229
|
front: "front";
|
|
46
230
|
back: "back";
|
|
@@ -48,6 +232,7 @@ export declare const ItemNode: z.ZodObject<{
|
|
|
48
232
|
children: z.ZodDefault<z.ZodArray<z.ZodDefault<z.ZodTemplateLiteral<`item_${string}`>>>>;
|
|
49
233
|
wallId: z.ZodOptional<z.ZodString>;
|
|
50
234
|
wallT: z.ZodOptional<z.ZodNumber>;
|
|
235
|
+
collectionIds: z.ZodOptional<z.ZodArray<z.ZodCustom<`collection_${string}`, `collection_${string}`>>>;
|
|
51
236
|
asset: z.ZodObject<{
|
|
52
237
|
id: z.ZodString;
|
|
53
238
|
category: z.ZodString;
|
|
@@ -67,8 +252,57 @@ export declare const ItemNode: z.ZodObject<{
|
|
|
67
252
|
surface: z.ZodOptional<z.ZodObject<{
|
|
68
253
|
height: z.ZodNumber;
|
|
69
254
|
}, z.core.$strip>>;
|
|
255
|
+
interactive: z.ZodOptional<z.ZodObject<{
|
|
256
|
+
controls: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
257
|
+
kind: z.ZodLiteral<"toggle">;
|
|
258
|
+
label: z.ZodOptional<z.ZodString>;
|
|
259
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
260
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
261
|
+
kind: z.ZodLiteral<"slider">;
|
|
262
|
+
label: z.ZodString;
|
|
263
|
+
min: z.ZodNumber;
|
|
264
|
+
max: z.ZodNumber;
|
|
265
|
+
step: z.ZodDefault<z.ZodNumber>;
|
|
266
|
+
unit: z.ZodOptional<z.ZodString>;
|
|
267
|
+
displayMode: z.ZodDefault<z.ZodEnum<{
|
|
268
|
+
slider: "slider";
|
|
269
|
+
stepper: "stepper";
|
|
270
|
+
dial: "dial";
|
|
271
|
+
}>>;
|
|
272
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
273
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
274
|
+
kind: z.ZodLiteral<"temperature">;
|
|
275
|
+
label: z.ZodDefault<z.ZodString>;
|
|
276
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
277
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
278
|
+
unit: z.ZodDefault<z.ZodEnum<{
|
|
279
|
+
C: "C";
|
|
280
|
+
F: "F";
|
|
281
|
+
}>>;
|
|
282
|
+
default: z.ZodOptional<z.ZodNumber>;
|
|
283
|
+
}, z.core.$strip>], "kind">>>;
|
|
284
|
+
effects: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
285
|
+
kind: z.ZodLiteral<"animation">;
|
|
286
|
+
clips: z.ZodObject<{
|
|
287
|
+
on: z.ZodOptional<z.ZodString>;
|
|
288
|
+
off: z.ZodOptional<z.ZodString>;
|
|
289
|
+
loop: z.ZodOptional<z.ZodString>;
|
|
290
|
+
}, z.core.$strip>;
|
|
291
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
292
|
+
kind: z.ZodLiteral<"light">;
|
|
293
|
+
color: z.ZodDefault<z.ZodString>;
|
|
294
|
+
intensityRange: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
295
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
296
|
+
offset: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
297
|
+
}, z.core.$strip>], "kind">>>;
|
|
298
|
+
}, z.core.$strip>>;
|
|
70
299
|
}, z.core.$strip>;
|
|
71
300
|
}, z.core.$strip>;
|
|
72
301
|
export type ItemNode = z.infer<typeof ItemNode>;
|
|
302
|
+
/**
|
|
303
|
+
* Returns the effective world-space dimensions of an item after applying its scale.
|
|
304
|
+
* Use this everywhere item.asset.dimensions is used for spatial calculations.
|
|
305
|
+
*/
|
|
306
|
+
export declare function getScaledDimensions(item: ItemNode): [number, number, number];
|
|
73
307
|
export {};
|
|
74
308
|
//# sourceMappingURL=item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/schema/nodes/item.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/schema/nodes/item.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,QAAA,MAAM,mBAAmB;;;;iBAIvB,CAAA;AAEF,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;iBASvB,CAAA;AAEF,QAAA,MAAM,wBAAwB;;;;;;;;;;iBAO5B,CAAA;AAEF,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAIjB,CAAA;AAIF,QAAA,MAAM,qBAAqB;;;;;;;iBAOzB,CAAA;AAEF,QAAA,MAAM,iBAAiB;;;;;;iBAMrB,CAAA;AAEF,QAAA,MAAM,YAAY;;;;;;;;;;;;;2BAA2E,CAAA;AAI7F,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGrB,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACzE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACnD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AACnE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AACjD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmBf,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AACpD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAE/C,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BnB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAA;AAE/C;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAI5E"}
|
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
import dedent from 'dedent';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { BaseNode, nodeType, objectId } from '../base';
|
|
4
|
+
// --- Control descriptors ---
|
|
5
|
+
const toggleControlSchema = z.object({
|
|
6
|
+
kind: z.literal('toggle'),
|
|
7
|
+
label: z.string().optional(),
|
|
8
|
+
default: z.boolean().optional(),
|
|
9
|
+
});
|
|
10
|
+
const sliderControlSchema = z.object({
|
|
11
|
+
kind: z.literal('slider'),
|
|
12
|
+
label: z.string(),
|
|
13
|
+
min: z.number(),
|
|
14
|
+
max: z.number(),
|
|
15
|
+
step: z.number().default(1),
|
|
16
|
+
unit: z.string().optional(),
|
|
17
|
+
displayMode: z.enum(['slider', 'stepper', 'dial']).default('slider'),
|
|
18
|
+
default: z.number().optional(),
|
|
19
|
+
});
|
|
20
|
+
const temperatureControlSchema = z.object({
|
|
21
|
+
kind: z.literal('temperature'),
|
|
22
|
+
label: z.string().default('Temperature'),
|
|
23
|
+
min: z.number().default(16),
|
|
24
|
+
max: z.number().default(30),
|
|
25
|
+
unit: z.enum(['C', 'F']).default('C'),
|
|
26
|
+
default: z.number().optional(),
|
|
27
|
+
});
|
|
28
|
+
const controlSchema = z.discriminatedUnion('kind', [
|
|
29
|
+
toggleControlSchema,
|
|
30
|
+
sliderControlSchema,
|
|
31
|
+
temperatureControlSchema,
|
|
32
|
+
]);
|
|
33
|
+
// --- Effect descriptors ---
|
|
34
|
+
const animationEffectSchema = z.object({
|
|
35
|
+
kind: z.literal('animation'),
|
|
36
|
+
clips: z.object({
|
|
37
|
+
on: z.string().optional(),
|
|
38
|
+
off: z.string().optional(),
|
|
39
|
+
loop: z.string().optional(),
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
const lightEffectSchema = z.object({
|
|
43
|
+
kind: z.literal('light'),
|
|
44
|
+
color: z.string().default('#ffffff'),
|
|
45
|
+
intensityRange: z.tuple([z.number(), z.number()]),
|
|
46
|
+
distance: z.number().optional(),
|
|
47
|
+
offset: z.tuple([z.number(), z.number(), z.number()]).default([0, 0, 0]),
|
|
48
|
+
});
|
|
49
|
+
const effectSchema = z.discriminatedUnion('kind', [animationEffectSchema, lightEffectSchema]);
|
|
50
|
+
// --- Interactive descriptor ---
|
|
51
|
+
const interactiveSchema = z.object({
|
|
52
|
+
controls: z.array(controlSchema).default([]),
|
|
53
|
+
effects: z.array(effectSchema).default([]),
|
|
54
|
+
});
|
|
4
55
|
const assetSchema = z.object({
|
|
5
56
|
id: z.string(),
|
|
6
57
|
category: z.string(),
|
|
@@ -16,20 +67,24 @@ const assetSchema = z.object({
|
|
|
16
67
|
scale: z.tuple([z.number(), z.number(), z.number()]).default([1, 1, 1]),
|
|
17
68
|
surface: z
|
|
18
69
|
.object({
|
|
19
|
-
height: z.number(), // where things rest
|
|
70
|
+
height: z.number(), // where things rest
|
|
20
71
|
})
|
|
21
72
|
.optional(), // undefined = can't place things on it
|
|
73
|
+
interactive: interactiveSchema.optional(),
|
|
22
74
|
});
|
|
23
75
|
export const ItemNode = BaseNode.extend({
|
|
24
76
|
id: objectId('item'),
|
|
25
77
|
type: nodeType('item'),
|
|
26
78
|
position: z.tuple([z.number(), z.number(), z.number()]).default([0, 0, 0]),
|
|
27
79
|
rotation: z.tuple([z.number(), z.number(), z.number()]).default([0, 0, 0]),
|
|
80
|
+
scale: z.tuple([z.number(), z.number(), z.number()]).default([1, 1, 1]),
|
|
28
81
|
side: z.enum(['front', 'back']).optional(),
|
|
29
82
|
children: z.array(objectId('item')).default([]),
|
|
30
83
|
// Wall attachment properties (only used when asset.attachTo is "wall" or "wall-side")
|
|
31
84
|
wallId: z.string().optional(),
|
|
32
85
|
wallT: z.number().optional(), // 0-1 parametric position along wall
|
|
86
|
+
// Denormalized references to collections this node belongs to
|
|
87
|
+
collectionIds: z.array(z.custom()).optional(),
|
|
33
88
|
asset: assetSchema,
|
|
34
89
|
}).describe(dedent `Item node - used to represent a item in the building
|
|
35
90
|
- position: position in level coordinate system (or parent coordinate system if attached)
|
|
@@ -44,3 +99,12 @@ export const ItemNode = BaseNode.extend({
|
|
|
44
99
|
- scale: corrective scale for the model
|
|
45
100
|
- tags: tags associated with the item
|
|
46
101
|
`);
|
|
102
|
+
/**
|
|
103
|
+
* Returns the effective world-space dimensions of an item after applying its scale.
|
|
104
|
+
* Use this everywhere item.asset.dimensions is used for spatial calculations.
|
|
105
|
+
*/
|
|
106
|
+
export function getScaledDimensions(item) {
|
|
107
|
+
const [w, h, d] = item.asset.dimensions;
|
|
108
|
+
const [sx, sy, sz] = item.scale;
|
|
109
|
+
return [w * sx, h * sy, d * sz];
|
|
110
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"level.d.ts","sourceRoot":"","sources":["../../../src/schema/nodes/level.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"level.d.ts","sourceRoot":"","sources":["../../../src/schema/nodes/level.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;iBAwBrB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA"}
|
|
@@ -11,7 +11,17 @@ import { ZoneNode } from './zone';
|
|
|
11
11
|
export const LevelNode = BaseNode.extend({
|
|
12
12
|
id: objectId('level'),
|
|
13
13
|
type: nodeType('level'),
|
|
14
|
-
children: z
|
|
14
|
+
children: z
|
|
15
|
+
.array(z.union([
|
|
16
|
+
WallNode.shape.id,
|
|
17
|
+
ZoneNode.shape.id,
|
|
18
|
+
SlabNode.shape.id,
|
|
19
|
+
CeilingNode.shape.id,
|
|
20
|
+
RoofNode.shape.id,
|
|
21
|
+
ScanNode.shape.id,
|
|
22
|
+
GuideNode.shape.id,
|
|
23
|
+
]))
|
|
24
|
+
.default([]),
|
|
15
25
|
// Specific props
|
|
16
26
|
level: z.number().default(0),
|
|
17
27
|
}).describe(dedent `
|