@combos-fun/plugin-renderer-3d-text 0.1.16 → 0.1.17

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/README.md CHANGED
@@ -58,10 +58,13 @@ translations; later `requestI18n` calls only send templates still missing
58
58
  from that catalog.
59
59
  If the host returns `needed: true` but a template is missing from
60
60
  `translations`, the system sends only the still-untranslated texts and waits
61
- for one more `requestI18n` before showing that label. Returning to copy that is already in
62
- `translations` does not call `requestI18n` again. Translation is applied only when
63
- the result is `needed: true`. Without the injected SDK, the game stays on
64
- the source text.
61
+ for one more `requestI18n` before showing that label. After `ready`, the next
62
+ render of a template that still has no translation requests it again. The same
63
+ visible label does not request every frame; hiding it and showing it does.
64
+ Returning to copy that is already in `translations` does not call `requestI18n`
65
+ again. `needed: false` keeps source text and does not cancel later requests
66
+ after `needed: true`. Translation is applied only when the result is
67
+ `needed: true`. Without the injected SDK, the game stays on the source text.
65
68
 
66
69
  ## License
67
70
 
package/agent-skill.md CHANGED
@@ -23,7 +23,7 @@ No scale fields; size is `fontSize`. Glyph layout is async. `maxWidth: 0` and `f
23
23
 
24
24
  **MUST** `new Text3DSystem({ sourceLocale, sourceTexts })`. `sourceLocale` is the written language (`en`, `zh-CN`, `ja-JP`), not the device locale. `sourceTexts` lists every template. `declareSourceTexts([...])` during `onSystemsBootstrapComplete` also works. Omitting `sourceLocale` disables host i18n.
25
25
 
26
- `text` is the translation key. Values go in `replacements`. `requestI18n` runs in `beforeReady` and holds `ready` when `window.combos.requestI18n` exists. Labels stay empty until that reply. Apply only when `needed: true`. A missing template is requested once more; after `ready` it stays empty until that reply. One session catalog: new labels are added, earlier screens are looked up, and already translated templates are not sent again. `needed: false` keeps source text. Do not post `i18n-ready` / `set-i18n`. With no `sourceLocale` or `requestI18n`, replacements still run and source text stays.
26
+ `text` is the translation key. Values go in `replacements`. `requestI18n` runs in `beforeReady` and holds `ready` when `window.combos.requestI18n` exists. Labels stay empty until that reply. Apply only when `needed: true`. A missing template is requested once more before `ready`. After that, a later render of a template that still has no translation requests it again; the same visible label does not request every frame, and hiding it then showing it does. A `needed: false` reply keeps source text and does not cancel later requests after `needed: true`. One session catalog: new labels are added, earlier screens are looked up, and already translated templates are not sent again. Do not post `i18n-ready` / `set-i18n`. With no `sourceLocale` or `requestI18n`, replacements still run and source text stays.
27
27
 
28
28
  ```ts
