@ng-native/components 0.27.0 → 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.
- package/android/src/main/java/dev/ngnative/components/ContextMenuPopup.kt +61 -19
- package/android/src/main/java/dev/ngnative/components/MenusModule.kt +22 -0
- package/android/src/main/java/dev/ngnative/components/Shortcut.kt +13 -4
- package/dist/context-menu.d.ts +14 -6
- package/dist/context-menu.js +30 -28
- package/dist/context-menu.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/menu.d.ts +7 -4
- package/dist/menu.js +10 -4
- package/dist/menu.js.map +1 -1
- package/dist/modal.d.ts +6 -2
- package/dist/modal.js.map +1 -1
- package/dist/native-button.d.ts +8 -1
- package/dist/native-button.js +5 -1
- package/dist/native-button.js.map +1 -1
- package/dist/press-menu.d.ts +39 -0
- package/dist/press-menu.js +76 -0
- package/dist/press-menu.js.map +1 -0
- package/dist/pressable.d.ts +3 -0
- package/dist/pressable.js +6 -1
- package/dist/pressable.js.map +1 -1
- package/dist/reanimated.js +27 -3
- package/dist/reanimated.js.map +1 -1
- package/dist/settled-updates.d.ts +55 -0
- package/dist/settled-updates.js +77 -0
- package/dist/settled-updates.js.map +1 -0
- package/dist/sidebar-item.d.ts +18 -3
- package/dist/sidebar-item.js +29 -3
- package/dist/sidebar-item.js.map +1 -1
- package/dist/stand-ins/reanimated.d.ts +5 -0
- package/dist/stand-ins/reanimated.js +7 -0
- package/dist/stand-ins/reanimated.js.map +1 -1
- package/dist/sticky-rows.d.ts +120 -25
- package/dist/sticky-rows.js +265 -65
- package/dist/sticky-rows.js.map +1 -1
- package/dist/svg-icon.d.ts +9 -0
- package/dist/svg-icon.js +37 -0
- package/dist/svg-icon.js.map +1 -0
- package/dist/virtual-list-sticky-level.d.ts +39 -0
- package/dist/virtual-list-sticky-level.js +82 -0
- package/dist/virtual-list-sticky-level.js.map +1 -0
- package/dist/virtual-list-sticky.d.ts +19 -0
- package/dist/virtual-list-sticky.js +13 -0
- package/dist/virtual-list-sticky.js.map +1 -0
- package/dist/virtual-list.d.ts +6 -2
- package/dist/virtual-list.js +60 -43
- package/dist/virtual-list.js.map +1 -1
- package/dist/worklet-style.d.ts +11 -0
- package/dist/worklet-style.js +15 -1
- package/dist/worklet-style.js.map +1 -1
- package/dist/worklets.d.ts +5 -1
- package/dist/worklets.js.map +1 -1
- package/dist/written-props.js +1 -0
- package/dist/written-props.js.map +1 -1
- package/package.json +3 -3
package/dist/reanimated.js
CHANGED
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
* them, and re-exporting them here would only add a name to keep in step.
|
|
32
32
|
*/
|
|
33
33
|
import { Directive } from '@angular/core';
|
|
34
|
-
import { makeMutable, startMapper, stopMapper } from 'react-native-reanimated';
|
|
34
|
+
import { getStaticFeatureFlag, makeMutable, startMapper, stopMapper, } from 'react-native-reanimated';
|
|
35
|
+
import { settledReader } from "./settled-updates.js";
|
|
35
36
|
import { WorkletScrollBase } from "./worklet-scroll.js";
|
|
36
37
|
import { WorkletStyleBase } from "./worklet-style.js";
|
|
37
38
|
import { WORKLETS } from "./worklets.js";
|
|
@@ -57,8 +58,27 @@ export { releaseOnDestroy } from "./release-on-destroy.js";
|
|
|
57
58
|
export function sharedValue(initial) {
|
|
58
59
|
return makeMutable(initial);
|
|
59
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Not public: what Reanimated's own components read the settled values through, and the inverse
|
|
63
|
+
* of its processing they render them with, since Reanimated keeps the values as native takes them
|
|
64
|
+
* and the engine processes a style itself. Required for the reason `updateProps` is, and with no
|
|
65
|
+
* extension, so that Metro picks the native file: `ReanimatedModule/index.native.ts` over the
|
|
66
|
+
* browser's `index.ts`, and the collector's `.native.ts` from 4.8.
|
|
67
|
+
*/
|
|
68
|
+
const { ReanimatedModule } = require('react-native-reanimated/src/ReanimatedModule');
|
|
69
|
+
const collector = require('react-native-reanimated/src/PropsRegistryGarbageCollector');
|
|
70
|
+
/**
|
|
71
|
+
* Where Reanimated hands over what its views settled on, as its own React components read it. With
|
|
72
|
+
* `FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS` off it keeps no such record, and with
|
|
73
|
+
* `USE_ANIMATION_BACKEND` on it applies nothing to a commit, so there is nothing to read. Nor where
|
|
74
|
+
* it gives no way to turn what it hands over back into a style (before 4.7).
|
|
75
|
+
*/
|
|
76
|
+
const settledUpdates = getStaticFeatureFlag('FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS') &&
|
|
77
|
+
!getStaticFeatureFlag('USE_ANIMATION_BACKEND')
|
|
78
|
+
? settledReader(ReanimatedModule, collector)
|
|
79
|
+
: null;
|
|
60
80
|
const backend = {
|
|
61
|
-
bind: (target, style) => {
|
|
81
|
+
bind: (target, style, settled) => {
|
|
62
82
|
// The shape `updateProps` takes: a `{ value }` holder of descriptors, so that the set of
|
|
63
83
|
// views a style drives can change without the worklet being rebuilt. Ours never does - one
|
|
64
84
|
// directive drives one node - so a plain object is enough.
|
|
@@ -68,7 +88,11 @@ const backend = {
|
|
|
68
88
|
'worklet';
|
|
69
89
|
updateProps(descriptors, updater(...values));
|
|
70
90
|
}, values);
|
|
71
|
-
|
|
91
|
+
const stopSettling = settledUpdates?.watch(target.tag, settled);
|
|
92
|
+
return () => {
|
|
93
|
+
stopMapper(id);
|
|
94
|
+
stopSettling?.();
|
|
95
|
+
};
|
|
72
96
|
},
|
|
73
97
|
scroll: (target, spec) => {
|
|
74
98
|
const { values, handler } = spec;
|
package/dist/reanimated.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reanimated.js","sourceRoot":"","sources":["../src/reanimated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"reanimated.js","sourceRoot":"","sources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AE,CAAC;;2FAE1C,YAAY;kBAJxB,SAAS;mBAAC;oBACT,QAAQ,EAAE,gBAAgB;oBAC1B,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;iBACtD;;AAOD,MAAM,OAAO,aAAc,SAAQ,iBAAiB;uGAAvC,aAAa;2FAAb,aAAa,8DAFb,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;;2FAE1C,aAAa;kBAJzB,SAAS;mBAAC;oBACT,QAAQ,EAAE,iBAAiB;oBAC3B,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;iBACtD","sourcesContent":["/**\n * Reanimated, without React: a style computed on the UI thread, bound to one of our nodes.\n *\n * ```ts\n * import { WorkletStyle, sharedValue, workletStyle } from '@ng-native/components/reanimated';\n *\n * protected readonly offset = sharedValue(0);\n * protected readonly slide = workletStyle([this.offset], (offset) => {\n * 'worklet';\n * return { transform: [{ translateX: offset.value }] };\n * });\n * ```\n * ```html\n * <view [workletStyle]=\"slide\">\n * ```\n *\n * Deliberately outside the barrel: everything here reaches React Native's\n * Flow source, which Node cannot parse, and the rest of the package has to stay loadable in the\n * test suite.\n *\n * What makes this work at all is that Reanimated addresses a view by its **shadow node**, not by a\n * React instance. `getShadowNodeWrapperFromRef` digs one out of a fiber; our engine has held the\n * same object since it created the node, so there is nothing to dig for. `startMapper` and\n * `makeMutable` are public, and the whole React half of `useAnimatedStyle` - refs, effects, the\n * animated component wrapper - is what an Angular directive replaces.\n *\n * An app installs `react-native-reanimated` and `react-native-worklets` itself, and gets the\n * worklet Babel plugin from `babel-preset-expo`, which adds it as soon as the package is present.\n * Everything else an animation needs - `withTiming`, `withSpring`, `interpolate`, `Easing` - is\n * imported from `react-native-reanimated` directly: they are plain functions with no React in\n * them, and re-exporting them here would only add a name to keep in step.\n */\nimport { Directive } from '@angular/core';\nimport {\n getStaticFeatureFlag,\n makeMutable,\n startMapper,\n stopMapper,\n} from 'react-native-reanimated';\n/**\n * `updateProps` is what every animated style in Reanimated goes through, and there is no exported\n * equivalent. It is a worklet, so it is called from ours rather than from here.\n *\n * Two things about the import. It goes through `src/` because that is where the package's own\n * `react-native` field points and Metro prefers that field: the built `lib/` copy would be a\n * second Reanimated in the bundle, with module state of its own. And it is a `require`, so that\n * these sources stay out of our type-checking program, where they fail against settings they were\n * never written for.\n */\nconst { updateProps } = require('react-native-reanimated/src/updateProps/index.ts') as {\n updateProps(descriptors: object, updates: Record<string, unknown>): void;\n};\nimport { settledReader, type SettledSource, type Unprocess } from './settled-updates.ts';\nimport { WorkletScrollBase } from './worklet-scroll.ts';\nimport { WorkletStyleBase } from './worklet-style.ts';\nimport { WORKLETS, type MutableValue, type WorkletBackend } from './worklets.ts';\n\nexport {\n workletScroll,\n workletStyle,\n type SharedValue,\n type WorkletScrollSpec,\n type WorkletStyleSpec,\n} from './worklets.ts';\nexport { releaseOnDestroy } from './release-on-destroy.ts';\n\n/**\n * A value both runtimes can see. Reanimated's own `useSharedValue` is this plus a React ref, and\n * the ref is the half that does not apply here. Typed with the shape of Reanimated's own, so it\n * goes to `cancelAnimation` and the rest of the library as one of theirs would.\n */\nexport function sharedValue<T>(initial: T): MutableValue<T> {\n return makeMutable(initial);\n}\n\n/**\n * Not public: what Reanimated's own components read the settled values through, and the inverse\n * of its processing they render them with, since Reanimated keeps the values as native takes them\n * and the engine processes a style itself. Required for the reason `updateProps` is, and with no\n * extension, so that Metro picks the native file: `ReanimatedModule/index.native.ts` over the\n * browser's `index.ts`, and the collector's `.native.ts` from 4.8.\n */\nconst { ReanimatedModule } = require('react-native-reanimated/src/ReanimatedModule') as {\n ReanimatedModule: SettledSource;\n};\nconst collector = require('react-native-reanimated/src/PropsRegistryGarbageCollector') as Unprocess;\n\n/**\n * Where Reanimated hands over what its views settled on, as its own React components read it. With\n * `FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS` off it keeps no such record, and with\n * `USE_ANIMATION_BACKEND` on it applies nothing to a commit, so there is nothing to read. Nor where\n * it gives no way to turn what it hands over back into a style (before 4.7).\n */\nconst settledUpdates =\n getStaticFeatureFlag('FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS') &&\n !getStaticFeatureFlag('USE_ANIMATION_BACKEND')\n ? settledReader(ReanimatedModule, collector)\n : null;\n\nconst backend: WorkletBackend = {\n bind: (target, style, settled) => {\n // The shape `updateProps` takes: a `{ value }` holder of descriptors, so that the set of\n // views a style drives can change without the worklet being rebuilt. Ours never does - one\n // directive drives one node - so a plain object is enough.\n const descriptors = { value: [{ tag: target.tag, shadowNodeWrapper: target.shadowNode }] };\n const { values, updater } = style;\n const id = startMapper(() => {\n 'worklet';\n updateProps(descriptors, updater(...values));\n }, values as unknown[]);\n const stopSettling = settledUpdates?.watch(target.tag, settled);\n return () => {\n stopMapper(id);\n stopSettling?.();\n };\n },\n\n scroll: (target, spec) => {\n const { values, handler } = spec;\n // The same registration a gesture uses, on the name React Native's scroll views emit. The\n // event still reaches our own listeners: Reanimated observes it rather than consuming it.\n const id = registerEventHandler(\n (event: never) => {\n 'worklet';\n handler(event, ...values);\n },\n 'onScroll',\n target.tag,\n );\n return () => unregisterEventHandler(id);\n },\n};\n\n/**\n * Not public, and the same call Reanimated's own `WorkletEventHandler` makes. Reached through\n * `src/` for the reason `updateProps` is, and required rather than imported so that those sources\n * stay out of our type-checking program.\n */\nconst { registerEventHandler, unregisterEventHandler } =\n require('react-native-reanimated/src/core.ts') as {\n registerEventHandler(\n worklet: (event: never) => void,\n eventName: string,\n emitterReactTag: number,\n ): number;\n unregisterEventHandler(id: number): void;\n };\n\n@Directive({\n selector: '[workletStyle]',\n providers: [{ provide: WORKLETS, useValue: backend }],\n})\nexport class WorkletStyle extends WorkletStyleBase {}\n\n@Directive({\n selector: '[workletScroll]',\n providers: [{ provide: WORKLETS, useValue: backend }],\n})\nexport class WorkletScroll extends WorkletScrollBase {}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Reanimated's views settled on, read for the views a `[workletStyle]` drives.
|
|
3
|
+
*
|
|
4
|
+
* Reanimated keeps the values a worklet drew each view with in a registry, and applies every entry
|
|
5
|
+
* to each commit React Native makes, cloning the view and each ancestor. A view stays there until
|
|
6
|
+
* the values are in the props it is committed with. Reanimated's own React components read
|
|
7
|
+
* `getSettledUpdates()` every half second while any is mounted and render what it hands them; a
|
|
8
|
+
* view it handed over on one read and that has not moved since, it lets go on the next. Nothing
|
|
9
|
+
* reads it for ours, so this does, and hands each view's values to whoever commits them.
|
|
10
|
+
*
|
|
11
|
+
* Kept apart from `reanimated.ts`, which reaches React Native's Flow source, so a test can drive it.
|
|
12
|
+
*/
|
|
13
|
+
/** One view's values, as Reanimated's `getSettledUpdates()` hands them over. */
|
|
14
|
+
export interface SettledUpdate {
|
|
15
|
+
readonly viewTag: number;
|
|
16
|
+
readonly styleProps: Readonly<Record<string, unknown>> | null;
|
|
17
|
+
}
|
|
18
|
+
export declare class SettledUpdates {
|
|
19
|
+
#private;
|
|
20
|
+
/**
|
|
21
|
+
* `read` is `getSettledUpdates()`, answering undefined where Reanimated has none. It is told
|
|
22
|
+
* which views are watched, for a Reanimated that asks, so that it lets no other view go.
|
|
23
|
+
*/
|
|
24
|
+
constructor(read: (isWatched: (tag: number) => boolean) => readonly SettledUpdate[] | undefined);
|
|
25
|
+
/**
|
|
26
|
+
* Hand `listener` the values the view with `tag` settles on, each time it does. Read for while
|
|
27
|
+
* any view is watched. Returns the function that stops it.
|
|
28
|
+
*/
|
|
29
|
+
watch(tag: number, listener: (props: Readonly<Record<string, unknown>>) => void): () => void;
|
|
30
|
+
private collect;
|
|
31
|
+
}
|
|
32
|
+
/** One view's settled values as Reanimated hands them over: `styleProps` in 4.7, `props` and `style` from 4.8. */
|
|
33
|
+
export interface RawSettled {
|
|
34
|
+
readonly viewTag: number;
|
|
35
|
+
readonly styleProps?: Record<string, unknown> | null;
|
|
36
|
+
readonly props?: Record<string, unknown>;
|
|
37
|
+
readonly style?: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
/** Reanimated's module, which hands the settled values over. */
|
|
40
|
+
export interface SettledSource {
|
|
41
|
+
getSettledUpdates?(isViewRegistered?: (tag: number) => boolean): readonly RawSettled[];
|
|
42
|
+
}
|
|
43
|
+
/** Reanimated's inverse of its processing, from its garbage collector's module. */
|
|
44
|
+
export interface Unprocess {
|
|
45
|
+
/** 4.7. */
|
|
46
|
+
unprocessProps?(props: Record<string, unknown>): void;
|
|
47
|
+
/** 4.8 and later. */
|
|
48
|
+
unprocessSettledUpdate?(update: RawSettled): void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Read settled values in the shape this Reanimated hands them over in, turned back into a style
|
|
52
|
+
* for the engine to process like any other. Null where there is no way to: before 4.7, which gives
|
|
53
|
+
* no inverse to turn them back with.
|
|
54
|
+
*/
|
|
55
|
+
export declare function settledReader(source: SettledSource, unprocess: Unprocess): SettledUpdates | null;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Reanimated's views settled on, read for the views a `[workletStyle]` drives.
|
|
3
|
+
*
|
|
4
|
+
* Reanimated keeps the values a worklet drew each view with in a registry, and applies every entry
|
|
5
|
+
* to each commit React Native makes, cloning the view and each ancestor. A view stays there until
|
|
6
|
+
* the values are in the props it is committed with. Reanimated's own React components read
|
|
7
|
+
* `getSettledUpdates()` every half second while any is mounted and render what it hands them; a
|
|
8
|
+
* view it handed over on one read and that has not moved since, it lets go on the next. Nothing
|
|
9
|
+
* reads it for ours, so this does, and hands each view's values to whoever commits them.
|
|
10
|
+
*
|
|
11
|
+
* Kept apart from `reanimated.ts`, which reaches React Native's Flow source, so a test can drive it.
|
|
12
|
+
*/
|
|
13
|
+
/** How often Reanimated's own components read: `FLUSH_INTERVAL_MS` in its garbage collector. */
|
|
14
|
+
const EVERY_MS = 500;
|
|
15
|
+
export class SettledUpdates {
|
|
16
|
+
#listeners = new Map();
|
|
17
|
+
#read;
|
|
18
|
+
#isWatched = (tag) => this.#listeners.has(tag);
|
|
19
|
+
#timer = null;
|
|
20
|
+
/**
|
|
21
|
+
* `read` is `getSettledUpdates()`, answering undefined where Reanimated has none. It is told
|
|
22
|
+
* which views are watched, for a Reanimated that asks, so that it lets no other view go.
|
|
23
|
+
*/
|
|
24
|
+
constructor(read) {
|
|
25
|
+
this.#read = read;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hand `listener` the values the view with `tag` settles on, each time it does. Read for while
|
|
29
|
+
* any view is watched. Returns the function that stops it.
|
|
30
|
+
*/
|
|
31
|
+
watch(tag, listener) {
|
|
32
|
+
this.#listeners.set(tag, listener);
|
|
33
|
+
this.#timer ??= setInterval(() => this.collect(), EVERY_MS);
|
|
34
|
+
return () => {
|
|
35
|
+
// A view bound again keeps its tag: the newer listener stays.
|
|
36
|
+
if (this.#listeners.get(tag) !== listener)
|
|
37
|
+
return;
|
|
38
|
+
this.#listeners.delete(tag);
|
|
39
|
+
if (this.#listeners.size === 0 && this.#timer !== null) {
|
|
40
|
+
clearInterval(this.#timer);
|
|
41
|
+
this.#timer = null;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
collect() {
|
|
46
|
+
for (const { viewTag, styleProps } of this.#read(this.#isWatched) ?? []) {
|
|
47
|
+
if (styleProps)
|
|
48
|
+
this.#listeners.get(viewTag)?.(styleProps);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Read settled values in the shape this Reanimated hands them over in, turned back into a style
|
|
54
|
+
* for the engine to process like any other. Null where there is no way to: before 4.7, which gives
|
|
55
|
+
* no inverse to turn them back with.
|
|
56
|
+
*/
|
|
57
|
+
export function settledReader(source, unprocess) {
|
|
58
|
+
const read = source.getSettledUpdates?.bind(source);
|
|
59
|
+
if (!read)
|
|
60
|
+
return null;
|
|
61
|
+
const { unprocessProps, unprocessSettledUpdate } = unprocess;
|
|
62
|
+
if (unprocessSettledUpdate) {
|
|
63
|
+
// 4.8 asks which views the reader commits, and lets only those go.
|
|
64
|
+
return new SettledUpdates((isWatched) => read(isWatched).map((update) => {
|
|
65
|
+
unprocessSettledUpdate(update);
|
|
66
|
+
return { viewTag: update.viewTag, styleProps: { ...update.props, ...update.style } };
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
if (!unprocessProps)
|
|
70
|
+
return null;
|
|
71
|
+
return new SettledUpdates(() => read().map(({ viewTag, styleProps }) => {
|
|
72
|
+
if (styleProps)
|
|
73
|
+
unprocessProps(styleProps);
|
|
74
|
+
return { viewTag, styleProps: styleProps ?? null };
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=settled-updates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settled-updates.js","sourceRoot":"","sources":["../src/settled-updates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,gGAAgG;AAChG,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB,MAAM,OAAO,cAAc;IAChB,UAAU,GAAG,IAAI,GAAG,EAA8D,CAAC;IACnF,KAAK,CAAgF;IACrF,UAAU,GAAG,CAAC,GAAW,EAAW,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzE,MAAM,GAA0C,IAAI,CAAC;IAErD;;;OAGG;IACH,YAAY,IAAmF;QAC7F,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAW,EAAE,QAA4D;QAC7E,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,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AAE,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;QACvF,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,cAAc;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,IAAI,cAAc,CAAC,GAAG,EAAE,CAC7B,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,EAAiB,EAAE;QACpD,IAAI,UAAU;YAAE,cAAc,CAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,IAAI,IAAI,EAAE,CAAC;IACrD,CAAC,CAAC,CACH,CAAC;AACJ,CAAC","sourcesContent":["/**\n * What Reanimated's views settled on, read for the views a `[workletStyle]` drives.\n *\n * Reanimated keeps the values a worklet drew each view with in a registry, and applies every entry\n * to each commit React Native makes, cloning the view and each ancestor. A view stays there until\n * the values are in the props it is committed with. Reanimated's own React components read\n * `getSettledUpdates()` every half second while any is mounted and render what it hands them; a\n * view it handed over on one read and that has not moved since, it lets go on the next. Nothing\n * reads it for ours, so this does, and hands each view's values to whoever commits them.\n *\n * Kept apart from `reanimated.ts`, which reaches React Native's Flow source, so a test can drive it.\n */\n\n/** One view's values, as Reanimated's `getSettledUpdates()` hands them over. */\nexport interface SettledUpdate {\n readonly viewTag: number;\n readonly styleProps: Readonly<Record<string, unknown>> | null;\n}\n\n/** How often Reanimated's own components read: `FLUSH_INTERVAL_MS` in its garbage collector. */\nconst EVERY_MS = 500;\n\nexport class SettledUpdates {\n readonly #listeners = new Map<number, (props: Readonly<Record<string, unknown>>) => void>();\n readonly #read: (isWatched: (tag: number) => boolean) => readonly SettledUpdate[] | undefined;\n readonly #isWatched = (tag: number): boolean => this.#listeners.has(tag);\n #timer: ReturnType<typeof setInterval> | null = null;\n\n /**\n * `read` is `getSettledUpdates()`, answering undefined where Reanimated has none. It is told\n * which views are watched, for a Reanimated that asks, so that it lets no other view go.\n */\n constructor(read: (isWatched: (tag: number) => boolean) => readonly SettledUpdate[] | undefined) {\n this.#read = read;\n }\n\n /**\n * Hand `listener` the values the view with `tag` settles on, each time it does. Read for while\n * any view is watched. Returns the function that stops it.\n */\n watch(tag: number, listener: (props: Readonly<Record<string, unknown>>) => void): () => void {\n this.#listeners.set(tag, listener);\n this.#timer ??= setInterval(() => this.collect(), EVERY_MS);\n return () => {\n // A view bound again keeps its tag: the newer listener stays.\n if (this.#listeners.get(tag) !== listener) return;\n this.#listeners.delete(tag);\n if (this.#listeners.size === 0 && this.#timer !== null) {\n clearInterval(this.#timer);\n this.#timer = null;\n }\n };\n }\n\n private collect(): void {\n for (const { viewTag, styleProps } of this.#read(this.#isWatched) ?? []) {\n if (styleProps) this.#listeners.get(viewTag)?.(styleProps);\n }\n }\n}\n\n/** One view's settled values as Reanimated hands them over: `styleProps` in 4.7, `props` and `style` from 4.8. */\nexport interface RawSettled {\n readonly viewTag: number;\n readonly styleProps?: Record<string, unknown> | null;\n readonly props?: Record<string, unknown>;\n readonly style?: Record<string, unknown>;\n}\n\n/** Reanimated's module, which hands the settled values over. */\nexport interface SettledSource {\n getSettledUpdates?(isViewRegistered?: (tag: number) => boolean): readonly RawSettled[];\n}\n\n/** Reanimated's inverse of its processing, from its garbage collector's module. */\nexport interface Unprocess {\n /** 4.7. */\n unprocessProps?(props: Record<string, unknown>): void;\n /** 4.8 and later. */\n unprocessSettledUpdate?(update: RawSettled): void;\n}\n\n/**\n * Read settled values in the shape this Reanimated hands them over in, turned back into a style\n * for the engine to process like any other. Null where there is no way to: before 4.7, which gives\n * no inverse to turn them back with.\n */\nexport function settledReader(source: SettledSource, unprocess: Unprocess): SettledUpdates | null {\n const read = source.getSettledUpdates?.bind(source);\n if (!read) return null;\n const { unprocessProps, unprocessSettledUpdate } = unprocess;\n if (unprocessSettledUpdate) {\n // 4.8 asks which views the reader commits, and lets only those go.\n return new SettledUpdates((isWatched) =>\n read(isWatched).map((update): SettledUpdate => {\n unprocessSettledUpdate(update);\n return { viewTag: update.viewTag, styleProps: { ...update.props, ...update.style } };\n }),\n );\n }\n if (!unprocessProps) return null;\n return new SettledUpdates(() =>\n read().map(({ viewTag, styleProps }): SettledUpdate => {\n if (styleProps) unprocessProps(styleProps);\n return { viewTag, styleProps: styleProps ?? null };\n }),\n );\n}\n"]}
|
package/dist/sidebar-item.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Signal } from '@angular/core';
|
|
1
2
|
import type { ButtonIcon } from './native-button.ts';
|
|
2
3
|
import { ControlBase } from './pressable.ts';
|
|
3
4
|
import { type SidebarRow } from './sidebar.ts';
|
|
@@ -15,6 +16,7 @@ export type SidebarItemIcon = ButtonIcon;
|
|
|
15
16
|
*
|
|
16
17
|
* Content inside the element replaces the default row of icon, label and badge: its pressables
|
|
17
18
|
* take clicks, and while the row is selected its host has `data-selected` for CSS to restyle it.
|
|
19
|
+
* On macOS it also has `data-emphasized` while that selection is drawn in the accent colour.
|
|
18
20
|
*/
|
|
19
21
|
export declare class SidebarItem extends ControlBase implements SidebarRow {
|
|
20
22
|
private readonly sidebar;
|
|
@@ -28,15 +30,28 @@ export declare class SidebarItem extends ControlBase implements SidebarRow {
|
|
|
28
30
|
readonly sfSymbol: import("@angular/core").InputSignal<string | undefined>;
|
|
29
31
|
/** Android: a drawable resource before the label. */
|
|
30
32
|
readonly drawableName: import("@angular/core").InputSignal<string | undefined>;
|
|
31
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* The picture for each OS at once, as on `<native-tab>`. On macOS and Linux it can be an icon's
|
|
35
|
+
* SVG markup, `[icon]="{ svg: lucideBlocks }"`, which the host draws in the row's text colour.
|
|
36
|
+
*/
|
|
32
37
|
readonly icon: import("@angular/core").InputSignal<ButtonIcon | undefined>;
|
|
33
38
|
/** Whether this is the sidebar's selected item. A `path` from the router sets it by route. */
|
|
34
39
|
readonly selected: import("@angular/core").ModelSignal<boolean>;
|
|
35
40
|
/** The user chose this item. */
|
|
36
41
|
readonly select: import("@angular/core").OutputEmitterRef<void>;
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
/** On macOS, whether the source list draws the row's selection emphasized, as it last said. */
|
|
43
|
+
private readonly hostEmphasized;
|
|
44
|
+
/**
|
|
45
|
+
* macOS: whether the row is selected and its selection is drawn in the accent colour, while the
|
|
46
|
+
* window is key and the sidebar has the focus. Otherwise the selection is grey, and this is false.
|
|
47
|
+
* Always false on other platforms.
|
|
48
|
+
*/
|
|
49
|
+
readonly emphasized: Signal<boolean>;
|
|
50
|
+
protected readonly symbol: Signal<string | undefined>;
|
|
51
|
+
protected readonly drawableResource: Signal<string | undefined>;
|
|
52
|
+
protected readonly svgIcon: Signal<string | undefined>;
|
|
39
53
|
private stopSelect;
|
|
54
|
+
private stopEmphasis;
|
|
40
55
|
constructor();
|
|
41
56
|
protected roleByDefault(): 'button';
|
|
42
57
|
protected accessibleByDefault(): boolean;
|
package/dist/sidebar-item.js
CHANGED
|
@@ -1,10 +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
3
|
import { registerViewName } from '@ng-native/fabric';
|
|
4
4
|
import { ControlBase, TouchableBase } from "./pressable.js";
|
|
5
5
|
import { Sidebar } from "./sidebar.js";
|
|
6
6
|
import { hostDraws } from "./split-view.js";
|
|
7
7
|
import { Text } from "./text.js";
|
|
8
|
+
import { svgIconMarkup } from "./svg-icon.js";
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
9
10
|
/**
|
|
10
11
|
* On macOS a row of the sidebar's source list, a model object the desktop host builds an
|
|
@@ -27,6 +28,7 @@ registerViewName('sidebar-item', {
|
|
|
27
28
|
*
|
|
28
29
|
* Content inside the element replaces the default row of icon, label and badge: its pressables
|
|
29
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.
|
|
30
32
|
*/
|
|
31
33
|
export class SidebarItem extends ControlBase {
|
|
32
34
|
sidebar = inject(Sidebar, { optional: true });
|
|
@@ -42,7 +44,10 @@ export class SidebarItem extends ControlBase {
|
|
|
42
44
|
...(ngDevMode ? [undefined, { debugName: "sfSymbol" }] : /* istanbul ignore next */ []));
|
|
43
45
|
/** Android: a drawable resource before the label. */
|
|
44
46
|
drawableName = input(undefined, { ...(ngDevMode ? { debugName: "drawableName" } : /* istanbul ignore next */ {}), alias: 'drawable' });
|
|
45
|
-
/**
|
|
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
|
+
*/
|
|
46
51
|
icon = input(/* @ts-ignore */
|
|
47
52
|
...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
48
53
|
/** Whether this is the sidebar's selected item. A `path` from the router sets it by route. */
|
|
@@ -50,6 +55,16 @@ export class SidebarItem extends ControlBase {
|
|
|
50
55
|
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
51
56
|
/** The user chose this item. */
|
|
52
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 */ []));
|
|
53
68
|
symbol = computed(() => {
|
|
54
69
|
const icon = this.icon();
|
|
55
70
|
return this.sfSymbol() ?? (icon && 'sfSymbol' in icon ? icon.sfSymbol : undefined);
|
|
@@ -60,7 +75,10 @@ export class SidebarItem extends ControlBase {
|
|
|
60
75
|
return this.drawableName() ?? (icon && 'drawable' in icon ? icon.drawable : undefined);
|
|
61
76
|
}, /* @ts-ignore */
|
|
62
77
|
...(ngDevMode ? [{ debugName: "drawableResource" }] : /* istanbul ignore next */ []));
|
|
78
|
+
svgIcon = computed(() => svgIconMarkup(this.icon(), 'sidebar-item'), /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "svgIcon" }] : /* istanbul ignore next */ []));
|
|
63
80
|
stopSelect = null;
|
|
81
|
+
stopEmphasis = null;
|
|
64
82
|
constructor() {
|
|
65
83
|
super();
|
|
66
84
|
const remove = this.sidebar?.addRow(this);
|
|
@@ -89,10 +107,16 @@ export class SidebarItem extends ControlBase {
|
|
|
89
107
|
if (event.target === this.node)
|
|
90
108
|
this.choose();
|
|
91
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
|
+
});
|
|
92
115
|
}
|
|
93
116
|
ngOnDestroy() {
|
|
94
117
|
super.ngOnDestroy();
|
|
95
118
|
this.stopSelect?.();
|
|
119
|
+
this.stopEmphasis?.();
|
|
96
120
|
}
|
|
97
121
|
/** The user chose this row: select it, deselect the rest, and say so. */
|
|
98
122
|
choose() {
|
|
@@ -106,7 +130,7 @@ export class SidebarItem extends ControlBase {
|
|
|
106
130
|
this.selected.set(false);
|
|
107
131
|
}
|
|
108
132
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: SidebarItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
109
|
-
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: [
|
|
110
134
|
{ provide: TouchableBase, useExisting: forwardRef(() => SidebarItem) },
|
|
111
135
|
{
|
|
112
136
|
provide: SIDEBAR_SELECTION,
|
|
@@ -145,8 +169,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
|
|
|
145
169
|
'[badge]': 'drawnHere ? undefined : badge()',
|
|
146
170
|
'[sfSymbol]': 'drawnHere ? undefined : symbol()',
|
|
147
171
|
'[drawable]': 'drawnHere ? undefined : drawableResource()',
|
|
172
|
+
'[svgIcon]': 'drawnHere ? undefined : svgIcon()',
|
|
148
173
|
'[selected]': 'drawnHere ? undefined : selected()',
|
|
149
174
|
'[attr.data-selected]': "selected() ? '' : null",
|
|
175
|
+
'[attr.data-emphasized]': "emphasized() ? '' : null",
|
|
150
176
|
'[class.sidebar-item-drawn]': 'drawnHere',
|
|
151
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 "] }]
|
|
152
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"] }] } });
|
package/dist/sidebar-item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAmB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;;AAEjC;;;;GAIG;AACH,gBAAgB,CAAC,cAAc,EAAE;IAC/B,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,qBAAqB;CAC7B,CAAC,CAAC;AAKH;;;;;;;;;;;GAWG;AA8CH,MAAM,OAAO,WAAY,SAAQ,WAAW;IACzB,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,sEAAsE;IACnD,SAAS,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAE1D,mDAAmD;IAC1C,KAAK,GAAG,KAAK;yFAAU,CAAC;IACjC,oDAAoD;IAC3C,KAAK,GAAG,K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WAAW;2FAAX,WAAW,ytCAjBX;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;;2FA2CH,WAAW;kBA7CvB,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,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 { 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';\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 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 /** 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,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAmB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;;AAE9C;;;;GAIG;AACH,gBAAgB,CAAC,cAAc,EAAE;IAC/B,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,qBAAqB;CAC7B,CAAC,CAAC;AAKH;;;;;;;;;;;;GAYG;AAgDH,MAAM,OAAO,WAAY,SAAQ,WAAW;IACzB,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,sEAAsE;IACnD,SAAS,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAE1D,mDAAmD;IAC1C,KAAK,GAAG,KAAK;yFAAU,CAAC;IACjC,oDAAoD;IAC3C,KAAK,GAAG,KAAK,CAAyD,SAAS,6EACtF,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,K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;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"]}
|
|
@@ -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.js","sourceRoot":"","sources":["../../src/stand-ins/reanimated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,IAAI,WAAW,EAA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**\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,IAAI,CAAC,CAAC;IACjB,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,UAAU,UAAU,CAAI,EAAK,EAAE,OAAgB,EAA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AC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC;AAClC,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC;AAC7B,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,QAAQ;IACf,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,KAAK;IACX,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,KAAK;IACf,EAAE,EAAE,CAAC,MAA6B,EAAE,EAAE,CAAC,MAAM;IAC7C,GAAG,EAAE,CAAC,MAA6B,EAAE,EAAE,CAAC,MAAM;IAC9C,KAAK,EAAE,CAAC,MAA6B,EAAE,EAAE,CAAC,MAAM;CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAW,CAAC;AAE5F,MAAM,UAAU,OAAO,CAAyB,EAAqB;IACnE,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\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"]}
|