create-octane-xplat 0.18.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 (77) hide show
  1. package/README.md +2 -144
  2. package/compatibility.json +97 -19
  3. package/compatibility.ts +141 -72
  4. package/dist/compatibility.js +66 -26
  5. package/dist/index.js +127 -64
  6. package/dist/package-manager.js +62 -0
  7. package/dist/scaffold.js +377 -127
  8. package/index.ts +256 -154
  9. package/library-template/AGENTS.md +6 -4
  10. package/library-template/README.md +22 -18
  11. package/library-template/bunfig +4 -0
  12. package/library-template/package.json +115 -18
  13. package/library-template/patches/@nativescript-community__octane@0.2.5.patch +1018 -0
  14. package/library-template/patches/@nativescript-community__sqlite-bridge@4.1.1.patch +30 -0
  15. package/library-template/patches/@nativescript-community__vite-octane@0.2.1.patch +72 -0
  16. package/library-template/patches/@nativescript__core@9.1.3.patch +1280 -0
  17. package/library-template/patches/@nativescript__doctor@2.0.18.patch +13 -0
  18. package/library-template/patches/@nativescript__vite@8.0.20.patch +2019 -0
  19. package/library-template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
  20. package/library-template/patches/@octanejs__tiptap@0.0.62.patch +12 -0
  21. package/library-template/patches/@sveltejs__acorn-typescript@1.0.13.patch +16 -0
  22. package/library-template/patches/css@3.0.0.patch +52 -0
  23. package/library-template/patches/octane@0.16.3.patch +1479 -0
  24. package/library-template/src/Badge.tsx +7 -6
  25. package/library-template/src/Badge.web.tsx +7 -6
  26. package/library-template/src/Welcome.stories.tsx +12 -0
  27. package/library-template/src/normalizeBadgeLabel.ts +1 -1
  28. package/library-template/src/props.ts +11 -11
  29. package/library-template/tests/normalizeBadgeLabel.test.ts +1 -1
  30. package/library-template/tests/packed-consumer.mjs +140 -123
  31. package/library-template/tsconfig.envs.json +1 -0
  32. package/library-template/tsconfig.json +1 -0
  33. package/library-template/tsconfig.types.json +15 -1
  34. package/library-template/tsrx-typegen.json +1 -1
  35. package/library-template/workshop.config.ts +3 -0
  36. package/package-manager.ts +93 -0
  37. package/package.json +70 -58
  38. package/scaffold.ts +1056 -526
  39. package/template/.agents/skills/xplat/SKILL.md +6 -6
  40. package/template/.agents/skills/xplat/references/components.md +1 -1
  41. package/template/.agents/skills/xplat/references/navigation.md +1 -1
  42. package/template/.agents/skills/xplat/references/styling.md +14 -14
  43. package/template/AGENTS.md +10 -10
  44. package/template/bunfig +4 -0
  45. package/template/gitignore +1 -0
  46. package/template/nativescript.config.ts +13 -16
  47. package/template/package.json +119 -10
  48. package/template/patches/@nativescript-community__octane@0.2.5.patch +1018 -0
  49. package/template/patches/@nativescript-community__sqlite-bridge@4.1.1.patch +30 -0
  50. package/template/patches/@nativescript-community__vite-octane@0.2.1.patch +72 -0
  51. package/template/patches/@nativescript__core@9.1.3.patch +1280 -0
  52. package/template/patches/@nativescript__doctor@2.0.18.patch +13 -0
  53. package/template/patches/@nativescript__vite@8.0.20.patch +2019 -0
  54. package/template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
  55. package/template/patches/@octanejs__tiptap@0.0.62.patch +12 -0
  56. package/template/patches/@sveltejs__acorn-typescript@1.0.13.patch +16 -0
  57. package/template/patches/css@3.0.0.patch +52 -0
  58. package/template/patches/octane@0.16.3.patch +1479 -0
  59. package/template/src/App.tsrx +77 -42
  60. package/template/src/Welcome.stories.tsx +22 -0
  61. package/template/src/app.spec.tsrx +169 -163
  62. package/template/src/app.web.test.tsx +18 -13
  63. package/template/src/failure-reporting.spec.ts +3 -3
  64. package/template/src/main.ts +14 -13
  65. package/template/src/main.tsrx +2 -0
  66. package/template/src/main.web.tsrx +5 -5
  67. package/template/src/native-runtime.spec.ts +13 -11
  68. package/template/src/test-setup.web.ts +9 -8
  69. package/template/src/test.ts +6 -6
  70. package/template/tsconfig.json +17 -1
  71. package/template/vite.config.native.mts +1 -2
  72. package/template/vite.config.ts +29 -23
  73. package/template/vitest.config.mts +18 -18
  74. package/template/vitest.web.config.mts +7 -7
  75. package/template/workshop.config.ts +3 -0
  76. package/library-template/pnpm-workspace.yaml +0 -171
  77. package/template/pnpm-workspace.yaml +0 -192
