@dfosco/storyboard-react 4.0.0-beta.41 → 4.0.0-beta.42

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,11 +1,11 @@
1
1
  {
2
2
  "name": "@dfosco/storyboard-react",
3
- "version": "4.0.0-beta.41",
3
+ "version": "4.0.0-beta.42",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@base-ui/react": "^1.4.0",
7
- "@dfosco/storyboard-core": "4.0.0-beta.41",
8
- "@dfosco/tiny-canvas": "4.0.0-beta.41",
7
+ "@dfosco/storyboard-core": "4.0.0-beta.42",
8
+ "@dfosco/tiny-canvas": "4.0.0-beta.42",
9
9
  "@neodrag/react": "^2.3.1",
10
10
  "glob": "^11.0.0",
11
11
  "jsonc-parser": "^3.3.1",
package/src/Icon.jsx CHANGED
@@ -54,9 +54,10 @@ const customIcons = {
54
54
  },
55
55
  'flow': {
56
56
  viewBox: '0 0 24 24',
57
+ strokeWidth: '2.5',
57
58
  strokePaths: [
58
- 'M5.5 5l5.5 7-5.5 7',
59
- 'M13 5l5.5 7-5.5 7',
59
+ 'M13 19L22 12L13 5L13 19Z',
60
+ 'M2 19L11 12L2 5L2 19Z',
60
61
  ],
61
62
  },
62
63
  }
@@ -136,7 +137,7 @@ export default function Icon({ name, size = 16, label, color, strokeWeight, clas
136
137
  if (custom.strokePaths) {
137
138
  return (
138
139
  <span className={className} style={style}>
139
- <svg width={size} height={size} viewBox={custom.viewBox} fill="none" stroke="currentColor" strokeWidth="1.5" {...ariaProps}>
140
+ <svg width={size} height={size} viewBox={custom.viewBox} fill="none" stroke="currentColor" strokeWidth={custom.strokeWidth || "1.5"} strokeLinecap="round" strokeLinejoin="round" {...ariaProps}>
140
141
  {custom.strokePaths.map((d, i) => <path key={i} d={d} />)}
141
142
  </svg>
142
143
  </span>
@@ -11,6 +11,40 @@ import { Menu } from '@base-ui/react/menu'
11
11
  import Icon from './Icon.jsx'
12
12
  import css from './Viewfinder.module.css'
13
13
 
14
+ /* ─── Theme sync: read toolbar theme from DOM and apply to Primer/BaseUI ─── */
15
+
16
+ function getToolbarThemeAttrs() {
17
+ const theme = document.documentElement.getAttribute('data-sb-toolbar-theme') || 'light'
18
+ if (theme === 'dark_dimmed') {
19
+ return { 'data-color-mode': 'dark', 'data-dark-theme': 'dark_dimmed', 'data-light-theme': 'light' }
20
+ }
21
+ if (theme.startsWith('dark')) {
22
+ return { 'data-color-mode': 'dark', 'data-dark-theme': 'dark', 'data-light-theme': 'light' }
23
+ }
24
+ return { 'data-color-mode': 'light', 'data-light-theme': 'light', 'data-dark-theme': 'dark' }
25
+ }
26
+
27
+ function useToolbarTheme() {
28
+ const [attrs, setAttrs] = useState(getToolbarThemeAttrs)
29
+
30
+ useEffect(() => {
31
+ const update = () => setAttrs(getToolbarThemeAttrs())
32
+ const observer = new MutationObserver(update)
33
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-sb-toolbar-theme'] })
34
+ update()
35
+ return () => observer.disconnect()
36
+ }, [])
37
+
38
+ // Sync to document.body so BaseUI portals inherit Primer theme
39
+ useEffect(() => {
40
+ for (const [key, value] of Object.entries(attrs)) {
41
+ document.body.setAttribute(key, value)
42
+ }
43
+ }, [attrs])
44
+
45
+ return attrs
46
+ }
47
+
14
48
  /* ─── localStorage helpers ─── */
15
49
 
16
50
  const STARRED_KEY = 'sb-viewfinder-starred'
@@ -109,11 +143,12 @@ function AvatarStack({ authors }) {
109
143
  <img
110
144
  key={username}
111
145
  className={css.avatarImg}
112
- src={`https://github.com/${username}.png`}
146
+ src={`https://github.com/${username}.png?size=48`}
113
147
  alt={username}
114
148
  width={24}
115
149
  height={24}
116
150
  loading="lazy"
151
+ onError={(e) => { e.target.style.display = 'none' }}
117
152
  />
118
153
  ))}
119
154
  </div>
@@ -692,6 +727,7 @@ export default function Viewfinder({
692
727
  hideDefaultScene = false,
693
728
  }) {
694
729
  const shouldHideDefault = hideDefaultFlow ?? hideDefaultScene
730
+ const themeAttrs = useToolbarTheme()
695
731
 
696
732
  // Build data index from real prototype/canvas/story data
697
733
  const knownRoutes = useMemo(() =>
@@ -880,7 +916,7 @@ export default function Viewfinder({
880
916
  const pageTitle = NAV_ITEMS.find(n => n.id === activeNav)?.label || 'All artifacts'
881
917
 
882
918
  return (
883
- <div className={css.layout}>
919
+ <div className={css.layout} {...themeAttrs}>
884
920
  {/* ─── Full-width Header ─── */}
885
921
  <header className={css.topBar}>
886
922
  <div className={css.topBarLeft}>