@parallelworks/ui 0.44.0 → 0.45.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/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 +18 -31
- 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.js +1 -1
- 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/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 +197 -80
- package/dist/components/Provider.js +200 -118
- 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 +3 -1
- package/dist/components/StatusBadge.js +9 -32
- 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/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/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 +36 -58
- 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/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/utils.d.ts +0 -2
- package/dist/file-explorer/lib/utils.js +1 -25
- package/dist/file-explorer/toasts.js +104 -185
- 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/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 +1 -2
- package/dist/graph/SuggestionInput.js +1 -3
- 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.js +2 -2
- package/dist/graph/editorRows.js +22 -25
- package/dist/graph/editorStrings.d.ts +16 -19
- package/dist/graph/editorStrings.js +11 -23
- 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 +121 -159
- 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/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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { positionerClassName, tipArrowClassName, tipClassName } from "./floating.js";
|
|
2
2
|
import { keyedByContent } from "./keys.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Fragment as Fragment$1, createContext, use, useState } from "react";
|
|
@@ -19,21 +19,18 @@ function KbdShortcut({ keys }) {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
function TooltipPopup({ content, shortcut, side }) {
|
|
22
|
-
return /* @__PURE__ */ jsx(Tooltip.Portal, {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
className:
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
className:
|
|
30
|
-
children: [/* @__PURE__ */ jsx(
|
|
31
|
-
|
|
32
|
-
children: [content, /* @__PURE__ */ jsx(KbdShortcut, { keys: shortcut })]
|
|
33
|
-
}) : content]
|
|
34
|
-
})
|
|
22
|
+
return /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
23
|
+
side,
|
|
24
|
+
sideOffset: 8,
|
|
25
|
+
className: positionerClassName,
|
|
26
|
+
children: /* @__PURE__ */ jsxs(Tooltip.Popup, {
|
|
27
|
+
className: `max-w-xs ${tipClassName}`,
|
|
28
|
+
children: [/* @__PURE__ */ jsx(Tooltip.Arrow, { className: tipArrowClassName }), shortcut ? /* @__PURE__ */ jsxs("span", {
|
|
29
|
+
className: "inline-flex items-center gap-2",
|
|
30
|
+
children: [content, /* @__PURE__ */ jsx(KbdShortcut, { keys: shortcut })]
|
|
31
|
+
}) : content]
|
|
35
32
|
})
|
|
36
|
-
});
|
|
33
|
+
}) });
|
|
37
34
|
}
|
|
38
35
|
/** One popup serves every Tooltip below it, so each anchor costs only a trigger.
|
|
39
36
|
* UIProvider mounts it; nothing else needs to. */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** `primary` is the one action a view leads to; `secondary` sits beside it;
|
|
2
|
+
* `outline` and `ghost` are toolbar and inline actions, bordered or not;
|
|
3
|
+
* `danger` confirms what can't be undone. */
|
|
4
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
|
|
5
|
+
export type ButtonSize = 'xs' | 'sm' | 'md';
|
|
6
|
+
export interface ButtonStyle {
|
|
7
|
+
variant?: ButtonVariant | undefined;
|
|
8
|
+
size?: ButtonSize | undefined;
|
|
9
|
+
/** A square holding only an icon. */
|
|
10
|
+
iconOnly?: boolean | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** The one look for anything pressed: a button, or a link or popup trigger
|
|
13
|
+
* that acts as one. `Button` and `IconButton` apply it; use it directly on a
|
|
14
|
+
* host link or another component's trigger. Outline and ghost read as
|
|
15
|
+
* selected for a pressed toggle (`aria-pressed`), an open popup's trigger
|
|
16
|
+
* (`data-popup-open`, which Base UI triggers set), or a button that shows its
|
|
17
|
+
* state some other way, such as by its label (`data-selected`). */
|
|
18
|
+
export declare function buttonClasses({ variant, size, iconOnly, }?: ButtonStyle): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cx } from "../cx.js";
|
|
2
|
+
//#region src/components/buttonClasses.ts
|
|
3
|
+
var base = "relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-medium no-underline transition-colors focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--theme-link) disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50";
|
|
4
|
+
var variants = {
|
|
5
|
+
primary: "bg-(--theme-accent) text-(--theme-accent-text) hover:not-disabled:not-aria-disabled:bg-(--theme-accent-hover)",
|
|
6
|
+
secondary: "border border-(--theme-border) bg-(--theme-panel-bg) text-(--theme-app) hover:not-disabled:not-aria-disabled:bg-(--theme-hover)",
|
|
7
|
+
outline: "border border-(--theme-border) text-(--theme-muted-text-color) hover:not-disabled:not-aria-disabled:bg-(--theme-muted-panel-bg) hover:not-disabled:not-aria-disabled:text-(--theme-app) aria-pressed:border-(--theme-link) aria-pressed:text-(--theme-app) data-selected:border-(--theme-link) data-selected:text-(--theme-app) data-popup-open:bg-(--theme-muted-panel-bg) data-popup-open:text-(--theme-app)",
|
|
8
|
+
ghost: "text-(--theme-muted-text-color) hover:not-disabled:not-aria-disabled:bg-(--theme-muted-panel-bg) hover:not-disabled:not-aria-disabled:text-(--theme-app) aria-pressed:bg-(--theme-muted-panel-bg) aria-pressed:text-(--theme-link) data-selected:bg-(--theme-muted-panel-bg) data-selected:text-(--theme-link) data-popup-open:bg-(--theme-muted-panel-bg) data-popup-open:text-(--theme-app)",
|
|
9
|
+
danger: "bg-(--theme-error) text-white hover:not-disabled:not-aria-disabled:bg-(--theme-error)/90"
|
|
10
|
+
};
|
|
11
|
+
var sizes = {
|
|
12
|
+
xs: "h-6 px-2 text-xs [&_svg]:size-3",
|
|
13
|
+
sm: "h-7 px-2.5 text-xs [&_svg]:size-3.5",
|
|
14
|
+
md: "h-8 px-3 text-sm [&_svg]:size-4"
|
|
15
|
+
};
|
|
16
|
+
var squares = {
|
|
17
|
+
xs: "size-6 text-xs [&_svg]:size-3",
|
|
18
|
+
sm: "size-7 text-xs [&_svg]:size-3.5",
|
|
19
|
+
md: "size-8 text-sm [&_svg]:size-4"
|
|
20
|
+
};
|
|
21
|
+
/** The one look for anything pressed: a button, or a link or popup trigger
|
|
22
|
+
* that acts as one. `Button` and `IconButton` apply it; use it directly on a
|
|
23
|
+
* host link or another component's trigger. Outline and ghost read as
|
|
24
|
+
* selected for a pressed toggle (`aria-pressed`), an open popup's trigger
|
|
25
|
+
* (`data-popup-open`, which Base UI triggers set), or a button that shows its
|
|
26
|
+
* state some other way, such as by its label (`data-selected`). */
|
|
27
|
+
function buttonClasses({ variant = "secondary", size = "md", iconOnly = false } = {}) {
|
|
28
|
+
return cx(base, variants[variant], (iconOnly ? squares : sizes)[size]);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { buttonClasses };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ThemeRegistration } from 'shiki';
|
|
2
|
+
/** The light and dark registrations; they're the same tokens, so either mode follows the theme. */
|
|
3
|
+
export declare const CODE_THEMES: [ThemeRegistration, ThemeRegistration];
|
|
4
|
+
/** The name to highlight with when one theme is enough. */
|
|
5
|
+
export declare const CODE_THEME: ThemeRegistration;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region src/components/codeTheme.ts
|
|
2
|
+
var v = (token) => `var(--theme-code-${token})`;
|
|
3
|
+
/** TextMate scopes for each code token. */
|
|
4
|
+
var SCOPES = [
|
|
5
|
+
[
|
|
6
|
+
"comment",
|
|
7
|
+
["comment", "punctuation.definition.comment"],
|
|
8
|
+
"italic"
|
|
9
|
+
],
|
|
10
|
+
["keyword", [
|
|
11
|
+
"keyword",
|
|
12
|
+
"storage",
|
|
13
|
+
"storage.type",
|
|
14
|
+
"storage.modifier",
|
|
15
|
+
"constant.language",
|
|
16
|
+
"markup.heading",
|
|
17
|
+
"markup.bold"
|
|
18
|
+
]],
|
|
19
|
+
["string", [
|
|
20
|
+
"string",
|
|
21
|
+
"markup.inline.raw",
|
|
22
|
+
"markup.fenced_code",
|
|
23
|
+
"string.regexp"
|
|
24
|
+
]],
|
|
25
|
+
["number", [
|
|
26
|
+
"constant.numeric",
|
|
27
|
+
"constant.character",
|
|
28
|
+
"constant.other",
|
|
29
|
+
"variable.other.constant"
|
|
30
|
+
]],
|
|
31
|
+
["function", [
|
|
32
|
+
"entity.name.function",
|
|
33
|
+
"support.function",
|
|
34
|
+
"meta.function-call.generic"
|
|
35
|
+
]],
|
|
36
|
+
["type", [
|
|
37
|
+
"entity.name.type",
|
|
38
|
+
"entity.name.class",
|
|
39
|
+
"entity.other.inherited-class",
|
|
40
|
+
"support.type",
|
|
41
|
+
"support.class"
|
|
42
|
+
]],
|
|
43
|
+
["property", [
|
|
44
|
+
"entity.name.tag",
|
|
45
|
+
"entity.other.attribute-name",
|
|
46
|
+
"variable.other.property",
|
|
47
|
+
"variable.other.object.property",
|
|
48
|
+
"support.type.property-name",
|
|
49
|
+
"meta.object-literal.key",
|
|
50
|
+
"markup.underline.link"
|
|
51
|
+
]],
|
|
52
|
+
["text", [
|
|
53
|
+
"variable",
|
|
54
|
+
"punctuation",
|
|
55
|
+
"keyword.operator",
|
|
56
|
+
"meta.embedded"
|
|
57
|
+
]]
|
|
58
|
+
];
|
|
59
|
+
function registration(name, type) {
|
|
60
|
+
return {
|
|
61
|
+
name,
|
|
62
|
+
type,
|
|
63
|
+
fg: v("text"),
|
|
64
|
+
bg: v("bg"),
|
|
65
|
+
colors: {
|
|
66
|
+
"editor.background": v("bg"),
|
|
67
|
+
"editor.foreground": v("text")
|
|
68
|
+
},
|
|
69
|
+
tokenColors: [
|
|
70
|
+
...SCOPES.map(([token, scope, fontStyle]) => ({
|
|
71
|
+
scope,
|
|
72
|
+
settings: {
|
|
73
|
+
foreground: v(token),
|
|
74
|
+
...fontStyle ? { fontStyle } : {}
|
|
75
|
+
}
|
|
76
|
+
})),
|
|
77
|
+
{
|
|
78
|
+
scope: ["markup.inserted"],
|
|
79
|
+
settings: { foreground: "var(--theme-ansi-green)" }
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
scope: ["markup.deleted"],
|
|
83
|
+
settings: { foreground: "var(--theme-ansi-red)" }
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** The light and dark registrations; they're the same tokens, so either mode follows the theme. */
|
|
89
|
+
var CODE_THEMES = [registration("theme-code-light", "light"), registration("theme-code-dark", "dark")];
|
|
90
|
+
/** The name to highlight with when one theme is enough. */
|
|
91
|
+
var CODE_THEME = CODE_THEMES[0];
|
|
92
|
+
//#endregion
|
|
93
|
+
export { CODE_THEME, CODE_THEMES };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type FieldBoxSize = 'sm' | 'md';
|
|
2
|
+
export interface FieldBoxOptions {
|
|
3
|
+
size?: FieldBoxSize | undefined;
|
|
4
|
+
/** Grows with its content, as a textarea or a field of chips does, instead of holding one line. */
|
|
5
|
+
multiline?: boolean | undefined;
|
|
6
|
+
/** False when what is inside pads itself, as an input beside buttons does. */
|
|
7
|
+
padded?: boolean | undefined;
|
|
8
|
+
/** Drawn around the element that takes focus rather than on it, as for an input with
|
|
9
|
+
* buttons beside it: focus, invalid and disabled then follow what is inside. */
|
|
10
|
+
within?: boolean | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** The box every input-like control draws: text inputs, textareas, and the triggers of
|
|
13
|
+
* pickers. Invalid follows `aria-invalid`, disabled follows `disabled` or `data-disabled`. */
|
|
14
|
+
export declare function fieldBox({ size, multiline, padded, within, }?: FieldBoxOptions): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cx } from "../cx.js";
|
|
2
|
+
//#region src/components/fieldBox.ts
|
|
3
|
+
var sizes = {
|
|
4
|
+
sm: {
|
|
5
|
+
height: "h-7",
|
|
6
|
+
minHeight: "min-h-7",
|
|
7
|
+
px: "px-2",
|
|
8
|
+
py: "py-1",
|
|
9
|
+
text: "text-xs"
|
|
10
|
+
},
|
|
11
|
+
md: {
|
|
12
|
+
height: "h-9",
|
|
13
|
+
minHeight: "min-h-9",
|
|
14
|
+
px: "px-3",
|
|
15
|
+
py: "py-2",
|
|
16
|
+
text: "text-sm"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var base = "w-full min-w-0 rounded-md border border-(--theme-border) bg-(--theme-input-bg) text-(--theme-app) outline-none transition-colors placeholder:text-(--theme-muted-text-color)";
|
|
20
|
+
var own = cx("focus-visible:border-(--theme-accent) focus-visible:ring-1 focus-visible:ring-(--theme-accent)", "aria-invalid:border-(--theme-error) aria-invalid:focus-visible:ring-(--theme-error)", "disabled:cursor-not-allowed disabled:bg-(--theme-input-disabled-bg) disabled:text-(--theme-placeholder)", "data-disabled:cursor-not-allowed data-disabled:bg-(--theme-input-disabled-bg) data-disabled:text-(--theme-placeholder)");
|
|
21
|
+
var inside = cx("has-[:focus-visible]:border-(--theme-accent) has-[:focus-visible]:ring-1 has-[:focus-visible]:ring-(--theme-accent)", "has-[[aria-invalid=true]]:border-(--theme-error) has-[[aria-invalid=true]:focus-visible]:ring-(--theme-error)", "has-[input:disabled]:cursor-not-allowed has-[input:disabled]:bg-(--theme-input-disabled-bg) has-[input:disabled]:text-(--theme-placeholder)", "data-disabled:cursor-not-allowed data-disabled:bg-(--theme-input-disabled-bg) data-disabled:text-(--theme-placeholder)");
|
|
22
|
+
/** The box every input-like control draws: text inputs, textareas, and the triggers of
|
|
23
|
+
* pickers. Invalid follows `aria-invalid`, disabled follows `disabled` or `data-disabled`. */
|
|
24
|
+
function fieldBox({ size = "md", multiline = false, padded = true, within = false } = {}) {
|
|
25
|
+
const box = sizes[size];
|
|
26
|
+
return cx(base, box.text, multiline ? box.minHeight : box.height, padded && box.px, padded && multiline && box.py, within ? inside : own);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { fieldBox };
|
|
@@ -1,14 +1,35 @@
|
|
|
1
|
-
/** Popups portal into the host's .ds-root when it has one, so they inherit the
|
|
2
|
-
* design system's CSS variables; undefined lets the portal use document.body. */
|
|
3
|
-
export declare function portalContainer(): HTMLElement | undefined;
|
|
4
1
|
/** Above dialogs and sticky chrome; hidden while its anchor is scrolled out of view. */
|
|
5
|
-
export declare const positionerClassName = "z-
|
|
2
|
+
export declare const positionerClassName = "z-(--layer-popover) outline-none data-anchor-hidden:invisible";
|
|
6
3
|
/** A panel of choices: a menu, a select's list, a combobox's list. */
|
|
7
4
|
export declare const panelClassName = "rounded-lg border border-(--theme-border) bg-(--theme-app-bg) text-sm text-(--theme-app) shadow-(--theme-shadow-lg) outline-none origin-(--transform-origin) transition-[transform,opacity] duration-100 data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0";
|
|
8
5
|
/** A row in a panel. */
|
|
9
|
-
export declare const panelItemClassName = "flex w-full cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-left outline-none data-highlighted:bg-(--theme-hover) data-highlighted:text-(--theme-
|
|
6
|
+
export declare const panelItemClassName = "flex w-full cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-left outline-none data-highlighted:bg-(--theme-hover) data-highlighted:text-(--theme-app) data-disabled:cursor-not-allowed data-disabled:opacity-50";
|
|
10
7
|
/** A tooltip's or infotip's small inverted surface. */
|
|
11
8
|
export declare const tipClassName = "rounded-md bg-(--theme-app) px-2 py-1 text-xs text-(--theme-app-bg) shadow-(--theme-shadow) whitespace-pre-line break-words data-instant:transition-none origin-(--transform-origin) transition-[transform,opacity] duration-100 data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0";
|
|
12
9
|
export declare const tipArrowClassName = "size-2 rotate-45 bg-(--theme-app) data-[side=top]:-bottom-1 data-[side=bottom]:-top-1 data-[side=left]:-right-1 data-[side=right]:-left-1";
|
|
13
10
|
/** A hover card's surface; the card sets its own width and padding. */
|
|
14
11
|
export declare const cardClassName = "overflow-hidden rounded-xl border border-(--theme-border) bg-(--theme-panel-bg) text-(--theme-app) shadow-(--theme-shadow-lg) outline-none origin-(--transform-origin) transition-[transform,opacity] duration-100 data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0";
|
|
12
|
+
/** Where a popup opens: under an element, such as the button that opened it, or
|
|
13
|
+
* at a pointer event's point, which then moves with the element it landed on. */
|
|
14
|
+
export type FloatingAnchor = Element | {
|
|
15
|
+
clientX: number;
|
|
16
|
+
clientY: number;
|
|
17
|
+
currentTarget?: EventTarget | null;
|
|
18
|
+
};
|
|
19
|
+
/** A popup positioner's anchor: an element, or a point that reads its place each frame. */
|
|
20
|
+
export type PositionerAnchor = Element | {
|
|
21
|
+
getBoundingClientRect: () => DOMRect | ReturnType<typeof pointRect>;
|
|
22
|
+
contextElement?: Element;
|
|
23
|
+
};
|
|
24
|
+
declare function pointRect(x: number, y: number): {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
left: number;
|
|
28
|
+
top: number;
|
|
29
|
+
right: number;
|
|
30
|
+
bottom: number;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
};
|
|
34
|
+
export declare function toPositionerAnchor(at: FloatingAnchor): PositionerAnchor;
|
|
35
|
+
export {};
|
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
//#region src/components/floating.ts
|
|
2
|
-
/** Popups portal into the host's .ds-root when it has one, so they inherit the
|
|
3
|
-
* design system's CSS variables; undefined lets the portal use document.body. */
|
|
4
|
-
function portalContainer() {
|
|
5
|
-
if (typeof document === "undefined") return;
|
|
6
|
-
return document.querySelector(".ds-root") ?? void 0;
|
|
7
|
-
}
|
|
8
2
|
/** Above dialogs and sticky chrome; hidden while its anchor is scrolled out of view. */
|
|
9
|
-
var positionerClassName = "z-
|
|
3
|
+
var positionerClassName = "z-(--layer-popover) outline-none data-anchor-hidden:invisible";
|
|
10
4
|
var enterExit = "origin-(--transform-origin) transition-[transform,opacity] duration-100 data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0";
|
|
11
5
|
/** A panel of choices: a menu, a select's list, a combobox's list. */
|
|
12
6
|
var panelClassName = `rounded-lg border border-(--theme-border) bg-(--theme-app-bg) text-sm text-(--theme-app) shadow-(--theme-shadow-lg) outline-none ${enterExit}`;
|
|
13
7
|
/** A row in a panel. */
|
|
14
|
-
var panelItemClassName = "flex w-full cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-left outline-none data-highlighted:bg-(--theme-hover) data-highlighted:text-(--theme-
|
|
8
|
+
var panelItemClassName = "flex w-full cursor-pointer select-none items-center gap-2 px-3 py-1.5 text-left outline-none data-highlighted:bg-(--theme-hover) data-highlighted:text-(--theme-app) data-disabled:cursor-not-allowed data-disabled:opacity-50";
|
|
15
9
|
/** A tooltip's or infotip's small inverted surface. */
|
|
16
10
|
var tipClassName = `rounded-md bg-(--theme-app) px-2 py-1 text-xs text-(--theme-app-bg) shadow-(--theme-shadow) whitespace-pre-line break-words data-instant:transition-none ${enterExit}`;
|
|
17
11
|
var tipArrowClassName = "size-2 rotate-45 bg-(--theme-app) data-[side=top]:-bottom-1 data-[side=bottom]:-top-1 data-[side=left]:-right-1 data-[side=right]:-left-1";
|
|
18
12
|
/** A hover card's surface; the card sets its own width and padding. */
|
|
19
13
|
var cardClassName = `overflow-hidden rounded-xl border border-(--theme-border) bg-(--theme-panel-bg) text-(--theme-app) shadow-(--theme-shadow-lg) outline-none ${enterExit}`;
|
|
14
|
+
function pointRect(x, y) {
|
|
15
|
+
return {
|
|
16
|
+
x,
|
|
17
|
+
y,
|
|
18
|
+
left: x,
|
|
19
|
+
top: y,
|
|
20
|
+
right: x,
|
|
21
|
+
bottom: y,
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 0
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function toPositionerAnchor(at) {
|
|
27
|
+
if (at instanceof Element) return at;
|
|
28
|
+
const { clientX, clientY } = at;
|
|
29
|
+
const on = at.currentTarget instanceof Element ? at.currentTarget : null;
|
|
30
|
+
if (!on) return { getBoundingClientRect: () => pointRect(clientX, clientY) };
|
|
31
|
+
const start = on.getBoundingClientRect();
|
|
32
|
+
const dx = clientX - start.left;
|
|
33
|
+
const dy = clientY - start.top;
|
|
34
|
+
return {
|
|
35
|
+
contextElement: on,
|
|
36
|
+
getBoundingClientRect: () => {
|
|
37
|
+
const now = on.getBoundingClientRect();
|
|
38
|
+
return pointRect(now.left + dx, now.top + dy);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
20
42
|
//#endregion
|
|
21
|
-
export { cardClassName, panelClassName, panelItemClassName,
|
|
43
|
+
export { cardClassName, panelClassName, panelItemClassName, positionerClassName, tipArrowClassName, tipClassName, toPositionerAnchor };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useCallback, useMemo, useRef, useSyncExternalStore } from "react";
|
|
2
|
+
//#region src/components/persistedState.ts
|
|
3
|
+
var listeners = /* @__PURE__ */ new Map();
|
|
4
|
+
var memory = /* @__PURE__ */ new Map();
|
|
5
|
+
var MISSING = Symbol("missing");
|
|
6
|
+
function readRaw(key) {
|
|
7
|
+
const held = memory.get(key);
|
|
8
|
+
if (held !== void 0) return held;
|
|
9
|
+
try {
|
|
10
|
+
return globalThis.localStorage?.getItem(key) ?? null;
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function writeRaw(key, raw) {
|
|
16
|
+
try {
|
|
17
|
+
if (raw === null) globalThis.localStorage?.removeItem(key);
|
|
18
|
+
else globalThis.localStorage?.setItem(key, raw);
|
|
19
|
+
memory.delete(key);
|
|
20
|
+
} catch {
|
|
21
|
+
if (raw === null) memory.delete(key);
|
|
22
|
+
else memory.set(key, raw);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function parse(raw) {
|
|
26
|
+
if (raw === null) return MISSING;
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(raw);
|
|
29
|
+
} catch {
|
|
30
|
+
return MISSING;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function subscribe(key, listener) {
|
|
34
|
+
let keyListeners = listeners.get(key);
|
|
35
|
+
if (!keyListeners) {
|
|
36
|
+
keyListeners = /* @__PURE__ */ new Set();
|
|
37
|
+
listeners.set(key, keyListeners);
|
|
38
|
+
}
|
|
39
|
+
keyListeners.add(listener);
|
|
40
|
+
const onStorage = (e) => {
|
|
41
|
+
if (e.key === key || e.key === null) listener();
|
|
42
|
+
};
|
|
43
|
+
window.addEventListener("storage", onStorage);
|
|
44
|
+
return () => {
|
|
45
|
+
keyListeners.delete(listener);
|
|
46
|
+
window.removeEventListener("storage", onStorage);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function useLocalPersistedState(key, defaultValue) {
|
|
50
|
+
const raw = useSyncExternalStore(useCallback((listener) => subscribe(key, listener), [key]), () => readRaw(key), () => null);
|
|
51
|
+
const fallback = useRef(defaultValue);
|
|
52
|
+
fallback.current = defaultValue;
|
|
53
|
+
const stored = useMemo(() => parse(raw), [raw]);
|
|
54
|
+
return [stored === MISSING ? defaultValue : stored, useCallback((update) => {
|
|
55
|
+
const current = parse(readRaw(key));
|
|
56
|
+
const previous = current === MISSING ? fallback.current : current;
|
|
57
|
+
const next = typeof update === "function" ? update(previous) : update;
|
|
58
|
+
writeRaw(key, next === void 0 ? null : JSON.stringify(next));
|
|
59
|
+
for (const listener of listeners.get(key) ?? []) listener();
|
|
60
|
+
}, [key])];
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { useLocalPersistedState };
|
|
@@ -1,8 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { type TimeValue } from '../format.js';
|
|
2
|
+
export type { TimeValue };
|
|
3
|
+
/** Something worked out from the time, kept current by one clock that ticks
|
|
4
|
+
* each second for every component reading it. A component re-renders only
|
|
5
|
+
* when what `select` returns changes, so a label reading "3h" sits still
|
|
6
|
+
* while the clock runs. `select` runs every tick, so keep it cheap; while
|
|
7
|
+
* `running` is false the component leaves the clock and `select` sees the
|
|
8
|
+
* last tick's time. */
|
|
9
|
+
export declare function useClock<T>(select: (now: number) => T, running?: boolean): T;
|
|
10
|
+
/** `long` reads "5 minutes ago" in the host's locale; `compact` reads "5m",
|
|
11
|
+
* for a row with little room. */
|
|
12
|
+
export type RelativeTimeFormat = 'long' | 'compact';
|
|
13
|
+
/** How long ago, or until, `value` is, kept current as time passes. Empty for
|
|
14
|
+
* a missing or invalid time. */
|
|
15
|
+
export declare function useRelativeTime(value: TimeValue, format?: RelativeTimeFormat): string;
|
|
16
|
+
/** A time shown relative to now ("5 minutes ago", or "5m" compact), counting
|
|
17
|
+
* on while it stays on screen, with the exact time on hover. Renders nothing
|
|
18
|
+
* for a missing time. */
|
|
19
|
+
export declare function RelativeTime({ value, format, className, }: {
|
|
20
|
+
value: TimeValue;
|
|
21
|
+
format?: RelativeTimeFormat;
|
|
22
|
+
className?: string;
|
|
23
|
+
}): import("react").JSX.Element | null;
|
|
24
|
+
/** Milliseconds from `start` to `end`, or to now while `running`, in whole
|
|
25
|
+
* seconds so it changes at most once a second. Running defaults to having no
|
|
26
|
+
* end; pass false for something that stopped without recording when. Null
|
|
27
|
+
* without a start. */
|
|
28
|
+
export declare function useElapsed(start: TimeValue, end?: TimeValue, running?: boolean): number | null;
|
|
29
|
+
/** How long something took, or has taken so far while it runs: 45s, 2m 13s.
|
|
30
|
+
* Renders nothing without a start. */
|
|
31
|
+
export declare function Elapsed({ start, end, running, className, }: {
|
|
32
|
+
start: TimeValue;
|
|
33
|
+
end?: TimeValue;
|
|
34
|
+
running?: boolean;
|
|
35
|
+
className?: string;
|
|
36
|
+
}): import("react").JSX.Element | null;
|
|
@@ -1,32 +1,115 @@
|
|
|
1
|
+
import { Tooltip } from "./Tooltip.js";
|
|
1
2
|
import { useStrings } from "./Provider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { formatDateTime, formatDuration, toDateTime } from "../format.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useRef, useState, useSyncExternalStore } from "react";
|
|
6
|
+
import { DateTime, Duration } from "luxon";
|
|
7
|
+
//#region src/components/relativeTime.tsx
|
|
8
|
+
var SECOND = 1e3;
|
|
9
|
+
var MINUTE = 60 * SECOND;
|
|
10
|
+
var HOUR = 60 * MINUTE;
|
|
11
|
+
var DAY = 24 * HOUR;
|
|
12
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
13
|
+
var timer;
|
|
14
|
+
var now = Date.now();
|
|
15
|
+
function subscribe(listener) {
|
|
16
|
+
listeners.add(listener);
|
|
17
|
+
if (!timer) {
|
|
18
|
+
now = Date.now();
|
|
19
|
+
timer = setInterval(() => {
|
|
20
|
+
now = Date.now();
|
|
21
|
+
for (const notify of listeners) notify();
|
|
22
|
+
}, SECOND);
|
|
23
|
+
}
|
|
24
|
+
return () => {
|
|
25
|
+
listeners.delete(listener);
|
|
26
|
+
if (listeners.size === 0) {
|
|
27
|
+
clearInterval(timer);
|
|
28
|
+
timer = void 0;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var stopped = () => () => {};
|
|
33
|
+
/** Something worked out from the time, kept current by one clock that ticks
|
|
34
|
+
* each second for every component reading it. A component re-renders only
|
|
35
|
+
* when what `select` returns changes, so a label reading "3h" sits still
|
|
36
|
+
* while the clock runs. `select` runs every tick, so keep it cheap; while
|
|
37
|
+
* `running` is false the component leaves the clock and `select` sees the
|
|
38
|
+
* last tick's time. */
|
|
39
|
+
function useClock(select, running = true) {
|
|
40
|
+
const snapshot = () => select(now);
|
|
41
|
+
return useSyncExternalStore(running ? subscribe : stopped, snapshot, snapshot);
|
|
42
|
+
}
|
|
43
|
+
function compactLabel(age, t) {
|
|
44
|
+
const minutes = Math.floor(Math.abs(age) / MINUTE);
|
|
45
|
+
if (minutes < 1) return t.now;
|
|
8
46
|
if (minutes < 60) return t.minutes(minutes);
|
|
9
47
|
const hours = Math.floor(minutes / 60);
|
|
10
48
|
if (hours < 24) return t.hours(hours);
|
|
11
49
|
const days = Math.floor(hours / 24);
|
|
12
|
-
|
|
13
|
-
|
|
50
|
+
return days < 365 ? t.days(days) : t.years(Math.floor(days / 365));
|
|
51
|
+
}
|
|
52
|
+
function unitOf(age) {
|
|
53
|
+
const size = Math.abs(age);
|
|
54
|
+
return size < MINUTE ? SECOND : size < HOUR ? MINUTE : size < DAY ? HOUR : DAY;
|
|
14
55
|
}
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
function useRelativeTime() {
|
|
56
|
+
/** How long ago, or until, `value` is, kept current as time passes. Empty for
|
|
57
|
+
* a missing or invalid time. */
|
|
58
|
+
function useRelativeTime(value, format = "long") {
|
|
18
59
|
const t = useStrings().time;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
60
|
+
const at = toDateTime(value)?.toMillis() ?? null;
|
|
61
|
+
const last = useRef(null);
|
|
62
|
+
return useClock((current) => {
|
|
63
|
+
if (at === null) return "";
|
|
64
|
+
const age = current - at;
|
|
65
|
+
const unit = unitOf(age);
|
|
66
|
+
const key = `${format}:${at}:${unit}:${Math.trunc(age / unit)}`;
|
|
67
|
+
if (last.current?.key !== key) {
|
|
68
|
+
const label = format === "compact" ? compactLabel(age, t) : DateTime.fromMillis(at).toRelative({ base: DateTime.fromMillis(current) }) ?? "";
|
|
69
|
+
last.current = {
|
|
70
|
+
key,
|
|
71
|
+
label
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return last.current.label;
|
|
75
|
+
}, at !== null);
|
|
76
|
+
}
|
|
77
|
+
/** A time shown relative to now ("5 minutes ago", or "5m" compact), counting
|
|
78
|
+
* on while it stays on screen, with the exact time on hover. Renders nothing
|
|
79
|
+
* for a missing time. */
|
|
80
|
+
function RelativeTime({ value, format = "long", className }) {
|
|
81
|
+
const label = useRelativeTime(value, format);
|
|
82
|
+
const time = toDateTime(value);
|
|
83
|
+
if (!label || !time) return null;
|
|
84
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
85
|
+
content: formatDateTime(time, "seconds"),
|
|
86
|
+
children: /* @__PURE__ */ jsx("time", {
|
|
87
|
+
dateTime: time.toISO() ?? void 0,
|
|
88
|
+
className,
|
|
89
|
+
children: label
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** Milliseconds from `start` to `end`, or to now while `running`, in whole
|
|
94
|
+
* seconds so it changes at most once a second. Running defaults to having no
|
|
95
|
+
* end; pass false for something that stopped without recording when. Null
|
|
96
|
+
* without a start. */
|
|
97
|
+
function useElapsed(start, end, running = toDateTime(end) === null) {
|
|
98
|
+
const from = toDateTime(start)?.toMillis() ?? null;
|
|
99
|
+
const to = toDateTime(end)?.toMillis() ?? null;
|
|
100
|
+
const [shownAt] = useState(Date.now);
|
|
101
|
+
return useClock((current) => from === null ? null : Math.max(0, Math.floor(((to ?? Math.max(current, shownAt)) - from) / SECOND) * SECOND), from !== null && to === null && running);
|
|
102
|
+
}
|
|
103
|
+
/** How long something took, or has taken so far while it runs: 45s, 2m 13s.
|
|
104
|
+
* Renders nothing without a start. */
|
|
105
|
+
function Elapsed({ start, end, running, className }) {
|
|
106
|
+
const elapsed = useElapsed(start, end, running);
|
|
107
|
+
if (elapsed === null) return null;
|
|
108
|
+
return /* @__PURE__ */ jsx("time", {
|
|
109
|
+
dateTime: Duration.fromMillis(elapsed).toISO() ?? void 0,
|
|
110
|
+
className,
|
|
111
|
+
children: formatDuration(elapsed)
|
|
112
|
+
});
|
|
30
113
|
}
|
|
31
114
|
//#endregion
|
|
32
|
-
export { useRelativeTime };
|
|
115
|
+
export { Elapsed, RelativeTime, useClock, useElapsed, useRelativeTime };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** The parts SegmentedControl and segmented Tabs share, so a picker and a set
|
|
3
|
+
* of views beside it look the same. */
|
|
4
|
+
export interface SegmentLayout {
|
|
5
|
+
/** Segments share the container's width equally. */
|
|
6
|
+
fill?: boolean | undefined;
|
|
7
|
+
/** Segments stack as icons with their labels in tooltips, for a collapsed rail. */
|
|
8
|
+
iconOnly?: boolean | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function segmentGroupClassName({ fill, iconOnly }: SegmentLayout): string;
|
|
11
|
+
export declare function segmentClassName(current: boolean, { fill, iconOnly }: SegmentLayout): string;
|
|
12
|
+
export declare function SegmentContent({ label, icon, badge, iconOnly, }: {
|
|
13
|
+
label: string;
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
badge?: ReactNode;
|
|
16
|
+
iconOnly?: boolean | undefined;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cx } from "../cx.js";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/segmented.tsx
|
|
4
|
+
function segmentGroupClassName({ fill, iconOnly }) {
|
|
5
|
+
return cx("gap-0.5", iconOnly ? "flex flex-col items-center" : cx("rounded-lg theme-muted-panel p-0.5", fill ? "grid auto-cols-fr grid-flow-col" : "inline-flex"));
|
|
6
|
+
}
|
|
7
|
+
function segmentClassName(current, { fill, iconOnly }) {
|
|
8
|
+
return cx("relative flex min-w-0 cursor-pointer items-center justify-center rounded-md font-medium transition-colors duration-150 outline-none focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--theme-link) data-disabled:cursor-not-allowed data-disabled:opacity-50", current ? "bg-(--theme-panel-bg) theme-text shadow-sm ring-1 ring-(--theme-border)" : "theme-muted-text hover:theme-text hover:bg-(--theme-hover)", iconOnly ? "h-8 w-8" : cx("h-7 gap-1.5 text-[13px]", fill ? "px-1.5" : "px-2.5"));
|
|
9
|
+
}
|
|
10
|
+
function SegmentContent({ label, icon, badge, iconOnly }) {
|
|
11
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
+
icon,
|
|
13
|
+
iconOnly ? /* @__PURE__ */ jsx("span", {
|
|
14
|
+
className: "sr-only",
|
|
15
|
+
children: label
|
|
16
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
17
|
+
className: "truncate",
|
|
18
|
+
children: label
|
|
19
|
+
}),
|
|
20
|
+
badge && (iconOnly ? /* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: "absolute top-1 right-1 inline-flex",
|
|
22
|
+
children: badge
|
|
23
|
+
}) : badge)
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { SegmentContent, segmentClassName, segmentGroupClassName };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Guards page shortcuts from firing inside inputs, terminals, editors, and dialogs. */
|
|
2
|
+
export declare function isTextEntryContext(target: EventTarget | null): boolean;
|
|
3
|
+
/** Calls `onPress` on a single key, such as F to filter, unless the key goes to a text field. */
|
|
4
|
+
export declare function useShortcutKey(key: string | undefined, onPress: () => void): void;
|