create-octane-xplat 0.19.0 → 0.20.0

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/README.md +2 -147
  2. package/compatibility.json +74 -61
  3. package/compatibility.ts +134 -79
  4. package/dist/compatibility.js +45 -13
  5. package/dist/index.js +127 -64
  6. package/dist/package-manager.js +62 -0
  7. package/dist/scaffold.js +362 -57
  8. package/index.ts +256 -156
  9. package/library-template/AGENTS.md +1 -1
  10. package/library-template/README.md +4 -3
  11. package/library-template/bunfig +4 -0
  12. package/library-template/package.json +73 -70
  13. package/library-template/patches/@nativescript-community__octane@0.2.5.patch +161 -24
  14. package/library-template/patches/@nativescript__core@9.1.3.patch +98 -0
  15. package/library-template/patches/@nativescript__vite@8.0.20.patch +532 -17
  16. package/library-template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
  17. package/library-template/patches/octane@0.16.3.patch +56 -2
  18. package/library-template/src/Badge.tsx +5 -5
  19. package/library-template/src/Badge.web.tsx +5 -5
  20. package/library-template/src/Welcome.stories.tsx +12 -0
  21. package/library-template/src/normalizeBadgeLabel.ts +1 -1
  22. package/library-template/src/props.ts +11 -11
  23. package/library-template/tests/normalizeBadgeLabel.test.ts +1 -1
  24. package/library-template/tests/packed-consumer.mjs +140 -123
  25. package/library-template/tsconfig.envs.json +1 -0
  26. package/library-template/tsconfig.json +1 -0
  27. package/library-template/tsconfig.types.json +15 -1
  28. package/library-template/tsrx-typegen.json +1 -1
  29. package/library-template/workshop.config.ts +3 -0
  30. package/package-manager.ts +93 -0
  31. package/package.json +10 -5
  32. package/scaffold.ts +1061 -449
  33. package/template/.agents/skills/xplat/SKILL.md +1 -1
  34. package/template/.agents/skills/xplat/references/styling.md +10 -10
  35. package/template/AGENTS.md +2 -2
  36. package/template/bunfig +4 -0
  37. package/template/nativescript.config.ts +13 -13
  38. package/template/package.json +69 -64
  39. package/template/patches/@nativescript-community__octane@0.2.5.patch +161 -24
  40. package/template/patches/@nativescript__core@9.1.3.patch +98 -0
  41. package/template/patches/@nativescript__vite@8.0.20.patch +532 -17
  42. package/template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
  43. package/template/patches/octane@0.16.3.patch +56 -2
  44. package/template/src/App.tsrx +66 -64
  45. package/template/src/Welcome.stories.tsx +22 -0
  46. package/template/src/app.spec.tsrx +168 -158
  47. package/template/src/app.web.test.tsx +18 -13
  48. package/template/src/failure-reporting.spec.ts +3 -3
  49. package/template/src/main.ts +14 -13
  50. package/template/src/main.tsrx +2 -0
  51. package/template/src/native-runtime.spec.ts +13 -11
  52. package/template/src/test-setup.web.ts +9 -8
  53. package/template/src/test.ts +6 -6
  54. package/template/tsconfig.json +17 -1
  55. package/template/vite.config.native.mts +1 -2
  56. package/template/vite.config.ts +29 -23
  57. package/template/vitest.config.mts +17 -17
  58. package/template/vitest.web.config.mts +7 -7
  59. package/template/workshop.config.ts +3 -0
  60. package/library-template/patches/@tsrx__typescript-plugin@0.4.11.patch +0 -11
  61. package/template/patches/@tsrx__typescript-plugin@0.4.11.patch +0 -11
  62. /package/library-template/patches/{@octanejs__tiptap@0.0.61.patch → @octanejs__tiptap@0.0.62.patch} +0 -0
  63. /package/template/patches/{@octanejs__tiptap@0.0.61.patch → @octanejs__tiptap@0.0.62.patch} +0 -0
@@ -24,16 +24,17 @@
24
24
  "@nativescript-community/octane": "0.2.5",
25
25
  "@nativescript/core": "9.1.3",
26
26
  "@nativescript/types": "9.1.4",
27
- "@octane-xplat/cli": "0.19.0",
28
- "@octane-xplat/jsx": "0.19.0",
29
- "@octane-xplat/ui": "0.19.0",
27
+ "@octane-xplat/cli": "0.20.0",
28
+ "@octane-xplat/jsx": "0.20.0",
29
+ "@octane-xplat/lint": "0.20.0",
30
+ "@octane-xplat/ui": "0.20.0",
31
+ "@octane-xplat/workshop": "0.20.0",
30
32
  "@octanejs/vite-plugin": "0.5.0",
31
33
  "@tsrx/oxc": "0.20.0",
