@things-factory/figure-ui 10.1.125 → 10.1.127
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/client/modeller/align.ts +6 -4
- package/client/modeller/canvas.ts +6 -1
- package/client/modeller/editor.ts +149 -34
- package/client/modeller/evaluated.ts +47 -0
- package/client/modeller/figure-facts.ts +8 -0
- package/client/modeller/figure-preview.ts +38 -16
- package/client/modeller/figure-properties.ts +32 -0
- package/client/modeller/figure-verdict.ts +10 -1
- package/client/modeller/joint-fan.ts +4 -7
- package/client/modeller/links.ts +2 -1
- package/dist-client/modeller/align.d.ts +2 -1
- package/dist-client/modeller/align.js +6 -4
- package/dist-client/modeller/align.js.map +1 -1
- package/dist-client/modeller/canvas.js +8 -1
- package/dist-client/modeller/canvas.js.map +1 -1
- package/dist-client/modeller/editor.d.ts +35 -1
- package/dist-client/modeller/editor.js +138 -37
- package/dist-client/modeller/editor.js.map +1 -1
- package/dist-client/modeller/evaluated.d.ts +12 -0
- package/dist-client/modeller/evaluated.js +42 -0
- package/dist-client/modeller/evaluated.js.map +1 -0
- package/dist-client/modeller/figure-facts.d.ts +0 -7
- package/dist-client/modeller/figure-facts.js +9 -0
- package/dist-client/modeller/figure-facts.js.map +1 -1
- package/dist-client/modeller/figure-preview.js +38 -16
- package/dist-client/modeller/figure-preview.js.map +1 -1
- package/dist-client/modeller/figure-properties.d.ts +8 -2
- package/dist-client/modeller/figure-properties.js +26 -0
- package/dist-client/modeller/figure-properties.js.map +1 -1
- package/dist-client/modeller/figure-verdict.d.ts +2 -0
- package/dist-client/modeller/figure-verdict.js +10 -2
- package/dist-client/modeller/figure-verdict.js.map +1 -1
- package/dist-client/modeller/joint-fan.js +4 -7
- package/dist-client/modeller/joint-fan.js.map +1 -1
- package/dist-client/modeller/links.js +3 -2
- package/dist-client/modeller/links.js.map +1 -1
- package/dist-client/modeller/product-session.d.ts +68 -112
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/test/evaluated.test.ts +40 -0
- package/test/gizmo.test.ts +1 -1
- package/test/mode-switch.test.ts +41 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/figure-ui",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.127",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"@things-factory:registry": "https://registry.npmjs.org"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"clean": "npm run clean:server && npm run clean:client"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@hatiolab/figure-model": "^0.4.
|
|
30
|
+
"@hatiolab/figure-model": "^0.4.1",
|
|
31
31
|
"@hatiolab/things-scene": "^10.1.74",
|
|
32
32
|
"@material/web": "^2.0.0",
|
|
33
33
|
"@operato/data-grist": "^10.0.0",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@operato/shell": "^10.0.0",
|
|
41
41
|
"@operato/styles": "^10.0.0",
|
|
42
42
|
"@operato/utils": "^10.0.0",
|
|
43
|
-
"@things-factory/ai-assistant": "^10.1.
|
|
43
|
+
"@things-factory/ai-assistant": "^10.1.127",
|
|
44
44
|
"@things-factory/figure-service": "^10.1.123",
|
|
45
45
|
"three": "^0.185.1"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "1a224d9f1cbf56697a739e505b97333dd090d473"
|
|
48
48
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* One selection asks several questions of the same figure; the figure is evaluated once for them
|
|
3
|
+
* (`evaluatedGeometryOf`), and asked again when the asset object or the values are not the same.
|
|
4
|
+
*/
|
|
5
|
+
import { test } from 'node:test'
|
|
6
|
+
import assert from 'node:assert/strict'
|
|
7
|
+
|
|
8
|
+
import { addFigureBox, createFigureAsset } from '@hatiolab/figure-model'
|
|
9
|
+
import { compileFigureAsset } from '@hatiolab/figure-model'
|
|
10
|
+
import { evaluatedGeometryOf, seedEvaluatedGeometry } from '../client/modeller/evaluated.ts'
|
|
11
|
+
|
|
12
|
+
const asset = () => addFigureBox(createFigureAsset('Held'), { id: 'a', size: { x: 100, y: 100, z: 100 }, position: { x: 0, y: 50, z: 0 } })
|
|
13
|
+
|
|
14
|
+
test('the same asset under the same values is evaluated once', () => {
|
|
15
|
+
const a = asset()
|
|
16
|
+
assert.equal(evaluatedGeometryOf(a), evaluatedGeometryOf(a))
|
|
17
|
+
const values = { ...a.designInputs }
|
|
18
|
+
assert.equal(evaluatedGeometryOf(a, values), evaluatedGeometryOf(a, { ...values }))
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('another asset object, or other values, is evaluated afresh and says what it now is', () => {
|
|
22
|
+
const a = asset()
|
|
23
|
+
const first = evaluatedGeometryOf(a)
|
|
24
|
+
assert.notEqual(evaluatedGeometryOf(asset()), first)
|
|
25
|
+
const input = Object.keys(a.designInputs).find(id => id.endsWith('position.y'))!
|
|
26
|
+
const moved = evaluatedGeometryOf(a, { ...a.designInputs, [input]: 500 })
|
|
27
|
+
assert.notEqual(moved, first)
|
|
28
|
+
const y = (g: typeof first) => (g.find(o => o.id === 'a') as unknown as { pose: { t: number[] } }).pose.t[1]
|
|
29
|
+
assert.equal(y(first), 50)
|
|
30
|
+
assert.equal(y(moved), 500)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('an answer the session already has is seeded, and answers the same question however its values are listed', () => {
|
|
34
|
+
const a = asset()
|
|
35
|
+
const values = { ...a.designInputs }
|
|
36
|
+
const seeded = compileFigureAsset(a).evaluate().geometry
|
|
37
|
+
seedEvaluatedGeometry(a, values, seeded)
|
|
38
|
+
assert.equal(evaluatedGeometryOf(a, Object.fromEntries(Object.entries(values).reverse())), seeded)
|
|
39
|
+
assert.notEqual(evaluatedGeometryOf(asset(), values), seeded)
|
|
40
|
+
})
|
package/test/gizmo.test.ts
CHANGED
|
@@ -168,7 +168,7 @@ test('크기 칸과 손잡이 — 배치가 지키는 면을 지킨다, 커널
|
|
|
168
168
|
hung = applyFigureAuthoring(hung, { kind: 'declare-occupancy', proposal: proposeFigureOccupancy(hung), placement: 'ceiling' })
|
|
169
169
|
assert.equal(centreY(grow(hung, 'lamp', gizmoReachOf(hung, 'lamp').sizes![1], 300), 'lamp') + 300 / 2, 0, '천장 도형: 윗면이 천장에')
|
|
170
170
|
const editor = read('../client/modeller/editor.ts')
|
|
171
|
-
assert.ok(editor.includes('figureSizeEditChanges(
|
|
171
|
+
assert.ok(editor.includes('figureSizeEditChanges(this.parsedAsset(), part, [change])'), '숫자 칸이 부른다')
|
|
172
172
|
assert.ok(editor.includes('figureSizeEditChanges(asset, ownerOf(id), written)'), '손잡이도 부른다')
|
|
173
173
|
assert.ok(!read('../client/modeller/gizmo.ts').includes('keepBottomChanges'), '화면의 제 산수는 없다')
|
|
174
174
|
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Going from the preview back to editing does not build the edit canvas again: a 3D scene costs about a third of a
|
|
3
|
+
* second to make, and the canvas keeps its selection, gizmo and camera while the preview is in front. The preview is the
|
|
4
|
+
* other way round -- it is taken down when it is left, because a preview left standing behind the canvas made every edit
|
|
5
|
+
* dearer (a box added went from 240 ms to over a second, 2026-10-08).
|
|
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
|
+
const read = (path: string) => readFileSync(fileURLToPath(new URL(path, import.meta.url)), 'utf-8')
|
|
13
|
+
|
|
14
|
+
test('the edit canvas stays standing, out of sight, while the preview is in front', () => {
|
|
15
|
+
const editor = read('../client/modeller/editor.ts')
|
|
16
|
+
assert.ok(editor.includes("<div middle ?hidden=${this.middle === 'preview'}>"), 'the edit area is hidden, not removed')
|
|
17
|
+
assert.ok(/div\[middle\]\[hidden\]\s*\{\s*display: none;/.test(editor), 'and hidden by the stylesheet, which `display: flex` would otherwise override')
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('the preview is only there while it is in front', () => {
|
|
21
|
+
const editor = read('../client/modeller/editor.ts')
|
|
22
|
+
assert.ok(editor.includes("${this.middle === 'preview'\n ? html`<figure-preview"), 'it is made when asked for and taken down when left')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('a canvas out of sight is not resized to nothing and takes no picture', () => {
|
|
26
|
+
const canvas = read('../client/modeller/canvas.ts')
|
|
27
|
+
assert.ok(canvas.includes('this.checkVisibility?.() !== false') && canvas.includes('this.scene?.resize?.()'), 'resize only when visible')
|
|
28
|
+
assert.ok(canvas.includes('if (this.checkVisibility?.() === false) return undefined'), 'no picture while hidden, as when there was no canvas')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
* A value typed beside the preview changes the figure; the preview used to take its 3D scene down and make another, and
|
|
33
|
+
* the new scene's first drawing compiled the shaders again: five frames of 570 to 960 ms for one number (2026-10-09). The
|
|
34
|
+
* content is made again inside the scene that stands, keeping the renderer and the camera, as undo does.
|
|
35
|
+
*/
|
|
36
|
+
test('the preview makes its content again inside the scene that stands, and makes a new scene only when it cannot', () => {
|
|
37
|
+
const preview = read('../client/modeller/figure-preview.ts')
|
|
38
|
+
assert.ok(preview.includes('rebuildContentModel!(model, { preserveThreeD: true })'), 'rebuilt in place, keeping the 3D runtime')
|
|
39
|
+
assert.ok(preview.includes('this.registered === type'), 'only for the same figure')
|
|
40
|
+
assert.ok(/catch \{\s*this\.teardown\(\)/.test(preview), 'and a scene made anew when the content cannot be made again in place')
|
|
41
|
+
})
|