@marktiderman/genesis-sites 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +321 -2
- package/dist/assets/form-island.c0f6fac859.js +51 -0
- package/dist/assets/islands.230b20b9c4.js +1 -0
- package/dist/assets/sites-forms.5e6ebf31c3.css +10 -0
- package/dist/assets/sites-forms.css +10 -0
- package/dist/assets/sites.b28b796c6f.css +2 -0
- package/dist/assets/sites.css +2 -0
- package/dist/blocks.d.ts +13 -0
- package/dist/blocks.js +22 -0
- package/dist/blocks.js.map +1 -0
- package/dist/chunk-43XUAO63.js +1255 -0
- package/dist/chunk-43XUAO63.js.map +1 -0
- package/dist/chunk-GA7U3CIN.js +658 -0
- package/dist/chunk-GA7U3CIN.js.map +1 -0
- package/dist/chunk-KEF3V5ZN.js +499 -0
- package/dist/chunk-KEF3V5ZN.js.map +1 -0
- package/dist/index.d.ts +240 -0
- package/dist/index.js +252 -0
- package/dist/index.js.map +1 -0
- package/dist/registry-CdgVymsu.d.ts +764 -0
- package/dist/sections.d.ts +386 -0
- package/dist/sections.js +4 -0
- package/dist/sections.js.map +1 -0
- package/dist/store-BzGw2i5J.d.ts +377 -0
- package/dist/supabase.d.ts +41 -0
- package/dist/supabase.js +174 -0
- package/dist/supabase.js.map +1 -0
- package/dist/web.d.ts +118 -0
- package/dist/web.js +355 -0
- package/dist/web.js.map +1 -0
- package/migrations/0001_genesis_sites.sql +763 -0
- package/migrations/tests/0001_genesis_sites.test.sql +320 -0
- package/package.json +144 -3
package/dist/web.d.ts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { f as FormsResolver, o as ReleaseSnapshot, R as ReleasePage, q as ResolvedForm } from './registry-CdgVymsu.js';
|
|
2
|
+
import { p as SiteStore, b as BrandSource, R as ReservedPaths, c as FontInfo, q as SiteTheme } from './store-BzGw2i5J.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import '@marktiderman/genesis-design-system';
|
|
6
|
+
|
|
7
|
+
/** Where this package serves its own files, under the site's base path. Reserved for pages. */
|
|
8
|
+
declare const ASSETS_PREFIX = "/_gs";
|
|
9
|
+
interface SiteRequestOptions {
|
|
10
|
+
/** The live path needs only `getLive`; preview needs the draft reads too. */
|
|
11
|
+
store: Pick<SiteStore, "getLive"> & Partial<Pick<SiteStore, "getDraft" | "listPages" | "getPageDraft">>;
|
|
12
|
+
brand: BrandSource;
|
|
13
|
+
/** The site this request is for, resolved by the host from the Host header (or a path). */
|
|
14
|
+
siteId: string;
|
|
15
|
+
/**
|
|
16
|
+
* `live` (default) serves the published release, cached at the CDN.
|
|
17
|
+
* `preview` serves the drafts, `noindex` and `no-store`; the store must be
|
|
18
|
+
* one signed in as the viewer, so the database's `can_view` decides who sees them.
|
|
19
|
+
*/
|
|
20
|
+
mode?: "live" | "preview";
|
|
21
|
+
/**
|
|
22
|
+
* The site's primary origin (`https://riverside.example`) for canonical,
|
|
23
|
+
* Open Graph and sitemap URLs. Default: the request URL's origin. Pass it
|
|
24
|
+
* whenever a site has more than one hostname, so every alias names the same
|
|
25
|
+
* canonical address.
|
|
26
|
+
*/
|
|
27
|
+
origin?: string;
|
|
28
|
+
/** The path the site is mounted under (`/sites-demo`); `""` at the root. */
|
|
29
|
+
basePath?: string;
|
|
30
|
+
/** Paths that belong to the host app; null for them. Default `DEFAULT_RESERVED_PATHS`. */
|
|
31
|
+
reserved?: ReservedPaths;
|
|
32
|
+
/** Resolves a form embed's slug. Without it, form embeds render nothing (and log). */
|
|
33
|
+
forms?: FormsResolver;
|
|
34
|
+
/** Called with the cache tags of every cacheable response, for hosts that set their own cache headers. */
|
|
35
|
+
onPublishedTags?: (tags: string[], info: {
|
|
36
|
+
siteId: string;
|
|
37
|
+
releaseId: string | null;
|
|
38
|
+
path: string;
|
|
39
|
+
status: number;
|
|
40
|
+
}) => void;
|
|
41
|
+
/** An unknown path: `fall-through` (default) returns null; `not-found` serves the site's 404 page. */
|
|
42
|
+
unknownPath?: "fall-through" | "not-found";
|
|
43
|
+
/** Font stylesheets: Google Fonts by default, `false` for none, or a function returning a URL per font. */
|
|
44
|
+
fonts?: false | ((font: FontInfo) => string | null);
|
|
45
|
+
/** A Content-Security-Policy header (default true). */
|
|
46
|
+
csp?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Serve a site request, or return null when the request isn't the site's.
|
|
50
|
+
*
|
|
51
|
+
* @stability Beta
|
|
52
|
+
*/
|
|
53
|
+
declare function handleSiteRequest(request: Request, options: SiteRequestOptions): Promise<Response | null>;
|
|
54
|
+
/**
|
|
55
|
+
* One page as an HTML string (tests, static export, the editor's preview frame).
|
|
56
|
+
*
|
|
57
|
+
* @stability Beta
|
|
58
|
+
*/
|
|
59
|
+
declare function renderSitePageToString(request: Request, options: SiteRequestOptions): Promise<{
|
|
60
|
+
status: number;
|
|
61
|
+
html: string;
|
|
62
|
+
headers: Headers;
|
|
63
|
+
} | null>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* SiteRenderer: one page of a release as a whole HTML document. Server-only
|
|
67
|
+
* output: it is rendered to a string or stream and never hydrated. The only
|
|
68
|
+
* script is the islands loader, and only on a page with a phone menu or a
|
|
69
|
+
* form.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
interface SiteAssets {
|
|
73
|
+
/** The shared stylesheet. */
|
|
74
|
+
css: string;
|
|
75
|
+
/** The form stylesheet, linked only on pages with a form. */
|
|
76
|
+
formsCss: string;
|
|
77
|
+
/** The islands loader. */
|
|
78
|
+
islands: string;
|
|
79
|
+
}
|
|
80
|
+
interface SiteRendererProps {
|
|
81
|
+
snapshot: ReleaseSnapshot;
|
|
82
|
+
/** The page to render, or null for the site's "not found" page. */
|
|
83
|
+
page: ReleasePage | null;
|
|
84
|
+
theme: SiteTheme;
|
|
85
|
+
/** The site's primary origin, for canonical and Open Graph URLs. */
|
|
86
|
+
origin: string;
|
|
87
|
+
/** The path prefix the site is served under (`""` at the root). */
|
|
88
|
+
basePath?: string;
|
|
89
|
+
mode?: "live" | "preview";
|
|
90
|
+
logo?: {
|
|
91
|
+
src: string;
|
|
92
|
+
alt: string;
|
|
93
|
+
};
|
|
94
|
+
/** Forms on the page, already resolved (see `collectFormSlugs`). */
|
|
95
|
+
forms?: ReadonlyMap<string, ResolvedForm | null>;
|
|
96
|
+
/** Asset URLs. */
|
|
97
|
+
assets: SiteAssets;
|
|
98
|
+
/** The stylesheet URL for a font, or null to rely on installed fonts. Default: Google Fonts. */
|
|
99
|
+
fontHref?: ((font: FontInfo) => string | null) | false;
|
|
100
|
+
}
|
|
101
|
+
declare const googleFontHref: (font: FontInfo) => string | null;
|
|
102
|
+
/** The form slugs a page uses, to resolve before rendering: well-formed slugs of visible form embeds in the page body. */
|
|
103
|
+
declare function collectFormSlugs(_snapshot: ReleaseSnapshot, page: ReleasePage | null): string[];
|
|
104
|
+
/**
|
|
105
|
+
* The document for one page.
|
|
106
|
+
*
|
|
107
|
+
* @stability Beta
|
|
108
|
+
*/
|
|
109
|
+
declare function SiteRenderer({ snapshot, page, theme, origin, basePath, mode, logo, forms, assets, fontHref }: SiteRendererProps): React.JSX.Element;
|
|
110
|
+
|
|
111
|
+
declare const ASSET_SIZES: {
|
|
112
|
+
readonly css: 32183;
|
|
113
|
+
readonly formsCss: 72702;
|
|
114
|
+
readonly islands: 2431;
|
|
115
|
+
readonly formIsland: 502065;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export { ASSETS_PREFIX, ASSET_SIZES, type SiteAssets, SiteRenderer, type SiteRendererProps, type SiteRequestOptions, collectFormSlugs, googleFontHref, handleSiteRequest, renderSitePageToString };
|