@simpleview/cms-foundation 0.0.28 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/chunk-2WII7C3O.js +31 -0
  2. package/dist/chunk-2WII7C3O.js.map +7 -0
  3. package/dist/chunk-4LSFAAZW.js +1 -0
  4. package/dist/chunk-4LSFAAZW.js.map +7 -0
  5. package/dist/chunk-5WRI5ZAA.js +31 -0
  6. package/dist/chunk-5WRI5ZAA.js.map +7 -0
  7. package/dist/chunk-CMALSZV3.js +1 -0
  8. package/dist/chunk-CMALSZV3.js.map +7 -0
  9. package/dist/chunk-DG37VYL5.js +1 -0
  10. package/dist/chunk-DG37VYL5.js.map +7 -0
  11. package/dist/chunk-EDXU7MNB.js +39 -0
  12. package/dist/chunk-EDXU7MNB.js.map +7 -0
  13. package/dist/chunk-EEKFLXZI.js +11 -0
  14. package/dist/chunk-EEKFLXZI.js.map +7 -0
  15. package/dist/chunk-EG5F4AP4.js +1 -0
  16. package/dist/chunk-EG5F4AP4.js.map +7 -0
  17. package/dist/chunk-EWRVCIV6.js +1 -0
  18. package/dist/chunk-EWRVCIV6.js.map +7 -0
  19. package/dist/chunk-F5L7DWHD.js +1 -0
  20. package/dist/chunk-F5L7DWHD.js.map +7 -0
  21. package/dist/chunk-FJML4RHB.js +59 -0
  22. package/dist/chunk-FJML4RHB.js.map +7 -0
  23. package/dist/chunk-GPTPACV2.js +33 -0
  24. package/dist/chunk-GPTPACV2.js.map +7 -0
  25. package/dist/chunk-JT6WIXOP.js +81 -0
  26. package/dist/chunk-JT6WIXOP.js.map +7 -0
  27. package/dist/chunk-MPAGXIUB.js +11 -0
  28. package/dist/chunk-MPAGXIUB.js.map +7 -0
  29. package/dist/chunk-OEYLOZQK.js +31 -0
  30. package/dist/chunk-OEYLOZQK.js.map +7 -0
  31. package/dist/chunk-P3WX4DFS.js +93 -0
  32. package/dist/chunk-P3WX4DFS.js.map +7 -0
  33. package/dist/chunk-VV3NKXSX.js +17 -0
  34. package/dist/chunk-VV3NKXSX.js.map +7 -0
  35. package/dist/chunk-XG5CMDEI.js +1 -0
  36. package/dist/chunk-XG5CMDEI.js.map +7 -0
  37. package/dist/chunk-ZQUGFKHP.js +1 -0
  38. package/dist/chunk-ZQUGFKHP.js.map +7 -0
  39. package/dist/components/App/App.js +4 -5
  40. package/dist/components/App/App.js.map +3 -3
  41. package/dist/components/App/index.js +8 -1
  42. package/dist/components/App/index.js.map +3 -3
  43. package/dist/components/Error/Error.js +4 -11
  44. package/dist/components/Error/Error.js.map +3 -3
  45. package/dist/components/Error/Error.types.js +1 -0
  46. package/dist/components/Error/index.js +9 -2
  47. package/dist/components/Error/index.js.map +3 -3
  48. package/dist/components/Layout/Layout.js +4 -25
  49. package/dist/components/Layout/Layout.js.map +3 -3
  50. package/dist/components/Layout/index.js +8 -1
  51. package/dist/components/Layout/index.js.map +3 -3
  52. package/dist/components/Preview/PreviewCivWrapper.js +4 -25
  53. package/dist/components/Preview/PreviewCivWrapper.js.map +3 -3
  54. package/dist/components/Preview/PreviewContent.js +18 -10
  55. package/dist/components/Preview/PreviewContent.js.map +3 -3
  56. package/dist/components/Preview/PreviewPageWrapper.js +4 -85
  57. package/dist/components/Preview/PreviewPageWrapper.js.map +3 -3
  58. package/dist/components/Preview/index.js +29 -3
  59. package/dist/components/Preview/index.js.map +3 -3
  60. package/dist/components/Section/Section.js +18 -8
  61. package/dist/components/Section/Section.js.map +3 -3
  62. package/dist/components/Section/Section.types.js +1 -0
  63. package/dist/components/Section/SectionItem.js +18 -11
  64. package/dist/components/Section/SectionItem.js.map +3 -3
  65. package/dist/components/Section/SectionItemCiv.js +18 -19
  66. package/dist/components/Section/SectionItemCiv.js.map +3 -3
  67. package/dist/components/Section/index.js +25 -4
  68. package/dist/components/Section/index.js.map +3 -3
  69. package/dist/components/Unknown/Unknown.js +6 -28
  70. package/dist/components/Unknown/Unknown.js.map +3 -3
  71. package/dist/components/Unknown/index.js +10 -1
  72. package/dist/components/Unknown/index.js.map +3 -3
  73. package/dist/components/index.js +47 -6
  74. package/dist/components/index.js.map +3 -3
  75. package/dist/contexts/ComponentMapContext.js +19 -9
  76. package/dist/contexts/ComponentMapContext.js.map +3 -3
  77. package/dist/contexts/index.js +23 -1
  78. package/dist/contexts/index.js.map +3 -3
  79. package/dist/routes/index.js +7131 -2
  80. package/dist/routes/index.js.map +4 -4
  81. package/dist/types/cms.js +1 -0
  82. package/dist/types/index.js +2 -1
  83. package/dist/types/index.js.map +3 -3
  84. package/dist/utils/getCmsUrl.js +4 -5
  85. package/dist/utils/getCmsUrl.js.map +3 -3
  86. package/dist/utils/getPageContent.js +5 -50
  87. package/dist/utils/getPageContent.js.map +3 -3
  88. package/dist/utils/index.js +11 -2
  89. package/dist/utils/index.js.map +3 -3
  90. package/dist/vite/config.js +4 -33
  91. package/dist/vite/config.js.map +3 -3
  92. package/dist/vite/index.js +7 -1
  93. package/dist/vite/index.js.map +3 -3
  94. package/package.json +4 -4
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-XG5CMDEI.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-ZQUGFKHP.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,8 +1,7 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Outlet } from "react-router";
3
- function App() {
4
- return /* @__PURE__ */ jsx(Outlet, {});
5
- }
1
+ import {
2
+ App
3
+ } from "../../chunk-MPAGXIUB.js";
4
+ import "../../chunk-5WRI5ZAA.js";
6
5
  export {
7
6
  App
8
7
  };
