@things-factory/figure-ui 10.1.129 → 10.1.142

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 (95) hide show
  1. package/client/modeller/align.ts +24 -18
  2. package/client/modeller/editor.ts +165 -253
  3. package/client/modeller/fasten-geometry.ts +12 -9
  4. package/client/modeller/figure-facts.ts +12 -14
  5. package/client/modeller/figure-links.ts +16 -12
  6. package/client/modeller/figure-preview.ts +13 -4
  7. package/client/modeller/figure-properties.ts +6 -5
  8. package/client/modeller/figure-verdict.ts +14 -8
  9. package/client/modeller/joint-fan.ts +15 -17
  10. package/client/modeller/links.ts +17 -23
  11. package/client/modeller/live.ts +6 -3
  12. package/client/modeller/motion-ends.ts +6 -7
  13. package/client/modeller/occupancy.ts +2 -3
  14. package/client/modeller/product-session.ts +15 -0
  15. package/client/modeller/revision.ts +66 -0
  16. package/client/pages/figure-modeller-page.ts +5 -18
  17. package/dist-client/modeller/align.d.ts +12 -7
  18. package/dist-client/modeller/align.js +21 -17
  19. package/dist-client/modeller/align.js.map +1 -1
  20. package/dist-client/modeller/editor.d.ts +8 -34
  21. package/dist-client/modeller/editor.js +175 -250
  22. package/dist-client/modeller/editor.js.map +1 -1
  23. package/dist-client/modeller/fasten-geometry.d.ts +3 -2
  24. package/dist-client/modeller/fasten-geometry.js +11 -9
  25. package/dist-client/modeller/fasten-geometry.js.map +1 -1
  26. package/dist-client/modeller/figure-facts.d.ts +9 -1
  27. package/dist-client/modeller/figure-facts.js +11 -15
  28. package/dist-client/modeller/figure-facts.js.map +1 -1
  29. package/dist-client/modeller/figure-links.d.ts +4 -5
  30. package/dist-client/modeller/figure-links.js +14 -13
  31. package/dist-client/modeller/figure-links.js.map +1 -1
  32. package/dist-client/modeller/figure-preview.d.ts +5 -2
  33. package/dist-client/modeller/figure-preview.js +13 -4
  34. package/dist-client/modeller/figure-preview.js.map +1 -1
  35. package/dist-client/modeller/figure-properties.d.ts +3 -2
  36. package/dist-client/modeller/figure-properties.js +6 -6
  37. package/dist-client/modeller/figure-properties.js.map +1 -1
  38. package/dist-client/modeller/figure-verdict.d.ts +4 -2
  39. package/dist-client/modeller/figure-verdict.js +12 -9
  40. package/dist-client/modeller/figure-verdict.js.map +1 -1
  41. package/dist-client/modeller/joint-fan.d.ts +8 -4
  42. package/dist-client/modeller/joint-fan.js +15 -16
  43. package/dist-client/modeller/joint-fan.js.map +1 -1
  44. package/dist-client/modeller/links.d.ts +6 -5
  45. package/dist-client/modeller/links.js +17 -24
  46. package/dist-client/modeller/links.js.map +1 -1
  47. package/dist-client/modeller/live.d.ts +3 -2
  48. package/dist-client/modeller/live.js +7 -3
  49. package/dist-client/modeller/live.js.map +1 -1
  50. package/dist-client/modeller/motion-ends.d.ts +2 -2
  51. package/dist-client/modeller/motion-ends.js +5 -6
  52. package/dist-client/modeller/motion-ends.js.map +1 -1
  53. package/dist-client/modeller/occupancy.d.ts +2 -2
  54. package/dist-client/modeller/occupancy.js +2 -3
  55. package/dist-client/modeller/occupancy.js.map +1 -1
  56. package/dist-client/modeller/product-session.d.ts +44 -39
  57. package/dist-client/modeller/product-session.js +17 -0
  58. package/dist-client/modeller/product-session.js.map +1 -1
  59. package/dist-client/modeller/revision.d.ts +37 -0
  60. package/dist-client/modeller/revision.js +39 -0
  61. package/dist-client/modeller/revision.js.map +1 -0
  62. package/dist-client/pages/figure-modeller-page.d.ts +0 -6
  63. package/dist-client/pages/figure-modeller-page.js +6 -14
  64. package/dist-client/pages/figure-modeller-page.js.map +1 -1
  65. package/dist-client/tsconfig.tsbuildinfo +1 -1
  66. package/package.json +7 -7
  67. package/test/align.test.ts +14 -12
  68. package/test/browser/modeller-page.js +52 -4
  69. package/test/browser/modeller-revision.check.mjs +144 -0
  70. package/test/command-preview.test.ts +9 -8
  71. package/test/fasten-drawing.test.ts +1 -1
  72. package/test/fasten-geometry.test.ts +10 -9
  73. package/test/fields.test.ts +1 -1
  74. package/test/first-minute.test.ts +1 -1
  75. package/test/gizmo.test.ts +1 -1
  76. package/test/joint-fan.test.ts +30 -14
  77. package/test/joint-frames.test.ts +9 -8
  78. package/test/links.test.ts +13 -12
  79. package/test/live.test.ts +3 -3
  80. package/test/parts-wiring.test.ts +1 -1
  81. package/test/properties.test.ts +6 -5
  82. package/test/release-panel.test.ts +3 -3
  83. package/test/resize-with-placement.test.ts +8 -6
  84. package/test/revision-of.ts +22 -0
  85. package/test/revision.test.ts +172 -0
  86. package/test/section-editor.test.ts +4 -3
  87. package/test/section-panel.test.ts +5 -4
  88. package/test/verdict.test.ts +1 -1
  89. package/client/modeller/evaluated.ts +0 -47
  90. package/dist-client/modeller/evaluated.d.ts +0 -12
  91. package/dist-client/modeller/evaluated.js +0 -42
  92. package/dist-client/modeller/evaluated.js.map +0 -1
  93. package/dist-client/tsconfig.scratch.tsbuildinfo +0 -1
  94. package/test/evaluated.test.ts +0 -40
  95. package/test/mode-switch.test.ts +0 -43
