@krizaka/ui 4.4.0 → 4.4.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/account-menu.d.ts +1 -1
- package/dist/account-menu.js +1 -1
- package/dist/account-menu.js.map +1 -1
- package/dist/account-settings.d.ts +1 -1
- package/dist/account-settings.js +13 -6
- package/dist/account-settings.js.map +1 -1
- package/dist/agenda.d.ts +1 -1
- package/dist/agenda.js +2 -1
- package/dist/agenda.js.map +1 -1
- package/dist/analysis-report.js +19 -11
- package/dist/analysis-report.js.map +1 -1
- package/dist/app-frame.d.ts +1 -1
- package/dist/app-frame.js.map +1 -1
- package/dist/app-header/search.js +2 -2
- package/dist/app-header/search.js.map +1 -1
- package/dist/avatar/defaults.js +3 -1
- package/dist/avatar/defaults.js.map +1 -1
- package/dist/avatar.js +3 -1
- package/dist/avatar.js.map +1 -1
- package/dist/bird-plate.js +8 -2
- package/dist/bird-plate.js.map +1 -1
- package/dist/chapter.js +7 -4
- package/dist/chapter.js.map +1 -1
- package/dist/chat.js +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chip.js +1 -1
- package/dist/{chunk-SNSQLGGS.js → chunk-5VZ37TY3.js} +1 -1
- package/dist/{chunk-XWJDBQU7.js.map → chunk-5VZ37TY3.js.map} +1 -1
- package/dist/{chunk-MTVX4RRF.js → chunk-HP7BDMVK.js} +11 -3
- package/dist/chunk-HP7BDMVK.js.map +1 -0
- package/dist/{chunk-PK3L6WQT.js → chunk-LNAAWT4Y.js} +4 -2
- package/dist/{chunk-PK3L6WQT.js.map → chunk-LNAAWT4Y.js.map} +1 -1
- package/dist/{chunk-UIP3WX5O.js → chunk-MDSP7DJR.js} +2 -2
- package/dist/chunk-MDSP7DJR.js.map +1 -0
- package/dist/{chunk-IEGTRCDI.js → chunk-NQENOT6L.js} +2 -2
- package/dist/{chunk-IEGTRCDI.js.map → chunk-NQENOT6L.js.map} +1 -1
- package/dist/{chunk-FM42KOAU.js → chunk-P7AFIKWG.js} +5 -3
- package/dist/chunk-P7AFIKWG.js.map +1 -0
- package/dist/{chunk-BCD2CRFG.js → chunk-PJNR4NTS.js} +2 -2
- package/dist/chunk-PJNR4NTS.js.map +1 -0
- package/dist/{chunk-ZFR6ZNXD.js → chunk-PVQ2KKPZ.js} +1 -1
- package/dist/chunk-PVQ2KKPZ.js.map +1 -0
- package/dist/{chunk-U4XTZMB7.js → chunk-QA3WETWT.js} +1 -1
- package/dist/{chunk-U4XTZMB7.js.map → chunk-QA3WETWT.js.map} +1 -1
- package/dist/{chunk-YXETEQQJ.js → chunk-SG2RKUVJ.js} +2 -2
- package/dist/{chunk-EOWV6BNQ.js → chunk-TXFX4PMN.js} +4 -2
- package/dist/{chunk-EOWV6BNQ.js.map → chunk-TXFX4PMN.js.map} +1 -1
- package/dist/{chunk-XWJDBQU7.js → chunk-V5RO6JYI.js} +1 -1
- package/dist/{chunk-SNSQLGGS.js.map → chunk-V5RO6JYI.js.map} +1 -1
- package/dist/{chunk-VUD4IEVJ.js → chunk-VZ6ZALIJ.js} +1 -1
- package/dist/chunk-VZ6ZALIJ.js.map +1 -0
- package/dist/{chunk-2DHL7NJW.js → chunk-XVRKKYWU.js} +5 -3
- package/dist/{chunk-2DHL7NJW.js.map → chunk-XVRKKYWU.js.map} +1 -1
- package/dist/{chunk-CDNOT2KR.js → chunk-YTYNKMNS.js} +1 -1
- package/dist/chunk-YTYNKMNS.js.map +1 -0
- package/dist/code-block.js.map +1 -1
- package/dist/combobox.js +2 -2
- package/dist/copy-button.js +2 -2
- package/dist/copy-button.js.map +1 -1
- package/dist/data-table.js +3 -3
- package/dist/desktop-window.d.ts +1 -1
- package/dist/desktop-window.js +3 -1
- package/dist/desktop-window.js.map +1 -1
- package/dist/drop-overlay.js +8 -8
- package/dist/drop-overlay.js.map +1 -1
- package/dist/elephant.d.ts +1 -1
- package/dist/elephant.js.map +1 -1
- package/dist/embed-facade.d.ts +1 -1
- package/dist/embed-facade.js +3 -1
- package/dist/embed-facade.js.map +1 -1
- package/dist/engine-flow.js +7 -2
- package/dist/engine-flow.js.map +1 -1
- package/dist/entity-header.js +9 -3
- package/dist/entity-header.js.map +1 -1
- package/dist/file-upload.d.ts +1 -1
- package/dist/file-upload.js.map +1 -1
- package/dist/filter-bar.d.ts +4 -4
- package/dist/filter-bar.js +2 -2
- package/dist/flock.js +9 -6
- package/dist/flock.js.map +1 -1
- package/dist/form.d.ts +3 -3
- package/dist/form.js.map +1 -1
- package/dist/genui.js +3 -3
- package/dist/glossary-term.d.ts +1 -1
- package/dist/glossary-term.js.map +1 -1
- package/dist/glossary.d.ts +1 -1
- package/dist/glossary.js.map +1 -1
- package/dist/identity-card.js +1 -1
- package/dist/index.js +1 -1
- package/dist/kind-config-editor.d.ts +2 -2
- package/dist/kind-config-editor.js +1 -1
- package/dist/kind-config-editor.js.map +1 -1
- package/dist/kpi-explained.d.ts +1 -1
- package/dist/kpi-explained.js +4 -4
- package/dist/kpi-explained.js.map +1 -1
- package/dist/landing-page.js +1 -1
- package/dist/{lightbox-Q45BZ3HW.js → lightbox-MRB2YZEP.js} +1 -1
- package/dist/lightbox-MRB2YZEP.js.map +1 -0
- package/dist/map/cards.js +4 -2
- package/dist/map/cards.js.map +1 -1
- package/dist/map/pin.js +2 -1
- package/dist/map/pin.js.map +1 -1
- package/dist/map.d.ts +1 -1
- package/dist/map.js.map +1 -1
- package/dist/mascot-quote.js +1 -1
- package/dist/mascot-state.js +1 -1
- package/dist/mascots.js +1 -1
- package/dist/match-dialog.js +1 -1
- package/dist/motion.d.ts +1 -1
- package/dist/motion.js.map +1 -1
- package/dist/native/form.d.ts +3 -3
- package/dist/native/form.js.map +1 -1
- package/dist/native/markdown.d.ts +1 -1
- package/dist/native/markdown.js.map +1 -1
- package/dist/native/vertical-video.js.map +1 -1
- package/dist/native.d.ts +12 -12
- package/dist/native.js +12 -7
- package/dist/native.js.map +1 -1
- package/dist/nav-bar.d.ts +2 -2
- package/dist/nav-bar.js +1 -1
- package/dist/nav-bar.js.map +1 -1
- package/dist/next-actions.d.ts +1 -1
- package/dist/next-actions.js.map +1 -1
- package/dist/notification-preferences.d.ts +1 -1
- package/dist/notification-preferences.js +5 -2
- package/dist/notification-preferences.js.map +1 -1
- package/dist/page-index.js +2 -2
- package/dist/page-index.js.map +1 -1
- package/dist/product-page.js +1 -1
- package/dist/promo-code-field.d.ts +1 -1
- package/dist/promo-code-field.js.map +1 -1
- package/dist/qr-code.d.ts +1 -1
- package/dist/qr-code.js +1 -1
- package/dist/rail-nav.js +3 -3
- package/dist/rail-nav.js.map +1 -1
- package/dist/retro-tv.d.ts +1 -1
- package/dist/retro-tv.js.map +1 -1
- package/dist/reviews.d.ts +2 -2
- package/dist/reviews.js.map +1 -1
- package/dist/router.d.ts +1 -1
- package/dist/router.js +8 -8
- package/dist/router.js.map +1 -1
- package/dist/{schema-CL7t7xqb.d.ts → schema-Dd05m48Q.d.ts} +9 -9
- package/dist/service-card.js +22 -13
- package/dist/service-card.js.map +1 -1
- package/dist/settings-layout.js +1 -1
- package/dist/shop/booking.js.map +1 -1
- package/dist/shop/gallery.js +7 -6
- package/dist/shop/gallery.js.map +1 -1
- package/dist/shop/hero.js.map +1 -1
- package/dist/shop/look.d.ts +2 -2
- package/dist/shop/look.js +1 -1
- package/dist/shop/look.js.map +1 -1
- package/dist/shop/map-gate.d.ts +1 -1
- package/dist/shop/map-gate.js +2 -2
- package/dist/shop/map-gate.js.map +1 -1
- package/dist/shop/services.js.map +1 -1
- package/dist/shop-composer.d.ts +12 -12
- package/dist/shop-composer.js +27 -14
- package/dist/shop-composer.js.map +1 -1
- package/dist/shop-gallery.js +1 -1
- package/dist/shop.d.ts +2 -2
- package/dist/shop.js +2 -2
- package/dist/shop.js.map +1 -1
- package/dist/signature.js +2 -1
- package/dist/signature.js.map +1 -1
- package/dist/site-cahier.js +7 -3
- package/dist/site-cahier.js.map +1 -1
- package/dist/site-footer.js +6 -2
- package/dist/site-footer.js.map +1 -1
- package/dist/slot-picker.js +5 -2
- package/dist/slot-picker.js.map +1 -1
- package/dist/stat.js +1 -1
- package/dist/status-chip.d.ts +1 -1
- package/dist/status-chip.js.map +1 -1
- package/dist/tabs.js.map +1 -1
- package/dist/tag-input.js +2 -2
- package/dist/tag-selector.js +1 -1
- package/dist/text-style.js +4 -3
- package/dist/text-style.js.map +1 -1
- package/dist/usage.js +8 -3
- package/dist/usage.js.map +1 -1
- package/dist/versus-card.js +1 -1
- package/dist/versus-card.js.map +1 -1
- package/dist/vertical-video.js +1 -1
- package/dist/vertical-video.js.map +1 -1
- package/dist/wall.d.ts +4 -4
- package/dist/wall.js +1 -1
- package/dist/wall.js.map +1 -1
- package/package.json +5 -5
- package/registry/account-menu.json +1 -1
- package/registry/account-settings.json +2 -2
- package/registry/agenda.json +1 -1
- package/registry/analysis-report.json +2 -2
- package/registry/app-frame.json +3 -3
- package/registry/app-header.json +1 -1
- package/registry/avatar.json +1 -1
- package/registry/badge.json +2 -2
- package/registry/bird-plate.json +1 -1
- package/registry/chapter.json +1 -1
- package/registry/chip.json +1 -1
- package/registry/copy-button.json +1 -1
- package/registry/data-table.json +1 -1
- package/registry/desktop-window.json +1 -1
- package/registry/drop-overlay.json +1 -1
- package/registry/elephant.json +1 -1
- package/registry/embed-facade.json +2 -2
- package/registry/engine-flow.json +2 -2
- package/registry/entity-header.json +1 -1
- package/registry/file-upload.json +1 -1
- package/registry/filter-bar.json +1 -1
- package/registry/flock.json +2 -2
- package/registry/form.json +7 -7
- package/registry/glossary-term.json +1 -1
- package/registry/glossary.json +1 -1
- package/registry/index.json +7 -7
- package/registry/kind-config-editor.json +1 -1
- package/registry/kpi-explained.json +1 -1
- package/registry/map.json +4 -4
- package/registry/mascot-state.json +1 -1
- package/registry/mascots.json +2 -2
- package/registry/nav-bar.json +4 -4
- package/registry/next-actions.json +1 -1
- package/registry/notification-preferences.json +1 -1
- package/registry/page-index.json +1 -1
- package/registry/page.json +1 -1
- package/registry/promo-code-field.json +1 -1
- package/registry/qr-code.json +2 -2
- package/registry/rail-nav.json +3 -3
- package/registry/retro-tv.json +1 -1
- package/registry/reviews.json +1 -1
- package/registry/router.json +1 -1
- package/registry/service-card.json +1 -1
- package/registry/settings-layout.json +1 -1
- package/registry/shop-composer.json +7 -7
- package/registry/shop-gallery.json +1 -1
- package/registry/shop.json +11 -11
- package/registry/signature.json +1 -1
- package/registry/site-cahier.json +1 -1
- package/registry/site-footer.json +3 -3
- package/registry/slot-picker.json +1 -1
- package/registry/stat.json +1 -1
- package/registry/status-chip.json +1 -1
- package/registry/tabs.json +1 -1
- package/registry/text-style.json +1 -1
- package/registry/usage.json +2 -2
- package/registry/versus-card.json +1 -1
- package/registry/vertical-video.json +1 -1
- package/registry/wall.json +5 -5
- package/registry/waveform.json +2 -2
- package/dist/chunk-BCD2CRFG.js.map +0 -1
- package/dist/chunk-CDNOT2KR.js.map +0 -1
- package/dist/chunk-FM42KOAU.js.map +0 -1
- package/dist/chunk-MTVX4RRF.js.map +0 -1
- package/dist/chunk-UIP3WX5O.js.map +0 -1
- package/dist/chunk-VUD4IEVJ.js.map +0 -1
- package/dist/chunk-ZFR6ZNXD.js.map +0 -1
- package/dist/lightbox-Q45BZ3HW.js.map +0 -1
- /package/dist/{chunk-YXETEQQJ.js.map → chunk-SG2RKUVJ.js.map} +0 -0
package/dist/shop-gallery.js
CHANGED
|
@@ -28,7 +28,7 @@ var shopGalleryLabelsFr = {
|
|
|
28
28
|
// src/shop-gallery/shop-gallery.tsx
|
|
29
29
|
import * as React from "react";
|
|
30
30
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
31
|
-
var Lightbox = React.lazy(() => import("./lightbox-
|
|
31
|
+
var Lightbox = React.lazy(() => import("./lightbox-MRB2YZEP.js"));
|
|
32
32
|
var BENTO = 5;
|
|
33
33
|
var styles = `
|
|
34
34
|
.kz-sg{position:relative}
|
package/dist/shop.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as ShopPage } from './schema-
|
|
2
|
-
export { L as LocalizedText, P as ParsedSection, b as SECTION_DEFINITIONS, c as SECTION_TYPES, d as SHOP_SCHEMA_VERSION, a as Section, e as SectionDefinition, f as SectionOf, g as SectionSpec, h as SectionType, i as ShopPageIssue, j as ShopPageResult, k as defineSection, p as parseShopPage, s as sectionDefinition, l as shopPageSchema } from './schema-
|
|
1
|
+
import { S as ShopPage } from './schema-Dd05m48Q.js';
|
|
2
|
+
export { L as LocalizedText, P as ParsedSection, b as SECTION_DEFINITIONS, c as SECTION_TYPES, d as SHOP_SCHEMA_VERSION, a as Section, e as SectionDefinition, f as SectionOf, g as SectionSpec, h as SectionType, i as ShopPageIssue, j as ShopPageResult, k as defineSection, p as parseShopPage, s as sectionDefinition, l as shopPageSchema } from './schema-Dd05m48Q.js';
|
|
3
3
|
export { b as ShopFrame, c as ShopFrameProps, a as ShopPhoto, d as ShopSection, S as ShopSectionProps } from './frame-CmDztC_y.js';
|
|
4
4
|
import 'zod/mini';
|
|
5
5
|
import 'react';
|
package/dist/shop.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
SECTION_TYPES,
|
|
4
4
|
defineSection,
|
|
5
5
|
sectionDefinition
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PVQ2KKPZ.js";
|
|
7
7
|
import {
|
|
8
8
|
SHOP_LIMITS
|
|
9
9
|
} from "./chunk-ZYHWJ7U5.js";
|
|
@@ -75,7 +75,7 @@ var KEY = /^[A-Za-z0-9_-]{1,40}$/;
|
|
|
75
75
|
function readPreviewMessage(event, origin) {
|
|
76
76
|
if (event.origin !== origin) return null;
|
|
77
77
|
const d = event.data;
|
|
78
|
-
if (typeof d !== "object" || d
|
|
78
|
+
if (typeof d !== "object" || d?.source !== SOURCE) return null;
|
|
79
79
|
if (d.type === "refresh") return { source: SOURCE, type: "refresh" };
|
|
80
80
|
if ((d.type === "select" || d.type === "scroll") && typeof d.key === "string" && KEY.test(d.key)) return { source: SOURCE, type: d.type, key: d.key };
|
|
81
81
|
return null;
|
package/dist/shop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shop/schema.ts","../src/shop/migrate.ts","../src/shop/preview.ts","../src/shop/starters.ts"],"sourcesContent":["// The document a shop page is (ADR-007 §1): an ordered list of sections, each a `type` × `variant` with its settings and\n// its blocks. Parsed on write (a route refuses an invalid one, with the path) and on read. The storage is the product's.\nimport * as z from \"zod/mini\";\n\nimport { SECTION_DEFINITIONS, type SectionType } from \"./catalogue\";\nimport { SHOP_LIMITS } from \"./limits\";\n\n/** The version of the document's format; migrations are pure functions schema n → n + 1 (`migrate.ts`). */\n// @fixed: ADR-007 §1 — the format version of the code, bumped with a migration; not a shop setting.\nexport const SHOP_SCHEMA_VERSION = 1;\n\n/** A look preset by id and version (`@krizaka/tokens`): `salon-atelier`. The mode is the visitor's, never stored. */\nexport const presetRef = z.object({\n id: z.string().check(z.regex(/^[a-z]+-[a-z]+$/, \"a preset id (trade-name)\")),\n version: z.int().check(z.minimum(1)),\n});\n\nconst sectionUnion = z.discriminatedUnion(\n \"type\",\n SECTION_DEFINITIONS.map((d) => d.schema) as unknown as [z.ZodMiniObject, ...z.ZodMiniObject[]],\n);\n\nexport const shopPageSchema = z\n .object({\n schema: z.literal(SHOP_SCHEMA_VERSION),\n preset: presetRef,\n /** Overrides the preset's density. */\n density: z.optional(z.enum([\"compact\", \"airy\"])),\n /** One of the accents the look lists as tested (`krizaka`, `folioviv:accent-2`…): the owner's choice within the look. */\n accent: z.optional(z.string().check(z.regex(/^[a-z]+(:accent-2)?$/, \"an accent of the look\"))),\n sections: z.array(sectionUnion).check(z.minLength(1), z.maxLength(SHOP_LIMITS.sections)),\n })\n .check(\n z.superRefine((page, ctx) => {\n const add = (path: (string | number)[], message: string) => ctx.issues.push({ code: \"custom\", message, path, input: page });\n const seen = new Set<string>();\n page.sections.forEach((section, i) => {\n const s = section as { key: string; type: string };\n if (seen.has(s.key)) add([\"sections\", i, \"key\"], `the key \"${s.key}\" is used twice`);\n seen.add(s.key);\n if (s.type === \"hero\" && i !== 0) add([\"sections\", i, \"type\"], \"the hero is the first section, and there is only one\");\n });\n }),\n );\n\n/** A section of any type, as parsed: its `settings` and `blocks` are the type's own. */\nexport type Section = z.output<(typeof SECTION_DEFINITIONS)[number][\"schema\"]>;\nexport type ShopPage = {\n schema: typeof SHOP_SCHEMA_VERSION;\n preset: z.output<typeof presetRef>;\n density?: \"compact\" | \"airy\" | undefined;\n accent?: string | undefined;\n sections: Section[];\n};\nexport type SectionOf<T extends SectionType> = Extract<Section, { type: T }>;\n\nexport type ShopPageIssue = { path: string; message: string };\nexport type ShopPageResult = { ok: true; page: ShopPage } | { ok: false; issues: ShopPageIssue[] };\n\n/** Validates a document; an invalid one answers every issue with its path (`sections.2.variant`), for a 422. */\nexport function parseShopPage(input: unknown): ShopPageResult {\n const result = shopPageSchema.safeParse(input);\n if (result.success) return { ok: true, page: result.data as unknown as ShopPage };\n return { ok: false, issues: result.error.issues.map((i) => ({ path: i.path.join(\".\"), message: i.message })) };\n}\n","// Migrations of the document (ADR-007 §1): pure functions schema n → n + 1, applied in memory when an older document is\n// read; the product writes the migrated one back on the next save. A newer document than this code knows is refused.\nimport { SHOP_SCHEMA_VERSION } from \"./schema\";\n\nexport type ShopMigration = {\n /** The schema it reads. */\n from: number;\n /** Pure: returns a new document, never mutates. */\n up: (doc: Record<string, unknown>) => Record<string, unknown>;\n};\n\n/** The migrations of the document, oldest first. Schema 1 is the first format: none yet. */\nexport const SHOP_MIGRATIONS: readonly ShopMigration[] = [];\n\nexport type MigrationResult = { ok: true; doc: Record<string, unknown>; from: number } | { ok: false; reason: string };\n\n/** A migrator over a list of migrations and a current version (the shop's own are `migrateShopPage`). */\nexport function createMigrator(migrations: readonly ShopMigration[], current: number) {\n return (input: unknown): MigrationResult => {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return { ok: false, reason: \"a document is an object\" };\n let doc = input as Record<string, unknown>;\n const from = doc.schema;\n if (typeof from !== \"number\" || !Number.isInteger(from) || from < 1) return { ok: false, reason: \"the document has no schema version\" };\n if (from > current) return { ok: false, reason: `schema ${from} is newer than this code knows (${current})` };\n for (let n = from; n < current; n++) {\n const step = migrations.find((m) => m.from === n);\n if (!step) return { ok: false, reason: `no migration from schema ${n}` };\n doc = { ...step.up(doc), schema: n + 1 };\n }\n return { ok: true, doc, from };\n };\n}\n\n/** Brings a stored document to the current schema (then `parseShopPage` it). */\nexport const migrateShopPage = createMigrator(SHOP_MIGRATIONS, SHOP_SCHEMA_VERSION);\n","// The preview bridge (ADR-007 §5): the composer shows the product's real public page in an iframe of its own route\n// (`?draft=<id>`) and talks to it by `postMessage` — three messages only, every one origin-checked on both sides: `select` (outline\n// a section), `scroll` (bring it into view), `refresh` (the draft changed: reload the data). Nothing else crosses: no document, no\n// script, no style. Both halves are here, tiny and free of React, because the page side must not import the composer.\n\n/** The only messages: the composer to the page. */\nexport type PreviewMessage = { source: \"krizaka-shop-composer\"; type: \"select\" | \"scroll\"; key: string } | { source: \"krizaka-shop-composer\"; type: \"refresh\" };\n\nconst SOURCE = \"krizaka-shop-composer\";\nconst KEY = /^[A-Za-z0-9_-]{1,40}$/;\n\n/** Reads a message event: only if it comes from `origin`, is one of the three messages and carries a well-formed key. */\nexport function readPreviewMessage(event: Pick<MessageEvent, \"origin\" | \"data\">, origin: string): PreviewMessage | null {\n if (event.origin !== origin) return null;\n const d = event.data as Record<string, unknown> | null;\n if (typeof d !== \"object\" || d === null || d.source !== SOURCE) return null;\n if (d.type === \"refresh\") return { source: SOURCE, type: \"refresh\" };\n if ((d.type === \"select\" || d.type === \"scroll\") && typeof d.key === \"string\" && KEY.test(d.key)) return { source: SOURCE, type: d.type, key: d.key };\n return null;\n}\n\n/** The composer's side: posts to the preview's window, addressed to its origin only. */\nexport function postToPreview(target: Pick<Window, \"postMessage\"> | null | undefined, origin: string, message: PreviewMessage): void {\n target?.postMessage(message, origin);\n}\n\n/** The attribute that names a section in the preview page: `<div data-shop-key=\"s_8f2c\">` (a block: the outline is its ring). */\nexport const SHOP_KEY_ATTRIBUTE = \"data-shop-key\";\n\n/**\n * The page's side: outlines the selected section (`data-shop-selected`, drawn by `blocks.css`), scrolls it into view, and calls\n * `onRefresh` when the draft changed. Returns the function that removes it. Only runs in an iframe of the composer's origin.\n */\nexport function connectShopPreview({ composerOrigin, onRefresh, root = document }: { composerOrigin: string; onRefresh?: () => void; root?: Document }): () => void {\n const find = (key: string) => root.querySelector<HTMLElement>(`[${SHOP_KEY_ATTRIBUTE}=\"${key}\"]`);\n const handler = (event: MessageEvent) => {\n // The origin first, before anything else is read from the message.\n if (event.origin !== composerOrigin) return;\n const m = readPreviewMessage(event, composerOrigin);\n if (!m) return;\n if (m.type === \"refresh\") {\n onRefresh?.();\n return;\n }\n for (const selected of root.querySelectorAll<HTMLElement>(\"[data-shop-selected]\")) delete selected.dataset.shopSelected;\n const el = find(m.key);\n if (!el) return;\n el.dataset.shopSelected = \"\";\n if (m.type === \"scroll\") {\n const reduced = typeof matchMedia === \"function\" && matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n el.scrollIntoView({ block: \"center\", behavior: reduced ? \"auto\" : \"smooth\" });\n }\n };\n window.addEventListener(\"message\", handler);\n return () => window.removeEventListener(\"message\", handler);\n}\n","// The starter documents (ADR-007 §4, §8): the five compositions of the ADR as data — a section list and a preset. A\n// product's template becomes one of these; the composer's « Start from » lists them. They hold no price, no text of a\n// shop and no photo: references and rules only.\nimport type { SectionOf, ShopPage } from \"./schema\";\n\nconst s = (key: string) => key;\nconst doc = (preset: string, density: \"compact\" | \"airy\", sections: ShopPage[\"sections\"]): ShopPage => ({\n schema: 1,\n preset: { id: preset, version: 1 },\n density,\n sections,\n});\nconst hero = (variant: \"poster\" | \"split\" | \"banner\" | \"tv\"): SectionOf<\"hero\"> => ({\n key: s(\"s_hero\"),\n type: \"hero\",\n variant,\n settings: { focus: \"center\" },\n blocks: [\n { key: \"b_open\", type: \"fact\", settings: { kind: \"open-now\" } },\n { key: \"b_area\", type: \"fact\", settings: { kind: \"area\" } },\n { key: \"b_score\", type: \"fact\", settings: { kind: \"score\" } },\n ],\n});\nconst menu = (columns: 1 | 2, aside: \"hours\" | \"none\"): SectionOf<\"services\"> => ({\n key: s(\"s_services\"),\n type: \"services\",\n variant: \"menu\",\n settings: { source: \"all\", groupBy: \"category\", columns, aside },\n});\nconst booking = (variant: \"strip\" | \"panel\" | \"sticky\", key: string): SectionOf<\"booking\"> => ({ key, type: \"booking\", variant, settings: { count: 4 } });\nconst gallery = (variant: \"mosaic\" | \"filmstrip\" | \"wall\" | \"grid\", key: string, extra: Partial<Pick<SectionOf<\"gallery\">, \"settings\" | \"blocks\">> = {}): SectionOf<\"gallery\"> => ({\n key,\n type: \"gallery\",\n variant,\n settings: { source: \"all\", texture: \"plaster\" },\n ...extra,\n});\n\n/** The salon, compact: the poster, the next free times, the price board beside the hours, a filmstrip, the reviews. */\nexport const salonCompact = doc(\"salon-vitrine\", \"compact\", [\n hero(\"poster\"),\n booking(\"strip\", \"s_times\"),\n menu(1, \"hours\"),\n gallery(\"filmstrip\", \"s_photos\"),\n { key: \"s_reviews\", type: \"reviews\", variant: \"summary-cards\", settings: { rule: \"best\", count: 2 } },\n booking(\"panel\", \"s_book\"),\n]);\n\n/** The salon, editorial: a split hero, the quote, the two-column menu, the mosaic, the visit. */\nexport const salonEditorial = doc(\"salon-atelier\", \"airy\", [\n hero(\"split\"),\n { key: \"s_story\", type: \"story\", variant: \"quote\", settings: { body: {} } },\n menu(2, \"none\"),\n gallery(\"mosaic\", \"s_photos\"),\n { key: \"s_visit\", type: \"visit\", variant: \"split\", settings: { showPhone: true } },\n booking(\"panel\", \"s_book\"),\n]);\n\n/** The salon, gallery first: the sign and the old TV, the mosaic, the menu, the wall. */\nexport const salonGallery = doc(\"salon-atelier\", \"compact\", [\n hero(\"tv\"),\n gallery(\"mosaic\", \"s_photos\"),\n menu(1, \"hours\"),\n gallery(\"wall\", \"s_wall\", { blocks: [{ key: \"b_note\", type: \"note\", settings: { text: \"Merci Jade !\", signature: \"Nadia\" } }] }),\n booking(\"sticky\", \"s_sticky\"),\n]);\n\n/** The dog walker, route: the poster, the areas, the menu, the next free times, a filmstrip. */\nexport const petsRoute = doc(\"pets-canal\", \"compact\", [\n hero(\"poster\"),\n { key: \"s_visit\", type: \"visit\", variant: \"map\", settings: { showPhone: false } },\n menu(1, \"none\"),\n booking(\"strip\", \"s_times\"),\n gallery(\"filmstrip\", \"s_photos\"),\n]);\n\n/** The dog walker, journal: a hero on paper, the notebook wall, the menu, the TV with notes. */\nexport const petsJournal = doc(\"pets-carnet\", \"airy\", [\n hero(\"split\"),\n gallery(\"wall\", \"s_wall\", { settings: { source: \"all\", texture: \"ridge\" } }),\n menu(1, \"none\"),\n { key: \"s_tv\", type: \"video\", variant: \"tv\", settings: { cabinet: \"portable\" } },\n booking(\"panel\", \"s_book\"),\n]);\n\nexport const shopStarters = { salonCompact, salonEditorial, salonGallery, petsRoute, petsJournal } as const;\nexport type ShopStarterId = keyof typeof shopStarters;\n"],"mappings":";;;;;;;;;;;;;;;;AAEA,YAAY,OAAO;AAOZ,IAAM,sBAAsB;AAG5B,IAAM,YAAc,SAAO;AAAA,EAChC,IAAM,SAAO,EAAE,MAAQ,QAAM,mBAAmB,0BAA0B,CAAC;AAAA,EAC3E,SAAW,MAAI,EAAE,MAAQ,UAAQ,CAAC,CAAC;AACrC,CAAC;AAED,IAAM,eAAiB;AAAA,EACrB;AAAA,EACA,oBAAoB,IAAI,CAAC,MAAM,EAAE,MAAM;AACzC;AAEO,IAAM,iBACV,SAAO;AAAA,EACN,QAAU,UAAQ,mBAAmB;AAAA,EACrC,QAAQ;AAAA;AAAA,EAER,SAAW,WAAW,OAAK,CAAC,WAAW,MAAM,CAAC,CAAC;AAAA;AAAA,EAE/C,QAAU,WAAW,SAAO,EAAE,MAAQ,QAAM,wBAAwB,uBAAuB,CAAC,CAAC;AAAA,EAC7F,UAAY,QA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,UAAU;AAC9B,CAAC;AAGM,IAAM,YAAY,IAAI,cAAc,WAAW;AAAA,EACpD,KAAK,QAAQ;AAAA,EACb,EAAE,KAAK,WAAW,MAAM,SAAS,SAAS,OAAO,UAAU,EAAE,WAAW,MAAM,EAAE;AAAA,EAChF,KAAK,GAAG,MAAM;AAAA,EACd,QAAQ,SAAS,SAAS;AAAA,EAC1B,QAAQ,aAAa,UAAU;AACjC,CAAC;AAGM,IAAM,cAAc,IAAI,eAAe,QAAQ;AAAA,EACpD,KAAK,OAAO;AAAA,EACZ,QAAQ,QAAQ,UAAU,EAAE,UAAU,EAAE,QAAQ,OAAO,SAAS,QAAQ,EAAE,CAAC;AAAA,EAC3E,KAAK,GAAG,MAAM;AAAA,EACd,EAAE,KAAK,QAAQ,MAAM,SAAS,SAAS,MAAM,UAAU,EAAE,SAAS,WAAW,EAAE;AAAA,EAC/E,QAAQ,SAAS,QAAQ;AAC3B,CAAC;AAEM,IAAM,eAAe,EAAE,cAAc,gBAAgB,cAAc,WAAW,YAAY;","names":["s","doc"]}
|
|
1
|
+
{"version":3,"sources":["../src/shop/schema.ts","../src/shop/migrate.ts","../src/shop/preview.ts","../src/shop/starters.ts"],"sourcesContent":["// The document a shop page is (ADR-007 §1): an ordered list of sections, each a `type` × `variant` with its settings and\n// its blocks. Parsed on write (a route refuses an invalid one, with the path) and on read. The storage is the product's.\nimport * as z from \"zod/mini\";\n\nimport { SECTION_DEFINITIONS, type SectionType } from \"./catalogue\";\nimport { SHOP_LIMITS } from \"./limits\";\n\n/** The version of the document's format; migrations are pure functions schema n → n + 1 (`migrate.ts`). */\n// @fixed: ADR-007 §1 — the format version of the code, bumped with a migration; not a shop setting.\nexport const SHOP_SCHEMA_VERSION = 1;\n\n/** A look preset by id and version (`@krizaka/tokens`): `salon-atelier`. The mode is the visitor's, never stored. */\nexport const presetRef = z.object({\n id: z.string().check(z.regex(/^[a-z]+-[a-z]+$/, \"a preset id (trade-name)\")),\n version: z.int().check(z.minimum(1)),\n});\n\nconst sectionUnion = z.discriminatedUnion(\n \"type\",\n SECTION_DEFINITIONS.map((d) => d.schema) as unknown as [z.ZodMiniObject, ...z.ZodMiniObject[]],\n);\n\nexport const shopPageSchema = z\n .object({\n schema: z.literal(SHOP_SCHEMA_VERSION),\n preset: presetRef,\n /** Overrides the preset's density. */\n density: z.optional(z.enum([\"compact\", \"airy\"])),\n /** One of the accents the look lists as tested (`krizaka`, `folioviv:accent-2`…): the owner's choice within the look. */\n accent: z.optional(z.string().check(z.regex(/^[a-z]+(:accent-2)?$/, \"an accent of the look\"))),\n sections: z.array(sectionUnion).check(z.minLength(1), z.maxLength(SHOP_LIMITS.sections)),\n })\n .check(\n z.superRefine((page, ctx) => {\n const add = (path: (string | number)[], message: string) => ctx.issues.push({ code: \"custom\", message, path, input: page });\n const seen = new Set<string>();\n page.sections.forEach((section, i) => {\n const s = section as { key: string; type: string };\n if (seen.has(s.key)) add([\"sections\", i, \"key\"], `the key \"${s.key}\" is used twice`);\n seen.add(s.key);\n if (s.type === \"hero\" && i !== 0) add([\"sections\", i, \"type\"], \"the hero is the first section, and there is only one\");\n });\n }),\n );\n\n/** A section of any type, as parsed: its `settings` and `blocks` are the type's own. */\nexport type Section = z.output<(typeof SECTION_DEFINITIONS)[number][\"schema\"]>;\nexport type ShopPage = {\n schema: typeof SHOP_SCHEMA_VERSION;\n preset: z.output<typeof presetRef>;\n density?: \"compact\" | \"airy\";\n accent?: string;\n sections: Section[];\n};\nexport type SectionOf<T extends SectionType> = Extract<Section, { type: T }>;\n\nexport type ShopPageIssue = { path: string; message: string };\nexport type ShopPageResult = { ok: true; page: ShopPage } | { ok: false; issues: ShopPageIssue[] };\n\n/** Validates a document; an invalid one answers every issue with its path (`sections.2.variant`), for a 422. */\nexport function parseShopPage(input: unknown): ShopPageResult {\n const result = shopPageSchema.safeParse(input);\n if (result.success) return { ok: true, page: result.data as unknown as ShopPage };\n return { ok: false, issues: result.error.issues.map((i) => ({ path: i.path.join(\".\"), message: i.message })) };\n}\n","// Migrations of the document (ADR-007 §1): pure functions schema n → n + 1, applied in memory when an older document is\n// read; the product writes the migrated one back on the next save. A newer document than this code knows is refused.\nimport { SHOP_SCHEMA_VERSION } from \"./schema\";\n\nexport type ShopMigration = {\n /** The schema it reads. */\n from: number;\n /** Pure: returns a new document, never mutates. */\n up: (doc: Record<string, unknown>) => Record<string, unknown>;\n};\n\n/** The migrations of the document, oldest first. Schema 1 is the first format: none yet. */\nexport const SHOP_MIGRATIONS: readonly ShopMigration[] = [];\n\nexport type MigrationResult = { ok: true; doc: Record<string, unknown>; from: number } | { ok: false; reason: string };\n\n/** A migrator over a list of migrations and a current version (the shop's own are `migrateShopPage`). */\nexport function createMigrator(migrations: readonly ShopMigration[], current: number) {\n return (input: unknown): MigrationResult => {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return { ok: false, reason: \"a document is an object\" };\n let doc = input as Record<string, unknown>;\n const from = doc.schema;\n if (typeof from !== \"number\" || !Number.isInteger(from) || from < 1) return { ok: false, reason: \"the document has no schema version\" };\n if (from > current) return { ok: false, reason: `schema ${from} is newer than this code knows (${current})` };\n for (let n = from; n < current; n++) {\n const step = migrations.find((m) => m.from === n);\n if (!step) return { ok: false, reason: `no migration from schema ${n}` };\n doc = { ...step.up(doc), schema: n + 1 };\n }\n return { ok: true, doc, from };\n };\n}\n\n/** Brings a stored document to the current schema (then `parseShopPage` it). */\nexport const migrateShopPage = createMigrator(SHOP_MIGRATIONS, SHOP_SCHEMA_VERSION);\n","// The preview bridge (ADR-007 §5): the composer shows the product's real public page in an iframe of its own route\n// (`?draft=<id>`) and talks to it by `postMessage` — three messages only, every one origin-checked on both sides: `select` (outline\n// a section), `scroll` (bring it into view), `refresh` (the draft changed: reload the data). Nothing else crosses: no document, no\n// script, no style. Both halves are here, tiny and free of React, because the page side must not import the composer.\n\n/** The only messages: the composer to the page. */\nexport type PreviewMessage = { source: \"krizaka-shop-composer\"; type: \"select\" | \"scroll\"; key: string } | { source: \"krizaka-shop-composer\"; type: \"refresh\" };\n\nconst SOURCE = \"krizaka-shop-composer\";\nconst KEY = /^[A-Za-z0-9_-]{1,40}$/;\n\n/** Reads a message event: only if it comes from `origin`, is one of the three messages and carries a well-formed key. */\nexport function readPreviewMessage(event: Pick<MessageEvent, \"origin\" | \"data\">, origin: string): PreviewMessage | null {\n if (event.origin !== origin) return null;\n const d = event.data as Record<string, unknown> | null;\n if (typeof d !== \"object\" || d?.source !== SOURCE) return null;\n if (d.type === \"refresh\") return { source: SOURCE, type: \"refresh\" };\n if ((d.type === \"select\" || d.type === \"scroll\") && typeof d.key === \"string\" && KEY.test(d.key)) return { source: SOURCE, type: d.type, key: d.key };\n return null;\n}\n\n/** The composer's side: posts to the preview's window, addressed to its origin only. */\nexport function postToPreview(target: Pick<Window, \"postMessage\"> | null | undefined, origin: string, message: PreviewMessage): void {\n target?.postMessage(message, origin);\n}\n\n/** The attribute that names a section in the preview page: `<div data-shop-key=\"s_8f2c\">` (a block: the outline is its ring). */\nexport const SHOP_KEY_ATTRIBUTE = \"data-shop-key\";\n\n/**\n * The page's side: outlines the selected section (`data-shop-selected`, drawn by `blocks.css`), scrolls it into view, and calls\n * `onRefresh` when the draft changed. Returns the function that removes it. Only runs in an iframe of the composer's origin.\n */\nexport function connectShopPreview({ composerOrigin, onRefresh, root = document }: { composerOrigin: string; onRefresh?: () => void; root?: Document }): () => void {\n const find = (key: string) => root.querySelector<HTMLElement>(`[${SHOP_KEY_ATTRIBUTE}=\"${key}\"]`);\n const handler = (event: MessageEvent) => {\n // The origin first, before anything else is read from the message.\n if (event.origin !== composerOrigin) return;\n const m = readPreviewMessage(event, composerOrigin);\n if (!m) return;\n if (m.type === \"refresh\") {\n onRefresh?.();\n return;\n }\n for (const selected of root.querySelectorAll<HTMLElement>(\"[data-shop-selected]\")) delete selected.dataset.shopSelected;\n const el = find(m.key);\n if (!el) return;\n el.dataset.shopSelected = \"\";\n if (m.type === \"scroll\") {\n const reduced = typeof matchMedia === \"function\" && matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n el.scrollIntoView({ block: \"center\", behavior: reduced ? \"auto\" : \"smooth\" });\n }\n };\n window.addEventListener(\"message\", handler);\n return () => window.removeEventListener(\"message\", handler);\n}\n","// The starter documents (ADR-007 §4, §8): the five compositions of the ADR as data — a section list and a preset. A\n// product's template becomes one of these; the composer's « Start from » lists them. They hold no price, no text of a\n// shop and no photo: references and rules only.\nimport type { SectionOf, ShopPage } from \"./schema\";\n\nconst s = (key: string) => key;\nconst doc = (preset: string, density: \"compact\" | \"airy\", sections: ShopPage[\"sections\"]): ShopPage => ({\n schema: 1,\n preset: { id: preset, version: 1 },\n density,\n sections,\n});\nconst hero = (variant: \"poster\" | \"split\" | \"banner\" | \"tv\"): SectionOf<\"hero\"> => ({\n key: s(\"s_hero\"),\n type: \"hero\",\n variant,\n settings: { focus: \"center\" },\n blocks: [\n { key: \"b_open\", type: \"fact\", settings: { kind: \"open-now\" } },\n { key: \"b_area\", type: \"fact\", settings: { kind: \"area\" } },\n { key: \"b_score\", type: \"fact\", settings: { kind: \"score\" } },\n ],\n});\nconst menu = (columns: 1 | 2, aside: \"hours\" | \"none\"): SectionOf<\"services\"> => ({\n key: s(\"s_services\"),\n type: \"services\",\n variant: \"menu\",\n settings: { source: \"all\", groupBy: \"category\", columns, aside },\n});\nconst booking = (variant: \"strip\" | \"panel\" | \"sticky\", key: string): SectionOf<\"booking\"> => ({ key, type: \"booking\", variant, settings: { count: 4 } });\nconst gallery = (variant: \"mosaic\" | \"filmstrip\" | \"wall\" | \"grid\", key: string, extra: Partial<Pick<SectionOf<\"gallery\">, \"settings\" | \"blocks\">> = {}): SectionOf<\"gallery\"> => ({\n key,\n type: \"gallery\",\n variant,\n settings: { source: \"all\", texture: \"plaster\" },\n ...extra,\n});\n\n/** The salon, compact: the poster, the next free times, the price board beside the hours, a filmstrip, the reviews. */\nexport const salonCompact = doc(\"salon-vitrine\", \"compact\", [\n hero(\"poster\"),\n booking(\"strip\", \"s_times\"),\n menu(1, \"hours\"),\n gallery(\"filmstrip\", \"s_photos\"),\n { key: \"s_reviews\", type: \"reviews\", variant: \"summary-cards\", settings: { rule: \"best\", count: 2 } },\n booking(\"panel\", \"s_book\"),\n]);\n\n/** The salon, editorial: a split hero, the quote, the two-column menu, the mosaic, the visit. */\nexport const salonEditorial = doc(\"salon-atelier\", \"airy\", [\n hero(\"split\"),\n { key: \"s_story\", type: \"story\", variant: \"quote\", settings: { body: {} } },\n menu(2, \"none\"),\n gallery(\"mosaic\", \"s_photos\"),\n { key: \"s_visit\", type: \"visit\", variant: \"split\", settings: { showPhone: true } },\n booking(\"panel\", \"s_book\"),\n]);\n\n/** The salon, gallery first: the sign and the old TV, the mosaic, the menu, the wall. */\nexport const salonGallery = doc(\"salon-atelier\", \"compact\", [\n hero(\"tv\"),\n gallery(\"mosaic\", \"s_photos\"),\n menu(1, \"hours\"),\n gallery(\"wall\", \"s_wall\", { blocks: [{ key: \"b_note\", type: \"note\", settings: { text: \"Merci Jade !\", signature: \"Nadia\" } }] }),\n booking(\"sticky\", \"s_sticky\"),\n]);\n\n/** The dog walker, route: the poster, the areas, the menu, the next free times, a filmstrip. */\nexport const petsRoute = doc(\"pets-canal\", \"compact\", [\n hero(\"poster\"),\n { key: \"s_visit\", type: \"visit\", variant: \"map\", settings: { showPhone: false } },\n menu(1, \"none\"),\n booking(\"strip\", \"s_times\"),\n gallery(\"filmstrip\", \"s_photos\"),\n]);\n\n/** The dog walker, journal: a hero on paper, the notebook wall, the menu, the TV with notes. */\nexport const petsJournal = doc(\"pets-carnet\", \"airy\", [\n hero(\"split\"),\n gallery(\"wall\", \"s_wall\", { settings: { source: \"all\", texture: \"ridge\" } }),\n menu(1, \"none\"),\n { key: \"s_tv\", type: \"video\", variant: \"tv\", settings: { cabinet: \"portable\" } },\n booking(\"panel\", \"s_book\"),\n]);\n\nexport const shopStarters = { salonCompact, salonEditorial, salonGallery, petsRoute, petsJournal } as const;\nexport type ShopStarterId = keyof typeof shop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|
@@ -14,13 +14,14 @@ function Signature({ variant = "both", name = "Krizaka \xB7 Montr\xE9al", date,
|
|
|
14
14
|
const filter = `kz-ink-${React.useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
15
15
|
const stamp = variant !== "script";
|
|
16
16
|
const script = variant !== "stamp";
|
|
17
|
+
const stampAria = script ? { "aria-hidden": true } : { role: "img", "aria-label": name };
|
|
17
18
|
return /* @__PURE__ */ jsxs("div", { className: cn("kz-signature", className), "data-variant": variant, style: { ...style, filter: `url(#${filter})` }, ...props, children: [
|
|
18
19
|
/* @__PURE__ */ jsx("svg", { width: "0", height: "0", "aria-hidden": true, focusable: "false", className: "kz-signature-defs", children: /* @__PURE__ */ jsxs("filter", { id: filter, x: "0", y: "0", width: "100%", height: "100%", children: [
|
|
19
20
|
/* @__PURE__ */ jsx("feTurbulence", { type: "fractalNoise", baseFrequency: "0.85", numOctaves: "2", seed: "7", result: "grain" }),
|
|
20
21
|
/* @__PURE__ */ jsx("feColorMatrix", { in: "grain", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.4 1.45", result: "speckle" }),
|
|
21
22
|
/* @__PURE__ */ jsx("feComposite", { in: "SourceGraphic", in2: "speckle", operator: "in" })
|
|
22
23
|
] }) }),
|
|
23
|
-
stamp ? /* @__PURE__ */ jsxs("svg", { className: "kz-signature-stamp", viewBox: "62 62 236 236", fill: "none", ...
|
|
24
|
+
stamp ? /* @__PURE__ */ jsxs("svg", { className: "kz-signature-stamp", viewBox: "62 62 236 236", fill: "none", ...stampAria, focusable: "false", children: [
|
|
24
25
|
/* @__PURE__ */ jsx("circle", { cx: "180", cy: "180", r: "112", stroke: "currentColor", strokeWidth: "6" }),
|
|
25
26
|
/* @__PURE__ */ jsx("circle", { cx: "180", cy: "180", r: "100", stroke: "currentColor", strokeWidth: "2", strokeDasharray: "4 7" }),
|
|
26
27
|
/* @__PURE__ */ jsx("path", { d: SHIELD, stroke: "currentColor", strokeWidth: "18", strokeLinecap: "round", strokeLinejoin: "round" }),
|
package/dist/signature.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/signature/signature.tsx"],"sourcesContent":["// Server-safe. The Krizaka signature of the Cahier (ADR-004, blocks.css): at the end of a section or a page, the way an\n// owner signs their notebook — the Krizaka mark as a small ink stamp and the house's name in the notebook's pen. It never\n// imitates a person's hand: the pen is the `cahier` font role of the tokens, and the mark is the brand's. Both are inked\n// with the host's text role, with a slight texture (an SVG filter, fixed seed: the same on every render).\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { warnDeprecated } from \"../deprecated\";\n\nexport type SignatureProps = Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> & {\n /** `stamp` (the mark alone), `script` (the name alone) or `both`. @default \"both\" */\n variant?: \"stamp\" | \"script\" | \"both\";\n /** The words written by hand. @default \"Krizaka · Montréal\" */\n name?: string;\n /** The date, written small under the name (`23 octobre 2026`). */\n date?: string;\n /** The machine-readable date (`2026-10-23`) of the `time` element. */\n dateTime?: string;\n};\n\n// The cropped shield of KrizakaLogo (marks/krizaka-geometry.ts), in one ink: the open hexagon, its node, its core, a ring.\nconst SHIELD = \"M259.7,134 L259.7,226 L180,272 L100.3,226 L100.3,134 L180,88 L212,106.5\";\n\n/**\n * A small hand-signed mark: the Krizaka mark as an ink stamp, the house's name in the notebook's pen, an optional date.\n * @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.\n */\nexport function Signature({ variant = \"both\", name = \"Krizaka · Montréal\", date, dateTime, className, style, ...props }: SignatureProps) {\n warnDeprecated(\"signature\");\n const filter = `kz-ink-${React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n const stamp = variant !== \"script\";\n const script = variant !== \"stamp\";\n return (\n <div className={cn(\"kz-signature\", className)} data-variant={variant} style={{ ...style, filter: `url(#${filter})` }} {...props}>\n <svg width=\"0\" height=\"0\" aria-hidden focusable=\"false\" className=\"kz-signature-defs\">\n <filter id={filter} x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <feTurbulence type=\"fractalNoise\" baseFrequency=\"0.85\" numOctaves=\"2\" seed=\"7\" result=\"grain\" />\n <feColorMatrix in=\"grain\" type=\"matrix\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.4 1.45\" result=\"speckle\" />\n <feComposite in=\"SourceGraphic\" in2=\"speckle\" operator=\"in\" />\n </filter>\n </svg>\n {stamp ? (\n <svg className=\"kz-signature-stamp\" viewBox=\"62 62 236 236\" fill=\"none\" {...
|
|
1
|
+
{"version":3,"sources":["../src/signature/signature.tsx"],"sourcesContent":["// Server-safe. The Krizaka signature of the Cahier (ADR-004, blocks.css): at the end of a section or a page, the way an\n// owner signs their notebook — the Krizaka mark as a small ink stamp and the house's name in the notebook's pen. It never\n// imitates a person's hand: the pen is the `cahier` font role of the tokens, and the mark is the brand's. Both are inked\n// with the host's text role, with a slight texture (an SVG filter, fixed seed: the same on every render).\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { warnDeprecated } from \"../deprecated\";\n\nexport type SignatureProps = Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> & {\n /** `stamp` (the mark alone), `script` (the name alone) or `both`. @default \"both\" */\n variant?: \"stamp\" | \"script\" | \"both\";\n /** The words written by hand. @default \"Krizaka · Montréal\" */\n name?: string;\n /** The date, written small under the name (`23 octobre 2026`). */\n date?: string;\n /** The machine-readable date (`2026-10-23`) of the `time` element. */\n dateTime?: string;\n};\n\n// The cropped shield of KrizakaLogo (marks/krizaka-geometry.ts), in one ink: the open hexagon, its node, its core, a ring.\nconst SHIELD = \"M259.7,134 L259.7,226 L180,272 L100.3,226 L100.3,134 L180,88 L212,106.5\";\n\n/**\n * A small hand-signed mark: the Krizaka mark as an ink stamp, the house's name in the notebook's pen, an optional date.\n * @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.\n */\nexport function Signature({ variant = \"both\", name = \"Krizaka · Montréal\", date, dateTime, className, style, ...props }: SignatureProps) {\n warnDeprecated(\"signature\");\n const filter = `kz-ink-${React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n const stamp = variant !== \"script\";\n const script = variant !== \"stamp\";\n const stampAria = script ? { \"aria-hidden\": true } : { role: \"img\" as const, \"aria-label\": name };\n return (\n <div className={cn(\"kz-signature\", className)} data-variant={variant} style={{ ...style, filter: `url(#${filter})` }} {...props}>\n <svg width=\"0\" height=\"0\" aria-hidden focusable=\"false\" className=\"kz-signature-defs\">\n <filter id={filter} x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <feTurbulence type=\"fractalNoise\" baseFrequency=\"0.85\" numOctaves=\"2\" seed=\"7\" result=\"grain\" />\n <feColorMatrix in=\"grain\" type=\"matrix\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.4 1.45\" result=\"speckle\" />\n <feComposite in=\"SourceGraphic\" in2=\"speckle\" operator=\"in\" />\n </filter>\n </svg>\n {stamp ? (\n <svg className=\"kz-signature-stamp\" viewBox=\"62 62 236 236\" fill=\"none\" {...stampAria} focusable=\"false\">\n <circle cx=\"180\" cy=\"180\" r=\"112\" stroke=\"currentColor\" strokeWidth=\"6\" />\n <circle cx=\"180\" cy=\"180\" r=\"100\" stroke=\"currentColor\" strokeWidth=\"2\" strokeDasharray=\"4 7\" />\n <path d={SHIELD} stroke=\"currentColor\" strokeWidth=\"18\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n <circle cx=\"259.7\" cy=\"134\" r=\"15\" fill=\"currentColor\" />\n <circle cx=\"180\" cy=\"180\" r=\"20\" fill=\"currentColor\" />\n </svg>\n ) : null}\n {script ? (\n <span className=\"kz-signature-text\">\n <span className=\"kz-signature-name\">{name}</span>\n {date ? <time className=\"kz-signature-date\" dateTime={dateTime}>{date}</time> : null}\n </span>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAIA,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AAY,MAAK,eAAc,SAAQ,gBAAe,SAAQ;AAAA,MACrG,oBAAC,YAAO,IAAG,SAAQ,IAAG,OAAM,GAAE,MAAK,MAAK,gBAAe;AAAA,MACvD,oBAAC,YAAO,IAAG,OAAM,IAAG,OAAM,GAAE,MAAK,MAAK,gBAAe;AAAA,OACvD,IACE;AAAA,IACH,SACC,qBAAC,UAAK,WAAU,qBACd;AAAA,0BAAC,UAAK,WAAU,qBAAqB,gBAAK;AAAA,MACzC,OAAO,oBAAC,UAAK,WAAU,qBAAoB,UAAqB,gBAAK,IAAU;AAAA,OAClF,IACE;AAAA,KACN;AAEJ;","names":[]}
|
package/dist/site-cahier.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-TVLRE7S3.js";
|
|
15
15
|
import {
|
|
16
16
|
Mascot
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-P7AFIKWG.js";
|
|
18
18
|
import {
|
|
19
19
|
cn
|
|
20
20
|
} from "./chunk-NSLXEDIS.js";
|
|
@@ -502,6 +502,10 @@ function backToTop(event) {
|
|
|
502
502
|
window.scrollTo({ top: 0, behavior: "auto" });
|
|
503
503
|
}
|
|
504
504
|
var ToneContext = React.createContext("product");
|
|
505
|
+
function currentMark(atHome, isCurrent2) {
|
|
506
|
+
if (atHome) return "page";
|
|
507
|
+
return isCurrent2 ? "true" : void 0;
|
|
508
|
+
}
|
|
505
509
|
var NO_STATUS = { shared: null, exceptions: /* @__PURE__ */ new Map() };
|
|
506
510
|
function SiteFooter({
|
|
507
511
|
current,
|
|
@@ -568,7 +572,7 @@ function SiteFooter({
|
|
|
568
572
|
"a",
|
|
569
573
|
{
|
|
570
574
|
href: e.url,
|
|
571
|
-
"aria-current": atHome
|
|
575
|
+
"aria-current": currentMark(atHome, isCurrent2),
|
|
572
576
|
onClick: atHome ? backToTop : void 0,
|
|
573
577
|
className: s.link(),
|
|
574
578
|
children: [
|
|
@@ -708,7 +712,7 @@ function SiteCahier({ site: site2, name, bird, hue, nav, navLabel = "Main", home
|
|
|
708
712
|
/* @__PURE__ */ jsx10(Mascot, { bird, tone: "own", size: 30, animated: false }),
|
|
709
713
|
/* @__PURE__ */ jsx10("span", { children: name })
|
|
710
714
|
] }),
|
|
711
|
-
/* @__PURE__ */ jsx10("nav", { "aria-label": navLabel, children: /* @__PURE__ */ jsx10("ul", { className: "kz-cahier-nav", children: nav.map((item
|
|
715
|
+
/* @__PURE__ */ jsx10("nav", { "aria-label": navLabel, children: /* @__PURE__ */ jsx10("ul", { className: "kz-cahier-nav", children: nav.map((item) => /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10(BlockLink, { href: item.href, linkAs, "aria-current": item.current ? "page" : void 0, children: item.label }) }, item.href)) }) })
|
|
712
716
|
] }) }) }),
|
|
713
717
|
/* @__PURE__ */ jsx10("main", { className: "kz-cahier-main", children }),
|
|
714
718
|
footer === false ? null : /* @__PURE__ */ jsx10(SiteFooter, { current: site2, ...footer })
|