@hanzo/ui 4.5.3 → 4.6.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-MCP.md +3 -3
- package/README.md +229 -0
- package/assets/ai-icons.tsx +207 -0
- package/assets/crypto.tsx +33 -0
- package/assets/file-type-icon.tsx +66 -0
- package/assets/file.tsx +45 -0
- package/assets/general.tsx +2318 -0
- package/assets/hanzo-logo.svg +9 -0
- package/assets/hanzo-logo.tsx +15 -0
- package/assets/index.ts +8 -0
- package/assets/index.tsx +4 -0
- package/assets/llm-provider.tsx +1094 -0
- package/bin/create-registry.js +1 -1
- package/bin/test-mcp.sh +1 -1
- package/bin/update-registry.js +2 -2
- package/blocks/components/content.tsx +1 -1
- package/blocks/components/grid-block/index.tsx +1 -1
- package/blocks/components/screenful-block/content.tsx +1 -1
- package/blocks/components/screenful-block/poster-background.tsx +1 -1
- package/components/index.ts +56 -0
- package/dist/button.d.ts +1 -0
- package/dist/button.js +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/use-click-away.d.ts +2 -0
- package/dist/hooks/use-click-away.js +23 -0
- package/dist/hooks/use-combined-refs.d.ts +3 -0
- package/dist/hooks/use-combined-refs.js +18 -0
- package/dist/hooks/use-copy-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-clipboard.js +21 -0
- package/dist/hooks/use-debounce.d.ts +1 -0
- package/dist/hooks/use-debounce.js +13 -0
- package/dist/hooks/use-fill-ids.d.ts +8 -0
- package/dist/hooks/use-fill-ids.js +20 -0
- package/dist/hooks/use-map.d.ts +1 -0
- package/dist/hooks/use-map.js +20 -0
- package/dist/hooks/use-measure.d.ts +8 -0
- package/dist/hooks/use-measure.js +25 -0
- package/dist/hooks/use-reverse-video-playback.d.ts +1 -0
- package/dist/hooks/use-reverse-video-playback.js +41 -0
- package/dist/hooks/use-scroll-restoration.d.ts +8 -0
- package/dist/hooks/use-scroll-restoration.js +36 -0
- package/dist/mcp/enhanced-server.js +3 -3
- package/dist/mcp/index.js +1 -1
- package/dist/registry/api.d.ts +1 -1
- package/dist/registry/api.js +3 -4
- package/dist/registry/index.d.ts +348 -4
- package/dist/registry/index.js +3 -3
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/helpers/file.ts +33 -0
- package/helpers/memoization.ts +40 -0
- package/package.json +27 -6
- package/primitives/accordion.tsx +53 -45
- package/primitives/alert-dialog.tsx +185 -0
- package/primitives/alert.tsx +74 -0
- package/primitives/apply-typography.tsx +1 -1
- package/primitives/avatar.tsx +37 -29
- package/primitives/background-beams.tsx +142 -0
- package/primitives/badge.tsx +27 -19
- package/primitives/breadcrumb.tsx +77 -62
- package/primitives/button.tsx +69 -72
- package/primitives/card.tsx +73 -59
- package/primitives/chat/chat-input-area.tsx +87 -0
- package/primitives/chat/chat-input.tsx +71 -0
- package/primitives/chat/files-preview.tsx +330 -0
- package/primitives/chat/index.ts +6 -0
- package/primitives/chat/json-form.tsx +8 -0
- package/primitives/chat/message-list.tsx +307 -0
- package/primitives/chat/message.tsx +569 -0
- package/primitives/chat/sqlite-preview.tsx +215 -0
- package/primitives/checkbox.tsx +18 -19
- package/primitives/collapsible.tsx +9 -0
- package/primitives/command.tsx +75 -83
- package/primitives/context-menu.tsx +115 -109
- package/primitives/copy-to-clipboard-icon.tsx +60 -0
- package/primitives/dialog-video-controller.tsx +1 -1
- package/primitives/dialog.tsx +111 -145
- package/primitives/dot-pattern.tsx +57 -0
- package/primitives/dots-loader.tsx +13 -0
- package/primitives/drawer.tsx +59 -87
- package/primitives/dropdown-menu.tsx +199 -0
- package/primitives/error-message.tsx +19 -0
- package/primitives/file-uploader.tsx +200 -0
- package/primitives/form.tsx +92 -87
- package/primitives/hover-card.tsx +28 -0
- package/primitives/icons/github.tsx +1 -1
- package/primitives/icons/youtube-logo.tsx +1 -1
- package/primitives/index-common.ts +121 -42
- package/primitives/index-next.ts +3 -1
- package/primitives/input.tsx +115 -20
- package/primitives/label.tsx +15 -23
- package/primitives/loading-spinner.tsx +1 -1
- package/primitives/markdown-preview.tsx +609 -0
- package/primitives/mermaid.tsx +196 -0
- package/primitives/next/link-element.tsx +1 -1
- package/primitives/next/mdx-link.tsx +1 -1
- package/primitives/pagination.tsx +117 -0
- package/primitives/popover.tsx +20 -25
- package/primitives/pretty-json-print.tsx +28 -0
- package/primitives/progress.tsx +14 -15
- package/primitives/prompt-textarea.tsx +72 -0
- package/primitives/qr-code.tsx +112 -0
- package/primitives/radio-group.tsx +25 -39
- package/primitives/resizable.tsx +47 -0
- package/primitives/scroll-area.tsx +35 -25
- package/primitives/search-input.tsx +66 -0
- package/primitives/select.tsx +62 -109
- package/primitives/separator.tsx +22 -26
- package/primitives/sheet.tsx +78 -117
- package/primitives/skeleton.tsx +13 -16
- package/primitives/slider.tsx +50 -60
- package/primitives/stepper.tsx +272 -0
- package/primitives/switch.tsx +14 -23
- package/primitives/table.tsx +65 -77
- package/primitives/tabs.tsx +29 -39
- package/primitives/text-link.tsx +25 -0
- package/primitives/textarea.tsx +61 -0
- package/primitives/textfield.tsx +75 -0
- package/primitives/toast.tsx +30 -0
- package/primitives/toggle-group.tsx +33 -33
- package/primitives/toggle.tsx +22 -51
- package/primitives/tooltip.tsx +37 -38
- package/registry.json +1 -1
- package/src/button.ts +1 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/use-click-away.ts +31 -0
- package/src/hooks/use-combined-refs.ts +22 -0
- package/src/hooks/use-copy-clipboard.ts +30 -0
- package/src/hooks/use-debounce.ts +17 -0
- package/src/hooks/use-fill-ids.ts +25 -0
- package/src/hooks/use-map.ts +26 -0
- package/src/hooks/use-measure.ts +42 -0
- package/src/hooks/use-reverse-video-playback.ts +43 -0
- package/src/hooks/use-scroll-restoration.ts +50 -0
- package/{mcp → src/mcp}/README.md +1 -1
- package/{mcp → src/mcp}/enhanced-server.ts +2 -2
- package/{registry → src/registry}/api.ts +3 -3
- package/{registry → src/registry}/index.ts +3 -3
- package/src/utils.ts +1 -0
- package/style/theme-provider.tsx +1 -1
- package/test-imports.mjs +19 -0
- package/tsconfig.json +9 -4
- package/types/animation-def.ts +1 -1
- package/types/button-def.ts +1 -1
- package/types/index.ts +1 -1
- package/util/blob.ts +28 -0
- package/util/copy-to-clipboard.ts +17 -0
- package/util/create-shadow-root.ts +22 -0
- package/util/date.ts +83 -0
- package/util/debounce.ts +11 -0
- package/util/file.ts +15 -0
- package/util/format-and-abbreviate-as-currency.ts +1 -1
- package/util/format-text.ts +33 -0
- package/util/index.ts +9 -78
- package/util/timing.ts +3 -0
- package/util/toasts.tsx +17 -0
- package/utils.ts +9 -0
- package/dist/blocks/components/accordian-block.d.ts +0 -4
- package/dist/blocks/components/accordian-block.jsx +0 -25
- package/dist/blocks/components/block-component-props.d.ts +0 -7
- package/dist/blocks/components/block-component-props.js +0 -1
- package/dist/blocks/components/bullet-cards-block.d.ts +0 -4
- package/dist/blocks/components/bullet-cards-block.jsx +0 -25
- package/dist/blocks/components/card-block/index.d.ts +0 -6
- package/dist/blocks/components/card-block/index.jsx +0 -87
- package/dist/blocks/components/card-block/link-out-button.d.ts +0 -6
- package/dist/blocks/components/card-block/link-out-button.jsx +0 -4
- package/dist/blocks/components/card-block/util.d.ts +0 -4
- package/dist/blocks/components/card-block/util.js +0 -6
- package/dist/blocks/components/carte-blanche-block/index.d.ts +0 -4
- package/dist/blocks/components/carte-blanche-block/index.jsx +0 -82
- package/dist/blocks/components/carte-blanche-block/variant-content-left.d.ts +0 -10
- package/dist/blocks/components/carte-blanche-block/variant-content-left.jsx +0 -23
- package/dist/blocks/components/content.d.ts +0 -10
- package/dist/blocks/components/content.jsx +0 -47
- package/dist/blocks/components/cta-block.d.ts +0 -12
- package/dist/blocks/components/cta-block.jsx +0 -69
- package/dist/blocks/components/enh-heading-block.d.ts +0 -7
- package/dist/blocks/components/enh-heading-block.jsx +0 -142
- package/dist/blocks/components/grid-block/grid-block-mutator.d.ts +0 -5
- package/dist/blocks/components/grid-block/grid-block-mutator.js +0 -1
- package/dist/blocks/components/grid-block/index.d.ts +0 -9
- package/dist/blocks/components/grid-block/index.jsx +0 -56
- package/dist/blocks/components/grid-block/mutator-registry.d.ts +0 -3
- package/dist/blocks/components/grid-block/mutator-registry.js +0 -5
- package/dist/blocks/components/grid-block/table-borders.mutator.d.ts +0 -3
- package/dist/blocks/components/grid-block/table-borders.mutator.js +0 -36
- package/dist/blocks/components/group-block.d.ts +0 -7
- package/dist/blocks/components/group-block.jsx +0 -61
- package/dist/blocks/components/heading-block.d.ts +0 -4
- package/dist/blocks/components/heading-block.jsx +0 -99
- package/dist/blocks/components/image-block.d.ts +0 -7
- package/dist/blocks/components/image-block.jsx +0 -69
- package/dist/blocks/components/index.d.ts +0 -14
- package/dist/blocks/components/index.js +0 -13
- package/dist/blocks/components/screenful-block/content.d.ts +0 -8
- package/dist/blocks/components/screenful-block/content.jsx +0 -71
- package/dist/blocks/components/screenful-block/index.d.ts +0 -12
- package/dist/blocks/components/screenful-block/index.jsx +0 -57
- package/dist/blocks/components/screenful-block/poster-background.d.ts +0 -7
- package/dist/blocks/components/screenful-block/poster-background.jsx +0 -14
- package/dist/blocks/components/screenful-block/video-background.d.ts +0 -8
- package/dist/blocks/components/screenful-block/video-background.jsx +0 -20
- package/dist/blocks/components/space-block.d.ts +0 -4
- package/dist/blocks/components/space-block.jsx +0 -42
- package/dist/blocks/components/video-block.d.ts +0 -9
- package/dist/blocks/components/video-block.jsx +0 -83
- package/dist/blocks/def/accordian-block.d.ts +0 -10
- package/dist/blocks/def/accordian-block.js +0 -2
- package/dist/blocks/def/block.d.ts +0 -4
- package/dist/blocks/def/block.js +0 -1
- package/dist/blocks/def/bullet-cards-block.d.ts +0 -17
- package/dist/blocks/def/bullet-cards-block.js +0 -1
- package/dist/blocks/def/card-block.d.ts +0 -17
- package/dist/blocks/def/card-block.js +0 -2
- package/dist/blocks/def/carte-blanche-block.d.ts +0 -12
- package/dist/blocks/def/carte-blanche-block.js +0 -1
- package/dist/blocks/def/cta-block.d.ts +0 -8
- package/dist/blocks/def/cta-block.js +0 -1
- package/dist/blocks/def/element-block.d.ts +0 -7
- package/dist/blocks/def/element-block.js +0 -2
- package/dist/blocks/def/enh-heading-block.d.ts +0 -22
- package/dist/blocks/def/enh-heading-block.js +0 -1
- package/dist/blocks/def/grid-block.d.ts +0 -12
- package/dist/blocks/def/grid-block.js +0 -1
- package/dist/blocks/def/group-block.d.ts +0 -7
- package/dist/blocks/def/group-block.js +0 -1
- package/dist/blocks/def/heading-block.d.ts +0 -11
- package/dist/blocks/def/heading-block.js +0 -1
- package/dist/blocks/def/image-block.d.ts +0 -26
- package/dist/blocks/def/image-block.js +0 -1
- package/dist/blocks/def/index.d.ts +0 -17
- package/dist/blocks/def/index.js +0 -2
- package/dist/blocks/def/screenful-block.d.ts +0 -41
- package/dist/blocks/def/screenful-block.js +0 -1
- package/dist/blocks/def/space-block.d.ts +0 -47
- package/dist/blocks/def/space-block.js +0 -8
- package/dist/blocks/def/video-block.d.ts +0 -5
- package/dist/blocks/def/video-block.js +0 -1
- package/dist/blocks/index.d.ts +0 -2
- package/dist/blocks/index.js +0 -2
- package/dist/primitives/accordion.d.ts +0 -10
- package/dist/primitives/accordion.jsx +0 -21
- package/dist/primitives/action-button.d.ts +0 -9
- package/dist/primitives/action-button.jsx +0 -16
- package/dist/primitives/apply-typography.d.ts +0 -7
- package/dist/primitives/apply-typography.jsx +0 -38
- package/dist/primitives/aspect-ratio.d.ts +0 -3
- package/dist/primitives/aspect-ratio.jsx +0 -4
- package/dist/primitives/avatar.d.ts +0 -6
- package/dist/primitives/avatar.jsx +0 -11
- package/dist/primitives/badge.d.ts +0 -9
- package/dist/primitives/badge.jsx +0 -18
- package/dist/primitives/breadcrumb.d.ts +0 -19
- package/dist/primitives/breadcrumb.jsx +0 -27
- package/dist/primitives/breakpoint-indicator.d.ts +0 -3
- package/dist/primitives/breakpoint-indicator.jsx +0 -14
- package/dist/primitives/button.d.ts +0 -12
- package/dist/primitives/button.jsx +0 -55
- package/dist/primitives/calendar.d.ts +0 -8
- package/dist/primitives/calendar.jsx +0 -40
- package/dist/primitives/card.d.ts +0 -8
- package/dist/primitives/card.jsx +0 -18
- package/dist/primitives/carousel.d.ts +0 -18
- package/dist/primitives/carousel.jsx +0 -106
- package/dist/primitives/checkbox.d.ts +0 -4
- package/dist/primitives/checkbox.jsx +0 -15
- package/dist/primitives/combobox.d.ts +0 -41
- package/dist/primitives/combobox.jsx +0 -77
- package/dist/primitives/command.d.ts +0 -17
- package/dist/primitives/command.jsx +0 -38
- package/dist/primitives/context-menu.d.ts +0 -27
- package/dist/primitives/context-menu.jsx +0 -57
- package/dist/primitives/dialog-video-controller.d.ts +0 -3
- package/dist/primitives/dialog-video-controller.jsx +0 -24
- package/dist/primitives/dialog.d.ts +0 -28
- package/dist/primitives/dialog.jsx +0 -37
- package/dist/primitives/drawer.d.ts +0 -29
- package/dist/primitives/drawer.jsx +0 -34
- package/dist/primitives/form.d.ts +0 -12
- package/dist/primitives/form.jsx +0 -69
- package/dist/primitives/icons/github.d.ts +0 -4
- package/dist/primitives/icons/github.jsx +0 -6
- package/dist/primitives/icons/index.d.ts +0 -4
- package/dist/primitives/icons/index.js +0 -4
- package/dist/primitives/icons/youtube-logo.d.ts +0 -4
- package/dist/primitives/icons/youtube-logo.jsx +0 -39
- package/dist/primitives/index-common.d.ts +0 -47
- package/dist/primitives/index-common.js +0 -46
- package/dist/primitives/index-next.d.ts +0 -2
- package/dist/primitives/index-next.js +0 -2
- package/dist/primitives/input-otp.d.ts +0 -7
- package/dist/primitives/input-otp.jsx +0 -24
- package/dist/primitives/input.d.ts +0 -5
- package/dist/primitives/input.jsx +0 -11
- package/dist/primitives/label.d.ts +0 -5
- package/dist/primitives/label.jsx +0 -11
- package/dist/primitives/list-adaptor.d.ts +0 -9
- package/dist/primitives/list-adaptor.js +0 -1
- package/dist/primitives/list-box.d.ts +0 -10
- package/dist/primitives/list-box.jsx +0 -14
- package/dist/primitives/loading-spinner.d.ts +0 -5
- package/dist/primitives/loading-spinner.jsx +0 -8
- package/dist/primitives/navigation-menu.d.ts +0 -12
- package/dist/primitives/navigation-menu.jsx +0 -38
- package/dist/primitives/next/image.d.ts +0 -11
- package/dist/primitives/next/image.jsx +0 -42
- package/dist/primitives/next/index.d.ts +0 -7
- package/dist/primitives/next/index.js +0 -7
- package/dist/primitives/next/inline-icon.d.ts +0 -13
- package/dist/primitives/next/inline-icon.jsx +0 -15
- package/dist/primitives/next/link-element.d.ts +0 -23
- package/dist/primitives/next/link-element.jsx +0 -56
- package/dist/primitives/next/mdx-link.d.ts +0 -3
- package/dist/primitives/next/mdx-link.jsx +0 -12
- package/dist/primitives/next/media-stack.d.ts +0 -8
- package/dist/primitives/next/media-stack.jsx +0 -28
- package/dist/primitives/next/nav-items.d.ts +0 -10
- package/dist/primitives/next/nav-items.jsx +0 -24
- package/dist/primitives/next/youtube-embed.d.ts +0 -11
- package/dist/primitives/next/youtube-embed.jsx +0 -23
- package/dist/primitives/popover.d.ts +0 -9
- package/dist/primitives/popover.jsx +0 -18
- package/dist/primitives/progress.d.ts +0 -4
- package/dist/primitives/progress.jsx +0 -9
- package/dist/primitives/radio-group.d.ts +0 -7
- package/dist/primitives/radio-group.jsx +0 -18
- package/dist/primitives/scroll-area.d.ts +0 -5
- package/dist/primitives/scroll-area.jsx +0 -19
- package/dist/primitives/select.d.ts +0 -13
- package/dist/primitives/select.jsx +0 -62
- package/dist/primitives/separator.d.ts +0 -4
- package/dist/primitives/separator.jsx +0 -7
- package/dist/primitives/sheet.d.ts +0 -30
- package/dist/primitives/sheet.jsx +0 -56
- package/dist/primitives/skeleton.d.ts +0 -4
- package/dist/primitives/skeleton.jsx +0 -3
- package/dist/primitives/slider.d.ts +0 -9
- package/dist/primitives/slider.jsx +0 -30
- package/dist/primitives/sonner.d.ts +0 -5
- package/dist/primitives/sonner.jsx +0 -16
- package/dist/primitives/step-indicator.d.ts +0 -9
- package/dist/primitives/step-indicator.jsx +0 -23
- package/dist/primitives/switch.d.ts +0 -6
- package/dist/primitives/switch.jsx +0 -14
- package/dist/primitives/table.d.ts +0 -10
- package/dist/primitives/table.jsx +0 -21
- package/dist/primitives/tabs.d.ts +0 -7
- package/dist/primitives/tabs.jsx +0 -18
- package/dist/primitives/text-area.d.ts +0 -5
- package/dist/primitives/text-area.jsx +0 -9
- package/dist/primitives/toggle-group.d.ts +0 -14
- package/dist/primitives/toggle-group.jsx +0 -28
- package/dist/primitives/toggle.d.ts +0 -14
- package/dist/primitives/toggle.jsx +0 -52
- package/dist/primitives/tooltip.d.ts +0 -11
- package/dist/primitives/tooltip.jsx +0 -18
- package/dist/primitives/video-player.d.ts +0 -6
- package/dist/primitives/video-player.jsx +0 -8
- package/dist/style/theme-provider.d.ts +0 -4
- package/dist/style/theme-provider.jsx +0 -11
- package/dist/tailwind/fontFamily.tailwind.d.ts +0 -8
- package/dist/tailwind/fontFamily.tailwind.js +0 -7
- package/dist/tailwind/fontSize.tailwind.d.ts +0 -36
- package/dist/tailwind/fontSize.tailwind.js +0 -13
- package/dist/tailwind/index.d.ts +0 -3
- package/dist/tailwind/index.js +0 -2
- package/dist/tailwind/screens.tailwind.d.ts +0 -9
- package/dist/tailwind/screens.tailwind.js +0 -8
- package/dist/tailwind/tw-font-desc.d.ts +0 -6
- package/dist/tailwind/tw-font-desc.js +0 -6
- package/dist/types/animation-def.d.ts +0 -2
- package/dist/types/animation-def.js +0 -1
- package/dist/types/breakpoints.d.ts +0 -4
- package/dist/types/breakpoints.js +0 -4
- package/dist/types/bullet-item.d.ts +0 -6
- package/dist/types/bullet-item.js +0 -2
- package/dist/types/button-def.d.ts +0 -29
- package/dist/types/button-def.js +0 -2
- package/dist/types/dimensions.d.ts +0 -5
- package/dist/types/dimensions.js +0 -1
- package/dist/types/grid-def.d.ts +0 -36
- package/dist/types/grid-def.js +0 -33
- package/dist/types/image-def.d.ts +0 -27
- package/dist/types/image-def.js +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.js +0 -2
- package/dist/types/link-def.d.ts +0 -44
- package/dist/types/link-def.js +0 -1
- package/dist/types/media-stack-def.d.ts +0 -25
- package/dist/types/media-stack-def.js +0 -1
- package/dist/types/t-shirt-size.d.ts +0 -2
- package/dist/types/t-shirt-size.js +0 -1
- package/dist/types/tshirt-dimensions.d.ts +0 -12
- package/dist/types/tshirt-dimensions.js +0 -1
- package/dist/types/video-def.d.ts +0 -9
- package/dist/types/video-def.js +0 -1
- package/dist/util/format-and-abbreviate-as-currency.d.ts +0 -11
- package/dist/util/format-and-abbreviate-as-currency.js +0 -91
- package/dist/util/format-to-max-char.d.ts +0 -5
- package/dist/util/format-to-max-char.js +0 -57
- package/dist/util/index-client.d.ts +0 -2
- package/dist/util/index-client.js +0 -3
- package/dist/util/index.d.ts +0 -17
- package/dist/util/index.js +0 -41
- package/dist/util/number-abbreviate.d.ts +0 -9
- package/dist/util/number-abbreviate.js +0 -30
- package/dist/util/specifier.d.ts +0 -7
- package/dist/util/specifier.js +0 -31
- package/dist/util/spread-to-transform.d.ts +0 -7
- package/dist/util/spread-to-transform.js +0 -18
- package/dist/util/step-animation.d.ts +0 -5
- package/dist/util/step-animation.js +0 -60
- package/dist/util/two-way-map.d.ts +0 -8
- package/dist/util/two-way-map.js +0 -16
- /package/{mcp → src/mcp}/index.ts +0 -0
- /package/{mcp → src/mcp}/package.json +0 -0
- /package/{registry → src/registry}/package.json +0 -0
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type AnimationDef from './animation-def';
|
|
2
|
-
import type ImageDef from './image-def';
|
|
3
|
-
import type VideoDef from './video-def';
|
|
4
|
-
/**
|
|
5
|
-
* This will be implemented via css transforms,
|
|
6
|
-
* so will be a subset of those capabilities.
|
|
7
|
-
* Individual transforms will be added as they
|
|
8
|
-
* are needed.
|
|
9
|
-
*/
|
|
10
|
-
interface MediaTransform {
|
|
11
|
-
/** (X and Y) or [X, Y] */
|
|
12
|
-
scale?: number | number[];
|
|
13
|
-
}
|
|
14
|
-
interface MediaStackDef {
|
|
15
|
-
img?: ImageDef;
|
|
16
|
-
video?: VideoDef;
|
|
17
|
-
animation?: AnimationDef;
|
|
18
|
-
mediaTransform?: MediaTransform;
|
|
19
|
-
/** prefered order of precedence.
|
|
20
|
-
* If an type is missing, it will not be used.
|
|
21
|
-
* default (inMediaStack component): ['a', 'v', 'i']
|
|
22
|
-
* */
|
|
23
|
-
order?: ('a' | 'v' | 'i')[];
|
|
24
|
-
}
|
|
25
|
-
export type { MediaStackDef, MediaTransform };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type ConcreteDimensions = {
|
|
2
|
-
w: number;
|
|
3
|
-
h: number;
|
|
4
|
-
};
|
|
5
|
-
type TShirtDimensions = {
|
|
6
|
-
xs?: ConcreteDimensions;
|
|
7
|
-
sm?: ConcreteDimensions;
|
|
8
|
-
md: ConcreteDimensions;
|
|
9
|
-
lg?: ConcreteDimensions;
|
|
10
|
-
xl?: ConcreteDimensions;
|
|
11
|
-
};
|
|
12
|
-
export { type TShirtDimensions as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/video-def.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type QuantityAbbrSymbol } from './number-abbreviate';
|
|
2
|
-
interface FormatThreshold {
|
|
3
|
-
from: number;
|
|
4
|
-
use: QuantityAbbrSymbol;
|
|
5
|
-
}
|
|
6
|
-
declare const formatAndAbbreviateAsCurrency: (n: number | null, thresholds?: FormatThreshold[], roundingAdds?: number, maxDecimal?: number) => {
|
|
7
|
-
full: string;
|
|
8
|
-
result: string;
|
|
9
|
-
change: "rounded" | "none" | "abbr" | "empty";
|
|
10
|
-
};
|
|
11
|
-
export { formatAndAbbreviateAsCurrency as default, type FormatThreshold, type QuantityAbbrSymbol };
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import Abbr, { ABBR_SYMBOLS_ARRAY } from './number-abbreviate';
|
|
2
|
-
const usdFormatter = Intl.NumberFormat('en-US', {
|
|
3
|
-
style: 'currency',
|
|
4
|
-
currency: 'USD',
|
|
5
|
-
minimumFractionDigits: 2,
|
|
6
|
-
});
|
|
7
|
-
const formatAsUSCurrency = (n) => {
|
|
8
|
-
let result = usdFormatter.format(n);
|
|
9
|
-
return result.endsWith('.00') ? result.slice(0, -3) : result;
|
|
10
|
-
};
|
|
11
|
-
const formatAndAbbreviateAsCurrency = (n, thresholds = [{
|
|
12
|
-
from: 1000000000,
|
|
13
|
-
use: 'M'
|
|
14
|
-
}],
|
|
15
|
-
/**
|
|
16
|
-
* Chars that will be added by ui if the number is rounded.
|
|
17
|
-
* For example, if the desired output for 10.15 is "~10.1",
|
|
18
|
-
* the tilda counts as 1 char.
|
|
19
|
-
*/
|
|
20
|
-
roundingAdds = 1, maxDecimal = 2) => {
|
|
21
|
-
if (n === null) {
|
|
22
|
-
return {
|
|
23
|
-
full: '',
|
|
24
|
-
result: '',
|
|
25
|
-
change: 'empty'
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
const formatted = formatAsUSCurrency(n);
|
|
29
|
-
if (n < thresholds[0].from) {
|
|
30
|
-
return {
|
|
31
|
-
full: formatted,
|
|
32
|
-
result: formatted,
|
|
33
|
-
change: 'none'
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
// Get operative FormatThreshold pair...
|
|
37
|
-
let threshold;
|
|
38
|
-
for (let i = 0; i < thresholds.length && n >= thresholds[i].from; threshold = thresholds[i], i++) { }
|
|
39
|
-
// Build up units array to all units
|
|
40
|
-
// up to threshold.use
|
|
41
|
-
const units = [];
|
|
42
|
-
for (let i = 0; i < ABBR_SYMBOLS_ARRAY.length; i++) {
|
|
43
|
-
const current = ABBR_SYMBOLS_ARRAY[i];
|
|
44
|
-
units.push(current);
|
|
45
|
-
if (current === threshold.use) {
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const abbreviator = new Abbr(units);
|
|
50
|
-
// Use threshold.from as a guide to how many chars are available:
|
|
51
|
-
// first digit + comma = 2
|
|
52
|
-
// Possible trailing cents: '.xx'.length = 3
|
|
53
|
-
// 3 - 2 = 1
|
|
54
|
-
const charsAvail = formatAsUSCurrency(threshold.from).length + 1;
|
|
55
|
-
const abbr = abbreviator.abbreviate(n, charsAvail); // arbitrary, but good approx
|
|
56
|
-
const numStr = abbr.slice(0, -1);
|
|
57
|
-
const abbreviation = abbr.slice(-1);
|
|
58
|
-
const numerical = parseFloat(numStr);
|
|
59
|
-
const integral = Math.floor(numerical);
|
|
60
|
-
const integralString = formatAsUSCurrency(integral);
|
|
61
|
-
const commas = integralString.split(',').length - 1;
|
|
62
|
-
// minus abbr, dec point, dollar sign, and roundingAdds / tilda,
|
|
63
|
-
// (1 + 1 + 1 + roundingAdds)
|
|
64
|
-
// ("precision" does NOT include the decimal point itself,
|
|
65
|
-
// so we have to explicitly factor it in.)
|
|
66
|
-
const roundedString = numerical.toPrecision(charsAvail - commas - (3 + roundingAdds));
|
|
67
|
-
// remove trailing zeros, if any
|
|
68
|
-
const roundedNumerical = parseFloat(roundedString);
|
|
69
|
-
const roundedIntegral = Math.trunc(roundedNumerical);
|
|
70
|
-
const roundedIntegralString = formatAsUSCurrency(roundedIntegral);
|
|
71
|
-
let decimalPortion = roundedNumerical - roundedIntegral;
|
|
72
|
-
let result;
|
|
73
|
-
if (decimalPortion !== 0) {
|
|
74
|
-
// remove trailing zeros if any
|
|
75
|
-
decimalPortion = parseFloat(decimalPortion.toFixed(maxDecimal));
|
|
76
|
-
const decimalPortionString = decimalPortion.toString();
|
|
77
|
-
const afterDecimalString = decimalPortionString.slice(decimalPortionString.indexOf('.') + 1);
|
|
78
|
-
result = roundedIntegralString + '.' + afterDecimalString + abbreviation;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
result = roundedIntegralString + abbreviation;
|
|
82
|
-
}
|
|
83
|
-
// Did we lose any precision?
|
|
84
|
-
const rounded = (roundedIntegral + decimalPortion !== n);
|
|
85
|
-
return {
|
|
86
|
-
full: formatted,
|
|
87
|
-
result,
|
|
88
|
-
change: rounded ? 'rounded' : 'abbr'
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
export { formatAndAbbreviateAsCurrency as default };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import Abbr from './number-abbreviate';
|
|
2
|
-
const abbr = new Abbr(['K', 'M', 'B', 'T']);
|
|
3
|
-
const formatToMaxChar = (n, maxChars,
|
|
4
|
-
/**
|
|
5
|
-
* Chars that will be added by ui if the number is rounded.
|
|
6
|
-
* For example, if the desired output for 10.15 is "~10.1",
|
|
7
|
-
* the tilda counts as 1 char.
|
|
8
|
-
*/
|
|
9
|
-
roundingAdds = 1) => {
|
|
10
|
-
if (n === null) {
|
|
11
|
-
return {
|
|
12
|
-
result: '',
|
|
13
|
-
change: 'empty'
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
const s = n.toString();
|
|
17
|
-
if (s.length > maxChars) {
|
|
18
|
-
// Highest number that can be rounded down to an
|
|
19
|
-
// acceptable string.
|
|
20
|
-
// Decimal point, plus one decimal place = 2 chars
|
|
21
|
-
const cuttoff = Math.pow(10, maxChars - 2 - roundingAdds) - 0.05;
|
|
22
|
-
if (n < cuttoff) {
|
|
23
|
-
const intPortion = Math.floor(n);
|
|
24
|
-
const len = intPortion.toString().length;
|
|
25
|
-
// 1 is for dec point itself
|
|
26
|
-
const availDecimals = maxChars - len - 1 - roundingAdds;
|
|
27
|
-
// removes trailing zeros, if any
|
|
28
|
-
const roundedNumerical = parseFloat(n.toFixed(availDecimals));
|
|
29
|
-
return {
|
|
30
|
-
result: roundedNumerical.toString(),
|
|
31
|
-
change: 'rounded'
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
const str = abbr.abbreviate(n, maxChars);
|
|
36
|
-
const numStr = str.slice(0, -1);
|
|
37
|
-
const abbreviation = str.slice(-1);
|
|
38
|
-
const numerical = parseFloat(numStr);
|
|
39
|
-
// minus abbr, dec point, and roundingAdds / tilda,
|
|
40
|
-
// (1 + 1 + roundingAdds)
|
|
41
|
-
// ("precision" does NOT include the decimal point itself,
|
|
42
|
-
// so we have to explicitly factor it in.)
|
|
43
|
-
const roundedString = numerical.toPrecision(maxChars - (2 + roundingAdds));
|
|
44
|
-
// remove trailing zeros, if any
|
|
45
|
-
const roundedNumerical = parseFloat(roundedString);
|
|
46
|
-
return {
|
|
47
|
-
result: roundedNumerical.toString() + abbreviation,
|
|
48
|
-
change: roundedNumerical === numerical ? 'abbr' : 'rounded'
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
result: s,
|
|
54
|
-
change: 'none'
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export default formatToMaxChar;
|
package/dist/util/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type ClassValue } from 'clsx';
|
|
2
|
-
export { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import type { Dimensions } from '../types';
|
|
4
|
-
export declare const cn: (...inputs: ClassValue[]) => string;
|
|
5
|
-
export declare const markdown: (s: string, options?: any) => JSX.Element;
|
|
6
|
-
export declare const round: (num: number) => string;
|
|
7
|
-
export declare const pxToRem: (px: number, base: number) => string;
|
|
8
|
-
export declare const pxToEm: (px: number, base: number) => string;
|
|
9
|
-
export declare const hexToRgb: (hex: string) => string;
|
|
10
|
-
export declare const asNum: (n: number | `${number}`) => number;
|
|
11
|
-
export declare const constrain: (d: Dimensions, c: Dimensions) => Dimensions;
|
|
12
|
-
export declare const containsToken: (s: string | undefined, toFind: string) => boolean;
|
|
13
|
-
export declare const ldMerge: (result: any, ...sources: any[]) => any;
|
|
14
|
-
export declare const capitalize: (str: string) => string;
|
|
15
|
-
export { default as spreadToTransform } from './spread-to-transform';
|
|
16
|
-
export { default as formatToMaxChar } from './format-to-max-char';
|
|
17
|
-
export { default as formatAndAbbreviateAsCurrency, type FormatThreshold, type QuantityAbbrSymbol } from './format-and-abbreviate-as-currency';
|
package/dist/util/index.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { compiler as mdCompiler } from 'markdown-to-jsx';
|
|
2
|
-
import { clsx } from 'clsx';
|
|
3
|
-
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
export { cva } from 'class-variance-authority';
|
|
5
|
-
import { default as _merge } from 'lodash.merge';
|
|
6
|
-
export const cn = (...inputs) => (twMerge(clsx(inputs)));
|
|
7
|
-
export const markdown = (s, options) => (mdCompiler(s, {
|
|
8
|
-
wrapper: null,
|
|
9
|
-
...options
|
|
10
|
-
}));
|
|
11
|
-
export const round = (num) => (num
|
|
12
|
-
.toFixed(7)
|
|
13
|
-
.replace(/(\.[0-9]+?)0+$/, '$1')
|
|
14
|
-
.replace(/\.0$/, ''));
|
|
15
|
-
export const pxToRem = (px, base) => (`${round(px / base)}rem`);
|
|
16
|
-
export const pxToEm = (px, base) => (`${round(px / base)}em`);
|
|
17
|
-
export const hexToRgb = (hex) => {
|
|
18
|
-
hex = hex.replace('#', '');
|
|
19
|
-
hex = hex.length === 3 ? hex.replace(/./g, '$&$&') : hex;
|
|
20
|
-
const r = parseInt(hex.substring(0, 2), 16);
|
|
21
|
-
const g = parseInt(hex.substring(2, 4), 16);
|
|
22
|
-
const b = parseInt(hex.substring(4, 6), 16);
|
|
23
|
-
return `${r} ${g} ${b}`;
|
|
24
|
-
};
|
|
25
|
-
export const asNum = (n) => ((typeof n === 'number') ? n : parseInt(n, 10));
|
|
26
|
-
// https://stackoverflow.com/questions/3971841/how-to-resize-images-proportionally-keeping-the-aspect-ratio
|
|
27
|
-
export const constrain = (d, c) => {
|
|
28
|
-
const ratio = Math.min(c.w / d.w, c.h / d.h);
|
|
29
|
-
return {
|
|
30
|
-
w: Math.round(d.w * ratio),
|
|
31
|
-
h: Math.round(d.h * ratio)
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export const containsToken = (s, toFind) => (s ? s.split(' ').includes(toFind) : false);
|
|
35
|
-
export const ldMerge = (result, ...sources) => (_merge(result, ...sources));
|
|
36
|
-
export const capitalize = (str) => (str.charAt(0).toUpperCase() + str.slice(1));
|
|
37
|
-
export { default as spreadToTransform } from './spread-to-transform';
|
|
38
|
-
export { default as formatToMaxChar } from './format-to-max-char';
|
|
39
|
-
export { default as formatAndAbbreviateAsCurrency } from './format-and-abbreviate-as-currency';
|
|
40
|
-
// Must be imported from 'use client', so can't include this...
|
|
41
|
-
// export * from './step-animation'
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type QuantityAbbrSymbol = 'K' | 'M' | 'B' | 'T';
|
|
2
|
-
declare const ABBR_SYMBOLS_ARRAY: ("K" | "M" | "B" | "T")[];
|
|
3
|
-
declare class NumberAbbreviator {
|
|
4
|
-
private _units;
|
|
5
|
-
constructor(units?: QuantityAbbrSymbol[]);
|
|
6
|
-
private _abbreviate;
|
|
7
|
-
abbreviate: (n: number, decPlaces: number, log?: boolean) => string;
|
|
8
|
-
}
|
|
9
|
-
export { type QuantityAbbrSymbol, ABBR_SYMBOLS_ARRAY, NumberAbbreviator as default };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// cf: https://github.com/domharrington/js-number-abbreviate/blob/master/index.js
|
|
2
|
-
const ABBR_SYMBOLS_ARRAY = ['K', 'M', 'B', 'T'];
|
|
3
|
-
class NumberAbbreviator {
|
|
4
|
-
constructor(units) {
|
|
5
|
-
this._abbreviate = (n, decPlaces, log = false) => {
|
|
6
|
-
const _decPlaces = Math.pow(10, decPlaces);
|
|
7
|
-
let _n = n;
|
|
8
|
-
let _unit;
|
|
9
|
-
for (let i = this._units.length - 1; i >= 0; i--) {
|
|
10
|
-
const size = Math.pow(10, (i + 1) * 3);
|
|
11
|
-
if (size <= _n) {
|
|
12
|
-
_n = Math.round(_n * _decPlaces / size) / _decPlaces;
|
|
13
|
-
if ((_n === 1000) && (i < this._units.length - 1)) {
|
|
14
|
-
_n = 1;
|
|
15
|
-
i++;
|
|
16
|
-
}
|
|
17
|
-
_unit = this._units[i];
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return _n.toString() + (_unit ?? '');
|
|
22
|
-
};
|
|
23
|
-
this.abbreviate = (n, decPlaces, log = false) => {
|
|
24
|
-
const abbreviatedNumber = this._abbreviate(Math.abs(n), decPlaces, log);
|
|
25
|
-
return n < 0 ? '-' + abbreviatedNumber : abbreviatedNumber;
|
|
26
|
-
};
|
|
27
|
-
this._units = units ?? ABBR_SYMBOLS_ARRAY;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export { ABBR_SYMBOLS_ARRAY, NumberAbbreviator as default };
|
package/dist/util/specifier.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Dimensions, TShirtSize } from '../types';
|
|
2
|
-
import type { TypographySize } from '../primitives/apply-typography';
|
|
3
|
-
export declare const getPrimaryStartingWith: (s: string, toFind: string) => string | undefined;
|
|
4
|
-
export declare const getTShirtSize: (s: string) => TShirtSize | undefined;
|
|
5
|
-
export declare const getTypographySize: (s: string) => TypographySize | undefined;
|
|
6
|
-
export declare const getDim: (s: string) => Dimensions | undefined;
|
|
7
|
-
export declare function getSpecifierData<T>(main: string, getPrimary: (s: string) => string | undefined, getData: (s: string) => T | undefined, def?: T): T | undefined;
|
package/dist/util/specifier.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export const getPrimaryStartingWith = (s, toFind) => {
|
|
2
|
-
const tokenArray = s.split(' ');
|
|
3
|
-
return tokenArray.find((tok) => (tok.startsWith(`${toFind}-`)));
|
|
4
|
-
};
|
|
5
|
-
export const getTShirtSize = (s) => {
|
|
6
|
-
const subTokenArray = s.split('-');
|
|
7
|
-
return subTokenArray[subTokenArray.length - 1];
|
|
8
|
-
};
|
|
9
|
-
export const getTypographySize = (s) => {
|
|
10
|
-
const subTokenArray = s.split('-');
|
|
11
|
-
return subTokenArray[subTokenArray.length - 1];
|
|
12
|
-
};
|
|
13
|
-
export const getDim = (s) => {
|
|
14
|
-
const subTokenArray = s.split('-');
|
|
15
|
-
const dimStr = subTokenArray[subTokenArray.length - 1];
|
|
16
|
-
if (dimStr) {
|
|
17
|
-
const dimTokenArray = s.split('x');
|
|
18
|
-
return dimTokenArray ? {
|
|
19
|
-
w: Number(dimTokenArray[0]),
|
|
20
|
-
h: Number(dimTokenArray[1])
|
|
21
|
-
} : undefined;
|
|
22
|
-
}
|
|
23
|
-
return undefined;
|
|
24
|
-
};
|
|
25
|
-
export function getSpecifierData(main, getPrimary, getData, def) {
|
|
26
|
-
const primary = getPrimary(main);
|
|
27
|
-
if (primary) {
|
|
28
|
-
return getData(primary) ?? def;
|
|
29
|
-
}
|
|
30
|
-
return def ?? undefined;
|
|
31
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default (t) => {
|
|
2
|
-
let transformStrings = [];
|
|
3
|
-
const scaleVal = 'scale' in t ? t.scale : undefined;
|
|
4
|
-
if (scaleVal) {
|
|
5
|
-
if (typeof scaleVal === 'number') {
|
|
6
|
-
transformStrings.push(`scale(${scaleVal})`);
|
|
7
|
-
}
|
|
8
|
-
else if (Array.isArray(scaleVal) &&
|
|
9
|
-
scaleVal.length == 2 &&
|
|
10
|
-
typeof scaleVal[0] === 'number') {
|
|
11
|
-
transformStrings.push(`scale(${scaleVal[0]}, ${scaleVal[1]})`);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
throw new Error("parsing MediaTransform: Unrecognized value for 'scale'!");
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return transformStrings.length > 0 ? { transform: transformStrings.join(' ') } : {};
|
|
18
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { makeObservable, reaction, computed, observable, action } from 'mobx';
|
|
3
|
-
class MyStepAnimation {
|
|
4
|
-
/** initialStep: false -> true: step 0
|
|
5
|
-
true -> false: step 1
|
|
6
|
-
after intervals[0] : step 2
|
|
7
|
-
after intervals[1] : step 3
|
|
8
|
-
|
|
9
|
-
initialStep must contain at least one mobx observable and return boolean
|
|
10
|
-
see: https://mobx.js.org/reactions.html#reaction
|
|
11
|
-
*/
|
|
12
|
-
constructor(initialStep, intervals) {
|
|
13
|
-
this._step = -1;
|
|
14
|
-
this._reactionDisposer = undefined;
|
|
15
|
-
// This is separated out because reactions have to be created
|
|
16
|
-
// once we have a valid doc / window etc. (mobx internals)
|
|
17
|
-
// Can't just do it in constructor and assign to ref
|
|
18
|
-
this.initialize = () => {
|
|
19
|
-
const fireNext = () => {
|
|
20
|
-
this._setStep(this._step + 1);
|
|
21
|
-
if (this._step <= this._intervals.length) {
|
|
22
|
-
// No need to call clearTimeout(): https://stackoverflow.com/a/7391588/11645689
|
|
23
|
-
setTimeout(() => { fireNext(); }, this._intervals[this._step - 1]);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
this._reactionDisposer = reaction(this._initialStep, (triggered) => {
|
|
27
|
-
if (triggered && this._step === -1) {
|
|
28
|
-
this._setStep(0);
|
|
29
|
-
}
|
|
30
|
-
// extra safe
|
|
31
|
-
else if (this._step === 0) {
|
|
32
|
-
fireNext();
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
this._setStep = (v) => { this._step = v; };
|
|
37
|
-
this.dispose = () => {
|
|
38
|
-
if (this._reactionDisposer) {
|
|
39
|
-
this._reactionDisposer();
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
// https://mobx.js.org/computeds-with-args.html#2-close-over-the-arguments
|
|
43
|
-
this.notPast = (step) => (computed(() => (this._step > -1 && this._step <= step)).get());
|
|
44
|
-
this._initialStep = initialStep;
|
|
45
|
-
this._intervals = intervals;
|
|
46
|
-
makeObservable(this, {
|
|
47
|
-
_step: observable,
|
|
48
|
-
_setStep: action
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const useStepAnimation = (initialStep, intervals) => {
|
|
53
|
-
const animRef = useRef(new MyStepAnimation(initialStep, intervals));
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
animRef.current.initialize();
|
|
56
|
-
return animRef.current.dispose;
|
|
57
|
-
}, []);
|
|
58
|
-
return animRef.current;
|
|
59
|
-
};
|
|
60
|
-
export { useStepAnimation };
|
package/dist/util/two-way-map.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
class TwoWayReadonlyMap {
|
|
2
|
-
constructor(map) {
|
|
3
|
-
this.map = map;
|
|
4
|
-
this.reverseMap = new Map();
|
|
5
|
-
map.forEach((value, key) => {
|
|
6
|
-
this.reverseMap.set(value, key);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
get(key) {
|
|
10
|
-
return this.map.get(key);
|
|
11
|
-
}
|
|
12
|
-
revGet(key) {
|
|
13
|
-
return this.reverseMap.get(key);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export default TwoWayReadonlyMap;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|