@ng-native/components 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +78 -1
  3. package/dist/activity-indicator.d.ts +41 -0
  4. package/dist/activity-indicator.js +66 -0
  5. package/dist/activity-indicator.js.map +1 -0
  6. package/dist/animated-style.d.ts +31 -0
  7. package/dist/animated-style.js +102 -0
  8. package/dist/animated-style.js.map +1 -0
  9. package/dist/animated.d.ts +125 -0
  10. package/dist/animated.js +538 -0
  11. package/dist/animated.js.map +1 -0
  12. package/dist/animation.d.ts +40 -0
  13. package/dist/animation.js +20 -0
  14. package/dist/animation.js.map +1 -0
  15. package/dist/animations-web.d.ts +8 -0
  16. package/dist/animations-web.js +31 -0
  17. package/dist/animations-web.js.map +1 -0
  18. package/dist/animations.d.ts +7 -0
  19. package/dist/animations.js +58 -0
  20. package/dist/animations.js.map +1 -0
  21. package/dist/controlled-model.d.ts +33 -0
  22. package/dist/controlled-model.js +47 -0
  23. package/dist/controlled-model.js.map +1 -0
  24. package/dist/easing.d.ts +21 -0
  25. package/dist/easing.js +50 -0
  26. package/dist/easing.js.map +1 -0
  27. package/dist/events.d.ts +169 -0
  28. package/dist/events.js +2 -0
  29. package/dist/events.js.map +1 -0
  30. package/dist/gesture-backend.d.ts +26 -0
  31. package/dist/gesture-backend.js +14 -0
  32. package/dist/gesture-backend.js.map +1 -0
  33. package/dist/gesture-dispatch.d.ts +67 -0
  34. package/dist/gesture-dispatch.js +106 -0
  35. package/dist/gesture-dispatch.js.map +1 -0
  36. package/dist/gestures.d.ts +23 -0
  37. package/dist/gestures.js +164 -0
  38. package/dist/gestures.js.map +1 -0
  39. package/dist/height-index.d.ts +31 -0
  40. package/dist/height-index.js +80 -0
  41. package/dist/height-index.js.map +1 -0
  42. package/dist/image-background.d.ts +32 -0
  43. package/dist/image-background.js +80 -0
  44. package/dist/image-background.js.map +1 -0
  45. package/dist/image.d.ts +79 -0
  46. package/dist/image.js +155 -0
  47. package/dist/image.js.map +1 -0
  48. package/dist/index.d.ts +38 -0
  49. package/dist/index.js +39 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/input-accessory-view.d.ts +16 -0
  52. package/dist/input-accessory-view.js +29 -0
  53. package/dist/input-accessory-view.js.map +1 -0
  54. package/dist/keyboard-avoiding-view.d.ts +79 -0
  55. package/dist/keyboard-avoiding-view.js +172 -0
  56. package/dist/keyboard-avoiding-view.js.map +1 -0
  57. package/dist/keyboard-dock.d.ts +126 -0
  58. package/dist/keyboard-dock.js +327 -0
  59. package/dist/keyboard-dock.js.map +1 -0
  60. package/dist/keyboard-taps.d.ts +12 -0
  61. package/dist/keyboard-taps.js +51 -0
  62. package/dist/keyboard-taps.js.map +1 -0
  63. package/dist/modal.d.ts +56 -0
  64. package/dist/modal.js +102 -0
  65. package/dist/modal.js.map +1 -0
  66. package/dist/native-gesture.d.ts +21 -0
  67. package/dist/native-gesture.js +56 -0
  68. package/dist/native-gesture.js.map +1 -0
  69. package/dist/native-ref.d.ts +7 -0
  70. package/dist/native-ref.js +13 -0
  71. package/dist/native-ref.js.map +1 -0
  72. package/dist/pressable.d.ts +220 -0
  73. package/dist/pressable.js +484 -0
  74. package/dist/pressable.js.map +1 -0
  75. package/dist/reanimated.d.ts +19 -0
  76. package/dist/reanimated.js +111 -0
  77. package/dist/reanimated.js.map +1 -0
  78. package/dist/refresh-control.d.ts +50 -0
  79. package/dist/refresh-control.js +103 -0
  80. package/dist/refresh-control.js.map +1 -0
  81. package/dist/safe-area-provider.d.ts +11 -0
  82. package/dist/safe-area-provider.js +70 -0
  83. package/dist/safe-area-provider.js.map +1 -0
  84. package/dist/safe-area-view.d.ts +22 -0
  85. package/dist/safe-area-view.js +77 -0
  86. package/dist/safe-area-view.js.map +1 -0
  87. package/dist/safe-area.d.ts +12 -0
  88. package/dist/safe-area.js +27 -0
  89. package/dist/safe-area.js.map +1 -0
  90. package/dist/scroll-view-props.d.ts +89 -0
  91. package/dist/scroll-view-props.js +153 -0
  92. package/dist/scroll-view-props.js.map +1 -0
  93. package/dist/scroll-view.d.ts +95 -0
  94. package/dist/scroll-view.js +181 -0
  95. package/dist/scroll-view.js.map +1 -0
  96. package/dist/section-list.d.ts +146 -0
  97. package/dist/section-list.js +300 -0
  98. package/dist/section-list.js.map +1 -0
  99. package/dist/sticky-headers.d.ts +41 -0
  100. package/dist/sticky-headers.js +118 -0
  101. package/dist/sticky-headers.js.map +1 -0
  102. package/dist/swipe-refresh-layout.d.ts +51 -0
  103. package/dist/swipe-refresh-layout.js +162 -0
  104. package/dist/swipe-refresh-layout.js.map +1 -0
  105. package/dist/switch.d.ts +54 -0
  106. package/dist/switch.js +110 -0
  107. package/dist/switch.js.map +1 -0
  108. package/dist/template-slot.d.ts +18 -0
  109. package/dist/template-slot.js +30 -0
  110. package/dist/template-slot.js.map +1 -0
  111. package/dist/text-input.d.ts +168 -0
  112. package/dist/text-input.js +312 -0
  113. package/dist/text-input.js.map +1 -0
  114. package/dist/text.d.ts +70 -0
  115. package/dist/text.js +111 -0
  116. package/dist/text.js.map +1 -0
  117. package/dist/touchable-opacity.d.ts +36 -0
  118. package/dist/touchable-opacity.js +76 -0
  119. package/dist/touchable-opacity.js.map +1 -0
  120. package/dist/transforms.d.ts +2 -0
  121. package/dist/transforms.js +17 -0
  122. package/dist/transforms.js.map +1 -0
  123. package/dist/view-base.d.ts +332 -0
  124. package/dist/view-base.js +534 -0
  125. package/dist/view-base.js.map +1 -0
  126. package/dist/view.d.ts +12 -0
  127. package/dist/view.js +18 -0
  128. package/dist/view.js.map +1 -0
  129. package/dist/virtual-list.d.ts +530 -0
  130. package/dist/virtual-list.js +1150 -0
  131. package/dist/virtual-list.js.map +1 -0
  132. package/dist/worklet-scroll.d.ts +13 -0
  133. package/dist/worklet-scroll.js +49 -0
  134. package/dist/worklet-scroll.js.map +1 -0
  135. package/dist/worklet-style.d.ts +13 -0
  136. package/dist/worklet-style.js +47 -0
  137. package/dist/worklet-style.js.map +1 -0
  138. package/dist/worklets.d.ts +89 -0
  139. package/dist/worklets.js +42 -0
  140. package/dist/worklets.js.map +1 -0
  141. package/dist/written-props.d.ts +6 -0
  142. package/dist/written-props.js +180 -0
  143. package/dist/written-props.js.map +1 -0
  144. package/package.json +88 -3
