@agimon-ai/po-web-components 0.0.0-alpha.2 → 0.0.0-alpha.21
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 +191 -1
- package/README.md +7 -7
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{@modelcontextprotocol_server@2.2.0/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-CfX6zgs1.d.mts → @modelcontextprotocol_server@2.3.1/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-D4NN8WsG.d.mts} +5 -6
- package/dist/node_modules/.pnpm/@modelcontextprotocol_server@2.3.1/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-D4NN8WsG.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_server@2.3.1/node_modules/@modelcontextprotocol/server/dist/index.d.mts +2 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/compat.d.mts +8 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/compat.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/errors.d.mts +21 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/errors.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/parse.d.mts +15 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/parse.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/schemas.d.mts +169 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/schemas.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/api.d.mts +38 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/api.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/checks.d.mts +63 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/checks.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/core.d.mts +50 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/core.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/{zod@4.6.5 → zod@4.6.6}/node_modules/zod/v4/core/errors.d.mts +3 -87
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/errors.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/{zod@4.6.5 → zod@4.6.6}/node_modules/zod/v4/core/json-schema.d.mts +1 -26
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/json-schema.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/{zod@4.6.5 → zod@4.6.6}/node_modules/zod/v4/core/registries.d.mts +3 -7
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/registries.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/{zod@4.6.5 → zod@4.6.6}/node_modules/zod/v4/core/schemas.d.mts +10 -405
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/schemas.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/{zod@4.6.5 → zod@4.6.6}/node_modules/zod/v4/core/standard-schema.d.mts +1 -1
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/standard-schema.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/{zod@4.6.5 → zod@4.6.6}/node_modules/zod/v4/core/to-json-schema.d.mts +4 -33
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/to-json-schema.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/util.d.mts +38 -0
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/util.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/{zod@4.6.5 → zod@4.6.6}/node_modules/zod/v4/core/versions.d.mts +1 -1
- package/dist/node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/versions.d.mts.map +1 -0
- package/dist/packages/core/po-core/dist/mcpWidget.d.mts +2 -2
- package/dist/packages/core/po-core/dist/src/web/types/mcpWidget.d.mts +3 -3
- package/dist/packages/core/po-core/dist/web.d.mts +2 -2
- package/dist/packages/core/po-web-components/src/components/Accordion.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Accordion.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/AgentAvatar.d.mts +14 -0
- package/dist/packages/core/po-web-components/src/components/AgentAvatar.d.mts.map +1 -0
- package/dist/packages/core/po-web-components/src/components/AgentAvatar.mjs +2 -0
- package/dist/packages/core/po-web-components/src/components/AgentAvatar.mjs.map +1 -0
- package/dist/packages/core/po-web-components/src/components/AnsiText.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/AnsiText.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Avatar.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Avatar.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Badge.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Badge.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Breadcrumb.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Breadcrumb.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Button.d.mts.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Button.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Button.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Checkbox.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Checkbox.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/CodeBlock.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/CodeBlock.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/CodeEditorView.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/CodeEditorView.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Command.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Command.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/CopyButton.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/CopyButton.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Dialog.d.mts +1 -1
- package/dist/packages/core/po-web-components/src/components/Dialog.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Dialog.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/DiffView.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/DiffView.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Dot.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Dot.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Drawer.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Drawer.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/DropdownMenu.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/DropdownMenu.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/EmptyState.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/EmptyState.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/HashlineLines.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/HashlineLines.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Input.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Input.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Kbd.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Kbd.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Label.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Label.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Markdown.d.mts +1 -0
- package/dist/packages/core/po-web-components/src/components/Markdown.d.mts.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Markdown.mjs +2 -2
- package/dist/packages/core/po-web-components/src/components/Markdown.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/McpApp.d.mts +5 -4
- package/dist/packages/core/po-web-components/src/components/McpApp.d.mts.map +1 -1
- package/dist/packages/core/po-web-components/src/components/McpApp.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/McpToolWidget.d.mts +3 -3
- package/dist/packages/core/po-web-components/src/components/McpToolWidget.d.mts.map +1 -1
- package/dist/packages/core/po-web-components/src/components/McpToolWidget.mjs +2 -2
- package/dist/packages/core/po-web-components/src/components/McpToolWidget.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/MediaPreview.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/MediaPreview.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/MermaidDiagram.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/MermaidDiagram.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/MessageItem.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/MessageItem.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/MessageLines.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/MessageLines.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/OptionList.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/OptionList.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Panel.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Panel.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/PdfPreview.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/PdfPreview.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Picker.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Picker.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Popover.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Popover.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Progress.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Progress.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/RadioGroup.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/RadioGroup.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/ReviewCommentDraft.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/ReviewCommentDraft.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/ScrollArea.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/ScrollArea.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/SectionLabel.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/SectionLabel.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Select.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Select.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Separator.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Separator.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Settings.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Settings.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Sheet.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Sheet.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Skeleton.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Skeleton.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/StatusBadge.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/StatusBadge.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/StreamCursor.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/StreamCursor.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Switch.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Switch.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Tabs.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Tabs.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Toast.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Toast.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/ToolPathLink.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/ToolPathLink.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/components/Tooltip.mjs +1 -1
- package/dist/packages/core/po-web-components/src/components/Tooltip.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/icons/icons.d.mts +2 -2
- package/dist/packages/core/po-web-components/src/icons/icons.mjs +1 -1
- package/dist/packages/core/po-web-components/src/lib/ansiSpans.mjs +1 -1
- package/dist/packages/core/po-web-components/src/lib/ansiSpans.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/lib/editorTheme.d.mts +19 -19
- package/dist/packages/core/po-web-components/src/lib/editorTheme.d.mts.map +1 -1
- package/dist/packages/core/po-web-components/src/lib/editorTheme.mjs +1 -1
- package/dist/packages/core/po-web-components/src/lib/editorTheme.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/lib/hashlineHighlight.mjs +1 -1
- package/dist/packages/core/po-web-components/src/lib/hashlineHighlight.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/lib/hashlineView.mjs +1 -1
- package/dist/packages/core/po-web-components/src/lib/hashlineView.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/lib/syntaxHighlight.d.mts +2 -2
- package/dist/packages/core/po-web-components/src/lib/syntaxHighlight.mjs +1 -1
- package/dist/packages/core/po-web-components/src/lib/syntaxHighlight.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/theme/builtinThemes.d.mts +1 -1
- package/dist/packages/core/po-web-components/src/theme/builtinThemes.d.mts.map +1 -1
- package/dist/packages/core/po-web-components/src/theme/builtinThemes.mjs +1 -1
- package/dist/packages/core/po-web-components/src/theme/builtinThemes.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/theme/derive.mjs +1 -1
- package/dist/packages/core/po-web-components/src/theme/derive.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/theme/nativeTheme.d.mts +2 -2
- package/dist/packages/core/po-web-components/src/theme/nativeTheme.mjs +1 -1
- package/dist/packages/core/po-web-components/src/theme/nativeTheme.mjs.map +1 -1
- package/dist/packages/core/po-web-components/src/types/theme.d.mts +1 -1
- package/dist/packages/core/po-web-components/src/types/theme.d.mts.map +1 -1
- package/dist/packages/core/po-web-components/src/types/theme.mjs +1 -1
- package/dist/packages/core/po-web-components/src/types/theme.mjs.map +1 -1
- package/dist/packages/core/po-web-components/themes/po-nord-dark.mjs +2 -0
- package/dist/packages/core/po-web-components/themes/po-nord-dark.mjs.map +1 -0
- package/dist/packages/core/po-web-components/themes/po-one-light.mjs +2 -0
- package/dist/packages/core/po-web-components/themes/po-one-light.mjs.map +1 -0
- package/dist/src/components/Accordion.cjs +1 -1
- package/dist/src/components/Accordion.cjs.map +1 -1
- package/dist/src/components/AgentAvatar.cjs +2 -0
- package/dist/src/components/AgentAvatar.cjs.map +1 -0
- package/dist/src/components/AnsiText.cjs +1 -1
- package/dist/src/components/AnsiText.cjs.map +1 -1
- package/dist/src/components/Avatar.cjs +1 -1
- package/dist/src/components/Avatar.cjs.map +1 -1
- package/dist/src/components/Badge.cjs +1 -1
- package/dist/src/components/Badge.cjs.map +1 -1
- package/dist/src/components/Breadcrumb.cjs +1 -1
- package/dist/src/components/Breadcrumb.cjs.map +1 -1
- package/dist/src/components/Button.cjs +1 -1
- package/dist/src/components/Button.cjs.map +1 -1
- package/dist/src/components/Checkbox.cjs +1 -1
- package/dist/src/components/Checkbox.cjs.map +1 -1
- package/dist/src/components/CodeBlock.cjs +1 -1
- package/dist/src/components/CodeBlock.cjs.map +1 -1
- package/dist/src/components/CodeEditorView.cjs +1 -1
- package/dist/src/components/CodeEditorView.cjs.map +1 -1
- package/dist/src/components/Command.cjs +1 -1
- package/dist/src/components/Command.cjs.map +1 -1
- package/dist/src/components/CopyButton.cjs +1 -1
- package/dist/src/components/CopyButton.cjs.map +1 -1
- package/dist/src/components/Dialog.cjs +1 -1
- package/dist/src/components/Dialog.cjs.map +1 -1
- package/dist/src/components/DiffView.cjs +1 -1
- package/dist/src/components/DiffView.cjs.map +1 -1
- package/dist/src/components/Dot.cjs +1 -1
- package/dist/src/components/Dot.cjs.map +1 -1
- package/dist/src/components/Drawer.cjs +1 -1
- package/dist/src/components/Drawer.cjs.map +1 -1
- package/dist/src/components/DropdownMenu.cjs +1 -1
- package/dist/src/components/DropdownMenu.cjs.map +1 -1
- package/dist/src/components/EmptyState.cjs +1 -1
- package/dist/src/components/EmptyState.cjs.map +1 -1
- package/dist/src/components/HashlineLines.cjs +1 -1
- package/dist/src/components/HashlineLines.cjs.map +1 -1
- package/dist/src/components/Input.cjs +1 -1
- package/dist/src/components/Input.cjs.map +1 -1
- package/dist/src/components/Kbd.cjs +1 -1
- package/dist/src/components/Kbd.cjs.map +1 -1
- package/dist/src/components/Label.cjs +1 -1
- package/dist/src/components/Label.cjs.map +1 -1
- package/dist/src/components/Markdown.cjs +2 -2
- package/dist/src/components/Markdown.cjs.map +1 -1
- package/dist/src/components/McpApp.cjs.map +1 -1
- package/dist/src/components/McpToolWidget.cjs +2 -2
- package/dist/src/components/McpToolWidget.cjs.map +1 -1
- package/dist/src/components/MediaPreview.cjs +1 -1
- package/dist/src/components/MediaPreview.cjs.map +1 -1
- package/dist/src/components/MermaidDiagram.cjs +1 -1
- package/dist/src/components/MermaidDiagram.cjs.map +1 -1
- package/dist/src/components/MessageItem.cjs +1 -1
- package/dist/src/components/MessageItem.cjs.map +1 -1
- package/dist/src/components/MessageLines.cjs +1 -1
- package/dist/src/components/MessageLines.cjs.map +1 -1
- package/dist/src/components/OptionList.cjs +1 -1
- package/dist/src/components/OptionList.cjs.map +1 -1
- package/dist/src/components/Panel.cjs +1 -1
- package/dist/src/components/Panel.cjs.map +1 -1
- package/dist/src/components/PdfPreview.cjs +1 -1
- package/dist/src/components/PdfPreview.cjs.map +1 -1
- package/dist/src/components/Picker.cjs +1 -1
- package/dist/src/components/Picker.cjs.map +1 -1
- package/dist/src/components/Popover.cjs +1 -1
- package/dist/src/components/Popover.cjs.map +1 -1
- package/dist/src/components/Progress.cjs +1 -1
- package/dist/src/components/Progress.cjs.map +1 -1
- package/dist/src/components/RadioGroup.cjs +1 -1
- package/dist/src/components/RadioGroup.cjs.map +1 -1
- package/dist/src/components/ReviewCommentDraft.cjs +1 -1
- package/dist/src/components/ReviewCommentDraft.cjs.map +1 -1
- package/dist/src/components/ScrollArea.cjs +1 -1
- package/dist/src/components/ScrollArea.cjs.map +1 -1
- package/dist/src/components/SectionLabel.cjs +1 -1
- package/dist/src/components/SectionLabel.cjs.map +1 -1
- package/dist/src/components/Select.cjs +1 -1
- package/dist/src/components/Select.cjs.map +1 -1
- package/dist/src/components/Separator.cjs +1 -1
- package/dist/src/components/Separator.cjs.map +1 -1
- package/dist/src/components/Settings.cjs +1 -1
- package/dist/src/components/Settings.cjs.map +1 -1
- package/dist/src/components/Sheet.cjs +1 -1
- package/dist/src/components/Sheet.cjs.map +1 -1
- package/dist/src/components/Skeleton.cjs +1 -1
- package/dist/src/components/Skeleton.cjs.map +1 -1
- package/dist/src/components/StatusBadge.cjs +1 -1
- package/dist/src/components/StatusBadge.cjs.map +1 -1
- package/dist/src/components/StreamCursor.cjs +1 -1
- package/dist/src/components/StreamCursor.cjs.map +1 -1
- package/dist/src/components/Switch.cjs +1 -1
- package/dist/src/components/Switch.cjs.map +1 -1
- package/dist/src/components/Tabs.cjs +1 -1
- package/dist/src/components/Tabs.cjs.map +1 -1
- package/dist/src/components/Toast.cjs +1 -1
- package/dist/src/components/Toast.cjs.map +1 -1
- package/dist/src/components/ToolPathLink.cjs +1 -1
- package/dist/src/components/ToolPathLink.cjs.map +1 -1
- package/dist/src/components/Tooltip.cjs +1 -1
- package/dist/src/components/Tooltip.cjs.map +1 -1
- package/dist/src/icons/icons.cjs +1 -1
- package/dist/src/lib/ansiSpans.cjs +1 -1
- package/dist/src/lib/ansiSpans.cjs.map +1 -1
- package/dist/src/lib/editorTheme.cjs +1 -1
- package/dist/src/lib/editorTheme.cjs.map +1 -1
- package/dist/src/lib/hashlineHighlight.cjs +1 -1
- package/dist/src/lib/hashlineHighlight.cjs.map +1 -1
- package/dist/src/lib/hashlineView.cjs +1 -1
- package/dist/src/lib/hashlineView.cjs.map +1 -1
- package/dist/src/lib/syntaxHighlight.cjs +1 -1
- package/dist/src/lib/syntaxHighlight.cjs.map +1 -1
- package/dist/src/theme/builtinThemes.cjs +1 -1
- package/dist/src/theme/builtinThemes.cjs.map +1 -1
- package/dist/src/theme/derive.cjs +1 -1
- package/dist/src/theme/derive.cjs.map +1 -1
- package/dist/src/theme/nativeTheme.cjs +1 -1
- package/dist/src/theme/nativeTheme.cjs.map +1 -1
- package/dist/src/types/theme.cjs +1 -1
- package/dist/src/types/theme.cjs.map +1 -1
- package/dist/themes/po-nord-dark.cjs +2 -0
- package/dist/themes/po-nord-dark.cjs.map +1 -0
- package/dist/themes/po-one-light.cjs +2 -0
- package/dist/themes/po-one-light.cjs.map +1 -0
- package/package.json +18 -18
- package/styles/mcp.css +11 -11
- package/styles/preview.css +1 -1
- package/styles/theme.css +118 -119
- package/themes/{doom-nord-dark.json → po-nord-dark.json} +1 -1
- package/themes/{doom-one-light.json → po-one-light.json} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_server@2.2.0/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-CfX6zgs1.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_server@2.2.0/node_modules/@modelcontextprotocol/server/dist/index.d.mts +0 -2
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/coerce.d.mts +0 -20
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/coerce.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/compat.d.mts +0 -50
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/compat.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/deep-partial.d.mts +0 -10
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/deep-partial.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/errors.d.mts +0 -33
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/errors.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.d.mts +0 -28
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/from-json-schema.d.mts +0 -14
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/from-json-schema.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/in-out.d.mts +0 -13
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/in-out.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.d.mts +0 -13
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.d.mts +0 -54
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.d.mts +0 -775
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.d.mts +0 -331
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.d.mts +0 -296
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/compile.d.mts +0 -67
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/compile.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.d.mts +0 -85
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.d.mts +0 -18
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/index.d.mts +0 -24
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/index.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-generator.d.mts +0 -67
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-generator.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.d.mts +0 -12
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.d.mts +0 -18
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.d.mts +0 -54
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.d.mts +0 -94
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/registries.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/schemas.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/standard-schema.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.d.mts +0 -237
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/index.d.mts +0 -29
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/index.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ar.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ar.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/az.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/az.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/be.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/be.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/bg.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/bg.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/bn.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/bn.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ca.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ca.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ckb.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ckb.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/cs.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/cs.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/da.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/da.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/de.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/de.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/el.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/el.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/eo.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/eo.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/es.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/es.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fa.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fa.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fi.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fi.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fr-CA.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fr-CA.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fr.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/fr.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/gu.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/gu.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/he.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/he.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hi.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hi.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hr.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hr.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hu.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hu.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hy.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hy.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/id.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/id.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/index.d.mts +0 -69
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/index.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/is.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/is.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/it.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/it.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ja.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ja.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ka.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ka.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/kh.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/kh.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/km.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/km.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/kn.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/kn.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ko.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ko.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/lt.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/lt.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/mk.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/mk.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ms.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ms.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ne.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ne.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/nl.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/nl.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/nn.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/nn.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/no.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/no.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ota.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ota.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/pl.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/pl.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ps.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ps.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/pt-BR.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/pt-BR.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/pt.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/pt.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ro.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ro.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ru.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ru.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/sk.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/sk.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/sl.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/sl.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/sv.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/sv.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ta.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ta.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/tg.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/tg.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/th.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/th.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/tk.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/tk.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/tr.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/tr.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ua.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ua.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/uk.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/uk.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ur.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ur.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/uz.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/uz.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/vi.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/vi.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/yo.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/yo.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/zh-CN.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/zh-CN.d.mts.map +0 -1
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/zh-TW.d.mts +0 -8
- package/dist/node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/zh-TW.d.mts.map +0 -1
- package/dist/packages/core/po-web-components/themes/doom-nord-dark.mjs +0 -2
- package/dist/packages/core/po-web-components/themes/doom-nord-dark.mjs.map +0 -1
- package/dist/packages/core/po-web-components/themes/doom-one-dark.mjs +0 -2
- package/dist/packages/core/po-web-components/themes/doom-one-dark.mjs.map +0 -1
- package/dist/packages/core/po-web-components/themes/doom-one-light.mjs +0 -2
- package/dist/packages/core/po-web-components/themes/doom-one-light.mjs.map +0 -1
- package/dist/themes/doom-nord-dark.cjs +0 -2
- package/dist/themes/doom-nord-dark.cjs.map +0 -1
- package/dist/themes/doom-one-dark.cjs +0 -2
- package/dist/themes/doom-one-dark.cjs.map +0 -1
- package/dist/themes/doom-one-light.cjs +0 -2
- package/dist/themes/doom-one-light.cjs.map +0 -1
- package/themes/doom-one-dark.json +0 -30
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../lib/cn.cjs"),t=require("./Dialog.cjs");let n=require("radix-ui"),r=require("react/jsx-runtime"),i=require("react");function a({open:a,onOpenChange:o,side:s,title:c,children:l,className:u,showHeader:d=!0,"data-testid":f,backdropTestId:p}){let m=(0,i.useRef)(null);return/* @__PURE__ */ (0,r.jsx)(t.Dialog,{open:a,onOpenChange:o,children:/* @__PURE__ */ (0,r.jsxs)(t.DialogPortal,{children:[/* @__PURE__ */ (0,r.jsx)(t.DialogOverlay,{"data-testid":p}),/* @__PURE__ */ (0,r.jsxs)(n.Dialog.Content,{"aria-describedby":void 0,"data-testid":f,className:e.cn(`fixed inset-y-0 z-50 flex w-[min(300px,calc(100vw-48px))] flex-col overflow-y-auto border-
|
|
1
|
+
const e=require("../lib/cn.cjs"),t=require("./Dialog.cjs");let n=require("radix-ui"),r=require("react/jsx-runtime"),i=require("react");function a({open:a,onOpenChange:o,side:s,title:c,children:l,className:u,showHeader:d=!0,"data-testid":f,backdropTestId:p}){let m=(0,i.useRef)(null);return/* @__PURE__ */ (0,r.jsx)(t.Dialog,{open:a,onOpenChange:o,children:/* @__PURE__ */ (0,r.jsxs)(t.DialogPortal,{children:[/* @__PURE__ */ (0,r.jsx)(t.DialogOverlay,{"data-testid":p}),/* @__PURE__ */ (0,r.jsxs)(n.Dialog.Content,{"aria-describedby":void 0,"data-testid":f,className:e.cn(`fixed inset-y-0 z-50 flex w-[min(300px,calc(100vw-48px))] flex-col overflow-y-auto border-po-border bg-po-rail outline-none`,s===`left`?`left-0 border-r`:`right-0 border-l`,u),onOpenAutoFocus:()=>{m.current=document.activeElement instanceof HTMLElement?document.activeElement:null},onCloseAutoFocus:e=>{e.preventDefault(),m.current?.isConnected&&m.current.focus()},children:[d?/* @__PURE__ */ (0,r.jsx)(t.DialogHeader,{dismissible:!0,closeLabel:`hide ${c.toLowerCase()}`,children:/* @__PURE__ */ (0,r.jsx)(t.DialogTitle,{children:c})}):/* @__PURE__ */ (0,r.jsx)(t.DialogTitle,{className:`sr-only`,children:c}),l]})]})})}exports.Drawer=a;
|
|
2
2
|
//# sourceMappingURL=Drawer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.cjs","names":["useRef","Dialog","DialogPortal","DialogOverlay","DialogPrimitive","cn","DialogHeader","DialogTitle","require_cn","require_Dialog","radix_ui","react_jsx_runtime","react","Drawer","testId","opener","backdropTestId","side","className","event","showHeader","title","children"],"sources":["../../../src/components/Drawer.tsx"],"sourcesContent":["import { Dialog as DialogPrimitive } from 'radix-ui';\nimport { type ReactNode, useRef } from 'react';\n\nimport { cn } from '../lib/cn';\nimport { Dialog, DialogHeader, DialogOverlay, DialogPortal, DialogTitle } from './Dialog';\n\nexport interface DrawerProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n side: 'left' | 'right';\n title: string;\n children: ReactNode;\n className?: string;\n showHeader?: boolean;\n 'data-testid'?: string;\n backdropTestId?: string;\n}\n\n/** A controlled side panel with a focus trap and restoration for external header buttons. */\nexport function Drawer({\n open,\n onOpenChange,\n side,\n title,\n children,\n className,\n showHeader = true,\n 'data-testid': testId,\n backdropTestId,\n}: DrawerProps) {\n const opener = useRef<HTMLElement | null>(null);\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogPortal>\n <DialogOverlay data-testid={backdropTestId} />\n <DialogPrimitive.Content\n aria-describedby={undefined}\n data-testid={testId}\n className={cn(\n 'fixed inset-y-0 z-50 flex w-[min(300px,calc(100vw-48px))] flex-col overflow-y-auto border-
|
|
1
|
+
{"version":3,"file":"Drawer.cjs","names":["useRef","Dialog","DialogPortal","DialogOverlay","DialogPrimitive","cn","DialogHeader","DialogTitle","require_cn","require_Dialog","radix_ui","react_jsx_runtime","react","Drawer","testId","opener","backdropTestId","side","className","event","showHeader","title","children"],"sources":["../../../src/components/Drawer.tsx"],"sourcesContent":["import { Dialog as DialogPrimitive } from 'radix-ui';\nimport { type ReactNode, useRef } from 'react';\n\nimport { cn } from '../lib/cn';\nimport { Dialog, DialogHeader, DialogOverlay, DialogPortal, DialogTitle } from './Dialog';\n\nexport interface DrawerProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n side: 'left' | 'right';\n title: string;\n children: ReactNode;\n className?: string;\n showHeader?: boolean;\n 'data-testid'?: string;\n backdropTestId?: string;\n}\n\n/** A controlled side panel with a focus trap and restoration for external header buttons. */\nexport function Drawer({\n open,\n onOpenChange,\n side,\n title,\n children,\n className,\n showHeader = true,\n 'data-testid': testId,\n backdropTestId,\n}: DrawerProps) {\n const opener = useRef<HTMLElement | null>(null);\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogPortal>\n <DialogOverlay data-testid={backdropTestId} />\n <DialogPrimitive.Content\n aria-describedby={undefined}\n data-testid={testId}\n className={cn(\n 'fixed inset-y-0 z-50 flex w-[min(300px,calc(100vw-48px))] flex-col overflow-y-auto border-po-border bg-po-rail outline-none',\n side === 'left' ? 'left-0 border-r' : 'right-0 border-l',\n className,\n )}\n onOpenAutoFocus={() => {\n opener.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n }}\n onCloseAutoFocus={(event) => {\n event.preventDefault();\n if (opener.current?.isConnected) opener.current.focus();\n }}\n >\n {showHeader ? (\n <DialogHeader dismissible closeLabel={`hide ${title.toLowerCase()}`}>\n <DialogTitle>{title}</DialogTitle>\n </DialogHeader>\n ) : (\n <DialogTitle className=\"sr-only\">{title}</DialogTitle>\n )}\n {children}\n </DialogPrimitive.Content>\n </DialogPortal>\n </Dialog>\n );\n}\n"],"mappings":"uIAmBA,SAAgBa,EAAO,CACrB,OACA,eACA,OACA,QACA,WACA,YACA,aAAa,GACb,cAAeC,EACf,kBACc,CACd,IAAMC,GAAA,EAASf,EAAAA,OAAAA,CAA2B,IAAI,EAC9C,MACE,iBAAA,EAAAW,EAAA,IAAA,CAACV,EAAAA,OAAD,CAAc,OAAoB,eAChC,SAAA,iBAAA,EAAAU,EAAA,KAAA,CAACT,EAAAA,aAAD,CAAA,SAAA,CACE,iBAAA,EAAAS,EAAA,IAAA,CAACR,EAAAA,cAAD,CAAe,cAAaa,CAAiB,CAAA,EAC7C,iBAAA,EAAAL,EAAA,KAAA,CAACP,EAAAA,OAAgB,QAAjB,CACE,mBAAkB,IAAA,GAClB,cAAaU,EACb,UAAWT,EAAAA,GACT,8HACAY,IAAS,OAAS,kBAAoB,mBACtCC,CACF,EACA,oBAAuB,CACrB,EAAO,QAAU,SAAS,yBAAyB,YAAc,SAAS,cAAgB,IAC5F,EACA,iBAAmB,GAAU,CAC3BC,EAAM,eAAe,EACjBJ,EAAO,SAAS,aAAaA,EAAO,QAAQ,MAAM,CACxD,EAdF,SAAA,CAgBGK,EACC,iBAAA,EAAAT,EAAA,IAAA,CAACL,EAAAA,aAAD,CAAc,YAAA,GAAY,WAAY,QAAQe,EAAM,YAAY,IAC9D,SAAA,iBAAA,EAAAV,EAAA,IAAA,CAACJ,EAAAA,YAAD,CAAA,SAAcc,CAAmB,CAAA,CACrB,CAAA,EAEd,iBAAA,EAAAV,EAAA,IAAA,CAACJ,EAAAA,YAAD,CAAa,UAAU,UAAW,SAAAc,CAAmB,CAAA,EAEtDC,CACsB,CACb,CAAA,CAAA,CAAA,CAAA,CACR,CAAA,CAEZ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require("../icons/icons.cjs");const e=require("../lib/cn.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime"),r=require("class-variance-authority"),i=require("lucide-react");function a(e){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Root,{"data-slot":`dropdown-menu`,...e})}function o(e){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function s(e){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Group,{"data-slot":`dropdown-menu-group`,...e})}const c=`z-50 flex min-w-[120px] flex-col overflow-hidden rounded border border-
|
|
1
|
+
require("../icons/icons.cjs");const e=require("../lib/cn.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime"),r=require("class-variance-authority"),i=require("lucide-react");function a(e){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Root,{"data-slot":`dropdown-menu`,...e})}function o(e){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function s(e){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Group,{"data-slot":`dropdown-menu-group`,...e})}const c=`z-50 flex min-w-[120px] flex-col overflow-hidden rounded border border-po-border bg-po-panel py-1 shadow-xl outline-none data-[state=open]:animate-po-rise`;function l({className:r,align:i=`end`,sideOffset:a=4,...o}){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Portal,{children:/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Content,{"data-slot":`dropdown-menu-content`,align:i,sideOffset:a,className:e.cn(c,r),...o})})}const u=(0,r.cva)(`flex w-full cursor-pointer items-center gap-2 px-2.5 py-1.5 text-left text-base outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-40 data-[highlighted]:bg-po-deep`,{variants:{variant:{default:`text-po-hi`,destructive:`text-po-red`},indented:{true:`pl-7`,false:``}},defaultVariants:{variant:`default`,indented:!1}});function d({className:r,variant:i,indented:a,...o}){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Item,{"data-slot":`dropdown-menu-item`,"data-variant":i??`default`,className:e.cn(u({variant:i,indented:a}),r),...o})}function f({children:e}){return/* @__PURE__ */ (0,n.jsx)(`span`,{className:`pointer-events-none absolute left-2.5 flex h-3 w-3 items-center justify-center`,children:/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.ItemIndicator,{children:e})})}function p({className:r,variant:a,children:o,...s}){return/* @__PURE__ */ (0,n.jsxs)(t.DropdownMenu.CheckboxItem,{"data-slot":`dropdown-menu-checkbox-item`,className:e.cn(`relative`,u({variant:a,indented:!0}),r),...s,children:[/* @__PURE__ */ (0,n.jsx)(f,{children:/* @__PURE__ */ (0,n.jsx)(i.Check,{className:`h-3 w-3 text-po-blue`})}),o]})}function m(e){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.RadioGroup,{"data-slot":`dropdown-menu-radio-group`,...e})}function h({className:r,variant:i,children:a,...o}){return/* @__PURE__ */ (0,n.jsxs)(t.DropdownMenu.RadioItem,{"data-slot":`dropdown-menu-radio-item`,className:e.cn(`relative`,u({variant:i,indented:!0}),r),...o,children:[/* @__PURE__ */ (0,n.jsx)(f,{children:/* @__PURE__ */ (0,n.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-po-blue`})}),a]})}function g(e){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Sub,{"data-slot":`dropdown-menu-sub`,...e})}function _({className:r,children:a,...o}){return/* @__PURE__ */ (0,n.jsxs)(t.DropdownMenu.SubTrigger,{"data-slot":`dropdown-menu-sub-trigger`,className:e.cn(u(),`data-[state=open]:bg-po-deep`,r),...o,children:[/* @__PURE__ */ (0,n.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:a}),/* @__PURE__ */ (0,n.jsx)(i.ChevronRight,{className:`h-3 w-3 shrink-0 text-po-faint`})]})}function v({className:r,sideOffset:i=2,...a}){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Portal,{children:/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.SubContent,{"data-slot":`dropdown-menu-sub-content`,sideOffset:i,className:e.cn(c,r),...a})})}function y({className:r,...i}){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Label,{"data-slot":`dropdown-menu-label`,className:e.cn(`px-2.5 py-1 text-sm font-semibold text-po-dim first-letter:uppercase`,r),...i})}function b({className:t,...r}){return/* @__PURE__ */ (0,n.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:e.cn(`ml-auto shrink-0 text-sm text-po-dim`,t),...r})}function x({className:r,...i}){return/* @__PURE__ */ (0,n.jsx)(t.DropdownMenu.Separator,{"data-slot":`dropdown-menu-separator`,className:e.cn(`my-1 h-px bg-po-border-soft`,r),...i})}exports.DropdownMenu=a,exports.DropdownMenuCheckboxItem=p,exports.DropdownMenuContent=l,exports.DropdownMenuGroup=s,exports.DropdownMenuItem=d,exports.DropdownMenuLabel=y,exports.DropdownMenuRadioGroup=m,exports.DropdownMenuRadioItem=h,exports.DropdownMenuSeparator=x,exports.DropdownMenuShortcut=b,exports.DropdownMenuSub=g,exports.DropdownMenuSubContent=v,exports.DropdownMenuSubTrigger=_,exports.DropdownMenuTrigger=o,exports.dropdownMenuItemVariants=u;
|
|
2
2
|
//# sourceMappingURL=DropdownMenu.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.cjs","names":["DropdownMenuPrimitive","cn","cva","CheckIcon","ChevronRightIcon","require_cn","radix_ui","react_jsx_runtime","class_variance_authority","lucide_react","DropdownMenu","props","DropdownMenuTrigger","DropdownMenuGroup","CONTENT_CLASS","DropdownMenuContent","className","dropdownMenuItemVariants","DropdownMenuItem","variant","ItemIndicator","DropdownMenuCheckboxItem","children","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuSub","DropdownMenuSubTrigger","DropdownMenuSubContent","DropdownMenuLabel","DropdownMenuShortcut","DropdownMenuSeparator"],"sources":["../../../src/components/DropdownMenu.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport { CheckIcon, ChevronRightIcon } from '../icons/icons';\nimport { cn } from '../lib/cn';\n\n/** shadcn's DropdownMenu on Radix: roving focus, typeahead, outside click, Escape. */\nexport function DropdownMenu(props: ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nexport function DropdownMenuTrigger(props: ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n return <DropdownMenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />;\n}\n\n/** A run of items under one label, so the separator between groups is structural. */\nexport function DropdownMenuGroup(props: ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />;\n}\n\n/** The surface every menu and submenu wears. */\nconst CONTENT_CLASS =\n 'z-50 flex min-w-[120px] flex-col overflow-hidden rounded border border-doom-border bg-doom-panel py-1 shadow-xl outline-none data-[state=open]:animate-doom-rise';\n\nexport function DropdownMenuContent({\n className,\n align = 'end',\n sideOffset = 4,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(CONTENT_CLASS, className)}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nexport const dropdownMenuItemVariants = cva(\n 'flex w-full cursor-pointer items-center gap-2 px-2.5 py-1.5 text-left text-base outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-40 data-[highlighted]:bg-doom-deep',\n {\n variants: {\n variant: {\n default: 'text-doom-hi',\n destructive: 'text-doom-red',\n },\n /** A row that carries a check or bullet keeps a gutter for it, so labels line up whether or not one is set. */\n indented: { true: 'pl-7', false: '' },\n },\n defaultVariants: { variant: 'default', indented: false },\n },\n);\n\nexport interface DropdownMenuItemProps\n extends ComponentProps<typeof DropdownMenuPrimitive.Item>, VariantProps<typeof dropdownMenuItemVariants> {}\n\nexport function DropdownMenuItem({ className, variant, indented, ...props }: DropdownMenuItemProps) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-variant={variant ?? 'default'}\n className={cn(dropdownMenuItemVariants({ variant, indented }), className)}\n {...props}\n />\n );\n}\n\n/** The check or bullet a selectable row shows when it is set; it sits in the row's gutter. */\nfunction ItemIndicator({ children }: { children: ReactNode }) {\n return (\n <span className=\"pointer-events-none absolute left-2.5 flex h-3 w-3 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>{children}</DropdownMenuPrimitive.ItemIndicator>\n </span>\n );\n}\n\nexport interface DropdownMenuCheckboxItemProps\n extends ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>, VariantProps<typeof dropdownMenuItemVariants> {}\n\n/** A row that toggles: the check lives in the gutter so the label never shifts. */\nexport function DropdownMenuCheckboxItem({ className, variant, children, ...props }: DropdownMenuCheckboxItemProps) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn('relative', dropdownMenuItemVariants({ variant, indented: true }), className)}\n {...props}\n >\n <ItemIndicator>\n <CheckIcon className=\"h-3 w-3 text-doom-blue\" />\n </ItemIndicator>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n}\n\n/** The exclusive-choice group; pair it with DropdownMenuRadioItem. */\nexport function DropdownMenuRadioGroup(props: ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n return <DropdownMenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nexport interface DropdownMenuRadioItemProps\n extends ComponentProps<typeof DropdownMenuPrimitive.RadioItem>, VariantProps<typeof dropdownMenuItemVariants> {}\n\nexport function DropdownMenuRadioItem({ className, variant, children, ...props }: DropdownMenuRadioItemProps) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn('relative', dropdownMenuItemVariants({ variant, indented: true }), className)}\n {...props}\n >\n <ItemIndicator>\n <span className=\"h-1.5 w-1.5 rounded-full bg-doom-blue\" />\n </ItemIndicator>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n}\n\nexport function DropdownMenuSub(props: ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\n/** The row that opens a submenu; the chevron is part of the row, not the caller's job. */\nexport function DropdownMenuSubTrigger({\n className,\n children,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.SubTrigger>) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n className={cn(dropdownMenuItemVariants(), 'data-[state=open]:bg-doom-deep', className)}\n {...props}\n >\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n <ChevronRightIcon className=\"h-3 w-3 shrink-0 text-doom-faint\" />\n </DropdownMenuPrimitive.SubTrigger>\n );\n}\n\nexport function DropdownMenuSubContent({\n className,\n sideOffset = 2,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n sideOffset={sideOffset}\n className={cn(CONTENT_CLASS, className)}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nexport function DropdownMenuLabel({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Label>) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n className={cn('px-2.5 py-1 text-sm font-semibold text-doom-dim first-letter:uppercase', className)}\n {...props}\n />\n );\n}\n\n/** The keystroke printed at the right of a row; the row supplies the gap. */\nexport function DropdownMenuShortcut({ className, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn('ml-auto shrink-0 text-sm text-doom-dim', className)}\n {...props}\n />\n );\n}\n\nexport function DropdownMenuSeparator({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn('my-1 h-px bg-doom-border-soft', className)}\n {...props}\n />\n );\n}\n"],"mappings":"wLAQA,SAAgBU,EAAa,EAA0D,CACrF,MAAO,iBAAA,EAAAH,EAAA,IAAA,CAACP,EAAAA,aAAsB,KAAvB,CAA4B,YAAU,gBAAgB,GAAIW,CAAQ,CAAA,CAC3E,CAEA,SAAgBC,EAAoB,EAA6D,CAC/F,MAAO,iBAAA,EAAAL,EAAA,IAAA,CAACP,EAAAA,aAAsB,QAAvB,CAA+B,YAAU,wBAAwB,GAAIW,CAAQ,CAAA,CACtF,CAGA,SAAg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AJ,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,0BAA2B,UAAe,CAAA,EAC1D,iBAAA,EAAAA,EAAA,IAAA,CAACH,EAAAA,aAAD,CAAkB,UAAU,kCAAoC,CAAA,CAChC,GAEtC,CAEA,SAAgBuB,EAAuB,CACrC,YACA,aAAa,EACb,GAAGhB,GACuD,CAC1D,MACE,iBAAA,EAAAJ,EAAA,IAAA,CAACP,EAAAA,aAAsB,OAAvB,CAAA,SACE,iBAAA,EAAAO,EAAA,IAAA,CAACP,EAAAA,aAAsB,WAAvB,CACE,YAAU,4BACE,aACZ,UAAWC,EAAAA,GAAGa,EAAeE,CAAS,EACtC,GAAIL,CACL,CAAA,CAC2B,CAAA,CAElC,CAEA,SAAgBiB,EAAkB,CAAE,YAAW,GAAGjB,GAA6D,CAC7G,MACE,iBAAA,EAAAJ,EAAA,IAAA,CAACP,EAAAA,aAAsB,MAAvB,CACE,YAAU,sBACV,UAAWC,EAAAA,GAAG,yEAA0Ee,CAAS,EACjG,GAAIL,CACL,CAAA,CAEL,CAGA,SAAgBkB,EAAqB,CAAE,YAAW,GAAGlB,GAAiC,CACpF,MACE,iBAAA,EAAAJ,EAAA,IAAA,CAAC,OAAD,CACE,YAAU,yBACV,UAAWN,EAAAA,GAAG,yCAA0Ce,CAAS,EACjE,GAAIL,CACL,CAAA,CAEL,CAEA,SAAgBmB,EAAsB,CAAE,YAAW,GAAGnB,GAAiE,CACrH,MACE,iBAAA,EAAAJ,EAAA,IAAA,CAACP,EAAAA,aAAsB,UAAvB,CACE,YAAU,0BACV,UAAWC,EAAAA,GAAG,gCAAiCe,CAAS,EACxD,GAAIL,CACL,CAAA,CAEL"}
|
|
1
|
+
{"version":3,"file":"DropdownMenu.cjs","names":["DropdownMenuPrimitive","cn","cva","CheckIcon","ChevronRightIcon","require_cn","radix_ui","react_jsx_runtime","class_variance_authority","lucide_react","DropdownMenu","props","DropdownMenuTrigger","DropdownMenuGroup","CONTENT_CLASS","DropdownMenuContent","className","dropdownMenuItemVariants","DropdownMenuItem","variant","ItemIndicator","DropdownMenuCheckboxItem","children","DropdownMenuRadioGroup","DropdownMenuRadioItem","DropdownMenuSub","DropdownMenuSubTrigger","DropdownMenuSubContent","DropdownMenuLabel","DropdownMenuShortcut","DropdownMenuSeparator"],"sources":["../../../src/components/DropdownMenu.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport { CheckIcon, ChevronRightIcon } from '../icons/icons';\nimport { cn } from '../lib/cn';\n\n/** shadcn's DropdownMenu on Radix: roving focus, typeahead, outside click, Escape. */\nexport function DropdownMenu(props: ComponentProps<typeof DropdownMenuPrimitive.Root>) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nexport function DropdownMenuTrigger(props: ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {\n return <DropdownMenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />;\n}\n\n/** A run of items under one label, so the separator between groups is structural. */\nexport function DropdownMenuGroup(props: ComponentProps<typeof DropdownMenuPrimitive.Group>) {\n return <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />;\n}\n\n/** The surface every menu and submenu wears. */\nconst CONTENT_CLASS =\n 'z-50 flex min-w-[120px] flex-col overflow-hidden rounded border border-po-border bg-po-panel py-1 shadow-xl outline-none data-[state=open]:animate-po-rise';\n\nexport function DropdownMenuContent({\n className,\n align = 'end',\n sideOffset = 4,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.Content>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(CONTENT_CLASS, className)}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nexport const dropdownMenuItemVariants = cva(\n 'flex w-full cursor-pointer items-center gap-2 px-2.5 py-1.5 text-left text-base outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-40 data-[highlighted]:bg-po-deep',\n {\n variants: {\n variant: {\n default: 'text-po-hi',\n destructive: 'text-po-red',\n },\n /** A row that carries a check or bullet keeps a gutter for it, so labels line up whether or not one is set. */\n indented: { true: 'pl-7', false: '' },\n },\n defaultVariants: { variant: 'default', indented: false },\n },\n);\n\nexport interface DropdownMenuItemProps\n extends ComponentProps<typeof DropdownMenuPrimitive.Item>, VariantProps<typeof dropdownMenuItemVariants> {}\n\nexport function DropdownMenuItem({ className, variant, indented, ...props }: DropdownMenuItemProps) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-variant={variant ?? 'default'}\n className={cn(dropdownMenuItemVariants({ variant, indented }), className)}\n {...props}\n />\n );\n}\n\n/** The check or bullet a selectable row shows when it is set; it sits in the row's gutter. */\nfunction ItemIndicator({ children }: { children: ReactNode }) {\n return (\n <span className=\"pointer-events-none absolute left-2.5 flex h-3 w-3 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>{children}</DropdownMenuPrimitive.ItemIndicator>\n </span>\n );\n}\n\nexport interface DropdownMenuCheckboxItemProps\n extends ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>, VariantProps<typeof dropdownMenuItemVariants> {}\n\n/** A row that toggles: the check lives in the gutter so the label never shifts. */\nexport function DropdownMenuCheckboxItem({ className, variant, children, ...props }: DropdownMenuCheckboxItemProps) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn('relative', dropdownMenuItemVariants({ variant, indented: true }), className)}\n {...props}\n >\n <ItemIndicator>\n <CheckIcon className=\"h-3 w-3 text-po-blue\" />\n </ItemIndicator>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n}\n\n/** The exclusive-choice group; pair it with DropdownMenuRadioItem. */\nexport function DropdownMenuRadioGroup(props: ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {\n return <DropdownMenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nexport interface DropdownMenuRadioItemProps\n extends ComponentProps<typeof DropdownMenuPrimitive.RadioItem>, VariantProps<typeof dropdownMenuItemVariants> {}\n\nexport function DropdownMenuRadioItem({ className, variant, children, ...props }: DropdownMenuRadioItemProps) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn('relative', dropdownMenuItemVariants({ variant, indented: true }), className)}\n {...props}\n >\n <ItemIndicator>\n <span className=\"h-1.5 w-1.5 rounded-full bg-po-blue\" />\n </ItemIndicator>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n}\n\nexport function DropdownMenuSub(props: ComponentProps<typeof DropdownMenuPrimitive.Sub>) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\n/** The row that opens a submenu; the chevron is part of the row, not the caller's job. */\nexport function DropdownMenuSubTrigger({\n className,\n children,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.SubTrigger>) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n className={cn(dropdownMenuItemVariants(), 'data-[state=open]:bg-po-deep', className)}\n {...props}\n >\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n <ChevronRightIcon className=\"h-3 w-3 shrink-0 text-po-faint\" />\n </DropdownMenuPrimitive.SubTrigger>\n );\n}\n\nexport function DropdownMenuSubContent({\n className,\n sideOffset = 2,\n ...props\n}: ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n sideOffset={sideOffset}\n className={cn(CONTENT_CLASS, className)}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nexport function DropdownMenuLabel({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Label>) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n className={cn('px-2.5 py-1 text-sm font-semibold text-po-dim first-letter:uppercase', className)}\n {...props}\n />\n );\n}\n\n/** The keystroke printed at the right of a row; the row supplies the gap. */\nexport function DropdownMenuShortcut({ className, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn('ml-auto shrink-0 text-sm text-po-dim', className)}\n {...props}\n />\n );\n}\n\nexport function DropdownMenuSeparator({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn('my-1 h-px bg-po-border-soft', className)}\n {...props}\n />\n );\n}\n"],"mappings":"wLAQA,SAAgBU,EAAa,EAA0D,CACrF,MAAO,iBAAA,EAAAH,EAAA,IAAA,CAACP,EAAAA,aAAsB,KAAvB,CAA4B,YAAU,gBAAgB,GAAIW,CAAQ,CAAA,CAC3E,CAEA,SAAgBC,EAAoB,EAA6D,CAC/F,MAAO,iBAAA,EAAAL,EAAA,IAAA,CAACP,EAAAA,aAAsB,QAAvB,CAA+B,YAAU,wBAAwB,GAAIW,CAAQ,CAAA,CACtF,CAGA,SAAgBE,EAAkB,EAA2D,CAC3F,MAAO,iBAAA,EAAAN,EAAA,IAAA,CAACP,EAAAA,aAAsB,MAAvB,CAA6B,YAAU,sBAAsB,GAAIW,CAAQ,CAAA,CAClF,CAGA,MAAMG,EACJ,6JAEF,SAAgBC,EAAoB,CAClC,YACA,QAAQ,MACR,aAAa,EACb,GAAGJ,GACoD,CACvD,MACE,iBAAA,EAAAJ,EAAA,IAAA,CAACP,EAAAA,aAAsB,OAAvB,CAAA,SACE,iBAAA,EAAAO,EAAA,IAAA,CAACP,EAAAA,aAAsB,QAAvB,CACE,YAAU,wBACH,QACK,aACZ,UAAWC,EAAAA,GAAGa,EAAeE,CAAS,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,CACL,CAAA,CAC2B,CAAA,CAElC,CAEA,SAAgBiB,EAAkB,CAAE,YAAW,GAAGjB,GAA6D,CAC7G,MACE,iBAAA,EAAAJ,EAAA,IAAA,CAACP,EAAAA,aAAsB,MAAvB,CACE,YAAU,sBACV,UAAWC,EAAAA,GAAG,uEAAwEe,CAAS,EAC/F,GAAIL,CACL,CAAA,CAEL,CAGA,SAAgBkB,EAAqB,CAAE,YAAW,GAAGlB,GAAiC,CACpF,MACE,iBAAA,EAAAJ,EAAA,IAAA,CAAC,OAAD,CACE,YAAU,yBACV,UAAWN,EAAAA,GAAG,uCAAwCe,CAAS,EAC/D,GAAIL,CACL,CAAA,CAEL,CAEA,SAAgBmB,EAAsB,CAAE,YAAW,GAAGnB,GAAiE,CACrH,MACE,iBAAA,EAAAJ,EAAA,IAAA,CAACP,EAAAA,aAAsB,UAAvB,CACE,YAAU,0BACV,UAAWC,EAAAA,GAAG,8BAA+Be,CAAS,EACtD,GAAIL,CACL,CAAA,CAEL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../lib/cn.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime");function r({title:r,description:i,children:a,className:o,asChild:s=!1,...c}){let l=s?t.Slot.Root:`div`;return/* @__PURE__ */ (0,n.jsx)(l,{"data-slot":`empty-state`,className:e.cn(`flex min-w-0 flex-1 items-center justify-center px-3 py-4 sm:px-4`,o),...c,children:/* @__PURE__ */ (0,n.jsxs)(`div`,{className:`flex min-w-0 w-full max-w-[520px] flex-col items-center gap-3 text-center`,children:[/* @__PURE__ */ (0,n.jsx)(`span`,{className:`text-lg font-semibold text-
|
|
1
|
+
const e=require("../lib/cn.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime");function r({title:r,description:i,children:a,className:o,asChild:s=!1,...c}){let l=s?t.Slot.Root:`div`;return/* @__PURE__ */ (0,n.jsx)(l,{"data-slot":`empty-state`,className:e.cn(`flex min-w-0 flex-1 items-center justify-center px-3 py-4 sm:px-4`,o),...c,children:/* @__PURE__ */ (0,n.jsxs)(`div`,{className:`flex min-w-0 w-full max-w-[520px] flex-col items-center gap-3 text-center`,children:[/* @__PURE__ */ (0,n.jsx)(`span`,{className:`text-lg font-semibold text-po-hi`,children:r}),i?/* @__PURE__ */ (0,n.jsx)(`span`,{className:`text-base leading-relaxed text-po-dim`,children:i}):null,a]})})}exports.EmptyState=r;
|
|
2
2
|
//# sourceMappingURL=EmptyState.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.cjs","names":["Slot","cn","require_cn","radix_ui","react_jsx_runtime","EmptyState","props","Component","asChild","className","title","description","children"],"sources":["../../../src/components/EmptyState.tsx"],"sourcesContent":["import { Slot } from 'radix-ui';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport { cn } from '../lib/cn';\n\nexport interface EmptyStateProps extends Omit<ComponentProps<'div'>, 'title'> {\n title: ReactNode;\n description?: ReactNode;\n /** Optional calls to action under the copy. */\n children?: ReactNode;\n /**\n * Render the child element instead of a <div>, so an empty row inside a\n * list stays an <li> and the list keeps its semantics.\n */\n asChild?: boolean;\n}\n\n/** The centred \"nothing here yet\" card every empty panel shares. */\nexport function EmptyState({ title, description, children, className, asChild = false, ...props }: EmptyStateProps) {\n const Component = asChild ? Slot.Root : 'div';\n return (\n <Component\n data-slot=\"empty-state\"\n className={cn('flex min-w-0 flex-1 items-center justify-center px-3 py-4 sm:px-4', className)}\n {...props}\n >\n <div className=\"flex min-w-0 w-full max-w-[520px] flex-col items-center gap-3 text-center\">\n <span className=\"text-lg font-semibold text-
|
|
1
|
+
{"version":3,"file":"EmptyState.cjs","names":["Slot","cn","require_cn","radix_ui","react_jsx_runtime","EmptyState","props","Component","asChild","className","title","description","children"],"sources":["../../../src/components/EmptyState.tsx"],"sourcesContent":["import { Slot } from 'radix-ui';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport { cn } from '../lib/cn';\n\nexport interface EmptyStateProps extends Omit<ComponentProps<'div'>, 'title'> {\n title: ReactNode;\n description?: ReactNode;\n /** Optional calls to action under the copy. */\n children?: ReactNode;\n /**\n * Render the child element instead of a <div>, so an empty row inside a\n * list stays an <li> and the list keeps its semantics.\n */\n asChild?: boolean;\n}\n\n/** The centred \"nothing here yet\" card every empty panel shares. */\nexport function EmptyState({ title, description, children, className, asChild = false, ...props }: EmptyStateProps) {\n const Component = asChild ? Slot.Root : 'div';\n return (\n <Component\n data-slot=\"empty-state\"\n className={cn('flex min-w-0 flex-1 items-center justify-center px-3 py-4 sm:px-4', className)}\n {...props}\n >\n <div className=\"flex min-w-0 w-full max-w-[520px] flex-col items-center gap-3 text-center\">\n <span className=\"text-lg font-semibold text-po-hi\">{title}</span>\n {description ? <span className=\"text-base leading-relaxed text-po-dim\">{description}</span> : null}\n {children}\n </div>\n </Component>\n );\n}\n"],"mappings":"0FAkBA,SAAgBK,EAAW,CAAE,QAAO,cAAa,WAAU,YAAW,UAAU,GAAO,GAAGC,GAA0B,CAClH,IAAMC,EAAYC,EAAUR,EAAAA,KAAK,KAAO,MACxC,MACE,iBAAA,EAAAI,EAAA,IAAA,CAACG,EAAD,CACE,YAAU,cACV,UAAWN,EAAAA,GAAG,oEAAqEQ,CAAS,EAC5F,GAAIH,EAEJ,SAAA,iBAAA,EAAAF,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,4EAAf,SAAA,CACE,iBAAA,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,mCAAoC,SAAAM,CAAY,CAAA,EAC/DC,EAAc,iBAAA,EAAAP,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,wCAAyC,SAAAO,CAAkB,CAAA,EAAI,KAC7FC,CACE,GACI,CAAA,CAEf"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../lib/cn.cjs"),t=require("../lib/syntaxHighlight.cjs"),n=require("./SyntaxText.cjs"),r=require("../lib/hashlineHighlight.cjs");let i=require("react/jsx-runtime"),a=require("react");const o=/* @__PURE__ */ new Map;function s(e){let n=r.hashlineGroupsKey(e),[i,s]=(0,a.useState)(void 0);return(0,a.useEffect)(()=>{let r=!0,i=/* @__PURE__ */ new Map,a=e.map(async e=>{let n=t.detectGrammar({path:e.path,text:e.text});if(n===void 0)return;let r=await t.highlightToLines(e.text,n);if(r!==void 0)for(let[t,n]of e.indices.entries()){let e=r[t];e!==void 0&&i.set(n,e)}});return Promise.allSettled(a).then(()=>{r&&i.size>0&&s({key:n,spans:i})}),()=>{r=!1}},[n]),i?.key===n?i.spans:o}function c({className:t,lines:o,gutter:c,path:l,...u}){let d=s((0,a.useMemo)(()=>r.hashlineGroups(o,l),[o,l])),f={width:`${c}ch`};return/* @__PURE__ */ (0,i.jsx)(`div`,{"data-slot":`hashline-lines`,className:e.cn(`flex flex-col font-mono`,t),...u,children:o.map((e,t)=>{if(e.type===`file`)return/* @__PURE__ */ (0,i.jsx)(`span`,{className:`mt-1 truncate text-
|
|
1
|
+
const e=require("../lib/cn.cjs"),t=require("../lib/syntaxHighlight.cjs"),n=require("./SyntaxText.cjs"),r=require("../lib/hashlineHighlight.cjs");let i=require("react/jsx-runtime"),a=require("react");const o=/* @__PURE__ */ new Map;function s(e){let n=r.hashlineGroupsKey(e),[i,s]=(0,a.useState)(void 0);return(0,a.useEffect)(()=>{let r=!0,i=/* @__PURE__ */ new Map,a=e.map(async e=>{let n=t.detectGrammar({path:e.path,text:e.text});if(n===void 0)return;let r=await t.highlightToLines(e.text,n);if(r!==void 0)for(let[t,n]of e.indices.entries()){let e=r[t];e!==void 0&&i.set(n,e)}});return Promise.allSettled(a).then(()=>{r&&i.size>0&&s({key:n,spans:i})}),()=>{r=!1}},[n]),i?.key===n?i.spans:o}function c({className:t,lines:o,gutter:c,path:l,...u}){let d=s((0,a.useMemo)(()=>r.hashlineGroups(o,l),[o,l])),f={width:`${c}ch`};return/* @__PURE__ */ (0,i.jsx)(`div`,{"data-slot":`hashline-lines`,className:e.cn(`flex flex-col font-mono`,t),...u,children:o.map((e,t)=>{if(e.type===`file`)return/* @__PURE__ */ (0,i.jsx)(`span`,{className:`mt-1 truncate text-po-faint first:mt-0`,children:e.path},t);if(e.type===`plain`)return/* @__PURE__ */ (0,i.jsx)(`span`,{className:`whitespace-pre-wrap break-words text-po-dim`,children:e.text},t);let{value:r}=e;return/* @__PURE__ */ (0,i.jsxs)(`span`,{className:`flex gap-2`,children:[r.marker===void 0?null:/* @__PURE__ */ (0,i.jsx)(`span`,{className:`w-4 shrink-0 ${r.marker===`match`?`text-po-blue`:`text-po-faint`}`,children:r.marker===`match`?`>>`:``}),/* @__PURE__ */ (0,i.jsx)(`span`,{className:`shrink-0 text-right text-po-faint`,style:f,children:r.line}),/* @__PURE__ */ (0,i.jsx)(n.SyntaxLine,{spans:d.get(t),text:r.content,className:`min-w-0 whitespace-pre-wrap break-words ${r.marker===`match`?`text-po-hi`:`text-po-text`}`})]},t)})})}exports.HashlineLines=c;
|
|
2
2
|
//# sourceMappingURL=HashlineLines.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HashlineLines.cjs","names":["hashlineGroupsKey","useState","detectGrammar","highlightToLines","useMemo","hashlineGroups","cn","SyntaxLine","require_cn","require_syntaxHighlight","require_SyntaxText","require_hashlineHighlight","react_jsx_runtime","react","NO_SPANS","useHashlineSpans","key","groups","done","setDone","live","next","work","grammar","group","highlighted","offset","index","line","HashlineLines","props","spans","lines","path","gutterStyle","gutter","className","value"],"sources":["../../../src/components/HashlineLines.tsx"],"sourcesContent":["import { type ComponentProps, useEffect, useMemo, useState } from 'react';\n\nimport { cn } from '../lib/cn';\nimport { type HashlineGroup, hashlineGroups, hashlineGroupsKey } from '../lib/hashlineHighlight';\nimport type { PresentedLine } from '../lib/hashlineView';\nimport { detectGrammar, highlightToLines, type SyntaxSpan } from '../lib/syntaxHighlight';\nimport { SyntaxLine } from './SyntaxText';\n\n/**\n * The anchored body shared by hashline results: a file heading per group, a\n * right-aligned line-number gutter, and a `>>` marker on grep matches. The\n * gutter width is a style, not a class, because it follows the widest number.\n *\n * The anchored lines are coloured with the editor's grammars when the body\n * names a file, or when `path` names one for a result that does not. Colour\n * arrives a frame or two late and never blocks the text: an unhighlighted body\n * is the same body without the colours.\n */\nexport interface HashlineLinesProps extends ComponentProps<'div'> {\n lines: readonly PresentedLine[];\n /** Width of the line-number column, in characters, from `hashlineBody`. */\n gutter: number;\n /** The file a body of bare anchored lines came from, for highlighting. */\n path?: string | undefined;\n}\n\nconst NO_SPANS: ReadonlyMap<number, readonly SyntaxSpan[]> = new Map();\n\n/**\n * Spans per presented-line index, once every file's run has parsed. The result\n * is stored with the body it belongs to, so a body that has changed since\n * reads as plain rather than wearing the previous body's colours.\n */\nfunction useHashlineSpans(groups: readonly HashlineGroup[]): ReadonlyMap<number, readonly SyntaxSpan[]> {\n const key = hashlineGroupsKey(groups);\n const [done, setDone] = useState<{ key: string; spans: ReadonlyMap<number, readonly SyntaxSpan[]> } | undefined>(\n undefined,\n );\n\n useEffect(() => {\n let live = true;\n const next = new Map<number, readonly SyntaxSpan[]>();\n const work = groups.map(async (group) => {\n const grammar = detectGrammar({ path: group.path, text: group.text });\n if (grammar === undefined) return;\n const highlighted = await highlightToLines(group.text, grammar);\n if (highlighted === undefined) return;\n for (const [offset, index] of group.indices.entries()) {\n const line = highlighted[offset];\n if (line !== undefined) next.set(index, line);\n }\n });\n // One state write for the whole body, so a many-file grep result does not\n // repaint once per file. A grammar that fails to load leaves its run plain.\n void Promise.allSettled(work).then(() => {\n if (live && next.size > 0) setDone({ key, spans: next });\n });\n return () => {\n live = false;\n };\n // The groups are rebuilt every render; their key is what actually changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [key]);\n\n return done?.key === key ? done.spans : NO_SPANS;\n}\n\nexport function HashlineLines({ className, lines, gutter, path, ...props }: HashlineLinesProps) {\n const groups = useMemo(() => hashlineGroups(lines, path), [lines, path]);\n const spans = useHashlineSpans(groups);\n // Bound to a name rather than written inline: this file ships as a scaffold\n // template too, and an inline style object opens with the same two braces\n // Liquid reads as an output tag, which fails to render.\n const gutterStyle = { width: `${gutter}ch` };\n return (\n <div data-slot=\"hashline-lines\" className={cn('flex flex-col font-mono', className)} {...props}>\n {lines.map((line, index) => {\n if (line.type === 'file') {\n return (\n <span key={index} className=\"mt-1 truncate text-
|
|
1
|
+
{"version":3,"file":"HashlineLines.cjs","names":["hashlineGroupsKey","useState","detectGrammar","highlightToLines","useMemo","hashlineGroups","cn","SyntaxLine","require_cn","require_syntaxHighlight","require_SyntaxText","require_hashlineHighlight","react_jsx_runtime","react","NO_SPANS","useHashlineSpans","key","groups","done","setDone","live","next","work","grammar","group","highlighted","offset","index","line","HashlineLines","props","spans","lines","path","gutterStyle","gutter","className","value"],"sources":["../../../src/components/HashlineLines.tsx"],"sourcesContent":["import { type ComponentProps, useEffect, useMemo, useState } from 'react';\n\nimport { cn } from '../lib/cn';\nimport { type HashlineGroup, hashlineGroups, hashlineGroupsKey } from '../lib/hashlineHighlight';\nimport type { PresentedLine } from '../lib/hashlineView';\nimport { detectGrammar, highlightToLines, type SyntaxSpan } from '../lib/syntaxHighlight';\nimport { SyntaxLine } from './SyntaxText';\n\n/**\n * The anchored body shared by hashline results: a file heading per group, a\n * right-aligned line-number gutter, and a `>>` marker on grep matches. The\n * gutter width is a style, not a class, because it follows the widest number.\n *\n * The anchored lines are coloured with the editor's grammars when the body\n * names a file, or when `path` names one for a result that does not. Colour\n * arrives a frame or two late and never blocks the text: an unhighlighted body\n * is the same body without the colours.\n */\nexport interface HashlineLinesProps extends ComponentProps<'div'> {\n lines: readonly PresentedLine[];\n /** Width of the line-number column, in characters, from `hashlineBody`. */\n gutter: number;\n /** The file a body of bare anchored lines came from, for highlighting. */\n path?: string | undefined;\n}\n\nconst NO_SPANS: ReadonlyMap<number, readonly SyntaxSpan[]> = new Map();\n\n/**\n * Spans per presented-line index, once every file's run has parsed. The result\n * is stored with the body it belongs to, so a body that has changed since\n * reads as plain rather than wearing the previous body's colours.\n */\nfunction useHashlineSpans(groups: readonly HashlineGroup[]): ReadonlyMap<number, readonly SyntaxSpan[]> {\n const key = hashlineGroupsKey(groups);\n const [done, setDone] = useState<{ key: string; spans: ReadonlyMap<number, readonly SyntaxSpan[]> } | undefined>(\n undefined,\n );\n\n useEffect(() => {\n let live = true;\n const next = new Map<number, readonly SyntaxSpan[]>();\n const work = groups.map(async (group) => {\n const grammar = detectGrammar({ path: group.path, text: group.text });\n if (grammar === undefined) return;\n const highlighted = await highlightToLines(group.text, grammar);\n if (highlighted === undefined) return;\n for (const [offset, index] of group.indices.entries()) {\n const line = highlighted[offset];\n if (line !== undefined) next.set(index, line);\n }\n });\n // One state write for the whole body, so a many-file grep result does not\n // repaint once per file. A grammar that fails to load leaves its run plain.\n void Promise.allSettled(work).then(() => {\n if (live && next.size > 0) setDone({ key, spans: next });\n });\n return () => {\n live = false;\n };\n // The groups are rebuilt every render; their key is what actually changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [key]);\n\n return done?.key === key ? done.spans : NO_SPANS;\n}\n\nexport function HashlineLines({ className, lines, gutter, path, ...props }: HashlineLinesProps) {\n const groups = useMemo(() => hashlineGroups(lines, path), [lines, path]);\n const spans = useHashlineSpans(groups);\n // Bound to a name rather than written inline: this file ships as a scaffold\n // template too, and an inline style object opens with the same two braces\n // Liquid reads as an output tag, which fails to render.\n const gutterStyle = { width: `${gutter}ch` };\n return (\n <div data-slot=\"hashline-lines\" className={cn('flex flex-col font-mono', className)} {...props}>\n {lines.map((line, index) => {\n if (line.type === 'file') {\n return (\n <span key={index} className=\"mt-1 truncate text-po-faint first:mt-0\">\n {line.path}\n </span>\n );\n }\n if (line.type === 'plain') {\n return (\n <span key={index} className=\"whitespace-pre-wrap break-words text-po-dim\">\n {line.text}\n </span>\n );\n }\n const { value } = line;\n return (\n <span key={index} className=\"flex gap-2\">\n {value.marker !== undefined ? (\n <span className={`w-4 shrink-0 ${value.marker === 'match' ? 'text-po-blue' : 'text-po-faint'}`}>\n {value.marker === 'match' ? '>>' : ''}\n </span>\n ) : null}\n <span className=\"shrink-0 text-right text-po-faint\" style={gutterStyle}>\n {value.line}\n </span>\n <SyntaxLine\n spans={spans.get(index)}\n text={value.content}\n className={`min-w-0 whitespace-pre-wrap break-words ${value.marker === 'match' ? 'text-po-hi' : 'text-po-text'}`}\n />\n </span>\n );\n })}\n </div>\n );\n}\n"],"mappings":"uMA0BA,MAAMc,kBAAuD,IAAI,IAOjE,SAASC,EAAiB,EAA8E,CACtG,IAAMC,EAAMhB,EAAAA,kBAAkBiB,CAAM,EAC9B,CAACC,EAAMC,IAAA,EAAWlB,EAAAA,SAAAA,CACtB,IAAA,EACF,EA2BA,OAzBA,EAAAY,EAAA,UAAA,KAAgB,CACd,IAAIO,EAAO,GACLC,kBAAO,IAAI,IACXC,EAAOL,EAAO,IAAI,KAAO,IAAU,CACvC,IAAMM,EAAUrB,EAAAA,cAAc,CAAE,KAAMsB,EAAM,KAAM,KAAMA,EAAM,IAAK,CAAC,EACpE,GAAID,IAAY,IAAA,GAAW,OAC3B,IAAME,EAAc,MAAMtB,EAAAA,iBAAiBqB,EAAM,KAAMD,CAAO,EAC9D,GAAIE,IAAgB,IAAA,GACpB,IAAK,GAAM,CAACC,EAAQC,KAAUH,EAAM,QAAQ,QAAQ,EAAG,CACrD,IAAMI,EAAOH,EAAYC,GACrBE,IAAS,IAAA,IAAWP,EAAK,IAAIM,EAAOC,CAAI,CAC9C,CACF,CAAC,EAMD,OAHA,QAAa,WAAWN,CAAI,CAAC,CAAC,SAAW,CACnCF,GAAQC,EAAK,KAAO,GAAGF,EAAQ,CAAE,MAAK,MAAOE,CAAK,CAAC,CACzD,CAAC,MACY,CACX,EAAO,EACT,CAGF,EAAG,CAACL,CAAG,CAAC,EAEDE,GAAM,MAAQF,EAAME,EAAK,MAAQJ,CAC1C,CAEA,SAAgBe,EAAc,CAAE,YAAW,QAAO,SAAQ,OAAM,GAAGC,GAA6B,CAE9F,IAAMC,EAAQhB,GAAA,EADC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n=(0,require("class-variance-authority").cva)(`min-w-0 text-
|
|
1
|
+
const e=require("../lib/cn.cjs");let t=require("react/jsx-runtime");const n=(0,require("class-variance-authority").cva)(`min-w-0 text-po-hi outline-none placeholder:text-po-faint disabled:opacity-50 aria-invalid:border-po-edge-red aria-invalid:text-po-red`,{variants:{variant:{default:`rounded border border-po-border bg-po-deep transition-colors focus:border-po-green/60`,bare:`border-0 bg-transparent`},size:{xs:`min-h-6 px-1.5 py-0.5 text-sm`,sm:`min-h-7 px-2 py-1 text-sm`,md:`min-h-8 px-2.5 py-1.5 text-base`,lg:`min-h-9 px-3 py-1.5 text-base`}},compoundVariants:[{variant:`bare`,class:`min-h-0 p-0`}],defaultVariants:{variant:`default`,size:`md`}});function r({className:r,type:i,variant:a,size:o,...s}){return/* @__PURE__ */ (0,t.jsx)(`input`,{type:i??`text`,"data-slot":`input`,spellCheck:!1,className:e.cn(n({variant:a,size:o}),r),...s})}exports.Input=r,exports.fieldVariants=n;
|
|
2
2
|
//# sourceMappingURL=Input.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.cjs","names":["cva","cn","require_cn","react_jsx_runtime","fieldVariants","Input","props","type","className"],"sources":["../../../src/components/Input.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../lib/cn';\n\n/**\n * The shape both fields wear, so a single-line and a multi-line field in the\n * same form agree on their well, their type ramp, and their invalid state.\n * Textarea builds on it rather than restating it.\n */\nexport const fieldVariants = cva(\n 'min-w-0 text-
|
|
1
|
+
{"version":3,"file":"Input.cjs","names":["cva","cn","require_cn","react_jsx_runtime","fieldVariants","Input","props","type","className"],"sources":["../../../src/components/Input.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../lib/cn';\n\n/**\n * The shape both fields wear, so a single-line and a multi-line field in the\n * same form agree on their well, their type ramp, and their invalid state.\n * Textarea builds on it rather than restating it.\n */\nexport const fieldVariants = cva(\n 'min-w-0 text-po-hi outline-none placeholder:text-po-faint disabled:opacity-50 aria-invalid:border-po-edge-red aria-invalid:text-po-red',\n {\n variants: {\n variant: {\n default: 'rounded border border-po-border bg-po-deep transition-colors focus:border-po-green/60',\n /** No well: a composer or a palette search that draws its own surface. */\n bare: 'border-0 bg-transparent',\n },\n /** The same rungs Button names, so a field and the button beside it line up. */\n size: {\n xs: 'min-h-6 px-1.5 py-0.5 text-sm',\n sm: 'min-h-7 px-2 py-1 text-sm',\n md: 'min-h-8 px-2.5 py-1.5 text-base',\n lg: 'min-h-9 px-3 py-1.5 text-base',\n },\n },\n compoundVariants: [\n // A bare field sits inside a surface that already has its own padding,\n // so it keeps the size's type ramp and gives up the size's box.\n { variant: 'bare', class: 'min-h-0 p-0' },\n ],\n defaultVariants: { variant: 'default', size: 'md' },\n },\n);\n\nexport type FieldVariant = NonNullable<VariantProps<typeof fieldVariants>['variant']>;\nexport type FieldSize = NonNullable<VariantProps<typeof fieldVariants>['size']>;\n\nexport interface InputProps extends Omit<ComponentProps<'input'>, 'size'>, VariantProps<typeof fieldVariants> {}\n\n/** The one text field: deep well, quiet border, accent border on focus, red edge when invalid. */\nexport function Input({ className, type, variant, size, ...props }: InputProps) {\n return (\n <input\n type={type ?? 'text'}\n data-slot=\"input\"\n spellCheck={false}\n className={cn(fieldVariants({ variant, size }), className)}\n {...props}\n />\n );\n}\n"],"mappings":"oEAUA,MAAaI,GAAA,oCAAgBJ,CAAAA,CAAAA,IAAAA,CAC3B,yIACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,wFAET,KAAM,yBACR,EAEA,KAAM,CACJ,GAAI,gCACJ,GAAI,4BACJ,GAAI,kCACJ,GAAI,+BACN,CACF,EACA,iBAAkB,CAGhB,CAAE,QAAS,OAAQ,MAAO,aAAc,CAC1C,EACA,gBAAiB,CAAE,QAAS,UAAW,KAAM,IAAK,CACpD,CACF,EAQA,SAAgBK,EAAM,CAAE,YAAW,OAAM,UAAS,OAAM,GAAGC,GAAqB,CAC9E,MACE,iBAAA,EAAAH,EAAA,IAAA,CAAC,QAAD,CACE,KAAMI,GAAQ,OACd,YAAU,QACV,WAAY,GACZ,UAAWN,EAAAA,GAAGG,EAAc,CAAE,UAAS,MAAK,CAAC,EAAGI,CAAS,EACzD,GAAIF,CACL,CAAA,CAEL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../lib/cn.cjs");let t=require("react/jsx-runtime");function n({className:n,...r}){return/* @__PURE__ */ (0,t.jsx)(`kbd`,{"data-slot":`kbd`,className:e.cn(`inline-flex items-center rounded bg-
|
|
1
|
+
const e=require("../lib/cn.cjs");let t=require("react/jsx-runtime");function n({className:n,...r}){return/* @__PURE__ */ (0,t.jsx)(`kbd`,{"data-slot":`kbd`,className:e.cn(`inline-flex items-center rounded bg-po-deep px-1.5 py-0.5 font-mono text-xs font-medium text-po-dim`,n),...r})}exports.Kbd=n;
|
|
2
2
|
//# sourceMappingURL=Kbd.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Kbd.cjs","names":["cn","require_cn","react_jsx_runtime","Kbd","props","className"],"sources":["../../../src/components/Kbd.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\n\nimport { cn } from '../lib/cn';\n\n/** A key or key path, drawn as the leader hints draw them. */\nexport function Kbd({ className, ...props }: ComponentProps<'kbd'>) {\n return (\n <kbd\n data-slot=\"kbd\"\n className={cn(\n 'inline-flex items-center rounded bg-
|
|
1
|
+
{"version":3,"file":"Kbd.cjs","names":["cn","require_cn","react_jsx_runtime","Kbd","props","className"],"sources":["../../../src/components/Kbd.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\n\nimport { cn } from '../lib/cn';\n\n/** A key or key path, drawn as the leader hints draw them. */\nexport function Kbd({ className, ...props }: ComponentProps<'kbd'>) {\n return (\n <kbd\n data-slot=\"kbd\"\n className={cn(\n 'inline-flex items-center rounded bg-po-deep px-1.5 py-0.5 font-mono text-xs font-medium text-po-dim',\n className,\n )}\n {...props}\n />\n );\n}\n"],"mappings":"oEAKA,SAAgBG,EAAI,CAAE,YAAW,GAAGC,GAAgC,CAClE,MACE,iBAAA,EAAAF,EAAA,IAAA,CAAC,MAAD,CACE,YAAU,MACV,UAAWF,EAAAA,GACT,sGACAK,CACF,EACA,GAAID,CACL,CAAA,CAEL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../lib/cn.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime");function r({className:r,...i}){return/* @__PURE__ */ (0,n.jsx)(t.Label.Root,{"data-slot":`label`,className:e.cn(`flex items-center gap-1.5 text-base font-medium text-
|
|
1
|
+
const e=require("../lib/cn.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime");function r({className:r,...i}){return/* @__PURE__ */ (0,n.jsx)(t.Label.Root,{"data-slot":`label`,className:e.cn(`flex items-center gap-1.5 text-base font-medium text-po-text select-none has-[+:disabled]:opacity-50`,r),...i})}exports.Label=r;
|
|
2
2
|
//# sourceMappingURL=Label.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.cjs","names":["LabelPrimitive","cn","require_cn","radix_ui","react_jsx_runtime","Label","props","className"],"sources":["../../../src/components/Label.tsx"],"sourcesContent":["import { Label as LabelPrimitive } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../lib/cn';\n\n/** A field's name: clicking it focuses the control, which a bare span never does. */\nexport function Label({ className, ...props }: ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-1.5 text-base font-medium text-
|
|
1
|
+
{"version":3,"file":"Label.cjs","names":["LabelPrimitive","cn","require_cn","radix_ui","react_jsx_runtime","Label","props","className"],"sources":["../../../src/components/Label.tsx"],"sourcesContent":["import { Label as LabelPrimitive } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../lib/cn';\n\n/** A field's name: clicking it focuses the control, which a bare span never does. */\nexport function Label({ className, ...props }: ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'flex items-center gap-1.5 text-base font-medium text-po-text select-none has-[+:disabled]:opacity-50',\n className,\n )}\n {...props}\n />\n );\n}\n"],"mappings":"0FAMA,SAAgBK,EAAM,CAAE,YAAW,GAAGC,GAAqD,CACzF,MACE,iBAAA,EAAAF,EAAA,IAAA,CAACJ,EAAAA,MAAe,KAAhB,CACE,YAAU,QACV,UAAWC,EAAAA,GACT,uGACAM,CACF,EACA,GAAID,CACL,CAAA,CAEL"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("./CodeBlock.cjs");let n=require("react/jsx-runtime"),r=require("react"),i=require("react-markdown");i=e.__toESM(i,1);let a=require("remark-gfm");a=e.__toESM(a,1);const o=[a.default],s=`rounded bg-
|
|
2
|
-
`)?t:void 0,l=o===void 0||e!==void 0?void 0:a?.(o);return l!==void 0&&o!==void 0?/* @__PURE__ */ (0,n.jsx)(`button`,{type:`button`,"data-testid":`markdown-file-link`,title:`open ${o}`,onClick:l,className:`${s} cursor-pointer underline decoration-
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("./CodeBlock.cjs");let n=require("react/jsx-runtime"),r=require("react"),i=require("react-markdown");i=e.__toESM(i,1);let a=require("remark-gfm");a=e.__toESM(a,1);const o=[a.default],s=`rounded bg-po-deep px-1 py-px font-mono text-po-green`,c=(0,r.createContext)(void 0),l=(0,r.createContext)(void 0);function u({src:e,alt:t}){let i=(0,r.useContext)(l),a;if(typeof e==`string`&&e!==``&&!/^(?:[a-z][a-z\d+.-]*:|\/\/|#|\?)/i.test(e))try{a=decodeURIComponent(e.split(/[?#]/,1)[0])}catch{a=``}let[o,s]=(0,r.useState)();(0,r.useEffect)(()=>{if(i===void 0||a===void 0)return;let e=!0,t;return Promise.resolve().then(()=>{if(e&&s(void 0),a===``)throw Error(`Invalid image path.`);return i(a)}).then(n=>{e?(t=n,s({path:a,loader:i,url:n.url})):n.dispose()}).catch(()=>{e&&s({path:a,loader:i,failed:!0})}),()=>{e=!1,t?.dispose()}},[a,i]);let c=o?.path===a&&o?.loader===i?o:void 0;return i!==void 0&&a!==void 0&&(c?.url===void 0||c.failed)?/* @__PURE__ */ (0,n.jsxs)(`span`,{role:c?.failed?`alert`:`status`,title:a,children:[t||a||`Image`,` (`,c?.failed?`unavailable`:`loading...`,`)`]}):/* @__PURE__ */ (0,n.jsx)(`img`,{src:i!==void 0&&a!==void 0?c?.url:e,alt:t??``,onError:i!==void 0&&a!==void 0?()=>s({path:a,loader:i,failed:!0}):void 0,className:`max-h-[480px] max-w-full rounded border border-po-border`})}function d({className:e,children:t,...i}){let a=(0,r.useContext)(c),o=typeof t==`string`&&!t.includes(`
|
|
2
|
+
`)?t:void 0,l=o===void 0||e!==void 0?void 0:a?.(o);return l!==void 0&&o!==void 0?/* @__PURE__ */ (0,n.jsx)(`button`,{type:`button`,"data-testid":`markdown-file-link`,title:`open ${o}`,onClick:l,className:`${s} cursor-pointer underline decoration-po-green/40 underline-offset-2 hover:text-po-hi hover:decoration-po-hi`,children:o}):/* @__PURE__ */ (0,n.jsx)(`code`,{...i,className:`${e??``} ${s} [pre_&]:bg-transparent [pre_&]:p-0 [pre_&]:text-po-hi`,children:t})}function f({href:e,children:t}){let i=(0,r.useContext)(c),a=e;try{a=e===void 0?void 0:decodeURIComponent(e)}catch{a=void 0}let o=a!==void 0&&a!==``&&!/^(?:[a-z][a-z\d+.-]*:|\/\/|#|\?)/i.test(a)?i?.(a,!0):void 0;return o===void 0?/* @__PURE__ */ (0,n.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`text-po-blue underline decoration-po-blue/50`,children:t}):/* @__PURE__ */ (0,n.jsx)(`button`,{type:`button`,"data-testid":`markdown-file-link`,title:`open ${a}`,onClick:o,className:`text-po-blue underline decoration-po-blue/50`,children:t})}function p(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>p(e)).join(``):``}function m({children:e}){let i=(0,r.isValidElement)(e)?e:void 0;return i===void 0?/* @__PURE__ */ (0,n.jsx)(`pre`,{className:`overflow-x-auto rounded border border-po-border bg-po-deep p-2.5 text-sm leading-relaxed`,children:e}):/* @__PURE__ */ (0,n.jsx)(t.CodeBlock,{text:p(i.props.children).replace(/\n$/,``),className:i.props.className})}const h={p:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:e}),strong:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`strong`,{className:`font-semibold text-po-hi`,children:e}),em:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`em`,{className:`italic`,children:e}),del:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`del`,{className:`text-po-dim line-through`,children:e}),a:f,code:d,pre:m,ul:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`ul`,{className:`list-disc pl-5`,children:e}),ol:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`ol`,{className:`list-decimal pl-5`,children:e}),li:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`li`,{className:`whitespace-pre-wrap break-words`,children:e}),h1:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`h1`,{className:`mt-2 text-2xl font-semibold text-po-hi first:mt-0`,children:e}),h2:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`h2`,{className:`mt-2 text-xl font-semibold text-po-hi first:mt-0`,children:e}),h3:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`h3`,{className:`mt-1 text-lg font-semibold text-po-hi first:mt-0`,children:e}),h4:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`h4`,{className:`font-semibold text-po-hi`,children:e}),h5:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`h5`,{className:`font-semibold text-po-text`,children:e}),h6:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`h6`,{className:`font-semibold text-po-dim`,children:e}),blockquote:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`blockquote`,{className:`border-l-2 border-po-border pl-3 text-po-dim`,children:e}),hr:()=>/* @__PURE__ */ (0,n.jsx)(`hr`,{className:`border-po-border-soft`}),table:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`div`,{className:`overflow-x-auto`,children:/* @__PURE__ */ (0,n.jsx)(`table`,{className:`border-collapse`,children:e})}),th:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`th`,{className:`border border-po-border bg-po-deep px-2 py-1 text-left font-semibold text-po-hi`,children:e}),td:({children:e})=>/* @__PURE__ */ (0,n.jsx)(`td`,{className:`border border-po-border px-2 py-1 align-top`,children:e}),img:u};function g({text:e,onFileLink:t,loadImage:r}){return/* @__PURE__ */ (0,n.jsx)(c.Provider,{value:t,children:/* @__PURE__ */ (0,n.jsx)(l.Provider,{value:r,children:/* @__PURE__ */ (0,n.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:/* @__PURE__ */ (0,n.jsx)(i.default,{remarkPlugins:o,components:h,children:e})})})})}exports.Markdown=g;
|
|
3
3
|
//# sourceMappingURL=Markdown.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.cjs","names":["remarkGfm","createContext","useContext","useState","isValidElement","CodeBlock","ReactMarkdown","require_runtime","require_CodeBlock","react_jsx_runtime","react","react_markdown","remark_gfm","REMARK_PLUGINS","CODE_CLASS","FileLinkContext","ImageContext","Image","loader","path","src","loaded","setLoaded","active","asset","result","current","alt","Code","rest","onFileLink","label","children","open","className","Link","href","textOf","child","Pre","code","COMPONENTS","Markdown","loadImage","text"],"sources":["../../../src/components/Markdown.tsx"],"sourcesContent":["import {\n createContext,\n type ComponentProps,\n isValidElement,\n type ReactNode,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport ReactMarkdown, { type Components } from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\n\nimport { CodeBlock } from './CodeBlock';\n\nconst REMARK_PLUGINS = [remarkGfm];\n\n// No size: inline code follows the prose it sits in, 15px in the conversation\n// and 13px in a compact transcript, so a path never reads smaller than its sentence.\nconst CODE_CLASS = 'rounded bg-doom-deep px-1 py-px font-mono text-doom-green';\n\n/**\n * What a piece of inline code opens, when the host knows.\n *\n * Returning undefined leaves the span as plain code, which is the answer for\n * everything a message quotes that is not a file: a class name, a flag, a\n * command. The caller decides what counts, because only it knows which files\n * the session has.\n */\nexport type FileLinkHandler = (text: string, explicit?: boolean) => (() => void) | undefined;\n\n/**\n * Passed by context rather than as a component prop so the component map stays\n * a module constant. Rebuilding that map per render gives react-markdown new\n * component identities, which remounts the whole rendered tree on every frame\n * of a streaming reply.\n */\nconst FileLinkContext = createContext<FileLinkHandler | undefined>(undefined);\n\ntype ImageLoader = (path: string) => Promise<{ url: string; dispose(): void }>;\nconst ImageContext = createContext<ImageLoader | undefined>(undefined);\n\nfunction Image({ src, alt }: ComponentProps<'img'>) {\n const loader = useContext(ImageContext);\n let path: string | undefined;\n if (typeof src === 'string' && src !== '' && !/^(?:[a-z][a-z\\d+.-]*:|\\/\\/|#|\\?)/i.test(src)) {\n try {\n path = decodeURIComponent(src.split(/[?#]/, 1)[0]!);\n } catch {\n // An invalid encoded filename is shown as unavailable, never fetched.\n path = '';\n }\n }\n const [loaded, setLoaded] = useState<{ path: string; loader: ImageLoader; url?: string; failed?: boolean }>();\n useEffect(() => {\n if (loader === undefined || path === undefined) return;\n let active = true;\n let asset: Awaited<ReturnType<ImageLoader>> | undefined;\n void Promise.resolve()\n .then(() => {\n if (active) setLoaded(undefined);\n if (path === '') throw new Error('Invalid image path.');\n return loader(path);\n })\n .then((result) => {\n if (!active) {\n result.dispose();\n return;\n }\n asset = result;\n setLoaded({ path, loader, url: result.url });\n })\n .catch(() => {\n if (active) setLoaded({ path, loader, failed: true });\n });\n return () => {\n active = false;\n asset?.dispose();\n };\n }, [path, loader]);\n const current = loaded?.path === path && loaded?.loader === loader ? loaded : undefined;\n if (loader !== undefined && path !== undefined && (current?.url === undefined || current.failed))\n return (\n <span role={current?.failed ? 'alert' : 'status'} title={path}>\n {alt || path || 'Image'} ({current?.failed ? 'unavailable' : 'loading...'})\n </span>\n );\n return (\n <img\n src={loader !== undefined && path !== undefined ? current?.url : src}\n alt={alt ?? ''}\n onError={loader !== undefined && path !== undefined ? () => setLoaded({ path, loader, failed: true }) : undefined}\n className=\"max-h-[480px] max-w-full rounded border border-doom-border\"\n />\n );\n}\n\nfunction Code({ className, children, ...rest }: ComponentProps<'code'>) {\n const onFileLink = useContext(FileLinkContext);\n // Only a single-line span with no language class is a candidate: a fenced\n // block is content, not a reference, and its own renderer owns it.\n const label = typeof children === 'string' && !children.includes('\\n') ? children : undefined;\n const open = label === undefined || className !== undefined ? undefined : onFileLink?.(label);\n if (open !== undefined && label !== undefined) {\n return (\n <button\n type=\"button\"\n data-testid=\"markdown-file-link\"\n title={`open ${label}`}\n onClick={open}\n className={`${CODE_CLASS} cursor-pointer underline decoration-doom-green/40 underline-offset-2 hover:text-doom-hi hover:decoration-doom-hi`}\n >\n {label}\n </button>\n );\n }\n return (\n <code\n {...rest}\n className={`${className ?? ''} ${CODE_CLASS} [pre_&]:bg-transparent [pre_&]:p-0 [pre_&]:text-doom-hi`}\n >\n {children}\n </code>\n );\n}\n\nfunction Link({ href, children }: ComponentProps<'a'>) {\n const onFileLink = useContext(FileLinkContext);\n let path = href;\n try {\n path = href === undefined ? undefined : decodeURIComponent(href);\n } catch {\n path = undefined;\n }\n const isFile = path !== undefined && path !== '' && !/^(?:[a-z][a-z\\d+.-]*:|\\/\\/|#|\\?)/i.test(path);\n const open = isFile ? onFileLink?.(path!, true) : undefined;\n if (open !== undefined)\n return (\n <button\n type=\"button\"\n data-testid=\"markdown-file-link\"\n title={`open ${path}`}\n onClick={open}\n className=\"text-doom-blue underline decoration-doom-blue/50\"\n >\n {children}\n </button>\n );\n return (\n <a href={href} target=\"_blank\" rel=\"noreferrer\" className=\"text-doom-blue underline decoration-doom-blue/50\">\n {children}\n </a>\n );\n}\n\n/** The text inside a fence, which react-markdown hands over as nested strings. */\nfunction textOf(children: ReactNode): string {\n if (typeof children === 'string') return children;\n if (Array.isArray(children)) return children.map((child) => textOf(child as ReactNode)).join('');\n return '';\n}\n\n/**\n * A fenced block, read off the <code> child that carries its language.\n *\n * The block is handed to `CodeBlock` whole rather than rendered as a styled\n * <pre> around inline code, because a fence is content with its own\n * presentation: it is coloured, it can be copied, and a mermaid fence is a\n * picture. A <pre> that came from raw HTML has no such child and keeps the\n * plain box.\n */\nfunction Pre({ children }: ComponentProps<'pre'>) {\n const code = isValidElement<{ className?: string; children?: ReactNode }>(children) ? children : undefined;\n if (code === undefined)\n return (\n <pre className=\"overflow-x-auto rounded border border-doom-border bg-doom-deep p-2.5 text-sm leading-relaxed\">\n {children}\n </pre>\n );\n // Markdown ends every fence with a newline the author did not type.\n return <CodeBlock text={textOf(code.props.children).replace(/\\n$/, '')} className={code.props.className} />;\n}\nconst COMPONENTS: Components = {\n p: ({ children }) => <p className=\"whitespace-pre-wrap break-words\">{children}</p>,\n strong: ({ children }) => <strong className=\"font-semibold text-doom-hi\">{children}</strong>,\n em: ({ children }) => <em className=\"italic\">{children}</em>,\n del: ({ children }) => <del className=\"text-doom-dim line-through\">{children}</del>,\n a: Link,\n code: Code,\n pre: Pre,\n ul: ({ children }) => <ul className=\"list-disc pl-5\">{children}</ul>,\n ol: ({ children }) => <ol className=\"list-decimal pl-5\">{children}</ol>,\n li: ({ children }) => <li className=\"whitespace-pre-wrap break-words\">{children}</li>,\n // Headings step up from the prose they sit in and never shrink below it, so a\n // reply's `##` reads as a heading in both the 15px conversation and a 13px\n // compact transcript. h4 to h6 keep the prose size and lean on weight alone.\n h1: ({ children }) => <h1 className=\"mt-2 text-2xl font-semibold text-doom-hi first:mt-0\">{children}</h1>,\n h2: ({ children }) => <h2 className=\"mt-2 text-xl font-semibold text-doom-hi first:mt-0\">{children}</h2>,\n h3: ({ children }) => <h3 className=\"mt-1 text-lg font-semibold text-doom-hi first:mt-0\">{children}</h3>,\n h4: ({ children }) => <h4 className=\"font-semibold text-doom-hi\">{children}</h4>,\n h5: ({ children }) => <h5 className=\"font-semibold text-doom-text\">{children}</h5>,\n h6: ({ children }) => <h6 className=\"font-semibold text-doom-dim\">{children}</h6>,\n blockquote: ({ children }) => (\n <blockquote className=\"border-l-2 border-doom-border pl-3 text-doom-dim\">{children}</blockquote>\n ),\n hr: () => <hr className=\"border-doom-border-soft\" />,\n table: ({ children }) => (\n <div className=\"overflow-x-auto\">\n <table className=\"border-collapse\">{children}</table>\n </div>\n ),\n th: ({ children }) => (\n <th className=\"border border-doom-border bg-doom-deep px-2 py-1 text-left font-semibold text-doom-hi\">\n {children}\n </th>\n ),\n td: ({ children }) => <td className=\"border border-doom-border px-2 py-1 align-top\">{children}</td>,\n img: Image,\n};\n\n/** GitHub-flavored Markdown using the cockpit's safe, shared presentation. */\nexport function Markdown({\n text,\n onFileLink,\n loadImage,\n}: {\n text: string;\n onFileLink?: FileLinkHandler;\n loadImage?: ImageLoader;\n}) {\n return (\n <FileLinkContext.Provider value={onFileLink}>\n <ImageContext.Provider value={loadImage}>\n <div className=\"flex min-w-0 flex-col gap-2\">\n <ReactMarkdown remarkPlugins={REMARK_PLUGINS} components={COMPONENTS}>\n {text}\n </ReactMarkdown>\n </div>\n </ImageContext.Provider>\n </FileLinkContext.Provider>\n );\n}\n"],"mappings":"qOAcA,MAAMa,EAAiB,CAACb,EAAAA,OAAS,EAI3Bc,EAAa,4DAkBbC,GAAA,EAAkBd,EAAAA,cAAAA,CAA2C,IAAA,EAAS,EAGtEe,GAAA,EAAef,EAAAA,cAAAA,CAAuC,IAAA,EAAS,EAErE,SAASgB,EAAM,CAAE,MAAK,OAA8B,CAClD,IAAMC,GAAA,EAAShB,EAAAA,WAAAA,CAAWc,CAAY,EAClCG,EACJ,GAAI,OAAOC,GAAQ,UAAYA,IAAQ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CAAI,UAAU,gDAAiD,UAAa,CAAA,EAClG,IAAKQ,CACP,EAGA,SAAgByB,EAAS,CACvB,OACA,aACA,aAKC,CACD,MACE,iBAAA,EAAAjC,EAAA,IAAA,CAACM,EAAgB,SAAjB,CAA0B,MAAOe,EAC/B,SAAA,iBAAA,EAAArB,EAAA,IAAA,CAACO,EAAa,SAAd,CAAuB,MAAO2B,EAC5B,SAAA,iBAAA,EAAAlC,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,8BACb,SAAA,iBAAA,EAAAA,EAAA,IAAA,CAACH,EAAAA,QAAD,CAAe,cAAeO,EAAgB,WAAY4B,EACvD,SAAAG,CACY,CAAA,CACZ,CAAA,CACgB,CAAA,CACC,CAAA,CAE9B"}
|
|
1
|
+
{"version":3,"file":"Markdown.cjs","names":["remarkGfm","createContext","useContext","useState","isValidElement","CodeBlock","ReactMarkdown","require_runtime","require_CodeBlock","react_jsx_runtime","react","react_markdown","remark_gfm","REMARK_PLUGINS","CODE_CLASS","FileLinkContext","ImageContext","Image","loader","path","src","loaded","setLoaded","active","asset","result","current","alt","Code","rest","onFileLink","label","children","open","className","Link","href","textOf","child","Pre","code","COMPONENTS","Markdown","loadImage","text"],"sources":["../../../src/components/Markdown.tsx"],"sourcesContent":["import {\n createContext,\n type ComponentProps,\n isValidElement,\n type ReactNode,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport ReactMarkdown, { type Components } from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\n\nimport { CodeBlock } from './CodeBlock';\n\nconst REMARK_PLUGINS = [remarkGfm];\n\n// No size: inline code follows the prose it sits in, 15px in the conversation\n// and 13px in a compact transcript, so a path never reads smaller than its sentence.\nconst CODE_CLASS = 'rounded bg-po-deep px-1 py-px font-mono text-po-green';\n\n/**\n * What a piece of inline code opens, when the host knows.\n *\n * Returning undefined leaves the span as plain code, which is the answer for\n * everything a message quotes that is not a file: a class name, a flag, a\n * command. The caller decides what counts, because only it knows which files\n * the session has.\n */\nexport type FileLinkHandler = (text: string, explicit?: boolean) => (() => void) | undefined;\n\n/**\n * Passed by context rather than as a component prop so the component map stays\n * a module constant. Rebuilding that map per render gives react-markdown new\n * component identities, which remounts the whole rendered tree on every frame\n * of a streaming reply.\n */\nconst FileLinkContext = createContext<FileLinkHandler | undefined>(undefined);\n\ntype ImageLoader = (path: string) => Promise<{ url: string; dispose(): void }>;\nconst ImageContext = createContext<ImageLoader | undefined>(undefined);\n\nfunction Image({ src, alt }: ComponentProps<'img'>) {\n const loader = useContext(ImageContext);\n let path: string | undefined;\n if (typeof src === 'string' && src !== '' && !/^(?:[a-z][a-z\\d+.-]*:|\\/\\/|#|\\?)/i.test(src)) {\n try {\n path = decodeURIComponent(src.split(/[?#]/, 1)[0]!);\n } catch {\n // An invalid encoded filename is shown as unavailable, never fetched.\n path = '';\n }\n }\n const [loaded, setLoaded] = useState<{ path: string; loader: ImageLoader; url?: string; failed?: boolean }>();\n useEffect(() => {\n if (loader === undefined || path === undefined) return;\n let active = true;\n let asset: Awaited<ReturnType<ImageLoader>> | undefined;\n void Promise.resolve()\n .then(() => {\n if (active) setLoaded(undefined);\n if (path === '') throw new Error('Invalid image path.');\n return loader(path);\n })\n .then((result) => {\n if (!active) {\n result.dispose();\n return;\n }\n asset = result;\n setLoaded({ path, loader, url: result.url });\n })\n .catch(() => {\n if (active) setLoaded({ path, loader, failed: true });\n });\n return () => {\n active = false;\n asset?.dispose();\n };\n }, [path, loader]);\n const current = loaded?.path === path && loaded?.loader === loader ? loaded : undefined;\n if (loader !== undefined && path !== undefined && (current?.url === undefined || current.failed))\n return (\n <span role={current?.failed ? 'alert' : 'status'} title={path}>\n {alt || path || 'Image'} ({current?.failed ? 'unavailable' : 'loading...'})\n </span>\n );\n return (\n <img\n src={loader !== undefined && path !== undefined ? current?.url : src}\n alt={alt ?? ''}\n onError={loader !== undefined && path !== undefined ? () => setLoaded({ path, loader, failed: true }) : undefined}\n className=\"max-h-[480px] max-w-full rounded border border-po-border\"\n />\n );\n}\n\nfunction Code({ className, children, ...rest }: ComponentProps<'code'>) {\n const onFileLink = useContext(FileLinkContext);\n // Only a single-line span with no language class is a candidate: a fenced\n // block is content, not a reference, and its own renderer owns it.\n const label = typeof children === 'string' && !children.includes('\\n') ? children : undefined;\n const open = label === undefined || className !== undefined ? undefined : onFileLink?.(label);\n if (open !== undefined && label !== undefined) {\n return (\n <button\n type=\"button\"\n data-testid=\"markdown-file-link\"\n title={`open ${label}`}\n onClick={open}\n className={`${CODE_CLASS} cursor-pointer underline decoration-po-green/40 underline-offset-2 hover:text-po-hi hover:decoration-po-hi`}\n >\n {label}\n </button>\n );\n }\n return (\n <code\n {...rest}\n className={`${className ?? ''} ${CODE_CLASS} [pre_&]:bg-transparent [pre_&]:p-0 [pre_&]:text-po-hi`}\n >\n {children}\n </code>\n );\n}\n\nfunction Link({ href, children }: ComponentProps<'a'>) {\n const onFileLink = useContext(FileLinkContext);\n let path = href;\n try {\n path = href === undefined ? undefined : decodeURIComponent(href);\n } catch {\n path = undefined;\n }\n const isFile = path !== undefined && path !== '' && !/^(?:[a-z][a-z\\d+.-]*:|\\/\\/|#|\\?)/i.test(path);\n const open = isFile ? onFileLink?.(path!, true) : undefined;\n if (open !== undefined)\n return (\n <button\n type=\"button\"\n data-testid=\"markdown-file-link\"\n title={`open ${path}`}\n onClick={open}\n className=\"text-po-blue underline decoration-po-blue/50\"\n >\n {children}\n </button>\n );\n return (\n <a href={href} target=\"_blank\" rel=\"noreferrer\" className=\"text-po-blue underline decoration-po-blue/50\">\n {children}\n </a>\n );\n}\n\n/** The text inside a fence, which react-markdown hands over as nested strings. */\nfunction textOf(children: ReactNode): string {\n if (typeof children === 'string') return children;\n if (Array.isArray(children)) return children.map((child) => textOf(child as ReactNode)).join('');\n return '';\n}\n\n/**\n * A fenced block, read off the <code> child that carries its language.\n *\n * The block is handed to `CodeBlock` whole rather than rendered as a styled\n * <pre> around inline code, because a fence is content with its own\n * presentation: it is coloured, it can be copied, and a mermaid fence is a\n * picture. A <pre> that came from raw HTML has no such child and keeps the\n * plain box.\n */\nfunction Pre({ children }: ComponentProps<'pre'>) {\n const code = isValidElement<{ className?: string; children?: ReactNode }>(children) ? children : undefined;\n if (code === undefined)\n return (\n <pre className=\"overflow-x-auto rounded border border-po-border bg-po-deep p-2.5 text-sm leading-relaxed\">\n {children}\n </pre>\n );\n // Markdown ends every fence with a newline the author did not type.\n return <CodeBlock text={textOf(code.props.children).replace(/\\n$/, '')} className={code.props.className} />;\n}\nconst COMPONENTS: Components = {\n p: ({ children }) => <p className=\"whitespace-pre-wrap break-words\">{children}</p>,\n strong: ({ children }) => <strong className=\"font-semibold text-po-hi\">{children}</strong>,\n em: ({ children }) => <em className=\"italic\">{children}</em>,\n del: ({ children }) => <del className=\"text-po-dim line-through\">{children}</del>,\n a: Link,\n code: Code,\n pre: Pre,\n ul: ({ children }) => <ul className=\"list-disc pl-5\">{children}</ul>,\n ol: ({ children }) => <ol className=\"list-decimal pl-5\">{children}</ol>,\n li: ({ children }) => <li className=\"whitespace-pre-wrap break-words\">{children}</li>,\n // Headings step up from the prose they sit in and never shrink below it, so a\n // reply's `##` reads as a heading in both the 15px conversation and a 13px\n // compact transcript. h4 to h6 keep the prose size and lean on weight alone.\n h1: ({ children }) => <h1 className=\"mt-2 text-2xl font-semibold text-po-hi first:mt-0\">{children}</h1>,\n h2: ({ children }) => <h2 className=\"mt-2 text-xl font-semibold text-po-hi first:mt-0\">{children}</h2>,\n h3: ({ children }) => <h3 className=\"mt-1 text-lg font-semibold text-po-hi first:mt-0\">{children}</h3>,\n h4: ({ children }) => <h4 className=\"font-semibold text-po-hi\">{children}</h4>,\n h5: ({ children }) => <h5 className=\"font-semibold text-po-text\">{children}</h5>,\n h6: ({ children }) => <h6 className=\"font-semibold text-po-dim\">{children}</h6>,\n blockquote: ({ children }) => (\n <blockquote className=\"border-l-2 border-po-border pl-3 text-po-dim\">{children}</blockquote>\n ),\n hr: () => <hr className=\"border-po-border-soft\" />,\n table: ({ children }) => (\n <div className=\"overflow-x-auto\">\n <table className=\"border-collapse\">{children}</table>\n </div>\n ),\n th: ({ children }) => (\n <th className=\"border border-po-border bg-po-deep px-2 py-1 text-left font-semibold text-po-hi\">{children}</th>\n ),\n td: ({ children }) => <td className=\"border border-po-border px-2 py-1 align-top\">{children}</td>,\n img: Image,\n};\n\n/** GitHub-flavored Markdown using the cockpit's safe, shared presentation. */\nexport function Markdown({\n text,\n onFileLink,\n loadImage,\n}: {\n text: string;\n onFileLink?: FileLinkHandler;\n loadImage?: ImageLoader;\n}) {\n return (\n <FileLinkContext.Provider value={onFileLink}>\n <ImageContext.Provider value={loadImage}>\n <div className=\"flex min-w-0 flex-col gap-2\">\n <ReactMarkdown remarkPlugins={REMARK_PLUGINS} components={COMPONENTS}>\n {text}\n </ReactMarkdown>\n </div>\n </ImageContext.Provider>\n </FileLinkContext.Provider>\n );\n}\n"],"mappings":"qOAcA,MAAMa,EAAiB,CAACb,EAAAA,OAAS,EAI3Bc,EAAa,wDAkBbC,GAAA,EAAkBd,EAAAA,cAAAA,CAA2C,IAAA,EAAS,EAGtEe,GAAA,EAAef,EAAAA,cAAAA,CAAuC,IAAA,EAAS,EAErE,SAASgB,EAAM,CAAE,MAAK,OAA8B,CAClD,IAAMC,GAAA,EAAShB,EAAAA,WAAAA,CAAWc,CAAY,EAClCG,EACJ,GAAI,OAAOC,GAAQ,UAAYA,IAAQ,IAAM,CAAC,oCAAoC,KAAKA,CAAG,EACxF,GAAI,CACF,EAAO,mBAAmBA,EAAI,MAAM,OAAQ,CAAC,CAAC,CAAC,EAAG,CACpD,MAAQ,CAEN,EAAO,EACT,CAEF,GAAM,CAACC,EAAQC,IAAA,EAAanB,EAAAA,SAAAA,CAAgF,GAC5G,EAAAO,EAAA,UAAA,KAAgB,CACd,GAAIQ,IAAW,IAAA,IAAaC,IAAS,IAAA,GAAW,OAChD,IAAII,EAAS,GACTC,EAkBJ,OAjBA,QAAa,QAAQ,CAAC,CACnB,SAAW,CAEV,GADID,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4B,EACvD,SAAAG,CACY,CAAA,CACZ,CAAA,CACgB,CAAA,CACC,CAAA,CAE9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpApp.cjs","names":["Component","createRoot","App","react_jsx_runtime","react","_modelcontextprotocol_ext_apps","react_dom_client","WidgetBoundary","McpApp","Widget","view","widgets","mountMcpApp","element","root","app","disposed","terminal","connected","appVisible","render","fail","message","identify","name","widget","updateRefresh","enabled","applyContext","context","tool","ui","args","result","dispose"],"sources":["../../../src/components/McpApp.tsx"],"sourcesContent":["import type { DoomMcpWidgetProps } from '@agimon-ai/po-core/web';\nimport {\n App,\n applyDocumentTheme,\n applyHostStyleVariables,\n type McpUiHostContext,\n} from '@modelcontextprotocol/ext-apps';\nimport { Component, type ComponentType, type ReactNode } from 'react';\nimport { createRoot } from 'react-dom/client';\n\ninterface View {\n readonly widget?: string;\n readonly props: DoomMcpWidgetProps;\n readonly failure?: string;\n}\n\nclass WidgetBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {\n state = { failed: false };\n\n static getDerivedStateFromError() {\n return { failed: true };\n }\n\n render() {\n return this.state.failed ? <p role=\"status\">The tool widget could not be rendered.</p> : this.props.children;\n }\n}\n\n/** The root only dispatches. Tool-specific presentation belongs to the contributing package. */\nexport function McpApp({\n widgets,\n view,\n}: {\n widgets: Readonly<Record<string, ComponentType<DoomMcpWidgetProps>>>;\n view: View;\n}) {\n const Widget = view.widget !== undefined && Object.hasOwn(widgets, view.widget) ? widgets[view.widget] : undefined;\n if (view.failure) return <p role=\"status\">{view.failure}</p>;\n if (Widget === undefined)\n return (\n <p role=\"status\">\n {view.widget === undefined ? 'Waiting for tool information...' : 'No widget is available for this tool.'}\n </p>\n );\n return (\n <WidgetBoundary key={view.widget}>\n <Widget {...view.props} />\n </WidgetBoundary>\n );\n}\n\n/** Mounts one independently sandboxed invocation of the sync-generated widget registry. */\nexport async function mountMcpApp(widgets: Readonly<Record<string, ComponentType<DoomMcpWidgetProps>>>): Promise<void> {\n const element = document.getElementById('root');\n if (element === null) throw new Error('Missing MCP app root');\n const root = createRoot(element);\n const app = new App({ name: 'po-tools', version: '1.0.0' }, {}, { autoResize: true });\n let disposed = false;\n let terminal = false;\n let connected = false;\n let appVisible = false;\n let view: View = { props: { toolName: '', args: {}, result: null, phase: 'connecting' } };\n\n const render = (): void => {\n if (!disposed) root.render(<McpApp widgets={widgets} view={view} />);\n };\n const fail = (message: string): void => {\n terminal = true;\n view = { ...view, failure: message };\n render();\n };\n const identify = (name: unknown, widget: unknown): boolean => {\n if (typeof name === 'string' && name.length > 0) {\n if (view.props.toolName && view.props.toolName !== name) {\n fail('The tool changed. Reopen this widget from the conversation.');\n return false;\n }\n view = { ...view, props: { ...view.props, toolName: name } };\n }\n if (typeof widget === 'string') {\n if (view.widget !== undefined && view.widget !== widget) {\n fail('The widget changed. Refresh the MCP connection.');\n return false;\n }\n view = { ...view, widget };\n }\n return true;\n };\n const updateRefresh = (): void => {\n const name = view.props.toolName;\n const enabled = connected && appVisible && !!app.getHostCapabilities()?.serverTools && name.length > 0;\n view = {\n ...view,\n props: {\n ...view.props,\n refresh: enabled\n ? async () => {\n if (disposed || name !== view.props.toolName || !appVisible)\n throw new Error('This widget is no longer active.');\n return app.callServerTool({ name, arguments: { ...view.props.args } });\n }\n : undefined,\n },\n };\n };\n const applyContext = (context: McpUiHostContext | undefined): void => {\n if (disposed || context === undefined) return;\n if (context.theme) {\n applyDocumentTheme(context.theme);\n document.documentElement.classList.toggle('dark', context.theme === 'dark');\n document.documentElement.dataset.theme = context.theme;\n }\n if (context.styles?.variables) applyHostStyleVariables(context.styles.variables);\n const tool = context.toolInfo?.tool;\n if (tool) {\n if (!identify(tool.name, tool._meta?.['po/widget'])) return;\n const ui = tool._meta?.ui as { visibility?: unknown } | undefined;\n appVisible = Array.isArray(ui?.visibility) && ui.visibility.includes('app');\n }\n updateRefresh();\n render();\n };\n\n app.ontoolinputpartial = ({ arguments: args }) => {\n if (disposed || terminal) return;\n view = { ...view, props: { ...view.props, args: args ?? {}, phase: 'preparing' } };\n render();\n };\n app.ontoolinput = ({ arguments: args }) => {\n if (disposed || terminal) return;\n view = { ...view, props: { ...view.props, args: args ?? {}, phase: 'running' } };\n render();\n };\n app.ontoolresult = (result) => {\n if (disposed || terminal) return;\n if (!identify(result._meta?.['po/toolName'], result._meta?.['po/widget'])) return;\n terminal = true;\n view = { ...view, props: { ...view.props, result, phase: 'result' } };\n updateRefresh();\n render();\n };\n app.ontoolcancelled = () => {\n if (disposed || terminal) return;\n terminal = true;\n view = { ...view, props: { ...view.props, phase: 'cancelled', result: null } };\n render();\n };\n app.onhostcontextchanged = applyContext;\n\n const dispose = (): void => {\n if (disposed) return;\n view = { ...view, failure: 'Tool view closed.' };\n render();\n disposed = true;\n window.removeEventListener('pagehide', dispose);\n setTimeout(() => {\n void app.close().catch(() => {});\n }, 0);\n };\n\n app.onteardown = () => {\n dispose();\n return {};\n };\n window.addEventListener('pagehide', dispose, { once: true });\n render();\n\n try {\n await app.connect();\n if (disposed) return;\n connected = true;\n applyContext(app.getHostContext());\n } catch {\n if (!disposed) fail('Could not connect to the app host. Reopen this widget in an MCP Apps-compatible client.');\n }\n}\n"],"mappings":"gIAgBA,IAAMO,EAAN,cAA6BP,EAAAA,SAAwD,CACnF,MAAQ,CAAE,OAAQ,EAAM,EAExB,OAAO,0BAA2B,CAChC,MAAO,CAAE,OAAQ,EAAK,CACxB,CAEA,QAAS,CACP,OAAO,KAAK,MAAM,OAAS,iBAAA,EAAAG,EAAA,IAAA,CAAC,IAAD,CAAG,KAAK,SAAS,SAAA,wCAAyC,CAAA,EAAI,KAAK,MAAM,QACtG,CACF,EAGA,SAAgBK,EAAO,CACrB,UACA,QAIC,CACD,IAAMC,EAASC,EAAK,SAAW,IAAA,IAAa,OAAO,OAAOC,EAASD,EAAK,MAAM,EAAIC,EAAQD,EAAK,QAAU,IAAA,GAQzG,OAPIA,EAAK,QAAgB,iBAAA,EAAAP,EAAA,IAAA,C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ocol_ext_apps","react_dom_client","WidgetBoundary","McpApp","Widget","view","widgets","mountMcpApp","element","root","app","disposed","terminal","connected","appVisible","render","fail","message","identify","name","widget","updateRefresh","enabled","applyContext","context","tool","ui","args","result","dispose"],"sources":["../../../src/components/McpApp.tsx"],"sourcesContent":["import type { PoMcpWidgetProps } from '@agimon-ai/po-core/web';\nimport {\n App,\n applyDocumentTheme,\n applyHostStyleVariables,\n type McpUiHostContext,\n} from '@modelcontextprotocol/ext-apps';\nimport { Component, type ComponentType, type ReactNode } from 'react';\nimport { createRoot } from 'react-dom/client';\n\ninterface View {\n readonly widget?: string;\n readonly props: PoMcpWidgetProps;\n readonly failure?: string;\n}\n\nclass WidgetBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {\n state = { failed: false };\n\n static getDerivedStateFromError() {\n return { failed: true };\n }\n\n render() {\n return this.state.failed ? <p role=\"status\">The tool widget could not be rendered.</p> : this.props.children;\n }\n}\n\n/** The root only dispatches. Tool-specific presentation belongs to the contributing package. */\nexport function McpApp({\n widgets,\n view,\n}: {\n widgets: Readonly<Record<string, ComponentType<PoMcpWidgetProps>>>;\n view: View;\n}) {\n const Widget = view.widget !== undefined && Object.hasOwn(widgets, view.widget) ? widgets[view.widget] : undefined;\n if (view.failure) return <p role=\"status\">{view.failure}</p>;\n if (Widget === undefined)\n return (\n <p role=\"status\">\n {view.widget === undefined ? 'Waiting for tool information...' : 'No widget is available for this tool.'}\n </p>\n );\n return (\n <WidgetBoundary key={view.widget}>\n <Widget {...view.props} />\n </WidgetBoundary>\n );\n}\n\n/** Mounts one independently sandboxed invocation of the sync-generated widget registry. */\nexport async function mountMcpApp(widgets: Readonly<Record<string, ComponentType<PoMcpWidgetProps>>>): Promise<void> {\n const element = document.getElementById('root');\n if (element === null) throw new Error('Missing MCP app root');\n const root = createRoot(element);\n const app = new App({ name: 'po-tools', version: '1.0.0' }, {}, { autoResize: true });\n let disposed = false;\n let terminal = false;\n let connected = false;\n let appVisible = false;\n let view: View = { props: { toolName: '', args: {}, result: null, phase: 'connecting' } };\n\n const render = (): void => {\n if (!disposed) root.render(<McpApp widgets={widgets} view={view} />);\n };\n const fail = (message: string): void => {\n terminal = true;\n view = { ...view, failure: message };\n render();\n };\n const identify = (name: unknown, widget: unknown): boolean => {\n if (typeof name === 'string' && name.length > 0) {\n if (view.props.toolName && view.props.toolName !== name) {\n fail('The tool changed. Reopen this widget from the conversation.');\n return false;\n }\n view = { ...view, props: { ...view.props, toolName: name } };\n }\n if (typeof widget === 'string') {\n if (view.widget !== undefined && view.widget !== widget) {\n fail('The widget changed. Refresh the MCP connection.');\n return false;\n }\n view = { ...view, widget };\n }\n return true;\n };\n const updateRefresh = (): void => {\n const name = view.props.toolName;\n const enabled = connected && appVisible && !!app.getHostCapabilities()?.serverTools && name.length > 0;\n view = {\n ...view,\n props: {\n ...view.props,\n refresh: enabled\n ? async () => {\n if (disposed || name !== view.props.toolName || !appVisible)\n throw new Error('This widget is no longer active.');\n return app.callServerTool({ name, arguments: { ...view.props.args } });\n }\n : undefined,\n },\n };\n };\n const applyContext = (context: McpUiHostContext | undefined): void => {\n if (disposed || context === undefined) return;\n if (context.theme) {\n applyDocumentTheme(context.theme);\n document.documentElement.classList.toggle('dark', context.theme === 'dark');\n document.documentElement.dataset.theme = context.theme;\n }\n if (context.styles?.variables) applyHostStyleVariables(context.styles.variables);\n const tool = context.toolInfo?.tool;\n if (tool) {\n if (!identify(tool.name, tool._meta?.['po/widget'])) return;\n const ui = tool._meta?.ui as { visibility?: unknown } | undefined;\n appVisible = Array.isArray(ui?.visibility) && ui.visibility.includes('app');\n }\n updateRefresh();\n render();\n };\n\n app.ontoolinputpartial = ({ arguments: args }) => {\n if (disposed || terminal) return;\n view = { ...view, props: { ...view.props, args: args ?? {}, phase: 'preparing' } };\n render();\n };\n app.ontoolinput = ({ arguments: args }) => {\n if (disposed || terminal) return;\n view = { ...view, props: { ...view.props, args: args ?? {}, phase: 'running' } };\n render();\n };\n app.ontoolresult = (result) => {\n if (disposed || terminal) return;\n if (!identify(result._meta?.['po/toolName'], result._meta?.['po/widget'])) return;\n terminal = true;\n view = { ...view, props: { ...view.props, result, phase: 'result' } };\n updateRefresh();\n render();\n };\n app.ontoolcancelled = () => {\n if (disposed || terminal) return;\n terminal = true;\n view = { ...view, props: { ...view.props, phase: 'cancelled', result: null } };\n render();\n };\n app.onhostcontextchanged = applyContext;\n\n const dispose = (): void => {\n if (disposed) return;\n view = { ...view, failure: 'Tool view closed.' };\n render();\n disposed = true;\n window.removeEventListener('pagehide', dispose);\n setTimeout(() => {\n void app.close().catch(() => {});\n }, 0);\n };\n\n app.onteardown = () => {\n dispose();\n return {};\n };\n window.addEventListener('pagehide', dispose, { once: true });\n render();\n\n try {\n await app.connect();\n if (disposed) return;\n connected = true;\n applyContext(app.getHostContext());\n } catch {\n if (!disposed) fail('Could not connect to the app host. Reopen this widget in an MCP Apps-compatible client.');\n }\n}\n"],"mappings":"gIAgBA,IAAMO,EAAN,cAA6BP,EAAAA,SAAwD,CACnF,MAAQ,CAAE,OAAQ,EAAM,EAExB,OAAO,0BAA2B,CAChC,MAAO,CAAE,OAAQ,EAAK,CACxB,CAEA,QAAS,CACP,OAAO,KAAK,MAAM,OAAS,iBAAA,EAAAG,EAAA,IAAA,CAAC,IAAD,CAAG,KAAK,SAAS,SAAA,wCAAyC,CAAA,EAAI,KAAK,MAAM,QACtG,CACF,EAGA,SAAgBK,EAAO,CACrB,UACA,QAIC,CACD,IAAMC,EAASC,EAAK,SAAW,IAAA,IAAa,OAAO,OAAOC,EAASD,EAAK,MAAM,EAAIC,EAAQD,EAAK,QAAU,IAAA,GAQzG,OAPIA,EAAK,QAAgB,iBAAA,EAAAP,EAAA,IAAA,CAAC,IAAD,CAAG,KAAK,SAAU,SAAAO,EAAK,OAAW,CAAA,EACvDD,IAAW,IAAA,GAEX,iBAAA,EAAAN,EAAA,IAAA,CAAC,IAAD,CAAG,KAAK,SACL,SAAAO,EAAK,SAAW,IAAA,GAAY,kCAAoC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MAAO,CAAE,GAAGA,EAAK,MAAO,KAAMsB,GAAQ,CAAC,EAAG,MAAO,SAAU,CAAE,EAC/EZ,EAAO,EACT,EACA,EAAI,aAAgB,GAAW,CACzBJ,GAAYC,GACXM,EAASU,EAAO,QAAQ,eAAgBA,EAAO,QAAQ,YAAY,IACxE,EAAW,GACX,EAAO,CAAE,GAAGvB,EAAM,MAAO,CAAE,GAAGA,EAAK,MAAO,SAAQ,MAAO,QAAS,CAAE,EACpEgB,EAAc,EACdN,EAAO,EACT,EACA,EAAI,oBAAwB,CACtBJ,GAAYC,IAChB,EAAW,GACX,EAAO,CAAE,GAAGP,EAAM,MAAO,CAAE,GAAGA,EAAK,MAAO,MAAO,YAAa,OAAQ,IAAK,CAAE,EAC7EU,EAAO,EACT,EACA,EAAI,qBAAuBQ,EAE3B,IAAMM,MAAsB,CACtBlB,IACJ,EAAO,CAAE,GAAGN,EAAM,QAAS,mBAAoB,EAC/CU,EAAO,EACP,EAAW,GACX,OAAO,oBAAoB,WAAYc,CAAO,EAC9C,eAAiB,CACfnB,EAAS,MAAM,CAAC,CAAC,UAAY,CAAC,CAAC,CACjC,EAAG,CAAC,EACN,EAEA,EAAI,gBACFmB,EAAQ,EACD,CAAC,GAEV,OAAO,iBAAiB,WAAYA,EAAS,CAAE,KAAM,EAAK,CAAC,EAC3Dd,EAAO,EAEP,GAAI,CAEF,GADA,MAAML,EAAI,QAAQ,EACdC,EAAU,OACd,EAAY,GACZY,EAAab,EAAI,eAAe,CAAC,CACnC,MAAQ,CACDC,GAAUK,EAAK,yFAAyF,CAC/G,CACF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
let e=require("react/jsx-runtime");function t({title:t,phase:n,result:r,error:i,children:a}){let o=n===`error`||r?.isError===!0;return/* @__PURE__ */ (0,e.jsxs)(`section`,{className:`min-w-0 rounded-md border border-
|
|
2
|
-
`:``}${e.text}`,o=Math.max(0,n-r.length);i||=t.length>o,r+=t.slice(0,o)}if(!r&&t.structuredContent){let e=JSON.stringify(t.structuredContent,null,2);r=e.slice(0,n),i=e.length>n}return/* @__PURE__ */ (0,e.jsxs)(`details`,{open:!0,className:`min-w-0 rounded-md border border-
|
|
1
|
+
let e=require("react/jsx-runtime");function t({title:t,phase:n,result:r,error:i,children:a}){let o=n===`error`||r?.isError===!0;return/* @__PURE__ */ (0,e.jsxs)(`section`,{className:`min-w-0 rounded-md border border-po-border bg-po-bg p-4 text-base text-po-text`,children:[/* @__PURE__ */ (0,e.jsx)(`h1`,{className:`m-0 break-words text-lg font-semibold`,children:t}),/* @__PURE__ */ (0,e.jsx)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:o?`my-2 text-po-red`:`my-2 text-po-dim`,children:i??(o?`Tool failed`:n===`result`?`Result received`:n===`cancelled`?`Tool cancelled`:n===`running`?`Running tool...`:n===`preparing`?`Preparing tool...`:`Connecting to host...`)}),a]})}function n(e){if(typeof e==`string`)return e.length>500?`${e.slice(0,500)}...`:e;if(typeof e==`number`&&Number.isFinite(e)||typeof e==`boolean`)return String(e);if(Array.isArray(e)&&e.every(e=>typeof e==`string`))return n(e.join(`, `))}function r({fields:t}){let r=t.flatMap(([e,t])=>{let r=n(t);return r===void 0||r===``?[]:[{label:e,text:r}]});return r.length===0?null:/* @__PURE__ */ (0,e.jsx)(`dl`,{"aria-label":`Tool details`,className:`my-3 flex min-w-0 flex-col gap-2`,children:r.map(({label:t,text:n})=>/* @__PURE__ */ (0,e.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-x-3 gap-y-1`,children:[/* @__PURE__ */ (0,e.jsx)(`dt`,{className:`text-sm text-po-dim`,children:t}),/* @__PURE__ */ (0,e.jsx)(`dd`,{className:`m-0 min-w-0 whitespace-pre-wrap break-all text-sm`,children:n})]},t))})}function i({result:t}){if(t===null)return null;let n=8e3,r=``,i=!1,a=0;for(let e of t.content??[]){if(e.type!==`text`){a+=1;continue}let t=`${r?`
|
|
2
|
+
`:``}${e.text}`,o=Math.max(0,n-r.length);i||=t.length>o,r+=t.slice(0,o)}if(!r&&t.structuredContent){let e=JSON.stringify(t.structuredContent,null,2);r=e.slice(0,n),i=e.length>n}return/* @__PURE__ */ (0,e.jsxs)(`details`,{open:!0,className:`min-w-0 rounded-md border border-po-border-soft`,children:[/* @__PURE__ */ (0,e.jsx)(`summary`,{className:`cursor-pointer bg-po-panel p-3 text-sm focus-visible:outline`,children:`Tool output`}),/* @__PURE__ */ (0,e.jsx)(`pre`,{tabIndex:0,"aria-label":`Tool output preview`,className:`m-0 max-h-72 overflow-auto whitespace-pre-wrap break-all p-3 font-mono text-sm`,children:r||(a?`Non-text result returned to the agent.`:`No text output.`)}),i||a?/* @__PURE__ */ (0,e.jsxs)(`p`,{className:`m-0 border-t border-po-border-soft p-3 text-sm text-po-dim`,children:[i?`Preview truncated. Full output remains in the tool result. `:``,a?`${a} non-text content item(s) returned to the agent.`:``]}):null]})}exports.McpToolFields=r,exports.McpToolFrame=t,exports.McpToolOutput=i;
|
|
3
3
|
//# sourceMappingURL=McpToolWidget.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpToolWidget.cjs","names":["react_jsx_runtime","McpToolFrame","failed","phase","result","title","error","children","fieldText","value","item","McpToolFields","values","fields","label","text","McpToolOutput","limit","truncated","nonText","block","part","remaining"],"sources":["../../../src/components/McpToolWidget.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"McpToolWidget.cjs","names":["react_jsx_runtime","McpToolFrame","failed","phase","result","title","error","children","fieldText","value","item","McpToolFields","values","fields","label","text","McpToolOutput","limit","truncated","nonText","block","part","remaining"],"sources":["../../../src/components/McpToolWidget.tsx"],"sourcesContent":["import type { PoMcpWidgetProps } from '@agimon-ai/po-core/mcpWidget';\nimport type { ReactNode } from 'react';\n\n/** Presentational primitives only. Each package chooses its own fields and result presentation. */\nexport function McpToolFrame({\n title,\n phase,\n result,\n error,\n children,\n}: Pick<PoMcpWidgetProps, 'phase' | 'result' | 'error'> & { title: string; children?: ReactNode }) {\n const failed = phase === 'error' || result?.isError === true;\n const status = failed\n ? 'Tool failed'\n : phase === 'result'\n ? 'Result received'\n : phase === 'cancelled'\n ? 'Tool cancelled'\n : phase === 'running'\n ? 'Running tool...'\n : phase === 'preparing'\n ? 'Preparing tool...'\n : 'Connecting to host...';\n return (\n <section className=\"min-w-0 rounded-md border border-po-border bg-po-bg p-4 text-base text-po-text\">\n <h1 className=\"m-0 break-words text-lg font-semibold\">{title}</h1>\n <p\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className={failed ? 'my-2 text-po-red' : 'my-2 text-po-dim'}\n >\n {error ?? status}\n </p>\n {children}\n </section>\n );\n}\n\nfunction fieldText(value: unknown): string | undefined {\n if (typeof value === 'string') return value.length > 500 ? `${value.slice(0, 500)}...` : value;\n if (typeof value === 'number' && Number.isFinite(value)) return String(value);\n if (typeof value === 'boolean') return String(value);\n if (Array.isArray(value) && value.every((item) => typeof item === 'string')) return fieldText(value.join(', '));\n return undefined;\n}\n\nexport function McpToolFields({ fields }: { fields: readonly (readonly [string, unknown])[] }) {\n const values = fields.flatMap(([label, value]) => {\n const text = fieldText(value);\n return text === undefined || text === '' ? [] : [{ label, text }];\n });\n if (values.length === 0) return null;\n return (\n <dl aria-label=\"Tool details\" className=\"my-3 flex min-w-0 flex-col gap-2\">\n {values.map(({ label, text }) => (\n <div key={label} className=\"flex min-w-0 flex-wrap gap-x-3 gap-y-1\">\n <dt className=\"text-sm text-po-dim\">{label}</dt>\n <dd className=\"m-0 min-w-0 whitespace-pre-wrap break-all text-sm\">{text}</dd>\n </div>\n ))}\n </dl>\n );\n}\n\nexport function McpToolOutput({ result }: Pick<PoMcpWidgetProps, 'result'>) {\n if (result === null) return null;\n const limit = 8000;\n let text = '';\n let truncated = false;\n let nonText = 0;\n for (const block of result.content ?? []) {\n if (block.type !== 'text') {\n nonText += 1;\n continue;\n }\n const part = `${text ? '\\n' : ''}${block.text}`;\n const remaining = Math.max(0, limit - text.length);\n truncated ||= part.length > remaining;\n text += part.slice(0, remaining);\n }\n if (!text && result.structuredContent) {\n const value = JSON.stringify(result.structuredContent, null, 2);\n text = value.slice(0, limit);\n truncated = value.length > limit;\n }\n return (\n <details open className=\"min-w-0 rounded-md border border-po-border-soft\">\n <summary className=\"cursor-pointer bg-po-panel p-3 text-sm focus-visible:outline\">Tool output</summary>\n <pre\n tabIndex={0}\n aria-label=\"Tool output preview\"\n className=\"m-0 max-h-72 overflow-auto whitespace-pre-wrap break-all p-3 font-mono text-sm\"\n >\n {text || (nonText ? 'Non-text result returned to the agent.' : 'No text output.')}\n </pre>\n {truncated || nonText ? (\n <p className=\"m-0 border-t border-po-border-soft p-3 text-sm text-po-dim\">\n {truncated ? 'Preview truncated. Full output remains in the tool result. ' : ''}\n {nonText ? `${nonText} non-text content item(s) returned to the agent.` : ''}\n </p>\n ) : null}\n </details>\n );\n}\n"],"mappings":"mCAIA,SAAgBC,EAAa,CAC3B,QACA,QACA,SACA,QACA,YACiG,CACjG,IAAMC,EAASC,IAAU,SAAWC,GAAQ,UAAY,GAYxD,MACE,iBAAA,EAAAJ,EAAA,KAAA,CAAC,UAAD,CAAS,UAAU,iFAAnB,SAAA,CACE,iBAAA,EAAAA,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,wCAAyC,SAAAK,CAAU,CAAA,EACjE,iBAAA,EAAAL,EAAA,IAAA,CAAC,IAAD,CACE,KAAK,SACL,YAAU,SACV,cAAY,OACZ,UAAWE,EAAS,mBAAqB,mBAExC,SAAAI,IApBQJ,EACX,cACAC,IAAU,SACR,kBACAA,IAAU,YACR,iBACAA,IAAU,UACR,kBACAA,IAAU,YACR,oBACA,wBAWL,CAAA,EACFI,CACM,GAEb,CAEA,SAASC,EAAU,EAAoC,CACrD,GAAI,OAAOC,GAAU,SAAU,OAAOA,EAAM,OAAS,IAAM,GAAGA,EAAM,MAAM,EAAG,GAAG,EAAE,KAAOA,EAEzF,GADI,OAAOA,GAAU,UAAY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S,CACjC,CACA,GAAI,CAACP,GAAQX,EAAO,kBAAmB,CACrC,IAAMK,EAAQ,KAAK,UAAUL,EAAO,kBAAmB,KAAM,CAAC,EAC9D,EAAOK,EAAM,MAAM,EAAGQ,CAAK,EAC3B,EAAYR,EAAM,OAASQ,CAC7B,CACA,MACE,iBAAA,EAAAjB,EAAA,KAAA,CAAC,UAAD,CAAS,KAAA,GAAK,UAAU,kDAAxB,SAAA,CACE,iBAAA,EAAAA,EAAA,IAAA,CAAC,UAAD,CAAS,UAAU,+DAA+D,SAAA,aAAoB,CAAA,EACtG,iBAAA,EAAAA,EAAA,IAAA,CAAC,MAAD,CACE,SAAU,EACV,aAAW,sBACX,UAAU,iFAET,SAAAe,IAASI,EAAU,yCAA2C,kBAC5D,CAAA,EACJD,GAAaC,EACZ,iBAAA,EAAAnB,EAAA,KAAA,CAAC,IAAD,CAAG,UAAU,6DAAb,SAAA,CACGkB,EAAY,8DAAgE,GAC5EC,EAAU,GAAGA,EAAQ,kDAAoD,EACzE,CACD,CAAA,EAAA,IACG,GAEb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
require("../icons/icons.cjs");const e=require("../lib/cn.cjs"),t=require("./Badge.cjs"),n=require("../lib/media.cjs"),r=require("../lib/mediaPlayback.cjs"),i=require("./PdfPreview.cjs");let a=require("react/jsx-runtime"),o=require("react"),s=require("lucide-react");const c=`max-w-full rounded border border-
|
|
1
|
+
require("../icons/icons.cjs");const e=require("../lib/cn.cjs"),t=require("./Badge.cjs"),n=require("../lib/media.cjs"),r=require("../lib/mediaPlayback.cjs"),i=require("./PdfPreview.cjs");let a=require("react/jsx-runtime"),o=require("react"),s=require("lucide-react");const c=`max-w-full rounded border border-po-border bg-po-deep`;function l(e){return{playing:!e.paused&&!e.ended,currentTime:e.currentTime,duration:Number.isFinite(e.duration)?e.duration:0}}function u(e,t={current:void 0}){return{play:async()=>{let t=e.current;t!==null&&await t.play()},pause:()=>e.current?.pause(),seek:t=>{let n=e.current;n!==null&&(n.currentTime=r.boundedMediaTime(t,n.duration))},getState:()=>{let t=e.current;return t===null?{playing:!1,currentTime:0,duration:0}:l(t)},isFrameReady:()=>{let n=e.current;return n!==null&&!n.seeking&&n.readyState>=2&&(n.requestVideoFrameCallback===void 0||t.current!==void 0)},getIntrinsicSize:()=>{let t=e.current;return t===null||t.videoWidth<=0||t.videoHeight<=0?null:{width:t.videoWidth,height:t.videoHeight}},captureFrame:async(n=`image/png`,r)=>{let i=e.current;if(i===null||i.videoWidth<=0||i.videoHeight<=0||i.seeking)return null;let a=t.current===void 0?void 0:{...t.current},o=a?.mediaTime??i.currentTime,s=document.createElement(`canvas`);s.width=i.videoWidth,s.height=i.videoHeight;let c=s.getContext(`2d`);if(c===null)return null;c.drawImage(i,0,0,s.width,s.height);let l=await new Promise(e=>s.toBlob(e,n,r));return l===null?null:{blob:l,width:s.width,height:s.height,timeSeconds:o,...a===void 0?{}:{metadata:a}}}}}function d({src:t,className:n,testId:r,controllerRef:i,onPlaybackStateChange:s,videoControls:d=!0}){let f=(0,o.useRef)(null),p=(0,o.useRef)(void 0),m=()=>{let e=f.current;e!==null&&s?.(l(e))},h=(0,o.useRef)(m);return(0,o.useEffect)(()=>{h.current=m}),(0,o.useImperativeHandle)(i,()=>u(f,p),[]),(0,o.useEffect)(()=>{let e=f.current;if(e===null||e.requestVideoFrameCallback===void 0)return;let t=0,n=(r,i)=>{p.current={mediaTime:i.mediaTime,...Number.isFinite(i.presentedFrames)?{presentedFrames:i.presentedFrames}:{}},h.current(),t=e.requestVideoFrameCallback(n)};return t=e.requestVideoFrameCallback(n),()=>e.cancelVideoFrameCallback(t)},[]),/* @__PURE__ */ (0,a.jsx)(`video`,{ref:f,src:t,controls:d,playsInline:!0,preload:`metadata`,"data-testid":r,"data-kind":`video`,className:e.cn(c,`max-h-[36rem]`,n),onPlay:m,onPause:m,onTimeUpdate:m,onDurationChange:m,onEnded:m,onLoadedMetadata:m,onLoadedData:m,onSeeking:()=>{p.current=void 0,m()},onSeeked:m,children:/* @__PURE__ */ (0,a.jsx)(`track`,{kind:`captions`})})}function f({src:r,path:o,kind:l,contentType:u,className:f,controllerRef:p,pdfControllerRef:m,onPlaybackStateChange:h,videoControls:g,"data-testid":_}){let v=l??n.mediaKindOf(o),y=o.split(`/`).at(-1)??o;if(v===`image`){let t=/^image\/(?:avif|bmp|gif|jpeg|png|webp)$/i.test(u??``),n=/* @__PURE__ */ (0,a.jsx)(`img`,{src:r,alt:o,className:e.cn(c,`max-h-[36rem]`,f)});return t?/* @__PURE__ */ (0,a.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,"data-testid":_,"data-kind":v,children:n}):/* @__PURE__ */ (0,a.jsx)(`span`,{"data-testid":_,"data-kind":v,children:n})}return v===`video`?/* @__PURE__ */ (0,a.jsx)(d,{src:r,className:f,controllerRef:p,onPlaybackStateChange:h,testId:_,videoControls:g}):v===`pdf`?/* @__PURE__ */ (0,a.jsx)(i.PdfPreview,{src:r,path:o,controllerRef:m,"data-testid":_,className:f}):/* @__PURE__ */ (0,a.jsx)(t.Badge,{asChild:!0,size:`md`,"data-testid":_,"data-kind":v,className:e.cn(`self-start bg-po-panel text-po-text hover:border-po-blue/50`,f),children:/* @__PURE__ */ (0,a.jsxs)(`a`,{href:r,download:y,children:[/* @__PURE__ */ (0,a.jsx)(s.FileText,{className:`h-3 w-3 shrink-0 text-po-faint`}),`download `,y]})})}exports.MediaPreview=f,exports.mediaPlaybackState=l,exports.mediaPreviewController=u;
|
|
2
2
|
//# sourceMappingURL=MediaPreview.cjs.map
|