@triniwiz/nativescript-masonkit 1.0.0-beta.105 → 1.0.0-beta.107

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/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs.map +1 -1
  2. package/common.d.ts +26 -7
  3. package/common.js +154 -20
  4. package/common.js.map +1 -1
  5. package/css-shorthands.js +11 -1
  6. package/css-shorthands.js.map +1 -1
  7. package/package.json +1 -1
  8. package/platforms/android/masonkit-release.aar +0 -0
  9. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +7 -0
  10. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +33 -0
  11. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  12. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  13. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +4521 -13215
  14. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +6 -4
  15. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  16. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +6 -4
  17. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  18. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8710 -8669
  19. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +14 -0
  20. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +33 -0
  21. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
  22. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  23. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  24. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +4521 -13215
  25. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +6 -4
  26. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  27. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -4
  28. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +4521 -13215
  29. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +6 -4
  30. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  31. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +6 -4
  32. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +28 -28
  33. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  34. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8704 -8663
  35. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8307 -8281
  36. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason-Swift.h +7 -0
  37. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/mason_native.h +33 -0
  38. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Mason +0 -0
  39. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros.swiftsourceinfo +0 -0
  40. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +4521 -13215
  41. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.private.swiftinterface +6 -4
  42. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftdoc +0 -0
  43. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftinterface +6 -4
  44. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  45. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8203 -8161
  46. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason-Swift.h +7 -0
  47. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/mason_native.h +33 -0
  48. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Mason +0 -0
  49. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros-simulator.swiftsourceinfo +0 -0
  50. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +4521 -13215
  51. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.private.swiftinterface +6 -4
  52. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftdoc +0 -0
  53. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftinterface +6 -4
  54. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +16 -16
  55. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  56. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8203 -8161
  57. package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
  58. package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
  59. package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
  60. package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
  61. package/properties.d.ts +0 -5
  62. package/properties.js +23 -13
  63. package/properties.js.map +1 -1
  64. package/scroll/index.ios.js +1 -0
  65. package/scroll/index.ios.js.map +1 -1
  66. package/style.d.ts +3 -0
  67. package/style.js +148 -136
  68. package/style.js.map +1 -1
  69. package/text/index.android.js +9 -2
  70. package/text/index.android.js.map +1 -1
  71. package/text/index.ios.js +11 -2
  72. package/text/index.ios.js.map +1 -1
  73. package/typings/android.d.ts +2 -0
  74. package/typings/objc!Mason.d.ts +4 -0
  75. package/utils/index.ios.d.ts +2 -2
  76. package/view/index.ios.js +1 -0
  77. package/view/index.ios.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"triniwiz-nativescript-masonkit-angular.mjs","sources":["../../../../../packages/nativescript-masonkit/angular/src/mason-meta.ts","../../../../../packages/nativescript-masonkit/angular/src/component-host.ts","../../../../../packages/nativescript-masonkit/angular/src/element-registry.ts","../../../../../packages/nativescript-masonkit/angular/src/install.ts","../../../../../packages/nativescript-masonkit/angular/triniwiz-nativescript-masonkit-angular.ts"],"sourcesContent":["import type { ViewClassMeta } from '@nativescript/angular';\nimport { frameworkRegistry, readLinkedList } from '@triniwiz/nativescript-masonkit';\n\n/**\n * The subset of MasonKit's `ViewBase` child API this meta drives.\n *\n * Typed structurally rather than against the real class so the meta can also be\n * attached to subclasses declared outside this package (e.g. an app's own\n * `View` subclass) without a nominal dependency.\n */\ninterface MasonChildOps {\n /**\n * MasonKit's raw child list. Unlike `_viewChildren` it includes text-node and\n * placeholder (`<br>`) entries, and it is the list `insertChild` splices into.\n */\n _children: unknown[];\n getChildIndex(child: unknown): number;\n insertChild(child: unknown, atIndex: number): void;\n addChild(child: unknown): void;\n removeChild(child: unknown): void;\n}\n\n/**\n * Index of `child` in the parent's raw `_children` list, or -1.\n *\n * Deliberately *not* `parent.getChildIndex()`: that walks `_viewChildren`, which\n * filters out text nodes and placeholders, so its indices drift from the ones\n * `insertChild()` splices into as soon as a container mixes views and text. The\n * only index `insertChild` accepts is a `_children` index, so that is what we\n * compute. `getChildIndex` stays as the fallback for a container that predates\n * `_children` or overrides the lookup.\n */\nfunction rawChildIndex(parent: MasonChildOps, child: unknown): number {\n if (child == null) {\n return -1;\n }\n const children = parent._children;\n if (Array.isArray(children)) {\n return children.indexOf(child);\n }\n return typeof parent.getChildIndex === 'function' ? parent.getChildIndex(child) : -1;\n}\n\n/**\n * `ViewClassMeta` that routes Angular's visual-tree mutations through MasonKit's\n * own child bookkeeping.\n *\n * ## Why every MasonKit element needs this\n *\n * MasonKit's `ViewBase` extends `CustomLayoutView`, **not** `LayoutBase`.\n * `@nativescript/angular`'s `ViewUtil` branches on `view instanceof LayoutBase`,\n * so without a meta a MasonKit container falls into the generic fallbacks:\n *\n * - `addToVisualTree` → `parent._addChildFromBuilder(name, child)`, which is a\n * plain `addChild()` append. The resolved `next` sibling is **discarded**, so\n * anything Angular inserts in the middle of a container (`*ngIf` toggling on,\n * `*ngFor` reordering, a router swap) lands at the end and the Taffy tree ends\n * up in a different order than the template.\n * - `removeFromVisualTree` → core's `parent._removeView(child)`, which bypasses\n * MasonKit's `removeChild()` entirely. The native view detaches but the entry\n * stays in `_children`, and since `_children` is what drives native insertion\n * indices (`_nativeIndexFor`), every later insert into that container is\n * misplaced - the classic \"nested components lay out wrong\" symptom.\n *\n * Routing through `insertChild`/`addChild`/`removeChild` keeps the Taffy tree,\n * the `_children` bookkeeping and the native view tree in step. This is the same\n * contract `frameMeta`/`formattedStringMeta` use for their containers.\n *\n * ## Why `insertChild` must not throw\n *\n * `next` is whatever `ViewUtil.findNextVisual()` resolved to, which is not\n * guaranteed to be a node MasonKit ever tracked. MasonKit's own `insertBefore()`\n * throws `NotFoundError` for an unknown reference; thrown from here that would\n * abort the component's change detection and blank it. An unknown reference\n * simply degrades to an append, exactly as `insertToLayout` does for classic\n * layouts.\n *\n * Invisible nodes (Angular's `CommentNode`/`TextNode`) are intentionally left to\n * `ViewUtil`'s default handling: it assigns `parent.text`, which MasonKit's\n * `textProperty.setNative` already reconciles into real native text nodes.\n */\nexport const masonMeta: ViewClassMeta = {\n insertChild(parent: MasonChildOps, child: unknown, next?: unknown): void {\n const index = rawChildIndex(parent, next);\n if (index > -1) {\n parent.insertChild(child, index);\n } else {\n parent.addChild(child);\n }\n },\n removeChild(parent: MasonChildOps, child: unknown): void {\n parent.removeChild(child);\n },\n};\n\n// ---------------------------------------------------------------------------\n// Framework adapter: Angular's visual tree uses firstChild/nextSibling, but\n// every node has nodeType 1, including invisible TextNode/CommentNode anchors.\n// Registered after the built-in defaults, so it is checked before the generic\n// DOM-shim adapter.\n// ---------------------------------------------------------------------------\n\nframeworkRegistry.register({\n name: 'angular-nativescript',\n getElement(view) {\n if (view?.firstChild !== undefined && view?.meta?.skipAddToDom !== undefined) {\n return view;\n }\n return null;\n },\n getChildren: readLinkedList,\n classify(node) {\n if (node.nodeType === 'text' || node.nodeType === 3 || node.nodeName === 'TextNode' || node.constructor?.name === 'TextNode') {\n return 'text';\n }\n if (node.nodeName === 'br') {\n return 'break';\n }\n if (node.nodeName === 'CommentNode' || node.constructor?.name === 'CommentNode' || node.meta?.skipAddToDom) {\n return 'none';\n }\n return 'element';\n },\n syntheticTextOnEmpty: false,\n});\n","import { ActionBar, Frame, Page, ProxyViewContainer, View as NSView } from '@nativescript/core';\nimport { EmulatedRenderer, PageRouterOutlet, isKnownView, registerElement, ɵViewUtil } from '@nativescript/angular';\nimport { View } from '@triniwiz/nativescript-masonkit';\n\nimport { masonMeta } from './mason-meta';\n\n/**\n * Internal element name the host container is registered under. Every component\n * host is created from this entry and then re-stamped with its original tag, so\n * this name never appears in a template.\n */\nconst COMPONENT_HOST_TAG = 'mason-component-host';\n\n/** How a passthrough element can be identified. */\nexport type PassthroughMatcher = string | RegExp | ((elementName: string) => boolean);\n\n/**\n * Framework router outlets, which must stay transparent.\n *\n * They host a classic `Frame`/`Page` that fills its parent by classic\n * measurement. A `ProxyViewContainer` is a logical passthrough - its child is\n * hoisted into the nearest real native ancestor and measured with an exact,\n * fill-parent size. A MasonKit host is instead a real Taffy box, and Taffy\n * *content-sizes* a foreign (non-MasonKit) child, so the `Frame` collapses to\n * ~0 and nothing from the outlet down renders.\n *\n * Most `@nativescript/angular` views (`ActionBar`, `ActionItem`, ...) are\n * already `registerElement`'d, so only the outlets reach us as unregistered\n * elements.\n */\nconst DEFAULT_PASSTHROUGH_ELEMENTS = ['page-router-outlet', 'ns-empty-outlet', 'router-outlet'];\n\nexport interface ComponentHostOptions {\n /**\n * Turn component-host mode off entirely while keeping element registration.\n *\n * @default true\n */\n enabled?: boolean;\n /**\n * Extra elements to keep as a transparent `ProxyViewContainer`. Strings are\n * compared case-insensitively; regexes and predicates receive the raw element\n * name.\n *\n * Routed components are handled automatically, so this is only needed for a\n * component whose template root is a classic fill-parent view that this\n * cannot see coming - another router outlet, a `Frame`, a `Page`.\n */\n passthrough?: PassthroughMatcher[];\n /**\n * Recognise page roots automatically: routed components at creation time, and\n * any host that turns out to hold a `Frame`, `Page` or `ActionBar`.\n *\n * @default true\n */\n autoDetectPassthrough?: boolean;\n /**\n * Keep the Angular root component's host element a `ProxyViewContainer`.\n *\n * `AppHostView` only wraps the root in its full-screen root `GridLayout` when\n * that root *is* a `ProxyViewContainer`, so the root element has to stay a\n * passthrough for the tree below it to have a viewport-sized ancestor to\n * resolve `height: 100%` against.\n *\n * Detected rather than hardcoded: Angular creates the root component's host\n * through `NativeScriptRenderer.selectRootElement`, so an element created\n * while that runs is the root. See {@link patchSelectRootElement}.\n *\n * @default true\n */\n rootAsPassthrough?: boolean;\n}\n\n/**\n * Live configuration, read at element-creation time rather than captured at\n * install time so a later `installMasonKit()` call can still adjust it.\n *\n * `passthrough` is not mirrored here: matchers are compiled straight into\n * {@link passthroughNames} / {@link passthroughTests} when they arrive.\n */\nconst config = {\n enabled: true,\n autoDetectPassthrough: true,\n rootAsPassthrough: true,\n};\n\n/** Lowercased string matchers, kept separate for O(1) lookup. */\nconst passthroughNames = new Set<string>(DEFAULT_PASSTHROUGH_ELEMENTS);\n/** Regex and predicate matchers. */\nconst passthroughTests: Array<RegExp | ((name: string) => boolean)> = [];\n\nlet installed = false;\n\n/**\n * Set while `PageRouterOutlet` is building a routed component, so the host\n * element it creates can be recognised as a page root at creation time.\n * See {@link patchPageRouterOutlet}.\n */\nlet creatingPageRoot = false;\n\n/**\n * Set while `NativeScriptRenderer.selectRootElement` is creating the Angular\n * root component's host element. See {@link patchSelectRootElement}.\n */\nlet creatingAppRoot = false;\n\n/**\n * The real native container behind every component host element.\n *\n * MasonKit's `View` is a `CustomLayoutView` backed by the Taffy layout engine;\n * it embeds in classic NativeScript layouts and hosts both MasonKit and classic\n * NativeScript children. Making a component's host element one of these gives\n * it the same mental model as the web: the host is a real box in the layout,\n * with the full style surface, and `flex`/`grid` on a component element does\n * what it says.\n */\nclass MasonComponentHost extends View {\n /** The element name from the template, kept for diagnostics and auto-detect. */\n masonHostElementName?: string;\n\n addChild(child: unknown): void {\n inspectChild(this, child);\n super.addChild(child);\n }\n\n insertChild(child: unknown, atIndex: number): void {\n inspectChild(this, child);\n super.insertChild(child, atIndex);\n }\n}\n\n/**\n * True when `child` cannot lay out under a Taffy box at all, so its host has to\n * become transparent.\n *\n * `Frame` and `Page` fill their parent by classic measurement, and Taffy\n * content-sizes a foreign (non-MasonKit) child, so under a MasonKit host they\n * collapse to ~0 and nothing below them renders. No styling an app can apply\n * works around that, which is what makes forcing a passthrough right.\n */\nfunction needsTransparentParent(child: unknown): boolean {\n if (child instanceof Frame || child instanceof Page) {\n return true;\n }\n // A proxy hoists its own children, so look through it for the view it is\n // standing in for.\n if (child instanceof ProxyViewContainer) {\n const count = child.getChildrenCount();\n for (let i = 0; i < count; i++) {\n if (needsTransparentParent(child.getChildAt(i))) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction inspectChild(host: MasonComponentHost, child: unknown): void {\n if (!config.autoDetectPassthrough || !host.masonHostElementName) {\n return;\n }\n if (!(child instanceof NSView)) {\n return;\n }\n // An ActionBar means this component is a page root: its siblings are\n // page-level content that fills the `Page` by classic measurement, and a\n // Taffy box between the two content-sizes them away.\n //\n // This is the backstop for the outlet hook in `patchPageRouterOutlet()`. If\n // that hook stops firing - a different routing path, an upstream refactor -\n // this still catches the case, one render late.\n if (needsTransparentParent(child) || child instanceof ActionBar) {\n learnPassthroughElement(host.masonHostElementName);\n }\n}\n\n/**\n * Record an element name as a passthrough after the fact, and say so.\n *\n * The host that triggered detection already exists and cannot change class:\n * Angular's `ViewUtil` holds it in a sibling linked list, so swapping it\n * mid-render would corrupt that list. Every *later* creation of the element\n * becomes a proxy, so the second render onwards is correct - and the log names\n * the selector to put in `passthrough` to fix the first render too.\n */\nfunction learnPassthroughElement(elementName: string): void {\n const name = elementName.toLowerCase();\n if (passthroughNames.has(name)) {\n return;\n }\n passthroughNames.add(name);\n console.log(`[masonkit/angular] <${elementName}> holds a page-level view (Frame, Page or ActionBar) that Taffy cannot size as a Mason box. ` + `It will be created as a transparent ProxyViewContainer from now on. Add '${elementName}' to the ` + `passthrough option to apply this from the first render too.`);\n}\n\nfunction isPassthrough(elementName: string): boolean {\n if (passthroughNames.has(elementName.toLowerCase())) {\n return true;\n }\n for (const test of passthroughTests) {\n if (test instanceof RegExp ? test.test(elementName) : test(elementName)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Recognise routed components at creation time, so the very first render of a\n * route is correct rather than being repaired afterwards.\n *\n * A routed component is a page root: `PageRouterOutlet` creates it, then moves\n * its host element to be the `Page`'s content. Page-level content (a\n * fill-parent `ScrollView` or layout) sizes itself against the `Page` by\n * classic measurement, so a Taffy box in between content-sizes it to nothing -\n * the ActionBar still renders because it is hoisted onto the `Page`, and\n * everything below it disappears.\n *\n * Detection alone cannot fix that, because by the time a host reports an\n * ActionBar child the host exists and cannot change class. `activateOnGoForward`\n * closes the gap: it builds the routed component inside its own call, so the\n * first unregistered element created while it runs *is* the route's host\n * element. Bracketing it gives `createView` the one piece of information it was\n * missing, with no per-app configuration.\n *\n * Nothing is lost by making these transparent: a page root is a full-screen\n * container, not a box anyone styles. Components *below* it stay real MasonKit\n * hosts, which is where component-host mode earns its keep.\n */\nfunction patchPageRouterOutlet(): void {\n // `activateOnGoForward` is private on the class, so reach it through an\n // untyped view of the prototype.\n const proto = PageRouterOutlet?.prototype as unknown as undefined | Record<string, unknown>;\n const original = proto?.['activateOnGoForward'];\n if (!proto || typeof original !== 'function') {\n // Different version, different internals. The ActionBar backstop in\n // `inspectChild` still covers it from the second render on.\n return;\n }\n\n proto['activateOnGoForward'] = function (this: unknown, ...args: unknown[]) {\n creatingPageRoot = true;\n try {\n return original.apply(this, args);\n } finally {\n creatingPageRoot = false;\n }\n };\n}\n\n/**\n * Recognise the Angular root component's host element at creation time.\n *\n * Angular bootstraps the root component through\n * `renderer.selectRootElement(selector)`, and the NativeScript renderer creates\n * the host element from that selector with `viewUtil.createView`. Bracketing the\n * call marks exactly that element as the root, however many times the app\n * bootstraps in one JS process.\n *\n * This used to be a \"first unregistered element ever created\" counter, which is\n * only right for the first bootstrap. When Android recreates the Activity while\n * the process lives on (tapping the launcher icon after an `ns run` deploy,\n * rotation, a dark-mode switch), `@nativescript/angular` bootstraps the app\n * again and the counter is already past zero, so the root became a real\n * MasonKit box. `AppHostView` then skips its full-screen root `GridLayout`, and\n * Taffy content-sizes the classic view under it to the ActionBar height - the\n * page renders as an empty screen below the toolbar.\n */\nfunction patchSelectRootElement(rendererProto: { selectRootElement?: unknown }): void {\n const original = rendererProto.selectRootElement;\n if (typeof original !== 'function') {\n return;\n }\n rendererProto.selectRootElement = function (this: unknown, ...args: unknown[]) {\n creatingAppRoot = true;\n try {\n return original.apply(this, args);\n } finally {\n creatingAppRoot = false;\n }\n };\n}\n\nfunction applyOptions(options: ComponentHostOptions): void {\n if (options.enabled !== undefined) {\n config.enabled = options.enabled;\n }\n if (options.autoDetectPassthrough !== undefined) {\n config.autoDetectPassthrough = options.autoDetectPassthrough;\n }\n if (options.rootAsPassthrough !== undefined) {\n config.rootAsPassthrough = options.rootAsPassthrough;\n }\n for (const matcher of options.passthrough ?? []) {\n if (typeof matcher === 'string') {\n passthroughNames.add(matcher.toLowerCase());\n } else {\n passthroughTests.push(matcher);\n }\n }\n}\n\n/**\n * Turn every Angular component host element into a real MasonKit view.\n *\n * Stock `@nativescript/angular` creates a `ProxyViewContainer` for every element\n * that is not `registerElement`'d - i.e. every Angular component selector. That\n * container creates no native view, so anything placed on a component element\n * (`backgroundColor`, `margin`, `class=\"...\"`, host bindings) is set on an\n * invisible logical wrapper with no visual effect, and the component is\n * transparent to layout. Nesting components then produces layouts that do not\n * match the template, because the boxes the template implies do not exist.\n *\n * This replaces that fallback with a {@link MasonComponentHost}, so a component\n * host element is a real box, as on the web.\n *\n * Idempotent: repeated calls only update the configuration.\n *\n * Trade-off: an unknown element name (a typo, a component that was never\n * declared) becomes a host instead of throwing \"No known component for element\n * X\". Set `enabled: false` to keep the stock behaviour.\n */\nexport function enableMasonComponentHosts(options: ComponentHostOptions = {}): void {\n applyOptions(options);\n\n if (installed) {\n return;\n }\n installed = true;\n\n registerElement(COMPONENT_HOST_TAG, () => MasonComponentHost, masonMeta);\n\n patchPageRouterOutlet();\n\n // Patch point 1 of 2: `ViewUtil.createView` substitutes 'ProxyViewContainer'\n // for unregistered elements. `ɵViewUtil` is a frozen namespace, but the\n // `ViewUtil` prototype itself is mutable.\n const { ViewUtil } = ɵViewUtil;\n const originalCreateView = ViewUtil.prototype.createView;\n ViewUtil.prototype.createView = function (name: string) {\n const unregistered = !isKnownView(name);\n\n // The element `selectRootElement` creates is the Angular root component's\n // host. Consume the flag so only that element claims it.\n let isAppRoot = false;\n if (unregistered && creatingAppRoot) {\n creatingAppRoot = false;\n isAppRoot = true;\n }\n\n // The first unregistered element created while `PageRouterOutlet` is\n // building a routed component is that route's host element. Consume the\n // flag so only that element claims it, and remember the name so later\n // creations of the same component match without needing the bracket.\n let isPageRoot = false;\n if (unregistered && creatingPageRoot) {\n creatingPageRoot = false;\n isPageRoot = true;\n passthroughNames.add(name.toLowerCase());\n }\n\n if (!config.enabled || !unregistered || isPageRoot || isPassthrough(name) || (config.rootAsPassthrough && isAppRoot)) {\n // Known element, or one we deliberately keep as a transparent\n // ProxyViewContainer. `originalCreateView` substitutes the proxy for\n // unregistered names but does not record the original tag (the renderer\n // normally does that), so stamp it here to keep CSS type selectors and\n // debugging output working on this path too.\n const view = originalCreateView.call(this, name);\n if (unregistered) {\n view.customCSSName = name;\n }\n return view;\n }\n\n const host = originalCreateView.call(this, COMPONENT_HOST_TAG) as MasonComponentHost & { nodeName: string; tagName: string; cssType: string; customCSSName: string };\n // Preserve the original tag for CSS type selectors, for debugging, and for\n // Angular's `rootElement.tagName.toLowerCase()` bootstrap check.\n host.nodeName = name;\n host.tagName = name;\n host.cssType = name;\n host.customCSSName = name;\n host.masonHostElementName = name;\n return host;\n };\n\n // Patch point 2 of 2: `NativeScriptRenderer.createElement` performs the same\n // 'ProxyViewContainer' substitution *before* delegating to `createView`, so\n // the patch above would never see the original tag. Route it through the\n // patched `createView` with the tag intact. The renderer class is not\n // exported, but `EmulatedRenderer` extends it and delegates via\n // `super.createElement()`, so patching the shared base prototype covers both.\n const rendererProto = Object.getPrototypeOf(EmulatedRenderer.prototype) as {\n createElement(this: { viewUtil: InstanceType<typeof ViewUtil> }, name: string, namespace?: string): unknown;\n selectRootElement?: unknown;\n };\n patchSelectRootElement(rendererProto);\n\n const originalCreateElement = rendererProto.createElement;\n rendererProto.createElement = function (name: string, namespace?: string) {\n if (isKnownView(name)) {\n // Nothing to intercept - keep the stock path, including its tracing.\n return originalCreateElement.call(this, name, namespace);\n }\n // Unregistered: hand the *original* tag to the patched `createView`, which\n // decides between a host and a proxy and stamps `customCSSName` either way.\n return this.viewUtil.createView(name);\n };\n}\n","import { registerElement } from '@nativescript/angular';\nimport { getMasonKitElements, type GetMasonKitElementsOptions } from '@triniwiz/nativescript-masonkit/elements';\n\nimport { masonMeta } from './mason-meta';\n\nexport type RegisterElementsOptions = GetMasonKitElementsOptions;\n\n/**\n * Element names this package has already registered, so a second call (module\n * re-import, HMR) is a no-op rather than a duplicate registration.\n */\nconst registered = new Set<string>();\n\n/**\n * Register MasonKit's elements with `@nativescript/angular`, each with the child\n * bookkeeping meta it needs (see {@link masonMeta}) when it manages children\n * through MasonKit's own child list.\n *\n * The tag list itself — including the \"`/web`'s more specific element wins\"\n * de-duplication between `/web` and MasonKit's own widgets — comes from the\n * shared {@link getMasonKitElements}, so it can never drift from what other\n * framework integrations register.\n *\n * Safe to call more than once - later calls skip names already registered here.\n *\n * ## Shadowing\n *\n * `registerElement` overwrites silently, and `@nativescript/angular` registers\n * every element under its original, lowercase and kebab spellings. MasonKit's\n * `Button`, `Img` and `/web`'s `Span` therefore *replace* core's `Button`,\n * `img` (`Image`) and `Span` for Angular templates. That is the intent - these\n * are the MasonKit-laid-out equivalents - but it is why `mason`/`web` can each\n * be turned off if an app wants to keep the classic widgets.\n */\nexport function registerMasonKitElements(options: RegisterElementsOptions = {}): void {\n for (const { tag, ctor, isContainer } of getMasonKitElements(options)) {\n // Compared lowercase: `getMasonKitElements` already de-dupes case-\n // insensitively across `/web` vs MasonKit's own widgets; this `registered`\n // set only guards against a second *call* to this function re-registering\n // the same tag.\n const key = tag.toLowerCase();\n if (registered.has(key)) {\n continue;\n }\n registered.add(key);\n // Pass the original casing through: `registerElement` also derives the\n // lowercase and kebab-case spellings from it, so registering `'TextArea'`\n // (not `'textarea'`) is what makes `<View>`, `<view>` AND `<text-area>`\n // all resolve.\n registerElement(tag, () => ctor, isContainer ? masonMeta : undefined);\n }\n}\n","import { ComponentHostOptions, enableMasonComponentHosts } from './component-host';\nimport { RegisterElementsOptions, registerMasonKitElements } from './element-registry';\n\nexport interface InstallMasonKitOptions extends RegisterElementsOptions {\n /**\n * Component-host mode: make every Angular component host element a real\n * MasonKit view instead of an invisible `ProxyViewContainer`.\n *\n * On by default - installing this is taken as the statement that MasonKit is\n * how the app lays out. Pass `false`, or an options object with\n * `enabled: false`, to opt out and keep stock `@nativescript/angular`\n * behaviour while still getting the element registrations.\n *\n * @default true\n */\n componentHosts?: boolean | ComponentHostOptions;\n}\n\n/**\n * Install MasonKit's Angular integration.\n *\n * Call this in `main.ts` **before** `runNativeScriptAngularApp()`:\n *\n * ```ts\n * import { installMasonKit } from '@triniwiz/nativescript-masonkit/angular';\n *\n * installMasonKit();\n *\n * runNativeScriptAngularApp({\n * appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule),\n * });\n * ```\n *\n * It has to run before the bootstrap, not as part of it: the element map and\n * the renderer patch must be in place before Angular creates the root\n * component's host element, and an `NgModule` import or an `APP_INITIALIZER`\n * would both be too late for some of that. A plain function call at the top of\n * the entry file is unambiguous about when it happens.\n *\n * Idempotent - element registration is deduplicated and the component-host\n * patches are installed once, then only reconfigured.\n */\nexport function installMasonKit(options: InstallMasonKitOptions = {}): void {\n registerMasonKitElements(options);\n\n const { componentHosts = true } = options;\n if (componentHosts === false) {\n enableMasonComponentHosts({ enabled: false });\n } else {\n enableMasonComponentHosts(componentHosts === true ? {} : componentHosts);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["NSView","ɵViewUtil"],"mappings":";;;;;AAsBA;;;;;;;;;AASG;AACH,SAAS,aAAa,CAAC,MAAqB,EAAE,KAAc,EAAA;AAC1D,IAAA,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,CAAC,CAAC;IACX;AACA,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS;AACjC,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AAC3B,QAAA,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC;IAChC;IACA,OAAO,OAAO,MAAM,CAAC,aAAa,KAAK,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACtF;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;AACI,MAAM,SAAS,GAAkB;AACtC,IAAA,WAAW,CAAC,MAAqB,EAAE,KAAc,EAAE,IAAc,EAAA;QAC/D,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC;AACzC,QAAA,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE;AACd,YAAA,MAAM,CAAC,WAAW,CAAC,KAAK,EAA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AAA,MAAM,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE;AAC7B,QAAA,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACvB;QACF;AACA,QAAA,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;;;;;AAKnB,QAAA,eAAe,CAAC,GAAG,EAAE,MAAM,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;IACvE;AACF;;ACjCA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;AACG,SAAU,eAAe,CAAC,OAAA,GAAkC,EAAE,EAAA;IAClE,wBAAwB,CAAC,OAAO,CAAC;AAEjC,IAAA,MAAM,EAAE,cAAc,GAAG,IAAI,EAAE,GAAG,OAAO;AACzC,IAAA,IAAI,cAAc,KAAK,KAAK,EAAE;AAC5B,QAAA,yBAAyB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC/C;SAAO;AACL,QAAA,yBAAyB,CAAC,cAAc,KAAK,IAAI,GAAG,EAAE,GAAG,cAAc,CAAC;IAC1E;AACF;;ACnDA;;AAEG;;;;"}
1
+ {"version":3,"file":"triniwiz-nativescript-masonkit-angular.mjs","sources":["../../../../../packages/nativescript-masonkit/angular/src/mason-meta.ts","../../../../../packages/nativescript-masonkit/angular/src/component-host.ts","../../../../../packages/nativescript-masonkit/angular/src/element-registry.ts","../../../../../packages/nativescript-masonkit/angular/src/install.ts","../../../../../packages/nativescript-masonkit/angular/triniwiz-nativescript-masonkit-angular.ts"],"sourcesContent":["import type { ViewClassMeta } from '@nativescript/angular';\nimport { frameworkRegistry, readLinkedList } from '@triniwiz/nativescript-masonkit';\n\n/**\n * The subset of MasonKit's `ViewBase` child API this meta drives.\n *\n * Typed structurally rather than against the real class so the meta can also be\n * attached to subclasses declared outside this package (e.g. an app's own\n * `View` subclass) without a nominal dependency.\n */\ninterface MasonChildOps {\n /**\n * MasonKit's raw child list. Unlike `_viewChildren` it includes text-node and\n * placeholder (`<br>`) entries, and it is the list `insertChild` splices into.\n */\n _children: unknown[];\n getChildIndex(child: unknown): number;\n insertChild(child: unknown, atIndex: number): void;\n addChild(child: unknown): void;\n removeChild(child: unknown): void;\n}\n\n/**\n * Index of `child` in the parent's raw `_children` list, or -1.\n *\n * Deliberately *not* `parent.getChildIndex()`: that walks `_viewChildren`, which\n * filters out text nodes and placeholders, so its indices drift from the ones\n * `insertChild()` splices into as soon as a container mixes views and text. The\n * only index `insertChild` accepts is a `_children` index, so that is what we\n * compute. `getChildIndex` stays as the fallback for a container that predates\n * `_children` or overrides the lookup.\n */\nfunction rawChildIndex(parent: MasonChildOps, child: unknown): number {\n if (child == null) {\n return -1;\n }\n const children = parent._children;\n if (Array.isArray(children)) {\n return children.indexOf(child);\n }\n return typeof parent.getChildIndex === 'function' ? parent.getChildIndex(child) : -1;\n}\n\n/**\n * `ViewClassMeta` that routes Angular's visual-tree mutations through MasonKit's\n * own child bookkeeping.\n *\n * ## Why every MasonKit element needs this\n *\n * MasonKit's `ViewBase` extends `CustomLayoutView`, **not** `LayoutBase`.\n * `@nativescript/angular`'s `ViewUtil` branches on `view instanceof LayoutBase`,\n * so without a meta a MasonKit container falls into the generic fallbacks:\n *\n * - `addToVisualTree` → `parent._addChildFromBuilder(name, child)`, which is a\n * plain `addChild()` append. The resolved `next` sibling is **discarded**, so\n * anything Angular inserts in the middle of a container (`*ngIf` toggling on,\n * `*ngFor` reordering, a router swap) lands at the end and the Taffy tree ends\n * up in a different order than the template.\n * - `removeFromVisualTree` → core's `parent._removeView(child)`, which bypasses\n * MasonKit's `removeChild()` entirely. The native view detaches but the entry\n * stays in `_children`, and since `_children` is what drives native insertion\n * indices (`_nativeIndexFor`), every later insert into that container is\n * misplaced - the classic \"nested components lay out wrong\" symptom.\n *\n * Routing through `insertChild`/`addChild`/`removeChild` keeps the Taffy tree,\n * the `_children` bookkeeping and the native view tree in step. This is the same\n * contract `frameMeta`/`formattedStringMeta` use for their containers.\n *\n * ## Why `insertChild` must not throw\n *\n * `next` is whatever `ViewUtil.findNextVisual()` resolved to, which is not\n * guaranteed to be a node MasonKit ever tracked. MasonKit's own `insertBefore()`\n * throws `NotFoundError` for an unknown reference; thrown from here that would\n * abort the component's change detection and blank it. An unknown reference\n * simply degrades to an append, exactly as `insertToLayout` does for classic\n * layouts.\n *\n * Invisible nodes (Angular's `CommentNode`/`TextNode`) are intentionally left to\n * `ViewUtil`'s default handling: it assigns `parent.text`, which MasonKit's\n * `textProperty.setNative` already reconciles into real native text nodes.\n */\nexport const masonMeta: ViewClassMeta = {\n insertChild(parent: MasonChildOps, child: unknown, next?: unknown): void {\n const index = rawChildIndex(parent, next);\n if (index > -1) {\n parent.insertChild(child, index);\n } else {\n parent.addChild(child);\n }\n },\n removeChild(parent: MasonChildOps, child: unknown): void {\n parent.removeChild(child);\n },\n};\n\n// ---------------------------------------------------------------------------\n// Framework adapter: Angular's visual tree uses firstChild/nextSibling, but\n// every node has nodeType 1, including invisible TextNode/CommentNode anchors.\n// Registered after the built-in defaults, so it is checked before the generic\n// DOM-shim adapter.\n// ---------------------------------------------------------------------------\n\nframeworkRegistry.register({\n name: 'angular-nativescript',\n getElement(view) {\n if (view?.firstChild !== undefined && view?.meta?.skipAddToDom !== undefined) {\n return view;\n }\n return null;\n },\n getChildren: readLinkedList,\n classify(node) {\n if (node.nodeType === 'text' || node.nodeType === 3 || node.nodeName === 'TextNode' || node.constructor?.name === 'TextNode') {\n return 'text';\n }\n if (node.nodeName === 'br') {\n return 'break';\n }\n if (node.nodeName === 'CommentNode' || node.constructor?.name === 'CommentNode' || node.meta?.skipAddToDom) {\n return 'none';\n }\n return 'element';\n },\n syntheticTextOnEmpty: false,\n});\n","import { ActionBar, Frame, Page, ProxyViewContainer, View as NSView } from '@nativescript/core';\nimport { EmulatedRenderer, PageRouterOutlet, isKnownView, registerElement, ɵViewUtil } from '@nativescript/angular';\nimport { View } from '@triniwiz/nativescript-masonkit';\n\nimport { masonMeta } from './mason-meta';\n\n/**\n * Internal element name the host container is registered under. Every component\n * host is created from this entry and then re-stamped with its original tag, so\n * this name never appears in a template.\n */\nconst COMPONENT_HOST_TAG = 'mason-component-host';\n\n/** How a passthrough element can be identified. */\nexport type PassthroughMatcher = string | RegExp | ((elementName: string) => boolean);\n\n/**\n * Framework router outlets, which must stay transparent.\n *\n * They host a classic `Frame`/`Page` that fills its parent by classic\n * measurement. A `ProxyViewContainer` is a logical passthrough - its child is\n * hoisted into the nearest real native ancestor and measured with an exact,\n * fill-parent size. A MasonKit host is instead a real Taffy box, and Taffy\n * *content-sizes* a foreign (non-MasonKit) child, so the `Frame` collapses to\n * ~0 and nothing from the outlet down renders.\n *\n * Most `@nativescript/angular` views (`ActionBar`, `ActionItem`, ...) are\n * already `registerElement`'d, so only the outlets reach us as unregistered\n * elements.\n */\nconst DEFAULT_PASSTHROUGH_ELEMENTS = ['page-router-outlet', 'ns-empty-outlet', 'router-outlet'];\n\nexport interface ComponentHostOptions {\n /**\n * Turn component-host mode off entirely while keeping element registration.\n *\n * @default true\n */\n enabled?: boolean;\n /**\n * Extra elements to keep as a transparent `ProxyViewContainer`. Strings are\n * compared case-insensitively; regexes and predicates receive the raw element\n * name.\n *\n * Routed components are handled automatically, so this is only needed for a\n * component whose template root is a classic fill-parent view that this\n * cannot see coming - another router outlet, a `Frame`, a `Page`.\n */\n passthrough?: PassthroughMatcher[];\n /**\n * Recognise page roots automatically: routed components at creation time, and\n * any host that turns out to hold a `Frame`, `Page` or `ActionBar`.\n *\n * @default true\n */\n autoDetectPassthrough?: boolean;\n /**\n * Keep the Angular root component's host element a `ProxyViewContainer`.\n *\n * `AppHostView` only wraps the root in its full-screen root `GridLayout` when\n * that root *is* a `ProxyViewContainer`, so the root element has to stay a\n * passthrough for the tree below it to have a viewport-sized ancestor to\n * resolve `height: 100%` against.\n *\n * Detected rather than hardcoded: Angular creates the root component's host\n * through `NativeScriptRenderer.selectRootElement`, so an element created\n * while that runs is the root. See {@link patchSelectRootElement}.\n *\n * @default true\n */\n rootAsPassthrough?: boolean;\n}\n\n/**\n * Live configuration, read at element-creation time rather than captured at\n * install time so a later `installMasonKit()` call can still adjust it.\n *\n * `passthrough` is not mirrored here: matchers are compiled straight into\n * {@link passthroughNames} / {@link passthroughTests} when they arrive.\n */\nconst config = {\n enabled: true,\n autoDetectPassthrough: true,\n rootAsPassthrough: true,\n};\n\n/** Lowercased string matchers, kept separate for O(1) lookup. */\nconst passthroughNames = new Set<string>(DEFAULT_PASSTHROUGH_ELEMENTS);\n/** Regex and predicate matchers. */\nconst passthroughTests: Array<RegExp | ((name: string) => boolean)> = [];\n\nlet installed = false;\n\n/**\n * Set while `PageRouterOutlet` is building a routed component, so the host\n * element it creates can be recognised as a page root at creation time.\n * See {@link patchPageRouterOutlet}.\n */\nlet creatingPageRoot = false;\n\n/**\n * Set while `NativeScriptRenderer.selectRootElement` is creating the Angular\n * root component's host element. See {@link patchSelectRootElement}.\n */\nlet creatingAppRoot = false;\n\n/**\n * The real native container behind every component host element.\n *\n * MasonKit's `View` is a `CustomLayoutView` backed by the Taffy layout engine;\n * it embeds in classic NativeScript layouts and hosts both MasonKit and classic\n * NativeScript children. Making a component's host element one of these gives\n * it the same mental model as the web: the host is a real box in the layout,\n * with the full style surface, and `flex`/`grid` on a component element does\n * what it says.\n */\nclass MasonComponentHost extends View {\n /** The element name from the template, kept for diagnostics and auto-detect. */\n masonHostElementName?: string;\n\n addChild(child: unknown): void {\n inspectChild(this, child);\n super.addChild(child);\n }\n\n insertChild(child: unknown, atIndex: number): void {\n inspectChild(this, child);\n super.insertChild(child, atIndex);\n }\n}\n\n/**\n * True when `child` cannot lay out under a Taffy box at all, so its host has to\n * become transparent.\n *\n * `Frame` and `Page` fill their parent by classic measurement, and Taffy\n * content-sizes a foreign (non-MasonKit) child, so under a MasonKit host they\n * collapse to ~0 and nothing below them renders. No styling an app can apply\n * works around that, which is what makes forcing a passthrough right.\n */\nfunction needsTransparentParent(child: unknown): boolean {\n if (child instanceof Frame || child instanceof Page) {\n return true;\n }\n // A proxy hoists its own children, so look through it for the view it is\n // standing in for.\n if (child instanceof ProxyViewContainer) {\n const count = child.getChildrenCount();\n for (let i = 0; i < count; i++) {\n if (needsTransparentParent(child.getChildAt(i))) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction inspectChild(host: MasonComponentHost, child: unknown): void {\n if (!config.autoDetectPassthrough || !host.masonHostElementName) {\n return;\n }\n if (!(child instanceof NSView)) {\n return;\n }\n // An ActionBar means this component is a page root: its siblings are\n // page-level content that fills the `Page` by classic measurement, and a\n // Taffy box between the two content-sizes them away.\n //\n // This is the backstop for the outlet hook in `patchPageRouterOutlet()`. If\n // that hook stops firing - a different routing path, an upstream refactor -\n // this still catches the case, one render late.\n if (needsTransparentParent(child) || child instanceof ActionBar) {\n learnPassthroughElement(host.masonHostElementName);\n }\n}\n\n/**\n * Record an element name as a passthrough after the fact, and say so.\n *\n * The host that triggered detection already exists and cannot change class:\n * Angular's `ViewUtil` holds it in a sibling linked list, so swapping it\n * mid-render would corrupt that list. Every *later* creation of the element\n * becomes a proxy, so the second render onwards is correct - and the log names\n * the selector to put in `passthrough` to fix the first render too.\n */\nfunction learnPassthroughElement(elementName: string): void {\n const name = elementName.toLowerCase();\n if (passthroughNames.has(name)) {\n return;\n }\n passthroughNames.add(name);\n console.log(`[masonkit/angular] <${elementName}> holds a page-level view (Frame, Page or ActionBar) that Taffy cannot size as a Mason box. ` + `It will be created as a transparent ProxyViewContainer from now on. Add '${elementName}' to the ` + `passthrough option to apply this from the first render too.`);\n}\n\nfunction isPassthrough(elementName: string): boolean {\n if (passthroughNames.has(elementName.toLowerCase())) {\n return true;\n }\n for (const test of passthroughTests) {\n if (test instanceof RegExp ? test.test(elementName) : test(elementName)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Recognise routed components at creation time, so the very first render of a\n * route is correct rather than being repaired afterwards.\n *\n * A routed component is a page root: `PageRouterOutlet` creates it, then moves\n * its host element to be the `Page`'s content. Page-level content (a\n * fill-parent `ScrollView` or layout) sizes itself against the `Page` by\n * classic measurement, so a Taffy box in between content-sizes it to nothing -\n * the ActionBar still renders because it is hoisted onto the `Page`, and\n * everything below it disappears.\n *\n * Detection alone cannot fix that, because by the time a host reports an\n * ActionBar child the host exists and cannot change class. `activateOnGoForward`\n * closes the gap: it builds the routed component inside its own call, so the\n * first unregistered element created while it runs *is* the route's host\n * element. Bracketing it gives `createView` the one piece of information it was\n * missing, with no per-app configuration.\n *\n * Nothing is lost by making these transparent: a page root is a full-screen\n * container, not a box anyone styles. Components *below* it stay real MasonKit\n * hosts, which is where component-host mode earns its keep.\n */\nfunction patchPageRouterOutlet(): void {\n // `activateOnGoForward` is private on the class, so reach it through an\n // untyped view of the prototype.\n const proto = PageRouterOutlet?.prototype as unknown as undefined | Record<string, unknown>;\n const original = proto?.['activateOnGoForward'];\n if (!proto || typeof original !== 'function') {\n // Different version, different internals. The ActionBar backstop in\n // `inspectChild` still covers it from the second render on.\n return;\n }\n\n proto['activateOnGoForward'] = function (this: unknown, ...args: unknown[]) {\n creatingPageRoot = true;\n try {\n return original.apply(this, args);\n } finally {\n creatingPageRoot = false;\n }\n };\n}\n\n/**\n * Recognise the Angular root component's host element at creation time.\n *\n * Angular bootstraps the root component through\n * `renderer.selectRootElement(selector)`, and the NativeScript renderer creates\n * the host element from that selector with `viewUtil.createView`. Bracketing the\n * call marks exactly that element as the root, however many times the app\n * bootstraps in one JS process.\n *\n * This used to be a \"first unregistered element ever created\" counter, which is\n * only right for the first bootstrap. When Android recreates the Activity while\n * the process lives on (tapping the launcher icon after an `ns run` deploy,\n * rotation, a dark-mode switch), `@nativescript/angular` bootstraps the app\n * again and the counter is already past zero, so the root became a real\n * MasonKit box. `AppHostView` then skips its full-screen root `GridLayout`, and\n * Taffy content-sizes the classic view under it to the ActionBar height - the\n * page renders as an empty screen below the toolbar.\n */\nfunction patchSelectRootElement(rendererProto: { selectRootElement?: unknown }): void {\n const original = rendererProto.selectRootElement;\n if (typeof original !== 'function') {\n return;\n }\n rendererProto.selectRootElement = function (this: unknown, ...args: unknown[]) {\n creatingAppRoot = true;\n try {\n return original.apply(this, args);\n } finally {\n creatingAppRoot = false;\n }\n };\n}\n\nfunction applyOptions(options: ComponentHostOptions): void {\n if (options.enabled !== undefined) {\n config.enabled = options.enabled;\n }\n if (options.autoDetectPassthrough !== undefined) {\n config.autoDetectPassthrough = options.autoDetectPassthrough;\n }\n if (options.rootAsPassthrough !== undefined) {\n config.rootAsPassthrough = options.rootAsPassthrough;\n }\n for (const matcher of options.passthrough ?? []) {\n if (typeof matcher === 'string') {\n passthroughNames.add(matcher.toLowerCase());\n } else {\n passthroughTests.push(matcher);\n }\n }\n}\n\n/**\n * Turn every Angular component host element into a real MasonKit view.\n *\n * Stock `@nativescript/angular` creates a `ProxyViewContainer` for every element\n * that is not `registerElement`'d - i.e. every Angular component selector. That\n * container creates no native view, so anything placed on a component element\n * (`backgroundColor`, `margin`, `class=\"...\"`, host bindings) is set on an\n * invisible logical wrapper with no visual effect, and the component is\n * transparent to layout. Nesting components then produces layouts that do not\n * match the template, because the boxes the template implies do not exist.\n *\n * This replaces that fallback with a {@link MasonComponentHost}, so a component\n * host element is a real box, as on the web.\n *\n * Idempotent: repeated calls only update the configuration.\n *\n * Trade-off: an unknown element name (a typo, a component that was never\n * declared) becomes a host instead of throwing \"No known component for element\n * X\". Set `enabled: false` to keep the stock behaviour.\n */\nexport function enableMasonComponentHosts(options: ComponentHostOptions = {}): void {\n applyOptions(options);\n\n if (installed) {\n return;\n }\n installed = true;\n\n registerElement(COMPONENT_HOST_TAG, () => MasonComponentHost, masonMeta);\n\n patchPageRouterOutlet();\n\n // Patch point 1 of 2: `ViewUtil.createView` substitutes 'ProxyViewContainer'\n // for unregistered elements. `ɵViewUtil` is a frozen namespace, but the\n // `ViewUtil` prototype itself is mutable.\n const { ViewUtil } = ɵViewUtil;\n const originalCreateView = ViewUtil.prototype.createView;\n ViewUtil.prototype.createView = function (name: string) {\n const unregistered = !isKnownView(name);\n\n // The element `selectRootElement` creates is the Angular root component's\n // host. Consume the flag so only that element claims it.\n let isAppRoot = false;\n if (unregistered && creatingAppRoot) {\n creatingAppRoot = false;\n isAppRoot = true;\n }\n\n // The first unregistered element created while `PageRouterOutlet` is\n // building a routed component is that route's host element. Consume the\n // flag so only that element claims it, and remember the name so later\n // creations of the same component match without needing the bracket.\n let isPageRoot = false;\n if (unregistered && creatingPageRoot) {\n creatingPageRoot = false;\n isPageRoot = true;\n passthroughNames.add(name.toLowerCase());\n }\n\n if (!config.enabled || !unregistered || isPageRoot || isPassthrough(name) || (config.rootAsPassthrough && isAppRoot)) {\n // Known element, or one we deliberately keep as a transparent\n // ProxyViewContainer. `originalCreateView` substitutes the proxy for\n // unregistered names but does not record the original tag (the renderer\n // normally does that), so stamp it here to keep CSS type selectors and\n // debugging output working on this path too.\n const view = originalCreateView.call(this, name);\n if (unregistered) {\n view.customCSSName = name;\n }\n return view;\n }\n\n const host = originalCreateView.call(this, COMPONENT_HOST_TAG) as MasonComponentHost & { nodeName: string; tagName: string; cssType: string; customCSSName: string };\n // Preserve the original tag for CSS type selectors, for debugging, and for\n // Angular's `rootElement.tagName.toLowerCase()` bootstrap check.\n host.nodeName = name;\n host.tagName = name;\n host.cssType = name;\n host.customCSSName = name;\n host.masonHostElementName = name;\n return host;\n };\n\n // Patch point 2 of 2: `NativeScriptRenderer.createElement` performs the same\n // 'ProxyViewContainer' substitution *before* delegating to `createView`, so\n // the patch above would never see the original tag. Route it through the\n // patched `createView` with the tag intact. The renderer class is not\n // exported, but `EmulatedRenderer` extends it and delegates via\n // `super.createElement()`, so patching the shared base prototype covers both.\n const rendererProto = Object.getPrototypeOf(EmulatedRenderer.prototype) as {\n createElement(this: { viewUtil: InstanceType<typeof ViewUtil> }, name: string, namespace?: string): unknown;\n selectRootElement?: unknown;\n };\n patchSelectRootElement(rendererProto);\n\n const originalCreateElement = rendererProto.createElement;\n rendererProto.createElement = function (name: string, namespace?: string) {\n if (isKnownView(name)) {\n // Nothing to intercept - keep the stock path, including its tracing.\n return originalCreateElement.call(this, name, namespace);\n }\n // Unregistered: hand the *original* tag to the patched `createView`, which\n // decides between a host and a proxy and stamps `customCSSName` either way.\n return this.viewUtil.createView(name);\n };\n}\n","import { registerElement } from '@nativescript/angular';\nimport { getMasonKitElements, type GetMasonKitElementsOptions } from '@triniwiz/nativescript-masonkit/elements';\n\nimport { masonMeta } from './mason-meta';\n\nexport type RegisterElementsOptions = GetMasonKitElementsOptions;\n\n/**\n * Element names this package has already registered, so a second call (module\n * re-import, HMR) is a no-op rather than a duplicate registration.\n */\nconst registered = new Set<string>();\n\n/**\n * Register MasonKit's elements with `@nativescript/angular`, each with the child\n * bookkeeping meta it needs (see {@link masonMeta}) when it manages children\n * through MasonKit's own child list.\n *\n * The tag list itself — including the \"`/web`'s more specific element wins\"\n * de-duplication between `/web` and MasonKit's own widgets — comes from the\n * shared {@link getMasonKitElements}, so it can never drift from what other\n * framework integrations register.\n *\n * Safe to call more than once - later calls skip names already registered here.\n *\n * ## Shadowing\n *\n * `registerElement` overwrites silently, and `@nativescript/angular` registers\n * every element under its original, lowercase and kebab spellings. MasonKit's\n * `Button`, `Img` and `/web`'s `Span` therefore *replace* core's `Button`,\n * `img` (`Image`) and `Span` for Angular templates. That is the intent - these\n * are the MasonKit-laid-out equivalents - but it is why `mason`/`web` can each\n * be turned off if an app wants to keep the classic widgets.\n */\nexport function registerMasonKitElements(options: RegisterElementsOptions = {}): void {\n for (const { tag, ctor, isContainer } of getMasonKitElements(options)) {\n // Compared lowercase: `getMasonKitElements` already de-dupes case-\n // insensitively across `/web` vs MasonKit's own widgets; this `registered`\n // set only guards against a second *call* to this function re-registering\n // the same tag.\n const key = tag.toLowerCase();\n if (registered.has(key)) {\n continue;\n }\n registered.add(key);\n // Pass the original casing through: `registerElement` also derives the\n // lowercase and kebab-case spellings from it, so registering `'TextArea'`\n // (not `'textarea'`) is what makes `<View>`, `<view>` AND `<text-area>`\n // all resolve.\n registerElement(tag, () => ctor, isContainer ? masonMeta : undefined);\n }\n}\n","import { ComponentHostOptions, enableMasonComponentHosts } from './component-host';\nimport { RegisterElementsOptions, registerMasonKitElements } from './element-registry';\n\nexport interface InstallMasonKitOptions extends RegisterElementsOptions {\n /**\n * Component-host mode: make every Angular component host element a real\n * MasonKit view instead of an invisible `ProxyViewContainer`.\n *\n * On by default - installing this is taken as the statement that MasonKit is\n * how the app lays out. Pass `false`, or an options object with\n * `enabled: false`, to opt out and keep stock `@nativescript/angular`\n * behaviour while still getting the element registrations.\n *\n * @default true\n */\n componentHosts?: boolean | ComponentHostOptions;\n}\n\n/**\n * Install MasonKit's Angular integration.\n *\n * Call this in `main.ts` **before** `runNativeScriptAngularApp()`:\n *\n * ```ts\n * import { installMasonKit } from '@triniwiz/nativescript-masonkit/angular';\n *\n * installMasonKit();\n *\n * runNativeScriptAngularApp({\n * appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule),\n * });\n * ```\n *\n * It has to run before the bootstrap, not as part of it: the element map and\n * the renderer patch must be in place before Angular creates the root\n * component's host element, and an `NgModule` import or an `APP_INITIALIZER`\n * would both be too late for some of that. A plain function call at the top of\n * the entry file is unambiguous about when it happens.\n *\n * Idempotent - element registration is deduplicated and the component-host\n * patches are installed once, then only reconfigured.\n */\nexport function installMasonKit(options: InstallMasonKitOptions = {}): void {\n registerMasonKitElements(options);\n\n const { componentHosts = true } = options;\n if (componentHosts === false) {\n enableMasonComponentHosts({ enabled: false });\n } else {\n enableMasonComponentHosts(componentHosts === true ? {} : componentHosts);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["NSView","ɵViewUtil"],"mappings":";;;;;AAsBA;;;;;;;;;AASG;AACH,SAAS,aAAa,CAAC,MAAqB,EAAE,KAAc,EAAA;AAC1D,IAAA,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,CAAC,CAAC;IACX;AACA,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS;AACjC,IAAA,IA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 @@
1
1
  import { AddChildFromBuilder, CustomLayoutView, View as NSView, ViewBase as NSViewBase, Property, widthProperty, heightProperty, CoreTypes, marginLeftProperty, marginRightProperty, marginTopProperty, marginBottomProperty, minWidthProperty, minHeightProperty, fontSizeProperty, fontWeightProperty, fontStyleProperty, colorProperty, lineHeightProperty, letterSpacingProperty, textAlignmentProperty, textDecorationProperty, borderLeftWidthProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, backgroundColorProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, paddingBottomProperty, zIndexProperty } from '@nativescript/core';
2
2
  import { Display, Gap, GridAutoFlow, JustifyItems, JustifySelf, Length, LengthAuto, Overflow, Position, BoxSizing, VerticalAlign, FlexDirection, Float, Clear } from '.';
3
3
  import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
4
- import { fontInternalProperty, borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderBottomRightRadiusProperty, borderBottomLeftRadiusProperty, borderTopColorProperty, borderRightColorProperty, borderBottomColorProperty, borderLeftColorProperty } from '@nativescript/core/ui/styling/style-properties';
4
+ import { fontInternalProperty, backgroundInternalProperty, borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderBottomRightRadiusProperty, borderBottomLeftRadiusProperty, borderTopColorProperty, borderRightColorProperty, borderBottomColorProperty, borderLeftColorProperty } from '@nativescript/core/ui/styling/style-properties';
5
5
  import { Style } from './style';
6
6
  import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderProperty, borderLeftProperty, borderTopProperty, borderRightProperty, borderBottomProperty, borderRadiusProperty, bottomProperty, boxSizingProperty, clearProperty, columnGapProperty, cornerShapeProperty, displayProperty, filterProperty, flexBasisProperty, floatProperty, gridAreaProperty, gridAutoColumnsProperty, gridAutoFlowProperty, gridAutoRowsProperty, gridColumnEndProperty, gridColumnProperty, gridColumnStartProperty, gridRowEndProperty, gridRowProperty, gridRowStartProperty, gridTemplateAreasProperty, gridTemplateColumnsProperty, gridTemplateRowsProperty, justifyItemsProperty, justifySelfProperty, leftProperty, marginProperty, maxHeightProperty, maxWidthProperty, overflowXProperty, overflowYProperty, paddingProperty, positionProperty, rightProperty, rowGapProperty, scrollBarWidthProperty, textOverFlowProperty, textProperty, textWrapProperty, topProperty, verticalAlignProperty, boxShadowProperty, transformProperty, borderColorProperty, borderStyleProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty } from './properties';
7
7
  import { isMasonView_, isTextChild_, isText_, native_, pseudoStyles_, eventType_ } from './symbols';
@@ -131,6 +131,7 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
131
131
  [widthProperty.setNative]: (value: any) => void;
132
132
  [maxWidthProperty.setNative]: (value: any) => void;
133
133
  [maxHeightProperty.setNative]: (value: any) => void;
134
+ [backgroundInternalProperty.getDefault]: () => any;
134
135
  [marginProperty.setNative]: (value: any) => void;
135
136
  [marginLeftProperty.setNative]: (value: any) => void;
136
137
  [marginRightProperty.setNative]: (value: any) => void;
@@ -228,8 +229,19 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
228
229
  _unregisterNativeEvent(arg: string, callback: any, thisArg?: any): void;
229
230
  initNativeView(): void;
230
231
  _setNativeViewFrame(nativeView: any, frame: CGRect): void;
232
+ /**
233
+ * iOS: the views in this subtree a root's layout pass must visit (non-Mason children, which core
234
+ * lays out, and Mason views listening to layoutChanged). The pass skips subtrees where it's 0.
235
+ */
236
+ _masonLayoutWork: number;
237
+ private _masonAddLayoutWork;
238
+ private _masonListensToLayout;
239
+ _addViewCore(view: any, atIndex?: number): void;
240
+ _removeViewCore(view: any): void;
231
241
  addEventListener(arg: string, callback: any, thisArg?: any): void;
232
242
  removeEventListener(arg: string, callback: any, thisArg?: any): void;
243
+ private _addEventListener;
244
+ private _removeEventListener;
233
245
  private _applyPseudoClassStyles;
234
246
  _hoverHandler(subscribe: boolean): void;
235
247
  _handler(subscribe: boolean): void;
@@ -245,13 +257,20 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
245
257
  /** Size a non-Mason child with core's measure: its native view rarely implements sizeThatFits. */
246
258
  _masonMeasureForeign(child: any): void;
247
259
  /**
248
- * Windows core hands a child's percentage width/height here instead of applying it itself, so the
249
- * layout resolves it against the containing block. `false` when core should handle it.
260
+ * Sets a non-Mason child's percentage width/height (`null` clears it), resolved against the
261
+ * containing block. Windows core calls this for every percentage; on Android and iOS a view calls
262
+ * it when its native sizing can't express one. `false` when core should handle it.
250
263
  */
251
264
  _setChildPercentSize(child: any, horizontal: boolean, fraction: number | null): boolean;
265
+ /**
266
+ * A native removal relays out natively but runs no core layout pass, so `layoutChanged`
267
+ * and non-Mason descendants miss it. Ask for one; a subtree being torn down is unloaded.
268
+ */
269
+ _masonRequestLayoutAfterRemoval(): void;
252
270
  /** Lay out the non-Mason views in this root's subtree from the frames Mason set. */
253
271
  _masonLayoutForeignDescendants(): void;
254
272
  requestLayout(): void;
273
+ _parentChanged(oldParent: any): void;
255
274
  getMeasuredWidth(): number;
256
275
  getMeasuredHeight(): number;
257
276
  eachChildView(callback: (child: NSView) => boolean): void;
@@ -354,10 +373,10 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
354
373
  set right(value: LengthAuto);
355
374
  get bottom(): LengthAuto;
356
375
  set bottom(value: LengthAuto);
357
- set maxWidth(value: LengthAuto);
358
- get maxWidth(): LengthAuto;
359
- set maxHeight(value: LengthAuto);
360
- get maxHeight(): LengthAuto;
376
+ set maxWidth(value: LengthAuto | CoreTypes.PercentLengthType);
377
+ get maxWidth(): CoreTypes.PercentLengthType;
378
+ set maxHeight(value: LengthAuto | CoreTypes.PercentLengthType);
379
+ get maxHeight(): CoreTypes.PercentLengthType;
361
380
  _redrawNativeBackground(value: any): void;
362
381
  get padding(): string | number | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit;
363
382
  set padding(value: string | number | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit);
package/common.js CHANGED
@@ -6,10 +6,10 @@ import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowP
6
6
  // The per-corner radius and per-side colour longhands core's `border-radius`
7
7
  // / `border-color` shorthands expand into. They live in the styling module
8
8
  // rather than core's root export, unlike the border *width* longhands above.
9
- import { fontInternalProperty, borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderBottomRightRadiusProperty, borderBottomLeftRadiusProperty, borderTopColorProperty, borderRightColorProperty, borderBottomColorProperty, borderLeftColorProperty } from '@nativescript/core/ui/styling/style-properties';
9
+ import { fontInternalProperty, backgroundInternalProperty, borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderBottomRightRadiusProperty, borderBottomLeftRadiusProperty, borderTopColorProperty, borderRightColorProperty, borderBottomColorProperty, borderLeftColorProperty } from '@nativescript/core/ui/styling/style-properties';
10
10
  import { _forceStyleUpdate } from './utils';
11
11
  import { borderRadiusCorners, composeBorderRadius, isCssLength, parseCornerRadius, toCamelCase } from './css-shorthands';
12
- import { Style } from './style';
12
+ import { Style, nodeHelper } from './style';
13
13
  import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderProperty, borderLeftProperty, borderTopProperty, borderRightProperty, borderBottomProperty, borderRadiusProperty, bottomProperty, boxSizingProperty, clearProperty, columnGapProperty, cornerShapeProperty, displayProperty, filterProperty, flexBasisProperty, floatProperty, gridAreaProperty, gridAutoColumnsProperty, gridAutoFlowProperty, gridAutoRowsProperty, gridColumnEndProperty, gridColumnProperty, gridColumnStartProperty, gridRowEndProperty, gridRowProperty, gridRowStartProperty, gridTemplateAreasProperty, gridTemplateColumnsProperty, gridTemplateRowsProperty, justifyItemsProperty, justifySelfProperty, leftProperty, marginProperty, maxHeightProperty, maxWidthProperty, overflowXProperty, overflowYProperty, paddingProperty, positionProperty, rightProperty, rowGapProperty, scrollBarWidthProperty, textOverFlowProperty, textProperty, textWrapProperty, topProperty, verticalAlignProperty, boxShadowProperty, transformProperty, borderColorProperty, borderStyleProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty, installMasonSizeUnits, } from './properties';
14
14
  import { isMasonView_, isTextChild_, isText_, isPlaceholder_, text_, native_, textNode_, textNodeIndex_, textNodeProxied_, pseudoStyles_, emptyTextNode_, breakRun_, anonymousText_, windowsFontSource_, hostsRuns_, needsAnonymousText_, borderRadiusCorners_, borderSideColors_, eventType_ } from './symbols';
15
15
  import { Tree } from './tree';
@@ -212,6 +212,19 @@ function clearWindowsActive(view) {
212
212
  const TEARDOWN_SLICE_MS = 8;
213
213
  // Reading the clock costs more than a teardown on some devices.
214
214
  const TEARDOWNS_PER_CLOCK_READ = 16;
215
+ // Mason roots whose requestLayout already climbed to the page in this turn.
216
+ let climbedRoots = null;
217
+ function markClimbed(root) {
218
+ if (!climbedRoots) {
219
+ climbedRoots = new Set();
220
+ queueMicrotask(() => (climbedRoots = null));
221
+ }
222
+ climbedRoots.add(root);
223
+ }
224
+ // A layout in between clears core's flag, so the next request climbs again.
225
+ function climbedThisTurn(root) {
226
+ return !!climbedRoots?.has(root) && !!root.isLayoutRequested;
227
+ }
215
228
  export class ViewBase extends CustomLayoutView {
216
229
  _tearDownUI(force) {
217
230
  if ((__ANDROID__ || __APPLE__ || __WINDOWS__) && !force && !this.reusable && this._context && this.nativeViewProtected) {
@@ -234,7 +247,9 @@ export class ViewBase extends CustomLayoutView {
234
247
  if ((__ANDROID__ || __APPLE__ || __WINDOWS__) && this._masonPendingTeardown) {
235
248
  this._masonPendingTeardown = false;
236
249
  if (this._context === context) {
237
- if (!this.mIsRootView && this.parent && !this._isAddedToNativeVisualTree) {
250
+ // core 9.1 renamed mIsRootView to the private _isRootView
251
+ const isRootView = this._isRootView ?? this.mIsRootView;
252
+ if (!isRootView && this.parent && !this._isAddedToNativeVisualTree) {
238
253
  const nativeIndex = this.parent._childIndexToNativeChildIndex(atIndex ?? -1);
239
254
  this._isAddedToNativeVisualTree = this.parent._addViewToNativeVisualTree(this, nativeIndex);
240
255
  }
@@ -312,10 +327,18 @@ export class ViewBase extends CustomLayoutView {
312
327
  this[_c] = false;
313
328
  this[_d] = {};
314
329
  this._pendingEventsRegistration = [];
330
+ /**
331
+ * iOS: the views in this subtree a root's layout pass must visit (non-Mason children, which core
332
+ * lays out, and Mason views listening to layoutChanged). The pass skips subtrees where it's 0.
333
+ */
334
+ this._masonLayoutWork = 0;
315
335
  // `width`/`height` are core CssAnimationProperties whose stylesheet accessor
316
336
  // is non-configurable, so units Mason understands but core does not (`vh`,
317
337
  // `rem`, `pt`, …) have to be resolved on this view's own Style object.
318
338
  installMasonSizeUnits(this.style);
339
+ if (__ANDROID__) {
340
+ this._isPaddingRelative = false;
341
+ }
319
342
  }
320
343
  get innerHTML() {
321
344
  //@ts-ignore
@@ -525,7 +548,50 @@ export class ViewBase extends CustomLayoutView {
525
548
  _setNativeViewFrame(nativeView, frame) {
526
549
  // nativeView.frame = frame;
527
550
  }
551
+ _masonAddLayoutWork(delta) {
552
+ // Up to the root: a non-Mason parent is laid out by core and its Mason roots keep their own count.
553
+ let view = this;
554
+ while (view?.[isMasonView_]) {
555
+ view._masonLayoutWork += delta;
556
+ view = view.parent;
557
+ }
558
+ }
559
+ _masonListensToLayout() {
560
+ return this.hasListeners(NSView.layoutChangedEvent);
561
+ }
562
+ _addViewCore(view, atIndex) {
563
+ // Before setup: listeners the child gains while loading add themselves through `parent`.
564
+ if (__APPLE__) {
565
+ const work = view?.[isMasonView_] ? view._masonLayoutWork : 1;
566
+ if (work)
567
+ this._masonAddLayoutWork(work);
568
+ }
569
+ // @ts-ignore
570
+ super._addViewCore(view, atIndex);
571
+ }
572
+ _removeViewCore(view) {
573
+ // @ts-ignore
574
+ super._removeViewCore(view);
575
+ // After teardown: listeners removed while unloading already subtracted themselves.
576
+ if (__APPLE__) {
577
+ const work = view?.[isMasonView_] ? view._masonLayoutWork : 1;
578
+ if (work)
579
+ this._masonAddLayoutWork(-work);
580
+ }
581
+ }
528
582
  addEventListener(arg, callback, thisArg) {
583
+ const listened = __APPLE__ && this._masonListensToLayout();
584
+ this._addEventListener(arg, callback, thisArg);
585
+ if (__APPLE__ && !listened && this._masonListensToLayout())
586
+ this._masonAddLayoutWork(1);
587
+ }
588
+ removeEventListener(arg, callback, thisArg) {
589
+ const listened = __APPLE__ && this._masonListensToLayout();
590
+ this._removeEventListener(arg, callback, thisArg);
591
+ if (__APPLE__ && listened && !this._masonListensToLayout())
592
+ this._masonAddLayoutWork(-1);
593
+ }
594
+ _addEventListener(arg, callback, thisArg) {
529
595
  if (typeof thisArg === 'boolean') {
530
596
  thisArg = {
531
597
  capture: thisArg,
@@ -543,7 +609,7 @@ export class ViewBase extends CustomLayoutView {
543
609
  }
544
610
  super.addEventListener(arg, callback, thisArg);
545
611
  }
546
- removeEventListener(arg, callback, thisArg) {
612
+ _removeEventListener(arg, callback, thisArg) {
547
613
  if (typeof thisArg === 'boolean') {
548
614
  thisArg = {
549
615
  capture: thisArg,
@@ -676,20 +742,47 @@ export class ViewBase extends CustomLayoutView {
676
742
  });
677
743
  }
678
744
  /**
679
- * Windows core hands a child's percentage width/height here instead of applying it itself, so the
680
- * layout resolves it against the containing block. `false` when core should handle it.
745
+ * Sets a non-Mason child's percentage width/height (`null` clears it), resolved against the
746
+ * containing block. Windows core calls this for every percentage; on Android and iOS a view calls
747
+ * it when its native sizing can't express one. `false` when core should handle it.
681
748
  */
682
749
  _setChildPercentSize(child, horizontal, fraction) {
683
750
  const nativeChild = child?.nativeViewProtected;
684
- if (!__WINDOWS__ || !nativeChild || child[isMasonView_])
751
+ if (!nativeChild || child[isMasonView_])
685
752
  return false;
686
753
  const value = fraction ?? NaN;
687
- if (horizontal)
688
- masonEngine().SetPercentWidth(nativeChild, value);
689
- else
690
- masonEngine().SetPercentHeight(nativeChild, value);
754
+ if (__WINDOWS__) {
755
+ if (horizontal)
756
+ masonEngine().SetPercentWidth(nativeChild, value);
757
+ else
758
+ masonEngine().SetPercentHeight(nativeChild, value);
759
+ }
760
+ else if (__ANDROID__) {
761
+ const mason = org.nativescript.mason.masonkit.Mason.getShared();
762
+ if (horizontal)
763
+ mason.setPercentWidth(nativeChild, value);
764
+ else
765
+ mason.setPercentHeight(nativeChild, value);
766
+ }
767
+ else if (__APPLE__) {
768
+ if (horizontal)
769
+ NSCMason.shared.setPercentWidth(nativeChild, value);
770
+ else
771
+ NSCMason.shared.setPercentHeight(nativeChild, value);
772
+ }
773
+ else {
774
+ return false;
775
+ }
691
776
  return true;
692
777
  }
778
+ /**
779
+ * A native removal relays out natively but runs no core layout pass, so `layoutChanged`
780
+ * and non-Mason descendants miss it. Ask for one; a subtree being torn down is unloaded.
781
+ */
782
+ _masonRequestLayoutAfterRemoval() {
783
+ if (__APPLE__ && this.isLoaded)
784
+ this.requestLayout();
785
+ }
693
786
  /** Lay out the non-Mason views in this root's subtree from the frames Mason set. */
694
787
  _masonLayoutForeignDescendants() {
695
788
  if (!__APPLE__)
@@ -697,6 +790,8 @@ export class ViewBase extends CustomLayoutView {
697
790
  const visit = (view) => {
698
791
  view.eachChildView((child) => {
699
792
  if (child[isMasonView_]) {
793
+ if (!(child._masonLayoutWork > 0))
794
+ return true;
700
795
  // Keep `layoutChanged` working for the few views that listen to it.
701
796
  if (child.hasListeners?.(NSView.layoutChangedEvent)) {
702
797
  const b = child._getCurrentLayoutBounds();
@@ -725,10 +820,21 @@ export class ViewBase extends CustomLayoutView {
725
820
  let root = this.parent;
726
821
  while (root?.parent?.[isMasonView_])
727
822
  root = root.parent;
823
+ if (root && climbedThisTurn(root))
824
+ return;
728
825
  root?.requestLayout();
729
826
  return;
730
827
  }
828
+ // Core climbs on every call, once per changed property; once per turn is enough.
829
+ if (__APPLE__ && climbedThisTurn(this))
830
+ return;
731
831
  super.requestLayout();
832
+ if (__APPLE__)
833
+ markClimbed(this);
834
+ }
835
+ _parentChanged(oldParent) {
836
+ climbedRoots?.delete(this);
837
+ super._parentChanged(oldParent);
732
838
  }
733
839
  getMeasuredWidth() {
734
840
  if (this._masonPlacedNatively && this.nativeViewProtected) {
@@ -1557,7 +1663,11 @@ export class ViewBase extends CustomLayoutView {
1557
1663
  // `border-radius` / `border-color` arriving as core's longhands.
1558
1664
  _nativeBorderRadiusCorners() {
1559
1665
  // @ts-ignore
1560
- const native = String(this._styleHelper?.borderRadius ?? '').trim();
1666
+ const style = this._styleHelper;
1667
+ if ((__ANDROID__ || __APPLE__) && style && !style.hasBorderRadius()) {
1668
+ return borderRadiusCorners('0');
1669
+ }
1670
+ const native = String(style?.borderRadius ?? '').trim();
1561
1671
  try {
1562
1672
  return borderRadiusCorners(native || '0');
1563
1673
  }
@@ -1575,11 +1685,21 @@ export class ViewBase extends CustomLayoutView {
1575
1685
  if (!corners) {
1576
1686
  corners = this[borderRadiusCorners_] = this._nativeBorderRadiusCorners();
1577
1687
  }
1578
- corners[corner] = parseCornerRadius(lengthToCssString(masonLength(value)));
1688
+ const css = lengthToCssString(masonLength(value));
1689
+ const radius = (corners[corner] = /\s/.test(css) ? parseCornerRadius(css) : [css, css]);
1690
+ const shorthand = composeBorderRadius(corners);
1691
+ if ((__ANDROID__ || __APPLE__) && style._writeCornerRadius(corner, radius, shorthand)) {
1692
+ return;
1693
+ }
1579
1694
  // @ts-ignore
1580
- style.borderRadius = composeBorderRadius(corners);
1695
+ style.borderRadius = shorthand;
1581
1696
  }
1582
1697
  _nativeCornerRadius(corner) {
1698
+ // @ts-ignore
1699
+ const style = this._styleHelper;
1700
+ if ((__ANDROID__ || __APPLE__) && style && !style.hasBorderRadius()) {
1701
+ return '0';
1702
+ }
1583
1703
  const [h, v] = this._nativeBorderRadiusCorners()[corner];
1584
1704
  return h === v ? h : `${h} ${v}`;
1585
1705
  }
@@ -1608,7 +1728,7 @@ export class ViewBase extends CustomLayoutView {
1608
1728
  this._borderRadiusCorner(3, value);
1609
1729
  }
1610
1730
  _borderSideColor(side, value) {
1611
- if (__ANDROID__) {
1731
+ if (__ANDROID__ || __APPLE__) {
1612
1732
  const s = this._styleHelper;
1613
1733
  if (s) {
1614
1734
  s.setBorderSideColor(side === 't' ? 'top' : side === 'r' ? 'right' : side === 'b' ? 'bottom' : 'left', value);
@@ -1623,7 +1743,7 @@ export class ViewBase extends CustomLayoutView {
1623
1743
  const shorthand = `${sides.t} ${sides.r} ${sides.b} ${sides.l}`;
1624
1744
  if (__ANDROID__) {
1625
1745
  // @ts-ignore
1626
- org.nativescript.mason.masonkit.NodeHelper.getShared().setBorderColor(this.nativeView, shorthand);
1746
+ nodeHelper().setBorderColor(this.nativeView, shorthand);
1627
1747
  }
1628
1748
  else if (__APPLE__) {
1629
1749
  // @ts-ignore
@@ -1818,11 +1938,15 @@ export class ViewBase extends CustomLayoutView {
1818
1938
  s.setBorderColor(String(value));
1819
1939
  // @ts-ignore
1820
1940
  else
1821
- org.nativescript.mason.masonkit.NodeHelper.getShared().setBorderColor(this.nativeView, String(value));
1941
+ nodeHelper().setBorderColor(this.nativeView, String(value));
1822
1942
  }
1823
1943
  else if (__APPLE__) {
1944
+ const s = this._styleHelper;
1945
+ if (s)
1946
+ s.setBorderColor(String(value));
1824
1947
  // @ts-ignore
1825
- this.nativeView.style.setBorderColor(String(value));
1948
+ else
1949
+ this.nativeView.style.setBorderColor(String(value));
1826
1950
  }
1827
1951
  else if (__WINDOWS__) {
1828
1952
  // @ts-ignore
@@ -1854,7 +1978,7 @@ export class ViewBase extends CustomLayoutView {
1854
1978
  [listStyleTypeProperty.setNative](value) {
1855
1979
  if (__ANDROID__) {
1856
1980
  // @ts-ignore
1857
- org.nativescript.mason.masonkit.NodeHelper.getShared().setListStyleType(this.nativeView, String(value));
1981
+ nodeHelper().setListStyleType(this.nativeView, String(value));
1858
1982
  }
1859
1983
  else if (__APPLE__) {
1860
1984
  // @ts-ignore
@@ -1865,7 +1989,7 @@ export class ViewBase extends CustomLayoutView {
1865
1989
  [listStylePositionProperty.setNative](value) {
1866
1990
  if (__ANDROID__) {
1867
1991
  // @ts-ignore
1868
- org.nativescript.mason.masonkit.NodeHelper.getShared().setListStylePosition(this.nativeView, String(value));
1992
+ nodeHelper().setListStylePosition(this.nativeView, String(value));
1869
1993
  }
1870
1994
  else if (__APPLE__) {
1871
1995
  // @ts-ignore
@@ -2157,15 +2281,19 @@ export class ViewBase extends CustomLayoutView {
2157
2281
  style.width = value;
2158
2282
  }
2159
2283
  }
2284
+ // @ts-ignore core declares maxWidth as a field on View
2160
2285
  set maxWidth(value) {
2161
2286
  this.style.maxWidth = value;
2162
2287
  }
2288
+ // @ts-ignore
2163
2289
  get maxWidth() {
2164
2290
  return this.style.maxWidth;
2165
2291
  }
2292
+ // @ts-ignore core declares maxHeight as a field on View
2166
2293
  set maxHeight(value) {
2167
2294
  this.style.maxHeight = value;
2168
2295
  }
2296
+ // @ts-ignore
2169
2297
  get maxHeight() {
2170
2298
  return this.style.maxHeight;
2171
2299
  }
@@ -2184,6 +2312,12 @@ export class ViewBase extends CustomLayoutView {
2184
2312
  }
2185
2313
  }
2186
2314
  _redrawNativeBackground(value) { }
2315
+ [backgroundInternalProperty.getDefault]() {
2316
+ if (__ANDROID__ || __APPLE__)
2317
+ return null;
2318
+ // @ts-ignore
2319
+ return super[backgroundInternalProperty.getDefault]?.();
2320
+ }
2187
2321
  [marginProperty.setNative](value) {
2188
2322
  // @ts-ignore
2189
2323
  const style = this._styleHelper;