@symbiote-native/blur 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 +51 -2
- package/build/angular/blur-target-view/index.android.d.ts +7 -0
- package/build/angular/blur-target-view/index.android.js +84 -0
- package/build/angular/blur-target-view/index.d.ts +1 -0
- package/build/angular/blur-target-view/index.ios.d.ts +6 -0
- package/build/angular/blur-target-view/index.ios.js +76 -0
- package/build/angular/blur-target-view/index.js +2 -0
- package/build/angular/blur-target-view/shared.d.ts +9 -0
- package/build/angular/blur-target-view/shared.js +64 -0
- package/build/angular/blur-view.d.ts +23 -0
- package/build/angular/blur-view.js +136 -0
- package/build/angular/index.d.ts +3 -0
- package/build/angular/index.js +4 -0
- package/build/core/blur.d.ts +53 -0
- package/build/core/blur.js +104 -0
- package/build/core/index.d.ts +1 -0
- package/build/core/index.js +1 -0
- package/build/react/blur.d.ts +18 -0
- package/build/react/blur.js +18 -0
- package/build/react/index.d.ts +3 -0
- package/build/react/index.js +3 -0
- package/build/solid/blur.d.ts +19 -0
- package/build/solid/blur.js +17 -0
- package/build/solid/index.d.ts +3 -0
- package/build/solid/index.js +3 -0
- package/build/svelte/blur-props.d.ts +13 -0
- package/build/svelte/blur-props.js +1 -0
- package/build/svelte/blur-target-view.svelte +14 -0
- package/build/svelte/blur-target-view.svelte.d.ts +4 -0
- package/build/svelte/blur-view.svelte +21 -0
- package/build/svelte/blur-view.svelte.d.ts +4 -0
- package/build/svelte/index.d.ts +4 -0
- package/build/svelte/index.js +4 -0
- package/build/vue/blur.d.ts +12 -0
- package/build/vue/blur.js +50 -0
- package/build/vue/index.d.ts +3 -0
- package/build/vue/index.js +3 -0
- package/build-ngc/angular/blur-target-view/index.android.d.ts +10 -0
- package/build-ngc/angular/blur-target-view/index.android.js +40 -0
- package/build-ngc/angular/blur-target-view/index.android.js.map +1 -0
- package/build-ngc/angular/blur-target-view/index.d.ts +1 -0
- package/build-ngc/angular/blur-target-view/index.ios.d.ts +9 -0
- package/build-ngc/angular/blur-target-view/index.ios.js +27 -0
- package/build-ngc/angular/blur-target-view/index.ios.js.map +1 -0
- package/build-ngc/angular/blur-target-view/index.js +3 -0
- package/build-ngc/angular/blur-target-view/index.js.map +1 -0
- package/build-ngc/angular/blur-target-view/shared.d.ts +12 -0
- package/build-ngc/angular/blur-target-view/shared.js +20 -0
- package/build-ngc/angular/blur-target-view/shared.js.map +1 -0
- package/build-ngc/angular/blur-view.d.ts +26 -0
- package/build-ngc/angular/blur-view.js +77 -0
- package/build-ngc/angular/blur-view.js.map +1 -0
- package/build-ngc/angular/index.d.ts +3 -0
- package/build-ngc/angular/index.js +5 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/core/blur.d.ts +53 -0
- package/build-ngc/core/blur.js +105 -0
- package/build-ngc/core/blur.js.map +1 -0
- package/build-ngc/core/index.d.ts +1 -0
- package/build-ngc/core/index.js +2 -0
- package/build-ngc/core/index.js.map +1 -0
- package/native-link.json +12 -0
- package/package.json +145 -3
- package/src/angular/blur-target-view/index.android.ts +39 -0
- package/src/angular/blur-target-view/index.ios.ts +25 -0
- package/src/angular/blur-target-view/index.ts +2 -0
- package/src/angular/blur-target-view/shared.ts +21 -0
- package/src/angular/blur-view.ts +85 -0
- package/src/angular/index.ts +13 -0
- package/src/core/blur.ts +210 -0
- package/src/core/index.ts +15 -0
- package/src/react/blur.ts +46 -0
- package/src/react/index.ts +14 -0
- package/src/solid/blur.ts +54 -0
- package/src/solid/index.ts +14 -0
- package/src/svelte/blur-props.ts +18 -0
- package/src/svelte/blur-target-view.svelte +14 -0
- package/src/svelte/blur-view.svelte +21 -0
- package/src/svelte/index.ts +15 -0
- package/src/svelte/svelte-ambient.d.ts +6 -0
- package/src/svelte/svelte-compile.test-helper.ts +6 -0
- package/src/vue/blur.ts +82 -0
- package/src/vue/index.ts +14 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Ядро `BlurView` и `BlurTargetView`, порт `BlurView.tsx` из expo-blur
|
|
2
|
+
import { Platform, requireNativeViewManager } from 'expo-modules-core';
|
|
3
|
+
import { el } from '@symbiote-native/components';
|
|
4
|
+
import { defineExpoNativeViews, getNativeTag, isSymbioteNode, whenCommitted, } from '@symbiote-native/engine';
|
|
5
|
+
export const BLUR_MODULE_NAME = 'ExpoBlur';
|
|
6
|
+
const BLUR_VIEW_NAME = 'ExpoBlurView';
|
|
7
|
+
const BLUR_TARGET_VIEW_NAME = 'ExpoBlurTargetView';
|
|
8
|
+
const BLUR_METHODS = [
|
|
9
|
+
'none',
|
|
10
|
+
'dimezisBlurView',
|
|
11
|
+
'dimezisBlurViewSdk31Plus',
|
|
12
|
+
];
|
|
13
|
+
const DEFAULT_BLUR_METHOD = BLUR_METHODS[0];
|
|
14
|
+
// Эти ключи разбираются здесь, остальное уходит на View как есть
|
|
15
|
+
const BLUR_KEYS = new Set([
|
|
16
|
+
'tint',
|
|
17
|
+
'intensity',
|
|
18
|
+
'blurReductionFactor',
|
|
19
|
+
'experimentalBlurMethod',
|
|
20
|
+
'blurMethod',
|
|
21
|
+
]);
|
|
22
|
+
const ABSOLUTE_FILL = {
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
left: 0,
|
|
25
|
+
right: 0,
|
|
26
|
+
top: 0,
|
|
27
|
+
bottom: 0,
|
|
28
|
+
};
|
|
29
|
+
const CONTAINER_STYLE = { backgroundColor: 'transparent' };
|
|
30
|
+
const DEPRECATED_METHOD_WARNING = 'The `experimentalBlurMethod` prop has been depracated. Please use the `blurMethod` prop instead.';
|
|
31
|
+
// Регистрация идёт при рендере: побочный эффект барреля теряется в release
|
|
32
|
+
const views = defineExpoNativeViews(requireNativeViewManager, BLUR_MODULE_NAME, {
|
|
33
|
+
blur: BLUR_VIEW_NAME,
|
|
34
|
+
target: BLUR_TARGET_VIEW_NAME,
|
|
35
|
+
});
|
|
36
|
+
export const blurViewName = views.blur.name;
|
|
37
|
+
export const blurTargetViewName = views.target.name;
|
|
38
|
+
export const ensureBlurRegistered = views.blur.ensureRegistered;
|
|
39
|
+
export const ensureBlurTargetRegistered = views.target.ensureRegistered;
|
|
40
|
+
function isBlurMethod(value) {
|
|
41
|
+
return BLUR_METHODS.some(method => method === value);
|
|
42
|
+
}
|
|
43
|
+
function blurMethodOf(props) {
|
|
44
|
+
const provided = Reflect.get(props, 'blurMethod');
|
|
45
|
+
const deprecated = Reflect.get(props, 'experimentalBlurMethod');
|
|
46
|
+
if (isBlurMethod(provided))
|
|
47
|
+
return provided;
|
|
48
|
+
return isBlurMethod(deprecated) ? deprecated : DEFAULT_BLUR_METHOD;
|
|
49
|
+
}
|
|
50
|
+
/** Предупреждения из `componentDidMount` upstream, зовутся один раз при монтировании */
|
|
51
|
+
export function warnBlurProps(props, hasBlurTarget) {
|
|
52
|
+
const method = blurMethodOf(props);
|
|
53
|
+
const isAndroidTarget = Platform.select({ android: true, default: false });
|
|
54
|
+
if (isAndroidTarget && method !== DEFAULT_BLUR_METHOD && !hasBlurTarget) {
|
|
55
|
+
console.warn(`You have selected the "${method}" blur method, but the \`blurTarget\` prop has not been configured. The blur view will fallback to "none" blur method to avoid errors. You can learn more about the new BlurView API at: https://docs.expo.dev/versions/latest/sdk/blur-view/`);
|
|
56
|
+
}
|
|
57
|
+
if (Reflect.get(props, 'experimentalBlurMethod') != null) {
|
|
58
|
+
console.warn(DEPRECATED_METHOD_WARNING);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Отдаёт нативный тег цели размытия после её коммита, у не-узла отдаёт `undefined`
|
|
63
|
+
* Адаптер сам приводит свой ref к host-узлу, возвращённая функция отменяет ожидание
|
|
64
|
+
*/
|
|
65
|
+
export function watchBlurTarget(target, onId) {
|
|
66
|
+
if (!isSymbioteNode(target)) {
|
|
67
|
+
onId(undefined);
|
|
68
|
+
return () => { };
|
|
69
|
+
}
|
|
70
|
+
return whenCommitted(target, () => onId(getNativeTag(target)));
|
|
71
|
+
}
|
|
72
|
+
// `object`, а не тип пропсов: Vue и Angular отдают нетипизированный набор атрибутов
|
|
73
|
+
export function renderBlurView(props, blurTargetId) {
|
|
74
|
+
const hostProps = Object.fromEntries(Object.entries(props).filter(([key]) => !BLUR_KEYS.has(key)));
|
|
75
|
+
const style = [CONTAINER_STYLE, Reflect.get(props, 'style')];
|
|
76
|
+
if (!ensureBlurRegistered()) {
|
|
77
|
+
console.warn('BlurView is not available on this platform');
|
|
78
|
+
return el('view', { ...hostProps, style });
|
|
79
|
+
}
|
|
80
|
+
const tint = Reflect.get(props, 'tint');
|
|
81
|
+
const intensity = Reflect.get(props, 'intensity');
|
|
82
|
+
const reduction = Reflect.get(props, 'blurReductionFactor');
|
|
83
|
+
const native = el(blurViewName(), {
|
|
84
|
+
...(blurTargetId === undefined ? {} : { blurTargetId }),
|
|
85
|
+
tint: tint ?? 'default',
|
|
86
|
+
intensity: intensity ?? 50,
|
|
87
|
+
blurReductionFactor: reduction ?? 4,
|
|
88
|
+
blurMethod: blurMethodOf(props),
|
|
89
|
+
style: ABSOLUTE_FILL,
|
|
90
|
+
});
|
|
91
|
+
return el('view', { ...hostProps, style }, [native]);
|
|
92
|
+
}
|
|
93
|
+
// Нативная цель размытия есть только на Android, на iOS это обычный View
|
|
94
|
+
export function renderBlurTargetView(props) {
|
|
95
|
+
const hostProps = { ...props };
|
|
96
|
+
if (!Platform.select({ android: true, default: false })) {
|
|
97
|
+
return el('view', hostProps);
|
|
98
|
+
}
|
|
99
|
+
if (!ensureBlurTargetRegistered()) {
|
|
100
|
+
console.warn('BlurTargetView is not available on this platform');
|
|
101
|
+
return el('view', hostProps);
|
|
102
|
+
}
|
|
103
|
+
return el(blurTargetViewName(), hostProps);
|
|
104
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BLUR_MODULE_NAME, blurTargetViewName, blurViewName, ensureBlurRegistered, ensureBlurTargetRegistered, renderBlurTargetView, renderBlurView, warnBlurProps, watchBlurTarget, type IBlurMethod, type IBlurTargetViewProps, type IBlurTint, type IBlurViewProps, } from './blur';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BLUR_MODULE_NAME, blurTargetViewName, blurViewName, ensureBlurRegistered, ensureBlurTargetRegistered, renderBlurTargetView, renderBlurView, warnBlurProps, watchBlurTarget, } from './blur.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode, RefObject } from 'react';
|
|
2
|
+
import type { IHostInstance, IViewProps } from '@symbiote-native/react';
|
|
3
|
+
import type { IBlurTargetViewProps, IBlurViewProps } from '../core';
|
|
4
|
+
export type IBlurViewReactProps = IBlurViewProps & Omit<IViewProps, keyof IBlurViewProps | 'children'> & {
|
|
5
|
+
/** Ref на `BlurTargetView`, его содержимое это фон для размытия */
|
|
6
|
+
blurTarget?: RefObject<IHostInstance | null>;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
export type IBlurTargetViewReactProps = IBlurTargetViewProps & Omit<IViewProps, keyof IBlurTargetViewProps | 'children' | 'ref'> & {
|
|
11
|
+
ref?: RefObject<IHostInstance | null>;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
/** React twin of `expo-blur`'s `BlurView`, children paint over the blur */
|
|
16
|
+
export declare function BlurView(props: IBlurViewReactProps): ReactElement;
|
|
17
|
+
/** React twin of `expo-blur`'s `BlurTargetView`, native on Android and a plain View on iOS */
|
|
18
|
+
export declare function BlurTargetView(props: IBlurTargetViewReactProps): ReactElement;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createElement, useEffect, useLayoutEffect, useState } from 'react';
|
|
2
|
+
import { descriptorToReactWithChildren } from '@symbiote-native/react';
|
|
3
|
+
import { renderBlurTargetView, renderBlurView, warnBlurProps, watchBlurTarget, } from '../core/index.js';
|
|
4
|
+
/** React twin of `expo-blur`'s `BlurView`, children paint over the blur */
|
|
5
|
+
export function BlurView(props) {
|
|
6
|
+
const { blurTarget, children, ...rest } = props;
|
|
7
|
+
const [blurTargetId, setBlurTargetId] = useState();
|
|
8
|
+
// Без списка зависимостей, как `componentDidUpdate` upstream: ref цели ставится в коммите
|
|
9
|
+
useLayoutEffect(() => watchBlurTarget(blurTarget?.current, setBlurTargetId));
|
|
10
|
+
useEffect(() => warnBlurProps(rest, blurTarget !== undefined), []);
|
|
11
|
+
return descriptorToReactWithChildren(renderBlurView(rest, blurTargetId), children);
|
|
12
|
+
}
|
|
13
|
+
/** React twin of `expo-blur`'s `BlurTargetView`, native on Android and a plain View on iOS */
|
|
14
|
+
export function BlurTargetView(props) {
|
|
15
|
+
const { children, ...rest } = props;
|
|
16
|
+
const descriptor = renderBlurTargetView(rest);
|
|
17
|
+
return createElement(descriptor.type, descriptor.props, children);
|
|
18
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { BlurTargetView, BlurView } from './blur';
|
|
2
|
+
export type { IBlurTargetViewReactProps as IBlurTargetViewProps, IBlurViewReactProps as IBlurViewProps, } from './blur';
|
|
3
|
+
export { BLUR_MODULE_NAME, blurTargetViewName, blurViewName, type IBlurMethod, type IBlurTint, } from '../core';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { JSX } from 'solid-js';
|
|
2
|
+
import { descriptorToSolid } from '@symbiote-native/solid';
|
|
3
|
+
import type { IHostInstance, IViewProps } from '@symbiote-native/solid';
|
|
4
|
+
import type { IClassNameValue } from '@symbiote-native/engine';
|
|
5
|
+
import type { IBlurTargetViewProps, IBlurViewProps } from '../core';
|
|
6
|
+
export type IBlurViewSolidProps = IBlurViewProps & Omit<IViewProps, keyof IBlurViewProps | 'children' | 'ref'> & {
|
|
7
|
+
/** Host-узел `BlurTargetView`, его содержимое это фон для размытия */
|
|
8
|
+
blurTarget?: IHostInstance;
|
|
9
|
+
children?: JSX.Element;
|
|
10
|
+
class?: IClassNameValue;
|
|
11
|
+
};
|
|
12
|
+
export type IBlurTargetViewSolidProps = IBlurTargetViewProps & Omit<IViewProps, keyof IBlurTargetViewProps | 'children'> & {
|
|
13
|
+
children?: JSX.Element;
|
|
14
|
+
class?: IClassNameValue;
|
|
15
|
+
};
|
|
16
|
+
/** Solid twin of `expo-blur`'s `BlurView`, children paint over the blur */
|
|
17
|
+
export declare function BlurView(props: IBlurViewSolidProps): ReturnType<typeof descriptorToSolid>;
|
|
18
|
+
/** Solid twin of `expo-blur`'s `BlurTargetView`, native on Android and a plain View on iOS */
|
|
19
|
+
export declare const BlurTargetView: (props: IBlurTargetViewSolidProps) => import("@symbiote-native/engine").ISymbioteNode;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createEffect, createSignal, onCleanup, onMount, splitProps } from 'solid-js';
|
|
2
|
+
import { defineDescriptorComponent, descriptorToSolid, } from '@symbiote-native/solid';
|
|
3
|
+
import { renderBlurTargetView, renderBlurView, warnBlurProps, watchBlurTarget, } from '../core/index.js';
|
|
4
|
+
/** Solid twin of `expo-blur`'s `BlurView`, children paint over the blur */
|
|
5
|
+
export function BlurView(props) {
|
|
6
|
+
const [local, rest] = splitProps(props, ['children', 'blurTarget']);
|
|
7
|
+
const [blurTargetId, setBlurTargetId] = createSignal();
|
|
8
|
+
// Цель приходит сигналом после коммита, поэтому следим за ней, а не читаем один раз
|
|
9
|
+
createEffect(() => {
|
|
10
|
+
const cancel = watchBlurTarget(local.blurTarget, setBlurTargetId);
|
|
11
|
+
onCleanup(cancel);
|
|
12
|
+
});
|
|
13
|
+
onMount(() => warnBlurProps({ ...rest }, local.blurTarget !== undefined));
|
|
14
|
+
return descriptorToSolid(() => renderBlurView({ ...rest }, blurTargetId()), () => local.children);
|
|
15
|
+
}
|
|
16
|
+
/** Solid twin of `expo-blur`'s `BlurTargetView`, native on Android and a plain View on iOS */
|
|
17
|
+
export const BlurTargetView = defineDescriptorComponent(renderBlurTargetView);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { BlurTargetView, BlurView } from './blur';
|
|
2
|
+
export type { IBlurTargetViewSolidProps as IBlurTargetViewProps, IBlurViewSolidProps as IBlurViewProps, } from './blur';
|
|
3
|
+
export { BLUR_MODULE_NAME, blurTargetViewName, blurViewName, type IBlurMethod, type IBlurTint, } from '../core';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { IViewProps } from '@symbiote-native/svelte';
|
|
3
|
+
import type { IBlurTargetViewProps, IBlurViewProps } from '../core';
|
|
4
|
+
export type IBlurViewSvelteProps = IBlurViewProps & Omit<IViewProps, keyof IBlurViewProps | 'children'> & {
|
|
5
|
+
/** Значение `bind:ref` от `BlurTargetView`, его содержимое это фон для размытия */
|
|
6
|
+
blurTarget?: unknown;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
};
|
|
9
|
+
export type IBlurTargetViewSvelteProps = IBlurTargetViewProps & Omit<IViewProps, keyof IBlurTargetViewProps | 'children'> & {
|
|
10
|
+
/** Host-ref, отдаётся через `bind:ref` и передаётся в `blurTarget` у `BlurView` */
|
|
11
|
+
ref?: unknown;
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import DescriptorHost from '@symbiote-native/svelte/descriptor-host';
|
|
3
|
+
import { renderBlurTargetView } from '../core';
|
|
4
|
+
import type { IBlurTargetViewSvelteProps } from './blur-props';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
ref = $bindable(),
|
|
9
|
+
...rest
|
|
10
|
+
}: IBlurTargetViewSvelteProps = $props();
|
|
11
|
+
const descriptor = $derived(renderBlurTargetView({ ...rest }));
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<DescriptorHost {descriptor} bind:ref {children} />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import DescriptorHost from '@symbiote-native/svelte/descriptor-host';
|
|
3
|
+
import { hostInstance } from '@symbiote-native/svelte/native-view-bridge';
|
|
4
|
+
import { renderBlurView, warnBlurProps, watchBlurTarget } from '../core';
|
|
5
|
+
import type { IBlurViewSvelteProps } from './blur-props';
|
|
6
|
+
|
|
7
|
+
const { children, blurTarget, ...rest }: IBlurViewSvelteProps = $props();
|
|
8
|
+
let blurTargetId = $state<number | undefined>();
|
|
9
|
+
|
|
10
|
+
// Цель приходит после монтирования и мутирует, поэтому эффект следит за ней
|
|
11
|
+
$effect(() =>
|
|
12
|
+
watchBlurTarget(hostInstance(blurTarget), id => {
|
|
13
|
+
blurTargetId = id;
|
|
14
|
+
}),
|
|
15
|
+
);
|
|
16
|
+
$effect(() => warnBlurProps({ ...rest }, blurTarget !== undefined));
|
|
17
|
+
|
|
18
|
+
const descriptor = $derived(renderBlurView({ ...rest }, blurTargetId));
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<DescriptorHost {descriptor} {children} />
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as BlurTargetView } from './blur-target-view.svelte';
|
|
2
|
+
export { default as BlurView } from './blur-view.svelte';
|
|
3
|
+
export type { IBlurTargetViewSvelteProps as IBlurTargetViewProps, IBlurViewSvelteProps as IBlurViewProps, } from './blur-props';
|
|
4
|
+
export { BLUR_MODULE_NAME, blurTargetViewName, blurViewName, type IBlurMethod, type IBlurTint, } from '../core';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @symbiote-native/blur/svelte: компоненты `BlurView` и `BlurTargetView` поверх общего ядра
|
|
2
|
+
export { default as BlurTargetView } from './blur-target-view.svelte';
|
|
3
|
+
export { default as BlurView } from './blur-view.svelte';
|
|
4
|
+
export { BLUR_MODULE_NAME, blurTargetViewName, blurViewName, } from '../core/index.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type VNode } from '@vue/runtime-core';
|
|
2
|
+
import type { IViewProps } from '@symbiote-native/vue';
|
|
3
|
+
import type { IBlurTargetViewProps, IBlurViewProps } from '../core';
|
|
4
|
+
export type IBlurViewVueProps = IBlurViewProps & Omit<IViewProps, keyof IBlurViewProps> & {
|
|
5
|
+
/** Template ref на `BlurTargetView`, его содержимое это фон для размытия */
|
|
6
|
+
blurTarget?: unknown;
|
|
7
|
+
};
|
|
8
|
+
export type IBlurTargetViewVueProps = IBlurTargetViewProps & Omit<IViewProps, keyof IBlurTargetViewProps>;
|
|
9
|
+
/** Vue twin of `expo-blur`'s `BlurView`, the default slot paints over the blur */
|
|
10
|
+
export declare const BlurView: import("vue").DefineComponent<{}, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
11
|
+
/** Vue twin of `expo-blur`'s `BlurTargetView`, native on Android and a plain View on iOS */
|
|
12
|
+
export declare const BlurTargetView: 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,50 @@
|
|
|
1
|
+
import { defineComponent, h, isRef, onBeforeUnmount, onMounted, onUpdated, ref, toRaw, } from '@vue/runtime-core';
|
|
2
|
+
import { descriptorToVue, normalizeVueAttrs } from '@symbiote-native/vue';
|
|
3
|
+
import { renderBlurTargetView, renderBlurView, warnBlurProps, watchBlurTarget, } from '../core/index.js';
|
|
4
|
+
// Template ref на компонент отдаёт его публичный экземпляр, корневой host-узел лежит в `$el`
|
|
5
|
+
function hostOf(target) {
|
|
6
|
+
const value = isRef(target) ? target.value : target;
|
|
7
|
+
const host = value !== null && typeof value === 'object' && '$el' in value
|
|
8
|
+
? value.$el
|
|
9
|
+
: value;
|
|
10
|
+
return toRaw(host);
|
|
11
|
+
}
|
|
12
|
+
/** Vue twin of `expo-blur`'s `BlurView`, the default slot paints over the blur */
|
|
13
|
+
export const BlurView = defineComponent({
|
|
14
|
+
name: 'BlurView',
|
|
15
|
+
// Все атрибуты это пропсы нативного view, на обёртку ничего не должно просочиться
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
setup(_props, { attrs, slots }) {
|
|
18
|
+
const blurTargetId = ref();
|
|
19
|
+
let cancelWatch = () => { };
|
|
20
|
+
const syncTarget = () => {
|
|
21
|
+
cancelWatch();
|
|
22
|
+
cancelWatch = watchBlurTarget(hostOf(attrs.blurTarget), id => {
|
|
23
|
+
blurTargetId.value = id;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
// Ref цели ставится при патче, поэтому читаем его после монтирования и каждого обновления
|
|
27
|
+
onMounted(() => {
|
|
28
|
+
syncTarget();
|
|
29
|
+
warnBlurProps(normalizeVueAttrs(attrs), attrs.blurTarget !== undefined);
|
|
30
|
+
});
|
|
31
|
+
onUpdated(syncTarget);
|
|
32
|
+
onBeforeUnmount(() => cancelWatch());
|
|
33
|
+
return () => {
|
|
34
|
+
const { blurTarget: _blurTarget, ...rest } = normalizeVueAttrs(attrs);
|
|
35
|
+
const descriptor = renderBlurView(rest, blurTargetId.value);
|
|
36
|
+
return descriptorToVue(descriptor, slots.default?.() ?? []);
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
/** Vue twin of `expo-blur`'s `BlurTargetView`, native on Android and a plain View on iOS */
|
|
41
|
+
export const BlurTargetView = defineComponent({
|
|
42
|
+
name: 'BlurTargetView',
|
|
43
|
+
inheritAttrs: false,
|
|
44
|
+
setup(_props, { attrs, slots }) {
|
|
45
|
+
return () => {
|
|
46
|
+
const descriptor = renderBlurTargetView(normalizeVueAttrs(attrs));
|
|
47
|
+
return h(descriptor.type, descriptor.props, slots.default?.() ?? []);
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { BlurTargetView, BlurView } from './blur';
|
|
2
|
+
export type { IBlurTargetViewVueProps as IBlurTargetViewProps, IBlurViewVueProps as IBlurViewProps, } from './blur';
|
|
3
|
+
export { BLUR_MODULE_NAME, blurTargetViewName, blurViewName, type IBlurMethod, type IBlurTint, } from '../core';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BlurTargetViewBase } from './shared';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/** Angular twin of `expo-blur`'s `BlurTargetView`, the native target view on Android */
|
|
4
|
+
export declare class BlurTargetView extends BlurTargetViewBase {
|
|
5
|
+
private readonly hostRef;
|
|
6
|
+
constructor();
|
|
7
|
+
get nativeElement(): unknown;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BlurTargetView, never>;
|
|
9
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BlurTargetView, "BlurTargetView", never, {}, {}, never, ["*"], true, never>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, ElementRef, NO_ERRORS_SCHEMA, ViewChild, } from '@angular/core';
|
|
2
|
+
import { warnIfViewNameIsDynamic } from '@symbiote-native/engine';
|
|
3
|
+
import { SymbioteHostPropsDirective } from '@symbiote-native/angular';
|
|
4
|
+
import { BLUR_MODULE_NAME } from '../../core';
|
|
5
|
+
import { BlurTargetViewBase } from './shared';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
const TEMPLATE_TAG = 'ViewManagerAdapter_ExpoBlur_ExpoBlurTargetView';
|
|
8
|
+
/** Angular twin of `expo-blur`'s `BlurTargetView`, the native target view on Android */
|
|
9
|
+
export class BlurTargetView extends BlurTargetViewBase {
|
|
10
|
+
hostRef;
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
warnIfViewNameIsDynamic(TEMPLATE_TAG, BLUR_MODULE_NAME, 'ExpoBlurTargetView');
|
|
14
|
+
}
|
|
15
|
+
get nativeElement() {
|
|
16
|
+
return this.hostRef.nativeElement;
|
|
17
|
+
}
|
|
18
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BlurTargetView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
19
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: BlurTargetView, isStandalone: true, selector: "BlurTargetView", viewQueries: [{ propertyName: "hostRef", first: true, predicate: ["host"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: `<ViewManagerAdapter_ExpoBlur_ExpoBlurTargetView #host [symbioteHostProps]="hostProps">
|
|
20
|
+
<ng-content />
|
|
21
|
+
</ViewManagerAdapter_ExpoBlur_ExpoBlurTargetView>`, isInline: true, dependencies: [{ kind: "directive", type: SymbioteHostPropsDirective, selector: "[symbioteHostProps]", inputs: ["symbioteHostProps"], exportAs: ["symbioteHost"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
22
|
+
}
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BlurTargetView, decorators: [{
|
|
24
|
+
type: Component,
|
|
25
|
+
args: [{
|
|
26
|
+
selector: 'BlurTargetView',
|
|
27
|
+
standalone: true,
|
|
28
|
+
imports: [SymbioteHostPropsDirective],
|
|
29
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
30
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
31
|
+
// Имя тега это нативное имя view, его нельзя собрать динамически
|
|
32
|
+
template: `<ViewManagerAdapter_ExpoBlur_ExpoBlurTargetView #host [symbioteHostProps]="hostProps">
|
|
33
|
+
<ng-content />
|
|
34
|
+
</ViewManagerAdapter_ExpoBlur_ExpoBlurTargetView>`,
|
|
35
|
+
}]
|
|
36
|
+
}], ctorParameters: () => [], propDecorators: { hostRef: [{
|
|
37
|
+
type: ViewChild,
|
|
38
|
+
args: ['host', { read: ElementRef, static: true }]
|
|
39
|
+
}] } });
|
|
40
|
+
//# sourceMappingURL=index.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../../src/angular/blur-target-view/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;;AAE9C,MAAM,YAAY,GAAG,gDAAgD,CAAC;AAEtE,wFAAwF;AAYxF,MAAM,OAAO,cAAe,SAAQ,kBAAkB;IAEnC,OAAO,CAAuB;IAE/C;QACE,KAAK,EAAE,CAAC;QACR,uBAAuB,CAAC,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IACpC,CAAC;uGAXU,cAAc;2FAAd,cAAc,sJACE,UAAU,kEAL3B;;oDAEwC,4DANxC,0BAA0B;;2FAQzB,cAAc;kBAX1B,SAAS;mBAAC;oBACT,QAAQ,EAAE,gBAAgB;oBAC1B,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,0BAA0B,CAAC;oBACrC,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,iEAAiE;oBACjE,QAAQ,EAAE;;oDAEwC;iBACnD;;sBAEE,SAAS;uBAAC,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BlurTargetView } from './index.ios';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BlurTargetViewBase } from './shared';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/** Angular twin of `expo-blur`'s `BlurTargetView`, a plain View on iOS */
|
|
4
|
+
export declare class BlurTargetView extends BlurTargetViewBase {
|
|
5
|
+
private readonly hostRef;
|
|
6
|
+
get nativeElement(): unknown;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BlurTargetView, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BlurTargetView, "BlurTargetView", never, {}, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, ElementRef, ViewChild, } from '@angular/core';
|
|
2
|
+
import { SymbioteHostPropsDirective, View } from '@symbiote-native/angular';
|
|
3
|
+
import { BlurTargetViewBase } from './shared';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/** Angular twin of `expo-blur`'s `BlurTargetView`, a plain View on iOS */
|
|
6
|
+
export class BlurTargetView extends BlurTargetViewBase {
|
|
7
|
+
hostRef;
|
|
8
|
+
get nativeElement() {
|
|
9
|
+
return this.hostRef.nativeElement;
|
|
10
|
+
}
|
|
11
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BlurTargetView, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
12
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: BlurTargetView, isStandalone: true, selector: "BlurTargetView", viewQueries: [{ propertyName: "hostRef", first: true, predicate: ["host"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: `<view #host [symbioteHostProps]="hostProps"><ng-content /></view>`, isInline: true, dependencies: [{ kind: "directive", type: SymbioteHostPropsDirective, selector: "[symbioteHostProps]", inputs: ["symbioteHostProps"], exportAs: ["symbioteHost"] }, { kind: "component", type: View, selector: "view" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
13
|
+
}
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BlurTargetView, decorators: [{
|
|
15
|
+
type: Component,
|
|
16
|
+
args: [{
|
|
17
|
+
selector: 'BlurTargetView',
|
|
18
|
+
standalone: true,
|
|
19
|
+
imports: [SymbioteHostPropsDirective, View],
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
template: `<view #host [symbioteHostProps]="hostProps"><ng-content /></view>`,
|
|
22
|
+
}]
|
|
23
|
+
}], propDecorators: { hostRef: [{
|
|
24
|
+
type: ViewChild,
|
|
25
|
+
args: ['host', { read: ElementRef, static: true }]
|
|
26
|
+
}] } });
|
|
27
|
+
//# sourceMappingURL=index.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../src/angular/blur-target-view/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,0BAA0B,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;;AAE9C,0EAA0E;AAQ1E,MAAM,OAAO,cAAe,SAAQ,kBAAkB;IAEnC,OAAO,CAAuB;IAE/C,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IACpC,CAAC;uGANU,cAAc;2FAAd,cAAc,sJACE,UAAU,kEAH3B,mEAAmE,4DAFnE,0BAA0B,2HAAE,IAAI;;2FAI/B,cAAc;kBAP1B,SAAS;mBAAC;oBACT,QAAQ,EAAE,gBAAgB;oBAC1B,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,0BAA0B,EAAE,IAAI,CAAC;oBAC3C,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,QAAQ,EAAE,mEAAmE;iBAC9E;;sBAEE,SAAS;uBAAC,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/blur-target-view/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NativeViewBase } from '@symbiote-native/angular';
|
|
2
|
+
import type { IDescriptor } from '@symbiote-native/components';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare abstract class BlurTargetViewBase extends NativeViewBase {
|
|
5
|
+
/** Нужен свойству `blurTarget` у `BlurView`, чтобы найти host-узел */
|
|
6
|
+
abstract readonly nativeElement: unknown;
|
|
7
|
+
protected readonly propNames: readonly [];
|
|
8
|
+
protected renderView(props: object): IDescriptor;
|
|
9
|
+
get hostProps(): Record<string, unknown>;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BlurTargetViewBase, never>;
|
|
11
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BlurTargetViewBase, never, never, {}, {}, never, never, true, never>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Directive, Input } from '@angular/core';
|
|
2
|
+
import { NativeViewBase } from '@symbiote-native/angular';
|
|
3
|
+
import { renderBlurTargetView } from '../../core';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
// Платформы различаются только тегом в шаблоне, остальное общее
|
|
6
|
+
export class BlurTargetViewBase extends NativeViewBase {
|
|
7
|
+
propNames = [];
|
|
8
|
+
renderView(props) {
|
|
9
|
+
return renderBlurTargetView(props);
|
|
10
|
+
}
|
|
11
|
+
get hostProps() {
|
|
12
|
+
return this.descriptor?.props ?? {};
|
|
13
|
+
}
|
|
14
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BlurTargetViewBase, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
15
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.8", type: BlurTargetViewBase, isStandalone: true, usesInheritance: true, ngImport: i0 });
|
|
16
|
+
}
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BlurTargetViewBase, decorators: [{
|
|
18
|
+
type: Directive
|
|
19
|
+
}] });
|
|
20
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/angular/blur-target-view/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;;AAElD,gEAAgE;AAEhE,MAAM,OAAgB,kBAAmB,SAAQ,cAAc;IAI1C,SAAS,GAAG,EAA2D,CAAC;IAExE,UAAU,CAAC,KAAa;QACzC,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC;IACtC,CAAC;uGAZmB,kBAAkB;2FAAlB,kBAAkB;;2FAAlB,kBAAkB;kBADvC,SAAS"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type AfterViewInit, type OnChanges, type OnDestroy, type SimpleChanges } from '@angular/core';
|
|
2
|
+
import { NativeViewBase } from '@symbiote-native/angular';
|
|
3
|
+
import type { IDescriptor } from '@symbiote-native/components';
|
|
4
|
+
import type { IBlurViewProps } from '../core';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/** Angular twin of `expo-blur`'s `BlurView`, the projected content paints over the blur */
|
|
7
|
+
export declare class BlurView extends NativeViewBase implements AfterViewInit, OnChanges, OnDestroy {
|
|
8
|
+
tint?: IBlurViewProps['tint'];
|
|
9
|
+
intensity?: IBlurViewProps['intensity'];
|
|
10
|
+
blurReductionFactor?: IBlurViewProps['blurReductionFactor'];
|
|
11
|
+
experimentalBlurMethod?: IBlurViewProps['experimentalBlurMethod'];
|
|
12
|
+
blurMethod?: IBlurViewProps['blurMethod'];
|
|
13
|
+
/** Template ref на `BlurTargetView`, его содержимое это фон для размытия */
|
|
14
|
+
blurTarget?: unknown;
|
|
15
|
+
protected readonly propNames: readonly ["tint", "intensity", "blurReductionFactor", "experimentalBlurMethod", "blurMethod"];
|
|
16
|
+
private blurTargetId;
|
|
17
|
+
private cancelWatch;
|
|
18
|
+
private isViewReady;
|
|
19
|
+
protected renderView(props: object): IDescriptor;
|
|
20
|
+
ngAfterViewInit(): void;
|
|
21
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
22
|
+
protected disposeView(): void;
|
|
23
|
+
private watchTarget;
|
|
24
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BlurView, never>;
|
|
25
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BlurView, "BlurView", never, { "tint": { "alias": "tint"; "required": false; }; "intensity": { "alias": "intensity"; "required": false; }; "blurReductionFactor": { "alias": "blurReductionFactor"; "required": false; }; "experimentalBlurMethod": { "alias": "experimentalBlurMethod"; "required": false; }; "blurMethod": { "alias": "blurMethod"; "required": false; }; "blurTarget": { "alias": "blurTarget"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Input, } from '@angular/core';
|
|
2
|
+
import { DescriptorHost, NativeViewBase, hostNodeOf, } from '@symbiote-native/angular';
|
|
3
|
+
import { renderBlurView, warnBlurProps, watchBlurTarget } from '../core';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/** Angular twin of `expo-blur`'s `BlurView`, the projected content paints over the blur */
|
|
6
|
+
export class BlurView extends NativeViewBase {
|
|
7
|
+
tint;
|
|
8
|
+
intensity;
|
|
9
|
+
blurReductionFactor;
|
|
10
|
+
experimentalBlurMethod;
|
|
11
|
+
blurMethod;
|
|
12
|
+
/** Template ref на `BlurTargetView`, его содержимое это фон для размытия */
|
|
13
|
+
blurTarget;
|
|
14
|
+
propNames = [
|
|
15
|
+
'tint',
|
|
16
|
+
'intensity',
|
|
17
|
+
'blurReductionFactor',
|
|
18
|
+
'experimentalBlurMethod',
|
|
19
|
+
'blurMethod',
|
|
20
|
+
];
|
|
21
|
+
blurTargetId;
|
|
22
|
+
cancelWatch = () => { };
|
|
23
|
+
isViewReady = false;
|
|
24
|
+
renderView(props) {
|
|
25
|
+
return renderBlurView(props, this.blurTargetId);
|
|
26
|
+
}
|
|
27
|
+
// Цель ставится при создании представления соседа, поэтому ждём `ngAfterViewInit`
|
|
28
|
+
ngAfterViewInit() {
|
|
29
|
+
this.isViewReady = true;
|
|
30
|
+
this.watchTarget();
|
|
31
|
+
warnBlurProps(Object.fromEntries(this.propNames.map(name => [name, Reflect.get(this, name)])), this.blurTarget !== undefined);
|
|
32
|
+
}
|
|
33
|
+
ngOnChanges(changes) {
|
|
34
|
+
super.ngOnChanges(changes);
|
|
35
|
+
if (this.isViewReady && 'blurTarget' in changes)
|
|
36
|
+
this.watchTarget();
|
|
37
|
+
}
|
|
38
|
+
disposeView() {
|
|
39
|
+
this.cancelWatch();
|
|
40
|
+
}
|
|
41
|
+
watchTarget() {
|
|
42
|
+
this.cancelWatch();
|
|
43
|
+
this.cancelWatch = watchBlurTarget(hostNodeOf(this.blurTarget), id => {
|
|
44
|
+
this.blurTargetId = id;
|
|
45
|
+
this.changeDetector.markForCheck();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BlurView, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
49
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: BlurView, isStandalone: true, selector: "BlurView", inputs: { tint: "tint", intensity: "intensity", blurReductionFactor: "blurReductionFactor", experimentalBlurMethod: "experimentalBlurMethod", blurMethod: "blurMethod", blurTarget: "blurTarget" }, usesInheritance: true, usesOnChanges: 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: BlurView, decorators: [{
|
|
54
|
+
type: Component,
|
|
55
|
+
args: [{
|
|
56
|
+
selector: 'BlurView',
|
|
57
|
+
standalone: true,
|
|
58
|
+
imports: [DescriptorHost],
|
|
59
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
60
|
+
template: `@if (descriptor; as node) {
|
|
61
|
+
<symbiote-descriptor-host [node]="node"><ng-content /></symbiote-descriptor-host>
|
|
62
|
+
}`,
|
|
63
|
+
}]
|
|
64
|
+
}], propDecorators: { tint: [{
|
|
65
|
+
type: Input
|
|
66
|
+
}], intensity: [{
|
|
67
|
+
type: Input
|
|
68
|
+
}], blurReductionFactor: [{
|
|
69
|
+
type: Input
|
|
70
|
+
}], experimentalBlurMethod: [{
|
|
71
|
+
type: Input
|
|
72
|
+
}], blurMethod: [{
|
|
73
|
+
type: Input
|
|
74
|
+
}], blurTarget: [{
|
|
75
|
+
type: Input
|
|
76
|
+
}] } });
|
|
77
|
+
//# sourceMappingURL=blur-view.js.map
|