@inkeep/agents-ui 0.1.0 → 0.14.9
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/LICENSE +64 -0
- package/README.md +1 -67
- package/dist/_virtual/index.cjs +1 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.development.cjs +1 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.production.cjs +1 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +5 -0
- package/dist/color-mode/index.cjs +1 -0
- package/dist/color-mode/index.js +170 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +5093 -0
- package/dist/index.d.ts +5093 -0
- package/dist/index.js +213 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +9 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +68 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs +9 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +56 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.cjs +1 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js +8 -0
- package/dist/primitives/atoms/avatars/ai.cjs +1 -0
- package/dist/primitives/atoms/avatars/ai.js +99 -0
- package/dist/primitives/atoms/avatars/user.cjs +1 -0
- package/dist/primitives/atoms/avatars/user.js +27 -0
- package/dist/primitives/atoms/cmdk/command-score.cjs +1 -0
- package/dist/primitives/atoms/cmdk/command-score.js +46 -0
- package/dist/primitives/atoms/cmdk/index.cjs +1 -0
- package/dist/primitives/atoms/cmdk/index.js +521 -0
- package/dist/primitives/atoms/codeblock/index.cjs +1 -0
- package/dist/primitives/atoms/codeblock/index.js +40 -0
- package/dist/primitives/atoms/custom-styles.cjs +1 -0
- package/dist/primitives/atoms/custom-styles.js +57 -0
- package/dist/primitives/atoms/dialog.cjs +1 -0
- package/dist/primitives/atoms/dialog.js +226 -0
- package/dist/primitives/atoms/error-boundary.cjs +1 -0
- package/dist/primitives/atoms/error-boundary.js +9 -0
- package/dist/primitives/atoms/icons/built-in-icon-renderer.cjs +1 -0
- package/dist/primitives/atoms/icons/built-in-icon-renderer.js +51 -0
- package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -0
- package/dist/primitives/atoms/icons/built-in-icons.js +86 -0
- package/dist/primitives/atoms/icons/checkbox-icon.cjs +1 -0
- package/dist/primitives/atoms/icons/checkbox-icon.js +24 -0
- package/dist/primitives/atoms/icons/collections/bi.cjs +1 -0
- package/dist/primitives/atoms/icons/collections/bi.js +49 -0
- package/dist/primitives/atoms/icons/collections/fi.cjs +1 -0
- package/dist/primitives/atoms/icons/collections/fi.js +29 -0
- package/dist/primitives/atoms/icons/collections/gr.cjs +1 -0
- package/dist/primitives/atoms/icons/collections/gr.js +21 -0
- package/dist/primitives/atoms/icons/collections/io5.cjs +1 -0
- package/dist/primitives/atoms/icons/collections/io5.js +806 -0
- package/dist/primitives/atoms/icons/collections/pi.cjs +1 -0
- package/dist/primitives/atoms/icons/collections/pi.js +49 -0
- package/dist/primitives/atoms/icons/custom-icon.cjs +1 -0
- package/dist/primitives/atoms/icons/custom-icon.js +19 -0
- package/dist/primitives/atoms/icons/generate-icon.cjs +1 -0
- package/dist/primitives/atoms/icons/generate-icon.js +56 -0
- package/dist/primitives/atoms/icons/index.cjs +1 -0
- package/dist/primitives/atoms/icons/index.js +6 -0
- package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -0
- package/dist/primitives/atoms/icons/inkeep-default-icons.js +24 -0
- package/dist/primitives/atoms/link.cjs +1 -0
- package/dist/primitives/atoms/link.js +35 -0
- package/dist/primitives/atoms/markdown/components.cjs +1 -0
- package/dist/primitives/atoms/markdown/components.js +73 -0
- package/dist/primitives/atoms/markdown/index.cjs +1 -0
- package/dist/primitives/atoms/markdown/index.js +115 -0
- package/dist/primitives/atoms/markdown/rehype-inline-code-property.cjs +1 -0
- package/dist/primitives/atoms/markdown/rehype-inline-code-property.js +12 -0
- package/dist/primitives/atoms/portal-with-theme.cjs +1 -0
- package/dist/primitives/atoms/portal-with-theme.js +12 -0
- package/dist/primitives/atoms/portal.cjs +1 -0
- package/dist/primitives/atoms/portal.js +19 -0
- package/dist/primitives/atoms/select.cjs +1 -0
- package/dist/primitives/atoms/select.js +785 -0
- package/dist/primitives/atoms/shadow/context.cjs +1 -0
- package/dist/primitives/atoms/shadow/context.js +54 -0
- package/dist/primitives/atoms/shadow/create.cjs +1 -0
- package/dist/primitives/atoms/shadow/create.js +56 -0
- package/dist/primitives/atoms/shadow/root.cjs +1 -0
- package/dist/primitives/atoms/shadow/root.js +22 -0
- package/dist/primitives/atoms/shadow/use-ensured-forwarded-ref.cjs +1 -0
- package/dist/primitives/atoms/shadow/use-ensured-forwarded-ref.js +11 -0
- package/dist/primitives/atoms/shadow/utils.cjs +1 -0
- package/dist/primitives/atoms/shadow/utils.js +16 -0
- package/dist/primitives/components/chat-button.cjs +1 -0
- package/dist/primitives/components/chat-button.js +46 -0
- package/dist/primitives/components/embedded-chat/chat-provider.cjs +1 -0
- package/dist/primitives/components/embedded-chat/chat-provider.js +20 -0
- package/dist/primitives/components/embedded-chat/use-chat-action.cjs +1 -0
- package/dist/primitives/components/embedded-chat/use-chat-action.js +38 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +3 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +160 -0
- package/dist/primitives/components/embedded-chat/use-stream-processor.cjs +1 -0
- package/dist/primitives/components/embedded-chat/use-stream-processor.js +82 -0
- package/dist/primitives/components/embedded-chat.cjs +11 -0
- package/dist/primitives/components/embedded-chat.js +1898 -0
- package/dist/primitives/components/embedded-search/search-provider.cjs +1 -0
- package/dist/primitives/components/embedded-search/search-provider.js +26 -0
- package/dist/primitives/components/embedded-search/transform-results.cjs +1 -0
- package/dist/primitives/components/embedded-search/transform-results.js +47 -0
- package/dist/primitives/components/embedded-search/url-query.cjs +1 -0
- package/dist/primitives/components/embedded-search/url-query.js +12 -0
- package/dist/primitives/components/embedded-search/use-inkeep-search.cjs +1 -0
- package/dist/primitives/components/embedded-search/use-inkeep-search.js +35 -0
- package/dist/primitives/components/embedded-search/use-search-filter.cjs +1 -0
- package/dist/primitives/components/embedded-search/use-search-filter.js +77 -0
- package/dist/primitives/components/embedded-search.cjs +1 -0
- package/dist/primitives/components/embedded-search.js +628 -0
- package/dist/primitives/components/factory.cjs +1 -0
- package/dist/primitives/components/factory.js +39 -0
- package/dist/primitives/components/index.cjs +1 -0
- package/dist/primitives/components/index.js +27 -0
- package/dist/primitives/components/modal/modal-provider.cjs +1 -0
- package/dist/primitives/components/modal/modal-provider.js +8 -0
- package/dist/primitives/components/modal/use-inkeep-modal.cjs +1 -0
- package/dist/primitives/components/modal/use-inkeep-modal.js +45 -0
- package/dist/primitives/components/modal/widget-auto-focus.cjs +1 -0
- package/dist/primitives/components/modal/widget-auto-focus.js +16 -0
- package/dist/primitives/components/modal.cjs +1 -0
- package/dist/primitives/components/modal.js +40 -0
- package/dist/primitives/components/presence.cjs +1 -0
- package/dist/primitives/components/presence.js +26 -0
- package/dist/primitives/components/searchbar.cjs +1 -0
- package/dist/primitives/components/searchbar.js +54 -0
- package/dist/primitives/components/sidebar-chat/index.cjs +1 -0
- package/dist/primitives/components/sidebar-chat/index.js +86 -0
- package/dist/primitives/components/sidebar-chat/use-sidebar-chat-resizer.cjs +1 -0
- package/dist/primitives/components/sidebar-chat/use-sidebar-chat-resizer.js +34 -0
- package/dist/primitives/components/tagline-logo-icon.cjs +1 -0
- package/dist/primitives/components/tagline-logo-icon.js +26 -0
- package/dist/primitives/components/use-component-trigger.cjs +1 -0
- package/dist/primitives/components/use-component-trigger.js +16 -0
- package/dist/primitives/constants/search.cjs +1 -0
- package/dist/primitives/constants/search.js +5 -0
- package/dist/primitives/hooks/index.cjs +1 -0
- package/dist/primitives/hooks/index.js +24 -0
- package/dist/primitives/hooks/use-boolean.cjs +1 -0
- package/dist/primitives/hooks/use-boolean.js +17 -0
- package/dist/primitives/hooks/use-component-classnames.cjs +1 -0
- package/dist/primitives/hooks/use-component-classnames.js +14 -0
- package/dist/primitives/hooks/use-container-size.cjs +1 -0
- package/dist/primitives/hooks/use-container-size.js +18 -0
- package/dist/primitives/hooks/use-copy-to-clipboard.cjs +1 -0
- package/dist/primitives/hooks/use-copy-to-clipboard.js +24 -0
- package/dist/primitives/hooks/use-debounce.cjs +1 -0
- package/dist/primitives/hooks/use-debounce.js +16 -0
- package/dist/primitives/hooks/use-instant-update.cjs +1 -0
- package/dist/primitives/hooks/use-instant-update.js +16 -0
- package/dist/primitives/hooks/use-is-mounted.cjs +1 -0
- package/dist/primitives/hooks/use-is-mounted.js +11 -0
- package/dist/primitives/hooks/use-media-query.cjs +1 -0
- package/dist/primitives/hooks/use-media-query.js +14 -0
- package/dist/primitives/hooks/use-resize-observer.cjs +1 -0
- package/dist/primitives/hooks/use-resize-observer.js +32 -0
- package/dist/primitives/hooks/use-scroll-to-bottom.cjs +1 -0
- package/dist/primitives/hooks/use-scroll-to-bottom.js +52 -0
- package/dist/primitives/hooks/use-scrolling-fades.cjs +1 -0
- package/dist/primitives/hooks/use-scrolling-fades.js +18 -0
- package/dist/primitives/hooks/use-settle-action.cjs +1 -0
- package/dist/primitives/hooks/use-settle-action.js +11 -0
- package/dist/primitives/index.cjs +1 -0
- package/dist/primitives/index.js +155 -0
- package/dist/primitives/providers/attachment-item-provider.cjs +1 -0
- package/dist/primitives/providers/attachment-item-provider.js +13 -0
- package/dist/primitives/providers/attachments-bar-provider.cjs +1 -0
- package/dist/primitives/providers/attachments-bar-provider.js +57 -0
- package/dist/primitives/providers/base-events-provider.cjs +1 -0
- package/dist/primitives/providers/base-events-provider.js +37 -0
- package/dist/primitives/providers/chat-form-provider.cjs +1 -0
- package/dist/primitives/providers/chat-form-provider.js +109 -0
- package/dist/primitives/providers/config-provider.cjs +1 -0
- package/dist/primitives/providers/config-provider.js +38 -0
- package/dist/primitives/providers/feedback-item-provider.cjs +1 -0
- package/dist/primitives/providers/feedback-item-provider.js +16 -0
- package/dist/primitives/providers/feedback-provider.cjs +1 -0
- package/dist/primitives/providers/feedback-provider.js +83 -0
- package/dist/primitives/providers/form-field-provider.cjs +1 -0
- package/dist/primitives/providers/form-field-provider.js +17 -0
- package/dist/primitives/providers/help-menu-provider.cjs +1 -0
- package/dist/primitives/providers/help-menu-provider.js +19 -0
- package/dist/primitives/providers/hover-popover-provider.cjs +1 -0
- package/dist/primitives/providers/hover-popover-provider.js +13 -0
- package/dist/primitives/providers/index.cjs +1 -0
- package/dist/primitives/providers/index.js +57 -0
- package/dist/primitives/providers/markdown-provider.cjs +1 -0
- package/dist/primitives/providers/markdown-provider.js +8 -0
- package/dist/primitives/providers/message-attachments-provider.cjs +1 -0
- package/dist/primitives/providers/message-attachments-provider.js +27 -0
- package/dist/primitives/providers/message-provider.cjs +1 -0
- package/dist/primitives/providers/message-provider.js +14 -0
- package/dist/primitives/providers/root-provider.cjs +1 -0
- package/dist/primitives/providers/root-provider.js +21 -0
- package/dist/primitives/providers/search-events-provider.cjs +1 -0
- package/dist/primitives/providers/search-events-provider.js +17 -0
- package/dist/primitives/providers/sidebar-chat-provider.cjs +1 -0
- package/dist/primitives/providers/sidebar-chat-provider.js +41 -0
- package/dist/primitives/providers/source-item-provider.cjs +1 -0
- package/dist/primitives/providers/source-item-provider.js +13 -0
- package/dist/primitives/providers/theme-provider.cjs +3 -0
- package/dist/primitives/providers/theme-provider.js +79 -0
- package/dist/primitives/providers/widget-provider.cjs +1 -0
- package/dist/primitives/providers/widget-provider.js +8 -0
- package/dist/primitives/utils/component-ids.cjs +1 -0
- package/dist/primitives/utils/component-ids.js +309 -0
- package/dist/primitives/utils/compose-event-handlers.cjs +1 -0
- package/dist/primitives/utils/compose-event-handlers.js +10 -0
- package/dist/primitives/utils/compose-refs.cjs +1 -0
- package/dist/primitives/utils/compose-refs.js +30 -0
- package/dist/primitives/utils/default-settings.cjs +1 -0
- package/dist/primitives/utils/default-settings.js +50 -0
- package/dist/primitives/utils/form.cjs +1 -0
- package/dist/primitives/utils/form.js +17 -0
- package/dist/primitives/utils/generate-uid.cjs +1 -0
- package/dist/primitives/utils/generate-uid.js +14 -0
- package/dist/primitives/utils/get-source-icon.cjs +1 -0
- package/dist/primitives/utils/get-source-icon.js +11 -0
- package/dist/primitives/utils/highlight-emphasis.cjs +1 -0
- package/dist/primitives/utils/highlight-emphasis.js +15 -0
- package/dist/primitives/utils/merge-props.cjs +1 -0
- package/dist/primitives/utils/merge-props.js +41 -0
- package/dist/primitives/utils/misc.cjs +1 -0
- package/dist/primitives/utils/misc.js +31 -0
- package/dist/primitives/utils/split-props.cjs +1 -0
- package/dist/primitives/utils/split-props.js +10 -0
- package/dist/react/chat-button.cjs +1 -0
- package/dist/react/chat-button.js +60 -0
- package/dist/react/embedded-chat.cjs +1 -0
- package/dist/react/embedded-chat.js +380 -0
- package/dist/react/embedded-search-and-chat.cjs +1 -0
- package/dist/react/embedded-search-and-chat.impl.cjs +1 -0
- package/dist/react/embedded-search-and-chat.impl.js +43 -0
- package/dist/react/embedded-search-and-chat.js +66 -0
- package/dist/react/embedded-search.cjs +1 -0
- package/dist/react/embedded-search.js +181 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.js +213 -0
- package/dist/react/modal.chat.cjs +1 -0
- package/dist/react/modal.chat.js +21 -0
- package/dist/react/modal.cjs +1 -0
- package/dist/react/modal.js +27 -0
- package/dist/react/modal.search-and-chat.cjs +1 -0
- package/dist/react/modal.search-and-chat.js +27 -0
- package/dist/react/modal.search.cjs +1 -0
- package/dist/react/modal.search.js +21 -0
- package/dist/react/searchbar.cjs +1 -0
- package/dist/react/searchbar.js +68 -0
- package/dist/react/sidebar-chat.cjs +1 -0
- package/dist/react/sidebar-chat.js +49 -0
- package/dist/react/utils.cjs +1 -0
- package/dist/react/utils.js +20 -0
- package/dist/react/widget-toggle.cjs +1 -0
- package/dist/react/widget-toggle.js +65 -0
- package/dist/styled/components/chat-button.cjs +1 -0
- package/dist/styled/components/chat-button.js +56 -0
- package/dist/styled/components/data-summary-group.cjs +1 -0
- package/dist/styled/components/data-summary-group.js +76 -0
- package/dist/styled/components/embedded-chat.cjs +1 -0
- package/dist/styled/components/embedded-chat.js +1816 -0
- package/dist/styled/components/embedded-search/results-loading.cjs +1 -0
- package/dist/styled/components/embedded-search/results-loading.js +39 -0
- package/dist/styled/components/embedded-search.cjs +1 -0
- package/dist/styled/components/embedded-search.js +680 -0
- package/dist/styled/components/index.cjs +1 -0
- package/dist/styled/components/index.js +24 -0
- package/dist/styled/components/loading-indicator.cjs +1 -0
- package/dist/styled/components/loading-indicator.js +36 -0
- package/dist/styled/components/message.cjs +1 -0
- package/dist/styled/components/message.js +140 -0
- package/dist/styled/components/modal.cjs +1 -0
- package/dist/styled/components/modal.js +46 -0
- package/dist/styled/components/searchbar.cjs +1 -0
- package/dist/styled/components/searchbar.js +81 -0
- package/dist/styled/components/shadow.cjs +1 -0
- package/dist/styled/components/shadow.js +8 -0
- package/dist/styled/components/sidebar-chat.cjs +1 -0
- package/dist/styled/components/sidebar-chat.js +90 -0
- package/dist/styled/components/ui/markdown-styles.cjs +1 -0
- package/dist/styled/components/ui/markdown-styles.js +38 -0
- package/dist/styled/components/ui/recipes/ai-chat-page-wrapper.cjs +1 -0
- package/dist/styled/components/ui/recipes/ai-chat-page-wrapper.js +32 -0
- package/dist/styled/components/ui/recipes/attachment.cjs +1 -0
- package/dist/styled/components/ui/recipes/attachment.js +28 -0
- package/dist/styled/components/ui/recipes/button.cjs +1 -0
- package/dist/styled/components/ui/recipes/button.js +81 -0
- package/dist/styled/components/ui/recipes/checkbox.cjs +1 -0
- package/dist/styled/components/ui/recipes/checkbox.js +23 -0
- package/dist/styled/components/ui/recipes/citation.cjs +1 -0
- package/dist/styled/components/ui/recipes/citation.js +75 -0
- package/dist/styled/components/ui/recipes/icon.cjs +1 -0
- package/dist/styled/components/ui/recipes/icon.js +6 -0
- package/dist/styled/components/ui/recipes/index.cjs +1 -0
- package/dist/styled/components/ui/recipes/index.js +37 -0
- package/dist/styled/components/ui/recipes/input.cjs +1 -0
- package/dist/styled/components/ui/recipes/input.js +34 -0
- package/dist/styled/components/ui/recipes/link.cjs +1 -0
- package/dist/styled/components/ui/recipes/link.js +13 -0
- package/dist/styled/components/ui/recipes/markdown.cjs +1 -0
- package/dist/styled/components/ui/recipes/markdown.js +103 -0
- package/dist/styled/components/ui/recipes/modal.cjs +1 -0
- package/dist/styled/components/ui/recipes/modal.js +59 -0
- package/dist/styled/components/ui/recipes/popover.cjs +1 -0
- package/dist/styled/components/ui/recipes/popover.js +20 -0
- package/dist/styled/components/ui/recipes/scrollable.cjs +1 -0
- package/dist/styled/components/ui/recipes/scrollable.js +15 -0
- package/dist/styled/components/ui/recipes/select.cjs +1 -0
- package/dist/styled/components/ui/recipes/select.js +38 -0
- package/dist/styled/components/ui/recipes/skeleton.cjs +1 -0
- package/dist/styled/components/ui/recipes/skeleton.js +16 -0
- package/dist/styled/components/ui/recipes/widget-toggle.cjs +1 -0
- package/dist/styled/components/ui/recipes/widget-toggle.js +35 -0
- package/dist/styled/index.cjs +1 -0
- package/dist/styled/index.js +177 -0
- package/dist/styled/inkeep.css.cjs +4049 -0
- package/dist/styled/inkeep.css.js +4053 -0
- package/dist/styled/utils.cjs +1 -0
- package/dist/styled/utils.js +11 -0
- package/dist/theme/color-utils.cjs +1 -0
- package/dist/theme/color-utils.js +21 -0
- package/dist/theme/colors.cjs +1 -0
- package/dist/theme/colors.js +143 -0
- package/dist/theme/index.cjs +1 -0
- package/dist/theme/index.js +58 -0
- package/dist/theme/utils/create-css-variables.cjs +1 -0
- package/dist/theme/utils/create-css-variables.js +24 -0
- package/dist/theme/utils/generate-theme-variables.cjs +1 -0
- package/dist/theme/utils/generate-theme-variables.js +34 -0
- package/dist/types/message.cjs +1 -0
- package/dist/types/message.js +5 -0
- package/dist/types/types.d.cts +1754 -0
- package/dist/types/types.d.ts +1754 -0
- package/package.json +132 -39
- package/LICENSE.md +0 -51
- package/dist/assets/index-3anqgmEs.js +0 -49
- package/dist/assets/index-CF_BRP1w.css +0 -1
- package/dist/index.html +0 -14
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
import { jsxs as Z, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { Root as Ee, Portal as Ce, Overlay as we, Content as ye } from "../dialog.js";
|
|
3
|
+
import * as c from "react";
|
|
4
|
+
import { useCallback as le, useMemo as Ie } from "react";
|
|
5
|
+
import { commandScore as Re } from "./command-score.js";
|
|
6
|
+
import { Primitive as R } from "@radix-ui/react-primitive";
|
|
7
|
+
import { useId as F } from "@radix-ui/react-id";
|
|
8
|
+
import { s as ke } from "../../../node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js";
|
|
9
|
+
import { ASK_AI_TRIGGER_VALUE as xe } from "../../constants/search.js";
|
|
10
|
+
import { composeEventHandlers as Ae } from "../../utils/compose-event-handlers.js";
|
|
11
|
+
import { useWidget as _e } from "../../providers/widget-provider.js";
|
|
12
|
+
import { useShadow as Le } from "../shadow/context.js";
|
|
13
|
+
const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', Me = '[cmdk-group-heading=""]', ae = '[cmdk-item=""]', ue = `${ae}:not([aria-disabled="true"])`, Y = "cmdk-item-select", L = "data-value", Pe = (t, n, r) => Re(t, n, r ?? []), de = c.createContext(void 0), D = () => c.useContext(de), fe = c.createContext(void 0), ee = () => c.useContext(fe), me = c.createContext(void 0), he = c.forwardRef((t, n) => {
|
|
14
|
+
const r = M(() => /* @__PURE__ */ new Set()), i = M(() => /* @__PURE__ */ new Map()), a = M(() => /* @__PURE__ */ new Map()), f = M(() => /* @__PURE__ */ new Set()), s = ve(t), {
|
|
15
|
+
label: h,
|
|
16
|
+
children: d,
|
|
17
|
+
value: S,
|
|
18
|
+
onValueChange: C,
|
|
19
|
+
filter: y,
|
|
20
|
+
shouldFilter: w,
|
|
21
|
+
loop: I,
|
|
22
|
+
disablePointerSelection: _ = !1,
|
|
23
|
+
vimBindings: B = !0,
|
|
24
|
+
defaultSearch: te,
|
|
25
|
+
...N
|
|
26
|
+
} = t, v = M(() => ({
|
|
27
|
+
/** Value of the search query. */
|
|
28
|
+
search: te ?? "",
|
|
29
|
+
/** Currently selected item value. */
|
|
30
|
+
value: t.value ?? t.defaultValue ?? "",
|
|
31
|
+
/** Currently selected item id. */
|
|
32
|
+
selectedItemId: void 0,
|
|
33
|
+
filtered: {
|
|
34
|
+
/** The count of all visible items. */
|
|
35
|
+
count: 0,
|
|
36
|
+
/** Map from visible item id to its search score. */
|
|
37
|
+
items: /* @__PURE__ */ new Map(),
|
|
38
|
+
/** Set of groups with at least one visible item. */
|
|
39
|
+
groups: /* @__PURE__ */ new Set()
|
|
40
|
+
}
|
|
41
|
+
})), U = F(), $ = F(), j = F(), k = c.useRef(null), g = $e();
|
|
42
|
+
A(() => {
|
|
43
|
+
if (S !== void 0) {
|
|
44
|
+
const e = S.trim();
|
|
45
|
+
v.current.value = e, E.emit();
|
|
46
|
+
}
|
|
47
|
+
}, [S]), A(() => {
|
|
48
|
+
g(6, ne);
|
|
49
|
+
}, []);
|
|
50
|
+
const G = Le(), E = c.useMemo(() => ({
|
|
51
|
+
subscribe: (e) => (f.current.add(e), () => f.current.delete(e)),
|
|
52
|
+
snapshot: () => v.current,
|
|
53
|
+
setState: (e, l, o) => {
|
|
54
|
+
if (!Object.is(v.current[e], l)) {
|
|
55
|
+
if (v.current[e] = l, e === "search")
|
|
56
|
+
W(), z(), g(1, H);
|
|
57
|
+
else if (e === "value" && (G?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input") || g(1, () => {
|
|
58
|
+
x()?.focus();
|
|
59
|
+
}), g(7, () => {
|
|
60
|
+
v.current.selectedItemId = x()?.id, E.emit();
|
|
61
|
+
}), o || g(5, ne), s.current?.value !== void 0)) {
|
|
62
|
+
const b = l ?? "";
|
|
63
|
+
s.current.onValueChange?.(b);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
E.emit();
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
emit: () => {
|
|
70
|
+
f.current.forEach((e) => e());
|
|
71
|
+
}
|
|
72
|
+
}), []), q = c.useMemo(
|
|
73
|
+
() => ({
|
|
74
|
+
// Keep id → {value, keywords} mapping up-to-date
|
|
75
|
+
value: (e, l, o) => {
|
|
76
|
+
l !== a.current.get(e)?.value && (a.current.set(e, { value: l, keywords: o }), v.current.filtered.items.set(e, re(l, o)), g(2, () => {
|
|
77
|
+
z(), E.emit();
|
|
78
|
+
}));
|
|
79
|
+
},
|
|
80
|
+
// Track item lifecycle (mount, unmount)
|
|
81
|
+
item: (e, l) => (r.current.add(e), l && (i.current.has(l) ? i.current?.get(l)?.add(e) : i.current.set(l, /* @__PURE__ */ new Set([e]))), g(3, () => {
|
|
82
|
+
W(), z(), v.current.value || H(), E.emit();
|
|
83
|
+
}), () => {
|
|
84
|
+
a.current.delete(e), r.current.delete(e), v.current.filtered.items.delete(e);
|
|
85
|
+
const o = x();
|
|
86
|
+
g(4, () => {
|
|
87
|
+
W(), o?.getAttribute("id") === e && H(), E.emit();
|
|
88
|
+
});
|
|
89
|
+
}),
|
|
90
|
+
// Track group lifecycle (mount, unmount)
|
|
91
|
+
group: (e) => (i.current.has(e) || i.current.set(e, /* @__PURE__ */ new Set()), () => {
|
|
92
|
+
a.current.delete(e), i.current.delete(e);
|
|
93
|
+
}),
|
|
94
|
+
filter: () => !!s.current.shouldFilter,
|
|
95
|
+
label: h || t["aria-label"] || "",
|
|
96
|
+
getDisablePointerSelection: () => !!s.current.disablePointerSelection,
|
|
97
|
+
listId: U,
|
|
98
|
+
inputId: j,
|
|
99
|
+
labelId: $,
|
|
100
|
+
listInnerRef: k
|
|
101
|
+
}),
|
|
102
|
+
[]
|
|
103
|
+
);
|
|
104
|
+
function re(e, l) {
|
|
105
|
+
const o = s.current?.filter ?? Pe;
|
|
106
|
+
return e ? o?.(e, v.current.search, l) : 0;
|
|
107
|
+
}
|
|
108
|
+
function z() {
|
|
109
|
+
if (!v.current.search || // Explicitly false, because true | undefined is the default
|
|
110
|
+
s.current.shouldFilter === !1)
|
|
111
|
+
return;
|
|
112
|
+
const e = v.current.filtered.items, l = [];
|
|
113
|
+
v.current.filtered.groups.forEach((u) => {
|
|
114
|
+
const m = i.current.get(u);
|
|
115
|
+
let b = 0;
|
|
116
|
+
m.forEach((Q) => {
|
|
117
|
+
const Se = e.get(Q);
|
|
118
|
+
b = Math.max(Se, b);
|
|
119
|
+
}), l.push([u, b]);
|
|
120
|
+
});
|
|
121
|
+
const o = k.current;
|
|
122
|
+
V().sort((u, m) => {
|
|
123
|
+
const b = u.getAttribute("id"), Q = m.getAttribute("id");
|
|
124
|
+
return (e.get(Q) ?? 0) - (e.get(b) ?? 0);
|
|
125
|
+
}).forEach((u) => {
|
|
126
|
+
const m = u.closest(X);
|
|
127
|
+
if (m) {
|
|
128
|
+
const b = u.parentElement === m ? u : u.closest(`${X} > *`);
|
|
129
|
+
b && m.appendChild(b);
|
|
130
|
+
} else {
|
|
131
|
+
const b = u.parentElement === o ? u : u.closest(`${X} > *`);
|
|
132
|
+
b && o?.appendChild(b);
|
|
133
|
+
}
|
|
134
|
+
}), l.sort((u, m) => m[1] - u[1]).forEach((u) => {
|
|
135
|
+
const m = k.current?.querySelector(
|
|
136
|
+
`${T}[${L}="${encodeURIComponent(u[0])}"]`
|
|
137
|
+
);
|
|
138
|
+
m?.parentElement?.appendChild(m);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function H() {
|
|
142
|
+
const l = V().find(
|
|
143
|
+
(o) => o.getAttribute("aria-disabled") !== "true" && o.getAttribute("data-value") !== xe
|
|
144
|
+
)?.getAttribute(L);
|
|
145
|
+
E.setState("value", l || void 0);
|
|
146
|
+
}
|
|
147
|
+
function W() {
|
|
148
|
+
if (!v.current.search || // Explicitly false, because true | undefined is the default
|
|
149
|
+
s.current.shouldFilter === !1) {
|
|
150
|
+
v.current.filtered.count = r.current.size;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
v.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
154
|
+
let e = 0;
|
|
155
|
+
for (const l of r.current) {
|
|
156
|
+
const o = a.current.get(l)?.value ?? "", u = a.current.get(l)?.keywords ?? [], m = re(o, u);
|
|
157
|
+
v.current.filtered.items.set(l, m), m > 0 && e++;
|
|
158
|
+
}
|
|
159
|
+
for (const [l, o] of i.current)
|
|
160
|
+
for (const u of o) {
|
|
161
|
+
const m = v.current.filtered.items.get(u);
|
|
162
|
+
if (m && m > 0) {
|
|
163
|
+
v.current.filtered.groups.add(l);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
v.current.filtered.count = e;
|
|
168
|
+
}
|
|
169
|
+
function ne() {
|
|
170
|
+
const e = x();
|
|
171
|
+
e && (e.parentElement?.firstChild === e && e.closest(T)?.querySelector(Me)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
|
|
172
|
+
}
|
|
173
|
+
function x() {
|
|
174
|
+
return k.current?.querySelector(`${ae}[aria-selected="true"]`);
|
|
175
|
+
}
|
|
176
|
+
function V() {
|
|
177
|
+
return Array.from(k.current?.querySelectorAll(ue) || []);
|
|
178
|
+
}
|
|
179
|
+
function oe(e) {
|
|
180
|
+
const o = V()[e];
|
|
181
|
+
o && E.setState("value", o.getAttribute(L));
|
|
182
|
+
}
|
|
183
|
+
function J(e) {
|
|
184
|
+
const l = x(), o = V(), u = o.findIndex((b) => b === l);
|
|
185
|
+
let m = o[u + e];
|
|
186
|
+
s.current?.loop && (m = u + e < 0 ? o[o.length - 1] : u + e === o.length ? o[0] : o[u + e]), m && E.setState("value", m.getAttribute(L));
|
|
187
|
+
}
|
|
188
|
+
function ce(e) {
|
|
189
|
+
let o = x()?.closest(T), u;
|
|
190
|
+
for (; o && !u; )
|
|
191
|
+
o = e > 0 ? Ne(o, T) : Ue(o, T), u = o?.querySelector(ue);
|
|
192
|
+
u ? E.setState("value", u.getAttribute(L)) : J(e);
|
|
193
|
+
}
|
|
194
|
+
const pe = () => oe(V().length - 1), se = (e) => {
|
|
195
|
+
e.preventDefault(), e.metaKey ? pe() : e.altKey ? ce(1) : J(1);
|
|
196
|
+
}, ie = (e) => {
|
|
197
|
+
e.preventDefault(), e.metaKey ? oe(0) : e.altKey ? ce(-1) : J(-1);
|
|
198
|
+
}, be = _e();
|
|
199
|
+
return /* @__PURE__ */ Z(
|
|
200
|
+
R.div,
|
|
201
|
+
{
|
|
202
|
+
ref: n,
|
|
203
|
+
tabIndex: -1,
|
|
204
|
+
...N,
|
|
205
|
+
"cmdk-root": "",
|
|
206
|
+
onKeyDown: (e) => {
|
|
207
|
+
if (be?.view === "search" && (N.onKeyDown?.(e), !e.defaultPrevented))
|
|
208
|
+
switch (e.key) {
|
|
209
|
+
case "n":
|
|
210
|
+
case "j": {
|
|
211
|
+
B && e.ctrlKey && se(e);
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
case "ArrowDown": {
|
|
215
|
+
se(e);
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
case "p":
|
|
219
|
+
case "k": {
|
|
220
|
+
B && e.ctrlKey && ie(e);
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
case "ArrowUp": {
|
|
224
|
+
ie(e);
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
case "Enter":
|
|
228
|
+
if (!e.nativeEvent.isComposing && e.keyCode !== 229) {
|
|
229
|
+
e.preventDefault();
|
|
230
|
+
const l = x();
|
|
231
|
+
if (l) {
|
|
232
|
+
const o = new Event(Y);
|
|
233
|
+
l.dispatchEvent(o);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
style: {
|
|
239
|
+
display: "contents"
|
|
240
|
+
},
|
|
241
|
+
children: [
|
|
242
|
+
/* @__PURE__ */ p(
|
|
243
|
+
"label",
|
|
244
|
+
{
|
|
245
|
+
"cmdk-label": "",
|
|
246
|
+
htmlFor: q.inputId,
|
|
247
|
+
id: q.labelId,
|
|
248
|
+
style: qe,
|
|
249
|
+
children: h
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
K(t, (e) => /* @__PURE__ */ p(fe.Provider, { value: E, children: /* @__PURE__ */ p(de.Provider, { value: q, children: e }) }))
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
}), Ve = c.forwardRef((t, n) => {
|
|
257
|
+
const { id: r } = t, i = c.useRef(null), a = c.useContext(me), f = D(), s = ve(t), h = s.current?.forceMount ?? a?.forceMount;
|
|
258
|
+
A(() => {
|
|
259
|
+
if (!h)
|
|
260
|
+
return f.item(r, a?.id);
|
|
261
|
+
}, [h]);
|
|
262
|
+
const d = ge(r, i, [t.value, t.children, i], t.keywords), S = ee(), C = P((g) => g.value && g.value === d.current), y = P(
|
|
263
|
+
(g) => h || f.filter() === !1 ? !0 : g.search ? g.filtered.items.get(r) > 0 : !0
|
|
264
|
+
);
|
|
265
|
+
c.useEffect(() => {
|
|
266
|
+
const g = i.current;
|
|
267
|
+
if (!g || t.disabled) return;
|
|
268
|
+
const G = () => I("keyboard");
|
|
269
|
+
return g.addEventListener(Y, G), () => g.removeEventListener(Y, G);
|
|
270
|
+
}, [y, t.onSelect, t.disabled]);
|
|
271
|
+
const w = le(() => {
|
|
272
|
+
S.setState("value", d.current, !0);
|
|
273
|
+
}, [S, d]), I = le(
|
|
274
|
+
(g = "click") => {
|
|
275
|
+
w(), s.current.onSelect?.({ value: d.current, trigger: g });
|
|
276
|
+
},
|
|
277
|
+
[w, s, d]
|
|
278
|
+
);
|
|
279
|
+
if (!y) return null;
|
|
280
|
+
const {
|
|
281
|
+
disabled: _,
|
|
282
|
+
value: B,
|
|
283
|
+
onSelect: te,
|
|
284
|
+
forceMount: N,
|
|
285
|
+
keywords: v,
|
|
286
|
+
onClick: U,
|
|
287
|
+
...$
|
|
288
|
+
} = t, j = Ie(() => O([i, n]), [i, n]), k = Ae(U, I);
|
|
289
|
+
return /* @__PURE__ */ p(
|
|
290
|
+
R.div,
|
|
291
|
+
{
|
|
292
|
+
ref: j,
|
|
293
|
+
...$,
|
|
294
|
+
id: r,
|
|
295
|
+
"cmdk-item": "",
|
|
296
|
+
role: "option",
|
|
297
|
+
"aria-disabled": !!_,
|
|
298
|
+
"aria-selected": !!C,
|
|
299
|
+
"data-disabled": !!_,
|
|
300
|
+
"data-selected": !!C,
|
|
301
|
+
onPointerMove: _ || f.getDisablePointerSelection() ? void 0 : w,
|
|
302
|
+
onClick: _ ? void 0 : k,
|
|
303
|
+
onFocus: _ ? void 0 : w,
|
|
304
|
+
children: t.children
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
}), Te = c.forwardRef((t, n) => {
|
|
308
|
+
const { heading: r, children: i, forceMount: a, ...f } = t, s = F(), h = c.useRef(null), d = c.useRef(null), S = F(), C = D(), y = P(
|
|
309
|
+
(I) => a || C.filter() === !1 ? !0 : I.search ? I.filtered.groups.has(s) : !0
|
|
310
|
+
);
|
|
311
|
+
A(() => C.group(s), []), ge(s, h, [t.value, t.heading, d]);
|
|
312
|
+
const w = c.useMemo(() => ({ id: s, forceMount: a }), [a]);
|
|
313
|
+
return /* @__PURE__ */ Z(
|
|
314
|
+
R.div,
|
|
315
|
+
{
|
|
316
|
+
ref: O([h, n]),
|
|
317
|
+
...f,
|
|
318
|
+
"cmdk-group": "",
|
|
319
|
+
role: "presentation",
|
|
320
|
+
hidden: y ? void 0 : !0,
|
|
321
|
+
children: [
|
|
322
|
+
r && /* @__PURE__ */ p("div", { ref: d, "cmdk-group-heading": "", "aria-hidden": !0, id: S, children: r }),
|
|
323
|
+
K(t, (I) => (
|
|
324
|
+
// biome-ignore lint/a11y/useSemanticElements: <explanation>
|
|
325
|
+
/* @__PURE__ */ p("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? S : void 0, children: /* @__PURE__ */ p(me.Provider, { value: w, children: I }) })
|
|
326
|
+
))
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
}), Fe = c.forwardRef((t, n) => {
|
|
331
|
+
const { alwaysRender: r, ...i } = t, a = c.useRef(null), f = P((s) => !s.search);
|
|
332
|
+
return !r && !f ? null : /* @__PURE__ */ p(
|
|
333
|
+
R.div,
|
|
334
|
+
{
|
|
335
|
+
ref: O([a, n]),
|
|
336
|
+
...i,
|
|
337
|
+
"cmdk-separator": "",
|
|
338
|
+
role: "separator"
|
|
339
|
+
}
|
|
340
|
+
);
|
|
341
|
+
}), Oe = c.forwardRef((t, n) => {
|
|
342
|
+
const { onValueChange: r, ...i } = t, a = t.value != null, f = ee(), s = P((d) => d.search), h = D();
|
|
343
|
+
return c.useEffect(() => {
|
|
344
|
+
t.value != null && f.setState("search", t.value);
|
|
345
|
+
}, [t.value]), /* @__PURE__ */ p(
|
|
346
|
+
R.input,
|
|
347
|
+
{
|
|
348
|
+
ref: n,
|
|
349
|
+
...i,
|
|
350
|
+
"cmdk-input": "",
|
|
351
|
+
autoComplete: "off",
|
|
352
|
+
autoCorrect: "off",
|
|
353
|
+
spellCheck: !1,
|
|
354
|
+
"aria-autocomplete": "list",
|
|
355
|
+
role: "combobox",
|
|
356
|
+
"aria-expanded": !0,
|
|
357
|
+
"aria-controls": h.listId,
|
|
358
|
+
"aria-labelledby": h.labelId,
|
|
359
|
+
id: h.inputId,
|
|
360
|
+
type: "text",
|
|
361
|
+
value: a ? t.value : s,
|
|
362
|
+
onChange: (d) => {
|
|
363
|
+
a || f.setState("search", d.target.value), r?.(d.target.value);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
}), De = c.forwardRef((t, n) => {
|
|
368
|
+
const { children: r, label: i = "Suggestions", ...a } = t, f = c.useRef(null), s = c.useRef(null), h = D();
|
|
369
|
+
return c.useEffect(() => {
|
|
370
|
+
if (s.current && f.current) {
|
|
371
|
+
const d = s.current, S = f.current;
|
|
372
|
+
let C;
|
|
373
|
+
const y = new ResizeObserver(() => {
|
|
374
|
+
C = requestAnimationFrame(() => {
|
|
375
|
+
const w = d.offsetHeight;
|
|
376
|
+
S.style.setProperty("--cmdk-list-height", w.toFixed(1) + "px");
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
return y.observe(d), () => {
|
|
380
|
+
cancelAnimationFrame(C), y.unobserve(d);
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
}, []), /* @__PURE__ */ p(
|
|
384
|
+
R.div,
|
|
385
|
+
{
|
|
386
|
+
ref: O([f, n]),
|
|
387
|
+
...a,
|
|
388
|
+
"cmdk-list": "",
|
|
389
|
+
tabIndex: -1,
|
|
390
|
+
"aria-label": i,
|
|
391
|
+
id: h.listId,
|
|
392
|
+
children: K(t, (d) => /* @__PURE__ */ p("div", { ref: O([s, h.listInnerRef]), "cmdk-list-sizer": "", children: d }))
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
}), Ge = c.forwardRef((t, n) => {
|
|
396
|
+
const { open: r, onOpenChange: i, overlayClassName: a, contentClassName: f, container: s, ...h } = t;
|
|
397
|
+
return /* @__PURE__ */ p(Ee, { open: r, onOpenChange: i, children: /* @__PURE__ */ Z(Ce, { container: s, children: [
|
|
398
|
+
/* @__PURE__ */ p(we, { "cmdk-overlay": "", className: a }),
|
|
399
|
+
/* @__PURE__ */ p(ye, { "aria-label": t.label, "cmdk-dialog": "", className: f, children: /* @__PURE__ */ p(he, { ref: n, ...h }) })
|
|
400
|
+
] }) });
|
|
401
|
+
}), Ke = c.forwardRef((t, n) => P((i) => i.filtered.count === 0) ? /* @__PURE__ */ p(R.div, { ref: n, ...t, "cmdk-empty": "", role: "presentation" }) : null), Be = c.forwardRef((t, n) => {
|
|
402
|
+
const { progress: r, children: i, label: a = "Loading...", ...f } = t;
|
|
403
|
+
return /* @__PURE__ */ p(
|
|
404
|
+
R.div,
|
|
405
|
+
{
|
|
406
|
+
ref: n,
|
|
407
|
+
...f,
|
|
408
|
+
"cmdk-loading": "",
|
|
409
|
+
role: "progressbar",
|
|
410
|
+
"aria-valuenow": r,
|
|
411
|
+
"aria-valuemin": 0,
|
|
412
|
+
"aria-valuemax": 100,
|
|
413
|
+
"aria-label": a,
|
|
414
|
+
children: K(t, (s) => /* @__PURE__ */ p("div", { "aria-hidden": !0, children: s }))
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
}), nt = Object.assign(he, {
|
|
418
|
+
List: De,
|
|
419
|
+
Item: Ve,
|
|
420
|
+
Input: Oe,
|
|
421
|
+
Group: Te,
|
|
422
|
+
Separator: Fe,
|
|
423
|
+
Dialog: Ge,
|
|
424
|
+
Empty: Ke,
|
|
425
|
+
Loading: Be
|
|
426
|
+
});
|
|
427
|
+
function Ne(t, n) {
|
|
428
|
+
let r = t.nextElementSibling;
|
|
429
|
+
for (; r; ) {
|
|
430
|
+
if (r.matches(n)) return r;
|
|
431
|
+
r = r.nextElementSibling;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function Ue(t, n) {
|
|
435
|
+
let r = t.previousElementSibling;
|
|
436
|
+
for (; r; ) {
|
|
437
|
+
if (r.matches(n)) return r;
|
|
438
|
+
r = r.previousElementSibling;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
function ve(t) {
|
|
442
|
+
const n = c.useRef(t);
|
|
443
|
+
return A(() => {
|
|
444
|
+
n.current = t;
|
|
445
|
+
}), n;
|
|
446
|
+
}
|
|
447
|
+
const A = typeof window > "u" ? c.useEffect : c.useLayoutEffect;
|
|
448
|
+
function M(t) {
|
|
449
|
+
const n = c.useRef(void 0);
|
|
450
|
+
return n.current === void 0 && (n.current = t()), n;
|
|
451
|
+
}
|
|
452
|
+
function O(t) {
|
|
453
|
+
return (n) => {
|
|
454
|
+
t.forEach((r) => {
|
|
455
|
+
typeof r == "function" ? r(n) : r != null && (r.current = n);
|
|
456
|
+
});
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
function P(t) {
|
|
460
|
+
const n = ee(), r = () => t(n.snapshot());
|
|
461
|
+
return ke.useSyncExternalStore(n.subscribe, r, r);
|
|
462
|
+
}
|
|
463
|
+
function ge(t, n, r, i = []) {
|
|
464
|
+
const a = c.useRef(void 0), f = D();
|
|
465
|
+
return A(() => {
|
|
466
|
+
const s = (() => {
|
|
467
|
+
for (const d of r) {
|
|
468
|
+
if (typeof d == "string")
|
|
469
|
+
return d.trim();
|
|
470
|
+
if (typeof d == "object" && "current" in d)
|
|
471
|
+
return d.current ? d.current.textContent?.trim() : a.current;
|
|
472
|
+
}
|
|
473
|
+
})(), h = i.map((d) => d.trim());
|
|
474
|
+
f.value(t, s, h), n.current?.setAttribute(L, s), a.current = s;
|
|
475
|
+
}), a;
|
|
476
|
+
}
|
|
477
|
+
const $e = () => {
|
|
478
|
+
const [t, n] = c.useState(), r = M(() => /* @__PURE__ */ new Map());
|
|
479
|
+
return A(() => {
|
|
480
|
+
r.current.forEach((i) => i()), r.current = /* @__PURE__ */ new Map();
|
|
481
|
+
}, [t]), (i, a) => {
|
|
482
|
+
r.current.set(i, a), n({});
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
function je(t) {
|
|
486
|
+
const n = t.type;
|
|
487
|
+
return typeof n == "function" ? n(t.props) : "render" in n ? n.render(t.props) : t;
|
|
488
|
+
}
|
|
489
|
+
function K({ asChild: t, children: n }, r) {
|
|
490
|
+
return t && c.isValidElement(n) ? c.cloneElement(
|
|
491
|
+
je(n),
|
|
492
|
+
{ ref: n.ref },
|
|
493
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
494
|
+
r(n.props.children)
|
|
495
|
+
) : r(n);
|
|
496
|
+
}
|
|
497
|
+
const qe = {
|
|
498
|
+
position: "absolute",
|
|
499
|
+
width: "1px",
|
|
500
|
+
height: "1px",
|
|
501
|
+
padding: "0",
|
|
502
|
+
margin: "-1px",
|
|
503
|
+
overflow: "hidden",
|
|
504
|
+
clip: "rect(0, 0, 0, 0)",
|
|
505
|
+
whiteSpace: "nowrap",
|
|
506
|
+
borderWidth: "0"
|
|
507
|
+
};
|
|
508
|
+
export {
|
|
509
|
+
nt as Command,
|
|
510
|
+
Ge as CommandDialog,
|
|
511
|
+
Ke as CommandEmpty,
|
|
512
|
+
Oe as CommandInput,
|
|
513
|
+
Ve as CommandItem,
|
|
514
|
+
De as CommandList,
|
|
515
|
+
Be as CommandLoading,
|
|
516
|
+
he as CommandRoot,
|
|
517
|
+
Fe as CommandSeparator,
|
|
518
|
+
Pe as defaultFilter,
|
|
519
|
+
P as useCommandState,
|
|
520
|
+
ee as useCommandStore
|
|
521
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("prism-react-renderer"),f=require("../../../color-mode/index.cjs"),S=require("../../hooks/use-copy-to-clipboard.cjs"),v=require("../../providers/config-provider.cjs"),B=require("../../utils/misc.cjs"),I=require("../icons/custom-icon.cjs"),o=require("../markdown/components.cjs"),L=t.themes.oneLight,R=t.themes.vsDark,D=({className:d="",children:l,onCopy:a})=>{const c=d.replace(/^language-/,""),r=String(l).replace(/\n$/,""),[i,h]=S.useCopyToClipboard(),{baseSettings:n}=v.useInkeepConfig(),g=n.theme?.syntaxHighlighter,{lightTheme:p=L,darkTheme:u=R}=g??{},C=f.useColorModeValue(p,u),m=()=>{h(r),a?.(c,r)};return e.jsxs(o.CodeblockContainer,{children:[e.jsxs(o.CodeblockHeader,{children:[e.jsx(o.CodeblockHeaderLanguage,{children:c}),e.jsx(o.CodeblockCopyButton,{"aria-label":"Copy to clipboard",onClick:m,"data-copied":B.dataAttr(i),children:e.jsx(I.CustomIcon,{iconKey:i?"codeCopied":"codeCopy"})})]}),e.jsx(o.CodeblockHighlighterWrapper,{children:e.jsx(t.Highlight,{theme:C,code:r,language:c,prism:n.prism,children:({className:k,tokens:b,getLineProps:x,getTokenProps:j,style:y})=>e.jsx(o.CodeblockHighlighter,{className:k,children:e.jsx(o.CodeblockCode,{style:y,children:b.map((s,q)=>e.jsx("div",{...x({line:s}),children:s.map((T,H)=>e.jsx("span",{...j({token:T})},H))},q))})})})})]})};exports.CodeBlock=D;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { themes as l, Highlight as L } from "prism-react-renderer";
|
|
3
|
+
import { useColorModeValue as S } from "../../../color-mode/index.js";
|
|
4
|
+
import { useCopyToClipboard as j } from "../../hooks/use-copy-to-clipboard.js";
|
|
5
|
+
import { useInkeepConfig as v } from "../../providers/config-provider.js";
|
|
6
|
+
import { dataAttr as B } from "../../utils/misc.js";
|
|
7
|
+
import { CustomIcon as D } from "../icons/custom-icon.js";
|
|
8
|
+
import { CodeblockContainer as I, CodeblockHeader as N, CodeblockHeaderLanguage as A, CodeblockCopyButton as K, CodeblockHighlighterWrapper as M, CodeblockHighlighter as V, CodeblockCode as W } from "../markdown/components.js";
|
|
9
|
+
const $ = l.oneLight, q = l.vsDark, R = ({ className: a = "", children: d, onCopy: h }) => {
|
|
10
|
+
const o = a.replace(/^language-/, ""), r = String(d).replace(/\n$/, ""), [t, p] = j(), { baseSettings: i } = v(), m = i.theme?.syntaxHighlighter, { lightTheme: s = $, darkTheme: g = q } = m ?? {}, C = S(s, g);
|
|
11
|
+
return /* @__PURE__ */ n(I, { children: [
|
|
12
|
+
/* @__PURE__ */ n(N, { children: [
|
|
13
|
+
/* @__PURE__ */ e(A, { children: o }),
|
|
14
|
+
/* @__PURE__ */ e(
|
|
15
|
+
K,
|
|
16
|
+
{
|
|
17
|
+
"aria-label": "Copy to clipboard",
|
|
18
|
+
onClick: () => {
|
|
19
|
+
p(r), h?.(o, r);
|
|
20
|
+
},
|
|
21
|
+
"data-copied": B(t),
|
|
22
|
+
children: /* @__PURE__ */ e(D, { iconKey: t ? "codeCopied" : "codeCopy" })
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
] }),
|
|
26
|
+
/* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(
|
|
27
|
+
L,
|
|
28
|
+
{
|
|
29
|
+
theme: C,
|
|
30
|
+
code: r,
|
|
31
|
+
language: o,
|
|
32
|
+
prism: i.prism,
|
|
33
|
+
children: ({ className: k, tokens: u, getLineProps: b, getTokenProps: f, style: y }) => /* @__PURE__ */ e(V, { className: k, children: /* @__PURE__ */ e(W, { style: y, children: u.map((c, H) => /* @__PURE__ */ e("div", { ...b({ line: c }), children: c.map((T, x) => /* @__PURE__ */ e("span", { ...f({ token: T }) }, x)) }, H)) }) })
|
|
34
|
+
}
|
|
35
|
+
) })
|
|
36
|
+
] });
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
R as CodeBlock
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),o=require("react"),i=require("../utils/generate-uid.cjs"),k=require("../providers/config-provider.cjs"),h=require("dequal");function p(){const{baseSettings:n}=k.useInkeepConfig(),[s,d]=o.useState([]),r=c(n.theme.styles),{customStyles:y,linksCount:a}=o.useMemo(()=>{if(!r||!Array.isArray(r))return{customStyles:null,loaded:!0};const{links:l,styleSheets:m}=r.reduce((e,t)=>(t.type==="link"?e.links.push(t):t.type==="style"&&e.styleSheets.push(t),e),{links:[],styleSheets:[]}),S=m.map(e=>u.jsx("style",{type:"text/css",dangerouslySetInnerHTML:{__html:e.value}},e.key??i.generatePrefixedUniqueId("link_"))),f=l.map(e=>{const t=e.key??i.generatePrefixedUniqueId("stylesheet_");return u.jsx("link",{id:t,rel:"stylesheet",type:"text/css",href:e.value,onLoad:()=>{d(g=>[...new Set([...g,e.value])])}},t)});return{customStyles:u.jsxs(u.Fragment,{children:[f,S]}),linksCount:l.length}},[r]);return{customStyles:y,loaded:s.length>=(a??0)}}function c(n){const s=o.useRef(void 0);return h.dequal(s.current,n)||(s.current=n),s.current}exports.useCompareMemoize=c;exports.useCustomStyles=p;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l, jsxs as p, Fragment as k } from "react/jsx-runtime";
|
|
3
|
+
import { useState as h, useMemo as S, useRef as g } from "react";
|
|
4
|
+
import { generatePrefixedUniqueId as u } from "../utils/generate-uid.js";
|
|
5
|
+
import { useInkeepConfig as x } from "../providers/config-provider.js";
|
|
6
|
+
import { dequal as L } from "dequal";
|
|
7
|
+
function A() {
|
|
8
|
+
const { baseSettings: n } = x(), [s, i] = h([]), r = C(n.theme.styles), { customStyles: y, linksCount: c } = S(() => {
|
|
9
|
+
if (!r || !Array.isArray(r)) return { customStyles: null, loaded: !0 };
|
|
10
|
+
const { links: o, styleSheets: d } = r.reduce(
|
|
11
|
+
(e, t) => (t.type === "link" ? e.links.push(t) : t.type === "style" && e.styleSheets.push(t), e),
|
|
12
|
+
{ links: [], styleSheets: [] }
|
|
13
|
+
), m = d.map((e) => /* @__PURE__ */ l(
|
|
14
|
+
"style",
|
|
15
|
+
{
|
|
16
|
+
type: "text/css",
|
|
17
|
+
dangerouslySetInnerHTML: { __html: e.value }
|
|
18
|
+
},
|
|
19
|
+
e.key ?? u("link_")
|
|
20
|
+
)), a = o.map((e) => {
|
|
21
|
+
const t = e.key ?? u("stylesheet_");
|
|
22
|
+
return /* @__PURE__ */ l(
|
|
23
|
+
"link",
|
|
24
|
+
{
|
|
25
|
+
id: t,
|
|
26
|
+
rel: "stylesheet",
|
|
27
|
+
type: "text/css",
|
|
28
|
+
href: e.value,
|
|
29
|
+
onLoad: () => {
|
|
30
|
+
i((f) => [.../* @__PURE__ */ new Set([...f, e.value])]);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
t
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
customStyles: /* @__PURE__ */ p(k, { children: [
|
|
38
|
+
a,
|
|
39
|
+
m
|
|
40
|
+
] }),
|
|
41
|
+
linksCount: o.length
|
|
42
|
+
};
|
|
43
|
+
}, [r]);
|
|
44
|
+
return {
|
|
45
|
+
customStyles: y,
|
|
46
|
+
loaded: s.length >= (c ?? 0)
|
|
47
|
+
// >= in case a url is removed
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function C(n) {
|
|
51
|
+
const s = g(void 0);
|
|
52
|
+
return L(s.current, n) || (s.current = n), s.current;
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
C as useCompareMemoize,
|
|
56
|
+
A as useCustomStyles
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),T=require("react"),p=require("@radix-ui/primitive"),P=require("@radix-ui/react-compose-refs"),H=require("@radix-ui/react-context"),C=require("@radix-ui/react-id"),z=require("@radix-ui/react-use-controllable-state"),B=require("@radix-ui/react-dismissable-layer"),K=require("@zag-js/focus-trap"),U=require("@radix-ui/react-portal"),_=require("@radix-ui/react-presence"),g=require("@radix-ui/react-primitive"),V=require("@radix-ui/react-focus-guards"),Y=require("react-remove-scroll"),Z=require("aria-hidden"),J=require("@radix-ui/react-slot");function Q(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const c=Q(T),x="Dialog",[N,W]=H.createContextScope(x),[X,l]=N(x),O=e=>{const{__scopeDialog:n,children:t,open:s,defaultOpen:o,onOpenChange:r,modal:a=!0}=e,u=c.useRef(null),f=c.useRef(null),[R=!1,m]=z.useControllableState({prop:s,defaultProp:o??!1,onChange:r});return i.jsx(X,{scope:n,triggerRef:u,contentRef:f,contentId:C.useId(),titleId:C.useId(),descriptionId:C.useId(),open:R,onOpenChange:m,onOpenToggle:c.useCallback(()=>m(G=>!G),[m]),modal:a,children:t})};O.displayName=x;const M="DialogTrigger",S=c.forwardRef((e,n)=>{const{__scopeDialog:t,...s}=e,o=l(M,t),r=P.useComposedRefs(n,o.triggerRef);return i.jsx(g.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":j(o.open),...s,ref:r,onClick:p.composeEventHandlers(e.onClick,o.onOpenToggle)})});S.displayName=M;const v="DialogPortal",[$,q]=N(v,{forceMount:void 0}),y=e=>{const{__scopeDialog:n,forceMount:t,children:s,container:o}=e,r=l(v,n);return i.jsx($,{scope:n,forceMount:t,children:c.Children.map(s,a=>i.jsx(_.Presence,{present:t||r.open,children:i.jsx(U.Portal,{asChild:!0,container:o,children:a})}))})};y.displayName=v;const D="DialogOverlay",E=c.forwardRef((e,n)=>{const t=q(D,e.__scopeDialog),{forceMount:s=t.forceMount,...o}=e,r=l(D,e.__scopeDialog);return r.modal?i.jsx(_.Presence,{present:s||r.open,children:i.jsx(ee,{...o,ref:n})}):null});E.displayName=D;const ee=c.forwardRef((e,n)=>{const{__scopeDialog:t,...s}=e,o=l(D,t);return i.jsx(Y.RemoveScroll,{as:J.Slot,allowPinchZoom:!0,shards:[o.contentRef],gapMode:"padding",removeScrollBar:!0,children:i.jsx(g.Primitive.div,{"data-state":j(o.open),...s,ref:n,style:{pointerEvents:"auto",...s.style}})})}),d="DialogContent",b=c.forwardRef((e,n)=>{const t=q(d,e.__scopeDialog),{forceMount:s=t.forceMount,...o}=e,r=l(d,e.__scopeDialog);return i.jsx(_.Presence,{present:s||r.open,children:r.modal?i.jsx(te,{...o,ref:n}):i.jsx(oe,{...o,ref:n})})});b.displayName=d;const te=c.forwardRef((e,n)=>{const t=l(d,e.__scopeDialog),s=c.useRef(null),o=P.useComposedRefs(n,t.contentRef,s);return c.useEffect(()=>{const r=s.current;if(r)return Z.hideOthers(r)},[]),i.jsx(w,{...e,ref:o,trapFocus:t.open,disableOutsidePointerEvents:!0,onPointerDownOutside:p.composeEventHandlers(e.onPointerDownOutside,r=>{const a=r.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0;(a.button===2||u)&&r.preventDefault()}),onFocusOutside:p.composeEventHandlers(e.onFocusOutside,r=>r.preventDefault())})}),oe=c.forwardRef((e,n)=>{const t=l(d,e.__scopeDialog),s=c.useRef(!1),o=c.useRef(!1);return i.jsx(w,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onInteractOutside:r=>{e.onInteractOutside?.(r),r.defaultPrevented||(s.current=!0,r.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=r.target;t.triggerRef.current?.contains(a)&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&o.current&&r.preventDefault()}})}),w=c.forwardRef((e,n)=>{const{__scopeDialog:t,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:r,...a}=e,u=l(d,t),f=c.useRef(null),R=P.useComposedRefs(n,f);return V.useFocusGuards(),T.useEffect(()=>{if(s)return K.trapFocus(f.current,{preventScroll:!0,onActivate:o,onDeactivate:r,initialFocus:!1})},[]),i.jsx(B.DismissableLayer,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":j(u.open),...a,ref:R,onDismiss:()=>u.onOpenChange(!1)})}),A="DialogTitle",h=c.forwardRef((e,n)=>{const{__scopeDialog:t,...s}=e,o=l(A,t);return i.jsx(g.Primitive.h2,{id:o.titleId,...s,ref:n})});h.displayName=A;const F="DialogDescription",k=c.forwardRef((e,n)=>{const{__scopeDialog:t,...s}=e,o=l(F,t);return i.jsx(g.Primitive.p,{id:o.descriptionId,...s,ref:n})});k.displayName=F;const L="DialogClose",I=c.forwardRef((e,n)=>{const{__scopeDialog:t,...s}=e,o=l(L,t);return i.jsx(g.Primitive.button,{type:"button",...s,ref:n,onClick:p.composeEventHandlers(e.onClick,()=>o.onOpenChange(!1))})});I.displayName=L;function j(e){return e?"open":"closed"}const ne=O,re=y,se=E,ce=b,ie=h,ae=I;exports.Close=ae;exports.Content=ce;exports.Dialog=O;exports.DialogClose=I;exports.DialogContent=b;exports.DialogDescription=k;exports.DialogOverlay=E;exports.DialogPortal=y;exports.DialogTitle=h;exports.DialogTrigger=S;exports.Overlay=se;exports.Portal=re;exports.Root=ne;exports.Title=ie;exports.createDialogScope=W;
|