@things-factory/figure-viewer 10.1.205 → 10.1.207

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/figure-viewer",
3
- "version": "10.1.205",
3
+ "version": "10.1.207",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -27,7 +27,7 @@
27
27
  "test": "FIGURE_FREEZE_COMPILED=1 node --import ./test/resolve-ts-siblings.mjs --test test/*.test.ts"
28
28
  },
29
29
  "dependencies": {
30
- "@hatiolab/figure-model": "^0.9.5",
30
+ "@hatiolab/figure-model": "^0.10.0",
31
31
  "@hatiolab/things-scene": "^10.1.95",
32
32
  "@material/web": "^2.0.0",
33
33
  "@operato/i18n": "^10.0.0",
@@ -35,5 +35,5 @@
35
35
  "@things-factory/styles": "^10.1.123",
36
36
  "lit": "^3.1.2"
37
37
  },
38
- "gitHead": "7311492aa5eaa00993c0325053f5f7ae8b1fb024"
38
+ "gitHead": "e6e3fbf5c353629adbeb8850093150b14254e059"
39
39
  }
@@ -51,6 +51,12 @@ test('a declared size reads as its range on each axis; the row gives category, t
51
51
  assert.match(valueOf(facts, 'updated')!, / · 관리자$/)
52
52
  })
53
53
 
