@krizaka/ui 3.75.0 → 3.76.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/dist/blocks.css +2 -0
- package/dist/{chunk-RI3AA2E3.js → chunk-CEW3LQOZ.js} +518 -427
- package/dist/chunk-CEW3LQOZ.js.map +1 -0
- package/dist/data-table.d.ts +1 -1
- package/dist/data-table.js +1 -1
- package/dist/filter-bar.d.ts +3 -3
- package/dist/genui.js +1 -1
- package/dist/nav-bar.js +1 -1
- package/dist/nav-bar.js.map +1 -1
- package/dist/shop/services.js +1 -1
- package/dist/shop/services.js.map +1 -1
- package/dist/shop-composer.js +1 -1
- package/dist/shop-composer.js.map +1 -1
- package/dist/shop-gallery.js +2 -2
- package/dist/shop-gallery.js.map +1 -1
- package/dist/theme.d.ts +3 -1
- package/dist/theme.js +2 -1
- package/dist/theme.js.map +1 -1
- package/package.json +10 -10
- package/registry/app-frame.json +1 -1
- package/registry/data-table.json +19 -19
- package/registry/index.json +7 -7
- package/registry/map.json +1 -1
- package/registry/nav-bar.json +2 -2
- package/registry/rail-nav.json +1 -1
- package/registry/shop-gallery.json +1 -1
- package/registry/shop.json +2 -2
- package/registry/site-footer.json +1 -1
- package/registry/theme.json +3 -3
- package/dist/chunk-RI3AA2E3.js.map +0 -1
package/dist/shop-gallery.js
CHANGED
|
@@ -52,9 +52,9 @@ var styles = `
|
|
|
52
52
|
.kz-sg[data-count="1"] .kz-sg-list{grid-template-columns:1fr}
|
|
53
53
|
.kz-sg[data-count="1"] .kz-sg-list>li{aspect-ratio:16/9}
|
|
54
54
|
.kz-sg[data-count="2"] .kz-sg-list>li,.kz-sg[data-count="2"] .kz-sg-list>li:first-child:nth-last-child(odd){aspect-ratio:4/3;grid-column:auto}
|
|
55
|
-
.kz-sg:not([data-count="1"]):not([data-count="2"]) .kz-sg-list{grid-template-columns:repeat(4,1fr);grid-template-rows:repeat(2,1fr);aspect-ratio:2/1}
|
|
55
|
+
.kz-sg:not([data-count="1"]):not([data-count="2"]) .kz-sg-list{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));aspect-ratio:2/1}
|
|
56
56
|
.kz-sg:not([data-count="1"]):not([data-count="2"]) .kz-sg-list>li,.kz-sg[data-strip=true] .kz-sg-list>li{aspect-ratio:auto;flex:none}
|
|
57
|
-
.kz-sg:not([data-count="1"]):not([data-count="2"]) .kz-sg-list>li:first-child{grid-column:1/3;grid-row:1/3}
|
|
57
|
+
.kz-sg:not([data-count="1"]):not([data-count="2"]) .kz-sg-list>li:first-child{grid-column:1/3;grid-row:1/3;aspect-ratio:auto}
|
|
58
58
|
.kz-sg[data-count="3"] .kz-sg-list>li:nth-child(n+2){grid-column:3/5}
|
|
59
59
|
.kz-sg[data-count="4"] .kz-sg-list>li:nth-child(2){grid-column:3/5}
|
|
60
60
|
.kz-sg[data-strip=true] .kz-sg-list>li:nth-child(n+6){display:none}
|
package/dist/shop-gallery.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shop-gallery/labels.ts","../src/shop-gallery/shop-gallery.tsx"],"sourcesContent":["export type ShopGalleryLabels = {\n /** The tile's name: `Open photo 3 of 12: Two chairs by the window`. */\n open: (alt: string, position: number, total: number) => string;\n /** The last tile of the mosaic: `+ 8 photos`. */\n more: (count: number) => string;\n /** The phone strip's counter: `3 / 12`. */\n counter: (position: number, total: number) => string;\n previous: string;\n next: string;\n close: string;\n /** The lightbox's title, read by a screen reader: `Photos of the salon`. */\n title: (label: string) => string;\n /** The lightbox's position: `3 of 12`. */\n position: (position: number, total: number) => string;\n};\n\nexport const shopGalleryLabels: ShopGalleryLabels = {\n open: (alt, position, total) => (alt ? `Open photo ${position} of ${total}: ${alt}` : `Open photo ${position} of ${total}`),\n more: (count) => `+ ${count} photos`,\n counter: (position, total) => `${position} / ${total}`,\n previous: \"Previous photo\",\n next: \"Next photo\",\n close: \"Close\",\n title: (label) => label,\n position: (position, total) => `${position} of ${total}`,\n};\n\nexport const shopGalleryLabelsFr: ShopGalleryLabels = {\n open: (alt, position, total) => (alt ? `Ouvrir la photo ${position} sur ${total} : ${alt}` : `Ouvrir la photo ${position} sur ${total}`),\n more: (count) => `+ ${count} photos`,\n counter: (position, total) => `${position} / ${total}`,\n previous: \"Photo précédente\",\n next: \"Photo suivante\",\n close: \"Fermer\",\n title: (label) => label,\n position: (position, total) => `${position} sur ${total}`,\n};\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { type ShopGalleryLabels, shopGalleryLabels } from \"./labels\";\n\n// The lightbox is a lazy chunk: nothing of it is loaded until a photo is opened.\nconst Lightbox = React.lazy(() => import(\"./lightbox\"));\n\nexport type ShopGalleryPhoto = {\n id: string;\n /** The tile's image. */\n src: string;\n /** What it shows, in words: the tile's name and the lightbox's caption. */\n alt: string;\n /** The widths the product holds (`/a-400.avif 400w, /a-800.avif 800w, /a-1200.avif 1200w`). */\n srcSet?: string;\n /** The lightbox's image at full resolution (default: `src`). */\n fullSrc?: string;\n fullSrcSet?: string;\n};\n\nexport type ShopGalleryProps = Omit<React.ComponentProps<\"div\">, \"children\"> & {\n /** The shop's photos, in order, already unique. */\n photos: readonly ShopGalleryPhoto[];\n /** The gallery's accessible name (`Photos of the salon`). */\n label: string;\n /** The tiles' `sizes` (default: the bento's share of a 72 rem page on a desktop, 78 vw on a phone). */\n sizes?: string;\n /** Translated texts; `shopGalleryLabelsFr` for French. */\n labels?: Partial<ShopGalleryLabels>;\n};\n\nconst BENTO = 5;\n\nconst styles = `\n.kz-sg{position:relative}\n.kz-sg-list{margin:0;padding:0;list-style:none;display:grid;grid-template-columns:repeat(2,1fr);gap:.5rem}\n.kz-sg-tile{position:relative;display:block;width:100%;height:100%;padding:0;overflow:hidden;cursor:zoom-in;border:1px solid var(--kz-border-subtle);border-radius:var(--kz-shop-photo-radius,.75rem);background:var(--kz-surface-2);color:var(--kz-text-on-media)}\n.kz-sg-tile img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}\n.kz-sg-tile:focus-visible{outline:2px solid var(--kz-ring);outline-offset:2px}\n.kz-sg-list>li{aspect-ratio:1/1;min-width:0}\n.kz-sg-list>li:first-child:nth-last-child(odd){grid-column:span 2;aspect-ratio:16/10}\n.kz-sg-more,.kz-sg-count{display:none}\n.kz-sg[data-strip=true] .kz-sg-list{display:flex;gap:.75rem;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;margin-inline:-1rem;padding-inline:1rem;scroll-padding-inline:1rem;-webkit-mask-image:linear-gradient(to right,transparent,currentcolor 1.25rem,currentcolor calc(100% - 1.25rem),transparent);mask-image:linear-gradient(to right,transparent,currentcolor 1.25rem,currentcolor calc(100% - 1.25rem),transparent)}\n.kz-sg[data-strip=true] .kz-sg-list::-webkit-scrollbar{display:none}\n.kz-sg[data-strip=true] .kz-sg-list>li{flex:0 0 78%;aspect-ratio:4/5;scroll-snap-align:start}\n.kz-sg[data-strip=true] .kz-sg-list>li:first-child:nth-last-child(odd){grid-column:auto;aspect-ratio:4/5}\n.kz-sg[data-strip=true] .kz-sg-count{display:block;margin:.5rem 0 0;text-align:end;font:600 .75rem/1 var(--kz-font-mono,monospace);color:var(--kz-text-secondary)}\n@media (prefers-reduced-motion:no-preference){.kz-sg[data-strip=true] .kz-sg-list{scroll-behavior:smooth}.kz-sg-tile img{transition:transform .35s ease}.kz-sg-tile:hover img{transform:scale(1.03)}}\n@media (min-width:40rem){\n.kz-sg-list{gap:.75rem}\n.kz-sg[data-strip=true] .kz-sg-list{display:grid;overflow:visible;margin-inline:0;padding-inline:0;-webkit-mask-image:none;mask-image:none}\n.kz-sg[data-strip=true] .kz-sg-count{display:none}\n.kz-sg[data-count=\"1\"] .kz-sg-list{grid-template-columns:1fr}\n.kz-sg[data-count=\"1\"] .kz-sg-list>li{aspect-ratio:16/9}\n.kz-sg[data-count=\"2\"] .kz-sg-list>li,.kz-sg[data-count=\"2\"] .kz-sg-list>li:first-child:nth-last-child(odd){aspect-ratio:4/3;grid-column:auto}\n.kz-sg:not([data-count=\"1\"]):not([data-count=\"2\"]) .kz-sg-list{grid-template-columns:repeat(4,1fr);grid-template-rows:repeat(2,1fr);aspect-ratio:2/1}\n.kz-sg:not([data-count=\"1\"]):not([data-count=\"2\"]) .kz-sg-list>li,.kz-sg[data-strip=true] .kz-sg-list>li{aspect-ratio:auto;flex:none}\n.kz-sg:not([data-count=\"1\"]):not([data-count=\"2\"]) .kz-sg-list>li:first-child{grid-column:1/3;grid-row:1/3}\n.kz-sg[data-count=\"3\"] .kz-sg-list>li:nth-child(n+2){grid-column:3/5}\n.kz-sg[data-count=\"4\"] .kz-sg-list>li:nth-child(2){grid-column:3/5}\n.kz-sg[data-strip=true] .kz-sg-list>li:nth-child(n+6){display:none}\n.kz-sg[data-more=true] .kz-sg-list>li:nth-child(5) .kz-sg-more{position:absolute;inset:0;display:grid;place-items:center;background:color-mix(in srgb,var(--kz-scrim-strong) 62%,transparent);font:700 1.125rem/1.2 var(--kz-font-sans,system-ui);text-align:center}\n}\n`;\n\n/** A shop's photos: a bento mosaic (one 2×2 lead and four tiles, the last one « + N photos »), a snap strip on a phone, and a lightbox. */\nexport function ShopGallery({ photos, label, sizes, labels: given, className, ...props }: ShopGalleryProps) {\n const labels = { ...shopGalleryLabels, ...given };\n const total = photos.length;\n const strip = total >= BENTO;\n const [open, setOpen] = React.useState<number | null>(null);\n const [current, setCurrent] = React.useState(1);\n const tiles = React.useRef<(HTMLButtonElement | null)[]>([]);\n const opener = React.useRef<number>(0);\n if (total === 0) return null;\n\n const tileSizes = sizes ?? (strip ? \"(min-width: 40rem) 36rem, 78vw\" : \"(min-width: 40rem) 36rem, 50vw\");\n const onScroll = (event: React.UIEvent<HTMLUListElement>) => {\n const list = event.currentTarget;\n const first = list.children[0] as HTMLElement | undefined;\n const step = first ? first.offsetWidth + 12 : 0;\n if (step > 0) setCurrent(Math.min(total, Math.max(1, Math.round(list.scrollLeft / step) + 1)));\n };\n return (\n <div className={cn(\"kz-sg\", className)} data-count={total} data-strip={strip || undefined} data-more={total > BENTO || undefined} role=\"group\" aria-label={label} {...props}>\n <style>{styles}</style>\n <ul className=\"kz-sg-list\" onScroll={strip ? onScroll : undefined}>\n {photos.map((photo, i) => (\n <li key={photo.id}>\n <button\n type=\"button\"\n ref={(node) => {\n tiles.current[i] = node;\n }}\n className=\"kz-sg-tile\"\n aria-label={i === BENTO - 1 && total > BENTO ? `${labels.more(total - BENTO + 1)}: ${labels.open(photo.alt, i + 1, total)}` : labels.open(photo.alt, i + 1, total)}\n onClick={() => {\n opener.current = i;\n setOpen(i);\n }}\n >\n <img src={photo.src} srcSet={photo.srcSet} sizes={photo.srcSet ? tileSizes : undefined} alt=\"\" loading=\"lazy\" decoding=\"async\" />\n {i === BENTO - 1 && total > BENTO && <span className=\"kz-sg-more\" aria-hidden>{labels.more(total - BENTO + 1)}</span>}\n </button>\n </li>\n ))}\n </ul>\n {strip && <p className=\"kz-sg-count\" aria-hidden>{labels.counter(current, total)}</p>}\n {open !== null && (\n <React.Suspense fallback={null}>\n <Lightbox\n photos={photos}\n index={open}\n onIndexChange={setOpen}\n onClose={() => setOpen(null)}\n label={label}\n labels={labels}\n returnFocus={() => tiles.current[opener.current] ?? null}\n />\n </React.Suspense>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AAgBO,IAAM,oBAAuC;AAAA,EAClD,MAAM,CAAC,KAAK,UAAU,UAAW,MAAM,cAAc,QAAQ,OAAO,KAAK,KAAK,GAAG,KAAK,cAAc,QAAQ,OAAO,KAAK;AAAA,EACxH,MAAM,CAAC,UAAU,KAAK,KAAK;AAAA,EAC3B,SAAS,CAAC,UAAU,UAAU,GAAG,QAAQ,MAAM,KAAK;AAAA,EACpD,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO,CAAC,UAAU;AAAA,EAClB,UAAU,CAAC,UAAU,UAAU,GAAG,QAAQ,OAAO,KAAK;AACxD;AA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S,KAAK,GAAE;AAAA,IAChF,SAAS,QACR,oBAAO,gBAAN,EAAe,UAAU,MACxB;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,QACP,eAAe;AAAA,QACf,SAAS,MAAM,QAAQ,IAAI;AAAA,QAC3B;AAAA,QACA;AAAA,QACA,aAAa,MAAM,MAAM,QAAQ,OAAO,OAAO,KAAK;AAAA;AAAA,IACtD,GACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/shop-gallery/labels.ts","../src/shop-gallery/shop-gallery.tsx"],"sourcesContent":["export type ShopGalleryLabels = {\n /** The tile's name: `Open photo 3 of 12: Two chairs by the window`. */\n open: (alt: string, position: number, total: number) => string;\n /** The last tile of the mosaic: `+ 8 photos`. */\n more: (count: number) => string;\n /** The phone strip's counter: `3 / 12`. */\n counter: (position: number, total: number) => string;\n previous: string;\n next: string;\n close: string;\n /** The lightbox's title, read by a screen reader: `Photos of the salon`. */\n title: (label: string) => string;\n /** The lightbox's position: `3 of 12`. */\n position: (position: number, total: number) => string;\n};\n\nexport const shopGalleryLabels: ShopGalleryLabels = {\n open: (alt, position, total) => (alt ? `Open photo ${position} of ${total}: ${alt}` : `Open photo ${position} of ${total}`),\n more: (count) => `+ ${count} photos`,\n counter: (position, total) => `${position} / ${total}`,\n previous: \"Previous photo\",\n next: \"Next photo\",\n close: \"Close\",\n title: (label) => label,\n position: (position, total) => `${position} of ${total}`,\n};\n\nexport const shopGalleryLabelsFr: ShopGalleryLabels = {\n open: (alt, position, total) => (alt ? `Ouvrir la photo ${position} sur ${total} : ${alt}` : `Ouvrir la photo ${position} sur ${total}`),\n more: (count) => `+ ${count} photos`,\n counter: (position, total) => `${position} / ${total}`,\n previous: \"Photo précédente\",\n next: \"Photo suivante\",\n close: \"Fermer\",\n title: (label) => label,\n position: (position, total) => `${position} sur ${total}`,\n};\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { type ShopGalleryLabels, shopGalleryLabels } from \"./labels\";\n\n// The lightbox is a lazy chunk: nothing of it is loaded until a photo is opened.\nconst Lightbox = React.lazy(() => import(\"./lightbox\"));\n\nexport type ShopGalleryPhoto = {\n id: string;\n /** The tile's image. */\n src: string;\n /** What it shows, in words: the tile's name and the lightbox's caption. */\n alt: string;\n /** The widths the product holds (`/a-400.avif 400w, /a-800.avif 800w, /a-1200.avif 1200w`). */\n srcSet?: string;\n /** The lightbox's image at full resolution (default: `src`). */\n fullSrc?: string;\n fullSrcSet?: string;\n};\n\nexport type ShopGalleryProps = Omit<React.ComponentProps<\"div\">, \"children\"> & {\n /** The shop's photos, in order, already unique. */\n photos: readonly ShopGalleryPhoto[];\n /** The gallery's accessible name (`Photos of the salon`). */\n label: string;\n /** The tiles' `sizes` (default: the bento's share of a 72 rem page on a desktop, 78 vw on a phone). */\n sizes?: string;\n /** Translated texts; `shopGalleryLabelsFr` for French. */\n labels?: Partial<ShopGalleryLabels>;\n};\n\nconst BENTO = 5;\n\nconst styles = `\n.kz-sg{position:relative}\n.kz-sg-list{margin:0;padding:0;list-style:none;display:grid;grid-template-columns:repeat(2,1fr);gap:.5rem}\n.kz-sg-tile{position:relative;display:block;width:100%;height:100%;padding:0;overflow:hidden;cursor:zoom-in;border:1px solid var(--kz-border-subtle);border-radius:var(--kz-shop-photo-radius,.75rem);background:var(--kz-surface-2);color:var(--kz-text-on-media)}\n.kz-sg-tile img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}\n.kz-sg-tile:focus-visible{outline:2px solid var(--kz-ring);outline-offset:2px}\n.kz-sg-list>li{aspect-ratio:1/1;min-width:0}\n.kz-sg-list>li:first-child:nth-last-child(odd){grid-column:span 2;aspect-ratio:16/10}\n.kz-sg-more,.kz-sg-count{display:none}\n.kz-sg[data-strip=true] .kz-sg-list{display:flex;gap:.75rem;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;margin-inline:-1rem;padding-inline:1rem;scroll-padding-inline:1rem;-webkit-mask-image:linear-gradient(to right,transparent,currentcolor 1.25rem,currentcolor calc(100% - 1.25rem),transparent);mask-image:linear-gradient(to right,transparent,currentcolor 1.25rem,currentcolor calc(100% - 1.25rem),transparent)}\n.kz-sg[data-strip=true] .kz-sg-list::-webkit-scrollbar{display:none}\n.kz-sg[data-strip=true] .kz-sg-list>li{flex:0 0 78%;aspect-ratio:4/5;scroll-snap-align:start}\n.kz-sg[data-strip=true] .kz-sg-list>li:first-child:nth-last-child(odd){grid-column:auto;aspect-ratio:4/5}\n.kz-sg[data-strip=true] .kz-sg-count{display:block;margin:.5rem 0 0;text-align:end;font:600 .75rem/1 var(--kz-font-mono,monospace);color:var(--kz-text-secondary)}\n@media (prefers-reduced-motion:no-preference){.kz-sg[data-strip=true] .kz-sg-list{scroll-behavior:smooth}.kz-sg-tile img{transition:transform .35s ease}.kz-sg-tile:hover img{transform:scale(1.03)}}\n@media (min-width:40rem){\n.kz-sg-list{gap:.75rem}\n.kz-sg[data-strip=true] .kz-sg-list{display:grid;overflow:visible;margin-inline:0;padding-inline:0;-webkit-mask-image:none;mask-image:none}\n.kz-sg[data-strip=true] .kz-sg-count{display:none}\n.kz-sg[data-count=\"1\"] .kz-sg-list{grid-template-columns:1fr}\n.kz-sg[data-count=\"1\"] .kz-sg-list>li{aspect-ratio:16/9}\n.kz-sg[data-count=\"2\"] .kz-sg-list>li,.kz-sg[data-count=\"2\"] .kz-sg-list>li:first-child:nth-last-child(odd){aspect-ratio:4/3;grid-column:auto}\n.kz-sg:not([data-count=\"1\"]):not([data-count=\"2\"]) .kz-sg-list{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));aspect-ratio:2/1}\n.kz-sg:not([data-count=\"1\"]):not([data-count=\"2\"]) .kz-sg-list>li,.kz-sg[data-strip=true] .kz-sg-list>li{aspect-ratio:auto;flex:none}\n.kz-sg:not([data-count=\"1\"]):not([data-count=\"2\"]) .kz-sg-list>li:first-child{grid-column:1/3;grid-row:1/3;aspect-ratio:auto}\n.kz-sg[data-count=\"3\"] .kz-sg-list>li:nth-child(n+2){grid-column:3/5}\n.kz-sg[data-count=\"4\"] .kz-sg-list>li:nth-child(2){grid-column:3/5}\n.kz-sg[data-strip=true] .kz-sg-list>li:nth-child(n+6){display:none}\n.kz-sg[data-more=true] .kz-sg-list>li:nth-child(5) .kz-sg-more{position:absolute;inset:0;display:grid;place-items:center;background:color-mix(in srgb,var(--kz-scrim-strong) 62%,transparent);font:700 1.125rem/1.2 var(--kz-font-sans,system-ui);text-align:center}\n}\n`;\n\n/** A shop's photos: a bento mosaic (one 2×2 lead and four tiles, the last one « + N photos »), a snap strip on a phone, and a lightbox. */\nexport function ShopGallery({ photos, label, sizes, labels: given, className, ...props }: ShopGalleryProps) {\n const labels = { ...shopGalleryLabels, ...given };\n const total = photos.length;\n const strip = total >= BENTO;\n const [open, setOpen] = React.useState<number | null>(null);\n const [current, setCurrent] = React.useState(1);\n const tiles = React.useRef<(HTMLButtonElement | null)[]>([]);\n const opener = React.useRef<number>(0);\n if (total === 0) return null;\n\n const tileSizes = sizes ?? (strip ? \"(min-width: 40rem) 36rem, 78vw\" : \"(min-width: 40rem) 36rem, 50vw\");\n const onScroll = (event: React.UIEvent<HTMLUListElement>) => {\n const list = event.currentTarget;\n const first = list.children[0] as HTMLElement | undefined;\n const step = first ? first.offsetWidth + 12 : 0;\n if (step > 0) setCurrent(Math.min(total, Math.max(1, Math.round(list.scrollLeft / step) + 1)));\n };\n return (\n <div className={cn(\"kz-sg\", className)} data-count={total} data-strip={strip || undefined} data-more={total > BENTO || undefined} role=\"group\" aria-label={label} {...props}>\n <style>{styles}</style>\n <ul className=\"kz-sg-list\" onScroll={strip ? onScroll : undefined}>\n {photos.map((photo, i) => (\n <li key={photo.id}>\n <button\n type=\"button\"\n ref={(node) => {\n tiles.current[i] = node;\n }}\n className=\"kz-sg-tile\"\n aria-label={i === BENTO - 1 && total > BENTO ? `${labels.more(total - BENTO + 1)}: ${labels.open(photo.alt, i + 1, total)}` : labels.open(photo.alt, i + 1, total)}\n onClick={() => {\n opener.current = i;\n setOpen(i);\n }}\n >\n <img src={photo.src} srcSet={photo.srcSet} sizes={photo.srcSet ? tileSizes : undefined} alt=\"\" loading=\"lazy\" decoding=\"async\" />\n {i === BENTO - 1 && total > BENTO && <span className=\"kz-sg-more\" aria-hidden>{labels.more(total - BENTO + 1)}</span>}\n </button>\n </li>\n ))}\n </ul>\n {strip && <p className=\"kz-sg-count\" aria-hidden>{labels.counter(current, total)}</p>}\n {open !== null && (\n <React.Suspense fallback={null}>\n <Lightbox\n photos={photos}\n index={open}\n onIndexChange={setOpen}\n onClose={() => setOpen(null)}\n label={label}\n labels={labels}\n returnFocus={() => tiles.current[opener.current] ?? null}\n />\n </React.Suspense>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AAgBO,IAAM,oBAAuC;AAAA,EAClD,MAAM,CAAC,KAAK,UAAU,UAAW,MAAM,cAAc,QAAQ,OAAO,KAAK,KAAK,GAAG,KAAK,cAAc,QAAQ,OAAO,KAAK;AAAA,EACxH,MAAM,CAAC,UAAU,KAAK,KAAK;AAAA,EAC3B,SAAS,CAAC,UAAU,UAAU,GAAG,QAAQ,MAAM,KAAK;AAAA,EACpD,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO,CAAC,UAAU;AAAA,EAClB,UAAU,CAAC,UAAU,UAAU,GAAG,QAAQ,OAAO,KAAK;AACxD;AAEO,IAAM,sBAAyC;AAAA,EACpD,MAAM,CAAC,KAAK,UAAU,UAAW,MAAM,mBAAmB,QAAQ,QAAQ,KAAK,MAAM,GAAG,KAAK,mBAAmB,QAAQ,QAAQ,KAAK;AAAA,EACrI,MAAM,CAAC,UAAU,KAAK,KAAK;AAAA,EAC3B,SAAS,CAAC,UAAU,UAAU,GAAG,QAAQ,MAAM,KAAK;AAAA,EACpD,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO,C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CHANGED
|
@@ -15,7 +15,9 @@ type ThemeScriptProps = {
|
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* In <head>, before anything renders: applies the persisted mode (else `defaultMode`) and named theme, so the page
|
|
18
|
-
* never flashes. `
|
|
18
|
+
* never flashes. It also sets `html[data-session]` when the readable `kz-session` hint cookie says a session exists, so
|
|
19
|
+
* `blocks.css` hides the bar's signed-out-only actions from the first paint (krizaka-ui#827). `nonce` for a strict
|
|
20
|
+
* Content-Security-Policy.
|
|
19
21
|
*/
|
|
20
22
|
declare function ThemeScript({ nonce, defaultMode }: ThemeScriptProps): React.JSX.Element;
|
|
21
23
|
type ThemeContextValue = {
|
package/dist/theme.js
CHANGED
|
@@ -52,9 +52,10 @@ function applyName(previous, next) {
|
|
|
52
52
|
if (previous) classes.remove(`theme-${previous}`);
|
|
53
53
|
if (next) classes.add(`theme-${next}`);
|
|
54
54
|
}
|
|
55
|
+
var SESSION_HINT_COOKIE = "kz-session";
|
|
55
56
|
function ThemeScript({ nonce, defaultMode = "system" }) {
|
|
56
57
|
const fallback = isMode(defaultMode) ? defaultMode : "system";
|
|
57
|
-
const js = `(function(){try{var m=localStorage.getItem("${MODE_KEY}");if(m!=="dark"&&m!=="light"&&m!=="system")m="${fallback}";var n=localStorage.getItem("${NAME_KEY}");var d=matchMedia("${DARK_QUERY}").matches;var c=document.documentElement.classList;c.toggle("light",m==="light"||(m==="system"&&!d));if(n)c.add("theme-"+n);var a=localStorage.getItem("${ACCENT_KEY}");if(a)document.documentElement.setAttribute("data-accent",a);var y=localStorage.getItem("${DENSITY_KEY}");if(y)document.documentElement.setAttribute("data-density",y)}catch(e){}})()`;
|
|
58
|
+
const js = `(function(){try{if(/(?:^|;\\s*)${SESSION_HINT_COOKIE}=1(?:;|$)/.test(document.cookie))document.documentElement.setAttribute("data-session","")}catch(e){}try{var m=localStorage.getItem("${MODE_KEY}");if(m!=="dark"&&m!=="light"&&m!=="system")m="${fallback}";var n=localStorage.getItem("${NAME_KEY}");var d=matchMedia("${DARK_QUERY}").matches;var c=document.documentElement.classList;c.toggle("light",m==="light"||(m==="system"&&!d));if(n)c.add("theme-"+n);var a=localStorage.getItem("${ACCENT_KEY}");if(a)document.documentElement.setAttribute("data-accent",a);var y=localStorage.getItem("${DENSITY_KEY}");if(y)document.documentElement.setAttribute("data-density",y)}catch(e){}})()`;
|
|
58
59
|
return /* @__PURE__ */ jsx("script", { nonce, dangerouslySetInnerHTML: { __html: js } });
|
|
59
60
|
}
|
|
60
61
|
var ThemeContext = React.createContext(null);
|
package/dist/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/theme.tsx"],"sourcesContent":["// Client. ONE mechanism for the whole organisation: dark by default, `html.light` for light, `html.theme-<name>` for a\n// named theme, persisted in localStorage (`kz-theme` for the mode, `kz-theme-name` for the named theme).\nimport * as React from \"react\";\n\nimport { type ButtonVariants, buttonVariants } from \"../button/button\";\n\nexport type Mode = \"dark\" | \"light\" | \"system\";\n\nconst MODE_KEY = \"kz-theme\";\nconst NAME_KEY = \"kz-theme-name\";\nconst ACCENT_KEY = \"kz-accent\";\nconst DENSITY_KEY = \"kz-density\";\nconst MODES: readonly Mode[] = [\"dark\", \"light\", \"system\"];\nconst DARK_QUERY = \"(prefers-color-scheme: dark)\";\n\nconst isMode = (value: unknown): value is Mode => MODES.includes(value as Mode);\n\n// Storage blocked (private mode, sandbox): the choice lives in memory for the page.\nconst memory = new Map<string, string>();\n\nfunction read(key: string): string | null {\n try {\n return localStorage.getItem(key);\n } catch {\n return memory.get(key) ?? null;\n }\n}\n\nfunction write(key: string, value: string | null) {\n if (value === null) memory.delete(key);\n else memory.set(key, value);\n try {\n if (value === null) localStorage.removeItem(key);\n else localStorage.setItem(key, value);\n } catch {\n // storage blocked: memory holds it\n }\n}\n\n// The persisted choice is an external store: every provider and tab reads the same value, the server reads none.\nconst listeners = new Set<() => void>();\nconst notify = () => listeners.forEach((listener) => listener());\nfunction subscribe(listener: () => void) {\n listeners.add(listener);\n window.addEventListener(\"storage\", listener);\n return () => {\n listeners.delete(listener);\n window.removeEventListener(\"storage\", listener);\n };\n}\n\nfunction applyMode(mode: Mode) {\n const dark = window.matchMedia(DARK_QUERY).matches;\n document.documentElement.classList.toggle(\"light\", mode === \"light\" || (mode === \"system\" && !dark));\n}\n\nfunction applyName(previous: string | null, next: string | null) {\n const classes = document.documentElement.classList;\n if (previous) classes.remove(`theme-${previous}`);\n if (next) classes.add(`theme-${next}`);\n}\n\nexport type ThemeScriptProps = {\n /** The nonce of a strict Content-Security-Policy (`script-src 'nonce-…'`). */\n nonce?: string;\n /**\n * The mode before the visitor chooses one — pass the same value as `ThemeProvider`'s `defaultMode`. A persisted\n * choice (`kz-theme`) always wins.\n * @default \"system\"\n */\n defaultMode?: Mode;\n};\n\n/**\n * In <head>, before anything renders: applies the persisted mode (else `defaultMode`) and named theme, so the page\n * never flashes. `nonce` for a strict Content-Security-Policy.\n */\nexport function ThemeScript({ nonce, defaultMode = \"system\" }: ThemeScriptProps) {\n const fallback = isMode(defaultMode) ? defaultMode : \"system\";\n const js =\n `(function(){try{var m=localStorage.getItem(\"${MODE_KEY}\");if(m!==\"dark\"&&m!==\"light\"&&m!==\"system\")m=\"${fallback}\";` +\n `var n=localStorage.getItem(\"${NAME_KEY}\");var d=matchMedia(\"${DARK_QUERY}\").matches;var c=document.documentElement.classList;` +\n `c.toggle(\"light\",m===\"light\"||(m===\"system\"&&!d));if(n)c.add(\"theme-\"+n);var a=localStorage.getItem(\"${ACCENT_KEY}\");if(a)document.documentElement.setAttribute(\"data-accent\",a);var y=localStorage.getItem(\"${DENSITY_KEY}\");if(y)document.documentElement.setAttribute(\"data-density\",y)}catch(e){}})()`;\n return <script nonce={nonce} dangerouslySetInnerHTML={{ __html: js }} />;\n}\n\nexport type ThemeContextValue = {\n /** The chosen mode: dark, light or follow the system. */\n mode: Mode;\n setMode: (mode: Mode) => void;\n /** The named theme (`html.theme-<name>`), or null. */\n theme: string | null;\n setTheme: (theme: string | null) => void;\n};\n\nconst ThemeContext = React.createContext<ThemeContextValue | null>(null);\n\nexport type ThemeProviderProps = {\n children: React.ReactNode;\n /**\n * The mode before the visitor chooses one (nothing persisted as `kz-theme`) — pass the same value to `ThemeScript`.\n * @default \"system\"\n */\n defaultMode?: Mode;\n};\n\nexport function ThemeProvider({ children, defaultMode = \"system\" }: ThemeProviderProps) {\n // Before hydration the server knows nothing persisted (ThemeScript has already applied it to <html>).\n const stored = React.useSyncExternalStore(subscribe, () => read(MODE_KEY), () => null);\n const mode: Mode = isMode(stored) ? stored : defaultMode;\n const theme = React.useSyncExternalStore(subscribe, () => read(NAME_KEY), () => null);\n\n // The same resolution as ThemeScript (a no-op after it), for an app that renders the provider without the script.\n React.useEffect(() => {\n const persisted = read(MODE_KEY);\n applyMode(isMode(persisted) ? persisted : defaultMode);\n }, [defaultMode]);\n\n // \"system\" follows the operating system while the page is open.\n React.useEffect(() => {\n if (mode !== \"system\") return;\n const query = window.matchMedia(DARK_QUERY);\n const onChange = () => applyMode(\"system\");\n query.addEventListener?.(\"change\", onChange);\n return () => query.removeEventListener?.(\"change\", onChange);\n }, [mode]);\n\n const setMode = React.useCallback((next: Mode) => {\n write(MODE_KEY, next);\n applyMode(next);\n notify();\n }, []);\n\n const setTheme = React.useCallback((next: string | null) => {\n applyName(read(NAME_KEY), next);\n write(NAME_KEY, next);\n notify();\n }, []);\n\n const value = React.useMemo(() => ({ mode, setMode, theme, setTheme }), [mode, setMode, theme, setTheme]);\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n}\n\n/** The theme context, or `null` outside a `ThemeProvider` (a frame that offers the theme only when the app has one). */\nexport function useOptionalTheme(): ThemeContextValue | null {\n return React.useContext(ThemeContext);\n}\n\nexport function useTheme(): ThemeContextValue {\n const context = React.useContext(ThemeContext);\n if (!context) throw new Error(\"useTheme: wrap the app in <ThemeProvider>\");\n return context;\n}\n\nconst ICONS: Record<Mode, React.ReactNode> = {\n dark: <path d=\"M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5Z\" />,\n light: (\n <>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4\" />\n </>\n ),\n system: (\n <>\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\" />\n <path d=\"M8 20h8M12 16v4\" />\n </>\n ),\n};\n\nexport type ThemeToggleProps = Omit<React.ComponentProps<\"button\">, \"onClick\" | \"children\"> &\n Pick<ButtonVariants, \"variant\" | \"shape\"> & {\n /** Any `Button` variant. */\n variant?: ButtonVariants[\"variant\"];\n /**\n * rounded · pill.\n * @default \"rounded\"\n */\n shape?: ButtonVariants[\"shape\"];\n /** The accessible name — a string, or one per current mode (e.g. `(mode) => t(\"theme.\" + mode)`). */\n label: string | ((mode: Mode) => string);\n };\n\n/**\n * An icon button (styled as `IconButton`, without its Slot) that cycles dark → light → system. Needs a\n * <ThemeProvider> above it. State: `data-mode`.\n */\nexport function ThemeToggle({ label, variant = \"ghost\", shape, className, ...props }: ThemeToggleProps) {\n const { mode, setMode } = useTheme();\n const next = MODES[(MODES.indexOf(mode) + 1) % MODES.length] as Mode;\n const name = typeof label === \"function\" ? label(mode) : label;\n return (\n <button\n type=\"button\"\n aria-label={name}\n title={name}\n data-mode={mode}\n onClick={() => setMode(next)}\n className={buttonVariants({ variant, shape, size: \"icon\", className })}\n {...props}\n >\n <svg viewBox=\"0 0 24 24\" className=\"h-5 w-5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n {ICONS[mode]}\n </svg>\n </button>\n );\n}\n\n/** The choices of the Appearance block (ADR-006 §4): the theme (`system · light · dark`, then a surface set), the accent, the density. */\nexport type AppearanceState = {\n /** `system`, `light`, `dark`, or the surface set (`blueprint`, `carbone`) — which is dark. */\n themeId: string;\n setThemeId: (id: string) => void;\n /** A brand's accent (`data-accent` on `<html>`), or null: the product's own. */\n accent: string | null;\n setAccent: (accent: string | null) => void;\n /** `standard` or `compact` (`data-density` on `<html>`, the token layer: rows and gaps one step down). */\n density: string;\n setDensity: (density: string) => void;\n};\n\nfunction applyAttribute(name: string, value: string | null) {\n if (value === null) document.documentElement.removeAttribute(name);\n else document.documentElement.setAttribute(name, value);\n}\n\n/**\n * The state of the Appearance block, applied at once and kept in the browser (`kz-theme`, `kz-theme-name`, `kz-accent`,\n * `kz-density`; `ThemeScript` restores them before paint). A product with an account also saves what `onChange` of the block\n * reports, so the choice follows the person. Needs a `ThemeProvider`.\n * @param surfaceSets the themes that are a dark surface set (default `blueprint`, `carbone`)\n */\nexport function useAppearance(surfaceSets: readonly string[] = [\"blueprint\", \"carbone\"]): AppearanceState {\n const { mode, setMode, theme, setTheme } = useTheme();\n const accent = React.useSyncExternalStore(subscribe, () => read(ACCENT_KEY), () => null);\n const density = React.useSyncExternalStore(subscribe, () => read(DENSITY_KEY), () => null) ?? \"standard\";\n const themeId = theme && surfaceSets.includes(theme) && mode === \"dark\" ? theme : mode;\n const setThemeId = React.useCallback(\n (id: string) => {\n if (surfaceSets.includes(id)) {\n setMode(\"dark\");\n setTheme(id);\n } else {\n setTheme(null);\n setMode(id as Mode);\n }\n },\n [setMode, setTheme, surfaceSets],\n );\n const setAccent = React.useCallback((next: string | null) => {\n applyAttribute(\"data-accent\", next);\n write(ACCENT_KEY, next);\n notify();\n }, []);\n const setDensity = React.useCallback((next: string) => {\n applyAttribute(\"data-density\", next === \"standard\" ? null : next);\n write(DENSITY_KEY, next === \"standard\" ? null : next);\n notify();\n }, []);\n return { themeId, setThemeId, accent, setAccent, density, setDensity };\n}\n"],"mappings":";;;;;;;;;AAEA,YAAY,WAAW;AAiFd,SA0EL,UA1EK,KA0EL,YA1EK;AA3ET,IAAM,WAAW;AACjB,IAAM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e,MAAc,OAAsB;AAC1D,MAAI,UAAU,KAAM,UAAS,gBAAgB,gBAAgB,IAAI;AAAA,MAC5D,UAAS,gBAAgB,aAAa,MAAM,KAAK;AACxD;AAQO,SAAS,cAAc,cAAiC,CAAC,aAAa,SAAS,GAAoB;AACxG,QAAM,EAAE,MAAM,SAAS,OAAO,SAAS,IAAI,SAAS;AACpD,QAAM,SAAe,2BAAqB,WAAW,MAAM,KAAK,UAAU,GAAG,MAAM,IAAI;AACvF,QAAM,UAAgB,2BAAqB,WAAW,MAAM,KAAK,WAAW,GAAG,MAAM,IAAI,KAAK;AAC9F,QAAM,UAAU,SAAS,YAAY,SAAS,KAAK,KAAK,SAAS,SAAS,QAAQ;AAClF,QAAM,aAAmB;AAAA,IACvB,CAAC,OAAe;AACd,UAAI,YAAY,SAAS,EAAE,GAAG;AAC5B,gBAAQ,MAAM;AACd,iBAAS,EAAE;AAAA,MACb,OAAO;AACL,iBAAS,IAAI;AACb,gBAAQ,EAAU;AAAA,MACpB;AAAA,IACF;AAAA,IACA,CAAC,SAAS,UAAU,WAAW;AAAA,EACjC;AACA,QAAM,YAAkB,kBAAY,CAAC,SAAwB;AAC3D,mBAAe,eAAe,IAAI;AAClC,UAAM,YAAY,IAAI;AACtB,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,QAAM,aAAmB,kBAAY,CAAC,SAAiB;AACrD,mBAAe,gBAAgB,SAAS,aAAa,OAAO,IAAI;AAChE,UAAM,aAAa,SAAS,aAAa,OAAO,IAAI;AACpD,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,SAAO,EAAE,SAAS,YAAY,QAAQ,WAAW,SAAS,WAAW;AACvE;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/theme/theme.tsx"],"sourcesContent":["// Client. ONE mechanism for the whole organisation: dark by default, `html.light` for light, `html.theme-<name>` for a\n// named theme, persisted in localStorage (`kz-theme` for the mode, `kz-theme-name` for the named theme).\nimport * as React from \"react\";\n\nimport { type ButtonVariants, buttonVariants } from \"../button/button\";\n\nexport type Mode = \"dark\" | \"light\" | \"system\";\n\nconst MODE_KEY = \"kz-theme\";\nconst NAME_KEY = \"kz-theme-name\";\nconst ACCENT_KEY = \"kz-accent\";\nconst DENSITY_KEY = \"kz-density\";\nconst MODES: readonly Mode[] = [\"dark\", \"light\", \"system\"];\nconst DARK_QUERY = \"(prefers-color-scheme: dark)\";\n\nconst isMode = (value: unknown): value is Mode => MODES.includes(value as Mode);\n\n// Storage blocked (private mode, sandbox): the choice lives in memory for the page.\nconst memory = new Map<string, string>();\n\nfunction read(key: string): string | null {\n try {\n return localStorage.getItem(key);\n } catch {\n return memory.get(key) ?? null;\n }\n}\n\nfunction write(key: string, value: string | null) {\n if (value === null) memory.delete(key);\n else memory.set(key, value);\n try {\n if (value === null) localStorage.removeItem(key);\n else localStorage.setItem(key, value);\n } catch {\n // storage blocked: memory holds it\n }\n}\n\n// The persisted choice is an external store: every provider and tab reads the same value, the server reads none.\nconst listeners = new Set<() => void>();\nconst notify = () => listeners.forEach((listener) => listener());\nfunction subscribe(listener: () => void) {\n listeners.add(listener);\n window.addEventListener(\"storage\", listener);\n return () => {\n listeners.delete(listener);\n window.removeEventListener(\"storage\", listener);\n };\n}\n\nfunction applyMode(mode: Mode) {\n const dark = window.matchMedia(DARK_QUERY).matches;\n document.documentElement.classList.toggle(\"light\", mode === \"light\" || (mode === \"system\" && !dark));\n}\n\nfunction applyName(previous: string | null, next: string | null) {\n const classes = document.documentElement.classList;\n if (previous) classes.remove(`theme-${previous}`);\n if (next) classes.add(`theme-${next}`);\n}\n\nexport type ThemeScriptProps = {\n /** The nonce of a strict Content-Security-Policy (`script-src 'nonce-…'`). */\n nonce?: string;\n /**\n * The mode before the visitor chooses one — pass the same value as `ThemeProvider`'s `defaultMode`. A persisted\n * choice (`kz-theme`) always wins.\n * @default \"system\"\n */\n defaultMode?: Mode;\n};\n\n/** The readable flag cookie of a session (`kz-session=1`, kept by `@krizaka/auth`): a hint, never the proof. */\nconst SESSION_HINT_COOKIE = \"kz-session\";\n\n/**\n * In <head>, before anything renders: applies the persisted mode (else `defaultMode`) and named theme, so the page\n * never flashes. It also sets `html[data-session]` when the readable `kz-session` hint cookie says a session exists, so\n * `blocks.css` hides the bar's signed-out-only actions from the first paint (krizaka-ui#827). `nonce` for a strict\n * Content-Security-Policy.\n */\nexport function ThemeScript({ nonce, defaultMode = \"system\" }: ThemeScriptProps) {\n const fallback = isMode(defaultMode) ? defaultMode : \"system\";\n const js =\n `(function(){try{if(/(?:^|;\\\\s*)${SESSION_HINT_COOKIE}=1(?:;|$)/.test(document.cookie))document.documentElement.setAttribute(\"data-session\",\"\")}catch(e){}try{var m=localStorage.getItem(\"${MODE_KEY}\");if(m!==\"dark\"&&m!==\"light\"&&m!==\"system\")m=\"${fallback}\";` +\n `var n=localStorage.getItem(\"${NAME_KEY}\");var d=matchMedia(\"${DARK_QUERY}\").matches;var c=document.documentElement.classList;` +\n `c.toggle(\"light\",m===\"light\"||(m===\"system\"&&!d));if(n)c.add(\"theme-\"+n);var a=localStorage.getItem(\"${ACCENT_KEY}\");if(a)document.documentElement.setAttribute(\"data-accent\",a);var y=localStorage.getItem(\"${DENSITY_KEY}\");if(y)document.documentElement.setAttribute(\"data-density\",y)}catch(e){}})()`;\n return <script nonce={nonce} dangerouslySetInnerHTML={{ __html: js }} />;\n}\n\nexport type ThemeContextValue = {\n /** The chosen mode: dark, light or follow the system. */\n mode: Mode;\n setMode: (mode: Mode) => void;\n /** The named theme (`html.theme-<name>`), or null. */\n theme: string | null;\n setTheme: (theme: string | null) => void;\n};\n\nconst ThemeContext = React.createContext<ThemeContextValue | null>(null);\n\nexport type ThemeProviderProps = {\n children: React.ReactNode;\n /**\n * The mode before the visitor chooses one (nothing persisted as `kz-theme`) — pass the same value to `ThemeScript`.\n * @default \"system\"\n */\n defaultMode?: Mode;\n};\n\nexport function ThemeProvider({ children, defaultMode = \"system\" }: ThemeProviderProps) {\n // Before hydration the server knows nothing persisted (ThemeScript has already applied it to <html>).\n const stored = React.useSyncExternalStore(subscribe, () => read(MODE_KEY), () => null);\n const mode: Mode = isMode(stored) ? stored : defaultMode;\n const theme = React.useSyncExternalStore(subscribe, () => read(NAME_KEY), () => null);\n\n // The same resolution as ThemeScript (a no-op after it), for an app that renders the provider without the script.\n React.useEffect(() => {\n const persisted = read(MODE_KEY);\n applyMode(isMode(persisted) ? persisted : defaultMode);\n }, [defaultMode]);\n\n // \"system\" follows the operating system while the page is open.\n React.useEffect(() => {\n if (mode !== \"system\") return;\n const query = window.matchMedia(DARK_QUERY);\n const onChange = () => applyMode(\"system\");\n query.addEventListener?.(\"change\", onChange);\n return () => query.removeEventListener?.(\"change\", onChange);\n }, [mode]);\n\n const setMode = React.useCallback((next: Mode) => {\n write(MODE_KEY, next);\n applyMode(next);\n notify();\n }, []);\n\n const setTheme = React.useCallback((next: string | null) => {\n applyName(read(NAME_KEY), next);\n write(NAME_KEY, next);\n notify();\n }, []);\n\n const value = React.useMemo(() => ({ mode, setMode, theme, setTheme }), [mode, setMode, theme, setTheme]);\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n}\n\n/** The theme context, or `null` outside a `ThemeProvider` (a frame that offers the theme only when the app has one). */\nexport function useOptionalTheme(): ThemeContextValue | null {\n return React.useContext(ThemeContext);\n}\n\nexport function useTheme(): ThemeContextValue {\n const context = React.useContext(ThemeContext);\n if (!context) throw new Error(\"useTheme: wrap the app in <ThemeProvider>\");\n return context;\n}\n\nconst ICONS: Record<Mode, React.ReactNode> = {\n dark: <path d=\"M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5Z\" />,\n light: (\n <>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4\" />\n </>\n ),\n system: (\n <>\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\" />\n <path d=\"M8 20h8M12 16v4\" />\n </>\n ),\n};\n\nexport type ThemeToggleProps = Omit<React.ComponentProps<\"button\">, \"onClick\" | \"children\"> &\n Pick<ButtonVariants, \"variant\" | \"shape\"> & {\n /** Any `Button` variant. */\n variant?: ButtonVariants[\"variant\"];\n /**\n * rounded · pill.\n * @default \"rounded\"\n */\n shape?: ButtonVariants[\"shape\"];\n /** The accessible name — a string, or one per current mode (e.g. `(mode) => t(\"theme.\" + mode)`). */\n label: string | ((mode: Mode) => string);\n };\n\n/**\n * An icon button (styled as `IconButton`, without its Slot) that cycles dark → light → system. Needs a\n * <ThemeProvider> above it. State: `data-mode`.\n */\nexport function ThemeToggle({ label, variant = \"ghost\", shape, className, ...props }: ThemeToggleProps) {\n const { mode, setMode } = useTheme();\n const next = MODES[(MODES.indexOf(mode) + 1) % MODES.length] as Mode;\n const name = typeof label === \"function\" ? label(mode) : label;\n return (\n <button\n type=\"button\"\n aria-label={name}\n title={name}\n data-mode={mode}\n onClick={() => setMode(next)}\n className={buttonVariants({ variant, shape, size: \"icon\", className })}\n {...props}\n >\n <svg viewBox=\"0 0 24 24\" className=\"h-5 w-5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n {ICONS[mode]}\n </svg>\n </button>\n );\n}\n\n/** The choices of the Appearance block (ADR-006 §4): the theme (`system · light · dark`, then a surface set), the accent, the density. */\nexport type AppearanceState = {\n /** `system`, `light`, `dark`, or the surface set (`blueprint`, `carbone`) — which is dark. */\n themeId: string;\n setThemeId: (id: string) => void;\n /** A brand's accent (`data-accent` on `<html>`), or null: the product's own. */\n accent: string | null;\n setAccent: (accent: string | null) => void;\n /** `standard` or `compact` (`data-density` on `<html>`, the token layer: rows and gaps one step down). */\n density: string;\n setDensity: (density: string) => void;\n};\n\nfunction applyAttribute(name: string, value: string | null) {\n if (value === null) document.documentElement.removeAttribute(name);\n else document.documentElement.setAttribute(name, value);\n}\n\n/**\n * The state of the Appearance block, applied at once and kept in the browser (`kz-theme`, `kz-theme-name`, `kz-accent`,\n * `kz-density`; `ThemeScript` restores them before paint). A product with an account also saves what `onChange` of the block\n * reports, so the choice follows the person. Needs a `ThemeProvider`.\n * @param surfaceSets the themes that are a dark surface set (default `blueprint`, `carbone`)\n */\nexport function useAppearance(surfaceSets: readonly string[] = [\"blueprint\", \"carbone\"]): AppearanceState {\n const { mode, setMode, theme, setTheme } = useTheme();\n const accent = React.useSyncExternalStore(subscribe, () => read(ACCENT_KEY), () => null);\n const density = React.useSyncExternalStore(subscribe, () => read(DENSITY_KEY), () => null) ?? \"standard\";\n const themeId = theme && surfaceSets.includes(theme) && mode === \"dark\" ? theme : mode;\n const setThemeId = React.useCallback(\n (id: string) => {\n if (surfaceSets.includes(id)) {\n setMode(\"dark\");\n setTheme(id);\n } else {\n setTheme(null);\n setMode(id as Mode);\n }\n },\n [setMode, setTheme, surfaceSets],\n );\n const setAccent = React.useCallback((next: string | null) => {\n applyAttribute(\"data-accent\", next);\n write(ACCENT_KEY, next);\n notify();\n }, []);\n const setDensity = React.useCallback((next: string) => {\n applyAttribute(\"data-density\", next === \"standard\" ? null : next);\n write(DENSITY_KEY, next === \"standard\" ? null : next);\n notify();\n }, []);\n return { themeId, setThemeId, accent, setAccent, density, setDensity };\n}\n"],"mappings":";;;;;;;;;AAEA,YAAY,WAAW;AAsFd,SA0EL,UA1EK,KA0EL,YA1EK;AAhFT,IAAM,WAAW;AACjB,IAAM,WAAW;AACjB,IAAM,aAAa;AACnB,IAAM,cAAc;AACpB,IAAM,QAAyB,CAAC,QAAQ,SAAS,QAAQ;AACzD,IAAM,aAAa;AAEnB,IAAM,SAAS,CAAC,UAAkC,MAAM,SAAS,KAAa;AAG9E,IAAM,SAAS,oBAAI,IAAoB;AAEvC,SAAS,KAAK,KAA4B;AACxC,MAAI;AACF,WAAO,aAAa,QAAQ,GAAG;AAAA,EACjC,QAAQ;AACN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2BAAqB,WAAW,MAAM,KAAK,UAAU,GAAG,MAAM,IAAI;AACvF,QAAM,UAAgB,2BAAqB,WAAW,MAAM,KAAK,WAAW,GAAG,MAAM,IAAI,KAAK;AAC9F,QAAM,UAAU,SAAS,YAAY,SAAS,KAAK,KAAK,SAAS,SAAS,QAAQ;AAClF,QAAM,aAAmB;AAAA,IACvB,CAAC,OAAe;AACd,UAAI,YAAY,SAAS,EAAE,GAAG;AAC5B,gBAAQ,MAAM;AACd,iBAAS,EAAE;AAAA,MACb,OAAO;AACL,iBAAS,IAAI;AACb,gBAAQ,EAAU;AAAA,MACpB;AAAA,IACF;AAAA,IACA,CAAC,SAAS,UAAU,WAAW;AAAA,EACjC;AACA,QAAM,YAAkB,kBAAY,CAAC,SAAwB;AAC3D,mBAAe,eAAe,IAAI;AAClC,UAAM,YAAY,IAAI;AACtB,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,QAAM,aAAmB,kBAAY,CAAC,SAAiB;AACrD,mBAAe,gBAAgB,SAAS,aAAa,OAAO,IAAI;AAChE,UAAM,aAAa,SAAS,aAAa,OAAO,IAAI;AACpD,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,SAAO,EAAE,SAAS,YAAY,QAAQ,WAAW,SAAS,WAAW;AACvE;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krizaka/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.76.1",
|
|
4
4
|
"description": "The Krizaka front-end platform's components: the primitives (button, card, dialog, toast, menu, field, tabs, chip, switch, slider, command palette, theme, countdown…) on the semantic --kz-* tokens, the animated marks (Krizaka, Orazaka, Yomizaka, Akinaza) and the motion signature — web and /native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"krizaka",
|
|
@@ -976,8 +976,8 @@
|
|
|
976
976
|
"*.css"
|
|
977
977
|
],
|
|
978
978
|
"peerDependencies": {
|
|
979
|
-
"@krizaka/query": ">=0.
|
|
980
|
-
"@krizaka/tailwind": ">=3.
|
|
979
|
+
"@krizaka/query": ">=0.3.0",
|
|
980
|
+
"@krizaka/tailwind": ">=3.76.1",
|
|
981
981
|
"@maplibre/maplibre-react-native": ">=11",
|
|
982
982
|
"@shopify/flash-list": ">=2",
|
|
983
983
|
"expo-camera": ">=16",
|
|
@@ -1040,7 +1040,7 @@
|
|
|
1040
1040
|
"tsup": "^9.0.0",
|
|
1041
1041
|
"typescript": "^5.9.0",
|
|
1042
1042
|
"vitest": "^5.0.5",
|
|
1043
|
-
"@krizaka/query": "0.
|
|
1043
|
+
"@krizaka/query": "0.3.0"
|
|
1044
1044
|
},
|
|
1045
1045
|
"engines": {
|
|
1046
1046
|
"node": ">=22"
|
|
@@ -1810,10 +1810,10 @@
|
|
|
1810
1810
|
]
|
|
1811
1811
|
},
|
|
1812
1812
|
{
|
|
1813
|
-
"name": "./data-table: DataTable (TanStack Table v9, the windowing of TanStack Virtual, Radix Checkbox, the pagination)",
|
|
1813
|
+
"name": "./data-table: DataTable (TanStack Table v9, the windowing of TanStack Virtual, Radix Checkbox, the pagination) // 2026-10-29: split for Sonar S3776 (was 137); +700 B accepted by the CTO; win back in #861",
|
|
1814
1814
|
"path": "dist/data-table.js",
|
|
1815
1815
|
"import": "{ DataTable }",
|
|
1816
|
-
"limit": "
|
|
1816
|
+
"limit": "49.5 kB",
|
|
1817
1817
|
"gzip": true,
|
|
1818
1818
|
"ignore": [
|
|
1819
1819
|
"tailwind-variants",
|
|
@@ -3062,10 +3062,10 @@
|
|
|
3062
3062
|
]
|
|
3063
3063
|
},
|
|
3064
3064
|
{
|
|
3065
|
-
"name": "./genui: GenUiStream (A2UI v0.9 validator, store, surface, base catalog with DataTable)",
|
|
3065
|
+
"name": "./genui: GenUiStream (A2UI v0.9 validator, store, surface, base catalog with DataTable) // 2026-10-29: carries the DataTable split for Sonar S3776; +800 B accepted by the CTO; win back in #861",
|
|
3066
3066
|
"path": "dist/genui.js",
|
|
3067
3067
|
"import": "{ GenUiStream, baseGenUiCatalog }",
|
|
3068
|
-
"limit": "
|
|
3068
|
+
"limit": "55.2 kB",
|
|
3069
3069
|
"gzip": true,
|
|
3070
3070
|
"ignore": [
|
|
3071
3071
|
"tailwind-variants",
|
|
@@ -3366,9 +3366,9 @@
|
|
|
3366
3366
|
"sonner": "^2.0.8",
|
|
3367
3367
|
"tailwind-variants": "^3.3.1",
|
|
3368
3368
|
"zod": "^4.6.7",
|
|
3369
|
-
"@krizaka/
|
|
3369
|
+
"@krizaka/intl": "^0.4.1",
|
|
3370
3370
|
"@krizaka/pacer": "^0.1.0",
|
|
3371
|
-
"@krizaka/
|
|
3371
|
+
"@krizaka/tokens": "^3.76.1"
|
|
3372
3372
|
},
|
|
3373
3373
|
"scripts": {
|
|
3374
3374
|
"build": "node -e \"const fs=require('node:fs');fs.rmSync('dist',{recursive:true,force:true});for(const f of fs.readdirSync('registry/examples',{recursive:true}))if(/\\.(js|d\\.ts)$/.test(f))fs.rmSync('registry/examples/'+f)\" && tsup && node -e \"require('node:fs').copyFileSync('src/motion.css','dist/motion.css');require('node:fs').copyFileSync('src/blocks.css','dist/blocks.css');require('node:fs').copyFileSync('src/story.css','dist/story.css')\" && node scripts/build-registry.mjs",
|