@morphika/webframe 0.1.0
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/LICENSE +21 -0
- package/README.md +46 -0
- package/admin/assets.ts +4 -0
- package/admin/database.ts +4 -0
- package/admin/index.ts +6 -0
- package/admin/login.ts +4 -0
- package/admin/navigation.ts +4 -0
- package/admin/pages-editor.ts +4 -0
- package/admin/pages.ts +4 -0
- package/admin/projects-editor.ts +4 -0
- package/admin/projects.ts +4 -0
- package/admin/settings.ts +4 -0
- package/admin/setup.ts +4 -0
- package/admin/storage.ts +4 -0
- package/admin/styles.ts +4 -0
- package/app/(site)/[slug]/loading.tsx +20 -0
- package/app/(site)/[slug]/page.tsx +83 -0
- package/app/(site)/error.tsx +32 -0
- package/app/(site)/layout.tsx +53 -0
- package/app/(site)/loading.tsx +20 -0
- package/app/(site)/not-found.tsx +41 -0
- package/app/(site)/page.tsx +43 -0
- package/app/(site)/preview/page.tsx +99 -0
- package/app/(site)/work/[slug]/loading.tsx +23 -0
- package/app/(site)/work/[slug]/page.tsx +84 -0
- package/app/admin/assets/page.tsx +573 -0
- package/app/admin/database/page.tsx +302 -0
- package/app/admin/error.tsx +53 -0
- package/app/admin/layout.tsx +273 -0
- package/app/admin/login/page.tsx +88 -0
- package/app/admin/navigation/page.tsx +157 -0
- package/app/admin/page.tsx +17 -0
- package/app/admin/pages/[slug]/page.tsx +849 -0
- package/app/admin/pages/page.tsx +588 -0
- package/app/admin/projects/[slug]/page.tsx +3 -0
- package/app/admin/projects/page.tsx +669 -0
- package/app/admin/settings/page.tsx +132 -0
- package/app/admin/setup/page.tsx +64 -0
- package/app/admin/storage/page.tsx +518 -0
- package/app/admin/styles/page.tsx +243 -0
- package/app/api/admin/assets/file/route.ts +81 -0
- package/app/api/admin/assets/health/route.ts +170 -0
- package/app/api/admin/assets/register/route.ts +163 -0
- package/app/api/admin/assets/registry/route.ts +98 -0
- package/app/api/admin/assets/relink/confirm/route.ts +242 -0
- package/app/api/admin/assets/relink/route.ts +202 -0
- package/app/api/admin/assets/scan/route.ts +271 -0
- package/app/api/admin/auth/route.ts +160 -0
- package/app/api/admin/custom-sections/[slug]/route.ts +159 -0
- package/app/api/admin/custom-sections/route.ts +127 -0
- package/app/api/admin/database/route.ts +53 -0
- package/app/api/admin/pages/[slug]/duplicate/route.ts +91 -0
- package/app/api/admin/pages/[slug]/route.ts +617 -0
- package/app/api/admin/pages/[slug]/set-home/route.ts +76 -0
- package/app/api/admin/pages/route.ts +129 -0
- package/app/api/admin/preview/route.ts +53 -0
- package/app/api/admin/r2/connect/route.ts +181 -0
- package/app/api/admin/r2/delete/route.ts +198 -0
- package/app/api/admin/r2/disconnect/route.ts +42 -0
- package/app/api/admin/r2/rename/route.ts +265 -0
- package/app/api/admin/r2/status/route.ts +106 -0
- package/app/api/admin/r2/upload-url/route.ts +148 -0
- package/app/api/admin/revalidate/route.ts +55 -0
- package/app/api/admin/settings/route.ts +279 -0
- package/app/api/admin/setup/complete/route.ts +51 -0
- package/app/api/admin/setup/route.ts +118 -0
- package/app/api/admin/storage/switch/route.ts +117 -0
- package/app/api/admin/styles/fonts/route.ts +97 -0
- package/app/api/admin/styles/route.ts +304 -0
- package/app/api/assets/[...path]/route.ts +98 -0
- package/app/api/custom-sections/[id]/route.ts +43 -0
- package/app/api/draft-mode/disable/route.ts +10 -0
- package/app/api/draft-mode/enable/route.ts +26 -0
- package/app/api/projects/route.ts +42 -0
- package/app/api/styles/route.ts +88 -0
- package/app/favicon.ico +0 -0
- package/app/globals.css +7 -0
- package/app/layout.tsx +53 -0
- package/app/robots.ts +17 -0
- package/app/sitemap.ts +48 -0
- package/app/studio/[[...index]]/page.tsx +8 -0
- package/components/admin/MetadataEditor.tsx +173 -0
- package/components/admin/PublishToggle.tsx +130 -0
- package/components/admin/icons.tsx +40 -0
- package/components/admin/nav-builder/NavBuilder.tsx +182 -0
- package/components/admin/nav-builder/NavBuilderGrid.tsx +326 -0
- package/components/admin/nav-builder/NavGeneralSettings.tsx +275 -0
- package/components/admin/nav-builder/NavGridCell.tsx +48 -0
- package/components/admin/nav-builder/NavGridItem.tsx +189 -0
- package/components/admin/nav-builder/NavItemSettings.tsx +288 -0
- package/components/admin/nav-builder/NavItemTypePicker.tsx +102 -0
- package/components/admin/nav-builder/NavLivePreview.tsx +125 -0
- package/components/admin/nav-builder/NavSettingsFields.tsx +248 -0
- package/components/admin/nav-builder/NavSettingsPanel.tsx +127 -0
- package/components/admin/nav-builder/index.ts +10 -0
- package/components/admin/nav-builder/nav-builder-utils.ts +238 -0
- package/components/admin/setup-wizard/BrandingStep.tsx +218 -0
- package/components/admin/setup-wizard/DatabaseStep.tsx +331 -0
- package/components/admin/setup-wizard/DoneStep.tsx +187 -0
- package/components/admin/setup-wizard/SetupWizard.tsx +166 -0
- package/components/admin/setup-wizard/StorageStep.tsx +308 -0
- package/components/admin/setup-wizard/WelcomeStep.tsx +96 -0
- package/components/admin/setup-wizard/index.ts +9 -0
- package/components/admin/styles/ColorsEditor.tsx +214 -0
- package/components/admin/styles/FontsEditor.tsx +258 -0
- package/components/admin/styles/GridLayoutEditor.tsx +292 -0
- package/components/admin/styles/LinksButtonsEditor.tsx +120 -0
- package/components/admin/styles/TypographyEditor.tsx +266 -0
- package/components/admin/styles/index.ts +9 -0
- package/components/admin/styles/shared.tsx +68 -0
- package/components/blocks/BlockRenderer.tsx +404 -0
- package/components/blocks/ButtonBlockRenderer.tsx +52 -0
- package/components/blocks/CoverBlockRenderer.tsx +239 -0
- package/components/blocks/CustomSectionInstanceRenderer.tsx +82 -0
- package/components/blocks/EnterAnimationWrapper.tsx +140 -0
- package/components/blocks/HoverAnimationWrapper.tsx +308 -0
- package/components/blocks/ImageBlockRenderer.tsx +61 -0
- package/components/blocks/ImageGridBlockRenderer.tsx +545 -0
- package/components/blocks/PageBackground.tsx +28 -0
- package/components/blocks/PageNavAnimation.tsx +35 -0
- package/components/blocks/PageNavColor.tsx +24 -0
- package/components/blocks/PageRenderer.tsx +142 -0
- package/components/blocks/ParallaxGroupRenderer.tsx +448 -0
- package/components/blocks/ParallaxSlideRenderer.tsx +175 -0
- package/components/blocks/ProjectGridBlockRenderer.tsx +556 -0
- package/components/blocks/SectionRenderer.tsx +170 -0
- package/components/blocks/SectionV2Renderer.tsx +330 -0
- package/components/blocks/ShaderCanvas.tsx +392 -0
- package/components/blocks/SpacerBlockRenderer.tsx +17 -0
- package/components/blocks/TextBlockRenderer.tsx +87 -0
- package/components/blocks/TypewriterRichText.tsx +464 -0
- package/components/blocks/TypewriterWrapper.tsx +149 -0
- package/components/blocks/VideoBlockRenderer.tsx +304 -0
- package/components/blocks/index.ts +2 -0
- package/components/builder/AssetBrowser.tsx +2 -0
- package/components/builder/BlockLivePreview.tsx +101 -0
- package/components/builder/BlockTypePicker.tsx +178 -0
- package/components/builder/BuilderCanvas.tsx +354 -0
- package/components/builder/CanvasMinimap.tsx +200 -0
- package/components/builder/CanvasToolbar.tsx +202 -0
- package/components/builder/ColorPicker.tsx +243 -0
- package/components/builder/ColorSwatchPicker.tsx +274 -0
- package/components/builder/ColumnDragContext.tsx +51 -0
- package/components/builder/ColumnDragOverlay.tsx +110 -0
- package/components/builder/CustomSectionInstanceCard.tsx +97 -0
- package/components/builder/DeviceFrame.tsx +123 -0
- package/components/builder/DndWrapper.tsx +337 -0
- package/components/builder/InsertionLines.tsx +186 -0
- package/components/builder/ParallaxGroupCanvas.tsx +228 -0
- package/components/builder/ParallaxSlideHeader.tsx +113 -0
- package/components/builder/ReadOnlyFrame.tsx +417 -0
- package/components/builder/SectionEditorBar.tsx +288 -0
- package/components/builder/SectionTypePicker.tsx +422 -0
- package/components/builder/SectionV2Canvas.tsx +297 -0
- package/components/builder/SectionV2Column.tsx +488 -0
- package/components/builder/SettingsPanel.tsx +911 -0
- package/components/builder/SortableBlock.tsx +230 -0
- package/components/builder/SortableRow.tsx +362 -0
- package/components/builder/VirtualAssetGrid.tsx +397 -0
- package/components/builder/asset-browser/AssetBrowser.tsx +178 -0
- package/components/builder/asset-browser/FileLightbox.tsx +116 -0
- package/components/builder/asset-browser/FolderTreeItem.tsx +55 -0
- package/components/builder/asset-browser/R2BrowserContent.tsx +436 -0
- package/components/builder/asset-browser/R2ContextMenu.tsx +98 -0
- package/components/builder/asset-browser/VideoThumbnail.tsx +63 -0
- package/components/builder/asset-browser/helpers.ts +88 -0
- package/components/builder/asset-browser/index.ts +1 -0
- package/components/builder/asset-browser/types.ts +49 -0
- package/components/builder/asset-browser/useAssetBrowser.ts +344 -0
- package/components/builder/asset-browser/useR2DragDrop.ts +116 -0
- package/components/builder/asset-browser/useR2Operations.ts +189 -0
- package/components/builder/blockStyles.tsx +295 -0
- package/components/builder/editors/ButtonBlockEditor.tsx +184 -0
- package/components/builder/editors/CoverBlockEditor.tsx +488 -0
- package/components/builder/editors/EnterAnimationPicker.tsx +297 -0
- package/components/builder/editors/HoverEffectPicker.tsx +209 -0
- package/components/builder/editors/ImageBlockEditor.tsx +206 -0
- package/components/builder/editors/ImageGridBlockEditor.tsx +386 -0
- package/components/builder/editors/ProjectGridEditor.tsx +648 -0
- package/components/builder/editors/SpacerBlockEditor.tsx +167 -0
- package/components/builder/editors/StaggerSettings.tsx +108 -0
- package/components/builder/editors/TextAlignmentIcons.tsx +39 -0
- package/components/builder/editors/TextBlockEditor.tsx +462 -0
- package/components/builder/editors/TextStylePicker.tsx +183 -0
- package/components/builder/editors/VideoBlockEditor.tsx +278 -0
- package/components/builder/editors/index.ts +10 -0
- package/components/builder/editors/shared.tsx +345 -0
- package/components/builder/hooks/useColumnDrag.ts +472 -0
- package/components/builder/hooks/useColumnResize.ts +221 -0
- package/components/builder/index.ts +12 -0
- package/components/builder/live-preview/LiveButtonPreview.tsx +38 -0
- package/components/builder/live-preview/LiveCoverPreview.tsx +146 -0
- package/components/builder/live-preview/LiveImageGridPreview.tsx +123 -0
- package/components/builder/live-preview/LiveImagePreview.tsx +107 -0
- package/components/builder/live-preview/LiveProjectGridPreview.tsx +1010 -0
- package/components/builder/live-preview/LiveSpacerPreview.tsx +9 -0
- package/components/builder/live-preview/LiveTextEditor.tsx +198 -0
- package/components/builder/live-preview/LiveVideoPreview.tsx +98 -0
- package/components/builder/live-preview/index.ts +10 -0
- package/components/builder/live-preview/shared.tsx +153 -0
- package/components/builder/settings-panel/BlockLayoutTab.tsx +532 -0
- package/components/builder/settings-panel/BlockSettings.tsx +94 -0
- package/components/builder/settings-panel/ColumnV2Settings.tsx +160 -0
- package/components/builder/settings-panel/LayoutTab.tsx +310 -0
- package/components/builder/settings-panel/PageSettings.tsx +200 -0
- package/components/builder/settings-panel/ParallaxGroupSettings.tsx +118 -0
- package/components/builder/settings-panel/ParallaxSlideSettings.tsx +178 -0
- package/components/builder/settings-panel/SectionV2AnimationTab.tsx +103 -0
- package/components/builder/settings-panel/SectionV2LayoutTab.tsx +312 -0
- package/components/builder/settings-panel/SectionV2Settings.tsx +323 -0
- package/components/builder/settings-panel/TRBLInputs.tsx +51 -0
- package/components/builder/settings-panel/index.ts +19 -0
- package/components/builder/settings-panel/responsive-helpers.ts +524 -0
- package/components/ui/CustomCursor.tsx +118 -0
- package/components/ui/NavContentLightbox.tsx +152 -0
- package/components/ui/Navbar.tsx +582 -0
- package/components/ui/PortfolioTracker.tsx +87 -0
- package/components/ui/ScrollToTop.tsx +47 -0
- package/lib/animation/enter-presets.ts +147 -0
- package/lib/animation/enter-resolve.ts +90 -0
- package/lib/animation/enter-types.ts +128 -0
- package/lib/animation/hover-effect-presets.ts +210 -0
- package/lib/animation/hover-effect-types.ts +126 -0
- package/lib/asset-retry.ts +111 -0
- package/lib/assets.ts +92 -0
- package/lib/audit.ts +35 -0
- package/lib/auth-token.ts +94 -0
- package/lib/auth.ts +13 -0
- package/lib/builder/cascade-helpers.ts +51 -0
- package/lib/builder/cascade.ts +533 -0
- package/lib/builder/constants.ts +103 -0
- package/lib/builder/defaults.ts +182 -0
- package/lib/builder/history.ts +48 -0
- package/lib/builder/index.ts +21 -0
- package/lib/builder/layout-styles.ts +344 -0
- package/lib/builder/masonry.ts +166 -0
- package/lib/builder/responsive.ts +156 -0
- package/lib/builder/serializer.ts +845 -0
- package/lib/builder/store-blocks.ts +193 -0
- package/lib/builder/store-canvas.ts +319 -0
- package/lib/builder/store-helpers.ts +490 -0
- package/lib/builder/store-sections.ts +709 -0
- package/lib/builder/store.ts +333 -0
- package/lib/builder/templates.ts +297 -0
- package/lib/builder/types.ts +374 -0
- package/lib/builder/utils.ts +37 -0
- package/lib/color-utils.ts +116 -0
- package/lib/config/index.ts +57 -0
- package/lib/config/types.ts +122 -0
- package/lib/contexts/AssetContext.tsx +79 -0
- package/lib/contexts/NavAnimationContext.tsx +44 -0
- package/lib/contexts/NavColorContext.tsx +38 -0
- package/lib/contexts/PageExitContext.tsx +194 -0
- package/lib/contexts/ThumbStatusContext.tsx +83 -0
- package/lib/csrf-client.ts +34 -0
- package/lib/csrf.ts +68 -0
- package/lib/format-utils.ts +24 -0
- package/lib/hooks/useViewport.ts +42 -0
- package/lib/logger.ts +81 -0
- package/lib/revalidate.ts +23 -0
- package/lib/sanitize.ts +91 -0
- package/lib/sanity/client.ts +8 -0
- package/lib/sanity/queries.ts +486 -0
- package/lib/sanity/types.ts +869 -0
- package/lib/sanity/writeClient.ts +24 -0
- package/lib/security.ts +402 -0
- package/lib/setup/detect.ts +156 -0
- package/lib/shader/glsl/index.ts +27 -0
- package/lib/shader/glsl/pixelate.ts +51 -0
- package/lib/shader/glsl/rgb-shift.ts +45 -0
- package/lib/shader/glsl/ripple.ts +46 -0
- package/lib/shader/glsl/vertex.ts +14 -0
- package/lib/storage/index.ts +211 -0
- package/lib/storage/r2-adapter.ts +286 -0
- package/lib/storage/types.ts +125 -0
- package/lib/styles/provider.tsx +267 -0
- package/lib/thumbnails/generate.ts +151 -0
- package/lib/utils.ts +6 -0
- package/package.json +212 -0
- package/sanity/compose.ts +65 -0
- package/sanity/sanity.config.ts +126 -0
- package/sanity/schemas/assetRegistry.ts +301 -0
- package/sanity/schemas/blocks/blockLayout.ts +90 -0
- package/sanity/schemas/blocks/buttonBlock.ts +82 -0
- package/sanity/schemas/blocks/coverBlock.ts +229 -0
- package/sanity/schemas/blocks/imageBlock.ts +58 -0
- package/sanity/schemas/blocks/imageGridBlock.ts +112 -0
- package/sanity/schemas/blocks/index.ts +9 -0
- package/sanity/schemas/blocks/projectGridBlock.ts +251 -0
- package/sanity/schemas/blocks/spacerBlock.ts +41 -0
- package/sanity/schemas/blocks/textBlock.ts +139 -0
- package/sanity/schemas/blocks/videoBlock.ts +80 -0
- package/sanity/schemas/customSection.ts +69 -0
- package/sanity/schemas/customSectionInstance.ts +163 -0
- package/sanity/schemas/index.ts +111 -0
- package/sanity/schemas/objects/enterAnimationConfig.ts +72 -0
- package/sanity/schemas/objects/hoverEffectConfig.ts +90 -0
- package/sanity/schemas/objects/parallaxGroup.ts +66 -0
- package/sanity/schemas/objects/parallaxSlide.ts +217 -0
- package/sanity/schemas/objects/typewriterConfig.ts +38 -0
- package/sanity/schemas/page.ts +162 -0
- package/sanity/schemas/pageSection.ts +157 -0
- package/sanity/schemas/pageSectionV2.ts +269 -0
- package/sanity/schemas/siteSettings.ts +256 -0
- package/sanity/schemas/siteStyles.ts +210 -0
- package/site/error.ts +4 -0
- package/site/index.ts +8 -0
- package/site/not-found.ts +4 -0
- package/site/page.ts +4 -0
- package/site/preview.ts +4 -0
- package/site/robots.ts +4 -0
- package/site/sitemap.ts +4 -0
- package/site/work.ts +4 -0
- package/studio/index.ts +4 -0
- package/styles/admin.css +85 -0
- package/styles/animations.css +237 -0
- package/styles/base.css +148 -0
- package/styles/globals.css +10 -0
- package/tsconfig.json +25 -0
package/package.json
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@morphika/webframe",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Visual Page Builder — core library. A reusable website builder with visual editing, CMS integration, and asset management.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/MorphikaStudio/Morphika_Webframe.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"visual-builder",
|
|
13
|
+
"website-builder",
|
|
14
|
+
"cms",
|
|
15
|
+
"next.js",
|
|
16
|
+
"sanity",
|
|
17
|
+
"page-builder",
|
|
18
|
+
"morphika"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"admin/",
|
|
22
|
+
"app/",
|
|
23
|
+
"components/",
|
|
24
|
+
"lib/",
|
|
25
|
+
"sanity/",
|
|
26
|
+
"site/",
|
|
27
|
+
"studio/",
|
|
28
|
+
"styles/",
|
|
29
|
+
"tsconfig.json",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"!**/__tests__/",
|
|
32
|
+
"!**/*.test.ts",
|
|
33
|
+
"!**/*.test.tsx",
|
|
34
|
+
"!**/*.spec.ts",
|
|
35
|
+
"!**/*.spec.tsx",
|
|
36
|
+
"!**/archive/"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"prepack": "node scripts/prepack.mjs",
|
|
40
|
+
"postpack": "node scripts/postpack.mjs",
|
|
41
|
+
"test": "vitest",
|
|
42
|
+
"test:run": "vitest run",
|
|
43
|
+
"lint": "eslint",
|
|
44
|
+
"typecheck": "tsc --noEmit"
|
|
45
|
+
},
|
|
46
|
+
"exports": {
|
|
47
|
+
"./config": "./lib/config/index.ts",
|
|
48
|
+
"./config/types": "./lib/config/types.ts",
|
|
49
|
+
|
|
50
|
+
"./components/blocks": "./components/blocks/index.ts",
|
|
51
|
+
"./components/blocks/*": "./components/blocks/*.tsx",
|
|
52
|
+
"./components/builder": "./components/builder/index.ts",
|
|
53
|
+
"./components/builder/*": "./components/builder/*.tsx",
|
|
54
|
+
"./components/builder/editors/*": "./components/builder/editors/*.tsx",
|
|
55
|
+
"./components/builder/settings-panel": "./components/builder/settings-panel/index.ts",
|
|
56
|
+
"./components/builder/settings-panel/*": "./components/builder/settings-panel/*.tsx",
|
|
57
|
+
"./components/builder/asset-browser": "./components/builder/asset-browser/index.ts",
|
|
58
|
+
"./components/builder/asset-browser/*": "./components/builder/asset-browser/*.tsx",
|
|
59
|
+
"./components/builder/live-preview": "./components/builder/live-preview/index.ts",
|
|
60
|
+
"./components/builder/live-preview/*": "./components/builder/live-preview/*.tsx",
|
|
61
|
+
"./components/admin": "./components/admin/index.ts",
|
|
62
|
+
"./components/admin/*": "./components/admin/*.tsx",
|
|
63
|
+
"./components/admin/nav-builder": "./components/admin/nav-builder/index.ts",
|
|
64
|
+
"./components/admin/nav-builder/*": "./components/admin/nav-builder/*.tsx",
|
|
65
|
+
"./components/admin/styles": "./components/admin/styles/index.ts",
|
|
66
|
+
"./components/admin/styles/*": "./components/admin/styles/*.tsx",
|
|
67
|
+
"./components/ui/*": "./components/ui/*.tsx",
|
|
68
|
+
|
|
69
|
+
"./lib/builder": "./lib/builder/index.ts",
|
|
70
|
+
"./lib/builder/*": "./lib/builder/*.ts",
|
|
71
|
+
"./lib/sanity/client": "./lib/sanity/client.ts",
|
|
72
|
+
"./lib/sanity/writeClient": "./lib/sanity/writeClient.ts",
|
|
73
|
+
"./lib/sanity/queries": "./lib/sanity/queries.ts",
|
|
74
|
+
"./lib/sanity/types": "./lib/sanity/types.ts",
|
|
75
|
+
"./lib/animation/*": "./lib/animation/*.ts",
|
|
76
|
+
"./lib/shader/glsl": "./lib/shader/glsl/index.ts",
|
|
77
|
+
"./lib/storage": "./lib/storage/index.ts",
|
|
78
|
+
"./lib/storage/*": "./lib/storage/*.ts",
|
|
79
|
+
"./lib/contexts/*": "./lib/contexts/*.tsx",
|
|
80
|
+
"./lib/styles/provider": "./lib/styles/provider.tsx",
|
|
81
|
+
"./lib/hooks/*": "./lib/hooks/*.ts",
|
|
82
|
+
"./lib/thumbnails/*": "./lib/thumbnails/*.ts",
|
|
83
|
+
"./lib/assets": "./lib/assets.ts",
|
|
84
|
+
"./lib/auth": "./lib/auth.ts",
|
|
85
|
+
"./lib/auth-token": "./lib/auth-token.ts",
|
|
86
|
+
"./lib/csrf": "./lib/csrf.ts",
|
|
87
|
+
"./lib/csrf-client": "./lib/csrf-client.ts",
|
|
88
|
+
"./lib/security": "./lib/security.ts",
|
|
89
|
+
"./lib/sanitize": "./lib/sanitize.ts",
|
|
90
|
+
"./lib/logger": "./lib/logger.ts",
|
|
91
|
+
"./lib/audit": "./lib/audit.ts",
|
|
92
|
+
"./lib/revalidate": "./lib/revalidate.ts",
|
|
93
|
+
"./lib/color-utils": "./lib/color-utils.ts",
|
|
94
|
+
"./lib/format-utils": "./lib/format-utils.ts",
|
|
95
|
+
"./lib/utils": "./lib/utils.ts",
|
|
96
|
+
"./lib/asset-retry": "./lib/asset-retry.ts",
|
|
97
|
+
|
|
98
|
+
"./sanity/schemas": "./sanity/schemas/index.ts",
|
|
99
|
+
"./sanity/schemas/*": "./sanity/schemas/*.ts",
|
|
100
|
+
"./sanity/schemas/blocks": "./sanity/schemas/blocks/index.ts",
|
|
101
|
+
"./sanity/schemas/blocks/*": "./sanity/schemas/blocks/*.ts",
|
|
102
|
+
"./sanity/schemas/objects/*": "./sanity/schemas/objects/*.ts",
|
|
103
|
+
"./sanity/compose": "./sanity/compose.ts",
|
|
104
|
+
"./sanity/config": "./sanity/sanity.config.ts",
|
|
105
|
+
|
|
106
|
+
"./styles/base.css": "./styles/base.css",
|
|
107
|
+
"./styles/animations.css": "./styles/animations.css",
|
|
108
|
+
"./styles/admin.css": "./styles/admin.css",
|
|
109
|
+
"./styles/globals.css": "./styles/globals.css",
|
|
110
|
+
|
|
111
|
+
"./site": "./site/index.ts",
|
|
112
|
+
"./site/page": "./site/page.ts",
|
|
113
|
+
"./site/work": "./site/work.ts",
|
|
114
|
+
"./site/preview": "./site/preview.ts",
|
|
115
|
+
"./site/not-found": "./site/not-found.ts",
|
|
116
|
+
"./site/error": "./site/error.ts",
|
|
117
|
+
"./site/robots": "./site/robots.ts",
|
|
118
|
+
"./site/sitemap": "./site/sitemap.ts",
|
|
119
|
+
|
|
120
|
+
"./admin": "./admin/index.ts",
|
|
121
|
+
"./admin/login": "./admin/login.ts",
|
|
122
|
+
"./admin/pages": "./admin/pages.ts",
|
|
123
|
+
"./admin/pages/editor": "./admin/pages-editor.ts",
|
|
124
|
+
"./admin/projects": "./admin/projects.ts",
|
|
125
|
+
"./admin/projects/editor": "./admin/projects-editor.ts",
|
|
126
|
+
"./admin/styles": "./admin/styles.ts",
|
|
127
|
+
"./admin/navigation": "./admin/navigation.ts",
|
|
128
|
+
"./admin/storage": "./admin/storage.ts",
|
|
129
|
+
"./admin/assets": "./admin/assets.ts",
|
|
130
|
+
"./admin/database": "./admin/database.ts",
|
|
131
|
+
"./admin/settings": "./admin/settings.ts",
|
|
132
|
+
"./admin/setup": "./admin/setup.ts",
|
|
133
|
+
|
|
134
|
+
"./components/admin/setup-wizard": "./components/admin/setup-wizard/index.ts",
|
|
135
|
+
"./components/admin/setup-wizard/*": "./components/admin/setup-wizard/*.tsx",
|
|
136
|
+
|
|
137
|
+
"./lib/setup/detect": "./lib/setup/detect.ts",
|
|
138
|
+
|
|
139
|
+
"./studio": "./studio/index.ts",
|
|
140
|
+
|
|
141
|
+
"./api/admin/auth": "./app/api/admin/auth/route.ts",
|
|
142
|
+
"./api/admin/pages": "./app/api/admin/pages/route.ts",
|
|
143
|
+
"./api/admin/pages/slug": "./app/api/admin/pages/[slug]/route.ts",
|
|
144
|
+
"./api/admin/pages/duplicate": "./app/api/admin/pages/[slug]/duplicate/route.ts",
|
|
145
|
+
"./api/admin/pages/set-home": "./app/api/admin/pages/[slug]/set-home/route.ts",
|
|
146
|
+
"./api/admin/assets/scan": "./app/api/admin/assets/scan/route.ts",
|
|
147
|
+
"./api/admin/assets/registry": "./app/api/admin/assets/registry/route.ts",
|
|
148
|
+
"./api/admin/assets/relink": "./app/api/admin/assets/relink/route.ts",
|
|
149
|
+
"./api/admin/assets/relink-confirm": "./app/api/admin/assets/relink/confirm/route.ts",
|
|
150
|
+
"./api/admin/assets/file": "./app/api/admin/assets/file/route.ts",
|
|
151
|
+
"./api/admin/assets/register": "./app/api/admin/assets/register/route.ts",
|
|
152
|
+
"./api/admin/assets/health": "./app/api/admin/assets/health/route.ts",
|
|
153
|
+
"./api/admin/r2/connect": "./app/api/admin/r2/connect/route.ts",
|
|
154
|
+
"./api/admin/r2/disconnect": "./app/api/admin/r2/disconnect/route.ts",
|
|
155
|
+
"./api/admin/r2/status": "./app/api/admin/r2/status/route.ts",
|
|
156
|
+
"./api/admin/r2/upload-url": "./app/api/admin/r2/upload-url/route.ts",
|
|
157
|
+
"./api/admin/r2/delete": "./app/api/admin/r2/delete/route.ts",
|
|
158
|
+
"./api/admin/r2/rename": "./app/api/admin/r2/rename/route.ts",
|
|
159
|
+
"./api/admin/custom-sections": "./app/api/admin/custom-sections/route.ts",
|
|
160
|
+
"./api/admin/custom-sections/slug": "./app/api/admin/custom-sections/[slug]/route.ts",
|
|
161
|
+
"./api/admin/styles": "./app/api/admin/styles/route.ts",
|
|
162
|
+
"./api/admin/styles/fonts": "./app/api/admin/styles/fonts/route.ts",
|
|
163
|
+
"./api/admin/settings": "./app/api/admin/settings/route.ts",
|
|
164
|
+
"./api/admin/database": "./app/api/admin/database/route.ts",
|
|
165
|
+
"./api/admin/setup": "./app/api/admin/setup/route.ts",
|
|
166
|
+
"./api/admin/setup/complete": "./app/api/admin/setup/complete/route.ts",
|
|
167
|
+
"./api/admin/preview": "./app/api/admin/preview/route.ts",
|
|
168
|
+
"./api/admin/revalidate": "./app/api/admin/revalidate/route.ts",
|
|
169
|
+
"./api/admin/storage/switch": "./app/api/admin/storage/switch/route.ts",
|
|
170
|
+
"./api/styles": "./app/api/styles/route.ts",
|
|
171
|
+
"./api/projects": "./app/api/projects/route.ts",
|
|
172
|
+
"./api/assets": "./app/api/assets/[...path]/route.ts",
|
|
173
|
+
"./api/custom-sections": "./app/api/custom-sections/[id]/route.ts",
|
|
174
|
+
"./api/draft-mode/enable": "./app/api/draft-mode/enable/route.ts",
|
|
175
|
+
"./api/draft-mode/disable": "./app/api/draft-mode/disable/route.ts"
|
|
176
|
+
},
|
|
177
|
+
"peerDependencies": {
|
|
178
|
+
"next": ">=16.0.0",
|
|
179
|
+
"react": ">=19.0.0",
|
|
180
|
+
"react-dom": ">=19.0.0"
|
|
181
|
+
},
|
|
182
|
+
"dependencies": {
|
|
183
|
+
"@aws-sdk/client-s3": "^3.1021.0",
|
|
184
|
+
"@aws-sdk/s3-request-presigner": "^3.1021.0",
|
|
185
|
+
"@dnd-kit/core": "^6.3.1",
|
|
186
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
187
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
188
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
189
|
+
"next-sanity": "^12.1.5",
|
|
190
|
+
"sanity": "^5.17.1",
|
|
191
|
+
"zustand": "^5.0.12",
|
|
192
|
+
"ogl": "^1.0.8"
|
|
193
|
+
},
|
|
194
|
+
"devDependencies": {
|
|
195
|
+
"@tailwindcss/postcss": "^4",
|
|
196
|
+
"@types/node": "^20",
|
|
197
|
+
"@types/react": "^19",
|
|
198
|
+
"@types/react-dom": "^19",
|
|
199
|
+
"eslint": "^9",
|
|
200
|
+
"eslint-config-next": "16.2.1",
|
|
201
|
+
"next": "16.2.1",
|
|
202
|
+
"react": "19.2.4",
|
|
203
|
+
"react-dom": "19.2.4",
|
|
204
|
+
"tailwindcss": "^4",
|
|
205
|
+
"typescript": "^5",
|
|
206
|
+
"vitest": "^4.1.2",
|
|
207
|
+
"@testing-library/react": "^16.3.0",
|
|
208
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
209
|
+
"@testing-library/user-event": "^14.6.1",
|
|
210
|
+
"jsdom": "^26.1.0"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanity Schema Composition
|
|
3
|
+
*
|
|
4
|
+
* Merges core schemas with optional instance-specific schemas.
|
|
5
|
+
* Instance schemas with the same `name` as a core schema override the core version.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { coreSchemas } from "@morphika/webframe/sanity/schemas";
|
|
9
|
+
* import { composeSchemas } from "@morphika/webframe/sanity/compose";
|
|
10
|
+
*
|
|
11
|
+
* // Use core schemas as-is:
|
|
12
|
+
* const schemas = composeSchemas(coreSchemas);
|
|
13
|
+
*
|
|
14
|
+
* // Add custom document types:
|
|
15
|
+
* import { myCustomType } from "./schemas/myCustomType";
|
|
16
|
+
* const schemas = composeSchemas(coreSchemas, [myCustomType]);
|
|
17
|
+
*
|
|
18
|
+
* // Override a core schema:
|
|
19
|
+
* import { customPage } from "./schemas/customPage"; // name: "page"
|
|
20
|
+
* const schemas = composeSchemas(coreSchemas, [customPage]); // replaces core "page"
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
type SanitySchemaType = { name: string; [key: string]: any };
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Compose Sanity schema arrays with override-by-name deduplication.
|
|
28
|
+
*
|
|
29
|
+
* @param core - Base schema array from @morphika/webframe (required)
|
|
30
|
+
* @param instance - Optional instance-specific schemas to merge in.
|
|
31
|
+
* Schemas whose `name` matches a core schema replace the core version.
|
|
32
|
+
* Schemas with new names are appended.
|
|
33
|
+
* @returns Merged schema array ready for Sanity's `schema.types`
|
|
34
|
+
*/
|
|
35
|
+
export function composeSchemas(
|
|
36
|
+
core: SanitySchemaType[],
|
|
37
|
+
instance?: SanitySchemaType[],
|
|
38
|
+
): SanitySchemaType[] {
|
|
39
|
+
if (!instance || instance.length === 0) {
|
|
40
|
+
return [...core];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Build a map of instance schemas by name for O(1) lookup
|
|
44
|
+
const instanceByName = new Map<string, SanitySchemaType>();
|
|
45
|
+
for (const schema of instance) {
|
|
46
|
+
instanceByName.set(schema.name, schema);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Replace core schemas that have an instance override
|
|
50
|
+
const merged: SanitySchemaType[] = core.map((coreSchema) => {
|
|
51
|
+
const override = instanceByName.get(coreSchema.name);
|
|
52
|
+
if (override) {
|
|
53
|
+
instanceByName.delete(coreSchema.name); // consumed
|
|
54
|
+
return override;
|
|
55
|
+
}
|
|
56
|
+
return coreSchema;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Append any remaining instance schemas (new types, not overrides)
|
|
60
|
+
for (const schema of instanceByName.values()) {
|
|
61
|
+
merged.push(schema);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return merged;
|
|
65
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { defineConfig } from "sanity";
|
|
2
|
+
import { structureTool } from "sanity/structure";
|
|
3
|
+
import { presentationTool } from "sanity/presentation";
|
|
4
|
+
import { schemaTypes } from "./schemas";
|
|
5
|
+
import type { StructureBuilder } from "sanity/structure";
|
|
6
|
+
import { getSiteConfig } from "../lib/config";
|
|
7
|
+
|
|
8
|
+
// siteSettings is the only true singleton (one document, fixed ID)
|
|
9
|
+
const SINGLETON_TYPES = new Set(["siteSettings", "siteStyles", "assetRegistry"]);
|
|
10
|
+
|
|
11
|
+
const cfg = getSiteConfig();
|
|
12
|
+
|
|
13
|
+
// Labels for Sanity Studio sidebar — instance can override via site.config.ts
|
|
14
|
+
const labels = {
|
|
15
|
+
content: "Content",
|
|
16
|
+
masterPages: "Master Pages",
|
|
17
|
+
projects: "Projects",
|
|
18
|
+
allPages: "All Pages",
|
|
19
|
+
siteSettings: "Site Settings",
|
|
20
|
+
assetRegistry: "Asset Registry",
|
|
21
|
+
...cfg.sanity.studioLabels,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Custom sidebar structure
|
|
25
|
+
const structure = (S: StructureBuilder) =>
|
|
26
|
+
S.list()
|
|
27
|
+
.title(labels.content)
|
|
28
|
+
.items([
|
|
29
|
+
// === MASTER PAGES ===
|
|
30
|
+
// These are `page` documents filtered by page_type (not separate schema types)
|
|
31
|
+
S.listItem()
|
|
32
|
+
.title(labels.masterPages)
|
|
33
|
+
.child(
|
|
34
|
+
S.list()
|
|
35
|
+
.title(labels.masterPages)
|
|
36
|
+
.items([
|
|
37
|
+
S.listItem()
|
|
38
|
+
.title("Home")
|
|
39
|
+
.child(
|
|
40
|
+
S.documentList()
|
|
41
|
+
.title("Home")
|
|
42
|
+
.schemaType("page")
|
|
43
|
+
.filter('_type == "page" && page_type == "home"')
|
|
44
|
+
),
|
|
45
|
+
S.listItem()
|
|
46
|
+
.title("Archive")
|
|
47
|
+
.child(
|
|
48
|
+
S.documentList()
|
|
49
|
+
.title("Archive")
|
|
50
|
+
.schemaType("page")
|
|
51
|
+
.filter('_type == "page" && page_type == "archive"')
|
|
52
|
+
),
|
|
53
|
+
S.listItem()
|
|
54
|
+
.title("About")
|
|
55
|
+
.child(
|
|
56
|
+
S.documentList()
|
|
57
|
+
.title("About")
|
|
58
|
+
.schemaType("page")
|
|
59
|
+
.filter('_type == "page" && page_type == "about"')
|
|
60
|
+
),
|
|
61
|
+
S.listItem()
|
|
62
|
+
.title("Contact")
|
|
63
|
+
.child(
|
|
64
|
+
S.documentList()
|
|
65
|
+
.title("Contact")
|
|
66
|
+
.schemaType("page")
|
|
67
|
+
.filter('_type == "page" && page_type == "contact"')
|
|
68
|
+
),
|
|
69
|
+
S.divider(),
|
|
70
|
+
S.listItem()
|
|
71
|
+
.title(labels.siteSettings)
|
|
72
|
+
.child(S.document().schemaType("siteSettings").documentId("siteSettings")),
|
|
73
|
+
S.listItem()
|
|
74
|
+
.title(labels.assetRegistry)
|
|
75
|
+
.child(S.document().schemaType("assetRegistry").documentId("assetRegistry")),
|
|
76
|
+
])
|
|
77
|
+
),
|
|
78
|
+
|
|
79
|
+
S.divider(),
|
|
80
|
+
|
|
81
|
+
// === PROJECTS ===
|
|
82
|
+
// Projects are `page` documents with page_type == "project"
|
|
83
|
+
S.listItem()
|
|
84
|
+
.title(labels.projects)
|
|
85
|
+
.child(
|
|
86
|
+
S.documentList()
|
|
87
|
+
.title(labels.projects)
|
|
88
|
+
.schemaType("page")
|
|
89
|
+
.filter('_type == "page" && page_type == "project"')
|
|
90
|
+
),
|
|
91
|
+
|
|
92
|
+
S.divider(),
|
|
93
|
+
|
|
94
|
+
// === ALL PAGES ===
|
|
95
|
+
S.listItem()
|
|
96
|
+
.title(labels.allPages)
|
|
97
|
+
.schemaType("page")
|
|
98
|
+
.child(S.documentTypeList("page").title(labels.allPages)),
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
export default defineConfig({
|
|
102
|
+
name: cfg.sanity.projectName,
|
|
103
|
+
title: cfg.sanity.studioTitle,
|
|
104
|
+
|
|
105
|
+
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID || "",
|
|
106
|
+
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET || "production",
|
|
107
|
+
|
|
108
|
+
basePath: "/studio",
|
|
109
|
+
|
|
110
|
+
plugins: [
|
|
111
|
+
structureTool({ structure }),
|
|
112
|
+
presentationTool({
|
|
113
|
+
previewUrl: {
|
|
114
|
+
previewMode: {
|
|
115
|
+
enable: "/api/draft-mode/enable",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
}),
|
|
119
|
+
],
|
|
120
|
+
schema: {
|
|
121
|
+
types: schemaTypes,
|
|
122
|
+
// Prevent singletons from being created via the "New document" button
|
|
123
|
+
templates: (templates) =>
|
|
124
|
+
templates.filter(({ schemaType }) => !SINGLETON_TYPES.has(schemaType)),
|
|
125
|
+
},
|
|
126
|
+
});
|