@parallelworks/ui 0.44.0 → 0.46.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/README.md +348 -25
- package/dist/ai/agent/diff.d.ts +2 -1
- package/dist/ai/agent/diff.js +4 -12
- package/dist/ai/agent/diffHighlight.d.ts +1 -1
- package/dist/ai/agent/diffHighlight.js +4 -3
- package/dist/ai/agent/index.d.ts +2 -1
- package/dist/ai/agent/permissions.d.ts +1 -1
- package/dist/ai/agent/permissions.js +1 -1
- package/dist/ai/agent/toolStrings.d.ts +37 -0
- package/dist/ai/agent/toolStrings.js +35 -0
- package/dist/ai/agent/toolfmt.d.ts +8 -3
- package/dist/ai/agent/toolfmt.js +50 -65
- package/dist/ai/ai.css +22 -35
- package/dist/ai/components/AllocationSelector.js +2 -2
- package/dist/ai/components/AttachmentManager.js +28 -29
- package/dist/ai/components/AttachmentUpload.js +25 -30
- package/dist/ai/components/BlockedGroupBanner.js +2 -2
- package/dist/ai/components/BranchNavigator.js +3 -4
- package/dist/ai/components/ChatEmptyState.js +8 -7
- package/dist/ai/components/ChatInput.js +10 -12
- package/dist/ai/components/ChatLayout.js +3 -3
- package/dist/ai/components/ChatMessage.js +49 -61
- package/dist/ai/components/ChatMessageList.js +46 -42
- package/dist/ai/components/ChatSidebar.js +26 -34
- package/dist/ai/components/ChatStage.d.ts +1 -1
- package/dist/ai/components/ChatStage.js +2 -2
- package/dist/ai/components/ComposerChrome.js +3 -4
- package/dist/ai/components/DragOverlay.js +6 -4
- package/dist/ai/components/ModelSelector.js +14 -15
- package/dist/ai/components/PastedText.js +18 -14
- package/dist/ai/components/ProviderIssueBanner.js +3 -4
- package/dist/ai/components/Reasoning.d.ts +12 -6
- package/dist/ai/components/Reasoning.js +31 -18
- package/dist/ai/components/ShareDialog.js +25 -28
- package/dist/ai/components/SlashMenu.js +3 -3
- package/dist/ai/components/agent/ActivityLine.d.ts +0 -5
- package/dist/ai/components/agent/ActivityLine.js +17 -54
- package/dist/ai/components/agent/AgentMessageParts.js +139 -149
- package/dist/ai/components/conversationActions.js +16 -16
- package/dist/ai/core/ChatProvider.d.ts +2 -4
- package/dist/ai/core/ChatProvider.js +25 -38
- package/dist/ai/core/exportConversation.js +4 -4
- package/dist/ai/core/pasteLanguage.d.ts +1 -1
- package/dist/ai/core/pasteLanguage.js +1 -1
- package/dist/ai/core/sidebarState.d.ts +8 -6
- package/dist/ai/core/sidebarState.js +21 -28
- package/dist/ai/core/useKeyboardShortcuts.js +14 -5
- package/dist/ai/index.d.ts +4 -5
- package/dist/ai/index.js +7 -7
- package/dist/ai/strings.d.ts +14 -31
- package/dist/ai/strings.js +19 -39
- package/dist/ai/types.d.ts +0 -5
- package/dist/ai/ui/ConversationSidebar.d.ts +12 -9
- package/dist/ai/ui/ConversationSidebar.js +43 -87
- package/dist/ai/ui/Markdown.d.ts +3 -6
- package/dist/ai/ui/Markdown.js +6 -73
- package/dist/ai/ui/Notice.js +10 -12
- package/dist/ai/ui/chip.d.ts +2 -2
- package/dist/ai/ui/chip.js +1 -1
- package/dist/ai/ui/sidebar.d.ts +4 -20
- package/dist/ai/ui/sidebar.js +30 -67
- package/dist/ai/utils.d.ts +0 -1
- package/dist/ai/utils.js +1 -14
- package/dist/brandIcons.d.ts +51 -0
- package/dist/brandIcons.js +75 -0
- package/dist/components/Avatar.d.ts +3 -1
- package/dist/components/Avatar.js +34 -28
- package/dist/components/Button.d.ts +12 -7
- package/dist/components/Button.js +39 -44
- package/dist/components/Callout.js +18 -12
- package/dist/components/Card.d.ts +18 -8
- package/dist/components/Card.js +17 -6
- package/dist/components/Checkbox.d.ts +9 -0
- package/dist/components/Checkbox.js +30 -0
- package/dist/components/Combobox.d.ts +9 -1
- package/dist/components/Combobox.js +71 -44
- package/dist/components/ConfirmModal.js +11 -11
- package/dist/components/ContextMenu.d.ts +2 -8
- package/dist/components/ContextMenu.js +2 -29
- package/dist/components/CopyToClipboard.js +17 -36
- package/dist/components/CreateModal.d.ts +3 -24
- package/dist/components/CreateModal.js +46 -113
- package/dist/components/DatePicker.d.ts +31 -0
- package/dist/components/DatePicker.js +191 -0
- package/dist/components/DescriptionList.js +4 -4
- package/dist/components/Disclosure.d.ts +34 -0
- package/dist/components/Disclosure.js +46 -0
- package/dist/components/Drawer.d.ts +47 -0
- package/dist/components/Drawer.js +120 -0
- package/dist/components/EmptyState.d.ts +15 -10
- package/dist/components/EmptyState.js +13 -8
- package/dist/components/ExternalLink.d.ts +8 -0
- package/dist/components/ExternalLink.js +29 -0
- package/dist/components/Field.d.ts +70 -0
- package/dist/components/Field.js +159 -0
- package/dist/components/HoverCard.js +11 -14
- package/dist/components/IconButton.d.ts +16 -13
- package/dist/components/IconButton.js +27 -18
- package/dist/components/InfoTip.js +16 -23
- package/dist/components/Input.d.ts +10 -9
- package/dist/components/Input.js +54 -96
- package/dist/components/LetterBadge.js +2 -2
- package/dist/components/Loader.d.ts +15 -8
- package/dist/components/Loader.js +29 -19
- package/dist/components/Markdown.d.ts +7 -1
- package/dist/components/Markdown.js +2 -0
- package/dist/components/MarkdownImpl.d.ts +1 -1
- package/dist/components/MarkdownImpl.js +55 -14
- package/dist/components/Menu.js +13 -15
- package/dist/components/MenuEntries.js +11 -16
- package/dist/components/Meter.d.ts +48 -0
- package/dist/components/Meter.js +94 -0
- package/dist/components/Modal.js +11 -14
- package/dist/components/NumberInput.d.ts +25 -0
- package/dist/components/NumberInput.js +55 -0
- package/dist/components/Overview.js +12 -10
- package/dist/components/PageHeader.d.ts +2 -3
- package/dist/components/PageHeader.js +30 -21
- package/dist/components/Pagination.d.ts +27 -14
- package/dist/components/Pagination.js +86 -25
- package/dist/components/Popover.d.ts +47 -0
- package/dist/components/Popover.js +63 -0
- package/dist/components/Provider.d.ts +200 -83
- package/dist/components/Provider.js +203 -121
- package/dist/components/Radio.d.ts +1 -1
- package/dist/components/Radio.js +4 -4
- package/dist/components/RefreshButton.d.ts +15 -0
- package/dist/components/RefreshButton.js +53 -0
- package/dist/components/RunStatusIcon.d.ts +12 -0
- package/dist/components/RunStatusIcon.js +84 -0
- package/dist/components/SearchInput.d.ts +16 -0
- package/dist/components/SearchInput.js +52 -0
- package/dist/components/Section.d.ts +28 -0
- package/dist/components/Section.js +76 -0
- package/dist/components/SegmentedControl.d.ts +7 -11
- package/dist/components/SegmentedControl.js +25 -56
- package/dist/components/Select.d.ts +5 -1
- package/dist/components/Select.js +43 -44
- package/dist/components/SettingModeOption.d.ts +3 -5
- package/dist/components/SettingModeOption.js +5 -6
- package/dist/components/SettingsCard.d.ts +32 -19
- package/dist/components/SettingsCard.js +40 -13
- package/dist/components/Skeleton.d.ts +22 -0
- package/dist/components/Skeleton.js +34 -0
- package/dist/components/Slider.d.ts +16 -0
- package/dist/components/Slider.js +30 -0
- package/dist/components/Sort.js +4 -6
- package/dist/components/StatusBadge.d.ts +5 -3
- package/dist/components/StatusBadge.js +10 -33
- package/dist/components/StatusIcons.d.ts +0 -4
- package/dist/components/StatusIcons.js +5 -13
- package/dist/components/Switch.d.ts +5 -1
- package/dist/components/Switch.js +23 -6
- package/dist/components/Table.js +13 -20
- package/dist/components/Tabs.d.ts +52 -0
- package/dist/components/Tabs.js +75 -0
- package/dist/components/ThemeEditor.d.ts +29 -0
- package/dist/components/ThemeEditor.js +397 -0
- package/dist/components/Toast.d.ts +57 -0
- package/dist/components/Toast.js +203 -0
- package/dist/components/Tooltip.js +12 -15
- package/dist/components/buttonClasses.d.ts +18 -0
- package/dist/components/buttonClasses.js +31 -0
- package/dist/components/codeTheme.d.ts +5 -0
- package/dist/components/codeTheme.js +93 -0
- package/dist/components/comboboxItems.d.ts +1 -1
- package/dist/components/fieldBox.d.ts +14 -0
- package/dist/components/fieldBox.js +29 -0
- package/dist/components/floating.d.ts +26 -5
- package/dist/components/floating.js +31 -9
- package/dist/{ai/ui/codeBreaks.js → components/markdownCodeBreaks.js} +1 -1
- package/dist/components/persistedState.d.ts +2 -0
- package/dist/components/persistedState.js +63 -0
- package/dist/components/relativeTime.d.ts +36 -8
- package/dist/components/relativeTime.js +106 -23
- package/dist/components/segmented.d.ts +17 -0
- package/dist/components/segmented.js +27 -0
- package/dist/components/shortcutKey.d.ts +4 -0
- package/dist/components/shortcutKey.js +27 -0
- package/dist/components/splitter.d.ts +26 -0
- package/dist/components/splitter.js +69 -0
- package/dist/components/tone.d.ts +9 -0
- package/dist/components/tone.js +30 -0
- package/dist/components/useCopy.d.ts +14 -0
- package/dist/components/useCopy.js +31 -0
- package/dist/components/useCssIsDark.d.ts +2 -0
- package/dist/components/useCssIsDark.js +2 -1
- package/dist/components/useTheme.d.ts +10 -0
- package/dist/components/useTheme.js +40 -0
- package/dist/cx.d.ts +5 -0
- package/dist/cx.js +11 -0
- package/dist/editing.d.ts +1 -1
- package/dist/editor/Editor.js +2 -2
- package/dist/editor/EditorField.js +7 -10
- package/dist/editor/FormCodePanel.js +10 -23
- package/dist/editor/Monaco.js +7 -4
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.js +2 -2
- package/dist/editor/themes.d.ts +4 -0
- package/dist/editor/themes.js +75 -76
- package/dist/file-explorer/FileExplorer.js +180 -187
- package/dist/file-explorer/FileExplorerContext.js +45 -67
- package/dist/file-explorer/FilePreview/CodePreviewEditor.js +2 -1
- package/dist/file-explorer/FilePreview/Inline.js +9 -7
- package/dist/file-explorer/FilePreview/StreamedBadge.js +2 -2
- package/dist/file-explorer/FilePreview/Viewer.js +32 -34
- package/dist/file-explorer/FilePreview/index.js +60 -92
- package/dist/file-explorer/FilePreview/useObjectBlobUrl.js +4 -4
- package/dist/file-explorer/FilePreview/useObjectText.js +4 -4
- package/dist/file-explorer/FilePreview/usePresignedUrl.js +4 -4
- package/dist/file-explorer/FileRow.js +10 -15
- package/dist/file-explorer/FileRowsWindow.js +2 -6
- package/dist/file-explorer/FileTable.js +2 -2
- package/dist/file-explorer/FileTableHeaders.js +8 -11
- package/dist/file-explorer/LoadMoreRow.js +8 -9
- package/dist/file-explorer/TreeView.js +16 -16
- package/dist/file-explorer/helpers.d.ts +1 -4
- package/dist/file-explorer/helpers.js +101 -114
- package/dist/file-explorer/lib/types.d.ts +2 -2
- package/dist/file-explorer/lib/utils.d.ts +0 -2
- package/dist/file-explorer/lib/utils.js +1 -25
- package/dist/file-explorer/toasts.js +109 -190
- package/dist/form/Fields/BooleanField.js +12 -14
- package/dist/form/Fields/CheckboxGroupField.d.ts +1 -1
- package/dist/form/Fields/CheckboxGroupField.js +16 -18
- package/dist/form/Fields/ColorField.js +11 -11
- package/dist/form/Fields/DropdownField.d.ts +1 -1
- package/dist/form/Fields/DropdownField.js +20 -36
- package/dist/form/Fields/DurationField.d.ts +1 -1
- package/dist/form/Fields/DurationField.js +36 -50
- package/dist/form/Fields/LabelField.js +2 -2
- package/dist/form/Fields/MultiDropdownField.d.ts +1 -1
- package/dist/form/Fields/MultiDropdownField.js +9 -14
- package/dist/form/Fields/NumberField.d.ts +1 -1
- package/dist/form/Fields/NumberField.js +13 -48
- package/dist/form/Fields/ObjectField.js +3 -3
- package/dist/form/Fields/RadioField.d.ts +1 -1
- package/dist/form/Fields/RadioField.js +15 -18
- package/dist/form/Fields/RangeField.js +34 -35
- package/dist/form/Fields/StringField.d.ts +1 -1
- package/dist/form/Fields/StringField.js +15 -25
- package/dist/form/Fields/TextAreaField.js +10 -15
- package/dist/form/Form.d.ts +7 -2
- package/dist/form/Form.js +144 -49
- package/dist/form/FormLayout.js +18 -12
- package/dist/form/Wizard/WizardContainer.js +44 -18
- package/dist/form/Wizard/WizardNavigation.d.ts +1 -1
- package/dist/form/Wizard/WizardNavigation.js +31 -56
- package/dist/form/Wizard/WizardStepIndicator.d.ts +3 -0
- package/dist/form/Wizard/WizardStepIndicator.js +98 -114
- package/dist/form/Wizard/types.d.ts +2 -2
- package/dist/form/fieldFrame.d.ts +7 -0
- package/dist/form/fieldFrame.js +19 -0
- package/dist/form/index.d.ts +5 -5
- package/dist/form/index.js +4 -6
- package/dist/form/layoutCSS.js +5 -4
- package/dist/form/types/fieldComponentTypes.d.ts +5 -3
- package/dist/form/useChoiceField.js +2 -3
- package/dist/form/useFieldValue.d.ts +3 -0
- package/dist/form/useFieldValue.js +24 -7
- package/dist/form/utils/duration.d.ts +2 -2
- package/dist/form/utils/duration.js +3 -3
- package/dist/form/utils/fieldItems.d.ts +1 -1
- package/dist/form/utils/fieldPath.d.ts +5 -3
- package/dist/form/utils/fieldPath.js +18 -3
- package/dist/form/utils/secondaryField.d.ts +0 -7
- package/dist/form/utils/secondaryField.js +1 -12
- package/dist/form/validation.d.ts +29 -0
- package/dist/form/validation.js +14 -0
- package/dist/format.d.ts +28 -0
- package/dist/format.js +64 -0
- package/dist/graph/AnnotationBanner.js +20 -31
- package/dist/graph/Connectors.js +1 -1
- package/dist/graph/DependencyGraph.js +51 -65
- package/dist/graph/GraphEditor.js +24 -28
- package/dist/graph/GraphEditorDialogs.js +239 -245
- package/dist/graph/InputDialog.js +93 -112
- package/dist/graph/InputsEditor.js +83 -84
- package/dist/graph/JobSummary.js +10 -11
- package/dist/graph/MatrixGroup.js +3 -3
- package/dist/graph/ProblemsButton.js +9 -10
- package/dist/graph/ShortcutsButton.js +12 -17
- package/dist/graph/SuggestionInput.d.ts +2 -3
- package/dist/graph/SuggestionInput.js +2 -4
- package/dist/graph/TreeView.js +47 -45
- package/dist/graph/WorkflowSettingsDialog.js +97 -102
- package/dist/graph/editorChrome.js +10 -12
- package/dist/graph/editorFields.d.ts +19 -16
- package/dist/graph/editorFields.js +97 -135
- package/dist/graph/editorPrimitives.d.ts +2 -2
- package/dist/graph/editorPrimitives.js +3 -3
- package/dist/graph/editorRows.js +22 -25
- package/dist/graph/editorStrings.d.ts +18 -21
- package/dist/graph/editorStrings.js +15 -27
- package/dist/graph/fieldProblems.js +2 -2
- package/dist/graph/graphEditorState.d.ts +4 -4
- package/dist/graph/inputRefs.d.ts +0 -13
- package/dist/graph/inputRefs.js +122 -160
- package/dist/graph/settingsViews.js +5 -3
- package/dist/graph/stepWith.js +100 -100
- package/dist/graph/toolbarPanel.d.ts +8 -0
- package/dist/graph/toolbarPanel.js +11 -0
- package/dist/icons.d.ts +234 -23
- package/dist/icons.js +249 -264
- package/dist/index.d.ts +38 -21
- package/dist/index.js +42 -21
- package/dist/list/ActionToolbar.d.ts +1 -5
- package/dist/list/ActionToolbar.js +21 -20
- package/dist/list/ListPage.js +7 -7
- package/dist/list/ListTable.d.ts +3 -2
- package/dist/list/ListTable.js +33 -29
- package/dist/list/ListViewControls.d.ts +0 -17
- package/dist/list/ListViewControls.js +50 -118
- package/dist/list/UserHoverCard.js +24 -32
- package/dist/list/index.d.ts +2 -4
- package/dist/list/index.js +3 -5
- package/dist/list/listSearch.d.ts +1 -1
- package/dist/list/listSearch.js +19 -14
- package/dist/list/rowMenu.js +20 -26
- package/dist/logviewer/LogViewer.js +268 -382
- package/dist/logviewer/logviewer.css +53 -41
- package/dist/logviewer/segments.d.ts +1 -1
- package/dist/logviewer/segments.js +1 -1
- package/dist/styles/base.css +16 -40
- package/dist/styles/theme.css +75 -106
- package/dist/styles.css +1 -1
- package/dist/theme/color.d.ts +40 -0
- package/dist/theme/color.js +228 -0
- package/dist/theme/contrast.d.ts +42 -0
- package/dist/theme/contrast.js +145 -0
- package/dist/theme/derive.d.ts +25 -0
- package/dist/theme/derive.js +475 -0
- package/dist/theme/fit.d.ts +35 -0
- package/dist/theme/fit.js +185 -0
- package/dist/theme/index.d.ts +14 -29
- package/dist/theme/index.js +20 -279
- package/dist/theme/model.d.ts +64 -0
- package/dist/theme/model.js +219 -0
- package/package.json +9 -5
- package/dist/ai/ui/Avatar.d.ts +0 -7
- package/dist/ai/ui/Avatar.js +0 -24
- package/dist/components/Filter.d.ts +0 -15
- package/dist/components/Filter.js +0 -32
- package/dist/components/FilterPill.d.ts +0 -7
- package/dist/components/FilterPill.js +0 -14
- package/dist/components/Indicator.d.ts +0 -4
- package/dist/components/Indicator.js +0 -44
- package/dist/components/SectionHeader.d.ts +0 -8
- package/dist/components/SectionHeader.js +0 -11
- package/dist/components/SettingRow.d.ts +0 -18
- package/dist/components/SettingRow.js +0 -35
- package/dist/components/SettingsGroup.d.ts +0 -8
- package/dist/components/SettingsGroup.js +0 -17
- package/dist/components/ghostButton.d.ts +0 -4
- package/dist/components/ghostButton.js +0 -7
- package/dist/components/inputClasses.d.ts +0 -1
- package/dist/components/inputClasses.js +0 -4
- package/dist/duration.d.ts +0 -3
- package/dist/duration.js +0 -17
- package/dist/form/FieldGroup.d.ts +0 -11
- package/dist/form/FieldGroup.js +0 -36
- package/dist/form/FieldWrapper.d.ts +0 -16
- package/dist/form/FieldWrapper.js +0 -55
- package/dist/form/fieldContext.d.ts +0 -19
- package/dist/form/fieldContext.js +0 -26
- package/dist/graph/Collapse.d.ts +0 -7
- package/dist/graph/Collapse.js +0 -15
- package/dist/graph/ToolbarPopover.d.ts +0 -13
- package/dist/graph/ToolbarPopover.js +0 -39
- package/dist/icons/ai/AiOutlineRollback.js +0 -16
- package/dist/icons/bi/BiBell.js +0 -16
- package/dist/icons/bi/BiBellOff.js +0 -16
- package/dist/icons/bi/BiBuildings.js +0 -20
- package/dist/icons/bi/BiError.js +0 -20
- package/dist/icons/bi/BiExpandVertical.js +0 -16
- package/dist/icons/bi/BiPause.js +0 -16
- package/dist/icons/bi/BiPlay.js +0 -16
- package/dist/icons/bi/BiRedo.js +0 -16
- package/dist/icons/bi/BiSolidCheckShield.js +0 -16
- package/dist/icons/bi/BiSolidTrashAlt.js +0 -16
- package/dist/icons/bi/BiStop.js +0 -16
- package/dist/icons/bi/BiUndo.js +0 -16
- package/dist/icons/bs/BsArrowsCollapse.js +0 -22
- package/dist/icons/bs/BsBank2.js +0 -19
- package/dist/icons/bs/BsBriefcase.js +0 -19
- package/dist/icons/bs/BsBucket.js +0 -19
- package/dist/icons/bs/BsCalendarX.js +0 -23
- package/dist/icons/bs/BsChatLeft.js +0 -19
- package/dist/icons/bs/BsChevronDoubleDown.js +0 -29
- package/dist/icons/bs/BsChevronDoubleUp.js +0 -29
- package/dist/icons/bs/BsClipboardCheck.js +0 -34
- package/dist/icons/bs/BsCurrencyDollar.js +0 -19
- package/dist/icons/bs/BsDash.js +0 -19
- package/dist/icons/bs/BsFileEarmarkZip.js +0 -23
- package/dist/icons/bs/BsFiles.js +0 -19
- package/dist/icons/bs/BsGeoAlt.js +0 -23
- package/dist/icons/bs/BsGrid.js +0 -19
- package/dist/icons/bs/BsLayers.js +0 -19
- package/dist/icons/bs/BsLayoutThreeColumns.js +0 -19
- package/dist/icons/bs/BsListUl.js +0 -22
- package/dist/icons/bs/BsMortarboard.js +0 -23
- package/dist/icons/bs/BsMusicNoteBeamed.js +0 -34
- package/dist/icons/bs/BsOpenai.js +0 -19
- package/dist/icons/bs/BsPersonPlus.js +0 -26
- package/dist/icons/bs/BsSearch.js +0 -19
- package/dist/icons/bs/BsSend.js +0 -19
- package/dist/icons/bs/BsShieldSlash.js +0 -22
- package/dist/icons/bs/BsStar.js +0 -19
- package/dist/icons/bs/BsStarFill.js +0 -19
- package/dist/icons/bs/BsStopCircle.js +0 -23
- package/dist/icons/bs/BsTag.js +0 -23
- package/dist/icons/bs/BsTelephone.js +0 -19
- package/dist/icons/bs/BsTerminal.js +0 -23
- package/dist/icons/bs/BsTerminalFill.js +0 -19
- package/dist/icons/bs/BsThreeDots.js +0 -19
- package/dist/icons/bs/BsThreeDotsVertical.js +0 -19
- package/dist/icons/bs/BsZoomIn.js +0 -37
- package/dist/icons/fa/FaAmazon.js +0 -16
- package/dist/icons/fa/FaAngleDown.js +0 -16
- package/dist/icons/fa/FaAngleLeft.js +0 -16
- package/dist/icons/fa/FaAngleRight.js +0 -16
- package/dist/icons/fa/FaAngleUp.js +0 -16
- package/dist/icons/fa/FaArrowDown.js +0 -16
- package/dist/icons/fa/FaArrowLeft.js +0 -16
- package/dist/icons/fa/FaArrowRight.js +0 -16
- package/dist/icons/fa/FaArrowUp.js +0 -16
- package/dist/icons/fa/FaBalanceScale.js +0 -16
- package/dist/icons/fa/FaCaretDown.js +0 -16
- package/dist/icons/fa/FaCentos.js +0 -16
- package/dist/icons/fa/FaChartLine.js +0 -16
- package/dist/icons/fa/FaChartPie.js +0 -16
- package/dist/icons/fa/FaCheck.js +0 -16
- package/dist/icons/fa/FaChevronDown.js +0 -16
- package/dist/icons/fa/FaChevronUp.js +0 -16
- package/dist/icons/fa/FaChrome.js +0 -16
- package/dist/icons/fa/FaCircleNotch.js +0 -16
- package/dist/icons/fa/FaCloud.js +0 -16
- package/dist/icons/fa/FaCloudDownloadAlt.js +0 -16
- package/dist/icons/fa/FaCog.js +0 -16
- package/dist/icons/fa/FaCogs.js +0 -16
- package/dist/icons/fa/FaComments.js +0 -16
- package/dist/icons/fa/FaCompress.js +0 -16
- package/dist/icons/fa/FaDesktop.js +0 -16
- package/dist/icons/fa/FaDocker.js +0 -16
- package/dist/icons/fa/FaDollarSign.js +0 -16
- package/dist/icons/fa/FaEdge.js +0 -16
- package/dist/icons/fa/FaEdit.js +0 -16
- package/dist/icons/fa/FaExclamationTriangle.js +0 -16
- package/dist/icons/fa/FaExpand.js +0 -16
- package/dist/icons/fa/FaEye.js +0 -16
- package/dist/icons/fa/FaEyeSlash.js +0 -16
- package/dist/icons/fa/FaFile.js +0 -16
- package/dist/icons/fa/FaFilePdf.js +0 -16
- package/dist/icons/fa/FaFilter.js +0 -16
- package/dist/icons/fa/FaFirefoxBrowser.js +0 -16
- package/dist/icons/fa/FaFlask.js +0 -16
- package/dist/icons/fa/FaFolder.js +0 -16
- package/dist/icons/fa/FaGithub.js +0 -16
- package/dist/icons/fa/FaGitlab.js +0 -16
- package/dist/icons/fa/FaGlobe.js +0 -16
- package/dist/icons/fa/FaGlobeAmericas.js +0 -16
- package/dist/icons/fa/FaImage.js +0 -16
- package/dist/icons/fa/FaInfoCircle.js +0 -16
- package/dist/icons/fa/FaKey.js +0 -16
- package/dist/icons/fa/FaLayerGroup.js +0 -16
- package/dist/icons/fa/FaLink.js +0 -16
- package/dist/icons/fa/FaLinkedin.js +0 -16
- package/dist/icons/fa/FaLinux.js +0 -16
- package/dist/icons/fa/FaList.js +0 -16
- package/dist/icons/fa/FaLock.js +0 -16
- package/dist/icons/fa/FaOpenid.js +0 -16
- package/dist/icons/fa/FaOpera.js +0 -16
- package/dist/icons/fa/FaPaperclip.js +0 -16
- package/dist/icons/fa/FaPlus.js +0 -16
- package/dist/icons/fa/FaPowerOff.js +0 -16
- package/dist/icons/fa/FaPrint.js +0 -16
- package/dist/icons/fa/FaQrcode.js +0 -16
- package/dist/icons/fa/FaQuestionCircle.js +0 -16
- package/dist/icons/fa/FaRedhat.js +0 -16
- package/dist/icons/fa/FaRegCircle.js +0 -16
- package/dist/icons/fa/FaRegFileImage.js +0 -16
- package/dist/icons/fa/FaRegFolder.js +0 -16
- package/dist/icons/fa/FaRobot.js +0 -16
- package/dist/icons/fa/FaRocket.js +0 -16
- package/dist/icons/fa/FaRunning.js +0 -16
- package/dist/icons/fa/FaSafari.js +0 -16
- package/dist/icons/fa/FaSave.js +0 -16
- package/dist/icons/fa/FaSearch.js +0 -16
- package/dist/icons/fa/FaShieldAlt.js +0 -16
- package/dist/icons/fa/FaSlack.js +0 -16
- package/dist/icons/fa/FaStar.js +0 -16
- package/dist/icons/fa/FaStop.js +0 -16
- package/dist/icons/fa/FaSuse.js +0 -16
- package/dist/icons/fa/FaTerminal.js +0 -16
- package/dist/icons/fa/FaTimes.js +0 -16
- package/dist/icons/fa/FaUbuntu.js +0 -16
- package/dist/icons/fa/FaUndoAlt.js +0 -16
- package/dist/icons/fa/FaUnlink.js +0 -16
- package/dist/icons/fa/FaUser.js +0 -16
- package/dist/icons/fa/FaUsers.js +0 -16
- package/dist/icons/fa/FaWindows.js +0 -16
- package/dist/icons/fa6/FaApple.js +0 -16
- package/dist/icons/fa6/FaArrowsRotate.js +0 -16
- package/dist/icons/fa6/FaDebian.js +0 -16
- package/dist/icons/fa6/FaFilterCircleXmark.js +0 -16
- package/dist/icons/fa6/FaInbox.js +0 -16
- package/dist/icons/fa6/FaLocationDot.js +0 -16
- package/dist/icons/fa6/FaRegFilePdf.js +0 -16
- package/dist/icons/fa6/FaRegFolderOpen.js +0 -16
- package/dist/icons/fa6/FaUpRightFromSquare.js +0 -16
- package/dist/icons/fa6/FaWandMagicSparkles.js +0 -16
- package/dist/icons/fa6/FaXTwitter.js +0 -16
- package/dist/icons/fi/FiActivity.js +0 -23
- package/dist/icons/fi/FiAlertCircle.js +0 -49
- package/dist/icons/fi/FiChevronDown.js +0 -23
- package/dist/icons/fi/FiClock.js +0 -31
- package/dist/icons/fi/FiCopy.js +0 -34
- package/dist/icons/fi/FiDownload.js +0 -40
- package/dist/icons/fi/FiFile.js +0 -27
- package/dist/icons/fi/FiFileText.js +0 -55
- package/dist/icons/fi/FiHardDrive.js +0 -55
- package/dist/icons/fi/FiRotateCcw.js +0 -27
- package/dist/icons/fi/FiUpload.js +0 -40
- package/dist/icons/fi/FiX.js +0 -37
- package/dist/icons/fi/FiZap.js +0 -23
- package/dist/icons/gi/GiSpy.js +0 -16
- package/dist/icons/go/GoGitCommit.js +0 -16
- package/dist/icons/go/GoGitPullRequest.js +0 -20
- package/dist/icons/go/GoIssueOpened.js +0 -16
- package/dist/icons/go/GoPlus.js +0 -16
- package/dist/icons/go/GoRepoForked.js +0 -28
- package/dist/icons/go/GoSignOut.js +0 -16
- package/dist/icons/go/GoSkip.js +0 -20
- package/dist/icons/go/GoVideo.js +0 -20
- package/dist/icons/gr/GrCloudComputer.js +0 -20
- package/dist/icons/gr/GrInbox.js +0 -20
- package/dist/icons/gr/GrServerCluster.js +0 -20
- package/dist/icons/gr/GrStorage.js +0 -20
- package/dist/icons/gr/GrTasks.js +0 -20
- package/dist/icons/hi/HiCog.js +0 -24
- package/dist/icons/hi/HiDuplicate.js +0 -24
- package/dist/icons/hi/HiOutlineArchive.js +0 -26
- package/dist/icons/hi/HiOutlineClipboardCopy.js +0 -26
- package/dist/icons/hi/HiOutlineHome.js +0 -26
- package/dist/icons/hi/HiQuestionMarkCircle.js +0 -24
- package/dist/icons/hi/HiServer.js +0 -24
- package/dist/icons/hi2/HiMiniCheckCircle.js +0 -24
- package/dist/icons/hi2/HiMiniLanguage.js +0 -28
- package/dist/icons/hi2/HiMiniMinusCircle.js +0 -24
- package/dist/icons/hi2/HiMiniXCircle.js +0 -24
- package/dist/icons/hi2/HiSparkles.js +0 -24
- package/dist/icons/im/ImSpinner5.js +0 -19
- package/dist/icons/io/IoIosNotifications.js +0 -16
- package/dist/icons/io/IoMdBuild.js +0 -16
- package/dist/icons/io/IoMdClose.js +0 -16
- package/dist/icons/io5/IoCloudUploadOutline.js +0 -32
- package/dist/icons/io5/IoDocumentTextOutline.js +0 -31
- package/dist/icons/io5/IoFileTrayFullOutline.js +0 -31
- package/dist/icons/io5/IoHeart.js +0 -16
- package/dist/icons/io5/IoHeartDislike.js +0 -16
- package/dist/icons/io5/IoHeartOutline.js +0 -22
- package/dist/icons/io5/IoInformationCircleOutline.js +0 -50
- package/dist/icons/io5/IoSettingsOutline.js +0 -22
- package/dist/icons/io5/IoWarningOutline.js +0 -40
- package/dist/icons/lu/LuArrowRight.js +0 -27
- package/dist/icons/lu/LuBadgeCheck.js +0 -27
- package/dist/icons/lu/LuBraces.js +0 -27
- package/dist/icons/lu/LuBrainCircuit.js +0 -101
- package/dist/icons/lu/LuCalendar.js +0 -46
- package/dist/icons/lu/LuCheck.js +0 -23
- package/dist/icons/lu/LuChevronLeft.js +0 -23
- package/dist/icons/lu/LuChevronRight.js +0 -23
- package/dist/icons/lu/LuCode.js +0 -27
- package/dist/icons/lu/LuExternalLink.js +0 -35
- package/dist/icons/lu/LuEye.js +0 -31
- package/dist/icons/lu/LuEyeOff.js +0 -40
- package/dist/icons/lu/LuFolderTree.js +0 -40
- package/dist/icons/lu/LuIdCard.js +0 -55
- package/dist/icons/lu/LuKeyboard.js +0 -71
- package/dist/icons/lu/LuLogs.js +0 -65
- package/dist/icons/lu/LuMail.js +0 -33
- package/dist/icons/lu/LuMegaphone.js +0 -27
- package/dist/icons/lu/LuMoon.js +0 -23
- package/dist/icons/lu/LuNetwork.js +0 -63
- package/dist/icons/lu/LuPartyPopper.js +0 -65
- package/dist/icons/lu/LuSettings2.js +0 -48
- package/dist/icons/lu/LuSheet.js +0 -72
- package/dist/icons/lu/LuShield.js +0 -23
- package/dist/icons/lu/LuSun.js +0 -69
- package/dist/icons/lu/LuTextCursorInput.js +0 -45
- package/dist/icons/lu/LuX.js +0 -27
- package/dist/icons/lu/LuZoomIn.js +0 -59
- package/dist/icons/lu/LuZoomOut.js +0 -49
- package/dist/icons/md/MdClear.js +0 -23
- package/dist/icons/md/MdDragHandle.js +0 -23
- package/dist/icons/md/MdInstallDesktop.js +0 -31
- package/dist/icons/md/MdOutlineAttachMoney.js +0 -23
- package/dist/icons/md/MdOutlineMoneyOff.js +0 -23
- package/dist/icons/md/MdPieChart.js +0 -23
- package/dist/icons/md/MdRefresh.js +0 -23
- package/dist/icons/md/MdReplay.js +0 -23
- package/dist/icons/md/MdSmartphone.js +0 -23
- package/dist/icons/pi/PiArrowBendUpRightBold.js +0 -19
- package/dist/icons/pi/PiPlugsConnectedFill.js +0 -19
- package/dist/icons/pi/PiRectangleDashed.js +0 -19
- package/dist/icons/pi/PiShareBold.js +0 -19
- package/dist/icons/si/SiAnthropic.js +0 -19
- package/dist/icons/si/SiHelm.js +0 -19
- package/dist/icons/si/SiKubernetes.js +0 -19
- package/dist/icons/tb/TbAlertTriangle.js +0 -35
- package/dist/icons/tb/TbAlertTriangleFilled.js +0 -19
- package/dist/icons/tb/TbApi.js +0 -40
- package/dist/icons/tb/TbBrain.js +0 -50
- package/dist/icons/tb/TbBuildingTunnel.js +0 -65
- package/dist/icons/tb/TbEdit.js +0 -35
- package/dist/icons/tb/TbLayoutSidebar.js +0 -27
- package/dist/icons/tb/TbLayoutSidebarLeftCollapse.js +0 -35
- package/dist/icons/tb/TbLayoutSidebarRightCollapse.js +0 -35
- package/dist/icons/tb/TbUser.js +0 -27
- package/dist/icons/tb/TbUserOff.js +0 -35
- package/dist/icons/tb/TbWorldShare.js +0 -55
- package/dist/icons/tb/TbWorldWww.js +0 -65
- package/dist/icons/ti/TiArrowSortedDown.js +0 -20
- package/dist/icons/ti/TiArrowSortedUp.js +0 -20
- package/dist/icons/ti/TiArrowUnsorted.js +0 -20
- package/dist/icons/ti/TiCancel.js +0 -20
- package/dist/icons/vsc/VscChromeMinimize.js +0 -19
- package/dist/icons/vsc/VscJson.js +0 -19
- package/dist/icons/vsc/VscLayoutSidebarLeft.js +0 -19
- package/dist/icons/vsc/VscPass.js +0 -27
- package/dist/icons/vsc/VscSplitHorizontal.js +0 -19
- package/dist/icons/vsc/VscTerminalPowershell.js +0 -19
- package/dist/list/ListPager.d.ts +0 -14
- package/dist/list/ListPager.js +0 -62
- package/dist/list/textEntry.d.ts +0 -2
- package/dist/list/textEntry.js +0 -10
- /package/dist/{ai/ui/codeBreaks.d.ts → components/markdownCodeBreaks.d.ts} +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** A color in OKLCH: lightness 0–1, chroma 0–~0.37, hue in degrees. */
|
|
2
|
+
export interface Oklch {
|
|
3
|
+
l: number;
|
|
4
|
+
c: number;
|
|
5
|
+
h: number;
|
|
6
|
+
}
|
|
7
|
+
type Vec3 = [number, number, number];
|
|
8
|
+
/** An RGB space the generator writes into. Both gamma-encode as sRGB does. */
|
|
9
|
+
export type Gamut = 'srgb' | 'p3';
|
|
10
|
+
/** Parses `#rgb`, `#rrggbb`, `oklch(L C H)` (L as 0–1 or a percentage) or
|
|
11
|
+
* `color(display-p3 r g b)`, or returns null. */
|
|
12
|
+
export declare function parseColor(input: string): Oklch | null;
|
|
13
|
+
/** Like `parseColor`, for colors the code itself wrote. */
|
|
14
|
+
export declare function oklch(input: string): Oklch;
|
|
15
|
+
export declare function toOklab({ l, c, h }: Oklch): Vec3;
|
|
16
|
+
export declare function fromOklab([l, a, b]: Vec3): Oklch;
|
|
17
|
+
/** The color that gamma-encoded channels in a gamut show. */
|
|
18
|
+
export declare function fromRgb(rgb: Vec3, gamut?: Gamut): Oklch;
|
|
19
|
+
/** The distance between two colors in OKLab (ΔEOK). */
|
|
20
|
+
export declare function deltaE(a: Oklch, b: Oklch): number;
|
|
21
|
+
/** About one just-noticeable difference in ΔEOK, as CSS Color 4 uses it. */
|
|
22
|
+
export declare const JND = 0.02;
|
|
23
|
+
/** CSS Color 4's gamut mapping: lower chroma at fixed lightness and hue until
|
|
24
|
+
* clipping the rest is no longer noticeable. Returns channels, 0–1. */
|
|
25
|
+
export declare function gamutMap(color: Oklch, gamut?: Gamut): Vec3;
|
|
26
|
+
/** The sRGB hex a color shows as, gamut-mapped. */
|
|
27
|
+
export declare function toHex(color: Oklch): string;
|
|
28
|
+
/** A color's display-p3 channels, gamut-mapped and rounded as `toP3` writes them. */
|
|
29
|
+
export declare function p3Channels(color: Oklch): Vec3;
|
|
30
|
+
/** `color(display-p3 …)` of a color, gamut-mapped into display-p3, with an optional alpha. */
|
|
31
|
+
export declare function toP3(color: Oklch, alpha?: number): string;
|
|
32
|
+
/** The color a generated color shows as in a gamut. */
|
|
33
|
+
export declare function rendered(color: Oklch, gamut?: Gamut): Oklch;
|
|
34
|
+
/** Part of the way from `a` to `b`, interpolated in OKLab. */
|
|
35
|
+
export declare function mixOklab(a: Oklch, b: Oklch, t: number): Oklch;
|
|
36
|
+
/** `rgba()` of a hex color at an alpha. */
|
|
37
|
+
export declare function withAlpha(hex: string, alpha: number): string;
|
|
38
|
+
/** A color written as a hex, or an `rgba()` over a backdrop, as the hex it shows as. */
|
|
39
|
+
export declare function composite(color: string, backdrop: string): string;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
//#region src/theme/color.ts
|
|
2
|
+
var HEX = /^#?([\da-f]{3}|[\da-f]{6})$/i;
|
|
3
|
+
var OKLCH = /^oklch\(\s*([\d.]+)(%?)\s+([\d.]+)\s+([\d.]+)(?:deg)?\s*\)$/i;
|
|
4
|
+
var P3 = /^color\(\s*display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s*\)$/i;
|
|
5
|
+
/** Parses `#rgb`, `#rrggbb`, `oklch(L C H)` (L as 0–1 or a percentage) or
|
|
6
|
+
* `color(display-p3 r g b)`, or returns null. */
|
|
7
|
+
function parseColor(input) {
|
|
8
|
+
const text = input.trim();
|
|
9
|
+
const hex = HEX.exec(text)?.[1];
|
|
10
|
+
if (hex) {
|
|
11
|
+
const full = hex.length === 3 ? [...hex].map((c) => c + c).join("") : hex;
|
|
12
|
+
return fromRgb([
|
|
13
|
+
0,
|
|
14
|
+
2,
|
|
15
|
+
4
|
|
16
|
+
].map((i) => Number.parseInt(full.slice(i, i + 2), 16) / 255));
|
|
17
|
+
}
|
|
18
|
+
const p3 = P3.exec(text);
|
|
19
|
+
if (p3) {
|
|
20
|
+
const rgb = [
|
|
21
|
+
p3[1],
|
|
22
|
+
p3[2],
|
|
23
|
+
p3[3]
|
|
24
|
+
].map(Number);
|
|
25
|
+
return rgb.every((v) => Number.isFinite(v) && v >= 0 && v <= 1) ? fromRgb(rgb, "p3") : null;
|
|
26
|
+
}
|
|
27
|
+
const m = OKLCH.exec(text);
|
|
28
|
+
if (m) {
|
|
29
|
+
const l = Number(m[1]) / (m[2] ? 100 : 1);
|
|
30
|
+
const c = Number(m[3]);
|
|
31
|
+
const h = Number(m[4]);
|
|
32
|
+
if ([
|
|
33
|
+
l,
|
|
34
|
+
c,
|
|
35
|
+
h
|
|
36
|
+
].every(Number.isFinite) && l >= 0 && l <= 1) return {
|
|
37
|
+
l,
|
|
38
|
+
c,
|
|
39
|
+
h: (h % 360 + 360) % 360
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
/** Like `parseColor`, for colors the code itself wrote. */
|
|
45
|
+
function oklch(input) {
|
|
46
|
+
const color = parseColor(input);
|
|
47
|
+
if (!color) throw new Error(`Invalid color: ${input}`);
|
|
48
|
+
return color;
|
|
49
|
+
}
|
|
50
|
+
var toLinear = (v) => v <= .04045 ? v / 12.92 : ((v + .055) / 1.055) ** 2.4;
|
|
51
|
+
var toGamma = (v) => v <= .0031308 ? 12.92 * v : 1.055 * Math.sign(v) * Math.abs(v) ** (1 / 2.4) - .055;
|
|
52
|
+
function linearSrgbToOklab([r, g, b]) {
|
|
53
|
+
const l = Math.cbrt(.4122214708 * r + .5363325363 * g + .0514459929 * b);
|
|
54
|
+
const m = Math.cbrt(.2119034982 * r + .6806995451 * g + .1073969566 * b);
|
|
55
|
+
const s = Math.cbrt(.0883024619 * r + .2817188376 * g + .6299787005 * b);
|
|
56
|
+
return [
|
|
57
|
+
.2104542553 * l + .793617785 * m - .0040720468 * s,
|
|
58
|
+
1.9779984951 * l - 2.428592205 * m + .4505937099 * s,
|
|
59
|
+
.0259040371 * l + .7827717662 * m - .808675766 * s
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
function oklabToLinearSrgb([L, a, b]) {
|
|
63
|
+
const l = (L + .3963377774 * a + .2158037573 * b) ** 3;
|
|
64
|
+
const m = (L - .1055613458 * a - .0638541728 * b) ** 3;
|
|
65
|
+
const s = (L - .0894841775 * a - 1.291485548 * b) ** 3;
|
|
66
|
+
return [
|
|
67
|
+
4.0767416621 * l - 3.3077115913 * m + .2309699292 * s,
|
|
68
|
+
-1.2684380046 * l + 2.6097574011 * m - .3413193965 * s,
|
|
69
|
+
-.0041960863 * l - .7034186147 * m + 1.707614701 * s
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
var SRGB_TO_P3 = [
|
|
73
|
+
[
|
|
74
|
+
.8224621209,
|
|
75
|
+
.177537879,
|
|
76
|
+
0
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
.0331941989,
|
|
80
|
+
.9668058011,
|
|
81
|
+
0
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
.0170826307,
|
|
85
|
+
.0723974407,
|
|
86
|
+
.9105199286
|
|
87
|
+
]
|
|
88
|
+
];
|
|
89
|
+
var P3_TO_SRGB = [
|
|
90
|
+
[
|
|
91
|
+
1.2249401763,
|
|
92
|
+
-.2249401763,
|
|
93
|
+
0
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
-.0420569547,
|
|
97
|
+
1.0420569547,
|
|
98
|
+
0
|
|
99
|
+
],
|
|
100
|
+
[
|
|
101
|
+
-.0196375546,
|
|
102
|
+
-.0786360456,
|
|
103
|
+
1.0982736001
|
|
104
|
+
]
|
|
105
|
+
];
|
|
106
|
+
var multiply = (m, [r, g, b]) => m.map((row) => row[0] * r + row[1] * g + row[2] * b);
|
|
107
|
+
function toOklab({ l, c, h }) {
|
|
108
|
+
const rad = h * Math.PI / 180;
|
|
109
|
+
return [
|
|
110
|
+
l,
|
|
111
|
+
c * Math.cos(rad),
|
|
112
|
+
c * Math.sin(rad)
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
function fromOklab([l, a, b]) {
|
|
116
|
+
const c = Math.hypot(a, b);
|
|
117
|
+
return {
|
|
118
|
+
l,
|
|
119
|
+
c,
|
|
120
|
+
h: c < 1e-6 ? 0 : (Math.atan2(b, a) * 180 / Math.PI % 360 + 360) % 360
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/** The color that gamma-encoded channels in a gamut show. */
|
|
124
|
+
function fromRgb(rgb, gamut = "srgb") {
|
|
125
|
+
const linear = rgb.map(toLinear);
|
|
126
|
+
return fromOklab(linearSrgbToOklab(gamut === "p3" ? multiply(P3_TO_SRGB, linear) : linear));
|
|
127
|
+
}
|
|
128
|
+
/** Gamma-encoded channels in a gamut, outside 0–1 when the color is out of it. */
|
|
129
|
+
function toRgb(color, gamut) {
|
|
130
|
+
const linear = oklabToLinearSrgb(toOklab(color));
|
|
131
|
+
return (gamut === "p3" ? multiply(SRGB_TO_P3, linear) : linear).map(toGamma);
|
|
132
|
+
}
|
|
133
|
+
var inGamut = (rgb) => rgb.every((v) => v >= -1e-6 && v <= 1.000001);
|
|
134
|
+
var clip = (rgb) => rgb.map((v) => Math.min(1, Math.max(0, v)));
|
|
135
|
+
/** The distance between two colors in OKLab (ΔEOK). */
|
|
136
|
+
function deltaE(a, b) {
|
|
137
|
+
const [l1, a1, b1] = toOklab(a);
|
|
138
|
+
const [l2, a2, b2] = toOklab(b);
|
|
139
|
+
return Math.hypot(l1 - l2, a1 - a2, b1 - b2);
|
|
140
|
+
}
|
|
141
|
+
/** About one just-noticeable difference in ΔEOK, as CSS Color 4 uses it. */
|
|
142
|
+
var JND = .02;
|
|
143
|
+
/** CSS Color 4's gamut mapping: lower chroma at fixed lightness and hue until
|
|
144
|
+
* clipping the rest is no longer noticeable. Returns channels, 0–1. */
|
|
145
|
+
function gamutMap(color, gamut = "srgb") {
|
|
146
|
+
if (color.l >= 1) return [
|
|
147
|
+
1,
|
|
148
|
+
1,
|
|
149
|
+
1
|
|
150
|
+
];
|
|
151
|
+
if (color.l <= 0) return [
|
|
152
|
+
0,
|
|
153
|
+
0,
|
|
154
|
+
0
|
|
155
|
+
];
|
|
156
|
+
const direct = toRgb(color, gamut);
|
|
157
|
+
if (inGamut(direct)) return clip(direct);
|
|
158
|
+
const near = (c) => deltaE(fromRgb(clip(toRgb(c, gamut)), gamut), c) < JND;
|
|
159
|
+
if (near(color)) return clip(direct);
|
|
160
|
+
let lo = 0;
|
|
161
|
+
let hi = color.c;
|
|
162
|
+
let current = { ...color };
|
|
163
|
+
while (hi - lo > 1e-4) {
|
|
164
|
+
current = {
|
|
165
|
+
...color,
|
|
166
|
+
c: (lo + hi) / 2
|
|
167
|
+
};
|
|
168
|
+
const rgb = toRgb(current, gamut);
|
|
169
|
+
if (inGamut(rgb)) lo = current.c;
|
|
170
|
+
else if (near(current)) return clip(rgb);
|
|
171
|
+
else hi = current.c;
|
|
172
|
+
}
|
|
173
|
+
return clip(toRgb(current, gamut));
|
|
174
|
+
}
|
|
175
|
+
/** The sRGB hex a color shows as, gamut-mapped. */
|
|
176
|
+
function toHex(color) {
|
|
177
|
+
return `#${gamutMap(color).map((v) => Math.round(v * 255).toString(16).padStart(2, "0")).join("")}`;
|
|
178
|
+
}
|
|
179
|
+
/** A color's display-p3 channels, gamut-mapped and rounded as `toP3` writes them. */
|
|
180
|
+
function p3Channels(color) {
|
|
181
|
+
return gamutMap(color, "p3").map((v) => Number(v.toFixed(4)));
|
|
182
|
+
}
|
|
183
|
+
/** `color(display-p3 …)` of a color, gamut-mapped into display-p3, with an optional alpha. */
|
|
184
|
+
function toP3(color, alpha) {
|
|
185
|
+
const [r, g, b] = p3Channels(color);
|
|
186
|
+
return `color(display-p3 ${r} ${g} ${b}${alpha === void 0 ? "" : ` / ${Number(alpha.toFixed(3))}`})`;
|
|
187
|
+
}
|
|
188
|
+
/** The color a generated color shows as in a gamut. */
|
|
189
|
+
function rendered(color, gamut = "srgb") {
|
|
190
|
+
return gamut === "p3" ? fromRgb(p3Channels(color), "p3") : oklch(toHex(color));
|
|
191
|
+
}
|
|
192
|
+
/** Part of the way from `a` to `b`, interpolated in OKLab. */
|
|
193
|
+
function mixOklab(a, b, t) {
|
|
194
|
+
const x = toOklab(a);
|
|
195
|
+
const y = toOklab(b);
|
|
196
|
+
return fromOklab([
|
|
197
|
+
0,
|
|
198
|
+
1,
|
|
199
|
+
2
|
|
200
|
+
].map((i) => x[i] + (y[i] - x[i]) * t));
|
|
201
|
+
}
|
|
202
|
+
/** `rgba()` of a hex color at an alpha. */
|
|
203
|
+
function withAlpha(hex, alpha) {
|
|
204
|
+
const [r, g, b] = [
|
|
205
|
+
1,
|
|
206
|
+
3,
|
|
207
|
+
5
|
|
208
|
+
].map((i) => Number.parseInt(hex.slice(i, i + 2), 16));
|
|
209
|
+
return `rgba(${r}, ${g}, ${b}, ${Number(alpha.toFixed(3))})`;
|
|
210
|
+
}
|
|
211
|
+
/** A color written as a hex, or an `rgba()` over a backdrop, as the hex it shows as. */
|
|
212
|
+
function composite(color, backdrop) {
|
|
213
|
+
const m = /^rgba\(\s*(\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\s*\)$/.exec(color.trim());
|
|
214
|
+
if (!m) return color;
|
|
215
|
+
const alpha = Number(m[4]);
|
|
216
|
+
const under = [
|
|
217
|
+
1,
|
|
218
|
+
3,
|
|
219
|
+
5
|
|
220
|
+
].map((i) => Number.parseInt(backdrop.slice(i, i + 2), 16));
|
|
221
|
+
return `#${[
|
|
222
|
+
1,
|
|
223
|
+
2,
|
|
224
|
+
3
|
|
225
|
+
].map((i, k) => Math.round(Number(m[i]) * alpha + under[k] * (1 - alpha)).toString(16).padStart(2, "0")).join("")}`;
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
export { JND, composite, deltaE, fromOklab, fromRgb, gamutMap, mixOklab, oklch, p3Channels, parseColor, rendered, toHex, toOklab, toP3, withAlpha };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Gamut, type Oklch } from './color.js';
|
|
2
|
+
type Rgb = [number, number, number];
|
|
3
|
+
/** WCAG 2's contrast ratio between two hex colors, 1–21. */
|
|
4
|
+
export declare function contrastRatio(a: string, b: string): number;
|
|
5
|
+
/** Whether a background reads better under white text than black: the theme's mode. */
|
|
6
|
+
export declare function isDarkColor(hex: string): boolean;
|
|
7
|
+
/** APCA lightness contrast of text on a background, as a magnitude 0–~108. */
|
|
8
|
+
export declare function apcaContrast(text: string, background: string): number;
|
|
9
|
+
/** How much contrast a foreground needs: a WCAG 2 ratio and, for text, an APCA Lc. */
|
|
10
|
+
export interface ContrastTarget {
|
|
11
|
+
wcag: number;
|
|
12
|
+
apca?: number;
|
|
13
|
+
}
|
|
14
|
+
/** Whether a foreground meets a target on every background it sits on, in sRGB. */
|
|
15
|
+
export declare function meets(fg: string, backgrounds: readonly string[], target: ContrastTarget): boolean;
|
|
16
|
+
/** A color as a screen shows it: channels in the gamut it's written in. */
|
|
17
|
+
export interface Shown {
|
|
18
|
+
rgb: Rgb;
|
|
19
|
+
gamut: Gamut;
|
|
20
|
+
}
|
|
21
|
+
/** How a generated color shows when written in a gamut: as a hex for sRGB, as `color(display-p3)` for p3. */
|
|
22
|
+
export declare function shown(color: Oklch, gamut: Gamut): Shown;
|
|
23
|
+
/** A translucent fill over a backdrop, composited in the fill's gamut. */
|
|
24
|
+
export declare function over(fill: Shown, alpha: number, backdrop: Oklch): Shown;
|
|
25
|
+
/** Whether a shown foreground meets a target on every shown background. Each is measured in its own gamut. */
|
|
26
|
+
export declare function meetsIn(fg: Shown, backgrounds: readonly Shown[], target: ContrastTarget): boolean;
|
|
27
|
+
/** How a written color shows: a hex in sRGB, or `color(display-p3 …)` in display-p3. */
|
|
28
|
+
export declare function shownValue(value: string): Shown | null;
|
|
29
|
+
/** Both contrasts of a foreground on a background as written, in whichever gamut each is. */
|
|
30
|
+
export declare function measure(fg: Shown, bg: Shown): {
|
|
31
|
+
wcag: number;
|
|
32
|
+
apca: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The color nearest `start` in lightness, at its hue and chroma, that meets
|
|
36
|
+
* `target` on every background in sRGB. It moves away from the backgrounds
|
|
37
|
+
* toward black on light grounds and white on dark ones; a color that already
|
|
38
|
+
* meets the target comes back unchanged, so a brand color is kept wherever it
|
|
39
|
+
* reads.
|
|
40
|
+
*/
|
|
41
|
+
export declare function solve(start: Oklch, backgrounds: readonly string[], target: ContrastTarget): Oklch;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { p3Channels, toHex } from "./color.js";
|
|
2
|
+
//#region src/theme/contrast.ts
|
|
3
|
+
var hexChannels = (hex) => [
|
|
4
|
+
1,
|
|
5
|
+
3,
|
|
6
|
+
5
|
|
7
|
+
].map((i) => Number.parseInt(hex.slice(i, i + 2), 16) / 255);
|
|
8
|
+
var WEIGHTS = {
|
|
9
|
+
srgb: {
|
|
10
|
+
wcag: [
|
|
11
|
+
.2126,
|
|
12
|
+
.7152,
|
|
13
|
+
.0722
|
|
14
|
+
],
|
|
15
|
+
apca: [
|
|
16
|
+
.2126729,
|
|
17
|
+
.7151522,
|
|
18
|
+
.072175
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
p3: {
|
|
22
|
+
wcag: [
|
|
23
|
+
.2289745641,
|
|
24
|
+
.6917385218,
|
|
25
|
+
.0792869141
|
|
26
|
+
],
|
|
27
|
+
apca: [
|
|
28
|
+
.2289829595,
|
|
29
|
+
.6917492626,
|
|
30
|
+
.0792677779
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
function luminance(rgb, gamut) {
|
|
35
|
+
const w = WEIGHTS[gamut].wcag;
|
|
36
|
+
return rgb.reduce((sum, v, i) => sum + w[i] * (v <= .04045 ? v / 12.92 : ((v + .055) / 1.055) ** 2.4), 0);
|
|
37
|
+
}
|
|
38
|
+
function ratio(la, lb) {
|
|
39
|
+
const [hi, lo] = la > lb ? [la, lb] : [lb, la];
|
|
40
|
+
return (hi + .05) / (lo + .05);
|
|
41
|
+
}
|
|
42
|
+
var cache = /* @__PURE__ */ new Map();
|
|
43
|
+
function cachedLuminance(hex) {
|
|
44
|
+
let v = cache.get(hex);
|
|
45
|
+
if (v === void 0) {
|
|
46
|
+
if (cache.size > 4096) cache.clear();
|
|
47
|
+
v = luminance(hexChannels(hex), "srgb");
|
|
48
|
+
cache.set(hex, v);
|
|
49
|
+
}
|
|
50
|
+
return v;
|
|
51
|
+
}
|
|
52
|
+
/** WCAG 2's contrast ratio between two hex colors, 1–21. */
|
|
53
|
+
function contrastRatio(a, b) {
|
|
54
|
+
return ratio(cachedLuminance(a), cachedLuminance(b));
|
|
55
|
+
}
|
|
56
|
+
/** Whether a background reads better under white text than black: the theme's mode. */
|
|
57
|
+
function isDarkColor(hex) {
|
|
58
|
+
return contrastRatio(hex, "#ffffff") >= contrastRatio(hex, "#000000");
|
|
59
|
+
}
|
|
60
|
+
var APCA = {
|
|
61
|
+
exponent: 2.4,
|
|
62
|
+
normBg: .56,
|
|
63
|
+
normText: .57,
|
|
64
|
+
revText: .62,
|
|
65
|
+
revBg: .65,
|
|
66
|
+
blackThreshold: .022,
|
|
67
|
+
blackClamp: 1.414,
|
|
68
|
+
scale: 1.14,
|
|
69
|
+
offset: .027,
|
|
70
|
+
minDeltaY: 5e-4,
|
|
71
|
+
clip: .1
|
|
72
|
+
};
|
|
73
|
+
function apcaY(rgb, gamut) {
|
|
74
|
+
const w = WEIGHTS[gamut].apca;
|
|
75
|
+
const y = rgb.reduce((sum, v, i) => sum + w[i] * Math.max(0, v) ** APCA.exponent, 0);
|
|
76
|
+
return y > APCA.blackThreshold ? y : y + (APCA.blackThreshold - y) ** APCA.blackClamp;
|
|
77
|
+
}
|
|
78
|
+
function lc(yText, yBg) {
|
|
79
|
+
if (Math.abs(yBg - yText) < APCA.minDeltaY) return 0;
|
|
80
|
+
if (yBg > yText) {
|
|
81
|
+
const sapc = (yBg ** APCA.normBg - yText ** APCA.normText) * APCA.scale;
|
|
82
|
+
return sapc < APCA.clip ? 0 : (sapc - APCA.offset) * 100;
|
|
83
|
+
}
|
|
84
|
+
const sapc = (yBg ** APCA.revBg - yText ** APCA.revText) * APCA.scale;
|
|
85
|
+
return sapc > -APCA.clip ? 0 : -(sapc + APCA.offset) * 100;
|
|
86
|
+
}
|
|
87
|
+
/** APCA lightness contrast of text on a background, as a magnitude 0–~108. */
|
|
88
|
+
function apcaContrast(text, background) {
|
|
89
|
+
return lc(apcaY(hexChannels(text), "srgb"), apcaY(hexChannels(background), "srgb"));
|
|
90
|
+
}
|
|
91
|
+
/** Whether a foreground meets a target on every background it sits on, in sRGB. */
|
|
92
|
+
function meets(fg, backgrounds, target) {
|
|
93
|
+
return backgrounds.every((bg) => contrastRatio(fg, bg) >= target.wcag && (target.apca === void 0 || apcaContrast(fg, bg) >= target.apca));
|
|
94
|
+
}
|
|
95
|
+
/** How a generated color shows when written in a gamut: as a hex for sRGB, as `color(display-p3)` for p3. */
|
|
96
|
+
function shown(color, gamut) {
|
|
97
|
+
return {
|
|
98
|
+
rgb: gamut === "p3" ? p3Channels(color) : hexChannels(toHex(color)),
|
|
99
|
+
gamut
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** A translucent fill over a backdrop, composited in the fill's gamut. */
|
|
103
|
+
function over(fill, alpha, backdrop) {
|
|
104
|
+
const under = shown(backdrop, fill.gamut).rgb;
|
|
105
|
+
return {
|
|
106
|
+
rgb: fill.rgb.map((v, i) => v * alpha + under[i] * (1 - alpha)),
|
|
107
|
+
gamut: fill.gamut
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** Whether a shown foreground meets a target on every shown background. Each is measured in its own gamut. */
|
|
111
|
+
function meetsIn(fg, backgrounds, target) {
|
|
112
|
+
const yWcag = luminance(fg.rgb, fg.gamut);
|
|
113
|
+
const yApca = apcaY(fg.rgb, fg.gamut);
|
|
114
|
+
return backgrounds.every((bg) => ratio(yWcag, luminance(bg.rgb, bg.gamut)) >= target.wcag - 1e-9 && (target.apca === void 0 || lc(yApca, apcaY(bg.rgb, bg.gamut)) >= target.apca - 1e-9));
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The color nearest `start` in lightness, at its hue and chroma, that meets
|
|
118
|
+
* `target` on every background in sRGB. It moves away from the backgrounds
|
|
119
|
+
* toward black on light grounds and white on dark ones; a color that already
|
|
120
|
+
* meets the target comes back unchanged, so a brand color is kept wherever it
|
|
121
|
+
* reads.
|
|
122
|
+
*/
|
|
123
|
+
function solve(start, backgrounds, target) {
|
|
124
|
+
if (meets(toHex(start), backgrounds, target)) return start;
|
|
125
|
+
const pole = isDarkColor(backgrounds[0] ?? "#ffffff") ? 1 : 0;
|
|
126
|
+
const at = (t) => ({
|
|
127
|
+
...start,
|
|
128
|
+
l: start.l + (pole - start.l) * t
|
|
129
|
+
});
|
|
130
|
+
if (!meets(toHex(at(1)), backgrounds, target)) return {
|
|
131
|
+
l: pole,
|
|
132
|
+
c: 0,
|
|
133
|
+
h: 0
|
|
134
|
+
};
|
|
135
|
+
let lo = 0;
|
|
136
|
+
let hi = 1;
|
|
137
|
+
while (hi - lo > .002) {
|
|
138
|
+
const mid = (lo + hi) / 2;
|
|
139
|
+
if (meets(toHex(at(mid)), backgrounds, target)) hi = mid;
|
|
140
|
+
else lo = mid;
|
|
141
|
+
}
|
|
142
|
+
return at(hi);
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
export { apcaContrast, contrastRatio, isDarkColor, meets, meetsIn, over, shown, solve };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type CodeStyle, type Scheme } from './model.js';
|
|
2
|
+
export declare const THEME_TOKENS: readonly ['--theme-app-bg', '--theme-panel-bg', '--theme-panel-hover', '--theme-muted-panel-bg', '--theme-hover', '--theme-input-bg', '--theme-input-disabled-bg', '--theme-app', '--theme-muted-text-color', '--theme-placeholder', '--theme-link', '--theme-border', '--theme-border-strong', '--theme-accent', '--theme-accent-text', '--theme-accent-hover', '--theme-accent-subtle', '--theme-focus', '--theme-focus-ring', '--theme-success', '--theme-success-muted', '--theme-error', '--theme-error-muted', '--theme-warning', '--theme-warning-muted', '--theme-info', '--theme-info-muted', '--theme-favorite', '--theme-favorite-muted', '--theme-shadow-sm', '--theme-shadow', '--theme-shadow-lg', '--theme-shadow-xl', '--theme-sidebar-bg', '--theme-sidebar-text', '--theme-sidebar-hover', '--theme-sidebar-active-bg', '--theme-sidebar-active-text', '--theme-code-bg', '--theme-code-text', '--theme-code-comment', '--theme-code-keyword', '--theme-code-string', '--theme-code-number', '--theme-code-function', '--theme-code-type', '--theme-code-property', '--theme-ansi-black', '--theme-ansi-red', '--theme-ansi-green', '--theme-ansi-yellow', '--theme-ansi-blue', '--theme-ansi-magenta', '--theme-ansi-cyan', '--theme-ansi-white'];
|
|
3
|
+
export type ThemeToken = (typeof THEME_TOKENS)[number];
|
|
4
|
+
export type ThemeVariables = Record<ThemeToken, string>;
|
|
5
|
+
/** The tokens the sidebar owns. A host's chrome may supply its own fallbacks, so the stylesheet gives them no defaults. */
|
|
6
|
+
export declare const SIDEBAR_TOKENS: readonly ThemeToken[];
|
|
7
|
+
/** A theme as both outputs: every token in sRGB, and the tokens a display-p3 screen shows noticeably more of. */
|
|
8
|
+
export interface GeneratedTheme {
|
|
9
|
+
srgb: ThemeVariables;
|
|
10
|
+
/** `color(display-p3 …)` for the tokens whose display-p3 mapping is more than one just-noticeable difference from their sRGB one. */
|
|
11
|
+
p3: Partial<ThemeVariables>;
|
|
12
|
+
}
|
|
13
|
+
export interface DeriveOptions {
|
|
14
|
+
/** How the code theme colors syntax. */
|
|
15
|
+
code?: CodeStyle;
|
|
16
|
+
}
|
|
17
|
+
/** Every token as sRGB, plus display-p3 overrides that keep every contrast the sRGB output meets. */
|
|
18
|
+
export declare function generateTheme(scheme: Scheme, options?: DeriveOptions): GeneratedTheme;
|
|
19
|
+
/** Every `--theme-*` token for a scheme, in sRGB. */
|
|
20
|
+
export declare function deriveTheme(scheme: Scheme, options?: DeriveOptions): ThemeVariables;
|
|
21
|
+
/** A stylesheet for a scheme: sRGB under `selector`, and the display-p3 overrides under
|
|
22
|
+
* `@media (color-gamut: p3)`. `omit` leaves tokens out, such as ones a host supplies. */
|
|
23
|
+
export declare function themeStylesheet(selector: string, scheme: Scheme, options?: DeriveOptions & {
|
|
24
|
+
omit?: readonly ThemeToken[];
|
|
25
|
+
}): string;
|