@simpleview/cms-foundation 0.0.17 → 0.0.18

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.
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useComponentMap } from "../../contexts/index.js";
3
3
  function SectionItemCiv(civ) {
4
4
  const map = useComponentMap();
5
+ console.log("SECTION MAP", map);
5
6
  if (civ === void 0) {
6
7
  return /* @__PURE__ */ jsx(
7
8
  map.Error,
@@ -15,7 +16,7 @@ function SectionItemCiv(civ) {
15
16
  if (Component === void 0) {
16
17
  return /* @__PURE__ */ jsx(map.Unknown, { ...civ });
17
18
  }
18
- return /* @__PURE__ */ jsx(map.ErrorBoundary, { children: /* @__PURE__ */ jsx(Component, { ...civ }) });
19
+ return /* @__PURE__ */ jsx(Component, { ...civ });
19
20
  }
20
21
  export {
21
22
  SectionItemCiv
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/Section/SectionItemCiv.tsx"],
4
- "sourcesContent": ["import { useComponentMap } from \"../../contexts/index.js\";\r\nimport type { CivProps } from \"../../types/index.js\";\r\n\r\nexport function SectionItemCiv(civ: CivProps) {\r\n\tconst map = useComponentMap();\r\n\r\n\tif (civ === undefined) {\r\n\t\treturn (\r\n\t\t\t<map.Error\r\n\t\t\t\tstatus={500}\r\n\t\t\t\tmessage=\"Is the CMS API running? I bet it isn't \uD83D\uDE09\"\r\n\t\t\t/>\r\n\t\t);\r\n\t}\r\n\r\n\tconst Component = map.civs[civ.component];\r\n\r\n\tif (Component === undefined) {\r\n\t\treturn <map.Unknown {...civ} />;\r\n\t}\r\n\r\n\treturn (\r\n\t\t<map.ErrorBoundary>\r\n\t\t\t<Component {...civ} />\r\n\t\t</map.ErrorBoundary>\r\n\t);\r\n}\r\n"],
5
- "mappings": "AAQG;AARH,SAAS,uBAAuB;AAGzB,SAAS,eAAe,KAAe;AAC7C,QAAM,MAAM,gBAAgB;AAE5B,MAAI,QAAQ,QAAW;AACtB,WACC;AAAA,MAAC,IAAI;AAAA,MAAJ;AAAA,QACA,QAAQ;AAAA,QACR,SAAQ;AAAA;AAAA,IACT;AAAA,EAEF;AAEA,QAAM,YAAY,IAAI,KAAK,IAAI,SAAS;AAExC,MAAI,cAAc,QAAW;AAC5B,WAAO,oBAAC,IAAI,SAAJ,EAAa,GAAG,KAAK;AAAA,EAC9B;AAEA,SACC,oBAAC,IAAI,eAAJ,EACA,8BAAC,aAAW,GAAG,KAAK,GACrB;AAEF;",
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\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"],
5
+ "mappings": "AASG;AATH,SAAS,uBAAuB;AAGzB,SAAS,eAAe,KAAe;AAC7C,QAAM,MAAM,gBAAgB;AAC5B,UAAQ,IAAI,eAAe,GAAG;AAE9B,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,6 +1,5 @@
1
1
  export * from "./App/index.js";
2
2
  export * from "./Error/index.js";
3
- export * from "./ErrorBoundary/index.js";
4
3
  export * from "./Layout/index.js";
5
4
  export * from "./Preview/index.js";
6
5
  export * from "./Section/index.js";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/index.ts"],
4
- "sourcesContent": ["export * from \"./App/index.js\";\r\nexport * from \"./Error/index.js\";\r\nexport * from \"./ErrorBoundary/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;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,13 +1,8 @@
1
- import {
2
- Unknown,
3
- Error,
4
- ErrorBoundary
5
- } from "../components/index.js";
1
+ import { Unknown, Error } from "../components/index.js";
6
2
  import { createContext, useContext } from "react";
7
3
  const ComponentMapContext = createContext({
8
4
  civs: {},
9
5
  Error,
10
- ErrorBoundary,
11
6
  Unknown
12
7
  });
13
8
  const ComponentMapProvider = ComponentMapContext.Provider;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/contexts/ComponentMapContext.tsx"],
4
- "sourcesContent": ["import {\r\n\tUnknown,\r\n\tError,\r\n\tErrorBoundary,\r\n\ttype ErrorProps,\r\n\ttype ErrorBoundaryProps,\r\n} from \"../components/index.js\";\r\nimport type { CivProps, ComponentMap } from \"../types/index.js\";\r\nimport { createContext, useContext, type FC, type ComponentClass } from \"react\";\r\n\r\nconst ComponentMapContext = createContext<{\r\n\tcivs: ComponentMap;\r\n\tError: FC<ErrorProps>;\r\n\tErrorBoundary: ComponentClass<ErrorBoundaryProps>;\r\n\tUnknown: FC<CivProps>;\r\n}>({\r\n\tcivs: {},\r\n\tError,\r\n\tErrorBoundary,\r\n\tUnknown,\r\n});\r\n\r\nexport const ComponentMapProvider = ComponentMapContext.Provider;\r\n\r\nexport const useComponentMap = () => useContext(ComponentMapContext);\r\n"],
5
- "mappings": "AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OAGM;AAEP,SAAS,eAAe,kBAAgD;AAExE,MAAM,sBAAsB,cAKzB;AAAA,EACF,MAAM,CAAC;AAAA,EACP;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAEM,MAAM,uBAAuB,oBAAoB;AAEjD,MAAM,kBAAkB,MAAM,WAAW,mBAAmB;",
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
+ "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
  }
@@ -1,6 +1,5 @@
1
1
  export * from "./App/index.js";
2
2
  export * from "./Error/index.js";
3
- export * from "./ErrorBoundary/index.js";
4
3
  export * from "./Layout/index.js";
5
4
  export * from "./Preview/index.js";
6
5
  export * from "./Section/index.js";
@@ -1,15 +1,13 @@
1
- import { type ErrorProps, type ErrorBoundaryProps } from "../components/index.js";
1
+ import { type ErrorProps } from "../components/index.js";
2
2
  import type { CivProps, ComponentMap } from "../types/index.js";
3
- import { type FC, type ComponentClass } from "react";
3
+ import { type FC } from "react";
4
4
  export declare const ComponentMapProvider: import("react").Provider<{
5
5
  civs: ComponentMap;
6
6
  Error: FC<ErrorProps>;
7
- ErrorBoundary: ComponentClass<ErrorBoundaryProps>;
8
7
  Unknown: FC<CivProps>;
9
8
  }>;
10
9
  export declare const useComponentMap: () => {
11
10
  civs: ComponentMap;
12
11
  Error: FC<ErrorProps>;
13
- ErrorBoundary: ComponentClass<ErrorBoundaryProps>;
14
12
  Unknown: FC<CivProps>;
15
13
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simpleview/cms-foundation",
3
3
  "type": "module",
4
- "version": "0.0.17",
4
+ "version": "0.0.18",
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": {
@@ -1,30 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import React, { Component } from "react";
3
- class ErrorBoundary extends Component {
4
- constructor(props) {
5
- super(props);
6
- this.state = { hasError: false };
7
- }
8
- static getDerivedStateFromError(error) {
9
- return { hasError: true, error };
10
- }
11
- componentDidCatch(error, errorInfo) {
12
- console.error("ErrorBoundary caught an error:", error, errorInfo);
13
- }
14
- render() {
15
- if (this.state.hasError) {
16
- if (this.props.fallback) {
17
- return this.props.fallback;
18
- }
19
- return /* @__PURE__ */ jsxs("div", { style: { padding: "20px", textAlign: "center" }, children: [
20
- /* @__PURE__ */ jsx("h1", { children: "Something went wrong" }),
21
- /* @__PURE__ */ jsx("p", { children: this.state.error?.message })
22
- ] });
23
- }
24
- return this.props.children;
25
- }
26
- }
27
- export {
28
- ErrorBoundary
29
- };
30
- //# sourceMappingURL=ErrorBoundary.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/ErrorBoundary/ErrorBoundary.tsx"],
4
- "sourcesContent": ["import React, { Component, type ErrorInfo, type ReactNode } from \"react\";\r\nimport type {\r\n\tErrorBoundaryProps,\r\n\tErrorBoundaryState,\r\n} from \"./ErrorBoundary.types.js\";\r\n\r\nexport class ErrorBoundary extends Component<\r\n\tErrorBoundaryProps,\r\n\tErrorBoundaryState\r\n> {\r\n\tconstructor(props: ErrorBoundaryProps) {\r\n\t\tsuper(props);\r\n\t\tthis.state = { hasError: false };\r\n\t}\r\n\r\n\tstatic getDerivedStateFromError(error: Error): ErrorBoundaryState {\r\n\t\treturn { hasError: true, error };\r\n\t}\r\n\r\n\tcomponentDidCatch(error: Error, errorInfo: ErrorInfo): void {\r\n\t\tconsole.error(\"ErrorBoundary caught an error:\", error, errorInfo);\r\n\t}\r\n\r\n\trender(): ReactNode {\r\n\t\tif (this.state.hasError) {\r\n\t\t\tif (this.props.fallback) {\r\n\t\t\t\treturn this.props.fallback;\r\n\t\t\t}\r\n\r\n\t\t\treturn (\r\n\t\t\t\t<div style={{ padding: \"20px\", textAlign: \"center\" }}>\r\n\t\t\t\t\t<h1>Something went wrong</h1>\r\n\t\t\t\t\t<p>{this.state.error?.message}</p>\r\n\t\t\t\t</div>\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\treturn this.props.children;\r\n\t}\r\n}\r\n"],
5
- "mappings": "AA8BI,SACC,KADD;AA9BJ,OAAO,SAAS,iBAAiD;AAM1D,MAAM,sBAAsB,UAGjC;AAAA,EACD,YAAY,OAA2B;AACtC,UAAM,KAAK;AACX,SAAK,QAAQ,EAAE,UAAU,MAAM;AAAA,EAChC;AAAA,EAEA,OAAO,yBAAyB,OAAkC;AACjE,WAAO,EAAE,UAAU,MAAM,MAAM;AAAA,EAChC;AAAA,EAEA,kBAAkB,OAAc,WAA4B;AAC3D,YAAQ,MAAM,kCAAkC,OAAO,SAAS;AAAA,EACjE;AAAA,EAEA,SAAoB;AACnB,QAAI,KAAK,MAAM,UAAU;AACxB,UAAI,KAAK,MAAM,UAAU;AACxB,eAAO,KAAK,MAAM;AAAA,MACnB;AAEA,aACC,qBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,WAAW,SAAS,GAClD;AAAA,4BAAC,QAAG,kCAAoB;AAAA,QACxB,oBAAC,OAAG,eAAK,MAAM,OAAO,SAAQ;AAAA,SAC/B;AAAA,IAEF;AAEA,WAAO,KAAK,MAAM;AAAA,EACnB;AACD;",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=ErrorBoundary.types.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,3 +0,0 @@
1
- export * from "./ErrorBoundary.js";
2
- export * from "./ErrorBoundary.types.js";
3
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/ErrorBoundary/index.ts"],
4
- "sourcesContent": ["export * from \"./ErrorBoundary.js\";\r\nexport * from \"./ErrorBoundary.types.js\";\r\n"],
5
- "mappings": "AAAA,cAAc;AACd,cAAc;",
6
- "names": []
7
- }
@@ -1,8 +0,0 @@
1
- import { Component, type ErrorInfo, type ReactNode } from "react";
2
- import type { ErrorBoundaryProps, ErrorBoundaryState } from "./ErrorBoundary.types.js";
3
- export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
4
- constructor(props: ErrorBoundaryProps);
5
- static getDerivedStateFromError(error: Error): ErrorBoundaryState;
6
- componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
7
- render(): ReactNode;
8
- }
@@ -1,9 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- export interface ErrorBoundaryProps {
3
- children: ReactNode;
4
- fallback?: ReactNode;
5
- }
6
- export interface ErrorBoundaryState {
7
- hasError: boolean;
8
- error?: Error;
9
- }
@@ -1,2 +0,0 @@
1
- export * from "./ErrorBoundary.js";
2
- export * from "./ErrorBoundary.types.js";