@simpleview/cms-foundation 0.0.2 → 0.0.4

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.
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Outlet } from "react-router";
3
+ function App() {
4
+ return /* @__PURE__ */ jsx(Outlet, {});
5
+ }
6
+ export {
7
+ App
8
+ };
9
+ //# sourceMappingURL=App.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/App/App.tsx"],
4
+ "sourcesContent": ["import { Outlet } from \"react-router\";\n\nexport function App() {\n\treturn <Outlet />;\n}\n"],
5
+ "mappings": "AAGQ;AAHR,SAAS,cAAc;AAEhB,SAAS,MAAM;AACrB,SAAO,oBAAC,UAAO;AAChB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./App";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/App/index.ts"],
4
+ "sourcesContent": ["export * from \"./App\";\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,29 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Links, Meta, Scripts, ScrollRestoration } from "react-router";
3
+ const allowIndexing = process.env.NODE_ENV === "production";
4
+ function Layout({ children }) {
5
+ return /* @__PURE__ */ jsxs("html", { lang: "en", children: [
6
+ /* @__PURE__ */ jsxs("head", { children: [
7
+ /* @__PURE__ */ jsx(Meta, {}),
8
+ /* @__PURE__ */ jsx("meta", { charSet: "utf-8" }),
9
+ /* @__PURE__ */ jsx(
10
+ "meta",
11
+ {
12
+ name: "viewport",
13
+ content: "width=device-width,initial-scale=1"
14
+ }
15
+ ),
16
+ allowIndexing && /* @__PURE__ */ jsx("meta", { name: "robots", content: "noindex, nofollow" }),
17
+ /* @__PURE__ */ jsx(Links, {})
18
+ ] }),
19
+ /* @__PURE__ */ jsxs("body", { children: [
20
+ children,
21
+ /* @__PURE__ */ jsx(ScrollRestoration, {}),
22
+ /* @__PURE__ */ jsx(Scripts, {})
23
+ ] })
24
+ ] });
25
+ }
26
+ export {
27
+ Layout
28
+ };
29
+ //# sourceMappingURL=Layout.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/Layout/Layout.tsx"],
4
+ "sourcesContent": ["import { Links, Meta, Scripts, ScrollRestoration } from \"react-router\";\n\nconst allowIndexing = process.env.NODE_ENV === \"production\";\n\ninterface LayoutProps {\n\tchildren: React.ReactNode;\n}\n\nexport function Layout({ children }: LayoutProps) {\n\treturn (\n\t\t<html lang=\"en\">\n\t\t\t<head>\n\t\t\t\t<Meta />\n\t\t\t\t<meta charSet=\"utf-8\" />\n\t\t\t\t<meta\n\t\t\t\t\tname=\"viewport\"\n\t\t\t\t\tcontent=\"width=device-width,initial-scale=1\"\n\t\t\t\t/>\n\t\t\t\t{allowIndexing && (\n\t\t\t\t\t<meta name=\"robots\" content=\"noindex, nofollow\" />\n\t\t\t\t)}\n\t\t\t\t<Links />\n\t\t\t</head>\n\t\t\t<body>\n\t\t\t\t{children}\n\t\t\t\t<ScrollRestoration />\n\t\t\t\t<Scripts />\n\t\t\t</body>\n\t\t</html>\n\t);\n}\n"],
5
+ "mappings": "AAWG,SACC,KADD;AAXH,SAAS,OAAO,MAAM,SAAS,yBAAyB;AAExD,MAAM,gBAAgB,QAAQ,IAAI,aAAa;AAMxC,SAAS,OAAO,EAAE,SAAS,GAAgB;AACjD,SACC,qBAAC,UAAK,MAAK,MACV;AAAA,yBAAC,UACA;AAAA,0BAAC,QAAK;AAAA,MACN,oBAAC,UAAK,SAAQ,SAAQ;AAAA,MACtB;AAAA,QAAC;AAAA;AAAA,UACA,MAAK;AAAA,UACL,SAAQ;AAAA;AAAA,MACT;AAAA,MACC,iBACA,oBAAC,UAAK,MAAK,UAAS,SAAQ,qBAAoB;AAAA,MAEjD,oBAAC,SAAM;AAAA,OACR;AAAA,IACA,qBAAC,UACC;AAAA;AAAA,MACD,oBAAC,qBAAkB;AAAA,MACnB,oBAAC,WAAQ;AAAA,OACV;AAAA,KACD;AAEF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Layout";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/Layout/index.ts"],
4
+ "sourcesContent": ["export * from \"./Layout\";\n"],
5
+ "mappings": "AAAA,cAAc;",
6
+ "names": []
7
+ }
@@ -1,4 +1,6 @@
1
+ export * from "./App";
1
2
  export * from "./Error";
