@simpleview/cms-foundation 0.0.12 → 0.0.14
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/dist/components/App/index.js +1 -1
- package/dist/components/App/index.js.map +1 -1
- package/dist/components/Error/Error.js.map +1 -1
- package/dist/components/Error/index.js +2 -2
- package/dist/components/Error/index.js.map +1 -1
- package/dist/components/Layout/index.js +1 -1
- package/dist/components/Layout/index.js.map +1 -1
- package/dist/components/Preview/PreviewCivWrapper.js.map +1 -1
- package/dist/components/Preview/PreviewContent.js +1 -1
- package/dist/components/Preview/PreviewContent.js.map +1 -1
- package/dist/components/Preview/PreviewPageWrapper.js.map +1 -1
- package/dist/components/Preview/index.js +3 -3
- package/dist/components/Preview/index.js.map +1 -1
- package/dist/components/Section/Section.js +1 -1
- package/dist/components/Section/Section.js.map +1 -1
- package/dist/components/Section/SectionItem.js +3 -3
- package/dist/components/Section/SectionItem.js.map +1 -1
- package/dist/components/Section/SectionItemCiv.js +1 -1
- package/dist/components/Section/SectionItemCiv.js.map +1 -1
- package/dist/components/Section/index.js +4 -4
- package/dist/components/Section/index.js.map +1 -1
- package/dist/components/Unknown/Unknown.js +1 -1
- package/dist/components/Unknown/Unknown.js.map +1 -1
- package/dist/components/Unknown/index.js +1 -1
- package/dist/components/Unknown/index.js.map +1 -1
- package/dist/components/index.js +6 -7
- package/dist/components/index.js.map +2 -2
- package/dist/contexts/ComponentMapContext.js +1 -1
- package/dist/contexts/ComponentMapContext.js.map +1 -1
- package/dist/contexts/index.js +1 -1
- package/dist/contexts/index.js.map +1 -1
- package/dist/types/components/App/index.d.ts +1 -1
- package/dist/types/components/Error/Error.d.ts +1 -1
- package/dist/types/components/Error/index.d.ts +2 -2
- package/dist/types/components/Layout/index.d.ts +1 -1
- package/dist/types/components/Preview/PreviewCivWrapper.d.ts +1 -1
- package/dist/types/components/Preview/PreviewPageWrapper.d.ts +1 -1
- package/dist/types/components/Preview/index.d.ts +3 -3
- package/dist/types/components/Section/Section.d.ts +1 -1
- package/dist/types/components/Section/Section.types.d.ts +1 -1
- package/dist/types/components/Section/SectionItem.d.ts +1 -1
- package/dist/types/components/Section/SectionItemCiv.d.ts +1 -1
- package/dist/types/components/Section/index.d.ts +4 -4
- package/dist/types/components/Unknown/Unknown.d.ts +1 -1
- package/dist/types/components/Unknown/index.d.ts +1 -1
- package/dist/types/components/index.d.ts +6 -7
- package/dist/types/contexts/ComponentMapContext.d.ts +2 -2
- package/dist/types/contexts/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/utils/getPageContent.d.ts +1 -1
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/utils/getPageContent.js +1 -1
- package/dist/utils/getPageContent.js.map +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./App";
|
|
1
|
+
export * from "./App.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Error/Error.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { ErrorProps } from \"./Error.types\";\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"],
|
|
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
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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./Error";
|
|
2
|
-
export * from "./Error.types";
|
|
1
|
+
export * from "./Error.js";
|
|
2
|
+
export * from "./Error.types.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Error/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"./Error\";\r\nexport * from \"./Error.types\";\r\n"],
|
|
4
|
+
"sourcesContent": ["export * from \"./Error.js\";\r\nexport * from \"./Error.types.js\";\r\n"],
|
|
5
5
|
"mappings": "AAAA,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Layout";
|
|
1
|
+
export * from "./Layout.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Preview/PreviewCivWrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { PropsWithChildren, MouseEventHandler } from \"react\";\r\nimport type { PreviewContextState } from \"./PreviewPageWrapper\";\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"],
|
|
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
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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Section } from "@simpleview/cms-foundation/components";
|
|
3
|
-
import { usePreview } from "./PreviewPageWrapper";
|
|
3
|
+
import { usePreview } from "./PreviewPageWrapper.js";
|
|
4
4
|
function PreviewContent() {
|
|
5
5
|
const preview = usePreview();
|
|
6
6
|
if (!preview || !preview.pageData) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Preview/PreviewContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Section } from \"@simpleview/cms-foundation/components\";\r\nimport { usePreview } from \"./PreviewPageWrapper\";\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"],
|
|
4
|
+
"sourcesContent": ["import { Section } from \"@simpleview/cms-foundation/components\";\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
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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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\";\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"],
|
|
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
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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./PreviewCivWrapper";
|
|
2
|
-
export * from "./PreviewPageWrapper";
|
|
3
|
-
export * from "./PreviewContent";
|
|
1
|
+
export * from "./PreviewCivWrapper.js";
|
|
2
|
+
export * from "./PreviewPageWrapper.js";
|
|
3
|
+
export * from "./PreviewContent.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Preview/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"./PreviewCivWrapper\";\r\nexport * from \"./PreviewPageWrapper\";\r\nexport * from \"./PreviewContent\";\r\n"],
|
|
4
|
+
"sourcesContent": ["export * from \"./PreviewCivWrapper.js\";\r\nexport * from \"./PreviewPageWrapper.js\";\r\nexport * from \"./PreviewContent.js\";\r\n"],
|
|
5
5
|
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Section/Section.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { SectionProps } from \"./Section.types\";\r\nimport { SectionItem } from \"./SectionItem\";\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"],
|
|
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
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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PreviewCivWrapper } from "../Preview";
|
|
3
|
-
import { usePreview } from "../Preview/PreviewPageWrapper";
|
|
4
|
-
import { SectionItemCiv } from "./SectionItemCiv";
|
|
2
|
+
import { PreviewCivWrapper } from "../Preview/index.js";
|
|
3
|
+
import { usePreview } from "../Preview/PreviewPageWrapper.js";
|
|
4
|
+
import { SectionItemCiv } from "./SectionItemCiv.js";
|
|
5
5
|
function SectionItem(civ) {
|
|
6
6
|
const preview = usePreview();
|
|
7
7
|
if (!preview) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Section/SectionItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { CivProps } from \"../../types\";\r\nimport { PreviewCivWrapper } from \"../Preview\";\r\nimport { usePreview } from \"../Preview/PreviewPageWrapper\";\r\nimport { SectionItemCiv } from \"./SectionItemCiv\";\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"],
|
|
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
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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Section/SectionItemCiv.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useComponentMap } from \"../../contexts\";\r\nimport type { CivProps } from \"../../types\";\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"],
|
|
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
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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./Section";
|
|
2
|
-
export * from "./SectionItem";
|
|
3
|
-
export * from "./SectionItemCiv";
|
|
4
|
-
export * from "./Section.types";
|
|
1
|
+
export * from "./Section.js";
|
|
2
|
+
export * from "./SectionItem.js";
|
|
3
|
+
export * from "./SectionItemCiv.js";
|
|
4
|
+
export * from "./Section.types.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Section/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"./Section\";\r\nexport * from \"./SectionItem\";\r\nexport * from \"./SectionItemCiv\";\r\nexport * from \"./Section.types\";\r\n"],
|
|
4
|
+
"sourcesContent": ["export * from \"./Section.js\";\r\nexport * from \"./SectionItem.js\";\r\nexport * from \"./SectionItemCiv.js\";\r\nexport * from \"./Section.types.js\";\r\n"],
|
|
5
5
|
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {} from "../../types";
|
|
2
|
+
import {} from "../../types/index.js";
|
|
3
3
|
const Unknown = ({ civid, name, type, component }) => {
|
|
4
4
|
return /* @__PURE__ */ jsxs("div", { className: "bg-red-900 text-white p-6 my-5 flex flex-col rounded-lg", children: [
|
|
5
5
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Unknown/Unknown.tsx"],
|
|
4
|
-
"sourcesContent": ["import { type CivProps } from \"../../types\";\n\nexport const Unknown = ({ civid, name, type, component }: CivProps) => {\n\treturn (\n\t\t<div className=\"bg-red-900 text-white p-6 my-5 flex flex-col rounded-lg\">\n\t\t\t<div>\n\t\t\t\t<strong>Unknown Component</strong>\n\t\t\t\t{component && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span> </span>\n\t\t\t\t\t\t<span>({component})</span>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t<div>civid: {civid}</div>\n\t\t\t<div>\n\t\t\t\tname: {name} ({type})\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n"],
|
|
4
|
+
"sourcesContent": ["import { type CivProps } from \"../../types/index.js\";\n\nexport const Unknown = ({ civid, name, type, component }: CivProps) => {\n\treturn (\n\t\t<div className=\"bg-red-900 text-white p-6 my-5 flex flex-col rounded-lg\">\n\t\t\t<div>\n\t\t\t\t<strong>Unknown Component</strong>\n\t\t\t\t{component && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span> </span>\n\t\t\t\t\t\t<span>({component})</span>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t<div>civid: {civid}</div>\n\t\t\t<div>\n\t\t\t\tname: {name} ({type})\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n"],
|
|
5
5
|
"mappings": "AAMI,SAEC,UAFD,KAIE,YAJF;AANJ,eAA8B;AAEvB,MAAM,UAAU,CAAC,EAAE,OAAO,MAAM,MAAM,UAAU,MAAgB;AACtE,SACC,qBAAC,SAAI,WAAU,2DACd;AAAA,yBAAC,SACA;AAAA,0BAAC,YAAO,+BAAiB;AAAA,MACxB,aACA,iCACC;AAAA,4BAAC,UAAK,eAAC;AAAA,QACP,qBAAC,UAAK;AAAA;AAAA,UAAE;AAAA,UAAU;AAAA,WAAC;AAAA,SACpB;AAAA,OAEF;AAAA,IACA,qBAAC,SAAI;AAAA;AAAA,MAAQ;AAAA,OAAM;AAAA,IACnB,qBAAC,SAAI;AAAA;AAAA,MACG;AAAA,MAAK;AAAA,MAAG;AAAA,MAAK;AAAA,OACrB;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Unknown";
|
|
1
|
+
export * from "./Unknown.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/components/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export * from "./App";
|
|
2
|
-
export * from "./Error";
|
|
3
|
-
export * from "./Layout";
|
|
4
|
-
export * from "./Preview";
|
|
5
|
-
export * from "./Section";
|
|
6
|
-
export * from "./Unknown";
|
|
7
|
-
export * from "./Preview";
|
|
1
|
+
export * from "./App/index.js";
|
|
2
|
+
export * from "./Error/index.js";
|
|
3
|
+
export * from "./Layout/index.js";
|
|
4
|
+
export * from "./Preview/index.js";
|
|
5
|
+
export * from "./Section/index.js";
|
|
6
|
+
export * from "./Unknown/index.js";
|
|
8
7
|
//# 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 \"./App\";\r\nexport * from \"./Error\";\r\nexport * from \"./Layout\";\r\nexport * from \"./Preview\";\r\nexport * from \"./Section\";\r\nexport * from \"./Unknown\";\r\
|
|
5
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;
|
|
4
|
+
"sourcesContent": ["export * from \"./App/index.js\";\r\nexport * from \"./Error/index.js\";\r\nexport * from \"./Layout/index.js\";\r\nexport * from \"./Preview/index.js\";\r\nexport * from \"./Section/index.js\";\r\nexport * from \"./Unknown/index.js\";\r\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/contexts/ComponentMapContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Unknown, Error, type ErrorProps } from \"../components\";\r\nimport type { CivProps, ComponentMap } from \"../types\";\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\tError,\r\n\tUnknown,\r\n});\r\n\r\nexport const ComponentMapProvider = ComponentMapContext.Provider;\r\n\r\nexport const useComponentMap = () => useContext(ComponentMapContext);\r\n"],
|
|
4
|
+
"sourcesContent": ["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\tError,\r\n\tUnknown,\r\n});\r\n\r\nexport const ComponentMapProvider = ComponentMapContext.Provider;\r\n\r\nexport const useComponentMap = () => useContext(ComponentMapContext);\r\n"],
|
|
5
5
|
"mappings": "AAAA,SAAS,SAAS,aAA8B;AAEhD,SAAS,eAAe,kBAA2B;AAEnD,MAAM,sBAAsB,cAIzB;AAAA,EACF,MAAM,CAAC;AAAA,EACP;AAAA,EACA;AACD,CAAC;AAEM,MAAM,uBAAuB,oBAAoB;AAEjD,MAAM,kBAAkB,MAAM,WAAW,mBAAmB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/contexts/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./ComponentMapContext";
|
|
1
|
+
export * from "./ComponentMapContext.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./App";
|
|
1
|
+
export * from "./App.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ErrorProps } from "./Error.types";
|
|
1
|
+
import type { ErrorProps } from "./Error.types.js";
|
|
2
2
|
export declare function Error({ status, message }: ErrorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Error";
|
|
2
|
-
export * from "./Error.types";
|
|
1
|
+
export * from "./Error.js";
|
|
2
|
+
export * from "./Error.types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./Layout";
|
|
1
|
+
export * from "./Layout.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropsWithChildren } from "react";
|
|
2
|
-
import type { PreviewContextState } from "./PreviewPageWrapper";
|
|
2
|
+
import type { PreviewContextState } from "./PreviewPageWrapper.js";
|
|
3
3
|
type PreviewCivWrapper = PropsWithChildren<{
|
|
4
4
|
civid: string;
|
|
5
5
|
}> & PreviewContextState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropsWithChildren } from "react";
|
|
2
|
-
import type { CivProps, PageData } from "../../types";
|
|
2
|
+
import type { CivProps, PageData } from "../../types/index.js";
|
|
3
3
|
export interface PreviewContextState {
|
|
4
4
|
onCivEnter: (civid: string) => void;
|
|
5
5
|
highlighted?: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./PreviewCivWrapper";
|
|
2
|
-
export * from "./PreviewPageWrapper";
|
|
3
|
-
export * from "./PreviewContent";
|
|
1
|
+
export * from "./PreviewCivWrapper.js";
|
|
2
|
+
export * from "./PreviewPageWrapper.js";
|
|
3
|
+
export * from "./PreviewContent.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { SectionProps } from "./Section.types";
|
|
1
|
+
import type { SectionProps } from "./Section.types.js";
|
|
2
2
|
export declare function Section({ section }: SectionProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CivProps } from "../../types";
|
|
1
|
+
import type { CivProps } from "../../types/index.js";
|
|
2
2
|
export declare function SectionItem(civ: CivProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CivProps } from "../../types";
|
|
1
|
+
import type { CivProps } from "../../types/index.js";
|
|
2
2
|
export declare function SectionItemCiv(civ: CivProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./Section";
|
|
2
|
-
export * from "./SectionItem";
|
|
3
|
-
export * from "./SectionItemCiv";
|
|
4
|
-
export * from "./Section.types";
|
|
1
|
+
export * from "./Section.js";
|
|
2
|
+
export * from "./SectionItem.js";
|
|
3
|
+
export * from "./SectionItemCiv.js";
|
|
4
|
+
export * from "./Section.types.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type CivProps } from "../../types";
|
|
1
|
+
import { type CivProps } from "../../types/index.js";
|
|
2
2
|
export declare const Unknown: ({ civid, name, type, component }: CivProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./Unknown";
|
|
1
|
+
export * from "./Unknown.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export * from "./App";
|
|
2
|
-
export * from "./Error";
|
|
3
|
-
export * from "./Layout";
|
|
4
|
-
export * from "./Preview";
|
|
5
|
-
export * from "./Section";
|
|
6
|
-
export * from "./Unknown";
|
|
7
|
-
export * from "./Preview";
|
|
1
|
+
export * from "./App/index.js";
|
|
2
|
+
export * from "./Error/index.js";
|
|
3
|
+
export * from "./Layout/index.js";
|
|
4
|
+
export * from "./Preview/index.js";
|
|
5
|
+
export * from "./Section/index.js";
|
|
6
|
+
export * from "./Unknown/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ErrorProps } from "../components";
|
|
2
|
-
import type { CivProps, ComponentMap } from "../types";
|
|
1
|
+
import { type ErrorProps } from "../components/index.js";
|
|
2
|
+
import type { CivProps, ComponentMap } from "../types/index.js";
|
|
3
3
|
import { type FC } from "react";
|
|
4
4
|
export declare const ComponentMapProvider: import("react").Provider<{
|
|
5
5
|
civs: ComponentMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./ComponentMapContext";
|
|
1
|
+
export * from "./ComponentMapContext.js";
|
package/dist/types/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./cms";
|
|
1
|
+
export * from "./cms.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./cms";
|
|
1
|
+
export * from "./cms.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./getCmsUrl";
|
|
2
|
-
export * from "./getPageContent";
|
|
1
|
+
export * from "./getCmsUrl.js";
|
|
2
|
+
export * from "./getPageContent.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/getPageContent.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CivProps, PageData } from \"../types\";\r\nimport { getCmsUrl } from \"./getCmsUrl\";\r\n\r\nexport type { PageData };\r\n\r\nconst previewPath = \"/includes/plugins/nav/preview_civs/\";\r\n\r\nexport async function getPageContent(\r\n\treq: Request\r\n): Promise<PageData<CivProps>> {\r\n\tconst incomingUrl = new URL(req.url, \"http://placeholder.com\");\r\n\tconst cmsUrl = getCmsUrl(incomingUrl.host);\r\n\r\n\tif (\r\n\t\t!incomingUrl.pathname.endsWith(\"/\") ||\r\n\t\t/\\.[^/]+$/.test(incomingUrl.pathname)\r\n\t) {\r\n\t\t// If it's a file request, we append /content.json\r\n\t\tcmsUrl.pathname = incomingUrl.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 = incomingUrl.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\t\"X-Forwarded-For\":\r\n\t\t\treq.headers.get(\"x-real-ip\") ||\r\n\t\t\treq.headers.get(\"x-forwarded-host\") ||\r\n\t\t\t\"\",\r\n\t\t\"User-Agent\": req.headers.get(\"user-agent\") || \"\",\r\n\t};\r\n\r\n\ttry {\r\n\t\tlet body: URLSearchParams | undefined = undefined;\r\n\r\n\t\t/**\r\n\t\t * If this is the live preview page, we need to append the search params from the incoming URL\r\n\t\t * and send the CIVs along with the request.\r\n\t\t */\r\n\t\tif (req.method === \"POST\" && incomingUrl.pathname === previewPath) {\r\n\t\t\tincomingUrl.searchParams.forEach((val, key) => {\r\n\t\t\t\tcmsUrl.searchParams.set(key, val);\r\n\t\t\t});\r\n\r\n\t\t\tconst formData = await req.formData();\r\n\t\t\tconst civs = formData.get(\"headless_civs\");\r\n\r\n\t\t\tif (typeof civs !== \"string\") {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t\"Posted CIVs were not a base64 encoded string.\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tconst data = JSON.parse(atob(civs));\r\n\r\n\t\t\treturn data;\r\n\t\t}\r\n\r\n\t\tconst url = cmsUrl.toString();\r\n\t\tconst { method } = req;\r\n\t\tconst fetchParams: RequestInit = {\r\n\t\t\tmethod,\r\n\t\t\theaders,\r\n\t\t\tbody,\r\n\t\t};\r\n\r\n\t\tconsole.log(\"Making page content request:\", {\r\n\t\t\turl,\r\n\t\t\t...fetchParams,\r\n\t\t});\r\n\r\n\t\tconst result = await fetch(url, fetchParams).then((res) => res.json());\r\n\t\treturn result;\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"],
|
|
4
|
+
"sourcesContent": ["import type { CivProps, PageData } from \"../types/index.js\";\r\nimport { getCmsUrl } from \"./getCmsUrl.js\";\r\n\r\nexport type { PageData };\r\n\r\nconst previewPath = \"/includes/plugins/nav/preview_civs/\";\r\n\r\nexport async function getPageContent(\r\n\treq: Request\r\n): Promise<PageData<CivProps>> {\r\n\tconst incomingUrl = new URL(req.url, \"http://placeholder.com\");\r\n\tconst cmsUrl = getCmsUrl(incomingUrl.host);\r\n\r\n\tif (\r\n\t\t!incomingUrl.pathname.endsWith(\"/\") ||\r\n\t\t/\\.[^/]+$/.test(incomingUrl.pathname)\r\n\t) {\r\n\t\t// If it's a file request, we append /content.json\r\n\t\tcmsUrl.pathname = incomingUrl.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 = incomingUrl.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\t\"X-Forwarded-For\":\r\n\t\t\treq.headers.get(\"x-real-ip\") ||\r\n\t\t\treq.headers.get(\"x-forwarded-host\") ||\r\n\t\t\t\"\",\r\n\t\t\"User-Agent\": req.headers.get(\"user-agent\") || \"\",\r\n\t};\r\n\r\n\ttry {\r\n\t\tlet body: URLSearchParams | undefined = undefined;\r\n\r\n\t\t/**\r\n\t\t * If this is the live preview page, we need to append the search params from the incoming URL\r\n\t\t * and send the CIVs along with the request.\r\n\t\t */\r\n\t\tif (req.method === \"POST\" && incomingUrl.pathname === previewPath) {\r\n\t\t\tincomingUrl.searchParams.forEach((val, key) => {\r\n\t\t\t\tcmsUrl.searchParams.set(key, val);\r\n\t\t\t});\r\n\r\n\t\t\tconst formData = await req.formData();\r\n\t\t\tconst civs = formData.get(\"headless_civs\");\r\n\r\n\t\t\tif (typeof civs !== \"string\") {\r\n\t\t\t\tthrow new Error(\r\n\t\t\t\t\t\"Posted CIVs were not a base64 encoded string.\"\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tconst data = JSON.parse(atob(civs));\r\n\r\n\t\t\treturn data;\r\n\t\t}\r\n\r\n\t\tconst url = cmsUrl.toString();\r\n\t\tconst { method } = req;\r\n\t\tconst fetchParams: RequestInit = {\r\n\t\t\tmethod,\r\n\t\t\theaders,\r\n\t\t\tbody,\r\n\t\t};\r\n\r\n\t\tconsole.log(\"Making page content request:\", {\r\n\t\t\turl,\r\n\t\t\t...fetchParams,\r\n\t\t});\r\n\r\n\t\tconst result = await fetch(url, fetchParams).then((res) => res.json());\r\n\t\treturn result;\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
5
|
"mappings": "AACA,SAAS,iBAAiB;AAI1B,MAAM,cAAc;AAEpB,eAAsB,eACrB,KAC8B;AAC9B,QAAM,cAAc,IAAI,IAAI,IAAI,KAAK,wBAAwB;AAC7D,QAAM,SAAS,UAAU,YAAY,IAAI;AAEzC,MACC,CAAC,YAAY,SAAS,SAAS,GAAG,KAClC,WAAW,KAAK,YAAY,QAAQ,GACnC;AAED,WAAO,WAAW,YAAY,WAAW;AAAA,EAC1C,OAAO;AAEN,WAAO,WAAW,YAAY,WAAW;AAAA,EAC1C;AAEA,QAAM,UAAkC;AAAA,IACvC,mBAAmB;AAAA,IACnB,mBACC,IAAI,QAAQ,IAAI,WAAW,KAC3B,IAAI,QAAQ,IAAI,kBAAkB,KAClC;AAAA,IACD,cAAc,IAAI,QAAQ,IAAI,YAAY,KAAK;AAAA,EAChD;AAEA,MAAI;AACH,QAAI,OAAoC;AAMxC,QAAI,IAAI,WAAW,UAAU,YAAY,aAAa,aAAa;AAClE,kBAAY,aAAa,QAAQ,CAAC,KAAK,QAAQ;AAC9C,eAAO,aAAa,IAAI,KAAK,GAAG;AAAA,MACjC,CAAC;AAED,YAAM,WAAW,MAAM,IAAI,SAAS;AACpC,YAAM,OAAO,SAAS,IAAI,eAAe;AAEzC,UAAI,OAAO,SAAS,UAAU;AAC7B,cAAM,IAAI;AAAA,UACT;AAAA,QACD;AAAA,MACD;AAEA,YAAM,OAAO,KAAK,MAAM,KAAK,IAAI,CAAC;AAElC,aAAO;AAAA,IACR;AAEA,UAAM,MAAM,OAAO,SAAS;AAC5B,UAAM,EAAE,OAAO,IAAI;AACnB,UAAM,cAA2B;AAAA,MAChC;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAEA,YAAQ,IAAI,gCAAgC;AAAA,MAC3C;AAAA,MACA,GAAG;AAAA,IACJ,CAAC;AAED,UAAM,SAAS,MAAM,MAAM,KAAK,WAAW,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC;AACrE,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/dist/utils/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./getCmsUrl";
|
|
2
|
-
export * from "./getPageContent";
|
|
1
|
+
export * from "./getCmsUrl.js";
|
|
2
|
+
export * from "./getPageContent.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"./getCmsUrl\";\r\nexport * from \"./getPageContent\";\r\n"],
|
|
4
|
+
"sourcesContent": ["export * from \"./getCmsUrl.js\";\r\nexport * from \"./getPageContent.js\";\r\n"],
|
|
5
5
|
"mappings": "AAAA,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleview/cms-foundation",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.14",
|
|
5
5
|
"description": "Provides helper types and components to assist when working with Granicus CMS Reactor.",
|
|
6
6
|
"packageManager": "yarn@4.6.0+sha224.acd0786f07ffc6c933940eb65fc1d627131ddf5455bddcc295dc90fd",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"install:host": "npm install -f --package-lock false",
|
|
9
|
+
"typecheck": "tsc --noEmit",
|
|
9
10
|
"build": "tsx build",
|
|
10
11
|
"start": "tsx build --watch"
|
|
11
12
|
},
|