@rxdrag/website-studio 0.0.59 → 0.0.61

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.
Files changed (48) hide show
  1. package/dist/components/LeftDrawer/ComponentsPanel/ComponentsRootNode.d.ts +1 -1
  2. package/dist/components/LeftDrawer/PagesPanel/PredefinedApis.d.ts +4 -0
  3. package/dist/components/LeftDrawer/PagesPanel/PredefinedPageCard.d.ts +2 -0
  4. package/dist/components/common/ComponentCategoryList/ComponentCategoryModal.d.ts +0 -1
  5. package/dist/components/common/ComponentCategoryList/ComponentCategoryNode.d.ts +0 -1
  6. package/dist/components/common/ComponentCategoryList/ComponentList.d.ts +0 -1
  7. package/dist/components/common/ComponentCategoryList/ComponentModal.d.ts +0 -1
  8. package/dist/components/common/ComponentCategoryList/index.d.ts +0 -1
  9. package/dist/components/common/ComponentCategoryListScope/index.d.ts +1 -2
  10. package/dist/components/common/ImportComponentModal/index.d.ts +1 -2
  11. package/dist/components/utils/ViewModeButtons.d.ts +1 -1
  12. package/dist/{cssMode-09f3d08a.js → cssMode-93f05de2.js} +4 -3
  13. package/dist/{cssMode-09f3d08a.js.map → cssMode-93f05de2.js.map} +1 -1
  14. package/dist/{freemarker2-e76b71c2.js → freemarker2-fd9b10d3.js} +4 -3
  15. package/dist/{freemarker2-e76b71c2.js.map → freemarker2-fd9b10d3.js.map} +1 -1
  16. package/dist/{handlebars-1e06e488.js → handlebars-f1ead386.js} +4 -3
  17. package/dist/{handlebars-1e06e488.js.map → handlebars-f1ead386.js.map} +1 -1
  18. package/dist/hooks/useSchema.d.ts +1 -0
  19. package/dist/{html-01a2c82d.js → html-9d030721.js} +4 -3
  20. package/dist/{html-01a2c82d.js.map → html-9d030721.js.map} +1 -1
  21. package/dist/{htmlMode-71fa2280.js → htmlMode-30d0de91.js} +4 -3
  22. package/dist/{htmlMode-71fa2280.js.map → htmlMode-30d0de91.js.map} +1 -1
  23. package/dist/{index-f5bad985.js → index-e4647972.js} +292 -393
  24. package/dist/{index-f5bad985.js.map → index-e4647972.js.map} +1 -1
  25. package/dist/index.mjs +3 -2
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/{javascript-31f976b5.js → javascript-327c666e.js} +5 -4
  28. package/dist/{javascript-31f976b5.js.map → javascript-327c666e.js.map} +1 -1
  29. package/dist/{jsonMode-0ac682a1.js → jsonMode-5c4ceeca.js} +4 -3
  30. package/dist/{jsonMode-0ac682a1.js.map → jsonMode-5c4ceeca.js.map} +1 -1
  31. package/dist/{liquid-cf497048.js → liquid-8243f0d7.js} +4 -3
  32. package/dist/{liquid-cf497048.js.map → liquid-8243f0d7.js.map} +1 -1
  33. package/dist/{mdx-8494287c.js → mdx-07e52606.js} +4 -3
  34. package/dist/{mdx-8494287c.js.map → mdx-07e52606.js.map} +1 -1
  35. package/dist/{python-7b6d405d.js → python-53510841.js} +4 -3
  36. package/dist/{python-7b6d405d.js.map → python-53510841.js.map} +1 -1
  37. package/dist/{razor-0a925e48.js → razor-58b7df65.js} +4 -3
  38. package/dist/{razor-0a925e48.js.map → razor-58b7df65.js.map} +1 -1
  39. package/dist/{tsMode-a79abe6c.js → tsMode-9d793b1d.js} +4 -3
  40. package/dist/{tsMode-a79abe6c.js.map → tsMode-9d793b1d.js.map} +1 -1
  41. package/dist/types.d.ts +2 -2
  42. package/dist/{typescript-6fed2f8c.js → typescript-20c35b0b.js} +4 -3
  43. package/dist/{typescript-6fed2f8c.js.map → typescript-20c35b0b.js.map} +1 -1
  44. package/dist/{xml-7fc2d3d8.js → xml-3f468811.js} +4 -3
  45. package/dist/{xml-7fc2d3d8.js.map → xml-3f468811.js.map} +1 -1
  46. package/dist/{yaml-e8730fef.js → yaml-699fe7d2.js} +4 -3
  47. package/dist/{yaml-e8730fef.js.map → yaml-699fe7d2.js.map} +1 -1
  48. package/package.json +16 -15
@@ -6,7 +6,7 @@ var __publicField = (obj, key2, value) => {
6
6
  };
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
- import React__default, { createContext, useMemo, useContext, useCallback, useEffect, memo, useState, useRef, forwardRef as forwardRef$2, Component, useImperativeHandle, isValidElement, cloneElement } from "react";
9
+ import React__default, { createContext, useContext, useMemo, useCallback, useEffect, memo, useState, useRef, forwardRef as forwardRef$2, Component, useImperativeHandle, isValidElement, cloneElement } from "react";
10
10
  import { ThemeBranchFields, PageQueryOptions, PageFields, FrontComponentQueryOptions, FrontComponentFields, MediaQueryOptions, ComponentCategoryFields, SectionTemplateQueryOptions, SectionTemplateFields, ComponentCategoryQueryOptions, TemplateCategoryQueryOptions, TemplateCategoryFields, ThemeBranchQueryOptions, StyleConfigFields, LangFields, ThemeConfigQueryOptions, ThemeConfigFields, ThemeFields, WebsiteQueryOptions, WebsiteFields, PageAssciations, TaskQueryOptions, TaskFields, AppModule, TaskStatus, PageType, websiteToInput, TaskType, LangQueryOptions, WebsiteAssciations, ExtendFieldType, ThemeConfigAssciations, WebsiteSettingsQueryOptions, WebsiteSettingsFields, themeConfigToInputCascade, ThemeConfigEntityName, MediaType, themeConfigToInput, websiteSettingsToInput, WebsiteSettingsEntityName, WebsiteSettingsAssciations, PageEntityName, ThemeBranchEntityName, themeBranchToInputCascade, ThemeQueryOptions, ThemeCategoryFields, FrontComponentEntityName, pageToInputCascade, sectionTemplateToInput, ProductCategoryEntityName, ProductCategoryQueryOptions, ProductCategoryFields, ProductQueryOptions, ProductFields, PublishableStatus, TaskEntityName, ComponentCategoryEntityName, themeBranchToInput, frontComponentToInput, SectionTemplateEntityName, pageToInput, PageMetaQueryOptions, PageMetaFields, PageMetaAssciations, FrontComponentAssciations, componentCategoryToInput } from "@rxdrag/rxcms-models";
11
11
  import { GlobalLoading, EntityForm, SubmitButton, useListData, SearchInput, EntityPagination, useIsLoading, QueryListScope, EntitySelect, useRemoveRow, useEditRow, EntityEditModal, useSelectionsState, EntityTable, EntityListScope, NewButton, EntityRowScope, EntitySelectField, useNewRow } from "@rxdrag/rxcms-models-ui";
12
12
  import { useOneThemeBranch, usePageList, useTemplateCategoryList, useSectionTemplateList, useComponentCategoryList, useFrontComponentList, useOneThemeBranchById, useTaskList, useUpsertOneWebsite, useDeleteThemeBranchById, useUpsertOneThemeBranch, useLangList, useOneWebsiteSettings, useOneThemeConfig, useUpsertOneThemeConfig, useUpsertOneWebsiteSettings, useUpsertOnePage, useUpsertOneSectionTemplate, useUpsertOneFrontComponent, useDeletePageById } from "@rxdrag/rxcms-model-hooks";
@@ -23,21 +23,22 @@ import { create as create$4 } from "zustand";
23
23
  import { Card, CardBody, Button as Button$2, CircularProgress, addToast, CardHeader, Select, SelectItem, Dropdown, DropdownTrigger, DropdownMenu as DropdownMenu$1, DropdownItem, Accordion, AccordionItem, Input, Tabs, Tab, Divider, cn, Checkbox, Chip, Skeleton, CardFooter, Image, useDisclosure, Modal as Modal$2, ModalContent as ModalContent$2, ModalHeader as ModalHeader$1, ModalBody as ModalBody$1, ModalFooter as ModalFooter$1, Tooltip, RadioGroup, Radio } from "@heroui/react";
24
24
  import { Icon } from "@iconify/react";
25
25
  import { useTranslateTheme, TaskManager, useSubscribeTaskEvents, useTranslateBuiltinPage, useTranslateCustomizedPages, useTranlateComponents, useUploadDeploymentFile, WebsiteAddonContext } from "@rxdrag/website-addon";
26
- import { InputField, TextareaField, toField, ColorField, SwitchField, SelectField, PasswordField, Form } from "@rxdrag/fieldy-heroui";
26
+ import { InputField, TextareaField, toField, ColorField, SwitchField, SelectField, PasswordField, Form, CheckboxField } from "@rxdrag/fieldy-heroui";
27
27
  import { ObjectField, useFormValue, useForm } from "@rxdrag/react-fieldy-pro";
