@simpleview/cms-foundation 0.0.24 → 0.0.25

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 (121) hide show
  1. package/dist/components/App/App.js +5 -4
  2. package/dist/components/App/App.js.map +3 -3
  3. package/dist/components/App/index.js +1 -8
  4. package/dist/components/App/index.js.map +3 -3
  5. package/dist/components/Error/Error.js +11 -4
  6. package/dist/components/Error/Error.js.map +3 -3
  7. package/dist/components/Error/Error.types.js +0 -1
  8. package/dist/components/Error/index.js +2 -9
  9. package/dist/components/Error/index.js.map +3 -3
  10. package/dist/components/Layout/Layout.js +25 -4
  11. package/dist/components/Layout/Layout.js.map +3 -3
  12. package/dist/components/Layout/index.js +1 -8
  13. package/dist/components/Layout/index.js.map +3 -3
  14. package/dist/components/Preview/PreviewCivWrapper.js +25 -4
  15. package/dist/components/Preview/PreviewCivWrapper.js.map +3 -3
  16. package/dist/components/Preview/PreviewContent.js +10 -18
  17. package/dist/components/Preview/PreviewContent.js.map +3 -3
  18. package/dist/components/Preview/PreviewPageWrapper.js +85 -4
  19. package/dist/components/Preview/PreviewPageWrapper.js.map +3 -3
  20. package/dist/components/Preview/index.js +3 -29
  21. package/dist/components/Preview/index.js.map +3 -3
  22. package/dist/components/Section/Section.js +8 -18
  23. package/dist/components/Section/Section.js.map +3 -3
  24. package/dist/components/Section/Section.types.js +0 -1
  25. package/dist/components/Section/SectionItem.js +11 -18
  26. package/dist/components/Section/SectionItem.js.map +3 -3
  27. package/dist/components/Section/SectionItemCiv.js +19 -18
  28. package/dist/components/Section/SectionItemCiv.js.map +3 -3
  29. package/dist/components/Section/index.js +4 -25
  30. package/dist/components/Section/index.js.map +3 -3
  31. package/dist/components/Unknown/Unknown.js +28 -6
  32. package/dist/components/Unknown/Unknown.js.map +3 -3
  33. package/dist/components/Unknown/index.js +1 -10
  34. package/dist/components/Unknown/index.js.map +3 -3
  35. package/dist/components/index.js +6 -47
  36. package/dist/components/index.js.map +3 -3
  37. package/dist/contexts/ComponentMapContext.js +9 -19
  38. package/dist/contexts/ComponentMapContext.js.map +3 -3
  39. package/dist/contexts/index.js +1 -23
  40. package/dist/contexts/index.js.map +3 -3
  41. package/dist/routes/index.js +2 -7131
  42. package/dist/routes/index.js.map +4 -4
  43. package/dist/types/cms.js +0 -1
  44. package/dist/types/index.js +1 -2
  45. package/dist/types/index.js.map +3 -3
  46. package/dist/types/src/vite/config.d.ts +1 -0
  47. package/dist/types/src/vite/index.d.ts +1 -0
  48. package/dist/utils/getCmsUrl.js +5 -4
  49. package/dist/utils/getCmsUrl.js.map +3 -3
  50. package/dist/utils/getPageContent.js +50 -5
  51. package/dist/utils/getPageContent.js.map +3 -3
  52. package/dist/utils/index.js +2 -11
  53. package/dist/utils/index.js.map +3 -3
  54. package/dist/vite/config.js +37 -0
  55. package/dist/vite/config.js.map +7 -0
  56. package/dist/vite/index.js +2 -0
  57. package/dist/vite/index.js.map +7 -0
  58. package/package.json +11 -5
  59. package/dist/chunk-2WII7C3O.js +0 -31
  60. package/dist/chunk-2WII7C3O.js.map +0 -7
  61. package/dist/chunk-4LSFAAZW.js +0 -1
  62. package/dist/chunk-4LSFAAZW.js.map +0 -7
  63. package/dist/chunk-5WRI5ZAA.js +0 -31
  64. package/dist/chunk-5WRI5ZAA.js.map +0 -7
  65. package/dist/chunk-CMALSZV3.js +0 -1
  66. package/dist/chunk-CMALSZV3.js.map +0 -7
  67. package/dist/chunk-DG37VYL5.js +0 -1
  68. package/dist/chunk-DG37VYL5.js.map +0 -7
  69. package/dist/chunk-EEKFLXZI.js +0 -11
  70. package/dist/chunk-EEKFLXZI.js.map +0 -7
  71. package/dist/chunk-EG5F4AP4.js +0 -1
  72. package/dist/chunk-EG5F4AP4.js.map +0 -7
  73. package/dist/chunk-EWRVCIV6.js +0 -1
  74. package/dist/chunk-EWRVCIV6.js.map +0 -7
  75. package/dist/chunk-F5L7DWHD.js +0 -1
  76. package/dist/chunk-F5L7DWHD.js.map +0 -7
  77. package/dist/chunk-FJML4RHB.js +0 -59
  78. package/dist/chunk-FJML4RHB.js.map +0 -7
  79. package/dist/chunk-GPTPACV2.js +0 -33
  80. package/dist/chunk-GPTPACV2.js.map +0 -7
  81. package/dist/chunk-MPAGXIUB.js +0 -11
  82. package/dist/chunk-MPAGXIUB.js.map +0 -7
  83. package/dist/chunk-OEYLOZQK.js +0 -31
  84. package/dist/chunk-OEYLOZQK.js.map +0 -7
  85. package/dist/chunk-P3WX4DFS.js +0 -93
  86. package/dist/chunk-P3WX4DFS.js.map +0 -7
  87. package/dist/chunk-SPYOQSRR.js +0 -90
  88. package/dist/chunk-SPYOQSRR.js.map +0 -7
  89. package/dist/chunk-VV3NKXSX.js +0 -17
  90. package/dist/chunk-VV3NKXSX.js.map +0 -7
  91. package/dist/chunk-XG5CMDEI.js +0 -1
  92. package/dist/chunk-XG5CMDEI.js.map +0 -7
  93. package/dist/chunk-ZQUGFKHP.js +0 -1
  94. package/dist/chunk-ZQUGFKHP.js.map +0 -7
  95. /package/dist/types/{components → src/components}/App/App.d.ts +0 -0
  96. /package/dist/types/{components → src/components}/App/index.d.ts +0 -0
  97. /package/dist/types/{components → src/components}/Error/Error.d.ts +0 -0
  98. /package/dist/types/{components → src/components}/Error/Error.types.d.ts +0 -0
  99. /package/dist/types/{components → src/components}/Error/index.d.ts +0 -0
  100. /package/dist/types/{components → src/components}/Layout/Layout.d.ts +0 -0
  101. /package/dist/types/{components → src/components}/Layout/index.d.ts +0 -0
  102. /package/dist/types/{components → src/components}/Preview/PreviewCivWrapper.d.ts +0 -0
  103. /package/dist/types/{components → src/components}/Preview/PreviewContent.d.ts +0 -0
  104. /package/dist/types/{components → src/components}/Preview/PreviewPageWrapper.d.ts +0 -0
  105. /package/dist/types/{components → src/components}/Preview/index.d.ts +0 -0
  106. /package/dist/types/{components → src/components}/Section/Section.d.ts +0 -0
  107. /package/dist/types/{components → src/components}/Section/Section.types.d.ts +0 -0
  108. /package/dist/types/{components → src/components}/Section/SectionItem.d.ts +0 -0
  109. /package/dist/types/{components → src/components}/Section/SectionItemCiv.d.ts +0 -0
  110. /package/dist/types/{components → src/components}/Section/index.d.ts +0 -0
  111. /package/dist/types/{components → src/components}/Unknown/Unknown.d.ts +0 -0
  112. /package/dist/types/{components → src/components}/Unknown/index.d.ts +0 -0
  113. /package/dist/types/{components → src/components}/index.d.ts +0 -0
  114. /package/dist/types/{contexts → src/contexts}/ComponentMapContext.d.ts +0 -0
  115. /package/dist/types/{contexts → src/contexts}/index.d.ts +0 -0
  116. /package/dist/types/{routes → src/routes}/index.d.ts +0 -0
  117. /package/dist/types/{types → src/types}/cms.d.ts +0 -0
  118. /package/dist/types/{types → src/types}/index.d.ts +0 -0
  119. /package/dist/types/{utils → src/utils}/getCmsUrl.d.ts +0 -0
  120. /package/dist/types/{utils → src/utils}/getPageContent.d.ts +0 -0
  121. /package/dist/types/{utils → src/utils}/index.d.ts +0 -0
