@jxsuite/studio 0.10.1 → 0.10.2
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 +105 -89
- package/dist/studio.js.map +17 -17
- package/package.json +29 -29
- package/src/browse/browse.js +21 -19
- package/src/canvas/canvas-live-render.js +7 -1
- package/src/canvas/canvas-render.js +8 -6
- package/src/files/files.js +2 -0
- package/src/panels/imports-panel.js +2 -2
- package/src/panels/properties-panel.js +3 -3
- package/src/panels/stylebook-panel.js +27 -20
- package/src/settings/{collections-editor.js → content-types-editor.js} +48 -48
- package/src/settings/schema-field-ui.js +1 -1
- package/src/state.js +1 -1
- package/src/studio.js +10 -4
- package/src/utils/studio-utils.js +5 -5
package/dist/studio.js
CHANGED
|
@@ -32876,7 +32876,7 @@ var init_lit = __esm(() => {
|
|
|
32876
32876
|
});
|
|
32877
32877
|
|
|
32878
32878
|
// ../../node_modules/@spectrum-web-components/base/src/version.dev.js
|
|
32879
|
-
var version2 = "1.12.
|
|
32879
|
+
var version2 = "1.12.1", coreVersion2 = "0.1.0";
|
|
32880
32880
|
|
|
32881
32881
|
// ../../node_modules/@spectrum-web-components/base/src/Base.dev.js
|
|
32882
32882
|
function SpectrumMixin(constructor) {
|
|
@@ -174677,7 +174677,13 @@ async function renderCanvasLive(gen, doc, canvasEl) {
|
|
|
174677
174677
|
console.warn("Studio: failed to import package", entry, e);
|
|
174678
174678
|
}
|
|
174679
174679
|
} else if (entry?.$ref) {
|
|
174680
|
-
|
|
174680
|
+
let href;
|
|
174681
|
+
try {
|
|
174682
|
+
href = new URL(entry.$ref, docBase).href;
|
|
174683
|
+
} catch (urlErr) {
|
|
174684
|
+
console.warn("Studio: invalid element URL", { ref: entry.$ref, docBase }, urlErr);
|
|
174685
|
+
continue;
|
|
174686
|
+
}
|
|
174681
174687
|
try {
|
|
174682
174688
|
await defineElement(href);
|
|
174683
174689
|
} catch (e) {
|
|
@@ -176032,10 +176038,10 @@ function inferInputType(entry) {
|
|
|
176032
176038
|
return "combobox";
|
|
176033
176039
|
return "text";
|
|
176034
176040
|
}
|
|
176035
|
-
function
|
|
176036
|
-
if (!documentPath || !projectConfig?.
|
|
176041
|
+
function findContentTypeSchema(documentPath, projectConfig) {
|
|
176042
|
+
if (!documentPath || !projectConfig?.contentTypes)
|
|
176037
176043
|
return null;
|
|
176038
|
-
for (const [name, def3] of Object.entries(projectConfig.
|
|
176044
|
+
for (const [name, def3] of Object.entries(projectConfig.contentTypes)) {
|
|
176039
176045
|
if (!def3.source || !def3.schema)
|
|
176040
176046
|
continue;
|
|
176041
176047
|
const src = def3.source.replace(/^\.\//, "");
|
|
@@ -176609,14 +176615,14 @@ function renderDefsEditor(container) {
|
|
|
176609
176615
|
render2(tpl, container);
|
|
176610
176616
|
}
|
|
176611
176617
|
|
|
176612
|
-
// src/settings/
|
|
176618
|
+
// src/settings/content-types-editor.js
|
|
176613
176619
|
init_platform();
|
|
176614
176620
|
init_store();
|
|
176615
|
-
var
|
|
176621
|
+
var selectedContentType = null;
|
|
176616
176622
|
var showAddField2 = false;
|
|
176617
176623
|
var newFieldState2 = { name: "", type: "string", required: false };
|
|
176618
|
-
var
|
|
176619
|
-
var
|
|
176624
|
+
var showNewContentType = false;
|
|
176625
|
+
var newContentTypeName = "";
|
|
176620
176626
|
async function saveProjectConfig2() {
|
|
176621
176627
|
const platform3 = getPlatform();
|
|
176622
176628
|
const config = projectState.projectConfig;
|
|
@@ -176624,35 +176630,35 @@ async function saveProjectConfig2() {
|
|
|
176624
176630
|
}
|
|
176625
176631
|
function getSelectedSchema() {
|
|
176626
176632
|
const config = projectState?.projectConfig;
|
|
176627
|
-
return config?.
|
|
176633
|
+
return config?.contentTypes?.[selectedContentType]?.schema;
|
|
176628
176634
|
}
|
|
176629
|
-
function
|
|
176630
|
-
const slug =
|
|
176635
|
+
function handleNewContentType(rerender) {
|
|
176636
|
+
const slug = newContentTypeName.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
176631
176637
|
if (!slug)
|
|
176632
176638
|
return;
|
|
176633
176639
|
const config = projectState?.projectConfig;
|
|
176634
176640
|
if (!config)
|
|
176635
176641
|
return;
|
|
176636
|
-
if (!config.
|
|
176637
|
-
config.
|
|
176638
|
-
if (config.
|
|
176642
|
+
if (!config.contentTypes)
|
|
176643
|
+
config.contentTypes = {};
|
|
176644
|
+
if (config.contentTypes[slug])
|
|
176639
176645
|
return;
|
|
176640
|
-
config.
|
|
176641
|
-
source:
|
|
176646
|
+
config.contentTypes[slug] = {
|
|
176647
|
+
source: `./content/${slug}/**/*.md`,
|
|
176642
176648
|
schema: { type: "object", properties: {}, required: [] }
|
|
176643
176649
|
};
|
|
176644
|
-
|
|
176645
|
-
|
|
176646
|
-
|
|
176650
|
+
selectedContentType = slug;
|
|
176651
|
+
showNewContentType = false;
|
|
176652
|
+
newContentTypeName = "";
|
|
176647
176653
|
rerender();
|
|
176648
176654
|
saveProjectConfig2().then(async () => {
|
|
176649
176655
|
const platform3 = getPlatform();
|
|
176650
|
-
await platform3.writeFile(
|
|
176656
|
+
await platform3.writeFile(`content/${slug}/.gitkeep`, "");
|
|
176651
176657
|
});
|
|
176652
176658
|
}
|
|
176653
176659
|
function handleAddField2(rerender) {
|
|
176654
176660
|
const name = newFieldState2.name.trim();
|
|
176655
|
-
if (!name || !
|
|
176661
|
+
if (!name || !selectedContentType)
|
|
176656
176662
|
return;
|
|
176657
176663
|
const schema = getSelectedSchema();
|
|
176658
176664
|
if (!schema)
|
|
@@ -176788,30 +176794,30 @@ function handleChangeNestedType2(parentName, childName, newType, rerender) {
|
|
|
176788
176794
|
rerender();
|
|
176789
176795
|
saveProjectConfig2();
|
|
176790
176796
|
}
|
|
176791
|
-
function
|
|
176792
|
-
if (!
|
|
176797
|
+
function handleDeleteContentType(rerender) {
|
|
176798
|
+
if (!selectedContentType)
|
|
176793
176799
|
return;
|
|
176794
176800
|
const config = projectState?.projectConfig;
|
|
176795
|
-
if (!config?.
|
|
176801
|
+
if (!config?.contentTypes?.[selectedContentType])
|
|
176796
176802
|
return;
|
|
176797
|
-
delete config.
|
|
176798
|
-
|
|
176803
|
+
delete config.contentTypes[selectedContentType];
|
|
176804
|
+
selectedContentType = null;
|
|
176799
176805
|
rerender();
|
|
176800
176806
|
saveProjectConfig2();
|
|
176801
176807
|
}
|
|
176802
|
-
function
|
|
176803
|
-
const rerender = () =>
|
|
176808
|
+
function renderContentTypesEditor(container) {
|
|
176809
|
+
const rerender = () => renderContentTypesEditor(container);
|
|
176804
176810
|
const config = projectState?.projectConfig;
|
|
176805
|
-
const
|
|
176806
|
-
const
|
|
176811
|
+
const contentTypes = config?.contentTypes || {};
|
|
176812
|
+
const contentTypeNames = Object.keys(contentTypes);
|
|
176807
176813
|
const listTpl = html`
|
|
176808
176814
|
<div class="settings-list-panel">
|
|
176809
|
-
${
|
|
176815
|
+
${contentTypeNames.map((name) => html`
|
|
176810
176816
|
<sp-action-button
|
|
176811
176817
|
size="s"
|
|
176812
|
-
?selected=${
|
|
176818
|
+
?selected=${selectedContentType === name}
|
|
176813
176819
|
@click=${() => {
|
|
176814
|
-
|
|
176820
|
+
selectedContentType = name;
|
|
176815
176821
|
showAddField2 = false;
|
|
176816
176822
|
rerender();
|
|
176817
176823
|
}}
|
|
@@ -176819,25 +176825,25 @@ function renderCollectionsEditor(container) {
|
|
|
176819
176825
|
${name}
|
|
176820
176826
|
</sp-action-button>
|
|
176821
176827
|
`)}
|
|
176822
|
-
${
|
|
176828
|
+
${showNewContentType ? html`
|
|
176823
176829
|
<div class="settings-inline-form">
|
|
176824
176830
|
<sp-textfield
|
|
176825
176831
|
size="s"
|
|
176826
|
-
placeholder="
|
|
176827
|
-
.value=${
|
|
176832
|
+
placeholder="content-type-name"
|
|
176833
|
+
.value=${newContentTypeName}
|
|
176828
176834
|
@input=${(e) => {
|
|
176829
|
-
|
|
176835
|
+
newContentTypeName = e.target.value;
|
|
176830
176836
|
}}
|
|
176831
176837
|
@keydown=${(e) => {
|
|
176832
176838
|
if (e.key === "Enter")
|
|
176833
|
-
|
|
176839
|
+
handleNewContentType(rerender);
|
|
176834
176840
|
if (e.key === "Escape") {
|
|
176835
|
-
|
|
176841
|
+
showNewContentType = false;
|
|
176836
176842
|
rerender();
|
|
176837
176843
|
}
|
|
176838
176844
|
}}
|
|
176839
176845
|
></sp-textfield>
|
|
176840
|
-
<sp-action-button size="s" @click=${() =>
|
|
176846
|
+
<sp-action-button size="s" @click=${() => handleNewContentType(rerender)}>
|
|
176841
176847
|
Create
|
|
176842
176848
|
</sp-action-button>
|
|
176843
176849
|
</div>
|
|
@@ -176846,20 +176852,20 @@ function renderCollectionsEditor(container) {
|
|
|
176846
176852
|
size="s"
|
|
176847
176853
|
quiet
|
|
176848
176854
|
@click=${() => {
|
|
176849
|
-
|
|
176855
|
+
showNewContentType = true;
|
|
176850
176856
|
rerender();
|
|
176851
176857
|
}}
|
|
176852
176858
|
>
|
|
176853
|
-
<sp-icon-add slot="icon"></sp-icon-add> New
|
|
176859
|
+
<sp-icon-add slot="icon"></sp-icon-add> New Content Type
|
|
176854
176860
|
</sp-action-button>
|
|
176855
176861
|
`}
|
|
176856
176862
|
</div>
|
|
176857
176863
|
`;
|
|
176858
176864
|
let editorTpl;
|
|
176859
|
-
if (!
|
|
176860
|
-
editorTpl = html`<div class="settings-empty-state">Select or create a
|
|
176865
|
+
if (!selectedContentType || !contentTypes[selectedContentType]) {
|
|
176866
|
+
editorTpl = html`<div class="settings-empty-state">Select or create a content type</div>`;
|
|
176861
176867
|
} else {
|
|
176862
|
-
const col =
|
|
176868
|
+
const col = contentTypes[selectedContentType];
|
|
176863
176869
|
const schema = col.schema || {};
|
|
176864
176870
|
const properties = schema.properties || {};
|
|
176865
176871
|
const required = schema.required || [];
|
|
@@ -176878,13 +176884,13 @@ function renderCollectionsEditor(container) {
|
|
|
176878
176884
|
editorTpl = html`
|
|
176879
176885
|
<div class="settings-editor-panel">
|
|
176880
176886
|
<div class="settings-editor-header">
|
|
176881
|
-
<h3>${
|
|
176887
|
+
<h3>${selectedContentType}</h3>
|
|
176882
176888
|
<sp-field-label size="s">Source: ${col.source || "—"}</sp-field-label>
|
|
176883
176889
|
<sp-action-button
|
|
176884
176890
|
size="xs"
|
|
176885
176891
|
quiet
|
|
176886
|
-
title="Delete
|
|
176887
|
-
@click=${() =>
|
|
176892
|
+
title="Delete content type"
|
|
176893
|
+
@click=${() => handleDeleteContentType(rerender)}
|
|
176888
176894
|
>
|
|
176889
176895
|
<sp-icon-delete slot="icon"></sp-icon-delete>
|
|
176890
176896
|
</sp-action-button>
|
|
@@ -177145,11 +177151,11 @@ function renderStylebookMode(ctx) {
|
|
|
177145
177151
|
>
|
|
177146
177152
|
<sp-tab label="Stylebook" value="stylebook"></sp-tab>
|
|
177147
177153
|
<sp-tab label="Definitions" value="definitions"></sp-tab>
|
|
177148
|
-
<sp-tab label="
|
|
177154
|
+
<sp-tab label="Content Types" value="contentTypes"></sp-tab>
|
|
177149
177155
|
</sp-tabs>
|
|
177150
177156
|
</div>
|
|
177151
177157
|
`;
|
|
177152
|
-
if (settingsTab === "definitions" || settingsTab === "
|
|
177158
|
+
if (settingsTab === "definitions" || settingsTab === "contentTypes") {
|
|
177153
177159
|
canvasWrap.style.overflow = "hidden";
|
|
177154
177160
|
render2(html`${settingsChromeBarTpl}
|
|
177155
177161
|
<div
|
|
@@ -177160,7 +177166,7 @@ function renderStylebookMode(ctx) {
|
|
|
177160
177166
|
if (settingsTab === "definitions")
|
|
177161
177167
|
renderDefsEditor(container);
|
|
177162
177168
|
else
|
|
177163
|
-
|
|
177169
|
+
renderContentTypesEditor(container);
|
|
177164
177170
|
return;
|
|
177165
177171
|
}
|
|
177166
177172
|
view.stylebookElToTag = new WeakMap;
|
|
@@ -177293,13 +177299,6 @@ function selectStylebookTag(tag3, media) {
|
|
|
177293
177299
|
}
|
|
177294
177300
|
});
|
|
177295
177301
|
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
177302
|
}
|
|
177304
177303
|
function renderStylebookOverlays() {
|
|
177305
177304
|
if (!_ctx6)
|
|
@@ -177337,7 +177336,7 @@ function renderStylebookOverlays() {
|
|
|
177337
177336
|
`, panel.overlay);
|
|
177338
177337
|
}
|
|
177339
177338
|
}
|
|
177340
|
-
function buildStylebookElement(entry, rootStyle, activeBreakpoints) {
|
|
177339
|
+
function buildStylebookElement(entry, rootStyle, activeBreakpoints, parentTag = null) {
|
|
177341
177340
|
const el = document.createElement(entry.tag);
|
|
177342
177341
|
if (entry.text)
|
|
177343
177342
|
el.textContent = entry.text;
|
|
@@ -177350,7 +177349,8 @@ function buildStylebookElement(entry, rootStyle, activeBreakpoints) {
|
|
|
177350
177349
|
}
|
|
177351
177350
|
if (entry.style)
|
|
177352
177351
|
el.style.cssText = entry.style;
|
|
177353
|
-
const
|
|
177352
|
+
const compoundSelector = parentTag && parentTag !== entry.tag ? `& ${parentTag} ${entry.tag}` : null;
|
|
177353
|
+
const tagStyle = compoundSelector && rootStyle[compoundSelector] || rootStyle[`& ${entry.tag}`];
|
|
177354
177354
|
if (tagStyle) {
|
|
177355
177355
|
for (const [prop, val] of Object.entries(tagStyle)) {
|
|
177356
177356
|
if (typeof val === "string" || typeof val === "number") {
|
|
@@ -177380,7 +177380,7 @@ function buildStylebookElement(entry, rootStyle, activeBreakpoints) {
|
|
|
177380
177380
|
}
|
|
177381
177381
|
if (entry.children) {
|
|
177382
177382
|
for (const child of entry.children) {
|
|
177383
|
-
el.appendChild(buildStylebookElement(child, rootStyle, activeBreakpoints));
|
|
177383
|
+
el.appendChild(buildStylebookElement(child, rootStyle, activeBreakpoints, entry.tag));
|
|
177384
177384
|
}
|
|
177385
177385
|
}
|
|
177386
177386
|
return el;
|
|
@@ -177417,6 +177417,11 @@ function hasTagStyle(rootStyle, tag3) {
|
|
|
177417
177417
|
return s && typeof s === "object" && Object.keys(s).length > 0;
|
|
177418
177418
|
}
|
|
177419
177419
|
function renderStylebookElementsIntoCanvas(canvasEl, rootStyle, filter, customizedOnly, activeBreakpoints) {
|
|
177420
|
+
for (const [k, v] of Object.entries(rootStyle)) {
|
|
177421
|
+
if (k.startsWith("--") && (typeof v === "string" || typeof v === "number")) {
|
|
177422
|
+
canvasEl.style.setProperty(k, String(v));
|
|
177423
|
+
}
|
|
177424
|
+
}
|
|
177420
177425
|
const sectionTemplates = [];
|
|
177421
177426
|
for (const section of stylebook_meta_default.$sections) {
|
|
177422
177427
|
let entries2 = section.elements;
|
|
@@ -177439,10 +177444,11 @@ function renderStylebookElementsIntoCanvas(canvasEl, rootStyle, filter, customiz
|
|
|
177439
177444
|
view.stylebookElToTag.set(card, entry.tag);
|
|
177440
177445
|
elToPath.set(card, ["__sb", entry.tag]);
|
|
177441
177446
|
for (const child of el.querySelectorAll("*")) {
|
|
177442
|
-
const
|
|
177447
|
+
const childTag = child.tagName.toLowerCase();
|
|
177443
177448
|
if (!view.stylebookElToTag.has(child)) {
|
|
177444
|
-
|
|
177445
|
-
|
|
177449
|
+
const compound = childTag === entry.tag ? entry.tag : `${entry.tag} ${childTag}`;
|
|
177450
|
+
view.stylebookElToTag.set(child, compound);
|
|
177451
|
+
elToPath.set(child, ["__sb", compound]);
|
|
177446
177452
|
}
|
|
177447
177453
|
}
|
|
177448
177454
|
})}
|
|
@@ -177450,8 +177456,10 @@ function renderStylebookElementsIntoCanvas(canvasEl, rootStyle, filter, customiz
|
|
|
177450
177456
|
<div
|
|
177451
177457
|
class="element-card-preview"
|
|
177452
177458
|
${ref((c) => {
|
|
177453
|
-
if (c
|
|
177459
|
+
if (c) {
|
|
177460
|
+
c.textContent = "";
|
|
177454
177461
|
c.appendChild(el);
|
|
177462
|
+
}
|
|
177455
177463
|
})}
|
|
177456
177464
|
></div>
|
|
177457
177465
|
<div class="element-card-label"><${entry.tag}></div>
|
|
@@ -179094,9 +179102,9 @@ var ENTITY_TYPES = [
|
|
|
179094
179102
|
{ key: "component", label: "Component", dir: "components", ext: ".json" },
|
|
179095
179103
|
{ key: "content", label: "Content", dir: "content", ext: ".md" }
|
|
179096
179104
|
];
|
|
179097
|
-
function buildFrontmatterYaml(
|
|
179105
|
+
function buildFrontmatterYaml(contentTypeName) {
|
|
179098
179106
|
const config = projectState?.projectConfig;
|
|
179099
|
-
const col = config?.
|
|
179107
|
+
const col = config?.contentTypes?.[contentTypeName];
|
|
179100
179108
|
if (!col?.schema?.properties)
|
|
179101
179109
|
return `title: Untitled
|
|
179102
179110
|
`;
|
|
@@ -179109,26 +179117,26 @@ function buildFrontmatterYaml(collectionName) {
|
|
|
179109
179117
|
return yaml || `title: Untitled
|
|
179110
179118
|
`;
|
|
179111
179119
|
}
|
|
179112
|
-
function
|
|
179120
|
+
function getContentTypeTypes() {
|
|
179113
179121
|
const config = projectState?.projectConfig;
|
|
179114
|
-
if (!config?.
|
|
179122
|
+
if (!config?.contentTypes)
|
|
179115
179123
|
return [];
|
|
179116
|
-
return Object.entries(config.
|
|
179124
|
+
return Object.entries(config.contentTypes).map(([name, def3]) => {
|
|
179117
179125
|
const d2 = def3;
|
|
179118
179126
|
const dir = d2.source ? d2.source.replace(/^\.\//, "").split("/")[0] : name;
|
|
179119
179127
|
return {
|
|
179120
|
-
key: `
|
|
179128
|
+
key: `contentType:${name}`,
|
|
179121
179129
|
label: name.charAt(0).toUpperCase() + name.slice(1),
|
|
179122
179130
|
dir,
|
|
179123
179131
|
ext: ".md",
|
|
179124
|
-
|
|
179132
|
+
contentTypeName: name
|
|
179125
179133
|
};
|
|
179126
179134
|
});
|
|
179127
179135
|
}
|
|
179128
179136
|
async function handleNewEntity(typeKey, container, ctx) {
|
|
179129
|
-
const
|
|
179130
|
-
const
|
|
179131
|
-
const allTypes = [...ENTITY_TYPES, ...
|
|
179137
|
+
const isContentType = typeKey.startsWith("contentType:");
|
|
179138
|
+
const contentTypeName = isContentType ? typeKey.slice("contentType:".length) : null;
|
|
179139
|
+
const allTypes = [...ENTITY_TYPES, ...getContentTypeTypes()];
|
|
179132
179140
|
const typeInfo = allTypes.find((t) => t.key === typeKey);
|
|
179133
179141
|
if (!typeInfo)
|
|
179134
179142
|
return;
|
|
@@ -179139,7 +179147,7 @@ async function handleNewEntity(typeKey, container, ctx) {
|
|
|
179139
179147
|
const filePath = `${typeInfo.dir}/${slug}${typeInfo.ext}`;
|
|
179140
179148
|
let content;
|
|
179141
179149
|
if (typeInfo.ext === ".md") {
|
|
179142
|
-
const frontmatter =
|
|
179150
|
+
const frontmatter = contentTypeName ? buildFrontmatterYaml(contentTypeName) : `title: Untitled
|
|
179143
179151
|
`;
|
|
179144
179152
|
content = `---
|
|
179145
179153
|
${frontmatter}---
|
|
@@ -179180,7 +179188,7 @@ async function renderBrowse(container, ctx) {
|
|
|
179180
179188
|
await loadFiles();
|
|
179181
179189
|
}
|
|
179182
179190
|
const files = filteredFiles();
|
|
179183
|
-
const
|
|
179191
|
+
const contentTypeTypes = getContentTypeTypes();
|
|
179184
179192
|
const filterBar = html`
|
|
179185
179193
|
<div class="browse-filter-bar">
|
|
179186
179194
|
<sp-action-group selects="single" size="s" compact>
|
|
@@ -179216,7 +179224,7 @@ async function renderBrowse(container, ctx) {
|
|
|
179216
179224
|
@change=${(e) => handleNewEntity(e.target.value, container, ctx)}
|
|
179217
179225
|
>
|
|
179218
179226
|
${ENTITY_TYPES.map((t) => html`<sp-menu-item value=${t.key}>${t.label}</sp-menu-item>`)}
|
|
179219
|
-
${
|
|
179227
|
+
${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
179228
|
</sp-menu>
|
|
179221
179229
|
</sp-popover>
|
|
179222
179230
|
</overlay-trigger>
|
|
@@ -179527,7 +179535,8 @@ function renderCanvas() {
|
|
|
179527
179535
|
const S = _ctx10.getState();
|
|
179528
179536
|
const canvasMode = _ctx10.getCanvasMode();
|
|
179529
179537
|
++view.renderGeneration;
|
|
179530
|
-
|
|
179538
|
+
const modeChanged = canvasMode !== view.prevCanvasMode;
|
|
179539
|
+
if (modeChanged && canvasWrap["_$litPart$"]) {
|
|
179531
179540
|
canvasWrap.textContent = "";
|
|
179532
179541
|
delete canvasWrap["_$litPart$"];
|
|
179533
179542
|
}
|
|
@@ -179548,7 +179557,6 @@ function renderCanvas() {
|
|
|
179548
179557
|
}
|
|
179549
179558
|
return;
|
|
179550
179559
|
}
|
|
179551
|
-
const modeChanged = canvasMode !== view.prevCanvasMode;
|
|
179552
179560
|
view.prevCanvasMode = canvasMode;
|
|
179553
179561
|
for (const fn of view.canvasDndCleanups)
|
|
179554
179562
|
fn();
|
|
@@ -183992,6 +184000,8 @@ ${md}` : md;
|
|
|
183992
184000
|
if (path2.endsWith(".md")) {
|
|
183993
184001
|
await ctx.loadMarkdown(content3, null);
|
|
183994
184002
|
ctx.S.documentPath = path2;
|
|
184003
|
+
ctx.S.dirty = false;
|
|
184004
|
+
ctx.commit(ctx.S);
|
|
183995
184005
|
} else {
|
|
183996
184006
|
const doc = JSON.parse(content3);
|
|
183997
184007
|
const newS = createState(doc);
|
|
@@ -187269,7 +187279,7 @@ function renderGitPanel(S) {
|
|
|
187269
187279
|
}
|
|
187270
187280
|
|
|
187271
187281
|
// ../../node_modules/@spectrum-web-components/base/src/version.js
|
|
187272
|
-
var version = "1.12.
|
|
187282
|
+
var version = "1.12.1";
|
|
187273
187283
|
var coreVersion = "0.1.0";
|
|
187274
187284
|
|
|
187275
187285
|
// ../../node_modules/@spectrum-web-components/theme/src/theme-interfaces.dev.js
|
|
@@ -213747,7 +213757,7 @@ function kvRow(key, value2, onChange, onDelete, datalistId = null) {
|
|
|
213747
213757
|
function renderFrontmatterOnlyPanel() {
|
|
213748
213758
|
const S = getState();
|
|
213749
213759
|
const fm = S.content?.frontmatter || {};
|
|
213750
|
-
const col =
|
|
213760
|
+
const col = findContentTypeSchema(S.documentPath, projectState?.projectConfig);
|
|
213751
213761
|
const schemaProps = col?.schema?.properties;
|
|
213752
213762
|
const requiredFields = new Set(col?.schema?.required || []);
|
|
213753
213763
|
const fields = [];
|
|
@@ -214588,7 +214598,7 @@ function renderPropertiesPanelTemplate(ctx) {
|
|
|
214588
214598
|
})() : nothing;
|
|
214589
214599
|
const frontmatterT = S.mode === "content" ? (() => {
|
|
214590
214600
|
const fm = S.content?.frontmatter || {};
|
|
214591
|
-
const col =
|
|
214601
|
+
const col = findContentTypeSchema(S.documentPath, projectState?.projectConfig);
|
|
214592
214602
|
const schemaProps = col?.schema?.properties;
|
|
214593
214603
|
const requiredFields = new Set(col?.schema?.required || []);
|
|
214594
214604
|
const fields = [];
|
|
@@ -215565,13 +215575,19 @@ if (_openParam) {
|
|
|
215565
215575
|
}
|
|
215566
215576
|
projectState.projectDirs = foundDirs;
|
|
215567
215577
|
}
|
|
215568
|
-
const
|
|
215578
|
+
const _fileParam = new URLSearchParams(location.search).get("file");
|
|
215579
|
+
const fileRelPath = _fileParam || siteCtx.fileRelPath || _openParam;
|
|
215569
215580
|
const content3 = await platform4.readFile(fileRelPath);
|
|
215570
215581
|
if (content3) {
|
|
215571
|
-
|
|
215572
|
-
|
|
215582
|
+
if (fileRelPath.endsWith(".md")) {
|
|
215583
|
+
await loadMarkdown2(content3, null);
|
|
215584
|
+
S.documentPath = fileRelPath;
|
|
215585
|
+
} else {
|
|
215586
|
+
const parsed = JSON.parse(content3);
|
|
215587
|
+
S = createState(parsed);
|
|
215588
|
+
S.documentPath = fileRelPath;
|
|
215589
|
+
}
|
|
215573
215590
|
S.dirty = false;
|
|
215574
|
-
S.documentPath = fileRelPath;
|
|
215575
215591
|
S.ui = { ...S.ui, leftTab: "files" };
|
|
215576
215592
|
({ doc, session } = fromFlat(S));
|
|
215577
215593
|
render();
|
|
@@ -215703,5 +215719,5 @@ addUpdateMiddleware((state3) => {
|
|
|
215703
215719
|
scheduleAutosave();
|
|
215704
215720
|
});
|
|
215705
215721
|
|
|
215706
|
-
//# debugId=
|
|
215722
|
+
//# debugId=2B1FE5B3505549D664756E2164756E21
|
|
215707
215723
|
//# sourceMappingURL=studio.js.map
|