@simpleview/cms-foundation 0.0.19 → 0.0.20
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/{esm/chunk-3XE3FU2Q.js → chunk-4BZHC5AC.js} +2 -2
- package/dist/{esm/chunk-3XE3FU2Q.js.map → chunk-4BZHC5AC.js.map} +1 -1
- package/dist/{esm/chunk-XAA4SHWQ.js → chunk-EE5DCIH7.js} +1 -1
- package/dist/{esm/chunk-XAA4SHWQ.js.map → chunk-EE5DCIH7.js.map} +1 -1
- package/dist/{esm/chunk-KOFH3YD5.js → chunk-EEKFLXZI.js} +1 -1
- package/dist/{esm/chunk-KOFH3YD5.js.map → chunk-EEKFLXZI.js.map} +1 -1
- package/dist/{esm/chunk-JBH3L5H3.js → chunk-FJML4RHB.js} +2 -2
- package/dist/{esm/chunk-JBH3L5H3.js.map → chunk-FJML4RHB.js.map} +1 -1
- package/dist/{esm/chunk-Y3F3FIHL.js → chunk-GPTPACV2.js} +1 -1
- package/dist/{esm/chunk-Y3F3FIHL.js.map → chunk-GPTPACV2.js.map} +1 -1
- package/dist/{esm/chunk-OXNPIKMX.js → chunk-MNT3ZFUU.js} +2 -2
- package/dist/{esm/chunk-OXNPIKMX.js.map → chunk-MNT3ZFUU.js.map} +1 -1
- package/dist/{esm/chunk-DSB2O33V.js → chunk-NX7QUAFC.js} +5 -5
- package/dist/{esm/chunk-DSB2O33V.js.map → chunk-NX7QUAFC.js.map} +1 -1
- package/dist/{esm/chunk-3MVAULSY.js → chunk-OEYLOZQK.js} +1 -1
- package/dist/{esm/chunk-3MVAULSY.js.map → chunk-OEYLOZQK.js.map} +1 -1
- package/dist/{esm/chunk-DZHGFBDL.js → chunk-P3WX4DFS.js} +1 -1
- package/dist/{esm/chunk-DZHGFBDL.js.map → chunk-P3WX4DFS.js.map} +1 -1
- package/dist/{esm/chunk-SKKWOM3E.js → chunk-VV3NKXSX.js} +1 -1
- package/dist/{esm/chunk-SKKWOM3E.js.map → chunk-VV3NKXSX.js.map} +1 -1
- package/dist/components/App/App.js +5 -5
- package/dist/components/App/App.js.map +3 -3
- package/dist/components/App/index.js +9 -1
- package/dist/components/App/index.js.map +3 -3
- package/dist/components/Error/Error.js +4 -11
- package/dist/components/Error/Error.js.map +3 -3
- package/dist/components/Error/Error.types.js +1 -0
- package/dist/components/Error/index.js +9 -2
- package/dist/components/Error/index.js.map +3 -3
- package/dist/components/Layout/Layout.js +5 -25
- package/dist/components/Layout/Layout.js.map +3 -3
- package/dist/components/Layout/index.js +9 -1
- package/dist/components/Layout/index.js.map +3 -3
- package/dist/components/Preview/PreviewCivWrapper.js +4 -25
- package/dist/components/Preview/PreviewCivWrapper.js.map +3 -3
- package/dist/components/Preview/PreviewContent.js +19 -10
- package/dist/components/Preview/PreviewContent.js.map +3 -3
- package/dist/components/Preview/PreviewPageWrapper.js +4 -85
- package/dist/components/Preview/PreviewPageWrapper.js.map +3 -3
- package/dist/components/Preview/index.js +30 -3
- package/dist/components/Preview/index.js.map +3 -3
- package/dist/components/Section/Section.js +19 -8
- package/dist/components/Section/Section.js.map +3 -3
- package/dist/components/Section/Section.types.js +1 -0
- package/dist/components/Section/SectionItem.js +19 -11
- package/dist/components/Section/SectionItem.js.map +3 -3
- package/dist/components/Section/SectionItemCiv.js +19 -20
- package/dist/components/Section/SectionItemCiv.js.map +3 -3
- package/dist/components/Section/index.js +26 -4
- package/dist/components/Section/index.js.map +3 -3
- package/dist/components/Unknown/Unknown.js +6 -28
- package/dist/components/Unknown/Unknown.js.map +3 -3
- package/dist/components/Unknown/index.js +10 -1
- package/dist/components/Unknown/index.js.map +3 -3
- package/dist/components/index.js +48 -6
- package/dist/components/index.js.map +3 -3
- package/dist/contexts/ComponentMapContext.js +20 -9
- package/dist/contexts/ComponentMapContext.js.map +3 -3
- package/dist/contexts/index.js +24 -1
- package/dist/contexts/index.js.map +3 -3
- package/dist/routes/index.js +7134 -3
- package/dist/routes/index.js.map +4 -4
- package/dist/types/cms.js +1 -0
- package/dist/types/index.js +2 -1
- package/dist/types/index.js.map +3 -3
- package/dist/utils/getCmsUrl.js +4 -5
- package/dist/utils/getCmsUrl.js.map +3 -3
- package/dist/utils/getPageContent.js +5 -50
- package/dist/utils/getPageContent.js.map +3 -3
- package/dist/utils/index.js +11 -2
- package/dist/utils/index.js.map +3 -3
- package/package.json +1 -1
- package/dist/esm/components/App/App.js +0 -9
- package/dist/esm/components/App/App.js.map +0 -7
- package/dist/esm/components/App/index.js +0 -10
- package/dist/esm/components/App/index.js.map +0 -7
- package/dist/esm/components/Error/Error.js +0 -8
- package/dist/esm/components/Error/Error.js.map +0 -7
- package/dist/esm/components/Error/Error.types.js +0 -2
- package/dist/esm/components/Error/Error.types.js.map +0 -7
- package/dist/esm/components/Error/index.js +0 -10
- package/dist/esm/components/Error/index.js.map +0 -7
- package/dist/esm/components/Layout/Layout.js +0 -9
- package/dist/esm/components/Layout/Layout.js.map +0 -7
- package/dist/esm/components/Layout/index.js +0 -10
- package/dist/esm/components/Layout/index.js.map +0 -7
- package/dist/esm/components/Preview/PreviewCivWrapper.js +0 -8
- package/dist/esm/components/Preview/PreviewCivWrapper.js.map +0 -7
- package/dist/esm/components/Preview/PreviewContent.js +0 -23
- package/dist/esm/components/Preview/PreviewContent.js.map +0 -7
- package/dist/esm/components/Preview/PreviewPageWrapper.js +0 -10
- package/dist/esm/components/Preview/PreviewPageWrapper.js.map +0 -7
- package/dist/esm/components/Preview/index.js +0 -31
- package/dist/esm/components/Preview/index.js.map +0 -7
- package/dist/esm/components/Section/Section.js +0 -23
- package/dist/esm/components/Section/Section.js.map +0 -7
- package/dist/esm/components/Section/Section.types.js +0 -2
- package/dist/esm/components/Section/Section.types.js.map +0 -7
- package/dist/esm/components/Section/SectionItem.js +0 -23
- package/dist/esm/components/Section/SectionItem.js.map +0 -7
- package/dist/esm/components/Section/SectionItemCiv.js +0 -23
- package/dist/esm/components/Section/SectionItemCiv.js.map +0 -7
- package/dist/esm/components/Section/index.js +0 -27
- package/dist/esm/components/Section/index.js.map +0 -7
- package/dist/esm/components/Unknown/Unknown.js +0 -10
- package/dist/esm/components/Unknown/Unknown.js.map +0 -7
- package/dist/esm/components/Unknown/index.js +0 -11
- package/dist/esm/components/Unknown/index.js.map +0 -7
- package/dist/esm/components/index.js +0 -49
- package/dist/esm/components/index.js.map +0 -7
- package/dist/esm/contexts/ComponentMapContext.js +0 -25
- package/dist/esm/contexts/ComponentMapContext.js.map +0 -7
- package/dist/esm/contexts/index.js +0 -25
- package/dist/esm/contexts/index.js.map +0 -7
- package/dist/esm/routes/index.js +0 -7142
- package/dist/esm/routes/index.js.map +0 -7
- package/dist/esm/types/cms.js +0 -2
- package/dist/esm/types/cms.js.map +0 -7
- package/dist/esm/types/index.js +0 -3
- package/dist/esm/types/index.js.map +0 -7
- package/dist/esm/utils/getCmsUrl.js +0 -8
- package/dist/esm/utils/getCmsUrl.js.map +0 -7
- package/dist/esm/utils/getPageContent.js +0 -9
- package/dist/esm/utils/getPageContent.js.map +0 -7
- package/dist/esm/utils/index.js +0 -12
- package/dist/esm/utils/index.js.map +0 -7
- /package/dist/{esm/chunk-4LSFAAZW.js → chunk-4LSFAAZW.js} +0 -0
- /package/dist/{esm/chunk-4LSFAAZW.js.map → chunk-4LSFAAZW.js.map} +0 -0
- /package/dist/{esm/chunk-5WRI5ZAA.js → chunk-5WRI5ZAA.js} +0 -0
- /package/dist/{esm/chunk-5WRI5ZAA.js.map → chunk-5WRI5ZAA.js.map} +0 -0
- /package/dist/{esm/chunk-CMALSZV3.js → chunk-CMALSZV3.js} +0 -0
- /package/dist/{esm/chunk-CMALSZV3.js.map → chunk-CMALSZV3.js.map} +0 -0
- /package/dist/{esm/chunk-DG37VYL5.js → chunk-DG37VYL5.js} +0 -0
- /package/dist/{esm/chunk-DG37VYL5.js.map → chunk-DG37VYL5.js.map} +0 -0
- /package/dist/{esm/chunk-EG5F4AP4.js → chunk-EG5F4AP4.js} +0 -0
- /package/dist/{esm/chunk-EG5F4AP4.js.map → chunk-EG5F4AP4.js.map} +0 -0
- /package/dist/{esm/chunk-EWRVCIV6.js → chunk-EWRVCIV6.js} +0 -0
- /package/dist/{esm/chunk-EWRVCIV6.js.map → chunk-EWRVCIV6.js.map} +0 -0
- /package/dist/{esm/chunk-F5L7DWHD.js → chunk-F5L7DWHD.js} +0 -0
- /package/dist/{esm/chunk-F5L7DWHD.js.map → chunk-F5L7DWHD.js.map} +0 -0
- /package/dist/{esm/chunk-XG5CMDEI.js → chunk-XG5CMDEI.js} +0 -0
- /package/dist/{esm/chunk-XG5CMDEI.js.map → chunk-XG5CMDEI.js.map} +0 -0
- /package/dist/{esm/chunk-ZQUGFKHP.js → chunk-ZQUGFKHP.js} +0 -0
- /package/dist/{esm/chunk-ZQUGFKHP.js.map → chunk-ZQUGFKHP.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../src/utils/getCmsUrl.ts"],
|
|
4
4
|
"sourcesContent": ["const { CMS_DOMAIN } = process.env;\r\n\r\nexport function getCmsUrl(host: string): URL {\r\n\tconst siteClient = host.split(\".\")[0];\r\n\treturn new URL(`https://${siteClient}.${CMS_DOMAIN}`);\r\n}\r\n"],
|
|
5
5
|
"mappings": ";AAAA,IAAM,EAAE,WAAW,IAAI,QAAQ;AAExB,SAAS,UAAU,MAAmB;AAC5C,QAAM,aAAa,KAAK,MAAM,GAAG,EAAE,CAAC;AACpC,SAAO,IAAI,IAAI,WAAW,UAAU,IAAI,UAAU,EAAE;AACrD;",
|
|
6
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCmsUrl
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EEKFLXZI.js";
|
|
4
4
|
|
|
5
5
|
// src/utils/getPageContent.ts
|
|
6
6
|
var previewPath = "/includes/plugins/nav/preview_civs/";
|
|
@@ -56,4 +56,4 @@ async function getPageContent(req) {
|
|
|
56
56
|
export {
|
|
57
57
|
getPageContent
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-FJML4RHB.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../src/utils/getPageContent.ts"],
|
|
4
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": ";;;;;AAKA,IAAM,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": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../src/components/Unknown/Unknown.tsx"],
|
|
4
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;AAJG,IAAM,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": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Outlet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EE5DCIH7.js";
|
|
4
4
|
|
|
5
5
|
// src/components/App/App.tsx
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -11,4 +11,4 @@ function App() {
|
|
|
11
11
|
export {
|
|
12
12
|
App
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-MNT3ZFUU.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../src/components/App/App.tsx"],
|
|
4
4
|
"sourcesContent": ["import { Outlet } from \"react-router\";\n\nexport function App() {\n\treturn <Outlet />;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;AAGQ;AADD,SAAS,MAAM;AACrB,SAAO,oBAAC,UAAO;AAChB;",
|
|
6
6
|
"names": []
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PreviewCivWrapper
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OEYLOZQK.js";
|
|
4
4
|
import {
|
|
5
5
|
usePreview
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-P3WX4DFS.js";
|
|
7
7
|
import {
|
|
8
8
|
Error
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VV3NKXSX.js";
|
|
10
10
|
import {
|
|
11
11
|
Unknown
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GPTPACV2.js";
|
|
13
13
|
|
|
14
14
|
// src/components/Preview/PreviewContent.tsx
|
|
15
15
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -79,4 +79,4 @@ export {
|
|
|
79
79
|
Section,
|
|
80
80
|
PreviewContent
|
|
81
81
|
};
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
82
|
+
//# sourceMappingURL=chunk-NX7QUAFC.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
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
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\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\n\r\nexport function SectionItemCiv(civ: CivProps) {\r\n\tconst map = useComponentMap();\r\n\tconsole.log(\"SECTION 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
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,CAAC;AAAA,EACP;AAAA,EACA;AACD,CAAC;AAEM,IAAM,uBAAuB,oBAAoB;AAEjD,IAAM,kBAAkB,MAAM,WAAW,mBAAmB;;;ACPhE,gBAAAA,YAAA;AANI,SAAS,eAAe,KAAe;AAC7C,QAAM,MAAM,gBAAgB;AAC5B,UAAQ,IAAI,eAAe,GAAG;AAE9B,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;;;ACdS,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
6
|
"names": ["jsx", "jsx", "jsx"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../src/components/Preview/PreviewCivWrapper.tsx"],
|
|
4
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": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../src/components/Preview/PreviewPageWrapper.tsx"],
|
|
4
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": ";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
6
|
"names": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../src/components/Error/Error.tsx"],
|
|
4
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": []
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
App
|
|
3
|
+
} from "../../chunk-MNT3ZFUU.js";
|
|
4
|
+
import "../../chunk-EE5DCIH7.js";
|
|
5
|
+
import "../../chunk-5WRI5ZAA.js";
|
|
6
6
|
export {
|
|
7
7
|
App
|
|
8
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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-4BZHC5AC.js";
|
|
4
|
+
import "../../chunk-EE5DCIH7.js";
|
|
5
|
+
import "../../chunk-5WRI5ZAA.js";
|
|
26
6
|
export {
|
|
27
7
|
Layout
|
|
28
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import {
|
|
2
|
+
PreviewContent
|
|
3
|
+
} from "../../chunk-NX7QUAFC.js";
|
|
4
|
+
import "../../chunk-OEYLOZQK.js";
|
|
5
|
+
import "../../chunk-P3WX4DFS.js";
|
|
6
|
+
import "../../chunk-F5L7DWHD.js";
|
|
7
|
+
import "../../chunk-MNT3ZFUU.js";
|
|
8
|
+
import "../../chunk-CMALSZV3.js";
|
|
9
|
+
import "../../chunk-VV3NKXSX.js";
|
|
10
|
+
import "../../chunk-EG5F4AP4.js";
|
|
11
|
+
import "../../chunk-XG5CMDEI.js";
|
|
12
|
+
import "../../chunk-4BZHC5AC.js";
|
|
13
|
+
import "../../chunk-EE5DCIH7.js";
|
|
14
|
+
import "../../chunk-EWRVCIV6.js";
|
|
15
|
+
import "../../chunk-DG37VYL5.js";
|
|
16
|
+
import "../../chunk-GPTPACV2.js";
|
|
17
|
+
import "../../chunk-4LSFAAZW.js";
|
|
18
|
+
import "../../chunk-ZQUGFKHP.js";
|
|
19
|
+
import "../../chunk-5WRI5ZAA.js";
|
|
11
20
|
export {
|
|
12
21
|
PreviewContent
|
|
13
22
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
PreviewContent
|
|
3
|
+
} from "../../chunk-NX7QUAFC.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-MNT3ZFUU.js";
|
|
13
|
+
import "../../chunk-CMALSZV3.js";
|
|
14
|
+
import "../../chunk-VV3NKXSX.js";
|
|
15
|
+
import "../../chunk-EG5F4AP4.js";
|
|
16
|
+
import "../../chunk-XG5CMDEI.js";
|
|
17
|
+
import "../../chunk-4BZHC5AC.js";
|
|
18
|
+
import "../../chunk-EE5DCIH7.js";
|
|
19
|
+
import "../../chunk-EWRVCIV6.js";
|
|
20
|
+
import "../../chunk-DG37VYL5.js";
|
|
21
|
+
import "../../chunk-GPTPACV2.js";
|
|
22
|
+
import "../../chunk-4LSFAAZW.js";
|
|
23
|
+
import "../../chunk-ZQUGFKHP.js";
|
|
24
|
+
import "../../chunk-5WRI5ZAA.js";
|
|
25
|
+
export {
|
|
26
|
+
PreviewCivWrapper,
|
|
27
|
+
PreviewContent,
|
|
28
|
+
PreviewPageWrapper,
|
|
29
|
+
usePreview
|
|
30
|
+
};
|
|
4
31
|
//# sourceMappingURL=index.js.map
|