@makeswift/runtime 0.9.3 → 0.9.4
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 +1 -1
- package/dist/Box.es.js +2 -2
- package/dist/Button.cjs.js +1 -1
- package/dist/Button.es.js +2 -2
- package/dist/Carousel.cjs.js +1 -1
- package/dist/Carousel.es.js +2 -2
- package/dist/Countdown.cjs.js +1 -1
- package/dist/Countdown.es.js +2 -2
- package/dist/Divider.cjs.js +1 -1
- package/dist/Divider.es.js +2 -2
- package/dist/Embed.es.js +1 -1
- package/dist/Form.cjs.js +1 -1
- package/dist/Form.es.js +2 -2
- package/dist/Image.cjs.js +1 -1
- package/dist/Image.es.js +2 -2
- package/dist/LiveProvider.cjs.js +1 -1
- package/dist/LiveProvider.es.js +1 -1
- package/dist/Navigation.cjs.js +1 -1
- package/dist/Navigation.es.js +2 -2
- package/dist/PreviewProvider.cjs.js +1 -1
- package/dist/PreviewProvider.es.js +2 -2
- package/dist/ReadOnlyText.cjs.js +3 -4
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +3 -4
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +10 -11
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +9 -10
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +1 -1
- package/dist/Root.es.js +2 -2
- package/dist/SocialLinks.cjs.js +1 -1
- package/dist/SocialLinks.es.js +2 -2
- package/dist/Text.cjs.js +1 -1
- package/dist/Text.es.js +1 -1
- package/dist/Video.es.js +1 -1
- package/dist/components.cjs.js +1 -1
- package/dist/components.es.js +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +18 -14
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +2 -2
- package/dist/index.cjs.js +161 -49
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs10.js +22 -10
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs5.js +99 -5
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs8.js +1 -1
- package/dist/index.cjs9.js +1 -1
- package/dist/index.es.js +148 -37
- package/dist/index.es.js.map +1 -1
- package/dist/index.es10.js +23 -11
- package/dist/index.es10.js.map +1 -1
- package/dist/index.es2.js +1 -1
- package/dist/index.es4.js +1 -1
- package/dist/index.es5.js +91 -2
- 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 +2 -2
- package/dist/next.cjs.js +1 -1
- package/dist/next.es.js +2 -2
- package/dist/react-page.cjs.js +97 -8
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +95 -8
- 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 +17 -70
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +20 -74
- package/dist/slate.es.js.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/builtin/Text/ReadOnlyText.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +0 -17
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
- package/dist/types/src/controls/control.d.ts +3 -2
- package/dist/types/src/controls/control.d.ts.map +1 -1
- package/dist/types/src/controls/index.d.ts +1 -0
- package/dist/types/src/controls/index.d.ts.map +1 -1
- package/dist/types/src/controls/list.d.ts +2 -0
- package/dist/types/src/controls/list.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +2 -0
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/typography.d.ts +31 -0
- package/dist/types/src/controls/typography.d.ts.map +1 -0
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +6 -3
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/introspection.d.ts +1 -1
- package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
- package/dist/types/src/runtimes/react/controls/control.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/typography.d.ts +21 -0
- package/dist/types/src/runtimes/react/controls/typography.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/index.d.ts +9 -0
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types.cjs2.js +5 -5
- package/dist/types.cjs2.js.map +1 -1
- package/dist/types.es2.js +2 -2
- package/dist/{text-input.cjs.js → typography.cjs.js} +9 -1
- package/dist/typography.cjs.js.map +1 -0
- package/dist/{text-input.es.js → typography.es.js} +8 -2
- package/dist/typography.es.js.map +1 -0
- package/package.json +1 -1
- package/dist/leaf.cjs.js +0 -182
- package/dist/leaf.cjs.js.map +0 -1
- package/dist/leaf.es.js +0 -179
- package/dist/leaf.es.js.map +0 -1
- package/dist/text-input.cjs.js.map +0 -1
- package/dist/text-input.es.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadOnlyTextV2.cjs.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { useTypographyClassName } from '../../../../components/builtin/Text/components'\nimport useEnhancedTypography from '../../../../components/builtin/Text/components/Leaf/leaf'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { RichTextV2Control, RichTextV2ControlData, RichTextV2Mode } from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Text } from 'slate'\nimport { Link } from '../../../../components/shared/Link'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\n\ntype Props = {\n text: RichTextV2ControlData\n control: RichTextV2Control | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: descendants, control }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = getText(descendants)\n\n const mode = control?.descriptor.config.mode ?? RichTextV2Mode.Block\n\n return (\n <div ref={ref}>\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants descendants={descendants} mode={mode} />\n )}\n </div>\n )\n})\n\nexport default ReadOnlyTextV2\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return (\n <span className={typographyClassName}>\n {descendant.text === '' ? '\\uFEFF' : descendant.text}\n </span>\n )\n}\n\nexport interface InlineProps {\n descendant: Inline\n mode: RichTextV2Mode\n}\n\nfunction InlineElement({ descendant, mode }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} mode={mode} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} mode={mode} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} mode={mode} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} mode={mode} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n mode: RichTextV2Mode\n}\n\nexport function BlockElement({ descendant, mode }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(useResponsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n const quoteStyle = useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n })\n\n switch (descendant.type) {\n case BlockType.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n default:\n if (mode === RichTextV2Mode.Inline)\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n }\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: any): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({ descendants, mode }: { descendants: Descendant[]; mode: RichTextV2Mode }) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <TextElement key={index} descendant={descendant} />\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement key={index} descendant={descendant} mode={mode} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Text:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} mode={mode} />\n default:\n return null\n }\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Descendant): descendant is Block {\n if (isText(descendant)) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n case BlockType.Text:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if (isText(descendant)) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return descendant.children.map(descendant => getTextByDescendant(descendant)).join('') ?? ''\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: Descendant[]): string {\n return descendant.map(getTextByDescendant).join('\\n')\n}\n"],"names":["ReadOnlyTextV2","forwardRef","text","descendants","control","ref","descendantsAsString","getText","mode","descriptor","config","RichTextV2Mode","Block","_jsx","useStyle","display","width","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","margin","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","BlockType","Text","cx","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","Inline","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBMA,MAAAA,iBAAiBC,MAAAA,WAAW,sBAChC;AAAA,EAAEC,MAAMC;AAAAA,EAAaC;AAAAA,GACrBC,KACA;;AACMC,QAAAA,sBAAsBC,QAAQJ,WAAD;AAEnC,QAAMK,OAAOJ,yCAASK,WAAWC,OAAOF,SAA3BJ,YAAmCO,UAAeC,eAAAA;AAG7D,wCAAA,OAAA;AAAA,IAAK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nlyTextV2.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { RichTextV2Control, RichTextV2ControlData, RichTextV2Mode } from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Text } from 'slate'\nimport { Link } from '../../../../components/shared/Link'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\nimport useEnhancedTypography, { useTypographyClassName } from '../typography'\n\ntype Props = {\n text: RichTextV2ControlData\n control: RichTextV2Control | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: descendants, control }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = getText(descendants)\n\n const mode = control?.descriptor.config.mode ?? RichTextV2Mode.Block\n\n return (\n <div ref={ref}>\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants descendants={descendants} mode={mode} />\n )}\n </div>\n )\n})\n\nexport default ReadOnlyTextV2\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return (\n <span className={typographyClassName}>\n {descendant.text === '' ? '\\uFEFF' : descendant.text}\n </span>\n )\n}\n\nexport interface InlineProps {\n descendant: Inline\n mode: RichTextV2Mode\n}\n\nfunction InlineElement({ descendant, mode }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} mode={mode} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} mode={mode} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} mode={mode} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} mode={mode} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n mode: RichTextV2Mode\n}\n\nexport function BlockElement({ descendant, mode }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(useResponsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n const quoteStyle = useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n })\n\n switch (descendant.type) {\n case BlockType.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n default:\n if (mode === RichTextV2Mode.Inline)\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n }\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: any): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({ descendants, mode }: { descendants: Descendant[]; mode: RichTextV2Mode }) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <TextElement key={index} descendant={descendant} />\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement key={index} descendant={descendant} mode={mode} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Text:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} mode={mode} />\n default:\n return null\n }\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Descendant): descendant is Block {\n if (isText(descendant)) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n case BlockType.Text:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if (isText(descendant)) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return descendant.children.map(descendant => getTextByDescendant(descendant)).join('') ?? ''\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: Descendant[]): string {\n return descendant.map(getTextByDescendant).join('\\n')\n}\n"],"names":["ReadOnlyTextV2","forwardRef","text","descendants","control","ref","descendantsAsString","getText","mode","descriptor","config","RichTextV2Mode","Block","_jsx","useStyle","display","width","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","margin","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","BlockType","Text","cx","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","Inline","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeMA,MAAAA,iBAAiBC,MAAAA,WAAW,sBAChC;AAAA,EAAEC,MAAMC;AAAAA,EAAaC;AA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BA,YAAkC;AAC1CA,SAAAA,WAAW4C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;;;"}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import { cx } from "@emotion/css";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { U as useEnhancedTypography, V as useTypographyClassName, n as useResponsiveStyle } from "./index.es.js";
|
|
4
|
+
import { b7 as RichTextV2Mode, U as useStyle, be as BlockType, bc as InlineType } from "./react-page.es.js";
|
|
5
|
+
import { L as Link } from "./index.es3.js";
|
|
5
6
|
import "slate";
|
|
6
7
|
import "./state/breakpoints.es.js";
|
|
7
8
|
import "./types.es2.js";
|
|
8
9
|
import "is-hotkey";
|
|
9
10
|
import "slate-react";
|
|
10
11
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
11
|
-
import { L as Link } from "./index.es3.js";
|
|
12
|
-
import { u as useEnhancedTypography, a as useTypographyClassName } from "./leaf.es.js";
|
|
13
|
-
import "redux";
|
|
14
|
-
import "redux-thunk";
|
|
15
|
-
import "./actions.es.js";
|
|
16
|
-
import "@emotion/serialize";
|
|
17
|
-
import "@emotion/utils";
|
|
18
12
|
import "use-sync-external-store/shim/with-selector";
|
|
19
13
|
import "next/dynamic";
|
|
20
|
-
import "./
|
|
14
|
+
import "./actions.es.js";
|
|
15
|
+
import "./typography.es.js";
|
|
21
16
|
import "./combobox.es.js";
|
|
22
17
|
import "use-sync-external-store/shim";
|
|
18
|
+
import "redux";
|
|
19
|
+
import "redux-thunk";
|
|
23
20
|
import "./types.es.js";
|
|
24
21
|
import "./box-models.es.js";
|
|
25
22
|
import "css-box-model";
|
|
26
23
|
import "color";
|
|
24
|
+
import "@emotion/serialize";
|
|
25
|
+
import "@emotion/utils";
|
|
27
26
|
import "scroll-into-view-if-needed";
|
|
28
27
|
import "react-dom";
|
|
29
28
|
import "html-react-parser";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadOnlyTextV2.es.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { useTypographyClassName } from '../../../../components/builtin/Text/components'\nimport useEnhancedTypography from '../../../../components/builtin/Text/components/Leaf/leaf'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { RichTextV2Control, RichTextV2ControlData, RichTextV2Mode } from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Text } from 'slate'\nimport { Link } from '../../../../components/shared/Link'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\n\ntype Props = {\n text: RichTextV2ControlData\n control: RichTextV2Control | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: descendants, control }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = getText(descendants)\n\n const mode = control?.descriptor.config.mode ?? RichTextV2Mode.Block\n\n return (\n <div ref={ref}>\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants descendants={descendants} mode={mode} />\n )}\n </div>\n )\n})\n\nexport default ReadOnlyTextV2\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return (\n <span className={typographyClassName}>\n {descendant.text === '' ? '\\uFEFF' : descendant.text}\n </span>\n )\n}\n\nexport interface InlineProps {\n descendant: Inline\n mode: RichTextV2Mode\n}\n\nfunction InlineElement({ descendant, mode }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} mode={mode} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} mode={mode} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} mode={mode} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} mode={mode} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n mode: RichTextV2Mode\n}\n\nexport function BlockElement({ descendant, mode }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(useResponsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n const quoteStyle = useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n })\n\n switch (descendant.type) {\n case BlockType.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n default:\n if (mode === RichTextV2Mode.Inline)\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n }\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: any): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({ descendants, mode }: { descendants: Descendant[]; mode: RichTextV2Mode }) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <TextElement key={index} descendant={descendant} />\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement key={index} descendant={descendant} mode={mode} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Text:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} mode={mode} />\n default:\n return null\n }\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Descendant): descendant is Block {\n if (isText(descendant)) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n case BlockType.Text:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if (isText(descendant)) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return descendant.children.map(descendant => getTextByDescendant(descendant)).join('') ?? ''\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: Descendant[]): string {\n return descendant.map(getTextByDescendant).join('\\n')\n}\n"],"names":["ReadOnlyTextV2","forwardRef","text","descendants","control","ref","descendantsAsString","getText","mode","descriptor","config","RichTextV2Mode","Block","_jsx","useStyle","display","width","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","margin","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","BlockType","Text","cx","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","Inline","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;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AGA,aAAA;AAAA;AAEZ;AAED,6BAA6B1B,YAAgC;;AACvD8C,MAAAA,OAAO9C,UAAD,GAAc;AACtB,WAAOA,iBAAWnB,SAAXmB,YAAmB;AAAA,EAC3B;AAEOA,UAAAA,WAAWQ;AAAAA,SACZC,WAAWK;AAAAA,SACXL,WAAWC;AAAAA,SACXD,WAAWI;AAAAA,SACXJ,WAAWG;AACPZ,aAAAA,iBAAWW,SAASiC,IAAI5C,CAAc+C,gBAAAA,oBAAoB/C,WAAD,CAAzD,EAAuEgD,KAAK,EAA5E,MAAAhD,YAAmF;AAAA,SACvFyB,UAAUI;AAAAA,SACVJ,UAAUK;AAAAA,SACVL,UAAUM;AAAAA,SACVN,UAAUU;AAAAA,SACVV,UAAUG;AAAAA,SACVH,UAAUW;AAAAA,SACVX,UAAUa;AAAAA,SACVb,UAAUc;AAAAA,SACVd,UAAUe;AAEXxC,aAAAA,iBAAWW,SACRiC,IAAI5C,CAAc+C,gBAAAA,oBAAoB/C,WAAD,CADxC,EAEGgD,KAAKhD,WAAWW,SAASsC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAAlD,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAW4C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;"}
|
|
1
|
+
{"version":3,"file":"ReadOnlyTextV2.es.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { RichTextV2Control, RichTextV2ControlData, RichTextV2Mode } from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Text } from 'slate'\nimport { Link } from '../../../../components/shared/Link'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\nimport useEnhancedTypography, { useTypographyClassName } from '../typography'\n\ntype Props = {\n text: RichTextV2ControlData\n control: RichTextV2Control | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: descendants, control }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = getText(descendants)\n\n const mode = control?.descriptor.config.mode ?? RichTextV2Mode.Block\n\n return (\n <div ref={ref}>\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants descendants={descendants} mode={mode} />\n )}\n </div>\n )\n})\n\nexport default ReadOnlyTextV2\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return (\n <span className={typographyClassName}>\n {descendant.text === '' ? '\\uFEFF' : descendant.text}\n </span>\n )\n}\n\nexport interface InlineProps {\n descendant: Inline\n mode: RichTextV2Mode\n}\n\nfunction InlineElement({ descendant, mode }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} mode={mode} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} mode={mode} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} mode={mode} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} mode={mode} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n mode: RichTextV2Mode\n}\n\nexport function BlockElement({ descendant, mode }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(useResponsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n const quoteStyle = useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n })\n\n switch (descendant.type) {\n case BlockType.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n default:\n if (mode === RichTextV2Mode.Inline)\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n }\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: any): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({ descendants, mode }: { descendants: Descendant[]; mode: RichTextV2Mode }) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <TextElement key={index} descendant={descendant} />\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement key={index} descendant={descendant} mode={mode} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Text:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} mode={mode} />\n default:\n return null\n }\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Descendant): descendant is Block {\n if (isText(descendant)) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n case BlockType.Text:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if (isText(descendant)) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return descendant.children.map(descendant => getTextByDescendant(descendant)).join('') ?? ''\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: Descendant[]): string {\n return descendant.map(getTextByDescendant).join('\\n')\n}\n"],"names":["ReadOnlyTextV2","forwardRef","text","descendants","control","ref","descendantsAsString","getText","mode","descriptor","config","RichTextV2Mode","Block","_jsx","useStyle","display","width","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","margin","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","BlockType","Text","cx","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","Inline","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeMA,MAAAA,iBAAiBC,WAAW,sBAChC;AAAA,EAAEC,MAAMC;AAAAA,EAAaC;AAAAA,GACrBC,KACA;;AACMC,QAAAA,sBAAsBC,QAAQJ,WAAD;AAEnC,QAAMK,OAAOJ,yCAASK,WAAWC,OAAOF,SAA3BJ,YAAmCO,eAAeC;AAG7D,6BAAA,OAAA;AAAA,IAAK;AAAA,IACFN,UAAAA,wBAAwB,KACvBO,oBAAC,aAAD,EAAA,IAEAA,oBAAC,aAAD;AAAA,MAAa;AAAA,MAA0B;AAAA,IAAA,CAAvC;AAAA,EAAA,CALN;AASD,CAjBgC;AAqBjC,qBAAqB;AAAA,EA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N,UAAUU;AAAAA,SACVV,UAAUG;AAAAA,SACVH,UAAUW;AAAAA,SACVX,UAAUa;AAAAA,SACVb,UAAUc;AAAAA,SACVd,UAAUe;AAEXxC,aAAAA,iBAAWW,SACRiC,IAAI5C,CAAc+C,gBAAAA,oBAAoB/C,WAAD,CADxC,EAEGgD,KAAKhD,WAAWW,SAASsC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAAlD,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAW4C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;"}
|
package/dist/Root.cjs.js
CHANGED
|
@@ -17,7 +17,7 @@ require("./state/breakpoints.cjs.js");
|
|
|
17
17
|
require("slate");
|
|
18
18
|
require("use-sync-external-store/shim/with-selector");
|
|
19
19
|
require("next/dynamic");
|
|
20
|
-
require("./
|
|
20
|
+
require("./typography.cjs.js");
|
|
21
21
|
require("./combobox.cjs.js");
|
|
22
22
|
require("use-sync-external-store/shim");
|
|
23
23
|
require("./types.cjs.js");
|
package/dist/Root.es.js
CHANGED
|
@@ -2,7 +2,7 @@ var _a;
|
|
|
2
2
|
import { normalize } from "polished";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { forwardRef, useRef } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { U as useStyle } from "./react-page.es.js";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { E as Element } from "./index.es.js";
|
|
8
8
|
import { B as BackgroundsContainer, G as GridItem } from "./index.es2.js";
|
|
@@ -16,7 +16,7 @@ import "./state/breakpoints.es.js";
|
|
|
16
16
|
import "slate";
|
|
17
17
|
import "use-sync-external-store/shim/with-selector";
|
|
18
18
|
import "next/dynamic";
|
|
19
|
-
import "./
|
|
19
|
+
import "./typography.es.js";
|
|
20
20
|
import "./combobox.es.js";
|
|
21
21
|
import "use-sync-external-store/shim";
|
|
22
22
|
import "./types.es.js";
|
package/dist/SocialLinks.cjs.js
CHANGED
|
@@ -43,7 +43,7 @@ require("next/link");
|
|
|
43
43
|
require("use-sync-external-store/shim/with-selector");
|
|
44
44
|
require("next/dynamic");
|
|
45
45
|
require("./actions.cjs.js");
|
|
46
|
-
require("./
|
|
46
|
+
require("./typography.cjs.js");
|
|
47
47
|
require("./combobox.cjs.js");
|
|
48
48
|
require("slate");
|
|
49
49
|
require("use-sync-external-store/shim");
|
package/dist/SocialLinks.es.js
CHANGED
|
@@ -35,14 +35,14 @@ import { L as Link } from "./index.es3.js";
|
|
|
35
35
|
import { n as useResponsiveStyle, q as colorToString } from "./index.es.js";
|
|
36
36
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
37
37
|
import { G as GutterContainer } from "./index.es4.js";
|
|
38
|
-
import {
|
|
38
|
+
import { U as useStyle } from "./react-page.es.js";
|
|
39
39
|
import { cx } from "@emotion/css";
|
|
40
40
|
import "scroll-into-view-if-needed";
|
|
41
41
|
import "next/link";
|
|
42
42
|
import "use-sync-external-store/shim/with-selector";
|
|
43
43
|
import "next/dynamic";
|
|
44
44
|
import "./actions.es.js";
|
|
45
|
-
import "./
|
|
45
|
+
import "./typography.es.js";
|
|
46
46
|
import "./combobox.es.js";
|
|
47
47
|
import "slate";
|
|
48
48
|
import "use-sync-external-store/shim";
|
package/dist/Text.cjs.js
CHANGED
|
@@ -33,7 +33,7 @@ require("@emotion/css");
|
|
|
33
33
|
require("@emotion/serialize");
|
|
34
34
|
require("@emotion/utils");
|
|
35
35
|
require("slate");
|
|
36
|
-
require("./
|
|
36
|
+
require("./typography.cjs.js");
|
|
37
37
|
require("./combobox.cjs.js");
|
|
38
38
|
require("use-sync-external-store/shim");
|
|
39
39
|
require("./types.cjs.js");
|
package/dist/Text.es.js
CHANGED
|
@@ -31,7 +31,7 @@ import "@emotion/css";
|
|
|
31
31
|
import "@emotion/serialize";
|
|
32
32
|
import "@emotion/utils";
|
|
33
33
|
import "slate";
|
|
34
|
-
import "./
|
|
34
|
+
import "./typography.es.js";
|
|
35
35
|
import "./combobox.es.js";
|
|
36
36
|
import "use-sync-external-store/shim";
|
|
37
37
|
import "./types.es.js";
|
package/dist/Video.es.js
CHANGED
|
@@ -20,7 +20,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20
20
|
import { cx } from "@emotion/css";
|
|
21
21
|
import { forwardRef, useState, useEffect } from "react";
|
|
22
22
|
import ReactPlayer from "react-player";
|
|
23
|
-
import {
|
|
23
|
+
import { U as useStyle } from "./react-page.es.js";
|
|
24
24
|
import { p as placeholders } from "./placeholders.es.js";
|
|
25
25
|
import { jsx } from "react/jsx-runtime";
|
|
26
26
|
import "redux";
|
package/dist/components.cjs.js
CHANGED
|
@@ -33,7 +33,7 @@ require("./box-models.cjs.js");
|
|
|
33
33
|
require("css-box-model");
|
|
34
34
|
require("use-sync-external-store/shim/with-selector");
|
|
35
35
|
require("next/dynamic");
|
|
36
|
-
require("./
|
|
36
|
+
require("./typography.cjs.js");
|
|
37
37
|
require("./combobox.cjs.js");
|
|
38
38
|
require("use-sync-external-store/shim");
|
|
39
39
|
require("./types.cjs.js");
|
package/dist/components.es.js
CHANGED
|
@@ -31,7 +31,7 @@ import "./box-models.es.js";
|
|
|
31
31
|
import "css-box-model";
|
|
32
32
|
import "use-sync-external-store/shim/with-selector";
|
|
33
33
|
import "next/dynamic";
|
|
34
|
-
import "./
|
|
34
|
+
import "./typography.es.js";
|
|
35
35
|
import "./combobox.es.js";
|
|
36
36
|
import "use-sync-external-store/shim";
|
|
37
37
|
import "./types.es.js";
|
|
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
};
|
|
32
32
|
const import_meta = {};
|
|
33
33
|
import { C as ComboboxControlType } from "./combobox.es.js";
|
|
34
|
-
import {
|
|
34
|
+
import { a7 as ListControlType, a8 as ShapeControlType, a6 as StyleV2ControlType, a3 as RichTextV2ControlType, ae as Types } from "./react-page.es.js";
|
|
35
35
|
import "slate";
|
|
36
36
|
function isSerializedFunction(value) {
|
|
37
37
|
return value instanceof MessagePort;
|
package/dist/controls.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
var
|
|
3
|
+
var typography = require("./typography.cjs.js");
|
|
4
4
|
var reactPage = require("./react-page.cjs.js");
|
|
5
5
|
var combobox = require("./combobox.cjs.js");
|
|
6
6
|
require("redux");
|
|
@@ -12,19 +12,21 @@ require("@emotion/css");
|
|
|
12
12
|
require("@emotion/serialize");
|
|
13
13
|
require("@emotion/utils");
|
|
14
14
|
require("slate");
|
|
15
|
-
exports.Checkbox =
|
|
16
|
-
exports.CheckboxControlType =
|
|
17
|
-
exports.IconRadioGroupControlType =
|
|
18
|
-
exports.Number =
|
|
19
|
-
exports.NumberControlType =
|
|
20
|
-
exports.Select =
|
|
21
|
-
exports.SelectControlType =
|
|
22
|
-
exports.TextArea =
|
|
23
|
-
exports.TextAreaControlType =
|
|
24
|
-
exports.TextInput =
|
|
25
|
-
exports.TextInputControlType =
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
15
|
+
exports.Checkbox = typography.Checkbox;
|
|
16
|
+
exports.CheckboxControlType = typography.CheckboxControlType;
|
|
17
|
+
exports.IconRadioGroupControlType = typography.IconRadioGroupControlType;
|
|
18
|
+
exports.Number = typography.Number;
|
|
19
|
+
exports.NumberControlType = typography.NumberControlType;
|
|
20
|
+
exports.Select = typography.Select;
|
|
21
|
+
exports.SelectControlType = typography.SelectControlType;
|
|
22
|
+
exports.TextArea = typography.TextArea;
|
|
23
|
+
exports.TextAreaControlType = typography.TextAreaControlType;
|
|
24
|
+
exports.TextInput = typography.TextInput;
|
|
25
|
+
exports.TextInputControlType = typography.TextInputControlType;
|
|
26
|
+
exports.TypographyControlType = typography.TypographyControlType;
|
|
27
|
+
exports.unstable_IconRadioGroup = typography.unstable_IconRadioGroup;
|
|
28
|
+
exports.unstable_IconRadioGroupIcon = typography.unstable_IconRadioGroupIcon;
|
|
29
|
+
exports.unstable_Typography = typography.unstable_Typography;
|
|
28
30
|
exports.Color = reactPage.Color;
|
|
29
31
|
exports.ColorControlType = reactPage.ColorControlType;
|
|
30
32
|
exports.Image = reactPage.Image$1;
|
|
@@ -70,6 +72,8 @@ exports.copyShapeData = reactPage.copyShapeData;
|
|
|
70
72
|
exports.copySlotData = reactPage.copySlotData;
|
|
71
73
|
exports.copyStyleData = reactPage.copyStyleData;
|
|
72
74
|
exports.createRichTextV2Plugin = reactPage.createRichTextV2Plugin;
|
|
75
|
+
exports.introspectListData = reactPage.introspectListData;
|
|
76
|
+
exports.introspectShapeData = reactPage.introspectShapeData;
|
|
73
77
|
exports.merge = reactPage.merge;
|
|
74
78
|
exports.mergeSlotData = reactPage.mergeSlotData;
|
|
75
79
|
exports.richTextDAOToDTO = reactPage.richTextDAOToDTO;
|
package/dist/controls.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"controls.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/controls.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { aw as Color,
|
|
1
|
+
export { c as Checkbox, C as CheckboxControlType, I as IconRadioGroupControlType, e as Number, N as NumberControlType, f as Select, S as SelectControlType, g as TextArea, a as TextAreaControlType, h as TextInput, b as TextInputControlType, T as TypographyControlType, d as unstable_IconRadioGroup, u as unstable_IconRadioGroupIcon, i as unstable_Typography } from "./typography.es.js";
|
|
2
|
+
export { aw as Color, ab as ColorControlType, aA as Image, aa as ImageControlType, a0 as ImageControlValueFormat, aC as Link, a9 as LinkControlType, aE as List, aG as ListControl, aF as ListControlMessageType, a7 as ListControlType, a$ as ObjectType, b0 as RichText, b2 as RichTextControl, b1 as RichTextControlMessageType, a4 as RichTextControlType, bb as RichTextV2Control, ba as RichTextV2ControlMessageType, a3 as RichTextV2ControlType, b7 as RichTextV2Mode, aJ as Shape, aL as ShapeControl, aK as ShapeControlMessageType, a8 as ShapeControlType, aO as Slot, aQ as SlotControl, aP as SlotControlMessageType, a5 as SlotControlType, aT as Style, aV as StyleControl, aU as StyleControlMessageType, $ as StyleControlProperty, a2 as StyleControlType, a_ as StyleV2Control, aZ as StyleV2ControlMessageType, a6 as StyleV2ControlType, ay as copy, ax as copyColorData, aB as copyImageData, aD as copyLinkData, aH as copyListData, aM as copyShapeData, aR as copySlotData, aW as copyStyleData, b8 as createRichTextV2Plugin, aI as introspectListData, aN as introspectShapeData, az as merge, aS as mergeSlotData, b6 as richTextDAOToDTO, b4 as richTextDTOtoDAO, b3 as richTextDTOtoSelection, b5 as toSelectionDTO, b9 as unstable_RichTextV2, aY as unstable_StyleV2, aX as unstable_useStyleV2ClassName } from "./react-page.es.js";
|
|
3
3
|
export { a as Combobox, C as ComboboxControlType } from "./combobox.es.js";
|
|
4
4
|
import "redux";
|
|
5
5
|
import "redux-thunk";
|