@rxdrag/website-studio 0.0.58 → 0.0.60

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-ffe0c44c.js} +4 -3
  13. package/dist/{cssMode-09f3d08a.js.map → cssMode-ffe0c44c.js.map} +1 -1
  14. package/dist/{freemarker2-e76b71c2.js → freemarker2-541dbdeb.js} +4 -3
  15. package/dist/{freemarker2-e76b71c2.js.map → freemarker2-541dbdeb.js.map} +1 -1
  16. package/dist/{handlebars-1e06e488.js → handlebars-4dfc6fda.js} +4 -3
  17. package/dist/{handlebars-1e06e488.js.map → handlebars-4dfc6fda.js.map} +1 -1
  18. package/dist/hooks/useSchema.d.ts +1 -0
  19. package/dist/{html-01a2c82d.js → html-f353ad65.js} +4 -3
  20. package/dist/{html-01a2c82d.js.map → html-f353ad65.js.map} +1 -1
  21. package/dist/{htmlMode-71fa2280.js → htmlMode-66d590ee.js} +4 -3
  22. package/dist/{htmlMode-71fa2280.js.map → htmlMode-66d590ee.js.map} +1 -1
  23. package/dist/{index-f5bad985.js → index-43a16806.js} +292 -333
  24. package/dist/{index-f5bad985.js.map → index-43a16806.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-62aac17e.js} +5 -4
  28. package/dist/{javascript-31f976b5.js.map → javascript-62aac17e.js.map} +1 -1
  29. package/dist/{jsonMode-0ac682a1.js → jsonMode-40922d8d.js} +4 -3
  30. package/dist/{jsonMode-0ac682a1.js.map → jsonMode-40922d8d.js.map} +1 -1
  31. package/dist/{liquid-cf497048.js → liquid-735f1dae.js} +4 -3
  32. package/dist/{liquid-cf497048.js.map → liquid-735f1dae.js.map} +1 -1
  33. package/dist/{mdx-8494287c.js → mdx-e495673a.js} +4 -3
  34. package/dist/{mdx-8494287c.js.map → mdx-e495673a.js.map} +1 -1
  35. package/dist/{python-7b6d405d.js → python-fbb8e475.js} +4 -3
  36. package/dist/{python-7b6d405d.js.map → python-fbb8e475.js.map} +1 -1
  37. package/dist/{razor-0a925e48.js → razor-015f7859.js} +4 -3
  38. package/dist/{razor-0a925e48.js.map → razor-015f7859.js.map} +1 -1
  39. package/dist/{tsMode-a79abe6c.js → tsMode-92a6a656.js} +4 -3
  40. package/dist/{tsMode-a79abe6c.js.map → tsMode-92a6a656.js.map} +1 -1
  41. package/dist/types.d.ts +2 -2
  42. package/dist/{typescript-6fed2f8c.js → typescript-ac8dc120.js} +4 -3
  43. package/dist/{typescript-6fed2f8c.js.map → typescript-ac8dc120.js.map} +1 -1
  44. package/dist/{xml-7fc2d3d8.js → xml-b791f2df.js} +4 -3
  45. package/dist/{xml-7fc2d3d8.js.map → xml-b791f2df.js.map} +1 -1
  46. package/dist/{yaml-e8730fef.js → yaml-e690f8a2.js} +4 -3
  47. package/dist/{yaml-e8730fef.js.map → yaml-e690f8a2.js.map} +1 -1
  48. package/package.json +21 -20
@@ -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, 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-541dbdeb.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-541dbdeb.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-541dbdeb.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-541dbdeb.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-541dbdeb.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-541dbdeb.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-541dbdeb.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-4dfc6fda.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-f353ad65.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-62aac17e.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-735f1dae.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-e495673a.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-fbb8e475.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-015f7859.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-ac8dc120.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-b791f2df.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-e690f8a2.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-ffe0c44c.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-66d590ee.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-40922d8d.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-92a6a656.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
  ]);
@@ -203145,7 +203145,7 @@ function PagesModalContent(props) {
203145
203145
  const tranlatePages = useTranslateCustomizedPages();
203146
203146
  const data = useListData();
203147
203147
  const [selection, setSelections] = useSelectionsState() || [];
203148
- const confirmResolveRef = useRef();
203148
+ const confirmResolveRef = useRef(void 0);
203149
203149
  useEffect(() => {
203150
203150
  var _a4;
203151
203151
  setPagesToImport(
@@ -203239,13 +203239,9 @@ function PagesModalContent(props) {
203239
203239
  confirmResolveRef.current = void 0;
203240
203240
  }
203241
203241
  }, []);
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(
203242
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full overflow-hidden", children: [
203243
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DialogHeader, { className: "px-6 py-4 border-b", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "导入页面" }) }),
203244
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto min-h-0 p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
203249
203245
  EntityTable,
