@agimon-ai/doompi-web-components 0.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +106 -0
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/components/Accordion.d.cts +11 -0
- package/dist/components/Accordion.d.cts.map +1 -0
- package/dist/components/Avatar.d.cts +10 -0
- package/dist/components/Avatar.d.cts.map +1 -0
- package/dist/components/Badge.d.cts +18 -0
- package/dist/components/Badge.d.cts.map +1 -0
- package/dist/components/Button.d.cts +25 -0
- package/dist/components/Button.d.cts.map +1 -0
- package/dist/components/Checkbox.d.cts +8 -0
- package/dist/components/Checkbox.d.cts.map +1 -0
- package/dist/components/Collapsible.d.cts +10 -0
- package/dist/components/Collapsible.d.cts.map +1 -0
- package/dist/components/Command.d.cts +42 -0
- package/dist/components/Command.d.cts.map +1 -0
- package/dist/components/Dialog.d.cts +39 -0
- package/dist/components/Dialog.d.cts.map +1 -0
- package/dist/components/Dot.d.cts +16 -0
- package/dist/components/Dot.d.cts.map +1 -0
- package/dist/components/DropdownMenu.d.cts +34 -0
- package/dist/components/DropdownMenu.d.cts.map +1 -0
- package/dist/components/EmptyState.d.cts +18 -0
- package/dist/components/EmptyState.d.cts.map +1 -0
- package/dist/components/Input.d.cts +20 -0
- package/dist/components/Input.d.cts.map +1 -0
- package/dist/components/Kbd.d.cts +7 -0
- package/dist/components/Kbd.d.cts.map +1 -0
- package/dist/components/Label.d.cts +8 -0
- package/dist/components/Label.d.cts.map +1 -0
- package/dist/components/Markdown.d.cts +8 -0
- package/dist/components/Markdown.d.cts.map +1 -0
- package/dist/components/MessageItem.d.cts +71 -0
- package/dist/components/MessageItem.d.cts.map +1 -0
- package/dist/components/MessageLines.d.cts +24 -0
- package/dist/components/MessageLines.d.cts.map +1 -0
- package/dist/components/OptionList.d.cts +50 -0
- package/dist/components/OptionList.d.cts.map +1 -0
- package/dist/components/Panel.d.cts +15 -0
- package/dist/components/Panel.d.cts.map +1 -0
- package/dist/components/Popover.d.cts +19 -0
- package/dist/components/Popover.d.cts.map +1 -0
- package/dist/components/Progress.d.cts +8 -0
- package/dist/components/Progress.d.cts.map +1 -0
- package/dist/components/RadioGroup.d.cts +15 -0
- package/dist/components/RadioGroup.d.cts.map +1 -0
- package/dist/components/ScrollArea.d.cts +13 -0
- package/dist/components/ScrollArea.d.cts.map +1 -0
- package/dist/components/SectionLabel.d.cts +7 -0
- package/dist/components/SectionLabel.d.cts.map +1 -0
- package/dist/components/Select.d.cts +19 -0
- package/dist/components/Select.d.cts.map +1 -0
- package/dist/components/Separator.d.cts +13 -0
- package/dist/components/Separator.d.cts.map +1 -0
- package/dist/components/Skeleton.d.cts +11 -0
- package/dist/components/Skeleton.d.cts.map +1 -0
- package/dist/components/Spinner.d.cts +15 -0
- package/dist/components/Spinner.d.cts.map +1 -0
- package/dist/components/StatusBadge.d.cts +24 -0
- package/dist/components/StatusBadge.d.cts.map +1 -0
- package/dist/components/StreamCursor.d.cts +7 -0
- package/dist/components/StreamCursor.d.cts.map +1 -0
- package/dist/components/Switch.d.cts +8 -0
- package/dist/components/Switch.d.cts.map +1 -0
- package/dist/components/Tabs.d.cts +36 -0
- package/dist/components/Tabs.d.cts.map +1 -0
- package/dist/components/Textarea.d.cts +10 -0
- package/dist/components/Textarea.d.cts.map +1 -0
- package/dist/components/Toast.d.cts +24 -0
- package/dist/components/Toast.d.cts.map +1 -0
- package/dist/components/Tooltip.d.cts +11 -0
- package/dist/components/Tooltip.d.cts.map +1 -0
- package/dist/icons/icons.d.cts +2 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +42 -0
- package/dist/index.d.mts +42 -0
- package/dist/index.mjs +1 -0
- package/dist/lib/cn.d.cts +7 -0
- package/dist/lib/cn.d.cts.map +1 -0
- package/dist/lib/collapse.d.cts +15 -0
- package/dist/lib/collapse.d.cts.map +1 -0
- package/dist/lib/optionList.d.cts +22 -0
- package/dist/lib/optionList.d.cts.map +1 -0
- package/dist/lib/tone.d.cts +26 -0
- package/dist/lib/tone.d.cts.map +1 -0
- package/dist/src/components/Accordion.cjs +2 -0
- package/dist/src/components/Accordion.cjs.map +1 -0
- package/dist/src/components/Accordion.d.mts +11 -0
- package/dist/src/components/Accordion.d.mts.map +1 -0
- package/dist/src/components/Accordion.mjs +2 -0
- package/dist/src/components/Accordion.mjs.map +1 -0
- package/dist/src/components/Avatar.cjs +2 -0
- package/dist/src/components/Avatar.cjs.map +1 -0
- package/dist/src/components/Avatar.d.mts +10 -0
- package/dist/src/components/Avatar.d.mts.map +1 -0
- package/dist/src/components/Avatar.mjs +2 -0
- package/dist/src/components/Avatar.mjs.map +1 -0
- package/dist/src/components/Badge.cjs +2 -0
- package/dist/src/components/Badge.cjs.map +1 -0
- package/dist/src/components/Badge.d.mts +18 -0
- package/dist/src/components/Badge.d.mts.map +1 -0
- package/dist/src/components/Badge.mjs +2 -0
- package/dist/src/components/Badge.mjs.map +1 -0
- package/dist/src/components/Button.cjs +2 -0
- package/dist/src/components/Button.cjs.map +1 -0
- package/dist/src/components/Button.d.mts +25 -0
- package/dist/src/components/Button.d.mts.map +1 -0
- package/dist/src/components/Button.mjs +2 -0
- package/dist/src/components/Button.mjs.map +1 -0
- package/dist/src/components/Checkbox.cjs +2 -0
- package/dist/src/components/Checkbox.cjs.map +1 -0
- package/dist/src/components/Checkbox.d.mts +8 -0
- package/dist/src/components/Checkbox.d.mts.map +1 -0
- package/dist/src/components/Checkbox.mjs +2 -0
- package/dist/src/components/Checkbox.mjs.map +1 -0
- package/dist/src/components/Collapsible.cjs +2 -0
- package/dist/src/components/Collapsible.cjs.map +1 -0
- package/dist/src/components/Collapsible.d.mts +10 -0
- package/dist/src/components/Collapsible.d.mts.map +1 -0
- package/dist/src/components/Collapsible.mjs +2 -0
- package/dist/src/components/Collapsible.mjs.map +1 -0
- package/dist/src/components/Command.cjs +2 -0
- package/dist/src/components/Command.cjs.map +1 -0
- package/dist/src/components/Command.d.mts +42 -0
- package/dist/src/components/Command.d.mts.map +1 -0
- package/dist/src/components/Command.mjs +2 -0
- package/dist/src/components/Command.mjs.map +1 -0
- package/dist/src/components/Dialog.cjs +2 -0
- package/dist/src/components/Dialog.cjs.map +1 -0
- package/dist/src/components/Dialog.d.mts +39 -0
- package/dist/src/components/Dialog.d.mts.map +1 -0
- package/dist/src/components/Dialog.mjs +2 -0
- package/dist/src/components/Dialog.mjs.map +1 -0
- package/dist/src/components/Dot.cjs +2 -0
- package/dist/src/components/Dot.cjs.map +1 -0
- package/dist/src/components/Dot.d.mts +16 -0
- package/dist/src/components/Dot.d.mts.map +1 -0
- package/dist/src/components/Dot.mjs +2 -0
- package/dist/src/components/Dot.mjs.map +1 -0
- package/dist/src/components/DropdownMenu.cjs +2 -0
- package/dist/src/components/DropdownMenu.cjs.map +1 -0
- package/dist/src/components/DropdownMenu.d.mts +34 -0
- package/dist/src/components/DropdownMenu.d.mts.map +1 -0
- package/dist/src/components/DropdownMenu.mjs +2 -0
- package/dist/src/components/DropdownMenu.mjs.map +1 -0
- package/dist/src/components/EmptyState.cjs +2 -0
- package/dist/src/components/EmptyState.cjs.map +1 -0
- package/dist/src/components/EmptyState.d.mts +18 -0
- package/dist/src/components/EmptyState.d.mts.map +1 -0
- package/dist/src/components/EmptyState.mjs +2 -0
- package/dist/src/components/EmptyState.mjs.map +1 -0
- package/dist/src/components/Input.cjs +2 -0
- package/dist/src/components/Input.cjs.map +1 -0
- package/dist/src/components/Input.d.mts +20 -0
- package/dist/src/components/Input.d.mts.map +1 -0
- package/dist/src/components/Input.mjs +2 -0
- package/dist/src/components/Input.mjs.map +1 -0
- package/dist/src/components/Kbd.cjs +2 -0
- package/dist/src/components/Kbd.cjs.map +1 -0
- package/dist/src/components/Kbd.d.mts +7 -0
- package/dist/src/components/Kbd.d.mts.map +1 -0
- package/dist/src/components/Kbd.mjs +2 -0
- package/dist/src/components/Kbd.mjs.map +1 -0
- package/dist/src/components/Label.cjs +2 -0
- package/dist/src/components/Label.cjs.map +1 -0
- package/dist/src/components/Label.d.mts +8 -0
- package/dist/src/components/Label.d.mts.map +1 -0
- package/dist/src/components/Label.mjs +2 -0
- package/dist/src/components/Label.mjs.map +1 -0
- package/dist/src/components/Markdown.cjs +2 -0
- package/dist/src/components/Markdown.cjs.map +1 -0
- package/dist/src/components/Markdown.d.mts +8 -0
- package/dist/src/components/Markdown.d.mts.map +1 -0
- package/dist/src/components/Markdown.mjs +2 -0
- package/dist/src/components/Markdown.mjs.map +1 -0
- package/dist/src/components/MessageItem.cjs +2 -0
- package/dist/src/components/MessageItem.cjs.map +1 -0
- package/dist/src/components/MessageItem.d.mts +71 -0
- package/dist/src/components/MessageItem.d.mts.map +1 -0
- package/dist/src/components/MessageItem.mjs +2 -0
- package/dist/src/components/MessageItem.mjs.map +1 -0
- package/dist/src/components/MessageLines.cjs +2 -0
- package/dist/src/components/MessageLines.cjs.map +1 -0
- package/dist/src/components/MessageLines.d.mts +24 -0
- package/dist/src/components/MessageLines.d.mts.map +1 -0
- package/dist/src/components/MessageLines.mjs +2 -0
- package/dist/src/components/MessageLines.mjs.map +1 -0
- package/dist/src/components/OptionList.cjs +2 -0
- package/dist/src/components/OptionList.cjs.map +1 -0
- package/dist/src/components/OptionList.d.mts +50 -0
- package/dist/src/components/OptionList.d.mts.map +1 -0
- package/dist/src/components/OptionList.mjs +2 -0
- package/dist/src/components/OptionList.mjs.map +1 -0
- package/dist/src/components/Panel.cjs +2 -0
- package/dist/src/components/Panel.cjs.map +1 -0
- package/dist/src/components/Panel.d.mts +15 -0
- package/dist/src/components/Panel.d.mts.map +1 -0
- package/dist/src/components/Panel.mjs +2 -0
- package/dist/src/components/Panel.mjs.map +1 -0
- package/dist/src/components/Popover.cjs +2 -0
- package/dist/src/components/Popover.cjs.map +1 -0
- package/dist/src/components/Popover.d.mts +19 -0
- package/dist/src/components/Popover.d.mts.map +1 -0
- package/dist/src/components/Popover.mjs +2 -0
- package/dist/src/components/Popover.mjs.map +1 -0
- package/dist/src/components/Progress.cjs +2 -0
- package/dist/src/components/Progress.cjs.map +1 -0
- package/dist/src/components/Progress.d.mts +8 -0
- package/dist/src/components/Progress.d.mts.map +1 -0
- package/dist/src/components/Progress.mjs +2 -0
- package/dist/src/components/Progress.mjs.map +1 -0
- package/dist/src/components/RadioGroup.cjs +2 -0
- package/dist/src/components/RadioGroup.cjs.map +1 -0
- package/dist/src/components/RadioGroup.d.mts +15 -0
- package/dist/src/components/RadioGroup.d.mts.map +1 -0
- package/dist/src/components/RadioGroup.mjs +2 -0
- package/dist/src/components/RadioGroup.mjs.map +1 -0
- package/dist/src/components/ScrollArea.cjs +2 -0
- package/dist/src/components/ScrollArea.cjs.map +1 -0
- package/dist/src/components/ScrollArea.d.mts +13 -0
- package/dist/src/components/ScrollArea.d.mts.map +1 -0
- package/dist/src/components/ScrollArea.mjs +2 -0
- package/dist/src/components/ScrollArea.mjs.map +1 -0
- package/dist/src/components/SectionLabel.cjs +2 -0
- package/dist/src/components/SectionLabel.cjs.map +1 -0
- package/dist/src/components/SectionLabel.d.mts +7 -0
- package/dist/src/components/SectionLabel.d.mts.map +1 -0
- package/dist/src/components/SectionLabel.mjs +2 -0
- package/dist/src/components/SectionLabel.mjs.map +1 -0
- package/dist/src/components/Select.cjs +2 -0
- package/dist/src/components/Select.cjs.map +1 -0
- package/dist/src/components/Select.d.mts +19 -0
- package/dist/src/components/Select.d.mts.map +1 -0
- package/dist/src/components/Select.mjs +2 -0
- package/dist/src/components/Select.mjs.map +1 -0
- package/dist/src/components/Separator.cjs +2 -0
- package/dist/src/components/Separator.cjs.map +1 -0
- package/dist/src/components/Separator.d.mts +13 -0
- package/dist/src/components/Separator.d.mts.map +1 -0
- package/dist/src/components/Separator.mjs +2 -0
- package/dist/src/components/Separator.mjs.map +1 -0
- package/dist/src/components/Skeleton.cjs +2 -0
- package/dist/src/components/Skeleton.cjs.map +1 -0
- package/dist/src/components/Skeleton.d.mts +11 -0
- package/dist/src/components/Skeleton.d.mts.map +1 -0
- package/dist/src/components/Skeleton.mjs +2 -0
- package/dist/src/components/Skeleton.mjs.map +1 -0
- package/dist/src/components/Spinner.cjs +2 -0
- package/dist/src/components/Spinner.cjs.map +1 -0
- package/dist/src/components/Spinner.d.mts +15 -0
- package/dist/src/components/Spinner.d.mts.map +1 -0
- package/dist/src/components/Spinner.mjs +2 -0
- package/dist/src/components/Spinner.mjs.map +1 -0
- package/dist/src/components/StatusBadge.cjs +2 -0
- package/dist/src/components/StatusBadge.cjs.map +1 -0
- package/dist/src/components/StatusBadge.d.mts +24 -0
- package/dist/src/components/StatusBadge.d.mts.map +1 -0
- package/dist/src/components/StatusBadge.mjs +2 -0
- package/dist/src/components/StatusBadge.mjs.map +1 -0
- package/dist/src/components/StreamCursor.cjs +2 -0
- package/dist/src/components/StreamCursor.cjs.map +1 -0
- package/dist/src/components/StreamCursor.d.mts +7 -0
- package/dist/src/components/StreamCursor.d.mts.map +1 -0
- package/dist/src/components/StreamCursor.mjs +2 -0
- package/dist/src/components/StreamCursor.mjs.map +1 -0
- package/dist/src/components/Switch.cjs +2 -0
- package/dist/src/components/Switch.cjs.map +1 -0
- package/dist/src/components/Switch.d.mts +8 -0
- package/dist/src/components/Switch.d.mts.map +1 -0
- package/dist/src/components/Switch.mjs +2 -0
- package/dist/src/components/Switch.mjs.map +1 -0
- package/dist/src/components/Tabs.cjs +2 -0
- package/dist/src/components/Tabs.cjs.map +1 -0
- package/dist/src/components/Tabs.d.mts +36 -0
- package/dist/src/components/Tabs.d.mts.map +1 -0
- package/dist/src/components/Tabs.mjs +2 -0
- package/dist/src/components/Tabs.mjs.map +1 -0
- package/dist/src/components/Textarea.cjs +2 -0
- package/dist/src/components/Textarea.cjs.map +1 -0
- package/dist/src/components/Textarea.d.mts +10 -0
- package/dist/src/components/Textarea.d.mts.map +1 -0
- package/dist/src/components/Textarea.mjs +2 -0
- package/dist/src/components/Textarea.mjs.map +1 -0
- package/dist/src/components/Toast.cjs +2 -0
- package/dist/src/components/Toast.cjs.map +1 -0
- package/dist/src/components/Toast.d.mts +24 -0
- package/dist/src/components/Toast.d.mts.map +1 -0
- package/dist/src/components/Toast.mjs +2 -0
- package/dist/src/components/Toast.mjs.map +1 -0
- package/dist/src/components/Tooltip.cjs +2 -0
- package/dist/src/components/Tooltip.cjs.map +1 -0
- package/dist/src/components/Tooltip.d.mts +11 -0
- package/dist/src/components/Tooltip.d.mts.map +1 -0
- package/dist/src/components/Tooltip.mjs +2 -0
- package/dist/src/components/Tooltip.mjs.map +1 -0
- package/dist/src/icons/icons.cjs +1 -0
- package/dist/src/icons/icons.d.mts +2 -0
- package/dist/src/icons/icons.mjs +1 -0
- package/dist/src/lib/cn.cjs +2 -0
- package/dist/src/lib/cn.cjs.map +1 -0
- package/dist/src/lib/cn.d.mts +7 -0
- package/dist/src/lib/cn.d.mts.map +1 -0
- package/dist/src/lib/cn.mjs +2 -0
- package/dist/src/lib/cn.mjs.map +1 -0
- package/dist/src/lib/collapse.cjs +2 -0
- package/dist/src/lib/collapse.cjs.map +1 -0
- package/dist/src/lib/collapse.d.mts +15 -0
- package/dist/src/lib/collapse.d.mts.map +1 -0
- package/dist/src/lib/collapse.mjs +2 -0
- package/dist/src/lib/collapse.mjs.map +1 -0
- package/dist/src/lib/optionList.cjs +2 -0
- package/dist/src/lib/optionList.cjs.map +1 -0
- package/dist/src/lib/optionList.d.mts +22 -0
- package/dist/src/lib/optionList.d.mts.map +1 -0
- package/dist/src/lib/optionList.mjs +2 -0
- package/dist/src/lib/optionList.mjs.map +1 -0
- package/dist/src/lib/tone.cjs +2 -0
- package/dist/src/lib/tone.cjs.map +1 -0
- package/dist/src/lib/tone.d.mts +26 -0
- package/dist/src/lib/tone.d.mts.map +1 -0
- package/dist/src/lib/tone.mjs +2 -0
- package/dist/src/lib/tone.mjs.map +1 -0
- package/dist/src/theme/apply.cjs +3 -0
- package/dist/src/theme/apply.cjs.map +1 -0
- package/dist/src/theme/apply.d.mts +26 -0
- package/dist/src/theme/apply.d.mts.map +1 -0
- package/dist/src/theme/apply.mjs +3 -0
- package/dist/src/theme/apply.mjs.map +1 -0
- package/dist/src/theme/builtinThemes.cjs +2 -0
- package/dist/src/theme/builtinThemes.cjs.map +1 -0
- package/dist/src/theme/builtinThemes.d.mts +12 -0
- package/dist/src/theme/builtinThemes.d.mts.map +1 -0
- package/dist/src/theme/builtinThemes.mjs +2 -0
- package/dist/src/theme/builtinThemes.mjs.map +1 -0
- package/dist/src/theme/derive.cjs +2 -0
- package/dist/src/theme/derive.cjs.map +1 -0
- package/dist/src/theme/derive.d.mts +15 -0
- package/dist/src/theme/derive.d.mts.map +1 -0
- package/dist/src/theme/derive.mjs +2 -0
- package/dist/src/theme/derive.mjs.map +1 -0
- package/dist/src/theme/parse.cjs +2 -0
- package/dist/src/theme/parse.cjs.map +1 -0
- package/dist/src/theme/parse.d.mts +11 -0
- package/dist/src/theme/parse.d.mts.map +1 -0
- package/dist/src/theme/parse.mjs +2 -0
- package/dist/src/theme/parse.mjs.map +1 -0
- package/dist/src/theme/piTheme.cjs +2 -0
- package/dist/src/theme/piTheme.cjs.map +1 -0
- package/dist/src/theme/piTheme.d.mts +20 -0
- package/dist/src/theme/piTheme.d.mts.map +1 -0
- package/dist/src/theme/piTheme.mjs +2 -0
- package/dist/src/theme/piTheme.mjs.map +1 -0
- package/dist/src/theme/preference.cjs +2 -0
- package/dist/src/theme/preference.cjs.map +1 -0
- package/dist/src/theme/preference.d.mts +16 -0
- package/dist/src/theme/preference.d.mts.map +1 -0
- package/dist/src/theme/preference.mjs +2 -0
- package/dist/src/theme/preference.mjs.map +1 -0
- package/dist/src/types/theme.cjs +2 -0
- package/dist/src/types/theme.cjs.map +1 -0
- package/dist/src/types/theme.d.mts +39 -0
- package/dist/src/types/theme.d.mts.map +1 -0
- package/dist/src/types/theme.mjs +2 -0
- package/dist/src/types/theme.mjs.map +1 -0
- package/dist/src/types/tone.cjs +2 -0
- package/dist/src/types/tone.cjs.map +1 -0
- package/dist/src/types/tone.d.mts +29 -0
- package/dist/src/types/tone.d.mts.map +1 -0
- package/dist/src/types/tone.mjs +2 -0
- package/dist/src/types/tone.mjs.map +1 -0
- package/dist/theme/apply.d.cts +26 -0
- package/dist/theme/apply.d.cts.map +1 -0
- package/dist/theme/builtinThemes.d.cts +12 -0
- package/dist/theme/builtinThemes.d.cts.map +1 -0
- package/dist/theme/derive.d.cts +15 -0
- package/dist/theme/derive.d.cts.map +1 -0
- package/dist/theme/parse.d.cts +11 -0
- package/dist/theme/parse.d.cts.map +1 -0
- package/dist/theme/piTheme.d.cts +20 -0
- package/dist/theme/piTheme.d.cts.map +1 -0
- package/dist/theme/preference.d.cts +16 -0
- package/dist/theme/preference.d.cts.map +1 -0
- package/dist/theme.cjs +1 -0
- package/dist/theme.d.cts +8 -0
- package/dist/theme.d.mts +8 -0
- package/dist/theme.mjs +1 -0
- package/dist/themes/doom-nord-dark.cjs +2 -0
- package/dist/themes/doom-nord-dark.cjs.map +1 -0
- package/dist/themes/doom-nord-dark.mjs +2 -0
- package/dist/themes/doom-nord-dark.mjs.map +1 -0
- package/dist/themes/doom-one-dark.cjs +2 -0
- package/dist/themes/doom-one-dark.cjs.map +1 -0
- package/dist/themes/doom-one-dark.mjs +2 -0
- package/dist/themes/doom-one-dark.mjs.map +1 -0
- package/dist/themes/doom-one-light.cjs +2 -0
- package/dist/themes/doom-one-light.cjs.map +1 -0
- package/dist/themes/doom-one-light.mjs +2 -0
- package/dist/themes/doom-one-light.mjs.map +1 -0
- package/dist/types/theme.d.cts +39 -0
- package/dist/types/theme.d.cts.map +1 -0
- package/dist/types/tone.d.cts +29 -0
- package/dist/types/tone.d.cts.map +1 -0
- package/llms.txt +8 -0
- package/package.json +95 -0
- package/styles/tokens.css +202 -0
- package/themes/doom-nord-dark.json +27 -0
- package/themes/doom-one-dark.json +39 -0
- package/themes/doom-one-light.json +27 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=9;function t(e,t){let{options:n,cursor:r,onCursorChange:i,onSelect:a}=t,o=n.length;if(o===0)return;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation(),i((r+(e.key===`ArrowDown`?1:-1)+o)%o);return}if(e.key===`Enter`){let t=n[r];if(t===void 0)return;e.preventDefault(),e.stopPropagation(),a(t);return}let s=Number.parseInt(e.key,10)-1,c=Number.isInteger(s)&&s<9?n[s]:void 0;c!==void 0&&(e.preventDefault(),e.stopPropagation(),a(c))}function n(e){return e>9?`up/down move · enter select · 1-9 jump`:`1-9 select · enter confirm`}function r(e){return e<9?String(e+1):`·`}export{e as MAX_DIGIT_SHORTCUT,t as handleOptionListKey,n as optionListHint,r as optionMarker};
|
|
2
|
+
//# sourceMappingURL=optionList.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionList.mjs","names":[],"sources":["../../../src/lib/optionList.ts"],"sourcesContent":["import type { KeyboardEvent } from 'react';\n\n/** Digits are a shortcut, not the only way in: only the first nine can have one. */\nexport const MAX_DIGIT_SHORTCUT = 9;\n\n/**\n * The keyboard an option list answers to, handled on whichever element the\n * surrounding overlay focuses. Every key it claims is consumed, so a digit\n * that answers the agent never also reaches the rail's session shortcuts.\n */\nexport function handleOptionListKey(\n event: KeyboardEvent,\n input: {\n options: readonly string[];\n cursor: number;\n onCursorChange: (cursor: number) => void;\n onSelect: (option: string) => void;\n },\n): void {\n const { options, cursor, onCursorChange, onSelect } = input;\n const count = options.length;\n if (count === 0) return;\n\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n onCursorChange((cursor + (event.key === 'ArrowDown' ? 1 : -1) + count) % count);\n return;\n }\n if (event.key === 'Enter') {\n const option = options[cursor];\n if (option === undefined) return;\n event.preventDefault();\n event.stopPropagation();\n onSelect(option);\n return;\n }\n const index = Number.parseInt(event.key, 10) - 1;\n const option = Number.isInteger(index) && index < MAX_DIGIT_SHORTCUT ? options[index] : undefined;\n if (option === undefined) return;\n event.preventDefault();\n event.stopPropagation();\n onSelect(option);\n}\n\n/** What the footer should promise, given how many options there are. */\nexport function optionListHint(count: number): string {\n return count > MAX_DIGIT_SHORTCUT ? 'up/down move · enter select · 1-9 jump' : '1-9 select · enter confirm';\n}\n\n/** The digit a row answers to, or the bullet that says it has none. */\nexport function optionMarker(index: number): string {\n return index < MAX_DIGIT_SHORTCUT ? String(index + 1) : '·';\n}\n"],"mappings":"AAGA,MAAa,EAAqB,EAOlC,SAAgB,EACd,EACA,EAMM,CACN,GAAM,CAAE,UAAS,SAAQ,iBAAgB,YAAa,EAChD,EAAQ,EAAQ,OACtB,GAAI,IAAU,EAAG,OAEjB,GAAI,EAAM,MAAQ,aAAe,EAAM,MAAQ,UAAW,CACxD,EAAM,eAAe,EACrB,EAAM,gBAAgB,EACtB,GAAgB,GAAU,EAAM,MAAQ,YAAc,EAAI,IAAM,GAAS,CAAK,EAC9E,MACF,CACA,GAAI,EAAM,MAAQ,QAAS,CACzB,IAAM,EAAS,EAAQ,GACvB,GAAI,IAAW,IAAA,GAAW,OAC1B,EAAM,eAAe,EACrB,EAAM,gBAAgB,EACtB,EAAS,CAAM,EACf,MACF,CACA,IAAM,EAAQ,OAAO,SAAS,EAAM,IAAK,EAAE,EAAI,EACzC,EAAS,OAAO,UAAU,CAAK,GAAK,EAAA,EAA6B,EAAQ,GAAS,IAAA,GACpF,IAAW,IAAA,KACf,EAAM,eAAe,EACrB,EAAM,gBAAgB,EACtB,EAAS,CAAM,EACjB,CAGA,SAAgB,EAAe,EAAuB,CACpD,OAAO,EAAA,EAA6B,yCAA2C,4BACjF,CAGA,SAAgB,EAAa,EAAuB,CAClD,OAAO,EAAA,EAA6B,OAAO,EAAQ,CAAC,EAAI,GAC1D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e={neutral:`neutral`,running:`yellow`,ok:`green`,error:`red`,info:`blue`,accent:`magenta`},t={neutral:`muted`,running:`yellow`,ok:`green`,error:`red`,info:`blue`,accent:`magenta`},n={neutral:`neutral`,blue:`info`,green:`ok`,yellow:`running`,red:`error`,magenta:`accent`,violet:`accent`,cyan:`info`,orange:`running`,teal:`info`},r={hi:`neutral`,text:`neutral`,dim:`neutral`,muted:`neutral`,success:`ok`,error:`error`,warning:`running`,accent:`info`};exports.CHIP_TO_STATUS=n,exports.LINE_TONE_TO_STATUS=r,exports.STATUS_TO_CHIP=e,exports.STATUS_TO_DOT=t;
|
|
2
|
+
//# sourceMappingURL=tone.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tone.cjs","names":[],"sources":["../../../src/lib/tone.ts"],"sourcesContent":["import type { ChipTone, DotTone, MessageLineTone, StatusTone } from '../types/tone.ts';\n\n/**\n * Translations between the tone vocabularies.\n *\n * Every surface that shows an outcome used to carry its own\n * `Record<Tone, string>` table mapping a state onto a colour class. Those\n * tables disagreed as often as they agreed. These maps are the one place the\n * translation lives, so a card picks a status tone from its own domain and\n * asks here what colour that reads as.\n */\n\n/** The colour a status reads as, for the chip and border families. */\nexport const STATUS_TO_CHIP: Readonly<Record<StatusTone, ChipTone>> = {\n neutral: 'neutral',\n running: 'yellow',\n ok: 'green',\n error: 'red',\n info: 'blue',\n accent: 'magenta',\n};\n\n/** The dot a status reads as; a neutral status is present but not live. */\nexport const STATUS_TO_DOT: Readonly<Record<StatusTone, DotTone>> = {\n neutral: 'muted',\n running: 'yellow',\n ok: 'green',\n error: 'red',\n info: 'blue',\n accent: 'magenta',\n};\n\n/**\n * The status a colour stands for, for a caller that has only a chip tone.\n * Lossy on purpose: the palette has more colours than there are outcomes, and\n * a colour with no outcome of its own reads as neutral.\n */\nexport const CHIP_TO_STATUS: Readonly<Record<ChipTone, StatusTone>> = {\n neutral: 'neutral',\n blue: 'info',\n green: 'ok',\n yellow: 'running',\n red: 'error',\n magenta: 'accent',\n violet: 'accent',\n cyan: 'info',\n orange: 'running',\n teal: 'info',\n};\n\n/** The status a body line's role corresponds to, for a card that badges its worst line. */\nexport const LINE_TONE_TO_STATUS: Readonly<Record<MessageLineTone, StatusTone>> = {\n hi: 'neutral',\n text: 'neutral',\n dim: 'neutral',\n muted: 'neutral',\n success: 'ok',\n error: 'error',\n warning: 'running',\n accent: 'info',\n};\n"],"mappings":"AAaA,MAAa,EAAyD,CACpE,QAAS,UACT,QAAS,SACT,GAAI,QACJ,MAAO,MACP,KAAM,OACN,OAAQ,SACV,EAGa,EAAuD,CAClE,QAAS,QACT,QAAS,SACT,GAAI,QACJ,MAAO,MACP,KAAM,OACN,OAAQ,SACV,EAOa,EAAyD,CACpE,QAAS,UACT,KAAM,OACN,MAAO,KACP,OAAQ,UACR,IAAK,QACL,QAAS,SACT,OAAQ,SACR,KAAM,OACN,OAAQ,UACR,KAAM,MACR,EAGa,EAAqE,CAChF,GAAI,UACJ,KAAM,UACN,IAAK,UACL,MAAO,UACP,QAAS,KACT,MAAO,QACP,QAAS,UACT,OAAQ,MACV"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ChipTone, DotTone, MessageLineTone, StatusTone } from "../types/tone.mjs";
|
|
2
|
+
//#region src/lib/tone.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Translations between the tone vocabularies.
|
|
5
|
+
*
|
|
6
|
+
* Every surface that shows an outcome used to carry its own
|
|
7
|
+
* `Record<Tone, string>` table mapping a state onto a colour class. Those
|
|
8
|
+
* tables disagreed as often as they agreed. These maps are the one place the
|
|
9
|
+
* translation lives, so a card picks a status tone from its own domain and
|
|
10
|
+
* asks here what colour that reads as.
|
|
11
|
+
*/
|
|
12
|
+
/** The colour a status reads as, for the chip and border families. */
|
|
13
|
+
declare const STATUS_TO_CHIP: Readonly<Record<StatusTone, ChipTone>>;
|
|
14
|
+
/** The dot a status reads as; a neutral status is present but not live. */
|
|
15
|
+
declare const STATUS_TO_DOT: Readonly<Record<StatusTone, DotTone>>;
|
|
16
|
+
/**
|
|
17
|
+
* The status a colour stands for, for a caller that has only a chip tone.
|
|
18
|
+
* Lossy on purpose: the palette has more colours than there are outcomes, and
|
|
19
|
+
* a colour with no outcome of its own reads as neutral.
|
|
20
|
+
*/
|
|
21
|
+
declare const CHIP_TO_STATUS: Readonly<Record<ChipTone, StatusTone>>;
|
|
22
|
+
/** The status a body line's role corresponds to, for a card that badges its worst line. */
|
|
23
|
+
declare const LINE_TONE_TO_STATUS: Readonly<Record<MessageLineTone, StatusTone>>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CHIP_TO_STATUS, LINE_TONE_TO_STATUS, STATUS_TO_CHIP, STATUS_TO_DOT };
|
|
26
|
+
//# sourceMappingURL=tone.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tone.d.mts","names":[],"sources":["../../../src/lib/tone.ts"],"mappings":";;;;;;;;;;;;cAaa,gBAAgB,SAAS,OAAO,YAAY;;cAU5C,eAAe,SAAS,OAAO,YAAY;;;;;;cAc3C,gBAAgB,SAAS,OAAO,UAAU;;cAc1C,qBAAqB,SAAS,OAAO,iBAAiB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e={neutral:`neutral`,running:`yellow`,ok:`green`,error:`red`,info:`blue`,accent:`magenta`},t={neutral:`muted`,running:`yellow`,ok:`green`,error:`red`,info:`blue`,accent:`magenta`},n={neutral:`neutral`,blue:`info`,green:`ok`,yellow:`running`,red:`error`,magenta:`accent`,violet:`accent`,cyan:`info`,orange:`running`,teal:`info`},r={hi:`neutral`,text:`neutral`,dim:`neutral`,muted:`neutral`,success:`ok`,error:`error`,warning:`running`,accent:`info`};export{n as CHIP_TO_STATUS,r as LINE_TONE_TO_STATUS,e as STATUS_TO_CHIP,t as STATUS_TO_DOT};
|
|
2
|
+
//# sourceMappingURL=tone.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tone.mjs","names":[],"sources":["../../../src/lib/tone.ts"],"sourcesContent":["import type { ChipTone, DotTone, MessageLineTone, StatusTone } from '../types/tone.ts';\n\n/**\n * Translations between the tone vocabularies.\n *\n * Every surface that shows an outcome used to carry its own\n * `Record<Tone, string>` table mapping a state onto a colour class. Those\n * tables disagreed as often as they agreed. These maps are the one place the\n * translation lives, so a card picks a status tone from its own domain and\n * asks here what colour that reads as.\n */\n\n/** The colour a status reads as, for the chip and border families. */\nexport const STATUS_TO_CHIP: Readonly<Record<StatusTone, ChipTone>> = {\n neutral: 'neutral',\n running: 'yellow',\n ok: 'green',\n error: 'red',\n info: 'blue',\n accent: 'magenta',\n};\n\n/** The dot a status reads as; a neutral status is present but not live. */\nexport const STATUS_TO_DOT: Readonly<Record<StatusTone, DotTone>> = {\n neutral: 'muted',\n running: 'yellow',\n ok: 'green',\n error: 'red',\n info: 'blue',\n accent: 'magenta',\n};\n\n/**\n * The status a colour stands for, for a caller that has only a chip tone.\n * Lossy on purpose: the palette has more colours than there are outcomes, and\n * a colour with no outcome of its own reads as neutral.\n */\nexport const CHIP_TO_STATUS: Readonly<Record<ChipTone, StatusTone>> = {\n neutral: 'neutral',\n blue: 'info',\n green: 'ok',\n yellow: 'running',\n red: 'error',\n magenta: 'accent',\n violet: 'accent',\n cyan: 'info',\n orange: 'running',\n teal: 'info',\n};\n\n/** The status a body line's role corresponds to, for a card that badges its worst line. */\nexport const LINE_TONE_TO_STATUS: Readonly<Record<MessageLineTone, StatusTone>> = {\n hi: 'neutral',\n text: 'neutral',\n dim: 'neutral',\n muted: 'neutral',\n success: 'ok',\n error: 'error',\n warning: 'running',\n accent: 'info',\n};\n"],"mappings":"AAaA,MAAa,EAAyD,CACpE,QAAS,UACT,QAAS,SACT,GAAI,QACJ,MAAO,MACP,KAAM,OACN,OAAQ,SACV,EAGa,EAAuD,CAClE,QAAS,QACT,QAAS,SACT,GAAI,QACJ,MAAO,MACP,KAAM,OACN,OAAQ,SACV,EAOa,EAAyD,CACpE,QAAS,UACT,KAAM,OACN,MAAO,KACP,OAAQ,UACR,IAAK,QACL,QAAS,SACT,OAAQ,SACR,KAAM,OACN,OAAQ,UACR,KAAM,MACR,EAGa,EAAqE,CAChF,GAAI,UACJ,KAAM,UACN,IAAK,UACL,MAAO,UACP,QAAS,KACT,MAAO,QACP,QAAS,UACT,OAAQ,MACV"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=require("../types/theme.cjs"),t=require("./derive.cjs"),n=`data-theme`;function r(n){let r={};for(let t of e.PALETTE_TOKENS)r[e.themeVariable(t)]=n.tokens[t];for(let i of t.derivedTokens())r[e.themeVariable(i)]=t.tokenValue(n,i);return r}function i(e,t=`:root`){let n=Object.entries(r(e)).map(([e,t])=>` ${e}: ${t};`);return`${t} {\n color-scheme: ${e.scheme};\n${n.join(`
|
|
2
|
+
`)}\n}\n`}function a(e,t){for(let[n,i]of Object.entries(r(e)))t.style.setProperty(n,i);t.style.colorScheme=e.scheme,t.setAttribute(n,e.name)}exports.THEME_ATTRIBUTE=n,exports.applyTheme=a,exports.themeCssText=i,exports.themeCssVariables=r;
|
|
3
|
+
//# sourceMappingURL=apply.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.cjs","names":["PALETTE_TOKENS","themeVariable","derivedTokens","tokenValue"],"sources":["../../../src/theme/apply.ts"],"sourcesContent":["import { PALETTE_TOKENS, type ThemeConfig, themeVariable } from '../types/theme.ts';\nimport { derivedTokens, tokenValue } from './derive.ts';\n\n/** The attribute the active theme's name is stamped on, for CSS that keys off a theme. */\nexport const THEME_ATTRIBUTE = 'data-theme';\n\n/** Every custom property a theme publishes, keyed by property name. */\nexport function themeCssVariables(theme: ThemeConfig): Record<string, string> {\n const variables: Record<string, string> = {};\n for (const token of PALETTE_TOKENS) variables[themeVariable(token)] = theme.tokens[token];\n for (const token of derivedTokens()) variables[themeVariable(token)] = tokenValue(theme, token);\n return variables;\n}\n\n/** The theme as a stylesheet rule, for a server that wants to inline it. */\nexport function themeCssText(theme: ThemeConfig, selector = ':root'): string {\n const declarations = Object.entries(themeCssVariables(theme)).map(([name, value]) => ` ${name}: ${value};`);\n return `${selector} {\\n color-scheme: ${theme.scheme};\\n${declarations.join('\\n')}\\n}\\n`;\n}\n\n/** The subset of an element the theme touches, so tests can pass a plain object. */\nexport interface ThemeRoot {\n style: { setProperty(name: string, value: string): void; colorScheme: string };\n setAttribute(name: string, value: string): void;\n}\n\n/**\n * Applies a theme to the page: every token becomes a custom property on the\n * root, the colour scheme follows, and the theme name is stamped so a style\n * may key off it. Idempotent and synchronous, so calling it before the first\n * render avoids a flash of the default theme.\n */\nexport function applyTheme(theme: ThemeConfig, root: ThemeRoot): void {\n for (const [name, value] of Object.entries(themeCssVariables(theme))) root.style.setProperty(name, value);\n root.style.colorScheme = theme.scheme;\n root.setAttribute(THEME_ATTRIBUTE, theme.name);\n}\n"],"mappings":"gEAIa,EAAkB,aAG/B,SAAgB,EAAkB,EAA4C,CAC5E,IAAM,EAAoC,CAAC,EAC3C,IAAK,IAAM,KAASA,EAAAA,eAAgB,EAAUC,EAAAA,cAAc,CAAK,GAAK,EAAM,OAAO,GACnF,IAAK,IAAM,KAASC,EAAAA,cAAc,EAAG,EAAUD,EAAAA,cAAc,CAAK,GAAKE,EAAAA,WAAW,EAAO,CAAK,EAC9F,OAAO,CACT,CAGA,SAAgB,EAAa,EAAoB,EAAW,QAAiB,CAC3E,IAAM,EAAe,OAAO,QAAQ,EAAkB,CAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAM,KAAW,KAAK,EAAK,IAAI,EAAM,EAAE,EAC3G,MAAO,GAAG,EAAS,sBAAsB,EAAM,OAAO,KAAK,EAAa,KAAK;CAAI,EAAE,MACrF,CAcA,SAAgB,EAAW,EAAoB,EAAuB,CACpE,IAAK,GAAM,CAAC,EAAM,KAAU,OAAO,QAAQ,EAAkB,CAAK,CAAC,EAAG,EAAK,MAAM,YAAY,EAAM,CAAK,EACxG,EAAK,MAAM,YAAc,EAAM,OAC/B,EAAK,aAAa,EAAiB,EAAM,IAAI,CAC/C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ThemeConfig } from "../types/theme.mjs";
|
|
2
|
+
//#region src/theme/apply.d.ts
|
|
3
|
+
/** The attribute the active theme's name is stamped on, for CSS that keys off a theme. */
|
|
4
|
+
declare const THEME_ATTRIBUTE = "data-theme";
|
|
5
|
+
/** Every custom property a theme publishes, keyed by property name. */
|
|
6
|
+
declare function themeCssVariables(theme: ThemeConfig): Record<string, string>;
|
|
7
|
+
/** The theme as a stylesheet rule, for a server that wants to inline it. */
|
|
8
|
+
declare function themeCssText(theme: ThemeConfig, selector?: string): string;
|
|
9
|
+
/** The subset of an element the theme touches, so tests can pass a plain object. */
|
|
10
|
+
interface ThemeRoot {
|
|
11
|
+
style: {
|
|
12
|
+
setProperty(name: string, value: string): void;
|
|
13
|
+
colorScheme: string;
|
|
14
|
+
};
|
|
15
|
+
setAttribute(name: string, value: string): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Applies a theme to the page: every token becomes a custom property on the
|
|
19
|
+
* root, the colour scheme follows, and the theme name is stamped so a style
|
|
20
|
+
* may key off it. Idempotent and synchronous, so calling it before the first
|
|
21
|
+
* render avoids a flash of the default theme.
|
|
22
|
+
*/
|
|
23
|
+
declare function applyTheme(theme: ThemeConfig, root: ThemeRoot): void;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { THEME_ATTRIBUTE, ThemeRoot, applyTheme, themeCssText, themeCssVariables };
|
|
26
|
+
//# sourceMappingURL=apply.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.mts","names":[],"sources":["../../../src/theme/apply.ts"],"mappings":";;;cAIa;;iBAGG,kBAAkB,OAAO,cAAc;;iBAQvC,aAAa,OAAO,aAAa;;UAMhC;EACf;IAAS,YAAY,cAAc;IAAsB;;EACzD,aAAa,cAAc;;;;;;;;iBASb,WAAW,OAAO,aAAa,MAAM"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{PALETTE_TOKENS as e,themeVariable as t}from"../types/theme.mjs";import{derivedTokens as n,tokenValue as r}from"./derive.mjs";const i=`data-theme`;function a(i){let a={};for(let n of e)a[t(n)]=i.tokens[n];for(let e of n())a[t(e)]=r(i,e);return a}function o(e,t=`:root`){let n=Object.entries(a(e)).map(([e,t])=>` ${e}: ${t};`);return`${t} {\n color-scheme: ${e.scheme};\n${n.join(`
|
|
2
|
+
`)}\n}\n`}function s(e,t){for(let[n,r]of Object.entries(a(e)))t.style.setProperty(n,r);t.style.colorScheme=e.scheme,t.setAttribute(i,e.name)}export{i as THEME_ATTRIBUTE,s as applyTheme,o as themeCssText,a as themeCssVariables};
|
|
3
|
+
//# sourceMappingURL=apply.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.mjs","names":[],"sources":["../../../src/theme/apply.ts"],"sourcesContent":["import { PALETTE_TOKENS, type ThemeConfig, themeVariable } from '../types/theme.ts';\nimport { derivedTokens, tokenValue } from './derive.ts';\n\n/** The attribute the active theme's name is stamped on, for CSS that keys off a theme. */\nexport const THEME_ATTRIBUTE = 'data-theme';\n\n/** Every custom property a theme publishes, keyed by property name. */\nexport function themeCssVariables(theme: ThemeConfig): Record<string, string> {\n const variables: Record<string, string> = {};\n for (const token of PALETTE_TOKENS) variables[themeVariable(token)] = theme.tokens[token];\n for (const token of derivedTokens()) variables[themeVariable(token)] = tokenValue(theme, token);\n return variables;\n}\n\n/** The theme as a stylesheet rule, for a server that wants to inline it. */\nexport function themeCssText(theme: ThemeConfig, selector = ':root'): string {\n const declarations = Object.entries(themeCssVariables(theme)).map(([name, value]) => ` ${name}: ${value};`);\n return `${selector} {\\n color-scheme: ${theme.scheme};\\n${declarations.join('\\n')}\\n}\\n`;\n}\n\n/** The subset of an element the theme touches, so tests can pass a plain object. */\nexport interface ThemeRoot {\n style: { setProperty(name: string, value: string): void; colorScheme: string };\n setAttribute(name: string, value: string): void;\n}\n\n/**\n * Applies a theme to the page: every token becomes a custom property on the\n * root, the colour scheme follows, and the theme name is stamped so a style\n * may key off it. Idempotent and synchronous, so calling it before the first\n * render avoids a flash of the default theme.\n */\nexport function applyTheme(theme: ThemeConfig, root: ThemeRoot): void {\n for (const [name, value] of Object.entries(themeCssVariables(theme))) root.style.setProperty(name, value);\n root.style.colorScheme = theme.scheme;\n root.setAttribute(THEME_ATTRIBUTE, theme.name);\n}\n"],"mappings":"oIAIA,MAAa,EAAkB,aAG/B,SAAgB,EAAkB,EAA4C,CAC5E,IAAM,EAAoC,CAAC,EAC3C,IAAK,IAAM,KAAS,EAAgB,EAAU,EAAc,CAAK,GAAK,EAAM,OAAO,GACnF,IAAK,IAAM,KAAS,EAAc,EAAG,EAAU,EAAc,CAAK,GAAK,EAAW,EAAO,CAAK,EAC9F,OAAO,CACT,CAGA,SAAgB,EAAa,EAAoB,EAAW,QAAiB,CAC3E,IAAM,EAAe,OAAO,QAAQ,EAAkB,CAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAM,KAAW,KAAK,EAAK,IAAI,EAAM,EAAE,EAC3G,MAAO,GAAG,EAAS,sBAAsB,EAAM,OAAO,KAAK,EAAa,KAAK;CAAI,EAAE,MACrF,CAcA,SAAgB,EAAW,EAAoB,EAAuB,CACpE,IAAK,GAAM,CAAC,EAAM,KAAU,OAAO,QAAQ,EAAkB,CAAK,CAAC,EAAG,EAAK,MAAM,YAAY,EAAM,CAAK,EACxG,EAAK,MAAM,YAAc,EAAM,OAC/B,EAAK,aAAa,EAAiB,EAAM,IAAI,CAC/C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../../themes/doom-nord-dark.cjs"),t=require("../../themes/doom-one-dark.cjs"),n=require("../../themes/doom-one-light.cjs"),r=require("./parse.cjs");function i(e,t){let n=r.parseThemeConfig(e);if(n===null)throw Error(`The shipped theme ${t} is malformed.`);return n}const a=[i(t.default,`doom-one-dark.json`),i(n.default,`doom-one-light.json`),i(e.default,`doom-nord-dark.json`)],o=a[0];function s(e){return a.find(t=>t.name===e)}exports.BUILTIN_THEMES=a,exports.DEFAULT_THEME=o,exports.DEFAULT_THEME_NAME=`doom-one-dark`,exports.builtinTheme=s;
|
|
2
|
+
//# sourceMappingURL=builtinThemes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtinThemes.cjs","names":["parseThemeConfig","doomOneDark","doomOneLight","doomNordDark"],"sources":["../../../src/theme/builtinThemes.ts"],"sourcesContent":["import type { ThemeConfig } from '../types/theme.ts';\nimport doomNordDark from '../../themes/doom-nord-dark.json' with { type: 'json' };\nimport doomOneDark from '../../themes/doom-one-dark.json' with { type: 'json' };\nimport doomOneLight from '../../themes/doom-one-light.json' with { type: 'json' };\nimport { parseThemeConfig } from './parse.ts';\n\nfunction shipped(input: unknown, file: string): ThemeConfig {\n const theme = parseThemeConfig(input);\n if (theme === null) throw new Error(`The shipped theme ${file} is malformed.`);\n return theme;\n}\n\n/** The theme the cockpit renders with until a preference says otherwise. */\nexport const DEFAULT_THEME_NAME = 'doom-one-dark';\n\n/** The themes this package ships, default first. */\nexport const BUILTIN_THEMES: readonly ThemeConfig[] = [\n shipped(doomOneDark, 'doom-one-dark.json'),\n shipped(doomOneLight, 'doom-one-light.json'),\n shipped(doomNordDark, 'doom-nord-dark.json'),\n];\n\nexport const DEFAULT_THEME: ThemeConfig = BUILTIN_THEMES[0];\n\n/** A shipped theme by name, or undefined for a name nothing shipped under. */\nexport function builtinTheme(name: string): ThemeConfig | undefined {\n return BUILTIN_THEMES.find((theme) => theme.name === name);\n}\n"],"mappings":"qKAMA,SAAS,EAAQ,EAAgB,EAA2B,CAC1D,IAAM,EAAQA,EAAAA,iBAAiB,CAAK,EACpC,GAAI,IAAU,KAAM,MAAU,MAAM,qBAAqB,EAAK,eAAe,EAC7E,OAAO,CACT,CAGA,MAGa,EAAyC,CACpD,EAAQC,EAAAA,QAAa,oBAAoB,EACzC,EAAQC,EAAAA,QAAc,qBAAqB,EAC3C,EAAQC,EAAAA,QAAc,qBAAqB,CAC7C,EAEa,EAA6B,EAAe,GAGzD,SAAgB,EAAa,EAAuC,CAClE,OAAO,EAAe,KAAM,GAAU,EAAM,OAAS,CAAI,CAC3D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ThemeConfig } from "../types/theme.mjs";
|
|
2
|
+
//#region src/theme/builtinThemes.d.ts
|
|
3
|
+
/** The theme the cockpit renders with until a preference says otherwise. */
|
|
4
|
+
declare const DEFAULT_THEME_NAME = "doom-one-dark";
|
|
5
|
+
/** The themes this package ships, default first. */
|
|
6
|
+
declare const BUILTIN_THEMES: readonly ThemeConfig[];
|
|
7
|
+
declare const DEFAULT_THEME: ThemeConfig;
|
|
8
|
+
/** A shipped theme by name, or undefined for a name nothing shipped under. */
|
|
9
|
+
declare function builtinTheme(name: string): ThemeConfig | undefined;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { BUILTIN_THEMES, DEFAULT_THEME, DEFAULT_THEME_NAME, builtinTheme };
|
|
12
|
+
//# sourceMappingURL=builtinThemes.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtinThemes.d.mts","names":[],"sources":["../../../src/theme/builtinThemes.ts"],"mappings":";;;cAaa;;cAGA,yBAAyB;cAMzB,eAAe;;iBAGZ,aAAa,eAAe"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"../../themes/doom-nord-dark.mjs";import t from"../../themes/doom-one-dark.mjs";import n from"../../themes/doom-one-light.mjs";import{parseThemeConfig as r}from"./parse.mjs";function i(e,t){let n=r(e);if(n===null)throw Error(`The shipped theme ${t} is malformed.`);return n}const a=`doom-one-dark`,o=[i(t,`doom-one-dark.json`),i(n,`doom-one-light.json`),i(e,`doom-nord-dark.json`)],s=o[0];function c(e){return o.find(t=>t.name===e)}export{o as BUILTIN_THEMES,s as DEFAULT_THEME,a as DEFAULT_THEME_NAME,c as builtinTheme};
|
|
2
|
+
//# sourceMappingURL=builtinThemes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtinThemes.mjs","names":["doomOneDark","doomOneLight","doomNordDark"],"sources":["../../../src/theme/builtinThemes.ts"],"sourcesContent":["import type { ThemeConfig } from '../types/theme.ts';\nimport doomNordDark from '../../themes/doom-nord-dark.json' with { type: 'json' };\nimport doomOneDark from '../../themes/doom-one-dark.json' with { type: 'json' };\nimport doomOneLight from '../../themes/doom-one-light.json' with { type: 'json' };\nimport { parseThemeConfig } from './parse.ts';\n\nfunction shipped(input: unknown, file: string): ThemeConfig {\n const theme = parseThemeConfig(input);\n if (theme === null) throw new Error(`The shipped theme ${file} is malformed.`);\n return theme;\n}\n\n/** The theme the cockpit renders with until a preference says otherwise. */\nexport const DEFAULT_THEME_NAME = 'doom-one-dark';\n\n/** The themes this package ships, default first. */\nexport const BUILTIN_THEMES: readonly ThemeConfig[] = [\n shipped(doomOneDark, 'doom-one-dark.json'),\n shipped(doomOneLight, 'doom-one-light.json'),\n shipped(doomNordDark, 'doom-nord-dark.json'),\n];\n\nexport const DEFAULT_THEME: ThemeConfig = BUILTIN_THEMES[0];\n\n/** A shipped theme by name, or undefined for a name nothing shipped under. */\nexport function builtinTheme(name: string): ThemeConfig | undefined {\n return BUILTIN_THEMES.find((theme) => theme.name === name);\n}\n"],"mappings":"2LAMA,SAAS,EAAQ,EAAgB,EAA2B,CAC1D,IAAM,EAAQ,EAAiB,CAAK,EACpC,GAAI,IAAU,KAAM,MAAU,MAAM,qBAAqB,EAAK,eAAe,EAC7E,OAAO,CACT,CAGA,MAAa,EAAqB,gBAGrB,EAAyC,CACpD,EAAQA,EAAa,oBAAoB,EACzC,EAAQC,EAAc,qBAAqB,EAC3C,EAAQC,EAAc,qBAAqB,CAC7C,EAEa,EAA6B,EAAe,GAGzD,SAAgB,EAAa,EAAuC,CAClE,OAAO,EAAe,KAAM,GAAU,EAAM,OAAS,CAAI,CAC3D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../types/theme.cjs"),t=`'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`;function n(e){if(e===`font-mono`)return t;if(e===`on-selected`)return`color-mix(in srgb, var(--doom-selected) 12%, white)`;let[n,r]=e.split(`-`);return n===`tint`?`color-mix(in srgb, var(--doom-${r}) 16%, var(--doom-panel))`:`color-mix(in srgb, var(--doom-${r}) 40%, var(--doom-border))`}function r(){let t=[];for(let n of e.ACCENT_TOKENS)t.push(`tint-${n}`);for(let n of e.ACCENT_TOKENS)t.push(`edge-${n}`);return t.push(`on-selected`,`font-mono`),t}function i(e,t){let r=e.tokens[t];return r===void 0?n(t):r}exports.DEFAULT_FONT_MONO=t,exports.derivedFallback=n,exports.derivedTokens=r,exports.tokenValue=i;
|
|
2
|
+
//# sourceMappingURL=derive.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive.cjs","names":["ACCENT_TOKENS"],"sources":["../../../src/theme/derive.ts"],"sourcesContent":["import {\n ACCENT_TOKENS,\n type AccentToken,\n type DerivedToken,\n type ThemeConfig,\n type ThemeToken,\n} from '../types/theme.ts';\n\n/** How much of an accent goes into its tinted background; the rest is the panel. */\nconst TINT_MIX_PERCENT = 16;\n/** How much of an accent goes into its accented border; the rest is the border. */\nconst EDGE_MIX_PERCENT = 40;\n/** How much of the selection tints its foreground; the rest is white, so the label stays legible on it. */\nconst ON_SELECTED_MIX_PERCENT = 12;\n\nexport const DEFAULT_FONT_MONO =\n \"'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace\";\n\n/**\n * A derived token's fallback: a CSS colour expression over the palette, so a\n * theme that supplies only its palette still gets coherent tints and edges.\n */\nexport function derivedFallback(token: DerivedToken): string {\n if (token === 'font-mono') return DEFAULT_FONT_MONO;\n if (token === 'on-selected')\n return `color-mix(in srgb, var(--doom-selected) ${String(ON_SELECTED_MIX_PERCENT)}%, white)`;\n const [kind, accent] = token.split('-') as ['tint' | 'edge', AccentToken];\n return kind === 'tint'\n ? `color-mix(in srgb, var(--doom-${accent}) ${String(TINT_MIX_PERCENT)}%, var(--doom-panel))`\n : `color-mix(in srgb, var(--doom-${accent}) ${String(EDGE_MIX_PERCENT)}%, var(--doom-border))`;\n}\n\n/** Every derived token, in a stable order. */\nexport function derivedTokens(): DerivedToken[] {\n const tokens: DerivedToken[] = [];\n for (const accent of ACCENT_TOKENS) tokens.push(`tint-${accent}`);\n for (const accent of ACCENT_TOKENS) tokens.push(`edge-${accent}`);\n tokens.push('on-selected', 'font-mono');\n return tokens;\n}\n\n/** The value a theme publishes for a token: its own, or the derived fallback. */\nexport function tokenValue(theme: ThemeConfig, token: ThemeToken): string {\n const own = (theme.tokens as Partial<Record<ThemeToken, string>>)[token];\n if (own !== undefined) return own;\n return derivedFallback(token as DerivedToken);\n}\n"],"mappings":"sCAea,EACX,wFAMF,SAAgB,EAAgB,EAA6B,CAC3D,GAAI,IAAU,YAAa,OAAO,EAClC,GAAI,IAAU,cACZ,MAAO,sDACT,GAAM,CAAC,EAAM,GAAU,EAAM,MAAM,GAAG,EACtC,OAAO,IAAS,OACZ,iCAAiC,EAAO,2BACxC,iCAAiC,EAAO,2BAC9C,CAGA,SAAgB,GAAgC,CAC9C,IAAM,EAAyB,CAAC,EAChC,IAAK,IAAM,KAAUA,EAAAA,cAAe,EAAO,KAAK,QAAQ,GAAQ,EAChE,IAAK,IAAM,KAAUA,EAAAA,cAAe,EAAO,KAAK,QAAQ,GAAQ,EAEhE,OADA,EAAO,KAAK,cAAe,WAAW,EAC/B,CACT,CAGA,SAAgB,EAAW,EAAoB,EAA2B,CACxE,IAAM,EAAO,EAAM,OAA+C,GAElE,OADI,IAAQ,IAAA,GACL,EAAgB,CAAqB,EADd,CAEhC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DerivedToken, ThemeConfig, ThemeToken } from "../types/theme.mjs";
|
|
2
|
+
//#region src/theme/derive.d.ts
|
|
3
|
+
declare const DEFAULT_FONT_MONO = "'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace";
|
|
4
|
+
/**
|
|
5
|
+
* A derived token's fallback: a CSS colour expression over the palette, so a
|
|
6
|
+
* theme that supplies only its palette still gets coherent tints and edges.
|
|
7
|
+
*/
|
|
8
|
+
declare function derivedFallback(token: DerivedToken): string;
|
|
9
|
+
/** Every derived token, in a stable order. */
|
|
10
|
+
declare function derivedTokens(): DerivedToken[];
|
|
11
|
+
/** The value a theme publishes for a token: its own, or the derived fallback. */
|
|
12
|
+
declare function tokenValue(theme: ThemeConfig, token: ThemeToken): string;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { DEFAULT_FONT_MONO, derivedFallback, derivedTokens, tokenValue };
|
|
15
|
+
//# sourceMappingURL=derive.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive.d.mts","names":[],"sources":["../../../src/theme/derive.ts"],"mappings":";;cAea;;;;;iBAOG,gBAAgB,OAAO;;iBAWvB,iBAAiB;;iBASjB,WAAW,OAAO,aAAa,OAAO"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ACCENT_TOKENS as e}from"../types/theme.mjs";const t=`'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`;function n(e){if(e===`font-mono`)return t;if(e===`on-selected`)return`color-mix(in srgb, var(--doom-selected) 12%, white)`;let[n,r]=e.split(`-`);return n===`tint`?`color-mix(in srgb, var(--doom-${r}) 16%, var(--doom-panel))`:`color-mix(in srgb, var(--doom-${r}) 40%, var(--doom-border))`}function r(){let t=[];for(let n of e)t.push(`tint-${n}`);for(let n of e)t.push(`edge-${n}`);return t.push(`on-selected`,`font-mono`),t}function i(e,t){let r=e.tokens[t];return r===void 0?n(t):r}export{t as DEFAULT_FONT_MONO,n as derivedFallback,r as derivedTokens,i as tokenValue};
|
|
2
|
+
//# sourceMappingURL=derive.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive.mjs","names":[],"sources":["../../../src/theme/derive.ts"],"sourcesContent":["import {\n ACCENT_TOKENS,\n type AccentToken,\n type DerivedToken,\n type ThemeConfig,\n type ThemeToken,\n} from '../types/theme.ts';\n\n/** How much of an accent goes into its tinted background; the rest is the panel. */\nconst TINT_MIX_PERCENT = 16;\n/** How much of an accent goes into its accented border; the rest is the border. */\nconst EDGE_MIX_PERCENT = 40;\n/** How much of the selection tints its foreground; the rest is white, so the label stays legible on it. */\nconst ON_SELECTED_MIX_PERCENT = 12;\n\nexport const DEFAULT_FONT_MONO =\n \"'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace\";\n\n/**\n * A derived token's fallback: a CSS colour expression over the palette, so a\n * theme that supplies only its palette still gets coherent tints and edges.\n */\nexport function derivedFallback(token: DerivedToken): string {\n if (token === 'font-mono') return DEFAULT_FONT_MONO;\n if (token === 'on-selected')\n return `color-mix(in srgb, var(--doom-selected) ${String(ON_SELECTED_MIX_PERCENT)}%, white)`;\n const [kind, accent] = token.split('-') as ['tint' | 'edge', AccentToken];\n return kind === 'tint'\n ? `color-mix(in srgb, var(--doom-${accent}) ${String(TINT_MIX_PERCENT)}%, var(--doom-panel))`\n : `color-mix(in srgb, var(--doom-${accent}) ${String(EDGE_MIX_PERCENT)}%, var(--doom-border))`;\n}\n\n/** Every derived token, in a stable order. */\nexport function derivedTokens(): DerivedToken[] {\n const tokens: DerivedToken[] = [];\n for (const accent of ACCENT_TOKENS) tokens.push(`tint-${accent}`);\n for (const accent of ACCENT_TOKENS) tokens.push(`edge-${accent}`);\n tokens.push('on-selected', 'font-mono');\n return tokens;\n}\n\n/** The value a theme publishes for a token: its own, or the derived fallback. */\nexport function tokenValue(theme: ThemeConfig, token: ThemeToken): string {\n const own = (theme.tokens as Partial<Record<ThemeToken, string>>)[token];\n if (own !== undefined) return own;\n return derivedFallback(token as DerivedToken);\n}\n"],"mappings":"mDASA,MAMa,EACX,wFAMF,SAAgB,EAAgB,EAA6B,CAC3D,GAAI,IAAU,YAAa,OAAO,EAClC,GAAI,IAAU,cACZ,MAAO,sDACT,GAAM,CAAC,EAAM,GAAU,EAAM,MAAM,GAAG,EACtC,OAAO,IAAS,OACZ,iCAAiC,EAAO,2BACxC,iCAAiC,EAAO,2BAC9C,CAGA,SAAgB,GAAgC,CAC9C,IAAM,EAAyB,CAAC,EAChC,IAAK,IAAM,KAAU,EAAe,EAAO,KAAK,QAAQ,GAAQ,EAChE,IAAK,IAAM,KAAU,EAAe,EAAO,KAAK,QAAQ,GAAQ,EAEhE,OADA,EAAO,KAAK,cAAe,WAAW,EAC/B,CACT,CAGA,SAAgB,EAAW,EAAoB,EAA2B,CACxE,IAAM,EAAO,EAAM,OAA+C,GAElE,OADI,IAAQ,IAAA,GACL,EAAgB,CAAqB,EADd,CAEhC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../types/theme.cjs"),t=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,n=/^(?:#[0-9a-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\((?:[^()]|\([^()]*\))*\)|[a-z]+)$/i;function r(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function i(i){if(!r(i))return null;let{name:a,label:o,scheme:s,tokens:c}=i;if(typeof a!=`string`||!t.test(a)||typeof o!=`string`||o.trim()===``||s!==`dark`&&s!==`light`||!r(c))return null;let l={};for(let t of e.PALETTE_TOKENS){let e=c[t];if(typeof e!=`string`||!n.test(e.trim()))return null;l[t]=e.trim()}for(let t of e.DERIVED_TOKENS){let e=c[t];if(e!==void 0){if(typeof e!=`string`||e.trim()===``)return null;l[t]=e.trim()}}return{name:a,label:o,scheme:s,tokens:l}}exports.parseThemeConfig=i;
|
|
2
|
+
//# sourceMappingURL=parse.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.cjs","names":["PALETTE_TOKENS","DERIVED_TOKENS"],"sources":["../../../src/theme/parse.ts"],"sourcesContent":["import { DERIVED_TOKENS, PALETTE_TOKENS, type ThemeConfig, type ThemeScheme } from '../types/theme.ts';\n\nconst THEME_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n/** A CSS colour as a theme may spell it: hex, a colour function, or a named colour; never a url or an image. */\nconst CSS_COLOR =\n /^(?:#[0-9a-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\\((?:[^()]|\\([^()]*\\))*\\)|[a-z]+)$/i;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Validates a theme config read from JSON. Returns null rather than throwing\n * because a bad theme file must never take the cockpit down; the caller falls\n * back to the shipped default and says so.\n */\nexport function parseThemeConfig(input: unknown): ThemeConfig | null {\n if (!isRecord(input)) return null;\n const { name, label, scheme, tokens } = input;\n if (typeof name !== 'string' || !THEME_NAME.test(name)) return null;\n if (typeof label !== 'string' || label.trim() === '') return null;\n if (scheme !== 'dark' && scheme !== 'light') return null;\n if (!isRecord(tokens)) return null;\n\n const accepted: Record<string, string> = {};\n for (const token of PALETTE_TOKENS) {\n const value = tokens[token];\n if (typeof value !== 'string' || !CSS_COLOR.test(value.trim())) return null;\n accepted[token] = value.trim();\n }\n for (const token of DERIVED_TOKENS) {\n const value = tokens[token];\n if (value === undefined) continue;\n if (typeof value !== 'string' || value.trim() === '') return null;\n accepted[token] = value.trim();\n }\n return { name, label, scheme: scheme as ThemeScheme, tokens: accepted as ThemeConfig['tokens'] };\n}\n"],"mappings":"sCAEM,EAAa,6BAEb,EACJ,iIAEF,SAAS,EAAS,EAAkD,CAClE,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,CAAK,CAC5E,CAOA,SAAgB,EAAiB,EAAoC,CACnE,GAAI,CAAC,EAAS,CAAK,EAAG,OAAO,KAC7B,GAAM,CAAE,OAAM,QAAO,SAAQ,UAAW,EAIxC,GAHI,OAAO,GAAS,UAAY,CAAC,EAAW,KAAK,CAAI,GACjD,OAAO,GAAU,UAAY,EAAM,KAAK,IAAM,IAC9C,IAAW,QAAU,IAAW,SAChC,CAAC,EAAS,CAAM,EAAG,OAAO,KAE9B,IAAM,EAAmC,CAAC,EAC1C,IAAK,IAAM,KAASA,EAAAA,eAAgB,CAClC,IAAM,EAAQ,EAAO,GACrB,GAAI,OAAO,GAAU,UAAY,CAAC,EAAU,KAAK,EAAM,KAAK,CAAC,EAAG,OAAO,KACvE,EAAS,GAAS,EAAM,KAAK,CAC/B,CACA,IAAK,IAAM,KAASC,EAAAA,eAAgB,CAClC,IAAM,EAAQ,EAAO,GACjB,OAAU,IAAA,GACd,IAAI,OAAO,GAAU,UAAY,EAAM,KAAK,IAAM,GAAI,OAAO,KAC7D,EAAS,GAAS,EAAM,KAAK,CADgC,CAE/D,CACA,MAAO,CAAE,OAAM,QAAe,SAAuB,OAAQ,CAAkC,CACjG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ThemeConfig } from "../types/theme.mjs";
|
|
2
|
+
//#region src/theme/parse.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Validates a theme config read from JSON. Returns null rather than throwing
|
|
5
|
+
* because a bad theme file must never take the cockpit down; the caller falls
|
|
6
|
+
* back to the shipped default and says so.
|
|
7
|
+
*/
|
|
8
|
+
declare function parseThemeConfig(input: unknown): ThemeConfig | null;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { parseThemeConfig };
|
|
11
|
+
//# sourceMappingURL=parse.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.mts","names":[],"sources":["../../../src/theme/parse.ts"],"mappings":";;;;;;;iBAgBgB,iBAAiB,iBAAiB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{DERIVED_TOKENS as e,PALETTE_TOKENS as t}from"../types/theme.mjs";const n=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,r=/^(?:#[0-9a-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\((?:[^()]|\([^()]*\))*\)|[a-z]+)$/i;function i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function a(a){if(!i(a))return null;let{name:o,label:s,scheme:c,tokens:l}=a;if(typeof o!=`string`||!n.test(o)||typeof s!=`string`||s.trim()===``||c!==`dark`&&c!==`light`||!i(l))return null;let u={};for(let e of t){let t=l[e];if(typeof t!=`string`||!r.test(t.trim()))return null;u[e]=t.trim()}for(let t of e){let e=l[t];if(e!==void 0){if(typeof e!=`string`||e.trim()===``)return null;u[t]=e.trim()}}return{name:o,label:s,scheme:c,tokens:u}}export{a as parseThemeConfig};
|
|
2
|
+
//# sourceMappingURL=parse.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.mjs","names":[],"sources":["../../../src/theme/parse.ts"],"sourcesContent":["import { DERIVED_TOKENS, PALETTE_TOKENS, type ThemeConfig, type ThemeScheme } from '../types/theme.ts';\n\nconst THEME_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n/** A CSS colour as a theme may spell it: hex, a colour function, or a named colour; never a url or an image. */\nconst CSS_COLOR =\n /^(?:#[0-9a-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\\((?:[^()]|\\([^()]*\\))*\\)|[a-z]+)$/i;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Validates a theme config read from JSON. Returns null rather than throwing\n * because a bad theme file must never take the cockpit down; the caller falls\n * back to the shipped default and says so.\n */\nexport function parseThemeConfig(input: unknown): ThemeConfig | null {\n if (!isRecord(input)) return null;\n const { name, label, scheme, tokens } = input;\n if (typeof name !== 'string' || !THEME_NAME.test(name)) return null;\n if (typeof label !== 'string' || label.trim() === '') return null;\n if (scheme !== 'dark' && scheme !== 'light') return null;\n if (!isRecord(tokens)) return null;\n\n const accepted: Record<string, string> = {};\n for (const token of PALETTE_TOKENS) {\n const value = tokens[token];\n if (typeof value !== 'string' || !CSS_COLOR.test(value.trim())) return null;\n accepted[token] = value.trim();\n }\n for (const token of DERIVED_TOKENS) {\n const value = tokens[token];\n if (value === undefined) continue;\n if (typeof value !== 'string' || value.trim() === '') return null;\n accepted[token] = value.trim();\n }\n return { name, label, scheme: scheme as ThemeScheme, tokens: accepted as ThemeConfig['tokens'] };\n}\n"],"mappings":"wEAEA,MAAM,EAAa,6BAEb,EACJ,iIAEF,SAAS,EAAS,EAAkD,CAClE,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,CAAK,CAC5E,CAOA,SAAgB,EAAiB,EAAoC,CACnE,GAAI,CAAC,EAAS,CAAK,EAAG,OAAO,KAC7B,GAAM,CAAE,OAAM,QAAO,SAAQ,UAAW,EAIxC,GAHI,OAAO,GAAS,UAAY,CAAC,EAAW,KAAK,CAAI,GACjD,OAAO,GAAU,UAAY,EAAM,KAAK,IAAM,IAC9C,IAAW,QAAU,IAAW,SAChC,CAAC,EAAS,CAAM,EAAG,OAAO,KAE9B,IAAM,EAAmC,CAAC,EAC1C,IAAK,IAAM,KAAS,EAAgB,CAClC,IAAM,EAAQ,EAAO,GACrB,GAAI,OAAO,GAAU,UAAY,CAAC,EAAU,KAAK,EAAM,KAAK,CAAC,EAAG,OAAO,KACvE,EAAS,GAAS,EAAM,KAAK,CAC/B,CACA,IAAK,IAAM,KAAS,EAAgB,CAClC,IAAM,EAAQ,EAAO,GACjB,OAAU,IAAA,GACd,IAAI,OAAO,GAAU,UAAY,EAAM,KAAK,IAAM,GAAI,OAAO,KAC7D,EAAS,GAAS,EAAM,KAAK,CADgC,CAE/D,CACA,MAAO,CAAE,OAAM,QAAe,SAAuB,OAAQ,CAAkC,CACjG"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./parse.cjs");function t(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function n(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=Number.parseInt(t[1],16),r=n>>16&255,i=n>>8&255,a=n&255;return(.2126*r+.7152*i+.0722*a)/255}function r(e,t){if(t!==void 0)return e[t]??t}function i(i,a={}){if(!t(i))return null;let{name:o,vars:s,colors:c}=i;if(!t(s))return null;let l={};for(let[e,t]of Object.entries(s))typeof t==`string`&&(l[e]=t);let u={};if(t(c))for(let[e,t]of Object.entries(c))typeof t==`string`&&(u[e]=t);let d=l.bg,f=l.bgAlt??d,p=l.fg;if(d===void 0||p===void 0)return null;let m=n(d),h=a.scheme??(m!==null&&m>.5?`light`:`dark`),g=`color-mix(in srgb, ${f} 84%, ${h===`dark`?`black`:`white`})`,_=r(l,u.borderMuted)??l.grey??`color-mix(in srgb, ${p} 25%, ${d})`,v=a.name??(typeof o==`string`?o:`pi-theme`);return e.parseThemeConfig({name:v,label:a.label??v,scheme:h,tokens:{bg:d,rail:f,panel:`color-mix(in srgb, ${f} 70%, ${d})`,deep:g,border:_,"border-soft":`color-mix(in srgb, ${_} 55%, ${d})`,hi:`color-mix(in srgb, ${p} 65%, ${h===`dark`?`white`:`black`})`,text:p,dim:r(l,u.muted)??l.fgAlt??p,faint:r(l,u.dim)??l.comment??l.greyAlt??p,blue:l.blue??r(l,u.accent)??p,green:l.green??r(l,u.success)??p,yellow:l.yellow??r(l,u.warning)??p,red:l.red??r(l,u.error)??p,magenta:l.magenta??l.violet??p,violet:l.violet??l.magenta??p,cyan:l.cyan??l.blue??p,orange:l.orange??l.yellow??p,teal:l.teal??l.cyan??p,selected:l.darkBlue??l.blue??p}})}exports.themeFromPiTheme=i;
|
|
2
|
+
//# sourceMappingURL=piTheme.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piTheme.cjs","names":["parseThemeConfig"],"sources":["../../../src/theme/piTheme.ts"],"sourcesContent":["import type { ThemeConfig, ThemeScheme } from '../types/theme.ts';\nimport { parseThemeConfig } from './parse.ts';\n\n/**\n * The Pi TUI theme shape (theme-schema.json): a palette of named vars and\n * semantic colours that name a var or spell a colour.\n */\ninterface PiThemeLike {\n name?: unknown;\n vars?: unknown;\n colors?: unknown;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction hexLuminance(hex: string): number | null {\n const match = /^#([0-9a-f]{6})$/i.exec(hex.trim());\n if (!match) return null;\n const value = Number.parseInt(match[1], 16);\n const r = (value >> 16) & 0xff;\n const g = (value >> 8) & 0xff;\n const b = value & 0xff;\n return (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;\n}\n\n/** Resolves a Pi colour reference: a var name, or a literal colour. */\nfunction resolve(vars: Record<string, string>, reference: string | undefined): string | undefined {\n if (reference === undefined) return undefined;\n return vars[reference] ?? reference;\n}\n\nexport interface PiThemeBridgeOptions {\n /** The web theme's id; defaults to the Pi theme's name. */\n name?: string;\n label?: string;\n /** Forced scheme; otherwise inferred from the background luminance. */\n scheme?: ThemeScheme;\n}\n\n/**\n * Builds a web theme from a Pi TUI theme, so the palette DoomPi ships for\n * the terminal (doompi-ui/themes/doom-pi-dark.json) drives the browser too.\n * The mapping is by role, not by name: Pi has no cockpit \"deep\" surface or\n * \"border-soft\" line, so those are mixed from the nearest vars. Returns null\n * when the input is not a Pi theme with a complete palette.\n */\nexport function themeFromPiTheme(input: unknown, options: PiThemeBridgeOptions = {}): ThemeConfig | null {\n if (!isRecord(input)) return null;\n const { name, vars, colors } = input as PiThemeLike;\n if (!isRecord(vars)) return null;\n const palette: Record<string, string> = {};\n for (const [key, value] of Object.entries(vars)) if (typeof value === 'string') palette[key] = value;\n const semantic: Record<string, string> = {};\n if (isRecord(colors))\n for (const [key, value] of Object.entries(colors)) if (typeof value === 'string') semantic[key] = value;\n\n const bg = palette.bg;\n const bgAlt = palette.bgAlt ?? bg;\n const fg = palette.fg;\n if (bg === undefined || fg === undefined) return null;\n\n const luminance = hexLuminance(bg);\n const scheme: ThemeScheme = options.scheme ?? (luminance !== null && luminance > 0.5 ? 'light' : 'dark');\n const towards = scheme === 'dark' ? 'black' : 'white';\n const deep = `color-mix(in srgb, ${bgAlt} 84%, ${towards})`;\n const border = resolve(palette, semantic.borderMuted) ?? palette.grey ?? `color-mix(in srgb, ${fg} 25%, ${bg})`;\n const themeName = options.name ?? (typeof name === 'string' ? name : 'pi-theme');\n\n return parseThemeConfig({\n name: themeName,\n label: options.label ?? themeName,\n scheme,\n tokens: {\n bg,\n rail: bgAlt,\n panel: `color-mix(in srgb, ${bgAlt} 70%, ${bg})`,\n deep,\n border,\n 'border-soft': `color-mix(in srgb, ${border} 55%, ${bg})`,\n hi: `color-mix(in srgb, ${fg} 65%, ${scheme === 'dark' ? 'white' : 'black'})`,\n text: fg,\n dim: resolve(palette, semantic.muted) ?? palette.fgAlt ?? fg,\n faint: resolve(palette, semantic.dim) ?? palette.comment ?? palette.greyAlt ?? fg,\n blue: palette.blue ?? resolve(palette, semantic.accent) ?? fg,\n green: palette.green ?? resolve(palette, semantic.success) ?? fg,\n yellow: palette.yellow ?? resolve(palette, semantic.warning) ?? fg,\n red: palette.red ?? resolve(palette, semantic.error) ?? fg,\n magenta: palette.magenta ?? palette.violet ?? fg,\n violet: palette.violet ?? palette.magenta ?? fg,\n cyan: palette.cyan ?? palette.blue ?? fg,\n orange: palette.orange ?? palette.yellow ?? fg,\n teal: palette.teal ?? palette.cyan ?? fg,\n selected: palette.darkBlue ?? palette.blue ?? fg,\n },\n });\n}\n"],"mappings":"+BAaA,SAAS,EAAS,EAAkD,CAClE,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,CAAK,CAC5E,CAEA,SAAS,EAAa,EAA4B,CAChD,IAAM,EAAQ,oBAAoB,KAAK,EAAI,KAAK,CAAC,EACjD,GAAI,CAAC,EAAO,OAAO,KACnB,IAAM,EAAQ,OAAO,SAAS,EAAM,GAAI,EAAE,EACpC,EAAK,GAAS,GAAM,IACpB,EAAK,GAAS,EAAK,IACnB,EAAI,EAAQ,IAClB,OAAQ,MAAS,EAAI,MAAS,EAAI,MAAS,GAAK,GAClD,CAGA,SAAS,EAAQ,EAA8B,EAAmD,CAC5F,OAAc,IAAA,GAClB,OAAO,EAAK,IAAc,CAC5B,CAiBA,SAAgB,EAAiB,EAAgB,EAAgC,CAAC,EAAuB,CACvG,GAAI,CAAC,EAAS,CAAK,EAAG,OAAO,KAC7B,GAAM,CAAE,OAAM,OAAM,UAAW,EAC/B,GAAI,CAAC,EAAS,CAAI,EAAG,OAAO,KAC5B,IAAM,EAAkC,CAAC,EACzC,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,CAAI,EAAO,OAAO,GAAU,WAAU,EAAQ,GAAO,GAC/F,IAAM,EAAmC,CAAC,EAC1C,GAAI,EAAS,CAAM,EACZ,IAAA,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,CAAM,EAAO,OAAO,GAAU,WAAU,EAAS,GAAO,GAEpG,IAAM,EAAK,EAAQ,GACb,EAAQ,EAAQ,OAAS,EACzB,EAAK,EAAQ,GACnB,GAAI,IAAO,IAAA,IAAa,IAAO,IAAA,GAAW,OAAO,KAEjD,IAAM,EAAY,EAAa,CAAE,EAC3B,EAAsB,EAAQ,SAAW,IAAc,MAAQ,EAAY,GAAM,QAAU,QAE3F,EAAO,sBAAsB,EAAM,QADzB,IAAW,OAAS,QAAU,QACW,GACnD,EAAS,EAAQ,EAAS,EAAS,WAAW,GAAK,EAAQ,MAAQ,sBAAsB,EAAG,QAAQ,EAAG,GACvG,EAAY,EAAQ,OAAS,OAAO,GAAS,SAAW,EAAO,YAErE,OAAOA,EAAAA,iBAAiB,CACtB,KAAM,EACN,MAAO,EAAQ,OAAS,EACxB,SACA,OAAQ,CACN,KACA,KAAM,EACN,MAAO,sBAAsB,EAAM,QAAQ,EAAG,GAC9C,OACA,SACA,cAAe,sBAAsB,EAAO,QAAQ,EAAG,GACvD,GAAI,sBAAsB,EAAG,QAAQ,IAAW,OAAS,QAAU,QAAQ,GAC3E,KAAM,EACN,IAAK,EAAQ,EAAS,EAAS,KAAK,GAAK,EAAQ,OAAS,EAC1D,MAAO,EAAQ,EAAS,EAAS,GAAG,GAAK,EAAQ,SAAW,EAAQ,SAAW,EAC/E,KAAM,EAAQ,MAAQ,EAAQ,EAAS,EAAS,MAAM,GAAK,EAC3D,MAAO,EAAQ,OAAS,EAAQ,EAAS,EAAS,OAAO,GAAK,EAC9D,OAAQ,EAAQ,QAAU,EAAQ,EAAS,EAAS,OAAO,GAAK,EAChE,IAAK,EAAQ,KAAO,EAAQ,EAAS,EAAS,KAAK,GAAK,EACxD,QAAS,EAAQ,SAAW,EAAQ,QAAU,EAC9C,OAAQ,EAAQ,QAAU,EAAQ,SAAW,EAC7C,KAAM,EAAQ,MAAQ,EAAQ,MAAQ,EACtC,OAAQ,EAAQ,QAAU,EAAQ,QAAU,EAC5C,KAAM,EAAQ,MAAQ,EAAQ,MAAQ,EACtC,SAAU,EAAQ,UAAY,EAAQ,MAAQ,CAChD,CACF,CAAC,CACH"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ThemeConfig, ThemeScheme } from "../types/theme.mjs";
|
|
2
|
+
//#region src/theme/piTheme.d.ts
|
|
3
|
+
interface PiThemeBridgeOptions {
|
|
4
|
+
/** The web theme's id; defaults to the Pi theme's name. */
|
|
5
|
+
name?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Forced scheme; otherwise inferred from the background luminance. */
|
|
8
|
+
scheme?: ThemeScheme;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Builds a web theme from a Pi TUI theme, so the palette DoomPi ships for
|
|
12
|
+
* the terminal (doompi-ui/themes/doom-pi-dark.json) drives the browser too.
|
|
13
|
+
* The mapping is by role, not by name: Pi has no cockpit "deep" surface or
|
|
14
|
+
* "border-soft" line, so those are mixed from the nearest vars. Returns null
|
|
15
|
+
* when the input is not a Pi theme with a complete palette.
|
|
16
|
+
*/
|
|
17
|
+
declare function themeFromPiTheme(input: unknown, options?: PiThemeBridgeOptions): ThemeConfig | null;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { PiThemeBridgeOptions, themeFromPiTheme };
|
|
20
|
+
//# sourceMappingURL=piTheme.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piTheme.d.mts","names":[],"sources":["../../../src/theme/piTheme.ts"],"mappings":";;UAiCiB;;EAEf;EACA;;EAEA,SAAS;;;;;;;;;iBAUK,iBAAiB,gBAAgB,UAAS,uBAA4B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{parseThemeConfig as e}from"./parse.mjs";function t(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function n(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=Number.parseInt(t[1],16),r=n>>16&255,i=n>>8&255,a=n&255;return(.2126*r+.7152*i+.0722*a)/255}function r(e,t){if(t!==void 0)return e[t]??t}function i(i,a={}){if(!t(i))return null;let{name:o,vars:s,colors:c}=i;if(!t(s))return null;let l={};for(let[e,t]of Object.entries(s))typeof t==`string`&&(l[e]=t);let u={};if(t(c))for(let[e,t]of Object.entries(c))typeof t==`string`&&(u[e]=t);let d=l.bg,f=l.bgAlt??d,p=l.fg;if(d===void 0||p===void 0)return null;let m=n(d),h=a.scheme??(m!==null&&m>.5?`light`:`dark`),g=`color-mix(in srgb, ${f} 84%, ${h===`dark`?`black`:`white`})`,_=r(l,u.borderMuted)??l.grey??`color-mix(in srgb, ${p} 25%, ${d})`,v=a.name??(typeof o==`string`?o:`pi-theme`);return e({name:v,label:a.label??v,scheme:h,tokens:{bg:d,rail:f,panel:`color-mix(in srgb, ${f} 70%, ${d})`,deep:g,border:_,"border-soft":`color-mix(in srgb, ${_} 55%, ${d})`,hi:`color-mix(in srgb, ${p} 65%, ${h===`dark`?`white`:`black`})`,text:p,dim:r(l,u.muted)??l.fgAlt??p,faint:r(l,u.dim)??l.comment??l.greyAlt??p,blue:l.blue??r(l,u.accent)??p,green:l.green??r(l,u.success)??p,yellow:l.yellow??r(l,u.warning)??p,red:l.red??r(l,u.error)??p,magenta:l.magenta??l.violet??p,violet:l.violet??l.magenta??p,cyan:l.cyan??l.blue??p,orange:l.orange??l.yellow??p,teal:l.teal??l.cyan??p,selected:l.darkBlue??l.blue??p}})}export{i as themeFromPiTheme};
|
|
2
|
+
//# sourceMappingURL=piTheme.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piTheme.mjs","names":[],"sources":["../../../src/theme/piTheme.ts"],"sourcesContent":["import type { ThemeConfig, ThemeScheme } from '../types/theme.ts';\nimport { parseThemeConfig } from './parse.ts';\n\n/**\n * The Pi TUI theme shape (theme-schema.json): a palette of named vars and\n * semantic colours that name a var or spell a colour.\n */\ninterface PiThemeLike {\n name?: unknown;\n vars?: unknown;\n colors?: unknown;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction hexLuminance(hex: string): number | null {\n const match = /^#([0-9a-f]{6})$/i.exec(hex.trim());\n if (!match) return null;\n const value = Number.parseInt(match[1], 16);\n const r = (value >> 16) & 0xff;\n const g = (value >> 8) & 0xff;\n const b = value & 0xff;\n return (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;\n}\n\n/** Resolves a Pi colour reference: a var name, or a literal colour. */\nfunction resolve(vars: Record<string, string>, reference: string | undefined): string | undefined {\n if (reference === undefined) return undefined;\n return vars[reference] ?? reference;\n}\n\nexport interface PiThemeBridgeOptions {\n /** The web theme's id; defaults to the Pi theme's name. */\n name?: string;\n label?: string;\n /** Forced scheme; otherwise inferred from the background luminance. */\n scheme?: ThemeScheme;\n}\n\n/**\n * Builds a web theme from a Pi TUI theme, so the palette DoomPi ships for\n * the terminal (doompi-ui/themes/doom-pi-dark.json) drives the browser too.\n * The mapping is by role, not by name: Pi has no cockpit \"deep\" surface or\n * \"border-soft\" line, so those are mixed from the nearest vars. Returns null\n * when the input is not a Pi theme with a complete palette.\n */\nexport function themeFromPiTheme(input: unknown, options: PiThemeBridgeOptions = {}): ThemeConfig | null {\n if (!isRecord(input)) return null;\n const { name, vars, colors } = input as PiThemeLike;\n if (!isRecord(vars)) return null;\n const palette: Record<string, string> = {};\n for (const [key, value] of Object.entries(vars)) if (typeof value === 'string') palette[key] = value;\n const semantic: Record<string, string> = {};\n if (isRecord(colors))\n for (const [key, value] of Object.entries(colors)) if (typeof value === 'string') semantic[key] = value;\n\n const bg = palette.bg;\n const bgAlt = palette.bgAlt ?? bg;\n const fg = palette.fg;\n if (bg === undefined || fg === undefined) return null;\n\n const luminance = hexLuminance(bg);\n const scheme: ThemeScheme = options.scheme ?? (luminance !== null && luminance > 0.5 ? 'light' : 'dark');\n const towards = scheme === 'dark' ? 'black' : 'white';\n const deep = `color-mix(in srgb, ${bgAlt} 84%, ${towards})`;\n const border = resolve(palette, semantic.borderMuted) ?? palette.grey ?? `color-mix(in srgb, ${fg} 25%, ${bg})`;\n const themeName = options.name ?? (typeof name === 'string' ? name : 'pi-theme');\n\n return parseThemeConfig({\n name: themeName,\n label: options.label ?? themeName,\n scheme,\n tokens: {\n bg,\n rail: bgAlt,\n panel: `color-mix(in srgb, ${bgAlt} 70%, ${bg})`,\n deep,\n border,\n 'border-soft': `color-mix(in srgb, ${border} 55%, ${bg})`,\n hi: `color-mix(in srgb, ${fg} 65%, ${scheme === 'dark' ? 'white' : 'black'})`,\n text: fg,\n dim: resolve(palette, semantic.muted) ?? palette.fgAlt ?? fg,\n faint: resolve(palette, semantic.dim) ?? palette.comment ?? palette.greyAlt ?? fg,\n blue: palette.blue ?? resolve(palette, semantic.accent) ?? fg,\n green: palette.green ?? resolve(palette, semantic.success) ?? fg,\n yellow: palette.yellow ?? resolve(palette, semantic.warning) ?? fg,\n red: palette.red ?? resolve(palette, semantic.error) ?? fg,\n magenta: palette.magenta ?? palette.violet ?? fg,\n violet: palette.violet ?? palette.magenta ?? fg,\n cyan: palette.cyan ?? palette.blue ?? fg,\n orange: palette.orange ?? palette.yellow ?? fg,\n teal: palette.teal ?? palette.cyan ?? fg,\n selected: palette.darkBlue ?? palette.blue ?? fg,\n },\n });\n}\n"],"mappings":"+CAaA,SAAS,EAAS,EAAkD,CAClE,OAAO,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,CAAK,CAC5E,CAEA,SAAS,EAAa,EAA4B,CAChD,IAAM,EAAQ,oBAAoB,KAAK,EAAI,KAAK,CAAC,EACjD,GAAI,CAAC,EAAO,OAAO,KACnB,IAAM,EAAQ,OAAO,SAAS,EAAM,GAAI,EAAE,EACpC,EAAK,GAAS,GAAM,IACpB,EAAK,GAAS,EAAK,IACnB,EAAI,EAAQ,IAClB,OAAQ,MAAS,EAAI,MAAS,EAAI,MAAS,GAAK,GAClD,CAGA,SAAS,EAAQ,EAA8B,EAAmD,CAC5F,OAAc,IAAA,GAClB,OAAO,EAAK,IAAc,CAC5B,CAiBA,SAAgB,EAAiB,EAAgB,EAAgC,CAAC,EAAuB,CACvG,GAAI,CAAC,EAAS,CAAK,EAAG,OAAO,KAC7B,GAAM,CAAE,OAAM,OAAM,UAAW,EAC/B,GAAI,CAAC,EAAS,CAAI,EAAG,OAAO,KAC5B,IAAM,EAAkC,CAAC,EACzC,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,CAAI,EAAO,OAAO,GAAU,WAAU,EAAQ,GAAO,GAC/F,IAAM,EAAmC,CAAC,EAC1C,GAAI,EAAS,CAAM,EACZ,IAAA,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,CAAM,EAAO,OAAO,GAAU,WAAU,EAAS,GAAO,GAEpG,IAAM,EAAK,EAAQ,GACb,EAAQ,EAAQ,OAAS,EACzB,EAAK,EAAQ,GACnB,GAAI,IAAO,IAAA,IAAa,IAAO,IAAA,GAAW,OAAO,KAEjD,IAAM,EAAY,EAAa,CAAE,EAC3B,EAAsB,EAAQ,SAAW,IAAc,MAAQ,EAAY,GAAM,QAAU,QAE3F,EAAO,sBAAsB,EAAM,QADzB,IAAW,OAAS,QAAU,QACW,GACnD,EAAS,EAAQ,EAAS,EAAS,WAAW,GAAK,EAAQ,MAAQ,sBAAsB,EAAG,QAAQ,EAAG,GACvG,EAAY,EAAQ,OAAS,OAAO,GAAS,SAAW,EAAO,YAErE,OAAO,EAAiB,CACtB,KAAM,EACN,MAAO,EAAQ,OAAS,EACxB,SACA,OAAQ,CACN,KACA,KAAM,EACN,MAAO,sBAAsB,EAAM,QAAQ,EAAG,GAC9C,OACA,SACA,cAAe,sBAAsB,EAAO,QAAQ,EAAG,GACvD,GAAI,sBAAsB,EAAG,QAAQ,IAAW,OAAS,QAAU,QAAQ,GAC3E,KAAM,EACN,IAAK,EAAQ,EAAS,EAAS,KAAK,GAAK,EAAQ,OAAS,EAC1D,MAAO,EAAQ,EAAS,EAAS,GAAG,GAAK,EAAQ,SAAW,EAAQ,SAAW,EAC/E,KAAM,EAAQ,MAAQ,EAAQ,EAAS,EAAS,MAAM,GAAK,EAC3D,MAAO,EAAQ,OAAS,EAAQ,EAAS,EAAS,OAAO,GAAK,EAC9D,OAAQ,EAAQ,QAAU,EAAQ,EAAS,EAAS,OAAO,GAAK,EAChE,IAAK,EAAQ,KAAO,EAAQ,EAAS,EAAS,KAAK,GAAK,EACxD,QAAS,EAAQ,SAAW,EAAQ,QAAU,EAC9C,OAAQ,EAAQ,QAAU,EAAQ,SAAW,EAC7C,KAAM,EAAQ,MAAQ,EAAQ,MAAQ,EACtC,OAAQ,EAAQ,QAAU,EAAQ,QAAU,EAC5C,KAAM,EAAQ,MAAQ,EAAQ,MAAQ,EACtC,SAAU,EAAQ,UAAY,EAAQ,MAAQ,CAChD,CACF,CAAC,CACH"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=`doompi.web.theme`;function t(e){try{let t=e?.getItem(`doompi.web.theme`)??null;return t===null||t===``?null:t}catch{return null}}function n(t,n){try{n===null?t?.removeItem(e):t?.setItem(e,n)}catch{}}exports.THEME_STORAGE_KEY=e,exports.readThemePreference=t,exports.writeThemePreference=n;
|
|
2
|
+
//# sourceMappingURL=preference.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preference.cjs","names":[],"sources":["../../../src/theme/preference.ts"],"sourcesContent":["/** Where the page remembers the chosen theme; one key, machine-local. */\nexport const THEME_STORAGE_KEY = 'doompi.web.theme';\n\n/** The two Storage calls the preference needs, so tests pass a plain map. */\nexport interface PreferenceStorage {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\n/** The stored theme name, or null when nothing was chosen or storage is unavailable. */\nexport function readThemePreference(storage: PreferenceStorage | undefined): string | null {\n try {\n const value = storage?.getItem(THEME_STORAGE_KEY) ?? null;\n return value === null || value === '' ? null : value;\n } catch {\n return null;\n }\n}\n\n/** Remembers a theme name; null forgets it. Storage failures are swallowed: a theme is a convenience. */\nexport function writeThemePreference(storage: PreferenceStorage | undefined, name: string | null): void {\n try {\n if (name === null) storage?.removeItem(THEME_STORAGE_KEY);\n else storage?.setItem(THEME_STORAGE_KEY, name);\n } catch {\n // Private mode or a full quota: the theme still applies for this page load.\n }\n}\n"],"mappings":"AACA,MAAa,EAAoB,mBAUjC,SAAgB,EAAoB,EAAuD,CACzF,GAAI,CACF,IAAM,EAAQ,GAAS,QAAA,kBAAyB,GAAK,KACrD,OAAO,IAAU,MAAQ,IAAU,GAAK,KAAO,CACjD,MAAQ,CACN,OAAO,IACT,CACF,CAGA,SAAgB,EAAqB,EAAwC,EAA2B,CACtG,GAAI,CACE,IAAS,KAAM,GAAS,WAAW,CAAiB,EACnD,GAAS,QAAQ,EAAmB,CAAI,CAC/C,MAAQ,CAER,CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/theme/preference.d.ts
|
|
2
|
+
/** Where the page remembers the chosen theme; one key, machine-local. */
|
|
3
|
+
declare const THEME_STORAGE_KEY = "doompi.web.theme";
|
|
4
|
+
/** The two Storage calls the preference needs, so tests pass a plain map. */
|
|
5
|
+
interface PreferenceStorage {
|
|
6
|
+
getItem(key: string): string | null;
|
|
7
|
+
setItem(key: string, value: string): void;
|
|
8
|
+
removeItem(key: string): void;
|
|
9
|
+
}
|
|
10
|
+
/** The stored theme name, or null when nothing was chosen or storage is unavailable. */
|
|
11
|
+
declare function readThemePreference(storage: PreferenceStorage | undefined): string | null;
|
|
12
|
+
/** Remembers a theme name; null forgets it. Storage failures are swallowed: a theme is a convenience. */
|
|
13
|
+
declare function writeThemePreference(storage: PreferenceStorage | undefined, name: string | null): void;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { PreferenceStorage, THEME_STORAGE_KEY, readThemePreference, writeThemePreference };
|
|
16
|
+
//# sourceMappingURL=preference.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preference.d.mts","names":[],"sources":["../../../src/theme/preference.ts"],"mappings":";;cACa;;UAGI;EACf,QAAQ;EACR,QAAQ,aAAa;EACrB,WAAW;;;iBAIG,oBAAoB,SAAS;;iBAU7B,qBAAqB,SAAS,+BAA+B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=`doompi.web.theme`;function t(e){try{let t=e?.getItem(`doompi.web.theme`)??null;return t===null||t===``?null:t}catch{return null}}function n(t,n){try{n===null?t?.removeItem(e):t?.setItem(e,n)}catch{}}export{e as THEME_STORAGE_KEY,t as readThemePreference,n as writeThemePreference};
|
|
2
|
+
//# sourceMappingURL=preference.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preference.mjs","names":[],"sources":["../../../src/theme/preference.ts"],"sourcesContent":["/** Where the page remembers the chosen theme; one key, machine-local. */\nexport const THEME_STORAGE_KEY = 'doompi.web.theme';\n\n/** The two Storage calls the preference needs, so tests pass a plain map. */\nexport interface PreferenceStorage {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\n/** The stored theme name, or null when nothing was chosen or storage is unavailable. */\nexport function readThemePreference(storage: PreferenceStorage | undefined): string | null {\n try {\n const value = storage?.getItem(THEME_STORAGE_KEY) ?? null;\n return value === null || value === '' ? null : value;\n } catch {\n return null;\n }\n}\n\n/** Remembers a theme name; null forgets it. Storage failures are swallowed: a theme is a convenience. */\nexport function writeThemePreference(storage: PreferenceStorage | undefined, name: string | null): void {\n try {\n if (name === null) storage?.removeItem(THEME_STORAGE_KEY);\n else storage?.setItem(THEME_STORAGE_KEY, name);\n } catch {\n // Private mode or a full quota: the theme still applies for this page load.\n }\n}\n"],"mappings":"AACA,MAAa,EAAoB,mBAUjC,SAAgB,EAAoB,EAAuD,CACzF,GAAI,CACF,IAAM,EAAQ,GAAS,QAAA,kBAAyB,GAAK,KACrD,OAAO,IAAU,MAAQ,IAAU,GAAK,KAAO,CACjD,MAAQ,CACN,OAAO,IACT,CACF,CAGA,SAAgB,EAAqB,EAAwC,EAA2B,CACtG,GAAI,CACE,IAAS,KAAM,GAAS,WAAW,CAAiB,EACnD,GAAS,QAAQ,EAAmB,CAAI,CAC/C,MAAQ,CAER,CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=[`bg`,`rail`,`panel`,`deep`,`border`,`border-soft`,`hi`,`text`,`dim`,`faint`,`blue`,`green`,`yellow`,`red`,`magenta`,`violet`,`cyan`,`orange`,`teal`,`selected`],t=[`blue`,`green`,`yellow`,`red`,`magenta`,`violet`,`cyan`,`orange`,`teal`],n=[`tint-blue`,`tint-green`,`tint-yellow`,`tint-red`,`tint-magenta`,`tint-violet`,`tint-cyan`,`tint-orange`,`tint-teal`,`edge-blue`,`edge-green`,`edge-yellow`,`edge-red`,`edge-magenta`,`edge-violet`,`edge-cyan`,`edge-orange`,`edge-teal`,`on-selected`,`font-mono`],r=[...e,...n];function i(e){return`--doom-${e}`}exports.ACCENT_TOKENS=t,exports.DERIVED_TOKENS=n,exports.PALETTE_TOKENS=e,exports.THEME_TOKENS=r,exports.themeVariable=i;
|
|
2
|
+
//# sourceMappingURL=theme.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.cjs","names":[],"sources":["../../../src/types/theme.ts"],"sourcesContent":["/**\n * The web theme contract: the named colours every cockpit surface is built\n * from. Palette tokens are the hand-picked values a theme must supply; the\n * derived tokens (tinted backgrounds, accented borders) are computed from the\n * palette unless a theme pins them, which is how the shipped dark theme keeps\n * its exact mockup values while a third-party theme needs only the palette.\n */\nexport const PALETTE_TOKENS = [\n 'bg',\n 'rail',\n 'panel',\n 'deep',\n 'border',\n 'border-soft',\n 'hi',\n 'text',\n 'dim',\n 'faint',\n 'blue',\n 'green',\n 'yellow',\n 'red',\n 'magenta',\n 'violet',\n 'cyan',\n 'orange',\n 'teal',\n 'selected',\n] as const;\n\nexport const ACCENT_TOKENS = ['blue', 'green', 'yellow', 'red', 'magenta', 'violet', 'cyan', 'orange', 'teal'] as const;\n\nexport const DERIVED_TOKENS = [\n 'tint-blue',\n 'tint-green',\n 'tint-yellow',\n 'tint-red',\n 'tint-magenta',\n 'tint-violet',\n 'tint-cyan',\n 'tint-orange',\n 'tint-teal',\n 'edge-blue',\n 'edge-green',\n 'edge-yellow',\n 'edge-red',\n 'edge-magenta',\n 'edge-violet',\n 'edge-cyan',\n 'edge-orange',\n 'edge-teal',\n /**\n * The readable foreground on the `selected` surface. Derived so an existing\n * theme stays valid, but a theme whose `selected` is pale must pin it: CSS\n * cannot pick a contrasting colour on its own, and the fallback assumes a\n * saturated selection, which is what both shipped themes use.\n */\n 'on-selected',\n 'font-mono',\n] as const;\n\nexport const THEME_TOKENS = [...PALETTE_TOKENS, ...DERIVED_TOKENS] as const;\n\nexport type PaletteToken = (typeof PALETTE_TOKENS)[number];\nexport type AccentToken = (typeof ACCENT_TOKENS)[number];\nexport type DerivedToken = (typeof DERIVED_TOKENS)[number];\nexport type ThemeToken = (typeof THEME_TOKENS)[number];\n\nexport type ThemeScheme = 'dark' | 'light';\n\n/** A theme config as written in JSON: identity, colour scheme, and the token values. */\nexport interface ThemeConfig {\n /** Stable id, kebab-case; the `data-theme` attribute and the stored preference. */\n name: string;\n /** What a picker shows. */\n label: string;\n /** Drives `color-scheme` so native controls and scrollbars match. */\n scheme: ThemeScheme;\n tokens: Record<PaletteToken, string> & Partial<Record<DerivedToken, string>>;\n}\n\n/** The CSS custom property a token is published as. */\nexport function themeVariable(token: ThemeToken): `--doom-${ThemeToken}` {\n return `--doom-${token}`;\n}\n"],"mappings":"AAOA,MAAa,EAAiB,CAC5B,KACA,OACA,QACA,OACA,SACA,cACA,KACA,OACA,MACA,QACA,OACA,QACA,SACA,MACA,UACA,SACA,OACA,SACA,OACA,UACF,EAEa,EAAgB,CAAC,OAAQ,QAAS,SAAU,MAAO,UAAW,SAAU,OAAQ,SAAU,MAAM,EAEhG,EAAiB,CAC5B,YACA,aACA,cACA,WACA,eACA,cACA,YACA,cACA,YACA,YACA,aACA,cACA,WACA,eACA,cACA,YACA,cACA,YAOA,cACA,WACF,EAEa,EAAe,CAAC,GAAG,EAAgB,GAAG,CAAc,EAqBjE,SAAgB,EAAc,EAA2C,CACvE,MAAO,UAAU,GACnB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/types/theme.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The web theme contract: the named colours every cockpit surface is built
|
|
4
|
+
* from. Palette tokens are the hand-picked values a theme must supply; the
|
|
5
|
+
* derived tokens (tinted backgrounds, accented borders) are computed from the
|
|
6
|
+
* palette unless a theme pins them, which is how the shipped dark theme keeps
|
|
7
|
+
* its exact mockup values while a third-party theme needs only the palette.
|
|
8
|
+
*/
|
|
9
|
+
declare const PALETTE_TOKENS: readonly ['bg', 'rail', 'panel', 'deep', 'border', 'border-soft', 'hi', 'text', 'dim', 'faint', 'blue', 'green', 'yellow', 'red', 'magenta', 'violet', 'cyan', 'orange', 'teal', 'selected'];
|
|
10
|
+
declare const ACCENT_TOKENS: readonly ['blue', 'green', 'yellow', 'red', 'magenta', 'violet', 'cyan', 'orange', 'teal'];
|
|
11
|
+
declare const DERIVED_TOKENS: readonly ['tint-blue', 'tint-green', 'tint-yellow', 'tint-red', 'tint-magenta', 'tint-violet', 'tint-cyan', 'tint-orange', 'tint-teal', 'edge-blue', 'edge-green', 'edge-yellow', 'edge-red', 'edge-magenta', 'edge-violet', 'edge-cyan', 'edge-orange', 'edge-teal',
|
|
12
|
+
/**
|
|
13
|
+
* The readable foreground on the `selected` surface. Derived so an existing
|
|
14
|
+
* theme stays valid, but a theme whose `selected` is pale must pin it: CSS
|
|
15
|
+
* cannot pick a contrasting colour on its own, and the fallback assumes a
|
|
16
|
+
* saturated selection, which is what both shipped themes use.
|
|
17
|
+
*/
|
|
18
|
+
'on-selected', 'font-mono'];
|
|
19
|
+
declare const THEME_TOKENS: readonly ["bg", "rail", "panel", "deep", "border", "border-soft", "hi", "text", "dim", "faint", "blue", "green", "yellow", "red", "magenta", "violet", "cyan", "orange", "teal", "selected", "tint-blue", "tint-green", "tint-yellow", "tint-red", "tint-magenta", "tint-violet", "tint-cyan", "tint-orange", "tint-teal", "edge-blue", "edge-green", "edge-yellow", "edge-red", "edge-magenta", "edge-violet", "edge-cyan", "edge-orange", "edge-teal", "on-selected", "font-mono"];
|
|
20
|
+
type PaletteToken = (typeof PALETTE_TOKENS)[number];
|
|
21
|
+
type AccentToken = (typeof ACCENT_TOKENS)[number];
|
|
22
|
+
type DerivedToken = (typeof DERIVED_TOKENS)[number];
|
|
23
|
+
type ThemeToken = (typeof THEME_TOKENS)[number];
|
|
24
|
+
type ThemeScheme = 'dark' | 'light';
|
|
25
|
+
/** A theme config as written in JSON: identity, colour scheme, and the token values. */
|
|
26
|
+
interface ThemeConfig {
|
|
27
|
+
/** Stable id, kebab-case; the `data-theme` attribute and the stored preference. */
|
|
28
|
+
name: string;
|
|
29
|
+
/** What a picker shows. */
|
|
30
|
+
label: string;
|
|
31
|
+
/** Drives `color-scheme` so native controls and scrollbars match. */
|
|
32
|
+
scheme: ThemeScheme;
|
|
33
|
+
tokens: Record<PaletteToken, string> & Partial<Record<DerivedToken, string>>;
|
|
34
|
+
}
|
|
35
|
+
/** The CSS custom property a token is published as. */
|
|
36
|
+
declare function themeVariable(token: ThemeToken): `--doom-${ThemeToken}`;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ACCENT_TOKENS, AccentToken, DERIVED_TOKENS, DerivedToken, PALETTE_TOKENS, PaletteToken, THEME_TOKENS, ThemeConfig, ThemeScheme, ThemeToken, themeVariable };
|
|
39
|
+
//# sourceMappingURL=theme.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.mts","names":[],"sources":["../../../src/types/theme.ts"],"mappings":";;;;;;;;cAOa;cAuBA;cAEA;;;;;;;;cA6BA;KAED,uBAAuB;KACvB,sBAAsB;KACtB,uBAAuB;KACvB,qBAAqB;KAErB;;UAGK;;EAEf;;EAEA;;EAEA,QAAQ;EACR,QAAQ,OAAO,wBAAwB,QAAQ,OAAO;;;iBAIxC,cAAc,OAAO,uBAAuB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=[`bg`,`rail`,`panel`,`deep`,`border`,`border-soft`,`hi`,`text`,`dim`,`faint`,`blue`,`green`,`yellow`,`red`,`magenta`,`violet`,`cyan`,`orange`,`teal`,`selected`],t=[`blue`,`green`,`yellow`,`red`,`magenta`,`violet`,`cyan`,`orange`,`teal`],n=[`tint-blue`,`tint-green`,`tint-yellow`,`tint-red`,`tint-magenta`,`tint-violet`,`tint-cyan`,`tint-orange`,`tint-teal`,`edge-blue`,`edge-green`,`edge-yellow`,`edge-red`,`edge-magenta`,`edge-violet`,`edge-cyan`,`edge-orange`,`edge-teal`,`on-selected`,`font-mono`],r=[...e,...n];function i(e){return`--doom-${e}`}export{t as ACCENT_TOKENS,n as DERIVED_TOKENS,e as PALETTE_TOKENS,r as THEME_TOKENS,i as themeVariable};
|
|
2
|
+
//# sourceMappingURL=theme.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.mjs","names":[],"sources":["../../../src/types/theme.ts"],"sourcesContent":["/**\n * The web theme contract: the named colours every cockpit surface is built\n * from. Palette tokens are the hand-picked values a theme must supply; the\n * derived tokens (tinted backgrounds, accented borders) are computed from the\n * palette unless a theme pins them, which is how the shipped dark theme keeps\n * its exact mockup values while a third-party theme needs only the palette.\n */\nexport const PALETTE_TOKENS = [\n 'bg',\n 'rail',\n 'panel',\n 'deep',\n 'border',\n 'border-soft',\n 'hi',\n 'text',\n 'dim',\n 'faint',\n 'blue',\n 'green',\n 'yellow',\n 'red',\n 'magenta',\n 'violet',\n 'cyan',\n 'orange',\n 'teal',\n 'selected',\n] as const;\n\nexport const ACCENT_TOKENS = ['blue', 'green', 'yellow', 'red', 'magenta', 'violet', 'cyan', 'orange', 'teal'] as const;\n\nexport const DERIVED_TOKENS = [\n 'tint-blue',\n 'tint-green',\n 'tint-yellow',\n 'tint-red',\n 'tint-magenta',\n 'tint-violet',\n 'tint-cyan',\n 'tint-orange',\n 'tint-teal',\n 'edge-blue',\n 'edge-green',\n 'edge-yellow',\n 'edge-red',\n 'edge-magenta',\n 'edge-violet',\n 'edge-cyan',\n 'edge-orange',\n 'edge-teal',\n /**\n * The readable foreground on the `selected` surface. Derived so an existing\n * theme stays valid, but a theme whose `selected` is pale must pin it: CSS\n * cannot pick a contrasting colour on its own, and the fallback assumes a\n * saturated selection, which is what both shipped themes use.\n */\n 'on-selected',\n 'font-mono',\n] as const;\n\nexport const THEME_TOKENS = [...PALETTE_TOKENS, ...DERIVED_TOKENS] as const;\n\nexport type PaletteToken = (typeof PALETTE_TOKENS)[number];\nexport type AccentToken = (typeof ACCENT_TOKENS)[number];\nexport type DerivedToken = (typeof DERIVED_TOKENS)[number];\nexport type ThemeToken = (typeof THEME_TOKENS)[number];\n\nexport type ThemeScheme = 'dark' | 'light';\n\n/** A theme config as written in JSON: identity, colour scheme, and the token values. */\nexport interface ThemeConfig {\n /** Stable id, kebab-case; the `data-theme` attribute and the stored preference. */\n name: string;\n /** What a picker shows. */\n label: string;\n /** Drives `color-scheme` so native controls and scrollbars match. */\n scheme: ThemeScheme;\n tokens: Record<PaletteToken, string> & Partial<Record<DerivedToken, string>>;\n}\n\n/** The CSS custom property a token is published as. */\nexport function themeVariable(token: ThemeToken): `--doom-${ThemeToken}` {\n return `--doom-${token}`;\n}\n"],"mappings":"AAOA,MAAa,EAAiB,CAC5B,KACA,OACA,QACA,OACA,SACA,cACA,KACA,OACA,MACA,QACA,OACA,QACA,SACA,MACA,UACA,SACA,OACA,SACA,OACA,UACF,EAEa,EAAgB,CAAC,OAAQ,QAAS,SAAU,MAAO,UAAW,SAAU,OAAQ,SAAU,MAAM,EAEhG,EAAiB,CAC5B,YACA,aACA,cACA,WACA,eACA,cACA,YACA,cACA,YACA,YACA,aACA,cACA,WACA,eACA,cACA,YACA,cACA,YAOA,cACA,WACF,EAEa,EAAe,CAAC,GAAG,EAAgB,GAAG,CAAc,EAqBjE,SAAgB,EAAc,EAA2C,CACvE,MAAO,UAAU,GACnB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=[`blue`,`green`,`yellow`,`red`,`magenta`,`violet`,`cyan`,`orange`,`teal`],t=[`neutral`,...e],n=[`neutral`,`muted`,...e],r=[`neutral`,`running`,`ok`,`error`,`info`,`accent`],i=[`hi`,`text`,`dim`,`muted`,`success`,`error`,`warning`,`accent`];exports.ACCENT_TONES=e,exports.CHIP_TONES=t,exports.DOT_TONES=n,exports.MESSAGE_LINE_TONES=i,exports.STATUS_TONES=r;
|
|
2
|
+
//# sourceMappingURL=tone.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tone.cjs","names":[],"sources":["../../../src/types/tone.ts"],"sourcesContent":["/**\n * The tone vocabularies every surface shares.\n *\n * Three of them exist because they answer different questions. A chromatic\n * tone names a colour (\"this chip is violet\"), a status tone names an outcome\n * (\"this run failed\"), and a line tone names a role inside a body of text.\n * They live here, not beside the components that draw them, so a consumer can\n * translate between them without importing a component, and so adding a tone\n * to one table without the others fails to compile.\n */\n\n/** The accents a theme supplies; mirrors ACCENT_TOKENS in ./theme.ts. */\nexport const ACCENT_TONES = ['blue', 'green', 'yellow', 'red', 'magenta', 'violet', 'cyan', 'orange', 'teal'] as const;\nexport type AccentTone = (typeof ACCENT_TONES)[number];\n\n/** What a chip may be: an accent, or the quiet default. */\nexport const CHIP_TONES = ['neutral', ...ACCENT_TONES] as const;\nexport type ChipTone = (typeof CHIP_TONES)[number];\n\n/** A dot adds `muted` for a thing that exists but is not live. */\nexport const DOT_TONES = ['neutral', 'muted', ...ACCENT_TONES] as const;\nexport type DotTone = (typeof DOT_TONES)[number];\n\n/** What happened, rather than what colour it is. */\nexport const STATUS_TONES = ['neutral', 'running', 'ok', 'error', 'info', 'accent'] as const;\nexport type StatusTone = (typeof STATUS_TONES)[number];\n\n/** The role a single line of a message body plays. */\nexport const MESSAGE_LINE_TONES = ['hi', 'text', 'dim', 'muted', 'success', 'error', 'warning', 'accent'] as const;\nexport type MessageLineTone = (typeof MESSAGE_LINE_TONES)[number];\n"],"mappings":"AAYA,MAAa,EAAe,CAAC,OAAQ,QAAS,SAAU,MAAO,UAAW,SAAU,OAAQ,SAAU,MAAM,EAI/F,EAAa,CAAC,UAAW,GAAG,CAAY,EAIxC,EAAY,CAAC,UAAW,QAAS,GAAG,CAAY,EAIhD,EAAe,CAAC,UAAW,UAAW,KAAM,QAAS,OAAQ,QAAQ,EAIrE,EAAqB,CAAC,KAAM,OAAQ,MAAO,QAAS,UAAW,QAAS,UAAW,QAAQ"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/types/tone.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The tone vocabularies every surface shares.
|
|
4
|
+
*
|
|
5
|
+
* Three of them exist because they answer different questions. A chromatic
|
|
6
|
+
* tone names a colour ("this chip is violet"), a status tone names an outcome
|
|
7
|
+
* ("this run failed"), and a line tone names a role inside a body of text.
|
|
8
|
+
* They live here, not beside the components that draw them, so a consumer can
|
|
9
|
+
* translate between them without importing a component, and so adding a tone
|
|
10
|
+
* to one table without the others fails to compile.
|
|
11
|
+
*/
|
|
12
|
+
/** The accents a theme supplies; mirrors ACCENT_TOKENS in ./theme.ts. */
|
|
13
|
+
declare const ACCENT_TONES: readonly ['blue', 'green', 'yellow', 'red', 'magenta', 'violet', 'cyan', 'orange', 'teal'];
|
|
14
|
+
type AccentTone = (typeof ACCENT_TONES)[number];
|
|
15
|
+
/** What a chip may be: an accent, or the quiet default. */
|
|
16
|
+
declare const CHIP_TONES: readonly ["neutral", "blue", "green", "yellow", "red", "magenta", "violet", "cyan", "orange", "teal"];
|
|
17
|
+
type ChipTone = (typeof CHIP_TONES)[number];
|
|
18
|
+
/** A dot adds `muted` for a thing that exists but is not live. */
|
|
19
|
+
declare const DOT_TONES: readonly ["neutral", "muted", "blue", "green", "yellow", "red", "magenta", "violet", "cyan", "orange", "teal"];
|
|
20
|
+
type DotTone = (typeof DOT_TONES)[number];
|
|
21
|
+
/** What happened, rather than what colour it is. */
|
|
22
|
+
declare const STATUS_TONES: readonly ['neutral', 'running', 'ok', 'error', 'info', 'accent'];
|
|
23
|
+
type StatusTone = (typeof STATUS_TONES)[number];
|
|
24
|
+
/** The role a single line of a message body plays. */
|
|
25
|
+
declare const MESSAGE_LINE_TONES: readonly ['hi', 'text', 'dim', 'muted', 'success', 'error', 'warning', 'accent'];
|
|
26
|
+
type MessageLineTone = (typeof MESSAGE_LINE_TONES)[number];
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ACCENT_TONES, AccentTone, CHIP_TONES, ChipTone, DOT_TONES, DotTone, MESSAGE_LINE_TONES, MessageLineTone, STATUS_TONES, StatusTone };
|
|
29
|
+
//# sourceMappingURL=tone.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tone.d.mts","names":[],"sources":["../../../src/types/tone.ts"],"mappings":";;;;;;;;;;;;cAYa;KACD,qBAAqB;;cAGpB;KACD,mBAAmB;;cAGlB;KACD,kBAAkB;;cAGjB;KACD,qBAAqB;;cAGpB;KACD,0BAA0B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=[`blue`,`green`,`yellow`,`red`,`magenta`,`violet`,`cyan`,`orange`,`teal`],t=[`neutral`,...e],n=[`neutral`,`muted`,...e],r=[`neutral`,`running`,`ok`,`error`,`info`,`accent`],i=[`hi`,`text`,`dim`,`muted`,`success`,`error`,`warning`,`accent`];export{e as ACCENT_TONES,t as CHIP_TONES,n as DOT_TONES,i as MESSAGE_LINE_TONES,r as STATUS_TONES};
|
|
2
|
+
//# sourceMappingURL=tone.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tone.mjs","names":[],"sources":["../../../src/types/tone.ts"],"sourcesContent":["/**\n * The tone vocabularies every surface shares.\n *\n * Three of them exist because they answer different questions. A chromatic\n * tone names a colour (\"this chip is violet\"), a status tone names an outcome\n * (\"this run failed\"), and a line tone names a role inside a body of text.\n * They live here, not beside the components that draw them, so a consumer can\n * translate between them without importing a component, and so adding a tone\n * to one table without the others fails to compile.\n */\n\n/** The accents a theme supplies; mirrors ACCENT_TOKENS in ./theme.ts. */\nexport const ACCENT_TONES = ['blue', 'green', 'yellow', 'red', 'magenta', 'violet', 'cyan', 'orange', 'teal'] as const;\nexport type AccentTone = (typeof ACCENT_TONES)[number];\n\n/** What a chip may be: an accent, or the quiet default. */\nexport const CHIP_TONES = ['neutral', ...ACCENT_TONES] as const;\nexport type ChipTone = (typeof CHIP_TONES)[number];\n\n/** A dot adds `muted` for a thing that exists but is not live. */\nexport const DOT_TONES = ['neutral', 'muted', ...ACCENT_TONES] as const;\nexport type DotTone = (typeof DOT_TONES)[number];\n\n/** What happened, rather than what colour it is. */\nexport const STATUS_TONES = ['neutral', 'running', 'ok', 'error', 'info', 'accent'] as const;\nexport type StatusTone = (typeof STATUS_TONES)[number];\n\n/** The role a single line of a message body plays. */\nexport const MESSAGE_LINE_TONES = ['hi', 'text', 'dim', 'muted', 'success', 'error', 'warning', 'accent'] as const;\nexport type MessageLineTone = (typeof MESSAGE_LINE_TONES)[number];\n"],"mappings":"AAYA,MAAa,EAAe,CAAC,OAAQ,QAAS,SAAU,MAAO,UAAW,SAAU,OAAQ,SAAU,MAAM,EAI/F,EAAa,CAAC,UAAW,GAAG,CAAY,EAIxC,EAAY,CAAC,UAAW,QAAS,GAAG,CAAY,EAIhD,EAAe,CAAC,UAAW,UAAW,KAAM,QAAS,OAAQ,QAAQ,EAIrE,EAAqB,CAAC,KAAM,OAAQ,MAAO,QAAS,UAAW,QAAS,UAAW,QAAQ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ThemeConfig } from "../types/theme.cjs";
|
|
2
|
+
//#region src/theme/apply.d.ts
|
|
3
|
+
/** The attribute the active theme's name is stamped on, for CSS that keys off a theme. */
|
|
4
|
+
declare const THEME_ATTRIBUTE = "data-theme";
|
|
5
|
+
/** Every custom property a theme publishes, keyed by property name. */
|
|
6
|
+
declare function themeCssVariables(theme: ThemeConfig): Record<string, string>;
|
|
7
|
+
/** The theme as a stylesheet rule, for a server that wants to inline it. */
|
|
8
|
+
declare function themeCssText(theme: ThemeConfig, selector?: string): string;
|
|
9
|
+
/** The subset of an element the theme touches, so tests can pass a plain object. */
|
|
10
|
+
interface ThemeRoot {
|
|
11
|
+
style: {
|
|
12
|
+
setProperty(name: string, value: string): void;
|
|
13
|
+
colorScheme: string;
|
|
14
|
+
};
|
|
15
|
+
setAttribute(name: string, value: string): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Applies a theme to the page: every token becomes a custom property on the
|
|
19
|
+
* root, the colour scheme follows, and the theme name is stamped so a style
|
|
20
|
+
* may key off it. Idempotent and synchronous, so calling it before the first
|
|
21
|
+
* render avoids a flash of the default theme.
|
|
22
|
+
*/
|
|
23
|
+
declare function applyTheme(theme: ThemeConfig, root: ThemeRoot): void;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { THEME_ATTRIBUTE, ThemeRoot, applyTheme, themeCssText, themeCssVariables };
|
|
26
|
+
//# sourceMappingURL=apply.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.cts","names":[],"sources":["../../src/theme/apply.ts"],"mappings":";;;cAIa;;iBAGG,kBAAkB,OAAO,cAAc;;iBAQvC,aAAa,OAAO,aAAa;;UAMhC;EACf;IAAS,YAAY,cAAc;IAAsB;;EACzD,aAAa,cAAc;;;;;;;;iBASb,WAAW,OAAO,aAAa,MAAM"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ThemeConfig } from "../types/theme.cjs";
|
|
2
|
+
//#region src/theme/builtinThemes.d.ts
|
|
3
|
+
/** The theme the cockpit renders with until a preference says otherwise. */
|
|
4
|
+
declare const DEFAULT_THEME_NAME = "doom-one-dark";
|
|
5
|
+
/** The themes this package ships, default first. */
|
|
6
|
+
declare const BUILTIN_THEMES: readonly ThemeConfig[];
|
|
7
|
+
declare const DEFAULT_THEME: ThemeConfig;
|
|
8
|
+
/** A shipped theme by name, or undefined for a name nothing shipped under. */
|
|
9
|
+
declare function builtinTheme(name: string): ThemeConfig | undefined;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { BUILTIN_THEMES, DEFAULT_THEME, DEFAULT_THEME_NAME, builtinTheme };
|
|
12
|
+
//# sourceMappingURL=builtinThemes.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtinThemes.d.cts","names":[],"sources":["../../src/theme/builtinThemes.ts"],"mappings":";;;cAaa;;cAGA,yBAAyB;cAMzB,eAAe;;iBAGZ,aAAa,eAAe"}
|