@makeswift/runtime 0.9.4 → 0.9.6
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/Box.cjs.js +3 -3
- package/dist/Box.es.js +3 -3
- package/dist/Button.cjs.js +3 -3
- package/dist/Button.es.js +3 -3
- package/dist/Carousel.cjs.js +3 -3
- package/dist/Carousel.es.js +3 -3
- package/dist/Countdown.cjs.js +1 -1
- package/dist/Countdown.es.js +1 -1
- package/dist/Divider.cjs.js +3 -3
- package/dist/Divider.es.js +3 -3
- package/dist/Embed.cjs.js +1 -0
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +1 -0
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +1 -1
- package/dist/Form.es.js +1 -1
- package/dist/Image.cjs.js +1 -1
- package/dist/Image.es.js +1 -1
- package/dist/LiveProvider.cjs.js +4 -4
- package/dist/LiveProvider.es.js +5 -5
- package/dist/Navigation.cjs.js +2 -2
- package/dist/Navigation.es.js +2 -2
- package/dist/PreviewProvider.cjs.js +8 -7
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +11 -10
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +3 -2
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +5 -4
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +12 -12
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +14 -14
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +1 -1
- package/dist/Root.es.js +1 -1
- package/dist/SocialLinks.cjs.js +3 -3
- package/dist/SocialLinks.es.js +3 -3
- package/dist/Text.cjs.js +1 -1
- package/dist/Text.es.js +1 -1
- package/dist/Video.cjs.js +1 -0
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +1 -0
- package/dist/Video.es.js.map +1 -1
- package/dist/actions.cjs.js +467 -3
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +467 -4
- package/dist/actions.es.js.map +1 -1
- package/dist/api.cjs.js +20 -1
- package/dist/api.cjs.js.map +1 -1
- package/dist/api.es.js +20 -1
- package/dist/api.es.js.map +1 -1
- package/dist/box-model.cjs.js +1 -0
- package/dist/box-model.cjs.js.map +1 -1
- package/dist/box-model.es.js +1 -0
- package/dist/box-model.es.js.map +1 -1
- package/dist/builder.cjs.js +1 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +1 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +1 -1
- package/dist/components.es.js +1 -1
- package/dist/control-serialization.cjs.js +1 -0
- package/dist/control-serialization.cjs.js.map +1 -1
- package/dist/control-serialization.es.js +1 -0
- package/dist/control-serialization.es.js.map +1 -1
- package/dist/controls.cjs.js +1 -0
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +2 -1
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +71 -41
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +5 -4
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs2.js +1 -0
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs5.js +30 -14
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs8.js +1 -1
- package/dist/index.cjs9.js +4 -4
- package/dist/index.es.js +74 -45
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +7 -6
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es2.js +2 -1
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es5.js +32 -16
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +1 -1
- package/dist/index.es8.js +1 -1
- package/dist/index.es9.js +6 -6
- package/dist/main.cjs.js +1 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +1 -0
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +1 -1
- package/dist/next.es.js +2 -2
- package/dist/prop-controllers.cjs.js +1 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +1 -0
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +27 -32
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +27 -14
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +1 -1
- package/dist/react.es.js +1 -1
- package/dist/slate.cjs.js +25 -67
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +31 -71
- package/dist/slate.es.js.map +1 -1
- package/dist/state/breakpoints.cjs.js +14 -0
- package/dist/state/breakpoints.cjs.js.map +1 -1
- package/dist/state/breakpoints.es.js +14 -1
- package/dist/state/breakpoints.es.js.map +1 -1
- package/dist/types/src/api/graphql/documents/fragments.d.ts +1 -1
- package/dist/types/src/api/graphql/documents/fragments.d.ts.map +1 -1
- package/dist/types/src/api/graphql/documents/queries.d.ts.map +1 -1
- package/dist/types/src/api/graphql/generated/fragment-document-nodes.d.ts.map +1 -1
- package/dist/types/src/api/graphql/generated/types.d.ts +12 -0
- package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
- package/dist/types/src/api/react.d.ts +3 -1
- package/dist/types/src/api/react.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
- package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
- package/dist/types/src/components/page/Page.d.ts.map +1 -1
- package/dist/types/src/controls/icon-radio-group.d.ts +1 -1
- package/dist/types/src/controls/icon-radio-group.d.ts.map +1 -1
- package/dist/types/src/controls/link.d.ts +1 -1
- package/dist/types/src/controls/link.d.ts.map +1 -1
- package/dist/types/src/controls/select.d.ts +1 -1
- package/dist/types/src/controls/select.d.ts.map +1 -1
- package/dist/types/src/controls/typography.d.ts +1 -1
- package/dist/types/src/controls/typography.d.ts.map +1 -1
- package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts +11 -2
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/next/index.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/style-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/typography.d.ts +2 -2
- package/dist/types/src/runtimes/react/controls/typography.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/getValue.d.ts +1 -1
- package/dist/types/src/slate/InlinePlugin/getValue.d.ts.map +1 -1
- package/dist/types/src/slate/LinkPlugin/getValue.d.ts.map +1 -1
- package/dist/types/src/slate/TextAlignPlugin/getValue.d.ts +4 -0
- package/dist/types/src/slate/TextAlignPlugin/getValue.d.ts.map +1 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/getValue.d.ts +4 -0
- package/dist/types/src/slate/TypographyPlugin/getValue.d.ts.map +1 -0
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/index.d.ts +0 -1
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/utils/responsive.d.ts +3 -5
- package/dist/types/src/slate/utils/responsive.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +7 -7
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/makeswift-api-client.d.ts +1 -1
- package/dist/types/src/state/makeswift-api-client.d.ts.map +1 -1
- package/dist/types/src/state/modules/breakpoints.d.ts +2 -0
- package/dist/types/src/state/modules/breakpoints.d.ts.map +1 -1
- package/dist/types/src/state/modules/locales.d.ts +6 -7
- package/dist/types/src/state/modules/locales.d.ts.map +1 -1
- package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
- package/dist/types/src/state/react-page.d.ts +3 -1
- package/dist/types/src/state/react-page.d.ts.map +1 -1
- package/dist/types/types/locale.d.ts +9 -0
- package/dist/types/types/locale.d.ts.map +1 -0
- package/dist/types.cjs2.js +8 -11
- package/dist/types.cjs2.js.map +1 -1
- package/dist/types.es2.js +9 -12
- package/dist/types.es2.js.map +1 -1
- package/dist/typography.cjs.js.map +1 -1
- package/dist/typography.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/src/slate/ColorPlugin/index.d.ts +0 -10
- package/dist/types/src/slate/ColorPlugin/index.d.ts.map +0 -1
package/dist/index.es5.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es5.js","sources":["../src/slate/TypographyPlugin/clearActiveTypographyStyle.ts","../src/slate/TypographyPlugin/clearDeviceActiveTypography.ts","../src/slate/TypographyPlugin/detachActiveTypography.ts","../src/slate/TypographyPlugin/setActiveTypographyId.ts","../src/slate/TypographyPlugin/setActiveTypographyStyle.ts","../src/slate/utils/responsive.ts","../src/slate/TypographyPlugin/index.ts"],"sourcesContent":["import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype ClearActiveTypographyStyleOptions = {\n at?: Range\n}\n\nexport function clearActiveTypographyStyle(\n editor: Editor,\n options?: ClearActiveTypographyStyleOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style: [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype ClearDeviceActiveTypographyOptions = {\n at?: Range\n}\n\nexport function clearDeviceActiveTypography(\n editor: Editor,\n currentDeviceId: string,\n options?: ClearDeviceActiveTypographyOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style:\n node?.typography?.style.filter(({ deviceId }) => deviceId !== currentDeviceId) ?? [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype SetActiveTypographyIdOptions = {\n at?: Range\n}\n\nexport function detachActiveTypography(\n editor: Editor,\n value: RichTextTypography['style'],\n options?: SetActiveTypographyIdOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n Transforms.setNodes(\n editor,\n {\n typography: {\n style: value,\n },\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\n\ntype SetActiveTypographyIdOptions = {\n at?: Range\n}\n\nexport function setActiveTypographyId(\n editor: Editor,\n id?: string,\n options?: SetActiveTypographyIdOptions,\n) {\n const at = options?.at ?? editor.selection\n if (!at) return\n Transforms.setNodes(\n editor,\n {\n typography: {\n id,\n style: [],\n },\n },\n {\n at,\n match: node => Text.isText(node),\n split: Range.isExpanded(at),\n },\n )\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { Breakpoints, findBreakpointOverride, BreakpointId } from '../../state/modules/breakpoints'\nimport { RichTextTypography } from '../types'\n\ntype SetActiveTypographyStyleOptions = {\n at?: Range\n}\n\nexport function setActiveTypographyStyle(\n editor: Editor,\n breakpoints: Breakpoints,\n deviceId: string,\n prop: string,\n value?: unknown,\n options?: SetActiveTypographyStyleOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const deviceOverrides = node?.typography?.style ?? []\n const deviceStyle = findBreakpointOverride(\n breakpoints,\n deviceOverrides,\n deviceId as BreakpointId,\n v => v,\n ) || {\n value: {},\n }\n const nextDeviceStyle = {\n deviceId,\n value: { ...deviceStyle.value, [prop]: value },\n }\n\n const nextTypography: RichTextTypography = {\n ...node.typography,\n style: [...deviceOverrides.filter(v => v.deviceId !== deviceId), nextDeviceStyle],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography: nextTypography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, NodeMatch, Descendant, NodeEntry } from 'slate'\nimport { getSelection } from '../selectors'\nimport deepEqual from '../../utils/deepEqual'\n\ntype SetResponsiveValueOptions<T extends Descendant> = {\n match: NodeMatch<T>\n split: boolean\n}\n\nexport function setResponsiveValue<T extends Descendant, K extends keyof T>(\n editor: Editor,\n key: K,\n value: T[K] | undefined,\n options: SetResponsiveValueOptions<T>,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = getSelection(editor)\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes<Descendant>(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: options.match,\n split: options.split,\n },\n )\n }\n\n if (atRef.current) {\n const nodesToUpdate = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: (node, path) => options.match(node, path) && node.slice === true,\n }),\n )\n\n for (const [, path] of nodesToUpdate) {\n Transforms.setNodes(\n editor,\n {\n [key]: value,\n },\n { at: path },\n )\n }\n }\n\n atRef.unref()\n })\n}\n\ntype GetResponsiveValueOptions<T extends Descendant> = {\n match: NodeMatch<T>\n}\n\nexport function getResponsiveValue<T extends Descendant, K extends keyof T>(\n editor: Editor,\n key: K,\n options: GetResponsiveValueOptions<T>,\n): T[K] | undefined {\n const matchingValues = Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: options?.match,\n }),\n )\n .filter(([node, path]) => options.match(node, path))\n .map(([node]) => node[key]) as (T[K] | undefined)[]\n\n const value =\n matchingValues.length === 0\n ? undefined\n : matchingValues.reduce((a, b) => (deepEqual(a, b) ? b : undefined))\n\n return value\n}\n\ntype NormalizeResponsiveValueOptions<T extends Descendant> = {\n match: NodeMatch<T>\n}\n\nexport function normalizeResponsiveValue<T extends Descendant, K extends keyof T & string>(\n editor: Editor,\n key: K,\n options: NormalizeResponsiveValueOptions<T>,\n) {\n return (entry: NodeEntry) => {\n const [node, path] = entry\n\n if (!options.match(node, path)) {\n return false\n }\n\n const responsiveValue = node?.[key]\n\n if (Array.isArray(responsiveValue) && responsiveValue.length === 0) {\n Transforms.unsetNodes(editor, key, { at: path })\n return true\n }\n\n if (node?.slice != null) {\n Transforms.unsetNodes(editor, 'slice', { at: path })\n return true\n }\n\n return false\n }\n}\n","import { Editor, Text, Transforms } from 'slate'\nimport { clearActiveTypographyStyle } from './clearActiveTypographyStyle'\nimport { clearDeviceActiveTypography } from './clearDeviceActiveTypography'\nimport { detachActiveTypography } from './detachActiveTypography'\nimport { setActiveTypographyId } from './setActiveTypographyId'\nimport { setActiveTypographyStyle } from './setActiveTypographyStyle'\nimport { createRichTextV2Plugin, unstable_Typography } from '../../controls'\nimport { getResponsiveValue, setResponsiveValue } from '../utils/responsive'\n\nexport const TypographyActions = {\n setActiveTypographyId,\n setActiveTypographyStyle,\n clearActiveTypographyStyle,\n clearDeviceActiveTypography,\n detachActiveTypography,\n}\n\nexport const TYPOGRAPHY_KEY = 'typography'\n\nexport function withTypography(editor: Editor) {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n if (\n Text.isText(normalizationNode) &&\n normalizationNode?.typography?.id == null &&\n normalizationNode?.typography?.style.length === 0\n ) {\n Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath })\n return\n }\n\n if (Text.isText(normalizationNode) && normalizationNode?.slice != null) {\n Transforms.unsetNodes(editor, 'slice', { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n\nexport function TypographyPlugin() {\n return createRichTextV2Plugin({\n withPlugin: withTypography,\n control: {\n definition: unstable_Typography(),\n onChange: (editor, value) => {\n setResponsiveValue(editor, TYPOGRAPHY_KEY, value, {\n match: Text.isText,\n split: true,\n })\n },\n getValue: editor => getResponsiveValue(editor, TYPOGRAPHY_KEY, { match: Text.isText }),\n getLeafValue: (text: Text) => {\n return Text.isText(text) ? text.typography : undefined\n },\n },\n renderLeaf: (renderLeaf, className) => props => {\n return renderLeaf({\n ...props,\n leaf: {\n ...props.leaf,\n className: `${props.leaf.className} ${className}`,\n },\n })\n },\n })\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,oCACL,QACA,SACA;AACO,SAAA,mBAAmB,QAAQ,MAAM;;AAChC,UAAA,KAAK,yCAAS,OAAT,YAAe,OAAO;AACjC,QAAI,CAAC;AAAI;AACT,UAAM,QAAQ,OAAO,SAAS,QAAQ,EAAE;AAExC,QAAI,MAAM,SAAS;AACjB,iBAAW,SACT,QACA;AAAA,QACE,OAAO;AAAA,MAAA,GAET;AAAA,QACE,IAAI,MAAM;AAAA,QACV,OAAO,CAAA,SAAQ,KAAK,OAAO,IAAI;AAAA,QAC/B,OAAO,MAAM,WAAW,MAAM,OAAO;AAAA,MAAA,CAEzC;AAAA,IACF;AAEA,QAAI,MAAM,SAAS;AACjB,YAAM,YAAY,MAAM,KACtB,OAAO,MAAM,QAAQ;AAAA,QACnB,IAAI,MAAM;AAAA,QACV,OAAO,CAAQ,SAAA,KAAK,OAAO,IAAI,KAAK,KAAK,UAAU;AAAA,MACpD,CAAA,CACH;AAEW,iBAAA,CAAC,MAAM,SAAS,WAAW;AAChC,YAAA,KAAK,OAAO,IAAI,GAAG;AACrB,gBAAM,aAAiC,iCAClC,KAAK,aAD6B;AAAA,YAErC,OAAO,CAAC;AAAA,UAAA;AAGV,qBAAW,SACT,QACA;AAAA,YACE;AAAA,UAAA,GAEF,EAAE,IAAI,KAAA,CACR;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,UAAM,MAAM;AAAA,EAAA,CACb;AACH;AClDE,qCAAA,QACA,iBACA,SACA;AACO,SAAA,mBAAmB,QAAQ,MAAM;;AAChC,UAAA,KAAK,yCAAS,OAAT,YAAe,OAAO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AgB;AAC7C,QAAM,EAAE,kBAAkB;AAC1B,SAAO,gBAAgB,CAAS,UAAA;;AACxB,UAAA,CAAC,mBAAmB,qBAAqB;AAC/C,QACE,KAAK,OAAO,iBAAiB,KAC7B,8DAAmB,eAAnB,mBAA+B,OAAM,QACrC,8DAAmB,eAAnB,mBAA+B,MAAM,YAAW,GAChD;AACA,iBAAW,WAAW,QAAQ,gBAAgB,EAAE,IAAI,mBAAmB;AACvE;AAAA,IACF;AAEA,QAAI,KAAK,OAAO,iBAAiB,KAAK,wDAAmB,UAAS,MAAM;AACtE,iBAAW,WAAW,QAAQ,SAAS,EAAE,IAAI,mBAAmB;AAChE;AAAA,IACF;AAEA,kBAAc,KAAK;AAAA,EAAA;AAGd,SAAA;AACT;AAEmC,4BAAA;AACjC,SAAO,uBAAuB;AAAA,IAC5B,YAAY;AAAA,IACZ,SAAS;AAAA,MACP,YAAY,oBAAoB;AAAA,MAChC,UAAU,CAAC,QAAQ,UAAU;AACR,2BAAA,QAAQ,gBAAgB,OAAO;AAAA,UAChD,OAAO,KAAK;AAAA,UACZ,OAAO;AAAA,QAAA,CACR;AAAA,MACH;AAAA,MACA,UAAU,YAAU,mBAAmB,QAAQ,gBAAgB,EAAE,OAAO,KAAK,QAAQ;AAAA,MACrF,cAAc,CAAC,SAAe;AAC5B,eAAO,KAAK,OAAO,IAAI,IAAI,KAAK,aAAa;AAAA,MAC/C;AAAA,IACF;AAAA,IACA,YAAY,CAAC,YAAY,cAAc,CAAS,UAAA;AAC9C,aAAO,WAAW,iCACb,QADa;AAAA,QAEhB,MAAM,iCACD,MAAM,OADL;AAAA,UAEJ,WAAW,GAAG,MAAM,KAAK,aAAa;AAAA,QACxC;AAAA,MAAA,EACD;AAAA,IACH;AAAA,EAAA,CACD;AACH;;"}
|
|
1
|
+
{"version":3,"file":"index.es5.js","sources":["../src/slate/TypographyPlugin/clearActiveTypographyStyle.ts","../src/slate/TypographyPlugin/clearDeviceActiveTypography.ts","../src/slate/TypographyPlugin/detachActiveTypography.ts","../src/slate/TypographyPlugin/setActiveTypographyId.ts","../src/slate/TypographyPlugin/setActiveTypographyStyle.ts","../src/slate/utils/responsive.ts","../src/slate/TypographyPlugin/getValue.tsx","../src/slate/TypographyPlugin/index.ts"],"sourcesContent":["import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype ClearActiveTypographyStyleOptions = {\n at?: Range\n}\n\nexport function clearActiveTypographyStyle(\n editor: Editor,\n options?: ClearActiveTypographyStyleOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style: [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype ClearDeviceActiveTypographyOptions = {\n at?: Range\n}\n\nexport function clearDeviceActiveTypography(\n editor: Editor,\n currentDeviceId: string,\n options?: ClearDeviceActiveTypographyOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const typography: RichTextTypography = {\n ...node.typography,\n style:\n node?.typography?.style.filter(({ deviceId }) => deviceId !== currentDeviceId) ?? [],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { RichTextTypography } from '../types'\n\ntype SetActiveTypographyIdOptions = {\n at?: Range\n}\n\nexport function detachActiveTypography(\n editor: Editor,\n value: RichTextTypography['style'],\n options?: SetActiveTypographyIdOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n Transforms.setNodes(\n editor,\n {\n typography: {\n style: value,\n },\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\n\ntype SetActiveTypographyIdOptions = {\n at?: Range\n}\n\nexport function setActiveTypographyId(\n editor: Editor,\n id?: string,\n options?: SetActiveTypographyIdOptions,\n) {\n const at = options?.at ?? editor.selection\n if (!at) return\n Transforms.setNodes(\n editor,\n {\n typography: {\n id,\n style: [],\n },\n },\n {\n at,\n match: node => Text.isText(node),\n split: Range.isExpanded(at),\n },\n )\n}\n","import { Editor, Transforms, Text, Range } from 'slate'\nimport { Breakpoints, findBreakpointOverride, BreakpointId } from '../../state/modules/breakpoints'\nimport { RichTextTypography } from '../types'\n\ntype SetActiveTypographyStyleOptions = {\n at?: Range\n}\n\nexport function setActiveTypographyStyle(\n editor: Editor,\n breakpoints: Breakpoints,\n deviceId: string,\n prop: string,\n value?: unknown,\n options?: SetActiveTypographyStyleOptions,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = options?.at ?? editor.selection\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: node => Text.isText(node),\n split: Range.isExpanded(atRef.current),\n },\n )\n }\n\n if (atRef.current) {\n const textNodes = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: node => Text.isText(node) && node.slice === true,\n }),\n )\n\n for (const [node, path] of textNodes) {\n if (Text.isText(node)) {\n const deviceOverrides = node?.typography?.style ?? []\n const deviceStyle = findBreakpointOverride(\n breakpoints,\n deviceOverrides,\n deviceId as BreakpointId,\n v => v,\n ) || {\n value: {},\n }\n const nextDeviceStyle = {\n deviceId,\n value: { ...deviceStyle.value, [prop]: value },\n }\n\n const nextTypography: RichTextTypography = {\n ...node.typography,\n style: [...deviceOverrides.filter(v => v.deviceId !== deviceId), nextDeviceStyle],\n }\n\n Transforms.setNodes(\n editor,\n {\n typography: nextTypography,\n },\n { at: path },\n )\n }\n }\n }\n\n atRef.unref()\n })\n}\n","import { Editor, Transforms, NodeMatch, Descendant, NodeEntry } from 'slate'\nimport { getSelection } from '../selectors'\nimport { ResponsiveValue } from '../../prop-controllers'\nimport shallowEqual from '../../utils/shallowEqual'\nimport { BlockTextAlignment } from '../types'\n\ntype SetResponsiveValueOptions<T extends Descendant> = {\n match: NodeMatch<T>\n split: boolean\n}\n\nexport function setResponsiveValue<T extends Descendant, K extends keyof T>(\n editor: Editor,\n key: K,\n value: T[K] | undefined | null,\n options: SetResponsiveValueOptions<T>,\n) {\n Editor.withoutNormalizing(editor, () => {\n const at = getSelection(editor)\n if (!at) return\n const atRef = Editor.rangeRef(editor, at)\n\n if (atRef.current) {\n Transforms.setNodes<Descendant>(\n editor,\n {\n slice: true,\n },\n {\n at: atRef.current,\n match: options.match,\n split: options.split,\n },\n )\n }\n\n if (atRef.current) {\n const nodesToUpdate = Array.from(\n Editor.nodes(editor, {\n at: atRef.current,\n match: (node, path) => options.match(node, path) && node.slice === true,\n }),\n )\n\n for (const [, path] of nodesToUpdate) {\n Transforms.setNodes(\n editor,\n {\n [key]: value,\n },\n { at: path },\n )\n }\n }\n\n atRef.unref()\n })\n}\n\ntype NormalizeResponsiveValueOptions<T extends Descendant> = {\n match: NodeMatch<T>\n}\n\nexport function normalizeResponsiveValue<T extends Descendant, K extends keyof T & string>(\n editor: Editor,\n key: K,\n options: NormalizeResponsiveValueOptions<T>,\n) {\n return (entry: NodeEntry) => {\n const [node, path] = entry\n\n if (!options.match(node, path)) {\n return false\n }\n\n const responsiveValue = node?.[key]\n\n if (Array.isArray(responsiveValue) && responsiveValue.length === 0) {\n Transforms.unsetNodes(editor, key, { at: path })\n return true\n }\n\n if (node?.slice != null) {\n Transforms.unsetNodes(editor, 'slice', { at: path })\n return true\n }\n\n return false\n }\n}\n\nexport function responsiveShallowEqual<T>(\n a: ResponsiveValue<T> = [],\n b: ResponsiveValue<T> = [],\n): ResponsiveValue<T> {\n const aObject: Record<string, BlockTextAlignment> = a.reduce(\n (acc, curr) => ({\n ...acc,\n [curr.deviceId]: curr.value,\n }),\n {},\n )\n const bObject: Record<string, BlockTextAlignment> = b.reduce(\n (acc, curr) => ({\n ...acc,\n [curr.deviceId]: curr.value,\n }),\n {},\n )\n\n const definedDevices = new Set([...a.map(a => a.deviceId), ...b.map(b => b.deviceId)])\n\n return Array.from(definedDevices).map(deviceId => {\n const aVal = aObject[deviceId]\n const bVal = bObject[deviceId]\n\n if (aVal === undefined && bVal === undefined) return { deviceId, value: undefined }\n\n return shallowEqual(aVal, bVal) ? { deviceId, value: aVal } : { deviceId, value: null }\n }) as ResponsiveValue<T>\n}\n","import { Editor, Text } from 'slate'\nimport { RichTextTypography } from '../types'\nimport { getSelection } from '../selectors'\nimport deepEqual from '../../utils/deepEqual'\n\nexport function getValue(editor: Editor) {\n const matchingValues = Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: Text.isText,\n }),\n ).map(([node]) => node['typography']) as (RichTextTypography | undefined)[]\n\n if (matchingValues.length === 0) {\n return undefined\n }\n\n return (\n matchingValues.reduce((a, b) => (deepEqual(a, b) ? b : undefined), matchingValues.at(0)) ?? null\n )\n}\n","import { Editor, Text, Transforms } from 'slate'\nimport { clearActiveTypographyStyle } from './clearActiveTypographyStyle'\nimport { clearDeviceActiveTypography } from './clearDeviceActiveTypography'\nimport { detachActiveTypography } from './detachActiveTypography'\nimport { setActiveTypographyId } from './setActiveTypographyId'\nimport { setActiveTypographyStyle } from './setActiveTypographyStyle'\nimport { createRichTextV2Plugin, unstable_Typography } from '../../controls'\nimport { setResponsiveValue } from '../utils/responsive'\nimport { getValue } from './getValue'\n\nexport const TypographyActions = {\n setActiveTypographyId,\n setActiveTypographyStyle,\n clearActiveTypographyStyle,\n clearDeviceActiveTypography,\n detachActiveTypography,\n}\n\nexport const TYPOGRAPHY_KEY = 'typography'\n\nexport function withTypography(editor: Editor) {\n const { normalizeNode } = editor\n editor.normalizeNode = entry => {\n const [normalizationNode, normalizationPath] = entry\n if (\n Text.isText(normalizationNode) &&\n normalizationNode?.typography?.id == null &&\n normalizationNode?.typography?.style.length === 0\n ) {\n Transforms.unsetNodes(editor, TYPOGRAPHY_KEY, { at: normalizationPath })\n return\n }\n\n if (Text.isText(normalizationNode) && normalizationNode?.slice != null) {\n Transforms.unsetNodes(editor, 'slice', { at: normalizationPath })\n return\n }\n\n normalizeNode(entry)\n }\n\n return editor\n}\n\nexport function TypographyPlugin() {\n return createRichTextV2Plugin({\n withPlugin: withTypography,\n control: {\n definition: unstable_Typography(),\n onChange: (editor, value) => {\n setResponsiveValue(editor, TYPOGRAPHY_KEY, value, {\n match: Text.isText,\n split: true,\n })\n },\n getValue: editor => getValue(editor),\n getLeafValue: (text: Text) => {\n return Text.isText(text) ? text.typography : undefined\n },\n },\n renderLeaf: (renderLeaf, className) => props => {\n return renderLeaf({\n ...props,\n leaf: {\n ...props.leaf,\n className: `${props.leaf.className} ${className}`,\n },\n })\n },\n })\n}\n"],"names":["editor","matchingValues","Array","from","Editor","nodes","at","getSelection","match","Text","isText","map","node","length","undefined","reduce","a","b","deepEqual"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,oCACL,QACA,SACA;AACO,SAAA,mBAAmB,QAAQ,MAAM;;AAChC,UAAA,KAAK,yCAAS,OAAT,YAAe,OAAO;AACjC,QAAI,CAAC;AAAI;AACT,UAAM,QAAQ,OAAO,SAAS,QAAQ,EAAE;AAExC,QAAI,MAAM,SAAS;AACjB,iBAAW,SACT,QACA;AAAA,QACE,OAAO;AAAA,MAAA,GAET;AAAA,QACE,IAAI,MAAM;AAAA,QACV,OAAO,CAAA,SAAQ,KAAK,OAAO,IAAI;AAAA,QAC/B,OAAO,MAAM,WAAW,MAAM,OAAO;AAAA,MAAA,CAEzC;AAAA,IACF;AAEA,QAAI,MAAM,SAAS;AACjB,YAAM,YAAY,MAAM,KACtB,OAAO,MAAM,QAAQ;AAAA,QACnB,IAAI,MAAM;AAAA,QACV,OAAO,CAAQ,SAAA,KAAK,OAAO,IAAI,KAAK,KAAK,UAAU;AAAA,MACpD,CAAA,CACH;AAEW,iBAAA,CAAC,MAAM,SAAS,WAAW;AAChC,YAAA,KAAK,OAAO,IAAI,GAAG;AACrB,gBAAM,aAAiC,iCAClC,KAAK,aAD6B;AAAA,YAErC,OAAO,CAAC;AAAA,UAAA;AAGV,qBAAW,SACT,QACA;AAAA,YACE;AAAA,UAAA,GAEF,EAAE,IAAI,KAAA,CACR;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,UAAM,MAAM;AAAA,EAAA,CACb;AACH;AClDE,qCAAA,QACA,iBACA,SACA;AACO,SAAA,mBAAmB,QAAQ,MAAM;;AAChC,UAAA,KAAK,yCAAS,OAAT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AAO,uBAAuB;AAAA,IAC5B,YAAY;AAAA,IACZ,SAAS;AAAA,MACP,YAAY,oBAAoB;AAAA,MAChC,UAAU,CAAC,QAAQ,UAAU;AACR,2BAAA,QAAQ,gBAAgB,OAAO;AAAA,UAChD,OAAO,KAAK;AAAA,UACZ,OAAO;AAAA,QAAA,CACR;AAAA,MACH;AAAA,MACA,UAAU,CAAU,WAAA,SAAS,MAAM;AAAA,MACnC,cAAc,CAAC,SAAe;AAC5B,eAAO,KAAK,OAAO,IAAI,IAAI,KAAK,aAAa;AAAA,MAC/C;AAAA,IACF;AAAA,IACA,YAAY,CAAC,YAAY,cAAc,CAAS,UAAA;AAC9C,aAAO,WAAW,iCACb,QADa;AAAA,QAEhB,MAAM,iCACD,MAAM,OADL;AAAA,UAEJ,WAAW,GAAG,MAAM,KAAK,aAAa;AAAA,QACxC;AAAA,MAAA,EACD;AAAA,IACH;AAAA,EAAA,CACD;AACH;;"}
|
package/dist/index.es6.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Path, Transforms } from "slate";
|
|
2
2
|
import isHotkey from "is-hotkey";
|
|
3
|
-
import {
|
|
3
|
+
import { bf as BlockType, b9 as createRichTextV2Plugin } from "./react-page.es.js";
|
|
4
4
|
import { E as ElementUtils } from "./types.es2.js";
|
|
5
5
|
const BLOCK_ONE_PATH = [0];
|
|
6
6
|
const BLOCK_TWO_PATH = [1];
|
package/dist/index.es8.js
CHANGED
|
@@ -7,6 +7,7 @@ import "./react-page.es.js";
|
|
|
7
7
|
import "redux";
|
|
8
8
|
import "redux-thunk";
|
|
9
9
|
import "./actions.es.js";
|
|
10
|
+
import "zod";
|
|
10
11
|
import "./state/breakpoints.es.js";
|
|
11
12
|
import "@emotion/css";
|
|
12
13
|
import "@emotion/serialize";
|
|
@@ -24,7 +25,6 @@ import "scroll-into-view-if-needed";
|
|
|
24
25
|
import "react-dom";
|
|
25
26
|
import "html-react-parser";
|
|
26
27
|
import "next/head";
|
|
27
|
-
import "zod";
|
|
28
28
|
import "@emotion/server/create-instance";
|
|
29
29
|
import "next/document";
|
|
30
30
|
import "cors";
|
package/dist/index.es9.js
CHANGED
|
@@ -34,21 +34,21 @@ import { Range, createEditor } from "slate";
|
|
|
34
34
|
import isHotkey from "is-hotkey";
|
|
35
35
|
import { withHistory, HistoryEditor } from "slate-history";
|
|
36
36
|
import { ReactEditor, withReact, Slate, Editable } from "slate-react";
|
|
37
|
-
import { U as useStyle,
|
|
38
|
-
import {
|
|
39
|
-
import "@emotion/serialize";
|
|
40
|
-
import "@emotion/utils";
|
|
41
|
-
import { O as ControlValue, Q as useBuilderEditMode, T as pollBoxModel } from "./index.es.js";
|
|
37
|
+
import { U as useStyle, b8 as RichTextV2Mode, bf as BlockType, bo as BuilderEditMode } from "./react-page.es.js";
|
|
38
|
+
import { Q as ControlValue, T as useBuilderEditMode, U as pollBoxModel } from "./index.es.js";
|
|
42
39
|
import "./state/breakpoints.es.js";
|
|
43
40
|
import "./types.es2.js";
|
|
44
41
|
import { I as InlineModePlugin } from "./index.es6.js";
|
|
45
42
|
import { w as withBuilder } from "./index.es7.js";
|
|
46
43
|
import { jsx } from "react/jsx-runtime";
|
|
47
44
|
import "./index.es3.js";
|
|
45
|
+
import { cx } from "@emotion/css";
|
|
48
46
|
import { u as useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.es.js";
|
|
47
|
+
import "./actions.es.js";
|
|
49
48
|
import "redux";
|
|
50
49
|
import "redux-thunk";
|
|
51
|
-
import "
|
|
50
|
+
import "@emotion/serialize";
|
|
51
|
+
import "@emotion/utils";
|
|
52
52
|
import "use-sync-external-store/shim/with-selector";
|
|
53
53
|
import "next/dynamic";
|
|
54
54
|
import "./typography.es.js";
|
package/dist/main.cjs.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
var actions = require("./actions.cjs.js");
|
|
4
4
|
var reactPage = require("./react-page.cjs.js");
|
|
5
5
|
var constants = require("./constants.cjs.js");
|
|
6
|
+
require("zod");
|
|
6
7
|
require("redux");
|
|
7
8
|
require("redux-thunk");
|
|
8
9
|
require("./state/breakpoints.cjs.js");
|
package/dist/main.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/main.es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { A as ActionTypes, h as builderPointerMove, d as changeApiResource, c as changeDocument, a as changeDocumentElementScrollTop, g as changePathname, b as cleanUp, e as evictApiResource, i as init, m as messageHostPropController, r as registerDocument, s as scrollDocumentElement, j as setBreakpoints, f as setBuilderEditMode, k as setLocale, l as setLocales, u as unregisterDocument } from "./actions.es.js";
|
|
2
2
|
export { C as ComponentIcon, c as createDocument } from "./react-page.es.js";
|
|
3
3
|
export { M as MakeswiftComponentType } from "./constants.es.js";
|
|
4
|
+
import "zod";
|
|
4
5
|
import "redux";
|
|
5
6
|
import "redux-thunk";
|
|
6
7
|
import "./state/breakpoints.es.js";
|
package/dist/main.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
package/dist/next.cjs.js
CHANGED
|
@@ -9,6 +9,7 @@ require("./react-page.cjs.js");
|
|
|
9
9
|
require("redux");
|
|
10
10
|
require("redux-thunk");
|
|
11
11
|
require("./actions.cjs.js");
|
|
12
|
+
require("zod");
|
|
12
13
|
require("./state/breakpoints.cjs.js");
|
|
13
14
|
require("@emotion/css");
|
|
14
15
|
require("@emotion/serialize");
|
|
@@ -25,7 +26,6 @@ require("scroll-into-view-if-needed");
|
|
|
25
26
|
require("react-dom");
|
|
26
27
|
require("html-react-parser");
|
|
27
28
|
require("next/head");
|
|
28
|
-
require("zod");
|
|
29
29
|
require("@emotion/server/create-instance");
|
|
30
30
|
require("next/document");
|
|
31
31
|
require("cors");
|
package/dist/next.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
export {
|
|
2
|
+
export { a1 as Document, $ as Makeswift, a2 as MakeswiftApiHandler, _ as Page, a0 as PreviewModeScript, B as forwardNextDynamicRef, Z as getServerSideProps, X as getStaticPaths, Y as getStaticProps } from "./index.es.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "use-sync-external-store/shim/with-selector";
|
|
5
5
|
import "next/dynamic";
|
|
@@ -7,6 +7,7 @@ import "./react-page.es.js";
|
|
|
7
7
|
import "redux";
|
|
8
8
|
import "redux-thunk";
|
|
9
9
|
import "./actions.es.js";
|
|
10
|
+
import "zod";
|
|
10
11
|
import "./state/breakpoints.es.js";
|
|
11
12
|
import "@emotion/css";
|
|
12
13
|
import "@emotion/serialize";
|
|
@@ -23,7 +24,6 @@ import "scroll-into-view-if-needed";
|
|
|
23
24
|
import "react-dom";
|
|
24
25
|
import "html-react-parser";
|
|
25
26
|
import "next/head";
|
|
26
|
-
import "zod";
|
|
27
27
|
import "@emotion/server/create-instance";
|
|
28
28
|
import "next/document";
|
|
29
29
|
import "cors";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-controllers.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prop-controllers.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-controllers.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prop-controllers.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/dist/react-page.cjs.js
CHANGED
|
@@ -35,28 +35,8 @@ var slate = require("slate");
|
|
|
35
35
|
function _interopDefaultLegacy(e) {
|
|
36
36
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
37
37
|
}
|
|
38
|
-
function _interopNamespace(e) {
|
|
39
|
-
if (e && e.__esModule)
|
|
40
|
-
return e;
|
|
41
|
-
var n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
42
|
-
if (e) {
|
|
43
|
-
Object.keys(e).forEach(function(k) {
|
|
44
|
-
if (k !== "default") {
|
|
45
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
46
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
get: function() {
|
|
49
|
-
return e[k];
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
n["default"] = e;
|
|
56
|
-
return Object.freeze(n);
|
|
57
|
-
}
|
|
58
38
|
var thunk__default = /* @__PURE__ */ _interopDefaultLegacy(thunk);
|
|
59
|
-
var
|
|
39
|
+
var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
|
|
60
40
|
const ComponentIcon = {
|
|
61
41
|
Billing: "billing",
|
|
62
42
|
Bolt: "bolt",
|
|
@@ -309,6 +289,13 @@ function reducer$1(state = getInitialState(), action) {
|
|
|
309
289
|
return state;
|
|
310
290
|
}
|
|
311
291
|
}
|
|
292
|
+
function parseLocalesInput(input) {
|
|
293
|
+
return {
|
|
294
|
+
locales: input.locales.map((locale) => actions.localeStringSchema.parse(locale)),
|
|
295
|
+
defaultLocale: actions.localeStringSchema.parse(input.defaultLocale),
|
|
296
|
+
locale: null
|
|
297
|
+
};
|
|
298
|
+
}
|
|
312
299
|
const ColorControlType = "makeswift::controls::color";
|
|
313
300
|
function Color(config = {}) {
|
|
314
301
|
return { type: ColorControlType, config };
|
|
@@ -1925,7 +1912,7 @@ function merge(definition, a, b = a, context) {
|
|
|
1925
1912
|
}
|
|
1926
1913
|
const isServer = typeof window === "undefined";
|
|
1927
1914
|
const useInsertionEffectSpecifier = "useInsertionEffect";
|
|
1928
|
-
const useInsertionEffect = (_a =
|
|
1915
|
+
const useInsertionEffect = (_a = React__default["default"][useInsertionEffectSpecifier]) != null ? _a : React__default["default"].useLayoutEffect;
|
|
1929
1916
|
function useStyle(style) {
|
|
1930
1917
|
const serialized = serialize.serializeStyles([style], css.cache.registered);
|
|
1931
1918
|
utils.registerStyles(css.cache, serialized, false);
|
|
@@ -2103,6 +2090,7 @@ function richTextDTOtoDAO(data) {
|
|
|
2103
2090
|
return (_c = (_b = (_a2 = data.document) == null ? void 0 : _a2.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c : [];
|
|
2104
2091
|
}
|
|
2105
2092
|
function toInlineOrTextDTO(node) {
|
|
2093
|
+
var _a2;
|
|
2106
2094
|
if (isText(node)) {
|
|
2107
2095
|
return [
|
|
2108
2096
|
{
|
|
@@ -2127,7 +2115,7 @@ function toInlineOrTextDTO(node) {
|
|
|
2127
2115
|
object: ObjectType.Inline,
|
|
2128
2116
|
nodes: node.children.flatMap(toInlineOrTextDTO),
|
|
2129
2117
|
type: node.type,
|
|
2130
|
-
data: node.link
|
|
2118
|
+
data: (_a2 = node.link) != null ? _a2 : void 0
|
|
2131
2119
|
}
|
|
2132
2120
|
];
|
|
2133
2121
|
case InlineType.Code:
|
|
@@ -2464,7 +2452,7 @@ function getTypographyStyleSwatchIds(style) {
|
|
|
2464
2452
|
}).filter(isNonNullable)) != null ? _a2 : [];
|
|
2465
2453
|
}
|
|
2466
2454
|
function getSwatchIds(descriptor, prop) {
|
|
2467
|
-
var _a2;
|
|
2455
|
+
var _a2, _b;
|
|
2468
2456
|
if (prop == null)
|
|
2469
2457
|
return [];
|
|
2470
2458
|
switch (descriptor.type) {
|
|
@@ -2475,12 +2463,12 @@ function getSwatchIds(descriptor, prop) {
|
|
|
2475
2463
|
case Types.NavigationLinks: {
|
|
2476
2464
|
const value = prop;
|
|
2477
2465
|
return (_a2 = value == null ? void 0 : value.flatMap((item) => {
|
|
2478
|
-
var _a3,
|
|
2466
|
+
var _a3, _b2, _c, _d;
|
|
2479
2467
|
switch (item.type) {
|
|
2480
2468
|
case "button":
|
|
2481
2469
|
case "dropdown":
|
|
2482
2470
|
return [
|
|
2483
|
-
...(
|
|
2471
|
+
...(_b2 = (_a3 = item.payload.color) == null ? void 0 : _a3.map((override) => override.value).map((color) => color.swatchId)) != null ? _b2 : [],
|
|
2484
2472
|
...(_d = (_c = item.payload.textColor) == null ? void 0 : _c.map((override) => override.value).map((color) => color.swatchId)) != null ? _d : []
|
|
2485
2473
|
];
|
|
2486
2474
|
}
|
|
@@ -2492,20 +2480,20 @@ function getSwatchIds(descriptor, prop) {
|
|
|
2492
2480
|
return getBoxShadowsSwatchIds(prop);
|
|
2493
2481
|
case Types.RichText: {
|
|
2494
2482
|
let getNodeSwatchIds = function(node) {
|
|
2495
|
-
var _a3,
|
|
2483
|
+
var _a3, _b2, _c, _d;
|
|
2496
2484
|
switch (node.object) {
|
|
2497
2485
|
case "document":
|
|
2498
2486
|
case "block":
|
|
2499
2487
|
case "inline":
|
|
2500
|
-
return (
|
|
2488
|
+
return (_b2 = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodeSwatchIds)) != null ? _b2 : [];
|
|
2501
2489
|
case "text":
|
|
2502
2490
|
return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
|
|
2503
2491
|
default:
|
|
2504
2492
|
return [];
|
|
2505
2493
|
}
|
|
2506
2494
|
}, getMarkSwatchIds = function(mark) {
|
|
2507
|
-
var _a3,
|
|
2508
|
-
return getTypographyStyleSwatchIds((
|
|
2495
|
+
var _a3, _b2;
|
|
2496
|
+
return getTypographyStyleSwatchIds((_b2 = (_a3 = mark.data) == null ? void 0 : _a3.value) == null ? void 0 : _b2.style);
|
|
2509
2497
|
};
|
|
2510
2498
|
const value = prop;
|
|
2511
2499
|
if (value == null || value.document == null)
|
|
@@ -2518,7 +2506,7 @@ function getSwatchIds(descriptor, prop) {
|
|
|
2518
2506
|
}
|
|
2519
2507
|
case StyleV2ControlType: {
|
|
2520
2508
|
const value = prop;
|
|
2521
|
-
return value.flatMap((value2) => getSwatchIds(descriptor.config.type, value2.value));
|
|
2509
|
+
return (_b = value == null ? void 0 : value.flatMap((value2) => getSwatchIds(descriptor.config.type, value2.value))) != null ? _b : [];
|
|
2522
2510
|
}
|
|
2523
2511
|
case RichTextV2ControlType: {
|
|
2524
2512
|
let getDescendantSwatchIds = function(descendant) {
|
|
@@ -2688,6 +2676,8 @@ function getPageIds(descriptor, prop) {
|
|
|
2688
2676
|
switch (value.type) {
|
|
2689
2677
|
case "OPEN_PAGE":
|
|
2690
2678
|
return value.payload.pageId == null ? [] : [value.payload.pageId];
|
|
2679
|
+
default:
|
|
2680
|
+
return [];
|
|
2691
2681
|
}
|
|
2692
2682
|
}
|
|
2693
2683
|
case Types.NavigationLinks: {
|
|
@@ -2944,7 +2934,10 @@ function getBreakpoints(state) {
|
|
|
2944
2934
|
return state.breakpoints;
|
|
2945
2935
|
}
|
|
2946
2936
|
function getLocales(state) {
|
|
2947
|
-
return state.locales;
|
|
2937
|
+
return state.locales.locales.map((locale) => new Intl.Locale(locale));
|
|
2938
|
+
}
|
|
2939
|
+
function getDefaultLocale(state) {
|
|
2940
|
+
return state.locales.defaultLocale ? new Intl.Locale(state.locales.defaultLocale) : null;
|
|
2948
2941
|
}
|
|
2949
2942
|
function configureStore({
|
|
2950
2943
|
rootElements,
|
|
@@ -3066,6 +3059,7 @@ exports.getBuilderEditMode = getBuilderEditMode;
|
|
|
3066
3059
|
exports.getComponentPropControllerDescriptors = getComponentPropControllerDescriptors;
|
|
3067
3060
|
exports.getComponentPropControllerDescriptors$1 = getComponentPropControllerDescriptors$1;
|
|
3068
3061
|
exports.getComponentsMeta = getComponentsMeta;
|
|
3062
|
+
exports.getDefaultLocale = getDefaultLocale;
|
|
3069
3063
|
exports.getDocument = getDocument;
|
|
3070
3064
|
exports.getDocument$1 = getDocument$1;
|
|
3071
3065
|
exports.getDocumentKeysSortedByDepth = getDocumentKeysSortedByDepth;
|
|
@@ -3097,6 +3091,7 @@ exports.isNonNullable = isNonNullable;
|
|
|
3097
3091
|
exports.isPropControllersHandle = isPropControllersHandle;
|
|
3098
3092
|
exports.merge = merge;
|
|
3099
3093
|
exports.mergeSlotData = mergeSlotData;
|
|
3094
|
+
exports.parseLocalesInput = parseLocalesInput;
|
|
3100
3095
|
exports.reducer = reducer$8;
|
|
3101
3096
|
exports.reducer$1 = reducer$7;
|
|
3102
3097
|
exports.reducer$2 = reducer$9;
|