28
28
  import "react-colorful";
29
29
  import { motion, AnimatePresence, LazyMotion, m } from "framer-motion";
30
30
  import ReactDOM, { createPortal } from "react-dom";
31
31
  import { keys } from "lodash-es";
32
- import { DeployType, useExportWebsite as useExportWebsite$1, useGenerateWebsiteFiles, traverseFiles as traverseFiles$1 } from "@rxdrag/code-generator";
32
+ import { DeployType, predefinedTypes, askForQuote } from "@rxdrag/code-templates";
33
33
  import { Designer, useDesignerEngine, useDocumentModified, useClearModified, useDocConfig, useDocumentCode, useViewMode, useGetDocSchemaTree, ViewMode, useRootNode, useActivedDocumentId, IFrameCanvasImpl, KeyboardDriver, DragDropDriver, DragOverDriver, MouseClickDriver, MouseMoveDriver, MouseOverOutDriver, CanvasResizeDriver, CanvasScrollDriver, MouseUpDriver, useDragStore, RelativePosition, AcceptType, useCurrentNode, useSelectedElementsRectsInIframe, useActivedElementRect, useActivedId, useTreeNode, useChangeNodeMeta, useNodeMeta, createNodeHandlerProps, useSelection, useBackup, useSetInsertTargetWithPosition, useComponentOperationStore, NodeRelativePosition, TabType, InsertMode, useGetNode, useNodeMove, useClone, useRemoveSelectedNodes, useSelectedNode, useSelectedParent, useSelectParent, MouseMoveEvent, useCodeModified, RXID_ATTR_NAME, useSchemaTree, useSetChildren, useSetDocConfig, useDeviceType, DeviceType, useHistory, useResourceNode, useCanAccept, useConfigModified, useCreateDocument, useRemoveDocument, ContainerImpl, DocumentRoot } from "@rxdrag/rxcraft";
34
34
  import { useAiAgent, AiWidget, AiAgentRoot } from "@rxdrag/ai-agent";
35
35
  import { useUpsertEntityWithIndicator } from "@rxdrag/rxcms-entify-wrapper";
36
36
  import dayjs from "dayjs";
37
- import { cn as cn$1, Tabs as Tabs$1, TabsList, TabsTrigger, TabsContent, Button as Button$3, Label as Label$1, Input as Input$1, AccordionTrigger, Accordion as Accordion$1, AccordionItem as AccordionItem$1, AccordionContent } from "@rxdrag/shadcn";
37
+ import { cn as cn$1, Tabs as Tabs$1, TabsList, TabsTrigger, TabsContent, Button as Button$3, Label as Label$1, Input as Input$1, AccordionTrigger, Accordion as Accordion$1, AccordionItem as AccordionItem$1, AccordionContent, DialogHeader, DialogTitle, DialogFooter, Dialog, DialogContent } from "@rxdrag/shadcn";
38
38
  import { isObj, isStr } from "@rxdrag/shared";
39
39
  import { TextNodeName, CommentNodeName } from "@rxdrag/schema-pro";
40
40
  import { emit, EVENT_ENTITY_POSTED } from "@rxdrag/entify-lib";
41
+ import { useExportWebsite as useExportWebsite$1, useGenerateWebsiteFiles, traverseFiles as traverseFiles$1 } from "@rxdrag/code-generator";
41
42
  const StudioContext = createContext({});
42
43
  function useAllFrontComponents() {
43
44
  var _a3;
@@ -58,15 +59,6 @@ function useSectionComponents() {
58
59
  return components == null ? void 0 : components.filter((item) => item.isSectionBlock);
59
60
  }, [components]);
60
61
  }
