@bagelink/vue 1.15.549 → 1.15.551
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/form/inputs/RichText/index.vue.d.ts.map +1 -1
- package/dist/composables/useTheme.d.ts.map +1 -1
- package/dist/core.css +2 -2
- package/dist/index.cjs +40 -40
- package/dist/index.css +1 -1
- package/dist/index.mjs +5352 -5332
- package/dist/style.css +2 -2
- package/package.json +1 -1
- package/src/components/form/inputs/RichText/index.vue +38 -9
- package/src/composables/useTheme.ts +31 -2
- package/src/styles/dark.css +8 -0
package/package.json
CHANGED
|
@@ -3621,7 +3621,7 @@ const imgTransform = computed({
|
|
|
3621
3621
|
|
|
3622
3622
|
<template>
|
|
3623
3623
|
<div
|
|
3624
|
-
class="bagel-input" :class="[shellClass, { 'has-value': hasEditorValue, 'rich-text-full-height': fullHeight }]" :style="shellStyle"
|
|
3624
|
+
class="bagel-input rich-text-light-theme" :class="[shellClass, { 'has-value': hasEditorValue, 'rich-text-full-height': fullHeight }]" :style="shellStyle"
|
|
3625
3625
|
v-bind="attrs"
|
|
3626
3626
|
>
|
|
3627
3627
|
<label v-if="label">{{ label }}</label>
|
|
@@ -4205,14 +4205,43 @@ line-height: 1.65;
|
|
|
4205
4205
|
font-size: var(--richtext-font-size, 16px);
|
|
4206
4206
|
}
|
|
4207
4207
|
|
|
4208
|
-
/*
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4208
|
+
/* RichText is deliberately a light-theme island. Re-declare every semantic
|
|
4209
|
+
token changed by dark mode at the component boundary, so the editor chrome,
|
|
4210
|
+
controls, menus and editing surface render exactly as they do in light mode. */
|
|
4211
|
+
.rich-text-light-theme {
|
|
4212
|
+
color-scheme: light;
|
|
4213
|
+
--bgl-box-bg: #fff;
|
|
4214
|
+
--bgl-popup-bg: #fff;
|
|
4215
|
+
--bgl-popup-text: #282929;
|
|
4216
|
+
--bgl-input-bg: #f5f8fa;
|
|
4217
|
+
--bgl-input-color: #000;
|
|
4218
|
+
--bgl-dropdown-color: #282929;
|
|
4219
|
+
--bgl-text-color: #282929;
|
|
4220
|
+
--bgl-richtext-color: #fff;
|
|
4221
|
+
--bgl-border-color: #00000020;
|
|
4222
|
+
--bgl-placeholder-color: #00000040;
|
|
4223
|
+
--bgl-label-color: #00000080;
|
|
4224
|
+
--bgl-gray-light: #f5f8fa;
|
|
4225
|
+
--bgl-gray: #b7b7b7;
|
|
4226
|
+
--bgl-shadow: #00000031;
|
|
4227
|
+
--bgl-hover-filter: brightness(90%);
|
|
4228
|
+
--bgl-active-filter: brightness(70%);
|
|
4229
|
+
}
|
|
4230
|
+
|
|
4231
|
+
.bgl-dark-mode .rich-text-light-theme .pair-black.bgl_flatPill,
|
|
4232
|
+
.bgl-dark-mode .rich-text-light-theme .pair-black.bgl_pill-border {
|
|
4233
|
+
color: var(--bgl-black);
|
|
4234
|
+
}
|
|
4235
|
+
|
|
4236
|
+
.bgl-dark-mode .rich-text-light-theme .bg-white:not(.keep-white) {
|
|
4237
|
+
background: #fff !important;
|
|
4238
|
+
color: #282929;
|
|
4239
|
+
}
|
|
4240
|
+
|
|
4241
|
+
.bgl-dark-mode .rich-text-light-theme input:not([type="radio"]):not([type="checkbox"]):not([type="color"]),
|
|
4242
|
+
.bgl-dark-mode .rich-text-light-theme textarea,
|
|
4243
|
+
.bgl-dark-mode .rich-text-light-theme select {
|
|
4244
|
+
box-shadow: none;
|
|
4216
4245
|
}
|
|
4217
4246
|
|
|
4218
4247
|
</style>
|
|
@@ -55,6 +55,24 @@ const manualSelection = ref(false)
|
|
|
55
55
|
|
|
56
56
|
const isBrowser = typeof window !== 'undefined'
|
|
57
57
|
|
|
58
|
+
function readStoredTheme() {
|
|
59
|
+
if (!isBrowser) return null
|
|
60
|
+
try {
|
|
61
|
+
return window.localStorage.getItem(STORAGE_KEY)
|
|
62
|
+
} catch {
|
|
63
|
+
return null
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function storeTheme(value: string) {
|
|
68
|
+
if (!isBrowser) return
|
|
69
|
+
try {
|
|
70
|
+
window.localStorage.setItem(STORAGE_KEY, value)
|
|
71
|
+
} catch {
|
|
72
|
+
// Storage can be unavailable in privacy-restricted or embedded contexts.
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
58
76
|
function getSystemPrefersDark() {
|
|
59
77
|
return allowDark.value && isBrowser && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
60
78
|
}
|
|
@@ -123,6 +141,7 @@ function toggleTheme() {
|
|
|
123
141
|
* fall back to "system" when they haven't picked one.
|
|
124
142
|
*/
|
|
125
143
|
export function configureTheme(options: { allowDark?: boolean, manualSelection?: boolean } = {}) {
|
|
144
|
+
const manualSelectionWasEnabled = manualSelection.value
|
|
126
145
|
if (options.allowDark !== undefined) {
|
|
127
146
|
allowDark.value = options.allowDark
|
|
128
147
|
}
|
|
@@ -136,6 +155,16 @@ export function configureTheme(options: { allowDark?: boolean, manualSelection?:
|
|
|
136
155
|
// wouldn't react until something mounted, forcing a refresh.
|
|
137
156
|
initTheme()
|
|
138
157
|
|
|
158
|
+
// Configuration may legitimately run after an imported component called
|
|
159
|
+
// useTheme(). Restore the saved manual choice when manual selection becomes
|
|
160
|
+
// enabled so initialization order cannot silently discard the preference.
|
|
161
|
+
if (manualSelection.value && !manualSelectionWasEnabled) {
|
|
162
|
+
const saved = readStoredTheme()
|
|
163
|
+
if (themeOptions.value.some(t => t.value === saved)) {
|
|
164
|
+
colorMode.value = saved!
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
139
168
|
// When the project has no manual switcher, force "system" — even if initTheme()
|
|
140
169
|
// already ran earlier (via useTheme) and restored a stale saved value before
|
|
141
170
|
// this config was known.
|
|
@@ -187,7 +216,7 @@ function initTheme() {
|
|
|
187
216
|
// Only restore a saved manual choice when the project allows manual selection.
|
|
188
217
|
// Otherwise always follow the OS, so the app can't get stuck on a stale value.
|
|
189
218
|
if (manualSelection.value) {
|
|
190
|
-
const saved =
|
|
219
|
+
const saved = readStoredTheme()
|
|
191
220
|
if (themeOptions.value.some(t => t.value === saved)) {
|
|
192
221
|
colorMode.value = saved!
|
|
193
222
|
}
|
|
@@ -207,7 +236,7 @@ function initTheme() {
|
|
|
207
236
|
// Persist + apply on mode changes (persist only matters for manual selection)
|
|
208
237
|
watch(colorMode, (newMode) => {
|
|
209
238
|
if (manualSelection.value) {
|
|
210
|
-
|
|
239
|
+
storeTheme(newMode)
|
|
211
240
|
}
|
|
212
241
|
applyTheme(newMode)
|
|
213
242
|
})
|
package/src/styles/dark.css
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
Semantic, not inversion: override only the semantic tokens (surfaces, text,
|
|
3
3
|
borders) with dark values; --bgl-black/--bgl-white keep their real meaning. */
|
|
4
4
|
|
|
5
|
+
:root.bgl-light-mode {
|
|
6
|
+
color-scheme: light;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:root.bgl-dark-mode {
|
|
10
|
+
color-scheme: dark;
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
/* `:root.bgl-dark-mode` raises specificity to (0,2,0) so these tokens win over a
|
|
6
14
|
project's own `:root {}`; bare `.bgl-dark-mode` is a non-root fallback. */
|
|
7
15
|
:root.bgl-dark-mode,
|