shatter-morph 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 +174 -2
- package/dist/chunk-ETHEVVRU.js +3 -0
- package/dist/chunk-ETHEVVRU.js.map +1 -0
- package/dist/chunk-GTAQR2GH.js +1217 -0
- package/dist/chunk-GTAQR2GH.js.map +1 -0
- package/dist/chunk-SWLSKC4J.cjs +1227 -0
- package/dist/chunk-SWLSKC4J.cjs.map +1 -0
- package/dist/chunk-SWUNN6ZW.cjs +4 -0
- package/dist/chunk-SWUNN6ZW.cjs.map +1 -0
- package/dist/element.cjs +117 -0
- package/dist/element.cjs.map +1 -0
- package/dist/element.d.cts +21 -0
- package/dist/element.d.ts +21 -0
- package/dist/element.js +114 -0
- package/dist/element.js.map +1 -0
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +77 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +17 -0
- package/dist/react.d.ts +17 -0
- package/dist/react.js +48 -0
- package/dist/react.js.map +1 -0
- package/dist/shatter-morph.global.js +2 -0
- package/dist/shatter-morph.global.js.map +1 -0
- package/dist/types-CbWNqfzy.d.cts +32 -0
- package/dist/types-CbWNqfzy.d.ts +32 -0
- package/dist/vue.cjs +91 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.cts +49 -0
- package/dist/vue.d.ts +49 -0
- package/dist/vue.js +61 -0
- package/dist/vue.js.map +1 -0
- package/package.json +117 -4
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('./chunk-SWUNN6ZW.cjs');
|
|
4
|
+
var chunkSWLSKC4J_cjs = require('./chunk-SWLSKC4J.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "isShatterEnabled", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkSWLSKC4J_cjs.isShatterEnabled; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "prepareShatter", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkSWLSKC4J_cjs.prepareShatter; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "setShatterEnabled", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkSWLSKC4J_cjs.setShatterEnabled; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "shatterIn", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkSWLSKC4J_cjs.shatterIn; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "shatterOut", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkSWLSKC4J_cjs.shatterOut; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "shatterTo", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkSWLSKC4J_cjs.shatterTo; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "shatterUpdate", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return chunkSWLSKC4J_cjs.shatterUpdate; }
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=index.cjs.map
|
|
37
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { S as ShatterOptions, P as PreparedShatter, b as ShatterAnimation } from './types-CbWNqfzy.cjs';
|
|
2
|
+
export { c as ShatterMotion, d as ShatterOrigin, a as ShatterResult } from './types-CbWNqfzy.cjs';
|
|
3
|
+
|
|
4
|
+
declare function shatterOut(element: Element, options?: ShatterOptions): ShatterAnimation;
|
|
5
|
+
declare function shatterIn(element: Element, options?: ShatterOptions): ShatterAnimation;
|
|
6
|
+
declare function shatterTo(from: Element, to: Element, options?: ShatterOptions): ShatterAnimation;
|
|
7
|
+
declare function prepareShatter(element: Element, options?: ShatterOptions): PreparedShatter;
|
|
8
|
+
declare function shatterUpdate(element: Element, update: () => void | PromiseLike<unknown>, options?: ShatterOptions): ShatterAnimation;
|
|
9
|
+
|
|
10
|
+
declare function setShatterEnabled(value: boolean): void;
|
|
11
|
+
declare function isShatterEnabled(): boolean;
|
|
12
|
+
|
|
13
|
+
export { PreparedShatter, ShatterAnimation, ShatterOptions, isShatterEnabled, prepareShatter, setShatterEnabled, shatterIn, shatterOut, shatterTo, shatterUpdate };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { S as ShatterOptions, P as PreparedShatter, b as ShatterAnimation } from './types-CbWNqfzy.js';
|
|
2
|
+
export { c as ShatterMotion, d as ShatterOrigin, a as ShatterResult } from './types-CbWNqfzy.js';
|
|
3
|
+
|
|
4
|
+
declare function shatterOut(element: Element, options?: ShatterOptions): ShatterAnimation;
|
|
5
|
+
declare function shatterIn(element: Element, options?: ShatterOptions): ShatterAnimation;
|
|
6
|
+
declare function shatterTo(from: Element, to: Element, options?: ShatterOptions): ShatterAnimation;
|
|
7
|
+
declare function prepareShatter(element: Element, options?: ShatterOptions): PreparedShatter;
|
|
8
|
+
declare function shatterUpdate(element: Element, update: () => void | PromiseLike<unknown>, options?: ShatterOptions): ShatterAnimation;
|
|
9
|
+
|
|
10
|
+
declare function setShatterEnabled(value: boolean): void;
|
|
11
|
+
declare function isShatterEnabled(): boolean;
|
|
12
|
+
|
|
13
|
+
export { PreparedShatter, ShatterAnimation, ShatterOptions, isShatterEnabled, prepareShatter, setShatterEnabled, shatterIn, shatterOut, shatterTo, shatterUpdate };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/react.cjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
require('./chunk-SWUNN6ZW.cjs');
|
|
5
|
+
var chunkSWLSKC4J_cjs = require('./chunk-SWLSKC4J.cjs');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
|
|
8
|
+
function assignRef(ref, node) {
|
|
9
|
+
if (typeof ref === "function") ref(node);
|
|
10
|
+
else if (ref) ref.current = node;
|
|
11
|
+
}
|
|
12
|
+
var ShatterBoundary = class extends react.Component {
|
|
13
|
+
element = null;
|
|
14
|
+
setElement = (node) => {
|
|
15
|
+
this.element = node;
|
|
16
|
+
assignRef(this.props.forwardedRef, node);
|
|
17
|
+
};
|
|
18
|
+
getSnapshotBeforeUpdate(previous) {
|
|
19
|
+
if (!this.element || Object.is(previous.value, this.props.value)) return null;
|
|
20
|
+
return chunkSWLSKC4J_cjs.prepareShatter(this.element, this.props.options);
|
|
21
|
+
}
|
|
22
|
+
componentDidUpdate(previous, _state, prepared) {
|
|
23
|
+
if (previous.forwardedRef !== this.props.forwardedRef) {
|
|
24
|
+
assignRef(previous.forwardedRef, null);
|
|
25
|
+
assignRef(this.props.forwardedRef, this.element);
|
|
26
|
+
}
|
|
27
|
+
if (!prepared) return;
|
|
28
|
+
void prepared.play(this.props.options).finished.then((result) => this.props.onShatterComplete?.(result));
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const {
|
|
32
|
+
as = "div",
|
|
33
|
+
value: _value,
|
|
34
|
+
options: _options,
|
|
35
|
+
onShatterComplete: _complete,
|
|
36
|
+
forwardedRef: _ref,
|
|
37
|
+
children,
|
|
38
|
+
...rest
|
|
39
|
+
} = this.props;
|
|
40
|
+
return react.createElement(as, { ...rest, ref: this.setElement }, children);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var Shatter = react.forwardRef(function Shatter2(props, ref) {
|
|
44
|
+
return react.createElement(ShatterBoundary, { ...props, forwardedRef: ref });
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
Object.defineProperty(exports, "isShatterEnabled", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return chunkSWLSKC4J_cjs.isShatterEnabled; }
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "prepareShatter", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return chunkSWLSKC4J_cjs.prepareShatter; }
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "setShatterEnabled", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () { return chunkSWLSKC4J_cjs.setShatterEnabled; }
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "shatterIn", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () { return chunkSWLSKC4J_cjs.shatterIn; }
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "shatterOut", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () { return chunkSWLSKC4J_cjs.shatterOut; }
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "shatterTo", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () { return chunkSWLSKC4J_cjs.shatterTo; }
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(exports, "shatterUpdate", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function () { return chunkSWLSKC4J_cjs.shatterUpdate; }
|
|
74
|
+
});
|
|
75
|
+
exports.Shatter = Shatter;
|
|
76
|
+
//# sourceMappingURL=react.cjs.map
|
|
77
|
+
//# sourceMappingURL=react.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/react.ts"],"names":["Component","prepareShatter","createElement","forwardRef","Shatter"],"mappings":";;;;;;AAg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AAAA,EAES,MAAA,GAAS;AAChB,IAAA,MAAM;AAAA,MACJ,EAAA,GAAK,KAAA;AAAA,MACL,KAAA,EAAO,MAAA;AAAA,MACP,OAAA,EAAS,QAAA;AAAA,MACT,iBAAA,EAAmB,SAAA;AAAA,MACnB,YAAA,EAAc,IAAA;AAAA,MACd,QAAA;AAAA,MACA,GAAG;AAAA,QACD,IAAA,CAAK,KAAA;AACT,IAAA,OAAOC,mBAAA,CAAc,IAAI,EAAE,GAAG,MAAM,GAAA,EAAK,IAAA,CAAK,UAAA,EAAW,EAAG,QAAQ,CAAA;AAAA,EACtE;AACF,CAAA;AAEO,IAAM,OAAA,GAAUC,gBAAA,CAAsC,SAASC,QAAAA,CAAQ,OAAO,GAAA,EAAK;AACxF,EAAA,OAAOF,oBAAc,eAAA,EAAiB,EAAE,GAAG,KAAA,EAAO,YAAA,EAAc,KAAK,CAAA;AACvE,CAAC","file":"react.cjs","sourcesContent":["import { Component, createElement, forwardRef, type ForwardedRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { prepareShatter } from '../core/shatter';\nimport type { PreparedShatter, ShatterOptions, ShatterResult } from '../core/types';\n\nexport interface ShatterProps extends HTMLAttributes<HTMLElement> {\n value: unknown;\n as?: keyof HTMLElementTagNameMap;\n options?: ShatterOptions;\n onShatterComplete?: (result: ShatterResult) => void;\n children?: ReactNode;\n}\n\ninterface BoundaryProps extends ShatterProps {\n forwardedRef: ForwardedRef<HTMLElement>;\n}\n\nfunction assignRef(ref: ForwardedRef<HTMLElement>, node: HTMLElement | null) {\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n}\n\nclass ShatterBoundary extends Component<BoundaryProps> {\n private element: HTMLElement | null = null;\n\n private readonly setElement = (node: HTMLElement | null) => {\n this.element = node;\n assignRef(this.props.forwardedRef, node);\n };\n\n override getSnapshotBeforeUpdate(previous: BoundaryProps): PreparedShatter | null {\n if (!this.element || Object.is(previous.value, this.props.value)) return null;\n return prepareShatter(this.element, this.props.options);\n }\n\n override componentDidUpdate(previous: BoundaryProps, _state: unknown, prepared: PreparedShatter | null) {\n if (previous.forwardedRef !== this.props.forwardedRef) {\n assignRef(previous.forwardedRef, null);\n assignRef(this.props.forwardedRef, this.element);\n }\n if (!prepared) return;\n void prepared.play(this.props.options).finished.then((result) => this.props.onShatterComplete?.(result));\n }\n\n override render() {\n const {\n as = 'div',\n value: _value,\n options: _options,\n onShatterComplete: _complete,\n forwardedRef: _ref,\n children,\n ...rest\n } = this.props;\n return createElement(as, { ...rest, ref: this.setElement }, children);\n }\n}\n\nexport const Shatter = forwardRef<HTMLElement, ShatterProps>(function Shatter(props, ref) {\n return createElement(ShatterBoundary, { ...props, forwardedRef: ref });\n});\n"]}
|
package/dist/react.d.cts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import { S as ShatterOptions, a as ShatterResult } from './types-CbWNqfzy.cjs';
|
|
4
|
+
export { P as PreparedShatter, b as ShatterAnimation, c as ShatterMotion, d as ShatterOrigin } from './types-CbWNqfzy.cjs';
|
|
5
|
+
export { isShatterEnabled, prepareShatter, setShatterEnabled, shatterIn, shatterOut, shatterTo, shatterUpdate } from './index.cjs';
|
|
6
|
+
|
|
7
|
+
interface ShatterProps extends HTMLAttributes<HTMLElement> {
|
|
8
|
+
value: unknown;
|
|
9
|
+
as?: keyof HTMLElementTagNameMap;
|
|
10
|
+
options?: ShatterOptions;
|
|
11
|
+
onShatterComplete?: (result: ShatterResult) => void;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare const Shatter: react.ForwardRefExoticComponent<ShatterProps & react.RefAttributes<HTMLElement>>;
|
|
15
|
+
|
|
16
|
+
export { Shatter, ShatterOptions, ShatterResult };
|
|
17
|
+
export type { ShatterProps };
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import { S as ShatterOptions, a as ShatterResult } from './types-CbWNqfzy.js';
|
|
4
|
+
export { P as PreparedShatter, b as ShatterAnimation, c as ShatterMotion, d as ShatterOrigin } from './types-CbWNqfzy.js';
|
|
5
|
+
export { isShatterEnabled, prepareShatter, setShatterEnabled, shatterIn, shatterOut, shatterTo, shatterUpdate } from './index.js';
|
|
6
|
+
|
|
7
|
+
interface ShatterProps extends HTMLAttributes<HTMLElement> {
|
|
8
|
+
value: unknown;
|
|
9
|
+
as?: keyof HTMLElementTagNameMap;
|
|
10
|
+
options?: ShatterOptions;
|
|
11
|
+
onShatterComplete?: (result: ShatterResult) => void;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare const Shatter: react.ForwardRefExoticComponent<ShatterProps & react.RefAttributes<HTMLElement>>;
|
|
15
|
+
|
|
16
|
+
export { Shatter, ShatterOptions, ShatterResult };
|
|
17
|
+
export type { ShatterProps };
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { prepareShatter } from './chunk-GTAQR2GH.js';
|
|
4
|
+
export { isShatterEnabled, prepareShatter, setShatterEnabled, shatterIn, shatterOut, shatterTo, shatterUpdate } from './chunk-GTAQR2GH.js';
|
|
5
|
+
import { forwardRef, createElement, Component } from 'react';
|
|
6
|
+
|
|
7
|
+
function assignRef(ref, node) {
|
|
8
|
+
if (typeof ref === "function") ref(node);
|
|
9
|
+
else if (ref) ref.current = node;
|
|
10
|
+
}
|
|
11
|
+
var ShatterBoundary = class extends Component {
|
|
12
|
+
element = null;
|
|
13
|
+
setElement = (node) => {
|
|
14
|
+
this.element = node;
|
|
15
|
+
assignRef(this.props.forwardedRef, node);
|
|
16
|
+
};
|
|
17
|
+
getSnapshotBeforeUpdate(previous) {
|
|
18
|
+
if (!this.element || Object.is(previous.value, this.props.value)) return null;
|
|
19
|
+
return prepareShatter(this.element, this.props.options);
|
|
20
|
+
}
|
|
21
|
+
componentDidUpdate(previous, _state, prepared) {
|
|
22
|
+
if (previous.forwardedRef !== this.props.forwardedRef) {
|
|
23
|
+
assignRef(previous.forwardedRef, null);
|
|
24
|
+
assignRef(this.props.forwardedRef, this.element);
|
|
25
|
+
}
|
|
26
|
+
if (!prepared) return;
|
|
27
|
+
void prepared.play(this.props.options).finished.then((result) => this.props.onShatterComplete?.(result));
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
const {
|
|
31
|
+
as = "div",
|
|
32
|
+
value: _value,
|
|
33
|
+
options: _options,
|
|
34
|
+
onShatterComplete: _complete,
|
|
35
|
+
forwardedRef: _ref,
|
|
36
|
+
children,
|
|
37
|
+
...rest
|
|
38
|
+
} = this.props;
|
|
39
|
+
return createElement(as, { ...rest, ref: this.setElement }, children);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var Shatter = forwardRef(function Shatter2(props, ref) {
|
|
43
|
+
return createElement(ShatterBoundary, { ...props, forwardedRef: ref });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export { Shatter };
|
|
47
|
+
//# sourceMappingURL=react.js.map
|
|
48
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/react.ts"],"names":["Shatter"],"mappings":";;;;;AAgBA,SAAS,SAAA,CAAU,KAAgC,IAAA,EAA0B;AAC3E,EAAA,IAAI,OAAO,GAAA,KAAQ,UAAA,EAAY,GAAA,CAAI,IAAI,CAAA;AAAA,OAAA,IAC9B,GAAA,MAAS,OAAA,GAAU,IAAA;AAC9B;AAEA,IAAM,eAAA,GAAN,cAA8B,SAAA,CAAyB;AAAA,EAC7C,OAAA,GAA8B,IAAA;AAAA,EAErB,UAAA,GAAa,CAAC,IAAA,KAA6B;AAC1D,IAAA,IAAA,CAAK,OAAA,GAAU,IAAA;AACf,IAAA,SAAA,CAAU,IAAA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ACtE;AACF,CAAA;AAEO,IAAM,OAAA,GAAU,UAAA,CAAsC,SAASA,QAAAA,CAAQ,OAAO,GAAA,EAAK;AACxF,EAAA,OAAO,cAAc,eAAA,EAAiB,EAAE,GAAG,KAAA,EAAO,YAAA,EAAc,KAAK,CAAA;AACvE,CAAC","file":"react.js","sourcesContent":["import { Component, createElement, forwardRef, type ForwardedRef, type HTMLAttributes, type ReactNode } from 'react';\nimport { prepareShatter } from '../core/shatter';\nimport type { PreparedShatter, ShatterOptions, ShatterResult } from '../core/types';\n\nexport interface ShatterProps extends HTMLAttributes<HTMLElement> {\n value: unknown;\n as?: keyof HTMLElementTagNameMap;\n options?: ShatterOptions;\n onShatterComplete?: (result: ShatterResult) => void;\n children?: ReactNode;\n}\n\ninterface BoundaryProps extends ShatterProps {\n forwardedRef: ForwardedRef<HTMLElement>;\n}\n\nfunction assignRef(ref: ForwardedRef<HTMLElement>, node: HTMLElement | null) {\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n}\n\nclass ShatterBoundary extends Component<BoundaryProps> {\n private element: HTMLElement | null = null;\n\n private readonly setElement = (node: HTMLElement | null) => {\n this.element = node;\n assignRef(this.props.forwardedRef, node);\n };\n\n override getSnapshotBeforeUpdate(previous: BoundaryProps): PreparedShatter | null {\n if (!this.element || Object.is(previous.value, this.props.value)) return null;\n return prepareShatter(this.element, this.props.options);\n }\n\n override componentDidUpdate(previous: BoundaryProps, _state: unknown, prepared: PreparedShatter | null) {\n if (previous.forwardedRef !== this.props.forwardedRef) {\n assignRef(previous.forwardedRef, null);\n assignRef(this.props.forwardedRef, this.element);\n }\n if (!prepared) return;\n void prepared.play(this.props.options).finished.then((result) => this.props.onShatterComplete?.(result));\n }\n\n override render() {\n const {\n as = 'div',\n value: _value,\n options: _options,\n onShatterComplete: _complete,\n forwardedRef: _ref,\n children,\n ...rest\n } = this.props;\n return createElement(as, { ...rest, ref: this.setElement }, children);\n }\n}\n\nexport const Shatter = forwardRef<HTMLElement, ShatterProps>(function Shatter(props, ref) {\n return createElement(ShatterBoundary, { ...props, forwardedRef: ref });\n});\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var ShatterMorph=(()=>{var tt=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.prototype.hasOwnProperty;var re=(t,e)=>{for(var n in e)tt(t,n,{get:e[n],enumerable:!0})},ie=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ne(e))!oe.call(t,r)&&r!==n&&tt(t,r,{get:()=>e[r],enumerable:!(o=ee(e,r))||o.enumerable});return t};var se=t=>ie(tt({},"__esModule",{value:!0}),t);var Sn={};re(Sn,{SHATTER_COMPLETE_EVENT:()=>ut,defineShatterMorphElement:()=>Q,isShatterEnabled:()=>Z,prepareShatter:()=>ct,setShatterEnabled:()=>Yt,shatterIn:()=>Zt,shatterOut:()=>Kt,shatterTo:()=>J,shatterUpdate:()=>Jt});var ht=Math.PI*2,pt=.42,mt=.12,ae=1-pt-mt,O=t=>Math.min(Math.max(t,0),1),w=(t,e,n)=>t+(e-t)*n;function S(t,e,n){let o=O((n-t)/(e-t));return o*o*(3-2*o)}function V(t,e,n){let o;return e==="left"?o=t.x:e==="right"?o=1-t.x:e==="top"?o=t.y:e==="bottom"?o=1-t.y:o=O(Math.hypot(t.x-.5,t.y-.5)/Math.SQRT1_2),O(o)*pt+O(n)*mt}function H(t,e){return S(0,ae,t-e)}function z(t){return S(0,.2,t)*(1-S(.8,1,t))}function B(t,e,n,o){let r=Math.sin(Math.PI*e);if(t==="burst"){let l=n.a*ht,c=(n.b-.5)*Math.PI,u=o*(.55+n.c*.75)*r;return{x:Math.cos(l)*Math.cos(c)*u,y:Math.sin(c)*u*.8,z:Math.sin(l)*Math.cos(c)*u*.7}}if(t==="fall"){let l=e<.5?(e*2)**2:-(((1-e)*2)**2);return{x:(n.a-.5)*o*1.1*r,y:l*o*1.35+(n.b-.5)*o*.25*r,z:(n.c-.5)*o*.6*r}}let i=e*ht*1.08-.62,s=o*(.82+.18*r),a=o*.2*(.35+r);return{x:Math.cos(i)*s*1.04+(n.b-.5)*a,y:-Math.sin(i)*s*.86+(n.c-.5)*a,z:Math.sin(i+.9)*s*.6+(n.d-.5)*a*1.4}}function dt(t,e){return t==="fall"?S(0,.12,Math.abs(e-.5)):1}var le=1.5;function ft(t,e,n){let{frame:o,origin:r,random:i}=e,s=[];for(let a=0;a<t;a+=1){let l={a:i(),b:i(),c:i(),d:i()},c={x:i(),y:i()};s.push({x:o.left+c.x*o.width,y:o.top+c.y*o.height,delay:V(c,r,l.a),size:n(l),seed:l})}return s}function ce(t){let e=document.createElement("canvas");e.width=96,e.height=96;let n=e.getContext("2d");if(!n)return null;let o=n.createRadialGradient(48,48,0,48,48,48);return o.addColorStop(0,t),o.addColorStop(1,"rgba(0, 0, 0, 0)"),n.fillStyle=o,n.fillRect(0,0,96,96),e}function yt(t){let{canvas:e,color:n,motion:o,radius:r,perspective:i,center:s,frame:a}=t,l=e.getContext("2d");if(!l)return null;let c=Math.min(window.devicePixelRatio||1,le),u=window.innerWidth,h=window.innerHeight;e.width=Math.round(u*c),e.height=Math.round(h*c);let d=Math.max(a.width,a.height),y=ft(t.dust,t,f=>Math.max(d*.004,1.2)*(.6+f.d)),x=ft(t.mist,t,f=>d*(.24+f.d*.26)),b=x.length?ce(n):null,g=(f,M)=>{let E=H(M,f.delay),p=z(E);if(p<=.01)return null;let m=B(o,E,f.seed,r),R=w(f.x,s.x+m.x,p),L=w(f.y,s.y+m.y,p),C=i/Math.max(i-m.z*p,1);return{x:s.x+(R-s.x)*C,y:s.y+(L-s.y)*C,size:f.size*C,weight:p}};return{draw(f,M,E){if(l.setTransform(c,0,0,c,0,0),l.clearRect(0,0,u,h),l.translate(M,E),l.globalCompositeOperation="lighter",b)for(let p of x){let m=g(p,f);m&&(l.globalAlpha=m.weight*.16,l.drawImage(b,m.x-m.size/2,m.y-m.size/2,m.size,m.size))}l.fillStyle=n;for(let p of y){let m=g(p,f);m&&(l.globalAlpha=m.weight*(.35+p.seed.b*.65),l.fillRect(m.x,m.y,m.size,m.size))}l.globalAlpha=1}}}function ue(t,e,n,o){let r=Math.max(Math.round(Math.sqrt(n*t/e)),1),i=Math.max(Math.round(n/r),1),s=t/r,a=e/i,l=[],c=(u,h)=>{l.push({x:(u+.04+o()*.92)*s,y:(h+.04+o()*.92)*a})};for(let u=0;u<i;u+=1)for(let h=0;h<r;h+=1)o()<.86&&c(h,u),o()<.2&&c(h,u);return l.length===0&&l.push({x:t/2,y:e/2}),l}function he(t,e,n){let o=[];return t.forEach((r,i)=>{let s=t[(i+1)%t.length]??r,a=(r.x-e.x)*n.x+(r.y-e.y)*n.y,l=(s.x-e.x)*n.x+(s.y-e.y)*n.y;if(a<=0&&o.push(r),a<0&&l>0||a>0&&l<0){let c=a/(a-l);o.push({x:r.x+(s.x-r.x)*c,y:r.y+(s.y-r.y)*c})}}),o}function xt(t,e){let n=0;for(let o of t)n=Math.max(n,Math.hypot(o.x-e.x,o.y-e.y));return n}function pe(t,e,n){let o=t,r=xt(o,e);for(let i of n){if(i===e)continue;let s={x:i.x-e.x,y:i.y-e.y};if(!(Math.hypot(s.x,s.y)/2>r)){if(o=he(o,{x:(e.x+i.x)/2,y:(e.y+i.y)/2},s),o.length<3)return[];r=xt(o,e)}}return o}function me(t){let e=0,n=0,o=0;return t.forEach((r,i)=>{let s=t[(i+1)%t.length]??r,a=r.x*s.y-s.x*r.y;e+=a,n+=(r.x+s.x)*a,o+=(r.y+s.y)*a}),e===0?{center:{x:0,y:0},area:0}:{center:{x:n/(3*e),y:o/(3*e)},area:Math.abs(e)/2}}function gt(t,e,n,o){let r=[{x:0,y:0},{x:t,y:0},{x:t,y:e},{x:0,y:e}],i=ue(t,e,Math.max(n,1),o),s=t*e,a=[];for(let l of i){let c=pe(r,l,i);if(c.length<3)continue;let{center:u,area:h}=me(c);h/s<1e-6||a.push({points:c.map(d=>({x:d.x/t,y:d.y/e})),center:{x:u.x/t,y:u.y/e},area:h/s})}return a}var de=".stage{position:fixed;inset:0;pointer-events:none;transform-style:preserve-3d;}.piece{position:absolute;transform-style:preserve-3d;will-change:transform,opacity;}.edge,.face{position:absolute;inset:0;}.edge{opacity:0;}.face{overflow:hidden;}.content{position:absolute;}.shade{position:absolute;inset:0;opacity:0;background:linear-gradient(135deg,rgba(255,255,255,.62),rgba(255,255,255,.08));}.line{position:absolute;inset:0;width:100%;height:100%;overflow:visible;opacity:0;}.line path{fill:none;stroke-width:1;vector-effect:non-scaling-stroke;}.debris{position:fixed;inset:0;width:100%;height:100%;}.definitions{position:absolute;width:0;height:0;overflow:hidden;}";function fe(t,e){if(typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in t&&"replaceSync"in CSSStyleSheet.prototype){let o=new CSSStyleSheet;o.replaceSync(e),t.adoptedStyleSheets=[o];return}let n=document.createElement("style");n.textContent=e,t.appendChild(n)}function ye(t){let e=document.createElement("div");e.setAttribute("data-shatter-morph",""),e.setAttribute("aria-hidden","true"),e.setAttribute("inert",""),e.style.cssText=`position:fixed;inset:0;width:100vw;height:100vh;max-width:none;max-height:none;margin:0;padding:0;border:0;background:transparent;overflow:visible;pointer-events:none;z-index:${t};`,"popover"in e&&e.setAttribute("popover","manual"),document.documentElement.appendChild(e);try{e.showPopover?.()}catch{e.removeAttribute("popover")}return e}function bt(t,e){let n=ye(t),o=n.attachShadow({mode:"open"});fe(o,de+e);let r=document.createElement("div");return r.className="stage",o.appendChild(r),{host:n,shadow:o,stage:r}}function et(t,e,n){return t.style.color=n,t.style.color=e,getComputedStyle(t).color||n}var U="data-shatter-scroll",xe="http://www.w3.org/1999/xhtml",ge="http://www.w3.org/2000/svg",be=new Set(["script","style","link","meta","base","noscript","template"]),vt=new Set(["iframe","embed","object","audio","frame","slot"]),Se=new Set(["button","input","meter","progress","select","textarea"]),Ee=new Set(["accesskey","action","autofocus","autoplay","class","contenteditable","draggable","form","formaction","id","is","name","nonce","ping","popover","popovertarget","sizes","slot","srcset","style","tabindex","target"]),ve=/^(?:animation|transition|will-change|view-transition|view-timeline|scroll-timeline|anchor-name|position-anchor|contain|content-visibility|pointer-events)/,Me=/^(?:background|border)/,Pe="-webkit-text-fill-color",Ce=/url\((["']?)#([^"')]+)\1\)/g,we=["background-color","background-image","border-top-color","border-top-style","border-top-width","border-top-left-radius"],Ae=["color","content","font-family","font-size","font-style","font-weight","letter-spacing","opacity","text-transform"],Te=["fill","stroke","stroke-width","fill-opacity","stroke-opacity","opacity"],St=new Map;function Mt(t){return{prefix:t,classes:new Map,rules:[],bitmaps:[],references:new Map,scopes:new Map,nodeCount:0}}function nt(t,e){try{t.getContext("2d")?.drawImage(e,0,0,t.width,t.height)}catch{return}}function Re(t){return"getElementById"in t}function Pt(t,e,n,o){let r=e.getRootNode(),i=n.scopes.get(r);i===void 0&&(i=n.scopes.size,n.scopes.set(r,i));let s=`${n.prefix}${i}-${t}`;return Re(r)&&!n.references.has(s)&&n.references.set(s,{id:t,root:r,isInstanced:o}),s}function ot(t,e,n){return t.replace(Ce,(o,r,i)=>`url("#${Pt(i,e,n,!1)}")`)}function Oe(t,e,n,o){return e!=="href"&&e!=="xlink:href"?ot(n,t,o):n.startsWith("#")?`#${Pt(n.slice(1),t,o,t.localName==="use")}`:n}function Ct(t,e=null){let n="";for(let o=0;o<t.length;o+=1){let r=t.item(o);if(ve.test(r)||e?.test(r))continue;let i=t.getPropertyValue(r);!i||r===Pe&&i===t.getPropertyValue("color")||(n+=`${r}:${i};`)}return n}function Et(t,e){let n=getComputedStyle(t,e);return Ae.map(o=>{let r=n.getPropertyValue(o);return r?`${o}:${r};`:""}).join("")}function Le(t,e,n){let o=[];for(let r of["::before","::after"]){let i=getComputedStyle(t,r),s=i.getPropertyValue("content");s&&s!=="none"&&s!=="normal"&&o.push([r,ot(Ct(i),t,n)])}return e.display==="list-item"&&o.push(["::marker",Et(t,"::marker")]),t.hasAttribute("placeholder")&&o.push(["::placeholder",Et(t,"::placeholder")]),o}function wt(t){return we.map(e=>t.getPropertyValue(e)).join("|")}function ke(t,e){let n=t.getAttribute("type")??"",o=`${t.localName}:${n}:${e}`,r=St.get(o);if(r!==void 0)return r;let i=document.createElement("div");i.style.display="none",i.style.colorScheme=e;let s=document.createElement(t.localName);n&&s.setAttribute("type",n),i.attachShadow({mode:"open"}).appendChild(s),document.documentElement.appendChild(i);let a=wt(getComputedStyle(s));return i.remove(),St.set(o,a),a}function Ne(t,e){return Se.has(t.localName)&&e.appearance!=="none"&&wt(e)===ke(t,e.colorScheme)}function $e(t,e,n){let o=getComputedStyle(t),r=e&&Ne(t,o)?Me:null,i=ot(Ct(o,r),t,n),s=Le(t,o,n),a=`${i}|${s.join("|")}`,l=n.classes.get(a);if(l)return l;let c=`${n.prefix}${n.classes.size}`;n.classes.set(a,c),n.rules.push(`.${c}{${i}}`);for(let[u,h]of s)n.rules.push(`.${c}${u}{${h}}`);return c}function Ie(t,e){let n=getComputedStyle(t),o=t.parentElement?getComputedStyle(t.parentElement):null;for(let r of Te){let i=n.getPropertyValue(r);i&&i!==o?.getPropertyValue(r)&&e.style.setProperty(r,i)}}function Fe(t){let e=t.localName==="video",n=e?t.videoWidth:t.width,o=e?t.videoHeight:t.height,r=document.createElement("canvas");return r.width=n||1,r.height=o||1,n&&o&&nt(r,t),r}function _e(t,e,n){return e.startsWith("on")||Ee.has(e)||(t.localName==="a"||t.localName==="area")&&(e==="href"||e==="xlink:href")?!0:n&&e==="loading"}function De(t,e,n,o){for(let r of Array.from(t.attributes)){let i=r.name.toLowerCase();if(_e(t,i,n))continue;let s=n?r.value:Oe(t,i,r.value,o);try{e.setAttributeNS(r.namespaceURI,r.name,s)}catch{continue}}}function Ve(t,e){if(t.localName==="input"){let n=t,o=n.type==="password"?"x".repeat(n.value.length):n.value;n.type!=="file"&&e.setAttribute("value",o),e.toggleAttribute("checked",n.checked)}else if(t.localName==="option")e.toggleAttribute("selected",t.selected);else if(t.localName==="img"){let n=t;n.currentSrc&&e.setAttribute("src",n.currentSrc),e.setAttribute("decoding","sync")}}function He(t){if(t.shadowRoot)return Array.from(t.shadowRoot.childNodes);if(t.localName==="slot"){let e=t.assignedNodes();if(e.length)return e}return Array.from(t.childNodes)}function ze(t,e,n){let o=t.localName;if(e&&(o==="canvas"||o==="video")){let r=Fe(t);n.bitmaps.push(r);let i=document.createElement("canvas");return i.width=r.width,i.height=r.height,i}return e&&(vt.has(o)||o.includes("-"))?document.createElement("div"):document.createElementNS(t.namespaceURI,t.localName)}function Be(t,e,n,o){for(let r of He(t))if(r.nodeType===Node.TEXT_NODE)e.appendChild(document.createTextNode(r.nodeValue??"")),n.nodeCount+=1;else if(r.nodeType===Node.ELEMENT_NODE){let i=G(r,n,o);i&&e.appendChild(i)}}function G(t,e,n=!0){let o=t.localName;if(be.has(o))return null;let r=t.namespaceURI===xe,i=ze(t,r,e);return i.localName===o&&(De(t,i,r,e),r&&Ve(t,i)),n?i.setAttribute("class",$e(t,r,e)):Ie(t,i),e.nodeCount+=1,(t.scrollLeft||t.scrollTop)&&i.setAttribute(U,`${t.scrollLeft},${t.scrollTop}`),o==="textarea"?i.textContent=t.value:o!=="canvas"&&o!=="video"&&!(r&&vt.has(o)&&o!=="slot")&&Be(t,i,e,n),i}function At(t){let e=document.createElementNS(ge,"svg");e.setAttribute("class","definitions");for(let[n,o]of t.references){let r=o.root.getElementById(o.id),i=r&&G(r,t,!o.isInstanced);i&&(i.setAttribute("id",n),e.appendChild(i))}return e.childElementCount?e:null}var Tt={transition:"none",visibility:"hidden","clip-path":"inset(50%)"},Ue=Object.keys(Tt),Ge=["visibility","clip-path"],k=new WeakMap,W=new WeakMap;function N(t){return t.style}function X(t,e){return{value:t.getPropertyValue(e),priority:t.getPropertyPriority(e)}}function rt(t,e,n,o){o.value?e.setProperty(n,o.value,o.priority):e.removeProperty(n),t.getAttribute("style")===""&&t.removeAttribute("style")}function Rt(t){for(let e of Ue)t.setProperty(e,Tt[e],"important")}function Ot(t,e,n){for(let o of Ge)rt(t,e,o,n[o])}function j(t){let e=N(t);!e||k.has(t)||(k.set(t,{transition:X(e,"transition"),visibility:X(e,"visibility"),"clip-path":X(e,"clip-path")}),Rt(e))}function Y(t){let e=N(t),n=k.get(t);!e||!n||(k.delete(t),Ot(t,e,n),getComputedStyle(t).visibility,rt(t,e,"transition",n.transition))}function Lt(t,e){let n=N(t),o=k.get(t);if(!n||!o)return e();Ot(t,n,o);try{return e()}finally{Rt(n)}}function q(t){t.setAttribute("hidden","");let e=N(t);!e||W.has(t)||getComputedStyle(t).display!=="none"&&(W.set(t,X(e,"display")),e.setProperty("display","none","important"))}function $(t){t.removeAttribute("hidden");let e=N(t),n=W.get(t);!e||!n||(W.delete(t),rt(t,e,"display",n))}var Xe=new Set(["none","matrix(1, 0, 0, 1, 0, 0)","matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)"]),kt=0;function We(t){let e=/^matrix(3d)?\((.+)\)$/.exec(t);if(!e?.[2])return t||"none";let n=e[2].split(",").map(r=>r.trim()),o=e[1]?[12,13,14]:[4,5];for(let r of o)n[r]="0";return`matrix${e[1]??""}(${n.join(", ")})`}function je(t,e,n){let o=t,r=getComputedStyle(t),i=We(r.transform),s=Xe.has(i)&&(!r.rotate||r.rotate==="none")&&(!r.scale||r.scale==="none"),a=s?e.width:o.offsetWidth||e.width,l=s?e.height:o.offsetHeight||e.height;return`.${n}{position:absolute!important;inset:auto!important;left:${(e.width-a)/2}px!important;top:${(e.height-l)/2}px!important;width:${a}px!important;height:${l}px!important;margin:0!important;float:none!important;box-sizing:border-box!important;translate:none!important;transform:${i}!important;transform-origin:50% 50%!important;}`}function A(t){let e=t.getBoundingClientRect();if(e.width<1||e.height<1)return null;kt+=1;let n=Mt(`shatter-${kt}-`);return Lt(t,()=>{let o=G(t,n);if(!o)return null;let r=n.nodeCount,i=At(n),s=`${n.prefix}root`;return o.classList.add(s),n.rules.push(je(t,e,s)),{frame:{left:e.left,top:e.top,width:e.width,height:e.height},template:o,definitions:i,rules:n.rules.join(""),nodeCount:r,bitmaps:n.bitmaps}})}function Nt(t,e=1){let n=t.template.cloneNode(!0);return t.bitmaps.length&&(n.localName==="canvas"?[n]:Array.from(n.querySelectorAll("canvas"))).forEach((r,i)=>{let s=t.bitmaps[i];if(!s)return;let a=r;a.width=Math.max(Math.round(s.width*e),1),a.height=Math.max(Math.round(s.height*e),1),nt(a,s)}),n}function $t(t){for(let e of Array.from(t.querySelectorAll(`[${U}]`))){let[n,o]=(e.getAttribute(U)??"0,0").split(",").map(Number);e.scrollLeft=n??0,e.scrollTop=o??0}}var It=.6,P=5e-4,Ft="http://www.w3.org/2000/svg";function I(t){let e=document.createElement("div");return e.className=t,e}function Ye(t,e){return t.x<P&&e.x<P||t.x>1-P&&e.x>1-P||t.y<P&&e.y<P||t.y>1-P&&e.y>1-P}function qe(t,e){let n="";return t.points.forEach((o,r)=>{let i=(r+1)%t.points.length,s=t.points[i],a=e[r],l=e[i];!s||!a||!l||Ye(o,s)||(n+=`M${a.x.toFixed(2)} ${a.y.toFixed(2)}L${l.x.toFixed(2)} ${l.y.toFixed(2)}`)}),n}function Ke(t,e){let n=document.createElementNS(Ft,"svg");n.setAttribute("class","line"),n.setAttribute("viewBox","0 0 100 100"),n.setAttribute("preserveAspectRatio","none");let o=document.createElementNS(Ft,"path");return o.setAttribute("d",t),o.setAttribute("stroke",e),n.appendChild(o),n}function Ze(t,e){let n=t.center.x*e.width,o=t.center.y*e.height,r=t.points.map(u=>{let h=u.x*e.width,d=u.y*e.height,y=Math.hypot(h-n,d-o)||1;return{x:h+(h-n)/y*It,y:d+(d-o)/y*It}}),i=Math.floor(Math.min(...r.map(u=>u.x))),s=Math.floor(Math.min(...r.map(u=>u.y))),a=Math.max(Math.ceil(Math.max(...r.map(u=>u.x)))-i,1),l=Math.max(Math.ceil(Math.max(...r.map(u=>u.y)))-s,1),c=r.map(u=>({x:(u.x-i)/a*100,y:(u.y-s)/l*100}));return{centerX:n,centerY:o,left:i,top:s,width:a,height:l,local:c}}function st(t,e,n){let{frame:o}=e,{centerX:r,centerY:i,left:s,top:a,width:l,height:c,local:u}=Ze(t,o),h=`polygon(${u.map(m=>`${m.x.toFixed(2)}% ${m.y.toFixed(2)}%`).join(",")})`,d=(r-s)/l*100,y=(i-a)/c*100,x=I("piece");x.style.cssText=`left:${o.left+s}px;top:${o.top+a}px;width:${l}px;height:${c}px;transform-origin:${d.toFixed(2)}% ${y.toFixed(2)}%;display:none;`;let b=I("edge");b.style.cssText=`clip-path:${h};background:${n.edgeColor};transform:translateZ(${-n.depth}px);`;let g=I("face");g.style.clipPath=h;let f=I("content");f.style.cssText=`left:${-s}px;top:${-a}px;width:${o.width}px;height:${o.height}px;`,f.appendChild(Nt(e,n.bitmapScale));let M=I("shade");g.append(f,M),x.append(b,g);let E=n.cracks?qe(t,u):"",p=E?Ke(E,n.edgeColor):null;return p&&x.appendChild(p),{root:x,edge:b,shade:M,line:p,x:o.left+r,y:o.top+i,visible:!1,scrollRestored:!1,edgeOpacity:0,shadeOpacity:0,lineOpacity:0}}function at(t,e){!t||t.visible===e||(t.visible=e,t.root.style.display=e?"block":"none",e&&!t.scrollRestored&&(t.scrollRestored=!0,$t(t.root)))}function _t(t,{x:e,y:n,z:o,axis:r,angle:i,scale:s,opacity:a}){t.root.style.transform=`translate3d(${e.toFixed(2)}px,${n.toFixed(2)}px,${o.toFixed(2)}px) rotate3d(${r.x.toFixed(3)},${r.y.toFixed(3)},${r.z.toFixed(3)},${i.toFixed(3)}rad) scale(${s.toFixed(3)})`,t.root.style.opacity=a.toFixed(2)}function it(t,e,n){return Math.abs(e-n)<.01?e:(t.style.opacity=n.toFixed(2),n)}function Dt(t,e,n,o){let r=Math.abs(Math.cos(n));t.edgeOpacity=it(t.edge,t.edgeOpacity,S(.02,.35,e)),t.shadeOpacity=it(t.shade,t.shadeOpacity,e*(.16+r*.38)),t.line&&(t.lineOpacity=it(t.line,t.lineOpacity,Math.max(o*(1-e),e*.5)))}function Vt(t){if(t===void 0)return Math.random;let e=t>>>0||1;return()=>{e=e+1831565813>>>0;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}var Je=1800,Ht="#8f897f",zt="rgba(128, 122, 112, 0.92)",Qe=2147483e3,Wt=1400,tn=10,en=220,nn=16e3,Bt=32e6,on=8,rn=900,sn=36,an=1200,K=new WeakMap;function T(t){K.get(t)?.finish()}function v(t,e){return e?.(t),{finished:Promise.resolve(t),finish(){},cancel(){}}}function ln(t,e,n){let o=t==="auto"?Math.min(Math.max(Math.round(e/2100),16),110):Math.min(Math.max(Math.round(t),2),en),r=Math.floor(nn/Math.max(n,1));return r<tn?0:Math.min(o,r)}function Ut(t){return t?t.frame.width*t.frame.height:0}function Gt(t){return(t?.bitmaps??[]).reduce((e,n)=>e+n.width*n.height,0)}function cn(t,e,n){let o=(Gt(t)+Gt(e))*n;return o>Bt?Math.sqrt(Bt/o):1}function Xt(t){return{x:t.left+t.width/2,y:t.top+t.height/2}}function un(t,e,n){let o=Xt((t??e).frame),r=Xt(e.frame),i=Math.max(t?.frame.width??0,t?.frame.height??0,e.frame.width,e.frame.height);return{motion:n.motion??"vortex",origin:n.origin??"right",center:{x:(o.x+r.x)/2,y:(o.y+r.y)/2},radius:i*.62*(n.spread??1),depth:n.depth??Math.max(Math.min(e.frame.width,e.frame.height)*.016,2)}}function hn(t,{from:e,to:n},o,r,i,s){let a={a:s(),b:s(),c:s(),d:s()},l={x:a.c-.5,y:a.a-.5,z:a.b-.5},c=Math.hypot(l.x,l.y,l.z)||1,u=e?st(t,e,r):null,h=n?st(t,n,r):null;return u&&i.appendChild(u.root),h&&i.appendChild(h.root),{seed:a,delay:V(t.center,o.origin,a.a),axis:{x:l.x/c,y:l.y/c,z:l.z/c},turns:Math.PI*(2+a.b*4),shrink:.56+a.d*.4,from:u,to:h}}function pn(t,{host:e,shadow:n},o,r,i,s){let a=t.dust===!1?0:typeof t.dust=="number"?t.dust:i*8,l=t.mist===!1?0:sn;if(!(a>0||l>0))return null;let c=document.createElement("canvas");return c.className="debris",n.appendChild(c),yt({canvas:c,color:et(e,t.color??Ht,Ht),dust:Math.min(Math.max(Math.round(a),0),rn),mist:l,motion:o.motion,origin:o.origin,radius:o.radius,perspective:Wt,center:o.center,frame:r,random:s})}function mn(t,e,n,o,r){let{from:i,to:s,options:a}=t,{host:l,stage:c}=n,u=Vt(a.seed);c.style.perspective=`${Wt}px`,c.style.perspectiveOrigin=`${o.center.x}px ${o.center.y}px`;for(let y of[i,s])y?.definitions&&c.appendChild(y.definitions.cloneNode(!0));let h=gt(e.frame.width,e.frame.height,r,u),d={depth:o.depth,edgeColor:et(l,a.edgeColor??zt,zt),cracks:a.cracks??!0,bitmapScale:cn(i,s,h.length)};return{shards:h.map(y=>hn(y,t,o,d,c,u)),debris:pn(a,n,o,e.frame,r,u)}}function dn(t,e,n,o){let{motion:r,center:i,radius:s}=o,a=!t.to,l=!t.from,c=H(e,t.delay),u=a?c*.5:l?.5+c*.5:c,h=l||!a&&u>=.5,d=h?t.to:t.from;if(!d)return;at(h?t.from:t.to,!1),at(d,!0);let y=z(u),x=B(r,u,t.seed,s),b=y*t.turns,g=dt(r,u);a&&(g*=1-S(.72,1,c)),l&&(g*=S(0,.28,c)),_t(d,{x:w(d.x,i.x+x.x,y)-d.x,y:w(d.y,i.y+x.y,y)-d.y,z:x.z*y,axis:t.axis,angle:b,scale:w(1,t.shrink,y),opacity:g}),Dt(d,y,b,n)}function fn(t,{host:e,stage:n},o,r){let{anchor:i,options:s}=t,a=Math.max(s.duration??Je,1),l=i.getBoundingClientRect(),c=p=>{let m=S(0,.05,p)*(1-S(.8,.97,p)),R=i.getBoundingClientRect(),L=R.width?R.left-l.left:0,C=R.width?R.top-l.top:0;n.style.transform=L||C?`translate(${L}px,${C}px)`:"";for(let te of r.shards)dn(te,p,m,o);r.debris?.draw(p,L,C)},u=!1,h=0,d=null,y,x=new Promise(p=>{y=p}),b=()=>{document.hidden&&f.finish()},g=p=>{if(!u){u=!0,cancelAnimationFrame(h),clearTimeout(M),document.removeEventListener("visibilitychange",b);for(let m of t.veiled)Y(m);p==="cancelled"?t.revert():t.settle(),e.remove();for(let m of t.elements)K.get(m)===f&&K.delete(m);y(p),s.onComplete?.(p)}},f={finished:x,finish:()=>g("finished"),cancel:()=>g("cancelled")},M=setTimeout(f.finish,a+an),E=p=>{if(u)return;if(!i.isConnected){f.finish();return}d??=p;let m=O((p-d)/a);c(m),m>=1?f.finish():h=requestAnimationFrame(E)};for(let p of t.elements)K.set(p,f);for(let p of t.veiled)j(p);return document.addEventListener("visibilitychange",b),c(0),document.hidden?f.finish():h=requestAnimationFrame(E),f}function F(t){let{from:e,to:n,options:o}=t,r=n??e,i=(e?.nodeCount??0)+(n?.nodeCount??0)+on,s=Math.max(Ut(e),Ut(n)),a=r?ln(o.shards??"auto",s,i):0;if(!r||a===0)return t.settle(),v("skipped",o.onComplete);let l=un(e,r,o),c=bt(o.zIndex??Qe,(e?.rules??"")+(n?.rules??"")),u;try{u=mn(t,r,c,l,a)}catch{return c.host.remove(),t.settle(),v("skipped",o.onComplete)}return fn(t,c,l,u)}var jt=!0;function Yt(t){jt=t}function Z(){return jt}function qt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function _(t){return typeof document>"u"||!Z()?!1:t.respectReducedMotion===!1||!qt()}function D(t,e){e.keepLayout?j(t):q(t)}function lt(t){$(t),Y(t)}function yn(t){return typeof t?.then=="function"}function Kt(t,e={}){if(typeof document>"u")return v("skipped",e.onComplete);T(t);let n=_(e)?A(t):null;return n?F({from:n,to:null,anchor:t,elements:[t],veiled:[t],settle:()=>D(t,e),revert:()=>{},options:e}):(D(t,e),v("skipped",e.onComplete))}function Zt(t,e={}){if(typeof document>"u")return v("skipped",e.onComplete);T(t),lt(t);let n=_(e)?A(t):null;return n?F({from:null,to:n,anchor:t,elements:[t],veiled:[t],settle:()=>{},revert:()=>D(t,e),options:e}):v("skipped",e.onComplete)}function J(t,e,n={}){if(typeof document>"u"||t===e)return v("skipped",n.onComplete);T(t),T(e);let o=_(n),r=o?A(t):null;D(t,n),lt(e);let i=o?A(e):null;return!r&&!i?v("skipped",n.onComplete):F({from:r,to:i,anchor:i?e:t,elements:[t,e],veiled:i?[e]:[],settle:()=>{},revert:()=>{D(e,n),lt(t)},options:n})}function ct(t,e={}){T(t);let n=_(e)?A(t):null;return{play(o=e){return!n||!_(o)?v("skipped",o.onComplete):(T(t),F({from:n,to:A(t),anchor:t,elements:[t],veiled:[t],settle:()=>{},revert:()=>{},options:o}))}}}function Jt(t,e,n={}){let o=ct(t,n),r=e();if(!yn(r))return o.play(n);let i=null,s=null;return{finished:Promise.resolve(r).then(()=>(i=o.play(n),s&&i[s](),i.finished)),finish(){s="finish",i?.finish()},cancel(){s="cancel",i?.cancel()}}}var ut="shatter-complete",xn=["vortex","burst","fall"],gn=["left","right","top","bottom","center"];function Qt(t){if(t===null||t.trim()==="")return;let e=Number(t);return Number.isFinite(e)?e:void 0}function bn(){return class extends HTMLElement{static observedAttributes=["active"];#t=null;#e=null;#n=new MutationObserver(()=>this.#o());options={};get active(){return this.getAttribute("active")??"0"}set active(t){this.setAttribute("active",String(t))}get activeElement(){return this.#t}show(t){this.active=String(t)}next(){this.#r(1)}previous(){this.#r(-1)}finish(){this.#e?.finish()}connectedCallback(){getComputedStyle(this).display==="inline"&&(this.style.display="block"),this.#n.observe(this,{childList:!0}),this.#o()}disconnectedCallback(){this.#n.disconnect(),this.#e?.finish(),this.#e=null}attributeChangedCallback(t,e,n){if(!this.isConnected||e===n||n===null)return;let o=this.#i(n);if(!o||o===this.#t)return;let r=this.#t;if(this.#t=o,!r){$(o);return}let i=J(r,o,this.#s());this.#e=i,i.finished.then(s=>{this.#e===i&&(this.#e=null),this.dispatchEvent(new CustomEvent(ut,{detail:{result:s,active:this.active}}))})}#o(){let t=Array.from(this.children),e=this.#t&&t.includes(this.#t)?this.#t:null;this.#t=this.#i(this.active)??e??t[0]??null;for(let n of t)n===this.#t?$(n):q(n)}#r(t){let e=Array.from(this.children);if(!e.length)return;let n=this.#t?e.indexOf(this.#t):0;this.active=String((n+t+e.length)%e.length)}#i(t){let e=Array.from(this.children),n=e.find(o=>o.id===t||o.getAttribute("data-name")===t);return n||(/^\d+$/.test(t)?e[Number(t)]??null:null)}#s(){let t={...this.options},e=Qt(this.getAttribute("duration")),n=Qt(this.getAttribute("shards")),o=this.getAttribute("motion"),r=this.getAttribute("origin"),i=this.getAttribute("color");return e!==void 0&&(t.duration=e),n!==void 0&&(t.shards=n),o&&xn.includes(o)&&(t.motion=o),r&&gn.includes(r)&&(t.origin=r),i&&(t.color=i),this.hasAttribute("no-dust")&&(t.dust=!1),this.hasAttribute("no-mist")&&(t.mist=!1),this.hasAttribute("no-cracks")&&(t.cracks=!1),t}}}function Q(t="shatter-morph"){typeof customElements>"u"||customElements.get(t)||customElements.define(t,bn())}Q();return se(Sn);})();
|
|
2
|
+
//# sourceMappingURL=shatter-morph.global.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/browser.ts","../src/core/motion.ts","../src/core/debris.ts","../src/core/fracture.ts","../src/core/overlay.ts","../src/core/clone.ts","../src/core/visibility.ts","../src/core/snapshot.ts","../src/core/piece.ts","../src/core/random.ts","../src/core/run.ts","../src/core/settings.ts","../src/core/shatter.ts","../src/adapters/element.ts"],"sourcesContent":["import { defineShatterMorphElement } from './adapters/element';\n\nexport * from './index';\nexport { SHATTER_COMPLETE_EVENT, defineShatterMorphElement } from './adapters/element';\n\ndefineShatterMorphElement();\n","import type { Point } from './fracture';\n\nexport type ShatterMotion = 'vortex' | 'burst' | 'fall';\nexport type ShatterOrigin = 'left' | 'right' | 'top' | 'bottom' | 'center';\n\nexport interface Seed {\n a: number;\n b: number;\n c: number;\n d: number;\n}\n\nexport interface Vector {\n x: number;\n y: number;\n z: number;\n}\n\nconst TAU = Math.PI * 2;\nconst SWEEP_SHARE = 0.42;\nconst JITTER_SHARE = 0.12;\n\nexport const FLIGHT_SHARE = 1 - SWEEP_SHARE - JITTER_SHARE;\n\nexport const clamp01 = (value: number) => Math.min(Math.max(value, 0), 1);\n\nexport const mix = (from: number, to: number, amount: number) => from + (to - from) * amount;\n\nexport function smoothstep(start: number, end: number, value: number) {\n const x = clamp01((value - start) / (end - start));\n return x * x * (3 - 2 * x);\n}\n\nexport function launchDelay(center: Point, origin: ShatterOrigin, jitter: number) {\n let distance: number;\n\n if (origin === 'left') distance = center.x;\n else if (origin === 'right') distance = 1 - center.x;\n else if (origin === 'top') distance = center.y;\n else if (origin === 'bottom') distance = 1 - center.y;\n else distance = clamp01(Math.hypot(center.x - 0.5, center.y - 0.5) / Math.SQRT1_2);\n\n return clamp01(distance) * SWEEP_SHARE + clamp01(jitter) * JITTER_SHARE;\n}\n\nexport function flightProgress(time: number, delay: number) {\n return smoothstep(0, FLIGHT_SHARE, time - delay);\n}\n\nexport function flightWeight(progress: number) {\n return smoothstep(0, 0.2, progress) * (1 - smoothstep(0.8, 1, progress));\n}\n\nexport function flightPoint(motion: ShatterMotion, progress: number, seed: Seed, radius: number): Vector {\n const arc = Math.sin(Math.PI * progress);\n\n if (motion === 'burst') {\n const angle = seed.a * TAU;\n const tilt = (seed.b - 0.5) * Math.PI;\n const reach = radius * (0.55 + seed.c * 0.75) * arc;\n return {\n x: Math.cos(angle) * Math.cos(tilt) * reach,\n y: Math.sin(tilt) * reach * 0.8,\n z: Math.sin(angle) * Math.cos(tilt) * reach * 0.7\n };\n }\n\n if (motion === 'fall') {\n const drop = progress < 0.5 ? (progress * 2) ** 2 : -(((1 - progress) * 2) ** 2);\n return {\n x: (seed.a - 0.5) * radius * 1.1 * arc,\n y: drop * radius * 1.35 + (seed.b - 0.5) * radius * 0.25 * arc,\n z: (seed.c - 0.5) * radius * 0.6 * arc\n };\n }\n\n const angle = progress * TAU * 1.08 - 0.62;\n const reach = radius * (0.82 + 0.18 * arc);\n const tube = radius * 0.2 * (0.35 + arc);\n return {\n x: Math.cos(angle) * reach * 1.04 + (seed.b - 0.5) * tube,\n y: -Math.sin(angle) * reach * 0.86 + (seed.c - 0.5) * tube,\n z: Math.sin(angle + 0.9) * reach * 0.6 + (seed.d - 0.5) * tube * 1.4\n };\n}\n\nexport function midpointFade(motion: ShatterMotion, progress: number) {\n return motion === 'fall' ? smoothstep(0, 0.12, Math.abs(progress - 0.5)) : 1;\n}\n","import { flightPoint, flightProgress, flightWeight, launchDelay, mix } from './motion';\nimport type { Seed, ShatterMotion, ShatterOrigin } from './motion';\nimport type { Frame } from './snapshot';\nimport type { Random } from './random';\n\nexport interface DebrisOptions {\n canvas: HTMLCanvasElement;\n color: string;\n dust: number;\n mist: number;\n motion: ShatterMotion;\n origin: ShatterOrigin;\n radius: number;\n perspective: number;\n center: { x: number; y: number };\n frame: Frame;\n random: Random;\n}\n\nexport interface Debris {\n draw(time: number, offsetX: number, offsetY: number): void;\n}\n\ninterface Mote {\n x: number;\n y: number;\n delay: number;\n size: number;\n seed: Seed;\n}\n\nconst MAX_PIXEL_RATIO = 1.5;\n\nfunction createMotes(count: number, options: DebrisOptions, sizeOf: (seed: Seed) => number) {\n const { frame, origin, random } = options;\n const motes: Mote[] = [];\n\n for (let index = 0; index < count; index += 1) {\n const seed = { a: random(), b: random(), c: random(), d: random() };\n const unit = { x: random(), y: random() };\n motes.push({\n x: frame.left + unit.x * frame.width,\n y: frame.top + unit.y * frame.height,\n delay: launchDelay(unit, origin, seed.a),\n size: sizeOf(seed),\n seed\n });\n }\n return motes;\n}\n\nfunction createMistSprite(color: string) {\n const sprite = document.createElement('canvas');\n sprite.width = 96;\n sprite.height = 96;\n const context = sprite.getContext('2d');\n if (!context) return null;\n\n const gradient = context.createRadialGradient(48, 48, 0, 48, 48, 48);\n gradient.addColorStop(0, color);\n gradient.addColorStop(1, 'rgba(0, 0, 0, 0)');\n context.fillStyle = gradient;\n context.fillRect(0, 0, 96, 96);\n return sprite;\n}\n\nexport function createDebris(options: DebrisOptions): Debris | null {\n const { canvas, color, motion, radius, perspective, center, frame } = options;\n const context = canvas.getContext('2d');\n if (!context) return null;\n\n const pixelRatio = Math.min(window.devicePixelRatio || 1, MAX_PIXEL_RATIO);\n const width = window.innerWidth;\n const height = window.innerHeight;\n canvas.width = Math.round(width * pixelRatio);\n canvas.height = Math.round(height * pixelRatio);\n\n const scale = Math.max(frame.width, frame.height);\n const dust = createMotes(options.dust, options, (seed) => Math.max(scale * 0.004, 1.2) * (0.6 + seed.d));\n const mist = createMotes(options.mist, options, (seed) => scale * (0.24 + seed.d * 0.26));\n const sprite = mist.length ? createMistSprite(color) : null;\n\n const place = (mote: Mote, time: number) => {\n const progress = flightProgress(time, mote.delay);\n const weight = flightWeight(progress);\n if (weight <= 0.01) return null;\n\n const point = flightPoint(motion, progress, mote.seed, radius);\n const x = mix(mote.x, center.x + point.x, weight);\n const y = mix(mote.y, center.y + point.y, weight);\n const depth = perspective / Math.max(perspective - point.z * weight, 1);\n return {\n x: center.x + (x - center.x) * depth,\n y: center.y + (y - center.y) * depth,\n size: mote.size * depth,\n weight\n };\n };\n\n return {\n draw(time: number, offsetX: number, offsetY: number) {\n context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n context.clearRect(0, 0, width, height);\n context.translate(offsetX, offsetY);\n context.globalCompositeOperation = 'lighter';\n\n if (sprite) {\n for (const mote of mist) {\n const placed = place(mote, time);\n if (!placed) continue;\n context.globalAlpha = placed.weight * 0.16;\n context.drawImage(sprite, placed.x - placed.size / 2, placed.y - placed.size / 2, placed.size, placed.size);\n }\n }\n\n context.fillStyle = color;\n for (const mote of dust) {\n const placed = place(mote, time);\n if (!placed) continue;\n context.globalAlpha = placed.weight * (0.35 + mote.seed.b * 0.65);\n context.fillRect(placed.x, placed.y, placed.size, placed.size);\n }\n context.globalAlpha = 1;\n }\n };\n}\n","import type { Random } from './random';\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface Shard {\n points: Point[];\n center: Point;\n area: number;\n}\n\nconst MIN_AREA = 1e-6;\n\nfunction createSites(width: number, height: number, count: number, random: Random) {\n const columns = Math.max(Math.round(Math.sqrt((count * width) / height)), 1);\n const rows = Math.max(Math.round(count / columns), 1);\n const cellWidth = width / columns;\n const cellHeight = height / rows;\n const sites: Point[] = [];\n\n const addSite = (column: number, row: number) => {\n sites.push({\n x: (column + 0.04 + random() * 0.92) * cellWidth,\n y: (row + 0.04 + random() * 0.92) * cellHeight\n });\n };\n\n for (let row = 0; row < rows; row += 1) {\n for (let column = 0; column < columns; column += 1) {\n if (random() < 0.86) addSite(column, row);\n if (random() < 0.2) addSite(column, row);\n }\n }\n\n if (sites.length === 0) sites.push({ x: width / 2, y: height / 2 });\n return sites;\n}\n\nfunction clip(polygon: Point[], mid: Point, normal: Point) {\n const clipped: Point[] = [];\n\n polygon.forEach((current, index) => {\n const next = polygon[(index + 1) % polygon.length] ?? current;\n const currentSide = (current.x - mid.x) * normal.x + (current.y - mid.y) * normal.y;\n const nextSide = (next.x - mid.x) * normal.x + (next.y - mid.y) * normal.y;\n\n if (currentSide <= 0) clipped.push(current);\n if ((currentSide < 0 && nextSide > 0) || (currentSide > 0 && nextSide < 0)) {\n const amount = currentSide / (currentSide - nextSide);\n clipped.push({\n x: current.x + (next.x - current.x) * amount,\n y: current.y + (next.y - current.y) * amount\n });\n }\n });\n\n return clipped;\n}\n\nfunction reachOf(polygon: Point[], site: Point) {\n let reach = 0;\n for (const point of polygon) reach = Math.max(reach, Math.hypot(point.x - site.x, point.y - site.y));\n return reach;\n}\n\nfunction createCell(outline: Point[], site: Point, sites: Point[]) {\n let polygon = outline;\n let reach = reachOf(polygon, site);\n\n for (const other of sites) {\n if (other === site) continue;\n const normal = { x: other.x - site.x, y: other.y - site.y };\n if (Math.hypot(normal.x, normal.y) / 2 > reach) continue;\n\n polygon = clip(polygon, { x: (site.x + other.x) / 2, y: (site.y + other.y) / 2 }, normal);\n if (polygon.length < 3) return [];\n reach = reachOf(polygon, site);\n }\n\n return polygon;\n}\n\nfunction measure(polygon: Point[]) {\n let doubled = 0;\n let x = 0;\n let y = 0;\n\n polygon.forEach((current, index) => {\n const next = polygon[(index + 1) % polygon.length] ?? current;\n const cross = current.x * next.y - next.x * current.y;\n doubled += cross;\n x += (current.x + next.x) * cross;\n y += (current.y + next.y) * cross;\n });\n\n if (doubled === 0) return { center: { x: 0, y: 0 }, area: 0 };\n return {\n center: { x: x / (3 * doubled), y: y / (3 * doubled) },\n area: Math.abs(doubled) / 2\n };\n}\n\nexport function fracture(width: number, height: number, count: number, random: Random): Shard[] {\n const outline: Point[] = [\n { x: 0, y: 0 },\n { x: width, y: 0 },\n { x: width, y: height },\n { x: 0, y: height }\n ];\n const sites = createSites(width, height, Math.max(count, 1), random);\n const total = width * height;\n const shards: Shard[] = [];\n\n for (const site of sites) {\n const polygon = createCell(outline, site, sites);\n if (polygon.length < 3) continue;\n\n const { center, area } = measure(polygon);\n if (area / total < MIN_AREA) continue;\n\n shards.push({\n points: polygon.map((point) => ({ x: point.x / width, y: point.y / height })),\n center: { x: center.x / width, y: center.y / height },\n area: area / total\n });\n }\n\n return shards;\n}\n","export interface Overlay {\n host: HTMLElement;\n shadow: ShadowRoot;\n stage: HTMLElement;\n}\n\nconst STAGE_RULES =\n '.stage{position:fixed;inset:0;pointer-events:none;transform-style:preserve-3d;}' +\n '.piece{position:absolute;transform-style:preserve-3d;will-change:transform,opacity;}' +\n '.edge,.face{position:absolute;inset:0;}' +\n '.edge{opacity:0;}' +\n '.face{overflow:hidden;}' +\n '.content{position:absolute;}' +\n '.shade{position:absolute;inset:0;opacity:0;background:linear-gradient(135deg,rgba(255,255,255,.62),rgba(255,255,255,.08));}' +\n '.line{position:absolute;inset:0;width:100%;height:100%;overflow:visible;opacity:0;}' +\n '.line path{fill:none;stroke-width:1;vector-effect:non-scaling-stroke;}' +\n '.debris{position:fixed;inset:0;width:100%;height:100%;}' +\n '.definitions{position:absolute;width:0;height:0;overflow:hidden;}';\n\nfunction applyRules(root: ShadowRoot, rules: string) {\n if (\n typeof CSSStyleSheet !== 'undefined' &&\n 'adoptedStyleSheets' in root &&\n 'replaceSync' in CSSStyleSheet.prototype\n ) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(rules);\n root.adoptedStyleSheets = [sheet];\n return;\n }\n const style = document.createElement('style');\n style.textContent = rules;\n root.appendChild(style);\n}\n\nfunction createHost(zIndex: number) {\n const host = document.createElement('div');\n host.setAttribute('data-shatter-morph', '');\n host.setAttribute('aria-hidden', 'true');\n host.setAttribute('inert', '');\n host.style.cssText =\n `position:fixed;inset:0;width:100vw;height:100vh;max-width:none;max-height:none;margin:0;padding:0;` +\n `border:0;background:transparent;overflow:visible;pointer-events:none;z-index:${zIndex};`;\n if ('popover' in host) host.setAttribute('popover', 'manual');\n document.documentElement.appendChild(host);\n try {\n (host as HTMLElement & { showPopover?: () => void }).showPopover?.();\n } catch {\n host.removeAttribute('popover');\n }\n return host;\n}\n\nexport function createOverlay(zIndex: number, rules: string): Overlay {\n const host = createHost(zIndex);\n const shadow = host.attachShadow({ mode: 'open' });\n applyRules(shadow, STAGE_RULES + rules);\n\n const stage = document.createElement('div');\n stage.className = 'stage';\n shadow.appendChild(stage);\n return { host, shadow, stage };\n}\n\nexport function resolveColor(host: HTMLElement, color: string, fallback: string) {\n host.style.color = fallback;\n host.style.color = color;\n return getComputedStyle(host).color || fallback;\n}\n","type ReferenceRoot = Node & NonElementParentNode;\n\ninterface Reference {\n id: string;\n root: ReferenceRoot;\n isInstanced: boolean;\n}\n\nexport interface Build {\n prefix: string;\n classes: Map<string, string>;\n rules: string[];\n bitmaps: HTMLCanvasElement[];\n references: Map<string, Reference>;\n scopes: Map<Node, number>;\n nodeCount: number;\n}\n\nexport const SCROLL_ATTRIBUTE = 'data-shatter-scroll';\n\nconst HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nconst DROPPED_TAGS = new Set(['script', 'style', 'link', 'meta', 'base', 'noscript', 'template']);\nconst PLACEHOLDER_TAGS = new Set(['iframe', 'embed', 'object', 'audio', 'frame', 'slot']);\nconst FORM_CONTROLS = new Set(['button', 'input', 'meter', 'progress', 'select', 'textarea']);\nconst BLOCKED_ATTRIBUTES = new Set([\n 'accesskey',\n 'action',\n 'autofocus',\n 'autoplay',\n 'class',\n 'contenteditable',\n 'draggable',\n 'form',\n 'formaction',\n 'id',\n 'is',\n 'name',\n 'nonce',\n 'ping',\n 'popover',\n 'popovertarget',\n 'sizes',\n 'slot',\n 'srcset',\n 'style',\n 'tabindex',\n 'target'\n]);\nconst SKIPPED_PROPERTY =\n /^(?:animation|transition|will-change|view-transition|view-timeline|scroll-timeline|anchor-name|position-anchor|contain|content-visibility|pointer-events)/;\nconst CONTROL_PAINT = /^(?:background|border)/;\nconst TEXT_FILL = '-webkit-text-fill-color';\nconst URL_REFERENCE = /url\\(([\"']?)#([^\"')]+)\\1\\)/g;\nconst LOOK_PROPERTIES = [\n 'background-color',\n 'background-image',\n 'border-top-color',\n 'border-top-style',\n 'border-top-width',\n 'border-top-left-radius'\n];\nconst TEXT_PROPERTIES = [\n 'color',\n 'content',\n 'font-family',\n 'font-size',\n 'font-style',\n 'font-weight',\n 'letter-spacing',\n 'opacity',\n 'text-transform'\n];\nconst PAINT_PROPERTIES = ['fill', 'stroke', 'stroke-width', 'fill-opacity', 'stroke-opacity', 'opacity'];\n\nconst defaultLooks = new Map<string, string>();\n\nexport function createBuild(prefix: string): Build {\n return {\n prefix,\n classes: new Map(),\n rules: [],\n bitmaps: [],\n references: new Map(),\n scopes: new Map(),\n nodeCount: 0\n };\n}\n\nexport function drawInto(canvas: HTMLCanvasElement, image: CanvasImageSource) {\n try {\n canvas.getContext('2d')?.drawImage(image, 0, 0, canvas.width, canvas.height);\n } catch {\n return;\n }\n}\n\nfunction hasIdLookup(node: Node): node is ReferenceRoot {\n return 'getElementById' in node;\n}\n\nfunction referenceTo(id: string, source: Element, build: Build, isInstanced: boolean) {\n const root = source.getRootNode();\n let scope = build.scopes.get(root);\n if (scope === undefined) {\n scope = build.scopes.size;\n build.scopes.set(root, scope);\n }\n\n const scopedId = `${build.prefix}${scope}-${id}`;\n if (hasIdLookup(root) && !build.references.has(scopedId)) {\n build.references.set(scopedId, { id, root, isInstanced });\n }\n return scopedId;\n}\n\nfunction scopeUrls(text: string, source: Element, build: Build) {\n return text.replace(\n URL_REFERENCE,\n (_match, _quote: string, id: string) => `url(\"#${referenceTo(id, source, build, false)}\")`\n );\n}\n\nfunction scopeAttribute(source: Element, name: string, value: string, build: Build) {\n if (name !== 'href' && name !== 'xlink:href') return scopeUrls(value, source, build);\n if (!value.startsWith('#')) return value;\n return `#${referenceTo(value.slice(1), source, build, source.localName === 'use')}`;\n}\n\nfunction styleText(style: CSSStyleDeclaration, skipped: RegExp | null = null) {\n let text = '';\n for (let index = 0; index < style.length; index += 1) {\n const name = style.item(index);\n if (SKIPPED_PROPERTY.test(name) || skipped?.test(name)) continue;\n const value = style.getPropertyValue(name);\n if (!value || (name === TEXT_FILL && value === style.getPropertyValue('color'))) continue;\n text += `${name}:${value};`;\n }\n return text;\n}\n\nfunction textStyle(source: Element, pseudo: string) {\n const style = getComputedStyle(source, pseudo);\n return TEXT_PROPERTIES.map((name) => {\n const value = style.getPropertyValue(name);\n return value ? `${name}:${value};` : '';\n }).join('');\n}\n\nfunction pseudoRules(source: Element, style: CSSStyleDeclaration, build: Build) {\n const rules: [string, string][] = [];\n\n for (const pseudo of ['::before', '::after']) {\n const computed = getComputedStyle(source, pseudo);\n const content = computed.getPropertyValue('content');\n if (content && content !== 'none' && content !== 'normal') {\n rules.push([pseudo, scopeUrls(styleText(computed), source, build)]);\n }\n }\n if (style.display === 'list-item') rules.push(['::marker', textStyle(source, '::marker')]);\n if (source.hasAttribute('placeholder')) rules.push(['::placeholder', textStyle(source, '::placeholder')]);\n return rules;\n}\n\nfunction lookOf(style: CSSStyleDeclaration) {\n return LOOK_PROPERTIES.map((name) => style.getPropertyValue(name)).join('|');\n}\n\nfunction defaultLook(source: Element, colorScheme: string) {\n const type = source.getAttribute('type') ?? '';\n const key = `${source.localName}:${type}:${colorScheme}`;\n const known = defaultLooks.get(key);\n if (known !== undefined) return known;\n\n const host = document.createElement('div');\n host.style.display = 'none';\n host.style.colorScheme = colorScheme;\n const probe = document.createElement(source.localName);\n if (type) probe.setAttribute('type', type);\n host.attachShadow({ mode: 'open' }).appendChild(probe);\n document.documentElement.appendChild(host);\n const look = lookOf(getComputedStyle(probe));\n host.remove();\n defaultLooks.set(key, look);\n return look;\n}\n\nfunction hasNativeLook(source: Element, style: CSSStyleDeclaration) {\n return (\n FORM_CONTROLS.has(source.localName) &&\n style.appearance !== 'none' &&\n lookOf(style) === defaultLook(source, style.colorScheme)\n );\n}\n\nfunction classFor(source: Element, isHtml: boolean, build: Build) {\n const style = getComputedStyle(source);\n const skipped = isHtml && hasNativeLook(source, style) ? CONTROL_PAINT : null;\n const base = scopeUrls(styleText(style, skipped), source, build);\n const pseudos = pseudoRules(source, style, build);\n const key = `${base}|${pseudos.join('|')}`;\n const existing = build.classes.get(key);\n if (existing) return existing;\n\n const name = `${build.prefix}${build.classes.size}`;\n build.classes.set(key, name);\n build.rules.push(`.${name}{${base}}`);\n for (const [pseudo, text] of pseudos) build.rules.push(`.${name}${pseudo}{${text}}`);\n return name;\n}\n\nfunction copyOwnPaint(source: Element, copy: Element) {\n const own = getComputedStyle(source);\n const parent = source.parentElement ? getComputedStyle(source.parentElement) : null;\n\n for (const name of PAINT_PROPERTIES) {\n const value = own.getPropertyValue(name);\n if (value && value !== parent?.getPropertyValue(name)) (copy as SVGElement).style.setProperty(name, value);\n }\n}\n\nfunction copyBitmap(source: HTMLCanvasElement | HTMLVideoElement) {\n const isVideo = source.localName === 'video';\n const width = isVideo ? (source as HTMLVideoElement).videoWidth : (source as HTMLCanvasElement).width;\n const height = isVideo ? (source as HTMLVideoElement).videoHeight : (source as HTMLCanvasElement).height;\n const bitmap = document.createElement('canvas');\n bitmap.width = width || 1;\n bitmap.height = height || 1;\n if (width && height) drawInto(bitmap, source);\n return bitmap;\n}\n\nfunction isBlockedAttribute(element: Element, name: string, isHtml: boolean) {\n if (name.startsWith('on') || BLOCKED_ATTRIBUTES.has(name)) return true;\n const isLink = element.localName === 'a' || element.localName === 'area';\n if (isLink && (name === 'href' || name === 'xlink:href')) return true;\n return isHtml && name === 'loading';\n}\n\nfunction copyAttributes(source: Element, copy: Element, isHtml: boolean, build: Build) {\n for (const attribute of Array.from(source.attributes)) {\n const name = attribute.name.toLowerCase();\n if (isBlockedAttribute(source, name, isHtml)) continue;\n const value = isHtml ? attribute.value : scopeAttribute(source, name, attribute.value, build);\n try {\n copy.setAttributeNS(attribute.namespaceURI, attribute.name, value);\n } catch {\n continue;\n }\n }\n}\n\nfunction copyFormState(source: Element, copy: Element) {\n if (source.localName === 'input') {\n const input = source as HTMLInputElement;\n const value = input.type === 'password' ? 'x'.repeat(input.value.length) : input.value;\n if (input.type !== 'file') copy.setAttribute('value', value);\n copy.toggleAttribute('checked', input.checked);\n } else if (source.localName === 'option') {\n copy.toggleAttribute('selected', (source as HTMLOptionElement).selected);\n } else if (source.localName === 'img') {\n const image = source as HTMLImageElement;\n if (image.currentSrc) copy.setAttribute('src', image.currentSrc);\n copy.setAttribute('decoding', 'sync');\n }\n}\n\nfunction childrenOf(source: Element): Node[] {\n if (source.shadowRoot) return Array.from(source.shadowRoot.childNodes);\n if (source.localName === 'slot') {\n const assigned = (source as HTMLSlotElement).assignedNodes();\n if (assigned.length) return assigned;\n }\n return Array.from(source.childNodes);\n}\n\nfunction createCopy(source: Element, isHtml: boolean, build: Build) {\n const tag = source.localName;\n\n if (isHtml && (tag === 'canvas' || tag === 'video')) {\n const bitmap = copyBitmap(source as HTMLCanvasElement | HTMLVideoElement);\n build.bitmaps.push(bitmap);\n const copy = document.createElement('canvas');\n copy.width = bitmap.width;\n copy.height = bitmap.height;\n return copy;\n }\n\n if (isHtml && (PLACEHOLDER_TAGS.has(tag) || tag.includes('-'))) return document.createElement('div');\n return document.createElementNS(source.namespaceURI, source.localName);\n}\n\nfunction copyChildren(source: Element, copy: Element, build: Build, isStyled: boolean) {\n for (const child of childrenOf(source)) {\n if (child.nodeType === Node.TEXT_NODE) {\n copy.appendChild(document.createTextNode(child.nodeValue ?? ''));\n build.nodeCount += 1;\n } else if (child.nodeType === Node.ELEMENT_NODE) {\n const childCopy = cloneElement(child as Element, build, isStyled);\n if (childCopy) copy.appendChild(childCopy);\n }\n }\n}\n\nexport function cloneElement(source: Element, build: Build, isStyled = true): Element | null {\n const tag = source.localName;\n if (DROPPED_TAGS.has(tag)) return null;\n\n const isHtml = source.namespaceURI === HTML_NAMESPACE;\n const copy = createCopy(source, isHtml, build);\n\n if (copy.localName === tag) {\n copyAttributes(source, copy, isHtml, build);\n if (isHtml) copyFormState(source, copy);\n }\n if (isStyled) copy.setAttribute('class', classFor(source, isHtml, build));\n else copyOwnPaint(source, copy);\n build.nodeCount += 1;\n\n if (source.scrollLeft || source.scrollTop) {\n copy.setAttribute(SCROLL_ATTRIBUTE, `${source.scrollLeft},${source.scrollTop}`);\n }\n\n if (tag === 'textarea') {\n copy.textContent = (source as HTMLTextAreaElement).value;\n } else if (tag !== 'canvas' && tag !== 'video' && !(isHtml && PLACEHOLDER_TAGS.has(tag) && tag !== 'slot')) {\n copyChildren(source, copy, build, isStyled);\n }\n return copy;\n}\n\nexport function createDefinitions(build: Build) {\n const holder = document.createElementNS(SVG_NAMESPACE, 'svg');\n holder.setAttribute('class', 'definitions');\n\n for (const [scopedId, reference] of build.references) {\n const target = reference.root.getElementById(reference.id);\n const copy = target && cloneElement(target, build, !reference.isInstanced);\n if (!copy) continue;\n copy.setAttribute('id', scopedId);\n holder.appendChild(copy);\n }\n return holder.childElementCount ? holder : null;\n}\n","interface SavedProperty {\n value: string;\n priority: string;\n}\n\nconst VEIL = {\n transition: 'none',\n visibility: 'hidden',\n 'clip-path': 'inset(50%)'\n} as const;\n\ntype VeilProperty = keyof typeof VEIL;\ntype SavedVeil = Record<VeilProperty, SavedProperty>;\n\nconst VEIL_PROPERTIES = Object.keys(VEIL) as VeilProperty[];\nconst VISUAL_PROPERTIES: VeilProperty[] = ['visibility', 'clip-path'];\n\nconst veils = new WeakMap<Element, SavedVeil>();\nconst forcedDisplay = new WeakMap<Element, SavedProperty>();\n\nfunction styleOf(element: Element) {\n return (element as HTMLElement).style as CSSStyleDeclaration | undefined;\n}\n\nfunction save(style: CSSStyleDeclaration, name: string): SavedProperty {\n return { value: style.getPropertyValue(name), priority: style.getPropertyPriority(name) };\n}\n\nfunction restore(element: Element, style: CSSStyleDeclaration, name: string, saved: SavedProperty) {\n if (saved.value) style.setProperty(name, saved.value, saved.priority);\n else style.removeProperty(name);\n if (element.getAttribute('style') === '') element.removeAttribute('style');\n}\n\nfunction applyVeil(style: CSSStyleDeclaration) {\n for (const name of VEIL_PROPERTIES) style.setProperty(name, VEIL[name], 'important');\n}\n\nfunction liftVeil(element: Element, style: CSSStyleDeclaration, saved: SavedVeil) {\n for (const name of VISUAL_PROPERTIES) restore(element, style, name, saved[name]);\n}\n\nexport function veil(element: Element) {\n const style = styleOf(element);\n if (!style || veils.has(element)) return;\n veils.set(element, {\n transition: save(style, 'transition'),\n visibility: save(style, 'visibility'),\n 'clip-path': save(style, 'clip-path')\n });\n applyVeil(style);\n}\n\nexport function unveil(element: Element) {\n const style = styleOf(element);\n const saved = veils.get(element);\n if (!style || !saved) return;\n veils.delete(element);\n liftVeil(element, style, saved);\n void getComputedStyle(element).visibility;\n restore(element, style, 'transition', saved.transition);\n}\n\nexport function withoutVeil<T>(element: Element, read: () => T): T {\n const style = styleOf(element);\n const saved = veils.get(element);\n if (!style || !saved) return read();\n\n liftVeil(element, style, saved);\n try {\n return read();\n } finally {\n applyVeil(style);\n }\n}\n\nexport function conceal(element: Element) {\n element.setAttribute('hidden', '');\n const style = styleOf(element);\n if (!style || forcedDisplay.has(element)) return;\n if (getComputedStyle(element).display === 'none') return;\n forcedDisplay.set(element, save(style, 'display'));\n style.setProperty('display', 'none', 'important');\n}\n\nexport function reveal(element: Element) {\n element.removeAttribute('hidden');\n const style = styleOf(element);\n const saved = forcedDisplay.get(element);\n if (!style || !saved) return;\n forcedDisplay.delete(element);\n restore(element, style, 'display', saved);\n}\n","import { cloneElement, createBuild, createDefinitions, drawInto, SCROLL_ATTRIBUTE } from './clone';\nimport { withoutVeil } from './visibility';\n\nexport interface Frame {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\nexport interface Snapshot {\n frame: Frame;\n template: Element;\n definitions: Element | null;\n rules: string;\n nodeCount: number;\n bitmaps: HTMLCanvasElement[];\n}\n\nconst IDENTITY_TRANSFORMS = new Set([\n 'none',\n 'matrix(1, 0, 0, 1, 0, 0)',\n 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)'\n]);\n\nlet snapshotCount = 0;\n\nexport function withoutTranslation(transform: string) {\n const match = /^matrix(3d)?\\((.+)\\)$/.exec(transform);\n if (!match?.[2]) return transform || 'none';\n\n const parts = match[2].split(',').map((part) => part.trim());\n const offsets = match[1] ? [12, 13, 14] : [4, 5];\n for (const index of offsets) parts[index] = '0';\n return `matrix${match[1] ?? ''}(${parts.join(', ')})`;\n}\n\nfunction rootRule(element: Element, rect: DOMRect, name: string) {\n const box = element as HTMLElement;\n const computed = getComputedStyle(element);\n const transform = withoutTranslation(computed.transform);\n const isUntransformed =\n IDENTITY_TRANSFORMS.has(transform) &&\n (!computed.rotate || computed.rotate === 'none') &&\n (!computed.scale || computed.scale === 'none');\n const width = isUntransformed ? rect.width : box.offsetWidth || rect.width;\n const height = isUntransformed ? rect.height : box.offsetHeight || rect.height;\n\n return (\n `.${name}{position:absolute!important;inset:auto!important;` +\n `left:${(rect.width - width) / 2}px!important;top:${(rect.height - height) / 2}px!important;` +\n `width:${width}px!important;height:${height}px!important;margin:0!important;float:none!important;` +\n `box-sizing:border-box!important;translate:none!important;transform:${transform}!important;` +\n `transform-origin:50% 50%!important;}`\n );\n}\n\nexport function captureSnapshot(element: Element): Snapshot | null {\n const rect = element.getBoundingClientRect();\n if (rect.width < 1 || rect.height < 1) return null;\n\n snapshotCount += 1;\n const build = createBuild(`shatter-${snapshotCount}-`);\n\n return withoutVeil(element, () => {\n const template = cloneElement(element, build);\n if (!template) return null;\n\n const nodeCount = build.nodeCount;\n const definitions = createDefinitions(build);\n const rootName = `${build.prefix}root`;\n template.classList.add(rootName);\n build.rules.push(rootRule(element, rect, rootName));\n\n return {\n frame: { left: rect.left, top: rect.top, width: rect.width, height: rect.height },\n template,\n definitions,\n rules: build.rules.join(''),\n nodeCount,\n bitmaps: build.bitmaps\n };\n });\n}\n\nexport function instantiate(snapshot: Snapshot, bitmapScale = 1) {\n const node = snapshot.template.cloneNode(true) as Element;\n if (!snapshot.bitmaps.length) return node;\n\n const canvases = node.localName === 'canvas' ? [node] : Array.from(node.querySelectorAll('canvas'));\n canvases.forEach((element, index) => {\n const bitmap = snapshot.bitmaps[index];\n if (!bitmap) return;\n const canvas = element as HTMLCanvasElement;\n canvas.width = Math.max(Math.round(bitmap.width * bitmapScale), 1);\n canvas.height = Math.max(Math.round(bitmap.height * bitmapScale), 1);\n drawInto(canvas, bitmap);\n });\n return node;\n}\n\nexport function restoreScroll(root: Element) {\n for (const element of Array.from(root.querySelectorAll(`[${SCROLL_ATTRIBUTE}]`))) {\n const [left, top] = (element.getAttribute(SCROLL_ATTRIBUTE) ?? '0,0').split(',').map(Number);\n element.scrollLeft = left ?? 0;\n element.scrollTop = top ?? 0;\n }\n}\n","import type { Point, Shard } from './fracture';\nimport { smoothstep, type Vector } from './motion';\nimport { instantiate, restoreScroll, type Frame, type Snapshot } from './snapshot';\n\nexport interface Piece {\n root: HTMLElement;\n edge: HTMLElement;\n shade: HTMLElement;\n line: SVGSVGElement | null;\n x: number;\n y: number;\n visible: boolean;\n scrollRestored: boolean;\n edgeOpacity: number;\n shadeOpacity: number;\n lineOpacity: number;\n}\n\nexport interface PieceLook {\n depth: number;\n edgeColor: string;\n cracks: boolean;\n bitmapScale: number;\n}\n\nexport interface PiecePose {\n x: number;\n y: number;\n z: number;\n axis: Vector;\n angle: number;\n scale: number;\n opacity: number;\n}\n\nconst SEAM_BLEED = 0.6;\nconst OUTER_EDGE = 0.0005;\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n\nfunction createDiv(className: string) {\n const element = document.createElement('div');\n element.className = className;\n return element;\n}\n\nfunction isOuterEdge(start: Point, end: Point) {\n return (\n (start.x < OUTER_EDGE && end.x < OUTER_EDGE) ||\n (start.x > 1 - OUTER_EDGE && end.x > 1 - OUTER_EDGE) ||\n (start.y < OUTER_EDGE && end.y < OUTER_EDGE) ||\n (start.y > 1 - OUTER_EDGE && end.y > 1 - OUTER_EDGE)\n );\n}\n\nfunction crackPath(shard: Shard, local: Point[]) {\n let path = '';\n shard.points.forEach((point, index) => {\n const nextIndex = (index + 1) % shard.points.length;\n const nextPoint = shard.points[nextIndex];\n const start = local[index];\n const end = local[nextIndex];\n if (!nextPoint || !start || !end || isOuterEdge(point, nextPoint)) return;\n path += `M${start.x.toFixed(2)} ${start.y.toFixed(2)}L${end.x.toFixed(2)} ${end.y.toFixed(2)}`;\n });\n return path;\n}\n\nfunction createCrackLine(path: string, color: string) {\n const line = document.createElementNS(SVG_NAMESPACE, 'svg');\n line.setAttribute('class', 'line');\n line.setAttribute('viewBox', '0 0 100 100');\n line.setAttribute('preserveAspectRatio', 'none');\n const outline = document.createElementNS(SVG_NAMESPACE, 'path');\n outline.setAttribute('d', path);\n outline.setAttribute('stroke', color);\n line.appendChild(outline);\n return line;\n}\n\nfunction measureShard(shard: Shard, frame: Frame) {\n const centerX = shard.center.x * frame.width;\n const centerY = shard.center.y * frame.height;\n const pixels = shard.points.map((point) => {\n const x = point.x * frame.width;\n const y = point.y * frame.height;\n const distance = Math.hypot(x - centerX, y - centerY) || 1;\n return {\n x: x + ((x - centerX) / distance) * SEAM_BLEED,\n y: y + ((y - centerY) / distance) * SEAM_BLEED\n };\n });\n const left = Math.floor(Math.min(...pixels.map((point) => point.x)));\n const top = Math.floor(Math.min(...pixels.map((point) => point.y)));\n const width = Math.max(Math.ceil(Math.max(...pixels.map((point) => point.x))) - left, 1);\n const height = Math.max(Math.ceil(Math.max(...pixels.map((point) => point.y))) - top, 1);\n const local = pixels.map((point) => ({\n x: ((point.x - left) / width) * 100,\n y: ((point.y - top) / height) * 100\n }));\n return { centerX, centerY, left, top, width, height, local };\n}\n\nexport function createPiece(shard: Shard, snapshot: Snapshot, look: PieceLook): Piece {\n const { frame } = snapshot;\n const { centerX, centerY, left, top, width, height, local } = measureShard(shard, frame);\n const polygon = `polygon(${local.map((point) => `${point.x.toFixed(2)}% ${point.y.toFixed(2)}%`).join(',')})`;\n const originX = ((centerX - left) / width) * 100;\n const originY = ((centerY - top) / height) * 100;\n\n const root = createDiv('piece');\n root.style.cssText =\n `left:${frame.left + left}px;top:${frame.top + top}px;width:${width}px;height:${height}px;` +\n `transform-origin:${originX.toFixed(2)}% ${originY.toFixed(2)}%;display:none;`;\n\n const edge = createDiv('edge');\n edge.style.cssText = `clip-path:${polygon};background:${look.edgeColor};transform:translateZ(${-look.depth}px);`;\n\n const face = createDiv('face');\n face.style.clipPath = polygon;\n\n const content = createDiv('content');\n content.style.cssText = `left:${-left}px;top:${-top}px;width:${frame.width}px;height:${frame.height}px;`;\n content.appendChild(instantiate(snapshot, look.bitmapScale));\n\n const shade = createDiv('shade');\n face.append(content, shade);\n root.append(edge, face);\n\n const path = look.cracks ? crackPath(shard, local) : '';\n const line = path ? createCrackLine(path, look.edgeColor) : null;\n if (line) root.appendChild(line);\n\n return {\n root,\n edge,\n shade,\n line,\n x: frame.left + centerX,\n y: frame.top + centerY,\n visible: false,\n scrollRestored: false,\n edgeOpacity: 0,\n shadeOpacity: 0,\n lineOpacity: 0\n };\n}\n\nexport function setPieceVisible(piece: Piece | null, visible: boolean) {\n if (!piece || piece.visible === visible) return;\n piece.visible = visible;\n piece.root.style.display = visible ? 'block' : 'none';\n if (visible && !piece.scrollRestored) {\n piece.scrollRestored = true;\n restoreScroll(piece.root);\n }\n}\n\nexport function movePiece(piece: Piece, { x, y, z, axis, angle, scale, opacity }: PiecePose) {\n piece.root.style.transform =\n `translate3d(${x.toFixed(2)}px,${y.toFixed(2)}px,${z.toFixed(2)}px) ` +\n `rotate3d(${axis.x.toFixed(3)},${axis.y.toFixed(3)},${axis.z.toFixed(3)},${angle.toFixed(3)}rad) ` +\n `scale(${scale.toFixed(3)})`;\n piece.root.style.opacity = opacity.toFixed(2);\n}\n\nfunction setOpacity(element: HTMLElement | SVGSVGElement, current: number, next: number) {\n if (Math.abs(current - next) < 0.01) return current;\n element.style.opacity = next.toFixed(2);\n return next;\n}\n\nexport function shadePiece(piece: Piece, weight: number, angle: number, crack: number) {\n const facing = Math.abs(Math.cos(angle));\n piece.edgeOpacity = setOpacity(piece.edge, piece.edgeOpacity, smoothstep(0.02, 0.35, weight));\n piece.shadeOpacity = setOpacity(piece.shade, piece.shadeOpacity, weight * (0.16 + facing * 0.38));\n if (piece.line) {\n piece.lineOpacity = setOpacity(piece.line, piece.lineOpacity, Math.max(crack * (1 - weight), weight * 0.5));\n }\n}\n","export type Random = () => number;\n\nexport function createRandom(seed?: number): Random {\n if (seed === undefined) return Math.random;\n\n let state = seed >>> 0 || 1;\n return () => {\n state = (state + 0x6d2b79f5) >>> 0;\n let value = state;\n value = Math.imul(value ^ (value >>> 15), value | 1);\n value ^= value + Math.imul(value ^ (value >>> 7), value | 61);\n return ((value ^ (value >>> 14)) >>> 0) / 4294967296;\n };\n}\n","import { createDebris, type Debris } from './debris';\nimport { fracture, type Shard } from './fracture';\nimport {\n clamp01,\n flightPoint,\n flightProgress,\n flightWeight,\n launchDelay,\n midpointFade,\n mix,\n smoothstep,\n type Seed,\n type ShatterMotion,\n type ShatterOrigin,\n type Vector\n} from './motion';\nimport { createOverlay, resolveColor, type Overlay } from './overlay';\nimport { createPiece, movePiece, setPieceVisible, shadePiece, type Piece, type PieceLook } from './piece';\nimport { createRandom, type Random } from './random';\nimport type { Frame, Snapshot } from './snapshot';\nimport type { ShatterAnimation, ShatterOptions, ShatterResult } from './types';\nimport { unveil, veil } from './visibility';\n\nexport interface RunConfig {\n from: Snapshot | null;\n to: Snapshot | null;\n anchor: Element;\n elements: Element[];\n veiled: Element[];\n settle: () => void;\n revert: () => void;\n options: ShatterOptions;\n}\n\ninterface Flight {\n motion: ShatterMotion;\n origin: ShatterOrigin;\n center: { x: number; y: number };\n radius: number;\n depth: number;\n}\n\ninterface FlyingShard {\n seed: Seed;\n delay: number;\n axis: Vector;\n turns: number;\n shrink: number;\n from: Piece | null;\n to: Piece | null;\n}\n\ninterface Scene {\n shards: FlyingShard[];\n debris: Debris | null;\n}\n\nconst DEFAULT_DURATION = 1800;\nconst DEFAULT_COLOR = '#8f897f';\nconst DEFAULT_EDGE_COLOR = 'rgba(128, 122, 112, 0.92)';\nconst DEFAULT_Z_INDEX = 2147483000;\nconst PERSPECTIVE = 1400;\nconst MIN_SHARDS = 10;\nconst MAX_SHARDS = 220;\nconst MAX_CLONED_NODES = 16000;\nconst MAX_BITMAP_PIXELS = 32_000_000;\nconst NODES_PER_PIECE = 8;\nconst MAX_DUST = 900;\nconst MIST_COUNT = 36;\nconst SAFETY_MARGIN = 1200;\n\nconst running = new WeakMap<Element, ShatterAnimation>();\n\nexport function finishRunning(element: Element) {\n running.get(element)?.finish();\n}\n\nexport function settledAnimation(result: ShatterResult, onComplete?: ShatterOptions['onComplete']): ShatterAnimation {\n onComplete?.(result);\n return { finished: Promise.resolve(result), finish() {}, cancel() {} };\n}\n\nexport function resolveShardCount(requested: number | 'auto', area: number, nodesPerShard: number) {\n const wanted =\n requested === 'auto'\n ? Math.min(Math.max(Math.round(area / 2100), 16), 110)\n : Math.min(Math.max(Math.round(requested), 2), MAX_SHARDS);\n const affordable = Math.floor(MAX_CLONED_NODES / Math.max(nodesPerShard, 1));\n return affordable < MIN_SHARDS ? 0 : Math.min(wanted, affordable);\n}\n\nfunction areaOf(snapshot: Snapshot | null) {\n return snapshot ? snapshot.frame.width * snapshot.frame.height : 0;\n}\n\nfunction bitmapPixels(snapshot: Snapshot | null) {\n return (snapshot?.bitmaps ?? []).reduce((total, bitmap) => total + bitmap.width * bitmap.height, 0);\n}\n\nfunction bitmapScaleFor(from: Snapshot | null, to: Snapshot | null, shardCount: number) {\n const pixels = (bitmapPixels(from) + bitmapPixels(to)) * shardCount;\n return pixels > MAX_BITMAP_PIXELS ? Math.sqrt(MAX_BITMAP_PIXELS / pixels) : 1;\n}\n\nfunction centerOf(frame: Frame) {\n return { x: frame.left + frame.width / 2, y: frame.top + frame.height / 2 };\n}\n\nfunction planFlight(from: Snapshot | null, main: Snapshot, options: ShatterOptions): Flight {\n const start = centerOf((from ?? main).frame);\n const end = centerOf(main.frame);\n const largest = Math.max(from?.frame.width ?? 0, from?.frame.height ?? 0, main.frame.width, main.frame.height);\n\n return {\n motion: options.motion ?? 'vortex',\n origin: options.origin ?? 'right',\n center: { x: (start.x + end.x) / 2, y: (start.y + end.y) / 2 },\n radius: largest * 0.62 * (options.spread ?? 1),\n depth: options.depth ?? Math.max(Math.min(main.frame.width, main.frame.height) * 0.016, 2)\n };\n}\n\nfunction launchShard(\n shard: Shard,\n { from, to }: RunConfig,\n flight: Flight,\n look: PieceLook,\n stage: HTMLElement,\n random: Random\n): FlyingShard {\n const seed = { a: random(), b: random(), c: random(), d: random() };\n const axis = { x: seed.c - 0.5, y: seed.a - 0.5, z: seed.b - 0.5 };\n const length = Math.hypot(axis.x, axis.y, axis.z) || 1;\n const fromPiece = from ? createPiece(shard, from, look) : null;\n const toPiece = to ? createPiece(shard, to, look) : null;\n if (fromPiece) stage.appendChild(fromPiece.root);\n if (toPiece) stage.appendChild(toPiece.root);\n\n return {\n seed,\n delay: launchDelay(shard.center, flight.origin, seed.a),\n axis: { x: axis.x / length, y: axis.y / length, z: axis.z / length },\n turns: Math.PI * (2 + seed.b * 4),\n shrink: 0.56 + seed.d * 0.4,\n from: fromPiece,\n to: toPiece\n };\n}\n\nfunction createDebrisLayer(\n options: ShatterOptions,\n { host, shadow }: Overlay,\n flight: Flight,\n frame: Frame,\n shardCount: number,\n random: Random\n) {\n const dust = options.dust === false ? 0 : typeof options.dust === 'number' ? options.dust : shardCount * 8;\n const mist = options.mist === false ? 0 : MIST_COUNT;\n if (!(dust > 0 || mist > 0)) return null;\n\n const canvas = document.createElement('canvas');\n canvas.className = 'debris';\n shadow.appendChild(canvas);\n return createDebris({\n canvas,\n color: resolveColor(host, options.color ?? DEFAULT_COLOR, DEFAULT_COLOR),\n dust: Math.min(Math.max(Math.round(dust), 0), MAX_DUST),\n mist,\n motion: flight.motion,\n origin: flight.origin,\n radius: flight.radius,\n perspective: PERSPECTIVE,\n center: flight.center,\n frame,\n random\n });\n}\n\nfunction buildScene(config: RunConfig, main: Snapshot, overlay: Overlay, flight: Flight, shardCount: number): Scene {\n const { from, to, options } = config;\n const { host, stage } = overlay;\n const random = createRandom(options.seed);\n\n stage.style.perspective = `${PERSPECTIVE}px`;\n stage.style.perspectiveOrigin = `${flight.center.x}px ${flight.center.y}px`;\n for (const snapshot of [from, to]) {\n if (snapshot?.definitions) stage.appendChild(snapshot.definitions.cloneNode(true));\n }\n\n const shards = fracture(main.frame.width, main.frame.height, shardCount, random);\n const look: PieceLook = {\n depth: flight.depth,\n edgeColor: resolveColor(host, options.edgeColor ?? DEFAULT_EDGE_COLOR, DEFAULT_EDGE_COLOR),\n cracks: options.cracks ?? true,\n bitmapScale: bitmapScaleFor(from, to, shards.length)\n };\n\n return {\n shards: shards.map((shard) => launchShard(shard, config, flight, look, stage, random)),\n debris: createDebrisLayer(options, overlay, flight, main.frame, shardCount, random)\n };\n}\n\nfunction renderShard(shard: FlyingShard, time: number, crack: number, flight: Flight) {\n const { motion, center, radius } = flight;\n const isOutOnly = !shard.to;\n const isInOnly = !shard.from;\n const raw = flightProgress(time, shard.delay);\n const progress = isOutOnly ? raw * 0.5 : isInOnly ? 0.5 + raw * 0.5 : raw;\n const usesTarget = isInOnly || (!isOutOnly && progress >= 0.5);\n const piece = usesTarget ? shard.to : shard.from;\n if (!piece) return;\n\n setPieceVisible(usesTarget ? shard.from : shard.to, false);\n setPieceVisible(piece, true);\n\n const weight = flightWeight(progress);\n const point = flightPoint(motion, progress, shard.seed, radius);\n const angle = weight * shard.turns;\n let opacity = midpointFade(motion, progress);\n if (isOutOnly) opacity *= 1 - smoothstep(0.72, 1, raw);\n if (isInOnly) opacity *= smoothstep(0, 0.28, raw);\n\n movePiece(piece, {\n x: mix(piece.x, center.x + point.x, weight) - piece.x,\n y: mix(piece.y, center.y + point.y, weight) - piece.y,\n z: point.z * weight,\n axis: shard.axis,\n angle,\n scale: mix(1, shard.shrink, weight),\n opacity\n });\n shadePiece(piece, weight, angle, crack);\n}\n\nfunction playScene(config: RunConfig, { host, stage }: Overlay, flight: Flight, scene: Scene): ShatterAnimation {\n const { anchor, options } = config;\n const duration = Math.max(options.duration ?? DEFAULT_DURATION, 1);\n const anchorStart = anchor.getBoundingClientRect();\n\n const render = (time: number) => {\n const crack = smoothstep(0, 0.05, time) * (1 - smoothstep(0.8, 0.97, time));\n const now = anchor.getBoundingClientRect();\n const offsetX = now.width ? now.left - anchorStart.left : 0;\n const offsetY = now.width ? now.top - anchorStart.top : 0;\n stage.style.transform = offsetX || offsetY ? `translate(${offsetX}px,${offsetY}px)` : '';\n for (const shard of scene.shards) renderShard(shard, time, crack, flight);\n scene.debris?.draw(time, offsetX, offsetY);\n };\n\n let done = false;\n let frameId = 0;\n let startTime: number | null = null;\n let resolveFinished!: (result: ShatterResult) => void;\n const finished = new Promise<ShatterResult>((resolve) => {\n resolveFinished = resolve;\n });\n\n const handleVisibility = () => {\n if (document.hidden) animation.finish();\n };\n\n const complete = (result: ShatterResult) => {\n if (done) return;\n done = true;\n cancelAnimationFrame(frameId);\n clearTimeout(safetyTimer);\n document.removeEventListener('visibilitychange', handleVisibility);\n\n for (const element of config.veiled) unveil(element);\n if (result === 'cancelled') config.revert();\n else config.settle();\n host.remove();\n\n for (const element of config.elements) {\n if (running.get(element) === animation) running.delete(element);\n }\n resolveFinished(result);\n options.onComplete?.(result);\n };\n\n const animation: ShatterAnimation = {\n finished,\n finish: () => complete('finished'),\n cancel: () => complete('cancelled')\n };\n\n const safetyTimer = setTimeout(animation.finish, duration + SAFETY_MARGIN);\n\n const tick = (now: number) => {\n if (done) return;\n if (!anchor.isConnected) {\n animation.finish();\n return;\n }\n startTime ??= now;\n const time = clamp01((now - startTime) / duration);\n render(time);\n if (time >= 1) animation.finish();\n else frameId = requestAnimationFrame(tick);\n };\n\n for (const element of config.elements) running.set(element, animation);\n for (const element of config.veiled) veil(element);\n document.addEventListener('visibilitychange', handleVisibility);\n render(0);\n\n if (document.hidden) animation.finish();\n else frameId = requestAnimationFrame(tick);\n\n return animation;\n}\n\nexport function startRun(config: RunConfig): ShatterAnimation {\n const { from, to, options } = config;\n const main = to ?? from;\n const nodesPerShard = (from?.nodeCount ?? 0) + (to?.nodeCount ?? 0) + NODES_PER_PIECE;\n const area = Math.max(areaOf(from), areaOf(to));\n const shardCount = main ? resolveShardCount(options.shards ?? 'auto', area, nodesPerShard) : 0;\n\n if (!main || shardCount === 0) {\n config.settle();\n return settledAnimation('skipped', options.onComplete);\n }\n\n const flight = planFlight(from, main, options);\n const overlay = createOverlay(options.zIndex ?? DEFAULT_Z_INDEX, (from?.rules ?? '') + (to?.rules ?? ''));\n\n let scene: Scene;\n try {\n scene = buildScene(config, main, overlay, flight, shardCount);\n } catch {\n overlay.host.remove();\n config.settle();\n return settledAnimation('skipped', options.onComplete);\n }\n return playScene(config, overlay, flight, scene);\n}\n","let enabled = true;\n\nexport function setShatterEnabled(value: boolean) {\n enabled = value;\n}\n\nexport function isShatterEnabled() {\n return enabled;\n}\n\nexport function prefersReducedMotion() {\n return (\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n","import { finishRunning, settledAnimation, startRun } from './run';\nimport { isShatterEnabled, prefersReducedMotion } from './settings';\nimport { captureSnapshot } from './snapshot';\nimport type { PreparedShatter, ShatterAnimation, ShatterOptions } from './types';\nimport { conceal, reveal, unveil, veil } from './visibility';\n\nfunction canAnimate(options: ShatterOptions) {\n if (typeof document === 'undefined' || !isShatterEnabled()) return false;\n return options.respectReducedMotion === false || !prefersReducedMotion();\n}\n\nfunction hideElement(element: Element, options: ShatterOptions) {\n if (options.keepLayout) veil(element);\n else conceal(element);\n}\n\nfunction showElement(element: Element) {\n reveal(element);\n unveil(element);\n}\n\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return typeof (value as PromiseLike<unknown> | null | undefined)?.then === 'function';\n}\n\nexport function shatterOut(element: Element, options: ShatterOptions = {}): ShatterAnimation {\n if (typeof document === 'undefined') return settledAnimation('skipped', options.onComplete);\n finishRunning(element);\n\n const snapshot = canAnimate(options) ? captureSnapshot(element) : null;\n if (!snapshot) {\n hideElement(element, options);\n return settledAnimation('skipped', options.onComplete);\n }\n\n return startRun({\n from: snapshot,\n to: null,\n anchor: element,\n elements: [element],\n veiled: [element],\n settle: () => hideElement(element, options),\n revert: () => {},\n options\n });\n}\n\nexport function shatterIn(element: Element, options: ShatterOptions = {}): ShatterAnimation {\n if (typeof document === 'undefined') return settledAnimation('skipped', options.onComplete);\n finishRunning(element);\n showElement(element);\n\n const snapshot = canAnimate(options) ? captureSnapshot(element) : null;\n if (!snapshot) return settledAnimation('skipped', options.onComplete);\n\n return startRun({\n from: null,\n to: snapshot,\n anchor: element,\n elements: [element],\n veiled: [element],\n settle: () => {},\n revert: () => hideElement(element, options),\n options\n });\n}\n\nexport function shatterTo(from: Element, to: Element, options: ShatterOptions = {}): ShatterAnimation {\n if (typeof document === 'undefined' || from === to) return settledAnimation('skipped', options.onComplete);\n finishRunning(from);\n finishRunning(to);\n\n const animate = canAnimate(options);\n const before = animate ? captureSnapshot(from) : null;\n hideElement(from, options);\n showElement(to);\n const after = animate ? captureSnapshot(to) : null;\n\n if (!before && !after) return settledAnimation('skipped', options.onComplete);\n\n return startRun({\n from: before,\n to: after,\n anchor: after ? to : from,\n elements: [from, to],\n veiled: after ? [to] : [],\n settle: () => {},\n revert: () => {\n hideElement(to, options);\n showElement(from);\n },\n options\n });\n}\n\nexport function prepareShatter(element: Element, options: ShatterOptions = {}): PreparedShatter {\n finishRunning(element);\n const before = canAnimate(options) ? captureSnapshot(element) : null;\n\n return {\n play(playOptions = options) {\n if (!before || !canAnimate(playOptions)) return settledAnimation('skipped', playOptions.onComplete);\n finishRunning(element);\n return startRun({\n from: before,\n to: captureSnapshot(element),\n anchor: element,\n elements: [element],\n veiled: [element],\n settle: () => {},\n revert: () => {},\n options: playOptions\n });\n }\n };\n}\n\nexport function shatterUpdate(\n element: Element,\n update: () => void | PromiseLike<unknown>,\n options: ShatterOptions = {}\n): ShatterAnimation {\n const prepared = prepareShatter(element, options);\n const pending = update();\n\n if (!isThenable(pending)) return prepared.play(options);\n\n let inner: ShatterAnimation | null = null;\n let requested: 'finish' | 'cancel' | null = null;\n const finished = Promise.resolve(pending).then(() => {\n inner = prepared.play(options);\n if (requested) inner[requested]();\n return inner.finished;\n });\n\n return {\n finished,\n finish() {\n requested = 'finish';\n inner?.finish();\n },\n cancel() {\n requested = 'cancel';\n inner?.cancel();\n }\n };\n}\n","import type { ShatterMotion, ShatterOrigin } from '../core/motion';\nimport { shatterTo } from '../core/shatter';\nimport type { ShatterAnimation, ShatterOptions, ShatterResult } from '../core/types';\nimport { conceal, reveal } from '../core/visibility';\n\nexport interface ShatterMorphElement extends HTMLElement {\n active: string;\n readonly activeElement: Element | null;\n options: ShatterOptions;\n show(target: number | string): void;\n next(): void;\n previous(): void;\n finish(): void;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'shatter-morph': ShatterMorphElement;\n }\n}\n\nexport const SHATTER_COMPLETE_EVENT = 'shatter-complete';\n\nconst MOTIONS: readonly string[] = ['vortex', 'burst', 'fall'];\nconst ORIGINS: readonly string[] = ['left', 'right', 'top', 'bottom', 'center'];\n\nfunction numberAttribute(value: string | null) {\n if (value === null || value.trim() === '') return undefined;\n const parsed = Number(value);\n return Number.isFinite(parsed) ? parsed : undefined;\n}\n\nfunction createElementClass(): CustomElementConstructor {\n return class extends HTMLElement implements ShatterMorphElement {\n static readonly observedAttributes = ['active'];\n\n #current: Element | null = null;\n #animation: ShatterAnimation | null = null;\n readonly #observer = new MutationObserver(() => this.#syncChildren());\n options: ShatterOptions = {};\n\n get active() {\n return this.getAttribute('active') ?? '0';\n }\n\n set active(value: string) {\n this.setAttribute('active', String(value));\n }\n\n get activeElement() {\n return this.#current;\n }\n\n show(target: number | string) {\n this.active = String(target);\n }\n\n next() {\n this.#step(1);\n }\n\n previous() {\n this.#step(-1);\n }\n\n finish() {\n this.#animation?.finish();\n }\n\n connectedCallback() {\n if (getComputedStyle(this).display === 'inline') this.style.display = 'block';\n this.#observer.observe(this, { childList: true });\n this.#syncChildren();\n }\n\n disconnectedCallback() {\n this.#observer.disconnect();\n this.#animation?.finish();\n this.#animation = null;\n }\n\n attributeChangedCallback(_name: string, previous: string | null, next: string | null) {\n if (!this.isConnected || previous === next || next === null) return;\n const target = this.#resolve(next);\n if (!target || target === this.#current) return;\n\n const from = this.#current;\n this.#current = target;\n if (!from) {\n reveal(target);\n return;\n }\n\n const animation = shatterTo(from, target, this.#settings());\n this.#animation = animation;\n void animation.finished.then((result: ShatterResult) => {\n if (this.#animation === animation) this.#animation = null;\n this.dispatchEvent(new CustomEvent(SHATTER_COMPLETE_EVENT, { detail: { result, active: this.active } }));\n });\n }\n\n #syncChildren() {\n const items = Array.from(this.children);\n const kept = this.#current && items.includes(this.#current) ? this.#current : null;\n this.#current = this.#resolve(this.active) ?? kept ?? items[0] ?? null;\n\n for (const item of items) {\n if (item === this.#current) reveal(item);\n else conceal(item);\n }\n }\n\n #step(direction: number) {\n const items = Array.from(this.children);\n if (!items.length) return;\n const index = this.#current ? items.indexOf(this.#current) : 0;\n this.active = String((index + direction + items.length) % items.length);\n }\n\n #resolve(value: string) {\n const items = Array.from(this.children);\n const named = items.find((item) => item.id === value || item.getAttribute('data-name') === value);\n if (named) return named;\n return /^\\d+$/.test(value) ? (items[Number(value)] ?? null) : null;\n }\n\n #settings(): ShatterOptions {\n const settings: ShatterOptions = { ...this.options };\n const duration = numberAttribute(this.getAttribute('duration'));\n const shards = numberAttribute(this.getAttribute('shards'));\n const motion = this.getAttribute('motion');\n const origin = this.getAttribute('origin');\n const color = this.getAttribute('color');\n\n if (duration !== undefined) settings.duration = duration;\n if (shards !== undefined) settings.shards = shards;\n if (motion && MOTIONS.includes(motion)) settings.motion = motion as ShatterMotion;\n if (origin && ORIGINS.includes(origin)) settings.origin = origin as ShatterOrigin;\n if (color) settings.color = color;\n if (this.hasAttribute('no-dust')) settings.dust = false;\n if (this.hasAttribute('no-mist')) settings.mist = false;\n if (this.hasAttribute('no-cracks')) settings.cracks = false;\n return settings;\n }\n };\n}\n\nexport function defineShatterMorphElement(tagName = 'shatter-morph') {\n if (typeof customElements === 'undefined') return;\n if (!customElements.get(tagName)) customElements.define(tagName, createElementClass());\n}\n"],"mappings":"8cAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,4BAAAE,GAAA,8BAAAC,EAAA,qBAAAC,EAAA,mBAAAC,GAAA,sBAAAC,GAAA,cAAAC,GAAA,eAAAC,GAAA,cAAAC,EAAA,kBAAAC,KCkBA,IAAMC,GAAM,KAAK,GAAK,EAChBC,GAAc,IACdC,GAAe,IAERC,GAAe,EAAIF,GAAcC,GAEjCE,EAAWC,GAAkB,KAAK,IAAI,KAAK,IAAIA,EAAO,CAAC,EAAG,CAAC,EAE3DC,EAAM,CAACC,EAAcC,EAAYC,IAAmBF,GAAQC,EAAKD,GAAQE,EAE/E,SAASC,EAAWC,EAAeC,EAAaP,EAAe,CACpE,I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AAK,aAAa,UAAU,CAAC,EACxD6B,EAAS7B,GAAgB,KAAK,aAAa,QAAQ,CAAC,EACpD8B,EAAS,KAAK,aAAa,QAAQ,EACnCC,EAAS,KAAK,aAAa,QAAQ,EACnCC,EAAQ,KAAK,aAAa,OAAO,EAEvC,OAAIJ,IAAa,SAAWD,EAAS,SAAWC,GAC5CC,IAAW,SAAWF,EAAS,OAASE,GACxCC,GAAUhC,GAAQ,SAASgC,CAAM,IAAGH,EAAS,OAASG,GACtDC,GAAUhC,GAAQ,SAASgC,CAAM,IAAGJ,EAAS,OAASI,GACtDC,IAAOL,EAAS,MAAQK,GACxB,KAAK,aAAa,SAAS,IAAGL,EAAS,KAAO,IAC9C,KAAK,aAAa,SAAS,IAAGA,EAAS,KAAO,IAC9C,KAAK,aAAa,WAAW,IAAGA,EAAS,OAAS,IAC/CA,CACT,CACF,CACF,CAEO,SAASM,EAA0BC,EAAU,gBAAiB,CAC/D,OAAO,eAAmB,KACzB,eAAe,IAAIA,CAAO,GAAG,eAAe,OAAOA,EAAS/B,GAAmB,CAAC,CACvF,CbjJAgC,EAA0B","names":["browser_exports","__export","SHATTER_COMPLETE_EVENT","defineShatterMorphElement","isShatterEnabled","prepareShatter","setShatterEnabled","shatterIn","shatterOut","shatterTo","shatterUpdate","TAU","SWEEP_SHARE","JITTER_SHARE","FLIGHT_SHARE","clamp01","value","mix","from","to","amount","smoothstep","start","end","x","launchDelay","center","origin","jitter","distance","flightProgress","time","delay","flightWeight","progress","flightPoint","motion","seed","radius","arc","angle","tilt","reach","drop","tube","midpointFade","MAX_PIXEL_RATIO","createMotes","count","options","sizeOf","frame","origin","random","motes","index","seed","unit","launchDelay","createMistSprite","color","sprite","context","gradient","createDebris","canvas","motion","radius","perspective","center","pixelRatio","width","height","scale","dust","mist","place","mote","time","progress","flightProgress","weight","flightWeight","point","flightPoint","x","mix","y","depth","offsetX","offsetY","placed","createSites","width","height","count","random","columns","rows","cellWidth","cellHeight","sites","addSite","column","row","clip","polygon","mid","normal","clipped","current","index","next","currentSide","nextSide","amount","reachOf","site","reach","point","createCell","outline","other","measure","doubled","x","y","cross","fracture","total","shards","center","area","STAGE_RULES","applyRules","root","rules","sheet","style","createHost","zIndex","host","createOverlay","shadow","stage","resolveColor","color","fallback","SCROLL_ATTRIBUTE","HTML_NAMESPACE","SVG_NAMESPACE","DROPPED_TAGS","PLACEHOLDER_TAGS","FORM_CONTROLS","BLOCKED_ATTRIBUTES","SKIPPED_PROPERTY","CONTROL_PAINT","TEXT_FILL","URL_REFERENCE","LOOK_PROPERTIES","TEXT_PROPERTIES","PAINT_PROPERTIES","defaultLooks","createBuild","prefix","drawInto","canvas","image","hasIdLookup","node","referenceTo","id","source","build","isInstanced","root","scope","scopedId","scopeUrls","text","_match","_quote","scopeAttribute","name","value","styleText","style","skipped","index","textStyle","pseudo","pseudoRules","rules","computed","content","lookOf","defaultLook","colorScheme","type","key","known","host","probe","look","hasNativeLook","classFor","isHtml","base","pseudos","existing","copyOwnPaint","copy","own","parent","copyBitmap","isVideo","width","height","bitmap","isBlockedAttribute","element","copyAttributes","attribute","copyFormState","input","childrenOf","assigned","createCopy","tag","copyChildren","isStyled","child","childCopy","cloneElement","createDefinitions","holder","reference","target","VEIL","VEIL_PROPERTIES","VISUAL_PROPERTIES","veils","forcedDisplay","styleOf","element","save","style","name","restore","saved","applyVeil","liftVeil","veil","unveil","withoutVeil","read","conceal","reveal","IDENTITY_TRANSFORMS","snapshotCount","withoutTranslation","transform","match","parts","part","offsets","index","rootRule","element","rect","name","box","computed","isUntransformed","width","height","captureSnapshot","build","createBuild","withoutVeil","template","cloneElement","nodeCount","definitions","createDefinitions","rootName","instantiate","snapshot","bitmapScale","node","bitmap","canvas","drawInto","restoreScroll","root","SCROLL_ATTRIBUTE","left","top","SEAM_BLEED","OUTER_EDGE","SVG_NAMESPACE","createDiv","className","element","isOuterEdge","start","end","crackPath","shard","local","path","point","index","nextIndex","nextPoint","createCrackLine","color","line","outline","measureShard","frame","centerX","centerY","pixels","x","y","distance","left","top","width","height","createPiece","snapshot","look","polygon","originX","originY","root","edge","face","content","instantiate","shade","setPieceVisible","piece","visible","restoreScroll","movePiece","z","axis","angle","scale","opacity","setOpacity","current","next","shadePiece","weight","crack","facing","smoothstep","createRandom","seed","state","value","DEFAULT_DURATION","DEFAULT_COLOR","DEFAULT_EDGE_COLOR","DEFAULT_Z_INDEX","PERSPECTIVE","MIN_SHARDS","MAX_SHARDS","MAX_CLONED_NODES","MAX_BITMAP_PIXELS","NODES_PER_PIECE","MAX_DUST","MIST_COUNT","SAFETY_MARGIN","running","finishRunning","element","settledAnimation","result","onComplete","resolveShardCount","requested","area","nodesPerShard","wanted","affordable","areaOf","snapshot","bitmapPixels","total","bitmap","bitmapScaleFor","from","to","shardCount","pixels","centerOf","frame","planFlight","main","options","start","end","largest","launchShard","shard","flight","look","stage","random","seed","axis","length","fromPiece","createPiece","toPiece","launchDelay","createDebrisLayer","host","shadow","dust","mist","canvas","createDebris","resolveColor","buildScene","config","overlay","createRandom","shards","fracture","renderShard","time","crack","motion","center","radius","isOutOnly","isInOnly","raw","flightProgress","progress","usesTarget","piece","setPieceVisible","weight","flightWeight","point","flightPoint","angle","opacity","midpointFade","smoothstep","movePiece","mix","shadePiece","playScene","scene","anchor","duration","anchorStart","render","now","offsetX","offsetY","done","frameId","startTime","resolveFinished","finished","resolve","handleVisibility","animation","complete","safetyTimer","unveil","tick","clamp01","veil","startRun","createOverlay","enabled","setShatterEnabled","value","isShatterEnabled","prefersReducedMotion","canAnimate","options","isShatterEnabled","prefersReducedMotion","hideElement","element","veil","conceal","showElement","reveal","unveil","isThenable","value","shatterOut","settledAnimation","finishRunning","snapshot","captureSnapshot","startRun","shatterIn","shatterTo","from","to","animate","before","after","prepareShatter","playOptions","shatterUpdate","update","prepared","pending","inner","requested","SHATTER_COMPLETE_EVENT","MOTIONS","ORIGINS","numberAttribute","value","parsed","createElementClass","#current","#animation","#observer","#syncChildren","target","#step","_name","previous","next","#resolve","from","reveal","animation","shatterTo","#settings","result","items","kept","item","conceal","direction","index","named","settings","duration","shards","motion","origin","color","defineShatterMorphElement","tagName","defineShatterMorphElement"]}
|