@krizaka/ui 3.71.0 → 3.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/blocks.css +26 -0
  2. package/dist/chunk-M3T5RQYV.js +34 -0
  3. package/dist/chunk-M3T5RQYV.js.map +1 -0
  4. package/dist/chunk-ZFR6ZNXD.js +203 -0
  5. package/dist/chunk-ZFR6ZNXD.js.map +1 -0
  6. package/dist/{frame-D6Xv83t8.d.ts → frame-CNZ5VgDD.d.ts} +11 -4
  7. package/dist/schema-DgjBz7-8.d.ts +242 -0
  8. package/dist/shop/booking.d.ts +2 -2
  9. package/dist/shop/booking.js +1 -1
  10. package/dist/shop/booking.js.map +1 -1
  11. package/dist/shop/bulletin.js +1 -1
  12. package/dist/shop/faq.d.ts +2 -1
  13. package/dist/shop/faq.js +1 -1
  14. package/dist/shop/faq.js.map +1 -1
  15. package/dist/shop/gallery.js +1 -1
  16. package/dist/shop/look.d.ts +43 -0
  17. package/dist/shop/look.js +52 -0
  18. package/dist/shop/look.js.map +1 -0
  19. package/dist/shop/policies.d.ts +2 -1
  20. package/dist/shop/policies.js +1 -1
  21. package/dist/shop/policies.js.map +1 -1
  22. package/dist/shop/reviews.d.ts +2 -1
  23. package/dist/shop/reviews.js +1 -1
  24. package/dist/shop/reviews.js.map +1 -1
  25. package/dist/shop/services.js +1 -1
  26. package/dist/shop/social.js +1 -1
  27. package/dist/shop/story.d.ts +2 -1
  28. package/dist/shop/story.js +1 -1
  29. package/dist/shop/story.js.map +1 -1
  30. package/dist/shop/team.js +1 -1
  31. package/dist/shop/video.js +1 -1
  32. package/dist/shop/visit.js +1 -1
  33. package/dist/shop-composer.d.ts +29 -0
  34. package/dist/shop-composer.js +156 -89
  35. package/dist/shop-composer.js.map +1 -1
  36. package/dist/shop.d.ts +6 -240
  37. package/dist/shop.js +24 -212
  38. package/dist/shop.js.map +1 -1
  39. package/package.json +25 -6
  40. package/registry/app-frame.json +1 -1
  41. package/registry/elephant.json +1 -1
  42. package/registry/index.json +9 -8
  43. package/registry/map.json +1 -1
  44. package/registry/nav-bar.json +1 -1
  45. package/registry/rail-nav.json +1 -1
  46. package/registry/shop-composer.json +9 -5
  47. package/registry/shop.json +50 -9
  48. package/registry/site-footer.json +1 -1
  49. package/dist/chunk-A7MQPIEG.js +0 -31
  50. package/dist/chunk-A7MQPIEG.js.map +0 -1