3
+ export * from "./Layout";
2
4
  export * from "./Section";
3
5
  export * from "./Unknown";
4
6
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/index.ts"],
4
- "sourcesContent": ["export * from \"./Error\";\r\nexport * from \"./Section\";\r\nexport * from \"./Unknown\";\r\n"],
5
- "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
4
+ "sourcesContent": ["export * from \"./App\";\r\nexport * from \"./Error\";\r\nexport * from \"./Layout\";\r\nexport * from \"./Section\";\r\nexport * from \"./Unknown\";\r\n"],
5
+ "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,9 @@
1
+ import { relative } from "@react-router/dev/routes";
2
+ const { index, layout, prefix, route } = relative("app/client/app");
3
+ export {
4
+ index,
5
+ layout,
6
+ prefix,
7
+ route
8
+ };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/routes/index.ts"],
4
+ "sourcesContent": ["import { type RouteConfigEntry, relative } from \"@react-router/dev/routes\";\r\n\r\nconst { index, layout, prefix, route } = relative(\"app/client/app\");\r\n\r\nexport type { RouteConfigEntry };\r\n\r\nexport { index, layout, prefix, route };\r\n"],
5
+ "mappings": "AAAA,SAAgC,gBAAgB;AAEhD,MAAM,EAAE,OAAO,QAAQ,QAAQ,MAAM,IAAI,SAAS,gBAAgB;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export declare function App(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./App";
@@ -0,0 +1,5 @@
1
+ interface LayoutProps {
2
+ children: React.ReactNode;
3
+ }
4
+ export declare function Layout({ children }: LayoutProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Layout";
@@ -1,3 +1,5 @@
1
+ export * from "./App";
1
2
  export * from "./Error";
3
+ export * from "./Layout";
2
4
  export * from "./Section";
3
5
  export * from "./Unknown";
@@ -0,0 +1,4 @@
1
+ import { type RouteConfigEntry } from "@react-router/dev/routes";
2
+ declare const index: typeof import("@react-router/dev/routes").index, layout: typeof import("@react-router/dev/routes").layout, prefix: typeof import("@react-router/dev/routes").prefix, route: typeof import("@react-router/dev/routes").route;
3
+ export type { RouteConfigEntry };
4
+ export { index, layout, prefix, route };
@@ -162,12 +162,13 @@ export interface PageData<T> {
162
162
  };
163
163
  token: string;
164
164
  }
