@wireai/activation 0.14.2 → 0.14.3
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/CHANGELOG.md +71 -0
- package/README.md +12 -2
- package/dist/coachmarks/index.d.mts +12 -4
- package/dist/coachmarks/index.d.ts +12 -4
- package/dist/coachmarks/index.js +205 -56
- package/dist/coachmarks/index.js.map +1 -1
- package/dist/coachmarks/index.mjs +157 -7
- package/dist/coachmarks/index.mjs.map +1 -1
- package/dist/showcase/index.js +235 -46
- package/dist/showcase/index.js.map +1 -1
- package/dist/showcase/index.mjs +201 -10
- package/dist/showcase/index.mjs.map +1 -1
- package/metro/index.js +16 -5
- package/package.json +1 -1
- package/src/coachmarks/GestureHint.tsx +16 -7
- package/src/coachmarks/SpotlightOverlay.tsx +19 -13
- package/src/coachmarks/index.ts +7 -2
- package/src/coachmarks/reanimated.ts +342 -0
- package/src/showcase/FeatureShowcase.tsx +25 -9
- package/src/showcase/blazejOnboarding.ts +136 -0
- package/src/showcase/index.ts +8 -4
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React3, { createContext, useEffect, useMemo, useContext, useSyncExternalStore,
|
|
1
|
+
import React3, { createContext, forwardRef, createElement, useEffect, useMemo, useContext, useSyncExternalStore, useState, useReducer, useRef, useCallback } from 'react';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
4
|
-
import Animated, { useSharedValue, useReducedMotion, withRepeat, withSequence, withTiming, withDelay, useAnimatedStyle, useAnimatedProps, FadeOut, FadeIn } from 'react-native-reanimated';
|
|
3
|
+
import { View, StyleSheet, useWindowDimensions, Pressable, Text, AccessibilityInfo } from 'react-native';
|
|
5
4
|
|
|
6
5
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
7
6
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -87,8 +86,8 @@ var DEFAULT_TIMEOUT_MS = 4e3;
|
|
|
87
86
|
var failOpen = async (storage, key) => {
|
|
88
87
|
var _a;
|
|
89
88
|
if (!storage) return defaultWireFeatures;
|
|
90
|
-
const
|
|
91
|
-
return (_a =
|
|
89
|
+
const cached3 = await readCachedFeatures(storage, key);
|
|
90
|
+
return (_a = cached3 == null ? void 0 : cached3.features) != null ? _a : defaultWireFeatures;
|
|
92
91
|
};
|
|
93
92
|
var fetchWithTimeout = async (url, apiKey, timeoutMs) => {
|
|
94
93
|
const controller = typeof AbortController !== "undefined" ? new AbortController() : void 0;
|
|
@@ -367,6 +366,157 @@ var resolveBlurView = (requireModule = runtimeRequire) => {
|
|
|
367
366
|
return void 0;
|
|
368
367
|
}
|
|
369
368
|
};
|
|
369
|
+
var lastKnown = false;
|
|
370
|
+
var useReducedMotion = () => {
|
|
371
|
+
const [reduced, setReduced] = useState(lastKnown);
|
|
372
|
+
useEffect(() => {
|
|
373
|
+
let mounted = true;
|
|
374
|
+
AccessibilityInfo.isReduceMotionEnabled().then((value) => {
|
|
375
|
+
lastKnown = value;
|
|
376
|
+
if (mounted) setReduced(value);
|
|
377
|
+
}).catch(() => {
|
|
378
|
+
});
|
|
379
|
+
const sub = AccessibilityInfo.addEventListener("reduceMotionChanged", (value) => {
|
|
380
|
+
lastKnown = value;
|
|
381
|
+
setReduced(value);
|
|
382
|
+
});
|
|
383
|
+
return () => {
|
|
384
|
+
mounted = false;
|
|
385
|
+
sub == null ? void 0 : sub.remove();
|
|
386
|
+
};
|
|
387
|
+
}, []);
|
|
388
|
+
return reduced;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// src/coachmarks/reanimated.ts
|
|
392
|
+
var runtimeRequire2 = (moduleName) => {
|
|
393
|
+
if (moduleName !== "react-native-reanimated") return void 0;
|
|
394
|
+
if (typeof __require !== "function") return void 0;
|
|
395
|
+
try {
|
|
396
|
+
return __require("react-native-reanimated");
|
|
397
|
+
} catch {
|
|
398
|
+
return void 0;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
var useStaticSharedValue = (initial) => {
|
|
402
|
+
const [, bump] = useReducer((n) => n + 1, 0);
|
|
403
|
+
const box = useRef(null);
|
|
404
|
+
if (box.current === null) {
|
|
405
|
+
let current2 = initial;
|
|
406
|
+
box.current = {
|
|
407
|
+
get value() {
|
|
408
|
+
return current2;
|
|
409
|
+
},
|
|
410
|
+
set value(next) {
|
|
411
|
+
if (Object.is(next, current2)) return;
|
|
412
|
+
current2 = next;
|
|
413
|
+
bump();
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
return box.current;
|
|
418
|
+
};
|
|
419
|
+
var runWorklet = (factory, fallback) => {
|
|
420
|
+
var _a;
|
|
421
|
+
try {
|
|
422
|
+
return (_a = factory()) != null ? _a : fallback;
|
|
423
|
+
} catch {
|
|
424
|
+
return fallback;
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
var StaticAnimatedView = forwardRef(function StaticAnimatedView2({ entering: _entering, exiting: _exiting, children, ...rest }, ref) {
|
|
428
|
+
return createElement(View, { ...rest, ref }, children);
|
|
429
|
+
});
|
|
430
|
+
var staticCreateAnimatedComponent = (component) => function StaticAnimatedComponent({ animatedProps, ...rest }) {
|
|
431
|
+
return createElement(component, { ...rest, ...animatedProps });
|
|
432
|
+
};
|
|
433
|
+
var staticApi = {
|
|
434
|
+
present: false,
|
|
435
|
+
View: StaticAnimatedView,
|
|
436
|
+
createAnimatedComponent: staticCreateAnimatedComponent,
|
|
437
|
+
useSharedValue: useStaticSharedValue,
|
|
438
|
+
useAnimatedStyle: (factory) => runWorklet(factory, {}),
|
|
439
|
+
useAnimatedProps: (factory) => runWorklet(factory, {}),
|
|
440
|
+
useReducedMotion,
|
|
441
|
+
withTiming: (toValue) => toValue,
|
|
442
|
+
withRepeat: (animation) => animation,
|
|
443
|
+
withSequence: (...animations) => {
|
|
444
|
+
var _a;
|
|
445
|
+
return (_a = animations[animations.length - 1]) != null ? _a : 0;
|
|
446
|
+
},
|
|
447
|
+
withDelay: (_ms, animation) => animation,
|
|
448
|
+
fadeIn: () => void 0,
|
|
449
|
+
fadeOut: () => void 0
|
|
450
|
+
};
|
|
451
|
+
var isFunction = (value) => typeof value === "function";
|
|
452
|
+
var isComponent = (value) => typeof value === "function" || !!value && typeof value === "object" && "$$typeof" in value;
|
|
453
|
+
var fromModule = (mod) => {
|
|
454
|
+
var _a, _b;
|
|
455
|
+
if (!mod || typeof mod !== "object") return void 0;
|
|
456
|
+
const ns = mod;
|
|
457
|
+
const def = ns.default && typeof ns.default === "object" ? ns.default : void 0;
|
|
458
|
+
const pick = (name) => {
|
|
459
|
+
var _a2;
|
|
460
|
+
return (_a2 = ns[name]) != null ? _a2 : def == null ? void 0 : def[name];
|
|
461
|
+
};
|
|
462
|
+
const view = (_a = def == null ? void 0 : def.View) != null ? _a : ns.View;
|
|
463
|
+
const createAnimated = (_b = def == null ? void 0 : def.createAnimatedComponent) != null ? _b : ns.createAnimatedComponent;
|
|
464
|
+
const hooks = {
|
|
465
|
+
useSharedValue: pick("useSharedValue"),
|
|
466
|
+
useAnimatedStyle: pick("useAnimatedStyle"),
|
|
467
|
+
useAnimatedProps: pick("useAnimatedProps"),
|
|
468
|
+
useReducedMotion: pick("useReducedMotion"),
|
|
469
|
+
withTiming: pick("withTiming"),
|
|
470
|
+
withRepeat: pick("withRepeat"),
|
|
471
|
+
withSequence: pick("withSequence"),
|
|
472
|
+
withDelay: pick("withDelay")
|
|
473
|
+
};
|
|
474
|
+
const fadeIn = pick("FadeIn");
|
|
475
|
+
const fadeOut = pick("FadeOut");
|
|
476
|
+
if (!isComponent(view) || !isFunction(createAnimated)) return void 0;
|
|
477
|
+
if (Object.values(hooks).some((member) => !isFunction(member))) return void 0;
|
|
478
|
+
if (!fadeIn || !fadeOut) return void 0;
|
|
479
|
+
const api2 = {
|
|
480
|
+
present: true,
|
|
481
|
+
View: view,
|
|
482
|
+
createAnimatedComponent: createAnimated,
|
|
483
|
+
...hooks,
|
|
484
|
+
fadeIn: (durationMs) => fadeIn.duration(durationMs),
|
|
485
|
+
fadeOut: (durationMs) => fadeOut.duration(durationMs)
|
|
486
|
+
};
|
|
487
|
+
return api2;
|
|
488
|
+
};
|
|
489
|
+
var cached2;
|
|
490
|
+
var resolveReanimated = (requireModule = runtimeRequire2) => {
|
|
491
|
+
var _a;
|
|
492
|
+
try {
|
|
493
|
+
if (cached2 === void 0 || requireModule !== runtimeRequire2) {
|
|
494
|
+
const resolved = (_a = fromModule(requireModule("react-native-reanimated"))) != null ? _a : staticApi;
|
|
495
|
+
if (requireModule === runtimeRequire2) cached2 = resolved;
|
|
496
|
+
return resolved;
|
|
497
|
+
}
|
|
498
|
+
return cached2;
|
|
499
|
+
} catch {
|
|
500
|
+
return staticApi;
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
var api = () => resolveReanimated();
|
|
504
|
+
var Animated = {
|
|
505
|
+
get View() {
|
|
506
|
+
return api().View;
|
|
507
|
+
},
|
|
508
|
+
createAnimatedComponent: (component) => api().createAnimatedComponent(component)
|
|
509
|
+
};
|
|
510
|
+
var FadeIn = { duration: (durationMs) => api().fadeIn(durationMs) };
|
|
511
|
+
var FadeOut = { duration: (durationMs) => api().fadeOut(durationMs) };
|
|
512
|
+
var useSharedValue = (initial) => api().useSharedValue(initial);
|
|
513
|
+
var useAnimatedStyle = (factory) => api().useAnimatedStyle(factory);
|
|
514
|
+
var useAnimatedProps = (factory) => api().useAnimatedProps(factory);
|
|
515
|
+
var useReducedMotion2 = () => api().useReducedMotion();
|
|
516
|
+
var withTiming = (toValue, config) => api().withTiming(toValue, config);
|
|
517
|
+
var withRepeat = (animation, count, reverse) => api().withRepeat(animation, count, reverse);
|
|
518
|
+
var withSequence = (...animations) => api().withSequence(...animations);
|
|
519
|
+
var withDelay = (ms, animation) => api().withDelay(ms, animation);
|
|
370
520
|
var SWIPE_MS = 700;
|
|
371
521
|
var TAP_MS = 320;
|
|
372
522
|
var SPREAD_MS = 620;
|
|
@@ -428,7 +578,7 @@ var GestureHintComponent = ({
|
|
|
428
578
|
const opacity = useSharedValue(1);
|
|
429
579
|
const pulse = useSharedValue(1);
|
|
430
580
|
const spread = useSharedValue(0);
|
|
431
|
-
const reduced =
|
|
581
|
+
const reduced = useReducedMotion2();
|
|
432
582
|
const isSwipe = type === "swipe_up" || type === "swipe_down" || type === "swipe_left" || type === "swipe_right";
|
|
433
583
|
const isSpread = type === "pinch" || type === "zoom";
|
|
434
584
|
const isTap = type === "tap" || type === "double_tap";
|
|
@@ -598,7 +748,7 @@ var SpotlightOverlayComponent = ({
|
|
|
598
748
|
accentTextColor
|
|
599
749
|
}) => {
|
|
600
750
|
const { height: screenH } = useWindowDimensions();
|
|
601
|
-
const reduced =
|
|
751
|
+
const reduced = useReducedMotion2();
|
|
602
752
|
const theme = useOnboardingTheme();
|
|
603
753
|
const accent = accentColor != null ? accentColor : theme.colors.primary;
|
|
604
754
|
const accentText = accentTextColor != null ? accentTextColor : theme.colors.onPrimary;
|