@operato/scene-storage 10.0.0-beta.58 → 10.0.0-beta.60
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 +22 -0
- package/dist/stockpile.d.ts +11 -0
- package/dist/stockpile.js +10 -0
- package/dist/stockpile.js.map +1 -1
- package/package.json +3 -3
- package/src/stockpile.ts +17 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [10.0.0-beta.60](https://github.com/things-scene/operato-scene/compare/v10.0.0-beta.59...v10.0.0-beta.60) (2026-06-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @operato/scene-storage
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [10.0.0-beta.59](https://github.com/things-scene/operato-scene/compare/v10.0.0-beta.58...v10.0.0-beta.59) (2026-06-17)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### :rocket: New Features
|
|
18
|
+
|
|
19
|
+
* **routing:** Phase B1 — RoutingTarget.routingWeight capability + sink 구현 + validator warning ([d25288d](https://github.com/things-scene/operato-scene/commit/d25288d516509658f446d5a24746aa4b72faa475))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### :bug: Bug Fix
|
|
23
|
+
|
|
24
|
+
* **routing:** 라이브 검증 발견 결함 2건 fix + E2E 단위 테스트 추가 ([88e3b59](https://github.com/things-scene/operato-scene/commit/88e3b599cb1d45f3dd804b3e33ab0dddf7c82392))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [10.0.0-beta.58](https://github.com/things-scene/operato-scene/compare/v10.0.0-beta.57...v10.0.0-beta.58) (2026-06-17)
|
|
7
29
|
|
|
8
30
|
|
package/dist/stockpile.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ export interface StockpileState extends State {
|
|
|
34
34
|
* 매칭해 이 StockPile 로 분배. 미설정 시 routingDestination() 가 state.id 로 fallback.
|
|
35
35
|
*/
|
|
36
36
|
destination?: string;
|
|
37
|
+
/**
|
|
38
|
+
* 라우팅 가중치 (Phase B1). 같은 destination 의 N sink 분산 시 weight 정책 사용.
|
|
39
|
+
* 미설정 = 1. weight ≤ 0 invalid (validator warning).
|
|
40
|
+
*/
|
|
41
|
+
weight?: number;
|
|
37
42
|
/** click 시 invoke 할 Popup 컴포넌트 id (StorageRack / RackGrid 와 동일 패턴). */
|
|
38
43
|
popupRef?: string;
|
|
39
44
|
/**
|
|
@@ -56,6 +61,12 @@ export default class Stockpile extends Stockpile_base implements SlottedHolder {
|
|
|
56
61
|
* 미설정 시 자기 id 로 (단일 sink 직접 지정 fallback). chute 와 동일 규약.
|
|
57
62
|
*/
|
|
58
63
|
routingDestination(): string;
|
|
64
|
+
/**
|
|
65
|
+
* RoutingTarget.routingWeight — state.weight 명시 시만 숫자 반환. 미명시는 undefined →
|
|
66
|
+
* caller 가 *_inDegree fallback (경로 갯수)_* 으로 자연 capacity 측정. default 1 반환은
|
|
67
|
+
* "명시됨" 으로 오인되어 inDegree 무시 — 가중치 결함의 원인 (2026-06-17 라이브 진단).
|
|
68
|
+
*/
|
|
69
|
+
routingWeight(): number | undefined;
|
|
59
70
|
get nature(): ComponentNature;
|
|
60
71
|
get anchors(): never[];
|
|
61
72
|
slotIds(): ReadonlyArray<string>;
|
package/dist/stockpile.js
CHANGED
|
@@ -36,6 +36,7 @@ const NATURE = {
|
|
|
36
36
|
{ type: 'select', label: 'pick-policy', name: 'pickPolicy',
|
|
37
37
|
property: { options: ['lifo', 'fifo'] } },
|
|
38
38
|
{ type: 'string', label: 'destination', name: 'destination' },
|
|
39
|
+
{ type: 'number', label: 'weight', name: 'weight', placeholder: '같은 destination N sink 분산 가중치 (기본 1)' },
|
|
39
40
|
{ type: 'id-input', label: 'popup-ref', name: 'popupRef',
|
|
40
41
|
property: { component: 'popup' } },
|
|
41
42
|
{ type: 'id-input', label: 'legend-target', name: 'legendTarget',
|
|
@@ -55,6 +56,15 @@ let Stockpile = class Stockpile extends RecordStorage()(Holdable(CarrierHolder(P
|
|
|
55
56
|
routingDestination() {
|
|
56
57
|
return this.state.destination ?? this.state.id;
|
|
57
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* RoutingTarget.routingWeight — state.weight 명시 시만 숫자 반환. 미명시는 undefined →
|
|
61
|
+
* caller 가 *_inDegree fallback (경로 갯수)_* 으로 자연 capacity 측정. default 1 반환은
|
|
62
|
+
* "명시됨" 으로 오인되어 inDegree 무시 — 가중치 결함의 원인 (2026-06-17 라이브 진단).
|
|
63
|
+
*/
|
|
64
|
+
routingWeight() {
|
|
65
|
+
const w = this.state.weight;
|
|
66
|
+
return typeof w === 'number' && Number.isFinite(w) ? w : undefined;
|
|
67
|
+
}
|
|
58
68
|
// ── 그래프 참여 ─────────────────────────────────────────────────────────────
|
|
59
69
|
// StockPile 은 *방향 없는 받는 footprint*. 별도 면 anchor 를 publish 하지 않는다 —
|
|
60
70
|
// 어느 면으로 받는지는 의미 없고, 슈트/컨베이어의 *출구 anchor 가 자기 footprint 에
|
package/dist/stockpile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stockpile.js","sourceRoot":"","sources":["../src/stockpile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAmB,iBAAiB,EAAE,QAAQ,EAAc,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5H,OAAO,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,UAAU,EAMX,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAsD/C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,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC5D,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * Stockpile — 평치(block/floor) 보관 영역. 사각형 footprint + `state.data` 의 record[].\n * 실제 carrier component 를 자식으로 두지 않고, 인벤토리(records)의 *_개수와 종류_* 만으로\n * 가상 carrier mesh 를 자동 적치(stackPattern × carrierPreset)해 시각화한다.\n *\n * 데이터 idiom — StorageRack 과 동일 (`state.data: Record[]`). mover 가 pick/place 하면\n * record push/pop, _realObject 가 records.length 기준 mesh 를 재배치.\n *\n * 1단계 — 시각화: 모델에 `data: [{id:'a'},{id:'b'},...]` 가 들어오면 mesh 가 자동 적치.\n * 2단계(추후) — mover 통합: obtainCarrier 가 transient carrier 컴포넌트 materialize,\n * receiveAt 가 record push + carrier dispose.\n */\n\nimport * as THREE from 'three'\nimport { Component, ComponentNature, ContainerAbstract, Holdable, RealObject, sceneComponent } from '@hatiolab/things-scene'\nimport type { State, Material3D } from '@hatiolab/things-scene'\nimport {\n CarrierHolder,\n Placeable,\n RecordStorage,\n SlotTarget,\n type AttachFrame,\n type Alignment,\n type Heights,\n type PlacementArchetype,\n type SlottedHolder\n} from '@operato/scene-base'\n\nimport { Stockpile3D } from './stockpile-3d.js'\n\nexport type StackPattern = 'row' | 'staggered' | 'pyramid' | 'column' | 'pile'\nexport type CarrierPreset = 'box' | 'pallet' | 'drum' | 'sack' | 'crate' | 'bale'\nexport type PickPolicy = 'lifo' | 'fifo'\n\n/** 적치된 carrier 의 record. 향후 sku / weight / 입고시각 등 확장. */\nexport interface StockpileRecord {\n id: string\n [key: string]: any\n}\n\nexport interface StockpileState extends State {\n /** 적치 carrier 의 record 목록 — storage-rack 의 state.data 와 동일 idiom. */\n data?: StockpileRecord[]\n\n /** 적치 형태 프리셋. default 'row'. */\n stackPattern?: StackPattern\n /** 가상 carrier 종류 프리셋. default 'box'. */\n carrierPreset?: CarrierPreset\n\n /** 가상 carrier 한 개의 크기 (없으면 preset 별 기본). */\n carrierWidth?: number\n carrierHeight?: number\n carrierDepth?: number\n /** 적치된 carrier 사이의 평면(xz) 간격 — 0 이면 딱 붙음, default 3. y(단 적층)는 항상 딱 붙음. */\n carrierGap?: number\n\n /** 최대 적치 수 (undefined = 무제한). */\n capacity?: number\n /** 위로 몇 단까지 (undefined = stack 형태에 맡김). */\n stackHeightLimit?: number\n /** 어느 끝에서 빼나. default 'lifo'. */\n pickPolicy?: PickPolicy\n\n /**\n * 라우팅 행선지 값 (RoutingTarget). sorter/router 가 carrier.destination 과 string\n * 매칭해 이 StockPile 로 분배. 미설정 시 routingDestination() 가 state.id 로 fallback.\n */\n destination?: string\n\n /** click 시 invoke 할 Popup 컴포넌트 id (StorageRack / RackGrid 와 동일 패턴). */\n popupRef?: string\n\n /**\n * Legend 컴포넌트 id. legend 의 `state.status = {field, ranges, defaultColor}` 를\n * 참조해 각 record 의 field 값을 색상으로 매핑한다 (StorageRack 와 동일 패턴).\n * 미명시 시 scene 안 `type='legend'` 첫 컴포넌트 자동 발견.\n */\n legendTarget?: string\n\n material3d?: Material3D\n}\n\nconst SLOT_ID = 'pile'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n { type: 'select', label: 'stack-pattern', name: 'stackPattern',\n property: { options: ['row', 'staggered', 'pyramid', 'column', 'pile'] } },\n { type: 'select', label: 'carrier-preset', name: 'carrierPreset',\n property: { options: ['box', 'pallet', 'drum', 'sack', 'crate', 'bale'] } },\n { type: 'number', label: 'carrier-width', name: 'carrierWidth' },\n { type: 'number', label: 'carrier-height', name: 'carrierHeight' },\n { type: 'number', label: 'carrier-depth', name: 'carrierDepth' },\n { type: 'number', label: 'carrier-gap', name: 'carrierGap' },\n { type: 'number', label: 'capacity', name: 'capacity' },\n { type: 'number', label: 'stack-height-limit', name: 'stackHeightLimit' },\n { type: 'select', label: 'pick-policy', name: 'pickPolicy',\n property: { options: ['lifo', 'fifo'] } },\n { type: 'string', label: 'destination', name: 'destination' },\n { type: 'id-input', label: 'popup-ref', name: 'popupRef',\n property: { component: 'popup' } },\n { type: 'id-input', label: 'legend-target', name: 'legendTarget',\n property: { component: 'legend' },\n placeholder: '미명시 시 scene 의 legend 자동 발견' }\n ],\n help: 'scene/component/stockpile'\n}\n\n@sceneComponent('stockpile')\nexport default class Stockpile extends RecordStorage<StockpileRecord>()(\n Holdable(CarrierHolder(Placeable(ContainerAbstract)))\n) implements SlottedHolder {\n declare state: StockpileState\n declare _realObject?: Stockpile3D\n\n static placement: PlacementArchetype = 'floor'\n static align: Alignment = 'bottom'\n static defaultDepth = (_h: Heights) => 5 // pad 두께\n\n /**\n * RoutingTarget — 자기 행선지 값 publish. sorter 가 carrier.destination 과 매칭.\n * 미설정 시 자기 id 로 (단일 sink 직접 지정 fallback). chute 와 동일 규약.\n */\n routingDestination(): string {\n return (this.state.destination as string | undefined) ?? (this.state.id as string)\n }\n\n // ── 그래프 참여 ─────────────────────────────────────────────────────────────\n // StockPile 은 *방향 없는 받는 footprint*. 별도 면 anchor 를 publish 하지 않는다 —\n // 어느 면으로 받는지는 의미 없고, 슈트/컨베이어의 *출구 anchor 가 자기 footprint 에\n // 닿으면*(matchOutbounds 의 deliversInto, bounds 기반) 자동 연결된다. (사용자 명시\n // 2026-06-14: \"스톡파일은 슈트의 출구와 면한 부분이 있으면 그곳을 링크\".) RoutingTarget\n // (routingDestination) 만으로 그래프 노드로 수집되고, bounds 는 coordinator 가 채운다.\n // 멀리 떨어진 타겟은 명시 링크(nextRef/RoutingLinks)로 연결.\n\n get nature(): ComponentNature { return NATURE }\n get anchors() { return [] }\n\n // ── records / inventoryCount: RecordStorage mixin 제공.\n\n // ── SlottedHolder duck-type override — 단일 slot ('pile') ───────────────\n // mixin default 는 record 마다 slotId. Stockpile 은 *_단일 슬롯_* 시맨틱이라\n // 자기 구현 유지.\n slotIds(): ReadonlyArray<string> { return [SLOT_ID] }\n\n hasCarrierAt(slotId: string): boolean {\n return slotId === SLOT_ID && this.inventoryCount > 0\n }\n\n canReceiveAt(slotId: string, _carrier?: Component): boolean {\n if (slotId !== SLOT_ID) return false\n const cap = this.state.capacity\n if (typeof cap === 'number' && this.inventoryCount >= cap) return false\n return true\n }\n\n /** Transferable contract — dispatch/Transfer planning 이 capacity 확인에 호출. 단일 slot 위임. */\n canReceive(carrier?: Component): boolean {\n return this.canReceiveAt(SLOT_ID, carrier)\n }\n\n occupiedSlotIds(): ReadonlyArray<string> {\n return this.inventoryCount > 0 ? [SLOT_ID] : []\n }\n emptySlotIds(): ReadonlyArray<string> {\n return this.canReceiveAt(SLOT_ID) ? [SLOT_ID] : []\n }\n\n /**\n * record 한 개를 빼서 carrier 컴포넌트로 transient materialize. mover 가 pickup\n * 하면 이걸 reparent 해서 들고 다닌다. storage-rack._materializeCarrier 와 동일\n * 패턴 — Component.register(type) 으로 클래스 lookup, addComponent({silent: true})\n * 로 cascade 차단.\n */\n obtainCarrier(slotId: string): Component | null {\n if (slotId !== SLOT_ID) return null\n if (this.records.length === 0) return null\n const records = [...this.records]\n const policy = (this.state.pickPolicy ?? 'lifo') as PickPolicy\n const record = policy === 'fifo' ? records.shift()! : records.pop()!\n this._setDataSilently(records)\n return this._materializeCarrier(record)\n }\n\n private _materializeCarrier(record: StockpileRecord): Component | null {\n // carrierPreset → 등록된 컴포넌트 type. 미등록(drum/sack/bale 등) 은 시각 mesh\n // 전용이라 carrier 컴포넌트로는 fallback ('parcel'/'box').\n const preset = (this.state.carrierPreset ?? 'box') as CarrierPreset\n const PRESET_TO_TYPE: Record<CarrierPreset, string> = {\n box: 'box',\n pallet: 'pallet',\n crate: 'box',\n drum: 'parcel',\n sack: 'parcel',\n bale: 'parcel'\n }\n const carrierType = (record as any).type ?? PRESET_TO_TYPE[preset] ?? 'parcel'\n const CarrierClass = (Component as any).register(carrierType) as\n | (new (...args: any[]) => Component) | undefined\n if (!CarrierClass) {\n console.warn(`[stockpile] carrier type \"${carrierType}\" 미등록 — obtainCarrier 실패`)\n return null\n }\n\n // 크기 — state.carrier* 또는 preset default\n const stockpileW = (this.state as any).width ?? 100\n const stockpileH = (this.state as any).height ?? 100\n const cw = this.state.carrierWidth ?? 30\n const ch = this.state.carrierHeight ?? 30\n const cd = this.state.carrierDepth ?? 22\n\n // id/refid/transform 류 제외 — scene 안 기존 component 충돌 회피 (storage-rack 패턴)\n const { id: _id, refid: _refid, transform: _tf, ...recordCopy } = record as any\n // stockpile-inner 좌표 — center 에 놓기 (Mover 가 곧 pick 해 들고 감)\n const carrierState: any = {\n ...recordCopy,\n type: carrierType,\n width: cw,\n height: ch,\n depth: cd,\n refid: _nextStockpileCarrierRefid(),\n left: stockpileW / 2 - cw / 2,\n top: stockpileH / 2 - ch / 2\n }\n\n const carrier = new CarrierClass(carrierState, (this as any)._app)\n // transient carrier → _holdings (모델링 자식 `_components` 아님). Mover.pick\n // 이 reparent 호출 시 ContainerAbstract.addComponent 가 oldContainer._holdings\n // 도 자동 정리 (stale 방지, §1.2 직교). board JSON 직렬화 / Inspector 표시\n // 자동 차단 — Spot 시범 패턴 (2026-06-16).\n ;(this as any).addHolding(carrier)\n void (carrier as any).realObject\n ;(carrier as any).applyHolderAttachPoint?.()\n return carrier\n }\n\n /**\n * carrier 의 state → StockpileRecord 추출. id 누락 시 `stk-` prefix 자동 생성.\n * transform/refid 등 *_물리적 위치 필드_* 는 *_제외_* — record 는 *_논리적 식별_*\n * 만. SlottedHolder duck 의 표준 entry point — receiveAt 안에서 호출.\n */\n recordFromCarrier(carrier: Component, _slotId: string): StockpileRecord {\n const cstate: any = (carrier as any)?.state ?? {}\n const cid = cstate.id ?? `stk-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`\n return {\n id: String(cid),\n ...(cstate.type ? { type: cstate.type } : {}),\n ...(typeof cstate.width === 'number' ? { width: cstate.width } : {}),\n ...(typeof cstate.height === 'number' ? { height: cstate.height } : {}),\n ...(typeof cstate.depth === 'number' ? { depth: cstate.depth } : {})\n }\n }\n\n /**\n * carrier 를 받아 record 로 push, carrier 객체는 dispose (시각은 _realObject 가\n * records 길이 기준 자동 갱신). capacity 초과 시도는 canReceiveAt 가 이미 차단.\n */\n async receiveAt(slotId: string, carrier: Component, _options?: any): Promise<void> {\n const record = this.recordFromCarrier(carrier, slotId)\n const records = [...this.records, record]\n this._setDataSilently(records)\n ;(carrier as any)?.dispose?.()\n }\n\n /** dispatch → handoff 의 accept 분기 — receiveAt 으로 위임. */\n async accept(carrier: Component, options?: any): Promise<void> {\n return this.receiveAt(SLOT_ID, carrier, options)\n }\n async receive(carrier: Component, options?: any): Promise<void> {\n return this.receiveAt(SLOT_ID, carrier, options)\n }\n\n /**\n * mover 가 obtainCarrier 로 빼낸 transient carrier 를 pad 위에 안착 (잠깐 보이는\n * 위치). mover 가 pick 하면 즉시 deck 으로 reparent 되므로 잔류는 짧다.\n * Spot 과 동일 idiom — pad-top + carrier 의 halfDepth 만큼 들어올림.\n */\n attachPointFor(carrier: Component): AttachFrame | null {\n const ro = this._realObject\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 slotTargetAt(slotId: string): SlotTarget {\n return new SlotTarget(this as any, slotId)\n }\n getSlotAttachObject3d(slotId: string): any {\n // slotId 가 'pile' 이면 pad. record.id 면 그 carrier mesh — popup tether 가 그\n // stock 에 정확히 연결되도록.\n return (this as any)._realObject?.getAttachFrame?.(slotId)\n }\n\n // _setDataSilently 는 RecordStorage mixin 제공 — 다만 mixin 은 _rebuildVisual\n // 호출. Stockpile 의 3D 갱신은 update() 라서 hook override.\n _rebuildVisual(): void {\n this._realObject?.update?.()\n }\n\n /**\n * 2D — outlined pad + 인벤토리 카운트 텍스트. 평치 의도가 한 눈에 — 사각 영역 위에\n * 적재된 carrier 수가 가운데 큰 글씨로.\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) || '#c89c5c'\n const strokeStyle = (this.state.strokeStyle as string) || fillStyle\n\n // pad (반투명)\n ctx.save()\n ctx.fillStyle = fillStyle\n ctx.globalAlpha = 0.18\n ctx.fillRect(left, top, width, height)\n ctx.restore()\n\n // outline (dashed)\n ctx.save()\n ctx.strokeStyle = strokeStyle\n ctx.lineWidth = 1.5\n ctx.setLineDash([6, 3])\n ctx.strokeRect(left + 0.75, top + 0.75, width - 1.5, height - 1.5)\n ctx.setLineDash([])\n ctx.restore()\n\n // 인벤토리 수 + capacity (있으면)\n ctx.save()\n const fontSize = Math.min(width, height) * 0.22\n ctx.fillStyle = '#333'\n ctx.font = `bold ${fontSize}px sans-serif`\n ctx.textAlign = 'center'\n ctx.textBaseline = 'middle'\n const label = typeof this.state.capacity === 'number'\n ? `${this.inventoryCount}/${this.state.capacity}`\n : `${this.inventoryCount}`\n ctx.fillText(label, left + width / 2, top + height / 2)\n ctx.restore()\n }\n\n // ── Popup 연동 — storage-rack 동일 패턴 ───────────────────────────────\n /**\n * things-scene EventManager3D 가 raycast → object3d.userData.context.component 의\n * `trigger(\"click\", mouseEvent)` 을 호출 → eventMap 으로 receive. pad / carrier mesh\n * 어느 쪽을 클릭하든 stockpile 전체 popup invoke (단일 slot 이라 cell 구분 없음).\n */\n get eventMap() {\n return {\n '(self)': {\n '(self)': {\n click: this._onStockpileClick\n }\n }\n }\n }\n\n private _onStockpileClick = (mouseEvent: MouseEvent) => {\n // view mode 에서만 동작 (modeling 중 click 은 framework 선택 로직 우선).\n if (!(this as any).app?.isViewMode) return\n const hit = this._raycastStockpileHit(mouseEvent)\n if (!hit) return\n // hit.object 가 carrier mesh 면 userData.recordId 보유 → 그 stock 의 popup.\n // pad / 기타면 stockpile 전체 popup.\n const recordId = hit.object?.userData?.recordId as string | undefined\n this._dispatchStockpilePopup(typeof recordId === 'string' ? recordId : undefined)\n }\n\n /**\n * state.popupRef 가 가리키는 Popup 컴포넌트를 invoke.\n * - recordId 명시 → 그 record 의 anchor = mesh. payload = 해당 record.\n * - 미명시 (pad 클릭) → 'pile' anchor (pad). payload = 전체 inventory.\n *\n * RecordStorage mixin 의 `_invokePopup(slotId, payload)` 를 활용. 단일 slot\n * 시맨틱이 record/pile 두 모드라 mixin 위 wrapper 로 dispatch.\n */\n private _dispatchStockpilePopup(recordId?: string): void {\n if (!this.state.popupRef) return\n if (recordId) {\n const record = (this.records as ReadonlyArray<StockpileRecord>)\n .find(r => r.id === recordId) ?? { id: recordId }\n this._invokePopup(recordId, record)\n } else {\n this._invokePopup(SLOT_ID, {\n componentId: (this.state as any).id,\n records: this.records,\n inventoryCount: this.inventoryCount,\n capacity: this.state.capacity,\n carrierPreset: this.state.carrierPreset,\n stackPattern: this.state.stackPattern\n })\n }\n }\n\n /**\n * 클릭 시 framework 의 mouse NDC 를 재사용해 raycast → *우리 stockpile* 의 어떤 mesh 가\n * closest hit 인지 반환 (다른 object 가 더 가까우면 undefined). storage-rack._raycastRackHit\n * 와 동일 패턴 — capability.getObjectsByRaycast 우선, 없으면 scene/camera/canvas 재구성.\n */\n private _raycastStockpileHit(mouseEvent: MouseEvent): THREE.Intersection | undefined {\n const ro: any = (this as any)._realObject\n if (!ro?.object3d) return undefined\n\n const tc: any = ro.threeContainer\n if (!tc) return undefined\n\n const cap: any = tc._threeCapability ?? tc._capability\n let intersects: THREE.Intersection[] | undefined\n if (cap?.getObjectsByRaycast) {\n intersects = cap.getObjectsByRaycast() as THREE.Intersection[] | undefined\n }\n if (!intersects || intersects.length === 0) {\n const scene = tc.scene3d as THREE.Scene | undefined\n const renderer = tc.renderer3d as THREE.WebGLRenderer | undefined\n const camera =\n (tc.activeCamera3d as THREE.Camera | undefined) ??\n (cap?.activeCamera as THREE.Camera | undefined) ??\n (cap?.camera as THREE.Camera | undefined)\n const canvas = renderer?.domElement\n if (!scene || !canvas || !camera) return undefined\n const rect = canvas.getBoundingClientRect()\n if (rect.width === 0 || rect.height === 0) return undefined\n const ndc = new THREE.Vector2(\n ((mouseEvent.clientX - rect.left) / rect.width) * 2 - 1,\n -((mouseEvent.clientY - rect.top) / rect.height) * 2 + 1\n )\n const raycaster = new THREE.Raycaster()\n raycaster.setFromCamera(ndc, camera)\n intersects = raycaster.intersectObjects(scene.children, true)\n }\n if (!intersects || intersects.length === 0) return undefined\n\n // 가장 가까운 hit 이 *이 stockpile* 의 descendant 여야 한다 (다른 mesh 가 사이에 있으면 skip).\n const closest = intersects[0]\n let obj: THREE.Object3D | null = closest.object\n while (obj) {\n if (obj.userData?.context === ro) return closest\n obj = obj.parent\n }\n return undefined\n }\n\n // legendTarget / _onLegendChanged / resolveLegendColor — RecordStorage mixin 제공.\n\n buildRealObject(): RealObject | undefined {\n return new Stockpile3D(this)\n }\n}\n\n// transient carrier refid — scene 내 기존 컴포넌트와 충돌 회피용 큰 시작값\n// (storage-rack 의 _nextCarrierRefid 와 같은 idiom, 별도 범위로 분리).\nlet _stockpileCarrierSeq = 0\nfunction _nextStockpileCarrierRefid(): number {\n return 800000 + (_stockpileCarrierSeq++)\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 const d = (c as any)?.state?.depth\n return typeof d === 'number' && Number.isFinite(d) ? d : 0\n}\n"]}
|
|
1
|
+
{"version":3,"file":"stockpile.js","sourceRoot":"","sources":["../src/stockpile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAmB,iBAAiB,EAAE,QAAQ,EAAc,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5H,OAAO,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,UAAU,EAMX,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,WAAW,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AAA;AAC5B,SAAS,0BAA0B;IACjC,OAAO,MAAM,GAAG,CAAC,oBAAoB,EAAE,CAAC,CAAA;AAC1C,CAAC;AAED,SAAS,YAAY,CAAC,CAAY;IAChC,MAAM,GAAG,GAAI,CAAS,CAAC,WAAW,EAAE,cAAc,CAAA;IAClD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAA;IAC/D,MAAM,CAAC,GAAI,CAAS,EAAE,KAAK,EAAE,KAAK,CAAA;IAClC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC5D,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * Stockpile — 평치(block/floor) 보관 영역. 사각형 footprint + `state.data` 의 record[].\n * 실제 carrier component 를 자식으로 두지 않고, 인벤토리(records)의 *_개수와 종류_* 만으로\n * 가상 carrier mesh 를 자동 적치(stackPattern × carrierPreset)해 시각화한다.\n *\n * 데이터 idiom — StorageRack 과 동일 (`state.data: Record[]`). mover 가 pick/place 하면\n * record push/pop, _realObject 가 records.length 기준 mesh 를 재배치.\n *\n * 1단계 — 시각화: 모델에 `data: [{id:'a'},{id:'b'},...]` 가 들어오면 mesh 가 자동 적치.\n * 2단계(추후) — mover 통합: obtainCarrier 가 transient carrier 컴포넌트 materialize,\n * receiveAt 가 record push + carrier dispose.\n */\n\nimport * as THREE from 'three'\nimport { Component, ComponentNature, ContainerAbstract, Holdable, RealObject, sceneComponent } from '@hatiolab/things-scene'\nimport type { State, Material3D } from '@hatiolab/things-scene'\nimport {\n CarrierHolder,\n Placeable,\n RecordStorage,\n SlotTarget,\n type AttachFrame,\n type Alignment,\n type Heights,\n type PlacementArchetype,\n type SlottedHolder\n} from '@operato/scene-base'\n\nimport { Stockpile3D } from './stockpile-3d.js'\n\nexport type StackPattern = 'row' | 'staggered' | 'pyramid' | 'column' | 'pile'\nexport type CarrierPreset = 'box' | 'pallet' | 'drum' | 'sack' | 'crate' | 'bale'\nexport type PickPolicy = 'lifo' | 'fifo'\n\n/** 적치된 carrier 의 record. 향후 sku / weight / 입고시각 등 확장. */\nexport interface StockpileRecord {\n id: string\n [key: string]: any\n}\n\nexport interface StockpileState extends State {\n /** 적치 carrier 의 record 목록 — storage-rack 의 state.data 와 동일 idiom. */\n data?: StockpileRecord[]\n\n /** 적치 형태 프리셋. default 'row'. */\n stackPattern?: StackPattern\n /** 가상 carrier 종류 프리셋. default 'box'. */\n carrierPreset?: CarrierPreset\n\n /** 가상 carrier 한 개의 크기 (없으면 preset 별 기본). */\n carrierWidth?: number\n carrierHeight?: number\n carrierDepth?: number\n /** 적치된 carrier 사이의 평면(xz) 간격 — 0 이면 딱 붙음, default 3. y(단 적층)는 항상 딱 붙음. */\n carrierGap?: number\n\n /** 최대 적치 수 (undefined = 무제한). */\n capacity?: number\n /** 위로 몇 단까지 (undefined = stack 형태에 맡김). */\n stackHeightLimit?: number\n /** 어느 끝에서 빼나. default 'lifo'. */\n pickPolicy?: PickPolicy\n\n /**\n * 라우팅 행선지 값 (RoutingTarget). sorter/router 가 carrier.destination 과 string\n * 매칭해 이 StockPile 로 분배. 미설정 시 routingDestination() 가 state.id 로 fallback.\n */\n destination?: string\n\n /**\n * 라우팅 가중치 (Phase B1). 같은 destination 의 N sink 분산 시 weight 정책 사용.\n * 미설정 = 1. weight ≤ 0 invalid (validator warning).\n */\n weight?: number\n\n /** click 시 invoke 할 Popup 컴포넌트 id (StorageRack / RackGrid 와 동일 패턴). */\n popupRef?: string\n\n /**\n * Legend 컴포넌트 id. legend 의 `state.status = {field, ranges, defaultColor}` 를\n * 참조해 각 record 의 field 값을 색상으로 매핑한다 (StorageRack 와 동일 패턴).\n * 미명시 시 scene 안 `type='legend'` 첫 컴포넌트 자동 발견.\n */\n legendTarget?: string\n\n material3d?: Material3D\n}\n\nconst SLOT_ID = 'pile'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n { type: 'select', label: 'stack-pattern', name: 'stackPattern',\n property: { options: ['row', 'staggered', 'pyramid', 'column', 'pile'] } },\n { type: 'select', label: 'carrier-preset', name: 'carrierPreset',\n property: { options: ['box', 'pallet', 'drum', 'sack', 'crate', 'bale'] } },\n { type: 'number', label: 'carrier-width', name: 'carrierWidth' },\n { type: 'number', label: 'carrier-height', name: 'carrierHeight' },\n { type: 'number', label: 'carrier-depth', name: 'carrierDepth' },\n { type: 'number', label: 'carrier-gap', name: 'carrierGap' },\n { type: 'number', label: 'capacity', name: 'capacity' },\n { type: 'number', label: 'stack-height-limit', name: 'stackHeightLimit' },\n { type: 'select', label: 'pick-policy', name: 'pickPolicy',\n property: { options: ['lifo', 'fifo'] } },\n { type: 'string', label: 'destination', name: 'destination' },\n { type: 'number', label: 'weight', name: 'weight', placeholder: '같은 destination N sink 분산 가중치 (기본 1)' },\n { type: 'id-input', label: 'popup-ref', name: 'popupRef',\n property: { component: 'popup' } },\n { type: 'id-input', label: 'legend-target', name: 'legendTarget',\n property: { component: 'legend' },\n placeholder: '미명시 시 scene 의 legend 자동 발견' }\n ],\n help: 'scene/component/stockpile'\n}\n\n@sceneComponent('stockpile')\nexport default class Stockpile extends RecordStorage<StockpileRecord>()(\n Holdable(CarrierHolder(Placeable(ContainerAbstract)))\n) implements SlottedHolder {\n declare state: StockpileState\n declare _realObject?: Stockpile3D\n\n static placement: PlacementArchetype = 'floor'\n static align: Alignment = 'bottom'\n static defaultDepth = (_h: Heights) => 5 // pad 두께\n\n /**\n * RoutingTarget — 자기 행선지 값 publish. sorter 가 carrier.destination 과 매칭.\n * 미설정 시 자기 id 로 (단일 sink 직접 지정 fallback). chute 와 동일 규약.\n */\n routingDestination(): string {\n return (this.state.destination as string | undefined) ?? (this.state.id as string)\n }\n\n /**\n * RoutingTarget.routingWeight — state.weight 명시 시만 숫자 반환. 미명시는 undefined →\n * caller 가 *_inDegree fallback (경로 갯수)_* 으로 자연 capacity 측정. default 1 반환은\n * \"명시됨\" 으로 오인되어 inDegree 무시 — 가중치 결함의 원인 (2026-06-17 라이브 진단).\n */\n routingWeight(): number | undefined {\n const w = this.state.weight\n return typeof w === 'number' && Number.isFinite(w) ? w : undefined\n }\n\n // ── 그래프 참여 ─────────────────────────────────────────────────────────────\n // StockPile 은 *방향 없는 받는 footprint*. 별도 면 anchor 를 publish 하지 않는다 —\n // 어느 면으로 받는지는 의미 없고, 슈트/컨베이어의 *출구 anchor 가 자기 footprint 에\n // 닿으면*(matchOutbounds 의 deliversInto, bounds 기반) 자동 연결된다. (사용자 명시\n // 2026-06-14: \"스톡파일은 슈트의 출구와 면한 부분이 있으면 그곳을 링크\".) RoutingTarget\n // (routingDestination) 만으로 그래프 노드로 수집되고, bounds 는 coordinator 가 채운다.\n // 멀리 떨어진 타겟은 명시 링크(nextRef/RoutingLinks)로 연결.\n\n get nature(): ComponentNature { return NATURE }\n get anchors() { return [] }\n\n // ── records / inventoryCount: RecordStorage mixin 제공.\n\n // ── SlottedHolder duck-type override — 단일 slot ('pile') ───────────────\n // mixin default 는 record 마다 slotId. Stockpile 은 *_단일 슬롯_* 시맨틱이라\n // 자기 구현 유지.\n slotIds(): ReadonlyArray<string> { return [SLOT_ID] }\n\n hasCarrierAt(slotId: string): boolean {\n return slotId === SLOT_ID && this.inventoryCount > 0\n }\n\n canReceiveAt(slotId: string, _carrier?: Component): boolean {\n if (slotId !== SLOT_ID) return false\n const cap = this.state.capacity\n if (typeof cap === 'number' && this.inventoryCount >= cap) return false\n return true\n }\n\n /** Transferable contract — dispatch/Transfer planning 이 capacity 확인에 호출. 단일 slot 위임. */\n canReceive(carrier?: Component): boolean {\n return this.canReceiveAt(SLOT_ID, carrier)\n }\n\n occupiedSlotIds(): ReadonlyArray<string> {\n return this.inventoryCount > 0 ? [SLOT_ID] : []\n }\n emptySlotIds(): ReadonlyArray<string> {\n return this.canReceiveAt(SLOT_ID) ? [SLOT_ID] : []\n }\n\n /**\n * record 한 개를 빼서 carrier 컴포넌트로 transient materialize. mover 가 pickup\n * 하면 이걸 reparent 해서 들고 다닌다. storage-rack._materializeCarrier 와 동일\n * 패턴 — Component.register(type) 으로 클래스 lookup, addComponent({silent: true})\n * 로 cascade 차단.\n */\n obtainCarrier(slotId: string): Component | null {\n if (slotId !== SLOT_ID) return null\n if (this.records.length === 0) return null\n const records = [...this.records]\n const policy = (this.state.pickPolicy ?? 'lifo') as PickPolicy\n const record = policy === 'fifo' ? records.shift()! : records.pop()!\n this._setDataSilently(records)\n return this._materializeCarrier(record)\n }\n\n private _materializeCarrier(record: StockpileRecord): Component | null {\n // carrierPreset → 등록된 컴포넌트 type. 미등록(drum/sack/bale 등) 은 시각 mesh\n // 전용이라 carrier 컴포넌트로는 fallback ('parcel'/'box').\n const preset = (this.state.carrierPreset ?? 'box') as CarrierPreset\n const PRESET_TO_TYPE: Record<CarrierPreset, string> = {\n box: 'box',\n pallet: 'pallet',\n crate: 'box',\n drum: 'parcel',\n sack: 'parcel',\n bale: 'parcel'\n }\n const carrierType = (record as any).type ?? PRESET_TO_TYPE[preset] ?? 'parcel'\n const CarrierClass = (Component as any).register(carrierType) as\n | (new (...args: any[]) => Component) | undefined\n if (!CarrierClass) {\n console.warn(`[stockpile] carrier type \"${carrierType}\" 미등록 — obtainCarrier 실패`)\n return null\n }\n\n // 크기 — state.carrier* 또는 preset default\n const stockpileW = (this.state as any).width ?? 100\n const stockpileH = (this.state as any).height ?? 100\n const cw = this.state.carrierWidth ?? 30\n const ch = this.state.carrierHeight ?? 30\n const cd = this.state.carrierDepth ?? 22\n\n // id/refid/transform 류 제외 — scene 안 기존 component 충돌 회피 (storage-rack 패턴)\n const { id: _id, refid: _refid, transform: _tf, ...recordCopy } = record as any\n // stockpile-inner 좌표 — center 에 놓기 (Mover 가 곧 pick 해 들고 감)\n const carrierState: any = {\n ...recordCopy,\n type: carrierType,\n width: cw,\n height: ch,\n depth: cd,\n refid: _nextStockpileCarrierRefid(),\n left: stockpileW / 2 - cw / 2,\n top: stockpileH / 2 - ch / 2\n }\n\n const carrier = new CarrierClass(carrierState, (this as any)._app)\n // transient carrier → _holdings (모델링 자식 `_components` 아님). Mover.pick\n // 이 reparent 호출 시 ContainerAbstract.addComponent 가 oldContainer._holdings\n // 도 자동 정리 (stale 방지, §1.2 직교). board JSON 직렬화 / Inspector 표시\n // 자동 차단 — Spot 시범 패턴 (2026-06-16).\n ;(this as any).addHolding(carrier)\n void (carrier as any).realObject\n ;(carrier as any).applyHolderAttachPoint?.()\n return carrier\n }\n\n /**\n * carrier 의 state → StockpileRecord 추출. id 누락 시 `stk-` prefix 자동 생성.\n * transform/refid 등 *_물리적 위치 필드_* 는 *_제외_* — record 는 *_논리적 식별_*\n * 만. SlottedHolder duck 의 표준 entry point — receiveAt 안에서 호출.\n */\n recordFromCarrier(carrier: Component, _slotId: string): StockpileRecord {\n const cstate: any = (carrier as any)?.state ?? {}\n const cid = cstate.id ?? `stk-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`\n return {\n id: String(cid),\n ...(cstate.type ? { type: cstate.type } : {}),\n ...(typeof cstate.width === 'number' ? { width: cstate.width } : {}),\n ...(typeof cstate.height === 'number' ? { height: cstate.height } : {}),\n ...(typeof cstate.depth === 'number' ? { depth: cstate.depth } : {})\n }\n }\n\n /**\n * carrier 를 받아 record 로 push, carrier 객체는 dispose (시각은 _realObject 가\n * records 길이 기준 자동 갱신). capacity 초과 시도는 canReceiveAt 가 이미 차단.\n */\n async receiveAt(slotId: string, carrier: Component, _options?: any): Promise<void> {\n const record = this.recordFromCarrier(carrier, slotId)\n const records = [...this.records, record]\n this._setDataSilently(records)\n ;(carrier as any)?.dispose?.()\n }\n\n /** dispatch → handoff 의 accept 분기 — receiveAt 으로 위임. */\n async accept(carrier: Component, options?: any): Promise<void> {\n return this.receiveAt(SLOT_ID, carrier, options)\n }\n async receive(carrier: Component, options?: any): Promise<void> {\n return this.receiveAt(SLOT_ID, carrier, options)\n }\n\n /**\n * mover 가 obtainCarrier 로 빼낸 transient carrier 를 pad 위에 안착 (잠깐 보이는\n * 위치). mover 가 pick 하면 즉시 deck 으로 reparent 되므로 잔류는 짧다.\n * Spot 과 동일 idiom — pad-top + carrier 의 halfDepth 만큼 들어올림.\n */\n attachPointFor(carrier: Component): AttachFrame | null {\n const ro = this._realObject\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 slotTargetAt(slotId: string): SlotTarget {\n return new SlotTarget(this as any, slotId)\n }\n getSlotAttachObject3d(slotId: string): any {\n // slotId 가 'pile' 이면 pad. record.id 면 그 carrier mesh — popup tether 가 그\n // stock 에 정확히 연결되도록.\n return (this as any)._realObject?.getAttachFrame?.(slotId)\n }\n\n // _setDataSilently 는 RecordStorage mixin 제공 — 다만 mixin 은 _rebuildVisual\n // 호출. Stockpile 의 3D 갱신은 update() 라서 hook override.\n _rebuildVisual(): void {\n this._realObject?.update?.()\n }\n\n /**\n * 2D — outlined pad + 인벤토리 카운트 텍스트. 평치 의도가 한 눈에 — 사각 영역 위에\n * 적재된 carrier 수가 가운데 큰 글씨로.\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) || '#c89c5c'\n const strokeStyle = (this.state.strokeStyle as string) || fillStyle\n\n // pad (반투명)\n ctx.save()\n ctx.fillStyle = fillStyle\n ctx.globalAlpha = 0.18\n ctx.fillRect(left, top, width, height)\n ctx.restore()\n\n // outline (dashed)\n ctx.save()\n ctx.strokeStyle = strokeStyle\n ctx.lineWidth = 1.5\n ctx.setLineDash([6, 3])\n ctx.strokeRect(left + 0.75, top + 0.75, width - 1.5, height - 1.5)\n ctx.setLineDash([])\n ctx.restore()\n\n // 인벤토리 수 + capacity (있으면)\n ctx.save()\n const fontSize = Math.min(width, height) * 0.22\n ctx.fillStyle = '#333'\n ctx.font = `bold ${fontSize}px sans-serif`\n ctx.textAlign = 'center'\n ctx.textBaseline = 'middle'\n const label = typeof this.state.capacity === 'number'\n ? `${this.inventoryCount}/${this.state.capacity}`\n : `${this.inventoryCount}`\n ctx.fillText(label, left + width / 2, top + height / 2)\n ctx.restore()\n }\n\n // ── Popup 연동 — storage-rack 동일 패턴 ───────────────────────────────\n /**\n * things-scene EventManager3D 가 raycast → object3d.userData.context.component 의\n * `trigger(\"click\", mouseEvent)` 을 호출 → eventMap 으로 receive. pad / carrier mesh\n * 어느 쪽을 클릭하든 stockpile 전체 popup invoke (단일 slot 이라 cell 구분 없음).\n */\n get eventMap() {\n return {\n '(self)': {\n '(self)': {\n click: this._onStockpileClick\n }\n }\n }\n }\n\n private _onStockpileClick = (mouseEvent: MouseEvent) => {\n // view mode 에서만 동작 (modeling 중 click 은 framework 선택 로직 우선).\n if (!(this as any).app?.isViewMode) return\n const hit = this._raycastStockpileHit(mouseEvent)\n if (!hit) return\n // hit.object 가 carrier mesh 면 userData.recordId 보유 → 그 stock 의 popup.\n // pad / 기타면 stockpile 전체 popup.\n const recordId = hit.object?.userData?.recordId as string | undefined\n this._dispatchStockpilePopup(typeof recordId === 'string' ? recordId : undefined)\n }\n\n /**\n * state.popupRef 가 가리키는 Popup 컴포넌트를 invoke.\n * - recordId 명시 → 그 record 의 anchor = mesh. payload = 해당 record.\n * - 미명시 (pad 클릭) → 'pile' anchor (pad). payload = 전체 inventory.\n *\n * RecordStorage mixin 의 `_invokePopup(slotId, payload)` 를 활용. 단일 slot\n * 시맨틱이 record/pile 두 모드라 mixin 위 wrapper 로 dispatch.\n */\n private _dispatchStockpilePopup(recordId?: string): void {\n if (!this.state.popupRef) return\n if (recordId) {\n const record = (this.records as ReadonlyArray<StockpileRecord>)\n .find(r => r.id === recordId) ?? { id: recordId }\n this._invokePopup(recordId, record)\n } else {\n this._invokePopup(SLOT_ID, {\n componentId: (this.state as any).id,\n records: this.records,\n inventoryCount: this.inventoryCount,\n capacity: this.state.capacity,\n carrierPreset: this.state.carrierPreset,\n stackPattern: this.state.stackPattern\n })\n }\n }\n\n /**\n * 클릭 시 framework 의 mouse NDC 를 재사용해 raycast → *우리 stockpile* 의 어떤 mesh 가\n * closest hit 인지 반환 (다른 object 가 더 가까우면 undefined). storage-rack._raycastRackHit\n * 와 동일 패턴 — capability.getObjectsByRaycast 우선, 없으면 scene/camera/canvas 재구성.\n */\n private _raycastStockpileHit(mouseEvent: MouseEvent): THREE.Intersection | undefined {\n const ro: any = (this as any)._realObject\n if (!ro?.object3d) return undefined\n\n const tc: any = ro.threeContainer\n if (!tc) return undefined\n\n const cap: any = tc._threeCapability ?? tc._capability\n let intersects: THREE.Intersection[] | undefined\n if (cap?.getObjectsByRaycast) {\n intersects = cap.getObjectsByRaycast() as THREE.Intersection[] | undefined\n }\n if (!intersects || intersects.length === 0) {\n const scene = tc.scene3d as THREE.Scene | undefined\n const renderer = tc.renderer3d as THREE.WebGLRenderer | undefined\n const camera =\n (tc.activeCamera3d as THREE.Camera | undefined) ??\n (cap?.activeCamera as THREE.Camera | undefined) ??\n (cap?.camera as THREE.Camera | undefined)\n const canvas = renderer?.domElement\n if (!scene || !canvas || !camera) return undefined\n const rect = canvas.getBoundingClientRect()\n if (rect.width === 0 || rect.height === 0) return undefined\n const ndc = new THREE.Vector2(\n ((mouseEvent.clientX - rect.left) / rect.width) * 2 - 1,\n -((mouseEvent.clientY - rect.top) / rect.height) * 2 + 1\n )\n const raycaster = new THREE.Raycaster()\n raycaster.setFromCamera(ndc, camera)\n intersects = raycaster.intersectObjects(scene.children, true)\n }\n if (!intersects || intersects.length === 0) return undefined\n\n // 가장 가까운 hit 이 *이 stockpile* 의 descendant 여야 한다 (다른 mesh 가 사이에 있으면 skip).\n const closest = intersects[0]\n let obj: THREE.Object3D | null = closest.object\n while (obj) {\n if (obj.userData?.context === ro) return closest\n obj = obj.parent\n }\n return undefined\n }\n\n // legendTarget / _onLegendChanged / resolveLegendColor — RecordStorage mixin 제공.\n\n buildRealObject(): RealObject | undefined {\n return new Stockpile3D(this)\n }\n}\n\n// transient carrier refid — scene 내 기존 컴포넌트와 충돌 회피용 큰 시작값\n// (storage-rack 의 _nextCarrierRefid 와 같은 idiom, 별도 범위로 분리).\nlet _stockpileCarrierSeq = 0\nfunction _nextStockpileCarrierRefid(): number {\n return 800000 + (_stockpileCarrierSeq++)\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 const d = (c as any)?.state?.depth\n return typeof d === 'number' && Number.isFinite(d) ? d : 0\n}\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/scene-storage",
|
|
3
3
|
"description": "Storage-domain components for things-scene (smart factory / logistics) — pallet, box, parcel; AS/RS and shelves planned.",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "10.0.0-beta.
|
|
5
|
+
"version": "10.0.0-beta.60",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@hatiolab/things-scene": "^10.0.0-beta.1",
|
|
29
|
-
"@operato/scene-base": "^10.0.0-beta.
|
|
29
|
+
"@operato/scene-base": "^10.0.0-beta.60",
|
|
30
30
|
"three": "^0.183.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"typescript": "^5.0.4"
|
|
46
46
|
},
|
|
47
47
|
"prettier": "@hatiolab/prettier-config",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "db5ff4b8ef5a6107349e7c2a51ee2884785e5fab"
|
|
49
49
|
}
|
package/src/stockpile.ts
CHANGED
|
@@ -69,6 +69,12 @@ export interface StockpileState extends State {
|
|
|
69
69
|
*/
|
|
70
70
|
destination?: string
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* 라우팅 가중치 (Phase B1). 같은 destination 의 N sink 분산 시 weight 정책 사용.
|
|
74
|
+
* 미설정 = 1. weight ≤ 0 invalid (validator warning).
|
|
75
|
+
*/
|
|
76
|
+
weight?: number
|
|
77
|
+
|
|
72
78
|
/** click 시 invoke 할 Popup 컴포넌트 id (StorageRack / RackGrid 와 동일 패턴). */
|
|
73
79
|
popupRef?: string
|
|
74
80
|
|
|
@@ -102,6 +108,7 @@ const NATURE: ComponentNature = {
|
|
|
102
108
|
{ type: 'select', label: 'pick-policy', name: 'pickPolicy',
|
|
103
109
|
property: { options: ['lifo', 'fifo'] } },
|
|
104
110
|
{ type: 'string', label: 'destination', name: 'destination' },
|
|
111
|
+
{ type: 'number', label: 'weight', name: 'weight', placeholder: '같은 destination N sink 분산 가중치 (기본 1)' },
|
|
105
112
|
{ type: 'id-input', label: 'popup-ref', name: 'popupRef',
|
|
106
113
|
property: { component: 'popup' } },
|
|
107
114
|
{ type: 'id-input', label: 'legend-target', name: 'legendTarget',
|
|
@@ -130,6 +137,16 @@ export default class Stockpile extends RecordStorage<StockpileRecord>()(
|
|
|
130
137
|
return (this.state.destination as string | undefined) ?? (this.state.id as string)
|
|
131
138
|
}
|
|
132
139
|
|
|
140
|
+
/**
|
|
141
|
+
* RoutingTarget.routingWeight — state.weight 명시 시만 숫자 반환. 미명시는 undefined →
|
|
142
|
+
* caller 가 *_inDegree fallback (경로 갯수)_* 으로 자연 capacity 측정. default 1 반환은
|
|
143
|
+
* "명시됨" 으로 오인되어 inDegree 무시 — 가중치 결함의 원인 (2026-06-17 라이브 진단).
|
|
144
|
+
*/
|
|
145
|
+
routingWeight(): number | undefined {
|
|
146
|
+
const w = this.state.weight
|
|
147
|
+
return typeof w === 'number' && Number.isFinite(w) ? w : undefined
|
|
148
|
+
}
|
|
149
|
+
|
|
133
150
|
// ── 그래프 참여 ─────────────────────────────────────────────────────────────
|
|
134
151
|
// StockPile 은 *방향 없는 받는 footprint*. 별도 면 anchor 를 publish 하지 않는다 —
|
|
135
152
|
// 어느 면으로 받는지는 의미 없고, 슈트/컨베이어의 *출구 anchor 가 자기 footprint 에
|