@@ -1,40 +0,0 @@
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
- })
@@ -1,43 +0,0 @@
1
- /*
2
- * Going between editing and the preview does not build a 3D scene each time (about 300 ms): the edit canvas and, once it
3
- * has been asked for, the preview stay standing and one of them is out of sight. A preview shown again after the figure
4
- * changed makes its content again inside its scene (below); one that did not change is shown as it was.
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
- const read = (path: string) => readFileSync(fileURLToPath(new URL(path, import.meta.url)), 'utf-8')
12
-
13
- test('the edit canvas stays standing, out of sight, while the preview is in front', () => {
14
- const editor = read('../client/modeller/editor.ts')
15
- assert.ok(editor.includes("<div middle ?hidden=${this.middle === 'preview'}>"), 'the edit area is hidden, not removed')
16
- assert.ok(/div\[middle\]\[hidden\]\s*\{\s*display: none;/.test(editor), 'and hidden by the stylesheet, which `display: flex` would otherwise override')
17
- })
18
-
19
- test('the preview is made when first asked for and kept, out of sight, after that', () => {
20
- const editor = read('../client/modeller/editor.ts')
21
- assert.ok(editor.includes("if (this.middle === 'preview') this.previewMounted = true"), 'made when asked for')
22
- assert.ok(editor.includes("${this.previewMounted\n ? html`<figure-preview\n ?hidden=${this.middle !== 'preview'}\n .active=${this.middle === 'preview'}"), 'then kept, hidden and not in front')
23
- const preview = read('../client/modeller/figure-preview.ts')
24
- assert.ok(preview.includes('if (!this.active) {\n this.stale = true') && preview.includes('this.stale || changed.has(\'active\')'), 'out of sight it does not follow the figure; shown again it catches up')
25
- })
26
-
27
- test('a canvas out of sight is not resized to nothing and takes no picture', () => {
28
- const canvas = read('../client/modeller/canvas.ts')
29
- assert.ok(canvas.includes('this.checkVisibility?.() !== false') && canvas.includes('this.scene?.resize?.()'), 'resize only when visible')
30
- assert.ok(canvas.includes('if (this.checkVisibility?.() === false) return undefined'), 'no picture while hidden, as when there was no canvas')
31
- })
32
-
33
- /*
34
- * A value typed beside the preview changes the figure; the preview used to take its 3D scene down and make another, and
35
- * the new scene's first drawing compiled the shaders again: five frames of 570 to 960 ms for one number (2026-10-09). The
36
- * content is made again inside the scene that stands, keeping the renderer and the camera, as undo does.
37
- */
38
- test('the preview makes its content again inside the scene that stands, and makes a new scene only when it cannot', () => {
39
- const preview = read('../client/modeller/figure-preview.ts')
40
- assert.ok(preview.includes('rebuildContentModel!(model, { preserveThreeD: true })'), 'rebuilt in place, keeping the 3D runtime')
41
- assert.ok(preview.includes('this.registered === type'), 'only for the same figure')
42
- assert.ok(/catch \{\s*this\.teardown\(\)/.test(preview), 'and a scene made anew when the content cannot be made again in place')
43
- })