32
- "@tsrx/typescript-plugin": "0.4.11",
33
34
  "octane": "0.16.3",
34
- "tsrx-typegen": "0.5.0",
35
- "typescript": "5.9.3",
36
- "vite": "8.3.0",
35
+ "tsrx-typegen": "0.6.0",
36
+ "typescript": "7.1.0-beta",
37
+ "vite": "8.3.6",
37
38
  "vitest": "4.1.11"
38
39
  }
39
40
  }
@@ -41,7 +42,8 @@
41
42
  "files": [
42
43
  "src",
43
44
  "types",
44
- "LICENSE"
45
+ "LICENSE",
46
+ "!src/**/*.stories.*"
45
47
  ],
46
48
  "type": "module",
47
49
  "exports": {
@@ -49,15 +51,9 @@
49
51
  "macos": null,
50
52
  "linux": null,
51
53
  "windows": null,
52
- "web": {
53
- "types": "./types/index.web.d.ts",
54
- "default": "./src/index.web.ts"
55
- },
56
- "native": {
57
- "types": "./types/index.d.ts",
58
- "default": "./src/index.ts"
59
- },
60
54
  "types": "./types/index.d.ts",
55
+ "web": "./src/index.web.ts",
56
+ "native": "./src/index.ts",
61
57
  "default": "./src/index.ts"
62
58
  }
63
59
  },
@@ -73,18 +69,21 @@
73
69
  "test:packed": "node tests/packed-consumer.mjs",
74
70
  "prepack": "bun run typegen && tsrx-typegen --pack-check",
75
71
  "pack:check": "bun run test:packed",
76
- "format": "xplat fmt"
72
+ "format": "xplat fmt",
73
+ "workshop": "xplat workshop dev --target web"
77
74
  },
78
75
  "devDependencies": {
79
76
  "@nativescript-community/octane": "catalog:xplat",
80
77
  "@nativescript/core": "catalog:xplat",
81
78
  "@nativescript/types": "catalog:xplat",
82
79
  "@octane-xplat/cli": "catalog:xplat",
80
+ "@octane-xplat/fmt": "0.3.0",
83
81
  "@octane-xplat/jsx": "catalog:xplat",
82
+ "@octane-xplat/lint": "catalog:xplat",
84
83
  "@octane-xplat/ui": "catalog:xplat",
84
+ "@octane-xplat/workshop": "catalog:xplat",
85
85
  "@octanejs/vite-plugin": "catalog:xplat",
86
86
  "@tsrx/oxc": "catalog:xplat",
87
- "@tsrx/typescript-plugin": "catalog:xplat",
88
87
  "octane": "catalog:xplat",
89
88
  "tsrx-typegen": "catalog:xplat",
90
89
  "typescript": "catalog:xplat",
@@ -94,8 +93,8 @@
94
93
  "peerDependencies": {
95
94
  "@nativescript-community/octane": ">=0.2.1 <1",
96
95
  "@nativescript/core": ">=9.1.0 <10",
97
- "@octane-xplat/jsx": "^0.19.0",
98
- "@octane-xplat/ui": "^0.19.0",
96
+ "@octane-xplat/jsx": "^0.20.0",
97
+ "@octane-xplat/ui": "^0.20.0",
99
98
  "octane": ">=0.6.3 <1"
100
99
  },
101
100
  "peerDependenciesMeta": {
@@ -107,56 +106,59 @@
107
106
  }
108
107
  },
