@rxdrag/website-studio 0.0.27 → 0.0.29
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/backup/useExportTheme.d.ts +16 -2
- package/dist/{cssMode-b9a7e63d.js → cssMode-560cfbce.js} +2 -2
- package/dist/{cssMode-b9a7e63d.js.map → cssMode-560cfbce.js.map} +1 -1
- package/dist/{freemarker2-3087a48e.js → freemarker2-ae5b918b.js} +2 -2
- package/dist/{freemarker2-3087a48e.js.map → freemarker2-ae5b918b.js.map} +1 -1
- package/dist/{handlebars-93839a14.js → handlebars-2822a6f3.js} +2 -2
- package/dist/{handlebars-93839a14.js.map → handlebars-2822a6f3.js.map} +1 -1
- package/dist/{html-352ae7b6.js → html-adcd062a.js} +2 -2
- package/dist/{html-352ae7b6.js.map → html-adcd062a.js.map} +1 -1
- package/dist/{htmlMode-cb94f112.js → htmlMode-b4888b89.js} +2 -2
- package/dist/{htmlMode-cb94f112.js.map → htmlMode-b4888b89.js.map} +1 -1
- package/dist/{index-f92078c9.js → index-ca588fca.js} +157 -97
- package/dist/{index-f92078c9.js.map → index-ca588fca.js.map} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{javascript-1e4d4e79.js → javascript-ebf4f00e.js} +3 -3
- package/dist/{javascript-1e4d4e79.js.map → javascript-ebf4f00e.js.map} +1 -1
- package/dist/{jsonMode-98cba404.js → jsonMode-0bfb96d5.js} +2 -2
- package/dist/{jsonMode-98cba404.js.map → jsonMode-0bfb96d5.js.map} +1 -1
- package/dist/{liquid-4dd49239.js → liquid-9baed185.js} +2 -2
- package/dist/{liquid-4dd49239.js.map → liquid-9baed185.js.map} +1 -1
- package/dist/{mdx-885d9fc7.js → mdx-2cb8d781.js} +2 -2
- package/dist/{mdx-885d9fc7.js.map → mdx-2cb8d781.js.map} +1 -1
- package/dist/{python-7c6923ac.js → python-9c44c183.js} +2 -2
- package/dist/{python-7c6923ac.js.map → python-9c44c183.js.map} +1 -1
- package/dist/{razor-4a86e8cb.js → razor-daa857fe.js} +2 -2
- package/dist/{razor-4a86e8cb.js.map → razor-daa857fe.js.map} +1 -1
- package/dist/{tsMode-1dd2088d.js → tsMode-7a0e93b3.js} +2 -2
- package/dist/{tsMode-1dd2088d.js.map → tsMode-7a0e93b3.js.map} +1 -1
- package/dist/{typescript-a2aa1b20.js → typescript-598dddef.js} +2 -2
- package/dist/{typescript-a2aa1b20.js.map → typescript-598dddef.js.map} +1 -1
- package/dist/{xml-6499a804.js → xml-4e1c92ab.js} +2 -2
- package/dist/{xml-6499a804.js.map → xml-4e1c92ab.js.map} +1 -1
- package/dist/{yaml-c4d73856.js → yaml-1cbcca95.js} +2 -2
- package/dist/{yaml-c4d73856.js.map → yaml-1cbcca95.js.map} +1 -1
- package/package.json +14 -14
|
@@ -18,7 +18,7 @@ import { NodeMountedEvent, RXID_ATTR_NAME, HistoryableActionType, IFrameCanvasIm
|
|
|
18
18
|
import { useVariables, useExecuteExpression, VariableProvider, expressionAndName, expressionTernaryName, expressionLoopName, useViewKey, createSchema, ENTIFY_SERVER_URL, staticMaterials, ViewKeyProvider, slotContentName, expressionName } from "@rxdrag/website-materials";
|
|
19
19
|
import { isHTMLElement as isHTMLElement$1, isStr } from "@rxdrag/shared";
|
|
20
20
|
import { isFunction as isFunction$2, debounce, keys, uniqueId } from "lodash-es";
|
|
21
|
-
import { useEntifyEndpoint, useEntifyToken, useLazyQueryEntityList, useLazyQueryOneEntity, useCreateEntityClient, emitEntityChange } from "@rxdrag/entify-hooks";
|
|
21
|
+
import { useEntifyEndpoint, useEntifyToken, useLazyQueryEntityList, useLazyQueryOneEntity, useCreateEntityClient, emitEntityChange, useGithubUploadMutation } from "@rxdrag/entify-hooks";
|
|
22
22
|
import dayjs from "dayjs";
|
|
23
23
|
import { ErrorBoundary, ColorPicker, useSave, CheckCircleIcon as CheckCircleIcon$1, CloseIcon, ModalBody, AddIcon as AddIcon$1, TaskStopIcon, AiStarIcon, ConfirmDialog, SettingsIcon, ModalFooter, FavouriteIcon, LightIcon, DarkIcon, EditIcon, TextInput, Drawer, ModalHeader, ModalClose, SearchIcon, ModalContent as ModalContent$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1, MonacoEditor, getTheFile, MoreIcon, LanguageIcon, SeoIcon, DownloadIcon, UploadIcon, StyledTooltip, PlayIcon, Logo, GlobalIcon, SnsIcon, LightBoltIcon, WarningIcon, PinIcon, PredefinedColorPicker, PagesIcon, WidgetIcon, LeafNode, GroupNode, TreeView, DesignIcon, RemoveIcon, ResetIcon, ImportIcon, AstroIcon, AddFolderIcon, TemplateIcon, AddTemplateIcon } from "@rxdrag/rxcms-common";
|
|
24
24
|
import { PageLoader, PopoverController, ModalController, AnimateController, TabsController, NumberController, FlipController, CollapseController, AosController } from "@rxdrag/website-lib-core";
|
|
@@ -138145,7 +138145,7 @@ registerLanguage({
|
|
|
138145
138145
|
aliases: ["FreeMarker2", "Apache FreeMarker2"],
|
|
138146
138146
|
loader: () => {
|
|
138147
138147
|
{
|
|
138148
|
-
return import("./freemarker2-
|
|
138148
|
+
return import("./freemarker2-ae5b918b.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
138149
138149
|
}
|
|
138150
138150
|
}
|
|
138151
138151
|
});
|
|
@@ -138154,7 +138154,7 @@ registerLanguage({
|
|
|
138154
138154
|
aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"],
|
|
138155
138155
|
loader: () => {
|
|
138156
138156
|
{
|
|
138157
|
-
return import("./freemarker2-
|
|
138157
|
+
return import("./freemarker2-ae5b918b.js").then((m2) => m2.TagAngleInterpolationDollar);
|
|
138158
138158
|
}
|
|
138159
138159
|
}
|
|
138160
138160
|
});
|
|
@@ -138163,7 +138163,7 @@ registerLanguage({
|
|
|
138163
138163
|
aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"],
|
|
138164
138164
|
loader: () => {
|
|
138165
138165
|
{
|
|
138166
|
-
return import("./freemarker2-
|
|
138166
|
+
return import("./freemarker2-ae5b918b.js").then((m2) => m2.TagBracketInterpolationDollar);
|
|
138167
138167
|
}
|
|
138168
138168
|
}
|
|
138169
138169
|
});
|
|
@@ -138172,7 +138172,7 @@ registerLanguage({
|
|
|
138172
138172
|
aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"],
|
|
138173
138173
|
loader: () => {
|
|
138174
138174
|
{
|
|
138175
|
-
return import("./freemarker2-
|
|
138175
|
+
return import("./freemarker2-ae5b918b.js").then((m2) => m2.TagAngleInterpolationBracket);
|
|
138176
138176
|
}
|
|
138177
138177
|
}
|
|
138178
138178
|
});
|
|
@@ -138181,7 +138181,7 @@ registerLanguage({
|
|
|
138181
138181
|
aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"],
|
|
138182
138182
|
loader: () => {
|
|
138183
138183
|
{
|
|
138184
|
-
return import("./freemarker2-
|
|
138184
|
+
return import("./freemarker2-ae5b918b.js").then((m2) => m2.TagBracketInterpolationBracket);
|
|
138185
138185
|
}
|
|
138186
138186
|
}
|
|
138187
138187
|
});
|
|
@@ -138190,7 +138190,7 @@ registerLanguage({
|
|
|
138190
138190
|
aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"],
|
|
138191
138191
|
loader: () => {
|
|
138192
138192
|
{
|
|
138193
|
-
return import("./freemarker2-
|
|
138193
|
+
return import("./freemarker2-ae5b918b.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
138194
138194
|
}
|
|
138195
138195
|
}
|
|
138196
138196
|
});
|
|
@@ -138199,7 +138199,7 @@ registerLanguage({
|
|
|
138199
138199
|
aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"],
|
|
138200
138200
|
loader: () => {
|
|
138201
138201
|
{
|
|
138202
|
-
return import("./freemarker2-
|
|
138202
|
+
return import("./freemarker2-ae5b918b.js").then((m2) => m2.TagAutoInterpolationBracket);
|
|
138203
138203
|
}
|
|
138204
138204
|
}
|
|
138205
138205
|
});
|
|
@@ -138249,7 +138249,7 @@ registerLanguage({
|
|
|
138249
138249
|
mimetypes: ["text/x-handlebars-template"],
|
|
138250
138250
|
loader: () => {
|
|
138251
138251
|
{
|
|
138252
|
-
return import("./handlebars-
|
|
138252
|
+
return import("./handlebars-2822a6f3.js");
|
|
138253
138253
|
}
|
|
138254
138254
|
}
|
|
138255
138255
|
});
|
|
@@ -138282,7 +138282,7 @@ registerLanguage({
|
|
|
138282
138282
|
mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
|
|
138283
138283
|
loader: () => {
|
|
138284
138284
|
{
|
|
138285
|
-
return import("./html-
|
|
138285
|
+
return import("./html-adcd062a.js");
|
|
138286
138286
|
}
|
|
138287
138287
|
}
|
|
138288
138288
|
});
|
|
@@ -138335,7 +138335,7 @@ registerLanguage({
|
|
|
138335
138335
|
mimetypes: ["text/javascript"],
|
|
138336
138336
|
loader: () => {
|
|
138337
138337
|
{
|
|
138338
|
-
return import("./javascript-
|
|
138338
|
+
return import("./javascript-ebf4f00e.js");
|
|
138339
138339
|
}
|
|
138340
138340
|
}
|
|
138341
138341
|
});
|
|
@@ -138434,7 +138434,7 @@ registerLanguage({
|
|
|
138434
138434
|
mimetypes: ["application/liquid"],
|
|
138435
138435
|
loader: () => {
|
|
138436
138436
|
{
|
|
138437
|
-
return import("./liquid-
|
|
138437
|
+
return import("./liquid-9baed185.js");
|
|
138438
138438
|
}
|
|
138439
138439
|
}
|
|
138440
138440
|
});
|
|
@@ -138482,7 +138482,7 @@ registerLanguage({
|
|
|
138482
138482
|
aliases: ["MDX", "mdx"],
|
|
138483
138483
|
loader: () => {
|
|
138484
138484
|
{
|
|
138485
|
-
return import("./mdx-
|
|
138485
|
+
return import("./mdx-2cb8d781.js");
|
|
138486
138486
|
}
|
|
138487
138487
|
}
|
|
138488
138488
|
});
|
|
@@ -138741,7 +138741,7 @@ registerLanguage({
|
|
|
138741
138741
|
firstLine: "^#!/.*\\bpython[0-9.-]*\\b",
|
|
138742
138742
|
loader: () => {
|
|
138743
138743
|
{
|
|
138744
|
-
return import("./python-
|
|
138744
|
+
return import("./python-9c44c183.js");
|
|
138745
138745
|
}
|
|
138746
138746
|
}
|
|
138747
138747
|
});
|
|
@@ -138790,7 +138790,7 @@ registerLanguage({
|
|
|
138790
138790
|
mimetypes: ["text/x-cshtml"],
|
|
138791
138791
|
loader: () => {
|
|
138792
138792
|
{
|
|
138793
|
-
return import("./razor-
|
|
138793
|
+
return import("./razor-daa857fe.js");
|
|
138794
138794
|
}
|
|
138795
138795
|
}
|
|
138796
138796
|
});
|
|
@@ -139126,7 +139126,7 @@ registerLanguage({
|
|
|
139126
139126
|
mimetypes: ["text/typescript"],
|
|
139127
139127
|
loader: () => {
|
|
139128
139128
|
{
|
|
139129
|
-
return import("./typescript-
|
|
139129
|
+
return import("./typescript-598dddef.js");
|
|
139130
139130
|
}
|
|
139131
139131
|
}
|
|
139132
139132
|
});
|
|
@@ -139210,7 +139210,7 @@ registerLanguage({
|
|
|
139210
139210
|
mimetypes: ["text/xml", "application/xml", "application/xaml+xml", "application/xml-dtd"],
|
|
139211
139211
|
loader: () => {
|
|
139212
139212
|
{
|
|
139213
|
-
return import("./xml-
|
|
139213
|
+
return import("./xml-4e1c92ab.js");
|
|
139214
139214
|
}
|
|
139215
139215
|
}
|
|
139216
139216
|
});
|
|
@@ -139227,7 +139227,7 @@ registerLanguage({
|
|
|
139227
139227
|
mimetypes: ["application/x-yaml", "text/x-yaml"],
|
|
139228
139228
|
loader: () => {
|
|
139229
139229
|
{
|
|
139230
|
-
return import("./yaml-
|
|
139230
|
+
return import("./yaml-1cbcca95.js");
|
|
139231
139231
|
}
|
|
139232
139232
|
}
|
|
139233
139233
|
});
|
|
@@ -139351,7 +139351,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3(
|
|
|
139351
139351
|
monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
|
|
139352
139352
|
function getMode$3() {
|
|
139353
139353
|
{
|
|
139354
|
-
return import("./cssMode-
|
|
139354
|
+
return import("./cssMode-560cfbce.js");
|
|
139355
139355
|
}
|
|
139356
139356
|
}
|
|
139357
139357
|
monaco_editor_core_exports$3.languages.onLanguage("less", () => {
|
|
@@ -139482,7 +139482,7 @@ monaco_editor_core_exports$2.languages.html = {
|
|
|
139482
139482
|
};
|
|
139483
139483
|
function getMode$2() {
|
|
139484
139484
|
{
|
|
139485
|
-
return import("./htmlMode-
|
|
139485
|
+
return import("./htmlMode-b4888b89.js");
|
|
139486
139486
|
}
|
|
139487
139487
|
}
|
|
139488
139488
|
function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
|
|
@@ -139580,7 +139580,7 @@ var getWorker = () => getMode$1().then((mode) => mode.getWorker());
|
|
|
139580
139580
|
monaco_editor_core_exports$1.languages.json = { jsonDefaults, getWorker };
|
|
139581
139581
|
function getMode$1() {
|
|
139582
139582
|
{
|
|
139583
|
-
return import("./jsonMode-
|
|
139583
|
+
return import("./jsonMode-0bfb96d5.js");
|
|
139584
139584
|
}
|
|
139585
139585
|
}
|
|
139586
139586
|
monaco_editor_core_exports$1.languages.register({
|
|
@@ -139856,7 +139856,7 @@ monaco_editor_core_exports.languages.typescript = {
|
|
|
139856
139856
|
};
|
|
139857
139857
|
function getMode() {
|
|
139858
139858
|
{
|
|
139859
|
-
return import("./tsMode-
|
|
139859
|
+
return import("./tsMode-7a0e93b3.js");
|
|
139860
139860
|
}
|
|
139861
139861
|
}
|
|
139862
139862
|
monaco_editor_core_exports.languages.onLanguage("typescript", () => {
|
|
@@ -190866,96 +190866,144 @@ function useImportTheme() {
|
|
|
190866
190866
|
confirmText
|
|
190867
190867
|
};
|
|
190868
190868
|
}
|
|
190869
|
-
function
|
|
190869
|
+
function useThemeZipExport(fileName) {
|
|
190870
190870
|
const [isExporting, setIsExporting] = useState(false);
|
|
190871
|
-
const
|
|
190872
|
-
const styleConfig = useThemeStyleConfig();
|
|
190871
|
+
const { files } = useThemeFiles();
|
|
190873
190872
|
const save = useSave();
|
|
190874
|
-
const
|
|
190875
|
-
const componentCategories = useComponentCategories();
|
|
190876
|
-
const templateCategories = useTemplateCategories();
|
|
190877
|
-
const templates = useSectionTemplates();
|
|
190878
|
-
const pages = usePages();
|
|
190879
|
-
const exportTheme = useCallback(async () => {
|
|
190880
|
-
var _a3, _b3;
|
|
190873
|
+
const exportAsZip = useCallback(async () => {
|
|
190881
190874
|
setIsExporting(true);
|
|
190882
190875
|
try {
|
|
190883
|
-
const themeInfo = {
|
|
190884
|
-
...theme,
|
|
190885
|
-
styleConfig,
|
|
190886
|
-
componentCategories: (_a3 = componentCategories == null ? void 0 : componentCategories.items) == null ? void 0 : _a3.map((category) => ({
|
|
190887
|
-
...category,
|
|
190888
|
-
components: components == null ? void 0 : components.filter((com) => {
|
|
190889
|
-
var _a4;
|
|
190890
|
-
return ((_a4 = com.category) == null ? void 0 : _a4.id) === category.id;
|
|
190891
|
-
}).map((com) => ({ id: com.id }))
|
|
190892
|
-
})),
|
|
190893
|
-
templateCategories: (_b3 = templateCategories == null ? void 0 : templateCategories.items) == null ? void 0 : _b3.map((category) => ({
|
|
190894
|
-
...category,
|
|
190895
|
-
templates: templates == null ? void 0 : templates.filter((temp) => {
|
|
190896
|
-
var _a4;
|
|
190897
|
-
return ((_a4 = temp.category) == null ? void 0 : _a4.id) === category.id;
|
|
190898
|
-
}).map((temp) => ({ id: temp.id }))
|
|
190899
|
-
})),
|
|
190900
|
-
templates: void 0,
|
|
190901
|
-
components: void 0,
|
|
190902
|
-
pages: void 0
|
|
190903
|
-
};
|
|
190904
190876
|
const zip = new JSZip();
|
|
190905
|
-
|
|
190906
|
-
|
|
190907
|
-
|
|
190908
|
-
|
|
190909
|
-
|
|
190910
|
-
|
|
190911
|
-
}
|
|
190912
|
-
}
|
|
190913
|
-
const templatesFolder = zip.folder("templates");
|
|
190914
|
-
if (templatesFolder) {
|
|
190915
|
-
for (const template of templates || []) {
|
|
190916
|
-
templatesFolder.file(
|
|
190917
|
-
template.id + ".json",
|
|
190918
|
-
JSON.stringify(template, null, 2)
|
|
190919
|
-
);
|
|
190920
|
-
}
|
|
190921
|
-
}
|
|
190922
|
-
const pagesFolder = zip.folder("pages");
|
|
190923
|
-
if (pagesFolder) {
|
|
190924
|
-
for (const page of pages || []) {
|
|
190925
|
-
pagesFolder.file(page.id + ".json", JSON.stringify(page, null, 2));
|
|
190926
|
-
}
|
|
190927
|
-
}
|
|
190877
|
+
traverseFiles(files, (file, fullPath) => {
|
|
190878
|
+
if (file.type === "folder")
|
|
190879
|
+
zip.folder(fullPath);
|
|
190880
|
+
else
|
|
190881
|
+
zip.file(fullPath, file.content || "");
|
|
190882
|
+
});
|
|
190928
190883
|
const content = await zip.generateAsync({ type: "blob" });
|
|
190929
190884
|
save(fileName, content);
|
|
190885
|
+
return;
|
|
190930
190886
|
} catch (error) {
|
|
190931
190887
|
console.error(error);
|
|
190932
190888
|
} finally {
|
|
190933
190889
|
setIsExporting(false);
|
|
190934
190890
|
}
|
|
190935
|
-
}, [
|
|
190936
|
-
|
|
190937
|
-
|
|
190938
|
-
|
|
190939
|
-
|
|
190940
|
-
|
|
190941
|
-
|
|
190942
|
-
|
|
190943
|
-
|
|
190944
|
-
|
|
190945
|
-
|
|
190946
|
-
|
|
190891
|
+
}, [files, save, fileName]);
|
|
190892
|
+
return { exportAsZip, isExporting };
|
|
190893
|
+
}
|
|
190894
|
+
function useThemeGitUpload(repoName) {
|
|
190895
|
+
const [uploading, setUploading] = useState(false);
|
|
190896
|
+
const { files } = useThemeFiles();
|
|
190897
|
+
const [upload] = useGithubUploadMutation();
|
|
190898
|
+
const uploadToGit = useCallback(async () => {
|
|
190899
|
+
setUploading(true);
|
|
190900
|
+
try {
|
|
190901
|
+
const githubFiles = [];
|
|
190902
|
+
traverseFiles(files, (file, fullPath) => {
|
|
190903
|
+
if (file.type === "folder")
|
|
190904
|
+
return;
|
|
190905
|
+
githubFiles.push({ path: fullPath, content: file.content || "" });
|
|
190906
|
+
});
|
|
190907
|
+
await upload({
|
|
190908
|
+
owner: "wljQAQ",
|
|
190909
|
+
branch: "master",
|
|
190910
|
+
repo: repoName + Date.now(),
|
|
190911
|
+
commit: "初始化模板",
|
|
190912
|
+
files: githubFiles
|
|
190913
|
+
});
|
|
190914
|
+
alert(`上传到github成功`);
|
|
190915
|
+
} catch (err) {
|
|
190916
|
+
console.error("上传失败", err);
|
|
190917
|
+
alert("上传到github失败");
|
|
190918
|
+
} finally {
|
|
190919
|
+
setUploading(false);
|
|
190920
|
+
}
|
|
190921
|
+
}, [files, upload, repoName]);
|
|
190922
|
+
return { uploadToGit, uploading };
|
|
190923
|
+
}
|
|
190924
|
+
function useThemeFiles() {
|
|
190925
|
+
const theme = useStudioTheme();
|
|
190926
|
+
const styleConfig = useThemeStyleConfig();
|
|
190927
|
+
const components = useFrontComponents();
|
|
190928
|
+
const componentCategories = useComponentCategories();
|
|
190929
|
+
const templateCategories = useTemplateCategories();
|
|
190930
|
+
const templates = useSectionTemplates();
|
|
190931
|
+
const pages = usePages();
|
|
190932
|
+
const files = useMemo(() => {
|
|
190933
|
+
var _a3, _b3;
|
|
190934
|
+
const themeJson = {
|
|
190935
|
+
...theme,
|
|
190936
|
+
styleConfig,
|
|
190937
|
+
componentCategories: (_a3 = componentCategories == null ? void 0 : componentCategories.items) == null ? void 0 : _a3.map((category) => ({
|
|
190938
|
+
...category,
|
|
190939
|
+
components: components == null ? void 0 : components.filter((c) => {
|
|
190940
|
+
var _a4;
|
|
190941
|
+
return ((_a4 = c.category) == null ? void 0 : _a4.id) === category.id;
|
|
190942
|
+
}).map((c) => ({ id: c.id }))
|
|
190943
|
+
})),
|
|
190944
|
+
templateCategories: (_b3 = templateCategories == null ? void 0 : templateCategories.items) == null ? void 0 : _b3.map((category) => ({
|
|
190945
|
+
...category,
|
|
190946
|
+
templates: templates == null ? void 0 : templates.filter((t) => {
|
|
190947
|
+
var _a4;
|
|
190948
|
+
return ((_a4 = t.category) == null ? void 0 : _a4.id) === category.id;
|
|
190949
|
+
}).map((t) => ({ id: t.id }))
|
|
190950
|
+
}))
|
|
190951
|
+
};
|
|
190952
|
+
return [
|
|
190953
|
+
{ type: "file", name: "theme.json", content: JSON.stringify(themeJson, null, 2) },
|
|
190954
|
+
{ type: "file", name: "README.md", content: "主题备份文件,无需解压。" },
|
|
190955
|
+
{
|
|
190956
|
+
type: "folder",
|
|
190957
|
+
name: "templates",
|
|
190958
|
+
files: templates == null ? void 0 : templates.map((t) => ({
|
|
190959
|
+
type: "file",
|
|
190960
|
+
name: `${t.id}.json`,
|
|
190961
|
+
content: JSON.stringify(t, null, 2)
|
|
190962
|
+
}))
|
|
190963
|
+
},
|
|
190964
|
+
{
|
|
190965
|
+
type: "folder",
|
|
190966
|
+
name: "components",
|
|
190967
|
+
files: components == null ? void 0 : components.map((c) => ({
|
|
190968
|
+
type: "file",
|
|
190969
|
+
name: `${c.id}.json`,
|
|
190970
|
+
content: JSON.stringify(c, null, 2)
|
|
190971
|
+
}))
|
|
190972
|
+
},
|
|
190973
|
+
{
|
|
190974
|
+
type: "folder",
|
|
190975
|
+
name: "pages",
|
|
190976
|
+
files: pages == null ? void 0 : pages.map((p2) => ({
|
|
190977
|
+
type: "file",
|
|
190978
|
+
name: `${p2.id}.json`,
|
|
190979
|
+
content: JSON.stringify(p2, null, 2)
|
|
190980
|
+
}))
|
|
190981
|
+
}
|
|
190982
|
+
];
|
|
190983
|
+
}, [theme, styleConfig, components, componentCategories, templateCategories, templates, pages]);
|
|
190984
|
+
return { files };
|
|
190985
|
+
}
|
|
190986
|
+
function traverseFiles(files, callback, parentPath = "") {
|
|
190987
|
+
for (const file of files) {
|
|
190988
|
+
const currentPath = parentPath ? `${parentPath}/${file.name}` : file.name;
|
|
190989
|
+
callback(file, currentPath);
|
|
190990
|
+
if (file.type === "folder" && file.files) {
|
|
190991
|
+
traverseFiles(file.files, callback, currentPath);
|
|
190992
|
+
}
|
|
190993
|
+
}
|
|
190947
190994
|
}
|
|
190948
190995
|
function MoreActions$1() {
|
|
190949
|
-
var _a3;
|
|
190996
|
+
var _a3, _b3;
|
|
190950
190997
|
const [parentThemeOpen, setParentThemeOpen] = useState(false);
|
|
190951
190998
|
const [styleConfigOpen, setStyleConfigOpen] = useState(false);
|
|
190952
190999
|
const setConfigType = useStudioStore((state) => state.setConfigType);
|
|
190953
191000
|
const isBaseLangTheme = useIsBaseLangTheme();
|
|
190954
191001
|
const theme = useStudioTheme();
|
|
190955
191002
|
const website = useWebsite();
|
|
190956
|
-
const {
|
|
191003
|
+
const { exportAsZip, isExporting } = useThemeZipExport(
|
|
190957
191004
|
`website-${website == null ? void 0 : website.name}-` + ((_a3 = theme == null ? void 0 : theme.lang) == null ? void 0 : _a3.abbr)
|
|
190958
191005
|
);
|
|
191006
|
+
const { uploadToGit, uploading: isUploadingToGit } = useThemeGitUpload(`website-${website == null ? void 0 : website.name}-` + ((_b3 = theme == null ? void 0 : theme.lang) == null ? void 0 : _b3.abbr));
|
|
190959
191007
|
const {
|
|
190960
191008
|
upload,
|
|
190961
191009
|
isUploading,
|
|
@@ -190973,7 +191021,7 @@ function MoreActions$1() {
|
|
|
190973
191021
|
variant: "light",
|
|
190974
191022
|
isIconOnly: true,
|
|
190975
191023
|
className: "text-default-500",
|
|
190976
|
-
isLoading: isExporting || isUploading,
|
|
191024
|
+
isLoading: isExporting || isUploading || isUploadingToGit,
|
|
190977
191025
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MoreIcon, { className: "size-5" })
|
|
190978
191026
|
}
|
|
190979
191027
|
) }),
|
|
@@ -190983,12 +191031,15 @@ function MoreActions$1() {
|
|
|
190983
191031
|
"aria-label": "更多操作",
|
|
190984
191032
|
disabledKeys: isBaseLangTheme ? [] : ["parent-theme"],
|
|
190985
191033
|
children: [
|
|
190986
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
191034
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
190987
191035
|
DropdownItem,
|
|
190988
191036
|
{
|
|
190989
191037
|
startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(LanguageIcon, { className: "size-5" }),
|
|
190990
191038
|
onPress: () => setConfigType(ThemeConfigType.MultiLang),
|
|
190991
|
-
children:
|
|
191039
|
+
children: [
|
|
191040
|
+
"多语言配置 ",
|
|
191041
|
+
isUploadingToGit
|
|
191042
|
+
]
|
|
190992
191043
|
},
|
|
190993
191044
|
"multi-lang"
|
|
190994
191045
|
),
|
|
@@ -191086,11 +191137,20 @@ function MoreActions$1() {
|
|
|
191086
191137
|
DropdownItem,
|
|
191087
191138
|
{
|
|
191088
191139
|
startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(DownloadIcon, { className: "size-5" }),
|
|
191089
|
-
onPress:
|
|
191140
|
+
onPress: exportAsZip,
|
|
191090
191141
|
children: "网站导出"
|
|
191091
191142
|
},
|
|
191092
191143
|
"export-website"
|
|
191093
191144
|
),
|
|
191145
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
191146
|
+
DropdownItem,
|
|
191147
|
+
{
|
|
191148
|
+
startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(DownloadIcon, { className: "size-5" }),
|
|
191149
|
+
onPress: uploadToGit,
|
|
191150
|
+
children: "网站导出到GIT"
|
|
191151
|
+
},
|
|
191152
|
+
"export-website"
|
|
191153
|
+
),
|
|
191094
191154
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
191095
191155
|
DropdownItem,
|
|
191096
191156
|
{
|
|
@@ -202757,7 +202817,7 @@ function MoreActions() {
|
|
|
202757
202817
|
} = useDisclosure();
|
|
202758
202818
|
const setConfigType = useStudioStore((state) => state.setConfigType);
|
|
202759
202819
|
const theme = useStudioTheme();
|
|
202760
|
-
const {
|
|
202820
|
+
const { exportAsZip, isExporting } = useThemeZipExport("theme-" + (theme == null ? void 0 : theme.id));
|
|
202761
202821
|
const {
|
|
202762
202822
|
upload,
|
|
202763
202823
|
isUploading,
|
|
@@ -202844,7 +202904,7 @@ function MoreActions() {
|
|
|
202844
202904
|
]
|
|
202845
202905
|
}
|
|
202846
202906
|
),
|
|
202847
|
-
onPress:
|
|
202907
|
+
onPress: exportAsZip,
|
|
202848
202908
|
children: "下载主题"
|
|
202849
202909
|
},
|
|
202850
202910
|
"export-theme"
|
|
@@ -203637,4 +203697,4 @@ export {
|
|
|
203637
203697
|
typescriptDefaults as t,
|
|
203638
203698
|
useCustomizedMaterials as u
|
|
203639
203699
|
};
|
|
203640
|
-
//# sourceMappingURL=index-
|
|
203700
|
+
//# sourceMappingURL=index-ca588fca.js.map
|