@marktiderman/genesis-sites 0.3.2 → 0.4.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/dist/editor.d.ts CHANGED
@@ -219,6 +219,9 @@ declare function createEditorConfig(options?: EditorConfigOptions): EditorConfig
219
219
  * `z.partialRecord(Day, …)`, gets one optional field per key); an array of
220
220
  * objects → a list of them; an array of strings → one per line.
221
221
  *
222
+ * A prop marked `.meta({ deprecated: true })` gets no field: the schema still
223
+ * accepts it, and a migration moves it.
224
+ *
222
225
  * Anything else gets a field that says it can't be edited here, and a
223
226
  * warning in the console, so a gap is visible rather than silent.
224
227
  */
@@ -289,7 +292,7 @@ declare const presetComponentName: (type: string, index: number) => string;
289
292
  declare const sectionTypeOf: (componentName: string) => string;
290
293
  type Lookup = (type: string) => AnySectionDefinition | undefined;
291
294
  type SlotKeys = (type: string) => readonly string[];
292
- /** A node as a Puck item. Unknown types keep their props, so nothing is lost. */
295
+ /** A node as a Puck item, at its section's current version. Unknown types keep their props, so nothing is lost. */
293
296
  declare function nodeToItem(node: SectionNode, slotKeys?: SlotKeys): PuckItem;
294
297
  /**
295
298
  * Empty optional values out: `""`, and objects left with nothing in them
package/dist/editor.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { starterSite, exampleBrands, landingPage } from './chunk-KPOX7D4S.js';
2
- import './chunk-C375ZPU2.js';
2
+ import './chunk-P5MR34QQ.js';
3
3
  import './chunk-VZUDRPFG.js';
4
4
  import { stableHash, isConflict, prepareRelease, PublishBlockedError, siteTheme, brandDisplayName, themeCss, migrateNode, migratePage, migrateSite } from './chunk-FBQF2L7O.js';
5
5
  import { getSection, sectionJsonSchema, listSections, SECTION_CATEGORIES, PageDoc, SiteDoc, newSectionId } from './chunk-ZGWGQGT2.js';
@@ -357,8 +357,23 @@ var presetComponentName = (type, index) => index === 0 ? type : `${type}__${inde
357
357
  var sectionTypeOf = (componentName) => componentName.split("__")[0];
358
358
  var noSlots = () => [];
359
359
  var hideOnValue = (hideOn) => hideOn.includes("mobile") && hideOn.includes("desktop") ? "both" : hideOn[0] ?? "none";
360
+ function currentProps(node) {
361
+ const def = getSection(node.type);
362
+ if (!def || node.v >= def.version) return { props: structuredClone(node.props), v: node.v };
363
+ let props = structuredClone(node.props);
364
+ try {
365
+ for (let n = node.v + 1; n <= def.version; n++) {
366
+ const step = def.migrations?.[n];
367
+ if (step) props = step(props);
368
+ }
369
+ } catch {
370
+ return { props: structuredClone(node.props), v: node.v };
371
+ }
372
+ return { props, v: def.version };
373
+ }
360
374
  function nodeToItem(node, slotKeys = noSlots) {
361
- const props = { ...structuredClone(node.props) };
375
+ const current = currentProps(node);
376
+ const props = { ...current.props };
362
377
  for (const key of slotKeys(node.type)) {
363
378
  const nested = props[key];
364
379
  if (Array.isArray(nested)) props[key] = nested.map((n) => nodeToItem(n, slotKeys));
@@ -368,7 +383,7 @@ function nodeToItem(node, slotKeys = noSlots) {
368
383
  props: {
369
384
  ...props,
370
385
  id: node.id,
371
- _v: node.v,
386
+ _v: current.v,
372
387
  ...node.variant ? { _variant: node.variant } : {},
373
388
  _hidden: node.hidden === true,
374
389
  _hideOn: node.hideOn?.length ? hideOnValue(node.hideOn) : "none",
@@ -730,7 +745,10 @@ function enumKeyedProperties(schema) {
730
745
  function objectFields(schema, ctx) {
731
746
  const required = new Set(schema.required ?? []);
732
747
  const out = {};
733
- for (const [key, prop] of Object.entries(schema.properties ?? {})) out[key] = fieldFor(key, prop, required.has(key), ctx);
748
+ for (const [key, prop] of Object.entries(schema.properties ?? {})) {
749
+ if (prop.deprecated === true) continue;
750
+ out[key] = fieldFor(key, prop, required.has(key), ctx);
751
+ }
734
752
  return out;
735
753
  }
736
754
  function imageItemFields(schema, ctx) {
@@ -1495,12 +1513,12 @@ function PagesPanel(props) {
1495
1513
 
1496
1514
  // src/editor/preview.ts
1497
1515
  async function loadSiteCss() {
1498
- const { ASSETS } = await import('./assets.generated-QOBL5IUN.js');
1516
+ const { ASSETS } = await import('./assets.generated-WCOFU56J.js');
1499
1517
  return ASSETS.css.body;
1500
1518
  }
1501
1519
  var styleText = (css) => css.replace(/<\/style/gi, "<\\/style");
1502
1520
  async function renderPreview(input) {
1503
- const [{ renderSitePageToString }, { ASSETS }] = await Promise.all([import('./handler-F4ZMH34N.js'), import('./assets.generated-QOBL5IUN.js')]);
1521
+ const [{ renderSitePageToString }, { ASSETS }] = await Promise.all([import('./handler-G35AUOTG.js'), import('./assets.generated-WCOFU56J.js')]);
1504
1522
  const result = await renderSitePageToString(new Request(`https://preview.invalid${input.path}`), {
1505
1523
  store: input.store,
1506
1524
  brand: { getBrand: () => input.brand },