@ng-native/components 0.26.1 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/android/src/main/java/dev/ngnative/components/ContextMenuPopup.kt +61 -19
  2. package/android/src/main/java/dev/ngnative/components/MenusModule.kt +22 -0
  3. package/android/src/main/java/dev/ngnative/components/Shortcut.kt +13 -4
  4. package/dist/context-menu.d.ts +14 -6
  5. package/dist/context-menu.js +30 -28
  6. package/dist/context-menu.js.map +1 -1
  7. package/dist/drag-and-drop.d.ts +4 -4
  8. package/dist/drag-and-drop.js +6 -6
  9. package/dist/drag-and-drop.js.map +1 -1
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.js +3 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/menu.d.ts +7 -4
  14. package/dist/menu.js +10 -4
  15. package/dist/menu.js.map +1 -1
  16. package/dist/modal.d.ts +12 -8
  17. package/dist/modal.js +8 -8
  18. package/dist/modal.js.map +1 -1
  19. package/dist/native-button.d.ts +13 -3
  20. package/dist/native-button.js +12 -5
  21. package/dist/native-button.js.map +1 -1
  22. package/dist/press-menu.d.ts +39 -0
  23. package/dist/press-menu.js +76 -0
  24. package/dist/press-menu.js.map +1 -0
  25. package/dist/pressable.d.ts +3 -0
  26. package/dist/pressable.js +6 -1
  27. package/dist/pressable.js.map +1 -1
  28. package/dist/reanimated.js +27 -3
  29. package/dist/reanimated.js.map +1 -1
  30. package/dist/safe-area-provider.js +9 -7
  31. package/dist/safe-area-provider.js.map +1 -1
  32. package/dist/settled-updates.d.ts +55 -0
  33. package/dist/settled-updates.js +77 -0
  34. package/dist/settled-updates.js.map +1 -0
  35. package/dist/sidebar-item.d.ts +19 -4
  36. package/dist/sidebar-item.js +33 -6
  37. package/dist/sidebar-item.js.map +1 -1
  38. package/dist/sidebar-section.js +3 -2
  39. package/dist/sidebar-section.js.map +1 -1
  40. package/dist/stand-ins/reanimated.d.ts +5 -0
  41. package/dist/stand-ins/reanimated.js +7 -0
  42. package/dist/stand-ins/reanimated.js.map +1 -1
  43. package/dist/sticky-rows.d.ts +120 -25
  44. package/dist/sticky-rows.js +265 -65
  45. package/dist/sticky-rows.js.map +1 -1
  46. package/dist/svg-icon.d.ts +9 -0
  47. package/dist/svg-icon.js +37 -0
  48. package/dist/svg-icon.js.map +1 -0
  49. package/dist/virtual-list-sticky-level.d.ts +39 -0
  50. package/dist/virtual-list-sticky-level.js +82 -0
  51. package/dist/virtual-list-sticky-level.js.map +1 -0
  52. package/dist/virtual-list-sticky.d.ts +19 -0
  53. package/dist/virtual-list-sticky.js +13 -0
  54. package/dist/virtual-list-sticky.js.map +1 -0
  55. package/dist/virtual-list.d.ts +6 -2
  56. package/dist/virtual-list.js +60 -43
  57. package/dist/virtual-list.js.map +1 -1
  58. package/dist/worklet-style.d.ts +11 -0
  59. package/dist/worklet-style.js +15 -1
  60. package/dist/worklet-style.js.map +1 -1
  61. package/dist/worklets.d.ts +5 -1
  62. package/dist/worklets.js.map +1 -1
  63. package/dist/written-props.js +1 -0
  64. package/dist/written-props.js.map +1 -1
  65. package/package.json +3 -3
@@ -1,9 +1,11 @@
1
- import { Component, DestroyRef, computed, forwardRef, inject, input, model, output, } from '@angular/core';
1
+ import { Component, DestroyRef, computed, forwardRef, inject, input, model, output, signal, } from '@angular/core';
2
2
  import { SIDEBAR_SELECTION } from '@ng-native/device';
3
- import { nativePlatform, registerViewName } from '@ng-native/fabric';
3
+ import { registerViewName } from '@ng-native/fabric';
4
4
  import { ControlBase, TouchableBase } from "./pressable.js";
5
5
  import { Sidebar } from "./sidebar.js";
6
+ import { hostDraws } from "./split-view.js";
6
7
  import { Text } from "./text.js";
8
+ import { svgIconMarkup } from "./svg-icon.js";
7
9
  import * as i0 from "@angular/core";
8
10
  /**
9
11
  * On macOS a row of the sidebar's source list, a model object the desktop host builds an
@@ -26,11 +28,12 @@ registerViewName('sidebar-item', {
26
28
  *
27
29
  * Content inside the element replaces the default row of icon, label and badge: its pressables
28
30
  * take clicks, and while the row is selected its host has `data-selected` for CSS to restyle it.
31
+ * On macOS it also has `data-emphasized` while that selection is drawn in the accent colour.
29
32
  */