109
108
  "overrides": {
110
- "@lexical/a11y": "0.52.0",
111
- "@lexical/code": "0.52.0",
112
- "@lexical/devtools-core": "0.52.0",
113
- "@lexical/dragon": "0.52.0",
114
- "@lexical/extension": "0.52.0",
115
- "@lexical/hashtag": "0.52.0",
116
- "@lexical/history": "0.52.0",
117
- "@lexical/html": "0.52.0",
118
- "@lexical/internal": "0.52.0",
119
- "@lexical/link": "0.52.0",
120
- "@lexical/list": "0.52.0",
121
- "@lexical/mark": "0.52.0",
122
- "@lexical/markdown": "0.52.0",
123
- "@lexical/overflow": "0.52.0",
124
- "@lexical/plain-text": "0.52.0",
125
- "@lexical/rich-text": "0.52.0",
126
- "@lexical/selection": "0.52.0",
127
- "@lexical/table": "0.52.0",
128
- "@lexical/text": "0.52.0",
129
- "@lexical/utils": "0.52.0",
130
- "@lexical/yjs": "0.52.0",
109
+ "@lexical/a11y": "0.53.0",
110
+ "@lexical/code": "0.53.0",
111
+ "@lexical/devtools-core": "0.53.0",
112
+ "@lexical/dragon": "0.53.0",
113
+ "@lexical/extension": "0.53.0",
114
+ "@lexical/hashtag": "0.53.0",
115
+ "@lexical/history": "0.53.0",
116
+ "@lexical/html": "0.53.0",
117
+ "@lexical/internal": "0.53.0",
118
+ "@lexical/link": "0.53.0",
119
+ "@lexical/list": "0.53.0",
120
+ "@lexical/mark": "0.53.0",
121
+ "@lexical/markdown": "0.53.0",
122
+ "@lexical/overflow": "0.53.0",
123
+ "@lexical/plain-text": "0.53.0",
124
+ "@lexical/rich-text": "0.53.0",
125
+ "@lexical/selection": "0.53.0",
126
+ "@lexical/table": "0.53.0",
127
+ "@lexical/text": "0.53.0",
128
+ "@lexical/utils": "0.53.0",
129
+ "@lexical/yjs": "0.53.0",
131
130
  "@nativescript-community/vite-octane>esbuild": "0.27.7",
132
131
  "@nativescript/vite>esbuild": "0.27.7",
133
- "@tiptap/core": "3.32.0",
134
- "@tiptap/extension-blockquote": "3.32.0",
135
- "@tiptap/extension-bold": "3.32.0",
136
- "@tiptap/extension-bullet-list": "3.32.0",
137
- "@tiptap/extension-code": "3.32.0",
138
- "@tiptap/extension-code-block": "3.32.0",
139
- "@tiptap/extension-document": "3.32.0",
140
- "@tiptap/extension-dropcursor": "3.32.0",
141
- "@tiptap/extension-gapcursor": "3.32.0",
142
- "@tiptap/extension-hard-break": "3.32.0",
143
- "@tiptap/extension-heading": "3.32.0",
144
- "@tiptap/extension-horizontal-rule": "3.32.0",
145
- "@tiptap/extension-italic": "3.32.0",
146
- "@tiptap/extension-link": "3.32.0",
147
- "@tiptap/extension-list": "3.32.0",
148
- "@tiptap/extension-list-item": "3.32.0",
149
- "@tiptap/extension-list-keymap": "3.32.0",
150
- "@tiptap/extension-ordered-list": "3.32.0",
151
- "@tiptap/extension-paragraph": "3.32.0",
152
- "@tiptap/extension-strike": "3.32.0",
153
- "@tiptap/extension-text": "3.32.0",
154
- "@tiptap/extension-underline": "3.32.0",
155
- "@tiptap/extensions": "3.32.0",
156
- "@tiptap/pm": "3.32.0",
157
- "@tiptap/starter-kit": "3.32.0",
158
- "@tiptap/static-renderer": "3.32.0",
159
- "lexical": "0.52.0",
132
+ "@nativescript/vite>typescript": "5.9.3",
133
+ "@tiptap/core": "3.32.2",
134
+ "@tiptap/extension-blockquote": "3.32.2",
135
+ "@tiptap/extension-bold": "3.32.2",
136
+ "@tiptap/extension-bubble-menu": "3.32.2",
137
+ "@tiptap/extension-bullet-list": "3.32.2",
138
+ "@tiptap/extension-code": "3.32.2",
139
+ "@tiptap/extension-code-block": "3.32.2",
140
+ "@tiptap/extension-document": "3.32.2",
141
+ "@tiptap/extension-dropcursor": "3.32.2",
142
+ "@tiptap/extension-floating-menu": "3.32.2",
143
+ "@tiptap/extension-gapcursor": "3.32.2",
144
+ "@tiptap/extension-hard-break": "3.32.2",
145
+ "@tiptap/extension-heading": "3.32.2",
146
+ "@tiptap/extension-horizontal-rule": "3.32.2",
147
+ "@tiptap/extension-italic": "3.32.2",
148
+ "@tiptap/extension-link": "3.32.2",
149
+ "@tiptap/extension-list": "3.32.2",
150
+ "@tiptap/extension-list-item": "3.32.2",
151
+ "@tiptap/extension-list-keymap": "3.32.2",
152
+ "@tiptap/extension-ordered-list": "3.32.2",
153
+ "@tiptap/extension-paragraph": "3.32.2",
154
+ "@tiptap/extension-strike": "3.32.2",
155
+ "@tiptap/extension-text": "3.32.2",
156
+ "@tiptap/extension-underline": "3.32.2",
157
+ "@tiptap/extensions": "3.32.2",
158
+ "@tiptap/pm": "3.32.2",
159
+ "@tiptap/starter-kit": "3.32.2",
160
+ "@tiptap/static-renderer": "3.32.2",
161
+ "lexical": "0.53.0",
160
162
  "oxlint-tsgolint": "7.0.2005",
161
163
  "regenerate": "1.5.0",
162
164
  "vite>esbuild": "0.27.7"
@@ -169,17 +171,18 @@
169
171
  "patchedDependencies": {
170
172
  "octane@0.16.3": "patches/octane@0.16.3.patch",
171
173
  "@nativescript/core@9.1.3": "patches/@nativescript__core@9.1.3.patch",
174
+ "@octane-xplat/nativescript-mason-core@1.0.0-beta.7": "patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch",
172
175
  "css@3.0.0": "patches/css@3.0.0.patch",
173
176
  "@nativescript/vite@8.0.20": "patches/@nativescript__vite@8.0.20.patch",
174
177
  "@nativescript-community/octane@0.2.5": "patches/@nativescript-community__octane@0.2.5.patch",
175
178
  "@nativescript-community/vite-octane@0.2.1": "patches/@nativescript-community__vite-octane@0.2.1.patch",
176
- "@tsrx/typescript-plugin@0.4.11": "patches/@tsrx__typescript-plugin@0.4.11.patch",
177
- "@octanejs/tiptap@0.0.61": "patches/@octanejs__tiptap@0.0.61.patch",
179
+ "@octanejs/tiptap@0.0.62": "patches/@octanejs__tiptap@0.0.62.patch",
178
180
  "@nativescript/doctor@2.0.18": "patches/@nativescript__doctor@2.0.18.patch",
179
181
  "@sveltejs/acorn-typescript@1.0.13": "patches/@sveltejs__acorn-typescript@1.0.13.patch",
180
182
  "@nativescript-community/sqlite-bridge@4.1.1": "patches/@nativescript-community__sqlite-bridge@4.1.1.patch"
181
183
  },
182
184
  "trustedDependencies": [
185
+ "@octane-xplat/cli",
183
186
  "esbuild",
184
187
  "@parcel/watcher"
185
188
  ]
@@ -35,7 +35,7 @@ index 80e30299c44e889e3a066ce2c9a8feb6b7ceaa42..85c447ecf9952d28019f3093faab1600
35
35
  * Mount an Octane component into an existing NativeScript view.
36
36
  *
37
37
  diff --git a/dist/driver.js b/dist/driver.js
38
- index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad06226494 100644
38
+ index 8bc563add4cb675a12651184b63805b10224274d..0f0e395ce195862db32ef5539e086de84b8828d2 100644
39
39
  --- a/dist/driver.js
40
40
  +++ b/dist/driver.js
41
41
  @@ -1,8 +1,11 @@
@@ -166,7 +166,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
166
166
  if (typeof value === 'string')
167
167
  return value;
168
168
  if (Array.isArray(value))
169
- @@ -147,16 +190,309 @@ function normalizeClass(value) {
169
+ @@ -147,23 +190,397 @@ function normalizeClass(value) {
170
170
  .join(' ');
171
171
  return '';
172
172
  }
@@ -296,7 +296,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
296
296
  +function warnStyleOnlyProp(node, name) {
297
297
  + const key = node.type + ':' + name;
298
298
  + if (warnedStyleOnlyProps.has(key))
299
- + return;
299
+ return;
300
300
  + warnedStyleOnlyProps.add(key);
301
301
  + console.warn(`[xplat] <${node.type} ${name}=...> is a layout key — move it into style={{ ${name}: ... }} or a class.`);
302
302
  +}
@@ -376,8 +376,11 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
376
376
  + style.overflowX = enabled ? 'scroll' : 'hidden';
377
377
  + style.overflowY = enabled ? 'scroll' : 'hidden';
378
378
  + }
379
- + }
380
- +}
379
+ }
380
+ - if (typeof value === 'object')
381
+ - Object.assign(view.style, value);
382
+ }
383
+ -/** Recompute a text host's `text` from its `#text` children. */
381
384
  +
