morphicons 1.4.1 → 1.5.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/README.md +67 -9
- package/dist/MorphIcon.svelte +4 -3
- package/dist/adapters.d.ts +55 -0
- package/dist/adapters.js +139 -0
- package/dist/dom.d.ts +2 -37
- package/dist/dom.js +20 -7
- package/dist/index-DXp5b6BU.d.ts +48 -0
- package/dist/index.js +2 -1
- package/dist/normalize-CYnN3Npw.js +540 -0
- package/dist/react-native.d.ts +7 -2
- package/dist/react-native.js +13 -5
- package/dist/react.d.ts +6 -2
- package/dist/react.js +11 -4
- package/dist/{spring-CBynweFS.js → spring-CFHloqPP.js} +2 -540
- package/dist/svelte-shared.d.ts +11 -6
- package/dist/svelte-shared.js +11 -6
- package/dist/vue.d.ts +17 -2
- package/dist/vue.js +18 -5
- package/package.json +26 -1
package/dist/vue.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { a as buildPlan,
|
|
1
|
+
import { a as buildPlan, c as interpPolar, o as allocOutputs, r as resampleIcon } from "./spring-CFHloqPP.js";
|
|
2
|
+
import { i as serialize } from "./normalize-CYnN3Npw.js";
|
|
2
3
|
import { canonicalD, createMorph } from "./dom.js";
|
|
3
4
|
import { defineComponent, h, onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
|
|
4
5
|
//#region src/vue/index.ts
|
|
@@ -40,6 +41,13 @@ const MorphIcon = defineComponent({
|
|
|
40
41
|
type: [String, Object],
|
|
41
42
|
default: void 0
|
|
42
43
|
},
|
|
44
|
+
/** Reduced-motion policy: "never" (default) animates regardless of the OS
|
|
45
|
+
* setting, "user" honors prefers-reduced-motion (morphs degrade to an
|
|
46
|
+
* instant swap while it is on), "always" always jumps. */
|
|
47
|
+
reducedMotion: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "never"
|
|
50
|
+
},
|
|
43
51
|
size: {
|
|
44
52
|
type: [Number, String],
|
|
45
53
|
default: 24
|
|
@@ -84,7 +92,7 @@ const MorphIcon = defineComponent({
|
|
|
84
92
|
if (morph) return morph;
|
|
85
93
|
const el = pathEl.value;
|
|
86
94
|
if (dead || !el) return null;
|
|
87
|
-
morph = createMorph(el, birth);
|
|
95
|
+
morph = createMorph(el, birth, { reducedMotion: props.reducedMotion });
|
|
88
96
|
return morph;
|
|
89
97
|
};
|
|
90
98
|
onMounted(() => {
|
|
@@ -93,7 +101,7 @@ const MorphIcon = defineComponent({
|
|
|
93
101
|
const controlled = from !== void 0 && to !== void 0;
|
|
94
102
|
const initialIcon = icon ?? from ?? to;
|
|
95
103
|
if (!el || initialIcon === void 0) return;
|
|
96
|
-
const m = createMorph(el, controlled ? from : initialIcon);
|
|
104
|
+
const m = createMorph(el, controlled ? from : initialIcon, { reducedMotion: props.reducedMotion });
|
|
97
105
|
morph = m;
|
|
98
106
|
if (controlled) {
|
|
99
107
|
pair = [from, to];
|
|
@@ -113,6 +121,9 @@ const MorphIcon = defineComponent({
|
|
|
113
121
|
based = false;
|
|
114
122
|
pair = null;
|
|
115
123
|
});
|
|
124
|
+
watch(() => props.reducedMotion, (v) => {
|
|
125
|
+
if (morph) morph.reducedMotion = v;
|
|
126
|
+
});
|
|
116
127
|
watch(() => [
|
|
117
128
|
props.icon,
|
|
118
129
|
props.from,
|
|
@@ -128,8 +139,10 @@ const MorphIcon = defineComponent({
|
|
|
128
139
|
if (icon === void 0 || !changed && !left) return;
|
|
129
140
|
pair = null;
|
|
130
141
|
based = false;
|
|
131
|
-
if (morph)
|
|
132
|
-
|
|
142
|
+
if (morph) {
|
|
143
|
+
morph.reducedMotion = props.reducedMotion;
|
|
144
|
+
morph.morphTo(icon, props.spring);
|
|
145
|
+
} else ensure(icon);
|
|
133
146
|
});
|
|
134
147
|
watch(() => [
|
|
135
148
|
props.from,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "morphicons",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Universal morphing for stroke-based icons with spring physics — zero runtime dependencies",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Guillermo (https://guillermolg.com)",
|
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
"types": "./dist/dom.d.ts",
|
|
52
52
|
"default": "./dist/dom.js"
|
|
53
53
|
},
|
|
54
|
+
"./adapters": {
|
|
55
|
+
"types": "./dist/adapters.d.ts",
|
|
56
|
+
"default": "./dist/adapters.js"
|
|
57
|
+
},
|
|
54
58
|
"./react": {
|
|
55
59
|
"types": "./dist/react.d.ts",
|
|
56
60
|
"default": "./dist/react.js"
|
|
@@ -121,6 +125,27 @@
|
|
|
121
125
|
"limit": "7.5 KB",
|
|
122
126
|
"gzip": true
|
|
123
127
|
},
|
|
128
|
+
{
|
|
129
|
+
"name": "adapters (aggregate — grows by design, see per-export gates)",
|
|
130
|
+
"path": "dist/adapters.js",
|
|
131
|
+
"import": "*",
|
|
132
|
+
"limit": "4.4 KB",
|
|
133
|
+
"gzip": true
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "adapters › svgToIcon (per-export shakeability gate)",
|
|
137
|
+
"path": "dist/adapters.js",
|
|
138
|
+
"import": "{ svgToIcon }",
|
|
139
|
+
"limit": "3.7 KB",
|
|
140
|
+
"gzip": true
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "adapters › maskTarget (per-export shakeability gate)",
|
|
144
|
+
"path": "dist/adapters.js",
|
|
145
|
+
"import": "{ maskTarget }",
|
|
146
|
+
"limit": "0.8 KB",
|
|
147
|
+
"gzip": true
|
|
148
|
+
},
|
|
124
149
|
{
|
|
125
150
|
"name": "core + dom + react (MorphIcon, react external)",
|
|
126
151
|
"path": "dist/react.js",
|