@symbiote-native/blur 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +217 -2
- package/build/angular/blur-target-view/index.android.d.ts +7 -0
- package/build/angular/blur-target-view/index.android.js +87 -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 +138 -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 +46 -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 +81 -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 +46 -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 +22 -0
- package/src/angular/blur-view.ts +87 -0
- package/src/angular/index.ts +13 -0
- package/src/core/blur.ts +214 -0
- package/src/core/index.ts +15 -0
- package/src/react/blur.ts +49 -0
- package/src/react/index.ts +14 -0
- package/src/solid/blur.ts +60 -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
package/src/vue/blur.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
h,
|
|
4
|
+
isRef,
|
|
5
|
+
onBeforeUnmount,
|
|
6
|
+
onMounted,
|
|
7
|
+
onUpdated,
|
|
8
|
+
ref,
|
|
9
|
+
toRaw,
|
|
10
|
+
type VNode,
|
|
11
|
+
} from '@vue/runtime-core';
|
|
12
|
+
import { descriptorToVue, normalizeVueAttrs } from '@symbiote-native/vue';
|
|
13
|
+
import type { IViewProps } from '@symbiote-native/vue';
|
|
14
|
+
import {
|
|
15
|
+
renderBlurTargetView,
|
|
16
|
+
renderBlurView,
|
|
17
|
+
warnBlurProps,
|
|
18
|
+
watchBlurTarget,
|
|
19
|
+
} from '../core';
|
|
20
|
+
import type { IBlurTargetViewProps, IBlurViewProps } from '../core';
|
|
21
|
+
|
|
22
|
+
// Поверхность View как у `ViewProps` в upstream, дети идут слотом по умолчанию
|
|
23
|
+
export type IBlurViewVueProps = IBlurViewProps &
|
|
24
|
+
Omit<IViewProps, keyof IBlurViewProps> & {
|
|
25
|
+
/** Template ref на `BlurTargetView`, его содержимое это фон для размытия */
|
|
26
|
+
blurTarget?: unknown;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type IBlurTargetViewVueProps = IBlurTargetViewProps &
|
|
30
|
+
Omit<IViewProps, keyof IBlurTargetViewProps>;
|
|
31
|
+
|
|
32
|
+
// Template ref на компонент отдаёт его публичный экземпляр, корневой host-узел лежит в `$el`
|
|
33
|
+
function hostOf(target: unknown): unknown {
|
|
34
|
+
const value = isRef(target) ? target.value : target;
|
|
35
|
+
const host =
|
|
36
|
+
value !== null && typeof value === 'object' && '$el' in value
|
|
37
|
+
? value.$el
|
|
38
|
+
: value;
|
|
39
|
+
return toRaw(host);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Vue twin of `expo-blur`'s `BlurView`, the default slot paints over the blur */
|
|
43
|
+
export const BlurView = defineComponent({
|
|
44
|
+
name: 'BlurView',
|
|
45
|
+
// Все атрибуты это пропсы нативного view, на обёртку ничего не должно просочиться
|
|
46
|
+
inheritAttrs: false,
|
|
47
|
+
setup(_props, { attrs, slots }) {
|
|
48
|
+
const blurTargetId = ref<number | undefined>();
|
|
49
|
+
let cancelWatch = (): void => {};
|
|
50
|
+
const syncTarget = (): void => {
|
|
51
|
+
cancelWatch();
|
|
52
|
+
cancelWatch = watchBlurTarget(hostOf(attrs.blurTarget), id => {
|
|
53
|
+
blurTargetId.value = id;
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
// Ref цели ставится при патче, поэтому читаем его после монтирования и каждого обновления
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
syncTarget();
|
|
59
|
+
warnBlurProps(normalizeVueAttrs(attrs), attrs.blurTarget !== undefined);
|
|
60
|
+
});
|
|
61
|
+
onUpdated(syncTarget);
|
|
62
|
+
onBeforeUnmount(() => cancelWatch());
|
|
63
|
+
|
|
64
|
+
return (): VNode => {
|
|
65
|
+
const { blurTarget: _blurTarget, ...rest } = normalizeVueAttrs(attrs);
|
|
66
|
+
const descriptor = renderBlurView(rest, blurTargetId.value);
|
|
67
|
+
return descriptorToVue(descriptor, slots.default?.() ?? []);
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/** Vue twin of `expo-blur`'s `BlurTargetView`, native on Android and a plain View on iOS */
|
|
73
|
+
export const BlurTargetView = defineComponent({
|
|
74
|
+
name: 'BlurTargetView',
|
|
75
|
+
inheritAttrs: false,
|
|
76
|
+
setup(_props, { attrs, slots }) {
|
|
77
|
+
return (): VNode => {
|
|
78
|
+
const descriptor = renderBlurTargetView(normalizeVueAttrs(attrs));
|
|
79
|
+
return h(descriptor.type, descriptor.props, slots.default?.() ?? []);
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
});
|
package/src/vue/index.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @symbiote-native/blur/vue: компоненты `BlurView` и `BlurTargetView` поверх общего ядра
|
|
2
|
+
|
|
3
|
+
export { BlurTargetView, BlurView } from './blur';
|
|
4
|
+
export type {
|
|
5
|
+
IBlurTargetViewVueProps as IBlurTargetViewProps,
|
|
6
|
+
IBlurViewVueProps as IBlurViewProps,
|
|
7
|
+
} from './blur';
|
|
8
|
+
export {
|
|
9
|
+
BLUR_MODULE_NAME,
|
|
10
|
+
blurTargetViewName,
|
|
11
|
+
blurViewName,
|
|
12
|
+
type IBlurMethod,
|
|
13
|
+
type IBlurTint,
|
|
14
|
+
} from '../core';
|