@yewdiel21/motion-kit 0.15.0 → 0.17.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.
Files changed (85) hide show
  1. package/README.md +25 -0
  2. package/dist/auto/index.d.ts +8 -3
  3. package/dist/auto/index.js +13 -3
  4. package/dist/auto/index.js.map +1 -1
  5. package/dist/{chunk-A6QQCF6V.js → chunk-7IQTMF7Y.js} +1542 -54
  6. package/dist/chunk-7IQTMF7Y.js.map +1 -0
  7. package/dist/{chunk-6IRJYXJU.js → chunk-BZLMCHUD.js} +2 -2
  8. package/dist/{chunk-JXRS3OEA.js → chunk-VJFPTLAK.js} +29 -7
  9. package/dist/chunk-VJFPTLAK.js.map +1 -0
  10. package/dist/css/components/chart.css +7 -0
  11. package/dist/css/components/drilldown-menu.css +130 -0
  12. package/dist/css/components/heatmap-chart.css +7 -0
  13. package/dist/css/components/pie-chart.css +7 -0
  14. package/dist/css/components/radar-chart.css +7 -0
  15. package/dist/css/components/radial-chart.css +16 -2
  16. package/dist/css/components/sankey-chart.css +7 -0
  17. package/dist/css/components/scroll-island.css +3 -0
  18. package/dist/css/components/signature-pad.css +104 -0
  19. package/dist/css/components/voice-message-bubble.css +50 -0
  20. package/dist/css/components/waveform-player.css +36 -0
  21. package/dist/css/components/wheel-picker.css +17 -0
  22. package/dist/elements/index.d.ts +90 -4
  23. package/dist/elements/index.js +290 -8
  24. package/dist/elements/index.js.map +1 -1
  25. package/dist/{reveal-BfyKKsw4.d.ts → engine-Bn6hC87X.d.ts} +206 -1
  26. package/dist/index.css +324 -2
  27. package/dist/index.d.ts +3 -3
  28. package/dist/index.js +13 -3
  29. package/dist/index.js.map +1 -1
  30. package/dist/react/index.d.ts +48 -10
  31. package/dist/react/index.js +240 -10
  32. package/dist/react/index.js.map +1 -1
  33. package/dist/{reduced-6X_bns60.d.ts → reduced-YS6TZjpa.d.ts} +1 -1
  34. package/dist/{store-CA2Qcun_.d.ts → store-CZ6vdtIE.d.ts} +5 -1
  35. package/package.json +110 -110
  36. package/registry.json +64 -0
  37. package/src/auto/auto-init.ts +308 -293
  38. package/src/components/add-to-cart/README.md +49 -34
  39. package/src/components/add-to-cart/react.tsx +4 -0
  40. package/src/components/chart/README.md +49 -34
  41. package/src/components/chart/chart.css +7 -0
  42. package/src/components/chart/element.ts +2 -1
  43. package/src/components/chart/engine.ts +105 -13
  44. package/src/components/chart/react.tsx +2 -2
  45. package/src/components/drilldown-menu/README.md +163 -0
  46. package/src/components/drilldown-menu/drilldown-menu.css +129 -0
  47. package/src/components/drilldown-menu/element.ts +59 -0
  48. package/src/components/drilldown-menu/engine.ts +338 -0
  49. package/src/components/drilldown-menu/react.tsx +76 -0
  50. package/src/components/radial-chart/README.md +10 -0
  51. package/src/components/radial-chart/element.ts +2 -2
  52. package/src/components/radial-chart/engine.ts +33 -6
  53. package/src/components/radial-chart/radial-chart.css +9 -2
  54. package/src/components/radial-chart/react.tsx +2 -2
  55. package/src/components/scroll-island/README.md +44 -34
  56. package/src/components/scroll-island/element.ts +1 -1
  57. package/src/components/scroll-island/engine.ts +25 -3
  58. package/src/components/scroll-island/react.tsx +3 -3
  59. package/src/components/scroll-island/scroll-island.css +3 -0
  60. package/src/components/signature-pad/README.md +97 -0
  61. package/src/components/signature-pad/element.ts +57 -0
  62. package/src/components/signature-pad/engine.ts +437 -0
  63. package/src/components/signature-pad/react.tsx +56 -0
  64. package/src/components/signature-pad/signature-pad.css +103 -0
  65. package/src/components/voice-message-bubble/README.md +31 -0
  66. package/src/components/voice-message-bubble/element.ts +20 -0
  67. package/src/components/voice-message-bubble/engine.ts +68 -0
  68. package/src/components/voice-message-bubble/react.tsx +27 -0
  69. package/src/components/voice-message-bubble/voice-message-bubble.css +12 -0
  70. package/src/components/waveform-player/README.md +30 -0
  71. package/src/components/waveform-player/element.ts +21 -0
  72. package/src/components/waveform-player/engine.ts +261 -0
  73. package/src/components/waveform-player/react.tsx +27 -0
  74. package/src/components/waveform-player/waveform-player.css +35 -0
  75. package/src/components/wheel-picker/README.md +33 -0
  76. package/src/components/wheel-picker/element.ts +18 -0
  77. package/src/components/wheel-picker/engine.ts +210 -0
  78. package/src/components/wheel-picker/react.tsx +32 -0
  79. package/src/components/wheel-picker/wheel-picker.css +16 -0
  80. package/src/elements/index.ts +273 -258
  81. package/src/index.ts +295 -290
  82. package/src/react/index.ts +176 -171
  83. package/dist/chunk-A6QQCF6V.js.map +0 -1
  84. package/dist/chunk-JXRS3OEA.js.map +0 -1
  85. /package/dist/{chunk-6IRJYXJU.js.map → chunk-BZLMCHUD.js.map} +0 -0
