@combos-fun/plugin-renderer-3d-text 0.1.4 → 0.1.6
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 +36 -0
- package/agent-skill.md +39 -0
- package/dist/plugin-renderer-3d-text.cjs.js +261 -19
- package/dist/plugin-renderer-3d-text.cjs.js.map +1 -1
- package/dist/plugin-renderer-3d-text.cjs.prod.js +1 -1
- package/dist/plugin-renderer-3d-text.d.ts +86 -4
- package/dist/plugin-renderer-3d-text.esm.js +250 -20
- package/dist/plugin-renderer-3d-text.esm.js.map +1 -1
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -22,6 +22,42 @@ import manifest from '@combos-fun/plugin-renderer-3d-text/plugin-manifest';
|
|
|
22
22
|
// require.resolve('@combos-fun/plugin-renderer-3d-text/agent-skill')
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
## Host-driven i18n
|
|
26
|
+
|
|
27
|
+
Same host contract as `@combos-fun/plugin-renderer-text`. Configure the source
|
|
28
|
+
locale on the 3D text system. Locale names use BCP 47 tags.
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
const textSystem = new Text3DSystem({
|
|
32
|
+
sourceLocale: 'zh-CN',
|
|
33
|
+
sourceTexts: [
|
|
34
|
+
'{player} 获得了 {score} 分',
|
|
35
|
+
'开始游戏',
|
|
36
|
+
'下一屏文案',
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
new Text3D({
|
|
43
|
+
text: '{player} 获得了 {score} 分',
|
|
44
|
+
replacements: {
|
|
45
|
+
player: 'Alice',
|
|
46
|
+
score: 100,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The host injects `window.combos` into the game HTML head. The first
|
|
52
|
+
`requestI18n` runs in `beforeReady` and holds `combos-game:ready` / `start`
|
|
53
|
+
until the host replies. Put every later-screen template in `sourceTexts` so
|
|
54
|
+
those screens reuse the startup catalog instead of flashing source text.
|
|
55
|
+
If the host returns `needed: true` but a template is missing from
|
|
56
|
+
`translations`, the system merges all current texts and waits for one more
|
|
57
|
+
`requestI18n` before showing that label. Translation is applied only when
|
|
58
|
+
the result is `needed: true`. Without the injected SDK, the game stays on
|
|
59
|
+
the source text.
|
|
60
|
+
|
|
25
61
|
## License
|
|
26
62
|
|
|
27
63
|
Internal workspace package, part of the Combos Fun engine monorepo.
|
package/agent-skill.md
CHANGED
|
@@ -12,11 +12,50 @@ import { Text3D, Text3DSystem, type Text3DParams } from '@combos-fun/plugin-rend
|
|
|
12
12
|
|
|
13
13
|
`componentName = 'Text3D'`; `systemName = 'Text3DSystem'`.
|
|
14
14
|
|
|
15
|
+
For dynamic, translatable text, keep values in named `replacements`; do not
|
|
16
|
+
concatenate them into `text` and do not invent translation IDs:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
score.addComponent(new Text3D({
|
|
20
|
+
text: '{player} scored {score} points',
|
|
21
|
+
replacements: { player: 'Alice', score: 100 },
|
|
22
|
+
fontSize: 0.4,
|
|
23
|
+
}));
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Enable host-driven translation with:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
new Text3DSystem({
|
|
30
|
+
sourceLocale: 'en-US',
|
|
31
|
+
sourceTexts: ['Play', 'Next stage unlocked'],
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Pass **every** later-screen template in `sourceTexts` so the first
|
|
36
|
+
`requestI18n` translates the full catalog before `ready`. New labels then
|
|
37
|
+
reuse that cache and do not flash the source language. You can also call
|
|
38
|
+
`textSystem.declareSourceTexts([...])` during `onSystemsBootstrapComplete`.
|
|
39
|
+
|
|
40
|
+
The source template itself is the translation lookup key. After labels exist,
|
|
41
|
+
the system checks that `window.combos.requestI18n` exists. The first
|
|
42
|
+
`requestI18n({ sourceLocale, sourceTexts })` runs in `beforeReady` and holds
|
|
43
|
+
game `ready` / `start` until the host replies. Apply the result only when
|
|
44
|
+
`needed: true`. If that reply is `needed: true` but a current template is
|
|
45
|
+
missing from `translations`, merge every seeded and mounted template and
|
|
46
|
+
`requestI18n` once more before `ready`. After ready, a new label whose
|
|
47
|
+
translation is still missing stays empty, merges all current templates, waits
|
|
48
|
+
for one more `requestI18n`, then renders. `needed: false` keeps source text
|
|
49
|
+
and does not hold later labels. Do not post `i18n-ready` / `set-i18n` from
|
|
50
|
+
this plugin. If no source locale or method is present, placeholder replacement
|
|
51
|
+
still works and source text stays as-is.
|
|
52
|
+
|
|
15
53
|
## Parameters
|
|
16
54
|
|
|
17
55
|
| Field | Type | Default |
|
|
18
56
|
|-------|------|---------|
|
|
19
57
|
| `text` | `string` | `''` |
|
|
58
|
+
| `replacements` | `Record<string, string \| number>` | `{}` |
|
|
20
59
|
| `fontSize` | `number` | `0.5` |
|
|
21
60
|
| `color` | `number` | `0xffffff` |
|
|
22
61
|
| `anchorX` | `string` | `'center'` |
|
|
@@ -10,6 +10,7 @@ class Text3D extends engine.Component {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.text = '';
|
|
13
|
+
this.replacements = {};
|
|
13
14
|
this.fontSize = 0.5;
|
|
14
15
|
this.color = 0xffffff;
|
|
15
16
|
this.anchorX = 'center';
|
|
@@ -25,8 +26,12 @@ class Text3D extends engine.Component {
|
|
|
25
26
|
}
|
|
26
27
|
static { this.componentName = 'Text3D'; }
|
|
27
28
|
init(obj) {
|
|
28
|
-
if (obj)
|
|
29
|
-
|
|
29
|
+
if (!obj)
|
|
30
|
+
return;
|
|
31
|
+
const { replacements, ...rest } = obj;
|
|
32
|
+
Object.assign(this, rest);
|
|
33
|
+
if (replacements)
|
|
34
|
+
this.replacements = { ...replacements };
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
37
|
tslib.__decorate([
|
|
@@ -155,17 +160,169 @@ tslib.__decorate([
|
|
|
155
160
|
})
|
|
156
161
|
], Text3D.prototype, "rotationZ", void 0);
|
|
157
162
|
|
|
163
|
+
/** Host-injected global. The SDK itself is not part of this repo. */
|
|
164
|
+
const COMBOS_HOST_SDK = 'combos';
|
|
165
|
+
function hasCombosRequestI18n(sdk = typeof window === 'undefined' ? undefined : window.combos) {
|
|
166
|
+
return !!sdk && typeof sdk.requestI18n === 'function';
|
|
167
|
+
}
|
|
168
|
+
function parseI18nResult(data) {
|
|
169
|
+
if (!data || typeof data !== 'object')
|
|
170
|
+
return { needed: false };
|
|
171
|
+
const input = data;
|
|
172
|
+
if (input.needed !== true)
|
|
173
|
+
return { needed: false };
|
|
174
|
+
if (typeof input.locale !== 'string' || !input.locale.trim()) {
|
|
175
|
+
return { needed: false };
|
|
176
|
+
}
|
|
177
|
+
if (!input.translations ||
|
|
178
|
+
typeof input.translations !== 'object' ||
|
|
179
|
+
Array.isArray(input.translations)) {
|
|
180
|
+
return { needed: false };
|
|
181
|
+
}
|
|
182
|
+
const entries = Object.entries(input.translations);
|
|
183
|
+
if (entries.some(([, value]) => typeof value !== 'string')) {
|
|
184
|
+
return { needed: false };
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
needed: true,
|
|
188
|
+
locale: input.locale.trim(),
|
|
189
|
+
translations: Object.fromEntries(entries),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/** Ask the injected host SDK. Always resolves; missing method means no translation. */
|
|
193
|
+
async function requestHostI18n(request) {
|
|
194
|
+
if (typeof window === 'undefined' || !hasCombosRequestI18n(window.combos)) {
|
|
195
|
+
return { needed: false };
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
return parseI18nResult(await window.combos.requestI18n(request));
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return { needed: false };
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** Keep identical to `@combos-fun/plugin-renderer-text` localization. */
|
|
206
|
+
const PLACEHOLDER_PATTERN = /\{([A-Za-z_$][\w$.-]*)\}/g;
|
|
207
|
+
function interpolateText(template, replacements) {
|
|
208
|
+
if (!replacements)
|
|
209
|
+
return template;
|
|
210
|
+
return template.replace(PLACEHOLDER_PATTERN, (placeholder, name) => {
|
|
211
|
+
if (!Object.prototype.hasOwnProperty.call(replacements, name)) {
|
|
212
|
+
return placeholder;
|
|
213
|
+
}
|
|
214
|
+
return String(replacements[name]);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
function findTranslatedTemplate(sourceText, translations) {
|
|
218
|
+
if (Object.prototype.hasOwnProperty.call(translations, sourceText)) {
|
|
219
|
+
return translations[sourceText];
|
|
220
|
+
}
|
|
221
|
+
const trimmed = sourceText.trim();
|
|
222
|
+
if (trimmed &&
|
|
223
|
+
trimmed !== sourceText &&
|
|
224
|
+
Object.prototype.hasOwnProperty.call(translations, trimmed)) {
|
|
225
|
+
return translations[trimmed];
|
|
226
|
+
}
|
|
227
|
+
return undefined;
|
|
228
|
+
}
|
|
229
|
+
function hasSourceTranslation(sourceText, translations) {
|
|
230
|
+
return findTranslatedTemplate(sourceText, translations) !== undefined;
|
|
231
|
+
}
|
|
232
|
+
function hasMissingSourceTranslations(sourceTexts, translations) {
|
|
233
|
+
return sourceTexts.some((text) => !hasSourceTranslation(text, translations));
|
|
234
|
+
}
|
|
235
|
+
function shouldHoldForMissingTranslation(sourceText, translations, state) {
|
|
236
|
+
if (!state.sourceLocale || !state.i18nNeeded || !state.firstI18nSettled)
|
|
237
|
+
return false;
|
|
238
|
+
if (state.sourceLocale.toLowerCase() === state.targetLocale.toLowerCase())
|
|
239
|
+
return false;
|
|
240
|
+
const trimmed = sourceText.trim();
|
|
241
|
+
if (!trimmed)
|
|
242
|
+
return false;
|
|
243
|
+
if (hasSourceTranslation(sourceText, translations))
|
|
244
|
+
return false;
|
|
245
|
+
return !state.resolvedSourceTexts.has(trimmed);
|
|
246
|
+
}
|
|
247
|
+
function localizeText(sourceText, replacements, sourceLocale, targetLocale, translations) {
|
|
248
|
+
const shouldTranslate = !!sourceLocale &&
|
|
249
|
+
!!targetLocale &&
|
|
250
|
+
sourceLocale.toLowerCase() !== targetLocale.toLowerCase();
|
|
251
|
+
const template = shouldTranslate
|
|
252
|
+
? findTranslatedTemplate(sourceText, translations) ?? sourceText
|
|
253
|
+
: sourceText;
|
|
254
|
+
return interpolateText(template, replacements);
|
|
255
|
+
}
|
|
256
|
+
function addSourceTexts(target, texts) {
|
|
257
|
+
if (!texts)
|
|
258
|
+
return;
|
|
259
|
+
for (const text of texts) {
|
|
260
|
+
const source = typeof text === 'string' ? text.trim() : '';
|
|
261
|
+
if (source)
|
|
262
|
+
target.add(source);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function mergeTranslations(current, incoming) {
|
|
266
|
+
const next = { ...current };
|
|
267
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
268
|
+
if (typeof value === 'string')
|
|
269
|
+
next[key] = value;
|
|
270
|
+
}
|
|
271
|
+
return next;
|
|
272
|
+
}
|
|
273
|
+
|
|
158
274
|
let Text3DSystem = class Text3DSystem extends pluginRenderer3d.Renderer3D {
|
|
159
275
|
constructor() {
|
|
160
276
|
super(...arguments);
|
|
161
277
|
this.name = 'Text3DSystem';
|
|
162
278
|
this.texts = new Map();
|
|
163
279
|
this.poseBridges = new Map();
|
|
280
|
+
this.sourceLocale = '';
|
|
281
|
+
this.targetLocale = '';
|
|
282
|
+
this.translations = {};
|
|
283
|
+
this.seededSourceTexts = new Set();
|
|
284
|
+
this.lastRequestedSourceTexts = '';
|
|
285
|
+
this.i18nRequestScheduled = false;
|
|
286
|
+
this.i18nRequestId = 0;
|
|
287
|
+
this.firstI18nSettled = false;
|
|
288
|
+
this.i18nNeeded = false;
|
|
289
|
+
this.resolvedSourceTexts = new Set();
|
|
164
290
|
}
|
|
165
291
|
static { this.systemName = 'Text3DSystem'; }
|
|
166
|
-
init() {
|
|
292
|
+
init(params) {
|
|
167
293
|
const renderer3DSystem = this.game.getSystem(pluginRenderer3d.Renderer3DSystem);
|
|
168
294
|
renderer3DSystem.rendererManager.register(this);
|
|
295
|
+
this.sourceLocale = params?.sourceLocale?.trim() ?? '';
|
|
296
|
+
this.targetLocale = this.sourceLocale;
|
|
297
|
+
this.declareSourceTexts(params?.sourceTexts);
|
|
298
|
+
}
|
|
299
|
+
/** Register extra source templates before or after ready. First request includes these. */
|
|
300
|
+
declareSourceTexts(texts) {
|
|
301
|
+
addSourceTexts(this.seededSourceTexts, texts);
|
|
302
|
+
this.scheduleI18nRequest();
|
|
303
|
+
}
|
|
304
|
+
async beforeReady() {
|
|
305
|
+
if (this.firstI18nSettled)
|
|
306
|
+
return;
|
|
307
|
+
this.update();
|
|
308
|
+
if (!this.sourceLocale) {
|
|
309
|
+
this.firstI18nSettled = true;
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
await this.requestI18nAndApply();
|
|
313
|
+
if (this.i18nNeeded &&
|
|
314
|
+
hasMissingSourceTranslations(this.collectSourceTexts(), this.translations)) {
|
|
315
|
+
await this.requestI18nAndApply();
|
|
316
|
+
}
|
|
317
|
+
this.firstI18nSettled = true;
|
|
318
|
+
}
|
|
319
|
+
setI18n(locale, translations) {
|
|
320
|
+
const targetLocale = locale?.trim();
|
|
321
|
+
if (!targetLocale || !translations || typeof translations !== 'object')
|
|
322
|
+
return;
|
|
323
|
+
this.targetLocale = targetLocale;
|
|
324
|
+
this.translations = mergeTranslations(this.translations, translations);
|
|
325
|
+
this.refreshAllText();
|
|
169
326
|
}
|
|
170
327
|
componentChanged(changed) {
|
|
171
328
|
if (changed.componentName !== 'Text3D')
|
|
@@ -177,17 +334,17 @@ let Text3DSystem = class Text3DSystem extends pluginRenderer3d.Renderer3D {
|
|
|
177
334
|
this.handleRemove(changed.gameObject.id);
|
|
178
335
|
}
|
|
179
336
|
else {
|
|
180
|
-
this.handleChange(changed
|
|
337
|
+
this.handleChange(changed);
|
|
181
338
|
}
|
|
182
339
|
}
|
|
183
340
|
rendererUpdate(gameObject) {
|
|
184
341
|
const component = gameObject.getComponent(Text3D);
|
|
185
342
|
if (!component)
|
|
186
343
|
return;
|
|
187
|
-
const
|
|
188
|
-
if (!
|
|
344
|
+
const entry = this.texts.get(gameObject.id);
|
|
345
|
+
if (!entry)
|
|
189
346
|
return;
|
|
190
|
-
this.applyPose(gameObject, component,
|
|
347
|
+
this.applyPose(gameObject, component, entry.mesh);
|
|
191
348
|
}
|
|
192
349
|
handleAdd(gameObject, component) {
|
|
193
350
|
const textMesh = new troikaThreeText.Text();
|
|
@@ -195,27 +352,32 @@ let Text3DSystem = class Text3DSystem extends pluginRenderer3d.Renderer3D {
|
|
|
195
352
|
textMesh.sync();
|
|
196
353
|
pluginRenderer3d.tagObject3D(textMesh, gameObject.id);
|
|
197
354
|
this.threeContext.attachVisual(gameObject.id, textMesh, gameObject);
|
|
198
|
-
this.texts.set(gameObject.id, textMesh);
|
|
355
|
+
this.texts.set(gameObject.id, { mesh: textMesh, component });
|
|
199
356
|
this.poseBridges.set(gameObject.id, new pluginRenderer3d.VisualPoseBridge());
|
|
357
|
+
this.scheduleI18nRequest();
|
|
200
358
|
}
|
|
201
|
-
handleChange(
|
|
202
|
-
const
|
|
203
|
-
if (!
|
|
359
|
+
handleChange(changed) {
|
|
360
|
+
const entry = this.texts.get(changed.gameObject.id);
|
|
361
|
+
if (!entry)
|
|
204
362
|
return;
|
|
205
|
-
|
|
206
|
-
|
|
363
|
+
const component = changed.component;
|
|
364
|
+
entry.component = component;
|
|
365
|
+
this.syncTextProps(entry.mesh, component);
|
|
366
|
+
entry.mesh.sync();
|
|
367
|
+
if (changed.prop.prop[0] === 'text')
|
|
368
|
+
this.scheduleI18nRequest();
|
|
207
369
|
}
|
|
208
370
|
handleRemove(id) {
|
|
209
|
-
const
|
|
210
|
-
if (!
|
|
371
|
+
const entry = this.texts.get(id);
|
|
372
|
+
if (!entry)
|
|
211
373
|
return;
|
|
212
|
-
this.threeContext.detachVisual(id,
|
|
213
|
-
|
|
374
|
+
this.threeContext.detachVisual(id, entry.mesh);
|
|
375
|
+
entry.mesh.dispose();
|
|
214
376
|
this.texts.delete(id);
|
|
215
377
|
this.poseBridges.delete(id);
|
|
216
378
|
}
|
|
217
379
|
syncTextProps(textMesh, component) {
|
|
218
|
-
textMesh.text = component
|
|
380
|
+
textMesh.text = this.resolveText(component);
|
|
219
381
|
textMesh.fontSize = component.fontSize;
|
|
220
382
|
textMesh.color = component.color;
|
|
221
383
|
textMesh.anchorX = component.anchorX;
|
|
@@ -243,16 +405,84 @@ let Text3DSystem = class Text3DSystem extends pluginRenderer3d.Renderer3D {
|
|
|
243
405
|
textMesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
|
|
244
406
|
}
|
|
245
407
|
onDestroy() {
|
|
408
|
+
this.i18nRequestId += 1;
|
|
409
|
+
this.firstI18nSettled = false;
|
|
410
|
+
this.i18nNeeded = false;
|
|
411
|
+
this.resolvedSourceTexts.clear();
|
|
246
412
|
for (const [id] of this.texts) {
|
|
247
413
|
this.handleRemove(id);
|
|
248
414
|
}
|
|
249
415
|
this.texts.clear();
|
|
250
416
|
}
|
|
417
|
+
resolveText(component) {
|
|
418
|
+
if (shouldHoldForMissingTranslation(component.text, this.translations, {
|
|
419
|
+
sourceLocale: this.sourceLocale,
|
|
420
|
+
targetLocale: this.targetLocale,
|
|
421
|
+
i18nNeeded: this.i18nNeeded,
|
|
422
|
+
firstI18nSettled: this.firstI18nSettled,
|
|
423
|
+
resolvedSourceTexts: this.resolvedSourceTexts,
|
|
424
|
+
})) {
|
|
425
|
+
return '';
|
|
426
|
+
}
|
|
427
|
+
return localizeText(component.text, component.replacements, this.sourceLocale, this.targetLocale, this.translations);
|
|
428
|
+
}
|
|
429
|
+
collectSourceTexts() {
|
|
430
|
+
const sourceTexts = new Set(this.seededSourceTexts);
|
|
431
|
+
for (const entry of this.texts.values()) {
|
|
432
|
+
addSourceTexts(sourceTexts, [entry.component.text]);
|
|
433
|
+
}
|
|
434
|
+
return [...sourceTexts];
|
|
435
|
+
}
|
|
436
|
+
scheduleI18nRequest() {
|
|
437
|
+
if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestScheduled)
|
|
438
|
+
return;
|
|
439
|
+
this.i18nRequestScheduled = true;
|
|
440
|
+
queueMicrotask(() => {
|
|
441
|
+
this.i18nRequestScheduled = false;
|
|
442
|
+
this.startI18nRequest();
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
startI18nRequest() {
|
|
446
|
+
if (!this.sourceLocale || !this.firstI18nSettled)
|
|
447
|
+
return;
|
|
448
|
+
const sourceTexts = this.collectSourceTexts();
|
|
449
|
+
const signature = [...sourceTexts].sort().join('\0');
|
|
450
|
+
if (signature === this.lastRequestedSourceTexts)
|
|
451
|
+
return;
|
|
452
|
+
void this.requestI18nAndApply();
|
|
453
|
+
}
|
|
454
|
+
async requestI18nAndApply() {
|
|
455
|
+
const sourceTexts = this.collectSourceTexts();
|
|
456
|
+
const signature = [...sourceTexts].sort().join('\0');
|
|
457
|
+
this.lastRequestedSourceTexts = signature;
|
|
458
|
+
const requestId = ++this.i18nRequestId;
|
|
459
|
+
const result = await requestHostI18n({
|
|
460
|
+
sourceLocale: this.sourceLocale,
|
|
461
|
+
sourceTexts,
|
|
462
|
+
});
|
|
463
|
+
if (requestId !== this.i18nRequestId)
|
|
464
|
+
return;
|
|
465
|
+
addSourceTexts(this.resolvedSourceTexts, sourceTexts);
|
|
466
|
+
this.i18nNeeded = result.needed;
|
|
467
|
+
if (!result.needed) {
|
|
468
|
+
this.refreshAllText();
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
this.setI18n(result.locale, result.translations);
|
|
472
|
+
}
|
|
473
|
+
refreshAllText() {
|
|
474
|
+
for (const entry of this.texts.values()) {
|
|
475
|
+
entry.mesh.text = this.resolveText(entry.component);
|
|
476
|
+
entry.mesh.sync();
|
|
477
|
+
}
|
|
478
|
+
}
|
|
251
479
|
};
|
|
252
480
|
Text3DSystem = tslib.__decorate([
|
|
253
481
|
engine.decorators.componentObserver({
|
|
254
482
|
Text3D: [
|
|
255
|
-
'text',
|
|
483
|
+
'text',
|
|
484
|
+
{ prop: ['replacements'], deep: true },
|
|
485
|
+
'fontSize', 'color', 'anchorX', 'anchorY', 'maxWidth', 'font',
|
|
256
486
|
'positionX', 'positionY', 'positionZ',
|
|
257
487
|
'rotationX', 'rotationY', 'rotationZ',
|
|
258
488
|
],
|
|
@@ -260,6 +490,18 @@ Text3DSystem = tslib.__decorate([
|
|
|
260
490
|
], Text3DSystem);
|
|
261
491
|
var Text3DSystem_default = Text3DSystem;
|
|
262
492
|
|
|
493
|
+
exports.COMBOS_HOST_SDK = COMBOS_HOST_SDK;
|
|
263
494
|
exports.Text3D = Text3D;
|
|
264
495
|
exports.Text3DSystem = Text3DSystem_default;
|
|
496
|
+
exports.addSourceTexts = addSourceTexts;
|
|
497
|
+
exports.findTranslatedTemplate = findTranslatedTemplate;
|
|
498
|
+
exports.hasCombosRequestI18n = hasCombosRequestI18n;
|
|
499
|
+
exports.hasMissingSourceTranslations = hasMissingSourceTranslations;
|
|
500
|
+
exports.hasSourceTranslation = hasSourceTranslation;
|
|
501
|
+
exports.interpolateText = interpolateText;
|
|
502
|
+
exports.localizeText = localizeText;
|
|
503
|
+
exports.mergeTranslations = mergeTranslations;
|
|
504
|
+
exports.parseI18nResult = parseI18nResult;
|
|
505
|
+
exports.requestHostI18n = requestHostI18n;
|
|
506
|
+
exports.shouldHoldForMissingTranslation = shouldHoldForMissingTranslation;
|
|
265
507
|
//# 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/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Text3DParams {\n text?: string;\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 @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) Object.assign(this, obj);\n }\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';\n\n@decorators.componentObserver({\n Text3D: [\n 'text', 'fontSize', 'color', 'anchorX', 'anchorY', 'maxWidth', 'font',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n ],\n})\nexport default class Text3DSystem extends Renderer3D {\n static systemName = 'Text3DSystem';\n name: string = 'Text3DSystem';\n\n private texts: Map<number, TroikaText> = new Map();\n private poseBridges = new Map<number, VisualPoseBridge>();\n\n init() {\n const renderer3DSystem = this.game.getSystem(Renderer3DSystem) as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\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.gameObject.id, changed.component as Text3D);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Text3D) as Text3D;\n if (!component) return;\n\n const textMesh = this.texts.get(gameObject.id);\n if (!textMesh) return;\n this.applyPose(gameObject, component, textMesh);\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, textMesh);\n this.poseBridges.set(gameObject.id, new VisualPoseBridge());\n }\n\n private handleChange(id: number, component: Text3D) {\n const textMesh = this.texts.get(id);\n if (!textMesh) return;\n\n this.syncTextProps(textMesh, component);\n textMesh.sync();\n }\n\n private handleRemove(id: number) {\n const textMesh = this.texts.get(id);\n if (!textMesh) return;\n\n this.threeContext.detachVisual(id, textMesh);\n textMesh.dispose();\n this.texts.delete(id);\n this.poseBridges.delete(id);\n }\n\n private syncTextProps(textMesh: TroikaText, component: Text3D) {\n textMesh.text = component.text;\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 for (const [id] of this.texts) {\n this.handleRemove(id);\n }\n this.texts.clear();\n }\n}\n"],"names":["Component","__decorate","Field","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","TroikaText","tagObject3D","VisualPoseBridge","Transform3D","decorators"],"mappings":";;;;;;;;AAmBc,MAAO,MAAO,SAAQA,gBAAuB,CAAA;AAA3D,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAA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O,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM;YACrE,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACtC,SAAA;KACF;AACoB,CAAA,EAAA,YAAY,CAkGhC;2BAlGoB,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\nexport function hasMissingSourceTranslations(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n): boolean {\n return sourceTexts.some((text) => !hasSourceTranslation(text, translations));\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 || !state.i18nNeeded || !state.firstI18nSettled) return false;\n if (state.sourceLocale.toLowerCase() === state.targetLocale.toLowerCase()) return false;\n const trimmed = sourceText.trim();\n if (!trimmed) return false;\n if (hasSourceTranslation(sourceText, translations)) 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 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. Later `Text3D` nodes reuse this catalog\n * and will not flash the source language.\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 private seededSourceTexts = 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 addSourceTexts(this.seededSourceTexts, 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 }\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.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 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 collectSourceTexts(): string[] {\n const sourceTexts = new Set(this.seededSourceTexts);\n for (const entry of this.texts.values()) {\n addSourceTexts(sourceTexts, [entry.component.text]);\n }\n return [...sourceTexts];\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 const signature = [...sourceTexts].sort().join('\\0');\n if (signature === this.lastRequestedSourceTexts) return;\n void this.requestI18nAndApply();\n }\n\n private async requestI18nAndApply() {\n const sourceTexts = this.collectSourceTexts();\n const signature = [...sourceTexts].sort().join('\\0');\n this.lastRequestedSourceTexts = signature;\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,C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C,KAAK,CAAC,SAAS,CAAC;AACnD,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE;QACnB;IACF;;AA5NmB,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,CA6NhC;2BA7NoB,YAAY;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
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 h(e,t){return void 0!==l(e,t)}function u(e,t){return e.some(e=>!h(e,t))}function x(e,t,o){if(!o.sourceLocale||!o.i18nNeeded||!o.firstI18nSettled)return!1;if(o.sourceLocale.toLowerCase()===o.targetLocale.toLowerCase())return!1;const s=e.trim();return!!s&&(!h(e,t)&&!o.resolvedSourceTexts.has(s))}function m(e,t,o,s,r){return p(!!o&&!!s&&o.toLowerCase()!==s.toLowerCase()?l(e,r)??e:e,t)}function f(e,t){if(t)for(const o of t){const t="string"==typeof o?o.trim():"";t&&e.add(t)}}function y(e,t){const o={...e};for(const[e,s]of Object.entries(t))"string"==typeof s&&(o[e]=s);return o}let T=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.seededSourceTexts=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){f(this.seededSourceTexts,e),this.scheduleI18nRequest()}async beforeReady(){this.firstI18nSettled||(this.update(),this.sourceLocale?(await this.requestI18nAndApply(),this.i18nNeeded&&u(this.collectSourceTexts(),this.translations)&&await this.requestI18nAndApply(),this.firstI18nSettled=!0):this.firstI18nSettled=!0)}setI18n(e,t){const o=e?.trim();o&&t&&"object"==typeof t&&(this.targetLocale=o,this.translations=y(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.scheduleI18nRequest()}handleChange(e){const t=this.texts.get(e.gameObject.id);if(!t)return;const o=e.component;t.component=o,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 x(e.text,this.translations,{sourceLocale:this.sourceLocale,targetLocale:this.targetLocale,i18nNeeded:this.i18nNeeded,firstI18nSettled:this.firstI18nSettled,resolvedSourceTexts:this.resolvedSourceTexts})?"":m(e.text,e.replacements,this.sourceLocale,this.targetLocale,this.translations)}collectSourceTexts(){const e=new Set(this.seededSourceTexts);for(const t of this.texts.values())f(e,[t.component.text]);return[...e]}scheduleI18nRequest(){this.sourceLocale&&this.firstI18nSettled&&!this.i18nRequestScheduled&&(this.i18nRequestScheduled=!0,queueMicrotask(()=>{this.i18nRequestScheduled=!1,this.startI18nRequest()}))}startI18nRequest(){if(!this.sourceLocale||!this.firstI18nSettled)return;[...this.collectSourceTexts()].sort().join("\0")!==this.lastRequestedSourceTexts&&this.requestI18nAndApply()}async requestI18nAndApply(){const e=this.collectSourceTexts(),t=[...e].sort().join("\0");this.lastRequestedSourceTexts=t;const o=++this.i18nRequestId,s=await c({sourceLocale:this.sourceLocale,sourceTexts:e});o===this.i18nRequestId&&(f(this.resolvedSourceTexts,e),this.i18nNeeded=s.needed,s.needed?this.setI18n(s.locale,s.translations):this.refreshAllText())}refreshAllText(){for(const e of this.texts.values())e.mesh.text=this.resolveText(e.component),e.mesh.sync()}};T=e.__decorate([t.decorators.componentObserver({Text3D:["text",{prop:["replacements"],deep:!0},"fontSize","color","anchorX","anchorY","maxWidth","font","positionX","positionY","positionZ","rotationX","rotationY","rotationZ"]})],T);var g=T;exports.COMBOS_HOST_SDK="combos",exports.Text3D=i,exports.Text3DSystem=g,exports.addSourceTexts=f,exports.findTranslatedTemplate=l,exports.hasCombosRequestI18n=n,exports.hasMissingSourceTranslations=u,exports.hasSourceTranslation=h,exports.interpolateText=p,exports.localizeText=m,exports.mergeTranslations=y,exports.parseI18nResult=a,exports.requestHostI18n=c,exports.shouldHoldForMissingTranslation=x;
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
import { Component, ComponentChanged, GameObject } from '@combos-fun/engine';
|
|
2
2
|
import { Renderer3D } from '@combos-fun/plugin-renderer-3d';
|
|
3
3
|
|
|
4
|
+
/** Keep identical to `@combos-fun/plugin-renderer-text` localization. */
|
|
5
|
+
type TextReplacementValue = string | number;
|
|
6
|
+
type TextReplacements = Record<string, TextReplacementValue>;
|
|
7
|
+
type TextTranslations = Record<string, string>;
|
|
8
|
+
declare function interpolateText(template: string, replacements?: TextReplacements): string;
|
|
9
|
+
declare function findTranslatedTemplate(sourceText: string, translations: TextTranslations): string | undefined;
|
|
10
|
+
declare function hasSourceTranslation(sourceText: string, translations: TextTranslations): boolean;
|
|
11
|
+
declare function hasMissingSourceTranslations(sourceTexts: readonly string[], translations: TextTranslations): boolean;
|
|
12
|
+
declare function shouldHoldForMissingTranslation(sourceText: string, translations: TextTranslations, state: {
|
|
13
|
+
sourceLocale: string;
|
|
14
|
+
targetLocale: string;
|
|
15
|
+
i18nNeeded: boolean;
|
|
16
|
+
firstI18nSettled: boolean;
|
|
17
|
+
resolvedSourceTexts: ReadonlySet<string>;
|
|
18
|
+
}): boolean;
|
|
19
|
+
declare function localizeText(sourceText: string, replacements: TextReplacements | undefined, sourceLocale: string, targetLocale: string, translations: TextTranslations): string;
|
|
20
|
+
declare function addSourceTexts(target: Set<string>, texts?: Iterable<string | undefined | null>): void;
|
|
21
|
+
declare function mergeTranslations(current: TextTranslations, incoming: Record<string, unknown>): TextTranslations;
|
|
22
|
+
|
|
4
23
|
interface Text3DParams {
|
|
5
24
|
text?: string;
|
|
25
|
+
/** Values substituted into named placeholders such as `{score}`. */
|
|
26
|
+
replacements?: TextReplacements;
|
|
6
27
|
fontSize?: number;
|
|
7
28
|
color?: number;
|
|
8
29
|
anchorX?: string;
|
|
@@ -19,6 +40,7 @@ interface Text3DParams {
|
|
|
19
40
|
declare class Text3D extends Component<Text3DParams> {
|
|
20
41
|
static componentName: string;
|
|
21
42
|
text: string;
|
|
43
|
+
replacements: TextReplacements;
|
|
22
44
|
fontSize: number;
|
|
23
45
|
color: number;
|
|
24
46
|
anchorX: string;
|
|
@@ -34,12 +56,36 @@ declare class Text3D extends Component<Text3DParams> {
|
|
|
34
56
|
init(obj?: Text3DParams): void;
|
|
35
57
|
}
|
|
36
58
|
|
|
37
|
-
|
|
59
|
+
interface Text3DSystemParams {
|
|
60
|
+
/** BCP 47 locale of the source text, for example `zh-CN`. Omit to disable host-driven i18n. */
|
|
61
|
+
sourceLocale?: string;
|
|
62
|
+
/**
|
|
63
|
+
* All source templates to translate on first `requestI18n`, including copy
|
|
64
|
+
* for screens that are not mounted yet. Later `Text3D` nodes reuse this catalog
|
|
65
|
+
* and will not flash the source language.
|
|
66
|
+
*/
|
|
67
|
+
sourceTexts?: string[];
|
|
68
|
+
}
|
|
69
|
+
declare class Text3DSystem extends Renderer3D<Text3DSystemParams> {
|
|
38
70
|
static systemName: string;
|
|
39
71
|
name: string;
|
|
40
72
|
private texts;
|
|
41
73
|
private poseBridges;
|
|
42
|
-
|
|
74
|
+
private sourceLocale;
|
|
75
|
+
private targetLocale;
|
|
76
|
+
private translations;
|
|
77
|
+
private seededSourceTexts;
|
|
78
|
+
private lastRequestedSourceTexts;
|
|
79
|
+
private i18nRequestScheduled;
|
|
80
|
+
private i18nRequestId;
|
|
81
|
+
private firstI18nSettled;
|
|
82
|
+
private i18nNeeded;
|
|
83
|
+
private resolvedSourceTexts;
|
|
84
|
+
init(params?: Text3DSystemParams): void;
|
|
85
|
+
/** Register extra source templates before or after ready. First request includes these. */
|
|
86
|
+
declareSourceTexts(texts?: string[]): void;
|
|
87
|
+
beforeReady(): Promise<void>;
|
|
88
|
+
setI18n(locale: string, translations: TextTranslations): void;
|
|
43
89
|
componentChanged(changed: ComponentChanged): void;
|
|
44
90
|
rendererUpdate(gameObject: GameObject): void;
|
|
45
91
|
private handleAdd;
|
|
@@ -48,7 +94,43 @@ declare class Text3DSystem extends Renderer3D {
|
|
|
48
94
|
private syncTextProps;
|
|
49
95
|
private applyPose;
|
|
50
96
|
onDestroy(): void;
|
|
97
|
+
private resolveText;
|
|
98
|
+
private collectSourceTexts;
|
|
99
|
+
private scheduleI18nRequest;
|
|
100
|
+
private startI18nRequest;
|
|
101
|
+
private requestI18nAndApply;
|
|
102
|
+
private refreshAllText;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Keep identical to `@combos-fun/plugin-renderer-text` hostSdk. */
|
|
106
|
+
|
|
107
|
+
/** Host-injected global. The SDK itself is not part of this repo. */
|
|
108
|
+
declare const COMBOS_HOST_SDK: "combos";
|
|
109
|
+
interface CombosI18nRequest {
|
|
110
|
+
sourceLocale: string;
|
|
111
|
+
sourceTexts: string[];
|
|
112
|
+
}
|
|
113
|
+
type CombosI18nResult = {
|
|
114
|
+
needed: false;
|
|
115
|
+
} | {
|
|
116
|
+
needed: true;
|
|
117
|
+
locale: string;
|
|
118
|
+
translations: TextTranslations;
|
|
119
|
+
};
|
|
120
|
+
interface CombosHostSdk {
|
|
121
|
+
requestI18n?(request: CombosI18nRequest): Promise<CombosI18nResult>;
|
|
122
|
+
}
|
|
123
|
+
declare global {
|
|
124
|
+
interface Window {
|
|
125
|
+
combos?: CombosHostSdk;
|
|
126
|
+
}
|
|
51
127
|
}
|
|
128
|
+
declare function hasCombosRequestI18n(sdk?: CombosHostSdk | undefined | null): sdk is CombosHostSdk & {
|
|
129
|
+
requestI18n: NonNullable<CombosHostSdk['requestI18n']>;
|
|
130
|
+
};
|
|
131
|
+
declare function parseI18nResult(data: unknown): CombosI18nResult;
|
|
132
|
+
/** Ask the injected host SDK. Always resolves; missing method means no translation. */
|
|
133
|
+
declare function requestHostI18n(request: CombosI18nRequest): Promise<CombosI18nResult>;
|
|
52
134
|
|
|
53
|
-
export { Text3D, Text3DSystem };
|
|
54
|
-
export type { Text3DParams };
|
|
135
|
+
export { COMBOS_HOST_SDK, Text3D, Text3DSystem, addSourceTexts, findTranslatedTemplate, hasCombosRequestI18n, hasMissingSourceTranslations, hasSourceTranslation, interpolateText, localizeText, mergeTranslations, parseI18nResult, requestHostI18n, shouldHoldForMissingTranslation };
|
|
136
|
+
export type { CombosHostSdk, CombosI18nRequest, CombosI18nResult, Text3DParams, Text3DSystemParams, TextReplacementValue, TextReplacements, TextTranslations };
|
|
@@ -8,6 +8,7 @@ class Text3D extends Component {
|
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
|
10
10
|
this.text = '';
|
|
11
|
+
this.replacements = {};
|
|
11
12
|
this.fontSize = 0.5;
|
|
12
13
|
this.color = 0xffffff;
|
|
13
14
|
this.anchorX = 'center';
|
|
@@ -23,8 +24,12 @@ class Text3D extends Component {
|
|
|
23
24
|
}
|
|
24
25
|
static { this.componentName = 'Text3D'; }
|
|
25
26
|
init(obj) {
|
|
26
|
-
if (obj)
|
|
27
|
-
|
|
27
|
+
if (!obj)
|
|
28
|
+
return;
|
|
29
|
+
const { replacements, ...rest } = obj;
|
|
30
|
+
Object.assign(this, rest);
|
|
31
|
+
if (replacements)
|
|
32
|
+
this.replacements = { ...replacements };
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
35
|
__decorate([
|
|
@@ -153,17 +158,169 @@ __decorate([
|
|
|
153
158
|
})
|
|
154
159
|
], Text3D.prototype, "rotationZ", void 0);
|
|
155
160
|
|
|
161
|
+
/** Host-injected global. The SDK itself is not part of this repo. */
|
|
162
|
+
const COMBOS_HOST_SDK = 'combos';
|
|
163
|
+
function hasCombosRequestI18n(sdk = typeof window === 'undefined' ? undefined : window.combos) {
|
|
164
|
+
return !!sdk && typeof sdk.requestI18n === 'function';
|
|
165
|
+
}
|
|
166
|
+
function parseI18nResult(data) {
|
|
167
|
+
if (!data || typeof data !== 'object')
|
|
168
|
+
return { needed: false };
|
|
169
|
+
const input = data;
|
|
170
|
+
if (input.needed !== true)
|
|
171
|
+
return { needed: false };
|
|
172
|
+
if (typeof input.locale !== 'string' || !input.locale.trim()) {
|
|
173
|
+
return { needed: false };
|
|
174
|
+
}
|
|
175
|
+
if (!input.translations ||
|
|
176
|
+
typeof input.translations !== 'object' ||
|
|
177
|
+
Array.isArray(input.translations)) {
|
|
178
|
+
return { needed: false };
|
|
179
|
+
}
|
|
180
|
+
const entries = Object.entries(input.translations);
|
|
181
|
+
if (entries.some(([, value]) => typeof value !== 'string')) {
|
|
182
|
+
return { needed: false };
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
needed: true,
|
|
186
|
+
locale: input.locale.trim(),
|
|
187
|
+
translations: Object.fromEntries(entries),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/** Ask the injected host SDK. Always resolves; missing method means no translation. */
|
|
191
|
+
async function requestHostI18n(request) {
|
|
192
|
+
if (typeof window === 'undefined' || !hasCombosRequestI18n(window.combos)) {
|
|
193
|
+
return { needed: false };
|
|
194
|
+
}
|
|
195
|
+
try {
|
|
196
|
+
return parseI18nResult(await window.combos.requestI18n(request));
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return { needed: false };
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** Keep identical to `@combos-fun/plugin-renderer-text` localization. */
|
|
204
|
+
const PLACEHOLDER_PATTERN = /\{([A-Za-z_$][\w$.-]*)\}/g;
|
|
205
|
+
function interpolateText(template, replacements) {
|
|
206
|
+
if (!replacements)
|
|
207
|
+
return template;
|
|
208
|
+
return template.replace(PLACEHOLDER_PATTERN, (placeholder, name) => {
|
|
209
|
+
if (!Object.prototype.hasOwnProperty.call(replacements, name)) {
|
|
210
|
+
return placeholder;
|
|
211
|
+
}
|
|
212
|
+
return String(replacements[name]);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function findTranslatedTemplate(sourceText, translations) {
|
|
216
|
+
if (Object.prototype.hasOwnProperty.call(translations, sourceText)) {
|
|
217
|
+
return translations[sourceText];
|
|
218
|
+
}
|
|
219
|
+
const trimmed = sourceText.trim();
|
|
220
|
+
if (trimmed &&
|
|
221
|
+
trimmed !== sourceText &&
|
|
222
|
+
Object.prototype.hasOwnProperty.call(translations, trimmed)) {
|
|
223
|
+
return translations[trimmed];
|
|
224
|
+
}
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
function hasSourceTranslation(sourceText, translations) {
|
|
228
|
+
return findTranslatedTemplate(sourceText, translations) !== undefined;
|
|
229
|
+
}
|
|
230
|
+
function hasMissingSourceTranslations(sourceTexts, translations) {
|
|
231
|
+
return sourceTexts.some((text) => !hasSourceTranslation(text, translations));
|
|
232
|
+
}
|
|
233
|
+
function shouldHoldForMissingTranslation(sourceText, translations, state) {
|
|
234
|
+
if (!state.sourceLocale || !state.i18nNeeded || !state.firstI18nSettled)
|
|
235
|
+
return false;
|
|
236
|
+
if (state.sourceLocale.toLowerCase() === state.targetLocale.toLowerCase())
|
|
237
|
+
return false;
|
|
238
|
+
const trimmed = sourceText.trim();
|
|
239
|
+
if (!trimmed)
|
|
240
|
+
return false;
|
|
241
|
+
if (hasSourceTranslation(sourceText, translations))
|
|
242
|
+
return false;
|
|
243
|
+
return !state.resolvedSourceTexts.has(trimmed);
|
|
244
|
+
}
|
|
245
|
+
function localizeText(sourceText, replacements, sourceLocale, targetLocale, translations) {
|
|
246
|
+
const shouldTranslate = !!sourceLocale &&
|
|
247
|
+
!!targetLocale &&
|
|
248
|
+
sourceLocale.toLowerCase() !== targetLocale.toLowerCase();
|
|
249
|
+
const template = shouldTranslate
|
|
250
|
+
? findTranslatedTemplate(sourceText, translations) ?? sourceText
|
|
251
|
+
: sourceText;
|
|
252
|
+
return interpolateText(template, replacements);
|
|
253
|
+
}
|
|
254
|
+
function addSourceTexts(target, texts) {
|
|
255
|
+
if (!texts)
|
|
256
|
+
return;
|
|
257
|
+
for (const text of texts) {
|
|
258
|
+
const source = typeof text === 'string' ? text.trim() : '';
|
|
259
|
+
if (source)
|
|
260
|
+
target.add(source);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function mergeTranslations(current, incoming) {
|
|
264
|
+
const next = { ...current };
|
|
265
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
266
|
+
if (typeof value === 'string')
|
|
267
|
+
next[key] = value;
|
|
268
|
+
}
|
|
269
|
+
return next;
|
|
270
|
+
}
|
|
271
|
+
|
|
156
272
|
let Text3DSystem = class Text3DSystem extends Renderer3D {
|
|
157
273
|
constructor() {
|
|
158
274
|
super(...arguments);
|
|
159
275
|
this.name = 'Text3DSystem';
|
|
160
276
|
this.texts = new Map();
|
|
161
277
|
this.poseBridges = new Map();
|
|
278
|
+
this.sourceLocale = '';
|
|
279
|
+
this.targetLocale = '';
|
|
280
|
+
this.translations = {};
|
|
281
|
+
this.seededSourceTexts = new Set();
|
|
282
|
+
this.lastRequestedSourceTexts = '';
|
|
283
|
+
this.i18nRequestScheduled = false;
|
|
284
|
+
this.i18nRequestId = 0;
|
|
285
|
+
this.firstI18nSettled = false;
|
|
286
|
+
this.i18nNeeded = false;
|
|
287
|
+
this.resolvedSourceTexts = new Set();
|
|
162
288
|
}
|
|
163
289
|
static { this.systemName = 'Text3DSystem'; }
|
|
164
|
-
init() {
|
|
290
|
+
init(params) {
|
|
165
291
|
const renderer3DSystem = this.game.getSystem(Renderer3DSystem);
|
|
166
292
|
renderer3DSystem.rendererManager.register(this);
|
|
293
|
+
this.sourceLocale = params?.sourceLocale?.trim() ?? '';
|
|
294
|
+
this.targetLocale = this.sourceLocale;
|
|
295
|
+
this.declareSourceTexts(params?.sourceTexts);
|
|
296
|
+
}
|
|
297
|
+
/** Register extra source templates before or after ready. First request includes these. */
|
|
298
|
+
declareSourceTexts(texts) {
|
|
299
|
+
addSourceTexts(this.seededSourceTexts, texts);
|
|
300
|
+
this.scheduleI18nRequest();
|
|
301
|
+
}
|
|
302
|
+
async beforeReady() {
|
|
303
|
+
if (this.firstI18nSettled)
|
|
304
|
+
return;
|
|
305
|
+
this.update();
|
|
306
|
+
if (!this.sourceLocale) {
|
|
307
|
+
this.firstI18nSettled = true;
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
await this.requestI18nAndApply();
|
|
311
|
+
if (this.i18nNeeded &&
|
|
312
|
+
hasMissingSourceTranslations(this.collectSourceTexts(), this.translations)) {
|
|
313
|
+
await this.requestI18nAndApply();
|
|
314
|
+
}
|
|
315
|
+
this.firstI18nSettled = true;
|
|
316
|
+
}
|
|
317
|
+
setI18n(locale, translations) {
|
|
318
|
+
const targetLocale = locale?.trim();
|
|
319
|
+
if (!targetLocale || !translations || typeof translations !== 'object')
|
|
320
|
+
return;
|
|
321
|
+
this.targetLocale = targetLocale;
|
|
322
|
+
this.translations = mergeTranslations(this.translations, translations);
|
|
323
|
+
this.refreshAllText();
|
|
167
324
|
}
|
|
168
325
|
componentChanged(changed) {
|
|
169
326
|
if (changed.componentName !== 'Text3D')
|
|
@@ -175,17 +332,17 @@ let Text3DSystem = class Text3DSystem extends Renderer3D {
|
|
|
175
332
|
this.handleRemove(changed.gameObject.id);
|
|
176
333
|
}
|
|
177
334
|
else {
|
|
178
|
-
this.handleChange(changed
|
|
335
|
+
this.handleChange(changed);
|
|
179
336
|
}
|
|
180
337
|
}
|
|
181
338
|
rendererUpdate(gameObject) {
|
|
182
339
|
const component = gameObject.getComponent(Text3D);
|
|
183
340
|
if (!component)
|
|
184
341
|
return;
|
|
185
|
-
const
|
|
186
|
-
if (!
|
|
342
|
+
const entry = this.texts.get(gameObject.id);
|
|
343
|
+
if (!entry)
|
|
187
344
|
return;
|
|
188
|
-
this.applyPose(gameObject, component,
|
|
345
|
+
this.applyPose(gameObject, component, entry.mesh);
|
|
189
346
|
}
|
|
190
347
|
handleAdd(gameObject, component) {
|
|
191
348
|
const textMesh = new Text();
|
|
@@ -193,27 +350,32 @@ let Text3DSystem = class Text3DSystem extends Renderer3D {
|
|
|
193
350
|
textMesh.sync();
|
|
194
351
|
tagObject3D(textMesh, gameObject.id);
|
|
195
352
|
this.threeContext.attachVisual(gameObject.id, textMesh, gameObject);
|
|
196
|
-
this.texts.set(gameObject.id, textMesh);
|
|
353
|
+
this.texts.set(gameObject.id, { mesh: textMesh, component });
|
|
197
354
|
this.poseBridges.set(gameObject.id, new VisualPoseBridge());
|
|
355
|
+
this.scheduleI18nRequest();
|
|
198
356
|
}
|
|
199
|
-
handleChange(
|
|
200
|
-
const
|
|
201
|
-
if (!
|
|
357
|
+
handleChange(changed) {
|
|
358
|
+
const entry = this.texts.get(changed.gameObject.id);
|
|
359
|
+
if (!entry)
|
|
202
360
|
return;
|
|
203
|
-
|
|
204
|
-
|
|
361
|
+
const component = changed.component;
|
|
362
|
+
entry.component = component;
|
|
363
|
+
this.syncTextProps(entry.mesh, component);
|
|
364
|
+
entry.mesh.sync();
|
|
365
|
+
if (changed.prop.prop[0] === 'text')
|
|
366
|
+
this.scheduleI18nRequest();
|
|
205
367
|
}
|
|
206
368
|
handleRemove(id) {
|
|
207
|
-
const
|
|
208
|
-
if (!
|
|
369
|
+
const entry = this.texts.get(id);
|
|
370
|
+
if (!entry)
|
|
209
371
|
return;
|
|
210
|
-
this.threeContext.detachVisual(id,
|
|
211
|
-
|
|
372
|
+
this.threeContext.detachVisual(id, entry.mesh);
|
|
373
|
+
entry.mesh.dispose();
|
|
212
374
|
this.texts.delete(id);
|
|
213
375
|
this.poseBridges.delete(id);
|
|
214
376
|
}
|
|
215
377
|
syncTextProps(textMesh, component) {
|
|
216
|
-
textMesh.text = component
|
|
378
|
+
textMesh.text = this.resolveText(component);
|
|
217
379
|
textMesh.fontSize = component.fontSize;
|
|
218
380
|
textMesh.color = component.color;
|
|
219
381
|
textMesh.anchorX = component.anchorX;
|
|
@@ -241,16 +403,84 @@ let Text3DSystem = class Text3DSystem extends Renderer3D {
|
|
|
241
403
|
textMesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
|
|
242
404
|
}
|
|
243
405
|
onDestroy() {
|
|
406
|
+
this.i18nRequestId += 1;
|
|
407
|
+
this.firstI18nSettled = false;
|
|
408
|
+
this.i18nNeeded = false;
|
|
409
|
+
this.resolvedSourceTexts.clear();
|
|
244
410
|
for (const [id] of this.texts) {
|
|
245
411
|
this.handleRemove(id);
|
|
246
412
|
}
|
|
247
413
|
this.texts.clear();
|
|
248
414
|
}
|
|
415
|
+
resolveText(component) {
|
|
416
|
+
if (shouldHoldForMissingTranslation(component.text, this.translations, {
|
|
417
|
+
sourceLocale: this.sourceLocale,
|
|
418
|
+
targetLocale: this.targetLocale,
|
|
419
|
+
i18nNeeded: this.i18nNeeded,
|
|
420
|
+
firstI18nSettled: this.firstI18nSettled,
|
|
421
|
+
resolvedSourceTexts: this.resolvedSourceTexts,
|
|
422
|
+
})) {
|
|
423
|
+
return '';
|
|
424
|
+
}
|
|
425
|
+
return localizeText(component.text, component.replacements, this.sourceLocale, this.targetLocale, this.translations);
|
|
426
|
+
}
|
|
427
|
+
collectSourceTexts() {
|
|
428
|
+
const sourceTexts = new Set(this.seededSourceTexts);
|
|
429
|
+
for (const entry of this.texts.values()) {
|
|
430
|
+
addSourceTexts(sourceTexts, [entry.component.text]);
|
|
431
|
+
}
|
|
432
|
+
return [...sourceTexts];
|
|
433
|
+
}
|
|
434
|
+
scheduleI18nRequest() {
|
|
435
|
+
if (!this.sourceLocale || !this.firstI18nSettled || this.i18nRequestScheduled)
|
|
436
|
+
return;
|
|
437
|
+
this.i18nRequestScheduled = true;
|
|
438
|
+
queueMicrotask(() => {
|
|
439
|
+
this.i18nRequestScheduled = false;
|
|
440
|
+
this.startI18nRequest();
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
startI18nRequest() {
|
|
444
|
+
if (!this.sourceLocale || !this.firstI18nSettled)
|
|
445
|
+
return;
|
|
446
|
+
const sourceTexts = this.collectSourceTexts();
|
|
447
|
+
const signature = [...sourceTexts].sort().join('\0');
|
|
448
|
+
if (signature === this.lastRequestedSourceTexts)
|
|
449
|
+
return;
|
|
450
|
+
void this.requestI18nAndApply();
|
|
451
|
+
}
|
|
452
|
+
async requestI18nAndApply() {
|
|
453
|
+
const sourceTexts = this.collectSourceTexts();
|
|
454
|
+
const signature = [...sourceTexts].sort().join('\0');
|
|
455
|
+
this.lastRequestedSourceTexts = signature;
|
|
456
|
+
const requestId = ++this.i18nRequestId;
|
|
457
|
+
const result = await requestHostI18n({
|
|
458
|
+
sourceLocale: this.sourceLocale,
|
|
459
|
+
sourceTexts,
|
|
460
|
+
});
|
|
461
|
+
if (requestId !== this.i18nRequestId)
|
|
462
|
+
return;
|
|
463
|
+
addSourceTexts(this.resolvedSourceTexts, sourceTexts);
|
|
464
|
+
this.i18nNeeded = result.needed;
|
|
465
|
+
if (!result.needed) {
|
|
466
|
+
this.refreshAllText();
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
this.setI18n(result.locale, result.translations);
|
|
470
|
+
}
|
|
471
|
+
refreshAllText() {
|
|
472
|
+
for (const entry of this.texts.values()) {
|
|
473
|
+
entry.mesh.text = this.resolveText(entry.component);
|
|
474
|
+
entry.mesh.sync();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
249
477
|
};
|
|
250
478
|
Text3DSystem = __decorate([
|
|
251
479
|
decorators.componentObserver({
|
|
252
480
|
Text3D: [
|
|
253
|
-
'text',
|
|
481
|
+
'text',
|
|
482
|
+
{ prop: ['replacements'], deep: true },
|
|
483
|
+
'fontSize', 'color', 'anchorX', 'anchorY', 'maxWidth', 'font',
|
|
254
484
|
'positionX', 'positionY', 'positionZ',
|
|
255
485
|
'rotationX', 'rotationY', 'rotationZ',
|
|
256
486
|
],
|
|
@@ -258,5 +488,5 @@ Text3DSystem = __decorate([
|
|
|
258
488
|
], Text3DSystem);
|
|
259
489
|
var Text3DSystem_default = Text3DSystem;
|
|
260
490
|
|
|
261
|
-
export { Text3D, Text3DSystem_default as Text3DSystem };
|
|
491
|
+
export { COMBOS_HOST_SDK, Text3D, Text3DSystem_default as Text3DSystem, addSourceTexts, findTranslatedTemplate, hasCombosRequestI18n, hasMissingSourceTranslations, hasSourceTranslation, interpolateText, localizeText, mergeTranslations, parseI18nResult, requestHostI18n, shouldHoldForMissingTranslation };
|
|
262
492
|
//# 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/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Text3DParams {\n text?: string;\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 @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) Object.assign(this, obj);\n }\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';\n\n@decorators.componentObserver({\n Text3D: [\n 'text', 'fontSize', 'color', 'anchorX', 'anchorY', 'maxWidth', 'font',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n ],\n})\nexport default class Text3DSystem extends Renderer3D {\n static systemName = 'Text3DSystem';\n name: string = 'Text3DSystem';\n\n private texts: Map<number, TroikaText> = new Map();\n private poseBridges = new Map<number, VisualPoseBridge>();\n\n init() {\n const renderer3DSystem = this.game.getSystem(Renderer3DSystem) as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\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.gameObject.id, changed.component as Text3D);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Text3D) as Text3D;\n if (!component) return;\n\n const textMesh = this.texts.get(gameObject.id);\n if (!textMesh) return;\n this.applyPose(gameObject, component, textMesh);\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, textMesh);\n this.poseBridges.set(gameObject.id, new VisualPoseBridge());\n }\n\n private handleChange(id: number, component: Text3D) {\n const textMesh = this.texts.get(id);\n if (!textMesh) return;\n\n this.syncTextProps(textMesh, component);\n textMesh.sync();\n }\n\n private handleRemove(id: number) {\n const textMesh = this.texts.get(id);\n if (!textMesh) return;\n\n this.threeContext.detachVisual(id, textMesh);\n textMesh.dispose();\n this.texts.delete(id);\n this.poseBridges.delete(id);\n }\n\n private syncTextProps(textMesh: TroikaText, component: Text3D) {\n textMesh.text = component.text;\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 for (const [id] of this.texts) {\n this.handleRemove(id);\n }\n this.texts.clear();\n }\n}\n"],"names":["TroikaText"],"mappings":";;;;;;AAmBc,MAAO,MAAO,SAAQ,SAAuB,CAAA;AAA3D,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,IAAI,GA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,WAAW,EAAE,WAAW,EAAE,WAAW;AACtC,SAAA;KACF;AACoB,CAAA,EAAA,YAAY,CAkGhC;2BAlGoB,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\nexport function hasMissingSourceTranslations(\n sourceTexts: readonly string[],\n translations: TextTranslations,\n): boolean {\n return sourceTexts.some((text) => !hasSourceTranslation(text, translations));\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 || !state.i18nNeeded || !state.firstI18nSettled) return false;\n if (state.sourceLocale.toLowerCase() === state.targetLocale.toLowerCase()) return false;\n const trimmed = sourceText.trim();\n if (!trimmed) return false;\n if (hasSourceTranslation(sourceText, translations)) 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 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. Later `Text3D` nodes reuse this catalog\n * and will not flash the source language.\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 private seededSourceTexts = 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 addSourceTexts(this.seededSourceTexts, 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 }\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.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 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 collectSourceTexts(): string[] {\n const sourceTexts = new Set(this.seededSourceTexts);\n for (const entry of this.texts.values()) {\n addSourceTexts(sourceTexts, [entry.component.text]);\n }\n return [...sourceTexts];\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 const signature = [...sourceTexts].sort().join('\\0');\n if (signature === this.lastRequestedSourceTexts) return;\n void this.requestI18nAndApply();\n }\n\n private async requestI18nAndApply() {\n const sourceTexts = this.collectSourceTexts();\n const signature = [...sourceTexts].sort().join('\\0');\n this.lastRequestedSourceTexts = signature;\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,CA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AAE;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,CA6NhC;2BA7NoB,YAAY;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-3d-text",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
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,12 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"three": "^0.172.0",
|
|
30
30
|
"troika-three-text": "^0.52.3",
|
|
31
|
-
"@combos-fun/engine": "0.1.
|
|
32
|
-
"@combos-fun/
|
|
33
|
-
"@combos-fun/
|
|
31
|
+
"@combos-fun/engine": "0.1.6",
|
|
32
|
+
"@combos-fun/inspector-decorator": "0.1.6",
|
|
33
|
+
"@combos-fun/plugin-renderer-3d": "0.1.6"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"tsx": "^4.20.3"
|
|
34
37
|
},
|
|
35
38
|
"keywords": [
|
|
36
39
|
"combos-fun",
|
|
@@ -41,6 +44,7 @@
|
|
|
41
44
|
"font"
|
|
42
45
|
],
|
|
43
46
|
"scripts": {
|
|
44
|
-
"build": "node ../../scripts/build-package.mjs"
|
|
47
|
+
"build": "node ../../scripts/build-package.mjs",
|
|
48
|
+
"test": "node --import tsx --test test/*.test.ts"
|
|
45
49
|
}
|
|
46
50
|
}
|