@operato/scene-storage 10.0.0-beta.28 → 10.0.0-beta.30
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/CHANGELOG.md +15 -0
- package/dist/asrs-crane-3d.d.ts +10 -0
- package/dist/asrs-crane-3d.js +17 -0
- package/dist/asrs-crane-3d.js.map +1 -1
- package/dist/asrs-crane.d.ts +49 -13
- package/dist/asrs-crane.js +120 -16
- package/dist/asrs-crane.js.map +1 -1
- package/dist/asrs-rack.d.ts +49 -19
- package/dist/asrs-rack.js +108 -20
- package/dist/asrs-rack.js.map +1 -1
- package/dist/box.d.ts +3 -3
- package/dist/box.js +1 -2
- package/dist/box.js.map +1 -1
- package/dist/generic-container.d.ts +2 -2
- package/dist/generic-container.js +1 -2
- package/dist/generic-container.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/pallet.d.ts +2 -2
- package/dist/pallet.js +1 -2
- package/dist/pallet.js.map +1 -1
- package/dist/parcel.d.ts +3 -3
- package/dist/parcel.js +1 -2
- package/dist/parcel.js.map +1 -1
- package/dist/rack-cell-3d.d.ts +25 -0
- package/dist/rack-cell-3d.js +88 -0
- package/dist/rack-cell-3d.js.map +1 -0
- package/dist/rack-cell.d.ts +56 -0
- package/dist/rack-cell.js +200 -0
- package/dist/rack-cell.js.map +1 -0
- package/dist/spot.d.ts +4 -11
- package/dist/spot.js +2 -3
- package/dist/spot.js.map +1 -1
- package/dist/templates/index.d.ts +42 -0
- package/dist/templates/index.js +43 -1
- package/dist/templates/index.js.map +1 -1
- package/package.json +9 -4
- package/src/asrs-crane-3d.ts +20 -0
- package/src/asrs-crane.ts +137 -16
- package/src/asrs-rack.ts +119 -20
- package/src/box.ts +2 -4
- package/src/generic-container.ts +1 -3
- package/src/index.ts +3 -0
- package/src/pallet.ts +1 -3
- package/src/parcel.ts +2 -4
- package/src/rack-cell-3d.ts +101 -0
- package/src/rack-cell.ts +228 -0
- package/src/spot.ts +4 -5
- package/src/templates/index.ts +43 -1
- package/test/setup.js +279 -0
- package/test/test-asrs-crane.ts +319 -0
- package/tsconfig.json +2 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* RackCell 3D — invisible anchor group positioned at the cell's location
|
|
5
|
+
* within the parent rack's 3D coordinate space.
|
|
6
|
+
*
|
|
7
|
+
* RackCell has no geometry of its own. Its sole 3D purpose is to provide
|
|
8
|
+
* an Object3D that carriers can be attached to (via Three.js `.attach()`),
|
|
9
|
+
* placed at the exact cell position within the rack. The position is derived
|
|
10
|
+
* from the parent AsrsRack's CellMap (by cellId), not from 2D state fields —
|
|
11
|
+
* rack cells occupy 3D levels that have no 2D analogue.
|
|
12
|
+
*
|
|
13
|
+
* updateTransform() override: things-scene's standard updateTransform
|
|
14
|
+
* reads `component.center` (2D) and flattens it to 3D. For rack cells this
|
|
15
|
+
* is wrong — we need the 3D cell position (bay x, level y, row z) from the
|
|
16
|
+
* parent rack. So we override and read it directly from the CellMap.
|
|
17
|
+
*/
|
|
18
|
+
import * as THREE from 'three';
|
|
19
|
+
import { RealObjectGroup } from '@hatiolab/things-scene';
|
|
20
|
+
export class RackCell3D extends RealObjectGroup {
|
|
21
|
+
build() {
|
|
22
|
+
super.build();
|
|
23
|
+
this._repositionFromCellMap();
|
|
24
|
+
}
|
|
25
|
+
updateDimension() {
|
|
26
|
+
// intentional no-op — size comes from the cell definition, not state
|
|
27
|
+
}
|
|
28
|
+
updateTransform() {
|
|
29
|
+
this._repositionFromCellMap();
|
|
30
|
+
}
|
|
31
|
+
updateAlpha() {
|
|
32
|
+
// invisible — no materials to update
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Position this group at the cell's localPosition within the rack's 3D space.
|
|
36
|
+
*
|
|
37
|
+
* CellMap.grid() places cell origins at:
|
|
38
|
+
* x = b * bayWidth, y = l * levelHeight, z = r * rowDepth
|
|
39
|
+
* (starting from 0,0,0 at the rack's bottom-left-front corner).
|
|
40
|
+
*
|
|
41
|
+
* The rack's object3d is centered: X spans [-width/2, +width/2],
|
|
42
|
+
* Y spans [-depth/2, +depth/2], Z spans [-height/2, +height/2].
|
|
43
|
+
*
|
|
44
|
+
* So the cell centre in rack-local 3D space:
|
|
45
|
+
* x3d = cellPos.x + bayWidth/2 - width/2
|
|
46
|
+
* y3d = cellPos.y + levelHeight/2 - rackDepth/2
|
|
47
|
+
* z3d = cellPos.z + rowDepth/2 - rackHeight/2
|
|
48
|
+
*/
|
|
49
|
+
_repositionFromCellMap() {
|
|
50
|
+
const rack = this.component.parent;
|
|
51
|
+
if (!rack?.cellMap)
|
|
52
|
+
return;
|
|
53
|
+
const cellId = this.component.state?.cellId;
|
|
54
|
+
if (!cellId)
|
|
55
|
+
return;
|
|
56
|
+
const cell = rack.cellMap.findById(cellId);
|
|
57
|
+
if (!cell)
|
|
58
|
+
return;
|
|
59
|
+
const rs = rack.state;
|
|
60
|
+
const rackWidth = rs?.width || 1000;
|
|
61
|
+
const rackDepth = rs?.depth || 3000; // Y dimension (floor→ceiling)
|
|
62
|
+
const rackHeight = rs?.height || 600; // Z dimension (front→back, 2D height)
|
|
63
|
+
const bays = Math.max(1, Math.floor(rs?.bays || 5));
|
|
64
|
+
const levels = Math.max(1, Math.floor(rs?.levels || 4));
|
|
65
|
+
const rows = 1;
|
|
66
|
+
const bayWidth = rackWidth / bays;
|
|
67
|
+
const levelHeight = rackDepth / levels;
|
|
68
|
+
const rowDepth = rackHeight / rows;
|
|
69
|
+
const x3d = cell.localPosition.x + bayWidth / 2 - rackWidth / 2;
|
|
70
|
+
const y3d = cell.localPosition.y + levelHeight / 2 - rackDepth / 2;
|
|
71
|
+
const z3d = cell.localPosition.z + rowDepth / 2 - rackHeight / 2;
|
|
72
|
+
this.object3d.position.set(x3d, y3d, z3d);
|
|
73
|
+
// Optionally visualise cells in debug mode (outline box, very faint)
|
|
74
|
+
if (process.env.NODE_ENV !== 'production' && rack.state?.debugCells) {
|
|
75
|
+
this._addDebugBox(bayWidth, levelHeight, rowDepth);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
_debugBox;
|
|
79
|
+
_addDebugBox(w, h, d) {
|
|
80
|
+
if (this._debugBox)
|
|
81
|
+
return;
|
|
82
|
+
const geo = new THREE.BoxGeometry(w * 0.98, h * 0.98, d * 0.98);
|
|
83
|
+
const edges = new THREE.EdgesGeometry(geo);
|
|
84
|
+
this._debugBox = new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0x00ff88, transparent: true, opacity: 0.2 }));
|
|
85
|
+
this.object3d.add(this._debugBox);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=rack-cell-3d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rack-cell-3d.js","sourceRoot":"","sources":["../src/rack-cell-3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,MAAM,OAAO,UAAW,SAAQ,eAAe;IAC7C,KAAK;QACH,KAAK,CAAC,KAAK,EAAE,CAAA;QACb,IAAI,CAAC,sBAAsB,EAAE,CAAA;IAC/B,CAAC;IAED,eAAe;QACb,qEAAqE;IACvE,CAAC;IAED,eAAe;QACb,IAAI,CAAC,sBAAsB,EAAE,CAAA;IAC/B,CAAC;IAED,WAAW;QACT,qCAAqC;IACvC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,sBAAsB;QACpB,MAAM,IAAI,GAAI,IAAI,CAAC,SAAiB,CAAC,MAAM,CAAA;QAC3C,IAAI,CAAC,IAAI,EAAE,OAAO;YAAE,OAAM;QAE1B,MAAM,MAAM,GAAI,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G,CAAC,CAAA;QAEhE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;QAEzC,qEAAqE;QACrE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAK,IAAI,CAAC,KAAa,EAAE,UAAU,EAAE,CAAC;YAC7E,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAA;QACpD,CAAC;IACH,CAAC;IAEO,SAAS,CAAqB;IAE9B,YAAY,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;QAClD,IAAI,IAAI,CAAC,SAAS;YAAE,OAAM;QAC1B,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;QAC/D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;QAC1C,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,CAAC,YAAY,CACrC,KAAK,EACL,IAAI,KAAK,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAClF,CAAA;QACD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACnC,CAAC;CACF","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * RackCell 3D — invisible anchor group positioned at the cell's location\n * within the parent rack's 3D coordinate space.\n *\n * RackCell has no geometry of its own. Its sole 3D purpose is to provide\n * an Object3D that carriers can be attached to (via Three.js `.attach()`),\n * placed at the exact cell position within the rack. The position is derived\n * from the parent AsrsRack's CellMap (by cellId), not from 2D state fields —\n * rack cells occupy 3D levels that have no 2D analogue.\n *\n * updateTransform() override: things-scene's standard updateTransform\n * reads `component.center` (2D) and flattens it to 3D. For rack cells this\n * is wrong — we need the 3D cell position (bay x, level y, row z) from the\n * parent rack. So we override and read it directly from the CellMap.\n */\n\nimport * as THREE from 'three'\nimport { RealObjectGroup } from '@hatiolab/things-scene'\n\nexport class RackCell3D extends RealObjectGroup {\n build() {\n super.build()\n this._repositionFromCellMap()\n }\n\n updateDimension() {\n // intentional no-op — size comes from the cell definition, not state\n }\n\n updateTransform() {\n this._repositionFromCellMap()\n }\n\n updateAlpha() {\n // invisible — no materials to update\n }\n\n /**\n * Position this group at the cell's localPosition within the rack's 3D space.\n *\n * CellMap.grid() places cell origins at:\n * x = b * bayWidth, y = l * levelHeight, z = r * rowDepth\n * (starting from 0,0,0 at the rack's bottom-left-front corner).\n *\n * The rack's object3d is centered: X spans [-width/2, +width/2],\n * Y spans [-depth/2, +depth/2], Z spans [-height/2, +height/2].\n *\n * So the cell centre in rack-local 3D space:\n * x3d = cellPos.x + bayWidth/2 - width/2\n * y3d = cellPos.y + levelHeight/2 - rackDepth/2\n * z3d = cellPos.z + rowDepth/2 - rackHeight/2\n */\n _repositionFromCellMap() {\n const rack = (this.component as any).parent\n if (!rack?.cellMap) return\n\n const cellId = (this.component as any).state?.cellId as string | undefined\n if (!cellId) return\n\n const cell = rack.cellMap.findById(cellId)\n if (!cell) return\n\n const rs = rack.state as any\n const rackWidth = (rs?.width as number) || 1000\n const rackDepth = (rs?.depth as number) || 3000 // Y dimension (floor→ceiling)\n const rackHeight = (rs?.height as number) || 600 // Z dimension (front→back, 2D height)\n const bays = Math.max(1, Math.floor(rs?.bays || 5))\n const levels = Math.max(1, Math.floor(rs?.levels || 4))\n const rows = 1\n\n const bayWidth = rackWidth / bays\n const levelHeight = rackDepth / levels\n const rowDepth = rackHeight / rows\n\n const x3d = cell.localPosition.x + bayWidth / 2 - rackWidth / 2\n const y3d = cell.localPosition.y + levelHeight / 2 - rackDepth / 2\n const z3d = cell.localPosition.z + rowDepth / 2 - rackHeight / 2\n\n this.object3d.position.set(x3d, y3d, z3d)\n\n // Optionally visualise cells in debug mode (outline box, very faint)\n if (process.env.NODE_ENV !== 'production' && (rack.state as any)?.debugCells) {\n this._addDebugBox(bayWidth, levelHeight, rowDepth)\n }\n }\n\n private _debugBox?: THREE.LineSegments\n\n private _addDebugBox(w: number, h: number, d: number) {\n if (this._debugBox) return\n const geo = new THREE.BoxGeometry(w * 0.98, h * 0.98, d * 0.98)\n const edges = new THREE.EdgesGeometry(geo)\n this._debugBox = new THREE.LineSegments(\n edges,\n new THREE.LineBasicMaterial({ color: 0x00ff88, transparent: true, opacity: 0.2 })\n )\n this.object3d.add(this._debugBox)\n }\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Component, ComponentNature, RealObject } from '@hatiolab/things-scene';
|
|
2
|
+
import { type AttachFrame } from '@operato/scene-base';
|
|
3
|
+
/**
|
|
4
|
+
* How many carriers a cell can hold simultaneously.
|
|
5
|
+
* - single: exactly 1 (typical pallet bay)
|
|
6
|
+
* - multi: small stack (up to 4, e.g. a multi-deep tray)
|
|
7
|
+
* - bulk: unlimited (e.g. a floor area measured in slots)
|
|
8
|
+
*/
|
|
9
|
+
export type RackCellType = 'single' | 'multi' | 'bulk';
|
|
10
|
+
declare const RackCell_base: any;
|
|
11
|
+
/**
|
|
12
|
+
* RackCell — single-slot storage cell inside an AsrsRack.
|
|
13
|
+
*
|
|
14
|
+
* Mixin chain: CarrierHolder(ContainerAbstract)
|
|
15
|
+
* - CarrierHolder: publishes attachPointFor(), gates containable() to Carriables
|
|
16
|
+
* - ContainerAbstract: manages child carrier components
|
|
17
|
+
*
|
|
18
|
+
* No Placeable mixin — RackCell3D self-positions from the parent rack's
|
|
19
|
+
* CellMap (via updateTransform override), bypassing things-scene's standard
|
|
20
|
+
* 2D→3D coordinate mapping which cannot express 3D levels.
|
|
21
|
+
*/
|
|
22
|
+
export default class RackCell extends RackCell_base {
|
|
23
|
+
get cellId(): string;
|
|
24
|
+
get cellType(): RackCellType;
|
|
25
|
+
/** Maximum carrier count for this cell based on cellType. */
|
|
26
|
+
get capacity(): number;
|
|
27
|
+
get nature(): ComponentNature;
|
|
28
|
+
get anchors(): [];
|
|
29
|
+
/** True when fewer carriers are currently held than capacity. */
|
|
30
|
+
canReceive(_component?: any): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Accept a carrier into this cell.
|
|
33
|
+
* Sets TRANSFER_SLOT_KEY = cellId on the carrier, then reparents.
|
|
34
|
+
* Fires 'transfer-received' so monitors can react.
|
|
35
|
+
*/
|
|
36
|
+
receive(carrier: any, options?: any): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Release a carrier from this cell to `target`.
|
|
39
|
+
* Delegates to `target.receive()` if available, otherwise `target.reparent()`.
|
|
40
|
+
*/
|
|
41
|
+
dispatch(carrier: any, target: any, options?: any): Promise<void>;
|
|
42
|
+
/** Alias for receive() — semantic sugar for the storage domain. */
|
|
43
|
+
store(carrier: any, options?: any): Promise<void>;
|
|
44
|
+
/** Alias for dispatch() — semantic sugar for the storage domain. */
|
|
45
|
+
retrieve(carrier: any, target: any, options?: any): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Return the 3D attach frame for carriers placed in this cell.
|
|
48
|
+
* Carriers are lifted by their own halfDepth so the bottom face
|
|
49
|
+
* rests at the cell's Y-center (which is levelHeight/2 above the beam).
|
|
50
|
+
*/
|
|
51
|
+
attachPointFor(carrier: Component): AttachFrame | null;
|
|
52
|
+
/** RackCell has no 2D visual — the rack draws its own structure. */
|
|
53
|
+
render(_ctx: CanvasRenderingContext2D): void;
|
|
54
|
+
buildRealObject(): RealObject | undefined;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* RackCell — a single storage slot within an AsrsRack.
|
|
5
|
+
*
|
|
6
|
+
* A RackCell is a virtual component: it occupies a specific (bay, row, level)
|
|
7
|
+
* coordinate within the parent rack and acts as a CarrierHolder for one carrier
|
|
8
|
+
* (or several, depending on `cellType`).
|
|
9
|
+
*
|
|
10
|
+
* The crane (AsrsCrane) navigates toward a RackCell as its `place()` destination —
|
|
11
|
+
* because the rack cell is a discrete component, Mover.moveTo() can target it
|
|
12
|
+
* directly and arrive at exactly the right bay × level position.
|
|
13
|
+
*
|
|
14
|
+
* Visual: invisible in 2D (no visible 2D footprint — rack cells don't make
|
|
15
|
+
* sense as 2D top-down boxes). In 3D, each cell is an invisible Group
|
|
16
|
+
* positioned within the rack's coordinate space (RackCell3D handles
|
|
17
|
+
* this via updateTransform override).
|
|
18
|
+
*
|
|
19
|
+
* Lifecycle: AsrsRack._buildCells() instantiates RackCell children.
|
|
20
|
+
* Do not create RackCell components manually — they are managed by the rack.
|
|
21
|
+
*
|
|
22
|
+
* Domain aliases:
|
|
23
|
+
* cell.store(carrier) ← cell.receive(carrier)
|
|
24
|
+
* cell.retrieve(carrier, target) ← cell.dispatch(carrier, target)
|
|
25
|
+
*/
|
|
26
|
+
import { __decorate } from "tslib";
|
|
27
|
+
import { ContainerAbstract, TRANSFER_SLOT_KEY, sceneComponent } from '@hatiolab/things-scene';
|
|
28
|
+
import { CarrierHolder } from '@operato/scene-base';
|
|
29
|
+
import { RackCell3D } from './rack-cell-3d.js';
|
|
30
|
+
const NATURE = {
|
|
31
|
+
mutable: false,
|
|
32
|
+
resizable: false,
|
|
33
|
+
rotatable: false,
|
|
34
|
+
properties: [
|
|
35
|
+
{
|
|
36
|
+
type: 'string',
|
|
37
|
+
label: 'cell-id',
|
|
38
|
+
name: 'cellId',
|
|
39
|
+
placeholder: 'e.g. 0-0-0'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: 'select',
|
|
43
|
+
label: 'cell-type',
|
|
44
|
+
name: 'cellType',
|
|
45
|
+
property: {
|
|
46
|
+
options: [
|
|
47
|
+
{ display: 'Single', value: 'single' },
|
|
48
|
+
{ display: 'Multi', value: 'multi' },
|
|
49
|
+
{ display: 'Bulk', value: 'bulk' }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
help: 'scene/component/rack-cell'
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* RackCell — single-slot storage cell inside an AsrsRack.
|
|
58
|
+
*
|
|
59
|
+
* Mixin chain: CarrierHolder(ContainerAbstract)
|
|
60
|
+
* - CarrierHolder: publishes attachPointFor(), gates containable() to Carriables
|
|
61
|
+
* - ContainerAbstract: manages child carrier components
|
|
62
|
+
*
|
|
63
|
+
* No Placeable mixin — RackCell3D self-positions from the parent rack's
|
|
64
|
+
* CellMap (via updateTransform override), bypassing things-scene's standard
|
|
65
|
+
* 2D→3D coordinate mapping which cannot express 3D levels.
|
|
66
|
+
*/
|
|
67
|
+
let RackCell = class RackCell extends CarrierHolder(ContainerAbstract) {
|
|
68
|
+
// ── Identification ────────────────────────────────────────────────────────
|
|
69
|
+
get cellId() {
|
|
70
|
+
return this.state.cellId || '';
|
|
71
|
+
}
|
|
72
|
+
get cellType() {
|
|
73
|
+
return (this.state.cellType || 'single');
|
|
74
|
+
}
|
|
75
|
+
/** Maximum carrier count for this cell based on cellType. */
|
|
76
|
+
get capacity() {
|
|
77
|
+
switch (this.cellType) {
|
|
78
|
+
case 'single': return 1;
|
|
79
|
+
case 'multi': return 4;
|
|
80
|
+
case 'bulk': return Infinity;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// ── Interface ─────────────────────────────────────────────────────────────
|
|
84
|
+
get nature() {
|
|
85
|
+
return NATURE;
|
|
86
|
+
}
|
|
87
|
+
get anchors() {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
// ── Transfer protocol ─────────────────────────────────────────────────────
|
|
91
|
+
/** True when fewer carriers are currently held than capacity. */
|
|
92
|
+
canReceive(_component) {
|
|
93
|
+
const occupied = this.components?.length ?? 0;
|
|
94
|
+
return occupied < this.capacity;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Accept a carrier into this cell.
|
|
98
|
+
* Sets TRANSFER_SLOT_KEY = cellId on the carrier, then reparents.
|
|
99
|
+
* Fires 'transfer-received' so monitors can react.
|
|
100
|
+
*/
|
|
101
|
+
async receive(carrier, options = {}) {
|
|
102
|
+
if (!this.canReceive(carrier)) {
|
|
103
|
+
;
|
|
104
|
+
this.trigger?.('transfer-rejected', {
|
|
105
|
+
type: 'transfer-rejected',
|
|
106
|
+
component: carrier,
|
|
107
|
+
container: this,
|
|
108
|
+
reason: 'no-slot'
|
|
109
|
+
});
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
carrier[TRANSFER_SLOT_KEY] = this.cellId;
|
|
113
|
+
this.reparent?.(carrier, options);
|
|
114
|
+
this.trigger?.('transfer-received', {
|
|
115
|
+
type: 'transfer-received',
|
|
116
|
+
component: carrier,
|
|
117
|
+
container: this,
|
|
118
|
+
slotId: this.cellId
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Release a carrier from this cell to `target`.
|
|
123
|
+
* Delegates to `target.receive()` if available, otherwise `target.reparent()`.
|
|
124
|
+
*/
|
|
125
|
+
async dispatch(carrier, target, options = {}) {
|
|
126
|
+
if (target?.canReceive && !target.canReceive(carrier)) {
|
|
127
|
+
;
|
|
128
|
+
this.trigger?.('transfer-rejected', {
|
|
129
|
+
type: 'transfer-rejected',
|
|
130
|
+
component: carrier,
|
|
131
|
+
container: this,
|
|
132
|
+
reason: 'target-full'
|
|
133
|
+
});
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
delete carrier[TRANSFER_SLOT_KEY];
|
|
137
|
+
if (typeof target?.receive === 'function') {
|
|
138
|
+
await target.receive(carrier, options);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
;
|
|
142
|
+
target.reparent?.(carrier, options);
|
|
143
|
+
}
|
|
144
|
+
;
|
|
145
|
+
this.trigger?.('transfer-dispatched', {
|
|
146
|
+
type: 'transfer-dispatched',
|
|
147
|
+
component: carrier,
|
|
148
|
+
container: this,
|
|
149
|
+
target
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
// ── Domain aliases ────────────────────────────────────────────────────────
|
|
153
|
+
/** Alias for receive() — semantic sugar for the storage domain. */
|
|
154
|
+
store(carrier, options) {
|
|
155
|
+
return this.receive(carrier, options);
|
|
156
|
+
}
|
|
157
|
+
/** Alias for dispatch() — semantic sugar for the storage domain. */
|
|
158
|
+
retrieve(carrier, target, options) {
|
|
159
|
+
return this.dispatch(carrier, target, options);
|
|
160
|
+
}
|
|
161
|
+
// ── 3D attach frame ───────────────────────────────────────────────────────
|
|
162
|
+
/**
|
|
163
|
+
* Return the 3D attach frame for carriers placed in this cell.
|
|
164
|
+
* Carriers are lifted by their own halfDepth so the bottom face
|
|
165
|
+
* rests at the cell's Y-center (which is levelHeight/2 above the beam).
|
|
166
|
+
*/
|
|
167
|
+
attachPointFor(carrier) {
|
|
168
|
+
const root = this._realObject?.object3d;
|
|
169
|
+
if (!root)
|
|
170
|
+
return null;
|
|
171
|
+
const carrierDepth = resolveCarrierDepth(carrier);
|
|
172
|
+
return {
|
|
173
|
+
attach: root,
|
|
174
|
+
localPosition: { x: 0, y: carrierDepth / 2, z: 0 }
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
// ── 2D rendering ──────────────────────────────────────────────────────────
|
|
178
|
+
/** RackCell has no 2D visual — the rack draws its own structure. */
|
|
179
|
+
render(_ctx) {
|
|
180
|
+
// intentional no-op
|
|
181
|
+
}
|
|
182
|
+
// ── 3D ───────────────────────────────────────────────────────────────────
|
|
183
|
+
buildRealObject() {
|
|
184
|
+
return new RackCell3D(this);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
RackCell = __decorate([
|
|
188
|
+
sceneComponent('rack-cell')
|
|
189
|
+
], RackCell);
|
|
190
|
+
export default RackCell;
|
|
191
|
+
function resolveCarrierDepth(c) {
|
|
192
|
+
const eff = c._realObject?.effectiveDepth;
|
|
193
|
+
if (typeof eff === 'number' && Number.isFinite(eff))
|
|
194
|
+
return eff;
|
|
195
|
+
return numOr(c?.state?.depth, 0);
|
|
196
|
+
}
|
|
197
|
+
function numOr(v, dflt) {
|
|
198
|
+
return typeof v === 'number' && Number.isFinite(v) ? v : dflt;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=rack-cell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rack-cell.js","sourceRoot":"","sources":["../src/rack-cell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;AAEH,OAAO,EAGL,iBAAiB,EAEjB,iBAAiB,EACjB,cAAc,EACf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAoB,MAAM,qBAAqB,CAAA;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAU9C,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,YAAY;SAC1B;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE;gBACR,OAAO,EAAE;oBACP,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACtC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;oBACpC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;iBACnC;aACF;SACF;KACF;IACD,IAAI,EAAE,2BAA2B;CAClC,CAAA;AAED;;;;;;;;;;GAU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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAC/D,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * RackCell — a single storage slot within an AsrsRack.\n *\n * A RackCell is a virtual component: it occupies a specific (bay, row, level)\n * coordinate within the parent rack and acts as a CarrierHolder for one carrier\n * (or several, depending on `cellType`).\n *\n * The crane (AsrsCrane) navigates toward a RackCell as its `place()` destination —\n * because the rack cell is a discrete component, Mover.moveTo() can target it\n * directly and arrive at exactly the right bay × level position.\n *\n * Visual: invisible in 2D (no visible 2D footprint — rack cells don't make\n * sense as 2D top-down boxes). In 3D, each cell is an invisible Group\n * positioned within the rack's coordinate space (RackCell3D handles\n * this via updateTransform override).\n *\n * Lifecycle: AsrsRack._buildCells() instantiates RackCell children.\n * Do not create RackCell components manually — they are managed by the rack.\n *\n * Domain aliases:\n * cell.store(carrier) ← cell.receive(carrier)\n * cell.retrieve(carrier, target) ← cell.dispatch(carrier, target)\n */\n\nimport {\n Component,\n ComponentNature,\n ContainerAbstract,\n RealObject,\n TRANSFER_SLOT_KEY,\n sceneComponent\n} from '@hatiolab/things-scene'\nimport { CarrierHolder, type AttachFrame } from '@operato/scene-base'\n\nimport { RackCell3D } from './rack-cell-3d.js'\n\n/**\n * How many carriers a cell can hold simultaneously.\n * - single: exactly 1 (typical pallet bay)\n * - multi: small stack (up to 4, e.g. a multi-deep tray)\n * - bulk: unlimited (e.g. a floor area measured in slots)\n */\nexport type RackCellType = 'single' | 'multi' | 'bulk'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: false,\n rotatable: false,\n properties: [\n {\n type: 'string',\n label: 'cell-id',\n name: 'cellId',\n placeholder: 'e.g. 0-0-0'\n },\n {\n type: 'select',\n label: 'cell-type',\n name: 'cellType',\n property: {\n options: [\n { display: 'Single', value: 'single' },\n { display: 'Multi', value: 'multi' },\n { display: 'Bulk', value: 'bulk' }\n ]\n }\n }\n ],\n help: 'scene/component/rack-cell'\n}\n\n/**\n * RackCell — single-slot storage cell inside an AsrsRack.\n *\n * Mixin chain: CarrierHolder(ContainerAbstract)\n * - CarrierHolder: publishes attachPointFor(), gates containable() to Carriables\n * - ContainerAbstract: manages child carrier components\n *\n * No Placeable mixin — RackCell3D self-positions from the parent rack's\n * CellMap (via updateTransform override), bypassing things-scene's standard\n * 2D→3D coordinate mapping which cannot express 3D levels.\n */\n@sceneComponent('rack-cell')\nexport default class RackCell extends CarrierHolder(ContainerAbstract) {\n // ── Identification ────────────────────────────────────────────────────────\n\n get cellId(): string {\n return (this.state.cellId as string) || ''\n }\n\n get cellType(): RackCellType {\n return ((this.state.cellType as RackCellType) || 'single')\n }\n\n /** Maximum carrier count for this cell based on cellType. */\n get capacity(): number {\n switch (this.cellType) {\n case 'single': return 1\n case 'multi': return 4\n case 'bulk': return Infinity\n }\n }\n\n // ── Interface ─────────────────────────────────────────────────────────────\n\n get nature(): ComponentNature {\n return NATURE\n }\n\n get anchors(): [] {\n return []\n }\n\n // ── Transfer protocol ─────────────────────────────────────────────────────\n\n /** True when fewer carriers are currently held than capacity. */\n canReceive(_component?: any): boolean {\n const occupied = ((this as any).components as Component[] | undefined)?.length ?? 0\n return occupied < this.capacity\n }\n\n /**\n * Accept a carrier into this cell.\n * Sets TRANSFER_SLOT_KEY = cellId on the carrier, then reparents.\n * Fires 'transfer-received' so monitors can react.\n */\n async receive(carrier: any, options: any = {}): Promise<void> {\n if (!this.canReceive(carrier)) {\n ;(this as any).trigger?.('transfer-rejected', {\n type: 'transfer-rejected',\n component: carrier,\n container: this,\n reason: 'no-slot'\n })\n return\n }\n carrier[TRANSFER_SLOT_KEY] = this.cellId\n ;(this as any).reparent?.(carrier, options)\n ;(this as any).trigger?.('transfer-received', {\n type: 'transfer-received',\n component: carrier,\n container: this,\n slotId: this.cellId\n })\n }\n\n /**\n * Release a carrier from this cell to `target`.\n * Delegates to `target.receive()` if available, otherwise `target.reparent()`.\n */\n async dispatch(carrier: any, target: any, options: any = {}): Promise<void> {\n if (target?.canReceive && !target.canReceive(carrier)) {\n ;(this as any).trigger?.('transfer-rejected', {\n type: 'transfer-rejected',\n component: carrier,\n container: this,\n reason: 'target-full'\n })\n return\n }\n delete carrier[TRANSFER_SLOT_KEY]\n if (typeof target?.receive === 'function') {\n await target.receive(carrier, options)\n } else {\n ;(target as any).reparent?.(carrier, options)\n }\n ;(this as any).trigger?.('transfer-dispatched', {\n type: 'transfer-dispatched',\n component: carrier,\n container: this,\n target\n })\n }\n\n // ── Domain aliases ────────────────────────────────────────────────────────\n\n /** Alias for receive() — semantic sugar for the storage domain. */\n store(carrier: any, options?: any): Promise<void> {\n return this.receive(carrier, options)\n }\n\n /** Alias for dispatch() — semantic sugar for the storage domain. */\n retrieve(carrier: any, target: any, options?: any): Promise<void> {\n return this.dispatch(carrier, target, options)\n }\n\n // ── 3D attach frame ───────────────────────────────────────────────────────\n\n /**\n * Return the 3D attach frame for carriers placed in this cell.\n * Carriers are lifted by their own halfDepth so the bottom face\n * rests at the cell's Y-center (which is levelHeight/2 above the beam).\n */\n attachPointFor(carrier: Component): AttachFrame | null {\n const root = (this as any)._realObject?.object3d\n if (!root) return null\n const carrierDepth = resolveCarrierDepth(carrier)\n return {\n attach: root,\n localPosition: { x: 0, y: carrierDepth / 2, z: 0 }\n }\n }\n\n // ── 2D rendering ──────────────────────────────────────────────────────────\n\n /** RackCell has no 2D visual — the rack draws its own structure. */\n render(_ctx: CanvasRenderingContext2D) {\n // intentional no-op\n }\n\n // ── 3D ───────────────────────────────────────────────────────────────────\n\n buildRealObject(): RealObject | undefined {\n return new RackCell3D(this as any)\n }\n}\n\nfunction resolveCarrierDepth(c: Component): number {\n const eff = (c as any)._realObject?.effectiveDepth\n if (typeof eff === 'number' && Number.isFinite(eff)) return eff\n return numOr((c as any)?.state?.depth, 0)\n}\n\nfunction numOr(v: unknown, dflt: number): number {\n return typeof v === 'number' && Number.isFinite(v) ? v : dflt\n}\n"]}
|
package/dist/spot.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component, ComponentNature, RealObject } from '@hatiolab/things-scene';
|
|
2
|
-
import { type Alignment, type Heights, type PlacementArchetype } from '@operato/scene-base';
|
|
3
|
-
declare const
|
|
4
|
-
export default class Spot extends
|
|
2
|
+
import { type AttachFrame, type Alignment, type Heights, type PlacementArchetype } from '@operato/scene-base';
|
|
3
|
+
declare const Spot_base: any;
|
|
4
|
+
export default class Spot extends Spot_base {
|
|
5
5
|
static placement: PlacementArchetype;
|
|
6
6
|
static align: Alignment;
|
|
7
7
|
static defaultDepth: (_h: Heights) => number;
|
|
@@ -29,13 +29,6 @@ export default class Spot extends Base {
|
|
|
29
29
|
* falling back to raw `state.depth` for components built before
|
|
30
30
|
* RealObject creation.
|
|
31
31
|
*/
|
|
32
|
-
attachPointFor(carrier: Component):
|
|
33
|
-
attach: import("three").Object3D<import("three").Object3DEventMap>;
|
|
34
|
-
localPosition: {
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
|
-
z: number;
|
|
38
|
-
};
|
|
39
|
-
} | undefined;
|
|
32
|
+
attachPointFor(carrier: Component): AttachFrame | null;
|
|
40
33
|
}
|
|
41
34
|
export {};
|
package/dist/spot.js
CHANGED
|
@@ -49,8 +49,7 @@ const NATURE = {
|
|
|
49
49
|
// `ContainerAbstract` (not `Container`) — Container = MixinHTMLElement(ContainerAbstract),
|
|
50
50
|
// which forces `isHTMLElement(): true` and trips the 3D pipeline's
|
|
51
51
|
// addObject DOM-skip gate. Spot is purely 3D.
|
|
52
|
-
|
|
53
|
-
let Spot = class Spot extends Base {
|
|
52
|
+
let Spot = class Spot extends CarrierHolder(Placeable(ContainerAbstract)) {
|
|
54
53
|
static placement = 'floor';
|
|
55
54
|
static align = 'bottom';
|
|
56
55
|
static defaultDepth = (_h) => 2; // a thin pad
|
|
@@ -127,7 +126,7 @@ let Spot = class Spot extends Base {
|
|
|
127
126
|
const ro = this._realObject;
|
|
128
127
|
const frame = ro?.getAttachFrame?.();
|
|
129
128
|
if (!frame)
|
|
130
|
-
return
|
|
129
|
+
return null;
|
|
131
130
|
const carrierDepth = resolveDepth(carrier);
|
|
132
131
|
return {
|
|
133
132
|
attach: frame,
|
package/dist/spot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spot.js","sourceRoot":"","sources":["../src/spot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;AAEH,OAAO,EAA8B,iBAAiB,EAAc,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAClH,OAAO,EACL,aAAa,EACb,SAAS,EAIV,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,2EAA2E;IAC3E,wEAAwE;IACxE,uBAAuB;IACvB,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,sBAAsB;CAC7B,CAAA;AAED,kFAAkF;AAClF,uEAAuE;AACvE,sEAAsE;AACtE,EAAE;AACF,2FAA2F;AAC3F,mEAAmE;AACnE,8CAA8C;AAC9C,MAAM,IAAI,GAAG,aAAa,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAgC,CAAA;AAGxE,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,IAAI;IACpC,MAAM,CAAC,SAAS,GAAuB,OAAO,CAAA;IAC9C,MAAM,CAAC,KAAK,GAAc,QAAQ,CAAA;IAClC,MAAM,CAAC,YAAY,GAAG,CAAC,EAAW,EAAE,EAAE,CAAC,CAAC,CAAA,CAAC,aAAa;IAEtD,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,OAAO;QACT,OAAO,EAAE,CAAA;IACX,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,GAA6B;QAClC,M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,EAAE,CAAC,CAAC,CAAA;YACzB,OAAM;QACR,KAAK,WAAW;YACd,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;YACjC,OAAM;QACR,KAAK,UAAU;YACb,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;YAC7C,OAAM;QACR,KAAK,MAAM,CAAC;QACZ;YACE,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,GAAG,CAAC,CAAC,CAAA;YACnC,OAAM;IACV,CAAC;AACH,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * Spot — virtual pickup / drop zone.\n *\n * A modeling-time anchor for \"this is where things land\" — the destination\n * of a robot arm pick-and-place, the slot of an AGV stop, the staging\n * zone next to a conveyor. Spot itself does not move and does\n * not perform any logistics action; it only marks a location and accepts\n * carrier components as children.\n *\n * Visual identity:\n * - 2D: outlined rectangle with corner \"L\" marks (so it reads as a\n * virtual zone, not a solid object).\n * - 3D: a thin translucent floor pad — only the floor of the conceptual\n * box is rendered, the side walls are absent.\n *\n * Standard things-scene properties used (no component-specific extras —\n * keep the property-panel UX uniform with other components):\n * - `fillStyle` — pad / outline color (sole color source)\n * - `strokeStyle` — outline color override (defaults to fillStyle)\n * - `lineWidth` / `lineDash` — outline stroke style\n * - `alpha` — overall transparency, framework-applied\n * - `text` / `fontColor` / `fontSize` / `fontFamily` / `bold` / `italic`\n * — label rendered by the standard text pipeline\n * - `material3d` (3D) — metalness / roughness / castShadow / receiveShadow\n *\n * Role: `CarrierHolder` — accepts any Carrier as a child and lays it on\n * the top face of the pad (overrides default attachPointFor).\n */\n\nimport { Component, ComponentNature, ContainerAbstract, RealObject, sceneComponent } from '@hatiolab/things-scene'\nimport {\n CarrierHolder,\n Placeable,\n type Alignment,\n type Heights,\n type PlacementArchetype\n} from '@operato/scene-base'\n\nimport { Spot3D } from './spot-3d.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n // No component-specific properties — fillStyle / strokeStyle / lineWidth /\n // alpha / text / font* are framework-standard, surfaced by the property\n // panel automatically.\n properties: [],\n help: 'scene/component/spot'\n}\n\n// ContainerAbstract base — Spot accepts carrier children (parcel/box/pallet/...).\n// CarrierHolder mixin only publishes the attach-point hook; the actual\n// child-list management comes from things-scene's container abstract.\n//\n// `ContainerAbstract` (not `Container`) — Container = MixinHTMLElement(ContainerAbstract),\n// which forces `isHTMLElement(): true` and trips the 3D pipeline's\n// addObject DOM-skip gate. Spot is purely 3D.\nconst Base = CarrierHolder(Placeable(ContainerAbstract)) as unknown as typeof Component\n\n@sceneComponent('spot')\nexport default class Spot extends Base {\n static placement: PlacementArchetype = 'floor'\n static align: Alignment = 'bottom'\n static defaultDepth = (_h: Heights) => 2 // a thin pad\n\n get nature(): ComponentNature {\n return NATURE\n }\n\n get anchors() {\n return []\n }\n\n /**\n * 2D — outlined rectangle + corner L marks. The pad body is drawn with a\n * fixed low alpha (0.15) on top of the user's `fillStyle` so the zone reads\n * as virtual even when fillStyle is fully opaque. Outline + corner marks\n * use `strokeStyle` (or fall back to `fillStyle`) at the user's `lineWidth`\n * and `lineDash`. The text label is drawn by the framework's standard\n * postrender pipeline using `text` / `fontColor` / `fontSize` / etc.\n */\n render(ctx: CanvasRenderingContext2D) {\n const { left = 0, top = 0, width = 100, height = 100 } = this.state\n const fillStyle = (this.state.fillStyle as string) || '#3a8fbd'\n const strokeStyle = (this.state.strokeStyle as string) || fillStyle\n const lineWidth = numOr(this.state.lineWidth, 1)\n const lineDashStyle = String(this.state.lineDash ?? 'dash')\n\n // ── Pad body (fixed-low-alpha tint of fillStyle) ───────────────────\n ctx.save()\n ctx.fillStyle = fillStyle\n ctx.globalAlpha = 0.15\n ctx.fillRect(left, top, width, height)\n ctx.restore()\n\n // ── Outline ────────────────────────────────────────────────────────\n ctx.save()\n ctx.strokeStyle = strokeStyle\n ctx.lineWidth = lineWidth\n applyLineDash(ctx, lineDashStyle, lineWidth)\n ctx.strokeRect(\n left + lineWidth / 2,\n top + lineWidth / 2,\n width - lineWidth,\n height - lineWidth\n )\n ctx.setLineDash([])\n ctx.restore()\n\n // ── Corner L marks (solid, slightly heavier than outline) ──────────\n const ml = Math.min(width, height) * 0.18\n const cornerW = Math.max(lineWidth * 1.5, 1.5)\n ctx.save()\n ctx.strokeStyle = strokeStyle\n ctx.lineWidth = cornerW\n for (const [cx, cy, sx, sy] of [\n [left, top, 1, 1],\n [left + width, top, -1, 1],\n [left + width, top + height, -1, -1],\n [left, top + height, 1, -1]\n ] as [number, number, number, number][]) {\n ctx.beginPath()\n ctx.moveTo(cx + sx * ml, cy)\n ctx.lineTo(cx, cy)\n ctx.lineTo(cx, cy + sy * ml)\n ctx.stroke()\n }\n ctx.restore()\n }\n\n buildRealObject(): RealObject | undefined {\n return new Spot3D(this as any)\n }\n\n /**\n * Mount carriers on the TOP of the pad (Spot3D's `getAttachFrame` is\n * already at pad-top in spot-local). Then lift the carrier by its\n * own halfDepth so the carrier's BOTTOM rests ON the pad surface, not\n * its volumetric center — without this lift, half the carrier would\n * sink below the pad / floor.\n *\n * Reads `_realObject.effectiveDepth` first (the framework-resolved\n * value, accounting for `static defaultDepth` and parent context),\n * falling back to raw `state.depth` for components built before\n * RealObject creation.\n */\n attachPointFor(carrier: Component) {\n const ro = (this as any)._realObject as Spot3D | undefined\n const frame = ro?.getAttachFrame?.()\n if (!frame) return undefined\n const carrierDepth = resolveDepth(carrier)\n return {\n attach: frame,\n localPosition: { x: 0, y: carrierDepth / 2, z: 0 }\n }\n }\n}\n\nfunction resolveDepth(c: Component): number {\n const eff = (c as any)._realObject?.effectiveDepth\n if (typeof eff === 'number' && Number.isFinite(eff)) return eff\n return numOr((c as any)?.state?.depth, 0)\n}\n\nfunction numOr(v: unknown, dflt: number): number {\n return typeof v === 'number' && Number.isFinite(v) ? v : dflt\n}\n\n/**\n * Map a things-scene `lineDash` string to a Canvas dash pattern. Mirrors\n * the keys understood by things-scene's `drawer/stroke.ts` so users see\n * consistent options across components. Unknown strings fall through to\n * a plain dashed pattern instead of throwing on setLineDash.\n */\nfunction applyLineDash(ctx: CanvasRenderingContext2D, style: string, lw: number) {\n switch (style) {\n case 'solid':\n ctx.setLineDash([])\n return\n case 'round-dot':\n ctx.setLineDash([0.1, lw * 2])\n ctx.lineCap = 'round'\n return\n case 'square-dot':\n ctx.setLineDash([lw, lw])\n return\n case 'long-dash':\n ctx.setLineDash([lw * 6, lw * 3])\n return\n case 'dash-dot':\n ctx.setLineDash([lw * 4, lw * 2, lw, lw * 2])\n return\n case 'dash':\n default:\n ctx.setLineDash([lw * 4, lw * 1.5])\n return\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"spot.js","sourceRoot":"","sources":["../src/spot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;AAEH,OAAO,EAA8B,iBAAiB,EAAc,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAClH,OAAO,EACL,aAAa,EACb,SAAS,EAKV,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,2EAA2E;IAC3E,wEAAwE;IACxE,uBAAuB;IACvB,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,sBAAsB;CAC7B,CAAA;AAED,kFAAkF;AAClF,uEAAuE;AACvE,sEAAsE;AACtE,EAAE;AACF,2FAA2F;AAC3F,mEAAmE;AACnE,8CAA8C;AAE/B,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,aAAa,CAAC,SAAS,CAAC,iBAAiB,CAAC,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AAU;IAC7E,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,OAAO;YACV,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;YACnB,OAAM;QACR,KAAK,WAAW;YACd,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;YAC9B,GAAG,CAAC,OAAO,GAAG,OAAO,CAAA;YACrB,OAAM;QACR,KAAK,YAAY;YACf,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;YACzB,OAAM;QACR,KAAK,WAAW;YACd,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;YACjC,OAAM;QACR,KAAK,UAAU;YACb,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;YAC7C,OAAM;QACR,KAAK,MAAM,CAAC;QACZ;YACE,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,GAAG,CAAC,CAAC,CAAA;YACnC,OAAM;IACV,CAAC;AACH,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * Spot — virtual pickup / drop zone.\n *\n * A modeling-time anchor for \"this is where things land\" — the destination\n * of a robot arm pick-and-place, the slot of an AGV stop, the staging\n * zone next to a conveyor. Spot itself does not move and does\n * not perform any logistics action; it only marks a location and accepts\n * carrier components as children.\n *\n * Visual identity:\n * - 2D: outlined rectangle with corner \"L\" marks (so it reads as a\n * virtual zone, not a solid object).\n * - 3D: a thin translucent floor pad — only the floor of the conceptual\n * box is rendered, the side walls are absent.\n *\n * Standard things-scene properties used (no component-specific extras —\n * keep the property-panel UX uniform with other components):\n * - `fillStyle` — pad / outline color (sole color source)\n * - `strokeStyle` — outline color override (defaults to fillStyle)\n * - `lineWidth` / `lineDash` — outline stroke style\n * - `alpha` — overall transparency, framework-applied\n * - `text` / `fontColor` / `fontSize` / `fontFamily` / `bold` / `italic`\n * — label rendered by the standard text pipeline\n * - `material3d` (3D) — metalness / roughness / castShadow / receiveShadow\n *\n * Role: `CarrierHolder` — accepts any Carrier as a child and lays it on\n * the top face of the pad (overrides default attachPointFor).\n */\n\nimport { Component, ComponentNature, ContainerAbstract, RealObject, sceneComponent } from '@hatiolab/things-scene'\nimport {\n CarrierHolder,\n Placeable,\n type AttachFrame,\n type Alignment,\n type Heights,\n type PlacementArchetype\n} from '@operato/scene-base'\n\nimport { Spot3D } from './spot-3d.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n // No component-specific properties — fillStyle / strokeStyle / lineWidth /\n // alpha / text / font* are framework-standard, surfaced by the property\n // panel automatically.\n properties: [],\n help: 'scene/component/spot'\n}\n\n// ContainerAbstract base — Spot accepts carrier children (parcel/box/pallet/...).\n// CarrierHolder mixin only publishes the attach-point hook; the actual\n// child-list management comes from things-scene's container abstract.\n//\n// `ContainerAbstract` (not `Container`) — Container = MixinHTMLElement(ContainerAbstract),\n// which forces `isHTMLElement(): true` and trips the 3D pipeline's\n// addObject DOM-skip gate. Spot is purely 3D.\n@sceneComponent('spot')\nexport default class Spot extends CarrierHolder(Placeable(ContainerAbstract)) {\n static placement: PlacementArchetype = 'floor'\n static align: Alignment = 'bottom'\n static defaultDepth = (_h: Heights) => 2 // a thin pad\n\n get nature(): ComponentNature {\n return NATURE\n }\n\n get anchors() {\n return []\n }\n\n /**\n * 2D — outlined rectangle + corner L marks. The pad body is drawn with a\n * fixed low alpha (0.15) on top of the user's `fillStyle` so the zone reads\n * as virtual even when fillStyle is fully opaque. Outline + corner marks\n * use `strokeStyle` (or fall back to `fillStyle`) at the user's `lineWidth`\n * and `lineDash`. The text label is drawn by the framework's standard\n * postrender pipeline using `text` / `fontColor` / `fontSize` / etc.\n */\n render(ctx: CanvasRenderingContext2D) {\n const { left = 0, top = 0, width = 100, height = 100 } = this.state\n const fillStyle = (this.state.fillStyle as string) || '#3a8fbd'\n const strokeStyle = (this.state.strokeStyle as string) || fillStyle\n const lineWidth = numOr(this.state.lineWidth, 1)\n const lineDashStyle = String(this.state.lineDash ?? 'dash')\n\n // ── Pad body (fixed-low-alpha tint of fillStyle) ───────────────────\n ctx.save()\n ctx.fillStyle = fillStyle\n ctx.globalAlpha = 0.15\n ctx.fillRect(left, top, width, height)\n ctx.restore()\n\n // ── Outline ────────────────────────────────────────────────────────\n ctx.save()\n ctx.strokeStyle = strokeStyle\n ctx.lineWidth = lineWidth\n applyLineDash(ctx, lineDashStyle, lineWidth)\n ctx.strokeRect(\n left + lineWidth / 2,\n top + lineWidth / 2,\n width - lineWidth,\n height - lineWidth\n )\n ctx.setLineDash([])\n ctx.restore()\n\n // ── Corner L marks (solid, slightly heavier than outline) ──────────\n const ml = Math.min(width, height) * 0.18\n const cornerW = Math.max(lineWidth * 1.5, 1.5)\n ctx.save()\n ctx.strokeStyle = strokeStyle\n ctx.lineWidth = cornerW\n for (const [cx, cy, sx, sy] of [\n [left, top, 1, 1],\n [left + width, top, -1, 1],\n [left + width, top + height, -1, -1],\n [left, top + height, 1, -1]\n ] as [number, number, number, number][]) {\n ctx.beginPath()\n ctx.moveTo(cx + sx * ml, cy)\n ctx.lineTo(cx, cy)\n ctx.lineTo(cx, cy + sy * ml)\n ctx.stroke()\n }\n ctx.restore()\n }\n\n buildRealObject(): RealObject | undefined {\n return new Spot3D(this as any)\n }\n\n /**\n * Mount carriers on the TOP of the pad (Spot3D's `getAttachFrame` is\n * already at pad-top in spot-local). Then lift the carrier by its\n * own halfDepth so the carrier's BOTTOM rests ON the pad surface, not\n * its volumetric center — without this lift, half the carrier would\n * sink below the pad / floor.\n *\n * Reads `_realObject.effectiveDepth` first (the framework-resolved\n * value, accounting for `static defaultDepth` and parent context),\n * falling back to raw `state.depth` for components built before\n * RealObject creation.\n */\n attachPointFor(carrier: Component): AttachFrame | null {\n const ro = (this as any)._realObject as Spot3D | undefined\n const frame = ro?.getAttachFrame?.()\n if (!frame) return null\n const carrierDepth = resolveDepth(carrier)\n return {\n attach: frame,\n localPosition: { x: 0, y: carrierDepth / 2, z: 0 }\n }\n }\n}\n\nfunction resolveDepth(c: Component): number {\n const eff = (c as any)._realObject?.effectiveDepth\n if (typeof eff === 'number' && Number.isFinite(eff)) return eff\n return numOr((c as any)?.state?.depth, 0)\n}\n\nfunction numOr(v: unknown, dflt: number): number {\n return typeof v === 'number' && Number.isFinite(v) ? v : dflt\n}\n\n/**\n * Map a things-scene `lineDash` string to a Canvas dash pattern. Mirrors\n * the keys understood by things-scene's `drawer/stroke.ts` so users see\n * consistent options across components. Unknown strings fall through to\n * a plain dashed pattern instead of throwing on setLineDash.\n */\nfunction applyLineDash(ctx: CanvasRenderingContext2D, style: string, lw: number) {\n switch (style) {\n case 'solid':\n ctx.setLineDash([])\n return\n case 'round-dot':\n ctx.setLineDash([0.1, lw * 2])\n ctx.lineCap = 'round'\n return\n case 'square-dot':\n ctx.setLineDash([lw, lw])\n return\n case 'long-dash':\n ctx.setLineDash([lw * 6, lw * 3])\n return\n case 'dash-dot':\n ctx.setLineDash([lw * 4, lw * 2, lw, lw * 2])\n return\n case 'dash':\n default:\n ctx.setLineDash([lw * 4, lw * 1.5])\n return\n }\n}\n"]}
|
|
@@ -36,6 +36,7 @@ declare const _default: ({
|
|
|
36
36
|
bays?: undefined;
|
|
37
37
|
status?: undefined;
|
|
38
38
|
carriageHeight?: undefined;
|
|
39
|
+
components?: undefined;
|
|
39
40
|
};
|
|
40
41
|
} | {
|
|
41
42
|
type: string;
|
|
@@ -53,6 +54,7 @@ declare const _default: ({
|
|
|
53
54
|
bays?: undefined;
|
|
54
55
|
status?: undefined;
|
|
55
56
|
carriageHeight?: undefined;
|
|
57
|
+
components?: undefined;
|
|
56
58
|
};
|
|
57
59
|
} | {
|
|
58
60
|
type: string;
|
|
@@ -70,6 +72,7 @@ declare const _default: ({
|
|
|
70
72
|
material?: undefined;
|
|
71
73
|
status?: undefined;
|
|
72
74
|
carriageHeight?: undefined;
|
|
75
|
+
components?: undefined;
|
|
73
76
|
};
|
|
74
77
|
} | {
|
|
75
78
|
type: string;
|
|
@@ -87,6 +90,45 @@ declare const _default: ({
|
|
|
87
90
|
material?: undefined;
|
|
88
91
|
levels?: undefined;
|
|
89
92
|
bays?: undefined;
|
|
93
|
+
components?: undefined;
|
|
94
|
+
};
|
|
95
|
+
} | {
|
|
96
|
+
type: string;
|
|
97
|
+
description: string;
|
|
98
|
+
group: string;
|
|
99
|
+
icon: string;
|
|
100
|
+
model: {
|
|
101
|
+
type: string;
|
|
102
|
+
top: number;
|
|
103
|
+
left: number;
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
106
|
+
components: ({
|
|
107
|
+
type: string;
|
|
108
|
+
top: number;
|
|
109
|
+
left: number;
|
|
110
|
+
width: number;
|
|
111
|
+
height: number;
|
|
112
|
+
levels: number;
|
|
113
|
+
bays: number;
|
|
114
|
+
status?: undefined;
|
|
115
|
+
carriageHeight?: undefined;
|
|
116
|
+
} | {
|
|
117
|
+
type: string;
|
|
118
|
+
top: number;
|
|
119
|
+
left: number;
|
|
120
|
+
width: number;
|
|
121
|
+
height: number;
|
|
122
|
+
status: string;
|
|
123
|
+
carriageHeight: number;
|
|
124
|
+
levels?: undefined;
|
|
125
|
+
bays?: undefined;
|
|
126
|
+
})[];
|
|
127
|
+
material?: undefined;
|
|
128
|
+
levels?: undefined;
|
|
129
|
+
bays?: undefined;
|
|
130
|
+
status?: undefined;
|
|
131
|
+
carriageHeight?: undefined;
|
|
90
132
|
};
|
|
91
133
|
})[];
|
|
92
134
|
export default _default;
|
package/dist/templates/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* things-scene catalog templates for the storage domain — pallet/box/parcel
|
|
3
|
-
* variants, ASRS rack/crane, and the virtual `spot` placement marker.
|
|
3
|
+
* variants, ASRS rack/crane, ASRS aisle composite, and the virtual `spot` placement marker.
|
|
4
4
|
*/
|
|
5
5
|
import spot from './spot.js';
|
|
6
6
|
const pallet = new URL('../../icons/pallet.png', import.meta.url).href;
|
|
@@ -108,6 +108,48 @@ export default [
|
|
|
108
108
|
carriageHeight: 100
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
+
{
|
|
112
|
+
type: 'group',
|
|
113
|
+
description: 'AS/RS aisle — 4-level rack pair + stacker crane',
|
|
114
|
+
group: 'storage',
|
|
115
|
+
icon: asrsRack,
|
|
116
|
+
model: {
|
|
117
|
+
type: 'group',
|
|
118
|
+
top: 100,
|
|
119
|
+
left: 100,
|
|
120
|
+
width: 840,
|
|
121
|
+
height: 220,
|
|
122
|
+
components: [
|
|
123
|
+
{
|
|
124
|
+
type: 'asrs-rack',
|
|
125
|
+
top: 100,
|
|
126
|
+
left: 100,
|
|
127
|
+
width: 800,
|
|
128
|
+
height: 80,
|
|
129
|
+
levels: 4,
|
|
130
|
+
bays: 8
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: 'asrs-crane',
|
|
134
|
+
top: 140,
|
|
135
|
+
left: 420,
|
|
136
|
+
width: 60,
|
|
137
|
+
height: 220,
|
|
138
|
+
status: 'idle',
|
|
139
|
+
carriageHeight: 0
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
type: 'asrs-rack',
|
|
143
|
+
top: 320,
|
|
144
|
+
left: 100,
|
|
145
|
+
width: 800,
|
|
146
|
+
height: 80,
|
|
147
|
+
levels: 4,
|
|
148
|
+
bays: 8
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
},
|
|
111
153
|
spot
|
|
112
154
|
];
|
|
113
155
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"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E,GAAG;YACX,MAAM,EAAE,MAAM;YACd,cAAc,EAAE,GAAG;SACpB;KACF;IACD,IAAI;CACL,CAAA","sourcesContent":["/*\n * things-scene catalog templates for the storage domain — pallet/box/parcel\n * variants, ASRS rack/crane, and the virtual `spot` placement marker.\n */\nimport spot from './spot.js'\nconst pallet = new URL('../../icons/pallet.png', import.meta.url).href\nconst box = new URL('../../icons/box.png', import.meta.url).href\nconst parcel = new URL('../../icons/parcel.png', import.meta.url).href\nconst asrsRack = new URL('../../icons/asrs-rack.png', import.meta.url).href\nconst asrsCrane = new URL('../../icons/asrs-crane.png', import.meta.url).href\n\nexport default [\n {\n type: 'pallet',\n description: 'wood pallet (EUR / EPAL)',\n group: 'storage',\n icon: pallet,\n model: {\n type: 'pallet',\n top: 100,\n left: 100,\n width: 80,\n height: 80,\n material: 'wood'\n }\n },\n {\n type: 'pallet',\n description: 'plastic pallet',\n group: 'storage',\n icon: pallet,\n model: {\n type: 'pallet',\n top: 100,\n left: 250,\n width: 80,\n height: 80,\n material: 'plastic'\n }\n },\n {\n type: 'box',\n description: 'wood crate',\n group: 'storage',\n icon: box,\n model: {\n type: 'box',\n top: 100,\n left: 400,\n width: 80,\n height: 80,\n material: 'wood'\n }\n },\n {\n type: 'box',\n description: 'plastic tote',\n group: 'storage',\n icon: box,\n model: {\n type: 'box',\n top: 100,\n left: 520,\n width: 80,\n height: 80,\n material: 'plastic'\n }\n },\n {\n type: 'parcel',\n description: 'cardboard parcel',\n group: 'storage',\n icon: parcel,\n model: {\n type: 'parcel',\n top: 100,\n left: 640,\n width: 60,\n height: 80\n }\n },\n {\n type: 'asrs-rack',\n description: 'AS/RS storage rack (multi-level)',\n group: 'storage',\n icon: asrsRack,\n model: {\n type: 'asrs-rack',\n top: 300,\n left: 100,\n width: 800,\n height: 200,\n levels: 4,\n bays: 5\n }\n },\n {\n type: 'asrs-crane',\n description: 'AS/RS stacker crane',\n group: 'storage',\n icon: asrsCrane,\n model: {\n type: 'asrs-crane',\n top: 550,\n left: 400,\n width: 100,\n height: 200,\n status: 'idle',\n carriageHeight: 100\n }\n },\n spot\n]\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AACtE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAChE,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AACtE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,2BAA2B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAC3E,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,4BAA4B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAE7E,eAAe;IACb;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,0BAA0B;QACvC,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,GAAG;YACT,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,MAAM;SACjB;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,gBAAgB;QAC7B,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,GAAG;Y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,IAAI,EAAE,SAAS;QACf,KAAK,EAAE;YACL,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,GAAG;YACT,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;YACX,MAAM,EAAE,MAAM;YACd,cAAc,EAAE,GAAG;SACpB;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,iDAAiD;QAC9D,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,GAAG;YACT,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;YACX,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,WAAW;oBACjB,GAAG,EAAE,GAAG;oBACR,IAAI,EAAE,GAAG;oBACT,KAAK,EAAE,GAAG;oBACV,MAAM,EAAE,EAAE;oBACV,MAAM,EAAE,CAAC;oBACT,IAAI,EAAE,CAAC;iBACR;gBACD;oBACE,IAAI,EAAE,YAAY;oBAClB,GAAG,EAAE,GAAG;oBACR,IAAI,EAAE,GAAG;oBACT,KAAK,EAAE,EAAE;oBACT,MAAM,EAAE,GAAG;oBACX,MAAM,EAAE,MAAM;oBACd,cAAc,EAAE,CAAC;iBAClB;gBACD;oBACE,IAAI,EAAE,WAAW;oBACjB,GAAG,EAAE,GAAG;oBACR,IAAI,EAAE,GAAG;oBACT,KAAK,EAAE,GAAG;oBACV,MAAM,EAAE,EAAE;oBACV,MAAM,EAAE,CAAC;oBACT,IAAI,EAAE,CAAC;iBACR;aACF;SACF;KACF;IACD,IAAI;CACL,CAAA","sourcesContent":["/*\n * things-scene catalog templates for the storage domain — pallet/box/parcel\n * variants, ASRS rack/crane, ASRS aisle composite, and the virtual `spot` placement marker.\n */\nimport spot from './spot.js'\nconst pallet = new URL('../../icons/pallet.png', import.meta.url).href\nconst box = new URL('../../icons/box.png', import.meta.url).href\nconst parcel = new URL('../../icons/parcel.png', import.meta.url).href\nconst asrsRack = new URL('../../icons/asrs-rack.png', import.meta.url).href\nconst asrsCrane = new URL('../../icons/asrs-crane.png', import.meta.url).href\n\nexport default [\n {\n type: 'pallet',\n description: 'wood pallet (EUR / EPAL)',\n group: 'storage',\n icon: pallet,\n model: {\n type: 'pallet',\n top: 100,\n left: 100,\n width: 80,\n height: 80,\n material: 'wood'\n }\n },\n {\n type: 'pallet',\n description: 'plastic pallet',\n group: 'storage',\n icon: pallet,\n model: {\n type: 'pallet',\n top: 100,\n left: 250,\n width: 80,\n height: 80,\n material: 'plastic'\n }\n },\n {\n type: 'box',\n description: 'wood crate',\n group: 'storage',\n icon: box,\n model: {\n type: 'box',\n top: 100,\n left: 400,\n width: 80,\n height: 80,\n material: 'wood'\n }\n },\n {\n type: 'box',\n description: 'plastic tote',\n group: 'storage',\n icon: box,\n model: {\n type: 'box',\n top: 100,\n left: 520,\n width: 80,\n height: 80,\n material: 'plastic'\n }\n },\n {\n type: 'parcel',\n description: 'cardboard parcel',\n group: 'storage',\n icon: parcel,\n model: {\n type: 'parcel',\n top: 100,\n left: 640,\n width: 60,\n height: 80\n }\n },\n {\n type: 'asrs-rack',\n description: 'AS/RS storage rack (multi-level)',\n group: 'storage',\n icon: asrsRack,\n model: {\n type: 'asrs-rack',\n top: 300,\n left: 100,\n width: 800,\n height: 200,\n levels: 4,\n bays: 5\n }\n },\n {\n type: 'asrs-crane',\n description: 'AS/RS stacker crane',\n group: 'storage',\n icon: asrsCrane,\n model: {\n type: 'asrs-crane',\n top: 550,\n left: 400,\n width: 100,\n height: 200,\n status: 'idle',\n carriageHeight: 100\n }\n },\n {\n type: 'group',\n description: 'AS/RS aisle — 4-level rack pair + stacker crane',\n group: 'storage',\n icon: asrsRack,\n model: {\n type: 'group',\n top: 100,\n left: 100,\n width: 840,\n height: 220,\n components: [\n {\n type: 'asrs-rack',\n top: 100,\n left: 100,\n width: 800,\n height: 80,\n levels: 4,\n bays: 8\n },\n {\n type: 'asrs-crane',\n top: 140,\n left: 420,\n width: 60,\n height: 220,\n status: 'idle',\n carriageHeight: 0\n },\n {\n type: 'asrs-rack',\n top: 320,\n left: 100,\n width: 800,\n height: 80,\n levels: 4,\n bays: 8\n }\n ]\n }\n },\n spot\n]\n"]}
|