@@ -0,0 +1,1018 @@
1
+ diff --git a/dist/driver.d.ts b/dist/driver.d.ts
2
+ index 80e30299c44e889e3a066ce2c9a8feb6b7ceaa42..85c447ecf9952d28019f3093faab16005c81e4a6 100644
3
+ --- a/dist/driver.d.ts
4
+ +++ b/dist/driver.d.ts
5
+ @@ -1,5 +1,5 @@
6
+ import { type EventData, LayoutBase, type ViewBase } from '@nativescript/core';
7
+ -import { type UniversalHostDriver, type UniversalPortalTargetHandle, type UniversalRoot } from 'octane/universal/native';
8
+ +import { type UniversalHostCommand, type UniversalHostDriver, type UniversalPortalTargetHandle, type UniversalRoot } from 'octane/universal/native';
9
+ interface HostNode {
10
+ readonly id: number;
11
+ readonly type: string;
12
+ @@ -14,6 +14,9 @@ interface HostNode {
13
+ readonly muted: Set<string>;
14
+ /** Whether this node's `text` has been driven by `#text` children. */
15
+ textApplied: boolean;
16
+ + readonly propDefaults: Map<string, unknown>;
17
+ + readonly styleDefaults: Map<string, unknown>;
18
+ + styleKeys: Set<string>;
19
+ }
20
+ /**
21
+ * A command `parent`: a host node id's node, the root container (`null`), or a
22
+ @@ -42,6 +45,14 @@ export interface NativeScriptContainer {
23
+ root: UniversalRoot | null;
24
+ }
25
+ export declare const nativeScriptDriver: UniversalHostDriver<NativeScriptContainer, ViewBase | null>;
26
+ +export interface BatchObserver {
27
+ + /** Before a batch's commands apply; the previous layout is still on screen. */
28
+ + willApply?(container: NativeScriptContainer, commands: readonly UniversalHostCommand[], depth: number): void;
29
+ + /** After the batch's commands and the tab-view flush applied. Not called if apply threw. */
30
+ + didApply?(container: NativeScriptContainer, commands: readonly UniversalHostCommand[], depth: number): void;
31
+ +}
32
+ +/** Observe every batch on every NativeScript root; returns an unsubscribe. */
33
+ +export declare function observeBatches(observer: BatchObserver): () => void;
34
+ /**
35
+ * Mount an Octane component into an existing NativeScript view.
36
+ *
37
+ diff --git a/dist/driver.js b/dist/driver.js
38
+ index 8bc563add4cb675a12651184b63805b10224274d..0f0e395ce195862db32ef5539e086de84b8828d2 100644
39
+ --- a/dist/driver.js
40
+ +++ b/dist/driver.js
41
+ @@ -1,8 +1,11 @@
42
+ -import { ActionBar, ContentView, FormattedString, LayoutBase, ListView, Span, TabView, TabViewItem, TextBase, View, unsetValue, } from '@nativescript/core';
43
+ +import { cssTreeParse } from '@nativescript/core/css/css-tree-parser';
44
+ +import { _getProperties, _getStyleProperties, } from '@nativescript/core/ui/core/properties';
45
+ +import { ActionBar, ContentView, FormattedString, LayoutBase, ListView, Span, TabView, TabViewItem, TextBase, View, Utils, unsetValue, } from '@nativescript/core';
46
+ import { createUniversalRoot, } from 'octane/universal/native';
47
+ import { NATIVESCRIPT_RENDERER_ID } from './config.js';
48
+ import { ELEMENTS, EVENT_PROP, eventNameFor, onElementReplaced, } from './elements.js';
49
+ import { releaseListView, setRenderItem, } from './list-view.js';
50
+ +import { Style as MasonStyle } from '@octane-xplat/nativescript-masonkit/style';
51
+ /** `#text` nodes carry no view; the driver folds them into the parent's `text`. */
52
+ const TEXT = '#text';
53
+ /**
54
+ @@ -62,6 +65,9 @@ function createNode(container, id, type, props) {
55
+ listeners: new Map(),
56
+ muted: new Set(),
57
+ textApplied: false,
58
+ + propDefaults: new Map(),
59
+ + styleDefaults: new Map(),
60
+ + styleKeys: new Set(),
61
+ };
62
+ if (node.view !== null)
63
+ viewOwners.set(node.view, { container, node });
64
+ @@ -73,7 +79,10 @@ function instantiate(type) {
65
+ if (Element === undefined) {
66
+ throw new Error(`NativeScript driver: <${type}> is not a registered element.`);
67
+ }
68
+ - return new Element();
69
+ + const view = new Element();
70
+ + if (MASON_CONTAINER_TAGS.has(type))
71
+ + applyMasonDefaults(type, view);
72
+ + return view;
73
+ }
74
+ function applyProps(node, props) {
75
+ if (node.view === null) {
76
+ @@ -90,14 +99,16 @@ function applyProps(node, props) {
77
+ setProp(node, node.view, name, props[name]);
78
+ }
79
+ }
80
+ -/**
81
+ - * `update` carries the host's dynamic-prop snapshot; attributes that were
82
+ - * static in the compiled plan arrive only with `create`. Merge instead of
83
+ - * replace, or a first update would strip a node's static layout props.
84
+ - */
85
+ +/** `update` is the complete next bag, including the plan's static props. */
86
+ function updateProps(node, next) {
87
+ + for (const name of Object.keys(node.props)) {
88
+ + if (!Object.hasOwn(next, name) && node.view !== null)
89
+ + setProp(node, node.view, name, undefined);
90
+ + }
91
+ applyProps(node, next);
92
+ - node.props = { ...node.props, ...next };
93
+ + node.props = next;
94
+ + if (node.parent !== null && MASON_CONTAINER_TAGS.has(node.parent.type))
95
+ + applyMasonChildLayout(node, node.parent);
96
+ }
97
+ function setProp(node, view, name, value) {
98
+ if (name === 'children' || name === 'key' || name === 'ref')
99
+ @@ -105,6 +116,15 @@ function setProp(node, view, name, value) {
100
+ // Event props arrive as their own `event` commands.
101
+ if (EVENT_PROP.test(name))
102
+ return;
103
+ + if (value === undefined &&
104
+ + !node.propDefaults.has(name) &&
105
+ + (name !== 'style' || node.styleKeys.size === 0))
106
+ + return;
107
+ + if (value != null &&
108
+ + value !== unsetValue &&
109
+ + name !== 'style' &&
110
+ + !node.propDefaults.has(name))
111
+ + node.propDefaults.set(name, view[name]);
112
+ if (name === 'className' || name === 'class') {
113
+ view.className =
114
+ value == null || value === unsetValue
115
+ @@ -113,13 +133,31 @@ function setProp(node, view, name, value) {
116
+ return;
117
+ }
118
+ if (name === 'style') {
119
+ - applyStyle(view, value);
120
+ + applyStyle(node, view, value);
121
+ return;
122
+ }
123
+ if (name === 'renderItem' && view instanceof ListView) {
124
+ setRenderItem(view, value ?? null, createNativeScriptRoot);
125
+ return;
126
+ }
127
+ + // Mason cutover — all layout props are style-only: warn when a former
128
+ + // prop name arrives on a mason container or a child of one.
129
+ + if (MASON_CONTAINER_TAGS.has(node.type))
130
+ + applyMasonContainerProp(node, view, name, value);
131
+ + if (MASON_STYLE_ONLY_PROPS.has(name) &&
132
+ + (MASON_CONTAINER_TAGS.has(node.type) ||
133
+ + (node.parent !== null && MASON_CONTAINER_TAGS.has(node.parent.type))))
134
+ + warnStyleOnlyProp(node, name);
135
+ + // Never forward nullish values to coercing native setters. A never-applied
136
+ + // prop has nothing to restore, including when its initial value is undefined.
137
+ + const target = view;
138
+ + if (value == null || value === unsetValue) {
139
+ + if (!node.propDefaults.has(name))
140
+ + return;
141
+ + value = isRegisteredProperty(view, name)
142
+ + ? unsetValue
143
+ + : node.propDefaults.get(name);
144
+ + }
145
+ // Core raises `<name>Change` for a script write exactly as for a user
146
+ // edit; a controlled input must not see its own value come back as one.
147
+ const echo = `${name}Change`;
148
+ @@ -127,7 +165,10 @@ function setProp(node, view, name, value) {
149
+ if (listening)
150
+ node.muted.add(echo);
151
+ try {
152
+ - view[name] = value;
153
+ + target[name] = value;
154
+ + if (value === unsetValue &&
155
+ + _getStyleProperties().some((p) => p.name === name))
156
+ + refreshCss(view);
157
+ }
158
+ finally {
159
+ if (listening)
160
+ @@ -137,6 +178,8 @@ function setProp(node, view, name, value) {
161
+ // `class`/`className` compose clsx-style on the DOM renderer; join arrays
162
+ // with spaces so NativeScript's class selectors can match each class.
163
+ function normalizeClass(value) {
164
+ + if (typeof value === 'number')
165
+ + return value ? String(value) : '';
166
+ if (typeof value === 'string')
167
+ return value;
168
+ if (Array.isArray(value))
169
+ @@ -147,23 +190,397 @@ function normalizeClass(value) {
170
+ .join(' ');
171
+ return '';
172
+ }
173
+ -function applyStyle(view, value) {
174
+ - if (value == null || value === unsetValue)
175
+ - return;
176
+ +/** Match the actual registered setter, not merely a globally registered name. */
177
+ +function isRegisteredProperty(view, name) {
178
+ + let prototype = view;
179
+ + while (prototype !== null) {
180
+ + const descriptor = Object.getOwnPropertyDescriptor(prototype, name);
181
+ + if (descriptor !== undefined) {
182
+ + return (_getProperties().some((property) => property.name === name && property.set === descriptor.set) ||
183
+ + (_getStyleProperties().some((property) => property.name === name) &&
184
+ + descriptor.set !== undefined &&
185
+ + name in view.style));
186
+ + }
187
+ + prototype = Object.getPrototypeOf(prototype);
188
+ + }
189
+ + return false;
190
+ +}
191
+ +/** Core discards the cascaded value when a local value occupies its slot. */
192
+ +function refreshCss(view) {
193
+ + // No public single-key refresh exists in core 9.1. setInlineStyle only writes
194
+ + // declarations; the recursive _onCssStateChange would also touch descendants.
195
+ + view._cssState?.onChange();
196
+ +}
197
+ +/** Replace authored keys; clearing a local CssProperty must restore class CSS. */
198
+ +function applyStyle(node, view, value) {
199
+ + const style = view.style;
200
+ + const next = typeof value === 'string'
201
+ + ? inlineStyleKeys(value)
202
+ + : value !== null && typeof value === 'object' && value !== unsetValue
203
+ + ? new Set(Object.keys(value))
204
+ + : new Set();
205
+ + for (const key of node.styleKeys) {
206
+ + if (!next.has(key))
207
+ + unsetStyleKey(node, view, key);
208
+ + }
209
+ + for (const key of next) {
210
+ + if (!node.styleDefaults.has(key))
211
+ + node.styleDefaults.set(key, style[key]);
212
+ + }
213
+ if (typeof value === 'string') {
214
+ view.setInlineStyle(value);
215
+ + }
216
+ + else if (value !== null &&
217
+ + typeof value === 'object' &&
218
+ + value !== unsetValue) {
219
+ + for (const key of next) {
220
+ + const entry = value[key];
221
+ + if (entry == null || entry === unsetValue)
222
+ + unsetStyleKey(node, view, key);
223
+ + else
224
+ + style[key] = entry;
225
+ + }
226
+ + }
227
+ + node.styleKeys = next;
228
+ +}
229
+ +function unsetStyleKey(node, view, name) {
230
+ + // The foreign-leaf binding observes the resolved style, so removal needs
231
+ + // no leaf write here — the cascade restore raises the longhand's Change
232
+ + // event and the binding re-syncs.
233
+ + const style = view.style;
234
+ + if (name.startsWith('--')) {
235
+ + view.style.removeUnscopedCssVariable(name);
236
+ + }
237
+ + else {
238
+ + const registered = _getStyleProperties().some((p) => p.name === name || p.cssLocalName === name);
239
+ + style[name] = registered ? unsetValue : node.styleDefaults.get(name);
240
+ + }
241
+ + refreshCss(view);
242
+ +}
243
+ +function inlineStyleKeys(style) {
244
+ + const keys = new Set();
245
+ + const sheet = cssTreeParse(`local { ${style} }`, undefined);
246
+ + for (const rule of sheet.stylesheet.rules) {
247
+ + for (const declaration of rule.declarations ?? []) {
248
+ + if (declaration.type !== 'declaration')
249
+ + continue;
250
+ + const name = declaration.property;
251
+ + keys.add(name.startsWith('--')
252
+ + ? name
253
+ + : name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase()));
254
+ + }
255
+ + }
256
+ + return keys;
257
+ +}
258
+ +
259
+ +// --- Mason layout cutover ---------------------------------------------------
260
+ +// masonview is the single layout intrinsic — all layout is expressed in CSS
261
+ +// props (display/flex/grid/position), forwarded onto the node's mason Style.
262
+ +// scrollview stays the platform scroll shell (MasonKit Scroll). Dispatch is
263
+ +// by node tag, so nothing below re-derives the view's class.
264
+ +const MASON_CONTAINER_TAGS = new Set(['masonview', 'scrollview']);
265
+ +// Props whose CssProperty is registered on core's layout classes, never on
266
+ +// MasonKit's ViewBase — `view.flexDirection` would store a dead field, so the
267
+ +// write is forwarded to the mason Style surface instead.
268
+ +// Every former layout-prop name — contract props, LayoutChildProps sugar,
269
+ +// and raw CSS keys alike — is style-only now. As direct props they land on a
270
+ +// dead native field, so the driver warns once per key instead.
271
+ +const MASON_STYLE_ONLY_PROPS = new Set([
272
+ + 'display', 'position', 'inset', 'aspectRatio', 'overflow', 'overflowX',
273
+ + 'overflowY', 'flexBasis', 'justifySelf', 'justifyItems', 'direction',
274
+ + 'boxSizing', 'textAlign', 'scrollbarWidth', 'gridTemplateRows',
275
+ + 'gridTemplateColumns', 'gridTemplateAreas', 'gridAutoFlow', 'gridAutoRows',
276
+ + 'gridAutoColumns', 'gridRow', 'gridColumn', 'gridRowStart', 'gridRowEnd',
277
+ + 'gridColumnStart', 'gridColumnEnd', 'gridArea', 'flexDirection', 'flexWrap',
278
+ + 'justifyContent', 'alignItems', 'alignContent', 'gap', 'rowGap',
279
+ + 'columnGap', 'flexGrow', 'flexShrink', 'alignSelf', 'order', 'row', 'col',
280
+ + 'rowSpan', 'colSpan', 'dock', 'horizontalAlignment', 'verticalAlignment',
281
+ + 'flexWrapBefore', 'stretchLastChild', 'itemWidth', 'itemHeight',
282
+ + 'rows', 'columns',
283
+ +]);
284
+ +// Only leaf layout longhands: core expands shorthands before notifying.
285
+ +// Read the effective NS style, never copy authored values into another tier.
286
+ +const MASON_LEAF_STYLE_KEYS = [
287
+ + 'display',
288
+ + 'width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight',
289
+ + 'marginTop', 'marginRight', 'marginBottom', 'marginLeft',
290
+ + 'flexGrow', 'flexShrink', 'flexBasis', 'alignSelf', 'justifySelf',
291
+ + 'order', 'position', 'left', 'top', 'right', 'bottom', 'aspectRatio',
292
+ + 'gridRow', 'gridColumn', 'gridRowStart', 'gridRowEnd', 'gridColumnStart', 'gridColumnEnd',
293
+ +];
294
+ +const masonLeafBindings = new WeakMap();
295
+ +const warnedStyleOnlyProps = new Set();
296
+ +function warnStyleOnlyProp(node, name) {
297
+ + const key = node.type + ':' + name;
298
+ + if (warnedStyleOnlyProps.has(key))
299
+ return;
300
+ + warnedStyleOnlyProps.add(key);
301
+ + console.warn(`[xplat] <${node.type} ${name}=...> is a layout key — move it into style={{ ${name}: ... }} or a class.`);
302
+ +}
303
+ +
304
+ +/** A mason Style bound to the node's mason leaf — `_styleHelper` on MasonKit's
305
+ + * own views; for foreign ({N}-native) children, `Style.fromView` binds the
306
+ + * leaf node `nodeForView` creates at insert. Returns undefined until the
307
+ + * child's native view exists (props are stashed and replayed at attach). */
308
+ +function masonChildStyle(view) {
309
+ + if (view === null || view === undefined)
310
+ + return undefined;
311
+ + const helper = view._styleHelper;
312
+ + if (helper !== undefined)
313
+ + return helper;
314
+ + const native = view.nativeViewProtected;
315
+ + if (!native)
316
+ + return undefined;
317
+ + try {
318
+ + return MasonStyle.fromView(view, native);
319
+ + }
320
+ + catch {
321
+ + return undefined;
322
+ + }
323
+ +}
324
+ +
325
+ +/** NS attached alignment -> CSS self-alignment keyword. */
326
+ +function masonAlignKeyword(value) {
327
+ + switch (value) {
328
+ + case 'left':
329
+ + case 'top':
330
+ + return 'start';
331
+ + case 'right':
332
+ + case 'bottom':
333
+ + return 'end';
334
+ + case 'center':
335
+ + case 'middle':
336
+ + return 'center';
337
+ + case 'stretch':
338
+ + return 'stretch';
339
+ + }
340
+ + return undefined;
341
+ +}
342
+ +
343
+ +/** Container-role defaults — equivalent to each NS layout's built-in mode. */
344
+ +function applyMasonDefaults(type, view) {
345
+ + const style = view.style;
346
+ + if (type === 'scrollview') {
347
+ + style.display = 'flex';
348
+ + style.flexDirection = 'column';
349
+ + style.overflowY = 'scroll';
350
+ + style.overflowX = 'hidden';
351
+ + }
352
+ + // Core's alignItems CssProperty already defaults to stretch. A local
353
+ + // write here would outrank every stylesheet rule, including centering.
354
+ + // Containers establish the containing block for absolute descendants.
355
+ + // Write through the css-source accessor so stylesheet `position` rules
356
+ + // (e.g. `.vx-absolute > *` absolute children) still take effect — a
357
+ + // local write here shadowed them and pinned Windows overlays in flow.
358
+ + style['css:position'] = 'relative';
359
+ +}
360
+ +
361
+ +/** Container-role prop -> mason style write. Runs for every prop on a mason
362
+ + * container; only the scrollview chrome keys (orientation/scroll toggles)
363
+ + * still translate — everything else is style-only. */
364
+ +function applyMasonContainerProp(node, view, name, value) {
365
+ + const style = view.style;
366
+ + const unset = value == null || value === unsetValue;
367
+ + if (node.type === 'scrollview') {
368
+ + if (name === 'orientation' || name === 'horizontal') {
369
+ + const horizontal = !unset && (value === 'horizontal' || value === true);
370
+ + style.flexDirection = horizontal ? 'row' : 'column';
371
+ + style.overflowX = horizontal ? 'scroll' : 'hidden';
372
+ + style.overflowY = horizontal ? 'hidden' : 'scroll';
373
+ + }
374
+ + if (name === 'isScrollEnabled') {
375
+ + const enabled = !unset && value !== false;
376
+ + style.overflowX = enabled ? 'scroll' : 'hidden';
377
+ + style.overflowY = enabled ? 'scroll' : 'hidden';
378
+ + }
379
+ }
380
+ - if (typeof value === 'object')
381
+ - Object.assign(view.style, value);
382
+ }
383
+ -/** Recompute a text host's `text` from its `#text` children. */
384
+ +
385
+ +/** Keep foreign leaves in sync with the effective NativeScript cascade.
386
+ + * MasonKit's property handlers only forward to its own _styleHelper views.
387
+ + * Observe longhand changes so classes, pseudo states, inline removal and
388
+ + * stylesheet refreshes follow the same path. Rebind on loaded because the
389
+ + * native leaf may not exist at insert, or may have been recreated. */
390
+ +function applyMasonChildLayout(node, parent) {
391
+ + const view = node.view;
392
+ + if (!view || view._styleHelper !== undefined)
393
+ + return;
394
+ + if (masonLeafBindings.has(view)) {
395
+ + masonLeafBindings.get(view).sync();
396
+ + return;
397
+ + }
398
+ + let native;
399
+ + let leaf;
400
+ + let defaultDisplay;
401
+ + const applied = new Map();
402
+ + const syncKey = (key) => {
403
+ + if (!leaf)
404
+ + return;
405
+ + let value = view.style[key];
406
+ + // Core omits collapsed children from measurement. Mason must omit the
407
+ + // same leaf from layout, otherwise the two hosts disagree on its box.
408
+ + // Keep the cascade intact so uncollapsing restores authored display.
409
+ + if (key === 'display')
410
+ + value = view.style.visibility === 'collapse' ? 'none' : value ?? defaultDisplay;
411
+ + if (value === undefined || value === unsetValue) {
412
+ + // Plain/unregistered fields can vanish without a CssProperty
413
+ + // default. Mason requires an explicit grid reset (undefined is
414
+ + // ignored by its setters).
415
+ + if ((key === 'gridRow' || key === 'gridColumn') && applied.has(key))
416
+ + value = 'auto';
417
+ + else
418
+ + return;
419
+ + }
420
+ + // Core's auto self-alignment is Mason's normal (-1 / parent default).
421
+ + if ((key === 'alignSelf' || key === 'justifySelf') && value === 'auto')
422
+ + value = 'normal';
423
+ + if (typeof value === 'number' && !Number.isFinite(value))
424
+ + value = 'auto';
425
+ + // Mason's object px setter treats the number as DIP; core's parsed
426
+ + // px length is physical pixels. Convert once at this boundary.
427
+ + if (value && typeof value === 'object' && value.unit === 'px')
428
+ + value = { value: Utils.layout.toDeviceIndependentPixels(value.value), unit: 'dip' };
429
+ + const previous = applied.get(key);
430
+ + if (Object.is(previous, value) || (value && previous && typeof value === 'object' &&
431
+ + value.unit === previous.unit && value.value === previous.value))
432
+ + return;
433
+ + leaf[key] = value;
434
+ + applied.set(key, value);
435
+ + return true;
436
+ + };
437
+ + const sync = () => {
438
+ + if (native !== view.nativeViewProtected || !leaf) {
439
+ + native = view.nativeViewProtected;
440
+ + leaf = masonChildStyle(view);
441
+ + defaultDisplay = leaf?.display;
442
+ + applied.clear();
443
+ + }
444
+ + let changed = false;
445
+ + const update = () => {
446
+ + for (const key of MASON_LEAF_STYLE_KEYS)
447
+ + changed = syncKey(key) || changed;
448
+ + };
449
+ + // Foreign native style writes normally flush on a microtask, after
450
+ + // core may already have measured the parent. Commit first, then ask
451
+ + // the Mason container to recompute the foreign frame.
452
+ + if (leaf?.batch)
453
+ + leaf.batch(update);
454
+ + else
455
+ + update();
456
+ + if (changed)
457
+ + parent.view?.requestLayout?.();
458
+ + };
459
+ + const handlers = [...MASON_LEAF_STYLE_KEYS, 'visibility'].map(key => {
460
+ + const handler = () => sync();
461
+ + view.style.on?.(key + 'Change', handler);
462
+ + return [key + 'Change', handler];
463
+ + });
464
+ + view.on('loaded', sync);
465
+ + masonLeafBindings.set(view, {
466
+ + sync,
467
+ + dispose() {
468
+ + for (const [event, handler] of handlers)
469
+ + view.style.off?.(event, handler);
470
+ + view.off('loaded', sync);
471
+ + },
472
+ + });
473
+ + sync();
474
+ +}
475
+ +function releaseMasonChildLayout(view) {
476
+ + if (!view)
477
+ + return;
478
+ + masonLeafBindings.get(view)?.dispose();
479
+ + masonLeafBindings.delete(view);
480
+ +}
481
+ +
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). */
516
+ function syncText(parent) {
517
+ if (parent === null || isPortalTarget(parent))
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) {
574
+ parentView.insertChild(view, Math.min(index, parentView.getChildrenCount()));
575
+ return;
576
+ }
577
+ + // Custom-layout containers that own their child list without subclassing
578
+ + // LayoutBase (e.g. MasonKit ViewBase — CustomLayoutView → ContainerView).
579
+ + // Plain View/ContainerView lacks insertChild, so this stays a capability
580
+ + // check rather than a catch-all.
581
+ + if (typeof parentView.insertChild === 'function' && typeof parentView.removeChild === 'function') {
582
+ + const count = typeof parentView.getChildrenCount === 'function' ? parentView.getChildrenCount() : index;
583
+ + parentView.insertChild(view, Math.min(index, count));
584
+ + return;
585
+ + }
586
+ if (parentView instanceof ContentView) {
587
+ parentView.content = view;
588
+ return;
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) {
615
+ parentView.removeChild(view);
616
+ return;
617
+ }
618
+ + // Same capability check as addViewChild: custom-layout containers that
619
+ + // aren't LayoutBase subclasses remove children through removeChild.
620
+ + if (typeof parentView.removeChild === 'function' && typeof parentView.insertChild === 'function') {
621
+ + if (view.parent === parentView)
622
+ + parentView.removeChild(view);
623
+ + return;
624
+ + }
625
+ if (parentView instanceof ContentView) {
626
+ if (parentView.content === view)
627
+ parentView.content = CLEARED;
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) {
652
+ return null;
653
+ }
654
+ function detach(container, node) {
655
+ + releaseMasonChildLayout(node.view);
656
+ const parent = node.parent;
657
+ const siblings = childrenOf(container, parent);
658
+ const index = siblings.indexOf(node);
659
+ @@ -370,6 +830,12 @@ function attach(container, node) {
660
+ }
661
+ }
662
+ addViewChild(parentView, node.view, index);
663
+ + // The child's mason leaf node exists only once the parent has attached it;
664
+ + // synchronize effective styles after attachment.
665
+ + if (parent !== null && MASON_CONTAINER_TAGS.has(parent.type)) {
666
+ + for (const sibling of childrenOf(container, parent))
667
+ + applyMasonChildLayout(sibling, parent);
668
+ + }
669
+ markTabView(tabViewOwning(node));
670
+ }
671
+ function insert(container, parent, node, before) {
672
+ @@ -395,6 +861,23 @@ function insert(container, parent, node, before) {
673
+ * nests an apply, so this is a depth rather than a flag.
674
+ */
675
+ let applyingDepth = 0;
676
+ +const batchObservers = new Set();
677
+ +export function observeBatches(observer) {
678
+ + batchObservers.add(observer);
679
+ + return () => {
680
+ + batchObservers.delete(observer);
681
+ + };
682
+ +}
683
+ +function notifyBatchObservers(hook, container, commands, depth) {
684
+ + for (const observer of [...batchObservers]) {
685
+ + try {
686
+ + observer[hook]?.(container, commands, depth);
687
+ + }
688
+ + catch (error) {
689
+ + console.error('NativeScript driver: batch observer threw:', error);
690
+ + }
691
+ + }
692
+ +}
693
+ function setEvent(container, node, type, listener) {
694
+ const view = node.view;
695
+ if (view === null)
696
+ @@ -429,6 +912,7 @@ function setEvent(container, node, type, listener) {
697
+ view.on(type, handler);
698
+ }
699
+ function disposeListeners(node) {
700
+ + releaseMasonChildLayout(node.view);
701
+ const view = node.view;
702
+ if (view !== null) {
703
+ for (const [type, handler] of node.listeners)
704
+ @@ -460,6 +944,7 @@ function recreateView(container, node) {
705
+ // no longer host them.
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.`);
707
+ }
708
+ + releaseMasonChildLayout(previous);
709
+ const parentView = hostViewOf(container, node.parent);
710
+ for (const child of node.children) {
711
+ if (child.view !== null)
712
+ @@ -480,6 +965,9 @@ function recreateView(container, node) {
713
+ viewOwners.set(view, { container, node });
714
+ node.view = view;
715
+ node.textApplied = false;
716
+ + node.propDefaults.clear();
717
+ + node.styleDefaults.clear();
718
+ + node.styleKeys.clear();
719
+ applyProps(node, node.props);
720
+ for (const [type, handler] of node.listeners)
721
+ view.on(type, handler);
722
+ @@ -500,6 +988,12 @@ function recreateView(container, node) {
723
+ addViewChild(view, child.view, index++);
724
+ }
725
+ }
726
+ + if (MASON_CONTAINER_TAGS.has(node.type)) {
727
+ + for (const child of node.children) {
728
+ + releaseMasonChildLayout(child.view);
729
+ + applyMasonChildLayout(child, node);
730
+ + }
731
+ + }
732
+ syncText(node);
733
+ markTabView(node);
734
+ attach(container, node);
735
+ @@ -548,7 +1042,7 @@ function preparePortalTarget(context) {
736
+ }
737
+ const target = owner?.node.view ?? suppliedTarget;
738
+ if (!(target instanceof LayoutBase)) {
739
+ - throw new TypeError(`NativeScript driver: a <${target.typeName}> view cannot host portal children; target a layout (e.g. rootlayout, gridlayout).`);
740
+ + throw new TypeError(`NativeScript driver: a <${target.typeName}> view cannot host portal children; target a layout (e.g. rootlayout, masonview).`);
741
+ }
742
+ let id = portalTargetIds.get(target);
743
+ if (id === undefined) {
744
+ @@ -641,7 +1135,7 @@ function applyCommand(container, command) {
745
+ }
746
+ export const nativeScriptDriver = {
747
+ id: NATIVESCRIPT_RENDERER_ID,
748
+ - capabilities: { text: 'host' },
749
+ + capabilities: { text: 'host', visibility: true },
750
+ events: {
751
+ classify(name) {
752
+ if (!EVENT_PROP.test(name))
753
+ @@ -656,6 +1150,7 @@ export const nativeScriptDriver = {
754
+ }
755
+ return {
756
+ apply() {
757
+ + notifyBatchObservers('willApply', container, batch.commands, applyingDepth);
758
+ applyingDepth++;
759
+ pendingTabViews.push(new Set());
760
+ try {
761
+ @@ -670,6 +1165,7 @@ export const nativeScriptDriver = {
762
+ applyingDepth--;
763
+ }
764
+ }
765
+ + notifyBatchObservers('didApply', container, batch.commands, applyingDepth);
766
+ },
767
+ // Nothing is staged ahead of `apply`, so there is nothing to release.
768
+ abort() { },
769
+ diff --git a/dist/elements.js b/dist/elements.js
770
+ index a13bcea75176146f58f047be1d9c7b0cdda1120a..cecfae898004a6257a13be68bb39ae7d1307d0b4 100644
771
+ --- a/dist/elements.js
772
+ +++ b/dist/elements.js
773
+ @@ -1,4 +1,7 @@
774
+ -import { AbsoluteLayout, ActionBar, ActionItem, ActivityIndicator, Button, LiquidGlass, ContentView, DatePicker, DockLayout, FlexboxLayout, FormattedString, Frame, GridLayout, HtmlView, Image, Label, ListPicker, ListView, NavigationButton, Page, Placeholder, Progress, ProxyViewContainer, RootLayout, ScrollView, SearchBar, SegmentedBar, SegmentedBarItem, Slider, Span, StackLayout, Switch, TabView, TabViewItem, TextField, TextView, TimePicker, WebView, WrapLayout, } from '@nativescript/core';
775
+ +import { ActionBar, ActionItem, ActivityIndicator, Button, LiquidGlass, ContentView, DatePicker, FormattedString, Frame, HtmlView, Image, Label, ListPicker, ListView, NavigationButton, Page, Placeholder, Progress, ProxyViewContainer, RootLayout, SearchBar, SegmentedBar, SegmentedBarItem, Slider, Span, Switch, TabView, TabViewItem, TextField, TextView, TimePicker, WebView, } from '@nativescript/core';
776
+ +// Mason cutover: container intrinsics resolve to MasonKit views; the driver
777
+ +// translates their NativeScript-shaped props into mason style writes.
778
+ +import { View as MasonView, Scroll as MasonScroll } from '@octane-xplat/nativescript-masonkit';
779
+ /**
780
+ * Lowercase tag name -> view constructor. The keys are the JSX tag names of
781
+ * `intrinsics.ts`; an app extends the vocabulary with `registerElement`.
782
+ @@ -28,18 +31,14 @@ export function onElementReplaced(listener) {
783
+ };
784
+ }
785
+ const BUILTIN_ELEMENTS = [
786
+ - ['absolutelayout', AbsoluteLayout],
787
+ ['actionbar', ActionBar],
788
+ ['actionitem', ActionItem],
789
+ ['activityindicator', ActivityIndicator],
790
+ ['button', Button],
791
+ ['contentview', ContentView],
792
+ ['datepicker', DatePicker],
793
+ - ['docklayout', DockLayout],
794
+ - ['flexboxlayout', FlexboxLayout],
795
+ ['formattedstring', FormattedString],
796
+ ['frame', Frame],
797
+ - ['gridlayout', GridLayout],
798
+ ['htmlview', HtmlView],
799
+ ['image', Image],
800
+ ['label', Label],
801
+ @@ -51,13 +50,12 @@ const BUILTIN_ELEMENTS = [
802
+ ['progress', Progress],
803
+ ['proxyviewcontainer', ProxyViewContainer],
804
+ ['rootlayout', RootLayout],
805
+ - ['scrollview', ScrollView],
806
+ + ['scrollview', MasonScroll],
807
+ ['searchbar', SearchBar],
808
+ ['segmentedbar', SegmentedBar],
809
+ ['segmentedbaritem', SegmentedBarItem],
810
+ ['slider', Slider],
811
+ ['span', Span],
812
+ - ['stacklayout', StackLayout],
813
+ ['switch', Switch],
814
+ ['tabview', TabView],
815
+ ['tabviewitem', TabViewItem],
816
+ @@ -65,8 +63,8 @@ const BUILTIN_ELEMENTS = [
817
+ ['textview', TextView],
818
+ ['timepicker', TimePicker],
819
+ ['webview', WebView],
820
+ - ['wraplayout', WrapLayout],
821
+ ['liquidglass', LiquidGlass],
822
+ + ['masonview', MasonView],
823
+ ];
824
+ for (const [tag, element] of BUILTIN_ELEMENTS)
825
+ registerElement(tag, element);
826
+ diff --git a/dist/index.d.ts b/dist/index.d.ts
827
+ index 20937a1f9af4687cd53093c5e7f6225d550bec4b..f7e8b409f34e60abd55b509f1301989a02254389 100644
828
+ --- a/dist/index.d.ts
829
+ +++ b/dist/index.d.ts
830
+ @@ -10,8 +10,8 @@
831
+ * plugins by bare package id and folds `dist/` subpaths back onto the root.
832
+ */
833
+ export * from 'octane/universal/native';
834
+ -export { createNativeScriptRoot, nativeScriptDriver, renderNativeScriptApp, } from './driver.js';
835
+ -export type { NativeScriptContainer } from './driver.js';
836
+ +export { createNativeScriptRoot, nativeScriptDriver, observeBatches, renderNativeScriptApp, } from './driver.js';
837
+ +export type { BatchObserver, NativeScriptContainer } from './driver.js';
838
+ export { ELEMENTS, eventNameFor, onElementReplaced, registerElement, } from './elements.js';
839
+ export type { ElementConstructor } from './elements.js';
840
+ export type { RenderItem } from './list-view.js';
841
+ diff --git a/dist/index.js b/dist/index.js
842
+ index d7f912e56337a6692105395a0a7c524554dd9edd..0dc884630037aaa156f016676f4abf10c728e17d 100644
843
+ --- a/dist/index.js
844
+ +++ b/dist/index.js
845
+ @@ -10,6 +10,6 @@
846
+ * plugins by bare package id and folds `dist/` subpaths back onto the root.
847
+ */
848
+ export * from 'octane/universal/native';
849
+ -export { createNativeScriptRoot, nativeScriptDriver, renderNativeScriptApp, } from './driver.js';
850
+ +export { createNativeScriptRoot, nativeScriptDriver, observeBatches, renderNativeScriptApp, } from './driver.js';
851
+ export { ELEMENTS, eventNameFor, onElementReplaced, registerElement, } from './elements.js';
852
+ export { NATIVESCRIPT_RENDERER_ID } from './config.js';
853
+ diff --git a/dist/intrinsics.d.ts b/dist/intrinsics.d.ts
854
+ index 45a47cbbce199df9635852ca4cdb2849e9bbc83d..23b81c44b6860e6099e8c1a70f975f6e792aa2b2 100644
855
+ --- a/dist/intrinsics.d.ts
856
+ +++ b/dist/intrinsics.d.ts
857
+ @@ -23,10 +23,11 @@
858
+ * ```
859
+ */
860
+ import type * as NS from '@nativescript/core';
861
+ +import type { CSSProperties } from 'octane/jsx-runtime';
862
+ export type NativeScriptNode = unknown;
863
+ -type Ref<TInstance> = ((instance: TInstance | null) => void) | {
864
+ +type Ref<TInstance> = ((instance: TInstance | null) => void | (() => void)) | {
865
+ current: TInstance | null;
866
+ -} | null;
867
+ +} | readonly Ref<TInstance>[] | null | undefined;
868
+ /**
869
+ * The driver assigns every non-event prop onto the view instance, so a JSX
870
+ * attribute is a NativeScript view property rather than a DOM attribute.
871
+ @@ -72,16 +73,64 @@ export interface CommonEvents<TInstance> {
872
+ onFocus?: (event: NSEventData<TInstance>) => void;
873
+ onBlur?: (event: NSEventData<TInstance>) => void;
874
+ }
875
+ -/** Values accepted by the driver's `className` and `class` props. */
876
+ -export type ClassValue = string | boolean | null | undefined | readonly ClassValue[] | {
877
+ - readonly [className: string]: unknown;
878
+ -};
879
+ +/** Octane's class composition contract, shared unchanged with the DOM. */
880
+ +export type { ClassValue } from 'octane/jsx-runtime';
881
+ +import type { ClassValue } from 'octane/jsx-runtime';
882
+ +/** Mason engine style keys accepted through `style`/`className` — under a
883
+ + * masonview parent a child's leaf style consumes them; on a masonview they
884
+ + * are the container's own layout. These are the only way to set raw layout
885
+ + * properties: direct props of the same names are rejected by the driver. */
886
+ +export interface MasonStyleProps {
887
+ + display?: string;
888
+ + position?: string;
889
+ + inset?: number | string;
890
+ + left?: number | string;
891
+ + top?: number | string;
892
+ + right?: number | string;
893
+ + bottom?: number | string;
894
+ + direction?: string;
895
+ + boxSizing?: string;
896
+ + flexDirection?: string;
897
+ + flexWrap?: string;
898
+ + justifyContent?: string;
899
+ + justifyItems?: string;
900
+ + justifySelf?: string;
901
+ + alignItems?: string;
902
+ + alignContent?: string;
903
+ + alignSelf?: string;
904
+ + textAlign?: string;
905
+ + gap?: number | string;
906
+ + rowGap?: number | string;
907
+ + columnGap?: number | string;
908
+ + flexGrow?: number;
909
+ + flexShrink?: number;
910
+ + flexBasis?: number | string;
911
+ + order?: number;
912
+ + aspectRatio?: number;
913
+ + overflow?: string;
914
+ + overflowX?: string;
915
+ + overflowY?: string;
916
+ + scrollbarWidth?: number;
917
+ + gridTemplateRows?: string;
918
+ + gridTemplateColumns?: string;
919
+ + gridTemplateAreas?: string;
920
+ + gridAutoFlow?: string;
921
+ + gridAutoRows?: string;
922
+ + gridAutoColumns?: string;
923
+ + gridRow?: string;
924
+ + gridColumn?: string;
925
+ + gridRowStart?: string | number;
926
+ + gridRowEnd?: string | number;
927
+ + gridColumnStart?: string | number;
928
+ + gridColumnEnd?: string | number;
929
+ + gridArea?: string;
930
+ +}
931
+ export interface CommonAttributes {
932
+ /** Resolved against `app.css`. */
933
+ className?: ClassValue;
934
+ class?: ClassValue;
935
+ /** A string is parsed as inline CSS; an object is assigned onto `view.style`. */
936
+ - style?: string | Partial<NS.Style>;
937
+ + style?: string | Partial<NS.Style> | MasonStyleProps | CSSProperties;
938
+ /**
939
+ * Name of the property on a slot-hosting parent (e.g. a drawer's
940
+ * `mainContent` / `leftDrawer`) this child should be assigned to instead of
941
+ @@ -89,21 +138,18 @@ export interface CommonAttributes {
942
+ */
943
+ hostSlot?: string;
944
+ /**
945
+ - * Attached layout properties. The layout modules register these on `View` at
946
+ - * runtime, so they are absent from the `@nativescript/core` class typings.
947
+ + * ARIA-shaped accessibility values; shared components emit plain strings
948
+ + * through the escape-props helpers rather than the NativeScript enums.
949
+ */
950
+ - row?: number | string;
951
+ - col?: number | string;
952
+ - rowSpan?: number | string;
953
+ - colSpan?: number | string;
954
+ - dock?: 'top' | 'right' | 'bottom' | 'left';
955
+ - left?: number | string;
956
+ - top?: number | string;
957
+ - flexGrow?: number | string;
958
+ - flexShrink?: number | string;
959
+ - flexWrapBefore?: boolean | string;
960
+ - alignSelf?: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
961
+ - order?: number | string;
962
+ + accessibilityRole?: string;
963
+ + accessibilityState?: string;
964
+ + accessibilityLiveRegion?: string;
965
+ + /** Platform escape bags — applied onto the native view by the leaf's
966
+ + * applyEscapeProps, not by the driver. */
967
+ + ios?: Record<string, unknown>;
968
+ + android?: Record<string, unknown>;
969
+ + windows?: Record<string, unknown>;
970
+ + macos?: Record<string, unknown>;
971
+ }
972
+ export interface ListViewAttributes {
973
+ /**
974
+ @@ -117,25 +163,21 @@ export interface ListViewAttributes {
975
+ }
976
+ export interface OctaneAttributes<TInstance> {
977
+ key?: string | number;
978
+ - ref?: Ref<TInstance> | readonly Ref<TInstance>[];
979
+ + ref?: Ref<TInstance>;
980
+ children?: NativeScriptNode;
981
+ }
982
+ type Overridden = keyof CommonAttributes | keyof OctaneAttributes<unknown> | keyof CommonEvents<unknown>;
983
+ /** Props of a JSX tag backed by a `@nativescript/core`-style view class; the type to use for app-registered tags. */
984
+ export type Attributes<TClass extends abstract new (...args: never[]) => unknown> = Omit<ViewProperties<InstanceType<TClass>> & DerivedEvents<TClass, InstanceType<TClass>>, Overridden> & CommonAttributes & CommonEvents<InstanceType<TClass>> & OctaneAttributes<InstanceType<TClass>>;
985
+ export interface NativeScriptElements {
986
+ - absolutelayout: Attributes<typeof NS.AbsoluteLayout>;
987
+ actionbar: Attributes<typeof NS.ActionBar>;
988
+ actionitem: Attributes<typeof NS.ActionItem>;
989
+ activityindicator: Attributes<typeof NS.ActivityIndicator>;
990
+ button: Attributes<typeof NS.Button>;
991
+ contentview: Attributes<typeof NS.ContentView>;
992
+ datepicker: Attributes<typeof NS.DatePicker>;
993
+ - docklayout: Attributes<typeof NS.DockLayout>;
994
+ - flexboxlayout: Attributes<typeof NS.FlexboxLayout>;
995
+ formattedstring: Attributes<typeof NS.FormattedString>;
996
+ frame: Attributes<typeof NS.Frame>;
997
+ - gridlayout: Attributes<typeof NS.GridLayout>;
998
+ htmlview: Attributes<typeof NS.HtmlView>;
999
+ image: Attributes<typeof NS.Image>;
1000
+ label: Attributes<typeof NS.Label>;
1001
+ @@ -153,7 +195,6 @@ export interface NativeScriptElements {
1002
+ segmentedbaritem: Attributes<typeof NS.SegmentedBarItem>;
1003
+ slider: Attributes<typeof NS.Slider>;
1004
+ span: Attributes<typeof NS.Span>;
1005
+ - stacklayout: Attributes<typeof NS.StackLayout>;
1006
+ switch: Attributes<typeof NS.Switch>;
1007
+ tabview: Attributes<typeof NS.TabView>;
1008
+ tabviewitem: Attributes<typeof NS.TabViewItem>;
1009
+ @@ -161,7 +202,8 @@ export interface NativeScriptElements {
1010
+ textview: Attributes<typeof NS.TextView>;
1011
+ timepicker: Attributes<typeof NS.TimePicker>;
1012
+ webview: Attributes<typeof NS.WebView>;
1013
+ - wraplayout: Attributes<typeof NS.WrapLayout>;
1014
+ + /** The single layout container — all layout flows through `style`/`className`; layout prop names are rejected by the driver. */
1015
+ + masonview: Attributes<typeof NS.View>;
1016
+ /** iOS 26 glass surface (plain layout elsewhere); behaves as a GridLayout. */
1017
+ liquidglass: Attributes<typeof NS.LiquidGlass>;
1018
+ }