@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 A. Prokopenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,218 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @symbiote-native/blur
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[`expo-blur`](https://docs.expo.dev/versions/latest/sdk/blur-view/) for **every**
|
|
4
|
+
[SymbioteNative](../../README.md) adapter: React, Vue, Svelte, Solid and Angular. `BlurView` blurs
|
|
5
|
+
what is behind it, `BlurTargetView` marks the content Android blurs.
|
|
6
|
+
|
|
7
|
+
Built the same way as [`@symbiote-native/clipboard`](../clipboard)'s `ClipboardPasteButton`, an
|
|
8
|
+
`expo-modules-core` native view reached through `requireNativeViewManager` (see the
|
|
9
|
+
`symbiote-expo-native-module` project skill: why `expo-modules-core` is depended on directly and never
|
|
10
|
+
the `expo` meta-package, why the upstream JS is hand-ported into `core/`, and how autolinking finds the
|
|
11
|
+
native module). One render function in `core/` returns a descriptor and every adapter only turns it into
|
|
12
|
+
its own element.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
**New app:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx @symbiote-native/cli new my-app --blur
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Existing SymbioteNative app:**
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx @symbiote-native/cli add --blur
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Either way: installs `@symbiote-native/blur` and wires the native autolinking automatically,
|
|
29
|
+
see [`@symbiote-native/cli`](../cli).
|
|
30
|
+
|
|
31
|
+
<details>
|
|
32
|
+
<summary>Manual install (no CLI - installing and wiring native autolinking by hand)</summary>
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @symbiote-native/blur
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Depends on `expo-blur` and `expo-modules-core` directly (regular dependencies, pinned to exact
|
|
39
|
+
versions, since this package's `core/` is hand-ported against one specific native API shape).
|
|
40
|
+
Never install `expo-blur` yourself, and never add the `expo` package to this project: it bundles
|
|
41
|
+
its own Metro/Babel pipeline that conflicts with this project's own.
|
|
42
|
+
|
|
43
|
+
### Required one-time step: native autolinking wiring
|
|
44
|
+
|
|
45
|
+
`expo-blur`'s native code is discovered by `expo-modules-autolinking`, not by RN's own
|
|
46
|
+
`react-native.config.cjs` mechanism. Wire it into the native host app **once**, it covers this package
|
|
47
|
+
and every other `expo-modules-core` package with zero further changes. The steps and the
|
|
48
|
+
mechanics behind them are in the `symbiote-expo-native-module` skill and in
|
|
49
|
+
[`@symbiote-native/network`](../network)'s README; the reference app is `examples/expo-react`.
|
|
50
|
+
|
|
51
|
+
</details>
|
|
52
|
+
|
|
53
|
+
## Shape
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
src/core/ blur.ts - props, the blurMethod warning, watchBlurTarget, renderBlurView
|
|
57
|
+
(a View carrying style over an absolute-fill native blur, both platforms) and
|
|
58
|
+
renderBlurTargetView (native on Android, a plain View on iOS).
|
|
59
|
+
src/react/ @symbiote-native/blur/react - BlurView, BlurTargetView
|
|
60
|
+
src/vue/ @symbiote-native/blur/vue - BlurView, BlurTargetView
|
|
61
|
+
src/svelte/ @symbiote-native/blur/svelte - BlurView, BlurTargetView (.svelte)
|
|
62
|
+
src/solid/ @symbiote-native/blur/solid - BlurView, BlurTargetView
|
|
63
|
+
src/angular/ @symbiote-native/blur/angular - BlurView, BlurTargetView
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`blurTarget` is each adapter's own reference to a `BlurTargetView`. The package resolves it to a node
|
|
67
|
+
and waits for the commit (`watchBlurTarget`) before telling native, so a Vue or Svelte render order cannot
|
|
68
|
+
hand native a tag that does not exist yet.
|
|
69
|
+
|
|
70
|
+
## Use it
|
|
71
|
+
|
|
72
|
+
### React
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import { BlurTargetView, BlurView } from '@symbiote-native/blur/react';
|
|
76
|
+
|
|
77
|
+
const target = useRef<IHostInstance>(null);
|
|
78
|
+
|
|
79
|
+
<BlurTargetView ref={target}>
|
|
80
|
+
<Image source={photo} />
|
|
81
|
+
</BlurTargetView>;
|
|
82
|
+
<BlurView blurTarget={target} blurMethod="dimezisBlurView" tint="light" intensity={60}>
|
|
83
|
+
<Text>Over the blur</Text>
|
|
84
|
+
</BlurView>;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Vue
|
|
88
|
+
|
|
89
|
+
```vue
|
|
90
|
+
<script setup lang="ts">
|
|
91
|
+
import { ref } from '@vue/runtime-core';
|
|
92
|
+
import { BlurTargetView, BlurView } from '@symbiote-native/blur/vue';
|
|
93
|
+
|
|
94
|
+
const target = ref(null);
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<template>
|
|
98
|
+
<BlurTargetView ref="target"><image :source="photo" /></BlurTargetView>
|
|
99
|
+
<BlurView :blur-target="target" blur-method="dimezisBlurView" tint="light" :intensity="60">
|
|
100
|
+
<text>Over the blur</text>
|
|
101
|
+
</BlurView>
|
|
102
|
+
</template>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Angular
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { BlurTargetView, BlurView } from '@symbiote-native/blur/angular';
|
|
109
|
+
|
|
110
|
+
@Component({
|
|
111
|
+
imports: [BlurTargetView, BlurView],
|
|
112
|
+
template: `
|
|
113
|
+
<BlurTargetView #target><image [source]="photo" /></BlurTargetView>
|
|
114
|
+
<BlurView [blurTarget]="target" blurMethod="dimezisBlurView" tint="light" [intensity]="60">
|
|
115
|
+
<text>Over the blur</text>
|
|
116
|
+
</BlurView>
|
|
117
|
+
`,
|
|
118
|
+
})
|
|
119
|
+
export class Card {}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Svelte
|
|
123
|
+
|
|
124
|
+
```svelte
|
|
125
|
+
<script lang="ts">
|
|
126
|
+
import { BlurTargetView, BlurView } from '@symbiote-native/blur/svelte';
|
|
127
|
+
|
|
128
|
+
let target = $state<unknown>();
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<BlurTargetView bind:ref={target}><image source={photo} /></BlurTargetView>
|
|
132
|
+
<BlurView blurTarget={target} blurMethod="dimezisBlurView" tint="light" intensity={60}>
|
|
133
|
+
<text>Over the blur</text>
|
|
134
|
+
</BlurView>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Solid
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
import { createSignal } from 'solid-js';
|
|
141
|
+
import { BlurTargetView, BlurView } from '@symbiote-native/blur/solid';
|
|
142
|
+
|
|
143
|
+
const [target, setTarget] = createSignal<IHostInstance>();
|
|
144
|
+
|
|
145
|
+
<BlurTargetView ref={setTarget}><image source={photo} /></BlurTargetView>;
|
|
146
|
+
<BlurView blurTarget={target()} blurMethod="dimezisBlurView" tint="light" intensity={60}>
|
|
147
|
+
<text>Over the blur</text>
|
|
148
|
+
</BlurView>;
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## API
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
<BlurView
|
|
155
|
+
tint?={'default' | 'light' | 'dark' | 'extraLight' | 'regular' | system materials}
|
|
156
|
+
intensity?={number} // 1..100, default 50
|
|
157
|
+
blurMethod?={'none' | 'dimezisBlurView' | 'dimezisBlurViewSdk31Plus'} // Android, default 'none'
|
|
158
|
+
blurReductionFactor?={number} // Android, divides the intensity, default 4
|
|
159
|
+
blurTarget?={BlurTargetView ref} // Android, needed by the dimezis methods
|
|
160
|
+
style? testID? nativeID? onLayout? ...View accessibility and responder props
|
|
161
|
+
/>
|
|
162
|
+
<BlurTargetView ref> // native on Android, a plain View on iOS
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Ported from upstream's `BlurView.tsx` and `BlurTargetView.tsx`.
|
|
166
|
+
|
|
167
|
+
## Notes
|
|
168
|
+
|
|
169
|
+
- **Android blurs nothing until you ask for it.** `blurMethod` defaults to `none`, which is only a
|
|
170
|
+
translucent view. Pick `dimezisBlurView` (or `dimezisBlurViewSdk31Plus`) and pass a `blurTarget`.
|
|
171
|
+
Without a target the package warns and falls back to `none`.
|
|
172
|
+
- **One `BlurTargetView` can serve many `BlurView`s**, as long as they all sit inside its bounds.
|
|
173
|
+
That is cheaper than one target per blur.
|
|
174
|
+
- **The blur view must be above what it blurs.** Place it after the content in the tree (or give it
|
|
175
|
+
a higher `zIndex`), not beside or under it.
|
|
176
|
+
- **Every iOS tint adds a translucent layer.** Each `tint` is a system material that sits over the
|
|
177
|
+
blur, and iOS exposes no plain blur radius. Android and the fallback can go without a tint.
|
|
178
|
+
- **`blurReductionFactor` is Android only.** It divides the intensity to bring the Android blur
|
|
179
|
+
closer to iOS.
|
|
180
|
+
- **Without the native view you get a plain `View`.** The package logs
|
|
181
|
+
`BlurView is not available on this platform` and renders your children without a blur.
|
|
182
|
+
- **Not ported.** The web variant (`BlurView.web.tsx`, `getBackgroundColor`) and the Reanimated `getAnimatableRef` hook. Angular templates spell the Android target tag statically, so an `__expo_app_identifier__` suffix makes it warn instead of render.
|
|
183
|
+
|
|
184
|
+
## Common questions
|
|
185
|
+
|
|
186
|
+
- **Nothing is blurred on Android.** `blurMethod` defaults to `none`. Wrap the content in a
|
|
187
|
+
`BlurTargetView`, pass its ref as `blurTarget` and set `blurMethod="dimezisBlurView"`.
|
|
188
|
+
- **The blur does not follow a scrolling list.** Render the blur view after the content, or give it
|
|
189
|
+
a higher `zIndex`. Beside or below the list it shows nothing.
|
|
190
|
+
- **Inside a `Modal` on Android.** Put the `Modal` inside the `BlurTargetView` and point the
|
|
191
|
+
`BlurView` in the `Modal` at that target. Not demoed in the canary apps.
|
|
192
|
+
- **Corners are not rounded.** Put `overflow: 'hidden'` next to the `borderRadius`.
|
|
193
|
+
- **Missing on some iPhones.** Settings > Accessibility > Display & Text Size > Reduce Transparency
|
|
194
|
+
turns blur off. Render a solid fallback.
|
|
195
|
+
- **No tint.** Not possible on iOS, every system blur style adds a tint layer.
|
|
196
|
+
- **Animating `intensity`.** It is a plain prop, drive it from state, a signal or a rune.
|
|
197
|
+
- **Android build cannot find `BlurView`.** The library comes from JitPack, which React Native's
|
|
198
|
+
Gradle plugin adds by default. It fails if `react.includeJitpackRepository=false`.
|
|
199
|
+
|
|
200
|
+
Sources: [Expo docs: BlurView](https://docs.expo.dev/versions/latest/sdk/blur-view/),
|
|
201
|
+
[expo/expo#6613](https://github.com/expo/expo/issues/6613),
|
|
202
|
+
[expo/expo#44165](https://github.com/expo/expo/issues/44165),
|
|
203
|
+
[expo/expo#18615](https://github.com/expo/expo/issues/18615),
|
|
204
|
+
[expo/expo#34737](https://github.com/expo/expo/issues/34737),
|
|
205
|
+
[expo/expo#49240](https://github.com/expo/expo/issues/49240),
|
|
206
|
+
[expo/expo#32781](https://github.com/expo/expo/issues/32781),
|
|
207
|
+
[expo/expo#34141](https://github.com/expo/expo/issues/34141).
|
|
208
|
+
|
|
209
|
+
## Test it
|
|
210
|
+
|
|
211
|
+
No device is needed for the logic. The core tests (`src/core/*.test.ts`) replace `expo-modules-core`
|
|
212
|
+
(`requireNativeViewManager`, `Platform`) and assert the descriptor a render function returns. The
|
|
213
|
+
adapter tests (`src/{react,vue,solid,angular}/**/*.test.*`, `vitest`) render the real component over the
|
|
214
|
+
recording Fabric with an injected view config and assert the committed payload, and Svelte's
|
|
215
|
+
`*.smoke.test.ts` compile the `.svelte` files and mount them. Painting itself is verified on a device in
|
|
216
|
+
the six `examples/expo-*` canary apps (`examples/expo-react`, `examples/expo-vue-sfc`,
|
|
217
|
+
`examples/expo-vue-tsx`, `examples/expo-svelte`, `examples/expo-solid`, `examples/expo-angular`), see the
|
|
218
|
+
parent [README](../../README.md).
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BlurTargetViewBase } from './shared';
|
|
2
|
+
/** Angular twin of `expo-blur`'s `BlurTargetView`, the native target view on Android */
|
|
3
|
+
export declare class BlurTargetView extends BlurTargetViewBase {
|
|
4
|
+
private readonly hostRef;
|
|
5
|
+
constructor();
|
|
6
|
+
get nativeElement(): unknown;
|
|
7
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { ChangeDetectionStrategy, Component, ElementRef, NO_ERRORS_SCHEMA, ViewChild, } from '@angular/core';
|
|
36
|
+
import { warnIfViewNameIsDynamic } from '@symbiote-native/engine';
|
|
37
|
+
import { SymbioteHostPropsDirective } from '@symbiote-native/angular';
|
|
38
|
+
import { BLUR_MODULE_NAME } from '../../core/index.js';
|
|
39
|
+
import { BlurTargetViewBase } from './shared.js';
|
|
40
|
+
const TEMPLATE_TAG = 'ViewManagerAdapter_ExpoBlur_ExpoBlurTargetView';
|
|
41
|
+
/** Angular twin of `expo-blur`'s `BlurTargetView`, the native target view on Android */
|
|
42
|
+
let BlurTargetView = (() => {
|
|
43
|
+
let _classDecorators = [Component({
|
|
44
|
+
selector: 'BlurTargetView',
|
|
45
|
+
standalone: true,
|
|
46
|
+
imports: [SymbioteHostPropsDirective],
|
|
47
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
48
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
49
|
+
// Имя тега это нативное имя view, его нельзя собрать динамически
|
|
50
|
+
template: `<ViewManagerAdapter_ExpoBlur_ExpoBlurTargetView
|
|
51
|
+
#host
|
|
52
|
+
[symbioteHostProps]="hostProps"
|
|
53
|
+
>
|
|
54
|
+
<ng-content />
|
|
55
|
+
</ViewManagerAdapter_ExpoBlur_ExpoBlurTargetView>`,
|
|
56
|
+
})];
|
|
57
|
+
let _classDescriptor;
|
|
58
|
+
let _classExtraInitializers = [];
|
|
59
|
+
let _classThis;
|
|
60
|
+
let _classSuper = BlurTargetViewBase;
|
|
61
|
+
let _hostRef_decorators;
|
|
62
|
+
let _hostRef_initializers = [];
|
|
63
|
+
let _hostRef_extraInitializers = [];
|
|
64
|
+
var BlurTargetView = class extends _classSuper {
|
|
65
|
+
static { _classThis = this; }
|
|
66
|
+
static {
|
|
67
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
68
|
+
_hostRef_decorators = [ViewChild('host', { read: ElementRef, static: true })];
|
|
69
|
+
__esDecorate(null, null, _hostRef_decorators, { kind: "field", name: "hostRef", static: false, private: false, access: { has: obj => "hostRef" in obj, get: obj => obj.hostRef, set: (obj, value) => { obj.hostRef = value; } }, metadata: _metadata }, _hostRef_initializers, _hostRef_extraInitializers);
|
|
70
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
71
|
+
BlurTargetView = _classThis = _classDescriptor.value;
|
|
72
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
73
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
74
|
+
}
|
|
75
|
+
hostRef = __runInitializers(this, _hostRef_initializers, void 0);
|
|
76
|
+
constructor() {
|
|
77
|
+
super();
|
|
78
|
+
__runInitializers(this, _hostRef_extraInitializers);
|
|
79
|
+
warnIfViewNameIsDynamic(TEMPLATE_TAG, BLUR_MODULE_NAME, 'ExpoBlurTargetView');
|
|
80
|
+
}
|
|
81
|
+
get nativeElement() {
|
|
82
|
+
return this.hostRef.nativeElement;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return BlurTargetView = _classThis;
|
|
86
|
+
})();
|
|
87
|
+
export { BlurTargetView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BlurTargetView } from './index.ios';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { ChangeDetectionStrategy, Component, ElementRef, ViewChild, } from '@angular/core';
|
|
36
|
+
import { SymbioteHostPropsDirective, View } from '@symbiote-native/angular';
|
|
37
|
+
import { BlurTargetViewBase } from './shared.js';
|
|
38
|
+
/** Angular twin of `expo-blur`'s `BlurTargetView`, a plain View on iOS */
|
|
39
|
+
let BlurTargetView = (() => {
|
|
40
|
+
let _classDecorators = [Component({
|
|
41
|
+
selector: 'BlurTargetView',
|
|
42
|
+
standalone: true,
|
|
43
|
+
imports: [SymbioteHostPropsDirective, View],
|
|
44
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
45
|
+
template: `<view #host [symbioteHostProps]="hostProps"><ng-content /></view>`,
|
|
46
|
+
})];
|
|
47
|
+
let _classDescriptor;
|
|
48
|
+
let _classExtraInitializers = [];
|
|
49
|
+
let _classThis;
|
|
50
|
+
let _classSuper = BlurTargetViewBase;
|
|
51
|
+
let _hostRef_decorators;
|
|
52
|
+
let _hostRef_initializers = [];
|
|
53
|
+
let _hostRef_extraInitializers = [];
|
|
54
|
+
var BlurTargetView = class extends _classSuper {
|
|
55
|
+
static { _classThis = this; }
|
|
56
|
+
static {
|
|
57
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
58
|
+
_hostRef_decorators = [ViewChild('host', { read: ElementRef, static: true })];
|
|
59
|
+
__esDecorate(null, null, _hostRef_decorators, { kind: "field", name: "hostRef", static: false, private: false, access: { has: obj => "hostRef" in obj, get: obj => obj.hostRef, set: (obj, value) => { obj.hostRef = value; } }, metadata: _metadata }, _hostRef_initializers, _hostRef_extraInitializers);
|
|
60
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
61
|
+
BlurTargetView = _classThis = _classDescriptor.value;
|
|
62
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
63
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
64
|
+
}
|
|
65
|
+
hostRef = __runInitializers(this, _hostRef_initializers, void 0);
|
|
66
|
+
get nativeElement() {
|
|
67
|
+
return this.hostRef.nativeElement;
|
|
68
|
+
}
|
|
69
|
+
constructor() {
|
|
70
|
+
super(...arguments);
|
|
71
|
+
__runInitializers(this, _hostRef_extraInitializers);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return BlurTargetView = _classThis;
|
|
75
|
+
})();
|
|
76
|
+
export { BlurTargetView };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NativeViewBase } from '@symbiote-native/angular';
|
|
2
|
+
import type { IDescriptor } from '@symbiote-native/components';
|
|
3
|
+
export declare abstract class BlurTargetViewBase extends NativeViewBase {
|
|
4
|
+
/** Нужен свойству `blurTarget` у `BlurView`, чтобы найти host-узел */
|
|
5
|
+
abstract readonly nativeElement: unknown;
|
|
6
|
+
protected readonly propNames: readonly [];
|
|
7
|
+
protected renderView(props: object): IDescriptor;
|
|
8
|
+
get hostProps(): Record<string, unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { Directive, Input } from '@angular/core';
|
|
36
|
+
import { NativeViewBase } from '@symbiote-native/angular';
|
|
37
|
+
import { renderBlurTargetView } from '../../core/index.js';
|
|
38
|
+
// Платформы различаются только тегом в шаблоне, остальное общее
|
|
39
|
+
let BlurTargetViewBase = (() => {
|
|
40
|
+
let _classDecorators = [Directive()];
|
|
41
|
+
let _classDescriptor;
|
|
42
|
+
let _classExtraInitializers = [];
|
|
43
|
+
let _classThis;
|
|
44
|
+
let _classSuper = NativeViewBase;
|
|
45
|
+
var BlurTargetViewBase = class extends _classSuper {
|
|
46
|
+
static { _classThis = this; }
|
|
47
|
+
static {
|
|
48
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
49
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
50
|
+
BlurTargetViewBase = _classThis = _classDescriptor.value;
|
|
51
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
52
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
53
|
+
}
|
|
54
|
+
propNames = [];
|
|
55
|
+
renderView(props) {
|
|
56
|
+
return renderBlurTargetView(props);
|
|
57
|
+
}
|
|
58
|
+
get hostProps() {
|
|
59
|
+
return this.descriptor?.props ?? {};
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return BlurTargetViewBase = _classThis;
|
|
63
|
+
})();
|
|
64
|
+
export { BlurTargetViewBase };
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
/** Angular twin of `expo-blur`'s `BlurView`, the projected content paints over the blur */
|
|
6
|
+
export declare class BlurView extends NativeViewBase implements AfterViewInit, OnChanges, OnDestroy {
|
|
7
|
+
tint?: IBlurViewProps['tint'];
|
|
8
|
+
intensity?: IBlurViewProps['intensity'];
|
|
9
|
+
blurReductionFactor?: IBlurViewProps['blurReductionFactor'];
|
|
10
|
+
experimentalBlurMethod?: IBlurViewProps['experimentalBlurMethod'];
|
|
11
|
+
blurMethod?: IBlurViewProps['blurMethod'];
|
|
12
|
+
/** Template ref на `BlurTargetView`, его содержимое это фон для размытия */
|
|
13
|
+
blurTarget?: unknown;
|
|
14
|
+
protected readonly propNames: readonly ["tint", "intensity", "blurReductionFactor", "experimentalBlurMethod", "blurMethod"];
|
|
15
|
+
private blurTargetId;
|
|
16
|
+
private cancelWatch;
|
|
17
|
+
private isViewReady;
|
|
18
|
+
protected renderView(props: object): IDescriptor;
|
|
19
|
+
ngAfterViewInit(): void;
|
|
20
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
21
|
+
protected disposeView(): void;
|
|
22
|
+
private watchTarget;
|
|
23
|
+
}
|