54
+ test('an open end reads as what the parts allow: from 0 and up to ∞ where nothing limits it (ADR-0087 decision 6)', () => {
55
+ const asset = applyFigureAuthoring(box(), { kind: 'declare-instance-size', range: { y: { min: 50, max: 400 } }, at: { x: 100, y: 100, z: 100 } })
56
+ const facts = detailFactsOf(asset, { id: '1', type: 'box', name: '상자' } as never, say)
57
+ assert.equal(valueOf(facts, 'size'), 'X 0–∞ · Y 50–400 · Z 0–∞ mm')
58
+ })
59
+
54
60
  test('what it does follows its capability names; a set that is no rung is shown as the names', () => {
55
61
  const holds = editFigurePart(box(), { kind: 'set-capabilities', names: ['Capacity', 'Holdable'] })
56
62
  assert.equal(valueOf(detailFactsOf(holds, { id: '1', type: 'box', name: '상자' } as never, say), 'does'), ko['figure.label.rung-hold'])
@@ -5,9 +5,9 @@
5
5
  import { test } from 'node:test'
6
6
  import assert from 'node:assert/strict'
7
7
 
8
- import { addFigureBox, applyFigureAuthoring, createFigureAsset, proposeFigureOccupancy } from '@hatiolab/figure-model'
8
+ import { addFigureBox, applyFigureAuthoring, createFigureAsset } from '@hatiolab/figure-model'
9
9
 
10
- import { authoredSizeOf, occupancyAtSize, PREVIEW_WAYS, previewClampsOf, previewInstances, previewOneInstance, previewTypeOf, setupPartOf, sizeRangeOf, sizeWithinRange } from '../client/preview-model.ts'
10
+ import { authoredSizeOf, bodyAtSize, PREVIEW_WAYS, previewClampsOf, previewInstances, previewOneInstance, previewTypeOf, setupPartOf, sizeRangeOf, sizeSpanOf, sizeWithinRange } from '../client/preview-model.ts'
11
11
 
12
12
  test('여덟 — 기준과 일곱 조합, 한 줄에 넷, 늘린 축만 두 배 · 높이는 늘 적는다', () => {
13
13
  assert.deepEqual(PREVIEW_WAYS.map(w => w.name), ['base', 'x', 'y', 'z', 'x·y', 'x·z', 'y·z', 'x·y·z'])
@@ -72,15 +72,30 @@ test('크기 범위 — 선언된 축만 열리고, 바라는 크기는 그 범
72
72
  assert.equal(sizeWithinRange(asset, 'x', Number.NaN), undefined)
73
73
  })
74
74
 
75
- test('인스턴스의 상자는 그 크기에서의 차지하는 공간이다 — 크기 입력값이 아니다 (첫 15분 재측정, 2026-10-16)', () => {
76
- let asset = addFigureBox(createFigureAsset('Padded'), { id: 'body', size: { x: 1000, y: 200, z: 400 }, position: { x: 0, y: 100, z: 0 } })
75
+ /* ADR-0087 결정 6: 좁히지 않은 끝은 부품에서 계산한다 — 막는 것이 없으면 끝이 없고, 끌개는 그린 크기의 두 배 · 반까지 간다. */
76
+ test('크기 범위 — 좁히지 않은 끝은 부품이 허락하는 만큼, 끌개는 열린 끝에서 두 배 · 반까지', () => {
77
+ let asset = addFigureBox(createFigureAsset('Panel'), { id: 'panel', size: { x: 1000, y: 200, z: 400 }, position: { x: 0, y: 100, z: 0 } })
78
+ asset = applyFigureAuthoring(asset, { kind: 'declare-instance-size', at: { x: 1000, y: 200, z: 400 } })
79
+ assert.deepEqual(sizeRangeOf(asset, 'x'), { min: 0, max: Infinity }, '막는 부품이 없다')
80
+ assert.deepEqual(sizeSpanOf(asset, 'x'), { min: 500, max: 2000 })
81
+ assert.equal(sizeWithinRange(asset, 'x', 9000), 9000, '보드처럼 붙들지 않는다')
82
+ asset = applyFigureAuthoring(asset, { kind: 'link-dimension', part: 'panel', axis: 'x', source: { of: 'instance', axis: 'x' }, plus: -400 })
83
+ const x = sizeRangeOf(asset, 'x')!
84
+ assert.ok(x.min > 400 && x.min < 400.001 && x.max === Infinity, `${x.min}`)
85
+ assert.deepEqual(sizeSpanOf(asset, 'x'), { min: x.min, max: 2000 }, '부품이 정한 끝은 그대로')
86
+ assert.equal(sizeWithinRange(asset, 'x', 100), x.min)
87
+ })
88
+
89
+ test('인스턴스의 상자는 그 크기에서의 몸체다 — 크기 입력값이 아니다 (첫 15분 재측정 2026-10-16, ADR-0145)', () => {
90
+ let asset = addFigureBox(createFigureAsset('Knobbed'), { id: 'body', size: { x: 1000, y: 200, z: 400 }, position: { x: 0, y: 100, z: 0 } })
77
91
  asset = applyFigureAuthoring(asset, { kind: 'follow-size', part: 'body' })
78
- assert.equal(occupancyAtSize(asset, { x: 1000, y: 200, z: 400 }) === undefined || !!asset.occupancy, true)
79
- asset = applyFigureAuthoring(asset, { kind: 'declare-occupancy', proposal: proposeFigureOccupancy(asset, { over: 'range' }), padding: { x: 100, y: 0, z: 0 } })
80
- const at = (x: number) => occupancyAtSize(asset, { x, y: 200, z: 400 })!
81
- assert.deepEqual([Math.round(at(1000).x), Math.round(at(3000).x)], [1200, 3200], '부품의 너비에 여유 양쪽 100 mm')
82
- assert.equal(occupancyAtSize(addFigureBox(createFigureAsset('Bare'), { id: 'b', size: { x: 1, y: 1, z: 1 }, position: { x: 0, y: 0, z: 0 } }), { x: 1, y: 1, z: 1 }), undefined, '공간이 없으면 없다')
92
+ /* A 100 mm knob on the body's right face: the body reaches past the size by it. */
93
+ asset = addFigureBox(asset, { id: 'knob', size: { x: 100, y: 100, z: 100 }, position: { x: 550, y: 100, z: 0 } })
94
+ asset = applyFigureAuthoring(asset, { kind: 'attach', part: 'knob', to: { part: 'body', face: 'right' } })
95
+ const at = (x: number) => bodyAtSize(asset, { x, y: 200, z: 400 })!
96
+ assert.deepEqual([Math.round(at(1000).x), Math.round(at(3000).x)], [1100, 3100], '부품의 너비에 손잡이 100 mm')
97
+ assert.equal(bodyAtSize(addFigureBox(createFigureAsset('Bare'), { id: 'b', size: { x: 1, y: 1, z: 1 }, position: { x: 0, y: 0, z: 0 } }), { x: 1, y: 1, z: 1 }), undefined, '크기 입력이 없으면 없다')
83
98
  /* The eight stand in their boxes too. */
84
99
  const { components } = previewInstances('T', { x: 1000, y: 200, z: 400 }, asked => at(asked.x))
85
- assert.equal(components[1]!.width, 2200, 'x 두 배: 2000 + 여유 200')
100
+ assert.equal(components[1]!.width, 2100, 'x 두 배: 2000 + 손잡이 100')
86
101
  })