@rxdrag/website-studio 0.0.62 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{cssMode-93f05de2.js → cssMode-1ab89064.js} +4 -4
- package/dist/{cssMode-93f05de2.js.map → cssMode-1ab89064.js.map} +1 -1
- package/dist/{freemarker2-fd9b10d3.js → freemarker2-eec5295f.js} +4 -4
- package/dist/{freemarker2-fd9b10d3.js.map → freemarker2-eec5295f.js.map} +1 -1
- package/dist/{handlebars-f1ead386.js → handlebars-0e868bca.js} +4 -4
- package/dist/{handlebars-f1ead386.js.map → handlebars-0e868bca.js.map} +1 -1
- package/dist/{html-9d030721.js → html-303f826d.js} +4 -4
- package/dist/{html-9d030721.js.map → html-303f826d.js.map} +1 -1
- package/dist/{htmlMode-30d0de91.js → htmlMode-df7aefa4.js} +4 -4
- package/dist/{htmlMode-30d0de91.js.map → htmlMode-df7aefa4.js.map} +1 -1
- package/dist/{index-e4647972.js → index-18cfb59e.js} +30 -864
- package/dist/{index-e4647972.js.map → index-18cfb59e.js.map} +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +5 -9
- package/dist/{javascript-327c666e.js → javascript-306f63bf.js} +5 -5
- package/dist/{javascript-327c666e.js.map → javascript-306f63bf.js.map} +1 -1
- package/dist/{jsonMode-5c4ceeca.js → jsonMode-7ab8006e.js} +4 -4
- package/dist/{jsonMode-5c4ceeca.js.map → jsonMode-7ab8006e.js.map} +1 -1
- package/dist/{liquid-8243f0d7.js → liquid-4d499a76.js} +4 -4
- package/dist/{liquid-8243f0d7.js.map → liquid-4d499a76.js.map} +1 -1
- package/dist/{mdx-07e52606.js → mdx-1987ac4c.js} +4 -4
- package/dist/{mdx-07e52606.js.map → mdx-1987ac4c.js.map} +1 -1
- package/dist/{python-53510841.js → python-73b3c1eb.js} +4 -4
- package/dist/{python-53510841.js.map → python-73b3c1eb.js.map} +1 -1
- package/dist/{razor-58b7df65.js → razor-aca52a13.js} +4 -4
- package/dist/{razor-58b7df65.js.map → razor-aca52a13.js.map} +1 -1
- package/dist/{tsMode-9d793b1d.js → tsMode-850582f7.js} +4 -4
- package/dist/{tsMode-9d793b1d.js.map → tsMode-850582f7.js.map} +1 -1
- package/dist/{typescript-20c35b0b.js → typescript-10c44d6d.js} +4 -4
- package/dist/{typescript-20c35b0b.js.map → typescript-10c44d6d.js.map} +1 -1
- package/dist/{xml-3f468811.js → xml-e0e5d3c2.js} +4 -4
- package/dist/{xml-3f468811.js.map → xml-e0e5d3c2.js.map} +1 -1
- package/dist/{yaml-699fe7d2.js → yaml-47ee05ee.js} +4 -4
- package/dist/{yaml-699fe7d2.js.map → yaml-47ee05ee.js.map} +1 -1
- package/package.json +20 -20
- package/dist/generator/hooks/baseFiles.d.ts +0 -90
- package/dist/generator/hooks/bases/astro.config.mjs.d.ts +0 -1
- package/dist/generator/hooks/bases/createEnv.d.ts +0 -2
- package/dist/generator/hooks/bases/favicon.svg.d.ts +0 -1
- package/dist/generator/hooks/bases/package.json.d.ts +0 -1
- package/dist/generator/hooks/bases/src/base.css.d.ts +0 -2
- package/dist/generator/hooks/bases/src/layouts/Layout.astro.d.ts +0 -1
- package/dist/generator/hooks/bases/src/lib/lib.index.d.ts +0 -1
- package/dist/generator/hooks/bases/src/pages/api/ask-for-quote.ts.d.ts +0 -1
- package/dist/generator/hooks/bases/tailwind.config.mjs.d.ts +0 -1
- package/dist/generator/hooks/bases/tsconfig.json.d.ts +0 -1
- package/dist/generator/hooks/index.d.ts +0 -4
- package/dist/generator/hooks/useExportWebsite.d.ts +0 -4
- package/dist/generator/hooks/useGetComponentFiles.d.ts +0 -5
- package/dist/generator/hooks/useGetFiles.d.ts +0 -90
- package/dist/generator/hooks/useGetFrontComponents.d.ts +0 -2
- package/dist/generator/hooks/useGetPageFiles.d.ts +0 -13
- package/dist/generator/hooks/useGetPages.d.ts +0 -2
- package/dist/generator/index.d.ts +0 -1
|
@@ -7,21 +7,20 @@ var __publicField = (obj, key2, value) => {
|
|
|
7
7
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$2, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa;
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import React__default, { createContext, useContext, useMemo, useCallback, useEffect, memo, useState, useRef, forwardRef as forwardRef$2, Component, useImperativeHandle, isValidElement, cloneElement } from "react";
|
|
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,
|
|
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, websiteToInput, TaskType, LangQueryOptions, WebsiteAssciations, ExtendFieldType, ThemeConfigAssciations, WebsiteSettingsQueryOptions, WebsiteSettingsFields, themeConfigToInputCascade, ThemeConfigEntityName, MediaType, themeConfigToInput, websiteSettingsToInput, WebsiteSettingsEntityName, WebsiteSettingsAssciations, PageEntityName, ThemeBranchEntityName, PageType, 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";
|
|
13
13
|
import { newPageMetaOptions, useWebsite, useCurrentLangId, ComponentType, MediaSingleSelectField, FullImageSelectField, useSiteId, useCurrentLang, TitleAndSlug, TitleViewField, DescriptionViewField, RxcmsMedias, SiteRoot, usePreviewUrl, LangSelect } from "@rxdrag/biz-components";
|
|
14
14
|
import clsx$1 from "clsx";
|
|
15
|
-
import { staticMaterials, useViewKey, AddablePlaceHolder,
|
|
15
|
+
import { staticMaterials, useViewKey, AddablePlaceHolder, ViewKeyProvider, ComponentTreeWidget, VariableProvider, setters, DEFUALT_DEVICE_MAP, DEFAULT_SMALLEST_DEVICE, MetaEdittingProvider, useVariables, useExecuteExpression, classListToClassName, expressionAndName, expressionTernaryName, expressionLoopName, slotContentName } from "@rxdrag/website-materials";
|
|
16
16
|
import { compileCode, AsyncFunction, transformSchemaToCode, compileAstroToReact, extractVariables, isExpression, parseExpressionValue, convertHtmlAttrToJsxAttr, transformCodeToSchema } from "@rxdrag/astro-compiler";
|
|
17
17
|
import { PageLoader, PopoverController, ModalController, AnimateController, TabsController, NumberController, FlipController, CollapseController, AosController, DEFAULT_SAMLL, DEFAULT_MEDIUM, DEFAULT_LARGE, Icon as Icon$1 } from "@rxdrag/website-lib-core";
|
|
18
18
|
import gsap$2 from "gsap";
|
|
19
|
-
import {
|
|
20
|
-
import JSZip from "jszip";
|
|
21
|
-
import { useSave, CheckCircleIcon as CheckCircleIcon$1, CloseIcon, ModalBody, AddIcon as AddIcon$1, TaskStopIcon, AiStarIcon, ConfirmDialog, SettingsIcon, ModalFooter, FavouriteIcon, LightIcon, DarkIcon, EditIcon, TextInput, Drawer, ModalHeader, ModalClose, SearchIcon, ModalContent as ModalContent$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1, WarningIcon, PinIcon, ErrorBoundary, CloneIcon, RemoveIcon, MonacoEditor, RunningIcon, StyledTooltip, PlayIcon, getTheFile, MoreIcon, CodeSyncIcon, Logo, PagesIcon, WidgetIcon, SeoIcon, TextIcon, HeadingIcon, StarIcon, ImageIcon, VideoIcon, SplineIcon, CardIcon, TableIcon, GridIcon, BoxIcon, DividerIcon, SpacerIcon, SlotIcon, LinkIcon, BreadcrumbIcon, TabsIcon, PopoverIcon, ModalIcon, FormIcon, LeafNode, GroupNode, TreeView, DesignIcon, ResetIcon, ImportIcon, AstroIcon, AddFolderIcon, MediasIcon, LanguageIcon, SettingsMinimalisticIcon, CodeSquareIcon, DownloadIcon, UploadIcon } from "@rxdrag/rxcms-common";
|
|
19
|
+
import { CheckCircleIcon as CheckCircleIcon$1, CloseIcon, ModalBody, AddIcon as AddIcon$1, TaskStopIcon, AiStarIcon, ConfirmDialog, SettingsIcon, ModalFooter, FavouriteIcon, LightIcon, DarkIcon, EditIcon, TextInput, Drawer, ModalHeader, ModalClose, SearchIcon, ModalContent as ModalContent$1, Modal as Modal$1, ModalOverlay as ModalOverlay$1, WarningIcon, PinIcon, ErrorBoundary, CloneIcon, RemoveIcon, MonacoEditor, RunningIcon, StyledTooltip, PlayIcon, getTheFile, useSave, MoreIcon, CodeSyncIcon, Logo, PagesIcon, WidgetIcon, SeoIcon, TextIcon, HeadingIcon, StarIcon, ImageIcon, VideoIcon, SplineIcon, CardIcon, TableIcon, GridIcon, BoxIcon, DividerIcon, SpacerIcon, SlotIcon, LinkIcon, BreadcrumbIcon, TabsIcon, PopoverIcon, ModalIcon, FormIcon, LeafNode, GroupNode, TreeView, DesignIcon, ResetIcon, ImportIcon, AstroIcon, AddFolderIcon, MediasIcon, LanguageIcon, SettingsMinimalisticIcon, CodeSquareIcon, DownloadIcon, UploadIcon } from "@rxdrag/rxcms-common";
|
|
22
20
|
import { create as create$4 } from "zustand";
|
|
23
21
|
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
22
|
import { Icon } from "@iconify/react";
|
|
23
|
+
import { useLazyQueryOneEntity, emitEntityChange, useEntifyEndpoint, useEntifyToken, useCreateEntityClient } from "@rxdrag/entify-hooks";
|
|
25
24
|
import { useTranslateTheme, TaskManager, useSubscribeTaskEvents, useTranslateBuiltinPage, useTranslateCustomizedPages, useTranlateComponents, useUploadDeploymentFile, WebsiteAddonContext } from "@rxdrag/website-addon";
|
|
26
25
|
import { InputField, TextareaField, toField, ColorField, SwitchField, SelectField, PasswordField, Form, CheckboxField } from "@rxdrag/fieldy-heroui";
|
|
27
26
|
import { ObjectField, useFormValue, useForm } from "@rxdrag/react-fieldy-pro";
|
|
@@ -38,7 +37,8 @@ import { cn as cn$1, Tabs as Tabs$1, TabsList, TabsTrigger, TabsContent, Button
|
|
|
38
37
|
import { isObj, isStr } from "@rxdrag/shared";
|
|
39
38
|
import { TextNodeName, CommentNodeName } from "@rxdrag/schema-pro";
|
|
40
39
|
import { emit, EVENT_ENTITY_POSTED } from "@rxdrag/entify-lib";
|
|
41
|
-
import
|
|
40
|
+
import JSZip from "jszip";
|
|
41
|
+
import { useExportWebsite, useGenerateWebsiteFiles, traverseFiles as traverseFiles$1 } from "@rxdrag/code-generator";
|
|
42
42
|
const StudioContext = createContext({});
|
|
43
43
|
function useAllFrontComponents() {
|
|
44
44
|
var _a3;
|
|
@@ -3810,836 +3810,6 @@ function useFrontComponent(name) {
|
|
|
3810
3810
|
const components = useAllComponents();
|
|
3811
3811
|
return components == null ? void 0 : components.find((c) => c.name === name);
|
|
3812
3812
|
}
|
|
3813
|
-
function useGetFrontComponents() {
|
|
3814
|
-
const query = useLazyQueryEntityList();
|
|
3815
|
-
const getFrontCompoents = useCallback(
|
|
3816
|
-
async (themeId) => {
|
|
3817
|
-
return await query(
|
|
3818
|
-
new FrontComponentQueryOptions(
|
|
3819
|
-
[
|
|
3820
|
-
FrontComponentFields.id,
|
|
3821
|
-
FrontComponentFields.name,
|
|
3822
|
-
FrontComponentFields.title,
|
|
3823
|
-
FrontComponentFields.seqValue,
|
|
3824
|
-
FrontComponentFields.updatedAt,
|
|
3825
|
-
FrontComponentFields.code,
|
|
3826
|
-
FrontComponentFields.propsSchema,
|
|
3827
|
-
FrontComponentFields.propsTest,
|
|
3828
|
-
FrontComponentFields.slots,
|
|
3829
|
-
FrontComponentFields.droppable
|
|
3830
|
-
],
|
|
3831
|
-
{
|
|
3832
|
-
where: {
|
|
3833
|
-
theme: {
|
|
3834
|
-
id: {
|
|
3835
|
-
_eq: themeId
|
|
3836
|
-
}
|
|
3837
|
-
}
|
|
3838
|
-
},
|
|
3839
|
-
orderBy: [
|
|
3840
|
-
{
|
|
3841
|
-
[FrontComponentFields.seqValue]: "asc"
|
|
3842
|
-
},
|
|
3843
|
-
{
|
|
3844
|
-
[FrontComponentFields.createdAt]: "asc"
|
|
3845
|
-
}
|
|
3846
|
-
]
|
|
3847
|
-
}
|
|
3848
|
-
).category([ComponentCategoryFields.id, ComponentCategoryFields.name]).theme().setNoQuery(!themeId).toGqlOptions()
|
|
3849
|
-
);
|
|
3850
|
-
},
|
|
3851
|
-
[query]
|
|
3852
|
-
);
|
|
3853
|
-
return getFrontCompoents;
|
|
3854
|
-
}
|
|
3855
|
-
function useGetPages() {
|
|
3856
|
-
const query = useLazyQueryEntityList();
|
|
3857
|
-
const getPages = useCallback(
|
|
3858
|
-
async (themeId) => {
|
|
3859
|
-
return await query(
|
|
3860
|
-
new PageQueryOptions(
|
|
3861
|
-
[
|
|
3862
|
-
PageFields.id,
|
|
3863
|
-
PageFields.title,
|
|
3864
|
-
PageFields.createdAt,
|
|
3865
|
-
PageFields.updatedAt,
|
|
3866
|
-
PageFields.slug,
|
|
3867
|
-
PageFields.code,
|
|
3868
|
-
PageFields.pageType,
|
|
3869
|
-
PageFields.dataSource
|
|
3870
|
-
],
|
|
3871
|
-
{
|
|
3872
|
-
where: {
|
|
3873
|
-
[PageAssciations.theme]: {
|
|
3874
|
-
id: { _eq: themeId }
|
|
3875
|
-
}
|
|
3876
|
-
},
|
|
3877
|
-
orderBy: [
|
|
3878
|
-
{
|
|
3879
|
-
createdAt: "desc"
|
|
3880
|
-
}
|
|
3881
|
-
]
|
|
3882
|
-
}
|
|
3883
|
-
).meta(newPageMetaOptions()).setNoQuery(!themeId).toGqlOptions()
|
|
3884
|
-
);
|
|
3885
|
-
},
|
|
3886
|
-
[query]
|
|
3887
|
-
);
|
|
3888
|
-
return getPages;
|
|
3889
|
-
}
|
|
3890
|
-
const packageCode = `{
|
|
3891
|
-
"name": "astro-project",
|
|
3892
|
-
"type": "module",
|
|
3893
|
-
"version": "0.0.1",
|
|
3894
|
-
"scripts": {
|
|
3895
|
-
"dev": "astro dev",
|
|
3896
|
-
"start": "astro dev",
|
|
3897
|
-
"build": "astro build",
|
|
3898
|
-
"preview": "astro preview",
|
|
3899
|
-
"astro": "astro"
|
|
3900
|
-
},
|
|
3901
|
-
"dependencies": {
|
|
3902
|
-
"@astrojs/react": "^4.2.0",
|
|
3903
|
-
"@iconify/react": "^5.0.2",
|
|
3904
|
-
"@rxdrag/website-lib": "^0.0.11",
|
|
3905
|
-
"@rxdrag/website-lib-core": "^0.0.9",
|
|
3906
|
-
"@rxdrag/slate-preview": "^1.2.55",
|
|
3907
|
-
"@rxdrag/rxcms-models": "^0.3.46",
|
|
3908
|
-
"astro": "^5.3.0",
|
|
3909
|
-
"dayjs": "^1.11.7",
|
|
3910
|
-
"gsap": "^3.12.7",
|
|
3911
|
-
"react": "^19.1.0",
|
|
3912
|
-
"react-dom": "^19.1.0"
|
|
3913
|
-
},
|
|
3914
|
-
"devDependencies": {
|
|
3915
|
-
"@astrojs/node": "^9.1.3",
|
|
3916
|
-
"@astrojs/tailwind": "^6.0.0",
|
|
3917
|
-
"@astrojs/vercel": "^8.1.2",
|
|
3918
|
-
"@tailwindcss/forms": "^0.5.7",
|
|
3919
|
-
"@tailwindcss/typography": "^0.5.13",
|
|
3920
|
-
"@types/react": "^18.2.20",
|
|
3921
|
-
"@types/react-dom": "^19.1.0",
|
|
3922
|
-
"tailwindcss": "^3.4.1"
|
|
3923
|
-
}
|
|
3924
|
-
}`;
|
|
3925
|
-
const astroConfig = `import { defineConfig } from "astro/config";
|
|
3926
|
-
import tailwind from "@astrojs/tailwind";
|
|
3927
|
-
import react from "@astrojs/react";
|
|
3928
|
-
import node from "@astrojs/node";
|
|
3929
|
-
|
|
3930
|
-
export default defineConfig({
|
|
3931
|
-
integrations: [tailwind(), react()],
|
|
3932
|
-
output: "static", // 使用服务端渲染模式
|
|
3933
|
-
adapter: node({
|
|
3934
|
-
mode: "standalone", // 使用独立模式
|
|
3935
|
-
}), // 使用 Node.js 适配器
|
|
3936
|
-
});
|
|
3937
|
-
`;
|
|
3938
|
-
const tsconfigCode = `{
|
|
3939
|
-
"extends": "astro/tsconfigs/strict",
|
|
3940
|
-
"compilerOptions": {
|
|
3941
|
-
"jsx": "react-jsx",
|
|
3942
|
-
"jsxImportSource": "react"
|
|
3943
|
-
},
|
|
3944
|
-
"include": [".astro/types.d.ts", "**/*"],
|
|
3945
|
-
"exclude": ["dist"]
|
|
3946
|
-
}
|
|
3947
|
-
`;
|
|
3948
|
-
const createEnv = (theme) => {
|
|
3949
|
-
var _a3, _b3;
|
|
3950
|
-
return `PUBLIC_ENTIFY_SERVER_URL =${ENTIFY_SERVER_URL}
|
|
3951
|
-
#测试服务器跟生产服务器
|
|
3952
|
-
PUBLIC_WEBSITE_ID = ${(_a3 = theme == null ? void 0 : theme.website) == null ? void 0 : _a3.id}
|
|
3953
|
-
#语言
|
|
3954
|
-
PUBLIC_LANGUAGE = ${(_b3 = theme == null ? void 0 : theme.lang) == null ? void 0 : _b3.abbr}
|
|
3955
|
-
#nodejs服务地址
|
|
3956
|
-
#PUBLIC_WEBSITE_ID = 4299262263296
|
|
3957
|
-
PUBLIC_ENTIFY_GUEST_TOKEN = "17bD#4!fG8^2wS*0z"
|
|
3958
|
-
`;
|
|
3959
|
-
};
|
|
3960
|
-
const gitignoreCode = `# build output
|
|
3961
|
-
dist/
|
|
3962
|
-
|
|
3963
|
-
# generated types
|
|
3964
|
-
.astro/
|
|
3965
|
-
|
|
3966
|
-
# dependencies
|
|
3967
|
-
node_modules/
|
|
3968
|
-
|
|
3969
|
-
# logs
|
|
3970
|
-
npm-debug.log*
|
|
3971
|
-
yarn-debug.log*
|
|
3972
|
-
yarn-error.log*
|
|
3973
|
-
pnpm-debug.log*
|
|
3974
|
-
|
|
3975
|
-
# environment variables
|
|
3976
|
-
.env
|
|
3977
|
-
.env.production
|
|
3978
|
-
|
|
3979
|
-
# macOS-specific files
|
|
3980
|
-
.DS_Store
|
|
3981
|
-
|
|
3982
|
-
# jetbrains setting folder
|
|
3983
|
-
.idea/
|
|
3984
|
-
|
|
3985
|
-
`;
|
|
3986
|
-
const faviconCode = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 36 36">
|
|
3987
|
-
<path fill="#000" d="M22.25 4h-8.5a1 1 0 0 0-.96.73l-5.54 19.4a.5.5 0 0 0 .62.62l5.05-1.44a2 2 0 0 0 1.38-1.4l3.22-11.66a.5.5 0 0 1 .96 0l3.22 11.67a2 2 0 0 0 1.38 1.39l5.05 1.44a.5.5 0 0 0 .62-.62l-5.54-19.4a1 1 0 0 0-.96-.73Z"/>
|
|
3988
|
-
<path fill="url(#gradient)" d="M18 28a7.63 7.63 0 0 1-3-.61v.61a3 3 0 0 0 6 0v-.61c-.94.4-1.95.61-3 .61Z"/>
|
|
3989
|
-
<defs>
|
|
3990
|
-
<linearGradient id="gradient" x1="18" x2="18" y1="28" y2="31" gradientUnits="userSpaceOnUse">
|
|
3991
|
-
<stop stop-color="#FF1639"/>
|
|
3992
|
-
<stop offset="1" stop-color="#FF1639" stop-opacity="0"/>
|
|
3993
|
-
</linearGradient>
|
|
3994
|
-
</defs>
|
|
3995
|
-
</svg>`;
|
|
3996
|
-
const createBaseCssCode = (theme) => {
|
|
3997
|
-
var _a3;
|
|
3998
|
-
return `@tailwind base;
|
|
3999
|
-
@tailwind components;
|
|
4000
|
-
@tailwind utilities;
|
|
4001
|
-
|
|
4002
|
-
${((_a3 = theme.styleConfig) == null ? void 0 : _a3.css) || ""}
|
|
4003
|
-
|
|
4004
|
-
`;
|
|
4005
|
-
};
|
|
4006
|
-
const tailwindConfigCode = `import plugin from "tailwindcss/plugin";
|
|
4007
|
-
|
|
4008
|
-
export default {
|
|
4009
|
-
darkMode: "class", // 使用class策略来控制暗色模式
|
|
4010
|
-
content: [
|
|
4011
|
-
"./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}",
|
|
4012
|
-
"node_modules/@rxdrag/website-lib/src/**/*.{js,ts,jsx,tsx}",
|
|
4013
|
-
"node_modules/@rxdrag/website-lib-core/src/**/*.{js,ts,jsx,tsx}",
|
|
4014
|
-
],
|
|
4015
|
-
theme: {
|
|
4016
|
-
extend: {},
|
|
4017
|
-
},
|
|
4018
|
-
plugins: [
|
|
4019
|
-
require("@tailwindcss/forms"),
|
|
4020
|
-
require("@tailwindcss/typography"),
|
|
4021
|
-
plugin(function ({ addVariant }) {
|
|
4022
|
-
addVariant("scrolled", ".scrolled &");
|
|
4023
|
-
addVariant("open", [".open&", ".open &"]);
|
|
4024
|
-
addVariant("actived", [".actived&", ".actived &"]);
|
|
4025
|
-
addVariant("disabled", [".disabled&", ".disabled &"]);
|
|
4026
|
-
addVariant("selected", [".selected&", ".selected &"]);
|
|
4027
|
-
}),
|
|
4028
|
-
],
|
|
4029
|
-
};
|
|
4030
|
-
|
|
4031
|
-
`;
|
|
4032
|
-
const libCode = `import {
|
|
4033
|
-
Entify,
|
|
4034
|
-
type EnvVariables,
|
|
4035
|
-
type IEntify,
|
|
4036
|
-
} from "@rxdrag/website-lib-core";
|
|
4037
|
-
|
|
4038
|
-
export function getEnvVariables(): EnvVariables {
|
|
4039
|
-
return {
|
|
4040
|
-
websiteId: ({}).PUBLIC_WEBSITE_ID,
|
|
4041
|
-
entifyServerUrl: ({}).PUBLIC_ENTIFY_SERVER_URL,
|
|
4042
|
-
entifyGuestToken: ({}).PUBLIC_ENTIFY_GUEST_TOKEN,
|
|
4043
|
-
language: ({}).PUBLIC_LANGUAGE,
|
|
4044
|
-
};
|
|
4045
|
-
}
|
|
4046
|
-
|
|
4047
|
-
export const rx = Entify.getInstance(getEnvVariables()) as IEntify;
|
|
4048
|
-
`;
|
|
4049
|
-
const layoutCode = `---
|
|
4050
|
-
import "../style.css";
|
|
4051
|
-
import { ClientRouter } from "astro:transitions";
|
|
4052
|
-
---
|
|
4053
|
-
|
|
4054
|
-
<!doctype html>
|
|
4055
|
-
<html lang="zh-CN">
|
|
4056
|
-
<head>
|
|
4057
|
-
<meta charset="UTF-8" />
|
|
4058
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
4059
|
-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
4060
|
-
<meta name="generator" content={Astro.generator} />
|
|
4061
|
-
<ClientRouter />
|
|
4062
|
-
<slot name="meta" />
|
|
4063
|
-
</head>
|
|
4064
|
-
<body>
|
|
4065
|
-
<slot />
|
|
4066
|
-
</body>
|
|
4067
|
-
</html>
|
|
4068
|
-
|
|
4069
|
-
<style>
|
|
4070
|
-
html,
|
|
4071
|
-
body {
|
|
4072
|
-
margin: 0;
|
|
4073
|
-
width: 100%;
|
|
4074
|
-
height: 100%;
|
|
4075
|
-
}
|
|
4076
|
-
</style>
|
|
4077
|
-
`;
|
|
4078
|
-
const askForQuoteCode = `import type { APIRoute } from "astro";
|
|
4079
|
-
import type {
|
|
4080
|
-
SpamFilterRule,
|
|
4081
|
-
SpamFilterRuleBoolExp,
|
|
4082
|
-
SpamFilterRuleDistinctExp,
|
|
4083
|
-
SpamFilterRuleOrderBy,
|
|
4084
|
-
} from "@rxdrag/rxcms-models";
|
|
4085
|
-
import {
|
|
4086
|
-
EnquiryAssciations,
|
|
4087
|
-
EnquiryEntityName,
|
|
4088
|
-
EnquiryFields,
|
|
4089
|
-
SpamFilterRuleFields,
|
|
4090
|
-
SpamFilterRuleQueryOptions,
|
|
4091
|
-
} from "@rxdrag/rxcms-models";
|
|
4092
|
-
import { getEnvVariables, rx } from "../../lib";
|
|
4093
|
-
import {
|
|
4094
|
-
queryWebSiteSettings,
|
|
4095
|
-
sendEmail,
|
|
4096
|
-
upsertEntity,
|
|
4097
|
-
verifyEncryption,
|
|
4098
|
-
type QuoteRequest,
|
|
4099
|
-
} from "@rxdrag/website-lib-core";
|
|
4100
|
-
|
|
4101
|
-
// 标记此页面为服务器渲染,而不是静态生成
|
|
4102
|
-
export const prerender = false;
|
|
4103
|
-
|
|
4104
|
-
export const POST: APIRoute = async ({ request }) => {
|
|
4105
|
-
try {
|
|
4106
|
-
const envVariables = getEnvVariables();
|
|
4107
|
-
|
|
4108
|
-
// 从请求中获取JSON数据
|
|
4109
|
-
let requestData: QuoteRequest;
|
|
4110
|
-
try {
|
|
4111
|
-
requestData = await request.json();
|
|
4112
|
-
} catch (error) {
|
|
4113
|
-
console.error("JSON parsing error:", error);
|
|
4114
|
-
return new Response(
|
|
4115
|
-
JSON.stringify({
|
|
4116
|
-
success: false,
|
|
4117
|
-
message: "Invalid request format",
|
|
4118
|
-
}),
|
|
4119
|
-
{
|
|
4120
|
-
status: 400,
|
|
4121
|
-
headers: {
|
|
4122
|
-
"Content-Type": "application/json",
|
|
4123
|
-
},
|
|
4124
|
-
}
|
|
4125
|
-
);
|
|
4126
|
-
}
|
|
4127
|
-
|
|
4128
|
-
// 验证蜜罐字段
|
|
4129
|
-
if (requestData.phone) {
|
|
4130
|
-
console.log("Honeypot triggered - spam submission detected");
|
|
4131
|
-
// 悄悄失败,返回成功但不处理
|
|
4132
|
-
return new Response(
|
|
4133
|
-
JSON.stringify({
|
|
4134
|
-
success: true,
|
|
4135
|
-
message:
|
|
4136
|
-
"Your enquiry has been submitted successfully, we will contact you soon",
|
|
4137
|
-
}),
|
|
4138
|
-
{
|
|
4139
|
-
status: 200,
|
|
4140
|
-
headers: {
|
|
4141
|
-
"Content-Type": "application/json",
|
|
4142
|
-
},
|
|
4143
|
-
}
|
|
4144
|
-
);
|
|
4145
|
-
}
|
|
4146
|
-
|
|
4147
|
-
// 创建实体对象 - 移除不在数据库模型中的字段
|
|
4148
|
-
const { phone, encryptedField, ...entityData } = requestData;
|
|
4149
|
-
const entity: Record<string, unknown> = { ...entityData };
|
|
4150
|
-
|
|
4151
|
-
// 检查蜜罐字段
|
|
4152
|
-
if (phone) {
|
|
4153
|
-
// 蜜罐被触发,拒绝请求
|
|
4154
|
-
return new Response(
|
|
4155
|
-
JSON.stringify({
|
|
4156
|
-
success: false,
|
|
4157
|
-
message: "Form submission rejected",
|
|
4158
|
-
}),
|
|
4159
|
-
{
|
|
4160
|
-
status: 400,
|
|
4161
|
-
headers: {
|
|
4162
|
-
"Content-Type": "application/json",
|
|
4163
|
-
},
|
|
4164
|
-
}
|
|
4165
|
-
);
|
|
4166
|
-
}
|
|
4167
|
-
|
|
4168
|
-
// 验证加密字段
|
|
4169
|
-
const isValid = verifyEncryption(
|
|
4170
|
-
//加密盐
|
|
4171
|
-
"yizhanfeinb",
|
|
4172
|
-
encryptedField,
|
|
4173
|
-
phone || "",
|
|
4174
|
-
30 // 30分钟有效期
|
|
4175
|
-
);
|
|
4176
|
-
|
|
4177
|
-
if (!isValid) {
|
|
4178
|
-
// 加密验证失败,拒绝请求
|
|
4179
|
-
return new Response(
|
|
4180
|
-
JSON.stringify({
|
|
4181
|
-
success: false,
|
|
4182
|
-
message: "Invalid form submission",
|
|
4183
|
-
}),
|
|
4184
|
-
{
|
|
4185
|
-
status: 400,
|
|
4186
|
-
headers: {
|
|
4187
|
-
"Content-Type": "application/json",
|
|
4188
|
-
},
|
|
4189
|
-
}
|
|
4190
|
-
);
|
|
4191
|
-
}
|
|
4192
|
-
|
|
4193
|
-
// 获取请求头信息
|
|
4194
|
-
const url =
|
|
4195
|
-
request.headers.get("X-Request-URL") || request.headers.get("referer");
|
|
4196
|
-
const ip =
|
|
4197
|
-
request.headers.get("X-Forwarded-For") ||
|
|
4198
|
-
request.headers.get("X-Real-IP");
|
|
4199
|
-
const userAgent = request.headers.get("user-agent");
|
|
4200
|
-
|
|
4201
|
-
// 设置额外字段
|
|
4202
|
-
entity[EnquiryFields.formIp] = ip;
|
|
4203
|
-
entity[EnquiryFields.fromUrl] = url;
|
|
4204
|
-
entity[EnquiryFields.userAgent] = userAgent;
|
|
4205
|
-
entity[EnquiryFields.read] = false;
|
|
4206
|
-
entity[EnquiryFields.spam] = false;
|
|
4207
|
-
entity[EnquiryAssciations.website] = {
|
|
4208
|
-
sync: { id: envVariables.websiteId },
|
|
4209
|
-
};
|
|
4210
|
-
|
|
4211
|
-
// 验证必填字段
|
|
4212
|
-
if (
|
|
4213
|
-
!entity[EnquiryFields.name] ||
|
|
4214
|
-
!entity[EnquiryFields.email] ||
|
|
4215
|
-
!entity[EnquiryFields.message]
|
|
4216
|
-
) {
|
|
4217
|
-
return new Response(
|
|
4218
|
-
JSON.stringify({
|
|
4219
|
-
success: false,
|
|
4220
|
-
message: "Please fill in all required fields",
|
|
4221
|
-
}),
|
|
4222
|
-
{
|
|
4223
|
-
status: 400,
|
|
4224
|
-
headers: {
|
|
4225
|
-
"Content-Type": "application/json",
|
|
4226
|
-
},
|
|
4227
|
-
}
|
|
4228
|
-
);
|
|
4229
|
-
}
|
|
4230
|
-
|
|
4231
|
-
// 垃圾信息过滤
|
|
4232
|
-
const spamRules = (
|
|
4233
|
-
await rx.queryEntityList<
|
|
4234
|
-
SpamFilterRule,
|
|
4235
|
-
SpamFilterRuleBoolExp,
|
|
4236
|
-
SpamFilterRuleOrderBy,
|
|
4237
|
-
SpamFilterRuleDistinctExp
|
|
4238
|
-
>(
|
|
4239
|
-
new SpamFilterRuleQueryOptions([
|
|
4240
|
-
SpamFilterRuleFields.emails,
|
|
4241
|
-
SpamFilterRuleFields.ips,
|
|
4242
|
-
SpamFilterRuleFields.keywords,
|
|
4243
|
-
])
|
|
4244
|
-
)
|
|
4245
|
-
)?.items as SpamFilterRule[] | undefined;
|
|
4246
|
-
|
|
4247
|
-
for (const rule of spamRules || []) {
|
|
4248
|
-
const email = (entity[EnquiryFields.email] as string)?.trim();
|
|
4249
|
-
if (
|
|
4250
|
-
!email ||
|
|
4251
|
-
rule.emails
|
|
4252
|
-
?.replace(",", ",")
|
|
4253
|
-
.split(",")
|
|
4254
|
-
.map((em) => em.trim())
|
|
4255
|
-
.includes(email) ||
|
|
4256
|
-
(ip &&
|
|
4257
|
-
rule.ips
|
|
4258
|
-
?.replace(",", ",")
|
|
4259
|
-
.split(",")
|
|
4260
|
-
.map((ipAddr) => ipAddr.trim())
|
|
4261
|
-
.includes(ip)) ||
|
|
4262
|
-
rule.keywords
|
|
4263
|
-
?.split(",")
|
|
4264
|
-
.some(
|
|
4265
|
-
(keyword: string) =>
|
|
4266
|
-
keyword &&
|
|
4267
|
-
(entity[EnquiryFields.message] as string).includes(keyword)
|
|
4268
|
-
)
|
|
4269
|
-
) {
|
|
4270
|
-
// 标记为垃圾信息并保存
|
|
4271
|
-
await upsertEntity(
|
|
4272
|
-
EnquiryEntityName,
|
|
4273
|
-
{ ...entity, spam: true, read: false },
|
|
4274
|
-
envVariables
|
|
4275
|
-
);
|
|
4276
|
-
|
|
4277
|
-
// 返回404响应,模拟原始行为
|
|
4278
|
-
return new Response(null, { status: 404 });
|
|
4279
|
-
}
|
|
4280
|
-
}
|
|
4281
|
-
|
|
4282
|
-
// 保存询价信息
|
|
4283
|
-
await upsertEntity(EnquiryEntityName, entity, envVariables);
|
|
4284
|
-
|
|
4285
|
-
// 获取网站设置并发送邮件通知
|
|
4286
|
-
const websettins = await queryWebSiteSettings(envVariables);
|
|
4287
|
-
const name = entity?.[EnquiryFields.name] as string;
|
|
4288
|
-
|
|
4289
|
-
if (websettins?.noticeEmail) {
|
|
4290
|
-
const content = \`
|
|
4291
|
-
Company: \${entity[EnquiryFields.company]}
|
|
4292
|
-
Name: \${name}
|
|
4293
|
-
Email: \${entity[EnquiryFields.email]}
|
|
4294
|
-
Message: \${entity[EnquiryFields.message]}
|
|
4295
|
-
IP: \${ip}
|
|
4296
|
-
URL: \${url}
|
|
4297
|
-
CTA: \${entity[EnquiryFields.fromCta]}
|
|
4298
|
-
userAgent: \${userAgent}
|
|
4299
|
-
\`;
|
|
4300
|
-
|
|
4301
|
-
const employeeEmail = {
|
|
4302
|
-
to: websettins?.noticeEmail,
|
|
4303
|
-
subject: "New Enquiry Received",
|
|
4304
|
-
message: content,
|
|
4305
|
-
};
|
|
4306
|
-
|
|
4307
|
-
await sendEmail(employeeEmail, envVariables);
|
|
4308
|
-
}
|
|
4309
|
-
|
|
4310
|
-
// 返回JSON响应
|
|
4311
|
-
return new Response(
|
|
4312
|
-
JSON.stringify({
|
|
4313
|
-
success: true,
|
|
4314
|
-
message:
|
|
4315
|
-
"Your enquiry has been submitted successfully, we will contact you soon",
|
|
4316
|
-
}),
|
|
4317
|
-
{
|
|
4318
|
-
status: 200,
|
|
4319
|
-
headers: {
|
|
4320
|
-
"Content-Type": "application/json",
|
|
4321
|
-
},
|
|
4322
|
-
}
|
|
4323
|
-
);
|
|
4324
|
-
} catch (error) {
|
|
4325
|
-
console.error("Error processing enquiry request:", error);
|
|
4326
|
-
|
|
4327
|
-
// 返回错误响应
|
|
4328
|
-
return new Response(
|
|
4329
|
-
JSON.stringify({
|
|
4330
|
-
success: false,
|
|
4331
|
-
message: "Submission failed, please try again later",
|
|
4332
|
-
}),
|
|
4333
|
-
{
|
|
4334
|
-
status: 500,
|
|
4335
|
-
headers: {
|
|
4336
|
-
"Content-Type": "application/json",
|
|
4337
|
-
},
|
|
4338
|
-
}
|
|
4339
|
-
);
|
|
4340
|
-
}
|
|
4341
|
-
};
|
|
4342
|
-
`;
|
|
4343
|
-
const createBaseFiles = (theme) => {
|
|
4344
|
-
return {
|
|
4345
|
-
"package.json": {
|
|
4346
|
-
file: {
|
|
4347
|
-
contents: packageCode
|
|
4348
|
-
}
|
|
4349
|
-
},
|
|
4350
|
-
".gitignore": {
|
|
4351
|
-
file: {
|
|
4352
|
-
contents: gitignoreCode
|
|
4353
|
-
}
|
|
4354
|
-
},
|
|
4355
|
-
"astro.config.mjs": {
|
|
4356
|
-
file: {
|
|
4357
|
-
contents: astroConfig
|
|
4358
|
-
}
|
|
4359
|
-
},
|
|
4360
|
-
"tsconfig.json": {
|
|
4361
|
-
file: {
|
|
4362
|
-
contents: tsconfigCode
|
|
4363
|
-
}
|
|
4364
|
-
},
|
|
4365
|
-
".env": {
|
|
4366
|
-
file: {
|
|
4367
|
-
contents: createEnv(theme)
|
|
4368
|
-
}
|
|
4369
|
-
},
|
|
4370
|
-
"tailwind.config.mjs": {
|
|
4371
|
-
file: {
|
|
4372
|
-
contents: tailwindConfigCode
|
|
4373
|
-
}
|
|
4374
|
-
},
|
|
4375
|
-
src: {
|
|
4376
|
-
directory: {
|
|
4377
|
-
layouts: {
|
|
4378
|
-
directory: {
|
|
4379
|
-
"Layout.astro": {
|
|
4380
|
-
file: {
|
|
4381
|
-
contents: layoutCode
|
|
4382
|
-
}
|
|
4383
|
-
}
|
|
4384
|
-
}
|
|
4385
|
-
},
|
|
4386
|
-
pages: {
|
|
4387
|
-
directory: {
|
|
4388
|
-
api: {
|
|
4389
|
-
directory: {
|
|
4390
|
-
"ask-for-quote.ts": {
|
|
4391
|
-
file: {
|
|
4392
|
-
contents: askForQuoteCode
|
|
4393
|
-
}
|
|
4394
|
-
}
|
|
4395
|
-
}
|
|
4396
|
-
}
|
|
4397
|
-
}
|
|
4398
|
-
},
|
|
4399
|
-
components: {
|
|
4400
|
-
directory: {}
|
|
4401
|
-
},
|
|
4402
|
-
lib: {
|
|
4403
|
-
directory: {
|
|
4404
|
-
"index.ts": {
|
|
4405
|
-
file: {
|
|
4406
|
-
contents: libCode
|
|
4407
|
-
}
|
|
4408
|
-
}
|
|
4409
|
-
}
|
|
4410
|
-
},
|
|
4411
|
-
"style.css": {
|
|
4412
|
-
file: {
|
|
4413
|
-
contents: createBaseCssCode(theme)
|
|
4414
|
-
}
|
|
4415
|
-
},
|
|
4416
|
-
"env.d.ts": {
|
|
4417
|
-
file: {
|
|
4418
|
-
contents: `/// <reference types="astro/client" />`
|
|
4419
|
-
}
|
|
4420
|
-
}
|
|
4421
|
-
}
|
|
4422
|
-
},
|
|
4423
|
-
public: {
|
|
4424
|
-
directory: {
|
|
4425
|
-
"favicon.svg": {
|
|
4426
|
-
file: {
|
|
4427
|
-
contents: faviconCode
|
|
4428
|
-
}
|
|
4429
|
-
}
|
|
4430
|
-
}
|
|
4431
|
-
}
|
|
4432
|
-
};
|
|
4433
|
-
};
|
|
4434
|
-
const PAGE_TYPE_PATHS = {
|
|
4435
|
-
[PageType.Home]: "index.astro",
|
|
4436
|
-
[PageType.Page404]: "404.astro",
|
|
4437
|
-
[PageType.PageError]: "500.astro",
|
|
4438
|
-
[PageType.Thanks]: "thanks.astro",
|
|
4439
|
-
[PageType.SearchList]: "search.astro",
|
|
4440
|
-
[PageType.Post]: "posts/[slug].astro",
|
|
4441
|
-
[PageType.PostList]: "posts/page/[page].astro",
|
|
4442
|
-
[PageType.PostCategory]: "posts/categories/[slug]/[page].astro",
|
|
4443
|
-
[PageType.Product]: "products/[slug].astro",
|
|
4444
|
-
[PageType.ProductList]: "products/page/[page].astro",
|
|
4445
|
-
[PageType.ProductCategory]: "products/categories/[slug]/[page].astro",
|
|
4446
|
-
[PageType.Profile]: "profiles/[id].astro"
|
|
4447
|
-
// 其他页面类型可以根据需要添加
|
|
4448
|
-
};
|
|
4449
|
-
const createFileEntry = (contents) => ({
|
|
4450
|
-
file: { contents }
|
|
4451
|
-
});
|
|
4452
|
-
const createDirectoryEntry = (content = {}) => ({
|
|
4453
|
-
directory: content
|
|
4454
|
-
});
|
|
4455
|
-
function useGetPageFiles() {
|
|
4456
|
-
const getPages = useGetPages();
|
|
4457
|
-
const getPageFiles = useCallback(
|
|
4458
|
-
async (themeId) => {
|
|
4459
|
-
var _a3;
|
|
4460
|
-
const pages = (_a3 = await getPages(themeId)) == null ? void 0 : _a3.items;
|
|
4461
|
-
const defaultHomeContent = `---
|
|
4462
|
-
import Layout from '../layouts/Layout.astro';
|
|
4463
|
-
---
|
|
4464
|
-
|
|
4465
|
-
<Layout>
|
|
4466
|
-
<main class="p-4 max-w-screen-lg mx-auto">
|
|
4467
|
-
<h1 class="text-3xl font-bold mb-4">欢迎访问</h1>
|
|
4468
|
-
<p class="text-lg">没有找到首页...</p>
|
|
4469
|
-
</main>
|
|
4470
|
-
</Layout>
|
|
4471
|
-
`;
|
|
4472
|
-
const initialPageFiles = {
|
|
4473
|
-
"index.astro": createFileEntry(defaultHomeContent)
|
|
4474
|
-
};
|
|
4475
|
-
const createNestedDir = (basePath, structure) => {
|
|
4476
|
-
let current = structure;
|
|
4477
|
-
for (const segment of basePath) {
|
|
4478
|
-
if (!current[segment]) {
|
|
4479
|
-
current[segment] = createDirectoryEntry();
|
|
4480
|
-
}
|
|
4481
|
-
current = current[segment].directory;
|
|
4482
|
-
}
|
|
4483
|
-
return current;
|
|
4484
|
-
};
|
|
4485
|
-
const createFileAtPath = (path, content, structure) => {
|
|
4486
|
-
const segments = path.split("/");
|
|
4487
|
-
const fileName = segments.pop() || "";
|
|
4488
|
-
if (segments.length === 0) {
|
|
4489
|
-
structure[fileName] = createFileEntry(content);
|
|
4490
|
-
} else {
|
|
4491
|
-
const dirContent = createNestedDir(segments, structure);
|
|
4492
|
-
dirContent[fileName] = createFileEntry(content);
|
|
4493
|
-
}
|
|
4494
|
-
};
|
|
4495
|
-
createNestedDir(["posts"], initialPageFiles);
|
|
4496
|
-
createNestedDir(["posts", "categories"], initialPageFiles);
|
|
4497
|
-
createNestedDir(["posts", "page"], initialPageFiles);
|
|
4498
|
-
createNestedDir(["products"], initialPageFiles);
|
|
4499
|
-
createNestedDir(["products", "categories"], initialPageFiles);
|
|
4500
|
-
createNestedDir(["products", "page"], initialPageFiles);
|
|
4501
|
-
createNestedDir(["profiles"], initialPageFiles);
|
|
4502
|
-
createNestedDir(["api"], initialPageFiles);
|
|
4503
|
-
const processedPaths = /* @__PURE__ */ new Set();
|
|
4504
|
-
if (pages && pages.length > 0) {
|
|
4505
|
-
pages.forEach((page) => {
|
|
4506
|
-
const pageContent = page.code || "";
|
|
4507
|
-
const pageType = page.pageType;
|
|
4508
|
-
const path = PAGE_TYPE_PATHS[pageType];
|
|
4509
|
-
if (path) {
|
|
4510
|
-
createFileAtPath(path, pageContent, initialPageFiles);
|
|
4511
|
-
processedPaths.add(path);
|
|
4512
|
-
} else if (page.pageType === PageType.Customized && page.slug) {
|
|
4513
|
-
const fileName = `${page.slug}.astro`;
|
|
4514
|
-
initialPageFiles[fileName] = createFileEntry(pageContent);
|
|
4515
|
-
processedPaths.add(fileName);
|
|
4516
|
-
} else {
|
|
4517
|
-
const fileName = "page.astro";
|
|
4518
|
-
initialPageFiles[fileName] = createFileEntry(pageContent);
|
|
4519
|
-
processedPaths.add(fileName);
|
|
4520
|
-
}
|
|
4521
|
-
});
|
|
4522
|
-
}
|
|
4523
|
-
return initialPageFiles;
|
|
4524
|
-
},
|
|
4525
|
-
[getPages]
|
|
4526
|
-
);
|
|
4527
|
-
return getPageFiles;
|
|
4528
|
-
}
|
|
4529
|
-
function useGetComponentFiles() {
|
|
4530
|
-
const getComponents = useGetFrontComponents();
|
|
4531
|
-
const getFiles = useCallback(
|
|
4532
|
-
async (themeId) => {
|
|
4533
|
-
var _a3;
|
|
4534
|
-
const components = (_a3 = await getComponents(themeId)) == null ? void 0 : _a3.items;
|
|
4535
|
-
const files = {};
|
|
4536
|
-
if (components && components.length > 0) {
|
|
4537
|
-
components.forEach((component) => {
|
|
4538
|
-
if (component.name && component.code) {
|
|
4539
|
-
files[`${component.name}.astro`] = {
|
|
4540
|
-
file: {
|
|
4541
|
-
contents: component.code
|
|
4542
|
-
}
|
|
4543
|
-
};
|
|
4544
|
-
}
|
|
4545
|
-
});
|
|
4546
|
-
}
|
|
4547
|
-
return files;
|
|
4548
|
-
},
|
|
4549
|
-
[getComponents]
|
|
4550
|
-
);
|
|
4551
|
-
return getFiles;
|
|
4552
|
-
}
|
|
4553
|
-
function useGetFiles() {
|
|
4554
|
-
const getPageFiles = useGetPageFiles();
|
|
4555
|
-
const getComponentFiles = useGetComponentFiles();
|
|
4556
|
-
const getFiles = useCallback(
|
|
4557
|
-
async (theme) => {
|
|
4558
|
-
if (!(theme == null ? void 0 : theme.id)) {
|
|
4559
|
-
console.error("theme is not defined");
|
|
4560
|
-
return;
|
|
4561
|
-
}
|
|
4562
|
-
const pageFiles = await getPageFiles((theme == null ? void 0 : theme.id) || void 0);
|
|
4563
|
-
const componentFiles = await getComponentFiles((theme == null ? void 0 : theme.id) || void 0);
|
|
4564
|
-
const baseFiles = createBaseFiles(theme);
|
|
4565
|
-
return {
|
|
4566
|
-
...baseFiles,
|
|
4567
|
-
src: {
|
|
4568
|
-
...baseFiles.src,
|
|
4569
|
-
directory: {
|
|
4570
|
-
...baseFiles.src.directory,
|
|
4571
|
-
components: {
|
|
4572
|
-
...baseFiles.src.directory.components,
|
|
4573
|
-
directory: {
|
|
4574
|
-
...baseFiles.src.directory.components.directory,
|
|
4575
|
-
...componentFiles
|
|
4576
|
-
}
|
|
4577
|
-
},
|
|
4578
|
-
pages: {
|
|
4579
|
-
...baseFiles.src.directory.pages,
|
|
4580
|
-
directory: {
|
|
4581
|
-
...baseFiles.src.directory.pages.directory,
|
|
4582
|
-
...pageFiles
|
|
4583
|
-
}
|
|
4584
|
-
}
|
|
4585
|
-
}
|
|
4586
|
-
}
|
|
4587
|
-
};
|
|
4588
|
-
},
|
|
4589
|
-
[getComponentFiles, getPageFiles]
|
|
4590
|
-
);
|
|
4591
|
-
return getFiles;
|
|
4592
|
-
}
|
|
4593
|
-
function useExportWebsite() {
|
|
4594
|
-
const [isExporting, setIsExporting] = useState(false);
|
|
4595
|
-
const theme = useStudioTheme();
|
|
4596
|
-
const save = useSave();
|
|
4597
|
-
const getFiles = useGetFiles();
|
|
4598
|
-
const addFilesToZip = useCallback(
|
|
4599
|
-
(zip, files, currentPath = "") => {
|
|
4600
|
-
for (const [name, content] of Object.entries(files)) {
|
|
4601
|
-
const path = currentPath ? `${currentPath}/${name}` : name;
|
|
4602
|
-
if (content.file && content.file.contents) {
|
|
4603
|
-
zip.file(path, content.file.contents);
|
|
4604
|
-
} else if (content.directory) {
|
|
4605
|
-
const folder = zip.folder(path);
|
|
4606
|
-
if (folder) {
|
|
4607
|
-
addFilesToZip(folder, content.directory, "");
|
|
4608
|
-
}
|
|
4609
|
-
} else if (typeof content === "object" && content !== null) {
|
|
4610
|
-
if (name === "src" || name === "public" || name === "components" || name === "pages") {
|
|
4611
|
-
const folder = zip.folder(path);
|
|
4612
|
-
if (folder) {
|
|
4613
|
-
addFilesToZip(folder, content, "");
|
|
4614
|
-
}
|
|
4615
|
-
} else {
|
|
4616
|
-
addFilesToZip(zip, content, path);
|
|
4617
|
-
}
|
|
4618
|
-
}
|
|
4619
|
-
}
|
|
4620
|
-
},
|
|
4621
|
-
[]
|
|
4622
|
-
);
|
|
4623
|
-
const exportWebsite = useCallback(async () => {
|
|
4624
|
-
try {
|
|
4625
|
-
if (theme == null ? void 0 : theme.id) {
|
|
4626
|
-
setIsExporting(true);
|
|
4627
|
-
const files = await getFiles(theme);
|
|
4628
|
-
const zip = new JSZip();
|
|
4629
|
-
addFilesToZip(zip, files);
|
|
4630
|
-
const content = await zip.generateAsync({ type: "blob" });
|
|
4631
|
-
const fileName = `website-${theme.name || theme.id}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}`;
|
|
4632
|
-
save(fileName, content);
|
|
4633
|
-
}
|
|
4634
|
-
} catch (e) {
|
|
4635
|
-
console.error(e);
|
|
4636
|
-
throw e;
|
|
4637
|
-
} finally {
|
|
4638
|
-
setIsExporting(false);
|
|
4639
|
-
}
|
|
4640
|
-
}, [getFiles, save, theme, addFilesToZip]);
|
|
4641
|
-
return { exportWebsite, isExporting };
|
|
4642
|
-
}
|
|
4643
3813
|
const defaultDesktopWidth = void 0;
|
|
4644
3814
|
const defaultTabletWidth = 800;
|
|
4645
3815
|
const defaultMobileWidth = 480;
|
|
@@ -136364,7 +135534,7 @@ registerLanguage({
|
|
|
136364
135534
|
aliases: ["FreeMarker2", "Apache FreeMarker2"],
|
|
136365
135535
|
loader: () => {
|
|
136366
135536
|
{
|
|
136367
|
-
return import("./freemarker2-
|
|
135537
|
+
return import("./freemarker2-eec5295f.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
136368
135538
|
}
|
|
136369
135539
|
}
|
|
136370
135540
|
});
|
|
@@ -136373,7 +135543,7 @@ registerLanguage({
|
|
|
136373
135543
|
aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"],
|
|
136374
135544
|
loader: () => {
|
|
136375
135545
|
{
|
|
136376
|
-
return import("./freemarker2-
|
|
135546
|
+
return import("./freemarker2-eec5295f.js").then((m2) => m2.TagAngleInterpolationDollar);
|
|
136377
135547
|
}
|
|
136378
135548
|
}
|
|
136379
135549
|
});
|
|
@@ -136382,7 +135552,7 @@ registerLanguage({
|
|
|
136382
135552
|
aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"],
|
|
136383
135553
|
loader: () => {
|
|
136384
135554
|
{
|
|
136385
|
-
return import("./freemarker2-
|
|
135555
|
+
return import("./freemarker2-eec5295f.js").then((m2) => m2.TagBracketInterpolationDollar);
|
|
136386
135556
|
}
|
|
136387
135557
|
}
|
|
136388
135558
|
});
|
|
@@ -136391,7 +135561,7 @@ registerLanguage({
|
|
|
136391
135561
|
aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"],
|
|
136392
135562
|
loader: () => {
|
|
136393
135563
|
{
|
|
136394
|
-
return import("./freemarker2-
|
|
135564
|
+
return import("./freemarker2-eec5295f.js").then((m2) => m2.TagAngleInterpolationBracket);
|
|
136395
135565
|
}
|
|
136396
135566
|
}
|
|
136397
135567
|
});
|
|
@@ -136400,7 +135570,7 @@ registerLanguage({
|
|
|
136400
135570
|
aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"],
|
|
136401
135571
|
loader: () => {
|
|
136402
135572
|
{
|
|
136403
|
-
return import("./freemarker2-
|
|
135573
|
+
return import("./freemarker2-eec5295f.js").then((m2) => m2.TagBracketInterpolationBracket);
|
|
136404
135574
|
}
|
|
136405
135575
|
}
|
|
136406
135576
|
});
|
|
@@ -136409,7 +135579,7 @@ registerLanguage({
|
|
|
136409
135579
|
aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"],
|
|
136410
135580
|
loader: () => {
|
|
136411
135581
|
{
|
|
136412
|
-
return import("./freemarker2-
|
|
135582
|
+
return import("./freemarker2-eec5295f.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
136413
135583
|
}
|
|
136414
135584
|
}
|
|
136415
135585
|
});
|
|
@@ -136418,7 +135588,7 @@ registerLanguage({
|
|
|
136418
135588
|
aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"],
|
|
136419
135589
|
loader: () => {
|
|
136420
135590
|
{
|
|
136421
|
-
return import("./freemarker2-
|
|
135591
|
+
return import("./freemarker2-eec5295f.js").then((m2) => m2.TagAutoInterpolationBracket);
|
|
136422
135592
|
}
|
|
136423
135593
|
}
|
|
136424
135594
|
});
|
|
@@ -136468,7 +135638,7 @@ registerLanguage({
|
|
|
136468
135638
|
mimetypes: ["text/x-handlebars-template"],
|
|
136469
135639
|
loader: () => {
|
|
136470
135640
|
{
|
|
136471
|
-
return import("./handlebars-
|
|
135641
|
+
return import("./handlebars-0e868bca.js");
|
|
136472
135642
|
}
|
|
136473
135643
|
}
|
|
136474
135644
|
});
|
|
@@ -136501,7 +135671,7 @@ registerLanguage({
|
|
|
136501
135671
|
mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
|
|
136502
135672
|
loader: () => {
|
|
136503
135673
|
{
|
|
136504
|
-
return import("./html-
|
|
135674
|
+
return import("./html-303f826d.js");
|
|
136505
135675
|
}
|
|
136506
135676
|
}
|
|
136507
135677
|
});
|
|
@@ -136554,7 +135724,7 @@ registerLanguage({
|
|
|
136554
135724
|
mimetypes: ["text/javascript"],
|
|
136555
135725
|
loader: () => {
|
|
136556
135726
|
{
|
|
136557
|
-
return import("./javascript-
|
|
135727
|
+
return import("./javascript-306f63bf.js");
|
|
136558
135728
|
}
|
|
136559
135729
|
}
|
|
136560
135730
|
});
|
|
@@ -136653,7 +135823,7 @@ registerLanguage({
|
|
|
136653
135823
|
mimetypes: ["application/liquid"],
|
|
136654
135824
|
loader: () => {
|
|
136655
135825
|
{
|
|
136656
|
-
return import("./liquid-
|
|
135826
|
+
return import("./liquid-4d499a76.js");
|
|
136657
135827
|
}
|
|
136658
135828
|
}
|
|
136659
135829
|
});
|
|
@@ -136701,7 +135871,7 @@ registerLanguage({
|
|
|
136701
135871
|
aliases: ["MDX", "mdx"],
|
|
136702
135872
|
loader: () => {
|
|
136703
135873
|
{
|
|
136704
|
-
return import("./mdx-
|
|
135874
|
+
return import("./mdx-1987ac4c.js");
|
|
136705
135875
|
}
|
|
136706
135876
|
}
|
|
136707
135877
|
});
|
|
@@ -136960,7 +136130,7 @@ registerLanguage({
|
|
|
136960
136130
|
firstLine: "^#!/.*\\bpython[0-9.-]*\\b",
|
|
136961
136131
|
loader: () => {
|
|
136962
136132
|
{
|
|
136963
|
-
return import("./python-
|
|
136133
|
+
return import("./python-73b3c1eb.js");
|
|
136964
136134
|
}
|
|
136965
136135
|
}
|
|
136966
136136
|
});
|
|
@@ -137009,7 +136179,7 @@ registerLanguage({
|
|
|
137009
136179
|
mimetypes: ["text/x-cshtml"],
|
|
137010
136180
|
loader: () => {
|
|
137011
136181
|
{
|
|
137012
|
-
return import("./razor-
|
|
136182
|
+
return import("./razor-aca52a13.js");
|
|
137013
136183
|
}
|
|
137014
136184
|
}
|
|
137015
136185
|
});
|
|
@@ -137345,7 +136515,7 @@ registerLanguage({
|
|
|
137345
136515
|
mimetypes: ["text/typescript"],
|
|
137346
136516
|
loader: () => {
|
|
137347
136517
|
{
|
|
137348
|
-
return import("./typescript-
|
|
136518
|
+
return import("./typescript-10c44d6d.js");
|
|
137349
136519
|
}
|
|
137350
136520
|
}
|
|
137351
136521
|
});
|
|
@@ -137429,7 +136599,7 @@ registerLanguage({
|
|
|
137429
136599
|
mimetypes: ["text/xml", "application/xml", "application/xaml+xml", "application/xml-dtd"],
|
|
137430
136600
|
loader: () => {
|
|
137431
136601
|
{
|
|
137432
|
-
return import("./xml-
|
|
136602
|
+
return import("./xml-e0e5d3c2.js");
|
|
137433
136603
|
}
|
|
137434
136604
|
}
|
|
137435
136605
|
});
|
|
@@ -137446,7 +136616,7 @@ registerLanguage({
|
|
|
137446
136616
|
mimetypes: ["application/x-yaml", "text/x-yaml"],
|
|
137447
136617
|
loader: () => {
|
|
137448
136618
|
{
|
|
137449
|
-
return import("./yaml-
|
|
136619
|
+
return import("./yaml-47ee05ee.js");
|
|
137450
136620
|
}
|
|
137451
136621
|
}
|
|
137452
136622
|
});
|
|
@@ -137570,7 +136740,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3(
|
|
|
137570
136740
|
monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
|
|
137571
136741
|
function getMode$3() {
|
|
137572
136742
|
{
|
|
137573
|
-
return import("./cssMode-
|
|
136743
|
+
return import("./cssMode-1ab89064.js");
|
|
137574
136744
|
}
|
|
137575
136745
|
}
|
|
137576
136746
|
monaco_editor_core_exports$3.languages.onLanguage("less", () => {
|
|
@@ -137701,7 +136871,7 @@ monaco_editor_core_exports$2.languages.html = {
|
|
|
137701
136871
|
};
|
|
137702
136872
|
function getMode$2() {
|
|
137703
136873
|
{
|
|
137704
|
-
return import("./htmlMode-
|
|
136874
|
+
return import("./htmlMode-df7aefa4.js");
|
|
137705
136875
|
}
|
|
137706
136876
|
}
|
|
137707
136877
|
function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
|
|
@@ -137799,7 +136969,7 @@ var getWorker = () => getMode$1().then((mode) => mode.getWorker());
|
|
|
137799
136969
|
monaco_editor_core_exports$1.languages.json = { jsonDefaults, getWorker };
|
|
137800
136970
|
function getMode$1() {
|
|
137801
136971
|
{
|
|
137802
|
-
return import("./jsonMode-
|
|
136972
|
+
return import("./jsonMode-7ab8006e.js");
|
|
137803
136973
|
}
|
|
137804
136974
|
}
|
|
137805
136975
|
monaco_editor_core_exports$1.languages.register({
|
|
@@ -138075,7 +137245,7 @@ monaco_editor_core_exports.languages.typescript = {
|
|
|
138075
137245
|
};
|
|
138076
137246
|
function getMode() {
|
|
138077
137247
|
{
|
|
138078
|
-
return import("./tsMode-
|
|
137248
|
+
return import("./tsMode-850582f7.js");
|
|
138079
137249
|
}
|
|
138080
137250
|
}
|
|
138081
137251
|
monaco_editor_core_exports.languages.onLanguage("typescript", () => {
|
|
@@ -204811,7 +203981,7 @@ function DownloadCodeModal(props) {
|
|
|
204811
203981
|
const { isOpen, onClose } = props;
|
|
204812
203982
|
const [selected, setSelected] = useState(DeployType.CloudarePages);
|
|
204813
203983
|
const website = useWebsite();
|
|
204814
|
-
const { exportWebsite, isExporting } = useExportWebsite
|
|
203984
|
+
const { exportWebsite, isExporting } = useExportWebsite(
|
|
204815
203985
|
website,
|
|
204816
203986
|
selected,
|
|
204817
203987
|
() => {
|
|
@@ -205425,13 +204595,9 @@ export {
|
|
|
205425
204595
|
ThemeSelectModal as T,
|
|
205426
204596
|
WebsiteStudio as W,
|
|
205427
204597
|
useFrontComponent as a,
|
|
205428
|
-
|
|
205429
|
-
useGetPages as c,
|
|
205430
|
-
useGetFiles as d,
|
|
205431
|
-
useExportWebsite as e,
|
|
205432
|
-
ThemeStudio as f,
|
|
204598
|
+
ThemeStudio as b,
|
|
205433
204599
|
monaco_editor_core_star as m,
|
|
205434
204600
|
typescriptDefaults as t,
|
|
205435
204601
|
useCustomizedMaterials as u
|
|
205436
204602
|
};
|
|
205437
|
-
//# sourceMappingURL=index-
|
|
204603
|
+
//# sourceMappingURL=index-18cfb59e.js.map
|