61
- function useFrontComponentsBySectionBlock(isSectionBlock) {
62
- var _a3;
63
- const components = (_a3 = React__default.useContext(StudioContext)) == null ? void 0 : _a3.components;
64
- return useMemo(() => {
65
- return components == null ? void 0 : components.filter(
66
- (item) => isSectionBlock ? item.isSectionBlock === isSectionBlock : !item.isSectionBlock
67
- );
68
- }, [components, isSectionBlock]);
69
- }
70
62
  function useAllComponents() {
71
63
  const { components, parentTheme } = React__default.useContext(StudioContext);
72
64
  return useMemo(() => {
@@ -103,16 +95,6 @@ function useAllComponentCategories() {
103
95
  const result = useContext(StudioContext).componentCategories;
104
96
  return result;
105
97
  }
106
- function useComponentCategoriesWithSectionBlock(isSectionBlock) {
107
- const result = useContext(StudioContext).componentCategories;
108
- return useMemo(() => {
109
- var _a3;
110
- const items = (_a3 = result == null ? void 0 : result.items) == null ? void 0 : _a3.filter(
111
- (item) => isSectionBlock ? item.isSectionBlock === isSectionBlock : !item.isSectionBlock
112
- );
113
- return { ...result, items };
114
- }, [result, isSectionBlock]);
115
- }
116
98
  function useSectionCategories() {
117
99
  const result = useContext(StudioContext).componentCategories;
118
100
  return useMemo(() => {
@@ -136382,7 +136364,7 @@ registerLanguage({
136382
136364
  aliases: ["FreeMarker2", "Apache FreeMarker2"],
136383
136365
  loader: () => {
136384
136366
  {
136385
- return import("./freemarker2-e76b71c2.js").then((m2) => m2.TagAutoInterpolationDollar);
136367
+ return import("./freemarker2-fd9b10d3.js").then((m2) => m2.TagAutoInterpolationDollar);
136386
136368
  }
136387
136369
  }
136388
136370
  });
@@ -136391,7 +136373,7 @@ registerLanguage({
136391
136373
  aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"],
136392
136374
  loader: () => {
136393
136375
  {
136394
- return import("./freemarker2-e76b71c2.js").then((m2) => m2.TagAngleInterpolationDollar);
136376
+ return import("./freemarker2-fd9b10d3.js").then((m2) => m2.TagAngleInterpolationDollar);
136395
136377
  }
136396
136378
  }
136397
136379
  });
@@ -136400,7 +136382,7 @@ registerLanguage({
136400
136382
  aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"],
136401
136383
  loader: () => {
136402
136384
  {
136403
- return import("./freemarker2-e76b71c2.js").then((m2) => m2.TagBracketInterpolationDollar);
136385
+ return import("./freemarker2-fd9b10d3.js").then((m2) => m2.TagBracketInterpolationDollar);
136404
136386
  }
136405
136387
  }
136406
136388
  });
@@ -136409,7 +136391,7 @@ registerLanguage({
136409
136391
  aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"],
136410
136392
  loader: () => {
136411
136393
  {
136412
- return import("./freemarker2-e76b71c2.js").then((m2) => m2.TagAngleInterpolationBracket);
136394
+ return import("./freemarker2-fd9b10d3.js").then((m2) => m2.TagAngleInterpolationBracket);
136413
136395
  }
136414
136396
  }
136415
136397
  });
@@ -136418,7 +136400,7 @@ registerLanguage({
136418
136400
  aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"],
136419
136401
  loader: () => {
136420
136402
  {
136421
- return import("./freemarker2-e76b71c2.js").then((m2) => m2.TagBracketInterpolationBracket);
136403
+ return import("./freemarker2-fd9b10d3.js").then((m2) => m2.TagBracketInterpolationBracket);
136422
136404
  }
136423
136405
  }
136424
136406
  });
@@ -136427,7 +136409,7 @@ registerLanguage({
136427
136409
  aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"],
136428
136410
  loader: () => {
136429
136411
  {
136430
- return import("./freemarker2-e76b71c2.js").then((m2) => m2.TagAutoInterpolationDollar);
136412
+ return import("./freemarker2-fd9b10d3.js").then((m2) => m2.TagAutoInterpolationDollar);
136431
136413
  }
136432
136414
  }
136433
136415
  });
@@ -136436,7 +136418,7 @@ registerLanguage({
136436
136418
  aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"],
136437
136419
  loader: () => {
136438
136420
  {
136439
- return import("./freemarker2-e76b71c2.js").then((m2) => m2.TagAutoInterpolationBracket);
136421
+ return import("./freemarker2-fd9b10d3.js").then((m2) => m2.TagAutoInterpolationBracket);
136440
136422
  }
136441
136423
  }
136442
136424
  });
@@ -136486,7 +136468,7 @@ registerLanguage({
136486
136468
  mimetypes: ["text/x-handlebars-template"],
136487
136469
  loader: () => {
136488
136470
  {
136489
- return import("./handlebars-1e06e488.js");
136471
+ return import("./handlebars-f1ead386.js");
136490
136472
  }
136491
136473
  }
136492
136474
  });
@@ -136519,7 +136501,7 @@ registerLanguage({
136519
136501
  mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
136520
136502
  loader: () => {
136521
136503
  {
136522
- return import("./html-01a2c82d.js");
136504
+ return import("./html-9d030721.js");
136523
136505
  }
136524
136506
  }
136525
136507
  });
@@ -136572,7 +136554,7 @@ registerLanguage({
136572
136554
  mimetypes: ["text/javascript"],
136573
136555
  loader: () => {
136574
136556
  {
136575
- return import("./javascript-31f976b5.js");
136557
+ return import("./javascript-327c666e.js");
136576
136558
  }
136577
136559
  }
136578
136560
  });
@@ -136671,7 +136653,7 @@ registerLanguage({
136671
136653
  mimetypes: ["application/liquid"],
136672
136654
  loader: () => {
136673
136655
  {
136674
- return import("./liquid-cf497048.js");
136656
+ return import("./liquid-8243f0d7.js");
136675
136657
  }
136676
136658
  }
136677
136659
  });
@@ -136719,7 +136701,7 @@ registerLanguage({
136719
136701
  aliases: ["MDX", "mdx"],
136720
136702
  loader: () => {
136721
136703
  {
136722
- return import("./mdx-8494287c.js");
136704
+ return import("./mdx-07e52606.js");
136723
136705
  }
136724
136706
  }
136725
136707
  });
@@ -136978,7 +136960,7 @@ registerLanguage({
136978
136960
  firstLine: "^#!/.*\\bpython[0-9.-]*\\b",
136979
136961
  loader: () => {
136980
136962
  {
136981
- return import("./python-7b6d405d.js");
136963
+ return import("./python-53510841.js");
136982
136964
  }
136983
136965
  }
136984
136966
  });
@@ -137027,7 +137009,7 @@ registerLanguage({
137027
137009
  mimetypes: ["text/x-cshtml"],
137028
137010
  loader: () => {
137029
137011
  {
137030
- return import("./razor-0a925e48.js");
137012
+ return import("./razor-58b7df65.js");
137031
137013
  }
137032
137014
  }
137033
137015
  });
@@ -137363,7 +137345,7 @@ registerLanguage({
137363
137345
  mimetypes: ["text/typescript"],
137364
137346
  loader: () => {
137365
137347
  {
137366
- return import("./typescript-6fed2f8c.js");
137348
+ return import("./typescript-20c35b0b.js");
137367
137349
  }
137368
137350
  }
137369
137351
  });
@@ -137447,7 +137429,7 @@ registerLanguage({
137447
137429
  mimetypes: ["text/xml", "application/xml", "application/xaml+xml", "application/xml-dtd"],
137448
137430
  loader: () => {
137449
137431
  {
137450
- return import("./xml-7fc2d3d8.js");
137432
+ return import("./xml-3f468811.js");
137451
137433
  }
137452
137434
  }
137453
137435
  });
@@ -137464,7 +137446,7 @@ registerLanguage({
137464
137446
  mimetypes: ["application/x-yaml", "text/x-yaml"],
137465
137447
  loader: () => {
137466
137448
  {
137467
- return import("./yaml-e8730fef.js");
137449
+ return import("./yaml-699fe7d2.js");
137468
137450
  }
137469
137451
  }
137470
137452
  });
@@ -137588,7 +137570,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3(
137588
137570
  monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
137589
137571
  function getMode$3() {
137590
137572
  {
137591
- return import("./cssMode-09f3d08a.js");
137573
+ return import("./cssMode-93f05de2.js");
137592
137574
  }
137593
137575
  }
137594
137576
  monaco_editor_core_exports$3.languages.onLanguage("less", () => {
@@ -137719,7 +137701,7 @@ monaco_editor_core_exports$2.languages.html = {
137719
137701
  };
137720
137702
  function getMode$2() {
137721
137703
  {
137722
- return import("./htmlMode-71fa2280.js");
137704
+ return import("./htmlMode-30d0de91.js");
137723
137705
  }
137724
137706
  }
137725
137707
  function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
@@ -137817,7 +137799,7 @@ var getWorker = () => getMode$1().then((mode) => mode.getWorker());
137817
137799
  monaco_editor_core_exports$1.languages.json = { jsonDefaults, getWorker };
137818
137800
  function getMode$1() {
137819
137801
  {
137820
- return import("./jsonMode-0ac682a1.js");
137802
+ return import("./jsonMode-5c4ceeca.js");
137821
137803
  }
137822
137804
  }
137823
137805
  monaco_editor_core_exports$1.languages.register({
@@ -138093,7 +138075,7 @@ monaco_editor_core_exports.languages.typescript = {
138093
138075
  };
138094
138076
  function getMode() {
138095
138077
  {
138096
- return import("./tsMode-a79abe6c.js");
138078
+ return import("./tsMode-9d793b1d.js");
138097
138079
  }
138098
138080
  }
138099
138081
  monaco_editor_core_exports.languages.onLanguage("typescript", () => {
@@ -188263,8 +188245,8 @@ CMS的网页跟组件的可视化编辑器,使用的是Astro代码作为dsl。
188263
188245
  var ContentType = /* @__PURE__ */ ((ContentType2) => {
188264
188246
  ContentType2["Page"] = "page";
188265
188247
  ContentType2["Component"] = "component";
188266
- ContentType2["PredefinedPage"] = "predefined-page";
188267
188248
  ContentType2["Template"] = "template";
188249
+ ContentType2["Api"] = "api";
188268
188250
  return ContentType2;
188269
188251
  })(ContentType || {});
188270
188252
  var DrawerConentType = /* @__PURE__ */ ((DrawerConentType2) => {
@@ -188444,7 +188426,7 @@ function PageSaveButton() {
188444
188426
  );
188445
188427
  }, [getSchemaTree, docConfig, page, viewMode, engine, save, docCode]);
188446
188428
  const disabled = !modified;
188447
- return page && ((selection == null ? void 0 : selection.type) === ContentType.Page || (selection == null ? void 0 : selection.type) === ContentType.PredefinedPage) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
188429
+ return page && ((selection == null ? void 0 : selection.type) === ContentType.Page || (selection == null ? void 0 : selection.type) === ContentType.Api) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
188448
188430
  Button$2,
188449
188431
  {
188450
188432
  size: "sm",
@@ -191619,7 +191601,8 @@ const defaultSchema = {
191619
191601
  const emptyValue = {
191620
191602
  code: "",
191621
191603
  schema: void 0,
191622
- config: void 0
191604
+ config: void 0,
191605
+ onlyCode: false
191623
191606
  };
191624
191607
  function useSchema(selectedContent) {
191625
191608
  const [content, setContent] = useState(emptyValue);
@@ -191633,10 +191616,11 @@ function useSchema(selectedContent) {
191633
191616
  const templatesRef = useRef(templates);
191634
191617
  templatesRef.current = templates;
191635
191618
  useEffect(() => {
191636
- var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i3, _j2;
191619
+ var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i3, _j2, _k2;
191637
191620
  let code;
191638
191621
  let hasContent = false;
191639
191622
  let defaultConfig2;
191623
+ let onlyCode = false;
191640
191624
  if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Component) {
191641
191625
  const component = (_a3 = componentsRef.current) == null ? void 0 : _a3.find(
191642
191626
  (component2) => component2.id === selectedContent.id
@@ -191645,7 +191629,7 @@ function useSchema(selectedContent) {
191645
191629
  code = component.code;
191646
191630
  hasContent = true;
191647
191631
  }
191648
- } else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.PredefinedPage || (selectedContent == null ? void 0 : selectedContent.type) === ContentType.Page) {
191632
+ } else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Page) {
191649
191633
  const page = (_b3 = pagesRef.current) == null ? void 0 : _b3.find(
191650
191634
  (item) => item.id === selectedContent.id
191651
191635
  );
@@ -191664,8 +191648,14 @@ function useSchema(selectedContent) {
191664
191648
  code = page.code;
191665
191649
  hasContent = true;
191666
191650
  }
191651
+ } else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Api) {
191652
+ onlyCode = true;
191653
+ const page = (_j2 = pagesRef.current) == null ? void 0 : _j2.find(
191654
+ (item) => item.id === selectedContent.id
191655
+ );
191656
+ code = page == null ? void 0 : page.code;
191667
191657
  } else if ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Template) {
191668
- const template = (_j2 = templatesRef.current) == null ? void 0 : _j2.find(
191658
+ const template = (_k2 = templatesRef.current) == null ? void 0 : _k2.find(
191669
191659
  (template2) => template2.id === selectedContent.id
191670
191660
  );
191671
191661
  if (template) {
@@ -191673,7 +191663,13 @@ function useSchema(selectedContent) {
191673
191663
  hasContent = true;
191674
191664
  }
191675
191665
  }
191676
- if (code) {
191666
+ if (onlyCode) {
191667
+ setContent({
191668
+ code: code || "",
191669
+ schema: { ...defaultSchema, children: [] },
191670
+ onlyCode: true
191671
+ });
191672
+ } else if (code) {
191677
191673
  transformCodeToSchema(code).then((value) => {
191678
191674
  setContent({
191679
191675
  schema: { ...defaultSchema, children: (value == null ? void 0 : value.template) || [] },
@@ -191956,7 +191952,7 @@ function StatusBar({ docId }) {
191956
191952
  className: "w-full text-default-500 flex items-center justify-between",
191957
191953
  children: [
191958
191954
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
191959
- selectedContent && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
191955
+ selectedContent && (selectedContent == null ? void 0 : selectedContent.type) !== ContentType.Api && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
191960
191956
  Button$2,
191961
191957
  {
191962
191958
  size: "sm",
@@ -198580,6 +198576,9 @@ function ViewModeButtons() {
198580
198576
  setChildren
198581
198577
  ]
198582
198578
  );
198579
+ if ((page == null ? void 0 : page.pageType) === PageType.AskForQuote || (page == null ? void 0 : page.pageType) === PageType.CustomizedApi) {
198580
+ return null;
198581
+ }
198583
198582
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
198584
198583
  /* @__PURE__ */ jsxRuntimeExports.jsx(
198585
198584
  CanvasToolbarButton,
@@ -200242,7 +200241,6 @@ const ThemeToolbar = memo(() => {
200242
200241
  /* @__PURE__ */ jsxRuntimeExports.jsx(RedoUndo, {}),
200243
200242
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex gap-1 pr-4 items-center justify-end"), children: [
200244
200243
  /* @__PURE__ */ jsxRuntimeExports.jsx(ViewModeButtons, {}),
200245
- /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { orientation: "vertical", className: "h-5" }),
200246
200244
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button$2, { size: "sm", variant: "bordered", onPress: handleToMockWebsite, children: "主题数据" }),
200247
200245
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "save-action" }),
200248
200246
  /* @__PURE__ */ jsxRuntimeExports.jsx(MoreActions$1, {})
@@ -202674,7 +202672,7 @@ function useResetPage() {
202674
202672
  return resetPage;
202675
202673
  }
202676
202674
  function PredefinedPageCard(props) {
202677
- const { pages, pageType } = props;
202675
+ const { pages, defaultCode, pageType, isApi } = props;
202678
202676
  const [resetting, setResetting] = useState(false);
202679
202677
  const [confirmTitle, setConfirmTitle] = useState(
202680
202678
  void 0
@@ -202696,8 +202694,8 @@ function PredefinedPageCard(props) {
202696
202694
  const resetPage = useResetPage();
202697
202695
  const queryPage = useLazyQueryOneEntity();
202698
202696
  const translatePage = useTranslateBuiltinPage();
202699
- const confirmResolveRef = useRef();
202700
- const selected = (selectedContent == null ? void 0 : selectedContent.type) === ContentType.PredefinedPage && (selectedContent == null ? void 0 : selectedContent.id) === (page == null ? void 0 : page.id);
202697
+ const confirmResolveRef = useRef(void 0);
202698
+ const selected = ((selectedContent == null ? void 0 : selectedContent.type) === ContentType.Page || (selectedContent == null ? void 0 : selectedContent.type) === ContentType.Api) && (selectedContent == null ? void 0 : selectedContent.id) === (page == null ? void 0 : page.id);
202701
202699
  const [remove, { isMutating: removing }] = useDeletePageById();
202702
202700
  const website = useWebsite();
202703
202701
  const [save, { isMutating }] = useUpsertOnePage({
@@ -202709,14 +202707,15 @@ function PredefinedPageCard(props) {
202709
202707
  save({
202710
202708
  theme: { sync: { id: theme == null ? void 0 : theme.id } },
202711
202709
  pageType: pageType == null ? void 0 : pageType.pageType,
202712
- title: pageType == null ? void 0 : pageType.title
202710
+ title: pageType == null ? void 0 : pageType.title,
202711
+ code: defaultCode
202713
202712
  });
202714
202713
  };
202715
202714
  const handleDesign = useCallback(() => {
202716
202715
  if (!selected && (page == null ? void 0 : page.id)) {
202717
202716
  setEditingPage(page);
202718
202717
  setSelectedContent({
202719
- type: ContentType.PredefinedPage,
202718
+ type: isApi ? ContentType.Api : ContentType.Page,
202720
202719
  id: page == null ? void 0 : page.id,
202721
202720
  breadcrumbs: ["预定义页面", (pageType == null ? void 0 : pageType.title) || ""]
202722
202721
  });
@@ -202728,6 +202727,7 @@ function PredefinedPageCard(props) {
202728
202727
  page,
202729
202728
  setEditingPage,
202730
202729
  setSelectedContent,
202730
+ isApi,
202731
202731
  pageType == null ? void 0 : pageType.title,
202732
202732
  closeDrawer
202733
202733
  ]);
@@ -202959,68 +202959,9 @@ function PredefinedPageCard(props) {
202959
202959
  )
202960
202960
  ] });
202961
202961
  }
202962
- const predefinedTypes = [
202963
- {
202964
- title: "首页",
202965
- pageType: PageType.Home
202966
- },
202967
- {
202968
- title: "文章页",
202969
- pageType: PageType.Post
202970
- },
202971
- {
202972
- title: "产品页",
202973
- pageType: PageType.Product
202974
- },
202975
- //TODO 暂时不支持文章分类
202976
- // {
202977
- // title: "文章分类页",
202978
- // pageType: PageType.PostCategory,
202979
- // },
202980
- {
202981
- title: "文章列表页",
202982
- pageType: PageType.PostList
202983
- },
202984
- //TODO: 产品分类跟产品列表用一也就行
202985
- {
202986
- title: "产品分类页",
202987
- pageType: PageType.ProductCategory
202988
- },
202989
- {
202990
- title: "产品列表页",
202991
- pageType: PageType.ProductList
202992
- },
202993
- {
202994
- title: "搜索页",
202995
- pageType: PageType.SearchList
202996
- },
202997
- {
202998
- title: "个人简介页",
202999
- pageType: PageType.Profile
203000
- },
203001
- {
203002
- title: "感谢页面",
203003
- pageType: PageType.Thanks
203004
- },
203005
- {
203006
- title: "404页面",
203007
- pageType: PageType.Page404
203008
- },
203009
- {
203010
- title: "错误页面",
203011
- pageType: PageType.PageError
203012
- }
203013
- ];
203014
202962
  function PredefinedPages(props) {
203015
202963
  const { pages } = props;
203016
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: predefinedTypes.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
203017
- PredefinedPageCard,
203018
- {
203019
- pages,
203020
- pageType: item
203021
- },
203022
- item.pageType
203023
- )) });
202964
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: predefinedTypes.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(PredefinedPageCard, { pages, pageType: item }, item.pageType)) });
203024
202965
  }
203025
202966
  function PageModal(props) {
203026
202967
  const { themeId, onFilter, ...rest } = props;
@@ -203145,7 +203086,7 @@ function PagesModalContent(props) {
203145
203086
  const tranlatePages = useTranslateCustomizedPages();
203146
203087
  const data = useListData();
203147
203088
  const [selection, setSelections] = useSelectionsState() || [];
203148
- const confirmResolveRef = useRef();
203089
+ const confirmResolveRef = useRef(void 0);
203149
203090
  useEffect(() => {
203150
203091
  var _a4;
203151
203092
  setPagesToImport(
@@ -203239,13 +203180,9 @@ function PagesModalContent(props) {
203239
203180
  confirmResolveRef.current = void 0;
203240
203181
  }
203241
203182
  }, []);
203242
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
203243
- /* @__PURE__ */ jsxRuntimeExports.jsxs(ModalHeader, { className: "pr-2", children: [
203244
- "导入页面",
203245
- /* @__PURE__ */ jsxRuntimeExports.jsx(ModalClose, {})
203246
- ] }),
203247
- /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}),
203248
- /* @__PURE__ */ jsxRuntimeExports.jsx(ModalBody, { className: "flex-1 overflow-y-auto min-h-0 p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
203183
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full overflow-hidden", children: [
203184
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DialogHeader, { className: "px-6 py-4 border-b", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "导入页面" }) }),
203185
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto min-h-0 p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
203249
203186
  EntityTable,
203250
203187
  {
203251
203188
  "aria-label": "文章列表",
@@ -203260,28 +203197,28 @@ function PagesModalContent(props) {
203260
203197
  ] })
203261
203198
  }
203262
203199
  ) }),
203263
- /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}),
203264
- /* @__PURE__ */ jsxRuntimeExports.jsxs(ModalFooter, { className: "justify-between", children: [
203265
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-500 flex items-center gap-2" }),
203266
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [
203200
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogFooter, { className: "px-6 py-4 border-t justify-between", children: [
203201
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground flex items-center gap-2" }),
203202
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
203267
203203
  /* @__PURE__ */ jsxRuntimeExports.jsx(
203268
- Button$2,
203204
+ Button$3,
203269
203205
  {
203270
- variant: "light",
203271
- className: "text-default-500",
203272
- onPress: onClose,
203206
+ type: "button",
203207
+ variant: "outline",
203208
+ onClick: onClose,
203273
203209
  children: "关闭"
203274
203210
  }
203275
203211
  ),
203276
- /* @__PURE__ */ jsxRuntimeExports.jsx(
203277
- Button$2,
203212
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
203213
+ Button$3,
203278
203214
  {
203279
- variant: "solid",
203280
- color: "primary",
203281
- onPress: handleImport,
203282
- isLoading: importing,
203283
- isDisabled: !(selection == null ? void 0 : selection.length),
203284
- children: "导入"
203215
+ type: "button",
203216
+ disabled: importing || !(selection == null ? void 0 : selection.length),
203217
+ onClick: handleImport,
203218
+ children: [
203219
+ importing && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2", children: "⏳" }),
203220
+ "导入"
203221
+ ]
203285
203222
  }
203286
203223
  )
203287
203224
  ] })
@@ -203352,24 +203289,30 @@ function ImportPageModal({ open, onClose }) {
203352
203289
  orderBy
203353
203290
  }).setNoQuery(!(parentTheme == null ? void 0 : parentTheme.id));
203354
203291
  }, [baseThemeId, isBaseLangTheme, parentTheme == null ? void 0 : parentTheme.id]);
203355
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1, { isOpen: open, onClose, children: [
203356
- /* @__PURE__ */ jsxRuntimeExports.jsx(ModalOverlay$1, { className: "z-20" }),
203357
- /* @__PURE__ */ jsxRuntimeExports.jsx(
203358
- QueryListScope,
203359
- {
203360
- defaultPageSize: 20,
203361
- options: queryOptions,
203362
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
203363
- ModalContent$1,
203364
- {
203365
- className: "h-[80vh] max-h-[560px] shadow-lg z-20",
203366
- width: 620,
203367
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(PagesModalContent, { onClose })
203368
- }
203369
- )
203370
- }
203371
- )
203372
- ] });
203292
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Dialog, { open, onOpenChange: (isOpen) => !isOpen && onClose(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
203293
+ QueryListScope,
203294
+ {
203295
+ defaultPageSize: 20,
203296
+ options: queryOptions,
203297
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { className: "max-w-[620px] h-[80vh] max-h-[560px] p-0 gap-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PagesModalContent, { onClose }) })
203298
+ }
203299
+ ) });
203300
+ }
203301
+ function PredefinedApis(props) {
203302
+ const { pages } = props;
203303
+ const defaultCode = useMemo(() => askForQuote.content, []);
203304
+ const item = predefinedTypes.find(
203305
+ (item2) => item2.pageType === PageType.AskForQuote
203306
+ );
203307
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
203308
+ PredefinedPageCard,
203309
+ {
203310
+ isApi: true,
203311
+ pages,
203312
+ pageType: item,
203313
+ defaultCode
203314
+ }
203315
+ );
203373
203316
  }
203374
203317
  function PagesPanel(props) {
203375
203318
  var _a3;
@@ -203416,8 +203359,8 @@ function PagesPanel(props) {
203416
203359
  ] }),
203417
203360
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500 italic mb-2 mt-2", children: "默认页面" }),
203418
203361
  /* @__PURE__ */ jsxRuntimeExports.jsx(PredefinedPages, { pages: pages || [] }),
203419
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500 italic mb-2 mt-2", children: "自定义接口" }),
203420
203362
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500 italic mb-2 mt-2", children: "默认接口" }),
203363
+ /* @__PURE__ */ jsxRuntimeExports.jsx(PredefinedApis, { pages: pages || [] }),
203421
203364
  /* @__PURE__ */ jsxRuntimeExports.jsx(
203422
203365
  ImportPageModal,
203423
203366
  {
@@ -203598,20 +203541,20 @@ function LeftDrawerPannels() {
203598
203541
  ] });
203599
203542
  }
203600
203543
  function ComponentModal(props) {
203601
- const { isSectionBlock, themeId, categoryId, noCagegory, onFilter, ...rest } = props;
203544
+ const { themeId, categoryId, noCagegory, onFilter, ...rest } = props;
203602
203545
  const webSite = useWebsite();
203603
203546
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
203604
203547
  EntityEditModal,
203605
203548
  {
203606
203549
  entityName: FrontComponentEntityName,
203607
203550
  entityLabel: "自定义组件",
203608
- size: "2xl",
203609
203551
  initialValue: {
203610
- isSectionBlock,
203611
203552
  theme: { id: themeId },
203612
203553
  category: { id: categoryId }
203613
203554
  },
203614
- zIndexCls: "z-[1000]",
203555
+ classNames: {
203556
+ content: "sm:max-w-[800px]"
203557
+ },
203615
203558
  entityToInput: frontComponentToInput,
203616
203559
  onFilter,
203617
203560
  ...rest,
@@ -203621,6 +203564,7 @@ function ComponentModal(props) {
203621
203564
  {
203622
203565
  name: "name",
203623
203566
  label: "名称",
203567
+ autoFocus: true,
203624
203568
  validateSchema: {
203625
203569
  type: "string",
203626
203570
  required: true
@@ -203632,7 +203576,6 @@ function ComponentModal(props) {
203632
203576
  /* @__PURE__ */ jsxRuntimeExports.jsx(
203633
203577
  InputField,
203634
203578
  {
203635
- autoFocus: true,
203636
203579
  name: "title",
203637
203580
  label: "标题",
203638
203581
  validateSchema: {
@@ -203653,7 +203596,7 @@ function ComponentModal(props) {
203653
203596
  classNames: {
203654
203597
  label: "text-sm",
203655
203598
  base: "flex-col gap-1",
203656
- shower: "w-[600px] h-[400px]"
203599
+ shower: "w-[300px] h-[200px]"
203657
203600
  },
203658
203601
  mediaTypes: [MediaType.image]
203659
203602
  }
@@ -203697,7 +203640,8 @@ function ComponentModal(props) {
203697
203640
  labelPlacement: "outside",
203698
203641
  placeholder: "请输入顺序"
203699
203642
  }
203700
- )
203643
+ ),
203644
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxField, { label: "区块", name: "isSectionBlock", children: "是区块" })
203701
203645
  ] })
203702
203646
  }
203703
203647
  );
@@ -203801,7 +203745,6 @@ function ComponentList(props) {
203801
203745
  const {
203802
203746
  themeId,
203803
203747
  readonly,
203804
- isSectionBlock,
203805
203748
  list: list2,
203806
203749
  category,
203807
203750
  newComponent,
@@ -203831,7 +203774,6 @@ function ComponentList(props) {
203831
203774
  !readonly && /* @__PURE__ */ jsxRuntimeExports.jsx(
203832
203775
  ComponentModal,
203833
203776
  {
203834
- isSectionBlock,
203835
203777
  themeId,
203836
203778
  value: newComponent,
203837
203779
  noCagegory,
@@ -203846,14 +203788,7 @@ function ComponentList(props) {
203846
203788
  const ComponentCategoryNode = memo(
203847
203789
  (props) => {
203848
203790
  var _a3;
203849
- const {
203850
- isSectionBlock,
203851
- category,
203852
- themeId,
203853
- readonly,
203854
- selectedId,
203855
- onSelect
203856
- } = props;
203791
+ const { category, themeId, readonly, selectedId, onSelect } = props;
203857
203792
  const [open, setOpen] = React__default.useState(false);
203858
203793
  const website = useWebsite();
203859
203794
  const [remove, { isMutating }] = useRemoveRow({
@@ -203863,7 +203798,7 @@ const ComponentCategoryNode = memo(
203863
203798
  });
203864
203799
  const [newComponent, setNewComponent] = React__default.useState();
203865
203800
  const edit = useEditRow();
203866
- const components = useFrontComponentsBySectionBlock(isSectionBlock);
203801
+ const components = useAllFrontComponents();
203867
203802
  const componentsInCategory = useMemo(
203868
203803
  () => components == null ? void 0 : components.filter((item) => {
203869
203804
  var _a4;
@@ -203877,11 +203812,10 @@ const ComponentCategoryNode = memo(
203877
203812
  const handleNewComponent = React__default.useCallback(() => {
203878
203813
  setNewComponent({
203879
203814
  category: { id: category.id },
203880
- theme: { id: themeId },
203881
- isSectionBlock
203815
+ theme: { id: themeId }
203882
203816
  });
203883
203817
  setOpen(false);
203884
- }, [category.id, themeId, isSectionBlock]);
203818
+ }, [category.id, themeId]);
203885
203819
  const handleEdit = React__default.useCallback(() => {
203886
203820
  edit();
203887
203821
  setOpen(false);
@@ -203960,7 +203894,6 @@ const ComponentCategoryNode = memo(
203960
203894
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
203961
203895
  ComponentList,
203962
203896
  {
203963
- isSectionBlock,
203964
203897
  category,
203965
203898
  themeId,
203966
203899
  readonly,
@@ -203977,7 +203910,7 @@ const ComponentCategoryNode = memo(
203977
203910
  );
203978
203911
  function ComponentCategoryList(props) {
203979
203912
  var _a3;
203980
- const { readonly, selectedId, onSelect, isSectionBlock } = props;
203913
+ const { readonly, selectedId, onSelect } = props;
203981
203914
  const data = useListData();
203982
203915
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (_a3 = data == null ? void 0 : data.items) == null ? void 0 : _a3.map((item) => {
203983
203916
  var _a4, _b3;
@@ -203988,15 +203921,14 @@ function ComponentCategoryList(props) {
203988
203921
  themeId: (_b3 = item.theme) == null ? void 0 : _b3.id,
203989
203922
  readonly,
203990
203923
  selectedId,
203991
- isSectionBlock,
203992
203924
  onSelect: (id) => onSelect == null ? void 0 : onSelect(id, [item.name || ""])
203993
203925
  }
203994
203926
  ) }, item.id);
203995
203927
  }) });
203996
203928
  }
203997
203929
  function ComponentCategoryListScope(props) {
203998
- const { children, isSectionBlock } = props;
203999
- const componentCategories = useComponentCategoriesWithSectionBlock(isSectionBlock);
203930
+ const { children } = props;
203931
+ const componentCategories = useAllComponentCategories();
204000
203932
  return componentCategories && /* @__PURE__ */ jsxRuntimeExports.jsx(
204001
203933
  EntityListScope,
204002
203934
  {
@@ -204007,15 +203939,14 @@ function ComponentCategoryListScope(props) {
204007
203939
  );
204008
203940
  }
204009
203941
  function ComponentCategoryModal(props) {
204010
- const { themeId, onClose, isSectionBlock } = props;
203942
+ const { themeId, onClose } = props;
204011
203943
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
204012
203944
  EntityEditModal,
204013
203945
  {
204014
203946
  entityName: ComponentCategoryEntityName,
204015
203947
  entityLabel: "组件分类",
204016
203948
  initialValue: {
204017
- theme: { id: themeId },
204018
- isSectionBlock
203949
+ theme: { id: themeId }
204019
203950
  },
204020
203951
  entityToInput: componentCategoryToInput,
204021
203952
  onClose,
@@ -204200,7 +204131,6 @@ function useComponentsImportTask() {
204200
204131
  };
204201
204132
  }
204202
204133
  function ImportComponentModal({
204203
- isSectionBlock,
204204
204134
  open,
204205
204135
  onClose
204206
204136
  }) {
@@ -204237,31 +204167,15 @@ function ImportComponentModal({
204237
204167
  )
204238
204168
  );
204239
204169
  const categories = useMemo(() => {
204240
- var _a4, _b3;
204241
- return !isBaseTheme ? ((_a4 = baseTheme == null ? void 0 : baseTheme.componentCategories) == null ? void 0 : _a4.filter(
204242
- (category) => category.isSectionBlock ? category.isSectionBlock === isSectionBlock : !category.isSectionBlock
204243
- )) || [] : ((_b3 = parentTheme == null ? void 0 : parentTheme.componentCategories) == null ? void 0 : _b3.filter(
204244
- (category) => category.isSectionBlock ? category.isSectionBlock === isSectionBlock : !category.isSectionBlock
204245
- )) || [];
204170
+ return !isBaseTheme ? (baseTheme == null ? void 0 : baseTheme.componentCategories) || [] : (parentTheme == null ? void 0 : parentTheme.componentCategories) || [];
204246
204171
  }, [
204247
204172
  isBaseTheme,
204248
204173
  baseTheme == null ? void 0 : baseTheme.componentCategories,
204249
- parentTheme == null ? void 0 : parentTheme.componentCategories,
204250
- isSectionBlock
204174
+ parentTheme == null ? void 0 : parentTheme.componentCategories
204251
204175
  ]);
204252
204176
  const components = useMemo(() => {
204253
- var _a4, _b3;
204254
- return !isBaseTheme ? ((_a4 = baseTheme == null ? void 0 : baseTheme.components) == null ? void 0 : _a4.filter(
204255
- (component) => component.isSectionBlock ? component.isSectionBlock === isSectionBlock : !component.isSectionBlock
204256
- )) || [] : ((_b3 = parentTheme == null ? void 0 : parentTheme.components) == null ? void 0 : _b3.filter(
204257
- (component) => component.isSectionBlock ? component.isSectionBlock === isSectionBlock : !component.isSectionBlock
204258
- )) || [];
204259
- }, [
204260
- isBaseTheme,
204261
- baseTheme == null ? void 0 : baseTheme.components,
204262
- parentTheme == null ? void 0 : parentTheme.components,
204263
- isSectionBlock
204264
- ]);
204177
+ return !isBaseTheme ? (baseTheme == null ? void 0 : baseTheme.components) || [] : (parentTheme == null ? void 0 : parentTheme.components) || [];
204178
+ }, [isBaseTheme, baseTheme == null ? void 0 : baseTheme.components, parentTheme == null ? void 0 : parentTheme.components]);
204265
204179
  const noCategoryComponents = useMemo(() => {
204266
204180
  return components.filter((component) => {
204267
204181
  var _a4;
@@ -204338,40 +204252,45 @@ function ImportComponentModal({
204338
204252
  themeComs,
204339
204253
  translateComponents
204340
204254
  ]);
204341
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1, { isOpen: open, onClose, children: [
204342
- /* @__PURE__ */ jsxRuntimeExports.jsx(ModalOverlay$1, { className: "z-10" }),
204343
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
204344
- ModalContent$1,
204345
- {
204346
- className: "h-[80vh] shadow-lg border border-divider z-10",
204347
- width: 600,
204348
- children: [
204349
- /* @__PURE__ */ jsxRuntimeExports.jsxs(ModalHeader, { className: "pr-3", children: [
204350
- isSectionBlock ? "转入区块" : "转入组件",
204351
- /* @__PURE__ */ jsxRuntimeExports.jsx(ModalClose, {})
204352
- ] }),
204353
- /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}),
204354
- /* @__PURE__ */ jsxRuntimeExports.jsx(ModalBody, { className: "flex-1 overflow-y-auto min-h-0 p-2", children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentsSkeletons, {}) : /* @__PURE__ */ jsxRuntimeExports.jsxs(TreeView, { children: [
204355
- categories == null ? void 0 : categories.map((category) => /* @__PURE__ */ jsxRuntimeExports.jsx(GroupNode, { title: category.name, icon: false, children: components.filter(
204356
- (component) => {
204357
- var _a4;
204358
- return ((_a4 = component.category) == null ? void 0 : _a4.id) === category.id;
204359
- }
204360
- ).map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(
204361
- LeafNode,
204255
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
204256
+ Dialog,
204257
+ {
204258
+ open,
204259
+ onOpenChange: (isOpen) => !isOpen && onClose(),
204260
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogContent, { className: "max-w-[600px] h-[80vh] p-0 gap-0", children: [
204261
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full overflow-hidden", children: [
204262
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DialogHeader, { className: "px-6 py-4 border-b", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "转入组件" }) }),
204263
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto min-h-0 p-2", children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentsSkeletons, {}) : /* @__PURE__ */ jsxRuntimeExports.jsxs(TreeView, { children: [
204264
+ categories == null ? void 0 : categories.map((category) => /* @__PURE__ */ jsxRuntimeExports.jsx(
204265
+ GroupNode,
204362
204266
  {
204363
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(
204364
- Checkbox,
204365
- {
204366
- isSelected: selection.includes(component.id || ""),
204367
- onValueChange: () => handleToggleSelect(component.id || "")
204267
+ title: category.name,
204268
+ icon: false,
204269
+ children: components.filter(
204270
+ (component) => {
204271
+ var _a4;
204272
+ return ((_a4 = component.category) == null ? void 0 : _a4.id) === category.id;
204368
204273
  }
204369
- ),
204370
- onClick: () => handleToggleSelect(component.id || ""),
204371
- children: component.title || component.name
204274
+ ).map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(
204275
+ LeafNode,
204276
+ {
204277
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(
204278
+ Checkbox,
204279
+ {
204280
+ isSelected: selection.includes(
204281
+ component.id || ""
204282
+ ),
204283
+ onValueChange: () => handleToggleSelect(component.id || "")
204284
+ }
204285
+ ),
204286
+ onClick: () => handleToggleSelect(component.id || ""),
204287
+ children: component.title || component.name
204288
+ },
204289
+ component.id
204290
+ ))
204372
204291
  },
204373
- component.id
204374
- )) }, category.id)),
204292
+ category.id
204293
+ )),
204375
204294
  noCategoryComponents.map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(
204376
204295
  LeafNode,
204377
204296
  {
@@ -204388,51 +204307,46 @@ function ImportComponentModal({
204388
204307
  component.id
204389
204308
  ))
204390
204309
  ] }) }),
204391
- /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}),
204392
- /* @__PURE__ */ jsxRuntimeExports.jsxs(ModalFooter, { className: "justify-between", children: [
204393
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-500 flex items-center gap-2" }),
204310
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogFooter, { className: "px-6 py-4 border-t justify-between", children: [
204311
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground flex items-center gap-2" }),
204394
204312
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
204395
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button$2, { variant: "light", onPress: onClose, children: "关闭" }),
204396
- /* @__PURE__ */ jsxRuntimeExports.jsx(
204397
- Button$2,
204313
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$3, { type: "button", variant: "outline", onClick: onClose, children: "关闭" }),
204314
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
204315
+ Button$3,
204398
204316
  {
204399
- variant: "solid",
204400
- color: "primary",
204401
- onPress: handleImport,
204402
- isLoading: loading,
204403
- children: "转入"
204317
+ type: "button",
204318
+ disabled: loading,
204319
+ onClick: handleImport,
204320
+ children: [
204321
+ loading && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2", children: "" }),
204322
+ "转入"
204323
+ ]
204404
204324
  }
204405
204325
  )
204406
204326
  ] })
204407
- ] }),
204408
- /* @__PURE__ */ jsxRuntimeExports.jsx(
204409
- ConfirmDialog,
204410
- {
204411
- open: !!confirmTitle,
204412
- onClose: () => {
204413
- setConfirmTitle(void 0);
204414
- if (confirmResolveRef.current) {
204415
- confirmResolveRef.current(false);
204416
- confirmResolveRef.current = void 0;
204417
- }
204418
- },
204419
- onConfirm: handleConfirm,
204420
- confirm: confirmTitle
204421
- }
204422
- )
204423
- ]
204424
- }
204425
- )
204426
- ] });
204327
+ ] })
204328
+ ] }),
204329
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
204330
+ ConfirmDialog,
204331
+ {
204332
+ open: !!confirmTitle,
204333
+ onClose: () => {
204334
+ setConfirmTitle(void 0);
204335
+ if (confirmResolveRef.current) {
204336
+ confirmResolveRef.current(false);
204337
+ confirmResolveRef.current = void 0;
204338
+ }
204339
+ },
204340
+ onConfirm: handleConfirm,
204341
+ confirm: confirmTitle
204342
+ }
204343
+ )
204344
+ ] })
204345
+ }
204346
+ );
204427
204347
  }
204428
204348
  function ComponentsRootNode(props) {
204429
- const {
204430
- themeId,
204431
- readonly,
204432
- selectedContent,
204433
- onSelectContent,
204434
- isSectionBlock
204435
- } = props;
204349
+ const { themeId, readonly, selectedContent, onSelectContent, isTheme } = props;
204436
204350
  const [open, setOpen] = React__default.useState(false);
204437
204351
  const [comModalOpen, setComModalOpen] = React__default.useState(false);
204438
204352
  const [newComponent, setNewComponent] = React__default.useState();
@@ -204442,7 +204356,7 @@ function ComponentsRootNode(props) {
204442
204356
  );
204443
204357
  const website = useWebsite();
204444
204358
  const handleNewCagegory = useNewRow();
204445
- const components = useFrontComponentsBySectionBlock(isSectionBlock);
204359
+ const components = useAllFrontComponents();
204446
204360
  const comsNoCategory = useMemo(
204447
204361
  () => components == null ? void 0 : components.filter((item) => {
204448
204362
  var _a3;
@@ -204452,10 +204366,9 @@ function ComponentsRootNode(props) {
204452
204366
  );
204453
204367
  const handleNewComponent = React__default.useCallback(() => {
204454
204368
  setNewComponent({
204455
- theme: { id: themeId },
204456
- isSectionBlock
204369
+ theme: { id: themeId }
204457
204370
  });
204458
- }, [themeId, isSectionBlock]);
204371
+ }, [themeId]);
204459
204372
  const handleOpenChange = React__default.useCallback((open2) => {
204460
204373
  setOpen(open2);
204461
204374
  }, []);
@@ -204475,21 +204388,17 @@ function ComponentsRootNode(props) {
204475
204388
  id,
204476
204389
  breadcrumbs: [
204477
204390
  "物料库",
204478
- ...isSectionBlock ? ["区块"] : ["组件"],
204479
204391
  ...breadcrumbs || [],
204480
204392
  (component == null ? void 0 : component.title) || (component == null ? void 0 : component.name) || ""
204481
204393
  ]
204482
204394
  });
204483
204395
  }
204484
204396
  },
204485
- [
204486
- setEditingPage,
204487
- components,
204488
- setEditingComponent,
204489
- onSelectContent,
204490
- isSectionBlock
204491
- ]
204397
+ [setEditingPage, components, setEditingComponent, onSelectContent]
204492
204398
  );
