@things-factory/figure-viewer 10.1.266 → 10.1.279

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.
Files changed (56) hide show
  1. package/dist-client/data-words.d.ts +5 -0
  2. package/dist-client/data-words.js +13 -3
  3. package/package.json +17 -3
  4. package/translations/en.json +1 -1
  5. package/translations/es.json +1 -1
  6. package/translations/ja.json +1 -1
  7. package/translations/ko.json +1 -1
  8. package/translations/ms.json +1 -1
  9. package/translations/zh.json +1 -1
  10. package/client/capability-rung.ts +0 -22
  11. package/client/controls.ts +0 -54
  12. package/client/data-connection.ts +0 -82
  13. package/client/data-words.ts +0 -31
  14. package/client/detail-facts.ts +0 -86
  15. package/client/detail-motion.ts +0 -61
  16. package/client/figure-asset-viewer.ts +0 -472
  17. package/client/figure-data-list.ts +0 -87
  18. package/client/figure-data-report.ts +0 -142
  19. package/client/figure-facts-list.ts +0 -59
  20. package/client/figure-thumb-mark.ts +0 -34
  21. package/client/figure-view.ts +0 -151
  22. package/client/index.ts +0 -19
  23. package/client/preview-model.ts +0 -162
  24. package/client/side-panel-styles.ts +0 -480
  25. package/client/tsconfig.json +0 -19
  26. package/client/unit-words.ts +0 -11
  27. package/dist-client/capability-rung.js.map +0 -1
  28. package/dist-client/controls.js.map +0 -1
  29. package/dist-client/data-connection.js.map +0 -1
  30. package/dist-client/data-words.js.map +0 -1
  31. package/dist-client/detail-facts.js.map +0 -1
  32. package/dist-client/detail-motion.js.map +0 -1
  33. package/dist-client/figure-asset-viewer.js.map +0 -1
  34. package/dist-client/figure-data-list.js.map +0 -1
  35. package/dist-client/figure-data-report.js.map +0 -1
  36. package/dist-client/figure-facts-list.js.map +0 -1
  37. package/dist-client/figure-thumb-mark.js.map +0 -1
  38. package/dist-client/figure-view.js.map +0 -1
  39. package/dist-client/index.js.map +0 -1
  40. package/dist-client/preview-model.js.map +0 -1
  41. package/dist-client/side-panel-styles.js.map +0 -1
  42. package/dist-client/tsconfig.tsbuildinfo +0 -1
  43. package/dist-client/unit-words.js.map +0 -1
  44. package/dist-server/index.js.map +0 -1
  45. package/dist-server/tsconfig.tsbuildinfo +0 -1
  46. package/server/index.ts +0 -4
  47. package/server/tsconfig.json +0 -10
  48. package/test/controls.test.ts +0 -51
  49. package/test/data-connection.test.ts +0 -35
  50. package/test/detail-facts.test.ts +0 -89
  51. package/test/detail-motion.test.ts +0 -110
  52. package/test/figure-data-report.test.ts +0 -88
  53. package/test/joints.ts +0 -30
  54. package/test/preview.test.ts +0 -101
  55. package/test/resolve-ts-siblings.mjs +0 -85
  56. package/test/view.test.ts +0 -13
