@makeswift/runtime 0.28.10-canary.5 → 0.28.10-canary.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/cjs/api/graphql-api-client.js +1 -1
  2. package/dist/cjs/api/rest-api-client.js +1 -1
  3. package/dist/cjs/api-handler/handlers/manifest.js +1 -1
  4. package/dist/cjs/controls/rich-text/control.js.map +1 -1
  5. package/dist/cjs/next/components/tests/controls/page-control-prop-rendering.js +3 -18
  6. package/dist/cjs/next/components/tests/controls/page-control-prop-rendering.js.map +1 -1
  7. package/dist/cjs/runtimes/react/react-runtime-core.js +14 -3
  8. package/dist/cjs/runtimes/react/react-runtime-core.js.map +1 -1
  9. package/dist/cjs/runtimes/react/server/components/element-data.js +6 -2
  10. package/dist/cjs/runtimes/react/server/components/element-data.js.map +1 -1
  11. package/dist/cjs/runtimes/react/server/components/element.js +20 -2
  12. package/dist/cjs/runtimes/react/server/components/element.js.map +1 -1
  13. package/dist/cjs/runtimes/react/server/injectable-props.js +17 -0
  14. package/dist/cjs/runtimes/react/server/injectable-props.js.map +1 -0
  15. package/dist/cjs/runtimes/react/server/render-context.js +1 -6
  16. package/dist/cjs/runtimes/react/server/render-context.js.map +1 -1
  17. package/dist/cjs/runtimes/react/testing/react-runtime.js +3 -4
  18. package/dist/cjs/runtimes/react/testing/react-runtime.js.map +1 -1
  19. package/dist/cjs/runtimes/react/testing/render-to-string.js +44 -0
  20. package/dist/cjs/runtimes/react/testing/render-to-string.js.map +1 -0
  21. package/dist/cjs/state/modules/components-meta.js.map +1 -1
  22. package/dist/esm/api/graphql-api-client.js +1 -1
  23. package/dist/esm/api/rest-api-client.js +1 -1
  24. package/dist/esm/api-handler/handlers/manifest.js +1 -1
  25. package/dist/esm/controls/rich-text/control.js.map +1 -1
  26. package/dist/esm/next/components/tests/controls/page-control-prop-rendering.js +1 -16
  27. package/dist/esm/next/components/tests/controls/page-control-prop-rendering.js.map +1 -1
  28. package/dist/esm/runtimes/react/react-runtime-core.js +14 -3
  29. package/dist/esm/runtimes/react/react-runtime-core.js.map +1 -1
  30. package/dist/esm/runtimes/react/server/components/element-data.js +6 -2
  31. package/dist/esm/runtimes/react/server/components/element-data.js.map +1 -1
  32. package/dist/esm/runtimes/react/server/components/element.js +20 -2
  33. package/dist/esm/runtimes/react/server/components/element.js.map +1 -1
  34. package/dist/esm/runtimes/react/server/injectable-props.js +1 -0
  35. package/dist/esm/runtimes/react/server/injectable-props.js.map +1 -0
  36. package/dist/esm/runtimes/react/server/render-context.js +1 -6
  37. package/dist/esm/runtimes/react/server/render-context.js.map +1 -1
  38. package/dist/esm/runtimes/react/testing/react-runtime.js +3 -4
  39. package/dist/esm/runtimes/react/testing/react-runtime.js.map +1 -1
  40. package/dist/esm/runtimes/react/testing/render-to-string.js +20 -0
  41. package/dist/esm/runtimes/react/testing/render-to-string.js.map +1 -0
  42. package/dist/esm/state/modules/components-meta.js.map +1 -1
  43. package/dist/types/next/components/tests/controls/page-control-prop-rendering.d.ts.map +1 -1
  44. package/dist/types/runtimes/react/react-runtime-core.d.ts +18 -5
  45. package/dist/types/runtimes/react/react-runtime-core.d.ts.map +1 -1
  46. package/dist/types/runtimes/react/server/components/__tests__/element.test.d.ts +2 -0
  47. package/dist/types/runtimes/react/server/components/__tests__/element.test.d.ts.map +1 -0
  48. package/dist/types/runtimes/react/server/components/element-data.d.ts +2 -1
  49. package/dist/types/runtimes/react/server/components/element-data.d.ts.map +1 -1
  50. package/dist/types/runtimes/react/server/components/element.d.ts.map +1 -1
  51. package/dist/types/runtimes/react/server/injectable-props.d.ts +5 -0
  52. package/dist/types/runtimes/react/server/injectable-props.d.ts.map +1 -0
  53. package/dist/types/runtimes/react/server/render-context.d.ts +2 -1
  54. package/dist/types/runtimes/react/server/render-context.d.ts.map +1 -1
  55. package/dist/types/runtimes/react/testing/react-runtime.d.ts +5 -4
  56. package/dist/types/runtimes/react/testing/react-runtime.d.ts.map +1 -1
  57. package/dist/types/runtimes/react/testing/render-to-string.d.ts +3 -0
  58. package/dist/types/runtimes/react/testing/render-to-string.d.ts.map +1 -0
  59. package/dist/types/state/modules/components-meta.d.ts +2 -0
  60. package/dist/types/state/modules/components-meta.d.ts.map +1 -1
  61. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/next/components/tests/controls/page-control-prop-rendering.tsx"],"sourcesContent":["import { type ReactNode, Fragment, forwardRef, useRef, isValidElement, act } from 'react'\nimport { renderToReadableStream } from 'react-dom/server'\nimport { JSDOM } from 'jsdom'\nimport { render, screen } from '@testing-library/react'\nimport '@testing-library/jest-dom'\nimport { ServerInsertedHTMLContext } from 'next/navigation'\n\nimport { type Data, type ValueType, type DataType, ControlDefinition } from '@makeswift/controls'\n\nimport { type CacheData } from '../../../../api/api-resources-client'\nimport { ElementData } from '../../../../state/read-only-state'\nimport { setIsInBuilder } from '../../../../state/actions/internal/read-only-actions'\nimport { ReactRuntime } from '../../../../runtimes/react/react-runtime'\nimport { MakeswiftComponent } from '../../../../runtimes/react/components/MakeswiftComponent'\nimport { Page } from '../../page'\nimport { isServer } from '../../../../utils/is-server'\nimport * as Testing from '../../../testing'\n\nconst ROOT_ID = '00000000-0000-0000-0000-000000000000'\nconst ELEMENT_ID = '11111111-1111-1111-1111-111111111111'\n\nconst renderProp = (prop: any) =>\n prop === undefined ? 'undefined' : isValidElement(prop) ? prop : JSON.stringify(prop)\n\nconst propSnapshot = (prop: HTMLElement | null) =>\n prop?.childElementCount ? prop.childNodes : parseStringifiedProp(prop?.textContent ?? '')\n\nconst parseStringifiedProp = (prop: string) => (prop === 'undefined' ? undefined : JSON.parse(prop))\n\nasync function streamToString(stream: ReadableStream) {\n const reader = stream.getReader()\n const decoder = new TextDecoder()\n\n let result = ''\n\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n result += decoder.decode(value, { stream: true })\n }\n\n return result\n}\n\nasync function renderToString(element: ReactNode) {\n return await streamToString(await renderToReadableStream(element))\n}\n\nasync function serverSideRender(children: ReactNode) {\n // wrap the children in a context provider to capture server-inserted HTML, see\n // https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/server-inserted-html.tsx\n const serverInsertedCallbacks: (() => React.ReactNode)[] = []\n\n const elementTree = (\n <ServerInsertedHTMLContext.Provider value={handler => serverInsertedCallbacks.push(handler)}>\n {children}\n </ServerInsertedHTMLContext.Provider>\n )\n\n const elementsHTML = await renderToString(elementTree)\n\n const serverInsertedNodes = serverInsertedCallbacks.map((callback, index) => (\n <Fragment key={'__next_server_inserted__' + index}>{callback()}</Fragment>\n ))\n\n const headHTML = await renderToString(serverInsertedNodes)\n\n const dom = new JSDOM(\n `<!DOCTYPE html><head>${headHTML}</head><body><div id=\"root\">${elementsHTML}</div></body></div>`,\n {\n runScripts: 'dangerously',\n },\n )\n\n return dom.window.document\n}\n\n/**\n * In read-write mode, the runtime opens a `MessageChannel` to the builder\n * parent frame; jsdom doesn't implement `MessageChannel`, so stub them to keep\n * the read-write setup from throwing.\n */\nfunction stubBuilderMessageChannel(): () => void {\n const postMessageSpy = jest.spyOn(window, 'postMessage').mockImplementation(() => {})\n\n const originalMessageChannel = window.MessageChannel\n const stubPort = () => ({ onmessage: null, postMessage: () => {}, close: () => {} })\n window.MessageChannel = class {\n port1 = stubPort()\n port2 = stubPort()\n } as unknown as typeof MessageChannel\n\n return () => {\n postMessageSpy.mockRestore()\n window.MessageChannel = originalMessageChannel\n }\n}\n\nexport async function testPageControlPropRendering<D extends ControlDefinition>(\n controlDefinition: D,\n {\n toData,\n value,\n locale,\n cacheData,\n expectedRenders,\n registerComponents,\n action,\n rootElements = [],\n isInBuilder = false,\n isReadOnly = true,\n }: {\n toData?: (value: ValueType<D>) => DataType<D>\n value: ValueType<D> | undefined\n locale?: string | null\n cacheData?: Partial<CacheData>\n expectedRenders?: number\n registerComponents?: (runtime: ReactRuntime) => void\n action?: (element: HTMLElement) => Promise<void>\n rootElements?: ElementData[]\n isInBuilder?: boolean\n isReadOnly?: boolean\n },\n) {\n // Arrange\n const controlData: DataType<D> | Data =\n value !== undefined ? (toData ? toData(value) : controlDefinition.toData(value)) : undefined\n\n const testComponentMeta = {\n type: 'TestComponent',\n label: 'Test Component',\n }\n\n const testId = 'test-id'\n const renderCountTestId = 'render-count-test-id'\n const elementData: ElementData = {\n key: ELEMENT_ID,\n type: testComponentMeta.type,\n props: {\n propKey: controlData,\n },\n }\n\n const runtime = Testing.createReactRuntime()\n runtime.protoStore.dispatch(setIsInBuilder(isInBuilder))\n registerComponents?.(runtime)\n\n // Act\n runtime.registerComponent(\n forwardRef<HTMLDivElement, { propKey?: any }>(({ propKey }, ref) => {\n const renderCount = useRef(0)\n ++renderCount.current\n\n return (\n <div ref={ref}>\n <div data-testid={renderCountTestId}>{renderCount.current}</div>\n <div data-testid={testId}>{renderProp(propKey)}</div>\n </div>\n )\n }),\n {\n ...testComponentMeta,\n props: {\n propKey: controlDefinition as any,\n },\n },\n )\n\n const testElementTree = (component: ReactNode) => {\n // The runtime enters the read-write state when a non-null site version is\n // passed\n const siteVersion = isReadOnly ? null : { token: 'test-token', version: 'draft' }\n return (\n <Testing.ReactProvider runtime={runtime} siteVersion={siteVersion}>\n {component}\n </Testing.ReactProvider>\n )\n }\n\n if (!isServer()) {\n const restoreMessageChannel = isReadOnly ? null : stubBuilderMessageChannel()\n\n const rootElementData: ElementData = Testing.createRootComponent(\n [elementData, ...rootElements],\n ROOT_ID,\n )\n\n const snapshot = Testing.createMakeswiftPageSnapshot(rootElementData, { locale, cacheData })\n\n // Assert\n await act(async () => render(testElementTree(<Page snapshot={snapshot} />)))\n\n if (action) {\n await act(async () => {\n await action(screen.getByTestId(testId))\n })\n }\n\n expect(snapshot).toMatchSnapshot('snapshot')\n expect(propSnapshot(screen.getByTestId(testId))).toMatchSnapshot('resolvedValue')\n\n if (expectedRenders != null) {\n expect(Number(screen.getByTestId(renderCountTestId).textContent)).toBe(expectedRenders)\n }\n\n restoreMessageChannel?.()\n } else {\n // test server-side rendering using a component snapshot\n console.assert(action == null)\n console.assert(rootElements.length === 0)\n\n const snapshot = Testing.createMakeswiftComponentSnapshot(elementData, { locale, cacheData })\n const elementTree = testElementTree(\n <MakeswiftComponent snapshot={snapshot} {...testComponentMeta} />,\n )\n\n const document = await serverSideRender(elementTree)\n const getByTestId = (id: string): HTMLElement | null =>\n document.querySelector(`[data-testid=\"${id}\"]`)\n\n expect(propSnapshot(getByTestId(testId))).toMatchSnapshot('resolvedValue')\n expect([...document.querySelectorAll('style')].map(n => n.textContent)).toMatchSnapshot(\n 'component styles',\n )\n expect(Number(getByTestId(renderCountTestId)?.textContent)).toBe(1)\n }\n}\n"],"mappings":"AAsDI,cAoGI,YApGJ;AAtDJ,SAAyB,UAAU,YAAY,QAAQ,gBAAgB,WAAW;AAClF,SAAS,8BAA8B;AACvC,SAAS,aAAa;AACtB,SAAS,QAAQ,cAAc;AAC/B,OAAO;AACP,SAAS,iCAAiC;AAM1C,SAAS,sBAAsB;AAE/B,SAAS,0BAA0B;AACnC,SAAS,YAAY;AACrB,SAAS,gBAAgB;AACzB,YAAY,aAAa;AAEzB,MAAM,UAAU;AAChB,MAAM,aAAa;AAEnB,MAAM,aAAa,CAAC,SAClB,SAAS,SAAY,cAAc,eAAe,IAAI,IAAI,OAAO,KAAK,UAAU,IAAI;AAEtF,MAAM,eAAe,CAAC,SACpB,MAAM,oBAAoB,KAAK,aAAa,qBAAqB,MAAM,eAAe,EAAE;AAE1F,MAAM,uBAAuB,CAAC,SAAkB,SAAS,cAAc,SAAY,KAAK,MAAM,IAAI;AAElG,eAAe,eAAe,QAAwB;AACpD,QAAM,SAAS,OAAO,UAAU;AAChC,QAAM,UAAU,IAAI,YAAY;AAEhC,MAAI,SAAS;AAEb,SAAO,MAAM;AACX,UAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAC1C,QAAI;AAAM;AACV,cAAU,QAAQ,OAAO,OAAO,EAAE,QAAQ,KAAK,CAAC;AAAA,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AAO,YAAY,MAAM,CAAC;AAAA,MACzC,CAAC;AAAA,IACH;AAEA,WAAO,QAAQ,EAAE,gBAAgB,UAAU;AAC3C,WAAO,aAAa,OAAO,YAAY,MAAM,CAAC,CAAC,EAAE,gBAAgB,eAAe;AAEhF,QAAI,mBAAmB,MAAM;AAC3B,aAAO,OAAO,OAAO,YAAY,iBAAiB,EAAE,WAAW,CAAC,EAAE,KAAK,eAAe;AAAA,IACxF;AAEA,4BAAwB;AAAA,EAC1B,OAAO;AAEL,YAAQ,OAAO,UAAU,IAAI;AAC7B,YAAQ,OAAO,aAAa,WAAW,CAAC;AAExC,UAAM,WAAW,QAAQ,iCAAiC,aAAa,EAAE,QAAQ,UAAU,CAAC;AAC5F,UAAM,cAAc;AAAA,MAClB,oBAAC,sBAAmB,UAAqB,GAAG,mBAAmB;AAAA,IACjE;AAEA,UAAM,WAAW,MAAM,iBAAiB,WAAW;AACnD,UAAM,cAAc,CAAC,OACnB,SAAS,cAAc,iBAAiB,EAAE,IAAI;AAEhD,WAAO,aAAa,YAAY,MAAM,CAAC,CAAC,EAAE,gBAAgB,eAAe;AACzE,WAAO,CAAC,GAAG,SAAS,iBAAiB,OAAO,CAAC,EAAE,IAAI,OAAK,EAAE,WAAW,CAAC,EAAE;AAAA,MACtE;AAAA,IACF;AACA,WAAO,OAAO,YAAY,iBAAiB,GAAG,WAAW,CAAC,EAAE,KAAK,CAAC;AAAA,EACpE;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/next/components/tests/controls/page-control-prop-rendering.tsx"],"sourcesContent":["import { type ReactNode, Fragment, forwardRef, useRef, isValidElement, act } from 'react'\nimport { JSDOM } from 'jsdom'\nimport { render, screen } from '@testing-library/react'\nimport '@testing-library/jest-dom'\nimport { ServerInsertedHTMLContext } from 'next/navigation'\n\nimport { type Data, type ValueType, type DataType, ControlDefinition } from '@makeswift/controls'\n\nimport { type CacheData } from '../../../../api/api-resources-client'\nimport { ElementData } from '../../../../state/read-only-state'\nimport { setIsInBuilder } from '../../../../state/actions/internal/read-only-actions'\nimport { ReactRuntime } from '../../../../runtimes/react/react-runtime'\nimport { MakeswiftComponent } from '../../../../runtimes/react/components/MakeswiftComponent'\nimport { Page } from '../../page'\nimport { isServer } from '../../../../utils/is-server'\n\nimport { renderToString } from '../../../../runtimes/react/testing/render-to-string'\nimport * as Testing from '../../../testing'\n\nconst ROOT_ID = '00000000-0000-0000-0000-000000000000'\nconst ELEMENT_ID = '11111111-1111-1111-1111-111111111111'\n\nconst renderProp = (prop: any) =>\n prop === undefined ? 'undefined' : isValidElement(prop) ? prop : JSON.stringify(prop)\n\nconst propSnapshot = (prop: HTMLElement | null) =>\n prop?.childElementCount ? prop.childNodes : parseStringifiedProp(prop?.textContent ?? '')\n\nconst parseStringifiedProp = (prop: string) => (prop === 'undefined' ? undefined : JSON.parse(prop))\n\nasync function serverSideRender(children: ReactNode) {\n // wrap the children in a context provider to capture server-inserted HTML, see\n // https://github.com/vercel/next.js/blob/canary/packages/next/src/server/app-render/server-inserted-html.tsx\n const serverInsertedCallbacks: (() => React.ReactNode)[] = []\n\n const elementTree = (\n <ServerInsertedHTMLContext.Provider value={handler => serverInsertedCallbacks.push(handler)}>\n {children}\n </ServerInsertedHTMLContext.Provider>\n )\n\n const elementsHTML = await renderToString(elementTree)\n\n const serverInsertedNodes = serverInsertedCallbacks.map((callback, index) => (\n <Fragment key={'__next_server_inserted__' + index}>{callback()}</Fragment>\n ))\n\n const headHTML = await renderToString(serverInsertedNodes)\n\n const dom = new JSDOM(\n `<!DOCTYPE html><head>${headHTML}</head><body><div id=\"root\">${elementsHTML}</div></body></div>`,\n {\n runScripts: 'dangerously',\n },\n )\n\n return dom.window.document\n}\n\n/**\n * In read-write mode, the runtime opens a `MessageChannel` to the builder\n * parent frame; jsdom doesn't implement `MessageChannel`, so stub them to keep\n * the read-write setup from throwing.\n */\nfunction stubBuilderMessageChannel(): () => void {\n const postMessageSpy = jest.spyOn(window, 'postMessage').mockImplementation(() => {})\n\n const originalMessageChannel = window.MessageChannel\n const stubPort = () => ({ onmessage: null, postMessage: () => {}, close: () => {} })\n window.MessageChannel = class {\n port1 = stubPort()\n port2 = stubPort()\n } as unknown as typeof MessageChannel\n\n return () => {\n postMessageSpy.mockRestore()\n window.MessageChannel = originalMessageChannel\n }\n}\n\nexport async function testPageControlPropRendering<D extends ControlDefinition>(\n controlDefinition: D,\n {\n toData,\n value,\n locale,\n cacheData,\n expectedRenders,\n registerComponents,\n action,\n rootElements = [],\n isInBuilder = false,\n isReadOnly = true,\n }: {\n toData?: (value: ValueType<D>) => DataType<D>\n value: ValueType<D> | undefined\n locale?: string | null\n cacheData?: Partial<CacheData>\n expectedRenders?: number\n registerComponents?: (runtime: ReactRuntime) => void\n action?: (element: HTMLElement) => Promise<void>\n rootElements?: ElementData[]\n isInBuilder?: boolean\n isReadOnly?: boolean\n },\n) {\n // Arrange\n const controlData: DataType<D> | Data =\n value !== undefined ? (toData ? toData(value) : controlDefinition.toData(value)) : undefined\n\n const testComponentMeta = {\n type: 'TestComponent',\n label: 'Test Component',\n }\n\n const testId = 'test-id'\n const renderCountTestId = 'render-count-test-id'\n const elementData: ElementData = {\n key: ELEMENT_ID,\n type: testComponentMeta.type,\n props: {\n propKey: controlData,\n },\n }\n\n const runtime = Testing.createReactRuntime()\n runtime.protoStore.dispatch(setIsInBuilder(isInBuilder))\n registerComponents?.(runtime)\n\n // Act\n runtime.registerComponent(\n forwardRef<HTMLDivElement, { propKey?: any }>(({ propKey }, ref) => {\n const renderCount = useRef(0)\n ++renderCount.current\n\n return (\n <div ref={ref}>\n <div data-testid={renderCountTestId}>{renderCount.current}</div>\n <div data-testid={testId}>{renderProp(propKey)}</div>\n </div>\n )\n }),\n {\n ...testComponentMeta,\n props: {\n propKey: controlDefinition as any,\n },\n },\n )\n\n const testElementTree = (component: ReactNode) => {\n // The runtime enters the read-write state when a non-null site version is\n // passed\n const siteVersion = isReadOnly ? null : { token: 'test-token', version: 'draft' }\n return (\n <Testing.ReactProvider runtime={runtime} siteVersion={siteVersion}>\n {component}\n </Testing.ReactProvider>\n )\n }\n\n if (!isServer()) {\n const restoreMessageChannel = isReadOnly ? null : stubBuilderMessageChannel()\n\n const rootElementData: ElementData = Testing.createRootComponent(\n [elementData, ...rootElements],\n ROOT_ID,\n )\n\n const snapshot = Testing.createMakeswiftPageSnapshot(rootElementData, { locale, cacheData })\n\n // Assert\n await act(async () => render(testElementTree(<Page snapshot={snapshot} />)))\n\n if (action) {\n await act(async () => {\n await action(screen.getByTestId(testId))\n })\n }\n\n expect(snapshot).toMatchSnapshot('snapshot')\n expect(propSnapshot(screen.getByTestId(testId))).toMatchSnapshot('resolvedValue')\n\n if (expectedRenders != null) {\n expect(Number(screen.getByTestId(renderCountTestId).textContent)).toBe(expectedRenders)\n }\n\n restoreMessageChannel?.()\n } else {\n // test server-side rendering using a component snapshot\n console.assert(action == null)\n console.assert(rootElements.length === 0)\n\n const snapshot = Testing.createMakeswiftComponentSnapshot(elementData, { locale, cacheData })\n const elementTree = testElementTree(\n <MakeswiftComponent snapshot={snapshot} {...testComponentMeta} />,\n )\n\n const document = await serverSideRender(elementTree)\n const getByTestId = (id: string): HTMLElement | null =>\n document.querySelector(`[data-testid=\"${id}\"]`)\n\n expect(propSnapshot(getByTestId(testId))).toMatchSnapshot('resolvedValue')\n expect([...document.querySelectorAll('style')].map(n => n.textContent)).toMatchSnapshot(\n 'component styles',\n )\n expect(Number(getByTestId(renderCountTestId)?.textContent)).toBe(1)\n }\n}\n"],"mappings":"AAoCI,cAoGI,YApGJ;AApCJ,SAAyB,UAAU,YAAY,QAAQ,gBAAgB,WAAW;AAClF,SAAS,aAAa;AACtB,SAAS,QAAQ,cAAc;AAC/B,OAAO;AACP,SAAS,iCAAiC;AAM1C,SAAS,sBAAsB;AAE/B,SAAS,0BAA0B;AACnC,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAEzB,SAAS,sBAAsB;AAC/B,YAAY,aAAa;AAEzB,MAAM,UAAU;AAChB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,UAAU,CAAC;AAG3F,UAAM,IAAI,YAAY,OAAO,gBAAgB,oBAAC,QAAK,UAAoB,CAAE,CAAC,CAAC;AAE3E,QAAI,QAAQ;AACV,YAAM,IAAI,YAAY;AACpB,cAAM,OAAO,OAAO,YAAY,MAAM,CAAC;AAAA,MACzC,CAAC;AAAA,IACH;AAEA,WAAO,QAAQ,EAAE,gBAAgB,UAAU;AAC3C,WAAO,aAAa,OAAO,YAAY,MAAM,CAAC,CAAC,EAAE,gBAAgB,eAAe;AAEhF,QAAI,mBAAmB,MAAM;AAC3B,aAAO,OAAO,OAAO,YAAY,iBAAiB,EAAE,WAAW,CAAC,EAAE,KAAK,eAAe;AAAA,IACxF;AAEA,4BAAwB;AAAA,EAC1B,OAAO;AAEL,YAAQ,OAAO,UAAU,IAAI;AAC7B,YAAQ,OAAO,aAAa,WAAW,CAAC;AAExC,UAAM,WAAW,QAAQ,iCAAiC,aAAa,EAAE,QAAQ,UAAU,CAAC;AAC5F,UAAM,cAAc;AAAA,MAClB,oBAAC,sBAAmB,UAAqB,GAAG,mBAAmB;AAAA,IACjE;AAEA,UAAM,WAAW,MAAM,iBAAiB,WAAW;AACnD,UAAM,cAAc,CAAC,OACnB,SAAS,cAAc,iBAAiB,EAAE,IAAI;AAEhD,WAAO,aAAa,YAAY,MAAM,CAAC,CAAC,EAAE,gBAAgB,eAAe;AACzE,WAAO,CAAC,GAAG,SAAS,iBAAiB,OAAO,CAAC,EAAE,IAAI,OAAK,EAAE,WAAW,CAAC,EAAE;AAAA,MACtE;AAAA,IACF;AACA,WAAO,OAAO,YAAY,iBAAiB,GAAG,WAAW,CAAC,EAAE,KAAK,CAAC;AAAA,EACpE;AACF;","names":[]}
@@ -27,10 +27,12 @@ class ReactRuntimeCore extends RuntimeCore {
27
27
  server = false,
28
28
  props
29
29
  }) {
30
+ const isServerComponent = server !== false;
31
+ const injectedProps = typeof server === "object" ? server.unstable_injectedProps : {};
30
32
  validateComponentType(
31
33
  // make sure we don't access `component?.name` and trigger loading of the server
32
34
  // component unless we're running in the RSC environment
33
- server && !this.isRSCEnv() ? { type, componentName: label || "Unknown server component" } : {
35
+ isServerComponent && !this.isRSCEnv() ? { type, componentName: label || "Unknown server component" } : {
34
36
  type,
35
37
  componentName: component?.name || label || "Unknown component"
36
38
  }
@@ -38,7 +40,16 @@ class ReactRuntimeCore extends RuntimeCore {
38
40
  const unregisterComponent = this.protoStore.dispatch(
39
41
  registerComponentEffect(
40
42
  type,
41
- { label, icon, hidden, description, builtinSuspense, unstable_migration, server },
43
+ {
44
+ label,
45
+ icon,
46
+ hidden,
47
+ description,
48
+ builtinSuspense,
49
+ unstable_migration,
50
+ server: isServerComponent,
51
+ injectedProps
52
+ },
42
53
  props ?? {}
43
54
  )
44
55
  );
@@ -47,7 +58,7 @@ class ReactRuntimeCore extends RuntimeCore {
47
58
  "builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>."
48
59
  );
49
60
  }
50
- if (server && !this.isRSCEnv()) {
61
+ if (isServerComponent && !this.isRSCEnv()) {
51
62
  return () => {
52
63
  unregisterComponent();
53
64
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/runtimes/react/react-runtime-core.ts"],"sourcesContent":["import { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls'\n\nimport { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors'\n\nimport { supportsActivity } from './components/activity-with-fallback'\n\nimport {\n registerComponentEffect,\n registerReactComponentEffect,\n} from '../../state/actions/internal/read-only-actions'\n\nimport { ComponentIcon } from '../../state/modules/components-meta'\nimport type { ComponentType } from '../../state/read-only-state'\n\nimport { RuntimeCore } from './runtime-core'\n\nfunction validateComponentType({\n type,\n componentName,\n}: {\n type: string\n componentName: string\n}): void {\n if (typeof type !== 'string' || type === '') {\n throw new Error(\n `${componentName}: A non-empty string \\`type\\` is required for component registration, got ${type}`,\n )\n }\n}\n\nexport class ReactRuntimeCore extends RuntimeCore {\n registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Cube,\n hidden = false,\n description,\n builtinSuspense,\n unstable_migration,\n server = false,\n props,\n }: {\n type: string\n label: string\n icon?: ComponentIcon\n hidden?: boolean\n description?: string\n /**\n * In React <= 19.1, controls the default `<Suspense>` boundary.\n * Ignored in React >= 19.2; components are always wrapped in `<Activity>`.\n * Defaults to `true`.\n */\n builtinSuspense?: boolean\n /**\n * Marks this registration as superseded by `replacementType`. When\n * `replacementType` differs from `type`, the builder offers a way to\n * update existing instances.\n */\n unstable_migration?: { replacementType: string }\n server?: boolean\n props?: P\n },\n ): () => void {\n validateComponentType(\n // make sure we don't access `component?.name` and trigger loading of the server\n // component unless we're running in the RSC environment\n server && !this.isRSCEnv()\n ? { type, componentName: label || 'Unknown server component' }\n : {\n type,\n componentName: component?.name || label || 'Unknown component',\n },\n )\n\n const unregisterComponent = this.protoStore.dispatch(\n registerComponentEffect(\n type,\n { label, icon, hidden, description, builtinSuspense, unstable_migration, server },\n props ?? {},\n ),\n )\n\n if (supportsActivity() && builtinSuspense !== undefined) {\n console.warn(\n 'builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>.',\n )\n }\n\n if (server && !this.isRSCEnv()) {\n // we can't load server components code outside of the RSC environment, but we also\n // don't need to: if everything is set up correctly, React has already rendered and\n // streamed the corresponding React elements to the client for us -- see\n // `ServerElementsCache` and `ElementDataServer`\n return () => {\n unregisterComponent()\n }\n }\n\n const unregisterReactComponent = this.protoStore.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n\n protected isRSCEnv() {\n return false\n }\n}\n"],"mappings":"AAIA,SAAS,wBAAwB;AAEjC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,qBAAqB;AAG9B,SAAS,mBAAmB;AAE5B,SAAS,sBAAsB;AAAA,EAC7B;AAAA,EACA;AACF,GAGS;AACP,MAAI,OAAO,SAAS,YAAY,SAAS,IAAI;AAC3C,UAAM,IAAI;AAAA,MACR,GAAG,aAAa,6EAA6E,IAAI;AAAA,IACnG;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,YAAY;AAAA,EAChD,kBAKE,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO,cAAc;AAAA,IACrB,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,EACF,GAqBY;AACZ;AAAA;AAAA;AAAA,MAGE,UAAU,CAAC,KAAK,SAAS,IACrB,EAAE,MAAM,eAAe,SAAS,2BAA2B,IAC3D;AAAA,QACE;AAAA,QACA,eAAe,WAAW,QAAQ,SAAS;AAAA,MAC7C;AAAA,IACN;AAEA,UAAM,sBAAsB,KAAK,WAAW;AAAA,MAC1C;AAAA,QACE;AAAA,QACA,EAAE,OAAO,MAAM,QAAQ,aAAa,iBAAiB,oBAAoB,OAAO;AAAA,QAChF,SAAS,CAAC;AAAA,MACZ;AAAA,IACF;AAEA,QAAI,iBAAiB,KAAK,oBAAoB,QAAW;AACvD,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAEA,QAAI,UAAU,CAAC,KAAK,SAAS,GAAG;AAK9B,aAAO,MAAM;AACX,4BAAoB;AAAA,MACtB;AAAA,IACF;AAEA,UAAM,2BAA2B,KAAK,WAAW;AAAA,MAC/C,6BAA6B,MAAM,SAAqC;AAAA,IAC1E;AAEA,WAAO,MAAM;AACX,0BAAoB;AACpB,+BAAyB;AAAA,IAC3B;AAAA,EACF;AAAA,EAEU,WAAW;AACnB,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/runtimes/react/react-runtime-core.ts"],"sourcesContent":["import { type Component, type PropsWithoutRef, type ReactNode, type RefAttributes } from 'react'\n\nimport { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls'\n\nimport { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors'\n\nimport { supportsActivity } from './components/activity-with-fallback'\n\nimport {\n registerComponentEffect,\n registerReactComponentEffect,\n} from '../../state/actions/internal/read-only-actions'\n\nimport { ComponentIcon } from '../../state/modules/components-meta'\nimport type { ComponentType } from '../../state/read-only-state'\n\nimport { type InjectableProps } from './server/injectable-props'\n\nimport { RuntimeCore } from './runtime-core'\n\nfunction validateComponentType({\n type,\n componentName,\n}: {\n type: string\n componentName: string\n}): void {\n if (typeof type !== 'string' || type === '') {\n throw new Error(\n `${componentName}: A non-empty string \\`type\\` is required for component registration, got ${type}`,\n )\n }\n}\n\ntype InjectedPropsConfig = Record<string, keyof InjectableProps>\n\ntype ServerComponentConfig<I extends InjectedPropsConfig> =\n | boolean\n | {\n unstable_injectedProps: I\n }\n\ntype InjectedProps<I extends InjectedPropsConfig> = {\n [K in keyof I]: InjectableProps[I[K]]\n}\n\ntype ResolvedProps<P extends Record<string, LegacyDescriptor | UnifiedControlDefinition>> = {\n [K in keyof P]: DescriptorValueType<P[K]>\n}\n\ntype RegisteredComponentType<\n P extends Record<string, LegacyDescriptor | UnifiedControlDefinition>,\n I extends InjectedPropsConfig,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T = any,\n> =\n | {\n new (\n props: PropsWithoutRef<ResolvedProps<P>> & InjectedProps<I> & RefAttributes<T>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n context?: any,\n ): Component<ResolvedProps<P> & InjectedProps<I>>\n }\n | ((\n props: PropsWithoutRef<ResolvedProps<P>> & InjectedProps<I> & RefAttributes<T>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n context?: any,\n ) => ReactNode)\n\nexport class ReactRuntimeCore extends RuntimeCore {\n registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n const I extends InjectedPropsConfig = {},\n C extends RegisteredComponentType<P, I> = RegisteredComponentType<P, I>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Cube,\n hidden = false,\n description,\n builtinSuspense,\n unstable_migration,\n server = false,\n props,\n }: {\n type: string\n label: string\n icon?: ComponentIcon\n hidden?: boolean\n description?: string\n /**\n * In React <= 19.1, controls the default `<Suspense>` boundary.\n * Ignored in React >= 19.2; components are always wrapped in `<Activity>`.\n * Defaults to `true`.\n */\n builtinSuspense?: boolean\n /**\n * Marks this registration as superseded by `replacementType`. When\n * `replacementType` differs from `type`, the builder offers a way to\n * update existing instances.\n */\n unstable_migration?: { replacementType: string }\n server?: ServerComponentConfig<I>\n props?: P\n },\n ): () => void {\n const isServerComponent = server !== false\n const injectedProps = typeof server === 'object' ? server.unstable_injectedProps : {}\n\n validateComponentType(\n // make sure we don't access `component?.name` and trigger loading of the server\n // component unless we're running in the RSC environment\n isServerComponent && !this.isRSCEnv()\n ? { type, componentName: label || 'Unknown server component' }\n : {\n type,\n componentName: component?.name || label || 'Unknown component',\n },\n )\n\n const unregisterComponent = this.protoStore.dispatch(\n registerComponentEffect(\n type,\n {\n label,\n icon,\n hidden,\n description,\n builtinSuspense,\n unstable_migration,\n server: isServerComponent,\n injectedProps,\n },\n props ?? {},\n ),\n )\n\n if (supportsActivity() && builtinSuspense !== undefined) {\n console.warn(\n 'builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>.',\n )\n }\n\n if (isServerComponent && !this.isRSCEnv()) {\n // we can't load server components code outside of the RSC environment, but we also\n // don't need to: if everything is set up correctly, React has already rendered and\n // streamed the corresponding React elements to the client for us -- see\n // `ServerElementsCache` and `ElementDataServer`\n return () => {\n unregisterComponent()\n }\n }\n\n const unregisterReactComponent = this.protoStore.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n\n protected isRSCEnv() {\n return false\n }\n}\n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AEA,WAAO,MAAM;AACX,0BAAoB;AACpB,+BAAyB;AAAA,IAC3B;AAAA,EACF;AAAA,EAEU,WAAW;AACnB,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -17,7 +17,8 @@ import { resolveProps } from "../resolve-props";
17
17
  async function ServerElementData({
18
18
  documentKey,
19
19
  context,
20
- elementData
20
+ elementData,
21
+ injectedProps
21
22
  }) {
22
23
  const state = getStore(context).getState();
23
24
  const Component = getReactComponent(state, elementData.type);
@@ -44,7 +45,10 @@ async function ServerElementData({
44
45
  getBreakpoints(state),
45
46
  elementData.key
46
47
  );
47
- const props = await resolveProps(context, elementData, documentKey, definitions, stylesheet);
48
+ const props = {
49
+ ...await resolveProps(context, elementData, documentKey, definitions, stylesheet),
50
+ ...injectedProps
51
+ };
48
52
  return /* @__PURE__ */ jsxs(Fragment, { children: [
49
53
  /* @__PURE__ */ jsx(Component, { ...props }, elementData.key),
50
54
  /* @__PURE__ */ jsx(InjectServerCSS, { collector: cssCollector, elementKey: elementData.key })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/runtimes/react/server/components/element-data.tsx"],"sourcesContent":["import { type ReactNode } from 'react'\n\nimport { partitionRecord } from '../../../../utils/partition'\n\nimport {\n type State,\n type ElementData,\n getReactComponent,\n getBreakpoints,\n getComponentPropControllerDescriptors,\n} from '../../../../state/read-only-state'\n\nimport { FallbackComponent } from '../../../../components/shared/FallbackComponent'\nimport { isLegacyDescriptor } from '../../../../prop-controllers/descriptors'\n\nimport {\n ServerCSSCollector,\n createCollectingServerStylesheet,\n InjectServerCSS,\n} from '../css/server-css'\nimport { type ServerRenderContext, getStore } from '../render-context'\nimport { resolveProps } from '../resolve-props'\n\nexport async function ServerElementData({\n documentKey,\n context,\n elementData,\n}: {\n documentKey: string\n context: ServerRenderContext\n elementData: ElementData\n}): Promise<ReactNode> {\n const state = getStore(context).getState()\n\n const Component = getReactComponent(state, elementData.type)\n if (Component == null) {\n return (\n <FallbackComponent\n text=\"Component not found\"\n details={`Unknown component '${elementData.type}'`}\n />\n )\n }\n\n const [legacyDescriptors, definitions] = getControlDefs(state, elementData)\n const legacyKeys = Object.keys(legacyDescriptors)\n if (legacyKeys.length > 0) {\n console.warn(`Unexpected legacy control data in server element '${elementData.key}`, {\n elementData,\n legacyKeys,\n })\n }\n\n const cssCollector = new ServerCSSCollector()\n const stylesheet = createCollectingServerStylesheet(\n cssCollector,\n getBreakpoints(state),\n elementData.key,\n )\n\n const props = await resolveProps(context, elementData, documentKey, definitions, stylesheet)\n\n return (\n <>\n {/* Make the component the first child so that `findDOMNode` resolves to its first\n rendered DOM node (if any) rather than the component's `<style>` element */}\n <Component key={elementData.key} {...props} />\n <InjectServerCSS collector={cssCollector} elementKey={elementData.key} />\n </>\n )\n}\n\nconst getControlDefs = (state: State, elementData: ElementData) => {\n const descriptors = getComponentPropControllerDescriptors(state, elementData.type) ?? {}\n return partitionRecord(descriptors, isLegacyDescriptor)\n}\n"],"mappings":"AAqCM,SA0BF,UA1BE,KA0BF,YA1BE;AAnCN,SAAS,uBAAuB;AAEhC;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AAEnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAmC,gBAAgB;AACnD,SAAS,oBAAoB;AAE7B,eAAsB,kBAAkB;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AACF,GAIuB;AACrB,QAAM,QAAQ,SAAS,OAAO,EAAE,SAAS;AAEzC,QAAM,YAAY,kBAAkB,OAAO,YAAY,IAAI;AAC3D,MAAI,aAAa,MAAM;AACrB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS,sBAAsB,YAAY,IAAI;AAAA;AAAA,IACjD;AAAA,EAEJ;AAEA,QAAM,CAAC,mBAAmB,WAAW,IAAI,eAAe,OAAO,WAAW;AAC1E,QAAM,aAAa,OAAO,KAAK,iBAAiB;AAChD,MAAI,WAAW,SAAS,GAAG;AACzB,YAAQ,KAAK,qDAAqD,YAAY,GAAG,IAAI;AAAA,MACnF;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,eAAe,IAAI,mBAAmB;AAC5C,QAAM,aAAa;AAAA,IACjB;AAAA,IACA,eAAe,KAAK;AAAA,IACpB,YAAY;AAAA,EACd;AAEA,QAAM,QAAQ,MAAM,aAAa,SAAS,aAAa,aAAa,aAAa,UAAU;AAE3F,SACE,iCAGE;AAAA,wBAAC,aAAiC,GAAG,SAArB,YAAY,GAAgB;AAAA,IAC5C,oBAAC,mBAAgB,WAAW,cAAc,YAAY,YAAY,KAAK;AAAA,KACzE;AAEJ;AAEA,MAAM,iBAAiB,CAAC,OAAc,gBAA6B;AACjE,QAAM,cAAc,sCAAsC,OAAO,YAAY,IAAI,KAAK,CAAC;AACvF,SAAO,gBAAgB,aAAa,kBAAkB;AACxD;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/runtimes/react/server/components/element-data.tsx"],"sourcesContent":["import { type ReactNode } from 'react'\n\nimport { partitionRecord } from '../../../../utils/partition'\n\nimport {\n type State,\n type ElementData,\n getReactComponent,\n getBreakpoints,\n getComponentPropControllerDescriptors,\n} from '../../../../state/read-only-state'\n\nimport { FallbackComponent } from '../../../../components/shared/FallbackComponent'\nimport { isLegacyDescriptor } from '../../../../prop-controllers/descriptors'\n\nimport {\n ServerCSSCollector,\n createCollectingServerStylesheet,\n InjectServerCSS,\n} from '../css/server-css'\nimport { type ServerRenderContext, getStore } from '../render-context'\nimport { resolveProps } from '../resolve-props'\n\nexport async function ServerElementData({\n documentKey,\n context,\n elementData,\n injectedProps,\n}: {\n documentKey: string\n context: ServerRenderContext\n elementData: ElementData\n injectedProps: Record<string, unknown>\n}): Promise<ReactNode> {\n const state = getStore(context).getState()\n\n const Component = getReactComponent(state, elementData.type)\n if (Component == null) {\n return (\n <FallbackComponent\n text=\"Component not found\"\n details={`Unknown component '${elementData.type}'`}\n />\n )\n }\n\n const [legacyDescriptors, definitions] = getControlDefs(state, elementData)\n const legacyKeys = Object.keys(legacyDescriptors)\n if (legacyKeys.length > 0) {\n console.warn(`Unexpected legacy control data in server element '${elementData.key}`, {\n elementData,\n legacyKeys,\n })\n }\n\n const cssCollector = new ServerCSSCollector()\n const stylesheet = createCollectingServerStylesheet(\n cssCollector,\n getBreakpoints(state),\n elementData.key,\n )\n\n const props = {\n ...(await resolveProps(context, elementData, documentKey, definitions, stylesheet)),\n ...injectedProps,\n }\n\n return (\n <>\n {/* Make the component the first child so that `findDOMNode` resolves to its first\n rendered DOM node (if any) rather than the component's `<style>` element */}\n <Component key={elementData.key} {...props} />\n <InjectServerCSS collector={cssCollector} elementKey={elementData.key} />\n </>\n )\n}\n\nconst getControlDefs = (state: State, elementData: ElementData) => {\n const descriptors = getComponentPropControllerDescriptors(state, elementData.type) ?? {}\n return partitionRecord(descriptors, isLegacyDescriptor)\n}\n"],"mappings":"AAuCM,SA6BF,UA7BE,KA6BF,YA7BE;AArCN,SAAS,uBAAuB;AAEhC;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AAEnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAmC,gBAAgB;AACnD,SAAS,oBAAoB;AAE7B,eAAsB,kBAAkB;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKuB;AACrB,QAAM,QAAQ,SAAS,OAAO,EAAE,SAAS;AAEzC,QAAM,YAAY,kBAAkB,OAAO,YAAY,IAAI;AAC3D,MAAI,aAAa,MAAM;AACrB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS,sBAAsB,YAAY,IAAI;AAAA;AAAA,IACjD;AAAA,EAEJ;AAEA,QAAM,CAAC,mBAAmB,WAAW,IAAI,eAAe,OAAO,WAAW;AAC1E,QAAM,aAAa,OAAO,KAAK,iBAAiB;AAChD,MAAI,WAAW,SAAS,GAAG;AACzB,YAAQ,KAAK,qDAAqD,YAAY,GAAG,IAAI;AAAA,MACnF;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,eAAe,IAAI,mBAAmB;AAC5C,QAAM,aAAa;AAAA,IACjB;AAAA,IACA,eAAe,KAAK;AAAA,IACpB,YAAY;AAAA,EACd;AAEA,QAAM,QAAQ;AAAA,IACZ,GAAI,MAAM,aAAa,SAAS,aAAa,aAAa,aAAa,UAAU;AAAA,IACjF,GAAG;AAAA,EACL;AAEA,SACE,iCAGE;AAAA,wBAAC,aAAiC,GAAG,SAArB,YAAY,GAAgB;AAAA,IAC5C,oBAAC,mBAAgB,WAAW,cAAc,YAAY,YAAY,KAAK;AAAA,KACzE;AAEJ;AAEA,MAAM,iBAAiB,CAAC,OAAc,gBAA6B;AACjE,QAAM,cAAc,sCAAsC,OAAO,YAAY,IAAI,KAAK,CAAC;AACvF,SAAO,gBAAgB,aAAa,kBAAkB;AACxD;","names":[]}
@@ -1,4 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { mapValues } from "@makeswift/controls";
2
3
  import {
3
4
  isElementReference,
4
5
  getComponentsMeta
@@ -26,11 +27,28 @@ function ServerElement({
26
27
  }
27
28
  );
28
29
  }
30
+ const elementKey = element.key;
29
31
  const isRSC = elementMeta.server ?? false;
30
32
  if (!isRSC) {
31
- return /* @__PURE__ */ jsx(ClientElement, { element }, element.key);
33
+ return /* @__PURE__ */ jsx(ClientElement, { element }, elementKey);
32
34
  }
33
- return /* @__PURE__ */ jsx(ServerElementData, { documentKey, context, elementData: element });
35
+ const injectableProps = {
36
+ elementKey,
37
+ documentKey
38
+ };
39
+ const injectedProps = mapValues(
40
+ elementMeta.injectedProps ?? {},
41
+ (propName) => injectableProps[propName]
42
+ );
43
+ return /* @__PURE__ */ jsx(
44
+ ServerElementData,
45
+ {
46
+ documentKey,
47
+ context,
48
+ elementData: element,
49
+ injectedProps
50
+ }
51
+ );
34
52
  }
35
53
  export {
36
54
  ServerElement
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/runtimes/react/server/components/element.tsx"],"sourcesContent":["import { ReactNode } from 'react'\n\nimport {\n isElementReference,\n getComponentsMeta,\n type Element as ElementDataOrRef,\n} from '../../../../state/read-only-state'\n\nimport { FallbackComponent } from '../../../../components/shared/FallbackComponent'\n\nimport { Element as ClientElement } from '../../components/Element'\n\nimport { type ServerRenderContext, getStore } from '../render-context'\n\nimport { ServerElementData } from './element-data'\n\nexport function ServerElement({\n context,\n element,\n documentKey,\n}: {\n context: ServerRenderContext\n element: ElementDataOrRef\n documentKey: string\n}): ReactNode {\n // check for element references first to avoid looking them up as regular components\n if (isElementReference(element)) {\n return <FallbackComponent text=\"Element reference is not supported on server yet\" />\n }\n\n const state = getStore(context).getState()\n const elementMeta = getComponentsMeta(state).get(element.type)\n if (elementMeta == null) {\n return (\n <FallbackComponent\n text=\"Component not found\"\n details={`Missing component metadata for '${element.type}'`}\n />\n )\n }\n\n const isRSC = elementMeta.server ?? false\n if (!isRSC) {\n return <ClientElement key={element.key} element={element} />\n }\n\n return <ServerElementData documentKey={documentKey} context={context} elementData={element} />\n}\n"],"mappings":"AA2BW;AAzBX;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,yBAAyB;AAElC,SAAS,WAAW,qBAAqB;AAEzC,SAAmC,gBAAgB;AAEnD,SAAS,yBAAyB;AAE3B,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACF,GAIc;AAEZ,MAAI,mBAAmB,OAAO,GAAG;AAC/B,WAAO,oBAAC,qBAAkB,MAAK,oDAAmD;AAAA,EACpF;AAEA,QAAM,QAAQ,SAAS,OAAO,EAAE,SAAS;AACzC,QAAM,cAAc,kBAAkB,KAAK,EAAE,IAAI,QAAQ,IAAI;AAC7D,MAAI,eAAe,MAAM;AACvB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS,mCAAmC,QAAQ,IAAI;AAAA;AAAA,IAC1D;AAAA,EAEJ;AAEA,QAAM,QAAQ,YAAY,UAAU;AACpC,MAAI,CAAC,OAAO;AACV,WAAO,oBAAC,iBAAgC,WAAb,QAAQ,GAAuB;AAAA,EAC5D;AAEA,SAAO,oBAAC,qBAAkB,aAA0B,SAAkB,aAAa,SAAS;AAC9F;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/runtimes/react/server/components/element.tsx"],"sourcesContent":["import { ReactNode } from 'react'\n\nimport { mapValues } from '@makeswift/controls'\n\nimport {\n isElementReference,\n getComponentsMeta,\n type Element as ElementDataOrRef,\n} from '../../../../state/read-only-state'\n\nimport { FallbackComponent } from '../../../../components/shared/FallbackComponent'\n\nimport { Element as ClientElement } from '../../components/Element'\n\nimport { type ServerRenderContext, getStore } from '../render-context'\nimport { type InjectableProps } from '../injectable-props'\n\nimport { ServerElementData } from './element-data'\n\nexport function ServerElement({\n context,\n element,\n documentKey,\n}: {\n context: ServerRenderContext\n element: ElementDataOrRef\n documentKey: string\n}): ReactNode {\n // check for element references first to avoid looking them up as regular components\n if (isElementReference(element)) {\n return <FallbackComponent text=\"Element reference is not supported on server yet\" />\n }\n\n const state = getStore(context).getState()\n const elementMeta = getComponentsMeta(state).get(element.type)\n if (elementMeta == null) {\n return (\n <FallbackComponent\n text=\"Component not found\"\n details={`Missing component metadata for '${element.type}'`}\n />\n )\n }\n\n const elementKey = element.key\n const isRSC = elementMeta.server ?? false\n if (!isRSC) {\n return <ClientElement key={elementKey} element={element} />\n }\n\n const injectableProps: InjectableProps = {\n elementKey,\n documentKey,\n }\n\n const injectedProps = mapValues(\n elementMeta.injectedProps ?? {},\n propName => injectableProps[propName],\n )\n\n return (\n <ServerElementData\n documentKey={documentKey}\n context={context}\n elementData={element}\n injectedProps={injectedProps}\n />\n )\n}\n"],"mappings":"AA8BW;AA5BX,SAAS,iBAAiB;AAE1B;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,yBAAyB;AAElC,SAAS,WAAW,qBAAqB;AAEzC,SAAmC,gBAAgB;AAGnD,SAAS,yBAAyB;AAE3B,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACF,GAIc;AAEZ,MAAI,mBAAmB,OAAO,GAAG;AAC/B,WAAO,oBAAC,qBAAkB,MAAK,oDAAmD;AAAA,EACpF;AAEA,QAAM,QAAQ,SAAS,OAAO,EAAE,SAAS;AACzC,QAAM,cAAc,kBAAkB,KAAK,EAAE,IAAI,QAAQ,IAAI;AAC7D,MAAI,eAAe,MAAM;AACvB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAS,mCAAmC,QAAQ,IAAI;AAAA;AAAA,IAC1D;AAAA,EAEJ;AAEA,QAAM,aAAa,QAAQ;AAC3B,QAAM,QAAQ,YAAY,UAAU;AACpC,MAAI,CAAC,OAAO;AACV,WAAO,oBAAC,iBAA+B,WAAZ,UAA8B;AAAA,EAC3D;AAEA,QAAM,kBAAmC;AAAA,IACvC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,gBAAgB;AAAA,IACpB,YAAY,iBAAiB,CAAC;AAAA,IAC9B,cAAY,gBAAgB,QAAQ;AAAA,EACtC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,aAAa;AAAA,MACb;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=injectable-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -9,12 +9,7 @@ const getRenderContext = () => {
9
9
  throw Error("Makeswift render context was not set.");
10
10
  return context;
11
11
  };
12
- const getStore = ({ runtime, siteVersion, locale }) => {
13
- if (runtime.requestKey == null) {
14
- throw Error("Expected a runtime instance that is bound to a specific request key");
15
- }
16
- return runtime.getOrCreateStore({ siteVersion, locale });
17
- };
12
+ const getStore = ({ store }) => store;
18
13
  const RenderContext = ({
19
14
  context,
20
15
  children
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/server/render-context.tsx"],"sourcesContent":["import { cache, type PropsWithChildren } from 'react'\n\nimport { ReactRuntime } from '../../react/react-runtime'\nimport { type Store } from '../../../state/store'\n\nimport { type SiteVersion } from '../../../api/site-version'\nimport { MakeswiftClient } from '../../../client'\n\n/**\n * Request-scoped dependencies used to render Makeswift server elements.\n *\n * Framework integrations create a context for each request and install it with\n * `RenderContext` or `setRenderContext` so nested renderers can access it without\n * threading it through every component. The runtime must be request-bound;\n * together with `siteVersion` and `locale`, it selects the store and API resource\n * cache used during rendering.\n */\nexport type ServerRenderContext = {\n request: Request\n runtime: ReactRuntime\n client: MakeswiftClient\n siteVersion: SiteVersion | null\n locale: string | undefined\n}\n\nconst requestContext = cache((): { current?: ServerRenderContext } => ({}))\n\nexport const setRenderContext = (context: ServerRenderContext) => {\n requestContext().current = context\n}\n\nexport const getRenderContext = (): ServerRenderContext => {\n const context = requestContext().current\n if (!context) throw Error('Makeswift render context was not set.')\n return context\n}\n\nexport const getStore = ({ runtime, siteVersion, locale }: ServerRenderContext): Store => {\n if (runtime.requestKey == null) {\n throw Error('Expected a runtime instance that is bound to a specific request key')\n }\n\n return runtime.getOrCreateStore({ siteVersion, locale })\n}\n\nexport const RenderContext = ({\n context,\n children,\n}: PropsWithChildren<{ context: ServerRenderContext }>) => {\n setRenderContext(context)\n return children\n}\n"],"mappings":"AAAA,SAAS,aAAqC;AAyB9C,MAAM,iBAAiB,MAAM,OAA0C,CAAC,EAAE;AAEnE,MAAM,mBAAmB,CAAC,YAAiC;AAChE,iBAAe,EAAE,UAAU;AAC7B;AAEO,MAAM,mBAAmB,MAA2B;AACzD,QAAM,UAAU,eAAe,EAAE;AACjC,MAAI,CAAC;AAAS,UAAM,MAAM,uCAAuC;AACjE,SAAO;AACT;AAEO,MAAM,WAAW,CAAC,EAAE,SAAS,aAAa,OAAO,MAAkC;AACxF,MAAI,QAAQ,cAAc,MAAM;AAC9B,UAAM,MAAM,qEAAqE;AAAA,EACnF;AAEA,SAAO,QAAQ,iBAAiB,EAAE,aAAa,OAAO,CAAC;AACzD;AAEO,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AACF,MAA2D;AACzD,mBAAiB,OAAO;AACxB,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/server/render-context.tsx"],"sourcesContent":["import { cache, type PropsWithChildren } from 'react'\n\nimport { ReactRuntime } from '../../react/react-runtime'\nimport { type Store } from '../../../state/store'\n\nimport { type SiteVersion } from '../../../api/site-version'\nimport { MakeswiftClient } from '../../../client'\n\n/**\n * Request-scoped dependencies used to render Makeswift server elements.\n *\n * Framework integrations create a context for each request and install it with\n * `RenderContext` or `setRenderContext` so nested renderers can access it without\n * threading it through every component. The runtime must be request-bound;\n * together with `siteVersion` and `locale`, it selects the store and API resource\n * cache used during rendering.\n */\nexport type ServerRenderContext = {\n request: Request\n runtime: ReactRuntime\n client: MakeswiftClient\n siteVersion: SiteVersion | null\n locale: string | undefined\n store: Store\n}\n\nconst requestContext = cache((): { current?: ServerRenderContext } => ({}))\n\nexport const setRenderContext = (context: ServerRenderContext) => {\n requestContext().current = context\n}\n\nexport const getRenderContext = (): ServerRenderContext => {\n const context = requestContext().current\n if (!context) throw Error('Makeswift render context was not set.')\n return context\n}\n\nexport const getStore = ({ store }: ServerRenderContext): Store => store\n\nexport const RenderContext = ({\n context,\n children,\n}: PropsWithChildren<{ context: ServerRenderContext }>) => {\n setRenderContext(context)\n return children\n}\n"],"mappings":"AAAA,SAAS,aAAqC;AA0B9C,MAAM,iBAAiB,MAAM,OAA0C,CAAC,EAAE;AAEnE,MAAM,mBAAmB,CAAC,YAAiC;AAChE,iBAAe,EAAE,UAAU;AAC7B;AAEO,MAAM,mBAAmB,MAA2B;AACzD,QAAM,UAAU,eAAe,EAAE;AACjC,MAAI,CAAC;AAAS,UAAM,MAAM,uCAAuC;AACjE,SAAO;AACT;AAEO,MAAM,WAAW,CAAC,EAAE,MAAM,MAAkC;AAE5D,MAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AACF,MAA2D;AACzD,mBAAiB,OAAO;AACxB,SAAO;AACT;","names":[]}
@@ -2,10 +2,7 @@ import { TestOrigins } from "../../../testing/fixtures";
2
2
  import { ReactRuntime } from "../react-runtime";
3
3
  class TestReactRuntime extends ReactRuntime {
4
4
  env;
5
- constructor({
6
- env,
7
- ...args
8
- }) {
5
+ constructor({ env, ...args }) {
9
6
  super(args);
10
7
  this.env = env ?? "client";
11
8
  }
@@ -15,6 +12,7 @@ class TestReactRuntime extends ReactRuntime {
15
12
  }
16
13
  function createReactRuntime({
17
14
  breakpoints,
15
+ requestKey,
18
16
  env
19
17
  } = {}) {
20
18
  return new TestReactRuntime({
@@ -22,6 +20,7 @@ function createReactRuntime({
22
20
  // through the patched version instead of an eagerly captured reference to the original
23
21
  fetch: (...args) => globalThis.fetch(...args),
24
22
  breakpoints,
23
+ requestKey,
25
24
  env,
26
25
  ...TestOrigins
27
26
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/runtimes/react/testing/react-runtime.tsx"],"sourcesContent":["import { type BreakpointsInput } from '../../../state/modules/breakpoints'\nimport { TestOrigins } from '../../../testing/fixtures'\nimport { ReactRuntime } from '../react-runtime'\n\ntype RuntimeEnv = 'client' | 'ssr' | 'rsc'\n\nclass TestReactRuntime extends ReactRuntime {\n readonly env: RuntimeEnv\n\n constructor({\n env,\n ...args\n }: ConstructorParameters<typeof ReactRuntime>[0] & { env?: RuntimeEnv }) {\n super(args)\n this.env = env ?? 'client'\n }\n\n protected isRSCEnv() {\n return this.env === 'rsc'\n }\n}\n\nexport function createReactRuntime({\n breakpoints,\n env,\n}: { breakpoints?: BreakpointsInput; env?: RuntimeEnv } = {}) {\n return new TestReactRuntime({\n // Mock Service Worker patches global `fetch` for interception; make sure our test calls go\n // through the patched version instead of an eagerly captured reference to the original\n fetch: (...args) => globalThis.fetch(...args),\n breakpoints,\n env,\n ...TestOrigins,\n })\n}\n"],"mappings":"AACA,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAI7B,MAAM,yBAAyB,aAAa;AAAA,EACjC;AAAA,EAET,YAAY;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EACL,GAAyE;AACvE,UAAM,IAAI;AACV,SAAK,MAAM,OAAO;AAAA,EACpB;AAAA,EAEU,WAAW;AACnB,WAAO,KAAK,QAAQ;AAAA,EACtB;AACF;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,IAA0D,CAAC,GAAG;AAC5D,SAAO,IAAI,iBAAiB;AAAA;AAAA;AAAA,IAG1B,OAAO,IAAI,SAAS,WAAW,MAAM,GAAG,IAAI;AAAA,IAC5C;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/testing/react-runtime.tsx"],"sourcesContent":["import { TestOrigins } from '../../../testing/fixtures'\nimport { ReactRuntime } from '../react-runtime'\n\ntype RuntimeEnv = 'client' | 'ssr' | 'rsc'\ntype RuntimeArgs = ConstructorParameters<typeof ReactRuntime>[0]\n\nclass TestReactRuntime extends ReactRuntime {\n readonly env: RuntimeEnv\n\n constructor({ env, ...args }: RuntimeArgs & { env?: RuntimeEnv }) {\n super(args)\n this.env = env ?? 'client'\n }\n\n protected isRSCEnv() {\n return this.env === 'rsc'\n }\n}\n\nexport function createReactRuntime({\n breakpoints,\n requestKey,\n env,\n}: {\n breakpoints?: RuntimeArgs['breakpoints']\n requestKey?: RuntimeArgs['requestKey']\n env?: RuntimeEnv\n} = {}) {\n return new TestReactRuntime({\n // Mock Service Worker patches global `fetch` for interception; make sure our test calls go\n // through the patched version instead of an eagerly captured reference to the original\n fetch: (...args) => globalThis.fetch(...args),\n breakpoints,\n requestKey,\n env,\n ...TestOrigins,\n })\n}\n"],"mappings":"AAAA,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAK7B,MAAM,yBAAyB,aAAa;AAAA,EACjC;AAAA,EAET,YAAY,EAAE,KAAK,GAAG,KAAK,GAAuC;AAChE,UAAM,IAAI;AACV,SAAK,MAAM,OAAO;AAAA,EACpB;AAAA,EAEU,WAAW;AACnB,WAAO,KAAK,QAAQ;AAAA,EACtB;AACF;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AACF,IAII,CAAC,GAAG;AACN,SAAO,IAAI,iBAAiB;AAAA;AAAA;AAAA,IAG1B,OAAO,IAAI,SAAS,WAAW,MAAM,GAAG,IAAI;AAAA,IAC5C;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
@@ -0,0 +1,20 @@
1
+ import { renderToReadableStream } from "react-dom/server";
2
+ async function streamToString(stream) {
3
+ const reader = stream.getReader();
4
+ const decoder = new TextDecoder();
5
+ let result = "";
6
+ while (true) {
7
+ const { done, value } = await reader.read();
8
+ if (done)
9
+ break;
10
+ result += decoder.decode(value, { stream: true });
11
+ }
12
+ return result;
13
+ }
14
+ async function renderToString(element) {
15
+ return await streamToString(await renderToReadableStream(element));
16
+ }
17
+ export {
18
+ renderToString
19
+ };
20
+ //# sourceMappingURL=render-to-string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/runtimes/react/testing/render-to-string.ts"],"sourcesContent":["import { type ReactNode } from 'react'\nimport { renderToReadableStream } from 'react-dom/server'\n\nasync function streamToString(stream: ReadableStream) {\n const reader = stream.getReader()\n const decoder = new TextDecoder()\n\n let result = ''\n\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n result += decoder.decode(value, { stream: true })\n }\n\n return result\n}\n\nexport async function renderToString(element: ReactNode) {\n return await streamToString(await renderToReadableStream(element))\n}\n"],"mappings":"AACA,SAAS,8BAA8B;AAEvC,eAAe,eAAe,QAAwB;AACpD,QAAM,SAAS,OAAO,UAAU;AAChC,QAAM,UAAU,IAAI,YAAY;AAEhC,MAAI,SAAS;AAEb,SAAO,MAAM;AACX,UAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAC1C,QAAI;AAAM;AACV,cAAU,QAAQ,OAAO,OAAO,EAAE,QAAQ,KAAK,CAAC;AAAA,EAClD;AAEA,SAAO;AACT;AAEA,eAAsB,eAAe,SAAoB;AACvD,SAAO,MAAM,eAAe,MAAM,uBAAuB,OAAO,CAAC;AACnE;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/state/modules/components-meta.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-action-types'\n\nexport const ComponentIcon = {\n Accordion: 'accordion',\n Audio: 'audio',\n Billing: 'billing',\n Bolt: 'bolt',\n Button: 'button',\n Card: 'card',\n Cards: 'cards',\n Carousel: 'carousel',\n Chats: 'chats',\n Code: 'code',\n Countdown: 'countdown',\n Cube: 'cube',\n Database: 'database',\n Divider: 'divider',\n Form: 'form',\n Gallery: 'gallery',\n Grid: 'grid',\n Help: 'help',\n Image: 'image',\n Layout: 'layout',\n Lock: 'lock',\n Marker: 'marker',\n Navigation: 'navigation',\n Palette: 'palette',\n SocialLinks: 'social-links',\n Star: 'star',\n Table: 'table',\n Tabs: 'tabs',\n Text: 'text',\n Users: 'users',\n Video: 'video',\n} as const\n\nexport type ComponentIcon = (typeof ComponentIcon)[keyof typeof ComponentIcon]\n\nexport type ComponentMeta = {\n label: string\n icon: ComponentIcon\n hidden: boolean\n description?: string\n builtinSuspense?: boolean\n unstable_migration?: {\n replacementType: string\n }\n server?: boolean\n}\n\nexport type State = Map<string, ComponentMeta>\n\nexport function getInitialState({\n componentsMeta = new Map(),\n}: { componentsMeta?: Map<string, ComponentMeta> } = {}): State {\n return componentsMeta\n}\n\nexport function getComponentsMeta(state: State): Map<string, ComponentMeta> {\n return state\n}\n\nexport function getComponentMeta(state: State, type: string): ComponentMeta | null {\n return getComponentsMeta(state).get(type) ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.REGISTER_COMPONENT:\n return new Map(state).set(action.payload.type, action.payload.meta)\n\n case ReadOnlyActionTypes.UNREGISTER_COMPONENT: {\n const nextState = new Map(state)\n\n const deleted = nextState.delete(action.payload.type)\n\n return deleted ? nextState : state\n }\n\n default:\n return state\n }\n}\n"],"mappings":"AAAA,SAA0C,qBAAqB;AAC/D,SAAS,2BAA2B;AAE7B,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACT;AAkBO,SAAS,gBAAgB;AAAA,EAC9B,iBAAiB,oBAAI,IAAI;AAC3B,IAAqD,CAAC,GAAU;AAC9D,SAAO;AACT;AAEO,SAAS,kBAAkB,OAA0C;AAC1E,SAAO;AACT;AAEO,SAAS,iBAAiB,OAAc,MAAoC;AACjF,SAAO,kBAAkB,KAAK,EAAE,IAAI,IAAI,KAAK;AAC/C;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAuC;AAC/F,MAAI,CAAC,cAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,oBAAoB;AACvB,aAAO,IAAI,IAAI,KAAK,EAAE,IAAI,OAAO,QAAQ,MAAM,OAAO,QAAQ,IAAI;AAAA,IAEpE,KAAK,oBAAoB,sBAAsB;AAC7C,YAAM,YAAY,IAAI,IAAI,KAAK;AAE/B,YAAM,UAAU,UAAU,OAAO,OAAO,QAAQ,IAAI;AAEpD,aAAO,UAAU,YAAY;AAAA,IAC/B;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/state/modules/components-meta.ts"],"sourcesContent":["import { InjectableProps } from '../../runtimes/react/server/injectable-props'\nimport { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-action-types'\n\nexport const ComponentIcon = {\n Accordion: 'accordion',\n Audio: 'audio',\n Billing: 'billing',\n Bolt: 'bolt',\n Button: 'button',\n Card: 'card',\n Cards: 'cards',\n Carousel: 'carousel',\n Chats: 'chats',\n Code: 'code',\n Countdown: 'countdown',\n Cube: 'cube',\n Database: 'database',\n Divider: 'divider',\n Form: 'form',\n Gallery: 'gallery',\n Grid: 'grid',\n Help: 'help',\n Image: 'image',\n Layout: 'layout',\n Lock: 'lock',\n Marker: 'marker',\n Navigation: 'navigation',\n Palette: 'palette',\n SocialLinks: 'social-links',\n Star: 'star',\n Table: 'table',\n Tabs: 'tabs',\n Text: 'text',\n Users: 'users',\n Video: 'video',\n} as const\n\nexport type ComponentIcon = (typeof ComponentIcon)[keyof typeof ComponentIcon]\n\nexport type ComponentMeta = {\n label: string\n icon: ComponentIcon\n hidden: boolean\n description?: string\n builtinSuspense?: boolean\n unstable_migration?: {\n replacementType: string\n }\n server?: boolean\n injectedProps?: Record<string, keyof InjectableProps>\n}\n\nexport type State = Map<string, ComponentMeta>\n\nexport function getInitialState({\n componentsMeta = new Map(),\n}: { componentsMeta?: Map<string, ComponentMeta> } = {}): State {\n return componentsMeta\n}\n\nexport function getComponentsMeta(state: State): Map<string, ComponentMeta> {\n return state\n}\n\nexport function getComponentMeta(state: State, type: string): ComponentMeta | null {\n return getComponentsMeta(state).get(type) ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadOnlyActionTypes.REGISTER_COMPONENT:\n return new Map(state).set(action.payload.type, action.payload.meta)\n\n case ReadOnlyActionTypes.UNREGISTER_COMPONENT: {\n const nextState = new Map(state)\n\n const deleted = nextState.delete(action.payload.type)\n\n return deleted ? nextState : state\n }\n\n default:\n return state\n }\n}\n"],"mappings":"AACA,SAA0C,qBAAqB;AAC/D,SAAS,2BAA2B;AAE7B,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACT;AAmBO,SAAS,gBAAgB;AAAA,EAC9B,iBAAiB,oBAAI,IAAI;AAC3B,IAAqD,CAAC,GAAU;AAC9D,SAAO;AACT;AAEO,SAAS,kBAAkB,OAA0C;AAC1E,SAAO;AACT;AAEO,SAAS,iBAAiB,OAAc,MAAoC;AACjF,SAAO,kBAAkB,KAAK,EAAE,IAAI,IAAI,KAAK;AAC/C;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAuC;AAC/F,MAAI,CAAC,cAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,oBAAoB;AACvB,aAAO,IAAI,IAAI,KAAK,EAAE,IAAI,OAAO,QAAQ,MAAM,OAAO,QAAQ,IAAI;AAAA,IAEpE,KAAK,oBAAoB,sBAAsB;AAC7C,YAAM,YAAY,IAAI,IAAI,KAAK;AAE/B,YAAM,UAAU,UAAU,OAAO,OAAO,QAAQ,IAAI;AAEpD,aAAO,UAAU,YAAY;AAAA,IAC/B;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"page-control-prop-rendering.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/tests/controls/page-control-prop-rendering.tsx"],"names":[],"mappings":"AAIA,OAAO,2BAA2B,CAAA;AAGlC,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEjG,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAA;AAsFvE,wBAAsB,4BAA4B,CAAC,CAAC,SAAS,iBAAiB,EAC5E,iBAAiB,EAAE,CAAC,EACpB,EACE,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,YAAiB,EACjB,WAAmB,EACnB,UAAiB,GAClB,EAAE;IACD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC7C,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;IACpD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAChD,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,iBAwGF"}
1
+ {"version":3,"file":"page-control-prop-rendering.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/tests/controls/page-control-prop-rendering.tsx"],"names":[],"mappings":"AAGA,OAAO,2BAA2B,CAAA;AAGlC,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEjG,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAA;AAqEvE,wBAAsB,4BAA4B,CAAC,CAAC,SAAS,iBAAiB,EAC5E,iBAAiB,EAAE,CAAC,EACpB,EACE,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,MAAM,EACN,YAAiB,EACjB,WAAmB,EACnB,UAAiB,GAClB,EAAE;IACD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC7C,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;IACpD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAChD,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,iBAwGF"}
@@ -1,12 +1,24 @@
1
+ import { type Component, type PropsWithoutRef, type ReactNode, type RefAttributes } from 'react';
1
2
  import { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls';
2
3
  import { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors';
3
4
  import { ComponentIcon } from '../../state/modules/components-meta';
4
- import type { ComponentType } from '../../state/read-only-state';
5
+ import { type InjectableProps } from './server/injectable-props';
5
6
  import { RuntimeCore } from './runtime-core';
7
+ type InjectedPropsConfig = Record<string, keyof InjectableProps>;
8
+ type ServerComponentConfig<I extends InjectedPropsConfig> = boolean | {
9
+ unstable_injectedProps: I;
10
+ };
11
+ type InjectedProps<I extends InjectedPropsConfig> = {
12
+ [K in keyof I]: InjectableProps[I[K]];
13
+ };
14
+ type ResolvedProps<P extends Record<string, LegacyDescriptor | UnifiedControlDefinition>> = {
15
+ [K in keyof P]: DescriptorValueType<P[K]>;
16
+ };
17
+ type RegisteredComponentType<P extends Record<string, LegacyDescriptor | UnifiedControlDefinition>, I extends InjectedPropsConfig, T = any> = {
18
+ new (props: PropsWithoutRef<ResolvedProps<P>> & InjectedProps<I> & RefAttributes<T>, context?: any): Component<ResolvedProps<P> & InjectedProps<I>>;
19
+ } | ((props: PropsWithoutRef<ResolvedProps<P>> & InjectedProps<I> & RefAttributes<T>, context?: any) => ReactNode);
6
20
  export declare class ReactRuntimeCore extends RuntimeCore {
7
- registerComponent<ControlDef extends UnifiedControlDefinition, P extends Record<string, LegacyDescriptor | ControlDef>, C extends ComponentType<{
8
- [K in keyof P]: DescriptorValueType<P[K]>;
9
- }>>(component: C, { type, label, icon, hidden, description, builtinSuspense, unstable_migration, server, props, }: {
21
+ registerComponent<ControlDef extends UnifiedControlDefinition, P extends Record<string, LegacyDescriptor | ControlDef>, const I extends InjectedPropsConfig = {}, C extends RegisteredComponentType<P, I> = RegisteredComponentType<P, I>>(component: C, { type, label, icon, hidden, description, builtinSuspense, unstable_migration, server, props, }: {
10
22
  type: string;
11
23
  label: string;
12
24
  icon?: ComponentIcon;
@@ -26,9 +38,10 @@ export declare class ReactRuntimeCore extends RuntimeCore {
26
38
  unstable_migration?: {
27
39
  replacementType: string;
28
40
  };
29
- server?: boolean;
41
+ server?: ServerComponentConfig<I>;
30
42
  props?: P;
31
43
  }): () => void;
32
44
  protected isRSCEnv(): boolean;
33
45
  }
46
+ export {};
34
47
  //# sourceMappingURL=react-runtime-core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-runtime-core.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/react/react-runtime-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAEnF,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AASpG,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAgB5C,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,iBAAiB,CACf,UAAU,SAAS,wBAAwB,EAC3C,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,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UAAU,CAAC,EAEvD,KAAK,CAAC,CAAC,SAAS,mBAAmB,GAAG,EAAE,EACxC,CAAC,SAAS,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,EAEvE,SAAS,EAAE,CAAC,EACZ,EACE,IAAI,EACJ,KAAK,EACL,IAAyB,EACzB,MAAc,EACd,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,MAAc,EACd,KAAK,GACN,EAAE;QACD,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,aAAa,CAAA;QACpB,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB;;;;WAIG;QACH,eAAe,CAAC,EAAE,OAAO,CAAA;QACzB;;;;WAIG;QACH,kBAAkB,CAAC,EAAE;YAAE,eAAe,EAAE,MAAM,CAAA;SAAE,CAAA;QAChD,MAAM,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACjC,KAAK,CAAC,EAAE,CAAC,CAAA;KACV,GACA,MAAM,IAAI;IA0Db,SAAS,CAAC,QAAQ;CAGnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=element.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element.test.d.ts","sourceRoot":"","sources":["../../../../../../../src/runtimes/react/server/components/__tests__/element.test.tsx"],"names":[],"mappings":""}
@@ -1,9 +1,10 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type ElementData } from '../../../../state/read-only-state';
3
3
  import { type ServerRenderContext } from '../render-context';
4
- export declare function ServerElementData({ documentKey, context, elementData, }: {
4
+ export declare function ServerElementData({ documentKey, context, elementData, injectedProps, }: {
5
5
  documentKey: string;
6
6
  context: ServerRenderContext;
7
7
  elementData: ElementData;
8
+ injectedProps: Record<string, unknown>;
8
9
  }): Promise<ReactNode>;
9
10
  //# sourceMappingURL=element-data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"element-data.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/server/components/element-data.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,OAAO,EAEL,KAAK,WAAW,EAIjB,MAAM,mCAAmC,CAAA;AAU1C,OAAO,EAAE,KAAK,mBAAmB,EAAY,MAAM,mBAAmB,CAAA;AAGtE,wBAAsB,iBAAiB,CAAC,EACtC,WAAW,EACX,OAAO,EACP,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,mBAAmB,CAAA;IAC5B,WAAW,EAAE,WAAW,CAAA;CACzB,GAAG,OAAO,CAAC,SAAS,CAAC,CAuCrB"}
1
+ {"version":3,"file":"element-data.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/server/components/element-data.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,OAAO,EAEL,KAAK,WAAW,EAIjB,MAAM,mCAAmC,CAAA;AAU1C,OAAO,EAAE,KAAK,mBAAmB,EAAY,MAAM,mBAAmB,CAAA;AAGtE,wBAAsB,iBAAiB,CAAC,EACtC,WAAW,EACX,OAAO,EACP,WAAW,EACX,aAAa,GACd,EAAE;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,mBAAmB,CAAA;IAC5B,WAAW,EAAE,WAAW,CAAA;IACxB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACvC,GAAG,OAAO,CAAC,SAAS,CAAC,CA0CrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/server/components/element.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAGL,KAAK,OAAO,IAAI,gBAAgB,EACjC,MAAM,mCAAmC,CAAA;AAM1C,OAAO,EAAE,KAAK,mBAAmB,EAAY,MAAM,mBAAmB,CAAA;AAItE,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,WAAW,GACZ,EAAE;IACD,OAAO,EAAE,mBAAmB,CAAA;IAC5B,OAAO,EAAE,gBAAgB,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;CACpB,GAAG,SAAS,CAuBZ"}
1
+ {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/server/components/element.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,EAGL,KAAK,OAAO,IAAI,gBAAgB,EACjC,MAAM,mCAAmC,CAAA;AAM1C,OAAO,EAAE,KAAK,mBAAmB,EAAY,MAAM,mBAAmB,CAAA;AAKtE,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,WAAW,GACZ,EAAE;IACD,OAAO,EAAE,mBAAmB,CAAA;IAC5B,OAAO,EAAE,gBAAgB,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;CACpB,GAAG,SAAS,CAyCZ"}
@@ -0,0 +1,5 @@
1
+ export type InjectableProps = {
2
+ documentKey: string;
3
+ elementKey: string;
4
+ };
5
+ //# sourceMappingURL=injectable-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectable-props.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/server/injectable-props.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA"}
@@ -18,10 +18,11 @@ export type ServerRenderContext = {
18
18
  client: MakeswiftClient;
19
19
  siteVersion: SiteVersion | null;
20
20
  locale: string | undefined;
21
+ store: Store;
21
22
  };
22
23
  export declare const setRenderContext: (context: ServerRenderContext) => void;
23
24
  export declare const getRenderContext: () => ServerRenderContext;
24
- export declare const getStore: ({ runtime, siteVersion, locale }: ServerRenderContext) => Store;
25
+ export declare const getStore: ({ store }: ServerRenderContext) => Store;
25
26
  export declare const RenderContext: ({ context, children, }: PropsWithChildren<{
26
27
  context: ServerRenderContext;
27
28
  }>) => import("react").ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"render-context.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/server/render-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,YAAY,CAAA;IACrB,MAAM,EAAE,eAAe,CAAA;IACvB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAA;AAID,eAAO,MAAM,gBAAgB,GAAI,SAAS,mBAAmB,SAE5D,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAO,mBAInC,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,kCAAkC,mBAAmB,KAAG,KAMhF,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,wBAG3B,iBAAiB,CAAC;IAAE,OAAO,EAAE,mBAAmB,CAAA;CAAE,CAAC,8BAGrD,CAAA"}
1
+ {"version":3,"file":"render-context.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/server/render-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,YAAY,CAAA;IACrB,MAAM,EAAE,eAAe,CAAA;IACvB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAID,eAAO,MAAM,gBAAgB,GAAI,SAAS,mBAAmB,SAE5D,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAO,mBAInC,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,WAAW,mBAAmB,KAAG,KAAc,CAAA;AAExE,eAAO,MAAM,aAAa,GAAI,wBAG3B,iBAAiB,CAAC;IAAE,OAAO,EAAE,mBAAmB,CAAA;CAAE,CAAC,8BAGrD,CAAA"}
@@ -1,15 +1,16 @@
1
- import { type BreakpointsInput } from '../../../state/modules/breakpoints';
2
1
  import { ReactRuntime } from '../react-runtime';
3
2
  type RuntimeEnv = 'client' | 'ssr' | 'rsc';
3
+ type RuntimeArgs = ConstructorParameters<typeof ReactRuntime>[0];
4
4
  declare class TestReactRuntime extends ReactRuntime {
5
5
  readonly env: RuntimeEnv;
6
- constructor({ env, ...args }: ConstructorParameters<typeof ReactRuntime>[0] & {
6
+ constructor({ env, ...args }: RuntimeArgs & {
7
7
  env?: RuntimeEnv;
8
8
  });
9
9
  protected isRSCEnv(): boolean;
10
10
  }
11
- export declare function createReactRuntime({ breakpoints, env, }?: {
12
- breakpoints?: BreakpointsInput;
11
+ export declare function createReactRuntime({ breakpoints, requestKey, env, }?: {
12
+ breakpoints?: RuntimeArgs['breakpoints'];
13
+ requestKey?: RuntimeArgs['requestKey'];
13
14
  env?: RuntimeEnv;
14
15
  }): TestReactRuntime;
15
16
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"react-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/testing/react-runtime.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,KAAK,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAA;AAE1C,cAAM,gBAAiB,SAAQ,YAAY;IACzC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAA;gBAEZ,EACV,GAAG,EACH,GAAG,IAAI,EACR,EAAE,qBAAqB,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,UAAU,CAAA;KAAE;IAKvE,SAAS,CAAC,QAAQ;CAGnB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,WAAW,EACX,GAAG,GACJ,GAAE;IAAE,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAAC,GAAG,CAAC,EAAE,UAAU,CAAA;CAAO,oBAS3D"}
1
+ {"version":3,"file":"react-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/testing/react-runtime.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,KAAK,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAA;AAC1C,KAAK,WAAW,GAAG,qBAAqB,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;AAEhE,cAAM,gBAAiB,SAAQ,YAAY;IACzC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAA;gBAEZ,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,GAAG;QAAE,GAAG,CAAC,EAAE,UAAU,CAAA;KAAE;IAKhE,SAAS,CAAC,QAAQ;CAGnB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,WAAW,EACX,UAAU,EACV,GAAG,GACJ,GAAE;IACD,WAAW,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAA;IACxC,UAAU,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;IACtC,GAAG,CAAC,EAAE,UAAU,CAAA;CACZ,oBAUL"}
@@ -0,0 +1,3 @@
1
+ import { type ReactNode } from 'react';
2
+ export declare function renderToString(element: ReactNode): Promise<string>;
3
+ //# sourceMappingURL=render-to-string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-to-string.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/testing/render-to-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAkBtC,wBAAsB,cAAc,CAAC,OAAO,EAAE,SAAS,mBAEtD"}
@@ -1,3 +1,4 @@
1
+ import { InjectableProps } from '../../runtimes/react/server/injectable-props';
1
2
  import { type Action, type UnknownAction } from '../actions';
2
3
  export declare const ComponentIcon: {
3
4
  readonly Accordion: "accordion";
@@ -43,6 +44,7 @@ export type ComponentMeta = {
43
44
  replacementType: string;
44
45
  };
45
46
  server?: boolean;
47
+ injectedProps?: Record<string, keyof InjectableProps>;
46
48
  };
47
49
  export type State = Map<string, ComponentMeta>;
48
50
  export declare function getInitialState({ componentsMeta, }?: {
@@ -1 +1 @@
1
- {"version":3,"file":"components-meta.d.ts","sourceRoot":"","sources":["../../../../src/state/modules/components-meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAiB,MAAM,YAAY,CAAA;AAG3E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;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MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAA;AAE9E,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,aAAa,CAAA;IACnB,MAAM,EAAE,OAAO,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,kBAAkB,CAAC,EAAE;QACnB,eAAe,EAAE,MAAM,CAAA;KACxB,CAAA;IACD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,eAAe,CAAC,CAAA;CACtD,CAAA;AAED,MAAM,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;AAE9C,wBAAgB,eAAe,CAAC,EAC9B,cAA0B,GAC3B,GAAE;IAAE,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CAAO,GAAG,KAAK,CAE9D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAE1E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAEjF;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,YAAoB,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,KAAK,CAkB/F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makeswift/runtime",
3
- "version": "0.28.10-canary.5",
3
+ "version": "0.28.10-canary.7",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "url": "makeswift/makeswift",