@rxdrag/website-studio 0.0.44 → 0.0.45
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/{cssMode-f6ed7ab1.js → cssMode-8a633359.js} +4 -4
- package/dist/{cssMode-f6ed7ab1.js.map → cssMode-8a633359.js.map} +1 -1
- package/dist/{freemarker2-0b5a20e1.js → freemarker2-160c0ddc.js} +4 -4
- package/dist/{freemarker2-0b5a20e1.js.map → freemarker2-160c0ddc.js.map} +1 -1
- package/dist/{handlebars-3e804cdc.js → handlebars-b83294de.js} +4 -4
- package/dist/{handlebars-3e804cdc.js.map → handlebars-b83294de.js.map} +1 -1
- package/dist/hooks/useTranslateTheme.d.ts +1 -1
- package/dist/{html-bef31e01.js → html-e465efce.js} +4 -4
- package/dist/{html-bef31e01.js.map → html-e465efce.js.map} +1 -1
- package/dist/{htmlMode-190446f0.js → htmlMode-fed923b3.js} +4 -4
- package/dist/{htmlMode-190446f0.js.map → htmlMode-fed923b3.js.map} +1 -1
- package/dist/{index-add86284.js → index-6ddf2099.js} +158 -185
- package/dist/{index-add86284.js.map → index-6ddf2099.js.map} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/{javascript-a482a18d.js → javascript-a1dcfc76.js} +5 -5
- package/dist/{javascript-a482a18d.js.map → javascript-a1dcfc76.js.map} +1 -1
- package/dist/{jsonMode-36321e55.js → jsonMode-92034391.js} +4 -4
- package/dist/{jsonMode-36321e55.js.map → jsonMode-92034391.js.map} +1 -1
- package/dist/{liquid-91f2b334.js → liquid-8e298ea5.js} +4 -4
- package/dist/{liquid-91f2b334.js.map → liquid-8e298ea5.js.map} +1 -1
- package/dist/{mdx-5b3f4043.js → mdx-65c6fe0f.js} +4 -4
- package/dist/{mdx-5b3f4043.js.map → mdx-65c6fe0f.js.map} +1 -1
- package/dist/{python-5ab24881.js → python-55e87814.js} +4 -4
- package/dist/{python-5ab24881.js.map → python-55e87814.js.map} +1 -1
- package/dist/{razor-e2cba756.js → razor-34386182.js} +4 -4
- package/dist/{razor-e2cba756.js.map → razor-34386182.js.map} +1 -1
- package/dist/{tsMode-a884ed37.js → tsMode-67ddf297.js} +4 -4
- package/dist/{tsMode-a884ed37.js.map → tsMode-67ddf297.js.map} +1 -1
- package/dist/{typescript-47724791.js → typescript-48be5bbc.js} +4 -4
- package/dist/{typescript-47724791.js.map → typescript-48be5bbc.js.map} +1 -1
- package/dist/{xml-3d847f47.js → xml-1520dcee.js} +4 -4
- package/dist/{xml-3d847f47.js.map → xml-1520dcee.js.map} +1 -1
- package/dist/{yaml-f547855f.js → yaml-b01c807c.js} +4 -4
- package/dist/{yaml-f547855f.js.map → yaml-b01c807c.js.map} +1 -1
- package/package.json +19 -19
- package/dist/components/ConfigDrawer/MultiLangPanel/useTranslateThemeTask.d.ts +0 -7
|
@@ -7,7 +7,7 @@ var __publicField = (obj, key2, value) => {
|
|
|
7
7
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$2, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa;
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import React__default, { createContext, useContext, useMemo, memo, useEffect, useCallback, useState, useRef, forwardRef as forwardRef$2, Component, useImperativeHandle, isValidElement, cloneElement } from "react";
|
|
10
|
-
import { ThemeFields, PageQueryOptions, PageFields, FrontComponentQueryOptions, FrontComponentFields, ComponentCategoryFields, SectionTemplateQueryOptions, SectionTemplateFields, ComponentCategoryQueryOptions, TemplateCategoryQueryOptions, TemplateCategoryFields, ThemeQueryOptions, StyleConfigFields, LangFields, ThemeConfigQueryOptions, ThemeConfigFields, PageAssciations, PageType, ProductCategoryEntityName, ProductCategoryQueryOptions, ProductCategoryFields, ProductQueryOptions, ProductFields, PublishableStatus, websiteToInput, LangQueryOptions, WebsiteAssciations, ExtendFieldType, ThemeConfigAssciations, MediaQueryOptions, WebsiteSettingsQueryOptions, WebsiteSettingsFields, themeConfigToInputCascade, ThemeConfigEntityName, MediaType, themeConfigToInput, websiteSettingsToInput, WebsiteSettingsEntityName, WebsiteSettingsAssciations, PageEntityName, ThemeEntityName, themeToInputCascade, ThemeCategoryFields, themeToInput, frontComponentToInput, sectionTemplateToInput, pageToInputCascade, ComponentCategoryEntityName, SectionTemplateEntityName, FrontComponentEntityName, PageMetaFields, pageToInput, PageMetaAssciations, componentCategoryToInput, TemplateCategoryEntityName, templateCategoryToInput } from "@rxdrag/rxcms-models";
|
|
10
|
+
import { ThemeFields, PageQueryOptions, PageFields, FrontComponentQueryOptions, FrontComponentFields, ComponentCategoryFields, SectionTemplateQueryOptions, SectionTemplateFields, ComponentCategoryQueryOptions, TemplateCategoryQueryOptions, TemplateCategoryFields, ThemeQueryOptions, StyleConfigFields, LangFields, ThemeConfigQueryOptions, ThemeConfigFields, PageAssciations, PageType, ProductCategoryEntityName, ProductCategoryQueryOptions, ProductCategoryFields, ProductQueryOptions, ProductFields, PublishableStatus, websiteToInput, TaskOwner, LangQueryOptions, WebsiteAssciations, ExtendFieldType, ThemeConfigAssciations, MediaQueryOptions, WebsiteSettingsQueryOptions, WebsiteSettingsFields, themeConfigToInputCascade, ThemeConfigEntityName, MediaType, themeConfigToInput, websiteSettingsToInput, WebsiteSettingsEntityName, WebsiteSettingsAssciations, PageEntityName, ThemeEntityName, themeToInputCascade, ThemeCategoryFields, themeToInput, frontComponentToInput, sectionTemplateToInput, pageToInputCascade, ComponentCategoryEntityName, SectionTemplateEntityName, FrontComponentEntityName, PageMetaFields, pageToInput, PageMetaAssciations, componentCategoryToInput, TemplateCategoryEntityName, templateCategoryToInput } from "@rxdrag/rxcms-models";
|
|
11
11
|
import { GlobalLoading, EntityForm, SubmitButton, useListData, SearchInput, EntityPagination, useIsLoading, QueryListScope, useRemoveRow, useEditRow, EntityEditModal, useSelectionsState, EntityTable, EntityListScope, NewButton, EntityRowScope, EntitySelectField, useNewRow } from "@rxdrag/rxcms-models-ui";
|
|
12
12
|
import { useOneTheme, usePageList, useTemplateCategoryList, useSectionTemplateList, useComponentCategoryList, useFrontComponentList, useOneThemeById, useUpsertOneWebsite, useDeleteThemeById, useUpsertOneTheme, useLangList, useOneWebsiteSettings, useOneThemeConfig, useUpsertOneThemeConfig, useUpsertOneWebsiteSettings, useUpsertOnePage, useUpsertOneFrontComponent, useUpsertOneSectionTemplate, useDeletePageById } from "@rxdrag/rxcms-model-hooks";
|
|
13
13
|
import { newPageMetaOptions, useWebsite, useCurrentLang, ComponentType, currentLangState, useCurrentLangId, MediaSingleSelectField, FullImageSelectField, useSiteId, usePreviewUrl, LangSelect, TitleAndSlug, TitleViewField, DescriptionViewField, SiteRoot } from "@rxdrag/biz-components";
|
|
@@ -18,9 +18,9 @@ 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,
|
|
21
|
+
import { useEntifyEndpoint, useEntifyToken, useLazyQueryEntityList, useLazyQueryOneEntity, emitEntityChange, useCreateEntityClient } from "@rxdrag/entify-hooks";
|
|
22
22
|
import dayjs from "dayjs";
|
|
23
|
-
import { ErrorBoundary, ColorPicker, useSave, CheckCircleIcon as CheckCircleIcon$1, CloseIcon, ModalBody, AddIcon as AddIcon$1,
|
|
23
|
+
import { ErrorBoundary, ColorPicker, useSave, CheckCircleIcon as CheckCircleIcon$1, CloseIcon, ModalBody, AddIcon as AddIcon$1, 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, AiIcon, SettingsMinimalisticIcon, CodeSquareIcon, DownloadIcon, UploadIcon, StyledTooltip, PlayIcon, Logo, GlobalIcon, SnsIcon, LightBoltIcon, WarningIcon, PinIcon, PredefinedColorPicker, PagesIcon, WidgetIcon, LeafNode, GroupNode, TreeView, DesignIcon, RemoveIcon, ResetIcon, TaskStopIcon, 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";
|
|
25
25
|
import gsap$2 from "gsap";
|
|
26
26
|
import { Input, Textarea, StringArrayInput, ImageSelect, TargetSetter, propSetters, DeviceBreakpoints, DeviceContext } from "@rxdrag/schema-setters";
|
|
@@ -29,16 +29,16 @@ import { useEntifyWrapperStore, useUpsertEntityWithIndicator } from "@rxdrag/rxc
|
|
|
29
29
|
import JSZip from "jszip";
|
|
30
30
|
import { create as create$4 } from "zustand";
|
|
31
31
|
import { Icon } from "@iconify/react";
|
|
32
|
-
import { useInprogressTaskByKey, useUpdateTask, taskPool, TranslateThemeTask, TaskManager, ResetPageTask, ImportPagesTask, ImportComponentsTask } from "@rxdrag/ai-tasks";
|
|
33
32
|
import { useAiUrl, useAiAgent, AiWidget, AiAgentRoot } from "@rxdrag/ai-agent";
|
|
33
|
+
import { createHttpClient } from "@rxdrag/entify-lib";
|
|
34
34
|
import { InputField, TextareaField, toField, ColorField, SwitchField, SelectField, PasswordField, Form } from "@rxdrag/fieldy-heroui";
|
|
35
35
|
import { ObjectField, useFormValue, useForm, VirtualForm } from "@rxdrag/react-fieldy-pro";
|
|
36
36
|
import "react-colorful";
|
|
37
37
|
import { motion, AnimatePresence, LazyMotion, m } from "framer-motion";
|
|
38
38
|
import $4AOtR$reactdom, { createPortal } from "react-dom";
|
|
39
39
|
import { DeployType, useExportWebsite as useExportWebsite$1 } from "@rxdrag/code-generator";
|
|
40
|
-
import "@rxdrag/entify-lib";
|
|
41
40
|
import { ComponentRender } from "@rxdrag/react-runner-pro";
|
|
41
|
+
import { TaskManager, useInprogressTaskByKey, useUpdateTask, taskPool, ResetPageTask, ImportPagesTask, ImportComponentsTask } from "@rxdrag/ai-tasks";
|
|
42
42
|
import tinycolor from "tinycolor2";
|
|
43
43
|
var jsxRuntime = { exports: {} };
|
|
44
44
|
var reactJsxRuntime_production_min = {};
|
|
@@ -6582,53 +6582,116 @@ function LangCard(props) {
|
|
|
6582
6582
|
}
|
|
6583
6583
|
);
|
|
6584
6584
|
}
|
|
6585
|
-
const
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
const
|
|
6591
|
-
const
|
|
6592
|
-
const
|
|
6593
|
-
const
|
|
6594
|
-
const
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6585
|
+
const defaultSchema = {
|
|
6586
|
+
componentName: "Root"
|
|
6587
|
+
};
|
|
6588
|
+
const emptyValue = { schema: void 0, config: void 0 };
|
|
6589
|
+
function useSchema(selectedContent) {
|
|
6590
|
+
const [schema, setSchema] = useState(emptyValue);
|
|
6591
|
+
const components = useFrontComponents();
|
|
6592
|
+
const pages = usePages();
|
|
6593
|
+
const componentsRef = useRef(components);
|
|
6594
|
+
const pagesRef = useRef(pages);
|
|
6595
|
+
componentsRef.current = components;
|
|
6596
|
+
pagesRef.current = pages;
|
|
6597
|
+
const templates = useTemplates();
|
|
6598
|
+
const templatesRef = useRef(templates);
|
|
6599
|
+
templatesRef.current = templates;
|
|
6600
|
+
useEffect(() => {
|
|
6601
|
+
var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i3, _j2;
|
|
6602
|
+
let code;
|
|
6603
|
+
let hasContent = false;
|
|
6604
|
+
let defaultConfig2;
|
|
6605
|
+
if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Component) {
|
|
6606
|
+
const component = (_a3 = componentsRef.current) == null ? void 0 : _a3.find(
|
|
6607
|
+
(component2) => component2.id === selectedContent.id
|
|
6608
|
+
);
|
|
6609
|
+
if (component) {
|
|
6610
|
+
code = component.code;
|
|
6611
|
+
hasContent = true;
|
|
6612
|
+
}
|
|
6613
|
+
} else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.PredefinedPage || (selectedContent == null ? void 0 : selectedContent.type) === ContentType.Page) {
|
|
6614
|
+
const page = (_b3 = pagesRef.current) == null ? void 0 : _b3.find(
|
|
6615
|
+
(item) => item.id === selectedContent.id
|
|
6616
|
+
);
|
|
6617
|
+
defaultConfig2 = {
|
|
6618
|
+
pageMeta: {
|
|
6619
|
+
seoTitle: (_c2 = page == null ? void 0 : page.meta) == null ? void 0 : _c2.seoTitle,
|
|
6620
|
+
seoDescription: (_d2 = page == null ? void 0 : page.meta) == null ? void 0 : _d2.seoDescription,
|
|
6621
|
+
seoKeywords: (_e2 = page == null ? void 0 : page.meta) == null ? void 0 : _e2.seoKeywords,
|
|
6622
|
+
ogTitle: (_f2 = page == null ? void 0 : page.meta) == null ? void 0 : _f2.ogTitle,
|
|
6623
|
+
ogDescription: (_g2 = page == null ? void 0 : page.meta) == null ? void 0 : _g2.ogDescription,
|
|
6624
|
+
ogType: (_h2 = page == null ? void 0 : page.meta) == null ? void 0 : _h2.ogType,
|
|
6625
|
+
ogImage: (_i3 = page == null ? void 0 : page.meta) == null ? void 0 : _i3.ogImage
|
|
6626
|
+
}
|
|
6627
|
+
};
|
|
6628
|
+
if (page) {
|
|
6629
|
+
code = page.code;
|
|
6630
|
+
hasContent = true;
|
|
6631
|
+
}
|
|
6632
|
+
} else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Template) {
|
|
6633
|
+
const template = (_j2 = templatesRef.current) == null ? void 0 : _j2.find(
|
|
6634
|
+
(template2) => template2.id === selectedContent.id
|
|
6635
|
+
);
|
|
6636
|
+
if (template) {
|
|
6637
|
+
code = template.code;
|
|
6638
|
+
hasContent = true;
|
|
6639
|
+
}
|
|
6610
6640
|
}
|
|
6611
|
-
if (
|
|
6612
|
-
|
|
6613
|
-
|
|
6641
|
+
if (code) {
|
|
6642
|
+
transformCodeToSchema(code).then((value) => {
|
|
6643
|
+
setSchema({
|
|
6644
|
+
schema: { ...defaultSchema, children: (value == null ? void 0 : value.template) || [] },
|
|
6645
|
+
config: { ...defaultConfig2, ...value.resources }
|
|
6646
|
+
});
|
|
6647
|
+
});
|
|
6648
|
+
} else if (hasContent) {
|
|
6649
|
+
setSchema({
|
|
6650
|
+
schema: { ...defaultSchema, children: [] }
|
|
6651
|
+
});
|
|
6614
6652
|
}
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6653
|
+
}, [selectedContent == null ? void 0 : selectedContent.id, selectedContent == null ? void 0 : selectedContent.type]);
|
|
6654
|
+
console.log("===>schema", schema);
|
|
6655
|
+
return schema;
|
|
6656
|
+
}
|
|
6657
|
+
function useCloseDrawer() {
|
|
6658
|
+
const setDrawerType = useStudioStore((state) => state.setDrawerType);
|
|
6659
|
+
const drawerDocked = useStudioStore((state) => state.drawerDocked);
|
|
6660
|
+
const close = useCallback(() => {
|
|
6661
|
+
if (!drawerDocked) {
|
|
6662
|
+
setDrawerType(void 0);
|
|
6618
6663
|
}
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6664
|
+
}, [drawerDocked, setDrawerType]);
|
|
6665
|
+
return close;
|
|
6666
|
+
}
|
|
6667
|
+
function useIsBaseLangTheme() {
|
|
6668
|
+
var _a3, _b3;
|
|
6669
|
+
const theme = useStudioTheme();
|
|
6670
|
+
const website = useWebsite();
|
|
6671
|
+
return ((_a3 = theme == null ? void 0 : theme.lang) == null ? void 0 : _a3.id) === ((_b3 = website == null ? void 0 : website.baseLang) == null ? void 0 : _b3.id);
|
|
6672
|
+
}
|
|
6673
|
+
function useTranslateTheme() {
|
|
6674
|
+
const baseURL = useAiUrl();
|
|
6675
|
+
const token = useEntifyToken();
|
|
6676
|
+
const website = useWebsite();
|
|
6677
|
+
const translate = useCallback(
|
|
6678
|
+
async (langId, title) => {
|
|
6679
|
+
if (!token || !(website == null ? void 0 : website.id)) {
|
|
6680
|
+
console.error("No token or website id");
|
|
6681
|
+
return;
|
|
6682
|
+
}
|
|
6683
|
+
const http = createHttpClient({ baseURL, token });
|
|
6684
|
+
const response = await http.post("/api/translate-theme", {
|
|
6685
|
+
websiteId: website == null ? void 0 : website.id,
|
|
6686
|
+
langId,
|
|
6687
|
+
title,
|
|
6688
|
+
taskOwnerType: TaskOwner.Studio
|
|
6689
|
+
});
|
|
6690
|
+
console.log("translate response", response);
|
|
6691
|
+
},
|
|
6692
|
+
[baseURL, token, website == null ? void 0 : website.id]
|
|
6693
|
+
);
|
|
6694
|
+
return translate;
|
|
6632
6695
|
}
|
|
6633
6696
|
const linkTypes = [
|
|
6634
6697
|
{
|
|
@@ -6699,7 +6762,7 @@ function MultiLangPanel() {
|
|
|
6699
6762
|
var _a3, _b3, _c2, _d2, _e2, _f2;
|
|
6700
6763
|
const [linkType, setLinkType] = useState("subdomain");
|
|
6701
6764
|
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
6702
|
-
const [
|
|
6765
|
+
const [currentLangId, setCurrentLangId] = useCurrentLangId();
|
|
6703
6766
|
const selectedContent = useStudioStore((state) => state.selectedContent);
|
|
6704
6767
|
const setSelectedContent = useStudioStore(
|
|
6705
6768
|
(state) => state.setSelectedContent
|
|
@@ -6707,13 +6770,13 @@ function MultiLangPanel() {
|
|
|
6707
6770
|
const website = useWebsite();
|
|
6708
6771
|
const isChanginBaseLangRef = useRef(false);
|
|
6709
6772
|
const [upsertTheme, { isMutating: isCreating }] = useUpsertOneTheme();
|
|
6710
|
-
const
|
|
6773
|
+
const translateTheme = useTranslateTheme();
|
|
6711
6774
|
useEffect(() => {
|
|
6712
6775
|
var _a4;
|
|
6713
|
-
if (website && !
|
|
6714
|
-
|
|
6776
|
+
if (website && !currentLangId) {
|
|
6777
|
+
setCurrentLangId((_a4 = website.baseLang) == null ? void 0 : _a4.id);
|
|
6715
6778
|
}
|
|
6716
|
-
}, [
|
|
6779
|
+
}, [currentLangId, setCurrentLangId, website]);
|
|
6717
6780
|
const { data: allLangs, isLoading: allLangsLoading } = useLangList(
|
|
6718
6781
|
new LangQueryOptions([
|
|
6719
6782
|
LangFields.id,
|
|
@@ -6746,12 +6809,12 @@ function MultiLangPanel() {
|
|
|
6746
6809
|
);
|
|
6747
6810
|
const handleLangSelect = useCallback(
|
|
6748
6811
|
(langId) => {
|
|
6749
|
-
|
|
6750
|
-
if ((selectedContent == null ? void 0 : selectedContent.id) && langId !==
|
|
6812
|
+
setCurrentLangId(langId);
|
|
6813
|
+
if ((selectedContent == null ? void 0 : selectedContent.id) && langId !== currentLangId) {
|
|
6751
6814
|
setSelectedContent(void 0);
|
|
6752
6815
|
}
|
|
6753
6816
|
},
|
|
6754
|
-
[selectedContent == null ? void 0 : selectedContent.id,
|
|
6817
|
+
[selectedContent == null ? void 0 : selectedContent.id, setCurrentLangId, setSelectedContent, currentLangId]
|
|
6755
6818
|
);
|
|
6756
6819
|
const leftLangs = useMemo(() => {
|
|
6757
6820
|
var _a4;
|
|
@@ -6794,16 +6857,22 @@ function MultiLangPanel() {
|
|
|
6794
6857
|
const handleTranslate = useCallback(() => {
|
|
6795
6858
|
setConfirmOpen(true);
|
|
6796
6859
|
}, []);
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
}, [task]);
|
|
6860
|
+
useCallback(() => {
|
|
6861
|
+
}, []);
|
|
6800
6862
|
const handleCloseConfirm = useCallback(() => {
|
|
6801
6863
|
setConfirmOpen(false);
|
|
6802
6864
|
}, []);
|
|
6803
6865
|
const handleConfirm = useCallback(() => {
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6866
|
+
var _a4;
|
|
6867
|
+
if (!currentLangId) {
|
|
6868
|
+
console.error("No currentLang");
|
|
6869
|
+
return;
|
|
6870
|
+
}
|
|
6871
|
+
const lang = (_a4 = allLangs == null ? void 0 : allLangs.items) == null ? void 0 : _a4.find((lang2) => lang2.id === currentLangId);
|
|
6872
|
+
const title = `网站代码翻译到:${(lang == null ? void 0 : lang.cnName) || (lang == null ? void 0 : lang.enName) || (lang == null ? void 0 : lang.localName) || (lang == null ? void 0 : lang.abbr) || ""}`;
|
|
6873
|
+
translateTheme(currentLangId, title);
|
|
6874
|
+
}, [translateTheme, currentLangId, allLangs == null ? void 0 : allLangs.items]);
|
|
6875
|
+
const isRunning = false;
|
|
6807
6876
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
6808
6877
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ModalBody, { className: "flex-1 p-4 min-h-0 overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
6809
6878
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { className: "bg-default-50", children: [
|
|
@@ -6863,7 +6932,7 @@ function MultiLangPanel() {
|
|
|
6863
6932
|
LangCard,
|
|
6864
6933
|
{
|
|
6865
6934
|
lang,
|
|
6866
|
-
isSelected:
|
|
6935
|
+
isSelected: currentLangId === lang.id,
|
|
6867
6936
|
isBaseLang: ((_a4 = website == null ? void 0 : website.baseLang) == null ? void 0 : _a4.id) === lang.id,
|
|
6868
6937
|
onSelect: handleLangSelect
|
|
6869
6938
|
},
|
|
@@ -6911,23 +6980,15 @@ function MultiLangPanel() {
|
|
|
6911
6980
|
] })
|
|
6912
6981
|
] }),
|
|
6913
6982
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-6 flex items-center justify-between", children: [
|
|
6914
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-default-500"
|
|
6983
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-default-500" }),
|
|
6915
6984
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-2", children: [
|
|
6916
|
-
isRunning
|
|
6917
|
-
Button$2,
|
|
6918
|
-
{
|
|
6919
|
-
variant: "flat",
|
|
6920
|
-
startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(TaskStopIcon, { className: "size-5" }),
|
|
6921
|
-
onPress: handleStop,
|
|
6922
|
-
children: "停止"
|
|
6923
|
-
}
|
|
6924
|
-
),
|
|
6985
|
+
isRunning,
|
|
6925
6986
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
6926
6987
|
Button$2,
|
|
6927
6988
|
{
|
|
6928
6989
|
color: "primary",
|
|
6929
6990
|
startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiStarIcon, { className: "size-5" }),
|
|
6930
|
-
isDisabled:
|
|
6991
|
+
isDisabled: currentLangId === ((_d2 = website == null ? void 0 : website.baseLang) == null ? void 0 : _d2.id),
|
|
6931
6992
|
isLoading: isRunning,
|
|
6932
6993
|
onPress: handleTranslate,
|
|
6933
6994
|
children: "翻译 & 重置"
|
|
@@ -138162,7 +138223,7 @@ registerLanguage({
|
|
|
138162
138223
|
aliases: ["FreeMarker2", "Apache FreeMarker2"],
|
|
138163
138224
|
loader: () => {
|
|
138164
138225
|
{
|
|
138165
|
-
return import("./freemarker2-
|
|
138226
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
138166
138227
|
}
|
|
138167
138228
|
}
|
|
138168
138229
|
});
|
|
@@ -138171,7 +138232,7 @@ registerLanguage({
|
|
|
138171
138232
|
aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"],
|
|
138172
138233
|
loader: () => {
|
|
138173
138234
|
{
|
|
138174
|
-
return import("./freemarker2-
|
|
138235
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagAngleInterpolationDollar);
|
|
138175
138236
|
}
|
|
138176
138237
|
}
|
|
138177
138238
|
});
|
|
@@ -138180,7 +138241,7 @@ registerLanguage({
|
|
|
138180
138241
|
aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"],
|
|
138181
138242
|
loader: () => {
|
|
138182
138243
|
{
|
|
138183
|
-
return import("./freemarker2-
|
|
138244
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagBracketInterpolationDollar);
|
|
138184
138245
|
}
|
|
138185
138246
|
}
|
|
138186
138247
|
});
|
|
@@ -138189,7 +138250,7 @@ registerLanguage({
|
|
|
138189
138250
|
aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"],
|
|
138190
138251
|
loader: () => {
|
|
138191
138252
|
{
|
|
138192
|
-
return import("./freemarker2-
|
|
138253
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagAngleInterpolationBracket);
|
|
138193
138254
|
}
|
|
138194
138255
|
}
|
|
138195
138256
|
});
|
|
@@ -138198,7 +138259,7 @@ registerLanguage({
|
|
|
138198
138259
|
aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"],
|
|
138199
138260
|
loader: () => {
|
|
138200
138261
|
{
|
|
138201
|
-
return import("./freemarker2-
|
|
138262
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagBracketInterpolationBracket);
|
|
138202
138263
|
}
|
|
138203
138264
|
}
|
|
138204
138265
|
});
|
|
@@ -138207,7 +138268,7 @@ registerLanguage({
|
|
|
138207
138268
|
aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"],
|
|
138208
138269
|
loader: () => {
|
|
138209
138270
|
{
|
|
138210
|
-
return import("./freemarker2-
|
|
138271
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
138211
138272
|
}
|
|
138212
138273
|
}
|
|
138213
138274
|
});
|
|
@@ -138216,7 +138277,7 @@ registerLanguage({
|
|
|
138216
138277
|
aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"],
|
|
138217
138278
|
loader: () => {
|
|
138218
138279
|
{
|
|
138219
|
-
return import("./freemarker2-
|
|
138280
|
+
return import("./freemarker2-160c0ddc.js").then((m2) => m2.TagAutoInterpolationBracket);
|
|
138220
138281
|
}
|
|
138221
138282
|
}
|
|
138222
138283
|
});
|
|
@@ -138266,7 +138327,7 @@ registerLanguage({
|
|
|
138266
138327
|
mimetypes: ["text/x-handlebars-template"],
|
|
138267
138328
|
loader: () => {
|
|
138268
138329
|
{
|
|
138269
|
-
return import("./handlebars-
|
|
138330
|
+
return import("./handlebars-b83294de.js");
|
|
138270
138331
|
}
|
|
138271
138332
|
}
|
|
138272
138333
|
});
|
|
@@ -138299,7 +138360,7 @@ registerLanguage({
|
|
|
138299
138360
|
mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
|
|
138300
138361
|
loader: () => {
|
|
138301
138362
|
{
|
|
138302
|
-
return import("./html-
|
|
138363
|
+
return import("./html-e465efce.js");
|
|
138303
138364
|
}
|
|
138304
138365
|
}
|
|
138305
138366
|
});
|
|
@@ -138352,7 +138413,7 @@ registerLanguage({
|
|
|
138352
138413
|
mimetypes: ["text/javascript"],
|
|
138353
138414
|
loader: () => {
|
|
138354
138415
|
{
|
|
138355
|
-
return import("./javascript-
|
|
138416
|
+
return import("./javascript-a1dcfc76.js");
|
|
138356
138417
|
}
|
|
138357
138418
|
}
|
|
138358
138419
|
});
|
|
@@ -138451,7 +138512,7 @@ registerLanguage({
|
|
|
138451
138512
|
mimetypes: ["application/liquid"],
|
|
138452
138513
|
loader: () => {
|
|
138453
138514
|
{
|
|
138454
|
-
return import("./liquid-
|
|
138515
|
+
return import("./liquid-8e298ea5.js");
|
|
138455
138516
|
}
|
|
138456
138517
|
}
|
|
138457
138518
|
});
|
|
@@ -138499,7 +138560,7 @@ registerLanguage({
|
|
|
138499
138560
|
aliases: ["MDX", "mdx"],
|
|
138500
138561
|
loader: () => {
|
|
138501
138562
|
{
|
|
138502
|
-
return import("./mdx-
|
|
138563
|
+
return import("./mdx-65c6fe0f.js");
|
|
138503
138564
|
}
|
|
138504
138565
|
}
|
|
138505
138566
|
});
|
|
@@ -138758,7 +138819,7 @@ registerLanguage({
|
|
|
138758
138819
|
firstLine: "^#!/.*\\bpython[0-9.-]*\\b",
|
|
138759
138820
|
loader: () => {
|
|
138760
138821
|
{
|
|
138761
|
-
return import("./python-
|
|
138822
|
+
return import("./python-55e87814.js");
|
|
138762
138823
|
}
|
|
138763
138824
|
}
|
|
138764
138825
|
});
|
|
@@ -138807,7 +138868,7 @@ registerLanguage({
|
|
|
138807
138868
|
mimetypes: ["text/x-cshtml"],
|
|
138808
138869
|
loader: () => {
|
|
138809
138870
|
{
|
|
138810
|
-
return import("./razor-
|
|
138871
|
+
return import("./razor-34386182.js");
|
|
138811
138872
|
}
|
|
138812
138873
|
}
|
|
138813
138874
|
});
|
|
@@ -139143,7 +139204,7 @@ registerLanguage({
|
|
|
139143
139204
|
mimetypes: ["text/typescript"],
|
|
139144
139205
|
loader: () => {
|
|
139145
139206
|
{
|
|
139146
|
-
return import("./typescript-
|
|
139207
|
+
return import("./typescript-48be5bbc.js");
|
|
139147
139208
|
}
|
|
139148
139209
|
}
|
|
139149
139210
|
});
|
|
@@ -139227,7 +139288,7 @@ registerLanguage({
|
|
|
139227
139288
|
mimetypes: ["text/xml", "application/xml", "application/xaml+xml", "application/xml-dtd"],
|
|
139228
139289
|
loader: () => {
|
|
139229
139290
|
{
|
|
139230
|
-
return import("./xml-
|
|
139291
|
+
return import("./xml-1520dcee.js");
|
|
139231
139292
|
}
|
|
139232
139293
|
}
|
|
139233
139294
|
});
|
|
@@ -139244,7 +139305,7 @@ registerLanguage({
|
|
|
139244
139305
|
mimetypes: ["application/x-yaml", "text/x-yaml"],
|
|
139245
139306
|
loader: () => {
|
|
139246
139307
|
{
|
|
139247
|
-
return import("./yaml-
|
|
139308
|
+
return import("./yaml-b01c807c.js");
|
|
139248
139309
|
}
|
|
139249
139310
|
}
|
|
139250
139311
|
});
|
|
@@ -139368,7 +139429,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3(
|
|
|
139368
139429
|
monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
|
|
139369
139430
|
function getMode$3() {
|
|
139370
139431
|
{
|
|
139371
|
-
return import("./cssMode-
|
|
139432
|
+
return import("./cssMode-8a633359.js");
|
|
139372
139433
|
}
|
|
139373
139434
|
}
|
|
139374
139435
|
monaco_editor_core_exports$3.languages.onLanguage("less", () => {
|
|
@@ -139499,7 +139560,7 @@ monaco_editor_core_exports$2.languages.html = {
|
|
|
139499
139560
|
};
|
|
139500
139561
|
function getMode$2() {
|
|
139501
139562
|
{
|
|
139502
|
-
return import("./htmlMode-
|
|
139563
|
+
return import("./htmlMode-fed923b3.js");
|
|
139503
139564
|
}
|
|
139504
139565
|
}
|
|
139505
139566
|
function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
|
|
@@ -139597,7 +139658,7 @@ var getWorker = () => getMode$1().then((mode) => mode.getWorker());
|
|
|
139597
139658
|
monaco_editor_core_exports$1.languages.json = { jsonDefaults, getWorker };
|
|
139598
139659
|
function getMode$1() {
|
|
139599
139660
|
{
|
|
139600
|
-
return import("./jsonMode-
|
|
139661
|
+
return import("./jsonMode-92034391.js");
|
|
139601
139662
|
}
|
|
139602
139663
|
}
|
|
139603
139664
|
monaco_editor_core_exports$1.languages.register({
|
|
@@ -139873,7 +139934,7 @@ monaco_editor_core_exports.languages.typescript = {
|
|
|
139873
139934
|
};
|
|
139874
139935
|
function getMode() {
|
|
139875
139936
|
{
|
|
139876
|
-
return import("./tsMode-
|
|
139937
|
+
return import("./tsMode-67ddf297.js");
|
|
139877
139938
|
}
|
|
139878
139939
|
}
|
|
139879
139940
|
monaco_editor_core_exports.languages.onLanguage("typescript", () => {
|
|
@@ -190746,94 +190807,6 @@ const ThemeIcon = (props) => {
|
|
|
190746
190807
|
}
|
|
190747
190808
|
) });
|
|
190748
190809
|
};
|
|
190749
|
-
const defaultSchema = {
|
|
190750
|
-
componentName: "Root"
|
|
190751
|
-
};
|
|
190752
|
-
const emptyValue = { schema: void 0, config: void 0 };
|
|
190753
|
-
function useSchema(selectedContent) {
|
|
190754
|
-
const [schema, setSchema] = useState(emptyValue);
|
|
190755
|
-
const components = useFrontComponents();
|
|
190756
|
-
const pages = usePages();
|
|
190757
|
-
const componentsRef = useRef(components);
|
|
190758
|
-
const pagesRef = useRef(pages);
|
|
190759
|
-
componentsRef.current = components;
|
|
190760
|
-
pagesRef.current = pages;
|
|
190761
|
-
const templates = useTemplates();
|
|
190762
|
-
const templatesRef = useRef(templates);
|
|
190763
|
-
templatesRef.current = templates;
|
|
190764
|
-
useEffect(() => {
|
|
190765
|
-
var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i3, _j2;
|
|
190766
|
-
let code;
|
|
190767
|
-
let hasContent = false;
|
|
190768
|
-
let defaultConfig2;
|
|
190769
|
-
if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Component) {
|
|
190770
|
-
const component = (_a3 = componentsRef.current) == null ? void 0 : _a3.find(
|
|
190771
|
-
(component2) => component2.id === selectedContent.id
|
|
190772
|
-
);
|
|
190773
|
-
if (component) {
|
|
190774
|
-
code = component.code;
|
|
190775
|
-
hasContent = true;
|
|
190776
|
-
}
|
|
190777
|
-
} else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.PredefinedPage || (selectedContent == null ? void 0 : selectedContent.type) === ContentType.Page) {
|
|
190778
|
-
const page = (_b3 = pagesRef.current) == null ? void 0 : _b3.find(
|
|
190779
|
-
(item) => item.id === selectedContent.id
|
|
190780
|
-
);
|
|
190781
|
-
defaultConfig2 = {
|
|
190782
|
-
pageMeta: {
|
|
190783
|
-
seoTitle: (_c2 = page == null ? void 0 : page.meta) == null ? void 0 : _c2.seoTitle,
|
|
190784
|
-
seoDescription: (_d2 = page == null ? void 0 : page.meta) == null ? void 0 : _d2.seoDescription,
|
|
190785
|
-
seoKeywords: (_e2 = page == null ? void 0 : page.meta) == null ? void 0 : _e2.seoKeywords,
|
|
190786
|
-
ogTitle: (_f2 = page == null ? void 0 : page.meta) == null ? void 0 : _f2.ogTitle,
|
|
190787
|
-
ogDescription: (_g2 = page == null ? void 0 : page.meta) == null ? void 0 : _g2.ogDescription,
|
|
190788
|
-
ogType: (_h2 = page == null ? void 0 : page.meta) == null ? void 0 : _h2.ogType,
|
|
190789
|
-
ogImage: (_i3 = page == null ? void 0 : page.meta) == null ? void 0 : _i3.ogImage
|
|
190790
|
-
}
|
|
190791
|
-
};
|
|
190792
|
-
if (page) {
|
|
190793
|
-
code = page.code;
|
|
190794
|
-
hasContent = true;
|
|
190795
|
-
}
|
|
190796
|
-
} else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Template) {
|
|
190797
|
-
const template = (_j2 = templatesRef.current) == null ? void 0 : _j2.find(
|
|
190798
|
-
(template2) => template2.id === selectedContent.id
|
|
190799
|
-
);
|
|
190800
|
-
if (template) {
|
|
190801
|
-
code = template.code;
|
|
190802
|
-
hasContent = true;
|
|
190803
|
-
}
|
|
190804
|
-
}
|
|
190805
|
-
if (code) {
|
|
190806
|
-
transformCodeToSchema(code).then((value) => {
|
|
190807
|
-
setSchema({
|
|
190808
|
-
schema: { ...defaultSchema, children: (value == null ? void 0 : value.template) || [] },
|
|
190809
|
-
config: { ...defaultConfig2, ...value.resources }
|
|
190810
|
-
});
|
|
190811
|
-
});
|
|
190812
|
-
} else if (hasContent) {
|
|
190813
|
-
setSchema({
|
|
190814
|
-
schema: { ...defaultSchema, children: [] }
|
|
190815
|
-
});
|
|
190816
|
-
}
|
|
190817
|
-
}, [selectedContent == null ? void 0 : selectedContent.id, selectedContent == null ? void 0 : selectedContent.type]);
|
|
190818
|
-
console.log("===>schema", schema);
|
|
190819
|
-
return schema;
|
|
190820
|
-
}
|
|
190821
|
-
function useCloseDrawer() {
|
|
190822
|
-
const setDrawerType = useStudioStore((state) => state.setDrawerType);
|
|
190823
|
-
const drawerDocked = useStudioStore((state) => state.drawerDocked);
|
|
190824
|
-
const close = useCallback(() => {
|
|
190825
|
-
if (!drawerDocked) {
|
|
190826
|
-
setDrawerType(void 0);
|
|
190827
|
-
}
|
|
190828
|
-
}, [drawerDocked, setDrawerType]);
|
|
190829
|
-
return close;
|
|
190830
|
-
}
|
|
190831
|
-
function useIsBaseLangTheme() {
|
|
190832
|
-
var _a3, _b3;
|
|
190833
|
-
const theme = useStudioTheme();
|
|
190834
|
-
const website = useWebsite();
|
|
190835
|
-
return ((_a3 = theme == null ? void 0 : theme.lang) == null ? void 0 : _a3.id) === ((_b3 = website == null ? void 0 : website.baseLang) == null ? void 0 : _b3.id);
|
|
190836
|
-
}
|
|
190837
190810
|
function useImportTheme() {
|
|
190838
190811
|
const [isUploading, setIsUploading] = useState(false);
|
|
190839
190812
|
const [isImporting, setIsImporting] = useState(false);
|
|
@@ -203947,4 +203920,4 @@ export {
|
|
|
203947
203920
|
typescriptDefaults as t,
|
|
203948
203921
|
useCustomizedMaterials as u
|
|
203949
203922
|
};
|
|
203950
|
-
//# sourceMappingURL=index-
|
|
203923
|
+
//# sourceMappingURL=index-6ddf2099.js.map
|