@hatiolab/things-scene 10.1.77 → 10.1.78
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-types/items/capacity-mixin.d.ts +7 -4
- package/dist-types/items/capacity-mixin.d.ts.map +1 -1
- package/dist-types/items/slot-layout/index.d.ts +0 -2
- package/dist-types/items/slot-layout/index.d.ts.map +1 -1
- package/dist-types/items/slot-layout/slot-layout.d.ts +159 -40
- package/dist-types/items/slot-layout/slot-layout.d.ts.map +1 -1
- package/dist-types/items/slot-layout/vec3.d.ts +6 -0
- package/dist-types/items/slot-layout/vec3.d.ts.map +1 -0
- package/package.json +1 -2
- package/things-scene-min.js +1 -1
- package/things-scene-min.js.map +1 -1
- package/things-scene-transfer.mjs +2 -2
- package/things-scene.mjs +1 -1
- package/things-scene.mjs.map +1 -1
- package/dist-types/items/slot-layout/layout-issue.d.ts +0 -35
- package/dist-types/items/slot-layout/layout-issue.d.ts.map +0 -1
- package/dist-types/items/slot-layout/slot-seat.d.ts +0 -65
- package/dist-types/items/slot-layout/slot-seat.d.ts.map +0 -1
|
@@ -8,7 +8,7 @@ type Constructor<T = object> = new (...args: any[]) => T;
|
|
|
8
8
|
export declare function Capacity<TBase extends Constructor<Component>>(Base: TBase): {
|
|
9
9
|
new (...args: any[]): {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Anchor·Tier·Slot 레이아웃 (slot-layout). 정하면 slots 가 이 레이아웃의 자리(id t{tier}_s{slot})가 되고,
|
|
12
12
|
* slotById 는 자리를 늘어놓지 않고 계산으로 찾으며, slotSeatTransform 이 자리 안착 변환을 낸다.
|
|
13
13
|
*/
|
|
14
14
|
get slotLayout(): SlotLayout | undefined;
|
|
@@ -20,10 +20,13 @@ export declare function Capacity<TBase extends Constructor<Component>>(Base: TBa
|
|
|
20
20
|
*/
|
|
21
21
|
slotById(slotId: string): SlotDef | null;
|
|
22
22
|
/**
|
|
23
|
-
* 지정한 자리에 item 을 놓는
|
|
24
|
-
*
|
|
23
|
+
* 지정한 자리에 item 을 놓는 변환 — 그 자리 Tier 가 선 Anchor 의 좌표계 기준 (형상 중심, Y 축 회전 도, 균일 배율).
|
|
24
|
+
* Anchor 자체의 변환은 홀더가 준다(곱하는 쪽의 몫). 단위는 slotLayout 과 같다. belowHeight 는 같은 자리 아래
|
|
25
|
+
* item 들의 표시 높이 합. slotLayout 이 없거나 자리·치수가 잘못되면 null.
|
|
25
26
|
*/
|
|
26
|
-
slotSeatTransform(slotId: string, dims: ItemDims, belowHeight?: number, margin?: number): SeatTransform
|
|
27
|
+
slotSeatTransform(slotId: string, dims: ItemDims, belowHeight?: number, margin?: number): (SeatTransform & {
|
|
28
|
+
anchorId: string;
|
|
29
|
+
}) | null;
|
|
27
30
|
/**
|
|
28
31
|
* ArrangementStrategy used when `slots` is empty or slotDef has no arrangement.
|
|
29
32
|
* Override in subclass to supply richer strategies (Stack, Queue, Grid, etc.).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capacity-mixin.d.ts","sourceRoot":"","sources":["../../src/items/capacity-mixin.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACZ,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAA;AAKvD,OAAO,EAML,KAAK,QAAQ,EAEb,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAA;AAE/B,KAAK,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;AA2BxD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,SAAS,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK;kBA9B7B,GAAG,EAAE;QAqC9C;;;WAGG;0BACe,UAAU,GAAG,S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C,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,SAAS;QAI9G;;;WAGG;uCAC4B,GAAG,GAAG;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,SAAS;QAe/F;;;WAGG;wCAC6B,GAAG,GAAG;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,GAAG,SAAS;kCAoB3D,GAAG,GAAG,kBAAkB,GAAG,IAAI;QAczD;;;WAGG;8BACmB,WAAW,GAAG,GAAG,QAAO,gBAAgB,GAAQ,WAAW,GAAG,IAAI;QAyDxF;;;WAGG;8BACmB,MAAM,gBAAgB,GAAG,QAAQ,OAAO,GAAG,MAAM,GAAG,IAAI;QAa9E;;WAEG;mCACwB,MAAM,GAAG,IAAI;QASxC,6CAA6C;+BACtB,OAAO,GAAG,IAAI,aAAa,GAAG,GAAG,OAAO,GAAG,IAAI;QAMtE;;WAEG;+BACoB,MAAM,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAazC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/items/slot-layout/index.ts"],"names":[],"mappings":"AAMA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/items/slot-layout/index.ts"],"names":[],"mappings":"AAMA,cAAc,kBAAkB,CAAA"}
|
|
@@ -1,24 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { Vec3 } from './vec3.js';
|
|
2
|
+
export type LayoutIssueCode = 'TIERS_REQUIRED' | 'MOUNT_INVALID' | 'ANCHOR_REQUIRED'
|
|
3
|
+
/** The tier names an anchor the holder does not give (params.anchorId). Checked only when the anchors are known. */
|
|
4
|
+
| 'ANCHOR_UNKNOWN' | 'TIER_NUMBER_DUPLICATE' | 'FINITE_NUMBER_REQUIRED' | 'POSITIVE_NUMBER_REQUIRED' | 'POSITIVE_INTEGER_REQUIRED' | 'ARRAY_REQUIRED' | 'OBJECT_REQUIRED' | 'AXIS_INVALID' | 'PATTERN_INVALID' | 'SLOTS_REQUIRED' | 'SLOT_NUMBER_DUPLICATE'
|
|
5
|
+
/** A value JSON would turn into null (params.value: NaN, Infinity, -Infinity). */
|
|
6
|
+
| 'NOT_PERSISTABLE';
|
|
7
|
+
/** A problem as a code, the path of the value, and parameters -- never a sentence. The screen words it. */
|
|
8
|
+
export interface LayoutIssue {
|
|
9
|
+
code: LayoutIssueCode;
|
|
10
|
+
/** Where the value is, e.g. 'tiers[0].layout.pitch'. Empty for the layout as a whole. */
|
|
11
|
+
path: string;
|
|
12
|
+
params?: Record<string, string | number>;
|
|
13
|
+
}
|
|
14
|
+
export declare function layoutIssue(code: LayoutIssueCode, path: string, params?: Record<string, string | number>): LayoutIssue;
|
|
15
|
+
/**
|
|
16
|
+
* How a tier carries what it holds. ON and IN seat items along the tier's local +Y -- IN differs only in that the room
|
|
17
|
+
* is enclosed (a judgement about room, not a turned direction); HANG hangs them along -Y.
|
|
18
|
+
*/
|
|
3
19
|
export type SlotMount = 'ON' | 'IN' | 'HANG';
|
|
20
|
+
/** The anchor at the holder's own origin, for a holder that gives no other. */
|
|
21
|
+
export declare const HOLDER_ANCHOR = "holder";
|
|
4
22
|
export interface SlotLayout {
|
|
5
|
-
mount: SlotMount;
|
|
6
|
-
/** tierNo 오름차순 = 아래에서 위로 */
|
|
7
23
|
tiers: SlotLayoutTier[];
|
|
8
24
|
}
|
|
9
25
|
export interface SlotLayoutTier {
|
|
10
|
-
/**
|
|
26
|
+
/** The holder's own number for the tier: a positive integer, unique, kept when tiers are removed or reordered. */
|
|
11
27
|
tierNo: number;
|
|
12
|
-
/**
|
|
13
|
-
|
|
28
|
+
/** The anchor the tier stands on. */
|
|
29
|
+
anchorId: string;
|
|
30
|
+
mount: SlotMount;
|
|
31
|
+
/** The tier's centre in its anchor's frame. */
|
|
32
|
+
position: Vec3;
|
|
33
|
+
/** Degrees about the anchor's Y. */
|
|
34
|
+
rotation: number;
|
|
14
35
|
layout: SlotPattern;
|
|
15
36
|
}
|
|
16
|
-
/**
|
|
37
|
+
/** How the slots of one tier are arranged. */
|
|
17
38
|
export type SlotPattern = {
|
|
18
39
|
pattern: 'SINGLE';
|
|
19
40
|
slot: SlotSpec;
|
|
20
41
|
}
|
|
21
|
-
/** origin:
|
|
42
|
+
/** origin: which end of the axis slot 1 is at. MIN by default. */
|
|
22
43
|
| {
|
|
23
44
|
pattern: 'ROW';
|
|
24
45
|
count: number;
|
|
@@ -27,7 +48,7 @@ export type SlotPattern = {
|
|
|
27
48
|
origin?: 'MIN' | 'MAX';
|
|
28
49
|
slot: SlotSpec;
|
|
29
50
|
}
|
|
30
|
-
/**
|
|
51
|
+
/** rows run along Z, columns along X. */
|
|
31
52
|
| {
|
|
32
53
|
pattern: 'GRID';
|
|
33
54
|
rows: number;
|
|
@@ -43,35 +64,38 @@ export type SlotPattern = {
|
|
|
43
64
|
pattern: 'CUSTOM';
|
|
44
65
|
slots: PatternSlot[];
|
|
45
66
|
};
|
|
46
|
-
/** GRID
|
|
67
|
+
/** The order GRID slots are numbered in. ROW_MAJOR by default. Changing it changes what an address means. */
|
|
47
68
|
export type GridOrder = 'ROW_MAJOR' | 'COL_MAJOR' | 'SERPENTINE_ROW' | 'SERPENTINE_COL';
|
|
48
|
-
/** GRID 1
|
|
69
|
+
/** The corner GRID slot 1 is at. { x: 'MIN', z: 'MIN' } by default. Changing it changes what an address means. */
|
|
49
70
|
export interface GridOrigin {
|
|
50
71
|
x: 'MIN' | 'MAX';
|
|
51
72
|
z: 'MIN' | 'MAX';
|
|
52
73
|
}
|
|
53
|
-
/**
|
|
74
|
+
/** One slot's room and rules. Every slot of a SINGLE, ROW or GRID tier has the same. */
|
|
54
75
|
export interface SlotSpec {
|
|
55
|
-
/**
|
|
76
|
+
/** The room a held thing may take, in the tier's axes: width along X, depth along Z, height along Y. */
|
|
56
77
|
allowed: {
|
|
57
78
|
width: number;
|
|
58
79
|
depth: number;
|
|
59
80
|
height: number;
|
|
60
81
|
};
|
|
61
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* The item types it takes. Left out: any type; an empty list: none. (A figure's declaration must name them --
|
|
84
|
+
* ADR-0087 decision 3; that is the figure's rule, checked where figures are compiled, not here.)
|
|
85
|
+
*/
|
|
62
86
|
accepts?: string[];
|
|
63
|
-
/**
|
|
87
|
+
/** How many may be stacked in it. 1 when left out. */
|
|
64
88
|
stackLimit?: number;
|
|
65
|
-
/**
|
|
89
|
+
/** Degrees about Y. */
|
|
66
90
|
rotation?: number;
|
|
67
91
|
}
|
|
68
|
-
/** CUSTOM
|
|
92
|
+
/** A slot of a CUSTOM tier. */
|
|
69
93
|
export interface PatternSlot extends SlotSpec {
|
|
70
|
-
/**
|
|
94
|
+
/** The tier's own number for the slot: a positive integer, unique in the tier, kept when other slots are removed. */
|
|
71
95
|
slotNo: number;
|
|
72
|
-
/**
|
|
96
|
+
/** For display (FRONT, REAR, L, R …). */
|
|
73
97
|
name?: string;
|
|
74
|
-
/**
|
|
98
|
+
/** The slot's centre relative to the tier's centre. */
|
|
75
99
|
offset: {
|
|
76
100
|
x: number;
|
|
77
101
|
z: number;
|
|
@@ -81,12 +105,18 @@ export interface SlotAddress {
|
|
|
81
105
|
tier: number;
|
|
82
106
|
slot: number;
|
|
83
107
|
}
|
|
84
|
-
/**
|
|
108
|
+
/** A slot found by its address, with its tier's placement on the anchor. */
|
|
85
109
|
export interface ResolvedSlot {
|
|
86
110
|
tier: number;
|
|
87
111
|
slotNo: number;
|
|
88
112
|
name?: string;
|
|
89
|
-
|
|
113
|
+
anchorId: string;
|
|
114
|
+
mount: SlotMount;
|
|
115
|
+
/** The tier's centre in the anchor's frame. */
|
|
116
|
+
tierPosition: Vec3;
|
|
117
|
+
/** The tier's turn about the anchor's Y, degrees. */
|
|
118
|
+
tierRotation: number;
|
|
119
|
+
/** The slot's centre from the tier's centre, in the tier's axes. */
|
|
90
120
|
offset: {
|
|
91
121
|
x: number;
|
|
92
122
|
z: number;
|
|
@@ -98,41 +128,130 @@ export interface ResolvedSlot {
|
|
|
98
128
|
};
|
|
99
129
|
accepts?: string[];
|
|
100
130
|
stackLimit: number;
|
|
131
|
+
/** The slot's turn about Y in the tier, degrees. */
|
|
101
132
|
rotation: number;
|
|
102
133
|
}
|
|
134
|
+
export interface ValidateSlotLayoutOptions {
|
|
135
|
+
/** The anchors the holder gives. Left out: a tier's anchor is not checked against them. */
|
|
136
|
+
anchors?: Iterable<string>;
|
|
137
|
+
}
|
|
103
138
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*/
|
|
107
|
-
export declare function validateSlotLayout(layout: SlotLayout): LayoutIssue[];
|
|
108
|
-
/**
|
|
109
|
-
* JSON 으로 저장하면 null 로 바뀌는 값(NaN·Infinity)을 찾는다. 다시 열면 잘못된 레이아웃이 되므로 저장 전에 막는다.
|
|
139
|
+
* Everything wrong with a layout; an empty list is a sound one. stackLimit may be Infinity (no limit); a layout that is
|
|
140
|
+
* to be stored as JSON is also checked with `persistenceIssues`.
|
|
110
141
|
*/
|
|
142
|
+
export declare function validateSlotLayout(layout: SlotLayout, options?: ValidateSlotLayoutOptions): LayoutIssue[];
|
|
143
|
+
/** Values JSON turns into null (NaN, Infinity): stored, they would come back as a broken layout. */
|
|
111
144
|
export declare function persistenceIssues(value: unknown, path?: string): LayoutIssue[];
|
|
112
145
|
export declare function slotCount(pattern: SlotPattern): number;
|
|
113
|
-
/**
|
|
146
|
+
/** A tier's slot numbers, in order. ROW and GRID count from 1; CUSTOM has the numbers it was given. */
|
|
147
|
+
export declare function slotNumbers(pattern: SlotPattern): number[];
|
|
148
|
+
/** A GRID slot's number from its row r and column c (from 1), counted from the origin corner. */
|
|
114
149
|
export declare function gridSlotNo(rows: number, cols: number, r: number, c: number, order?: GridOrder): number;
|
|
115
|
-
/**
|
|
150
|
+
/** The row and column of a GRID slot number -- the inverse of gridSlotNo. */
|
|
116
151
|
export declare function gridCellOf(rows: number, cols: number, slotNo: number, order?: GridOrder): {
|
|
117
152
|
r: number;
|
|
118
153
|
c: number;
|
|
119
154
|
};
|
|
120
155
|
export interface ResolveSlotOptions {
|
|
121
|
-
/** stackLimit
|
|
156
|
+
/** The stackLimit of a slot that names none. 1 by default; Infinity for a holder's unlimited default slot. */
|
|
122
157
|
defaultStackLimit?: number;
|
|
123
158
|
}
|
|
124
159
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* origin MAX 인 축만 부호 반전
|
|
160
|
+
* The slot at an address, or null when the tier or the slot is not there. ROW and GRID slots are worked out:
|
|
161
|
+
* ROW centre = ((n - 1) - (count - 1) / 2) × pitch, negated when origin is MAX
|
|
162
|
+
* GRID centre = the row and column the order gives, x = (c - 1 - (cols - 1)/2) × pitch.x,
|
|
163
|
+
* z = (r - 1 - (rows - 1)/2) × pitch.z, each negated when its origin is MAX
|
|
130
164
|
*/
|
|
131
165
|
export declare function resolveSlot(layout: SlotLayout, address: SlotAddress, options?: ResolveSlotOptions): ResolvedSlot | null;
|
|
132
|
-
/**
|
|
166
|
+
/** A slot's logical id. */
|
|
133
167
|
export declare function slotIdOf(address: SlotAddress): string;
|
|
134
|
-
/**
|
|
168
|
+
/** The address a slot id names, or null when it is not one. */
|
|
135
169
|
export declare function addressOfSlotId(slotId: unknown): SlotAddress | null;
|
|
136
|
-
/**
|
|
170
|
+
/** Every address of a layout, tier by tier as written. For a big GRID, resolve only the addresses you need. */
|
|
137
171
|
export declare function slotAddresses(layout: SlotLayout): Generator<SlotAddress>;
|
|
172
|
+
/** A place in an anchor's frame: a position and a turn about the anchor's Y in degrees. */
|
|
173
|
+
export interface AnchorFrame {
|
|
174
|
+
position: Vec3;
|
|
175
|
+
rotation: number;
|
|
176
|
+
}
|
|
177
|
+
/** A slot's frame in its anchor's: the tier's placement, then the slot's offset and turn in the tier. */
|
|
178
|
+
export declare function slotFrame(slot: ResolvedSlot): AnchorFrame;
|
|
179
|
+
/** An item's size: width along X, depth along Z, height along Y -- in the layout's unit. */
|
|
180
|
+
export interface ItemDims {
|
|
181
|
+
width: number;
|
|
182
|
+
depth: number;
|
|
183
|
+
height: number;
|
|
184
|
+
}
|
|
185
|
+
/** Where an item sits: its centre, its turn about Y in degrees, and one uniform scale. */
|
|
186
|
+
export interface SeatTransform {
|
|
187
|
+
position: Vec3;
|
|
188
|
+
rotation: number;
|
|
189
|
+
scale: number;
|
|
190
|
+
}
|
|
191
|
+
export declare const DEFAULT_SEAT_MARGIN = 0.05;
|
|
192
|
+
/** The X and Z extent of an item turned by `rotation` degrees. */
|
|
193
|
+
export declare function rotatedFootprint(dims: ItemDims, rotation: number): {
|
|
194
|
+
width: number;
|
|
195
|
+
depth: number;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Where an item sits in its slot's own frame: shrunk to fit the slot's width and depth (by its turned extent, never
|
|
199
|
+
* enlarged), on top of `belowHeight` -- the shown heights (height × scale) of what is stacked under it -- along +Y for ON
|
|
200
|
+
* and IN, -Y for HANG. x and z are 0 and it is not turned: the slot's frame has the offset and the turn. `margin` is room
|
|
201
|
+
* left only for showing (0 ≤ margin < 1); whether it fits is judged elsewhere, at full size. Null when a size or value is
|
|
202
|
+
* unusable -- never NaN or Infinity.
|
|
203
|
+
* slotFrame(slot) then seatInSlot(...) = seatTransform(...)
|
|
204
|
+
*/
|
|
205
|
+
export declare function seatInSlot(dims: ItemDims, slot: ResolvedSlot, belowHeight?: number, margin?: number): SeatTransform | null;
|
|
206
|
+
/** Where an item sits in its anchor's frame: the slot's frame, then the seat in it. */
|
|
207
|
+
export declare function seatTransform(dims: ItemDims, slot: ResolvedSlot, belowHeight?: number, margin?: number): SeatTransform | null;
|
|
208
|
+
/** Where each of a slot's stacked items sits in the anchor's frame, bottom first. An item of unknown size is null and adds no height. */
|
|
209
|
+
export declare function stackSeatTransforms(stack: (ItemDims | null | undefined)[], slot: ResolvedSlot, margin?: number): (SeatTransform | null)[];
|
|
210
|
+
export type SlotSpaceCode =
|
|
211
|
+
/** Two slots' rooms share space (params: tier, slot, otherTier, otherSlot). Touching is not overlapping. */
|
|
212
|
+
'SLOT_OVERLAP'
|
|
213
|
+
/** A slot's footprint reaches past the face its anchor gives (params: tier, slot). */
|
|
214
|
+
| 'SLOT_OUTSIDE_ANCHOR'
|
|
215
|
+
/** The anchor gives no face size, so whether its slots stay on it is unknown (params: anchorId). */
|
|
216
|
+
| 'ANCHOR_SPACE_UNKNOWN';
|
|
217
|
+
/** A warning about a layout's room: a setting to look at, never a judgement that items can physically be put there. */
|
|
218
|
+
export interface SlotSpaceWarning {
|
|
219
|
+
code: SlotSpaceCode;
|
|
220
|
+
path: string;
|
|
221
|
+
params: Record<string, string | number>;
|
|
222
|
+
}
|
|
223
|
+
export interface SlotSpaceOptions {
|
|
224
|
+
/** The size of the face each anchor gives, centred on the anchor, in its X and Z. An anchor left out is UNKNOWN. */
|
|
225
|
+
anchorFaces?: Record<string, {
|
|
226
|
+
width: number;
|
|
227
|
+
depth: number;
|
|
228
|
+
}>;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Where a sound layout's slots crowd each other or leave their anchor's face, as warnings. Only slots on the same anchor
|
|
232
|
+
* are compared: anchors move apart. Rooms are each slot's allowed box, placed by its tier and turned; sharing a face or
|
|
233
|
+
* an edge is not overlapping.
|
|
234
|
+
*/
|
|
235
|
+
export declare function slotSpaceWarnings(layout: SlotLayout, options?: SlotSpaceOptions): SlotSpaceWarning[];
|
|
236
|
+
export type FitVerdict = 'OK' | 'NG' | 'UNKNOWN';
|
|
237
|
+
export type FitReason = 'SLOT_NOT_FOUND' | 'TYPE_NOT_ACCEPTED' | 'WIDTH_EXCEEDED' | 'DEPTH_EXCEEDED' | 'HEIGHT_EXCEEDED' | 'STACK_LIMIT_EXCEEDED' | 'SPEC_UNKNOWN';
|
|
238
|
+
export interface FitCandidate {
|
|
239
|
+
type?: string;
|
|
240
|
+
/** Left out when the size is not known. */
|
|
241
|
+
dims?: ItemDims | null;
|
|
242
|
+
}
|
|
243
|
+
export interface FitResult {
|
|
244
|
+
verdict: FitVerdict;
|
|
245
|
+
reasons: FitReason[];
|
|
246
|
+
}
|
|
247
|
+
export interface FitOptions {
|
|
248
|
+
/** Applied to both sides before types are compared. The type as it is by default. */
|
|
249
|
+
normalizeType?: (type: unknown) => string;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Whether one more item fits in a slot that already holds `occupants`, at full size. The count limit and the height
|
|
253
|
+
* limit are separate checks. accepts left out takes any type; an empty list takes none. UNKNOWN when a type or a size
|
|
254
|
+
* needed to judge is not known.
|
|
255
|
+
*/
|
|
256
|
+
export declare function judgeItemFit(slot: ResolvedSlot | null, candidate: FitCandidate, occupants?: FitCandidate[], options?: FitOptions): FitResult;
|
|
138
257
|
//# sourceMappingURL=slot-layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-layout.d.ts","sourceRoot":"","sources":["../../../src/items/slot-layout/slot-layout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slot-layout.d.ts","sourceRoot":"","sources":["../../../src/items/slot-layout/slot-layout.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAIrC,MAAM,MAAM,eAAe,GACvB,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|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hatiolab/things-scene",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.78",
|
|
4
4
|
"description": "A high-performance 2D/3D scene graph library for building interactive visual editors, combining HTML5 Canvas and Three.js to enable facility visualization, data-driven animations, and real-time monitoring dashboards",
|
|
5
5
|
"main": "things-scene-min.js",
|
|
6
6
|
"module": "things-scene.mjs",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"scripts": {
|
|
47
47
|
"test": "mocha --exit --require should --require ./test/setup.js --node-option import=tsx test/**/test-*.js",
|
|
48
48
|
"test:coverage": "c8 --reporter=text-summary --reporter=lcov mocha --exit --require should --require ./test/setup.js --node-option import=tsx 'test/**/test-*.js'",
|
|
49
|
-
"test:coverage:slot-layout": "c8 --check-coverage --statements 100 --lines 100 --branches 95 --functions 95 --include 'src/items/slot-layout/**' --reporter=text mocha --exit --require should --require ./test/setup.js --node-option import=tsx 'test/unit/items/test-slot-*.js' test/unit/items/test-capacity-slot-layout.js",
|
|
50
49
|
"test:figure": "TSX_TSCONFIG_PATH=./test/tsconfig.figure-model-src.json mocha --exit --require should --require ./test/setup.js --node-option import=./test/resolve-figure-model.mjs test/figure-*.check.js",
|
|
51
50
|
"test:case": "mocha --require should --require ./test/setup.js --node-option import=tsx",
|
|
52
51
|
"clean": "rimraf dist-types things-scene*.js *.js.map",
|