@symbiote-native/image 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +45 -2
- package/build/angular/image/index.d.ts +20 -0
- package/build/angular/image/index.js +113 -0
- package/build/angular/image-background/index.d.ts +14 -0
- package/build/angular/image-background/index.js +107 -0
- package/build/angular/index.d.ts +4 -0
- package/build/angular/index.js +6 -0
- package/build/angular/inject-image.d.ts +8 -0
- package/build/angular/inject-image.js +20 -0
- package/build/core/constants.d.ts +3 -0
- package/build/core/constants.js +4 -0
- package/build/core/hash-strings.d.ts +5 -0
- package/build/core/hash-strings.js +20 -0
- package/build/core/image-api.d.ts +18 -0
- package/build/core/image-api.js +30 -0
- package/build/core/image-background.d.ts +11 -0
- package/build/core/image-background.js +26 -0
- package/build/core/image-loader.d.ts +20 -0
- package/build/core/image-loader.js +42 -0
- package/build/core/image-ref-loader.d.ts +4 -0
- package/build/core/image-ref-loader.js +10 -0
- package/build/core/image-view-events.d.ts +9 -0
- package/build/core/image-view-events.js +32 -0
- package/build/core/image-view.d.ts +14 -0
- package/build/core/image-view.js +111 -0
- package/build/core/index.d.ts +10 -0
- package/build/core/index.js +7 -0
- package/build/core/native-module.d.ts +27 -0
- package/build/core/native-module.js +3 -0
- package/build/core/native-style.d.ts +19 -0
- package/build/core/native-style.js +62 -0
- package/build/core/props.d.ts +11 -0
- package/build/core/props.js +87 -0
- package/build/core/sources.d.ts +8 -0
- package/build/core/sources.js +59 -0
- package/build/core/types.d.ts +186 -0
- package/build/core/types.js +1 -0
- package/build/react/image-background.d.ts +7 -0
- package/build/react/image-background.js +7 -0
- package/build/react/image.d.ts +8 -0
- package/build/react/image.js +6 -0
- package/build/react/index.d.ts +6 -0
- package/build/react/index.js +5 -0
- package/build/react/use-image.d.ts +8 -0
- package/build/react/use-image.js +20 -0
- package/build/solid/image-background.d.ts +7 -0
- package/build/solid/image-background.js +4 -0
- package/build/solid/image.d.ts +45 -0
- package/build/solid/image.js +4 -0
- package/build/solid/index.d.ts +5 -0
- package/build/solid/index.js +5 -0
- package/build/solid/use-image.d.ts +8 -0
- package/build/solid/use-image.js +16 -0
- package/build/svelte/image-background-props.d.ts +5 -0
- package/build/svelte/image-background-props.js +1 -0
- package/build/svelte/image-background.svelte +10 -0
- package/build/svelte/image-background.svelte.d.ts +4 -0
- package/build/svelte/image.svelte +26 -0
- package/build/svelte/image.svelte.d.ts +10 -0
- package/build/svelte/index.d.ts +6 -0
- package/build/svelte/index.js +5 -0
- package/build/svelte/use-image.svelte.d.ts +10 -0
- package/build/svelte/use-image.svelte.js +26 -0
- package/build/vue/image-background.d.ts +3 -0
- package/build/vue/image-background.js +12 -0
- package/build/vue/image.d.ts +2 -0
- package/build/vue/image.js +4 -0
- package/build/vue/index.d.ts +4 -0
- package/build/vue/index.js +5 -0
- package/build/vue/use-image.d.ts +8 -0
- package/build/vue/use-image.js +18 -0
- package/build-ngc/angular/image/index.d.ts +23 -0
- package/build-ngc/angular/image/index.js +72 -0
- package/build-ngc/angular/image/index.js.map +1 -0
- package/build-ngc/angular/image-background/index.d.ts +17 -0
- package/build-ngc/angular/image-background/index.js +66 -0
- package/build-ngc/angular/image-background/index.js.map +1 -0
- package/build-ngc/angular/index.d.ts +4 -0
- package/build-ngc/angular/index.js +7 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/inject-image.d.ts +8 -0
- package/build-ngc/angular/inject-image.js +23 -0
- package/build-ngc/angular/inject-image.js.map +1 -0
- package/build-ngc/core/constants.d.ts +3 -0
- package/build-ngc/core/constants.js +5 -0
- package/build-ngc/core/constants.js.map +1 -0
- package/build-ngc/core/hash-strings.d.ts +5 -0
- package/build-ngc/core/hash-strings.js +21 -0
- package/build-ngc/core/hash-strings.js.map +1 -0
- package/build-ngc/core/image-api.d.ts +18 -0
- package/build-ngc/core/image-api.js +31 -0
- package/build-ngc/core/image-api.js.map +1 -0
- package/build-ngc/core/image-background.d.ts +11 -0
- package/build-ngc/core/image-background.js +27 -0
- package/build-ngc/core/image-background.js.map +1 -0
- package/build-ngc/core/image-loader.d.ts +20 -0
- package/build-ngc/core/image-loader.js +43 -0
- package/build-ngc/core/image-loader.js.map +1 -0
- package/build-ngc/core/image-ref-loader.d.ts +4 -0
- package/build-ngc/core/image-ref-loader.js +11 -0
- package/build-ngc/core/image-ref-loader.js.map +1 -0
- package/build-ngc/core/image-view-events.d.ts +9 -0
- package/build-ngc/core/image-view-events.js +33 -0
- package/build-ngc/core/image-view-events.js.map +1 -0
- package/build-ngc/core/image-view.d.ts +14 -0
- package/build-ngc/core/image-view.js +112 -0
- package/build-ngc/core/image-view.js.map +1 -0
- package/build-ngc/core/index.d.ts +10 -0
- package/build-ngc/core/index.js +8 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +27 -0
- package/build-ngc/core/native-module.js +4 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/native-style.d.ts +19 -0
- package/build-ngc/core/native-style.js +63 -0
- package/build-ngc/core/native-style.js.map +1 -0
- package/build-ngc/core/props.d.ts +11 -0
- package/build-ngc/core/props.js +88 -0
- package/build-ngc/core/props.js.map +1 -0
- package/build-ngc/core/sources.d.ts +8 -0
- package/build-ngc/core/sources.js +60 -0
- package/build-ngc/core/sources.js.map +1 -0
- package/build-ngc/core/types.d.ts +186 -0
- package/build-ngc/core/types.js +2 -0
- package/build-ngc/core/types.js.map +1 -0
- package/native-link.json +13 -0
- package/package.json +145 -3
- package/src/angular/image/index.ts +78 -0
- package/src/angular/image-background/index.ts +69 -0
- package/src/angular/index.ts +7 -0
- package/src/angular/inject-image.ts +29 -0
- package/src/core/constants.ts +6 -0
- package/src/core/hash-strings.ts +27 -0
- package/src/core/image-api.ts +67 -0
- package/src/core/image-background.ts +42 -0
- package/src/core/image-loader.ts +65 -0
- package/src/core/image-ref-loader.ts +16 -0
- package/src/core/image-view-events.ts +41 -0
- package/src/core/image-view.ts +156 -0
- package/src/core/index.ts +50 -0
- package/src/core/native-module.ts +45 -0
- package/src/core/native-style.ts +89 -0
- package/src/core/props.ts +118 -0
- package/src/core/sources.ts +70 -0
- package/src/core/types.ts +278 -0
- package/src/react/image-background.ts +14 -0
- package/src/react/image.ts +14 -0
- package/src/react/index.ts +8 -0
- package/src/react/use-image.ts +29 -0
- package/src/solid/image-background.ts +13 -0
- package/src/solid/image.ts +8 -0
- package/src/solid/index.ts +7 -0
- package/src/solid/use-image.ts +30 -0
- package/src/svelte/image-background-props.ts +6 -0
- package/src/svelte/image-background.svelte +10 -0
- package/src/svelte/image.svelte +26 -0
- package/src/svelte/index.ts +8 -0
- package/src/svelte/svelte-ambient.d.ts +3 -0
- package/src/svelte/svelte-compile.test-helper.ts +6 -0
- package/src/svelte/use-image.svelte.ts +38 -0
- package/src/vue/image-background.ts +17 -0
- package/src/vue/image.ts +5 -0
- package/src/vue/index.ts +6 -0
- package/src/vue/use-image.ts +34 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DependencyList } from 'react';
|
|
2
|
+
import type { IImageLoadOptions, IImageSource, ImageRef } from '../core';
|
|
3
|
+
/**
|
|
4
|
+
* Loads an image into a native `ImageRef`, `null` until the first one has loaded
|
|
5
|
+
*
|
|
6
|
+
* It loads again when the uri of the source or an item of `dependencies` changes
|
|
7
|
+
*/
|
|
8
|
+
export declare function useImage(source: IImageSource | string | number, options?: IImageLoadOptions, dependencies?: DependencyList): ImageRef | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { createImageRefLoader, resolveSource } from '../core/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Loads an image into a native `ImageRef`, `null` until the first one has loaded
|
|
5
|
+
*
|
|
6
|
+
* It loads again when the uri of the source or an item of `dependencies` changes
|
|
7
|
+
*/
|
|
8
|
+
export function useImage(source, options = {}, dependencies = []) {
|
|
9
|
+
const [image, setImage] = useState(null);
|
|
10
|
+
// The effect reads the options of the latest render, not the ones it started with
|
|
11
|
+
const latestOptions = useRef(options);
|
|
12
|
+
latestOptions.current = options;
|
|
13
|
+
const key = resolveSource(source)?.uri;
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const loader = createImageRefLoader(setImage, () => latestOptions.current);
|
|
16
|
+
loader.load(source);
|
|
17
|
+
return loader.cancel;
|
|
18
|
+
}, [key, ...dependencies]);
|
|
19
|
+
return image;
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JSX } from 'solid-js';
|
|
2
|
+
import type { IImageBackgroundProps } from '../core';
|
|
3
|
+
export type IImageBackgroundSolidProps = IImageBackgroundProps & {
|
|
4
|
+
children?: JSX.Element;
|
|
5
|
+
};
|
|
6
|
+
/** Solid twin of `expo-image`'s `ImageBackground`, children paint over the image */
|
|
7
|
+
export declare const ImageBackground: (props: IImageBackgroundSolidProps) => import("@symbiote-native/engine").ISymbioteNode;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { defineDescriptorComponent } from '@symbiote-native/solid';
|
|
2
|
+
import { renderImageBackground } from '../core/index.js';
|
|
3
|
+
/** Solid twin of `expo-image`'s `ImageBackground`, children paint over the image */
|
|
4
|
+
export const ImageBackground = defineDescriptorComponent(renderImageBackground);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { IImageViewHandle } from '../core';
|
|
2
|
+
/** Solid twin of `expo-image`'s `Image`, `ref` gets the handle of the view */
|
|
3
|
+
export declare const Image: (props: import("@symbiote-native/components").IAccessibilityProps & import("@symbiote-native/components").IAriaProps & import("@symbiote-native/components").IResponderProps & {
|
|
4
|
+
style?: import("@symbiote-native/engine").IStyleProp<import(".").IImageStyle>;
|
|
5
|
+
source?: import(".").IImageSources;
|
|
6
|
+
placeholder?: import(".").IImageSource | string | number | import(".").IImageSource[] | string[] | import("expo-modules-core").SharedRef<"image"> | null;
|
|
7
|
+
contentFit?: import(".").IImageContentFit;
|
|
8
|
+
placeholderContentFit?: import(".").IImageContentFit;
|
|
9
|
+
contentPosition?: import(".").IImageContentPosition;
|
|
10
|
+
transition?: import(".").IImageTransition | number | null;
|
|
11
|
+
blurRadius?: number;
|
|
12
|
+
tintColor?: import("@symbiote-native/engine").IColorValue | null;
|
|
13
|
+
priority?: "low" | "normal" | "high" | null;
|
|
14
|
+
loading?: "lazy" | "eager";
|
|
15
|
+
cachePolicy?: "none" | "disk" | "memory" | "memory-disk" | null;
|
|
16
|
+
responsivePolicy?: "live" | "initial" | "static";
|
|
17
|
+
recyclingKey?: string | null;
|
|
18
|
+
autoplay?: boolean;
|
|
19
|
+
sfEffect?: import(".").ISfSymbolEffect | null;
|
|
20
|
+
onLoadStart?: () => void;
|
|
21
|
+
onLoad?: (event: import(".").IImageLoadEventData) => void;
|
|
22
|
+
onProgress?: (event: import(".").IImageProgressEventData) => void;
|
|
23
|
+
onError?: (event: import(".").IImageErrorEventData) => void;
|
|
24
|
+
onLoadEnd?: () => void;
|
|
25
|
+
onDisplay?: () => void;
|
|
26
|
+
defaultSource?: import(".").IImageSource | null;
|
|
27
|
+
loadingIndicatorSource?: import(".").IImageSource | null;
|
|
28
|
+
resizeMode?: import(".").IImageResizeMode;
|
|
29
|
+
fadeDuration?: number;
|
|
30
|
+
focusable?: boolean;
|
|
31
|
+
accessible?: boolean;
|
|
32
|
+
accessibilityLabel?: string;
|
|
33
|
+
alt?: string;
|
|
34
|
+
enableLiveTextInteraction?: boolean;
|
|
35
|
+
allowDownscaling?: boolean;
|
|
36
|
+
decodeFormat?: import(".").IImageDecodeFormat;
|
|
37
|
+
useAppleWebpCodec?: boolean;
|
|
38
|
+
enforceEarlyResizing?: boolean;
|
|
39
|
+
preferHighDynamicRange?: boolean;
|
|
40
|
+
draggable?: boolean;
|
|
41
|
+
testID?: string;
|
|
42
|
+
nativeID?: string;
|
|
43
|
+
} & {
|
|
44
|
+
ref?: ((handle: IImageViewHandle) => void) | undefined;
|
|
45
|
+
}) => import("@symbiote-native/engine").ISymbioteNode | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @symbiote-native/image/solid: the image view, its cache and hash functions on a shared core
|
|
2
|
+
export { Image } from './image.js';
|
|
3
|
+
export { ImageBackground } from './image-background.js';
|
|
4
|
+
export { useImage } from './use-image.js';
|
|
5
|
+
export * from '../core/index.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Accessor } from 'solid-js';
|
|
2
|
+
import type { IImageLoadOptions, IImageSource, ImageRef } from '../core';
|
|
3
|
+
/**
|
|
4
|
+
* Solid twin of `expo-image`'s `useImage`, `null` until the first image has loaded
|
|
5
|
+
*
|
|
6
|
+
* It loads again when the uri of the source or a `dependencies` accessor changes
|
|
7
|
+
*/
|
|
8
|
+
export declare function useImage(source: Accessor<IImageSource | string | number>, options?: Accessor<IImageLoadOptions>, dependencies?: Accessor<unknown>[]): Accessor<ImageRef | null>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createEffect, createSignal, on, onCleanup } from 'solid-js';
|
|
2
|
+
import { createImageRefLoader, resolveSource } from '../core/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Solid twin of `expo-image`'s `useImage`, `null` until the first image has loaded
|
|
5
|
+
*
|
|
6
|
+
* It loads again when the uri of the source or a `dependencies` accessor changes
|
|
7
|
+
*/
|
|
8
|
+
export function useImage(source, options = () => ({}), dependencies = []) {
|
|
9
|
+
const [image, setImage] = createSignal(null);
|
|
10
|
+
createEffect(on(() => [resolveSource(source())?.uri, ...dependencies.map(read => read())], () => {
|
|
11
|
+
const loader = createImageRefLoader(setImage, options);
|
|
12
|
+
loader.load(source());
|
|
13
|
+
onCleanup(loader.cancel);
|
|
14
|
+
}));
|
|
15
|
+
return image;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import DescriptorHost from '@symbiote-native/svelte/descriptor-host';
|
|
3
|
+
import { renderImageBackground } from '../core';
|
|
4
|
+
import type { IImageBackgroundSvelteProps } from './image-background-props';
|
|
5
|
+
|
|
6
|
+
const { children, ...rest }: IImageBackgroundSvelteProps = $props();
|
|
7
|
+
const descriptor = $derived(renderImageBackground({ ...rest }));
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<DescriptorHost {descriptor} {children} />
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// The native view name is mixed-case, which a literal tag would parse as a component reference,
|
|
3
|
+
// so the tag is dynamic
|
|
4
|
+
import { hostProps } from '@symbiote-native/svelte/native-view-bridge';
|
|
5
|
+
import { useNativeViewController } from '@symbiote-native/svelte/runes/use-native-view-controller';
|
|
6
|
+
import { createImageView } from '../core';
|
|
7
|
+
import type { IImageViewProps } from '../core';
|
|
8
|
+
|
|
9
|
+
const props: IImageViewProps = $props();
|
|
10
|
+
const view = useNativeViewController(createImageView, () => ({ ...props }));
|
|
11
|
+
|
|
12
|
+
// The functions of the view are instance members, `bind:this` reaches them
|
|
13
|
+
export const startAnimating = view.handle.startAnimating;
|
|
14
|
+
export const stopAnimating = view.handle.stopAnimating;
|
|
15
|
+
export const lockResourceAsync = view.handle.lockResourceAsync;
|
|
16
|
+
export const unlockResourceAsync = view.handle.unlockResourceAsync;
|
|
17
|
+
export const reloadAsync = view.handle.reloadAsync;
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
{#if view.descriptor}
|
|
21
|
+
<svelte:element
|
|
22
|
+
this={view.descriptor.type}
|
|
23
|
+
{@attach view.attachHost}
|
|
24
|
+
{@attach hostProps(view.descriptor.props)}
|
|
25
|
+
/>
|
|
26
|
+
{/if}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IImageViewProps } from '../core';
|
|
2
|
+
declare const Image: import("svelte").Component<IImageViewProps, {
|
|
3
|
+
startAnimating: () => Promise<void>;
|
|
4
|
+
stopAnimating: () => Promise<void>;
|
|
5
|
+
lockResourceAsync: () => Promise<void>;
|
|
6
|
+
unlockResourceAsync: () => Promise<void>;
|
|
7
|
+
reloadAsync: () => Promise<void>;
|
|
8
|
+
}, "">;
|
|
9
|
+
type Image = ReturnType<typeof Image>;
|
|
10
|
+
export default Image;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Image } from './image.svelte';
|
|
2
|
+
export { default as ImageBackground } from './image-background.svelte';
|
|
3
|
+
export type { IImageBackgroundSvelteProps } from './image-background-props';
|
|
4
|
+
export { useImage } from './use-image.svelte';
|
|
5
|
+
export type { IUseImageResult } from './use-image.svelte';
|
|
6
|
+
export * from '../core';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @symbiote-native/image/svelte: the image view, its cache and hash functions on a shared core
|
|
2
|
+
export { default as Image } from './image.svelte';
|
|
3
|
+
export { default as ImageBackground } from './image-background.svelte';
|
|
4
|
+
export { useImage } from './use-image.svelte';
|
|
5
|
+
export * from '../core/index.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IImageLoadOptions, IImageSource, ImageRef } from '../core';
|
|
2
|
+
export type IUseImageResult = {
|
|
3
|
+
readonly current: ImageRef | null;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Svelte twin of `expo-image`'s `useImage`, boxed getter shape of the other hooks
|
|
7
|
+
*
|
|
8
|
+
* It loads again when the uri of the source or a value read by `getDependencies` changes
|
|
9
|
+
*/
|
|
10
|
+
export declare function useImage(getSource: () => IImageSource | string | number, getOptions?: () => IImageLoadOptions, getDependencies?: () => unknown[]): IUseImageResult;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { untrack } from 'svelte';
|
|
2
|
+
import { createImageRefLoader, resolveSource } from '../core/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Svelte twin of `expo-image`'s `useImage`, boxed getter shape of the other hooks
|
|
5
|
+
*
|
|
6
|
+
* It loads again when the uri of the source or a value read by `getDependencies` changes
|
|
7
|
+
*/
|
|
8
|
+
export function useImage(getSource, getOptions = () => ({}), getDependencies = () => []) {
|
|
9
|
+
let image = $state.raw(null);
|
|
10
|
+
const key = $derived(resolveSource(getSource())?.uri);
|
|
11
|
+
$effect(() => {
|
|
12
|
+
// Read so the effect tracks them, the source itself is not a trigger
|
|
13
|
+
key;
|
|
14
|
+
getDependencies();
|
|
15
|
+
const loader = createImageRefLoader(loaded => {
|
|
16
|
+
image = loaded;
|
|
17
|
+
}, getOptions);
|
|
18
|
+
untrack(() => loader.load(getSource()));
|
|
19
|
+
return loader.cancel;
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
get current() {
|
|
23
|
+
return image;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type VNode } from '@vue/runtime-core';
|
|
2
|
+
/** Vue twin of `expo-image`'s `ImageBackground`, the default slot paints over the image */
|
|
3
|
+
export declare const ImageBackground: import("vue").DefineComponent<{}, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineComponent } from '@vue/runtime-core';
|
|
2
|
+
import { descriptorToVue, normalizeVueAttrs } from '@symbiote-native/vue';
|
|
3
|
+
import { renderImageBackground } from '../core/index.js';
|
|
4
|
+
/** Vue twin of `expo-image`'s `ImageBackground`, the default slot paints over the image */
|
|
5
|
+
export const ImageBackground = defineComponent({
|
|
6
|
+
name: 'ImageBackground',
|
|
7
|
+
// Every attribute is a prop of the image or the view, nothing leaks onto the wrapper
|
|
8
|
+
inheritAttrs: false,
|
|
9
|
+
setup(_props, { attrs, slots }) {
|
|
10
|
+
return () => descriptorToVue(renderImageBackground(normalizeVueAttrs(attrs)), slots.default?.() ?? []);
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Vue twin of `expo-image`'s `Image`, `ref` gets the handle of the view */
|
|
2
|
+
export declare const Image: import("vue").DefineComponent<{}, () => import("vue").VNode | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { defineNativeViewComponent } from '@symbiote-native/vue';
|
|
2
|
+
import { createImageView } from '../core/index.js';
|
|
3
|
+
/** Vue twin of `expo-image`'s `Image`, `ref` gets the handle of the view */
|
|
4
|
+
export const Image = defineNativeViewComponent('Image', createImageView);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, ShallowRef, WatchSource } from '@vue/runtime-core';
|
|
2
|
+
import type { IImageLoadOptions, IImageSource, ImageRef } from '../core';
|
|
3
|
+
/**
|
|
4
|
+
* Vue twin of `expo-image`'s `useImage`, `null` until the first image has loaded
|
|
5
|
+
*
|
|
6
|
+
* It loads again when the uri of the source or a watched `dependencies` source changes
|
|
7
|
+
*/
|
|
8
|
+
export declare function useImage(source: MaybeRefOrGetter<IImageSource | string | number>, options?: MaybeRefOrGetter<IImageLoadOptions>, dependencies?: WatchSource[]): Readonly<ShallowRef<ImageRef | null>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { shallowRef, toValue, watch } from '@vue/runtime-core';
|
|
2
|
+
import { createImageRefLoader, resolveSource } from '../core/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Vue twin of `expo-image`'s `useImage`, `null` until the first image has loaded
|
|
5
|
+
*
|
|
6
|
+
* It loads again when the uri of the source or a watched `dependencies` source changes
|
|
7
|
+
*/
|
|
8
|
+
export function useImage(source, options = {}, dependencies = []) {
|
|
9
|
+
const image = shallowRef(null);
|
|
10
|
+
watch([() => resolveSource(toValue(source))?.uri, ...dependencies], (_next, _previous, onCleanup) => {
|
|
11
|
+
const loader = createImageRefLoader(loaded => {
|
|
12
|
+
image.value = loaded;
|
|
13
|
+
}, () => toValue(options));
|
|
14
|
+
loader.load(toValue(source));
|
|
15
|
+
onCleanup(loader.cancel);
|
|
16
|
+
}, { immediate: true });
|
|
17
|
+
return image;
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NativeViewBase } from '@symbiote-native/angular';
|
|
2
|
+
import type { IDescriptor } from '@symbiote-native/components';
|
|
3
|
+
import type { IStyleProp } from '@symbiote-native/engine';
|
|
4
|
+
import type { IImageStyle, IImageViewProps } from '../../core';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
declare const IMAGE_INPUTS: readonly ["source", "placeholder", "contentFit", "placeholderContentFit", "contentPosition", "transition", "blurRadius", "tintColor", "priority", "loading", "cachePolicy", "responsivePolicy", "recyclingKey", "autoplay", "sfEffect", "onLoadStart", "onLoad", "onProgress", "onError", "onLoadEnd", "onDisplay", "defaultSource", "loadingIndicatorSource", "resizeMode", "fadeDuration", "alt", "enableLiveTextInteraction", "allowDownscaling", "decodeFormat", "useAppleWebpCodec", "enforceEarlyResizing", "preferHighDynamicRange", "draggable"];
|
|
7
|
+
export interface ExpoImage extends Partial<Pick<IImageViewProps, (typeof IMAGE_INPUTS)[number]>> {
|
|
8
|
+
}
|
|
9
|
+
/** Angular twin of `expo-image`'s `Image`, `Image` itself is a primitive tag of the adapter */
|
|
10
|
+
export declare class ExpoImage extends NativeViewBase {
|
|
11
|
+
style?: IStyleProp<IImageStyle>;
|
|
12
|
+
private readonly view;
|
|
13
|
+
readonly startAnimating: () => Promise<void>;
|
|
14
|
+
readonly stopAnimating: () => Promise<void>;
|
|
15
|
+
readonly lockResourceAsync: () => Promise<void>;
|
|
16
|
+
readonly unlockResourceAsync: () => Promise<void>;
|
|
17
|
+
readonly reloadAsync: () => Promise<void>;
|
|
18
|
+
protected readonly propNames: readonly ["source", "placeholder", "contentFit", "placeholderContentFit", "contentPosition", "transition", "blurRadius", "tintColor", "priority", "loading", "cachePolicy", "responsivePolicy", "recyclingKey", "autoplay", "sfEffect", "onLoadStart", "onLoad", "onProgress", "onError", "onLoadEnd", "onDisplay", "defaultSource", "loadingIndicatorSource", "resizeMode", "fadeDuration", "alt", "enableLiveTextInteraction", "allowDownscaling", "decodeFormat", "useAppleWebpCodec", "enforceEarlyResizing", "preferHighDynamicRange", "draggable"];
|
|
19
|
+
protected renderView(props: object): IDescriptor | null;
|
|
20
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ExpoImage, never>;
|
|
21
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ExpoImage, "ExpoImage", never, { "source": { "alias": "source"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "contentFit": { "alias": "contentFit"; "required": false; }; "placeholderContentFit": { "alias": "placeholderContentFit"; "required": false; }; "contentPosition": { "alias": "contentPosition"; "required": false; }; "transition": { "alias": "transition"; "required": false; }; "blurRadius": { "alias": "blurRadius"; "required": false; }; "tintColor": { "alias": "tintColor"; "required": false; }; "priority": { "alias": "priority"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "cachePolicy": { "alias": "cachePolicy"; "required": false; }; "responsivePolicy": { "alias": "responsivePolicy"; "required": false; }; "recyclingKey": { "alias": "recyclingKey"; "required": false; }; "autoplay": { "alias": "autoplay"; "required": false; }; "sfEffect": { "alias": "sfEffect"; "required": false; }; "onLoadStart": { "alias": "onLoadStart"; "required": false; }; "onLoad": { "alias": "onLoad"; "required": false; }; "onProgress": { "alias": "onProgress"; "required": false; }; "onError": { "alias": "onError"; "required": false; }; "onLoadEnd": { "alias": "onLoadEnd"; "required": false; }; "onDisplay": { "alias": "onDisplay"; "required": false; }; "defaultSource": { "alias": "defaultSource"; "required": false; }; "loadingIndicatorSource": { "alias": "loadingIndicatorSource"; "required": false; }; "resizeMode": { "alias": "resizeMode"; "required": false; }; "fadeDuration": { "alias": "fadeDuration"; "required": false; }; "alt": { "alias": "alt"; "required": false; }; "enableLiveTextInteraction": { "alias": "enableLiveTextInteraction"; "required": false; }; "allowDownscaling": { "alias": "allowDownscaling"; "required": false; }; "decodeFormat": { "alias": "decodeFormat"; "required": false; }; "useAppleWebpCodec": { "alias": "useAppleWebpCodec"; "required": false; }; "enforceEarlyResizing": { "alias": "enforceEarlyResizing"; "required": false; }; "preferHighDynamicRange": { "alias": "preferHighDynamicRange"; "required": false; }; "draggable": { "alias": "draggable"; "required": false; }; }, {}, never, never, true, never>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { DescriptorOutlet, NativeViewBase } from '@symbiote-native/angular';
|
|
3
|
+
import { createImageView } from '../../core';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
// One list is the inputs of the component and the props it hands to the native view
|
|
6
|
+
const IMAGE_INPUTS = [
|
|
7
|
+
'source',
|
|
8
|
+
'placeholder',
|
|
9
|
+
'contentFit',
|
|
10
|
+
'placeholderContentFit',
|
|
11
|
+
'contentPosition',
|
|
12
|
+
'transition',
|
|
13
|
+
'blurRadius',
|
|
14
|
+
'tintColor',
|
|
15
|
+
'priority',
|
|
16
|
+
'loading',
|
|
17
|
+
'cachePolicy',
|
|
18
|
+
'responsivePolicy',
|
|
19
|
+
'recyclingKey',
|
|
20
|
+
'autoplay',
|
|
21
|
+
'sfEffect',
|
|
22
|
+
'onLoadStart',
|
|
23
|
+
'onLoad',
|
|
24
|
+
'onProgress',
|
|
25
|
+
'onError',
|
|
26
|
+
'onLoadEnd',
|
|
27
|
+
'onDisplay',
|
|
28
|
+
'defaultSource',
|
|
29
|
+
'loadingIndicatorSource',
|
|
30
|
+
'resizeMode',
|
|
31
|
+
'fadeDuration',
|
|
32
|
+
'alt',
|
|
33
|
+
'enableLiveTextInteraction',
|
|
34
|
+
'allowDownscaling',
|
|
35
|
+
'decodeFormat',
|
|
36
|
+
'useAppleWebpCodec',
|
|
37
|
+
'enforceEarlyResizing',
|
|
38
|
+
'preferHighDynamicRange',
|
|
39
|
+
'draggable',
|
|
40
|
+
];
|
|
41
|
+
/** Angular twin of `expo-image`'s `Image`, `Image` itself is a primitive tag of the adapter */
|
|
42
|
+
export class ExpoImage extends NativeViewBase {
|
|
43
|
+
view = createImageView(() => this.hostNode());
|
|
44
|
+
// The functions of the view are members of the component, a `@ViewChild` reaches them
|
|
45
|
+
startAnimating = this.view.handle.startAnimating;
|
|
46
|
+
stopAnimating = this.view.handle.stopAnimating;
|
|
47
|
+
lockResourceAsync = this.view.handle.lockResourceAsync;
|
|
48
|
+
unlockResourceAsync = this.view.handle.unlockResourceAsync;
|
|
49
|
+
reloadAsync = this.view.handle.reloadAsync;
|
|
50
|
+
propNames = IMAGE_INPUTS;
|
|
51
|
+
renderView(props) {
|
|
52
|
+
return this.view.render(props);
|
|
53
|
+
}
|
|
54
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ExpoImage, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
55
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: ExpoImage, isStandalone: true, selector: "ExpoImage", inputs: { source: "source", placeholder: "placeholder", contentFit: "contentFit", placeholderContentFit: "placeholderContentFit", contentPosition: "contentPosition", transition: "transition", blurRadius: "blurRadius", tintColor: "tintColor", priority: "priority", loading: "loading", cachePolicy: "cachePolicy", responsivePolicy: "responsivePolicy", recyclingKey: "recyclingKey", autoplay: "autoplay", sfEffect: "sfEffect", onLoadStart: "onLoadStart", onLoad: "onLoad", onProgress: "onProgress", onError: "onError", onLoadEnd: "onLoadEnd", onDisplay: "onDisplay", defaultSource: "defaultSource", loadingIndicatorSource: "loadingIndicatorSource", resizeMode: "resizeMode", fadeDuration: "fadeDuration", alt: "alt", enableLiveTextInteraction: "enableLiveTextInteraction", allowDownscaling: "allowDownscaling", decodeFormat: "decodeFormat", useAppleWebpCodec: "useAppleWebpCodec", enforceEarlyResizing: "enforceEarlyResizing", preferHighDynamicRange: "preferHighDynamicRange", draggable: "draggable" }, usesInheritance: true, ngImport: i0, template: `@if (descriptor; as node) {
|
|
56
|
+
<symbiote-descriptor-outlet [node]="node" />
|
|
57
|
+
}`, isInline: true, dependencies: [{ kind: "component", type: DescriptorOutlet, selector: "symbiote-descriptor-outlet", inputs: ["node"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
58
|
+
}
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ExpoImage, decorators: [{
|
|
60
|
+
type: Component,
|
|
61
|
+
args: [{
|
|
62
|
+
selector: 'ExpoImage',
|
|
63
|
+
standalone: true,
|
|
64
|
+
imports: [DescriptorOutlet],
|
|
65
|
+
inputs: [...IMAGE_INPUTS],
|
|
66
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
67
|
+
template: `@if (descriptor; as node) {
|
|
68
|
+
<symbiote-descriptor-outlet [node]="node" />
|
|
69
|
+
}`,
|
|
70
|
+
}]
|
|
71
|
+
}] });
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG5E,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;;AAG7C,oFAAoF;AACpF,MAAM,YAAY,GAAG;IACnB,QAAQ;IACR,aAAa;IACb,YAAY;IACZ,uBAAuB;IACvB,iBAAiB;IACjB,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,UAAU;IACV,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,cAAc;IACd,UAAU;IACV,UAAU;IACV,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,WAAW;IACX,WAAW;IACX,eAAe;IACf,wBAAwB;IACxB,YAAY;IACZ,cAAc;IACd,KAAK;IACL,2BAA2B;IAC3B,kBAAkB;IAClB,cAAc;IACd,mBAAmB;IACnB,sBAAsB;IACtB,wBAAwB;IACxB,WAAW;CACH,CAAC;AAMX,+FAA+F;AAW/F,MAAM,OAAO,SAAU,SAAQ,cAAc;IAI1B,IAAI,GAAG,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE/D,sFAAsF;IAC7E,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;IACjD,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;IAC/C,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;IACvD,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAC3D,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;IAExB,SAAS,GAAG,YAAY,CAAC;IAElC,UAAU,CAAC,KAAa;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;uGAjBU,SAAS;2FAAT,SAAS,okCAJV;;IAER,4DALQ,gBAAgB;;2FAOf,SAAS;kBAVrB,SAAS;mBAAC;oBACT,QAAQ,EAAE,WAAW;oBACrB,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,MAAM,EAAE,CAAC,GAAG,YAAY,CAAC;oBACzB,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,QAAQ,EAAE;;IAER;iBACH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NativeViewBase } from '@symbiote-native/angular';
|
|
2
|
+
import type { IDescriptor } from '@symbiote-native/components';
|
|
3
|
+
import type { IStyleProp } from '@symbiote-native/engine';
|
|
4
|
+
import type { IImageBackgroundProps, IImageStyle } from '../../core';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
declare const IMAGE_BACKGROUND_INPUTS: readonly ["source", "placeholder", "contentFit", "placeholderContentFit", "contentPosition", "transition", "blurRadius", "tintColor", "priority", "loading", "cachePolicy", "responsivePolicy", "recyclingKey", "autoplay", "sfEffect", "onLoadStart", "onLoad", "onProgress", "onError", "onLoadEnd", "onDisplay", "defaultSource", "loadingIndicatorSource", "resizeMode", "fadeDuration", "alt", "enableLiveTextInteraction", "allowDownscaling", "decodeFormat", "useAppleWebpCodec", "enforceEarlyResizing", "preferHighDynamicRange", "draggable", "imageStyle"];
|
|
7
|
+
export interface ExpoImageBackground extends Partial<Pick<IImageBackgroundProps, (typeof IMAGE_BACKGROUND_INPUTS)[number]>> {
|
|
8
|
+
}
|
|
9
|
+
/** Angular twin of `expo-image`'s `ImageBackground`, the content paints over the image */
|
|
10
|
+
export declare class ExpoImageBackground extends NativeViewBase {
|
|
11
|
+
style?: IStyleProp<IImageStyle>;
|
|
12
|
+
protected readonly propNames: readonly ["source", "placeholder", "contentFit", "placeholderContentFit", "contentPosition", "transition", "blurRadius", "tintColor", "priority", "loading", "cachePolicy", "responsivePolicy", "recyclingKey", "autoplay", "sfEffect", "onLoadStart", "onLoad", "onProgress", "onError", "onLoadEnd", "onDisplay", "defaultSource", "loadingIndicatorSource", "resizeMode", "fadeDuration", "alt", "enableLiveTextInteraction", "allowDownscaling", "decodeFormat", "useAppleWebpCodec", "enforceEarlyResizing", "preferHighDynamicRange", "draggable", "imageStyle"];
|
|
13
|
+
protected renderView(props: object): IDescriptor;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ExpoImageBackground, never>;
|
|
15
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ExpoImageBackground, "ExpoImageBackground", never, { "source": { "alias": "source"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "contentFit": { "alias": "contentFit"; "required": false; }; "placeholderContentFit": { "alias": "placeholderContentFit"; "required": false; }; "contentPosition": { "alias": "contentPosition"; "required": false; }; "transition": { "alias": "transition"; "required": false; }; "blurRadius": { "alias": "blurRadius"; "required": false; }; "tintColor": { "alias": "tintColor"; "required": false; }; "priority": { "alias": "priority"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "cachePolicy": { "alias": "cachePolicy"; "required": false; }; "responsivePolicy": { "alias": "responsivePolicy"; "required": false; }; "recyclingKey": { "alias": "recyclingKey"; "required": false; }; "autoplay": { "alias": "autoplay"; "required": false; }; "sfEffect": { "alias": "sfEffect"; "required": false; }; "onLoadStart": { "alias": "onLoadStart"; "required": false; }; "onLoad": { "alias": "onLoad"; "required": false; }; "onProgress": { "alias": "onProgress"; "required": false; }; "onError": { "alias": "onError"; "required": false; }; "onLoadEnd": { "alias": "onLoadEnd"; "required": false; }; "onDisplay": { "alias": "onDisplay"; "required": false; }; "defaultSource": { "alias": "defaultSource"; "required": false; }; "loadingIndicatorSource": { "alias": "loadingIndicatorSource"; "required": false; }; "resizeMode": { "alias": "resizeMode"; "required": false; }; "fadeDuration": { "alias": "fadeDuration"; "required": false; }; "alt": { "alias": "alt"; "required": false; }; "enableLiveTextInteraction": { "alias": "enableLiveTextInteraction"; "required": false; }; "allowDownscaling": { "alias": "allowDownscaling"; "required": false; }; "decodeFormat": { "alias": "decodeFormat"; "required": false; }; "useAppleWebpCodec": { "alias": "useAppleWebpCodec"; "required": false; }; "enforceEarlyResizing": { "alias": "enforceEarlyResizing"; "required": false; }; "preferHighDynamicRange": { "alias": "preferHighDynamicRange"; "required": false; }; "draggable": { "alias": "draggable"; "required": false; }; "imageStyle": { "alias": "imageStyle"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { DescriptorHost, NativeViewBase } from '@symbiote-native/angular';
|
|
3
|
+
import { renderImageBackground } from '../../core';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
// One list is the inputs of the component and the props it hands to the image
|
|
6
|
+
const IMAGE_BACKGROUND_INPUTS = [
|
|
7
|
+
'source',
|
|
8
|
+
'placeholder',
|
|
9
|
+
'contentFit',
|
|
10
|
+
'placeholderContentFit',
|
|
11
|
+
'contentPosition',
|
|
12
|
+
'transition',
|
|
13
|
+
'blurRadius',
|
|
14
|
+
'tintColor',
|
|
15
|
+
'priority',
|
|
16
|
+
'loading',
|
|
17
|
+
'cachePolicy',
|
|
18
|
+
'responsivePolicy',
|
|
19
|
+
'recyclingKey',
|
|
20
|
+
'autoplay',
|
|
21
|
+
'sfEffect',
|
|
22
|
+
'onLoadStart',
|
|
23
|
+
'onLoad',
|
|
24
|
+
'onProgress',
|
|
25
|
+
'onError',
|
|
26
|
+
'onLoadEnd',
|
|
27
|
+
'onDisplay',
|
|
28
|
+
'defaultSource',
|
|
29
|
+
'loadingIndicatorSource',
|
|
30
|
+
'resizeMode',
|
|
31
|
+
'fadeDuration',
|
|
32
|
+
'alt',
|
|
33
|
+
'enableLiveTextInteraction',
|
|
34
|
+
'allowDownscaling',
|
|
35
|
+
'decodeFormat',
|
|
36
|
+
'useAppleWebpCodec',
|
|
37
|
+
'enforceEarlyResizing',
|
|
38
|
+
'preferHighDynamicRange',
|
|
39
|
+
'draggable',
|
|
40
|
+
'imageStyle',
|
|
41
|
+
];
|
|
42
|
+
/** Angular twin of `expo-image`'s `ImageBackground`, the content paints over the image */
|
|
43
|
+
export class ExpoImageBackground extends NativeViewBase {
|
|
44
|
+
propNames = IMAGE_BACKGROUND_INPUTS;
|
|
45
|
+
renderView(props) {
|
|
46
|
+
return renderImageBackground(props);
|
|
47
|
+
}
|
|
48
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ExpoImageBackground, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
49
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: ExpoImageBackground, isStandalone: true, selector: "ExpoImageBackground", inputs: { source: "source", placeholder: "placeholder", contentFit: "contentFit", placeholderContentFit: "placeholderContentFit", contentPosition: "contentPosition", transition: "transition", blurRadius: "blurRadius", tintColor: "tintColor", priority: "priority", loading: "loading", cachePolicy: "cachePolicy", responsivePolicy: "responsivePolicy", recyclingKey: "recyclingKey", autoplay: "autoplay", sfEffect: "sfEffect", onLoadStart: "onLoadStart", onLoad: "onLoad", onProgress: "onProgress", onError: "onError", onLoadEnd: "onLoadEnd", onDisplay: "onDisplay", defaultSource: "defaultSource", loadingIndicatorSource: "loadingIndicatorSource", resizeMode: "resizeMode", fadeDuration: "fadeDuration", alt: "alt", enableLiveTextInteraction: "enableLiveTextInteraction", allowDownscaling: "allowDownscaling", decodeFormat: "decodeFormat", useAppleWebpCodec: "useAppleWebpCodec", enforceEarlyResizing: "enforceEarlyResizing", preferHighDynamicRange: "preferHighDynamicRange", draggable: "draggable", imageStyle: "imageStyle" }, usesInheritance: true, ngImport: i0, template: `@if (descriptor; as node) {
|
|
50
|
+
<symbiote-descriptor-host [node]="node"><ng-content /></symbiote-descriptor-host>
|
|
51
|
+
}`, isInline: true, dependencies: [{ kind: "component", type: DescriptorHost, selector: "symbiote-descriptor-host", inputs: ["node"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
52
|
+
}
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ExpoImageBackground, decorators: [{
|
|
54
|
+
type: Component,
|
|
55
|
+
args: [{
|
|
56
|
+
selector: 'ExpoImageBackground',
|
|
57
|
+
standalone: true,
|
|
58
|
+
imports: [DescriptorHost],
|
|
59
|
+
inputs: [...IMAGE_BACKGROUND_INPUTS],
|
|
60
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
61
|
+
template: `@if (descriptor; as node) {
|
|
62
|
+
<symbiote-descriptor-host [node]="node"><ng-content /></symbiote-descriptor-host>
|
|
63
|
+
}`,
|
|
64
|
+
}]
|
|
65
|
+
}] });
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/image-background/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;;AAInD,8EAA8E;AAC9E,MAAM,uBAAuB,GAAG;IAC9B,QAAQ;IACR,aAAa;IACb,YAAY;IACZ,uBAAuB;IACvB,iBAAiB;IACjB,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,UAAU;IACV,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,cAAc;IACd,UAAU;IACV,UAAU;IACV,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,WAAW;IACX,WAAW;IACX,eAAe;IACf,wBAAwB;IACxB,YAAY;IACZ,cAAc;IACd,KAAK;IACL,2BAA2B;IAC3B,kBAAkB;IAClB,cAAc;IACd,mBAAmB;IACnB,sBAAsB;IACtB,wBAAwB;IACxB,WAAW;IACX,YAAY;CACJ,CAAC;AAKX,0FAA0F;AAW1F,MAAM,OAAO,mBAAoB,SAAQ,cAAc;IAIzB,SAAS,GAAG,uBAAuB,CAAC;IAE7C,UAAU,CAAC,KAAa;QACzC,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;uGARU,mBAAmB;2FAAnB,mBAAmB,wmCAJpB;;IAER,4DALQ,cAAc;;2FAOb,mBAAmB;kBAV/B,SAAS;mBAAC;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,cAAc,CAAC;oBACzB,MAAM,EAAE,CAAC,GAAG,uBAAuB,CAAC;oBACpC,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,QAAQ,EAAE;;IAER;iBACH"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @symbiote-native/image/angular: the image view, its cache and hash functions on a shared core
|
|
2
|
+
// The selectors are `ExpoImage*`, `Image` and `ImageBackground` are tags of the adapter
|
|
3
|
+
export { ExpoImage } from './image';
|
|
4
|
+
export { ExpoImageBackground } from './image-background';
|
|
5
|
+
export { injectImage } from './inject-image';
|
|
6
|
+
export * from '../core';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,wFAAwF;AAExF,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Signal } from '@angular/core';
|
|
2
|
+
import type { IImageLoadOptions, IImageSource, ImageRef } from '../core';
|
|
3
|
+
/**
|
|
4
|
+
* Angular twin of `useImage`, `null` until the first image has loaded
|
|
5
|
+
*
|
|
6
|
+
* It loads again when the uri of the source or a signal read by `dependencies` changes
|
|
7
|
+
*/
|
|
8
|
+
export declare function injectImage(source: () => IImageSource | string | number, options?: () => IImageLoadOptions, dependencies?: () => unknown[]): Signal<ImageRef | null>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { computed, effect, signal, untracked } from '@angular/core';
|
|
2
|
+
import { createImageRefLoader, resolveSource } from '../core';
|
|
3
|
+
/**
|
|
4
|
+
* Angular twin of `useImage`, `null` until the first image has loaded
|
|
5
|
+
*
|
|
6
|
+
* It loads again when the uri of the source or a signal read by `dependencies` changes
|
|
7
|
+
*/
|
|
8
|
+
export function injectImage(source, options = () => ({}), dependencies = () => []) {
|
|
9
|
+
const image = signal(null, /* @ts-ignore */
|
|
10
|
+
...(ngDevMode ? [{ debugName: "image" }] : /* istanbul ignore next */ []));
|
|
11
|
+
const key = computed(() => resolveSource(source())?.uri, /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []));
|
|
13
|
+
effect(onCleanup => {
|
|
14
|
+
// Read so the effect tracks them, the source itself is not a trigger
|
|
15
|
+
key();
|
|
16
|
+
dependencies();
|
|
17
|
+
const loader = createImageRefLoader(loaded => image.set(loaded), options);
|
|
18
|
+
untracked(() => loader.load(source()));
|
|
19
|
+
onCleanup(loader.cancel);
|
|
20
|
+
});
|
|
21
|
+
return image.asReadonly();
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=inject-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject-image.js","sourceRoot":"","sources":["../../src/angular/inject-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG9D;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,MAA4C,EAC5C,UAAmC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAC7C,eAAgC,GAAG,EAAE,CAAC,EAAE;IAExC,MAAM,KAAK,GAAG,MAAM,CAAkB,IAAI;8EAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG;4EAAC,CAAC;IAEzD,MAAM,CAAC,SAAS,CAAC,EAAE;QACjB,qEAAqE;QACrE,GAAG,EAAE,CAAC;QACN,YAAY,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QAC1E,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACvC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,UAAU,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Apart from `native-module`, which resolves the module on import: the view needs the name too
|
|
2
|
+
export const IMAGE_MODULE_NAME = 'ExpoImage';
|
|
3
|
+
/** `sf:name` in a source string, the native side reads `sf:/name` */
|
|
4
|
+
export const SF_SYMBOL_PREFIX = 'sf:';
|
|
5
|
+
//# sourceMappingURL=constants.js.map
|