@ng-native/components 0.28.0 → 0.30.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.
- package/README.md +2 -2
- package/android/src/main/java/dev/ngnative/components/ColorSchemeModule.kt +116 -11
- package/dist/activity-indicator.js +3 -3
- package/dist/animated-style.js +3 -3
- package/dist/animations-web.js +3 -3
- package/dist/animations.js +3 -3
- package/dist/content-container.js +3 -3
- package/dist/context-menu.js +3 -3
- package/dist/drag-and-drop.js +6 -6
- package/dist/gestures-web.js +6 -6
- package/dist/gestures.js +6 -6
- package/dist/gradient-text.d.ts +1 -1
- package/dist/gradient-text.js +4 -4
- package/dist/gradient-text.js.map +1 -1
- package/dist/image-background.js +3 -3
- package/dist/image.js +3 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/input-accessory-view.js +3 -3
- package/dist/keyboard-avoiding-view.js +3 -3
- package/dist/keyboard-dock.js +15 -15
- package/dist/markdown-blocks.d.ts +2 -1
- package/dist/markdown-blocks.js +22 -18
- package/dist/markdown-blocks.js.map +1 -1
- package/dist/markdown-columns.js +3 -3
- package/dist/markdown-stream.js +8 -5
- package/dist/markdown-stream.js.map +1 -1
- package/dist/markdown.js +5 -5
- package/dist/markdown.js.map +1 -1
- package/dist/menu.d.ts +11 -5
- package/dist/menu.js +24 -44
- package/dist/menu.js.map +1 -1
- package/dist/modal.js +8 -3
- package/dist/modal.js.map +1 -1
- package/dist/native-button.d.ts +25 -3
- package/dist/native-button.js +102 -8
- package/dist/native-button.js.map +1 -1
- package/dist/native-gesture.js +3 -3
- package/dist/native-ref.js +3 -3
- package/dist/press-menu.d.ts +38 -8
- package/dist/press-menu.js +80 -19
- package/dist/press-menu.js.map +1 -1
- package/dist/pressable.js +14 -13
- package/dist/pressable.js.map +1 -1
- package/dist/reanimated-web.js +6 -6
- package/dist/reanimated.js +6 -6
- package/dist/refresh-control.js +3 -3
- package/dist/safe-area-provider.js +3 -3
- package/dist/safe-area-view.js +3 -3
- package/dist/scroll-view-props.js +3 -3
- package/dist/scroll-view.d.ts +3 -1
- package/dist/scroll-view.js +10 -5
- package/dist/scroll-view.js.map +1 -1
- package/dist/section-list.d.ts +4 -4
- package/dist/section-list.js +37 -34
- package/dist/section-list.js.map +1 -1
- package/dist/shortcut.js +3 -3
- package/dist/sidebar-item.js +3 -3
- package/dist/sidebar-section.d.ts +12 -5
- package/dist/sidebar-section.js +32 -12
- package/dist/sidebar-section.js.map +1 -1
- package/dist/sidebar.d.ts +11 -3
- package/dist/sidebar.js +18 -8
- package/dist/sidebar.js.map +1 -1
- package/dist/split-view.d.ts +23 -2
- package/dist/split-view.js +36 -9
- package/dist/split-view.js.map +1 -1
- package/dist/stand-ins/animations.js +3 -3
- package/dist/sticky-headers.d.ts +19 -0
- package/dist/sticky-headers.js +67 -10
- package/dist/sticky-headers.js.map +1 -1
- package/dist/sticky-rows.d.ts +13 -11
- package/dist/sticky-rows.js +35 -21
- package/dist/sticky-rows.js.map +1 -1
- package/dist/svg-icon.d.ts +16 -2
- package/dist/svg-icon.js +19 -3
- package/dist/svg-icon.js.map +1 -1
- package/dist/switch.js +3 -3
- package/dist/template-slot.js +3 -3
- package/dist/text-input.js +3 -3
- package/dist/text.js +3 -3
- package/dist/touchable-opacity.js +3 -3
- package/dist/tray-icon.d.ts +7 -1
- package/dist/tray-icon.js +17 -5
- package/dist/tray-icon.js.map +1 -1
- package/dist/view-base.d.ts +18 -2
- package/dist/view-base.js +42 -10
- package/dist/view-base.js.map +1 -1
- package/dist/view.js +3 -3
- package/dist/virtual-list-layout.d.ts +5 -0
- package/dist/virtual-list-layout.js.map +1 -1
- package/dist/virtual-list-num-columns.d.ts +8 -4
- package/dist/virtual-list-num-columns.js +13 -5
- package/dist/virtual-list-num-columns.js.map +1 -1
- package/dist/virtual-list-sticky-level.d.ts +0 -6
- package/dist/virtual-list-sticky-level.js +5 -29
- package/dist/virtual-list-sticky-level.js.map +1 -1
- package/dist/virtual-list.d.ts +72 -11
- package/dist/virtual-list.js +285 -74
- package/dist/virtual-list.js.map +1 -1
- package/dist/visual-effect.d.ts +37 -0
- package/dist/visual-effect.js +60 -0
- package/dist/visual-effect.js.map +1 -0
- package/dist/worklet-scroll.js +3 -3
- package/dist/worklet-style.js +3 -3
- package/dist/written-props.js +9 -0
- package/dist/written-props.js.map +1 -1
- package/ios/NgNativeButtonComponentView.mm +8 -4
- package/ios/NgNativeButtonMetrics.h +9 -2
- package/ios/NgNativeButtonMetrics.mm +33 -4
- package/ios/NgNativeButtonShadowNode.h +2 -0
- package/ios/NgNativeButtonShadowNode.mm +5 -1
- package/ios/NgNativeComponents.podspec +2 -2
- package/ios/NgNativeKeyboardFocus.h +21 -0
- package/ios/NgNativeKeyboardFocus.mm +28 -0
- package/ios/NgNativeKeyboardFocusModule.mm +203 -0
- package/ios/NgNativeMenus.mm +62 -2
- package/ios/NgNativePressMenu.h +36 -0
- package/ios/NgNativePressMenu.mm +79 -0
- package/ios/NgNativeViewBinder.h +5 -0
- package/ios/NgNativeViewBinder.mm +31 -4
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sticky-headers.js","sourceRoot":"","sources":["../src/sticky-headers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOlG;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAMnC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,aAAa;IACP,MAAM,CAAa;IACnB,UAAU,CAAgB;IACnC,OAAO,GAAe,EAAE,CAAC;IAChB,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IACtC,SAAS,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC7D,yFAAyF;IACxE,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IACtC,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAC;IACnD,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ostNode, type ScrollDrive, pinnedRange } from '@ng-native/fabric';\n\ninterface Extent {\n readonly start: number;\n readonly size: number;\n}\n\n/**\n * How long scrolling has to pause before a natively moved header's translate is written, so the\n * shadow tree, which a touch is hit-tested against, catches up with where native drew it. RN's\n * `ScrollViewStickyHeader` debounces the same write, by 64 ms on iOS.\n */\nexport const STICKY_SETTLE_MS = 64;\n\ntype LayoutEvent = {\n nativeEvent?: { layout?: { x?: number; y?: number; width?: number; height?: number } };\n};\n\n/**\n * `stickyHeaderIndices` for `<scroll-view>`, done the way RN's `ScrollView.js` does it.\n *\n * There is no native prop for it on either platform. RN wraps each sticky child in\n * `ScrollViewStickyHeader`, which translates it by the scroll offset past its own position and\n * stops where the next sticky child would push it off. The same sums run here, over the content\n * view's element children: control-flow anchors are not children in RN's sense and are skipped,\n * so an index counts what is committed.\n *\n * Each sticky child's position comes from its own layout event, and the translation is written\n * as its `transform` prop, with RN's `zIndex: 10` so it draws over the content scrolling under\n * it. A style of the caller's own that sets either wins, as it would in RN.\n *\n * Where the host can, native moves each one on every frame the scroll view moves, as RN's\n * animated interpolation does, and the translation is written only once scrolling pauses: a\n * translate written from each scroll event lands late, and on a fast fling the header shudders.\n */\nexport class StickyHeaders {\n private readonly engine: HostEngine;\n private readonly horizontal: () => boolean;\n private headers: HostNode[] = [];\n private readonly extents = new Map<HostNode, Extent>();\n private readonly listening = new Map<HostNode, () => void>();\n /** The translation last written per header, so an unchanged one is not written again. */\n private readonly written = new Map<HostNode, number>();\n private readonly drives = new Map<HostNode, ScrollDrive>();\n private settleTimer: ReturnType<typeof setTimeout> | undefined;\n private offset = 0;\n\n constructor(engine: HostEngine, scroll: HostNode, horizontal: () => boolean) {\n this.engine = engine;\n this.scroll = scroll;\n this.horizontal = horizontal;\n }\n\n private readonly scroll: HostNode;\n\n /** Find the sticky children again, after a pass that may have changed them. */\n track(content: HostNode | undefined, indices: readonly number[]): void {\n const children = (content?.childList ?? []).filter((child) => child.nodeKind === 'element');\n const headers = indices.flatMap((index) => children[index] ?? []);\n for (const node of this.headers) {\n if (!headers.includes(node)) this.release(node);\n }\n for (const node of headers) {\n if (this.listening.has(node)) continue;\n this.engine.setProp(node, 'zIndex', 10);\n this.listening.set(\n node,\n this.engine.setEventListener(node, 'topLayout', (event) => this.measured(node, event)),\n );\n }\n this.headers = headers;\n this.apply();\n }\n\n scrolled(offset: number): void {\n this.offset = offset;\n if (!this.engine.drivesScroll) return this.apply();\n clearTimeout(this.settleTimer);\n this.settleTimer = setTimeout(() => this.apply(), STICKY_SETTLE_MS);\n }\n\n destroy(): void {\n clearTimeout(this.settleTimer);\n for (const node of this.headers) this.release(node);\n this.headers = [];\n }\n\n private measured(node: HostNode, event: unknown): void {\n const layout = (event as LayoutEvent).nativeEvent?.layout;\n if (!layout) return;\n const horizontal = this.horizontal();\n this.extents.set(node, {\n start: (horizontal ? layout.x : layout.y) ?? 0,\n size: (horizontal ? layout.width : layout.height) ?? 0,\n });\n this.apply();\n }\n\n private release(node: HostNode): void {\n this.listening.get(node)?.();\n this.listening.delete(node);\n this.extents.delete(node);\n this.written.delete(node);\n this.drives.get(node)?.stop();\n this.drives.delete(node);\n this.engine.setProp(node, 'zIndex', undefined);\n this.engine.setProp(node, 'transform', undefined);\n }\n\n private drive(node: HostNode, start: number, stop: number): void {\n if (!this.engine.drivesScroll) return;\n const range = pinnedRange(start, stop);\n const drive = this.drives.get(node);\n if (drive) return drive.update(range);\n const axis = this.horizontal() ? 'x' : 'y';\n const next = this.engine.driveByScroll(node, this.scroll, axis, range);\n if (next) this.drives.set(node, next);\n }\n\n /** `ScrollViewStickyHeader`'s interpolation, as plain arithmetic. */\n private apply(): void {\n const key = this.horizontal() ? 'translateX' : 'translateY';\n this.headers.forEach((node, at) => {\n const own = this.extents.get(node);\n if (!own) return;\n const next = this.extents.get(this.headers[at + 1]!);\n const stop = next ? next.start - own.size : Infinity;\n this.drive(node, own.start, stop);\n const shift = Math.min(Math.max(0, this.offset - own.start), Math.max(0, stop - own.start));\n if (this.written.get(node) === shift) return;\n this.written.set(node, shift);\n this.engine.setProp(node, 'transform', shift > 0 ? [{ [key]: shift }] : undefined);\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sticky-headers.js","sourceRoot":"","sources":["../src/sticky-headers.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAO3B;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAMnC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,aAAa;IACP,MAAM,CAAa;IACnB,UAAU,CAAgB;IACnC,OAAO,GAAe,EAAE,CAAC;IAChB,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IACtC,SAAS,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC7D,yFAAyF;IACxE,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IACvD,0EAA0E;IACzD,MAAM,GAAG,IAAI,GAAG,EAG9B,CAAC;IACI,WAAW,CAA4C;IAC/D,2FAA2F;IACnF,MAAM,GAAG,CAAC,CAAC;IACX,UAAU,GAAqB,IAAI,CAAC;IAC5C,+FAA+F;IACvF,OAAO,GAAG,IAAI,CAAC;IAEvB,YAAY,MAAkB,EAAE,MAAgB,EAAE,UAAyB;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAEgB,MAAM,CAAW;IAElC,+EAA+E;IAC/E,KAAK,CAAC,OAA6B,EAAE,OAA0B;QAC7D,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC;QAC5F,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CA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K,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;YACvF,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK;gBAAE,OAAO;YAC7C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC9B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import {\n type HostEngine,\n type HostNode,\n type ScrollDrive,\n type WindowFrame,\n pinnedRange,\n} from '@ng-native/fabric';\n\ninterface Extent {\n readonly start: number;\n readonly size: number;\n}\n\n/**\n * How long scrolling has to pause before a natively moved header's translate is written, so the\n * shadow tree, which a touch is hit-tested against, catches up with where native drew it. RN's\n * `ScrollViewStickyHeader` debounces the same write, by 64 ms on iOS.\n */\nexport const STICKY_SETTLE_MS = 64;\n\ntype LayoutEvent = {\n nativeEvent?: { layout?: { x?: number; y?: number; width?: number; height?: number } };\n};\n\n/**\n * `stickyHeaderIndices` for `<scroll-view>`, done the way RN's `ScrollView.js` does it.\n *\n * There is no native prop for it on either platform. RN wraps each sticky child in\n * `ScrollViewStickyHeader`, which translates it by the scroll offset past its own position and\n * stops where the next sticky child would push it off. The same sums run here, over the content\n * view's element children: control-flow anchors are not children in RN's sense and are skipped,\n * so an index counts what is committed.\n *\n * Each sticky child's position comes from its own layout event, and the translation is written\n * as its `transform` prop, with RN's `zIndex: 10` so it draws over the content scrolling under\n * it. A style of the caller's own that sets either wins, as it would in RN.\n *\n * Where the host can, native moves each one on every frame the scroll view moves, as RN's\n * animated interpolation does, and the translation is written only once scrolling pauses: a\n * translate written from each scroll event lands late, and on a fast fling the header shudders.\n */\nexport class StickyHeaders {\n private readonly engine: HostEngine;\n private readonly horizontal: () => boolean;\n private headers: HostNode[] = [];\n private readonly extents = new Map<HostNode, Extent>();\n private readonly listening = new Map<HostNode, () => void>();\n /** The translation last written per header, so an unchanged one is not written again. */\n private readonly written = new Map<HostNode, number>();\n /** Each header's native drive, with the axis and range it moves along. */\n private readonly drives = new Map<\n HostNode,\n { drive: ScrollDrive; axis: 'x' | 'y'; range: string }\n >();\n private settleTimer: ReturnType<typeof setTimeout> | undefined;\n /** Where native last said the scroll view was, and along which axis: none until it has. */\n private offset = 0;\n private offsetAxis: 'x' | 'y' | null = null;\n /** Whether scrolling has paused: no scroll event is coming to draw a drive native is given. */\n private resting = true;\n\n constructor(engine: HostEngine, scroll: HostNode, horizontal: () => boolean) {\n this.engine = engine;\n this.scroll = scroll;\n this.horizontal = horizontal;\n }\n\n private readonly scroll: HostNode;\n\n /** Find the sticky children again, after a pass that may have changed them. */\n track(content: HostNode | undefined, indices: readonly number[]): void {\n const children = (content?.childList ?? []).filter((child) => child.nodeKind === 'element');\n const headers = indices.flatMap((index) => children[index] ?? []);\n for (const node of this.headers) {\n if (!headers.includes(node)) this.release(node);\n }\n for (const node of headers) {\n if (this.listening.has(node)) continue;\n this.engine.setProp(node, 'zIndex', 10);\n this.listening.set(\n node,\n this.engine.setEventListener(node, 'topLayout', (event) => this.measured(node, event)),\n );\n if (content) this.measureNow(node, content);\n }\n // With nothing sticky nothing hears the scroll view, so where it was last heard goes stale.\n if (headers.length === 0) this.offsetAxis = null;\n this.headers = headers;\n this.apply();\n }\n\n scrolled(offset: number): void {\n this.offset = offset;\n this.offsetAxis = this.axis();\n if (!this.engine.drivesScroll) return this.apply();\n this.resting = false;\n clearTimeout(this.settleTimer);\n this.settleTimer = setTimeout(() => {\n this.resting = true;\n this.apply();\n }, STICKY_SETTLE_MS);\n }\n\n destroy(): void {\n clearTimeout(this.settleTimer);\n for (const node of this.headers) this.release(node);\n this.headers = [];\n }\n\n private measured(node: HostNode, event: unknown): void {\n const layout = (event as LayoutEvent).nativeEvent?.layout;\n if (!layout) return;\n const horizontal = this.horizontal();\n this.extents.set(node, {\n start: (horizontal ? layout.x : layout.y) ?? 0,\n size: (horizontal ? layout.width : layout.height) ?? 0,\n });\n this.apply();\n }\n\n /**\n * Where a child is in the content now, for one that turns sticky after it was laid out: native\n * sends a layout event only when a view's layout changes, so none comes for it. RN's ScrollView\n * gets one by wrapping the child in a new view. Measured against the content view, both in the\n * window, as native answers; a child not committed yet is measured by its layout event instead.\n */\n private measureNow(node: HostNode, content: HostNode): void {\n let own: WindowFrame | undefined;\n let box: WindowFrame | undefined;\n const both = () => {\n if (!own || !box || this.extents.has(node) || !this.listening.has(node)) return;\n const horizontal = this.horizontal();\n this.extents.set(node, {\n start: horizontal ? own.x - box.x : own.y - box.y,\n size: horizontal ? own.width : own.height,\n });\n this.apply();\n };\n this.engine.measure(node, (frame) => ((own = frame), both()));\n this.engine.measure(content, (frame) => ((box = frame), both()));\n }\n\n private release(node: HostNode): void {\n this.listening.get(node)?.();\n this.listening.delete(node);\n this.extents.delete(node);\n this.written.delete(node);\n this.drives.get(node)?.drive.stop();\n this.drives.delete(node);\n this.engine.setProp(node, 'zIndex', undefined);\n this.engine.setProp(node, 'transform', undefined);\n }\n\n private axis(): 'x' | 'y' {\n return this.horizontal() ? 'x' : 'y';\n }\n\n /**\n * Hand a header to native to move along the scroll view's axis, made again when the axis changes.\n * A drive made, or given a new range, at rest has no scroll event coming to draw it, so native is\n * told where it last said the scroll view was, unless that was along the other axis. Mid-scroll\n * the next event draws it.\n */\n private drive(node: HostNode, start: number, stop: number): void {\n if (!this.engine.drivesScroll) return;\n const range = pinnedRange(start, stop);\n const key = JSON.stringify(range);\n const axis = this.axis();\n const held = this.drives.get(node);\n // Not a position native never gave: 0 would move every view on this scroll view's offset.\n const from = this.resting && this.offsetAxis === axis ? this.offset : undefined;\n if (held?.axis === axis) {\n if (held.range === key) return held.drive.update(range);\n held.range = key;\n return held.drive.update(range, from);\n }\n held?.drive.stop();\n this.drives.delete(node);\n const drive = this.engine.driveByScroll(node, this.scroll, axis, range, [], from);\n if (drive) this.drives.set(node, { drive, axis, range: key });\n }\n\n /** `ScrollViewStickyHeader`'s interpolation, as plain arithmetic. */\n private apply(): void {\n const key = this.horizontal() ? 'translateX' : 'translateY';\n // What native said along the other axis says nothing of this one.\n const offset = this.offsetAxis === this.axis() ? this.offset : 0;\n this.headers.forEach((node, at) => {\n const own = this.extents.get(node);\n if (!own) return;\n const next = this.extents.get(this.headers[at + 1]!);\n const stop = next ? next.start - own.size : Infinity;\n this.drive(node, own.start, stop);\n const shift = Math.min(Math.max(0, offset - own.start), Math.max(0, stop - own.start));\n if (this.written.get(node) === shift) return;\n this.written.set(node, shift);\n this.engine.setProp(node, 'transform', shift > 0 ? [{ [key]: shift }] : undefined);\n });\n }\n}\n"]}
|
package/dist/sticky-rows.d.ts
CHANGED
|
@@ -75,7 +75,10 @@ export declare class StickyRows {
|
|
|
75
75
|
*/
|
|
76
76
|
private readonly settled;
|
|
77
77
|
private settleTimer;
|
|
78
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* What native is moving, by row view: the axis with the transform kept beside the translate,
|
|
80
|
+
* and the range it moves the row by.
|
|
81
|
+
*/
|
|
79
82
|
private readonly drives;
|
|
80
83
|
/**
|
|
81
84
|
* What native moves the header by, once it has been pinned. Kept, moving it nowhere, when it no
|
|
@@ -111,9 +114,8 @@ export declare class StickyRows {
|
|
|
111
114
|
private readonly pinning;
|
|
112
115
|
/**
|
|
113
116
|
* Each sticky row's level, in list order: the rows of `stickyIndices` at level 0, and with a
|
|
114
|
-
* level function every row it gives one.
|
|
115
|
-
*
|
|
116
|
-
* there yet pins nothing and pushes nothing off until its row arrives.
|
|
117
|
+
* level function every row it gives one. A sticky index given for rows not there yet pins
|
|
118
|
+
* nothing and pushes nothing off until its row arrives.
|
|
117
119
|
*/
|
|
118
120
|
private readonly levels;
|
|
119
121
|
/** Each sticky row, with the rows it pins under and the one that pushes it off. */
|
|
@@ -146,8 +148,8 @@ export declare class StickyRows {
|
|
|
146
148
|
transform?: undefined;
|
|
147
149
|
} | undefined>;
|
|
148
150
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
+
* A pinned row in flow, moved by a transform from `at`, where flow put it, to where it holds:
|
|
152
|
+
* under the rows it pins under, until the next row at its level or further out pushes it off.
|
|
151
153
|
*/
|
|
152
154
|
flowStyle(index: number, at: number): Record<string, unknown>;
|
|
153
155
|
/**
|
|
@@ -200,12 +202,12 @@ export declare class StickyRows {
|
|
|
200
202
|
*/
|
|
201
203
|
private headerFrom;
|
|
202
204
|
/**
|
|
203
|
-
* Where native is told the scroll view is for a drive made
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
205
|
+
* Where native is told the scroll view is for a drive made, or moved by a new range, along
|
|
206
|
+
* `axis`. Native draws a graph when the offset changes, and at rest no scroll event comes to draw
|
|
207
|
+
* it: it is told where native last said it was, unless that was along the other axis. Mid-scroll
|
|
208
|
+
* the next event draws it. After a jump, `from`.
|
|
207
209
|
*/
|
|
208
|
-
private
|
|
210
|
+
private drawnFrom;
|
|
209
211
|
/** How native moves the pinned header. A first sticky row at the very top holds it in place. */
|
|
210
212
|
private headerRange;
|
|
211
213
|
/** How far the header moves before the first sticky row pushes it off: to that row's top. */
|
package/dist/sticky-rows.js
CHANGED
|
@@ -51,7 +51,10 @@ export class StickyRows {
|
|
|
51
51
|
settled = signal(0, /* @ts-ignore */
|
|
52
52
|
...(ngDevMode ? [{ debugName: "settled" }] : /* istanbul ignore next */ []));
|
|
53
53
|
settleTimer;
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* What native is moving, by row view: the axis with the transform kept beside the translate,
|
|
56
|
+
* and the range it moves the row by.
|
|
57
|
+
*/
|
|
55
58
|
drives = new Map();
|
|
56
59
|
/**
|
|
57
60
|
* What native moves the header by, once it has been pinned. Kept, moving it nowhere, when it no
|
|
@@ -93,9 +96,8 @@ export class StickyRows {
|
|
|
93
96
|
...(ngDevMode ? [{ debugName: "pinning" }] : /* istanbul ignore next */ []));
|
|
94
97
|
/**
|
|
95
98
|
* Each sticky row's level, in list order: the rows of `stickyIndices` at level 0, and with a
|
|
96
|
-
* level function every row it gives one.
|
|
97
|
-
*
|
|
98
|
-
* there yet pins nothing and pushes nothing off until its row arrives.
|
|
99
|
+
* level function every row it gives one. A sticky index given for rows not there yet pins
|
|
100
|
+
* nothing and pushes nothing off until its row arrives.
|
|
99
101
|
*/
|
|
100
102
|
levels = computed(() => {
|
|
101
103
|
const indices = this.list.indices();
|
|
@@ -109,10 +111,9 @@ export class StickyRows {
|
|
|
109
111
|
return levels;
|
|
110
112
|
}
|
|
111
113
|
const outermost = new Set(indices);
|
|
112
|
-
const flow = this.list.measuring();
|
|
113
114
|
items.forEach((item, index) => {
|
|
114
115
|
const level = outermost.has(index) ? 0 : levelOf(item, index);
|
|
115
|
-
if (level !== null
|
|
116
|
+
if (level !== null)
|
|
116
117
|
levels.push([index, level]);
|
|
117
118
|
});
|
|
118
119
|
return levels;
|
|
@@ -192,14 +193,19 @@ export class StickyRows {
|
|
|
192
193
|
}, /* @ts-ignore */
|
|
193
194
|
...(ngDevMode ? [{ debugName: "headerStyle" }] : /* istanbul ignore next */ []));
|
|
194
195
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
196
|
+
* A pinned row in flow, moved by a transform from `at`, where flow put it, to where it holds:
|
|
197
|
+
* under the rows it pins under, until the next row at its level or further out pushes it off.
|
|
197
198
|
*/
|
|
198
199
|
flowStyle(index, at) {
|
|
199
|
-
const
|
|
200
|
+
const holds = Math.min(this.offset(), this.stopOf(index)) + this.above(index);
|
|
201
|
+
const shift = Math.max(0, holds - at);
|
|
200
202
|
const move = `${this.list.horizontal() ? 'translateX' : 'translateY'}(${shift}px)`;
|
|
201
203
|
const flip = this.list.flipText();
|
|
202
|
-
return {
|
|
204
|
+
return {
|
|
205
|
+
...this.list.flowSpacing(),
|
|
206
|
+
zIndex: this.zIndexOf(index),
|
|
207
|
+
transform: flip ? `${move} ${flip}` : move,
|
|
208
|
+
};
|
|
203
209
|
}
|
|
204
210
|
/**
|
|
205
211
|
* A pinned row placed by its `top`: under the rows it pins under, until the next row at its
|
|
@@ -340,14 +346,22 @@ export class StickyRows {
|
|
|
340
346
|
if (!view || !next)
|
|
341
347
|
return;
|
|
342
348
|
live.add(view);
|
|
343
|
-
|
|
349
|
+
// The axis too: a list turned horizontal moves its sticky rows along x.
|
|
350
|
+
const statics = axis + JSON.stringify(next.statics);
|
|
351
|
+
const range = JSON.stringify(next.range);
|
|
344
352
|
const held = this.drives.get(view);
|
|
345
|
-
if (held?.statics === statics)
|
|
346
|
-
|
|
353
|
+
if (held?.statics === statics) {
|
|
354
|
+
const drawn = held.range === range && held.drawn;
|
|
355
|
+
const at = drawn ? from : this.drawnFrom(axis, from);
|
|
356
|
+
held.range = range;
|
|
357
|
+
held.drawn = drawn || at !== undefined;
|
|
358
|
+
return held.drive.update(next.range, at);
|
|
359
|
+
}
|
|
347
360
|
held?.drive.stop();
|
|
348
|
-
const
|
|
361
|
+
const told = this.drawnFrom(axis, from);
|
|
362
|
+
const drive = this.engine.driveByScroll(view, this.node, axis, next.range, next.statics, told);
|
|
349
363
|
if (drive)
|
|
350
|
-
this.drives.set(view, { drive, statics });
|
|
364
|
+
this.drives.set(view, { drive, statics, range, drawn: told !== undefined });
|
|
351
365
|
});
|
|
352
366
|
for (const [view, held] of this.drives) {
|
|
353
367
|
if (live.has(view))
|
|
@@ -380,7 +394,7 @@ export class StickyRows {
|
|
|
380
394
|
return held.drive.update(range, at);
|
|
381
395
|
}
|
|
382
396
|
held?.drive.stop();
|
|
383
|
-
const drive = this.engine.driveByScroll(view(), this.node, axis, range, statics, held ? (at ?? this.
|
|
397
|
+
const drive = this.engine.driveByScroll(view(), this.node, axis, range, statics, held ? (at ?? this.drawnFrom(axis, from)) : at);
|
|
384
398
|
this.headerDrive = drive && { drive, statics: key, pinned, range: moved };
|
|
385
399
|
}
|
|
386
400
|
/**
|
|
@@ -398,12 +412,12 @@ export class StickyRows {
|
|
|
398
412
|
return from ?? (this.nativeAxis === axis ? this.nativeAt : undefined);
|
|
399
413
|
}
|
|
400
414
|
/**
|
|
401
|
-
* Where native is told the scroll view is for a drive made
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
415
|
+
* Where native is told the scroll view is for a drive made, or moved by a new range, along
|
|
416
|
+
* `axis`. Native draws a graph when the offset changes, and at rest no scroll event comes to draw
|
|
417
|
+
* it: it is told where native last said it was, unless that was along the other axis. Mid-scroll
|
|
418
|
+
* the next event draws it. After a jump, `from`.
|
|
405
419
|
*/
|
|
406
|
-
|
|
420
|
+
drawnFrom(axis, from) {
|
|
407
421
|
return from ?? (this.resting && this.nativeAxis === axis ? this.nativeAt : undefined);
|
|
408
422
|
}
|
|
409
423
|
/** How native moves the pinned header. A first sticky row at the very top holds it in place. */
|
package/dist/sticky-rows.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sticky-rows.js","sourceRoot":"","sources":["../src/sticky-rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC9D,OAAO,EAML,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA2CvD,MAAM,IAAI,GAAsB,EAAE,CAAC;AAEnC,iDAAiD;AACjD,MAAM,KAAK,GAAgB,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,KAAK,GAAG,GAAG,CAAC;AAElB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OA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AI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC3E,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7C,OAAO;YACL,KAAK,EACH,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;YACzF,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE;SAChC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { computed, signal, type Signal } from '@angular/core';\nimport {\n type HostEngine,\n type HostNode,\n type ScrollDrive,\n type ScrollRange,\n type StaticTransform,\n pinnedRange,\n} from '@ng-native/fabric';\nimport { STICKY_SETTLE_MS } from './sticky-headers.ts';\nimport type { VirtualListSticky } from './virtual-list-sticky.ts';\n\n/** What `StickyRows` needs of the list whose rows it pins. */\nexport interface StickyRowsList {\n /** The sticky rows' indices, as `stickyIndices` gives them. */\n readonly indices: Signal<readonly number[]>;\n /** The rows' levels, when a directive on the list gives them, read from the items. */\n readonly levels: VirtualListSticky | null;\n readonly items: Signal<readonly unknown[]>;\n /** Whether the list header is pinned too, as `stickyHeader` says. */\n readonly header: Signal<boolean>;\n readonly headerHeight: Signal<number>;\n horizontal(): boolean;\n /** Rows size themselves and are laid out in flow. */\n measuring(): boolean;\n topOf(index: number): number;\n heightOf(index: number): number;\n /** An absolutely positioned row's style, at its own place. */\n slotStyle(index: number): Record<string, unknown>;\n /** What places a row in flow. */\n flowSpacing(): Record<string, unknown>;\n /** The list's flip, as transforms and as CSS text, when it is inverted. */\n flip(): readonly StaticTransform[] | undefined;\n flipText(): string | undefined;\n}\n\n/** A row as the list renders it, for what `StickyRows` reads of it. */\ninterface Row {\n readonly index: number;\n readonly parked?: boolean;\n}\n\n/** A sticky row: how deep it is, the rows it pins under, and the row that pushes it off. */\ninterface StickyRow {\n /** 0 for the outermost. The rows of `stickyIndices` are all at 0. */\n readonly level: number;\n /** The nearest row before it of each level further out, outermost first. */\n readonly above: readonly number[];\n /** The next row at its level or further out, if there is one. */\n next: number | undefined;\n}\n\nconst NONE: readonly number[] = [];\n\n/** A range native moves a view nowhere along. */\nconst STILL: ScrollRange = { input: [0, 1], output: [0, 0] };\n\n/**\n * The zIndex of a level 0 row where rows have levels, each level further in one under it. Fixed,\n * not counted from the levels the list holds: a deeper level arriving would otherwise commit new\n * props on every sticky row, and a view native is moving goes back to its place for a frame.\n * Levels this deep and deeper share a zIndex of 1.\n */\nconst FRONT = 100;\n\n/**\n * `<virtual-list>`'s sticky rows: which hold the leading edge, the style that pins each, the\n * header's pinned style, and, where the host moves views by the scroll on the native side, what\n * native is moving. The list's own share of `stickyIndices` and `stickyHeader`, as `StickyHeaders`\n * is `<scroll-view>`'s.\n *\n * Rows pin at levels, when `virtualListStickyLevel` gives them: a row holds the edge under the\n * rows of the levels further out than its own, and the next row at its level or further out pushes\n * it off. Without levels every sticky row is at level 0, each pushed off by the next.\n *\n * Pinning is not native: RN's `ScrollView.js` translates a sticky child against the scroll offset\n * in JavaScript, and a row here follows the offset the same way while it is the current one, by\n * its `top` when absolutely positioned and by a transform when in flow. Where native can move a\n * view by the scroll, each sticky row, and a pinned header, instead stays at its own place in the\n * list and native translates it on every frame the list scrolls, as RN's `ScrollViewStickyHeader`\n * does; a translate committed from each scroll event lands a frame or more late, and on a fast\n * fling the row shudders and comes away from the edge.\n */\nexport class StickyRows {\n /** Whether native moves sticky rows and the pinned header. */\n readonly native: boolean;\n /**\n * Where the scroll view is along its axis, header and all: 0 until native says otherwise, since\n * Android sends no scroll event until the list moves.\n */\n private readonly along = signal(0);\n /** The leading edge of the viewport in content space, past the header at its current size. */\n readonly offset = computed(() => this.along() - this.list.headerHeight());\n\n private readonly engine: HostEngine;\n private readonly node: HostNode;\n private readonly list: StickyRowsList;\n /**\n * Where the scroll view is once scrolling pauses, header and all, which the settled translate of\n * a native-moved row is from.\n */\n private readonly settled = signal(0);\n private settleTimer: ReturnType<typeof setTimeout> | undefined;\n /** What native is moving, by row view, with the transform kept beside the translate. */\n private readonly drives = new Map<HostNode, { drive: ScrollDrive; statics: string }>();\n /**\n * What native moves the header by, once it has been pinned. Kept, moving it nowhere, when it no\n * longer is: native goes on drawing a translate it set after its drive is gone.\n */\n private headerDrive: {\n drive: ScrollDrive;\n statics: string;\n pinned: boolean;\n range: string;\n } | null = null;\n /** The list scrolled itself, and native has not drawn its sticky rows there yet. */\n private jumped = false;\n /** Native has reported reaching the target, so this pass's drives are the last to need telling. */\n private landed = false;\n /** Where the list scrolled itself to, in the scroll view, which native reports with its event. */\n private jumpedTo = 0;\n /** Whether that scroll is animated, so native is still at its start until it reports. */\n private jumpAnimated = false;\n /** Where native's latest event since the jump said the scroll view was, header and all. */\n private reported: number | undefined;\n /** Where native's latest event of all said it was, header and all. */\n private nativeAt = 0;\n /** The axis the list scrolled along when native said so, until then none. */\n private nativeAxis: 'x' | 'y' | undefined;\n /** No scroll event has come for `STICKY_SETTLE_MS`, so none is on its way to draw a new graph. */\n private resting = true;\n /**\n * Scroll end events still to come, one for each jump that moved native, as iOS sends one. Kept\n * across jumps: one that landed has its end still to come, and must not be taken for the next's.\n */\n private ends = 0;\n /** The recycling type of a sticky row of each `itemType`: apart from plain rows of it. */\n private readonly typeOfKind = new Map<unknown, symbol>();\n private readonly types = new Set<unknown>();\n\n constructor(engine: HostEngine, node: HostNode, list: StickyRowsList) {\n this.engine = engine;\n this.node = node;\n this.list = list;\n this.native = engine.drivesScroll;\n }\n\n /** Whether the scroll offset is needed as a signal, which only pinning needs. */\n private readonly pinning = computed(() => this.list.header() || this.rows().size > 0);\n\n /**\n * Each sticky row's level, in list order: the rows of `stickyIndices` at level 0, and with a\n * level function every row it gives one. Rows that size themselves take level 0 alone: where a\n * deeper row pins depends on the heights of the rows over it. A sticky index given for rows not\n * there yet pins nothing and pushes nothing off until its row arrives.\n */\n private readonly levels = computed<readonly (readonly [index: number, level: number])[]>(() => {\n const indices = this.list.indices();\n const levelOf = this.list.levels?.levelOf();\n const items = this.list.items();\n const levels: [number, number][] = [];\n if (!levelOf) {\n for (const index of indices) if (index < items.length) levels.push([index, 0]);\n return levels;\n }\n const outermost = new Set(indices);\n const flow = this.list.measuring();\n items.forEach((item, index) => {\n const level = outermost.has(index) ? 0 : levelOf(item, index);\n if (level !== null && !(flow && level > 0)) levels.push([index, level]);\n });\n return levels;\n });\n\n /** Each sticky row, with the rows it pins under and the one that pushes it off. */\n readonly rows = computed(() => {\n const rows = new Map<number, StickyRow>();\n // The rows a row here would pin under: each deeper than the one before it.\n const open: number[] = [];\n for (const [index, level] of this.levels()) {\n while (open.length > 0 && rows.get(open.at(-1)!)!.level >= level) {\n rows.get(open.pop()!)!.next = index;\n }\n rows.set(index, { level, above: [...open], next: undefined });\n open.push(index);\n }\n return rows;\n });\n\n /**\n * For each sticky row in list order, the least offset that reaches it or a row after it. Where a\n * row starts to hold never comes before where the row before it does, unless a negative `rowGap`\n * overlaps the rows, and this stays in order either way, so `pinned` can halve over it.\n */\n private readonly reach = computed(() => {\n const order = this.levels();\n const reach = new Array<number>(order.length);\n let least = Infinity;\n for (let at = order.length - 1; at >= 0; at--) {\n least = Math.min(least, this.startOf(order[at]![0]));\n reach[at] = least;\n }\n return reach;\n });\n\n /**\n * The sticky rows currently holding the leading edge, outermost first: the last one the offset\n * has reached, under the rows it pins under. Empty when the list has scrolled back above the\n * first of them.\n */\n readonly pinned = computed<readonly number[]>(\n () => {\n const order = this.levels();\n if (order.length === 0) return NONE;\n const offset = this.offset();\n\n // The last row the offset has reached is the last whose `reach` it has, found by halving.\n const reach = this.reach();\n let low = 0;\n let high = order.length;\n while (low < high) {\n const middle = (low + high) >> 1;\n if (reach[middle]! <= offset) low = middle + 1;\n else high = middle;\n }\n if (low === 0) return NONE;\n const pinned = order[low - 1]![0];\n return [...this.rows().get(pinned)!.above, pinned];\n },\n // The same rows are the same pinning: where native moves them, a scroll then re-renders none.\n { equal: (a, b) => a.length === b.length && a.every((index, at) => index === b[at]) },\n );\n\n /**\n * The header's translation while it is pinned: the scroll position, held back at zero by an\n * overscroll and at the first sticky row, which pushes it off. Where native moves it, the\n * translate native had reached when scrolling paused, as for a sticky row.\n */\n readonly headerStyle = computed(() => {\n const flip = this.list.flipText();\n if (!this.list.header()) return flip ? { transform: flip } : undefined;\n const along = this.native ? this.settled() : this.along();\n const shift = Math.min(Math.max(0, along), this.headerLimit());\n const move =\n shift > 0 ? `${this.list.horizontal() ? 'translateX' : 'translateY'}(${shift}px)` : '';\n const transform = [move, flip ?? ''].filter(Boolean).join(' ');\n return transform ? { zIndex: 1, transform } : { zIndex: 1 };\n });\n\n /**\n * The pinned row `index` in flow, moved by a transform from `at`, where flow put it, to the leading\n * edge, until the next sticky row reaches it there and pushes it off.\n */\n flowStyle(index: number, at: number): Record<string, unknown> {\n const shift = Math.max(0, Math.min(this.offset(), this.stopOf(index)) - at);\n const move = `${this.list.horizontal() ? 'translateX' : 'translateY'}(${shift}px)`;\n const flip = this.list.flipText();\n return { ...this.list.flowSpacing(), zIndex: 1, transform: flip ? `${move} ${flip}` : move };\n }\n\n /**\n * A pinned row placed by its `top`: under the rows it pins under, until the next row at its\n * level or further out reaches it there and pushes it off.\n */\n slotStyle(index: number): Record<string, unknown> {\n const at = Math.min(this.offset(), this.stopOf(index)) + this.above(index);\n return {\n ...this.list.slotStyle(index),\n [this.list.horizontal() ? 'left' : 'top']: at,\n zIndex: this.zIndexOf(index),\n };\n }\n\n /**\n * A sticky row native moves: at its own place, with the translate native had reached when\n * scrolling paused, so the props agree with what is on screen.\n */\n style(index: number): Record<string, unknown> {\n const horizontal = this.list.horizontal();\n const style: Record<string, unknown> = this.list.measuring()\n ? { ...this.list.flowSpacing() }\n : { ...this.list.slotStyle(index) };\n style['zIndex'] = this.zIndexOf(index);\n const start = this.startOf(index);\n const settled = this.settled() - this.list.headerHeight();\n const shift = Math.min(Math.max(0, settled - start), this.stopOf(index) - start);\n const move = shift > 0 ? `${horizontal ? 'translateX' : 'translateY'}(${shift}px)` : '';\n const transform = [move, this.list.flipText() ?? ''].filter(Boolean).join(' ');\n if (transform) style['transform'] = transform;\n return style;\n }\n\n /**\n * The recycling type of a row: a sticky row is a type of its own, since native keeps the\n * translate it moved one by, and a plain row taking its slot commits no transform to put it\n * back. Apart from that, `kind`, the row's `itemType`.\n */\n recyclingType(index: number, kind: unknown): unknown {\n if (!this.rows().has(index)) return kind;\n let type = this.typeOfKind.get(kind);\n if (!type) {\n type = Symbol('sticky');\n this.typeOfKind.set(kind, type);\n this.types.add(type);\n }\n return type;\n }\n\n /** Whether a recycling type is a sticky row's. */\n isType(type: unknown): boolean {\n return this.types.has(type);\n }\n\n /** The list scrolled, to `along` in the scroll view. */\n scrolled(along: number): void {\n this.nativeAt = along;\n this.nativeAxis = this.list.horizontal() ? 'x' : 'y';\n if (this.jumped) {\n this.reported = along;\n // An event from before the jump, or on the way, is not where it lands.\n if (Math.abs(along - this.jumpedTo) <= 1) this.landed = true;\n }\n // A pinned row follows the scroll continuously, so the offset is a signal. Nothing reads it\n // until a row or the header is pinned, so without them this stays out of change detection,\n // and a fling that moves no row in or out of the window costs none. It is kept all the same:\n // a row that turns sticky in a scrolled list is pinned where the list is, not where it was.\n this.along.set(along);\n if (!this.native) return;\n clearTimeout(this.settleTimer);\n this.resting = false;\n const settle = () => {\n this.resting = true;\n this.settled.set(along);\n };\n if (!this.pinning()) return settle();\n // See `STICKY_SETTLE_MS`.\n this.settleTimer = setTimeout(settle, STICKY_SETTLE_MS);\n }\n\n /** The list is scrolling itself, to `to` in the scroll view, where native has not drawn yet. */\n jumping(to: number, animated: boolean): void {\n // To where native last said it was, with no earlier jump on its way: it moves nothing and\n // reports nothing. With one, native moves and comes back, and reports that.\n const pending = this.jumped && !this.landed;\n if (Math.abs(to - (pending ? this.jumpedTo : this.nativeAt)) > 1) this.ends++;\n this.jumped = pending || Math.abs(to - this.nativeAt) > 1;\n this.landed = false;\n this.jumpedTo = to;\n this.jumpAnimated = animated;\n this.reported = undefined;\n }\n\n /** The user took the scroll over: native's own events move the rows from here. */\n dragged(): void {\n this.jumped = this.landed = false;\n // Android sends no end for a jump that is not animated, so none is waited for past a drag.\n this.ends = 0;\n }\n\n /**\n * A scroll came to rest. The last of the jumps on their way has landed, wherever it did: iOS\n * does not stop a scroll at the end of the content, so it can rest past where the list said,\n * and what moves it next (a tap on the status bar) is not a drag.\n */\n rested(): void {\n if (this.ends > 0) this.ends--;\n if (this.jumped && this.ends === 0) this.landed = true;\n }\n\n /**\n * Hand each rendered sticky row's view to native to move, and let go of the rest, and the\n * header's view, `header`, while it is pinned. `views` are the rendered rows' views in the same\n * order as `rows`. Each is only asked for where there is a drive to make or let go.\n */\n drive(\n rows: () => readonly Row[],\n views: () => readonly HostNode[],\n header: () => HostNode,\n ): void {\n if (!this.pinning() && this.drives.size === 0 && !this.headerDrive) return;\n const rendered = views();\n const axis = this.list.horizontal() ? 'x' : 'y';\n const live = new Set<HostNode>();\n // After the list scrolled itself, where native is: it draws a graph when its offset changes,\n // and after a jump the offset of a drive just made may not. What native last reported, or\n // before it has, the target of a jump that is not animated. An animated one only once it has\n // landed: on the way native's offset changes every frame, so it draws a new graph anyway, and\n // the offset here trails native's and would set every pinned row back a frame. The same holds\n // mid-fling, which is why nothing is told outside a jump.\n const from = !this.jumped\n ? undefined\n : this.jumpAnimated\n ? this.landed\n ? this.reported\n : undefined\n : (this.reported ?? this.jumpedTo);\n rows().forEach((row, at) => {\n const view = rendered[at];\n const next = this.driveOf(row);\n if (!view || !next) return;\n live.add(view);\n const statics = JSON.stringify(next.statics);\n const held = this.drives.get(view);\n if (held?.statics === statics) return held.drive.update(next.range, from);\n held?.drive.stop();\n const drive = this.engine.driveByScroll(\n view,\n this.node,\n axis,\n next.range,\n next.statics,\n held ? this.remadeFrom(axis, from) : from,\n );\n if (drive) this.drives.set(view, { drive, statics });\n });\n for (const [view, held] of this.drives) {\n if (live.has(view)) continue;\n held.drive.stop();\n this.drives.delete(view);\n }\n this.driveHeader(header, axis, from);\n if (this.landed) this.jumped = this.landed = false;\n }\n\n /**\n * Hand the header to native to move while it is pinned, by the scroll view's offset until the\n * first sticky row pushes it off. Unpinned, it is moved nowhere.\n */\n private driveHeader(view: () => HostNode, axis: 'x' | 'y', from: number | undefined): void {\n const pinned = this.list.header();\n if (!pinned && !this.headerDrive) return;\n const range = pinned ? this.headerRange() : STILL;\n const held = this.headerDrive;\n const moved = JSON.stringify(range);\n const at = this.headerFrom(pinned, moved, axis, from);\n const statics = this.list.flip() ?? [];\n // The axis too: a list turned horizontal moves the header along x.\n const key = axis + JSON.stringify(statics);\n if (held?.statics === key) {\n held.pinned = pinned;\n held.range = moved;\n return held.drive.update(range, at);\n }\n held?.drive.stop();\n const drive = this.engine.driveByScroll(\n view(),\n this.node,\n axis,\n range,\n statics,\n held ? (at ?? this.remadeFrom(axis, from)) : at,\n );\n this.headerDrive = drive && { drive, statics: key, pinned, range: moved };\n }\n\n /**\n * Where native is told the scroll view is for the header's drive, `pinned` and moved by the range\n * `moved`. Pinned, let go, or moved by a new range at rest, native has no new scroll event to draw\n * it from: it is told where it last said it was. Mid-scroll the next event draws it, and what\n * native last said trails it, and what it said along the other axis says nothing of `axis`. After a\n * jump, `from`, where the list scrolled itself.\n */\n private headerFrom(\n pinned: boolean,\n moved: string,\n axis: 'x' | 'y',\n from: number | undefined,\n ): number | undefined {\n const held = this.headerDrive;\n const changed = held?.pinned !== pinned || (this.resting && held.range !== moved);\n if (!changed) return from;\n return from ?? (this.nativeAxis === axis ? this.nativeAt : undefined);\n }\n\n /**\n * Where native is told the scroll view is for a drive made again along `axis`, as for a flip. The\n * one it replaces may have been the last to read the offset, so the new one starts from nothing,\n * and at rest no scroll event comes to draw it: it is told where native last said it was, unless\n * that was along the other axis. After a jump, `from`.\n */\n private remadeFrom(axis: 'x' | 'y', from: number | undefined): number | undefined {\n return from ?? (this.resting && this.nativeAxis === axis ? this.nativeAt : undefined);\n }\n\n /** How native moves the pinned header. A first sticky row at the very top holds it in place. */\n private headerRange(): ScrollRange {\n const limit = this.headerLimit();\n return limit > 0 ? pinnedRange(0, limit) : STILL;\n }\n\n /** How far the header moves before the first sticky row pushes it off: to that row's top. */\n private headerLimit(): number {\n const [first] = this.rows().keys();\n return first === undefined ? Infinity : this.list.topOf(first);\n }\n\n destroy(): void {\n clearTimeout(this.settleTimer);\n for (const held of this.drives.values()) held.drive.stop();\n this.headerDrive?.drive.stop();\n }\n\n /** The size of the rows a sticky row pins under, which is how far from the edge it holds. */\n private above(index: number): number {\n let size = 0;\n for (const over of this.rows().get(index)?.above ?? NONE) size += this.list.heightOf(over);\n return size;\n }\n\n /**\n * A deeper row is drawn under the rows it pins under, and every sticky row over the rest. See\n * `FRONT`. Without levels a sticky row's zIndex is 1, as it was before there were any.\n */\n private zIndexOf(index: number): number {\n if (!this.list.levels?.levelOf()) return 1;\n return Math.max(1, FRONT - (this.rows().get(index)?.level ?? 0));\n }\n\n /** The offset a sticky row starts to hold from: where its top meets the rows it pins under. */\n private startOf(index: number): number {\n return this.list.topOf(index) - this.above(index);\n }\n\n /**\n * The offset a sticky row stops holding at, pushed off by the next: where that row's top meets\n * this row's far edge.\n */\n private stopOf(index: number): number {\n const next = this.rows().get(index)?.next;\n if (next === undefined) return Infinity;\n return this.list.topOf(next) - this.list.heightOf(index) - this.above(index);\n }\n\n /**\n * How native moves a rendered row, or null when it does not: along the scroll view's own\n * offset, which counts the header, from where the row meets the rows it pins under until the\n * next sticky row pushes it off. A row the next one follows with no space between them holds\n * nowhere, so native moves it nowhere: it is not let go, since native keeps the translate it\n * had moved a row by.\n */\n private driveOf(row: Row): { range: ScrollRange; statics: readonly StaticTransform[] } | null {\n if (!this.native || row.parked || !this.rows().has(row.index)) return null;\n const header = this.list.headerHeight();\n const start = header + this.startOf(row.index);\n const stop = header + this.stopOf(row.index);\n return {\n range:\n stop > start ? pinnedRange(start, stop) : { input: [start, start + 1], output: [0, 0] },\n statics: this.list.flip() ?? [],\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sticky-rows.js","sourceRoot":"","sources":["../src/sticky-rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC9D,OAAO,EAML,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA2CvD,MAAM,IAAI,GAAsB,EAAE,CAAC;AAEnC,iDAAiD;AACjD,MAAM,KAAK,GAAgB,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,KAAK,GAAG,GAAG,CAAC;AAElB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,UAAU;IACrB,8DAA8D;IACrD,MAAM,CAAU;IACzB;;;OAGG;IACc,KAAK,GAAG,MAAM,CAAC,CAAC;8EAAC,CAAC;IACnC,8FAA8F;IACrF,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;+EAAC,CAAC;IAEzD,MAAM,CAAa;IACnB,IAAI,CAAW;IACf,IAAI,CAAiB;IACtC;;;OAGG;IACc,OAAO,GAAG,MAAM,CAAC,CAAC;gFAAC,CA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;;;;OAMG;IACK,OAAO,CAAC,GAAQ;QACtB,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC3E,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7C,OAAO;YACL,KAAK,EACH,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;YACzF,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE;SAChC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { computed, signal, type Signal } from '@angular/core';\nimport {\n type HostEngine,\n type HostNode,\n type ScrollDrive,\n type ScrollRange,\n type StaticTransform,\n pinnedRange,\n} from '@ng-native/fabric';\nimport { STICKY_SETTLE_MS } from './sticky-headers.ts';\nimport type { VirtualListSticky } from './virtual-list-sticky.ts';\n\n/** What `StickyRows` needs of the list whose rows it pins. */\nexport interface StickyRowsList {\n /** The sticky rows' indices, as `stickyIndices` gives them. */\n readonly indices: Signal<readonly number[]>;\n /** The rows' levels, when a directive on the list gives them, read from the items. */\n readonly levels: VirtualListSticky | null;\n readonly items: Signal<readonly unknown[]>;\n /** Whether the list header is pinned too, as `stickyHeader` says. */\n readonly header: Signal<boolean>;\n readonly headerHeight: Signal<number>;\n horizontal(): boolean;\n /** Rows size themselves and are laid out in flow. */\n measuring(): boolean;\n topOf(index: number): number;\n heightOf(index: number): number;\n /** An absolutely positioned row's style, at its own place. */\n slotStyle(index: number): Record<string, unknown>;\n /** What places a row in flow. */\n flowSpacing(): Record<string, unknown>;\n /** The list's flip, as transforms and as CSS text, when it is inverted. */\n flip(): readonly StaticTransform[] | undefined;\n flipText(): string | undefined;\n}\n\n/** A row as the list renders it, for what `StickyRows` reads of it. */\ninterface Row {\n readonly index: number;\n readonly parked?: boolean;\n}\n\n/** A sticky row: how deep it is, the rows it pins under, and the row that pushes it off. */\ninterface StickyRow {\n /** 0 for the outermost. The rows of `stickyIndices` are all at 0. */\n readonly level: number;\n /** The nearest row before it of each level further out, outermost first. */\n readonly above: readonly number[];\n /** The next row at its level or further out, if there is one. */\n next: number | undefined;\n}\n\nconst NONE: readonly number[] = [];\n\n/** A range native moves a view nowhere along. */\nconst STILL: ScrollRange = { input: [0, 1], output: [0, 0] };\n\n/**\n * The zIndex of a level 0 row where rows have levels, each level further in one under it. Fixed,\n * not counted from the levels the list holds: a deeper level arriving would otherwise commit new\n * props on every sticky row, and a view native is moving goes back to its place for a frame.\n * Levels this deep and deeper share a zIndex of 1.\n */\nconst FRONT = 100;\n\n/**\n * `<virtual-list>`'s sticky rows: which hold the leading edge, the style that pins each, the\n * header's pinned style, and, where the host moves views by the scroll on the native side, what\n * native is moving. The list's own share of `stickyIndices` and `stickyHeader`, as `StickyHeaders`\n * is `<scroll-view>`'s.\n *\n * Rows pin at levels, when `virtualListStickyLevel` gives them: a row holds the edge under the\n * rows of the levels further out than its own, and the next row at its level or further out pushes\n * it off. Without levels every sticky row is at level 0, each pushed off by the next.\n *\n * Pinning is not native: RN's `ScrollView.js` translates a sticky child against the scroll offset\n * in JavaScript, and a row here follows the offset the same way while it is the current one, by\n * its `top` when absolutely positioned and by a transform when in flow. Where native can move a\n * view by the scroll, each sticky row, and a pinned header, instead stays at its own place in the\n * list and native translates it on every frame the list scrolls, as RN's `ScrollViewStickyHeader`\n * does; a translate committed from each scroll event lands a frame or more late, and on a fast\n * fling the row shudders and comes away from the edge.\n */\nexport class StickyRows {\n /** Whether native moves sticky rows and the pinned header. */\n readonly native: boolean;\n /**\n * Where the scroll view is along its axis, header and all: 0 until native says otherwise, since\n * Android sends no scroll event until the list moves.\n */\n private readonly along = signal(0);\n /** The leading edge of the viewport in content space, past the header at its current size. */\n readonly offset = computed(() => this.along() - this.list.headerHeight());\n\n private readonly engine: HostEngine;\n private readonly node: HostNode;\n private readonly list: StickyRowsList;\n /**\n * Where the scroll view is once scrolling pauses, header and all, which the settled translate of\n * a native-moved row is from.\n */\n private readonly settled = signal(0);\n private settleTimer: ReturnType<typeof setTimeout> | undefined;\n /**\n * What native is moving, by row view: the axis with the transform kept beside the translate,\n * and the range it moves the row by.\n */\n private readonly drives = new Map<\n HostNode,\n // `drawn`: native has been told where the scroll view is since the range last changed. A range\n // changed mid-scroll is told once the scroll pauses: one changed just before then has no\n // scroll event on its way to draw it.\n { drive: ScrollDrive; statics: string; range: string; drawn: boolean }\n >();\n /**\n * What native moves the header by, once it has been pinned. Kept, moving it nowhere, when it no\n * longer is: native goes on drawing a translate it set after its drive is gone.\n */\n private headerDrive: {\n drive: ScrollDrive;\n statics: string;\n pinned: boolean;\n range: string;\n } | null = null;\n /** The list scrolled itself, and native has not drawn its sticky rows there yet. */\n private jumped = false;\n /** Native has reported reaching the target, so this pass's drives are the last to need telling. */\n private landed = false;\n /** Where the list scrolled itself to, in the scroll view, which native reports with its event. */\n private jumpedTo = 0;\n /** Whether that scroll is animated, so native is still at its start until it reports. */\n private jumpAnimated = false;\n /** Where native's latest event since the jump said the scroll view was, header and all. */\n private reported: number | undefined;\n /** Where native's latest event of all said it was, header and all. */\n private nativeAt = 0;\n /** The axis the list scrolled along when native said so, until then none. */\n private nativeAxis: 'x' | 'y' | undefined;\n /** No scroll event has come for `STICKY_SETTLE_MS`, so none is on its way to draw a new graph. */\n private resting = true;\n /**\n * Scroll end events still to come, one for each jump that moved native, as iOS sends one. Kept\n * across jumps: one that landed has its end still to come, and must not be taken for the next's.\n */\n private ends = 0;\n /** The recycling type of a sticky row of each `itemType`: apart from plain rows of it. */\n private readonly typeOfKind = new Map<unknown, symbol>();\n private readonly types = new Set<unknown>();\n\n constructor(engine: HostEngine, node: HostNode, list: StickyRowsList) {\n this.engine = engine;\n this.node = node;\n this.list = list;\n this.native = engine.drivesScroll;\n }\n\n /** Whether the scroll offset is needed as a signal, which only pinning needs. */\n private readonly pinning = computed(() => this.list.header() || this.rows().size > 0);\n\n /**\n * Each sticky row's level, in list order: the rows of `stickyIndices` at level 0, and with a\n * level function every row it gives one. A sticky index given for rows not there yet pins\n * nothing and pushes nothing off until its row arrives.\n */\n private readonly levels = computed<readonly (readonly [index: number, level: number])[]>(() => {\n const indices = this.list.indices();\n const levelOf = this.list.levels?.levelOf();\n const items = this.list.items();\n const levels: [number, number][] = [];\n if (!levelOf) {\n for (const index of indices) if (index < items.length) levels.push([index, 0]);\n return levels;\n }\n const outermost = new Set(indices);\n items.forEach((item, index) => {\n const level = outermost.has(index) ? 0 : levelOf(item, index);\n if (level !== null) levels.push([index, level]);\n });\n return levels;\n });\n\n /** Each sticky row, with the rows it pins under and the one that pushes it off. */\n readonly rows = computed(() => {\n const rows = new Map<number, StickyRow>();\n // The rows a row here would pin under: each deeper than the one before it.\n const open: number[] = [];\n for (const [index, level] of this.levels()) {\n while (open.length > 0 && rows.get(open.at(-1)!)!.level >= level) {\n rows.get(open.pop()!)!.next = index;\n }\n rows.set(index, { level, above: [...open], next: undefined });\n open.push(index);\n }\n return rows;\n });\n\n /**\n * For each sticky row in list order, the least offset that reaches it or a row after it. Where a\n * row starts to hold never comes before where the row before it does, unless a negative `rowGap`\n * overlaps the rows, and this stays in order either way, so `pinned` can halve over it.\n */\n private readonly reach = computed(() => {\n const order = this.levels();\n const reach = new Array<number>(order.length);\n let least = Infinity;\n for (let at = order.length - 1; at >= 0; at--) {\n least = Math.min(least, this.startOf(order[at]![0]));\n reach[at] = least;\n }\n return reach;\n });\n\n /**\n * The sticky rows currently holding the leading edge, outermost first: the last one the offset\n * has reached, under the rows it pins under. Empty when the list has scrolled back above the\n * first of them.\n */\n readonly pinned = computed<readonly number[]>(\n () => {\n const order = this.levels();\n if (order.length === 0) return NONE;\n const offset = this.offset();\n\n // The last row the offset has reached is the last whose `reach` it has, found by halving.\n const reach = this.reach();\n let low = 0;\n let high = order.length;\n while (low < high) {\n const middle = (low + high) >> 1;\n if (reach[middle]! <= offset) low = middle + 1;\n else high = middle;\n }\n if (low === 0) return NONE;\n const pinned = order[low - 1]![0];\n return [...this.rows().get(pinned)!.above, pinned];\n },\n // The same rows are the same pinning: where native moves them, a scroll then re-renders none.\n { equal: (a, b) => a.length === b.length && a.every((index, at) => index === b[at]) },\n );\n\n /**\n * The header's translation while it is pinned: the scroll position, held back at zero by an\n * overscroll and at the first sticky row, which pushes it off. Where native moves it, the\n * translate native had reached when scrolling paused, as for a sticky row.\n */\n readonly headerStyle = computed(() => {\n const flip = this.list.flipText();\n if (!this.list.header()) return flip ? { transform: flip } : undefined;\n const along = this.native ? this.settled() : this.along();\n const shift = Math.min(Math.max(0, along), this.headerLimit());\n const move =\n shift > 0 ? `${this.list.horizontal() ? 'translateX' : 'translateY'}(${shift}px)` : '';\n const transform = [move, flip ?? ''].filter(Boolean).join(' ');\n return transform ? { zIndex: 1, transform } : { zIndex: 1 };\n });\n\n /**\n * A pinned row in flow, moved by a transform from `at`, where flow put it, to where it holds:\n * under the rows it pins under, until the next row at its level or further out pushes it off.\n */\n flowStyle(index: number, at: number): Record<string, unknown> {\n const holds = Math.min(this.offset(), this.stopOf(index)) + this.above(index);\n const shift = Math.max(0, holds - at);\n const move = `${this.list.horizontal() ? 'translateX' : 'translateY'}(${shift}px)`;\n const flip = this.list.flipText();\n return {\n ...this.list.flowSpacing(),\n zIndex: this.zIndexOf(index),\n transform: flip ? `${move} ${flip}` : move,\n };\n }\n\n /**\n * A pinned row placed by its `top`: under the rows it pins under, until the next row at its\n * level or further out reaches it there and pushes it off.\n */\n slotStyle(index: number): Record<string, unknown> {\n const at = Math.min(this.offset(), this.stopOf(index)) + this.above(index);\n return {\n ...this.list.slotStyle(index),\n [this.list.horizontal() ? 'left' : 'top']: at,\n zIndex: this.zIndexOf(index),\n };\n }\n\n /**\n * A sticky row native moves: at its own place, with the translate native had reached when\n * scrolling paused, so the props agree with what is on screen.\n */\n style(index: number): Record<string, unknown> {\n const horizontal = this.list.horizontal();\n const style: Record<string, unknown> = this.list.measuring()\n ? { ...this.list.flowSpacing() }\n : { ...this.list.slotStyle(index) };\n style['zIndex'] = this.zIndexOf(index);\n const start = this.startOf(index);\n const settled = this.settled() - this.list.headerHeight();\n const shift = Math.min(Math.max(0, settled - start), this.stopOf(index) - start);\n const move = shift > 0 ? `${horizontal ? 'translateX' : 'translateY'}(${shift}px)` : '';\n const transform = [move, this.list.flipText() ?? ''].filter(Boolean).join(' ');\n if (transform) style['transform'] = transform;\n return style;\n }\n\n /**\n * The recycling type of a row: a sticky row is a type of its own, since native keeps the\n * translate it moved one by, and a plain row taking its slot commits no transform to put it\n * back. Apart from that, `kind`, the row's `itemType`.\n */\n recyclingType(index: number, kind: unknown): unknown {\n if (!this.rows().has(index)) return kind;\n let type = this.typeOfKind.get(kind);\n if (!type) {\n type = Symbol('sticky');\n this.typeOfKind.set(kind, type);\n this.types.add(type);\n }\n return type;\n }\n\n /** Whether a recycling type is a sticky row's. */\n isType(type: unknown): boolean {\n return this.types.has(type);\n }\n\n /** The list scrolled, to `along` in the scroll view. */\n scrolled(along: number): void {\n this.nativeAt = along;\n this.nativeAxis = this.list.horizontal() ? 'x' : 'y';\n if (this.jumped) {\n this.reported = along;\n // An event from before the jump, or on the way, is not where it lands.\n if (Math.abs(along - this.jumpedTo) <= 1) this.landed = true;\n }\n // A pinned row follows the scroll continuously, so the offset is a signal. Nothing reads it\n // until a row or the header is pinned, so without them this stays out of change detection,\n // and a fling that moves no row in or out of the window costs none. It is kept all the same:\n // a row that turns sticky in a scrolled list is pinned where the list is, not where it was.\n this.along.set(along);\n if (!this.native) return;\n clearTimeout(this.settleTimer);\n this.resting = false;\n const settle = () => {\n this.resting = true;\n this.settled.set(along);\n };\n if (!this.pinning()) return settle();\n // See `STICKY_SETTLE_MS`.\n this.settleTimer = setTimeout(settle, STICKY_SETTLE_MS);\n }\n\n /** The list is scrolling itself, to `to` in the scroll view, where native has not drawn yet. */\n jumping(to: number, animated: boolean): void {\n // To where native last said it was, with no earlier jump on its way: it moves nothing and\n // reports nothing. With one, native moves and comes back, and reports that.\n const pending = this.jumped && !this.landed;\n if (Math.abs(to - (pending ? this.jumpedTo : this.nativeAt)) > 1) this.ends++;\n this.jumped = pending || Math.abs(to - this.nativeAt) > 1;\n this.landed = false;\n this.jumpedTo = to;\n this.jumpAnimated = animated;\n this.reported = undefined;\n }\n\n /** The user took the scroll over: native's own events move the rows from here. */\n dragged(): void {\n this.jumped = this.landed = false;\n // Android sends no end for a jump that is not animated, so none is waited for past a drag.\n this.ends = 0;\n }\n\n /**\n * A scroll came to rest. The last of the jumps on their way has landed, wherever it did: iOS\n * does not stop a scroll at the end of the content, so it can rest past where the list said,\n * and what moves it next (a tap on the status bar) is not a drag.\n */\n rested(): void {\n if (this.ends > 0) this.ends--;\n if (this.jumped && this.ends === 0) this.landed = true;\n }\n\n /**\n * Hand each rendered sticky row's view to native to move, and let go of the rest, and the\n * header's view, `header`, while it is pinned. `views` are the rendered rows' views in the same\n * order as `rows`. Each is only asked for where there is a drive to make or let go.\n */\n drive(\n rows: () => readonly Row[],\n views: () => readonly HostNode[],\n header: () => HostNode,\n ): void {\n if (!this.pinning() && this.drives.size === 0 && !this.headerDrive) return;\n const rendered = views();\n const axis = this.list.horizontal() ? 'x' : 'y';\n const live = new Set<HostNode>();\n // After the list scrolled itself, where native is: it draws a graph when its offset changes,\n // and after a jump the offset of a drive just made may not. What native last reported, or\n // before it has, the target of a jump that is not animated. An animated one only once it has\n // landed: on the way native's offset changes every frame, so it draws a new graph anyway, and\n // the offset here trails native's and would set every pinned row back a frame. The same holds\n // mid-fling, which is why nothing is told outside a jump.\n const from = !this.jumped\n ? undefined\n : this.jumpAnimated\n ? this.landed\n ? this.reported\n : undefined\n : (this.reported ?? this.jumpedTo);\n rows().forEach((row, at) => {\n const view = rendered[at];\n const next = this.driveOf(row);\n if (!view || !next) return;\n live.add(view);\n // The axis too: a list turned horizontal moves its sticky rows along x.\n const statics = axis + JSON.stringify(next.statics);\n const range = JSON.stringify(next.range);\n const held = this.drives.get(view);\n if (held?.statics === statics) {\n const drawn = held.range === range && held.drawn;\n const at = drawn ? from : this.drawnFrom(axis, from);\n held.range = range;\n held.drawn = drawn || at !== undefined;\n return held.drive.update(next.range, at);\n }\n held?.drive.stop();\n const told = this.drawnFrom(axis, from);\n const drive = this.engine.driveByScroll(\n view,\n this.node,\n axis,\n next.range,\n next.statics,\n told,\n );\n if (drive) this.drives.set(view, { drive, statics, range, drawn: told !== undefined });\n });\n for (const [view, held] of this.drives) {\n if (live.has(view)) continue;\n held.drive.stop();\n this.drives.delete(view);\n }\n this.driveHeader(header, axis, from);\n if (this.landed) this.jumped = this.landed = false;\n }\n\n /**\n * Hand the header to native to move while it is pinned, by the scroll view's offset until the\n * first sticky row pushes it off. Unpinned, it is moved nowhere.\n */\n private driveHeader(view: () => HostNode, axis: 'x' | 'y', from: number | undefined): void {\n const pinned = this.list.header();\n if (!pinned && !this.headerDrive) return;\n const range = pinned ? this.headerRange() : STILL;\n const held = this.headerDrive;\n const moved = JSON.stringify(range);\n const at = this.headerFrom(pinned, moved, axis, from);\n const statics = this.list.flip() ?? [];\n // The axis too: a list turned horizontal moves the header along x.\n const key = axis + JSON.stringify(statics);\n if (held?.statics === key) {\n held.pinned = pinned;\n held.range = moved;\n return held.drive.update(range, at);\n }\n held?.drive.stop();\n const drive = this.engine.driveByScroll(\n view(),\n this.node,\n axis,\n range,\n statics,\n held ? (at ?? this.drawnFrom(axis, from)) : at,\n );\n this.headerDrive = drive && { drive, statics: key, pinned, range: moved };\n }\n\n /**\n * Where native is told the scroll view is for the header's drive, `pinned` and moved by the range\n * `moved`. Pinned, let go, or moved by a new range at rest, native has no new scroll event to draw\n * it from: it is told where it last said it was. Mid-scroll the next event draws it, and what\n * native last said trails it, and what it said along the other axis says nothing of `axis`. After a\n * jump, `from`, where the list scrolled itself.\n */\n private headerFrom(\n pinned: boolean,\n moved: string,\n axis: 'x' | 'y',\n from: number | undefined,\n ): number | undefined {\n const held = this.headerDrive;\n const changed = held?.pinned !== pinned || (this.resting && held.range !== moved);\n if (!changed) return from;\n return from ?? (this.nativeAxis === axis ? this.nativeAt : undefined);\n }\n\n /**\n * Where native is told the scroll view is for a drive made, or moved by a new range, along\n * `axis`. Native draws a graph when the offset changes, and at rest no scroll event comes to draw\n * it: it is told where native last said it was, unless that was along the other axis. Mid-scroll\n * the next event draws it. After a jump, `from`.\n */\n private drawnFrom(axis: 'x' | 'y', from: number | undefined): number | undefined {\n return from ?? (this.resting && this.nativeAxis === axis ? this.nativeAt : undefined);\n }\n\n /** How native moves the pinned header. A first sticky row at the very top holds it in place. */\n private headerRange(): ScrollRange {\n const limit = this.headerLimit();\n return limit > 0 ? pinnedRange(0, limit) : STILL;\n }\n\n /** How far the header moves before the first sticky row pushes it off: to that row's top. */\n private headerLimit(): number {\n const [first] = this.rows().keys();\n return first === undefined ? Infinity : this.list.topOf(first);\n }\n\n destroy(): void {\n clearTimeout(this.settleTimer);\n for (const held of this.drives.values()) held.drive.stop();\n this.headerDrive?.drive.stop();\n }\n\n /** The size of the rows a sticky row pins under, which is how far from the edge it holds. */\n private above(index: number): number {\n let size = 0;\n for (const over of this.rows().get(index)?.above ?? NONE) size += this.list.heightOf(over);\n return size;\n }\n\n /**\n * A deeper row is drawn under the rows it pins under, and every sticky row over the rest. See\n * `FRONT`. Without levels a sticky row's zIndex is 1, as it was before there were any.\n */\n private zIndexOf(index: number): number {\n if (!this.list.levels?.levelOf()) return 1;\n return Math.max(1, FRONT - (this.rows().get(index)?.level ?? 0));\n }\n\n /** The offset a sticky row starts to hold from: where its top meets the rows it pins under. */\n private startOf(index: number): number {\n return this.list.topOf(index) - this.above(index);\n }\n\n /**\n * The offset a sticky row stops holding at, pushed off by the next: where that row's top meets\n * this row's far edge.\n */\n private stopOf(index: number): number {\n const next = this.rows().get(index)?.next;\n if (next === undefined) return Infinity;\n return this.list.topOf(next) - this.list.heightOf(index) - this.above(index);\n }\n\n /**\n * How native moves a rendered row, or null when it does not: along the scroll view's own\n * offset, which counts the header, from where the row meets the rows it pins under until the\n * next sticky row pushes it off. A row the next one follows with no space between them holds\n * nowhere, so native moves it nowhere: it is not let go, since native keeps the translate it\n * had moved a row by.\n */\n private driveOf(row: Row): { range: ScrollRange; statics: readonly StaticTransform[] } | null {\n if (!this.native || row.parked || !this.rows().has(row.index)) return null;\n const header = this.list.headerHeight();\n const start = header + this.startOf(row.index);\n const stop = header + this.stopOf(row.index);\n return {\n range:\n stop > start ? pinnedRange(start, stop) : { input: [start, start + 1], output: [0, 0] },\n statics: this.list.flip() ?? [],\n };\n }\n}\n"]}
|
package/dist/svg-icon.d.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
import type { ButtonIcon } from './native-button.ts';
|
|
1
2
|
/**
|
|
2
3
|
* The markup to commit as `svgIcon` for an icon, or undefined when it is not `{ svg }`. Says once,
|
|
3
4
|
* in development, when the markup is no `<svg>` element (the icon's name in place of its markup is
|
|
4
5
|
* the usual slip), and with `offDesktop` when the platform running draws a symbol or a drawable for
|
|
5
|
-
* the element but no SVG, since either shows no icon.
|
|
6
|
+
* the element but no SVG, since either shows no icon. `drawnOn` names the OSes that draw it.
|
|
6
7
|
*/
|
|
7
8
|
export declare function svgIconMarkup(icon: {
|
|
8
9
|
readonly svg?: string;
|
|
9
|
-
} | object | undefined, element: string, offDesktop?: boolean): string | undefined;
|
|
10
|
+
} | object | undefined, element: string, offDesktop?: boolean, drawnOn?: string): string | undefined;
|
|
11
|
+
/** A picture as a menu item or a tray icon sends it: each form under the key the host reads. */
|
|
12
|
+
export interface IconFields {
|
|
13
|
+
readonly sfSymbol?: string;
|
|
14
|
+
/** A drawable resource's name, which Android draws. */
|
|
15
|
+
readonly icon?: string;
|
|
16
|
+
readonly svgIcon?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The fields for an element's `sfSymbol` and `icon` inputs, where `icon` is a `ButtonIcon` or, as it
|
|
20
|
+
* was before it took one, a drawable's name. The `sfSymbol` input wins over an `icon` of
|
|
21
|
+
* `{ sfSymbol }`, as on `<native-button>`. Says what `svgIconMarkup` says.
|
|
22
|
+
*/
|
|
23
|
+
export declare function iconFields(sfSymbol: string | undefined, icon: string | ButtonIcon | undefined, element: string, offDesktop?: boolean): IconFields;
|
package/dist/svg-icon.js
CHANGED
|
@@ -16,9 +16,9 @@ function warnOnce(key, message) {
|
|
|
16
16
|
* The markup to commit as `svgIcon` for an icon, or undefined when it is not `{ svg }`. Says once,
|
|
17
17
|
* in development, when the markup is no `<svg>` element (the icon's name in place of its markup is
|
|
18
18
|
* the usual slip), and with `offDesktop` when the platform running draws a symbol or a drawable for
|
|
19
|
-
* the element but no SVG, since either shows no icon.
|
|
19
|
+
* the element but no SVG, since either shows no icon. `drawnOn` names the OSes that draw it.
|
|
20
20
|
*/
|
|
21
|
-
export function svgIconMarkup(icon, element, offDesktop = false) {
|
|
21
|
+
export function svgIconMarkup(icon, element, offDesktop = false, drawnOn = 'macOS and Linux') {
|
|
22
22
|
if (!icon || !('svg' in icon) || typeof icon.svg !== 'string')
|
|
23
23
|
return undefined;
|
|
24
24
|
const markup = icon.svg;
|
|
@@ -29,9 +29,25 @@ export function svgIconMarkup(icon, element, offDesktop = false) {
|
|
|
29
29
|
}
|
|
30
30
|
const os = nativePlatform();
|
|
31
31
|
if (offDesktop && os !== 'macos' && os !== 'linux') {
|
|
32
|
-
warnOnce(`platform:${element}:${os}`, `<${element}> draws an SVG icon on
|
|
32
|
+
warnOnce(`platform:${element}:${os}`, `<${element}> draws an SVG icon on ${drawnOn} only, so on ${os} it shows none. ` +
|
|
33
33
|
`Give it { sfSymbol } or { drawable } there.`);
|
|
34
34
|
}
|
|
35
35
|
return markup;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The fields for an element's `sfSymbol` and `icon` inputs, where `icon` is a `ButtonIcon` or, as it
|
|
39
|
+
* was before it took one, a drawable's name. The `sfSymbol` input wins over an `icon` of
|
|
40
|
+
* `{ sfSymbol }`, as on `<native-button>`. Says what `svgIconMarkup` says.
|
|
41
|
+
*/
|
|
42
|
+
export function iconFields(sfSymbol, icon, element, offDesktop = false) {
|
|
43
|
+
const given = typeof icon === 'string' ? { drawable: icon } : icon;
|
|
44
|
+
const symbol = sfSymbol || (given && 'sfSymbol' in given ? given.sfSymbol : undefined);
|
|
45
|
+
const drawable = given && 'drawable' in given ? given.drawable : undefined;
|
|
46
|
+
const svgIcon = svgIconMarkup(given, element, offDesktop);
|
|
47
|
+
return {
|
|
48
|
+
...(symbol && { sfSymbol: symbol }),
|
|
49
|
+
...(drawable && { icon: drawable }),
|
|
50
|
+
...(svgIcon && { svgIcon }),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
37
53
|
//# sourceMappingURL=svg-icon.js.map
|
package/dist/svg-icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg-icon.js","sourceRoot":"","sources":["../src/svg-icon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"svg-icon.js","sourceRoot":"","sources":["../src/svg-icon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKnD,6DAA6D;AAC7D,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjC,SAAS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GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,MAAM,MAAM,GAAG,QAAQ,IAAI,CAAC,KAAK,IAAI,UAAU,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACvF,MAAM,QAAQ,GAAG,KAAK,IAAI,UAAU,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3E,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAC1D,OAAO;QACL,GAAG,CAAC,MAAM,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnC,GAAG,CAAC,QAAQ,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACnC,GAAG,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC;KAC5B,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The `{ svg }` form of a `ButtonIcon`: an icon's SVG markup, such as an `@ng-icons` set's, which\n * the macOS and Linux hosts draw as their own icon (a template image AppKit tints, and a symbolic\n * icon GTK draws in the text colour). They take it as the `svgIcon` prop.\n */\nimport { nativePlatform } from '@ng-native/fabric';\nimport type { ButtonIcon } from './native-button.ts';\n\ndeclare const ngDevMode: unknown;\n\n/** What was already said, so a list of rows says it once. */\nconst warned = new Set<string>();\n\nfunction warnOnce(key: string, message: string): void {\n if ((typeof ngDevMode !== 'undefined' && !ngDevMode) || warned.has(key)) return;\n warned.add(key);\n console.warn(`[angular-native] ${message}`);\n}\n\n/**\n * The markup to commit as `svgIcon` for an icon, or undefined when it is not `{ svg }`. Says once,\n * in development, when the markup is no `<svg>` element (the icon's name in place of its markup is\n * the usual slip), and with `offDesktop` when the platform running draws a symbol or a drawable for\n * the element but no SVG, since either shows no icon. `drawnOn` names the OSes that draw it.\n */\nexport function svgIconMarkup(\n icon: { readonly svg?: string } | object | undefined,\n element: string,\n offDesktop = false,\n drawnOn = 'macOS and Linux',\n): string | undefined {\n if (!icon || !('svg' in icon) || typeof icon.svg !== 'string') return undefined;\n const markup = icon.svg;\n if (!/<svg[\\s/>]/i.test(markup)) {\n warnOnce(\n `markup:${markup}`,\n `<${element}> was given an SVG icon that is no <svg> element, so it shows none: ` +\n `\"${markup.slice(0, 40)}\". Pass the icon's markup, such as the string ` +\n `@ng-icons/lucide exports, not its name.`,\n );\n }\n const os = nativePlatform();\n if (offDesktop && os !== 'macos' && os !== 'linux') {\n warnOnce(\n `platform:${element}:${os}`,\n `<${element}> draws an SVG icon on ${drawnOn} only, so on ${os} it shows none. ` +\n `Give it { sfSymbol } or { drawable } there.`,\n );\n }\n return markup;\n}\n\n/** A picture as a menu item or a tray icon sends it: each form under the key the host reads. */\nexport interface IconFields {\n readonly sfSymbol?: string;\n /** A drawable resource's name, which Android draws. */\n readonly icon?: string;\n readonly svgIcon?: string;\n}\n\n/**\n * The fields for an element's `sfSymbol` and `icon` inputs, where `icon` is a `ButtonIcon` or, as it\n * was before it took one, a drawable's name. The `sfSymbol` input wins over an `icon` of\n * `{ sfSymbol }`, as on `<native-button>`. Says what `svgIconMarkup` says.\n */\nexport function iconFields(\n sfSymbol: string | undefined,\n icon: string | ButtonIcon | undefined,\n element: string,\n offDesktop = false,\n): IconFields {\n const given = typeof icon === 'string' ? { drawable: icon } : icon;\n const symbol = sfSymbol || (given && 'sfSymbol' in given ? given.sfSymbol : undefined);\n const drawable = given && 'drawable' in given ? given.drawable : undefined;\n const svgIcon = svgIconMarkup(given, element, offDesktop);\n return {\n ...(symbol && { sfSymbol: symbol }),\n ...(drawable && { icon: drawable }),\n ...(svgIcon && { svgIcon }),\n };\n}\n"]}
|
package/dist/switch.js
CHANGED
|
@@ -113,10 +113,10 @@ export class Switch extends ViewBase {
|
|
|
113
113
|
const command = nativePlatform() === 'android' ? 'setNativeValue' : 'setValue';
|
|
114
114
|
this.engine.dispatchCommand(this.node, command, [desired]);
|
|
115
115
|
}
|
|
116
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
117
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
116
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: Switch, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
117
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: Switch, isStandalone: true, selector: "switch", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, controlSize: { classPropertyName: "controlSize", publicName: "controlSize", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, thumbColor: { classPropertyName: "thumbColor", publicName: "thumbColor", isSignal: true, isRequired: false, transformFunction: null }, trackColor: { classPropertyName: "trackColor", publicName: "trackColor", isSignal: true, isRequired: false, transformFunction: null }, iosBackgroundColor: { classPropertyName: "iosBackgroundColor", publicName: "ios_backgroundColor", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", touch: "touch" }, host: { listeners: { "change": "onNativeChange($event)" }, properties: { "accessibilityState": "accessibilityStateProp()", "value": "checked()", "controlSize": "controlSize()", "disabled": "disabled()", "attr.data-disabled": "disabled() ? '' : null", "attr.data-invalid": "invalid() ? '' : null", "attr.data-touched": "touched() ? '' : null", "enabled": "enabled()", "thumbTintColor": "thumbColor()", "tintColor": "trackColor()?.false", "trackColorForTrue": "trackColor()?.true", "trackColorForFalse": "trackColor()?.false", "trackTintColor": "checked() ? trackColor()?.true : trackColor()?.false", "style.backgroundColor": "iosBackgroundColor()", "style.borderRadius": "iosBackgroundColor() ? 16 : undefined" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
118
118
|
}
|
|
119
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: Switch, decorators: [{
|
|
120
120
|
type: Directive,
|
|
121
121
|
args: [{
|
|
122
122
|
selector: 'switch',
|
package/dist/template-slot.js
CHANGED
|
@@ -20,10 +20,10 @@ export class TemplateSlot {
|
|
|
20
20
|
this.container.clear();
|
|
21
21
|
this.view = this.container.createEmbeddedView(this.template(), { ...this.context() });
|
|
22
22
|
}
|
|
23
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
24
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
23
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: TemplateSlot, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
24
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: TemplateSlot, isStandalone: true, selector: "[templateSlot]", inputs: { template: { classPropertyName: "template", publicName: "templateSlot", isSignal: true, isRequired: true, transformFunction: null }, context: { classPropertyName: "context", publicName: "templateSlotContext", isSignal: true, isRequired: true, transformFunction: null } }, usesOnChanges: true, ngImport: i0 });
|
|
25
25
|
}
|
|
26
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: TemplateSlot, decorators: [{
|
|
27
27
|
type: Directive,
|
|
28
28
|
args: [{ selector: '[templateSlot]' }]
|
|
29
29
|
}], propDecorators: { template: [{ type: i0.Input, args: [{ isSignal: true, alias: "templateSlot", required: true }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "templateSlotContext", required: true }] }] } });
|