@bagelink/vue 1.15.55 → 1.15.59

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.15.55",
4
+ "version": "1.15.59",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -36,5 +36,5 @@ export function useBglSchema<T = { [key: string]: unknown }>(
36
36
  return getFallbackSchema(data, _columns.value)
37
37
  }
38
38
 
39
- export { useTheme } from './useTheme'
39
+ export { configureTheme, useTheme } from './useTheme'
40
40
  export { useValidateFieldValue } from './useValidateFieldValue'
@@ -37,10 +37,18 @@ const STORAGE_KEY = 'color-mode'
37
37
  const colorMode = ref<string>('system')
38
38
  const isDark = ref(false)
39
39
 
40
+ /**
41
+ * Whether dark mode is enabled for this app. Defaults to `false` (light only),
42
+ * so dark mode is opt-in per project. Call `configureTheme({ allowDark: true })`
43
+ * once at app startup to enable it. When `false`, any dark/system-dark
44
+ * preference falls back to light and `bgl-dark-mode` is never applied.
45
+ */
46
+ const allowDark = ref(false)
47
+
40
48
  const isBrowser = typeof window !== 'undefined'
41
49
 
42
50
  function getSystemPrefersDark() {
43
- return isBrowser && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
51
+ return allowDark.value && isBrowser && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
44
52
  }
45
53
 
46
54
  function findTheme(value: string) {
@@ -69,11 +77,15 @@ function applyTheme(themeValue: string) {
69
77
  root.classList.add(themeToApply.class)
70
78
  }
71
79
  } else {
72
- // Apply the selected theme
80
+ // Apply the selected theme. If dark mode is disabled for this app, force
81
+ // any dark selection back to light so projects can opt out entirely.
73
82
  const theme = findTheme(themeValue)
74
- if (theme) {
75
- root.classList.add(theme.class)
76
- isDark.value = theme.isDark ?? false
83
+ const effectiveTheme = theme && theme.isDark && !allowDark.value
84
+ ? findTheme('light')
85
+ : theme
86
+ if (effectiveTheme) {
87
+ root.classList.add(effectiveTheme.class)
88
+ isDark.value = effectiveTheme.isDark ?? false
77
89
  }
78
90
  }
79
91
  }
@@ -89,6 +101,20 @@ function toggleTheme() {
89
101
  colorMode.value = cyclableThemes[nextIndex].value
90
102
  }
91
103
 
104
+ /**
105
+ * Configure theme behavior for the current app. Call once at startup.
106
+ *
107
+ * @param options.allowDark Enable dark mode for this project (default: false).
108
+ * When false, dark / system-dark falls back to light.
109
+ */
110
+ export function configureTheme(options: { allowDark?: boolean } = {}) {
111
+ if (options.allowDark !== undefined) {
112
+ allowDark.value = options.allowDark
113
+ }
114
+ // Re-apply with the new policy so a previously-saved dark choice is corrected.
115
+ applyTheme(colorMode.value)
116
+ }
117
+
92
118
  function addTheme(theme: ThemeOption) {
93
119
  // Check if theme with this value already exists
94
120
  const exists = themeOptions.value.some(t => t.value === theme.value)
@@ -101,6 +101,80 @@
101
101
  border-bottom: 1px solid currentColor !important;
102
102
  }
103
103
 
104
+ .hover-opacity-1,
105
+ .hover-opacity-2,
106
+ .hover-opacity-3,
107
+ .hover-opacity-4,
108
+ .hover-opacity-5,
109
+ .hover-opacity-6,
110
+ .hover-opacity-7,
111
+ .hover-opacity-8,
112
+ .hover-opacity-9,
113
+ .hover-opacity-10 {
114
+ transition: var(--bgl-transition);
115
+ }
116
+
117
+ .hover-opacity-1:hover,
118
+ .hover-opacity-1:active,
119
+ .hover-opacity-1:focus {
120
+ opacity: 0.1;
121
+ }
122
+
123
+ .hover-opacity-2:hover,
124
+ .hover-opacity-2:active,
125
+ .hover-opacity-2:focus {
126
+ opacity: 0.2;
127
+ }
128
+
129
+
130
+ .hover-opacity-3:hover,
131
+ .hover-opacity-3:active,
132
+ .hover-opacity-3:focus {
133
+ opacity: 0.3;
134
+ }
135
+
136
+ .hover-opacity-4:hover,
137
+ .hover-opacity-4:active,
138
+ .hover-opacity-4:focus {
139
+ opacity: 0.4;
140
+ }
141
+
142
+ .hover-opacity-5:hover,
143
+ .hover-opacity-5:active,
144
+ .hover-opacity-5:focus {
145
+ opacity: 0.5;
146
+ }
147
+
148
+ .hover-opacity-6:hover,
149
+ .hover-opacity-6:active,
150
+ .hover-opacity-6:focus {
151
+ opacity: 0.6;
152
+ }
153
+
154
+ .hover-opacity-7:hover,
155
+ .hover-opacity-7:active,
156
+ .hover-opacity-7:focus {
157
+ opacity: 0.7;
158
+ }
159
+
160
+ .hover-opacity-8:hover,
161
+ .hover-opacity-8:active,
162
+ .hover-opacity-8:focus {
163
+ opacity: 0.8;
164
+ }
165
+
166
+ .hover-opacity-9:hover,
167
+ .hover-opacity-9:active,
168
+ .hover-opacity-9:focus {
169
+ opacity: 0.9;
170
+ }
171
+
172
+ .hover-opacity-10:hover,
173
+ .hover-opacity-10:active,
174
+ .hover-opacity-10:focus {
175
+ opacity: 1;
176
+ }
177
+
104
178
  .border {
105
179
  border: 1px solid var(--bgl-border-color);
106
180
  }