@things-factory/figure-ui 10.1.220 → 10.1.222

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-ui",
3
- "version": "10.1.220",
3
+ "version": "10.1.222",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "@things-factory:registry": "https://registry.npmjs.org"
@@ -18,7 +18,7 @@
18
18
  "scripts": {
19
19
  "build": "npm run build:server && npm run build:client",
20
20
  "test": "FIGURE_FREEZE_COMPILED=1 node --import ./test/resolve-ts-siblings.mjs --test test/*.test.ts",
21
- "test:browser": "node --test test/browser/build.check.mjs test/browser/modeller.check.mjs test/browser/modeller-revision.check.mjs test/browser/editing.check.mjs test/browser/links.check.mjs test/browser/section.check.mjs test/browser/screen.check.mjs test/browser/product-page.check.mjs test/browser/parts.check.mjs test/browser/places-mesh.check.mjs test/browser/part-ids.check.mjs test/browser/fix-alignment.check.mjs test/browser/mesh-select.check.mjs test/browser/row-preview.check.mjs test/browser/detail-tabs.check.mjs test/browser/props.check.mjs test/browser/retire.check.mjs test/browser/namespace.check.mjs test/browser/public.check.mjs test/browser/category.check.mjs test/browser/property-section.check.mjs test/browser/list.check.mjs",
21
+ "test:browser": "node --test test/browser/build.check.mjs test/browser/modeller.check.mjs test/browser/modeller-revision.check.mjs test/browser/editing.check.mjs test/browser/links.check.mjs test/browser/section.check.mjs test/browser/screen.check.mjs test/browser/product-page.check.mjs test/browser/parts.check.mjs test/browser/places-mesh.check.mjs test/browser/part-ids.check.mjs test/browser/fix-alignment.check.mjs test/browser/mesh-select.check.mjs test/browser/row-preview.check.mjs test/browser/detail-tabs.check.mjs test/browser/props.check.mjs test/browser/retire.check.mjs test/browser/namespace.check.mjs test/browser/public.check.mjs test/browser/category.check.mjs test/browser/property-section.check.mjs test/browser/list.check.mjs test/browser/item.check.mjs",
22
22
  "copy:files": "copyfiles -e \"./client/**/*.{ts,js,json}\" -u 1 \"./client/**/*\" dist-client",
23
23
  "build:client": "npm run copy:files && npx tsc --p ./client/tsconfig.json",
24
24
  "build:server": "npx tsc --p ./server/tsconfig.json",
@@ -27,8 +27,8 @@
27
27
  "clean": "npm run clean:server && npm run clean:client"
28
28
  },
29
29
  "dependencies": {
30
- "@hatiolab/figure-model": "^0.11.0",
31
- "@hatiolab/things-scene": "^10.1.100",
30
+ "@hatiolab/figure-model": "^0.11.1",
31
+ "@hatiolab/things-scene": "^10.1.101",
32
32
  "@material/web": "^2.0.0",
33
33
  "@operato/data-grist": "^10.29.43",
34
34
  "@operato/graphql": "^10.29.43",
@@ -42,11 +42,11 @@
42
42
  "@operato/slot-layout-editor": "^10.29.43",
43
43
  "@operato/styles": "^10.0.0",
44
44
  "@operato/utils": "^10.29.43",
45
- "@things-factory/ai-assistant": "^10.1.220",
46
- "@things-factory/figure-service": "^10.1.218",
47
- "@things-factory/figure-viewer": "^10.1.213",
45
+ "@things-factory/ai-assistant": "^10.1.222",
46
+ "@things-factory/figure-service": "^10.1.222",
47
+ "@things-factory/figure-viewer": "^10.1.222",
48
48
  "@things-factory/setting-base": "^10.1.218",
49
49
  "three": "^0.185.1"
50
50
  },
51
- "gitHead": "539ba46c5975a958587f97174f250978aedd7c69"
51
+ "gitHead": "afdd6a9b1c8b440e39d4fec48bfbad1a0c02fccc"
52
52
  }