@@ -0,0 +1,80 @@
1
+ import { Component, computed, input } from '@angular/core';
2
+ import { Image } from "./image.js";
3
+ import { ViewBase } from "./view-base.js";
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * A view with an image behind its children. RN's `ImageBackground` is a `View` wrapping an
7
+ * absolutely-filled `Image`; there is no native component for it.
8
+ *
9
+ * `imageStyle` styles the image itself. RN also copies the outer style's width and height onto
10
+ * the image, a documented workaround for the image otherwise sizing itself; that is done here
11
+ * from `[style]`, and a background with no size there fills its box at 100%.
12
+ */
13
+ export class ImageBackground extends ViewBase {
14
+ source = input(/* @ts-ignore */
15
+ ...(ngDevMode ? [undefined, { debugName: "source" }] : /* istanbul ignore next */ []));
16
+ defaultSource = input(/* @ts-ignore */
17
+ ...(ngDevMode ? [undefined, { debugName: "defaultSource" }] : /* istanbul ignore next */ []));
18
+ resizeMode = input('cover', /* @ts-ignore */
19
+ ...(ngDevMode ? [{ debugName: "resizeMode" }] : /* istanbul ignore next */ []));
20
+ blurRadius = input(/* @ts-ignore */
21
+ ...(ngDevMode ? [undefined, { debugName: "blurRadius" }] : /* istanbul ignore next */ []));
22
+ tintColor = input(/* @ts-ignore */
23
+ ...(ngDevMode ? [undefined, { debugName: "tintColor" }] : /* istanbul ignore next */ []));
24
+ alt = input(/* @ts-ignore */
25
+ ...(ngDevMode ? [undefined, { debugName: "alt" }] : /* istanbul ignore next */ []));
26
+ /** Styles applied to the image rather than the container. */
27
+ imageStyle = input(/* @ts-ignore */
28
+ ...(ngDevMode ? [undefined, { debugName: "imageStyle" }] : /* istanbul ignore next */ []));
29
+ fill = computed(() => {
30
+ const outer = this.node.props['style'];
31
+ return {
32
+ position: 'absolute',
33
+ top: 0,
34
+ left: 0,
35
+ bottom: 0,
36
+ right: 0,
37
+ // A background sized by a class has nothing in its style to copy. Left unsized, the image
38
+ // would take its picture's own size rather than the box it is meant to fill.
39
+ width: outer?.width ?? '100%',
40
+ height: outer?.height ?? '100%',
41
+ ...this.imageStyle(),
42
+ };
43
+ }, /* @ts-ignore */
44
+ ...(ngDevMode ? [{ debugName: "fill" }] : /* istanbul ignore next */ []));
45
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ImageBackground, deps: null, target: i0.ɵɵFactoryTarget.Component });
46
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.2.0", type: ImageBackground, isStandalone: true, selector: "image-background", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, defaultSource: { classPropertyName: "defaultSource", publicName: "defaultSource", isSignal: true, isRequired: false, transformFunction: null }, resizeMode: { classPropertyName: "resizeMode", publicName: "resizeMode", isSignal: true, isRequired: false, transformFunction: null }, blurRadius: { classPropertyName: "blurRadius", publicName: "blurRadius", isSignal: true, isRequired: false, transformFunction: null }, tintColor: { classPropertyName: "tintColor", publicName: "tintColor", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, imageStyle: { classPropertyName: "imageStyle", publicName: "imageStyle", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: `
47
+ <image
48
+ [source]="source()"
49
+ [style]="fill()"
50
+ [resizeMode]="resizeMode()"
51
+ [blurRadius]="blurRadius()"
52
+ [tintColor]="tintColor()"
53
+ [defaultSource]="defaultSource()"
54
+ [alt]="alt()"
55
+ accessibilityIgnoresInvertColors="true"
56
+ />
57
+ <ng-content />
58
+ `, isInline: true, dependencies: [{ kind: "directive", type: Image, selector: "image", inputs: ["source", "src", "srcSet", "defaultSource", "loadingIndicatorSource", "resizeMode", "resizeMethod", "resizeMultiplier", "blurRadius", "capInsets", "tintColor", "fadeDuration", "progressiveRenderingEnabled", "alt", "crossOrigin", "referrerPolicy"] }] });
59
+ }
60
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ImageBackground, decorators: [{
61
+ type: Component,
62
+ args: [{
63
+ selector: 'image-background',
64
+ imports: [Image],
65
+ template: `
66
+ <image
67
+ [source]="source()"
68
+ [style]="fill()"
69
+ [resizeMode]="resizeMode()"
70
+ [blurRadius]="blurRadius()"
71
+ [tintColor]="tintColor()"
72
+ [defaultSource]="defaultSource()"
73
+ [alt]="alt()"
74
+ accessibilityIgnoresInvertColors="true"
75
+ />
76
+ <ng-content />
77
+ `,
78
+ }]
79
+ }], propDecorators: { source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: false }] }], defaultSource: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultSource", required: false }] }], resizeMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizeMode", required: false }] }], blurRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "blurRadius", required: false }] }], tintColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "tintColor", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], imageStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "imageStyle", required: false }] }] } });
80
+ //# sourceMappingURL=image-background.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-background.js","sourceRoot":"","sources":["../src/image-background.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,KAAK,EAA0C,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;;AAE1C;;;;;;;GAOG;AAkBH,MAAM,OAAO,eAAgB,SAAQ,QAAQ;IAClC,MAAM,GAAG,KAAK;0FAAe,CAAC;IAC9B,aAAa,GAAG,KAAK;iGAAe,CAAC;IACrC,UAAU,GAAG,KAAK,CAAkB,OAAO;mFAAC,CAAC;IAC7C,UAAU,GAAG,KAAK;8FAAU,CAAC;IAC7B,SAAS,GAAG,KAAK;6FAAU,CAAC;IAC5B,GAAG,GAAG,KAAK;uFAAU,CAAC;IAC/B,6DAA6D;IACpD,UAAU,GAAG,KAAK;8FAA2B,CAAC;IAEpC,IAAI,GAAG,QAAQ,CAAC,GAAG,EAAE;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAsD,CAAC;QAC5F,OAAO;YACL,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;YACP,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,CAAC;YACR,0FAA0F;YAC1F,6EAA6E;YAC7E,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,MAAM;YAC7B,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,MAAM;YAC/B,GAAG,IAAI,CAAC,UAAU,EAAE;SACrB,CAAC;IACJ,CAAC;6EAAC,CAAC;uGAxBQ,eAAe;2FAAf,eAAe,qgCAdhB;;;;;;;;;;;;GAYT,4DAbS,KAAK;;2FAeJ,eAAe;kBAjB3B,SAAS;mBAAC;oBACT,QAAQ,EAAE,kBAAkB;oBAC5B,OAAO,EAAE,CAAC,KAAK,CAAC;oBAChB,QAAQ,EAAE;;;;;;;;;;;;GAYT;iBACF","sourcesContent":["import { Component, computed, input } from '@angular/core';\nimport { Image, type ImageResizeMode, type ImageSource } from './image.ts';\nimport { ViewBase } from './view-base.ts';\n\n/**\n * A view with an image behind its children. RN's `ImageBackground` is a `View` wrapping an\n * absolutely-filled `Image`; there is no native component for it.\n *\n * `imageStyle` styles the image itself. RN also copies the outer style's width and height onto\n * the image, a documented workaround for the image otherwise sizing itself; that is done here\n * from `[style]`, and a background with no size there fills its box at 100%.\n */\n@Component({\n selector: 'image-background',\n imports: [Image],\n template: `\n <image\n [source]=\"source()\"\n [style]=\"fill()\"\n [resizeMode]=\"resizeMode()\"\n [blurRadius]=\"blurRadius()\"\n [tintColor]=\"tintColor()\"\n [defaultSource]=\"defaultSource()\"\n [alt]=\"alt()\"\n accessibilityIgnoresInvertColors=\"true\"\n />\n <ng-content />\n `,\n})\nexport class ImageBackground extends ViewBase {\n readonly source = input<ImageSource>();\n readonly defaultSource = input<ImageSource>();\n readonly resizeMode = input<ImageResizeMode>('cover');\n readonly blurRadius = input<number>();\n readonly tintColor = input<string>();\n readonly alt = input<string>();\n /** Styles applied to the image rather than the container. */\n readonly imageStyle = input<Record<string, unknown>>();\n\n protected readonly fill = computed(() => {\n const outer = this.node.props['style'] as { width?: unknown; height?: unknown } | undefined;\n return {\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n // A background sized by a class has nothing in its style to copy. Left unsized, the image\n // would take its picture's own size rather than the box it is meant to fill.\n width: outer?.width ?? '100%',\n height: outer?.height ?? '100%',\n ...this.imageStyle(),\n };\n });\n}\n"]}
@@ -0,0 +1,79 @@
1
+ import type { Insets } from './events.ts';
2
+ import { ViewBase } from './view-base.ts';
3
+ import * as i0 from "@angular/core";
4
+ /** A remote or local image, or several at different scales for native to choose between. */
5
+ export interface ImageURISource {
6
+ readonly uri: string;
7
+ readonly width?: number;
8
+ readonly height?: number;
9
+ readonly scale?: number;
10
+ readonly headers?: Readonly<Record<string, string>>;
11
+ readonly method?: string;
12
+ readonly body?: string;
13
+ readonly cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached';
14
+ }
15
+ /** A `require()`d asset compiles to a number; the host resolves it at commit time. */
16
+ export type ImageSource = number | ImageURISource | readonly ImageURISource[];
17
+ export type ImageResizeMode = 'cover' | 'contain' | 'stretch' | 'repeat' | 'center' | 'none';
18
+ /**
19
+ * An image. Commits as `RCTImageView`.
20
+ *
21
+ * What RN's `Image.js` does before native sees the props is done here: a `require()`d asset is
22
+ * resolved and its own width and height become the default size, `src` and `srcSet` are turned
23
+ * into sources, `alt` becomes the accessibility label, and `crossOrigin` and `referrerPolicy`
24
+ * become request headers. A `tintColor` given in `[style]` reaches native as it does in RN,
25
+ * because the engine flattens style into props.
26
+ *
27
+ * Events are element events: `(load)`, `(error)`, `(loadStart)`, `(loadEnd)`, `(progress)`.
28
+ */
29
+ export declare class Image extends ViewBase {
30
+ /** `Image.ios.js`: alt text is what makes an image worth stopping on. */
31
+ protected accessibleByDefault(): boolean;
32
+ /** And it is the label, unless the app gave a better one. */
33
+ protected labelByDefault(): string | undefined;
34
+ /** What to show: a `require()`d asset, a `{uri}` object, or a list of them. */
35
+ readonly source: import("@angular/core").InputSignal<ImageSource | undefined>;
36
+ /** `src`: a bare URI, the web spelling of `source`. */
37
+ readonly src: import("@angular/core").InputSignal<string | undefined>;
38
+ /** `srcSet`: URIs at several scales, as HTML writes it. */
39
+ readonly srcSet: import("@angular/core").InputSignal<string | undefined>;
40
+ /** Shown until `source` loads. */
41
+ readonly defaultSource: import("@angular/core").InputSignal<ImageSource | undefined>;
42
+ /** Android: an image shown in place of the loading indicator. */
43
+ readonly loadingIndicatorSource: import("@angular/core").InputSignal<ImageURISource | undefined>;
44
+ /** How the image fits its box. Defaults to `cover`. */
45
+ readonly resizeMode: import("@angular/core").InputSignal<ImageResizeMode | undefined>;
46
+ /** Android: how a large image is scaled down while decoding. */
47
+ readonly resizeMethod: import("@angular/core").InputSignal<"none" | "auto" | "resize" | "scale" | undefined>;
48
+ /** Android: the factor `resizeMethod: 'resize'` scales by. */
49
+ readonly resizeMultiplier: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
50
+ /** A blur applied to the image. */
51
+ readonly blurRadius: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
52
+ /** iOS: the edges of a stretchable image that must not stretch. */
53
+ readonly capInsets: import("@angular/core").InputSignal<Insets | undefined>;
54
+ /** Recolour every opaque pixel; for icons. May also come from `[style]`. */
55
+ readonly tintColor: import("@angular/core").InputSignal<string | undefined>;
56
+ /** Android: how long the fade-in takes, in ms. Defaults to 300. */
57
+ readonly fadeDuration: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
58
+ /** Android: show a progressive JPEG as it loads. */
59
+ readonly progressiveRenderingEnabled: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
60
+ /** Text describing the image for a screen reader; sets `accessible` too. */
61
+ readonly alt: import("@angular/core").InputSignal<string | undefined>;
62
+ /** Send credentials with the request, as the HTML attribute means. */
63
+ readonly crossOrigin: import("@angular/core").InputSignal<"anonymous" | "use-credentials" | undefined>;
64
+ /** The `Referrer-Policy` header for the request. */
65
+ readonly referrerPolicy: import("@angular/core").InputSignal<string | undefined>;
66
+ /** `source` alone, resolved once however many things read it. */
67
+ private readonly fromSource;
68
+ /** Every source form, resolved to the list native reads. */
69
+ protected readonly resolvedSource: import("@angular/core").Signal<readonly ImageURISource[] | undefined>;
70
+ /** A single source's own size, which RN uses as the default box, as an `<img>` does. */
71
+ protected readonly intrinsic: import("@angular/core").Signal<{
72
+ width: number;
73
+ height: number;
74
+ } | undefined>;
75
+ private fromSrc;
76
+ private headers;
77
+ static ɵfac: i0.ɵɵFactoryDeclaration<Image, never>;
78
+ static ɵdir: i0.ɵɵDirectiveDeclaration<Image, "image", never, { "source": { "alias": "source"; "required": false; "isSignal": true; }; "src": { "alias": "src"; "required": false; "isSignal": true; }; "srcSet": { "alias": "srcSet"; "required": false; "isSignal": true; }; "defaultSource": { "alias": "defaultSource"; "required": false; "isSignal": true; }; "loadingIndicatorSource": { "alias": "loadingIndicatorSource"; "required": false; "isSignal": true; }; "resizeMode": { "alias": "resizeMode"; "required": false; "isSignal": true; }; "resizeMethod": { "alias": "resizeMethod"; "required": false; "isSignal": true; }; "resizeMultiplier": { "alias": "resizeMultiplier"; "required": false; "isSignal": true; }; "blurRadius": { "alias": "blurRadius"; "required": false; "isSignal": true; }; "capInsets": { "alias": "capInsets"; "required": false; "isSignal": true; }; "tintColor": { "alias": "tintColor"; "required": false; "isSignal": true; }; "fadeDuration": { "alias": "fadeDuration"; "required": false; "isSignal": true; }; "progressiveRenderingEnabled": { "alias": "progressiveRenderingEnabled"; "required": false; "isSignal": true; }; "alt": { "alias": "alt"; "required": false; "isSignal": true; }; "crossOrigin": { "alias": "crossOrigin"; "required": false; "isSignal": true; }; "referrerPolicy": { "alias": "referrerPolicy"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
79
+ }
package/dist/image.js ADDED
@@ -0,0 +1,155 @@
1
+ import { Directive, computed, input } from '@angular/core';
2
+ import { optionalBoolean, optionalNumber } from "./transforms.js";
3
+ import { ViewBase } from "./view-base.js";
4
+ import * as i0 from "@angular/core";
5
+ /** Parse an HTML `srcset`: `"a.png 1x, a@2x.png 2x"`. */
6
+ function parseSrcSet(srcSet) {
7
+ return srcSet
8
+ .split(',')
9
+ .map((entry) => entry.trim())
10
+ .filter(Boolean)
11
+ .map((entry) => {
12
+ const [uri, descriptor] = entry.split(/\s+/);
13
+ const scale = descriptor?.endsWith('x') ? Number(descriptor.slice(0, -1)) : 1;
14
+ return { uri: uri, scale: Number.isFinite(scale) ? scale : 1 };
15
+ });
16
+ }
17
+ /**
18
+ * An image. Commits as `RCTImageView`.
19
+ *
20
+ * What RN's `Image.js` does before native sees the props is done here: a `require()`d asset is
21
+ * resolved and its own width and height become the default size, `src` and `srcSet` are turned
22
+ * into sources, `alt` becomes the accessibility label, and `crossOrigin` and `referrerPolicy`
23
+ * become request headers. A `tintColor` given in `[style]` reaches native as it does in RN,
24
+ * because the engine flattens style into props.
25
+ *
26
+ * Events are element events: `(load)`, `(error)`, `(loadStart)`, `(loadEnd)`, `(progress)`.
27
+ */
28
+ export class Image extends ViewBase {
29
+ /** `Image.ios.js`: alt text is what makes an image worth stopping on. */
30
+ accessibleByDefault() {
31
+ return this.alt() !== undefined;
32
+ }
33
+ /** And it is the label, unless the app gave a better one. */
34
+ labelByDefault() {
35
+ return this.alt();
36
+ }
37
+ /** What to show: a `require()`d asset, a `{uri}` object, or a list of them. */
38
+ source = input(/* @ts-ignore */
39
+ ...(ngDevMode ? [undefined, { debugName: "source" }] : /* istanbul ignore next */ []));
40
+ /** `src`: a bare URI, the web spelling of `source`. */
41
+ src = input(/* @ts-ignore */
42
+ ...(ngDevMode ? [undefined, { debugName: "src" }] : /* istanbul ignore next */ []));
43
+ /** `srcSet`: URIs at several scales, as HTML writes it. */
44
+ srcSet = input(/* @ts-ignore */
45
+ ...(ngDevMode ? [undefined, { debugName: "srcSet" }] : /* istanbul ignore next */ []));
46
+ /** Shown until `source` loads. */
47
+ defaultSource = input(/* @ts-ignore */
48
+ ...(ngDevMode ? [undefined, { debugName: "defaultSource" }] : /* istanbul ignore next */ []));
49
+ /** Android: an image shown in place of the loading indicator. */
50
+ loadingIndicatorSource = input(/* @ts-ignore */
51
+ ...(ngDevMode ? [undefined, { debugName: "loadingIndicatorSource" }] : /* istanbul ignore next */ []));
52
+ /** How the image fits its box. Defaults to `cover`. */
53
+ resizeMode = input(/* @ts-ignore */
54
+ ...(ngDevMode ? [undefined, { debugName: "resizeMode" }] : /* istanbul ignore next */ []));
55
+ /** Android: how a large image is scaled down while decoding. */
56
+ resizeMethod = input(/* @ts-ignore */
57
+ ...(ngDevMode ? [undefined, { debugName: "resizeMethod" }] : /* istanbul ignore next */ []));
58
+ /** Android: the factor `resizeMethod: 'resize'` scales by. */
59
+ resizeMultiplier = input(undefined, { ...(ngDevMode ? { debugName: "resizeMultiplier" } : /* istanbul ignore next */ {}), transform: optionalNumber });
60
+ /** A blur applied to the image. */
61
+ blurRadius = input(undefined, { ...(ngDevMode ? { debugName: "blurRadius" } : /* istanbul ignore next */ {}), transform: optionalNumber });
62
+ /** iOS: the edges of a stretchable image that must not stretch. */
63
+ capInsets = input(/* @ts-ignore */
64
+ ...(ngDevMode ? [undefined, { debugName: "capInsets" }] : /* istanbul ignore next */ []));
65
+ /** Recolour every opaque pixel; for icons. May also come from `[style]`. */
66
+ tintColor = input(/* @ts-ignore */
67
+ ...(ngDevMode ? [undefined, { debugName: "tintColor" }] : /* istanbul ignore next */ []));
68
+ /** Android: how long the fade-in takes, in ms. Defaults to 300. */
69
+ fadeDuration = input(undefined, { ...(ngDevMode ? { debugName: "fadeDuration" } : /* istanbul ignore next */ {}), transform: optionalNumber });
70
+ /** Android: show a progressive JPEG as it loads. */
71
+ progressiveRenderingEnabled = input(undefined, { ...(ngDevMode ? { debugName: "progressiveRenderingEnabled" } : /* istanbul ignore next */ {}), transform: optionalBoolean });
72
+ /** Text describing the image for a screen reader; sets `accessible` too. */
73
+ alt = input(/* @ts-ignore */
74
+ ...(ngDevMode ? [undefined, { debugName: "alt" }] : /* istanbul ignore next */ []));
75
+ /** Send credentials with the request, as the HTML attribute means. */
76
+ crossOrigin = input(/* @ts-ignore */
77
+ ...(ngDevMode ? [undefined, { debugName: "crossOrigin" }] : /* istanbul ignore next */ []));
78
+ /** The `Referrer-Policy` header for the request. */
79
+ referrerPolicy = input(/* @ts-ignore */
80
+ ...(ngDevMode ? [undefined, { debugName: "referrerPolicy" }] : /* istanbul ignore next */ []));
81
+ /** `source` alone, resolved once however many things read it. */
82
+ fromSource = computed(() => {
83
+ const source = this.source();
84
+ if (source === undefined)
85
+ return [];
86
+ if (Array.isArray(source))
87
+ return source;
88
+ const resolved = this.engine.resolveAsset(source);
89
+ return resolved ? [resolved] : [];
90
+ }, /* @ts-ignore */
91
+ ...(ngDevMode ? [{ debugName: "fromSource" }] : /* istanbul ignore next */ []));
92
+ /** Every source form, resolved to the list native reads. */
93
+ resolvedSource = computed(() => {
94
+ const listed = [...this.fromSource(), ...this.fromSrc()];
95
+ if (!listed.length)
96
+ return undefined;
97
+ const headers = this.headers();
98
+ return headers
99
+ ? listed.map((one) => ({ ...one, headers: { ...one.headers, ...headers } }))
100
+ : listed;
101
+ }, /* @ts-ignore */
102
+ ...(ngDevMode ? [{ debugName: "resolvedSource" }] : /* istanbul ignore next */ []));
103
+ /** A single source's own size, which RN uses as the default box, as an `<img>` does. */
104
+ intrinsic = computed(() => {
105
+ const source = this.source();
106
+ if (this.src() || this.srcSet() || Array.isArray(source))
107
+ return undefined;
108
+ const [one] = this.fromSource();
109
+ return one?.width !== undefined && one.height !== undefined
110
+ ? { width: one.width, height: one.height }
111
+ : undefined;
112
+ }, /* @ts-ignore */
113
+ ...(ngDevMode ? [{ debugName: "intrinsic" }] : /* istanbul ignore next */ []));
114
+ fromSrc() {
115
+ const set = this.srcSet();
116
+ const src = this.src();
117
+ const out = set ? parseSrcSet(set) : [];
118
+ if (src && !out.some((one) => one.scale === 1))
119
+ out.push({ uri: src, scale: 1 });
120
+ return out;
121
+ }
122
+ headers() {
123
+ const headers = {};
124
+ const cors = this.crossOrigin();
125
+ if (cors === 'use-credentials')
126
+ headers['Access-Control-Allow-Credentials'] = 'true';
127
+ const referrer = this.referrerPolicy();
128
+ if (referrer)
129
+ headers['Referrer-Policy'] = referrer;
130
+ return Object.keys(headers).length ? headers : null;
131
+ }
132
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: Image, deps: null, target: i0.ɵɵFactoryTarget.Directive });
133
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.0", type: Image, isStandalone: true, selector: "image", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, srcSet: { classPropertyName: "srcSet", publicName: "srcSet", isSignal: true, isRequired: false, transformFunction: null }, defaultSource: { classPropertyName: "defaultSource", publicName: "defaultSource", isSignal: true, isRequired: false, transformFunction: null }, loadingIndicatorSource: { classPropertyName: "loadingIndicatorSource", publicName: "loadingIndicatorSource", isSignal: true, isRequired: false, transformFunction: null }, resizeMode: { classPropertyName: "resizeMode", publicName: "resizeMode", isSignal: true, isRequired: false, transformFunction: null }, resizeMethod: { classPropertyName: "resizeMethod", publicName: "resizeMethod", isSignal: true, isRequired: false, transformFunction: null }, resizeMultiplier: { classPropertyName: "resizeMultiplier", publicName: "resizeMultiplier", isSignal: true, isRequired: false, transformFunction: null }, blurRadius: { classPropertyName: "blurRadius", publicName: "blurRadius", isSignal: true, isRequired: false, transformFunction: null }, capInsets: { classPropertyName: "capInsets", publicName: "capInsets", isSignal: true, isRequired: false, transformFunction: null }, tintColor: { classPropertyName: "tintColor", publicName: "tintColor", isSignal: true, isRequired: false, transformFunction: null }, fadeDuration: { classPropertyName: "fadeDuration", publicName: "fadeDuration", isSignal: true, isRequired: false, transformFunction: null }, progressiveRenderingEnabled: { classPropertyName: "progressiveRenderingEnabled", publicName: "progressiveRenderingEnabled", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, crossOrigin: { classPropertyName: "crossOrigin", publicName: "crossOrigin", isSignal: true, isRequired: false, transformFunction: null }, referrerPolicy: { classPropertyName: "referrerPolicy", publicName: "referrerPolicy", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "source": "resolvedSource()", "defaultSource": "defaultSource()", "loadingIndicatorSource": "loadingIndicatorSource()", "resizeMode": "resizeMode()", "resizeMethod": "resizeMethod()", "resizeMultiplier": "resizeMultiplier()", "blurRadius": "blurRadius()", "capInsets": "capInsets()", "tintColor": "tintColor()", "fadeDuration": "fadeDuration()", "progressiveRenderingEnabled": "progressiveRenderingEnabled()", "intrinsicSize": "intrinsic()" } }, usesInheritance: true, ngImport: i0 });
134
+ }
135
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: Image, decorators: [{
136
+ type: Directive,
137
+ args: [{
138
+ selector: 'image',
139
+ host: {
140
+ '[source]': 'resolvedSource()',
141
+ '[defaultSource]': 'defaultSource()',
142
+ '[loadingIndicatorSource]': 'loadingIndicatorSource()',
143
+ '[resizeMode]': 'resizeMode()',
144
+ '[resizeMethod]': 'resizeMethod()',
145
+ '[resizeMultiplier]': 'resizeMultiplier()',
146
+ '[blurRadius]': 'blurRadius()',
147
+ '[capInsets]': 'capInsets()',
148
+ '[tintColor]': 'tintColor()',
149
+ '[fadeDuration]': 'fadeDuration()',
150
+ '[progressiveRenderingEnabled]': 'progressiveRenderingEnabled()',
151
+ '[intrinsicSize]': 'intrinsic()',
152
+ },
153
+ }]
154
+ }], propDecorators: { source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: false }] }], src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: false }] }], srcSet: [{ type: i0.Input, args: [{ isSignal: true, alias: "srcSet", required: false }] }], defaultSource: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultSource", required: false }] }], loadingIndicatorSource: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingIndicatorSource", required: false }] }], resizeMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizeMode", required: false }] }], resizeMethod: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizeMethod", required: false }] }], resizeMultiplier: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizeMultiplier", required: false }] }], blurRadius: [{ type: i0.Input, args: [{ isSignal: true, alias: "blurRadius", required: false }] }], capInsets: [{ type: i0.Input, args: [{ isSignal: true, alias: "capInsets", required: false }] }], tintColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "tintColor", required: false }] }], fadeDuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "fadeDuration", required: false }] }], progressiveRenderingEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "progressiveRenderingEnabled", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], crossOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "crossOrigin", required: false }] }], referrerPolicy: [{ type: i0.Input, args: [{ isSignal: true, alias: "referrerPolicy", required: false }] }] } });
155
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1 @@
1
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AE,cAAc;wBAC9B,aAAa,EAAE,aAAa;wBAC5B,aAAa,EAAE,aAAa;wBAC5B,gBAAgB,EAAE,gBAAgB;wBAClC,+BAA+B,EAAE,+BAA+B;wBAChE,iBAAiB,EAAE,aAAa;qBACjC;iBACF","sourcesContent":["import { Directive, computed, input } from '@angular/core';\nimport type { Insets } from './events.ts';\nimport { optionalBoolean, optionalNumber } from './transforms.ts';\nimport { ViewBase } from './view-base.ts';\n\n/** A remote or local image, or several at different scales for native to choose between. */\nexport interface ImageURISource {\n readonly uri: string;\n readonly width?: number;\n readonly height?: number;\n readonly scale?: number;\n readonly headers?: Readonly<Record<string, string>>;\n readonly method?: string;\n readonly body?: string;\n readonly cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached';\n}\n/** A `require()`d asset compiles to a number; the host resolves it at commit time. */\nexport type ImageSource = number | ImageURISource | readonly ImageURISource[];\n\nexport type ImageResizeMode = 'cover' | 'contain' | 'stretch' | 'repeat' | 'center' | 'none';\n\n/** Parse an HTML `srcset`: `\"a.png 1x, a@2x.png 2x\"`. */\nfunction parseSrcSet(srcSet: string): ImageURISource[] {\n return srcSet\n .split(',')\n .map((entry) => entry.trim())\n .filter(Boolean)\n .map((entry) => {\n const [uri, descriptor] = entry.split(/\\s+/);\n const scale = descriptor?.endsWith('x') ? Number(descriptor.slice(0, -1)) : 1;\n return { uri: uri!, scale: Number.isFinite(scale) ? scale : 1 };\n });\n}\n\n/**\n * An image. Commits as `RCTImageView`.\n *\n * What RN's `Image.js` does before native sees the props is done here: a `require()`d asset is\n * resolved and its own width and height become the default size, `src` and `srcSet` are turned\n * into sources, `alt` becomes the accessibility label, and `crossOrigin` and `referrerPolicy`\n * become request headers. A `tintColor` given in `[style]` reaches native as it does in RN,\n * because the engine flattens style into props.\n *\n * Events are element events: `(load)`, `(error)`, `(loadStart)`, `(loadEnd)`, `(progress)`.\n */\n@Directive({\n selector: 'image',\n host: {\n '[source]': 'resolvedSource()',\n '[defaultSource]': 'defaultSource()',\n '[loadingIndicatorSource]': 'loadingIndicatorSource()',\n '[resizeMode]': 'resizeMode()',\n '[resizeMethod]': 'resizeMethod()',\n '[resizeMultiplier]': 'resizeMultiplier()',\n '[blurRadius]': 'blurRadius()',\n '[capInsets]': 'capInsets()',\n '[tintColor]': 'tintColor()',\n '[fadeDuration]': 'fadeDuration()',\n '[progressiveRenderingEnabled]': 'progressiveRenderingEnabled()',\n '[intrinsicSize]': 'intrinsic()',\n },\n})\nexport class Image extends ViewBase {\n /** `Image.ios.js`: alt text is what makes an image worth stopping on. */\n protected override accessibleByDefault(): boolean {\n return this.alt() !== undefined;\n }\n\n /** And it is the label, unless the app gave a better one. */\n protected override labelByDefault(): string | undefined {\n return this.alt();\n }\n\n /** What to show: a `require()`d asset, a `{uri}` object, or a list of them. */\n readonly source = input<ImageSource>();\n /** `src`: a bare URI, the web spelling of `source`. */\n readonly src = input<string>();\n /** `srcSet`: URIs at several scales, as HTML writes it. */\n readonly srcSet = input<string>();\n /** Shown until `source` loads. */\n readonly defaultSource = input<ImageSource>();\n /** Android: an image shown in place of the loading indicator. */\n readonly loadingIndicatorSource = input<ImageURISource>();\n /** How the image fits its box. Defaults to `cover`. */\n readonly resizeMode = input<ImageResizeMode>();\n /** Android: how a large image is scaled down while decoding. */\n readonly resizeMethod = input<'auto' | 'resize' | 'scale' | 'none'>();\n /** Android: the factor `resizeMethod: 'resize'` scales by. */\n readonly resizeMultiplier = input(undefined, { transform: optionalNumber });\n /** A blur applied to the image. */\n readonly blurRadius = input(undefined, { transform: optionalNumber });\n /** iOS: the edges of a stretchable image that must not stretch. */\n readonly capInsets = input<Insets>();\n /** Recolour every opaque pixel; for icons. May also come from `[style]`. */\n readonly tintColor = input<string>();\n /** Android: how long the fade-in takes, in ms. Defaults to 300. */\n readonly fadeDuration = input(undefined, { transform: optionalNumber });\n /** Android: show a progressive JPEG as it loads. */\n readonly progressiveRenderingEnabled = input(undefined, { transform: optionalBoolean });\n /** Text describing the image for a screen reader; sets `accessible` too. */\n readonly alt = input<string>();\n /** Send credentials with the request, as the HTML attribute means. */\n readonly crossOrigin = input<'anonymous' | 'use-credentials'>();\n /** The `Referrer-Policy` header for the request. */\n readonly referrerPolicy = input<string>();\n\n /** `source` alone, resolved once however many things read it. */\n private readonly fromSource = computed<readonly ImageURISource[]>(() => {\n const source = this.source();\n if (source === undefined) return [];\n if (Array.isArray(source)) return source as readonly ImageURISource[];\n const resolved = this.engine.resolveAsset(source) as ImageURISource | undefined;\n return resolved ? [resolved] : [];\n });\n\n /** Every source form, resolved to the list native reads. */\n protected readonly resolvedSource = computed<readonly ImageURISource[] | undefined>(() => {\n const listed = [...this.fromSource(), ...this.fromSrc()];\n if (!listed.length) return undefined;\n const headers = this.headers();\n return headers\n ? listed.map((one) => ({ ...one, headers: { ...one.headers, ...headers } }))\n : listed;\n });\n\n /** A single source's own size, which RN uses as the default box, as an `<img>` does. */\n protected readonly intrinsic = computed(() => {\n const source = this.source();\n if (this.src() || this.srcSet() || Array.isArray(source)) return undefined;\n const [one] = this.fromSource();\n return one?.width !== undefined && one.height !== undefined\n ? { width: one.width, height: one.height }\n : undefined;\n });\n\n private fromSrc(): readonly ImageURISource[] {\n const set = this.srcSet();\n const src = this.src();\n const out = set ? parseSrcSet(set) : [];\n if (src && !out.some((one) => one.scale === 1)) out.push({ uri: src, scale: 1 });\n return out;\n }\n\n private headers(): Record<string, string> | null {\n const headers: Record<string, string> = {};\n const cors = this.crossOrigin();\n if (cors === 'use-credentials') headers['Access-Control-Allow-Credentials'] = 'true';\n const referrer = this.referrerPolicy();\n if (referrer) headers['Referrer-Policy'] = referrer;\n return Object.keys(headers).length ? headers : null;\n }\n}\n"]}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The host primitives, and the platform-capability tokens they inject.
3
+ *
4
+ * Every element a template renders natively is a component here and must be imported by the
5
+ * component whose template uses it, as any Angular component must. A template that uses one
6
+ * without importing it compiles, renders a plain view, and is reported in dev builds.
7
+ *
8
+ * Importing this barrel evaluates decorators, so anything a Node test needs at runtime has to
9
+ * be reached as a source file instead - see the note in `packages/integration-tests/compile.ts`.
10
+ */
11
+ export { ActivityIndicator } from './activity-indicator.ts';
12
+ export { type AnimatedPropsHandle, type AnimationBackend } from './animation.ts';
13
+ export { type AccessibilityActionEvent, type AccessibilityActionPayload, type ContentSizeChangeEvent, type ImageErrorEvent, type ImageErrorPayload, type ImageLoadEvent, type ImageLoadPayload, type ImageProgressEvent, type ImageProgressPayload, type Insets, type KeyPressEvent, type KeyPressPayload, type LayoutEvent, type LayoutPayload, type OrientationChangeEvent, type OrientationChangePayload, type Point, type Rect, type ScrollEvent, type ScrollPayload, type SelectionChangeEvent, type SelectionChangePayload, type Size, type SwitchChangeEvent, type SwitchChangePayload, type TextInputChangeEvent, type TextInputChangePayload, type TextInputContentSizeEvent, type TextInputContentSizePayload, type TextInputEditingEvent, type TextInputFocusEvent, type TextInputFocusPayload, type TextInputScrollEvent, type TextInputScrollPayload, type TextLayoutEvent, type TextLayoutLine, type TextLayoutPayload, type TouchEvent, type TouchEventPayload, } from './events.ts';
14
+ export { Image, type ImageResizeMode, type ImageSource, type ImageURISource } from './image.ts';
15
+ export { ImageBackground } from './image-background.ts';
16
+ export { InputAccessoryView } from './input-accessory-view.ts';
17
+ export { KEYBOARD_CONTROLLER, KeyboardDock, KeyboardLift, provideKeyboardController, } from './keyboard-dock.ts';
18
+ export { KeyboardAvoidingView, type KeyboardAvoidingBehavior } from './keyboard-avoiding-view.ts';
19
+ export { Modal, type ModalOrientation, type ModalPresentationStyle } from './modal.ts';
20
+ export { NativeRef } from './native-ref.ts';
21
+ export { ControlBase, PressBehavior, Pressable, TouchableBase, type AndroidRipple, type PressEvent, } from './pressable.ts';
22
+ export { RefreshControl } from './refresh-control.ts';
23
+ export { type SafeAreaEdge, type SafeAreaEdges } from './safe-area.ts';
24
+ export { SafeAreaProvider } from './safe-area-provider.ts';
25
+ export { SafeAreaView, type SafeAreaEdgeMode } from './safe-area-view.ts';
26
+ export { type KeyboardShouldPersistTaps } from './keyboard-taps.ts';
27
+ export { ScrollView } from './scroll-view.ts';
28
+ export { SectionFooter, SectionHeader, SectionItem, SectionList, SectionSeparator, type SectionContext, type SectionItemContext, type SectionListSection, type SectionRow, type SectionSeparatorContext, } from './section-list.ts';
29
+ export { Switch } from './switch.ts';
30
+ export { Text, type DynamicTypeRamp, type EllipsizeMode } from './text.ts';
31
+ export { TextInput, type KeyboardType, type ReturnKeyType, type SubmitBehavior, } from './text-input.ts';
32
+ export { TouchableOpacity } from './touchable-opacity.ts';
33
+ export { optionalBoolean, optionalNumber } from './transforms.ts';
34
+ export { View } from './view.ts';
35
+ export { ViewBase, ViewBehavior, contributeAccessibility, type AccessibilityAction, type AccessibilityContribution, type AccessibilityLiveRegion, type AccessibilityRole, type AccessibilityState, type AccessibilityValue, type AndroidDrawable, type ImportantForAccessibility, type PointerEvents, } from './view-base.ts';
36
+ export { VirtualList, VirtualListRow, VirtualListSeparator, type VirtualItemHeight, type VirtualListSeparatorContext, type VirtualListVisiblePosition, type VirtualRow, } from './virtual-list.ts';
37
+ export { type GestureBackend, type GestureSpec, type GestureTarget } from './gesture-backend.ts';
38
+ export { workletScroll, workletStyle, type SharedValue, type WorkletBackend, type WorkletScrollSpec, type WorkletStyleSpec, type WorkletTarget, } from './worklets.ts';
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The host primitives, and the platform-capability tokens they inject.
3
+ *
4
+ * Every element a template renders natively is a component here and must be imported by the
5
+ * component whose template uses it, as any Angular component must. A template that uses one
6
+ * without importing it compiles, renders a plain view, and is reported in dev builds.
7
+ *
8
+ * Importing this barrel evaluates decorators, so anything a Node test needs at runtime has to
9
+ * be reached as a source file instead - see the note in `packages/integration-tests/compile.ts`.
10
+ */
11
+ export { ActivityIndicator } from "./activity-indicator.js";
12
+ export {} from "./animation.js";
13
+ export {} from "./events.js";
14
+ export { Image } from "./image.js";
15
+ export { ImageBackground } from "./image-background.js";
16
+ export { InputAccessoryView } from "./input-accessory-view.js";
17
+ export { KEYBOARD_CONTROLLER, KeyboardDock, KeyboardLift, provideKeyboardController, } from "./keyboard-dock.js";
18
+ export { KeyboardAvoidingView } from "./keyboard-avoiding-view.js";
19
+ export { Modal } from "./modal.js";
20
+ export { NativeRef } from "./native-ref.js";
21
+ export { ControlBase, PressBehavior, Pressable, TouchableBase, } from "./pressable.js";
22
+ export { RefreshControl } from "./refresh-control.js";
23
+ export {} from "./safe-area.js";
24
+ export { SafeAreaProvider } from "./safe-area-provider.js";
25
+ export { SafeAreaView } from "./safe-area-view.js";
26
+ export {} from "./keyboard-taps.js";
27
+ export { ScrollView } from "./scroll-view.js";
28
+ export { SectionFooter, SectionHeader, SectionItem, SectionList, SectionSeparator, } from "./section-list.js";
29
+ export { Switch } from "./switch.js";
30
+ export { Text } from "./text.js";
31
+ export { TextInput, } from "./text-input.js";
32
+ export { TouchableOpacity } from "./touchable-opacity.js";
33
+ export { optionalBoolean, optionalNumber } from "./transforms.js";
34
+ export { View } from "./view.js";
35
+ export { ViewBase, ViewBehavior, contributeAccessibility, } from "./view-base.js";
36
+ export { VirtualList, VirtualListRow, VirtualListSeparator, } from "./virtual-list.js";
37
+ export {} from "./gesture-backend.js";
38
+ export { workletScroll, workletStyle, } from "./worklets.js";
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAmD,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAwCN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAA+D,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,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AM,eAAe,CAAC","sourcesContent":["/**\n * The host primitives, and the platform-capability tokens they inject.\n *\n * Every element a template renders natively is a component here and must be imported by the\n * component whose template uses it, as any Angular component must. A template that uses one\n * without importing it compiles, renders a plain view, and is reported in dev builds.\n *\n * Importing this barrel evaluates decorators, so anything a Node test needs at runtime has to\n * be reached as a source file instead - see the note in `packages/integration-tests/compile.ts`.\n */\nexport { ActivityIndicator } from './activity-indicator.ts';\nexport { type AnimatedPropsHandle, type AnimationBackend } from './animation.ts';\nexport {\n type AccessibilityActionEvent,\n type AccessibilityActionPayload,\n type ContentSizeChangeEvent,\n type ImageErrorEvent,\n type ImageErrorPayload,\n type ImageLoadEvent,\n type ImageLoadPayload,\n type ImageProgressEvent,\n type ImageProgressPayload,\n type Insets,\n type KeyPressEvent,\n type KeyPressPayload,\n type LayoutEvent,\n type LayoutPayload,\n type OrientationChangeEvent,\n type OrientationChangePayload,\n type Point,\n type Rect,\n type ScrollEvent,\n type ScrollPayload,\n type SelectionChangeEvent,\n type SelectionChangePayload,\n type Size,\n type SwitchChangeEvent,\n type SwitchChangePayload,\n type TextInputChangeEvent,\n type TextInputChangePayload,\n type TextInputContentSizeEvent,\n type TextInputContentSizePayload,\n type TextInputEditingEvent,\n type TextInputFocusEvent,\n type TextInputFocusPayload,\n type TextInputScrollEvent,\n type TextInputScrollPayload,\n type TextLayoutEvent,\n type TextLayoutLine,\n type TextLayoutPayload,\n type TouchEvent,\n type TouchEventPayload,\n} from './events.ts';\nexport { Image, type ImageResizeMode, type ImageSource, type ImageURISource } from './image.ts';\nexport { ImageBackground } from './image-background.ts';\nexport { InputAccessoryView } from './input-accessory-view.ts';\nexport {\n KEYBOARD_CONTROLLER,\n KeyboardDock,\n KeyboardLift,\n provideKeyboardController,\n} from './keyboard-dock.ts';\nexport { KeyboardAvoidingView, type KeyboardAvoidingBehavior } from './keyboard-avoiding-view.ts';\nexport { Modal, type ModalOrientation, type ModalPresentationStyle } from './modal.ts';\nexport { NativeRef } from './native-ref.ts';\nexport {\n ControlBase,\n PressBehavior,\n Pressable,\n TouchableBase,\n type AndroidRipple,\n type PressEvent,\n} from './pressable.ts';\nexport { RefreshControl } from './refresh-control.ts';\nexport { type SafeAreaEdge, type SafeAreaEdges } from './safe-area.ts';\nexport { SafeAreaProvider } from './safe-area-provider.ts';\nexport { SafeAreaView, type SafeAreaEdgeMode } from './safe-area-view.ts';\nexport { type KeyboardShouldPersistTaps } from './keyboard-taps.ts';\nexport { ScrollView } from './scroll-view.ts';\nexport {\n SectionFooter,\n SectionHeader,\n SectionItem,\n SectionList,\n SectionSeparator,\n type SectionContext,\n type SectionItemContext,\n type SectionListSection,\n type SectionRow,\n type SectionSeparatorContext,\n} from './section-list.ts';\nexport { Switch } from './switch.ts';\nexport { Text, type DynamicTypeRamp, type EllipsizeMode } from './text.ts';\nexport {\n TextInput,\n type KeyboardType,\n type ReturnKeyType,\n type SubmitBehavior,\n} from './text-input.ts';\nexport { TouchableOpacity } from './touchable-opacity.ts';\nexport { optionalBoolean, optionalNumber } from './transforms.ts';\nexport { View } from './view.ts';\nexport {\n ViewBase,\n ViewBehavior,\n contributeAccessibility,\n type AccessibilityAction,\n type AccessibilityContribution,\n type AccessibilityLiveRegion,\n type AccessibilityRole,\n type AccessibilityState,\n type AccessibilityValue,\n type AndroidDrawable,\n type ImportantForAccessibility,\n type PointerEvents,\n} from './view-base.ts';\nexport {\n VirtualList,\n VirtualListRow,\n VirtualListSeparator,\n type VirtualItemHeight,\n type VirtualListSeparatorContext,\n type VirtualListVisiblePosition,\n type VirtualRow,\n} from './virtual-list.ts';\nexport { type GestureBackend, type GestureSpec, type GestureTarget } from './gesture-backend.ts';\nexport {\n workletScroll,\n workletStyle,\n type SharedValue,\n type WorkletBackend,\n type WorkletScrollSpec,\n type WorkletStyleSpec,\n type WorkletTarget,\n} from './worklets.ts';\n"]}
@@ -0,0 +1,16 @@
1
+ import { ViewBase } from './view-base.ts';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * A bar docked above the keyboard, iOS only. Pair it with a text input by giving this view a
5
+ * `nativeID` and the input the same `inputAccessoryViewID`.
6
+ *
7
+ * RN's wrapper positions the native host absolutely and wraps the content in a safe-area view
8
+ * sized to the window; the first is done here, the second is the caller's choice of content.
9
+ * On Android there is no native counterpart and the element commits as a plain view.
10
+ */
11
+ export declare class InputAccessoryView extends ViewBase {
12
+ /** The bar's background. */
13
+ readonly backgroundColor: import("@angular/core").InputSignal<string | undefined>;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<InputAccessoryView, never>;
15
+ static ɵdir: i0.ɵɵDirectiveDeclaration<InputAccessoryView, "input-accessory-view", never, { "backgroundColor": { "alias": "backgroundColor"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
16
+ }
@@ -0,0 +1,29 @@
1
+ import { Directive, input } from '@angular/core';
2
+ import { ViewBase } from "./view-base.js";
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * A bar docked above the keyboard, iOS only. Pair it with a text input by giving this view a
6
+ * `nativeID` and the input the same `inputAccessoryViewID`.
7
+ *
8
+ * RN's wrapper positions the native host absolutely and wraps the content in a safe-area view
9
+ * sized to the window; the first is done here, the second is the caller's choice of content.
10
+ * On Android there is no native counterpart and the element commits as a plain view.
11
+ */
12
+ export class InputAccessoryView extends ViewBase {
13
+ /** The bar's background. */
14
+ backgroundColor = input(/* @ts-ignore */
15
+ ...(ngDevMode ? [undefined, { debugName: "backgroundColor" }] : /* istanbul ignore next */ []));
16
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: InputAccessoryView, deps: null, target: i0.ɵɵFactoryTarget.Directive });
17
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.0", type: InputAccessoryView, isStandalone: true, selector: "input-accessory-view", inputs: { backgroundColor: { classPropertyName: "backgroundColor", publicName: "backgroundColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "backgroundColor": "backgroundColor()", "style.position": "\"absolute\"" } }, usesInheritance: true, ngImport: i0 });
18
+ }
19
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: InputAccessoryView, decorators: [{
20
+ type: Directive,
21
+ args: [{
22
+ selector: 'input-accessory-view',
23
+ host: {
24
+ '[backgroundColor]': 'backgroundColor()',
25
+ '[style.position]': '"absolute"',
26
+ },
27
+ }]
28
+ }], propDecorators: { backgroundColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "backgroundColor", required: false }] }] } });
29
+ //# sourceMappingURL=input-accessory-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-accessory-view.js","sourceRoot":"","sources":["../src/input-accessory-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;;AAE1C;;;;;;;GAOG;AAQH,MAAM,OAAO,kBAAmB,SAAQ,QAAQ;IAC9C,4BAA4B;IACnB,eAAe,GAAG,KAAK;mGAAU,CAAC;uGAFhC,kBAAkB;2FAAlB,kBAAkB;;2FAAlB,kBAAkB;kBAP9B,SAAS;mBAAC;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,IAAI,EAAE;wBACJ,mBAAmB,EAAE,mBAAmB;wBACxC,kBAAkB,EAAE,YAAY;qBACjC;iBACF","sourcesContent":["import { Directive, input } from '@angular/core';\nimport { ViewBase } from './view-base.ts';\n\n/**\n * A bar docked above the keyboard, iOS only. Pair it with a text input by giving this view a\n * `nativeID` and the input the same `inputAccessoryViewID`.\n *\n * RN's wrapper positions the native host absolutely and wraps the content in a safe-area view\n * sized to the window; the first is done here, the second is the caller's choice of content.\n * On Android there is no native counterpart and the element commits as a plain view.\n */\n@Directive({\n selector: 'input-accessory-view',\n host: {\n '[backgroundColor]': 'backgroundColor()',\n '[style.position]': '\"absolute\"',\n },\n})\nexport class InputAccessoryView extends ViewBase {\n /** The bar's background. */\n readonly backgroundColor = input<string>();\n}\n"]}
@@ -0,0 +1,79 @@
1
+ import type { NativeSyntheticEvent } from '@ng-native/fabric';
2
+ import type { Rect } from './events.ts';
3
+ import { ViewBase } from './view-base.ts';
4
+ import * as i0 from "@angular/core";
5
+ export type KeyboardAvoidingBehavior = 'padding' | 'height' | 'position';
6
+ /**
7
+ * Moves its content clear of the keyboard.
8
+ *
9
+ * RN's KeyboardAvoidingView is a JS composite: there is no native component, only a view whose
10
+ * padding, height or position tracks the keyboard. Off a device the `Keyboard` service reports
11
+ * nothing, so this renders as a plain view and does nothing, which is also the right behaviour on
12
+ * a platform with no soft keyboard.
13
+ *
14
+ * The overlap is the view's own frame against the keyboard's top edge, so a view that does not
15
+ * reach the bottom of the screen moves only as far as it must. Unlike RN, the frame's top is
16
+ * measured in the window, which is what the keyboard's `screenY` is in: `(layout)` reports it in
17
+ * the parent's coordinates, and on a screen under a navigation bar those start a bar's height
18
+ * down. RN leaves that to `keyboardVerticalOffset`, and a view that was not told came up short by
19
+ * exactly that much, its bottom edge still behind the keyboard. The overlap never exceeds the
20
+ * view's own height either: padding a view by more than it has pushes its content out of it.
21
+ * When the keyboard source reports no `screenY`, the keyboard's height stands in.
22
+ *
23
+ * The adjustment itself animates with the keyboard's own motion, the way RN's own
24
+ * KeyboardAvoidingView does: a keyboard event's `duration` and `easing` configure the next
25
+ * layout animation before the style change that moves this view, so the two run together rather
26
+ * than the padding, height or position jumping to its resting place in one step.
27
+ */
28
+ export declare class KeyboardAvoidingView extends ViewBase {
29
+ /**
30
+ * How to make room: pad the bottom, shrink the height, or shift the content up. RN leaves this
31
+ * unset and does nothing; `padding` is the default here because that is what a form wants.
32
+ */
33
+ readonly behavior: import("@angular/core").InputSignal<KeyboardAvoidingBehavior>;
34
+ /** Styles for the inner view that `position` moves. */
35
+ readonly contentContainerStyle: import("@angular/core").InputSignal<Record<string, unknown> | undefined>;
36
+ /** Set to false to stop avoiding without removing the view. */
37
+ readonly enabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
38
+ /**
39
+ * Extra room to leave above the keyboard, in points. RN's name, and in RN the place to put a
40
+ * header's height; here the view is measured in the window, so a navigation bar needs none.
41
+ */
42
+ readonly keyboardVerticalOffset: import("@angular/core").InputSignalWithTransform<number, unknown>;
43
+ private readonly keyboard;
44
+ private readonly layoutAnimation;
45
+ private readonly frame;
46
+ /** The height before any adjustment, which `height` mode shrinks from. */
47
+ private initialHeight;
48
+ /** How far the keyboard intrudes into this view, in points. */
49
+ protected readonly overlap: import("@angular/core").Signal<number>;
50
+ /**
51
+ * The adjustment, or nothing to adjust. Bound as the engine's style override rather than as
52
+ * host style, because Angular ranks a host style binding under the template's: a caller's
53
+ * `[style]="{flex: 1}"` would otherwise keep its flex in height mode and the view would not
54
+ * shrink at all. RN composes the adjustment after the caller's style, so it wins there too.
55
+ */
56
+ protected readonly avoidance: import("@angular/core").Signal<{
57
+ height: number;
58
+ flex: number;
59
+ paddingBottom?: undefined;
60
+ } | {
61
+ paddingBottom: number;
62
+ height?: undefined;
63
+ flex?: undefined;
64
+ } | undefined>;
65
+ protected readonly positioned: import("@angular/core").Signal<{
66
+ bottom: number;
67
+ }>;
68
+ constructor();
69
+ protected onLayout(event: NativeSyntheticEvent<{
70
+ layout?: Rect;
71
+ }>): void;
72
+ /**
73
+ * Where this view's top edge is in the window, or `fallback` where the platform cannot say.
74
+ * Synchronous on the new architecture, so it answers for the layout being reported.
75
+ */
76
+ private windowTop;
77
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeyboardAvoidingView, never>;
78
+ static ɵcmp: i0.ɵɵComponentDeclaration<KeyboardAvoidingView, "keyboard-avoiding-view", never, { "behavior": { "alias": "behavior"; "required": false; "isSignal": true; }; "contentContainerStyle": { "alias": "contentContainerStyle"; "required": false; "isSignal": true; }; "enabled": { "alias": "enabled"; "required": false; "isSignal": true; }; "keyboardVerticalOffset": { "alias": "keyboardVerticalOffset"; "required": false; "isSignal": true; }; }, {}, never, ["*", "*"], true, never>;
79
+ }