package/dist/blocks.css CHANGED
@@ -1912,6 +1912,11 @@ svg[data-bird="beaver"]{--kzb-pivot:60px 56px;--kzb-head-a:kzb-beaver-head 10s e
1912
1912
  .kz-shop-section .kz-heading-lead { font-size: 14.5px; line-height: 1.55; }
1913
1913
  /* The look preset's photo treatment (a CSS filter on the media box: no re-encoded image) — see @krizaka/tokens presets/shop. */
1914
1914
  .kz-shop [data-shop-photo] { filter: var(--kz-shop-photo-filter, none); border-radius: var(--kz-shop-photo-radius, var(--kz-radius-md, 8px)); }
1915
+ /* A look (`look-*`, @krizaka/tokens): the surface under the page, the print frame of a photo, the poster title's tracking. Without a look
1916
+ these variables are unset and the page is unchanged. */
1917
+ .kz-shop { background: var(--kz-shop-surface, transparent); }
1918
+ .kz-shop [data-shop-photo] { box-shadow: var(--kz-shop-photo-frame, none); }
1919
+ .kz-shop-section .kz-heading-title { letter-spacing: var(--kz-shop-title-tracking, inherit); }
1915
1920
  @media (min-width: 64rem) { .kz-shop-aside { position: sticky; top: var(--kz-anchor-offset, 96px); } }
1916
1921
 
1917
1922
  /* The look presets' typography and photo treatment (@krizaka/tokens `shop-presets.css`, krizaka-ui#745): the title weight and the
@@ -1930,3 +1935,24 @@ svg[data-bird="beaver"]{--kzb-pivot:60px 56px;--kzb-head-a:kzb-beaver-head 10s e
1930
1935
  .kz-shop-thumb-inner { position: absolute; top: 0; left: 0; width: 960px; transform-origin: top left; transform: scale(0.16667); }
1931
1936
  /* The section the composer outlines in the preview page (the bridge sets `data-shop-selected` on the block wrapped around it): a ring, never a layout change. */
1932
1937
  [data-shop-key][data-shop-selected] { outline: 2px solid var(--kz-accent); outline-offset: -2px; }
1938
+
1939
+ /* A look's motion mode (`ShopFrame motion`, akinaza#478): CSS only, no animation frame; every mode is still under reduced motion. */
1940
+ .kz-shop[data-shop-motion="still"] [data-reveal] { opacity: 1; transform: none; transition: none; }
1941
+ .kz-shop[data-shop-motion="soft"] { --kz-shop-ms: 180ms; }
1942
+ .kz-shop[data-shop-motion="paper"] { --kz-shop-ms: 260ms; }
1943
+ .kz-shop[data-shop-motion="lively"] { --kz-shop-ms: 320ms; }
1944
+ .kz-shop[data-shop-motion] [data-reveal] { transition-duration: var(--kz-shop-ms, 180ms); }
1945
+ @keyframes kz-shop-settle { from { transform: rotate(1.2deg) translateY(-3px); } to { transform: none; } }
1946
+ .kz-shop[data-shop-motion="paper"] [data-shop-photo] { animation: kz-shop-settle var(--kz-shop-ms) ease-out 1 both; }
1947
+ @media (prefers-reduced-motion: reduce) {
1948
+ .kz-shop[data-shop-motion] [data-reveal] { transition: none; }
1949
+ .kz-shop[data-shop-motion="paper"] [data-shop-photo] { animation: none; }
1950
+ }
1951
+ /* The Krizaka look's bird sits in the corner of its section, beside the words, never over them. */
1952
+ .kz-shop-section { position: relative; }
1953
+ .kz-shop-mascot { position: absolute; inset-block-start: 0; inset-inline-end: var(--kz-shop-g, 16px); width: 56px; height: 56px; pointer-events: none; }
1954
+ @media (max-width: 40rem) { .kz-shop-mascot { width: 40px; height: 40px; } .kz-shop-mascot svg { width: 100%; height: 100%; } }
1955
+ /* The look picker's swatch (shop-composer): the look's own surface and accent, drawn by its tokens. */
1956
+ .kz-look-swatch { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px; border-radius: 8px; background: var(--kz-shop-surface, var(--kz-surface-0)); color: var(--kz-text-primary, inherit); border: 1px solid var(--kz-border-default); }
1957
+ .kz-look-swatch i { width: 14px; height: 14px; border-radius: 50%; background: var(--kz-accent); display: inline-block; }
1958
+ .kz-look-chip { display: inline-flex; }
@@ -0,0 +1,34 @@
1
+ import {
2
+ Page,
3
+ SectionHeading,
4
+ cn
5
+ } from "./chunk-B47WSPMP.js";
6
+
7
+ // src/shop/frame.tsx
8
+ import * as React from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ var PAPERS = { plain: void 0, seyes: "ruled", kraft: "kraft", washi: "washi" };
11
+ function ShopFrame({ preset, density = "compact", accent, paper = "plain", motion, className, ...props }) {
12
+ return /* @__PURE__ */ jsx("div", { "data-shop-preset": preset, "data-shop-accent": accent, "data-paper": PAPERS[paper], "data-density": density, "data-shop-motion": motion, className: cn("kz-shop", className), ...props });
13
+ }
14
+ function ShopSection({ id, title, eyebrow, lead, actions, bleed, first, mascot, className, children, ...props }) {
15
+ const auto = React.useId();
16
+ const headingId = title ? `${id ?? auto}-title` : void 0;
17
+ const heading = title ? /* @__PURE__ */ jsx(SectionHeading, { id: headingId, size: "sm", eyebrow, title, lead, actions }) : null;
18
+ return /* @__PURE__ */ jsxs("section", { id, "aria-labelledby": headingId, "data-first": first ? "" : void 0, "data-bleed": bleed ? "" : void 0, className: cn("kz-shop-section", className), ...props, children: [
19
+ mascot ? /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "kz-shop-mascot", children: mascot }) : null,
20
+ bleed ? /* @__PURE__ */ jsxs(Fragment, { children: [
21
+ heading && /* @__PURE__ */ jsx(Page, { children: heading }),
22
+ children
23
+ ] }) : /* @__PURE__ */ jsxs(Page, { children: [
24
+ heading,
25
+ children
26
+ ] })
27
+ ] });
28
+ }
29
+
30
+ export {
31
+ ShopFrame,
32
+ ShopSection
33
+ };
34
+ //# sourceMappingURL=chunk-M3T5RQYV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shop/frame.tsx"],"sourcesContent":["// Server-safe. The frame and the rhythm of a shop page (ADR-007 §2): every section draws inside the page frame between the\n// gutters (`bleed` for a photo only), one vertical rhythm set by the density, a hairline between sections. No section sets\n// its own margin: it only says what it holds.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Page, SectionHeading } from \"../page/page\";\n\n/** A photo the product resolved: the address, its words, and the widths it has (`srcSet`). */\nexport type ShopPhoto = {\n src: string;\n /** What it shows, in words; empty when it only sets a mood. */\n alt: string;\n /** The widths the product holds (`/a-480.avif 480w, /a-960.avif 960w`); the section brings the `sizes`. */\n srcSet?: string;\n};\n\nexport type ShopFrameProps = React.HTMLAttributes<HTMLDivElement> & {\n /** The look preset (`salon-vitrine`, `@krizaka/tokens`): its tokens apply to everything inside. */\n preset?: string;\n /**\n * The rhythm: `compact` 40 px between sections (24 on a phone), `airy` 64 px (40). The document's, or the preset's.\n * @default \"compact\"\n */\n density?: \"compact\" | \"airy\";\n /**\n * One of the accents the preset lists as tested (`krizaka`, `akinaza:accent-2`…): the owner's choice within the look. Without it, the preset's own.\n * @see @krizaka/tokens `shopPresets`\n */\n accent?: string;\n /**\n * The paper under the page, from the preset: `seyes` (ruled), `kraft` (brown — mount `PaperGrain` once), `washi` (a tint of the accent) or `plain`.\n * @default \"plain\"\n */\n paper?: \"plain\" | \"seyes\" | \"kraft\" | \"washi\";\n /**\n * The look's motion mode, CSS only (`still` · `soft` · `paper` · `lively`): the arrival of blocks and the settling of photos. Under `prefers-reduced-motion` every mode is still.\n * @see @krizaka/tokens `shopPresets`\n */\n motion?: \"still\" | \"soft\" | \"paper\" | \"lively\";\n};\n\nconst PAPERS = { plain: undefined, seyes: \"ruled\", kraft: \"kraft\", washi: \"washi\" } as const;\n\n/** The page: sets the look preset, the accent, the paper and the density the sections below read. */\nexport function ShopFrame({ preset, density = \"compact\", accent, paper = \"plain\", motion, className, ...props }: ShopFrameProps) {\n return <div data-shop-preset={preset} data-shop-accent={accent} data-paper={PAPERS[paper]} data-density={density} data-shop-motion={motion} className={cn(\"kz-shop\", className)} {...props} />;\n}\n\nexport type ShopSectionProps = Omit<React.HTMLAttributes<HTMLElement>, \"title\"> & {\n /** The section's id: the anchor, and the heading's id. */\n id?: string;\n /** The `h2`. Without one the section is named by `aria-label`. */\n title?: React.ReactNode;\n /** A short lower-case note above the title. */\n eyebrow?: React.ReactNode;\n /** One sentence under the title. */\n lead?: React.ReactNode;\n /** A link or a button on the right of the heading (« All times → »). */\n actions?: React.ReactNode;\n /** The content reaches the edges of the screen (a photo, a strip); the heading stays on the frame. */\n bleed?: boolean;\n /** The section is the page's first (the hero): no hairline, no padding. */\n first?: boolean;\n /** A bird of the Krizaka look (`mascotFor`, `ShopMascot` of `@krizaka/ui/shop/look`), decorative, in the corner of the heading. Never on the first screen. */\n mascot?: React.ReactNode;\n};\n\n/** A section of a shop page. */\nexport function ShopSection({ id, title, eyebrow, lead, actions, bleed, first, mascot, className, children, ...props }: ShopSectionProps) {\n const auto = React.useId();\n const headingId = title ? `${id ?? auto}-title` : undefined;\n const heading = title ? <SectionHeading id={headingId} size=\"sm\" eyebrow={eyebrow} title={title} lead={lead} actions={actions} /> : null;\n return (\n <section id={id} aria-labelledby={headingId} data-first={first ? \"\" : undefined} data-bleed={bleed ? \"\" : undefined} className={cn(\"kz-shop-section\", className)} {...props}>\n {mascot ? <div aria-hidden className=\"kz-shop-mascot\">{mascot}</div> : null}\n {bleed ? (\n <>\n {heading && <Page>{heading}</Page>}\n {children}\n </>\n ) : (\n <Page>\n {heading}\n {children}\n </Page>\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;AAGA,YAAY,WAAW;AA2Cd,SA+BD,UA/BC,KA+BD,YA/BC;AAJT,IAAM,SAAS,EAAE,OAAO,QAAW,OAAO,SAAS,OAAO,SAAS,OAAO,QAAQ;AAG3E,SAAS,UAAU,EAAE,QAAQ,UAAU,WAAW,QAAQ,QAAQ,SAAS,QAAQ,WAAW,GAAG,MAAM,GAAmB;AAC/H,SAAO,oBAAC,SAAI,oBAAkB,QAAQ,oBAAkB,QAAQ,cAAY,OAAO,KAAK,GAAG,gBAAc,SAAS,oBAAkB,QAAQ,WAAW,GAAG,WAAW,SAAS,GAAI,GAAG,OAAO;AAC9L;AAsBO,SAAS,YAAY,EAAE,IAAI,OAAO,SAAS,MAAM,SAAS,OAAO,OAAO,QAAQ,WAAW,UAAU,GAAG,MAAM,GAAqB;AACxI,QAAM,OAAa,YAAM;AACzB,QAAM,YAAY,QAAQ,GAAG,MAAM,IAAI,WAAW;AAClD,QAAM,UAAU,QAAQ,oBAAC,kBAAe,IAAI,WAAW,MAAK,MAAK,SAAkB,OAAc,MAAY,SAAkB,IAAK;AACpI,SACE,qBAAC,aAAQ,IAAQ,mBAAiB,WAAW,cAAY,QAAQ,KAAK,QAAW,cAAY,QAAQ,KAAK,QAAW,WAAW,GAAG,mBAAmB,SAAS,GAAI,GAAG,OACnK;AAAA,aAAS,oBAAC,SAAI,eAAW,MAAC,WAAU,kBAAkB,kBAAO,IAAS;AAAA,IACtE,QACC,iCACG;AAAA,iBAAW,oBAAC,QAAM,mBAAQ;AAAA,MAC1B;AAAA,OACH,IAEA,qBAAC,QACE;AAAA;AAAA,MACA;AAAA,OACH;AAAA,KAEJ;AAEJ;","names":[]}
@@ -0,0 +1,203 @@
1
+ import {
2
+ SHOP_LIMITS
3
+ } from "./chunk-ZYHWJ7U5.js";
4
+
5
+ // src/shop/text.ts
6
+ import * as z from "zod/mini";
7
+ var localizedText = z.object({
8
+ fr: z.optional(z.string().check(z.maxLength(600))),
9
+ en: z.optional(z.string().check(z.maxLength(600)))
10
+ });
11
+
12
+ // src/shop/define.ts
13
+ import * as z2 from "zod/mini";
14
+ var key = z2.string().check(z2.minLength(1), z2.maxLength(40), z2.regex(/^[A-Za-z0-9_-]+$/, "a key (letters, digits, - and _)"));
15
+ function defineSection(spec) {
16
+ const blockUnion = spec.blocks && Object.keys(spec.blocks).length > 0 ? z2.discriminatedUnion(
17
+ "type",
18
+ Object.entries(spec.blocks).map(
19
+ ([type, settings]) => z2.object({ key, type: z2.literal(type), settings, text: z2.optional(z2.record(z2.string(), localizedText)) })
20
+ )
21
+ ) : void 0;
22
+ const blocks = blockUnion ? z2.optional(z2.array(blockUnion).check(z2.maxLength(SHOP_LIMITS.blocks))) : z2.optional(z2.array(z2.never()).check(z2.maxLength(0)));
23
+ const base = z2.object({
24
+ key,
25
+ type: z2.literal(spec.type),
26
+ variant: z2.enum(spec.variants),
27
+ disabled: z2.optional(z2.boolean()),
28
+ settings: spec.settings,
29
+ text: z2.optional(z2.object({ title: z2.optional(localizedText), lead: z2.optional(localizedText) })),
30
+ blocks
31
+ });
32
+ const schema = base.check(
33
+ z2.superRefine((value, ctx) => {
34
+ spec.refine?.(value, (path, message) => ctx.issues.push({ code: "custom", message, path, input: value }));
35
+ })
36
+ );
37
+ return Object.freeze({
38
+ ...spec,
39
+ defaultVariant: spec.variants[0],
40
+ blockTypes: Object.keys(spec.blocks ?? {}),
41
+ schema
42
+ });
43
+ }
44
+
45
+ // src/shop/catalogue.ts
46
+ import * as z3 from "zod/mini";
47
+ var ref = z3.string().check(z3.minLength(1), z3.maxLength(80));
48
+ var short = z3.string().check(z3.minLength(1), z3.maxLength(140));
49
+ var url = z3.string().check(z3.maxLength(300), z3.regex(/^https:\/\//, "an https address"));
50
+ var isoDay = z3.string().check(z3.regex(/^\d{4}-\d{2}-\d{2}$/, "a day (YYYY-MM-DD)"));
51
+ var source = z3.enum(["all", "pick"]);
52
+ var oneOf = (...n) => z3.union(n.map((v) => z3.literal(v)));
53
+ var platforms = ["tiktok", "youtube-shorts", "instagram"];
54
+ var heroSection = defineSection({
55
+ type: "hero",
56
+ variants: ["poster", "split", "banner", "tv"],
57
+ settings: z3.object({
58
+ /** The cover: a media id. Absent, the product's default for the trade. */
59
+ media: z3.optional(ref),
60
+ /** Where the photo is cropped to when the box is not its ratio. */
61
+ focus: z3.enum(["center", "top", "bottom"])
62
+ }),
63
+ settingsDefault: { focus: "center" },
64
+ blocks: { fact: z3.object({ kind: z3.enum(["open-now", "area", "score"]) }) }
65
+ });
66
+ var servicesSection = defineSection({
67
+ type: "services",
68
+ variants: ["menu", "cards", "index", "carousel"],
69
+ settings: z3.object({
70
+ /** `all` the shop's services, or `pick` the ones the `service` blocks name, in their order. */
71
+ source,
72
+ groupBy: z3.enum(["category", "none"]),
73
+ /** `menu` only: two columns when nothing sits beside it. */
74
+ columns: oneOf(1, 2),
75
+ /** `menu` only: the shop's hours, team and address beside the list (the host draws them from its own data). */
76
+ aside: z3.enum(["hours", "none"])
77
+ }),
78
+ settingsDefault: { source: "all", groupBy: "category", columns: 1, aside: "hours" },
79
+ blocks: { service: z3.object({ serviceId: ref }) },
80
+ refine: (section, issue) => {
81
+ if (section.settings.source === "pick" && (section.blocks ?? []).length === 0) issue(["blocks"], "pick at least one service");
82
+ if (section.variant === "cards" && (section.blocks ?? []).length > SHOP_LIMITS.cards) issue(["blocks"], `at most ${SHOP_LIMITS.cards} cards`);
83
+ }
84
+ });
85
+ var bookingSection = defineSection({
86
+ type: "booking",
87
+ variants: ["strip", "panel", "closing", "sticky"],
88
+ settings: z3.object({
89
+ /** A service the times are for; absent, the next free times of any service. */
90
+ serviceId: z3.optional(ref),
91
+ /** `strip`: how many times it shows. */
92
+ count: oneOf(3, 4, 6)
93
+ }),
94
+ settingsDefault: { count: 4 }
95
+ });
96
+ var gallerySection = defineSection({
97
+ type: "gallery",
98
+ variants: ["mosaic", "filmstrip", "wall", "grid"],
99
+ settings: z3.object({
100
+ source,
101
+ /** `wall` only. */
102
+ texture: z3.enum(["plaster", "brick", "ridge", "zellige"])
103
+ }),
104
+ settingsDefault: { source: "all", texture: "plaster" },
105
+ blocks: {
106
+ photo: z3.object({ mediaId: ref, caption: z3.optional(short) }),
107
+ note: z3.object({ text: short, signature: z3.optional(z3.string().check(z3.maxLength(40))) }),
108
+ sign: z3.object({})
109
+ },
110
+ refine: (section, issue) => {
111
+ const photos = (section.blocks ?? []).filter((b) => b.type === "photo").length;
112
+ if (photos > SHOP_LIMITS.photos) issue(["blocks"], `at most ${SHOP_LIMITS.photos} photos`);
113
+ }
114
+ });
115
+ var videoSection = defineSection({
116
+ type: "video",
117
+ variants: ["tv", "shorts"],
118
+ settings: z3.object({ cabinet: z3.enum(["cabinet", "portable"]), channel: z3.optional(z3.string().check(z3.maxLength(32))) }),
119
+ settingsDefault: { cabinet: "cabinet" },
120
+ blocks: { reel: z3.object({ platform: z3.enum(platforms), url }) }
121
+ });
122
+ var reviewsSection = defineSection({
123
+ type: "reviews",
124
+ variants: ["summary-cards", "quote", "strip"],
125
+ settings: z3.object({ rule: z3.enum(["best", "latest"]), count: oneOf(1, 2, 3) }),
126
+ settingsDefault: { rule: "best", count: 2 }
127
+ });
128
+ var bulletinSection = defineSection({
129
+ type: "bulletin",
130
+ variants: ["board", "banner"],
131
+ settings: z3.object({}),
132
+ settingsDefault: {},
133
+ blocks: { flyer: z3.object({ text: short, signature: z3.optional(z3.string().check(z3.maxLength(40))), until: z3.optional(isoDay) }) },
134
+ refine: (section, issue) => {
135
+ if ((section.blocks ?? []).length > SHOP_LIMITS.flyers) issue(["blocks"], `at most ${SHOP_LIMITS.flyers} flyers`);
136
+ }
137
+ });
138
+ var teamSection = defineSection({
139
+ type: "team",
140
+ variants: ["row", "cards"],
141
+ settings: z3.object({ source }),
142
+ settingsDefault: { source: "all" },
143
+ blocks: { member: z3.object({ memberId: ref }) }
144
+ });
145
+ var visitSection = defineSection({
146
+ type: "visit",
147
+ variants: ["card", "map", "split"],
148
+ settings: z3.object({ showPhone: z3.boolean() }),
149
+ settingsDefault: { showPhone: true }
150
+ });
151
+ var storySection = defineSection({
152
+ type: "story",
153
+ variants: ["quote", "owner"],
154
+ settings: z3.object({ body: localizedText }),
155
+ settingsDefault: { body: {} }
156
+ });
157
+ var socialSection = defineSection({
158
+ type: "social",
159
+ variants: ["links", "facade"],
160
+ settings: z3.object({}),
161
+ settingsDefault: {},
162
+ blocks: { link: z3.object({ platform: z3.enum(platforms), url }) }
163
+ });
164
+ var faqSection = defineSection({
165
+ type: "faq",
166
+ variants: ["list"],
167
+ settings: z3.object({}),
168
+ settingsDefault: {},
169
+ blocks: { question: z3.object({ question: localizedText, answer: localizedText }) }
170
+ });
171
+ var policiesSection = defineSection({
172
+ type: "policies",
173
+ variants: ["inline"],
174
+ settings: z3.object({ show: z3.array(z3.enum(["cancellation", "prices", "booking-window"])).check(z3.maxLength(3)) }),
175
+ settingsDefault: { show: ["cancellation", "prices", "booking-window"] }
176
+ });
177
+ var SECTION_DEFINITIONS = [
178
+ heroSection,
179
+ servicesSection,
180
+ bookingSection,
181
+ gallerySection,
182
+ videoSection,
183
+ reviewsSection,
184
+ bulletinSection,
185
+ teamSection,
186
+ visitSection,
187
+ storySection,
188
+ socialSection,
189
+ faqSection,
190
+ policiesSection
191
+ ];
192
+ var SECTION_TYPES = SECTION_DEFINITIONS.map((d) => d.type);
193
+ function sectionDefinition(type) {
194
+ return SECTION_DEFINITIONS.find((d) => d.type === type);
195
+ }
196
+
197
+ export {
198
+ defineSection,
199
+ SECTION_DEFINITIONS,
200
+ SECTION_TYPES,
201
+ sectionDefinition
202
+ };
203
+ //# sourceMappingURL=chunk-ZFR6ZNXD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shop/text.ts","../src/shop/define.ts","../src/shop/catalogue.ts"],"sourcesContent":["import * as z from \"zod/mini\";\n\n/** The owner's words, in each language; the product's message is the fallback when a language is absent. */\nexport const localizedText = z.object({\n fr: z.optional(z.string().check(z.maxLength(600))),\n en: z.optional(z.string().check(z.maxLength(600))),\n});\nexport type LocalizedText = z.output<typeof localizedText>;\n","// `defineSection` (ADR-007 §1): one section type = its variants, the zod schema of its settings, the blocks it allows\n// (each a zod schema) and the checks that need the whole section. It builds the zod schema of a section of this type, so\n// the renderer, the validator and the composer's generated forms agree.\nimport * as z from \"zod/mini\";\n\nimport { SHOP_LIMITS } from \"./limits\";\nimport { localizedText } from \"./text\";\n\ntype Shape = z.ZodMiniObject;\ntype BlockShapes = Record<string, Shape>;\n\n/** What a section of a type is, once parsed. */\nexport type ParsedSection<T extends string, V extends string, S extends Shape, B extends BlockShapes> = {\n key: string;\n type: T;\n variant: V;\n disabled?: boolean | undefined;\n settings: z.output<S>;\n text?: { title?: z.output<typeof localizedText> | undefined; lead?: z.output<typeof localizedText> | undefined } | undefined;\n blocks?: { [K in keyof B & string]: { key: string; type: K; settings: z.output<B[K]>; text?: Record<string, z.output<typeof localizedText>> | undefined } }[keyof B & string][] | undefined;\n};\n\nexport type SectionSpec<T extends string, V extends readonly [string, ...string[]], S extends Shape, B extends BlockShapes> = {\n /** The type's name: the `type` of a section. */\n type: T;\n /** Its variants; the first is the default one. */\n variants: V;\n /** The zod schema of its settings. */\n settings: S;\n /** The settings a new section starts with. */\n settingsDefault: z.input<S>;\n /** The block types it allows, each with the zod schema of its settings. None: the section has no blocks. */\n blocks?: B;\n /** The checks that read the whole section (a count, a combination); `issue(path, message)` refuses it. */\n refine?: (section: ParsedSection<T, V[number], S, B>, issue: (path: (string | number)[], message: string) => void) => void;\n};\n\nexport type SectionDefinitionOf<T extends string, V extends readonly [string, ...string[]], S extends Shape, B extends BlockShapes> = SectionSpec<T, V, S, B> & {\n readonly defaultVariant: V[number];\n readonly blockTypes: readonly (keyof B & string)[];\n /** The zod schema of a section of this type. */\n readonly schema: z.ZodMiniType<ParsedSection<T, V[number], S, B>>;\n};\n\nconst key = z.string().check(z.minLength(1), z.maxLength(40), z.regex(/^[A-Za-z0-9_-]+$/, \"a key (letters, digits, - and _)\"));\n\n/** Defines a section type. */\nexport function defineSection<const T extends string, const V extends readonly [string, ...string[]], S extends Shape, B extends BlockShapes = Record<never, never>>(\n spec: SectionSpec<T, V, S, B>,\n): SectionDefinitionOf<T, V, S, B> {\n const blockUnion = spec.blocks && Object.keys(spec.blocks).length > 0\n ? z.discriminatedUnion(\n \"type\",\n Object.entries(spec.blocks).map(([type, settings]) =>\n z.object({ key, type: z.literal(type), settings, text: z.optional(z.record(z.string(), localizedText)) }),\n ) as unknown as [z.ZodMiniObject, ...z.ZodMiniObject[]],\n )\n : undefined;\n const blocks = blockUnion\n ? z.optional(z.array(blockUnion).check(z.maxLength(SHOP_LIMITS.blocks)))\n : z.optional(z.array(z.never()).check(z.maxLength(0)));\n const base = z.object({\n key,\n type: z.literal(spec.type),\n variant: z.enum(spec.variants),\n disabled: z.optional(z.boolean()),\n settings: spec.settings,\n text: z.optional(z.object({ title: z.optional(localizedText), lead: z.optional(localizedText) })),\n blocks,\n });\n const schema = base.check(\n z.superRefine((value, ctx) => {\n spec.refine?.(value as never, (path, message) => ctx.issues.push({ code: \"custom\", message, path, input: value }));\n }),\n );\n return Object.freeze({\n ...spec,\n defaultVariant: spec.variants[0],\n blockTypes: Object.keys(spec.blocks ?? {}) as (keyof B & string)[],\n schema: schema as unknown as z.ZodMiniType<ParsedSection<T, V[number], S, B>>,\n });\n}\n","// The catalogue of section types (ADR-007 §3): each with its variants, its settings and the blocks it allows, as zod\n// schemas — the renderer, the validator and the composer's forms read the same definitions. The first variant of a type is\n// its default. Settings hold references and rules (ids, a source, a count), never a price or a text of the shop.\nimport * as z from \"zod/mini\";\n\nimport { defineSection } from \"./define\";\nimport { SHOP_LIMITS } from \"./limits\";\nimport { localizedText } from \"./text\";\n\n/** A reference to something the product holds (a service, a photo, a member): an opaque id. */\nconst ref = z.string().check(z.minLength(1), z.maxLength(80));\nconst short = z.string().check(z.minLength(1), z.maxLength(140));\nconst url = z.string().check(z.maxLength(300), z.regex(/^https:\\/\\//, \"an https address\"));\nconst isoDay = z.string().check(z.regex(/^\\d{4}-\\d{2}-\\d{2}$/, \"a day (YYYY-MM-DD)\"));\nconst source = z.enum([\"all\", \"pick\"]);\n/** One of a few numbers. */\nconst oneOf = <const N extends readonly [number, number, ...number[]]>(...n: N) => z.union(n.map((v) => z.literal(v)) as unknown as [z.ZodMiniLiteral<N[number]>, z.ZodMiniLiteral<N[number]>]);\n\nexport const platforms = [\"tiktok\", \"youtube-shorts\", \"instagram\"] as const;\n\nexport const heroSection = defineSection({\n type: \"hero\",\n variants: [\"poster\", \"split\", \"banner\", \"tv\"],\n settings: z.object({\n /** The cover: a media id. Absent, the product's default for the trade. */\n media: z.optional(ref),\n /** Where the photo is cropped to when the box is not its ratio. */\n focus: z.enum([\"center\", \"top\", \"bottom\"]),\n }),\n settingsDefault: { focus: \"center\" },\n blocks: { fact: z.object({ kind: z.enum([\"open-now\", \"area\", \"score\"]) }) },\n});\n\nexport const servicesSection = defineSection({\n type: \"services\",\n variants: [\"menu\", \"cards\", \"index\", \"carousel\"],\n settings: z.object({\n /** `all` the shop's services, or `pick` the ones the `service` blocks name, in their order. */\n source,\n groupBy: z.enum([\"category\", \"none\"]),\n /** `menu` only: two columns when nothing sits beside it. */\n columns: oneOf(1, 2),\n /** `menu` only: the shop's hours, team and address beside the list (the host draws them from its own data). */\n aside: z.enum([\"hours\", \"none\"]),\n }),\n settingsDefault: { source: \"all\", groupBy: \"category\", columns: 1, aside: \"hours\" },\n blocks: { service: z.object({ serviceId: ref }) },\n refine: (section, issue) => {\n if (section.settings.source === \"pick\" && (section.blocks ?? []).length === 0) issue([\"blocks\"], \"pick at least one service\");\n if (section.variant === \"cards\" && (section.blocks ?? []).length > SHOP_LIMITS.cards) issue([\"blocks\"], `at most ${SHOP_LIMITS.cards} cards`);\n },\n});\n\nexport const bookingSection = defineSection({\n type: \"booking\",\n variants: [\"strip\", \"panel\", \"closing\", \"sticky\"],\n settings: z.object({\n /** A service the times are for; absent, the next free times of any service. */\n serviceId: z.optional(ref),\n /** `strip`: how many times it shows. */\n count: oneOf(3, 4, 6),\n }),\n settingsDefault: { count: 4 },\n});\n\nexport const gallerySection = defineSection({\n type: \"gallery\",\n variants: [\"mosaic\", \"filmstrip\", \"wall\", \"grid\"],\n settings: z.object({\n source,\n /** `wall` only. */\n texture: z.enum([\"plaster\", \"brick\", \"ridge\", \"zellige\"]),\n }),\n settingsDefault: { source: \"all\", texture: \"plaster\" },\n blocks: {\n photo: z.object({ mediaId: ref, caption: z.optional(short) }),\n note: z.object({ text: short, signature: z.optional(z.string().check(z.maxLength(40))) }),\n sign: z.object({}),\n },\n refine: (section, issue) => {\n const photos = (section.blocks ?? []).filter((b) => b.type === \"photo\").length;\n if (photos > SHOP_LIMITS.photos) issue([\"blocks\"], `at most ${SHOP_LIMITS.photos} photos`);\n },\n});\n\nexport const videoSection = defineSection({\n type: \"video\",\n variants: [\"tv\", \"shorts\"],\n settings: z.object({ cabinet: z.enum([\"cabinet\", \"portable\"]), channel: z.optional(z.string().check(z.maxLength(32))) }),\n settingsDefault: { cabinet: \"cabinet\" },\n blocks: { reel: z.object({ platform: z.enum(platforms), url }) },\n});\n\nexport const reviewsSection = defineSection({\n type: \"reviews\",\n variants: [\"summary-cards\", \"quote\", \"strip\"],\n settings: z.object({ rule: z.enum([\"best\", \"latest\"]), count: oneOf(1, 2, 3) }),\n settingsDefault: { rule: \"best\", count: 2 },\n});\n\nexport const bulletinSection = defineSection({\n type: \"bulletin\",\n variants: [\"board\", \"banner\"],\n settings: z.object({}),\n settingsDefault: {},\n blocks: { flyer: z.object({ text: short, signature: z.optional(z.string().check(z.maxLength(40))), until: z.optional(isoDay) }) },\n refine: (section, issue) => {\n if ((section.blocks ?? []).length > SHOP_LIMITS.flyers) issue([\"blocks\"], `at most ${SHOP_LIMITS.flyers} flyers`);\n },\n});\n\nexport const teamSection = defineSection({\n type: \"team\",\n variants: [\"row\", \"cards\"],\n settings: z.object({ source }),\n settingsDefault: { source: \"all\" },\n blocks: { member: z.object({ memberId: ref }) },\n});\n\nexport const visitSection = defineSection({\n type: \"visit\",\n variants: [\"card\", \"map\", \"split\"],\n settings: z.object({ showPhone: z.boolean() }),\n settingsDefault: { showPhone: true },\n});\n\nexport const storySection = defineSection({\n type: \"story\",\n variants: [\"quote\", \"owner\"],\n settings: z.object({ body: localizedText }),\n settingsDefault: { body: {} },\n});\n\nexport const socialSection = defineSection({\n type: \"social\",\n variants: [\"links\", \"facade\"],\n settings: z.object({}),\n settingsDefault: {},\n blocks: { link: z.object({ platform: z.enum(platforms), url }) },\n});\n\nexport const faqSection = defineSection({\n type: \"faq\",\n variants: [\"list\"],\n settings: z.object({}),\n settingsDefault: {},\n blocks: { question: z.object({ question: localizedText, answer: localizedText }) },\n});\n\nexport const policiesSection = defineSection({\n type: \"policies\",\n variants: [\"inline\"],\n settings: z.object({ show: z.array(z.enum([\"cancellation\", \"prices\", \"booking-window\"])).check(z.maxLength(3)) }),\n settingsDefault: { show: [\"cancellation\", \"prices\", \"booking-window\"] },\n});\n\n/** Every section type, in the order the composer lists them. */\nexport const SECTION_DEFINITIONS = [\n heroSection, servicesSection, bookingSection, gallerySection, videoSection, reviewsSection, bulletinSection,\n teamSection, visitSection, storySection, socialSection, faqSection, policiesSection,\n] as const;\n\nexport type SectionDefinition = (typeof SECTION_DEFINITIONS)[number];\nexport type SectionType = SectionDefinition[\"type\"];\nexport const SECTION_TYPES = SECTION_DEFINITIONS.map((d) => d.type) as readonly SectionType[];\n\n/** The definition of a type. */\nexport function sectionDefinition<T extends SectionType>(type: T): Extract<SectionDefinition, { type: T }> {\n return SECTION_DEFINITIONS.find((d) => d.type === type) as Extract<SectionDefinition, { type: T }>;\n}\n"],"mappings":";;;;;AAAA,YAAY,OAAO;AAGZ,IAAM,gBAAkB,SAAO;AAAA,EACpC,IAAM,WAAW,SAAO,EAAE,MAAQ,YAAU,GAAG,CAAC,CAAC;AAAA,EACjD,IAAM,WAAW,SAAO,EAAE,MAAQ,YAAU,GAAG,CAAC,CAAC;AACnD,CAAC;;;ACHD,YAAYA,QAAO;AAyCnB,IAAM,MAAQ,UAAO,EAAE,MAAQ,aAAU,CAAC,GAAK,aAAU,EAAE,GAAK,SAAM,oBAAoB,kCAAkC,CAAC;AAGtH,SAAS,cACd,MACiC;AACjC,QAAM,aAAa,KAAK,UAAU,OAAO,KAAK,KAAK,MAAM,EAAE,SAAS,IAC9D;AAAA,IACA;AAAA,IACA,OAAO,QAAQ,KAAK,MAAM,EAAE;AAAA,MAAI,CAAC,CAAC,MAAM,QAAQ,MAC5C,UAAO,EAAE,KAAK,MAAQ,WAAQ,IAAI,GAAG,UAAU,MAAQ,YAAW,UAAS,U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AAc;AAAA,EAAc;AAAA,EAAe;AAAA,EAAY;AACtE;AAIO,IAAM,gBAAgB,oBAAoB,IAAI,CAAC,MAAM,EAAE,IAAI;AAG3D,SAAS,kBAAyC,MAAkD;AACzG,SAAO,oBAAoB,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AACxD;","names":["z","z"]}
@@ -26,9 +26,14 @@ type ShopFrameProps = React.HTMLAttributes<HTMLDivElement> & {
26
26
  * @default "plain"
27
27
  */
28
28
  paper?: "plain" | "seyes" | "kraft" | "washi";
29
+ /**
30
+ * The look's motion mode, CSS only (`still` · `soft` · `paper` · `lively`): the arrival of blocks and the settling of photos. Under `prefers-reduced-motion` every mode is still.
31
+ * @see @krizaka/tokens `shopPresets`
32
+ */
33
+ motion?: "still" | "soft" | "paper" | "lively";
29
34
  };
30
35
  /** The page: sets the look preset, the accent, the paper and the density the sections below read. */
31
- declare function ShopFrame({ preset, density, accent, paper, className, ...props }: ShopFrameProps): React.JSX.Element;
36
+ declare function ShopFrame({ preset, density, accent, paper, motion, className, ...props }: ShopFrameProps): React.JSX.Element;
32
37
  type ShopSectionProps = Omit<React.HTMLAttributes<HTMLElement>, "title"> & {
33
38
  /** The section's id: the anchor, and the heading's id. */
34
39
  id?: string;
@@ -44,9 +49,11 @@ type ShopSectionProps = Omit<React.HTMLAttributes<HTMLElement>, "title"> & {
44
49
  bleed?: boolean;
45
50
  /** The section is the page's first (the hero): no hairline, no padding. */
46
51
  first?: boolean;
52
+ /** A bird of the Krizaka look (`mascotFor`, `ShopMascot` of `@krizaka/ui/shop/look`), decorative, in the corner of the heading. Never on the first screen. */
53
+ mascot?: React.ReactNode;
47
54
  };
48
55
  /** A section of a shop page. */
49
- declare function ShopSection({ id, title, eyebrow, lead, actions, bleed, first, className, children, ...props }: ShopSectionProps): React.JSX.Element;
56
+ declare function ShopSection({ id, title, eyebrow, lead, actions, bleed, first, mascot, className, children, ...props }: ShopSectionProps): React.JSX.Element;
50
57
 
51
- export { ShopFrame as a, ShopSection as c };
52
- export type { ShopPhoto as S, ShopFrameProps as b, ShopSectionProps as d };
58
+ export { ShopFrame as b, ShopSection as d };
59
+ export type { ShopSectionProps as S, ShopPhoto as a, ShopFrameProps as c };
@@ -0,0 +1,242 @@
1
+ import * as z from 'zod/mini';
2
+
3
+ /** The owner's words, in each language; the product's message is the fallback when a language is absent. */
4
+ declare const localizedText: z.ZodMiniObject<{
5
+ fr: z.ZodMiniOptional<z.ZodMiniString<string>>;
6
+ en: z.ZodMiniOptional<z.ZodMiniString<string>>;
7
+ }, z.core.$strip>;
8
+ type LocalizedText = z.output<typeof localizedText>;
9
+
10
+ type Shape = z.ZodMiniObject;
11
+ type BlockShapes = Record<string, Shape>;
12
+ /** What a section of a type is, once parsed. */
13
+ type ParsedSection<T extends string, V extends string, S extends Shape, B extends BlockShapes> = {
14
+ key: string;
15
+ type: T;
16
+ variant: V;
17
+ disabled?: boolean | undefined;
18
+ settings: z.output<S>;
19
+ text?: {
20
+ title?: z.output<typeof localizedText> | undefined;
21
+ lead?: z.output<typeof localizedText> | undefined;
22
+ } | undefined;
23
+ blocks?: {
24
+ [K in keyof B & string]: {
25
+ key: string;
26
+ type: K;
27
+ settings: z.output<B[K]>;
28
+ text?: Record<string, z.output<typeof localizedText>> | undefined;
29
+ };
30
+ }[keyof B & string][] | undefined;
31
+ };
32
+ type SectionSpec<T extends string, V extends readonly [string, ...string[]], S extends Shape, B extends BlockShapes> = {
33
+ /** The type's name: the `type` of a section. */
34
+ type: T;
35
+ /** Its variants; the first is the default one. */
36
+ variants: V;
37
+ /** The zod schema of its settings. */
38
+ settings: S;
39
+ /** The settings a new section starts with. */
40
+ settingsDefault: z.input<S>;
41
+ /** The block types it allows, each with the zod schema of its settings. None: the section has no blocks. */
42
+ blocks?: B;
43
+ /** The checks that read the whole section (a count, a combination); `issue(path, message)` refuses it. */
44
+ refine?: (section: ParsedSection<T, V[number], S, B>, issue: (path: (string | number)[], message: string) => void) => void;
45
+ };
46
+ type SectionDefinitionOf<T extends string, V extends readonly [string, ...string[]], S extends Shape, B extends BlockShapes> = SectionSpec<T, V, S, B> & {
47
+ readonly defaultVariant: V[number];
48
+ readonly blockTypes: readonly (keyof B & string)[];
49
+ /** The zod schema of a section of this type. */
50
+ readonly schema: z.ZodMiniType<ParsedSection<T, V[number], S, B>>;
51
+ };
52
+ /** Defines a section type. */
53
+ declare function defineSection<const T extends string, const V extends readonly [string, ...string[]], S extends Shape, B extends BlockShapes = Record<never, never>>(spec: SectionSpec<T, V, S, B>): SectionDefinitionOf<T, V, S, B>;
54
+
55
+ /** Every section type, in the order the composer lists them. */
56
+ declare const SECTION_DEFINITIONS: readonly [SectionDefinitionOf<"hero", readonly ["poster", "split", "banner", "tv"], z.ZodMiniObject<{
57
+ media: z.ZodMiniOptional<z.ZodMiniString<string>>;
58
+ focus: z.ZodMiniEnum<{
59
+ center: "center";
60
+ top: "top";
61
+ bottom: "bottom";
62
+ }>;
63
+ }, z.core.$strip>, {
64
+ fact: z.ZodMiniObject<{
65
+ kind: z.ZodMiniEnum<{
66
+ "open-now": "open-now";
67
+ area: "area";
68
+ score: "score";
69
+ }>;
70
+ }, z.core.$strip>;
71
+ }>, SectionDefinitionOf<"services", readonly ["menu", "cards", "index", "carousel"], z.ZodMiniObject<{
72
+ source: z.ZodMiniEnum<{
73
+ all: "all";
74
+ pick: "pick";
75
+ }>;
76
+ groupBy: z.ZodMiniEnum<{
77
+ category: "category";
78
+ none: "none";
79
+ }>;
80
+ columns: z.ZodMiniUnion<[z.ZodMiniLiteral<1 | 2>, z.ZodMiniLiteral<1 | 2>]>;
81
+ aside: z.ZodMiniEnum<{
82
+ none: "none";
83
+ hours: "hours";
84
+ }>;
85
+ }, z.core.$strip>, {
86
+ service: z.ZodMiniObject<{
87
+ serviceId: z.ZodMiniString<string>;
88
+ }, z.core.$strip>;
89
+ }>, SectionDefinitionOf<"booking", readonly ["strip", "panel", "closing", "sticky"], z.ZodMiniObject<{
90
+ serviceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
91
+ count: z.ZodMiniUnion<[z.ZodMiniLiteral<3 | 4 | 6>, z.ZodMiniLiteral<3 | 4 | 6>]>;
92
+ }, z.core.$strip>, Record<never, never>>, SectionDefinitionOf<"gallery", readonly ["mosaic", "filmstrip", "wall", "grid"], z.ZodMiniObject<{
93
+ source: z.ZodMiniEnum<{
94
+ all: "all";
95
+ pick: "pick";
96
+ }>;
97
+ texture: z.ZodMiniEnum<{
98
+ plaster: "plaster";
99
+ brick: "brick";
100
+ ridge: "ridge";
101
+ zellige: "zellige";
102
+ }>;
103
+ }, z.core.$strip>, {
104
+ photo: z.ZodMiniObject<{
105
+ mediaId: z.ZodMiniString<string>;
106
+ caption: z.ZodMiniOptional<z.ZodMiniString<string>>;
107
+ }, z.core.$strip>;
108
+ note: z.ZodMiniObject<{
109
+ text: z.ZodMiniString<string>;
110
+ signature: z.ZodMiniOptional<z.ZodMiniString<string>>;
111
+ }, z.core.$strip>;
112
+ sign: z.ZodMiniObject<{}, z.core.$strip>;
113
+ }>, SectionDefinitionOf<"video", readonly ["tv", "shorts"], z.ZodMiniObject<{
114
+ cabinet: z.ZodMiniEnum<{
115
+ cabinet: "cabinet";
116
+ portable: "portable";
117
+ }>;
118
+ channel: z.ZodMiniOptional<z.ZodMiniString<string>>;
119
+ }, z.core.$strip>, {
120
+ reel: z.ZodMiniObject<{
121
+ platform: z.ZodMiniEnum<{
122
+ tiktok: "tiktok";
123
+ "youtube-shorts": "youtube-shorts";
124
+ instagram: "instagram";
125
+ }>;
126
+ url: z.ZodMiniString<string>;
127
+ }, z.core.$strip>;
128
+ }>, SectionDefinitionOf<"reviews", readonly ["summary-cards", "quote", "strip"], z.ZodMiniObject<{
129
+ rule: z.ZodMiniEnum<{
130
+ best: "best";
131
+ latest: "latest";
132
+ }>;
133
+ count: z.ZodMiniUnion<[z.ZodMiniLiteral<3 | 1 | 2>, z.ZodMiniLiteral<3 | 1 | 2>]>;
134
+ }, z.core.$strip>, Record<never, never>>, SectionDefinitionOf<"bulletin", readonly ["board", "banner"], z.ZodMiniObject<{}, z.core.$strip>, {
135
+ flyer: z.ZodMiniObject<{
136
+ text: z.ZodMiniString<string>;
137
+ signature: z.ZodMiniOptional<z.ZodMiniString<string>>;
138
+ until: z.ZodMiniOptional<z.ZodMiniString<string>>;
139
+ }, z.core.$strip>;
140
+ }>, SectionDefinitionOf<"team", readonly ["row", "cards"], z.ZodMiniObject<{
141
+ source: z.ZodMiniEnum<{
142
+ all: "all";
143
+ pick: "pick";
144
+ }>;
145
+ }, z.core.$strip>, {
146
+ member: z.ZodMiniObject<{
147
+ memberId: z.ZodMiniString<string>;
148
+ }, z.core.$strip>;
149
+ }>, SectionDefinitionOf<"visit", readonly ["card", "map", "split"], z.ZodMiniObject<{
150
+ showPhone: z.ZodMiniBoolean<boolean>;
151
+ }, z.core.$strip>, Record<never, never>>, SectionDefinitionOf<"story", readonly ["quote", "owner"], z.ZodMiniObject<{
152
+ body: z.ZodMiniObject<{
153
+ fr: z.ZodMiniOptional<z.ZodMiniString<string>>;
154
+ en: z.ZodMiniOptional<z.ZodMiniString<string>>;
155
+ }, z.core.$strip>;
156
+ }, z.core.$strip>, Record<never, never>>, SectionDefinitionOf<"social", readonly ["links", "facade"], z.ZodMiniObject<{}, z.core.$strip>, {
157
+ link: z.ZodMiniObject<{
158
+ platform: z.ZodMiniEnum<{
159
+ tiktok: "tiktok";
160
+ "youtube-shorts": "youtube-shorts";
161
+ instagram: "instagram";
162
+ }>;
163
+ url: z.ZodMiniString<string>;
164
+ }, z.core.$strip>;
165
+ }>, SectionDefinitionOf<"faq", readonly ["list"], z.ZodMiniObject<{}, z.core.$strip>, {
166
+ question: z.ZodMiniObject<{
167
+ question: z.ZodMiniObject<{
168
+ fr: z.ZodMiniOptional<z.ZodMiniString<string>>;
169
+ en: z.ZodMiniOptional<z.ZodMiniString<string>>;
170
+ }, z.core.$strip>;
171
+ answer: z.ZodMiniObject<{
172
+ fr: z.ZodMiniOptional<z.ZodMiniString<string>>;
173
+ en: z.ZodMiniOptional<z.ZodMiniString<string>>;
174
+ }, z.core.$strip>;
175
+ }, z.core.$strip>;
176
+ }>, SectionDefinitionOf<"policies", readonly ["inline"], z.ZodMiniObject<{
177
+ show: z.ZodMiniArray<z.ZodMiniEnum<{
178
+ cancellation: "cancellation";
179
+ prices: "prices";
180
+ "booking-window": "booking-window";
181
+ }>>;
182
+ }, z.core.$strip>, Record<never, never>>];
183
+ type SectionDefinition = (typeof SECTION_DEFINITIONS)[number];
184
+ type SectionType = SectionDefinition["type"];
185
+ declare const SECTION_TYPES: readonly SectionType[];
186
+ /** The definition of a type. */
187
+ declare function sectionDefinition<T extends SectionType>(type: T): Extract<SectionDefinition, {
188
+ type: T;
189
+ }>;
190
+
191
+ /** The version of the document's format; migrations are pure functions schema n → n + 1 (`migrate.ts`). */
192
+ declare const SHOP_SCHEMA_VERSION = 1;
193
+ /** A look preset by id and version (`@krizaka/tokens`): `salon-atelier`. The mode is the visitor's, never stored. */
194
+ declare const presetRef: z.ZodMiniObject<{
195
+ id: z.ZodMiniString<string>;
196
+ version: z.ZodMiniInt;
197
+ }, z.core.$strip>;
198
+ declare const shopPageSchema: z.ZodMiniObject<{
199
+ schema: z.ZodMiniLiteral<1>;
200
+ preset: z.ZodMiniObject<{
201
+ id: z.ZodMiniString<string>;
202
+ version: z.ZodMiniInt;
203
+ }, z.core.$strip>;
204
+ density: z.ZodMiniOptional<z.ZodMiniEnum<{
205
+ compact: "compact";
206
+ airy: "airy";
207
+ }>>;
208
+ accent: z.ZodMiniOptional<z.ZodMiniString<string>>;
209
+ sections: z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<Readonly<{
210
+ [k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
211
+ }>, z.core.$strip>, ...z.ZodMiniObject<Readonly<{
212
+ [k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
213
+ }>, z.core.$strip>[]], "type">>;
214
+ }, z.core.$strip>;
215
+ /** A section of any type, as parsed: its `settings` and `blocks` are the type's own. */
216
+ type Section = z.output<(typeof SECTION_DEFINITIONS)[number]["schema"]>;
217
+ type ShopPage = {
218
+ schema: typeof SHOP_SCHEMA_VERSION;
219
+ preset: z.output<typeof presetRef>;
220
+ density?: "compact" | "airy" | undefined;
221
+ accent?: string | undefined;
222
+ sections: Section[];
223
+ };
224
+ type SectionOf<T extends SectionType> = Extract<Section, {
225
+ type: T;
226
+ }>;
227
+ type ShopPageIssue = {
228
+ path: string;
229
+ message: string;
230
+ };
231
+ type ShopPageResult = {
232
+ ok: true;
233
+ page: ShopPage;
234
+ } | {
235
+ ok: false;
236
+ issues: ShopPageIssue[];
237
+ };
238
+ /** Validates a document; an invalid one answers every issue with its path (`sections.2.variant`), for a 422. */
239
+ declare function parseShopPage(input: unknown): ShopPageResult;
240
+
241
+ export { SECTION_DEFINITIONS as b, SECTION_TYPES as c, SHOP_SCHEMA_VERSION as d, defineSection as k, shopPageSchema as l, parseShopPage as p, sectionDefinition as s };
242
+ export type { LocalizedText as L, ParsedSection as P, ShopPage as S, Section as a, SectionDefinition as e, SectionOf as f, SectionSpec as g, SectionType as h, ShopPageIssue as i, ShopPageResult as j };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { L as LinkComponent } from '../block-link-BAg4eoZk.js';
3
- import { ShopPhoto } from '../shop.js';
3
+ import { ShopSectionProps, ShopPhoto } from '../shop.js';
4
4
 
5
5
  type BookingVariant = "strip" | "panel" | "closing" | "sticky";
6
6
  /** `closing`: the second action beside « Book » (`Call`, `Directions`): the host chooses it from the shop's settings. */
@@ -15,7 +15,7 @@ type BookingTime = {
15
15
  /** The booking page with this time chosen. */
16
16
  href: string;
17
17
  };
18
- type BookingSectionProps = Omit<React.ComponentProps<"section">, "title"> & {
18
+ type BookingSectionProps = Omit<React.ComponentProps<"section">, "title"> & Pick<ShopSectionProps, "mascot"> & {
19
19
  /** @default "strip" */
20
20
  variant?: BookingVariant;
21
21
  /** `strip`: the next free times, in order (the first `count`). */
@@ -6,7 +6,7 @@ import {
6
6
  } from "../chunk-5D7NMUF6.js";
7
7
  import {
8
8
  ShopSection
9
- } from "../chunk-A7MQPIEG.js";
9
+ } from "../chunk-M3T5RQYV.js";
10
10
  import {
11
11
  Page,
12
12
  cn