204399
+ const handleImport = React__default.useCallback(() => {
204400
+ setComModalOpen(true);
204401
+ }, []);
204493
204402
  if (!themeId) {
204494
204403
  return null;
204495
204404
  }
@@ -204497,7 +204406,7 @@ function ComponentsRootNode(props) {
204497
204406
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
204498
204407
  GroupNode,
204499
204408
  {
204500
- title: isSectionBlock ? "区块" : "组件",
204409
+ title: "组件",
204501
204410
  fiexdAction: open,
204502
204411
  icon: null,
204503
204412
  classNames: {
@@ -204532,19 +204441,19 @@ function ComponentsRootNode(props) {
204532
204441
  {
204533
204442
  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AddIcon$1, { className: "size-4" }),
204534
204443
  onPress: handleNewComponent,
204535
- children: isSectionBlock ? "添加区块" : "添加组件"
204444
+ children: "添加组件"
204536
204445
  },
204537
204446
  "add-component"
204538
204447
  ),
204539
- /* @__PURE__ */ jsxRuntimeExports.jsx(
204448
+ !isTheme ? /* @__PURE__ */ jsxRuntimeExports.jsx(
204540
204449
  DropdownItem,
204541
204450
  {
204542
204451
  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(ImportIcon, { className: "size-4" }),
204543
- onPress: () => setComModalOpen(true),
204544
- children: isSectionBlock ? "转入区块" : "转入组件"
204452
+ onPress: handleImport,
204453
+ children: "转入组件"
204545
204454
  },
204546
204455
  "import"
204547
- ),
204456
+ ) : null,
204548
204457
  /* @__PURE__ */ jsxRuntimeExports.jsx(
204549
204458
  DropdownItem,
204550
204459
  {
@@ -204574,7 +204483,7 @@ function ComponentsRootNode(props) {
204574
204483
  ]
204575
204484
  }
204576
204485
  ),
204577
- children: isSectionBlock ? "区块市场" : "组件市场"
204486
+ children: "组件市场"
204578
204487
  },
204579
204488
  "market"
204580
204489
  )
