@things-factory/figure-ui 10.1.10 → 10.1.13

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.10",
3
+ "version": "10.1.13",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "@things-factory:registry": "https://registry.npmjs.org"
@@ -37,8 +37,8 @@
37
37
  "@operato/shell": "^10.0.0",
38
38
  "@operato/styles": "^10.0.0",
39
39
  "@operato/utils": "^10.0.0",
40
- "@things-factory/figure-service": "^10.1.9",
40
+ "@things-factory/figure-service": "^10.1.13",
41
41
  "three": "^0.185.1"
42
42
  },
43
- "gitHead": "6f3e8480be33889220db17e9f1f4857c62b261b5"
43
+ "gitHead": "f2cd3d27e32e71cca1d3af5499ef54249b1cc111"
44
44
  }
@@ -131,10 +131,11 @@ test('모델러 AI 입구는 후보만 알리고, 팔레트·그림·현재 정
131
131
  const path = fileURLToPath(new URL('../client/modeller/figure-ask.ts', import.meta.url))
132
132
  const source = readFileSync(path, 'utf8')
133
133
 
134
- assert.match(source, /proposeFigure\(\{[\s\S]*prompt,[\s\S]*base: this\.source \? JSON\.stringify\(this\.source\) : undefined,[\s\S]*type: this\.source \? undefined : this\.type,[\s\S]*palette: Object\.keys\(activePalette\(\)/)
134
+ assert.match(source, /const baseSource = this\.source \? JSON\.stringify\(this\.source\) : undefined/)
135
+ assert.match(source, /proposeFigure\(\{[\s\S]*prompt,[\s\S]*base: baseSource,[\s\S]*type: this\.source \? undefined : this\.type,[\s\S]*palette: Object\.keys\(activePalette\(\)/)
135
136
  assert.match(source, /image: this\.picture/)
136
137
  assert.match(source, /feedback: this\.feedback/)
137
- assert.match(source, /new CustomEvent\('proposed', \{ detail: \{ proposal \}/)
138
+ assert.match(source, /new CustomEvent\('proposed', \{ detail: \{ proposal, baseSource \}/)
138
139
  assert.match(source, /this\.failure = \(err as Error\)\.message/)
139
140
  })
140
141
 
@@ -150,7 +151,8 @@ test('모델러의 수락·거절 피드백은 다음 인라인 후보 요청에
150
151
  const path = fileURLToPath(new URL('../client/pages/figure-modeller-page.ts', import.meta.url))
151
152
  const source = readFileSync(path, 'utf8')
152
153
 
153
- assert.match(source, /\.feedback=\$\{this\.proposalFeedback\}/)
154
+ assert.match(source, /new CustomEvent\('figure-ai-feedback'/)
155
+ assert.doesNotMatch(source, /<figure-ask/)
154
156
  assert.match(source, /this\.proposalFeedback = \[\.\.\.this\.proposalFeedback, feedback\]\.slice\(-5\)/)
155
157
  assert.match(source, /changed\.has\('figure'\).*this\.proposalFeedback = \[\]/s)
156
158
  })
@@ -0,0 +1,25 @@
1
+ import assert from 'node:assert/strict'
2
+ import { test } from 'node:test'
3
+ import { requestFigureAI, takeFigureAITarget } from '../client/modeller/figure-ai-target.ts'
4
+
5
+ test('AI 진입은 늦게 생성되는 Dock에도 복제된 원본을 한 번 전달한다', () => {
6
+ const oldWindow = globalThis.window
7
+ globalThis.window = new EventTarget() as any
8
+ try {
9
+ const source = { type: 'TEST', parts: [{ name: 'cube', size: { y: 100 } }] }
10
+ requestFigureAI({ figureId: 'a', source })
11
+ source.parts[0].size.y = 200
12
+ assert.equal((takeFigureAITarget()?.source as any).parts[0].size.y, 100)
13
+ assert.equal(takeFigureAITarget(), undefined)
14
+ } finally { globalThis.window = oldWindow }
15
+ })
16
+
17
+ test('연속된 명시적 진입에서는 최신 대상만 지연 Dock에 전달한다', () => {
18
+ const oldWindow = globalThis.window
19
+ globalThis.window = new EventTarget() as any
20
+ try {
21
+ requestFigureAI({ figureId: 'a' })
22
+ requestFigureAI({ figureId: 'b' })
23
+ assert.equal(takeFigureAITarget()?.figureId, 'b')
24
+ } finally { globalThis.window = oldWindow }
25
+ })
@@ -0,0 +1,15 @@
1
+ import assert from 'node:assert/strict'
2
+ import { test } from 'node:test'
3
+ import { shouldStartNewFigure } from '../client/modeller/new-figure-entry.ts'
4
+
5
+ test('entering new Figure replaces a previous unsaved draft', () => {
6
+ assert.equal(shouldStartNewFigure({ active: true }, true, ''), true)
7
+ })
8
+ test('removing resource ID replaces a saved model', () => {
9
+ assert.equal(shouldStartNewFigure({ resourceId: undefined }, true, 'saved'), true)
10
+ })
11
+ test('first entry starts empty but ordinary updates retain current work', () => {
12
+ assert.equal(shouldStartNewFigure({}, false), true)
13
+ assert.equal(shouldStartNewFigure({}, true, ''), false)
14
+ assert.equal(shouldStartNewFigure({ query: {} }, true, ''), false)
15
+ })