@@ -1,93 +0,0 @@
1
- // src/components/Preview/PreviewPageWrapper.tsx
2
- import {
3
- createContext,
4
- useContext,
5
- useMemo,
6
- useEffect,
7
- useState,
8
- useRef
9
- } from "react";
10
- import { jsx } from "react/jsx-runtime";
11
- var PreviewContext = createContext(
12
- void 0
13
- );
14
- var usePreview = () => useContext(PreviewContext);
15
- var post = (message) => {
16
- const parent = window.opener || window.parent;
17
- const fullMessage = typeof message === "string" ? message : {
18
- ...message,
19
- namespace: "sv_preview"
20
- };
21
- parent.postMessage(fullMessage, "*");
22
- };
23
- function PreviewPageWrapper({
24
- children,
25
- pageContent
26
- }) {
27
- const refs = useRef({});
28
- const [highlighted, setHighlighted] = useState(
29
- void 0
30
- );
31
- const [pageData, setPageData] = useState(
32
- pageContent
33
- );
34
- useEffect(() => {
35
- setPageData(pageContent);
36
- }, [pageContent]);
37
- useEffect(() => {
38
- post("init");
39
- const handleMessage = ({ data }) => {
40
- if (!data || !("namespace" in data) || data.namespace !== "sv_preview" || !("event" in data) || !("args" in data)) {
41
- return;
42
- }
43
- const { event, args } = data;
44
- if (event === "highlight") {
45
- setHighlighted(args.civid);
46
- }
47
- if (event === "scrollTo") {
48
- if (!refs.current[args.civid]) {
49
- return;
50
- }
51
- refs.current[args.civid].scrollIntoView({
52
- behavior: "smooth",
53
- block: "nearest"
54
- });
55
- }
56
- if (event === "update") {
57
- setPageData((prevPageData) => {
58
- if (!prevPageData) return null;
59
- return { ...prevPageData, body: args.body };
60
- });
61
- }
62
- };
63
- window.addEventListener("message", handleMessage);
64
- return () => window.removeEventListener("message", handleMessage);
65
- }, [setPageData]);
66
- const previewContextState = useMemo(
67
- () => ({
68
- register: (civid) => {
69
- return (ref) => refs.current[civid] = ref;
70
- },
71
- onCivEnter: (civid) => {
72
- post({
73
- event: "pbScrollTo",
74
- args: { civid }
75
- });
76
- post({
77
- event: "pbHighlight",
78
- args: { civid }
79
- });
80
- },
81
- highlighted,
82
- pageData
83
- }),
84
- [highlighted, pageData]
85
- );
86
- return /* @__PURE__ */ jsx(PreviewContext.Provider, { value: previewContextState, children });
87
- }
88
-
89
- export {
90
- usePreview,
91
- PreviewPageWrapper
92
- };
93
- //# sourceMappingURL=chunk-P3WX4DFS.js.map
@@ -1,7 +0,0 @@
1
- {
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": ";AACA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAqHL;AA3GF,IAAM,iBAAiB;AAAA,EACtB;AACD;AAEO,IAAM,aAAa,MACzB,WAAW,cAAc;AAQ1B,IAAM,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;",
6
- "names": []
7
- }
@@ -1,90 +0,0 @@
1
- import {
2
- PreviewCivWrapper
3
- } from "./chunk-OEYLOZQK.js";
4
- import {
5
- usePreview
6
- } from "./chunk-P3WX4DFS.js";
7
- import {
8
- Error
9
- } from "./chunk-VV3NKXSX.js";
10
- import {
11
- Unknown
12
- } from "./chunk-GPTPACV2.js";
13
-
14
- // src/components/Preview/PreviewContent.tsx
15
- import { jsx } from "react/jsx-runtime";
16
- function PreviewContent() {
17
- const preview = usePreview();
18
- if (!preview || !preview.pageData) {
19
- return null;
20
- }
21
- return /* @__PURE__ */ jsx(Section, { section: [preview.pageData.body] });
22
- }
23
-
24
- // src/contexts/ComponentMapContext.tsx
25
- import { createContext, useContext } from "react";
26
- var ComponentMapContext = createContext({
27
- civs: {
28
- foo: () => null
29
- },
30
- Error,
31
- Unknown
32
- });
33
- var ComponentMapProvider = ComponentMapContext.Provider;
34
- var useComponentMap = () => useContext(ComponentMapContext);
35
-
36
- // src/components/Section/SectionItemCiv.tsx
37
- import { useMatches } from "react-router";
38
- import { jsx as jsx2 } from "react/jsx-runtime";
39
- function SectionItemCiv(civ) {
40
- const matches = useMatches();
41
- const [
42
- {
43
- data: { clientComponentMap: map }
44
- }
45
- ] = matches;
46
- console.log("Component Map", map);
47
- if (civ === void 0) {
48
- return /* @__PURE__ */ jsx2(
49
- map.Error,
50
- {
51
- status: 500,
52
- message: "Is the CMS API running? I bet it isn't \u{1F609}"
53
- }
54
- );
55
- }
56
- const Component = map.civs[civ.component];
57
- if (Component === void 0) {
58
- return /* @__PURE__ */ jsx2(map.Unknown, { ...civ });
59
- }
60
- return /* @__PURE__ */ jsx2(Component, { ...civ });
61
- }
62
-
63
- // src/components/Section/SectionItem.tsx
64
- import { jsx as jsx3 } from "react/jsx-runtime";
65
- function SectionItem(civ) {
66
- const preview = usePreview();
67
- if (!preview) {
68
- return /* @__PURE__ */ jsx3(SectionItemCiv, { ...civ });
69
- }
70
- return /* @__PURE__ */ jsx3(PreviewCivWrapper, { civid: civ.civid, ...preview, children: /* @__PURE__ */ jsx3(SectionItemCiv, { ...civ }) });
71
- }
72
-
73
- // src/components/Section/Section.tsx
74
- import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
75
- function Section({ section }) {
76
- if (!Array.isArray(section) || !section.length) {
77
- return null;
78
- }
79
- return /* @__PURE__ */ jsx4(Fragment, { children: section.map((civ) => /* @__PURE__ */ jsx4(SectionItem, { ...civ }, civ.civid)) });
80
- }
81
-
82
- export {
83
- ComponentMapProvider,
84
- useComponentMap,
85
- SectionItemCiv,
86
- SectionItem,
87
- Section,
88
- PreviewContent
89
- };
90
- //# sourceMappingURL=chunk-SPYOQSRR.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/components/Preview/PreviewContent.tsx", "../src/contexts/ComponentMapContext.tsx", "../src/components/Section/SectionItemCiv.tsx", "../src/components/Section/SectionItem.tsx", "../src/components/Section/Section.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", "import { Unknown, Error, type ErrorProps } from \"../components/index.js\";\r\nimport type { CivProps, ComponentMap } from \"../types/index.js\";\r\nimport { createContext, useContext, type FC } from \"react\";\r\n\r\nconst ComponentMapContext = createContext<{\r\n\tcivs: ComponentMap;\r\n\tError: FC<ErrorProps>;\r\n\tUnknown: FC<CivProps>;\r\n}>({\r\n\tcivs: {\r\n\t\tfoo: () => null,\r\n\t},\r\n\tError,\r\n\tUnknown,\r\n});\r\n\r\nexport const ComponentMapProvider = ComponentMapContext.Provider;\r\n\r\nexport const useComponentMap = () => useContext(ComponentMapContext);\r\n", "import { useComponentMap } from \"../../contexts/index.js\";\r\nimport type { CivProps } from \"../../types/index.js\";\r\nimport { useMatches } from \"react-router\";\r\n\r\nexport function SectionItemCiv(civ: CivProps) {\r\n\tconst matches = useMatches();\r\n\r\n\tconst [\r\n\t\t{\r\n\t\t\tdata: { clientComponentMap: map },\r\n\t\t},\r\n\t] = matches as unknown as [\r\n\t\t{ data: { clientComponentMap: ReturnType<typeof useComponentMap> } }\r\n\t];\r\n\r\n\tconsole.log(\"Component Map\", map);\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", "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", "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": ";;;;;;;;;;;;;;AAUQ;AAPD,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;;;ACTA,SAAS,eAAe,kBAA2B;AAEnD,IAAM,sBAAsB,cAIzB;AAAA,EACF,MAAM;AAAA,IACL,KAAK,MAAM;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAEM,IAAM,uBAAuB,oBAAoB;AAEjD,IAAM,kBAAkB,MAAM,WAAW,mBAAmB;;;AChBnE,SAAS,kBAAkB;AAiBxB,gBAAAA,YAAA;AAfI,SAAS,eAAe,KAAe;AAC7C,QAAM,UAAU,WAAW;AAE3B,QAAM;AAAA,IACL;AAAA,MACC,MAAM,EAAE,oBAAoB,IAAI;AAAA,IACjC;AAAA,EACD,IAAI;AAIJ,UAAQ,IAAI,iBAAiB,GAAG;AAEhC,MAAI,QAAQ,QAAW;AACtB,WACC,gBAAAA;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,gBAAAA,KAAC,IAAI,SAAJ,EAAa,GAAG,KAAK;AAAA,EAC9B;AAEA,SAAO,gBAAAA,KAAC,aAAW,GAAG,KAAK;AAC5B;;;ACxBS,gBAAAC,YAAA;AAJF,SAAS,YAAY,KAAe;AAC1C,QAAM,UAAU,WAAW;AAE3B,MAAI,CAAC,SAAS;AACb,WAAO,gBAAAA,KAAC,kBAAgB,GAAG,KAAK;AAAA,EACjC;AAEA,SACC,gBAAAA,KAAC,qBAAkB,OAAO,IAAI,OAAQ,GAAG,SACxC,0BAAAA,KAAC,kBAAgB,GAAG,KAAK,GAC1B;AAEF;;;ACRE,mBAEE,OAAAC,YAFF;AANK,SAAS,QAAQ,EAAE,QAAQ,GAAiB;AAClD,MAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,CAAC,QAAQ,QAAQ;AAC/C,WAAO;AAAA,EACR;AAEA,SACC,gBAAAA,KAAA,YACE,kBAAQ,IAAI,CAAC,QACb,gBAAAA,KAAC,eAA6B,GAAG,OAAf,IAAI,KAAgB,CACtC,GACF;AAEF;",
6
- "names": ["jsx", "jsx", "jsx"]
7
- }
@@ -1,17 +0,0 @@
1
- // src/components/Error/Error.tsx
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- function Error({ status, message }) {
4
- return /* @__PURE__ */ jsxs(Fragment, { children: [
5
- /* @__PURE__ */ jsx("h1", { children: "Error" }),
6
- /* @__PURE__ */ jsxs("h3", { children: [
7
- "Status Code: ",
8
- status
9
- ] }),
10
- /* @__PURE__ */ jsx("p", { children: message })
11
- ] });
12
- }
13
-
14
- export {
15
- Error
16
- };
17
- //# sourceMappingURL=chunk-VV3NKXSX.js.map
@@ -1,7 +0,0 @@
1
- {
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;",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-XG5CMDEI.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-ZQUGFKHP.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
File without changes
File without changes
File without changes
File without changes
File without changes