@jxsuite/studio 0.10.1 → 0.11.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/studio.js CHANGED
@@ -606,7 +606,15 @@ function stripEventHandlers(node) {
606
606
  for (const [ck, cv] of Object.entries(v))
607
607
  cases[ck] = stripEventHandlers(cv);
608
608
  out.cases = cases;
609
- } else if (k === "state" || k === "style" || k === "attributes" || k === "$media") {
609
+ } else if (k === "state" && typeof v === "object" && v !== null) {
610
+ const state = {};
611
+ for (const [sk, sv] of Object.entries(v)) {
612
+ if (sv && typeof sv === "object" && sv.timing === "server")
613
+ continue;
614
+ state[sk] = sv;
615
+ }
616
+ out.state = state;
617
+ } else if (k === "style" || k === "attributes" || k === "$media") {
610
618
  out[k] = v;
611
619
  } else {
612
620
  out[k] = v;
@@ -32876,7 +32884,7 @@ var init_lit = __esm(() => {
32876
32884
  });
32877
32885
 
32878
32886
  // ../../node_modules/@spectrum-web-components/base/src/version.dev.js
32879
- var version2 = "1.12.0", coreVersion2 = "0.1.0";
32887
+ var version2 = "1.12.1", coreVersion2 = "0.1.0";
32880
32888
 
32881
32889
  // ../../node_modules/@spectrum-web-components/base/src/Base.dev.js
32882
32890
  function SpectrumMixin(constructor) {
@@ -41294,6 +41302,7 @@ var view = {
41294
41302
  stylebookElToTag: new WeakMap,
41295
41303
  showAddBreakpointForm: false,
41296
41304
  addBreakpointPreview: "",
41305
+ layoutSelection: null,
41297
41306
  autosaveTimer: null
41298
41307
  };
41299
41308
  // data/elements-meta.json
@@ -172222,6 +172231,80 @@ function getEffectiveHead(docHead) {
172222
172231
  }
172223
172232
  return merged;
172224
172233
  }
172234
+ var layoutCache = new Map;
172235
+ function invalidateLayoutCache() {
172236
+ layoutCache.clear();
172237
+ }
172238
+ function getEffectiveLayoutPath(docLayout) {
172239
+ if (docLayout === false)
172240
+ return null;
172241
+ const defaultLayout = projectState?.projectConfig?.defaults?.layout;
172242
+ return docLayout || defaultLayout || null;
172243
+ }
172244
+ async function resolveLayoutDoc(layoutPath) {
172245
+ const normalized = layoutPath.replace(/^\.\//, "");
172246
+ if (layoutCache.has(normalized))
172247
+ return structuredClone(layoutCache.get(normalized));
172248
+ try {
172249
+ const platform3 = getPlatform();
172250
+ const content = await platform3.readFile(normalized);
172251
+ const doc = JSON.parse(content);
172252
+ layoutCache.set(normalized, doc);
172253
+ return structuredClone(doc);
172254
+ } catch {
172255
+ return null;
172256
+ }
172257
+ }
172258
+ function distributePageIntoLayout(layoutDoc, pageDoc) {
172259
+ const pageChildren = pageDoc.children ?? [];
172260
+ const children = typeof pageChildren === "string" ? [pageChildren] : pageChildren;
172261
+ const named = new Map;
172262
+ const defaults = [];
172263
+ for (const child of children) {
172264
+ if (child && typeof child === "object" && child.attributes?.slot) {
172265
+ const slotName = child.attributes.slot;
172266
+ if (!named.has(slotName))
172267
+ named.set(slotName, []);
172268
+ named.get(slotName).push(child);
172269
+ } else {
172270
+ defaults.push(child);
172271
+ }
172272
+ }
172273
+ fillSlots(layoutDoc, named, defaults);
172274
+ if (pageDoc.state)
172275
+ layoutDoc.state = { ...layoutDoc.state, ...pageDoc.state };
172276
+ if (pageDoc.$media)
172277
+ layoutDoc.$media = { ...layoutDoc.$media, ...pageDoc.$media };
172278
+ if (pageDoc.style)
172279
+ layoutDoc.style = { ...layoutDoc.style, ...pageDoc.style };
172280
+ if (pageDoc.attributes)
172281
+ layoutDoc.attributes = { ...layoutDoc.attributes, ...pageDoc.attributes };
172282
+ return layoutDoc;
172283
+ }
172284
+ function fillSlots(node, named, defaults) {
172285
+ if (!node || typeof node !== "object")
172286
+ return;
172287
+ if (!Array.isArray(node.children))
172288
+ return;
172289
+ const newChildren = [];
172290
+ for (const child of node.children) {
172291
+ if (child && typeof child === "object" && child.tagName === "slot") {
172292
+ const slotName = child.attributes?.name;
172293
+ if (slotName && named.has(slotName)) {
172294
+ newChildren.push(...named.get(slotName));
172295
+ named.delete(slotName);
172296
+ } else if (!slotName && defaults.length > 0) {
172297
+ newChildren.push(...defaults);
172298
+ } else if (child.children) {
172299
+ newChildren.push(...child.children);
172300
+ }
172301
+ } else {
172302
+ fillSlots(child, named, defaults);
172303
+ newChildren.push(child);
172304
+ }
172305
+ }
172306
+ node.children = newChildren;
172307
+ }
172225
172308
  async function updateSiteConfig(patch) {
172226
172309
  const platform3 = getPlatform();
172227
172310
  const config = { ...projectState.projectConfig, ...patch };
@@ -173514,6 +173597,10 @@ var SCHEMA_KEYWORDS = new Set([
173514
173597
  "required",
173515
173598
  "examples"
173516
173599
  ]);
173600
+ var _serverFnConfig = { skip: false };
173601
+ function setSkipServerFunctions(v) {
173602
+ _serverFnConfig.skip = v;
173603
+ }
173517
173604
  async function buildScope(doc, parentScope = {}, base = location.href) {
173518
173605
  const raw = {};
173519
173606
  for (const [key, val] of Object.entries(parentScope)) {
@@ -173577,9 +173664,11 @@ async function buildScope(doc, parentScope = {}, base = location.href) {
173577
173664
  state[key] = await resolvePrototype(def3, state, key, base);
173578
173665
  }
173579
173666
  }
173580
- for (const [key, def3] of Object.entries(defs)) {
173581
- if (def3 != null && typeof def3 === "object" && def3.timing === "server" && def3.$src && def3.$export && !def3.$prototype) {
173582
- state[key] = await resolveServerFunction(def3, state, key, base);
173667
+ if (!_serverFnConfig.skip) {
173668
+ for (const [key, def3] of Object.entries(defs)) {
173669
+ if (def3 != null && typeof def3 === "object" && def3.timing === "server" && def3.$src && def3.$export && !def3.$prototype) {
173670
+ state[key] = await resolveServerFunction(def3, state, key, base);
173671
+ }
173583
173672
  }
173584
173673
  }
173585
173674
  if (doc.$media) {
@@ -174607,13 +174696,71 @@ function distributeSlots(host2, slottedChildren) {
174607
174696
  // src/canvas/canvas-live-render.js
174608
174697
  init_components();
174609
174698
  var _ctx5 = null;
174699
+ var layoutElements = new WeakSet;
174700
+ function findPageContentPrefix(node, path = []) {
174701
+ if (!node || typeof node !== "object")
174702
+ return null;
174703
+ if (Array.isArray(node.children)) {
174704
+ for (let i = 0;i < node.children.length; i++) {
174705
+ const child = node.children[i];
174706
+ if (child && typeof child === "object" && !child.$__layout) {
174707
+ return [...path, "children"];
174708
+ }
174709
+ }
174710
+ for (let i = 0;i < node.children.length; i++) {
174711
+ const child = node.children[i];
174712
+ if (child && typeof child === "object" && child.$__layout) {
174713
+ const found = findPageContentPrefix(child, [...path, "children", i]);
174714
+ if (found)
174715
+ return found;
174716
+ }
174717
+ }
174718
+ }
174719
+ return null;
174720
+ }
174721
+ var activeLayoutPath = null;
174722
+ function markLayoutNodes(node) {
174723
+ if (!node || typeof node !== "object")
174724
+ return;
174725
+ node.$__layout = true;
174726
+ if (Array.isArray(node.children)) {
174727
+ for (const child of node.children)
174728
+ markLayoutNodes(child);
174729
+ }
174730
+ if (node.$elements) {
174731
+ for (const el of node.$elements)
174732
+ markLayoutNodes(el);
174733
+ }
174734
+ }
174610
174735
  function initCanvasLiveRender(ctx) {
174611
174736
  _ctx5 = ctx;
174612
174737
  }
174613
174738
  async function renderCanvasLive(gen, doc, canvasEl) {
174614
174739
  const S = _ctx5.getState();
174615
174740
  const canvasMode = _ctx5.getCanvasMode();
174616
- const renderDoc = canvasMode === "preview" ? structuredClone(doc) : prepareForEditMode(stripEventHandlers(doc));
174741
+ setSkipServerFunctions(canvasMode !== "preview");
174742
+ let renderDoc = canvasMode === "preview" ? structuredClone(doc) : prepareForEditMode(stripEventHandlers(doc));
174743
+ let layoutWrapped = false;
174744
+ activeLayoutPath = null;
174745
+ const isPage = S.documentPath && projectState?.isSiteProject && (S.documentPath.startsWith("pages/") || S.documentPath.startsWith("./pages/"));
174746
+ let pageContentPrefix = null;
174747
+ if (isPage) {
174748
+ const layoutPath = getEffectiveLayoutPath(doc.$layout);
174749
+ if (layoutPath) {
174750
+ const layoutDoc = await resolveLayoutDoc(layoutPath);
174751
+ if (layoutDoc) {
174752
+ if (gen !== view.renderGeneration)
174753
+ return null;
174754
+ activeLayoutPath = layoutPath.replace(/^\.\//, "");
174755
+ markLayoutNodes(layoutDoc);
174756
+ const pageForSlots = canvasMode === "preview" ? structuredClone(doc) : renderDoc;
174757
+ const merged = distributePageIntoLayout(layoutDoc, pageForSlots);
174758
+ renderDoc = canvasMode === "preview" ? merged : prepareForEditMode(stripEventHandlers(merged));
174759
+ layoutWrapped = true;
174760
+ pageContentPrefix = findPageContentPrefix(merged);
174761
+ }
174762
+ }
174763
+ }
174617
174764
  const mapParentPaths = new Set;
174618
174765
  if (canvasMode === "design" || canvasMode === "edit") {
174619
174766
  (function findMapParents(node, path) {
@@ -174677,7 +174824,13 @@ async function renderCanvasLive(gen, doc, canvasEl) {
174677
174824
  console.warn("Studio: failed to import package", entry, e);
174678
174825
  }
174679
174826
  } else if (entry?.$ref) {
174680
- const href = new URL(entry.$ref, docBase).href;
174827
+ let href;
174828
+ try {
174829
+ href = new URL(entry.$ref, docBase).href;
174830
+ } catch (urlErr) {
174831
+ console.warn("Studio: invalid element URL", { ref: entry.$ref, docBase }, urlErr);
174832
+ continue;
174833
+ }
174681
174834
  try {
174682
174835
  await defineElement(href);
174683
174836
  } catch (e) {
@@ -174751,17 +174904,34 @@ async function renderCanvasLive(gen, doc, canvasEl) {
174751
174904
  if (gen !== view.renderGeneration)
174752
174905
  return null;
174753
174906
  const el = renderNode(renderDoc, $defs, {
174754
- onNodeCreated(el2, path) {
174907
+ onNodeCreated(el2, path, def3) {
174908
+ if (layoutWrapped && def3?.$__layout) {
174909
+ layoutElements.add(el2);
174910
+ if (el2.setAttribute)
174911
+ el2.setAttribute("data-jx-layout", "");
174912
+ return;
174913
+ }
174755
174914
  let mappedPath = path;
174915
+ if (layoutWrapped && pageContentPrefix) {
174916
+ const pfx = pageContentPrefix;
174917
+ if (path.length >= pfx.length && pfx.every((seg, i) => path[i] === seg)) {
174918
+ mappedPath = ["children", ...path.slice(pfx.length)];
174919
+ }
174920
+ }
174756
174921
  if ((canvasMode === "design" || canvasMode === "edit") && mapParentPaths.size > 0) {
174757
- for (let i = 0;i < path.length - 1; i++) {
174758
- if (path[i] === "children" && path[i + 1] === 0) {
174759
- const parentKey = path.slice(0, i).join("/");
174922
+ for (let i = 0;i < mappedPath.length - 1; i++) {
174923
+ if (mappedPath[i] === "children" && mappedPath[i + 1] === 0) {
174924
+ const parentKey = mappedPath.slice(0, i).join("/");
174760
174925
  if (mapParentPaths.has(parentKey)) {
174761
- if (path.length === i + 2) {
174762
- mappedPath = path.slice(0, i + 1);
174763
- } else if (path.length >= i + 4 && path[i + 2] === "children" && path[i + 3] === 0) {
174764
- mappedPath = [...path.slice(0, i), "children", "map", ...path.slice(i + 4)];
174926
+ if (mappedPath.length === i + 2) {
174927
+ mappedPath = mappedPath.slice(0, i + 1);
174928
+ } else if (mappedPath.length >= i + 4 && mappedPath[i + 2] === "children" && mappedPath[i + 3] === 0) {
174929
+ mappedPath = [
174930
+ ...mappedPath.slice(0, i),
174931
+ "children",
174932
+ "map",
174933
+ ...mappedPath.slice(i + 4)
174934
+ ];
174765
174935
  }
174766
174936
  break;
174767
174937
  }
@@ -176032,10 +176202,10 @@ function inferInputType(entry) {
176032
176202
  return "combobox";
176033
176203
  return "text";
176034
176204
  }
176035
- function findCollectionSchema(documentPath, projectConfig) {
176036
- if (!documentPath || !projectConfig?.collections)
176205
+ function findContentTypeSchema(documentPath, projectConfig) {
176206
+ if (!documentPath || !projectConfig?.contentTypes)
176037
176207
  return null;
176038
- for (const [name, def3] of Object.entries(projectConfig.collections)) {
176208
+ for (const [name, def3] of Object.entries(projectConfig.contentTypes)) {
176039
176209
  if (!def3.source || !def3.schema)
176040
176210
  continue;
176041
176211
  const src = def3.source.replace(/^\.\//, "");
@@ -176077,12 +176247,35 @@ init_platform();
176077
176247
  init_store();
176078
176248
 
176079
176249
  // src/settings/schema-field-ui.js
176080
- var FIELD_TYPES = ["string", "number", "boolean", "array", "object", "date"];
176081
- function fieldCardTpl(fieldName, fieldSchema, isRequired, handlers) {
176082
- const type = fieldSchema.format === "date" ? "date" : fieldSchema.type || "string";
176250
+ var FIELD_TYPES = [
176251
+ "string",
176252
+ "number",
176253
+ "boolean",
176254
+ "array",
176255
+ "object",
176256
+ "date",
176257
+ "image",
176258
+ "gallery",
176259
+ "reference"
176260
+ ];
176261
+ function detectFieldType(schema) {
176262
+ if (schema.$ref)
176263
+ return "reference";
176264
+ if (schema.format === "image")
176265
+ return "image";
176266
+ if (schema.format === "date")
176267
+ return "date";
176268
+ if (schema.type === "array" && schema.items?.format === "image")
176269
+ return "gallery";
176270
+ return schema.type || "string";
176271
+ }
176272
+ function fieldCardTpl(fieldName, fieldSchema, isRequired, handlers, contentTypeNames = []) {
176273
+ const type = detectFieldType(fieldSchema);
176083
176274
  const isNested = type === "object";
176275
+ const isRef2 = type === "reference";
176084
176276
  const nestedProps = fieldSchema.properties || {};
176085
176277
  const nestedRequired = fieldSchema.required || [];
176278
+ const refTarget = fieldSchema.$ref ? fieldSchema.$ref.replace("#/contentTypes/", "") : "";
176086
176279
  return html`
176087
176280
  <div class="schema-field-card">
176088
176281
  <div class="schema-field-row">
@@ -176124,6 +176317,21 @@ function fieldCardTpl(fieldName, fieldSchema, isRequired, handlers) {
176124
176317
  <sp-icon-delete slot="icon"></sp-icon-delete>
176125
176318
  </sp-action-button>
176126
176319
  </div>
176320
+ ${isRef2 && contentTypeNames.length ? html`
176321
+ <div class="schema-field-ref-target">
176322
+ <sp-picker
176323
+ size="s"
176324
+ label="Target"
176325
+ value=${refTarget}
176326
+ @change=${(e) => {
176327
+ if (handlers.onChangeRefTarget)
176328
+ handlers.onChangeRefTarget(fieldName, e.target.value);
176329
+ }}
176330
+ >
176331
+ ${contentTypeNames.map((n2) => html`<sp-menu-item value=${n2}>${n2}</sp-menu-item>`)}
176332
+ </sp-picker>
176333
+ </div>
176334
+ ` : nothing}
176127
176335
  ${isNested ? html`
176128
176336
  <div class="schema-field-nested">
176129
176337
  ${Object.entries(nestedProps).map(([name, sub]) => nestedFieldCardTpl(fieldName, name, sub, nestedRequired.includes(name), handlers))}
@@ -176134,7 +176342,7 @@ function fieldCardTpl(fieldName, fieldSchema, isRequired, handlers) {
176134
176342
  `;
176135
176343
  }
176136
176344
  function nestedFieldCardTpl(parentName, childName, childSchema, isRequired, handlers) {
176137
- const type = childSchema.format === "date" ? "date" : childSchema.type || "string";
176345
+ const type = detectFieldType(childSchema);
176138
176346
  return html`
176139
176347
  <div class="schema-field-card schema-field-card--nested">
176140
176348
  <div class="schema-field-row">
@@ -176283,6 +176491,12 @@ function schemaForType(type) {
176283
176491
  return { type: "object", properties: {}, required: [] };
176284
176492
  case "date":
176285
176493
  return { type: "string", format: "date" };
176494
+ case "image":
176495
+ return { type: "string", format: "image" };
176496
+ case "gallery":
176497
+ return { type: "array", items: { type: "string", format: "image" } };
176498
+ case "reference":
176499
+ return { $ref: "#/contentTypes/" };
176286
176500
  default:
176287
176501
  return { type: "string" };
176288
176502
  }
@@ -176290,6 +176504,8 @@ function schemaForType(type) {
176290
176504
  function yamlDefault(type, format2) {
176291
176505
  if (format2 === "date")
176292
176506
  return new Date().toISOString().split("T")[0];
176507
+ if (format2 === "image")
176508
+ return '""';
176293
176509
  switch (type) {
176294
176510
  case "boolean":
176295
176511
  return "false";
@@ -176609,14 +176825,14 @@ function renderDefsEditor(container) {
176609
176825
  render2(tpl, container);
176610
176826
  }
176611
176827
 
176612
- // src/settings/collections-editor.js
176828
+ // src/settings/content-types-editor.js
176613
176829
  init_platform();
176614
176830
  init_store();
176615
- var selectedCollection = null;
176831
+ var selectedContentType = null;
176616
176832
  var showAddField2 = false;
176617
176833
  var newFieldState2 = { name: "", type: "string", required: false };
176618
- var showNewCollection = false;
176619
- var newCollectionName = "";
176834
+ var showNewContentType = false;
176835
+ var newContentTypeName = "";
176620
176836
  async function saveProjectConfig2() {
176621
176837
  const platform3 = getPlatform();
176622
176838
  const config = projectState.projectConfig;
@@ -176624,35 +176840,35 @@ async function saveProjectConfig2() {
176624
176840
  }
176625
176841
  function getSelectedSchema() {
176626
176842
  const config = projectState?.projectConfig;
176627
- return config?.collections?.[selectedCollection]?.schema;
176843
+ return config?.contentTypes?.[selectedContentType]?.schema;
176628
176844
  }
176629
- function handleNewCollection(rerender) {
176630
- const slug = newCollectionName.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
176845
+ function handleNewContentType(rerender) {
176846
+ const slug = newContentTypeName.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
176631
176847
  if (!slug)
176632
176848
  return;
176633
176849
  const config = projectState?.projectConfig;
176634
176850
  if (!config)
176635
176851
  return;
176636
- if (!config.collections)
176637
- config.collections = {};
176638
- if (config.collections[slug])
176852
+ if (!config.contentTypes)
176853
+ config.contentTypes = {};
176854
+ if (config.contentTypes[slug])
176639
176855
  return;
176640
- config.collections[slug] = {
176641
- source: `./${slug}/**/*.md`,
176856
+ config.contentTypes[slug] = {
176857
+ source: `./content/${slug}/**/*.md`,
176642
176858
  schema: { type: "object", properties: {}, required: [] }
176643
176859
  };
176644
- selectedCollection = slug;
176645
- showNewCollection = false;
176646
- newCollectionName = "";
176860
+ selectedContentType = slug;
176861
+ showNewContentType = false;
176862
+ newContentTypeName = "";
176647
176863
  rerender();
176648
176864
  saveProjectConfig2().then(async () => {
176649
176865
  const platform3 = getPlatform();
176650
- await platform3.writeFile(`${slug}/.gitkeep`, "");
176866
+ await platform3.writeFile(`content/${slug}/.gitkeep`, "");
176651
176867
  });
176652
176868
  }
176653
176869
  function handleAddField2(rerender) {
176654
176870
  const name = newFieldState2.name.trim();
176655
- if (!name || !selectedCollection)
176871
+ if (!name || !selectedContentType)
176656
176872
  return;
176657
176873
  const schema = getSelectedSchema();
176658
176874
  if (!schema)
@@ -176719,6 +176935,14 @@ function handleChangeType2(fieldName, newType, rerender) {
176719
176935
  rerender();
176720
176936
  saveProjectConfig2();
176721
176937
  }
176938
+ function handleChangeRefTarget(fieldName, target, rerender) {
176939
+ const schema = getSelectedSchema();
176940
+ if (!schema?.properties)
176941
+ return;
176942
+ schema.properties[fieldName] = { $ref: `#/contentTypes/${target}` };
176943
+ rerender();
176944
+ saveProjectConfig2();
176945
+ }
176722
176946
  function handleAddNestedField2(parentName, fieldState, rerender) {
176723
176947
  const schema = getSelectedSchema();
176724
176948
  const parent = schema?.properties?.[parentName];
@@ -176788,30 +177012,30 @@ function handleChangeNestedType2(parentName, childName, newType, rerender) {
176788
177012
  rerender();
176789
177013
  saveProjectConfig2();
176790
177014
  }
176791
- function handleDeleteCollection(rerender) {
176792
- if (!selectedCollection)
177015
+ function handleDeleteContentType(rerender) {
177016
+ if (!selectedContentType)
176793
177017
  return;
176794
177018
  const config = projectState?.projectConfig;
176795
- if (!config?.collections?.[selectedCollection])
177019
+ if (!config?.contentTypes?.[selectedContentType])
176796
177020
  return;
176797
- delete config.collections[selectedCollection];
176798
- selectedCollection = null;
177021
+ delete config.contentTypes[selectedContentType];
177022
+ selectedContentType = null;
176799
177023
  rerender();
176800
177024
  saveProjectConfig2();
176801
177025
  }
176802
- function renderCollectionsEditor(container) {
176803
- const rerender = () => renderCollectionsEditor(container);
177026
+ function renderContentTypesEditor(container) {
177027
+ const rerender = () => renderContentTypesEditor(container);
176804
177028
  const config = projectState?.projectConfig;
176805
- const collections = config?.collections || {};
176806
- const collectionNames = Object.keys(collections);
177029
+ const contentTypes = config?.contentTypes || {};
177030
+ const contentTypeNames = Object.keys(contentTypes);
176807
177031
  const listTpl = html`
176808
177032
  <div class="settings-list-panel">
176809
- ${collectionNames.map((name) => html`
177033
+ ${contentTypeNames.map((name) => html`
176810
177034
  <sp-action-button
176811
177035
  size="s"
176812
- ?selected=${selectedCollection === name}
177036
+ ?selected=${selectedContentType === name}
176813
177037
  @click=${() => {
176814
- selectedCollection = name;
177038
+ selectedContentType = name;
176815
177039
  showAddField2 = false;
176816
177040
  rerender();
176817
177041
  }}
@@ -176819,25 +177043,25 @@ function renderCollectionsEditor(container) {
176819
177043
  ${name}
176820
177044
  </sp-action-button>
176821
177045
  `)}
176822
- ${showNewCollection ? html`
177046
+ ${showNewContentType ? html`
176823
177047
  <div class="settings-inline-form">
176824
177048
  <sp-textfield
176825
177049
  size="s"
176826
- placeholder="collection-name"
176827
- .value=${newCollectionName}
177050
+ placeholder="content-type-name"
177051
+ .value=${newContentTypeName}
176828
177052
  @input=${(e) => {
176829
- newCollectionName = e.target.value;
177053
+ newContentTypeName = e.target.value;
176830
177054
  }}
176831
177055
  @keydown=${(e) => {
176832
177056
  if (e.key === "Enter")
176833
- handleNewCollection(rerender);
177057
+ handleNewContentType(rerender);
176834
177058
  if (e.key === "Escape") {
176835
- showNewCollection = false;
177059
+ showNewContentType = false;
176836
177060
  rerender();
176837
177061
  }
176838
177062
  }}
176839
177063
  ></sp-textfield>
176840
- <sp-action-button size="s" @click=${() => handleNewCollection(rerender)}>
177064
+ <sp-action-button size="s" @click=${() => handleNewContentType(rerender)}>
176841
177065
  Create
176842
177066
  </sp-action-button>
176843
177067
  </div>
@@ -176846,20 +177070,20 @@ function renderCollectionsEditor(container) {
176846
177070
  size="s"
176847
177071
  quiet
176848
177072
  @click=${() => {
176849
- showNewCollection = true;
177073
+ showNewContentType = true;
176850
177074
  rerender();
176851
177075
  }}
176852
177076
  >
176853
- <sp-icon-add slot="icon"></sp-icon-add> New Collection
177077
+ <sp-icon-add slot="icon"></sp-icon-add> New Content Type
176854
177078
  </sp-action-button>
176855
177079
  `}
176856
177080
  </div>
176857
177081
  `;
176858
177082
  let editorTpl;
176859
- if (!selectedCollection || !collections[selectedCollection]) {
176860
- editorTpl = html`<div class="settings-empty-state">Select or create a collection</div>`;
177083
+ if (!selectedContentType || !contentTypes[selectedContentType]) {
177084
+ editorTpl = html`<div class="settings-empty-state">Select or create a content type</div>`;
176861
177085
  } else {
176862
- const col = collections[selectedCollection];
177086
+ const col = contentTypes[selectedContentType];
176863
177087
  const schema = col.schema || {};
176864
177088
  const properties = schema.properties || {};
176865
177089
  const required = schema.required || [];
@@ -176868,23 +177092,24 @@ function renderCollectionsEditor(container) {
176868
177092
  onToggleRequired: (n2) => handleToggleRequired2(n2, rerender),
176869
177093
  onRename: (oldN, newN) => handleRenameField2(oldN, newN, rerender),
176870
177094
  onChangeType: (n2, t) => handleChangeType2(n2, t, rerender),
177095
+ onChangeRefTarget: (n2, target) => handleChangeRefTarget(n2, target, rerender),
176871
177096
  onAddNestedField: (p, s) => handleAddNestedField2(p, s, rerender),
176872
177097
  onDeleteNested: (p, c) => handleDeleteNested2(p, c, rerender),
176873
177098
  onToggleNestedRequired: (p, c) => handleToggleNestedRequired2(p, c, rerender),
176874
177099
  onRenameNested: (p, o, n2) => handleRenameNested2(p, o, n2, rerender),
176875
177100
  onChangeNestedType: (p, c, t) => handleChangeNestedType2(p, c, t, rerender)
176876
177101
  };
176877
- const fieldCards = Object.entries(properties).map(([name, def3]) => fieldCardTpl(name, def3, required.includes(name), handlers));
177102
+ const fieldCards = Object.entries(properties).map(([name, def3]) => fieldCardTpl(name, def3, required.includes(name), handlers, contentTypeNames));
176878
177103
  editorTpl = html`
176879
177104
  <div class="settings-editor-panel">
176880
177105
  <div class="settings-editor-header">
176881
- <h3>${selectedCollection}</h3>
177106
+ <h3>${selectedContentType}</h3>
176882
177107
  <sp-field-label size="s">Source: ${col.source || "—"}</sp-field-label>
176883
177108
  <sp-action-button
176884
177109
  size="xs"
176885
177110
  quiet
176886
- title="Delete collection"
176887
- @click=${() => handleDeleteCollection(rerender)}
177111
+ title="Delete content type"
177112
+ @click=${() => handleDeleteContentType(rerender)}
176888
177113
  >
176889
177114
  <sp-icon-delete slot="icon"></sp-icon-delete>
176890
177115
  </sp-action-button>
@@ -177145,11 +177370,11 @@ function renderStylebookMode(ctx) {
177145
177370
  >
177146
177371
  <sp-tab label="Stylebook" value="stylebook"></sp-tab>
177147
177372
  <sp-tab label="Definitions" value="definitions"></sp-tab>
177148
- <sp-tab label="Collections" value="collections"></sp-tab>
177373
+ <sp-tab label="Content Types" value="contentTypes"></sp-tab>
177149
177374
  </sp-tabs>
177150
177375
  </div>
177151
177376
  `;
177152
- if (settingsTab === "definitions" || settingsTab === "collections") {
177377
+ if (settingsTab === "definitions" || settingsTab === "contentTypes") {
177153
177378
  canvasWrap.style.overflow = "hidden";
177154
177379
  render2(html`${settingsChromeBarTpl}
177155
177380
  <div
@@ -177160,7 +177385,7 @@ function renderStylebookMode(ctx) {
177160
177385
  if (settingsTab === "definitions")
177161
177386
  renderDefsEditor(container);
177162
177387
  else
177163
- renderCollectionsEditor(container);
177388
+ renderContentTypesEditor(container);
177164
177389
  return;
177165
177390
  }
177166
177391
  view.stylebookElToTag = new WeakMap;
@@ -177293,13 +177518,6 @@ function selectStylebookTag(tag3, media) {
177293
177518
  }
177294
177519
  });
177295
177520
  renderStylebookOverlays();
177296
- requestAnimationFrame(() => {
177297
- if (canvasPanels.length > 0) {
177298
- const el = findStylebookEl(canvasPanels[0].canvas, tag3);
177299
- if (el)
177300
- el.scrollIntoView({ behavior: "smooth", block: "center" });
177301
- }
177302
- });
177303
177521
  }
177304
177522
  function renderStylebookOverlays() {
177305
177523
  if (!_ctx6)
@@ -177337,7 +177555,7 @@ function renderStylebookOverlays() {
177337
177555
  `, panel.overlay);
177338
177556
  }
177339
177557
  }
177340
- function buildStylebookElement(entry, rootStyle, activeBreakpoints) {
177558
+ function buildStylebookElement(entry, rootStyle, activeBreakpoints, parentTag = null) {
177341
177559
  const el = document.createElement(entry.tag);
177342
177560
  if (entry.text)
177343
177561
  el.textContent = entry.text;
@@ -177350,7 +177568,8 @@ function buildStylebookElement(entry, rootStyle, activeBreakpoints) {
177350
177568
  }
177351
177569
  if (entry.style)
177352
177570
  el.style.cssText = entry.style;
177353
- const tagStyle = rootStyle[`& ${entry.tag}`];
177571
+ const compoundSelector = parentTag && parentTag !== entry.tag ? `& ${parentTag} ${entry.tag}` : null;
177572
+ const tagStyle = compoundSelector && rootStyle[compoundSelector] || rootStyle[`& ${entry.tag}`];
177354
177573
  if (tagStyle) {
177355
177574
  for (const [prop, val] of Object.entries(tagStyle)) {
177356
177575
  if (typeof val === "string" || typeof val === "number") {
@@ -177378,14 +177597,37 @@ function buildStylebookElement(entry, rootStyle, activeBreakpoints) {
177378
177597
  }
177379
177598
  }
177380
177599
  }
177600
+ if (activeBreakpoints) {
177601
+ const selector = compoundSelector || `& ${entry.tag}`;
177602
+ for (const [key, val] of Object.entries(rootStyle)) {
177603
+ if (!key.startsWith("@") || typeof val !== "object")
177604
+ continue;
177605
+ const mediaName = key.slice(1);
177606
+ if (mediaName === "--")
177607
+ continue;
177608
+ if (activeBreakpoints.has(mediaName)) {
177609
+ const mediaTagStyle = val[selector];
177610
+ if (mediaTagStyle && typeof mediaTagStyle === "object") {
177611
+ for (const [prop, v] of Object.entries(mediaTagStyle)) {
177612
+ if (typeof v === "string" || typeof v === "number") {
177613
+ try {
177614
+ el.style[prop] = v;
177615
+ } catch {}
177616
+ }
177617
+ }
177618
+ }
177619
+ }
177620
+ }
177621
+ }
177381
177622
  if (entry.children) {
177382
177623
  for (const child of entry.children) {
177383
- el.appendChild(buildStylebookElement(child, rootStyle, activeBreakpoints));
177624
+ el.appendChild(buildStylebookElement(child, rootStyle, activeBreakpoints, entry.tag));
177384
177625
  }
177385
177626
  }
177386
177627
  return el;
177387
177628
  }
177388
177629
  async function renderComponentPreview(comp) {
177630
+ setSkipServerFunctions(true);
177389
177631
  try {
177390
177632
  if (comp.source === "npm") {
177391
177633
  if (!customElements.get(comp.tagName)) {
@@ -177414,9 +177656,23 @@ async function renderComponentPreview(comp) {
177414
177656
  }
177415
177657
  function hasTagStyle(rootStyle, tag3) {
177416
177658
  const s = rootStyle[`& ${tag3}`];
177417
- return s && typeof s === "object" && Object.keys(s).length > 0;
177659
+ if (s && typeof s === "object" && Object.keys(s).length > 0)
177660
+ return true;
177661
+ const selector = `& ${tag3}`;
177662
+ for (const [key, val] of Object.entries(rootStyle)) {
177663
+ if (!key.startsWith("@") || typeof val !== "object")
177664
+ continue;
177665
+ if (val[selector])
177666
+ return true;
177667
+ }
177668
+ return false;
177418
177669
  }
177419
177670
  function renderStylebookElementsIntoCanvas(canvasEl, rootStyle, filter, customizedOnly, activeBreakpoints) {
177671
+ for (const [k, v] of Object.entries(rootStyle)) {
177672
+ if (k.startsWith("--") && (typeof v === "string" || typeof v === "number")) {
177673
+ canvasEl.style.setProperty(k, String(v));
177674
+ }
177675
+ }
177420
177676
  const sectionTemplates = [];
177421
177677
  for (const section of stylebook_meta_default.$sections) {
177422
177678
  let entries2 = section.elements;
@@ -177439,10 +177695,11 @@ function renderStylebookElementsIntoCanvas(canvasEl, rootStyle, filter, customiz
177439
177695
  view.stylebookElToTag.set(card, entry.tag);
177440
177696
  elToPath.set(card, ["__sb", entry.tag]);
177441
177697
  for (const child of el.querySelectorAll("*")) {
177442
- const tag3 = child.tagName.toLowerCase();
177698
+ const childTag = child.tagName.toLowerCase();
177443
177699
  if (!view.stylebookElToTag.has(child)) {
177444
- view.stylebookElToTag.set(child, tag3);
177445
- elToPath.set(child, ["__sb", tag3]);
177700
+ const compound = childTag === entry.tag ? entry.tag : `${entry.tag} ${childTag}`;
177701
+ view.stylebookElToTag.set(child, compound);
177702
+ elToPath.set(child, ["__sb", compound]);
177446
177703
  }
177447
177704
  }
177448
177705
  })}
@@ -177450,8 +177707,10 @@ function renderStylebookElementsIntoCanvas(canvasEl, rootStyle, filter, customiz
177450
177707
  <div
177451
177708
  class="element-card-preview"
177452
177709
  ${ref((c) => {
177453
- if (c && !c.firstChild)
177710
+ if (c) {
177711
+ c.textContent = "";
177454
177712
  c.appendChild(el);
177713
+ }
177455
177714
  })}
177456
177715
  ></div>
177457
177716
  <div class="element-card-label">&lt;${entry.tag}&gt;</div>
@@ -178197,11 +178456,13 @@ function applyDropInstruction(instruction, srcData, targetPath) {
178197
178456
  }
178198
178457
 
178199
178458
  // src/panels/canvas-dnd.js
178459
+ var _activeDropEl = null;
178200
178460
  function registerPanelDnD(panel) {
178201
178461
  const { canvas, dropLine } = panel;
178202
178462
  const allEls = canvas.querySelectorAll("*");
178203
178463
  const monitorCleanup = monitorForElements({
178204
- onDragStart() {
178464
+ onDragStart({ location: location2 }) {
178465
+ view.lastDragInput = location2.current.input;
178205
178466
  for (const el of canvas.querySelectorAll("*")) {
178206
178467
  el.style.pointerEvents = "auto";
178207
178468
  }
@@ -178212,6 +178473,8 @@ function registerPanelDnD(panel) {
178212
178473
  view.lastDragInput = location2.current.input;
178213
178474
  },
178214
178475
  onDrop() {
178476
+ _activeDropEl?.classList.remove("canvas-drop-target");
178477
+ _activeDropEl = null;
178215
178478
  for (const p of canvasPanels)
178216
178479
  p.dropLine.style.display = "none";
178217
178480
  view.lastDragInput = null;
@@ -178229,7 +178492,9 @@ function registerPanelDnD(panel) {
178229
178492
  if (!elPath)
178230
178493
  continue;
178231
178494
  const node = getNodeAtPath(S.document, elPath);
178232
- const isVoid = VOID_ELEMENTS.has((node?.tagName || "div").toLowerCase());
178495
+ const tag3 = (node?.tagName || "div").toLowerCase();
178496
+ const hasElementChildren = node?.children?.some((c) => c != null && typeof c === "object");
178497
+ const isLeaf2 = VOID_ELEMENTS.has(tag3) || !hasElementChildren;
178233
178498
  const cleanup = dropTargetForElements({
178234
178499
  element: el,
178235
178500
  canDrop({ source }) {
@@ -178239,75 +178504,101 @@ function registerPanelDnD(panel) {
178239
178504
  return true;
178240
178505
  },
178241
178506
  getData() {
178242
- return { path: elPath, _isVoid: isVoid };
178507
+ return { path: elPath, _isVoid: isLeaf2 };
178243
178508
  },
178244
- onDragEnter() {
178245
- showCanvasDropIndicator(el, elPath, isVoid, panel);
178509
+ onDragEnter({ location: location2 }) {
178510
+ view.lastDragInput = location2.current.input;
178511
+ if (_activeDropEl && _activeDropEl !== el) {
178512
+ _activeDropEl.classList.remove("canvas-drop-target");
178513
+ }
178514
+ _activeDropEl = el;
178515
+ showCanvasDropIndicator(el, elPath, isLeaf2, panel);
178246
178516
  },
178247
- onDrag() {
178248
- showCanvasDropIndicator(el, elPath, isVoid, panel);
178249
- },
178250
- onDragLeave() {
178251
- dropLine.style.display = "none";
178252
- el.classList.remove("canvas-drop-target");
178517
+ onDrag({ location: location2 }) {
178518
+ view.lastDragInput = location2.current.input;
178519
+ showCanvasDropIndicator(el, elPath, isLeaf2, panel);
178253
178520
  },
178521
+ onDragLeave() {},
178254
178522
  onDrop({ source }) {
178255
178523
  dropLine.style.display = "none";
178256
178524
  el.classList.remove("canvas-drop-target");
178257
- const instruction = getCanvasDropInstruction(el, elPath, isVoid);
178258
- if (!instruction)
178259
- return;
178260
- applyDropInstruction(instruction, source.data, elPath);
178525
+ _activeDropEl = null;
178526
+ const { instruction, targetPath } = getCanvasDropResult(el, elPath, isLeaf2);
178527
+ applyDropInstruction(instruction, source.data, targetPath);
178261
178528
  }
178262
178529
  });
178263
178530
  view.canvasDndCleanups.push(cleanup);
178264
178531
  }
178265
178532
  }
178266
- function getCanvasDropInstruction(el, elPath, isVoid) {
178267
- const rect = el.getBoundingClientRect();
178533
+ function getCanvasDropResult(el, elPath, isLeaf2) {
178268
178534
  if (!view.lastDragInput)
178269
- return null;
178535
+ return { instruction: { type: "make-child" }, referenceEl: el, targetPath: elPath };
178270
178536
  const y = view.lastDragInput.clientY;
178537
+ if (elPath.length === 0) {
178538
+ const children = Array.from(el.children);
178539
+ if (children.length === 0)
178540
+ return { instruction: { type: "make-child" }, referenceEl: el, targetPath: elPath };
178541
+ return nearestChildEdge(children, y, elPath);
178542
+ }
178543
+ const rect = el.getBoundingClientRect();
178271
178544
  const relY = (y - rect.top) / rect.height;
178272
- if (elPath.length === 0)
178273
- return { type: "make-child" };
178274
- if (isVoid)
178275
- return relY < 0.5 ? { type: "reorder-above" } : { type: "reorder-below" };
178545
+ if (isLeaf2) {
178546
+ const instruction = relY < 0.5 ? { type: "reorder-above" } : { type: "reorder-below" };
178547
+ return { instruction, referenceEl: el, targetPath: elPath };
178548
+ }
178276
178549
  if (relY < 0.25)
178277
- return { type: "reorder-above" };
178550
+ return { instruction: { type: "reorder-above" }, referenceEl: el, targetPath: elPath };
178278
178551
  if (relY > 0.75)
178279
- return { type: "reorder-below" };
178280
- return { type: "make-child" };
178552
+ return { instruction: { type: "reorder-below" }, referenceEl: el, targetPath: elPath };
178553
+ return { instruction: { type: "make-child" }, referenceEl: el, targetPath: elPath };
178281
178554
  }
178282
- function showCanvasDropIndicator(el, elPath, isVoid, panel) {
178283
- const instruction = getCanvasDropInstruction(el, elPath, isVoid);
178284
- const { dropLine, viewport } = panel;
178285
- if (!instruction) {
178286
- dropLine.style.display = "none";
178287
- return;
178555
+ function nearestChildEdge(children, cursorY, parentPath) {
178556
+ let closestDist = Infinity;
178557
+ let instruction = { type: "reorder-below" };
178558
+ let closestIdx = children.length - 1;
178559
+ for (let i = 0;i < children.length; i++) {
178560
+ const rect = children[i].getBoundingClientRect();
178561
+ const topDist = Math.abs(cursorY - rect.top);
178562
+ const bottomDist = Math.abs(cursorY - rect.bottom);
178563
+ if (topDist < closestDist) {
178564
+ closestDist = topDist;
178565
+ instruction = { type: "reorder-above" };
178566
+ closestIdx = i;
178567
+ }
178568
+ if (bottomDist < closestDist) {
178569
+ closestDist = bottomDist;
178570
+ instruction = { type: "reorder-below" };
178571
+ closestIdx = i;
178572
+ }
178288
178573
  }
178574
+ const childPath = [...parentPath, "children", closestIdx];
178575
+ return { instruction, referenceEl: children[closestIdx], targetPath: childPath };
178576
+ }
178577
+ function showCanvasDropIndicator(el, elPath, isLeaf2, panel) {
178578
+ const { instruction, referenceEl } = getCanvasDropResult(el, elPath, isLeaf2);
178579
+ const { dropLine, viewport } = panel;
178289
178580
  const scale = effectiveZoom();
178290
178581
  const wrapRect = viewport.getBoundingClientRect();
178291
- const elRect = el.getBoundingClientRect();
178292
- const left = (elRect.left - wrapRect.left + viewport.scrollLeft) / scale;
178293
- const width2 = elRect.width / scale;
178582
+ const refRect = referenceEl.getBoundingClientRect();
178583
+ const left = (refRect.left - wrapRect.left + viewport.scrollLeft) / scale;
178584
+ const width2 = refRect.width / scale;
178294
178585
  if (instruction.type === "make-child") {
178295
178586
  dropLine.style.display = "block";
178296
- dropLine.style.top = `${(elRect.top - wrapRect.top + viewport.scrollTop) / scale}px`;
178587
+ dropLine.style.top = `${(refRect.top - wrapRect.top + viewport.scrollTop) / scale}px`;
178297
178588
  dropLine.style.left = `${left}px`;
178298
178589
  dropLine.style.width = `${width2}px`;
178299
- dropLine.style.height = `${elRect.height / scale}px`;
178590
+ dropLine.style.height = `${refRect.height / scale}px`;
178300
178591
  dropLine.className = "canvas-drop-indicator inside";
178301
178592
  el.classList.add("canvas-drop-target");
178302
178593
  return;
178303
178594
  }
178304
178595
  el.classList.remove("canvas-drop-target");
178305
- const top = instruction.type === "reorder-above" ? (elRect.top - wrapRect.top + viewport.scrollTop) / scale : (elRect.bottom - wrapRect.top + viewport.scrollTop) / scale;
178596
+ const top = instruction.type === "reorder-above" ? (refRect.top - wrapRect.top + viewport.scrollTop) / scale : (refRect.bottom - wrapRect.top + viewport.scrollTop) / scale;
178306
178597
  dropLine.style.display = "block";
178307
178598
  dropLine.style.top = `${top}px`;
178308
178599
  dropLine.style.left = `${left}px`;
178309
178600
  dropLine.style.width = `${width2}px`;
178310
- dropLine.style.height = "2px";
178601
+ dropLine.style.height = "";
178311
178602
  dropLine.className = "canvas-drop-indicator line";
178312
178603
  }
178313
178604
 
@@ -178667,6 +178958,13 @@ function registerPanelEvents(panel) {
178667
178958
  const elements = withPanelPointerEvents(() => document.elementsFromPoint(e.clientX, e.clientY));
178668
178959
  for (const el of elements) {
178669
178960
  if (canvas.contains(el) && el !== canvas) {
178961
+ if (layoutElements.has(el)) {
178962
+ view.layoutSelection = { el, layoutPath: activeLayoutPath };
178963
+ update(selectNode(S, null));
178964
+ renderOnly("rightPanel");
178965
+ return;
178966
+ }
178967
+ view.layoutSelection = null;
178670
178968
  const originalPath = elToPath.get(el);
178671
178969
  if (originalPath) {
178672
178970
  let path = bubbleInlinePath(S.document, originalPath);
@@ -179050,11 +179348,13 @@ async function collectFiles(dir, platform3) {
179050
179348
  results.push(...sub);
179051
179349
  } else {
179052
179350
  const ext = extOf(entry.name);
179351
+ const category = categoryFor(entry.path, ext);
179352
+ const type = category === "Content" ? contentTypeFor(entry.path) || ext || "file" : ext || "file";
179053
179353
  results.push({
179054
179354
  name: entry.name,
179055
179355
  path: entry.path,
179056
- type: ext || "file",
179057
- category: categoryFor(entry.path, ext),
179356
+ type,
179357
+ category,
179058
179358
  ext
179059
179359
  });
179060
179360
  }
@@ -179062,6 +179362,21 @@ async function collectFiles(dir, platform3) {
179062
179362
  } catch {}
179063
179363
  return results;
179064
179364
  }
179365
+ function contentTypeFor(filePath) {
179366
+ const config = projectState?.projectConfig;
179367
+ if (!config?.contentTypes)
179368
+ return null;
179369
+ for (const [name, def3] of Object.entries(config.contentTypes)) {
179370
+ const d2 = def3;
179371
+ if (!d2.source)
179372
+ continue;
179373
+ const prefix = d2.source.replace(/^\.\//, "").split("/**")[0].split("/*")[0];
179374
+ if (filePath.startsWith(prefix + "/") || filePath === prefix) {
179375
+ return name.charAt(0).toUpperCase() + name.slice(1);
179376
+ }
179377
+ }
179378
+ return null;
179379
+ }
179065
179380
  async function loadFiles() {
179066
179381
  if (!projectState)
179067
179382
  return;
@@ -179094,9 +179409,9 @@ var ENTITY_TYPES = [
179094
179409
  { key: "component", label: "Component", dir: "components", ext: ".json" },
179095
179410
  { key: "content", label: "Content", dir: "content", ext: ".md" }
179096
179411
  ];
179097
- function buildFrontmatterYaml(collectionName) {
179412
+ function buildFrontmatterYaml(contentTypeName) {
179098
179413
  const config = projectState?.projectConfig;
179099
- const col = config?.collections?.[collectionName];
179414
+ const col = config?.contentTypes?.[contentTypeName];
179100
179415
  if (!col?.schema?.properties)
179101
179416
  return `title: Untitled
179102
179417
  `;
@@ -179109,26 +179424,26 @@ function buildFrontmatterYaml(collectionName) {
179109
179424
  return yaml || `title: Untitled
179110
179425
  `;
179111
179426
  }
179112
- function getCollectionTypes() {
179427
+ function getContentTypeTypes() {
179113
179428
  const config = projectState?.projectConfig;
179114
- if (!config?.collections)
179429
+ if (!config?.contentTypes)
179115
179430
  return [];
179116
- return Object.entries(config.collections).map(([name, def3]) => {
179431
+ return Object.entries(config.contentTypes).map(([name, def3]) => {
179117
179432
  const d2 = def3;
179118
179433
  const dir = d2.source ? d2.source.replace(/^\.\//, "").split("/")[0] : name;
179119
179434
  return {
179120
- key: `collection:${name}`,
179435
+ key: `contentType:${name}`,
179121
179436
  label: name.charAt(0).toUpperCase() + name.slice(1),
179122
179437
  dir,
179123
179438
  ext: ".md",
179124
- collectionName: name
179439
+ contentTypeName: name
179125
179440
  };
179126
179441
  });
179127
179442
  }
179128
179443
  async function handleNewEntity(typeKey, container, ctx) {
179129
- const isCollection = typeKey.startsWith("collection:");
179130
- const collectionName = isCollection ? typeKey.slice("collection:".length) : null;
179131
- const allTypes = [...ENTITY_TYPES, ...getCollectionTypes()];
179444
+ const isContentType = typeKey.startsWith("contentType:");
179445
+ const contentTypeName = isContentType ? typeKey.slice("contentType:".length) : null;
179446
+ const allTypes = [...ENTITY_TYPES, ...getContentTypeTypes()];
179132
179447
  const typeInfo = allTypes.find((t) => t.key === typeKey);
179133
179448
  if (!typeInfo)
179134
179449
  return;
@@ -179139,7 +179454,7 @@ async function handleNewEntity(typeKey, container, ctx) {
179139
179454
  const filePath = `${typeInfo.dir}/${slug}${typeInfo.ext}`;
179140
179455
  let content;
179141
179456
  if (typeInfo.ext === ".md") {
179142
- const frontmatter = collectionName ? buildFrontmatterYaml(collectionName) : `title: Untitled
179457
+ const frontmatter = contentTypeName ? buildFrontmatterYaml(contentTypeName) : `title: Untitled
179143
179458
  `;
179144
179459
  content = `---
179145
179460
  ${frontmatter}---
@@ -179180,7 +179495,7 @@ async function renderBrowse(container, ctx) {
179180
179495
  await loadFiles();
179181
179496
  }
179182
179497
  const files = filteredFiles();
179183
- const collectionTypes = getCollectionTypes();
179498
+ const contentTypeTypes = getContentTypeTypes();
179184
179499
  const filterBar = html`
179185
179500
  <div class="browse-filter-bar">
179186
179501
  <sp-action-group selects="single" size="s" compact>
@@ -179216,7 +179531,7 @@ async function renderBrowse(container, ctx) {
179216
179531
  @change=${(e) => handleNewEntity(e.target.value, container, ctx)}
179217
179532
  >
179218
179533
  ${ENTITY_TYPES.map((t) => html`<sp-menu-item value=${t.key}>${t.label}</sp-menu-item>`)}
179219
- ${collectionTypes.length ? html`<sp-menu-divider></sp-menu-divider> ${collectionTypes.map((t) => html`<sp-menu-item value=${t.key}>${t.label}</sp-menu-item>`)}` : ""}
179534
+ ${contentTypeTypes.length ? html`<sp-menu-divider></sp-menu-divider> ${contentTypeTypes.map((t) => html`<sp-menu-item value=${t.key}>${t.label}</sp-menu-item>`)}` : ""}
179220
179535
  </sp-menu>
179221
179536
  </sp-popover>
179222
179537
  </overlay-trigger>
@@ -179265,7 +179580,7 @@ async function renderBrowse(container, ctx) {
179265
179580
  >
179266
179581
  <sp-table-cell class="browse-name-cell">${f.name}</sp-table-cell>
179267
179582
  <sp-table-cell>${f.category}</sp-table-cell>
179268
- <sp-table-cell>${f.ext || "—"}</sp-table-cell>
179583
+ <sp-table-cell>${f.type}</sp-table-cell>
179269
179584
  <sp-table-cell class="browse-path-cell">${f.path}</sp-table-cell>
179270
179585
  </sp-table-row>
179271
179586
  `)}
@@ -179493,8 +179808,12 @@ function render4() {
179493
179808
  const boxes = [];
179494
179809
  if (S.hover && !pathsEqual(S.hover, S.selection)) {
179495
179810
  const el = findCanvasElement(S.hover, p.canvas);
179496
- if (el)
179497
- boxes.push(overlayBoxDescriptor(el, "hover", p));
179811
+ if (el) {
179812
+ const desc = overlayBoxDescriptor(el, "hover", p);
179813
+ if (layoutElements.has(el))
179814
+ desc.isLayout = true;
179815
+ boxes.push(desc);
179816
+ }
179498
179817
  }
179499
179818
  if (S.selection && p === getActivePanel()) {
179500
179819
  const el = findCanvasElement(S.selection, p.canvas);
@@ -179502,6 +179821,8 @@ function render4() {
179502
179821
  const desc = overlayBoxDescriptor(el, "selection", p);
179503
179822
  if (view.componentInlineEdit || _ctx9.isEditing())
179504
179823
  desc.border = "none";
179824
+ if (layoutElements.has(el))
179825
+ desc.isLayout = true;
179505
179826
  boxes.push(desc);
179506
179827
  }
179507
179828
  }
@@ -179509,9 +179830,11 @@ function render4() {
179509
179830
  ${p.dropLine}
179510
179831
  ${boxes.map((b) => html`
179511
179832
  <div
179512
- class=${b.cls}
179833
+ class="${b.cls}${b.isLayout ? " overlay-layout" : ""}"
179513
179834
  style="top:${b.top};left:${b.left};width:${b.width};height:${b.height}${b.border ? `;border:${b.border}` : ""}"
179514
- ></div>
179835
+ >
179836
+ ${b.isLayout ? html`<span class="overlay-layout-badge">Layout</span>` : nothing}
179837
+ </div>
179515
179838
  `)}
179516
179839
  `, p.overlay);
179517
179840
  }
@@ -179527,7 +179850,8 @@ function renderCanvas() {
179527
179850
  const S = _ctx10.getState();
179528
179851
  const canvasMode = _ctx10.getCanvasMode();
179529
179852
  ++view.renderGeneration;
179530
- if (canvasWrap["_$litPart$"]) {
179853
+ const modeChanged = canvasMode !== view.prevCanvasMode;
179854
+ if (modeChanged && canvasWrap["_$litPart$"]) {
179531
179855
  canvasWrap.textContent = "";
179532
179856
  delete canvasWrap["_$litPart$"];
179533
179857
  }
@@ -179548,7 +179872,6 @@ function renderCanvas() {
179548
179872
  }
179549
179873
  return;
179550
179874
  }
179551
- const modeChanged = canvasMode !== view.prevCanvasMode;
179552
179875
  view.prevCanvasMode = canvasMode;
179553
179876
  for (const fn of view.canvasDndCleanups)
179554
179877
  fn();
@@ -179657,10 +179980,11 @@ function renderCanvas() {
179657
179980
  canvasWrap.style.overflow = "hidden";
179658
179981
  resetZoomIndicator();
179659
179982
  }
179983
+ const { baseWidth: baseWidth2 } = parseMediaEntries(getEffectiveMedia(S.document.$media));
179660
179984
  const { tpl: panelTpl, panel } = canvasPanelTemplate(null, null, true);
179661
179985
  const editTpl = html`
179662
179986
  <div class="content-edit-canvas">
179663
- <div class="content-edit-column">${panelTpl}</div>
179987
+ <div class="content-edit-column" style="max-width:${baseWidth2}px">${panelTpl}</div>
179664
179988
  </div>
179665
179989
  `;
179666
179990
  render2(editTpl, canvasWrap);
@@ -183992,6 +184316,8 @@ ${md}` : md;
183992
184316
  if (path2.endsWith(".md")) {
183993
184317
  await ctx.loadMarkdown(content3, null);
183994
184318
  ctx.S.documentPath = path2;
184319
+ ctx.S.dirty = false;
184320
+ ctx.commit(ctx.S);
183995
184321
  } else {
183996
184322
  const doc = JSON.parse(content3);
183997
184323
  const newS = createState(doc);
@@ -187269,7 +187595,7 @@ function renderGitPanel(S) {
187269
187595
  }
187270
187596
 
187271
187597
  // ../../node_modules/@spectrum-web-components/base/src/version.js
187272
- var version = "1.12.0";
187598
+ var version = "1.12.1";
187273
187599
  var coreVersion = "0.1.0";
187274
187600
 
187275
187601
  // ../../node_modules/@spectrum-web-components/theme/src/theme-interfaces.dev.js
@@ -204773,6 +205099,316 @@ __decorateClass53([
204773
205099
  property({ type: String })
204774
205100
  ], ActionBar2.prototype, "variant", 1);
204775
205101
 
205102
+ // ../../node_modules/@spectrum-web-components/toast/src/Toast.dev.js
205103
+ init_index_dev();
205104
+ init_decorators_dev();
205105
+ init_focus_visible_dev();
205106
+
205107
+ // ../../node_modules/@spectrum-web-components/icons-workflow/src/elements/IconInfo.js
205108
+ init_index_dev();
205109
+
205110
+ // ../../node_modules/@spectrum-web-components/icons-workflow/src/icons/Info.js
205111
+ var InfoIcon = ({ width: a5 = 24, height: t12 = 24, hidden: e17 = false, title: r8 = "Info" } = {}) => tag6`<svg
205112
+ xmlns="http://www.w3.org/2000/svg"
205113
+ height="${t12}"
205114
+ viewBox="0 0 36 36"
205115
+ width="${a5}"
205116
+ aria-hidden=${e17 ? "true" : "false"}
205117
+ role="img"
205118
+ fill="currentColor"
205119
+ aria-label="${r8}"
205120
+ >
205121
+ <path
205122
+ d="M18 2a16 16 0 1 0 16 16A16 16 0 0 0 18 2Zm-.3 4.3a2.718 2.718 0 0 1 2.864 2.824 2.664 2.664 0 0 1-2.864 2.863 2.705 2.705 0 0 1-2.864-2.864A2.717 2.717 0 0 1 17.7 6.3ZM22 27a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1v-6h-1a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v9h1a1 1 0 0 1 1 1Z"
205123
+ />
205124
+ </svg>`;
205125
+
205126
+ // ../../node_modules/@spectrum-web-components/icons-workflow/src/icons-s2/InfoCircle.js
205127
+ var InfoCircleIcon = ({ width: r8 = 24, height: t12 = 24, hidden: e17 = false, title: l = "Info Circle" } = {}) => tag6`<svg
205128
+ xmlns="http://www.w3.org/2000/svg"
205129
+ width="${r8}"
205130
+ height="${t12}"
205131
+ viewBox="0 0 20 20"
205132
+ aria-hidden=${e17 ? "true" : "false"}
205133
+ role="img"
205134
+ fill="currentColor"
205135
+ aria-label="${l}"
205136
+ >
205137
+ <path
205138
+ d="m10,18.75c-4.8252,0-8.75-3.9248-8.75-8.75S5.1748,1.25,10,1.25s8.75,3.9248,8.75,8.75-3.9248,8.75-8.75,8.75Zm0-16c-3.99805,0-7.25,3.25195-7.25,7.25s3.25195,7.25,7.25,7.25,7.25-3.25195,7.25-7.25-3.25195-7.25-7.25-7.25Z"
205139
+ fill="currentColor"
205140
+ />
205141
+ <path
205142
+ d="m10.00064,5.26036c.23065-.00813.45538.07387.62661.22862.33033.36505.33033.92102,0,1.28607-.16935.15851-.39483.24308-.62664.23504-.23635.00948-.46589-.08035-.63302-.24775-.16207-.1679-.24916-.39432-.24137-.62755-.01238-.23497.06959-.46515.2277-.6394.17358-.16474.40786-.24988.64671-.23503Z"
205143
+ fill="currentColor"
205144
+ />
205145
+ <path
205146
+ d="m10,15.0625c-.41406,0-.75-.33594-.75-.75v-4.83496c0-.41406.33594-.75.75-.75s.75.33594.75.75v4.83496c0,.41406-.33594.75-.75.75Z"
205147
+ fill="currentColor"
205148
+ />
205149
+ </svg>`;
205150
+
205151
+ // ../../node_modules/@spectrum-web-components/icons-workflow/src/elements/IconInfo.js
205152
+ class IconInfo extends IconBase {
205153
+ render() {
205154
+ return setCustomTemplateLiteralTag2(html8), this.spectrumVersion === 1 ? InfoIcon({ hidden: !this.label, title: this.label }) : InfoCircleIcon({ hidden: !this.label, title: this.label });
205155
+ }
205156
+ }
205157
+
205158
+ // ../../node_modules/@spectrum-web-components/icons-workflow/icons/sp-icon-info.js
205159
+ defineElement2("sp-icon-info", IconInfo);
205160
+
205161
+ // ../../node_modules/@spectrum-web-components/icons-workflow/src/elements/IconCheckmarkCircle.js
205162
+ init_index_dev();
205163
+
205164
+ // ../../node_modules/@spectrum-web-components/icons-workflow/src/icons-s2/CheckmarkCircle.js
205165
+ var CheckmarkCircleIcon = ({ width: e17 = 24, height: l = 24, hidden: r8 = false, title: t12 = "Checkmark Circle" } = {}) => tag6`<svg
205166
+ xmlns="http://www.w3.org/2000/svg"
205167
+ width="${e17}"
205168
+ height="${l}"
205169
+ viewBox="0 0 20 20"
205170
+ aria-hidden=${r8 ? "true" : "false"}
205171
+ role="img"
205172
+ fill="currentColor"
205173
+ aria-label="${t12}"
205174
+ >
205175
+ <path
205176
+ d="M10,18.75c-4.8252,0-8.75-3.9248-8.75-8.75S5.1748,1.25,10,1.25s8.75,3.9248,8.75,8.75-3.9248,8.75-8.75,8.75ZM10,2.75c-3.99805,0-7.25,3.25195-7.25,7.25s3.25195,7.25,7.25,7.25,7.25-3.25195,7.25-7.25-3.25195-7.25-7.25-7.25Z"
205177
+ fill="currentColor"
205178
+ />
205179
+ <path
205180
+ d="M9.22266,13.5c-.21191,0-.41504-.08984-.55762-.24805l-2.51074-2.79199c-.27734-.30859-.25195-.78223.05566-1.05957s.78125-.25195,1.05957.05566l1.89355,2.10645,3.4873-4.75586c.24316-.33398.71094-.40918,1.04785-.16113.33398.24414.40625.71387.16113,1.04785l-4.03223,5.5c-.13281.18262-.3418.29492-.56738.30566-.01172.00098-.02441.00098-.03711.00098Z"
205181
+ fill="currentColor"
205182
+ />
205183
+ </svg>`;
205184
+
205185
+ // ../../node_modules/@spectrum-web-components/icons-workflow/src/icons/CheckmarkCircle.js
205186
+ var CheckmarkCircleIcon2 = ({ width: e17 = 24, height: a5 = 24, hidden: t12 = false, title: l = "Checkmark Circle" } = {}) => tag6`<svg
205187
+ xmlns="http://www.w3.org/2000/svg"
205188
+ width="${e17}"
205189
+ height="${a5}"
205190
+ viewBox="0 0 36 36"
205191
+ aria-hidden=${t12 ? "true" : "false"}
205192
+ role="img"
205193
+ fill="currentColor"
205194
+ aria-label="${l}"
205195
+ >
205196
+ <path
205197
+ d="M18 2a16 16 0 1 0 16 16A16 16 0 0 0 18 2Zm10.666 9.08L16.018 27.341a1.208 1.208 0 0 1-.875.461c-.024.002-.05.002-.073.002a1.2 1.2 0 0 1-.85-.351l-7.784-7.795a1.2 1.2 0 0 1 0-1.698l1.326-1.325a1.201 1.201 0 0 1 1.695 0l5.346 5.347L25.314 8.473A1.203 1.203 0 0 1 27 8.263l1.455 1.133a1.205 1.205 0 0 1 .211 1.684Z"
205198
+ />
205199
+ </svg>`;
205200
+
205201
+ // ../../node_modules/@spectrum-web-components/icons-workflow/src/elements/IconCheckmarkCircle.js
205202
+ class IconCheckmarkCircle extends IconBase {
205203
+ render() {
205204
+ return setCustomTemplateLiteralTag2(html8), this.spectrumVersion === 2 ? CheckmarkCircleIcon({ hidden: !this.label, title: this.label }) : CheckmarkCircleIcon2({ hidden: !this.label, title: this.label });
205205
+ }
205206
+ }
205207
+
205208
+ // ../../node_modules/@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js
205209
+ defineElement2("sp-icon-checkmark-circle", IconCheckmarkCircle);
205210
+
205211
+ // ../../node_modules/@spectrum-web-components/toast/src/toast.css.js
205212
+ init_index_dev();
205213
+ var o16 = css`
205214
+ :host{--spectrum-toast-font-weight:var(--spectrum-regular-font-weight);--spectrum-toast-font-size:var(--spectrum-font-size-100);--spectrum-toast-corner-radius:var(--spectrum-corner-radius-100);--spectrum-toast-block-size:var(--spectrum-toast-height);--spectrum-toast-max-inline-size:var(--spectrum-toast-maximum-width);--spectrum-toast-border-width:var(--spectrum-border-width-100);--spectrum-toast-line-height:var(--spectrum-line-height-100);--spectrum-toast-line-height-cjk:var(--spectrum-cjk-line-height-100);--spectrum-toast-spacing-icon-to-text:var(--spectrum-text-to-visual-100);--spectrum-toast-spacing-start-edge-to-text-and-icon:var(--spectrum-spacing-300);--spectrum-toast-spacing-text-and-action-button-to-divider:var(--spectrum-spacing-300);--spectrum-toast-spacing-top-edge-to-divider:var(--spectrum-spacing-100);--spectrum-toast-spacing-bottom-edge-to-divider:var(--spectrum-spacing-100);--spectrum-toast-spacing-top-edge-to-icon:var(--spectrum-toast-top-to-workflow-icon);--spectrum-toast-spacing-text-to-action-button-horizontal:var(--spectrum-spacing-300);--spectrum-toast-spacing-close-button:var(--spectrum-spacing-100);--spectrum-toast-spacing-block-start:var(--spectrum-spacing-100);--spectrum-toast-spacing-block-end:var(--spectrum-spacing-100);--spectrum-toast-spacing-top-edge-to-text:var(--spectrum-toast-top-to-text);--spectrum-toast-spacing-bottom-edge-to-text:var(--spectrum-toast-bottom-to-text);--spectrum-toast-negative-background-color-default:var(--spectrum-negative-background-color-default);--spectrum-toast-positive-background-color-default:var(--spectrum-positive-background-color-default);--spectrum-toast-informative-background-color-default:var(--spectrum-informative-background-color-default);--spectrum-toast-text-and-icon-color:var(--spectrum-white)}@media (forced-colors:active){:host{--highcontrast-toast-border-color:ButtonText;border:var(--mod-toast-border-width,var(--spectrum-toast-border-width))solid var(--highcontrast-toast-border-color,transparent)}}:host{-webkit-font-smoothing:antialiased;box-sizing:border-box;max-inline-size:var(--mod-toast-max-inline-size,var(--spectrum-toast-max-inline-size));min-block-size:var(--mod-toast-block-size,var(--spectrum-toast-block-size));font-size:var(--mod-toast-font-size,var(--spectrum-toast-font-size));font-weight:var(--mod-toast-font-weight,var(--spectrum-toast-font-weight));color:var(--mod-toast-background-color-default,var(--spectrum-toast-background-color-default));overflow-wrap:anywhere;background-color:var(--mod-toast-background-color-default,var(--spectrum-toast-background-color-default));border-radius:var(--mod-toast-corner-radius,var(--spectrum-toast-corner-radius));flex-direction:row;align-items:stretch;padding-inline-start:var(--mod-toast-spacing-start-edge-to-text-and-icon,var(--spectrum-toast-spacing-start-edge-to-text-and-icon));display:inline-flex}:host([variant=negative]){background-color:var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default))}:host([variant=negative]),:host([variant=negative]) .closeButton:focus-visible:not(:active){color:var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default))}:host([variant=info]){background-color:var(--mod-toast-informative-background-color-default,var(--spectrum-toast-informative-background-color-default))}:host([variant=info]),:host([variant=info]) .closeButton:focus-visible:not(:active){color:var(--mod-toast-informative-background-color-default,var(--spectrum-toast-informative-background-color-default))}:host([variant=positive]){background-color:var(--mod-toast-positive-background-color-default,var(--spectrum-toast-positive-background-color-default))}:host([variant=positive]),:host([variant=positive]) .closeButton:focus-visible:not(:active){color:var(--mod-toast-positive-background-color-default,var(--spectrum-toast-positive-background-color-default))}.type{flex-grow:0;flex-shrink:0;margin-block-start:var(--mod-toast-spacing-top-edge-to-icon,var(--spectrum-toast-spacing-top-edge-to-icon));margin-inline-start:0;margin-inline-end:var(--mod-toast-spacing-icon-to-text,var(--spectrum-toast-spacing-icon-to-text))}.content,.type{color:var(--mod-toast-text-and-icon-color,var(--spectrum-toast-text-and-icon-color))}.content{box-sizing:border-box;line-height:var(--mod-toast-line-height,var(--spectrum-toast-line-height));text-align:start;flex:auto;padding-block-start:calc(var(--mod-toast-spacing-top-edge-to-text,var(--spectrum-toast-spacing-top-edge-to-text)) - var(--mod-toast-spacing-block-start,var(--spectrum-toast-spacing-block-start)));padding-block-end:calc(var(--mod-toast-spacing-bottom-edge-to-text,var(--spectrum-toast-spacing-bottom-edge-to-text)) - var(--mod-toast-spacing-block-end,var(--spectrum-toast-spacing-block-end)));padding-inline-start:0;padding-inline-end:var(--mod-toast-spacing-text-to-action-button-horizontal,var(--spectrum-toast-spacing-text-to-action-button-horizontal));display:inline-block}.content:lang(ja),.content:lang(ko),.content:lang(zh){line-height:var(--mod-toast-line-height-cjk,var(--spectrum-toast-line-height-cjk))}.buttons{border-inline-start-color:var(--mod-toast-divider-color,var(--spectrum-toast-divider-color));flex:none;align-items:flex-start;margin-block-start:var(--mod-toast-spacing-top-edge-to-divider,var(--spectrum-toast-spacing-top-edge-to-divider));margin-block-end:var(--mod-toast-spacing-bottom-edge-to-divider,var(--spectrum-toast-spacing-bottom-edge-to-divider));padding-inline-end:var(--mod-toast-spacing-close-button,var(--spectrum-toast-spacing-close-button));display:flex}.buttons .spectrum-CloseButton{align-self:flex-start}.body{flex-wrap:wrap;flex:auto;align-self:center;align-items:center;padding-block-start:var(--mod-toast-spacing-block-start,var(--spectrum-toast-spacing-block-start));padding-block-end:var(--mod-toast-spacing-block-end,var(--spectrum-toast-spacing-block-end));display:flex}.body ::slotted([slot=action]){margin-inline-start:auto;margin-inline-end:var(--mod-toast-spacing-text-and-action-button-to-divider,var(--spectrum-toast-spacing-text-and-action-button-to-divider))}.body ::slotted([slot=action]:dir(rtl)){margin-inline-end:var(--mod-toast-spacing-text-and-action-button-to-divider,var(--spectrum-toast-spacing-text-and-action-button-to-divider))}.body+.buttons{border-inline-start-style:solid;border-inline-start-width:1px;padding-inline-start:var(--mod-toast-spacing-close-button,var(--spectrum-toast-spacing-close-button))}:host{--spectrum-toast-background-color-default:var(--system-toast-background-color-default);--spectrum-toast-divider-color:var(--system-toast-divider-color)}:host{--spectrum-overlay-animation-distance:var(--spectrum-spacing-100);--spectrum-overlay-animation-duration:var(--spectrum-animation-duration-100);visibility:hidden;pointer-events:none;opacity:0;transition:transform var(--spectrum-overlay-animation-duration)ease-in-out,opacity var(--spectrum-overlay-animation-duration)ease-in-out,visibility 0s linear var(--spectrum-overlay-animation-duration)}:host([open]){visibility:visible;pointer-events:auto;opacity:1;transition-delay:0s}:host([variant=error]),:host([variant=warning]){background-color:var(--highcontrast-toast-negative-background-color-default,var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default)))}:host([variant=negative]),:host([variant=negative]) .closeButton:focus-visible:not(:active),:host([variant=warning]),:host([variant=warning]) .closeButton:focus-visible:not(:active){color:var(--highcontrast-toast-negative-background-color-default,var(--mod-toast-negative-background-color-default,var(--spectrum-toast-negative-background-color-default)))}
205215
+ `;
205216
+ var toast_css_default = o16;
205217
+
205218
+ // ../../node_modules/@spectrum-web-components/toast/src/Toast.dev.js
205219
+ var __defProp55 = Object.defineProperty;
205220
+ var __getOwnPropDesc55 = Object.getOwnPropertyDescriptor;
205221
+ var __decorateClass54 = (decorators2, target, key, kind) => {
205222
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc55(target, key) : target;
205223
+ for (var i6 = decorators2.length - 1, decorator;i6 >= 0; i6--)
205224
+ if (decorator = decorators2[i6])
205225
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
205226
+ if (kind && result)
205227
+ __defProp55(target, key, result);
205228
+ return result;
205229
+ };
205230
+ var toastVariants = [
205231
+ "negative",
205232
+ "positive",
205233
+ "info",
205234
+ "error",
205235
+ "warning"
205236
+ ];
205237
+
205238
+ class Toast extends FocusVisiblePolyfillMixin(SpectrumElement) {
205239
+ constructor() {
205240
+ super(...arguments);
205241
+ this.open = false;
205242
+ this._timeout = null;
205243
+ this._variant = "";
205244
+ this.countdownStart = 0;
205245
+ this.nextCount = -1;
205246
+ this.doCountdown = (time) => {
205247
+ if (!this.countdownStart) {
205248
+ this.countdownStart = performance.now();
205249
+ }
205250
+ if (time - this.countdownStart > this._timeout) {
205251
+ this.shouldClose();
205252
+ this.countdownStart = 0;
205253
+ } else {
205254
+ this.countdown();
205255
+ }
205256
+ };
205257
+ this.countdown = () => {
205258
+ cancelAnimationFrame(this.nextCount);
205259
+ this.nextCount = requestAnimationFrame(this.doCountdown);
205260
+ };
205261
+ this.holdCountdown = () => {
205262
+ this.stopCountdown();
205263
+ this.addEventListener("focusout", this.resumeCountdown);
205264
+ };
205265
+ this.resumeCountdown = () => {
205266
+ this.removeEventListener("focusout", this.holdCountdown);
205267
+ this.countdown();
205268
+ };
205269
+ }
205270
+ static get styles() {
205271
+ return [toast_css_default];
205272
+ }
205273
+ set timeout(timeout2) {
205274
+ const hasTimeout = timeout2 !== null && timeout2 > 0;
205275
+ const newTimeout = hasTimeout ? Math.max(6000, timeout2) : null;
205276
+ const oldValue = this.timeout;
205277
+ if (newTimeout && this.countdownStart) {
205278
+ this.countdownStart = performance.now();
205279
+ }
205280
+ this._timeout = newTimeout;
205281
+ this.requestUpdate("timeout", oldValue);
205282
+ }
205283
+ get timeout() {
205284
+ return this._timeout;
205285
+ }
205286
+ set variant(variant) {
205287
+ if (variant === this.variant) {
205288
+ return;
205289
+ }
205290
+ const oldValue = this.variant;
205291
+ if (toastVariants.includes(variant)) {
205292
+ this.setAttribute("variant", variant);
205293
+ this._variant = variant;
205294
+ } else {
205295
+ this.removeAttribute("variant");
205296
+ this._variant = "";
205297
+ }
205298
+ this.requestUpdate("variant", oldValue);
205299
+ }
205300
+ get variant() {
205301
+ return this._variant;
205302
+ }
205303
+ renderIcon(variant, iconLabel) {
205304
+ switch (variant) {
205305
+ case "info":
205306
+ return html8`
205307
+ <sp-icon-info
205308
+ label=${iconLabel || "Information"}
205309
+ class="type"
205310
+ ></sp-icon-info>
205311
+ `;
205312
+ case "negative":
205313
+ case "error":
205314
+ return html8`
205315
+ <sp-icon-alert
205316
+ label=${iconLabel || "Error"}
205317
+ class="type"
205318
+ ></sp-icon-alert>
205319
+ `;
205320
+ case "warning":
205321
+ return html8`
205322
+ <sp-icon-alert
205323
+ label=${iconLabel || "Warning"}
205324
+ class="type"
205325
+ ></sp-icon-alert>
205326
+ `;
205327
+ case "positive":
205328
+ return html8`
205329
+ <sp-icon-checkmark-circle
205330
+ label=${iconLabel || "Success"}
205331
+ class="type"
205332
+ ></sp-icon-checkmark-circle>
205333
+ `;
205334
+ default:
205335
+ return html8``;
205336
+ }
205337
+ }
205338
+ startCountdown() {
205339
+ this.countdown();
205340
+ this.addEventListener("focusin", this.holdCountdown);
205341
+ }
205342
+ stopCountdown() {
205343
+ cancelAnimationFrame(this.nextCount);
205344
+ this.countdownStart = 0;
205345
+ }
205346
+ shouldClose() {
205347
+ const applyDefault = this.dispatchEvent(new CustomEvent("close", {
205348
+ composed: true,
205349
+ bubbles: true,
205350
+ cancelable: true
205351
+ }));
205352
+ if (applyDefault) {
205353
+ this.close();
205354
+ }
205355
+ }
205356
+ close() {
205357
+ this.open = false;
205358
+ }
205359
+ render() {
205360
+ return html8`
205361
+ ${this.renderIcon(this.variant, this.iconLabel)}
205362
+ <div class="body" role="alert">
205363
+ <div class="content">
205364
+ <slot></slot>
205365
+ </div>
205366
+ <slot name="action"></slot>
205367
+ </div>
205368
+ <div class="buttons">
205369
+ <sp-close-button
205370
+ @click=${this.shouldClose}
205371
+ label="Close"
205372
+ static-color="white"
205373
+ ></sp-close-button>
205374
+ </div>
205375
+ `;
205376
+ }
205377
+ updated(changes) {
205378
+ super.updated(changes);
205379
+ if (changes.has("open")) {
205380
+ if (this.open) {
205381
+ if (this.timeout) {
205382
+ this.startCountdown();
205383
+ }
205384
+ } else {
205385
+ if (this.timeout) {
205386
+ this.stopCountdown();
205387
+ }
205388
+ }
205389
+ }
205390
+ if (changes.has("timeout")) {
205391
+ if (this.timeout !== null && this.open) {
205392
+ this.startCountdown();
205393
+ } else {
205394
+ this.stopCountdown();
205395
+ }
205396
+ }
205397
+ }
205398
+ }
205399
+ __decorateClass54([
205400
+ property({ type: Boolean, reflect: true })
205401
+ ], Toast.prototype, "open", 2);
205402
+ __decorateClass54([
205403
+ property({ type: Number })
205404
+ ], Toast.prototype, "timeout", 1);
205405
+ __decorateClass54([
205406
+ property({ type: String })
205407
+ ], Toast.prototype, "variant", 1);
205408
+ __decorateClass54([
205409
+ property({ type: String, attribute: "icon-label" })
205410
+ ], Toast.prototype, "iconLabel", 2);
205411
+
204776
205412
  // ../../node_modules/@lit-labs/virtualizer/events.js
204777
205413
  class RangeChangedEvent extends Event {
204778
205414
  constructor(range3) {
@@ -205608,21 +206244,21 @@ init_decorators_dev();
205608
206244
 
205609
206245
  // ../../node_modules/@spectrum-web-components/table/src/table-body.css.js
205610
206246
  init_index_dev();
205611
- var o16 = css`
206247
+ var o17 = css`
205612
206248
  :host{border-radius:var(--mod-table-border-radius,var(--spectrum-table-border-radius));border:none;display:table-row-group;position:relative}:host([drop-target]){--mod-table-border-color:transparent;outline-width:var(--mod-table-focus-indicator-thickness,var(--spectrum-table-focus-indicator-thickness));outline-style:solid;outline-color:var(--highcontrast-table-focus-indicator-color,var(--mod-table-drop-zone-outline-color,var(--spectrum-table-drop-zone-outline-color)))}:host{border-block:var(--mod-table-border-width,var(--spectrum-table-border-width))solid var(--highcontrast-table-border-color,var(--mod-table-border-color,var(--spectrum-table-border-color)));border-inline:var(--mod-table-outer-border-inline-width,var(--spectrum-table-outer-border-inline-width))solid var(--highcontrast-table-border-color,var(--mod-table-border-color,var(--spectrum-table-border-color)));border-radius:var(--mod-table-border-radius,var(--spectrum-table-border-radius));flex-grow:1;display:block;overflow:auto}:host(:not([tabindex])){overflow:visible}
205613
206249
  `;
205614
- var table_body_css_default = o16;
206250
+ var table_body_css_default = o17;
205615
206251
 
205616
206252
  // ../../node_modules/@spectrum-web-components/table/src/TableBody.dev.js
205617
- var __defProp55 = Object.defineProperty;
205618
- var __getOwnPropDesc55 = Object.getOwnPropertyDescriptor;
205619
- var __decorateClass54 = (decorators2, target, key, kind) => {
205620
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc55(target, key) : target;
206253
+ var __defProp56 = Object.defineProperty;
206254
+ var __getOwnPropDesc56 = Object.getOwnPropertyDescriptor;
206255
+ var __decorateClass55 = (decorators2, target, key, kind) => {
206256
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc56(target, key) : target;
205621
206257
  for (var i6 = decorators2.length - 1, decorator;i6 >= 0; i6--)
205622
206258
  if (decorator = decorators2[i6])
205623
206259
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
205624
206260
  if (kind && result)
205625
- __defProp55(target, key, result);
206261
+ __defProp56(target, key, result);
205626
206262
  return result;
205627
206263
  };
205628
206264
 
@@ -205658,7 +206294,7 @@ class TableBody extends SpectrumElement {
205658
206294
  `;
205659
206295
  }
205660
206296
  }
205661
- __decorateClass54([
206297
+ __decorateClass55([
205662
206298
  property({ reflect: true })
205663
206299
  ], TableBody.prototype, "role", 2);
205664
206300
 
@@ -205679,15 +206315,15 @@ var t12 = css`
205679
206315
  var table_checkbox_cell_css_default = t12;
205680
206316
 
205681
206317
  // ../../node_modules/@spectrum-web-components/table/src/TableCheckboxCell.dev.js
205682
- var __defProp56 = Object.defineProperty;
205683
- var __getOwnPropDesc56 = Object.getOwnPropertyDescriptor;
205684
- var __decorateClass55 = (decorators2, target, key, kind) => {
205685
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc56(target, key) : target;
206318
+ var __defProp57 = Object.defineProperty;
206319
+ var __getOwnPropDesc57 = Object.getOwnPropertyDescriptor;
206320
+ var __decorateClass56 = (decorators2, target, key, kind) => {
206321
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc57(target, key) : target;
205686
206322
  for (var i6 = decorators2.length - 1, decorator;i6 >= 0; i6--)
205687
206323
  if (decorator = decorators2[i6])
205688
206324
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
205689
206325
  if (kind && result)
205690
- __defProp56(target, key, result);
206326
+ __defProp57(target, key, result);
205691
206327
  return result;
205692
206328
  };
205693
206329
 
@@ -205742,31 +206378,31 @@ class TableCheckboxCell extends SpectrumElement {
205742
206378
  `;
205743
206379
  }
205744
206380
  }
205745
- __decorateClass55([
206381
+ __decorateClass56([
205746
206382
  property({ type: Boolean, reflect: true, attribute: "head-cell" })
205747
206383
  ], TableCheckboxCell.prototype, "headCell", 2);
205748
- __decorateClass55([
206384
+ __decorateClass56([
205749
206385
  property({ reflect: true })
205750
206386
  ], TableCheckboxCell.prototype, "role", 2);
205751
- __decorateClass55([
206387
+ __decorateClass56([
205752
206388
  query(".checkbox")
205753
206389
  ], TableCheckboxCell.prototype, "checkbox", 2);
205754
- __decorateClass55([
206390
+ __decorateClass56([
205755
206391
  property({ type: Boolean })
205756
206392
  ], TableCheckboxCell.prototype, "indeterminate", 2);
205757
- __decorateClass55([
206393
+ __decorateClass56([
205758
206394
  property({ type: Boolean })
205759
206395
  ], TableCheckboxCell.prototype, "checked", 2);
205760
- __decorateClass55([
206396
+ __decorateClass56([
205761
206397
  property({ type: Boolean })
205762
206398
  ], TableCheckboxCell.prototype, "disabled", 2);
205763
- __decorateClass55([
206399
+ __decorateClass56([
205764
206400
  property({ type: Boolean, reflect: true, attribute: "selects-single" })
205765
206401
  ], TableCheckboxCell.prototype, "selectsSingle", 2);
205766
- __decorateClass55([
206402
+ __decorateClass56([
205767
206403
  property({ type: Boolean, reflect: true })
205768
206404
  ], TableCheckboxCell.prototype, "emphasized", 2);
205769
- __decorateClass55([
206405
+ __decorateClass56([
205770
206406
  property({ type: String })
205771
206407
  ], TableCheckboxCell.prototype, "label", 2);
205772
206408
 
@@ -205784,15 +206420,15 @@ var e17 = css`
205784
206420
  var table_row_css_default = e17;
205785
206421
 
205786
206422
  // ../../node_modules/@spectrum-web-components/table/src/TableRow.dev.js
205787
- var __defProp57 = Object.defineProperty;
205788
- var __getOwnPropDesc57 = Object.getOwnPropertyDescriptor;
205789
- var __decorateClass56 = (decorators2, target, key, kind) => {
205790
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc57(target, key) : target;
206423
+ var __defProp58 = Object.defineProperty;
206424
+ var __getOwnPropDesc58 = Object.getOwnPropertyDescriptor;
206425
+ var __decorateClass57 = (decorators2, target, key, kind) => {
206426
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc58(target, key) : target;
205791
206427
  for (var i6 = decorators2.length - 1, decorator;i6 >= 0; i6--)
205792
206428
  if (decorator = decorators2[i6])
205793
206429
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
205794
206430
  if (kind && result)
205795
- __defProp57(target, key, result);
206431
+ __defProp58(target, key, result);
205796
206432
  return result;
205797
206433
  };
205798
206434
 
@@ -205867,22 +206503,22 @@ class TableRow extends SpectrumElement {
205867
206503
  }
205868
206504
  }
205869
206505
  }
205870
- __decorateClass56([
206506
+ __decorateClass57([
205871
206507
  queryAssignedElements({
205872
206508
  selector: "sp-table-checkbox-cell",
205873
206509
  flatten: true
205874
206510
  })
205875
206511
  ], TableRow.prototype, "checkboxCells", 2);
205876
- __decorateClass56([
206512
+ __decorateClass57([
205877
206513
  property({ reflect: true })
205878
206514
  ], TableRow.prototype, "role", 2);
205879
- __decorateClass56([
206515
+ __decorateClass57([
205880
206516
  property({ type: Boolean })
205881
206517
  ], TableRow.prototype, "selectable", 2);
205882
- __decorateClass56([
206518
+ __decorateClass57([
205883
206519
  property({ type: Boolean, reflect: true })
205884
206520
  ], TableRow.prototype, "selected", 2);
205885
- __decorateClass56([
206521
+ __decorateClass57([
205886
206522
  property({ type: String })
205887
206523
  ], TableRow.prototype, "value", 2);
205888
206524
 
@@ -205897,15 +206533,15 @@ var e18 = css`
205897
206533
  var table_css_default = e18;
205898
206534
 
205899
206535
  // ../../node_modules/@spectrum-web-components/table/src/Table.dev.js
205900
- var __defProp58 = Object.defineProperty;
205901
- var __getOwnPropDesc58 = Object.getOwnPropertyDescriptor;
205902
- var __decorateClass57 = (decorators2, target, key, kind) => {
205903
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc58(target, key) : target;
206536
+ var __defProp59 = Object.defineProperty;
206537
+ var __getOwnPropDesc59 = Object.getOwnPropertyDescriptor;
206538
+ var __decorateClass58 = (decorators2, target, key, kind) => {
206539
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc59(target, key) : target;
205904
206540
  for (var i6 = decorators2.length - 1, decorator;i6 >= 0; i6--)
205905
206541
  if (decorator = decorators2[i6])
205906
206542
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
205907
206543
  if (kind && result)
205908
- __defProp58(target, key, result);
206544
+ __defProp59(target, key, result);
205909
206545
  return result;
205910
206546
  };
205911
206547
  class Table2 extends SizedMixin(SpectrumElement, {
@@ -206266,37 +206902,37 @@ class Table2 extends SizedMixin(SpectrumElement, {
206266
206902
  super.disconnectedCallback();
206267
206903
  }
206268
206904
  }
206269
- __decorateClass57([
206905
+ __decorateClass58([
206270
206906
  property({ reflect: true })
206271
206907
  ], Table2.prototype, "role", 2);
206272
- __decorateClass57([
206908
+ __decorateClass58([
206273
206909
  property({ type: String, reflect: true })
206274
206910
  ], Table2.prototype, "selects", 2);
206275
- __decorateClass57([
206911
+ __decorateClass58([
206276
206912
  property({ type: Array })
206277
206913
  ], Table2.prototype, "selected", 2);
206278
- __decorateClass57([
206914
+ __decorateClass58([
206279
206915
  property({ type: String, attribute: "select-all-label" })
206280
206916
  ], Table2.prototype, "selectAllLabel", 2);
206281
- __decorateClass57([
206917
+ __decorateClass58([
206282
206918
  property({ type: Array })
206283
206919
  ], Table2.prototype, "items", 2);
206284
- __decorateClass57([
206920
+ __decorateClass58([
206285
206921
  property({ type: Object })
206286
206922
  ], Table2.prototype, "itemValue", 2);
206287
- __decorateClass57([
206923
+ __decorateClass58([
206288
206924
  property({ type: Object })
206289
206925
  ], Table2.prototype, "itemLabel", 2);
206290
- __decorateClass57([
206926
+ __decorateClass58([
206291
206927
  property({ type: Boolean, reflect: true })
206292
206928
  ], Table2.prototype, "scroller", 2);
206293
- __decorateClass57([
206929
+ __decorateClass58([
206294
206930
  property({ type: Boolean, reflect: true })
206295
206931
  ], Table2.prototype, "emphasized", 2);
206296
- __decorateClass57([
206932
+ __decorateClass58([
206297
206933
  property({ type: Boolean, reflect: true })
206298
206934
  ], Table2.prototype, "quiet", 2);
206299
- __decorateClass57([
206935
+ __decorateClass58([
206300
206936
  property({ type: String, reflect: true })
206301
206937
  ], Table2.prototype, "density", 2);
206302
206938
 
@@ -206312,15 +206948,15 @@ var t13 = css`
206312
206948
  var table_head_css_default = t13;
206313
206949
 
206314
206950
  // ../../node_modules/@spectrum-web-components/table/src/TableHead.dev.js
206315
- var __defProp59 = Object.defineProperty;
206316
- var __getOwnPropDesc59 = Object.getOwnPropertyDescriptor;
206317
- var __decorateClass58 = (decorators2, target, key, kind) => {
206318
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc59(target, key) : target;
206951
+ var __defProp60 = Object.defineProperty;
206952
+ var __getOwnPropDesc60 = Object.getOwnPropertyDescriptor;
206953
+ var __decorateClass59 = (decorators2, target, key, kind) => {
206954
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc60(target, key) : target;
206319
206955
  for (var i6 = decorators2.length - 1, decorator;i6 >= 0; i6--)
206320
206956
  if (decorator = decorators2[i6])
206321
206957
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
206322
206958
  if (kind && result)
206323
- __defProp59(target, key, result);
206959
+ __defProp60(target, key, result);
206324
206960
  return result;
206325
206961
  };
206326
206962
 
@@ -206351,10 +206987,10 @@ class TableHead extends SpectrumElement {
206351
206987
  `;
206352
206988
  }
206353
206989
  }
206354
- __decorateClass58([
206990
+ __decorateClass59([
206355
206991
  property({ reflect: true })
206356
206992
  ], TableHead.prototype, "role", 2);
206357
- __decorateClass58([
206993
+ __decorateClass59([
206358
206994
  property({ type: Boolean, reflect: true })
206359
206995
  ], TableHead.prototype, "selected", 2);
206360
206996
 
@@ -206364,10 +207000,10 @@ init_decorators_dev();
206364
207000
 
206365
207001
  // ../../node_modules/@spectrum-web-components/icon/src/spectrum-icon-arrow.css.js
206366
207002
  init_index_dev();
206367
- var o17 = css`
207003
+ var o18 = css`
206368
207004
  .spectrum-UIIcon-ArrowRight75{--spectrum-icon-size:var(--spectrum-arrow-icon-size-75)}.spectrum-UIIcon-ArrowRight100{--spectrum-icon-size:var(--spectrum-arrow-icon-size-100)}.spectrum-UIIcon-ArrowRight200{--spectrum-icon-size:var(--spectrum-arrow-icon-size-200)}.spectrum-UIIcon-ArrowRight300{--spectrum-icon-size:var(--spectrum-arrow-icon-size-300)}.spectrum-UIIcon-ArrowRight400{--spectrum-icon-size:var(--spectrum-arrow-icon-size-400)}.spectrum-UIIcon-ArrowRight500{--spectrum-icon-size:var(--spectrum-arrow-icon-size-500)}.spectrum-UIIcon-ArrowRight600{--spectrum-icon-size:var(--spectrum-arrow-icon-size-600)}.spectrum-UIIcon-ArrowDown75{--spectrum-icon-size:var(--spectrum-arrow-icon-size-75);transform:rotate(90deg)}.spectrum-UIIcon-ArrowDown100{--spectrum-icon-size:var(--spectrum-arrow-icon-size-100);transform:rotate(90deg)}.spectrum-UIIcon-ArrowDown200{--spectrum-icon-size:var(--spectrum-arrow-icon-size-200);transform:rotate(90deg)}.spectrum-UIIcon-ArrowDown300{--spectrum-icon-size:var(--spectrum-arrow-icon-size-300);transform:rotate(90deg)}.spectrum-UIIcon-ArrowDown400{--spectrum-icon-size:var(--spectrum-arrow-icon-size-400);transform:rotate(90deg)}.spectrum-UIIcon-ArrowDown500{--spectrum-icon-size:var(--spectrum-arrow-icon-size-500);transform:rotate(90deg)}.spectrum-UIIcon-ArrowDown600{--spectrum-icon-size:var(--spectrum-arrow-icon-size-600);transform:rotate(90deg)}.spectrum-UIIcon-ArrowLeft75{--spectrum-icon-size:var(--spectrum-arrow-icon-size-75);transform:rotate(180deg)}.spectrum-UIIcon-ArrowLeft100{--spectrum-icon-size:var(--spectrum-arrow-icon-size-100);transform:rotate(180deg)}.spectrum-UIIcon-ArrowLeft200{--spectrum-icon-size:var(--spectrum-arrow-icon-size-200);transform:rotate(180deg)}.spectrum-UIIcon-ArrowLeft300{--spectrum-icon-size:var(--spectrum-arrow-icon-size-300);transform:rotate(180deg)}.spectrum-UIIcon-ArrowLeft400{--spectrum-icon-size:var(--spectrum-arrow-icon-size-400);transform:rotate(180deg)}.spectrum-UIIcon-ArrowLeft500{--spectrum-icon-size:var(--spectrum-arrow-icon-size-500);transform:rotate(180deg)}.spectrum-UIIcon-ArrowLeft600{--spectrum-icon-size:var(--spectrum-arrow-icon-size-600);transform:rotate(180deg)}.spectrum-UIIcon-ArrowUp75{--spectrum-icon-size:var(--spectrum-arrow-icon-size-75);transform:rotate(270deg)}.spectrum-UIIcon-ArrowUp100{--spectrum-icon-size:var(--spectrum-arrow-icon-size-100);transform:rotate(270deg)}.spectrum-UIIcon-ArrowUp200{--spectrum-icon-size:var(--spectrum-arrow-icon-size-200);transform:rotate(270deg)}.spectrum-UIIcon-ArrowUp300{--spectrum-icon-size:var(--spectrum-arrow-icon-size-300);transform:rotate(270deg)}.spectrum-UIIcon-ArrowUp400{--spectrum-icon-size:var(--spectrum-arrow-icon-size-400);transform:rotate(270deg)}.spectrum-UIIcon-ArrowUp500{--spectrum-icon-size:var(--spectrum-arrow-icon-size-500);transform:rotate(270deg)}.spectrum-UIIcon-ArrowUp600{--spectrum-icon-size:var(--spectrum-arrow-icon-size-600);transform:rotate(270deg)}
206369
207005
  `;
206370
- var spectrum_icon_arrow_css_default = o17;
207006
+ var spectrum_icon_arrow_css_default = o18;
206371
207007
 
206372
207008
  // ../../node_modules/@spectrum-web-components/icons-ui/src/elements/IconArrow100.js
206373
207009
  init_index_dev();
@@ -206422,15 +207058,15 @@ var t14 = css`
206422
207058
  var table_head_cell_css_default = t14;
206423
207059
 
206424
207060
  // ../../node_modules/@spectrum-web-components/table/src/TableHeadCell.dev.js
206425
- var __defProp60 = Object.defineProperty;
206426
- var __getOwnPropDesc60 = Object.getOwnPropertyDescriptor;
206427
- var __decorateClass59 = (decorators2, target, key, kind) => {
206428
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc60(target, key) : target;
207061
+ var __defProp61 = Object.defineProperty;
207062
+ var __getOwnPropDesc61 = Object.getOwnPropertyDescriptor;
207063
+ var __decorateClass60 = (decorators2, target, key, kind) => {
207064
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc61(target, key) : target;
206429
207065
  for (var i6 = decorators2.length - 1, decorator;i6 >= 0; i6--)
206430
207066
  if (decorator = decorators2[i6])
206431
207067
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
206432
207068
  if (kind && result)
206433
- __defProp60(target, key, result);
207069
+ __defProp61(target, key, result);
206434
207070
  return result;
206435
207071
  };
206436
207072
  var ariaSortValue = (sortDirection) => {
@@ -206531,19 +207167,19 @@ class TableHeadCell extends SpectrumElement {
206531
207167
  super.update(changes);
206532
207168
  }
206533
207169
  }
206534
- __decorateClass59([
207170
+ __decorateClass60([
206535
207171
  property({ type: Boolean, reflect: true })
206536
207172
  ], TableHeadCell.prototype, "active", 2);
206537
- __decorateClass59([
207173
+ __decorateClass60([
206538
207174
  property({ reflect: true })
206539
207175
  ], TableHeadCell.prototype, "role", 2);
206540
- __decorateClass59([
207176
+ __decorateClass60([
206541
207177
  property({ type: Boolean, reflect: true })
206542
207178
  ], TableHeadCell.prototype, "sortable", 2);
206543
- __decorateClass59([
207179
+ __decorateClass60([
206544
207180
  property({ reflect: true, attribute: "sort-direction" })
206545
207181
  ], TableHeadCell.prototype, "sortDirection", 2);
206546
- __decorateClass59([
207182
+ __decorateClass60([
206547
207183
  property({ attribute: "sort-key" })
206548
207184
  ], TableHeadCell.prototype, "sortKey", 2);
206549
207185
 
@@ -206559,15 +207195,15 @@ var e19 = css`
206559
207195
  var table_cell_css_default = e19;
206560
207196
 
206561
207197
  // ../../node_modules/@spectrum-web-components/table/src/TableCell.dev.js
206562
- var __defProp61 = Object.defineProperty;
206563
- var __getOwnPropDesc61 = Object.getOwnPropertyDescriptor;
206564
- var __decorateClass60 = (decorators2, target, key, kind) => {
206565
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc61(target, key) : target;
207198
+ var __defProp62 = Object.defineProperty;
207199
+ var __getOwnPropDesc62 = Object.getOwnPropertyDescriptor;
207200
+ var __decorateClass61 = (decorators2, target, key, kind) => {
207201
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc62(target, key) : target;
206566
207202
  for (var i6 = decorators2.length - 1, decorator;i6 >= 0; i6--)
206567
207203
  if (decorator = decorators2[i6])
206568
207204
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
206569
207205
  if (kind && result)
206570
- __defProp61(target, key, result);
207206
+ __defProp62(target, key, result);
206571
207207
  return result;
206572
207208
  };
206573
207209
 
@@ -206585,7 +207221,7 @@ class TableCell extends SpectrumElement {
206585
207221
  `;
206586
207222
  }
206587
207223
  }
206588
- __decorateClass60([
207224
+ __decorateClass61([
206589
207225
  property({ reflect: true })
206590
207226
  ], TableCell.prototype, "role", 2);
206591
207227
 
@@ -209787,12 +210423,12 @@ class JxValueSelector extends LitElement {
209787
210423
  return this;
209788
210424
  }
209789
210425
  get _isPicker() {
209790
- return !!this.value && this.options.some((o18) => !o18.divider && o18.value === this.value);
210426
+ return !!this.value && this.options.some((o19) => !o19.divider && o19.value === this.value);
209791
210427
  }
209792
210428
  get _selectedStyle() {
209793
210429
  if (!this._isPicker)
209794
210430
  return "";
209795
- const opt = this.options.find((o18) => !o18.divider && o18.value === this.value);
210431
+ const opt = this.options.find((o19) => !o19.divider && o19.value === this.value);
209796
210432
  return opt?.style || "";
209797
210433
  }
209798
210434
  _renderMenuItems() {
@@ -210132,6 +210768,7 @@ var components = [
210132
210768
  ["sp-accordion", Accordion],
210133
210769
  ["sp-accordion-item", AccordionItem],
210134
210770
  ["sp-action-bar", ActionBar2],
210771
+ ["sp-toast", Toast],
210135
210772
  ["sp-table", Table2],
210136
210773
  ["sp-table-head", TableHead],
210137
210774
  ["sp-table-head-cell", TableHeadCell],
@@ -213264,6 +213901,7 @@ function renderStylePanelTemplate(ctx) {
213264
213901
  // src/panels/properties-panel.js
213265
213902
  init_store();
213266
213903
  init_components();
213904
+ init_platform();
213267
213905
  // data/html-meta.json
213268
213906
  var html_meta_default = {
213269
213907
  $id: "html-meta",
@@ -213747,7 +214385,7 @@ function kvRow(key, value2, onChange, onDelete, datalistId = null) {
213747
214385
  function renderFrontmatterOnlyPanel() {
213748
214386
  const S = getState();
213749
214387
  const fm = S.content?.frontmatter || {};
213750
- const col = findCollectionSchema(S.documentPath, projectState?.projectConfig);
214388
+ const col = findContentTypeSchema(S.documentPath, projectState?.projectConfig);
213751
214389
  const schemaProps = col?.schema?.properties;
213752
214390
  const requiredFields = new Set(col?.schema?.required || []);
213753
214391
  const fields = [];
@@ -213776,9 +214414,11 @@ function renderFrontmatterOnlyPanel() {
213776
214414
  if (fields.length === 0 && !schemaProps) {
213777
214415
  return html`<div class="empty-state">No frontmatter. Select an element to inspect.</div>`;
213778
214416
  }
214417
+ const pageT = renderPageSection(S.document || {});
213779
214418
  return html`
213780
214419
  <div class="style-sidebar">
213781
214420
  <sp-accordion allow-multiple size="s">
214421
+ ${pageT}
213782
214422
  <sp-accordion-item label=${col ? `Frontmatter (${col.name})` : "Frontmatter"} open>
213783
214423
  <div class="style-section-body">
213784
214424
  ${fields.map((f) => renderFmFieldRow(f.field, f.entry, f.value, requiredFields))}
@@ -213847,6 +214487,64 @@ function renderFmFieldRow(field, entry, value2, requiredFields) {
213847
214487
  `
213848
214488
  });
213849
214489
  }
214490
+ if (entry.format === "image") {
214491
+ return renderFieldRow({
214492
+ prop: field,
214493
+ label: displayLabel,
214494
+ hasValue: hasVal,
214495
+ onClear,
214496
+ widget: renderMediaPicker(field, value2, (v) => update(updateFrontmatter(getState(), field, v || undefined)))
214497
+ });
214498
+ }
214499
+ if (entry.type === "array" && entry.items?.format === "image") {
214500
+ const images = Array.isArray(value2) ? value2 : [];
214501
+ return renderFieldRow({
214502
+ prop: field,
214503
+ label: displayLabel,
214504
+ hasValue: hasVal,
214505
+ onClear,
214506
+ widget: html`
214507
+ <div class="gallery-picker">
214508
+ <div class="gallery-picker-strip">
214509
+ ${images.map((img, i6) => html`
214510
+ <div class="gallery-picker-item">
214511
+ <img src=${img} alt="" class="gallery-picker-thumb" />
214512
+ <sp-action-button
214513
+ size="xs"
214514
+ quiet
214515
+ title="Remove"
214516
+ @click=${() => {
214517
+ const next2 = images.filter((_, idx) => idx !== i6);
214518
+ update(updateFrontmatter(getState(), field, next2.length ? next2 : undefined));
214519
+ }}
214520
+ >
214521
+ <sp-icon-close slot="icon"></sp-icon-close>
214522
+ </sp-action-button>
214523
+ </div>
214524
+ `)}
214525
+ </div>
214526
+ ${renderMediaPicker(`${field}:add`, "", (v) => {
214527
+ if (!v)
214528
+ return;
214529
+ const next2 = [...images, v];
214530
+ update(updateFrontmatter(getState(), field, next2));
214531
+ })}
214532
+ </div>
214533
+ `
214534
+ });
214535
+ }
214536
+ if (entry.$ref) {
214537
+ const targetName = entry.$ref.replace("#/contentTypes/", "");
214538
+ const targetDef = projectState?.projectConfig?.contentTypes?.[targetName];
214539
+ const picker = renderReferencePicker(field, value2, targetName, targetDef, (v) => update(updateFrontmatter(getState(), field, v || undefined)));
214540
+ return renderFieldRow({
214541
+ prop: field,
214542
+ label: displayLabel,
214543
+ hasValue: hasVal,
214544
+ onClear,
214545
+ widget: picker
214546
+ });
214547
+ }
213850
214548
  if (entry.type === "number") {
213851
214549
  return renderFieldRow({
213852
214550
  prop: field,
@@ -213883,6 +214581,55 @@ function renderFmFieldRow(field, entry, value2, requiredFields) {
213883
214581
  `
213884
214582
  });
213885
214583
  }
214584
+ var refEntriesCache = new Map;
214585
+ function renderReferencePicker(field, value2, targetName, targetDef, onCommit) {
214586
+ if (!targetDef?.source) {
214587
+ return html`<sp-textfield
214588
+ size="s"
214589
+ placeholder="slug"
214590
+ .value=${live(value2 || "")}
214591
+ @input=${debouncedStyleCommit(`fm:${field}`, 400, (e20) => onCommit(e20.target.value))}
214592
+ ></sp-textfield>`;
214593
+ }
214594
+ const cacheKey = targetName;
214595
+ if (!refEntriesCache.has(cacheKey)) {
214596
+ loadRefEntries(targetName, targetDef);
214597
+ }
214598
+ const entries2 = refEntriesCache.get(cacheKey) || [];
214599
+ return html`
214600
+ <sp-picker
214601
+ size="s"
214602
+ label=${targetName}
214603
+ .value=${live(value2 || "")}
214604
+ @change=${(e20) => onCommit(e20.target.value || undefined)}
214605
+ >
214606
+ <sp-menu-item value="">— none —</sp-menu-item>
214607
+ ${entries2.map((ent) => html`<sp-menu-item value=${ent.slug}>${ent.title || ent.slug}</sp-menu-item>`)}
214608
+ </sp-picker>
214609
+ `;
214610
+ }
214611
+ async function loadRefEntries(targetName, targetDef) {
214612
+ const platform4 = getPlatform();
214613
+ const sourceDir = targetDef.source.replace(/^\.\//, "").split("/**")[0].split("/*")[0];
214614
+ try {
214615
+ const listing = await platform4.listDirectory(sourceDir);
214616
+ const entries2 = [];
214617
+ for (const item of listing) {
214618
+ if (item.type === "directory")
214619
+ continue;
214620
+ const slug = item.name.replace(/\.[^.]+$/, "");
214621
+ let title = slug;
214622
+ try {
214623
+ const content3 = await platform4.readFile(item.path);
214624
+ const match2 = content3.match(/^---[\s\S]*?title:\s*(.+?)[\r\n]/m);
214625
+ if (match2)
214626
+ title = match2[1].trim().replace(/^["']|["']$/g, "");
214627
+ } catch {}
214628
+ entries2.push({ slug, title });
214629
+ }
214630
+ refEntriesCache.set(targetName, entries2);
214631
+ } catch {}
214632
+ }
213886
214633
  function renderRepeaterFieldsTemplate(node2, path2, _mapSignals) {
213887
214634
  const S = getState();
213888
214635
  return html`
@@ -214049,7 +214796,7 @@ function renderComponentPropsFieldsTemplate(node2, path2, mapSignals, navigateTo
214049
214796
  .value=${String(staticVal)}
214050
214797
  size="s"
214051
214798
  placeholder="—"
214052
- .options=${options.map((o18) => ({ value: o18, label: camelToLabel(o18) }))}
214799
+ .options=${options.map((o19) => ({ value: o19, label: camelToLabel(o19) }))}
214053
214800
  @change=${(e20) => onChange(e20.detail?.value ?? e20.target.value)}
214054
214801
  ></jx-value-selector>`;
214055
214802
  } else {
@@ -214248,8 +214995,124 @@ function mediaBreakpointRowTemplate(name, query3) {
214248
214995
  </div>
214249
214996
  `;
214250
214997
  }
214998
+ var layoutEntries = null;
214999
+ async function loadLayoutEntries() {
215000
+ try {
215001
+ const platform4 = getPlatform();
215002
+ const listing = await platform4.listDirectory("layouts");
215003
+ layoutEntries = listing.filter((f) => f.type === "file" && f.name.endsWith(".json")).map((f) => ({
215004
+ name: f.name.replace(/\.json$/, ""),
215005
+ path: `./layouts/${f.name}`
215006
+ }));
215007
+ } catch {
215008
+ layoutEntries = [];
215009
+ }
215010
+ renderOnly("rightPanel");
215011
+ }
215012
+ function isPageDocument(documentPath) {
215013
+ if (!documentPath || !projectState?.isSiteProject)
215014
+ return false;
215015
+ return documentPath.startsWith("pages/") || documentPath.startsWith("./pages/");
215016
+ }
215017
+ function renderPageSection(node2) {
215018
+ const S = getState();
215019
+ if (!isPageDocument(S.documentPath))
215020
+ return nothing;
215021
+ if (layoutEntries === null) {
215022
+ loadLayoutEntries();
215023
+ return nothing;
215024
+ }
215025
+ const currentLayout = node2.$layout;
215026
+ const defaultLayout = projectState?.projectConfig?.defaults?.layout;
215027
+ const effectivePath = getEffectiveLayoutPath(currentLayout);
215028
+ const displayValue = currentLayout === false ? "__none__" : currentLayout ? currentLayout : "__default__";
215029
+ return html`
215030
+ <sp-accordion-item label="Page" open>
215031
+ <div class="style-section-body">
215032
+ <div class="style-row" data-prop="$layout">
215033
+ <div class="style-row-label">
215034
+ ${currentLayout !== undefined ? html`<span
215035
+ class="set-dot"
215036
+ title="Reset to default"
215037
+ @click=${(e20) => {
215038
+ e20.stopPropagation();
215039
+ update(updateProperty(getState(), [], "$layout", undefined));
215040
+ }}
215041
+ ></span>` : nothing}
215042
+ <sp-field-label size="s">Layout</sp-field-label>
215043
+ </div>
215044
+ <sp-picker
215045
+ size="s"
215046
+ value=${displayValue}
215047
+ @change=${(e20) => {
215048
+ const val = e20.target.value;
215049
+ if (val === "__default__") {
215050
+ update(updateProperty(getState(), [], "$layout", undefined));
215051
+ } else if (val === "__none__") {
215052
+ update(updateProperty(getState(), [], "$layout", false));
215053
+ } else {
215054
+ update(updateProperty(getState(), [], "$layout", val));
215055
+ }
215056
+ invalidateLayoutCache();
215057
+ }}
215058
+ >
215059
+ <sp-menu-item value="__default__"
215060
+ >Default${defaultLayout ? ` (${defaultLayout.replace(/^\.\/layouts\//, "").replace(/\.json$/, "")})` : ""}</sp-menu-item
215061
+ >
215062
+ <sp-menu-item value="__none__">None</sp-menu-item>
215063
+ <sp-menu-divider></sp-menu-divider>
215064
+ ${layoutEntries.map((l) => html`<sp-menu-item value=${l.path}>${l.name}</sp-menu-item>`)}
215065
+ </sp-picker>
215066
+ </div>
215067
+ ${effectivePath ? html`<div style="font-size:10px;color:var(--fg-dim);padding:2px 0;font-style:italic">
215068
+ Wraps page content via &lt;slot&gt; distribution
215069
+ </div>` : nothing}
215070
+ </div>
215071
+ </sp-accordion-item>
215072
+ `;
215073
+ }
215074
+ function renderLayoutSelectionPanel(ctx) {
215075
+ const { el, layoutPath } = view.layoutSelection;
215076
+ const tagName = el?.tagName?.toLowerCase() || "element";
215077
+ const className2 = el?.className || "";
215078
+ const displayPath = layoutPath || "layout";
215079
+ return html`
215080
+ <div class="style-sidebar">
215081
+ <sp-accordion allow-multiple size="s">
215082
+ <sp-accordion-item label="Layout Element" open>
215083
+ <div class="style-section-body">
215084
+ <div style="display:flex;align-items:center;gap:6px;margin-bottom:8px">
215085
+ <span
215086
+ style="font-size:9px;padding:2px 6px;background:var(--spectrum-purple-600);color:white;border-radius:3px;text-transform:uppercase;letter-spacing:0.5px"
215087
+ >Layout</span
215088
+ >
215089
+ <code style="font-size:12px;font-family:monospace">&lt;${tagName}&gt;</code>
215090
+ </div>
215091
+ ${className2 ? html`<div class="style-row">
215092
+ <div class="style-row-label">
215093
+ <sp-field-label size="s">Class</sp-field-label>
215094
+ </div>
215095
+ <span style="font-size:11px;color:var(--fg-dim);word-break:break-all"
215096
+ >${className2}</span
215097
+ >
215098
+ </div>` : nothing}
215099
+ <div style="font-size:10px;color:var(--fg-dim);padding:4px 0;font-style:italic">
215100
+ This element is part of the page layout. Edit it by opening the layout file.
215101
+ </div>
215102
+ <span class="kv-add" @click=${() => ctx.navigateToComponent(displayPath)}
215103
+ >Open Layout →</span
215104
+ >
215105
+ </div>
215106
+ </sp-accordion-item>
215107
+ </sp-accordion>
215108
+ </div>
215109
+ `;
215110
+ }
214251
215111
  function renderPropertiesPanelTemplate(ctx) {
214252
215112
  const S = getState();
215113
+ if (view.layoutSelection) {
215114
+ return renderLayoutSelectionPanel(ctx);
215115
+ }
214253
215116
  if (!S.selection) {
214254
215117
  if (S.mode === "content") {
214255
215118
  return renderFrontmatterOnlyPanel();
@@ -214588,7 +215451,7 @@ function renderPropertiesPanelTemplate(ctx) {
214588
215451
  })() : nothing;
214589
215452
  const frontmatterT = S.mode === "content" ? (() => {
214590
215453
  const fm = S.content?.frontmatter || {};
214591
- const col = findCollectionSchema(S.documentPath, projectState?.projectConfig);
215454
+ const col = findContentTypeSchema(S.documentPath, projectState?.projectConfig);
214592
215455
  const schemaProps = col?.schema?.properties;
214593
215456
  const requiredFields = new Set(col?.schema?.required || []);
214594
215457
  const fields = [];
@@ -214628,14 +215491,15 @@ function renderPropertiesPanelTemplate(ctx) {
214628
215491
  </sp-accordion-item>
214629
215492
  `;
214630
215493
  })() : nothing;
215494
+ const pageT = isRoot ? renderPageSection(node2) : nothing;
214631
215495
  const tpl = html`
214632
215496
  <div class="style-sidebar">
214633
215497
  <sp-accordion allow-multiple size="s">
214634
- ${frontmatterT} ${isMapNode ? repeaterT : elemT} ${isMapNode ? nothing : observedAttrsT}
214635
- ${isMapNode ? nothing : switchT} ${isMapNode ? nothing : compPropsT}
214636
- ${isMapNode ? nothing : attrSectionTemplates} ${isMapNode ? nothing : customSectionT}
214637
- ${isMapNode ? nothing : mediaT} ${isMapNode ? nothing : cssPropsT}
214638
- ${isMapNode ? nothing : cssPartsT}
215498
+ ${pageT} ${frontmatterT} ${isMapNode ? repeaterT : elemT}
215499
+ ${isMapNode ? nothing : observedAttrsT} ${isMapNode ? nothing : switchT}
215500
+ ${isMapNode ? nothing : compPropsT} ${isMapNode ? nothing : attrSectionTemplates}
215501
+ ${isMapNode ? nothing : customSectionT} ${isMapNode ? nothing : mediaT}
215502
+ ${isMapNode ? nothing : cssPropsT} ${isMapNode ? nothing : cssPartsT}
214639
215503
  </sp-accordion>
214640
215504
  </div>
214641
215505
  `;
@@ -215565,13 +216429,19 @@ if (_openParam) {
215565
216429
  }
215566
216430
  projectState.projectDirs = foundDirs;
215567
216431
  }
215568
- const fileRelPath = siteCtx.fileRelPath || _openParam;
216432
+ const _fileParam = new URLSearchParams(location.search).get("file");
216433
+ const fileRelPath = _fileParam || siteCtx.fileRelPath || _openParam;
215569
216434
  const content3 = await platform4.readFile(fileRelPath);
215570
216435
  if (content3) {
215571
- const parsed = JSON.parse(content3);
215572
- S = createState(parsed);
216436
+ if (fileRelPath.endsWith(".md")) {
216437
+ await loadMarkdown2(content3, null);
216438
+ S.documentPath = fileRelPath;
216439
+ } else {
216440
+ const parsed = JSON.parse(content3);
216441
+ S = createState(parsed);
216442
+ S.documentPath = fileRelPath;
216443
+ }
215573
216444
  S.dirty = false;
215574
- S.documentPath = fileRelPath;
215575
216445
  S.ui = { ...S.ui, leftTab: "files" };
215576
216446
  ({ doc, session } = fromFlat(S));
215577
216447
  render();
@@ -215703,5 +216573,5 @@ addUpdateMiddleware((state3) => {
215703
216573
  scheduleAutosave();
215704
216574
  });
215705
216575
 
215706
- //# debugId=D62B21431F8E201A64756E2164756E21
216576
+ //# debugId=D2AFE14DF975CCFE64756E2164756E21
215707
216577
  //# sourceMappingURL=studio.js.map