30
33
  export class SidebarItem extends ControlBase {
31
34
  sidebar = inject(Sidebar, { optional: true });
32
- /** Whether this row is drawnHere here rather than by the desktop host. */
33
- drawnHere = nativePlatform() !== 'macos';
35
+ /** Whether this row is drawn here rather than by the desktop host. */
36
+ drawnHere = !hostDraws('sidebar-item');
34
37
  /** The row's text, and what it is announced as. */
35
38
  label = input(/* @ts-ignore */
36
39
  ...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
@@ -41,7 +44,10 @@ export class SidebarItem extends ControlBase {
41
44
  ...(ngDevMode ? [undefined, { debugName: "sfSymbol" }] : /* istanbul ignore next */ []));
42
45
  /** Android: a drawable resource before the label. */
43
46
  drawableName = input(undefined, { ...(ngDevMode ? { debugName: "drawableName" } : /* istanbul ignore next */ {}), alias: 'drawable' });
44
- /** The picture for each OS at once, as on `<native-tab>`. */
47
+ /**
48
+ * The picture for each OS at once, as on `<native-tab>`. On macOS and Linux it can be an icon's
49
+ * SVG markup, `[icon]="{ svg: lucideBlocks }"`, which the host draws in the row's text colour.
50
+ */
45
51
  icon = input(/* @ts-ignore */
46
52
  ...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
47
53
  /** Whether this is the sidebar's selected item. A `path` from the router sets it by route. */
@@ -49,6 +55,16 @@ export class SidebarItem extends ControlBase {
49
55
  ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
50
56
  /** The user chose this item. */
51
57
  select = output();
58
+ /** On macOS, whether the source list draws the row's selection emphasized, as it last said. */
59
+ hostEmphasized = signal(false, /* @ts-ignore */
60
+ ...(ngDevMode ? [{ debugName: "hostEmphasized" }] : /* istanbul ignore next */ []));
61
+ /**
62
+ * macOS: whether the row is selected and its selection is drawn in the accent colour, while the
63
+ * window is key and the sidebar has the focus. Otherwise the selection is grey, and this is false.
64
+ * Always false on other platforms.
65
+ */
66
+ emphasized = computed(() => this.selected() && this.hostEmphasized(), /* @ts-ignore */
67
+ ...(ngDevMode ? [{ debugName: "emphasized" }] : /* istanbul ignore next */ []));
52
68
  symbol = computed(() => {
53
69
  const icon = this.icon();
54
70
  return this.sfSymbol() ?? (icon && 'sfSymbol' in icon ? icon.sfSymbol : undefined);
@@ -59,7 +75,10 @@ export class SidebarItem extends ControlBase {
59
75
  return this.drawableName() ?? (icon && 'drawable' in icon ? icon.drawable : undefined);
60
76
  }, /* @ts-ignore */
61
77
  ...(ngDevMode ? [{ debugName: "drawableResource" }] : /* istanbul ignore next */ []));
78
+ svgIcon = computed(() => svgIconMarkup(this.icon(), 'sidebar-item'), /* @ts-ignore */
79
+ ...(ngDevMode ? [{ debugName: "svgIcon" }] : /* istanbul ignore next */ []));
62
80
  stopSelect = null;
81
+ stopEmphasis = null;
63
82
  constructor() {
64
83
  super();
65
84
  const remove = this.sidebar?.addRow(this);
@@ -88,10 +107,16 @@ export class SidebarItem extends ControlBase {
88
107
  if (event.target === this.node)
89
108
  this.choose();
90
109
  });
110
+ this.stopEmphasis = this.engine.setEventListener(this.node, 'topSidebarEmphasis', (event) => {
111
+ const { target, nativeEvent } = event;
112
+ if (target === this.node)
113
+ this.hostEmphasized.set(nativeEvent?.emphasized === true);
114
+ });
91
115
  }
92
116
  ngOnDestroy() {
93
117
  super.ngOnDestroy();
94
118
  this.stopSelect?.();
119
+ this.stopEmphasis?.();
95
120
  }
96
121
  /** The user chose this row: select it, deselect the rest, and say so. */
97
122
  choose() {
@@ -105,7 +130,7 @@ export class SidebarItem extends ControlBase {
105
130
  this.selected.set(false);
106
131
  }
107
132
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: SidebarItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
108
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: SidebarItem, isStandalone: true, selector: "sidebar-item", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, badge: { classPropertyName: "badge", publicName: "badge", isSignal: true, isRequired: false, transformFunction: null }, sfSymbol: { classPropertyName: "sfSymbol", publicName: "sfSymbol", isSignal: true, isRequired: false, transformFunction: null }, drawableName: { classPropertyName: "drawableName", publicName: "drawable", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", select: "select" }, host: { properties: { "label": "drawnHere ? undefined : label()", "badge": "drawnHere ? undefined : badge()", "sfSymbol": "drawnHere ? undefined : symbol()", "drawable": "drawnHere ? undefined : drawableResource()", "selected": "drawnHere ? undefined : selected()", "attr.data-selected": "selected() ? '' : null", "class.sidebar-item-drawn": "drawnHere" } }, providers: [
133
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: SidebarItem, isStandalone: true, selector: "sidebar-item", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, badge: { classPropertyName: "badge", publicName: "badge", isSignal: true, isRequired: false, transformFunction: null }, sfSymbol: { classPropertyName: "sfSymbol", publicName: "sfSymbol", isSignal: true, isRequired: false, transformFunction: null }, drawableName: { classPropertyName: "drawableName", publicName: "drawable", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", select: "select" }, host: { properties: { "label": "drawnHere ? undefined : label()", "badge": "drawnHere ? undefined : badge()", "sfSymbol": "drawnHere ? undefined : symbol()", "drawable": "drawnHere ? undefined : drawableResource()", "svgIcon": "drawnHere ? undefined : svgIcon()", "selected": "drawnHere ? undefined : selected()", "attr.data-selected": "selected() ? '' : null", "attr.data-emphasized": "emphasized() ? '' : null", "class.sidebar-item-drawn": "drawnHere" } }, providers: [
109
134
  { provide: TouchableBase, useExisting: forwardRef(() => SidebarItem) },
110
135
  {
111
136
  provide: SIDEBAR_SELECTION,
@@ -144,8 +169,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
144
169
  '[badge]': 'drawnHere ? undefined : badge()',
145
170
  '[sfSymbol]': 'drawnHere ? undefined : symbol()',
146
171
  '[drawable]': 'drawnHere ? undefined : drawableResource()',
172
+ '[svgIcon]': 'drawnHere ? undefined : svgIcon()',
147
173
  '[selected]': 'drawnHere ? undefined : selected()',
148
174
  '[attr.data-selected]': "selected() ? '' : null",
175
+ '[attr.data-emphasized]': "emphasized() ? '' : null",
149
176
  '[class.sidebar-item-drawn]': 'drawnHere',
150
177
  }, styles: ["\n /* A row drawn here. On macOS the host's cell is the row, and custom content fills it. */\n :host(.sidebar-item-drawn) {\n flex-direction: row;\n align-items: center;\n gap: 8px;\n padding: 6px 12px;\n }\n .sidebar-item-label {\n flex: 1;\n }\n .sidebar-item-badge {\n opacity: 0.6;\n }\n "] }]
151
178
  }], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], badge: [{ type: i0.Input, args: [{ isSignal: true, alias: "badge", required: false }] }], sfSymbol: [{ type: i0.Input, args: [{ isSignal: true, alias: "sfSymbol", required: false }] }], drawableName: [{ type: i0.Input, args: [{ isSignal: true, alias: "drawable", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }], select: [{ type: i0.Output, args: ["select"] }] } });
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-item.js","sourceRoot":"","sources":["../src/sidebar-item.ts"],"names":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AC,YACL;;;;;;;;;GAST,aAgBU;wBACT,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE;wBACtE;4BACE,OAAO,EAAE,iBAAiB;4BAC1B,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ;yBACjE;qBACF,QACK;wBACJ,SAAS,EAAE,iCAAiC;wBAC5C,SAAS,EAAE,iCAAiC;wBAC5C,YAAY,EAAE,kCAAkC;wBAChD,YAAY,EAAE,4CAA4C;wBAC1D,YAAY,EAAE,oCAAoC;wBAClD,sBAAsB,EAAE,wBAAwB;wBAChD,4BAA4B,EAAE,WAAW;qBAC1C","sourcesContent":["import {\n Component,\n DestroyRef,\n computed,\n forwardRef,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\nimport { SIDEBAR_SELECTION } from '@ng-native/device';\nimport { nativePlatform, registerViewName } from '@ng-native/fabric';\nimport type { ButtonIcon } from './native-button.ts';\nimport { ControlBase, TouchableBase } from './pressable.ts';\nimport { Sidebar, type SidebarRow } from './sidebar.ts';\nimport { Text } from './text.ts';\n\n/**\n * On macOS a row of the sidebar's source list, a model object the desktop host builds an\n * NSTableCellView from. An item with children is a custom row: the host puts its views in a cell\n * of its own. Elsewhere a pressable view, drawnHere here.\n */\nregisterViewName('sidebar-item', {\n ios: 'View',\n android: 'View',\n macos: 'NgNativeSidebarItem',\n});\n\n/** A sidebar item's picture, as on `<native-tab>` and `<native-button>`. */\nexport type SidebarItemIcon = ButtonIcon;\n\n/**\n * A row of the sidebar:\n *\n * <sidebar-item label=\"Inbox\" sfSymbol=\"tray\" [badge]=\"unread()\" [(selected)]=\"inbox\" />\n *\n * With `path`, from `@ng-native/router`, the route selects it, as a `<native-tab>`'s does, and\n * choosing it navigates there. Without, `[(selected)]` holds the selection. Either way choosing it\n * fires `(select)` and deselects the sidebar's other items.\n *\n * Content inside the element replaces the default row of icon, label and badge: its pressables\n * take clicks, and while the row is selected its host has `data-selected` for CSS to restyle it.\n */\n@Component({\n selector: 'sidebar-item',\n imports: [Text],\n template: `\n <ng-content>\n @if (drawnHere) {\n <text class=\"sidebar-item-label\">{{ label() }}</text>\n @if (badge()) {\n <text class=\"sidebar-item-badge\">{{ badge() }}</text>\n }\n }\n </ng-content>\n `,\n styles: `\n /* A row drawn here. On macOS the host's cell is the row, and custom content fills it. */\n :host(.sidebar-item-drawn) {\n flex-direction: row;\n align-items: center;\n gap: 8px;\n padding: 6px 12px;\n }\n .sidebar-item-label {\n flex: 1;\n }\n .sidebar-item-badge {\n opacity: 0.6;\n }\n `,\n providers: [\n { provide: TouchableBase, useExisting: forwardRef(() => SidebarItem) },\n {\n provide: SIDEBAR_SELECTION,\n useFactory: () => inject(forwardRef(() => SidebarItem)).selected,\n },\n ],\n host: {\n '[label]': 'drawnHere ? undefined : label()',\n '[badge]': 'drawnHere ? undefined : badge()',\n '[sfSymbol]': 'drawnHere ? undefined : symbol()',\n '[drawable]': 'drawnHere ? undefined : drawableResource()',\n '[selected]': 'drawnHere ? undefined : selected()',\n '[attr.data-selected]': \"selected() ? '' : null\",\n '[class.sidebar-item-drawn]': 'drawnHere',\n },\n})\nexport class SidebarItem extends ControlBase implements SidebarRow {\n private readonly sidebar = inject(Sidebar, { optional: true });\n /** Whether this row is drawnHere here rather than by the desktop host. */\n protected readonly drawnHere = nativePlatform() !== 'macos';\n\n /** The row's text, and what it is announced as. */\n readonly label = input<string>();\n /** A count or a short word at the trailing edge. */\n readonly badge = input<string | undefined, string | number | null | undefined>(undefined, {\n transform: (value) => (value == null ? undefined : String(value)),\n });\n /** An SF Symbol before the label, on macOS and iOS. */\n readonly sfSymbol = input<string>();\n /** Android: a drawable resource before the label. */\n readonly drawableName = input<string>(undefined, { alias: 'drawable' });\n /** The picture for each OS at once, as on `<native-tab>`. */\n readonly icon = input<SidebarItemIcon>();\n /** Whether this is the sidebar's selected item. A `path` from the router sets it by route. */\n readonly selected = model(false);\n /** The user chose this item. */\n readonly select = output<void>();\n\n protected readonly symbol = computed(() => {\n const icon = this.icon();\n return this.sfSymbol() ?? (icon && 'sfSymbol' in icon ? icon.sfSymbol : undefined);\n });\n\n protected readonly drawableResource = computed(() => {\n const icon = this.icon();\n return this.drawableName() ?? (icon && 'drawable' in icon ? icon.drawable : undefined);\n });\n\n private stopSelect: (() => void) | null = null;\n\n constructor() {\n super();\n const remove = this.sidebar?.addRow(this);\n if (remove) inject(DestroyRef).onDestroy(remove);\n this.press.subscribe(() => this.choose());\n }\n\n protected override roleByDefault(): 'button' {\n return 'button';\n }\n\n protected override accessibleByDefault(): boolean {\n return true;\n }\n\n protected override focusableByDefault(): boolean {\n return true;\n }\n\n /** On macOS the source list takes the click and selects the row: the responder never does. */\n protected override claims(): boolean {\n return this.drawnHere && super.claims();\n }\n\n override ngOnInit(): void {\n super.ngOnInit();\n if (this.drawnHere || this.stopSelect) return;\n this.stopSelect = this.engine.setEventListener(this.node, 'topSidebarSelect', (event) => {\n if ((event as { target?: unknown }).target === this.node) this.choose();\n });\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n this.stopSelect?.();\n }\n\n /** The user chose this row: select it, deselect the rest, and say so. */\n choose(): void {\n if (this.pressDisabled()) return;\n this.selected.set(true);\n this.sidebar?.chose(this);\n this.select.emit();\n }\n\n deselect(): void {\n this.selected.set(false);\n }\n}\n"]}
1
+ {"version":3,"file":"sidebar-item.js","sourceRoot":"","sources":["../src/sidebar-item.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACV,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,GAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,WAAW,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AAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;uGAxGU,WAAW;2FAAX,WAAW,6zCAnBX;YACT,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE;YACtE;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ;aACjE;SACF,iDA/BS;;;;;;;;;GAST,kaAVS,IAAI;;2FA6CH,WAAW;kBA/CvB,SAAS;+BACE,cAAc,WACf,CAAC,IAAI,CAAC,YACL;;;;;;;;;GAST,aAgBU;wBACT,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE;wBACtE;4BACE,OAAO,EAAE,iBAAiB;4BAC1B,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ;yBACjE;qBACF,QACK;wBACJ,SAAS,EAAE,iCAAiC;wBAC5C,SAAS,EAAE,iCAAiC;wBAC5C,YAAY,EAAE,kCAAkC;wBAChD,YAAY,EAAE,4CAA4C;wBAC1D,WAAW,EAAE,mCAAmC;wBAChD,YAAY,EAAE,oCAAoC;wBAClD,sBAAsB,EAAE,wBAAwB;wBAChD,wBAAwB,EAAE,0BAA0B;wBACpD,4BAA4B,EAAE,WAAW;qBAC1C","sourcesContent":["import {\n Component,\n DestroyRef,\n computed,\n forwardRef,\n inject,\n input,\n model,\n output,\n signal,\n type Signal,\n} from '@angular/core';\nimport { SIDEBAR_SELECTION } from '@ng-native/device';\nimport { registerViewName } from '@ng-native/fabric';\nimport type { ButtonIcon } from './native-button.ts';\nimport { ControlBase, TouchableBase } from './pressable.ts';\nimport { Sidebar, type SidebarRow } from './sidebar.ts';\nimport { hostDraws } from './split-view.ts';\nimport { Text } from './text.ts';\nimport { svgIconMarkup } from './svg-icon.ts';\n\n/**\n * On macOS a row of the sidebar's source list, a model object the desktop host builds an\n * NSTableCellView from. An item with children is a custom row: the host puts its views in a cell\n * of its own. Elsewhere a pressable view, drawnHere here.\n */\nregisterViewName('sidebar-item', {\n ios: 'View',\n android: 'View',\n macos: 'NgNativeSidebarItem',\n});\n\n/** A sidebar item's picture, as on `<native-tab>` and `<native-button>`. */\nexport type SidebarItemIcon = ButtonIcon;\n\n/**\n * A row of the sidebar:\n *\n * <sidebar-item label=\"Inbox\" sfSymbol=\"tray\" [badge]=\"unread()\" [(selected)]=\"inbox\" />\n *\n * With `path`, from `@ng-native/router`, the route selects it, as a `<native-tab>`'s does, and\n * choosing it navigates there. Without, `[(selected)]` holds the selection. Either way choosing it\n * fires `(select)` and deselects the sidebar's other items.\n *\n * Content inside the element replaces the default row of icon, label and badge: its pressables\n * take clicks, and while the row is selected its host has `data-selected` for CSS to restyle it.\n * On macOS it also has `data-emphasized` while that selection is drawn in the accent colour.\n */\n@Component({\n selector: 'sidebar-item',\n imports: [Text],\n template: `\n <ng-content>\n @if (drawnHere) {\n <text class=\"sidebar-item-label\">{{ label() }}</text>\n @if (badge()) {\n <text class=\"sidebar-item-badge\">{{ badge() }}</text>\n }\n }\n </ng-content>\n `,\n styles: `\n /* A row drawn here. On macOS the host's cell is the row, and custom content fills it. */\n :host(.sidebar-item-drawn) {\n flex-direction: row;\n align-items: center;\n gap: 8px;\n padding: 6px 12px;\n }\n .sidebar-item-label {\n flex: 1;\n }\n .sidebar-item-badge {\n opacity: 0.6;\n }\n `,\n providers: [\n { provide: TouchableBase, useExisting: forwardRef(() => SidebarItem) },\n {\n provide: SIDEBAR_SELECTION,\n useFactory: () => inject(forwardRef(() => SidebarItem)).selected,\n },\n ],\n host: {\n '[label]': 'drawnHere ? undefined : label()',\n '[badge]': 'drawnHere ? undefined : badge()',\n '[sfSymbol]': 'drawnHere ? undefined : symbol()',\n '[drawable]': 'drawnHere ? undefined : drawableResource()',\n '[svgIcon]': 'drawnHere ? undefined : svgIcon()',\n '[selected]': 'drawnHere ? undefined : selected()',\n '[attr.data-selected]': \"selected() ? '' : null\",\n '[attr.data-emphasized]': \"emphasized() ? '' : null\",\n '[class.sidebar-item-drawn]': 'drawnHere',\n },\n})\nexport class SidebarItem extends ControlBase implements SidebarRow {\n private readonly sidebar = inject(Sidebar, { optional: true });\n /** Whether this row is drawn here rather than by the desktop host. */\n protected readonly drawnHere = !hostDraws('sidebar-item');\n\n /** The row's text, and what it is announced as. */\n readonly label = input<string>();\n /** A count or a short word at the trailing edge. */\n readonly badge = input<string | undefined, string | number | null | undefined>(undefined, {\n transform: (value) => (value == null ? undefined : String(value)),\n });\n /** An SF Symbol before the label, on macOS and iOS. */\n readonly sfSymbol = input<string>();\n /** Android: a drawable resource before the label. */\n readonly drawableName = input<string>(undefined, { alias: 'drawable' });\n /**\n * The picture for each OS at once, as on `<native-tab>`. On macOS and Linux it can be an icon's\n * SVG markup, `[icon]=\"{ svg: lucideBlocks }\"`, which the host draws in the row's text colour.\n */\n readonly icon = input<SidebarItemIcon>();\n /** Whether this is the sidebar's selected item. A `path` from the router sets it by route. */\n readonly selected = model(false);\n /** The user chose this item. */\n readonly select = output<void>();\n\n /** On macOS, whether the source list draws the row's selection emphasized, as it last said. */\n private readonly hostEmphasized = signal(false);\n /**\n * macOS: whether the row is selected and its selection is drawn in the accent colour, while the\n * window is key and the sidebar has the focus. Otherwise the selection is grey, and this is false.\n * Always false on other platforms.\n */\n readonly emphasized: Signal<boolean> = computed(() => this.selected() && this.hostEmphasized());\n\n protected readonly symbol = computed(() => {\n const icon = this.icon();\n return this.sfSymbol() ?? (icon && 'sfSymbol' in icon ? icon.sfSymbol : undefined);\n });\n\n protected readonly drawableResource = computed(() => {\n const icon = this.icon();\n return this.drawableName() ?? (icon && 'drawable' in icon ? icon.drawable : undefined);\n });\n\n protected readonly svgIcon = computed(() => svgIconMarkup(this.icon(), 'sidebar-item'));\n\n private stopSelect: (() => void) | null = null;\n private stopEmphasis: (() => void) | null = null;\n\n constructor() {\n super();\n const remove = this.sidebar?.addRow(this);\n if (remove) inject(DestroyRef).onDestroy(remove);\n this.press.subscribe(() => this.choose());\n }\n\n protected override roleByDefault(): 'button' {\n return 'button';\n }\n\n protected override accessibleByDefault(): boolean {\n return true;\n }\n\n protected override focusableByDefault(): boolean {\n return true;\n }\n\n /** On macOS the source list takes the click and selects the row: the responder never does. */\n protected override claims(): boolean {\n return this.drawnHere && super.claims();\n }\n\n override ngOnInit(): void {\n super.ngOnInit();\n if (this.drawnHere || this.stopSelect) return;\n this.stopSelect = this.engine.setEventListener(this.node, 'topSidebarSelect', (event) => {\n if ((event as { target?: unknown }).target === this.node) this.choose();\n });\n this.stopEmphasis = this.engine.setEventListener(this.node, 'topSidebarEmphasis', (event) => {\n const { target, nativeEvent } = event as {\n target?: unknown;\n nativeEvent?: { emphasized?: unknown };\n };\n if (target === this.node) this.hostEmphasized.set(nativeEvent?.emphasized === true);\n });\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n this.stopSelect?.();\n this.stopEmphasis?.();\n }\n\n /** The user chose this row: select it, deselect the rest, and say so. */\n choose(): void {\n if (this.pressDisabled()) return;\n this.selected.set(true);\n this.sidebar?.chose(this);\n this.select.emit();\n }\n\n deselect(): void {\n this.selected.set(false);\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import { Component, computed, input, signal } from '@angular/core';
2
- import { nativePlatform, registerViewName } from '@ng-native/fabric';
2
+ import { registerViewName } from '@ng-native/fabric';
3
3
  import { Pressable } from "./pressable.js";
4
+ import { hostDraws } from "./split-view.js";
4
5
  import { optionalBoolean } from "./transforms.js";
5
6
  import { Text } from "./text.js";
6
7
  import { ViewBase } from "./view-base.js";
@@ -21,7 +22,7 @@ registerViewName('sidebar-section', {
21
22
  */
22
23
  export class SidebarSection extends ViewBase {
23
24
  /** Whether this section is drawn here rather than by the desktop host. */
24
- drawn = nativePlatform() !== 'macos';
25
+ drawn = !hostDraws('sidebar-section');
25
26
  /** Drawn, whether the items show: a collapsible section's title toggles it. */
26
27
  expanded = signal(true, /* @ts-ignore */
27
28
  ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-section.js","sourceRoot":"","sources":["../src/sidebar-section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;;AAE1C;;;GAGG;AACH,gBAAgB,CAAC,iBAAiB,EAAE;IAClC,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAC;AAEH;;;;GAIG;AA8BH,MAAM,OAAO,cAAe,SAAQ,QAAQ;IAC1C,0EAA0E;IACvD,KAAK,GAAG,cAAc,EAAE,KAAK,OAAO,CAAC;IACxD,+EAA+E;IAC5D,QAAQ,GAAG,MAAM,CAAC,IAAI;iFAAC,CAAC;IAE3C,0EAA0E;IACjE,KAAK,GAAG,KAAK;yFAAU,CAAC;IACjC,6DAA6D;IACpD,WAAW,GAAG,KAAK,CAAC,KAAK,mFAAI,SAAS,EAAE,eAAe,GAAG,CAAC;IAEpE,wFAAwF;IACrE,KAAK,GAAG,QAAQ,CACjC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;8EAC9E,CAAC;uGAdS,cAAc;2FAAd,cAAc,seA1Bf;;;;;;;;;;;;;;GAcT,sKAfS,SAAS,+EAAE,IAAI;;2FA2Bd,cAAc;kBA7B1B,SAAS;+BACE,iBAAiB,WAClB,CAAC,SAAS,EAAE,IAAI,CAAC,YAChB;;;;;;;;;;;;;;GAcT,QAOK;wBACJ,SAAS,EAAE,6BAA6B;wBACxC,eAAe,EAAE,mCAAmC;qBACrD","sourcesContent":["import { Component, computed, input, signal } from '@angular/core';\nimport { nativePlatform, registerViewName } from '@ng-native/fabric';\nimport { Pressable } from './pressable.ts';\nimport { optionalBoolean } from './transforms.ts';\nimport { Text } from './text.ts';\nimport { ViewBase } from './view-base.ts';\n\n/**\n * On macOS a group of the sidebar's source list, a model object the desktop host reads its rows\n * from. Neighbouring sections in one parent are one NSOutlineView. Elsewhere a view, drawn here.\n */\nregisterViewName('sidebar-section', {\n ios: 'View',\n android: 'View',\n macos: 'NgNativeSidebarSection',\n});\n\n/**\n * A group of `<sidebar-item>`s with an optional `title`. A `collapsible` one shows and hides its\n * items from its title: on macOS with the source list's own disclosure, drawn by a press on the\n * title elsewhere. Selection survives the section collapsing.\n */\n@Component({\n selector: 'sidebar-section',\n imports: [Pressable, Text],\n template: `\n @if (drawn && title()) {\n <pressable\n class=\"sidebar-section-title\"\n accessibilityRole=\"header\"\n [disabled]=\"!collapsible()\"\n (press)=\"expanded.set(!expanded())\"\n >\n <text>{{ title() }}</text>\n </pressable>\n }\n @if (shown()) {\n <ng-content />\n }\n `,\n styles: `\n .sidebar-section-title {\n padding: 8px 12px 4px;\n opacity: 0.6;\n }\n `,\n host: {\n '[title]': 'drawn ? undefined : title()',\n '[collapsible]': 'drawn ? undefined : collapsible()',\n },\n})\nexport class SidebarSection extends ViewBase {\n /** Whether this section is drawn here rather than by the desktop host. */\n protected readonly drawn = nativePlatform() !== 'macos';\n /** Drawn, whether the items show: a collapsible section's title toggles it. */\n protected readonly expanded = signal(true);\n\n /** The heading over the section's items. None gives an untitled group. */\n readonly title = input<string>();\n /** Whether the title shows and hides the section's items. */\n readonly collapsible = input(false, { transform: optionalBoolean });\n\n /** Whether the items show: always, unless a title that can show them again hid them. */\n protected readonly shown = computed(\n () => !this.drawn || this.expanded() || !(this.collapsible() && this.title()),\n );\n}\n"]}
1
+ {"version":3,"file":"sidebar-section.js","sourceRoot":"","sources":["../src/sidebar-section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;;AAE1C;;;GAGG;AACH,gBAAgB,CAAC,iBAAiB,EAAE;IAClC,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAC;AAEH;;;;GAIG;AA8BH,MAAM,OAAO,cAAe,SAAQ,QAAQ;IAC1C,0EAA0E;IACvD,KAAK,GAAG,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IACzD,+EAA+E;IAC5D,QAAQ,GAAG,MAAM,CAAC,IAAI;iFAAC,CAAC;IAE3C,0EAA0E;IACjE,KAAK,GAAG,KAAK;yFAAU,CAAC;IACjC,6DAA6D;IACpD,WAAW,GAAG,KAAK,CAAC,KAAK,mFAAI,SAAS,EAAE,eAAe,GAAG,CAAC;IAEpE,wFAAwF;IACrE,KAAK,GAAG,QAAQ,CACjC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;8EAC9E,CAAC;uGAdS,cAAc;2FAAd,cAAc,seA1Bf;;;;;;;;;;;;;;GAcT,sKAfS,SAAS,+EAAE,IAAI;;2FA2Bd,cAAc;kBA7B1B,SAAS;+BACE,iBAAiB,WAClB,CAAC,SAAS,EAAE,IAAI,CAAC,YAChB;;;;;;;;;;;;;;GAcT,QAOK;wBACJ,SAAS,EAAE,6BAA6B;wBACxC,eAAe,EAAE,mCAAmC;qBACrD","sourcesContent":["import { Component, computed, input, signal } from '@angular/core';\nimport { registerViewName } from '@ng-native/fabric';\nimport { Pressable } from './pressable.ts';\nimport { hostDraws } from './split-view.ts';\nimport { optionalBoolean } from './transforms.ts';\nimport { Text } from './text.ts';\nimport { ViewBase } from './view-base.ts';\n\n/**\n * On macOS a group of the sidebar's source list, a model object the desktop host reads its rows\n * from. Neighbouring sections in one parent are one NSOutlineView. Elsewhere a view, drawn here.\n */\nregisterViewName('sidebar-section', {\n ios: 'View',\n android: 'View',\n macos: 'NgNativeSidebarSection',\n});\n\n/**\n * A group of `<sidebar-item>`s with an optional `title`. A `collapsible` one shows and hides its\n * items from its title: on macOS with the source list's own disclosure, drawn by a press on the\n * title elsewhere. Selection survives the section collapsing.\n */\n@Component({\n selector: 'sidebar-section',\n imports: [Pressable, Text],\n template: `\n @if (drawn && title()) {\n <pressable\n class=\"sidebar-section-title\"\n accessibilityRole=\"header\"\n [disabled]=\"!collapsible()\"\n (press)=\"expanded.set(!expanded())\"\n >\n <text>{{ title() }}</text>\n </pressable>\n }\n @if (shown()) {\n <ng-content />\n }\n `,\n styles: `\n .sidebar-section-title {\n padding: 8px 12px 4px;\n opacity: 0.6;\n }\n `,\n host: {\n '[title]': 'drawn ? undefined : title()',\n '[collapsible]': 'drawn ? undefined : collapsible()',\n },\n})\nexport class SidebarSection extends ViewBase {\n /** Whether this section is drawn here rather than by the desktop host. */\n protected readonly drawn = !hostDraws('sidebar-section');\n /** Drawn, whether the items show: a collapsible section's title toggles it. */\n protected readonly expanded = signal(true);\n\n /** The heading over the section's items. None gives an untitled group. */\n readonly title = input<string>();\n /** Whether the title shows and hides the section's items. */\n readonly collapsible = input(false, { transform: optionalBoolean });\n\n /** Whether the items show: always, unless a title that can show them again hid them. */\n protected readonly shown = computed(\n () => !this.drawn || this.expanded() || !(this.collapsible() && this.title()),\n );\n}\n"]}
@@ -25,6 +25,11 @@ export declare function cancelAnimation(_value: unknown): void;
25
25
  /** What `@ng-native/components/reanimated` itself starts a style with; nothing runs it here. */
26
26
  export declare function startMapper(_worklet: () => void, _inputs?: unknown[]): number;
27
27
  export declare function stopMapper(_id: number): void;
28
+ /**
29
+ * What `@ng-native/components/reanimated` asks before it reads the values Reanimated's views
30
+ * settled on. Off: with no UI thread there are none to read.
31
+ */
32
+ export declare function getStaticFeatureFlag(_name: string): boolean;
28
33
  export declare const Extrapolation: {
29
34
  readonly IDENTITY: "identity";
30
35
  readonly CLAMP: "clamp";
@@ -39,6 +39,13 @@ export function startMapper(_worklet, _inputs) {
39
39
  return 0;
40
40
  }
41
41
  export function stopMapper(_id) { }
42
+ /**
43
+ * What `@ng-native/components/reanimated` asks before it reads the values Reanimated's views
44
+ * settled on. Off: with no UI thread there are none to read.
45
+ */
46
+ export function getStaticFeatureFlag(_name) {
47
+ return false;
48
+ }
42
49
  export const Extrapolation = { IDENTITY: 'identity', CLAMP: 'clamp', EXTEND: 'extend' };
43
50
  /** Past an end of the input range: the end's output, the input itself, or `undefined` to extend. */
44
51
  function beyond(x, output, how) {
@@ -1 +1 @@
1
- {"version":3,"file":"reanimated.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E,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,OAAO,CAAyB,EAAqB;IACnE,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["/**\n * `react-native-reanimated` where there is no UI-thread runtime: a browser build and a test, which\n * resolve the library here (`ngNativeWeb()` and `@ng-native/testing`).\n *\n * An animation finishes the moment it is assigned: `withTiming(100)` is `100`, and its callback\n * is called with `true` at once, so the value is where the animation ends and what ends it runs.\n * `interpolate` and `Extrapolation` are the library's own arithmetic; `Easing` curves are the\n * identity, since nothing is ever between an animation's ends.\n *\n * ponytail: the functions apps call from components, not the React hooks; add one when an app\n * imports it.\n */\nexport { sharedValue as makeMutable } from '../reanimated-web.ts';\nexport type { MutableValue as SharedValue } from '../worklets.ts';\n\ntype Done = ((finished?: boolean) => void) | undefined;\n\nconst settle = <T>(to: T, callback: Done): T => {\n callback?.(true);\n return to;\n};\n\nexport function withTiming<T>(to: T, _config?: object, callback?: Done): T {\n return settle(to, callback);\n}\n\nexport function withSpring<T>(to: T, _config?: object, callback?: Done): T {\n return settle(to, callback);\n}\n\nexport function withDecay(_config: { velocity?: number }, callback?: Done): number {\n return settle(0, callback);\n}\n\nexport function withDelay<T>(_delay: number, animation: T): T {\n return animation;\n}\n\nexport function withSequence<T>(...animations: T[]): T {\n return animations[animations.length - 1]!;\n}\n\nexport function withRepeat<T>(\n animation: T,\n _times?: number,\n _reverse?: boolean,\n callback?: Done,\n): T {\n return settle(animation, callback);\n}\n\nexport function cancelAnimation(_value: unknown): void {}\n\n/** What `@ng-native/components/reanimated` itself starts a style with; nothing runs it here. */\nexport function startMapper(_worklet: () => void, _inputs?: unknown[]): number {\n return 0;\n}\n\nexport function stopMapper(_id: number): void {}\n\nexport const Extrapolation = { IDENTITY: 'identity', CLAMP: 'clamp', EXTEND: 'extend' } as const;\ntype Extrapolate = (typeof Extrapolation)[keyof typeof Extrapolation];\n\n/** Past an end of the input range: the end's output, the input itself, or `undefined` to extend. */\nfunction beyond(x: number, output: number, how: Extrapolate | undefined): number | undefined {\n if (how === 'clamp') return output;\n if (how === 'identity') return x;\n return undefined;\n}\n\nexport function interpolate(\n x: number,\n input: readonly number[],\n output: readonly number[],\n extrapolate?: Extrapolate | { extrapolateLeft?: Extrapolate; extrapolateRight?: Extrapolate },\n): number {\n const left = typeof extrapolate === 'object' ? extrapolate.extrapolateLeft : extrapolate;\n const right = typeof extrapolate === 'object' ? extrapolate.extrapolateRight : extrapolate;\n const last = input.length - 1;\n const outside =\n x < input[0]!\n ? beyond(x, output[0]!, left)\n : x > input[last]!\n ? beyond(x, output[last]!, right)\n : undefined;\n if (outside !== undefined) return outside;\n let i = 0;\n while (i < last - 1 && x > input[i + 1]!) i++;\n const [a, b, p, q] = [input[i]!, input[i + 1]!, output[i]!, output[i + 1]!];\n return b === a ? p : p + ((x - a) / (b - a)) * (q - p);\n}\n\nconst identity = (t: number) => t;\nconst curve = () => identity;\nexport const Easing = {\n linear: identity,\n ease: identity,\n quad: identity,\n cubic: identity,\n sin: identity,\n circle: identity,\n exp: identity,\n bounce: identity,\n poly: curve,\n elastic: curve,\n back: curve,\n bezier: curve,\n bezierFn: curve,\n in: (easing: (t: number) => number) => easing,\n out: (easing: (t: number) => number) => easing,\n inOut: (easing: (t: number) => number) => easing,\n};\n\nexport const ReduceMotion = { System: 'system', Always: 'always', Never: 'never' } as const;\n\nexport function runOnJS<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R {\n return fn;\n}\n\nexport function runOnUI<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R {\n return fn;\n}\n"]}
1
+ {"version":3,"file":"reanimated.js","sourceRoot":"","sources":["../../src/stand-ins/reanimated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKlE,MAAM,MAAM,GAAG,CAAI,EAAK,EAAE,QAAc,EAAK,EAAE;IAC7C,QAAQ,EAAE,CAAC,IAA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time: a browser build and a test, which\n * resolve the library here (`ngNativeWeb()` and `@ng-native/testing`).\n *\n * An animation finishes the moment it is assigned: `withTiming(100)` is `100`, and its callback\n * is called with `true` at once, so the value is where the animation ends and what ends it runs.\n * `interpolate` and `Extrapolation` are the library's own arithmetic; `Easing` curves are the\n * identity, since nothing is ever between an animation's ends.\n *\n * ponytail: the functions apps call from components, not the React hooks; add one when an app\n * imports it.\n */\nexport { sharedValue as makeMutable } from '../reanimated-web.ts';\nexport type { MutableValue as SharedValue } from '../worklets.ts';\n\ntype Done = ((finished?: boolean) => void) | undefined;\n\nconst settle = <T>(to: T, callback: Done): T => {\n callback?.(true);\n return to;\n};\n\nexport function withTiming<T>(to: T, _config?: object, callback?: Done): T {\n return settle(to, callback);\n}\n\nexport function withSpring<T>(to: T, _config?: object, callback?: Done): T {\n return settle(to, callback);\n}\n\nexport function withDecay(_config: { velocity?: number }, callback?: Done): number {\n return settle(0, callback);\n}\n\nexport function withDelay<T>(_delay: number, animation: T): T {\n return animation;\n}\n\nexport function withSequence<T>(...animations: T[]): T {\n return animations[animations.length - 1]!;\n}\n\nexport function withRepeat<T>(\n animation: T,\n _times?: number,\n _reverse?: boolean,\n callback?: Done,\n): T {\n return settle(animation, callback);\n}\n\nexport function cancelAnimation(_value: unknown): void {}\n\n/** What `@ng-native/components/reanimated` itself starts a style with; nothing runs it here. */\nexport function startMapper(_worklet: () => void, _inputs?: unknown[]): number {\n return 0;\n}\n\nexport function stopMapper(_id: number): void {}\n\n/**\n * What `@ng-native/components/reanimated` asks before it reads the values Reanimated's views\n * settled on. Off: with no UI thread there are none to read.\n */\nexport function getStaticFeatureFlag(_name: string): boolean {\n return false;\n}\n\nexport const Extrapolation = { IDENTITY: 'identity', CLAMP: 'clamp', EXTEND: 'extend' } as const;\ntype Extrapolate = (typeof Extrapolation)[keyof typeof Extrapolation];\n\n/** Past an end of the input range: the end's output, the input itself, or `undefined` to extend. */\nfunction beyond(x: number, output: number, how: Extrapolate | undefined): number | undefined {\n if (how === 'clamp') return output;\n if (how === 'identity') return x;\n return undefined;\n}\n\nexport function interpolate(\n x: number,\n input: readonly number[],\n output: readonly number[],\n extrapolate?: Extrapolate | { extrapolateLeft?: Extrapolate; extrapolateRight?: Extrapolate },\n): number {\n const left = typeof extrapolate === 'object' ? extrapolate.extrapolateLeft : extrapolate;\n const right = typeof extrapolate === 'object' ? extrapolate.extrapolateRight : extrapolate;\n const last = input.length - 1;\n const outside =\n x < input[0]!\n ? beyond(x, output[0]!, left)\n : x > input[last]!\n ? beyond(x, output[last]!, right)\n : undefined;\n if (outside !== undefined) return outside;\n let i = 0;\n while (i < last - 1 && x > input[i + 1]!) i++;\n const [a, b, p, q] = [input[i]!, input[i + 1]!, output[i]!, output[i + 1]!];\n return b === a ? p : p + ((x - a) / (b - a)) * (q - p);\n}\n\nconst identity = (t: number) => t;\nconst curve = () => identity;\nexport const Easing = {\n linear: identity,\n ease: identity,\n quad: identity,\n cubic: identity,\n sin: identity,\n circle: identity,\n exp: identity,\n bounce: identity,\n poly: curve,\n elastic: curve,\n back: curve,\n bezier: curve,\n bezierFn: curve,\n in: (easing: (t: number) => number) => easing,\n out: (easing: (t: number) => number) => easing,\n inOut: (easing: (t: number) => number) => easing,\n};\n\nexport const ReduceMotion = { System: 'system', Always: 'always', Never: 'never' } as const;\n\nexport function runOnJS<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R {\n return fn;\n}\n\nexport function runOnUI<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R {\n return fn;\n}\n"]}
@@ -1,9 +1,13 @@
1
1
  import { type Signal } from '@angular/core';
2
2
  import { type HostEngine, type HostNode, type StaticTransform } from '@ng-native/fabric';
3
+ import type { VirtualListSticky } from './virtual-list-sticky.ts';
3
4
  /** What `StickyRows` needs of the list whose rows it pins. */
4
5
  export interface StickyRowsList {
5
6
  /** The sticky rows' indices, as `stickyIndices` gives them. */
6
7
  readonly indices: Signal<readonly number[]>;
8
+ /** The rows' levels, when a directive on the list gives them, read from the items. */
9
+ readonly levels: VirtualListSticky | null;
10
+ readonly items: Signal<readonly unknown[]>;
7
11
  /** Whether the list header is pinned too, as `stickyHeader` says. */
8
12
  readonly header: Signal<boolean>;
9
13
  readonly headerHeight: Signal<number>;
@@ -25,34 +29,59 @@ interface Row {
25
29
  readonly index: number;
26
30
  readonly parked?: boolean;
27
31
  }
32
+ /** A sticky row: how deep it is, the rows it pins under, and the row that pushes it off. */
33
+ interface StickyRow {
34
+ /** 0 for the outermost. The rows of `stickyIndices` are all at 0. */
35
+ readonly level: number;
36
+ /** The nearest row before it of each level further out, outermost first. */
37
+ readonly above: readonly number[];
38
+ /** The next row at its level or further out, if there is one. */
39
+ next: number | undefined;
40
+ }
28
41
  /**
29
- * `<virtual-list>`'s sticky rows: which one holds the leading edge, the style that pins it, the
42
+ * `<virtual-list>`'s sticky rows: which hold the leading edge, the style that pins each, the
30
43
  * header's pinned style, and, where the host moves views by the scroll on the native side, what
31
44
  * native is moving. The list's own share of `stickyIndices` and `stickyHeader`, as `StickyHeaders`
32
45
  * is `<scroll-view>`'s.
33
46
  *
47
+ * Rows pin at levels, when `virtualListStickyLevel` gives them: a row holds the edge under the
48
+ * rows of the levels further out than its own, and the next row at its level or further out pushes
49
+ * it off. Without levels every sticky row is at level 0, each pushed off by the next.
50
+ *
34
51
  * Pinning is not native: RN's `ScrollView.js` translates a sticky child against the scroll offset
35
52
  * in JavaScript, and a row here follows the offset the same way while it is the current one, by
36
53
  * its `top` when absolutely positioned and by a transform when in flow. Where native can move a
37
- * view by the scroll, each sticky row instead stays at its own place in the list and native
38
- * translates it on every frame the list scrolls, as RN's `ScrollViewStickyHeader` does; a
39
- * translate committed from each scroll event lands a frame or more late, and on a fast fling the
40
- * row shudders and comes away from the edge.
54
+ * view by the scroll, each sticky row, and a pinned header, instead stays at its own place in the
55
+ * list and native translates it on every frame the list scrolls, as RN's `ScrollViewStickyHeader`
56
+ * does; a translate committed from each scroll event lands a frame or more late, and on a fast
57
+ * fling the row shudders and comes away from the edge.
41
58
  */
42
59
  export declare class StickyRows {
43
- /** Whether native moves sticky rows. */
60
+ /** Whether native moves sticky rows and the pinned header. */
44
61
  readonly native: boolean;
45
- /** The leading edge of the viewport in content space, kept only while anything is pinned. */
46
- private readonly leading;
62
+ /**
63
+ * Where the scroll view is along its axis, header and all: 0 until native says otherwise, since
64
+ * Android sends no scroll event until the list moves.
65
+ */
66
+ private readonly along;
67
+ /** The leading edge of the viewport in content space, past the header at its current size. */
47
68
  readonly offset: Signal<number>;
48
69
  private readonly engine;
49
70
  private readonly node;
50
71
  private readonly list;
51
- /** The offset once scrolling pauses, which the settled translate of a native-moved row is from. */
72
+ /**
73
+ * Where the scroll view is once scrolling pauses, header and all, which the settled translate of
74
+ * a native-moved row is from.
75
+ */
52
76
  private readonly settled;
53
77
  private settleTimer;
54
78
  /** What native is moving, by row view, with the transform kept beside the translate. */
55
79
  private readonly drives;
80
+ /**
81
+ * What native moves the header by, once it has been pinned. Kept, moving it nowhere, when it no
82
+ * longer is: native goes on drawing a translate it set after its drive is gone.
83
+ */
84
+ private headerDrive;
56
85
  /** The list scrolled itself, and native has not drawn its sticky rows there yet. */
57
86
  private jumped;
58
87
  /** Native has reported reaching the target, so this pass's drives are the last to need telling. */
@@ -65,6 +94,10 @@ export declare class StickyRows {
65
94
  private reported;
66
95
  /** Where native's latest event of all said it was, header and all. */
67
96
  private nativeAt;
97
+ /** The axis the list scrolled along when native said so, until then none. */
98
+ private nativeAxis;
99
+ /** No scroll event has come for `STICKY_SETTLE_MS`, so none is on its way to draw a new graph. */
100
+ private resting;
68
101
  /**
69
102
  * Scroll end events still to come, one for each jump that moved native, as iOS sends one. Kept
70
103
  * across jumps: one that landed has its end still to come, and must not be taken for the next's.
@@ -76,16 +109,31 @@ export declare class StickyRows {
76
109
  constructor(engine: HostEngine, node: HostNode, list: StickyRowsList);
77
110
  /** Whether the scroll offset is needed as a signal, which only pinning needs. */
78
111
  private readonly pinning;
79
- /** Each sticky row, and the one after it, which pushes it off. */
80
- readonly next: Signal<Map<number, number>>;
81
112
  /**
82
- * The sticky row currently holding the leading edge: the last one at or before the offset.
83
- * Null when the list has scrolled back above the first of them.
113
+ * 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. Rows that size themselves take level 0 alone: where a
115
+ * deeper row pins depends on the heights of the rows over it. A sticky index given for rows not
116
+ * there yet pins nothing and pushes nothing off until its row arrives.
117
+ */
118
+ private readonly levels;
119
+ /** Each sticky row, with the rows it pins under and the one that pushes it off. */
120
+ readonly rows: Signal<Map<number, StickyRow>>;
121
+ /**
122
+ * For each sticky row in list order, the least offset that reaches it or a row after it. Where a
123
+ * row starts to hold never comes before where the row before it does, unless a negative `rowGap`
124
+ * overlaps the rows, and this stays in order either way, so `pinned` can halve over it.
84
125
  */
85
- readonly pinned: Signal<number | null>;
126
+ private readonly reach;
127
+ /**
128
+ * The sticky rows currently holding the leading edge, outermost first: the last one the offset
129
+ * has reached, under the rows it pins under. Empty when the list has scrolled back above the
130
+ * first of them.
131
+ */
132
+ readonly pinned: Signal<readonly number[]>;
86
133
  /**
87
134
  * The header's translation while it is pinned: the scroll position, held back at zero by an
88
- * overscroll and at the first sticky row, which pushes it off.
135
+ * overscroll and at the first sticky row, which pushes it off. Where native moves it, the
136
+ * translate native had reached when scrolling paused, as for a sticky row.
89
137
  */
90
138
  readonly headerStyle: Signal<{
91
139
  transform: string;
@@ -97,8 +145,16 @@ export declare class StickyRows {
97
145
  zIndex: number;
98
146
  transform?: undefined;
99
147
  } | undefined>;
100
- /** A pinned row in flow, moved from where flow put it to the leading edge by a transform. */
101
- flowStyle(at: number): Record<string, unknown>;
148
+ /**
149
+ * The pinned row `index` in flow, moved by a transform from `at`, where flow put it, to the leading
150
+ * edge, until the next sticky row reaches it there and pushes it off.
151
+ */
152
+ flowStyle(index: number, at: number): Record<string, unknown>;
153
+ /**
154
+ * A pinned row placed by its `top`: under the rows it pins under, until the next row at its
155
+ * level or further out reaches it there and pushes it off.
156
+ */
157
+ slotStyle(index: number): Record<string, unknown>;
102
158
  /**
103
159
  * A sticky row native moves: at its own place, with the translate native had reached when
104
160
  * scrolling paused, so the props agree with what is on screen.
@@ -112,8 +168,8 @@ export declare class StickyRows {
112
168
  recyclingType(index: number, kind: unknown): unknown;
113
169
  /** Whether a recycling type is a sticky row's. */
114
170
  isType(type: unknown): boolean;
115
- /** The list scrolled, to `offset` in content space and `along` in the scroll view. */
116
- scrolled(offset: number, along: number): void;
171
+ /** The list scrolled, to `along` in the scroll view. */
172
+ scrolled(along: number): void;
117
173
  /** The list is scrolling itself, to `to` in the scroll view, where native has not drawn yet. */
118
174
  jumping(to: number, animated: boolean): void;
119
175
  /** The user took the scroll over: native's own events move the rows from here. */
@@ -125,17 +181,56 @@ export declare class StickyRows {
125
181
  */
126
182
  rested(): void;
127
183
  /**
128
- * Hand each rendered sticky row's view to native to move, and let go of the rest. `views` are
129
- * the rendered rows' views in the same order as `rows`. Each is only asked for where there is a
130
- * drive to make or let go.
184
+ * Hand each rendered sticky row's view to native to move, and let go of the rest, and the
185
+ * header's view, `header`, while it is pinned. `views` are the rendered rows' views in the same
186
+ * order as `rows`. Each is only asked for where there is a drive to make or let go.
187
+ */
188
+ drive(rows: () => readonly Row[], views: () => readonly HostNode[], header: () => HostNode): void;
189
+ /**
190
+ * Hand the header to native to move while it is pinned, by the scroll view's offset until the
191
+ * first sticky row pushes it off. Unpinned, it is moved nowhere.
192
+ */
193
+ private driveHeader;
194
+ /**
195
+ * Where native is told the scroll view is for the header's drive, `pinned` and moved by the range
196
+ * `moved`. Pinned, let go, or moved by a new range at rest, native has no new scroll event to draw
197
+ * it from: it is told where it last said it was. Mid-scroll the next event draws it, and what
198
+ * native last said trails it, and what it said along the other axis says nothing of `axis`. After a
199
+ * jump, `from`, where the list scrolled itself.
131
200
  */
132
- drive(rows: () => readonly Row[], views: () => readonly HostNode[]): void;
201
+ private headerFrom;
202
+ /**
203
+ * Where native is told the scroll view is for a drive made again along `axis`, as for a flip. The
204
+ * one it replaces may have been the last to read the offset, so the new one starts from nothing,
205
+ * and at rest no scroll event comes to draw it: it is told where native last said it was, unless
206
+ * that was along the other axis. After a jump, `from`.
207
+ */
208
+ private remadeFrom;
209
+ /** How native moves the pinned header. A first sticky row at the very top holds it in place. */
210
+ private headerRange;
211
+ /** How far the header moves before the first sticky row pushes it off: to that row's top. */
212
+ private headerLimit;
133
213
  destroy(): void;
134
- /** Where a sticky row stops, pushed off by the next: that row's top, less this row's size. */
214
+ /** The size of the rows a sticky row pins under, which is how far from the edge it holds. */
215
+ private above;
216
+ /**
217
+ * A deeper row is drawn under the rows it pins under, and every sticky row over the rest. See
218
+ * `FRONT`. Without levels a sticky row's zIndex is 1, as it was before there were any.
219
+ */
220
+ private zIndexOf;
221
+ /** The offset a sticky row starts to hold from: where its top meets the rows it pins under. */
222
+ private startOf;
223
+ /**
224
+ * The offset a sticky row stops holding at, pushed off by the next: where that row's top meets
225
+ * this row's far edge.
226
+ */
135
227
  private stopOf;
136
228
  /**
137
229
  * How native moves a rendered row, or null when it does not: along the scroll view's own
138
- * offset, which counts the header, from the row's top until the next sticky row pushes it off.
230
+ * offset, which counts the header, from where the row meets the rows it pins under until the
231
+ * next sticky row pushes it off. A row the next one follows with no space between them holds
232
+ * nowhere, so native moves it nowhere: it is not let go, since native keeps the translate it
233
+ * had moved a row by.
139
234
  */
140
235
  private driveOf;
141
236
  }