@things-factory/board-import 10.0.0-beta.72 → 10.0.0-beta.73
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/dist-server/service/converters/generic-to.d.ts +0 -20
- package/dist-server/service/converters/generic-to.js +7 -23
- package/dist-server/service/converters/generic-to.js.map +1 -1
- package/dist-server/service/index.d.ts +2 -2
- package/dist-server/service/index.js +1 -2
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/service/converters/generic-to.test.ts +0 -54
- package/server/service/converters/generic-to.ts +7 -59
- package/server/service/index.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/board-import",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.73",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"things-factory": true,
|
|
6
6
|
"author": "heartyoh",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"@things-factory/shell": "^10.0.0-beta.72",
|
|
32
32
|
"dxf-parser": "^1.1.2"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "341da092718582e73103234d4ecd28d22d4fd85a"
|
|
35
35
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import {
|
|
8
8
|
convertPlaceholderTo,
|
|
9
|
-
attachGlbToPlaceholder,
|
|
10
9
|
isPlaceholderType,
|
|
11
10
|
CORE_PLACEHOLDER_TYPES
|
|
12
11
|
} from './generic-to'
|
|
@@ -90,56 +89,3 @@ describe('convertPlaceholderTo', () => {
|
|
|
90
89
|
})
|
|
91
90
|
})
|
|
92
91
|
|
|
93
|
-
describe('attachGlbToPlaceholder', () => {
|
|
94
|
-
const base = {
|
|
95
|
-
type: 'placeholder',
|
|
96
|
-
id: 'a',
|
|
97
|
-
left: 0,
|
|
98
|
-
top: 0,
|
|
99
|
-
width: 100,
|
|
100
|
-
height: 100
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
test('placeholder 는 type 유지 + src set', () => {
|
|
104
|
-
const r = attachGlbToPlaceholder(base as any, { src: '/glb/foo.glb' }) as any
|
|
105
|
-
expect(r.type).toBe('placeholder')
|
|
106
|
-
expect(r.src).toBe('/glb/foo.glb')
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
test('autoFit 옵션 전파', () => {
|
|
110
|
-
const r = attachGlbToPlaceholder(base as any, {
|
|
111
|
-
src: '/glb/foo.glb',
|
|
112
|
-
autoFit: true
|
|
113
|
-
}) as any
|
|
114
|
-
expect(r.autoFit).toBe(true)
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
test('convertedFrom 메타 없음', () => {
|
|
118
|
-
const r = attachGlbToPlaceholder(base as any, { src: '/glb/foo.glb' }) as any
|
|
119
|
-
expect(r.convertedFrom).toBeUndefined()
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
test('도메인 추상 (extraPlaceholderTypes) 은 type 유지', () => {
|
|
123
|
-
const tx = { ...base, type: 'GenericTransport' }
|
|
124
|
-
const r = attachGlbToPlaceholder(tx as any, {
|
|
125
|
-
src: '/glb/forklift.glb',
|
|
126
|
-
extraPlaceholderTypes: ['GenericTransport']
|
|
127
|
-
}) as any
|
|
128
|
-
expect(r.type).toBe('GenericTransport')
|
|
129
|
-
expect(r.src).toBe('/glb/forklift.glb')
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
test('명시 toType 지정 시 그것으로', () => {
|
|
133
|
-
const r = attachGlbToPlaceholder(base as any, {
|
|
134
|
-
src: '/glb/foo.glb',
|
|
135
|
-
toType: 'gltf-object'
|
|
136
|
-
}) as any
|
|
137
|
-
expect(r.type).toBe('gltf-object')
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
test('placeholder 가 아닌 type 은 throw', () => {
|
|
141
|
-
expect(() =>
|
|
142
|
-
attachGlbToPlaceholder({ type: 'rect', id: 'x' } as any, { src: '/glb/foo.glb' })
|
|
143
|
-
).toThrow(/not a generic placeholder/)
|
|
144
|
-
})
|
|
145
|
-
})
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generic placeholder → 도메인 컴포넌트 변환.
|
|
3
3
|
*
|
|
4
|
-
* Import 시 매칭되지 않은 entity 는
|
|
5
|
-
* 모델러 UI 에서 "Convert to ..." 액션으로
|
|
6
|
-
* morph 한다. `placeholder` 는 GltfComponent mixin 을 갖고 있어 GLB attach 시 type 유지.
|
|
4
|
+
* Import 시 매칭되지 않은 entity 는 `placeholder` 타입으로 보드에 배치된다.
|
|
5
|
+
* 사용자가 사후에 모델러 UI 에서 "Convert to ..." 액션으로 도메인 컴포넌트로 변환.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
* - `placeholder` — 도메인 비종속
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* 아키텍처 원칙:
|
|
8
|
+
* - `placeholder` — 도메인 비종속 임시 추상. 다른 type 으로 변환하는 기능만.
|
|
9
|
+
* GLB 지원 없음 (GltfComponent mixin 제거됨).
|
|
10
|
+
* - 도메인 generic 추상 (GenericTransport, GenericFacility 등) — 영구 도메인 추상.
|
|
11
|
+
* GLB 바디를 직접 채우는 방식으로 사용. 변환 대상 아님.
|
|
12
12
|
*
|
|
13
13
|
* 변환 시:
|
|
14
14
|
* - 좌표/크기/회전 보존
|
|
@@ -98,58 +98,6 @@ export function convertPlaceholderTo(
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
/**
|
|
102
|
-
* Generic placeholder 에 GLB 를 attach 해 GLB 기반 컴포넌트로 morph.
|
|
103
|
-
*
|
|
104
|
-
* morph 정책:
|
|
105
|
-
* - `placeholder` — type 유지 (GltfComponent mixin 이 있어 GLB 직접 수용).
|
|
106
|
-
* - 도메인 추상 (`GenericTransport`, `GenericFacility` 등) — type 유지 + src set.
|
|
107
|
-
* 호출자가 toType 명시 가능 (예: 'GenericTransport'). 미지정이면 placeholder type 유지.
|
|
108
|
-
*/
|
|
109
|
-
export interface AttachGlbOptions extends ConvertOptions {
|
|
110
|
-
/** GLB 파일 URL 또는 Attachment src. */
|
|
111
|
-
src: string
|
|
112
|
-
/** 자동으로 모델 크기에 맞춰 width/height/depth 보정 (gltf-object autoFit). */
|
|
113
|
-
autoFit?: boolean
|
|
114
|
-
/**
|
|
115
|
-
* 명시 변환 type — 도메인 추상 (`GenericTransport` 등) 으로 morph 시 지정.
|
|
116
|
-
* 미지정 시: placeholder type 유지 (placeholder 는 GltfComponent mixin 으로 GLB 직접 수용).
|
|
117
|
-
*/
|
|
118
|
-
toType?: string
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export function attachGlbToPlaceholder(
|
|
122
|
-
placeholder: BoardComponent,
|
|
123
|
-
options: AttachGlbOptions
|
|
124
|
-
): BoardComponent {
|
|
125
|
-
const extra = options.extraPlaceholderTypes ?? []
|
|
126
|
-
if (!isPlaceholderType(placeholder.type, extra)) {
|
|
127
|
-
throw new Error(
|
|
128
|
-
`Source component is not a generic placeholder (type=${placeholder.type}). Cannot attach GLB.`
|
|
129
|
-
)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const {
|
|
133
|
-
strokeStyle: _strokeStyle,
|
|
134
|
-
strokeDashArray: _strokeDashArray,
|
|
135
|
-
fillStyle: _fillStyle,
|
|
136
|
-
label: _label,
|
|
137
|
-
placeholderLabel: _placeholderLabel,
|
|
138
|
-
placeholderHint: _placeholderHint,
|
|
139
|
-
...preservedState
|
|
140
|
-
} = placeholder as any
|
|
141
|
-
|
|
142
|
-
// morph 후 type 결정 — placeholder 는 GltfComponent mixin 보유, 도메인 추상도 type 유지
|
|
143
|
-
const nextType = options.toType ?? placeholder.type
|
|
144
|
-
|
|
145
|
-
return {
|
|
146
|
-
...preservedState,
|
|
147
|
-
type: nextType,
|
|
148
|
-
src: options.src,
|
|
149
|
-
...(options.autoFit ? { autoFit: true } : {})
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
101
|
// ── Backward-compat alias — 기존 호출처 호환 ──────────────────────
|
|
154
102
|
|
|
155
103
|
/**
|
package/server/service/index.ts
CHANGED
|
@@ -28,11 +28,10 @@ export type { BindingOptions } from './pipeline/stage4-binding'
|
|
|
28
28
|
export {
|
|
29
29
|
convertGenericTo, // deprecated alias — keep for backward-compat
|
|
30
30
|
convertPlaceholderTo,
|
|
31
|
-
attachGlbToPlaceholder,
|
|
32
31
|
isPlaceholderType,
|
|
33
32
|
CORE_PLACEHOLDER_TYPES
|
|
34
33
|
} from './converters/generic-to'
|
|
35
|
-
export type { ConvertOptions
|
|
34
|
+
export type { ConvertOptions } from './converters/generic-to'
|
|
36
35
|
|
|
37
36
|
// Adapters
|
|
38
37
|
export { DxfAdapter } from './adapters/dxf-adapter'
|