@@ -0,0 +1,102 @@
1
+ /*
2
+ * The item tag on the capability tab in a real browser (ADR-0155 amendment 2): a box figure is no item; the box ticked
3
+ * tags it in one step, ticked again takes the tag away in one step, and the choice is drawn like the rungs above it.
4
+ * The page loads no translations, so the words read are i18n keys.
5
+ *
6
+ * Run: node --test test/browser/item.check.mjs
7
+ */
8
+ import { test, describe, before, after } from 'node:test'
9
+ import assert from 'node:assert/strict'
10
+
11
+ import { buildPage } from './build.mjs'
12
+ import { openPage } from './serve.mjs'
13
+
14
+ const sleep = ms => new Promise(done => setTimeout(done, ms))
15
+
16
+ let opened
17
+ before(async () => {
18
+ opened = await openPage(await buildPage('links-page.js'))
19
+ })
20
+ after(async () => {
21
+ await opened?.close()
22
+ })
23
+
24
+ const page = () => opened.page
25
+ const read = (fn, ...args) => page().evaluate(fn, ...args)
26
+ const state = () => read(() => probe.state())
27
+ const source = () => read(() => probe.source())
28
+ const settled = () => read(() => document.querySelector('figure-editor').updateComplete)
29
+
30
+ async function until(fn, args, what, ms = 8000) {
31
+ const deadline = Date.now() + ms
32
+ for (;;) {
33
+ const got = await read(fn, ...args)
34
+ if (got) return got
35
+ if (Date.now() > deadline) assert.fail(`waited for ${what}`)
36
+ await sleep(50)
37
+ }
38
+ }
39
+ async function oneStep(start) {
40
+ await until(from => probe.state().revision > from, [start.revision], 'the step written')
41
+ await settled()
42
+ await sleep(150)
43
+ assert.equal((await state()).revision, start.revision + 1, 'one step')
44
+ }
45
+ async function mount(kind) {
46
+ await read(kind => harness.mount(kind, null), kind)
47
+ await until(
48
+ () => {
49
+ try {
50
+ return probe.ids().some(id => !!probe.partOnPage(id))
51
+ } catch {
52
+ return false
53
+ }
54
+ },
55
+ [],
56
+ 'the figure drawn in 3D',
57
+ 15000
58
+ )
59
+ }
60
+ async function click(point, what) {
61
+ assert.ok(point, `${what} is on the page to click`)
62
+ await page().mouse.click(point.x, point.y)
63
+ await settled()
64
+ }
65
+ /** The centre of the first element matching, found through every shadow root; null when there is none or it is not shown. */
66
+ const centreOf = selector =>
67
+ read(selector => {
68
+ const deep = (root = document) => [...root.querySelectorAll(selector)].concat(...[...root.querySelectorAll('*')].filter(e => e.shadowRoot).map(e => deep(e.shadowRoot)))
69
+ const found = deep().find(e => e.getBoundingClientRect().height > 0)
70
+ if (!found) return null
71
+ const r = found.getBoundingClientRect()
72
+ return { x: r.left + r.width / 2, y: r.top + r.height / 2 }
73
+ }, selector)
74
+ const styleOf = selector =>
75
+ read(selector => {
76
+ const panel = document.querySelector('figure-editor').shadowRoot.querySelector('figure-capability-panel').shadowRoot
77
+ const s = getComputedStyle(panel.querySelector(selector))
78
+ return { border: s.borderTopWidth + ' ' + s.borderTopStyle, radius: s.borderTopLeftRadius, padding: s.paddingTop }
79
+ }, selector)
80
+
81
+ describe('the item tag on the capability tab', () => {
82
+ before(() => mount('box'))
83
+
84
+ test('a box is no item; ticked it is tagged in one step, ticked again the tag goes in one step', async () => {
85
+ await click(await read(l => probe.tab(l), 'figure.label.tab-short-capability'), 'the capability tab')
86
+ assert.equal(Object.hasOwn(await source(), 'item'), false)
87
+
88
+ let start = await state()
89
+ await click(await centreOf('label[item] input'), 'the item box')
90
+ await oneStep(start)
91
+ assert.equal((await source()).item, true)
92
+
93
+ start = await state()
94
+ await click(await centreOf('label[item] input'), 'the item box')
95
+ await oneStep(start)
96
+ assert.equal(Object.hasOwn(await source(), 'item'), false)
97
+ })
98
+
99
+ test('drawn like the rungs above it', async () => {
100
+ assert.deepEqual(await styleOf('label[item]'), await styleOf('label[rung]'))
101
+ })
102
+ })
@@ -351,6 +351,9 @@
351
351
  "figure.label.state": "state",
