@yewdiel21/motion-kit 0.10.0 → 0.15.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 +81 -0
- package/bin/motion-kit.mjs +3 -3
- package/dist/auto/index.d.ts +56 -3
- package/dist/auto/index.js +107 -3
- package/dist/auto/index.js.map +1 -1
- package/dist/{chunk-XAKC2QY7.js → chunk-6IRJYXJU.js} +3 -28
- package/dist/chunk-6IRJYXJU.js.map +1 -0
- package/dist/chunk-A6QQCF6V.js +21333 -0
- package/dist/chunk-A6QQCF6V.js.map +1 -0
- package/dist/chunk-JXRS3OEA.js +3638 -0
- package/dist/chunk-JXRS3OEA.js.map +1 -0
- package/dist/chunk-QP4QJOEN.js +72 -0
- package/dist/chunk-QP4QJOEN.js.map +1 -0
- package/dist/css/components/activity-feed.css +240 -0
- package/dist/css/components/add-to-cart.css +72 -0
- package/dist/css/components/attachment.css +266 -0
- package/dist/css/components/bidirectional-slider.css +168 -0
- package/dist/css/components/breadcrumb.css +110 -0
- package/dist/css/components/chart-tooltip.css +168 -0
- package/dist/css/components/chart.css +296 -0
- package/dist/css/components/code-block.css +264 -0
- package/dist/css/components/color-area.css +82 -0
- package/dist/css/components/color-field.css +67 -0
- package/dist/css/components/color-picker.css +131 -0
- package/dist/css/components/color-slider.css +113 -0
- package/dist/css/components/command-search.css +252 -0
- package/dist/css/components/context-menu.css +23 -0
- package/dist/css/components/credit-card.css +288 -0
- package/dist/css/components/data-table.css +686 -0
- package/dist/css/components/date-range-picker.css +168 -0
- package/dist/css/components/date-time-picker.css +178 -0
- package/dist/css/components/drawer.css +58 -0
- package/dist/css/components/editable-table.css +201 -0
- package/dist/css/components/empty-state.css +61 -0
- package/dist/css/components/file-explorer.css +633 -0
- package/dist/css/components/filter-builder.css +227 -0
- package/dist/css/components/heatmap-chart.css +391 -0
- package/dist/css/components/hold-confirm.css +87 -0
- package/dist/css/components/hover-card.css +19 -7
- package/dist/css/components/image-preview.css +283 -0
- package/dist/css/components/json-viewer.css +304 -0
- package/dist/css/components/like-button.css +78 -0
- package/dist/css/components/link-preview.css +275 -0
- package/dist/css/components/loading-button.css +77 -0
- package/dist/css/components/multi-select.css +267 -0
- package/dist/css/components/nav.css +102 -102
- package/dist/css/components/notification-bell.css +127 -0
- package/dist/css/components/orbit-menu.css +130 -0
- package/dist/css/components/pagination.css +10 -5
- package/dist/css/components/password-strength.css +183 -0
- package/dist/css/components/pie-chart.css +390 -0
- package/dist/css/components/pill-button.css +135 -0
- package/dist/css/components/popover.css +25 -0
- package/dist/css/components/progress.css +140 -0
- package/dist/css/components/questionnaire.css +217 -0
- package/dist/css/components/radar-chart.css +370 -0
- package/dist/css/components/radial-chart.css +398 -0
- package/dist/css/components/range-calendar.css +186 -0
- package/dist/css/components/range-slider.css +192 -0
- package/dist/css/components/resizable-panel.css +243 -0
- package/dist/css/components/rich-text-editor.css +284 -0
- package/dist/css/components/sankey-chart.css +358 -0
- package/dist/css/components/scratch-card.css +75 -0
- package/dist/css/components/scroll-island.css +111 -0
- package/dist/css/components/select.css +136 -0
- package/dist/css/components/skeleton.css +108 -0
- package/dist/css/components/split-view.css +19 -0
- package/dist/css/components/star-rating.css +80 -0
- package/dist/css/components/stat-card.css +164 -0
- package/dist/css/components/swipe-actions.css +105 -0
- package/dist/css/components/tag-input.css +244 -0
- package/dist/css/components/time-field.css +88 -0
- package/dist/css/components/timeline.css +219 -0
- package/dist/css/components/toolbar.css +122 -0
- package/dist/css/components/tooltip.css +79 -0
- package/dist/css/components/tree-view.css +289 -0
- package/dist/css/components/virtual-list.css +195 -0
- package/dist/css/components/voice-dots.css +70 -0
- package/dist/css/tokens.css +185 -181
- package/dist/elements/index.d.ts +849 -7
- package/dist/elements/index.js +1642 -8
- package/dist/elements/index.js.map +1 -1
- package/dist/{engine-GDGwQnJE.d.ts → engine-5zRIssTO.d.ts} +11 -1
- package/dist/engine-QECQnGz1.d.ts +33 -0
- package/dist/index.css +10890 -311
- package/dist/index.d.ts +89 -5
- package/dist/index.js +273 -9
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.ts +686 -24
- package/dist/react/index.js +2345 -9
- package/dist/react/index.js.map +1 -1
- package/dist/{reduced-BmBzKH94.d.ts → reduced-6X_bns60.d.ts} +9 -2
- package/dist/reveal-BfyKKsw4.d.ts +2474 -0
- package/dist/store-CA2Qcun_.d.ts +453 -0
- package/package.json +9 -16
- package/registry.json +1096 -543
- package/src/auto/auto-init.ts +104 -0
- package/src/components/activity-feed/README.md +56 -0
- package/src/components/activity-feed/activity-feed.css +239 -0
- package/src/components/activity-feed/element.ts +36 -0
- package/src/components/activity-feed/engine.ts +351 -0
- package/src/components/activity-feed/react.tsx +32 -0
- package/src/components/add-to-cart/README.md +34 -0
- package/src/components/add-to-cart/add-to-cart.css +71 -0
- package/src/components/add-to-cart/element.ts +20 -0
- package/src/components/add-to-cart/engine.ts +206 -0
- package/src/components/add-to-cart/react.tsx +29 -0
- package/src/components/attachment/README.md +27 -0
- package/src/components/attachment/attachment.css +265 -0
- package/src/components/attachment/element.ts +50 -0
- package/src/components/attachment/engine.ts +469 -0
- package/src/components/attachment/react.tsx +65 -0
- package/src/components/bidirectional-slider/README.md +46 -0
- package/src/components/bidirectional-slider/bidirectional-slider.css +167 -0
- package/src/components/bidirectional-slider/element.ts +42 -0
- package/src/components/bidirectional-slider/engine.ts +289 -0
- package/src/components/bidirectional-slider/react.tsx +45 -0
- package/src/components/breadcrumb/README.md +38 -0
- package/src/components/breadcrumb/breadcrumb.css +109 -0
- package/src/components/breadcrumb/element.ts +27 -0
- package/src/components/breadcrumb/engine.ts +249 -0
- package/src/components/breadcrumb/react.tsx +30 -0
- package/src/components/chart/README.md +34 -0
- package/src/components/chart/chart.css +295 -0
- package/src/components/chart/element.ts +43 -0
- package/src/components/chart/engine.ts +838 -0
- package/src/components/chart/parts.ts +237 -0
- package/src/components/chart/react.tsx +50 -0
- package/src/components/chart/use-chart.ts +55 -0
- package/src/components/chart-tooltip/README.md +53 -0
- package/src/components/chart-tooltip/chart-tooltip.css +167 -0
- package/src/components/chart-tooltip/element.ts +37 -0
- package/src/components/chart-tooltip/engine.ts +442 -0
- package/src/components/chart-tooltip/react.tsx +47 -0
- package/src/components/code-block/README.md +19 -0
- package/src/components/code-block/code-block.css +263 -0
- package/src/components/code-block/element.ts +34 -0
- package/src/components/code-block/engine.ts +254 -0
- package/src/components/code-block/highlight.ts +244 -0
- package/src/components/code-block/react.tsx +94 -0
- package/src/components/color-area/README.md +50 -0
- package/src/components/color-area/color-area.css +81 -0
- package/src/components/color-area/element.ts +26 -0
- package/src/components/color-area/engine.ts +246 -0
- package/src/components/color-area/react.tsx +42 -0
- package/src/components/color-field/README.md +43 -0
- package/src/components/color-field/color-field.css +66 -0
- package/src/components/color-field/element.ts +26 -0
- package/src/components/color-field/engine.ts +174 -0
- package/src/components/color-field/react.tsx +42 -0
- package/src/components/color-picker/README.md +45 -0
- package/src/components/color-picker/color-picker.css +130 -0
- package/src/components/color-picker/element.ts +45 -0
- package/src/components/color-picker/engine.ts +314 -0
- package/src/components/color-picker/react.tsx +47 -0
- package/src/components/color-slider/README.md +55 -0
- package/src/components/color-slider/color-slider.css +112 -0
- package/src/components/color-slider/element.ts +26 -0
- package/src/components/color-slider/engine.ts +234 -0
- package/src/components/color-slider/react.tsx +45 -0
- package/src/components/command-search/README.md +15 -0
- package/src/components/command-search/command-search.css +251 -0
- package/src/components/command-search/element.ts +36 -0
- package/src/components/command-search/engine.ts +356 -0
- package/src/components/command-search/match.ts +53 -0
- package/src/components/command-search/react.tsx +66 -0
- package/src/components/context-menu/README.md +31 -0
- package/src/components/context-menu/context-menu.css +22 -0
- package/src/components/context-menu/element.ts +40 -0
- package/src/components/context-menu/engine.ts +153 -0
- package/src/components/context-menu/react.tsx +57 -0
- package/src/components/credit-card/README.md +20 -0
- package/src/components/credit-card/card.ts +77 -0
- package/src/components/credit-card/credit-card.css +287 -0
- package/src/components/credit-card/element.ts +33 -0
- package/src/components/credit-card/engine.ts +410 -0
- package/src/components/credit-card/react.tsx +36 -0
- package/src/components/data-table/README.md +83 -0
- package/src/components/data-table/data-table.css +685 -0
- package/src/components/data-table/element.ts +54 -0
- package/src/components/data-table/engine.ts +1111 -0
- package/src/components/data-table/react.tsx +94 -0
- package/src/components/date-range-picker/README.md +51 -0
- package/src/components/date-range-picker/date-range-picker.css +167 -0
- package/src/components/date-range-picker/element.ts +52 -0
- package/src/components/date-range-picker/engine.ts +352 -0
- package/src/components/date-range-picker/react.tsx +57 -0
- package/src/components/date-time-picker/README.md +48 -0
- package/src/components/date-time-picker/date-time-picker.css +177 -0
- package/src/components/date-time-picker/element.ts +47 -0
- package/src/components/date-time-picker/engine.ts +350 -0
- package/src/components/date-time-picker/react.tsx +54 -0
- package/src/components/dialog/README.md +103 -102
- package/src/components/dialog/element.ts +123 -118
- package/src/components/dialog/engine.ts +449 -432
- package/src/components/drawer/README.md +28 -0
- package/src/components/drawer/drawer.css +57 -0
- package/src/components/drawer/element.ts +21 -0
- package/src/components/drawer/engine.ts +56 -0
- package/src/components/drawer/react.tsx +85 -0
- package/src/components/editable-table/README.md +67 -0
- package/src/components/editable-table/editable-table.css +200 -0
- package/src/components/editable-table/element.ts +45 -0
- package/src/components/editable-table/engine.ts +831 -0
- package/src/components/editable-table/react.tsx +79 -0
- package/src/components/empty-state/README.md +41 -0
- package/src/components/empty-state/element.ts +23 -0
- package/src/components/empty-state/empty-state.css +60 -0
- package/src/components/empty-state/engine.ts +232 -0
- package/src/components/empty-state/react.tsx +34 -0
- package/src/components/file-explorer/README.md +67 -0
- package/src/components/file-explorer/element.ts +39 -0
- package/src/components/file-explorer/engine.ts +1307 -0
- package/src/components/file-explorer/file-explorer.css +632 -0
- package/src/components/file-explorer/react.tsx +77 -0
- package/src/components/filter-builder/README.md +47 -0
- package/src/components/filter-builder/element.ts +34 -0
- package/src/components/filter-builder/engine.ts +396 -0
- package/src/components/filter-builder/filter-builder.css +226 -0
- package/src/components/filter-builder/react.tsx +36 -0
- package/src/components/heatmap-chart/README.md +48 -0
- package/src/components/heatmap-chart/element.ts +21 -0
- package/src/components/heatmap-chart/engine.ts +281 -0
- package/src/components/heatmap-chart/heatmap-chart.css +93 -0
- package/src/components/heatmap-chart/react.tsx +14 -0
- package/src/components/hold-confirm/README.md +13 -0
- package/src/components/hold-confirm/element.ts +24 -0
- package/src/components/hold-confirm/engine.ts +216 -0
- package/src/components/hold-confirm/hold-confirm.css +86 -0
- package/src/components/hold-confirm/react.tsx +28 -0
- package/src/components/hover-card/README.md +6 -2
- package/src/components/hover-card/engine.ts +98 -7
- package/src/components/hover-card/hover-card.css +19 -7
- package/src/components/image-preview/README.md +16 -0
- package/src/components/image-preview/element.ts +26 -0
- package/src/components/image-preview/engine.ts +405 -0
- package/src/components/image-preview/image-preview.css +282 -0
- package/src/components/image-preview/react.tsx +43 -0
- package/src/components/json-viewer/README.md +56 -0
- package/src/components/json-viewer/element.ts +37 -0
- package/src/components/json-viewer/engine.ts +449 -0
- package/src/components/json-viewer/json-viewer.css +303 -0
- package/src/components/json-viewer/react.tsx +56 -0
- package/src/components/like-button/README.md +13 -0
- package/src/components/like-button/element.ts +47 -0
- package/src/components/like-button/engine.ts +145 -0
- package/src/components/like-button/like-button.css +77 -0
- package/src/components/like-button/react.tsx +39 -0
- package/src/components/link-preview/README.md +19 -0
- package/src/components/link-preview/element.ts +29 -0
- package/src/components/link-preview/engine.ts +192 -0
- package/src/components/link-preview/link-preview.css +274 -0
- package/src/components/link-preview/react.tsx +101 -0
- package/src/components/loading-button/README.md +45 -0
- package/src/components/loading-button/element.ts +34 -0
- package/src/components/loading-button/engine.ts +201 -0
- package/src/components/loading-button/loading-button.css +76 -0
- package/src/components/loading-button/react.tsx +43 -0
- package/src/components/multi-select/README.md +48 -0
- package/src/components/multi-select/element.ts +28 -0
- package/src/components/multi-select/engine.ts +294 -0
- package/src/components/multi-select/multi-select.css +266 -0
- package/src/components/multi-select/react.tsx +39 -0
- package/src/components/nav/README.md +12 -10
- package/src/components/nav/element.ts +5 -5
- package/src/components/nav/engine.ts +21 -14
- package/src/components/nav/nav.css +102 -102
- package/src/components/nav/react.tsx +4 -4
- package/src/components/notification-bell/README.md +14 -0
- package/src/components/notification-bell/element.ts +48 -0
- package/src/components/notification-bell/engine.ts +202 -0
- package/src/components/notification-bell/notification-bell.css +126 -0
- package/src/components/notification-bell/react.tsx +57 -0
- package/src/components/orbit-menu/README.md +46 -0
- package/src/components/orbit-menu/element.ts +27 -0
- package/src/components/orbit-menu/engine.ts +179 -0
- package/src/components/orbit-menu/orbit-menu.css +129 -0
- package/src/components/orbit-menu/react.tsx +44 -0
- package/src/components/pagination/README.md +1 -1
- package/src/components/pagination/engine.ts +50 -4
- package/src/components/pagination/pagination.css +10 -5
- package/src/components/password-strength/README.md +17 -0
- package/src/components/password-strength/element.ts +22 -0
- package/src/components/password-strength/engine.ts +212 -0
- package/src/components/password-strength/password-strength.css +182 -0
- package/src/components/password-strength/react.tsx +36 -0
- package/src/components/password-strength/score.ts +62 -0
- package/src/components/pie-chart/README.md +48 -0
- package/src/components/pie-chart/element.ts +30 -0
- package/src/components/pie-chart/engine.ts +283 -0
- package/src/components/pie-chart/pie-chart.css +92 -0
- package/src/components/pie-chart/react.tsx +14 -0
- package/src/components/pill-button/README.md +46 -0
- package/src/components/pill-button/element.ts +16 -0
- package/src/components/pill-button/engine.ts +77 -0
- package/src/components/pill-button/pill-button.css +134 -0
- package/src/components/pill-button/react.tsx +32 -0
- package/src/components/popover/README.md +44 -0
- package/src/components/popover/element.ts +31 -0
- package/src/components/popover/engine.ts +114 -0
- package/src/components/popover/popover.css +24 -0
- package/src/components/popover/react.tsx +50 -0
- package/src/components/progress/README.md +17 -0
- package/src/components/progress/element.ts +30 -0
- package/src/components/progress/engine.ts +173 -0
- package/src/components/progress/progress.css +139 -0
- package/src/components/progress/react.tsx +35 -0
- package/src/components/questionnaire/README.md +32 -0
- package/src/components/questionnaire/element.ts +118 -0
- package/src/components/questionnaire/engine.ts +255 -0
- package/src/components/questionnaire/questionnaire.css +216 -0
- package/src/components/questionnaire/react.tsx +140 -0
- package/src/components/radar-chart/README.md +48 -0
- package/src/components/radar-chart/element.ts +30 -0
- package/src/components/radar-chart/engine.ts +327 -0
- package/src/components/radar-chart/radar-chart.css +72 -0
- package/src/components/radar-chart/react.tsx +14 -0
- package/src/components/radial-chart/README.md +48 -0
- package/src/components/radial-chart/element.ts +30 -0
- package/src/components/radial-chart/engine.ts +290 -0
- package/src/components/radial-chart/radial-chart.css +100 -0
- package/src/components/radial-chart/react.tsx +14 -0
- package/src/components/range-calendar/README.md +58 -0
- package/src/components/range-calendar/element.ts +42 -0
- package/src/components/range-calendar/engine.ts +390 -0
- package/src/components/range-calendar/range-calendar.css +185 -0
- package/src/components/range-calendar/react.tsx +56 -0
- package/src/components/range-slider/README.md +23 -0
- package/src/components/range-slider/element.ts +53 -0
- package/src/components/range-slider/engine.ts +316 -0
- package/src/components/range-slider/range-slider.css +191 -0
- package/src/components/range-slider/react.tsx +66 -0
- package/src/components/resizable-panel/README.md +61 -0
- package/src/components/resizable-panel/element.ts +36 -0
- package/src/components/resizable-panel/engine.ts +551 -0
- package/src/components/resizable-panel/react.tsx +74 -0
- package/src/components/resizable-panel/resizable-panel.css +242 -0
- package/src/components/rich-text-editor/README.md +57 -0
- package/src/components/rich-text-editor/element.ts +34 -0
- package/src/components/rich-text-editor/engine.ts +673 -0
- package/src/components/rich-text-editor/react.tsx +60 -0
- package/src/components/rich-text-editor/rich-text-editor.css +283 -0
- package/src/components/sankey-chart/README.md +48 -0
- package/src/components/sankey-chart/element.ts +31 -0
- package/src/components/sankey-chart/engine.ts +401 -0
- package/src/components/sankey-chart/react.tsx +14 -0
- package/src/components/sankey-chart/sankey-chart.css +60 -0
- package/src/components/scratch-card/README.md +15 -0
- package/src/components/scratch-card/element.ts +30 -0
- package/src/components/scratch-card/engine.ts +257 -0
- package/src/components/scratch-card/react.tsx +40 -0
- package/src/components/scratch-card/scratch-card.css +74 -0
- package/src/components/scroll-island/README.md +34 -0
- package/src/components/scroll-island/element.ts +16 -0
- package/src/components/scroll-island/engine.ts +252 -0
- package/src/components/scroll-island/react.tsx +26 -0
- package/src/components/scroll-island/scroll-island.css +110 -0
- package/src/components/select/README.md +34 -0
- package/src/components/select/element.ts +26 -0
- package/src/components/select/engine.ts +267 -0
- package/src/components/select/react.tsx +33 -0
- package/src/components/select/select.css +135 -0
- package/src/components/skeleton/README.md +15 -0
- package/src/components/skeleton/element.ts +32 -0
- package/src/components/skeleton/engine.ts +104 -0
- package/src/components/skeleton/react.tsx +41 -0
- package/src/components/skeleton/skeleton.css +107 -0
- package/src/components/split-view/README.md +50 -0
- package/src/components/split-view/element.ts +34 -0
- package/src/components/split-view/engine.ts +114 -0
- package/src/components/split-view/react.tsx +63 -0
- package/src/components/split-view/split-view.css +18 -0
- package/src/components/star-rating/README.md +14 -0
- package/src/components/star-rating/element.ts +26 -0
- package/src/components/star-rating/engine.ts +217 -0
- package/src/components/star-rating/react.tsx +33 -0
- package/src/components/star-rating/star-rating.css +79 -0
- package/src/components/stat-card/README.md +42 -0
- package/src/components/stat-card/element.ts +40 -0
- package/src/components/stat-card/engine.ts +283 -0
- package/src/components/stat-card/react.tsx +36 -0
- package/src/components/stat-card/stat-card.css +163 -0
- package/src/components/swipe-actions/README.md +19 -0
- package/src/components/swipe-actions/element.ts +26 -0
- package/src/components/swipe-actions/engine.ts +260 -0
- package/src/components/swipe-actions/react.tsx +80 -0
- package/src/components/swipe-actions/swipe-actions.css +104 -0
- package/src/components/tag-input/README.md +42 -0
- package/src/components/tag-input/element.ts +39 -0
- package/src/components/tag-input/engine.ts +313 -0
- package/src/components/tag-input/react.tsx +54 -0
- package/src/components/tag-input/tag-input.css +243 -0
- package/src/components/time-field/README.md +54 -0
- package/src/components/time-field/element.ts +38 -0
- package/src/components/time-field/engine.ts +110 -0
- package/src/components/time-field/react.tsx +45 -0
- package/src/components/time-field/time-field.css +87 -0
- package/src/components/timeline/README.md +57 -0
- package/src/components/timeline/element.ts +31 -0
- package/src/components/timeline/engine.ts +300 -0
- package/src/components/timeline/react.tsx +59 -0
- package/src/components/timeline/timeline.css +218 -0
- package/src/components/toolbar/README.md +46 -0
- package/src/components/toolbar/element.ts +30 -0
- package/src/components/toolbar/engine.ts +230 -0
- package/src/components/toolbar/react.tsx +34 -0
- package/src/components/toolbar/toolbar.css +121 -0
- package/src/components/tooltip/README.md +46 -0
- package/src/components/tooltip/element.ts +22 -0
- package/src/components/tooltip/engine.ts +288 -0
- package/src/components/tooltip/react.tsx +30 -0
- package/src/components/tooltip/tooltip.css +78 -0
- package/src/components/tree-view/README.md +61 -0
- package/src/components/tree-view/element.ts +32 -0
- package/src/components/tree-view/engine.ts +743 -0
- package/src/components/tree-view/react.tsx +82 -0
- package/src/components/tree-view/tree-view.css +288 -0
- package/src/components/virtual-list/README.md +81 -0
- package/src/components/virtual-list/element.ts +42 -0
- package/src/components/virtual-list/engine.ts +678 -0
- package/src/components/virtual-list/react.tsx +101 -0
- package/src/components/virtual-list/virtual-list.css +194 -0
- package/src/components/voice-dots/README.md +48 -0
- package/src/components/voice-dots/element.ts +45 -0
- package/src/components/voice-dots/engine.ts +243 -0
- package/src/components/voice-dots/react.tsx +52 -0
- package/src/components/voice-dots/voice-dots.css +69 -0
- package/src/core/chips.ts +196 -0
- package/src/core/color.ts +304 -0
- package/src/core/date-range.ts +67 -0
- package/src/core/dates.ts +11 -1
- package/src/core/files.ts +107 -0
- package/src/core/filter.ts +229 -0
- package/src/core/gsap.ts +80 -65
- package/src/core/listbox.ts +332 -0
- package/src/core/mark.ts +29 -0
- package/src/core/position.ts +89 -0
- package/src/core/relative-time.ts +77 -0
- package/src/core/segment-field.ts +373 -0
- package/src/core/segments.ts +153 -0
- package/src/core/tree.ts +116 -0
- package/src/core/virtual.ts +79 -0
- package/src/css/tokens.css +186 -182
- package/src/elements/index.ts +186 -0
- package/src/index.ts +88 -0
- package/src/motion/liquid.ts +14 -4
- package/src/motion/micro.ts +248 -0
- package/src/motion/sheet.ts +88 -65
- package/src/motion/surface.ts +9 -0
- package/src/react/index.ts +71 -1
- package/dist/chunk-IKQ5FODN.js +0 -1617
- package/dist/chunk-IKQ5FODN.js.map +0 -1
- package/dist/chunk-J6OCFNGU.js +0 -177
- package/dist/chunk-J6OCFNGU.js.map +0 -1
- package/dist/chunk-TFNRIZHU.js +0 -3977
- package/dist/chunk-TFNRIZHU.js.map +0 -1
- package/dist/chunk-XAKC2QY7.js.map +0 -1
- package/dist/reveal-jsX-uwUz.d.ts +0 -625
- package/dist/store-DYb3tTsZ.d.ts +0 -195
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { toTime, type TimeInput } from './relative-time';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Files (file-explorer), the pure part: what is a folder, the family an
|
|
5
|
+
* extension belongs to (its colour), sizes in KB and MB, a free name in a
|
|
6
|
+
* folder ("Nueva carpeta (2)") and the order of a folder's content (folders
|
|
7
|
+
* first, then by name, size or date; numbers in names in their natural order).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export interface FileEntry {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
/** 'folder' or 'file'; without it, an entry with children is a folder. */
|
|
14
|
+
kind?: 'folder' | 'file';
|
|
15
|
+
children?: FileEntry[];
|
|
16
|
+
/** Bytes. */
|
|
17
|
+
size?: number;
|
|
18
|
+
modified?: TimeInput;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type FileFamily = 'folder' | 'image' | 'pdf' | 'doc' | 'sheet' | 'slides' | 'code' | 'archive' | 'media' | 'other';
|
|
22
|
+
export type FileSort = 'name' | 'size' | 'modified';
|
|
23
|
+
|
|
24
|
+
export const isFolder = (entry: FileEntry) => (entry.kind ? entry.kind === 'folder' : Array.isArray(entry.children));
|
|
25
|
+
|
|
26
|
+
/** "pdf" for "Informe.PDF"; '' without one (".gitignore" has none). */
|
|
27
|
+
export function extensionOf(name: string): string {
|
|
28
|
+
const dot = name.lastIndexOf('.');
|
|
29
|
+
return dot > 0 && dot < name.length - 1 ? name.slice(dot + 1).toLowerCase() : '';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const FAMILIES: Record<Exclude<FileFamily, 'folder' | 'other'>, string[]> = {
|
|
33
|
+
image: ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'avif', 'heic', 'bmp', 'ico', 'fig', 'psd', 'ai', 'sketch'],
|
|
34
|
+
pdf: ['pdf'],
|
|
35
|
+
doc: ['doc', 'docx', 'txt', 'md', 'rtf', 'odt', 'pages'],
|
|
36
|
+
sheet: ['xls', 'xlsx', 'csv', 'numbers', 'ods'],
|
|
37
|
+
slides: ['ppt', 'pptx', 'key', 'odp'],
|
|
38
|
+
code: ['js', 'mjs', 'cjs', 'ts', 'tsx', 'jsx', 'json', 'css', 'scss', 'html', 'astro', 'vue', 'svelte', 'py', 'rb', 'go', 'rs', 'java', 'c', 'cpp', 'h', 'php', 'sh', 'sql', 'xml', 'yml', 'yaml', 'toml'],
|
|
39
|
+
archive: ['zip', 'rar', '7z', 'tar', 'gz', 'tgz', 'bz2'],
|
|
40
|
+
media: ['mp3', 'wav', 'ogg', 'flac', 'm4a', 'mp4', 'mov', 'avi', 'mkv', 'webm'],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export function fileFamily(entry: FileEntry): FileFamily {
|
|
44
|
+
if (isFolder(entry)) return 'folder';
|
|
45
|
+
const extension = extensionOf(entry.name);
|
|
46
|
+
for (const [family, extensions] of Object.entries(FAMILIES)) if (extensions.includes(extension)) return family as FileFamily;
|
|
47
|
+
return 'other';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** "820 B", "12 KB", "3,4 MB" (in the given language). */
|
|
51
|
+
export function formatSize(bytes: number, locale = 'es'): string {
|
|
52
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
53
|
+
let value = Math.max(0, bytes);
|
|
54
|
+
let unit = 0;
|
|
55
|
+
while (value >= 1024 && unit < units.length - 1) {
|
|
56
|
+
value /= 1024;
|
|
57
|
+
unit++;
|
|
58
|
+
}
|
|
59
|
+
let format: Intl.NumberFormat;
|
|
60
|
+
try {
|
|
61
|
+
format = new Intl.NumberFormat(locale, { maximumFractionDigits: unit && value < 10 ? 1 : 0 });
|
|
62
|
+
} catch {
|
|
63
|
+
format = new Intl.NumberFormat(undefined, { maximumFractionDigits: unit && value < 10 ? 1 : 0 });
|
|
64
|
+
}
|
|
65
|
+
return `${format.format(value)} ${units[unit]}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const same = (a: string, b: string) => a.localeCompare(b, undefined, { sensitivity: 'accent' }) === 0;
|
|
69
|
+
|
|
70
|
+
/** Does a sibling (other than `except`) already have this name? Case does not count ("foto" is "Foto"); accents do. */
|
|
71
|
+
export const nameTaken = (name: string, siblings: FileEntry[], except?: string) => siblings.some((sibling) => sibling.id !== except && same(sibling.name, name));
|
|
72
|
+
|
|
73
|
+
/** `name`, or "name (2)", "name (3)"… (before the extension for files) when a sibling has it; `except` is the entry being renamed. */
|
|
74
|
+
export function uniqueName(name: string, siblings: FileEntry[], except?: string): string {
|
|
75
|
+
if (!nameTaken(name, siblings, except)) return name;
|
|
76
|
+
const extension = extensionOf(name);
|
|
77
|
+
const base = extension ? name.slice(0, -extension.length - 1) : name;
|
|
78
|
+
for (let n = 2; ; n++) {
|
|
79
|
+
const candidate = extension ? `${base} (${n}).${extension}` : `${base} (${n})`;
|
|
80
|
+
if (!nameTaken(candidate, siblings, except)) return candidate;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Folders first; then by `key` (names in natural order: "Foto 2" before "Foto 10"). */
|
|
85
|
+
export function sortEntries(entries: FileEntry[], key: FileSort = 'name', direction: 1 | -1 = 1, locale = 'es'): FileEntry[] {
|
|
86
|
+
let collator: Intl.Collator;
|
|
87
|
+
try {
|
|
88
|
+
collator = new Intl.Collator(locale, { numeric: true, sensitivity: 'base' });
|
|
89
|
+
} catch {
|
|
90
|
+
collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });
|
|
91
|
+
}
|
|
92
|
+
const time = (entry: FileEntry) => toTime(entry.modified)?.getTime() ?? 0;
|
|
93
|
+
return [...entries].sort((a, b) => {
|
|
94
|
+
const folderA = isFolder(a);
|
|
95
|
+
if (folderA !== isFolder(b)) return folderA ? -1 : 1;
|
|
96
|
+
let diff = 0;
|
|
97
|
+
// Folders have no size of their own: by name, as file managers do.
|
|
98
|
+
if (key === 'size' && !folderA) diff = (a.size ?? 0) - (b.size ?? 0);
|
|
99
|
+
else if (key === 'modified') diff = time(a) - time(b);
|
|
100
|
+
if (!diff) diff = collator.compare(a.name, b.name);
|
|
101
|
+
return diff * direction;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** A deep copy of entries (dates and other values are kept as they are). */
|
|
106
|
+
export const cloneEntries = (entries: FileEntry[]): FileEntry[] =>
|
|
107
|
+
entries.map((entry) => (entry.children ? { ...entry, children: cloneEntries(entry.children) } : { ...entry }));
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { toDate } from './dates';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Filters (filter-builder, data-table): groups of conditions combined with
|
|
5
|
+
* AND / OR, nested. Each field has a type; each type its operators, with
|
|
6
|
+
* Spanish labels and how many values they take. matchesFilter() tests a
|
|
7
|
+
* record (text ignores case and accents; dates compare whole days; incomplete
|
|
8
|
+
* conditions do not filter); describeFilter() writes the filter as a sentence
|
|
9
|
+
* ("Estado es Activo y (Monto mayor que 100 o País es México)").
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type FilterFieldType = 'text' | 'number' | 'date' | 'select' | 'boolean';
|
|
13
|
+
|
|
14
|
+
export interface FilterField {
|
|
15
|
+
key: string;
|
|
16
|
+
label: string;
|
|
17
|
+
type?: FilterFieldType;
|
|
18
|
+
/** 'select' fields: the values to choose from. */
|
|
19
|
+
options?: Array<{ value: string; label: string }>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type FilterValue = string | number | null | [string | number | null, string | number | null];
|
|
23
|
+
|
|
24
|
+
export interface FilterRule {
|
|
25
|
+
id: string;
|
|
26
|
+
field: string;
|
|
27
|
+
operator: string;
|
|
28
|
+
value?: FilterValue;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface FilterGroup {
|
|
32
|
+
id: string;
|
|
33
|
+
combinator: 'and' | 'or';
|
|
34
|
+
rules: FilterNode[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type FilterNode = FilterRule | FilterGroup;
|
|
38
|
+
|
|
39
|
+
export interface OperatorDef {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
/** How many values it takes. */
|
|
43
|
+
arity: 0 | 1 | 2;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const OPERATORS: Record<FilterFieldType, OperatorDef[]> = {
|
|
47
|
+
text: [
|
|
48
|
+
{ id: 'contains', label: 'contiene', arity: 1 },
|
|
49
|
+
{ id: 'not_contains', label: 'no contiene', arity: 1 },
|
|
50
|
+
{ id: 'equals', label: 'es', arity: 1 },
|
|
51
|
+
{ id: 'not_equals', label: 'no es', arity: 1 },
|
|
52
|
+
{ id: 'starts', label: 'empieza por', arity: 1 },
|
|
53
|
+
{ id: 'ends', label: 'termina en', arity: 1 },
|
|
54
|
+
{ id: 'empty', label: 'está vacío', arity: 0 },
|
|
55
|
+
{ id: 'not_empty', label: 'no está vacío', arity: 0 },
|
|
56
|
+
],
|
|
57
|
+
number: [
|
|
58
|
+
{ id: 'eq', label: 'igual a', arity: 1 },
|
|
59
|
+
{ id: 'neq', label: 'distinto de', arity: 1 },
|
|
60
|
+
{ id: 'gt', label: 'mayor que', arity: 1 },
|
|
61
|
+
{ id: 'gte', label: 'mayor o igual que', arity: 1 },
|
|
62
|
+
{ id: 'lt', label: 'menor que', arity: 1 },
|
|
63
|
+
{ id: 'lte', label: 'menor o igual que', arity: 1 },
|
|
64
|
+
{ id: 'between', label: 'entre', arity: 2 },
|
|
65
|
+
{ id: 'empty', label: 'está vacío', arity: 0 },
|
|
66
|
+
{ id: 'not_empty', label: 'no está vacío', arity: 0 },
|
|
67
|
+
],
|
|
68
|
+
date: [
|
|
69
|
+
{ id: 'on', label: 'es el', arity: 1 },
|
|
70
|
+
{ id: 'before', label: 'antes del', arity: 1 },
|
|
71
|
+
{ id: 'after', label: 'después del', arity: 1 },
|
|
72
|
+
{ id: 'between', label: 'entre', arity: 2 },
|
|
73
|
+
{ id: 'empty', label: 'está vacío', arity: 0 },
|
|
74
|
+
{ id: 'not_empty', label: 'no está vacío', arity: 0 },
|
|
75
|
+
],
|
|
76
|
+
select: [
|
|
77
|
+
{ id: 'is', label: 'es', arity: 1 },
|
|
78
|
+
{ id: 'is_not', label: 'no es', arity: 1 },
|
|
79
|
+
{ id: 'empty', label: 'está vacío', arity: 0 },
|
|
80
|
+
{ id: 'not_empty', label: 'no está vacío', arity: 0 },
|
|
81
|
+
],
|
|
82
|
+
boolean: [
|
|
83
|
+
{ id: 'true', label: 'es sí', arity: 0 },
|
|
84
|
+
{ id: 'false', label: 'es no', arity: 0 },
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
let sequence = 0;
|
|
89
|
+
export const filterId = () => `f${(++sequence).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
90
|
+
|
|
91
|
+
export const isGroup = (node: FilterNode): node is FilterGroup => 'rules' in node && Array.isArray((node as FilterGroup).rules);
|
|
92
|
+
|
|
93
|
+
export const emptyFilter = (combinator: 'and' | 'or' = 'and'): FilterGroup => ({ id: filterId(), combinator, rules: [] });
|
|
94
|
+
|
|
95
|
+
export const typeOf = (field: FilterField | undefined): FilterFieldType => field?.type ?? 'text';
|
|
96
|
+
|
|
97
|
+
export const operatorsFor = (field: FilterField | undefined) => OPERATORS[typeOf(field)];
|
|
98
|
+
|
|
99
|
+
export const operatorOf = (field: FilterField | undefined, id: string) => operatorsFor(field).find((operator) => operator.id === id) ?? operatorsFor(field)[0]!;
|
|
100
|
+
|
|
101
|
+
/** A new condition on `field`: its type's first operator, no value yet. */
|
|
102
|
+
export function newRule(field: FilterField): FilterRule {
|
|
103
|
+
const operator = operatorsFor(field)[0]!;
|
|
104
|
+
return { id: filterId(), field: field.key, operator: operator.id, value: operator.arity === 2 ? [null, null] : null };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const blank = (value: unknown) => value === null || value === undefined || (typeof value === 'string' && value.trim() === '');
|
|
108
|
+
|
|
109
|
+
/** The condition has every value its operator needs. */
|
|
110
|
+
export function isComplete(rule: FilterRule, fields: FilterField[]): boolean {
|
|
111
|
+
const field = fields.find((candidate) => candidate.key === rule.field);
|
|
112
|
+
if (!field) return false;
|
|
113
|
+
const { arity } = operatorOf(field, rule.operator);
|
|
114
|
+
if (arity === 0) return true;
|
|
115
|
+
if (arity === 1) return !blank(rule.value);
|
|
116
|
+
return Array.isArray(rule.value) && !blank(rule.value[0]) && !blank(rule.value[1]);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const fold = (value: unknown) => String(value ?? '').normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase().trim();
|
|
120
|
+
const day = (value: unknown) => {
|
|
121
|
+
if (blank(value)) return null;
|
|
122
|
+
const date = toDate(value as string, new Date(Number.NaN));
|
|
123
|
+
return Number.isNaN(date.getTime()) ? null : date.getTime();
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
function testRule(record: Record<string, unknown>, rule: FilterRule, field: FilterField): boolean {
|
|
127
|
+
const raw = record[field.key];
|
|
128
|
+
const type = typeOf(field);
|
|
129
|
+
const { id } = operatorOf(field, rule.operator);
|
|
130
|
+
if (id === 'empty') return blank(raw);
|
|
131
|
+
if (id === 'not_empty') return !blank(raw);
|
|
132
|
+
const [a, b] = Array.isArray(rule.value) ? rule.value : [rule.value, null];
|
|
133
|
+
switch (type) {
|
|
134
|
+
case 'number': {
|
|
135
|
+
const n = Number(raw);
|
|
136
|
+
const x = Number(a);
|
|
137
|
+
const y = Number(b);
|
|
138
|
+
if (blank(raw) || Number.isNaN(n)) return false;
|
|
139
|
+
if (id === 'eq') return n === x;
|
|
140
|
+
if (id === 'neq') return n !== x;
|
|
141
|
+
if (id === 'gt') return n > x;
|
|
142
|
+
if (id === 'gte') return n >= x;
|
|
143
|
+
if (id === 'lt') return n < x;
|
|
144
|
+
if (id === 'lte') return n <= x;
|
|
145
|
+
return n >= Math.min(x, y) && n <= Math.max(x, y);
|
|
146
|
+
}
|
|
147
|
+
case 'date': {
|
|
148
|
+
const n = day(raw);
|
|
149
|
+
const x = day(a);
|
|
150
|
+
const y = day(b);
|
|
151
|
+
if (n === null || x === null) return false;
|
|
152
|
+
if (id === 'on') return n === x;
|
|
153
|
+
if (id === 'before') return n < x;
|
|
154
|
+
if (id === 'after') return n > x;
|
|
155
|
+
return y !== null && n >= Math.min(x, y) && n <= Math.max(x, y);
|
|
156
|
+
}
|
|
157
|
+
case 'boolean':
|
|
158
|
+
return id === 'true' ? Boolean(raw) : !raw;
|
|
159
|
+
case 'select':
|
|
160
|
+
return id === 'is' ? String(raw) === String(a) : String(raw) !== String(a);
|
|
161
|
+
default: {
|
|
162
|
+
const text = fold(raw);
|
|
163
|
+
const needle = fold(a);
|
|
164
|
+
if (id === 'contains') return text.includes(needle);
|
|
165
|
+
if (id === 'not_contains') return !text.includes(needle);
|
|
166
|
+
if (id === 'equals') return text === needle;
|
|
167
|
+
if (id === 'not_equals') return text !== needle;
|
|
168
|
+
if (id === 'starts') return text.startsWith(needle);
|
|
169
|
+
return text.endsWith(needle);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Whether `record` passes `filter`; incomplete conditions (and empty groups) do not filter. */
|
|
175
|
+
export function matchesFilter(record: Record<string, unknown>, filter: FilterGroup, fields: FilterField[]): boolean {
|
|
176
|
+
const results: boolean[] = [];
|
|
177
|
+
for (const node of filter.rules) {
|
|
178
|
+
if (isGroup(node)) {
|
|
179
|
+
if (!hasConditions(node, fields)) continue;
|
|
180
|
+
results.push(matchesFilter(record, node, fields));
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
const field = fields.find((candidate) => candidate.key === node.field);
|
|
184
|
+
if (!field || !isComplete(node, fields)) continue;
|
|
185
|
+
results.push(testRule(record, node, field));
|
|
186
|
+
}
|
|
187
|
+
if (!results.length) return true;
|
|
188
|
+
return filter.combinator === 'and' ? results.every(Boolean) : results.some(Boolean);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** The group holds at least one complete condition (at any depth). */
|
|
192
|
+
export function hasConditions(filter: FilterGroup, fields: FilterField[]): boolean {
|
|
193
|
+
return filter.rules.some((node) => (isGroup(node) ? hasConditions(node, fields) : isComplete(node, fields)));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const shown = (field: FilterField, value: unknown) => {
|
|
197
|
+
if (blank(value)) return '…';
|
|
198
|
+
if (typeOf(field) === 'select') return field.options?.find((option) => option.value === String(value))?.label ?? String(value);
|
|
199
|
+
if (typeOf(field) === 'date') {
|
|
200
|
+
const date = toDate(value as string, new Date(Number.NaN));
|
|
201
|
+
if (!Number.isNaN(date.getTime())) return new Intl.DateTimeFormat('es', { day: 'numeric', month: 'short', year: 'numeric' }).format(date);
|
|
202
|
+
}
|
|
203
|
+
return String(value);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/** The filter as a sentence; incomplete conditions are left out. Empty: ''. */
|
|
207
|
+
export function describeFilter(filter: FilterGroup, fields: FilterField[], nested = false): string {
|
|
208
|
+
const joiner = filter.combinator === 'and' ? ' y ' : ' o ';
|
|
209
|
+
const parts: string[] = [];
|
|
210
|
+
for (const node of filter.rules) {
|
|
211
|
+
if (isGroup(node)) {
|
|
212
|
+
const inner = describeFilter(node, fields, true);
|
|
213
|
+
if (inner) parts.push(inner);
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
const field = fields.find((candidate) => candidate.key === node.field);
|
|
217
|
+
if (!field || !isComplete(node, fields)) continue;
|
|
218
|
+
const operator = operatorOf(field, node.operator);
|
|
219
|
+
const [a, b] = Array.isArray(node.value) ? node.value : [node.value, null];
|
|
220
|
+
const values = operator.arity === 0 ? '' : operator.arity === 1 ? ` ${shown(field, a)}` : ` ${shown(field, a)} y ${shown(field, b)}`;
|
|
221
|
+
parts.push(`${field.label} ${operator.label}${values}`);
|
|
222
|
+
}
|
|
223
|
+
if (!parts.length) return '';
|
|
224
|
+
const text = parts.join(joiner);
|
|
225
|
+
return nested && parts.length > 1 ? `(${text})` : text;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** A deep copy (callbacks get their own). */
|
|
229
|
+
export const cloneFilter = (filter: FilterGroup): FilterGroup => JSON.parse(JSON.stringify(filter)) as FilterGroup;
|
package/src/core/gsap.ts
CHANGED
|
@@ -1,65 +1,80 @@
|
|
|
1
|
-
import { gsap } from 'gsap';
|
|
2
|
-
import { ScrollTrigger } from 'gsap/ScrollTrigger';
|
|
3
|
-
import { SplitText } from 'gsap/SplitText';
|
|
4
|
-
import { CustomEase } from 'gsap/CustomEase';
|
|
5
|
-
import { Flip } from 'gsap/Flip';
|
|
6
|
-
import { PATHS, springPath } from './curves';
|
|
7
|
-
|
|
8
|
-
/** elastic overshoot; close to the `--mk-ease-elastic` CSS curve. */
|
|
9
|
-
export const ELASTIC = 'elastic.out(1, 0.45)';
|
|
10
|
-
|
|
11
|
-
/** Custom eases registered by `registerMotion()`. Use the names as GSAP `ease` values. */
|
|
12
|
-
export const EASE = {
|
|
13
|
-
signature: 'mk-signature',
|
|
14
|
-
flow: 'mk-flow',
|
|
15
|
-
/** A closing surface's fade (`.56,.27,0,1`). Kept from v0.1; same curve as `fadeAway`. */
|
|
16
|
-
close: 'mk-close',
|
|
17
|
-
fadeAway: 'mk-fade-away',
|
|
18
|
-
/** A closing surface's blur (`.37,.35,0,1`). */
|
|
19
|
-
blurAway: 'mk-blur-away',
|
|
20
|
-
chatScroll: 'mk-chat-scroll',
|
|
21
|
-
/** Items travelling to a new place in a list (spring ratio .52). */
|
|
22
|
-
layoutReflow: 'mk-layout-reflow',
|
|
23
|
-
/** A dragged item landing in its slot (spring ratio .62). */
|
|
24
|
-
sortableLand: 'mk-sortable-land',
|
|
25
|
-
slot: 'mk-slot',
|
|
26
|
-
slotResize: 'mk-slot-resize',
|
|
27
|
-
liquidSize: 'mk-liquid-size',
|
|
28
|
-
swatch: 'mk-swatch',
|
|
29
|
-
swatchLight: 'mk-swatch-light',
|
|
30
|
-
sheet: 'mk-sheet',
|
|
31
|
-
inOut: 'mk-in-out',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
1
|
+
import { gsap } from 'gsap';
|
|
2
|
+
import { ScrollTrigger } from 'gsap/ScrollTrigger';
|
|
3
|
+
import { SplitText } from 'gsap/SplitText';
|
|
4
|
+
import { CustomEase } from 'gsap/CustomEase';
|
|
5
|
+
import { Flip } from 'gsap/Flip';
|
|
6
|
+
import { PATHS, springPath } from './curves';
|
|
7
|
+
|
|
8
|
+
/** elastic overshoot; close to the `--mk-ease-elastic` CSS curve. */
|
|
9
|
+
export const ELASTIC = 'elastic.out(1, 0.45)';
|
|
10
|
+
|
|
11
|
+
/** Custom eases registered by `registerMotion()`. Use the names as GSAP `ease` values. */
|
|
12
|
+
export const EASE = {
|
|
13
|
+
signature: 'mk-signature',
|
|
14
|
+
flow: 'mk-flow',
|
|
15
|
+
/** A closing surface's fade (`.56,.27,0,1`). Kept from v0.1; same curve as `fadeAway`. */
|
|
16
|
+
close: 'mk-close',
|
|
17
|
+
fadeAway: 'mk-fade-away',
|
|
18
|
+
/** A closing surface's blur (`.37,.35,0,1`). */
|
|
19
|
+
blurAway: 'mk-blur-away',
|
|
20
|
+
chatScroll: 'mk-chat-scroll',
|
|
21
|
+
/** Items travelling to a new place in a list (spring ratio .52). */
|
|
22
|
+
layoutReflow: 'mk-layout-reflow',
|
|
23
|
+
/** A dragged item landing in its slot (spring ratio .62). */
|
|
24
|
+
sortableLand: 'mk-sortable-land',
|
|
25
|
+
slot: 'mk-slot',
|
|
26
|
+
slotResize: 'mk-slot-resize',
|
|
27
|
+
liquidSize: 'mk-liquid-size',
|
|
28
|
+
swatch: 'mk-swatch',
|
|
29
|
+
swatchLight: 'mk-swatch-light',
|
|
30
|
+
sheet: 'mk-sheet',
|
|
31
|
+
inOut: 'mk-in-out',
|
|
32
|
+
/** Melonmind's button press (`buttonClickAnimation`, .37,1.42,.37,1). */
|
|
33
|
+
click: 'mk-click',
|
|
34
|
+
/** Melonmind's playful padding/radius morph (.38,.49,0,2). */
|
|
35
|
+
playful: 'mk-playful',
|
|
36
|
+
/** Melonmind's surface entrance (`animation-general-in-2`, .1,.8,0,1.1). */
|
|
37
|
+
pop: 'mk-pop',
|
|
38
|
+
/** Melonmind's entry wipe (.38,.49,0,1). */
|
|
39
|
+
wipe: 'mk-wipe',
|
|
40
|
+
/** Melonmind's error shake (.6,.6,.12,1.26). */
|
|
41
|
+
shake: 'mk-shake',
|
|
42
|
+
} as const;
|
|
43
|
+
|
|
44
|
+
const CURVES: Record<keyof typeof EASE, string> = {
|
|
45
|
+
signature: PATHS.signature,
|
|
46
|
+
flow: PATHS.flow,
|
|
47
|
+
close: '.56,.27,0,1',
|
|
48
|
+
fadeAway: '.56,.27,0,1',
|
|
49
|
+
blurAway: '.37,.35,0,1',
|
|
50
|
+
chatScroll: PATHS.chatScroll,
|
|
51
|
+
layoutReflow: springPath(0.52),
|
|
52
|
+
sortableLand: springPath(0.62),
|
|
53
|
+
slot: '.34,1.56,.64,1',
|
|
54
|
+
slotResize: '.2,0,0,1',
|
|
55
|
+
liquidSize: '.8,.3,.5,.8',
|
|
56
|
+
swatch: '.38,.49,0,1.5',
|
|
57
|
+
swatchLight: '.11,1,0,1',
|
|
58
|
+
sheet: '.16,1,.3,1',
|
|
59
|
+
inOut: '.42,0,.58,1',
|
|
60
|
+
click: '.37,1.42,.37,1',
|
|
61
|
+
playful: '.38,.49,0,2',
|
|
62
|
+
pop: '.1,.8,0,1.1',
|
|
63
|
+
wipe: '.38,.49,0,1',
|
|
64
|
+
shake: '.6,.6,.12,1.26',
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
let registered = false;
|
|
68
|
+
|
|
69
|
+
/** Register plugins and eases once. Safe to call from every recipe and during SSR (no-op). */
|
|
70
|
+
export function registerMotion() {
|
|
71
|
+
if (typeof window === 'undefined') return;
|
|
72
|
+
// Cancels the MK_HEAD_SCRIPT safety net: JS owns the entrance states from here on.
|
|
73
|
+
document.documentElement.classList.add('mk-ready');
|
|
74
|
+
if (registered) return;
|
|
75
|
+
registered = true;
|
|
76
|
+
gsap.registerPlugin(ScrollTrigger, SplitText, CustomEase, Flip);
|
|
77
|
+
for (const key of Object.keys(EASE) as Array<keyof typeof EASE>) CustomEase.create(EASE[key], CURVES[key]);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { gsap, ScrollTrigger, SplitText, CustomEase, Flip };
|