@geastack/geatsc-plugin-gea 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.
Files changed (63) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +37 -0
  3. package/dist/analyze.d.ts +4 -0
  4. package/dist/analyze.js +195 -0
  5. package/dist/cpp-canvas-colors.d.ts +4 -0
  6. package/dist/cpp-canvas-colors.js +226 -0
  7. package/dist/cpp-field-access.d.ts +49 -0
  8. package/dist/cpp-field-access.js +144 -0
  9. package/dist/cpp-ir-dom-style.d.ts +1 -0
  10. package/dist/cpp-ir-dom-style.js +49 -0
  11. package/dist/cpp-ir.d.ts +30 -0
  12. package/dist/cpp-ir.js +2426 -0
  13. package/dist/cpp-keyed-component-diagnostics.d.ts +8 -0
  14. package/dist/cpp-keyed-component-diagnostics.js +74 -0
  15. package/dist/cpp-keyed-list-diagnostics.d.ts +17 -0
  16. package/dist/cpp-keyed-list-diagnostics.js +84 -0
  17. package/dist/cpp-mounted-lowering.d.ts +81 -0
  18. package/dist/cpp-mounted-lowering.js +2235 -0
  19. package/dist/cpp-mounted.d.ts +25 -0
  20. package/dist/cpp-mounted.js +1376 -0
  21. package/dist/cpp-reactive-component-diagnostics.d.ts +2 -0
  22. package/dist/cpp-reactive-component-diagnostics.js +76 -0
  23. package/dist/cpp-reactive-component.d.ts +14 -0
  24. package/dist/cpp-reactive-component.js +349 -0
  25. package/dist/cpp-replacements.d.ts +14 -0
  26. package/dist/cpp-replacements.js +787 -0
  27. package/dist/cpp-source-replacements.d.ts +11 -0
  28. package/dist/cpp-source-replacements.js +257 -0
  29. package/dist/cpp-store-hub.d.ts +7 -0
  30. package/dist/cpp-store-hub.js +160 -0
  31. package/dist/cpp-store-method-body-parser.d.ts +2 -0
  32. package/dist/cpp-store-method-body-parser.js +392 -0
  33. package/dist/cpp-store-method-context.d.ts +48 -0
  34. package/dist/cpp-store-method-context.js +114 -0
  35. package/dist/cpp-store-method-expressions.d.ts +12 -0
  36. package/dist/cpp-store-method-expressions.js +1263 -0
  37. package/dist/cpp-store-method-replacements.d.ts +5 -0
  38. package/dist/cpp-store-method-replacements.js +1521 -0
  39. package/dist/cpp-store-method-targets.d.ts +19 -0
  40. package/dist/cpp-store-method-targets.js +296 -0
  41. package/dist/cpp-store-typed-arrays.d.ts +2 -0
  42. package/dist/cpp-store-typed-arrays.js +655 -0
  43. package/dist/cpp-stores.d.ts +73 -0
  44. package/dist/cpp-stores.js +1739 -0
  45. package/dist/cpp-template-renderer.d.ts +23 -0
  46. package/dist/cpp-template-renderer.js +3530 -0
  47. package/dist/css-style-declaration-shims.d.ts +3 -0
  48. package/dist/css-style-declaration-shims.js +47 -0
  49. package/dist/host-declarations.d.ts +11 -0
  50. package/dist/host-declarations.js +320 -0
  51. package/dist/host-shims.d.ts +3 -0
  52. package/dist/host-shims.js +3217 -0
  53. package/dist/index.d.ts +3 -0
  54. package/dist/index.js +1239 -0
  55. package/dist/load-ir.d.ts +7 -0
  56. package/dist/load-ir.js +40 -0
  57. package/dist/types.d.ts +604 -0
  58. package/dist/types.js +1 -0
  59. package/dist/utils.d.ts +26 -0
  60. package/dist/utils.js +723 -0
  61. package/dist/validate.d.ts +3 -0
  62. package/dist/validate.js +226 -0
  63. package/package.json +57 -0
