@fmsim/machine 2.0.0 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agv.js +2 -3
- package/dist/agv.js.map +1 -1
- package/dist/carrier.js +53 -43
- package/dist/carrier.js.map +1 -1
- package/dist/crane.js +37 -2
- package/dist/crane.js.map +1 -1
- package/dist/editors/index.js +2 -0
- package/dist/editors/index.js.map +1 -1
- package/dist/editors/load-layout-host.js +96 -0
- package/dist/editors/load-layout-host.js.map +1 -0
- package/dist/editors/ox-load-layout-panel.js +124 -0
- package/dist/editors/ox-load-layout-panel.js.map +1 -0
- package/dist/factories/crane-3d.js +77 -18
- package/dist/factories/crane-3d.js.map +1 -1
- package/dist/factories/machine-3d.js +29 -52
- package/dist/factories/machine-3d.js.map +1 -1
- package/dist/features/capacity-gauge-mixin.js +2 -3
- package/dist/features/capacity-gauge-mixin.js.map +1 -1
- package/dist/features/load-layout-holder.js +77 -0
- package/dist/features/load-layout-holder.js.map +1 -0
- package/dist/features/mcs-status-default.js +30 -7
- package/dist/features/mcs-status-default.js.map +1 -1
- package/dist/features/mcs-status-mixin.js +3 -3
- package/dist/features/mcs-status-mixin.js.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/mcs-carrier-holder.js +287 -82
- package/dist/mcs-carrier-holder.js.map +1 -1
- package/dist/oht.js +4 -0
- package/dist/oht.js.map +1 -1
- package/dist/port.js +6 -1
- package/dist/port.js.map +1 -1
- package/dist/scene/root-container-override.js +5 -11
- package/dist/scene/root-container-override.js.map +1 -1
- package/dist/shelf.js +4 -0
- package/dist/shelf.js.map +1 -1
- package/dist/shuttle.js +4 -0
- package/dist/shuttle.js.map +1 -1
- package/dist/stocker-carrier-bar.js +4 -4
- package/dist/stocker-carrier-bar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/carrier-type-code.js +10 -0
- package/dist/utils/carrier-type-code.js.map +1 -0
- package/dist/utils/crane-forks.js +5 -0
- package/dist/utils/crane-forks.js.map +1 -0
- package/dist/utils/layout-issue-text.js +16 -0
- package/dist/utils/layout-issue-text.js.map +1 -0
- package/dist/utils/layout-issue.js +16 -0
- package/dist/utils/layout-issue.js.map +1 -0
- package/dist/utils/load-address.js +217 -0
- package/dist/utils/load-address.js.map +1 -0
- package/dist/utils/stocker-gauge.js +3 -2
- package/dist/utils/stocker-gauge.js.map +1 -1
- package/jest.config.js +9 -1
- package/package.json +9 -6
- package/src/agv.ts +2 -3
- package/src/carrier.ts +50 -41
- package/src/crane.ts +39 -2
- package/src/editors/index.ts +2 -0
- package/src/editors/load-layout-host.ts +121 -0
- package/src/editors/ox-load-layout-panel.ts +129 -0
- package/src/factories/crane-3d.ts +74 -20
- package/src/factories/machine-3d.ts +26 -49
- package/src/features/capacity-gauge-mixin.ts +2 -3
- package/src/features/load-layout-holder.ts +83 -0
- package/src/features/mcs-status-default.ts +29 -10
- package/src/features/mcs-status-mixin.ts +3 -7
- package/src/index.ts +7 -0
- package/src/mcs-carrier-holder.ts +319 -78
- package/src/oht.ts +5 -0
- package/src/port.ts +7 -1
- package/src/scene/root-container-override.ts +4 -14
- package/src/shelf.ts +5 -0
- package/src/shuttle.ts +5 -0
- package/src/stocker-carrier-bar.ts +4 -4
- package/src/utils/carrier-type-code.ts +9 -0
- package/src/utils/crane-forks.ts +4 -0
- package/src/utils/layout-issue-text.ts +18 -0
- package/src/utils/layout-issue.ts +41 -0
- package/src/utils/load-address.ts +270 -0
- package/src/utils/stocker-gauge.ts +3 -3
- package/translations/en.json +42 -1
- package/translations/ja.json +42 -1
- package/translations/ko.json +59 -18
- package/translations/ms.json +42 -1
- package/translations/zh.json +42 -1
- package/dist/carrier-manager.js +0 -191
- package/dist/carrier-manager.js.map +0 -1
- package/dist/features/animation-default.js +0 -6
- package/dist/features/animation-default.js.map +0 -1
- package/dist/utils/get-value-on-ranges.js +0 -21
- package/dist/utils/get-value-on-ranges.js.map +0 -1
- package/src/carrier-manager.ts +0 -231
- package/src/features/animation-default.ts +0 -13
- package/src/utils/get-value-on-ranges.ts +0 -23
|
@@ -1,96 +1,301 @@
|
|
|
1
1
|
import { themesColorMap, themesAnimationMap } from '@fmsim/api';
|
|
2
|
+
import JSON5 from 'json5';
|
|
3
|
+
import { Capacity, Holdable, ItemsDataBinding, Model, TRANSFER_SLOT_KEY, figureLegendSourcesChanged, itemTypeEntryOf, itemTypeTableOf, registerFigureCapability, registerFigureLegendResolver } from '@hatiolab/things-scene';
|
|
4
|
+
import { HOLDER_ANCHOR } from '@hatiolab/figure-model';
|
|
5
|
+
import { CARRIER_HOLDER, carrierHolderProperties } from '@fmsim/figure-capabilities';
|
|
2
6
|
import MCSUnit from './mcs-unit.js';
|
|
3
|
-
import {
|
|
7
|
+
import { incomingFromV2 } from './utils/load-address';
|
|
4
8
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* (데이터 키는 모두 대문자 전제 — 케이스 정규화 없이 직접 읽는다)
|
|
9
|
+
* A holder's slots outside its layout (common item contract 3.4): every carrier of a holder without a layout stands in
|
|
10
|
+
* one pile, and a carrier whose address is unknown or wrong stands in the exception area beside the holder.
|
|
8
11
|
*/
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
12
|
+
export const PILE_SLOT = 'pile';
|
|
13
|
+
export const EXCEPTION_SLOT = 'exception';
|
|
14
|
+
/** Where the exception area starts, past the holder's +X edge: a gap of this much of the holder's width */
|
|
15
|
+
const EXCEPTION_GAP_RATIO = 0.1;
|
|
16
|
+
/** A carrier shown in a pile is this much of its holder's plan, and half its smaller side high (fmsim v2) */
|
|
17
|
+
const PILE_PLAN_RATIO = 0.8;
|
|
18
|
+
const PILE_HEIGHT_RATIO = 0.5;
|
|
19
|
+
/** The properties a carrier holder adds, offering the legends this board has (ADR-0167 decision 11, 미결 1) */
|
|
20
|
+
export const CARRIER_HOLDER_PROPERTIES = carrierHolderProperties({ legends: themesColorMap, animations: themesAnimationMap });
|
|
21
|
+
/**
|
|
22
|
+
* A holder of MCS carriers, as a mixin over what holds things (`fmsim.CarrierHolder`). What it holds is the common item
|
|
23
|
+
* contract's: carriers are its items (`_items`), found by their CARRIERNAME in the root (itemById), made, moved between
|
|
24
|
+
* holders and let go by the one reconcile by id. MCS's part is here: reading the holder data into one record per
|
|
25
|
+
* carrier, looking its CARRIERTYPE up in the domain's carrier type table (ADR-0155, theme carrier-types), and how a
|
|
26
|
+
* carrier -- whose size MCS does not say -- is shown.
|
|
27
|
+
*/
|
|
28
|
+
export function CarrierHolder(Base) {
|
|
29
|
+
return class extends Base {
|
|
30
|
+
/** Whatever wears this is a carrier holder: the legend resolver finds it up a carrier's parents. */
|
|
31
|
+
get isCarrierHolder() {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
get showOverflow() {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
get hierarchy() {
|
|
38
|
+
return Object.assign(Object.assign({}, super.hierarchy), { components: [] });
|
|
39
|
+
}
|
|
40
|
+
// ── items: the holder data is the holder's, the records are worked out from it ─────────────
|
|
41
|
+
_itemsFromData() {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
_keyedById() {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
/** A carrier the data moves here from another holder travels for two seconds */
|
|
48
|
+
itemMoveAnimation() {
|
|
49
|
+
return { duration: 2000, ease: 'inout' };
|
|
50
|
+
}
|
|
51
|
+
_createItemFromRecord(record) {
|
|
52
|
+
var _a;
|
|
53
|
+
const { width, height } = this.state;
|
|
54
|
+
return Model.compile(Object.assign({ id: record.itemId, type: 'Carrier', left: 0, top: 0, width, height }, record.itemState), (_a = this.root) === null || _a === void 0 ? void 0 : _a.app);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* One record per carrier the data names, bottom first: MULTICARRIERS in order, then the representative. Without a
|
|
58
|
+
* layout they all stand in the pile. A carrier is told its own keys and whether to show its text.
|
|
59
|
+
*/
|
|
60
|
+
carrierRecords(data) {
|
|
61
|
+
return incomingFromV2(data).map(c => ({
|
|
62
|
+
slotId: PILE_SLOT,
|
|
63
|
+
itemId: c.name,
|
|
64
|
+
itemState: this.carrierStateOf(c.record, c.record === data)
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
/** What a carrier is told: its own keys (the representative's are picked out of the holder data), and its text */
|
|
68
|
+
carrierStateOf(record, representative) {
|
|
69
|
+
let data = Object.assign({}, record);
|
|
70
|
+
if (representative) {
|
|
71
|
+
data = { CARRIERNAME: record.CARRIERNAME };
|
|
72
|
+
for (const k of ['CARRIERTYPE', 'EMPTYTYPE', 'CARRIERSTATUS'])
|
|
73
|
+
if (k in record)
|
|
74
|
+
data[k] = record[k];
|
|
41
75
|
}
|
|
42
|
-
|
|
43
|
-
// holder 측에는 별도 carrierDepth 속성을 두지 않는다.
|
|
44
|
-
];
|
|
45
|
-
}
|
|
46
|
-
get showOverflow() {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
get hierarchy() {
|
|
50
|
-
return Object.assign(Object.assign({}, super.hierarchy), { components: [] });
|
|
51
|
-
}
|
|
52
|
-
dispose() {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
;
|
|
55
|
-
(_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.carrierManager) === null || _b === void 0 ? void 0 : _b.update(this, {}, this.data);
|
|
56
|
-
super.dispose();
|
|
57
|
-
}
|
|
58
|
-
async ready() {
|
|
59
|
-
super.ready();
|
|
60
|
-
if (this._hasCarrierData(this.data)) {
|
|
61
|
-
;
|
|
62
|
-
this.root.carrierManager.update(this, this.data || {}, undefined);
|
|
76
|
+
return { data, showText: !!this.getState('showCarrierText') };
|
|
63
77
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
/**
|
|
79
|
+
* The carrier 2D draws (fmsim v2, a rule of position): the top of the data's stack -- MULTICARRIERS bottom first, the
|
|
80
|
+
* holder's own CARRIERNAME last -- when the holder holds it, else the last it holds.
|
|
81
|
+
*/
|
|
82
|
+
get topCarrier() {
|
|
83
|
+
const items = this._items;
|
|
84
|
+
const names = incomingFromV2(this.data).map(c => c.name);
|
|
85
|
+
for (let i = names.length - 1; i >= 0; i--) {
|
|
86
|
+
const held = items.find(c => c.state.id === names[i]);
|
|
87
|
+
if (held)
|
|
88
|
+
return held;
|
|
89
|
+
}
|
|
90
|
+
return items[items.length - 1];
|
|
91
|
+
}
|
|
92
|
+
/** The holder's carriers made to be what its data says now. Records the same as last time change nothing */
|
|
93
|
+
syncCarriers(data) {
|
|
94
|
+
const records = this.carrierRecords(data);
|
|
95
|
+
const taken = JSON.stringify(records);
|
|
96
|
+
if (taken === this._carrierRecordsTaken)
|
|
97
|
+
return;
|
|
98
|
+
this._carrierRecordsTaken = taken;
|
|
99
|
+
this._reconcileItems(records);
|
|
100
|
+
}
|
|
101
|
+
async ready() {
|
|
102
|
+
await super.ready();
|
|
103
|
+
this.syncCarriers(this.data);
|
|
104
|
+
}
|
|
105
|
+
onchange(after, before) {
|
|
106
|
+
super.onchange(after, before);
|
|
107
|
+
/* Its size moves its bottom and changes the size a pile shows carriers at: they take its plan, made and seated again. */
|
|
108
|
+
if ('width' in after || 'height' in after || 'depth' in after) {
|
|
109
|
+
const { width, height } = this.state;
|
|
110
|
+
for (const carrier of this._items)
|
|
111
|
+
if (width && height)
|
|
112
|
+
carrier.set({ width, height });
|
|
113
|
+
this._carriersSeatedAgain();
|
|
114
|
+
}
|
|
115
|
+
/* 이 홀더의 Carrier 들이 물려받는 범례가 바뀌었다: 그 피규어들이 범례를 다시 고른다 (ADR-0166 결정 12) */
|
|
116
|
+
if ('carrierLegendName' in after || 'carrierAnimationName' in after)
|
|
117
|
+
figureLegendSourcesChanged(this);
|
|
118
|
+
if ('showCarrierText' in after || 'slotLayout' in after) {
|
|
119
|
+
this._carrierRecordsTaken = undefined;
|
|
120
|
+
this.syncCarriers(this.data);
|
|
121
|
+
if ('slotLayout' in after)
|
|
122
|
+
this._carriersSeatedAgain();
|
|
73
123
|
}
|
|
74
124
|
}
|
|
75
|
-
|
|
76
|
-
|
|
125
|
+
onchangeData(after, before) {
|
|
126
|
+
this.syncCarriers(after.data || {});
|
|
127
|
+
super.onchangeData(after, before);
|
|
128
|
+
}
|
|
129
|
+
// ── the domain's item types ────────────────────────────────────────────────
|
|
130
|
+
/**
|
|
131
|
+
* A carrier's type (ADR-0155): the code it says (its CARRIERTYPE, trimmed and upper-cased -- doc 01, 6.8), in the
|
|
132
|
+
* domain's carrier type table the scene was given when it opened. None when the table does not have it, or the scene
|
|
133
|
+
* was given none.
|
|
134
|
+
*/
|
|
135
|
+
carrierItemType(carrier) {
|
|
136
|
+
const table = itemTypeTableOf(this);
|
|
137
|
+
return (table && itemTypeEntryOf(table, carrier)) || null;
|
|
138
|
+
}
|
|
139
|
+
/** A carrier's item type: its code, when the domain's table has it; else null */
|
|
140
|
+
itemTypeOf(carrier) {
|
|
141
|
+
var _a, _b;
|
|
142
|
+
return (_b = (_a = this.carrierItemType(carrier)) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : null;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A carrier's size in mm, as judged: none. MCS data does not say a carrier's size and a carrier type has none
|
|
146
|
+
* (ADR-0155 amendment 1 C); a carrier is shown at the size of the place it stands in (itemShownDimsOf).
|
|
147
|
+
*/
|
|
148
|
+
itemDimsOf(_carrier) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The size a carrier of unknown size is shown at, in mm (for showing only, never judged). In the pile, most of the
|
|
153
|
+
* holder's plan and half its smaller side high; elsewhere the box filling its slot, its height shared by the stack.
|
|
154
|
+
*/
|
|
155
|
+
itemShownDimsOf(_carrier, slot, slotId) {
|
|
156
|
+
/* Elsewhere outside the layout, a holder that keeps carriers there says (the exception area: LoadLayoutHolder). */
|
|
157
|
+
if (slotId === PILE_SLOT) {
|
|
158
|
+
const k = this.mmPerSceneUnit;
|
|
159
|
+
const { width = 0, height = 0 } = this.state;
|
|
160
|
+
const w = Math.abs(width) * PILE_PLAN_RATIO;
|
|
161
|
+
const d = Math.abs(height) * PILE_PLAN_RATIO;
|
|
162
|
+
return w > 0 && d > 0 ? { width: w * k, depth: d * k, height: Math.min(w, d) * PILE_HEIGHT_RATIO * k } : null;
|
|
163
|
+
}
|
|
164
|
+
const layers = Number.isFinite(slot.stackLimit) && slot.stackLimit > 0 ? slot.stackLimit : 1;
|
|
165
|
+
return Number.isFinite(slot.allowed.width)
|
|
166
|
+
? { width: slot.allowed.width, depth: slot.allowed.depth, height: slot.allowed.height / layers }
|
|
167
|
+
: null;
|
|
168
|
+
}
|
|
169
|
+
/** A carrier's size as it is shown, in mm: its own, or the size its slot shows an unknown one at (its seat's) */
|
|
170
|
+
carrierShownDimsOf(carrier) {
|
|
171
|
+
var _a, _b;
|
|
172
|
+
return (_b = (_a = this.itemSeatOf(carrier)) === null || _a === void 0 ? void 0 : _a.dims) !== null && _b !== void 0 ? _b : null;
|
|
173
|
+
}
|
|
174
|
+
/** Every carrier made again at the size it is shown at, and every slot seated again */
|
|
175
|
+
_carriersSeatedAgain() {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
const items = this._items;
|
|
178
|
+
for (const carrier of items)
|
|
179
|
+
(_b = (_a = carrier._realObject) === null || _a === void 0 ? void 0 : _a.update) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
180
|
+
const slots = new Set(items.map(c => c[TRANSFER_SLOT_KEY]));
|
|
181
|
+
for (const slotId of slots)
|
|
182
|
+
this._reseatSlot(slotId);
|
|
183
|
+
}
|
|
184
|
+
// ── where carriers stand ──────────────────────────────────────────────────
|
|
185
|
+
/**
|
|
186
|
+
* Where a holder's carriers rest, in coordinates above the holder's bottom, and whether they stand on it or hang from
|
|
187
|
+
* it: on the transport surface by default (fmsim v2). A Port, Shelf or Shuttle holds them at its bottom; an OHT hangs
|
|
188
|
+
* them below.
|
|
189
|
+
*/
|
|
190
|
+
get carrierRest() {
|
|
191
|
+
return { height: 30, mount: 'ON' };
|
|
192
|
+
}
|
|
193
|
+
/** The pile, and the exception area beside the holder's +X edge. Frames in mm on the holder's own anchor (its bottom) */
|
|
194
|
+
outsideSlots() {
|
|
195
|
+
const k = this.mmPerSceneUnit;
|
|
196
|
+
const { width = 0 } = this.state;
|
|
197
|
+
const w = Math.abs(width);
|
|
198
|
+
const rest = this.carrierRest;
|
|
199
|
+
return [
|
|
200
|
+
{
|
|
201
|
+
id: PILE_SLOT,
|
|
202
|
+
anchorId: HOLDER_ANCHOR,
|
|
203
|
+
frame: { position: { x: 0, y: rest.height * k, z: 0 }, rotation: 0 },
|
|
204
|
+
mount: rest.mount
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
id: EXCEPTION_SLOT,
|
|
208
|
+
anchorId: HOLDER_ANCHOR,
|
|
209
|
+
frame: {
|
|
210
|
+
position: { x: (w / 2 + w * EXCEPTION_GAP_RATIO) * k + this.exceptionHalfWidth, y: 0, z: 0 },
|
|
211
|
+
rotation: 0
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
];
|
|
215
|
+
}
|
|
216
|
+
/** Half the width of a carrier in the exception area, in mm: its edge stands past the gap */
|
|
217
|
+
get exceptionHalfWidth() {
|
|
218
|
+
return 0;
|
|
77
219
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
220
|
+
/**
|
|
221
|
+
* The holder's own anchor is its bottom's centre: a node on the frame at its 3D's origin (the box centre), half its
|
|
222
|
+
* 3D's depth down, turned and moved with it. Others by the layer below.
|
|
223
|
+
*/
|
|
224
|
+
anchorObject3D(anchorId) {
|
|
225
|
+
var _a;
|
|
226
|
+
const frame = super.anchorObject3D(anchorId);
|
|
227
|
+
if (anchorId !== HOLDER_ANCHOR || !frame)
|
|
228
|
+
return frame;
|
|
229
|
+
let node = frame.userData.carrierAnchor;
|
|
230
|
+
if (!node || node.parent !== frame) {
|
|
231
|
+
node = new frame.constructor();
|
|
232
|
+
node.name = 'carrier-anchor';
|
|
233
|
+
frame.add(node);
|
|
234
|
+
frame.userData.carrierAnchor = node;
|
|
235
|
+
}
|
|
236
|
+
node.position.set(0, -(Number((_a = this._realObject) === null || _a === void 0 ? void 0 : _a.effectiveDepth) || 0) / 2, 0);
|
|
237
|
+
return node;
|
|
81
238
|
}
|
|
82
|
-
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/** fmsim's own carrier holder: an MCS unit that holds things, wearing `fmsim.CarrierHolder`. */
|
|
242
|
+
class MCSCarrierHolder extends CarrierHolder(ItemsDataBinding(Holdable(Capacity(MCSUnit)))) {
|
|
243
|
+
static get properties() {
|
|
244
|
+
return [...MCSUnit.properties, ...CARRIER_HOLDER_PROPERTIES];
|
|
83
245
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
246
|
+
}
|
|
247
|
+
export default MCSCarrierHolder;
|
|
248
|
+
/*
|
|
249
|
+
The legend a carrier figure shows its tables by (ADR-0166 7, 12; ADR-0167 11): the nearest carrier holder up its
|
|
250
|
+
parents that chose one for the role -- carrier-legend its carrier legend, carrier-animation its carrier animation --
|
|
251
|
+
then the board root's same choice; none chosen, no answer (the figure's own table, fmsim's default). Colour and effect
|
|
252
|
+
only: a carrier figure's thickness is its own fixed table (ADR-0167 12).
|
|
253
|
+
*/
|
|
254
|
+
const ROLE_PROPERTY = {
|
|
255
|
+
'carrier-legend': 'carrierLegendName',
|
|
256
|
+
'carrier-animation': 'carrierAnimationName'
|
|
257
|
+
};
|
|
258
|
+
export function carrierHolderLegend({ component, role }) {
|
|
259
|
+
var _a, _b, _c, _d, _e, _f;
|
|
260
|
+
const property = ROLE_PROPERTY[role];
|
|
261
|
+
if (!property)
|
|
262
|
+
return undefined;
|
|
263
|
+
let name;
|
|
264
|
+
for (let at = component === null || component === void 0 ? void 0 : component.parent; at && !name; at = at.parent)
|
|
265
|
+
if (at.isCarrierHolder)
|
|
266
|
+
name = (_a = at.state) === null || _a === void 0 ? void 0 : _a[property];
|
|
267
|
+
name || (name = (_d = (_c = (_b = component === null || component === void 0 ? void 0 : component.root) === null || _b === void 0 ? void 0 : _b.rootModel) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d[property]);
|
|
268
|
+
if (typeof name !== 'string' || !name)
|
|
269
|
+
return undefined;
|
|
270
|
+
let legend = (_f = (_e = component === null || component === void 0 ? void 0 : component.root) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f[name];
|
|
271
|
+
if (typeof legend === 'string') {
|
|
272
|
+
try {
|
|
273
|
+
legend = JSON5.parse(legend);
|
|
274
|
+
}
|
|
275
|
+
catch (_g) {
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
94
278
|
}
|
|
279
|
+
return legend && typeof legend === 'object' ? colourAndEffect(legend) : undefined;
|
|
280
|
+
}
|
|
281
|
+
/** A legend as a figure takes it from fmsim: each entry's colour and effect; a colour alone stays the colour; an entry's JSON5 text read. */
|
|
282
|
+
function colourAndEffect(legend) {
|
|
283
|
+
return Object.fromEntries(Object.entries(legend).map(([code, raw]) => {
|
|
284
|
+
let entry = raw;
|
|
285
|
+
if (typeof entry === 'string' && entry.trim().startsWith('{')) {
|
|
286
|
+
try {
|
|
287
|
+
entry = JSON5.parse(entry);
|
|
288
|
+
}
|
|
289
|
+
catch (_a) {
|
|
290
|
+
return [code, raw];
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (!entry || typeof entry !== 'object')
|
|
294
|
+
return [code, entry];
|
|
295
|
+
const { color, effect } = entry;
|
|
296
|
+
return [code, Object.assign(Object.assign({}, (color !== undefined ? { color } : {})), (effect !== undefined ? { effect } : {}))];
|
|
297
|
+
}));
|
|
95
298
|
}
|
|
299
|
+
registerFigureLegendResolver(carrierHolderLegend);
|
|
300
|
+
registerFigureCapability(Object.assign(Object.assign({}, CARRIER_HOLDER), { properties: CARRIER_HOLDER_PROPERTIES }), base => CarrierHolder(base));
|
|
96
301
|
//# sourceMappingURL=mcs-carrier-holder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcs-carrier-holder.js","sourceRoot":"","sources":["../src/mcs-carrier-holder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,OAAO,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,CAAU,CAAA;AAE/F,SAAS,oBAAoB,CAAC,CAAM,EAAE,CAAM;;IAC1C,mEAAmE;IACnE,sDAAsD;IACtD,OAAO,CACL,IAAI,CAAC,SAAS,CAAC,MAAA,iBAAiB,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,aAAa,CAAC,mCAAI,EAAE,CAAC;QACzD,IAAI,CAAC,SAAS,CAAC,MAAA,iBAAiB,CAAC,CAAC,aAA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'\nimport { parseIfJsonString } from './utils/data-value'\n\n/**\n * Holder.data 변경 감지 시 carrierManager 에 전달할 4 키 묶음 + multiCarriers 배열.\n * 비교 결과 단 하나라도 다르면 carrierManager.update 호출.\n * (데이터 키는 모두 대문자 전제 — 케이스 정규화 없이 직접 읽는다)\n */\nconst CARRIER_DATA_KEYS = ['CARRIERNAME', 'CARRIERTYPE', 'EMPTYTYPE', 'CARRIERSTATUS'] as const\n\nfunction multiCarriersChanged(a: any, b: any): boolean {\n // MULTICARRIERS 값이 JSON 문자열로 올 수 있어 파싱 후 비교. shallow JSON 비교로 충분 —\n // 각 항목이 4 키 primitive 만 가짐. 빈/누락은 같은 '[]' 직렬화로 동치 취급.\n return (\n JSON.stringify(parseIfJsonString(a?.MULTICARRIERS) ?? []) !==\n JSON.stringify(parseIfJsonString(b?.MULTICARRIERS) ?? [])\n )\n}\n\nexport default class MCSCarrierHolder extends MCSUnit {\n static get properties(): any {\n return [\n ...MCSUnit.properties,\n {\n type: 'select',\n label: 'carrier-legend-name',\n name: 'carrierLegendName',\n property: {\n options: themesColorMap\n }\n },\n {\n type: 'select',\n label: 'carrier-animation-name',\n name: 'carrierAnimationName',\n property: {\n options: themesAnimationMap\n }\n },\n {\n type: 'boolean',\n label: 'show-carrier-text',\n name: 'showCarrierText'\n }\n // 적층 두께는 carrier 측 (Carrier.added) 에서 자기 default depth 를 결정.\n // holder 측에는 별도 carrierDepth 속성을 두지 않는다.\n ]\n }\n\n get showOverflow() {\n return true\n }\n\n get hierarchy() {\n return {\n ...super.hierarchy,\n components: []\n }\n }\n\n dispose(): void {\n ;(this.root as any)?.carrierManager?.update(this, {}, this.data)\n super.dispose()\n }\n\n async ready() {\n super.ready()\n\n if (this._hasCarrierData(this.data)) {\n ;(this.root as any).carrierManager.update(this, this.data || {}, undefined)\n }\n }\n\n onchangeData(after: Record<string, any>, before: Record<string, any>): void {\n const afterData = after.data || {}\n const beforeData = before.data || {}\n\n let changed = false\n for (const k of CARRIER_DATA_KEYS) {\n if (afterData[k] !== beforeData[k]) {\n changed = true\n break\n }\n }\n if (!changed) {\n changed = multiCarriersChanged(afterData, beforeData)\n }\n\n if (changed) {\n ;(this.root as any).carrierManager.update(this, afterData, beforeData)\n }\n\n super.onchangeData(after, before)\n }\n\n /** data 안에 carrier 정보 (대표 또는 multiCarriers) 가 하나라도 있는지. */\n private _hasCarrierData(data: any): boolean {\n if (!data) return false\n if (data.CARRIERNAME) return true\n const list = parseIfJsonString(data.MULTICARRIERS)\n if (Array.isArray(list) && list.some((a: any) => a?.CARRIERNAME)) return true\n return false\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mcs-carrier-holder.js","sourceRoot":"","sources":["../src/mcs-carrier-holder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,KAAK,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,EACf,eAAe,EACf,wBAAwB,EACxB,4BAA4B,EAE7B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAoC,MAAM,wBAAwB,CAAA;AACxF,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AACpF,OAAO,OAAO,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAA;AAC/B,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAA;AAEzC,2GAA2G;AAC3G,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAE/B,6GAA6G;AAC7G,MAAM,eAAe,GAAG,GAAG,CAAA;AAC3B,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAS7B,6GAA6G;AAC7G,MAAM,CAAC,MAA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CAAC;gBACP,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;YACpB,CAAC;QACH,CAAC;QACD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QAC7D,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAA8C,CAAA;QACxE,OAAO,CAAC,IAAI,kCAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAG,CAAA;IAC3G,CAAC,CAAC,CACH,CAAA;AACH,CAAC;AAED,4BAA4B,CAAC,mBAAmB,CAAC,CAAA;AACjD,wBAAwB,iCAAM,cAAc,KAAE,UAAU,EAAE,yBAAkC,KAAI,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAU,CAAC,CAAA","sourcesContent":["import { themesColorMap, themesAnimationMap } from '@fmsim/api'\nimport JSON5 from 'json5'\nimport {\n Capacity,\n Holdable,\n ItemsDataBinding,\n Model,\n TRANSFER_SLOT_KEY,\n figureLegendSourcesChanged,\n itemTypeEntryOf,\n itemTypeTableOf,\n registerFigureCapability,\n registerFigureLegendResolver,\n type ItemType\n} from '@hatiolab/things-scene'\nimport { HOLDER_ANCHOR, type ItemDims, type ResolvedSlot } from '@hatiolab/figure-model'\nimport { CARRIER_HOLDER, carrierHolderProperties } from '@fmsim/figure-capabilities'\nimport MCSUnit from './mcs-unit.js'\nimport { incomingFromV2 } from './utils/load-address'\n\n/**\n * A holder's slots outside its layout (common item contract 3.4): every carrier of a holder without a layout stands in\n * one pile, and a carrier whose address is unknown or wrong stands in the exception area beside the holder.\n */\nexport const PILE_SLOT = 'pile'\nexport const EXCEPTION_SLOT = 'exception'\n\n/** Where the exception area starts, past the holder's +X edge: a gap of this much of the holder's width */\nconst EXCEPTION_GAP_RATIO = 0.1\n\n/** A carrier shown in a pile is this much of its holder's plan, and half its smaller side high (fmsim v2) */\nconst PILE_PLAN_RATIO = 0.8\nconst PILE_HEIGHT_RATIO = 0.5\n\n/** The record of one carrier the holder's data names: its id, the slot it stands in, what it is told */\nexport interface CarrierRecord {\n slotId: string\n itemId: string\n itemState: { data: Record<string, any>; showText: boolean }\n}\n\n/** The properties a carrier holder adds, offering the legends this board has (ADR-0167 decision 11, 미결 1) */\nexport const CARRIER_HOLDER_PROPERTIES = carrierHolderProperties({ legends: themesColorMap, animations: themesAnimationMap })\n\n/**\n * A holder of MCS carriers, as a mixin over what holds things (`fmsim.CarrierHolder`). What it holds is the common item\n * contract's: carriers are its items (`_items`), found by their CARRIERNAME in the root (itemById), made, moved between\n * holders and let go by the one reconcile by id. MCS's part is here: reading the holder data into one record per\n * carrier, looking its CARRIERTYPE up in the domain's carrier type table (ADR-0155, theme carrier-types), and how a\n * carrier -- whose size MCS does not say -- is shown.\n */\nexport function CarrierHolder<T extends new (...args: any[]) => any>(Base: T) {\n return class extends Base {\n /** Whatever wears this is a carrier holder: the legend resolver finds it up a carrier's parents. */\n get isCarrierHolder(): true {\n return true\n }\n\n /** The records the reconcile took last, as JSON: the same again is not reconciled */\n _carrierRecordsTaken?: string\n\n get showOverflow() {\n return true\n }\n\n get hierarchy() {\n return {\n ...super.hierarchy,\n components: []\n }\n }\n\n // ── items: the holder data is the holder's, the records are worked out from it ─────────────\n\n _itemsFromData(): boolean {\n return false\n }\n\n _keyedById(): boolean {\n return true\n }\n\n /** A carrier the data moves here from another holder travels for two seconds */\n itemMoveAnimation() {\n return { duration: 2000, ease: 'inout' }\n }\n\n _createItemFromRecord(record: CarrierRecord): any {\n const { width, height } = (this as any).state\n return Model.compile(\n { id: record.itemId, type: 'Carrier', left: 0, top: 0, width, height, ...record.itemState },\n (this as any).root?.app\n )\n }\n\n /**\n * One record per carrier the data names, bottom first: MULTICARRIERS in order, then the representative. Without a\n * layout they all stand in the pile. A carrier is told its own keys and whether to show its text.\n */\n carrierRecords(data: Record<string, any> | undefined): CarrierRecord[] {\n return incomingFromV2(data).map(c => ({\n slotId: PILE_SLOT,\n itemId: c.name,\n itemState: this.carrierStateOf(c.record, c.record === data)\n }))\n }\n\n /** What a carrier is told: its own keys (the representative's are picked out of the holder data), and its text */\n carrierStateOf(record: Record<string, any>, representative: boolean): CarrierRecord['itemState'] {\n let data: Record<string, any> = { ...record }\n if (representative) {\n data = { CARRIERNAME: record.CARRIERNAME }\n for (const k of ['CARRIERTYPE', 'EMPTYTYPE', 'CARRIERSTATUS']) if (k in record) data[k] = record[k]\n }\n return { data, showText: !!(this as any).getState('showCarrierText') }\n }\n\n /**\n * The carrier 2D draws (fmsim v2, a rule of position): the top of the data's stack -- MULTICARRIERS bottom first, the\n * holder's own CARRIERNAME last -- when the holder holds it, else the last it holds.\n */\n get topCarrier(): any {\n const items: any[] = (this as any)._items\n const names = incomingFromV2((this as any).data).map(c => c.name)\n for (let i = names.length - 1; i >= 0; i--) {\n const held = items.find(c => c.state.id === names[i])\n if (held) return held\n }\n return items[items.length - 1]\n }\n\n /** The holder's carriers made to be what its data says now. Records the same as last time change nothing */\n syncCarriers(data: Record<string, any> | undefined) {\n const records = this.carrierRecords(data)\n const taken = JSON.stringify(records)\n if (taken === this._carrierRecordsTaken) return\n this._carrierRecordsTaken = taken\n ;(this as any)._reconcileItems(records)\n }\n\n async ready() {\n await super.ready()\n this.syncCarriers((this as any).data)\n }\n\n onchange(after: Record<string, any>, before: Record<string, any>): void {\n super.onchange(after, before)\n /* Its size moves its bottom and changes the size a pile shows carriers at: they take its plan, made and seated again. */\n if ('width' in after || 'height' in after || 'depth' in after) {\n const { width, height } = (this as any).state\n for (const carrier of (this as any)._items) if (width && height) carrier.set({ width, height })\n this._carriersSeatedAgain()\n }\n /* 이 홀더의 Carrier 들이 물려받는 범례가 바뀌었다: 그 피규어들이 범례를 다시 고른다 (ADR-0166 결정 12) */\n if ('carrierLegendName' in after || 'carrierAnimationName' in after) figureLegendSourcesChanged(this)\n if ('showCarrierText' in after || 'slotLayout' in after) {\n this._carrierRecordsTaken = undefined\n this.syncCarriers((this as any).data)\n if ('slotLayout' in after) this._carriersSeatedAgain()\n }\n }\n\n onchangeData(after: Record<string, any>, before: Record<string, any>): void {\n this.syncCarriers(after.data || {})\n super.onchangeData(after, before)\n }\n\n // ── the domain's item types ────────────────────────────────────────────────\n\n /**\n * A carrier's type (ADR-0155): the code it says (its CARRIERTYPE, trimmed and upper-cased -- doc 01, 6.8), in the\n * domain's carrier type table the scene was given when it opened. None when the table does not have it, or the scene\n * was given none.\n */\n carrierItemType(carrier: any): ItemType | null {\n const table = itemTypeTableOf(this)\n return (table && itemTypeEntryOf(table, carrier)) || null\n }\n\n /** A carrier's item type: its code, when the domain's table has it; else null */\n itemTypeOf(carrier: any): string | null {\n return this.carrierItemType(carrier)?.code ?? null\n }\n\n /**\n * A carrier's size in mm, as judged: none. MCS data does not say a carrier's size and a carrier type has none\n * (ADR-0155 amendment 1 C); a carrier is shown at the size of the place it stands in (itemShownDimsOf).\n */\n itemDimsOf(_carrier: any): ItemDims | null {\n return null\n }\n\n /**\n * The size a carrier of unknown size is shown at, in mm (for showing only, never judged). In the pile, most of the\n * holder's plan and half its smaller side high; elsewhere the box filling its slot, its height shared by the stack.\n */\n itemShownDimsOf(_carrier: any, slot: ResolvedSlot, slotId: string): ItemDims | null {\n /* Elsewhere outside the layout, a holder that keeps carriers there says (the exception area: LoadLayoutHolder). */\n if (slotId === PILE_SLOT) {\n const k = (this as any).mmPerSceneUnit\n const { width = 0, height = 0 } = (this as any).state\n const w = Math.abs(width) * PILE_PLAN_RATIO\n const d = Math.abs(height) * PILE_PLAN_RATIO\n return w > 0 && d > 0 ? { width: w * k, depth: d * k, height: Math.min(w, d) * PILE_HEIGHT_RATIO * k } : null\n }\n const layers = Number.isFinite(slot.stackLimit) && slot.stackLimit > 0 ? slot.stackLimit : 1\n return Number.isFinite(slot.allowed.width)\n ? { width: slot.allowed.width, depth: slot.allowed.depth, height: slot.allowed.height / layers }\n : null\n }\n\n /** A carrier's size as it is shown, in mm: its own, or the size its slot shows an unknown one at (its seat's) */\n carrierShownDimsOf(carrier: any): ItemDims | null {\n return (this as any).itemSeatOf(carrier)?.dims ?? null\n }\n\n /** Every carrier made again at the size it is shown at, and every slot seated again */\n _carriersSeatedAgain() {\n const items: any[] = (this as any)._items\n for (const carrier of items) carrier._realObject?.update?.()\n const slots = new Set(items.map(c => c[TRANSFER_SLOT_KEY]))\n for (const slotId of slots) (this as any)._reseatSlot(slotId)\n }\n\n // ── where carriers stand ──────────────────────────────────────────────────\n\n /**\n * Where a holder's carriers rest, in coordinates above the holder's bottom, and whether they stand on it or hang from\n * it: on the transport surface by default (fmsim v2). A Port, Shelf or Shuttle holds them at its bottom; an OHT hangs\n * them below.\n */\n get carrierRest(): { height: number; mount: 'ON' | 'HANG' } {\n return { height: 30, mount: 'ON' }\n }\n\n /** The pile, and the exception area beside the holder's +X edge. Frames in mm on the holder's own anchor (its bottom) */\n outsideSlots() {\n const k = (this as any).mmPerSceneUnit\n const { width = 0 } = (this as any).state\n const w = Math.abs(width)\n const rest = this.carrierRest\n return [\n {\n id: PILE_SLOT,\n anchorId: HOLDER_ANCHOR,\n frame: { position: { x: 0, y: rest.height * k, z: 0 }, rotation: 0 },\n mount: rest.mount\n },\n {\n id: EXCEPTION_SLOT,\n anchorId: HOLDER_ANCHOR,\n frame: {\n position: { x: (w / 2 + w * EXCEPTION_GAP_RATIO) * k + this.exceptionHalfWidth, y: 0, z: 0 },\n rotation: 0\n }\n }\n ]\n }\n\n /** Half the width of a carrier in the exception area, in mm: its edge stands past the gap */\n get exceptionHalfWidth(): number {\n return 0\n }\n\n /**\n * The holder's own anchor is its bottom's centre: a node on the frame at its 3D's origin (the box centre), half its\n * 3D's depth down, turned and moved with it. Others by the layer below.\n */\n anchorObject3D(anchorId: string): any {\n const frame = super.anchorObject3D(anchorId)\n if (anchorId !== HOLDER_ANCHOR || !frame) return frame\n let node = frame.userData.carrierAnchor\n if (!node || node.parent !== frame) {\n node = new frame.constructor()\n node.name = 'carrier-anchor'\n frame.add(node)\n frame.userData.carrierAnchor = node\n }\n node.position.set(0, -(Number((this as any)._realObject?.effectiveDepth) || 0) / 2, 0)\n return node\n }\n }\n}\n\n/* The mixins of things-scene are typed loosely: the holder is still an MCSUnit. */\ninterface MCSCarrierHolder extends MCSUnit {}\n\n/** fmsim's own carrier holder: an MCS unit that holds things, wearing `fmsim.CarrierHolder`. */\nclass MCSCarrierHolder extends CarrierHolder(ItemsDataBinding(Holdable(Capacity(MCSUnit as any)))) {\n static get properties(): any {\n return [...MCSUnit.properties, ...CARRIER_HOLDER_PROPERTIES]\n }\n}\n\nexport default MCSCarrierHolder\n\n/*\n The legend a carrier figure shows its tables by (ADR-0166 7, 12; ADR-0167 11): the nearest carrier holder up its\n parents that chose one for the role -- carrier-legend its carrier legend, carrier-animation its carrier animation --\n then the board root's same choice; none chosen, no answer (the figure's own table, fmsim's default). Colour and effect\n only: a carrier figure's thickness is its own fixed table (ADR-0167 12).\n*/\nconst ROLE_PROPERTY: Record<string, string> = {\n 'carrier-legend': 'carrierLegendName',\n 'carrier-animation': 'carrierAnimationName'\n}\n\nexport function carrierHolderLegend({ component, role }: { component: any; role: string }): unknown {\n const property = ROLE_PROPERTY[role]\n if (!property) return undefined\n let name: unknown\n for (let at = component?.parent; at && !name; at = at.parent) if (at.isCarrierHolder) name = at.state?.[property]\n name ||= component?.root?.rootModel?.state?.[property]\n if (typeof name !== 'string' || !name) return undefined\n let legend = component?.root?.style?.[name]\n if (typeof legend === 'string') {\n try {\n legend = JSON5.parse(legend)\n } catch {\n return undefined\n }\n }\n return legend && typeof legend === 'object' ? colourAndEffect(legend) : undefined\n}\n\n/** A legend as a figure takes it from fmsim: each entry's colour and effect; a colour alone stays the colour; an entry's JSON5 text read. */\nfunction colourAndEffect(legend: Record<string, unknown>): Record<string, unknown> {\n return Object.fromEntries(\n Object.entries(legend).map(([code, raw]) => {\n let entry = raw\n if (typeof entry === 'string' && entry.trim().startsWith('{')) {\n try {\n entry = JSON5.parse(entry)\n } catch {\n return [code, raw]\n }\n }\n if (!entry || typeof entry !== 'object') return [code, entry]\n const { color, effect } = entry as { color?: unknown; effect?: unknown }\n return [code, { ...(color !== undefined ? { color } : {}), ...(effect !== undefined ? { effect } : {}) }]\n })\n )\n}\n\nregisterFigureLegendResolver(carrierHolderLegend)\nregisterFigureCapability({ ...CARRIER_HOLDER, properties: CARRIER_HOLDER_PROPERTIES as never }, base => CarrierHolder(base) as never)\n"]}
|
package/dist/oht.js
CHANGED
|
@@ -12,6 +12,10 @@ let OHT = class OHT extends MCSVehicle {
|
|
|
12
12
|
static get nature() {
|
|
13
13
|
return NATURE;
|
|
14
14
|
}
|
|
15
|
+
/** Carriers hang below the OHT's bottom, the gripper's (fmsim v2) */
|
|
16
|
+
get carrierRest() {
|
|
17
|
+
return { height: 0, mount: 'HANG' };
|
|
18
|
+
}
|
|
15
19
|
get auxColor() {
|
|
16
20
|
return 'black';
|
|
17
21
|
}
|
package/dist/oht.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oht.js","sourceRoot":"","sources":["../src/oht.ts"],"names":[],"mappings":";AAAA,OAAO,EAA8B,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACnF,OAAO,UAAU,MAAM,eAAe,CAAA;AAEtC,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC;CACvC,CAAA;AAED,MAAM,GAAG,GAAG,CAAC,CAAA;AAGE,IAAM,GAAG,GAAT,MAAM,GAAI,SAAQ,UAAU;IACzC,MAAM,KAAK,MAAM;QACf,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAA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;eAzDoB,GAAG","sourcesContent":["import { Component, ComponentNature, sceneComponent } from '@hatiolab/things-scene'\nimport MCSVehicle from './mcs-vehicle'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [...MCSVehicle.properties]\n}\n\nconst GAP = 2\n\n@sceneComponent('OHT')\nexport default class OHT extends MCSVehicle {\n static get nature() {\n return NATURE\n }\n\n /** Carriers hang below the OHT's bottom, the gripper's (fmsim v2) */\n get carrierRest(): { height: number; mount: 'ON' | 'HANG' } {\n return { height: 0, mount: 'HANG' }\n }\n\n get auxColor() {\n return 'black'\n }\n\n /** OHT 의 parentObject 는 OHTLine. */\n get parentObjectTypes(): string[] {\n return ['OHTLine']\n }\n\n getLegendFallback() {\n return (this.root as any).ohtLegendTheme || super.getLegendFallback()\n }\n\n render(ctx: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n ctx.translate(left, top)\n ctx.beginPath()\n\n ctx.strokeStyle = this.auxColor\n ctx.fillStyle = this.statusColor!\n ctx.lineWidth = 1\n ctx.lineCap = 'round'\n ctx.setLineDash([])\n\n // Performance aware\n // const radius = Math.round(Math.min(width, height) * 0.1)\n // ctx.roundRect(0, 0, width, height, radius)\n // ctx.roundRect(GAP, GAP, width - GAP * 2, height - GAP * 2, radius - 1)\n ctx.rect(0, 0, width, height)\n ctx.rect(GAP, GAP, width - GAP * 2, height - GAP * 2)\n\n ctx.fill()\n ctx.stroke()\n\n ctx.beginPath()\n\n ctx.lineCap = 'butt'\n ctx.strokeStyle = 'black'\n ctx.lineWidth = 3\n ctx.moveTo(width / 2, GAP * 2)\n ctx.lineTo(width / 2, height - GAP * 2)\n\n ctx.stroke()\n\n ctx.translate(-left, -top)\n }\n}\n"]}
|
package/dist/port.js
CHANGED
|
@@ -2,16 +2,21 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { sceneComponent } from '@hatiolab/things-scene';
|
|
3
3
|
import { MCSZoneMixin, MCSZoneMixinProperties } from './features/mcs-zone-mixin';
|
|
4
4
|
import MCSCarrierHolder from './mcs-carrier-holder';
|
|
5
|
+
import { LoadLayoutHolder } from './features/load-layout-holder';
|
|
5
6
|
const NATURE = {
|
|
6
7
|
mutable: false,
|
|
7
8
|
resizable: true,
|
|
8
9
|
rotatable: true,
|
|
9
10
|
properties: [...MCSZoneMixinProperties, ...MCSCarrierHolder.properties]
|
|
10
11
|
};
|
|
11
|
-
let Port = class Port extends MCSZoneMixin(MCSCarrierHolder) {
|
|
12
|
+
let Port = class Port extends LoadLayoutHolder(MCSZoneMixin(MCSCarrierHolder)) {
|
|
12
13
|
static get nature() {
|
|
13
14
|
return NATURE;
|
|
14
15
|
}
|
|
16
|
+
/** Carriers stand at the Port's bottom (fmsim v2) */
|
|
17
|
+
get carrierRest() {
|
|
18
|
+
return { height: 0, mount: 'ON' };
|
|
19
|
+
}
|
|
15
20
|
get auxColor() {
|
|
16
21
|
return 'black';
|
|
17
22
|
}
|
package/dist/port.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"port.js","sourceRoot":"","sources":["../src/port.ts"],"names":[],"mappings":";AAAA,OAAO,EAA8B,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,gBAAgB,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"port.js","sourceRoot":"","sources":["../src/port.ts"],"names":[],"mappings":";AAAA,OAAO,EAA8B,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,gBAAgB,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,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,CAAC,MAAM,CAAC;GACF,IAAI,CA0CxB;eA1CoB,IAAI","sourcesContent":["import { Component, ComponentNature, sceneComponent } from '@hatiolab/things-scene'\nimport { MCSZoneMixin, MCSZoneMixinProperties } from './features/mcs-zone-mixin'\nimport MCSCarrierHolder from './mcs-carrier-holder'\nimport { LoadLayoutHolder } from './features/load-layout-holder'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [...MCSZoneMixinProperties, ...MCSCarrierHolder.properties]\n}\n\n@sceneComponent('Port')\nexport default class Port extends LoadLayoutHolder(MCSZoneMixin(MCSCarrierHolder)) {\n static get nature() {\n return NATURE\n }\n\n /** Carriers stand at the Port's bottom (fmsim v2) */\n get carrierRest(): { height: number; mount: 'ON' | 'HANG' } {\n return { height: 0, mount: 'ON' }\n }\n\n get auxColor() {\n return 'black'\n }\n\n getLegendFallback() {\n return (this.root as any).portLegendTheme || super.getLegendFallback()\n }\n\n /** Port 는 후보가 매우 많아 부모 머신 없이는 id 리스트를 조회하지 않는다 (machine 필수). */\n get idLookupRequiresMachine() {\n return true\n }\n\n render(ctx: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n ctx.strokeStyle = this.auxColor\n ctx.fillStyle = this.statusColor!\n ctx.lineWidth = 1\n ctx.lineCap = 'round'\n ctx.setLineDash([])\n\n ctx.beginPath()\n\n // Performance aware\n // const radius = Math.round(Math.min(width, height) * 0.1)\n // ctx.roundRect(left, top, width, height, radius)\n ctx.rect(left, top, width, height)\n\n ctx.fill()\n ctx.stroke()\n }\n}\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Component, RootContainer } from '@hatiolab/things-scene';
|
|
1
|
+
import { Component, RootContainer, figureLegendSourcesChanged } from '@hatiolab/things-scene';
|
|
2
2
|
import { themesColorMap, themesColorRange, themesAnimationMap } from '@fmsim/api';
|
|
3
|
-
import CarrierManager from '../carrier-manager';
|
|
4
3
|
/**
|
|
5
4
|
* 스토커 적재율 게이지 표시 모드 — 런타임 선택지.
|
|
6
5
|
* value 는 엔진 canonical(2D StockerCapacityBar / 3D buildGauge 공통), label 은 표시명.
|
|
@@ -224,6 +223,9 @@ ModelLayer.prototype.onchange = function (after) {
|
|
|
224
223
|
});
|
|
225
224
|
}
|
|
226
225
|
}
|
|
226
|
+
/* 보드의 Carrier 범례가 바뀌었다: Carrier 피규어들이 범례를 다시 고른다 (ADR-0166 결정 12) */
|
|
227
|
+
if (after && ['carrierLegendName', 'carrierAnimationName'].some(k => Object.prototype.hasOwnProperty.call(after, k)))
|
|
228
|
+
figureLegendSourcesChanged();
|
|
227
229
|
return _origModelLayerOnchange.call(this, after);
|
|
228
230
|
};
|
|
229
231
|
// === LegendTheme / AnimationTheme value resolve ===
|
|
@@ -232,7 +234,7 @@ ModelLayer.prototype.onchange = function (after) {
|
|
|
232
234
|
// 형태에 따라 (a) 정상 object 또는 (b) JSON 문자열 둘 다로 나타난다 (2026-06-09
|
|
233
235
|
// 진단 — consumer 인 carrier.ts:animationPreset 이 같은 이유로 typeof string
|
|
234
236
|
// 분기 + JSON5.parse 처리하는 선례 존재). LegendTheme getter 들이 이 분기를
|
|
235
|
-
// 두지 않아 string 통과 →
|
|
237
|
+
// 두지 않아 string 통과 → 구간 조회 매칭 실패 → 3D gauge 의 색상이
|
|
236
238
|
// fallback 으로만 결정되던 증상.
|
|
237
239
|
//
|
|
238
240
|
// fix 는 getter 한 곳에서 lazy parse. WeakMap<state, Map<rawString, parsed>>
|
|
@@ -289,14 +291,6 @@ Object.defineProperty(RootContainer.prototype, 'vehicleAnimation', {
|
|
|
289
291
|
return !!vehicleAnimation;
|
|
290
292
|
}
|
|
291
293
|
});
|
|
292
|
-
Object.defineProperty(RootContainer.prototype, 'carrierManager', {
|
|
293
|
-
get: function () {
|
|
294
|
-
if (!this._carrierManager) {
|
|
295
|
-
this._carrierManager = new CarrierManager(this);
|
|
296
|
-
}
|
|
297
|
-
return this._carrierManager;
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
294
|
// === 스토커 게이지 표시 모드 (런타임 전용 transient) ===
|
|
301
295
|
//
|
|
302
296
|
// 모델(state)에 저장하지 않는다 — nature 속성이 아니므로 보드 직렬화에 포함되지 않고,
|