@@ -204586,7 +204495,6 @@ function ComponentsRootNode(props) {
204586
204495
  /* @__PURE__ */ jsxRuntimeExports.jsx(
204587
204496
  ComponentCategoryList,
204588
204497
  {
204589
- isSectionBlock,
204590
204498
  selectedId: selectedContent == null ? void 0 : selectedContent.id,
204591
204499
  onSelect: handleSelect
204592
204500
  }
@@ -204594,7 +204502,6 @@ function ComponentsRootNode(props) {
204594
204502
  /* @__PURE__ */ jsxRuntimeExports.jsx(
204595
204503
  ComponentList,
204596
204504
  {
204597
- isSectionBlock,
204598
204505
  themeId,
204599
204506
  readonly,
204600
204507
  list: data,
@@ -204607,17 +204514,10 @@ function ComponentsRootNode(props) {
204607
204514
  ]
204608
204515
  }
204609
204516
  ),
204610
- /* @__PURE__ */ jsxRuntimeExports.jsx(
204611
- ComponentCategoryModal,
204612
- {
204613
- themeId,
204614
- isSectionBlock
204615
- }
204616
- ),
204517
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentCategoryModal, { themeId }),
204617
204518
  /* @__PURE__ */ jsxRuntimeExports.jsx(
204618
204519
  ImportComponentModal,
204619
204520
  {
204620
- isSectionBlock,
204621
204521
  open: comModalOpen,
204622
204522
  onClose: () => setComModalOpen(false)
204623
204523
  }
@@ -204625,7 +204525,7 @@ function ComponentsRootNode(props) {
204625
204525
  ] });
204626
204526
  }
