@makeswift/runtime 0.1.4 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Box.cjs.js +4 -3
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +5 -4
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +5 -3
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +16 -14
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +4 -3
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +5 -4
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +4 -3
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +5 -4
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +4 -3
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +5 -4
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +4 -3
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +5 -4
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +7 -3
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +9 -5
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs2.js +6 -4
- package/dist/Image.cjs2.js.map +1 -1
- package/dist/Image.es2.js +10 -8
- package/dist/Image.es2.js.map +1 -1
- package/dist/Navigation.cjs.js +4 -3
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +5 -4
- package/dist/Navigation.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +3 -2
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +4 -3
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +4 -3
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +6 -5
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +4 -3
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +5 -4
- package/dist/Video.es.js.map +1 -1
- package/dist/components.cjs.js +1 -1
- package/dist/components.es.js +1 -1
- package/dist/cssMediaRules.es.js +1 -1
- package/dist/index.cjs.js +13 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +14 -32
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +1 -1
- package/dist/index.es3.js +1 -1
- package/dist/next.es.js +1 -1
- package/dist/react-builder-preview.es.js +1 -1
- package/dist/types/api/react.d.ts.map +1 -1
- package/dist/types/components/builtin/Box/Box.d.ts +2 -2
- package/dist/types/components/builtin/Box/Box.d.ts.map +1 -1
- package/dist/types/components/builtin/Button/Button.d.ts +2 -1
- package/dist/types/components/builtin/Button/Button.d.ts.map +1 -1
- package/dist/types/components/builtin/Carousel/Carousel.d.ts +2 -2
- package/dist/types/components/builtin/Carousel/Carousel.d.ts.map +1 -1
- package/dist/types/components/builtin/Carousel/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Countdown/Countdown.d.ts +2 -2
- package/dist/types/components/builtin/Countdown/Countdown.d.ts.map +1 -1
- package/dist/types/components/builtin/Countdown/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Divider/Divider.d.ts +2 -2
- package/dist/types/components/builtin/Divider/Divider.d.ts.map +1 -1
- package/dist/types/components/builtin/Divider/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Embed/Embed.d.ts +2 -2
- package/dist/types/components/builtin/Embed/Embed.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/Form.d.ts +2 -2
- package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/components/Placeholder/index.d.ts +2 -1
- package/dist/types/components/builtin/Form/components/Placeholder/index.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Image/Image.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/Navigation.d.ts +2 -2
- package/dist/types/components/builtin/Navigation/Navigation.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/register.d.ts.map +1 -1
- package/dist/types/components/builtin/SocialLinks/SocialLinks.d.ts +2 -2
- package/dist/types/components/builtin/SocialLinks/SocialLinks.d.ts.map +1 -1
- package/dist/types/components/builtin/SocialLinks/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Text/Text.d.ts +2 -2
- package/dist/types/components/builtin/Text/Text.d.ts.map +1 -1
- package/dist/types/components/builtin/Text/register.d.ts.map +1 -1
- package/dist/types/components/builtin/Video/Video.d.ts +2 -2
- package/dist/types/components/builtin/Video/Video.d.ts.map +1 -1
- package/dist/types/components/builtin/Video/register.d.ts.map +1 -1
- package/dist/useBoxShadow.es.js +1 -1
- package/dist/useMediaQuery.es.js +1 -1
- package/package.json +1 -1
package/dist/Text.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.es.js","sources":["../src/components/hooks/useTypography.ts","../src/components/builtin/Text/components/RichTextEditor/components/Mark/hooks/useTypographyMark.ts","../src/components/builtin/Text/components/RichTextEditor/components/Mark/index.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesMarks.tsx","../src/components/builtin/Text/components/RichTextEditor/components/Block/index.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesBlocks.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/Link.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/Inlines.tsx","../src/components/builtin/Text/components/RichTextEditor/index.tsx","../src/components/builtin/Text/Text.tsx"],"sourcesContent":["import type { ColorValue } from '../utils/types'\nimport type { Length as LengthValue } from '../../prop-controllers'\nimport { DeviceOverride } from '../../prop-controllers'\nimport { TYPOGRAPHIES_BY_ID } from '../utils/queries'\nimport { useQuery } from '../../api/react'\n\nexport type TypographyStyleValue = {\n fontFamily?: string\n fontWeight?: number\n fontSize?: LengthValue\n color?: ColorValue\n textAlign?: string\n lineHeight?: number\n letterSpacing?: number\n uppercase?: boolean\n underline?: boolean\n strikethrough?: boolean\n italic?: boolean\n}\n\nexport type TypographyStyle = Array<DeviceOverride<TypographyStyleValue>>\n\nexport type Typography = {\n id: string\n name: string\n style: TypographyStyle\n}\n\nexport function useTypography(\n typographyId: string | null | undefined,\n): Typography | null | undefined {\n const { error, data } = useQuery(TYPOGRAPHIES_BY_ID, {\n skip: typographyId == null,\n variables: { ids: typographyId != null ? [typographyId] : [] },\n })\n\n if (typographyId == null || error != null) return null\n\n return data?.typographies[0] as Typography | null\n}\n","import { Length as LengthValue } from '../../../../../../../../prop-controllers'\nimport { ColorValue as Color } from '../../../../../../../utils/types'\nimport { findDeviceOverride } from '../../../../../../../utils/devices'\nimport type { DeviceOverride } from '../../../../../../../../prop-controllers'\nimport { SWATCHES_BY_ID } from '../../../../../../../utils/queries'\nimport { useTypography, TypographyStyle } from '../../../../../../../hooks/useTypography'\nimport { useQuery } from '../../../../../../../../api/react'\n\nexport type TypographyMarkDataValue = {\n fontWeight?: number\n fontSize?: LengthValue\n fontFamily?: string\n color?: Color\n textAlign?: string\n lineHeight?: number\n letterSpacing?: number\n uppercase?: boolean\n italic?: boolean\n underline?: boolean\n strikethrough?: boolean\n}\n\nexport type TypographyMarkValue = {\n id: string | null | undefined\n style: TypographyStyle\n}\n\nexport type TypographyMarkData = Array<DeviceOverride<TypographyMarkDataValue>>\n\nconst concat = <A extends unknown[], B extends unknown[]>(a: A, b: B) => a.concat(b)\nconst getSwatchId = ({ value: { color } }: any) => color && color.swatchId\nconst getDeviceId = ({ deviceId }: any) => deviceId\n\nconst withColor =\n (swatches: any) =>\n ({ value: { color, ...restOfValue }, ...rest }: any) => ({\n ...rest,\n value: {\n ...restOfValue,\n ...(color\n ? {\n color: {\n swatch: swatches.find((s: any) => s && s.id === color.swatchId),\n alpha: color.alpha,\n },\n }\n : {}),\n },\n })\n\nexport const overrideTypographyStyle = <A>(\n source: Array<DeviceOverride<A>>,\n override: Array<DeviceOverride<A>>,\n): Array<DeviceOverride<A>> => {\n const devices = [...new Set(source.map(getDeviceId).concat(override.map(getDeviceId)))]\n\n return devices.map((deviceId: any) => ({\n deviceId,\n value: {\n ...(findDeviceOverride(source, deviceId) || { value: {} }).value,\n ...(findDeviceOverride(override, deviceId, v => v) || { value: {} }).value,\n },\n })) as DeviceOverride<A>[]\n}\n\nexport default function useTypographyMark(\n value: TypographyMarkValue | null | undefined,\n): TypographyMarkData | null | undefined {\n const typography = useTypography(value && value.id)\n\n const swatchIds = [\n (typography && typography.style.map(getSwatchId)) || [],\n (value && value.style.map(getSwatchId)) || [],\n ]\n .reduce(concat)\n .filter(Boolean)\n\n const { error: colorError, data: colorData = {} } = useQuery(SWATCHES_BY_ID, {\n skip: swatchIds == null || swatchIds.length === 0,\n variables: { ids: swatchIds },\n })\n\n const { swatches = [] } = colorData\n\n if (colorError != null) return null\n\n return overrideTypographyStyle(\n (typography && typography.style.map(withColor(swatches))) || [],\n (value && value.style.map(withColor(swatches))) || [],\n )\n}\n","import { ComponentPropsWithoutRef } from 'react'\nimport styled, { css } from 'styled-components'\n\nimport useTypographyMark, {\n TypographyMarkValue,\n TypographyMarkData,\n overrideTypographyStyle,\n TypographyMarkDataValue,\n} from './hooks/useTypographyMark'\nimport { cssMediaRules } from '../../../../../../utils/cssMediaRules'\nimport { colorToString } from '../../../../../../utils/colorToString'\nimport { shallowMergeFallbacks } from '../../../../../../utils/devices'\n\nexport type { TypographyMarkValue }\nexport { overrideTypographyStyle }\n\nconst Span = styled.span<{ typographyStyle: TypographyMarkData | null | undefined }>`\n ${p =>\n cssMediaRules(\n [p.typographyStyle] as const,\n ([\n {\n color,\n fontFamily,\n fontSize,\n fontWeight,\n lineHeight,\n letterSpacing,\n uppercase,\n underline,\n strikethrough,\n italic,\n } = {} as TypographyMarkDataValue,\n ]) => css`\n ${color == null\n ? ''\n : css`\n color: ${colorToString(color)};\n `}\n\n ${fontFamily == null\n ? ''\n : css`\n font-family: '${fontFamily}';\n `}\n\n ${fontSize == null || fontSize.value == null || fontSize.unit == null\n ? ''\n : css`\n font-size: ${`${fontSize.value}${fontSize.unit}`};\n `}\n\n ${fontWeight == null\n ? ''\n : css`\n font-weight: ${fontWeight};\n `}\n\n ${lineHeight == null\n ? ''\n : css`\n line-height: ${lineHeight};\n `}\n\n ${letterSpacing == null\n ? ''\n : css`\n letter-spacing: ${letterSpacing / 10}em;\n `}\n\n ${underline == null && strikethrough == null\n ? ''\n : css`\n text-decoration: ${[\n Boolean(underline) && 'underline',\n Boolean(strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')};\n `}\n\n ${uppercase == null\n ? ''\n : css`\n text-transform: ${uppercase === true ? 'uppercase' : 'initial'};\n `}\n\n ${italic == null\n ? ''\n : css`\n font-style: ${italic === true ? 'italic' : 'initial'};\n `}\n `,\n shallowMergeFallbacks,\n )}\n`\n\ntype BaseProps = { value: TypographyMarkValue }\n\ntype Props = BaseProps & Omit<ComponentPropsWithoutRef<typeof Span>, keyof BaseProps>\n\nexport default function Mark({ value, ...restOfProps }: Props): JSX.Element {\n const typographyStyle = useTypographyMark(value)\n\n return <Span {...restOfProps} typographyStyle={typographyStyle} />\n}\n","import type { Plugin } from 'slate-react'\n\nimport Mark from '../components/Mark'\n\nconst TYPOGRAPHY_TYPE = 'typography'\n\nexport default function DeviceOverridesMarksPlugin(): Plugin {\n return {\n renderMark({ mark, children }, _editor, next) {\n if (mark.type === TYPOGRAPHY_TYPE) {\n return <Mark value={mark.data.get('value')}>{children}</Mark>\n }\n\n return next()\n },\n }\n}\n","import { forwardRef, ElementType, ComponentPropsWithoutRef } from 'react'\nimport styled, { css } from 'styled-components'\n\nimport { cssMediaRules } from '../../../../../../utils/cssMediaRules'\nimport type { ResponsiveValue } from '../../../../../../../prop-controllers'\n\ntype StyledBlockProps = {\n textAlign?: ResponsiveValue<'left' | 'center' | 'right' | 'justify'>\n as?: ElementType\n}\n\nconst StyledBlock = styled.div<StyledBlockProps>`\n margin: 0;\n ${p =>\n cssMediaRules([p.textAlign] as const, ([textAlign]) =>\n textAlign == null\n ? css``\n : css`\n text-align: ${textAlign};\n `,\n )}\n\n ${p =>\n p.as === 'blockquote'\n ? css`\n padding: 0.5em 10px;\n font-size: 1.25em;\n font-weight: 300;\n border-left: 5px solid rgba(0, 0, 0, 0.1);\n `\n : ''}\n`\n\ntype Props = ComponentPropsWithoutRef<typeof StyledBlock>\n\nexport default forwardRef<HTMLDivElement, Props>(function Block(\n { textAlign, ...restOfProps }: Props,\n ref,\n) {\n return <StyledBlock {...restOfProps} ref={ref} textAlign={textAlign} />\n})\n","import { Plugin } from 'slate-react'\n\nimport Block from '../components/Block'\n\nexport default function DeviceOverridesBlockPlugin(): Plugin {\n return {\n renderBlock(props, _editor, next): JSX.Element {\n const { node, attributes, children } = props\n const blockProps = { textAlign: node.data.get('textAlign') }\n\n switch (node.type) {\n case 'paragraph':\n return (\n <Block {...attributes} {...blockProps} as=\"p\">\n {children}\n </Block>\n )\n\n case 'heading-one':\n return (\n <Block {...attributes} {...blockProps} as=\"h1\">\n {children}\n </Block>\n )\n\n case 'heading-two':\n return (\n <Block {...attributes} {...blockProps} as=\"h2\">\n {children}\n </Block>\n )\n\n case 'heading-three':\n return (\n <Block {...attributes} {...blockProps} as=\"h3\">\n {children}\n </Block>\n )\n\n case 'heading-four':\n return (\n <Block {...attributes} {...blockProps} as=\"h4\">\n {children}\n </Block>\n )\n\n case 'heading-five':\n return (\n <Block {...attributes} {...blockProps} as=\"h5\">\n {children}\n </Block>\n )\n\n case 'heading-six':\n return (\n <Block {...attributes} {...blockProps} as=\"h6\">\n {children}\n </Block>\n )\n\n case 'blockquote':\n return (\n <Block {...attributes} {...blockProps} as=\"blockquote\">\n {children}\n </Block>\n )\n\n default:\n return next()\n }\n },\n }\n}\n","import { Plugin } from 'slate-react'\nimport styled from 'styled-components'\n\nimport { Link } from '../../../../../shared/Link'\n\nconst StyledLink = styled(Link)`\n text-decoration: none;\n`\n\nexport default function LinkPlugin(): Plugin {\n return {\n renderInline(props, _editor, next) {\n const { attributes, children, node } = props\n\n switch (node.type) {\n case 'link': {\n const { data } = node\n\n return (\n <StyledLink {...attributes} link={data.toJS()}>\n {children}\n </StyledLink>\n )\n }\n\n default: {\n return next()\n }\n }\n },\n }\n}\n","import { Plugin } from 'slate-react'\n\nexport default function Inlines(): Plugin {\n return {\n renderInline(props, _editor, next) {\n const { attributes, children, node } = props\n\n switch (node.type) {\n case 'code': {\n return <code {...attributes}>{children}</code>\n }\n\n case 'superscript': {\n return <sup {...attributes}>{children}</sup>\n }\n\n case 'subscript': {\n return <sub {...attributes}>{children}</sub>\n }\n\n default: {\n return next()\n }\n }\n },\n }\n}\n","import { ComponentPropsWithoutRef, forwardRef, useMemo } from 'react'\n\nimport { Editor as SlateEditor } from 'slate-react'\n\n// @ts-expect-error: no types for '@convertkit/slate-lists'\nimport Lists from '@convertkit/slate-lists'\nimport styled from 'styled-components'\n\nimport DeviceOverridesMarks from './plugins/DeviceOverridesMarks'\nimport DeviceOverridesBlocks from './plugins/DeviceOverridesBlocks'\nimport Link from './plugins/Link'\nimport Inlines from './plugins/Inlines'\n\nexport { overrideTypographyStyle } from './components/Mark'\n\ntype Props = ComponentPropsWithoutRef<typeof SlateEditor>\n\nexport const RichTextEditor = styled(\n forwardRef<SlateEditor, Props>(function RichTextEditor(\n { placeholder = 'Write some text...', ...restOfProps }: Props,\n ref,\n ) {\n const plugins = useMemo(\n () => [Lists(), Link(), Inlines(), DeviceOverridesBlocks(), DeviceOverridesMarks()],\n [],\n )\n\n return (\n <SlateEditor\n {...restOfProps}\n ref={ref}\n autoFocus={false}\n plugins={plugins}\n placeholder={placeholder}\n />\n )\n }),\n)`\n ul,\n ol {\n margin: 0;\n }\n`\n","import {\n useState,\n Ref,\n useImperativeHandle,\n forwardRef,\n useEffect,\n useCallback,\n useRef,\n KeyboardEvent as ReactKeyboardEvent,\n FocusEvent as ReactFocusEvent,\n} from 'react'\nimport styled from 'styled-components'\nimport { Editor, OnChangeParam } from 'slate-react'\nimport { Value, ValueJSON } from 'slate'\n// @ts-expect-error: no types for 'slate-hotkeys'\nimport Hotkeys from 'slate-hotkeys'\nimport { cx } from '@emotion/css'\nimport { isHotkey } from 'is-hotkey'\n\nimport {\n ElementIDValue,\n MarginValue,\n RichTextDescriptor,\n RichTextValue,\n} from '../../../prop-controllers/descriptors'\nimport { cssMargin } from '../../utils/cssMediaRules'\nimport { BoxModelHandle, getBox } from '../../../box-model'\nimport { PropControllersHandle } from '../../../state/modules/prop-controller-handles'\nimport { RichTextEditor } from './components/RichTextEditor'\nimport { useIsInBuilder } from '../../../runtimes/react'\nimport { DescriptorsPropControllers } from '../../../prop-controllers/instances'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: MarginValue\n}\n\nconst StyledRichTextEditor = styled(RichTextEditor).withConfig({\n shouldForwardProp: prop => !['margin'].includes(prop.toString()),\n})<{ margin: Props['margin'] }>`\n ${cssMargin()}\n`\n\nconst defaultText: ValueJSON = {\n document: { nodes: [{ object: 'block' as const, type: 'paragraph' as const, nodes: [] }] },\n data: {},\n}\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\ntype Descriptors = { text?: RichTextDescriptor }\n\nconst Text = forwardRef(function Text(\n { id, text, width, margin }: Props,\n ref: Ref<BoxModelHandle & PropControllersHandle<Descriptors>>,\n) {\n const [editor, setEditor] = useState<Editor | null>(null)\n const [propControllers, setPropControllers] =\n useState<DescriptorsPropControllers<Descriptors> | null>(null)\n const controller = propControllers?.text\n\n useImperativeHandle(\n ref,\n () => ({\n getBoxModel() {\n const el = editor?.findDOMNode([])\n\n return el instanceof Element ? getBox(el) : null\n },\n setPropControllers,\n }),\n [editor, setPropControllers],\n )\n\n useEffect(() => {\n if (editor) controller?.setSlateEditor(editor)\n }, [controller, editor])\n\n /**\n * We must keep local state so that we can reflect the user's typed changes immediately. At the\n * same time, though, the source of truth for the data is the prop data. This presents a\n * challenge: how do we keep local state in sync with the prop data without mangling user input as\n * data comes in?\n *\n * Consider, for example, that the user types \"Hello\". If at a later time, when the user is trying\n * to type \", world\" the component re-renders with prop data \"H\", \"He\", \"Hel\", \"Hell\", \"Hello\", it\n * will disrupt the user's typing. This could also happen as a result of the prop data changing\n * for other reasons, like collaborators changing the prop data concurrently. We want to avoid to\n * disrupt the user's typing, while at the same time display the \"true\" value as quickly as\n * possible.\n *\n * The approach we take here is to commit the prop data at an opportune time: as the user is\n * typing we avoid to commit prop data. But once they've stopped typing, we commit it as soon as\n * possible. This is known as a debounce.\n */\n const [value, setValue] = useState(() => {\n const { selection, ...textWithoutSelection } = text ?? defaultText\n\n return Value.fromJSON(textWithoutSelection)\n })\n const [shouldCommit, setShouldCommit] = useState(true)\n\n useEffect(() => {\n if (shouldCommit) {\n const nextValue = Value.fromJSON(text ?? defaultText)\n\n setValue(currentValue =>\n currentValue.selection.isBlurred\n ? Value.fromJSON(nextValue.toJSON({ preserveSelection: false }))\n : nextValue,\n )\n }\n }, [shouldCommit, text])\n\n useEffect(() => {\n if (shouldCommit) return\n\n const timeoutId = window.setTimeout(() => {\n setShouldCommit(true)\n }, COMMIT_DEBOUNCE_DELAY)\n\n return () => {\n window.clearTimeout(timeoutId)\n }\n }, [shouldCommit])\n\n function handleChange(change: OnChangeParam) {\n setValue(change.value as Value)\n\n if (change.value !== value) {\n setShouldCommit(false)\n\n controller?.onChange(change)\n }\n }\n\n // HACK: Slate holds on to the very first DOM event handlers passed in and doesn't update them\n // even if they change. Since `controller` is first `undefined` then we must use a ref.\n const lastController = useRef(controller)\n if (lastController.current !== controller) lastController.current = controller\n const handleFocus = useCallback(() => {\n lastController.current?.focus()\n }, [])\n const handleKeyDown = useCallback(\n (event: ReactKeyboardEvent, _editor: Editor, next: () => any) => {\n if (Hotkeys.isUndo(event)) {\n lastController.current?.undo()\n\n return true\n }\n\n if (Hotkeys.isRedo(event)) {\n lastController.current?.redo()\n\n return true\n }\n\n if (isHotkey('escape')(event)) {\n lastController.current?.blur()\n\n return true\n }\n\n return next()\n },\n [],\n )\n const handleBlur = useCallback((event: ReactFocusEvent, _editor: Editor, next: () => any) => {\n // Normally, after a user highlight a text, clicking on the panel will remove the text selection.\n // This line is a workaround for that. Because the panel is not in the iframe, relatedTarget\n // would be null, and we return early so we don't remove the selection.\n if (event.relatedTarget == null) return true\n\n // Blur the selection if the user is clicking on other text.\n return next()\n }, [])\n\n const isInBuilder = useIsInBuilder()\n\n return (\n <StyledRichTextEditor\n // @ts-expect-error: types don't allow for 'id' prop even though it's used.\n id={id}\n ref={setEditor}\n className={cx(width)}\n readOnly={!isInBuilder}\n margin={margin}\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n />\n )\n})\n\nexport default Text\n"],"names":["Span","styled","span","p","cssMediaRules","typographyStyle","color","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","uppercase","underline","strikethrough","italic","css","colorToString","value","unit","Boolean","filter","join","shallowMergeFallbacks","restOfProps","useTypographyMark","TYPOGRAPHY_TYPE","renderMark","mark","children","_editor","next","type","data","get","StyledBlock","div","textAlign","as","forwardRef","ref","renderBlock","props","node","attributes","blockProps","StyledLink","Link","renderInline","toJS","RichTextEditor","placeholder","plugins","useMemo","Lists","Inlines","DeviceOverridesBlocks","DeviceOverridesMarks","SlateEditor","StyledRichTextEditor","withConfig","shouldForwardProp","prop","includes","toString","cssMargin","defaultText","document","nodes","object","COMMIT_DEBOUNCE_DELAY","Text","id","text","width","margin","editor","setEditor","useState","propControllers","setPropControllers","controller","useImperativeHandle","getBoxModel","el","findDOMNode","Element","getBox","useEffect","setSlateEditor","setValue","selection","textWithoutSelection","Value","fromJSON","shouldCommit","setShouldCommit","nextValue","currentValue","isBlurred","toJSON","preserveSelection","timeoutId","window","setTimeout","clearTimeout","change","onChange","lastController","useRef","current","handleFocus","useCallback","focus","handleKeyDown","event","Hotkeys","isUndo","undo","isRedo","redo","isHotkey","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,QAAAA,QAAQC,OAAOF,KAAf,GAAuB;AACzBP,2BAAeE,YAAfF,mBAAwBU;AAEjB,aAAA;AAAA,IACR;AAEGF,QAAAA,QAAQG,OAAOJ,KAAf,GAAuB;AACzBP,2BAAeE,YAAfF,mBAAwBY;AAEjB,aAAA;AAAA,IACR;AAED,QAAIC,SAAS,QAAD,EAAWN,KAAnB,GAA2B;AAC7BP,2BAAeE,YAAfF,mBAAwBc;AAEjB,aAAA;AAAA,IACR;AAED,WAAO3F,KAAP;AAAA,EApB6B,GAsB/B,CAtB+B,CAAA;AAwBjC,QAAM4F,aAAaX,YAAY,CAACG,OAAwBrF,SAAiBC,SAAoB;AAIvFoF,QAAAA,MAAMS,iBAAiB;AAAa,aAAA;AAGxC,WAAO7F,KAAP;AAAA,EAP4B,GAQ3B,CAR2B,CAAA;AAUxB8F,QAAAA,cAAcC;AAGlB,6BAAC,sBAAD;AAAA,IAEE;AAAA,IACA,KAAKjD;AAAAA,IACL,WAAWkD,GAAGrD,KAAD;AAAA,IACb,UAAU,CAACmD;AAAAA,IACX;AAAA,IACA;AAAA,IACA,UAAUG;AAAAA,IACV,SAASjB;AAAAA,IACT,WAAWG;AAAAA,IACX,QAAQS;AAAAA,EAAAA,CAZZ;AAeD,CA9IsB;;"}
|
|
1
|
+
{"version":3,"file":"Text.es.js","sources":["../src/components/hooks/useTypography.ts","../src/components/builtin/Text/components/RichTextEditor/components/Mark/hooks/useTypographyMark.ts","../src/components/builtin/Text/components/RichTextEditor/components/Mark/index.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesMarks.tsx","../src/components/builtin/Text/components/RichTextEditor/components/Block/index.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesBlocks.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/Link.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/Inlines.tsx","../src/components/builtin/Text/components/RichTextEditor/index.tsx","../src/components/builtin/Text/Text.tsx"],"sourcesContent":["import type { ColorValue } from '../utils/types'\nimport type { Length as LengthValue } from '../../prop-controllers'\nimport { DeviceOverride } from '../../prop-controllers'\nimport { TYPOGRAPHIES_BY_ID } from '../utils/queries'\nimport { useQuery } from '../../api/react'\n\nexport type TypographyStyleValue = {\n fontFamily?: string\n fontWeight?: number\n fontSize?: LengthValue\n color?: ColorValue\n textAlign?: string\n lineHeight?: number\n letterSpacing?: number\n uppercase?: boolean\n underline?: boolean\n strikethrough?: boolean\n italic?: boolean\n}\n\nexport type TypographyStyle = Array<DeviceOverride<TypographyStyleValue>>\n\nexport type Typography = {\n id: string\n name: string\n style: TypographyStyle\n}\n\nexport function useTypography(\n typographyId: string | null | undefined,\n): Typography | null | undefined {\n const { error, data } = useQuery(TYPOGRAPHIES_BY_ID, {\n skip: typographyId == null,\n variables: { ids: typographyId != null ? [typographyId] : [] },\n })\n\n if (typographyId == null || error != null) return null\n\n return data?.typographies[0] as Typography | null\n}\n","import { Length as LengthValue } from '../../../../../../../../prop-controllers'\nimport { ColorValue as Color } from '../../../../../../../utils/types'\nimport { findDeviceOverride } from '../../../../../../../utils/devices'\nimport type { DeviceOverride } from '../../../../../../../../prop-controllers'\nimport { SWATCHES_BY_ID } from '../../../../../../../utils/queries'\nimport { useTypography, TypographyStyle } from '../../../../../../../hooks/useTypography'\nimport { useQuery } from '../../../../../../../../api/react'\n\nexport type TypographyMarkDataValue = {\n fontWeight?: number\n fontSize?: LengthValue\n fontFamily?: string\n color?: Color\n textAlign?: string\n lineHeight?: number\n letterSpacing?: number\n uppercase?: boolean\n italic?: boolean\n underline?: boolean\n strikethrough?: boolean\n}\n\nexport type TypographyMarkValue = {\n id: string | null | undefined\n style: TypographyStyle\n}\n\nexport type TypographyMarkData = Array<DeviceOverride<TypographyMarkDataValue>>\n\nconst concat = <A extends unknown[], B extends unknown[]>(a: A, b: B) => a.concat(b)\nconst getSwatchId = ({ value: { color } }: any) => color && color.swatchId\nconst getDeviceId = ({ deviceId }: any) => deviceId\n\nconst withColor =\n (swatches: any) =>\n ({ value: { color, ...restOfValue }, ...rest }: any) => ({\n ...rest,\n value: {\n ...restOfValue,\n ...(color\n ? {\n color: {\n swatch: swatches.find((s: any) => s && s.id === color.swatchId),\n alpha: color.alpha,\n },\n }\n : {}),\n },\n })\n\nexport const overrideTypographyStyle = <A>(\n source: Array<DeviceOverride<A>>,\n override: Array<DeviceOverride<A>>,\n): Array<DeviceOverride<A>> => {\n const devices = [...new Set(source.map(getDeviceId).concat(override.map(getDeviceId)))]\n\n return devices.map((deviceId: any) => ({\n deviceId,\n value: {\n ...(findDeviceOverride(source, deviceId) || { value: {} }).value,\n ...(findDeviceOverride(override, deviceId, v => v) || { value: {} }).value,\n },\n })) as DeviceOverride<A>[]\n}\n\nexport default function useTypographyMark(\n value: TypographyMarkValue | null | undefined,\n): TypographyMarkData | null | undefined {\n const typography = useTypography(value && value.id)\n\n const swatchIds = [\n (typography && typography.style.map(getSwatchId)) || [],\n (value && value.style.map(getSwatchId)) || [],\n ]\n .reduce(concat)\n .filter(Boolean)\n\n const { error: colorError, data: colorData = {} } = useQuery(SWATCHES_BY_ID, {\n skip: swatchIds == null || swatchIds.length === 0,\n variables: { ids: swatchIds },\n })\n\n const { swatches = [] } = colorData\n\n if (colorError != null) return null\n\n return overrideTypographyStyle(\n (typography && typography.style.map(withColor(swatches))) || [],\n (value && value.style.map(withColor(swatches))) || [],\n )\n}\n","import { ComponentPropsWithoutRef } from 'react'\nimport styled, { css } from 'styled-components'\n\nimport useTypographyMark, {\n TypographyMarkValue,\n TypographyMarkData,\n overrideTypographyStyle,\n TypographyMarkDataValue,\n} from './hooks/useTypographyMark'\nimport { cssMediaRules } from '../../../../../../utils/cssMediaRules'\nimport { colorToString } from '../../../../../../utils/colorToString'\nimport { shallowMergeFallbacks } from '../../../../../../utils/devices'\n\nexport type { TypographyMarkValue }\nexport { overrideTypographyStyle }\n\nconst Span = styled.span<{ typographyStyle: TypographyMarkData | null | undefined }>`\n ${p =>\n cssMediaRules(\n [p.typographyStyle] as const,\n ([\n {\n color,\n fontFamily,\n fontSize,\n fontWeight,\n lineHeight,\n letterSpacing,\n uppercase,\n underline,\n strikethrough,\n italic,\n } = {} as TypographyMarkDataValue,\n ]) => css`\n ${color == null\n ? ''\n : css`\n color: ${colorToString(color)};\n `}\n\n ${fontFamily == null\n ? ''\n : css`\n font-family: '${fontFamily}';\n `}\n\n ${fontSize == null || fontSize.value == null || fontSize.unit == null\n ? ''\n : css`\n font-size: ${`${fontSize.value}${fontSize.unit}`};\n `}\n\n ${fontWeight == null\n ? ''\n : css`\n font-weight: ${fontWeight};\n `}\n\n ${lineHeight == null\n ? ''\n : css`\n line-height: ${lineHeight};\n `}\n\n ${letterSpacing == null\n ? ''\n : css`\n letter-spacing: ${letterSpacing / 10}em;\n `}\n\n ${underline == null && strikethrough == null\n ? ''\n : css`\n text-decoration: ${[\n Boolean(underline) && 'underline',\n Boolean(strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')};\n `}\n\n ${uppercase == null\n ? ''\n : css`\n text-transform: ${uppercase === true ? 'uppercase' : 'initial'};\n `}\n\n ${italic == null\n ? ''\n : css`\n font-style: ${italic === true ? 'italic' : 'initial'};\n `}\n `,\n shallowMergeFallbacks,\n )}\n`\n\ntype BaseProps = { value: TypographyMarkValue }\n\ntype Props = BaseProps & Omit<ComponentPropsWithoutRef<typeof Span>, keyof BaseProps>\n\nexport default function Mark({ value, ...restOfProps }: Props): JSX.Element {\n const typographyStyle = useTypographyMark(value)\n\n return <Span {...restOfProps} typographyStyle={typographyStyle} />\n}\n","import type { Plugin } from 'slate-react'\n\nimport Mark from '../components/Mark'\n\nconst TYPOGRAPHY_TYPE = 'typography'\n\nexport default function DeviceOverridesMarksPlugin(): Plugin {\n return {\n renderMark({ mark, children }, _editor, next) {\n if (mark.type === TYPOGRAPHY_TYPE) {\n return <Mark value={mark.data.get('value')}>{children}</Mark>\n }\n\n return next()\n },\n }\n}\n","import { forwardRef, ElementType, ComponentPropsWithoutRef } from 'react'\nimport styled, { css } from 'styled-components'\n\nimport { cssMediaRules } from '../../../../../../utils/cssMediaRules'\nimport type { ResponsiveValue } from '../../../../../../../prop-controllers'\n\ntype StyledBlockProps = {\n textAlign?: ResponsiveValue<'left' | 'center' | 'right' | 'justify'>\n as?: ElementType\n}\n\nconst StyledBlock = styled.div<StyledBlockProps>`\n margin: 0;\n ${p =>\n cssMediaRules([p.textAlign] as const, ([textAlign]) =>\n textAlign == null\n ? css``\n : css`\n text-align: ${textAlign};\n `,\n )}\n\n ${p =>\n p.as === 'blockquote'\n ? css`\n padding: 0.5em 10px;\n font-size: 1.25em;\n font-weight: 300;\n border-left: 5px solid rgba(0, 0, 0, 0.1);\n `\n : ''}\n`\n\ntype Props = ComponentPropsWithoutRef<typeof StyledBlock>\n\nexport default forwardRef<HTMLDivElement, Props>(function Block(\n { textAlign, ...restOfProps }: Props,\n ref,\n) {\n return <StyledBlock {...restOfProps} ref={ref} textAlign={textAlign} />\n})\n","import { Plugin } from 'slate-react'\n\nimport Block from '../components/Block'\n\nexport default function DeviceOverridesBlockPlugin(): Plugin {\n return {\n renderBlock(props, _editor, next): JSX.Element {\n const { node, attributes, children } = props\n const blockProps = { textAlign: node.data.get('textAlign') }\n\n switch (node.type) {\n case 'paragraph':\n return (\n <Block {...attributes} {...blockProps} as=\"p\">\n {children}\n </Block>\n )\n\n case 'heading-one':\n return (\n <Block {...attributes} {...blockProps} as=\"h1\">\n {children}\n </Block>\n )\n\n case 'heading-two':\n return (\n <Block {...attributes} {...blockProps} as=\"h2\">\n {children}\n </Block>\n )\n\n case 'heading-three':\n return (\n <Block {...attributes} {...blockProps} as=\"h3\">\n {children}\n </Block>\n )\n\n case 'heading-four':\n return (\n <Block {...attributes} {...blockProps} as=\"h4\">\n {children}\n </Block>\n )\n\n case 'heading-five':\n return (\n <Block {...attributes} {...blockProps} as=\"h5\">\n {children}\n </Block>\n )\n\n case 'heading-six':\n return (\n <Block {...attributes} {...blockProps} as=\"h6\">\n {children}\n </Block>\n )\n\n case 'blockquote':\n return (\n <Block {...attributes} {...blockProps} as=\"blockquote\">\n {children}\n </Block>\n )\n\n default:\n return next()\n }\n },\n }\n}\n","import { Plugin } from 'slate-react'\nimport styled from 'styled-components'\n\nimport { Link } from '../../../../../shared/Link'\n\nconst StyledLink = styled(Link)`\n text-decoration: none;\n`\n\nexport default function LinkPlugin(): Plugin {\n return {\n renderInline(props, _editor, next) {\n const { attributes, children, node } = props\n\n switch (node.type) {\n case 'link': {\n const { data } = node\n\n return (\n <StyledLink {...attributes} link={data.toJS()}>\n {children}\n </StyledLink>\n )\n }\n\n default: {\n return next()\n }\n }\n },\n }\n}\n","import { Plugin } from 'slate-react'\n\nexport default function Inlines(): Plugin {\n return {\n renderInline(props, _editor, next) {\n const { attributes, children, node } = props\n\n switch (node.type) {\n case 'code': {\n return <code {...attributes}>{children}</code>\n }\n\n case 'superscript': {\n return <sup {...attributes}>{children}</sup>\n }\n\n case 'subscript': {\n return <sub {...attributes}>{children}</sub>\n }\n\n default: {\n return next()\n }\n }\n },\n }\n}\n","import { ComponentPropsWithoutRef, forwardRef, useMemo } from 'react'\n\nimport { Editor as SlateEditor } from 'slate-react'\n\n// @ts-expect-error: no types for '@convertkit/slate-lists'\nimport Lists from '@convertkit/slate-lists'\nimport styled from 'styled-components'\n\nimport DeviceOverridesMarks from './plugins/DeviceOverridesMarks'\nimport DeviceOverridesBlocks from './plugins/DeviceOverridesBlocks'\nimport Link from './plugins/Link'\nimport Inlines from './plugins/Inlines'\n\nexport { overrideTypographyStyle } from './components/Mark'\n\ntype Props = ComponentPropsWithoutRef<typeof SlateEditor>\n\nexport const RichTextEditor = styled(\n forwardRef<SlateEditor, Props>(function RichTextEditor(\n { placeholder = 'Write some text...', ...restOfProps }: Props,\n ref,\n ) {\n const plugins = useMemo(\n () => [Lists(), Link(), Inlines(), DeviceOverridesBlocks(), DeviceOverridesMarks()],\n [],\n )\n\n return (\n <SlateEditor\n {...restOfProps}\n ref={ref}\n autoFocus={false}\n plugins={plugins}\n placeholder={placeholder}\n />\n )\n }),\n)`\n ul,\n ol {\n margin: 0;\n }\n`\n","import {\n useState,\n Ref,\n useImperativeHandle,\n forwardRef,\n useEffect,\n useCallback,\n useRef,\n KeyboardEvent as ReactKeyboardEvent,\n FocusEvent as ReactFocusEvent,\n} from 'react'\nimport styled from 'styled-components'\nimport { Editor, OnChangeParam } from 'slate-react'\nimport { Value, ValueJSON } from 'slate'\n// @ts-expect-error: no types for 'slate-hotkeys'\nimport Hotkeys from 'slate-hotkeys'\nimport { isHotkey } from 'is-hotkey'\n\nimport {\n ElementIDValue,\n MarginValue,\n RichTextDescriptor,\n RichTextValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { cssMargin, cssWidth } from '../../utils/cssMediaRules'\nimport { BoxModelHandle, getBox } from '../../../box-model'\nimport { PropControllersHandle } from '../../../state/modules/prop-controller-handles'\nimport { RichTextEditor } from './components/RichTextEditor'\nimport { useIsInBuilder } from '../../../runtimes/react'\nimport { DescriptorsPropControllers } from '../../../prop-controllers/instances'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: WidthValue\n margin?: MarginValue\n}\n\nconst StyledRichTextEditor = styled(RichTextEditor).withConfig({\n shouldForwardProp: prop => !['width', 'margin'].includes(prop.toString()),\n})<{ width: Props['width']; margin: Props['margin'] }>`\n ${cssWidth()}\n ${cssMargin()}\n`\n\nconst defaultText: ValueJSON = {\n document: { nodes: [{ object: 'block' as const, type: 'paragraph' as const, nodes: [] }] },\n data: {},\n}\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\ntype Descriptors = { text?: RichTextDescriptor }\n\nconst Text = forwardRef(function Text(\n { id, text, width, margin }: Props,\n ref: Ref<BoxModelHandle & PropControllersHandle<Descriptors>>,\n) {\n const [editor, setEditor] = useState<Editor | null>(null)\n const [propControllers, setPropControllers] =\n useState<DescriptorsPropControllers<Descriptors> | null>(null)\n const controller = propControllers?.text\n\n useImperativeHandle(\n ref,\n () => ({\n getBoxModel() {\n const el = editor?.findDOMNode([])\n\n return el instanceof Element ? getBox(el) : null\n },\n setPropControllers,\n }),\n [editor, setPropControllers],\n )\n\n useEffect(() => {\n if (editor) controller?.setSlateEditor(editor)\n }, [controller, editor])\n\n /**\n * We must keep local state so that we can reflect the user's typed changes immediately. At the\n * same time, though, the source of truth for the data is the prop data. This presents a\n * challenge: how do we keep local state in sync with the prop data without mangling user input as\n * data comes in?\n *\n * Consider, for example, that the user types \"Hello\". If at a later time, when the user is trying\n * to type \", world\" the component re-renders with prop data \"H\", \"He\", \"Hel\", \"Hell\", \"Hello\", it\n * will disrupt the user's typing. This could also happen as a result of the prop data changing\n * for other reasons, like collaborators changing the prop data concurrently. We want to avoid to\n * disrupt the user's typing, while at the same time display the \"true\" value as quickly as\n * possible.\n *\n * The approach we take here is to commit the prop data at an opportune time: as the user is\n * typing we avoid to commit prop data. But once they've stopped typing, we commit it as soon as\n * possible. This is known as a debounce.\n */\n const [value, setValue] = useState(() => {\n const { selection, ...textWithoutSelection } = text ?? defaultText\n\n return Value.fromJSON(textWithoutSelection)\n })\n const [shouldCommit, setShouldCommit] = useState(true)\n\n useEffect(() => {\n if (shouldCommit) {\n const nextValue = Value.fromJSON(text ?? defaultText)\n\n setValue(currentValue =>\n currentValue.selection.isBlurred\n ? Value.fromJSON(nextValue.toJSON({ preserveSelection: false }))\n : nextValue,\n )\n }\n }, [shouldCommit, text])\n\n useEffect(() => {\n if (shouldCommit) return\n\n const timeoutId = window.setTimeout(() => {\n setShouldCommit(true)\n }, COMMIT_DEBOUNCE_DELAY)\n\n return () => {\n window.clearTimeout(timeoutId)\n }\n }, [shouldCommit])\n\n function handleChange(change: OnChangeParam) {\n setValue(change.value as Value)\n\n if (change.value !== value) {\n setShouldCommit(false)\n\n controller?.onChange(change)\n }\n }\n\n // HACK: Slate holds on to the very first DOM event handlers passed in and doesn't update them\n // even if they change. Since `controller` is first `undefined` then we must use a ref.\n const lastController = useRef(controller)\n if (lastController.current !== controller) lastController.current = controller\n const handleFocus = useCallback(() => {\n lastController.current?.focus()\n }, [])\n const handleKeyDown = useCallback(\n (event: ReactKeyboardEvent, _editor: Editor, next: () => any) => {\n if (Hotkeys.isUndo(event)) {\n lastController.current?.undo()\n\n return true\n }\n\n if (Hotkeys.isRedo(event)) {\n lastController.current?.redo()\n\n return true\n }\n\n if (isHotkey('escape')(event)) {\n lastController.current?.blur()\n\n return true\n }\n\n return next()\n },\n [],\n )\n const handleBlur = useCallback((event: ReactFocusEvent, _editor: Editor, next: () => any) => {\n // Normally, after a user highlight a text, clicking on the panel will remove the text selection.\n // This line is a workaround for that. Because the panel is not in the iframe, relatedTarget\n // would be null, and we return early so we don't remove the selection.\n if (event.relatedTarget == null) return true\n\n // Blur the selection if the user is clicking on other text.\n return next()\n }, [])\n\n const isInBuilder = useIsInBuilder()\n\n return (\n <StyledRichTextEditor\n // @ts-expect-error: types don't allow for 'id' prop even though it's used.\n id={id}\n ref={setEditor}\n width={width}\n readOnly={!isInBuilder}\n margin={margin}\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n />\n )\n})\n\nexport default Text\n"],"names":["Span","styled","span","p","cssMediaRules","typographyStyle","color","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","uppercase","underline","strikethrough","italic","css","colorToString","value","unit","Boolean","filter","join","shallowMergeFallbacks","restOfProps","useTypographyMark","TYPOGRAPHY_TYPE","renderMark","mark","children","_editor","next","type","data","get","StyledBlock","div","textAlign","as","forwardRef","ref","renderBlock","props","node","attributes","blockProps","StyledLink","Link","renderInline","toJS","RichTextEditor","placeholder","plugins","useMemo","Lists","Inlines","DeviceOverridesBlocks","DeviceOverridesMarks","SlateEditor","StyledRichTextEditor","withConfig","shouldForwardProp","prop","includes","toString","cssWidth","cssMargin","defaultText","document","nodes","object","COMMIT_DEBOUNCE_DELAY","Text","id","text","width","margin","editor","setEditor","useState","propControllers","setPropControllers","controller","useImperativeHandle","getBoxModel","el","findDOMNode","Element","getBox","useEffect","setSlateEditor","setValue","selection","textWithoutSelection","Value","fromJSON","shouldCommit","setShouldCommit","nextValue","currentValue","isBlurred","toJSON","preserveSelection","timeoutId","window","setTimeout","clearTimeout","change","onChange","lastController","useRef","current","handleFocus","useCallback","focus","handleKeyDown","event","Hotkeys","isUndo","undo","isRedo","redo","isHotkey","blur","handleBlur","relatedTarget","isInBuilder","useIsInBuilder","handleChange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,uBACL,cAC+B;AAC/B,QAAM,EAAE,OAAO,SAAS,SAAS,oBAAoB;AAAA,IACnD,MAAM,gBAAgB;AAAA,IACtB,WAAW,EAAE,KAAK,gBAAgB,OAAO,CAAC,YAAY,IAAI,GAAG;AAAA,EAAA,CAC9D;AAEG,MAAA,gBAAgB,QAAQ,SAAS;AAAa,WAAA;AAElD,SAAO,6BAAM,aAAa;AAC5B;ACVA,MAAM,SAAS,CAA2C,GAAM,MAAS,EAAE,OAAO,CAAC;AACnF,MAAM,cAAc,CAAC,EAAE,OAAO,EAAE,cAAmB,SAAS,MAAM;AAClE,MAAM,cAAc,CAAC,EAAE,eAAoB;AAE3C,MAAM,YACJ,CAAC,aACD,CAAC,OAAwD;AAAxD,eAAS,EAAP,OAAO,OAAT,IAAS,SAAE,YAAF,IAAY,wBAAZ,IAAY,CAAV,WAA4B,iBAAvC,IAAuC,CAArC;AAAsD,0CACpD,OADoD;AAAA,IAEvD,OAAO,kCACF,cACC,QACA;AAAA,MACE,OAAO;AAAA,QACL,QAAQ,SAAS,KAAK,CAAC,MAAW,KAAK,EAAE,OAAO,MAAM,QAAQ;AAAA,QAC9D,OAAO,MAAM;AAAA,MACf;AAAA,IAAA,IAEF,CAAC;AAAA,EAET;AAAA;AAEW,MAAA,0BAA0B,CACrC,QACA,aAC6B;AAC7B,QAAM,UAAU,CAAC,GAAG,IAA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IKE,QAAAA,iBAAiBC,OAAO5B,UAAD;AACzB2B,MAAAA,eAAeE,YAAY7B;AAAY2B,mBAAeE,UAAU7B;AAC9D8B,QAAAA,cAAcC,YAAY,MAAM;;AACpCJ,yBAAeE,YAAfF,mBAAwBK;AAAAA,EADK,GAE5B,CAF4B,CAAA;AAG/B,QAAMC,gBAAgBF,YACpB,CAACG,OAA2BtF,SAAiBC,SAAoB;;AAC3DsF,QAAAA,QAAQC,OAAOF,KAAf,GAAuB;AACzBP,2BAAeE,YAAfF,mBAAwBU;AAEjB,aAAA;AAAA,IACR;AAEGF,QAAAA,QAAQG,OAAOJ,KAAf,GAAuB;AACzBP,2BAAeE,YAAfF,mBAAwBY;AAEjB,aAAA;AAAA,IACR;AAED,QAAIC,SAAS,QAAD,EAAWN,KAAnB,GAA2B;AAC7BP,2BAAeE,YAAfF,mBAAwBc;AAEjB,aAAA;AAAA,IACR;AAED,WAAO5F,KAAP;AAAA,EApB6B,GAsB/B,CAtB+B,CAAA;AAwBjC,QAAM6F,aAAaX,YAAY,CAACG,OAAwBtF,SAAiBC,SAAoB;AAIvFqF,QAAAA,MAAMS,iBAAiB;AAAa,aAAA;AAGxC,WAAO9F,KAAP;AAAA,EAP4B,GAQ3B,CAR2B,CAAA;AAUxB+F,QAAAA,cAAcC;AAGlB,6BAAC,sBAAD;AAAA,IAEE;AAAA,IACA,KAAKjD;AAAAA,IACL;AAAA,IACA,UAAU,CAACgD;AAAAA,IACX;AAAA,IACA;AAAA,IACA,UAAUE;AAAAA,IACV,SAAShB;AAAAA,IACT,WAAWG;AAAAA,IACX,QAAQS;AAAAA,EAAAA,CAZZ;AAeD,CA9IsB;;"}
|
package/dist/Video.cjs.js
CHANGED
|
@@ -22,7 +22,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
22
22
|
var React = require("react");
|
|
23
23
|
var styled = require("styled-components");
|
|
24
24
|
var ReactPlayer = require("react-player");
|
|
25
|
-
var css = require("@emotion/css");
|
|
26
25
|
var cssMediaRules = require("./cssMediaRules.cjs.js");
|
|
27
26
|
var placeholders = require("./placeholders.cjs.js");
|
|
28
27
|
var jsxRuntime = require("react/jsx-runtime");
|
|
@@ -40,6 +39,7 @@ require("next/dynamic");
|
|
|
40
39
|
require("next/document");
|
|
41
40
|
require("slate");
|
|
42
41
|
require("@emotion/server/create-instance");
|
|
42
|
+
require("@emotion/css");
|
|
43
43
|
require("@apollo/client");
|
|
44
44
|
require("@apollo/client/link/batch-http");
|
|
45
45
|
require("./graphql.cjs.js");
|
|
@@ -58,11 +58,12 @@ function _interopDefaultLegacy(e) {
|
|
|
58
58
|
var styled__default = /* @__PURE__ */ _interopDefaultLegacy(styled);
|
|
59
59
|
var ReactPlayer__default = /* @__PURE__ */ _interopDefaultLegacy(ReactPlayer);
|
|
60
60
|
const Container = styled__default["default"].div.withConfig({
|
|
61
|
-
shouldForwardProp: (prop) => !["margin", "borderRadius"].includes(prop.toString())
|
|
61
|
+
shouldForwardProp: (prop) => !["width", "margin", "borderRadius"].includes(prop.toString())
|
|
62
62
|
})`
|
|
63
63
|
display: flex;
|
|
64
64
|
flex-direction: column;
|
|
65
65
|
overflow: hidden;
|
|
66
|
+
${cssMediaRules.cssWidth()}
|
|
66
67
|
${cssMediaRules.cssMargin()}
|
|
67
68
|
${cssMediaRules.cssBorderRadius()}
|
|
68
69
|
`;
|
|
@@ -78,7 +79,7 @@ const Video = React.forwardRef(function Video2({
|
|
|
78
79
|
return /* @__PURE__ */ jsxRuntime.jsx(Container, {
|
|
79
80
|
ref,
|
|
80
81
|
id,
|
|
81
|
-
|
|
82
|
+
width,
|
|
82
83
|
margin,
|
|
83
84
|
borderRadius,
|
|
84
85
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", {
|
package/dist/Video.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Video.cjs.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport styled from 'styled-components'\nimport ReactPlayer from 'react-player'\
|
|
1
|
+
{"version":3,"file":"Video.cjs.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport styled from 'styled-components'\nimport ReactPlayer from 'react-player'\n\nimport {\n BorderRadiusValue,\n ElementIDValue,\n MarginValue,\n VideoValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { cssBorderRadius, cssMargin, cssWidth } from '../../utils/cssMediaRules'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: WidthValue\n margin?: MarginValue\n borderRadius?: BorderRadiusValue\n}\n\nconst Container = styled.div.withConfig({\n shouldForwardProp: prop => !['width', 'margin', 'borderRadius'].includes(prop.toString()),\n})<{ width: Props['width']; margin: Props['margin']; borderRadius: Props['borderRadius'] }>`\n display: flex;\n flex-direction: column;\n overflow: hidden;\n ${cssWidth()}\n ${cssMargin()}\n ${cssBorderRadius()}\n`\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n\n return (\n <Container ref={ref} id={id} width={width} margin={margin} borderRadius={borderRadius}>\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </Container>\n )\n})\n\nexport default Video\n"],"names":["Container","styled","div","withConfig","shouldForwardProp","prop","includes","toString","cssWidth","cssMargin","cssBorderRadius","ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","position","paddingTop","top","left","right","bottom","_jsx","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,YAAYC,gBAAAA,WAAOC,IAAIC,WAAW;AAAA,EACtCC,mBAAmBC,CAAQ,SAAA,CAAC,CAAC,SAAS,UAAU,cAApB,EAAoCC,SAASD,KAAKE,UAAlD;AADU,CAAtB;AAAA;AAAA;AAAA;AAAA,IAMdC,cAAW,SAAA;AAAA,IACXC,cAAY,UAAA;AAAA,IACZC,cAAkB,gBAAA;AAAA;AAGtB,MAAMC,eAAe,KAAK;AAEpBC,MAAAA,QAAQC,MAAAA,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAOC;AAAAA,EAAQC;AAAAA,GAC5BC,KACA;AACMC,QAAAA,aAAaL,SAASA,MAAMM,OAAO,QAAQC,qBAAAA,WAAYC,QAAQR,MAAMM,GAA1B;AAEjD,wCACG,WAAD;AAAA,IAAW;AAAA,IAAU;AAAA,IAAQ;AAAA,IAAc;AAAA,IAAgB;AAAA,IACzD,yCAAA,OAAA;AAAA,MAAK,OAAO;AAAA,QAAEG,UAAU;AAAA,QAAYC,YAAa,GAAE,MAAMd;AAAAA,MAAzD;AAAA,MACE,yCAAA,OAAA;AAAA,QAAK,OAAO;AAAA,UAAEa,UAAU;AAAA,UAAYE,KAAK;AAAA,UAAGC,MAAM;AAAA,UAAGC,OAAO;AAAA,UAAGC,QAAQ;AAAA,QAAvE;AAAA,QAAA,UACGT,eAAe,OACdU,2BAAAA,IAACR,qBAAAA,6CACKP;UACJ,OAAM;AAAA,UACN,QAAO;AAAA,UACP,QAAQ;AAAA,YACNgB,OAAO;AAAA,cAAEC,eAAe;AAAA,gBAAEC,YAAYlB,SAAS,QAAQ,CAACA,MAAMmB;AAAAA,cAAtC;AAAA,YADlB;AAAA,YAENC,QAAQ;AAAA,cACNC,SAAS;AAAA,gBACPC,kBAAkBtB,SAAS,QAAQA,MAAMuB,SAAS,OAAO,SAAS;AAAA,cAD3D;AAAA,YADH;AAAA,UAFF;AAAA,QAAA,EAJV,IAcAR,2BAAA,IAAA,OAAA;AAAA,UAAK,OAAM;AAAA,UAAO,KAAKS,aAAAA,aAAaxB,MAAMyB;AAAAA,UAAK,KAAI;AAAA,QAAA,CAAnD;AAAA,MAAA,CAhBJ;AAAA,IAAA,CADF;AAAA,EAAA,CAFJ;AAyBD,CA/BuB;;"}
|
package/dist/Video.es.js
CHANGED
|
@@ -20,8 +20,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20
20
|
import { forwardRef } from "react";
|
|
21
21
|
import styled from "styled-components";
|
|
22
22
|
import ReactPlayer from "react-player";
|
|
23
|
-
import {
|
|
24
|
-
import { b as cssMargin, f as cssBorderRadius } from "./cssMediaRules.es.js";
|
|
23
|
+
import { a as cssWidth, b as cssMargin, f as cssBorderRadius } from "./cssMediaRules.es.js";
|
|
25
24
|
import { p as placeholders } from "./placeholders.es.js";
|
|
26
25
|
import { jsx } from "react/jsx-runtime";
|
|
27
26
|
import "./index.es.js";
|
|
@@ -38,6 +37,7 @@ import "next/dynamic";
|
|
|
38
37
|
import "next/document";
|
|
39
38
|
import "slate";
|
|
40
39
|
import "@emotion/server/create-instance";
|
|
40
|
+
import "@emotion/css";
|
|
41
41
|
import "@apollo/client";
|
|
42
42
|
import "@apollo/client/link/batch-http";
|
|
43
43
|
import "./graphql.es.js";
|
|
@@ -51,11 +51,12 @@ import "next/head";
|
|
|
51
51
|
import "uuid/v4";
|
|
52
52
|
import "corporate-ipsum";
|
|
53
53
|
const Container = styled.div.withConfig({
|
|
54
|
-
shouldForwardProp: (prop) => !["margin", "borderRadius"].includes(prop.toString())
|
|
54
|
+
shouldForwardProp: (prop) => !["width", "margin", "borderRadius"].includes(prop.toString())
|
|
55
55
|
})`
|
|
56
56
|
display: flex;
|
|
57
57
|
flex-direction: column;
|
|
58
58
|
overflow: hidden;
|
|
59
|
+
${cssWidth()}
|
|
59
60
|
${cssMargin()}
|
|
60
61
|
${cssBorderRadius()}
|
|
61
62
|
`;
|
|
@@ -71,7 +72,7 @@ const Video = forwardRef(function Video2({
|
|
|
71
72
|
return /* @__PURE__ */ jsx(Container, {
|
|
72
73
|
ref,
|
|
73
74
|
id,
|
|
74
|
-
|
|
75
|
+
width,
|
|
75
76
|
margin,
|
|
76
77
|
borderRadius,
|
|
77
78
|
children: /* @__PURE__ */ jsx("div", {
|
package/dist/Video.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Video.es.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport styled from 'styled-components'\nimport ReactPlayer from 'react-player'\
|
|
1
|
+
{"version":3,"file":"Video.es.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { forwardRef, Ref } from 'react'\nimport styled from 'styled-components'\nimport ReactPlayer from 'react-player'\n\nimport {\n BorderRadiusValue,\n ElementIDValue,\n MarginValue,\n VideoValue,\n WidthValue,\n} from '../../../prop-controllers/descriptors'\nimport { cssBorderRadius, cssMargin, cssWidth } from '../../utils/cssMediaRules'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: WidthValue\n margin?: MarginValue\n borderRadius?: BorderRadiusValue\n}\n\nconst Container = styled.div.withConfig({\n shouldForwardProp: prop => !['width', 'margin', 'borderRadius'].includes(prop.toString()),\n})<{ width: Props['width']; margin: Props['margin']; borderRadius: Props['borderRadius'] }>`\n display: flex;\n flex-direction: column;\n overflow: hidden;\n ${cssWidth()}\n ${cssMargin()}\n ${cssBorderRadius()}\n`\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n\n return (\n <Container ref={ref} id={id} width={width} margin={margin} borderRadius={borderRadius}>\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </Container>\n )\n})\n\nexport default Video\n"],"names":["Container","styled","div","withConfig","shouldForwardProp","prop","includes","toString","cssWidth","cssMargin","cssBorderRadius","ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","position","paddingTop","top","left","right","bottom","_jsx","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,YAAYC,OAAOC,IAAIC,WAAW;AAAA,EACtCC,mBAAmBC,CAAQ,SAAA,CAAC,CAAC,SAAS,UAAU,cAApB,EAAoCC,SAASD,KAAKE,UAAlD;AADU,CAAtB;AAAA;AAAA;AAAA;AAAA,IAMdC,SAAW;AAAA,IACXC,UAAY;AAAA,IACZC,gBAAkB;AAAA;AAGtB,MAAMC,eAAe,KAAK;AAEpBC,MAAAA,QAAQC,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAOC;AAAAA,EAAQC;AAAAA,GAC5BC,KACA;AACMC,QAAAA,aAAaL,SAASA,MAAMM,OAAO,QAAQC,YAAYC,QAAQR,MAAMM,GAA1B;AAEjD,6BACG,WAAD;AAAA,IAAW;AAAA,IAAU;AAAA,IAAQ;AAAA,IAAc;AAAA,IAAgB;AAAA,IACzD,8BAAA,OAAA;AAAA,MAAK,OAAO;AAAA,QAAEG,UAAU;AAAA,QAAYC,YAAa,GAAE,MAAMd;AAAAA,MAAzD;AAAA,MACE,8BAAA,OAAA;AAAA,QAAK,OAAO;AAAA,UAAEa,UAAU;AAAA,UAAYE,KAAK;AAAA,UAAGC,MAAM;AAAA,UAAGC,OAAO;AAAA,UAAGC,QAAQ;AAAA,QAAvE;AAAA,QAAA,UACGT,eAAe,OACdU,oBAAC,8CACKf;UACJ,OAAM;AAAA,UACN,QAAO;AAAA,UACP,QAAQ;AAAA,YACNgB,OAAO;AAAA,cAAEC,eAAe;AAAA,gBAAEC,YAAYlB,SAAS,QAAQ,CAACA,MAAMmB;AAAAA,cAAtC;AAAA,YADlB;AAAA,YAENC,QAAQ;AAAA,cACNC,SAAS;AAAA,gBACPC,kBAAkBtB,SAAS,QAAQA,MAAMuB,SAAS,OAAO,SAAS;AAAA,cAD3D;AAAA,YADH;AAAA,UAFF;AAAA,QAAA,EAJV,IAcAR,oBAAA,OAAA;AAAA,UAAK,OAAM;AAAA,UAAO,KAAKS,aAAaxB,MAAMyB;AAAAA,UAAK,KAAI;AAAA,QAAA,CAAnD;AAAA,MAAA,CAhBJ;AAAA,IAAA,CADF;AAAA,EAAA,CAFJ;AAyBD,CA/BuB;;"}
|
package/dist/components.cjs.js
CHANGED
|
@@ -21,7 +21,6 @@ var useMediaQuery = require("./useMediaQuery.cjs.js");
|
|
|
21
21
|
require("react");
|
|
22
22
|
require("styled-components");
|
|
23
23
|
require("framer-motion");
|
|
24
|
-
require("@emotion/css");
|
|
25
24
|
require("react/jsx-runtime");
|
|
26
25
|
require("./box-models.cjs.js");
|
|
27
26
|
require("css-box-model");
|
|
@@ -38,6 +37,7 @@ require("next/dynamic");
|
|
|
38
37
|
require("next/document");
|
|
39
38
|
require("slate");
|
|
40
39
|
require("@emotion/server/create-instance");
|
|
40
|
+
require("@emotion/css");
|
|
41
41
|
require("@apollo/client");
|
|
42
42
|
require("@apollo/client/link/batch-http");
|
|
43
43
|
require("./graphql.cjs.js");
|
package/dist/components.es.js
CHANGED
|
@@ -19,7 +19,6 @@ export { u as useMediaQuery } from "./useMediaQuery.es.js";
|
|
|
19
19
|
import "react";
|
|
20
20
|
import "styled-components";
|
|
21
21
|
import "framer-motion";
|
|
22
|
-
import "@emotion/css";
|
|
23
22
|
import "react/jsx-runtime";
|
|
24
23
|
import "./box-models.es.js";
|
|
25
24
|
import "css-box-model";
|
|
@@ -36,6 +35,7 @@ import "next/dynamic";
|
|
|
36
35
|
import "next/document";
|
|
37
36
|
import "slate";
|
|
38
37
|
import "@emotion/server/create-instance";
|
|
38
|
+
import "@emotion/css";
|
|
39
39
|
import "@apollo/client";
|
|
40
40
|
import "@apollo/client/link/batch-http";
|
|
41
41
|
import "./graphql.es.js";
|
package/dist/cssMediaRules.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from "styled-components";
|
|
2
|
-
import {
|
|
2
|
+
import { H as join, I as getDevice, J as getDeviceMediaQuery, p as colorToString } from "./index.es.js";
|
|
3
3
|
const getIndexes = (spans, index) => {
|
|
4
4
|
const flattened = spans.reduce((a, s) => a.concat(s), []);
|
|
5
5
|
if (index < 0 || index > flattened.length)
|
package/dist/index.cjs.js
CHANGED
|
@@ -482,6 +482,8 @@ class MakeswiftClient {
|
|
|
482
482
|
variables: introspectionData
|
|
483
483
|
});
|
|
484
484
|
res.data.pagePathnamesById.forEach((pagePathnameSlice) => {
|
|
485
|
+
if (pagePathnameSlice == null)
|
|
486
|
+
return;
|
|
485
487
|
const id = Buffer.from(`Page:${pagePathnameSlice.id}`).toString("base64");
|
|
486
488
|
this.apolloClient.cache.writeFragment({
|
|
487
489
|
fragment: graphql.PagePathnameSliceFragmentDoc,
|
|
@@ -807,13 +809,13 @@ function Page$1({
|
|
|
807
809
|
content: socialImage.publicUrl
|
|
808
810
|
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
809
811
|
property: "og:image:type",
|
|
810
|
-
content: socialImage.
|
|
812
|
+
content: socialImage.mimetype
|
|
811
813
|
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
812
814
|
name: "twitter:image",
|
|
813
815
|
content: socialImage.publicUrl
|
|
814
816
|
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
815
817
|
name: "twitter:card",
|
|
816
|
-
content:
|
|
818
|
+
content: "summary_large_image"
|
|
817
819
|
}), /* @__PURE__ */ jsxRuntime.jsx("meta", {
|
|
818
820
|
itemProp: "image",
|
|
819
821
|
content: socialImage.publicUrl
|
|
@@ -1127,7 +1129,7 @@ function registerComponent$c(runtime) {
|
|
|
1127
1129
|
props: {
|
|
1128
1130
|
id: descriptors.ElementID(),
|
|
1129
1131
|
backgrounds: descriptors.Backgrounds(),
|
|
1130
|
-
width: descriptors.Width(
|
|
1132
|
+
width: descriptors.Width(),
|
|
1131
1133
|
height: descriptors.ResponsiveIconRadioGroup({
|
|
1132
1134
|
label: "Height",
|
|
1133
1135
|
options: [
|
|
@@ -1335,10 +1337,7 @@ function registerComponent$a(runtime) {
|
|
|
1335
1337
|
{ key: uuid__default["default"](), props: {} }
|
|
1336
1338
|
]
|
|
1337
1339
|
}),
|
|
1338
|
-
width: descriptors.Width({
|
|
1339
|
-
format: descriptors.Width.Formats.ClassName,
|
|
1340
|
-
defaultValue: { value: 400, unit: "px" }
|
|
1341
|
-
}),
|
|
1340
|
+
width: descriptors.Width({ defaultValue: { value: 400, unit: "px" } }),
|
|
1342
1341
|
margin: descriptors.Margin(),
|
|
1343
1342
|
pageSize: descriptors.ResponsiveNumber((props) => {
|
|
1344
1343
|
var _a;
|
|
@@ -1490,10 +1489,7 @@ function registerComponent$9(runtime) {
|
|
|
1490
1489
|
label: "Label color",
|
|
1491
1490
|
placeholder: "black"
|
|
1492
1491
|
}),
|
|
1493
|
-
width: descriptors.Width({
|
|
1494
|
-
format: descriptors.Width.Formats.ClassName,
|
|
1495
|
-
defaultValue: { value: 560, unit: "px" }
|
|
1496
|
-
}),
|
|
1492
|
+
width: descriptors.Width({ defaultValue: { value: 560, unit: "px" } }),
|
|
1497
1493
|
margin: descriptors.Margin(),
|
|
1498
1494
|
daysLabel: descriptors.TextInput({ label: "Days label", placeholder: "Days" }),
|
|
1499
1495
|
hoursLabel: descriptors.TextInput({ label: "Hours label", placeholder: "Hours" }),
|
|
@@ -1534,10 +1530,7 @@ function registerComponent$8(runtime) {
|
|
|
1534
1530
|
options: [{ value: "px", label: "Pixels", icon: "Px16" }]
|
|
1535
1531
|
}),
|
|
1536
1532
|
color: descriptors.ResponsiveColor({ placeholder: "black" }),
|
|
1537
|
-
width: descriptors.Width({
|
|
1538
|
-
format: descriptors.Width.Formats.ClassName,
|
|
1539
|
-
defaultValue: { value: 100, unit: "%" }
|
|
1540
|
-
}),
|
|
1533
|
+
width: descriptors.Width({ defaultValue: { value: 100, unit: "%" } }),
|
|
1541
1534
|
margin: descriptors.Margin()
|
|
1542
1535
|
}
|
|
1543
1536
|
});
|
|
@@ -1552,7 +1545,7 @@ function registerComponent$7(runtime) {
|
|
|
1552
1545
|
props: {
|
|
1553
1546
|
id: descriptors.ElementID(),
|
|
1554
1547
|
html: descriptors.TextArea({ label: "Code", rows: 20 }),
|
|
1555
|
-
width: descriptors.Width({
|
|
1548
|
+
width: descriptors.Width({}),
|
|
1556
1549
|
margin: descriptors.Margin()
|
|
1557
1550
|
}
|
|
1558
1551
|
});
|
|
@@ -1691,7 +1684,6 @@ function registerComponent$6(runtime) {
|
|
|
1691
1684
|
hidden: props.tableId == null
|
|
1692
1685
|
})),
|
|
1693
1686
|
width: descriptors.Width({
|
|
1694
|
-
format: descriptors.Width.Formats.ClassName,
|
|
1695
1687
|
preset: [{ deviceId: "desktop", value: { value: 550, unit: "px" } }],
|
|
1696
1688
|
defaultValue: { value: 100, unit: "%" }
|
|
1697
1689
|
}),
|
|
@@ -1809,10 +1801,7 @@ function registerComponent$4(runtime) {
|
|
|
1809
1801
|
hidden
|
|
1810
1802
|
};
|
|
1811
1803
|
}),
|
|
1812
|
-
width: descriptors.Width({
|
|
1813
|
-
format: descriptors.Width.Formats.ClassName,
|
|
1814
|
-
defaultValue: { value: 100, unit: "%" }
|
|
1815
|
-
}),
|
|
1804
|
+
width: descriptors.Width({ defaultValue: { value: 100, unit: "%" } }),
|
|
1816
1805
|
margin: descriptors.Margin()
|
|
1817
1806
|
}
|
|
1818
1807
|
});
|
|
@@ -1936,10 +1925,7 @@ function registerComponent$2(runtime) {
|
|
|
1936
1925
|
step: 1,
|
|
1937
1926
|
defaultValue: { value: 0, unit: "px" }
|
|
1938
1927
|
}),
|
|
1939
|
-
width: descriptors.Width({
|
|
1940
|
-
format: descriptors.Width.Formats.ClassName,
|
|
1941
|
-
defaultValue: { value: 100, unit: "%" }
|
|
1942
|
-
}),
|
|
1928
|
+
width: descriptors.Width({ defaultValue: { value: 100, unit: "%" } }),
|
|
1943
1929
|
margin: descriptors.Margin({
|
|
1944
1930
|
preset: [
|
|
1945
1931
|
{
|
|
@@ -2008,7 +1994,6 @@ function registerComponent$1(runtime) {
|
|
|
2008
1994
|
}
|
|
2009
1995
|
})),
|
|
2010
1996
|
width: descriptors.Width({
|
|
2011
|
-
format: descriptors.Width.Formats.ClassName,
|
|
2012
1997
|
preset: [{ deviceId: "desktop", value: { value: 700, unit: "px" } }],
|
|
2013
1998
|
defaultValue: { value: 100, unit: "%" }
|
|
2014
1999
|
}),
|
|
@@ -2038,10 +2023,7 @@ function registerComponent(runtime) {
|
|
|
2038
2023
|
props: {
|
|
2039
2024
|
id: descriptors.ElementID(),
|
|
2040
2025
|
video: descriptors.Video({ preset: { controls: true } }),
|
|
2041
|
-
width: descriptors.Width({
|
|
2042
|
-
format: descriptors.Width.Formats.ClassName,
|
|
2043
|
-
defaultValue: { value: 560, unit: "px" }
|
|
2044
|
-
}),
|
|
2026
|
+
width: descriptors.Width({ defaultValue: { value: 560, unit: "px" } }),
|
|
2045
2027
|
margin: descriptors.Margin(),
|
|
2046
2028
|
borderRadius: descriptors.BorderRadius()
|
|
2047
2029
|
}
|
|
@@ -3035,7 +3017,7 @@ const ElementData = React.memo(React.forwardRef(function ElementData2({
|
|
|
3035
3017
|
suppressRefWarning(`\`ForwardRef(${ElementData2.name})\``);
|
|
3036
3018
|
if (Component == null) {
|
|
3037
3019
|
return /* @__PURE__ */ jsxRuntime.jsx(FallbackComponent, {
|
|
3038
|
-
ref,
|
|
3020
|
+
ref: setHandle,
|
|
3039
3021
|
text: "Component not found"
|
|
3040
3022
|
});
|
|
3041
3023
|
}
|
|
@@ -3180,7 +3162,6 @@ exports.getStaticPaths = getStaticPaths;
|
|
|
3180
3162
|
exports.getStaticProps = getStaticProps;
|
|
3181
3163
|
exports.isNonNullable = isNonNullable;
|
|
3182
3164
|
exports.join = join;
|
|
3183
|
-
exports.responsiveWidth = responsiveWidth;
|
|
3184
3165
|
exports.shallowMergeFallbacks = shallowMergeFallbacks;
|
|
3185
3166
|
exports.useBorder = useBorder;
|
|
3186
3167
|
exports.useElementId = useElementId;
|