package/dist/utils.js ADDED
@@ -0,0 +1,723 @@
1
+ export function boolOption(options, name) {
2
+ const value = options[name];
3
+ return value === '1' || value === 'true' || value === 'yes';
4
+ }
5
+ export function isRecord(value) {
6
+ return !!value && typeof value === 'object' && !Array.isArray(value);
7
+ }
8
+ export function cppString(value) {
9
+ return JSON.stringify(value);
10
+ }
11
+ export function cssPropertyName(value) {
12
+ if (value.startsWith('--'))
13
+ return value;
14
+ return value.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
15
+ }
16
+ export function styleDeclarationEnumForPropertyName(propertyName) {
17
+ if (propertyName.startsWith('--'))
18
+ return null;
19
+ return STYLE_DECLARATION_ENUM_BY_PROPERTY.get(propertyName) ?? null;
20
+ }
21
+ export function isPxLengthStylePropertyName(propertyName) {
22
+ return PX_LENGTH_STYLE_PROPERTIES.has(propertyName);
23
+ }
24
+ export function stylePercentPropertyEnumForPropertyName(propertyName) {
25
+ return STYLE_PERCENT_PROPERTY_ENUM_BY_PROPERTY.get(propertyName) ?? null;
26
+ }
27
+ export function styleRawNumberPropertyEnumsForPropertyName(propertyName) {
28
+ return STYLE_RAW_NUMBER_PROPERTY_ENUMS_BY_PROPERTY.get(propertyName) ?? null;
29
+ }
30
+ export function styleKeywordPropertyValuesForPropertyName(propertyName, rawValue) {
31
+ const value = rawValue.trim().toLowerCase();
32
+ if (propertyName === 'display')
33
+ return keywordValue('Display', DISPLAY_KEYWORDS, value);
34
+ if (propertyName === 'flex-direction')
35
+ return keywordValue('FlexDirection', FLEX_DIRECTION_KEYWORDS, value);
36
+ if (propertyName === 'flex-wrap')
37
+ return keywordValue('FlexWrap', FLEX_WRAP_KEYWORDS, value);
38
+ if (propertyName === 'justify-content')
39
+ return keywordValue('JustifyContent', FLEX_ALIGN_KEYWORDS, value);
40
+ if (propertyName === 'align-items')
41
+ return keywordValue('AlignItems', FLEX_ALIGN_KEYWORDS, value);
42
+ if (propertyName === 'justify-items')
43
+ return keywordValue('JustifyItems', FLEX_ALIGN_KEYWORDS, value);
44
+ if (propertyName === 'align-content')
45
+ return keywordValue('AlignContent', FLEX_ALIGN_KEYWORDS, value);
46
+ if (propertyName === 'align-self')
47
+ return keywordValue('AlignSelf', ALIGN_SELF_KEYWORDS, value);
48
+ if (propertyName === 'place-items') {
49
+ const align = FLEX_ALIGN_KEYWORDS.get(value);
50
+ return align === undefined
51
+ ? null
52
+ : [
53
+ { property: 'AlignItems', value: align },
54
+ { property: 'JustifyItems', value: align },
55
+ { property: 'JustifyContent', value: align },
56
+ ];
57
+ }
58
+ if (propertyName === 'position')
59
+ return keywordValue('Position', POSITION_KEYWORDS, value);
60
+ if (propertyName === 'text-align')
61
+ return keywordValue('TextAlign', TEXT_ALIGN_KEYWORDS, value);
62
+ if (propertyName === 'white-space')
63
+ return keywordValue('WhiteSpace', WHITE_SPACE_KEYWORDS, value);
64
+ if (propertyName === 'text-overflow')
65
+ return keywordValue('TextOverflow', TEXT_OVERFLOW_KEYWORDS, value);
66
+ if (propertyName === 'backface-visibility')
67
+ return keywordValue('Backface', BACKFACE_KEYWORDS, value);
68
+ if (propertyName === 'pointer-events')
69
+ return keywordValue('PointerEvents', POINTER_EVENTS_KEYWORDS, value);
70
+ if (propertyName === 'overflow')
71
+ return keywordValue('Overflow', OVERFLOW_KEYWORDS, value);
72
+ if (propertyName === 'overflow-x')
73
+ return keywordValue('OverflowX', OVERFLOW_KEYWORDS, value);
74
+ if (propertyName === 'overflow-y')
75
+ return keywordValue('OverflowY', OVERFLOW_KEYWORDS, value);
76
+ if (propertyName === 'text-decoration' || propertyName === 'text-decoration-line') {
77
+ return keywordValue('TextDecoration', TEXT_DECORATION_KEYWORDS, value);
78
+ }
79
+ if (propertyName === 'text-transform')
80
+ return keywordValue('TextTransform', TEXT_TRANSFORM_KEYWORDS, value);
81
+ return null;
82
+ }
83
+ export function styleKeywordPropertiesForPropertyName(propertyName) {
84
+ return STYLE_KEYWORD_PROPERTIES_BY_PROPERTY.get(propertyName) ?? null;
85
+ }
86
+ export function opaqueCssHexColor(rawValue) {
87
+ const text = rawValue.trim();
88
+ const match = text.match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);
89
+ if (!match)
90
+ return null;
91
+ const hex = match[1];
92
+ if (hex.length === 3) {
93
+ return {
94
+ r: parseInt(hex[0] + hex[0], 16),
95
+ g: parseInt(hex[1] + hex[1], 16),
96
+ b: parseInt(hex[2] + hex[2], 16),
97
+ };
98
+ }
99
+ return {
100
+ r: parseInt(hex.slice(0, 2), 16),
101
+ g: parseInt(hex.slice(2, 4), 16),
102
+ b: parseInt(hex.slice(4, 6), 16),
103
+ };
104
+ }
105
+ export function styleOpaqueColorTargetForPropertyName(propertyName) {
106
+ if (propertyName === 'color')
107
+ return 'color';
108
+ if (propertyName === 'background' || propertyName === 'background-color')
109
+ return 'background';
110
+ if (propertyName === 'active-background' || propertyName === 'active-background-color')
111
+ return 'active-background';
112
+ if (propertyName === 'border-color' ||
113
+ propertyName === 'border-top-color' ||
114
+ propertyName === 'border-right-color' ||
115
+ propertyName === 'border-bottom-color' ||
116
+ propertyName === 'border-left-color') {
117
+ return propertyName;
118
+ }
119
+ return null;
120
+ }
121
+ export function nativeStyleColorExpression(color) {
122
+ return `gea::framework::graphics::pixel::nativeStyleValue(${color.r}, ${color.g}, ${color.b})`;
123
+ }
124
+ function keywordValue(property, map, value) {
125
+ const mapped = map.get(value);
126
+ return mapped === undefined ? null : [{ property, value: mapped }];
127
+ }
128
+ const STYLE_DECLARATION_ENUM_BY_PROPERTY = new Map([
129
+ ['color-scheme', 'Ignored'],
130
+ ['background-position', 'Ignored'],
131
+ ['box-sizing', 'Ignored'],
132
+ ['font', 'Ignored'],
133
+ ['grid-column', 'Ignored'],
134
+ ['isolation', 'Ignored'],
135
+ ['letter-spacing', 'Ignored'],
136
+ ['object-fit', 'ObjectFit'],
137
+ ['outline', 'Ignored'],
138
+ ['scroll-snap-align', 'Ignored'],
139
+ ['scroll-snap-type', 'Ignored'],
140
+ ['scrollbar-width', 'Ignored'],
141
+ ['text-shadow', 'Ignored'],
142
+ ['transform-style', 'Ignored'],
143
+ ['transition', 'Ignored'],
144
+ ['cursor', 'Ignored'],
145
+ ['-webkit-tap-highlight-color', 'Ignored'],
146
+ ['animation', 'Animation'],
147
+ ['display', 'Display'],
148
+ ['flex-direction', 'FlexDirection'],
149
+ ['flex-wrap', 'FlexWrap'],
150
+ ['justify-content', 'JustifyContent'],
151
+ ['align-items', 'AlignItems'],
152
+ ['justify-items', 'JustifyItems'],
153
+ ['align-content', 'AlignContent'],
154
+ ['align-self', 'AlignSelf'],
155
+ ['place-items', 'PlaceItems'],
156
+ ['grid-template-columns', 'GridTemplateColumns'],
157
+ ['grid-template-rows', 'GridTemplateRows'],
158
+ ['content', 'Content'],
159
+ ['gap', 'Gap'],
160
+ ['width', 'Width'],
161
+ ['height', 'Height'],
162
+ ['min-width', 'MinWidth'],
163
+ ['min-height', 'MinHeight'],
164
+ ['max-width', 'MaxWidth'],
165
+ ['max-height', 'MaxHeight'],
166
+ ['flex', 'Flex'],
167
+ ['flex-grow', 'FlexGrow'],
168
+ ['flex-shrink', 'FlexShrink'],
169
+ ['flex-basis', 'FlexBasis'],
170
+ ['padding', 'Padding'],
171
+ ['padding-top', 'PaddingTop'],
172
+ ['padding-right', 'PaddingRight'],
173
+ ['padding-bottom', 'PaddingBottom'],
174
+ ['padding-left', 'PaddingLeft'],
175
+ ['margin', 'Margin'],
176
+ ['margin-top', 'MarginTop'],
177
+ ['margin-right', 'MarginRight'],
178
+ ['margin-bottom', 'MarginBottom'],
179
+ ['margin-left', 'MarginLeft'],
180
+ ['position', 'Position'],
181
+ ['inset', 'Inset'],
182
+ ['top', 'Top'],
183
+ ['right', 'Right'],
184
+ ['bottom', 'Bottom'],
185
+ ['left', 'Left'],
186
+ ['z-index', 'ZIndex'],
187
+ ['active-background-color', 'ActiveBackgroundColor'],
188
+ ['active-background', 'ActiveBackgroundColor'],
189
+ ['background-color', 'Background'],
190
+ ['background', 'Background'],
191
+ ['background-image', 'Background'],
192
+ ['background-size', 'BackgroundSize'],
193
+ ['color', 'Color'],
194
+ ['opacity', 'Opacity'],
195
+ ['border-color', 'BorderColor'],
196
+ ['border', 'Border'],
197
+ ['border-width', 'BorderWidth'],
198
+ ['border-top', 'BorderTop'],
199
+ ['border-right', 'BorderRight'],
200
+ ['border-bottom', 'BorderBottom'],
201
+ ['border-left', 'BorderLeft'],
202
+ ['border-top-width', 'BorderTopWidth'],
203
+ ['border-right-width', 'BorderRightWidth'],
204
+ ['border-bottom-width', 'BorderBottomWidth'],
205
+ ['border-left-width', 'BorderLeftWidth'],
206
+ ['border-top-color', 'BorderTopColor'],
207
+ ['border-right-color', 'BorderRightColor'],
208
+ ['border-bottom-color', 'BorderBottomColor'],
209
+ ['border-left-color', 'BorderLeftColor'],
210
+ ['border-radius', 'BorderRadius'],
211
+ ['border-top-left-radius', 'BorderTopLeftRadius'],
212
+ ['border-top-right-radius', 'BorderTopRightRadius'],
213
+ ['border-bottom-right-radius', 'BorderBottomRightRadius'],
214
+ ['border-bottom-left-radius', 'BorderBottomLeftRadius'],
215
+ ['font-family', 'FontFamily'],
216
+ ['font-size', 'FontSize'],
217
+ ['font-weight', 'FontWeight'],
218
+ ['line-height', 'LineHeight'],
219
+ ['text-align', 'TextAlign'],
220
+ ['text-decoration', 'TextDecoration'],
221
+ ['text-decoration-line', 'TextDecoration'],
222
+ ['text-transform', 'TextTransform'],
223
+ ['white-space', 'WhiteSpace'],
224
+ ['text-overflow', 'TextOverflow'],
225
+ ['backface-visibility', 'BackfaceVisibility'],
226
+ ['pointer-events', 'PointerEvents'],
227
+ ['overflow', 'Overflow'],
228
+ ['overflow-x', 'OverflowX'],
229
+ ['overflow-y', 'OverflowY'],
230
+ ['mask-image', 'MaskImage'],
231
+ ['-webkit-mask-image', 'MaskImage'],
232
+ ['transform', 'Transform'],
233
+ ['rotate', 'Rotate'],
234
+ ['scale', 'Scale'],
235
+ ['filter', 'Filter'],
236
+ ['box-shadow', 'BoxShadow'],
237
+ ['transform-origin', 'TransformOrigin'],
238
+ ['perspective', 'Perspective'],
239
+ ['perspective-origin', 'PerspectiveOrigin'],
240
+ ]);
241
+ const PX_LENGTH_STYLE_PROPERTIES = new Set([
242
+ 'gap',
243
+ 'width',
244
+ 'height',
245
+ 'min-width',
246
+ 'min-height',
247
+ 'max-width',
248
+ 'max-height',
249
+ 'padding',
250
+ 'padding-top',
251
+ 'padding-right',
252
+ 'padding-bottom',
253
+ 'padding-left',
254
+ 'margin',
255
+ 'margin-top',
256
+ 'margin-right',
257
+ 'margin-bottom',
258
+ 'margin-left',
259
+ 'top',
260
+ 'right',
261
+ 'bottom',
262
+ 'left',
263
+ 'border-width',
264
+ 'border-top-width',
265
+ 'border-right-width',
266
+ 'border-bottom-width',
267
+ 'border-left-width',
268
+ 'border-radius',
269
+ 'border-top-left-radius',
270
+ 'border-top-right-radius',
271
+ 'border-bottom-right-radius',
272
+ 'border-bottom-left-radius',
273
+ 'font-size',
274
+ 'perspective',
275
+ 'translate-x',
276
+ 'translate-y',
277
+ ]);
278
+ const STYLE_PERCENT_PROPERTY_ENUM_BY_PROPERTY = new Map([
279
+ ['width', 'WidthPercent'],
280
+ ['height', 'HeightPercent'],
281
+ ['top', 'TopPercent'],
282
+ ['right', 'RightPercent'],
283
+ ['bottom', 'BottomPercent'],
284
+ ['left', 'LeftPercent'],
285
+ ]);
286
+ const STYLE_RAW_NUMBER_PROPERTY_ENUMS_BY_PROPERTY = new Map([
287
+ ['gap', ['Gap']],
288
+ ['width', ['Width']],
289
+ ['height', ['Height']],
290
+ ['min-width', ['MinWidth']],
291
+ ['min-height', ['MinHeight']],
292
+ ['max-width', ['MaxWidth']],
293
+ ['max-height', ['MaxHeight']],
294
+ ['padding', ['PaddingTop', 'PaddingRight', 'PaddingBottom', 'PaddingLeft']],
295
+ ['padding-top', ['PaddingTop']],
296
+ ['padding-right', ['PaddingRight']],
297
+ ['padding-bottom', ['PaddingBottom']],
298
+ ['padding-left', ['PaddingLeft']],
299
+ ['margin', ['MarginTop', 'MarginRight', 'MarginBottom', 'MarginLeft']],
300
+ ['margin-top', ['MarginTop']],
301
+ ['margin-right', ['MarginRight']],
302
+ ['margin-bottom', ['MarginBottom']],
303
+ ['margin-left', ['MarginLeft']],
304
+ ['top', ['Top']],
305
+ ['right', ['Right']],
306
+ ['bottom', ['Bottom']],
307
+ ['left', ['Left']],
308
+ ['z-index', ['ZIndex']],
309
+ ['border-width', ['BorderWidth']],
310
+ ['border-top-width', ['BorderTopWidth']],
311
+ ['border-right-width', ['BorderRightWidth']],
312
+ ['border-bottom-width', ['BorderBottomWidth']],
313
+ ['border-left-width', ['BorderLeftWidth']],
314
+ ['border-radius', ['BorderRadiusTopLeft', 'BorderRadiusTopRight', 'BorderRadiusBottomRight', 'BorderRadiusBottomLeft']],
315
+ ['border-top-left-radius', ['BorderRadiusTopLeft']],
316
+ ['border-top-right-radius', ['BorderRadiusTopRight']],
317
+ ['border-bottom-right-radius', ['BorderRadiusBottomRight']],
318
+ ['border-bottom-left-radius', ['BorderRadiusBottomLeft']],
319
+ ['font-size', ['FontSize']],
320
+ ['font-weight', ['FontWeight']],
321
+ ]);
322
+ const STYLE_KEYWORD_PROPERTIES_BY_PROPERTY = new Map([
323
+ ['display', ['Display']],
324
+ ['flex-direction', ['FlexDirection']],
325
+ ['flex-wrap', ['FlexWrap']],
326
+ ['justify-content', ['JustifyContent']],
327
+ ['align-items', ['AlignItems']],
328
+ ['justify-items', ['JustifyItems']],
329
+ ['align-content', ['AlignContent']],
330
+ ['align-self', ['AlignSelf']],
331
+ ['place-items', ['AlignItems', 'JustifyItems', 'JustifyContent']],
332
+ ['position', ['Position']],
333
+ ['text-align', ['TextAlign']],
334
+ ['white-space', ['WhiteSpace']],
335
+ ['text-overflow', ['TextOverflow']],
336
+ ['backface-visibility', ['Backface']],
337
+ ['pointer-events', ['PointerEvents']],
338
+ ['overflow', ['Overflow']],
339
+ ['overflow-x', ['OverflowX']],
340
+ ['overflow-y', ['OverflowY']],
341
+ ['text-decoration', ['TextDecoration']],
342
+ ['text-decoration-line', ['TextDecoration']],
343
+ ['text-transform', ['TextTransform']],
344
+ ]);
345
+ const DISPLAY_KEYWORDS = new Map([
346
+ ['block', 0],
347
+ ['none', 1],
348
+ ['grid', 2],
349
+ ['inline-grid', 2],
350
+ ['flex', 3],
351
+ ['inline-flex', 3],
352
+ ]);
353
+ const FLEX_DIRECTION_KEYWORDS = new Map([
354
+ ['column', 0],
355
+ ['row', 1],
356
+ ]);
357
+ const FLEX_WRAP_KEYWORDS = new Map([
358
+ ['nowrap', 0],
359
+ ['wrap', 1],
360
+ ]);
361
+ const FLEX_ALIGN_KEYWORDS = new Map([
362
+ ['flex-start', 0],
363
+ ['start', 0],
364
+ ['center', 1],
365
+ ['flex-end', 2],
366
+ ['end', 2],
367
+ ['space-between', 3],
368
+ ['space-around', 4],
369
+ ['baseline', 5],
370
+ ]);
371
+ const ALIGN_SELF_KEYWORDS = new Map([
372
+ ['auto', -1],
373
+ ...FLEX_ALIGN_KEYWORDS,
374
+ ]);
375
+ const POSITION_KEYWORDS = new Map([
376
+ ['static', 0],
377
+ ['absolute', 1],
378
+ ['relative', 2],
379
+ ]);
380
+ const TEXT_ALIGN_KEYWORDS = new Map([
381
+ ['left', 0],
382
+ ['start', 0],
383
+ ['center', 1],
384
+ ['right', 2],
385
+ ['end', 2],
386
+ ]);
387
+ const WHITE_SPACE_KEYWORDS = new Map([
388
+ ['normal', 0],
389
+ ['pre-line', 0],
390
+ ['nowrap', 1],
391
+ ['pre', 1],
392
+ ]);
393
+ const TEXT_OVERFLOW_KEYWORDS = new Map([
394
+ ['clip', 0],
395
+ ['ellipsis', 1],
396
+ ]);
397
+ const BACKFACE_KEYWORDS = new Map([
398
+ ['visible', 0],
399
+ ['hidden', 1],
400
+ ]);
401
+ const POINTER_EVENTS_KEYWORDS = new Map([
402
+ ['auto', 0],
403
+ ['none', 1],
404
+ ]);
405
+ const OVERFLOW_KEYWORDS = new Map([
406
+ ['visible', 0],
407
+ ['hidden', 1],
408
+ ['scroll', 2],
409
+ ['auto', 2],
410
+ ]);
411
+ const TEXT_DECORATION_KEYWORDS = new Map([
412
+ ['none', 0],
413
+ ['underline', 1],
414
+ ['line-through', 2],
415
+ ['strikethrough', 2],
416
+ ]);
417
+ const TEXT_TRANSFORM_KEYWORDS = new Map([
418
+ ['none', 0],
419
+ ['uppercase', 1],
420
+ ['lowercase', 2],
421
+ ['capitalize', 3],
422
+ ]);
423
+ // Module-level runtime numeric constants follow the SCREAMING_SNAKE_CASE
424
+ // convention (DISPLAY_W, ITEM_COUNT, ITEM_HEIGHT, MAX_SCROLL, …). They are
425
+ // assigned once during module init — before any component mounts — and never
426
+ // reassigned, so a template slot that reads one carries no store dependency
427
+ // and its value can be resolved eagerly at mount time. The optimized C++
428
+ // template renderer relies on this to avoid bailing such components to the
429
+ // closure-codegen fallback (whose reactive bindings don't fire an initial
430
+ // apply in the native runtime).
431
+ export function isRuntimeNumericConstantIdentifier(name) {
432
+ return /^[A-Z][A-Z0-9_]*$/.test(name);
433
+ }
434
+ export function sanitizeCppIdentifier(value) {
435
+ const ident = value.replace(/[^A-Za-z0-9_]/g, (char) => `_x${char.codePointAt(0).toString(16)}_`);
436
+ const safe = ident ? (/^[A-Za-z_]/.test(ident) ? ident : `__gea_${ident}`) : 'anonymous';
437
+ return safe === 'main' || cppReservedNames.has(safe) ? `__gea_${safe}` : safe;
438
+ }
439
+ const cppReservedNames = new Set([
440
+ 'alignas',
441
+ 'alignof',
442
+ 'and',
443
+ 'and_eq',
444
+ 'asm',
445
+ 'auto',
446
+ 'bitand',
447
+ 'bitor',
448
+ 'bool',
449
+ 'break',
450
+ 'case',
451
+ 'catch',
452
+ 'char',
453
+ 'char8_t',
454
+ 'char16_t',
455
+ 'char32_t',
456
+ 'class',
457
+ 'compl',
458
+ 'concept',
459
+ 'const',
460
+ 'consteval',
461
+ 'constexpr',
462
+ 'constinit',
463
+ 'const_cast',
464
+ 'continue',
465
+ 'co_await',
466
+ 'co_return',
467
+ 'co_yield',
468
+ 'decltype',
469
+ 'default',
470
+ 'delete',
471
+ 'do',
472
+ 'double',
473
+ 'dynamic_cast',
474
+ 'else',
475
+ 'enum',
476
+ 'explicit',
477
+ 'export',
478
+ 'extern',
479
+ 'false',
480
+ 'float',
481
+ 'for',
482
+ 'friend',
483
+ 'goto',
484
+ 'if',
485
+ 'inline',
486
+ 'int',
487
+ 'long',
488
+ 'mutable',
489
+ 'namespace',
490
+ 'new',
491
+ 'noexcept',
492
+ 'not',
493
+ 'not_eq',
494
+ 'nullptr',
495
+ 'operator',
496
+ 'or',
497
+ 'or_eq',
498
+ 'private',
499
+ 'protected',
500
+ 'public',
501
+ 'register',
502
+ 'reinterpret_cast',
503
+ 'requires',
504
+ 'return',
505
+ 'short',
506
+ 'signed',
507
+ 'sizeof',
508
+ 'static',
509
+ 'static_assert',
510
+ 'static_cast',
511
+ 'struct',
512
+ 'switch',
513
+ 'template',
514
+ 'this',
515
+ 'thread_local',
516
+ 'throw',
517
+ 'true',
518
+ 'try',
519
+ 'typedef',
520
+ 'typeid',
521
+ 'typename',
522
+ 'typeof',
523
+ 'typeof_unqual',
524
+ 'union',
525
+ 'unsigned',
526
+ 'using',
527
+ 'virtual',
528
+ 'void',
529
+ 'volatile',
530
+ 'wchar_t',
531
+ 'while',
532
+ 'xor',
533
+ 'xor_eq',
534
+ 'y0',
535
+ 'y1',
536
+ 'yn',
537
+ 'j0',
538
+ 'j1',
539
+ 'jn',
540
+ 'fma',
541
+ 'gamma',
542
+ 'lgamma',
543
+ 'tgamma',
544
+ 'exp2',
545
+ 'exp10',
546
+ 'expm1',
547
+ 'log2',
548
+ 'log10',
549
+ 'log1p',
550
+ 'cbrt',
551
+ 'hypot',
552
+ 'erf',
553
+ 'erfc',
554
+ 'remainder',
555
+ 'remquo',
556
+ 'nan',
557
+ 'div',
558
+ 'ldiv',
559
+ 'lldiv',
560
+ 'time',
561
+ 'clock',
562
+ 'rand',
563
+ 'log',
564
+ 'logb',
565
+ 'exp',
566
+ 'sqrt',
567
+ 'pow',
568
+ 'sin',
569
+ 'cos',
570
+ 'tan',
571
+ 'asin',
572
+ 'acos',
573
+ 'atan',
574
+ 'atan2',
575
+ 'sinh',
576
+ 'cosh',
577
+ 'tanh',
578
+ 'asinh',
579
+ 'acosh',
580
+ 'atanh',
581
+ 'ceil',
582
+ 'floor',
583
+ 'round',
584
+ 'trunc',
585
+ 'fabs',
586
+ 'abs',
587
+ 'fmod',
588
+ 'fmin',
589
+ 'fmax',
590
+ 'modf',
591
+ 'frexp',
592
+ 'ldexp',
593
+ 'scalbn',
594
+ 'scalbln',
595
+ 'ilogb',
596
+ 'copysign',
597
+ 'signbit',
598
+ 'isnan',
599
+ 'isinf',
600
+ 'isfinite',
601
+ 'isnormal',
602
+ 'fpclassify',
603
+ 'index',
604
+ 'rindex',
605
+ 'getenv',
606
+ 'setenv',
607
+ 'putenv',
608
+ 'system',
609
+ 'exit',
610
+ 'abort',
611
+ 'atoi',
612
+ 'atol',
613
+ 'atof',
614
+ 'atoll',
615
+ 'strtol',
616
+ 'strtoll',
617
+ 'strtoul',
618
+ 'strtoull',
619
+ 'strtod',
620
+ 'strtof',
621
+ 'strtold',
622
+ 'strchr',
623
+ 'strrchr',
624
+ 'strstr',
625
+ 'strspn',
626
+ 'strcspn',
627
+ 'strpbrk',
628
+ 'strtok',
629
+ 'strncpy',
630
+ 'strncat',
631
+ 'strcmp',
632
+ 'strncmp',
633
+ 'strcoll',
634
+ 'strxfrm',
635
+ 'strerror',
636
+ 'strlen',
637
+ 'memcpy',
638
+ 'memmove',
639
+ 'memcmp',
640
+ 'memchr',
641
+ 'memset',
642
+ 'malloc',
643
+ 'calloc',
644
+ 'realloc',
645
+ 'free',
646
+ 'getline',
647
+ 'getdelim',
648
+ 'open',
649
+ 'close',
650
+ 'read',
651
+ 'write',
652
+ 'lseek',
653
+ 'pipe',
654
+ 'fork',
655
+ 'wait',
656
+ 'kill',
657
+ 'sleep',
658
+ 'usleep',
659
+ 'alarm',
660
+ 'getpid',
661
+ 'getppid',
662
+ 'getuid',
663
+ 'geteuid',
664
+ 'getgid',
665
+ 'getegid',
666
+ 'getpgrp',
667
+ 'getsid',
668
+ 'setpgid',
669
+ 'setsid',
670
+ 'tcgetpgrp',
671
+ 'tcsetpgrp',
672
+ 'access',
673
+ 'link',
674
+ 'unlink',
675
+ 'rename',
676
+ 'remove',
677
+ 'mkdir',
678
+ 'rmdir',
679
+ 'chdir',
680
+ 'getcwd',
681
+ 'chmod',
682
+ 'chown',
683
+ 'stat',
684
+ 'fstat',
685
+ 'lstat',
686
+ 'umask',
687
+ 'sync',
688
+ 'sysconf',
689
+ 'pathconf',
690
+ 'fpathconf',
691
+ 'select',
692
+ 'poll',
693
+ 'signal',
694
+ 'raise',
695
+ 'longjmp',
696
+ 'setjmp',
697
+ 'qsort',
698
+ 'bsearch',
699
+ 'fopen',
700
+ 'fclose',
701
+ 'fread',
702
+ 'fwrite',
703
+ 'fseek',
704
+ 'ftell',
705
+ 'rewind',
706
+ 'fgetc',
707
+ 'fputc',
708
+ 'fgets',
709
+ 'fputs',
710
+ 'getc',
711
+ 'putc',
712
+ 'getchar',
713
+ 'putchar',
714
+ 'puts',
715
+ 'gets',
716
+ 'printf',
717
+ 'fprintf',
718
+ 'sprintf',
719
+ 'snprintf',
720
+ 'scanf',
721
+ 'fscanf',
722
+ 'sscanf'
723
+ ]);