204627
204527
  function ComponentsPanel(props) {
204628
- const { hidden } = props;
204528
+ const { hidden, isTheme } = props;
204629
204529
  const setDrawerType = useStudioStore((state) => state.setDrawerType);
204630
204530
  const theme = useStudioTheme();
204631
204531
  const selectedContent = useStudioStore((state) => state.selectedContent);
@@ -204639,25 +204539,15 @@ function ComponentsPanel(props) {
204639
204539
  },
204640
204540
  [setDrawerType, setWillSelectedContent]
204641
204541
  );
204642
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex-col", hidden ? "hidden" : "flex"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TreeView, { children: [
204643
- /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentCategoryListScope, { isSectionBlock: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
204644
- ComponentsRootNode,
204645
- {
204646
- isSectionBlock: true,
204647
- themeId: theme == null ? void 0 : theme.id,
204648
- selectedContent,
204649
- onSelectContent: handleSelection
204650
- }
204651
- ) }),
204652
- /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentCategoryListScope, { isSectionBlock: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
204653
- ComponentsRootNode,
204654
- {
204655
- themeId: theme == null ? void 0 : theme.id,
204656
- selectedContent,
204657
- onSelectContent: handleSelection
204658
- }
204659
- ) })
204660
- ] }) });
204542
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex-col", hidden ? "hidden" : "flex"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(TreeView, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentCategoryListScope, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
204543
+ ComponentsRootNode,
204544
+ {
204545
+ themeId: theme == null ? void 0 : theme.id,
204546
+ selectedContent,
204547
+ onSelectContent: handleSelection,
204548
+ isTheme
204549
+ }
204550
+ ) }) }) });
204661
204551
  }
