@hanzogui/animate 8.3.1 → 8.3.2
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/dist/cjs/Animate.js +59 -0
- package/dist/cjs/Animate.js.map +1 -0
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/Animate.js +56 -0
- package/dist/esm/Animate.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +19 -14
- package/src/index.ts +1 -1
- package/types/Animate.d.ts +24 -25
- package/types/Animate.d.ts.map +1 -11
- package/types/index.d.ts +1 -2
- package/types/index.d.ts.map +1 -11
- package/dist/cjs/Animate.cjs +0 -77
- package/dist/cjs/Animate.native.js +0 -81
- package/dist/cjs/Animate.native.js.map +0 -1
- package/dist/cjs/index.cjs +0 -20
- package/dist/cjs/index.native.js +0 -23
- package/dist/cjs/index.native.js.map +0 -1
- package/dist/esm/Animate.mjs +0 -52
- package/dist/esm/Animate.mjs.map +0 -1
- package/dist/esm/Animate.native.js +0 -53
- package/dist/esm/Animate.native.js.map +0 -1
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js +0 -2
- package/dist/esm/index.native.js.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Animate = Animate;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const animate_presence_1 = require("@hanzogui/animate-presence");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
/**
|
|
8
|
+
* Because mounting and unmounting children can be expensive, this gives us the
|
|
9
|
+
* option to avoid that.
|
|
10
|
+
*
|
|
11
|
+
* type: 'presence' will act just like AnimatePresence, except you use `present`
|
|
12
|
+
* instead of conditional children.
|
|
13
|
+
* Note that this does avoid reconciling the children even when present={false}
|
|
14
|
+
* so no extra cost to perf over AnimatePresence.
|
|
15
|
+
*
|
|
16
|
+
* type: 'presence' with keepChildrenMounted true *always* render the children so you pay
|
|
17
|
+
* the cost up-front to mount them, but then you avoid the mount cost at the start
|
|
18
|
+
* of the animation.
|
|
19
|
+
*
|
|
20
|
+
* There's no "right way" it just depends on the use case, this component just makes
|
|
21
|
+
* it easier to choose the strategy yourself.
|
|
22
|
+
*
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
function Animate({ children, lazyMount, type, present, passThrough, ...props }) {
|
|
26
|
+
const [lazyMounted, setLazyMounted] = (0, react_1.useState)(lazyMount ? false : present);
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
if (passThrough)
|
|
29
|
+
return;
|
|
30
|
+
if (!lazyMount)
|
|
31
|
+
return;
|
|
32
|
+
if (!present)
|
|
33
|
+
return;
|
|
34
|
+
(0, react_1.startTransition)(() => {
|
|
35
|
+
setLazyMounted(present);
|
|
36
|
+
});
|
|
37
|
+
}, [lazyMount, present]);
|
|
38
|
+
// always immediately unmount
|
|
39
|
+
const mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
40
|
+
if (type === 'presence') {
|
|
41
|
+
if (props.keepChildrenMounted) {
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(animate_presence_1.PresenceChild, { isPresent: true, ...(!passThrough && {
|
|
43
|
+
initial: props.initial ? undefined : false,
|
|
44
|
+
onExitComplete: props.onExitComplete,
|
|
45
|
+
enterVariant: props.enterVariant,
|
|
46
|
+
exitVariant: props.exitVariant,
|
|
47
|
+
enterExitVariant: props.enterExitVariant,
|
|
48
|
+
// BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
|
|
49
|
+
// but since we always re-render this component on open changes this should be fine to leave off?
|
|
50
|
+
presenceAffectsLayout: false,
|
|
51
|
+
isPresent: present,
|
|
52
|
+
custom: props.custom,
|
|
53
|
+
}), children: children }));
|
|
54
|
+
}
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(animate_presence_1.AnimatePresence, { passThrough: passThrough, ...props, children: mounted || passThrough ? children : null }));
|
|
56
|
+
}
|
|
57
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=Animate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Animate.js","sourceRoot":"","sources":["../../src/Animate.tsx"],"names":[],"mappings":";;;;AACA,iEAA2E;AAC3E,iCAA4D;AAgB5D;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAwB,EACtB,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,OAAO,EACP,WAAW,EACX,GAAG,KAAK,EACK;IACb,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAE3E,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,WAAW;YAAE,OAAM;QACvB,IAAI,CAAC,SAAS;YAAE,OAAM;QACtB,IAAI,CAAC,OAAO;YAAE,OAAM;QACpB,IAAA,uBAAe,EAAC,GAAG,EAAE;YACnB,cAAc,CAAC,OAAO,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAA;IAExB,6BAA6B;IAC7B,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAA;IAEpE,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,IAAI,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAC9B,OAAO,CACL,uBAAC,gCAAa,IACZ,SAAS,WACL,CAAC,CAAC,WAAW,IAAI;oBACnB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;oBAC1C,cAAc,EAAE,KAAK,CAAC,cAAc;oBACpC,YAAY,EAAE,KAAK,CAAC,YAAY;oBAChC,WAAW,EAAE,KAAK,CAAC,WAAW;oBAC9B,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;oBACxC,0FAA0F;oBAC1F,iGAAiG;oBACjG,qBAAqB,EAAE,KAAK;oBAC5B,SAAS,EAAE,OAAO;oBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;iBACrB,CAAC,YAED,QAAe,GACF,CACjB,CAAA;QACH,CAAC;QAED,OAAO,CACL,uBAAC,kCAAe,IAAC,WAAW,EAAE,WAAW,KAAM,KAAK,YACjD,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GACzB,CACnB,CAAA;IACH,CAAC;IAED,OAAO,2DAAG,QAAQ,GAAI,CAAA;AACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs" }
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AnimatePresence, PresenceChild } from '@hanzogui/animate-presence';
|
|
3
|
+
import { startTransition, useEffect, useState } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Because mounting and unmounting children can be expensive, this gives us the
|
|
6
|
+
* option to avoid that.
|
|
7
|
+
*
|
|
8
|
+
* type: 'presence' will act just like AnimatePresence, except you use `present`
|
|
9
|
+
* instead of conditional children.
|
|
10
|
+
* Note that this does avoid reconciling the children even when present={false}
|
|
11
|
+
* so no extra cost to perf over AnimatePresence.
|
|
12
|
+
*
|
|
13
|
+
* type: 'presence' with keepChildrenMounted true *always* render the children so you pay
|
|
14
|
+
* the cost up-front to mount them, but then you avoid the mount cost at the start
|
|
15
|
+
* of the animation.
|
|
16
|
+
*
|
|
17
|
+
* There's no "right way" it just depends on the use case, this component just makes
|
|
18
|
+
* it easier to choose the strategy yourself.
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export function Animate({ children, lazyMount, type, present, passThrough, ...props }) {
|
|
23
|
+
const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (passThrough)
|
|
26
|
+
return;
|
|
27
|
+
if (!lazyMount)
|
|
28
|
+
return;
|
|
29
|
+
if (!present)
|
|
30
|
+
return;
|
|
31
|
+
startTransition(() => {
|
|
32
|
+
setLazyMounted(present);
|
|
33
|
+
});
|
|
34
|
+
}, [lazyMount, present]);
|
|
35
|
+
// always immediately unmount
|
|
36
|
+
const mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
37
|
+
if (type === 'presence') {
|
|
38
|
+
if (props.keepChildrenMounted) {
|
|
39
|
+
return (_jsx(PresenceChild, { isPresent: true, ...(!passThrough && {
|
|
40
|
+
initial: props.initial ? undefined : false,
|
|
41
|
+
onExitComplete: props.onExitComplete,
|
|
42
|
+
enterVariant: props.enterVariant,
|
|
43
|
+
exitVariant: props.exitVariant,
|
|
44
|
+
enterExitVariant: props.enterExitVariant,
|
|
45
|
+
// BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
|
|
46
|
+
// but since we always re-render this component on open changes this should be fine to leave off?
|
|
47
|
+
presenceAffectsLayout: false,
|
|
48
|
+
isPresent: present,
|
|
49
|
+
custom: props.custom,
|
|
50
|
+
}), children: children }));
|
|
51
|
+
}
|
|
52
|
+
return (_jsx(AnimatePresence, { passThrough: passThrough, ...props, children: mounted || passThrough ? children : null }));
|
|
53
|
+
}
|
|
54
|
+
return _jsx(_Fragment, { children: children });
|
|
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oBAC1C,cAAc,EAAE,KAAK,CAAC,cAAc;oBACpC,YAAY,EAAE,KAAK,CAAC,YAAY;oBAChC,WAAW,EAAE,KAAK,CAAC,WAAW;oBAC9B,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;oBACxC,0FAA0F;oBAC1F,iGAAiG;oBACjG,qBAAqB,EAAE,KAAK;oBAC5B,SAAS,EAAE,OAAO;oBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;iBACrB,CAAC,YAED,QAAe,GACF,CACjB,CAAA;QACH,CAAC;QAED,OAAO,CACL,KAAC,eAAe,IAAC,WAAW,EAAE,WAAW,KAAM,KAAK,YACjD,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GACzB,CACnB,CAAA;IACH,CAAC;IAED,OAAO,4BAAG,QAAQ,GAAI,CAAA;AACxB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './Animate.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAe,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/animate",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -10,38 +10,43 @@
|
|
|
10
10
|
],
|
|
11
11
|
"type": "module",
|
|
12
12
|
"sideEffects": false,
|
|
13
|
-
"main": "dist/cjs",
|
|
14
|
-
"module": "dist/esm",
|
|
13
|
+
"main": "./dist/cjs/index.js",
|
|
14
|
+
"module": "./dist/esm/index.js",
|
|
15
15
|
"types": "./types/index.d.ts",
|
|
16
16
|
"exports": {
|
|
17
17
|
"./package.json": "./package.json",
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./types/index.d.ts",
|
|
20
|
-
"react-native": "./dist/esm/index.
|
|
21
|
-
"browser": "./dist/esm/index.
|
|
22
|
-
"module": "./dist/esm/index.
|
|
23
|
-
"import": "./dist/esm/index.
|
|
24
|
-
"require": "./dist/cjs/index.
|
|
25
|
-
"default": "./dist/esm/index.
|
|
20
|
+
"react-native": "./dist/esm/index.js",
|
|
21
|
+
"browser": "./dist/esm/index.js",
|
|
22
|
+
"module": "./dist/esm/index.js",
|
|
23
|
+
"import": "./dist/esm/index.js",
|
|
24
|
+
"require": "./dist/cjs/index.js",
|
|
25
|
+
"default": "./dist/esm/index.js"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
|
-
"build": "hanzogui-build",
|
|
32
|
+
"build": "hanzogui-build --skip-native",
|
|
33
33
|
"watch": "hanzogui-build --watch",
|
|
34
34
|
"clean": "hanzogui-build clean",
|
|
35
35
|
"clean:build": "hanzogui-build clean:build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@hanzogui/animate-presence": "8.3.
|
|
38
|
+
"@hanzogui/animate-presence": "8.3.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@hanzogui/build": "8.3.
|
|
42
|
-
"react": "
|
|
41
|
+
"@hanzogui/build": "8.3.2",
|
|
42
|
+
"react": "19.2.8"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"react": ">=19"
|
|
45
|
+
"react": ">=19.2.8"
|
|
46
|
+
},
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/hanzoai/gui.git",
|
|
50
|
+
"directory": "pkgs/ui/animate"
|
|
46
51
|
}
|
|
47
52
|
}
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './Animate'
|
|
1
|
+
export * from './Animate.tsx'
|
package/types/Animate.d.ts
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import type { AnimatePresenceProps } from
|
|
1
|
+
import type { AnimatePresenceProps } from '@hanzogui/animate-presence';
|
|
2
2
|
type BaseProps = {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
passThrough?: boolean;
|
|
5
5
|
};
|
|
6
6
|
type PresenceProps = AnimatePresenceProps & {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
type: 'presence';
|
|
8
|
+
present: boolean;
|
|
9
|
+
keepChildrenMounted?: boolean;
|
|
10
|
+
lazyMount?: boolean;
|
|
11
11
|
};
|
|
12
12
|
export type AnimateProps = BaseProps & PresenceProps;
|
|
13
13
|
/**
|
|
14
|
-
* Because mounting and unmounting children can be expensive, this gives us the
|
|
15
|
-
* option to avoid that.
|
|
16
|
-
*
|
|
17
|
-
* type: 'presence' will act just like AnimatePresence, except you use `present`
|
|
18
|
-
* instead of conditional children.
|
|
19
|
-
* Note that this does avoid reconciling the children even when present={false}
|
|
20
|
-
* so no extra cost to perf over AnimatePresence.
|
|
21
|
-
*
|
|
22
|
-
* type: 'presence' with keepChildrenMounted true *always* render the children so you pay
|
|
23
|
-
* the cost up-front to mount them, but then you avoid the mount cost at the start
|
|
24
|
-
* of the animation.
|
|
25
|
-
*
|
|
26
|
-
* There's no "right way" it just depends on the use case, this component just makes
|
|
27
|
-
* it easier to choose the strategy yourself.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
14
|
+
* Because mounting and unmounting children can be expensive, this gives us the
|
|
15
|
+
* option to avoid that.
|
|
16
|
+
*
|
|
17
|
+
* type: 'presence' will act just like AnimatePresence, except you use `present`
|
|
18
|
+
* instead of conditional children.
|
|
19
|
+
* Note that this does avoid reconciling the children even when present={false}
|
|
20
|
+
* so no extra cost to perf over AnimatePresence.
|
|
21
|
+
*
|
|
22
|
+
* type: 'presence' with keepChildrenMounted true *always* render the children so you pay
|
|
23
|
+
* the cost up-front to mount them, but then you avoid the mount cost at the start
|
|
24
|
+
* of the animation.
|
|
25
|
+
*
|
|
26
|
+
* There's no "right way" it just depends on the use case, this component just makes
|
|
27
|
+
* it easier to choose the strategy yourself.
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
31
|
export declare function Animate({ children, lazyMount, type, present, passThrough, ...props }: AnimateProps): React.ReactNode;
|
|
32
32
|
export {};
|
|
33
|
-
|
|
34
33
|
//# sourceMappingURL=Animate.d.ts.map
|
package/types/Animate.d.ts.map
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mappings": "AAAA,cAAc,4BAA4B;KAIrC,YAAY;CACf,UAAU,MAAM;CAChB;;KAGG,gBAAgB,uBAAuB;CAC1C,MAAM;CACN;CACA;CACA;;AAGF,YAAY,eAAe,YAAY;;;;;;;;;;;;;;;;;;;AAqBvC,OAAO,iBAAS,QAAQ,EACtB,UACA,WACA,MACA,SACA,aACA,GAAG,SACF,eAAe,MAAM",
|
|
3
|
-
"names": [],
|
|
4
|
-
"sources": [
|
|
5
|
-
"src/Animate.tsx"
|
|
6
|
-
],
|
|
7
|
-
"version": 3,
|
|
8
|
-
"sourcesContent": [
|
|
9
|
-
"import type { AnimatePresenceProps } from '@hanzogui/animate-presence'\nimport { AnimatePresence, PresenceChild } from '@hanzogui/animate-presence'\nimport { startTransition, useEffect, useState } from 'react'\n\ntype BaseProps = {\n children: React.ReactNode\n passThrough?: boolean\n}\n\ntype PresenceProps = AnimatePresenceProps & {\n type: 'presence'\n present: boolean\n keepChildrenMounted?: boolean\n lazyMount?: boolean\n}\n\nexport type AnimateProps = BaseProps & PresenceProps\n\n/**\n * Because mounting and unmounting children can be expensive, this gives us the\n * option to avoid that.\n *\n * type: 'presence' will act just like AnimatePresence, except you use `present`\n * instead of conditional children.\n * Note that this does avoid reconciling the children even when present={false}\n * so no extra cost to perf over AnimatePresence.\n *\n * type: 'presence' with keepChildrenMounted true *always* render the children so you pay\n * the cost up-front to mount them, but then you avoid the mount cost at the start\n * of the animation.\n *\n * There's no \"right way\" it just depends on the use case, this component just makes\n * it easier to choose the strategy yourself.\n *\n *\n */\n\nexport function Animate({\n children,\n lazyMount,\n type,\n present,\n passThrough,\n ...props\n}: AnimateProps): React.ReactNode {\n const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present)\n\n useEffect(() => {\n if (passThrough) return\n if (!lazyMount) return\n if (!present) return\n startTransition(() => {\n setLazyMounted(present)\n })\n }, [lazyMount, present])\n\n // always immediately unmount\n const mounted = !present ? false : lazyMount ? lazyMounted : present\n\n if (type === 'presence') {\n if (props.keepChildrenMounted) {\n return (\n <PresenceChild\n isPresent\n {...(!passThrough && {\n initial: props.initial ? undefined : false,\n onExitComplete: props.onExitComplete,\n enterVariant: props.enterVariant,\n exitVariant: props.exitVariant,\n enterExitVariant: props.enterExitVariant,\n // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu\n // but since we always re-render this component on open changes this should be fine to leave off?\n presenceAffectsLayout: false,\n isPresent: present,\n custom: props.custom,\n })}\n >\n {children as any}\n </PresenceChild>\n )\n }\n\n return (\n <AnimatePresence passThrough={passThrough} {...props}>\n {mounted || passThrough ? children : null}\n </AnimatePresence>\n )\n }\n\n return <>{children}</>\n}\n"
|
|
10
|
-
]
|
|
11
|
-
}
|
|
1
|
+
{"version":3,"file":"Animate.d.ts","sourceRoot":"","sources":["../src/Animate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAItE,KAAK,SAAS,GAAG;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,KAAK,aAAa,GAAG,oBAAoB,GAAG;IAC1C,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,OAAO,EACP,WAAW,EACX,GAAG,KAAK,EACT,EAAE,YAAY,GAAG,KAAK,CAAC,SAAS,CA8ChC"}
|
package/types/index.d.ts
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mappings": "AAAA,cAAc",
|
|
3
|
-
"names": [],
|
|
4
|
-
"sources": [
|
|
5
|
-
"src/index.ts"
|
|
6
|
-
],
|
|
7
|
-
"version": 3,
|
|
8
|
-
"sourcesContent": [
|
|
9
|
-
"export * from './Animate'\n"
|
|
10
|
-
]
|
|
11
|
-
}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
package/dist/cjs/Animate.cjs
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: () => from[key],
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
23
|
-
var Animate_exports = {};
|
|
24
|
-
__export(Animate_exports, {
|
|
25
|
-
Animate: () => Animate
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(Animate_exports);
|
|
28
|
-
var import_animate_presence = require("@hanzogui/animate-presence");
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
-
function Animate({
|
|
32
|
-
children,
|
|
33
|
-
lazyMount,
|
|
34
|
-
type,
|
|
35
|
-
present,
|
|
36
|
-
passThrough,
|
|
37
|
-
...props
|
|
38
|
-
}) {
|
|
39
|
-
const [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? false : present);
|
|
40
|
-
(0, import_react.useEffect)(() => {
|
|
41
|
-
if (passThrough) return;
|
|
42
|
-
if (!lazyMount) return;
|
|
43
|
-
if (!present) return;
|
|
44
|
-
(0, import_react.startTransition)(() => {
|
|
45
|
-
setLazyMounted(present);
|
|
46
|
-
});
|
|
47
|
-
}, [lazyMount, present]);
|
|
48
|
-
const mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
49
|
-
if (type === "presence") {
|
|
50
|
-
if (props.keepChildrenMounted) {
|
|
51
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.PresenceChild, {
|
|
52
|
-
isPresent: true,
|
|
53
|
-
...(!passThrough && {
|
|
54
|
-
initial: props.initial ? void 0 : false,
|
|
55
|
-
onExitComplete: props.onExitComplete,
|
|
56
|
-
enterVariant: props.enterVariant,
|
|
57
|
-
exitVariant: props.exitVariant,
|
|
58
|
-
enterExitVariant: props.enterExitVariant,
|
|
59
|
-
// BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
|
|
60
|
-
// but since we always re-render this component on open changes this should be fine to leave off?
|
|
61
|
-
presenceAffectsLayout: false,
|
|
62
|
-
isPresent: present,
|
|
63
|
-
custom: props.custom
|
|
64
|
-
}),
|
|
65
|
-
children
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
|
|
69
|
-
passThrough,
|
|
70
|
-
...props,
|
|
71
|
-
children: mounted || passThrough ? children : null
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
75
|
-
children
|
|
76
|
-
});
|
|
77
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
25
|
-
var Animate_exports = {};
|
|
26
|
-
__export(Animate_exports, {
|
|
27
|
-
Animate: () => Animate
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(Animate_exports);
|
|
30
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
-
var import_animate_presence = require("@hanzogui/animate-presence");
|
|
32
|
-
var import_react = require("react");
|
|
33
|
-
function Animate(param) {
|
|
34
|
-
var {
|
|
35
|
-
children,
|
|
36
|
-
lazyMount,
|
|
37
|
-
type,
|
|
38
|
-
present,
|
|
39
|
-
passThrough,
|
|
40
|
-
...props
|
|
41
|
-
} = param;
|
|
42
|
-
var [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? false : present);
|
|
43
|
-
(0, import_react.useEffect)(function () {
|
|
44
|
-
if (passThrough) return;
|
|
45
|
-
if (!lazyMount) return;
|
|
46
|
-
if (!present) return;
|
|
47
|
-
(0, import_react.startTransition)(function () {
|
|
48
|
-
setLazyMounted(present);
|
|
49
|
-
});
|
|
50
|
-
}, [lazyMount, present]);
|
|
51
|
-
var mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
52
|
-
if (type === "presence") {
|
|
53
|
-
if (props.keepChildrenMounted) {
|
|
54
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.PresenceChild, {
|
|
55
|
-
isPresent: true,
|
|
56
|
-
...(!passThrough && {
|
|
57
|
-
initial: props.initial ? void 0 : false,
|
|
58
|
-
onExitComplete: props.onExitComplete,
|
|
59
|
-
enterVariant: props.enterVariant,
|
|
60
|
-
exitVariant: props.exitVariant,
|
|
61
|
-
enterExitVariant: props.enterExitVariant,
|
|
62
|
-
// BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
|
|
63
|
-
// but since we always re-render this component on open changes this should be fine to leave off?
|
|
64
|
-
presenceAffectsLayout: false,
|
|
65
|
-
isPresent: present,
|
|
66
|
-
custom: props.custom
|
|
67
|
-
}),
|
|
68
|
-
children
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
|
|
72
|
-
passThrough,
|
|
73
|
-
...props,
|
|
74
|
-
children: mounted || passThrough ? children : null
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
78
|
-
children
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=Animate.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Animate_exports","__export","Animate","module","exports","import_jsx_runtime","require","import_animate_presence","import_react","param","children","lazyMount","type","present","passThrough","props","lazyMounted","setLazyMounted","useState","useEffect","startTransition","mounted","keepChildrenMounted","jsx","PresenceChild","isPresent","initial","onExitComplete","enterVariant","exitVariant","enterExitVariant","presenceAffectsLayout","custom","AnimatePresence","Fragment"],"sources":["../../src/Animate.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAT,YAAA,CAA+CK,eAAA;AAC/C,IAAAK,kBAAqD,GAAAC,OAAA;AA4D7C,IAAAC,uBAAA,GAAAD,OAAA;AAzBD,IAAAE,YAAS,GAAQF,OAAA;AAAA,SACtBJ,QAAAO,KAAA;EAC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 -1,20 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
8
|
-
get: () => from[key],
|
|
9
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: true
|
|
17
|
-
}), mod);
|
|
18
|
-
var index_exports = {};
|
|
19
|
-
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("./Animate.cjs"), module.exports);
|
package/dist/cjs/index.native.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
-
get: () => from[key],
|
|
11
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
}), mod);
|
|
20
|
-
var index_exports = {};
|
|
21
|
-
module.exports = __toCommonJS(index_exports);
|
|
22
|
-
__reExport(index_exports, require("./Animate.native.js"), module.exports);
|
|
23
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
|
package/dist/esm/Animate.mjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { AnimatePresence, PresenceChild } from "@hanzogui/animate-presence";
|
|
2
|
-
import { startTransition, useEffect, useState } from "react";
|
|
3
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
4
|
-
function Animate({
|
|
5
|
-
children,
|
|
6
|
-
lazyMount,
|
|
7
|
-
type,
|
|
8
|
-
present,
|
|
9
|
-
passThrough,
|
|
10
|
-
...props
|
|
11
|
-
}) {
|
|
12
|
-
const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (passThrough) return;
|
|
15
|
-
if (!lazyMount) return;
|
|
16
|
-
if (!present) return;
|
|
17
|
-
startTransition(() => {
|
|
18
|
-
setLazyMounted(present);
|
|
19
|
-
});
|
|
20
|
-
}, [lazyMount, present]);
|
|
21
|
-
const mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
22
|
-
if (type === "presence") {
|
|
23
|
-
if (props.keepChildrenMounted) {
|
|
24
|
-
return /* @__PURE__ */jsx(PresenceChild, {
|
|
25
|
-
isPresent: true,
|
|
26
|
-
...(!passThrough && {
|
|
27
|
-
initial: props.initial ? void 0 : false,
|
|
28
|
-
onExitComplete: props.onExitComplete,
|
|
29
|
-
enterVariant: props.enterVariant,
|
|
30
|
-
exitVariant: props.exitVariant,
|
|
31
|
-
enterExitVariant: props.enterExitVariant,
|
|
32
|
-
// BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
|
|
33
|
-
// but since we always re-render this component on open changes this should be fine to leave off?
|
|
34
|
-
presenceAffectsLayout: false,
|
|
35
|
-
isPresent: present,
|
|
36
|
-
custom: props.custom
|
|
37
|
-
}),
|
|
38
|
-
children
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return /* @__PURE__ */jsx(AnimatePresence, {
|
|
42
|
-
passThrough,
|
|
43
|
-
...props,
|
|
44
|
-
children: mounted || passThrough ? children : null
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
return /* @__PURE__ */jsx(Fragment, {
|
|
48
|
-
children
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
export { Animate };
|
|
52
|
-
//# sourceMappingURL=Animate.mjs.map
|
package/dist/esm/Animate.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["AnimatePresence","PresenceChild","startTransition","useEffect","useState","Fragment","jsx","Animate","children","lazyMount","type","present","passThrough","props","lazyMounted","setLazyMounted","mounted","keepChildrenMounted","isPresent","initial","onExitComplete","enterVariant","exitVariant","enterExitVariant","presenceAffectsLayout","custom"],"sources":["../../src/Animate.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,eAAA,EAAiBC,aAAA,QAAqB;AAC/C,SAASC,eAAA,EAAiBC,SAAA,E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QAAA;IAAGG;EAAA,CAAS;AACrB","ignoreList":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { AnimatePresence, PresenceChild } from "@hanzogui/animate-presence";
|
|
3
|
-
import { startTransition, useEffect, useState } from "react";
|
|
4
|
-
function Animate(param) {
|
|
5
|
-
var {
|
|
6
|
-
children,
|
|
7
|
-
lazyMount,
|
|
8
|
-
type,
|
|
9
|
-
present,
|
|
10
|
-
passThrough,
|
|
11
|
-
...props
|
|
12
|
-
} = param;
|
|
13
|
-
var [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present);
|
|
14
|
-
useEffect(function () {
|
|
15
|
-
if (passThrough) return;
|
|
16
|
-
if (!lazyMount) return;
|
|
17
|
-
if (!present) return;
|
|
18
|
-
startTransition(function () {
|
|
19
|
-
setLazyMounted(present);
|
|
20
|
-
});
|
|
21
|
-
}, [lazyMount, present]);
|
|
22
|
-
var mounted = !present ? false : lazyMount ? lazyMounted : present;
|
|
23
|
-
if (type === "presence") {
|
|
24
|
-
if (props.keepChildrenMounted) {
|
|
25
|
-
return /* @__PURE__ */_jsx(PresenceChild, {
|
|
26
|
-
isPresent: true,
|
|
27
|
-
...(!passThrough && {
|
|
28
|
-
initial: props.initial ? void 0 : false,
|
|
29
|
-
onExitComplete: props.onExitComplete,
|
|
30
|
-
enterVariant: props.enterVariant,
|
|
31
|
-
exitVariant: props.exitVariant,
|
|
32
|
-
enterExitVariant: props.enterExitVariant,
|
|
33
|
-
// BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
|
|
34
|
-
// but since we always re-render this component on open changes this should be fine to leave off?
|
|
35
|
-
presenceAffectsLayout: false,
|
|
36
|
-
isPresent: present,
|
|
37
|
-
custom: props.custom
|
|
38
|
-
}),
|
|
39
|
-
children
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return /* @__PURE__ */_jsx(AnimatePresence, {
|
|
43
|
-
passThrough,
|
|
44
|
-
...props,
|
|
45
|
-
children: mounted || passThrough ? children : null
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return /* @__PURE__ */_jsx(_Fragment, {
|
|
49
|
-
children
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
export { Animate };
|
|
53
|
-
//# sourceMappingURL=Animate.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["jsx","_jsx","Fragment","_Fragment","AnimatePresence","PresenceChild","startTransition","useEffect","useState","Animate","param","children","lazyMount","type","present","passThrough","props","lazyMounted","setLazyMounted","mounted","keepChildrenMounted","isPresent","initial","onExitComplete","enterVariant","exitVariant","enterExitVariant","presenceAffectsLayout","custom"],"sources":["../../src/Animate.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,GAAA,IAAAC,IAAA,EAAAC,QAAiB,IAAAC,SAAA,QAAqB;AAC/C,SAASC,eAAA,EAAiBC,aAAW,oCAAgB;AA4D7C,SA2BCC,eA3BD,EAAAC,SAAA,EAAAC,QAAA;AAzBD,SAASC,QAAQC,KAAA;EACtB;IAAAC,QAAA;IAAAC,SAAA;IAAAC,IAAA;IAAAC,OAAA;IAAAC,WAAA;IAAA,GAAAC;EAAA,IAAAN,KAAA;EACA,KAAAO,WAAA,EAAAC,cAAA,IAAAV,QAAA,CAAAI,SAAA,WAAAE,OAAA;EACAP,SAAA;IACA,IAAAQ,WAAA;IACA,KAAAH,SAAA;IACA,IAAG,CAAAE,OAAA;IAC6BR,eAAA;MAChCY,cAAO,CAAAJ,OAAa;IAEpB;EACE,IACAF,SAAK,EACLE,OAAK,CACL;EACE,IAAAK,OAAA,IAAAL,OAAe,QAAO,GAAAF,SAAA,GAAAK,WAAA,GAAAH,OAAA;EAAA,IACvBD,IAAA;IACH,IAAIG,KAAA,CAAAI,mBAAmB;MAGvB,OAAM,eAAqBnB,IAAA,CAAAI,aAAQ,EAAY;QAE3CgB,SAAS;QACP,KAAAN,WAAM;UACRO,OACE,EAAAN,KAAA,CAAAM,OAAA;UAACC,cAAA,EAAAP,KAAA,CAAAO,cAAA;UAAAC,YAAA,EAAAR,KAAA,CAAAQ,YAAA;UACCC,WAAS,EAAAT,KAAA,CAAAS,WAAA;UACRC,gBAAK,EAAAV,KAAe,CAAAU,gBAAA;UAAA;UACkB;UACfC,qBACR,EAAM;UAAAN,SACpB,EAAAP,OAAa;UAAMc,MACnB,EAAAZ,KAAA,CAAAY;QAAwB;QAAAjB;MAAA;IAGD;IACZ,sBACGV,IAAA,CAAAG,eAAA;MAAAW,WAChB;MAAA,GAAAC,KAEC;MAAAL,QAAA,EAAAQ,OAAA,IAAAJ,WAAA,GAAAJ,QAAA;IAAA,EACH;EAAA;EAIJ,sBACEV,IAAA,CAAAE,SAAC;IAILQ;EAEA;AACF","ignoreList":[]}
|
package/dist/esm/index.mjs
DELETED
package/dist/esm/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|
package/dist/esm/index.native.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|