382
385
  +/** Keep foreign leaves in sync with the effective NativeScript cascade.
383
386
  + * MasonKit's property handlers only forward to its own _styleHelper views.
@@ -390,10 +393,8 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
390
393
  + return;
391
394
  + if (masonLeafBindings.has(view)) {
392
395
  + masonLeafBindings.get(view).sync();
393
- return;
394
- }
395
- - if (typeof value === 'object')
396
- - Object.assign(view.style, value);
396
+ + return;
397
+ + }
397
398
  + let native;
398
399
  + let leaf;
399
400
  + let defaultDisplay;
@@ -470,7 +471,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
470
471
  + },
471
472
  + });
472
473
  + sync();
473
- }
474
+ +}
474
475
  +function releaseMasonChildLayout(view) {
475
476
  + if (!view)
476
477
  + return;
@@ -478,10 +479,98 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
478
479
  + masonLeafBindings.delete(view);
479
480
  +}
480
481
  +
481
- /** Recompute a text host's `text` from its `#text` children. */
482
+ +/** Mint (or reuse) the driver-owned Span a `#text` child folds into when it
483
+ + * shares its text host with run elements, then apply its current text. */
484
+ +function foldedSpan(parent, child) {
485
+ + const spans = (parent.textSpans ??= new Map());
486
+ + for (const key of [...spans.keys()])
487
+ + if (!parent.children.includes(key))
488
+ + spans.delete(key);
489
+ + let span = spans.get(child);
490
+ + if (span === undefined) {
491
+ + span = new Span();
492
+ + spans.set(child, span);
493
+ + }
494
+ + span.text = child.text;
495
+ + return span;
496
+ +}
497
+ +/** Assign a FormattedString's run list in place. Removed spans leave the
498
+ + * collection before any re-add — a span re-enters only after its parent
499
+ + * clears, so reorder/growth never re-adds a still-parented span. */
500
+ +function replaceSpans(fs, runs) {
501
+ + const spans = fs.spans;
502
+ + let i = 0;
503
+ + while (i < spans.length && i < runs.length && spans[i] === runs[i])
504
+ + i++;
505
+ + if (i === spans.length && i === runs.length)
506
+ + return;
507
+ + if (i < spans.length)
508
+ + spans.splice(i, spans.length - i);
509
+ + if (i < runs.length)
510
+ + spans.splice(i, 0, ...runs.slice(i));
511
+ +}
512
+ +/** Recompute a text host's text from its `#text` children, folding mixed
513
+ + * text/run children into a single FormattedString in child order. `Span`
514
+ + * under a TextBase auto-wraps into `formattedText`; `#text` under
515
+ + * FormattedString/Span folds to text (octane-xplat decisions #25). */
482
516
  function syncText(parent) {
483
517
  if (parent === null || isPortalTarget(parent))
484
- @@ -190,6 +526,15 @@ function addViewChild(parentView, view, index) {
518
+ return;
519
+ const view = parent.view;
520
+ + if (view instanceof Span) {
521
+ + // A Span can't host views; its `#text` children fold into `text`.
522
+ + let text = '';
523
+ + for (const child of parent.children)
524
+ + if (child.view === null)
525
+ + text += child.text;
526
+ + view.text = text;
527
+ + return;
528
+ + }
529
+ + if (view instanceof FormattedString) {
530
+ + // Span children splice through add/removeViewChild; `#text` children
531
+ + // fold into minted spans interleaved in child order.
532
+ + if (!parent.children.some((child) => child.view === null))
533
+ + return;
534
+ + const runs = [];
535
+ + for (const child of parent.children) {
536
+ + if (child.view === null)
537
+ + runs.push(foldedSpan(parent, child));
538
+ + else if (child.view instanceof Span)
539
+ + runs.push(child.view);
540
+ + }
541
+ + replaceSpans(view, runs);
542
+ + return;
543
+ + }
544
+ if (!(view instanceof TextBase))
545
+ return;
546
+ + const elementChildren = parent.children.filter((child) => child.view !== null);
547
+ + if (elementChildren.length > 0 &&
548
+ + elementChildren.every((child) => child.view instanceof Span)) {
549
+ + // Mixed text/span children fold into one driver-owned FormattedString
550
+ + // in child order. An explicit formattedstring child or another view
551
+ + // type keeps its own attach path instead of joining the fold.
552
+ + const folded = (parent.foldedText ??= { fs: new FormattedString() });
553
+ + const runs = [];
554
+ + for (const child of parent.children)
555
+ + runs.push(child.view === null ? foldedSpan(parent, child) : child.view);
556
+ + replaceSpans(folded.fs, runs);
557
+ + if (view.formattedText !== folded.fs)
558
+ + view.formattedText = folded.fs;
559
+ + if (parent.textApplied || view.text !== '') {
560
+ + parent.textApplied = false;
561
+ + view.text = '';
562
+ + }
563
+ + return;
564
+ + }
565
+ + if (parent.foldedText != null) {
566
+ + if (view.formattedText === parent.foldedText.fs)
567
+ + view.formattedText = CLEARED;
568
+ + parent.foldedText = null;
569
+ + }
570
+ let text = '';
571
+ let found = false;
572
+ for (const child of parent.children) {
573
+ @@ -190,6 +607,15 @@ function addViewChild(parentView, view, index) {
485
574
  parentView.insertChild(view, Math.min(index, parentView.getChildrenCount()));
486
575
  return;
487
576
  }
@@ -497,7 +586,32 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
497
586
  if (parentView instanceof ContentView) {
498
587
  parentView.content = view;
499
588
  return;
500
- @@ -234,6 +579,13 @@ function removeViewChild(parentView, view) {
589
+ @@ -203,9 +629,24 @@ function addViewChild(parentView, view, index) {
590
+ return;
591
+ }
592
+ if (parentView instanceof FormattedString && view instanceof Span) {
593
+ + // When the formattedstring mixes `#text` and span children, syncText
594
+ + // owns the whole ordered run list.
595
+ + const owner = viewOwners.get(parentView)?.node;
596
+ + if (owner != null && owner.children.some((child) => child.view === null)) {
597
+ + syncText(owner);
598
+ + return;
599
+ + }
600
+ parentView.spans.splice(Math.min(index, parentView.spans.length), 0, view);
601
+ return;
602
+ }
603
+ + if (parentView instanceof TextBase && view instanceof Span) {
604
+ + // A span run under a text host joins its folded FormattedString;
605
+ + // syncText rebuilds the ordered run list.
606
+ + const owner = viewOwners.get(parentView)?.node;
607
+ + if (owner != null)
608
+ + syncText(owner);
609
+ + return;
610
+ + }
611
+ if (parentView instanceof TextBase && view instanceof FormattedString) {
612
+ parentView.formattedText = view;
613
+ return;
614
+ @@ -234,6 +675,13 @@ function removeViewChild(parentView, view) {
501
615
  parentView.removeChild(view);
502
616
  return;
503
617
  }
@@ -511,7 +625,30 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
511
625
  if (parentView instanceof ContentView) {
512
626
  if (parentView.content === view)
513
627
  parentView.content = CLEARED;
514
- @@ -315,6 +667,7 @@ function tabViewOwning(node) {
628
+ @@ -248,11 +696,22 @@ function removeViewChild(parentView, view) {
629
+ return;
630
+ }
631
+ if (parentView instanceof FormattedString && view instanceof Span) {
632
+ + const owner = viewOwners.get(parentView)?.node;
633
+ + if (owner != null && owner.children.some((child) => child.view === null)) {
634
+ + syncText(owner);
635
+ + return;
636
+ + }
637
+ const index = parentView.spans.indexOf(view);
638
+ if (index !== -1)
639
+ parentView.spans.splice(index, 1);
640
+ return;
641
+ }
642
+ + if (parentView instanceof TextBase && view instanceof Span) {
643
+ + const owner = viewOwners.get(parentView)?.node;
644
+ + if (owner != null)
645
+ + syncText(owner);
646
+ + return;
647
+ + }
648
+ if (parentView instanceof TextBase && parentView.formattedText === view) {
649
+ parentView.formattedText = CLEARED;
650
+ return;
651
+ @@ -315,6 +774,7 @@ function tabViewOwning(node) {
515
652
  return null;
516
653
  }
517
654
  function detach(container, node) {
@@ -519,7 +656,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
519
656
  const parent = node.parent;
520
657
  const siblings = childrenOf(container, parent);
521
658
  const index = siblings.indexOf(node);
522
- @@ -370,6 +723,12 @@ function attach(container, node) {
659
+ @@ -370,6 +830,12 @@ function attach(container, node) {
523
660
  }
524
661
  }
525
662
  addViewChild(parentView, node.view, index);
@@ -532,7 +669,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
532
669
  markTabView(tabViewOwning(node));
533
670
  }
534
671
  function insert(container, parent, node, before) {
535
- @@ -395,6 +754,23 @@ function insert(container, parent, node, before) {
672
+ @@ -395,6 +861,23 @@ function insert(container, parent, node, before) {
536
673
  * nests an apply, so this is a depth rather than a flag.
537
674
  */
538
675
  let applyingDepth = 0;
@@ -556,7 +693,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
556
693
  function setEvent(container, node, type, listener) {
557
694
  const view = node.view;
558
695
  if (view === null)
559
- @@ -429,6 +805,7 @@ function setEvent(container, node, type, listener) {
696
+ @@ -429,6 +912,7 @@ function setEvent(container, node, type, listener) {
560
697
  view.on(type, handler);
561
698
  }
562
699
  function disposeListeners(node) {
@@ -564,7 +701,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
564
701
  const view = node.view;
565
702
  if (view !== null) {
566
703
  for (const [type, handler] of node.listeners)
567
- @@ -460,6 +837,7 @@ function recreateView(container, node) {
704
+ @@ -460,6 +944,7 @@ function recreateView(container, node) {
568
705
  // no longer host them.
569
706
  throw new Error(`NativeScript driver: re-registered <${node.type}> is a <${view.typeName}>, which cannot host portal children; the registration stays on the previous view.`);
570
707
  }
@@ -572,7 +709,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
572
709
  const parentView = hostViewOf(container, node.parent);
573
710
  for (const child of node.children) {
574
711
  if (child.view !== null)
575
- @@ -480,6 +858,9 @@ function recreateView(container, node) {
712
+ @@ -480,6 +965,9 @@ function recreateView(container, node) {
576
713
  viewOwners.set(view, { container, node });
577
714
  node.view = view;
578
715
  node.textApplied = false;
@@ -582,7 +719,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
582
719
  applyProps(node, node.props);
583
720
  for (const [type, handler] of node.listeners)
584
721
  view.on(type, handler);
585
- @@ -500,6 +881,12 @@ function recreateView(container, node) {
722
+ @@ -500,6 +988,12 @@ function recreateView(container, node) {
586
723
  addViewChild(view, child.view, index++);
587
724
  }
588
725
  }
@@ -595,7 +732,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
595
732
  syncText(node);
596
733
  markTabView(node);
597
734
  attach(container, node);
598
- @@ -548,7 +935,7 @@ function preparePortalTarget(context) {
735
+ @@ -548,7 +1042,7 @@ function preparePortalTarget(context) {
599
736
  }
600
737
  const target = owner?.node.view ?? suppliedTarget;
601
738
  if (!(target instanceof LayoutBase)) {
@@ -604,7 +741,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
604
741
  }
605
742
  let id = portalTargetIds.get(target);
606
743
  if (id === undefined) {
607
- @@ -641,7 +1028,7 @@ function applyCommand(container, command) {
744
+ @@ -641,7 +1135,7 @@ function applyCommand(container, command) {
608
745
  }
609
746
  export const nativeScriptDriver = {
610
747
  id: NATIVESCRIPT_RENDERER_ID,
@@ -613,7 +750,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
613
750
  events: {
614
751
  classify(name) {
615
752
  if (!EVENT_PROP.test(name))
616
- @@ -656,6 +1043,7 @@ export const nativeScriptDriver = {
753
+ @@ -656,6 +1150,7 @@ export const nativeScriptDriver = {
617
754
  }
618
755
  return {
619
756
  apply() {
@@ -621,7 +758,7 @@ index 8bc563add4cb675a12651184b63805b10224274d..494acc783b1608485e640e157ee9d9ad
621
758
  applyingDepth++;
622
759
  pendingTabViews.push(new Set());
623
760
  try {
624
- @@ -670,6 +1058,7 @@ export const nativeScriptDriver = {
761
+ @@ -670,6 +1165,7 @@ export const nativeScriptDriver = {
625
762
  applyingDepth--;
626
763
  }
627
764
  }
@@ -1180,3 +1180,101 @@ index e75c7c8010e23917a7138c7351243aab0bad1f49..7cf9244c0290a76b186c15f13cc94ca7
1180
1180
  function isRule(node) {
1181
1181
  return node.type === 'rule';
1182
1182
  }
1183
+ diff --git a/ui/styling/font.ios.js b/ui/styling/font.ios.js
1184
+ index 31fd457fd1929618042db5c35ca687e23b0c05d7..8938d4224a86a996e21f7217d8785547214d5cbd 100644
1185
+ --- a/ui/styling/font.ios.js
1186
+ +++ b/ui/styling/font.ios.js
1187
+ @@ -4,9 +4,9 @@ import { File, Folder, knownFolders, path } from '../../file-system';
1188
+ export { FontStyle, FontWeight, FontVariationSettings, parseFont } from './font-common';
1189
+ const uiFontCache = new Map();
1190
+ function computeFontCacheKey(fontDescriptor) {
1191
+ - const { fontFamily, fontSize, fontWeight, fontVariationSettings, isBold, isItalic } = fontDescriptor;
1192
+ + const { fontFamily, fontSize, fontWeight, cssFontWeight, fontVariationSettings, isBold, isItalic } = fontDescriptor;
1193
+ const sep = ':';
1194
+ - return [fontFamily.join(sep), fontSize, fontWeight, String(FontVariationSettings.toString(fontVariationSettings)).replace(/'/g, '').replace(/[\s,]/g, '_'), isBold, isItalic].join(sep);
1195
+ + return [fontFamily.join(sep), fontSize, fontWeight, cssFontWeight, String(FontVariationSettings.toString(fontVariationSettings)).replace(/'/g, '').replace(/[\s,]/g, '_'), isBold, isItalic].join(sep);
1196
+ }
1197
+ function getUIFontCached(fontDescriptor) {
1198
+ const cacheKey = computeFontCacheKey(fontDescriptor);
1199
+ @@ -17,25 +17,38 @@ function getUIFontCached(fontDescriptor) {
1200
+ return uiFontCache.get(cacheKey);
1201
+ }
1202
+ let uiFont = NativeScriptUtils.createUIFont(fontDescriptor);
1203
+ - if (fontDescriptor.fontVariationSettings?.length) {
1204
+ - let font = CGFontCreateWithFontName(uiFont.fontName);
1205
+ - const variationAxes = CGFontCopyVariationAxes(font);
1206
+ - // This can be null if font doesn't support axes
1207
+ - if (variationAxes?.count) {
1208
+ - const variationSettings = NSMutableDictionary.new();
1209
+ - const variationAxesCount = variationAxes.count;
1210
+ - const variationAxesNames = [];
1211
+ - for (let i = 0, length = variationAxes.count; i < length; i++) {
1212
+ - variationAxesNames.push(String(variationAxes[i].objectForKey('kCGFontVariationAxisName')));
1213
+ - }
1214
+ - for (const variationSetting of fontDescriptor.fontVariationSettings) {
1215
+ - const axisName = fuzzySearch(variationSetting.axis, variationAxesNames);
1216
+ - if (axisName?.length) {
1217
+ - variationSettings.setValueForKey(variationSetting.value, axisName[0]);
1218
+ - }
1219
+ + // Resolve axes after the native CSS cascade has produced this Font. Keep
1220
+ + // derived coordinates out of the authored/inherited variation settings.
1221
+ + const axes = CTFontCopyVariationAxes(uiFont);
1222
+ + if (axes?.count) {
1223
+ + const variations = NSMutableDictionary.new();
1224
+ + const current = CTFontCopyVariation(uiFont);
1225
+ + if (current) {
1226
+ + variations.addEntriesFromDictionary(current);
1227
+ + }
1228
+ + let changed = false;
1229
+ + const settings = fontDescriptor.fontVariationSettings || [];
1230
+ + for (let index = 0; index < axes.count; index++) {
1231
+ + const axis = axes.objectAtIndex(index);
1232
+ + const identifier = Number(axis.objectForKey(kCTFontVariationAxisIdentifierKey));
1233
+ + const tag = String.fromCharCode(identifier >>> 24, (identifier >>> 16) & 255, (identifier >>> 8) & 255, identifier & 255);
1234
+ + const name = String(axis.objectForKey(kCTFontVariationAxisNameKey));
1235
+ + const explicit = settings.find((setting) => setting.axis.toLowerCase() === tag.toLowerCase())
1236
+ + || settings.find((setting) => fuzzySearch(setting.axis, [name]).length > 0);
1237
+ + const value = explicit ? explicit.value : tag === 'wght' ? fontDescriptor.cssFontWeight : undefined;
1238
+ + if (value === undefined) {
1239
+ + continue;
1240
+ }
1241
+ - font = CGFontCreateCopyWithVariations(font, variationSettings);
1242
+ - uiFont = CTFontCreateWithGraphicsFont(font, fontDescriptor.fontSize, null, null);
1243
+ + const minimum = Number(axis.objectForKey(kCTFontVariationAxisMinimumValueKey));
1244
+ + const maximum = Number(axis.objectForKey(kCTFontVariationAxisMaximumValueKey));
1245
+ + variations.setObjectForKey(Math.max(minimum, Math.min(maximum, value)), identifier);
1246
+ + changed = true;
1247
+ + }
1248
+ + if (changed) {
1249
+ + // Copy the resolved font so family, italic transforms and other
1250
+ + // selected coordinates survive the weight adjustment.
1251
+ + const descriptor = UIFontDescriptor.fontDescriptorWithFontAttributes({ [kCTFontVariationAttribute]: variations });
1252
+ + uiFont = CTFontCreateCopyWithAttributes(uiFont, fontDescriptor.fontSize, null, descriptor);
1253
+ }
1254
+ }
1255
+ uiFontCache.set(cacheKey, uiFont);
1256
+ @@ -72,6 +85,7 @@ export class Font extends FontBase {
1257
+ // Apply a11y scale and calculate proper font size (avoid applying multiplier to native point size as it's messing calculations)
1258
+ fontSize: this.fontSize ? this.fontSize * this.fontScale : defaultFont.pointSize,
1259
+ fontWeight: getNativeFontWeight(this.fontWeight),
1260
+ + cssFontWeight: getNumericFontWeight(this.fontWeight),
1261
+ fontVariationSettings: this.fontVariationSettings,
1262
+ isBold: this.isBold,
1263
+ isItalic: this.isItalic,
1264
+ @@ -82,6 +96,16 @@ export class Font extends FontBase {
1265
+ }
1266
+ }
1267
+ Font.default = new Font(undefined, undefined);
1268
+ +function getNumericFontWeight(weight) {
1269
+ + if (weight == null || weight === FontWeight.NORMAL) {
1270
+ + return 400;
1271
+ + }
1272
+ + if (weight === FontWeight.BOLD) {
1273
+ + return 700;
1274
+ + }
1275
+ + const numeric = Number(weight);
1276
+ + return Number.isFinite(numeric) ? numeric : 400;
1277
+ +}
1278
+ function getNativeFontWeight(fontWeight) {
1279
+ const value = typeof fontWeight === 'number' ? fontWeight + '' : fontWeight;
1280
+ switch (value) {