204662
204552
  function LeftDrawer(props) {
204663
204553
  const { isTheme } = props;
@@ -204719,7 +204609,8 @@ function MediaDialog(props) {
204719
204609
  );
204720
204610
  }
204721
204611
  function ThemeDesigner() {
204722
- const [layersOpen, setLayersOpen] = useState(true);
204612
+ const layersOpen = useStudioStore((state) => state.layersOpen);
204613
+ const setLayersOpen = useStudioStore((state) => state.setLayersOpen);
204723
204614
  const [mediaLibOpen, setMediaLibOpen] = useState(false);
204724
204615
  const drawerType = useStudioStore((state) => state.drawerType);
204725
204616
  const setDrawerType = useStudioStore((state) => state.setDrawerType);
@@ -204738,7 +204629,9 @@ function ThemeDesigner() {
204738
204629
  docIdRef.current = docId;
204739
204630
  const { modified } = useDocumentModified();
204740
204631
  const website = useWebsite();
204741
- const { schema, code, config: config2 } = useSchema(selectedContent);
204632
+ const { setViewMode } = useViewMode();
204633
+ const content = useSchema(selectedContent);
204634
+ const { schema, code, config: config2, onlyCode } = content;
204742
204635
  const fComs = useAllFrontComponents();
204743
204636
  const selectedComponent = fComs == null ? void 0 : fComs.find(
204744
204637
  (c) => c.id === (selectedContent == null ? void 0 : selectedContent.id) && (selectedContent == null ? void 0 : selectedContent.type) === ContentType.Component
@@ -204757,12 +204650,17 @@ function ThemeDesigner() {
204757
204650
  }
204758
204651
  const documentId = createDocument(schema, code, config2);
204759
204652
  setDocId(documentId || void 0);
204653
+ if (onlyCode) {
204654
+ setViewMode(ViewMode.Code);
204655
+ } else {
204656
+ setViewMode(ViewMode.Design);
204657
+ }
204760
204658
  } else {
204761
204659
  console.log("销毁 document");
204762
204660
  docIdRef.current && removeDocument(docIdRef.current);
204763
204661
  setDocId(void 0);
204764
204662
  }
204765
- }, [code, config2, createDocument, engine, removeDocument, schema]);
204663
+ }, [code, config2, createDocument, engine, removeDocument, schema, onlyCode, setViewMode]);
204766
204664
  const handleRefChange = useCallback(
204767
204665
  (el) => {
204768
204666
  var _a3, _b3;
@@ -205187,7 +205085,7 @@ function MoreActions() {
205187
205085
  ] });
