@seekbuddy/dsh-ui 0.0.0-stage → 0.2.0-beta.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/CHANGELOG.md +49 -0
- package/LICENSE +22 -0
- package/README.md +175 -2
- package/README.zh.md +176 -0
- package/THIRD_PARTY_NOTICES.md +42 -0
- package/UPSTREAM.md +56 -0
- package/dist/blocks.js +1582 -0
- package/dist/chunks/chunk-23KOEBWJ.js +104 -0
- package/dist/chunks/chunk-3HCOU44R.js +697 -0
- package/dist/chunks/chunk-5JXG4BHW.js +31 -0
- package/dist/chunks/chunk-5XDVPALS.js +61 -0
- package/dist/chunks/chunk-AY44MQMD.js +3052 -0
- package/dist/chunks/chunk-B3EEK7A2.js +408 -0
- package/dist/chunks/chunk-CEBTQO6W.js +24 -0
- package/dist/chunks/chunk-CI73NXA5.js +202 -0
- package/dist/chunks/chunk-CTQPGUZP.js +22 -0
- package/dist/chunks/chunk-F352IICS.js +57 -0
- package/dist/chunks/chunk-IOBKTEKP.js +144 -0
- package/dist/chunks/chunk-KETGFAOH.js +66 -0
- package/dist/chunks/chunk-LA3QDZYN.js +2777 -0
- package/dist/chunks/chunk-NE62SYOZ.js +89 -0
- package/dist/chunks/chunk-OQPH36OI.js +754 -0
- package/dist/chunks/chunk-QJKAQ6PO.js +155 -0
- package/dist/chunks/chunk-R6AUJQ3G.js +129 -0
- package/dist/chunks/chunk-RNVSCTW7.js +24 -0
- package/dist/chunks/chunk-RZOP2PFC.js +152 -0
- package/dist/chunks/chunk-TQU54HSM.js +112 -0
- package/dist/chunks/chunk-TUK6UGXM.js +36 -0
- package/dist/chunks/chunk-TZ7HRE6D.js +328 -0
- package/dist/chunks/chunk-VIH56PDF.js +57 -0
- package/dist/chunks/chunk-WUL523OW.js +27 -0
- package/dist/chunks/chunk-XX6MSZLS.js +261 -0
- package/dist/chunks/chunk-ZA47FP7C.js +7 -0
- package/dist/chunks/chunk-ZZNL5PWF.js +170 -0
- package/dist/icons.js +803 -0
- package/dist/index.js +1182 -0
- package/dist/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/katex.css +1 -0
- package/dist/katex.css.d.ts +2 -0
- package/dist/markdown.js +148 -0
- package/dist/meta.json +6876 -0
- package/dist/root-inputs.json +67 -0
- package/dist/seekbuddy-card.js +7 -0
- package/dist/seekbuddy-empty.js +8 -0
- package/dist/seekbuddy-internal/DangerButton.js +7 -0
- package/dist/seekbuddy-internal/Mark.js +7 -0
- package/dist/seekbuddy-internal/Message.js +10 -0
- package/dist/seekbuddy-internal/Pagination.js +9 -0
- package/dist/seekbuddy-internal/StatusBadge.js +7 -0
- package/dist/seekbuddy-internal/SubtleButton.js +7 -0
- package/dist/seekbuddy-internal/Switch.js +7 -0
- package/dist/seekbuddy-internal/Upload.js +7 -0
- package/dist/seekbuddy-internal/date/Calendar.js +8 -0
- package/dist/seekbuddy-internal/date/DatePicker.js +9 -0
- package/dist/seekbuddy-internal/date/DateRangePicker.js +9 -0
- package/dist/seekbuddy-internal/date/TimePicker.js +8 -0
- package/dist/seekbuddy-internal/date/fields.js +16 -0
- package/dist/seekbuddy-internal/qr/QrCode.js +7 -0
- package/dist/seekbuddy-spinner.js +7 -0
- package/dist/seekbuddy-tabs.js +7 -0
- package/dist/seekbuddy-timeline.js +8 -0
- package/dist/seekbuddy.js +89 -0
- package/dist/theme-bootstrap.js +13 -0
- package/dist/theme.js +37 -0
- package/dist/tokens.css +934 -0
- package/dist/tokens.css.d.ts +2 -0
- package/dist/types/Button.d.ts +18 -0
- package/dist/types/Checkbox.d.ts +19 -0
- package/dist/types/CodeFileIcon.d.ts +11 -0
- package/dist/types/CodeToolbar.d.ts +29 -0
- package/dist/types/ConfigField.d.ts +32 -0
- package/dist/types/ConnectionIndicator.d.ts +25 -0
- package/dist/types/DiffBlock.d.ts +51 -0
- package/dist/types/DisclosureRow.d.ts +35 -0
- package/dist/types/FileTypeIcon.d.ts +42 -0
- package/dist/types/FoldToggle.d.ts +19 -0
- package/dist/types/HoverCard.d.ts +36 -0
- package/dist/types/ImageLightbox.d.ts +26 -0
- package/dist/types/ImagePreview.d.ts +11 -0
- package/dist/types/Input.d.ts +11 -0
- package/dist/types/JsonTree.d.ts +58 -0
- package/dist/types/LinkIcon.d.ts +33 -0
- package/dist/types/Menu.d.ts +142 -0
- package/dist/types/MenuGroup.d.ts +21 -0
- package/dist/types/MenuSurface.d.ts +15 -0
- package/dist/types/Modal.d.ts +43 -0
- package/dist/types/PermissionIcon.d.ts +38 -0
- package/dist/types/Pill.d.ts +12 -0
- package/dist/types/ReadBlock.d.ts +47 -0
- package/dist/types/ReferenceIcon.d.ts +20 -0
- package/dist/types/RiskConfirmation.d.ts +19 -0
- package/dist/types/SearchBlock.d.ts +71 -0
- package/dist/types/SegmentedControl.d.ts +34 -0
- package/dist/types/SegmentedTabs.d.ts +25 -0
- package/dist/types/ShortcutKeys.d.ts +10 -0
- package/dist/types/SiteGlyph.d.ts +24 -0
- package/dist/types/StateDot.d.ts +19 -0
- package/dist/types/Switch.d.ts +19 -0
- package/dist/types/Tag.d.ts +31 -0
- package/dist/types/TerminalBlock.d.ts +77 -0
- package/dist/types/TextShimmer.d.ts +22 -0
- package/dist/types/Toast.d.ts +48 -0
- package/dist/types/Tooltip.d.ts +63 -0
- package/dist/types/WebBlock.d.ts +60 -0
- package/dist/types/ansi.d.ts +16 -0
- package/dist/types/blocks.d.ts +19 -0
- package/dist/types/clipboard.d.ts +8 -0
- package/dist/types/code-file-icon-artwork.d.ts +53 -0
- package/dist/types/code-file-types.d.ts +29 -0
- package/dist/types/code-highlighting.d.ts +11 -0
- package/dist/types/css-modules.d.ts +6 -0
- package/dist/types/darwin-desktop.d.ts +8 -0
- package/dist/types/file-size.d.ts +7 -0
- package/dist/types/focus.d.ts +8 -0
- package/dist/types/guide-artwork.d.ts +14 -0
- package/dist/types/head-tail-cap.d.ts +22 -0
- package/dist/types/icons/index.d.ts +384 -0
- package/dist/types/icons/props.d.ts +8 -0
- package/dist/types/icons/shared-artwork.d.ts +42 -0
- package/dist/types/icons.d.ts +6 -0
- package/dist/types/index.d.ts +53 -0
- package/dist/types/input-modality.d.ts +18 -0
- package/dist/types/keyboard-composition.d.ts +10 -0
- package/dist/types/markdown/CodeBlock.d.ts +34 -0
- package/dist/types/markdown/JsonBlock.d.ts +7 -0
- package/dist/types/markdown/MarkdownDelegate.d.ts +45 -0
- package/dist/types/markdown/MarkdownText.d.ts +47 -0
- package/dist/types/markdown/cjkFriendlyStrong.d.ts +8 -0
- package/dist/types/markdown/file-link.d.ts +12 -0
- package/dist/types/markdown/highlight.d.ts +147 -0
- package/dist/types/markdown/incremental.d.ts +79 -0
- package/dist/types/markdown/katex.d.ts +18 -0
- package/dist/types/markdown/local-image-syntax.d.ts +9 -0
- package/dist/types/markdown/mathCompatibility.d.ts +10 -0
- package/dist/types/markdown/parse.d.ts +24 -0
- package/dist/types/markdown/plain-text.d.ts +21 -0
- package/dist/types/markdown/render.d.ts +140 -0
- package/dist/types/markdown/useViewportHighlighting.d.ts +10 -0
- package/dist/types/markdown.d.ts +9 -0
- package/dist/types/overlay-top-margin.d.ts +7 -0
- package/dist/types/plugin-artwork.d.ts +16 -0
- package/dist/types/pointer-grace.d.ts +21 -0
- package/dist/types/rank-by-name.d.ts +21 -0
- package/dist/types/relative-time.d.ts +22 -0
- package/dist/types/seekbuddy/Card.d.ts +28 -0
- package/dist/types/seekbuddy/DangerButton.d.ts +31 -0
- package/dist/types/seekbuddy/Empty.d.ts +34 -0
- package/dist/types/seekbuddy/Mark.d.ts +27 -0
- package/dist/types/seekbuddy/Message.d.ts +52 -0
- package/dist/types/seekbuddy/Pagination.d.ts +66 -0
- package/dist/types/seekbuddy/Spinner.d.ts +20 -0
- package/dist/types/seekbuddy/StatusBadge.d.ts +33 -0
- package/dist/types/seekbuddy/SubtleButton.d.ts +30 -0
- package/dist/types/seekbuddy/Switch.d.ts +36 -0
- package/dist/types/seekbuddy/Tabs.d.ts +49 -0
- package/dist/types/seekbuddy/Timeline.d.ts +42 -0
- package/dist/types/seekbuddy/Upload.d.ts +101 -0
- package/dist/types/seekbuddy/date/Calendar.d.ts +94 -0
- package/dist/types/seekbuddy/date/DatePicker.d.ts +29 -0
- package/dist/types/seekbuddy/date/DateRangePicker.d.ts +41 -0
- package/dist/types/seekbuddy/date/TimePicker.d.ts +35 -0
- package/dist/types/seekbuddy/date/date.d.ts +79 -0
- package/dist/types/seekbuddy/date/fields.d.ts +45 -0
- package/dist/types/seekbuddy/index.d.ts +49 -0
- package/dist/types/seekbuddy/qr/QrCode.d.ts +37 -0
- package/dist/types/seekbuddy/qr/qr.d.ts +38 -0
- package/dist/types/theme-bootstrap.d.ts +3 -0
- package/dist/types/theme-core.d.ts +14 -0
- package/dist/types/theme.d.ts +4 -0
- package/dist/types/use-copy-feedback.d.ts +13 -0
- package/dist/types/useAnchoredMaxHeight.d.ts +13 -0
- package/dist/types/useAnchoredPosition.d.ts +35 -0
- package/dist/types/useDismissOnOutsidePointer.d.ts +10 -0
- package/dist/types/useModalLayer.d.ts +26 -0
- package/dist/types/user-text.d.ts +36 -0
- package/package.json +151 -4
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// src/theme-core.ts
|
|
2
|
+
var THEME_PREFERENCES = ["light", "dark", "system"];
|
|
3
|
+
var DEFAULT_PREFERENCE = "system";
|
|
4
|
+
var THEME_STORAGE_KEY = "dsh-ui-primitives.theme-preference";
|
|
5
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
var current = DEFAULT_PREFERENCE;
|
|
7
|
+
var currentDark = false;
|
|
8
|
+
var initialized = false;
|
|
9
|
+
var mediaQuery;
|
|
10
|
+
var mediaListenerAttached = false;
|
|
11
|
+
function isThemePreference(value) {
|
|
12
|
+
return typeof value === "string" && THEME_PREFERENCES.includes(value);
|
|
13
|
+
}
|
|
14
|
+
function getMediaQuery() {
|
|
15
|
+
if (mediaQuery !== void 0) return mediaQuery;
|
|
16
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return void 0;
|
|
17
|
+
mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
18
|
+
return mediaQuery;
|
|
19
|
+
}
|
|
20
|
+
function resolveDark(preference) {
|
|
21
|
+
return preference === "dark" || preference === "system" && (getMediaQuery()?.matches ?? false);
|
|
22
|
+
}
|
|
23
|
+
function applyTheme(preference) {
|
|
24
|
+
currentDark = resolveDark(preference);
|
|
25
|
+
if (typeof document === "undefined") return;
|
|
26
|
+
document.documentElement.style.colorScheme = currentDark ? "dark" : "light";
|
|
27
|
+
document.body?.toggleAttribute("data-ds-dark-theme", currentDark);
|
|
28
|
+
}
|
|
29
|
+
function notify() {
|
|
30
|
+
for (const listener of listeners) listener();
|
|
31
|
+
}
|
|
32
|
+
function onSystemThemeChange() {
|
|
33
|
+
if (current !== "system") return;
|
|
34
|
+
applyTheme(current);
|
|
35
|
+
notify();
|
|
36
|
+
}
|
|
37
|
+
function attachSystemListener() {
|
|
38
|
+
if (mediaListenerAttached) return;
|
|
39
|
+
const query = getMediaQuery();
|
|
40
|
+
if (query === void 0) return;
|
|
41
|
+
if (typeof query.addEventListener === "function") query.addEventListener("change", onSystemThemeChange);
|
|
42
|
+
else query.addListener?.(onSystemThemeChange);
|
|
43
|
+
mediaListenerAttached = true;
|
|
44
|
+
}
|
|
45
|
+
function readStoredPreference() {
|
|
46
|
+
if (typeof window === "undefined") return DEFAULT_PREFERENCE;
|
|
47
|
+
try {
|
|
48
|
+
const stored = window.localStorage.getItem(THEME_STORAGE_KEY);
|
|
49
|
+
return isThemePreference(stored) ? stored : DEFAULT_PREFERENCE;
|
|
50
|
+
} catch {
|
|
51
|
+
return DEFAULT_PREFERENCE;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function initializeTheme() {
|
|
55
|
+
if (initialized) {
|
|
56
|
+
applyTheme(current);
|
|
57
|
+
return current;
|
|
58
|
+
}
|
|
59
|
+
initialized = true;
|
|
60
|
+
current = readStoredPreference();
|
|
61
|
+
attachSystemListener();
|
|
62
|
+
applyTheme(current);
|
|
63
|
+
return current;
|
|
64
|
+
}
|
|
65
|
+
function setThemePreference(preference) {
|
|
66
|
+
initialized = true;
|
|
67
|
+
current = preference;
|
|
68
|
+
attachSystemListener();
|
|
69
|
+
applyTheme(preference);
|
|
70
|
+
if (typeof window !== "undefined") {
|
|
71
|
+
try {
|
|
72
|
+
window.localStorage.setItem(THEME_STORAGE_KEY, preference);
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
notify();
|
|
77
|
+
}
|
|
78
|
+
function getThemePreference() {
|
|
79
|
+
return current;
|
|
80
|
+
}
|
|
81
|
+
function getIsDark() {
|
|
82
|
+
return currentDark;
|
|
83
|
+
}
|
|
84
|
+
function subscribeTheme(listener) {
|
|
85
|
+
initializeTheme();
|
|
86
|
+
listeners.add(listener);
|
|
87
|
+
return () => {
|
|
88
|
+
listeners.delete(listener);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
THEME_PREFERENCES,
|
|
94
|
+
DEFAULT_PREFERENCE,
|
|
95
|
+
THEME_STORAGE_KEY,
|
|
96
|
+
isThemePreference,
|
|
97
|
+
resolveDark,
|
|
98
|
+
applyTheme,
|
|
99
|
+
initializeTheme,
|
|
100
|
+
setThemePreference,
|
|
101
|
+
getThemePreference,
|
|
102
|
+
getIsDark,
|
|
103
|
+
subscribeTheme
|
|
104
|
+
};
|