@@ -1,7 +1,7 @@
1
1
  {
2
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;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,9 @@
1
- export * from "./App.js";
1
+ import "../../chunk-F5L7DWHD.js";
2
+ import {
3
+ App
4
+ } from "../../chunk-MPAGXIUB.js";
5
+ import "../../chunk-5WRI5ZAA.js";
6
+ export {
7
+ App
8
+ };
2
9
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/App/index.ts"],
4
- "sourcesContent": ["export * from \"./App.js\";\n"],
5
- "mappings": "AAAA,cAAc;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,14 +1,7 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- function Error({ status, message }) {
3
- return /* @__PURE__ */ jsxs(Fragment, { children: [
4
- /* @__PURE__ */ jsx("h1", { children: "Error" }),
5
- /* @__PURE__ */ jsxs("h3", { children: [
6
- "Status Code: ",
7
- status
8
- ] }),
9
- /* @__PURE__ */ jsx("p", { children: message })
10
- ] });
11
- }
1
+ import {
2
+ Error
3
+ } from "../../chunk-VV3NKXSX.js";
4
+ import "../../chunk-5WRI5ZAA.js";
12
5
  export {
13
6
  Error
14
7
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Error/Error.tsx"],
4
- "sourcesContent": ["import type { ErrorProps } from \"./Error.types.js\";\r\n\r\nexport function Error({ status, message }: ErrorProps) {\r\n\treturn (\r\n\t\t<>\r\n\t\t\t<h1>Error</h1>\r\n\t\t\t<h3>Status Code: {status}</h3>\r\n\t\t\t<p>{message}</p>\r\n\t\t</>\r\n\t);\r\n}\r\n"],
5
- "mappings": "AAIE,mBACC,KACA,YAFD;AAFK,SAAS,MAAM,EAAE,QAAQ,QAAQ,GAAe;AACtD,SACC,iCACC;AAAA,wBAAC,QAAG,mBAAK;AAAA,IACT,qBAAC,QAAG;AAAA;AAAA,MAAc;AAAA,OAAO;AAAA,IACzB,oBAAC,OAAG,mBAAQ;AAAA,KACb;AAEF;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1 +1,2 @@
1
+ import "../../chunk-EG5F4AP4.js";
1
2
  //# sourceMappingURL=Error.types.js.map
@@ -1,3 +1,10 @@
1
- export * from "./Error.js";
2
- export * from "./Error.types.js";
1
+ import "../../chunk-CMALSZV3.js";
2
+ import {
3
+ Error
4
+ } from "../../chunk-VV3NKXSX.js";
5
+ import "../../chunk-EG5F4AP4.js";
6
+ import "../../chunk-5WRI5ZAA.js";
7
+ export {
8
+ Error
9
+ };
3
10
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Error/index.ts"],
4
- "sourcesContent": ["export * from \"./Error.js\";\r\nexport * from \"./Error.types.js\";\r\n"],
5
- "mappings": "AAAA,cAAc;AACd,cAAc;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,28 +1,7 @@
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
- }
1
+ import {
2
+ Layout
3
+ } from "../../chunk-2WII7C3O.js";
4
+ import "../../chunk-5WRI5ZAA.js";
26
5
  export {
27
6
  Layout
28
7
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Layout/Layout.tsx"],
4
- "sourcesContent": ["import { Links, Meta, Scripts, ScrollRestoration } from \"react-router\";\n\n// FIXME: This is not ideal as its client-level and we really need site-level\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": "AAYG,SACC,KADD;AAZH,SAAS,OAAO,MAAM,SAAS,yBAAyB;AAGxD,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;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,9 @@
1
- export * from "./Layout.js";
1
+ import "../../chunk-XG5CMDEI.js";
2
+ import {
3
+ Layout
4
+ } from "../../chunk-2WII7C3O.js";
5
+ import "../../chunk-5WRI5ZAA.js";
6
+ export {
7
+ Layout
8
+ };
2
9
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Layout/index.ts"],
4
- "sourcesContent": ["export * from \"./Layout.js\";\n"],
5
- "mappings": "AAAA,cAAc;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,28 +1,7 @@
1
- import { jsx } from "react/jsx-runtime";
2
- function PreviewCivWrapper({
3
- children,
4
- civid,
5
- onCivEnter,
6
- highlighted,
7
- register
8
- }) {
9
- const onMouseEnter = (e) => {
10
- e.stopPropagation();
11
- onCivEnter(civid);
12
- };
13
- return /* @__PURE__ */ jsx(
14
- "div",
15
- {
16
- style: highlighted === civid ? {
17
- outlineOffset: 5,
18
- outline: "rgb(217, 83, 30) solid 7px"
19
- } : void 0,
20
- onMouseEnter,
21
- ref: register(civid),
22
- children
23
- }
24
- );
25
- }
1
+ import {
2
+ PreviewCivWrapper
3
+ } from "../../chunk-OEYLOZQK.js";
4
+ import "../../chunk-5WRI5ZAA.js";
26
5
  export {
27
6
  PreviewCivWrapper
28
7
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Preview/PreviewCivWrapper.tsx"],
4
- "sourcesContent": ["import type { PropsWithChildren, MouseEventHandler } from \"react\";\r\nimport type { PreviewContextState } from \"./PreviewPageWrapper.js\";\r\n\r\ntype PreviewCivWrapper = PropsWithChildren<{\r\n\tcivid: string;\r\n}> &\r\n\tPreviewContextState;\r\n\r\nexport function PreviewCivWrapper({\r\n\tchildren,\r\n\tcivid,\r\n\tonCivEnter,\r\n\thighlighted,\r\n\tregister,\r\n}: PreviewCivWrapper) {\r\n\tconst onMouseEnter: MouseEventHandler = (e) => {\r\n\t\te.stopPropagation();\r\n\t\tonCivEnter(civid);\r\n\t};\r\n\r\n\treturn (\r\n\t\t<div\r\n\t\t\tstyle={\r\n\t\t\t\thighlighted === civid\r\n\t\t\t\t\t? {\r\n\t\t\t\t\t\t\toutlineOffset: 5,\r\n\t\t\t\t\t\t\toutline: \"rgb(217, 83, 30) solid 7px\",\r\n\t\t\t\t\t }\r\n\t\t\t\t\t: undefined\r\n\t\t\t}\r\n\t\t\tonMouseEnter={onMouseEnter}\r\n\t\t\tref={register(civid)}\r\n\t\t>\r\n\t\t\t{children}\r\n\t\t</div>\r\n\t);\r\n}\r\n"],
5
- "mappings": "AAqBE;AAbK,SAAS,kBAAkB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAsB;AACrB,QAAM,eAAkC,CAAC,MAAM;AAC9C,MAAE,gBAAgB;AAClB,eAAW,KAAK;AAAA,EACjB;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OACC,gBAAgB,QACb;AAAA,QACA,eAAe;AAAA,QACf,SAAS;AAAA,MACT,IACA;AAAA,MAEJ;AAAA,MACA,KAAK,SAAS,KAAK;AAAA,MAElB;AAAA;AAAA,EACF;AAEF;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,13 +1,21 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Section } from "../Section/Section.js";
3
- import { usePreview } from "./PreviewPageWrapper.js";
4
- function PreviewContent() {
5
- const preview = usePreview();
6
- if (!preview || !preview.pageData) {
7
- return null;
8
- }
9
- return /* @__PURE__ */ jsx(Section, { section: [preview.pageData.body] });
10
- }
1
+ import {
2
+ PreviewContent
3
+ } from "../../chunk-JT6WIXOP.js";
4
+ import "../../chunk-OEYLOZQK.js";
5
+ import "../../chunk-P3WX4DFS.js";
6
+ import "../../chunk-F5L7DWHD.js";
7
+ import "../../chunk-MPAGXIUB.js";
8
+ import "../../chunk-CMALSZV3.js";
9
+ import "../../chunk-VV3NKXSX.js";
10
+ import "../../chunk-EG5F4AP4.js";
11
+ import "../../chunk-XG5CMDEI.js";
12
+ import "../../chunk-2WII7C3O.js";
13
+ import "../../chunk-EWRVCIV6.js";
14
+ import "../../chunk-DG37VYL5.js";
15
+ import "../../chunk-GPTPACV2.js";
16
+ import "../../chunk-4LSFAAZW.js";
17
+ import "../../chunk-ZQUGFKHP.js";
18
+ import "../../chunk-5WRI5ZAA.js";
11
19
  export {
12
20
  PreviewContent
13
21
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Preview/PreviewContent.tsx"],
4
- "sourcesContent": ["import { Section } from \"../Section/Section.js\";\r\nimport { usePreview } from \"./PreviewPageWrapper.js\";\r\n\r\nexport function PreviewContent() {\r\n\tconst preview = usePreview();\r\n\r\n\tif (!preview || !preview.pageData) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\treturn <Section section={[preview.pageData.body]} />;\r\n}\r\n"],
5
- "mappings": "AAUQ;AAVR,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAEpB,SAAS,iBAAiB;AAChC,QAAM,UAAU,WAAW;AAE3B,MAAI,CAAC,WAAW,CAAC,QAAQ,UAAU;AAClC,WAAO;AAAA,EACR;AAEA,SAAO,oBAAC,WAAQ,SAAS,CAAC,QAAQ,SAAS,IAAI,GAAG;AACnD;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,89 +1,8 @@
1
- import { jsx } from "react/jsx-runtime";
2
1
  import {
3
- createContext,
4
- useContext,
5
- useMemo,
6
- useEffect,
7
- useState,
8
- useRef
9
- } from "react";
10
- const PreviewContext = createContext(
11
- void 0
12
- );
13
- const usePreview = () => useContext(PreviewContext);
14
- const post = (message) => {
15
- const parent = window.opener || window.parent;
16
- const fullMessage = typeof message === "string" ? message : {
17
- ...message,
18
- namespace: "sv_preview"
19
- };
20
- parent.postMessage(fullMessage, "*");
21
- };
22
- function PreviewPageWrapper({
23
- children,
24
- pageContent
25
- }) {
26
- const refs = useRef({});
27
- const [highlighted, setHighlighted] = useState(
28
- void 0
29
- );
30
- const [pageData, setPageData] = useState(
31
- pageContent
32
- );
33
- useEffect(() => {
34
- setPageData(pageContent);
35
- }, [pageContent]);
36
- useEffect(() => {
37
- post("init");
38
- const handleMessage = ({ data }) => {
39
- if (!data || !("namespace" in data) || data.namespace !== "sv_preview" || !("event" in data) || !("args" in data)) {
40
- return;
41
- }
42
- const { event, args } = data;
43
- if (event === "highlight") {
44
- setHighlighted(args.civid);
45
- }
46
- if (event === "scrollTo") {
47
- if (!refs.current[args.civid]) {
48
- return;
49
- }
50
- refs.current[args.civid].scrollIntoView({
51
- behavior: "smooth",
52
- block: "nearest"
53
- });
54
- }
55
- if (event === "update") {
56
- setPageData((prevPageData) => {
57
- if (!prevPageData) return null;
58
- return { ...prevPageData, body: args.body };
59
- });
60
- }
61
- };
62
- window.addEventListener("message", handleMessage);
63
- return () => window.removeEventListener("message", handleMessage);
64
- }, [setPageData]);
65
- const previewContextState = useMemo(
66
- () => ({
67
- register: (civid) => {
68
- return (ref) => refs.current[civid] = ref;
69
- },
70
- onCivEnter: (civid) => {
71
- post({
72
- event: "pbScrollTo",
73
- args: { civid }
74
- });
75
- post({
76
- event: "pbHighlight",
77
- args: { civid }
78
- });
79
- },
80
- highlighted,
81
- pageData
82
- }),
83
- [highlighted, pageData]
84
- );
85
- return /* @__PURE__ */ jsx(PreviewContext.Provider, { value: previewContextState, children });
86
- }
2
+ PreviewPageWrapper,
3
+ usePreview
4
+ } from "../../chunk-P3WX4DFS.js";
5
+ import "../../chunk-5WRI5ZAA.js";
87
6
  export {
88
7
  PreviewPageWrapper,
89
8
  usePreview
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Preview/PreviewPageWrapper.tsx"],
4
- "sourcesContent": ["import type { PropsWithChildren } from \"react\";\r\nimport {\r\n\tcreateContext,\r\n\tuseContext,\r\n\tuseMemo,\r\n\tuseEffect,\r\n\tuseState,\r\n\tuseRef,\r\n} from \"react\";\r\nimport type { CivProps, PageData } from \"../../types/index.js\";\r\n\r\nexport interface PreviewContextState {\r\n\tonCivEnter: (civid: string) => void;\r\n\thighlighted?: string;\r\n\tregister: (civid: string) => (ref: HTMLDivElement) => void;\r\n\tpageData: PageData<CivProps> | null;\r\n}\r\n\r\nconst PreviewContext = createContext<PreviewContextState | undefined>(\r\n\tundefined\r\n);\r\n\r\nexport const usePreview = (): PreviewContextState | undefined =>\r\n\tuseContext(PreviewContext);\r\n\r\ntype PostMessage =\r\n\t| \"init\"\r\n\t| { event: \"pbScrollTo\"; args: { civid: string } }\r\n\t| { event: \"pbHighlight\"; args: { civid: string } }\r\n\t| { event: \"pbUpdate\"; args: { body: CivProps } };\r\n\r\nconst post = (message: PostMessage) => {\r\n\tconst parent = window.opener || window.parent;\r\n\tconst fullMessage =\r\n\t\ttypeof message === \"string\"\r\n\t\t\t? message\r\n\t\t\t: {\r\n\t\t\t\t\t...message,\r\n\t\t\t\t\tnamespace: \"sv_preview\",\r\n\t\t\t };\r\n\r\n\tparent.postMessage(fullMessage, \"*\");\r\n};\r\n\r\nexport function PreviewPageWrapper({\r\n\tchildren,\r\n\tpageContent,\r\n}: PropsWithChildren<{ pageContent: PageData<CivProps> }>) {\r\n\tconst refs = useRef<Record<string, HTMLDivElement>>({});\r\n\tconst [highlighted, setHighlighted] = useState<string | undefined>(\r\n\t\tundefined\r\n\t);\r\n\tconst [pageData, setPageData] = useState<PageData<CivProps> | null>(\r\n\t\tpageContent\r\n\t);\r\n\r\n\tuseEffect(() => {\r\n\t\tsetPageData(pageContent);\r\n\t}, [pageContent]);\r\n\r\n\tuseEffect(() => {\r\n\t\tpost(\"init\");\r\n\r\n\t\tconst handleMessage = ({ data }: WindowEventMap[\"message\"]) => {\r\n\t\t\tif (\r\n\t\t\t\t!data ||\r\n\t\t\t\t!(\"namespace\" in data) ||\r\n\t\t\t\tdata.namespace !== \"sv_preview\" ||\r\n\t\t\t\t!(\"event\" in data) ||\r\n\t\t\t\t!(\"args\" in data)\r\n\t\t\t) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst { event, args } = data;\r\n\r\n\t\t\tif (event === \"highlight\") {\r\n\t\t\t\tsetHighlighted(args.civid);\r\n\t\t\t}\r\n\r\n\t\t\tif (event === \"scrollTo\") {\r\n\t\t\t\tif (!refs.current[args.civid]) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\trefs.current[args.civid].scrollIntoView({\r\n\t\t\t\t\tbehavior: \"smooth\",\r\n\t\t\t\t\tblock: \"nearest\",\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tif (event === \"update\") {\r\n\t\t\t\tsetPageData((prevPageData) => {\r\n\t\t\t\t\tif (!prevPageData) return null;\r\n\t\t\t\t\treturn { ...prevPageData, body: args.body };\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\twindow.addEventListener(\"message\", handleMessage);\r\n\t\treturn () => window.removeEventListener(\"message\", handleMessage);\r\n\t}, [setPageData]);\r\n\r\n\tconst previewContextState = useMemo<PreviewContextState>(\r\n\t\t() => ({\r\n\t\t\tregister: (civid) => {\r\n\t\t\t\treturn (ref) => (refs.current[civid] = ref);\r\n\t\t\t},\r\n\t\t\tonCivEnter: (civid) => {\r\n\t\t\t\tpost({\r\n\t\t\t\t\tevent: \"pbScrollTo\",\r\n\t\t\t\t\targs: { civid },\r\n\t\t\t\t});\r\n\t\t\t\tpost({\r\n\t\t\t\t\tevent: \"pbHighlight\",\r\n\t\t\t\t\targs: { civid },\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t\thighlighted,\r\n\t\t\tpageData,\r\n\t\t}),\r\n\t\t[highlighted, pageData]\r\n\t);\r\n\r\n\treturn (\r\n\t\t<PreviewContext.Provider value={previewContextState}>\r\n\t\t\t{children}\r\n\t\t</PreviewContext.Provider>\r\n\t);\r\n}\r\n"],
5
- "mappings": "AA6HE;AA5HF;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAUP,MAAM,iBAAiB;AAAA,EACtB;AACD;AAEO,MAAM,aAAa,MACzB,WAAW,cAAc;AAQ1B,MAAM,OAAO,CAAC,YAAyB;AACtC,QAAM,SAAS,OAAO,UAAU,OAAO;AACvC,QAAM,cACL,OAAO,YAAY,WAChB,UACA;AAAA,IACA,GAAG;AAAA,IACH,WAAW;AAAA,EACX;AAEJ,SAAO,YAAY,aAAa,GAAG;AACpC;AAEO,SAAS,mBAAmB;AAAA,EAClC;AAAA,EACA;AACD,GAA2D;AAC1D,QAAM,OAAO,OAAuC,CAAC,CAAC;AACtD,QAAM,CAAC,aAAa,cAAc,IAAI;AAAA,IACrC;AAAA,EACD;AACA,QAAM,CAAC,UAAU,WAAW,IAAI;AAAA,IAC/B;AAAA,EACD;AAEA,YAAU,MAAM;AACf,gBAAY,WAAW;AAAA,EACxB,GAAG,CAAC,WAAW,CAAC;AAEhB,YAAU,MAAM;AACf,SAAK,MAAM;AAEX,UAAM,gBAAgB,CAAC,EAAE,KAAK,MAAiC;AAC9D,UACC,CAAC,QACD,EAAE,eAAe,SACjB,KAAK,cAAc,gBACnB,EAAE,WAAW,SACb,EAAE,UAAU,OACX;AACD;AAAA,MACD;AAEA,YAAM,EAAE,OAAO,KAAK,IAAI;AAExB,UAAI,UAAU,aAAa;AAC1B,uBAAe,KAAK,KAAK;AAAA,MAC1B;AAEA,UAAI,UAAU,YAAY;AACzB,YAAI,CAAC,KAAK,QAAQ,KAAK,KAAK,GAAG;AAC9B;AAAA,QACD;AAEA,aAAK,QAAQ,KAAK,KAAK,EAAE,eAAe;AAAA,UACvC,UAAU;AAAA,UACV,OAAO;AAAA,QACR,CAAC;AAAA,MACF;AAEA,UAAI,UAAU,UAAU;AACvB,oBAAY,CAAC,iBAAiB;AAC7B,cAAI,CAAC,aAAc,QAAO;AAC1B,iBAAO,EAAE,GAAG,cAAc,MAAM,KAAK,KAAK;AAAA,QAC3C,CAAC;AAAA,MACF;AAAA,IACD;AAEA,WAAO,iBAAiB,WAAW,aAAa;AAChD,WAAO,MAAM,OAAO,oBAAoB,WAAW,aAAa;AAAA,EACjE,GAAG,CAAC,WAAW,CAAC;AAEhB,QAAM,sBAAsB;AAAA,IAC3B,OAAO;AAAA,MACN,UAAU,CAAC,UAAU;AACpB,eAAO,CAAC,QAAS,KAAK,QAAQ,KAAK,IAAI;AAAA,MACxC;AAAA,MACA,YAAY,CAAC,UAAU;AACtB,aAAK;AAAA,UACJ,OAAO;AAAA,UACP,MAAM,EAAE,MAAM;AAAA,QACf,CAAC;AACD,aAAK;AAAA,UACJ,OAAO;AAAA,UACP,MAAM,EAAE,MAAM;AAAA,QACf,CAAC;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,CAAC,aAAa,QAAQ;AAAA,EACvB;AAEA,SACC,oBAAC,eAAe,UAAf,EAAwB,OAAO,qBAC9B,UACF;AAEF;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,30 @@
1
- export * from "./PreviewCivWrapper.js";
2
- export * from "./PreviewPageWrapper.js";
3
- export * from "./PreviewContent.js";
1
+ import {
2
+ PreviewContent
3
+ } from "../../chunk-JT6WIXOP.js";
4
+ import {
5
+ PreviewCivWrapper
6
+ } from "../../chunk-OEYLOZQK.js";
7
+ import {
8
+ PreviewPageWrapper,
9
+ usePreview
10
+ } from "../../chunk-P3WX4DFS.js";
11
+ import "../../chunk-F5L7DWHD.js";
12
+ import "../../chunk-MPAGXIUB.js";
13
+ import "../../chunk-CMALSZV3.js";
14
+ import "../../chunk-VV3NKXSX.js";
15
+ import "../../chunk-EG5F4AP4.js";
16
+ import "../../chunk-XG5CMDEI.js";
17
+ import "../../chunk-2WII7C3O.js";
18
+ import "../../chunk-EWRVCIV6.js";
19
+ import "../../chunk-DG37VYL5.js";
20
+ import "../../chunk-GPTPACV2.js";
21
+ import "../../chunk-4LSFAAZW.js";
22
+ import "../../chunk-ZQUGFKHP.js";
23
+ import "../../chunk-5WRI5ZAA.js";
24
+ export {
25
+ PreviewCivWrapper,
26
+ PreviewContent,
27
+ PreviewPageWrapper,
28
+ usePreview
29
+ };
4
30
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Preview/index.ts"],
4
- "sourcesContent": ["export * from \"./PreviewCivWrapper.js\";\r\nexport * from \"./PreviewPageWrapper.js\";\r\nexport * from \"./PreviewContent.js\";\r\n"],
5
- "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,21 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
2
- import { SectionItem } from "./SectionItem.js";
3
- function Section({ section }) {
4
- if (!Array.isArray(section) || !section.length) {
5
- return null;
6
- }
7
- return /* @__PURE__ */ jsx(Fragment, { children: section.map((civ) => /* @__PURE__ */ jsx(SectionItem, { ...civ }, civ.civid)) });
8
- }
1
+ import {
2
+ Section
3
+ } from "../../chunk-JT6WIXOP.js";
4
+ import "../../chunk-OEYLOZQK.js";
5
+ import "../../chunk-P3WX4DFS.js";
6
+ import "../../chunk-F5L7DWHD.js";
7
+ import "../../chunk-MPAGXIUB.js";
8
+ import "../../chunk-CMALSZV3.js";
9
+ import "../../chunk-VV3NKXSX.js";
10
+ import "../../chunk-EG5F4AP4.js";
11
+ import "../../chunk-XG5CMDEI.js";
12
+ import "../../chunk-2WII7C3O.js";
13
+ import "../../chunk-EWRVCIV6.js";
14
+ import "../../chunk-DG37VYL5.js";
15
+ import "../../chunk-GPTPACV2.js";
16
+ import "../../chunk-4LSFAAZW.js";
17
+ import "../../chunk-ZQUGFKHP.js";
18
+ import "../../chunk-5WRI5ZAA.js";
9
19
  export {
10
20
  Section
11
21
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Section/Section.tsx"],
4
- "sourcesContent": ["import type { SectionProps } from \"./Section.types.js\";\r\nimport { SectionItem } from \"./SectionItem.js\";\r\n\r\nexport function Section({ section }: SectionProps) {\r\n\tif (!Array.isArray(section) || !section.length) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t{section.map((civ) => (\r\n\t\t\t\t<SectionItem key={civ.civid} {...civ} />\r\n\t\t\t))}\r\n\t\t</>\r\n\t);\r\n}\r\n"],
5
- "mappings": "AASE,mBAEE,WAFF;AARF,SAAS,mBAAmB;AAErB,SAAS,QAAQ,EAAE,QAAQ,GAAiB;AAClD,MAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,CAAC,QAAQ,QAAQ;AAC/C,WAAO;AAAA,EACR;AAEA,SACC,gCACE,kBAAQ,IAAI,CAAC,QACb,oBAAC,eAA6B,GAAG,OAAf,IAAI,KAAgB,CACtC,GACF;AAEF;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1 +1,2 @@
1
+ import "../../chunk-EWRVCIV6.js";
1
2
  //# sourceMappingURL=Section.types.js.map
@@ -1,14 +1,21 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { PreviewCivWrapper } from "../Preview/index.js";
3
- import { usePreview } from "../Preview/PreviewPageWrapper.js";
4
- import { SectionItemCiv } from "./SectionItemCiv.js";
5
- function SectionItem(civ) {
6
- const preview = usePreview();
7
- if (!preview) {
8
- return /* @__PURE__ */ jsx(SectionItemCiv, { ...civ });
9
- }
10
- return /* @__PURE__ */ jsx(PreviewCivWrapper, { civid: civ.civid, ...preview, children: /* @__PURE__ */ jsx(SectionItemCiv, { ...civ }) });
11
- }
1
+ import {
2
+ SectionItem
3
+ } from "../../chunk-JT6WIXOP.js";
4
+ import "../../chunk-OEYLOZQK.js";
5
+ import "../../chunk-P3WX4DFS.js";
6
+ import "../../chunk-F5L7DWHD.js";
7
+ import "../../chunk-MPAGXIUB.js";
8
+ import "../../chunk-CMALSZV3.js";
9
+ import "../../chunk-VV3NKXSX.js";
10
+ import "../../chunk-EG5F4AP4.js";
11
+ import "../../chunk-XG5CMDEI.js";
12
+ import "../../chunk-2WII7C3O.js";
13
+ import "../../chunk-EWRVCIV6.js";
14
+ import "../../chunk-DG37VYL5.js";
15
+ import "../../chunk-GPTPACV2.js";
16
+ import "../../chunk-4LSFAAZW.js";
17
+ import "../../chunk-ZQUGFKHP.js";
18
+ import "../../chunk-5WRI5ZAA.js";
12
19
  export {
13
20
  SectionItem
14
21
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Section/SectionItem.tsx"],
4
- "sourcesContent": ["import type { CivProps } from \"../../types/index.js\";\r\nimport { PreviewCivWrapper } from \"../Preview/index.js\";\r\nimport { usePreview } from \"../Preview/PreviewPageWrapper.js\";\r\nimport { SectionItemCiv } from \"./SectionItemCiv.js\";\r\n\r\nexport function SectionItem(civ: CivProps) {\r\n\tconst preview = usePreview();\r\n\r\n\tif (!preview) {\r\n\t\treturn <SectionItemCiv {...civ} />;\r\n\t}\r\n\r\n\treturn (\r\n\t\t<PreviewCivWrapper civid={civ.civid} {...preview}>\r\n\t\t\t<SectionItemCiv {...civ} />\r\n\t\t</PreviewCivWrapper>\r\n\t);\r\n}\r\n"],
5
- "mappings": "AASS;AART,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAExB,SAAS,YAAY,KAAe;AAC1C,QAAM,UAAU,WAAW;AAE3B,MAAI,CAAC,SAAS;AACb,WAAO,oBAAC,kBAAgB,GAAG,KAAK;AAAA,EACjC;AAEA,SACC,oBAAC,qBAAkB,OAAO,IAAI,OAAQ,GAAG,SACxC,8BAAC,kBAAgB,GAAG,KAAK,GAC1B;AAEF;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }
@@ -1,22 +1,21 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useComponentMap } from "../../contexts/index.js";
3
- function SectionItemCiv(civ) {
4
- const map = useComponentMap();
5
- if (civ === void 0) {
6
- return /* @__PURE__ */ jsx(
7
- map.Error,
8
- {
9
- status: 500,
10
- message: "Is the CMS API running? I bet it isn't \u{1F609}"
11
- }
12
- );
13
- }
14
- const Component = map.civs[civ.component];
15
- if (Component === void 0) {
16
- return /* @__PURE__ */ jsx(map.Unknown, { ...civ });
17
- }
18
- return /* @__PURE__ */ jsx(Component, { ...civ });
19
- }
1
+ import {
2
+ SectionItemCiv
3
+ } from "../../chunk-JT6WIXOP.js";
4
+ import "../../chunk-OEYLOZQK.js";
5
+ import "../../chunk-P3WX4DFS.js";
6
+ import "../../chunk-F5L7DWHD.js";
7
+ import "../../chunk-MPAGXIUB.js";
8
+ import "../../chunk-CMALSZV3.js";
9
+ import "../../chunk-VV3NKXSX.js";
10
+ import "../../chunk-EG5F4AP4.js";
11
+ import "../../chunk-XG5CMDEI.js";
12
+ import "../../chunk-2WII7C3O.js";
13
+ import "../../chunk-EWRVCIV6.js";
14
+ import "../../chunk-DG37VYL5.js";
15
+ import "../../chunk-GPTPACV2.js";
16
+ import "../../chunk-4LSFAAZW.js";
17
+ import "../../chunk-ZQUGFKHP.js";
18
+ import "../../chunk-5WRI5ZAA.js";
20
19
  export {
21
20
  SectionItemCiv
22
21
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/Section/SectionItemCiv.tsx"],
4
- "sourcesContent": ["import { useComponentMap } from \"../../contexts/index.js\";\r\nimport type { CivProps } from \"../../types/index.js\";\r\n\r\nexport function SectionItemCiv(civ: CivProps) {\r\n\tconst map = useComponentMap();\r\n\r\n\tif (civ === undefined) {\r\n\t\treturn (\r\n\t\t\t<map.Error\r\n\t\t\t\tstatus={500}\r\n\t\t\t\tmessage=\"Is the CMS API running? I bet it isn't \uD83D\uDE09\"\r\n\t\t\t/>\r\n\t\t);\r\n\t}\r\n\r\n\tconst Component = map.civs[civ.component];\r\n\r\n\tif (Component === undefined) {\r\n\t\treturn <map.Unknown {...civ} />;\r\n\t}\r\n\r\n\treturn <Component {...civ} />;\r\n}\r\n"],
5
- "mappings": "AAQG;AARH,SAAS,uBAAuB;AAGzB,SAAS,eAAe,KAAe;AAC7C,QAAM,MAAM,gBAAgB;AAE5B,MAAI,QAAQ,QAAW;AACtB,WACC;AAAA,MAAC,IAAI;AAAA,MAAJ;AAAA,QACA,QAAQ;AAAA,QACR,SAAQ;AAAA;AAAA,IACT;AAAA,EAEF;AAEA,QAAM,YAAY,IAAI,KAAK,IAAI,SAAS;AAExC,MAAI,cAAc,QAAW;AAC5B,WAAO,oBAAC,IAAI,SAAJ,EAAa,GAAG,KAAK;AAAA,EAC9B;AAEA,SAAO,oBAAC,aAAW,GAAG,KAAK;AAC5B;",
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
6
  "names": []
7
7
  }