205188
205086
  }
205189
205087
  const WebsiteToolbar = memo(() => {
205190
- var _a3, _b3, _c2, _d2;
205088
+ var _a3, _b3, _c2, _d2, _e2, _f2;
205191
205089
  const [isDeploying, setIsDeploying] = useState(false);
205192
205090
  const website = useWebsite();
205193
205091
  const currentLang = useCurrentLang();
@@ -205208,6 +205106,32 @@ const WebsiteToolbar = memo(() => {
205208
205106
  useEffect(() => {
205209
205107
  setSelectedContent(void 0);
205210
205108
  }, [currentLang, setSelectedContent]);
205109
+ const deployToGithub = useCallback(
205110
+ async (isStatic) => {
205111
+ const havap = isStatic;
205112
+ const formData = new FormData();
205113
+ formData.append("websiteId", (website == null ? void 0 : website.id) || "");
205114
+ formData.append("havap", String(havap));
205115
+ const files = await generateWebsiteFiles(isStatic) || [];
205116
+ const zip = new JSZip();
205117
+ traverseFiles$1(files, (file2, fullPath) => {
205118
+ if (file2.type === "folder") {
205119
+ zip.folder(fullPath);
205120
+ } else {
205121
+ zip.file(fullPath, file2.content || "");
205122
+ }
205123
+ });
205124
+ const suffix = isStatic ? "static" : "preview";
205125
+ const file = new File(
205126
+ [await zip.generateAsync({ type: "blob" })],
205127
+ `${(website == null ? void 0 : website.name) || "website"}_${suffix}.zip`,
205128
+ { type: "application/zip" }
205129
+ );
205130
+ formData.append("file", file);
205131
+ await uploadDeploymentFile(formData);
205132
+ },
205133
+ [generateWebsiteFiles, uploadDeploymentFile, website == null ? void 0 : website.id, website == null ? void 0 : website.name]
205134
+ );
205211
205135
  const deployWebsite = useCallback(async () => {
205212
205136
  var _a4, _b4;
205213
205137
  try {
@@ -205231,30 +205155,7 @@ const WebsiteToolbar = memo(() => {
205231
205155
  } finally {
205232
205156
  setIsDeploying(false);
205233
205157
  }
205234
- }, [website]);
205235
- const deployToGithub = async (isStatic) => {
205236
- const havap = isStatic;
205237
- const formData = new FormData();
205238
- formData.append("websiteId", (website == null ? void 0 : website.id) || "");
205239
- formData.append("havap", String(havap));
205240
- const files = await generateWebsiteFiles(isStatic) || [];
205241
- const zip = new JSZip();
205242
- traverseFiles$1(files, (file2, fullPath) => {
205243
- if (file2.type === "folder") {
205244
- zip.folder(fullPath);
205245
- } else {
205246
- zip.file(fullPath, file2.content || "");
205247
- }
205248
- });
205249
- const suffix = isStatic ? "static" : "preview";
205250
- const file = new File(
205251
- [await zip.generateAsync({ type: "blob" })],
205252
- `${(website == null ? void 0 : website.name) || "website"}_${suffix}.zip`,
205253
- { type: "application/zip" }
205254
- );
205255
- formData.append("file", file);
205256
- await uploadDeploymentFile(formData);
205257
- };
205158
+ }, [deployToGithub, (_d2 = (_c2 = website == null ? void 0 : website.settings) == null ? void 0 : _c2.deployConfig) == null ? void 0 : _d2.githubPreviewRepo]);
205258
205159
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
205259
205160
  "div",
205260
205161
  {
@@ -205268,39 +205169,30 @@ const WebsiteToolbar = memo(() => {
205268
205169
  ) }),
205269
205170
  /* @__PURE__ */ jsxRuntimeExports.jsx(DeviceTabs, {}),
205270
205171
  /* @__PURE__ */ jsxRuntimeExports.jsx(RedoUndo, {}),
205271
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
205272
- "div",
205273
- {
205274
- className: cn(
205275
- "flex gap-1 pr-4 items-center justify-end"
205276
- ),
205277
- children: [
205278
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewModeButtons, {}),
205279
- /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { orientation: "vertical", className: "h-5" }),
205280
- !!((_c2 = website == null ? void 0 : website.langs) == null ? void 0 : _c2.length) && ((_d2 = website == null ? void 0 : website.langs) == null ? void 0 : _d2.length) > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(
205281
- LangSelect,
205282
- {
205283
- onSelect: (langId) => navigate == null ? void 0 : navigate(`${rootPath}/${website == null ? void 0 : website.id}/lang/${langId}`)
205284
- }
205285
- ),
205286
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "save-action" }),
205287
- /* @__PURE__ */ jsxRuntimeExports.jsx(
205288
- Button$3,
205289
- {
205290
- size: "sm",
205291
- disabled: !previewUrl,
205292
- variant: "outline",
205293
- onClick: () => {
205294
- window.open(previewUrl, "_blank");
205295
- },
205296
- children: "预览网站"
205297
- }
205298
- ),
205299
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button$3, { size: "sm", loading: isDeploying, onClick: deployWebsite, children: "部署网站" }),
205300
- /* @__PURE__ */ jsxRuntimeExports.jsx(MoreActions, {})
205301
- ]
205302
- }
205303
- )
205172
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex gap-1 pr-4 items-center justify-end"), children: [
205173
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewModeButtons, {}),
205174
+ !!((_e2 = website == null ? void 0 : website.langs) == null ? void 0 : _e2.length) && ((_f2 = website == null ? void 0 : website.langs) == null ? void 0 : _f2.length) > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(
205175
+ LangSelect,
205176
+ {
205177
+ onSelect: (langId) => navigate == null ? void 0 : navigate(`${rootPath}/${website == null ? void 0 : website.id}/lang/${langId}`)
205178
+ }
205179
+ ),
205180
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "save-action" }),
205181
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
205182
+ Button$3,
205183
+ {
205184
+ size: "sm",
205185
+ disabled: !previewUrl,
205186
+ variant: "outline",
205187
+ onClick: () => {
205188
+ window.open(previewUrl, "_blank");
205189
+ },
205190
+ children: "预览网站"
205191
+ }
205192
+ ),
205193
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$3, { size: "sm", loading: isDeploying, onClick: deployWebsite, children: "部署网站" }),
205194
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MoreActions, {})
205195
+ ] })
205304
205196
  ]
205305
205197
  }
205306
205198
  );
@@ -205368,8 +205260,10 @@ function WebsiteDesigner(props) {
205368
205260
  const engine = useDesignerEngine();
205369
205261
  const docIdRef = useRef(void 0);
205370
205262
  docIdRef.current = docId;
205371
- const { schema, code, config: config2 } = useSchema(selectedContent);
205263
+ const content = useSchema(selectedContent);
205264
+ const { schema, code, config: config2, onlyCode } = content;
205372
205265
  const loading = useStudioLoading();
205266
+ const { setViewMode } = useViewMode();
205373
205267
  useCapabilities();
205374
205268
  useEffect(() => {
205375
205269
  if (engine && schema) {
@@ -205380,6 +205274,11 @@ function WebsiteDesigner(props) {
205380
205274
  }
205381
205275
  const documentId = createDocument(schema, code, config2);
205382
205276
  setDocId(documentId || void 0);
205277
+ if (onlyCode) {
205278
+ setViewMode(ViewMode.Code);
205279
+ } else {
205280
+ setViewMode(ViewMode.Design);
205281
+ }
205383
205282
  } else {
205384
205283
  console.log("销毁 document");
205385
205284
  if (docIdRef.current) {
@@ -205388,7 +205287,7 @@ function WebsiteDesigner(props) {
205388
205287
  }
205389
205288
  setDocId(void 0);
205390
205289
  }
205391
- }, [code, config2, createDocument, engine, removeDocument, schema]);
205290
+ }, [code, config2, createDocument, engine, removeDocument, schema, onlyCode, setViewMode]);
205392
205291
  const handleRefChange = useCallback(
205393
205292
  (el) => {
205394
205293
  var _a3, _b3;
@@ -205535,4 +205434,4 @@ export {
205535
205434
  typescriptDefaults as t,
205536
205435
  useCustomizedMaterials as u
205537
205436
  };
205538
- //# sourceMappingURL=index-f5bad985.js.map
205437
+ //# sourceMappingURL=index-e4647972.js.map