@marktiderman/genesis-sites 0.4.1 → 0.5.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.
- package/README.md +155 -18
- package/SKILL.md +46 -0
- package/dist/assets/fonts/LICENSES.txt +1469 -0
- package/dist/assets/{form-island.dc9aedd556.js → form-island.c521219f1b.js} +1 -1
- package/dist/assets/{islands.88abb49942.js → islands.f275dc88cb.js} +1 -1
- package/dist/assets/sites-forms.490d10e01b.css +10 -0
- package/dist/assets/sites-forms.css +1 -1
- package/dist/assets/sites.1a40b828a5.css +2 -0
- package/dist/assets/sites.css +1 -1
- package/dist/assets.generated-P7NPIZHO.js +3 -0
- package/dist/{assets.generated-7FRY6LHS.js.map → assets.generated-P7NPIZHO.js.map} +1 -1
- package/dist/{chunk-P5MR34QQ.js → chunk-3XCKSU4Z.js} +143 -85
- package/dist/chunk-3XCKSU4Z.js.map +1 -0
- package/dist/{chunk-PN2VXOA5.js → chunk-BJ6NXVZI.js} +9 -8
- package/dist/chunk-BJ6NXVZI.js.map +1 -0
- package/dist/{chunk-3VKTBE7S.js → chunk-MU2Z2C4F.js} +2 -2
- package/dist/{chunk-3VKTBE7S.js.map → chunk-MU2Z2C4F.js.map} +1 -1
- package/dist/chunk-OFJISW3T.js +3 -0
- package/dist/chunk-OFJISW3T.js.map +1 -0
- package/dist/{chunk-FBQF2L7O.js → chunk-VLY75P7W.js} +190 -40
- package/dist/chunk-VLY75P7W.js.map +1 -0
- package/dist/{chunk-PA7IZF4X.js → chunk-VMJ67LCW.js} +97 -28
- package/dist/chunk-VMJ67LCW.js.map +1 -0
- package/dist/{chunk-KPOX7D4S.js → chunk-XOM334IK.js} +5 -5
- package/dist/chunk-XOM334IK.js.map +1 -0
- package/dist/{chunk-ZGWGQGT2.js → chunk-YAASBQTJ.js} +35 -22
- package/dist/chunk-YAASBQTJ.js.map +1 -0
- package/dist/editor.d.ts +5 -3
- package/dist/editor.js +14 -10
- package/dist/editor.js.map +1 -1
- package/dist/fonts.generated-HTXRHNVY.js +4 -0
- package/dist/handler-ESFMOYYF.js +10 -0
- package/dist/{handler-P7RRXR6K.js.map → handler-ESFMOYYF.js.map} +1 -1
- package/dist/import.d.ts +26 -62
- package/dist/import.js +11 -258
- package/dist/import.js.map +1 -1
- package/dist/index.d.ts +10 -95
- package/dist/index.js +5 -4
- package/dist/{registry-HBn1X60x.d.ts → registry-CeSBSfU8.d.ts} +187 -13
- package/dist/sections.d.ts +124 -9
- package/dist/sections.js +3 -3
- package/dist/{store-BXiZeZzH.d.ts → store-CUsfzNmK.d.ts} +42 -119
- package/dist/supabase.d.ts +5 -3
- package/dist/supabase.js +15 -6
- package/dist/supabase.js.map +1 -1
- package/dist/templates-DALVa71A.d.ts +92 -0
- package/dist/templates.d.ts +78 -0
- package/dist/templates.js +146 -0
- package/dist/templates.js.map +1 -0
- package/dist/theme-B3Vh_b-P.d.ts +136 -0
- package/dist/web.d.ts +72 -13
- package/dist/web.js +7 -6
- package/migrations/tests/0001_genesis_sites.test.sql +4 -4
- package/migrations/tests/0002_genesis_sites_posts.test.sql +2 -2
- package/package.json +47 -12
- package/dist/assets/sites-forms.e506c7dda2.css +0 -10
- package/dist/assets/sites.716b4ac1a5.css +0 -2
- package/dist/assets.generated-7FRY6LHS.js +0 -3
- package/dist/chunk-FBQF2L7O.js.map +0 -1
- package/dist/chunk-KPOX7D4S.js.map +0 -1
- package/dist/chunk-P5MR34QQ.js.map +0 -1
- package/dist/chunk-PA7IZF4X.js.map +0 -1
- package/dist/chunk-PN2VXOA5.js.map +0 -1
- package/dist/chunk-ZGWGQGT2.js.map +0 -1
- package/dist/handler-P7RRXR6K.js +0 -9
package/dist/sections.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as SectionDefinition, s as Link, c as RenderContext, f as SectionNode, a8 as Surface, I as Image, m as FileRef, A as AnySectionDefinition } from './registry-CeSBSfU8.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { BandProps } from '@marktiderman/genesis-ui/band';
|
|
5
5
|
import { LucideIcon } from 'lucide-react';
|
|
6
6
|
import { HeaderSlotProps } from '@marktiderman/genesis-forms-web';
|
|
7
|
+
import '@marktiderman/genesis-media';
|
|
7
8
|
|
|
8
9
|
declare const ctaSection: Readonly<SectionDefinition<{
|
|
9
10
|
heading: string;
|
|
@@ -44,7 +45,7 @@ declare const featuresSection: Readonly<SectionDefinition<{
|
|
|
44
45
|
items: {
|
|
45
46
|
title: string;
|
|
46
47
|
body: string;
|
|
47
|
-
icon?: "check" | "message" | "target" | "activity" | "award" | "calendar" | "clock" | "dumbbell" | "heart" | "leaf" | "mail" | "map-pin" | "
|
|
48
|
+
icon?: "check" | "message" | "phone" | "target" | "activity" | "award" | "calendar" | "clock" | "dumbbell" | "heart" | "leaf" | "mail" | "map-pin" | "shield" | "smile" | "sparkles" | "star" | "trophy" | "users" | "zap" | undefined;
|
|
48
49
|
image?: {
|
|
49
50
|
src: string;
|
|
50
51
|
alt: string;
|
|
@@ -55,6 +56,16 @@ declare const featuresSection: Readonly<SectionDefinition<{
|
|
|
55
56
|
x: number;
|
|
56
57
|
y: number;
|
|
57
58
|
} | undefined;
|
|
59
|
+
phone?: {
|
|
60
|
+
src: string;
|
|
61
|
+
width?: number | undefined;
|
|
62
|
+
height?: number | undefined;
|
|
63
|
+
focal?: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
} | undefined;
|
|
67
|
+
} | undefined;
|
|
68
|
+
placeholder?: string | undefined;
|
|
58
69
|
} | undefined;
|
|
59
70
|
link?: {
|
|
60
71
|
label: string;
|
|
@@ -134,6 +145,16 @@ declare const gallerySection: Readonly<SectionDefinition<{
|
|
|
134
145
|
x: number;
|
|
135
146
|
y: number;
|
|
136
147
|
} | undefined;
|
|
148
|
+
phone?: {
|
|
149
|
+
src: string;
|
|
150
|
+
width?: number | undefined;
|
|
151
|
+
height?: number | undefined;
|
|
152
|
+
focal?: {
|
|
153
|
+
x: number;
|
|
154
|
+
y: number;
|
|
155
|
+
} | undefined;
|
|
156
|
+
} | undefined;
|
|
157
|
+
placeholder?: string | undefined;
|
|
137
158
|
caption?: string | undefined;
|
|
138
159
|
}[];
|
|
139
160
|
surface: "base" | "muted" | "accent" | "inverse";
|
|
@@ -172,6 +193,16 @@ declare const heroSection: Readonly<SectionDefinition<{
|
|
|
172
193
|
x: number;
|
|
173
194
|
y: number;
|
|
174
195
|
} | undefined;
|
|
196
|
+
phone?: {
|
|
197
|
+
src: string;
|
|
198
|
+
width?: number | undefined;
|
|
199
|
+
height?: number | undefined;
|
|
200
|
+
focal?: {
|
|
201
|
+
x: number;
|
|
202
|
+
y: number;
|
|
203
|
+
} | undefined;
|
|
204
|
+
} | undefined;
|
|
205
|
+
placeholder?: string | undefined;
|
|
175
206
|
} | undefined;
|
|
176
207
|
anchor?: string | undefined;
|
|
177
208
|
}>>;
|
|
@@ -189,6 +220,16 @@ declare const logosSection: Readonly<SectionDefinition<{
|
|
|
189
220
|
x: number;
|
|
190
221
|
y: number;
|
|
191
222
|
} | undefined;
|
|
223
|
+
phone?: {
|
|
224
|
+
src: string;
|
|
225
|
+
width?: number | undefined;
|
|
226
|
+
height?: number | undefined;
|
|
227
|
+
focal?: {
|
|
228
|
+
x: number;
|
|
229
|
+
y: number;
|
|
230
|
+
} | undefined;
|
|
231
|
+
} | undefined;
|
|
232
|
+
placeholder?: string | undefined;
|
|
192
233
|
} | undefined;
|
|
193
234
|
href?: string | undefined;
|
|
194
235
|
}[];
|
|
@@ -210,6 +251,16 @@ declare const navSection: Readonly<SectionDefinition<{
|
|
|
210
251
|
x: number;
|
|
211
252
|
y: number;
|
|
212
253
|
} | undefined;
|
|
254
|
+
phone?: {
|
|
255
|
+
src: string;
|
|
256
|
+
width?: number | undefined;
|
|
257
|
+
height?: number | undefined;
|
|
258
|
+
focal?: {
|
|
259
|
+
x: number;
|
|
260
|
+
y: number;
|
|
261
|
+
} | undefined;
|
|
262
|
+
} | undefined;
|
|
263
|
+
placeholder?: string | undefined;
|
|
213
264
|
} | undefined;
|
|
214
265
|
cta?: {
|
|
215
266
|
label: string;
|
|
@@ -307,6 +358,16 @@ declare const testimonialsSection: Readonly<SectionDefinition<{
|
|
|
307
358
|
x: number;
|
|
308
359
|
y: number;
|
|
309
360
|
} | undefined;
|
|
361
|
+
phone?: {
|
|
362
|
+
src: string;
|
|
363
|
+
width?: number | undefined;
|
|
364
|
+
height?: number | undefined;
|
|
365
|
+
focal?: {
|
|
366
|
+
x: number;
|
|
367
|
+
y: number;
|
|
368
|
+
} | undefined;
|
|
369
|
+
} | undefined;
|
|
370
|
+
placeholder?: string | undefined;
|
|
310
371
|
} | undefined;
|
|
311
372
|
}[];
|
|
312
373
|
surface: "base" | "muted" | "accent" | "inverse";
|
|
@@ -391,6 +452,16 @@ declare const schema: z.ZodObject<{
|
|
|
391
452
|
x: z.ZodNumber;
|
|
392
453
|
y: z.ZodNumber;
|
|
393
454
|
}, z.core.$strip>>;
|
|
455
|
+
phone: z.ZodOptional<z.ZodObject<{
|
|
456
|
+
src: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
457
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
458
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
459
|
+
focal: z.ZodOptional<z.ZodObject<{
|
|
460
|
+
x: z.ZodNumber;
|
|
461
|
+
y: z.ZodNumber;
|
|
462
|
+
}, z.core.$strip>>;
|
|
463
|
+
}, z.core.$strip>>;
|
|
464
|
+
placeholder: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
|
|
394
465
|
}, z.core.$strip>>;
|
|
395
466
|
contact: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
396
467
|
label: z.ZodString;
|
|
@@ -471,6 +542,16 @@ declare const mapSection: Readonly<SectionDefinition<{
|
|
|
471
542
|
x: number;
|
|
472
543
|
y: number;
|
|
473
544
|
} | undefined;
|
|
545
|
+
phone?: {
|
|
546
|
+
src: string;
|
|
547
|
+
width?: number | undefined;
|
|
548
|
+
height?: number | undefined;
|
|
549
|
+
focal?: {
|
|
550
|
+
x: number;
|
|
551
|
+
y: number;
|
|
552
|
+
} | undefined;
|
|
553
|
+
} | undefined;
|
|
554
|
+
placeholder?: string | undefined;
|
|
474
555
|
} | undefined;
|
|
475
556
|
primaryCta?: {
|
|
476
557
|
label: string;
|
|
@@ -502,7 +583,7 @@ declare const postBodySection: Readonly<SectionDefinition<{
|
|
|
502
583
|
|
|
503
584
|
declare const WEEKDAYS: readonly ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
504
585
|
type Weekday = (typeof WEEKDAYS)[number];
|
|
505
|
-
/** How a
|
|
586
|
+
/** How a session type's chip is drawn, from the brand's own colours. */
|
|
506
587
|
declare const CHIP_TONES: readonly ["primary", "inverse", "soft", "outline", "plain"];
|
|
507
588
|
declare const Session: z.ZodObject<{
|
|
508
589
|
day: z.ZodEnum<{
|
|
@@ -567,6 +648,10 @@ declare const scheduleSection: Readonly<SectionDefinition<{
|
|
|
567
648
|
} | undefined;
|
|
568
649
|
}[];
|
|
569
650
|
emptyText: string;
|
|
651
|
+
labels: {
|
|
652
|
+
items: string;
|
|
653
|
+
types: string;
|
|
654
|
+
};
|
|
570
655
|
surface: "base" | "muted" | "accent" | "inverse";
|
|
571
656
|
eyebrow?: string | undefined;
|
|
572
657
|
body?: string | undefined;
|
|
@@ -591,6 +676,16 @@ declare const teamSection: Readonly<SectionDefinition<{
|
|
|
591
676
|
x: number;
|
|
592
677
|
y: number;
|
|
593
678
|
} | undefined;
|
|
679
|
+
phone?: {
|
|
680
|
+
src: string;
|
|
681
|
+
width?: number | undefined;
|
|
682
|
+
height?: number | undefined;
|
|
683
|
+
focal?: {
|
|
684
|
+
x: number;
|
|
685
|
+
y: number;
|
|
686
|
+
} | undefined;
|
|
687
|
+
} | undefined;
|
|
688
|
+
placeholder?: string | undefined;
|
|
594
689
|
} | undefined;
|
|
595
690
|
summary?: string | undefined;
|
|
596
691
|
bio?: string | undefined;
|
|
@@ -632,6 +727,16 @@ declare const timelineSection: Readonly<SectionDefinition<{
|
|
|
632
727
|
x: number;
|
|
633
728
|
y: number;
|
|
634
729
|
} | undefined;
|
|
730
|
+
phone?: {
|
|
731
|
+
src: string;
|
|
732
|
+
width?: number | undefined;
|
|
733
|
+
height?: number | undefined;
|
|
734
|
+
focal?: {
|
|
735
|
+
x: number;
|
|
736
|
+
y: number;
|
|
737
|
+
} | undefined;
|
|
738
|
+
} | undefined;
|
|
739
|
+
placeholder?: string | undefined;
|
|
635
740
|
} | undefined;
|
|
636
741
|
cta?: {
|
|
637
742
|
label: string;
|
|
@@ -685,6 +790,7 @@ type IconName = keyof typeof ICONS;
|
|
|
685
790
|
declare const IconName: z.ZodEnum<{
|
|
686
791
|
check: "check";
|
|
687
792
|
message: "message";
|
|
793
|
+
phone: "phone";
|
|
688
794
|
target: "target";
|
|
689
795
|
activity: "activity";
|
|
690
796
|
award: "award";
|
|
@@ -695,7 +801,6 @@ declare const IconName: z.ZodEnum<{
|
|
|
695
801
|
leaf: "leaf";
|
|
696
802
|
mail: "mail";
|
|
697
803
|
"map-pin": "map-pin";
|
|
698
|
-
phone: "phone";
|
|
699
804
|
shield: "shield";
|
|
700
805
|
smile: "smile";
|
|
701
806
|
sparkles: "sparkles";
|
|
@@ -739,14 +844,24 @@ declare function fileHref(file: FileRef, ctx: RenderContext): string | null;
|
|
|
739
844
|
interface SiteImageProps {
|
|
740
845
|
image: Image;
|
|
741
846
|
className?: string;
|
|
742
|
-
/**
|
|
847
|
+
/** How wide the image shows, for the browser's pick from the `srcset` (only sent with one). */
|
|
743
848
|
sizes?: string;
|
|
744
|
-
/**
|
|
745
|
-
|
|
849
|
+
/**
|
|
850
|
+
* A large image (a hero, a half-width photo): the page's first one loads at
|
|
851
|
+
* once at high priority, the rest lazily.
|
|
852
|
+
*/
|
|
853
|
+
large?: boolean;
|
|
854
|
+
/** Loads at once at normal priority, never lazily (the header's logo). */
|
|
855
|
+
eager?: boolean;
|
|
746
856
|
ctx: RenderContext;
|
|
747
857
|
}
|
|
748
|
-
/**
|
|
749
|
-
|
|
858
|
+
/**
|
|
859
|
+
* An image with alt text (empty when decorative), its size to stop layout
|
|
860
|
+
* shift, a `srcset` through the host's image URL builder, the focal point as
|
|
861
|
+
* `object-position`, a phone crop as a `<picture>` source, and lazy loading
|
|
862
|
+
* except for the page's first large image.
|
|
863
|
+
*/
|
|
864
|
+
declare function SiteImage({ image, className, sizes, large, eager, ctx }: SiteImageProps): React.JSX.Element | null;
|
|
750
865
|
/** The section's title, at the level the page gives it (h1 for the page's main heading). */
|
|
751
866
|
declare function SectionTitle({ ctx, id, size, className, children }: {
|
|
752
867
|
ctx: RenderContext;
|
package/dist/sections.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { Anchor, ButtonLink, CHIP_TONES, HiddenTitle, ICONS, IconName, ItemTitle, MAP_PROVIDERS, SectionBand, SectionIntro, SectionTitle, SiteFormHeader, SiteImage, TextLink, WEEKDAYS, blogListSection, builtInSections, ctaSection, faqSection, featuresSection, fileDescription, fileHref, fileSection, footerSection, formEmbedSection, formatPostDate, formatTime, gallerySection, heroSection, linkAttrs, logosSection, mapEmbedUrl, mapPageUrl, mapSection, navSection, postBodySection, pricingSection, resolveHref, richTextSection, scheduleSection, siteFormSlots, statsSection, teamSection, testimonialsSection, timelineSection, titleId } from './chunk-
|
|
1
|
+
export { Anchor, ButtonLink, CHIP_TONES, HiddenTitle, ICONS, IconName, ItemTitle, MAP_PROVIDERS, SectionBand, SectionIntro, SectionTitle, SiteFormHeader, SiteImage, TextLink, WEEKDAYS, blogListSection, builtInSections, ctaSection, faqSection, featuresSection, fileDescription, fileHref, fileSection, footerSection, formEmbedSection, formatPostDate, formatTime, gallerySection, heroSection, linkAttrs, logosSection, mapEmbedUrl, mapPageUrl, mapSection, navSection, postBodySection, pricingSection, resolveHref, richTextSection, scheduleSection, siteFormSlots, statsSection, teamSection, testimonialsSection, timelineSection, titleId } from './chunk-3XCKSU4Z.js';
|
|
2
2
|
import './chunk-VZUDRPFG.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
import './chunk-YAASBQTJ.js';
|
|
4
|
+
import './chunk-MU2Z2C4F.js';
|
|
5
5
|
//# sourceMappingURL=sections.js.map
|
|
6
6
|
//# sourceMappingURL=sections.js.map
|
|
@@ -1,119 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A site's theme, from its brand: one `<style>` of CSS variables per site.
|
|
6
|
-
*
|
|
7
|
-
* The brand comes from the host (`BrandSource`) at render time, never copied
|
|
8
|
-
* into the site. A publish checks the brand's colours and records its hash;
|
|
9
|
-
* a page rendered with a different brand (edited since) is served with a
|
|
10
|
-
* short cache and a warning until the site is published again, which checks
|
|
11
|
-
* the new colours and purges the old pages. It
|
|
12
|
-
* may be a full `CanonicalBrand` or the minimal shape a brand screen collects
|
|
13
|
-
* (`SiteBrand`: a name, a primary colour for light and dark, a heading and a
|
|
14
|
-
* body font from a fixed list, a logo).
|
|
15
|
-
*
|
|
16
|
-
* The variables are design-system `themeFromBrand(brand).variables` (the
|
|
17
|
-
* brand's scales, `--color-*`) plus the genesis-ui roles the sections are
|
|
18
|
-
* styled with (`--primary`, `--background`, `--font-display`, ...), so the
|
|
19
|
-
* one shared stylesheet serves every brand. Foregrounds are picked for
|
|
20
|
-
* contrast: the text on a primary button is whichever of the brand's light
|
|
21
|
-
* or dark text reads better, and the focus ring falls back to the text
|
|
22
|
-
* colour when the primary is too faint on the page.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/** The minimal brand: what a brand screen collects. */
|
|
26
|
-
interface SiteBrand {
|
|
27
|
-
name: string;
|
|
28
|
-
colors: {
|
|
29
|
-
/** The primary colour in light mode, as #rrggbb. */
|
|
30
|
-
primary: string;
|
|
31
|
-
/** The primary in dark mode. Default: the light primary, lightened. */
|
|
32
|
-
primaryDark?: string;
|
|
33
|
-
};
|
|
34
|
-
fonts?: {
|
|
35
|
-
heading?: FontChoice;
|
|
36
|
-
body?: FontChoice;
|
|
37
|
-
};
|
|
38
|
-
/** The logo, shown in the header and footer and named in JSON-LD. */
|
|
39
|
-
logo?: {
|
|
40
|
-
src: string;
|
|
41
|
-
alt?: string;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/** What a `BrandSource` may return: the minimal brand, or a full design-system brand (with an optional logo). */
|
|
45
|
-
type BrandInput = SiteBrand | (CanonicalBrand & {
|
|
46
|
-
logo?: {
|
|
47
|
-
src: string;
|
|
48
|
-
alt?: string;
|
|
49
|
-
};
|
|
50
|
-
displayName?: string;
|
|
51
|
-
});
|
|
52
|
-
/** The host's brand, read at render time. */
|
|
53
|
-
interface BrandSource {
|
|
54
|
-
getBrand(siteId: string): Promise<BrandInput | null> | BrandInput | null;
|
|
55
|
-
}
|
|
56
|
-
interface FontInfo {
|
|
57
|
-
label: string;
|
|
58
|
-
/** The CSS font stack. */
|
|
59
|
-
stack: string;
|
|
60
|
-
/** The Google Fonts `family=` value, when it isn't a system font. */
|
|
61
|
-
google?: string;
|
|
62
|
-
}
|
|
63
|
-
/** The fonts a brand or site may choose. */
|
|
64
|
-
declare const FONT_CHOICES: Readonly<Record<FontChoice, FontInfo>>;
|
|
65
|
-
/** `#abc` / `#aabbcc` → [r, g, b] (0–255). Throws on anything else. */
|
|
66
|
-
declare function parseHex(hex: string): [number, number, number];
|
|
67
|
-
/** WCAG relative luminance. */
|
|
68
|
-
declare function luminance(hex: string): number;
|
|
69
|
-
/** WCAG contrast ratio (1–21) of two colours. */
|
|
70
|
-
declare function contrastRatio(a: string, b: string): number;
|
|
71
|
-
/** Mix a colour toward white (`amount` > 0) or black (< 0), 0–1. */
|
|
72
|
-
declare function mix(hex: string, amount: number): string;
|
|
73
|
-
/** `#4f46e5` → `243 75% 59%`: the HSL triplet genesis-ui's variables hold. */
|
|
74
|
-
declare function hexToHslTriplet(hex: string): string;
|
|
75
|
-
declare function isSiteBrand(brand: BrandInput): brand is SiteBrand;
|
|
76
|
-
/** The minimal brand as a design-system brand (Genesis's neutrals and status colours, the brand's primary and fonts). */
|
|
77
|
-
declare function toCanonicalBrand(brand: BrandInput): CanonicalBrand;
|
|
78
|
-
/** The brand's display name: the minimal brand's `name`, a canonical brand's `displayName` or `name`. */
|
|
79
|
-
declare function brandDisplayName(brand: BrandInput): string;
|
|
80
|
-
interface ThemePair {
|
|
81
|
-
/** What the pair is, for an accessibility issue: "body text on the page". */
|
|
82
|
-
name: string;
|
|
83
|
-
mode: "light" | "dark";
|
|
84
|
-
foreground: string;
|
|
85
|
-
background: string;
|
|
86
|
-
/** The ratio it must reach: 4.5 for text, 3 for the focus ring and other non-text marks. */
|
|
87
|
-
minimum: number;
|
|
88
|
-
/**
|
|
89
|
-
* `error` (default) blocks the publish; `warning` is shown but doesn't. A
|
|
90
|
-
* mark that never carries meaning alone (each one also has text or a shape)
|
|
91
|
-
* warns, so a light brand colour can still publish.
|
|
92
|
-
*/
|
|
93
|
-
severity?: "error" | "warning";
|
|
94
|
-
}
|
|
95
|
-
interface SiteTheme {
|
|
96
|
-
light: Record<string, string>;
|
|
97
|
-
dark: Record<string, string>;
|
|
98
|
-
colorScheme: "light" | "dark" | "auto";
|
|
99
|
-
/** The fonts the site uses, to load. */
|
|
100
|
-
fonts: FontInfo[];
|
|
101
|
-
/** The colour pairs the sections draw, for the contrast check. */
|
|
102
|
-
pairs: ThemePair[];
|
|
103
|
-
/** Hash of the brand and overrides it was made from (recorded on a release). */
|
|
104
|
-
brandHash: string;
|
|
105
|
-
}
|
|
106
|
-
/** FNV-1a, 32 bits twice: a short, stable hash for cache keys and release records (not for security). */
|
|
107
|
-
declare function stableHash(value: unknown): string;
|
|
108
|
-
/**
|
|
109
|
-
* The site's theme: variables for light and dark, the fonts to load, the
|
|
110
|
-
* pairs the contrast check reads, and a hash of what it was made from.
|
|
111
|
-
*
|
|
112
|
-
* @stability Beta
|
|
113
|
-
*/
|
|
114
|
-
declare function siteTheme(brand: BrandInput, theme?: Partial<SiteDoc["theme"]>): SiteTheme;
|
|
115
|
-
/** The site's `<style>` body: the light variables on `:root`, the dark ones by scheme. */
|
|
116
|
-
declare function themeCss(theme: SiteTheme): string;
|
|
1
|
+
import { A as AnySectionDefinition, U as ReleaseSnapshot, h as ReleasePage, g as SiteDoc, R as Release, b as PageMeta, a as PageDoc, P as PageKind, T as ReleaseMeta, i as PostSummary, L as LivePost, G as PostMeta, E as PostDraft, Y as SavePostInput, Z as SavePostResult, p as ImportPost, q as ImportPostsResult, a7 as SiteDocInput, z as PostDoc, K as PostStatus } from './registry-CeSBSfU8.js';
|
|
2
|
+
import { b as SiteTheme, B as BrandInput } from './theme-B3Vh_b-P.js';
|
|
117
3
|
|
|
118
4
|
/**
|
|
119
5
|
* URL and path rules shared by the schemas, the renderer and the database.
|
|
@@ -135,7 +21,7 @@ declare function isSafeImageSrc(value: unknown): value is string;
|
|
|
135
21
|
declare function isExternalHref(href: string): boolean;
|
|
136
22
|
/**
|
|
137
23
|
* A page's path: `/`, or lowercase segments of letters, digits and hyphens
|
|
138
|
-
* (`/about`, `/
|
|
24
|
+
* (`/about`, `/services/repairs`). No trailing slash, no dots, at most 8
|
|
139
25
|
* segments and 200 characters. The database checks the same pattern.
|
|
140
26
|
*/
|
|
141
27
|
declare const PAGE_PATH: RegExp;
|
|
@@ -173,6 +59,20 @@ interface SiteIssue {
|
|
|
173
59
|
}
|
|
174
60
|
declare const isPublishable: (issues: readonly SiteIssue[]) => boolean;
|
|
175
61
|
type Lookup = (type: string) => AnySectionDefinition | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Is this URL the site's own: a site path (`/photo.jpg`), or a URL on one of
|
|
64
|
+
* `origins` (the store's asset origin)?
|
|
65
|
+
*
|
|
66
|
+
* @stability Beta
|
|
67
|
+
*/
|
|
68
|
+
declare function isOwnUrl(src: string, origins?: readonly string[]): boolean;
|
|
69
|
+
/** Where files may load from, for the host check. */
|
|
70
|
+
interface AssetHostOptions {
|
|
71
|
+
/** `"own"`: a file elsewhere is an error. Default: a warning. */
|
|
72
|
+
images?: "any" | "own";
|
|
73
|
+
/** Origins that count as the site's own besides its paths: the store's asset origin (`SiteStore.assetOrigin`). */
|
|
74
|
+
assetOrigins?: readonly string[];
|
|
75
|
+
}
|
|
176
76
|
/** Issues on one page: its sections, limits and the h1. */
|
|
177
77
|
declare function checkPage(page: ReleasePage, lookup?: Lookup, reserved?: ReservedPaths): SiteIssue[];
|
|
178
78
|
/** Issues with the site's own parts: header, footer, redirects. */
|
|
@@ -182,6 +82,10 @@ declare function checkContrast(theme: SiteTheme): SiteIssue[];
|
|
|
182
82
|
interface CheckReleaseOptions {
|
|
183
83
|
/** The brand's theme: adds the contrast check. */
|
|
184
84
|
theme?: SiteTheme;
|
|
85
|
+
/** Origins that count as the site's own besides its paths: the store's asset origin. */
|
|
86
|
+
assetOrigins?: readonly string[];
|
|
87
|
+
/** The brand's logo, which every page shows: checked for where it loads from, like an image. */
|
|
88
|
+
logo?: string;
|
|
185
89
|
lookup?: Lookup;
|
|
186
90
|
reserved?: ReservedPaths;
|
|
187
91
|
}
|
|
@@ -191,6 +95,14 @@ interface CheckReleaseOptions {
|
|
|
191
95
|
* @stability Beta
|
|
192
96
|
*/
|
|
193
97
|
declare function checkRelease(snapshot: ReleaseSnapshot, options?: CheckReleaseOptions): SiteIssue[];
|
|
98
|
+
/**
|
|
99
|
+
* Images and files that load from somewhere other than the site itself or
|
|
100
|
+
* the store's asset origin: a warning, or an error when the site serves only
|
|
101
|
+
* its own (`images: "own"`), whose Content-Security-Policy would block them.
|
|
102
|
+
*
|
|
103
|
+
* @stability Beta
|
|
104
|
+
*/
|
|
105
|
+
declare function checkAssetHosts(snapshot: ReleaseSnapshot, options?: Pick<CheckReleaseOptions, "assetOrigins" | "logo" | "lookup">): SiteIssue[];
|
|
194
106
|
/** The blog's rules: one post page, not the home page, with a post-body section; a post list needs a post page. */
|
|
195
107
|
declare function checkBlog(snapshot: ReleaseSnapshot, lookup?: Lookup): SiteIssue[];
|
|
196
108
|
/**
|
|
@@ -200,7 +112,7 @@ declare function checkBlog(snapshot: ReleaseSnapshot, lookup?: Lookup): SiteIssu
|
|
|
200
112
|
*
|
|
201
113
|
* @stability Beta
|
|
202
114
|
*/
|
|
203
|
-
declare function checkPost(slug: string, doc: unknown): SiteIssue[];
|
|
115
|
+
declare function checkPost(slug: string, doc: unknown, hosts?: AssetHostOptions): SiteIssue[];
|
|
204
116
|
/**
|
|
205
117
|
* A rendered page's outline, from its HTML: one `h1`, no skipped heading
|
|
206
118
|
* level, every `<img>` with an `alt` attribute. For tests and for hosts that
|
|
@@ -259,6 +171,11 @@ interface PublishOptions {
|
|
|
259
171
|
/** The brand to check contrast against (and record the hash of). Required: a publish without it is blocked. */
|
|
260
172
|
brand?: BrandInput | null;
|
|
261
173
|
reserved?: ReservedPaths;
|
|
174
|
+
/**
|
|
175
|
+
* Origins that count as the site's own besides its paths, for the check on
|
|
176
|
+
* where images load from. A store adds its own `assetOrigin`.
|
|
177
|
+
*/
|
|
178
|
+
assetOrigins?: readonly string[];
|
|
262
179
|
}
|
|
263
180
|
interface NewPage {
|
|
264
181
|
path: string;
|
|
@@ -304,6 +221,12 @@ interface SiteStore {
|
|
|
304
221
|
listReleases(siteId: string): Promise<ReleaseMeta[]>;
|
|
305
222
|
/** Store an upload under `sites/<siteId>/...` (a PDF under `files/`) and record it. Images and PDF only. */
|
|
306
223
|
putAsset?(siteId: string, file: Blob, meta?: AssetMeta): Promise<Asset>;
|
|
224
|
+
/**
|
|
225
|
+
* The origin `putAsset` URLs live on (`https://project.supabase.co`), when
|
|
226
|
+
* it isn't the site's own. The publish checks and the page's
|
|
227
|
+
* Content-Security-Policy treat it as the site's own.
|
|
228
|
+
*/
|
|
229
|
+
readonly assetOrigin?: string;
|
|
307
230
|
/** The published posts, newest first, without bodies (at most `MAX_LIVE_POSTS`). Public, like `getLive`. */
|
|
308
231
|
listLivePosts?(siteId: string): Promise<PostSummary[]>;
|
|
309
232
|
/** One published post. Public, like `getLive`. Null for a draft, an unknown slug, or a site that isn't live. */
|
|
@@ -440,4 +363,4 @@ interface MemoryStoreOptions {
|
|
|
440
363
|
*/
|
|
441
364
|
declare function createMemorySiteStore(options?: MemoryStoreOptions): MemorySiteStore;
|
|
442
365
|
|
|
443
|
-
export {
|
|
366
|
+
export { type Asset as A, isConflict as B, type CheckReleaseOptions as C, DEFAULT_RESERVED_PATHS as D, isExternalHref as E, isOwnUrl as F, isPublishable as G, isReservedPath as H, type InvalidationInfo as I, isSafeHref as J, isSafeImageSrc as K, normalizeRequestPath as L, MAX_PAGE_PATH_LENGTH as M, type NewPage as N, pagePathProblems as O, type PublishOptions as P, prepareImportPost as Q, type ReservedPaths as R, type SiteStore as S, prepareRelease as T, siteCacheTag as U, validatePagePath as V, withCacheInvalidation as W, type AssetMeta as a, type SiteIssue as b, type SaveResult as c, ASSET_TYPES as d, type AssetHostOptions as e, MAX_URL_LENGTH as f, type MemorySiteStore as g, type MemoryStoreOptions as h, type NewSite as i, PAGE_PATH as j, type PageDraft as k, type PreparedRelease as l, PublishBlockedError as m, SiteConflictError as n, type SiteDraft as o, assetPath as p, checkAssetHosts as q, checkBlog as r, checkContrast as s, checkHtmlOutline as t, checkPage as u, checkPost as v, checkRelease as w, checkSiteDoc as x, createMemorySiteStore as y, formCacheTag as z };
|
package/dist/supabase.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
-
import { S as SiteStore } from './store-
|
|
3
|
-
export {
|
|
4
|
-
import './registry-
|
|
2
|
+
import { S as SiteStore } from './store-CUsfzNmK.js';
|
|
3
|
+
export { d as ASSET_TYPES } from './store-CUsfzNmK.js';
|
|
4
|
+
import './registry-CeSBSfU8.js';
|
|
5
|
+
import '@marktiderman/genesis-media';
|
|
5
6
|
import 'react';
|
|
6
7
|
import 'zod';
|
|
8
|
+
import './theme-B3Vh_b-P.js';
|
|
7
9
|
import '@marktiderman/genesis-design-system';
|
|
8
10
|
|
|
9
11
|
/**
|
package/dist/supabase.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { prepareImportPost, checkPost, isPublishable, PublishBlockedError, assetPath, ASSET_TYPES, prepareRelease } from './chunk-
|
|
2
|
-
export { ASSET_TYPES } from './chunk-
|
|
3
|
-
import { MAX_IMPORT_POSTS, validatePostSlug, PostDoc, PostSummarySchema, PageDoc, SiteDoc, parseSnapshot, ReleaseSnapshot } from './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
import { prepareImportPost, checkPost, isPublishable, PublishBlockedError, assetPath, ASSET_TYPES, prepareRelease } from './chunk-VLY75P7W.js';
|
|
2
|
+
export { ASSET_TYPES } from './chunk-VLY75P7W.js';
|
|
3
|
+
import { MAX_IMPORT_POSTS, validatePostSlug, PostDoc, PostSummarySchema, PageDoc, SiteDoc, parseSnapshot, ReleaseSnapshot } from './chunk-YAASBQTJ.js';
|
|
4
|
+
import './chunk-MU2Z2C4F.js';
|
|
5
5
|
|
|
6
6
|
// src/supabase/index.ts
|
|
7
7
|
var SITES_SCHEMA = "genesis_sites";
|
|
@@ -45,6 +45,13 @@ var fromPostJson = (j) => ({
|
|
|
45
45
|
function createSupabaseSiteStore(client, options = {}) {
|
|
46
46
|
const db = client.schema(SITES_SCHEMA);
|
|
47
47
|
const bucket = options.bucket ?? "site-assets";
|
|
48
|
+
const assetOrigin = (() => {
|
|
49
|
+
try {
|
|
50
|
+
return new URL(client.storage.from(bucket).getPublicUrl("x").data.publicUrl).origin;
|
|
51
|
+
} catch {
|
|
52
|
+
return void 0;
|
|
53
|
+
}
|
|
54
|
+
})();
|
|
48
55
|
async function release(id) {
|
|
49
56
|
const { data, error } = await db.from("site_releases").select("id, site_id, number, note, created_at, published_at, brand_hash, snapshot").eq("id", id).single();
|
|
50
57
|
if (error) fail(error, "reading the release");
|
|
@@ -58,6 +65,7 @@ function createSupabaseSiteStore(client, options = {}) {
|
|
|
58
65
|
return data ?? [];
|
|
59
66
|
}
|
|
60
67
|
const store = {
|
|
68
|
+
...assetOrigin ? { assetOrigin } : {},
|
|
61
69
|
async getLive(siteId) {
|
|
62
70
|
const { data, error } = await db.rpc("live_release", { site_id: siteId });
|
|
63
71
|
if (error) fail(error, "reading the live site");
|
|
@@ -130,7 +138,7 @@ function createSupabaseSiteStore(client, options = {}) {
|
|
|
130
138
|
if (!draft) throw new SiteStoreError(`No site ${siteId} (or you can't see it).`, "P0002");
|
|
131
139
|
const rows = await pageRows(siteId, true);
|
|
132
140
|
const pages = rows.map((r) => ({ id: r.id, path: r.path, kind: r.kind, doc: PageDoc.parse(r.draft), rev: r.draft_rev }));
|
|
133
|
-
const prepared = prepareRelease(draft.site, pages, opts);
|
|
141
|
+
const prepared = prepareRelease(draft.site, pages, { ...opts, assetOrigins: [...assetOrigin ? [assetOrigin] : [], ...opts.assetOrigins ?? []] });
|
|
134
142
|
const revs = Object.fromEntries(pages.map((p) => [p.id, p.rev]));
|
|
135
143
|
let siteRev = draft.rev;
|
|
136
144
|
for (const m of prepared.migratedPages) {
|
|
@@ -234,7 +242,8 @@ function createSupabaseSiteStore(client, options = {}) {
|
|
|
234
242
|
async publishPost(postId) {
|
|
235
243
|
const draft = await store.getPost(postId);
|
|
236
244
|
if (!draft) throw new SiteStoreError(`No post ${postId} (or you can't see it).`, "P0002");
|
|
237
|
-
const
|
|
245
|
+
const images = (await store.getDraft(draft.siteId))?.site.images;
|
|
246
|
+
const issues = checkPost(draft.slug, draft.doc, { ...images ? { images } : {}, ...assetOrigin ? { assetOrigins: [assetOrigin] } : {} });
|
|
238
247
|
if (!isPublishable(issues)) throw new PublishBlockedError(issues);
|
|
239
248
|
const { data, error } = await db.rpc("publish_post", { post_id: postId, expected_rev: draft.rev });
|
|
240
249
|
if (error) fail(error, "publishing the post");
|