@dfosco/storyboard-core 3.5.0 → 3.6.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/storyboard-ui.js +1978 -1969
- package/dist/storyboard-ui.js.map +1 -1
- package/package.json +1 -1
- package/src/inspector/highlighter.js +4 -4
- package/src/stores/themeStore.ts +25 -8
- package/src/tools/handlers/flows.js +10 -3
package/package.json
CHANGED
|
@@ -131,7 +131,7 @@ const THEMES = {
|
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* Resolve the current theme ID based on page theme and config.
|
|
134
|
-
*
|
|
134
|
+
* Follows code-box theme (data-sb-code-theme attribute).
|
|
135
135
|
*/
|
|
136
136
|
function normalizeThemeId(requested, mode) {
|
|
137
137
|
const fallback = mode === 'light' ? 'github' : 'github-dark-dimmed'
|
|
@@ -166,11 +166,11 @@ function resolveThemeId() {
|
|
|
166
166
|
const darkTheme = normalizeThemeId(highlighting.dark, 'dark')
|
|
167
167
|
const lightTheme = normalizeThemeId(highlighting.light, 'light')
|
|
168
168
|
|
|
169
|
-
const
|
|
170
|
-
? document.documentElement.getAttribute('data-sb-theme') || '
|
|
169
|
+
const codeTheme = typeof document !== 'undefined'
|
|
170
|
+
? document.documentElement.getAttribute('data-sb-code-theme') || 'light'
|
|
171
171
|
: 'dark'
|
|
172
172
|
|
|
173
|
-
return
|
|
173
|
+
return codeTheme.startsWith('dark') ? darkTheme : lightTheme
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/**
|
package/src/stores/themeStore.ts
CHANGED
|
@@ -92,35 +92,52 @@ function _applyToDOM(theme: ThemeValue, resolved: string): void {
|
|
|
92
92
|
if (typeof document === 'undefined') return
|
|
93
93
|
const el = document.documentElement
|
|
94
94
|
|
|
95
|
-
//
|
|
96
|
-
|
|
95
|
+
// Per-target resolved themes
|
|
96
|
+
const prototypeTheme = _syncTargets.prototype ? resolved : 'light'
|
|
97
|
+
const toolbarTheme = _syncTargets.toolbar ? resolved : 'light'
|
|
98
|
+
const codeTheme = _syncTargets.codeBoxes ? resolved : 'light'
|
|
99
|
+
|
|
100
|
+
// Internal attributes
|
|
101
|
+
el.setAttribute('data-sb-theme', prototypeTheme)
|
|
102
|
+
el.setAttribute('data-sb-code-theme', codeTheme)
|
|
97
103
|
|
|
98
104
|
// Toolbar theme — follows global theme when synced, stays light otherwise
|
|
99
|
-
const toolbarTheme = _syncTargets.toolbar ? resolved : 'light'
|
|
100
105
|
el.setAttribute('data-sb-toolbar-theme', toolbarTheme)
|
|
101
106
|
|
|
102
107
|
// Primer CSS attributes — these drive @primer/react ThemeProvider and
|
|
103
108
|
// Primer CSS custom-property layers without needing React state updates.
|
|
104
|
-
if (theme === 'system') {
|
|
109
|
+
if (theme === 'system' && _syncTargets.prototype) {
|
|
105
110
|
el.setAttribute('data-color-mode', 'auto')
|
|
106
111
|
el.setAttribute('data-light-theme', 'light')
|
|
107
112
|
el.setAttribute('data-dark-theme', 'dark')
|
|
108
|
-
} else if (
|
|
113
|
+
} else if (prototypeTheme.startsWith('dark')) {
|
|
109
114
|
el.setAttribute('data-color-mode', 'dark')
|
|
110
|
-
el.setAttribute('data-dark-theme',
|
|
115
|
+
el.setAttribute('data-dark-theme', prototypeTheme)
|
|
111
116
|
el.setAttribute('data-light-theme', 'light')
|
|
112
117
|
} else {
|
|
113
118
|
el.setAttribute('data-color-mode', 'light')
|
|
114
|
-
el.setAttribute('data-light-theme',
|
|
119
|
+
el.setAttribute('data-light-theme', prototypeTheme)
|
|
115
120
|
el.setAttribute('data-dark-theme', 'dark')
|
|
116
121
|
}
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
function _dispatchEvent(theme: ThemeValue, resolved: string): void {
|
|
120
125
|
if (typeof document === 'undefined') return
|
|
126
|
+
const prototypeTheme = _syncTargets.prototype ? theme : 'light'
|
|
127
|
+
const prototypeResolved = _syncTargets.prototype ? resolved : 'light'
|
|
128
|
+
const toolbarResolved = _syncTargets.toolbar ? resolved : 'light'
|
|
129
|
+
const codeResolved = _syncTargets.codeBoxes ? resolved : 'light'
|
|
130
|
+
|
|
121
131
|
document.dispatchEvent(
|
|
122
132
|
new CustomEvent('storyboard:theme:changed', {
|
|
123
|
-
detail: {
|
|
133
|
+
detail: {
|
|
134
|
+
theme,
|
|
135
|
+
resolved,
|
|
136
|
+
prototypeTheme,
|
|
137
|
+
prototypeResolved,
|
|
138
|
+
toolbarResolved,
|
|
139
|
+
codeResolved,
|
|
140
|
+
},
|
|
124
141
|
}),
|
|
125
142
|
)
|
|
126
143
|
}
|
|
@@ -19,8 +19,9 @@ export async function handler(ctx) {
|
|
|
19
19
|
path = path.replace(/\/+$/, '') || '/'
|
|
20
20
|
const segments = path.split('/').filter(Boolean)
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
const
|
|
22
|
+
// Detect and preserve branch-- segment on deployed branch builds
|
|
23
|
+
const branchSegment = (segments[0] && segments[0].startsWith('branch--')) ? segments[0] : null
|
|
24
|
+
const protoIdx = branchSegment ? 1 : 0
|
|
24
25
|
const proto = segments[protoIdx] || null
|
|
25
26
|
if (!proto) return []
|
|
26
27
|
|
|
@@ -49,7 +50,13 @@ export async function handler(ctx) {
|
|
|
49
50
|
label: meta?.title || f.name,
|
|
50
51
|
type: 'radio',
|
|
51
52
|
active: f.key === active,
|
|
52
|
-
execute: () => {
|
|
53
|
+
execute: () => {
|
|
54
|
+
let url = vf.resolveFlowRoute(f.key)
|
|
55
|
+
// Re-apply basePath and branch-- prefix so deployed branch builds stay on the correct path
|
|
56
|
+
const prefix = (base || '') + (branchSegment ? `/${branchSegment}` : '')
|
|
57
|
+
if (prefix) url = prefix + url
|
|
58
|
+
window.location.href = url
|
|
59
|
+
},
|
|
53
60
|
}
|
|
54
61
|
})
|
|
55
62
|
},
|