@@ -1,51 +0,0 @@
1
- /*
2
- * **조작값과 자세 도구** (2026-09-24).
3
- *
4
- * 보드가 값을 바꿔 피규어를 움직이는 자리다. 화면이 읽는 값을 명령을 실제로 적용한 자산에서 재고, 화면의 배선은
5
- * 소스에서 확인한다.
6
- */
7
- import { test } from 'node:test'
8
- import assert from 'node:assert/strict'
9
- import { readFileSync } from 'node:fs'
10
- import { fileURLToPath } from 'node:url'
11
-
12
- import { addFigureBox, applyFigureAuthoring, createFigureAsset, editFigurePart } from '@hatiolab/figure-model'
13
- import type { FigureAsset } from '@hatiolab/figure-model'
14
-
15
- import { controlsOf, poseAsDefault, poseDiffers } from '../client/controls.ts'
16
- import { moving } from './joints.ts'
17
-
18
- const read = (path: string) => readFileSync(fileURLToPath(new URL(path, import.meta.url)), 'utf8')
19
-
20
- const slider = (): FigureAsset => {
21
- let asset = createFigureAsset('Slider')
22
- asset = addFigureBox(asset, { id: 'block', size: { x: 100, y: 100, z: 100 }, position: { x: 0, y: 50, z: 0 } })
23
- asset = moving(asset, 'block', { kind: 'slide', axis: 'x', id: 'shift', min: 0, max: 60, start: 20 })
24
- asset = addFigureBox(asset, { id: 'arm', size: { x: 40, y: 200, z: 40 }, position: { x: 0, y: 200, z: 0 } })
25
- return moving(asset, 'arm', { kind: 'turn', axis: 'y', id: 'spin', min: -90, max: 90, start: 0 })
26
- }
27
-
28
- test('조작값마다 이름 · 단위 · 범위 · 지금 값 · 시작 값 · 이동 시간을 읽는다', () => {
29
- let asset = slider()
30
- asset = editFigurePart(asset, { kind: 'set-state-input', input: 'shift', label: '밀기', sweep: 2 })
31
- const [shift, spin] = controlsOf(asset, { shift: 45 })
32
- assert.deepEqual(
33
- { ...shift, step: undefined },
34
- { id: 'shift', label: '밀기', named: true, unit: 'mm', min: 0, max: 60, value: 45, start: 20, sweep: 2, step: undefined }
35
- )
36
- assert.equal(shift!.step, 0.6, '길이는 범위의 백분의 일씩')
37
- assert.equal(spin!.label, 'spin', '이름이 없으면 id')
38
- assert.equal(spin!.named, false)
39
- assert.equal(spin!.step, 1, '각도는 1도씩')
40
- assert.equal(spin!.value, 0, '편집기 값이 없으면 시작 값')
41
- })
42
-
43
- test('지금 자세를 기본으로 — 보고 있는 자세가 시작 자세와 다를 때만, 한 번의 편집으로', () => {
44
- const asset = slider()
45
- assert.equal(poseDiffers(controlsOf(asset)), false)
46
- const looking = controlsOf(asset, { shift: 50, spin: 30 })
47
- assert.equal(poseDiffers(looking), true)
48
- const kept = editFigurePart(asset, poseAsDefault(looking))
49
- assert.deepEqual([kept.stateDefaults['shift'], kept.stateDefaults['spin']], [50, 30])
50
- assert.equal(poseDiffers(controlsOf(kept, { shift: 50, spin: 30 })), false)
51
- })
@@ -1,35 +0,0 @@
1
- /*
2
- * A figure's connections as every screen reads them (the modeller's 「연결」, the preview's 「데이터」, the board's
3
- * 「피규어 데이터」): the field, what it moves by the name a person knows it by, and how.
4
- */
5
- import { test } from 'node:test'
6
- import assert from 'node:assert/strict'
7
-
8
- import { robotDogFigure } from '@hatiolab/figure-model'
9
- import { dataConnectionsOf, dataMoveOf, methodOf } from '../client/data-connection.ts'
10
-
11
- const DOG = robotDogFigure().asset
12
-
13
- test('each connection: its field, what it moves by name, how, and an items list by the part of an item each field says', () => {
14
- const at = (id: string) => dataConnectionsOf(DOG).find(c => c.id === id)!
15
- assert.deepEqual(dataConnectionsOf(DOG).map(c => c.id), DOG.dataInterface!.bindings.map(b => b.id))
16
- /* A motion group by its label, not its id. */
17
- assert.deepEqual([at('mode-locomotion').field, at('mode-locomotion').move, at('mode-locomotion').method], ['mode', { kind: 'motion-clip', name: '보행' }, 'value'])
18
- assert.equal(at('mode-locomotion').node?.kind, 'text')
19
- /* A table by its label and its targets. */
20
- assert.deepEqual([at('body-status').field, at('body-status').move, at('body-status').method], ['몸체 상태', { kind: 'table', name: 'body' }, 'code'])
21
- assert.deepEqual(at('facing').move, { kind: 'pose', name: 'heading' })
22
- /* The items go into the places by their layout's label; each element field says its part of an item. */
23
- assert.deepEqual(at('back-load').move, { kind: 'items', name: DOG.document.capabilities.slotLayout!.label })
24
- assert.deepEqual(at('back-load').itemFields, { id: 'id', place: 'slot' })
25
- assert.equal(at('mode-locomotion').itemFields, undefined)
26
- })
27
-
28
- test('a control by its label, else its id; a figure with no data has no connections', () => {
29
- const named = { ...DOG, stateInputs: { head: { label: '머리 각도' } } } as typeof DOG
30
- assert.deepEqual(dataMoveOf(named, { kind: 'state', input: 'head', sourceMode: 'observed' }), { kind: 'state', name: '머리 각도' })
31
- assert.deepEqual(dataMoveOf(DOG, { kind: 'state', input: 'head', sourceMode: 'observed' }), { kind: 'state', name: 'head' })
32
- assert.equal(methodOf({ id: 't', accessor: 'v', rule: 'table', lookup: 'ranges', targets: {}, table: {} }), 'ranges')
33
- const { dataInterface: _gone, ...bare } = DOG
34
- assert.deepEqual(dataConnectionsOf(bare as typeof DOG), [])
35
- })
@@ -1,89 +0,0 @@
1
- /*
2
- * What the catalogue preview says about a figure under its picture: read off the asset and the row, in the modeller's
3
- * words, and nothing made up for what the figure does not say.
4
- */
5
- import { test } from 'node:test'
6
- import assert from 'node:assert/strict'
7
- import { readFileSync } from 'node:fs'
8
- import { fileURLToPath } from 'node:url'
9
- import { addFigureBox, applyFigureAuthoring, createFigureAsset, editFigurePart } from '@hatiolab/figure-model'
10
-
11
- import { detailFactsOf, placeTerms } from '../client/detail-facts.ts'
12
-
13
- const ko = JSON.parse(readFileSync(fileURLToPath(new URL('../translations/ko.json', import.meta.url)), 'utf8'))
14
- /* `field.*` is the shell's; every figure word must be in this package. */
15
- const say = (key: string, params: Record<string, unknown> = {}) => {
16
- if (key.startsWith('field.')) return key
17
- assert.ok(ko[key], `ko has no words for ${key}`)
18
- return ko[key].replace(/\{(\w+)\}/g, (_: string, k: string) => String(params[k] ?? ''))
19
- }
20
- const box = () => addFigureBox(createFigureAsset('상자'), { id: 'block', size: { x: 100, y: 100, z: 100 }, position: { x: 0, y: 50, z: 0 } })
21
- const valueOf = (facts: ReturnType<typeof detailFactsOf>, key: string) => facts.find(f => f.key === key)?.value
22
-
23
- test('a bare figure: dashes for what it does not say, a score not yet measured, its authored size', () => {
24
- const facts = detailFactsOf(box(), { id: '1', type: 'box', name: '상자', score: null } as never, say)
25
- assert.equal(valueOf(facts, 'category'), '—')
26
- assert.equal(valueOf(facts, 'tags'), '—')
27
- assert.equal(valueOf(facts, 'placement'), '—')
28
- assert.equal(valueOf(facts, 'does'), ko['figure.label.rung-none'])
29
- assert.equal(valueOf(facts, 'places'), '—')
30
- assert.equal(valueOf(facts, 'joints'), '0')
31
- assert.equal(valueOf(facts, 'maturity'), ko['figure.text.not-measured-yet'])
32
- assert.equal(valueOf(facts, 'updated'), undefined)
33
- assert.equal(valueOf(facts, 'extensions'), undefined)
34
- })
35
-
36
- test('a declared size reads as its range on each axis; the row gives category, tags, score and who changed it', () => {
37
- const asset = applyFigureAuthoring(box(), {
38
- kind: 'declare-instance-size',
39
- range: { x: { min: 50, max: 4000 }, y: { min: 50, max: 400 }, z: { min: 50, max: 400 } },
40
- at: { x: 100, y: 100, z: 100 }
41
- })
42
- const facts = detailFactsOf(
43
- asset,
44
- { id: '1', type: 'box', name: '상자', category: 'equipment', tags: ['agv', 'line-2'], score: 82.6, updatedAt: '2026-10-12T03:00:00Z', updater: { id: 'u', name: '관리자' } } as never,
45
- say
46
- )
47
- assert.equal(valueOf(facts, 'size'), `X ${(50).toLocaleString()}–${(4000).toLocaleString()} · Y 50–400 · Z 50–400 mm`)
48
- assert.equal(valueOf(facts, 'category'), 'equipment')
49
- assert.equal(valueOf(facts, 'tags'), 'agv, line-2')
50
- assert.equal(valueOf(facts, 'maturity'), '83')
51
- assert.match(valueOf(facts, 'updated')!, / · 관리자$/)
52
- })
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
-
60
- test('what it does follows its capability names; a set that is no rung is shown as the names', () => {
61
- const holds = editFigurePart(box(), { kind: 'set-capabilities', names: ['Capacity', 'Holdable'] })
62
- assert.equal(valueOf(detailFactsOf(holds, { id: '1', type: 'box', name: '상자' } as never, say), 'does'), ko['figure.label.rung-hold'])
63
- const odd = editFigurePart(box(), { kind: 'set-capabilities', names: ['Capacity'] })
64
- assert.equal(valueOf(detailFactsOf(odd, { id: '1', type: 'box', name: '상자' } as never, say), 'does'), 'Capacity')
65
- })
66
-
67
- test('a row that keeps no score (a board server\'s release) has no maturity line; the catalogue\'s null says not measured', () => {
68
- assert.equal(valueOf(detailFactsOf(box(), { category: 'robot' }, say), 'maturity'), undefined)
69
- assert.equal(valueOf(detailFactsOf(box(), { category: 'robot', score: null }, say), 'maturity'), ko['figure.text.not-measured-yet'])
70
- })
71
-
72
- test('★ a place reads its role, what it accepts and how many — the same words wherever places are listed', () => {
73
- assert.equal(
74
- placeTerms({ role: 'grip', accepts: ['BOX', 'WORKPIECE'], capacity: 1 }, say),
75
- `${ko['figure.label.role-grip']} · ${say('figure.text.place-accepts', { accepts: 'BOX, WORKPIECE' })} · ${say('figure.label.place-holds', { count: 1 })}`
76
- )
77
- /* A place that names no type takes any item (ADR-0051 §4.1 decision 5). */
78
- assert.equal(placeTerms({ role: 'seat', capacity: 2 }, say), `${ko['figure.label.role-seat']} · 받는 것 모든 아이템 · ${say('figure.label.place-holds', { count: 2 })}`)
79
- assert.equal(ko['figure.label.role-grip'], '파지')
80
- assert.equal(say('figure.label.place-holds', { count: 1 }), '최대 1')
81
- })
82
-
83
- test('★ placement reads as the modeller says it (놓이는 곳), not as fastening (붙이기), and with no English name in brackets', () => {
84
- const facts = detailFactsOf(box(), { category: 'robot' }, say)
85
- assert.equal(facts.find(f => f.key === 'placement')?.label, ko['figure.label.figure-placement'])
86
- assert.equal(ko['figure.label.figure-placement'], '놓이는 곳')
87
- /* 「바닥 기반 (floor)」 showed the format's word beside the author's (user 2026-10-16, W5). */
88
- assert.equal(valueOf(detailFactsOf({ ...box(), placement: 'floor' }, {}, say), 'placement'), '바닥')
89
- })
@@ -1,110 +0,0 @@
1
- import { test } from 'node:test'
2
- import assert from 'node:assert/strict'
3
- import { readFileSync } from 'node:fs'
4
- import { fileURLToPath } from 'node:url'
5
- import { addFigureBox, createFigureAsset, editFigurePart, serializeFigureAsset } from '@hatiolab/figure-model'
6
- import { moving } from './joints.ts'
7
- import { clipsDriving, parametersForClip } from '../client/detail-motion.ts'
8
-
9
- function machine() {
10
- let asset = addFigureBox(createFigureAsset('Motion probe'), { id: 'block', size: { x: 100, y: 100, z: 100 }, position: { x: 0, y: 50, z: 0 } })
11
- asset = moving(asset, 'block', { kind: 'slide', axis: 'x', id: 'shift', min: 0, max: 200, start: 0 })
12
- return editFigurePart(asset, { kind: 'set-driver', state: 'shift', clip: 'cycle', duration: 4, keys: [{ seconds: 0, value: 0 }, { seconds: 2, value: 200 }, { seconds: 4, value: 0 }] })
13
- }
14
-
15
- test('playing a clip releases manual values that would mask its drivers, retaining unrelated controls and the source', () => {
16
- const asset = machine()
17
- const source = serializeFigureAsset(asset)
18
- const values = { shift: 75, other: 42 }
19
- assert.deepEqual(parametersForClip(asset, values, 'cycle'), { other: 42 })
20
- assert.deepEqual(values, { shift: 75, other: 42 })
21
- assert.equal(serializeFigureAsset(asset), source)
22
- assert.deepEqual(clipsDriving(asset, 'shift'), ['cycle'])
23
- assert.deepEqual(clipsDriving(asset, 'other'), [])
24
- })
25
-
26
- test('choosing a different clip cannot clear another clip’s manual control', () => {
27
- assert.deepEqual(parametersForClip(machine(), { shift: 75 }, 'other'), { shift: 75 })
28
- })
29
-
30
- /*
31
- * A clip of a motion group (ADR-0051 §3.2) is not played by its speed: the board plays a group's selected clip, and when
32
- * the figure's data chooses that clip, the data -- its default too -- wins over the selection. The robot dog's walk and
33
- * run, pressed in the dock, stood still on idle (2026-10-15). Read here by things-scene's own figure inputs.
34
- */
35
- import { applyFigureProposal, robotDogFigure } from '@hatiolab/figure-model'
36
- import { FigureInputs } from '@hatiolab/things-scene'
37
- import { clipPlayOf, playSettingsOf } from '../client/detail-motion.ts'
38
-
39
- const DOG = robotDogFigure().asset
40
- const played = (asset: typeof DOG, settings: { motion?: unknown; figureValues?: unknown }) => {
41
- const inputs = new FigureInputs(asset)
42
- const taken = inputs.setManual(settings)
43
- assert.ok(taken.accepted, JSON.stringify(taken.issues))
44
- return inputs.motion
45
- }
46
-
47
- test('a group clip the data chooses plays through the data value that turns into it', () => {
48
- assert.deepEqual(clipPlayOf(DOG, 'run'), { kind: 'data', group: 'locomotion', accessor: 'mode', value: 'run' })
49
- const settings = playSettingsOf(DOG, 'run')
50
- assert.deepEqual(settings, { clips: {}, motion: { locomotion: { clip: 'run', speed: 1, paused: false } }, figureValues: { mode: 'run' } })
51
- const motion = played(DOG, settings)
52
- assert.deepEqual([motion.locomotion!.clip, motion.locomotion!.speed, motion.locomotion!.paused], ['run', 1, false])
53
- /* The group's selection alone is not enough: the data's default, idle, wins -- what the dock did before. */
54
- assert.equal(played(DOG, { motion: settings.motion }).locomotion!.clip, 'idle')
55
- /* Nothing playing: every key let go, back to the default clip. */
56
- assert.deepEqual(playSettingsOf(DOG, ''), { clips: {}, motion: {}, figureValues: {} })
57
- assert.equal(played(DOG, playSettingsOf(DOG, '')).locomotion!.clip, 'idle')
58
- })
59
-
60
- test('a table chooses by the code whose look is the clip, its default by a closed value it does not name; else the clip cannot be chosen', () => {
61
- /* A closed field of its own, then the clip bound to it by a table in place of mode's. */
62
- const mapped = applyFigureProposal(DOG, [
63
- { kind: 'set-data-schema', schema: [...DOG.dataInterface!.schema, { name: 'gait', kind: 'text', values: ['STOP', 'GO', 'HURRY'], default: 'STOP' }] },
64
- { kind: 'remove-data-binding', id: 'mode-locomotion' },
65
- {
66
- kind: 'set-data-binding',
67
- binding: { id: 'gait-locomotion', accessor: 'gait', rule: 'table', lookup: 'code', targets: { group: 'locomotion' }, table: { GO: { clip: 'walk' }, HURRY: { clip: 'walk' }, default: { clip: 'idle' } } }
68
- }
69
- ])
70
- assert.deepEqual(clipPlayOf(mapped, 'walk'), { kind: 'data', group: 'locomotion', accessor: 'gait', value: 'GO' })
71
- assert.deepEqual(clipPlayOf(mapped, 'idle'), { kind: 'data', group: 'locomotion', accessor: 'gait', value: 'STOP' })
72
- assert.deepEqual(clipPlayOf(mapped, 'run'), { kind: 'unreachable', group: 'locomotion' })
73
- assert.equal(played(mapped, playSettingsOf(mapped, 'walk')).locomotion!.clip, 'walk')
74
- })
75
-
76
- test('a group nothing in the data chooses plays by its selection; a clip in no group, by its speed', () => {
77
- const { dataInterface: _data, ...free } = DOG
78
- assert.deepEqual(clipPlayOf(free as typeof DOG, 'walk'), { kind: 'group', group: 'locomotion' })
79
- assert.equal(played(free as typeof DOG, playSettingsOf(free as typeof DOG, 'walk')).locomotion!.clip, 'walk')
80
- assert.deepEqual(clipPlayOf(machine(), 'cycle'), { kind: 'free' })
81
- assert.deepEqual(playSettingsOf(machine(), 'cycle'), { clips: { cycle: 1 }, motion: {}, figureValues: {} })
82
- })
83
-
84
- test('the dock tells the board all three, and a clip it cannot choose is not pressed to no effect', () => {
85
- const viewer = readFileSync(fileURLToPath(new URL('../client/figure-asset-viewer.ts', import.meta.url)), 'utf8')
86
- assert.match(viewer, /const \{ clips, motion, figureValues \} = playSettingsOf\(this\.asset, this\.playing\)/)
87
- for (const key of ['clips', 'motion', 'figureValues']) assert.match(viewer, new RegExp(`this\\.tell\\('${key}', ${key}\\)`))
88
- assert.match(viewer, /\?disabled=\$\{unreachable\}/)
89
- for (const lang of ['ko', 'en', 'ja', 'zh', 'ms', 'es']) {
90
- const table = JSON.parse(readFileSync(fileURLToPath(new URL(`../translations/${lang}.json`, import.meta.url)), 'utf8'))
91
- assert.ok(table['figure.text.detail-clip-by-data'], lang)
92
- }
93
- })
94
-
95
- /*
96
- * A clip can move many inputs: the robot dog's walk, run and idle each move all eight leg joints. A play mark on an
97
- * input's row played the walk and every leg moved (user 2026-10-15), so a clip plays on its own row and an input's row
98
- * has none.
99
- */
100
- test('every clip that moves an input is named, and the motion tab plays clips on their own rows only', () => {
101
- for (const leg of ['fl', 'fr', 'hl', 'hr']) for (const joint of ['thigh', 'knee']) assert.deepEqual(clipsDriving(DOG, `${leg}-${joint}`), ['walk', 'run', 'idle'])
102
- assert.deepEqual(clipsDriving(DOG, 'head'), [])
103
- const viewer = readFileSync(fileURLToPath(new URL('../client/figure-asset-viewer.ts', import.meta.url)), 'utf8')
104
- const motion = viewer.slice(viewer.indexOf(' private renderMotion('), viewer.indexOf('\n }\n', viewer.indexOf(' private renderMotion(')))
105
- const inputRows = motion.slice(0, motion.indexOf('</section>'))
106
- assert.ok(!inputRows.includes('playButton'), 'an input row has no play mark')
107
- /* Free clips and each motion group's play on clip rows, the play mark at the row's end. */
108
- assert.equal(motion.match(/this\.clipRow\(name\)/g)?.length, 2)
109
- assert.match(viewer, /private clipRow\(name: string\) \{\n return html`<div slide clip><span title=\$\{name\}>\$\{name\}<\/span>\$\{this\.playButton\(name\)\}<\/div>`/)
110
- })
@@ -1,88 +0,0 @@
1
- /*
2
- * A figure's data list (data binding design, decision 3): what it shows of a placed figure, from the values and sources
3
- * things-scene's figure inputs worked out -- given in here as the inputs would give them -- and of a release in the
4
- * preview, with no data given.
5
- */
6
- import { test } from 'node:test'
7
- import assert from 'node:assert/strict'
8
- import { readFileSync } from 'node:fs'
9
- import { fileURLToPath } from 'node:url'
10
-
11
- import { figureDataExample, robotDogFigure } from '@hatiolab/figure-model'
12
- import { figureDataReportOf } from '../client/figure-data-report.ts'
13
-
14
- const DOG = robotDogFigure().asset
15
- const read = (path: string) => readFileSync(fileURLToPath(new URL(path, import.meta.url)), 'utf8')
16
-
17
- test('each value with where it came from and what it moves; a control the board holds; a list counted; fields the shape does not name', () => {
18
- const report = figureDataReportOf({
19
- asset: DOG,
20
- data: { mode: 'run', extra: 1, position: { x: 500, y: 9 }, load: [{ id: 'B1', slot: 't1_s1', weight: 3 }, { id: 'B2' }] },
21
- parameters: { head: 10 },
22
- values: { 'mode-locomotion': { value: 'run', source: 'live' }, 'cadence-locomotion': { value: 1, source: 'default' }, 'head-angle': { value: 0, source: 'default' }, 'at-z': { value: undefined, source: 'absent' } },
23
- refused: []
24
- })!
25
- const row = (path: string) => report.rows.find(r => r.path === path)!
26
- assert.deepEqual(report.rows.map(r => `${' '.repeat(r.depth)}${r.path}`), ['mode', 'cadence', 'headAngle', 'batteryLow', 'status', 'position', ' position.x', ' position.z', 'heading', 'load', ' load[].id', ' load[].slot'])
27
- assert.deepEqual([row('mode').value, row('mode').source, row('mode').behaviors], ['run', 'live', [{ kind: 'motion-clip', group: 'locomotion' }]])
28
- assert.deepEqual([row('cadence').value, row('cadence').source], [1, 'default'])
29
- /* A table moves its targets: the site's status shows on the body (ADR-0166). */
30
- assert.deepEqual(row('status').behaviors, [{ kind: 'table', targets: { parts: ['body'] } }])
31
- assert.deepEqual([row('position.z').value, row('position.z').source], [undefined, 'absent'])
32
- /* The board's own state value for the head holds it: the data's head angle does not move it. */
33
- assert.deepEqual(row('headAngle').heldByBoard, ['head'])
34
- assert.deepEqual(row('mode').heldByBoard, [])
35
- assert.equal(row('load').count, 2)
36
- assert.equal(row('load[].id').value, undefined, 'an item field has no one value')
37
- /* An item's field says its part of the item; the list's own row says the items go into the places. */
38
- assert.deepEqual([row('load[].id').itemField, row('load[].id').behaviors], ['id', []])
39
- assert.deepEqual([row('load[].slot').itemField, row('load').itemField], ['place', undefined])
40
- assert.deepEqual(row('load').behaviors.map(b => b.kind), ['items'])
41
- assert.deepEqual(report.unused.sort(), ['extra', 'load[].weight', 'position.y'])
42
- assert.deepEqual(report.example, figureDataExample(DOG.dataInterface!))
43
- })
44
-
45
- test('a release with no data given: every field says its kind, nothing is read', () => {
46
- const report = figureDataReportOf({ asset: DOG, data: {}, values: {}, refused: [] })!
47
- assert.ok(report.rows.length > 0)
48
- assert.ok(report.rows.every(r => r.value === undefined && r.source === undefined && r.count === undefined && !r.heldByBoard.length))
49
- assert.deepEqual(report.rows.find(r => r.path === 'mode')!.behaviors, [{ kind: 'motion-clip', group: 'locomotion' }])
50
- assert.deepEqual(report.unused, [])
51
- })
52
-
53
- test('the refusals are given back as they are; a figure with no data shape has no section', () => {
54
- const refused = [{ source: 'live', reason: 'data-values-refused', issues: [{ reason: 'out-of-range' as const, path: 'headAngle', value: 90 }] }]
55
- assert.deepEqual(figureDataReportOf({ asset: DOG, data: { headAngle: 90 }, values: {}, refused })!.refused, refused)
56
- const { dataInterface: _gone, ...bare } = DOG
57
- assert.equal(figureDataReportOf({ asset: bare as typeof DOG, data: {}, values: {}, refused: [] }), null)
58
- })
59
-
60
- test('the preview: the data tab lists the connections, the size and motion tabs name the board properties, in every language', () => {
61
- const viewer = read('../client/figure-asset-viewer.ts')
62
- assert.match(viewer, /FIGURE_VIEWER_TABS: readonly FigureViewerTab\[\] = \['info', 'size', 'motion', 'data'\]/)
63
- /* The connections and an example, from the asset; the board properties from the instance, as the board's panel reads them. */
64
- assert.match(viewer, /const connections = dataConnectionsOf\(asset\)/)
65
- assert.match(viewer, /figureDataExample\(asset\.dataInterface!\)/)
66
- assert.match(viewer, /this\.exposed = this\.scene\.root\?\.components\?\.\[0\]\?\.nature\?\.properties \?\? \[\]/)
67
- assert.match(viewer, /const DESIGN_KEYS = \['designInputs', 'slotLayout'\]/)
68
- for (const key of ['parameters', 'clips', 'motion']) assert.match(viewer, new RegExp(`heading\\('${key}'\\)`))
69
- for (const lang of ['ko', 'en', 'ja', 'zh', 'ms', 'es']) {
70
- const table = JSON.parse(read(`../translations/${lang}.json`))
71
- for (const key of [
72
- 'figure.label.detail-tab-data',
73
- 'figure.text.detail-no-data',
74
- 'figure.label.detail-example',
75
- 'figure.label.data-bindings',
76
- 'figure.text.board-data-none',
77
- ...['design-inputs', 'state-values', 'clip-speeds', 'motion-groups', 'slot-layout'].map(k => `label.${k}`),
78
- ...['live', 'manual', 'default', 'absent'].map(k => `figure.label.board-data-source-${k}`),
79
- ...['number', 'boolean', 'text', 'object', 'list'].map(k => `figure.label.data-kind-${k}`),
80
- ...['state', 'palette', 'motion-clip', 'motion-speed', 'motion-paused', 'pose', 'items'].map(k => `figure.label.data-behavior-${k}`),
81
- ...['x', 'y', 'z', 'heading'].map(k => `figure.label.data-axis-${k}`),
82
- ...['value', 'scale', 'code', 'ranges'].map(k => `figure.label.data-method-${k}`),
83
- ...['id', 'type', 'place', 'stack', 'status'].map(k => `figure.label.data-item-${k}`),
84
- ...['not-a-record', 'not-a-list', 'type-mismatch', 'out-of-range', 'value-unknown', 'json-unreadable', 'item-id-missing'].map(k => `figure.text.board-data-value-${k}`)
85
- ])
86
- assert.ok(table[key], `${lang}: ${key}`)
87
- }
88
- })
package/test/joints.ts DELETED
@@ -1,30 +0,0 @@
1
- /*
2
- * A copy of figure-ui test/joints.ts: a test fixture both packages' tests use (no product code).
3
- *
4
- * Moving a part in a test, as the modeller does it now (ADR-0093): the joint above the part is given a turn or a
5
- * slide. A part fastened to nothing is stood on the floor first -- a joint has a parent.
6
- */
7
- import { applyFigureAuthoring } from '@hatiolab/figure-model'
8
- import type { FigureAsset, FigureJoint } from '@hatiolab/figure-model'
9
-
10
- export function moving(
11
- asset: FigureAsset,
12
- part: string,
13
- spec: { kind: 'slide' | 'turn'; axis: 'x' | 'y' | 'z'; id: string; min: number; max: number; start?: number }
14
- ): FigureAsset {
15
- /* Stood on the floor where it is: its X and Z kept as offsets on the plane. */
16
- const at = (axis: 'x' | 'z') => ({ mm: asset.designInputs[`${part}.position.${axis}`] ?? 0 })
17
- const above: FigureJoint = asset.joints?.find(j => j.body1.part === part) ?? {
18
- id: part,
19
- body0: { plane: 'mounting-plane' },
20
- body1: { part },
21
- origin: { align: { x: at('x'), z: at('z') } }
22
- }
23
- return applyFigureAuthoring(asset, {
24
- kind: 'set-joint',
25
- joint: {
26
- ...above,
27
- motion: [{ type: spec.kind === 'slide' ? 'prismatic' : 'revolute', axis: spec.axis.toUpperCase() as 'X' | 'Y' | 'Z', lowerLimit: spec.min, upperLimit: spec.max, state: { id: spec.id, ...(spec.start !== undefined ? { start: spec.start } : {}) } }]
28
- }
29
- })
30
- }
@@ -1,101 +0,0 @@
1
- /*
2
- * **미리보기** (사용자 2026-09-24). 저작 중인 피규어를 도면처럼 등록하고,
3
- * 기준 크기와 한 · 두 · 세 축을 2배로 늘린 일곱을 나란히 FigureInstance 로 세운다.
4
- */
5
- import { test } from 'node:test'
6
- import assert from 'node:assert/strict'
7
-
8
- import { addFigureBox, applyFigureAuthoring, createFigureAsset } from '@hatiolab/figure-model'
9
-
10
- import { authoredSizeOf, bodyAtSize, PREVIEW_WAYS, previewClampsOf, previewInstances, previewOneInstance, previewTypeOf, setupPartOf, sizeRangeOf, sizeSpanOf, sizeWithinRange } from '../client/preview-model.ts'
11
-
12
- test('여덟 — 기준과 일곱 조합, 한 줄에 넷, 늘린 축만 두 배 · 높이는 늘 적는다', () => {
13
- assert.deepEqual(PREVIEW_WAYS.map(w => w.name), ['base', 'x', 'y', 'z', 'x·y', 'x·z', 'y·z', 'x·y·z'])
14
- const { components, board } = previewInstances('T', { x: 1000, y: 500, z: 400 })
15
- assert.equal(components.length, 8)
16
- assert.deepEqual(components.map(c => [c.width, c.depth, c.height]), [
17
- [1000, 500, 400], [2000, 500, 400], [1000, 1000, 400], [1000, 500, 800],
18
- [2000, 1000, 400], [2000, 500, 800], [1000, 1000, 800], [2000, 1000, 800]
19
- ])
20
- assert.ok(components.every(c => c.type === 'T'))
21
- assert.deepEqual(board, { width: 10000, height: 2000 }, '가장 큰 것이 들어갈 칸 넷씩 두 줄')
22
- })
23
-
24
- test('크기를 선언하지 않은 피규어는 부품이 차지하는 범위를 기준 크기로', () => {
25
- const asset = addFigureBox(createFigureAsset('Fixed'), { id: 'body', size: { x: 300, y: 200, z: 100 }, position: { x: 0, y: 100, z: 0 } })
26
- assert.deepEqual(authoredSizeOf(asset), { x: 300, y: 200, z: 100 })
27
- })
28
-
29
- test('미리보기는 제 타입으로 등록한다 — 남의 도면을 건드리지 않는다', () => {
30
- /* Going to the preview and back, and the registration standing and going with it, are the browser check's (test/browser/screen.check.mjs). */
31
- assert.equal(previewTypeOf(''), 'figure-preview-new', '저장 전 피규어')
32
- assert.equal(previewTypeOf('abc'), 'figure-preview-abc')
33
- })
34
-
35
- test('미리보기 — 선언하지 않은 크기를 묻는 변형은 그려지는 크기를 말한다(높이만 따르는 조명탑, 아키텍트 판정 09-25)', async () => {
36
- const fm = await import('@hatiolab/figure-model')
37
- let a = fm.addFigureBox(fm.createFigureAsset('Tower'), { id: 'mast', size: { x: 200, y: 2000, z: 300 }, position: { x: 0, y: 0, z: 0 } })
38
- a = fm.applyFigureAuthoring(a, { kind: 'attach', part: 'mast', to: { plane: 'mounting-plane' } })
39
- a = fm.applyFigureAuthoring(a, { kind: 'declare-instance-size', range: { x: { min: 200, max: 200 }, y: { min: 1000, max: 3000 }, z: { min: 300, max: 300 } } })
40
- const clamps = previewClampsOf(a, authoredSizeOf(a))
41
- assert.deepEqual(clamps['base'], [], '기준은 그대로')
42
- assert.deepEqual(clamps['x'], [{ axis: 'x', asked: 400, used: 200 }])
43
- assert.deepEqual(clamps['y'], [{ axis: 'y', asked: 4000, used: 3000 }], '높이도 선언 최대까지')
44
- assert.deepEqual(clamps['x·y·z'].map(c => c.axis), ['x', 'y', 'z'])
45
- })
46
-
47
- test('미리보기 크기 안내는 편집에서 고른 부품부터 — 안내에서 고른 것이 먼저, 없는 부품은 건너뛴다', () => {
48
- assert.equal(setupPartOf('', 'roller', ['frame', 'roller']), 'roller', '편집에서 고른 부품')
49
- assert.equal(setupPartOf('frame', 'roller', ['frame', 'roller']), 'frame', '안내에서 고른 것이 이긴다')
50
- assert.equal(setupPartOf('', 'leg', ['frame', 'roller']), 'frame', '크기 규칙이 없는 부품이면 첫 부품')
51
- assert.equal(setupPartOf('gone', '', ['frame']), 'frame', '사라진 부품은 건너뛴다')
52
- assert.equal(setupPartOf('', '', []), '')
53
- })
54
-
55
- test('한 대 — 기준 크기 하나를 두 배 판 가운데에 세운다 (첫 15분, 2026-10-16: 여덟 칸 한 배율에서 롤러가 점이 됐다)', () => {
56
- const { components, board } = previewOneInstance('T', { x: 3000, y: 800, z: 600 })
57
- assert.deepEqual(board, { width: 6000, height: 1200 })
58
- assert.equal(components.length, 1)
59
- const [one] = components
60
- assert.deepEqual([one!.width, one!.depth, one!.height], [3000, 800, 600])
61
- assert.deepEqual([one!.left + one!.width / 2, one!.top + one!.height / 2], [board.width / 2, board.height / 2], '판 가운데')
62
- })
63
-
64
- test('크기 범위 — 선언된 축만 열리고, 바라는 크기는 그 범위 안으로 붙든다', () => {
65
- let asset = addFigureBox(createFigureAsset('Ranged'), { id: 'body', size: { x: 1000, y: 200, z: 400 }, position: { x: 0, y: 100, z: 0 } })
66
- assert.equal(sizeRangeOf(asset, 'x'), undefined, '크기를 선언하지 않으면 바꿀 축이 없다')
67
- asset = applyFigureAuthoring(asset, { kind: 'declare-instance-size', range: { x: { min: 500, max: 4000 }, y: { min: 200, max: 200 }, z: { min: 400, max: 800 } }, at: { x: 1000, y: 200, z: 400 } })
68
- assert.deepEqual(sizeRangeOf(asset, 'x'), { min: 500, max: 4000 })
69
- assert.equal(sizeRangeOf(asset, 'y'), undefined, '한 값으로 묶인 축은 열리지 않는다')
70
- assert.deepEqual([sizeWithinRange(asset, 'x', 9000), sizeWithinRange(asset, 'x', 100), sizeWithinRange(asset, 'x', 2500)], [4000, 500, 2500])
71
- assert.equal(sizeWithinRange(asset, 'y', 300), undefined)
72
- assert.equal(sizeWithinRange(asset, 'x', Number.NaN), undefined)
73
- })
74
-
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 } })
91
- asset = applyFigureAuthoring(asset, { kind: 'follow-size', part: 'body' })
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, '크기 입력이 없으면 없다')
98
- /* The eight stand in their boxes too. */
99
- const { components } = previewInstances('T', { x: 1000, y: 200, z: 400 }, asked => at(asked.x))
100
- assert.equal(components[1]!.width, 2100, 'x 두 배: 2000 + 손잡이 100')
101
- })
@@ -1,85 +0,0 @@
1
- /*
2
- * ★ 소스 시험이 형제 모듈을 부를 수 있게 한다 — **`.js` 로 적힌 상대 경로를 `.ts` 로 되짚는다.**
3
- *
4
- * ── 무엇이 서고 있었나 (2026-08-22) ─────────────────────────────────────────
5
- * 이 패키지의 `npm test` 는 `node --test test/*.test.ts` 로 **소스를 그대로 실행**한다. 그런데 서버
6
- * 소스는 tsc 로 빌드되는 코드이므로 상대 import 를 `'./x.js'` 로 적는다(그것이 빌드 산출물에서 맞는
7
- * 경로다). 타입만 지우는 실행은 그 `.js` 를 `.ts` 로 바꿔 주지 않는다.
8
- *
9
- * 그래서 **소스 모듈이 형제 모듈을 값으로 참조하는 순간** 그 모듈 그래프를 부르는 시험이 전부 선다.
10
- * 실측으로 하루에 세 종류가 이 벽에 걸렸다: `identity/namespace.js`(정체성 이름공간) ·
11
- * `engine/log.js`(로그 문) · `isa95-coverage.js`(적합성 판정). 늘 같은 오류다.
12
- *
13
- * Cannot find module '…/server/identity/namespace.js' imported from '…/templates/wms-unit-load.ts'
14
- *
15
- * ── 왜 이 방식인가 ──────────────────────────────────────────────────────────
16
- * 고르던 길이 둘 있었다.
17
- *
18
- * ① 그 시험들을 **빌드 산출물**(`dist-server`)로 돌린다 — 이 패키지에 전례가 있다. 그러나 시험마다
19
- * 그 배선을 적어야 하고, 걸리는 시험이 늘 때마다 같은 일을 다시 한다. 그리고 산출물이 낡으면
20
- * **고친 코드가 아닌 것이 돌면서 초록으로 보인다.**
21
- * ② 상수를 쓰는 파일 안으로 옮긴다 — 값 참조가 사라지지만 **정본이 흩어진다.** 그것이 이 상수를 한
22
- * 자리에 모은 이유와 정면으로 어긋난다.
23
- *
24
- * 둘 다 증상을 피하는 것이고, 원인은 **해석 규칙 하나**다. 그래서 규칙을 고친다: 상대 경로 `.js` 가
25
- * 없고 같은 이름의 `.ts` 가 있으면 그것을 쓴다. 한 자리에 두므로 걸리는 시험이 늘어도 할 일이 없다.
26
- *
27
- * ── 무엇을 하지 않는가 ─────────────────────────────────────────────────────
28
- * **패키지 이름(`@things-factory/…`)은 손대지 않는다.** 그것은 의존 패키지의 산출물을 가리키는
29
- * 것이고 실제로 `.js` 가 있다. 되짚는 것은 **상대 경로**뿐이고, 그것도 `.ts` 가 실제로 있을 때만이다 —
30
- * 없으면 원래 오류가 그대로 난다(없는 것을 지어내지 않는다).
31
- */
32
- import { registerHooks } from 'node:module'
33
- import { createRequire } from 'node:module'
34
- import { existsSync } from 'node:fs'
35
- import { fileURLToPath, pathToFileURL } from 'node:url'
36
-
37
- /*
38
- * ── 이 패키지에서 한 가지 더 (2026-08-30) ───────────────────────────────────
39
- * things-factory 패키지는 CommonJS 로 빌드하므로 상대 import 를 **확장자 없이** 적는다(`'./x'`).
40
- * 빌드에서는 그것이 맞는데, 소스를 그대로 실행하는 테스트는 ESM 해석이라 확장자가 없으면 찾지 못한다.
41
- * 그래서 `.js` 와 같은 규칙을 확장자 없는 상대 경로에도 적용한다.
42
- */
43
- function tsSibling(specifier, parentURL, stripExtension) {
44
- if (!parentURL) return undefined
45
- const base = stripExtension ? specifier.slice(0, -3) : specifier
46
- const asTs = new URL(base + '.ts', parentURL)
47
- return existsSync(fileURLToPath(asTs)) ? asTs : undefined
48
- }
49
-
50
- /*
51
- * ── 패키지 이름 하나만 예외다: `@hatiolab/things-scene` (2026-09-24) ─────────────────────────
52
- * 이 패키지의 client 는 브라우저 코드이고, things-scene 은 버전이 둘이다 — 브라우저용 `things-scene.mjs` 와
53
- * 서버 전송용 `things-scene-transfer.mjs`. Node 는 `exports` 의 `node` 조건으로 전송 버전을 고르는데, 그 버전에는
54
- * figure 가 없다(`buildFigureGeometry` · `registerFigure` …). 모델러 소스를 Node 에서 시험하면 **브라우저가
55
- * 받을 버전**을 봐야 맞다. 그래서 이 이름만 브라우저 버전으로 되짚는다. 다른 패키지 이름은 그대로 둔다.
56
- */
57
- const SCENE_BROWSER_BUNDLE = (() => {
58
- try {
59
- const require = createRequire(import.meta.url)
60
- return pathToFileURL(require.resolve('@hatiolab/things-scene/package.json').replace(/package\.json$/, 'things-scene.mjs')).href
61
- } catch {
62
- return null
63
- }
64
- })()
65
-
66
- registerHooks({
67
- resolve(specifier, context, nextResolve) {
68
- if (specifier === '@hatiolab/things-scene' && SCENE_BROWSER_BUNDLE) return { url: SCENE_BROWSER_BUNDLE, shortCircuit: true }
69
- /* 상대 경로만 본다 — 패키지 이름은 그대로 둔다(의존 패키지의 산출물을 가리킨다). */
70
- if (!specifier.startsWith('.')) return nextResolve(specifier, context)
71
-
72
- const endsWithJs = specifier.endsWith('.js')
73
- const hasExtension = /\.[a-zA-Z0-9]+$/.test(specifier)
74
- if (!endsWithJs && hasExtension) return nextResolve(specifier, context)
75
-
76
- try {
77
- return nextResolve(specifier, context)
78
- } catch (err) {
79
- /* 해석이 실패한 그때만 `.ts` 를 본다 — 성공하는 경로의 뜻을 바꾸지 않는다. */
80
- const asTs = tsSibling(specifier, context?.parentURL, endsWithJs)
81
- if (!asTs) throw err
82
- return { url: pathToFileURL(fileURLToPath(asTs)).href, shortCircuit: true, format: 'module-typescript' }
83
- }
84
- }
85
- })
package/test/view.test.ts DELETED
@@ -1,13 +0,0 @@
1
- /*
2
- * **보기 — 작업대의 설정** (「환경」 탭). 피규어에 저장되지 않고, 보는 사람의 브라우저에 남는다.
3
- * 탭에서 바꾸면 판이 따르고 브라우저에 남으며 피규어는 그대로인 것은 브라우저 검사(`test/browser/screen.check.mjs`)가 본다.
4
- */
5
- import { test } from 'node:test'
6
- import assert from 'node:assert/strict'
7
-
8
- import { ENVIRONMENTS } from '../client/figure-view.ts'
9
-
10
- test('환경 탭 — 씬이 받는 환경 여덟을 모두 고를 수 있다', () => {
11
- assert.equal(ENVIRONMENTS.length, 8, '환경 여덟')
12
- assert.ok(ENVIRONMENTS.includes('studio') && ENVIRONMENTS.includes('rainy'))
13
- })