203250
203246
  {
203251
203247
  "aria-label": "文章列表",
@@ -203260,28 +203256,28 @@ function PagesModalContent(props) {
203260
203256
  ] })
203261
203257
  }
203262
203258
  ) }),
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: [
203259
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogFooter, { className: "px-6 py-4 border-t justify-between", children: [
203260
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground flex items-center gap-2" }),
203261
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
203267
203262
  /* @__PURE__ */ jsxRuntimeExports.jsx(
203268
- Button$2,
203263
+ Button$3,
203269
203264
  {
203270
- variant: "light",
203271
- className: "text-default-500",
203272
- onPress: onClose,
203265
+ type: "button",
203266
+ variant: "outline",
203267
+ onClick: onClose,
203273
203268
  children: "关闭"
203274
203269
  }
203275
203270
  ),
203276
- /* @__PURE__ */ jsxRuntimeExports.jsx(
203277
- Button$2,
203271
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
203272
+ Button$3,
203278
203273
  {
203279
- variant: "solid",
203280
- color: "primary",
203281
- onPress: handleImport,
203282
- isLoading: importing,
203283
- isDisabled: !(selection == null ? void 0 : selection.length),
203284
- children: "导入"
203274
+ type: "button",
203275
+ disabled: importing || !(selection == null ? void 0 : selection.length),
203276
+ onClick: handleImport,
203277
+ children: [
203278
+ importing && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2", children: "⏳" }),
203279
+ "导入"
203280
+ ]
203285
203281
  }
203286
203282
  )
203287
203283
  ] })
@@ -203352,24 +203348,31 @@ function ImportPageModal({ open, onClose }) {
203352
203348
  orderBy
203353
203349
  }).setNoQuery(!(parentTheme == null ? void 0 : parentTheme.id));
203354
203350
  }, [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
- ] });
203351
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Dialog, { open, onOpenChange: (isOpen) => !isOpen && onClose(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
203352
+ QueryListScope,
203353
+ {
203354
+ defaultPageSize: 20,
203355
+ options: queryOptions,
203356
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { className: "max-w-[620px] h-[80vh] max-h-[560px] p-0 gap-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PagesModalContent, { onClose }) })
203357
+ }
203358
+ ) });
203359
+ }
203360
+ const askForQuoteItem = {
203361
+ title: "提交询盘",
203362
+ pageType: PageType.AskForQuote
203363
+ };
203364
+ function PredefinedApis(props) {
203365
+ const { pages } = props;
203366
+ const defaultCode = useMemo(() => askForQuote.content, []);
203367
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
203368
+ PredefinedPageCard,
203369
+ {
203370
+ isApi: true,
203371
+ pages,
203372
+ pageType: askForQuoteItem,
203373
+ defaultCode
203374
+ }
203375
+ );
203373
203376
  }
203374
203377
  function PagesPanel(props) {
203375
203378
  var _a3;
@@ -203416,8 +203419,8 @@ function PagesPanel(props) {
203416
203419
  ] }),
203417
203420
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500 italic mb-2 mt-2", children: "默认页面" }),
203418
203421
  /* @__PURE__ */ jsxRuntimeExports.jsx(PredefinedPages, { pages: pages || [] }),
203419
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500 italic mb-2 mt-2", children: "自定义接口" }),
203420
203422
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500 italic mb-2 mt-2", children: "默认接口" }),
203423
+ /* @__PURE__ */ jsxRuntimeExports.jsx(PredefinedApis, { pages: pages || [] }),
203421
203424
  /* @__PURE__ */ jsxRuntimeExports.jsx(
203422
203425
  ImportPageModal,
203423
203426
  {
@@ -203598,20 +203601,20 @@ function LeftDrawerPannels() {
203598
203601
  ] });
203599
203602
  }