29
29
  sign.addComponent(new Text3D({
@@ -239,6 +239,20 @@ function hasMissingSourceTranslations(sourceTexts, translations) {
239
239
  function sourceTextsSignature(sourceTexts) {
240
240
  return [...sourceTexts].sort().join('\0');
241
241
  }
242
+ /** A later `needed: false` must not turn off a session that already needs translation. */
243
+ function retainI18nNeeded(i18nNeeded, resultNeeded) {
244
+ return i18nNeeded || resultNeeded;
245
+ }
246
+ /**
247
+ * Missing templates to ask for on a later render.
248
+ * Templates rendered since the last retry stay out, so a visible label does not
249
+ * request again every frame. Hiding that label arms it again.
250
+ */
251
+ function textsToRetryOnNextRender(requested, translations, i18nNeeded, renderedSinceRetry) {
252
+ if (!i18nNeeded)
253
+ return [];
254
+ return untranslatedSourceTexts(requested, translations).filter((text) => !renderedSinceRetry.has(text.trim()));
255
+ }
242
256
  /** After the first host reply, only request again for templates still missing. */
243
257
  function shouldRequestI18nForSourceTexts(sourceTexts, translations, state) {
244
258
  if (!state.i18nNeeded)
@@ -246,6 +260,8 @@ function shouldRequestI18nForSourceTexts(sourceTexts, translations, state) {
246
260
  const missing = untranslatedSourceTexts(sourceTexts, translations);
247
261
  if (missing.length === 0)
248
262
  return false;
263
+ if (state.renderAgain)
264
+ return true;
249
265
  return sourceTextsSignature(missing) !== state.lastRequestedSourceTexts;
250
266
  }
251
267
  function shouldHoldForMissingTranslation(sourceText, translations, state) {
@@ -307,10 +323,16 @@ let Text3DSystem = class Text3DSystem extends pluginRenderer3d.Renderer3D {
307
323
  this.knownSourceTexts = new Set();
308
324
  this.lastRequestedSourceTexts = '';
309
325
  this.i18nRequestScheduled = false;
326
+ this.renderDrivenRequest = false;
327
+ this.i18nRequestInFlight = false;
310
328
  this.i18nRequestId = 0;
311
329
  this.firstI18nSettled = false;
312
330
  this.i18nNeeded = false;
313
331
  this.resolvedSourceTexts = new Set();
332
+ /** Missing templates to send the next time they are rendered. */
333
+ this.retryOnNextRender = new Set();
334
+ /** Templates already retried during this time on screen. */
335
+ this.renderedSinceRetry = new Set();
314
336
  }
315
337
  static { this.systemName = 'Text3DSystem'; }
316
338
  init(params) {
@@ -370,6 +392,7 @@ let Text3DSystem = class Text3DSystem extends pluginRenderer3d.Renderer3D {
370
392
  const entry = this.texts.get(gameObject.id);
371
393
  if (!entry)
372
394
  return;
395
+ this.noteTextRender(component.text, isObjectRendered(entry.mesh));
373
396
  this.applyPose(gameObject, component, entry.mesh);
374
397
  }
375
398
  handleAdd(gameObject, component) {
@@ -437,7 +460,10 @@ let Text3DSystem = class Text3DSystem extends pluginRenderer3d.Renderer3D {
437
460
  this.i18nRequestId += 1;
438
461
  this.firstI18nSettled = false;
439
462
  this.i18nNeeded = false;
463
+ this.i18nRequestInFlight = false;
440
464
  this.resolvedSourceTexts.clear();
465
+ this.retryOnNextRender.clear();
466
+ this.renderedSinceRetry.clear();
441
467
  for (const [id] of this.texts) {
442
468
  this.handleRemove(id);
443
469
  }
@@ -464,7 +490,34 @@ let Text3DSystem = class Text3DSystem extends pluginRenderer3d.Renderer3D {
464
490
  }
465
491
  return [...this.knownSourceTexts];
466
492
  }
467
- scheduleI18nRequest() {
493
+ noteTextRender(sourceText, rendered) {
494
+ const source = sourceText.trim();
495
+ if (!source || !this.firstI18nSettled || !this.i18nNeeded)
496
+ return;
497
+ if (!rendered) {
498
+ if (this.renderedSinceRetry.delete(source) &&
499
+ !hasSourceTranslation(sourceText, this.translations)) {
500
+ this.retryOnNextRender.add(source);
501
+ }
502
+ return;
503
+ }
504
+ if (hasSourceTranslation(sourceText, this.translations)) {
505
+ this.retryOnNextRender.delete(source);
506
+ this.renderedSinceRetry.delete(source);
507
+ return;
508
+ }
509
+ if (this.i18nRequestInFlight ||
510
+ this.renderedSinceRetry.has(source) ||
511
+ !this.retryOnNextRender.has(source)) {
512
+ return;
513
+ }
514
+ this.renderedSinceRetry.add(source);
515
+ this.retryOnNextRender.delete(source);
516
+ this.scheduleI18nRequest({ onRender: true });
517
+ }
518
+ scheduleI18nRequest(options) {
519
+ if (options?.onRender)
520
+ this.renderDrivenRequest = true;
468
521
  if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestScheduled)
469
522
  return;
470
523
  this.i18nRequestScheduled = true;
@@ -474,12 +527,15 @@ let Text3DSystem = class Text3DSystem extends pluginRenderer3d.Renderer3D {
474
527
  });
475
528
  }
476
529
  startI18nRequest() {
477
- if (!this.sourceLocale || !this.firstI18nSettled)
530
+ if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestInFlight)
478
531
  return;
532
+ const onRender = this.renderDrivenRequest;
533
+ this.renderDrivenRequest = false;
479
534
  const sourceTexts = this.collectSourceTexts();
480
535
  if (!shouldRequestI18nForSourceTexts(sourceTexts, this.translations, {
481
536
  i18nNeeded: this.i18nNeeded,
482
537
  lastRequestedSourceTexts: this.lastRequestedSourceTexts,
538
+ renderAgain: onRender,
483
539
  })) {
484
540
  return;
485
541
  }
@@ -491,19 +547,30 @@ let Text3DSystem = class Text3DSystem extends pluginRenderer3d.Renderer3D {
491
547
  return;
492
548
  this.lastRequestedSourceTexts = sourceTextsSignature(sourceTexts);
493
549
  const requestId = ++this.i18nRequestId;
494
- const result = await requestHostI18n({
495
- sourceLocale: this.sourceLocale,
496
- sourceTexts,
497
- });
498
- if (requestId !== this.i18nRequestId)
499
- return;
500
- addSourceTexts(this.resolvedSourceTexts, sourceTexts);
501
- this.i18nNeeded = result.needed;
502
- if (!result.needed) {
503
- this.refreshAllText();
504
- return;
550
+ this.i18nRequestInFlight = true;
551
+ try {
552
+ const result = await requestHostI18n({
553
+ sourceLocale: this.sourceLocale,
554
+ sourceTexts,
555
+ });
556
+ if (requestId !== this.i18nRequestId)
557
+ return;
558
+ addSourceTexts(this.resolvedSourceTexts, sourceTexts);
559
+ this.i18nNeeded = retainI18nNeeded(this.i18nNeeded, result.needed);
560
+ if (!result.needed) {
561
+ this.refreshAllText();
562
+ }
563
+ else {
564
+ this.setI18n(result.locale, result.translations);
565
+ }
566
+ for (const text of textsToRetryOnNextRender(sourceTexts, this.translations, this.i18nNeeded, this.renderedSinceRetry)) {
567
+ this.retryOnNextRender.add(text);
568
+ }
569
+ }
570
+ finally {
571
+ if (requestId === this.i18nRequestId)
572
+ this.i18nRequestInFlight = false;
505
573
  }
506
- this.setI18n(result.locale, result.translations);
507
574
  }
508
575
  refreshAllText() {
509
576
  for (const entry of this.texts.values()) {
@@ -524,6 +591,22 @@ Text3DSystem = tslib.__decorate([
524
591
  })
525
592
  ], Text3DSystem);
526
593
  var Text3DSystem_default = Text3DSystem;
594
+ function isObjectRendered(object) {
595
+ const seen = new Set();
596
+ let current = object;
597
+ while (current) {
598
+ if (!current.visible)
599
+ return false;
600
+ if (seen.has(current))
601
+ return true;
602
+ seen.add(current);
603
+ const parent = current.parent;
604
+ if (!parent || typeof parent !== 'object' || !('visible' in parent))
605
+ return true;
606
+ current = parent;
607
+ }
608
+ return true;
609
+ }
527
610
 
528
611
  exports.COMBOS_HOST_SDK = COMBOS_HOST_SDK;
529
612
  exports.Text3D = Text3D;
@@ -538,8 +621,10 @@ exports.localizeText = localizeText;
538
621
  exports.mergeTranslations = mergeTranslations;
539
622
  exports.parseI18nResult = parseI18nResult;
540
623
  exports.requestHostI18n = requestHostI18n;
624
+ exports.retainI18nNeeded = retainI18nNeeded;
541
625
  exports.shouldHoldForMissingTranslation = shouldHoldForMissingTranslation;
542
626
  exports.shouldRequestI18nForSourceTexts = shouldRequestI18nForSourceTexts;
543
627
  exports.sourceTextsSignature = sourceTextsSignature;
628
+ exports.textsToRetryOnNextRender = textsToRetryOnNextRender;
544
629
  exports.untranslatedSourceTexts = untranslatedSourceTexts;
545
630
  //# sourceMappingURL=plugin-renderer-3d-text.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-renderer-3d-text.cjs.js","sources":["../lib/component.ts","../lib/hostSdk.ts","../lib/localization.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\nimport type { TextReplacements } from './localization';\n\nexport type { TextReplacementValue, TextReplacements } from './localization';\n\nexport interface Text3DParams {\n text?: string;\n /** Values substituted into named placeholders such as `{score}`. */\n replacements?: TextReplacements;\n fontSize?: number;\n color?: number;\n anchorX?: string;\n anchorY?: string;\n maxWidth?: number;\n font?: string;\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n}\n\nexport default class Text3D extends Component<Text3DParams> {\n static componentName: string = 'Text3D';\n\n @Field({\n\n type: 'string',\n\n group: 'Text3D',\n\n label: 'text',\n\n description: 'Visible text content.',\n\n editor: 'text',\n\n })\n\n text: string = '';\n\n replacements: TextReplacements = {};\n\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'fontSize',\n description: 'Font size.',\n editor: 'number-stepper',\n })\n fontSize: number = 0.5;\n @Field({\n type: 'number',\n group: 'Text3D',\n label: 'color',\n description: 'Color value.',\n editor: 'number-stepper',\n })\n color: number = 0xffffff;\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'anchorX',\n description: 'Horizontal text anchor.',\n editor: 'text',\n })\n anchorX: string = 'center';\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'anchorY',\n description: 'Vertical text anchor.',\n editor: 'text',\n })\n anchorY: string = 'middle';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'maxWidth',\n description: 'Maximum text wrap width.',\n editor: 'number-stepper',\n })\n maxWidth: number = 0;\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'font',\n description: 'Font URL or path for troika-three-text (not an engine resource name).',\n editor: 'text',\n })\n font: string = '';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionX',\n description: 'Local X position.',\n editor: 'number-stepper',\n })\n positionX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionY',\n description: 'Local Y position.',\n editor: 'number-stepper',\n })\n positionY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionZ',\n description: 'Local Z position.',\n editor: 'number-stepper',\n })\n positionZ: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationX',\n description: 'Rotation around X in radians.',\n editor: 'number-stepper',\n })\n rotationX: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationY',\n description: 'Rotation around Y in radians.',\n editor: 'number-stepper',\n })\n rotationY: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationZ',\n description: 'Rotation around Z in radians.',\n editor: 'number-stepper',\n })\n rotationZ: number = 0;\n\n init(obj?: Text3DParams) {\n if (!obj) return;\n const { replacements, ...rest } = obj;\n Object.assign(this, rest);\n if (replacements) this.replacements = { ...replacements };\n }\n}\n","/** Keep identical to `@combos-fun/plugin-renderer-text` hostSdk. */\nimport type { TextTranslations } from './localization';\n\n/** Host-injected global. The SDK itself is not part of this repo. */\nexport const COMBOS_HOST_SDK = 'combos' as const;\n\nexport interface CombosI18nRequest {\n sourceLocale: string;\n sourceTexts: string[];\n}\n\nexport type CombosI18nResult =\n | { needed: false }\n | { needed: true; locale: string; translations: TextTranslations };\n\nexport interface CombosHostSdk {\n requestI18n?(request: CombosI18nRequest): Promise<CombosI18nResult>;\n}\n\ndeclare global {\n interface Window {\n combos?: CombosHostSdk;\n }\n}\n\nexport function hasCombosRequestI18n(\n sdk: CombosHostSdk | undefined | null = typeof window === 'undefined' ? undefined : window.combos,\n): sdk is CombosHostSdk & { requestI18n: NonNullable<CombosHostSdk['requestI18n']> } {\n return !!sdk && typeof sdk.requestI18n === 'function';\n}\n\nexport function parseI18nResult(data: unknown): CombosI18nResult {\n if (!data || typeof data !== 'object') return { needed: false };\n const input = data as {\n needed?: unknown;\n locale?: unknown;\n translations?: unknown;\n };\n if (input.needed !== true) return { needed: false };\n if (typeof input.locale !== 'string' || !input.locale.trim()) {\n return { needed: false };\n }\n if (\n !input.translations ||\n typeof input.translations !== 'object' ||\n Array.isArray(input.translations)\n ) {\n return { needed: false };\n }\n const entries = Object.entries(input.translations);\n if (entries.some(([, value]) => typeof value !== 'string')) {\n return { needed: false };\n }\n return {\n needed: true,\n locale: input.locale.trim(),\n translations: Object.fromEntries(entries) as TextTranslations,\n };\n}\n\n/** Ask the injected host SDK. Always resolves; missing method means no translation. */\nexport async function requestHostI18n(\n request: CombosI18nRequest,\n): Promise<CombosI18nResult> {\n if (typeof window === 'undefined' || !hasCombosRequestI18n(window.combos)) {\n return { needed: false };\n }\n try {\n return parseI18nResult(await window.combos.requestI18n(request));\n } catch {\n return { needed: false };\n }\n}\n","/** Keep identical to `@combos-fun/plugin-renderer-text` localization. */\n\nexport type TextReplacementValue = string | number;\nexport type TextReplacements = Record<string, TextReplacementValue>;\nexport type TextTranslations = Record<string, string>;\n\nconst PLACEHOLDER_PATTERN = /\\{([A-Za-z_$][\\w$.-]*)\\}/g;\n\nexport function interpolateText(\n template: string,\n replacements?: TextReplacements,\n): string {\n if (!replacements) return template;\n return template.replace(PLACEHOLDER_PATTERN, (placeholder, name: string) => {\n if (!Object.prototype.hasOwnProperty.call(replacements, name)) {\n return placeholder;\n }\n return String(replacements[name]);\n });\n}\n\nexport function findTranslatedTemplate(\n sourceText: string,\n translations: TextTranslations,\n): string | undefined {\n if (Object.prototype.hasOwnProperty.call(translations, sourceText)) {\n return translations[sourceText];\n }\n const trimmed = sourceText.trim();\n if (\n trimmed &&\n trimmed !== sourceText &&\n Object.prototype.hasOwnProperty.call(translations, trimmed)\n ) {\n return translations[trimmed];\n }\n return undefined;\n}\n\nexport function hasSourceTranslation(\n sourceText: string,\n translations: TextTranslations,\n): boolean {\n return findTranslatedTemplate(sourceText, translations) !== undefined;\n}\n\n/** Templates that still have no translation; later `requestI18n` sends only these. */\nexport function untranslatedSourceTexts(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n): string[] {\n return sourceTexts.filter((text) => !hasSourceTranslation(text, translations));\n}\n\nexport function hasMissingSourceTranslations(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n): boolean {\n return untranslatedSourceTexts(sourceTexts, translations).length > 0;\n}\n\nexport function sourceTextsSignature(sourceTexts: readonly string[]): string {\n return [...sourceTexts].sort().join('\\0');\n}\n\n/** After the first host reply, only request again for templates still missing. */\nexport function shouldRequestI18nForSourceTexts(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n state: {\n i18nNeeded: boolean;\n lastRequestedSourceTexts: string;\n },\n): boolean {\n if (!state.i18nNeeded) return false;\n const missing = untranslatedSourceTexts(sourceTexts, translations);\n if (missing.length === 0) return false;\n return sourceTextsSignature(missing) !== state.lastRequestedSourceTexts;\n}\n\nexport function shouldHoldForMissingTranslation(\n sourceText: string,\n translations: TextTranslations,\n state: {\n sourceLocale: string;\n targetLocale: string;\n i18nNeeded: boolean;\n firstI18nSettled: boolean;\n resolvedSourceTexts: ReadonlySet<string>;\n },\n): boolean {\n if (!state.sourceLocale) return false;\n const trimmed = sourceText.trim();\n if (!trimmed) return false;\n if (hasSourceTranslation(sourceText, translations)) return false;\n // Flush mounts Text before the first requestI18n. targetLocale still equals\n // sourceLocale and i18nNeeded is still false, so holding only after settle\n // would paint the source copy, then swap it when the host replies.\n if (!state.firstI18nSettled) return true;\n if (!state.i18nNeeded) return false;\n if (state.sourceLocale.toLowerCase() === state.targetLocale.toLowerCase()) return false;\n return !state.resolvedSourceTexts.has(trimmed);\n}\n\nexport function localizeText(\n sourceText: string,\n replacements: TextReplacements | undefined,\n sourceLocale: string,\n targetLocale: string,\n translations: TextTranslations,\n): string {\n const shouldTranslate =\n !!sourceLocale &&\n !!targetLocale &&\n sourceLocale.toLowerCase() !== targetLocale.toLowerCase();\n const template = shouldTranslate\n ? findTranslatedTemplate(sourceText, translations) ?? sourceText\n : sourceText;\n return interpolateText(template, replacements);\n}\n\nexport function addSourceTexts(\n target: Set<string>,\n texts?: Iterable<string | undefined | null>,\n) {\n if (!texts) return;\n for (const text of texts) {\n const source = typeof text === 'string' ? text.trim() : '';\n if (source) target.add(source);\n }\n}\n\nexport function mergeTranslations(\n current: TextTranslations,\n incoming: Record<string, unknown>,\n): TextTranslations {\n const next = { ...current };\n for (const [key, value] of Object.entries(incoming)) {\n if (typeof value === 'string') next[key] = value;\n }\n return next;\n}\n","import { decorators, ComponentChanged, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport { Renderer3D, Renderer3DSystem, tagObject3D, Transform3D, VisualPoseBridge } from '@combos-fun/plugin-renderer-3d';\nimport { Text as TroikaText } from 'troika-three-text';\nimport Text3D from './component';\nimport { requestHostI18n } from './hostSdk';\nimport {\n addSourceTexts,\n hasMissingSourceTranslations,\n localizeText,\n mergeTranslations,\n shouldHoldForMissingTranslation,\n shouldRequestI18nForSourceTexts,\n sourceTextsSignature,\n untranslatedSourceTexts,\n type TextTranslations,\n} from './localization';\n\nexport interface Text3DSystemParams {\n /** BCP 47 locale of the source text, for example `zh-CN`. Omit to disable host-driven i18n. */\n sourceLocale?: string;\n /**\n * All source templates to translate on first `requestI18n`, including copy\n * for screens that are not mounted yet. The system also keeps a growing\n * session catalog of every later template it sees.\n */\n sourceTexts?: string[];\n}\n\n@decorators.componentObserver({\n Text3D: [\n 'text',\n { prop: ['replacements'], deep: true },\n 'fontSize', 'color', 'anchorX', 'anchorY', 'maxWidth', 'font',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n ],\n})\nexport default class Text3DSystem extends Renderer3D<Text3DSystemParams> {\n static systemName = 'Text3DSystem';\n name: string = 'Text3DSystem';\n\n private texts = new Map<number, { mesh: TroikaText; component: Text3D }>();\n private poseBridges = new Map<number, VisualPoseBridge>();\n private sourceLocale = '';\n private targetLocale = '';\n private translations: TextTranslations = {};\n /** Growing catalog of every source template seen this session. */\n private knownSourceTexts = new Set<string>();\n private lastRequestedSourceTexts = '';\n private i18nRequestScheduled = false;\n private i18nRequestId = 0;\n private firstI18nSettled = false;\n private i18nNeeded = false;\n private resolvedSourceTexts = new Set<string>();\n\n init(params?: Text3DSystemParams) {\n const renderer3DSystem = this.game.getSystem(Renderer3DSystem) as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n this.sourceLocale = params?.sourceLocale?.trim() ?? '';\n this.targetLocale = this.sourceLocale;\n this.declareSourceTexts(params?.sourceTexts);\n }\n\n /** Register extra source templates before or after ready. First request includes these. */\n declareSourceTexts(texts?: string[]) {\n this.rememberSourceTexts(texts);\n this.scheduleI18nRequest();\n }\n\n async beforeReady() {\n if (this.firstI18nSettled) return;\n this.update();\n if (!this.sourceLocale) {\n this.firstI18nSettled = true;\n return;\n }\n await this.requestI18nAndApply();\n if (\n this.i18nNeeded &&\n hasMissingSourceTranslations(this.collectSourceTexts(), this.translations)\n ) {\n await this.requestI18nAndApply();\n }\n this.firstI18nSettled = true;\n // needed:false refresh still ran with firstI18nSettled=false (empty hold).\n this.refreshAllText();\n }\n\n setI18n(locale: string, translations: TextTranslations) {\n const targetLocale = locale?.trim();\n if (!targetLocale || !translations || typeof translations !== 'object') return;\n this.targetLocale = targetLocale;\n this.translations = mergeTranslations(this.translations, translations);\n this.refreshAllText();\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Text3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Text3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.handleRemove(changed.gameObject.id);\n } else {\n this.handleChange(changed);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Text3D) as Text3D;\n if (!component) return;\n\n const entry = this.texts.get(gameObject.id);\n if (!entry) return;\n this.applyPose(gameObject, component, entry.mesh);\n }\n\n private handleAdd(gameObject: GameObject, component: Text3D) {\n const textMesh = new TroikaText();\n this.syncTextProps(textMesh, component);\n textMesh.sync();\n tagObject3D(textMesh, gameObject.id);\n\n this.threeContext.attachVisual(gameObject.id, textMesh, gameObject);\n this.texts.set(gameObject.id, { mesh: textMesh, component });\n this.poseBridges.set(gameObject.id, new VisualPoseBridge());\n this.rememberSourceTexts([component.text]);\n this.scheduleI18nRequest();\n }\n\n private handleChange(changed: ComponentChanged) {\n const entry = this.texts.get(changed.gameObject.id);\n if (!entry) return;\n const component = changed.component as Text3D;\n entry.component = component;\n if (changed.prop.prop[0] === 'text') this.rememberSourceTexts([component.text]);\n this.syncTextProps(entry.mesh, component);\n entry.mesh.sync();\n if (changed.prop.prop[0] === 'text') this.scheduleI18nRequest();\n }\n\n private handleRemove(id: number) {\n const entry = this.texts.get(id);\n if (!entry) return;\n\n this.threeContext.detachVisual(id, entry.mesh);\n entry.mesh.dispose();\n this.texts.delete(id);\n this.poseBridges.delete(id);\n }\n\n private syncTextProps(textMesh: TroikaText, component: Text3D) {\n textMesh.text = this.resolveText(component);\n textMesh.fontSize = component.fontSize;\n textMesh.color = component.color;\n textMesh.anchorX = component.anchorX;\n textMesh.anchorY = component.anchorY;\n if (component.maxWidth > 0) {\n textMesh.maxWidth = component.maxWidth;\n }\n if (component.font) {\n textMesh.font = component.font;\n }\n }\n\n private applyPose(gameObject: GameObject, component: Text3D, textMesh: TroikaText) {\n let bridge = this.poseBridges.get(gameObject.id);\n if (!bridge) {\n bridge = new VisualPoseBridge();\n this.poseBridges.set(gameObject.id, bridge);\n }\n const transform = gameObject.getComponent(Transform3D) as Transform3D | undefined;\n if (!bridge.sync(component, transform)) {\n textMesh.position.set(0, 0, 0);\n textMesh.rotation.set(0, 0, 0);\n return;\n }\n textMesh.position.set(component.positionX, component.positionY, component.positionZ);\n textMesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n }\n\n onDestroy() {\n this.i18nRequestId += 1;\n this.firstI18nSettled = false;\n this.i18nNeeded = false;\n this.resolvedSourceTexts.clear();\n for (const [id] of this.texts) {\n this.handleRemove(id);\n }\n this.texts.clear();\n }\n\n private resolveText(component: Text3D): string {\n if (\n shouldHoldForMissingTranslation(component.text, this.translations, {\n sourceLocale: this.sourceLocale,\n targetLocale: this.targetLocale,\n i18nNeeded: this.i18nNeeded,\n firstI18nSettled: this.firstI18nSettled,\n resolvedSourceTexts: this.resolvedSourceTexts,\n })\n ) {\n return '';\n }\n return localizeText(\n component.text,\n component.replacements,\n this.sourceLocale,\n this.targetLocale,\n this.translations,\n );\n }\n\n private rememberSourceTexts(texts?: Iterable<string | undefined | null>) {\n addSourceTexts(this.knownSourceTexts, texts);\n }\n\n private collectSourceTexts(): string[] {\n for (const entry of this.texts.values()) {\n this.rememberSourceTexts([entry.component.text]);\n }\n return [...this.knownSourceTexts];\n }\n\n private scheduleI18nRequest() {\n if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestScheduled) return;\n this.i18nRequestScheduled = true;\n queueMicrotask(() => {\n this.i18nRequestScheduled = false;\n this.startI18nRequest();\n });\n }\n\n private startI18nRequest() {\n if (!this.sourceLocale || !this.firstI18nSettled) return;\n const sourceTexts = this.collectSourceTexts();\n if (\n !shouldRequestI18nForSourceTexts(sourceTexts, this.translations, {\n i18nNeeded: this.i18nNeeded,\n lastRequestedSourceTexts: this.lastRequestedSourceTexts,\n })\n ) {\n return;\n }\n void this.requestI18nAndApply();\n }\n\n private async requestI18nAndApply() {\n const sourceTexts = untranslatedSourceTexts(\n this.collectSourceTexts(),\n this.translations,\n );\n if (sourceTexts.length === 0) return;\n this.lastRequestedSourceTexts = sourceTextsSignature(sourceTexts);\n const requestId = ++this.i18nRequestId;\n const result = await requestHostI18n({\n sourceLocale: this.sourceLocale,\n sourceTexts,\n });\n if (requestId !== this.i18nRequestId) return;\n addSourceTexts(this.resolvedSourceTexts, sourceTexts);\n this.i18nNeeded = result.needed;\n if (!result.needed) {\n this.refreshAllText();\n return;\n }\n this.setI18n(result.locale, result.translations);\n }\n\n private refreshAllText() {\n for (const entry of this.texts.values()) {\n entry.mesh.text = this.resolveText(entry.component);\n entry.mesh.sync();\n }\n }\n}\n"],"names":["Component","__decorate","Field","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","TroikaText","tagObject3D","VisualPoseBridge","Transform3D","decorators"],"mappings":";;;;;;;;AAwBc,MAAO,MAAO,SAAQA,gBAAuB,CAAA;AAA3D,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,IAAI,GAAW,EAAE;QAEjB,IAAA,CAAA,YAAY,GAAqB,EAAE;QAUnC,IAAA,CAAA,QAAQ,GAAW,GAAG;QAQtB,IAAA,CAAA,KAAK,GAAW,QAAQ;QAQxB,IAAA,CAAA,OAAO,GAAW,QAAQ;QAQ1B,IAAA,CAAA,OAAO,GAAW,QAAQ;QAS1B,IAAA,CAAA,QAAQ,GAAW,CAAC;QAQpB,IAAA,CAAA,IAAI,GAAW,EAAE;QASjB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;IAQvB;aAnIS,IAAA,CAAA,aAAa,GAAW,QAAX,CAAoB;AA6HxC,IAAA,IAAI,CAAC,GAAkB,EAAA;AACrB,QAAA,IAAI,CAAC,GAAG;YAAE;QACV,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG;AACrC,QAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC;AACzB,QAAA,IAAI,YAAY;AAAE,YAAA,IAAI,CAAC,YAAY,GAAG,EAAE,GAAG,YAAY,EAAE;IAC3D;;AAlHAC,gBAAA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CAAC;AACF,QAAA,IAAI,SAAS,KAAK,IAAI,CAAC,aAAa;YAAE;AACtC,QAAA,cAAc,CAAC,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC;AACrD,QAAA,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM;AAC/B,QAAA,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,IAAI,CAAC,cAAc,EAAE;YACrB;QACF;QACA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC;IAClD;IAEQ,cAAc,GAAA;QACpB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE;AACvC,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;AACnD,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE;QACnB;IACF;;AA7OmB,YAAY,GAAAR,gBAAA,CAAA;IAThCS,iBAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,MAAM,EAAE;YACN,MAAM;YACN,EAAE,IAAI,EAAE,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;YACtC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM;YAC7D,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACtC,SAAA;KACF;AACoB,CAAA,EAAA,YAAY,CA8OhC;2BA9OoB,YAAY;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin-renderer-3d-text.cjs.js","sources":["../lib/component.ts","../lib/hostSdk.ts","../lib/localization.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\nimport type { TextReplacements } from './localization';\n\nexport type { TextReplacementValue, TextReplacements } from './localization';\n\nexport interface Text3DParams {\n text?: string;\n /** Values substituted into named placeholders such as `{score}`. */\n replacements?: TextReplacements;\n fontSize?: number;\n color?: number;\n anchorX?: string;\n anchorY?: string;\n maxWidth?: number;\n font?: string;\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n}\n\nexport default class Text3D extends Component<Text3DParams> {\n static componentName: string = 'Text3D';\n\n @Field({\n\n type: 'string',\n\n group: 'Text3D',\n\n label: 'text',\n\n description: 'Visible text content.',\n\n editor: 'text',\n\n })\n\n text: string = '';\n\n replacements: TextReplacements = {};\n\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'fontSize',\n description: 'Font size.',\n editor: 'number-stepper',\n })\n fontSize: number = 0.5;\n @Field({\n type: 'number',\n group: 'Text3D',\n label: 'color',\n description: 'Color value.',\n editor: 'number-stepper',\n })\n color: number = 0xffffff;\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'anchorX',\n description: 'Horizontal text anchor.',\n editor: 'text',\n })\n anchorX: string = 'center';\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'anchorY',\n description: 'Vertical text anchor.',\n editor: 'text',\n })\n anchorY: string = 'middle';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'maxWidth',\n description: 'Maximum text wrap width.',\n editor: 'number-stepper',\n })\n maxWidth: number = 0;\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'font',\n description: 'Font URL or path for troika-three-text (not an engine resource name).',\n editor: 'text',\n })\n font: string = '';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionX',\n description: 'Local X position.',\n editor: 'number-stepper',\n })\n positionX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionY',\n description: 'Local Y position.',\n editor: 'number-stepper',\n })\n positionY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionZ',\n description: 'Local Z position.',\n editor: 'number-stepper',\n })\n positionZ: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationX',\n description: 'Rotation around X in radians.',\n editor: 'number-stepper',\n })\n rotationX: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationY',\n description: 'Rotation around Y in radians.',\n editor: 'number-stepper',\n })\n rotationY: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationZ',\n description: 'Rotation around Z in radians.',\n editor: 'number-stepper',\n })\n rotationZ: number = 0;\n\n init(obj?: Text3DParams) {\n if (!obj) return;\n const { replacements, ...rest } = obj;\n Object.assign(this, rest);\n if (replacements) this.replacements = { ...replacements };\n }\n}\n","/** Keep identical to `@combos-fun/plugin-renderer-text` hostSdk. */\nimport type { TextTranslations } from './localization';\n\n/** Host-injected global. The SDK itself is not part of this repo. */\nexport const COMBOS_HOST_SDK = 'combos' as const;\n\nexport interface CombosI18nRequest {\n sourceLocale: string;\n sourceTexts: string[];\n}\n\nexport type CombosI18nResult =\n | { needed: false }\n | { needed: true; locale: string; translations: TextTranslations };\n\nexport interface CombosHostSdk {\n requestI18n?(request: CombosI18nRequest): Promise<CombosI18nResult>;\n}\n\ndeclare global {\n interface Window {\n combos?: CombosHostSdk;\n }\n}\n\nexport function hasCombosRequestI18n(\n sdk: CombosHostSdk | undefined | null = typeof window === 'undefined' ? undefined : window.combos,\n): sdk is CombosHostSdk & { requestI18n: NonNullable<CombosHostSdk['requestI18n']> } {\n return !!sdk && typeof sdk.requestI18n === 'function';\n}\n\nexport function parseI18nResult(data: unknown): CombosI18nResult {\n if (!data || typeof data !== 'object') return { needed: false };\n const input = data as {\n needed?: unknown;\n locale?: unknown;\n translations?: unknown;\n };\n if (input.needed !== true) return { needed: false };\n if (typeof input.locale !== 'string' || !input.locale.trim()) {\n return { needed: false };\n }\n if (\n !input.translations ||\n typeof input.translations !== 'object' ||\n Array.isArray(input.translations)\n ) {\n return { needed: false };\n }\n const entries = Object.entries(input.translations);\n if (entries.some(([, value]) => typeof value !== 'string')) {\n return { needed: false };\n }\n return {\n needed: true,\n locale: input.locale.trim(),\n translations: Object.fromEntries(entries) as TextTranslations,\n };\n}\n\n/** Ask the injected host SDK. Always resolves; missing method means no translation. */\nexport async function requestHostI18n(\n request: CombosI18nRequest,\n): Promise<CombosI18nResult> {\n if (typeof window === 'undefined' || !hasCombosRequestI18n(window.combos)) {\n return { needed: false };\n }\n try {\n return parseI18nResult(await window.combos.requestI18n(request));\n } catch {\n return { needed: false };\n }\n}\n","/** Keep identical to `@combos-fun/plugin-renderer-text` localization. */\n\nexport type TextReplacementValue = string | number;\nexport type TextReplacements = Record<string, TextReplacementValue>;\nexport type TextTranslations = Record<string, string>;\n\nconst PLACEHOLDER_PATTERN = /\\{([A-Za-z_$][\\w$.-]*)\\}/g;\n\nexport function interpolateText(\n template: string,\n replacements?: TextReplacements,\n): string {\n if (!replacements) return template;\n return template.replace(PLACEHOLDER_PATTERN, (placeholder, name: string) => {\n if (!Object.prototype.hasOwnProperty.call(replacements, name)) {\n return placeholder;\n }\n return String(replacements[name]);\n });\n}\n\nexport function findTranslatedTemplate(\n sourceText: string,\n translations: TextTranslations,\n): string | undefined {\n if (Object.prototype.hasOwnProperty.call(translations, sourceText)) {\n return translations[sourceText];\n }\n const trimmed = sourceText.trim();\n if (\n trimmed &&\n trimmed !== sourceText &&\n Object.prototype.hasOwnProperty.call(translations, trimmed)\n ) {\n return translations[trimmed];\n }\n return undefined;\n}\n\nexport function hasSourceTranslation(\n sourceText: string,\n translations: TextTranslations,\n): boolean {\n return findTranslatedTemplate(sourceText, translations) !== undefined;\n}\n\n/** Templates that still have no translation; later `requestI18n` sends only these. */\nexport function untranslatedSourceTexts(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n): string[] {\n return sourceTexts.filter((text) => !hasSourceTranslation(text, translations));\n}\n\nexport function hasMissingSourceTranslations(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n): boolean {\n return untranslatedSourceTexts(sourceTexts, translations).length > 0;\n}\n\nexport function sourceTextsSignature(sourceTexts: readonly string[]): string {\n return [...sourceTexts].sort().join('\\0');\n}\n\n/** A later `needed: false` must not turn off a session that already needs translation. */\nexport function retainI18nNeeded(i18nNeeded: boolean, resultNeeded: boolean): boolean {\n return i18nNeeded || resultNeeded;\n}\n\n/**\n * Missing templates to ask for on a later render.\n * Templates rendered since the last retry stay out, so a visible label does not\n * request again every frame. Hiding that label arms it again.\n */\nexport function textsToRetryOnNextRender(\n requested: readonly string[],\n translations: TextTranslations,\n i18nNeeded: boolean,\n renderedSinceRetry: ReadonlySet<string>,\n): string[] {\n if (!i18nNeeded) return [];\n return untranslatedSourceTexts(requested, translations).filter(\n (text) => !renderedSinceRetry.has(text.trim()),\n );\n}\n\n/** After the first host reply, only request again for templates still missing. */\nexport function shouldRequestI18nForSourceTexts(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n state: {\n i18nNeeded: boolean;\n lastRequestedSourceTexts: string;\n /** The next render of a template that still has no translation. */\n renderAgain?: boolean;\n },\n): boolean {\n if (!state.i18nNeeded) return false;\n const missing = untranslatedSourceTexts(sourceTexts, translations);\n if (missing.length === 0) return false;\n if (state.renderAgain) return true;\n return sourceTextsSignature(missing) !== state.lastRequestedSourceTexts;\n}\n\nexport function shouldHoldForMissingTranslation(\n sourceText: string,\n translations: TextTranslations,\n state: {\n sourceLocale: string;\n targetLocale: string;\n i18nNeeded: boolean;\n firstI18nSettled: boolean;\n resolvedSourceTexts: ReadonlySet<string>;\n },\n): boolean {\n if (!state.sourceLocale) return false;\n const trimmed = sourceText.trim();\n if (!trimmed) return false;\n if (hasSourceTranslation(sourceText, translations)) return false;\n // Flush mounts Text before the first requestI18n. targetLocale still equals\n // sourceLocale and i18nNeeded is still false, so holding only after settle\n // would paint the source copy, then swap it when the host replies.\n if (!state.firstI18nSettled) return true;\n if (!state.i18nNeeded) return false;\n if (state.sourceLocale.toLowerCase() === state.targetLocale.toLowerCase()) return false;\n return !state.resolvedSourceTexts.has(trimmed);\n}\n\nexport function localizeText(\n sourceText: string,\n replacements: TextReplacements | undefined,\n sourceLocale: string,\n targetLocale: string,\n translations: TextTranslations,\n): string {\n const shouldTranslate =\n !!sourceLocale &&\n !!targetLocale &&\n sourceLocale.toLowerCase() !== targetLocale.toLowerCase();\n const template = shouldTranslate\n ? findTranslatedTemplate(sourceText, translations) ?? sourceText\n : sourceText;\n return interpolateText(template, replacements);\n}\n\nexport function addSourceTexts(\n target: Set<string>,\n texts?: Iterable<string | undefined | null>,\n) {\n if (!texts) return;\n for (const text of texts) {\n const source = typeof text === 'string' ? text.trim() : '';\n if (source) target.add(source);\n }\n}\n\nexport function mergeTranslations(\n current: TextTranslations,\n incoming: Record<string, unknown>,\n): TextTranslations {\n const next = { ...current };\n for (const [key, value] of Object.entries(incoming)) {\n if (typeof value === 'string') next[key] = value;\n }\n return next;\n}\n","import { decorators, ComponentChanged, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport { Renderer3D, Renderer3DSystem, tagObject3D, Transform3D, VisualPoseBridge } from '@combos-fun/plugin-renderer-3d';\nimport { Text as TroikaText } from 'troika-three-text';\nimport Text3D from './component';\nimport { requestHostI18n } from './hostSdk';\nimport {\n addSourceTexts,\n hasMissingSourceTranslations,\n hasSourceTranslation,\n localizeText,\n mergeTranslations,\n retainI18nNeeded,\n shouldHoldForMissingTranslation,\n shouldRequestI18nForSourceTexts,\n sourceTextsSignature,\n textsToRetryOnNextRender,\n untranslatedSourceTexts,\n type TextTranslations,\n} from './localization';\n\nexport interface Text3DSystemParams {\n /** BCP 47 locale of the source text, for example `zh-CN`. Omit to disable host-driven i18n. */\n sourceLocale?: string;\n /**\n * All source templates to translate on first `requestI18n`, including copy\n * for screens that are not mounted yet. The system also keeps a growing\n * session catalog of every later template it sees.\n */\n sourceTexts?: string[];\n}\n\n@decorators.componentObserver({\n Text3D: [\n 'text',\n { prop: ['replacements'], deep: true },\n 'fontSize', 'color', 'anchorX', 'anchorY', 'maxWidth', 'font',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n ],\n})\nexport default class Text3DSystem extends Renderer3D<Text3DSystemParams> {\n static systemName = 'Text3DSystem';\n name: string = 'Text3DSystem';\n\n private texts = new Map<number, { mesh: TroikaText; component: Text3D }>();\n private poseBridges = new Map<number, VisualPoseBridge>();\n private sourceLocale = '';\n private targetLocale = '';\n private translations: TextTranslations = {};\n /** Growing catalog of every source template seen this session. */\n private knownSourceTexts = new Set<string>();\n private lastRequestedSourceTexts = '';\n private i18nRequestScheduled = false;\n private renderDrivenRequest = false;\n private i18nRequestInFlight = false;\n private i18nRequestId = 0;\n private firstI18nSettled = false;\n private i18nNeeded = false;\n private resolvedSourceTexts = new Set<string>();\n /** Missing templates to send the next time they are rendered. */\n private retryOnNextRender = new Set<string>();\n /** Templates already retried during this time on screen. */\n private renderedSinceRetry = new Set<string>();\n\n init(params?: Text3DSystemParams) {\n const renderer3DSystem = this.game.getSystem(Renderer3DSystem) as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n this.sourceLocale = params?.sourceLocale?.trim() ?? '';\n this.targetLocale = this.sourceLocale;\n this.declareSourceTexts(params?.sourceTexts);\n }\n\n /** Register extra source templates before or after ready. First request includes these. */\n declareSourceTexts(texts?: string[]) {\n this.rememberSourceTexts(texts);\n this.scheduleI18nRequest();\n }\n\n async beforeReady() {\n if (this.firstI18nSettled) return;\n this.update();\n if (!this.sourceLocale) {\n this.firstI18nSettled = true;\n return;\n }\n await this.requestI18nAndApply();\n if (\n this.i18nNeeded &&\n hasMissingSourceTranslations(this.collectSourceTexts(), this.translations)\n ) {\n await this.requestI18nAndApply();\n }\n this.firstI18nSettled = true;\n // needed:false refresh still ran with firstI18nSettled=false (empty hold).\n this.refreshAllText();\n }\n\n setI18n(locale: string, translations: TextTranslations) {\n const targetLocale = locale?.trim();\n if (!targetLocale || !translations || typeof translations !== 'object') return;\n this.targetLocale = targetLocale;\n this.translations = mergeTranslations(this.translations, translations);\n this.refreshAllText();\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Text3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Text3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.handleRemove(changed.gameObject.id);\n } else {\n this.handleChange(changed);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Text3D) as Text3D;\n if (!component) return;\n\n const entry = this.texts.get(gameObject.id);\n if (!entry) return;\n this.noteTextRender(component.text, isObjectRendered(entry.mesh));\n this.applyPose(gameObject, component, entry.mesh);\n }\n\n private handleAdd(gameObject: GameObject, component: Text3D) {\n const textMesh = new TroikaText();\n this.syncTextProps(textMesh, component);\n textMesh.sync();\n tagObject3D(textMesh, gameObject.id);\n\n this.threeContext.attachVisual(gameObject.id, textMesh, gameObject);\n this.texts.set(gameObject.id, { mesh: textMesh, component });\n this.poseBridges.set(gameObject.id, new VisualPoseBridge());\n this.rememberSourceTexts([component.text]);\n this.scheduleI18nRequest();\n }\n\n private handleChange(changed: ComponentChanged) {\n const entry = this.texts.get(changed.gameObject.id);\n if (!entry) return;\n const component = changed.component as Text3D;\n entry.component = component;\n if (changed.prop.prop[0] === 'text') this.rememberSourceTexts([component.text]);\n this.syncTextProps(entry.mesh, component);\n entry.mesh.sync();\n if (changed.prop.prop[0] === 'text') this.scheduleI18nRequest();\n }\n\n private handleRemove(id: number) {\n const entry = this.texts.get(id);\n if (!entry) return;\n\n this.threeContext.detachVisual(id, entry.mesh);\n entry.mesh.dispose();\n this.texts.delete(id);\n this.poseBridges.delete(id);\n }\n\n private syncTextProps(textMesh: TroikaText, component: Text3D) {\n textMesh.text = this.resolveText(component);\n textMesh.fontSize = component.fontSize;\n textMesh.color = component.color;\n textMesh.anchorX = component.anchorX;\n textMesh.anchorY = component.anchorY;\n if (component.maxWidth > 0) {\n textMesh.maxWidth = component.maxWidth;\n }\n if (component.font) {\n textMesh.font = component.font;\n }\n }\n\n private applyPose(gameObject: GameObject, component: Text3D, textMesh: TroikaText) {\n let bridge = this.poseBridges.get(gameObject.id);\n if (!bridge) {\n bridge = new VisualPoseBridge();\n this.poseBridges.set(gameObject.id, bridge);\n }\n const transform = gameObject.getComponent(Transform3D) as Transform3D | undefined;\n if (!bridge.sync(component, transform)) {\n textMesh.position.set(0, 0, 0);\n textMesh.rotation.set(0, 0, 0);\n return;\n }\n textMesh.position.set(component.positionX, component.positionY, component.positionZ);\n textMesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n }\n\n onDestroy() {\n this.i18nRequestId += 1;\n this.firstI18nSettled = false;\n this.i18nNeeded = false;\n this.i18nRequestInFlight = false;\n this.resolvedSourceTexts.clear();\n this.retryOnNextRender.clear();\n this.renderedSinceRetry.clear();\n for (const [id] of this.texts) {\n this.handleRemove(id);\n }\n this.texts.clear();\n }\n\n private resolveText(component: Text3D): string {\n if (\n shouldHoldForMissingTranslation(component.text, this.translations, {\n sourceLocale: this.sourceLocale,\n targetLocale: this.targetLocale,\n i18nNeeded: this.i18nNeeded,\n firstI18nSettled: this.firstI18nSettled,\n resolvedSourceTexts: this.resolvedSourceTexts,\n })\n ) {\n return '';\n }\n return localizeText(\n component.text,\n component.replacements,\n this.sourceLocale,\n this.targetLocale,\n this.translations,\n );\n }\n\n private rememberSourceTexts(texts?: Iterable<string | undefined | null>) {\n addSourceTexts(this.knownSourceTexts, texts);\n }\n\n private collectSourceTexts(): string[] {\n for (const entry of this.texts.values()) {\n this.rememberSourceTexts([entry.component.text]);\n }\n return [...this.knownSourceTexts];\n }\n\n private noteTextRender(sourceText: string, rendered: boolean) {\n const source = sourceText.trim();\n if (!source || !this.firstI18nSettled || !this.i18nNeeded) return;\n if (!rendered) {\n if (\n this.renderedSinceRetry.delete(source) &&\n !hasSourceTranslation(sourceText, this.translations)\n ) {\n this.retryOnNextRender.add(source);\n }\n return;\n }\n if (hasSourceTranslation(sourceText, this.translations)) {\n this.retryOnNextRender.delete(source);\n this.renderedSinceRetry.delete(source);\n return;\n }\n if (\n this.i18nRequestInFlight ||\n this.renderedSinceRetry.has(source) ||\n !this.retryOnNextRender.has(source)\n ) {\n return;\n }\n this.renderedSinceRetry.add(source);\n this.retryOnNextRender.delete(source);\n this.scheduleI18nRequest({ onRender: true });\n }\n private scheduleI18nRequest(options?: { onRender?: boolean }) {\n if (options?.onRender) this.renderDrivenRequest = true;\n if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestScheduled) return;\n this.i18nRequestScheduled = true;\n queueMicrotask(() => {\n this.i18nRequestScheduled = false;\n this.startI18nRequest();\n });\n }\n\n private startI18nRequest() {\n if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestInFlight) return;\n const onRender = this.renderDrivenRequest;\n this.renderDrivenRequest = false;\n const sourceTexts = this.collectSourceTexts();\n if (\n !shouldRequestI18nForSourceTexts(sourceTexts, this.translations, {\n i18nNeeded: this.i18nNeeded,\n lastRequestedSourceTexts: this.lastRequestedSourceTexts,\n renderAgain: onRender,\n })\n ) {\n return;\n }\n void this.requestI18nAndApply();\n }\n\n private async requestI18nAndApply() {\n const sourceTexts = untranslatedSourceTexts(\n this.collectSourceTexts(),\n this.translations,\n );\n if (sourceTexts.length === 0) return;\n this.lastRequestedSourceTexts = sourceTextsSignature(sourceTexts);\n const requestId = ++this.i18nRequestId;\n this.i18nRequestInFlight = true;\n try {\n const result = await requestHostI18n({\n sourceLocale: this.sourceLocale,\n sourceTexts,\n });\n if (requestId !== this.i18nRequestId) return;\n addSourceTexts(this.resolvedSourceTexts, sourceTexts);\n this.i18nNeeded = retainI18nNeeded(this.i18nNeeded, result.needed);\n if (!result.needed) {\n this.refreshAllText();\n } else {\n this.setI18n(result.locale, result.translations);\n }\n for (const text of textsToRetryOnNextRender(\n sourceTexts,\n this.translations,\n this.i18nNeeded,\n this.renderedSinceRetry,\n )) {\n this.retryOnNextRender.add(text);\n }\n } finally {\n if (requestId === this.i18nRequestId) this.i18nRequestInFlight = false;\n }\n }\n\n private refreshAllText() {\n for (const entry of this.texts.values()) {\n entry.mesh.text = this.resolveText(entry.component);\n entry.mesh.sync();\n }\n }\n}\n\nfunction isObjectRendered(object: { visible: boolean; parent: unknown }): boolean {\n const seen = new Set<object>();\n let current: { visible: boolean; parent: unknown } | null = object;\n while (current) {\n if (!current.visible) return false;\n if (seen.has(current)) return true;\n seen.add(current);\n const parent = current.parent;\n if (!parent || typeof parent !== 'object' || !('visible' in parent)) return true;\n current = parent as { visible: boolean; parent: unknown };\n }\n return true;\n}\n"],"names":["Component","__decorate","Field","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","TroikaText","tagObject3D","VisualPoseBridge","Transform3D","decorators"],"mappings":";;;;;;;;AAwBc,MAAO,MAAO,SAAQA,gBAAuB,CAAA;AAA3D,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,IAAI,GAAW,EAAE;QAEjB,IAAA,CAAA,YAAY,GAAqB,EAAE;QAUnC,IAAA,CAAA,QAAQ,GAAW,GAAG;QAQtB,IAAA,CAAA,KAAK,GAAW,QAAQ;QAQxB,IAAA,CAAA,OAAO,GAAW,QAAQ;QAQ1B,IAAA,CAAA,OAAO,GAAW,QAAQ;QAS1B,IAAA,CAAA,QAAQ,GAAW,CAAC;QAQpB,IAAA,CAAA,IAAI,GAAW,EAAE;QASjB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;IAQvB;aAnIS,IAAA,CAAA,aAAa,GAAW,QAAX,CAAoB;AA6HxC,IAAA,IAAI,CAAC,GAAkB,EAAA;AACrB,QAAA,IAAI,CAAC,GAAG;YAAE;QACV,MAAM,EAAE,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AE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACtC,SAAA;KACF;AACoB,CAAA,EAAA,YAAY,CAqShC;2BArSoB,YAAY;AAuSjC,SAAS,gBAAgB,CAAC,MAA6C,EAAA;AACrE,IAAA,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU;IAC9B,IAAI,OAAO,GAAiD,MAAM;IAClE,OAAO,OAAO,EAAE;QACd,IAAI,CAAC,OAAO,CAAC,OAAO;AAAE,YAAA,OAAO,KAAK;AAClC,QAAA,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;AAAE,YAAA,OAAO,IAAI;AAClC,QAAA,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;AACjB,QAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM;AAC7B,QAAA,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,EAAE,SAAS,IAAI,MAAM,CAAC;AAAE,YAAA,OAAO,IAAI;QAChF,OAAO,GAAG,MAA+C;IAC3D;AACA,IAAA,OAAO,IAAI;AACb;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- "use strict";var e=require("tslib"),t=require("@combos-fun/engine"),o=require("@combos-fun/inspector-decorator"),s=require("@combos-fun/plugin-renderer-3d"),r=require("troika-three-text");class i extends t.Component{constructor(){super(...arguments),this.text="",this.replacements={},this.fontSize=.5,this.color=16777215,this.anchorX="center",this.anchorY="middle",this.maxWidth=0,this.font="",this.positionX=0,this.positionY=0,this.positionZ=0,this.rotationX=0,this.rotationY=0,this.rotationZ=0}static{this.componentName="Text3D"}init(e){if(!e)return;const{replacements:t,...o}=e;Object.assign(this,o),t&&(this.replacements={...t})}}e.__decorate([o.Field({type:"string",group:"Text3D",label:"text",description:"Visible text content.",editor:"text"})],i.prototype,"text",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Text3D",label:"fontSize",description:"Font size.",editor:"number-stepper"})],i.prototype,"fontSize",void 0),e.__decorate([o.Field({type:"number",group:"Text3D",label:"color",description:"Color value.",editor:"number-stepper"})],i.prototype,"color",void 0),e.__decorate([o.Field({type:"string",group:"Text3D",label:"anchorX",description:"Horizontal text anchor.",editor:"text"})],i.prototype,"anchorX",void 0),e.__decorate([o.Field({type:"string",group:"Text3D",label:"anchorY",description:"Vertical text anchor.",editor:"text"})],i.prototype,"anchorY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Text3D",label:"maxWidth",description:"Maximum text wrap width.",editor:"number-stepper"})],i.prototype,"maxWidth",void 0),e.__decorate([o.Field({type:"string",group:"Text3D",label:"font",description:"Font URL or path for troika-three-text (not an engine resource name).",editor:"text"})],i.prototype,"font",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Text3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],i.prototype,"positionX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Text3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],i.prototype,"positionY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Text3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],i.prototype,"positionZ",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Text3D",label:"rotationX",description:"Rotation around X in radians.",editor:"number-stepper"})],i.prototype,"rotationX",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Text3D",label:"rotationY",description:"Rotation around Y in radians.",editor:"number-stepper"})],i.prototype,"rotationY",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Text3D",label:"rotationZ",description:"Rotation around Z in radians.",editor:"number-stepper"})],i.prototype,"rotationZ",void 0);function n(e=("undefined"==typeof window?void 0:window.combos)){return!!e&&"function"==typeof e.requestI18n}function a(e){if(!e||"object"!=typeof e)return{needed:!1};const t=e;if(!0!==t.needed)return{needed:!1};if("string"!=typeof t.locale||!t.locale.trim())return{needed:!1};if(!t.translations||"object"!=typeof t.translations||Array.isArray(t.translations))return{needed:!1};const o=Object.entries(t.translations);return o.some(([,e])=>"string"!=typeof e)?{needed:!1}:{needed:!0,locale:t.locale.trim(),translations:Object.fromEntries(o)}}async function c(e){if("undefined"==typeof window||!n(window.combos))return{needed:!1};try{return a(await window.combos.requestI18n(e))}catch{return{needed:!1}}}const d=/\{([A-Za-z_$][\w$.-]*)\}/g;function p(e,t){return t?e.replace(d,(e,o)=>Object.prototype.hasOwnProperty.call(t,o)?String(t[o]):e):e}function l(e,t){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const o=e.trim();return o&&o!==e&&Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0}function u(e,t){return void 0!==l(e,t)}function h(e,t){return e.filter(e=>!u(e,t))}function x(e,t){return h(e,t).length>0}function m(e){return[...e].sort().join("\0")}function f(e,t,o){if(!o.i18nNeeded)return!1;const s=h(e,t);return 0!==s.length&&m(s)!==o.lastRequestedSourceTexts}function T(e,t,o){if(!o.sourceLocale)return!1;const s=e.trim();return!!s&&(!u(e,t)&&(!o.firstI18nSettled||!!o.i18nNeeded&&(o.sourceLocale.toLowerCase()!==o.targetLocale.toLowerCase()&&!o.resolvedSourceTexts.has(s))))}function y(e,t,o,s,r){return p(!!o&&!!s&&o.toLowerCase()!==s.toLowerCase()?l(e,r)??e:e,t)}function g(e,t){if(t)for(const o of t){const t="string"==typeof o?o.trim():"";t&&e.add(t)}}function S(e,t){const o={...e};for(const[e,s]of Object.entries(t))"string"==typeof s&&(o[e]=s);return o}let b=class extends s.Renderer3D{constructor(){super(...arguments),this.name="Text3DSystem",this.texts=new Map,this.poseBridges=new Map,this.sourceLocale="",this.targetLocale="",this.translations={},this.knownSourceTexts=new Set,this.lastRequestedSourceTexts="",this.i18nRequestScheduled=!1,this.i18nRequestId=0,this.firstI18nSettled=!1,this.i18nNeeded=!1,this.resolvedSourceTexts=new Set}static{this.systemName="Text3DSystem"}init(e){this.game.getSystem(s.Renderer3DSystem).rendererManager.register(this),this.sourceLocale=e?.sourceLocale?.trim()??"",this.targetLocale=this.sourceLocale,this.declareSourceTexts(e?.sourceTexts)}declareSourceTexts(e){this.rememberSourceTexts(e),this.scheduleI18nRequest()}async beforeReady(){this.firstI18nSettled||(this.update(),this.sourceLocale?(await this.requestI18nAndApply(),this.i18nNeeded&&x(this.collectSourceTexts(),this.translations)&&await this.requestI18nAndApply(),this.firstI18nSettled=!0,this.refreshAllText()):this.firstI18nSettled=!0)}setI18n(e,t){const o=e?.trim();o&&t&&"object"==typeof t&&(this.targetLocale=o,this.translations=S(this.translations,t),this.refreshAllText())}componentChanged(e){"Text3D"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.handleAdd(e.gameObject,e.component):e.type===t.OBSERVER_TYPE.REMOVE?this.handleRemove(e.gameObject.id):this.handleChange(e))}rendererUpdate(e){const t=e.getComponent(i);if(!t)return;const o=this.texts.get(e.id);o&&this.applyPose(e,t,o.mesh)}handleAdd(e,t){const o=new r.Text;this.syncTextProps(o,t),o.sync(),s.tagObject3D(o,e.id),this.threeContext.attachVisual(e.id,o,e),this.texts.set(e.id,{mesh:o,component:t}),this.poseBridges.set(e.id,new s.VisualPoseBridge),this.rememberSourceTexts([t.text]),this.scheduleI18nRequest()}handleChange(e){const t=this.texts.get(e.gameObject.id);if(!t)return;const o=e.component;t.component=o,"text"===e.prop.prop[0]&&this.rememberSourceTexts([o.text]),this.syncTextProps(t.mesh,o),t.mesh.sync(),"text"===e.prop.prop[0]&&this.scheduleI18nRequest()}handleRemove(e){const t=this.texts.get(e);t&&(this.threeContext.detachVisual(e,t.mesh),t.mesh.dispose(),this.texts.delete(e),this.poseBridges.delete(e))}syncTextProps(e,t){e.text=this.resolveText(t),e.fontSize=t.fontSize,e.color=t.color,e.anchorX=t.anchorX,e.anchorY=t.anchorY,t.maxWidth>0&&(e.maxWidth=t.maxWidth),t.font&&(e.font=t.font)}applyPose(e,t,o){let r=this.poseBridges.get(e.id);r||(r=new s.VisualPoseBridge,this.poseBridges.set(e.id,r));const i=e.getComponent(s.Transform3D);if(!r.sync(t,i))return o.position.set(0,0,0),void o.rotation.set(0,0,0);o.position.set(t.positionX,t.positionY,t.positionZ),o.rotation.set(t.rotationX,t.rotationY,t.rotationZ)}onDestroy(){this.i18nRequestId+=1,this.firstI18nSettled=!1,this.i18nNeeded=!1,this.resolvedSourceTexts.clear();for(const[e]of this.texts)this.handleRemove(e);this.texts.clear()}resolveText(e){return T(e.text,this.translations,{sourceLocale:this.sourceLocale,targetLocale:this.targetLocale,i18nNeeded:this.i18nNeeded,firstI18nSettled:this.firstI18nSettled,resolvedSourceTexts:this.resolvedSourceTexts})?"":y(e.text,e.replacements,this.sourceLocale,this.targetLocale,this.translations)}rememberSourceTexts(e){g(this.knownSourceTexts,e)}collectSourceTexts(){for(const e of this.texts.values())this.rememberSourceTexts([e.component.text]);return[...this.knownSourceTexts]}scheduleI18nRequest(){this.sourceLocale&&this.firstI18nSettled&&!this.i18nRequestScheduled&&(this.i18nRequestScheduled=!0,queueMicrotask(()=>{this.i18nRequestScheduled=!1,this.startI18nRequest()}))}startI18nRequest(){if(!this.sourceLocale||!this.firstI18nSettled)return;f(this.collectSourceTexts(),this.translations,{i18nNeeded:this.i18nNeeded,lastRequestedSourceTexts:this.lastRequestedSourceTexts})&&this.requestI18nAndApply()}async requestI18nAndApply(){const e=h(this.collectSourceTexts(),this.translations);if(0===e.length)return;this.lastRequestedSourceTexts=m(e);const t=++this.i18nRequestId,o=await c({sourceLocale:this.sourceLocale,sourceTexts:e});t===this.i18nRequestId&&(g(this.resolvedSourceTexts,e),this.i18nNeeded=o.needed,o.needed?this.setI18n(o.locale,o.translations):this.refreshAllText())}refreshAllText(){for(const e of this.texts.values())e.mesh.text=this.resolveText(e.component),e.mesh.sync()}};b=e.__decorate([t.decorators.componentObserver({Text3D:["text",{prop:["replacements"],deep:!0},"fontSize","color","anchorX","anchorY","maxWidth","font","positionX","positionY","positionZ","rotationX","rotationY","rotationZ"]})],b);var R=b;exports.COMBOS_HOST_SDK="combos",exports.Text3D=i,exports.Text3DSystem=R,exports.addSourceTexts=g,exports.findTranslatedTemplate=l,exports.hasCombosRequestI18n=n,exports.hasMissingSourceTranslations=x,exports.hasSourceTranslation=u,exports.interpolateText=p,exports.localizeText=y,exports.mergeTranslations=S,exports.parseI18nResult=a,exports.requestHostI18n=c,exports.shouldHoldForMissingTranslation=T,exports.shouldRequestI18nForSourceTexts=f,exports.sourceTextsSignature=m,exports.untranslatedSourceTexts=h;
1
+ "use strict";var e=require("tslib"),t=require("@combos-fun/engine"),s=require("@combos-fun/inspector-decorator"),r=require("@combos-fun/plugin-renderer-3d"),o=require("troika-three-text");class n extends t.Component{constructor(){super(...arguments),this.text="",this.replacements={},this.fontSize=.5,this.color=16777215,this.anchorX="center",this.anchorY="middle",this.maxWidth=0,this.font="",this.positionX=0,this.positionY=0,this.positionZ=0,this.rotationX=0,this.rotationY=0,this.rotationZ=0}static{this.componentName="Text3D"}init(e){if(!e)return;const{replacements:t,...s}=e;Object.assign(this,s),t&&(this.replacements={...t})}}e.__decorate([s.Field({type:"string",group:"Text3D",label:"text",description:"Visible text content.",editor:"text"})],n.prototype,"text",void 0),e.__decorate([s.Field({type:"number",step:.01,group:"Text3D",label:"fontSize",description:"Font size.",editor:"number-stepper"})],n.prototype,"fontSize",void 0),e.__decorate([s.Field({type:"number",group:"Text3D",label:"color",description:"Color value.",editor:"number-stepper"})],n.prototype,"color",void 0),e.__decorate([s.Field({type:"string",group:"Text3D",label:"anchorX",description:"Horizontal text anchor.",editor:"text"})],n.prototype,"anchorX",void 0),e.__decorate([s.Field({type:"string",group:"Text3D",label:"anchorY",description:"Vertical text anchor.",editor:"text"})],n.prototype,"anchorY",void 0),e.__decorate([s.Field({type:"number",step:.1,group:"Text3D",label:"maxWidth",description:"Maximum text wrap width.",editor:"number-stepper"})],n.prototype,"maxWidth",void 0),e.__decorate([s.Field({type:"string",group:"Text3D",label:"font",description:"Font URL or path for troika-three-text (not an engine resource name).",editor:"text"})],n.prototype,"font",void 0),e.__decorate([s.Field({type:"number",step:.1,group:"Text3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],n.prototype,"positionX",void 0),e.__decorate([s.Field({type:"number",step:.1,group:"Text3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],n.prototype,"positionY",void 0),e.__decorate([s.Field({type:"number",step:.1,group:"Text3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],n.prototype,"positionZ",void 0),e.__decorate([s.Field({type:"number",step:.01,group:"Text3D",label:"rotationX",description:"Rotation around X in radians.",editor:"number-stepper"})],n.prototype,"rotationX",void 0),e.__decorate([s.Field({type:"number",step:.01,group:"Text3D",label:"rotationY",description:"Rotation around Y in radians.",editor:"number-stepper"})],n.prototype,"rotationY",void 0),e.__decorate([s.Field({type:"number",step:.01,group:"Text3D",label:"rotationZ",description:"Rotation around Z in radians.",editor:"number-stepper"})],n.prototype,"rotationZ",void 0);function i(e=("undefined"==typeof window?void 0:window.combos)){return!!e&&"function"==typeof e.requestI18n}function d(e){if(!e||"object"!=typeof e)return{needed:!1};const t=e;if(!0!==t.needed)return{needed:!1};if("string"!=typeof t.locale||!t.locale.trim())return{needed:!1};if(!t.translations||"object"!=typeof t.translations||Array.isArray(t.translations))return{needed:!1};const s=Object.entries(t.translations);return s.some(([,e])=>"string"!=typeof e)?{needed:!1}:{needed:!0,locale:t.locale.trim(),translations:Object.fromEntries(s)}}async function a(e){if("undefined"==typeof window||!i(window.combos))return{needed:!1};try{return d(await window.combos.requestI18n(e))}catch{return{needed:!1}}}const c=/\{([A-Za-z_$][\w$.-]*)\}/g;function h(e,t){return t?e.replace(c,(e,s)=>Object.prototype.hasOwnProperty.call(t,s)?String(t[s]):e):e}function l(e,t){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const s=e.trim();return s&&s!==e&&Object.prototype.hasOwnProperty.call(t,s)?t[s]:void 0}function u(e,t){return void 0!==l(e,t)}function p(e,t){return e.filter(e=>!u(e,t))}function x(e,t){return p(e,t).length>0}function m(e){return[...e].sort().join("\0")}function f(e,t){return e||t}function y(e,t,s,r){return s?p(e,t).filter(e=>!r.has(e.trim())):[]}function T(e,t,s){if(!s.i18nNeeded)return!1;const r=p(e,t);return 0!==r.length&&(!!s.renderAgain||m(r)!==s.lastRequestedSourceTexts)}function S(e,t,s){if(!s.sourceLocale)return!1;const r=e.trim();return!!r&&(!u(e,t)&&(!s.firstI18nSettled||!!s.i18nNeeded&&(s.sourceLocale.toLowerCase()!==s.targetLocale.toLowerCase()&&!s.resolvedSourceTexts.has(r))))}function g(e,t,s,r,o){return h(!!s&&!!r&&s.toLowerCase()!==r.toLowerCase()?l(e,o)??e:e,t)}function R(e,t){if(t)for(const s of t){const t="string"==typeof s?s.trim():"";t&&e.add(t)}}function b(e,t){const s={...e};for(const[e,r]of Object.entries(t))"string"==typeof r&&(s[e]=r);return s}let q=class extends r.Renderer3D{constructor(){super(...arguments),this.name="Text3DSystem",this.texts=new Map,this.poseBridges=new Map,this.sourceLocale="",this.targetLocale="",this.translations={},this.knownSourceTexts=new Set,this.lastRequestedSourceTexts="",this.i18nRequestScheduled=!1,this.renderDrivenRequest=!1,this.i18nRequestInFlight=!1,this.i18nRequestId=0,this.firstI18nSettled=!1,this.i18nNeeded=!1,this.resolvedSourceTexts=new Set,this.retryOnNextRender=new Set,this.renderedSinceRetry=new Set}static{this.systemName="Text3DSystem"}init(e){this.game.getSystem(r.Renderer3DSystem).rendererManager.register(this),this.sourceLocale=e?.sourceLocale?.trim()??"",this.targetLocale=this.sourceLocale,this.declareSourceTexts(e?.sourceTexts)}declareSourceTexts(e){this.rememberSourceTexts(e),this.scheduleI18nRequest()}async beforeReady(){this.firstI18nSettled||(this.update(),this.sourceLocale?(await this.requestI18nAndApply(),this.i18nNeeded&&x(this.collectSourceTexts(),this.translations)&&await this.requestI18nAndApply(),this.firstI18nSettled=!0,this.refreshAllText()):this.firstI18nSettled=!0)}setI18n(e,t){const s=e?.trim();s&&t&&"object"==typeof t&&(this.targetLocale=s,this.translations=b(this.translations,t),this.refreshAllText())}componentChanged(e){"Text3D"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.handleAdd(e.gameObject,e.component):e.type===t.OBSERVER_TYPE.REMOVE?this.handleRemove(e.gameObject.id):this.handleChange(e))}rendererUpdate(e){const t=e.getComponent(n);if(!t)return;const s=this.texts.get(e.id);s&&(this.noteTextRender(t.text,function(e){const t=new Set;let s=e;for(;s;){if(!s.visible)return!1;if(t.has(s))return!0;t.add(s);const e=s.parent;if(!e||"object"!=typeof e||!("visible"in e))return!0;s=e}return!0}(s.mesh)),this.applyPose(e,t,s.mesh))}handleAdd(e,t){const s=new o.Text;this.syncTextProps(s,t),s.sync(),r.tagObject3D(s,e.id),this.threeContext.attachVisual(e.id,s,e),this.texts.set(e.id,{mesh:s,component:t}),this.poseBridges.set(e.id,new r.VisualPoseBridge),this.rememberSourceTexts([t.text]),this.scheduleI18nRequest()}handleChange(e){const t=this.texts.get(e.gameObject.id);if(!t)return;const s=e.component;t.component=s,"text"===e.prop.prop[0]&&this.rememberSourceTexts([s.text]),this.syncTextProps(t.mesh,s),t.mesh.sync(),"text"===e.prop.prop[0]&&this.scheduleI18nRequest()}handleRemove(e){const t=this.texts.get(e);t&&(this.threeContext.detachVisual(e,t.mesh),t.mesh.dispose(),this.texts.delete(e),this.poseBridges.delete(e))}syncTextProps(e,t){e.text=this.resolveText(t),e.fontSize=t.fontSize,e.color=t.color,e.anchorX=t.anchorX,e.anchorY=t.anchorY,t.maxWidth>0&&(e.maxWidth=t.maxWidth),t.font&&(e.font=t.font)}applyPose(e,t,s){let o=this.poseBridges.get(e.id);o||(o=new r.VisualPoseBridge,this.poseBridges.set(e.id,o));const n=e.getComponent(r.Transform3D);if(!o.sync(t,n))return s.position.set(0,0,0),void s.rotation.set(0,0,0);s.position.set(t.positionX,t.positionY,t.positionZ),s.rotation.set(t.rotationX,t.rotationY,t.rotationZ)}onDestroy(){this.i18nRequestId+=1,this.firstI18nSettled=!1,this.i18nNeeded=!1,this.i18nRequestInFlight=!1,this.resolvedSourceTexts.clear(),this.retryOnNextRender.clear(),this.renderedSinceRetry.clear();for(const[e]of this.texts)this.handleRemove(e);this.texts.clear()}resolveText(e){return S(e.text,this.translations,{sourceLocale:this.sourceLocale,targetLocale:this.targetLocale,i18nNeeded:this.i18nNeeded,firstI18nSettled:this.firstI18nSettled,resolvedSourceTexts:this.resolvedSourceTexts})?"":g(e.text,e.replacements,this.sourceLocale,this.targetLocale,this.translations)}rememberSourceTexts(e){R(this.knownSourceTexts,e)}collectSourceTexts(){for(const e of this.texts.values())this.rememberSourceTexts([e.component.text]);return[...this.knownSourceTexts]}noteTextRender(e,t){const s=e.trim();if(s&&this.firstI18nSettled&&this.i18nNeeded){if(t)return u(e,this.translations)?(this.retryOnNextRender.delete(s),void this.renderedSinceRetry.delete(s)):void(this.i18nRequestInFlight||this.renderedSinceRetry.has(s)||!this.retryOnNextRender.has(s)||(this.renderedSinceRetry.add(s),this.retryOnNextRender.delete(s),this.scheduleI18nRequest({onRender:!0})));this.renderedSinceRetry.delete(s)&&!u(e,this.translations)&&this.retryOnNextRender.add(s)}}scheduleI18nRequest(e){e?.onRender&&(this.renderDrivenRequest=!0),this.sourceLocale&&this.firstI18nSettled&&!this.i18nRequestScheduled&&(this.i18nRequestScheduled=!0,queueMicrotask(()=>{this.i18nRequestScheduled=!1,this.startI18nRequest()}))}startI18nRequest(){if(!this.sourceLocale||!this.firstI18nSettled||this.i18nRequestInFlight)return;const e=this.renderDrivenRequest;this.renderDrivenRequest=!1;T(this.collectSourceTexts(),this.translations,{i18nNeeded:this.i18nNeeded,lastRequestedSourceTexts:this.lastRequestedSourceTexts,renderAgain:e})&&this.requestI18nAndApply()}async requestI18nAndApply(){const e=p(this.collectSourceTexts(),this.translations);if(0===e.length)return;this.lastRequestedSourceTexts=m(e);const t=++this.i18nRequestId;this.i18nRequestInFlight=!0;try{const s=await a({sourceLocale:this.sourceLocale,sourceTexts:e});if(t!==this.i18nRequestId)return;R(this.resolvedSourceTexts,e),this.i18nNeeded=f(this.i18nNeeded,s.needed),s.needed?this.setI18n(s.locale,s.translations):this.refreshAllText();for(const t of y(e,this.translations,this.i18nNeeded,this.renderedSinceRetry))this.retryOnNextRender.add(t)}finally{t===this.i18nRequestId&&(this.i18nRequestInFlight=!1)}}refreshAllText(){for(const e of this.texts.values())e.mesh.text=this.resolveText(e.component),e.mesh.sync()}};q=e.__decorate([t.decorators.componentObserver({Text3D:["text",{prop:["replacements"],deep:!0},"fontSize","color","anchorX","anchorY","maxWidth","font","positionX","positionY","positionZ","rotationX","rotationY","rotationZ"]})],q);var v=q;exports.COMBOS_HOST_SDK="combos",exports.Text3D=n,exports.Text3DSystem=v,exports.addSourceTexts=R,exports.findTranslatedTemplate=l,exports.hasCombosRequestI18n=i,exports.hasMissingSourceTranslations=x,exports.hasSourceTranslation=u,exports.interpolateText=h,exports.localizeText=g,exports.mergeTranslations=b,exports.parseI18nResult=d,exports.requestHostI18n=a,exports.retainI18nNeeded=f,exports.shouldHoldForMissingTranslation=S,exports.shouldRequestI18nForSourceTexts=T,exports.sourceTextsSignature=m,exports.textsToRetryOnNextRender=y,exports.untranslatedSourceTexts=p;
@@ -12,10 +12,20 @@ declare function hasSourceTranslation(sourceText: string, translations: TextTran
12
12
  declare function untranslatedSourceTexts(sourceTexts: readonly string[], translations: TextTranslations): string[];
13
13
  declare function hasMissingSourceTranslations(sourceTexts: readonly string[], translations: TextTranslations): boolean;
14
14
  declare function sourceTextsSignature(sourceTexts: readonly string[]): string;
15
+ /** A later `needed: false` must not turn off a session that already needs translation. */
16
+ declare function retainI18nNeeded(i18nNeeded: boolean, resultNeeded: boolean): boolean;
17
+ /**
18
+ * Missing templates to ask for on a later render.
19
+ * Templates rendered since the last retry stay out, so a visible label does not
20
+ * request again every frame. Hiding that label arms it again.
21
+ */
22
+ declare function textsToRetryOnNextRender(requested: readonly string[], translations: TextTranslations, i18nNeeded: boolean, renderedSinceRetry: ReadonlySet<string>): string[];
15
23
  /** After the first host reply, only request again for templates still missing. */
16
24
  declare function shouldRequestI18nForSourceTexts(sourceTexts: readonly string[], translations: TextTranslations, state: {
17
25
  i18nNeeded: boolean;
18
26
  lastRequestedSourceTexts: string;
27
+ /** The next render of a template that still has no translation. */
28
+ renderAgain?: boolean;
19
29
  }): boolean;
20
30
  declare function shouldHoldForMissingTranslation(sourceText: string, translations: TextTranslations, state: {
21
31
  sourceLocale: string;
@@ -86,10 +96,16 @@ declare class Text3DSystem extends Renderer3D<Text3DSystemParams> {
86
96
  private knownSourceTexts;
87
97
  private lastRequestedSourceTexts;
88
98
  private i18nRequestScheduled;
99
+ private renderDrivenRequest;
100
+ private i18nRequestInFlight;
89
101
  private i18nRequestId;
90
102
  private firstI18nSettled;
91
103
  private i18nNeeded;
92
104
  private resolvedSourceTexts;
105
+ /** Missing templates to send the next time they are rendered. */
106
+ private retryOnNextRender;
107
+ /** Templates already retried during this time on screen. */
108
+ private renderedSinceRetry;
93
109
  init(params?: Text3DSystemParams): void;
94
110
  /** Register extra source templates before or after ready. First request includes these. */
95
111
  declareSourceTexts(texts?: string[]): void;
@@ -106,6 +122,7 @@ declare class Text3DSystem extends Renderer3D<Text3DSystemParams> {
106
122
  private resolveText;
107
123
  private rememberSourceTexts;
108
124
  private collectSourceTexts;
125
+ private noteTextRender;
109
126
  private scheduleI18nRequest;
110
127
  private startI18nRequest;
111
128
  private requestI18nAndApply;
@@ -142,5 +159,5 @@ declare function parseI18nResult(data: unknown): CombosI18nResult;
142
159
  /** Ask the injected host SDK. Always resolves; missing method means no translation. */
143
160
  declare function requestHostI18n(request: CombosI18nRequest): Promise<CombosI18nResult>;
144
161
 
145
- export { COMBOS_HOST_SDK, Text3D, Text3DSystem, addSourceTexts, findTranslatedTemplate, hasCombosRequestI18n, hasMissingSourceTranslations, hasSourceTranslation, interpolateText, localizeText, mergeTranslations, parseI18nResult, requestHostI18n, shouldHoldForMissingTranslation, shouldRequestI18nForSourceTexts, sourceTextsSignature, untranslatedSourceTexts };
162
+ export { COMBOS_HOST_SDK, Text3D, Text3DSystem, addSourceTexts, findTranslatedTemplate, hasCombosRequestI18n, hasMissingSourceTranslations, hasSourceTranslation, interpolateText, localizeText, mergeTranslations, parseI18nResult, requestHostI18n, retainI18nNeeded, shouldHoldForMissingTranslation, shouldRequestI18nForSourceTexts, sourceTextsSignature, textsToRetryOnNextRender, untranslatedSourceTexts };
146
163
  export type { CombosHostSdk, CombosI18nRequest, CombosI18nResult, Text3DParams, Text3DSystemParams, TextReplacementValue, TextReplacements, TextTranslations };
@@ -237,6 +237,20 @@ function hasMissingSourceTranslations(sourceTexts, translations) {
237
237
  function sourceTextsSignature(sourceTexts) {
238
238
  return [...sourceTexts].sort().join('\0');
239
239
  }
240
+ /** A later `needed: false` must not turn off a session that already needs translation. */
241
+ function retainI18nNeeded(i18nNeeded, resultNeeded) {
242
+ return i18nNeeded || resultNeeded;
243
+ }
244
+ /**
245
+ * Missing templates to ask for on a later render.
246
+ * Templates rendered since the last retry stay out, so a visible label does not
247
+ * request again every frame. Hiding that label arms it again.
248
+ */
249
+ function textsToRetryOnNextRender(requested, translations, i18nNeeded, renderedSinceRetry) {
250
+ if (!i18nNeeded)
251
+ return [];
252
+ return untranslatedSourceTexts(requested, translations).filter((text) => !renderedSinceRetry.has(text.trim()));
253
+ }
240
254
  /** After the first host reply, only request again for templates still missing. */
241
255
  function shouldRequestI18nForSourceTexts(sourceTexts, translations, state) {
242
256
  if (!state.i18nNeeded)
@@ -244,6 +258,8 @@ function shouldRequestI18nForSourceTexts(sourceTexts, translations, state) {
244
258
  const missing = untranslatedSourceTexts(sourceTexts, translations);
245
259
  if (missing.length === 0)
246
260
  return false;
261
+ if (state.renderAgain)
262
+ return true;
247
263
  return sourceTextsSignature(missing) !== state.lastRequestedSourceTexts;
248
264
  }
249
265
  function shouldHoldForMissingTranslation(sourceText, translations, state) {
@@ -305,10 +321,16 @@ let Text3DSystem = class Text3DSystem extends Renderer3D {
305
321
  this.knownSourceTexts = new Set();
306
322
  this.lastRequestedSourceTexts = '';
307
323
  this.i18nRequestScheduled = false;
324
+ this.renderDrivenRequest = false;
325
+ this.i18nRequestInFlight = false;
308
326
  this.i18nRequestId = 0;
309
327
  this.firstI18nSettled = false;
310
328
  this.i18nNeeded = false;
311
329
  this.resolvedSourceTexts = new Set();
330
+ /** Missing templates to send the next time they are rendered. */
331
+ this.retryOnNextRender = new Set();
332
+ /** Templates already retried during this time on screen. */
333
+ this.renderedSinceRetry = new Set();
312
334
  }
313
335
  static { this.systemName = 'Text3DSystem'; }
314
336
  init(params) {
@@ -368,6 +390,7 @@ let Text3DSystem = class Text3DSystem extends Renderer3D {
368
390
  const entry = this.texts.get(gameObject.id);
369
391
  if (!entry)
370
392
  return;
393
+ this.noteTextRender(component.text, isObjectRendered(entry.mesh));
371
394
  this.applyPose(gameObject, component, entry.mesh);
372
395
  }
373
396
  handleAdd(gameObject, component) {
@@ -435,7 +458,10 @@ let Text3DSystem = class Text3DSystem extends Renderer3D {
435
458
  this.i18nRequestId += 1;
436
459
  this.firstI18nSettled = false;
437
460
  this.i18nNeeded = false;
461
+ this.i18nRequestInFlight = false;
438
462
  this.resolvedSourceTexts.clear();
463
+ this.retryOnNextRender.clear();
464
+ this.renderedSinceRetry.clear();
439
465
  for (const [id] of this.texts) {
440
466
  this.handleRemove(id);
441
467
  }
@@ -462,7 +488,34 @@ let Text3DSystem = class Text3DSystem extends Renderer3D {
462
488
  }
463
489
  return [...this.knownSourceTexts];
464
490
  }
465
- scheduleI18nRequest() {
491
+ noteTextRender(sourceText, rendered) {
492
+ const source = sourceText.trim();
493
+ if (!source || !this.firstI18nSettled || !this.i18nNeeded)
494
+ return;
495
+ if (!rendered) {
496
+ if (this.renderedSinceRetry.delete(source) &&
497
+ !hasSourceTranslation(sourceText, this.translations)) {
498
+ this.retryOnNextRender.add(source);
499
+ }
500
+ return;
501
+ }
502
+ if (hasSourceTranslation(sourceText, this.translations)) {
503
+ this.retryOnNextRender.delete(source);
504
+ this.renderedSinceRetry.delete(source);
505
+ return;
506
+ }
507
+ if (this.i18nRequestInFlight ||
508
+ this.renderedSinceRetry.has(source) ||
509
+ !this.retryOnNextRender.has(source)) {
510
+ return;
511
+ }
512
+ this.renderedSinceRetry.add(source);
513
+ this.retryOnNextRender.delete(source);
514
+ this.scheduleI18nRequest({ onRender: true });
515
+ }
516
+ scheduleI18nRequest(options) {
517
+ if (options?.onRender)
518
+ this.renderDrivenRequest = true;
466
519
  if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestScheduled)
467
520
  return;
468
521
  this.i18nRequestScheduled = true;
@@ -472,12 +525,15 @@ let Text3DSystem = class Text3DSystem extends Renderer3D {
472
525
  });
473
526
  }
474
527
  startI18nRequest() {
475
- if (!this.sourceLocale || !this.firstI18nSettled)
528
+ if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestInFlight)
476
529
  return;
530
+ const onRender = this.renderDrivenRequest;
531
+ this.renderDrivenRequest = false;
477
532
  const sourceTexts = this.collectSourceTexts();
478
533
  if (!shouldRequestI18nForSourceTexts(sourceTexts, this.translations, {
479
534
  i18nNeeded: this.i18nNeeded,
480
535
  lastRequestedSourceTexts: this.lastRequestedSourceTexts,
536
+ renderAgain: onRender,
481
537
  })) {
482
538
  return;
483
539
  }
@@ -489,19 +545,30 @@ let Text3DSystem = class Text3DSystem extends Renderer3D {
489
545
  return;
490
546
  this.lastRequestedSourceTexts = sourceTextsSignature(sourceTexts);
491
547
  const requestId = ++this.i18nRequestId;
492
- const result = await requestHostI18n({
493
- sourceLocale: this.sourceLocale,
494
- sourceTexts,
495
- });
496
- if (requestId !== this.i18nRequestId)
497
- return;
498
- addSourceTexts(this.resolvedSourceTexts, sourceTexts);
499
- this.i18nNeeded = result.needed;
500
- if (!result.needed) {
501
- this.refreshAllText();
502
- return;
548
+ this.i18nRequestInFlight = true;
549
+ try {
550
+ const result = await requestHostI18n({
551
+ sourceLocale: this.sourceLocale,
552
+ sourceTexts,
553
+ });
554
+ if (requestId !== this.i18nRequestId)
555
+ return;
556
+ addSourceTexts(this.resolvedSourceTexts, sourceTexts);
557
+ this.i18nNeeded = retainI18nNeeded(this.i18nNeeded, result.needed);
558
+ if (!result.needed) {
559
+ this.refreshAllText();
560
+ }
561
+ else {
562
+ this.setI18n(result.locale, result.translations);
563
+ }
564
+ for (const text of textsToRetryOnNextRender(sourceTexts, this.translations, this.i18nNeeded, this.renderedSinceRetry)) {
565
+ this.retryOnNextRender.add(text);
566
+ }
567
+ }
568
+ finally {
569
+ if (requestId === this.i18nRequestId)
570
+ this.i18nRequestInFlight = false;
503
571
  }
504
- this.setI18n(result.locale, result.translations);
505
572
  }
506
573
  refreshAllText() {
507
574
  for (const entry of this.texts.values()) {
@@ -522,6 +589,22 @@ Text3DSystem = __decorate([
522
589
  })
523
590
  ], Text3DSystem);
524
591
  var Text3DSystem_default = Text3DSystem;
592
+ function isObjectRendered(object) {
593
+ const seen = new Set();
594
+ let current = object;
595
+ while (current) {
596
+ if (!current.visible)
597
+ return false;
598
+ if (seen.has(current))
599
+ return true;
600
+ seen.add(current);
601
+ const parent = current.parent;
602
+ if (!parent || typeof parent !== 'object' || !('visible' in parent))
603
+ return true;
604
+ current = parent;
605
+ }
606
+ return true;
607
+ }
525
608
 
526
- export { COMBOS_HOST_SDK, Text3D, Text3DSystem_default as Text3DSystem, addSourceTexts, findTranslatedTemplate, hasCombosRequestI18n, hasMissingSourceTranslations, hasSourceTranslation, interpolateText, localizeText, mergeTranslations, parseI18nResult, requestHostI18n, shouldHoldForMissingTranslation, shouldRequestI18nForSourceTexts, sourceTextsSignature, untranslatedSourceTexts };
609
+ export { COMBOS_HOST_SDK, Text3D, Text3DSystem_default as Text3DSystem, addSourceTexts, findTranslatedTemplate, hasCombosRequestI18n, hasMissingSourceTranslations, hasSourceTranslation, interpolateText, localizeText, mergeTranslations, parseI18nResult, requestHostI18n, retainI18nNeeded, shouldHoldForMissingTranslation, shouldRequestI18nForSourceTexts, sourceTextsSignature, textsToRetryOnNextRender, untranslatedSourceTexts };
527
610
  //# sourceMappingURL=plugin-renderer-3d-text.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-renderer-3d-text.esm.js","sources":["../lib/component.ts","../lib/hostSdk.ts","../lib/localization.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\nimport type { TextReplacements } from './localization';\n\nexport type { TextReplacementValue, TextReplacements } from './localization';\n\nexport interface Text3DParams {\n text?: string;\n /** Values substituted into named placeholders such as `{score}`. */\n replacements?: TextReplacements;\n fontSize?: number;\n color?: number;\n anchorX?: string;\n anchorY?: string;\n maxWidth?: number;\n font?: string;\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n}\n\nexport default class Text3D extends Component<Text3DParams> {\n static componentName: string = 'Text3D';\n\n @Field({\n\n type: 'string',\n\n group: 'Text3D',\n\n label: 'text',\n\n description: 'Visible text content.',\n\n editor: 'text',\n\n })\n\n text: string = '';\n\n replacements: TextReplacements = {};\n\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'fontSize',\n description: 'Font size.',\n editor: 'number-stepper',\n })\n fontSize: number = 0.5;\n @Field({\n type: 'number',\n group: 'Text3D',\n label: 'color',\n description: 'Color value.',\n editor: 'number-stepper',\n })\n color: number = 0xffffff;\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'anchorX',\n description: 'Horizontal text anchor.',\n editor: 'text',\n })\n anchorX: string = 'center';\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'anchorY',\n description: 'Vertical text anchor.',\n editor: 'text',\n })\n anchorY: string = 'middle';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'maxWidth',\n description: 'Maximum text wrap width.',\n editor: 'number-stepper',\n })\n maxWidth: number = 0;\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'font',\n description: 'Font URL or path for troika-three-text (not an engine resource name).',\n editor: 'text',\n })\n font: string = '';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionX',\n description: 'Local X position.',\n editor: 'number-stepper',\n })\n positionX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionY',\n description: 'Local Y position.',\n editor: 'number-stepper',\n })\n positionY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionZ',\n description: 'Local Z position.',\n editor: 'number-stepper',\n })\n positionZ: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationX',\n description: 'Rotation around X in radians.',\n editor: 'number-stepper',\n })\n rotationX: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationY',\n description: 'Rotation around Y in radians.',\n editor: 'number-stepper',\n })\n rotationY: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationZ',\n description: 'Rotation around Z in radians.',\n editor: 'number-stepper',\n })\n rotationZ: number = 0;\n\n init(obj?: Text3DParams) {\n if (!obj) return;\n const { replacements, ...rest } = obj;\n Object.assign(this, rest);\n if (replacements) this.replacements = { ...replacements };\n }\n}\n","/** Keep identical to `@combos-fun/plugin-renderer-text` hostSdk. */\nimport type { TextTranslations } from './localization';\n\n/** Host-injected global. The SDK itself is not part of this repo. */\nexport const COMBOS_HOST_SDK = 'combos' as const;\n\nexport interface CombosI18nRequest {\n sourceLocale: string;\n sourceTexts: string[];\n}\n\nexport type CombosI18nResult =\n | { needed: false }\n | { needed: true; locale: string; translations: TextTranslations };\n\nexport interface CombosHostSdk {\n requestI18n?(request: CombosI18nRequest): Promise<CombosI18nResult>;\n}\n\ndeclare global {\n interface Window {\n combos?: CombosHostSdk;\n }\n}\n\nexport function hasCombosRequestI18n(\n sdk: CombosHostSdk | undefined | null = typeof window === 'undefined' ? undefined : window.combos,\n): sdk is CombosHostSdk & { requestI18n: NonNullable<CombosHostSdk['requestI18n']> } {\n return !!sdk && typeof sdk.requestI18n === 'function';\n}\n\nexport function parseI18nResult(data: unknown): CombosI18nResult {\n if (!data || typeof data !== 'object') return { needed: false };\n const input = data as {\n needed?: unknown;\n locale?: unknown;\n translations?: unknown;\n };\n if (input.needed !== true) return { needed: false };\n if (typeof input.locale !== 'string' || !input.locale.trim()) {\n return { needed: false };\n }\n if (\n !input.translations ||\n typeof input.translations !== 'object' ||\n Array.isArray(input.translations)\n ) {\n return { needed: false };\n }\n const entries = Object.entries(input.translations);\n if (entries.some(([, value]) => typeof value !== 'string')) {\n return { needed: false };\n }\n return {\n needed: true,\n locale: input.locale.trim(),\n translations: Object.fromEntries(entries) as TextTranslations,\n };\n}\n\n/** Ask the injected host SDK. Always resolves; missing method means no translation. */\nexport async function requestHostI18n(\n request: CombosI18nRequest,\n): Promise<CombosI18nResult> {\n if (typeof window === 'undefined' || !hasCombosRequestI18n(window.combos)) {\n return { needed: false };\n }\n try {\n return parseI18nResult(await window.combos.requestI18n(request));\n } catch {\n return { needed: false };\n }\n}\n","/** Keep identical to `@combos-fun/plugin-renderer-text` localization. */\n\nexport type TextReplacementValue = string | number;\nexport type TextReplacements = Record<string, TextReplacementValue>;\nexport type TextTranslations = Record<string, string>;\n\nconst PLACEHOLDER_PATTERN = /\\{([A-Za-z_$][\\w$.-]*)\\}/g;\n\nexport function interpolateText(\n template: string,\n replacements?: TextReplacements,\n): string {\n if (!replacements) return template;\n return template.replace(PLACEHOLDER_PATTERN, (placeholder, name: string) => {\n if (!Object.prototype.hasOwnProperty.call(replacements, name)) {\n return placeholder;\n }\n return String(replacements[name]);\n });\n}\n\nexport function findTranslatedTemplate(\n sourceText: string,\n translations: TextTranslations,\n): string | undefined {\n if (Object.prototype.hasOwnProperty.call(translations, sourceText)) {\n return translations[sourceText];\n }\n const trimmed = sourceText.trim();\n if (\n trimmed &&\n trimmed !== sourceText &&\n Object.prototype.hasOwnProperty.call(translations, trimmed)\n ) {\n return translations[trimmed];\n }\n return undefined;\n}\n\nexport function hasSourceTranslation(\n sourceText: string,\n translations: TextTranslations,\n): boolean {\n return findTranslatedTemplate(sourceText, translations) !== undefined;\n}\n\n/** Templates that still have no translation; later `requestI18n` sends only these. */\nexport function untranslatedSourceTexts(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n): string[] {\n return sourceTexts.filter((text) => !hasSourceTranslation(text, translations));\n}\n\nexport function hasMissingSourceTranslations(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n): boolean {\n return untranslatedSourceTexts(sourceTexts, translations).length > 0;\n}\n\nexport function sourceTextsSignature(sourceTexts: readonly string[]): string {\n return [...sourceTexts].sort().join('\\0');\n}\n\n/** After the first host reply, only request again for templates still missing. */\nexport function shouldRequestI18nForSourceTexts(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n state: {\n i18nNeeded: boolean;\n lastRequestedSourceTexts: string;\n },\n): boolean {\n if (!state.i18nNeeded) return false;\n const missing = untranslatedSourceTexts(sourceTexts, translations);\n if (missing.length === 0) return false;\n return sourceTextsSignature(missing) !== state.lastRequestedSourceTexts;\n}\n\nexport function shouldHoldForMissingTranslation(\n sourceText: string,\n translations: TextTranslations,\n state: {\n sourceLocale: string;\n targetLocale: string;\n i18nNeeded: boolean;\n firstI18nSettled: boolean;\n resolvedSourceTexts: ReadonlySet<string>;\n },\n): boolean {\n if (!state.sourceLocale) return false;\n const trimmed = sourceText.trim();\n if (!trimmed) return false;\n if (hasSourceTranslation(sourceText, translations)) return false;\n // Flush mounts Text before the first requestI18n. targetLocale still equals\n // sourceLocale and i18nNeeded is still false, so holding only after settle\n // would paint the source copy, then swap it when the host replies.\n if (!state.firstI18nSettled) return true;\n if (!state.i18nNeeded) return false;\n if (state.sourceLocale.toLowerCase() === state.targetLocale.toLowerCase()) return false;\n return !state.resolvedSourceTexts.has(trimmed);\n}\n\nexport function localizeText(\n sourceText: string,\n replacements: TextReplacements | undefined,\n sourceLocale: string,\n targetLocale: string,\n translations: TextTranslations,\n): string {\n const shouldTranslate =\n !!sourceLocale &&\n !!targetLocale &&\n sourceLocale.toLowerCase() !== targetLocale.toLowerCase();\n const template = shouldTranslate\n ? findTranslatedTemplate(sourceText, translations) ?? sourceText\n : sourceText;\n return interpolateText(template, replacements);\n}\n\nexport function addSourceTexts(\n target: Set<string>,\n texts?: Iterable<string | undefined | null>,\n) {\n if (!texts) return;\n for (const text of texts) {\n const source = typeof text === 'string' ? text.trim() : '';\n if (source) target.add(source);\n }\n}\n\nexport function mergeTranslations(\n current: TextTranslations,\n incoming: Record<string, unknown>,\n): TextTranslations {\n const next = { ...current };\n for (const [key, value] of Object.entries(incoming)) {\n if (typeof value === 'string') next[key] = value;\n }\n return next;\n}\n","import { decorators, ComponentChanged, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport { Renderer3D, Renderer3DSystem, tagObject3D, Transform3D, VisualPoseBridge } from '@combos-fun/plugin-renderer-3d';\nimport { Text as TroikaText } from 'troika-three-text';\nimport Text3D from './component';\nimport { requestHostI18n } from './hostSdk';\nimport {\n addSourceTexts,\n hasMissingSourceTranslations,\n localizeText,\n mergeTranslations,\n shouldHoldForMissingTranslation,\n shouldRequestI18nForSourceTexts,\n sourceTextsSignature,\n untranslatedSourceTexts,\n type TextTranslations,\n} from './localization';\n\nexport interface Text3DSystemParams {\n /** BCP 47 locale of the source text, for example `zh-CN`. Omit to disable host-driven i18n. */\n sourceLocale?: string;\n /**\n * All source templates to translate on first `requestI18n`, including copy\n * for screens that are not mounted yet. The system also keeps a growing\n * session catalog of every later template it sees.\n */\n sourceTexts?: string[];\n}\n\n@decorators.componentObserver({\n Text3D: [\n 'text',\n { prop: ['replacements'], deep: true },\n 'fontSize', 'color', 'anchorX', 'anchorY', 'maxWidth', 'font',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n ],\n})\nexport default class Text3DSystem extends Renderer3D<Text3DSystemParams> {\n static systemName = 'Text3DSystem';\n name: string = 'Text3DSystem';\n\n private texts = new Map<number, { mesh: TroikaText; component: Text3D }>();\n private poseBridges = new Map<number, VisualPoseBridge>();\n private sourceLocale = '';\n private targetLocale = '';\n private translations: TextTranslations = {};\n /** Growing catalog of every source template seen this session. */\n private knownSourceTexts = new Set<string>();\n private lastRequestedSourceTexts = '';\n private i18nRequestScheduled = false;\n private i18nRequestId = 0;\n private firstI18nSettled = false;\n private i18nNeeded = false;\n private resolvedSourceTexts = new Set<string>();\n\n init(params?: Text3DSystemParams) {\n const renderer3DSystem = this.game.getSystem(Renderer3DSystem) as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n this.sourceLocale = params?.sourceLocale?.trim() ?? '';\n this.targetLocale = this.sourceLocale;\n this.declareSourceTexts(params?.sourceTexts);\n }\n\n /** Register extra source templates before or after ready. First request includes these. */\n declareSourceTexts(texts?: string[]) {\n this.rememberSourceTexts(texts);\n this.scheduleI18nRequest();\n }\n\n async beforeReady() {\n if (this.firstI18nSettled) return;\n this.update();\n if (!this.sourceLocale) {\n this.firstI18nSettled = true;\n return;\n }\n await this.requestI18nAndApply();\n if (\n this.i18nNeeded &&\n hasMissingSourceTranslations(this.collectSourceTexts(), this.translations)\n ) {\n await this.requestI18nAndApply();\n }\n this.firstI18nSettled = true;\n // needed:false refresh still ran with firstI18nSettled=false (empty hold).\n this.refreshAllText();\n }\n\n setI18n(locale: string, translations: TextTranslations) {\n const targetLocale = locale?.trim();\n if (!targetLocale || !translations || typeof translations !== 'object') return;\n this.targetLocale = targetLocale;\n this.translations = mergeTranslations(this.translations, translations);\n this.refreshAllText();\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Text3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Text3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.handleRemove(changed.gameObject.id);\n } else {\n this.handleChange(changed);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Text3D) as Text3D;\n if (!component) return;\n\n const entry = this.texts.get(gameObject.id);\n if (!entry) return;\n this.applyPose(gameObject, component, entry.mesh);\n }\n\n private handleAdd(gameObject: GameObject, component: Text3D) {\n const textMesh = new TroikaText();\n this.syncTextProps(textMesh, component);\n textMesh.sync();\n tagObject3D(textMesh, gameObject.id);\n\n this.threeContext.attachVisual(gameObject.id, textMesh, gameObject);\n this.texts.set(gameObject.id, { mesh: textMesh, component });\n this.poseBridges.set(gameObject.id, new VisualPoseBridge());\n this.rememberSourceTexts([component.text]);\n this.scheduleI18nRequest();\n }\n\n private handleChange(changed: ComponentChanged) {\n const entry = this.texts.get(changed.gameObject.id);\n if (!entry) return;\n const component = changed.component as Text3D;\n entry.component = component;\n if (changed.prop.prop[0] === 'text') this.rememberSourceTexts([component.text]);\n this.syncTextProps(entry.mesh, component);\n entry.mesh.sync();\n if (changed.prop.prop[0] === 'text') this.scheduleI18nRequest();\n }\n\n private handleRemove(id: number) {\n const entry = this.texts.get(id);\n if (!entry) return;\n\n this.threeContext.detachVisual(id, entry.mesh);\n entry.mesh.dispose();\n this.texts.delete(id);\n this.poseBridges.delete(id);\n }\n\n private syncTextProps(textMesh: TroikaText, component: Text3D) {\n textMesh.text = this.resolveText(component);\n textMesh.fontSize = component.fontSize;\n textMesh.color = component.color;\n textMesh.anchorX = component.anchorX;\n textMesh.anchorY = component.anchorY;\n if (component.maxWidth > 0) {\n textMesh.maxWidth = component.maxWidth;\n }\n if (component.font) {\n textMesh.font = component.font;\n }\n }\n\n private applyPose(gameObject: GameObject, component: Text3D, textMesh: TroikaText) {\n let bridge = this.poseBridges.get(gameObject.id);\n if (!bridge) {\n bridge = new VisualPoseBridge();\n this.poseBridges.set(gameObject.id, bridge);\n }\n const transform = gameObject.getComponent(Transform3D) as Transform3D | undefined;\n if (!bridge.sync(component, transform)) {\n textMesh.position.set(0, 0, 0);\n textMesh.rotation.set(0, 0, 0);\n return;\n }\n textMesh.position.set(component.positionX, component.positionY, component.positionZ);\n textMesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n }\n\n onDestroy() {\n this.i18nRequestId += 1;\n this.firstI18nSettled = false;\n this.i18nNeeded = false;\n this.resolvedSourceTexts.clear();\n for (const [id] of this.texts) {\n this.handleRemove(id);\n }\n this.texts.clear();\n }\n\n private resolveText(component: Text3D): string {\n if (\n shouldHoldForMissingTranslation(component.text, this.translations, {\n sourceLocale: this.sourceLocale,\n targetLocale: this.targetLocale,\n i18nNeeded: this.i18nNeeded,\n firstI18nSettled: this.firstI18nSettled,\n resolvedSourceTexts: this.resolvedSourceTexts,\n })\n ) {\n return '';\n }\n return localizeText(\n component.text,\n component.replacements,\n this.sourceLocale,\n this.targetLocale,\n this.translations,\n );\n }\n\n private rememberSourceTexts(texts?: Iterable<string | undefined | null>) {\n addSourceTexts(this.knownSourceTexts, texts);\n }\n\n private collectSourceTexts(): string[] {\n for (const entry of this.texts.values()) {\n this.rememberSourceTexts([entry.component.text]);\n }\n return [...this.knownSourceTexts];\n }\n\n private scheduleI18nRequest() {\n if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestScheduled) return;\n this.i18nRequestScheduled = true;\n queueMicrotask(() => {\n this.i18nRequestScheduled = false;\n this.startI18nRequest();\n });\n }\n\n private startI18nRequest() {\n if (!this.sourceLocale || !this.firstI18nSettled) return;\n const sourceTexts = this.collectSourceTexts();\n if (\n !shouldRequestI18nForSourceTexts(sourceTexts, this.translations, {\n i18nNeeded: this.i18nNeeded,\n lastRequestedSourceTexts: this.lastRequestedSourceTexts,\n })\n ) {\n return;\n }\n void this.requestI18nAndApply();\n }\n\n private async requestI18nAndApply() {\n const sourceTexts = untranslatedSourceTexts(\n this.collectSourceTexts(),\n this.translations,\n );\n if (sourceTexts.length === 0) return;\n this.lastRequestedSourceTexts = sourceTextsSignature(sourceTexts);\n const requestId = ++this.i18nRequestId;\n const result = await requestHostI18n({\n sourceLocale: this.sourceLocale,\n sourceTexts,\n });\n if (requestId !== this.i18nRequestId) return;\n addSourceTexts(this.resolvedSourceTexts, sourceTexts);\n this.i18nNeeded = result.needed;\n if (!result.needed) {\n this.refreshAllText();\n return;\n }\n this.setI18n(result.locale, result.translations);\n }\n\n private refreshAllText() {\n for (const entry of this.texts.values()) {\n entry.mesh.text = this.resolveText(entry.component);\n entry.mesh.sync();\n }\n }\n}\n"],"names":["TroikaText"],"mappings":";;;;;;AAwBc,MAAO,MAAO,SAAQ,SAAuB,CAAA;AAA3D,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,IAAI,GAAW,EAAE;QAEjB,IAAA,CAAA,YAAY,GAAqB,EAAE;QAUnC,IAAA,CAAA,QAAQ,GAAW,GAAG;QAQtB,IAAA,CAAA,KAAK,GAAW,QAAQ;QAQxB,IAAA,CAAA,OAAO,GAAW,QAAQ;QAQ1B,IAAA,CAAA,OAAO,GAAW,QAAQ;QAS1B,IAAA,CAAA,QAAQ,GAAW,CAAC;QAQpB,IAAA,CAAA,IAAI,GAAW,EAAE;QASjB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;IAQvB;aAnIS,IAAA,CAAA,aAAa,GAAW,QAAX,CAAoB;AA6HxC,IAAA,IAAI,CAAC,GAAkB,EAAA;AACrB,QAAA,IAAI,CAAC,GAAG;YAAE;QACV,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG;AACrC,QAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC;AACzB,QAAA,IAAI,YAAY;AAAE,YAAA,IAAI,CAAC,YAAY,GAAG,EAAE,GAAG,YAAY,EAAE;IAC3D;;AAlHA,UAAA,CAAA;AAdC,IAAA,KAAK,CAAC;AAEL,QAAA,IAAI,EAAE,QAAQ;AAEd,QAAA,KAAK,EAAE,QAAQ;AAEf,QAAA,K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B,QAAA,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,IAAI,CAAC,cAAc,EAAE;YACrB;QACF;QACA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC;IAClD;IAEQ,cAAc,GAAA;QACpB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE;AACvC,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC;AACnD,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE;QACnB;IACF;;AA7OmB,YAAY,GAAA,UAAA,CAAA;IAThC,UAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,MAAM,EAAE;YACN,MAAM;YACN,EAAE,IAAI,EAAE,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;YACtC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM;YAC7D,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACtC,SAAA;KACF;AACoB,CAAA,EAAA,YAAY,CA8OhC;2BA9OoB,YAAY;;;;"}
1
+ {"version":3,"file":"plugin-renderer-3d-text.esm.js","sources":["../lib/component.ts","../lib/hostSdk.ts","../lib/localization.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\nimport type { TextReplacements } from './localization';\n\nexport type { TextReplacementValue, TextReplacements } from './localization';\n\nexport interface Text3DParams {\n text?: string;\n /** Values substituted into named placeholders such as `{score}`. */\n replacements?: TextReplacements;\n fontSize?: number;\n color?: number;\n anchorX?: string;\n anchorY?: string;\n maxWidth?: number;\n font?: string;\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n}\n\nexport default class Text3D extends Component<Text3DParams> {\n static componentName: string = 'Text3D';\n\n @Field({\n\n type: 'string',\n\n group: 'Text3D',\n\n label: 'text',\n\n description: 'Visible text content.',\n\n editor: 'text',\n\n })\n\n text: string = '';\n\n replacements: TextReplacements = {};\n\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'fontSize',\n description: 'Font size.',\n editor: 'number-stepper',\n })\n fontSize: number = 0.5;\n @Field({\n type: 'number',\n group: 'Text3D',\n label: 'color',\n description: 'Color value.',\n editor: 'number-stepper',\n })\n color: number = 0xffffff;\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'anchorX',\n description: 'Horizontal text anchor.',\n editor: 'text',\n })\n anchorX: string = 'center';\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'anchorY',\n description: 'Vertical text anchor.',\n editor: 'text',\n })\n anchorY: string = 'middle';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'maxWidth',\n description: 'Maximum text wrap width.',\n editor: 'number-stepper',\n })\n maxWidth: number = 0;\n @Field({\n type: 'string',\n group: 'Text3D',\n label: 'font',\n description: 'Font URL or path for troika-three-text (not an engine resource name).',\n editor: 'text',\n })\n font: string = '';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionX',\n description: 'Local X position.',\n editor: 'number-stepper',\n })\n positionX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionY',\n description: 'Local Y position.',\n editor: 'number-stepper',\n })\n positionY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Text3D',\n label: 'positionZ',\n description: 'Local Z position.',\n editor: 'number-stepper',\n })\n positionZ: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationX',\n description: 'Rotation around X in radians.',\n editor: 'number-stepper',\n })\n rotationX: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationY',\n description: 'Rotation around Y in radians.',\n editor: 'number-stepper',\n })\n rotationY: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Text3D',\n label: 'rotationZ',\n description: 'Rotation around Z in radians.',\n editor: 'number-stepper',\n })\n rotationZ: number = 0;\n\n init(obj?: Text3DParams) {\n if (!obj) return;\n const { replacements, ...rest } = obj;\n Object.assign(this, rest);\n if (replacements) this.replacements = { ...replacements };\n }\n}\n","/** Keep identical to `@combos-fun/plugin-renderer-text` hostSdk. */\nimport type { TextTranslations } from './localization';\n\n/** Host-injected global. The SDK itself is not part of this repo. */\nexport const COMBOS_HOST_SDK = 'combos' as const;\n\nexport interface CombosI18nRequest {\n sourceLocale: string;\n sourceTexts: string[];\n}\n\nexport type CombosI18nResult =\n | { needed: false }\n | { needed: true; locale: string; translations: TextTranslations };\n\nexport interface CombosHostSdk {\n requestI18n?(request: CombosI18nRequest): Promise<CombosI18nResult>;\n}\n\ndeclare global {\n interface Window {\n combos?: CombosHostSdk;\n }\n}\n\nexport function hasCombosRequestI18n(\n sdk: CombosHostSdk | undefined | null = typeof window === 'undefined' ? undefined : window.combos,\n): sdk is CombosHostSdk & { requestI18n: NonNullable<CombosHostSdk['requestI18n']> } {\n return !!sdk && typeof sdk.requestI18n === 'function';\n}\n\nexport function parseI18nResult(data: unknown): CombosI18nResult {\n if (!data || typeof data !== 'object') return { needed: false };\n const input = data as {\n needed?: unknown;\n locale?: unknown;\n translations?: unknown;\n };\n if (input.needed !== true) return { needed: false };\n if (typeof input.locale !== 'string' || !input.locale.trim()) {\n return { needed: false };\n }\n if (\n !input.translations ||\n typeof input.translations !== 'object' ||\n Array.isArray(input.translations)\n ) {\n return { needed: false };\n }\n const entries = Object.entries(input.translations);\n if (entries.some(([, value]) => typeof value !== 'string')) {\n return { needed: false };\n }\n return {\n needed: true,\n locale: input.locale.trim(),\n translations: Object.fromEntries(entries) as TextTranslations,\n };\n}\n\n/** Ask the injected host SDK. Always resolves; missing method means no translation. */\nexport async function requestHostI18n(\n request: CombosI18nRequest,\n): Promise<CombosI18nResult> {\n if (typeof window === 'undefined' || !hasCombosRequestI18n(window.combos)) {\n return { needed: false };\n }\n try {\n return parseI18nResult(await window.combos.requestI18n(request));\n } catch {\n return { needed: false };\n }\n}\n","/** Keep identical to `@combos-fun/plugin-renderer-text` localization. */\n\nexport type TextReplacementValue = string | number;\nexport type TextReplacements = Record<string, TextReplacementValue>;\nexport type TextTranslations = Record<string, string>;\n\nconst PLACEHOLDER_PATTERN = /\\{([A-Za-z_$][\\w$.-]*)\\}/g;\n\nexport function interpolateText(\n template: string,\n replacements?: TextReplacements,\n): string {\n if (!replacements) return template;\n return template.replace(PLACEHOLDER_PATTERN, (placeholder, name: string) => {\n if (!Object.prototype.hasOwnProperty.call(replacements, name)) {\n return placeholder;\n }\n return String(replacements[name]);\n });\n}\n\nexport function findTranslatedTemplate(\n sourceText: string,\n translations: TextTranslations,\n): string | undefined {\n if (Object.prototype.hasOwnProperty.call(translations, sourceText)) {\n return translations[sourceText];\n }\n const trimmed = sourceText.trim();\n if (\n trimmed &&\n trimmed !== sourceText &&\n Object.prototype.hasOwnProperty.call(translations, trimmed)\n ) {\n return translations[trimmed];\n }\n return undefined;\n}\n\nexport function hasSourceTranslation(\n sourceText: string,\n translations: TextTranslations,\n): boolean {\n return findTranslatedTemplate(sourceText, translations) !== undefined;\n}\n\n/** Templates that still have no translation; later `requestI18n` sends only these. */\nexport function untranslatedSourceTexts(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n): string[] {\n return sourceTexts.filter((text) => !hasSourceTranslation(text, translations));\n}\n\nexport function hasMissingSourceTranslations(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n): boolean {\n return untranslatedSourceTexts(sourceTexts, translations).length > 0;\n}\n\nexport function sourceTextsSignature(sourceTexts: readonly string[]): string {\n return [...sourceTexts].sort().join('\\0');\n}\n\n/** A later `needed: false` must not turn off a session that already needs translation. */\nexport function retainI18nNeeded(i18nNeeded: boolean, resultNeeded: boolean): boolean {\n return i18nNeeded || resultNeeded;\n}\n\n/**\n * Missing templates to ask for on a later render.\n * Templates rendered since the last retry stay out, so a visible label does not\n * request again every frame. Hiding that label arms it again.\n */\nexport function textsToRetryOnNextRender(\n requested: readonly string[],\n translations: TextTranslations,\n i18nNeeded: boolean,\n renderedSinceRetry: ReadonlySet<string>,\n): string[] {\n if (!i18nNeeded) return [];\n return untranslatedSourceTexts(requested, translations).filter(\n (text) => !renderedSinceRetry.has(text.trim()),\n );\n}\n\n/** After the first host reply, only request again for templates still missing. */\nexport function shouldRequestI18nForSourceTexts(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n state: {\n i18nNeeded: boolean;\n lastRequestedSourceTexts: string;\n /** The next render of a template that still has no translation. */\n renderAgain?: boolean;\n },\n): boolean {\n if (!state.i18nNeeded) return false;\n const missing = untranslatedSourceTexts(sourceTexts, translations);\n if (missing.length === 0) return false;\n if (state.renderAgain) return true;\n return sourceTextsSignature(missing) !== state.lastRequestedSourceTexts;\n}\n\nexport function shouldHoldForMissingTranslation(\n sourceText: string,\n translations: TextTranslations,\n state: {\n sourceLocale: string;\n targetLocale: string;\n i18nNeeded: boolean;\n firstI18nSettled: boolean;\n resolvedSourceTexts: ReadonlySet<string>;\n },\n): boolean {\n if (!state.sourceLocale) return false;\n const trimmed = sourceText.trim();\n if (!trimmed) return false;\n if (hasSourceTranslation(sourceText, translations)) return false;\n // Flush mounts Text before the first requestI18n. targetLocale still equals\n // sourceLocale and i18nNeeded is still false, so holding only after settle\n // would paint the source copy, then swap it when the host replies.\n if (!state.firstI18nSettled) return true;\n if (!state.i18nNeeded) return false;\n if (state.sourceLocale.toLowerCase() === state.targetLocale.toLowerCase()) return false;\n return !state.resolvedSourceTexts.has(trimmed);\n}\n\nexport function localizeText(\n sourceText: string,\n replacements: TextReplacements | undefined,\n sourceLocale: string,\n targetLocale: string,\n translations: TextTranslations,\n): string {\n const shouldTranslate =\n !!sourceLocale &&\n !!targetLocale &&\n sourceLocale.toLowerCase() !== targetLocale.toLowerCase();\n const template = shouldTranslate\n ? findTranslatedTemplate(sourceText, translations) ?? sourceText\n : sourceText;\n return interpolateText(template, replacements);\n}\n\nexport function addSourceTexts(\n target: Set<string>,\n texts?: Iterable<string | undefined | null>,\n) {\n if (!texts) return;\n for (const text of texts) {\n const source = typeof text === 'string' ? text.trim() : '';\n if (source) target.add(source);\n }\n}\n\nexport function mergeTranslations(\n current: TextTranslations,\n incoming: Record<string, unknown>,\n): TextTranslations {\n const next = { ...current };\n for (const [key, value] of Object.entries(incoming)) {\n if (typeof value === 'string') next[key] = value;\n }\n return next;\n}\n","import { decorators, ComponentChanged, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport { Renderer3D, Renderer3DSystem, tagObject3D, Transform3D, VisualPoseBridge } from '@combos-fun/plugin-renderer-3d';\nimport { Text as TroikaText } from 'troika-three-text';\nimport Text3D from './component';\nimport { requestHostI18n } from './hostSdk';\nimport {\n addSourceTexts,\n hasMissingSourceTranslations,\n hasSourceTranslation,\n localizeText,\n mergeTranslations,\n retainI18nNeeded,\n shouldHoldForMissingTranslation,\n shouldRequestI18nForSourceTexts,\n sourceTextsSignature,\n textsToRetryOnNextRender,\n untranslatedSourceTexts,\n type TextTranslations,\n} from './localization';\n\nexport interface Text3DSystemParams {\n /** BCP 47 locale of the source text, for example `zh-CN`. Omit to disable host-driven i18n. */\n sourceLocale?: string;\n /**\n * All source templates to translate on first `requestI18n`, including copy\n * for screens that are not mounted yet. The system also keeps a growing\n * session catalog of every later template it sees.\n */\n sourceTexts?: string[];\n}\n\n@decorators.componentObserver({\n Text3D: [\n 'text',\n { prop: ['replacements'], deep: true },\n 'fontSize', 'color', 'anchorX', 'anchorY', 'maxWidth', 'font',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n ],\n})\nexport default class Text3DSystem extends Renderer3D<Text3DSystemParams> {\n static systemName = 'Text3DSystem';\n name: string = 'Text3DSystem';\n\n private texts = new Map<number, { mesh: TroikaText; component: Text3D }>();\n private poseBridges = new Map<number, VisualPoseBridge>();\n private sourceLocale = '';\n private targetLocale = '';\n private translations: TextTranslations = {};\n /** Growing catalog of every source template seen this session. */\n private knownSourceTexts = new Set<string>();\n private lastRequestedSourceTexts = '';\n private i18nRequestScheduled = false;\n private renderDrivenRequest = false;\n private i18nRequestInFlight = false;\n private i18nRequestId = 0;\n private firstI18nSettled = false;\n private i18nNeeded = false;\n private resolvedSourceTexts = new Set<string>();\n /** Missing templates to send the next time they are rendered. */\n private retryOnNextRender = new Set<string>();\n /** Templates already retried during this time on screen. */\n private renderedSinceRetry = new Set<string>();\n\n init(params?: Text3DSystemParams) {\n const renderer3DSystem = this.game.getSystem(Renderer3DSystem) as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n this.sourceLocale = params?.sourceLocale?.trim() ?? '';\n this.targetLocale = this.sourceLocale;\n this.declareSourceTexts(params?.sourceTexts);\n }\n\n /** Register extra source templates before or after ready. First request includes these. */\n declareSourceTexts(texts?: string[]) {\n this.rememberSourceTexts(texts);\n this.scheduleI18nRequest();\n }\n\n async beforeReady() {\n if (this.firstI18nSettled) return;\n this.update();\n if (!this.sourceLocale) {\n this.firstI18nSettled = true;\n return;\n }\n await this.requestI18nAndApply();\n if (\n this.i18nNeeded &&\n hasMissingSourceTranslations(this.collectSourceTexts(), this.translations)\n ) {\n await this.requestI18nAndApply();\n }\n this.firstI18nSettled = true;\n // needed:false refresh still ran with firstI18nSettled=false (empty hold).\n this.refreshAllText();\n }\n\n setI18n(locale: string, translations: TextTranslations) {\n const targetLocale = locale?.trim();\n if (!targetLocale || !translations || typeof translations !== 'object') return;\n this.targetLocale = targetLocale;\n this.translations = mergeTranslations(this.translations, translations);\n this.refreshAllText();\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Text3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Text3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.handleRemove(changed.gameObject.id);\n } else {\n this.handleChange(changed);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Text3D) as Text3D;\n if (!component) return;\n\n const entry = this.texts.get(gameObject.id);\n if (!entry) return;\n this.noteTextRender(component.text, isObjectRendered(entry.mesh));\n this.applyPose(gameObject, component, entry.mesh);\n }\n\n private handleAdd(gameObject: GameObject, component: Text3D) {\n const textMesh = new TroikaText();\n this.syncTextProps(textMesh, component);\n textMesh.sync();\n tagObject3D(textMesh, gameObject.id);\n\n this.threeContext.attachVisual(gameObject.id, textMesh, gameObject);\n this.texts.set(gameObject.id, { mesh: textMesh, component });\n this.poseBridges.set(gameObject.id, new VisualPoseBridge());\n this.rememberSourceTexts([component.text]);\n this.scheduleI18nRequest();\n }\n\n private handleChange(changed: ComponentChanged) {\n const entry = this.texts.get(changed.gameObject.id);\n if (!entry) return;\n const component = changed.component as Text3D;\n entry.component = component;\n if (changed.prop.prop[0] === 'text') this.rememberSourceTexts([component.text]);\n this.syncTextProps(entry.mesh, component);\n entry.mesh.sync();\n if (changed.prop.prop[0] === 'text') this.scheduleI18nRequest();\n }\n\n private handleRemove(id: number) {\n const entry = this.texts.get(id);\n if (!entry) return;\n\n this.threeContext.detachVisual(id, entry.mesh);\n entry.mesh.dispose();\n this.texts.delete(id);\n this.poseBridges.delete(id);\n }\n\n private syncTextProps(textMesh: TroikaText, component: Text3D) {\n textMesh.text = this.resolveText(component);\n textMesh.fontSize = component.fontSize;\n textMesh.color = component.color;\n textMesh.anchorX = component.anchorX;\n textMesh.anchorY = component.anchorY;\n if (component.maxWidth > 0) {\n textMesh.maxWidth = component.maxWidth;\n }\n if (component.font) {\n textMesh.font = component.font;\n }\n }\n\n private applyPose(gameObject: GameObject, component: Text3D, textMesh: TroikaText) {\n let bridge = this.poseBridges.get(gameObject.id);\n if (!bridge) {\n bridge = new VisualPoseBridge();\n this.poseBridges.set(gameObject.id, bridge);\n }\n const transform = gameObject.getComponent(Transform3D) as Transform3D | undefined;\n if (!bridge.sync(component, transform)) {\n textMesh.position.set(0, 0, 0);\n textMesh.rotation.set(0, 0, 0);\n return;\n }\n textMesh.position.set(component.positionX, component.positionY, component.positionZ);\n textMesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n }\n\n onDestroy() {\n this.i18nRequestId += 1;\n this.firstI18nSettled = false;\n this.i18nNeeded = false;\n this.i18nRequestInFlight = false;\n this.resolvedSourceTexts.clear();\n this.retryOnNextRender.clear();\n this.renderedSinceRetry.clear();\n for (const [id] of this.texts) {\n this.handleRemove(id);\n }\n this.texts.clear();\n }\n\n private resolveText(component: Text3D): string {\n if (\n shouldHoldForMissingTranslation(component.text, this.translations, {\n sourceLocale: this.sourceLocale,\n targetLocale: this.targetLocale,\n i18nNeeded: this.i18nNeeded,\n firstI18nSettled: this.firstI18nSettled,\n resolvedSourceTexts: this.resolvedSourceTexts,\n })\n ) {\n return '';\n }\n return localizeText(\n component.text,\n component.replacements,\n this.sourceLocale,\n this.targetLocale,\n this.translations,\n );\n }\n\n private rememberSourceTexts(texts?: Iterable<string | undefined | null>) {\n addSourceTexts(this.knownSourceTexts, texts);\n }\n\n private collectSourceTexts(): string[] {\n for (const entry of this.texts.values()) {\n this.rememberSourceTexts([entry.component.text]);\n }\n return [...this.knownSourceTexts];\n }\n\n private noteTextRender(sourceText: string, rendered: boolean) {\n const source = sourceText.trim();\n if (!source || !this.firstI18nSettled || !this.i18nNeeded) return;\n if (!rendered) {\n if (\n this.renderedSinceRetry.delete(source) &&\n !hasSourceTranslation(sourceText, this.translations)\n ) {\n this.retryOnNextRender.add(source);\n }\n return;\n }\n if (hasSourceTranslation(sourceText, this.translations)) {\n this.retryOnNextRender.delete(source);\n this.renderedSinceRetry.delete(source);\n return;\n }\n if (\n this.i18nRequestInFlight ||\n this.renderedSinceRetry.has(source) ||\n !this.retryOnNextRender.has(source)\n ) {\n return;\n }\n this.renderedSinceRetry.add(source);\n this.retryOnNextRender.delete(source);\n this.scheduleI18nRequest({ onRender: true });\n }\n private scheduleI18nRequest(options?: { onRender?: boolean }) {\n if (options?.onRender) this.renderDrivenRequest = true;\n if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestScheduled) return;\n this.i18nRequestScheduled = true;\n queueMicrotask(() => {\n this.i18nRequestScheduled = false;\n this.startI18nRequest();\n });\n }\n\n private startI18nRequest() {\n if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestInFlight) return;\n const onRender = this.renderDrivenRequest;\n this.renderDrivenRequest = false;\n const sourceTexts = this.collectSourceTexts();\n if (\n !shouldRequestI18nForSourceTexts(sourceTexts, this.translations, {\n i18nNeeded: this.i18nNeeded,\n lastRequestedSourceTexts: this.lastRequestedSourceTexts,\n renderAgain: onRender,\n })\n ) {\n return;\n }\n void this.requestI18nAndApply();\n }\n\n private async requestI18nAndApply() {\n const sourceTexts = untranslatedSourceTexts(\n this.collectSourceTexts(),\n this.translations,\n );\n if (sourceTexts.length === 0) return;\n this.lastRequestedSourceTexts = sourceTextsSignature(sourceTexts);\n const requestId = ++this.i18nRequestId;\n this.i18nRequestInFlight = true;\n try {\n const result = await requestHostI18n({\n sourceLocale: this.sourceLocale,\n sourceTexts,\n });\n if (requestId !== this.i18nRequestId) return;\n addSourceTexts(this.resolvedSourceTexts, sourceTexts);\n this.i18nNeeded = retainI18nNeeded(this.i18nNeeded, result.needed);\n if (!result.needed) {\n this.refreshAllText();\n } else {\n this.setI18n(result.locale, result.translations);\n }\n for (const text of textsToRetryOnNextRender(\n sourceTexts,\n this.translations,\n this.i18nNeeded,\n this.renderedSinceRetry,\n )) {\n this.retryOnNextRender.add(text);\n }\n } finally {\n if (requestId === this.i18nRequestId) this.i18nRequestInFlight = false;\n }\n }\n\n private refreshAllText() {\n for (const entry of this.texts.values()) {\n entry.mesh.text = this.resolveText(entry.component);\n entry.mesh.sync();\n }\n }\n}\n\nfunction isObjectRendered(object: { visible: boolean; parent: unknown }): boolean {\n const seen = new Set<object>();\n let current: { visible: boolean; parent: unknown } | null = object;\n while (current) {\n if (!current.visible) return false;\n if (seen.has(current)) return true;\n seen.add(current);\n const parent = current.parent;\n if (!parent || typeof parent !== 'object' || !('visible' in parent)) return true;\n current = parent as { visible: boolean; parent: unknown };\n }\n return true;\n}\n"],"names":["TroikaText"],"mappings":";;;;;;AAwBc,MAAO,MAAO,SAAQ,SAAuB,CAAA;AAA3D,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,IAAI,GAAW,EAAE;QAEjB,IAAA,CAAA,YAAY,GAAqB,EAAE;QAUnC,IAAA,CAAA,QAAQ,GAAW,GAAG;QAQtB,IAAA,CAAA,KAAK,GAAW,QAAQ;QAQxB,IAAA,CAAA,OAAO,GAAW,QAAQ;QAQ1B,IAAA,CAAA,OAAO,GAAW,QAAQ;QAS1B,IAAA,CAAA,QAAQ,GAAW,CAAC;QAQpB,IAAA,CAAA,IAAI,GAAW,EAAE;QASjB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;IAQvB;aAnIS,IAAA,CAAA,aAAa,GAAW,QAAX,CAAoB;AA6HxC,IAAA,IAAI,CAAC,GAAkB,EAAA;AACrB,QAAA,IAAI,CAAC,GAAG;YAAE;QACV,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG;AACrC,QAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC;AACzB,QAAA,IAAI,YAAY;AAAE,YAAA,IAAI,CAAC,YAAY,GAAG,EAAE,GAAG,YAAY,EAAE;IAC3D;;AAlHA,UAAA,CAAA;AAdC,IAAA,KAAK,CAAC;AAEL,QAAA,IAAI,EAAE,QAAQ;AAEd,QAAA,KAAK,EA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AE,YAAA,OAAO,IAAI;AAClC,QAAA,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;AACjB,QAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM;AAC7B,QAAA,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,EAAE,SAAS,IAAI,MAAM,CAAC;AAAE,YAAA,OAAO,IAAI;QAChF,OAAO,GAAG,MAA+C;IAC3D;AACA,IAAA,OAAO,IAAI;AACb;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-3d-text",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "3D text rendering, backed by troika-three-text",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-3d-text.esm.js",
@@ -28,9 +28,9 @@
28
28
  "dependencies": {
29
29
  "three": "^0.172.0",
30
30
  "troika-three-text": "^0.52.3",
31
- "@combos-fun/plugin-renderer-3d": "0.1.16",
32
- "@combos-fun/inspector-decorator": "0.1.16",
33
- "@combos-fun/engine": "0.1.16"
31
+ "@combos-fun/engine": "0.1.17",
32
+ "@combos-fun/inspector-decorator": "0.1.17",
33
+ "@combos-fun/plugin-renderer-3d": "0.1.17"
34
34
  },
35
35
  "devDependencies": {
36
36
  "tsx": "^4.20.3"