@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
package/dist/sidebar.d.ts
CHANGED
|
@@ -15,8 +15,10 @@ export interface SidebarRow {
|
|
|
15
15
|
* `[(collapsed)]` follows the title bar's sidebar button, View > Show Sidebar and a drag that shuts
|
|
16
16
|
* it, on macOS, and the sidebar button and swipe of a UISplitViewController on an iPad. `minWidth`
|
|
17
17
|
* and `maxWidth` bound a drag of the divider on macOS and the sidebar column's width on an iPad,
|
|
18
|
-
* and `autosave` names where macOS keeps the width and collapsed state across launches.
|
|
19
|
-
* the
|
|
18
|
+
* and `autosave` names where macOS keeps the width and collapsed state across launches.
|
|
19
|
+
* `[toggleButton]="false"` leaves the sidebar button out of the window's toolbar on macOS and its
|
|
20
|
+
* header bar on Linux, for a sidebar that draws its own. Drawn, a collapsed sidebar is hidden, the
|
|
21
|
+
* widths bound its style, and `autosave` and `toggleButton` are ignored.
|
|
20
22
|
*/
|
|
21
23
|
export declare class Sidebar extends ViewBase implements OnInit, OnDestroy {
|
|
22
24
|
protected readonly split: SplitView | null;
|
|
@@ -30,6 +32,12 @@ export declare class Sidebar extends ViewBase implements OnInit, OnDestroy {
|
|
|
30
32
|
readonly maxWidth: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
31
33
|
/** macOS: the name the width and collapsed state are kept under across launches. */
|
|
32
34
|
readonly autosave: import("@angular/core").InputSignal<string | undefined>;
|
|
35
|
+
/**
|
|
36
|
+
* macOS and Linux: whether the window's toolbar or header bar shows its sidebar button. Turn it
|
|
37
|
+
* off for a sidebar that draws a button of its own; View > Show Sidebar, its shortcut and
|
|
38
|
+
* `[(collapsed)]` still work.
|
|
39
|
+
*/
|
|
40
|
+
readonly toggleButton: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
33
41
|
private readonly rows;
|
|
34
42
|
private stopCollapsed;
|
|
35
43
|
/** Drawn, hidden while collapsed beside the content, or while a stack shows the content. */
|
|
@@ -43,5 +51,5 @@ export declare class Sidebar extends ViewBase implements OnInit, OnDestroy {
|
|
|
43
51
|
/** A row was chosen: the sidebar selects one row at a time, so every other one is deselected. */
|
|
44
52
|
chose(row: SidebarRow): void;
|
|
45
53
|
static ɵfac: i0.ɵɵFactoryDeclaration<Sidebar, never>;
|
|
46
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<Sidebar, "sidebar", never, { "collapsed": { "alias": "collapsed"; "required": false; "isSignal": true; }; "minWidth": { "alias": "minWidth"; "required": false; "isSignal": true; }; "maxWidth": { "alias": "maxWidth"; "required": false; "isSignal": true; }; "autosave": { "alias": "autosave"; "required": false; "isSignal": true; }; }, { "collapsed": "collapsedChange"; }, never, ["*"], true, never>;
|
|
54
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Sidebar, "sidebar", never, { "collapsed": { "alias": "collapsed"; "required": false; "isSignal": true; }; "minWidth": { "alias": "minWidth"; "required": false; "isSignal": true; }; "maxWidth": { "alias": "maxWidth"; "required": false; "isSignal": true; }; "autosave": { "alias": "autosave"; "required": false; "isSignal": true; }; "toggleButton": { "alias": "toggleButton"; "required": false; "isSignal": true; }; }, { "collapsed": "collapsedChange"; }, never, ["*"], true, never>;
|
|
47
55
|
}
|
package/dist/sidebar.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Component, computed, inject, input, model, } from '@angular/core';
|
|
1
|
+
import { Component, booleanAttribute, computed, forwardRef, inject, input, model, } from '@angular/core';
|
|
2
2
|
import { nativeSplitViews } from '@ng-native/device';
|
|
3
3
|
import { registerViewName } from '@ng-native/fabric';
|
|
4
4
|
import { optionalNumber } from "./transforms.js";
|
|
5
|
-
import { SplitView, hostDraws } from "./split-view.js";
|
|
5
|
+
import { SIDEBAR, SplitView, hostDraws } from "./split-view.js";
|
|
6
6
|
import { ViewBase } from "./view-base.js";
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
/**
|
|
@@ -27,8 +27,10 @@ const DRAWN_WIDTH = 240;
|
|
|
27
27
|
* `[(collapsed)]` follows the title bar's sidebar button, View > Show Sidebar and a drag that shuts
|
|
28
28
|
* it, on macOS, and the sidebar button and swipe of a UISplitViewController on an iPad. `minWidth`
|
|
29
29
|
* and `maxWidth` bound a drag of the divider on macOS and the sidebar column's width on an iPad,
|
|
30
|
-
* and `autosave` names where macOS keeps the width and collapsed state across launches.
|
|
31
|
-
* the
|
|
30
|
+
* and `autosave` names where macOS keeps the width and collapsed state across launches.
|
|
31
|
+
* `[toggleButton]="false"` leaves the sidebar button out of the window's toolbar on macOS and its
|
|
32
|
+
* header bar on Linux, for a sidebar that draws its own. Drawn, a collapsed sidebar is hidden, the
|
|
33
|
+
* widths bound its style, and `autosave` and `toggleButton` are ignored.
|
|
32
34
|
*/
|
|
33
35
|
export class Sidebar extends ViewBase {
|
|
34
36
|
split = inject(SplitView, { optional: true });
|
|
@@ -44,6 +46,12 @@ export class Sidebar extends ViewBase {
|
|
|
44
46
|
/** macOS: the name the width and collapsed state are kept under across launches. */
|
|
45
47
|
autosave = input(/* @ts-ignore */
|
|
46
48
|
...(ngDevMode ? [undefined, { debugName: "autosave" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/**
|
|
50
|
+
* macOS and Linux: whether the window's toolbar or header bar shows its sidebar button. Turn it
|
|
51
|
+
* off for a sidebar that draws a button of its own; View > Show Sidebar, its shortcut and
|
|
52
|
+
* `[(collapsed)]` still work.
|
|
53
|
+
*/
|
|
54
|
+
toggleButton = input(true, { ...(ngDevMode ? { debugName: "toggleButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
47
55
|
rows = new Set();
|
|
48
56
|
stopCollapsed = null;
|
|
49
57
|
/** Drawn, hidden while collapsed beside the content, or while a stack shows the content. */
|
|
@@ -86,19 +94,21 @@ export class Sidebar extends ViewBase {
|
|
|
86
94
|
other.deselect();
|
|
87
95
|
this.split?.showContent();
|
|
88
96
|
}
|
|
89
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
90
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.
|
|
97
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: Sidebar, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
98
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.3.0", type: Sidebar, isStandalone: true, selector: "sidebar", inputs: { collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, autosave: { classPropertyName: "autosave", publicName: "autosave", isSignal: true, isRequired: false, transformFunction: null }, toggleButton: { classPropertyName: "toggleButton", publicName: "toggleButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { collapsed: "collapsedChange" }, host: { properties: { "collapsed": "native ? collapsed() : undefined", "paneMinWidth": "native ? minWidth() : undefined", "paneMaxWidth": "native ? maxWidth() : undefined", "autosaveName": "native ? autosave() : undefined", "toggleButton": "native ? toggleButton() : undefined", "style.display": "hidden() ? 'none' : undefined", "style.width": "drawnWidth()", "style.minWidth": "native ? undefined : minWidth()", "style.maxWidth": "native ? undefined : maxWidth()", "style.flex": "split?.stacked() ? 1 : undefined" } }, providers: [{ provide: SIDEBAR, useExisting: forwardRef(() => Sidebar) }], usesInheritance: true, ngImport: i0, template: '<ng-content />', isInline: true });
|
|
91
99
|
}
|
|
92
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: Sidebar, decorators: [{
|
|
93
101
|
type: Component,
|
|
94
102
|
args: [{
|
|
95
103
|
selector: 'sidebar',
|
|
104
|
+
providers: [{ provide: SIDEBAR, useExisting: forwardRef(() => Sidebar) }],
|
|
96
105
|
template: '<ng-content />',
|
|
97
106
|
host: {
|
|
98
107
|
'[collapsed]': 'native ? collapsed() : undefined',
|
|
99
108
|
'[paneMinWidth]': 'native ? minWidth() : undefined',
|
|
100
109
|
'[paneMaxWidth]': 'native ? maxWidth() : undefined',
|
|
101
110
|
'[autosaveName]': 'native ? autosave() : undefined',
|
|
111
|
+
'[toggleButton]': 'native ? toggleButton() : undefined',
|
|
102
112
|
'[style.display]': "hidden() ? 'none' : undefined",
|
|
103
113
|
'[style.width]': 'drawnWidth()',
|
|
104
114
|
'[style.minWidth]': 'native ? undefined : minWidth()',
|
|
@@ -106,5 +116,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
|
|
|
106
116
|
'[style.flex]': 'split?.stacked() ? 1 : undefined',
|
|
107
117
|
},
|
|
108
118
|
}]
|
|
109
|
-
}], propDecorators: { collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], autosave: [{ type: i0.Input, args: [{ isSignal: true, alias: "autosave", required: false }] }] } });
|
|
119
|
+
}], propDecorators: { collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], autosave: [{ type: i0.Input, args: [{ isSignal: true, alias: "autosave", required: false }] }], toggleButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleButton", required: false }] }] } });
|
|
110
120
|
//# sourceMappingURL=sidebar.js.map
|
package/dist/sidebar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.js","sourceRoot":"","sources":["../src/sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,MAAM,EACN,KAAK,EACL,KAAK,GAGN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar.js","sourceRoot":"","sources":["../src/sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,MAAM,EACN,KAAK,EACL,KAAK,GAGN,MAAM,eAAe,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,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAED,iGAAiG;IACjG,KAAK,CAAC,GAAe;QACnB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,IAAI;YAAE,IAAI,KAAK,KAAK,GAAG;gBAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnE,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC;IAC5B,CAAC;uGA/DU,OAAO;2FAAP,OAAO,ywCAfP,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,iDAC/D,gBAAgB;;2FAcf,OAAO;kBAjBnB,SAAS;mBAAC;oBACT,QAAQ,EAAE,SAAS;oBACnB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC;oBACzE,QAAQ,EAAE,gBAAgB;oBAC1B,IAAI,EAAE;wBACJ,aAAa,EAAE,kCAAkC;wBACjD,gBAAgB,EAAE,iCAAiC;wBACnD,gBAAgB,EAAE,iCAAiC;wBACnD,gBAAgB,EAAE,iCAAiC;wBACnD,gBAAgB,EAAE,qCAAqC;wBACvD,iBAAiB,EAAE,+BAA+B;wBAClD,eAAe,EAAE,cAAc;wBAC/B,kBAAkB,EAAE,iCAAiC;wBACrD,kBAAkB,EAAE,iCAAiC;wBACrD,cAAc,EAAE,kCAAkC;qBACnD;iBACF","sourcesContent":["import {\n Component,\n booleanAttribute,\n computed,\n forwardRef,\n inject,\n input,\n model,\n type OnDestroy,\n type OnInit,\n} from '@angular/core';\nimport { nativeSplitViews } from '@ng-native/device';\nimport { registerViewName } from '@ng-native/fabric';\nimport { optionalNumber } from './transforms.ts';\nimport { SIDEBAR, SplitView, hostDraws } from './split-view.ts';\nimport { ViewBase } from './view-base.ts';\n\n/**\n * On macOS the sidebar pane of the desktop host's split view, and on an iPad the sidebar column of\n * a UISplitViewController: the host owns its width, and Yoga gets the pane's frame back from it.\n * Elsewhere a view, drawn here.\n */\nregisterViewName('sidebar', {\n get ios() {\n return nativeSplitViews() ? 'NgNativeSidebar' : 'View';\n },\n android: 'View',\n macos: 'NgNativeSidebar',\n});\n\n/** The width a drawn sidebar starts at, in points, where nothing styles one. */\nconst DRAWN_WIDTH = 240;\n\n/** A selectable row of the sidebar, as the sidebar sees it. */\nexport interface SidebarRow {\n /** Deselect, because another row of the same sidebar was chosen. */\n deselect(): void;\n}\n\n/**\n * The sidebar of a `<split-view>`. Its `<sidebar-section>`s and `<sidebar-item>`s are a source\n * list on macOS, an NSOutlineView; anything else in it (a search field, a footer) is drawn and\n * styled by CSS on every OS.\n *\n * `[(collapsed)]` follows the title bar's sidebar button, View > Show Sidebar and a drag that shuts\n * it, on macOS, and the sidebar button and swipe of a UISplitViewController on an iPad. `minWidth`\n * and `maxWidth` bound a drag of the divider on macOS and the sidebar column's width on an iPad,\n * and `autosave` names where macOS keeps the width and collapsed state across launches.\n * `[toggleButton]=\"false\"` leaves the sidebar button out of the window's toolbar on macOS and its\n * header bar on Linux, for a sidebar that draws its own. Drawn, a collapsed sidebar is hidden, the\n * widths bound its style, and `autosave` and `toggleButton` are ignored.\n */\n@Component({\n selector: 'sidebar',\n providers: [{ provide: SIDEBAR, useExisting: forwardRef(() => Sidebar) }],\n template: '<ng-content />',\n host: {\n '[collapsed]': 'native ? collapsed() : undefined',\n '[paneMinWidth]': 'native ? minWidth() : undefined',\n '[paneMaxWidth]': 'native ? maxWidth() : undefined',\n '[autosaveName]': 'native ? autosave() : undefined',\n '[toggleButton]': 'native ? toggleButton() : undefined',\n '[style.display]': \"hidden() ? 'none' : undefined\",\n '[style.width]': 'drawnWidth()',\n '[style.minWidth]': 'native ? undefined : minWidth()',\n '[style.maxWidth]': 'native ? undefined : maxWidth()',\n '[style.flex]': 'split?.stacked() ? 1 : undefined',\n },\n})\nexport class Sidebar extends ViewBase implements OnInit, OnDestroy {\n protected readonly split = inject(SplitView, { optional: true });\n /** Whether the host draws this sidebar: on macOS, and on an iPad. */\n protected readonly native = hostDraws('sidebar');\n\n /** Whether the sidebar is shut. Kept in step with the user's own toggles on macOS. */\n readonly collapsed = model(false);\n /** The narrowest a drag of the divider leaves it, in points. */\n readonly minWidth = input(undefined, { transform: optionalNumber });\n /** The widest a drag of the divider leaves it, in points. */\n readonly maxWidth = input(undefined, { transform: optionalNumber });\n /** macOS: the name the width and collapsed state are kept under across launches. */\n readonly autosave = input<string>();\n /**\n * macOS and Linux: whether the window's toolbar or header bar shows its sidebar button. Turn it\n * off for a sidebar that draws a button of its own; View > Show Sidebar, its shortcut and\n * `[(collapsed)]` still work.\n */\n readonly toggleButton = input(true, { transform: booleanAttribute });\n\n private readonly rows = new Set<SidebarRow>();\n private stopCollapsed: (() => void) | null = null;\n\n /** Drawn, hidden while collapsed beside the content, or while a stack shows the content. */\n protected readonly hidden = computed(() => {\n if (this.native) return false;\n if (this.split?.stacked()) return this.split.showing() === 'content';\n return this.collapsed();\n });\n\n /** Drawn beside the content, a column of a set width that the app's style can override. */\n protected readonly drawnWidth = computed(() =>\n this.native || this.split?.stacked() ? undefined : DRAWN_WIDTH,\n );\n\n override ngOnInit(): void {\n super.ngOnInit();\n if (!this.native || this.stopCollapsed) return;\n this.stopCollapsed = this.engine.setEventListener(this.node, 'topSidebarCollapse', (event) => {\n const { target, nativeEvent } = event as {\n target?: unknown;\n nativeEvent?: { collapsed?: unknown };\n };\n // A sidebar inside this one's content reports its own.\n if (target !== this.node) return;\n if (typeof nativeEvent?.collapsed === 'boolean') this.collapsed.set(nativeEvent.collapsed);\n });\n }\n\n ngOnDestroy(): void {\n this.stopCollapsed?.();\n }\n\n /** Called by a row of this sidebar as it is created; answers the call that takes it away. */\n addRow(row: SidebarRow): () => void {\n this.rows.add(row);\n return () => this.rows.delete(row);\n }\n\n /** A row was chosen: the sidebar selects one row at a time, so every other one is deselected. */\n chose(row: SidebarRow): void {\n for (const other of this.rows) if (other !== row) other.deselect();\n this.split?.showContent();\n }\n}\n"]}
|
package/dist/split-view.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { type Signal } from '@angular/core';
|
|
1
|
+
import { InjectionToken, type Signal } from '@angular/core';
|
|
2
2
|
import { ViewBase } from './view-base.ts';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
+
/** A `<sidebar>`, which provides itself as this so a split view can find it among its children. */
|
|
5
|
+
export declare const SIDEBAR: InjectionToken<unknown>;
|
|
4
6
|
/** Whether the host draws `element`, rather than a view drawn here. */
|
|
5
7
|
export declare function hostDraws(element: string): boolean;
|
|
6
8
|
/**
|
|
@@ -10,6 +12,12 @@ export declare function hostDraws(element: string): boolean;
|
|
|
10
12
|
export declare const ANDROID_EXPANDED_WIDTH = 840;
|
|
11
13
|
/** Which pane a split view shows: both side by side, or one of them as a stack's top. */
|
|
12
14
|
export type SplitViewShowing = 'both' | 'sidebar' | 'content';
|
|
15
|
+
/**
|
|
16
|
+
* How the desktop hosts draw a split view's content pane: `plain`, filling the space beside the
|
|
17
|
+
* sidebar, or `inset`, a card with rounded corners inset from its space's edges, on the sidebar's
|
|
18
|
+
* backdrop, which runs under the toolbar or header bar.
|
|
19
|
+
*/
|
|
20
|
+
export type SplitViewContentStyle = 'plain' | 'inset';
|
|
13
21
|
/** The content pane: everything in a `<split-view>` but its `<sidebar>`. */
|
|
14
22
|
export declare class SplitViewContent extends ViewBase {
|
|
15
23
|
protected readonly split: SplitView;
|
|
@@ -36,16 +44,29 @@ export declare class SplitViewContent extends ViewBase {
|
|
|
36
44
|
* root is the sidebar. On Android the columns wait for Material's expanded width,
|
|
37
45
|
* `ANDROID_EXPANDED_WIDTH`, as its list-detail layout does. There, choosing an item shows the content, and `showSidebar()` (or
|
|
38
46
|
* Android's back button) returns to the sidebar.
|
|
47
|
+
*
|
|
48
|
+
* `contentStyle="inset"` draws the content pane on macOS and Linux as a card with rounded corners,
|
|
49
|
+
* inset from its space's edges on the sidebar's backdrop, which runs under the toolbar. The pane's
|
|
50
|
+
* size, and so its layout, is the card's. iOS and Android ignore it.
|
|
39
51
|
*/
|
|
40
52
|
export declare class SplitView extends ViewBase {
|
|
53
|
+
/**
|
|
54
|
+
* macOS and Linux: the content pane `plain`, beside the sidebar, or `inset`, a rounded card on
|
|
55
|
+
* the sidebar's backdrop. iOS and Android ignore it.
|
|
56
|
+
*/
|
|
57
|
+
readonly contentStyle: import("@angular/core").InputSignal<SplitViewContentStyle>;
|
|
41
58
|
/** Whether this split view is drawn from views here, rather than by the host. */
|
|
42
59
|
readonly drawn: boolean;
|
|
43
60
|
/** Whether the host is iOS's, whose split view controller pushes and pops the content. */
|
|
44
61
|
private readonly stacksNatively;
|
|
62
|
+
/** Whether the desktop host draws this split view: on macOS and Linux. */
|
|
63
|
+
readonly onDesktop: boolean;
|
|
45
64
|
private readonly screen;
|
|
46
65
|
/** Too narrow for the panes side by side: below Material's expanded width on Android. */
|
|
47
66
|
private readonly compact;
|
|
48
67
|
private readonly top;
|
|
68
|
+
/** Its `<sidebar>`, a child of its own, as the sidebar pane takes only those. */
|
|
69
|
+
private readonly sidebar;
|
|
49
70
|
/** Whether the panes are a stack, one at a time: at a compact width, where it is drawn. */
|
|
50
71
|
readonly stacked: Signal<boolean>;
|
|
51
72
|
/** Which pane is showing. Both, unless the split view is a stack. */
|
|
@@ -59,5 +80,5 @@ export declare class SplitView extends ViewBase {
|
|
|
59
80
|
*/
|
|
60
81
|
showSidebar(): boolean;
|
|
61
82
|
static ɵfac: i0.ɵɵFactoryDeclaration<SplitView, never>;
|
|
62
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SplitView, "split-view", never, {}, {},
|
|
83
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SplitView, "split-view", never, { "contentStyle": { "alias": "contentStyle"; "required": false; "isSignal": true; }; }, {}, ["sidebar"], ["sidebar", "*"], true, never>;
|
|
63
84
|
}
|
package/dist/split-view.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, DestroyRef, computed, inject, signal } from '@angular/core';
|
|
1
|
+
import { Component, DestroyRef, InjectionToken, afterNextRender, computed, contentChild, inject, input, signal, } from '@angular/core';
|
|
2
2
|
import { HardwareBack, Screen, nativeSplitViews } from '@ng-native/device';
|
|
3
3
|
import { nativePlatform, registerViewName, registeredViewName } from '@ng-native/fabric';
|
|
4
4
|
import { ViewBase } from "./view-base.js";
|
|
@@ -23,6 +23,8 @@ registerViewName('split-view-content', {
|
|
|
23
23
|
android: 'View',
|
|
24
24
|
macos: 'NgNativeSplitContent',
|
|
25
25
|
});
|
|
26
|
+
/** A `<sidebar>`, which provides itself as this so a split view can find it among its children. */
|
|
27
|
+
export const SIDEBAR = new InjectionToken('angular-native.sidebar');
|
|
26
28
|
/** Whether the host draws `element`, rather than a view drawn here. */
|
|
27
29
|
export function hostDraws(element) {
|
|
28
30
|
return registeredViewName(element) !== 'View';
|
|
@@ -35,12 +37,15 @@ export const ANDROID_EXPANDED_WIDTH = 840;
|
|
|
35
37
|
/** The content pane: everything in a `<split-view>` but its `<sidebar>`. */
|
|
36
38
|
export class SplitViewContent extends ViewBase {
|
|
37
39
|
split = inject(SplitView);
|
|
38
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
39
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.
|
|
40
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: SplitViewContent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
41
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.3.0", type: SplitViewContent, isStandalone: true, selector: "split-view-content", host: { properties: { "style.display": "split.showing() === 'sidebar' ? 'none' : undefined", "contentStyle": "split.onDesktop ? split.contentStyle() : undefined" } }, usesInheritance: true, ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host { flex: 1; }"] });
|
|
40
42
|
}
|
|
41
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: SplitViewContent, decorators: [{
|
|
42
44
|
type: Component,
|
|
43
|
-
args: [{ selector: 'split-view-content', template: '<ng-content />', host: {
|
|
45
|
+
args: [{ selector: 'split-view-content', template: '<ng-content />', host: {
|
|
46
|
+
'[style.display]': "split.showing() === 'sidebar' ? 'none' : undefined",
|
|
47
|
+
'[contentStyle]': 'split.onDesktop ? split.contentStyle() : undefined',
|
|
48
|
+
}, styles: [":host { flex: 1; }"] }]
|
|
44
49
|
}] });
|
|
45
50
|
/**
|
|
46
51
|
* A sidebar beside the app's content:
|
|
@@ -62,12 +67,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
|
|
|
62
67
|
* root is the sidebar. On Android the columns wait for Material's expanded width,
|
|
63
68
|
* `ANDROID_EXPANDED_WIDTH`, as its list-detail layout does. There, choosing an item shows the content, and `showSidebar()` (or
|
|
64
69
|
* Android's back button) returns to the sidebar.
|
|
70
|
+
*
|
|
71
|
+
* `contentStyle="inset"` draws the content pane on macOS and Linux as a card with rounded corners,
|
|
72
|
+
* inset from its space's edges on the sidebar's backdrop, which runs under the toolbar. The pane's
|
|
73
|
+
* size, and so its layout, is the card's. iOS and Android ignore it.
|
|
65
74
|
*/
|
|
66
75
|
export class SplitView extends ViewBase {
|
|
76
|
+
/**
|
|
77
|
+
* macOS and Linux: the content pane `plain`, beside the sidebar, or `inset`, a rounded card on
|
|
78
|
+
* the sidebar's backdrop. iOS and Android ignore it.
|
|
79
|
+
*/
|
|
80
|
+
contentStyle = input('plain', /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "contentStyle" }] : /* istanbul ignore next */ []));
|
|
67
82
|
/** Whether this split view is drawn from views here, rather than by the host. */
|
|
68
83
|
drawn = !hostDraws('split-view');
|
|
69
84
|
/** Whether the host is iOS's, whose split view controller pushes and pops the content. */
|
|
70
85
|
stacksNatively = !this.drawn && nativePlatform() === 'ios';
|
|
86
|
+
/** Whether the desktop host draws this split view: on macOS and Linux. */
|
|
87
|
+
onDesktop = !this.drawn && !this.stacksNatively;
|
|
71
88
|
screen = inject(Screen);
|
|
72
89
|
/** Too narrow for the panes side by side: below Material's expanded width on Android. */
|
|
73
90
|
compact = computed(() => nativePlatform() === 'android'
|
|
@@ -76,6 +93,8 @@ export class SplitView extends ViewBase {
|
|
|
76
93
|
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
77
94
|
top = signal('sidebar', /* @ts-ignore */
|
|
78
95
|
...(ngDevMode ? [{ debugName: "top" }] : /* istanbul ignore next */ []));
|
|
96
|
+
/** Its `<sidebar>`, a child of its own, as the sidebar pane takes only those. */
|
|
97
|
+
sidebar = contentChild(SIDEBAR, { ...(ngDevMode ? { debugName: "sidebar" } : /* istanbul ignore next */ {}), descendants: false });
|
|
79
98
|
/** Whether the panes are a stack, one at a time: at a compact width, where it is drawn. */
|
|
80
99
|
stacked = computed(() => this.drawn && this.compact(), /* @ts-ignore */
|
|
81
100
|
...(ngDevMode ? [{ debugName: "stacked" }] : /* istanbul ignore next */ []));
|
|
@@ -86,6 +105,14 @@ export class SplitView extends ViewBase {
|
|
|
86
105
|
super();
|
|
87
106
|
const stop = inject(HardwareBack).handle(() => this.showSidebar());
|
|
88
107
|
inject(DestroyRef).onDestroy(stop);
|
|
108
|
+
afterNextRender(() => {
|
|
109
|
+
if (this.sidebar())
|
|
110
|
+
return;
|
|
111
|
+
if (typeof ngDevMode !== 'undefined' && !ngDevMode)
|
|
112
|
+
return;
|
|
113
|
+
console.warn('[angular-native] A <split-view> has no <sidebar> of its own, so its sidebar pane is ' +
|
|
114
|
+
'empty: on macOS it draws no divider. Put a <sidebar> in it as a child of its own.');
|
|
115
|
+
});
|
|
89
116
|
}
|
|
90
117
|
/** Show the content over the sidebar, where the panes are a stack. A choice in the sidebar does. */
|
|
91
118
|
showContent() {
|
|
@@ -105,17 +132,17 @@ export class SplitView extends ViewBase {
|
|
|
105
132
|
this.top.set('sidebar');
|
|
106
133
|
return true;
|
|
107
134
|
}
|
|
108
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
109
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
135
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: SplitView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
136
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.3.0", type: SplitView, isStandalone: true, selector: "split-view", inputs: { contentStyle: { classPropertyName: "contentStyle", publicName: "contentStyle", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.flexDirection": "drawn && !stacked() ? 'row' : undefined" } }, queries: [{ propertyName: "sidebar", first: true, predicate: SIDEBAR, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
110
137
|
<ng-content select="sidebar" />
|
|
111
138
|
<split-view-content><ng-content /></split-view-content>
|
|
112
139
|
`, isInline: true, styles: [":host { flex: 1; }"], dependencies: [{ kind: "component", type: SplitViewContent, selector: "split-view-content" }] });
|
|
113
140
|
}
|
|
114
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: SplitView, decorators: [{
|
|
115
142
|
type: Component,
|
|
116
143
|
args: [{ selector: 'split-view', imports: [SplitViewContent], template: `
|
|
117
144
|
<ng-content select="sidebar" />
|
|
118
145
|
<split-view-content><ng-content /></split-view-content>
|
|
119
146
|
`, host: { '[style.flexDirection]': "drawn && !stacked() ? 'row' : undefined" }, styles: [":host { flex: 1; }"] }]
|
|
120
|
-
}], ctorParameters: () => [] });
|
|
147
|
+
}], ctorParameters: () => [], propDecorators: { contentStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "contentStyle", required: false }] }], sidebar: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SIDEBAR), { ...{ descendants: false }, isSignal: true }] }] } });
|
|
121
148
|
//# sourceMappingURL=split-view.js.map
|
package/dist/split-view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-view.js","sourceRoot":"","sources":["../src/split-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;;AAE1C;;;;;GAKG;AACH,gBAAgB,CAAC,YAAY,EAAE;IAC7B,IAAI,GAAG;QACL,OAAO,gBAAgB,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC;IAC3D,CAAC;IACD,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,mBAAmB;CAC3B,CAAC,CAAC;AACH,gBAAgB,CAAC,oBAAoB,EAAE;IACrC,IAAI,GAAG;QACL,OAAO,gBAAgB,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,MAAM,CAAC;IAC9D,CAAC;IACD,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,sBAAsB;CAC9B,CAAC,CAAC;AAEH,uEAAuE;AACvE,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,kBAAkB,CAAC,OAAO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AEF;QACE,KAAK,EAAE,CAAC;QACR,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACnE,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,oGAAoG;IACpG,WAAW;QACT,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACxB,IAAI,IAAI,CAAC,cAAc;YAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACjF,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,IAAI,IAAI,CAAC,cAAc;YAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAC/E,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;uGA3CU,SAAS;2FAAT,SAAS,yLAPV;;;GAGT,4FA/BU,gBAAgB;;2FAmChB,SAAS;kBAVrB,SAAS;+BACE,YAAY,WACb,CAAC,gBAAgB,CAAC,YACjB;;;GAGT,QAEK,EAAE,uBAAuB,EAAE,yCAAyC,EAAE","sourcesContent":["import { Component, DestroyRef, computed, inject, signal, type Signal } from '@angular/core';\nimport { HardwareBack, Screen, nativeSplitViews } from '@ng-native/device';\nimport { nativePlatform, registerViewName, registeredViewName } from '@ng-native/fabric';\nimport { ViewBase } from './view-base.ts';\n\n/**\n * The host draws a split view on macOS: an NSSplitViewController for the first one in a window, a\n * plain NSSplitView for any other. On an iPad with the components pod it is a\n * UISplitViewController (`nativeSplitViews()`). Everywhere else it is drawn here, from views: two\n * columns, or at a compact width a stack whose root is the sidebar.\n */\nregisterViewName('split-view', {\n get ios() {\n return nativeSplitViews() ? 'NgNativeSplitView' : 'View';\n },\n android: 'View',\n macos: 'NgNativeSplitView',\n});\nregisterViewName('split-view-content', {\n get ios() {\n return nativeSplitViews() ? 'NgNativeSplitContent' : 'View';\n },\n android: 'View',\n macos: 'NgNativeSplitContent',\n});\n\n/** Whether the host draws `element`, rather than a view drawn here. */\nexport function hostDraws(element: string): boolean {\n return registeredViewName(element) !== 'View';\n}\n\n/**\n * Material's expanded window width, in dp: from it Android's list-detail layout shows the list\n * pane beside the content, and below it one pane at a time.\n */\nexport const ANDROID_EXPANDED_WIDTH = 840;\n\n/** Which pane a split view shows: both side by side, or one of them as a stack's top. */\nexport type SplitViewShowing = 'both' | 'sidebar' | 'content';\n\n/** The content pane: everything in a `<split-view>` but its `<sidebar>`. */\n@Component({\n selector: 'split-view-content',\n template: '<ng-content />',\n host: { '[style.display]': \"split.showing() === 'sidebar' ? 'none' : undefined\" },\n styles: ':host { flex: 1; }',\n})\nexport class SplitViewContent extends ViewBase {\n protected readonly split = inject(SplitView);\n}\n\n/**\n * A sidebar beside the app's content:\n *\n * <split-view>\n * <sidebar [(collapsed)]=\"hidden\">\n * <sidebar-section title=\"Library\">\n * <sidebar-item path=\"songs\" label=\"Songs\" sfSymbol=\"music.note\" />\n * </sidebar-section>\n * </sidebar>\n * <router-outlet />\n * </split-view>\n *\n * On macOS the first one in a window becomes its NSSplitViewController, with the full-height\n * sidebar and the toolbar's sidebar button; a nested or second one is a plain NSSplitView. On an\n * iPad it is a UISplitViewController, whose sidebar column holds the sidebar's rows drawn here,\n * and which collapses into a stack itself at a compact width (Slide Over, a narrow Split View),\n * the sidebar its root. On an iPhone and Android it is drawn: two columns, and at a compact width (`Screen.compact`) a stack whose\n * root is the sidebar. On Android the columns wait for Material's expanded width,\n * `ANDROID_EXPANDED_WIDTH`, as its list-detail layout does. There, choosing an item shows the content, and `showSidebar()` (or\n * Android's back button) returns to the sidebar.\n */\n@Component({\n selector: 'split-view',\n imports: [SplitViewContent],\n template: `\n <ng-content select=\"sidebar\" />\n <split-view-content><ng-content /></split-view-content>\n `,\n styles: ':host { flex: 1; }',\n host: { '[style.flexDirection]': \"drawn && !stacked() ? 'row' : undefined\" },\n})\nexport class SplitView extends ViewBase {\n /** Whether this split view is drawn from views here, rather than by the host. */\n readonly drawn = !hostDraws('split-view');\n /** Whether the host is iOS's, whose split view controller pushes and pops the content. */\n private readonly stacksNatively = !this.drawn && nativePlatform() === 'ios';\n private readonly screen = inject(Screen);\n /** Too narrow for the panes side by side: below Material's expanded width on Android. */\n private readonly compact = computed(() =>\n nativePlatform() === 'android'\n ? this.screen.window().width < ANDROID_EXPANDED_WIDTH\n : this.screen.compact(),\n );\n private readonly top = signal<'sidebar' | 'content'>('sidebar');\n\n /** Whether the panes are a stack, one at a time: at a compact width, where it is drawn. */\n readonly stacked: Signal<boolean> = computed(() => this.drawn && this.compact());\n\n /** Which pane is showing. Both, unless the split view is a stack. */\n readonly showing: Signal<SplitViewShowing> = computed(() =>\n this.stacked() ? this.top() : 'both',\n );\n\n constructor() {\n super();\n const stop = inject(HardwareBack).handle(() => this.showSidebar());\n inject(DestroyRef).onDestroy(stop);\n }\n\n /** Show the content over the sidebar, where the panes are a stack. A choice in the sidebar does. */\n showContent(): void {\n this.top.set('content');\n if (this.stacksNatively) this.engine.dispatchCommand(this.node, 'showContent');\n }\n\n /**\n * Go back to the sidebar, where the panes are a stack and the content is in front. Whether it\n * did, so Android's back button leaves the app from the sidebar.\n */\n showSidebar(): boolean {\n if (this.stacksNatively) this.engine.dispatchCommand(this.node, 'showSidebar');\n if (this.showing() !== 'content') return false;\n this.top.set('sidebar');\n return true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"split-view.js","sourceRoot":"","sources":["../src/split-view.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,MAA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,\n signal,\n type Signal,\n} from '@angular/core';\nimport { HardwareBack, Screen, nativeSplitViews } from '@ng-native/device';\nimport { nativePlatform, registerViewName, registeredViewName } from '@ng-native/fabric';\nimport { ViewBase } from './view-base.ts';\n\n/**\n * The host draws a split view on macOS: an NSSplitViewController for the first one in a window, a\n * plain NSSplitView for any other. On an iPad with the components pod it is a\n * UISplitViewController (`nativeSplitViews()`). Everywhere else it is drawn here, from views: two\n * columns, or at a compact width a stack whose root is the sidebar.\n */\nregisterViewName('split-view', {\n get ios() {\n return nativeSplitViews() ? 'NgNativeSplitView' : 'View';\n },\n android: 'View',\n macos: 'NgNativeSplitView',\n});\nregisterViewName('split-view-content', {\n get ios() {\n return nativeSplitViews() ? 'NgNativeSplitContent' : 'View';\n },\n android: 'View',\n macos: 'NgNativeSplitContent',\n});\n\ndeclare const ngDevMode: unknown;\n\n/** A `<sidebar>`, which provides itself as this so a split view can find it among its children. */\nexport const SIDEBAR = new InjectionToken<unknown>('angular-native.sidebar');\n\n/** Whether the host draws `element`, rather than a view drawn here. */\nexport function hostDraws(element: string): boolean {\n return registeredViewName(element) !== 'View';\n}\n\n/**\n * Material's expanded window width, in dp: from it Android's list-detail layout shows the list\n * pane beside the content, and below it one pane at a time.\n */\nexport const ANDROID_EXPANDED_WIDTH = 840;\n\n/** Which pane a split view shows: both side by side, or one of them as a stack's top. */\nexport type SplitViewShowing = 'both' | 'sidebar' | 'content';\n\n/**\n * How the desktop hosts draw a split view's content pane: `plain`, filling the space beside the\n * sidebar, or `inset`, a card with rounded corners inset from its space's edges, on the sidebar's\n * backdrop, which runs under the toolbar or header bar.\n */\nexport type SplitViewContentStyle = 'plain' | 'inset';\n\n/** The content pane: everything in a `<split-view>` but its `<sidebar>`. */\n@Component({\n selector: 'split-view-content',\n template: '<ng-content />',\n host: {\n '[style.display]': \"split.showing() === 'sidebar' ? 'none' : undefined\",\n '[contentStyle]': 'split.onDesktop ? split.contentStyle() : undefined',\n },\n styles: ':host { flex: 1; }',\n})\nexport class SplitViewContent extends ViewBase {\n protected readonly split = inject(SplitView);\n}\n\n/**\n * A sidebar beside the app's content:\n *\n * <split-view>\n * <sidebar [(collapsed)]=\"hidden\">\n * <sidebar-section title=\"Library\">\n * <sidebar-item path=\"songs\" label=\"Songs\" sfSymbol=\"music.note\" />\n * </sidebar-section>\n * </sidebar>\n * <router-outlet />\n * </split-view>\n *\n * On macOS the first one in a window becomes its NSSplitViewController, with the full-height\n * sidebar and the toolbar's sidebar button; a nested or second one is a plain NSSplitView. On an\n * iPad it is a UISplitViewController, whose sidebar column holds the sidebar's rows drawn here,\n * and which collapses into a stack itself at a compact width (Slide Over, a narrow Split View),\n * the sidebar its root. On an iPhone and Android it is drawn: two columns, and at a compact width (`Screen.compact`) a stack whose\n * root is the sidebar. On Android the columns wait for Material's expanded width,\n * `ANDROID_EXPANDED_WIDTH`, as its list-detail layout does. There, choosing an item shows the content, and `showSidebar()` (or\n * Android's back button) returns to the sidebar.\n *\n * `contentStyle=\"inset\"` draws the content pane on macOS and Linux as a card with rounded corners,\n * inset from its space's edges on the sidebar's backdrop, which runs under the toolbar. The pane's\n * size, and so its layout, is the card's. iOS and Android ignore it.\n */\n@Component({\n selector: 'split-view',\n imports: [SplitViewContent],\n template: `\n <ng-content select=\"sidebar\" />\n <split-view-content><ng-content /></split-view-content>\n `,\n styles: ':host { flex: 1; }',\n host: { '[style.flexDirection]': \"drawn && !stacked() ? 'row' : undefined\" },\n})\nexport class SplitView extends ViewBase {\n /**\n * macOS and Linux: the content pane `plain`, beside the sidebar, or `inset`, a rounded card on\n * the sidebar's backdrop. iOS and Android ignore it.\n */\n readonly contentStyle = input<SplitViewContentStyle>('plain');\n\n /** Whether this split view is drawn from views here, rather than by the host. */\n readonly drawn = !hostDraws('split-view');\n /** Whether the host is iOS's, whose split view controller pushes and pops the content. */\n private readonly stacksNatively = !this.drawn && nativePlatform() === 'ios';\n /** Whether the desktop host draws this split view: on macOS and Linux. */\n readonly onDesktop = !this.drawn && !this.stacksNatively;\n private readonly screen = inject(Screen);\n /** Too narrow for the panes side by side: below Material's expanded width on Android. */\n private readonly compact = computed(() =>\n nativePlatform() === 'android'\n ? this.screen.window().width < ANDROID_EXPANDED_WIDTH\n : this.screen.compact(),\n );\n private readonly top = signal<'sidebar' | 'content'>('sidebar');\n /** Its `<sidebar>`, a child of its own, as the sidebar pane takes only those. */\n private readonly sidebar = contentChild(SIDEBAR, { descendants: false });\n\n /** Whether the panes are a stack, one at a time: at a compact width, where it is drawn. */\n readonly stacked: Signal<boolean> = computed(() => this.drawn && this.compact());\n\n /** Which pane is showing. Both, unless the split view is a stack. */\n readonly showing: Signal<SplitViewShowing> = computed(() =>\n this.stacked() ? this.top() : 'both',\n );\n\n constructor() {\n super();\n const stop = inject(HardwareBack).handle(() => this.showSidebar());\n inject(DestroyRef).onDestroy(stop);\n afterNextRender(() => {\n if (this.sidebar()) return;\n if (typeof ngDevMode !== 'undefined' && !ngDevMode) return;\n console.warn(\n '[angular-native] A <split-view> has no <sidebar> of its own, so its sidebar pane is ' +\n 'empty: on macOS it draws no divider. Put a <sidebar> in it as a child of its own.',\n );\n });\n }\n\n /** Show the content over the sidebar, where the panes are a stack. A choice in the sidebar does. */\n showContent(): void {\n this.top.set('content');\n if (this.stacksNatively) this.engine.dispatchCommand(this.node, 'showContent');\n }\n\n /**\n * Go back to the sidebar, where the panes are a stack and the content is in front. Whether it\n * did, so Android's back button leaves the app from the sidebar.\n */\n showSidebar(): boolean {\n if (this.stacksNatively) this.engine.dispatchCommand(this.node, 'showSidebar');\n if (this.showing() !== 'content') return false;\n this.top.set('sidebar');\n return true;\n }\n}\n"]}
|
|
@@ -23,10 +23,10 @@ export const Animated = {
|
|
|
23
23
|
delay: (_time) => graph.delay(0),
|
|
24
24
|
};
|
|
25
25
|
export class AnimatedStyle extends AnimatedStyleBase {
|
|
26
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
27
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
26
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: AnimatedStyle, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
27
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: AnimatedStyle, isStandalone: true, selector: "[animatedStyle]", providers: [{ provide: ANIMATION, useValue: animationBackend }], usesInheritance: true, ngImport: i0 });
|
|
28
28
|
}
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: AnimatedStyle, decorators: [{
|
|
30
30
|
type: Directive,
|
|
31
31
|
args: [{
|
|
32
32
|
selector: '[animatedStyle]',
|
package/dist/sticky-headers.d.ts
CHANGED
|
@@ -30,9 +30,14 @@ export declare class StickyHeaders {
|
|
|
30
30
|
private readonly listening;
|
|
31
31
|
/** The translation last written per header, so an unchanged one is not written again. */
|
|
32
32
|
private readonly written;
|
|
33
|
+
/** Each header's native drive, with the axis and range it moves along. */
|
|
33
34
|
private readonly drives;
|
|
34
35
|
private settleTimer;
|
|
36
|
+
/** Where native last said the scroll view was, and along which axis: none until it has. */
|
|
35
37
|
private offset;
|
|
38
|
+
private offsetAxis;
|
|
39
|
+
/** Whether scrolling has paused: no scroll event is coming to draw a drive native is given. */
|
|
40
|
+
private resting;
|
|
36
41
|
constructor(engine: HostEngine, scroll: HostNode, horizontal: () => boolean);
|
|
37
42
|
private readonly scroll;
|
|
38
43
|
/** Find the sticky children again, after a pass that may have changed them. */
|
|
@@ -40,7 +45,21 @@ export declare class StickyHeaders {
|
|
|
40
45
|
scrolled(offset: number): void;
|
|
41
46
|
destroy(): void;
|
|
42
47
|
private measured;
|
|
48
|
+
/**
|
|
49
|
+
* Where a child is in the content now, for one that turns sticky after it was laid out: native
|
|
50
|
+
* sends a layout event only when a view's layout changes, so none comes for it. RN's ScrollView
|
|
51
|
+
* gets one by wrapping the child in a new view. Measured against the content view, both in the
|
|
52
|
+
* window, as native answers; a child not committed yet is measured by its layout event instead.
|
|
53
|
+
*/
|
|
54
|
+
private measureNow;
|
|
43
55
|
private release;
|
|
56
|
+
private axis;
|
|
57
|
+
/**
|
|
58
|
+
* Hand a header to native to move along the scroll view's axis, made again when the axis changes.
|
|
59
|
+
* A drive made, or given a new range, at rest has no scroll event coming to draw it, so native is
|
|
60
|
+
* told where it last said the scroll view was, unless that was along the other axis. Mid-scroll
|
|
61
|
+
* the next event draws it.
|
|
62
|
+
*/
|
|
44
63
|
private drive;
|
|
45
64
|
/** `ScrollViewStickyHeader`'s interpolation, as plain arithmetic. */
|
|
46
65
|
private apply;
|
package/dist/sticky-headers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pinnedRange } from '@ng-native/fabric';
|
|
1
|
+
import { pinnedRange, } from '@ng-native/fabric';
|
|
2
2
|
/**
|
|
3
3
|
* How long scrolling has to pause before a natively moved header's translate is written, so the
|
|
4
4
|
* shadow tree, which a touch is hit-tested against, catches up with where native drew it. RN's
|
|
@@ -30,9 +30,14 @@ export class StickyHeaders {
|
|
|
30
30
|
listening = new Map();
|
|
31
31
|
/** The translation last written per header, so an unchanged one is not written again. */
|
|
32
32
|
written = new Map();
|
|
33
|
+
/** Each header's native drive, with the axis and range it moves along. */
|
|
33
34
|
drives = new Map();
|
|
34
35
|
settleTimer;
|
|
36
|
+
/** Where native last said the scroll view was, and along which axis: none until it has. */
|
|
35
37
|
offset = 0;
|
|
38
|
+
offsetAxis = null;
|
|
39
|
+
/** Whether scrolling has paused: no scroll event is coming to draw a drive native is given. */
|
|
40
|
+
resting = true;
|
|
36
41
|
constructor(engine, scroll, horizontal) {
|
|
37
42
|
this.engine = engine;
|
|
38
43
|
this.scroll = scroll;
|
|
@@ -52,16 +57,26 @@ export class StickyHeaders {
|
|
|
52
57
|
continue;
|
|
53
58
|
this.engine.setProp(node, 'zIndex', 10);
|
|
54
59
|
this.listening.set(node, this.engine.setEventListener(node, 'topLayout', (event) => this.measured(node, event)));
|
|
60
|
+
if (content)
|
|
61
|
+
this.measureNow(node, content);
|
|
55
62
|
}
|
|
63
|
+
// With nothing sticky nothing hears the scroll view, so where it was last heard goes stale.
|
|
64
|
+
if (headers.length === 0)
|
|
65
|
+
this.offsetAxis = null;
|
|
56
66
|
this.headers = headers;
|
|
57
67
|
this.apply();
|
|
58
68
|
}
|
|
59
69
|
scrolled(offset) {
|
|
60
70
|
this.offset = offset;
|
|
71
|
+
this.offsetAxis = this.axis();
|
|
61
72
|
if (!this.engine.drivesScroll)
|
|
62
73
|
return this.apply();
|
|
74
|
+
this.resting = false;
|
|
63
75
|
clearTimeout(this.settleTimer);
|
|
64
|
-
this.settleTimer = setTimeout(() =>
|
|
76
|
+
this.settleTimer = setTimeout(() => {
|
|
77
|
+
this.resting = true;
|
|
78
|
+
this.apply();
|
|
79
|
+
}, STICKY_SETTLE_MS);
|
|
65
80
|
}
|
|
66
81
|
destroy() {
|
|
67
82
|
clearTimeout(this.settleTimer);
|
|
@@ -80,31 +95,73 @@ export class StickyHeaders {
|
|
|
80
95
|
});
|
|
81
96
|
this.apply();
|
|
82
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Where a child is in the content now, for one that turns sticky after it was laid out: native
|
|
100
|
+
* sends a layout event only when a view's layout changes, so none comes for it. RN's ScrollView
|
|
101
|
+
* gets one by wrapping the child in a new view. Measured against the content view, both in the
|
|
102
|
+
* window, as native answers; a child not committed yet is measured by its layout event instead.
|
|
103
|
+
*/
|
|
104
|
+
measureNow(node, content) {
|
|
105
|
+
let own;
|
|
106
|
+
let box;
|
|
107
|
+
const both = () => {
|
|
108
|
+
if (!own || !box || this.extents.has(node) || !this.listening.has(node))
|
|
109
|
+
return;
|
|
110
|
+
const horizontal = this.horizontal();
|
|
111
|
+
this.extents.set(node, {
|
|
112
|
+
start: horizontal ? own.x - box.x : own.y - box.y,
|
|
113
|
+
size: horizontal ? own.width : own.height,
|
|
114
|
+
});
|
|
115
|
+
this.apply();
|
|
116
|
+
};
|
|
117
|
+
this.engine.measure(node, (frame) => ((own = frame), both()));
|
|
118
|
+
this.engine.measure(content, (frame) => ((box = frame), both()));
|
|
119
|
+
}
|
|
83
120
|
release(node) {
|
|
84
121
|
this.listening.get(node)?.();
|
|
85
122
|
this.listening.delete(node);
|
|
86
123
|
this.extents.delete(node);
|
|
87
124
|
this.written.delete(node);
|
|
88
|
-
this.drives.get(node)?.stop();
|
|
125
|
+
this.drives.get(node)?.drive.stop();
|
|
89
126
|
this.drives.delete(node);
|
|
90
127
|
this.engine.setProp(node, 'zIndex', undefined);
|
|
91
128
|
this.engine.setProp(node, 'transform', undefined);
|
|
92
129
|
}
|
|
130
|
+
axis() {
|
|
131
|
+
return this.horizontal() ? 'x' : 'y';
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Hand a header to native to move along the scroll view's axis, made again when the axis changes.
|
|
135
|
+
* A drive made, or given a new range, at rest has no scroll event coming to draw it, so native is
|
|
136
|
+
* told where it last said the scroll view was, unless that was along the other axis. Mid-scroll
|
|
137
|
+
* the next event draws it.
|
|
138
|
+
*/
|
|
93
139
|
drive(node, start, stop) {
|
|
94
140
|
if (!this.engine.drivesScroll)
|
|
95
141
|
return;
|
|
96
142
|
const range = pinnedRange(start, stop);
|
|
97
|
-
const
|
|
143
|
+
const key = JSON.stringify(range);
|
|
144
|
+
const axis = this.axis();
|
|
145
|
+
const held = this.drives.get(node);
|
|
146
|
+
// Not a position native never gave: 0 would move every view on this scroll view's offset.
|
|
147
|
+
const from = this.resting && this.offsetAxis === axis ? this.offset : undefined;
|
|
148
|
+
if (held?.axis === axis) {
|
|
149
|
+
if (held.range === key)
|
|
150
|
+
return held.drive.update(range);
|
|
151
|
+
held.range = key;
|
|
152
|
+
return held.drive.update(range, from);
|
|
153
|
+
}
|
|
154
|
+
held?.drive.stop();
|
|
155
|
+
this.drives.delete(node);
|
|
156
|
+
const drive = this.engine.driveByScroll(node, this.scroll, axis, range, [], from);
|
|
98
157
|
if (drive)
|
|
99
|
-
|
|
100
|
-
const axis = this.horizontal() ? 'x' : 'y';
|
|
101
|
-
const next = this.engine.driveByScroll(node, this.scroll, axis, range);
|
|
102
|
-
if (next)
|
|
103
|
-
this.drives.set(node, next);
|
|
158
|
+
this.drives.set(node, { drive, axis, range: key });
|
|
104
159
|
}
|
|
105
160
|
/** `ScrollViewStickyHeader`'s interpolation, as plain arithmetic. */
|
|
106
161
|
apply() {
|
|
107
162
|
const key = this.horizontal() ? 'translateX' : 'translateY';
|
|
163
|
+
// What native said along the other axis says nothing of this one.
|
|
164
|
+
const offset = this.offsetAxis === this.axis() ? this.offset : 0;
|
|
108
165
|
this.headers.forEach((node, at) => {
|
|
109
166
|
const own = this.extents.get(node);
|
|
110
167
|
if (!own)
|
|
@@ -112,7 +169,7 @@ export class StickyHeaders {
|
|
|
112
169
|
const next = this.extents.get(this.headers[at + 1]);
|
|
113
170
|
const stop = next ? next.start - own.size : Infinity;
|
|
114
171
|
this.drive(node, own.start, stop);
|
|
115
|
-
const shift = Math.min(Math.max(0,
|
|
172
|
+
const shift = Math.min(Math.max(0, offset - own.start), Math.max(0, stop - own.start));
|
|
116
173
|
if (this.written.get(node) === shift)
|
|
117
174
|
return;
|
|
118
175
|
this.written.set(node, shift);
|