morphicons 1.7.1 → 2.0.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "morphicons",
3
- "version": "1.7.1",
4
- "description": "Universal morphing for stroke-based icons with spring physics — zero runtime dependencies",
3
+ "version": "2.0.1",
4
+ "description": "Universal morphing for SVG icons, stroked or filled, with spring physics and zero runtime dependencies",
5
5
  "license": "MIT",
6
6
  "author": "Guillermo (https://guillermolg.com)",
7
7
  "homepage": "https://www.morphicons.com",
@@ -59,6 +59,10 @@
59
59
  "types": "./dist/adapters.d.ts",
60
60
  "default": "./dist/adapters.js"
61
61
  },
62
+ "./region": {
63
+ "types": "./dist/region.d.ts",
64
+ "default": "./dist/region.js"
65
+ },
62
66
  "./react": {
63
67
  "types": "./dist/react.d.ts",
64
68
  "default": "./dist/react.js"
@@ -116,6 +120,10 @@
116
120
  "test": "bun test",
117
121
  "typecheck": "tsc --noEmit && tsc -p playground --noEmit && tsc -p tsconfig.react.json --noEmit && tsc -p tsconfig.react-native.json --noEmit && tsc -p tsconfig.vue.json --noEmit && tsc -p tsconfig.svelte.json --noEmit && tsc -p tsconfig.element.json --noEmit",
118
122
  "play": "bun ./playground/index.html",
123
+ "play:regions": "bun scripts/serve-regions.ts",
124
+ "bench:regions": "bun bench/region.bench.ts",
125
+ "bench:topology": "bun bench/region-topology.ts",
126
+ "bench:wide": "bun bench/region-wide.ts",
119
127
  "lint": "biome check .",
120
128
  "format": "biome check --write .",
121
129
  "build": "tsdown && bun scripts/build-svelte.ts && bun scripts/build-astro.ts",
@@ -134,21 +142,31 @@
134
142
  "name": "core + dom (createMorph + scheduler)",
135
143
  "path": "dist/dom.js",
136
144
  "import": "*",
137
- "limit": "7.5 KB",
145
+ "limit": "9.3 KB",
146
+ "gzip": true,
147
+ "ignore": [
148
+ "./region.js"
149
+ ]
150
+ },
151
+ {
152
+ "name": "region normalizer (morphicons/region standalone; lazy chunk of every binding)",
153
+ "path": "dist/region.js",
154
+ "import": "*",
155
+ "limit": "11.2 KB",
138
156
  "gzip": true
139
157
  },
140
158
  {
141
159
  "name": "adapters (aggregate — grows by design, see per-export gates)",
142
160
  "path": "dist/adapters.js",
143
161
  "import": "*",
144
- "limit": "4.8 KB",
162
+ "limit": "5.7 KB",
145
163
  "gzip": true
146
164
  },
147
165
  {
148
166
  "name": "adapters › svgToIcon (per-export shakeability gate)",
149
167
  "path": "dist/adapters.js",
150
168
  "import": "{ svgToIcon }",
151
- "limit": "3.7 KB",
169
+ "limit": "4.7 KB",
152
170
  "gzip": true
153
171
  },
154
172
  {
@@ -170,21 +188,16 @@
170
188
  "path": "dist/react.js",
171
189
  "import": "*",
172
190
  "ignore": [
173
- "react"
191
+ "./region.js"
174
192
  ],
175
- "limit": "8.5 KB",
193
+ "limit": "10.3 KB",
176
194
  "gzip": true
177
195
  },
178
196
  {
179
- "name": "core + dom + react-native (MorphIcon, react/rn/rnsvg external)",
197
+ "name": "core + dom + react-native (MorphIcon, react/rn/rnsvg external; Metro inlines the region chunk)",
180
198
  "path": "dist/react-native.js",
181
199
  "import": "*",
182
- "ignore": [
183
- "react",
184
- "react-native",
185
- "react-native-svg"
186
- ],
187
- "limit": "9 KB",
200
+ "limit": "16 KB",
188
201
  "gzip": true
189
202
  },
190
203
  {
@@ -192,9 +205,9 @@
192
205
  "path": "dist/vue.js",
193
206
  "import": "*",
194
207
  "ignore": [
195
- "vue"
208
+ "./region.js"
196
209
  ],
197
- "limit": "8.5 KB",
210
+ "limit": "10.3 KB",
198
211
  "gzip": true
199
212
  },
200
213
  {
@@ -202,9 +215,9 @@
202
215
  "path": "dist/svelte-shared.js",
203
216
  "import": "*",
204
217
  "ignore": [
205
- "svelte"
218
+ "./region.js"
206
219
  ],
207
- "limit": "8 KB",
220
+ "limit": "9.9 KB",
208
221
  "gzip": true
209
222
  },
210
223
  {
@@ -220,8 +233,11 @@
220
233
  "name": "core + dom + element (<morph-icon> custom element)",
221
234
  "path": "dist/element.js",
222
235
  "import": "*",
223
- "limit": "9.5 KB",
224
- "gzip": true
236
+ "limit": "11.2 KB",
237
+ "gzip": true,
238
+ "ignore": [
239
+ "./region.js"
240
+ ]
225
241
  },
226
242
  {
227
243
  "name": "astro shell (ships as source, consumer-compiled)",
@@ -234,24 +250,34 @@
234
250
  }
235
251
  ],
