@things-factory/board-import 10.0.0-beta.73 → 10.0.0-beta.76

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.
@@ -10,7 +10,13 @@ export interface ConvertOptions {
10
10
  */
11
11
  extraPlaceholderTypes?: ReadonlyArray<string>;
12
12
  }
13
- /** things-scene 코어가 등록한 도메인 비종속 placeholder type. */
13
+ /**
14
+ * things-scene 코어가 등록한 도메인 비종속 placeholder type.
15
+ *
16
+ * @sync things-scene/src/components/generic-placeholders.ts CORE_PLACEHOLDER_TYPES
17
+ * client/server 경계로 직접 import 불가 — 값을 바꾸면 양쪽 동시 수정 필수.
18
+ * 계약은 generic-to.test.ts 의 'CORE_PLACEHOLDER_TYPES contract' 어설션으로 보증.
19
+ */
14
20
  export declare const CORE_PLACEHOLDER_TYPES: readonly ["placeholder"];
15
21
  export declare function isPlaceholderType(type: string | undefined, extraTypes?: ReadonlyArray<string>): boolean;
16
22
  /**
@@ -23,7 +23,13 @@ exports.convertGenericTo = convertGenericTo;
23
23
  */
24
24
  const index_1 = require("../registry/index");
25
25
  const stage2_mapping_1 = require("../pipeline/stage2-mapping");
26
- /** things-scene 코어가 등록한 도메인 비종속 placeholder type. */
26
+ /**
27
+ * things-scene 코어가 등록한 도메인 비종속 placeholder type.
28
+ *
29
+ * @sync things-scene/src/components/generic-placeholders.ts CORE_PLACEHOLDER_TYPES
30
+ * client/server 경계로 직접 import 불가 — 값을 바꾸면 양쪽 동시 수정 필수.
31
+ * 계약은 generic-to.test.ts 의 'CORE_PLACEHOLDER_TYPES contract' 어설션으로 보증.
32
+ */
27
33
  exports.CORE_PLACEHOLDER_TYPES = [stage2_mapping_1.GENERIC_OBJECT_TYPE];
