@yugoo-design/dsh-design-studio-ui 0.1.0-beta.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -15
- package/lib/index.d.ts +21 -3
- package/lib/index.js +422 -376
- package/licenses/dsh-distribution.json +594 -31
- package/package.json +8 -3
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
1
|
+
import { Fragment, createContext, createElement, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
2
2
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
//#region src/controller.ts
|
|
@@ -443,13 +443,31 @@ var StudioPanelDraftController = class {
|
|
|
443
443
|
*/
|
|
444
444
|
/** Split one leading YAML frontmatter block from the document body. */
|
|
445
445
|
function splitFrontmatter(source) {
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
446
|
+
const opening = /^\uFEFF?---[ \t]*\r?\n/u.exec(source);
|
|
447
|
+
if (opening === null) return { body: source };
|
|
448
|
+
const remaining = source.slice(opening[0].length);
|
|
449
|
+
const closing = /^---[ \t]*(?:\r?\n|$)/mu.exec(remaining);
|
|
450
|
+
if (closing === null) return { body: source };
|
|
448
451
|
return {
|
|
449
|
-
frontmatter:
|
|
450
|
-
body:
|
|
452
|
+
frontmatter: remaining.slice(0, closing.index).replace(/\r?\n$/u, ""),
|
|
453
|
+
body: remaining.slice(closing.index + closing[0].length)
|
|
451
454
|
};
|
|
452
455
|
}
|
|
456
|
+
/** Shared full-file reading view; source/editing modes retain their original bytes. */
|
|
457
|
+
function renderStudioDocument(source, options) {
|
|
458
|
+
const { frontmatter, body } = splitFrontmatter(source);
|
|
459
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [frontmatter === void 0 ? null : /* @__PURE__ */ jsxs("details", {
|
|
460
|
+
className: "ygd-studio-file-metadata",
|
|
461
|
+
children: [/* @__PURE__ */ jsx("summary", { children: options.locale === "zh" ? "文件元信息 · 展开查看" : "File metadata · expand to view" }), /* @__PURE__ */ jsx("pre", {
|
|
462
|
+
className: "ygd-studio-frontmatter",
|
|
463
|
+
"aria-label": "frontmatter",
|
|
464
|
+
children: frontmatter
|
|
465
|
+
})]
|
|
466
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
467
|
+
"aria-label": options.ariaLabel,
|
|
468
|
+
children: renderStudioMarkdown(body)
|
|
469
|
+
})] });
|
|
470
|
+
}
|
|
453
471
|
/** Parse `**bold**` and `` `code` `` segments into React nodes; everything else is plain text. */
|
|
454
472
|
function inlineNodes(text, keyPrefix) {
|
|
455
473
|
const nodes = [];
|
|
@@ -707,6 +725,17 @@ const STUDIO_WORKSPACE_CSS = `
|
|
|
707
725
|
background:var(--ds-background);color:var(--ds-text);
|
|
708
726
|
font-family:var(--ds-body-font);font-size:var(--ds-base-font-size);line-height:var(--ds-line-height)}
|
|
709
727
|
.ygd-studio-workspace *{box-sizing:border-box}
|
|
728
|
+
.ygd-studio-workspace .ygd-studio-select{
|
|
729
|
+
--ds-bg-white:var(--ds-surface);--ds-fill-5:var(--ds-border);--ds-border-default:var(--ds-border);
|
|
730
|
+
--ds-text-primary:var(--ds-text);--ds-icon-outline-default:var(--ds-text-secondary);
|
|
731
|
+
--ds-brand-light-bg-default:var(--ds-primary-light);--ds-brand-text-primary:var(--ds-primary-dark);
|
|
732
|
+
--ds-radius-4:var(--ds-radius);--ygd-panel-control-focus:var(--ds-primary);
|
|
733
|
+
display:inline-flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;max-width:100%;height:32px;
|
|
734
|
+
padding:4px 10px;border:1px solid var(--ds-border);border-radius:var(--ds-radius);background:var(--ds-surface);color:var(--ds-text);font:inherit;line-height:20px;text-align:start;cursor:pointer}
|
|
735
|
+
.ygd-studio-select:focus-visible{outline:2px solid var(--ds-primary);outline-offset:2px}
|
|
736
|
+
.ygd-studio-select:disabled{cursor:not-allowed;opacity:.6}
|
|
737
|
+
button.ygd-studio-select>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
738
|
+
button.ygd-studio-select>span:last-child{display:flex;flex:none;align-items:center;color:var(--ds-text-secondary)}
|
|
710
739
|
.ygd-studio-workspace h1,.ygd-studio-workspace h2,.ygd-studio-workspace h3,.ygd-studio-workspace h4,.ygd-studio-workspace p,.ygd-studio-workspace ul,.ygd-studio-workspace ol{margin:0}
|
|
711
740
|
|
|
712
741
|
/* Narrow-viewport drawer toggle; positioned by the responsive block below */
|
|
@@ -1173,6 +1202,39 @@ function LoadingIndicator({ label }) {
|
|
|
1173
1202
|
});
|
|
1174
1203
|
}
|
|
1175
1204
|
//#endregion
|
|
1205
|
+
//#region src/StudioSelect.tsx
|
|
1206
|
+
const StudioSelectContext = createContext(void 0);
|
|
1207
|
+
/** Hosts may supply their shared accessible control; minimal hosts keep a
|
|
1208
|
+
* controlled native select, including visible unknown values and disabled state. */
|
|
1209
|
+
function StudioSelect({ className, ...props }) {
|
|
1210
|
+
const renderer = useContext(StudioSelectContext);
|
|
1211
|
+
const controlProps = {
|
|
1212
|
+
...props,
|
|
1213
|
+
className: `ygd-studio-select${className ? ` ${className}` : ""}`
|
|
1214
|
+
};
|
|
1215
|
+
if (renderer) return createElement(renderer, controlProps);
|
|
1216
|
+
const choices = props.options.some((option) => option.value === props.value) ? props.options : [{
|
|
1217
|
+
value: props.value,
|
|
1218
|
+
label: props.value,
|
|
1219
|
+
disabled: props.value !== ""
|
|
1220
|
+
}, ...props.options];
|
|
1221
|
+
return /* @__PURE__ */ jsx("select", {
|
|
1222
|
+
className: controlProps.className,
|
|
1223
|
+
"aria-label": props["aria-label"],
|
|
1224
|
+
value: props.value,
|
|
1225
|
+
disabled: props.disabled,
|
|
1226
|
+
onChange: (event) => {
|
|
1227
|
+
const value = event.currentTarget.value;
|
|
1228
|
+
if (!props.disabled && choices.some((option) => option.value === value && !option.disabled)) props.onValueChange(value);
|
|
1229
|
+
},
|
|
1230
|
+
children: choices.map((option) => /* @__PURE__ */ jsx("option", {
|
|
1231
|
+
value: option.value,
|
|
1232
|
+
disabled: option.disabled,
|
|
1233
|
+
children: option.label
|
|
1234
|
+
}, option.value))
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
//#endregion
|
|
1176
1238
|
//#region src/FileExplorer.tsx
|
|
1177
1239
|
function FileExplorer({ paths, selected, openFile, disabled = false }) {
|
|
1178
1240
|
const branch = (prefix) => {
|
|
@@ -1422,7 +1484,10 @@ function KitFiles({ client, name, version, mindset, description, locale, renderM
|
|
|
1422
1484
|
children: busy ? /* @__PURE__ */ jsx(LoadingIndicator, { label: zh ? "正在读取文件" : "Loading file" }) : error ? /* @__PURE__ */ jsx("p", {
|
|
1423
1485
|
role: "alert",
|
|
1424
1486
|
children: error
|
|
1425
|
-
}) : read && /\.md$/i.test(path) ?
|
|
1487
|
+
}) : read && /\.md$/i.test(path) ? renderStudioDocument(content, {
|
|
1488
|
+
locale,
|
|
1489
|
+
ariaLabel: "Kit document"
|
|
1490
|
+
}) : /* @__PURE__ */ jsx("pre", {
|
|
1426
1491
|
"aria-label": "Kit file source",
|
|
1427
1492
|
style: {
|
|
1428
1493
|
padding: 16,
|
|
@@ -1943,18 +2008,21 @@ function KitDraftEditor({ record, authoring, locale, opening, onDirtyChange, onR
|
|
|
1943
2008
|
/* @__PURE__ */ jsxs("div", {
|
|
1944
2009
|
className: "ygd-studio-draft-sources",
|
|
1945
2010
|
children: [
|
|
1946
|
-
/* @__PURE__ */ jsxs("label", { children: ["Bundle", /* @__PURE__ */
|
|
2011
|
+
/* @__PURE__ */ jsxs("label", { children: ["Bundle", /* @__PURE__ */ jsx(StudioSelect, {
|
|
1947
2012
|
"aria-label": "Preview Bundle",
|
|
1948
2013
|
disabled: opening || state.busy,
|
|
1949
2014
|
value: bundleKey,
|
|
1950
|
-
|
|
2015
|
+
onValueChange: (value) => {
|
|
1951
2016
|
controller.clearPreview();
|
|
1952
|
-
setBundleKey(
|
|
2017
|
+
setBundleKey(value);
|
|
1953
2018
|
},
|
|
1954
|
-
|
|
2019
|
+
options: [{
|
|
1955
2020
|
value: "",
|
|
1956
|
-
|
|
1957
|
-
}
|
|
2021
|
+
label: "—"
|
|
2022
|
+
}, ...record.mounts.map((mount) => ({
|
|
2023
|
+
value: `${mount.name}@${mount.version}`,
|
|
2024
|
+
label: `${mount.name}@${mount.version}`
|
|
2025
|
+
}))]
|
|
1958
2026
|
})] }),
|
|
1959
2027
|
/* @__PURE__ */ jsxs("label", { children: [t.sample, /* @__PURE__ */ jsx("textarea", {
|
|
1960
2028
|
"aria-label": t.sample,
|
|
@@ -3536,7 +3604,7 @@ function InstanceWorkbench({ client, id, locale, onBack, onChanged, renderPrevie
|
|
|
3536
3604
|
}) : !loaded ? /* @__PURE__ */ jsx("p", {
|
|
3537
3605
|
role: "status",
|
|
3538
3606
|
children: error ? zh ? "无法读取此文件。" : "Could not load this file." : path ? zh ? "读取中…" : "Loading…" : zh ? "没有可读取的文件。" : "No readable files."
|
|
3539
|
-
}) : reading && /\.md$/i.test(path) ? /* @__PURE__ */ jsx("div", { children:
|
|
3607
|
+
}) : reading && /\.md$/i.test(path) ? /* @__PURE__ */ jsx("div", { children: renderStudioDocument(content, { locale }) }) : /* @__PURE__ */ jsx("textarea", {
|
|
3540
3608
|
"aria-label": path || "Source file",
|
|
3541
3609
|
spellCheck: false,
|
|
3542
3610
|
value: content,
|
|
@@ -3583,18 +3651,14 @@ function InstanceWorkbench({ client, id, locale, onBack, onChanged, renderPrevie
|
|
|
3583
3651
|
children: [
|
|
3584
3652
|
record?.kind === "kit" && /* @__PURE__ */ jsx("div", {
|
|
3585
3653
|
className: "ygd-studio-doc-toolbar",
|
|
3586
|
-
children: /* @__PURE__ */ jsxs("label", { children: [zh ? "Bundle " : "Bundle ", /* @__PURE__ */ jsx(
|
|
3654
|
+
children: /* @__PURE__ */ jsxs("label", { children: [zh ? "Bundle " : "Bundle ", /* @__PURE__ */ jsx(StudioSelect, {
|
|
3587
3655
|
"aria-label": "Preview Bundle",
|
|
3588
3656
|
value: bundleKey,
|
|
3589
|
-
|
|
3590
|
-
|
|
3657
|
+
onValueChange: setBundleKey,
|
|
3658
|
+
options: record.mounts.map((mount) => ({
|
|
3591
3659
|
value: `${mount.bundle.name}@${mount.bundle.version}`,
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
" · ",
|
|
3595
|
-
mount.bundle.version
|
|
3596
|
-
]
|
|
3597
|
-
}, `${mount.bundle.name}@${mount.bundle.version}`))
|
|
3660
|
+
label: `${mount.bundle.name} · ${mount.bundle.version}`
|
|
3661
|
+
}))
|
|
3598
3662
|
})] })
|
|
3599
3663
|
}),
|
|
3600
3664
|
previewBusy && /* @__PURE__ */ jsx(LoadingIndicator, { label: zh ? "正在准备预览" : "Preparing preview" }),
|
|
@@ -4730,7 +4794,7 @@ function InstalledPreview({ authoring, client, kit, bundle, locale, declarative,
|
|
|
4730
4794
|
});
|
|
4731
4795
|
}
|
|
4732
4796
|
/** Read-only Studio surface: one complete page with global nav, sidebar, and workspace main. */
|
|
4733
|
-
function StudioWorkspace({ client, controller: supplied, authoring, kitAuthoring, trials, instances, componentLibrary, contentClient, onDraftDirtyChange, locale: hostLocale, onLocaleChange }) {
|
|
4797
|
+
function StudioWorkspace({ client, controller: supplied, authoring, kitAuthoring, trials, instances, componentLibrary, renderSelect, contentClient, onDraftDirtyChange, locale: hostLocale, onLocaleChange }) {
|
|
4734
4798
|
const controller = useMemo(() => supplied ?? new StudioWorkspaceController(client), [client, supplied]);
|
|
4735
4799
|
const snapshot = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
|
|
4736
4800
|
const tabElements = useRef(/* @__PURE__ */ new Map());
|
|
@@ -5102,20 +5166,10 @@ function StudioWorkspace({ client, controller: supplied, authoring, kitAuthoring
|
|
|
5102
5166
|
/* @__PURE__ */ jsx("span", { children: draft ? locale === "zh" ? "工作副本 · 未发布" : "Working copy · unpublished" : locale === "zh" ? "已安装内容" : "Installed content" })
|
|
5103
5167
|
]
|
|
5104
5168
|
});
|
|
5105
|
-
const markdownDoc = (source, ariaLabel) => {
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
children: [/* @__PURE__ */ jsx("summary", { children: locale === "zh" ? "文件元信息 · 展开查看" : "File metadata · expand to view" }), /* @__PURE__ */ jsx("pre", {
|
|
5110
|
-
className: "ygd-studio-frontmatter",
|
|
5111
|
-
"aria-label": "frontmatter",
|
|
5112
|
-
children: frontmatter
|
|
5113
|
-
})]
|
|
5114
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
5115
|
-
"aria-label": ariaLabel,
|
|
5116
|
-
children: renderStudioMarkdown(body)
|
|
5117
|
-
})] });
|
|
5118
|
-
};
|
|
5169
|
+
const markdownDoc = (source, ariaLabel) => renderStudioDocument(source, {
|
|
5170
|
+
locale,
|
|
5171
|
+
ariaLabel
|
|
5172
|
+
});
|
|
5119
5173
|
/** Bundle descriptions are authored as Markdown lists; cards render the same safe subset. */
|
|
5120
5174
|
const cardDescription = (description) => /* @__PURE__ */ jsx("div", {
|
|
5121
5175
|
className: "ygd-studio-card-description",
|
|
@@ -5157,17 +5211,14 @@ function StudioWorkspace({ client, controller: supplied, authoring, kitAuthoring
|
|
|
5157
5211
|
className: "ygd-studio-page-title",
|
|
5158
5212
|
children: bundleTitle(bundleWorkspace.name, bundleWorkspace.version)
|
|
5159
5213
|
}),
|
|
5160
|
-
/* @__PURE__ */ jsxs("label", { children: [locale === "zh" ? "版本 " : "Version ", /* @__PURE__ */ jsx(
|
|
5214
|
+
/* @__PURE__ */ jsxs("label", { children: [locale === "zh" ? "版本 " : "Version ", /* @__PURE__ */ jsx(StudioSelect, {
|
|
5161
5215
|
"aria-label": locale === "zh" ? "Bundle 版本" : "Bundle version",
|
|
5162
5216
|
value: bundleWorkspace.version,
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
leaveDrafts(() => void controller.openBundleWorkspace(bundleWorkspace.name, version));
|
|
5166
|
-
},
|
|
5167
|
-
children: groupInstalledContent(snapshot.view?.bundles ?? []).find((group) => group.name === bundleWorkspace.name)?.versions.map((bundle) => /* @__PURE__ */ jsx("option", {
|
|
5217
|
+
onValueChange: (version) => leaveDrafts(() => void controller.openBundleWorkspace(bundleWorkspace.name, version)),
|
|
5218
|
+
options: groupInstalledContent(snapshot.view?.bundles ?? []).find((group) => group.name === bundleWorkspace.name)?.versions.map((bundle) => ({
|
|
5168
5219
|
value: bundle.version,
|
|
5169
|
-
|
|
5170
|
-
}
|
|
5220
|
+
label: bundle.version
|
|
5221
|
+
})) ?? []
|
|
5171
5222
|
})] })
|
|
5172
5223
|
]
|
|
5173
5224
|
}),
|
|
@@ -5538,17 +5589,14 @@ function StudioWorkspace({ client, controller: supplied, authoring, kitAuthoring
|
|
|
5538
5589
|
className: "ygd-studio-page-title",
|
|
5539
5590
|
children: displayName(workspace.name)
|
|
5540
5591
|
}),
|
|
5541
|
-
/* @__PURE__ */ jsxs("label", { children: [locale === "zh" ? "版本 " : "Version ", /* @__PURE__ */ jsx(
|
|
5592
|
+
/* @__PURE__ */ jsxs("label", { children: [locale === "zh" ? "版本 " : "Version ", /* @__PURE__ */ jsx(StudioSelect, {
|
|
5542
5593
|
"aria-label": locale === "zh" ? "Kit 版本" : "Kit version",
|
|
5543
5594
|
value: workspace.version,
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
leaveDrafts(() => void controller.selectKit(workspace.name, version));
|
|
5547
|
-
},
|
|
5548
|
-
children: groupInstalledContent(snapshot.view?.kits ?? []).find((group) => group.name === workspace.name)?.versions.map((kit) => /* @__PURE__ */ jsx("option", {
|
|
5595
|
+
onValueChange: (version) => leaveDrafts(() => void controller.selectKit(workspace.name, version)),
|
|
5596
|
+
options: groupInstalledContent(snapshot.view?.kits ?? []).find((group) => group.name === workspace.name)?.versions.map((kit) => ({
|
|
5549
5597
|
value: kit.version,
|
|
5550
|
-
|
|
5551
|
-
}
|
|
5598
|
+
label: kit.version
|
|
5599
|
+
})) ?? []
|
|
5552
5600
|
})] })
|
|
5553
5601
|
]
|
|
5554
5602
|
}),
|
|
@@ -5650,340 +5698,338 @@ function StudioWorkspace({ client, controller: supplied, authoring, kitAuthoring
|
|
|
5650
5698
|
})
|
|
5651
5699
|
]
|
|
5652
5700
|
});
|
|
5653
|
-
return /* @__PURE__ */
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
className:
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
"aria-current": !componentsOpen && !archivesOpen && !draftsOpen && (bundleWorkspace || snapshot.section === "bundles") ? "page" : void 0,
|
|
5692
|
-
onClick: () => leaveDrafts(() => {
|
|
5693
|
-
setComponentsOpen(false);
|
|
5694
|
-
controller.setSection("bundles");
|
|
5695
|
-
}),
|
|
5696
|
-
children: [/* @__PURE__ */ jsx(StudioGlyph, { bundle: true }), t.bundlesTitle]
|
|
5697
|
-
})]
|
|
5698
|
-
}),
|
|
5699
|
-
/* @__PURE__ */ jsxs("div", {
|
|
5700
|
-
className: "ygd-studio-sidebar-footer",
|
|
5701
|
-
children: [componentLibrary && /* @__PURE__ */ jsx("nav", {
|
|
5702
|
-
className: "ygd-studio-sidebar-utilities",
|
|
5703
|
-
"aria-label": locale === "zh" ? "Studio 工具" : "Studio utilities",
|
|
5704
|
-
children: /* @__PURE__ */ jsxs("button", {
|
|
5701
|
+
return /* @__PURE__ */ jsx(StudioSelectContext.Provider, {
|
|
5702
|
+
value: renderSelect,
|
|
5703
|
+
children: /* @__PURE__ */ jsxs("section", {
|
|
5704
|
+
className: "ygd-studio-workspace",
|
|
5705
|
+
"aria-label": "Design Studio",
|
|
5706
|
+
children: [
|
|
5707
|
+
/* @__PURE__ */ jsx("style", { children: STUDIO_WORKSPACE_CSS }),
|
|
5708
|
+
/* @__PURE__ */ jsx("button", {
|
|
5709
|
+
className: "ygd-studio-menu-btn",
|
|
5710
|
+
type: "button",
|
|
5711
|
+
"aria-label": "Toggle menu",
|
|
5712
|
+
"aria-expanded": sidebarOpen,
|
|
5713
|
+
onClick: () => setSidebarOpen(!sidebarOpen),
|
|
5714
|
+
children: "☰"
|
|
5715
|
+
}),
|
|
5716
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5717
|
+
className: "ygd-studio-body",
|
|
5718
|
+
children: [/* @__PURE__ */ jsxs("aside", {
|
|
5719
|
+
className: `ygd-studio-sidebar${sidebarOpen ? " open" : ""}`,
|
|
5720
|
+
"aria-label": "Product navigation",
|
|
5721
|
+
children: [
|
|
5722
|
+
/* @__PURE__ */ jsx("div", {
|
|
5723
|
+
className: "ygd-studio-sidebar-logo",
|
|
5724
|
+
children: "Yugoo Design"
|
|
5725
|
+
}),
|
|
5726
|
+
/* @__PURE__ */ jsxs("nav", {
|
|
5727
|
+
className: "ygd-studio-sidebar-nav",
|
|
5728
|
+
"aria-label": "Studio sections",
|
|
5729
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
5730
|
+
className: "ygd-studio-sidebar-item",
|
|
5731
|
+
type: "button",
|
|
5732
|
+
"aria-current": !componentsOpen && !archivesOpen && !draftsOpen && !bundleWorkspace && snapshot.section === "kits" ? "page" : void 0,
|
|
5733
|
+
onClick: () => leaveDrafts(() => {
|
|
5734
|
+
setComponentsOpen(false);
|
|
5735
|
+
controller.backToList();
|
|
5736
|
+
}),
|
|
5737
|
+
children: [/* @__PURE__ */ jsx(StudioGlyph, {}), t.kitsTitle]
|
|
5738
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
5705
5739
|
className: "ygd-studio-sidebar-item",
|
|
5706
5740
|
type: "button",
|
|
5707
|
-
"aria-current": componentsOpen ? "page" : void 0,
|
|
5708
|
-
onClick: () => leaveDrafts(() =>
|
|
5709
|
-
|
|
5710
|
-
|
|
5741
|
+
"aria-current": !componentsOpen && !archivesOpen && !draftsOpen && (bundleWorkspace || snapshot.section === "bundles") ? "page" : void 0,
|
|
5742
|
+
onClick: () => leaveDrafts(() => {
|
|
5743
|
+
setComponentsOpen(false);
|
|
5744
|
+
controller.setSection("bundles");
|
|
5745
|
+
}),
|
|
5746
|
+
children: [/* @__PURE__ */ jsx(StudioGlyph, { bundle: true }), t.bundlesTitle]
|
|
5747
|
+
})]
|
|
5748
|
+
}),
|
|
5749
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5750
|
+
className: "ygd-studio-sidebar-footer",
|
|
5751
|
+
children: [componentLibrary && /* @__PURE__ */ jsx("nav", {
|
|
5752
|
+
className: "ygd-studio-sidebar-utilities",
|
|
5753
|
+
"aria-label": locale === "zh" ? "Studio 工具" : "Studio utilities",
|
|
5754
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
5755
|
+
className: "ygd-studio-sidebar-item",
|
|
5756
|
+
type: "button",
|
|
5757
|
+
"aria-current": componentsOpen ? "page" : void 0,
|
|
5758
|
+
onClick: () => leaveDrafts(() => setComponentsOpen(true)),
|
|
5759
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
5760
|
+
className: "ygd-studio-kitmark",
|
|
5761
|
+
"aria-hidden": "true",
|
|
5762
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
5763
|
+
viewBox: "0 0 24 24",
|
|
5764
|
+
fill: "none",
|
|
5765
|
+
stroke: "currentColor",
|
|
5766
|
+
strokeWidth: "1.5",
|
|
5767
|
+
children: [
|
|
5768
|
+
/* @__PURE__ */ jsx("rect", {
|
|
5769
|
+
x: "3",
|
|
5770
|
+
y: "3",
|
|
5771
|
+
width: "7",
|
|
5772
|
+
height: "7",
|
|
5773
|
+
rx: "1"
|
|
5774
|
+
}),
|
|
5775
|
+
/* @__PURE__ */ jsx("rect", {
|
|
5776
|
+
x: "14",
|
|
5777
|
+
y: "3",
|
|
5778
|
+
width: "7",
|
|
5779
|
+
height: "7",
|
|
5780
|
+
rx: "1"
|
|
5781
|
+
}),
|
|
5782
|
+
/* @__PURE__ */ jsx("rect", {
|
|
5783
|
+
x: "3",
|
|
5784
|
+
y: "14",
|
|
5785
|
+
width: "7",
|
|
5786
|
+
height: "7",
|
|
5787
|
+
rx: "1"
|
|
5788
|
+
}),
|
|
5789
|
+
/* @__PURE__ */ jsx("rect", {
|
|
5790
|
+
x: "14",
|
|
5791
|
+
y: "14",
|
|
5792
|
+
width: "7",
|
|
5793
|
+
height: "7",
|
|
5794
|
+
rx: "1"
|
|
5795
|
+
})
|
|
5796
|
+
]
|
|
5797
|
+
})
|
|
5798
|
+
}), locale === "zh" ? "面板组件库" : "Panel Component Library"]
|
|
5799
|
+
})
|
|
5800
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
5801
|
+
className: "ygd-studio-language",
|
|
5802
|
+
role: "group",
|
|
5803
|
+
"aria-label": locale === "zh" ? "界面语言" : "Interface language",
|
|
5804
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
5805
|
+
type: "button",
|
|
5806
|
+
lang: "zh-CN",
|
|
5807
|
+
"aria-pressed": locale === "zh",
|
|
5808
|
+
onClick: () => changeLocale("zh"),
|
|
5809
|
+
children: "中文"
|
|
5810
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
5811
|
+
type: "button",
|
|
5812
|
+
lang: "en",
|
|
5813
|
+
"aria-pressed": locale === "en",
|
|
5814
|
+
onClick: () => changeLocale("en"),
|
|
5815
|
+
children: "EN"
|
|
5816
|
+
})]
|
|
5817
|
+
})]
|
|
5818
|
+
})
|
|
5819
|
+
]
|
|
5820
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
5821
|
+
className: "ygd-studio-stage",
|
|
5822
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
5823
|
+
className: "ygd-studio-topbar",
|
|
5824
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
5825
|
+
"aria-label": "Breadcrumb",
|
|
5826
|
+
children: [
|
|
5827
|
+
/* @__PURE__ */ jsx("button", {
|
|
5828
|
+
className: "ygd-studio-breadcrumb-button",
|
|
5829
|
+
type: "button",
|
|
5830
|
+
onClick: () => {
|
|
5831
|
+
if (!componentsOpen) leaveDrafts(() => snapshot.section === "kits" ? controller.backToList() : controller.closeBundleWorkspace());
|
|
5832
|
+
},
|
|
5833
|
+
children: componentsOpen ? locale === "zh" ? "面板组件库" : "Panel Component Library" : snapshot.section === "kits" ? t.kitsTitle : t.bundlesTitle
|
|
5834
|
+
}),
|
|
5835
|
+
!componentsOpen && !archivesOpen && !instanceId && workspace && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
5711
5836
|
"aria-hidden": "true",
|
|
5712
|
-
children:
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
}),
|
|
5739
|
-
/* @__PURE__ */ jsx("rect", {
|
|
5740
|
-
x: "14",
|
|
5741
|
-
y: "14",
|
|
5742
|
-
width: "7",
|
|
5743
|
-
height: "7",
|
|
5744
|
-
rx: "1"
|
|
5745
|
-
})
|
|
5746
|
-
]
|
|
5747
|
-
})
|
|
5748
|
-
}), locale === "zh" ? "面板组件库" : "Panel Component Library"]
|
|
5749
|
-
})
|
|
5837
|
+
children: "/"
|
|
5838
|
+
}), bundleWorkspace ? /* @__PURE__ */ jsx("button", {
|
|
5839
|
+
className: "ygd-studio-breadcrumb-button",
|
|
5840
|
+
type: "button",
|
|
5841
|
+
onClick: () => leaveDrafts(() => controller.closeBundleWorkspace()),
|
|
5842
|
+
children: displayName(workspace.name)
|
|
5843
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
5844
|
+
"aria-current": "page",
|
|
5845
|
+
children: displayName(workspace.name)
|
|
5846
|
+
})] }),
|
|
5847
|
+
!componentsOpen && !archivesOpen && !instanceId && bundleWorkspace && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
5848
|
+
"aria-hidden": "true",
|
|
5849
|
+
children: "/"
|
|
5850
|
+
}), bundleTitle(bundleWorkspace.name, bundleWorkspace.version)] }),
|
|
5851
|
+
!componentsOpen && instanceId && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
5852
|
+
"aria-hidden": "true",
|
|
5853
|
+
children: "/"
|
|
5854
|
+
}), localInstances.find((record) => record.id === instanceId)?.title[locale]] }),
|
|
5855
|
+
archivesOpen && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
5856
|
+
"aria-hidden": "true",
|
|
5857
|
+
children: "/"
|
|
5858
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
5859
|
+
"aria-current": "page",
|
|
5860
|
+
children: locale === "zh" ? "内容归档" : "Content archives"
|
|
5861
|
+
})] })
|
|
5862
|
+
]
|
|
5750
5863
|
}), /* @__PURE__ */ jsxs("div", {
|
|
5751
|
-
className: "ygd-studio-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
5864
|
+
className: "ygd-studio-topbar-actions",
|
|
5865
|
+
children: [contentClient && /* @__PURE__ */ jsx("button", {
|
|
5866
|
+
className: "ygd-studio-btn-link",
|
|
5755
5867
|
type: "button",
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5868
|
+
disabled: archivesOpen,
|
|
5869
|
+
onClick: () => leaveDrafts(() => {
|
|
5870
|
+
setComponentsOpen(false);
|
|
5871
|
+
setArchivesOpen(true);
|
|
5872
|
+
}),
|
|
5873
|
+
children: locale === "zh" ? "内容归档" : "Content archives"
|
|
5874
|
+
}), !componentsOpen && /* @__PURE__ */ jsx("button", {
|
|
5875
|
+
className: "ygd-studio-btn-link",
|
|
5761
5876
|
type: "button",
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5877
|
+
disabled: snapshot.phase === "loading",
|
|
5878
|
+
onClick: () => leaveDrafts(() => {
|
|
5879
|
+
(async () => {
|
|
5880
|
+
await controller.load();
|
|
5881
|
+
await refreshInstances();
|
|
5882
|
+
if (workspace) await controller.selectKit(workspace.name, workspace.version);
|
|
5883
|
+
if (bundleWorkspace) {
|
|
5884
|
+
await controller.openBundleWorkspace(bundleWorkspace.name, bundleWorkspace.version);
|
|
5885
|
+
if (bundleFile) await controller.openBundleFile(bundleFile.path);
|
|
5886
|
+
}
|
|
5887
|
+
})();
|
|
5888
|
+
}),
|
|
5889
|
+
children: locale === "zh" ? "刷新内容" : "Refresh content"
|
|
5766
5890
|
})]
|
|
5767
5891
|
})]
|
|
5768
|
-
})
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
}), localInstances.find((record) => record.id === instanceId)?.title[locale]] }),
|
|
5805
|
-
archivesOpen && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
5806
|
-
"aria-hidden": "true",
|
|
5807
|
-
children: "/"
|
|
5808
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
5809
|
-
"aria-current": "page",
|
|
5810
|
-
children: locale === "zh" ? "内容归档" : "Content archives"
|
|
5811
|
-
})] })
|
|
5812
|
-
]
|
|
5813
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
5814
|
-
className: "ygd-studio-topbar-actions",
|
|
5815
|
-
children: [contentClient && /* @__PURE__ */ jsx("button", {
|
|
5816
|
-
className: "ygd-studio-btn-link",
|
|
5817
|
-
type: "button",
|
|
5818
|
-
disabled: archivesOpen,
|
|
5819
|
-
onClick: () => leaveDrafts(() => {
|
|
5820
|
-
setComponentsOpen(false);
|
|
5821
|
-
setArchivesOpen(true);
|
|
5822
|
-
}),
|
|
5823
|
-
children: locale === "zh" ? "内容归档" : "Content archives"
|
|
5824
|
-
}), !componentsOpen && /* @__PURE__ */ jsx("button", {
|
|
5825
|
-
className: "ygd-studio-btn-link",
|
|
5826
|
-
type: "button",
|
|
5827
|
-
disabled: snapshot.phase === "loading",
|
|
5828
|
-
onClick: () => leaveDrafts(() => {
|
|
5829
|
-
(async () => {
|
|
5830
|
-
await controller.load();
|
|
5831
|
-
await refreshInstances();
|
|
5832
|
-
if (workspace) await controller.selectKit(workspace.name, workspace.version);
|
|
5833
|
-
if (bundleWorkspace) {
|
|
5834
|
-
await controller.openBundleWorkspace(bundleWorkspace.name, bundleWorkspace.version);
|
|
5835
|
-
if (bundleFile) await controller.openBundleFile(bundleFile.path);
|
|
5836
|
-
}
|
|
5837
|
-
})();
|
|
5838
|
-
}),
|
|
5839
|
-
children: locale === "zh" ? "刷新内容" : "Refresh content"
|
|
5840
|
-
})]
|
|
5841
|
-
})]
|
|
5842
|
-
}), componentsOpen && componentLibrary ? /* @__PURE__ */ jsx(ComponentLibrary, {
|
|
5843
|
-
library: componentLibrary,
|
|
5844
|
-
locale
|
|
5845
|
-
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [authoringError && /* @__PURE__ */ jsx("p", {
|
|
5846
|
-
role: "alert",
|
|
5847
|
-
className: "ygd-studio-error",
|
|
5848
|
-
children: authoringError
|
|
5849
|
-
}), archivesOpen && contentClient ? /* @__PURE__ */ jsx(ContentArchiveWorkbench, {
|
|
5850
|
-
client: contentClient,
|
|
5851
|
-
installedKit: workspace ? {
|
|
5852
|
-
name: workspace.name,
|
|
5853
|
-
version: workspace.version
|
|
5854
|
-
} : void 0,
|
|
5855
|
-
locale,
|
|
5856
|
-
canAdoptKit: !!kitAuthoring,
|
|
5857
|
-
onBack: () => leaveDrafts(() => {}),
|
|
5858
|
-
onAdopt: (result) => leaveDrafts(() => {
|
|
5859
|
-
if (result.draft && kitAuthoring) {
|
|
5860
|
-
setDraftId(result.draft.id);
|
|
5861
|
-
setDraftsOpen("kit");
|
|
5862
|
-
controller.load();
|
|
5863
|
-
return;
|
|
5892
|
+
}), componentsOpen && componentLibrary ? /* @__PURE__ */ jsx(ComponentLibrary, {
|
|
5893
|
+
library: componentLibrary,
|
|
5894
|
+
locale
|
|
5895
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [authoringError && /* @__PURE__ */ jsx("p", {
|
|
5896
|
+
role: "alert",
|
|
5897
|
+
className: "ygd-studio-error",
|
|
5898
|
+
children: authoringError
|
|
5899
|
+
}), archivesOpen && contentClient ? /* @__PURE__ */ jsx(ContentArchiveWorkbench, {
|
|
5900
|
+
client: contentClient,
|
|
5901
|
+
installedKit: workspace ? {
|
|
5902
|
+
name: workspace.name,
|
|
5903
|
+
version: workspace.version
|
|
5904
|
+
} : void 0,
|
|
5905
|
+
locale,
|
|
5906
|
+
canAdoptKit: !!kitAuthoring,
|
|
5907
|
+
onBack: () => leaveDrafts(() => {}),
|
|
5908
|
+
onAdopt: (result) => leaveDrafts(() => {
|
|
5909
|
+
if (result.draft && kitAuthoring) {
|
|
5910
|
+
setDraftId(result.draft.id);
|
|
5911
|
+
setDraftsOpen("kit");
|
|
5912
|
+
controller.load();
|
|
5913
|
+
return;
|
|
5914
|
+
}
|
|
5915
|
+
const bundle = result.contents.find((item) => item.kind === "bundle");
|
|
5916
|
+
if (!bundle) return;
|
|
5917
|
+
const request = createGeneration.current;
|
|
5918
|
+
(async () => {
|
|
5919
|
+
await controller.load();
|
|
5920
|
+
if (request !== createGeneration.current || controller.getSnapshot().phase !== "ready") return;
|
|
5921
|
+
controller.setSection("bundles");
|
|
5922
|
+
await controller.openBundleWorkspace(bundle.pin.name, bundle.pin.version);
|
|
5923
|
+
})();
|
|
5924
|
+
}),
|
|
5925
|
+
onDirtyChange: (value) => {
|
|
5926
|
+
draftDirty.current = value;
|
|
5927
|
+
onDraftDirtyChange?.(value);
|
|
5864
5928
|
}
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
onDraftDirtyChange?.(value);
|
|
5878
|
-
}
|
|
5879
|
-
}) : snapshot.phase === "loading" && !instanceId && !draftsOpen ? /* @__PURE__ */ jsx("main", {
|
|
5880
|
-
className: "ygd-studio-main",
|
|
5881
|
-
children: /* @__PURE__ */ jsx(LoadingIndicator, { label: t.loading })
|
|
5882
|
-
}) : instanceId && instances ? /* @__PURE__ */ jsx(InstanceWorkbench, {
|
|
5883
|
-
client: instances,
|
|
5884
|
-
id: instanceId,
|
|
5885
|
-
locale,
|
|
5886
|
-
renderPreview: authoring?.renderPreview,
|
|
5887
|
-
onBack: () => leaveDrafts(() => controller.backToList()),
|
|
5888
|
-
onChanged: (record) => {
|
|
5889
|
-
setInstanceId(record?.id);
|
|
5890
|
-
refreshInstances().catch((error) => setAuthoringError(String(error)));
|
|
5891
|
-
},
|
|
5892
|
-
onDirtyChange: (value) => {
|
|
5893
|
-
draftDirty.current = value;
|
|
5894
|
-
onDraftDirtyChange?.(value);
|
|
5895
|
-
}
|
|
5896
|
-
}, instanceId) : draftsOpen === "kit" && kitAuthoring ? /* @__PURE__ */ jsx(KitDraftWorkbench, {
|
|
5897
|
-
authoring: kitAuthoring,
|
|
5898
|
-
initialId: draftId,
|
|
5899
|
-
locale,
|
|
5900
|
-
onDirtyChange: (value) => {
|
|
5901
|
-
draftDirty.current = value;
|
|
5902
|
-
onDraftDirtyChange?.(value);
|
|
5903
|
-
}
|
|
5904
|
-
}) : draftsOpen === "panel" && authoring ? /* @__PURE__ */ jsx(PanelDraftWorkbench, {
|
|
5905
|
-
onBack: () => leaveDrafts(() => {
|
|
5906
|
-
setBundleTab("preview");
|
|
5907
|
-
setPreviewMode("sample");
|
|
5908
|
-
}),
|
|
5909
|
-
trials,
|
|
5910
|
-
authoring,
|
|
5911
|
-
initialId: draftId,
|
|
5912
|
-
locale,
|
|
5913
|
-
onDirtyChange: (value) => {
|
|
5914
|
-
draftDirty.current = value;
|
|
5915
|
-
onDraftDirtyChange?.(value);
|
|
5916
|
-
}
|
|
5917
|
-
}) : bundleMain !== void 0 ? bundleMain : snapshot.section === "bundles" ? bundlesListMain : kitMain] })]
|
|
5918
|
-
})]
|
|
5919
|
-
}),
|
|
5920
|
-
workspace && recoveryOpen && /* @__PURE__ */ jsx(StudioDialog, {
|
|
5921
|
-
title: locale === "zh" ? "恢复工作副本" : "Restore working copy",
|
|
5922
|
-
close: () => setRecoveryOpen(false),
|
|
5923
|
-
children: kitAuthoring && mindsetChoices.length > 0 && /* @__PURE__ */ jsxs("label", {
|
|
5924
|
-
className: "ygd-studio-mindset-recovery",
|
|
5925
|
-
children: [
|
|
5926
|
-
locale === "zh" ? "工作副本" : "Working copy",
|
|
5927
|
-
" ",
|
|
5928
|
-
/* @__PURE__ */ jsxs("select", {
|
|
5929
|
-
"aria-label": "Mindset working copy",
|
|
5930
|
-
value: mindsetRecords.current.get(kitKey) ?? "",
|
|
5931
|
-
onChange: (event) => {
|
|
5932
|
-
const id = event.target.value;
|
|
5933
|
-
leaveDrafts(() => {
|
|
5934
|
-
if (id) mindsetRecords.current.set(kitKey, id);
|
|
5935
|
-
else mindsetRecords.current.delete(kitKey);
|
|
5936
|
-
setSavedMindsets((previous) => {
|
|
5937
|
-
const next = { ...previous };
|
|
5938
|
-
delete next[kitKey];
|
|
5939
|
-
return next;
|
|
5940
|
-
});
|
|
5941
|
-
setMindsetEditorEpoch((epoch) => epoch + 1);
|
|
5942
|
-
setRecoveryOpen(false);
|
|
5943
|
-
});
|
|
5929
|
+
}) : snapshot.phase === "loading" && !instanceId && !draftsOpen ? /* @__PURE__ */ jsx("main", {
|
|
5930
|
+
className: "ygd-studio-main",
|
|
5931
|
+
children: /* @__PURE__ */ jsx(LoadingIndicator, { label: t.loading })
|
|
5932
|
+
}) : instanceId && instances ? /* @__PURE__ */ jsx(InstanceWorkbench, {
|
|
5933
|
+
client: instances,
|
|
5934
|
+
id: instanceId,
|
|
5935
|
+
locale,
|
|
5936
|
+
renderPreview: authoring?.renderPreview,
|
|
5937
|
+
onBack: () => leaveDrafts(() => controller.backToList()),
|
|
5938
|
+
onChanged: (record) => {
|
|
5939
|
+
setInstanceId(record?.id);
|
|
5940
|
+
refreshInstances().catch((error) => setAuthoringError(String(error)));
|
|
5944
5941
|
},
|
|
5945
|
-
|
|
5946
|
-
value
|
|
5947
|
-
|
|
5948
|
-
}
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5942
|
+
onDirtyChange: (value) => {
|
|
5943
|
+
draftDirty.current = value;
|
|
5944
|
+
onDraftDirtyChange?.(value);
|
|
5945
|
+
}
|
|
5946
|
+
}, instanceId) : draftsOpen === "kit" && kitAuthoring ? /* @__PURE__ */ jsx(KitDraftWorkbench, {
|
|
5947
|
+
authoring: kitAuthoring,
|
|
5948
|
+
initialId: draftId,
|
|
5949
|
+
locale,
|
|
5950
|
+
onDirtyChange: (value) => {
|
|
5951
|
+
draftDirty.current = value;
|
|
5952
|
+
onDraftDirtyChange?.(value);
|
|
5953
|
+
}
|
|
5954
|
+
}) : draftsOpen === "panel" && authoring ? /* @__PURE__ */ jsx(PanelDraftWorkbench, {
|
|
5955
|
+
onBack: () => leaveDrafts(() => {
|
|
5956
|
+
setBundleTab("preview");
|
|
5957
|
+
setPreviewMode("sample");
|
|
5958
|
+
}),
|
|
5959
|
+
trials,
|
|
5960
|
+
authoring,
|
|
5961
|
+
initialId: draftId,
|
|
5962
|
+
locale,
|
|
5963
|
+
onDirtyChange: (value) => {
|
|
5964
|
+
draftDirty.current = value;
|
|
5965
|
+
onDraftDirtyChange?.(value);
|
|
5966
|
+
}
|
|
5967
|
+
}) : bundleMain !== void 0 ? bundleMain : snapshot.section === "bundles" ? bundlesListMain : kitMain] })]
|
|
5968
|
+
})]
|
|
5969
|
+
}),
|
|
5970
|
+
workspace && recoveryOpen && /* @__PURE__ */ jsx(StudioDialog, {
|
|
5971
|
+
title: locale === "zh" ? "恢复工作副本" : "Restore working copy",
|
|
5972
|
+
close: () => setRecoveryOpen(false),
|
|
5973
|
+
children: kitAuthoring && mindsetChoices.length > 0 && /* @__PURE__ */ jsxs("label", {
|
|
5974
|
+
className: "ygd-studio-mindset-recovery",
|
|
5975
|
+
children: [
|
|
5976
|
+
locale === "zh" ? "工作副本" : "Working copy",
|
|
5977
|
+
" ",
|
|
5978
|
+
/* @__PURE__ */ jsx(StudioSelect, {
|
|
5979
|
+
"aria-label": "Mindset working copy",
|
|
5980
|
+
value: mindsetRecords.current.get(kitKey) ?? "",
|
|
5981
|
+
onValueChange: (id) => {
|
|
5982
|
+
leaveDrafts(() => {
|
|
5983
|
+
if (id) mindsetRecords.current.set(kitKey, id);
|
|
5984
|
+
else mindsetRecords.current.delete(kitKey);
|
|
5985
|
+
setSavedMindsets((previous) => {
|
|
5986
|
+
const next = { ...previous };
|
|
5987
|
+
delete next[kitKey];
|
|
5988
|
+
return next;
|
|
5989
|
+
});
|
|
5990
|
+
setMindsetEditorEpoch((epoch) => epoch + 1);
|
|
5991
|
+
setRecoveryOpen(false);
|
|
5992
|
+
});
|
|
5993
|
+
},
|
|
5994
|
+
options: [{
|
|
5995
|
+
value: "",
|
|
5996
|
+
label: locale === "zh" ? "已安装原文" : "Installed source"
|
|
5997
|
+
}, ...mindsetChoices.map((record) => ({
|
|
5998
|
+
value: record.id,
|
|
5999
|
+
label: `${record.id.slice(0, 8)} · r${record.revision}`
|
|
6000
|
+
}))]
|
|
6001
|
+
})
|
|
6002
|
+
]
|
|
6003
|
+
})
|
|
6004
|
+
}),
|
|
6005
|
+
fileLocationOpen && /* @__PURE__ */ jsxs(StudioDialog, {
|
|
6006
|
+
title: locale === "zh" ? "文件位置" : "File location",
|
|
6007
|
+
close: () => setFileLocationOpen(false),
|
|
6008
|
+
children: [/* @__PURE__ */ jsx("p", { children: bundleWorkspace ? `${bundleWorkspace.name}/${bundleFile?.path ?? ""}` : "mindset.md" }), /* @__PURE__ */ jsx("p", { children: locale === "zh" ? "当前为包内相对路径。此宿主尚未提供本机绝对路径或打开编辑器接口。" : "Package-relative path. This host does not expose a local absolute path or editor launch capability." })]
|
|
6009
|
+
}),
|
|
6010
|
+
workspace && fullMindset && /* @__PURE__ */ jsxs(StudioDialog, {
|
|
6011
|
+
title: "mindset.md · 完整文件",
|
|
6012
|
+
close: () => setFullMindset(false),
|
|
6013
|
+
children: [/* @__PURE__ */ jsx("p", { children: locale === "zh" ? "包含 frontmatter 与 <design_skills>;阅读视图不会修改或丢弃文件内容。" : "Includes frontmatter and <design_skills>; the reading view never changes file content." }), codeFrame(visibleMindset, "Complete Mindset file")]
|
|
6014
|
+
}),
|
|
6015
|
+
workspace && kitFilesOpen && /* @__PURE__ */ jsxs(StudioDialog, {
|
|
6016
|
+
title: `${locale === "zh" ? "设计套件文件" : "Kit Files"} · ${workspace.name}`,
|
|
6017
|
+
close: () => setKitFilesOpen(false),
|
|
6018
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
6019
|
+
className: "ygd-studio-tree-node",
|
|
6020
|
+
type: "button",
|
|
6021
|
+
onClick: () => {
|
|
6022
|
+
setKitFilesOpen(false);
|
|
6023
|
+
setFullMindset(true);
|
|
6024
|
+
},
|
|
6025
|
+
children: "mindset.md"
|
|
6026
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
6027
|
+
className: "ygd-studio-subtitle",
|
|
6028
|
+
children: locale === "zh" ? "Bundle 资源请在对应 Bundle 的文件树中查看;其他 Kit 根目录文件读取尚未接入。" : "Compiled resource list; reading other Kit-root files is not yet connected."
|
|
6029
|
+
})]
|
|
5958
6030
|
})
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
title: locale === "zh" ? "文件位置" : "File location",
|
|
5962
|
-
close: () => setFileLocationOpen(false),
|
|
5963
|
-
children: [/* @__PURE__ */ jsx("p", { children: bundleWorkspace ? `${bundleWorkspace.name}/${bundleFile?.path ?? ""}` : "mindset.md" }), /* @__PURE__ */ jsx("p", { children: locale === "zh" ? "当前为包内相对路径。此宿主尚未提供本机绝对路径或打开编辑器接口。" : "Package-relative path. This host does not expose a local absolute path or editor launch capability." })]
|
|
5964
|
-
}),
|
|
5965
|
-
workspace && fullMindset && /* @__PURE__ */ jsxs(StudioDialog, {
|
|
5966
|
-
title: "mindset.md · 完整文件",
|
|
5967
|
-
close: () => setFullMindset(false),
|
|
5968
|
-
children: [/* @__PURE__ */ jsx("p", { children: locale === "zh" ? "包含 frontmatter 与 <design_skills>;阅读视图不会修改或丢弃文件内容。" : "Includes frontmatter and <design_skills>; the reading view never changes file content." }), codeFrame(visibleMindset, "Complete Mindset file")]
|
|
5969
|
-
}),
|
|
5970
|
-
workspace && kitFilesOpen && /* @__PURE__ */ jsxs(StudioDialog, {
|
|
5971
|
-
title: `${locale === "zh" ? "设计套件文件" : "Kit Files"} · ${workspace.name}`,
|
|
5972
|
-
close: () => setKitFilesOpen(false),
|
|
5973
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
5974
|
-
className: "ygd-studio-tree-node",
|
|
5975
|
-
type: "button",
|
|
5976
|
-
onClick: () => {
|
|
5977
|
-
setKitFilesOpen(false);
|
|
5978
|
-
setFullMindset(true);
|
|
5979
|
-
},
|
|
5980
|
-
children: "mindset.md"
|
|
5981
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
5982
|
-
className: "ygd-studio-subtitle",
|
|
5983
|
-
children: locale === "zh" ? "Bundle 资源请在对应 Bundle 的文件树中查看;其他 Kit 根目录文件读取尚未接入。" : "Compiled resource list; reading other Kit-root files is not yet connected."
|
|
5984
|
-
})]
|
|
5985
|
-
})
|
|
5986
|
-
]
|
|
6031
|
+
]
|
|
6032
|
+
})
|
|
5987
6033
|
});
|
|
5988
6034
|
}
|
|
5989
6035
|
//#endregion
|