@makeswift/runtime 0.29.0-canary.23 → 0.29.0-canary.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,7 +27,7 @@ class MakeswiftGraphQLApiClient {
27
27
  graphqlClient;
28
28
  constructor({ endpoint }) {
29
29
  this.graphqlClient = new import_client.GraphQLClient(endpoint, {
30
- "makeswift-runtime-version": "0.29.0-canary.23"
30
+ "makeswift-runtime-version": "0.29.0-canary.25"
31
31
  });
32
32
  }
33
33
  async getUnversionedResources({
@@ -223,7 +223,7 @@ class MakeswiftRestAPIClient {
223
223
  const requestHeaders = new Headers({
224
224
  "x-api-key": this.apiKey,
225
225
  "makeswift-site-api-key": this.apiKey,
226
- "makeswift-runtime-version": "0.29.0-canary.23"
226
+ "makeswift-runtime-version": "0.29.0-canary.25"
227
227
  });
228
228
  if (siteVersion?.token) {
229
229
  requestUrl.searchParams.set("version", siteVersion.version);
@@ -28,7 +28,7 @@ async function manifestHandler(req, { apiKey, manifest }) {
28
28
  return import_request_response.ApiResponse.json({ message: "Unauthorized" }, { status: 401 });
29
29
  }
30
30
  return import_request_response.ApiResponse.json({
31
- version: "0.29.0-canary.23",
31
+ version: "0.29.0-canary.25",
32
32
  interactionMode: true,
33
33
  clientSideNavigation: false,
34
34
  elementFromPoint: false,
@@ -24,14 +24,14 @@ module.exports = __toCommonJS(ErrorBoundary_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
25
  var import_react = require("react");
26
26
  class ErrorBoundary extends import_react.Component {
27
- static getDerivedStateFromError() {
28
- return { hasError: true };
27
+ static getDerivedStateFromError(error) {
28
+ return { hasError: true, details: error.message };
29
29
  }
30
30
  state = { hasError: false };
31
31
  render() {
32
32
  const { FallbackComponent } = this.props;
33
33
  if (this.state.hasError)
34
- return FallbackComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackComponent, {}) : null;
34
+ return FallbackComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackComponent, { details: this.state.details }) : null;
35
35
  return this.props.children;
36
36
  }
37
37
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/shared/ErrorBoundary.tsx"],"sourcesContent":["import { Component, ElementType, ReactNode } from 'react'\n\ntype ErrorProps = {\n FallbackComponent: ElementType\n children: ReactNode\n}\n\ntype State = {\n hasError: boolean\n}\n\nexport class ErrorBoundary extends Component<ErrorProps, State> {\n static getDerivedStateFromError() {\n return { hasError: true }\n }\n\n state = { hasError: false }\n\n render() {\n const { FallbackComponent } = this.props\n\n if (this.state.hasError) return FallbackComponent ? <FallbackComponent /> : null\n\n return this.props.children\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBwD;AArBxD,mBAAkD;AAW3C,MAAM,sBAAsB,uBAA6B;AAAA,EAC9D,OAAO,2BAA2B;AAChC,WAAO,EAAE,UAAU,KAAK;AAAA,EAC1B;AAAA,EAEA,QAAQ,EAAE,UAAU,MAAM;AAAA,EAE1B,SAAS;AACP,UAAM,EAAE,kBAAkB,IAAI,KAAK;AAEnC,QAAI,KAAK,MAAM;AAAU,aAAO,oBAAoB,4CAAC,qBAAkB,IAAK;AAE5E,WAAO,KAAK,MAAM;AAAA,EACpB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/shared/ErrorBoundary.tsx"],"sourcesContent":["import { Component, type ElementType, type ReactNode } from 'react'\n\ntype ErrorProps = {\n FallbackComponent: ElementType<{ details: string }>\n children: ReactNode\n}\n\ntype State =\n | {\n hasError: false\n }\n | {\n hasError: true\n details: string\n }\n\nexport class ErrorBoundary extends Component<ErrorProps, State> {\n static getDerivedStateFromError(error: Error): State {\n return { hasError: true, details: error.message }\n }\n\n state: State = { hasError: false }\n\n render() {\n const { FallbackComponent } = this.props\n\n if (this.state.hasError)\n return FallbackComponent ? <FallbackComponent details={this.state.details} /> : null\n\n return this.props.children\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BiC;AA3BjC,mBAA4D;AAgBrD,MAAM,sBAAsB,uBAA6B;AAAA,EAC9D,OAAO,yBAAyB,OAAqB;AACnD,WAAO,EAAE,UAAU,MAAM,SAAS,MAAM,QAAQ;AAAA,EAClD;AAAA,EAEA,QAAe,EAAE,UAAU,MAAM;AAAA,EAEjC,SAAS;AACP,UAAM,EAAE,kBAAkB,IAAI,KAAK;AAEnC,QAAI,KAAK,MAAM;AACb,aAAO,oBAAoB,4CAAC,qBAAkB,SAAS,KAAK,MAAM,SAAS,IAAK;AAElF,WAAO,KAAK,MAAM;AAAA,EACpB;AACF;","names":[]}
@@ -24,34 +24,54 @@ module.exports = __toCommonJS(FallbackComponent_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
25
  var import_react = require("react");
26
26
  var import_Warning20 = require("../../icons/Warning20");
27
- var import_use_style = require("../../../runtimes/react/css-runtime/hooks/use-style");
28
27
  const FallbackComponent = (0, import_react.forwardRef)(function FallbackComponent2({ text, details }, ref) {
29
- const { className: outerClassName, styleElement: outerStyleElement } = (0, import_use_style.useStyle)({
30
- width: "100%",
31
- height: 54,
32
- backgroundColor: "#fcedf2",
33
- borderRadius: 6,
34
- padding: 16,
35
- display: "flex",
36
- alignItems: "center",
37
- gap: 8,
38
- color: "#c73e6d",
39
- fill: "currentColor",
40
- fontFamily: "Heebo, sans-serif",
41
- fontSize: 16
42
- });
43
- const { className: noDisplayClassName, styleElement: noDisplayStyleElement } = (0, import_use_style.useStyle)({
44
- display: "none"
45
- });
46
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
47
- outerStyleElement,
48
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref, className: outerClassName, children: [
49
- noDisplayStyleElement,
50
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Warning20.Warning20, {}),
51
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: text }),
52
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: noDisplayClassName, children: details })
53
- ] })
54
- ] });
28
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
29
+ "div",
30
+ {
31
+ ref,
32
+ style: {
33
+ width: "100%",
34
+ height: 54,
35
+ backgroundColor: "#fcedf2",
36
+ borderRadius: 6,
37
+ padding: 16,
38
+ display: "flex",
39
+ alignItems: "center",
40
+ gap: 8,
41
+ color: "#c73e6d"
42
+ },
43
+ children: [
44
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
45
+ import_Warning20.Warning20,
46
+ {
47
+ style: {
48
+ fill: "currentColor"
49
+ }
50
+ }
51
+ ),
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
53
+ "span",
54
+ {
55
+ style: {
56
+ color: "currentColor",
57
+ fontFamily: "Heebo, sans-serif",
58
+ fontSize: 16
59
+ },
60
+ children: text
61
+ }
62
+ ),
63
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
64
+ "span",
65
+ {
66
+ style: {
67
+ display: "none"
68
+ },
69
+ children: details
70
+ }
71
+ )
72
+ ]
73
+ }
74
+ );
55
75
  });
