@makeswift/runtime 0.28.8-canary.1 → 0.28.8-canary.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/graphql-api-client.js +1 -1
- package/dist/cjs/api/rest-api-client.js +1 -1
- package/dist/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/client/index.js +1 -1
- package/dist/cjs/components/builtin/Embed/Embed.js +2 -1
- package/dist/cjs/components/builtin/Embed/Embed.js.map +1 -1
- package/dist/cjs/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
- package/dist/cjs/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map +1 -1
- package/dist/cjs/controls/index.js +4 -0
- package/dist/cjs/controls/index.js.map +1 -1
- package/dist/cjs/controls/link.js.map +1 -1
- package/dist/cjs/controls/rich-text/rich-text.js +2 -2
- package/dist/cjs/controls/rich-text/rich-text.js.map +1 -1
- package/dist/cjs/controls/rich-text-v2/control.js +2 -2
- package/dist/cjs/controls/rich-text-v2/control.js.map +1 -1
- package/dist/cjs/controls/rich-text-v2/rich-text-v2.js +2 -2
- package/dist/cjs/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/cjs/controls/serialization/base/index.js +1 -0
- package/dist/cjs/controls/serialization/base/index.js.map +1 -1
- package/dist/cjs/next/components/framework-provider/app-router/index.js +0 -2
- package/dist/cjs/next/components/framework-provider/app-router/index.js.map +1 -1
- package/dist/cjs/next/components/framework-provider/index.js +1 -1
- package/dist/cjs/next/components/framework-provider/index.js.map +1 -1
- package/dist/cjs/prop-controllers/instances.js +7 -4
- package/dist/cjs/prop-controllers/instances.js.map +1 -1
- package/dist/cjs/runtimes/react/components/framework-context.js +18 -12
- package/dist/cjs/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/cjs/runtimes/react/components/hooks/use-framework-context.js +1 -5
- package/dist/cjs/runtimes/react/components/hooks/use-framework-context.js.map +1 -1
- package/dist/cjs/runtimes/react/components/resolve-props.js +8 -1
- package/dist/cjs/runtimes/react/components/resolve-props.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js +4 -2
- package/dist/cjs/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/style.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-control-instances.js +39 -0
- package/dist/cjs/runtimes/react/hooks/use-control-instances.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js +11 -28
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-stylesheet-factory.js +3 -3
- package/dist/cjs/runtimes/react/hooks/use-stylesheet-factory.js.map +1 -1
- package/dist/cjs/runtimes/react/react-runtime-core.js +2 -1
- package/dist/cjs/runtimes/react/react-runtime-core.js.map +1 -1
- package/dist/cjs/runtimes/react/stylesheet-factory.js +17 -0
- package/dist/cjs/runtimes/react/stylesheet-factory.js.map +1 -0
- package/dist/cjs/slate/TypographyPlugin/normalizeTypographyUp.js.map +1 -1
- package/dist/cjs/slate/selectors.js.map +1 -1
- package/dist/cjs/slate/utils/toText.js.map +1 -1
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js +4 -3
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js.map +1 -1
- package/dist/cjs/state/modules/components-meta.js.map +1 -1
- package/dist/cjs/state/modules/element-trees.js +48 -20
- package/dist/cjs/state/modules/element-trees.js.map +1 -1
- package/dist/cjs/state/translations/get.js +1 -4
- package/dist/cjs/state/translations/get.js.map +1 -1
- package/dist/cjs/testing/fixtures/index.js +4 -2
- package/dist/cjs/testing/fixtures/index.js.map +1 -1
- package/dist/cjs/{utils/is.js → testing/fixtures/snippet.js} +17 -7
- package/dist/cjs/testing/fixtures/snippet.js.map +1 -0
- package/dist/cjs/translations/index.js.map +1 -1
- package/dist/cjs/unstable-framework-support/index.js +2 -8
- package/dist/cjs/unstable-framework-support/index.js.map +1 -1
- package/dist/cjs/utils/intersection.js.map +1 -1
- package/dist/esm/api/graphql-api-client.js +1 -1
- package/dist/esm/api/rest-api-client.js +1 -1
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/components/builtin/Embed/Embed.js +3 -2
- package/dist/esm/components/builtin/Embed/Embed.js.map +1 -1
- package/dist/esm/components/builtin/Navigation/components/DropDownButton/index.js +5 -1
- package/dist/esm/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
- package/dist/esm/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js +5 -1
- package/dist/esm/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map +1 -1
- package/dist/esm/controls/index.js +4 -0
- package/dist/esm/controls/index.js.map +1 -1
- package/dist/esm/controls/link.js.map +1 -1
- package/dist/esm/controls/rich-text/rich-text.js +2 -2
- package/dist/esm/controls/rich-text/rich-text.js.map +1 -1
- package/dist/esm/controls/rich-text-v2/control.js +2 -2
- package/dist/esm/controls/rich-text-v2/control.js.map +1 -1
- package/dist/esm/controls/rich-text-v2/rich-text-v2.js +2 -2
- package/dist/esm/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/esm/controls/serialization/base/index.js +2 -0
- package/dist/esm/controls/serialization/base/index.js.map +1 -1
- package/dist/esm/next/components/framework-provider/app-router/index.js +0 -4
- package/dist/esm/next/components/framework-provider/app-router/index.js.map +1 -1
- package/dist/esm/next/components/framework-provider/index.js +4 -2
- package/dist/esm/next/components/framework-provider/index.js.map +1 -1
- package/dist/esm/prop-controllers/instances.js +7 -4
- package/dist/esm/prop-controllers/instances.js.map +1 -1
- package/dist/esm/runtimes/react/components/framework-context.js +19 -8
- package/dist/esm/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/esm/runtimes/react/components/hooks/use-framework-context.js +1 -5
- package/dist/esm/runtimes/react/components/hooks/use-framework-context.js.map +1 -1
- package/dist/esm/runtimes/react/components/resolve-props.js +8 -1
- package/dist/esm/runtimes/react/components/resolve-props.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js +4 -2
- package/dist/esm/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js.map +1 -1
- package/dist/esm/runtimes/react/controls/style.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-control-instances.js +15 -0
- package/dist/esm/runtimes/react/hooks/use-control-instances.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js +10 -17
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-stylesheet-factory.js +3 -3
- package/dist/esm/runtimes/react/hooks/use-stylesheet-factory.js.map +1 -1
- package/dist/esm/runtimes/react/react-runtime-core.js +2 -1
- package/dist/esm/runtimes/react/react-runtime-core.js.map +1 -1
- package/dist/esm/runtimes/react/stylesheet-factory.js +1 -0
- package/dist/esm/runtimes/react/stylesheet-factory.js.map +1 -0
- package/dist/esm/slate/TypographyPlugin/normalizeTypographyUp.js.map +1 -1
- package/dist/esm/slate/selectors.js.map +1 -1
- package/dist/esm/slate/utils/toText.js.map +1 -1
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js +4 -3
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js.map +1 -1
- package/dist/esm/state/modules/components-meta.js.map +1 -1
- package/dist/esm/state/modules/element-trees.js +48 -20
- package/dist/esm/state/modules/element-trees.js.map +1 -1
- package/dist/esm/state/translations/get.js +1 -4
- package/dist/esm/state/translations/get.js.map +1 -1
- package/dist/esm/testing/fixtures/index.js +2 -1
- package/dist/esm/testing/fixtures/index.js.map +1 -1
- package/dist/esm/testing/fixtures/snippet.js +12 -0
- package/dist/esm/testing/fixtures/snippet.js.map +1 -0
- package/dist/esm/translations/index.js.map +1 -1
- package/dist/esm/unstable-framework-support/index.js +2 -8
- package/dist/esm/unstable-framework-support/index.js.map +1 -1
- package/dist/esm/utils/intersection.js.map +1 -1
- package/dist/types/components/builtin/Embed/Embed.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts.map +1 -1
- package/dist/types/components/shared/BackgroundsContainer/components/BackgroundVideo/index.d.ts.map +1 -1
- package/dist/types/controls/index.d.ts +1 -1
- package/dist/types/controls/index.d.ts.map +1 -1
- package/dist/types/controls/rich-text/rich-text.d.ts +2 -2
- package/dist/types/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/controls/rich-text-v2/control.d.ts +2 -2
- package/dist/types/controls/rich-text-v2/control.d.ts.map +1 -1
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts +2 -2
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/controls/serialization/base/index.d.ts.map +1 -1
- package/dist/types/next/components/framework-provider/app-router/index.d.ts +1 -1
- package/dist/types/next/components/framework-provider/app-router/index.d.ts.map +1 -1
- package/dist/types/next/components/framework-provider/index.d.ts.map +1 -1
- package/dist/types/prop-controllers/instances.d.ts +4 -2
- package/dist/types/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/__tests__/framework-context.test.d.ts +3 -0
- package/dist/types/runtimes/react/components/__tests__/framework-context.test.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/framework-context.d.ts +4 -6
- package/dist/types/runtimes/react/components/framework-context.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/hooks/use-framework-context.d.ts +1 -2
- package/dist/types/runtimes/react/components/hooks/use-framework-context.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/resolve-props.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-control-instances.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-control-instances.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts +7 -1
- package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-stylesheet-factory.d.ts +1 -5
- package/dist/types/runtimes/react/hooks/use-stylesheet-factory.d.ts.map +1 -1
- package/dist/types/runtimes/react/react-runtime-core.d.ts +9 -1
- package/dist/types/runtimes/react/react-runtime-core.d.ts.map +1 -1
- package/dist/types/runtimes/react/stylesheet-factory.d.ts +6 -0
- package/dist/types/runtimes/react/stylesheet-factory.d.ts.map +1 -0
- package/dist/types/slate/LinkPlugin/getValue.d.ts.map +1 -1
- package/dist/types/slate/LinkPlugin/index.d.ts.map +1 -1
- package/dist/types/slate/TypographyPlugin/getValue.d.ts.map +1 -1
- package/dist/types/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/slate/selectors.d.ts +2 -2
- package/dist/types/slate/selectors.d.ts.map +1 -1
- package/dist/types/slate/utils/toText.d.ts.map +1 -1
- package/dist/types/state/__tests__/fixtures/serialized-descriptors-from-builder.d.ts.map +1 -1
- package/dist/types/state/__tests__/fixtures/translatable-content-sample.d.ts.map +1 -1
- package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts.map +1 -1
- package/dist/types/state/modules/__tests__/fixtures/element-trees.d.ts +737 -0
- package/dist/types/state/modules/__tests__/fixtures/element-trees.d.ts.map +1 -1
- package/dist/types/state/modules/components-meta.d.ts +3 -0
- package/dist/types/state/modules/components-meta.d.ts.map +1 -1
- package/dist/types/state/translations/get.d.ts.map +1 -1
- package/dist/types/testing/fixtures/index.d.ts +2 -1
- package/dist/types/testing/fixtures/index.d.ts.map +1 -1
- package/dist/types/testing/fixtures/snippet.d.ts +6 -0
- package/dist/types/testing/fixtures/snippet.d.ts.map +1 -0
- package/dist/types/translations/index.d.ts +1 -1
- package/dist/types/translations/index.d.ts.map +1 -1
- package/dist/types/unstable-framework-support/index.d.ts +1 -1
- package/dist/types/unstable-framework-support/index.d.ts.map +1 -1
- package/dist/types/utils/intersection.d.ts +2 -1
- package/dist/types/utils/intersection.d.ts.map +1 -1
- package/package.json +8 -5
- package/react/builtins/package.json +1 -1
- package/dist/cjs/runtimes/react/controls/group.js +0 -45
- package/dist/cjs/runtimes/react/controls/group.js.map +0 -1
- package/dist/cjs/utils/is.js.map +0 -1
- package/dist/esm/runtimes/react/controls/group.js +0 -23
- package/dist/esm/runtimes/react/controls/group.js.map +0 -1
- package/dist/esm/utils/is.js +0 -6
- package/dist/esm/utils/is.js.map +0 -1
- package/dist/types/runtimes/react/controls/group.d.ts +0 -11
- package/dist/types/runtimes/react/controls/group.d.ts.map +0 -1
- package/dist/types/utils/is.d.ts +0 -3
- package/dist/types/utils/is.d.ts.map +0 -1
|
@@ -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.28.8-canary.
|
|
30
|
+
"makeswift-runtime-version": "0.28.8-canary.10"
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
async createTableRecord(tableId, columns) {
|
|
@@ -147,7 +147,7 @@ class MakeswiftRestAPIClient {
|
|
|
147
147
|
const requestHeaders = new Headers({
|
|
148
148
|
"x-api-key": this.apiKey,
|
|
149
149
|
"makeswift-site-api-key": this.apiKey,
|
|
150
|
-
"makeswift-runtime-version": "0.28.8-canary.
|
|
150
|
+
"makeswift-runtime-version": "0.28.8-canary.10"
|
|
151
151
|
});
|
|
152
152
|
if (siteVersion?.token) {
|
|
153
153
|
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.28.8-canary.
|
|
31
|
+
version: "0.28.8-canary.10",
|
|
32
32
|
interactionMode: true,
|
|
33
33
|
clientSideNavigation: false,
|
|
34
34
|
elementFromPoint: false,
|
package/dist/cjs/client/index.js
CHANGED
|
@@ -689,7 +689,7 @@ Received "${apiKey}" instead.`
|
|
|
689
689
|
headers: {
|
|
690
690
|
"x-api-key": this.apiKey,
|
|
691
691
|
"makeswift-site-api-key": this.apiKey,
|
|
692
|
-
"makeswift-runtime-version": "0.28.8-canary.
|
|
692
|
+
"makeswift-runtime-version": "0.28.8-canary.10",
|
|
693
693
|
"content-type": "application/json"
|
|
694
694
|
},
|
|
695
695
|
body: JSON.stringify({ token }),
|
|
@@ -94,6 +94,7 @@ const Embed = (0, import_react.forwardRef)(function Embed2({ id, width, margin,
|
|
|
94
94
|
});
|
|
95
95
|
}, [container, html]);
|
|
96
96
|
const className = (0, import_use_style.useStyle)({ minHeight: 15 });
|
|
97
|
+
const dangerouslySetInnerHTML = (0, import_react.useMemo)(() => ({ __html: html }), [html]);
|
|
97
98
|
if (shouldRender === false)
|
|
98
99
|
return null;
|
|
99
100
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -102,7 +103,7 @@ const Embed = (0, import_react.forwardRef)(function Embed2({ id, width, margin,
|
|
|
102
103
|
ref: setContainer,
|
|
103
104
|
id,
|
|
104
105
|
className: (0, import_css.cx)(className, width, margin),
|
|
105
|
-
dangerouslySetInnerHTML
|
|
106
|
+
dangerouslySetInnerHTML
|
|
106
107
|
}
|
|
107
108
|
);
|
|
108
109
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/builtin/Embed/Embed.tsx"],"sourcesContent":["'use client'\n\n/* eslint-env browser */\n\nimport { useState, useEffect, forwardRef, Ref, useImperativeHandle } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { cx } from '@emotion/css'\n\ntype Props = {\n id?: string\n html?: string\n width?: string\n margin?: string\n}\n\nconst defaultHtml = `<div style=\"padding: 24px; background-color: rgba(161, 168, 194, 0.18); overflow: hidden;\">\n<svg width=\"316\" height=\"168\" viewBox=\"0 0 316 168\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"70\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"78\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"116\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"20\" width=\"120\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"128\" y=\"20\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"166\" y=\"20\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"60\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"80\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"100\" width=\"110\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"206\" y=\"100\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"238\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"120\" width=\"50\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"146\" y=\"120\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"178\" y=\"120\" width=\"90\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"276\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"140\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect y=\"160\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n</svg>\n</div>`\nconst SCRIPT_TAG = 'script'\n\nconst Embed = forwardRef(function Embed(\n { id, width, margin, html = defaultHtml }: Props,\n ref: Ref<HTMLDivElement | null>,\n) {\n const [container, setContainer] = useState<HTMLDivElement | null>(null)\n const [shouldRender, setShouldRender] = useState(false)\n\n useIsomorphicLayoutEffect(() => {\n setShouldRender(true)\n }, [])\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(ref, () => container, [\n container,\n ])\n\n useEffect(() => {\n // TODO: When we SSR the editor, we can remove the editor check\n // and not run this effect on the first render.\n if (!container) return\n\n const walker = container.ownerDocument.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Element) {\n return node.tagName.toLowerCase() === SCRIPT_TAG\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_REJECT\n },\n })\n\n const nodes: Element[] = []\n\n while (walker.nextNode()) nodes.push(walker.currentNode as Element)\n\n // By default scripts appended dynamically will execute asyncrhonously. Here we ensure that\n // scripts are loaded synchronously since that's what a user usually expects with scripts in\n // embedded in HTML which usually comes from the server.\n //\n // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#notes\n async function executeScriptsInOrder() {\n for (let i = 0; i < nodes.length; i++) {\n await new Promise<void>(resolve => {\n const node = nodes[i]\n const script = node.ownerDocument.createElement(SCRIPT_TAG)\n\n script.textContent = node.textContent\n Array.from(node.attributes).forEach(({ name, value }) => {\n script.setAttribute(name, value)\n })\n\n script.onload = () => resolve()\n script.onerror = () => resolve()\n\n node.parentNode?.insertBefore(script, node)\n node.parentNode?.removeChild(node)\n\n if (!script.hasAttribute('src')) resolve()\n })\n }\n }\n\n executeScriptsInOrder().catch(error => {\n // Ignore errors from user-provided code\n console.error(error)\n })\n }, [container, html])\n\n const className = useStyle({ minHeight: 15 })\n\n if (shouldRender === false) return null\n\n return (\n <div\n ref={setContainer}\n id={id}\n className={cx(className, width, margin)}\n dangerouslySetInnerHTML={
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/builtin/Embed/Embed.tsx"],"sourcesContent":["'use client'\n\n/* eslint-env browser */\n\nimport { useState, useEffect, useMemo, forwardRef, Ref, useImperativeHandle } from 'react'\n\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { cx } from '@emotion/css'\n\ntype Props = {\n id?: string\n html?: string\n width?: string\n margin?: string\n}\n\nconst defaultHtml = `<div style=\"padding: 24px; background-color: rgba(161, 168, 194, 0.18); overflow: hidden;\">\n<svg width=\"316\" height=\"168\" viewBox=\"0 0 316 168\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"70\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"78\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"116\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"20\" width=\"120\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"128\" y=\"20\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"166\" y=\"20\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"60\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"80\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"100\" width=\"110\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"206\" y=\"100\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"238\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"120\" width=\"50\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"146\" y=\"120\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"178\" y=\"120\" width=\"90\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"276\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"140\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect y=\"160\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n</svg>\n</div>`\nconst SCRIPT_TAG = 'script'\n\nconst Embed = forwardRef(function Embed(\n { id, width, margin, html = defaultHtml }: Props,\n ref: Ref<HTMLDivElement | null>,\n) {\n const [container, setContainer] = useState<HTMLDivElement | null>(null)\n const [shouldRender, setShouldRender] = useState(false)\n\n useIsomorphicLayoutEffect(() => {\n setShouldRender(true)\n }, [])\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(ref, () => container, [\n container,\n ])\n\n useEffect(() => {\n // TODO: When we SSR the editor, we can remove the editor check\n // and not run this effect on the first render.\n if (!container) return\n\n const walker = container.ownerDocument.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Element) {\n return node.tagName.toLowerCase() === SCRIPT_TAG\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_REJECT\n },\n })\n\n const nodes: Element[] = []\n\n while (walker.nextNode()) nodes.push(walker.currentNode as Element)\n\n // By default scripts appended dynamically will execute asyncrhonously. Here we ensure that\n // scripts are loaded synchronously since that's what a user usually expects with scripts in\n // embedded in HTML which usually comes from the server.\n //\n // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#notes\n async function executeScriptsInOrder() {\n for (let i = 0; i < nodes.length; i++) {\n await new Promise<void>(resolve => {\n const node = nodes[i]\n const script = node.ownerDocument.createElement(SCRIPT_TAG)\n\n script.textContent = node.textContent\n Array.from(node.attributes).forEach(({ name, value }) => {\n script.setAttribute(name, value)\n })\n\n script.onload = () => resolve()\n script.onerror = () => resolve()\n\n node.parentNode?.insertBefore(script, node)\n node.parentNode?.removeChild(node)\n\n if (!script.hasAttribute('src')) resolve()\n })\n }\n }\n\n executeScriptsInOrder().catch(error => {\n // Ignore errors from user-provided code\n console.error(error)\n })\n }, [container, html])\n\n const className = useStyle({ minHeight: 15 })\n\n // React 19+ resets `innerHTML` whenever the `dangerouslySetInnerHTML`\n // object's identity changes, even if `__html` is the same string. Memoize\n // the object so unrelated re-renders don't wipe out DOM produced by the\n // executed scripts above. See https://github.com/facebook/react/issues/31660\n // and https://github.com/react/react/issues/31600\n const dangerouslySetInnerHTML = useMemo(() => ({ __html: html }), [html])\n\n if (shouldRender === false) return null\n\n return (\n <div\n ref={setContainer}\n id={id}\n className={cx(className, width, margin)}\n dangerouslySetInnerHTML={dangerouslySetInnerHTML}\n />\n )\n})\n\nexport default Embed\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuHI;AAnHJ,mBAAmF;AAEnF,uCAA0C;AAC1C,uBAAyB;AACzB,iBAAmB;AASnB,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBpB,MAAM,aAAa;AAEnB,MAAM,YAAQ,yBAAW,SAASA,OAChC,EAAE,IAAI,OAAO,QAAQ,OAAO,YAAY,GACxC,KACA;AACA,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAgC,IAAI;AACtE,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAS,KAAK;AAEtD,kEAA0B,MAAM;AAC9B,oBAAgB,IAAI;AAAA,EACtB,GAAG,CAAC,CAAC;AAEL,wCAAkE,KAAK,MAAM,WAAW;AAAA,IACtF;AAAA,EACF,CAAC;AAED,8BAAU,MAAM;AAGd,QAAI,CAAC;AAAW;AAEhB,UAAM,SAAS,UAAU,cAAc,iBAAiB,WAAW,WAAW,cAAc;AAAA,MAC1F,WAAW,MAAe;AACxB,eAAO,KAAK,QAAQ,YAAY,MAAM,aAClC,WAAW,gBACX,WAAW;AAAA,MACjB;AAAA,IACF,CAAC;AAED,UAAM,QAAmB,CAAC;AAE1B,WAAO,OAAO,SAAS;AAAG,YAAM,KAAK,OAAO,WAAsB;AAOlE,mBAAe,wBAAwB;AACrC,eAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,cAAM,IAAI,QAAc,aAAW;AACjC,gBAAM,OAAO,MAAM,CAAC;AACpB,gBAAM,SAAS,KAAK,cAAc,cAAc,UAAU;AAE1D,iBAAO,cAAc,KAAK;AAC1B,gBAAM,KAAK,KAAK,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,MAAM,MAAM;AACvD,mBAAO,aAAa,MAAM,KAAK;AAAA,UACjC,CAAC;AAED,iBAAO,SAAS,MAAM,QAAQ;AAC9B,iBAAO,UAAU,MAAM,QAAQ;AAE/B,eAAK,YAAY,aAAa,QAAQ,IAAI;AAC1C,eAAK,YAAY,YAAY,IAAI;AAEjC,cAAI,CAAC,OAAO,aAAa,KAAK;AAAG,oBAAQ;AAAA,QAC3C,CAAC;AAAA,MACH;AAAA,IACF;AAEA,0BAAsB,EAAE,MAAM,WAAS;AAErC,cAAQ,MAAM,KAAK;AAAA,IACrB,CAAC;AAAA,EACH,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,QAAM,gBAAY,2BAAS,EAAE,WAAW,GAAG,CAAC;AAO5C,QAAM,8BAA0B,sBAAQ,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC,IAAI,CAAC;AAExE,MAAI,iBAAiB;AAAO,WAAO;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,eAAW,eAAG,WAAW,OAAO,MAAM;AAAA,MACtC;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,IAAO,gBAAQ;","names":["Embed"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/components/builtin/Navigation/components/DropDownButton/index.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ForwardedRef, forwardRef, useRef, useState, ReactNode } from 'react'\n\nimport { CaretDown8 } from '../../../../icons/CaretDown8'\nimport { Plus8 } from '../../../../icons/Plus8'\nimport { ArrowDown8 } from '../../../../icons/ArrowDown8'\nimport { ChevronDown8 } from '../../../../icons/ChevronDown8'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { useResponsiveColor } from '../../../../hooks'\n\nimport { Link } from '../../../../shared/Link'\nimport Button from '../../../Button'\nimport { useIsomorphicLayoutEffect } from '../../../../hooks/useIsomorphicLayoutEffect'\nimport { cx, keyframes } from '@emotion/css'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../../../utils/responsive-style'\nimport { LinkData, ResponsiveColorData, ResponsiveTextStyleData } from '@makeswift/prop-controllers'\n\nconst DROP_DOWN_MENU_WIDTH = 200\n\ntype Position = 'left' | 'right'\n\nconst DROP_DOWN_MENU_CLASS_NAME = 'drop-down-menu'\n\ntype DropDownMenuBaseProps = {\n position: Position\n}\n\ntype DropDownMenuProps = DropDownMenuBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof DropDownMenuBaseProps>\n\nfunction DropDownMenu({ className, position, ...restOfProps }: DropDownMenuProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n DROP_DOWN_MENU_CLASS_NAME,\n useStyle({\n position: 'absolute',\n top: '100%',\n left: position === 'left' ? 0 : 'auto',\n right: position === 'right' ? 0 : 'auto',\n background: '#fff',\n margin: 0,\n padding: '8px 0',\n borderRadius: 4,\n boxShadow: '0 3px 10px rgba(0, 0, 0, 0.15)',\n width: DROP_DOWN_MENU_WIDTH,\n zIndex: 99,\n listStyle: 'none',\n overflow: 'hidden',\n transformOrigin: '50% 0',\n willChange: 'transform, opacity',\n transformStyle: 'preserve-3d',\n display: 'none',\n }),\n className,\n )}\n />\n )\n}\n\nconst dropIn = keyframes`\n 0% {\n opacity: 0;\n transform: rotateX(-20deg);\n }\n 100% {\n opacity: 1;\n transform: none;\n }\n`\n\ntype DropDownContainerProps = ComponentPropsWithoutRef<'div'>\n\nconst DropDownContainer = forwardRef(function DropDownContainer(\n { className, ...restOfProps }: DropDownContainerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({\n position: 'relative',\n [`&:hover .${DROP_DOWN_MENU_CLASS_NAME}`]: {\n display: 'block',\n animation: `${dropIn} 0.25s`,\n },\n }),\n className,\n )}\n />\n )\n})\n\ntype BaseDropDownItemProps = {\n className?: string\n color?: ResponsiveColorData\n textStyle?: ResponsiveTextStyleData\n}\n\ntype DropDownItemProps = BaseDropDownItemProps &\n Omit<ComponentPropsWithoutRef<typeof Link>, keyof BaseDropDownItemProps>\n\nfunction DropDownItem({ className, color, textStyle, ...restOfProps }: DropDownItemProps) {\n const colorData = useResponsiveColor(color)\n\n return (\n <Link\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'block',\n textDecoration: 'none',\n lineHeight: 1.4,\n padding: '8px 16px',\n color: 'black',\n backgroundColor: 'transparent',\n transition: 'background-color 0.2s',\n }),\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([colorData, textStyle] as const, ([color, textStyle = {}]) => {\n const fontSize = textStyle.fontSize || { value: 14, unit: 'px' }\n const fontWeight = textStyle.fontWeight == null ? 'normal' : textStyle.fontWeight\n const fontStyle = textStyle.fontStyle || []\n const letterSpacing = textStyle.letterSpacing == null ? null : textStyle.letterSpacing\n const textTransform = textStyle.textTransform || []\n\n return {\n color: color == null ? 'black' : colorToString(color),\n fontSize: `${fontSize.value}${fontSize.unit}`,\n fontWeight,\n fontStyle: fontStyle.includes('italic') ? 'italic' : 'normal',\n letterSpacing: letterSpacing == null ? 'normal' : `${letterSpacing}px`,\n textTransform: textTransform.includes('uppercase') ? 'uppercase' : 'none',\n }\n }),\n ),\n useStyle({\n '&:hover': {\n backgroundColor: 'rgba(0, 0, 0, 0.04)',\n },\n }),\n className,\n )}\n />\n )\n}\n\ntype Props = Omit<ComponentPropsWithoutRef<typeof Button>, 'textColor' | 'color'> & {\n label: string\n caret?: 'caret' | 'plus' | 'arrow-down' | 'chevron-down'\n links?: Array<{\n id: string\n payload: ComponentPropsWithoutRef<typeof DropDownItem> & {\n link?: LinkData\n label: string\n }\n }>\n textColor?: ResponsiveColorData\n color?: ResponsiveColorData\n}\n\nexport default function DropDownButton({\n label,\n caret = 'caret',\n links = [],\n textColor,\n color,\n ...restOfProps\n}: Props): ReactNode {\n const container = useRef<HTMLDivElement>(null)\n const [position, setPosition] = useState<Position>('left')\n\n useIsomorphicLayoutEffect(() => {\n if (\n container.current &&\n container.current.ownerDocument.defaultView!.innerWidth <\n container.current.offsetLeft + DROP_DOWN_MENU_WIDTH\n ) {\n setPosition('right')\n } else {\n setPosition('left')\n }\n }, [setPosition])\n\n return (\n <DropDownContainer ref={container}>\n <Button\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n >\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <span style={{ marginRight: 6 }}>{label}</span>\n <span style={{ display: 'inline-flex', fill: 'currentColor' }}>\n {caret === 'caret' && <CaretDown8 />}\n {caret === 'plus' && <Plus8 />}\n {caret === 'arrow-down' && <ArrowDown8 />}\n {caret === 'chevron-down' && <ChevronDown8 />}\n </span>\n </div>\n </Button>\n <DropDownMenu position={position}>\n {links.map(({ id, payload }) => (\n <DropDownItem {...payload} key={id}>\n {payload.label}\n </DropDownItem>\n ))}\n </DropDownMenu>\n </DropDownContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCI;AA+KM;AA/MV,IAAAA,gBAAgG;AAEhG,wBAA2B;AAC3B,mBAAsB;AACtB,wBAA2B;AAC3B,0BAA6B;AAC7B,2BAA8B;AAC9B,mBAAmC;AAEnC,kBAAqB;AACrB,oBAAmB;AACnB,uCAA0C;AAC1C,iBAA8B;AAC9B,uBAAyB;AACzB,8BAA2D;AAG3D,MAAM,uBAAuB;AAI7B,MAAM,4BAA4B;AASlC,SAAS,aAAa,EAAE,WAAW,UAAU,GAAG,YAAY,GAAsB;AAChF,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AA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CAAC,qBAAkB,KAAK,WACtB;AAAA;AAAA,MAAC,cAAAE;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,eAAW,iCAAmB,SAAS;AAAA,QACvC,WAAO,iCAAmB,KAAK;AAAA,QAE/B,uDAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,YAAY,SAAS,GAClD;AAAA,sDAAC,UAAK,OAAO,EAAE,aAAa,EAAE,GAAI,iBAAM;AAAA,UACxC,6CAAC,UAAK,OAAO,EAAE,SAAS,eAAe,MAAM,eAAe,GACzD;AAAA,sBAAU,WAAW,4CAAC,gCAAW;AAAA,YACjC,UAAU,UAAU,4CAAC,sBAAM;AAAA,YAC3B,UAAU,gBAAgB,4CAAC,gCAAW;AAAA,YACtC,UAAU,kBAAkB,4CAAC,oCAAa;AAAA,aAC7C;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IACA,4CAAC,gBAAa,UACX,gBAAM,IAAI,CAAC,EAAE,IAAI,QAAQ,MACxB,gDAAC,gBAAc,GAAG,SAAS,KAAK,MAC7B,QAAQ,KACX,CACD,GACH;AAAA,KACF;AAEJ;","names":["import_react","DropDownContainer","color","textStyle","Button"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/builtin/Navigation/components/DropDownButton/index.tsx"],"sourcesContent":["import {\n ComponentPropsWithoutRef,\n ForwardedRef,\n forwardRef,\n useRef,\n useState,\n ReactNode,\n} from 'react'\n\nimport { CaretDown8 } from '../../../../icons/CaretDown8'\nimport { Plus8 } from '../../../../icons/Plus8'\nimport { ArrowDown8 } from '../../../../icons/ArrowDown8'\nimport { ChevronDown8 } from '../../../../icons/ChevronDown8'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { useResponsiveColor } from '../../../../hooks'\n\nimport { Link } from '../../../../shared/Link'\nimport Button from '../../../Button'\nimport { useIsomorphicLayoutEffect } from '../../../../hooks/useIsomorphicLayoutEffect'\nimport { cx, keyframes } from '@emotion/css'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { useResponsiveStyle, useResponsiveTextStyle } from '../../../../utils/responsive-style'\nimport { LinkData, ResponsiveColorData, ResponsiveTextStyleData } from '@makeswift/prop-controllers'\n\nconst DROP_DOWN_MENU_WIDTH = 200\n\ntype Position = 'left' | 'right'\n\nconst DROP_DOWN_MENU_CLASS_NAME = 'drop-down-menu'\n\ntype DropDownMenuBaseProps = {\n position: Position\n}\n\ntype DropDownMenuProps = DropDownMenuBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof DropDownMenuBaseProps>\n\nfunction DropDownMenu({ className, position, ...restOfProps }: DropDownMenuProps) {\n return (\n <div\n {...restOfProps}\n className={cx(\n DROP_DOWN_MENU_CLASS_NAME,\n useStyle({\n position: 'absolute',\n top: '100%',\n left: position === 'left' ? 0 : 'auto',\n right: position === 'right' ? 0 : 'auto',\n background: '#fff',\n margin: 0,\n padding: '8px 0',\n borderRadius: 4,\n boxShadow: '0 3px 10px rgba(0, 0, 0, 0.15)',\n width: DROP_DOWN_MENU_WIDTH,\n zIndex: 99,\n listStyle: 'none',\n overflow: 'hidden',\n transformOrigin: '50% 0',\n willChange: 'transform, opacity',\n transformStyle: 'preserve-3d',\n display: 'none',\n }),\n className,\n )}\n />\n )\n}\n\nconst dropIn = keyframes`\n 0% {\n opacity: 0;\n transform: rotateX(-20deg);\n }\n 100% {\n opacity: 1;\n transform: none;\n }\n`\n\ntype DropDownContainerProps = ComponentPropsWithoutRef<'div'>\n\nconst DropDownContainer = forwardRef(function DropDownContainer(\n { className, ...restOfProps }: DropDownContainerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({\n position: 'relative',\n [`&:hover .${DROP_DOWN_MENU_CLASS_NAME}`]: {\n display: 'block',\n animation: `${dropIn} 0.25s`,\n },\n }),\n className,\n )}\n />\n )\n})\n\ntype BaseDropDownItemProps = {\n className?: string\n color?: ResponsiveColorData\n textStyle?: ResponsiveTextStyleData\n}\n\ntype DropDownItemProps = BaseDropDownItemProps &\n Omit<ComponentPropsWithoutRef<typeof Link>, keyof BaseDropDownItemProps>\n\nfunction DropDownItem({ className, color, textStyle, ...restOfProps }: DropDownItemProps) {\n const colorData = useResponsiveColor(color)\n\n return (\n <Link\n {...restOfProps}\n className={cx(\n useStyle({\n display: 'block',\n textDecoration: 'none',\n lineHeight: 1.4,\n padding: '8px 16px',\n color: 'black',\n backgroundColor: 'transparent',\n transition: 'background-color 0.2s',\n }),\n useStyle(useResponsiveTextStyle(textStyle)),\n useStyle(\n useResponsiveStyle([colorData, textStyle] as const, ([color, textStyle = {}]) => {\n const fontSize = textStyle.fontSize || { value: 14, unit: 'px' }\n const fontWeight = textStyle.fontWeight == null ? 'normal' : textStyle.fontWeight\n const fontStyle = textStyle.fontStyle || []\n const letterSpacing = textStyle.letterSpacing == null ? null : textStyle.letterSpacing\n const textTransform = textStyle.textTransform || []\n\n return {\n color: color == null ? 'black' : colorToString(color),\n fontSize: `${fontSize.value}${fontSize.unit}`,\n fontWeight,\n fontStyle: fontStyle.includes('italic') ? 'italic' : 'normal',\n letterSpacing: letterSpacing == null ? 'normal' : `${letterSpacing}px`,\n textTransform: textTransform.includes('uppercase') ? 'uppercase' : 'none',\n }\n }),\n ),\n useStyle({\n '&:hover': {\n backgroundColor: 'rgba(0, 0, 0, 0.04)',\n },\n }),\n className,\n )}\n />\n )\n}\n\ntype Props = Omit<ComponentPropsWithoutRef<typeof Button>, 'textColor' | 'color'> & {\n label: string\n caret?: 'caret' | 'plus' | 'arrow-down' | 'chevron-down'\n links?: Array<{\n id: string\n payload: ComponentPropsWithoutRef<typeof DropDownItem> & {\n link?: LinkData\n label: string\n }\n }>\n textColor?: ResponsiveColorData\n color?: ResponsiveColorData\n}\n\nexport default function DropDownButton({\n label,\n caret = 'caret',\n links = [],\n textColor,\n color,\n ...restOfProps\n}: Props): ReactNode {\n const container = useRef<HTMLDivElement>(null)\n const [position, setPosition] = useState<Position>('left')\n\n useIsomorphicLayoutEffect(() => {\n if (\n container.current &&\n container.current.ownerDocument.defaultView!.innerWidth <\n container.current.offsetLeft + DROP_DOWN_MENU_WIDTH\n ) {\n setPosition('right')\n } else {\n setPosition('left')\n }\n }, [setPosition])\n\n return (\n <DropDownContainer ref={container}>\n <Button\n {...restOfProps}\n textColor={useResponsiveColor(textColor)}\n color={useResponsiveColor(color)}\n >\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <span style={{ marginRight: 6 }}>{label}</span>\n <span style={{ display: 'inline-flex', fill: 'currentColor' }}>\n {caret === 'caret' && <CaretDown8 />}\n {caret === 'plus' && <Plus8 />}\n {caret === 'arrow-down' && <ArrowDown8 />}\n {caret === 'chevron-down' && <ChevronDown8 />}\n </span>\n </div>\n </Button>\n <DropDownMenu position={position}>\n {links.map(({ id, payload }) => (\n <DropDownItem {...payload} key={id}>\n {payload.label}\n </DropDownItem>\n ))}\n </DropDownMenu>\n </DropDownContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuCI;AA+KM;AAtNV,IAAAA,gBAOO;AAEP,wBAA2B;AAC3B,mBAAsB;AACtB,wBAA2B;AAC3B,0BAA6B;AAC7B,2BAA8B;AAC9B,mBAAmC;AAEnC,kBAAqB;AACrB,oBAAmB;AACnB,uCAA0C;AAC1C,iBAA8B;AAC9B,uBAAyB;AACzB,8BAA2D;AAG3D,MAAM,uBAAuB;AAI7B,MAAM,4BAA4B;AASlC,SAAS,aAAa,EAAE,WAAW,UAAU,GAAG,YAAY,GAAsB;AAChF,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW;AAAA,QACT;AAAA,YACA,2BAAS;AAAA,UACP,UAAU;AAAA,UACV,KAAK;AAAA,UACL,MAAM,aAAa,SAAS,IAAI;AAAA,UAChC,OAAO,aAAa,UAAU,IAAI;AAAA,UAClC,YAAY;AAAA,UACZ,QAAQ;AAAA,UACR,S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AAY,SAAS,GAClD;AAAA,sDAAC,UAAK,OAAO,EAAE,aAAa,EAAE,GAAI,iBAAM;AAAA,UACxC,6CAAC,UAAK,OAAO,EAAE,SAAS,eAAe,MAAM,eAAe,GACzD;AAAA,sBAAU,WAAW,4CAAC,gCAAW;AAAA,YACjC,UAAU,UAAU,4CAAC,sBAAM;AAAA,YAC3B,UAAU,gBAAgB,4CAAC,gCAAW;AAAA,YACtC,UAAU,kBAAkB,4CAAC,oCAAa;AAAA,aAC7C;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IACA,4CAAC,gBAAa,UACX,gBAAM,IAAI,CAAC,EAAE,IAAI,QAAQ,MACxB,gDAAC,gBAAc,GAAG,SAAS,KAAK,MAC7B,QAAQ,KACX,CACD,GACH;AAAA,KACF;AAEJ;","names":["import_react","DropDownContainer","color","textStyle","Button"]}
|
package/dist/cjs/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/components/shared/BackgroundsContainer/components/BackgroundVideo/index.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/shared/BackgroundsContainer/components/BackgroundVideo/index.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport {\n useState,\n useRef,\n ComponentPropsWithoutRef,\n ForwardedRef,\n forwardRef,\n ReactNode,\n} from 'react'\n\nimport { ReactPlayer } from '../../../react-player'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nimport { useIsomorphicLayoutEffect } from '../../../../hooks/useIsomorphicLayoutEffect'\n\nconst Container = forwardRef(function Container(\n { className, ...restOfProps }: ComponentPropsWithoutRef<'div'>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n return (\n <div\n {...restOfProps}\n ref={ref}\n className={cx(\n useStyle({\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n pointerEvents: 'none',\n overflow: 'hidden',\n }),\n className,\n )}\n />\n )\n})\n\nfunction Mask({\n backgroundColor,\n visible,\n}: {\n backgroundColor: string | undefined\n visible: boolean\n}) {\n return (\n <div\n className={useStyle({\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n background: backgroundColor,\n opacity: visible ? 1 : 0,\n transition: 'opacity 1s',\n })}\n />\n )\n}\n\nconst getScale = (element: HTMLElement, aspectRatio: number, zoom: number) => {\n const { offsetWidth: width, offsetHeight: height } = element\n const computedAspectRatio = width / height\n\n return Math.max(aspectRatio / computedAspectRatio, computedAspectRatio / aspectRatio) * zoom\n}\n\ntype Props = {\n url?: string\n aspectRatio?: number\n zoom?: number\n opacity?: number\n maskColor?: string\n}\n\nexport default function BackgroundVideo({\n url = '',\n aspectRatio = 16 / 9,\n zoom = 1,\n maskColor,\n opacity,\n}: Props): ReactNode {\n const [ready, setReady] = useState(false)\n const [scale, setScale] = useState(1)\n const container = useRef<HTMLDivElement>(null)\n\n useIsomorphicLayoutEffect(() => {\n const { current: containerEl } = container\n\n if (!containerEl) return undefined\n\n const { defaultView } = containerEl.ownerDocument\n const handleResize = () => setScale(getScale(containerEl, aspectRatio, zoom))\n\n handleResize()\n\n defaultView!.addEventListener('resize', handleResize)\n\n return () => defaultView!.removeEventListener('resize', handleResize)\n }, [aspectRatio, zoom])\n\n if (!ReactPlayer.canPlay(url)) return <></>\n\n return (\n <Container ref={container}>\n {container.current && (\n <ReactPlayer\n url={url}\n config={{\n vimeo: { playerOptions: { background: true } },\n youtube: {\n playerVars: {\n origin: container.current.ownerDocument.defaultView?.location.origin,\n },\n },\n wistia: {\n options: {\n endVideoBehavior: 'loop',\n playbackRateControl: false,\n playbar: false,\n playButton: false,\n volumeControl: false,\n fullscreenButton: false,\n muted: true,\n },\n },\n }}\n playing\n loop\n muted\n playsinline={true}\n controls={false}\n onReady={() => setReady(true)}\n style={{\n transform: `scale3d(${scale}, ${scale}, 1)`,\n opacity,\n }}\n width=\"100%\"\n height=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;","names":["Container"]}
|
|
@@ -68,6 +68,8 @@ __export(controls_exports, {
|
|
|
68
68
|
TextAreaDefinition: () => import_controls.TextAreaDefinition,
|
|
69
69
|
TextInput: () => import_controls.TextInput,
|
|
70
70
|
TextInputDefinition: () => import_controls.TextInputDefinition,
|
|
71
|
+
unstable_Gallery: () => import_controls.unstable_Gallery,
|
|
72
|
+
unstable_GalleryDefinition: () => import_controls.unstable_GalleryDefinition,
|
|
71
73
|
unstable_StyleV2: () => import_style_v2.unstable_StyleV2,
|
|
72
74
|
unstable_Typography: () => import_controls.unstable_Typography,
|
|
73
75
|
unstable_TypographyDefinition: () => import_controls.unstable_TypographyDefinition
|
|
@@ -131,6 +133,8 @@ var import_style_v2 = require("./style-v2/style-v2");
|
|
|
131
133
|
TextAreaDefinition,
|
|
132
134
|
TextInput,
|
|
133
135
|
TextInputDefinition,
|
|
136
|
+
unstable_Gallery,
|
|
137
|
+
unstable_GalleryDefinition,
|
|
134
138
|
unstable_StyleV2,
|
|
135
139
|
unstable_Typography,
|
|
136
140
|
unstable_TypographyDefinition,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/controls/index.ts"],"sourcesContent":["export * from './control'\n\nexport {\n ControlDefinition,\n Checkbox,\n CheckboxDefinition,\n Code,\n CodeDefinition,\n Color,\n ColorDefinition,\n Combobox,\n ComboboxDefinition,\n Font,\n FontDefinition,\n Group,\n GroupDefinition,\n GroupControl,\n IconRadioGroup,\n IconRadioGroupDefinition,\n type IconRadioGroupIcon,\n Image,\n ImageDefinition,\n List,\n ListDefinition,\n ListControl,\n Number,\n NumberDefinition,\n Select,\n SelectDefinition,\n Shape,\n ShapeDefinition,\n ShapeControl,\n Slider,\n SliderDefinition,\n Style,\n StyleDefinition,\n type StyleProperty,\n StyleControl,\n TextInput,\n TextInputDefinition,\n TextArea,\n TextAreaDefinition,\n unstable_Typography,\n unstable_TypographyDefinition,\n} from '@makeswift/controls'\n\nexport { Link, LinkDefinition } from './link'\nexport { RichTextV1Definition, RichTextV1Control } from './rich-text'\nexport { RichText, RichTextV2Definition, RichTextV2Control } from './rich-text-v2'\nexport { Slot, SlotDefinition, SlotControl } from './slot'\nexport { unstable_StyleV2, StyleV2Definition, StyleV2Control } from './style-v2/style-v2'\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAc,sBAAd;AAEA,
|
|
1
|
+
{"version":3,"sources":["../../../src/controls/index.ts"],"sourcesContent":["export * from './control'\n\nexport {\n ControlDefinition,\n Checkbox,\n CheckboxDefinition,\n Code,\n CodeDefinition,\n Color,\n ColorDefinition,\n Combobox,\n ComboboxDefinition,\n Font,\n FontDefinition,\n unstable_Gallery,\n unstable_GalleryDefinition,\n type GalleryOption,\n type GalleryPage,\n Group,\n GroupDefinition,\n GroupControl,\n IconRadioGroup,\n IconRadioGroupDefinition,\n type IconRadioGroupIcon,\n Image,\n ImageDefinition,\n List,\n ListDefinition,\n ListControl,\n Number,\n NumberDefinition,\n Select,\n SelectDefinition,\n Shape,\n ShapeDefinition,\n ShapeControl,\n Slider,\n SliderDefinition,\n Style,\n StyleDefinition,\n type StyleProperty,\n StyleControl,\n TextInput,\n TextInputDefinition,\n TextArea,\n TextAreaDefinition,\n unstable_Typography,\n unstable_TypographyDefinition,\n} from '@makeswift/controls'\n\nexport { Link, LinkDefinition } from './link'\nexport { RichTextV1Definition, RichTextV1Control } from './rich-text'\nexport { RichText, RichTextV2Definition, RichTextV2Control } from './rich-text-v2'\nexport { Slot, SlotDefinition, SlotControl } from './slot'\nexport { unstable_StyleV2, StyleV2Definition, StyleV2Control } from './style-v2/style-v2'\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAc,sBAAd;AAEA,sBA8CO;AAEP,kBAAqC;AACrC,uBAAwD;AACxD,0BAAkE;AAClE,kBAAkD;AAClD,sBAAoE;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/controls/link.ts"],"sourcesContent":["import { z } from 'zod'\nimport { type MouseEvent } from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\n\nimport {\n type DeserializedRecord,\n LinkDefinition as BaseLinkDefinition,\n LinkSchema,\n} from '@makeswift/controls'\n\ntype DataType = z.infer<typeof LinkDefinition.schema.data>\ntype ScrollOptions = z.infer<typeof LinkSchema.scrollOptions>\ntype MouseEventType = MouseEvent<Element>\n\nexport function validateElementRef(href: string) {\n try {\n const hash = new URL(`http://www.example.com/${href}`).hash\n return href === hash ? hash : undefined\n } catch (error) {\n return undefined\n }\n}\n\nexport class LinkDefinition extends BaseLinkDefinition<MouseEventType> {\n static deserialize(data: DeserializedRecord): LinkDefinition {\n if (data.type !== LinkDefinition.type) {\n throw new Error(`Link: expected type ${LinkDefinition.type}, got ${data.type}`)\n }\n\n const { config } = LinkDefinition.schema.definition.parse(data)\n return Link(config)\n }\n\n resolveOnClick(\n data: DataType | undefined,\n href: string,\n scrollOptions: ScrollOptions | undefined,\n ) {\n const onClick = (event: MouseEvent<Element>) => {\n if (event.defaultPrevented) return\n\n if (data && data.type === 'SCROLL_TO_ELEMENT') {\n const hash = validateElementRef(href)\n if (hash == null) {\n console.error(`Scroll-to-element link received invalid href: ${href}`)\n return\n }\n\n event.preventDefault()\n const view = event.view as unknown as Window\n\n scrollIntoView(view.document.querySelector(hash)!, {\n behavior: 'smooth',\n block: scrollOptions?.block,\n })\n\n if (view.location.hash !== hash) view.history.pushState({}, '', hash)\n }\n }\n\n onClick.$scrollOptions = scrollOptions\n return onClick\n }\n}\n\nexport function Link(config?: { description?: string
|
|
1
|
+
{"version":3,"sources":["../../../src/controls/link.ts"],"sourcesContent":["import { z } from 'zod'\nimport { type MouseEvent } from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\n\nimport {\n type DeserializedRecord,\n LinkDefinition as BaseLinkDefinition,\n LinkSchema,\n} from '@makeswift/controls'\n\ntype DataType = z.infer<typeof LinkDefinition.schema.data>\ntype ScrollOptions = z.infer<typeof LinkSchema.scrollOptions>\ntype MouseEventType = MouseEvent<Element>\n\nexport function validateElementRef(href: string) {\n try {\n const hash = new URL(`http://www.example.com/${href}`).hash\n return href === hash ? hash : undefined\n } catch (error) {\n return undefined\n }\n}\n\nexport class LinkDefinition extends BaseLinkDefinition<MouseEventType> {\n static deserialize(data: DeserializedRecord): LinkDefinition {\n if (data.type !== LinkDefinition.type) {\n throw new Error(`Link: expected type ${LinkDefinition.type}, got ${data.type}`)\n }\n\n const { config } = LinkDefinition.schema.definition.parse(data)\n return Link(config)\n }\n\n resolveOnClick(\n data: DataType | undefined,\n href: string,\n scrollOptions: ScrollOptions | undefined,\n ) {\n const onClick = (event: MouseEvent<Element>) => {\n if (event.defaultPrevented) return\n\n if (data && data.type === 'SCROLL_TO_ELEMENT') {\n const hash = validateElementRef(href)\n if (hash == null) {\n console.error(`Scroll-to-element link received invalid href: ${href}`)\n return\n }\n\n event.preventDefault()\n const view = event.view as unknown as Window\n\n scrollIntoView(view.document.querySelector(hash)!, {\n behavior: 'smooth',\n block: scrollOptions?.block,\n })\n\n if (view.location.hash !== hash) view.history.pushState({}, '', hash)\n }\n }\n\n onClick.$scrollOptions = scrollOptions\n return onClick\n }\n}\n\nexport function Link(config?: { description?: string; label?: string }): LinkDefinition {\n return new LinkDefinition(config ?? {})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wCAA2B;AAE3B,sBAIO;AAMA,SAAS,mBAAmB,MAAc;AAC/C,MAAI;AACF,UAAM,OAAO,IAAI,IAAI,0BAA0B,IAAI,EAAE,EAAE;AACvD,WAAO,SAAS,OAAO,OAAO;AAAA,EAChC,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAEO,MAAM,uBAAuB,gBAAAA,eAAmC;AAAA,EACrE,OAAO,YAAY,MAA0C;AAC3D,QAAI,KAAK,SAAS,eAAe,MAAM;AACrC,YAAM,IAAI,MAAM,uBAAuB,eAAe,IAAI,SAAS,KAAK,IAAI,EAAE;AAAA,IAChF;AAEA,UAAM,EAAE,OAAO,IAAI,eAAe,OAAO,WAAW,MAAM,IAAI;AAC9D,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAEA,eACE,MACA,MACA,eACA;AACA,UAAM,UAAU,CAAC,UAA+B;AAC9C,UAAI,MAAM;AAAkB;AAE5B,UAAI,QAAQ,KAAK,SAAS,qBAAqB;AAC7C,cAAM,OAAO,mBAAmB,IAAI;AACpC,YAAI,QAAQ,MAAM;AAChB,kBAAQ,MAAM,iDAAiD,IAAI,EAAE;AACrE;AAAA,QACF;AAEA,cAAM,eAAe;AACrB,cAAM,OAAO,MAAM;AAEnB,8CAAAC,SAAe,KAAK,SAAS,cAAc,IAAI,GAAI;AAAA,UACjD,UAAU;AAAA,UACV,OAAO,eAAe;AAAA,QACxB,CAAC;AAED,YAAI,KAAK,SAAS,SAAS;AAAM,eAAK,QAAQ,UAAU,CAAC,GAAG,IAAI,IAAI;AAAA,MACtE;AAAA,IACF;AAEA,YAAQ,iBAAiB;AACzB,WAAO;AAAA,EACT;AACF;AAEO,SAAS,KAAK,QAAmE;AACtF,SAAO,IAAI,eAAe,UAAU,CAAC,CAAC;AACxC;","names":["BaseLinkDefinition","scrollIntoView"]}
|
|
@@ -46,8 +46,8 @@ class Definition extends BaseDefinition {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
createInstance(
|
|
50
|
-
return new import_control.RichTextControl(
|
|
49
|
+
createInstance(args) {
|
|
50
|
+
return new import_control.RichTextControl(args);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/controls/rich-text/rich-text.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport {\n RichTextV1Definition,\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/controls/rich-text/rich-text.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport {\n RichTextV1Definition,\n StableValue,\n type DeserializedRecord,\n type ControlInstanceArgs,\n type ResourceResolver,\n type Stylesheet,\n type Resolvable,\n type DataType,\n} from '@makeswift/controls'\n\nimport { renderRichText } from '../../runtimes/react/controls/rich-text'\n\nimport { RichTextControl } from './control'\n\nabstract class BaseDefinition extends RichTextV1Definition<ReactNode, RichTextControl> {}\n\nclass Definition extends BaseDefinition {\n static deserialize(data: DeserializedRecord): Definition {\n if (data.type !== Definition.type) {\n throw new Error(`RichTextV1: expected type ${Definition.type}, got ${data.type}`)\n }\n\n return new (class RichTextV1 extends Definition {})()\n }\n\n resolveValue(\n data: DataType<BaseDefinition> | undefined,\n _resolver: ResourceResolver,\n _stylesheet: Stylesheet,\n control?: RichTextControl,\n ): Resolvable<ReactNode | undefined> {\n const stableValue = StableValue({\n name: Definition.type,\n read: () => renderRichText(data, control ?? null),\n })\n\n return {\n ...stableValue,\n triggerResolve: async () => {},\n }\n }\n\n createInstance(args: ControlInstanceArgs) {\n return new RichTextControl(args)\n }\n}\n\nexport { Definition as RichTextV1Definition, RichTextControl as RichTextV1Control }\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBASO;AAEP,uBAA+B;AAE/B,qBAAgC;AAEhC,MAAe,uBAAuB,qCAAiD;AAAC;AAExF,MAAM,mBAAmB,eAAe;AAAA,EACtC,OAAO,YAAY,MAAsC;AACvD,QAAI,KAAK,SAAS,WAAW,MAAM;AACjC,YAAM,IAAI,MAAM,6BAA6B,WAAW,IAAI,SAAS,KAAK,IAAI,EAAE;AAAA,IAClF;AAEA,WAAO,IAAK,MAAM,mBAAmB,WAAW;AAAA,IAAC,EAAG;AAAA,EACtD;AAAA,EAEA,aACE,MACA,WACA,aACA,SACmC;AACnC,UAAM,kBAAc,6BAAY;AAAA,MAC9B,MAAM,WAAW;AAAA,MACjB,MAAM,UAAM,iCAAe,MAAM,WAAW,IAAI;AAAA,IAClD,CAAC;AAED,WAAO;AAAA,MACL,GAAG;AAAA,MACH,gBAAgB,YAAY;AAAA,MAAC;AAAA,IAC/B;AAAA,EACF;AAAA,EAEA,eAAe,MAA2B;AACxC,WAAO,IAAI,+BAAgB,IAAI;AAAA,EACjC;AACF;","names":[]}
|
|
@@ -24,8 +24,8 @@ module.exports = __toCommonJS(control_exports);
|
|
|
24
24
|
var import_controls = require("@makeswift/controls");
|
|
25
25
|
var import_rich_text_v2 = require("./rich-text-v2");
|
|
26
26
|
class RichTextV2Control extends import_controls.ControlInstance {
|
|
27
|
-
constructor(
|
|
28
|
-
super(
|
|
27
|
+
constructor(descriptor, args) {
|
|
28
|
+
super(args);
|
|
29
29
|
this.descriptor = descriptor;
|
|
30
30
|
}
|
|
31
31
|
static messagePrefix = `${import_controls.RichTextDefinition.type}::control-message`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/controls/rich-text-v2/control.ts"],"sourcesContent":["import { Editor } from 'slate'\n// @ts-expect-error: there are no types for 'corporate-ipsum'\nimport ipsum from 'corporate-ipsum'\n\nimport {\n RichTextDefinition,\n ControlInstance,\n Slate,\n type BoxDisplayModel,\n type DataType,\n type
|
|
1
|
+
{"version":3,"sources":["../../../../src/controls/rich-text-v2/control.ts"],"sourcesContent":["import { Editor } from 'slate'\n// @ts-expect-error: there are no types for 'corporate-ipsum'\nimport ipsum from 'corporate-ipsum'\n\nimport {\n RichTextDefinition,\n ControlInstance,\n Slate,\n type BoxDisplayModel,\n type DataType,\n type ControlInstanceArgs,\n type Data,\n} from '@makeswift/controls'\n\nimport { RichTextV2Definition } from './rich-text-v2'\n\n// COSMOS -> HOST\ntype ResetValueMessage = { type: typeof RichTextV2Control.RESET_VALUE }\ntype FocusMessage = { type: typeof RichTextV2Control.FOCUS }\ntype RunPluginControlActionMessage = {\n type: typeof RichTextV2Control.RUN_PLUGIN_CONTROL_ACTION\n pluginIndex: number\n value: Data\n}\n\n// HOST -> COSMOS\ntype SetDefaultValueMessage = {\n type: typeof RichTextV2Control.SET_DEFAULT_VALUE\n value: Slate.Descendant[]\n}\n\ntype SetPluginControlValueMessage = {\n type: typeof RichTextV2Control.SET_PLUGIN_CONTROL_VALUE\n value: Data[]\n}\n\ntype OnChangeMessage = {\n type: typeof RichTextV2Control.ON_CHANGE\n value: DataType<RichTextV2Definition>\n}\n\ntype SelectMessage = { type: typeof RichTextV2Control.SELECT }\n\ntype SwitchToBuildModeMessage = {\n type: typeof RichTextV2Control.SWITCH_TO_BUILD_MODE\n}\n\ntype ChangeBoxModelMessage = {\n type: typeof RichTextV2Control.CHANGE_BOX_MODEL\n payload: { boxModel: BoxDisplayModel | null }\n}\n\ntype UndoMessage = { type: typeof RichTextV2Control.UNDO }\ntype RedoMessage = { type: typeof RichTextV2Control.REDO }\n\ntype Message =\n | ResetValueMessage\n | FocusMessage\n | RunPluginControlActionMessage\n | SetDefaultValueMessage\n | SetPluginControlValueMessage\n | OnChangeMessage\n | SelectMessage\n | SwitchToBuildModeMessage\n | ChangeBoxModelMessage\n | UndoMessage\n | RedoMessage\n\nexport class RichTextV2Control extends ControlInstance<Message> {\n private static readonly messagePrefix = `${RichTextDefinition.type}::control-message` as const\n\n // COSMOS -> HOST\n static readonly RESET_VALUE = `${this.messagePrefix}::reset-value` as const\n static readonly FOCUS = `${this.messagePrefix}::focus` as const\n static readonly RUN_PLUGIN_CONTROL_ACTION =\n `${this.messagePrefix}::run-plugin-control-action` as const\n\n // HOST -> COSMOS\n static readonly SET_DEFAULT_VALUE = `${this.messagePrefix}::set-default-value` as const\n static readonly SET_PLUGIN_CONTROL_VALUE =\n `${this.messagePrefix}::set-plugin-control-value` as const\n static readonly ON_CHANGE = `${this.messagePrefix}::on-change` as const\n static readonly SELECT = `${this.messagePrefix}::select` as const\n static readonly SWITCH_TO_BUILD_MODE = `${this.messagePrefix}::switch-to-build-mode` as const\n static readonly CHANGE_BOX_MODEL = `${this.messagePrefix}::change-box-model` as const\n\n static readonly REDO = `${this.messagePrefix}::redo` as const\n static readonly UNDO = `${this.messagePrefix}::undo` as const\n\n private editor: Editor | null = null\n private defaultValue: Slate.Descendant[] | null = null\n\n constructor(\n private readonly descriptor: RichTextV2Definition,\n args: ControlInstanceArgs<Message>,\n ) {\n super(args)\n }\n\n recv = (message: Message): void => {\n if (!this.editor) return\n\n switch (message.type) {\n case RichTextV2Control.FOCUS: {\n this.editor.focusAndSelectAll()\n break\n }\n\n case RichTextV2Control.RESET_VALUE: {\n if (this.defaultValue) {\n this.editor.resetValue(this.defaultValue)\n setTimeout(() => {\n this.onLocalUserChange()\n })\n }\n break\n }\n\n case RichTextV2Control.RUN_PLUGIN_CONTROL_ACTION: {\n this.descriptor.pluginControlAt(message.pluginIndex)?.onChange?.(this.editor, message.value)\n break\n }\n }\n }\n\n child(_key: string): ControlInstance | undefined {\n return undefined\n }\n\n setEditor(editor: Editor) {\n this.editor = editor\n this.sendMessage({\n type: RichTextV2Control.SET_PLUGIN_CONTROL_VALUE,\n value: this.getValue(editor),\n })\n\n const _onChange = editor.onChange\n this.editor.onChange = options => {\n _onChange(options)\n this.updatePluginValues()\n if (this.editor == null || options?.operation == null) return\n this.onLocalUserChange()\n }\n }\n\n setDefaultValue(defaultValue: Slate.Descendant[]) {\n this.defaultValue = defaultValue\n this.sendMessage({\n type: RichTextV2Control.SET_DEFAULT_VALUE,\n value: defaultValue,\n })\n }\n\n onLocalUserChange() {\n if (this.editor == null) return\n\n this.sendMessage({\n type: RichTextV2Control.ON_CHANGE,\n value: RichTextV2Definition.nodesToDataV2(this.editor.children, this.editor.currentKey),\n })\n }\n\n updatePluginValues() {\n const editor = this.editor\n if (editor == null) return\n\n this.sendMessage({\n type: RichTextV2Control.SET_PLUGIN_CONTROL_VALUE,\n value: this.getValue(editor),\n })\n }\n\n getValue(editor: Editor) {\n return this.descriptor.pluginControls.map(control => control.getValue?.(editor)) ?? []\n }\n\n select() {\n this.sendMessage({ type: RichTextV2Control.SELECT })\n }\n\n switchToBuildMode() {\n this.sendMessage({ type: RichTextV2Control.SWITCH_TO_BUILD_MODE })\n }\n\n undo() {\n this.sendMessage({ type: RichTextV2Control.UNDO })\n }\n\n redo() {\n this.sendMessage({ type: RichTextV2Control.REDO })\n }\n\n changeBoxModel(boxModel: BoxDisplayModel | null): void {\n this.sendMessage({\n type: RichTextV2Control.CHANGE_BOX_MODEL,\n payload: { boxModel },\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,sBAQO;AAEP,0BAAqC;AAsD9B,MAAM,0BAA0B,gCAAyB;AAAA,EAwB9D,YACmB,YACjB,MACA;AACA,UAAM,IAAI;AAHO;AAAA,EAInB;AAAA,EA5BA,OAAwB,gBAAgB,GAAG,mCAAmB,IAAI;AAAA;AAAA,EAGlE,OAAgB,cAAc,GAAG,KAAK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
@@ -96,8 +96,8 @@ class Definition extends import_controls.RichTextDefinition {
|
|
|
96
96
|
get configSchema() {
|
|
97
97
|
return Definition.fullSchema({ pluginDef: import_zod.z.any() }).config;
|
|
98
98
|
}
|
|
99
|
-
createInstance(
|
|
100
|
-
return new import_control.RichTextV2Control(
|
|
99
|
+
createInstance(args) {
|
|
100
|
+
return new import_control.RichTextV2Control(this, args);
|
|
101
101
|
}
|
|
102
102
|
resolveValue(data, _resolver, _stylesheet, control) {
|
|
103
103
|
const stableValue = (0, import_controls.StableValue)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/controls/rich-text-v2/rich-text-v2.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport { z } from 'zod'\n// @ts-expect-error: there are no types for 'corporate-ipsum'\nimport ipsum from 'corporate-ipsum'\n\nimport {\n RichTextDefinition as BaseRichTextDefinition,\n isNotNil,\n ControlDefinition,\n SerializationSchema,\n StableValue,\n type Data,\n type Resolvable,\n type
|
|
1
|
+
{"version":3,"sources":["../../../../src/controls/rich-text-v2/rich-text-v2.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport { z } from 'zod'\n// @ts-expect-error: there are no types for 'corporate-ipsum'\nimport ipsum from 'corporate-ipsum'\n\nimport {\n RichTextDefinition as BaseRichTextDefinition,\n isNotNil,\n ControlDefinition,\n SerializationSchema,\n StableValue,\n type Data,\n type Resolvable,\n type ControlInstanceArgs,\n type DeserializedRecord,\n type SchemaType,\n type SchemaTypeAny,\n type RichTextPluginControl,\n type ResourceResolver,\n type Stylesheet,\n type RichTextMode,\n} from '@makeswift/controls'\n\nimport { LinkPlugin } from '../../slate/LinkPlugin'\nimport { InlinePlugin } from '../../slate/InlinePlugin'\nimport { TextAlignPlugin } from '../../slate/TextAlignPlugin'\nimport { BlockPlugin } from '../../slate/BlockPlugin'\nimport { TypographyPlugin } from '../../slate/TypographyPlugin'\nimport { InlineModePlugin } from '../../slate/InlineModePlugin'\nimport { toText } from '../../slate/utils'\n\nimport { renderRichTextV2 } from '../../runtimes/react/controls/rich-text-v2'\n\nimport { RichTextV2Plugin, Plugin } from './plugin'\nimport { RichTextV2Control } from './control'\nimport { getTranslatableData } from './translations/get-translations'\n\ntype DataType = z.infer<typeof Definition.schema.data>\ntype DataV2Type = z.infer<typeof Definition.schema.dataV2>\ntype InstanceType = RichTextV2Control\ntype UserConfig = z.infer<typeof Definition.schema.userConfig>\ntype Config = UserConfig & {\n defaultValue: string\n plugins: RichTextV2Plugin[]\n}\n\nclass Definition extends BaseRichTextDefinition<ReactNode, Config, InstanceType> {\n constructor({ mode, defaultValue }: UserConfig, plugins?: RichTextV2Plugin[]) {\n super({\n mode,\n defaultValue:\n defaultValue ??\n (mode === Definition.Mode.Inline ? 'Edit this text' : Definition.generateParagraph()),\n plugins:\n plugins ??\n (mode === Definition.Mode.Inline\n ? [InlineModePlugin()]\n : [BlockPlugin(), TypographyPlugin(), TextAlignPlugin(), InlinePlugin(), LinkPlugin()]),\n })\n }\n\n static generateParagraph(): string {\n return ipsum(3)\n }\n\n static deserialize(\n data: DeserializedRecord,\n deserializeCallback: (r: DeserializedRecord) => ControlDefinition,\n ): RichTextV2Definition {\n if (data.type !== Definition.type) {\n throw new Error(`RichText: expected type ${Definition.type}, got ${data.type}`)\n }\n\n const { config } = Definition.fullSchema({\n pluginDef: SerializationSchema.deserializedRecord,\n }).definition.parse(data)\n\n const { plugins, ...userConfig } = config\n\n return new RichTextV2Definition(\n userConfig,\n plugins.map(({ control }) =>\n control ? { control: { definition: deserializeCallback(control?.definition) } } : {},\n ),\n )\n }\n\n static fullSchema<S extends SchemaTypeAny>({ pluginDef }: { pluginDef: S }) {\n const baseSchema = super.schema\n const plugin = z.object({\n control: z\n .object({\n definition: pluginDef,\n })\n .optional(),\n })\n\n const config = baseSchema.userConfig.extend({\n defaultValue: z.string(),\n plugins: z.array(plugin),\n })\n\n return {\n ...baseSchema,\n config,\n definition: z.object({\n type: baseSchema.type,\n config,\n }),\n }\n }\n\n get configSchema(): SchemaType<Config> {\n return Definition.fullSchema({ pluginDef: z.any() as SchemaType<ControlDefinition> }).config\n }\n\n createInstance(args: ControlInstanceArgs) {\n return new RichTextV2Control(this, args)\n }\n\n resolveValue(\n data: DataType | undefined,\n _resolver: ResourceResolver,\n _stylesheet: Stylesheet,\n control?: InstanceType,\n ): Resolvable<ReactNode | undefined> {\n const stableValue = StableValue({\n name: Definition.type,\n read: () => renderRichTextV2(data, this, control ?? null),\n })\n\n return {\n ...stableValue,\n triggerResolve: async () => {},\n }\n }\n\n getTranslatableData(data: DataType | undefined): Data {\n if (data == null) return null\n return getTranslatableData(Definition.dataToNodes(data), this.config.plugins)\n }\n\n get pluginControls(): RichTextPluginControl[] {\n return this.config.plugins.map(plugin => plugin.control).filter(isNotNil)\n }\n\n pluginControlAt(index: number): RichTextPluginControl | undefined {\n return this.pluginControls[index]\n }\n\n toText(data: DataType | undefined): string {\n if (data == null) return ''\n return toText(Definition.dataToNodes(data), this.config.mode ?? Definition.Mode.Block)\n }\n}\n\nexport class RichTextV2Definition extends Definition {}\n\nexport function RichText(config?: UserConfig): RichTextV2Definition {\n return new RichTextV2Definition(config ?? {})\n}\n\nRichText.Mode = Definition.Mode\nRichText.isV1Data = Definition.isV1Data\nRichText.dataToNodes = Definition.dataToNodes\nRichText.Plugin = Plugin\n\nexport { RichTextMode as RichTextV2Mode, type DataV2Type as RichTextDataV2, RichTextV2Control }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAAkB;AAElB,6BAAkB;AAElB,sBAgBO;AAEP,wBAA2B;AAC3B,0BAA6B;AAC7B,6BAAgC;AAChC,yBAA4B;AAC5B,8BAAiC;AACjC,8BAAiC;AACjC,mBAAuB;AAEvB,0BAAiC;AAEjC,oBAAyC;AACzC,qBAAkC;AAClC,8BAAoC;AAWpC,MAAM,mBAAmB,gBAAAA,mBAAwD;AAAA,EAC/E,Y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um"]}
|
|
@@ -44,6 +44,7 @@ function deserializeUnifiedControlDef(record) {
|
|
|
44
44
|
[import__.ColorDefinition.type]: import__.ColorDefinition.deserialize,
|
|
45
45
|
[import__.ComboboxDefinition.type]: import__.ComboboxDefinition.deserialize,
|
|
46
46
|
[import__.FontDefinition.type]: import__.FontDefinition.deserialize,
|
|
47
|
+
[import__.unstable_GalleryDefinition.type]: import__.unstable_GalleryDefinition.deserialize,
|
|
47
48
|
[import__.GroupDefinition.type]: (record2) => import__.GroupDefinition.deserialize(record2, deserializeUnifiedControlDef),
|
|
48
49
|
[import__.IconRadioGroupDefinition.type]: import__.IconRadioGroupDefinition.deserialize,
|
|
49
50
|
[import__.ImageDefinition.type]: import__.ImageDefinition.deserialize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/controls/serialization/base/index.ts"],"sourcesContent":["import {\n ControlDefinition,\n type SerializedRecord,\n type DeserializedRecord,\n ShapeV2Definition,\n DeserializationPlugin,\n deserializeRecord,\n} from '@makeswift/controls'\n\nimport {\n CheckboxDefinition,\n CodeDefinition,\n ColorDefinition,\n ComboboxDefinition,\n FontDefinition,\n GroupDefinition,\n IconRadioGroupDefinition,\n ImageDefinition,\n LinkDefinition,\n ListDefinition,\n NumberDefinition,\n RichTextV1Definition,\n RichTextV2Definition,\n SelectDefinition,\n ShapeDefinition,\n SliderDefinition,\n SlotDefinition,\n StyleDefinition,\n StyleV2Definition,\n TextAreaDefinition,\n TextInputDefinition,\n unstable_TypographyDefinition,\n} from '../../index'\n\nimport { BaseControlSerializationVisitor } from './visitor'\n\nexport { type SerializedRecord, type DeserializedRecord } from '@makeswift/controls'\n\nexport function serializeControls(\n controls: Record<string, ControlDefinition>,\n visitor: BaseControlSerializationVisitor,\n): Record<string, SerializedRecord> {\n return Object.entries(controls).reduce<Record<string, SerializedRecord>>(\n (acc, [key, control]) => {\n return { ...acc, [key]: control.accept(visitor) }\n },\n {},\n )\n}\n\nexport type DeserializeControlOptions = {\n plugins: DeserializationPlugin<any>[]\n}\n\nexport function deserializeControl(\n serializedControl: SerializedRecord,\n options: DeserializeControlOptions,\n): ControlDefinition {\n const plugins = options?.plugins ?? []\n\n return deserializeUnifiedControlDef(deserializeRecord(serializedControl, plugins))\n}\n\nexport function deserializeUnifiedControlDef(record: DeserializedRecord): ControlDefinition {\n type DeserializeMethod = (data: DeserializedRecord) => ControlDefinition\n const deserializeMethod: Record<string, DeserializeMethod> = {\n [CheckboxDefinition.type]: CheckboxDefinition.deserialize,\n [CodeDefinition.type]: CodeDefinition.deserialize,\n [ColorDefinition.type]: ColorDefinition.deserialize,\n [ComboboxDefinition.type]: ComboboxDefinition.deserialize,\n [FontDefinition.type]: FontDefinition.deserialize,\n [GroupDefinition.type]: record =>\n GroupDefinition.deserialize(record, deserializeUnifiedControlDef),\n [IconRadioGroupDefinition.type]: IconRadioGroupDefinition.deserialize,\n [ImageDefinition.type]: ImageDefinition.deserialize,\n [LinkDefinition.type]: LinkDefinition.deserialize,\n [ListDefinition.type]: record =>\n ListDefinition.deserialize(record, deserializeUnifiedControlDef),\n [NumberDefinition.type]: NumberDefinition.deserialize,\n [RichTextV1Definition.type]: RichTextV1Definition.deserialize,\n [RichTextV2Definition.type]: record =>\n RichTextV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [SelectDefinition.type]: SelectDefinition.deserialize,\n [ShapeDefinition.type]: record =>\n ShapeDefinition.deserialize(record, deserializeUnifiedControlDef),\n [SliderDefinition.type]: SliderDefinition.deserialize,\n [ShapeV2Definition.type]: record =>\n ShapeV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [SlotDefinition.type]: SlotDefinition.deserialize,\n [StyleDefinition.type]: StyleDefinition.deserialize,\n [StyleV2Definition.type]: record =>\n StyleV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [TextAreaDefinition.type]: TextAreaDefinition.deserialize,\n [TextInputDefinition.type]: TextInputDefinition.deserialize,\n [unstable_TypographyDefinition.type]: unstable_TypographyDefinition.deserialize,\n } as const\n\n const deserialize = deserializeMethod[record.type] ?? null\n if (deserialize == null) {\n throw new Error(`Unknown control type: ${record.type}`)\n }\n\n return deserialize(record)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAOO;AAEP,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/controls/serialization/base/index.ts"],"sourcesContent":["import {\n ControlDefinition,\n type SerializedRecord,\n type DeserializedRecord,\n ShapeV2Definition,\n DeserializationPlugin,\n deserializeRecord,\n} from '@makeswift/controls'\n\nimport {\n CheckboxDefinition,\n CodeDefinition,\n ColorDefinition,\n ComboboxDefinition,\n FontDefinition,\n unstable_GalleryDefinition,\n GroupDefinition,\n IconRadioGroupDefinition,\n ImageDefinition,\n LinkDefinition,\n ListDefinition,\n NumberDefinition,\n RichTextV1Definition,\n RichTextV2Definition,\n SelectDefinition,\n ShapeDefinition,\n SliderDefinition,\n SlotDefinition,\n StyleDefinition,\n StyleV2Definition,\n TextAreaDefinition,\n TextInputDefinition,\n unstable_TypographyDefinition,\n} from '../../index'\n\nimport { BaseControlSerializationVisitor } from './visitor'\n\nexport { type SerializedRecord, type DeserializedRecord } from '@makeswift/controls'\n\nexport function serializeControls(\n controls: Record<string, ControlDefinition>,\n visitor: BaseControlSerializationVisitor,\n): Record<string, SerializedRecord> {\n return Object.entries(controls).reduce<Record<string, SerializedRecord>>(\n (acc, [key, control]) => {\n return { ...acc, [key]: control.accept(visitor) }\n },\n {},\n )\n}\n\nexport type DeserializeControlOptions = {\n plugins: DeserializationPlugin<any>[]\n}\n\nexport function deserializeControl(\n serializedControl: SerializedRecord,\n options: DeserializeControlOptions,\n): ControlDefinition {\n const plugins = options?.plugins ?? []\n\n return deserializeUnifiedControlDef(deserializeRecord(serializedControl, plugins))\n}\n\nexport function deserializeUnifiedControlDef(record: DeserializedRecord): ControlDefinition {\n type DeserializeMethod = (data: DeserializedRecord) => ControlDefinition\n const deserializeMethod: Record<string, DeserializeMethod> = {\n [CheckboxDefinition.type]: CheckboxDefinition.deserialize,\n [CodeDefinition.type]: CodeDefinition.deserialize,\n [ColorDefinition.type]: ColorDefinition.deserialize,\n [ComboboxDefinition.type]: ComboboxDefinition.deserialize,\n [FontDefinition.type]: FontDefinition.deserialize,\n [unstable_GalleryDefinition.type]: unstable_GalleryDefinition.deserialize,\n [GroupDefinition.type]: record =>\n GroupDefinition.deserialize(record, deserializeUnifiedControlDef),\n [IconRadioGroupDefinition.type]: IconRadioGroupDefinition.deserialize,\n [ImageDefinition.type]: ImageDefinition.deserialize,\n [LinkDefinition.type]: LinkDefinition.deserialize,\n [ListDefinition.type]: record =>\n ListDefinition.deserialize(record, deserializeUnifiedControlDef),\n [NumberDefinition.type]: NumberDefinition.deserialize,\n [RichTextV1Definition.type]: RichTextV1Definition.deserialize,\n [RichTextV2Definition.type]: record =>\n RichTextV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [SelectDefinition.type]: SelectDefinition.deserialize,\n [ShapeDefinition.type]: record =>\n ShapeDefinition.deserialize(record, deserializeUnifiedControlDef),\n [SliderDefinition.type]: SliderDefinition.deserialize,\n [ShapeV2Definition.type]: record =>\n ShapeV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [SlotDefinition.type]: SlotDefinition.deserialize,\n [StyleDefinition.type]: StyleDefinition.deserialize,\n [StyleV2Definition.type]: record =>\n StyleV2Definition.deserialize(record, deserializeUnifiedControlDef),\n [TextAreaDefinition.type]: TextAreaDefinition.deserialize,\n [TextInputDefinition.type]: TextInputDefinition.deserialize,\n [unstable_TypographyDefinition.type]: unstable_TypographyDefinition.deserialize,\n } as const\n\n const deserialize = deserializeMethod[record.type] ?? null\n if (deserialize == null) {\n throw new Error(`Unknown control type: ${record.type}`)\n }\n\n return deserialize(record)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAOO;AAEP,eAwBO;AAM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yBAAgB,IAAI,GAAG,CAAAA,YACtB,yBAAgB,YAAYA,SAAQ,4BAA4B;AAAA,IAClE,CAAC,0BAAiB,IAAI,GAAG,0BAAiB;AAAA,IAC1C,CAAC,kCAAkB,IAAI,GAAG,CAAAA,YACxB,kCAAkB,YAAYA,SAAQ,4BAA4B;AAAA,IACpE,CAAC,wBAAe,IAAI,GAAG,wBAAe;AAAA,IACtC,CAAC,yBAAgB,IAAI,GAAG,yBAAgB;AAAA,IACxC,CAAC,2BAAkB,IAAI,GAAG,CAAAA,YACxB,2BAAkB,YAAYA,SAAQ,4BAA4B;AAAA,IACpE,CAAC,4BAAmB,IAAI,GAAG,4BAAmB;AAAA,IAC9C,CAAC,6BAAoB,IAAI,GAAG,6BAAoB;AAAA,IAChD,CAAC,uCAA8B,IAAI,GAAG,uCAA8B;AAAA,EACtE;AAEA,QAAM,cAAc,kBAAkB,OAAO,IAAI,KAAK;AACtD,MAAI,eAAe,MAAM;AACvB,UAAM,IAAI,MAAM,yBAAyB,OAAO,IAAI,EAAE;AAAA,EACxD;AAEA,SAAO,YAAY,MAAM;AAC3B;","names":["record"]}
|
|
@@ -21,12 +21,10 @@ __export(app_router_exports, {
|
|
|
21
21
|
context: () => context
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(app_router_exports);
|
|
24
|
-
var import_framework_context = require("../../../../runtimes/react/components/framework-context");
|
|
25
24
|
var import_HeadSnippet = require("./HeadSnippet");
|
|
26
25
|
const context = {
|
|
27
26
|
// The App Router uses built-in React Canary releases, which include all stable
|
|
28
27
|
// React 19 features, so we can simply use our default head implementation
|
|
29
|
-
Head: import_framework_context.DefaultHead,
|
|
30
28
|
HeadSnippet: import_HeadSnippet.HeadSnippet
|
|
31
29
|
};
|
|
32
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/next/components/framework-provider/app-router/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/next/components/framework-provider/app-router/index.ts"],"sourcesContent":["import { type FrameworkContext } from '../../../../runtimes/react/components/framework-context'\n\nimport { HeadSnippet } from './HeadSnippet'\n\nexport const context: Pick<FrameworkContext, 'HeadSnippet'> = {\n // The App Router uses built-in React Canary releases, which include all stable\n // React 19 features, so we can simply use our default head implementation\n HeadSnippet,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA4B;AAErB,MAAM,UAAiD;AAAA;AAAA;AAAA,EAG5D;AACF;","names":[]}
|
|
@@ -53,7 +53,7 @@ function FrameworkProvider({
|
|
|
53
53
|
}),
|
|
54
54
|
[isPagesRouter]
|
|
55
55
|
);
|
|
56
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framework_context.
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framework_context.FrameworkContextProvider, { value: context, children });
|
|
57
57
|
}
|
|
58
58
|
// Annotate the CommonJS export names for ESM import in node:
|
|
59
59
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/next/components/framework-provider/index.tsx"],"sourcesContent":["'use client'\n\nimport { type PropsWithChildren, useMemo } from 'react'\nimport NextImage from 'next/image'\n\nimport { useIsPagesRouter } from '../../hooks/use-is-pages-router'\nimport { FrameworkContext
|
|
1
|
+
{"version":3,"sources":["../../../../../src/next/components/framework-provider/index.tsx"],"sourcesContent":["'use client'\n\nimport { type PropsWithChildren, useMemo } from 'react'\nimport NextImage from 'next/image'\n\nimport { useIsPagesRouter } from '../../hooks/use-is-pages-router'\nimport {\n type FrameworkContext,\n FrameworkContextProvider,\n} from '../../../runtimes/react/components/framework-context'\n\nimport { context as appRouterContext } from './app-router'\nimport { context as pagesRouterContext } from './pages-router'\nimport { Link } from './link'\n\nexport function FrameworkProvider({\n children,\n forcePagesRouter,\n}: PropsWithChildren<{ forcePagesRouter?: boolean }>) {\n const isPagesRouter = useIsPagesRouter() || forcePagesRouter\n const context = useMemo<Partial<FrameworkContext>>(\n () => ({\n ...(isPagesRouter ? pagesRouterContext : appRouterContext),\n Image: NextImage,\n Link,\n }),\n [isPagesRouter],\n )\n\n return <FrameworkContextProvider value={context}>{children}</FrameworkContextProvider>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BS;AA3BT,mBAAgD;AAChD,mBAAsB;AAEtB,iCAAiC;AACjC,+BAGO;AAEP,wBAA4C;AAC5C,0BAA8C;AAC9C,kBAAqB;AAEd,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AACF,GAAsD;AACpD,QAAM,oBAAgB,6CAAiB,KAAK;AAC5C,QAAM,cAAU;AAAA,IACd,OAAO;AAAA,MACL,GAAI,gBAAgB,oBAAAA,UAAqB,kBAAAC;AAAA,MACzC,OAAO,aAAAC;AAAA,MACP;AAAA,IACF;AAAA,IACA,CAAC,aAAa;AAAA,EAChB;AAEA,SAAO,4CAAC,qDAAyB,OAAO,SAAU,UAAS;AAC7D;","names":["pagesRouterContext","appRouterContext","NextImage"]}
|
|
@@ -43,15 +43,18 @@ class TableFormFieldsPropController extends import_controls.ControlInstance {
|
|
|
43
43
|
this.sendMessage({ type: TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE, payload });
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function createPropController(
|
|
46
|
+
function createPropController({
|
|
47
|
+
descriptor,
|
|
48
|
+
...args
|
|
49
|
+
}) {
|
|
47
50
|
if (!(0, import_descriptors.isLegacyDescriptor)(descriptor)) {
|
|
48
|
-
return descriptor.createInstance(
|
|
51
|
+
return descriptor.createInstance(args);
|
|
49
52
|
}
|
|
50
53
|
switch (descriptor.type) {
|
|
51
54
|
case import_prop_controllers.Types.TableFormFields:
|
|
52
|
-
return new TableFormFieldsPropController(
|
|
55
|
+
return new TableFormFieldsPropController(args);
|
|
53
56
|
default:
|
|
54
|
-
return new import_controls.DefaultControlInstance(
|
|
57
|
+
return new import_controls.DefaultControlInstance(args);
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prop-controllers/instances.ts"],"sourcesContent":["import { type Descriptor, isLegacyDescriptor } from './descriptors'\nimport { Types as PropControllerTypes } from '@makeswift/prop-controllers'\n\nimport {\n type BoxDisplayModel,\n type
|
|
1
|
+
{"version":3,"sources":["../../../src/prop-controllers/instances.ts"],"sourcesContent":["import { type Descriptor, isLegacyDescriptor } from './descriptors'\nimport { Types as PropControllerTypes } from '@makeswift/prop-controllers'\n\nimport {\n type BoxDisplayModel,\n type ControlInstanceArgs,\n type ControlMessage,\n type InstanceType,\n ControlInstance,\n DefaultControlInstance,\n} from '@makeswift/controls'\n\nexport type PropControllerMessage = ControlMessage\n\nexport const TableFormFieldsMessageType = {\n TABLE_FORM_LAYOUT_CHANGE: 'TABLE_FORM_LAYOUT_CHANGE',\n TABLE_FORM_FIELD_LAYOUT_CHANGE: 'TABLE_FORM_FIELD_LAYOUT_CHANGE',\n} as const\n\ntype TableLayoutTableFormFieldsMessage = {\n type: typeof TableFormFieldsMessageType.TABLE_FORM_LAYOUT_CHANGE\n payload: { layout: BoxDisplayModel }\n}\n\ntype TableFieldLayoutTableFormFieldsMessage = {\n type: typeof TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE\n payload: { layout: BoxDisplayModel; index: number }\n}\n\nexport type TableFormFieldsMessage =\n | TableLayoutTableFormFieldsMessage\n | TableFieldLayoutTableFormFieldsMessage\n\nexport class TableFormFieldsPropController extends ControlInstance<TableFormFieldsMessage> {\n recv = () => {}\n child(_key: string): ControlInstance | undefined {\n return undefined\n }\n\n tableFormLayoutChange(payload: { layout: BoxDisplayModel }) {\n this.sendMessage({ type: TableFormFieldsMessageType.TABLE_FORM_LAYOUT_CHANGE, payload })\n }\n\n tableFormFieldLayoutChange(payload: { layout: BoxDisplayModel; index: number }) {\n this.sendMessage({ type: TableFormFieldsMessageType.TABLE_FORM_FIELD_LAYOUT_CHANGE, payload })\n }\n}\n\ntype DescriptorPropController<T extends Descriptor> = T extends {\n type: typeof PropControllerTypes.TableFormFields\n}\n ? TableFormFieldsPropController\n : InstanceType<T>\n\nexport type DescriptorsPropControllers<T extends Record<string, Descriptor>> = {\n [K in keyof T]: undefined extends T[K]\n ? DescriptorPropController<Exclude<T[K], undefined>>\n : DescriptorPropController<T[K]>\n}\n\nexport type AnyPropController = ControlInstance<any> | TableFormFieldsPropController\n\nexport function createPropController({\n descriptor,\n ...args\n}: {\n descriptor: Descriptor\n} & ControlInstanceArgs): AnyPropController {\n if (!isLegacyDescriptor(descriptor)) {\n return descriptor.createInstance(args)\n }\n\n switch (descriptor.type) {\n case PropControllerTypes.TableFormFields:\n return new TableFormFieldsPropController(args)\n\n default:\n return new DefaultControlInstance(args)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAoD;AACpD,8BAA6C;AAE7C,sBAOO;AAIA,MAAM,6BAA6B;AAAA,EACxC,0BAA0B;AAAA,EAC1B,gCAAgC;AAClC;AAgBO,MAAM,sCAAsC,gCAAwC;AAAA,EACzF,OAAO,MAAM;AAAA,EAAC;AAAA,EACd,MAAM,MAA2C;AAC/C,WAAO;AAAA,EACT;AAAA,EAEA,sBAAsB,SAAsC;AAC1D,SAAK,YAAY,EAAE,MAAM,2BAA2B,0BAA0B,QAAQ,CAAC;AAAA,EACzF;AAAA,EAEA,2BAA2B,SAAqD;AAC9E,SAAK,YAAY,EAAE,MAAM,2BAA2B,gCAAgC,QAAQ,CAAC;AAAA,EAC/F;AACF;AAgBO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA,GAAG;AACL,GAE4C;AAC1C,MAAI,KAAC,uCAAmB,UAAU,GAAG;AACnC,WAAO,WAAW,eAAe,IAAI;AAAA,EACvC;AAEA,UAAQ,WAAW,MAAM;AAAA,IACvB,KAAK,wBAAAA,MAAoB;AACvB,aAAO,IAAI,8BAA8B,IAAI;AAAA,IAE/C;AACE,aAAO,IAAI,uCAAuB,IAAI;AAAA,EAC1C;AACF;","names":["PropControllerTypes"]}
|
|
@@ -18,11 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var framework_context_exports = {};
|
|
20
20
|
__export(framework_context_exports, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
DefaultImage: () => DefaultImage,
|
|
24
|
-
DefaultLink: () => DefaultLink,
|
|
25
|
-
FrameworkContext: () => FrameworkContext
|
|
21
|
+
FrameworkContextProvider: () => FrameworkContextProvider,
|
|
22
|
+
useFrameworkContext: () => useFrameworkContext
|
|
26
23
|
});
|
|
27
24
|
module.exports = __toCommonJS(framework_context_exports);
|
|
28
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -48,18 +45,27 @@ const DefaultImage = ({ priority, fill, style, ...props }) => /* @__PURE__ */ (0
|
|
|
48
45
|
const DefaultLink = (0, import_react.forwardRef)(
|
|
49
46
|
({ linkType, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { ...props, ref })
|
|
50
47
|
);
|
|
51
|
-
const FrameworkContext = (0, import_react.createContext)({
|
|
48
|
+
const FrameworkContext = (0, import_react.createContext)({});
|
|
49
|
+
const FrameworkContextProvider = ({
|
|
50
|
+
value,
|
|
51
|
+
children
|
|
52
|
+
}) => {
|
|
53
|
+
const parentContext = (0, import_react.useContext)(FrameworkContext);
|
|
54
|
+
const mergedContext = (0, import_react.useMemo)(() => ({ ...parentContext, ...value }), [parentContext, value]);
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FrameworkContext.Provider, { value: mergedContext, children });
|
|
56
|
+
};
|
|
57
|
+
const defaultContext = {
|
|
52
58
|
Head: DefaultHead,
|
|
53
59
|
HeadSnippet: DefaultHeadSnippet,
|
|
54
60
|
Image: DefaultImage,
|
|
55
61
|
Link: DefaultLink
|
|
56
|
-
}
|
|
62
|
+
};
|
|
63
|
+
function useFrameworkContext() {
|
|
64
|
+
return { ...defaultContext, ...(0, import_react.useContext)(FrameworkContext) };
|
|
65
|
+
}
|
|
57
66
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
67
|
0 && (module.exports = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
DefaultImage,
|
|
62
|
-
DefaultLink,
|
|
63
|
-
FrameworkContext
|
|
68
|
+
FrameworkContextProvider,
|
|
69
|
+
useFrameworkContext
|
|
64
70
|
});
|
|
65
71
|
//# sourceMappingURL=framework-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/components/framework-context.tsx"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/components/framework-context.tsx"],"sourcesContent":["import {\n type ReactNode,\n type PropsWithChildren,\n type CSSProperties,\n type ComponentPropsWithoutRef,\n type MouseEvent,\n type ForwardRefExoticComponent,\n type RefAttributes,\n forwardRef,\n createContext,\n useContext,\n useMemo,\n} from 'react'\n\nimport { type LinkData } from '@makeswift/prop-controllers'\n\nimport { type Snippet } from '../../../client'\n\nimport { BaseHeadSnippet } from './page/HeadSnippet'\n\ntype HeadComponent = (props: { children: ReactNode }) => ReactNode\ntype HeadSnippet = (props: { snippet: Snippet }) => ReactNode\ntype ImageComponent = (props: {\n src: string\n alt: string\n sizes?: string\n width?: number\n height?: number\n priority?: boolean\n fill?: boolean\n style?: CSSProperties\n}) => ReactNode\n\ntype LinkProps = Omit<ComponentPropsWithoutRef<'a'>, 'onClick'> & {\n linkType?: LinkData['type']\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => unknown\n}\n\ntype LinkComponent = ForwardRefExoticComponent<RefAttributes<HTMLAnchorElement> & LinkProps>\n\nexport type FrameworkContext = {\n Head: HeadComponent\n HeadSnippet: HeadSnippet\n Image: ImageComponent\n Link: LinkComponent\n}\n\n// React 19 automatically hoists metadata tags to the <head>\nconst DefaultHead = ({ children }: PropsWithChildren) => <>{children}</>\n\nconst DefaultHeadSnippet = BaseHeadSnippet\n\nconst DefaultImage: ImageComponent = ({ priority, fill, style, ...props }) => (\n <img\n {...props}\n style={{\n ...(fill\n ? {\n height: '100%',\n width: '100%',\n objectFit: 'cover',\n }\n : {}),\n ...style,\n }}\n loading={priority ? 'eager' : 'lazy'}\n />\n)\n\nconst DefaultLink: LinkComponent = forwardRef<HTMLAnchorElement, LinkProps>(\n ({ linkType, ...props }, ref) => <a {...props} ref={ref} />,\n)\n\nconst FrameworkContext = createContext<Partial<FrameworkContext>>({})\n\nexport const FrameworkContextProvider = ({\n value,\n children,\n}: PropsWithChildren<{ value: Partial<FrameworkContext> }>) => {\n const parentContext = useContext(FrameworkContext)\n const mergedContext = useMemo(() => ({ ...parentContext, ...value }), [parentContext, value])\n\n return <FrameworkContext.Provider value={mergedContext}>{children}</FrameworkContext.Provider>\n}\n\nconst defaultContext: FrameworkContext = {\n Head: DefaultHead,\n HeadSnippet: DefaultHeadSnippet,\n Image: DefaultImage,\n Link: DefaultLink,\n}\n\nexport function useFrameworkContext(): FrameworkContext {\n return { ...defaultContext, ...useContext(FrameworkContext) }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDyD;AAhDzD,mBAYO;AAMP,yBAAgC;AA8BhC,MAAM,cAAc,CAAC,EAAE,SAAS,MAAyB,2EAAG,UAAS;AAErE,MAAM,qBAAqB;AAE3B,MAAM,eAA+B,CAAC,EAAE,UAAU,MAAM,OAAO,GAAG,MAAM,MACtE;AAAA,EAAC;AAAA;AAAA,IACE,GAAG;AAAA,IACJ,OAAO;AAAA,MACL,GAAI,OACA;AAAA,QACE,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,WAAW;AAAA,MACb,IACA,CAAC;AAAA,MACL,GAAG;AAAA,IACL;AAAA,IACA,SAAS,WAAW,UAAU;AAAA;AAChC;AAGF,MAAM,kBAA6B;AAAA,EACjC,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,4CAAC,OAAG,GAAG,OAAO,KAAU;AAC3D;AAEA,MAAM,uBAAmB,4BAAyC,CAAC,CAAC;AAE7D,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AACF,MAA+D;AAC7D,QAAM,oBAAgB,yBAAW,gBAAgB;AACjD,QAAM,oBAAgB,sBAAQ,OAAO,EAAE,GAAG,eAAe,GAAG,MAAM,IAAI,CAAC,eAAe,KAAK,CAAC;AAE5F,SAAO,4CAAC,iBAAiB,UAAjB,EAA0B,OAAO,eAAgB,UAAS;AACpE;AAEA,MAAM,iBAAmC;AAAA,EACvC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,OAAO;AAAA,EACP,MAAM;AACR;AAEO,SAAS,sBAAwC;AACtD,SAAO,EAAE,GAAG,gBAAgB,OAAG,yBAAW,gBAAgB,EAAE;AAC9D;","names":[]}
|
|
@@ -18,14 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var use_framework_context_exports = {};
|
|
20
20
|
__export(use_framework_context_exports, {
|
|
21
|
-
useFrameworkContext: () => useFrameworkContext
|
|
21
|
+
useFrameworkContext: () => import_framework_context.useFrameworkContext
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(use_framework_context_exports);
|
|
24
|
-
var import_react = require("react");
|
|
25
24
|
var import_framework_context = require("../framework-context");
|
|
26
|
-
function useFrameworkContext() {
|
|
27
|
-
return (0, import_react.useContext)(import_framework_context.FrameworkContext);
|
|
28
|
-
}
|
|
29
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
26
|
0 && (module.exports = {
|
|
31
27
|
useFrameworkContext
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/runtimes/react/components/hooks/use-framework-context.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/runtimes/react/components/hooks/use-framework-context.tsx"],"sourcesContent":["export { useFrameworkContext } from '../framework-context'\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAoC;","names":[]}
|