@kolkrabbi/kol-framework 0.4.2 → 0.5.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-framework",
3
- "version": "0.4.2",
3
+ "version": "0.5.1",
4
4
  "description": "KOL app shell — sidenav, layout, theme toggle, footer, heroes + brand color layer. SideNav takes nav data as props so the tree stays app-local.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,8 +27,8 @@
27
27
  "app-shell"
28
28
  ],
29
29
  "dependencies": {
30
- "@kolkrabbi/kol-component": "0.10.1",
31
- "@kolkrabbi/kol-icons": "0.6.1"
30
+ "@kolkrabbi/kol-component": "0.12.0",
31
+ "@kolkrabbi/kol-icons": "0.7.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": "^18.3.0 || ^19.0.0",
@@ -133,7 +133,7 @@ export default function ShellHeader({
133
133
  onClick={onTocToggle}
134
134
  aria-label="Toggle table of contents sidebar"
135
135
  >
136
- <Icon name="dock-right" size={18} />
136
+ <Icon name="panel-right" size={18} />
137
137
  </button>
138
138
  )}
139
139
  </div>
@@ -69,16 +69,17 @@ export default function ThemeToggle({ variant = 'icon', className = '' }) {
69
69
  )
70
70
  }
71
71
 
72
- // variant === 'icon' (default)
72
+ // variant === 'icon' (default) — 36×36 button / 20px glyph, the DS reference
73
+ // (user-verified 2026-07-15; was 32/18, which consumers shimmed via CSS)
73
74
  return (
74
75
  <button
75
76
  type="button"
76
77
  onClick={handleToggle}
77
78
  aria-label={`Switch to ${next} mode`}
78
79
  title={`Switch to ${next} mode`}
79
- className={`inline-flex items-center justify-center w-8 h-8 p-0 bg-transparent border-0 cursor-pointer text-emphasis hover:opacity-80 transition-opacity duration-300 ${className}`.trim()}
80
+ className={`inline-flex items-center justify-center w-9 h-9 p-0 bg-transparent border-0 cursor-pointer text-emphasis hover:opacity-80 transition-opacity duration-300 ${className}`.trim()}
80
81
  >
81
- {iconSwap(18)}
82
+ {iconSwap(20)}
82
83
  </button>
83
84
  )
84
85
  }
package/src/theme.js CHANGED
@@ -2,10 +2,11 @@ import { useEffect, useState } from 'react'
2
2
 
3
3
  /* Theme-state machinery — the logic behind ThemeToggle, exported so app code
4
4
  * (navbars, heroes, anything theme-aware) can read/set the theme without
5
- * mounting the toggle UI. Policy (unchanged from ThemeToggle): the DS is
6
- * light-first; an explicit choice is an app-set data-theme attribute or a
7
- * saved user toggle, and absent both the page follows prefers-color-scheme
8
- * via the theme CSS. `data-theme` + localStorage are written ONLY through
5
+ * mounting the toggle UI. Policy: the DS is light-first (USER law, theme
6
+ * 0.9.2 dropped the OS-follow auto-dark CSS); an explicit choice is an
7
+ * app-set data-theme attribute or a saved user toggle, and absent both the
8
+ * theme is light — never the OS preference, so state can't disagree with
9
+ * what the CSS renders. `data-theme` + localStorage are written ONLY through
9
10
  * applyTheme (a user action) — mounting a reader leaves the DOM untouched. */
10
11
 
11
12
  export const THEME_STORAGE_KEY = 'kol-theme'
@@ -22,8 +23,7 @@ function getExplicitTheme() {
22
23
 
23
24
  export function getInitialTheme() {
24
25
  if (typeof document === 'undefined') return 'light'
25
- return getExplicitTheme()
26
- ?? (window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light')
26
+ return getExplicitTheme() ?? 'light'
27
27
  }
28
28
 
29
29
  /** Stamp + persist an explicit theme choice. */
@@ -37,8 +37,8 @@ export function applyTheme(theme) {
37
37
  *
38
38
  * All instances observe the html `data-theme` attribute, so any writer
39
39
  * (this hook's setTheme, ThemeToggle, an app boot script) updates every
40
- * reader. When the page has no explicit choice, instances follow the
41
- * system preference. Returns { theme, isDark, setTheme, toggle }.
40
+ * reader. When the page has no explicit choice, the theme is light
41
+ * (light-first law). Returns { theme, isDark, setTheme, toggle }.
42
42
  */
43
43
  export function useTheme() {
44
44
  const [theme, setThemeState] = useState(getInitialTheme)
@@ -62,18 +62,8 @@ export function useTheme() {
62
62
  })
63
63
  observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] })
64
64
 
65
- /* No explicit choice anywhere — follow the system, like the theme CSS. */
66
- const mq = window.matchMedia?.('(prefers-color-scheme: dark)')
67
- const onChange = (e) => {
68
- try { if (localStorage.getItem(THEME_STORAGE_KEY)) return } catch { /* storage blocked */ }
69
- if (document.documentElement.dataset.theme) return
70
- setThemeState(e.matches ? 'dark' : 'light')
71
- }
72
- mq?.addEventListener?.('change', onChange)
73
-
74
65
  return () => {
75
66
  observer.disconnect()
76
- mq?.removeEventListener?.('change', onChange)
77
67
  }
78
68
  }, [])
79
69