203600
203603
  function ComponentModal(props) {
203601
- const { isSectionBlock, themeId, categoryId, noCagegory, onFilter, ...rest } = props;
203604
+ const { themeId, categoryId, noCagegory, onFilter, ...rest } = props;
203602
203605
  const webSite = useWebsite();
203603
203606
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
203604
203607
  EntityEditModal,
203605
203608
  {
203606
203609
  entityName: FrontComponentEntityName,
203607
203610
  entityLabel: "自定义组件",
203608
- size: "2xl",
203609
203611
  initialValue: {
203610
- isSectionBlock,
203611
203612
  theme: { id: themeId },
203612
203613
  category: { id: categoryId }
203613
203614
  },
203614
- zIndexCls: "z-[1000]",
203615
+ classNames: {
203616
+ content: "sm:max-w-[800px]"
203617
+ },
203615
203618
  entityToInput: frontComponentToInput,
203616
203619
  onFilter,
203617
203620
  ...rest,
@@ -203621,6 +203624,7 @@ function ComponentModal(props) {
203621
203624
  {
203622
203625
  name: "name",
203623
203626
  label: "名称",
203627
+ autoFocus: true,
203624
203628
  validateSchema: {
203625
203629
  type: "string",
203626
203630
  required: true
@@ -203632,7 +203636,6 @@ function ComponentModal(props) {
203632
203636
  /* @__PURE__ */ jsxRuntimeExports.jsx(
203633
203637
  InputField,
203634
203638
  {
203635
- autoFocus: true,
203636
203639
  name: "title",
203637
203640
  label: "标题",
203638
203641
  validateSchema: {
@@ -203653,7 +203656,7 @@ function ComponentModal(props) {
203653
203656
  classNames: {
203654
203657
  label: "text-sm",
203655
203658
  base: "flex-col gap-1",
203656
- shower: "w-[600px] h-[400px]"
203659
+ shower: "w-[300px] h-[200px]"
203657
203660
  },
203658
203661
  mediaTypes: [MediaType.image]
203659
203662
  }
@@ -203697,7 +203700,8 @@ function ComponentModal(props) {
203697
203700
  labelPlacement: "outside",
203698
203701
  placeholder: "请输入顺序"
203699
203702
  }
203700
- )
203703
+ ),
203704
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxField, { label: "区块", name: "isSectionBlock", children: "是区块" })
203701
203705
  ] })
203702
203706
  }
203703
203707
  );
@@ -203801,7 +203805,6 @@ function ComponentList(props) {
203801
203805
  const {
203802
203806
  themeId,
203803
203807
  readonly,
203804
- isSectionBlock,
203805
203808
  list: list2,
203806
203809
  category,
203807
203810
  newComponent,
@@ -203831,7 +203834,6 @@ function ComponentList(props) {
203831
203834
  !readonly && /* @__PURE__ */ jsxRuntimeExports.jsx(
203832
203835
  ComponentModal,
203833
203836
  {
203834
- isSectionBlock,
203835
203837
  themeId,
203836
203838
  value: newComponent,
203837
203839
  noCagegory,
@@ -203846,14 +203848,7 @@ function ComponentList(props) {
203846
203848
  const ComponentCategoryNode = memo(
203847
203849
  (props) => {
203848
203850
  var _a3;
203849
- const {
203850
- isSectionBlock,
203851
- category,
203852
- themeId,
203853
- readonly,
203854
- selectedId,
203855
- onSelect
203856
- } = props;
203851
+ const { category, themeId, readonly, selectedId, onSelect } = props;
203857
203852
  const [open, setOpen] = React__default.useState(false);
203858
203853
  const website = useWebsite();
203859
203854
  const [remove, { isMutating }] = useRemoveRow({
@@ -203863,7 +203858,7 @@ const ComponentCategoryNode = memo(
203863
203858
  });
203864
203859
  const [newComponent, setNewComponent] = React__default.useState();
203865
203860
  const edit = useEditRow();
203866
- const components = useFrontComponentsBySectionBlock(isSectionBlock);
203861
+ const components = useAllFrontComponents();
203867
203862
  const componentsInCategory = useMemo(
203868
203863
  () => components == null ? void 0 : components.filter((item) => {
203869
203864
  var _a4;
@@ -203877,11 +203872,10 @@ const ComponentCategoryNode = memo(
203877
203872
  const handleNewComponent = React__default.useCallback(() => {
203878
203873
  setNewComponent({
203879
203874
  category: { id: category.id },
203880
- theme: { id: themeId },
203881
- isSectionBlock
203875
+ theme: { id: themeId }
203882
203876
  });
203883
203877
  setOpen(false);
203884
- }, [category.id, themeId, isSectionBlock]);
203878
+ }, [category.id, themeId]);
203885
203879
  const handleEdit = React__default.useCallback(() => {
203886
203880
  edit();
203887
203881
  setOpen(false);
@@ -203960,7 +203954,6 @@ const ComponentCategoryNode = memo(
203960
203954
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
203961
203955
  ComponentList,
203962
203956
  {
203963
- isSectionBlock,
203964
203957
  category,
203965
203958
  themeId,
203966
203959
  readonly,
@@ -203977,7 +203970,7 @@ const ComponentCategoryNode = memo(
203977
203970
  );
203978
203971
  function ComponentCategoryList(props) {
203979
203972
  var _a3;
203980
- const { readonly, selectedId, onSelect, isSectionBlock } = props;
203973
+ const { readonly, selectedId, onSelect } = props;
203981
203974
  const data = useListData();
203982
203975
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (_a3 = data == null ? void 0 : data.items) == null ? void 0 : _a3.map((item) => {
203983
203976
  var _a4, _b3;
@@ -203988,15 +203981,14 @@ function ComponentCategoryList(props) {
203988
203981
  themeId: (_b3 = item.theme) == null ? void 0 : _b3.id,
203989
203982
  readonly,
203990
203983
  selectedId,
203991
- isSectionBlock,
203992
203984
  onSelect: (id) => onSelect == null ? void 0 : onSelect(id, [item.name || ""])
203993
203985
  }
203994
203986
  ) }, item.id);
203995
203987
  }) });
203996
203988
  }
203997
203989
  function ComponentCategoryListScope(props) {
203998
- const { children, isSectionBlock } = props;
203999
- const componentCategories = useComponentCategoriesWithSectionBlock(isSectionBlock);
203990
+ const { children } = props;
203991
+ const componentCategories = useAllComponentCategories();
204000
203992
  return componentCategories && /* @__PURE__ */ jsxRuntimeExports.jsx(
204001
203993
  EntityListScope,
204002
203994
  {
@@ -204007,15 +203999,14 @@ function ComponentCategoryListScope(props) {
204007
203999
  );
204008
204000
  }
204009
204001
  function ComponentCategoryModal(props) {
204010
- const { themeId, onClose, isSectionBlock } = props;
204002
+ const { themeId, onClose } = props;
204011
204003
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
204012
204004
  EntityEditModal,
204013
204005
  {
204014
204006
  entityName: ComponentCategoryEntityName,
204015
204007
  entityLabel: "组件分类",
204016
204008
  initialValue: {
204017
- theme: { id: themeId },
204018
- isSectionBlock
204009
+ theme: { id: themeId }
204019
204010
  },
204020
204011
  entityToInput: componentCategoryToInput,
204021
204012
  onClose,
@@ -204200,7 +204191,6 @@ function useComponentsImportTask() {
204200
204191
  };
204201
204192
  }
204202
204193
  function ImportComponentModal({
204203
- isSectionBlock,
204204
204194
  open,
204205
204195
  onClose
204206
204196
  }) {
@@ -204237,31 +204227,15 @@ function ImportComponentModal({
204237
204227
  )
204238
204228
  );
204239
204229
  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
- )) || [];
204230
+ return !isBaseTheme ? (baseTheme == null ? void 0 : baseTheme.componentCategories) || [] : (parentTheme == null ? void 0 : parentTheme.componentCategories) || [];
204246
204231
  }, [
204247
204232
  isBaseTheme,
204248
204233
  baseTheme == null ? void 0 : baseTheme.componentCategories,
204249
- parentTheme == null ? void 0 : parentTheme.componentCategories,
204250
- isSectionBlock
204234
+ parentTheme == null ? void 0 : parentTheme.componentCategories
204251
204235
  ]);
204252
204236
  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
- ]);
204237
+ return !isBaseTheme ? (baseTheme == null ? void 0 : baseTheme.components) || [] : (parentTheme == null ? void 0 : parentTheme.components) || [];
204238
+ }, [isBaseTheme, baseTheme == null ? void 0 : baseTheme.components, parentTheme == null ? void 0 : parentTheme.components]);
204265
204239
  const noCategoryComponents = useMemo(() => {
204266
204240
  return components.filter((component) => {
204267
204241
  var _a4;
@@ -204338,40 +204312,45 @@ function ImportComponentModal({
204338
204312
  themeComs,
204339
204313
  translateComponents
204340
204314
  ]);
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,
204315
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
204316
+ Dialog,
204317
+ {
204318
+ open,
204319
+ onOpenChange: (isOpen) => !isOpen && onClose(),
204320
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogContent, { className: "max-w-[600px] h-[80vh] p-0 gap-0", children: [
204321
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full overflow-hidden", children: [
204322
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DialogHeader, { className: "px-6 py-4 border-b", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "转入组件" }) }),
204323
+ /* @__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: [
204324
+ categories == null ? void 0 : categories.map((category) => /* @__PURE__ */ jsxRuntimeExports.jsx(
204325
+ GroupNode,
204362
204326
  {
204363
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(
204364
- Checkbox,
204365
- {
204366
- isSelected: selection.includes(component.id || ""),
204367
- onValueChange: () => handleToggleSelect(component.id || "")
204327
+ title: category.name,
204328
+ icon: false,
204329
+ children: components.filter(
204330
+ (component) => {
204331
+ var _a4;
204332
+ return ((_a4 = component.category) == null ? void 0 : _a4.id) === category.id;
204368
204333
  }
204369
- ),
204370
- onClick: () => handleToggleSelect(component.id || ""),
204371
- children: component.title || component.name
204334
+ ).map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(
204335
+ LeafNode,
204336
+ {
204337
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(
204338
+ Checkbox,
204339
+ {
204340
+ isSelected: selection.includes(
204341
+ component.id || ""
204342
+ ),
204343
+ onValueChange: () => handleToggleSelect(component.id || "")
204344
+ }
204345
+ ),
204346
+ onClick: () => handleToggleSelect(component.id || ""),
204347
+ children: component.title || component.name
204348
+ },
204349
+ component.id
204350
+ ))
204372
204351
  },
204373
- component.id
204374
- )) }, category.id)),
204352
+ category.id
204353
+ )),
204375
204354
  noCategoryComponents.map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(
204376
204355
  LeafNode,
204377
204356
  {
@@ -204388,51 +204367,46 @@ function ImportComponentModal({
204388
204367
  component.id
204389
204368
  ))
204390
204369
  ] }) }),
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" }),
204370
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogFooter, { className: "px-6 py-4 border-t justify-between", children: [
204371
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground flex items-center gap-2" }),
204394
204372
  /* @__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,
204373
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$3, { type: "button", variant: "outline", onClick: onClose, children: "关闭" }),
204374
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
204375
+ Button$3,
204398
204376
  {
204399
- variant: "solid",
204400
- color: "primary",
204401
- onPress: handleImport,
204402
- isLoading: loading,
204403
- children: "转入"
204377
+ type: "button",
204378
+ disabled: loading,
204379
+ onClick: handleImport,
204380
+ children: [
204381
+ loading && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2", children: "" }),
204382
+ "转入"
204383
+ ]
204404
204384
  }
204405
204385
  )
204406
204386
  ] })
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
- ] });
204387
+ ] })
204388
+ ] }),
204389
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
204390
+ ConfirmDialog,
204391
+ {
204392
+ open: !!confirmTitle,
204393
+ onClose: () => {
204394
+ setConfirmTitle(void 0);
204395
+ if (confirmResolveRef.current) {
204396
+ confirmResolveRef.current(false);
204397
+ confirmResolveRef.current = void 0;
204398
+ }
204399
+ },
204400
+ onConfirm: handleConfirm,
204401
+ confirm: confirmTitle
204402
+ }
204403
+ )
204404
+ ] })
204405
+ }
204406
+ );
204427
204407
  }
204428
204408
  function ComponentsRootNode(props) {
204429
- const {
204430
- themeId,
204431
- readonly,
204432
- selectedContent,
204433
- onSelectContent,
204434
- isSectionBlock
204435
- } = props;
204409
+ const { themeId, readonly, selectedContent, onSelectContent, isTheme } = props;
204436
204410
  const [open, setOpen] = React__default.useState(false);
204437
204411
  const [comModalOpen, setComModalOpen] = React__default.useState(false);
204438
204412
  const [newComponent, setNewComponent] = React__default.useState();
@@ -204442,7 +204416,7 @@ function ComponentsRootNode(props) {
204442
204416
  );
204443
204417
  const website = useWebsite();
204444
204418
  const handleNewCagegory = useNewRow();
204445
- const components = useFrontComponentsBySectionBlock(isSectionBlock);
204419
+ const components = useAllFrontComponents();
204446
204420
  const comsNoCategory = useMemo(
204447
204421
  () => components == null ? void 0 : components.filter((item) => {
204448
204422
  var _a3;
@@ -204452,10 +204426,9 @@ function ComponentsRootNode(props) {
204452
204426
  );
204453
204427
  const handleNewComponent = React__default.useCallback(() => {
204454
204428
  setNewComponent({
204455
- theme: { id: themeId },
204456
- isSectionBlock
204429
+ theme: { id: themeId }
204457
204430
  });
204458
- }, [themeId, isSectionBlock]);
204431
+ }, [themeId]);
204459
204432
  const handleOpenChange = React__default.useCallback((open2) => {
204460
204433
  setOpen(open2);
204461
204434
  }, []);
@@ -204475,21 +204448,17 @@ function ComponentsRootNode(props) {
204475
204448
  id,
204476
204449
  breadcrumbs: [
204477
204450
  "物料库",
204478
- ...isSectionBlock ? ["区块"] : ["组件"],
204479
204451
  ...breadcrumbs || [],
204480
204452
  (component == null ? void 0 : component.title) || (component == null ? void 0 : component.name) || ""
204481
204453
  ]
204482
204454
  });
204483
204455
  }
204484
204456
  },
204485
- [
204486
- setEditingPage,
204487
- components,
204488
- setEditingComponent,
204489
- onSelectContent,
204490
- isSectionBlock
204491
- ]
204457
+ [setEditingPage, components, setEditingComponent, onSelectContent]
204492
204458
  );
204459
+ const handleImport = React__default.useCallback(() => {
204460
+ setComModalOpen(true);
204461
+ }, []);
204493
204462
  if (!themeId) {
204494
204463
  return null;
204495
204464
  }
@@ -204497,7 +204466,7 @@ function ComponentsRootNode(props) {
204497
204466
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
204498
204467
  GroupNode,
204499
204468
  {
204500
- title: isSectionBlock ? "区块" : "组件",
204469
+ title: "组件",
204501
204470
  fiexdAction: open,
204502
204471
  icon: null,
204503
204472
  classNames: {
@@ -204532,19 +204501,19 @@ function ComponentsRootNode(props) {
204532
204501
  {
204533
204502
  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AddIcon$1, { className: "size-4" }),
204534
204503
  onPress: handleNewComponent,
204535
- children: isSectionBlock ? "添加区块" : "添加组件"
204504
+ children: "添加组件"
204536
204505
  },
204537
204506
  "add-component"
204538
204507
  ),
204539
- /* @__PURE__ */ jsxRuntimeExports.jsx(
204508
+ !isTheme ? /* @__PURE__ */ jsxRuntimeExports.jsx(
204540
204509
  DropdownItem,
204541
204510
  {
204542
204511
  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(ImportIcon, { className: "size-4" }),
204543
- onPress: () => setComModalOpen(true),
204544
- children: isSectionBlock ? "转入区块" : "转入组件"
204512
+ onPress: handleImport,
204513
+ children: "转入组件"
204545
204514
  },
204546
204515
  "import"
204547
- ),
204516
+ ) : null,
204548
204517
  /* @__PURE__ */ jsxRuntimeExports.jsx(
204549
204518
  DropdownItem,
204550
204519
  {
@@ -204574,7 +204543,7 @@ function ComponentsRootNode(props) {
204574
204543
  ]
204575
204544
  }
204576
204545
  ),
204577
- children: isSectionBlock ? "区块市场" : "组件市场"
204546
+ children: "组件市场"
204578
204547
  },
204579
204548
  "market"
204580
204549
  )
@@ -204586,7 +204555,6 @@ function ComponentsRootNode(props) {
204586
204555
  /* @__PURE__ */ jsxRuntimeExports.jsx(
204587
204556
  ComponentCategoryList,
204588
204557
  {
204589
- isSectionBlock,
204590
204558
  selectedId: selectedContent == null ? void 0 : selectedContent.id,
204591
204559
  onSelect: handleSelect
204592
204560
  }
@@ -204594,7 +204562,6 @@ function ComponentsRootNode(props) {
204594
204562
  /* @__PURE__ */ jsxRuntimeExports.jsx(
204595
204563
  ComponentList,
204596
204564
  {
204597
- isSectionBlock,
204598
204565
  themeId,
204599
204566
  readonly,
204600
204567
  list: data,
@@ -204607,17 +204574,10 @@ function ComponentsRootNode(props) {
204607
204574
  ]
204608
204575
  }
204609
204576
  ),
204610
- /* @__PURE__ */ jsxRuntimeExports.jsx(
204611
- ComponentCategoryModal,
204612
- {
204613
- themeId,
204614
- isSectionBlock
204615
- }
204616
- ),
204577
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentCategoryModal, { themeId }),
204617
204578
  /* @__PURE__ */ jsxRuntimeExports.jsx(
204618
204579
  ImportComponentModal,
204619
204580
  {
204620
- isSectionBlock,
204621
204581
  open: comModalOpen,
204622
204582
  onClose: () => setComModalOpen(false)
204623
204583
  }
@@ -204625,7 +204585,7 @@ function ComponentsRootNode(props) {
204625
204585
  ] });
204626
204586
  }
204627
204587
  function ComponentsPanel(props) {
204628
- const { hidden } = props;
204588
+ const { hidden, isTheme } = props;
204629
204589
  const setDrawerType = useStudioStore((state) => state.setDrawerType);
204630
204590
  const theme = useStudioTheme();
204631
204591
  const selectedContent = useStudioStore((state) => state.selectedContent);
@@ -204639,25 +204599,15 @@ function ComponentsPanel(props) {
204639
204599
  },
204640
204600
  [setDrawerType, setWillSelectedContent]
204641
204601
  );
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
- ] }) });
204602
+ 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(
204603
+ ComponentsRootNode,
204604
+ {
204605
+ themeId: theme == null ? void 0 : theme.id,
204606
+ selectedContent,
204607
+ onSelectContent: handleSelection,
204608
+ isTheme
204609
+ }
204610
+ ) }) }) });
204661
204611
  }
