@cmssy/cli 12.14.2 → 13.0.1

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.
@@ -5,11 +5,13 @@ import {
5
5
  type CmssyLayoutGroup,
6
6
  } from "@cmssy/react";
7
7
  import { CmssyLazyLayout } from "@cmssy/react/client";
8
+ import type { CmssyRegion } from "@cmssy/astro";
9
+ import type { layout } from "../cmssy.config";
8
10
  import { blocks } from "./blocks";
9
11
 
10
12
  export interface LayoutSlotProps {
11
13
  groups: CmssyLayoutGroup[];
12
- position: "header" | "footer";
14
+ position: CmssyRegion<typeof layout>;
13
15
  locale: string;
14
16
  defaultLocale: string;
15
17
  enabledLocales: string[];
@@ -1,7 +1,15 @@
1
- import { defineCmssyConfig } from "@cmssy/astro";
1
+ import { defineCmssyConfig, defineCmssyLayout } from "@cmssy/astro";
2
+
3
+ export const layout = defineCmssyLayout({
4
+ regions: [
5
+ { id: "header", label: "Header" },
6
+ { id: "footer", label: "Footer" },
7
+ ],
8
+ });
2
9
 
3
10
  export const cmssy = defineCmssyConfig({
4
11
  org: process.env.CMSSY_ORG_SLUG,
5
12
  workspaceSlug: process.env.CMSSY_WORKSPACE_SLUG,
6
13
  draftSecret: process.env.CMSSY_DRAFT_SECRET,
14
+ layout,
7
15
  });
@@ -7,8 +7,15 @@ import LayoutSlot from "../../cmssy/layout-slot";
7
7
 
8
8
  export const prerender = false;
9
9
 
10
- const { page, layouts, locale, defaultLocale, enabledLocales, editorData } =
11
- await loadCmssyPage(cmssy, Astro.request, Astro.url, { blocks });
10
+ const {
11
+ page,
12
+ layouts,
13
+ locale,
14
+ defaultLocale,
15
+ enabledLocales,
16
+ editorData,
17
+ layoutRegions,
18
+ } = await loadCmssyPage(cmssy, Astro.request, Astro.url, { blocks });
12
19
  const editorOrigin = resolveEditorOrigin(cmssy.editorOrigin);
13
20
  ---
14
21
 
@@ -35,7 +42,7 @@ const editorOrigin = resolveEditorOrigin(cmssy.editorOrigin);
35
42
  locale={locale}
36
43
  defaultLocale={defaultLocale}
37
44
  enabledLocales={enabledLocales}
38
- edit={{ editorOrigin }}
45
+ edit={{ editorOrigin, layoutRegions }}
39
46
  />
40
47
  <LayoutSlot
41
48
  client:load
@@ -1,5 +1,6 @@
1
1
  import { createCmssyPage, CmssyLayoutSlot } from "@cmssy/next/server";
2
- import { cmssy } from "@/cmssy.config";
2
+ import type { CmssyRegion } from "@cmssy/next";
3
+ import { cmssy, type layout } from "@/cmssy.config";
3
4
  import { blocks } from "@/cmssy/blocks";
4
5
  import { CmssyEditor } from "@/cmssy/editor";
5
6
  import { EditableLayout } from "@/cmssy/editable-layout";
@@ -21,7 +22,7 @@ const CmssyPage = createCmssyPage(cmssy, blocks, { editor: CmssyEditor });
21
22
 
22
23
  export default async function Page(props: PageProps) {
23
24
  const { path } = await props.params;
24
- const slot = (position: "header" | "footer") => (
25
+ const slot = (position: CmssyRegion<typeof layout>) => (
25
26
  <CmssyLayoutSlot
26
27
  config={cmssy}
27
28
  blocks={blocks}
@@ -3,7 +3,8 @@ import {
3
3
  CmssyLayoutSlot,
4
4
  isCmssyEditMode,
5
5
  } from "@cmssy/next/server";
6
- import { cmssy } from "@/cmssy.config";
6
+ import type { CmssyRegion } from "@cmssy/next";
7
+ import { cmssy, type layout } from "@/cmssy.config";
7
8
  import { blocks } from "@/cmssy/blocks";
8
9
  import { CmssyEditor } from "@/cmssy/editor";
9
10
  import { EditableLayout } from "@/cmssy/editable-layout";
@@ -24,7 +25,7 @@ export default async function EditPage(props: PageProps) {
24
25
 
25
26
  const editMode = await isCmssyEditMode();
26
27
 
27
- const slot = (position: "header" | "footer") => (
28
+ const slot = (position: CmssyRegion<typeof layout>) => (
28
29
  <CmssyLayoutSlot
29
30
  config={cmssy}
30
31
  blocks={blocks}
@@ -1,7 +1,15 @@
1
- import { defineCmssyConfig } from "@cmssy/next";
1
+ import { defineCmssyConfig, defineCmssyLayout } from "@cmssy/next";
2
+
3
+ export const layout = defineCmssyLayout({
4
+ regions: [
5
+ { id: "header", label: "Header" },
6
+ { id: "footer", label: "Footer" },
7
+ ],
8
+ });
2
9
 
3
10
  export const cmssy = defineCmssyConfig({
4
11
  org: process.env.CMSSY_ORG_SLUG,
5
12
  workspaceSlug: process.env.CMSSY_WORKSPACE_SLUG,
6
13
  draftSecret: process.env.CMSSY_DRAFT_SECRET,
14
+ layout,
7
15
  });
@@ -1,4 +1,4 @@
1
- import { CmssyLazyEditor } from "@cmssy/react/client";
1
+ import { CmssyLazyEditor, type EditBridgeConfig } from "@cmssy/react/client";
2
2
  import type { CmssyPageData } from "@cmssy/core";
3
3
 
4
4
  export function CmssyEditor(props: {
@@ -6,7 +6,7 @@ export function CmssyEditor(props: {
6
6
  locale: string;
7
7
  defaultLocale: string;
8
8
  enabledLocales: string[];
9
- edit: { editorOrigin: string | string[] };
9
+ edit: EditBridgeConfig;
10
10
  }) {
11
11
  return <CmssyLazyEditor {...props} load={() => import("./blocks")} />;
12
12
  }
@@ -5,11 +5,13 @@ import {
5
5
  type CmssyLayoutGroup,
6
6
  } from "@cmssy/react";
7
7
  import { CmssyLazyLayout } from "@cmssy/react/client";
8
+ import type { CmssyRegion } from "@cmssy/remix";
9
+ import type { layout } from "../../cmssy.config";
8
10
  import { blocks } from "./blocks";
9
11
 
10
12
  export interface LayoutSlotProps {
11
13
  groups: CmssyLayoutGroup[];
12
- position: "header" | "footer";
14
+ position: CmssyRegion<typeof layout>;
13
15
  locale: string;
14
16
  defaultLocale: string;
15
17
  enabledLocales: string[];
@@ -7,8 +7,12 @@ import {
7
7
  type EditorBlockData,
8
8
  type ResolveLayoutBlockDataOptions,
9
9
  } from "@cmssy/react";
10
- import { createCmssyHeaders, createCmssyLoader } from "@cmssy/remix";
11
- import { cmssy } from "../../cmssy.config";
10
+ import {
11
+ createCmssyHeaders,
12
+ createCmssyLoader,
13
+ type CmssyRegion,
14
+ } from "@cmssy/remix";
15
+ import { cmssy, type layout } from "../../cmssy.config";
12
16
  import { blocks } from "../cmssy/blocks";
13
17
  import { CmssyEditor } from "../cmssy/editor";
14
18
  import { LayoutSlot } from "../cmssy/layout-slot";
@@ -16,7 +20,7 @@ import type { Route } from "./+types/page";
16
20
 
17
21
  const cmssyLoader = createCmssyLoader(cmssy, { blocks });
18
22
 
19
- type Position = "header" | "footer";
23
+ type Position = CmssyRegion<typeof layout>;
20
24
 
21
25
  async function resolveSlot(
22
26
  options: Omit<ResolveLayoutBlockDataOptions, "position">,
@@ -73,6 +77,7 @@ export default function CmssyPage({ loaderData }: Route.ComponentProps) {
73
77
  enabledLocales,
74
78
  isEdit,
75
79
  editorOrigin,
80
+ layoutRegions,
76
81
  diagnostics,
77
82
  layoutData,
78
83
  blockData,
@@ -105,7 +110,7 @@ export default function CmssyPage({ loaderData }: Route.ComponentProps) {
105
110
  locale={locale}
106
111
  defaultLocale={defaultLocale}
107
112
  enabledLocales={enabledLocales}
108
- edit={{ editorOrigin }}
113
+ edit={{ editorOrigin, layoutRegions }}
109
114
  />
110
115
  {slot("footer")}
111
116
  </>
@@ -1,7 +1,15 @@
1
- import { defineCmssyConfig } from "@cmssy/remix";
1
+ import { defineCmssyConfig, defineCmssyLayout } from "@cmssy/remix";
2
+
3
+ export const layout = defineCmssyLayout({
4
+ regions: [
5
+ { id: "header", label: "Header" },
6
+ { id: "footer", label: "Footer" },
7
+ ],
8
+ });
2
9
 
3
10
  export const cmssy = defineCmssyConfig({
4
11
  org: process.env.CMSSY_ORG_SLUG,
5
12
  workspaceSlug: process.env.CMSSY_WORKSPACE_SLUG,
6
13
  draftSecret: process.env.CMSSY_DRAFT_SECRET,
14
+ layout,
7
15
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/cli",
3
- "version": "12.14.2",
3
+ "version": "13.0.1",
4
4
  "description": "The cmssy CLI: `cmssy init` wires cmssy into an existing Next.js, Astro or React Router app; `cmssy link` connects it to a workspace and verifies the editor wiring.",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -27,7 +27,7 @@
27
27
  "assets"
28
28
  ],
29
29
  "dependencies": {
30
- "@cmssy/core": "12.14.2"
30
+ "@cmssy/core": "13.0.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^20.0.0",