@things-factory/figure-viewer 10.1.170 → 10.1.171

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.170",
3
+ "version": "10.1.171",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -35,5 +35,5 @@
35
35
  "@things-factory/styles": "^10.1.123",
36
36
  "lit": "^3.1.2"
37
37
  },
38
- "gitHead": "1956b73789eace6376f1d79443306e1bb8e61908"
38
+ "gitHead": "e88536db0bc3cbb759fe58f9efeef66a67fef2c3"
39
39
  }
@@ -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 } from '@hatiolab/figure-model'
8
+ import { addFigureBox, applyFigureAuthoring, createFigureAsset, proposeFigureOccupancy } from '@hatiolab/figure-model'
9
9
 
10
- import { authoredSizeOf, PREVIEW_WAYS, previewClampsOf, previewInstances, previewOneInstance, previewTypeOf, setupPartOf, sizeRangeOf, sizeWithinRange } from '../client/preview-model.ts'
10
+ import { authoredSizeOf, occupancyAtSize, PREVIEW_WAYS, previewClampsOf, previewInstances, previewOneInstance, previewTypeOf, setupPartOf, sizeRangeOf, 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'])
@@ -71,3 +71,16 @@ test('크기 범위 — 선언된 축만 열리고, 바라는 크기는 그 범
71
71
  assert.equal(sizeWithinRange(asset, 'y', 300), undefined)
72
72
  assert.equal(sizeWithinRange(asset, 'x', Number.NaN), undefined)
73
73
  })
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 } })
77
+ 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, '공간이 없으면 없다')
83
+ /* The eight stand in their boxes too. */
84
+ const { components } = previewInstances('T', { x: 1000, y: 200, z: 400 }, asked => at(asked.x))
85
+ assert.equal(components[1]!.width, 2200, 'x 두 배: 2000 + 여유 200')
86
+ })