204662
204612
  function LeftDrawer(props) {
204663
204613
  const { isTheme } = props;
@@ -204719,7 +204669,8 @@ function MediaDialog(props) {
204719
204669
  );
204720
204670
  }
204721
204671
  function ThemeDesigner() {
204722
- const [layersOpen, setLayersOpen] = useState(true);
204672
+ const layersOpen = useStudioStore((state) => state.layersOpen);
204673
+ const setLayersOpen = useStudioStore((state) => state.setLayersOpen);
204723
204674
  const [mediaLibOpen, setMediaLibOpen] = useState(false);
204724
204675
  const drawerType = useStudioStore((state) => state.drawerType);
204725
204676
  const setDrawerType = useStudioStore((state) => state.setDrawerType);
@@ -204738,7 +204689,9 @@ function ThemeDesigner() {
204738
204689
  docIdRef.current = docId;
204739
204690
  const { modified } = useDocumentModified();
204740
204691
  const website = useWebsite();
204741
- const { schema, code, config: config2 } = useSchema(selectedContent);
204692
+ const { setViewMode } = useViewMode();
204693
+ const content = useSchema(selectedContent);
204694
+ const { schema, code, config: config2, onlyCode } = content;
204742
204695
  const fComs = useAllFrontComponents();
204743
204696
  const selectedComponent = fComs == null ? void 0 : fComs.find(
204744
204697
  (c) => c.id === (selectedContent == null ? void 0 : selectedContent.id) && (selectedContent == null ? void 0 : selectedContent.type) === ContentType.Component
@@ -204757,12 +204710,17 @@ function ThemeDesigner() {
204757
204710
  }
204758
204711
  const documentId = createDocument(schema, code, config2);
204759
204712
  setDocId(documentId || void 0);
204713
+ if (onlyCode) {
204714
+ setViewMode(ViewMode.Code);
204715
+ } else {
204716
+ setViewMode(ViewMode.Design);
204717
+ }
204760
204718
  } else {
204761
204719
  console.log("销毁 document");
204762
204720
  docIdRef.current && removeDocument(docIdRef.current);
204763
204721
  setDocId(void 0);
204764
204722
  }
204765
- }, [code, config2, createDocument, engine, removeDocument, schema]);
204723
+ }, [code, config2, createDocument, engine, removeDocument, schema, onlyCode, setViewMode]);
204766
204724
  const handleRefChange = useCallback(
204767
204725
  (el) => {
204768
204726
  var _a3, _b3;
@@ -205187,7 +205145,7 @@ function MoreActions() {
205187
205145
  ] });