@@ -17,7 +17,7 @@ import {
17
17
  createVoiceDots,
18
18
  iconSvg,
19
19
  toast
20
- } from "../chunk-JXRS3OEA.js";
20
+ } from "../chunk-VJFPTLAK.js";
21
21
  import {
22
22
  createActivityFeed,
23
23
  createAddToCart,
@@ -40,6 +40,7 @@ import {
40
40
  createDateTimePicker,
41
41
  createDialog,
42
42
  createDrawer,
43
+ createDrilldownMenu,
43
44
  createEditableTable,
44
45
  createEmptyState,
45
46
  createFileExplorer,
@@ -68,6 +69,7 @@ import {
68
69
  createScratchCard,
69
70
  createScrollIsland,
70
71
  createSelect,
72
+ createSignaturePad,
71
73
  createSkeleton,
72
74
  createSlotPicker,
73
75
  createSplitView,
@@ -82,8 +84,11 @@ import {
82
84
  createTooltip,
83
85
  createTrailer,
84
86
  createTreeView,
85
- createVirtualList
86
- } from "../chunk-A6QQCF6V.js";
87
+ createVirtualList,
88
+ createVoiceMessageBubble,
89
+ createWaveformPlayer,
90
+ createWheelPicker
91
+ } from "../chunk-7IQTMF7Y.js";
87
92
  import "../chunk-RVSKEBIC.js";
88
93
  import "../chunk-DOOMULVV.js";
89
94
  import "../chunk-TGV27ZWM.js";
@@ -927,6 +932,11 @@ var MkChartElement = class extends MkElement {
927
932
  series: "json",
928
933
  points: "json",
929
934
  stacked: "boolean",
935
+ barStyle: "string",
936
+ barTrack: "boolean",
937
+ barFill: "string",
938
+ barWidth: "number",
939
+ curve: "string",
930
940
  label: "string",
931
941
  height: "number",
932
942
  emptyLabel: "string",
@@ -940,7 +950,7 @@ var MkChartElement = class extends MkElement {
940
950
  }
941
951
  attributeChangedCallback(_name, previous, next) {
942
952
  if (previous === next || !this.instance) return;
943
- this.instance.update({ stacked: false, legend: void 0, ...this.options });
953
+ this.instance.update({ stacked: false, barTrack: false, barStyle: void 0, barFill: void 0, barWidth: void 0, curve: void 0, legend: void 0, ...this.options });
944
954
  }
945
955
  update(options) {
946
956
  this.instance?.update(options);
@@ -1881,7 +1891,7 @@ var MkAddToCartElement = class extends MkElement {
1881
1891
 
1882
1892
  // src/components/scroll-island/element.ts
1883
1893
  var MkScrollIslandElement = class extends MkElement {
1884
- static options = { sections: "string", reach: "number", idle: "number", page: "boolean" };
1894
+ static options = { sections: "string", reach: "number", idle: "number", persistent: "boolean", page: "boolean" };
1885
1895
  create(options) {
1886
1896
  return createScrollIsland(options.page ? document.documentElement : this, options);
1887
1897
  }
@@ -2026,13 +2036,13 @@ var MkRadarChartElement = class extends MkElement {
2026
2036
 
2027
2037
  // src/components/radial-chart/element.ts
2028
2038
  var MkRadialChartElement = class extends MkElement {
2029
- static options = { data: "json", max: "number", sweep: "number", size: "number", thickness: "number", label: "string", totalLabel: "string", legend: "boolean", emptyLabel: "string" };
2039
+ static options = { data: "json", max: "number", sweep: "number", size: "number", thickness: "number", segments: "number", center: "string", label: "string", totalLabel: "string", legend: "boolean", emptyLabel: "string" };
2030
2040
  create(options) {
2031
2041
  return createRadialChart(this, options);
2032
2042
  }
2033
2043
  attributeChangedCallback(_name, previous, next) {
2034
2044
  if (previous === next || !this.instance) return;
2035
- this.instance.update({ legend: void 0, max: void 0, ...this.options });
2045
+ this.instance.update({ legend: void 0, max: void 0, segments: 0, center: void 0, ...this.options });
2036
2046
  }
2037
2047
  update(options) {
2038
2048
  this.instance?.update(options);
@@ -2092,6 +2102,263 @@ var MkOrbitMenuElement = class extends MkElement {
2092
2102
  }
2093
2103
  };
2094
2104
 
2105
+ // src/components/signature-pad/element.ts
2106
+ var MkSignaturePadElement = class extends MkElement {
2107
+ static options = {
2108
+ data: "json",
2109
+ label: "string",
2110
+ hint: "string",
2111
+ placeholder: "string",
2112
+ color: "string",
2113
+ width: "number",
2114
+ disabled: "boolean",
2115
+ readOnly: "boolean",
2116
+ toolbar: "boolean",
2117
+ name: "string",
2118
+ historyLimit: "number"
2119
+ };
2120
+ saved;
2121
+ create(options) {
2122
+ return createSignaturePad(this, { ...options, data: options.data ?? this.saved });
2123
+ }
2124
+ attributeChangedCallback(name, previous, next) {
2125
+ if (previous === next || !this.instance || !this.isConnected) return;
2126
+ if (name === "disabled") {
2127
+ this.instance.setDisabled(next !== null && next !== "false");
2128
+ return;
2129
+ }
2130
+ if (name === "read-only") {
2131
+ this.instance.setReadOnly(next !== null && next !== "false");
2132
+ return;
2133
+ }
2134
+ if (name === "data") {
2135
+ try {
2136
+ this.instance.importData(next === null ? { version: 1, strokes: [] } : JSON.parse(next), false);
2137
+ } catch {
2138
+ }
2139
+ return;
2140
+ }
2141
+ this.saved = this.instance.exportData();
2142
+ this.instance.destroy();
2143
+ this.instance = createSignaturePad(this, { ...this.options, data: this.saved });
2144
+ }
2145
+ disconnectedCallback() {
2146
+ this.saved = this.instance?.exportData() ?? this.saved;
2147
+ super.disconnectedCallback();
2148
+ }
2149
+ connectedCallback() {
2150
+ if (!this.instance) this.instance = createSignaturePad(this, { ...this.options, data: this.saved ?? this.options.data });
2151
+ }
2152
+ get data() {
2153
+ if (this.instance) return this.instance.exportData();
2154
+ return this.saved ? { version: 1, strokes: this.saved.strokes.map((stroke) => ({ ...stroke, points: stroke.points.map((point) => ({ ...point })) })) } : { version: 1, strokes: [] };
2155
+ }
2156
+ set data(value) {
2157
+ this.importData(value);
2158
+ }
2159
+ get isEmpty() {
2160
+ return this.instance?.isEmpty ?? !this.saved?.strokes.length;
2161
+ }
2162
+ get canUndo() {
2163
+ return this.instance?.canUndo ?? false;
2164
+ }
2165
+ get canRedo() {
2166
+ return this.instance?.canRedo ?? false;
2167
+ }
2168
+ undo() {
2169
+ this.instance?.undo();
2170
+ }
2171
+ redo() {
2172
+ this.instance?.redo();
2173
+ }
2174
+ clear() {
2175
+ this.instance?.clear();
2176
+ }
2177
+ importData(value, notify = true) {
2178
+ return this.instance?.importData(value, notify) ?? false;
2179
+ }
2180
+ exportData() {
2181
+ return this.instance?.exportData() ?? this.data;
2182
+ }
2183
+ exportSVG(options) {
2184
+ return this.instance?.exportSVG(options) ?? "";
2185
+ }
2186
+ exportPNG(options) {
2187
+ return this.instance?.exportPNG(options) ?? Promise.resolve(null);
2188
+ }
2189
+ };
2190
+ var defineSignaturePad = () => defineElement("mk-signature-pad", MkSignaturePadElement);
2191
+
2192
+ // src/components/waveform-player/element.ts
2193
+ var MkWaveformPlayerElement = class _MkWaveformPlayerElement extends MkElement {
2194
+ static options = { src: "string", peaks: "json", label: "string", disabled: "boolean", playbackRates: "json" };
2195
+ create(options) {
2196
+ return createWaveformPlayer(this, options);
2197
+ }
2198
+ play() {
2199
+ return this.instance?.play() ?? Promise.resolve(false);
2200
+ }
2201
+ pause() {
2202
+ this.instance?.pause();
2203
+ }
2204
+ seek(seconds) {
2205
+ this.instance?.seek(seconds);
2206
+ }
2207
+ update(options) {
2208
+ this.instance?.update(options);
2209
+ }
2210
+ get state() {
2211
+ return this.instance?.state;
2212
+ }
2213
+ get audio() {
2214
+ return this.instance?.audio ?? null;
2215
+ }
2216
+ attributeChangedCallback(name, previous, next) {
2217
+ if (previous === next || !this.instance) return;
2218
+ const option = name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
2219
+ if (!Object.hasOwn(_MkWaveformPlayerElement.options, option)) return;
2220
+ this.instance.update({ [option]: this.options[option] });
2221
+ }
2222
+ };
2223
+ var defineWaveformPlayer = () => defineElement("mk-waveform-player", MkWaveformPlayerElement);
2224
+
2225
+ // src/components/voice-message-bubble/element.ts
2226
+ var MkVoiceMessageBubbleElement = class _MkVoiceMessageBubbleElement extends MkElement {
2227
+ static options = { src: "string", peaks: "json", label: "string", disabled: "boolean", playbackRates: "json", direction: "string", author: "string", timestamp: "string", dateTime: "string", status: "string" };
2228
+ create(options) {
2229
+ return createVoiceMessageBubble(this, options);
2230
+ }
2231
+ play() {
2232
+ return this.instance?.play() ?? Promise.resolve(false);
2233
+ }
2234
+ pause() {
2235
+ this.instance?.pause();
2236
+ }
2237
+ seek(seconds) {
2238
+ this.instance?.seek(seconds);
2239
+ }
2240
+ update(options) {
2241
+ this.instance?.update(options);
2242
+ }
2243
+ get state() {
2244
+ return this.instance?.state;
2245
+ }
2246
+ get audio() {
2247
+ return this.instance?.audio ?? null;
2248
+ }
2249
+ attributeChangedCallback(name, previous, next) {
2250
+ if (previous === next || !this.instance) return;
2251
+ const option = name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
2252
+ if (!Object.hasOwn(_MkVoiceMessageBubbleElement.options, option)) return;
2253
+ this.instance.update({ [option]: this.options[option] });
2254
+ }
2255
+ };
2256
+ var defineVoiceMessageBubble = () => defineElement("mk-voice-message-bubble", MkVoiceMessageBubbleElement);
2257
+
2258
+ // src/components/drilldown-menu/element.ts
2259
+ var MkDrilldownMenuElement = class extends MkElement {
2260
+ static options = { items: "json", path: "json", label: "string", backLabel: "string", emptyText: "string" };
2261
+ pendingItems;
2262
+ pendingPath;
2263
+ create(options) {
2264
+ return createDrilldownMenu(this, {
2265
+ ...options,
2266
+ ...this.pendingItems !== void 0 ? { items: this.pendingItems } : {},
2267
+ ...this.pendingPath !== void 0 ? { path: this.pendingPath } : {}
2268
+ });
2269
+ }
2270
+ attributeChangedCallback(name, previous, next) {
2271
+ if (previous === next) return;
2272
+ if (name === "items" || name === "path") {
2273
+ try {
2274
+ const value = JSON.parse(next ?? "[]");
2275
+ if (!Array.isArray(value)) return;
2276
+ if (name === "items") {
2277
+ this.pendingItems = value;
2278
+ this.instance?.setItems(this.pendingItems);
2279
+ } else {
2280
+ this.pendingPath = value;
2281
+ this.instance?.setPath(this.pendingPath);
2282
+ }
2283
+ } catch {
2284
+ }
2285
+ } else if (this.instance) {
2286
+ const { label, backLabel, emptyText } = this.options;
2287
+ this.instance.update({ label, backLabel, emptyText });
2288
+ }
2289
+ }
2290
+ get items() {
2291
+ return this.pendingItems ?? this.options.items ?? [];
2292
+ }
2293
+ set items(items) {
2294
+ this.pendingItems = items;
2295
+ this.instance?.setItems(items);
2296
+ }
2297
+ get path() {
2298
+ return this.instance?.path ?? this.pendingPath ?? this.options.path ?? [];
2299
+ }
2300
+ set path(path) {
2301
+ this.pendingPath = path;
2302
+ this.instance?.setPath(path);
2303
+ }
2304
+ open(id) {
2305
+ return this.instance?.open(id) ?? false;
2306
+ }
2307
+ back() {
2308
+ return this.instance?.back() ?? false;
2309
+ }
2310
+ root() {
2311
+ this.instance?.root();
2312
+ }
2313
+ reset() {
2314
+ this.instance?.reset();
2315
+ }
2316
+ setItems(items) {
2317
+ this.items = items;
2318
+ }
2319
+ setPath(path) {
2320
+ this.path = path;
2321
+ }
2322
+ focusItem(id) {
2323
+ this.instance?.focusItem(id);
2324
+ }
2325
+ };
2326
+ var defineDrilldownMenu = () => defineElement("mk-drilldown-menu", MkDrilldownMenuElement);
2327
+
2328
+ // src/components/wheel-picker/element.ts
2329
+ var MkWheelPickerElement = class extends MkElement {
2330
+ static options = { items: "json", value: "string", name: "string", label: "string", disabled: "boolean", visibleItems: "number", itemHeight: "number" };
2331
+ create(options) {
2332
+ return createWheelPicker(this, options);
2333
+ }
2334
+ attributeChangedCallback(name, previous, next) {
2335
+ if (previous === next || !this.instance) return;
2336
+ if (name === "value" && next !== null) {
2337
+ this.instance.setValue(next);
2338
+ return;
2339
+ }
2340
+ if (name === "items") {
2341
+ this.instance.setItems(this.options.items ?? []);
2342
+ if (this.options.value !== void 0) this.instance.setValue(String(this.options.value));
2343
+ return;
2344
+ }
2345
+ super.attributeChangedCallback(name, previous, next);
2346
+ }
2347
+ get value() {
2348
+ return this.instance?.value ?? "";
2349
+ }
2350
+ set value(next) {
2351
+ this.setAttribute("value", next);
2352
+ }
2353
+ setValue(value, notify = false) {
2354
+ this.instance?.setValue(value, notify);
2355
+ }
2356
+ setItems(items, notify = false) {
2357
+ this.instance?.setItems(items, notify);
2358
+ }
2359
+ };
2360
+ var defineWheelPicker = () => defineElement("mk-wheel-picker", MkWheelPickerElement);
2361
+
2095
2362
  // src/elements/index.ts
2096
2363
  var ELEMENTS = {
2097
2364
  "mk-theme-picker": MkThemePickerElement,
@@ -2173,7 +2440,12 @@ var ELEMENTS = {
2173
2440
  "mk-radial-chart": MkRadialChartElement,
2174
2441
  "mk-sankey-chart": MkSankeyChartElement,
2175
2442
  "mk-heatmap-chart": MkHeatmapChartElement,
2176
- "mk-orbit-menu": MkOrbitMenuElement
2443
+ "mk-orbit-menu": MkOrbitMenuElement,
2444
+ "mk-signature-pad": MkSignaturePadElement,
2445
+ "mk-waveform-player": MkWaveformPlayerElement,
2446
+ "mk-voice-message-bubble": MkVoiceMessageBubbleElement,
2447
+ "mk-drilldown-menu": MkDrilldownMenuElement,
2448
+ "mk-wheel-picker": MkWheelPickerElement
2177
2449
  // new-component:entries
2178
2450
  };
2179
2451
  function defineElements(names = Object.keys(ELEMENTS)) {
@@ -2205,6 +2477,7 @@ export {
2205
2477
  MkDateTimePickerElement,
2206
2478
  MkDialogElement,
2207
2479
  MkDrawerElement,
2480
+ MkDrilldownMenuElement,
2208
2481
  MkEditableTableElement,
2209
2482
  MkElement,
2210
2483
  MkEmptyStateElement,
@@ -2243,6 +2516,7 @@ export {
2243
2516
  MkScratchCardElement,
2244
2517
  MkScrollIslandElement,
2245
2518
  MkSelectElement,
2519
+ MkSignaturePadElement,
2246
2520
  MkSkeletonElement,
2247
2521
  MkSlotPickerElement,
2248
2522
  MkSplitViewElement,
@@ -2262,11 +2536,19 @@ export {
2262
2536
  MkTreeViewElement,
2263
2537
  MkVirtualListElement,
2264
2538
  MkVoiceDotsElement,
2539
+ MkVoiceMessageBubbleElement,
2540
+ MkWaveformPlayerElement,
2541
+ MkWheelPickerElement,
2265
2542
  SafeHTMLElement,
2543
+ defineDrilldownMenu,
2266
2544
  defineElement,
2267
2545
  defineElements,
2546
+ defineSignaturePad,
2268
2547
  defineStudioDock,
2269
2548
  defineTrailer,
2549
+ defineVoiceMessageBubble,
2550
+ defineWaveformPlayer,
2551
+ defineWheelPicker,
2270
2552
  toast
2271
2553
  };
2272
2554
  //# sourceMappingURL=index.js.map