@espressif/dashboard-ui-components 1.10.0 → 1.11.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/CHANGELOG.md +65 -0
- package/dist/_vendor/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/_vendor/@radix-ui/react-checkbox/dist/index.js +185 -0
- package/dist/_vendor/@radix-ui/react-compose-refs/dist/index.js +28 -0
- package/dist/_vendor/@radix-ui/react-context/dist/index.js +68 -0
- package/dist/_vendor/@radix-ui/react-presence/dist/index.js +127 -0
- package/dist/_vendor/@radix-ui/react-primitive/dist/index.js +42 -0
- package/dist/_vendor/@radix-ui/react-use-controllable-state/dist/index.js +55 -0
- package/dist/_vendor/@radix-ui/react-use-layout-effect/dist/index.js +5 -0
- package/dist/_vendor/@radix-ui/react-use-previous/dist/index.js +17 -0
- package/dist/_vendor/@radix-ui/react-use-size/dist/index.js +39 -0
- package/dist/_vendor/lottie-react/build/index.es.js +537 -0
- package/dist/_vendor/lottie-web/build/player/lottie.js +14149 -0
- package/dist/_virtual/_rolldown/runtime.js +24 -0
- package/dist/assets/illustrations/bulb-cloud-drawing.js +4 -0
- package/dist/assets/illustrations/rm-dashboard-update.js +4 -0
- package/dist/assets/illustrations/rm-data-download.js +4 -0
- package/dist/assets/logos/espressif/espressif-no-text.js +4 -0
- package/dist/assets/logos/espressif/espressif-with-text-dm.js +4 -0
- package/dist/assets/logos/espressif/espressif-with-text.js +4 -0
- package/dist/assets/logos/insights/insights-no-text.js +4 -0
- package/dist/assets/logos/insights/insights-with-text-dm.js +4 -0
- package/dist/assets/logos/insights/insights-with-text.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-no-text-dm.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-no-text.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-with-text-dm.js +4 -0
- package/dist/assets/logos/launchpad/launchpad-with-text.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-no-text.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-with-text-dm.js +4 -0
- package/dist/assets/logos/private-agents/private-agents-with-text.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-no-text.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker/rainmaker-with-text.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-no-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-no-text.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-classic/rainmaker-classic-with-text.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-no-text.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-with-text-dm.js +4 -0
- package/dist/assets/logos/rainmaker-neo/rainmaker-neo-with-text.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-no-text.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-with-text-dm.js +4 -0
- package/dist/assets/logos/ui-components/ui-components-with-text.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-no-text.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-with-text-dm.js +4 -0
- package/dist/assets/logos/zerocode/zerocode-with-text.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-no-text.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-with-text-dm.js +4 -0
- package/dist/assets/logos/zerocode-ai/zerocode-ai-with-text.js +4 -0
- package/dist/common/animated-rainmaker-logo/animated-rainmaker-logo.constants.js +18 -0
- package/dist/common/animated-rainmaker-logo/animated-rainmaker-logo.js +24 -0
- package/dist/common/animated-rainmaker-logo/rainmaker-c-logo.js +50 -0
- package/dist/common/animated-rainmaker-logo/use-animated-rainmaker-logo-animation.js +85 -0
- package/dist/common/app-logo/app-logo.js +59 -0
- package/dist/common/app-logo/logo-config.js +297 -0
- package/dist/common/copyright-card/copyright-card.js +39 -0
- package/dist/common/footer-card/footer-card.js +22 -0
- package/dist/common/index.js +8 -8
- package/dist/common/my-account-menu/my-account-menu.js +32 -0
- package/dist/common/page-loader/page-loader.js +21 -0
- package/dist/common/profile-card/profile-card.js +26 -0
- package/dist/components/accordion/accordion.js +52 -0
- package/dist/components/advanced-search-box/advanced-search-box.js +106 -0
- package/dist/components/alert/alert.js +85 -0
- package/dist/components/animated-containers/pop-collection-item.js +28 -0
- package/dist/components/async-multi-select/async-multi-select.js +199 -0
- package/dist/components/avatar/avatar.js +41 -0
- package/dist/components/button/button.js +191 -0
- package/dist/components/button/flash-button.js +110 -0
- package/dist/components/button/invert-button.js +13 -0
- package/dist/components/calendar/calendar.js +105 -0
- package/dist/components/cards/animated-card/animated-card-animations.js +57 -0
- package/dist/components/cards/animated-card/animated-card.js +42 -0
- package/dist/components/cards/basic-details-card.js +46 -0
- package/dist/components/cards/collapsible-card.js +48 -0
- package/dist/components/cards/no-data-card/no-data-card.js +30 -0
- package/dist/components/cards/section-card.js +265 -0
- package/dist/components/cards/simple-card.js +24 -0
- package/dist/components/carousel/carousel.js +158 -0
- package/dist/components/chart/area-chart.js +135 -0
- package/dist/components/chart/bar-chart.js +151 -0
- package/dist/components/chart/chart-colors.js +85 -0
- package/dist/components/chart/chart-series-data.js +53 -0
- package/dist/components/chart/chart.js +147 -0
- package/dist/components/chart/chart.types.js +7 -0
- package/dist/components/chart/composed-chart.js +182 -0
- package/dist/components/chart/donut-chart.js +177 -0
- package/dist/components/chart/line-chart.js +137 -0
- package/dist/components/chart/treemap-chart.js +294 -0
- package/dist/components/circular-progress/circular-progress.js +125 -0
- package/dist/components/code-editor/code-editor.js +235 -0
- package/dist/components/code-editor/code-editor.utils.js +122 -0
- package/dist/components/code-editor/use-code-editor-keys.js +79 -0
- package/dist/components/code-editor/use-highlighted-html.js +102 -0
- package/dist/components/confirmation-dialog/confirmation-dialog.js +72 -0
- package/dist/components/content-container/content-container.js +20 -0
- package/dist/components/copiable-text/copiable-text.js +46 -0
- package/dist/components/data-table/data-table.js +186 -0
- package/dist/components/data-table/responsive-columns.js +65 -0
- package/dist/components/data-table/row-actions.js +27 -0
- package/dist/components/data-table/sticky-columns.js +71 -0
- package/dist/components/data-table/table-body.js +57 -0
- package/dist/components/data-table/table-header.js +21 -0
- package/dist/components/date-picker/date-picker.js +95 -0
- package/dist/components/date-range-picker/date-range-picker.js +301 -0
- package/dist/components/date-range-picker/presets.js +174 -0
- package/dist/components/date-time-picker/date-time-picker.js +144 -0
- package/dist/components/date-time-picker/date-time-picker.utils.js +32 -0
- package/dist/components/device-icon/device-icon.config.js +194 -0
- package/dist/components/device-icon/device-icon.js +17 -0
- package/dist/components/device-icon/icons/air-conditioner.js +22 -0
- package/dist/components/device-icon/icons/blind.js +24 -0
- package/dist/components/device-icon/icons/dimmer.js +14 -0
- package/dist/components/device-icon/icons/extension-board.js +42 -0
- package/dist/components/device-icon/icons/fan.js +14 -0
- package/dist/components/device-icon/icons/knob.js +14 -0
- package/dist/components/device-icon/icons/led-strip.js +22 -0
- package/dist/components/device-icon/icons/light.js +14 -0
- package/dist/components/device-icon/icons/refrigerator.js +18 -0
- package/dist/components/device-icon/icons/retro-switch.js +18 -0
- package/dist/components/device-icon/icons/router.js +20 -0
- package/dist/components/device-icon/icons/sensor.js +20 -0
- package/dist/components/device-icon/icons/socket.js +19 -0
- package/dist/components/device-icon/icons/switch.js +19 -0
- package/dist/components/device-icon/icons/thermostat.js +21 -0
- package/dist/components/device-icon/icons/washing-machine.js +22 -0
- package/dist/components/device-icon/match-device.js +61 -0
- package/dist/components/dynamic-list/dynamic-list.js +445 -0
- package/dist/components/error-display/full-size-error/full-size-error.js +20 -0
- package/dist/components/error-display/inline-error/inline-error.js +12 -0
- package/dist/components/file-input/file-input.js +318 -0
- package/dist/components/file-upload/file-upload.js +317 -0
- package/dist/components/filters-bar/filters-bar.js +36 -0
- package/dist/components/fullscreen-dialog/fullscreen-dialog.js +68 -0
- package/dist/components/icon-avatar/icon-avatar.js +130 -0
- package/dist/components/icon-text-action-card/icon-text-action-card.js +190 -0
- package/dist/components/illustration/illustration-registry.js +37 -0
- package/dist/components/illustration/illustration-variants.js +21 -0
- package/dist/components/illustration/illustration.js +68 -0
- package/dist/components/index.d.ts +0 -20
- package/dist/components/index.js +134 -6
- package/dist/components/key-value-manager/key-value-manager-add-popover.js +126 -0
- package/dist/components/key-value-manager/key-value-manager-field.js +47 -0
- package/dist/components/key-value-manager/key-value-manager-table.js +188 -0
- package/dist/components/key-value-manager/key-value-manager.js +111 -0
- package/dist/components/key-value-manager/key-value-manager.props.js +28 -0
- package/dist/components/key-value-manager/key-value-manager.utils.js +21 -0
- package/dist/components/link/link.js +67 -0
- package/dist/components/list/dropdown-list-item.js +60 -0
- package/dist/components/list/list-item.utils.js +76 -0
- package/dist/components/list/list.js +49 -0
- package/dist/components/list/list.props.js +27 -0
- package/dist/components/list/standard-list-item.js +66 -0
- package/dist/components/list-details/list-details-item-button.js +46 -0
- package/dist/components/list-details/list-details-item-dropdown.js +112 -0
- package/dist/components/list-details/list-details-item-strip.js +125 -0
- package/dist/components/list-details/list-details.js +148 -0
- package/dist/components/lottie-animation-container/lottie-animation-container.js +31 -0
- package/dist/components/lottie-animations/animation-data/access-denied.js +3980 -0
- package/dist/components/lottie-animations/animation-data/active.js +825 -0
- package/dist/components/lottie-animations/animation-data/bar-chart.js +610 -0
- package/dist/components/lottie-animations/animation-data/chart-loading.js +5368 -0
- package/dist/components/lottie-animations/animation-data/cloud-download.js +1660 -0
- package/dist/components/lottie-animations/animation-data/cloud-sync.js +932 -0
- package/dist/components/lottie-animations/animation-data/coud-upload.js +7060 -0
- package/dist/components/lottie-animations/animation-data/cross-throb.js +1506 -0
- package/dist/components/lottie-animations/animation-data/dashboard-loading.js +14330 -0
- package/dist/components/lottie-animations/animation-data/error-spread-out.js +5567 -0
- package/dist/components/lottie-animations/animation-data/error.js +1211 -0
- package/dist/components/lottie-animations/animation-data/green-success.js +14826 -0
- package/dist/components/lottie-animations/animation-data/inactive.js +723 -0
- package/dist/components/lottie-animations/animation-data/light.js +2678 -0
- package/dist/components/lottie-animations/animation-data/lock.js +900 -0
- package/dist/components/lottie-animations/animation-data/lock2.js +1686 -0
- package/dist/components/lottie-animations/animation-data/locked.js +641 -0
- package/dist/components/lottie-animations/animation-data/search-error.js +954 -0
- package/dist/components/lottie-animations/animation-data/security.js +4121 -0
- package/dist/components/lottie-animations/animation-data/success.js +404 -0
- package/dist/components/lottie-animations/animation-data/verification-in-progress.js +10138 -0
- package/dist/components/lottie-animations/animation-data/warning.js +843 -0
- package/dist/components/lottie-animations/verification-in-progress/verification-in-progress.js +19 -0
- package/dist/components/markdown-content/markdown-content.components.js +114 -0
- package/dist/components/markdown-content/markdown-content.js +39 -0
- package/dist/components/menu/menu.js +19 -0
- package/dist/components/monospace-content/monospace-content.js +80 -0
- package/dist/components/nav-bar/nav-bar-details-panel.js +51 -0
- package/dist/components/nav-bar/nav-bar-mobile-menu.js +105 -0
- package/dist/components/nav-bar/nav-bar.js +449 -0
- package/dist/components/nav-bar/use-nav-bar-overflow.js +74 -0
- package/dist/components/nav-bar/use-nav-bar-scroll.js +42 -0
- package/dist/components/overflow-badge-list/overflow-badge-list.js +58 -0
- package/dist/components/page-container/page-container-skeleton.js +72 -0
- package/dist/components/page-container/page-container.js +93 -0
- package/dist/components/pagination/pagination.js +96 -0
- package/dist/components/pagination/pagination.props.js +16 -0
- package/dist/components/progress-bar/progress-bar.js +106 -0
- package/dist/components/radio-group/radio-group.js +41 -0
- package/dist/components/requirement-list/requirement-list.js +83 -0
- package/dist/components/scrollable-sections/scrollable-sections.js +270 -0
- package/dist/components/search-box/search-box.js +54 -0
- package/dist/components/search-field-shell.js +24 -0
- package/dist/components/selectable-card-list/checkbox-card-list.js +85 -0
- package/dist/components/selectable-card-list/radio-card-list.js +99 -0
- package/dist/components/selectable-card-list/selectable-card-list-shared.js +135 -0
- package/dist/components/selectable-card-list/selectable-card-list.js +34 -0
- package/dist/components/sidebar/sidebar.js +344 -0
- package/dist/components/sidebar/types.js +6 -0
- package/dist/components/simple-clickable-card/simple-clickable-card-shared.js +309 -0
- package/dist/components/simple-clickable-card/simple-clickable-card.js +106 -0
- package/dist/components/simple-info-card/simple-info-card.js +154 -0
- package/dist/components/simple-list/simple-list.js +146 -0
- package/dist/components/simple-paginated-list/simple-paginated-list.js +178 -0
- package/dist/components/simplified-date/simplified-date.js +56 -0
- package/dist/components/skeletons/table-skeleton.js +16 -0
- package/dist/components/spinner/spinner.js +25 -0
- package/dist/components/stat-card/stat-card.js +206 -0
- package/dist/components/status-badge/status-badge.js +108 -0
- package/dist/components/status-card-list/status-card-list.js +282 -0
- package/dist/components/tag/tag.js +144 -0
- package/dist/components/tag-input/tag-input.js +161 -0
- package/dist/components/text-effects/glitch-effect/glitch-text.js +115 -0
- package/dist/components/text-effects/gradient-text/gradient-text.js +32 -0
- package/dist/components/text-effects/highlight-text/highlight-text.js +35 -0
- package/dist/components/text-effects/parse-text-markup.js +53 -0
- package/dist/components/text-effects/shimmer-text/shimmer-text.js +67 -0
- package/dist/components/time-picker/time-picker.js +23 -0
- package/dist/components/toast/toast.js +126 -0
- package/dist/components/togglable-items-list/togglable-items-list.js +28 -0
- package/dist/components/tooltip/tooltip.js +21 -0
- package/dist/components/transfer-list/transfer-list.js +413 -0
- package/dist/components/truncated-line-with-tooltip/truncated-line-with-tooltip.js +61 -0
- package/dist/components/typography/typography-variants.js +41 -0
- package/dist/components/typography/typography.js +15 -0
- package/dist/components/user-type-badge/user-type-badge.js +40 -0
- package/dist/components/user-type-badge/user-type-badge.registry.js +17 -0
- package/dist/components/vertical-stepper/vertical-stepper.js +171 -0
- package/dist/core/alert.js +33 -0
- package/dist/core/animate-ui/components/animate/code-header.js +30 -0
- package/dist/core/animate-ui/components/animate/code.js +35 -0
- package/dist/core/animate-ui/components/animate/tabs.js +188 -0
- package/dist/core/animate-ui/components/animate/tooltip.js +39 -0
- package/dist/core/animate-ui/components/base/preview-card.js +29 -0
- package/dist/core/animate-ui/components/base/progress.js +32 -0
- package/dist/core/animate-ui/components/base/radio.js +24 -0
- package/dist/core/animate-ui/components/buttons/copy.js +95 -0
- package/dist/core/animate-ui/components/radix/accordion.js +36 -0
- package/dist/core/animate-ui/components/radix/dialog.js +60 -0
- package/dist/core/animate-ui/components/radix/dropdown-menu.js +129 -0
- package/dist/core/animate-ui/components/radix/sheet.js +110 -0
- package/dist/core/animate-ui/components/radix/sidebar.js +416 -0
- package/dist/core/animate-ui/components/radix/switch.js +34 -0
- package/dist/core/animate-ui/components/radix/toggle-group.js +115 -0
- package/dist/core/animate-ui/components/radix/toggle.js +24 -0
- package/dist/core/animate-ui/primitives/animate/code-block.js +131 -0
- package/dist/core/animate-ui/primitives/animate/escape-html.js +7 -0
- package/dist/core/animate-ui/primitives/animate/shiki-highlighter.js +64 -0
- package/dist/core/animate-ui/primitives/animate/slot.js +39 -0
- package/dist/core/animate-ui/primitives/animate/tabs.js +202 -0
- package/dist/core/animate-ui/primitives/animate/tooltip.js +351 -0
- package/dist/core/animate-ui/primitives/base/preview-card.js +107 -0
- package/dist/core/animate-ui/primitives/base/progress.js +60 -0
- package/dist/core/animate-ui/primitives/base/radio.js +83 -0
- package/dist/core/animate-ui/primitives/buttons/button.js +15 -0
- package/dist/core/animate-ui/primitives/effects/highlight.js +407 -0
- package/dist/core/animate-ui/primitives/radix/accordion.js +76 -0
- package/dist/core/animate-ui/primitives/radix/dialog.js +136 -0
- package/dist/core/animate-ui/primitives/radix/dropdown-menu.js +305 -0
- package/dist/core/animate-ui/primitives/radix/sheet.js +165 -0
- package/dist/core/animate-ui/primitives/radix/switch.js +86 -0
- package/dist/core/animate-ui/primitives/radix/toggle-group.js +100 -0
- package/dist/core/animate-ui/primitives/texts/counting-number.js +75 -0
- package/dist/core/avatar.js +32 -0
- package/dist/core/badge.js +27 -0
- package/dist/core/breadcrumb.js +62 -0
- package/dist/core/button/button.js +43 -0
- package/dist/core/button/craft-button.js +78 -0
- package/dist/core/button-group.js +38 -0
- package/dist/core/button.js +40 -0
- package/dist/core/card.js +42 -0
- package/dist/core/carousel/carousel.js +149 -0
- package/dist/core/checkbox/motion-checkbox.js +103 -0
- package/dist/core/collapsible.js +54 -0
- package/dist/core/combobox/combobox.js +85 -0
- package/dist/core/command.js +61 -0
- package/dist/core/field-end-icons.js +36 -0
- package/dist/core/field-label-row.js +33 -0
- package/dist/core/form.js +92 -0
- package/dist/core/hooks/use-controlled-state.js +27 -0
- package/dist/core/hooks/use-data-state.js +39 -0
- package/dist/core/hooks/use-is-in-view.js +18 -0
- package/dist/core/hooks/use-mobile.js +19 -0
- package/dist/core/hooks/use-reveal-on-scroll-up.js +141 -0
- package/dist/core/hooks/use-scroll-overflow.js +50 -0
- package/dist/core/index.js +18 -52
- package/dist/core/input/input-password.js +30 -0
- package/dist/core/input/input.js +147 -0
- package/dist/core/input-otp/input-otp.js +183 -0
- package/dist/core/label.js +15 -0
- package/dist/core/popover.js +31 -0
- package/dist/core/scroll-area.js +42 -0
- package/dist/core/select.js +121 -0
- package/dist/core/separator.js +40 -0
- package/dist/core/skeleton.js +11 -0
- package/dist/core/table.js +59 -0
- package/dist/core/textarea/textarea.js +97 -0
- package/dist/core/utils/get-strict-context.js +18 -0
- package/dist/index.js +148 -9
- package/dist/layouts/entry-layout/entry-layout-bg.js +4 -0
- package/dist/layouts/entry-layout/entry-layout.js +52 -0
- package/dist/layouts/index.js +7 -6
- package/dist/layouts/workspace-layout/account-menu/account-menu.js +108 -0
- package/dist/layouts/workspace-layout/breadcrumbs/derive-breadcrumbs.js +37 -0
- package/dist/layouts/workspace-layout/breadcrumbs/workspace-breadcrumbs.js +22 -0
- package/dist/layouts/workspace-layout/footer/footer.js +15 -0
- package/dist/layouts/workspace-layout/header/header.js +54 -0
- package/dist/layouts/workspace-layout/workspace-layout.js +157 -0
- package/dist/tailwind-preset.js +3 -4
- package/dist/utils/cn.js +8 -0
- package/dist/utils/color.js +72 -0
- package/dist/utils/index.js +3 -2
- package/dist/utils/path-match.js +17 -0
- package/dist/utils/silver-shine.js +63 -0
- package/dist/utils/variant-gradient-underlay.js +45 -0
- package/dist/utils/variant.js +426 -0
- package/package.json +7 -4
- package/dist/chunk-2GDYZAKR.js +0 -505
- package/dist/chunk-ALCWXFUC.js +0 -733
- package/dist/chunk-CDHBLANU.js +0 -59
- package/dist/chunk-LUESSJAF.js +0 -70068
- package/dist/chunk-TMORRNEB.js +0 -323
- package/dist/chunk-TRTQSARU.js +0 -31
- package/dist/chunk-VU4CZ76T.js +0 -43
- package/dist/chunk-XNLCVHBC.js +0 -364
- package/dist/chunk-Z4776NRY.js +0 -4347
- package/src/assets/illustrations/add-to-group.svg +0 -32
- package/src/assets/illustrations/chip.svg +0 -51
- package/src/assets/illustrations/create-new-group.svg +0 -27
- package/src/assets/illustrations/new-ota.svg +0 -61
- package/src/assets/illustrations/secured-key.svg +0 -48
- /package/dist/assets/{entry-layout-bg-JPI7GJ42.webp → entry-layout-bg-DUM0UhT3.webp} +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useIsInView } from "../../../hooks/use-is-in-view.js";
|
|
3
|
+
import { getHighlighter, normalizeLang } from "./shiki-highlighter.js";
|
|
4
|
+
import { escapeHtml } from "./escape-html.js";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/core/animate-ui/primitives/animate/code-block.tsx
|
|
8
|
+
function CodeBlock({ ref, code, lang, theme = "light", themes = {
|
|
9
|
+
light: "everforest-light",
|
|
10
|
+
dark: "everforest-dark"
|
|
11
|
+
}, writing = false, duration = 5e3, delay = 0, onDone, onWrite, scrollContainerRef, inView = false, inViewOnce = true, inViewMargin = "0px", ...props }) {
|
|
12
|
+
const { ref: localRef, isInView } = useIsInView(ref, {
|
|
13
|
+
inView,
|
|
14
|
+
inViewOnce,
|
|
15
|
+
inViewMargin
|
|
16
|
+
});
|
|
17
|
+
const [visibleCode, setVisibleCode] = React$1.useState("");
|
|
18
|
+
const [highlightedCode, setHighlightedCode] = React$1.useState("");
|
|
19
|
+
const [isDone, setIsDone] = React$1.useState(false);
|
|
20
|
+
React$1.useEffect(() => {
|
|
21
|
+
if (!visibleCode.length || !isInView) return;
|
|
22
|
+
const loadHighlightedCode = async () => {
|
|
23
|
+
const normalizedLang = normalizeLang(lang);
|
|
24
|
+
try {
|
|
25
|
+
setHighlightedCode((await getHighlighter()).codeToHtml(visibleCode, {
|
|
26
|
+
lang: normalizedLang,
|
|
27
|
+
themes,
|
|
28
|
+
defaultColor: theme
|
|
29
|
+
}));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.warn(`[dashboard-ui-components] Falling back to plain text for lang="${lang}"; not in the curated Shiki bundle.`, e);
|
|
32
|
+
setHighlightedCode(`<pre><code>${escapeHtml(visibleCode)}</code></pre>`);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
loadHighlightedCode();
|
|
36
|
+
}, [
|
|
37
|
+
lang,
|
|
38
|
+
themes,
|
|
39
|
+
writing,
|
|
40
|
+
isInView,
|
|
41
|
+
duration,
|
|
42
|
+
delay,
|
|
43
|
+
visibleCode,
|
|
44
|
+
theme
|
|
45
|
+
]);
|
|
46
|
+
React$1.useEffect(() => {
|
|
47
|
+
if (!writing) {
|
|
48
|
+
setVisibleCode(code);
|
|
49
|
+
onDone?.();
|
|
50
|
+
onWrite?.({
|
|
51
|
+
index: code.length,
|
|
52
|
+
length: code.length,
|
|
53
|
+
done: true
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!code.length || !isInView) return;
|
|
58
|
+
const characters = Array.from(code);
|
|
59
|
+
let index = 0;
|
|
60
|
+
const interval = duration / characters.length;
|
|
61
|
+
let intervalId;
|
|
62
|
+
const timeout = setTimeout(() => {
|
|
63
|
+
intervalId = setInterval(() => {
|
|
64
|
+
if (index < characters.length) {
|
|
65
|
+
setVisibleCode(() => {
|
|
66
|
+
const nextChar = characters.slice(0, index + 1).join("");
|
|
67
|
+
onWrite?.({
|
|
68
|
+
index: index + 1,
|
|
69
|
+
length: characters.length,
|
|
70
|
+
done: false
|
|
71
|
+
});
|
|
72
|
+
index += 1;
|
|
73
|
+
return nextChar;
|
|
74
|
+
});
|
|
75
|
+
localRef.current?.scrollTo({
|
|
76
|
+
top: localRef.current?.scrollHeight,
|
|
77
|
+
behavior: "smooth"
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
clearInterval(intervalId);
|
|
81
|
+
setIsDone(true);
|
|
82
|
+
onDone?.();
|
|
83
|
+
onWrite?.({
|
|
84
|
+
index: characters.length,
|
|
85
|
+
length: characters.length,
|
|
86
|
+
done: true
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}, interval);
|
|
90
|
+
}, delay);
|
|
91
|
+
return () => {
|
|
92
|
+
clearTimeout(timeout);
|
|
93
|
+
clearInterval(intervalId);
|
|
94
|
+
};
|
|
95
|
+
}, [
|
|
96
|
+
code,
|
|
97
|
+
duration,
|
|
98
|
+
delay,
|
|
99
|
+
isInView,
|
|
100
|
+
writing,
|
|
101
|
+
onDone,
|
|
102
|
+
onWrite,
|
|
103
|
+
localRef
|
|
104
|
+
]);
|
|
105
|
+
React$1.useEffect(() => {
|
|
106
|
+
if (!writing || !isInView) return;
|
|
107
|
+
const el = scrollContainerRef?.current ?? localRef.current?.parentElement ?? localRef.current;
|
|
108
|
+
if (!el) return;
|
|
109
|
+
requestAnimationFrame(() => {
|
|
110
|
+
el.scrollTo({
|
|
111
|
+
top: el.scrollHeight,
|
|
112
|
+
behavior: "smooth"
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
}, [
|
|
116
|
+
highlightedCode,
|
|
117
|
+
writing,
|
|
118
|
+
isInView,
|
|
119
|
+
scrollContainerRef,
|
|
120
|
+
localRef
|
|
121
|
+
]);
|
|
122
|
+
return /* @__PURE__ */ jsx("div", {
|
|
123
|
+
ref: localRef,
|
|
124
|
+
"data-writing": writing ? "" : void 0,
|
|
125
|
+
"data-done": isDone ? "" : void 0,
|
|
126
|
+
dangerouslySetInnerHTML: { __html: highlightedCode },
|
|
127
|
+
...props
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
export { CodeBlock };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/core/animate-ui/primitives/animate/escape-html.ts
|
|
2
|
+
/** Minimal HTML escaping for the unhighlighted plain-text fallback. */
|
|
3
|
+
function escapeHtml(input) {
|
|
4
|
+
return input.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { escapeHtml };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//#region src/core/animate-ui/primitives/animate/shiki-highlighter.ts
|
|
2
|
+
/** Alias table so common short names resolve to a bundled grammar. */
|
|
3
|
+
var LANG_ALIASES = {
|
|
4
|
+
js: "javascript",
|
|
5
|
+
ts: "typescript",
|
|
6
|
+
sh: "bash",
|
|
7
|
+
shell: "bash",
|
|
8
|
+
zsh: "bash",
|
|
9
|
+
md: "markdown",
|
|
10
|
+
py: "python",
|
|
11
|
+
yml: "yaml",
|
|
12
|
+
"c++": "cpp",
|
|
13
|
+
"c#": "csharp",
|
|
14
|
+
docker: "dockerfile"
|
|
15
|
+
};
|
|
16
|
+
var highlighterPromise = null;
|
|
17
|
+
/**
|
|
18
|
+
* Lazily instantiates a singleton `HighlighterCore` with the curated
|
|
19
|
+
* language + theme bundle. Called from `CodeBlock`'s effect so cost is
|
|
20
|
+
* paid only when a code fence actually mounts.
|
|
21
|
+
*/
|
|
22
|
+
function getHighlighter() {
|
|
23
|
+
if (!highlighterPromise) highlighterPromise = (async () => {
|
|
24
|
+
const [{ createHighlighterCore }, { createOnigurumaEngine }] = await Promise.all([import("shiki/core"), import("shiki/engine/oniguruma")]);
|
|
25
|
+
return createHighlighterCore({
|
|
26
|
+
themes: [
|
|
27
|
+
import("shiki/themes/everforest-light.mjs"),
|
|
28
|
+
import("shiki/themes/everforest-dark.mjs"),
|
|
29
|
+
import("shiki/themes/github-light.mjs"),
|
|
30
|
+
import("shiki/themes/github-dark.mjs")
|
|
31
|
+
],
|
|
32
|
+
langs: [
|
|
33
|
+
import("shiki/langs/javascript.mjs"),
|
|
34
|
+
import("shiki/langs/typescript.mjs"),
|
|
35
|
+
import("shiki/langs/jsx.mjs"),
|
|
36
|
+
import("shiki/langs/tsx.mjs"),
|
|
37
|
+
import("shiki/langs/json.mjs"),
|
|
38
|
+
import("shiki/langs/yaml.mjs"),
|
|
39
|
+
import("shiki/langs/bash.mjs"),
|
|
40
|
+
import("shiki/langs/html.mjs"),
|
|
41
|
+
import("shiki/langs/css.mjs"),
|
|
42
|
+
import("shiki/langs/markdown.mjs"),
|
|
43
|
+
import("shiki/langs/python.mjs"),
|
|
44
|
+
import("shiki/langs/go.mjs"),
|
|
45
|
+
import("shiki/langs/rust.mjs"),
|
|
46
|
+
import("shiki/langs/c.mjs"),
|
|
47
|
+
import("shiki/langs/cpp.mjs"),
|
|
48
|
+
import("shiki/langs/csharp.mjs"),
|
|
49
|
+
import("shiki/langs/java.mjs"),
|
|
50
|
+
import("shiki/langs/sql.mjs"),
|
|
51
|
+
import("shiki/langs/xml.mjs"),
|
|
52
|
+
import("shiki/langs/dockerfile.mjs")
|
|
53
|
+
],
|
|
54
|
+
engine: createOnigurumaEngine(import("shiki/wasm"))
|
|
55
|
+
});
|
|
56
|
+
})();
|
|
57
|
+
return highlighterPromise;
|
|
58
|
+
}
|
|
59
|
+
/** Resolves common short-name aliases (`js` → `javascript`, `sh` → `bash`, …). */
|
|
60
|
+
function normalizeLang(lang) {
|
|
61
|
+
return LANG_ALIASES[lang.toLowerCase()] ?? lang;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { getHighlighter, normalizeLang };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { isMotionComponent, motion } from "motion/react";
|
|
6
|
+
//#region src/core/animate-ui/primitives/animate/slot.tsx
|
|
7
|
+
function mergeRefs(...refs) {
|
|
8
|
+
return (node) => {
|
|
9
|
+
refs.forEach((ref) => {
|
|
10
|
+
if (!ref) return;
|
|
11
|
+
if (typeof ref === "function") ref(node);
|
|
12
|
+
else ref.current = node;
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function mergeProps(childProps, slotProps) {
|
|
17
|
+
const merged = {
|
|
18
|
+
...childProps,
|
|
19
|
+
...slotProps
|
|
20
|
+
};
|
|
21
|
+
if (childProps.className || slotProps.className) merged.className = cn(childProps.className, slotProps.className);
|
|
22
|
+
if (childProps.style || slotProps.style) merged.style = {
|
|
23
|
+
...childProps.style,
|
|
24
|
+
...slotProps.style
|
|
25
|
+
};
|
|
26
|
+
return merged;
|
|
27
|
+
}
|
|
28
|
+
function Slot({ children, ref, ...props }) {
|
|
29
|
+
const isAlreadyMotion = typeof children.type === "object" && children.type !== null && isMotionComponent(children.type);
|
|
30
|
+
const Base = React$1.useMemo(() => isAlreadyMotion ? children.type : motion.create(children.type), [isAlreadyMotion, children.type]);
|
|
31
|
+
if (!React$1.isValidElement(children)) return null;
|
|
32
|
+
const { ref: childRef, ...childProps } = children.props;
|
|
33
|
+
return /* @__PURE__ */ jsx(Base, {
|
|
34
|
+
...mergeProps(childProps, props),
|
|
35
|
+
ref: mergeRefs(childRef, ref)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { Slot };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { getStrictContext } from "../../../utils/get-strict-context.js";
|
|
3
|
+
import { Highlight, HighlightItem } from "../effects/highlight.js";
|
|
4
|
+
import { Slot } from "./slot.js";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { motion } from "motion/react";
|
|
8
|
+
//#region src/core/animate-ui/primitives/animate/tabs.tsx
|
|
9
|
+
var [TabsProvider, useTabs] = getStrictContext("TabsContext");
|
|
10
|
+
function Tabs({ defaultValue, value, onValueChange, children, ...props }) {
|
|
11
|
+
const [activeValue, setActiveValue] = React$1.useState(defaultValue);
|
|
12
|
+
const triggersRef = React$1.useRef(/* @__PURE__ */ new Map());
|
|
13
|
+
const initialSet = React$1.useRef(false);
|
|
14
|
+
const isControlled = value !== void 0;
|
|
15
|
+
React$1.useEffect(() => {
|
|
16
|
+
if (!isControlled && activeValue === void 0 && triggersRef.current.size > 0 && !initialSet.current) {
|
|
17
|
+
const firstTab = triggersRef.current.keys().next().value;
|
|
18
|
+
if (firstTab !== void 0) {
|
|
19
|
+
setActiveValue(firstTab);
|
|
20
|
+
initialSet.current = true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, [activeValue, isControlled]);
|
|
24
|
+
const registerTrigger = React$1.useCallback((val, node) => {
|
|
25
|
+
if (node) {
|
|
26
|
+
triggersRef.current.set(val, node);
|
|
27
|
+
if (!isControlled && activeValue === void 0 && !initialSet.current) {
|
|
28
|
+
setActiveValue(val);
|
|
29
|
+
initialSet.current = true;
|
|
30
|
+
}
|
|
31
|
+
} else triggersRef.current.delete(val);
|
|
32
|
+
}, [activeValue, isControlled]);
|
|
33
|
+
const handleValueChange = React$1.useCallback((val) => {
|
|
34
|
+
if (!isControlled) setActiveValue(val);
|
|
35
|
+
else onValueChange?.(val);
|
|
36
|
+
}, [isControlled, onValueChange]);
|
|
37
|
+
return /* @__PURE__ */ jsx(TabsProvider, {
|
|
38
|
+
value: {
|
|
39
|
+
activeValue: value ?? activeValue,
|
|
40
|
+
handleValueChange,
|
|
41
|
+
registerTrigger
|
|
42
|
+
},
|
|
43
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
44
|
+
"data-slot": "tabs",
|
|
45
|
+
...props,
|
|
46
|
+
children
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function TabsHighlight({ transition = {
|
|
51
|
+
type: "spring",
|
|
52
|
+
stiffness: 200,
|
|
53
|
+
damping: 25
|
|
54
|
+
}, ...props }) {
|
|
55
|
+
const { activeValue } = useTabs();
|
|
56
|
+
return /* @__PURE__ */ jsx(Highlight, {
|
|
57
|
+
"data-slot": "tabs-highlight",
|
|
58
|
+
controlledItems: true,
|
|
59
|
+
value: activeValue,
|
|
60
|
+
transition,
|
|
61
|
+
click: false,
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function TabsList(props) {
|
|
66
|
+
return /* @__PURE__ */ jsx("div", {
|
|
67
|
+
role: "tablist",
|
|
68
|
+
"data-slot": "tabs-list",
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function TabsHighlightItem(props) {
|
|
73
|
+
return /* @__PURE__ */ jsx(HighlightItem, {
|
|
74
|
+
"data-slot": "tabs-highlight-item",
|
|
75
|
+
...props
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function TabsTrigger({ ref, value, asChild = false, ...props }) {
|
|
79
|
+
const { activeValue, handleValueChange, registerTrigger } = useTabs();
|
|
80
|
+
const localRef = React$1.useRef(null);
|
|
81
|
+
React$1.useImperativeHandle(ref, () => localRef.current);
|
|
82
|
+
React$1.useEffect(() => {
|
|
83
|
+
registerTrigger(value, localRef.current);
|
|
84
|
+
return () => registerTrigger(value, null);
|
|
85
|
+
}, [value, registerTrigger]);
|
|
86
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : motion.button, {
|
|
87
|
+
ref: localRef,
|
|
88
|
+
"data-slot": "tabs-trigger",
|
|
89
|
+
role: "tab",
|
|
90
|
+
onClick: () => handleValueChange(value),
|
|
91
|
+
"data-state": activeValue === value ? "active" : "inactive",
|
|
92
|
+
...props
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function TabsContents({ children, transition = {
|
|
96
|
+
type: "spring",
|
|
97
|
+
stiffness: 300,
|
|
98
|
+
damping: 30,
|
|
99
|
+
bounce: 0,
|
|
100
|
+
restDelta: .01
|
|
101
|
+
}, ...props }) {
|
|
102
|
+
const { activeValue } = useTabs();
|
|
103
|
+
const childrenArray = React$1.Children.toArray(children);
|
|
104
|
+
const activeIndex = childrenArray.findIndex((child) => React$1.isValidElement(child) && typeof child.props === "object" && child.props !== null && "value" in child.props && child.props.value === activeValue);
|
|
105
|
+
const containerRef = React$1.useRef(null);
|
|
106
|
+
const itemRefs = React$1.useRef([]);
|
|
107
|
+
const [height, setHeight] = React$1.useState(0);
|
|
108
|
+
const roRef = React$1.useRef(null);
|
|
109
|
+
const measure = React$1.useCallback((index) => {
|
|
110
|
+
const pane = itemRefs.current[index];
|
|
111
|
+
const container = containerRef.current;
|
|
112
|
+
if (!pane || !container) return 0;
|
|
113
|
+
const base = pane.getBoundingClientRect().height || 0;
|
|
114
|
+
const cs = getComputedStyle(container);
|
|
115
|
+
const isBorderBox = cs.boxSizing === "border-box";
|
|
116
|
+
const paddingY = (parseFloat(cs.paddingTop || "0") || 0) + (parseFloat(cs.paddingBottom || "0") || 0);
|
|
117
|
+
const borderY = (parseFloat(cs.borderTopWidth || "0") || 0) + (parseFloat(cs.borderBottomWidth || "0") || 0);
|
|
118
|
+
let total = base + (isBorderBox ? paddingY + borderY : 0);
|
|
119
|
+
const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
120
|
+
total = Math.ceil(total * dpr) / dpr;
|
|
121
|
+
return total;
|
|
122
|
+
}, []);
|
|
123
|
+
React$1.useEffect(() => {
|
|
124
|
+
if (roRef.current) {
|
|
125
|
+
roRef.current.disconnect();
|
|
126
|
+
roRef.current = null;
|
|
127
|
+
}
|
|
128
|
+
const pane = itemRefs.current[activeIndex];
|
|
129
|
+
const container = containerRef.current;
|
|
130
|
+
if (!pane || !container) return;
|
|
131
|
+
setHeight(measure(activeIndex));
|
|
132
|
+
const ro = new ResizeObserver(() => {
|
|
133
|
+
const next = measure(activeIndex);
|
|
134
|
+
requestAnimationFrame(() => setHeight(next));
|
|
135
|
+
});
|
|
136
|
+
ro.observe(pane);
|
|
137
|
+
ro.observe(container);
|
|
138
|
+
roRef.current = ro;
|
|
139
|
+
return () => {
|
|
140
|
+
ro.disconnect();
|
|
141
|
+
roRef.current = null;
|
|
142
|
+
};
|
|
143
|
+
}, [
|
|
144
|
+
activeIndex,
|
|
145
|
+
childrenArray.length,
|
|
146
|
+
measure
|
|
147
|
+
]);
|
|
148
|
+
React$1.useLayoutEffect(() => {
|
|
149
|
+
if (height === 0 && activeIndex >= 0) {
|
|
150
|
+
const next = measure(activeIndex);
|
|
151
|
+
if (next !== 0) setHeight(next);
|
|
152
|
+
}
|
|
153
|
+
}, [
|
|
154
|
+
activeIndex,
|
|
155
|
+
height,
|
|
156
|
+
measure
|
|
157
|
+
]);
|
|
158
|
+
return /* @__PURE__ */ jsx(motion.div, {
|
|
159
|
+
ref: containerRef,
|
|
160
|
+
"data-slot": "tabs-contents",
|
|
161
|
+
style: { overflow: "hidden" },
|
|
162
|
+
animate: { height },
|
|
163
|
+
transition,
|
|
164
|
+
...props,
|
|
165
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
166
|
+
className: "flex -mx-2",
|
|
167
|
+
animate: { x: activeIndex * -100 + "%" },
|
|
168
|
+
transition,
|
|
169
|
+
children: childrenArray.map((child, index) => /* @__PURE__ */ jsx("div", {
|
|
170
|
+
ref: (el) => {
|
|
171
|
+
itemRefs.current[index] = el;
|
|
172
|
+
},
|
|
173
|
+
className: "w-full shrink-0 px-2 h-full",
|
|
174
|
+
children: child
|
|
175
|
+
}, index))
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function TabsContent({ value, style, asChild = false, ...props }) {
|
|
180
|
+
const { activeValue } = useTabs();
|
|
181
|
+
const isActive = activeValue === value;
|
|
182
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : motion.div, {
|
|
183
|
+
role: "tabpanel",
|
|
184
|
+
"data-slot": "tabs-content",
|
|
185
|
+
inert: !isActive,
|
|
186
|
+
style: {
|
|
187
|
+
overflow: "hidden",
|
|
188
|
+
...style
|
|
189
|
+
},
|
|
190
|
+
initial: { filter: "blur(0px)" },
|
|
191
|
+
animate: { filter: isActive ? "blur(0px)" : "blur(4px)" },
|
|
192
|
+
exit: { filter: "blur(0px)" },
|
|
193
|
+
transition: {
|
|
194
|
+
type: "spring",
|
|
195
|
+
stiffness: 200,
|
|
196
|
+
damping: 25
|
|
197
|
+
},
|
|
198
|
+
...props
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
//#endregion
|
|
202
|
+
export { Tabs, TabsContent, TabsContents, TabsHighlight, TabsHighlightItem, TabsList, TabsTrigger, useTabs };
|