352
352
  "figure.label.status-colors": "lit colors (lamps · indicators)",
353
353
  "figure.label.tab-capability": "capability",
354
+ "figure.label.item": "Item",
355
+ "figure.label.is-item": "Used as an item",
356
+ "figure.text.is-item-note": "The look of a thing a holder seats and carries: a reel, a tray, a magazine. Item type tables can pick this figure.",
354
357
  "figure.label.tab-environment": "environment",
355
358
  "figure.label.tools": "align",
356
359
  "figure.label.transparent": "transparent",
@@ -351,6 +351,9 @@
351
351
  "figure.label.state": "estado",
352
352
  "figure.label.status-colors": "colores encendidos (lámparas · indicadores)",
353
353
  "figure.label.tab-capability": "capacidad",
354
+ "figure.label.item": "Artículo",
355
+ "figure.label.is-item": "Se usa como artículo",
356
+ "figure.text.is-item-note": "La forma de algo que un contenedor asienta y lleva: una bobina, una bandeja, un cargador. Las tablas de tipos de artículo pueden elegir esta figura.",
354
357
  "figure.label.tab-environment": "entorno",
355
358
  "figure.label.tools": "alinear",
356
359
  "figure.label.transparent": "transparente",
@@ -351,6 +351,9 @@
351
351
  "figure.label.state": "状態",
352
352
  "figure.label.status-colors": "lit colors (lamps · indicators)",
353
353
  "figure.label.tab-capability": "能力",
354
+ "figure.label.item": "アイテム",
355
+ "figure.label.is-item": "アイテムとして使う",
356
+ "figure.text.is-item-note": "ホルダーが場所に載せて運ぶ物の形です。リール・トレイ・マガジン。アイテムタイプ表でこの Figure を選べます。",
354
357
  "figure.label.tab-environment": "環境",
355
358
  "figure.label.tools": "align",
356
359
  "figure.label.transparent": "transparent",
@@ -351,6 +351,9 @@
351
351
  "figure.label.state": "상태",
352
352
  "figure.label.status-colors": "켜진 색 (램프 · 표시등)",
353
353
  "figure.label.tab-capability": "능력",
354
+ "figure.label.item": "아이템",
355
+ "figure.label.is-item": "아이템으로 쓴다",
356
+ "figure.text.is-item-note": "홀더가 자리에 앉혀 나르는 물건의 모양입니다. 릴 · 트레이 · 매거진. 아이템 타입 표에서 이 피규어를 고를 수 있습니다.",
354
357
  "figure.label.tab-environment": "환경",
355
358
  "figure.label.tools": "정렬",
356
359
  "figure.label.transparent": "투명",
@@ -351,6 +351,9 @@
351
351
  "figure.label.state": "keadaan",
352
352
  "figure.label.status-colors": "lit colors (lamps · indicators)",
353
353
  "figure.label.tab-capability": "keupayaan",
354
+ "figure.label.item": "Item",
355
+ "figure.label.is-item": "Digunakan sebagai item",
356
+ "figure.text.is-item-note": "Rupa barang yang diletakkan dan dibawa oleh pemegang: gelendong, dulang, magazin. Jadual jenis item boleh memilih figura ini.",
354
357
  "figure.label.tab-environment": "persekitaran",
355
358
  "figure.label.tools": "align",
356
359
  "figure.label.transparent": "transparent",
@@ -351,6 +351,9 @@
351
351
  "figure.label.state": "状态",
352
352
  "figure.label.status-colors": "lit colors (lamps · indicators)",
353
353
  "figure.label.tab-capability": "能力",
354
+ "figure.label.item": "物品",
355
+ "figure.label.is-item": "用作物品",
356
+ "figure.text.is-item-note": "容器放在位置上搬运的物品外形:卷轴、托盘、料盒。物品类型表可以选择此 Figure。",
354
357
  "figure.label.tab-environment": "环境",
355
358
  "figure.label.tools": "align",
356
359
  "figure.label.transparent": "transparent",