56
76
  // Annotate the CommonJS export names for ESM import in node:
57
77
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/shared/FallbackComponent/FallbackComponent.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport { Warning20 } from '../../icons/Warning20'\nimport { useStyle } from '../../../runtimes/react/css-runtime/hooks/use-style'\n\ntype Props = {\n text: string\n details?: string\n}\n\nexport const FallbackComponent = forwardRef(function FallbackComponent(\n { text, details }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const { className: outerClassName, styleElement: outerStyleElement } = useStyle({\n width: '100%',\n height: 54,\n backgroundColor: '#fcedf2',\n borderRadius: 6,\n padding: 16,\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n color: '#c73e6d',\n fill: 'currentColor',\n fontFamily: 'Heebo, sans-serif',\n fontSize: 16,\n })\n const { className: noDisplayClassName, styleElement: noDisplayStyleElement } = useStyle({\n display: 'none',\n })\n return (\n <>\n {outerStyleElement}\n <div ref={ref} className={outerClassName}>\n {noDisplayStyleElement}\n <Warning20 />\n <span>{text}</span>\n <span className={noDisplayClassName}>{details}</span>\n </div>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BI;AA/BJ,mBAAgC;AAChC,uBAA0B;AAC1B,uBAAyB;AAOlB,MAAM,wBAAoB,yBAAW,SAASA,mBACnD,EAAE,MAAM,QAAQ,GAChB,KACA;AACA,QAAM,EAAE,WAAW,gBAAgB,cAAc,kBAAkB,QAAI,2BAAS;AAAA,IAC9E,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,SAAS;AAAA,IACT,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ,CAAC;AACD,QAAM,EAAE,WAAW,oBAAoB,cAAc,sBAAsB,QAAI,2BAAS;AAAA,IACtF,SAAS;AAAA,EACX,CAAC;AACD,SACE,4EACG;AAAA;AAAA,IACD,6CAAC,SAAI,KAAU,WAAW,gBACvB;AAAA;AAAA,MACD,4CAAC,8BAAU;AAAA,MACX,4CAAC,UAAM,gBAAK;AAAA,MACZ,4CAAC,UAAK,WAAW,oBAAqB,mBAAQ;AAAA,OAChD;AAAA,KACF;AAEJ,CAAC;","names":["FallbackComponent"]}
1
+ {"version":3,"sources":["../../../../../src/components/shared/FallbackComponent/FallbackComponent.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport { Warning20 } from '../../icons/Warning20'\n\ntype Props = {\n text: string\n details?: string\n}\n\nexport const FallbackComponent = forwardRef(function FallbackComponent(\n { text, details }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n // Intentionally use inline styles so that the fallback doesn't access the style\n // context, the absence of which may be the exact error we're trying to report\n return (\n <div\n ref={ref}\n style={{\n width: '100%',\n height: 54,\n backgroundColor: '#fcedf2',\n borderRadius: 6,\n padding: 16,\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n color: '#c73e6d',\n }}\n >\n <Warning20\n style={{\n fill: 'currentColor',\n }}\n />\n <span\n style={{\n color: 'currentColor',\n fontFamily: 'Heebo, sans-serif',\n fontSize: 16,\n }}\n >\n {text}\n </span>\n <span\n style={{\n display: 'none',\n }}\n >\n {details}\n </span>\n </div>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeI;AAfJ,mBAAgC;AAChC,uBAA0B;AAOnB,MAAM,wBAAoB,yBAAW,SAASA,mBACnD,EAAE,MAAM,QAAQ,GAChB,KACA;AAGA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,iBAAiB;AAAA,QACjB,cAAc;AAAA,QACd,SAAS;AAAA,QACT,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,KAAK;AAAA,QACL,OAAO;AAAA,MACT;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,MAAM;AAAA,YACR;AAAA;AAAA,QACF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,OAAO;AAAA,cACP,YAAY;AAAA,cACZ,UAAU;AAAA,YACZ;AAAA,YAEC;AAAA;AAAA,QACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,SAAS;AAAA,YACX;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["FallbackComponent"]}
@@ -49,6 +49,17 @@ const Element = (0, import_react.memo)(
49
49
  const { imperativeHandleRef, findDomNodeCallbackRef, elementCallbackRef } = useElementImperativeHandle(ref);
50
50
  const isRegisterElementDisabled = (0, import_use_disable_register_element.useIsRegisterElementDisabled)();
51
51
  const ElementRegistration = (0, import_use_is_read_only.useIsReadOnly)() || isRegisterElementDisabled ? NoOp : BuilderElementRegistration;
52
+ const ErrorFallback = (0, import_react.useCallback)(
53
+ ({ details }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
+ import_FallbackComponent.FallbackComponent,
55
+ {
56
+ text: `Error rendering component`,
57
+ details: `Error rendering component '${element.type}':
58
+ ${details}`
59
+ }
60
+ ),
61
+ [element.type]
62
+ );
52
63
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
53
64
  ElementRegistration,
54
65
  {
@@ -85,9 +96,6 @@ function useElementImperativeHandle(ref) {
85
96
  function NoOp({ children }) {
86
97
  return children;
87
98
  }
88
- function ErrorFallback() {
89
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_FallbackComponent.FallbackComponent, { text: `Error rendering component` });
90
- }
91
99
  // Annotate the CommonJS export names for ESM import in node:
92
100
  0 && (module.exports = {
93
101
  Element
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/components/Element.tsx"],"sourcesContent":["'use client'\n\nimport {\n type ReactNode,\n type Ref,\n type PropsWithChildren,\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useRef,\n lazy,\n} from 'react'\n\nimport {\n isElementReference,\n type Element as ElementDataOrRef,\n} from '../../../state/read-only-state'\n\nimport { FallbackComponent } from '../../../components/shared/FallbackComponent'\nimport { ErrorBoundary } from '../../../components/shared/ErrorBoundary'\n\nimport { useIsReadOnly } from '../hooks/use-is-read-only'\nimport { useIsRegisterElementDisabled } from '../hooks/use-disable-register-element'\n\nimport { ElementImperativeHandle } from '../element-imperative-handle'\nimport { FindDomNode } from '../find-dom-node'\n\nimport { ElementReference } from './ElementReference'\nimport { ElementData } from './ElementData'\n\nconst BuilderElementRegistration = lazy(() => import('./ElementRegistration'))\n\ntype Props = {\n element: ElementDataOrRef\n}\n\nexport const Element = memo(\n forwardRef(function Element(\n { element }: Props,\n ref: Ref<ElementImperativeHandle>,\n ): ReactNode | null {\n const { imperativeHandleRef, findDomNodeCallbackRef, elementCallbackRef } =\n useElementImperativeHandle(ref)\n\n const isRegisterElementDisabled = useIsRegisterElementDisabled()\n const ElementRegistration =\n useIsReadOnly() || isRegisterElementDisabled ? NoOp : BuilderElementRegistration\n\n return (\n <ElementRegistration\n componentHandle={imperativeHandleRef.current}\n elementKey={element.key}\n componentType={element.type}\n >\n <FindDomNode ref={findDomNodeCallbackRef}>\n <ErrorBoundary FallbackComponent={ErrorFallback}>\n {isElementReference(element) ? (\n <ElementReference\n key={element.key}\n ref={elementCallbackRef}\n elementReference={element}\n />\n ) : (\n <ElementData key={element.key} ref={elementCallbackRef} elementData={element} />\n )}\n </ErrorBoundary>\n </FindDomNode>\n </ElementRegistration>\n )\n }),\n)\n\n/**\n * Creates an `ElementImperativeHandle` instance that reports the element's DOM location to\n * the builder.\n *\n * Uses the element's attached ref when available; otherwise, falls back to React's\n * `findDOMNode` to locate the rendered DOM node.\n */\nfunction useElementImperativeHandle(ref: Ref<ElementImperativeHandle>) {\n const useFindDomNodeRef = useRef(true)\n const imperativeHandleRef = useRef(new ElementImperativeHandle())\n\n const findDomNodeCallbackRef = useCallback((current: (() => Element | Text | null) | null) => {\n if (useFindDomNodeRef.current === true) {\n imperativeHandleRef.current.callback(() => current?.() ?? null)\n }\n }, [])\n\n const elementCallbackRef = useCallback((current: unknown | null) => {\n useFindDomNodeRef.current = false\n\n imperativeHandleRef.current.callback(() => current)\n }, [])\n\n useImperativeHandle(ref, () => imperativeHandleRef.current, [])\n\n return { imperativeHandleRef, findDomNodeCallbackRef, elementCallbackRef }\n}\n\nfunction NoOp({ children }: PropsWithChildren) {\n return children\n}\n\nfunction ErrorFallback() {\n return <FallbackComponent text={`Error rendering component`} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0Dc;AAxDd,mBAUO;AAEP,6BAGO;AAEP,+BAAkC;AAClC,2BAA8B;AAE9B,8BAA8B;AAC9B,0CAA6C;AAE7C,uCAAwC;AACxC,2BAA4B;AAE5B,8BAAiC;AACjC,yBAA4B;AAE5B,MAAM,iCAA6B,mBAAK,MAAM,6CAAO,uBAAuB,GAAC;AAMtE,MAAM,cAAU;AAAA,MACrB,yBAAW,SAASA,SAClB,EAAE,QAAQ,GACV,KACkB;AAClB,UAAM,EAAE,qBAAqB,wBAAwB,mBAAmB,IACtE,2BAA2B,GAAG;AAEhC,UAAM,gCAA4B,kEAA6B;AAC/D,UAAM,0BACJ,uCAAc,KAAK,4BAA4B,OAAO;AAExD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,iBAAiB,oBAAoB;AAAA,QACrC,YAAY,QAAQ;AAAA,QACpB,eAAe,QAAQ;AAAA,QAEvB,sDAAC,oCAAY,KAAK,wBAChB,sDAAC,sCAAc,mBAAmB,eAC/B,yDAAmB,OAAO,IACzB;AAAA,UAAC;AAAA;AAAA,YAEC,KAAK;AAAA,YACL,kBAAkB;AAAA;AAAA,UAFb,QAAQ;AAAA,QAGf,IAEA,4CAAC,kCAA8B,KAAK,oBAAoB,aAAa,WAAnD,QAAQ,GAAoD,GAElF,GACF;AAAA;AAAA,IACF;AAAA,EAEJ,CAAC;AACH;AASA,SAAS,2BAA2B,KAAmC;AACrE,QAAM,wBAAoB,qBAAO,IAAI;AACrC,QAAM,0BAAsB,qBAAO,IAAI,yDAAwB,CAAC;AAEhE,QAAM,6BAAyB,0BAAY,CAAC,YAAkD;AAC5F,QAAI,kBAAkB,YAAY,MAAM;AACtC,0BAAoB,QAAQ,SAAS,MAAM,UAAU,KAAK,IAAI;AAAA,IAChE;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,yBAAqB,0BAAY,CAAC,YAA4B;AAClE,sBAAkB,UAAU;AAE5B,wBAAoB,QAAQ,SAAS,MAAM,OAAO;AAAA,EACpD,GAAG,CAAC,CAAC;AAEL,wCAAoB,KAAK,MAAM,oBAAoB,SAAS,CAAC,CAAC;AAE9D,SAAO,EAAE,qBAAqB,wBAAwB,mBAAmB;AAC3E;AAEA,SAAS,KAAK,EAAE,SAAS,GAAsB;AAC7C,SAAO;AACT;AAEA,SAAS,gBAAgB;AACvB,SAAO,4CAAC,8CAAkB,MAAM,6BAA6B;AAC/D;","names":["Element"]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/components/Element.tsx"],"sourcesContent":["'use client'\n\nimport {\n type ReactNode,\n type Ref,\n type PropsWithChildren,\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useRef,\n lazy,\n} from 'react'\n\nimport {\n isElementReference,\n type Element as ElementDataOrRef,\n} from '../../../state/read-only-state'\n\nimport { FallbackComponent } from '../../../components/shared/FallbackComponent'\nimport { ErrorBoundary } from '../../../components/shared/ErrorBoundary'\n\nimport { useIsReadOnly } from '../hooks/use-is-read-only'\nimport { useIsRegisterElementDisabled } from '../hooks/use-disable-register-element'\n\nimport { ElementImperativeHandle } from '../element-imperative-handle'\nimport { FindDomNode } from '../find-dom-node'\n\nimport { ElementReference } from './ElementReference'\nimport { ElementData } from './ElementData'\n\nconst BuilderElementRegistration = lazy(() => import('./ElementRegistration'))\n\ntype Props = {\n element: ElementDataOrRef\n}\n\nexport const Element = memo(\n forwardRef(function Element(\n { element }: Props,\n ref: Ref<ElementImperativeHandle>,\n ): ReactNode | null {\n const { imperativeHandleRef, findDomNodeCallbackRef, elementCallbackRef } =\n useElementImperativeHandle(ref)\n\n const isRegisterElementDisabled = useIsRegisterElementDisabled()\n const ElementRegistration =\n useIsReadOnly() || isRegisterElementDisabled ? NoOp : BuilderElementRegistration\n\n const ErrorFallback = useCallback(\n ({ details }: { details: string }) => (\n <FallbackComponent\n text={`Error rendering component`}\n details={`Error rendering component '${element.type}':\\n${details}`}\n />\n ),\n [element.type],\n )\n\n return (\n <ElementRegistration\n componentHandle={imperativeHandleRef.current}\n elementKey={element.key}\n componentType={element.type}\n >\n <FindDomNode ref={findDomNodeCallbackRef}>\n <ErrorBoundary FallbackComponent={ErrorFallback}>\n {isElementReference(element) ? (\n <ElementReference\n key={element.key}\n ref={elementCallbackRef}\n elementReference={element}\n />\n ) : (\n <ElementData key={element.key} ref={elementCallbackRef} elementData={element} />\n )}\n </ErrorBoundary>\n </FindDomNode>\n </ElementRegistration>\n )\n }),\n)\n\n/**\n * Creates an `ElementImperativeHandle` instance that reports the element's DOM location to\n * the builder.\n *\n * Uses the element's attached ref when available; otherwise, falls back to React's\n * `findDOMNode` to locate the rendered DOM node.\n */\nfunction useElementImperativeHandle(ref: Ref<ElementImperativeHandle>) {\n const useFindDomNodeRef = useRef(true)\n const imperativeHandleRef = useRef(new ElementImperativeHandle())\n\n const findDomNodeCallbackRef = useCallback((current: (() => Element | Text | null) | null) => {\n if (useFindDomNodeRef.current === true) {\n imperativeHandleRef.current.callback(() => current?.() ?? null)\n }\n }, [])\n\n const elementCallbackRef = useCallback((current: unknown | null) => {\n useFindDomNodeRef.current = false\n\n imperativeHandleRef.current.callback(() => current)\n }, [])\n\n useImperativeHandle(ref, () => imperativeHandleRef.current, [])\n\n return { imperativeHandleRef, findDomNodeCallbackRef, elementCallbackRef }\n}\n\nfunction NoOp({ children }: PropsWithChildren) {\n return children\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmDQ;AAjDR,mBAUO;AAEP,6BAGO;AAEP,+BAAkC;AAClC,2BAA8B;AAE9B,8BAA8B;AAC9B,0CAA6C;AAE7C,uCAAwC;AACxC,2BAA4B;AAE5B,8BAAiC;AACjC,yBAA4B;AAE5B,MAAM,iCAA6B,mBAAK,MAAM,6CAAO,uBAAuB,GAAC;AAMtE,MAAM,cAAU;AAAA,MACrB,yBAAW,SAASA,SAClB,EAAE,QAAQ,GACV,KACkB;AAClB,UAAM,EAAE,qBAAqB,wBAAwB,mBAAmB,IACtE,2BAA2B,GAAG;AAEhC,UAAM,gCAA4B,kEAA6B;AAC/D,UAAM,0BACJ,uCAAc,KAAK,4BAA4B,OAAO;AAExD,UAAM,oBAAgB;AAAA,MACpB,CAAC,EAAE,QAAQ,MACT;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,SAAS,8BAA8B,QAAQ,IAAI;AAAA,EAAO,OAAO;AAAA;AAAA,MACnE;AAAA,MAEF,CAAC,QAAQ,IAAI;AAAA,IACf;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,iBAAiB,oBAAoB;AAAA,QACrC,YAAY,QAAQ;AAAA,QACpB,eAAe,QAAQ;AAAA,QAEvB,sDAAC,oCAAY,KAAK,wBAChB,sDAAC,sCAAc,mBAAmB,eAC/B,yDAAmB,OAAO,IACzB;AAAA,UAAC;AAAA;AAAA,YAEC,KAAK;AAAA,YACL,kBAAkB;AAAA;AAAA,UAFb,QAAQ;AAAA,QAGf,IAEA,4CAAC,kCAA8B,KAAK,oBAAoB,aAAa,WAAnD,QAAQ,GAAoD,GAElF,GACF;AAAA;AAAA,IACF;AAAA,EAEJ,CAAC;AACH;AASA,SAAS,2BAA2B,KAAmC;AACrE,QAAM,wBAAoB,qBAAO,IAAI;AACrC,QAAM,0BAAsB,qBAAO,IAAI,yDAAwB,CAAC;AAEhE,QAAM,6BAAyB,0BAAY,CAAC,YAAkD;AAC5F,QAAI,kBAAkB,YAAY,MAAM;AACtC,0BAAoB,QAAQ,SAAS,MAAM,UAAU,KAAK,IAAI;AAAA,IAChE;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,yBAAqB,0BAAY,CAAC,YAA4B;AAClE,sBAAkB,UAAU;AAE5B,wBAAoB,QAAQ,SAAS,MAAM,OAAO;AAAA,EACpD,GAAG,CAAC,CAAC;AAEL,wCAAoB,KAAK,MAAM,oBAAoB,SAAS,CAAC,CAAC;AAE9D,SAAO,EAAE,qBAAqB,wBAAwB,mBAAmB;AAC3E;AAEA,SAAS,KAAK,EAAE,SAAS,GAAsB;AAC7C,SAAO;AACT;","names":["Element"]}
@@ -4,7 +4,7 @@ class MakeswiftGraphQLApiClient {
4
4
  graphqlClient;
5
5
  constructor({ endpoint }) {
6
6
  this.graphqlClient = new GraphQLClient(endpoint, {
7
- "makeswift-runtime-version": "0.29.0-canary.23"
7
+ "makeswift-runtime-version": "0.29.0-canary.25"
8
8
  });
9
9
  }
10
10
  async getUnversionedResources({
@@ -188,7 +188,7 @@ class MakeswiftRestAPIClient {
188
188
  const requestHeaders = new Headers({
189
189
  "x-api-key": this.apiKey,
190
190
  "makeswift-site-api-key": this.apiKey,
191
- "makeswift-runtime-version": "0.29.0-canary.23"
191
+ "makeswift-runtime-version": "0.29.0-canary.25"
192
192
  });
193
193
  if (siteVersion?.token) {
194
194
  requestUrl.searchParams.set("version", siteVersion.version);
@@ -8,7 +8,7 @@ async function manifestHandler(req, { apiKey, manifest }) {
8
8
  return ApiResponse.json({ message: "Unauthorized" }, { status: 401 });
9
9
  }
10
10
  return ApiResponse.json({
11
- version: "0.29.0-canary.23",
11
+ version: "0.29.0-canary.25",
12
12
  interactionMode: true,
13
13
  clientSideNavigation: false,
14
14
  elementFromPoint: false,
@@ -1,14 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Component } from "react";
3
3
  class ErrorBoundary extends Component {
4
- static getDerivedStateFromError() {
5
- return { hasError: true };
4
+ static getDerivedStateFromError(error) {
5
+ return { hasError: true, details: error.message };
6
6
  }
7
7
  state = { hasError: false };
8
8
  render() {
9
9
  const { FallbackComponent } = this.props;
10
10
  if (this.state.hasError)
11
- return FallbackComponent ? /* @__PURE__ */ jsx(FallbackComponent, {}) : null;
11
+ return FallbackComponent ? /* @__PURE__ */ jsx(FallbackComponent, { details: this.state.details }) : null;
12
12
  return this.props.children;
13
13
  }
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/shared/ErrorBoundary.tsx"],"sourcesContent":["import { Component, ElementType, ReactNode } from 'react'\n\ntype ErrorProps = {\n FallbackComponent: ElementType\n children: ReactNode\n}\n\ntype State = {\n hasError: boolean\n}\n\nexport class ErrorBoundary extends Component<ErrorProps, State> {\n static getDerivedStateFromError() {\n return { hasError: true }\n }\n\n state = { hasError: false }\n\n render() {\n const { FallbackComponent } = this.props\n\n if (this.state.hasError) return FallbackComponent ? <FallbackComponent /> : null\n\n return this.props.children\n }\n}\n"],"mappings":"AAqBwD;AArBxD,SAAS,iBAAyC;AAW3C,MAAM,sBAAsB,UAA6B;AAAA,EAC9D,OAAO,2BAA2B;AAChC,WAAO,EAAE,UAAU,KAAK;AAAA,EAC1B;AAAA,EAEA,QAAQ,EAAE,UAAU,MAAM;AAAA,EAE1B,SAAS;AACP,UAAM,EAAE,kBAAkB,IAAI,KAAK;AAEnC,QAAI,KAAK,MAAM;AAAU,aAAO,oBAAoB,oBAAC,qBAAkB,IAAK;AAE5E,WAAO,KAAK,MAAM;AAAA,EACpB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/shared/ErrorBoundary.tsx"],"sourcesContent":["import { Component, type ElementType, type ReactNode } from 'react'\n\ntype ErrorProps = {\n FallbackComponent: ElementType<{ details: string }>\n children: ReactNode\n}\n\ntype State =\n | {\n hasError: false\n }\n | {\n hasError: true\n details: string\n }\n\nexport class ErrorBoundary extends Component<ErrorProps, State> {\n static getDerivedStateFromError(error: Error): State {\n return { hasError: true, details: error.message }\n }\n\n state: State = { hasError: false }\n\n render() {\n const { FallbackComponent } = this.props\n\n if (this.state.hasError)\n return FallbackComponent ? <FallbackComponent details={this.state.details} /> : null\n\n return this.props.children\n }\n}\n"],"mappings":"AA2BiC;AA3BjC,SAAS,iBAAmD;AAgBrD,MAAM,sBAAsB,UAA6B;AAAA,EAC9D,OAAO,yBAAyB,OAAqB;AACnD,WAAO,EAAE,UAAU,MAAM,SAAS,MAAM,QAAQ;AAAA,EAClD;AAAA,EAEA,QAAe,EAAE,UAAU,MAAM;AAAA,EAEjC,SAAS;AACP,UAAM,EAAE,kBAAkB,IAAI,KAAK;AAEnC,QAAI,KAAK,MAAM;AACb,aAAO,oBAAoB,oBAAC,qBAAkB,SAAS,KAAK,MAAM,SAAS,IAAK;AAElF,WAAO,KAAK,MAAM;AAAA,EACpB;AACF;","names":[]}
@@ -1,34 +1,54 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { Warning20 } from "../../icons/Warning20";
4
- import { useStyle } from "../../../runtimes/react/css-runtime/hooks/use-style";
5
4
  const FallbackComponent = forwardRef(function FallbackComponent2({ text, details }, ref) {
6
- const { className: outerClassName, styleElement: outerStyleElement } = useStyle({
7
- width: "100%",
8
- height: 54,
9
- backgroundColor: "#fcedf2",
10
- borderRadius: 6,
11
- padding: 16,
12
- display: "flex",
13
- alignItems: "center",
14
- gap: 8,
15
- color: "#c73e6d",
16
- fill: "currentColor",
17
- fontFamily: "Heebo, sans-serif",
18
- fontSize: 16
19
- });
20
- const { className: noDisplayClassName, styleElement: noDisplayStyleElement } = useStyle({
21
- display: "none"
22
- });
23
- return /* @__PURE__ */ jsxs(Fragment, { children: [
24
- outerStyleElement,
25
- /* @__PURE__ */ jsxs("div", { ref, className: outerClassName, children: [
26
- noDisplayStyleElement,
27
- /* @__PURE__ */ jsx(Warning20, {}),
28
- /* @__PURE__ */ jsx("span", { children: text }),
29
- /* @__PURE__ */ jsx("span", { className: noDisplayClassName, children: details })
30
- ] })
31
- ] });
5
+ return /* @__PURE__ */ jsxs(
6
+ "div",
7
+ {
8
+ ref,
9
+ style: {
10
+ width: "100%",
11
+ height: 54,
12
+ backgroundColor: "#fcedf2",
13
+ borderRadius: 6,
14
+ padding: 16,
15
+ display: "flex",
16
+ alignItems: "center",
17
+ gap: 8,
18
+ color: "#c73e6d"
19
+ },
20
+ children: [
21
+ /* @__PURE__ */ jsx(
22
+ Warning20,
23
+ {
24
+ style: {
25
+ fill: "currentColor"
26
+ }
27
+ }
28
+ ),
29
+ /* @__PURE__ */ jsx(
30
+ "span",
31
+ {
32
+ style: {
33
+ color: "currentColor",
34
+ fontFamily: "Heebo, sans-serif",
35
+ fontSize: 16
36
+ },
37
+ children: text
38
+ }
39
+ ),
40
+ /* @__PURE__ */ jsx(
41
+ "span",
42
+ {
43
+ style: {
44
+ display: "none"
45
+ },
46
+ children: details
47
+ }
48
+ )
49
+ ]
50
+ }
51
+ );
32
52
  });
33
53
  export {
34
54
  FallbackComponent
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/shared/FallbackComponent/FallbackComponent.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport { Warning20 } from '../../icons/Warning20'\nimport { useStyle } from '../../../runtimes/react/css-runtime/hooks/use-style'\n\ntype Props = {\n text: string\n details?: string\n}\n\nexport const FallbackComponent = forwardRef(function FallbackComponent(\n { text, details }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const { className: outerClassName, styleElement: outerStyleElement } = useStyle({\n width: '100%',\n height: 54,\n backgroundColor: '#fcedf2',\n borderRadius: 6,\n padding: 16,\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n color: '#c73e6d',\n fill: 'currentColor',\n fontFamily: 'Heebo, sans-serif',\n fontSize: 16,\n })\n const { className: noDisplayClassName, styleElement: noDisplayStyleElement } = useStyle({\n display: 'none',\n })\n return (\n <>\n {outerStyleElement}\n <div ref={ref} className={outerClassName}>\n {noDisplayStyleElement}\n <Warning20 />\n <span>{text}</span>\n <span className={noDisplayClassName}>{details}</span>\n </div>\n </>\n )\n})\n"],"mappings":"AA+BI,mBAII,KAFF,YAFF;AA/BJ,SAAS,kBAAuB;AAChC,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAOlB,MAAM,oBAAoB,WAAW,SAASA,mBACnD,EAAE,MAAM,QAAQ,GAChB,KACA;AACA,QAAM,EAAE,WAAW,gBAAgB,cAAc,kBAAkB,IAAI,SAAS;AAAA,IAC9E,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,SAAS;AAAA,IACT,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ,CAAC;AACD,QAAM,EAAE,WAAW,oBAAoB,cAAc,sBAAsB,IAAI,SAAS;AAAA,IACtF,SAAS;AAAA,EACX,CAAC;AACD,SACE,iCACG;AAAA;AAAA,IACD,qBAAC,SAAI,KAAU,WAAW,gBACvB;AAAA;AAAA,MACD,oBAAC,aAAU;AAAA,MACX,oBAAC,UAAM,gBAAK;AAAA,MACZ,oBAAC,UAAK,WAAW,oBAAqB,mBAAQ;AAAA,OAChD;AAAA,KACF;AAEJ,CAAC;","names":["FallbackComponent"]}
1
+ {"version":3,"sources":["../../../../../src/components/shared/FallbackComponent/FallbackComponent.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport { Warning20 } from '../../icons/Warning20'\n\ntype Props = {\n text: string\n details?: string\n}\n\nexport const FallbackComponent = forwardRef(function FallbackComponent(\n { text, details }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n // Intentionally use inline styles so that the fallback doesn't access the style\n // context, the absence of which may be the exact error we're trying to report\n return (\n <div\n ref={ref}\n style={{\n width: '100%',\n height: 54,\n backgroundColor: '#fcedf2',\n borderRadius: 6,\n padding: 16,\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n color: '#c73e6d',\n }}\n >\n <Warning20\n style={{\n fill: 'currentColor',\n }}\n />\n <span\n style={{\n color: 'currentColor',\n fontFamily: 'Heebo, sans-serif',\n fontSize: 16,\n }}\n >\n {text}\n </span>\n <span\n style={{\n display: 'none',\n }}\n >\n {details}\n </span>\n </div>\n )\n})\n"],"mappings":"AAeI,SAcE,KAdF;AAfJ,SAAS,kBAAuB;AAChC,SAAS,iBAAiB;AAOnB,MAAM,oBAAoB,WAAW,SAASA,mBACnD,EAAE,MAAM,QAAQ,GAChB,KACA;AAGA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,iBAAiB;AAAA,QACjB,cAAc;AAAA,QACd,SAAS;AAAA,QACT,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,KAAK;AAAA,QACL,OAAO;AAAA,MACT;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,MAAM;AAAA,YACR;AAAA;AAAA,QACF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,OAAO;AAAA,cACP,YAAY;AAAA,cACZ,UAAU;AAAA,YACZ;AAAA,YAEC;AAAA;AAAA,QACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,SAAS;AAAA,YACX;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["FallbackComponent"]}
@@ -25,6 +25,17 @@ const Element = memo(
25
25
  const { imperativeHandleRef, findDomNodeCallbackRef, elementCallbackRef } = useElementImperativeHandle(ref);
26
26
  const isRegisterElementDisabled = useIsRegisterElementDisabled();
27
27
  const ElementRegistration = useIsReadOnly() || isRegisterElementDisabled ? NoOp : BuilderElementRegistration;
28
+ const ErrorFallback = useCallback(
29
+ ({ details }) => /* @__PURE__ */ jsx(
30
+ FallbackComponent,
31
+ {
32
+ text: `Error rendering component`,
33
+ details: `Error rendering component '${element.type}':
34
+ ${details}`
35
+ }
36
+ ),
37
+ [element.type]
38
+ );
28
39
  return /* @__PURE__ */ jsx(
29
40
  ElementRegistration,
30
41
  {
@@ -61,9 +72,6 @@ function useElementImperativeHandle(ref) {
61
72
  function NoOp({ children }) {
62
73
  return children;
63
74
  }
64
- function ErrorFallback() {
65
- return /* @__PURE__ */ jsx(FallbackComponent, { text: `Error rendering component` });
66
- }
67
75
  export {
68
76
  Element
69
77
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/components/Element.tsx"],"sourcesContent":["'use client'\n\nimport {\n type ReactNode,\n type Ref,\n type PropsWithChildren,\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useRef,\n lazy,\n} from 'react'\n\nimport {\n isElementReference,\n type Element as ElementDataOrRef,\n} from '../../../state/read-only-state'\n\nimport { FallbackComponent } from '../../../components/shared/FallbackComponent'\nimport { ErrorBoundary } from '../../../components/shared/ErrorBoundary'\n\nimport { useIsReadOnly } from '../hooks/use-is-read-only'\nimport { useIsRegisterElementDisabled } from '../hooks/use-disable-register-element'\n\nimport { ElementImperativeHandle } from '../element-imperative-handle'\nimport { FindDomNode } from '../find-dom-node'\n\nimport { ElementReference } from './ElementReference'\nimport { ElementData } from './ElementData'\n\nconst BuilderElementRegistration = lazy(() => import('./ElementRegistration'))\n\ntype Props = {\n element: ElementDataOrRef\n}\n\nexport const Element = memo(\n forwardRef(function Element(\n { element }: Props,\n ref: Ref<ElementImperativeHandle>,\n ): ReactNode | null {\n const { imperativeHandleRef, findDomNodeCallbackRef, elementCallbackRef } =\n useElementImperativeHandle(ref)\n\n const isRegisterElementDisabled = useIsRegisterElementDisabled()\n const ElementRegistration =\n useIsReadOnly() || isRegisterElementDisabled ? NoOp : BuilderElementRegistration\n\n return (\n <ElementRegistration\n componentHandle={imperativeHandleRef.current}\n elementKey={element.key}\n componentType={element.type}\n >\n <FindDomNode ref={findDomNodeCallbackRef}>\n <ErrorBoundary FallbackComponent={ErrorFallback}>\n {isElementReference(element) ? (\n <ElementReference\n key={element.key}\n ref={elementCallbackRef}\n elementReference={element}\n />\n ) : (\n <ElementData key={element.key} ref={elementCallbackRef} elementData={element} />\n )}\n </ErrorBoundary>\n </FindDomNode>\n </ElementRegistration>\n )\n }),\n)\n\n/**\n * Creates an `ElementImperativeHandle` instance that reports the element's DOM location to\n * the builder.\n *\n * Uses the element's attached ref when available; otherwise, falls back to React's\n * `findDOMNode` to locate the rendered DOM node.\n */\nfunction useElementImperativeHandle(ref: Ref<ElementImperativeHandle>) {\n const useFindDomNodeRef = useRef(true)\n const imperativeHandleRef = useRef(new ElementImperativeHandle())\n\n const findDomNodeCallbackRef = useCallback((current: (() => Element | Text | null) | null) => {\n if (useFindDomNodeRef.current === true) {\n imperativeHandleRef.current.callback(() => current?.() ?? null)\n }\n }, [])\n\n const elementCallbackRef = useCallback((current: unknown | null) => {\n useFindDomNodeRef.current = false\n\n imperativeHandleRef.current.callback(() => current)\n }, [])\n\n useImperativeHandle(ref, () => imperativeHandleRef.current, [])\n\n return { imperativeHandleRef, findDomNodeCallbackRef, elementCallbackRef }\n}\n\nfunction NoOp({ children }: PropsWithChildren) {\n return children\n}\n\nfunction ErrorFallback() {\n return <FallbackComponent text={`Error rendering component`} />\n}\n"],"mappings":";AA0Dc;AAxDd;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,OAEK;AAEP,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AAC9B,SAAS,oCAAoC;AAE7C,SAAS,+BAA+B;AACxC,SAAS,mBAAmB;AAE5B,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAE5B,MAAM,6BAA6B,KAAK,MAAM,OAAO,uBAAuB,CAAC;AAMtE,MAAM,UAAU;AAAA,EACrB,WAAW,SAASA,SAClB,EAAE,QAAQ,GACV,KACkB;AAClB,UAAM,EAAE,qBAAqB,wBAAwB,mBAAmB,IACtE,2BAA2B,GAAG;AAEhC,UAAM,4BAA4B,6BAA6B;AAC/D,UAAM,sBACJ,cAAc,KAAK,4BAA4B,OAAO;AAExD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,iBAAiB,oBAAoB;AAAA,QACrC,YAAY,QAAQ;AAAA,QACpB,eAAe,QAAQ;AAAA,QAEvB,8BAAC,eAAY,KAAK,wBAChB,8BAAC,iBAAc,mBAAmB,eAC/B,6BAAmB,OAAO,IACzB;AAAA,UAAC;AAAA;AAAA,YAEC,KAAK;AAAA,YACL,kBAAkB;AAAA;AAAA,UAFb,QAAQ;AAAA,QAGf,IAEA,oBAAC,eAA8B,KAAK,oBAAoB,aAAa,WAAnD,QAAQ,GAAoD,GAElF,GACF;AAAA;AAAA,IACF;AAAA,EAEJ,CAAC;AACH;AASA,SAAS,2BAA2B,KAAmC;AACrE,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,sBAAsB,OAAO,IAAI,wBAAwB,CAAC;AAEhE,QAAM,yBAAyB,YAAY,CAAC,YAAkD;AAC5F,QAAI,kBAAkB,YAAY,MAAM;AACtC,0BAAoB,QAAQ,SAAS,MAAM,UAAU,KAAK,IAAI;AAAA,IAChE;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,qBAAqB,YAAY,CAAC,YAA4B;AAClE,sBAAkB,UAAU;AAE5B,wBAAoB,QAAQ,SAAS,MAAM,OAAO;AAAA,EACpD,GAAG,CAAC,CAAC;AAEL,sBAAoB,KAAK,MAAM,oBAAoB,SAAS,CAAC,CAAC;AAE9D,SAAO,EAAE,qBAAqB,wBAAwB,mBAAmB;AAC3E;AAEA,SAAS,KAAK,EAAE,SAAS,GAAsB;AAC7C,SAAO;AACT;AAEA,SAAS,gBAAgB;AACvB,SAAO,oBAAC,qBAAkB,MAAM,6BAA6B;AAC/D;","names":["Element"]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/components/Element.tsx"],"sourcesContent":["'use client'\n\nimport {\n type ReactNode,\n type Ref,\n type PropsWithChildren,\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useRef,\n lazy,\n} from 'react'\n\nimport {\n isElementReference,\n type Element as ElementDataOrRef,\n} from '../../../state/read-only-state'\n\nimport { FallbackComponent } from '../../../components/shared/FallbackComponent'\nimport { ErrorBoundary } from '../../../components/shared/ErrorBoundary'\n\nimport { useIsReadOnly } from '../hooks/use-is-read-only'\nimport { useIsRegisterElementDisabled } from '../hooks/use-disable-register-element'\n\nimport { ElementImperativeHandle } from '../element-imperative-handle'\nimport { FindDomNode } from '../find-dom-node'\n\nimport { ElementReference } from './ElementReference'\nimport { ElementData } from './ElementData'\n\nconst BuilderElementRegistration = lazy(() => import('./ElementRegistration'))\n\ntype Props = {\n element: ElementDataOrRef\n}\n\nexport const Element = memo(\n forwardRef(function Element(\n { element }: Props,\n ref: Ref<ElementImperativeHandle>,\n ): ReactNode | null {\n const { imperativeHandleRef, findDomNodeCallbackRef, elementCallbackRef } =\n useElementImperativeHandle(ref)\n\n const isRegisterElementDisabled = useIsRegisterElementDisabled()\n const ElementRegistration =\n useIsReadOnly() || isRegisterElementDisabled ? NoOp : BuilderElementRegistration\n\n const ErrorFallback = useCallback(\n ({ details }: { details: string }) => (\n <FallbackComponent\n text={`Error rendering component`}\n details={`Error rendering component '${element.type}':\\n${details}`}\n />\n ),\n [element.type],\n )\n\n return (\n <ElementRegistration\n componentHandle={imperativeHandleRef.current}\n elementKey={element.key}\n componentType={element.type}\n >\n <FindDomNode ref={findDomNodeCallbackRef}>\n <ErrorBoundary FallbackComponent={ErrorFallback}>\n {isElementReference(element) ? (\n <ElementReference\n key={element.key}\n ref={elementCallbackRef}\n elementReference={element}\n />\n ) : (\n <ElementData key={element.key} ref={elementCallbackRef} elementData={element} />\n )}\n </ErrorBoundary>\n </FindDomNode>\n </ElementRegistration>\n )\n }),\n)\n\n/**\n * Creates an `ElementImperativeHandle` instance that reports the element's DOM location to\n * the builder.\n *\n * Uses the element's attached ref when available; otherwise, falls back to React's\n * `findDOMNode` to locate the rendered DOM node.\n */\nfunction useElementImperativeHandle(ref: Ref<ElementImperativeHandle>) {\n const useFindDomNodeRef = useRef(true)\n const imperativeHandleRef = useRef(new ElementImperativeHandle())\n\n const findDomNodeCallbackRef = useCallback((current: (() => Element | Text | null) | null) => {\n if (useFindDomNodeRef.current === true) {\n imperativeHandleRef.current.callback(() => current?.() ?? null)\n }\n }, [])\n\n const elementCallbackRef = useCallback((current: unknown | null) => {\n useFindDomNodeRef.current = false\n\n imperativeHandleRef.current.callback(() => current)\n }, [])\n\n useImperativeHandle(ref, () => imperativeHandleRef.current, [])\n\n return { imperativeHandleRef, findDomNodeCallbackRef, elementCallbackRef }\n}\n\nfunction NoOp({ children }: PropsWithChildren) {\n return children\n}\n"],"mappings":";AAmDQ;AAjDR;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,OAEK;AAEP,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AAC9B,SAAS,oCAAoC;AAE7C,SAAS,+BAA+B;AACxC,SAAS,mBAAmB;AAE5B,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAE5B,MAAM,6BAA6B,KAAK,MAAM,OAAO,uBAAuB,CAAC;AAMtE,MAAM,UAAU;AAAA,EACrB,WAAW,SAASA,SAClB,EAAE,QAAQ,GACV,KACkB;AAClB,UAAM,EAAE,qBAAqB,wBAAwB,mBAAmB,IACtE,2BAA2B,GAAG;AAEhC,UAAM,4BAA4B,6BAA6B;AAC/D,UAAM,sBACJ,cAAc,KAAK,4BAA4B,OAAO;AAExD,UAAM,gBAAgB;AAAA,MACpB,CAAC,EAAE,QAAQ,MACT;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,SAAS,8BAA8B,QAAQ,IAAI;AAAA,EAAO,OAAO;AAAA;AAAA,MACnE;AAAA,MAEF,CAAC,QAAQ,IAAI;AAAA,IACf;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,iBAAiB,oBAAoB;AAAA,QACrC,YAAY,QAAQ;AAAA,QACpB,eAAe,QAAQ;AAAA,QAEvB,8BAAC,eAAY,KAAK,wBAChB,8BAAC,iBAAc,mBAAmB,eAC/B,6BAAmB,OAAO,IACzB;AAAA,UAAC;AAAA;AAAA,YAEC,KAAK;AAAA,YACL,kBAAkB;AAAA;AAAA,UAFb,QAAQ;AAAA,QAGf,IAEA,oBAAC,eAA8B,KAAK,oBAAoB,aAAa,WAAnD,QAAQ,GAAoD,GAElF,GACF;AAAA;AAAA,IACF;AAAA,EAEJ,CAAC;AACH;AASA,SAAS,2BAA2B,KAAmC;AACrE,QAAM,oBAAoB,OAAO,IAAI;AACrC,QAAM,sBAAsB,OAAO,IAAI,wBAAwB,CAAC;AAEhE,QAAM,yBAAyB,YAAY,CAAC,YAAkD;AAC5F,QAAI,kBAAkB,YAAY,MAAM;AACtC,0BAAoB,QAAQ,SAAS,MAAM,UAAU,KAAK,IAAI;AAAA,IAChE;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,qBAAqB,YAAY,CAAC,YAA4B;AAClE,sBAAkB,UAAU;AAE5B,wBAAoB,QAAQ,SAAS,MAAM,OAAO;AAAA,EACpD,GAAG,CAAC,CAAC;AAEL,sBAAoB,KAAK,MAAM,oBAAoB,SAAS,CAAC,CAAC;AAE9D,SAAO,EAAE,qBAAqB,wBAAwB,mBAAmB;AAC3E;AAEA,SAAS,KAAK,EAAE,SAAS,GAAsB;AAC7C,SAAO;AACT;","names":["Element"]}
@@ -1,18 +1,19 @@
1
- import { Component, ElementType, ReactNode } from 'react';
1
+ import { Component, type ElementType, type ReactNode } from 'react';
2
2
  type ErrorProps = {
3
- FallbackComponent: ElementType;
3
+ FallbackComponent: ElementType<{
4
+ details: string;
5
+ }>;
4
6
  children: ReactNode;
5
7
  };
6
8
  type State = {
7
- hasError: boolean;
9
+ hasError: false;
10
+ } | {
11
+ hasError: true;
12
+ details: string;
8
13
  };
9
14
  export declare class ErrorBoundary extends Component<ErrorProps, State> {
10
- static getDerivedStateFromError(): {
11
- hasError: boolean;
12
- };
13
- state: {
14
- hasError: boolean;
15
- };
15
+ static getDerivedStateFromError(error: Error): State;
16
+ state: State;
16
17
  render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
17
18
  }
18
19
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEzD,KAAK,UAAU,GAAG;IAChB,iBAAiB,EAAE,WAAW,CAAA;IAC9B,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,qBAAa,aAAc,SAAQ,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC;IAC7D,MAAM,CAAC,wBAAwB;;;IAI/B,KAAK;;MAAsB;IAE3B,MAAM;CAOP"}
1
+ {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/shared/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEnE,KAAK,UAAU,GAAG;IAChB,iBAAiB,EAAE,WAAW,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACnD,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,KAAK,KAAK,GACN;IACE,QAAQ,EAAE,KAAK,CAAA;CAChB,GACD;IACE,QAAQ,EAAE,IAAI,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAEL,qBAAa,aAAc,SAAQ,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC;IAC7D,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAIpD,KAAK,EAAE,KAAK,CAAsB;IAElC,MAAM;CAQP"}
@@ -1 +1 @@
1
- {"version":3,"file":"FallbackComponent.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/FallbackComponent/FallbackComponent.tsx"],"names":[],"mappings":"AAIA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,iBAAiB,kGAgC5B,CAAA"}
1
+ {"version":3,"file":"FallbackComponent.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/FallbackComponent/FallbackComponent.tsx"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,iBAAiB,kGA4C5B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Element.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/Element.tsx"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,OAAO,IAAI,gBAAgB,EACjC,MAAM,gCAAgC,CAAA;AAQvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAQtE,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,OAAO,2KAkCnB,CAAA"}
1
+ {"version":3,"file":"Element.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/Element.tsx"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,OAAO,IAAI,gBAAgB,EACjC,MAAM,gCAAgC,CAAA;AAQvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAQtE,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,OAAO,2KA4CnB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makeswift/runtime",
3
- "version": "0.29.0-canary.23",
3
+ "version": "0.29.0-canary.25",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "url": "makeswift/makeswift",
@@ -242,9 +242,9 @@
242
242
  "use-sync-external-store": "^1.5.0",
243
243
  "uuid": "^9.0.0",
244
244
  "zod": "^3.21.4",
245
+ "@makeswift/controls": "0.1.22-canary.6",
245
246
  "@makeswift/next-plugin": "0.6.1",
246
- "@makeswift/prop-controllers": "0.4.16-canary.6",
247
- "@makeswift/controls": "0.1.22-canary.6"
247
+ "@makeswift/prop-controllers": "0.4.16-canary.6"
248
248
  },
249
249
  "devDependencies": {
250
250
  "@graphql-codegen/add": "^3.1.0",