236
252
  "devDependencies": {
237
- "@biomejs/biome": "^2.5.6",
238
- "@happy-dom/global-registrator": "^20.11.1",
239
- "@size-limit/preset-small-lib": "^13.0.3",
240
- "@tabler/icons": "^3.46.0",
241
- "@types/bun": "^1.3.14",
242
- "@types/react": "^19.2.18",
243
- "@types/react-dom": "^19.2.4",
253
+ "@biomejs/biome": "^2.5.15",
254
+ "@happy-dom/global-registrator": "^20.14.6",
255
+ "@iconify-json/bi": "^1.2.7",
256
+ "@iconify-json/heroicons": "^1.2.3",
257
+ "@iconify-json/iconoir": "^1.2.12",
258
+ "@iconify-json/lucide": "^1.2.144",
259
+ "@iconify-json/material-symbols": "^1.2.95",
260
+ "@iconify-json/mdi": "^1.2.3",
261
+ "@iconify-json/mingcute": "^1.2.8",
262
+ "@iconify-json/ph": "^1.2.2",
263
+ "@iconify-json/ri": "^1.2.10",
264
+ "@iconify-json/tabler": "^1.2.42",
265
+ "@size-limit/preset-small-lib": "^13.1.1",
266
+ "@tabler/icons": "^3.49.0",
267
+ "@types/bun": "^1.4.3",
268
+ "@types/react": "^19.3.0",
269
+ "@types/react-dom": "^19.3.0",
244
270
  "feather-icons": "^4.29.2",
245
- "happy-dom": "^20.11.1",
246
- "lucide": "^1.28.0",
247
- "react": "^19.2.8",
248
- "react-dom": "^19.2.8",
249
- "react-native": "^0.86.2",
271
+ "happy-dom": "^20.14.6",
272
+ "lucide": "^1.57.0",
273
+ "react": "^19.3.1",
274
+ "react-dom": "^19.3.1",
275
+ "react-native": "^0.87.1",
250
276
  "react-native-svg": "^15.15.5",
251
- "size-limit": "^13.0.3",
252
- "svelte": "^5.56.8",
253
- "tsdown": "^0.22.14",
277
+ "size-limit": "^13.1.1",
278
+ "svelte": "^5.57.2",
279
+ "tsdown": "^0.23.1",
254
280
  "typescript": "^7.0.2",
255
- "vue": "^3.5.40"
281
+ "vue": "^3.5.44"
256
282
  }
257
283
  }
@@ -1,60 +0,0 @@
1
- //#region src/core/spring.d.ts
2
- declare class Spring {
3
- x: number;
4
- v: number;
5
- k: number;
6
- c: number;
7
- config(k: number, c: number): void;
8
- /** Starts (or restarts mid-flight) preserving velocity. */
9
- start(): void;
10
- /** Advances dt seconds. Returns true on settle (|1−x| < 0.001 ∧ |v| < 0.02). */
11
- step(dt: number): boolean;
12
- }
13
- /** Spring presets (ζ = c/(2√k)) with the API's public names. */
14
- declare const SPRING_PRESETS: {
15
- /** ζ = 1.00 — critically damped, no overshoot. */
16
- readonly smooth: {
17
- readonly k: 170;
18
- readonly c: 26;
19
- };
20
- /** ζ = 0.73 — fast, subtle overshoot. */
21
- readonly snappy: {
22
- readonly k: 420;
23
- readonly c: 30;
24
- };
25
- /** ζ = 0.40 — playful. */
26
- readonly bouncy: {
27
- readonly k: 300;
28
- readonly c: 14;
29
- };
30
- };
31
- type SpringPreset = keyof typeof SPRING_PRESETS;
32
- //#endregion
33
- //#region src/core/types.d.ts
34
- /** Attributes of an icon node (values as Lucide exports them: string or
35
- * number). `undefined` is allowed on purpose — lucide's SVGProps includes it
36
- * and the runtime treats an undefined attr as absent (fallback). */
37
- type IconNodeAttrs = Record<string, string | number | undefined>;
38
- /** Lucide-style icon data: a `[tag, attrs]` list. Structurally typed —
39
- * Lucide is neither a dependency nor a peer; Feather/Tabler/custom paths
40
- * work just the same. */
41
- type IconNode = ReadonlyArray<readonly [string, IconNodeAttrs]>;
42
- /** Input accepted by the core: an IconNode or a raw `d` attribute.
43
- * (SVGElement is resolved in the dom layer — the core never touches DOM.) */
44
- type IconInput = IconNode | string;
45
- /** Normalized subpath: a chain of cubics packed as points
46
- * [p0, c1, c2, p1, c1', c2', p2, …] → Float64Array of length 2·(3m+1),
47
- * with m = number of segments. Consecutive segments share an endpoint. */
48
- interface CubicPath {
49
- pts: Float64Array;
50
- closed: boolean;
51
- }
52
- /** Subpath sampled at N points by arc length + its topology. It is the
53
- * currency between resample and plan; an intermediate shape (interruption)
54
- * is also a list of Sampled. */
55
- interface Sampled {
56
- pts: Float64Array;
57
- closed: boolean;
58
- }
59
- //#endregion
60
- export { Sampled as a, SpringPreset as c, IconNodeAttrs as i, IconInput as n, SPRING_PRESETS as o, IconNode as r, Spring as s, CubicPath as t };