205188
205146
  }
205189
205147
  const WebsiteToolbar = memo(() => {
205190
- var _a3, _b3, _c2, _d2;
205148
+ var _a3, _b3, _c2, _d2, _e2, _f2;
205191
205149
  const [isDeploying, setIsDeploying] = useState(false);
205192
205150
  const website = useWebsite();
205193
205151
  const currentLang = useCurrentLang();
@@ -205208,6 +205166,32 @@ const WebsiteToolbar = memo(() => {
205208
205166
  useEffect(() => {
205209
205167
  setSelectedContent(void 0);
205210
205168
  }, [currentLang, setSelectedContent]);
205169
+ const deployToGithub = useCallback(
205170
+ async (isStatic) => {
205171
+ const havap = isStatic;
205172
+ const formData = new FormData();
205173
+ formData.append("websiteId", (website == null ? void 0 : website.id) || "");
205174
+ formData.append("havap", String(havap));
205175
+ const files = await generateWebsiteFiles(isStatic) || [];
205176
+ const zip = new JSZip();
205177
+ traverseFiles$1(files, (file2, fullPath) => {
205178
+ if (file2.type === "folder") {
205179
+ zip.folder(fullPath);
205180
+ } else {
205181
+ zip.file(fullPath, file2.content || "");
205182
+ }
205183
+ });
205184
+ const suffix = isStatic ? "static" : "preview";
205185
+ const file = new File(
205186
+ [await zip.generateAsync({ type: "blob" })],
205187
+ `${(website == null ? void 0 : website.name) || "website"}_${suffix}.zip`,
205188
+ { type: "application/zip" }
205189
+ );
205190
+ formData.append("file", file);
205191
+ await uploadDeploymentFile(formData);
205192
+ },
205193
+ [generateWebsiteFiles, uploadDeploymentFile, website == null ? void 0 : website.id, website == null ? void 0 : website.name]
205194
+ );
205211
205195
  const deployWebsite = useCallback(async () => {
205212
205196
  var _a4, _b4;
205213
205197
  try {
@@ -205231,30 +205215,7 @@ const WebsiteToolbar = memo(() => {
205231
205215
  } finally {
205232
205216
  setIsDeploying(false);
205233
205217
  }
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
- };
205218
+ }, [deployToGithub, (_d2 = (_c2 = website == null ? void 0 : website.settings) == null ? void 0 : _c2.deployConfig) == null ? void 0 : _d2.githubPreviewRepo]);
205258
205219
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
205259
205220
  "div",
205260
205221
  {
@@ -205268,39 +205229,30 @@ const WebsiteToolbar = memo(() => {
205268
205229
  ) }),
205269
205230
  /* @__PURE__ */ jsxRuntimeExports.jsx(DeviceTabs, {}),
205270
205231
  /* @__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
- )
205232
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex gap-1 pr-4 items-center justify-end"), children: [
205233
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewModeButtons, {}),
205234
+ !!((_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(
205235
+ LangSelect,
205236
+ {
205237
+ onSelect: (langId) => navigate == null ? void 0 : navigate(`${rootPath}/${website == null ? void 0 : website.id}/lang/${langId}`)
205238
+ }
205239
+ ),
205240
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "save-action" }),
205241
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
205242
+ Button$3,
205243
+ {
205244
+ size: "sm",
205245
+ disabled: !previewUrl,
205246
+ variant: "outline",
205247
+ onClick: () => {
205248
+ window.open(previewUrl, "_blank");
205249
+ },
205250
+ children: "预览网站"
205251
+ }
205252
+ ),
205253
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$3, { size: "sm", loading: isDeploying, onClick: deployWebsite, children: "部署网站" }),
205254
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MoreActions, {})
205255
+ ] })
205304
205256
  ]
205305
205257
  }
205306
205258
  );
@@ -205368,8 +205320,10 @@ function WebsiteDesigner(props) {
205368
205320
  const engine = useDesignerEngine();
205369
205321
  const docIdRef = useRef(void 0);
205370
205322
  docIdRef.current = docId;
205371
- const { schema, code, config: config2 } = useSchema(selectedContent);
205323
+ const content = useSchema(selectedContent);
205324
+ const { schema, code, config: config2, onlyCode } = content;
205372
205325
  const loading = useStudioLoading();
205326
+ const { setViewMode } = useViewMode();
205373
205327
  useCapabilities();
205374
205328
  useEffect(() => {
205375
205329
  if (engine && schema) {
@@ -205380,6 +205334,11 @@ function WebsiteDesigner(props) {
205380
205334
  }
205381
205335
  const documentId = createDocument(schema, code, config2);
205382
205336
  setDocId(documentId || void 0);
205337
+ if (onlyCode) {
205338
+ setViewMode(ViewMode.Code);
205339
+ } else {
205340
+ setViewMode(ViewMode.Design);
205341
+ }
205383
205342
  } else {
205384
205343
  console.log("销毁 document");
205385
205344
  if (docIdRef.current) {
@@ -205388,7 +205347,7 @@ function WebsiteDesigner(props) {
205388
205347
  }
205389
205348
  setDocId(void 0);
205390
205349
  }
205391
- }, [code, config2, createDocument, engine, removeDocument, schema]);
205350
+ }, [code, config2, createDocument, engine, removeDocument, schema, onlyCode, setViewMode]);
205392
205351
  const handleRefChange = useCallback(
205393
205352
  (el) => {
205394
205353
  var _a3, _b3;
@@ -205535,4 +205494,4 @@ export {
205535
205494
  typescriptDefaults as t,
205536
205495
  useCustomizedMaterials as u
205537
205496
  };
205538
- //# sourceMappingURL=index-f5bad985.js.map
205497
+ //# sourceMappingURL=index-43a16806.js.map