@brytdesigns/web-component-core 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/animation/index.js +54 -1
- package/dist/esm/animation/index.js.map +1 -1
- package/dist/esm/index.js +54 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/main/animation/getTransitionConfig.js +55 -0
- package/dist/main/animation/getTransitionConfig.js.map +1 -0
- package/dist/main/animation/index.d.ts +25 -1
- package/dist/main/animation/index.js +1 -0
- package/dist/main/index.d.ts +25 -1
- package/package.json +1 -1
|
@@ -39,6 +39,59 @@ function awaitAllAnimations(promises) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
// src/animation/getTransitionConfig.ts
|
|
43
|
+
function getTransitionConfig(style) {
|
|
44
|
+
const properties = {
|
|
45
|
+
bounce: style.getPropertyValue("--motion--bounce"),
|
|
46
|
+
bounceDamping: style.getPropertyValue("--motion--bounce-damping"),
|
|
47
|
+
bounceStiffness: style.getPropertyValue("--motion--bounce-stiffness"),
|
|
48
|
+
duration: style.getPropertyValue("--motion--duration"),
|
|
49
|
+
damping: style.getPropertyValue("--motion--damping"),
|
|
50
|
+
delay: style.getPropertyValue("--motion--delay"),
|
|
51
|
+
ease: style.getPropertyValue("--motion--ease"),
|
|
52
|
+
elapsed: style.getPropertyValue("--motion--elapsed"),
|
|
53
|
+
mass: style.getPropertyValue("--motion--mass"),
|
|
54
|
+
max: style.getPropertyValue("--motion--max"),
|
|
55
|
+
min: style.getPropertyValue("--motion--min"),
|
|
56
|
+
power: style.getPropertyValue("--motion--power"),
|
|
57
|
+
repeat: style.getPropertyValue("--motion--repeat"),
|
|
58
|
+
repeatDelay: style.getPropertyValue("--motion--repeat-delay"),
|
|
59
|
+
repeatType: style.getPropertyValue("--motion--repeat-type"),
|
|
60
|
+
restDelta: style.getPropertyValue("--motion--rest-delta"),
|
|
61
|
+
restSpeed: style.getPropertyValue("--motion--rest-speed"),
|
|
62
|
+
startTime: style.getPropertyValue("--motion--start-time"),
|
|
63
|
+
timeConstant: style.getPropertyValue("--motion--time-constant"),
|
|
64
|
+
times: style.getPropertyValue("--motion--times"),
|
|
65
|
+
type: style.getPropertyValue("--motion--type"),
|
|
66
|
+
velocity: style.getPropertyValue("--motion--velocity"),
|
|
67
|
+
visualDuration: style.getPropertyValue("--motion--visual-duration")
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
bounce: properties.bounce ? parseFloat(properties.bounce) : void 0,
|
|
71
|
+
bounceDamping: properties.bounceDamping ? parseFloat(properties.bounceDamping) : void 0,
|
|
72
|
+
bounceStiffness: properties.bounceStiffness ? parseFloat(properties.bounceStiffness) : void 0,
|
|
73
|
+
duration: properties.duration ? parseFloat(properties.duration) : void 0,
|
|
74
|
+
damping: properties.damping ? parseFloat(properties.damping) : void 0,
|
|
75
|
+
delay: properties.delay ? parseFloat(properties.delay) : void 0,
|
|
76
|
+
ease: properties.ease ? properties.ease : void 0,
|
|
77
|
+
elapsed: properties.elapsed ? parseFloat(properties.elapsed) : void 0,
|
|
78
|
+
mass: properties.mass ? parseFloat(properties.mass) : void 0,
|
|
79
|
+
max: properties.max ? parseFloat(properties.max) : void 0,
|
|
80
|
+
min: properties.min ? parseFloat(properties.min) : void 0,
|
|
81
|
+
power: properties.power ? parseFloat(properties.power) : void 0,
|
|
82
|
+
repeat: properties.repeat ? parseInt(properties.repeat) : void 0,
|
|
83
|
+
repeatDelay: properties.repeatDelay ? parseFloat(properties.repeatDelay) : void 0,
|
|
84
|
+
repeatType: properties.repeatType ? properties.repeatType : void 0,
|
|
85
|
+
restDelta: properties.restDelta ? parseFloat(properties.restDelta) : void 0,
|
|
86
|
+
restSpeed: properties.restSpeed ? parseFloat(properties.restSpeed) : void 0,
|
|
87
|
+
startTime: properties.startTime ? parseFloat(properties.startTime) : void 0,
|
|
88
|
+
timeConstant: properties.timeConstant ? parseFloat(properties.timeConstant) : void 0,
|
|
89
|
+
type: properties.type ? properties.type : void 0,
|
|
90
|
+
velocity: properties.velocity ? parseFloat(properties.velocity) : void 0,
|
|
91
|
+
visualDuration: properties.visualDuration ? parseFloat(properties.visualDuration) : void 0
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { awaitAllAnimations, controlsToPromise, getTransitionConfig };
|
|
43
96
|
//# sourceMappingURL=index.js.map
|
|
44
97
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/animation/controlsToPromise.ts","../../../src/animation/awaitAllAnimations.ts"],"names":[],"mappings":";AAEA,eAAsB,kBACpB,QACA,EAAA;AACA,EAAO,OAAA,IAAI,OAAQ,CAAA,CAAC,OAAY,KAAA;AAC9B,IAAA,QAAA,CAAS,IAAK,CAAA,MAAM,OAAQ,CAAA,IAAI,CAAC,CAAA;AAAA,GAClC,CAAA;AACH;;;ACNO,SAAS,mBACd,QACA,EAAA;AACA,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,EAAS,CAAM,KAAA;AACjC,IAAA,MAAM,UAAiB,EAAC;AACxB,IAAA,IAAI,YAAY,QAAS,CAAA,MAAA;AACzB,IAAA,IAAI,cAAc,CAAG,EAAA;AACnB,MAAA,OAAA,CAAQ,EAAE,CAAA;AACV,MAAA;AAAA;AAGF,IAAS,SAAA,aAAA,CAAiB,OAAU,KAAe,EAAA;AACjD,MAAA,OAAA,CAAQ,KAAK,CAAI,GAAA,KAAA;AACjB,MAAa,SAAA,IAAA,CAAA;AACb,MAAA,IAAI,cAAc,CAAG,EAAA;AACnB,QAAA,OAAA,CAAQ,OAAO,CAAA;AAAA;AACjB;AAGF,IAAS,QAAA,CAAA,OAAA,CAAQ,CAAC,CAAA,EAAG,CAAM,KAAA;AACzB,MAAI,IAAA;AACF,QAAI,IAAA,CAAA,EAAG,UAAU,MAAQ,EAAA;AACvB,UAAA,aAAA,CAAc,MAAM,CAAC,CAAA;AAAA,SAChB,MAAA;AACL,UAAA,CAAA,CAAE,KAAK,MAAM;AACX,YAAA,aAAA,CAAc,MAAM,CAAC,CAAA;AAAA,WACtB,CAAA;AAAA;AACH,eACO,CAAG,EAAA;AACV,QAAA,CAAA,CAAE,KAAK,MAAM;AACX,UAAA,aAAA,CAAc,MAAM,CAAC,CAAA;AAAA,SACtB,CAAA;AAAA;AACH,KACD,CAAA;AAAA,GACF,CAAA;AACH","file":"index.js","sourcesContent":["import type { AnimationPlaybackControlsWithThen } from \"motion\";\n\nexport async function controlsToPromise(\n controls: AnimationPlaybackControlsWithThen,\n) {\n return new Promise((resolve) => {\n controls.then(() => resolve(null));\n });\n}\n","import type { AnimationPlaybackControlsWithThen } from \"motion\";\n\nexport function awaitAllAnimations(\n promises: AnimationPlaybackControlsWithThen[],\n) {\n return new Promise((resolve, _) => {\n const results: any[] = [];\n let remaining = promises.length;\n if (remaining === 0) {\n resolve([]); // zero‐length edge case\n return;\n }\n\n function updateResults<T>(value: T, index: number) {\n results[index] = value;\n remaining -= 1;\n if (remaining === 0) {\n resolve(results);\n }\n }\n\n promises.forEach((p, i) => {\n try {\n if (p?.state === \"idle\") {\n updateResults(null, i);\n } else {\n p.then(() => {\n updateResults(null, i);\n });\n }\n } catch (e) {\n p.then(() => {\n updateResults(null, i);\n });\n }\n });\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/animation/controlsToPromise.ts","../../../src/animation/awaitAllAnimations.ts","../../../src/animation/getTransitionConfig.ts"],"names":[],"mappings":";AAEA,eAAsB,kBACpB,QACA,EAAA;AACA,EAAO,OAAA,IAAI,OAAQ,CAAA,CAAC,OAAY,KAAA;AAC9B,IAAA,QAAA,CAAS,IAAK,CAAA,MAAM,OAAQ,CAAA,IAAI,CAAC,CAAA;AAAA,GAClC,CAAA;AACH;;;ACNO,SAAS,mBACd,QACA,EAAA;AACA,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,EAAS,CAAM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AA;AAAA,IACJ,UAAa,EAAA,UAAA,CAAW,UACpB,GAAA,UAAA,CAAW,UACX,GAAA,MAAA;AAAA,IACJ,WAAW,UAAW,CAAA,SAAA,GAClB,UAAW,CAAA,UAAA,CAAW,SAAS,CAC/B,GAAA,MAAA;AAAA,IACJ,WAAW,UAAW,CAAA,SAAA,GAClB,UAAW,CAAA,UAAA,CAAW,SAAS,CAC/B,GAAA,MAAA;AAAA,IACJ,WAAW,UAAW,CAAA,SAAA,GAClB,UAAW,CAAA,UAAA,CAAW,SAAS,CAC/B,GAAA,MAAA;AAAA,IACJ,cAAc,UAAW,CAAA,YAAA,GACrB,UAAW,CAAA,UAAA,CAAW,YAAY,CAClC,GAAA,MAAA;AAAA,IACJ,IAAO,EAAA,UAAA,CAAW,IACd,GAAA,UAAA,CAAW,IACX,GAAA,MAAA;AAAA,IACJ,UAAU,UAAW,CAAA,QAAA,GAAW,UAAW,CAAA,UAAA,CAAW,QAAQ,CAAI,GAAA,MAAA;AAAA,IAClE,gBAAgB,UAAW,CAAA,cAAA,GACvB,UAAW,CAAA,UAAA,CAAW,cAAc,CACpC,GAAA;AAAA,GACN;AACF","file":"index.js","sourcesContent":["import type { AnimationPlaybackControlsWithThen } from \"motion\";\n\nexport async function controlsToPromise(\n controls: AnimationPlaybackControlsWithThen,\n) {\n return new Promise((resolve) => {\n controls.then(() => resolve(null));\n });\n}\n","import type { AnimationPlaybackControlsWithThen } from \"motion\";\n\nexport function awaitAllAnimations(\n promises: AnimationPlaybackControlsWithThen[],\n) {\n return new Promise((resolve, _) => {\n const results: any[] = [];\n let remaining = promises.length;\n if (remaining === 0) {\n resolve([]); // zero‐length edge case\n return;\n }\n\n function updateResults<T>(value: T, index: number) {\n results[index] = value;\n remaining -= 1;\n if (remaining === 0) {\n resolve(results);\n }\n }\n\n promises.forEach((p, i) => {\n try {\n if (p?.state === \"idle\") {\n updateResults(null, i);\n } else {\n p.then(() => {\n updateResults(null, i);\n });\n }\n } catch (e) {\n p.then(() => {\n updateResults(null, i);\n });\n }\n });\n });\n}\n","import type {\n Easing,\n Transition,\n AnimationGeneratorType,\n RepeatType,\n} from \"motion\";\n\nexport function getTransitionConfig(style: CSSStyleDeclaration) {\n const properties = {\n bounce: style.getPropertyValue(\"--motion--bounce\"),\n bounceDamping: style.getPropertyValue(\"--motion--bounce-damping\"),\n bounceStiffness: style.getPropertyValue(\"--motion--bounce-stiffness\"),\n duration: style.getPropertyValue(\"--motion--duration\"),\n damping: style.getPropertyValue(\"--motion--damping\"),\n delay: style.getPropertyValue(\"--motion--delay\"),\n ease: style.getPropertyValue(\"--motion--ease\"),\n elapsed: style.getPropertyValue(\"--motion--elapsed\"),\n mass: style.getPropertyValue(\"--motion--mass\"),\n max: style.getPropertyValue(\"--motion--max\"),\n min: style.getPropertyValue(\"--motion--min\"),\n power: style.getPropertyValue(\"--motion--power\"),\n repeat: style.getPropertyValue(\"--motion--repeat\"),\n repeatDelay: style.getPropertyValue(\"--motion--repeat-delay\"),\n repeatType: style.getPropertyValue(\"--motion--repeat-type\"),\n restDelta: style.getPropertyValue(\"--motion--rest-delta\"),\n restSpeed: style.getPropertyValue(\"--motion--rest-speed\"),\n startTime: style.getPropertyValue(\"--motion--start-time\"),\n timeConstant: style.getPropertyValue(\"--motion--time-constant\"),\n times: style.getPropertyValue(\"--motion--times\"),\n type: style.getPropertyValue(\"--motion--type\"),\n velocity: style.getPropertyValue(\"--motion--velocity\"),\n visualDuration: style.getPropertyValue(\"--motion--visual-duration\"),\n };\n return {\n bounce: properties.bounce ? parseFloat(properties.bounce) : undefined,\n bounceDamping: properties.bounceDamping\n ? parseFloat(properties.bounceDamping)\n : undefined,\n bounceStiffness: properties.bounceStiffness\n ? parseFloat(properties.bounceStiffness)\n : undefined,\n duration: properties.duration ? parseFloat(properties.duration) : undefined,\n damping: properties.damping ? parseFloat(properties.damping) : undefined,\n delay: properties.delay ? parseFloat(properties.delay) : undefined,\n ease: (properties.ease ? properties.ease : undefined) as Easing,\n elapsed: properties.elapsed ? parseFloat(properties.elapsed) : undefined,\n mass: properties.mass ? parseFloat(properties.mass) : undefined,\n max: properties.max ? parseFloat(properties.max) : undefined,\n min: properties.min ? parseFloat(properties.min) : undefined,\n power: properties.power ? parseFloat(properties.power) : undefined,\n repeat: properties.repeat ? parseInt(properties.repeat) : undefined,\n repeatDelay: properties.repeatDelay\n ? parseFloat(properties.repeatDelay)\n : undefined,\n repeatType: (properties.repeatType\n ? properties.repeatType\n : undefined) as RepeatType,\n restDelta: properties.restDelta\n ? parseFloat(properties.restDelta)\n : undefined,\n restSpeed: properties.restSpeed\n ? parseFloat(properties.restSpeed)\n : undefined,\n startTime: properties.startTime\n ? parseFloat(properties.startTime)\n : undefined,\n timeConstant: properties.timeConstant\n ? parseFloat(properties.timeConstant)\n : undefined,\n type: (properties.type\n ? properties.type\n : undefined) as AnimationGeneratorType,\n velocity: properties.velocity ? parseFloat(properties.velocity) : undefined,\n visualDuration: properties.visualDuration\n ? parseFloat(properties.visualDuration)\n : undefined,\n } satisfies Transition;\n}\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -71,6 +71,59 @@ function awaitAllAnimations(promises) {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
// src/animation/getTransitionConfig.ts
|
|
75
|
+
function getTransitionConfig(style) {
|
|
76
|
+
const properties = {
|
|
77
|
+
bounce: style.getPropertyValue("--motion--bounce"),
|
|
78
|
+
bounceDamping: style.getPropertyValue("--motion--bounce-damping"),
|
|
79
|
+
bounceStiffness: style.getPropertyValue("--motion--bounce-stiffness"),
|
|
80
|
+
duration: style.getPropertyValue("--motion--duration"),
|
|
81
|
+
damping: style.getPropertyValue("--motion--damping"),
|
|
82
|
+
delay: style.getPropertyValue("--motion--delay"),
|
|
83
|
+
ease: style.getPropertyValue("--motion--ease"),
|
|
84
|
+
elapsed: style.getPropertyValue("--motion--elapsed"),
|
|
85
|
+
mass: style.getPropertyValue("--motion--mass"),
|
|
86
|
+
max: style.getPropertyValue("--motion--max"),
|
|
87
|
+
min: style.getPropertyValue("--motion--min"),
|
|
88
|
+
power: style.getPropertyValue("--motion--power"),
|
|
89
|
+
repeat: style.getPropertyValue("--motion--repeat"),
|
|
90
|
+
repeatDelay: style.getPropertyValue("--motion--repeat-delay"),
|
|
91
|
+
repeatType: style.getPropertyValue("--motion--repeat-type"),
|
|
92
|
+
restDelta: style.getPropertyValue("--motion--rest-delta"),
|
|
93
|
+
restSpeed: style.getPropertyValue("--motion--rest-speed"),
|
|
94
|
+
startTime: style.getPropertyValue("--motion--start-time"),
|
|
95
|
+
timeConstant: style.getPropertyValue("--motion--time-constant"),
|
|
96
|
+
times: style.getPropertyValue("--motion--times"),
|
|
97
|
+
type: style.getPropertyValue("--motion--type"),
|
|
98
|
+
velocity: style.getPropertyValue("--motion--velocity"),
|
|
99
|
+
visualDuration: style.getPropertyValue("--motion--visual-duration")
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
bounce: properties.bounce ? parseFloat(properties.bounce) : void 0,
|
|
103
|
+
bounceDamping: properties.bounceDamping ? parseFloat(properties.bounceDamping) : void 0,
|
|
104
|
+
bounceStiffness: properties.bounceStiffness ? parseFloat(properties.bounceStiffness) : void 0,
|
|
105
|
+
duration: properties.duration ? parseFloat(properties.duration) : void 0,
|
|
106
|
+
damping: properties.damping ? parseFloat(properties.damping) : void 0,
|
|
107
|
+
delay: properties.delay ? parseFloat(properties.delay) : void 0,
|
|
108
|
+
ease: properties.ease ? properties.ease : void 0,
|
|
109
|
+
elapsed: properties.elapsed ? parseFloat(properties.elapsed) : void 0,
|
|
110
|
+
mass: properties.mass ? parseFloat(properties.mass) : void 0,
|
|
111
|
+
max: properties.max ? parseFloat(properties.max) : void 0,
|
|
112
|
+
min: properties.min ? parseFloat(properties.min) : void 0,
|
|
113
|
+
power: properties.power ? parseFloat(properties.power) : void 0,
|
|
114
|
+
repeat: properties.repeat ? parseInt(properties.repeat) : void 0,
|
|
115
|
+
repeatDelay: properties.repeatDelay ? parseFloat(properties.repeatDelay) : void 0,
|
|
116
|
+
repeatType: properties.repeatType ? properties.repeatType : void 0,
|
|
117
|
+
restDelta: properties.restDelta ? parseFloat(properties.restDelta) : void 0,
|
|
118
|
+
restSpeed: properties.restSpeed ? parseFloat(properties.restSpeed) : void 0,
|
|
119
|
+
startTime: properties.startTime ? parseFloat(properties.startTime) : void 0,
|
|
120
|
+
timeConstant: properties.timeConstant ? parseFloat(properties.timeConstant) : void 0,
|
|
121
|
+
type: properties.type ? properties.type : void 0,
|
|
122
|
+
velocity: properties.velocity ? parseFloat(properties.velocity) : void 0,
|
|
123
|
+
visualDuration: properties.visualDuration ? parseFloat(properties.visualDuration) : void 0
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { abortablePromise, awaitAllAnimations, controlsToPromise, createFocusTrap, getTransitionConfig };
|
|
75
128
|
//# sourceMappingURL=index.js.map
|
|
76
129
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/focusTrap/index.ts","../../src/promise/abortablePromise.ts","../../src/animation/controlsToPromise.ts","../../src/animation/awaitAllAnimations.ts"],"names":["_createFocusTrap"],"mappings":";;;;AAOA,IAAM,YAA8B,EAAC;AAE9B,IAAM,eAAkB,GAAA,CAC7B,OACA,EAAA,OAAA,KAEA,WAAW,MAAM;AACf,EAAM,MAAA,CAAA,GAAI,WAAe,IAAA;AAAA,IACvB;AAAA,GACF;AACA,EAAI,IAAA,CAAC,EAAE,SAAW,EAAA;AAChB,IAAA,CAAA,CAAE,SAAY,GAAA,SAAA;AAAA;AAEhB,EAAO,OAAAA,iBAAA,CAAiB,SAAS,CAAC,CAAA;AACpC,CAAC;;;ACrBI,SAAS,gBAAA,CAAiB,SAAuB,MAAqB,EAAA;AAC3E,EAAA,IAAI,OAAO,OAAS,EAAA;AAClB,IAAO,OAAA,IAAI,QAAQ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,CAAA,CAAE,KAAK,MAAM;AACX,YAAA,aAAA,CAAc,MAAM,CAAC,CAAA;AAAA,WACtB,CAAA;AAAA;AACH,eACO,CAAG,EAAA;AACV,QAAA,CAAA,CAAE,KAAK,MAAM;AACX,UAAA,aAAA,CAAc,MAAM,CAAC,CAAA;AAAA,SACtB,CAAA;AAAA;AACH,KACD,CAAA;AAAA,GACF,CAAA;AACH","file":"index.js","sourcesContent":["import {\n createFocusTrap as _createFocusTrap,\n type Options,\n type FocusTrap,\n} from \"focus-trap\";\nimport { createMemo, type Accessor } from \"solid-js\";\n\nconst trapStack: Array<FocusTrap> = [];\n\nexport const createFocusTrap = (\n element: HTMLElement,\n options?: Accessor<Options>,\n) =>\n createMemo(() => {\n const o = options?.() || {\n trapStack,\n };\n if (!o.trapStack) {\n o.trapStack = trapStack;\n }\n return _createFocusTrap(element, o);\n });\n","export function abortablePromise(promise: Promise<any>, signal: AbortSignal) {\n if (signal.aborted) {\n return new Promise((_, rej) => rej(signal.reason));\n }\n\n return new Promise(async (res, rej) => {\n signal.addEventListener(\n \"abort\",\n () => {\n rej(signal.reason);\n },\n { once: true },\n );\n promise.then(res);\n });\n}\n","import type { AnimationPlaybackControlsWithThen } from \"motion\";\n\nexport async function controlsToPromise(\n controls: AnimationPlaybackControlsWithThen,\n) {\n return new Promise((resolve) => {\n controls.then(() => resolve(null));\n });\n}\n","import type { AnimationPlaybackControlsWithThen } from \"motion\";\n\nexport function awaitAllAnimations(\n promises: AnimationPlaybackControlsWithThen[],\n) {\n return new Promise((resolve, _) => {\n const results: any[] = [];\n let remaining = promises.length;\n if (remaining === 0) {\n resolve([]); // zero‐length edge case\n return;\n }\n\n function updateResults<T>(value: T, index: number) {\n results[index] = value;\n remaining -= 1;\n if (remaining === 0) {\n resolve(results);\n }\n }\n\n promises.forEach((p, i) => {\n try {\n if (p?.state === \"idle\") {\n updateResults(null, i);\n } else {\n p.then(() => {\n updateResults(null, i);\n });\n }\n } catch (e) {\n p.then(() => {\n updateResults(null, i);\n });\n }\n });\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/focusTrap/index.ts","../../src/promise/abortablePromise.ts","../../src/animation/controlsToPromise.ts","../../src/animation/awaitAllAnimations.ts","../../src/animation/getTransitionConfig.ts"],"names":["_createFocusTrap"],"mappings":";;;;AAOA,IAAM,YAA8B,EAAC;AAE9B,IAAM,eAAkB,GAAA,CAC7B,OACA,EAAA,OAAA,KAEA,WAAW,MAAM;AACf,EAAM,MAAA,CAAA,GAAI,WAAe,IAAA;AAAA,IACvB;AAAA,GACF;AACA,EAAI,IAAA,CAAC,EAAE,SAAW,EAAA;AAChB,IAAA,CAAA,CAAE,SAAY,GAAA,SAAA;AAAA;AAEhB,EAAO,OAAAA,iBAAA,CAAiB,SAAS,CAAC,CAAA;AACpC,CAAC;;;ACrBI,SAAS,gBAAA,CAAiB,SAAuB,MAAqB,EAAA;AAC3E,EAAA,IAAI,OAAO,OAAS,EAAA;AAClB,IAAO,OAAA,IAAI,QAAQ,CAAC,CAAA,EAAG,QAAQ,GAAI,CAAA,MAAA,CAAO,MAAM,CAAC,CAAA;AAAA;AAGnD,EAAA,OAAO,IAAI,OAAA,CAAQ,OAAO,GAAA,EAAK,GAAQ,KAAA;AACrC,IAAO,MAAA,CAAA,gBAAA;AAAA,MACL,OAAA;AAAA,MACA,MAAM;AACJ,QAAA,GAAA,CAAI,OAAO,MAAM,CAAA;AAAA,OACnB;AAAA,MACA,EAAE,MAAM,IAAK;AAAA,KACf;AACA,IAAA,OAAA,CAAQ,KAAK,GAAG,CAAA;AAAA,GACjB,CAAA;AACH;;;ACbA,eAAsB,kBACpB,QACA,EAAA;AACA,EAAO,OAAA,IAAI,OAAQ,CAAA,CAAC,OAAY,KAAA;AAC9B,IAAA,QAAA,CAAS,IAAK,CAAA,MAAM,OAAQ,CAAA,IAAI,CAAC,CAAA;AAAA,GAClC,CAAA;AACH;;;ACNO,SAAS,mBACd,QACA,EAAA;AACA,EAAA,OAAO,IAAI,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AA,UAAA,CAAW,WAAW,CACjC,GAAA,MAAA;AAAA,IACJ,UAAa,EAAA,UAAA,CAAW,UACpB,GAAA,UAAA,CAAW,UACX,GAAA,MAAA;AAAA,IACJ,WAAW,UAAW,CAAA,SAAA,GAClB,UAAW,CAAA,UAAA,CAAW,SAAS,CAC/B,GAAA,MAAA;AAAA,IACJ,WAAW,UAAW,CAAA,SAAA,GAClB,UAAW,CAAA,UAAA,CAAW,SAAS,CAC/B,GAAA,MAAA;AAAA,IACJ,WAAW,UAAW,CAAA,SAAA,GAClB,UAAW,CAAA,UAAA,CAAW,SAAS,CAC/B,GAAA,MAAA;AAAA,IACJ,cAAc,UAAW,CAAA,YAAA,GACrB,UAAW,CAAA,UAAA,CAAW,YAAY,CAClC,GAAA,MAAA;AAAA,IACJ,IAAO,EAAA,UAAA,CAAW,IACd,GAAA,UAAA,CAAW,IACX,GAAA,MAAA;AAAA,IACJ,UAAU,UAAW,CAAA,QAAA,GAAW,UAAW,CAAA,UAAA,CAAW,QAAQ,CAAI,GAAA,MAAA;AAAA,IAClE,gBAAgB,UAAW,CAAA,cAAA,GACvB,UAAW,CAAA,UAAA,CAAW,cAAc,CACpC,GAAA;AAAA,GACN;AACF","file":"index.js","sourcesContent":["import {\n createFocusTrap as _createFocusTrap,\n type Options,\n type FocusTrap,\n} from \"focus-trap\";\nimport { createMemo, type Accessor } from \"solid-js\";\n\nconst trapStack: Array<FocusTrap> = [];\n\nexport const createFocusTrap = (\n element: HTMLElement,\n options?: Accessor<Options>,\n) =>\n createMemo(() => {\n const o = options?.() || {\n trapStack,\n };\n if (!o.trapStack) {\n o.trapStack = trapStack;\n }\n return _createFocusTrap(element, o);\n });\n","export function abortablePromise(promise: Promise<any>, signal: AbortSignal) {\n if (signal.aborted) {\n return new Promise((_, rej) => rej(signal.reason));\n }\n\n return new Promise(async (res, rej) => {\n signal.addEventListener(\n \"abort\",\n () => {\n rej(signal.reason);\n },\n { once: true },\n );\n promise.then(res);\n });\n}\n","import type { AnimationPlaybackControlsWithThen } from \"motion\";\n\nexport async function controlsToPromise(\n controls: AnimationPlaybackControlsWithThen,\n) {\n return new Promise((resolve) => {\n controls.then(() => resolve(null));\n });\n}\n","import type { AnimationPlaybackControlsWithThen } from \"motion\";\n\nexport function awaitAllAnimations(\n promises: AnimationPlaybackControlsWithThen[],\n) {\n return new Promise((resolve, _) => {\n const results: any[] = [];\n let remaining = promises.length;\n if (remaining === 0) {\n resolve([]); // zero‐length edge case\n return;\n }\n\n function updateResults<T>(value: T, index: number) {\n results[index] = value;\n remaining -= 1;\n if (remaining === 0) {\n resolve(results);\n }\n }\n\n promises.forEach((p, i) => {\n try {\n if (p?.state === \"idle\") {\n updateResults(null, i);\n } else {\n p.then(() => {\n updateResults(null, i);\n });\n }\n } catch (e) {\n p.then(() => {\n updateResults(null, i);\n });\n }\n });\n });\n}\n","import type {\n Easing,\n Transition,\n AnimationGeneratorType,\n RepeatType,\n} from \"motion\";\n\nexport function getTransitionConfig(style: CSSStyleDeclaration) {\n const properties = {\n bounce: style.getPropertyValue(\"--motion--bounce\"),\n bounceDamping: style.getPropertyValue(\"--motion--bounce-damping\"),\n bounceStiffness: style.getPropertyValue(\"--motion--bounce-stiffness\"),\n duration: style.getPropertyValue(\"--motion--duration\"),\n damping: style.getPropertyValue(\"--motion--damping\"),\n delay: style.getPropertyValue(\"--motion--delay\"),\n ease: style.getPropertyValue(\"--motion--ease\"),\n elapsed: style.getPropertyValue(\"--motion--elapsed\"),\n mass: style.getPropertyValue(\"--motion--mass\"),\n max: style.getPropertyValue(\"--motion--max\"),\n min: style.getPropertyValue(\"--motion--min\"),\n power: style.getPropertyValue(\"--motion--power\"),\n repeat: style.getPropertyValue(\"--motion--repeat\"),\n repeatDelay: style.getPropertyValue(\"--motion--repeat-delay\"),\n repeatType: style.getPropertyValue(\"--motion--repeat-type\"),\n restDelta: style.getPropertyValue(\"--motion--rest-delta\"),\n restSpeed: style.getPropertyValue(\"--motion--rest-speed\"),\n startTime: style.getPropertyValue(\"--motion--start-time\"),\n timeConstant: style.getPropertyValue(\"--motion--time-constant\"),\n times: style.getPropertyValue(\"--motion--times\"),\n type: style.getPropertyValue(\"--motion--type\"),\n velocity: style.getPropertyValue(\"--motion--velocity\"),\n visualDuration: style.getPropertyValue(\"--motion--visual-duration\"),\n };\n return {\n bounce: properties.bounce ? parseFloat(properties.bounce) : undefined,\n bounceDamping: properties.bounceDamping\n ? parseFloat(properties.bounceDamping)\n : undefined,\n bounceStiffness: properties.bounceStiffness\n ? parseFloat(properties.bounceStiffness)\n : undefined,\n duration: properties.duration ? parseFloat(properties.duration) : undefined,\n damping: properties.damping ? parseFloat(properties.damping) : undefined,\n delay: properties.delay ? parseFloat(properties.delay) : undefined,\n ease: (properties.ease ? properties.ease : undefined) as Easing,\n elapsed: properties.elapsed ? parseFloat(properties.elapsed) : undefined,\n mass: properties.mass ? parseFloat(properties.mass) : undefined,\n max: properties.max ? parseFloat(properties.max) : undefined,\n min: properties.min ? parseFloat(properties.min) : undefined,\n power: properties.power ? parseFloat(properties.power) : undefined,\n repeat: properties.repeat ? parseInt(properties.repeat) : undefined,\n repeatDelay: properties.repeatDelay\n ? parseFloat(properties.repeatDelay)\n : undefined,\n repeatType: (properties.repeatType\n ? properties.repeatType\n : undefined) as RepeatType,\n restDelta: properties.restDelta\n ? parseFloat(properties.restDelta)\n : undefined,\n restSpeed: properties.restSpeed\n ? parseFloat(properties.restSpeed)\n : undefined,\n startTime: properties.startTime\n ? parseFloat(properties.startTime)\n : undefined,\n timeConstant: properties.timeConstant\n ? parseFloat(properties.timeConstant)\n : undefined,\n type: (properties.type\n ? properties.type\n : undefined) as AnimationGeneratorType,\n velocity: properties.velocity ? parseFloat(properties.velocity) : undefined,\n visualDuration: properties.visualDuration\n ? parseFloat(properties.visualDuration)\n : undefined,\n } satisfies Transition;\n}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
function getTransitionConfig(style) {
|
|
2
|
+
const properties = {
|
|
3
|
+
bounce: style.getPropertyValue("--motion--bounce"),
|
|
4
|
+
bounceDamping: style.getPropertyValue("--motion--bounce-damping"),
|
|
5
|
+
bounceStiffness: style.getPropertyValue("--motion--bounce-stiffness"),
|
|
6
|
+
duration: style.getPropertyValue("--motion--duration"),
|
|
7
|
+
damping: style.getPropertyValue("--motion--damping"),
|
|
8
|
+
delay: style.getPropertyValue("--motion--delay"),
|
|
9
|
+
ease: style.getPropertyValue("--motion--ease"),
|
|
10
|
+
elapsed: style.getPropertyValue("--motion--elapsed"),
|
|
11
|
+
mass: style.getPropertyValue("--motion--mass"),
|
|
12
|
+
max: style.getPropertyValue("--motion--max"),
|
|
13
|
+
min: style.getPropertyValue("--motion--min"),
|
|
14
|
+
power: style.getPropertyValue("--motion--power"),
|
|
15
|
+
repeat: style.getPropertyValue("--motion--repeat"),
|
|
16
|
+
repeatDelay: style.getPropertyValue("--motion--repeat-delay"),
|
|
17
|
+
repeatType: style.getPropertyValue("--motion--repeat-type"),
|
|
18
|
+
restDelta: style.getPropertyValue("--motion--rest-delta"),
|
|
19
|
+
restSpeed: style.getPropertyValue("--motion--rest-speed"),
|
|
20
|
+
startTime: style.getPropertyValue("--motion--start-time"),
|
|
21
|
+
timeConstant: style.getPropertyValue("--motion--time-constant"),
|
|
22
|
+
times: style.getPropertyValue("--motion--times"),
|
|
23
|
+
type: style.getPropertyValue("--motion--type"),
|
|
24
|
+
velocity: style.getPropertyValue("--motion--velocity"),
|
|
25
|
+
visualDuration: style.getPropertyValue("--motion--visual-duration")
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
bounce: properties.bounce ? parseFloat(properties.bounce) : void 0,
|
|
29
|
+
bounceDamping: properties.bounceDamping ? parseFloat(properties.bounceDamping) : void 0,
|
|
30
|
+
bounceStiffness: properties.bounceStiffness ? parseFloat(properties.bounceStiffness) : void 0,
|
|
31
|
+
duration: properties.duration ? parseFloat(properties.duration) : void 0,
|
|
32
|
+
damping: properties.damping ? parseFloat(properties.damping) : void 0,
|
|
33
|
+
delay: properties.delay ? parseFloat(properties.delay) : void 0,
|
|
34
|
+
ease: properties.ease ? properties.ease : void 0,
|
|
35
|
+
elapsed: properties.elapsed ? parseFloat(properties.elapsed) : void 0,
|
|
36
|
+
mass: properties.mass ? parseFloat(properties.mass) : void 0,
|
|
37
|
+
max: properties.max ? parseFloat(properties.max) : void 0,
|
|
38
|
+
min: properties.min ? parseFloat(properties.min) : void 0,
|
|
39
|
+
power: properties.power ? parseFloat(properties.power) : void 0,
|
|
40
|
+
repeat: properties.repeat ? parseInt(properties.repeat) : void 0,
|
|
41
|
+
repeatDelay: properties.repeatDelay ? parseFloat(properties.repeatDelay) : void 0,
|
|
42
|
+
repeatType: properties.repeatType ? properties.repeatType : void 0,
|
|
43
|
+
restDelta: properties.restDelta ? parseFloat(properties.restDelta) : void 0,
|
|
44
|
+
restSpeed: properties.restSpeed ? parseFloat(properties.restSpeed) : void 0,
|
|
45
|
+
startTime: properties.startTime ? parseFloat(properties.startTime) : void 0,
|
|
46
|
+
timeConstant: properties.timeConstant ? parseFloat(properties.timeConstant) : void 0,
|
|
47
|
+
type: properties.type ? properties.type : void 0,
|
|
48
|
+
velocity: properties.velocity ? parseFloat(properties.velocity) : void 0,
|
|
49
|
+
visualDuration: properties.visualDuration ? parseFloat(properties.visualDuration) : void 0
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { getTransitionConfig };
|
|
54
|
+
//# sourceMappingURL=getTransitionConfig.js.map
|
|
55
|
+
//# sourceMappingURL=getTransitionConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/animation/getTransitionConfig.ts"],"names":[],"mappings":"AAOO,SAAS,oBAAoB,KAA4B,EAAA;AAC9D,EAAA,MAAM,UAAa,GAAA;AAAA,IACjB,MAAA,EAAQ,KAAM,CAAA,gBAAA,CAAiB,kBAAkB,CAAA;AAAA,IACjD,aAAA,EAAe,KAAM,CAAA,gBAAA,CAAiB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A,CAAW,KAAK,CAAI,GAAA,MAAA;AAAA,IACzD,QAAQ,UAAW,CAAA,MAAA,GAAS,QAAS,CAAA,UAAA,CAAW,MAAM,CAAI,GAAA,MAAA;AAAA,IAC1D,aAAa,UAAW,CAAA,WAAA,GACpB,UAAW,CAAA,UAAA,CAAW,WAAW,CACjC,GAAA,MAAA;AAAA,IACJ,UAAa,EAAA,UAAA,CAAW,UACpB,GAAA,UAAA,CAAW,UACX,GAAA,MAAA;AAAA,IACJ,WAAW,UAAW,CAAA,SAAA,GAClB,UAAW,CAAA,UAAA,CAAW,SAAS,CAC/B,GAAA,MAAA;AAAA,IACJ,WAAW,UAAW,CAAA,SAAA,GAClB,UAAW,CAAA,UAAA,CAAW,SAAS,CAC/B,GAAA,MAAA;AAAA,IACJ,WAAW,UAAW,CAAA,SAAA,GAClB,UAAW,CAAA,UAAA,CAAW,SAAS,CAC/B,GAAA,MAAA;AAAA,IACJ,cAAc,UAAW,CAAA,YAAA,GACrB,UAAW,CAAA,UAAA,CAAW,YAAY,CAClC,GAAA,MAAA;AAAA,IACJ,IAAO,EAAA,UAAA,CAAW,IACd,GAAA,UAAA,CAAW,IACX,GAAA,MAAA;AAAA,IACJ,UAAU,UAAW,CAAA,QAAA,GAAW,UAAW,CAAA,UAAA,CAAW,QAAQ,CAAI,GAAA,MAAA;AAAA,IAClE,gBAAgB,UAAW,CAAA,cAAA,GACvB,UAAW,CAAA,UAAA,CAAW,cAAc,CACpC,GAAA;AAAA,GACN;AACF","file":"getTransitionConfig.js","sourcesContent":["import type {\n Easing,\n Transition,\n AnimationGeneratorType,\n RepeatType,\n} from \"motion\";\n\nexport function getTransitionConfig(style: CSSStyleDeclaration) {\n const properties = {\n bounce: style.getPropertyValue(\"--motion--bounce\"),\n bounceDamping: style.getPropertyValue(\"--motion--bounce-damping\"),\n bounceStiffness: style.getPropertyValue(\"--motion--bounce-stiffness\"),\n duration: style.getPropertyValue(\"--motion--duration\"),\n damping: style.getPropertyValue(\"--motion--damping\"),\n delay: style.getPropertyValue(\"--motion--delay\"),\n ease: style.getPropertyValue(\"--motion--ease\"),\n elapsed: style.getPropertyValue(\"--motion--elapsed\"),\n mass: style.getPropertyValue(\"--motion--mass\"),\n max: style.getPropertyValue(\"--motion--max\"),\n min: style.getPropertyValue(\"--motion--min\"),\n power: style.getPropertyValue(\"--motion--power\"),\n repeat: style.getPropertyValue(\"--motion--repeat\"),\n repeatDelay: style.getPropertyValue(\"--motion--repeat-delay\"),\n repeatType: style.getPropertyValue(\"--motion--repeat-type\"),\n restDelta: style.getPropertyValue(\"--motion--rest-delta\"),\n restSpeed: style.getPropertyValue(\"--motion--rest-speed\"),\n startTime: style.getPropertyValue(\"--motion--start-time\"),\n timeConstant: style.getPropertyValue(\"--motion--time-constant\"),\n times: style.getPropertyValue(\"--motion--times\"),\n type: style.getPropertyValue(\"--motion--type\"),\n velocity: style.getPropertyValue(\"--motion--velocity\"),\n visualDuration: style.getPropertyValue(\"--motion--visual-duration\"),\n };\n return {\n bounce: properties.bounce ? parseFloat(properties.bounce) : undefined,\n bounceDamping: properties.bounceDamping\n ? parseFloat(properties.bounceDamping)\n : undefined,\n bounceStiffness: properties.bounceStiffness\n ? parseFloat(properties.bounceStiffness)\n : undefined,\n duration: properties.duration ? parseFloat(properties.duration) : undefined,\n damping: properties.damping ? parseFloat(properties.damping) : undefined,\n delay: properties.delay ? parseFloat(properties.delay) : undefined,\n ease: (properties.ease ? properties.ease : undefined) as Easing,\n elapsed: properties.elapsed ? parseFloat(properties.elapsed) : undefined,\n mass: properties.mass ? parseFloat(properties.mass) : undefined,\n max: properties.max ? parseFloat(properties.max) : undefined,\n min: properties.min ? parseFloat(properties.min) : undefined,\n power: properties.power ? parseFloat(properties.power) : undefined,\n repeat: properties.repeat ? parseInt(properties.repeat) : undefined,\n repeatDelay: properties.repeatDelay\n ? parseFloat(properties.repeatDelay)\n : undefined,\n repeatType: (properties.repeatType\n ? properties.repeatType\n : undefined) as RepeatType,\n restDelta: properties.restDelta\n ? parseFloat(properties.restDelta)\n : undefined,\n restSpeed: properties.restSpeed\n ? parseFloat(properties.restSpeed)\n : undefined,\n startTime: properties.startTime\n ? parseFloat(properties.startTime)\n : undefined,\n timeConstant: properties.timeConstant\n ? parseFloat(properties.timeConstant)\n : undefined,\n type: (properties.type\n ? properties.type\n : undefined) as AnimationGeneratorType,\n velocity: properties.velocity ? parseFloat(properties.velocity) : undefined,\n visualDuration: properties.visualDuration\n ? parseFloat(properties.visualDuration)\n : undefined,\n } satisfies Transition;\n}\n"]}
|
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
-
import { AnimationPlaybackControlsWithThen } from 'motion';
|
|
3
|
+
import { AnimationGeneratorType, AnimationPlaybackControlsWithThen, Easing, RepeatType } from 'motion';
|
|
4
4
|
|
|
5
5
|
export declare function controlsToPromise(controls: AnimationPlaybackControlsWithThen): Promise<unknown>;
|
|
6
6
|
export declare function awaitAllAnimations(promises: AnimationPlaybackControlsWithThen[]): Promise<unknown>;
|
|
7
|
+
export declare function getTransitionConfig(style: CSSStyleDeclaration): {
|
|
8
|
+
bounce: number | undefined;
|
|
9
|
+
bounceDamping: number | undefined;
|
|
10
|
+
bounceStiffness: number | undefined;
|
|
11
|
+
duration: number | undefined;
|
|
12
|
+
damping: number | undefined;
|
|
13
|
+
delay: number | undefined;
|
|
14
|
+
ease: Easing;
|
|
15
|
+
elapsed: number | undefined;
|
|
16
|
+
mass: number | undefined;
|
|
17
|
+
max: number | undefined;
|
|
18
|
+
min: number | undefined;
|
|
19
|
+
power: number | undefined;
|
|
20
|
+
repeat: number | undefined;
|
|
21
|
+
repeatDelay: number | undefined;
|
|
22
|
+
repeatType: RepeatType;
|
|
23
|
+
restDelta: number | undefined;
|
|
24
|
+
restSpeed: number | undefined;
|
|
25
|
+
startTime: number | undefined;
|
|
26
|
+
timeConstant: number | undefined;
|
|
27
|
+
type: AnimationGeneratorType;
|
|
28
|
+
velocity: number | undefined;
|
|
29
|
+
visualDuration: number | undefined;
|
|
30
|
+
};
|
|
7
31
|
|
|
8
32
|
export {};
|
package/dist/main/index.d.ts
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
3
|
import { FocusTrap, Options } from 'focus-trap';
|
|
4
|
-
import { AnimationPlaybackControlsWithThen } from 'motion';
|
|
4
|
+
import { AnimationGeneratorType, AnimationPlaybackControlsWithThen, Easing, RepeatType } from 'motion';
|
|
5
5
|
import { Accessor } from 'solid-js';
|
|
6
6
|
|
|
7
7
|
export declare const createFocusTrap: (element: HTMLElement, options?: Accessor<Options>) => Accessor<FocusTrap>;
|
|
8
8
|
export declare function abortablePromise(promise: Promise<any>, signal: AbortSignal): Promise<unknown>;
|
|
9
9
|
export declare function controlsToPromise(controls: AnimationPlaybackControlsWithThen): Promise<unknown>;
|
|
10
10
|
export declare function awaitAllAnimations(promises: AnimationPlaybackControlsWithThen[]): Promise<unknown>;
|
|
11
|
+
export declare function getTransitionConfig(style: CSSStyleDeclaration): {
|
|
12
|
+
bounce: number | undefined;
|
|
13
|
+
bounceDamping: number | undefined;
|
|
14
|
+
bounceStiffness: number | undefined;
|
|
15
|
+
duration: number | undefined;
|
|
16
|
+
damping: number | undefined;
|
|
17
|
+
delay: number | undefined;
|
|
18
|
+
ease: Easing;
|
|
19
|
+
elapsed: number | undefined;
|
|
20
|
+
mass: number | undefined;
|
|
21
|
+
max: number | undefined;
|
|
22
|
+
min: number | undefined;
|
|
23
|
+
power: number | undefined;
|
|
24
|
+
repeat: number | undefined;
|
|
25
|
+
repeatDelay: number | undefined;
|
|
26
|
+
repeatType: RepeatType;
|
|
27
|
+
restDelta: number | undefined;
|
|
28
|
+
restSpeed: number | undefined;
|
|
29
|
+
startTime: number | undefined;
|
|
30
|
+
timeConstant: number | undefined;
|
|
31
|
+
type: AnimationGeneratorType;
|
|
32
|
+
velocity: number | undefined;
|
|
33
|
+
visualDuration: number | undefined;
|
|
34
|
+
};
|
|
11
35
|
|
|
12
36
|
export {};
|
package/package.json
CHANGED