@bridgebrew/ui 0.0.0-stage → 0.1.10-next.79
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 +21 -0
- package/README.md +39 -2
- package/SOURCE.md +182 -0
- package/dist/build.js +871 -0
- package/dist/theme-css.js +896 -0
- package/dist/themes.js +69 -0
- package/dist/types/build/stylesheet.d.ts +31 -0
- package/dist/types/components/composite/command/command.d.ts +94 -0
- package/dist/types/components/composite/command/index.d.ts +2 -0
- package/dist/types/components/composite/draft-bar/draft-bar.d.ts +12 -0
- package/dist/types/components/composite/draft-bar/index.d.ts +2 -0
- package/dist/types/components/composite/image-field/image-field.d.ts +33 -0
- package/dist/types/components/composite/image-field/index.d.ts +2 -0
- package/dist/types/components/composite/list/index.d.ts +3 -0
- package/dist/types/components/composite/list/list-swipe.d.ts +28 -0
- package/dist/types/components/composite/list/list.d.ts +95 -0
- package/dist/types/components/composite/picker/index.d.ts +2 -0
- package/dist/types/components/composite/picker/picker.d.ts +44 -0
- package/dist/types/components/composite/prompt-field/index.d.ts +2 -0
- package/dist/types/components/composite/prompt-field/prompt-field.d.ts +18 -0
- package/dist/types/components/composite/properties/index.d.ts +2 -0
- package/dist/types/components/composite/properties/properties.d.ts +24 -0
- package/dist/types/components/composite/snooze-menu/index.d.ts +4 -0
- package/dist/types/components/composite/snooze-menu/presets.d.ts +36 -0
- package/dist/types/components/composite/snooze-menu/snooze-menu.d.ts +27 -0
- package/dist/types/components/composite/tag-input/index.d.ts +2 -0
- package/dist/types/components/composite/tag-input/tag-input.d.ts +22 -0
- package/dist/types/components/composite/wizard/index.d.ts +2 -0
- package/dist/types/components/composite/wizard/wizard.d.ts +53 -0
- package/dist/types/components/core/avatar/avatar.d.ts +16 -0
- package/dist/types/components/core/avatar/index.d.ts +2 -0
- package/dist/types/components/core/badge/badge.d.ts +8 -0
- package/dist/types/components/core/badge/index.d.ts +2 -0
- package/dist/types/components/core/breadcrumb/breadcrumb.d.ts +21 -0
- package/dist/types/components/core/breadcrumb/index.d.ts +2 -0
- package/dist/types/components/core/bullets/bullets.d.ts +15 -0
- package/dist/types/components/core/bullets/index.d.ts +2 -0
- package/dist/types/components/core/button/button.d.ts +14 -0
- package/dist/types/components/core/button/index.d.ts +2 -0
- package/dist/types/components/core/card/card.d.ts +16 -0
- package/dist/types/components/core/card/index.d.ts +2 -0
- package/dist/types/components/core/checkbox/checkbox.d.ts +15 -0
- package/dist/types/components/core/checkbox/index.d.ts +2 -0
- package/dist/types/components/core/cluster/cluster.d.ts +5 -0
- package/dist/types/components/core/cluster/index.d.ts +1 -0
- package/dist/types/components/core/code-block/code-block.d.ts +18 -0
- package/dist/types/components/core/code-block/index.d.ts +2 -0
- package/dist/types/components/core/collapsible/collapsible.d.ts +8 -0
- package/dist/types/components/core/collapsible/index.d.ts +1 -0
- package/dist/types/components/core/colour-picker/colour-picker.d.ts +25 -0
- package/dist/types/components/core/colour-picker/index.d.ts +4 -0
- package/dist/types/components/core/combobox/combobox.d.ts +63 -0
- package/dist/types/components/core/combobox/index.d.ts +2 -0
- package/dist/types/components/core/detail/detail.d.ts +12 -0
- package/dist/types/components/core/detail/index.d.ts +1 -0
- package/dist/types/components/core/dialog/dialog.d.ts +43 -0
- package/dist/types/components/core/dialog/drag.d.ts +4 -0
- package/dist/types/components/core/dialog/index.d.ts +2 -0
- package/dist/types/components/core/drop-zone/drop-zone.d.ts +23 -0
- package/dist/types/components/core/drop-zone/index.d.ts +2 -0
- package/dist/types/components/core/dropdown-menu/dropdown-menu.d.ts +78 -0
- package/dist/types/components/core/dropdown-menu/index.d.ts +2 -0
- package/dist/types/components/core/editable-field/editable-field.d.ts +42 -0
- package/dist/types/components/core/editable-field/index.d.ts +2 -0
- package/dist/types/components/core/empty-state/empty-state.d.ts +11 -0
- package/dist/types/components/core/empty-state/index.d.ts +2 -0
- package/dist/types/components/core/field/field.d.ts +31 -0
- package/dist/types/components/core/field/index.d.ts +2 -0
- package/dist/types/components/core/icon/icon-sets.d.ts +38 -0
- package/dist/types/components/core/icon/icon.d.ts +14 -0
- package/dist/types/components/core/icon/index.d.ts +2 -0
- package/dist/types/components/core/input/index.d.ts +4 -0
- package/dist/types/components/core/input/input.d.ts +22 -0
- package/dist/types/components/core/input/textarea.d.ts +8 -0
- package/dist/types/components/core/kbd/index.d.ts +2 -0
- package/dist/types/components/core/kbd/kbd.d.ts +7 -0
- package/dist/types/components/core/label/index.d.ts +2 -0
- package/dist/types/components/core/label/label.d.ts +13 -0
- package/dist/types/components/core/main-content/index.d.ts +2 -0
- package/dist/types/components/core/main-content/main-content.d.ts +18 -0
- package/dist/types/components/core/pane/index.d.ts +1 -0
- package/dist/types/components/core/pane/pane.d.ts +12 -0
- package/dist/types/components/core/pick-menu/index.d.ts +4 -0
- package/dist/types/components/core/pick-menu/pick-menu.d.ts +57 -0
- package/dist/types/components/core/pick-menu/tag-menu.d.ts +19 -0
- package/dist/types/components/core/popover/index.d.ts +2 -0
- package/dist/types/components/core/popover/popover.d.ts +22 -0
- package/dist/types/components/core/progress/index.d.ts +2 -0
- package/dist/types/components/core/progress/progress.d.ts +13 -0
- package/dist/types/components/core/resizable/index.d.ts +2 -0
- package/dist/types/components/core/resizable/resizable.d.ts +15 -0
- package/dist/types/components/core/resizable/use-remembered-layout.d.ts +31 -0
- package/dist/types/components/core/screen-link/index.d.ts +2 -0
- package/dist/types/components/core/screen-link/screen-link.d.ts +52 -0
- package/dist/types/components/core/scroll-area/index.d.ts +2 -0
- package/dist/types/components/core/scroll-area/scroll-area.d.ts +13 -0
- package/dist/types/components/core/scroll-area/steps.d.ts +5 -0
- package/dist/types/components/core/section/index.d.ts +2 -0
- package/dist/types/components/core/section/section.d.ts +16 -0
- package/dist/types/components/core/segment-group/index.d.ts +2 -0
- package/dist/types/components/core/segment-group/segment-group.d.ts +24 -0
- package/dist/types/components/core/select/index.d.ts +2 -0
- package/dist/types/components/core/select/select.d.ts +39 -0
- package/dist/types/components/core/skeleton/index.d.ts +2 -0
- package/dist/types/components/core/skeleton/skeleton.d.ts +13 -0
- package/dist/types/components/core/slider/index.d.ts +2 -0
- package/dist/types/components/core/slider/slider.d.ts +9 -0
- package/dist/types/components/core/sortable/index.d.ts +2 -0
- package/dist/types/components/core/sortable/sortable.d.ts +53 -0
- package/dist/types/components/core/split-view/index.d.ts +2 -0
- package/dist/types/components/core/split-view/split-view.d.ts +28 -0
- package/dist/types/components/core/status-icon/index.d.ts +2 -0
- package/dist/types/components/core/status-icon/status-icon.d.ts +13 -0
- package/dist/types/components/core/table/collapsible-rows.d.ts +7 -0
- package/dist/types/components/core/table/expand-toggle.d.ts +10 -0
- package/dist/types/components/core/table/group-header.d.ts +14 -0
- package/dist/types/components/core/table/index.d.ts +8 -0
- package/dist/types/components/core/table/table.d.ts +31 -0
- package/dist/types/components/core/tabs/index.d.ts +2 -0
- package/dist/types/components/core/tabs/tabs.d.ts +20 -0
- package/dist/types/components/core/tag-pill/index.d.ts +2 -0
- package/dist/types/components/core/tag-pill/tag-pill.d.ts +25 -0
- package/dist/types/components/core/thumbnail/index.d.ts +2 -0
- package/dist/types/components/core/thumbnail/thumbnail.d.ts +23 -0
- package/dist/types/components/core/toast/index.d.ts +2 -0
- package/dist/types/components/core/toast/toast.d.ts +88 -0
- package/dist/types/components/core/toggle/index.d.ts +2 -0
- package/dist/types/components/core/toggle/toggle.d.ts +9 -0
- package/dist/types/components/core/toggle-group/index.d.ts +2 -0
- package/dist/types/components/core/toggle-group/toggle-group.d.ts +21 -0
- package/dist/types/components/core/tooltip/index.d.ts +2 -0
- package/dist/types/components/core/tooltip/tooltip.d.ts +33 -0
- package/dist/types/components/layout/multi-pane/index.d.ts +4 -0
- package/dist/types/components/layout/multi-pane/list-detail.d.ts +17 -0
- package/dist/types/components/layout/multi-pane/multi-pane.d.ts +34 -0
- package/dist/types/components/layout/single-pane/index.d.ts +2 -0
- package/dist/types/components/layout/single-pane/single-pane.d.ts +11 -0
- package/dist/types/components/shell/app-shell/app-shell.d.ts +12 -0
- package/dist/types/components/shell/app-shell/index.d.ts +2 -0
- package/dist/types/components/shell/sidebar/index.d.ts +2 -0
- package/dist/types/components/shell/sidebar/sidebar-group.d.ts +45 -0
- package/dist/types/components/shell/sidebar/sidebar-item.d.ts +19 -0
- package/dist/types/components/shell/sidebar/sidebar-resize-handle.d.ts +17 -0
- package/dist/types/components/shell/sidebar/sidebar-tree.d.ts +42 -0
- package/dist/types/components/shell/sidebar/sidebar.d.ts +27 -0
- package/dist/types/components/template/address-book-template/address-book-template.d.ts +15 -0
- package/dist/types/components/template/address-book-template/index.d.ts +2 -0
- package/dist/types/components/template/mail-template/index.d.ts +2 -0
- package/dist/types/components/template/mail-template/mail-template.d.ts +11 -0
- package/dist/types/components/template/use-narrow.d.ts +3 -0
- package/dist/types/index.d.ts +149 -0
- package/dist/types/kit/check-rendering.d.ts +3 -0
- package/dist/types/kit/kit.d.ts +76 -0
- package/dist/types/lib/clipboard.d.ts +5 -0
- package/dist/types/lib/dates.d.ts +9 -0
- package/dist/types/lib/json.d.ts +26 -0
- package/dist/types/lib/keys.d.ts +15 -0
- package/dist/types/lib/utils.d.ts +2 -0
- package/dist/types/lib/view-scope.d.ts +22 -0
- package/dist/types/profile/profile.d.ts +34 -0
- package/dist/types/theme/appearance.d.ts +31 -0
- package/dist/types/theme/boot.d.ts +3 -0
- package/dist/types/theme/client-appearance-react.d.ts +3 -0
- package/dist/types/theme/client-appearance.d.ts +69 -0
- package/dist/types/theme/generate-tokens.d.ts +45 -0
- package/dist/types/theme/pack-themes-react.d.ts +24 -0
- package/dist/types/theme/palette.d.ts +111 -0
- package/dist/types/theme/semantic-mapping.d.ts +28 -0
- package/dist/types/theme/set-theme.d.ts +30 -0
- package/dist/types/theme/theme-colours.d.ts +14 -0
- package/dist/types/theme/theme-css.d.ts +3 -0
- package/dist/types/theme/themes.d.ts +63 -0
- package/dist/types/theme/wallpaper-sheet.d.ts +16 -0
- package/dist/types/theme/wallpaper-theme-react.d.ts +7 -0
- package/dist/types/theme/wallpaper-theme.d.ts +37 -0
- package/package.json +87 -3
- package/src/build/stylesheet.ts +128 -0
- package/src/components/composite/command/command.meta.yaml +74 -0
- package/src/components/composite/command/command.tsx +939 -0
- package/src/components/composite/command/index.ts +17 -0
- package/src/components/composite/draft-bar/draft-bar.meta.yaml +19 -0
- package/src/components/composite/draft-bar/draft-bar.tsx +57 -0
- package/src/components/composite/draft-bar/index.ts +2 -0
- package/src/components/composite/image-field/image-field.meta.yaml +69 -0
- package/src/components/composite/image-field/image-field.tsx +267 -0
- package/src/components/composite/image-field/index.ts +2 -0
- package/src/components/composite/list/index.ts +18 -0
- package/src/components/composite/list/list-swipe.tsx +163 -0
- package/src/components/composite/list/list.meta.yaml +238 -0
- package/src/components/composite/list/list.tsx +868 -0
- package/src/components/composite/picker/index.ts +2 -0
- package/src/components/composite/picker/picker.meta.yaml +103 -0
- package/src/components/composite/picker/picker.tsx +276 -0
- package/src/components/composite/prompt-field/index.ts +2 -0
- package/src/components/composite/prompt-field/prompt-field.meta.yaml +60 -0
- package/src/components/composite/prompt-field/prompt-field.tsx +81 -0
- package/src/components/composite/properties/index.ts +9 -0
- package/src/components/composite/properties/properties.meta.yaml +56 -0
- package/src/components/composite/properties/properties.tsx +132 -0
- package/src/components/composite/snooze-menu/index.ts +11 -0
- package/src/components/composite/snooze-menu/presets.ts +169 -0
- package/src/components/composite/snooze-menu/snooze-menu.meta.yaml +58 -0
- package/src/components/composite/snooze-menu/snooze-menu.tsx +146 -0
- package/src/components/composite/tag-input/index.ts +2 -0
- package/src/components/composite/tag-input/tag-input.meta.yaml +51 -0
- package/src/components/composite/tag-input/tag-input.tsx +404 -0
- package/src/components/composite/wizard/index.ts +2 -0
- package/src/components/composite/wizard/wizard.meta.yaml +73 -0
- package/src/components/composite/wizard/wizard.tsx +256 -0
- package/src/components/core/avatar/avatar.meta.yaml +71 -0
- package/src/components/core/avatar/avatar.tsx +92 -0
- package/src/components/core/avatar/index.ts +2 -0
- package/src/components/core/badge/badge.meta.yaml +34 -0
- package/src/components/core/badge/badge.tsx +23 -0
- package/src/components/core/badge/index.ts +2 -0
- package/src/components/core/breadcrumb/breadcrumb.meta.yaml +45 -0
- package/src/components/core/breadcrumb/breadcrumb.tsx +110 -0
- package/src/components/core/breadcrumb/index.ts +2 -0
- package/src/components/core/bullets/bullets.meta.yaml +37 -0
- package/src/components/core/bullets/bullets.tsx +60 -0
- package/src/components/core/bullets/index.ts +2 -0
- package/src/components/core/button/button.meta.yaml +91 -0
- package/src/components/core/button/button.tsx +93 -0
- package/src/components/core/button/index.ts +2 -0
- package/src/components/core/card/card.meta.yaml +94 -0
- package/src/components/core/card/card.tsx +54 -0
- package/src/components/core/card/index.ts +2 -0
- package/src/components/core/checkbox/checkbox.meta.yaml +59 -0
- package/src/components/core/checkbox/checkbox.tsx +106 -0
- package/src/components/core/checkbox/index.ts +2 -0
- package/src/components/core/cluster/cluster.meta.yaml +4 -0
- package/src/components/core/cluster/cluster.tsx +17 -0
- package/src/components/core/cluster/index.ts +1 -0
- package/src/components/core/code-block/code-block.meta.yaml +30 -0
- package/src/components/core/code-block/code-block.tsx +93 -0
- package/src/components/core/code-block/index.ts +2 -0
- package/src/components/core/collapsible/collapsible.meta.yaml +34 -0
- package/src/components/core/collapsible/collapsible.tsx +54 -0
- package/src/components/core/collapsible/index.ts +1 -0
- package/src/components/core/colour-picker/colour-picker.meta.yaml +52 -0
- package/src/components/core/colour-picker/colour-picker.tsx +314 -0
- package/src/components/core/colour-picker/index.ts +4 -0
- package/src/components/core/combobox/combobox.meta.yaml +75 -0
- package/src/components/core/combobox/combobox.tsx +288 -0
- package/src/components/core/combobox/index.ts +2 -0
- package/src/components/core/detail/detail.meta.yaml +13 -0
- package/src/components/core/detail/detail.tsx +73 -0
- package/src/components/core/detail/index.ts +1 -0
- package/src/components/core/dialog/dialog.meta.yaml +95 -0
- package/src/components/core/dialog/dialog.tsx +254 -0
- package/src/components/core/dialog/drag.ts +40 -0
- package/src/components/core/dialog/index.ts +25 -0
- package/src/components/core/drop-zone/drop-zone.meta.yaml +55 -0
- package/src/components/core/drop-zone/drop-zone.tsx +146 -0
- package/src/components/core/drop-zone/index.ts +2 -0
- package/src/components/core/dropdown-menu/dropdown-menu.meta.yaml +118 -0
- package/src/components/core/dropdown-menu/dropdown-menu.tsx +407 -0
- package/src/components/core/dropdown-menu/index.ts +32 -0
- package/src/components/core/editable-field/editable-field.meta.yaml +120 -0
- package/src/components/core/editable-field/editable-field.tsx +346 -0
- package/src/components/core/editable-field/index.ts +2 -0
- package/src/components/core/empty-state/empty-state.meta.yaml +21 -0
- package/src/components/core/empty-state/empty-state.tsx +42 -0
- package/src/components/core/empty-state/index.ts +2 -0
- package/src/components/core/field/field.meta.yaml +37 -0
- package/src/components/core/field/field.tsx +100 -0
- package/src/components/core/field/index.ts +9 -0
- package/src/components/core/icon/curated-names.json +107 -0
- package/src/components/core/icon/icon-sets.ts +109 -0
- package/src/components/core/icon/icon.meta.yaml +30 -0
- package/src/components/core/icon/icon.tsx +93 -0
- package/src/components/core/icon/index.ts +2 -0
- package/src/components/core/input/index.ts +4 -0
- package/src/components/core/input/input.meta.yaml +98 -0
- package/src/components/core/input/input.tsx +133 -0
- package/src/components/core/input/textarea.meta.yaml +79 -0
- package/src/components/core/input/textarea.tsx +63 -0
- package/src/components/core/kbd/index.ts +2 -0
- package/src/components/core/kbd/kbd.meta.yaml +12 -0
- package/src/components/core/kbd/kbd.tsx +29 -0
- package/src/components/core/label/index.ts +2 -0
- package/src/components/core/label/label.meta.yaml +55 -0
- package/src/components/core/label/label.tsx +72 -0
- package/src/components/core/main-content/index.ts +2 -0
- package/src/components/core/main-content/main-content.meta.yaml +23 -0
- package/src/components/core/main-content/main-content.tsx +49 -0
- package/src/components/core/pane/index.ts +1 -0
- package/src/components/core/pane/pane.meta.yaml +13 -0
- package/src/components/core/pane/pane.tsx +64 -0
- package/src/components/core/pick-menu/index.ts +4 -0
- package/src/components/core/pick-menu/pick-menu.meta.yaml +36 -0
- package/src/components/core/pick-menu/pick-menu.tsx +348 -0
- package/src/components/core/pick-menu/tag-menu.meta.yaml +7 -0
- package/src/components/core/pick-menu/tag-menu.tsx +79 -0
- package/src/components/core/popover/index.ts +2 -0
- package/src/components/core/popover/popover.meta.yaml +16 -0
- package/src/components/core/popover/popover.tsx +66 -0
- package/src/components/core/progress/index.ts +2 -0
- package/src/components/core/progress/progress.meta.yaml +47 -0
- package/src/components/core/progress/progress.tsx +56 -0
- package/src/components/core/resizable/index.ts +13 -0
- package/src/components/core/resizable/resizable.meta.yaml +110 -0
- package/src/components/core/resizable/resizable.tsx +125 -0
- package/src/components/core/resizable/use-remembered-layout.ts +261 -0
- package/src/components/core/screen-link/index.ts +2 -0
- package/src/components/core/screen-link/screen-link.meta.yaml +34 -0
- package/src/components/core/screen-link/screen-link.tsx +100 -0
- package/src/components/core/scroll-area/index.ts +2 -0
- package/src/components/core/scroll-area/scroll-area.meta.yaml +72 -0
- package/src/components/core/scroll-area/scroll-area.tsx +95 -0
- package/src/components/core/scroll-area/steps.tsx +72 -0
- package/src/components/core/section/index.ts +2 -0
- package/src/components/core/section/section.meta.yaml +72 -0
- package/src/components/core/section/section.tsx +93 -0
- package/src/components/core/segment-group/index.ts +2 -0
- package/src/components/core/segment-group/segment-group.meta.yaml +71 -0
- package/src/components/core/segment-group/segment-group.tsx +166 -0
- package/src/components/core/select/index.ts +20 -0
- package/src/components/core/select/select.meta.yaml +48 -0
- package/src/components/core/select/select.tsx +226 -0
- package/src/components/core/skeleton/index.ts +2 -0
- package/src/components/core/skeleton/skeleton.meta.yaml +50 -0
- package/src/components/core/skeleton/skeleton.tsx +71 -0
- package/src/components/core/slider/index.ts +2 -0
- package/src/components/core/slider/slider.meta.yaml +55 -0
- package/src/components/core/slider/slider.tsx +46 -0
- package/src/components/core/sortable/index.ts +16 -0
- package/src/components/core/sortable/sortable.meta.yaml +125 -0
- package/src/components/core/sortable/sortable.tsx +471 -0
- package/src/components/core/split-view/index.ts +2 -0
- package/src/components/core/split-view/split-view.meta.yaml +85 -0
- package/src/components/core/split-view/split-view.tsx +193 -0
- package/src/components/core/status-icon/index.ts +2 -0
- package/src/components/core/status-icon/status-icon.meta.yaml +64 -0
- package/src/components/core/status-icon/status-icon.tsx +94 -0
- package/src/components/core/table/collapsible-rows.tsx +30 -0
- package/src/components/core/table/expand-toggle.tsx +58 -0
- package/src/components/core/table/group-header.tsx +35 -0
- package/src/components/core/table/index.ts +26 -0
- package/src/components/core/table/table.meta.yaml +67 -0
- package/src/components/core/table/table.tsx +166 -0
- package/src/components/core/tabs/index.ts +2 -0
- package/src/components/core/tabs/tabs.meta.yaml +57 -0
- package/src/components/core/tabs/tabs.tsx +74 -0
- package/src/components/core/tag-pill/index.ts +2 -0
- package/src/components/core/tag-pill/tag-pill.meta.yaml +19 -0
- package/src/components/core/tag-pill/tag-pill.tsx +102 -0
- package/src/components/core/thumbnail/index.ts +2 -0
- package/src/components/core/thumbnail/thumbnail.meta.yaml +59 -0
- package/src/components/core/thumbnail/thumbnail.tsx +162 -0
- package/src/components/core/toast/index.ts +12 -0
- package/src/components/core/toast/toast.meta.yaml +93 -0
- package/src/components/core/toast/toast.tsx +763 -0
- package/src/components/core/toggle/index.ts +2 -0
- package/src/components/core/toggle/toggle.meta.yaml +53 -0
- package/src/components/core/toggle/toggle.tsx +44 -0
- package/src/components/core/toggle-group/index.ts +2 -0
- package/src/components/core/toggle-group/toggle-group.meta.yaml +59 -0
- package/src/components/core/toggle-group/toggle-group.tsx +68 -0
- package/src/components/core/tooltip/index.ts +7 -0
- package/src/components/core/tooltip/tooltip.meta.yaml +93 -0
- package/src/components/core/tooltip/tooltip.tsx +198 -0
- package/src/components/layout/multi-pane/index.ts +4 -0
- package/src/components/layout/multi-pane/list-detail.tsx +45 -0
- package/src/components/layout/multi-pane/multi-pane.meta.yaml +67 -0
- package/src/components/layout/multi-pane/multi-pane.tsx +158 -0
- package/src/components/layout/single-pane/index.ts +2 -0
- package/src/components/layout/single-pane/single-pane.meta.yaml +35 -0
- package/src/components/layout/single-pane/single-pane.tsx +48 -0
- package/src/components/shell/app-shell/app-shell.meta.yaml +65 -0
- package/src/components/shell/app-shell/app-shell.tsx +61 -0
- package/src/components/shell/app-shell/index.ts +2 -0
- package/src/components/shell/sidebar/index.ts +35 -0
- package/src/components/shell/sidebar/sidebar-group.tsx +254 -0
- package/src/components/shell/sidebar/sidebar-item.tsx +88 -0
- package/src/components/shell/sidebar/sidebar-resize-handle.tsx +101 -0
- package/src/components/shell/sidebar/sidebar-tree.tsx +325 -0
- package/src/components/shell/sidebar/sidebar.meta.yaml +126 -0
- package/src/components/shell/sidebar/sidebar.tsx +142 -0
- package/src/components/template/address-book-template/address-book-template.meta.yaml +22 -0
- package/src/components/template/address-book-template/address-book-template.tsx +201 -0
- package/src/components/template/address-book-template/index.ts +2 -0
- package/src/components/template/mail-template/index.ts +2 -0
- package/src/components/template/mail-template/mail-template.meta.yaml +22 -0
- package/src/components/template/mail-template/mail-template.tsx +731 -0
- package/src/components/template/use-narrow.ts +18 -0
- package/src/index.ts +505 -0
- package/src/kit/check-rendering.tsx +130 -0
- package/src/kit/kit.tsx +177 -0
- package/src/lib/clipboard.ts +27 -0
- package/src/lib/dates.ts +13 -0
- package/src/lib/json.ts +59 -0
- package/src/lib/keys.ts +54 -0
- package/src/lib/utils.ts +12 -0
- package/src/lib/view-scope.tsx +60 -0
- package/src/profile/profile.ts +238 -0
- package/src/theme/appearance.ts +198 -0
- package/src/theme/boot.ts +6 -0
- package/src/theme/client-appearance-react.ts +14 -0
- package/src/theme/client-appearance.ts +284 -0
- package/src/theme/generate-tokens.ts +658 -0
- package/src/theme/pack-themes-react.ts +107 -0
- package/src/theme/palette.ts +301 -0
- package/src/theme/semantic-mapping.ts +165 -0
- package/src/theme/set-theme.ts +162 -0
- package/src/theme/theme-colours.ts +60 -0
- package/src/theme/theme-css.ts +15 -0
- package/src/theme/themes.ts +133 -0
- package/src/theme/wallpaper-sheet.ts +58 -0
- package/src/theme/wallpaper-theme-react.ts +60 -0
- package/src/theme/wallpaper-theme.ts +231 -0
|
@@ -0,0 +1,896 @@
|
|
|
1
|
+
// src/theme/theme-css.ts
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { dirname, join as join2 } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
// src/theme/generate-tokens.ts
|
|
7
|
+
import { readFileSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { parse as parseYaml } from "yaml";
|
|
10
|
+
|
|
11
|
+
// src/theme/palette.ts
|
|
12
|
+
var NEUTRAL_NAMES = [
|
|
13
|
+
"50",
|
|
14
|
+
"100",
|
|
15
|
+
"200",
|
|
16
|
+
"300",
|
|
17
|
+
"400",
|
|
18
|
+
"500",
|
|
19
|
+
"600",
|
|
20
|
+
"700",
|
|
21
|
+
"800",
|
|
22
|
+
"900",
|
|
23
|
+
"950"
|
|
24
|
+
];
|
|
25
|
+
var HUE_NAMES = [
|
|
26
|
+
"red",
|
|
27
|
+
"green",
|
|
28
|
+
"yellow",
|
|
29
|
+
"blue",
|
|
30
|
+
"magenta",
|
|
31
|
+
"cyan",
|
|
32
|
+
"orange",
|
|
33
|
+
"pink"
|
|
34
|
+
];
|
|
35
|
+
var DARK_POSITIONS = [0, 0.012, 0.03, 0.06, 0.09, 0.18, 0.3, 0.452, 0.69, 0.85, 1];
|
|
36
|
+
var LIGHT_POSITIONS = [0, 0.015, 0.031, 0.046, 0.077, 0.134, 0.182, 0.335, 0.511, 0.704, 1];
|
|
37
|
+
var DARK_ROLES = [
|
|
38
|
+
"sidebar",
|
|
39
|
+
"bg",
|
|
40
|
+
"surface",
|
|
41
|
+
"hover",
|
|
42
|
+
"active",
|
|
43
|
+
"badge/border",
|
|
44
|
+
"placeholder",
|
|
45
|
+
"muted",
|
|
46
|
+
"secondary",
|
|
47
|
+
"fg-strong",
|
|
48
|
+
"fg"
|
|
49
|
+
];
|
|
50
|
+
var LIGHT_ROLES = [
|
|
51
|
+
"surface",
|
|
52
|
+
"bg",
|
|
53
|
+
"sidebar",
|
|
54
|
+
"hover",
|
|
55
|
+
"active",
|
|
56
|
+
"badge/border",
|
|
57
|
+
"border-input",
|
|
58
|
+
"placeholder",
|
|
59
|
+
"muted",
|
|
60
|
+
"secondary",
|
|
61
|
+
"fg"
|
|
62
|
+
];
|
|
63
|
+
function parseOklch(str) {
|
|
64
|
+
const m = str.match(/oklch\(\s*([\d.]+)%\s+([\d.]+)\s+([\d.]+|none)\s*\)/);
|
|
65
|
+
if (!m) return null;
|
|
66
|
+
const [, l, c, h] = m;
|
|
67
|
+
if (l === void 0 || c === void 0 || h === void 0) return null;
|
|
68
|
+
return {
|
|
69
|
+
l: parseFloat(l) / 100,
|
|
70
|
+
c: parseFloat(c),
|
|
71
|
+
h: h === "none" ? 0 : parseFloat(h)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function oklchToString(color) {
|
|
75
|
+
const l = Math.max(0, Math.min(1, color.l));
|
|
76
|
+
const c = Math.max(0, color.c);
|
|
77
|
+
return `oklch(${(l * 100).toFixed(2)}% ${c.toFixed(4)} ${color.h.toFixed(1)})`;
|
|
78
|
+
}
|
|
79
|
+
function lerp(a, b, t) {
|
|
80
|
+
return a + (b - a) * t;
|
|
81
|
+
}
|
|
82
|
+
function lerpOklch(a, b, t) {
|
|
83
|
+
return {
|
|
84
|
+
l: lerp(a.l, b.l, t),
|
|
85
|
+
c: lerp(a.c, b.c, t),
|
|
86
|
+
h: lerp(a.h, b.h, t)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function deriveVariants(normal, bright, bg, isDark) {
|
|
90
|
+
isDark = isDark ?? bg.l < 0.5;
|
|
91
|
+
const low = {
|
|
92
|
+
l: isDark ? lerp(bg.l, normal.l, 0.15) : lerp(bg.l, normal.l, 0.08),
|
|
93
|
+
c: normal.c * (isDark ? 0.25 : 0.15),
|
|
94
|
+
h: normal.h
|
|
95
|
+
};
|
|
96
|
+
const mid = {
|
|
97
|
+
l: lerp(low.l, normal.l, 0.55),
|
|
98
|
+
c: normal.c * 0.65,
|
|
99
|
+
h: normal.h
|
|
100
|
+
};
|
|
101
|
+
const high = isDark ? { l: Math.min(bright.l + 0.08, 0.97), c: bright.c * 0.6, h: bright.h } : { l: Math.max(normal.l - 0.12, 0.15), c: normal.c * 0.9, h: normal.h };
|
|
102
|
+
return { low, mid, normal, bright, high };
|
|
103
|
+
}
|
|
104
|
+
function deriveNeutrals(bg, fg, isDark) {
|
|
105
|
+
isDark = isDark ?? bg.l < fg.l;
|
|
106
|
+
const positions = isDark ? DARK_POSITIONS : LIGHT_POSITIONS;
|
|
107
|
+
const roles = isDark ? DARK_ROLES : LIGHT_ROLES;
|
|
108
|
+
const startL = isDark ? Math.max(bg.l - 0.015, 0.03) : Math.min(bg.l + 0.012, 1);
|
|
109
|
+
const start = { l: startL, c: bg.c, h: bg.h };
|
|
110
|
+
const steps = [];
|
|
111
|
+
for (let i = 0; i < 11; i++) {
|
|
112
|
+
const position = positions[i];
|
|
113
|
+
const name = NEUTRAL_NAMES[i];
|
|
114
|
+
const role = roles[i];
|
|
115
|
+
if (position === void 0 || name === void 0 || role === void 0) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
steps.push({
|
|
119
|
+
color: lerpOklch(start, fg, position),
|
|
120
|
+
name,
|
|
121
|
+
role
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return steps;
|
|
125
|
+
}
|
|
126
|
+
function derivePalette(input) {
|
|
127
|
+
const isDark = input.type === "dark";
|
|
128
|
+
const chromatic = {};
|
|
129
|
+
for (const hue of HUE_NAMES) {
|
|
130
|
+
const { normal, bright } = input.hues[hue];
|
|
131
|
+
chromatic[hue] = deriveVariants(normal, bright, input.bg, isDark);
|
|
132
|
+
}
|
|
133
|
+
const neutrals = deriveNeutrals(input.bg, input.fg, isDark);
|
|
134
|
+
return {
|
|
135
|
+
chromatic,
|
|
136
|
+
neutrals,
|
|
137
|
+
accent: input.accent,
|
|
138
|
+
isDark,
|
|
139
|
+
...input.overrides && { overrides: input.overrides }
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// src/theme/semantic-mapping.ts
|
|
144
|
+
function byRole(neutrals, role) {
|
|
145
|
+
const step = neutrals.find((s) => s.role === role);
|
|
146
|
+
if (!step) throw new Error(`Neutral role "${role}" not found`);
|
|
147
|
+
return oklchToString(step.color);
|
|
148
|
+
}
|
|
149
|
+
function colorByRole(neutrals, role) {
|
|
150
|
+
const step = neutrals.find((s) => s.role === role);
|
|
151
|
+
if (!step) throw new Error(`Neutral role "${role}" not found`);
|
|
152
|
+
return step.color;
|
|
153
|
+
}
|
|
154
|
+
function mapPaletteToTokens(palette) {
|
|
155
|
+
const { chromatic, neutrals, accent, isDark } = palette;
|
|
156
|
+
const a = chromatic[accent];
|
|
157
|
+
const fmt = oklchToString;
|
|
158
|
+
const borderInputValue = isDark ? fmt(
|
|
159
|
+
lerpOklch(
|
|
160
|
+
colorByRole(neutrals, "badge/border"),
|
|
161
|
+
colorByRole(neutrals, "placeholder"),
|
|
162
|
+
0.55
|
|
163
|
+
)
|
|
164
|
+
) : byRole(neutrals, "border-input");
|
|
165
|
+
const colors = {
|
|
166
|
+
// ── Backgrounds (from neutral scale) ──
|
|
167
|
+
"--bg": byRole(neutrals, "bg"),
|
|
168
|
+
"--bg-surface": byRole(neutrals, "surface"),
|
|
169
|
+
"--bg-hover": byRole(neutrals, "hover"),
|
|
170
|
+
"--bg-active": byRole(neutrals, "active"),
|
|
171
|
+
"--bg-sidebar": byRole(neutrals, "sidebar"),
|
|
172
|
+
"--bg-badge": byRole(neutrals, "active"),
|
|
173
|
+
// badge uses active-level neutral
|
|
174
|
+
// ── Foregrounds (from neutral scale) ──
|
|
175
|
+
// Dark: placeholder → muted → secondary → fg-strong → fg
|
|
176
|
+
// Light: placeholder → muted → secondary → fg (no fg-strong)
|
|
177
|
+
"--fg": byRole(neutrals, "fg"),
|
|
178
|
+
"--fg-secondary": byRole(neutrals, "secondary"),
|
|
179
|
+
"--fg-muted": byRole(neutrals, "muted"),
|
|
180
|
+
"--fg-placeholder": byRole(neutrals, "placeholder"),
|
|
181
|
+
// ── Borders (from neutral scale) ──
|
|
182
|
+
"--border": byRole(neutrals, "badge/border"),
|
|
183
|
+
"--border-subtle": byRole(neutrals, "active"),
|
|
184
|
+
// subtle border = active level
|
|
185
|
+
"--border-input": borderInputValue,
|
|
186
|
+
// ── Accent (from accent hue) ──
|
|
187
|
+
// accent-fg = high-contrast text ON accent backgrounds (white on dark accent, dark on light accent)
|
|
188
|
+
"--accent": fmt(a.normal),
|
|
189
|
+
"--accent-hover": fmt(a.bright),
|
|
190
|
+
"--accent-fg": isDark ? byRole(neutrals, "sidebar") : oklchToString({ l: 1, c: 0, h: 0 }),
|
|
191
|
+
"--accent-subtle": fmt(a.low),
|
|
192
|
+
// ── Semantic colors ──
|
|
193
|
+
// Each has: base color, subtle bg variant, fg (text ON that color)
|
|
194
|
+
"--destructive": fmt(chromatic.red.normal),
|
|
195
|
+
"--destructive-subtle": fmt(chromatic.red.low),
|
|
196
|
+
"--destructive-fg": isDark ? byRole(neutrals, "sidebar") : oklchToString({ l: 1, c: 0, h: 0 }),
|
|
197
|
+
"--success": fmt(chromatic.green.normal),
|
|
198
|
+
"--success-subtle": fmt(chromatic.green.low),
|
|
199
|
+
"--success-fg": isDark ? byRole(neutrals, "sidebar") : oklchToString({ l: 1, c: 0, h: 0 }),
|
|
200
|
+
"--warning": fmt(chromatic.yellow.normal),
|
|
201
|
+
"--warning-subtle": fmt(chromatic.yellow.low),
|
|
202
|
+
// warning-fg is always dark — yellow is bright in both light and dark themes
|
|
203
|
+
"--warning-fg": isDark ? byRole(neutrals, "sidebar") : byRole(neutrals, "fg"),
|
|
204
|
+
// Bridge: warning as text. The bright yellow stays for backgrounds, icons, and dots; on a light
|
|
205
|
+
// background it is unreadable as text, so light themes darken it to 62.5% lightness (contrast-checked).
|
|
206
|
+
"--warning-text": isDark ? fmt(chromatic.yellow.normal) : fmt({ ...chromatic.yellow.normal, l: Math.min(chromatic.yellow.normal.l, 0.625) }),
|
|
207
|
+
// Bridge: a merged pull request (`text-merged`). No palette hue is violet, so it is fixed per theme type:
|
|
208
|
+
// violet-600 on a light background, violet-300 on a dark one (contrast-checked in themes.test.ts).
|
|
209
|
+
"--merged": isDark ? "oklch(81.10% 0.1110 293.6)" : "oklch(54.10% 0.2810 293.0)",
|
|
210
|
+
// ── Labels ──
|
|
211
|
+
"--label-bug-bg": fmt(chromatic.red.low),
|
|
212
|
+
"--label-bug-fg": fmt(chromatic.red.bright),
|
|
213
|
+
"--label-bug-dot": fmt(chromatic.red.mid),
|
|
214
|
+
"--label-feature-bg": fmt(a.low),
|
|
215
|
+
"--label-feature-fg": fmt(a.bright),
|
|
216
|
+
"--label-feature-dot": fmt(a.mid),
|
|
217
|
+
"--label-improvement-bg": fmt(chromatic.green.low),
|
|
218
|
+
"--label-improvement-fg": fmt(chromatic.green.bright),
|
|
219
|
+
"--label-improvement-dot": fmt(chromatic.green.mid),
|
|
220
|
+
// Bridge: a TagInput chip's dot — the feature label's, but the livelier accent in dark themes.
|
|
221
|
+
"--label-tag-dot": isDark ? fmt(a.normal) : fmt(a.mid)
|
|
222
|
+
};
|
|
223
|
+
const shadowOpacity = isDark ? 0.5 : 0.16;
|
|
224
|
+
const shadowOpacityMd = isDark ? 0.4 : 0.12;
|
|
225
|
+
const shadowOpacitySm = isDark ? 0.5 : 0.15;
|
|
226
|
+
const accentChroma = a.normal.c;
|
|
227
|
+
const isHighChromaAccent = accentChroma >= 0.18 && a.normal.h >= 150 && a.normal.h <= 250;
|
|
228
|
+
const hasGlow = isDark && isHighChromaAccent;
|
|
229
|
+
const glowDialog = hasGlow ? `, 0 0 24px rgba(0, 200, 210, 0.08)` : "";
|
|
230
|
+
const glowDropdown = hasGlow ? `, 0 0 16px rgba(0, 200, 210, 0.06)` : "";
|
|
231
|
+
const glowTooltip = hasGlow ? `, 0 0 8px rgba(0, 200, 210, 0.08)` : "";
|
|
232
|
+
const shadows = {
|
|
233
|
+
"--shadow-dialog": `0 16px 48px rgba(0, 0, 0, ${shadowOpacity})${glowDialog}, 0 0 0 0.5px var(--border)`,
|
|
234
|
+
"--shadow-dropdown": `0 4px 24px rgba(0, 0, 0, ${shadowOpacityMd})${glowDropdown}, 0 0 0 0.5px var(--border)`,
|
|
235
|
+
"--shadow-tooltip": `0 4px 12px rgba(0, 0, 0, ${shadowOpacitySm})${glowTooltip}`
|
|
236
|
+
};
|
|
237
|
+
const { overrides } = palette;
|
|
238
|
+
if (overrides?.accentFg) colors["--accent-fg"] = fmt(overrides.accentFg);
|
|
239
|
+
if (overrides?.sidebar) colors["--bg-sidebar"] = fmt(overrides.sidebar);
|
|
240
|
+
if (overrides?.fgMuted) colors["--fg-muted"] = fmt(overrides.fgMuted);
|
|
241
|
+
return {
|
|
242
|
+
colors,
|
|
243
|
+
shadows,
|
|
244
|
+
colorScheme: isDark ? "dark" : "light"
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// src/theme/themes.ts
|
|
249
|
+
var THEMES = [
|
|
250
|
+
{ id: "bridge-light", label: "Bridge Light", type: "light" },
|
|
251
|
+
{ id: "bridge-dark", label: "Bridge Dark", type: "dark" },
|
|
252
|
+
{ id: "wallpaper-light", label: "Wallpaper Light", type: "light", wallpaper: true },
|
|
253
|
+
{ id: "wallpaper-dark", label: "Wallpaper Dark", type: "dark", wallpaper: true }
|
|
254
|
+
];
|
|
255
|
+
var BRIDGE_THEMES = THEMES.filter((theme) => !theme.wallpaper);
|
|
256
|
+
var DEFAULT_THEME = { light: "bridge-light", dark: "bridge-dark" };
|
|
257
|
+
var packThemes = [];
|
|
258
|
+
function packThemesOfAttribute(value) {
|
|
259
|
+
return (value ?? "").split(" ").map((each) => each.split(":")).filter(
|
|
260
|
+
(pair) => /^[a-z0-9-]+$/.test(pair[0] ?? "") && (pair[1] === "light" || pair[1] === "dark")
|
|
261
|
+
).map(([id, type]) => ({ id, label: id, type }));
|
|
262
|
+
}
|
|
263
|
+
if (typeof document !== "undefined")
|
|
264
|
+
packThemes = packThemesOfAttribute(document.documentElement.dataset.packThemes);
|
|
265
|
+
|
|
266
|
+
// src/theme/wallpaper-theme.ts
|
|
267
|
+
var WALLPAPER_THEMES = { light: "wallpaper-light", dark: "wallpaper-dark" };
|
|
268
|
+
var ok = (l, c, h) => ({ l: l / 100, c, h });
|
|
269
|
+
var BASE_HUES = {
|
|
270
|
+
light: {
|
|
271
|
+
red: { normal: ok(63.78, 0.237, 25.4), bright: ok(54.78, 0.218, 25.4) },
|
|
272
|
+
green: { normal: ok(69.59, 0.149, 162.5), bright: ok(60.59, 0.137, 162.5) },
|
|
273
|
+
yellow: { normal: ok(77.24, 0.173, 65.4), bright: ok(68.24, 0.159, 65.4) },
|
|
274
|
+
blue: { normal: ok(48.77, 0.218, 264.1), bright: ok(39.77, 0.2, 264.1) },
|
|
275
|
+
magenta: { normal: ok(40, 0.157, 332), bright: ok(31, 0.144, 332) },
|
|
276
|
+
cyan: { normal: ok(70.75, 0.029, 255.2), bright: ok(61.75, 0.027, 255.2) },
|
|
277
|
+
orange: { normal: ok(75.97, 0.142, 59.5), bright: ok(66.97, 0.131, 59.5) },
|
|
278
|
+
pink: { normal: ok(68.99, 0.262, 329.5), bright: ok(59.99, 0.241, 329.5) }
|
|
279
|
+
},
|
|
280
|
+
dark: {
|
|
281
|
+
red: { normal: ok(65.51, 0.221, 23.5), bright: ok(73.51, 0.195, 23.5) },
|
|
282
|
+
green: { normal: ok(69.59, 0.149, 162.5), bright: ok(77.59, 0.131, 162.5) },
|
|
283
|
+
yellow: { normal: ok(77.24, 0.173, 65.4), bright: ok(85.24, 0.152, 65.4) },
|
|
284
|
+
blue: { normal: ok(57.09, 0.21, 264), bright: ok(65.09, 0.185, 264) },
|
|
285
|
+
magenta: { normal: ok(55, 0.157, 332), bright: ok(63, 0.138, 332) },
|
|
286
|
+
cyan: { normal: ok(70.75, 0.029, 255.2), bright: ok(78.75, 0.026, 255.2) },
|
|
287
|
+
orange: { normal: ok(75.97, 0.142, 59.5), bright: ok(83.97, 0.125, 59.5) },
|
|
288
|
+
pink: { normal: ok(68.99, 0.262, 329.5), bright: ok(76.99, 0.231, 329.5) }
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
function rgbToOklch(r, g, b) {
|
|
292
|
+
const linear = (v) => {
|
|
293
|
+
const c = v / 255;
|
|
294
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
295
|
+
};
|
|
296
|
+
const [lr, lg, lb] = [linear(r), linear(g), linear(b)];
|
|
297
|
+
const l_ = Math.cbrt(0.4122214708 * lr + 0.5363015719 * lg + 0.0514770061 * lb);
|
|
298
|
+
const m_ = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);
|
|
299
|
+
const s_ = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);
|
|
300
|
+
const L = 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_;
|
|
301
|
+
const a = 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_;
|
|
302
|
+
const bb = 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_;
|
|
303
|
+
const h = Math.atan2(bb, a) * 180 / Math.PI;
|
|
304
|
+
return { l: L, c: Math.hypot(a, bb), h: h < 0 ? h + 360 : h };
|
|
305
|
+
}
|
|
306
|
+
var GREY = 0.03;
|
|
307
|
+
var clamp = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
308
|
+
var contrastWithWhite = ({ l, c, h }) => {
|
|
309
|
+
const a = c * Math.cos(h * Math.PI / 180);
|
|
310
|
+
const b = c * Math.sin(h * Math.PI / 180);
|
|
311
|
+
const l_ = (l + 0.3963377774 * a + 0.2158037573 * b) ** 3;
|
|
312
|
+
const m_ = (l - 0.1055613458 * a - 0.0638541728 * b) ** 3;
|
|
313
|
+
const s_ = (l - 0.0894841775 * a - 1.291485548 * b) ** 3;
|
|
314
|
+
const gamut = (v) => clamp(v, 0, 1);
|
|
315
|
+
const luminance = 0.2126 * gamut(4.0767416621 * l_ - 3.3077115913 * m_ + 0.2309699292 * s_) + 0.7152 * gamut(-1.2684380046 * l_ + 2.6097574011 * m_ - 0.3413193965 * s_) + 0.0722 * gamut(-0.0041960863 * l_ - 0.7034186147 * m_ + 1.707614701 * s_);
|
|
316
|
+
return 1.05 / (luminance + 0.05);
|
|
317
|
+
};
|
|
318
|
+
var nearestHue = (h) => {
|
|
319
|
+
const distance = (name) => {
|
|
320
|
+
const d = Math.abs(BASE_HUES.light[name].normal.h - h) % 360;
|
|
321
|
+
return d > 180 ? 360 - d : d;
|
|
322
|
+
};
|
|
323
|
+
return HUE_NAMES.filter((name) => name !== "cyan").reduce(
|
|
324
|
+
(best, name) => distance(name) < distance(best) ? name : best
|
|
325
|
+
);
|
|
326
|
+
};
|
|
327
|
+
function wallpaperPalette(colours, type) {
|
|
328
|
+
const dark = type === "dark";
|
|
329
|
+
const hues = { ...BASE_HUES[type] };
|
|
330
|
+
const main = colours?.main ?? { l: 0.5, c: 0, h: 264 };
|
|
331
|
+
const second = colours?.second ?? { l: 0.5, c: 0.07, h: 264 };
|
|
332
|
+
const tint = (l, scale, max) => ({
|
|
333
|
+
l,
|
|
334
|
+
c: Math.min(max, main.c * scale),
|
|
335
|
+
h: main.h
|
|
336
|
+
});
|
|
337
|
+
let accent = "blue";
|
|
338
|
+
let accentFg = dark ? { l: 1, c: 0, h: 0 } : void 0;
|
|
339
|
+
if (colours?.vivid) {
|
|
340
|
+
accent = nearestHue(colours.vivid.h);
|
|
341
|
+
const { c, h } = colours.vivid;
|
|
342
|
+
const chroma = clamp(c * 2, 0.1, 0.2);
|
|
343
|
+
let l = dark ? clamp(colours.vivid.l, 0.55, 0.8) : clamp(colours.vivid.l, 0.42, 0.55);
|
|
344
|
+
const white = dark && contrastWithWhite({ l, c: chroma, h }) >= 4.6;
|
|
345
|
+
if (dark && !white) l = Math.max(l, 0.72);
|
|
346
|
+
while (!dark && l > 0.3 && contrastWithWhite({ l, c: chroma, h }) < 4.6) l -= 0.01;
|
|
347
|
+
hues[accent] = {
|
|
348
|
+
normal: { l, c: chroma, h },
|
|
349
|
+
bright: { l: dark ? l + 0.08 : l - 0.09, c: chroma * 0.92, h }
|
|
350
|
+
};
|
|
351
|
+
accentFg = white ? { l: 1, c: 0, h: 0 } : void 0;
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
input: {
|
|
355
|
+
name: dark ? WALLPAPER_THEMES.dark : WALLPAPER_THEMES.light,
|
|
356
|
+
type,
|
|
357
|
+
accent,
|
|
358
|
+
bg: dark ? tint(0.17, 0.3, 0.03) : tint(0.985, 0.25, 0.015),
|
|
359
|
+
fg: dark ? tint(0.97, 0.1, 8e-3) : tint(0.22, 0.15, 0.015),
|
|
360
|
+
hues,
|
|
361
|
+
overrides: {
|
|
362
|
+
...accentFg && { accentFg },
|
|
363
|
+
sidebar: dark ? tint(0.15, 0.35, 0.035) : tint(0.955, 0.4, 0.03)
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
paint: {
|
|
367
|
+
c1: dark ? tint(0.22, 0.6, 0.045) : tint(0.935, 0.5, 0.035),
|
|
368
|
+
c2: {
|
|
369
|
+
l: dark ? 0.38 : 0.84,
|
|
370
|
+
c: Math.min(0.09, second.c * 0.8),
|
|
371
|
+
h: second.c < GREY ? main.h : second.h
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// src/theme/generate-tokens.ts
|
|
378
|
+
var paints = /* @__PURE__ */ new Map();
|
|
379
|
+
function loadPalette(filePath) {
|
|
380
|
+
const raw = parseYaml(readFileSync(filePath, "utf-8"));
|
|
381
|
+
return readPalette(raw, filePath);
|
|
382
|
+
}
|
|
383
|
+
function readPalette(raw, filePath) {
|
|
384
|
+
if (raw.type !== "dark" && raw.type !== "light") {
|
|
385
|
+
throw new Error(`Invalid type "${raw.type}" in ${filePath} \u2014 must be "dark" or "light"`);
|
|
386
|
+
}
|
|
387
|
+
if (!HUE_NAMES.includes(raw.accent)) {
|
|
388
|
+
throw new Error(
|
|
389
|
+
`Invalid accent "${raw.accent}" in ${filePath} \u2014 must be one of: ${HUE_NAMES.join(", ")}`
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
const bg = parseOklch(raw.bg);
|
|
393
|
+
const fg = parseOklch(raw.fg);
|
|
394
|
+
if (!bg || !fg) {
|
|
395
|
+
throw new Error(`Invalid bg/fg in ${filePath}`);
|
|
396
|
+
}
|
|
397
|
+
const hues = {};
|
|
398
|
+
for (const hue of HUE_NAMES) {
|
|
399
|
+
const normalStr = raw.hues[hue];
|
|
400
|
+
const brightStr = raw.hues[`${hue}-bright`];
|
|
401
|
+
if (!normalStr || !brightStr) {
|
|
402
|
+
throw new Error(`Missing hue ${hue} in ${filePath}`);
|
|
403
|
+
}
|
|
404
|
+
const normal = parseOklch(normalStr);
|
|
405
|
+
const bright = parseOklch(brightStr);
|
|
406
|
+
if (!normal || !bright) {
|
|
407
|
+
throw new Error(`Invalid OKLCH for ${hue} in ${filePath}`);
|
|
408
|
+
}
|
|
409
|
+
hues[hue] = { normal, bright };
|
|
410
|
+
}
|
|
411
|
+
const overrides = {};
|
|
412
|
+
for (const [key, field] of [
|
|
413
|
+
["accent-fg", "accentFg"],
|
|
414
|
+
["sidebar", "sidebar"],
|
|
415
|
+
["fg-muted", "fgMuted"]
|
|
416
|
+
]) {
|
|
417
|
+
const value = raw[key];
|
|
418
|
+
if (value === void 0) continue;
|
|
419
|
+
const color = parseOklch(value);
|
|
420
|
+
if (!color) throw new Error(`Invalid OKLCH for ${key} in ${filePath}`);
|
|
421
|
+
overrides[field] = color;
|
|
422
|
+
}
|
|
423
|
+
const paint = { c1: "", c2: "" };
|
|
424
|
+
for (const seed of ["c1", "c2"]) {
|
|
425
|
+
const colour = parseOklch(raw.paint?.[seed] ?? "");
|
|
426
|
+
if (!colour) throw new Error(`Invalid or missing paint.${seed} (OKLCH) in ${filePath}`);
|
|
427
|
+
paint[seed] = oklchToString(colour);
|
|
428
|
+
}
|
|
429
|
+
paints.set(raw.name, paint);
|
|
430
|
+
return {
|
|
431
|
+
name: raw.name,
|
|
432
|
+
type: raw.type,
|
|
433
|
+
accent: raw.accent,
|
|
434
|
+
bg,
|
|
435
|
+
fg,
|
|
436
|
+
hues,
|
|
437
|
+
...Object.keys(overrides).length > 0 && { overrides }
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
function formatColorBlock(tokens, indent = " ", paint) {
|
|
441
|
+
const lines = [];
|
|
442
|
+
const bgTokens = Object.entries(tokens.colors).filter(([k]) => k.startsWith("--bg"));
|
|
443
|
+
const fgTokens = Object.entries(tokens.colors).filter(([k]) => k.startsWith("--fg"));
|
|
444
|
+
const borderTokens = Object.entries(tokens.colors).filter(([k]) => k.startsWith("--border"));
|
|
445
|
+
const accentTokens = Object.entries(tokens.colors).filter(([k]) => k.startsWith("--accent"));
|
|
446
|
+
const semanticTokens = Object.entries(tokens.colors).filter(
|
|
447
|
+
([k]) => k.startsWith("--destructive") || k.startsWith("--warning") || k.startsWith("--success") || k.startsWith("--merged")
|
|
448
|
+
);
|
|
449
|
+
const labelTokens = Object.entries(tokens.colors).filter(([k]) => k.startsWith("--label"));
|
|
450
|
+
const writeGroup = (comment, entries) => {
|
|
451
|
+
if (entries.length === 0) return;
|
|
452
|
+
lines.push(`${indent}/* ${comment} */`);
|
|
453
|
+
for (const [key, value] of entries) {
|
|
454
|
+
lines.push(`${indent}${key}: ${value};`);
|
|
455
|
+
}
|
|
456
|
+
lines.push("");
|
|
457
|
+
};
|
|
458
|
+
writeGroup("Backgrounds", bgTokens);
|
|
459
|
+
writeGroup("Foregrounds", fgTokens);
|
|
460
|
+
writeGroup("Borders", borderTokens);
|
|
461
|
+
writeGroup("Accent", accentTokens);
|
|
462
|
+
writeGroup("Semantic", semanticTokens);
|
|
463
|
+
writeGroup("Labels", labelTokens);
|
|
464
|
+
if (paint)
|
|
465
|
+
writeGroup("Paint seeds", [
|
|
466
|
+
["--paint-c1", paint.c1],
|
|
467
|
+
["--paint-c2", paint.c2]
|
|
468
|
+
]);
|
|
469
|
+
lines.push(`${indent}/* Overlay shadows */`);
|
|
470
|
+
for (const [key, value] of Object.entries(tokens.shadows)) {
|
|
471
|
+
lines.push(`${indent}${key}: ${value};`);
|
|
472
|
+
}
|
|
473
|
+
lines.push("");
|
|
474
|
+
lines.push(`${indent}color-scheme: ${tokens.colorScheme};`);
|
|
475
|
+
return lines.join("\n");
|
|
476
|
+
}
|
|
477
|
+
function generateTokensCss(palettes) {
|
|
478
|
+
const sections = [];
|
|
479
|
+
sections.push(`/* =============================================================================
|
|
480
|
+
Bridge UI Design Tokens \u2014 Generated by palette system at host start
|
|
481
|
+
Source: plugins/themes-default/themes/*.yaml (Bridge's own themes in themes.ts)
|
|
482
|
+
|
|
483
|
+
Three-layer pattern:
|
|
484
|
+
1. :root / [data-theme] \u2014 Semantic CSS custom properties (theme-switchable)
|
|
485
|
+
2. @theme inline \u2014 Bridge to Tailwind utility classes (runtime-switchable)
|
|
486
|
+
3. @theme \u2014 Static tokens (spacing, typography, shadows)
|
|
487
|
+
+ component-scoped rules \u2014 [data-slot] reset, animations / keyframes
|
|
488
|
+
|
|
489
|
+
CSS contract: variables + component-scoped rules only. No bare HTML tag
|
|
490
|
+
selectors; no geometry on native elements.
|
|
491
|
+
|
|
492
|
+
Color format: OKLCH \u2014 perceptually uniform, enables programmatic hue shifts.
|
|
493
|
+
============================================================================= */
|
|
494
|
+
|
|
495
|
+
:root {
|
|
496
|
+
/* Base radius for inline style usage */
|
|
497
|
+
--radius: 5px;
|
|
498
|
+
}`);
|
|
499
|
+
sections.push(`
|
|
500
|
+
/* Default: ${DEFAULT_THEME.light} / ${DEFAULT_THEME.dark} following the system */
|
|
501
|
+
|
|
502
|
+
:root {
|
|
503
|
+
${formatColorBlock(palettes.get(DEFAULT_THEME.light).tokens, " ", paints.get(DEFAULT_THEME.light))}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
@media (prefers-color-scheme: dark) {
|
|
507
|
+
:root {
|
|
508
|
+
${formatColorBlock(palettes.get(DEFAULT_THEME.dark).tokens, " ", paints.get(DEFAULT_THEME.dark))}
|
|
509
|
+
}
|
|
510
|
+
}`);
|
|
511
|
+
for (const { id, label } of THEMES) {
|
|
512
|
+
const palette = palettes.get(id);
|
|
513
|
+
const typeLabel = palette.input.type === "dark" ? "Dark" : "Light";
|
|
514
|
+
sections.push(`
|
|
515
|
+
/* =============================================================================
|
|
516
|
+
${label} \u2014 ${typeLabel} Theme
|
|
517
|
+
============================================================================= */
|
|
518
|
+
|
|
519
|
+
[data-theme="${id}"] {
|
|
520
|
+
${formatColorBlock(palette.tokens, " ", paints.get(id))}
|
|
521
|
+
}`);
|
|
522
|
+
}
|
|
523
|
+
sections.push(`
|
|
524
|
+
/* =============================================================================
|
|
525
|
+
Layer 2: Tailwind Utility Bridge
|
|
526
|
+
@theme inline prevents build-time resolution of var() \u2014 required for
|
|
527
|
+
runtime theme switching via data-theme attribute.
|
|
528
|
+
============================================================================= */
|
|
529
|
+
|
|
530
|
+
@theme inline {
|
|
531
|
+
/* Clear default Tailwind palette, preserve essentials */
|
|
532
|
+
--color-*: initial;
|
|
533
|
+
--color-white: #ffffff;
|
|
534
|
+
--color-black: #000000;
|
|
535
|
+
--color-transparent: transparent;
|
|
536
|
+
|
|
537
|
+
/* Background surfaces */
|
|
538
|
+
--color-background: var(--bg);
|
|
539
|
+
--color-surface: var(--bg-surface);
|
|
540
|
+
--color-hover: var(--bg-hover);
|
|
541
|
+
--color-active: var(--bg-active);
|
|
542
|
+
--color-sidebar: var(--bg-sidebar);
|
|
543
|
+
--color-badge: var(--bg-badge);
|
|
544
|
+
|
|
545
|
+
/* Foreground text */
|
|
546
|
+
--color-foreground: var(--fg);
|
|
547
|
+
--color-secondary: var(--fg-secondary);
|
|
548
|
+
--color-muted: var(--fg-muted);
|
|
549
|
+
--color-placeholder: var(--fg-placeholder);
|
|
550
|
+
|
|
551
|
+
/* Borders */
|
|
552
|
+
--color-border: var(--border);
|
|
553
|
+
--color-border-subtle: var(--border-subtle);
|
|
554
|
+
--color-input: var(--border-input);
|
|
555
|
+
|
|
556
|
+
/* Accent */
|
|
557
|
+
--color-accent: var(--accent);
|
|
558
|
+
--color-accent-hover: var(--accent-hover);
|
|
559
|
+
--color-accent-foreground: var(--accent-fg);
|
|
560
|
+
--color-accent-subtle: var(--accent-subtle);
|
|
561
|
+
|
|
562
|
+
/* Semantic */
|
|
563
|
+
--color-destructive: var(--destructive);
|
|
564
|
+
--color-destructive-subtle: var(--destructive-subtle);
|
|
565
|
+
--color-destructive-foreground: var(--destructive-fg);
|
|
566
|
+
--color-success: var(--success);
|
|
567
|
+
--color-success-subtle: var(--success-subtle);
|
|
568
|
+
--color-success-foreground: var(--success-fg);
|
|
569
|
+
--color-warning: var(--warning);
|
|
570
|
+
--color-warning-subtle: var(--warning-subtle);
|
|
571
|
+
--color-warning-foreground: var(--warning-fg);
|
|
572
|
+
--color-warning-text: var(--warning-text);
|
|
573
|
+
--color-merged: var(--merged);
|
|
574
|
+
|
|
575
|
+
/* Labels */
|
|
576
|
+
--color-label-bug-bg: var(--label-bug-bg);
|
|
577
|
+
--color-label-bug-fg: var(--label-bug-fg);
|
|
578
|
+
--color-label-bug-dot: var(--label-bug-dot);
|
|
579
|
+
--color-label-feature-bg: var(--label-feature-bg);
|
|
580
|
+
--color-label-feature-fg: var(--label-feature-fg);
|
|
581
|
+
--color-label-feature-dot: var(--label-feature-dot);
|
|
582
|
+
--color-label-improvement-bg: var(--label-improvement-bg);
|
|
583
|
+
--color-label-improvement-fg: var(--label-improvement-fg);
|
|
584
|
+
--color-label-improvement-dot: var(--label-improvement-dot);
|
|
585
|
+
--color-label-tag-dot: var(--label-tag-dot);
|
|
586
|
+
}`);
|
|
587
|
+
sections.push(`
|
|
588
|
+
/* =============================================================================
|
|
589
|
+
Layer 3: Static Tokens
|
|
590
|
+
These never change between themes \u2014 safe to resolve at build time.
|
|
591
|
+
============================================================================= */
|
|
592
|
+
|
|
593
|
+
/* The two bases the controls are drawn from: the look's "Control height" and "Control radius" (the appearance
|
|
594
|
+
plugin's settings) set them on <html>; a page without them (tests, a plugin in development) keeps these. */
|
|
595
|
+
:root {
|
|
596
|
+
--control-height: 30px;
|
|
597
|
+
--control-radius: 8px;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
@theme {
|
|
601
|
+
/* ---------------------------------------------------------------------------
|
|
602
|
+
Component Heights \u2014 exposed as h-xs, h-sm, h-md, h-lg utilities; a zoom of the control height
|
|
603
|
+
(md), whole pixels: 28px gives 20 / 24 / 28 / 32, 30px gives 21 / 26 / 30 / 34
|
|
604
|
+
--------------------------------------------------------------------------- */
|
|
605
|
+
--height-xs: round(var(--control-height) * 5 / 7, 1px);
|
|
606
|
+
--height-sm: round(var(--control-height) * 6 / 7, 1px);
|
|
607
|
+
--height-md: var(--control-height);
|
|
608
|
+
--height-lg: round(var(--control-height) * 8 / 7, 1px);
|
|
609
|
+
|
|
610
|
+
/* ---------------------------------------------------------------------------
|
|
611
|
+
Border Radius \u2014 every control a row holds on the control radius (rounded-control); what sits
|
|
612
|
+
inside its 2px frame (a segment's thumb) on rounded-control-inner
|
|
613
|
+
--------------------------------------------------------------------------- */
|
|
614
|
+
--radius-control: var(--control-radius);
|
|
615
|
+
--radius-control-inner: max(0px, var(--control-radius) - 2px);
|
|
616
|
+
/* The small corners never rounder than the controls: below 5px they follow it (checkboxes and panels included), at 0 square. */
|
|
617
|
+
--radius-sm: min(4px, var(--control-radius));
|
|
618
|
+
--radius-default: min(5px, var(--control-radius));
|
|
619
|
+
/* A menu's surface wraps its items (rounded-control) 4px away (p-1); a dialog never under 8px. */
|
|
620
|
+
--radius-dropdown: calc(var(--control-radius) + 4px);
|
|
621
|
+
--radius-dialog: max(8px, var(--control-radius));
|
|
622
|
+
|
|
623
|
+
/* ---------------------------------------------------------------------------
|
|
624
|
+
Border Width \u2014 0.5px hairline (Linear-inspired)
|
|
625
|
+
--------------------------------------------------------------------------- */
|
|
626
|
+
--border-width: 0.5px;
|
|
627
|
+
|
|
628
|
+
/* ---------------------------------------------------------------------------
|
|
629
|
+
Spacing
|
|
630
|
+
Base unit for Tailwind v4 multiplier system: p-4 = calc(0.25rem * 4) = 1rem
|
|
631
|
+
--------------------------------------------------------------------------- */
|
|
632
|
+
--spacing: 0.25rem;
|
|
633
|
+
|
|
634
|
+
/* ---------------------------------------------------------------------------
|
|
635
|
+
Typography \u2014 Font Families
|
|
636
|
+
--------------------------------------------------------------------------- */
|
|
637
|
+
--font-*: initial;
|
|
638
|
+
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
|
|
639
|
+
--font-mono: "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
|
|
640
|
+
|
|
641
|
+
/* ---------------------------------------------------------------------------
|
|
642
|
+
Typography \u2014 Font Sizes + Paired Line Heights
|
|
643
|
+
6-level scale with \u22652px gaps
|
|
644
|
+
--------------------------------------------------------------------------- */
|
|
645
|
+
--text-xs: 0.75rem;
|
|
646
|
+
--text-xs--line-height: 1rem;
|
|
647
|
+
--text-sm: 0.875rem;
|
|
648
|
+
--text-sm--line-height: 1.25rem;
|
|
649
|
+
--text-base: 1rem;
|
|
650
|
+
--text-base--line-height: 1.5rem;
|
|
651
|
+
--text-lg: 1.25rem;
|
|
652
|
+
--text-lg--line-height: 1.75rem;
|
|
653
|
+
--text-xl: 1.5rem;
|
|
654
|
+
--text-xl--line-height: 2rem;
|
|
655
|
+
--text-2xl: 1.875rem;
|
|
656
|
+
--text-2xl--line-height: 2.375rem;
|
|
657
|
+
|
|
658
|
+
/* Purpose-specific typography tokens (not part of the ordinal scale) */
|
|
659
|
+
--text-field: 0.9375rem;
|
|
660
|
+
--text-field--line-height: 1.375rem;
|
|
661
|
+
|
|
662
|
+
/* ---------------------------------------------------------------------------
|
|
663
|
+
Typography \u2014 Font Weights
|
|
664
|
+
--------------------------------------------------------------------------- */
|
|
665
|
+
--font-weight-normal: 400;
|
|
666
|
+
--font-weight-medium: 500;
|
|
667
|
+
--font-weight-semibold: 600;
|
|
668
|
+
--font-weight-bold: 700;
|
|
669
|
+
|
|
670
|
+
/* ---------------------------------------------------------------------------
|
|
671
|
+
Typography \u2014 Letter Spacing
|
|
672
|
+
--------------------------------------------------------------------------- */
|
|
673
|
+
--tracking-tight: -0.025em;
|
|
674
|
+
--tracking-normal: 0em;
|
|
675
|
+
--tracking-wide: 0.025em;
|
|
676
|
+
|
|
677
|
+
/* ---------------------------------------------------------------------------
|
|
678
|
+
Typography \u2014 Line Heights (standalone)
|
|
679
|
+
--------------------------------------------------------------------------- */
|
|
680
|
+
--leading-tight: 1.25;
|
|
681
|
+
--leading-normal: 1.5;
|
|
682
|
+
--leading-relaxed: 1.625;
|
|
683
|
+
|
|
684
|
+
/* ---------------------------------------------------------------------------
|
|
685
|
+
Shadows \u2014 4 tiers (sm, md, lg, xl) + extended range (xs, 2xl)
|
|
686
|
+
--------------------------------------------------------------------------- */
|
|
687
|
+
--shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
688
|
+
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1),
|
|
689
|
+
0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
690
|
+
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),
|
|
691
|
+
0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
692
|
+
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
|
|
693
|
+
0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
694
|
+
--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),
|
|
695
|
+
0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
696
|
+
--shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
|
|
697
|
+
}`);
|
|
698
|
+
sections.push(`
|
|
699
|
+
/* =============================================================================
|
|
700
|
+
Component Reset \u2014 the kit's own elements only
|
|
701
|
+
============================================================================= */
|
|
702
|
+
|
|
703
|
+
@layer base {
|
|
704
|
+
:where([data-slot]),
|
|
705
|
+
:where([data-slot])::before,
|
|
706
|
+
:where([data-slot])::after {
|
|
707
|
+
box-sizing: border-box;
|
|
708
|
+
margin: 0;
|
|
709
|
+
padding: 0;
|
|
710
|
+
border: 0 solid;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
:where([data-slot]) {
|
|
714
|
+
font-family: var(--font-sans);
|
|
715
|
+
font-size: inherit;
|
|
716
|
+
font-weight: inherit;
|
|
717
|
+
line-height: inherit;
|
|
718
|
+
color: inherit;
|
|
719
|
+
background: transparent;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/* Base UI's scrollbar hiding (ScrollArea viewport, Select popup): the kit turns off its inline
|
|
723
|
+
<style> elements, which the page's CSP refuses, and ships the same rule here. */
|
|
724
|
+
.base-ui-disable-scrollbar {
|
|
725
|
+
scrollbar-width: none;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
.base-ui-disable-scrollbar::-webkit-scrollbar {
|
|
729
|
+
display: none;
|
|
730
|
+
}
|
|
731
|
+
}`);
|
|
732
|
+
sections.push(`
|
|
733
|
+
/* =============================================================================
|
|
734
|
+
Animations \u2014 Overlay Components
|
|
735
|
+
============================================================================= */
|
|
736
|
+
|
|
737
|
+
@keyframes tooltip-fade-in {
|
|
738
|
+
from { opacity: 0; }
|
|
739
|
+
to { opacity: 1; }
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
[data-slot="tooltip-content"] {
|
|
743
|
+
animation: tooltip-fade-in 200ms ease-out both;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
@keyframes toast-slide-in {
|
|
747
|
+
from { transform: translateX(100%); }
|
|
748
|
+
to { transform: translateX(0); }
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
[data-slot="toast"] {
|
|
752
|
+
animation: toast-slide-in 200ms ease-out both;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/* A toast's countdown bar (data-slot="toast-countdown"): drains left to right over the toast's duration. */
|
|
756
|
+
@keyframes toast-countdown {
|
|
757
|
+
from { transform: scaleX(1); }
|
|
758
|
+
to { transform: scaleX(0); }
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/* SortableBoard's drag overlay settling after a swing: a damped pendulum from --swing-from. */
|
|
762
|
+
@keyframes bridge-ui-swing-settle {
|
|
763
|
+
0% { transform: rotate(var(--swing-from)); }
|
|
764
|
+
20% { transform: rotate(calc(var(--swing-from) * -0.35)); }
|
|
765
|
+
40% { transform: rotate(calc(var(--swing-from) * 0.18)); }
|
|
766
|
+
60% { transform: rotate(calc(var(--swing-from) * -0.08)); }
|
|
767
|
+
80% { transform: rotate(calc(var(--swing-from) * 0.03)); }
|
|
768
|
+
100% { transform: rotate(0deg); }
|
|
769
|
+
}`);
|
|
770
|
+
return sections.join("\n") + "\n";
|
|
771
|
+
}
|
|
772
|
+
function themeTokens(palettes) {
|
|
773
|
+
const tokens = /* @__PURE__ */ new Map();
|
|
774
|
+
for (const { id, type, wallpaper } of THEMES) {
|
|
775
|
+
if (wallpaper) {
|
|
776
|
+
const { input: input2, paint } = wallpaperPalette(void 0, type);
|
|
777
|
+
paints.set(id, { c1: oklchToString(paint.c1), c2: oklchToString(paint.c2) });
|
|
778
|
+
tokens.set(id, { input: input2, tokens: mapPaletteToTokens(derivePalette(input2)) });
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
const input = loadPalette(join(palettes, `${id}.yaml`));
|
|
782
|
+
if (input.name !== id)
|
|
783
|
+
throw new Error(
|
|
784
|
+
`themes-default/themes/${id}.yaml: name "${input.name}" does not match its file`
|
|
785
|
+
);
|
|
786
|
+
if (input.type !== type)
|
|
787
|
+
throw new Error(
|
|
788
|
+
`themes-default/themes/${id}.yaml: type "${input.type}" but THEMES says "${type}"`
|
|
789
|
+
);
|
|
790
|
+
tokens.set(id, { input, tokens: mapPaletteToTokens(derivePalette(input)) });
|
|
791
|
+
}
|
|
792
|
+
return tokens;
|
|
793
|
+
}
|
|
794
|
+
function generateThemeCss(palettes) {
|
|
795
|
+
return generateTokensCss(themeTokens(palettes));
|
|
796
|
+
}
|
|
797
|
+
var themeName = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
798
|
+
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
799
|
+
function colourOf(value) {
|
|
800
|
+
if (typeof value !== "string") return value;
|
|
801
|
+
const hex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(value.trim())?.[1];
|
|
802
|
+
if (hex === void 0) return value;
|
|
803
|
+
const full = hex.length === 3 ? [...hex].map((digit) => digit + digit).join("") : hex;
|
|
804
|
+
const [r, g, b] = [0, 2, 4].map((at) => parseInt(full.slice(at, at + 2), 16));
|
|
805
|
+
return oklchToString(rgbToOklch(r, g, b));
|
|
806
|
+
}
|
|
807
|
+
function packTheme(raw, palettes) {
|
|
808
|
+
if (!isObject(raw)) throw new Error("a theme file is an object: name, type, bg, fg\u2026");
|
|
809
|
+
const { name, type, label, tokens } = raw;
|
|
810
|
+
if (typeof name !== "string" || !themeName.test(name) || name.length > 40)
|
|
811
|
+
throw new Error(
|
|
812
|
+
"name is kebab-case (lowercase letters, digits, single hyphens), at most 40 characters"
|
|
813
|
+
);
|
|
814
|
+
if (THEMES.some((theme) => theme.id === name))
|
|
815
|
+
throw new Error(`name ${name} is one of Bridge's own themes: choose another`);
|
|
816
|
+
if (type !== "light" && type !== "dark") throw new Error('type is "light" or "dark"');
|
|
817
|
+
if (label !== void 0 && (typeof label !== "string" || label.length === 0 || label.length > 60))
|
|
818
|
+
throw new Error("label is a text of 1 to 60 characters");
|
|
819
|
+
const fallback = defaultRaw(type, palettes);
|
|
820
|
+
const hues = isObject(raw.hues) ? raw.hues : {};
|
|
821
|
+
const paint = isObject(raw.paint) ? raw.paint : {};
|
|
822
|
+
const merged = {
|
|
823
|
+
...fallback,
|
|
824
|
+
name,
|
|
825
|
+
type,
|
|
826
|
+
accent: raw.accent ?? fallback.accent,
|
|
827
|
+
bg: colourOf(raw.bg),
|
|
828
|
+
fg: colourOf(raw.fg),
|
|
829
|
+
hues: Object.fromEntries(
|
|
830
|
+
Object.entries(fallback.hues).map(([hue, value]) => [
|
|
831
|
+
hue,
|
|
832
|
+
colourOf(hues[hue] ?? brightOf(hues, hue, type) ?? value)
|
|
833
|
+
])
|
|
834
|
+
),
|
|
835
|
+
paint: {
|
|
836
|
+
c1: colourOf(paint.c1 ?? fallback.paint.c1),
|
|
837
|
+
c2: colourOf(paint.c2 ?? fallback.paint.c2)
|
|
838
|
+
},
|
|
839
|
+
...Object.fromEntries(
|
|
840
|
+
["accent-fg", "sidebar", "fg-muted"].map((key) => [key, colourOf(raw[key])])
|
|
841
|
+
)
|
|
842
|
+
};
|
|
843
|
+
for (const key of ["bg", "fg"])
|
|
844
|
+
if (typeof merged[key] !== "string" || !parseOklch(merged[key]))
|
|
845
|
+
throw new Error(`${key} is a colour: oklch(\u2026) or #rrggbb`);
|
|
846
|
+
const input = readPalette(merged, name);
|
|
847
|
+
const derived = mapPaletteToTokens(derivePalette(input));
|
|
848
|
+
const overrides = [];
|
|
849
|
+
if (tokens !== void 0) {
|
|
850
|
+
if (!isObject(tokens)) throw new Error('tokens is an object: { "--border": "oklch(\u2026)" }');
|
|
851
|
+
for (const [token, value] of Object.entries(tokens)) {
|
|
852
|
+
if (!/^--[a-z0-9-]+$/.test(token))
|
|
853
|
+
throw new Error(`tokens.${token}: a token is --kebab-case`);
|
|
854
|
+
const colour = colourOf(value);
|
|
855
|
+
if (typeof colour !== "string" || colour.length > 200 || /[;{}<>\\]/.test(colour))
|
|
856
|
+
throw new Error(`tokens.${token}: a CSS value without ; { } < > or \\`);
|
|
857
|
+
derived.colors[token] = colour;
|
|
858
|
+
overrides.push(` ${token}: ${colour};`);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
const info = { id: name, label: label ?? humanizeName(name), type };
|
|
862
|
+
return {
|
|
863
|
+
info,
|
|
864
|
+
css: `[data-theme="${name}"] {
|
|
865
|
+
${formatColorBlock(derived, " ", paints.get(name))}
|
|
866
|
+
${overrides.map((line) => `${line}
|
|
867
|
+
`).join("")}}
|
|
868
|
+
`
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
function brightOf(hues, hue, type) {
|
|
872
|
+
const normal = hue.endsWith("-bright") ? colourOf(hues[hue.slice(0, -7)]) : void 0;
|
|
873
|
+
const parsed = typeof normal === "string" ? parseOklch(normal) : null;
|
|
874
|
+
if (!parsed) return void 0;
|
|
875
|
+
return oklchToString({ ...parsed, l: parsed.l + (type === "dark" ? 0.08 : -0.09) });
|
|
876
|
+
}
|
|
877
|
+
var humanizeName = (name) => name.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
878
|
+
var defaultRaws = /* @__PURE__ */ new Map();
|
|
879
|
+
function defaultRaw(type, palettes) {
|
|
880
|
+
const file = join(palettes, `${DEFAULT_THEME[type]}.yaml`);
|
|
881
|
+
let raw = defaultRaws.get(file);
|
|
882
|
+
if (raw === void 0) {
|
|
883
|
+
raw = parseYaml(readFileSync(file, "utf-8"));
|
|
884
|
+
defaultRaws.set(file, raw);
|
|
885
|
+
}
|
|
886
|
+
return raw;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
// src/theme/theme-css.ts
|
|
890
|
+
var packageRoot = (dir) => existsSync(join2(dir, "package.json")) ? dir : packageRoot(dirname(dir));
|
|
891
|
+
var kitSources = join2(packageRoot(dirname(fileURLToPath(import.meta.url))), "src");
|
|
892
|
+
export {
|
|
893
|
+
generateThemeCss,
|
|
894
|
+
kitSources,
|
|
895
|
+
packTheme
|
|
896
|
+
};
|