28
34
  function isPlaceholderType(type, extraTypes = []) {
29
35
  if (!type)
@@ -1 +1 @@
1
- {"version":3,"file":"generic-to.js","sourceRoot":"","sources":["../../../server/service/converters/generic-to.ts"],"names":[],"mappings":";;;AAqCA,8CAOC;AAS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,CAAC,CAAA;IAC7D,MAAM,MAAM,GAAG;QACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrD,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,QAAQ;KAClC,CAAA;IAED,oDAAoD;IACpD,MAAM,EACJ,WAAW,EAAE,YAAY,EACzB,eAAe,EAAE,gBAAgB,EACjC,SAAS,EAAE,UAAU,EACrB,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,iBAAiB,EACnC,eAAe,EAAE,gBAAgB,EACjC,GAAG,cAAc,EAClB,GAAG,WAAkB,CAAA;IAEtB,OAAO;QACL,GAAG,cAAc;QACjB,QAAQ;QACR,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,KAAK;QACT,MAAM;QACN,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC;KACpC,CAAA;AACH,CAAC;AAED,8DAA8D;AAE9D;;GAEG;AACH,SAAgB,gBAAgB,CAC9B,OAAuB,EACvB,MAAc,EACd,UAA0B,EAAE;IAE5B,IAAI,OAAO,CAAC,IAAI,KAAK,oCAAmB,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,6CAA6C,OAAO,CAAC,IAAI,GAAG,CAAC,CAAA;IAC/E,CAAC;IACD,OAAO,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AACvD,CAAC","sourcesContent":["/**\n * Generic placeholder → 도메인 컴포넌트 변환.\n *\n * Import 시 매칭되지 않은 entity 는 `placeholder` 타입으로 보드에 배치된다.\n * 사용자가 사후에 모델러 UI 에서 \"Convert to ...\" 액션으로 도메인 컴포넌트로 변환.\n *\n * 아키텍처 원칙:\n * - `placeholder` — 도메인 비종속 임시 추상. 다른 type 으로 변환하는 기능만.\n * GLB 지원 없음 (GltfComponent mixin 제거됨).\n * - 도메인 generic 추상 (GenericTransport, GenericFacility 등) — 영구 도메인 추상.\n * GLB 바디를 직접 채우는 방식으로 사용. 변환 대상 아님.\n *\n * 변환 시:\n * - 좌표/크기/회전 보존\n * - source (원본 entity attribs) 보존\n * - 등록된 ImportRule.build 의 defaultState / idStrategy 적용\n */\nimport { find3DPreset, getImportRules } from '../registry/index'\nimport type { BoardComponent } from '../pipeline/stage3-board'\nimport type { ComponentCategory } from '../types/registry'\nimport { GENERIC_OBJECT_TYPE } from '../pipeline/stage2-mapping'\n\nexport interface ConvertOptions {\n scopes?: string[]\n /** 새 컴포넌트의 ID. 미지정 시 ImportRule 의 idStrategy 적용 또는 자동 생성. */\n id?: string\n /**\n * 코어 placeholder type ('placeholder') 외에 인정할 도메인 추상 type list.\n * 예: ['GenericTransport', 'GenericFacility'].\n * 호출자가 자기 도메인 패키지의 추상까지 변환 대상으로 포함하도록 명시.\n */\n extraPlaceholderTypes?: ReadonlyArray<string>\n}\n\n/** things-scene 코어가 등록한 도메인 비종속 placeholder type. */\nexport const CORE_PLACEHOLDER_TYPES = [GENERIC_OBJECT_TYPE] as const\n\nexport function isPlaceholderType(\n type: string | undefined,\n extraTypes: ReadonlyArray<string> = []\n): boolean {\n if (!type) return false\n if ((CORE_PLACEHOLDER_TYPES as readonly string[]).includes(type)) return true\n return extraTypes.includes(type)\n}\n\n// ── 일반화된 변환 helper ─────────────────────────────────────────────\n\n/**\n * 추상 placeholder 를 지정된 도메인 type 으로 변환. 호환되는 모든 generic-* 수용 (코어 + 도메인).\n *\n * 기존 좌표/크기/회전/source 보존. placeholder 시각 메타 (placeholderLabel/Hint, fillStyle 등) 는 제거.\n */\nexport function convertPlaceholderTo(\n placeholder: BoardComponent,\n toType: string,\n options: ConvertOptions = {}\n): BoardComponent {\n const extra = options.extraPlaceholderTypes ?? []\n if (!isPlaceholderType(placeholder.type, extra)) {\n throw new Error(\n `Source component is not a generic placeholder (type=${placeholder.type}). ` +\n `Expected one of: ${[...CORE_PLACEHOLDER_TYPES, ...extra].join(', ')}`\n )\n }\n\n const rules = getImportRules(options.scopes)\n const rule = rules.find(r => r.componentType === toType)\n\n const category: ComponentCategory = rule?.category ?? 'unknown'\n const newId = options.id ?? placeholder.id\n\n const preset = find3DPreset(toType, category, options.scopes)\n const threeD = {\n geometry: preset.geometry,\n ...(preset.material && { material: preset.material }),\n origin: preset.origin ?? 'bottom'\n }\n\n // placeholder 시각/스타일 메타는 새 type 으로 옮길 때 의미 없음 — 제거.\n const {\n strokeStyle: _strokeStyle,\n strokeDashArray: _strokeDashArray,\n fillStyle: _fillStyle,\n label: _label,\n placeholderLabel: _placeholderLabel,\n placeholderHint: _placeholderHint,\n ...preservedState\n } = placeholder as any\n\n return {\n ...preservedState,\n category,\n type: toType,\n id: newId,\n threeD,\n ...(rule?.build.defaultState || {})\n }\n}\n\n// ── Backward-compat alias — 기존 호출처 호환 ──────────────────────\n\n/**\n * @deprecated Use `convertPlaceholderTo`. Placeholder 한정 — 새 코드는 일반화된 helper.\n */\nexport function convertGenericTo(\n generic: BoardComponent,\n toType: string,\n options: ConvertOptions = {}\n): BoardComponent {\n if (generic.type !== GENERIC_OBJECT_TYPE) {\n throw new Error(`Source component is not Placeholder (type=${generic.type})`)\n }\n return convertPlaceholderTo(generic, toType, options)\n}\n"]}
1
+ {"version":3,"file":"generic-to.js","sourceRoot":"","sources":["../../../server/service/converters/generic-to.ts"],"names":[],"mappings":";;;AA2CA,8CAOC;AASD,oDA6CC;AAOD,4CASC;AAxHD;;;;;;;;;;;;;;;;GAgBG;AACH,6CAAgE;AAGhE,+DAAgE;AAchE;;;;;;GAMG;AACU,QAAA,sBAAsB,GAAG,CAAC,oCAAmB,CAAU,CAAA;AAEpE,SAAgB,iBAAiB,CAC/B,IAAwB,EACxB,aAAoC,EAAE;IAEtC,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IACvB,IAAK,8BAA4C,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,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AU,EACrB,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,iBAAiB,EACnC,eAAe,EAAE,gBAAgB,EACjC,GAAG,cAAc,EAClB,GAAG,WAAkB,CAAA;IAEtB,OAAO;QACL,GAAG,cAAc;QACjB,QAAQ;QACR,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,KAAK;QACT,MAAM;QACN,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC;KACpC,CAAA;AACH,CAAC;AAED,8DAA8D;AAE9D;;GAEG;AACH,SAAgB,gBAAgB,CAC9B,OAAuB,EACvB,MAAc,EACd,UAA0B,EAAE;IAE5B,IAAI,OAAO,CAAC,IAAI,KAAK,oCAAmB,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,6CAA6C,OAAO,CAAC,IAAI,GAAG,CAAC,CAAA;IAC/E,CAAC;IACD,OAAO,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AACvD,CAAC","sourcesContent":["/**\n * Generic placeholder → 도메인 컴포넌트 변환.\n *\n * Import 시 매칭되지 않은 entity 는 `placeholder` 타입으로 보드에 배치된다.\n * 사용자가 사후에 모델러 UI 에서 \"Convert to ...\" 액션으로 도메인 컴포넌트로 변환.\n *\n * 아키텍처 원칙:\n * - `placeholder` — 도메인 비종속 임시 추상. 다른 type 으로 변환하는 기능만.\n * GLB 지원 없음 (GltfComponent mixin 제거됨).\n * - 도메인 generic 추상 (GenericTransport, GenericFacility 등) — 영구 도메인 추상.\n * GLB 바디를 직접 채우는 방식으로 사용. 변환 대상 아님.\n *\n * 변환 시:\n * - 좌표/크기/회전 보존\n * - source (원본 entity attribs) 보존\n * - 등록된 ImportRule.build 의 defaultState / idStrategy 적용\n */\nimport { find3DPreset, getImportRules } from '../registry/index'\nimport type { BoardComponent } from '../pipeline/stage3-board'\nimport type { ComponentCategory } from '../types/registry'\nimport { GENERIC_OBJECT_TYPE } from '../pipeline/stage2-mapping'\n\nexport interface ConvertOptions {\n scopes?: string[]\n /** 새 컴포넌트의 ID. 미지정 시 ImportRule 의 idStrategy 적용 또는 자동 생성. */\n id?: string\n /**\n * 코어 placeholder type ('placeholder') 외에 인정할 도메인 추상 type list.\n * 예: ['GenericTransport', 'GenericFacility'].\n * 호출자가 자기 도메인 패키지의 추상까지 변환 대상으로 포함하도록 명시.\n */\n extraPlaceholderTypes?: ReadonlyArray<string>\n}\n\n/**\n * things-scene 코어가 등록한 도메인 비종속 placeholder type.\n *\n * @sync things-scene/src/components/generic-placeholders.ts CORE_PLACEHOLDER_TYPES\n * client/server 경계로 직접 import 불가 — 값을 바꾸면 양쪽 동시 수정 필수.\n * 계약은 generic-to.test.ts 의 'CORE_PLACEHOLDER_TYPES contract' 어설션으로 보증.\n */\nexport const CORE_PLACEHOLDER_TYPES = [GENERIC_OBJECT_TYPE] as const\n\nexport function isPlaceholderType(\n type: string | undefined,\n extraTypes: ReadonlyArray<string> = []\n): boolean {\n if (!type) return false\n if ((CORE_PLACEHOLDER_TYPES as readonly string[]).includes(type)) return true\n return extraTypes.includes(type)\n}\n\n// ── 일반화된 변환 helper ─────────────────────────────────────────────\n\n/**\n * 추상 placeholder 를 지정된 도메인 type 으로 변환. 호환되는 모든 generic-* 수용 (코어 + 도메인).\n *\n * 기존 좌표/크기/회전/source 보존. placeholder 시각 메타 (placeholderLabel/Hint, fillStyle 등) 는 제거.\n */\nexport function convertPlaceholderTo(\n placeholder: BoardComponent,\n toType: string,\n options: ConvertOptions = {}\n): BoardComponent {\n const extra = options.extraPlaceholderTypes ?? []\n if (!isPlaceholderType(placeholder.type, extra)) {\n throw new Error(\n `Source component is not a generic placeholder (type=${placeholder.type}). ` +\n `Expected one of: ${[...CORE_PLACEHOLDER_TYPES, ...extra].join(', ')}`\n )\n }\n\n const rules = getImportRules(options.scopes)\n const rule = rules.find(r => r.componentType === toType)\n\n const category: ComponentCategory = rule?.category ?? 'unknown'\n const newId = options.id ?? placeholder.id\n\n const preset = find3DPreset(toType, category, options.scopes)\n const threeD = {\n geometry: preset.geometry,\n ...(preset.material && { material: preset.material }),\n origin: preset.origin ?? 'bottom'\n }\n\n // placeholder 시각/스타일 메타는 새 type 으로 옮길 때 의미 없음 — 제거.\n const {\n strokeStyle: _strokeStyle,\n strokeDashArray: _strokeDashArray,\n fillStyle: _fillStyle,\n label: _label,\n placeholderLabel: _placeholderLabel,\n placeholderHint: _placeholderHint,\n ...preservedState\n } = placeholder as any\n\n return {\n ...preservedState,\n category,\n type: toType,\n id: newId,\n threeD,\n ...(rule?.build.defaultState || {})\n }\n}\n\n// ── Backward-compat alias — 기존 호출처 호환 ──────────────────────\n\n/**\n * @deprecated Use `convertPlaceholderTo`. Placeholder 한정 — 새 코드는 일반화된 helper.\n */\nexport function convertGenericTo(\n generic: BoardComponent,\n toType: string,\n options: ConvertOptions = {}\n): BoardComponent {\n if (generic.type !== GENERIC_OBJECT_TYPE) {\n throw new Error(`Source component is not Placeholder (type=${generic.type})`)\n }\n return convertPlaceholderTo(generic, toType, options)\n}\n"]}