@marktiderman/genesis-sites 0.8.0 → 0.9.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/README.md +128 -11
- package/SKILL.md +5 -0
- package/dist/analytics.d.ts +184 -0
- package/dist/analytics.js +3 -0
- package/dist/analytics.js.map +1 -0
- package/dist/assets/{form-island.da6c662a73.js → form-island.c3ffde29b6.js} +3 -3
- package/dist/assets/islands.21a94cdd5a.js +1 -0
- package/dist/assets/sites-forms.b64c156079.css +10 -0
- package/dist/assets/sites-forms.css +1 -1
- package/dist/assets/sites.2fac65f96a.css +2 -0
- package/dist/assets/sites.css +1 -1
- package/dist/assets.generated-7BO4OWC4.js +3 -0
- package/dist/{assets.generated-YGLB7VKL.js.map → assets.generated-7BO4OWC4.js.map} +1 -1
- package/dist/chunk-5RYCQEEE.js +256 -0
- package/dist/chunk-5RYCQEEE.js.map +1 -0
- package/dist/{chunk-MU2Z2C4F.js → chunk-CXBBUKGB.js} +14 -4
- package/dist/chunk-CXBBUKGB.js.map +1 -0
- package/dist/chunk-JC7VNS67.js +19 -0
- package/dist/chunk-JC7VNS67.js.map +1 -0
- package/dist/{chunk-FMQTSXJN.js → chunk-KJUN46FK.js} +60 -19
- package/dist/chunk-KJUN46FK.js.map +1 -0
- package/dist/{chunk-6CXTOPYI.js → chunk-QGU6FDH5.js} +74 -8
- package/dist/chunk-QGU6FDH5.js.map +1 -0
- package/dist/{chunk-I767PDBR.js → chunk-SBONYMUC.js} +38 -15
- package/dist/chunk-SBONYMUC.js.map +1 -0
- package/dist/{chunk-YAMQ2JKO.js → chunk-UOKNFG5O.js} +127 -14
- package/dist/chunk-UOKNFG5O.js.map +1 -0
- package/dist/{chunk-QE7KS2JS.js → chunk-UUC5USJH.js} +8 -45
- package/dist/chunk-UUC5USJH.js.map +1 -0
- package/dist/editor.d.ts +63 -14
- package/dist/editor.js +682 -254
- package/dist/editor.js.map +1 -1
- package/dist/handler-ZAM4NJOS.js +11 -0
- package/dist/{handler-J5BCH2VW.js.map → handler-ZAM4NJOS.js.map} +1 -1
- package/dist/import.d.ts +3 -3
- package/dist/import.js +1 -1
- package/dist/index.d.ts +23 -9
- package/dist/index.js +4 -4
- package/dist/{redirects-BNSD9MKa.d.ts → redirects-LcCNIJHQ.d.ts} +2 -2
- package/dist/{registry-BPn-tDlL.d.ts → registry-Cw7NF_le.d.ts} +17 -1
- package/dist/sections.d.ts +1 -1
- package/dist/sections.js +3 -3
- package/dist/{store-B_GMH42V.d.ts → store-BNYD5NAQ.d.ts} +30 -4
- package/dist/supabase.d.ts +4 -4
- package/dist/supabase.js +4 -4
- package/dist/{templates-CFSSG1iU.d.ts → templates-DPv0OYLl.d.ts} +2 -2
- package/dist/templates.d.ts +3 -3
- package/dist/templates.js +7 -3
- package/dist/templates.js.map +1 -1
- package/dist/{theme-Dw42GDI_.d.ts → theme-HJzN2tOm.d.ts} +2 -2
- package/dist/web.d.ts +50 -14
- package/dist/web.js +7 -6
- package/package.json +7 -3
- package/dist/assets/islands.83aaf5e0df.js +0 -1
- package/dist/assets/sites-forms.bac9a6aafd.css +0 -10
- package/dist/assets/sites.323090ba26.css +0 -2
- package/dist/assets.generated-YGLB7VKL.js +0 -3
- package/dist/chunk-6CXTOPYI.js.map +0 -1
- package/dist/chunk-FMQTSXJN.js.map +0 -1
- package/dist/chunk-I767PDBR.js.map +0 -1
- package/dist/chunk-MU2Z2C4F.js.map +0 -1
- package/dist/chunk-MXV2HOJO.js +0 -19
- package/dist/chunk-MXV2HOJO.js.map +0 -1
- package/dist/chunk-QE7KS2JS.js.map +0 -1
- package/dist/chunk-YAMQ2JKO.js.map +0 -1
- package/dist/handler-J5BCH2VW.js +0 -10
package/dist/editor.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { P as PageMeta, a as PageKind, b as PageDoc,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { R as RedirectDestination } from './redirects-
|
|
2
|
+
import { P as PageMeta, a as PageKind, b as PageDoc, F as FormsResolver, R as Release, c as RenderContext, d as ResolvedForm, S as SectionCategory, A as AnySectionDefinition, e as Seo, f as SectionNode, g as SiteDoc } from './registry-Cw7NF_le.js';
|
|
3
|
+
import { A as Asset, a as AssetMeta, S as SiteStore, b as SiteIssue, c as SiteCheckLevels, P as PublishOptions, R as ReservedPaths, d as SaveResult } from './store-BNYD5NAQ.js';
|
|
4
|
+
import { B as BrandInput } from './theme-HJzN2tOm.js';
|
|
5
|
+
import { R as RedirectDestination } from './redirects-LcCNIJHQ.js';
|
|
6
6
|
import { Config, Fields, Overrides } from '@puckeditor/core';
|
|
7
7
|
export { Config as PuckConfig, Data as PuckData, Overrides as PuckOverrides, createUsePuck, usePuck } from '@puckeditor/core';
|
|
8
8
|
import '@marktiderman/genesis-media';
|
|
@@ -25,6 +25,11 @@ interface PickedImage {
|
|
|
25
25
|
width?: number;
|
|
26
26
|
height?: number;
|
|
27
27
|
}
|
|
28
|
+
/** One form a form section can show: its slug (what the section stores) and its name. */
|
|
29
|
+
interface FormOption {
|
|
30
|
+
slug: string;
|
|
31
|
+
title: string;
|
|
32
|
+
}
|
|
28
33
|
|
|
29
34
|
/** A store the editor can drive. `reorderPages` is optional: without it, page order is the store's. */
|
|
30
35
|
type EditorSiteStore = SiteStore & {
|
|
@@ -42,13 +47,24 @@ interface SiteCheck {
|
|
|
42
47
|
*
|
|
43
48
|
* @stability Beta
|
|
44
49
|
*/
|
|
45
|
-
|
|
50
|
+
/** The forms a site can show: the resolver that renders them, and the list the editor's picker offers. */
|
|
51
|
+
type SiteFormsOptions = {
|
|
52
|
+
forms?: FormsResolver;
|
|
53
|
+
/**
|
|
54
|
+
* The host's forms. When given, a form section's slug must be one of them: a resolver may embed
|
|
55
|
+
* any well-formed slug, and the list is what the editor offers, so the check agrees with it.
|
|
56
|
+
*/
|
|
57
|
+
listForms?: () => Promise<readonly FormOption[]>;
|
|
58
|
+
/** The checks the app chooses (sample pictures, missing forms): each blocks, warns (the default) or is off. */
|
|
59
|
+
checks?: SiteCheckLevels;
|
|
60
|
+
};
|
|
61
|
+
declare function checkSite(store: SiteStore, siteId: string, options?: Pick<PublishOptions, "brand" | "reserved"> & SiteFormsOptions): Promise<SiteCheck>;
|
|
46
62
|
/** Publish after checking: a site with errors is refused before the store is asked. */
|
|
47
63
|
declare function publishSite(store: SiteStore, siteId: string, options: {
|
|
48
64
|
brand: BrandInput;
|
|
49
65
|
note?: string;
|
|
50
66
|
reserved?: ReservedPaths;
|
|
51
|
-
}): Promise<{
|
|
67
|
+
} & SiteFormsOptions): Promise<{
|
|
52
68
|
release: Release;
|
|
53
69
|
} | {
|
|
54
70
|
blocked: SiteIssue[];
|
|
@@ -82,9 +98,10 @@ interface PageTemplate {
|
|
|
82
98
|
}
|
|
83
99
|
/**
|
|
84
100
|
* The page templates: a blank page, the one-click landing page from the
|
|
85
|
-
* brand, the 404 page, and each page of the
|
|
86
|
-
* after its home page. The Add page dialog
|
|
87
|
-
* (made under Landing pages) and the 404
|
|
101
|
+
* brand, the 404 page, the blog (the post page), and each page of the
|
|
102
|
+
* starter site (about, contact) after its home page. The Add page dialog
|
|
103
|
+
* offers all but the landing page (made under Landing pages) and the 404
|
|
104
|
+
* page (made under Page not found).
|
|
88
105
|
*
|
|
89
106
|
* @stability Beta
|
|
90
107
|
*/
|
|
@@ -184,12 +201,22 @@ interface SiteEditorProps {
|
|
|
184
201
|
store: EditorSiteStore;
|
|
185
202
|
/** The site's brand: the canvas theme, and what a publish checks contrast against. */
|
|
186
203
|
brand: BrandInput;
|
|
187
|
-
/** Resolves form embeds' slugs, for the canvas and preview. */
|
|
204
|
+
/** Resolves form embeds' slugs, for the canvas and preview, and checks each one exists before a publish. */
|
|
188
205
|
forms?: FormsResolver;
|
|
206
|
+
/** The forms a form section can show, for its picker; without it, the form's slug is typed in. */
|
|
207
|
+
listForms?: () => Promise<readonly FormOption[]>;
|
|
208
|
+
/**
|
|
209
|
+
* The publish checks the app chooses: sample pictures left in a section
|
|
210
|
+
* (`sampleImages`) and form sections naming no form the host has
|
|
211
|
+
* (`missingForms`). Each blocks, warns or is off; left out, it warns.
|
|
212
|
+
*/
|
|
213
|
+
checks?: SiteCheckLevels;
|
|
189
214
|
/** The asset library and upload, beside the store's `putAsset`. */
|
|
190
215
|
assets?: EditorAssets;
|
|
191
216
|
/** After each publish. */
|
|
192
217
|
onPublish?: (release: Release) => void;
|
|
218
|
+
/** The host's page for the brand's fonts, colours and logo; the Pages tab links to it. */
|
|
219
|
+
brandSettingsHref?: string;
|
|
193
220
|
/**
|
|
194
221
|
* Whether anything isn't saved yet (waiting, saving, a conflict, a failed save, or a change that
|
|
195
222
|
* can't be saved until it's fixed). Block your app's own navigation while it's true: closing the
|
|
@@ -231,7 +258,7 @@ interface SiteEditorProps {
|
|
|
231
258
|
*
|
|
232
259
|
* @stability Beta
|
|
233
260
|
*/
|
|
234
|
-
declare function SiteEditor({ siteId, store, brand, forms, assets, onPublish, reserved, landingDirectory: defaultLanding, destinations, previewUrl, autosaveDelay, initialPageId, siteStylesheet, readOnly, onDirtyChange, className }: SiteEditorProps): React.JSX.Element;
|
|
261
|
+
declare function SiteEditor({ siteId, store, brand, forms, listForms, checks, assets, onPublish, brandSettingsHref, reserved, landingDirectory: defaultLanding, destinations, previewUrl, autosaveDelay, initialPageId, siteStylesheet, readOnly, onDirtyChange, className }: SiteEditorProps): React.JSX.Element;
|
|
235
262
|
|
|
236
263
|
/** What the Add picker and its limits know about one Puck component. */
|
|
237
264
|
interface ComponentInfo {
|
|
@@ -292,6 +319,7 @@ declare function createEditorConfig(options?: EditorConfigOptions): EditorConfig
|
|
|
292
319
|
* image picker, which asks for alt text;
|
|
293
320
|
* - `x-genesis-kind: "rich-text"` → the Genesis rich text editor;
|
|
294
321
|
* - `x-genesis-kind: "slot"` → a Puck slot (nested sections);
|
|
322
|
+
* - `x-genesis-kind: "form"` → a picker of the host's forms (`listForms`);
|
|
295
323
|
* - an enum, or a union of constants → a select;
|
|
296
324
|
* - a boolean → a yes/no radio; a number → a number input;
|
|
297
325
|
* - a string → text, or a textarea when it may run past 160 characters;
|
|
@@ -335,6 +363,16 @@ declare function sectionFields(def: AnySectionDefinition, options?: {
|
|
|
335
363
|
* and come back out on save. A page's header and footer (site parts) are
|
|
336
364
|
* slots on Puck's root, so the canvas shows and edits the whole page.
|
|
337
365
|
*
|
|
366
|
+
* A placeholder (sample content) carries the props it started with in
|
|
367
|
+
* `_placeholder`, so it stays one, wherever it came from (a template, or a
|
|
368
|
+
* `sample` preset added in the editor), until its props change.
|
|
369
|
+
*
|
|
370
|
+
* Puck draws an item over its component's `defaultProps` (the first preset's
|
|
371
|
+
* props), not only on insert. So an item from a document names every key of
|
|
372
|
+
* those defaults, set to `undefined` when the node doesn't have it: the canvas
|
|
373
|
+
* then draws what the document holds, as the live site does, never a preset's
|
|
374
|
+
* copy the page doesn't have.
|
|
375
|
+
*
|
|
338
376
|
* The editor's Add picker offers each section's presets: a preset after the
|
|
339
377
|
* first is its own Puck component, `type__n`, and turns back into `type` on
|
|
340
378
|
* save, so stored documents only ever name registered types.
|
|
@@ -393,13 +431,24 @@ interface FromItemOptions {
|
|
|
393
431
|
slotKeys?: SlotKeys;
|
|
394
432
|
/**
|
|
395
433
|
* A hash of the props each template placeholder had when the editor
|
|
396
|
-
* opened it (`placeholderSnapshot`), by section id
|
|
397
|
-
*
|
|
434
|
+
* opened it (`placeholderSnapshot`), by section id, for an item whose
|
|
435
|
+
* `_placeholder` is `true` (an item from `nodeToItem` carries its own
|
|
436
|
+
* starting props instead). A placeholder stays one only while its props
|
|
437
|
+
* are unchanged: editing it clears the flag.
|
|
398
438
|
*/
|
|
399
439
|
placeholders?: ReadonlyMap<string, string>;
|
|
400
440
|
}
|
|
401
441
|
/** A Puck item as a node. */
|
|
402
442
|
declare function itemToNode(item: PuckItem, options?: FromItemOptions): SectionNode;
|
|
443
|
+
/**
|
|
444
|
+
* Is this Puck item a placeholder nobody has edited yet (sample content, as
|
|
445
|
+
* it came from its template or preset)? Its text fields then show their
|
|
446
|
+
* values as hints, so typing replaces the sample rather than adding to it.
|
|
447
|
+
*/
|
|
448
|
+
declare function isUneditedSample(item: {
|
|
449
|
+
type: string;
|
|
450
|
+
props: Record<string, unknown>;
|
|
451
|
+
} | null | undefined, options?: Pick<FromItemOptions, "placeholders">): boolean;
|
|
403
452
|
/** A hash of every placeholder node's props, to tell later whether it was edited. */
|
|
404
453
|
declare function placeholderSnapshot(nodes: readonly SectionNode[], into?: Map<string, string>): Map<string, string>;
|
|
405
454
|
/** A page (and its site's header and footer) as the editor's Puck data. */
|
|
@@ -606,4 +655,4 @@ interface GenesisOverrideOptions {
|
|
|
606
655
|
}
|
|
607
656
|
declare function genesisOverrides(info: ReadonlyMap<string, ComponentInfo>, extra?: Partial<Overrides>, options?: GenesisOverrideOptions): Partial<Overrides>;
|
|
608
657
|
|
|
609
|
-
export { AssetPicker, type AssetPickerProps, AutosaveBlockedError, type AutosaveState, type AutosaveStatus, Autosaver, type AutosaverOptions, type CanvasMetadata, type ComponentInfo, type EditorAssets, type EditorConfig, type EditorConfigOptions, type EditorData, type EditorRootProps, type EditorSiteStore, type FromEditorResult, IMAGE_TYPES, LandingDirectoryError, NODE_KEYS, type PageTemplate, type PickedImage, type PreviewInput, type PreviewResult, type PuckItem, RedirectDestination, type SectionFields, type SiteCheck, SiteEditor, type SiteEditorProps, checkSite, countTypes, createEditorConfig, createLandingPage, fromEditorData, genesisOverrides, h1SectionId, humanize, itemToNode, moveLandingPage, movePageInList, nodeToItem, pageTemplates, pathProblems, placeholderSnapshot, presetComponentName, pruneEmpty, publishSite, renamePage, renderPreview, safeSectionId, sectionFields, sectionTypeOf, setLandingDirectory, slugify, toEditorData, uploadProblem };
|
|
658
|
+
export { AssetPicker, type AssetPickerProps, AutosaveBlockedError, type AutosaveState, type AutosaveStatus, Autosaver, type AutosaverOptions, type CanvasMetadata, type ComponentInfo, type EditorAssets, type EditorConfig, type EditorConfigOptions, type EditorData, type EditorRootProps, type EditorSiteStore, type FormOption, type FromEditorResult, IMAGE_TYPES, LandingDirectoryError, NODE_KEYS, type PageTemplate, type PickedImage, type PreviewInput, type PreviewResult, type PuckItem, RedirectDestination, type SectionFields, type SiteCheck, SiteEditor, type SiteEditorProps, type SiteFormsOptions, checkSite, countTypes, createEditorConfig, createLandingPage, fromEditorData, genesisOverrides, h1SectionId, humanize, isUneditedSample, itemToNode, moveLandingPage, movePageInList, nodeToItem, pageTemplates, pathProblems, placeholderSnapshot, presetComponentName, pruneEmpty, publishSite, renamePage, renderPreview, safeSectionId, sectionFields, sectionTypeOf, setLandingDirectory, slugify, toEditorData, uploadProblem };
|