@umbra.ui/core 0.1.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/dist/components/controls/Dropdown/types.d.ts +5 -0
- package/dist/components/controls/Dropdown/types.d.ts.map +1 -0
- package/dist/components/controls/Dropdown/types.js +1 -0
- package/dist/components/controls/SegmentedControl/types.d.ts +6 -0
- package/dist/components/controls/SegmentedControl/types.d.ts.map +1 -0
- package/dist/components/controls/SegmentedControl/types.js +1 -0
- package/dist/components/dialogs/Alert/types.d.ts +7 -0
- package/dist/components/dialogs/Alert/types.d.ts.map +1 -0
- package/dist/components/dialogs/Alert/types.js +1 -0
- package/dist/components/dialogs/Toast/types.d.ts +34 -0
- package/dist/components/dialogs/Toast/types.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/types.js +10 -0
- package/dist/components/dialogs/Toast/useToast.d.ts +36 -0
- package/dist/components/dialogs/Toast/useToast.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/useToast.js +90 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts +3 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/tooltip.js +33 -0
- package/dist/components/indicators/Tooltip/types.d.ts +14 -0
- package/dist/components/indicators/Tooltip/types.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/types.js +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts +18 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.js +57 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts +14 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts.map +1 -0
- package/dist/components/inputs/Tags/tag-bar-styles.js +313 -0
- package/dist/components/inputs/Tags/types.d.ts +93 -0
- package/dist/components/inputs/Tags/types.d.ts.map +1 -0
- package/dist/components/inputs/Tags/types.js +216 -0
- package/dist/components/inputs/search/types.d.ts +9 -0
- package/dist/components/inputs/search/types.d.ts.map +1 -0
- package/dist/components/inputs/search/types.js +1 -0
- package/dist/components/navigation/adaptive/types.d.ts +16 -0
- package/dist/components/navigation/adaptive/types.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/types.js +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts +27 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.js +40 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts +6 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useBreakpoints.js +37 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts +93 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.js +145 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts +31 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewAnimation.js +591 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts +52 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewResize.js +146 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts +25 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts.map +1 -0
- package/dist/components/navigation/navstack/useNavigationStack.js +133 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts +20 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts.map +1 -0
- package/dist/components/navigation/slideover/useSlideoverController.js +267 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts +20 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts.map +1 -0
- package/dist/components/navigation/splitview/useSplitViewController.js +325 -0
- package/dist/components/navigation/tabcontroller/types.d.ts +21 -0
- package/dist/components/navigation/tabcontroller/types.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/types.js +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts +5 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.js +10 -0
- package/dist/components/navigation/types.d.ts +8 -0
- package/dist/components/navigation/types.d.ts.map +1 -0
- package/dist/components/navigation/types.js +1 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts +11 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts.map +1 -0
- package/dist/components/pickers/CollectionPicker/types.js +1 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts +13 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts.map +1 -0
- package/dist/components/pickers/ColorPicker/colors.js +266 -0
- package/dist/components/pickers/FilePicker/types.d.ts +10 -0
- package/dist/components/pickers/FilePicker/types.d.ts.map +1 -0
- package/dist/components/pickers/FilePicker/types.js +1 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/theme.d.ts +73 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +279 -0
- package/dist/themes/blank.d.ts +7 -0
- package/dist/themes/blank.d.ts.map +1 -0
- package/dist/themes/blank.js +543 -0
- package/dist/themes/crimson-dark.d.ts +4 -0
- package/dist/themes/crimson-dark.d.ts.map +1 -0
- package/dist/themes/crimson-dark.js +552 -0
- package/dist/themes/cyan-light.d.ts +4 -0
- package/dist/themes/cyan-light.d.ts.map +1 -0
- package/dist/themes/cyan-light.js +552 -0
- package/dist/themes/dark.d.ts +4 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/dark.js +551 -0
- package/dist/themes/gold-dark.d.ts +4 -0
- package/dist/themes/gold-dark.d.ts.map +1 -0
- package/dist/themes/gold-dark.js +552 -0
- package/dist/themes/grass-dark.d.ts +4 -0
- package/dist/themes/grass-dark.d.ts.map +1 -0
- package/dist/themes/grass-dark.js +552 -0
- package/dist/themes/indigo.d.ts +4 -0
- package/dist/themes/indigo.d.ts.map +1 -0
- package/dist/themes/indigo.js +552 -0
- package/dist/themes/light.d.ts +4 -0
- package/dist/themes/light.d.ts.map +1 -0
- package/dist/themes/light.js +551 -0
- package/dist/themes/orange-dark.d.ts +4 -0
- package/dist/themes/orange-dark.d.ts.map +1 -0
- package/dist/themes/orange-dark.js +551 -0
- package/dist/themes/orange-light.d.ts +4 -0
- package/dist/themes/orange-light.d.ts.map +1 -0
- package/dist/themes/orange-light.js +551 -0
- package/package.json +62 -0
- package/src/components/controls/Button/Button.vue +417 -0
- package/src/components/controls/Button/README.md +348 -0
- package/src/components/controls/Button/theme.css +200 -0
- package/src/components/controls/Checkbox/Checkbox.vue +164 -0
- package/src/components/controls/Checkbox/README.md +441 -0
- package/src/components/controls/Checkbox/theme.css +36 -0
- package/src/components/controls/Dropdown/Dropdown.vue +476 -0
- package/src/components/controls/Dropdown/README.md +370 -0
- package/src/components/controls/Dropdown/theme.css +50 -0
- package/src/components/controls/Dropdown/types.ts +6 -0
- package/src/components/controls/IconButton/IconButton.vue +267 -0
- package/src/components/controls/IconButton/README.md +502 -0
- package/src/components/controls/IconButton/theme.css +89 -0
- package/src/components/controls/Radio/README.md +591 -0
- package/src/components/controls/Radio/Radio.vue +89 -0
- package/src/components/controls/Radio/theme.css +14 -0
- package/src/components/controls/RangeSlider/README.md +608 -0
- package/src/components/controls/RangeSlider/RangeSlider.vue +535 -0
- package/src/components/controls/RangeSlider/theme.css +80 -0
- package/src/components/controls/SegmentedControl/README.md +587 -0
- package/src/components/controls/SegmentedControl/SegmentedControl.vue +284 -0
- package/src/components/controls/SegmentedControl/theme.css +60 -0
- package/src/components/controls/SegmentedControl/types.ts +5 -0
- package/src/components/controls/Slider/README.md +627 -0
- package/src/components/controls/Slider/Slider.vue +260 -0
- package/src/components/controls/Slider/theme.css +74 -0
- package/src/components/controls/Stepper/README.md +601 -0
- package/src/components/controls/Stepper/Stepper.vue +103 -0
- package/src/components/controls/Stepper/theme.css +53 -0
- package/src/components/controls/Switch/README.md +667 -0
- package/src/components/controls/Switch/Switch.vue +127 -0
- package/src/components/controls/Switch/theme.css +42 -0
- package/src/components/dialogs/Alert/Alert.vue +218 -0
- package/src/components/dialogs/Alert/README.md +450 -0
- package/src/components/dialogs/Alert/theme.css +44 -0
- package/src/components/dialogs/Alert/types.ts +11 -0
- package/src/components/dialogs/Toast/README.md +522 -0
- package/src/components/dialogs/Toast/Toast.vue +296 -0
- package/src/components/dialogs/Toast/ToastContainer.vue +330 -0
- package/src/components/dialogs/Toast/theme.css +44 -0
- package/src/components/dialogs/Toast/types.ts +46 -0
- package/src/components/dialogs/Toast/useToast.ts +127 -0
- package/src/components/indicators/ProgressBar/ProgressBar.vue +98 -0
- package/src/components/indicators/ProgressBar/README.md +744 -0
- package/src/components/indicators/ProgressBar/theme.css +36 -0
- package/src/components/indicators/Tooltip/README.md +723 -0
- package/src/components/indicators/Tooltip/TooltipProvider.vue +142 -0
- package/src/components/indicators/Tooltip/theme.css +18 -0
- package/src/components/indicators/Tooltip/tooltip.ts +48 -0
- package/src/components/indicators/Tooltip/types.ts +15 -0
- package/src/components/indicators/Tooltip/useTooltip.ts +71 -0
- package/src/components/inputs/AutogrowTextView/AutogrowTextView.vue +110 -0
- package/src/components/inputs/AutogrowTextView/README.md +643 -0
- package/src/components/inputs/AutogrowTextView/theme.css +28 -0
- package/src/components/inputs/InputCard/InputCard.vue +600 -0
- package/src/components/inputs/InputCard/README.md +636 -0
- package/src/components/inputs/InputEmail/InputEmail.vue +698 -0
- package/src/components/inputs/InputEmail/README.md +764 -0
- package/src/components/inputs/InputNumber/InputNumber.vue +300 -0
- package/src/components/inputs/InputNumber/README.md +749 -0
- package/src/components/inputs/InputPhone/InputPhone.vue +645 -0
- package/src/components/inputs/InputPhone/README.md +636 -0
- package/src/components/inputs/InputSecure/InputSecure.vue +646 -0
- package/src/components/inputs/InputSecure/README.md +771 -0
- package/src/components/inputs/InputText/InputText.vue +225 -0
- package/src/components/inputs/InputText/README.md +844 -0
- package/src/components/inputs/OTP/OTP.vue +349 -0
- package/src/components/inputs/OTP/README.md +736 -0
- package/src/components/inputs/OTP/theme.css +50 -0
- package/src/components/inputs/StringCapture/README.md +718 -0
- package/src/components/inputs/StringCapture/StringCapture.vue +315 -0
- package/src/components/inputs/StringCapture/theme.css +86 -0
- package/src/components/inputs/Tags/README.md +897 -0
- package/src/components/inputs/Tags/TagBar.vue +793 -0
- package/src/components/inputs/Tags/TagCreation.vue +219 -0
- package/src/components/inputs/Tags/TagPicker.vue +380 -0
- package/src/components/inputs/Tags/tag-bar-styles.ts +354 -0
- package/src/components/inputs/Tags/theme.css +121 -0
- package/src/components/inputs/Tags/types.ts +346 -0
- package/src/components/inputs/search/README.md +759 -0
- package/src/components/inputs/search/SearchBar.vue +394 -0
- package/src/components/inputs/search/SearchResults.vue +310 -0
- package/src/components/inputs/search/theme.css +187 -0
- package/src/components/inputs/search/types.ts +8 -0
- package/src/components/inputs/theme.css +102 -0
- package/src/components/menus/ActionMenu/ActionMenu.vue +383 -0
- package/src/components/menus/ActionMenu/README.md +825 -0
- package/src/components/menus/ActionMenu/theme.css +93 -0
- package/src/components/models/Popover/Popover.vue +551 -0
- package/src/components/models/Popover/README.md +885 -0
- package/src/components/models/Popover/theme.css +52 -0
- package/src/components/models/Sheet/README.md +1159 -0
- package/src/components/models/Sheet/Sheet.vue +465 -0
- package/src/components/models/Sheet/theme.css +72 -0
- package/src/components/models/Sidebar/README.md +1228 -0
- package/src/components/models/Sidebar/Sidebar.vue +480 -0
- package/src/components/models/Sidebar/theme.css +90 -0
- package/src/components/navigation/adaptive/AdaptiveLayout.vue +779 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutBreadcrumbs.vue +192 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutMenuButton.vue +149 -0
- package/src/components/navigation/adaptive/README.md +768 -0
- package/src/components/navigation/adaptive/types.ts +19 -0
- package/src/components/navigation/adaptive/useAdaptiveLayout.ts +89 -0
- package/src/components/navigation/adaptive/useBreakpoints.ts +41 -0
- package/src/components/navigation/adaptive/useContainerMonitor.ts +214 -0
- package/src/components/navigation/adaptive/useViewAnimation.ts +721 -0
- package/src/components/navigation/adaptive/useViewResize.ts +211 -0
- package/src/components/navigation/navstack/NavigationStack.vue +180 -0
- package/src/components/navigation/navstack/README.md +994 -0
- package/src/components/navigation/navstack/useNavigationStack.ts +164 -0
- package/src/components/navigation/slideover/README.md +1275 -0
- package/src/components/navigation/slideover/SlideoverController.vue +287 -0
- package/src/components/navigation/slideover/useSlideoverController.ts +320 -0
- package/src/components/navigation/splitview/README.md +1115 -0
- package/src/components/navigation/splitview/SplitViewController.vue +176 -0
- package/src/components/navigation/splitview/useSplitViewController.ts +388 -0
- package/src/components/navigation/tabcontroller/README.md +919 -0
- package/src/components/navigation/tabcontroller/TabController.vue +307 -0
- package/src/components/navigation/tabcontroller/TabItem.vue +57 -0
- package/src/components/navigation/tabcontroller/types.ts +24 -0
- package/src/components/navigation/tabcontroller/useTabController.ts +18 -0
- package/src/components/navigation/theme.css +91 -0
- package/src/components/navigation/types.ts +7 -0
- package/src/components/pickers/CollectionPicker/CollectionPicker.vue +398 -0
- package/src/components/pickers/CollectionPicker/README.md +1115 -0
- package/src/components/pickers/CollectionPicker/theme.css +14 -0
- package/src/components/pickers/CollectionPicker/types.ts +11 -0
- package/src/components/pickers/ColorPicker/ColorPicker.vue +376 -0
- package/src/components/pickers/ColorPicker/README.md +1439 -0
- package/src/components/pickers/ColorPicker/colors.ts +299 -0
- package/src/components/pickers/ColorPicker/theme.css +32 -0
- package/src/components/pickers/DatePicker/DatePicker.vue +660 -0
- package/src/components/pickers/DatePicker/README.md +1195 -0
- package/src/components/pickers/DatePicker/theme.css +22 -0
- package/src/components/pickers/FilePicker/FilePicker.vue +534 -0
- package/src/components/pickers/FilePicker/README.md +1542 -0
- package/src/components/pickers/FilePicker/theme.css +48 -0
- package/src/components/pickers/FilePicker/types.ts +10 -0
- package/src/components/pickers/IconPicker/IconPicker.vue +327 -0
- package/src/components/pickers/IconPicker/README.md +1161 -0
- package/src/components/pickers/IconPicker/theme.css +28 -0
- package/src/components/pickers/theme.css +82 -0
- package/src/components/views/MarkdownViewer/MarkdownViewer.vue +442 -0
- package/src/components/views/MarkdownViewer/README.md +833 -0
- package/src/components/views/MarkdownViewer/theme.css +130 -0
- package/src/index.ts +263 -0
- package/src/theme.ts +378 -0
- package/src/themes/crimson-dark.ts +556 -0
- package/src/themes/cyan-light.ts +556 -0
- package/src/themes/dark.ts +557 -0
- package/src/themes/gold-dark.ts +556 -0
- package/src/themes/grass-dark.ts +556 -0
- package/src/themes/indigo.ts +556 -0
- package/src/themes/light.ts +557 -0
- package/src/themes/orange-dark.ts +557 -0
- package/src/themes/orange-light.ts +557 -0
- package/src/vue.d.ts +45 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@import "../theme.css";
|
|
2
|
+
|
|
3
|
+
/* Light theme */
|
|
4
|
+
:root {
|
|
5
|
+
/* Icon Cells */
|
|
6
|
+
--iconpicker-icon-cell-bg: #f3f4f6;
|
|
7
|
+
--iconpicker-icon-cell-border: #d1d5db;
|
|
8
|
+
--iconpicker-icon-cell-hover-bg: #e5e7eb;
|
|
9
|
+
--iconpicker-icon-cell-selected-bg: #acd8fc;
|
|
10
|
+
--iconpicker-icon-cell-selected-border: #5eb1ef;
|
|
11
|
+
|
|
12
|
+
/* Icon Color */
|
|
13
|
+
--iconpicker-icon-color: #374151;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Dark theme */
|
|
17
|
+
.dark,
|
|
18
|
+
.dark-theme {
|
|
19
|
+
/* Icon Cells */
|
|
20
|
+
--iconpicker-icon-cell-bg: #484848;
|
|
21
|
+
--iconpicker-icon-cell-border: #7b7b7b;
|
|
22
|
+
--iconpicker-icon-cell-hover-bg: #313131;
|
|
23
|
+
--iconpicker-icon-cell-selected-bg: #0090ff;
|
|
24
|
+
--iconpicker-icon-cell-selected-border: #eeeeee;
|
|
25
|
+
|
|
26
|
+
/* Icon Color */
|
|
27
|
+
--iconpicker-icon-color: #eeeeee;
|
|
28
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* Common picker theme variables */
|
|
2
|
+
:root {
|
|
3
|
+
/* Button */
|
|
4
|
+
--picker-button-bg: transparent;
|
|
5
|
+
--picker-button-border: 1px solid transparent;
|
|
6
|
+
--picker-button-hover-bg: #fcfcfc;
|
|
7
|
+
--picker-button-hover-border: 1px solid #d9d9d9;
|
|
8
|
+
--picker-button-hover-shadow: none;
|
|
9
|
+
--picker-button-hover-inset-shadow: none;
|
|
10
|
+
--picker-button-selected-bg: #fcfcfc;
|
|
11
|
+
--picker-button-selected-shadow: none;
|
|
12
|
+
--picker-button-selected-inset-shadow: none;
|
|
13
|
+
|
|
14
|
+
/* Picker */
|
|
15
|
+
--picker-picker-bg: #ffffff;
|
|
16
|
+
--picker-picker-border: 1px solid rgba(0, 0, 0, 0.1);
|
|
17
|
+
--picker-picker-shadow: rgba(0, 0, 0, 0.1);
|
|
18
|
+
--picker-picker-inset-shadow: rgba(255, 255, 255, 0.8);
|
|
19
|
+
|
|
20
|
+
/* Selection Bar */
|
|
21
|
+
--picker-selection-bar-bg: #f9fafb;
|
|
22
|
+
--picker-selection-bar-text: #1f2937;
|
|
23
|
+
--picker-selection-bar-border: rgba(0, 0, 0, 0.1);
|
|
24
|
+
|
|
25
|
+
/* Overlay */
|
|
26
|
+
--picker-overlay-bg: rgba(0, 0, 0, 0.5);
|
|
27
|
+
|
|
28
|
+
/* Text */
|
|
29
|
+
--picker-text-primary: #1f2937;
|
|
30
|
+
--picker-text-secondary: #374151;
|
|
31
|
+
--picker-text-muted: #9ca3af;
|
|
32
|
+
|
|
33
|
+
/* Borders */
|
|
34
|
+
--picker-border-light: rgba(0, 0, 0, 0.1);
|
|
35
|
+
--picker-border-medium: rgba(0, 0, 0, 0.15);
|
|
36
|
+
|
|
37
|
+
/* Backgrounds */
|
|
38
|
+
--picker-bg-subtle: rgba(0, 0, 0, 0.05);
|
|
39
|
+
--picker-bg-hover: rgba(0, 0, 0, 0.05);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Dark theme */
|
|
43
|
+
.dark,
|
|
44
|
+
.dark-theme {
|
|
45
|
+
/* Button */
|
|
46
|
+
--picker-button-bg: transparent;
|
|
47
|
+
--picker-button-border: none;
|
|
48
|
+
--picker-button-hover-bg: #484848;
|
|
49
|
+
--picker-button-hover-border: none;
|
|
50
|
+
--picker-button-hover-shadow: rgba(0, 0, 0, 0.21);
|
|
51
|
+
--picker-button-hover-inset-shadow: rgba(255, 255, 255, 0.1);
|
|
52
|
+
--picker-button-selected-bg: #484848;
|
|
53
|
+
--picker-button-selected-shadow: rgba(0, 0, 0, 0.21);
|
|
54
|
+
--picker-button-selected-inset-shadow: rgba(255, 255, 255, 0.1);
|
|
55
|
+
|
|
56
|
+
/* Picker */
|
|
57
|
+
--picker-picker-bg: #484848;
|
|
58
|
+
--picker-picker-border: none;
|
|
59
|
+
--picker-picker-shadow: rgba(0, 0, 0, 0.21);
|
|
60
|
+
--picker-picker-inset-shadow: rgba(255, 255, 255, 0.1);
|
|
61
|
+
|
|
62
|
+
/* Selection Bar */
|
|
63
|
+
--picker-selection-bar-bg: #5a5a5a;
|
|
64
|
+
--picker-selection-bar-text: #eeeeee;
|
|
65
|
+
--picker-selection-bar-border: rgba(0, 0, 0, 0.25);
|
|
66
|
+
|
|
67
|
+
/* Overlay */
|
|
68
|
+
--picker-overlay-bg: rgba(0, 0, 0, 0.25);
|
|
69
|
+
|
|
70
|
+
/* Text */
|
|
71
|
+
--picker-text-primary: #eeeeee;
|
|
72
|
+
--picker-text-secondary: #b4b4b4;
|
|
73
|
+
--picker-text-muted: #7b7b7b;
|
|
74
|
+
|
|
75
|
+
/* Borders */
|
|
76
|
+
--picker-border-light: rgba(255, 255, 255, 0.15);
|
|
77
|
+
--picker-border-medium: rgba(255, 255, 255, 0.25);
|
|
78
|
+
|
|
79
|
+
/* Backgrounds */
|
|
80
|
+
--picker-bg-subtle: rgba(255, 255, 255, 0.1);
|
|
81
|
+
--picker-bg-hover: rgba(255, 255, 255, 0.1);
|
|
82
|
+
}
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
onMounted,
|
|
5
|
+
nextTick,
|
|
6
|
+
watch,
|
|
7
|
+
ref,
|
|
8
|
+
useCssModule,
|
|
9
|
+
createApp,
|
|
10
|
+
} from "vue";
|
|
11
|
+
import { marked } from "marked";
|
|
12
|
+
import Prism from "prismjs";
|
|
13
|
+
import { CloneIcon, CheckIcon } from "@umbra-ui/icons";
|
|
14
|
+
import "./theme.css";
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
content: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const props = defineProps<Props>();
|
|
21
|
+
|
|
22
|
+
const containerRef = ref<HTMLElement | null>(null);
|
|
23
|
+
const css = useCssModule();
|
|
24
|
+
|
|
25
|
+
const htmlContent = computed(() => {
|
|
26
|
+
const renderer = new marked.Renderer();
|
|
27
|
+
|
|
28
|
+
// Custom code renderer to add language classes (marked v5+ token signature)
|
|
29
|
+
renderer.code = ({ text, lang }: { text: string; lang?: string }): string => {
|
|
30
|
+
const LANGUAGE_ALIASES: Record<string, string> = {
|
|
31
|
+
ts: "typescript",
|
|
32
|
+
js: "javascript",
|
|
33
|
+
sh: "bash",
|
|
34
|
+
shell: "bash",
|
|
35
|
+
html: "markup",
|
|
36
|
+
xml: "markup",
|
|
37
|
+
vue: "markup",
|
|
38
|
+
json5: "json",
|
|
39
|
+
};
|
|
40
|
+
const rawLanguage =
|
|
41
|
+
typeof lang === "string" ? lang.toLowerCase() : undefined;
|
|
42
|
+
const normalizedLanguage = rawLanguage
|
|
43
|
+
? LANGUAGE_ALIASES[rawLanguage] ?? rawLanguage
|
|
44
|
+
: undefined;
|
|
45
|
+
const validLanguage =
|
|
46
|
+
normalizedLanguage && Prism.languages[normalizedLanguage]
|
|
47
|
+
? normalizedLanguage
|
|
48
|
+
: "plaintext";
|
|
49
|
+
const highlighted =
|
|
50
|
+
validLanguage === "plaintext"
|
|
51
|
+
? text
|
|
52
|
+
: Prism.highlight(text, Prism.languages[validLanguage], validLanguage);
|
|
53
|
+
return `<pre><code class="language-${validLanguage}">${highlighted}</code></pre>`;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
marked.setOptions({
|
|
57
|
+
renderer: renderer,
|
|
58
|
+
breaks: true,
|
|
59
|
+
gfm: true,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const rawHtml = marked.parse(props.content) as string;
|
|
63
|
+
// Wrap tables for styling without relying on renderer signature differences
|
|
64
|
+
return rawHtml
|
|
65
|
+
.replace(/<table>/g, '<div class="table-wrapper">\n <table>')
|
|
66
|
+
.replace(/<\/table>/g, " </table>\n </div>");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const enhanceCodeBlocks = (): void => {
|
|
70
|
+
const root = containerRef.value;
|
|
71
|
+
if (!root) return;
|
|
72
|
+
const pres = Array.from(root.querySelectorAll("pre"));
|
|
73
|
+
for (const pre of pres) {
|
|
74
|
+
const el = pre as HTMLElement & {
|
|
75
|
+
dataset: Record<string, string | undefined>;
|
|
76
|
+
};
|
|
77
|
+
if (el.dataset.copyBound === "true") continue;
|
|
78
|
+
el.dataset.copyBound = "true";
|
|
79
|
+
el.style.position = el.style.position || "relative";
|
|
80
|
+
|
|
81
|
+
const button = document.createElement("button");
|
|
82
|
+
button.type = "button";
|
|
83
|
+
button.className = css.copy_button;
|
|
84
|
+
button.setAttribute("aria-label", "Copy code to clipboard");
|
|
85
|
+
// Mount icons inside the button so it stays consistent with the icon set
|
|
86
|
+
const cloneMount = document.createElement("span");
|
|
87
|
+
const checkMount = document.createElement("span");
|
|
88
|
+
cloneMount.className = css.copy_icon;
|
|
89
|
+
checkMount.className = css.check_icon;
|
|
90
|
+
button.appendChild(cloneMount);
|
|
91
|
+
button.appendChild(checkMount);
|
|
92
|
+
try {
|
|
93
|
+
const appClone = createApp(CloneIcon, { size: 16 });
|
|
94
|
+
appClone.mount(cloneMount);
|
|
95
|
+
const appCheck = createApp(CheckIcon, { size: 16 });
|
|
96
|
+
appCheck.mount(checkMount);
|
|
97
|
+
// Hide the check icon by default
|
|
98
|
+
checkMount.style.display = "none";
|
|
99
|
+
} catch {
|
|
100
|
+
// Fallback emoji if mounting fails for any reason
|
|
101
|
+
button.textContent = "📋";
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const handleClick = async (ev: Event) => {
|
|
105
|
+
ev.stopPropagation();
|
|
106
|
+
const code = el.querySelector("code");
|
|
107
|
+
const text = code?.textContent ?? "";
|
|
108
|
+
try {
|
|
109
|
+
if (navigator.clipboard?.writeText) {
|
|
110
|
+
await navigator.clipboard.writeText(text);
|
|
111
|
+
} else {
|
|
112
|
+
const ta = document.createElement("textarea");
|
|
113
|
+
ta.value = text;
|
|
114
|
+
ta.style.position = "fixed";
|
|
115
|
+
ta.style.opacity = "0";
|
|
116
|
+
document.body.appendChild(ta);
|
|
117
|
+
ta.select();
|
|
118
|
+
document.execCommand("copy");
|
|
119
|
+
document.body.removeChild(ta);
|
|
120
|
+
}
|
|
121
|
+
button.classList.add(css.copied);
|
|
122
|
+
// Swap icons to show checkmark briefly
|
|
123
|
+
if (cloneMount && checkMount) {
|
|
124
|
+
cloneMount.style.display = "none";
|
|
125
|
+
checkMount.style.display = "inline-flex";
|
|
126
|
+
}
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
button.classList.remove(css.copied);
|
|
129
|
+
if (cloneMount && checkMount) {
|
|
130
|
+
checkMount.style.display = "none";
|
|
131
|
+
cloneMount.style.display = "inline-flex";
|
|
132
|
+
}
|
|
133
|
+
}, 1200);
|
|
134
|
+
} catch {
|
|
135
|
+
// no-op
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
button.addEventListener("click", handleClick);
|
|
139
|
+
el.appendChild(button);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
onMounted(() => {
|
|
144
|
+
nextTick(() => {
|
|
145
|
+
// Re-highlight any inline code that might have been missed
|
|
146
|
+
Prism.highlightAll();
|
|
147
|
+
enhanceCodeBlocks();
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
watch(htmlContent, async () => {
|
|
152
|
+
await nextTick();
|
|
153
|
+
Prism.highlightAll();
|
|
154
|
+
enhanceCodeBlocks();
|
|
155
|
+
});
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
<template>
|
|
159
|
+
<div :class="$style.container" ref="containerRef" v-html="htmlContent"></div>
|
|
160
|
+
</template>
|
|
161
|
+
|
|
162
|
+
<style module>
|
|
163
|
+
.container {
|
|
164
|
+
font-size: var(--body);
|
|
165
|
+
line-height: var(--line-height-relaxed);
|
|
166
|
+
color: var(--markdownviewer-container-color);
|
|
167
|
+
font-family: var(--markdownviewer-container-font-family);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Headers */
|
|
171
|
+
.container :global(h1),
|
|
172
|
+
.container :global(h2),
|
|
173
|
+
.container :global(h3),
|
|
174
|
+
.container :global(h4),
|
|
175
|
+
.container :global(h5),
|
|
176
|
+
.container :global(h6) {
|
|
177
|
+
margin-top: 2rem;
|
|
178
|
+
margin-bottom: 1rem;
|
|
179
|
+
font-weight: var(--font-weight-semibold);
|
|
180
|
+
line-height: var(--line-height-tight);
|
|
181
|
+
letter-spacing: var(--letter-spacing-tight);
|
|
182
|
+
color: var(--markdownviewer-header-color);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.container :global(h1) {
|
|
186
|
+
font-size: var(--large-title);
|
|
187
|
+
border-bottom: 1px solid var(--markdownviewer-header-border);
|
|
188
|
+
padding-bottom: 0.3rem;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.container :global(h2) {
|
|
192
|
+
font-size: var(--title1);
|
|
193
|
+
border-bottom: 1px solid var(--markdownviewer-header-border);
|
|
194
|
+
padding-bottom: 0.3rem;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.container :global(h3) {
|
|
198
|
+
font-size: var(--title2);
|
|
199
|
+
}
|
|
200
|
+
.container :global(h4) {
|
|
201
|
+
font-size: var(--title3);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* Paragraphs and lists */
|
|
205
|
+
.container :global(p) {
|
|
206
|
+
margin-bottom: 1rem;
|
|
207
|
+
font-size: var(--body);
|
|
208
|
+
line-height: var(--line-height-relaxed);
|
|
209
|
+
letter-spacing: var(--letter-spacing-normal);
|
|
210
|
+
color: var(--markdownviewer-paragraph-color);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.container :global(ul),
|
|
214
|
+
.container :global(ol) {
|
|
215
|
+
margin-bottom: 1rem;
|
|
216
|
+
padding-left: 2rem;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.container :global(li) {
|
|
220
|
+
margin-bottom: 0.25rem;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* Links */
|
|
224
|
+
.container :global(a) {
|
|
225
|
+
color: var(--markdownviewer-link-color);
|
|
226
|
+
text-decoration: none;
|
|
227
|
+
transition: color 0.2s;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.container :global(a:hover) {
|
|
231
|
+
color: var(--markdownviewer-link-hover-color);
|
|
232
|
+
text-decoration: underline;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* Inline code */
|
|
236
|
+
.container :global(code:not([class*="language-"])) {
|
|
237
|
+
padding: 0.2em 0.4em;
|
|
238
|
+
margin: 0;
|
|
239
|
+
font-size: 85%;
|
|
240
|
+
background-color: var(--markdownviewer-inline-code-bg);
|
|
241
|
+
border-radius: 6px;
|
|
242
|
+
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
|
|
243
|
+
color: var(--markdownviewer-inline-code-color);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* Code blocks */
|
|
247
|
+
.container :global(pre) {
|
|
248
|
+
margin: 1rem 0;
|
|
249
|
+
padding: 1rem;
|
|
250
|
+
/* VS Code Dark Modern editor background */
|
|
251
|
+
background-color: var(--markdownviewer-code-block-bg);
|
|
252
|
+
border-radius: 6px;
|
|
253
|
+
overflow-x: auto;
|
|
254
|
+
border: 1px solid var(--markdownviewer-code-block-border);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.container :global(pre code) {
|
|
258
|
+
background-color: transparent;
|
|
259
|
+
padding: 0;
|
|
260
|
+
font-size: 14px;
|
|
261
|
+
line-height: 1.45;
|
|
262
|
+
/* VS Code default foreground */
|
|
263
|
+
color: var(--markdownviewer-code-block-color);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.copy_button {
|
|
267
|
+
position: absolute;
|
|
268
|
+
top: 8px;
|
|
269
|
+
right: 8px;
|
|
270
|
+
width: 28px;
|
|
271
|
+
height: 28px;
|
|
272
|
+
display: inline-flex;
|
|
273
|
+
align-items: center;
|
|
274
|
+
justify-content: center;
|
|
275
|
+
font-size: 14px;
|
|
276
|
+
line-height: 1;
|
|
277
|
+
color: var(--markdownviewer-copy-button-color);
|
|
278
|
+
background-color: var(--markdownviewer-copy-button-bg);
|
|
279
|
+
border: none;
|
|
280
|
+
border-radius: 6px;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
opacity: 0;
|
|
283
|
+
transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease,
|
|
284
|
+
border-color 0.15s ease, transform 0.05s ease;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.copy_icon,
|
|
288
|
+
.check_icon {
|
|
289
|
+
display: inline-flex;
|
|
290
|
+
align-items: center;
|
|
291
|
+
justify-content: center;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.copy_button:hover {
|
|
295
|
+
background-color: var(--markdownviewer-copy-button-hover-bg);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.copy_button:active {
|
|
299
|
+
transform: translateY(1px);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.copied {
|
|
303
|
+
color: var(--markdownviewer-copy-button-copied-color);
|
|
304
|
+
border-color: var(--markdownviewer-copy-button-copied-border);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.container :global(pre:hover) .copy_button {
|
|
308
|
+
opacity: 1;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/* Tables */
|
|
312
|
+
.container :global(.table-wrapper) {
|
|
313
|
+
overflow-x: auto;
|
|
314
|
+
margin: 1rem 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.container :global(table) {
|
|
318
|
+
width: 100%;
|
|
319
|
+
border-collapse: collapse;
|
|
320
|
+
font-size: 14px;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.container :global(th),
|
|
324
|
+
.container :global(td) {
|
|
325
|
+
padding: 0.75rem;
|
|
326
|
+
text-align: left;
|
|
327
|
+
border: 1px solid var(--markdownviewer-table-border);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.container :global(th) {
|
|
331
|
+
background-color: var(--markdownviewer-table-th-bg);
|
|
332
|
+
font-weight: 600;
|
|
333
|
+
color: var(--markdownviewer-table-th-color);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.container :global(tr:nth-child(even)) {
|
|
337
|
+
background-color: var(--markdownviewer-table-tr-even-bg);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.container :global(tr:hover) {
|
|
341
|
+
background-color: var(--markdownviewer-table-tr-hover-bg);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/* Horizontal rules */
|
|
345
|
+
.container :global(hr) {
|
|
346
|
+
height: 0.25em;
|
|
347
|
+
padding: 0;
|
|
348
|
+
margin: 2rem 0;
|
|
349
|
+
background-color: var(--markdownviewer-hr-bg);
|
|
350
|
+
border: 0;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/* Blockquotes */
|
|
354
|
+
.container :global(blockquote) {
|
|
355
|
+
padding: 0 1em;
|
|
356
|
+
color: var(--markdownviewer-blockquote-color);
|
|
357
|
+
border-left: 0.25em solid var(--markdownviewer-blockquote-border);
|
|
358
|
+
margin: 1rem 0;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/* Strong and emphasis */
|
|
362
|
+
.container :global(strong) {
|
|
363
|
+
font-weight: 600;
|
|
364
|
+
color: var(--markdownviewer-strong-color);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.container :global(em) {
|
|
368
|
+
font-style: italic;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/* Syntax highlighting */
|
|
372
|
+
.container :global(.token.comment),
|
|
373
|
+
.container :global(.token.prolog),
|
|
374
|
+
.container :global(.token.doctype),
|
|
375
|
+
.container :global(.token.cdata) {
|
|
376
|
+
/* VS Code comment */
|
|
377
|
+
color: var(--markdownviewer-token-comment);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.container :global(.token.punctuation) {
|
|
381
|
+
color: var(--markdownviewer-token-punctuation);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.container :global(.token.tag),
|
|
385
|
+
.container :global(.token.namespace),
|
|
386
|
+
.container :global(.token.deleted),
|
|
387
|
+
.container :global(.token.constant),
|
|
388
|
+
.container :global(.token.symbol) {
|
|
389
|
+
/* VS Code blue (tags, constants) */
|
|
390
|
+
color: var(--markdownviewer-token-tag);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.container :global(.token.property),
|
|
394
|
+
.container :global(.token.attr-name),
|
|
395
|
+
.container :global(.token.selector),
|
|
396
|
+
.container :global(.token.builtin) {
|
|
397
|
+
/* VS Code light blue (property/attr) */
|
|
398
|
+
color: var(--markdownviewer-token-property);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.container :global(.token.boolean),
|
|
402
|
+
.container :global(.token.number) {
|
|
403
|
+
/* VS Code number/boolean */
|
|
404
|
+
color: var(--markdownviewer-token-boolean);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.container :global(.token.string),
|
|
408
|
+
.container :global(.token.char),
|
|
409
|
+
.container :global(.token.inserted) {
|
|
410
|
+
/* VS Code string */
|
|
411
|
+
color: var(--markdownviewer-token-string);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.container :global(.token.operator),
|
|
415
|
+
.container :global(.token.entity),
|
|
416
|
+
.container :global(.token.url),
|
|
417
|
+
.container :global(.language-css .token.string),
|
|
418
|
+
.container :global(.style .token.string) {
|
|
419
|
+
color: var(--markdownviewer-token-operator);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.container :global(.token.keyword),
|
|
423
|
+
.container :global(.token.atrule) {
|
|
424
|
+
/* VS Code keyword */
|
|
425
|
+
color: var(--markdownviewer-token-keyword);
|
|
426
|
+
}
|
|
427
|
+
.container :global(.token.attr-value) {
|
|
428
|
+
color: var(--markdownviewer-token-string);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.container :global(.token.function),
|
|
432
|
+
.container :global(.token.class-name) {
|
|
433
|
+
/* VS Code function/type */
|
|
434
|
+
color: var(--markdownviewer-token-function);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.container :global(.token.regex),
|
|
438
|
+
.container :global(.token.important),
|
|
439
|
+
.container :global(.token.variable) {
|
|
440
|
+
color: var(--markdownviewer-token-regex);
|
|
441
|
+
}
|
|
442
|
+
</style>
|