@operato/scene-storage 10.0.0-beta.30 → 10.0.0-beta.31

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/src/rack-cell.ts CHANGED
@@ -32,6 +32,7 @@ import {
32
32
  TRANSFER_SLOT_KEY,
33
33
  sceneComponent
34
34
  } from '@hatiolab/things-scene'
35
+ import type { State, Material3D } from '@hatiolab/things-scene'
35
36
  import { CarrierHolder, type AttachFrame } from '@operato/scene-base'
36
37
 
37
38
  import { RackCell3D } from './rack-cell-3d.js'
@@ -44,6 +45,16 @@ import { RackCell3D } from './rack-cell-3d.js'
44
45
  */
45
46
  export type RackCellType = 'single' | 'multi' | 'bulk'
46
47
 
48
+ /** RackCell 컴포넌트 state */
49
+ export interface RackCellState extends State {
50
+ // ── 식별 ──
51
+ cellId?: string
52
+ cellType?: RackCellType
53
+
54
+ // ── 3D 재질 ──
55
+ material3d?: Material3D
56
+ }
57
+
47
58
  const NATURE: ComponentNature = {
48
59
  mutable: false,
49
60
  resizable: false,
@@ -84,14 +95,16 @@ const NATURE: ComponentNature = {
84
95
  */
85
96
  @sceneComponent('rack-cell')
86
97
  export default class RackCell extends CarrierHolder(ContainerAbstract) {
98
+ declare state: RackCellState
99
+
87
100
  // ── Identification ────────────────────────────────────────────────────────
88
101
 
89
102
  get cellId(): string {
90
- return (this.state.cellId as string) || ''
103
+ return this.state.cellId ?? ''
91
104
  }
92
105
 
93
106
  get cellType(): RackCellType {
94
- return ((this.state.cellType as RackCellType) || 'single')
107
+ return this.state.cellType ?? 'single'
95
108
  }
96
109
 
97
110
  /** Maximum carrier count for this cell based on cellType. */
@@ -117,7 +130,7 @@ export default class RackCell extends CarrierHolder(ContainerAbstract) {
117
130
 
118
131
  /** True when fewer carriers are currently held than capacity. */
119
132
  canReceive(_component?: any): boolean {
120
- const occupied = ((this as any).components as Component[] | undefined)?.length ?? 0
133
+ const occupied = (this.components as Component[] | undefined)?.length ?? 0
121
134
  return occupied < this.capacity
122
135
  }
123
136
 
@@ -128,7 +141,7 @@ export default class RackCell extends CarrierHolder(ContainerAbstract) {
128
141
  */
129
142
  async receive(carrier: any, options: any = {}): Promise<void> {
130
143
  if (!this.canReceive(carrier)) {
131
- ;(this as any).trigger?.('transfer-rejected', {
144
+ this.trigger('transfer-rejected', {
132
145
  type: 'transfer-rejected',
133
146
  component: carrier,
134
147
  container: this,
@@ -137,8 +150,8 @@ export default class RackCell extends CarrierHolder(ContainerAbstract) {
137
150
  return
138
151
  }
139
152
  carrier[TRANSFER_SLOT_KEY] = this.cellId
140
- ;(this as any).reparent?.(carrier, options)
141
- ;(this as any).trigger?.('transfer-received', {
153
+ this.reparent(carrier, options)
154
+ this.trigger('transfer-received', {
142
155
  type: 'transfer-received',
143
156
  component: carrier,
144
157
  container: this,
@@ -152,7 +165,7 @@ export default class RackCell extends CarrierHolder(ContainerAbstract) {
152
165
  */
153
166
  async dispatch(carrier: any, target: any, options: any = {}): Promise<void> {
154
167
  if (target?.canReceive && !target.canReceive(carrier)) {
155
- ;(this as any).trigger?.('transfer-rejected', {
168
+ this.trigger('transfer-rejected', {
156
169
  type: 'transfer-rejected',
157
170
  component: carrier,
158
171
  container: this,
@@ -166,7 +179,7 @@ export default class RackCell extends CarrierHolder(ContainerAbstract) {
166
179
  } else {
167
180
  ;(target as any).reparent?.(carrier, options)
168
181
  }
169
- ;(this as any).trigger?.('transfer-dispatched', {
182
+ this.trigger('transfer-dispatched', {
170
183
  type: 'transfer-dispatched',
171
184
  component: carrier,
172
185
  container: this,
@@ -194,7 +207,7 @@ export default class RackCell extends CarrierHolder(ContainerAbstract) {
194
207
  * rests at the cell's Y-center (which is levelHeight/2 above the beam).
195
208
  */
196
209
  attachPointFor(carrier: Component): AttachFrame | null {
197
- const root = (this as any)._realObject?.object3d
210
+ const root = this._realObject?.object3d
198
211
  if (!root) return null
199
212
  const carrierDepth = resolveCarrierDepth(carrier)
200
213
  return {
@@ -213,7 +226,7 @@ export default class RackCell extends CarrierHolder(ContainerAbstract) {
213
226
  // ── 3D ───────────────────────────────────────────────────────────────────
214
227
 
215
228
  buildRealObject(): RealObject | undefined {
216
- return new RackCell3D(this as any)
229
+ return new RackCell3D(this)
217
230
  }
218
231
  }
219
232
 
package/src/spot-3d.ts CHANGED
@@ -37,7 +37,7 @@ export class Spot3D extends RealObjectGroup {
37
37
  build() {
38
38
  super.build()
39
39
 
40
- const state = this.component.state as any
40
+ const state = this.component.state
41
41
  const w = Math.max(Math.abs(numOr(state.width, 100)), 1)
42
42
  const h = Math.max(Math.abs(numOr(state.height, 100)), 1)
43
43
  const d = this.effectiveDepth // 2 by default (thin pad)
package/src/spot.ts CHANGED
@@ -30,6 +30,7 @@
30
30
  */
31
31
 
32
32
  import { Component, ComponentNature, ContainerAbstract, RealObject, sceneComponent } from '@hatiolab/things-scene'
33
+ import type { State, Material3D } from '@hatiolab/things-scene'
33
34
  import {
34
35
  CarrierHolder,
35
36
  Placeable,
@@ -41,6 +42,13 @@ import {
41
42
 
42
43
  import { Spot3D } from './spot-3d.js'
43
44
 
45
+ /** Spot 컴포넌트 state */
46
+ export interface SpotState extends State {
47
+ // Spot has no component-specific state — it uses standard fillStyle /
48
+ // strokeStyle / lineWidth / alpha / text / font* / material3d.
49
+ material3d?: Material3D
50
+ }
51
+
44
52
  const NATURE: ComponentNature = {
45
53
  mutable: false,
46
54
  resizable: true,
@@ -61,6 +69,9 @@ const NATURE: ComponentNature = {
61
69
  // addObject DOM-skip gate. Spot is purely 3D.
62
70
  @sceneComponent('spot')
63
71
  export default class Spot extends CarrierHolder(Placeable(ContainerAbstract)) {
72
+ declare state: SpotState
73
+ declare _realObject?: Spot3D
74
+
64
75
  static placement: PlacementArchetype = 'floor'
65
76
  static align: Alignment = 'bottom'
66
77
  static defaultDepth = (_h: Heights) => 2 // a thin pad
@@ -131,7 +142,7 @@ export default class Spot extends CarrierHolder(Placeable(ContainerAbstract)) {
131
142
  }
132
143
 
133
144
  buildRealObject(): RealObject | undefined {
134
- return new Spot3D(this as any)
145
+ return new Spot3D(this)
135
146
  }
136
147
 
137
148
  /**
@@ -147,7 +158,7 @@ export default class Spot extends CarrierHolder(Placeable(ContainerAbstract)) {
147
158
  * RealObject creation.
148
159
  */
149
160
  attachPointFor(carrier: Component): AttachFrame | null {
150
- const ro = (this as any)._realObject as Spot3D | undefined
161
+ const ro = this._realObject
151
162
  const frame = ro?.getAttachFrame?.()
152
163
  if (!frame) return null
153
164
  const carrierDepth = resolveDepth(carrier)