165
- export interface CivProps<D = any> {
165
+ export interface CivProps<D = any, TD = any> {
166
166
  civid: string;
167
167
  name: string;
168
168
  type: string;
169
169
  component: string;
170
170
  content: Record<string, CivProps[]>;
171
171
  data: D;
172
+ templateData: TD;
172
173
  }
173
174
  export type ComponentMap = Record<string, React.FC<CivProps>>;
@@ -22,6 +22,12 @@ async function getPageContent(req) {
22
22
  headers["User-Agent"] = req.headers.get("user-agent") || "";
23
23
  }
24
24
  try {
25
+ console.log("Making page content request:", {
26
+ url: cmsUrl.toString(),
27
+ method: req.method,
28
+ headers,
29
+ body: data
30
+ });
25
31
  const response = await fetch(cmsUrl.toString(), {
26
32
  method: req.method,
27
33
  headers,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/getPageContent.ts"],
4
- "sourcesContent": ["import { IncomingMessage } from \"http\";\r\nimport type { CivProps, PageData } from \"../types\";\r\nimport { getCmsUrl } from \"./getCmsUrl\";\r\n\r\nexport type { PageData };\r\n\r\nexport async function getPageContent(\r\n\treq: Request\r\n): Promise<PageData<CivProps>> {\r\n\tlet data: undefined | IncomingMessage;\r\n\r\n\t// if (req.method === \"POST\") {\r\n\t// \t// if we have a POST req (most likely for Page Editor preview) then\r\n\t// \t// we'll pass the incoming req stream directly on to our outgoing\r\n\t// \t// req to the CMS. We don't do anything with the data here.\r\n\t// \tdata = req;\r\n\t// }\r\n\r\n\tconst parsed_url = new URL(req.url, \"http://placeholder.com\");\r\n\tconst cmsUrl = getCmsUrl(parsed_url.host);\r\n\r\n\tif (/\\.[^/]+$/.test(parsed_url.pathname)) {\r\n\t\t// If it's a file request, we append /content.json\r\n\t\tcmsUrl.pathname = parsed_url.pathname + \"/content.json\";\r\n\t} else {\r\n\t\t// If it's not a file request, we just append content.json since it already ends with a \"/\"\r\n\t\tcmsUrl.pathname = parsed_url.pathname + \"content.json\";\r\n\t}\r\n\r\n\tconst headers: Record<string, string> = {\r\n\t\t\"Accept-Encoding\": \"gzip\",\r\n\t};\r\n\r\n\tif (req.headers.get(\"x-real-ip\")) {\r\n\t\theaders[\"X-Forwarded-For\"] = req.headers.get(\"x-real-ip\") || \"\";\r\n\t}\r\n\tif (req.headers.get(\"x-forwarded-host\")) {\r\n\t\theaders[\"X-Forwarded-For\"] = req.headers.get(\"x-forwarded-host\") || \"\";\r\n\t}\r\n\tif (req.headers.get(\"user-agent\")) {\r\n\t\theaders[\"User-Agent\"] = req.headers.get(\"user-agent\") || \"\";\r\n\t}\r\n\r\n\ttry {\r\n\t\tconst response = await fetch(cmsUrl.toString(), {\r\n\t\t\tmethod: req.method,\r\n\t\t\theaders,\r\n\t\t\tbody: JSON.stringify(data),\r\n\t\t});\r\n\t\tconst result: PageData<CivProps> = await response.json();\r\n\r\n\t\tconst resultWithData = {\r\n\t\t\t...result,\r\n\t\t\theaders: result.headers ?? [],\r\n\t\t\tbody: result.body,\r\n\t\t};\r\n\r\n\t\treturn resultWithData;\r\n\t} catch (err: unknown) {\r\n\t\tconst status =\r\n\t\t\t(err as { response?: { status?: number } })?.response?.status ||\r\n\t\t\t500;\r\n\t\tconst message =\r\n\t\t\t(err as { response?: { statusText?: string } })?.response\r\n\t\t\t\t?.statusText || \"Server Error\";\r\n\t\tthrow new Error(`Status ${status}: ${message}`);\r\n\t}\r\n}\r\n"],
5
- "mappings": "AAAA,SAAS,uBAAuB;AAEhC,SAAS,iBAAiB;AAI1B,eAAsB,eACrB,KAC8B;AAC9B,MAAI;AASJ,QAAM,aAAa,IAAI,IAAI,IAAI,KAAK,wBAAwB;AAC5D,QAAM,SAAS,UAAU,WAAW,IAAI;AAExC,MAAI,WAAW,KAAK,WAAW,QAAQ,GAAG;AAEzC,WAAO,WAAW,WAAW,WAAW;AAAA,EACzC,OAAO;AAEN,WAAO,WAAW,WAAW,WAAW;AAAA,EACzC;AAEA,QAAM,UAAkC;AAAA,IACvC,mBAAmB;AAAA,EACpB;AAEA,MAAI,IAAI,QAAQ,IAAI,WAAW,GAAG;AACjC,YAAQ,iBAAiB,IAAI,IAAI,QAAQ,IAAI,WAAW,KAAK;AAAA,EAC9D;AACA,MAAI,IAAI,QAAQ,IAAI,kBAAkB,GAAG;AACxC,YAAQ,iBAAiB,IAAI,IAAI,QAAQ,IAAI,kBAAkB,KAAK;AAAA,EACrE;AACA,MAAI,IAAI,QAAQ,IAAI,YAAY,GAAG;AAClC,YAAQ,YAAY,IAAI,IAAI,QAAQ,IAAI,YAAY,KAAK;AAAA,EAC1D;AAEA,MAAI;AACH,UAAM,WAAW,MAAM,MAAM,OAAO,SAAS,GAAG;AAAA,MAC/C,QAAQ,IAAI;AAAA,MACZ;AAAA,MACA,MAAM,KAAK,UAAU,IAAI;AAAA,IAC1B,CAAC;AACD,UAAM,SAA6B,MAAM,SAAS,KAAK;AAEvD,UAAM,iBAAiB;AAAA,MACtB,GAAG;AAAA,MACH,SAAS,OAAO,WAAW,CAAC;AAAA,MAC5B,MAAM,OAAO;AAAA,IACd;AAEA,WAAO;AAAA,EACR,SAAS,KAAc;AACtB,UAAM,SACJ,KAA4C,UAAU,UACvD;AACD,UAAM,UACJ,KAAgD,UAC9C,cAAc;AAClB,UAAM,IAAI,MAAM,UAAU,MAAM,KAAK,OAAO,EAAE;AAAA,EAC/C;AACD;",
4
+ "sourcesContent": ["import { IncomingMessage } from \"http\";\r\nimport type { CivProps, PageData } from \"../types\";\r\nimport { getCmsUrl } from \"./getCmsUrl\";\r\n\r\nexport type { PageData };\r\n\r\nexport async function getPageContent(\r\n\treq: Request\r\n): Promise<PageData<CivProps>> {\r\n\tlet data: undefined | IncomingMessage;\r\n\r\n\t// if (req.method === \"POST\") {\r\n\t// \t// if we have a POST req (most likely for Page Editor preview) then\r\n\t// \t// we'll pass the incoming req stream directly on to our outgoing\r\n\t// \t// req to the CMS. We don't do anything with the data here.\r\n\t// \tdata = req;\r\n\t// }\r\n\r\n\tconst parsed_url = new URL(req.url, \"http://placeholder.com\");\r\n\tconst cmsUrl = getCmsUrl(parsed_url.host);\r\n\r\n\tif (/\\.[^/]+$/.test(parsed_url.pathname)) {\r\n\t\t// If it's a file request, we append /content.json\r\n\t\tcmsUrl.pathname = parsed_url.pathname + \"/content.json\";\r\n\t} else {\r\n\t\t// If it's not a file request, we just append content.json since it already ends with a \"/\"\r\n\t\tcmsUrl.pathname = parsed_url.pathname + \"content.json\";\r\n\t}\r\n\r\n\tconst headers: Record<string, string> = {\r\n\t\t\"Accept-Encoding\": \"gzip\",\r\n\t};\r\n\r\n\tif (req.headers.get(\"x-real-ip\")) {\r\n\t\theaders[\"X-Forwarded-For\"] = req.headers.get(\"x-real-ip\") || \"\";\r\n\t}\r\n\tif (req.headers.get(\"x-forwarded-host\")) {\r\n\t\theaders[\"X-Forwarded-For\"] = req.headers.get(\"x-forwarded-host\") || \"\";\r\n\t}\r\n\tif (req.headers.get(\"user-agent\")) {\r\n\t\theaders[\"User-Agent\"] = req.headers.get(\"user-agent\") || \"\";\r\n\t}\r\n\r\n\ttry {\r\n\t\tconsole.log(\"Making page content request:\", {\r\n\t\t\turl: cmsUrl.toString(),\r\n\t\t\tmethod: req.method,\r\n\t\t\theaders,\r\n\t\t\tbody: data,\r\n\t\t});\r\n\r\n\t\tconst response = await fetch(cmsUrl.toString(), {\r\n\t\t\tmethod: req.method,\r\n\t\t\theaders,\r\n\t\t\tbody: JSON.stringify(data),\r\n\t\t});\r\n\t\tconst result: PageData<CivProps> = await response.json();\r\n\r\n\t\tconst resultWithData = {\r\n\t\t\t...result,\r\n\t\t\theaders: result.headers ?? [],\r\n\t\t\tbody: result.body,\r\n\t\t};\r\n\r\n\t\treturn resultWithData;\r\n\t} catch (err: unknown) {\r\n\t\tconst status =\r\n\t\t\t(err as { response?: { status?: number } })?.response?.status ||\r\n\t\t\t500;\r\n\t\tconst message =\r\n\t\t\t(err as { response?: { statusText?: string } })?.response\r\n\t\t\t\t?.statusText || \"Server Error\";\r\n\t\tthrow new Error(`Status ${status}: ${message}`);\r\n\t}\r\n}\r\n"],
5
+ "mappings": "AAAA,SAAS,uBAAuB;AAEhC,SAAS,iBAAiB;AAI1B,eAAsB,eACrB,KAC8B;AAC9B,MAAI;AASJ,QAAM,aAAa,IAAI,IAAI,IAAI,KAAK,wBAAwB;AAC5D,QAAM,SAAS,UAAU,WAAW,IAAI;AAExC,MAAI,WAAW,KAAK,WAAW,QAAQ,GAAG;AAEzC,WAAO,WAAW,WAAW,WAAW;AAAA,EACzC,OAAO;AAEN,WAAO,WAAW,WAAW,WAAW;AAAA,EACzC;AAEA,QAAM,UAAkC;AAAA,IACvC,mBAAmB;AAAA,EACpB;AAEA,MAAI,IAAI,QAAQ,IAAI,WAAW,GAAG;AACjC,YAAQ,iBAAiB,IAAI,IAAI,QAAQ,IAAI,WAAW,KAAK;AAAA,EAC9D;AACA,MAAI,IAAI,QAAQ,IAAI,kBAAkB,GAAG;AACxC,YAAQ,iBAAiB,IAAI,IAAI,QAAQ,IAAI,kBAAkB,KAAK;AAAA,EACrE;AACA,MAAI,IAAI,QAAQ,IAAI,YAAY,GAAG;AAClC,YAAQ,YAAY,IAAI,IAAI,QAAQ,IAAI,YAAY,KAAK;AAAA,EAC1D;AAEA,MAAI;AACH,YAAQ,IAAI,gCAAgC;AAAA,MAC3C,KAAK,OAAO,SAAS;AAAA,MACrB,QAAQ,IAAI;AAAA,MACZ;AAAA,MACA,MAAM;AAAA,IACP,CAAC;AAED,UAAM,WAAW,MAAM,MAAM,OAAO,SAAS,GAAG;AAAA,MAC/C,QAAQ,IAAI;AAAA,MACZ;AAAA,MACA,MAAM,KAAK,UAAU,IAAI;AAAA,IAC1B,CAAC;AACD,UAAM,SAA6B,MAAM,SAAS,KAAK;AAEvD,UAAM,iBAAiB;AAAA,MACtB,GAAG;AAAA,MACH,SAAS,OAAO,WAAW,CAAC;AAAA,MAC5B,MAAM,OAAO;AAAA,IACd;AAEA,WAAO;AAAA,EACR,SAAS,KAAc;AACtB,UAAM,SACJ,KAA4C,UAAU,UACvD;AACD,UAAM,UACJ,KAAgD,UAC9C,cAAc;AAClB,UAAM,IAAI,MAAM,UAAU,MAAM,KAAK,OAAO,EAAE;AAAA,EAC/C;AACD;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@simpleview/cms-foundation",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Provides helper types and components to assist when working with Granicus CMS Reactor.",
5
5
  "packageManager": "yarn@4.6.0+sha224.acd0786f07ffc6c933940eb65fc1d627131ddf5455bddcc295dc90fd",
6
6
  "scripts": {
7
+ "install:host": "npm install -f --package-lock false",
7
8
  "build": "tsx build",
8
9
  "start": "tsx build --watch"
9
10
  },
@@ -22,9 +23,14 @@
22
23
  "./components": {
23
24
  "import": "./dist/components/index.js",
24
25
  "types": "./dist/types/components/index.d.ts"
26
+ },
27
+ "./routes": {
28
+ "import": "./dist/routes/index.js",
29
+ "types": "./dist/types/routes/index.d.ts"
25
30
  }
26
31
  },
27
32
  "devDependencies": {
33
+ "@react-router/dev": "7.7.0",
28
34
  "@types/node": "^24.1.0",
29
35
  "@types/react": "^19",
30
36
  "esbuild": "^0.25.8",
@@ -32,7 +38,8 @@
32
38
  "typescript": "^5.8.3"
33
39
  },
34
40
  "dependencies": {
35
- "react": "^19.1.1"
41
+ "react": "^19.1.1",
42
+ "react-router": "7.7.0"
36
43
  },
37
44
  "files": [
38
45
  "dist/"