@makeswift/runtime 0.21.3 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/react.js +45 -0
- package/dist/cjs/api/react.js.map +1 -1
- package/dist/cjs/components/shared/Link/index.js +14 -69
- package/dist/cjs/components/shared/Link/index.js.map +1 -1
- package/dist/cjs/components/utils/responsive-style.js +2 -1
- package/dist/cjs/components/utils/responsive-style.js.map +1 -1
- package/dist/cjs/controls/link.js +46 -2
- package/dist/cjs/controls/link.js.map +1 -1
- package/dist/cjs/controls/rich-text/rich-text.js +12 -0
- package/dist/cjs/controls/rich-text/rich-text.js.map +1 -1
- package/dist/cjs/controls/rich-text-v2/rich-text-v2.js +12 -0
- package/dist/cjs/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/cjs/controls/slot.js +12 -0
- package/dist/cjs/controls/slot.js.map +1 -1
- package/dist/cjs/next/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/next/components/tests/controls/fixtures/rich-text-v2.js +203 -0
- package/dist/cjs/next/components/tests/controls/fixtures/rich-text-v2.js.map +1 -0
- package/dist/cjs/runtimes/react/components/ElementData.js +1 -1
- package/dist/cjs/runtimes/react/components/ElementData.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/control.js +11 -156
- package/dist/cjs/runtimes/react/controls/control.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/EditableText/editable-text.js +1 -0
- package/dist/cjs/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js +9 -3
- package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.js +1 -0
- package/dist/cjs/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.js +2 -2
- package/dist/cjs/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js +12 -9
- package/dist/cjs/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/slot.js +5 -4
- package/dist/cjs/runtimes/react/controls/slot.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/style.js +6 -47
- package/dist/cjs/runtimes/react/controls/style.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/typography.js +49 -51
- package/dist/cjs/runtimes/react/controls/typography.js.map +1 -1
- package/dist/cjs/runtimes/react/controls.js +15 -111
- package/dist/cjs/runtimes/react/controls.js.map +1 -1
- package/dist/cjs/{utils/coalesce.js → runtimes/react/hooks/use-css-id.js} +13 -14
- package/dist/cjs/runtimes/react/hooks/use-css-id.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js +85 -0
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-resolved-value.js +9 -2
- package/dist/cjs/runtimes/react/hooks/use-resolved-value.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-resource-resolver.js +68 -0
- package/dist/cjs/runtimes/react/hooks/use-resource-resolver.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-stylesheet-factory.js +115 -0
- package/dist/cjs/runtimes/react/hooks/use-stylesheet-factory.js.map +1 -0
- package/dist/cjs/runtimes/react/resolvable-record.js +67 -0
- package/dist/cjs/runtimes/react/resolvable-record.js.map +1 -0
- package/dist/cjs/runtimes/react/use-style.js +20 -4
- package/dist/cjs/runtimes/react/use-style.js.map +1 -1
- package/dist/cjs/slate/TypographyPlugin/index.js +2 -1
- package/dist/cjs/slate/TypographyPlugin/index.js.map +1 -1
- package/dist/cjs/slate/TypographyPlugin/normalizeTypographyDown.js +2 -12
- package/dist/cjs/slate/TypographyPlugin/normalizeTypographyDown.js.map +1 -1
- package/dist/cjs/slate/index.js.map +1 -1
- package/dist/cjs/state/modules/breakpoints.js +7 -87
- package/dist/cjs/state/modules/breakpoints.js.map +1 -1
- package/dist/esm/api/react.js +45 -0
- package/dist/esm/api/react.js.map +1 -1
- package/dist/esm/components/shared/Link/index.js +14 -69
- package/dist/esm/components/shared/Link/index.js.map +1 -1
- package/dist/esm/components/utils/responsive-style.js +2 -3
- package/dist/esm/components/utils/responsive-style.js.map +1 -1
- package/dist/esm/controls/link.js +37 -2
- package/dist/esm/controls/link.js.map +1 -1
- package/dist/esm/controls/rich-text/rich-text.js +16 -1
- package/dist/esm/controls/rich-text/rich-text.js.map +1 -1
- package/dist/esm/controls/rich-text-v2/rich-text-v2.js +14 -1
- package/dist/esm/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/esm/controls/slot.js +14 -1
- package/dist/esm/controls/slot.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/next/components/tests/controls/fixtures/rich-text-v2.js +179 -0
- package/dist/esm/next/components/tests/controls/fixtures/rich-text-v2.js.map +1 -0
- package/dist/esm/runtimes/react/components/ElementData.js +2 -2
- package/dist/esm/runtimes/react/components/ElementData.js.map +1 -1
- package/dist/esm/runtimes/react/controls/control.js +11 -175
- package/dist/esm/runtimes/react/controls/control.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/EditableText/editable-text.js +1 -0
- package/dist/esm/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/rich-text.js +8 -2
- package/dist/esm/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.js +1 -0
- package/dist/esm/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.js +1 -1
- package/dist/esm/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js +14 -9
- package/dist/esm/runtimes/react/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/esm/runtimes/react/controls/slot.js +4 -3
- package/dist/esm/runtimes/react/controls/slot.js.map +1 -1
- package/dist/esm/runtimes/react/controls/style.js +6 -37
- package/dist/esm/runtimes/react/controls/style.js.map +1 -1
- package/dist/esm/runtimes/react/controls/typography.js +49 -48
- package/dist/esm/runtimes/react/controls/typography.js.map +1 -1
- package/dist/esm/runtimes/react/controls.js +14 -129
- package/dist/esm/runtimes/react/controls.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-css-id.js +8 -0
- package/dist/esm/runtimes/react/hooks/use-css-id.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js +53 -0
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-resolved-value.js +9 -2
- package/dist/esm/runtimes/react/hooks/use-resolved-value.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-resource-resolver.js +34 -0
- package/dist/esm/runtimes/react/hooks/use-resource-resolver.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-stylesheet-factory.js +94 -0
- package/dist/esm/runtimes/react/hooks/use-stylesheet-factory.js.map +1 -0
- package/dist/esm/runtimes/react/resolvable-record.js +43 -0
- package/dist/esm/runtimes/react/resolvable-record.js.map +1 -0
- package/dist/esm/runtimes/react/use-style.js +17 -3
- package/dist/esm/runtimes/react/use-style.js.map +1 -1
- package/dist/esm/slate/TypographyPlugin/index.js +2 -1
- package/dist/esm/slate/TypographyPlugin/index.js.map +1 -1
- package/dist/esm/slate/TypographyPlugin/normalizeTypographyDown.js +1 -1
- package/dist/esm/slate/TypographyPlugin/normalizeTypographyDown.js.map +1 -1
- package/dist/esm/slate/index.js.map +1 -1
- package/dist/esm/state/modules/breakpoints.js +9 -70
- package/dist/esm/state/modules/breakpoints.js.map +1 -1
- package/dist/types/api/react.d.ts +11 -1
- package/dist/types/api/react.d.ts.map +1 -1
- package/dist/types/components/builtin/Button/Button.d.ts +2 -2
- package/dist/types/components/shared/Link/index.d.ts.map +1 -1
- package/dist/types/components/utils/responsive-style.d.ts +1 -1
- package/dist/types/components/utils/responsive-style.d.ts.map +1 -1
- package/dist/types/controls/link.d.ts +16 -2
- package/dist/types/controls/link.d.ts.map +1 -1
- package/dist/types/controls/rich-text/rich-text.d.ts +2 -1
- package/dist/types/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts +2 -1
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/controls/slot.d.ts +2 -1
- package/dist/types/controls/slot.d.ts.map +1 -1
- package/dist/types/locale.d.ts +1 -1
- package/dist/types/next/components/tests/controls/fixtures/rich-text-v2.d.ts +40 -0
- package/dist/types/next/components/tests/controls/fixtures/rich-text-v2.d.ts.map +1 -0
- package/dist/types/next/components/tests/controls/rich-text-v2-control.test.d.ts +2 -0
- package/dist/types/next/components/tests/controls/rich-text-v2-control.test.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/control.d.ts +1 -1
- package/dist/types/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text/rich-text.d.ts +1 -1
- package/dist/types/runtimes/react/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +3 -3
- package/dist/types/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts +1 -1
- package/dist/types/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/slot.d.ts +4 -1
- package/dist/types/runtimes/react/controls/slot.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/style.d.ts +4 -3
- package/dist/types/runtimes/react/controls/style.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/typography.d.ts +5 -6
- package/dist/types/runtimes/react/controls/typography.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls.d.ts +1 -1
- package/dist/types/runtimes/react/controls.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-css-id.d.ts +2 -0
- package/dist/types/runtimes/react/hooks/use-css-id.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-resolved-value.d.ts +2 -2
- package/dist/types/runtimes/react/hooks/use-resolved-value.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-resource-resolver.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-resource-resolver.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-stylesheet-factory.d.ts +7 -0
- package/dist/types/runtimes/react/hooks/use-stylesheet-factory.d.ts.map +1 -0
- package/dist/types/runtimes/react/resolvable-record.d.ts +3 -0
- package/dist/types/runtimes/react/resolvable-record.d.ts.map +1 -0
- package/dist/types/runtimes/react/use-style.d.ts +4 -0
- package/dist/types/runtimes/react/use-style.d.ts.map +1 -1
- package/dist/types/slate/BlockPlugin/index.d.ts +5 -5
- package/dist/types/slate/LinkPlugin/getValue.d.ts +1 -1
- package/dist/types/slate/LinkPlugin/index.d.ts +1 -1
- package/dist/types/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/slate/TypographyPlugin/normalizeTypographyDown.d.ts.map +1 -1
- package/dist/types/slate/index.d.ts +1 -0
- package/dist/types/slate/index.d.ts.map +1 -1
- package/dist/types/slate/test-helpers/slate-test-helper.d.ts +4 -4
- package/dist/types/slate/test-helpers/test-elements.d.ts +1 -1
- package/dist/types/state/modules/breakpoints.d.ts +2 -21
- package/dist/types/state/modules/breakpoints.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/cjs/runtimes/react/controls/color.js +0 -58
- package/dist/cjs/runtimes/react/controls/color.js.map +0 -1
- package/dist/cjs/runtimes/react/controls/image.js +0 -53
- package/dist/cjs/runtimes/react/controls/image.js.map +0 -1
- package/dist/cjs/runtimes/react/controls/link.js +0 -110
- package/dist/cjs/runtimes/react/controls/link.js.map +0 -1
- package/dist/cjs/runtimes/react/controls/list.js +0 -58
- package/dist/cjs/runtimes/react/controls/list.js.map +0 -1
- package/dist/cjs/runtimes/react/controls/shape.js +0 -44
- package/dist/cjs/runtimes/react/controls/shape.js.map +0 -1
- package/dist/cjs/runtimes/react/controls/style-v2.js +0 -92
- package/dist/cjs/runtimes/react/controls/style-v2.js.map +0 -1
- package/dist/cjs/utils/coalesce.js.map +0 -1
- package/dist/cjs/utils/shallowMerge.js +0 -44
- package/dist/cjs/utils/shallowMerge.js.map +0 -1
- package/dist/esm/runtimes/react/controls/color.js +0 -24
- package/dist/esm/runtimes/react/controls/color.js.map +0 -1
- package/dist/esm/runtimes/react/controls/image.js +0 -29
- package/dist/esm/runtimes/react/controls/image.js.map +0 -1
- package/dist/esm/runtimes/react/controls/link.js +0 -76
- package/dist/esm/runtimes/react/controls/link.js.map +0 -1
- package/dist/esm/runtimes/react/controls/list.js +0 -34
- package/dist/esm/runtimes/react/controls/list.js.map +0 -1
- package/dist/esm/runtimes/react/controls/shape.js +0 -20
- package/dist/esm/runtimes/react/controls/shape.js.map +0 -1
- package/dist/esm/runtimes/react/controls/style-v2.js +0 -72
- package/dist/esm/runtimes/react/controls/style-v2.js.map +0 -1
- package/dist/esm/utils/coalesce.js +0 -13
- package/dist/esm/utils/coalesce.js.map +0 -1
- package/dist/esm/utils/shallowMerge.js +0 -14
- package/dist/esm/utils/shallowMerge.js.map +0 -1
- package/dist/types/runtimes/react/controls/color.d.ts +0 -4
- package/dist/types/runtimes/react/controls/color.d.ts.map +0 -1
- package/dist/types/runtimes/react/controls/image.d.ts +0 -4
- package/dist/types/runtimes/react/controls/image.d.ts.map +0 -1
- package/dist/types/runtimes/react/controls/link.d.ts +0 -4
- package/dist/types/runtimes/react/controls/link.d.ts.map +0 -1
- package/dist/types/runtimes/react/controls/list.d.ts +0 -12
- package/dist/types/runtimes/react/controls/list.d.ts.map +0 -1
- package/dist/types/runtimes/react/controls/shape.d.ts +0 -12
- package/dist/types/runtimes/react/controls/shape.d.ts.map +0 -1
- package/dist/types/runtimes/react/controls/style-v2.d.ts +0 -13
- package/dist/types/runtimes/react/controls/style-v2.d.ts.map +0 -1
- package/dist/types/utils/coalesce.d.ts +0 -3
- package/dist/types/utils/coalesce.d.ts.map +0 -1
- package/dist/types/utils/shallowMerge.d.ts +0 -2
- package/dist/types/utils/shallowMerge.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef } from 'react'\n\nimport { RichTextV2Definition, RichText } from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Element, Text } from 'slate'\nimport { toText } from '../../../../slate'\nimport { ControlValue } from '../control'\nimport { RenderElementProps, RenderLeafProps } from 'slate-react'\nimport { RichTextV2Plugin } from '../../../../controls/rich-text-v2/plugin'\nimport { RichTextDataV2 } from '../../../../controls/rich-text-v2'\n\ntype Props = {\n text: RichTextDataV2 |
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef } from 'react'\n\nimport { RichTextV2Definition, RichText } from '../../../../controls/rich-text-v2'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Element, Text } from 'slate'\nimport { toText } from '../../../../slate'\nimport { ControlValue } from '../control'\nimport { RenderElementProps, RenderLeafProps } from 'slate-react'\nimport { RichTextV2Plugin } from '../../../../controls/rich-text-v2/plugin'\nimport { RichTextDataV2 } from '../../../../controls/rich-text-v2'\n\ntype Props = {\n text: RichTextDataV2 | undefined\n definition: RichTextV2Definition | undefined\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text, definition }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = toText(\n text?.descendants ?? [],\n definition?.config.mode ?? RichText.Mode.Block,\n )\n\n return (\n <div\n ref={ref}\n style={{\n /**\n * These are the default styles that Slate uses for its editable div.\n * https://github.com/ianstormtaylor/slate/blob/4bd15ed3950e3a0871f5d0ecb391bb637c05e59d/packages/slate-react/src/components/editable.tsx\n * Search for `disableDefaultStyles`\n */\n position: 'relative',\n whiteSpace: 'pre-wrap',\n wordWrap: 'break-word',\n }}\n >\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants\n plugins={definition?.config.plugins ?? []}\n descendants={text?.descendants ?? []}\n />\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\ntype LeafProps = {\n leaf: Text\n plugins: RichTextV2Plugin[]\n}\n\nexport function LeafComponent({ plugins, ...props }: LeafProps) {\n function initialRenderLeaf({ leaf }: RenderLeafProps) {\n return <span className={leaf.className}>{leaf.text === '' ? '\\uFEFF' : leaf.text}</span>\n }\n\n const renderLeaf = plugins.reduce(\n (renderFn, plugin) => (props: RenderLeafProps) => {\n const { control, renderLeaf } = plugin\n\n if (control?.definition == null || renderLeaf == null) return renderFn(props)\n\n if (control.getLeafValue == null) return renderLeaf(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getLeafValue(props.leaf)}>\n {value => renderLeaf(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderLeaf,\n )\n\n return renderLeaf({ attributes: {} as any, leaf: props.leaf, children: null, text: props.leaf })\n}\n\ntype ElementProps = {\n descendant: Element\n plugins: RichTextV2Plugin[]\n}\n\nfunction ElementComponent({ plugins, ...props }: ElementProps) {\n function initialRenderElement(props: RenderElementProps) {\n return <Descendants descendants={props.element.children} plugins={plugins} />\n }\n\n const renderElement = plugins.reduce(\n (renderFn, plugin) => (props: RenderElementProps) => {\n const { control, renderElement } = plugin\n\n if (control?.definition == null || renderElement == null) return renderFn(props)\n\n if (control.getElementValue == null) return renderElement(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getElementValue(props.element)}>\n {value => renderElement(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderElement,\n )\n\n return renderElement({ attributes: {} as any, children: null, element: props.descendant })\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: Descendant): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({\n descendants,\n plugins,\n}: {\n plugins: RichTextV2Plugin[]\n descendants: Descendant[]\n}) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <LeafComponent key={index} plugins={plugins} leaf={descendant} />\n }\n\n return <ElementComponent key={index} descendant={descendant} plugins={plugins} />\n })}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwCQ;AAxCR,mBAAyC;AAEzC,0BAA+C;AAC/C,uBAAyB;AAEzB,IAAAA,gBAAuB;AACvB,qBAA6B;AAU7B,MAAM,qBAAiB,yBAAW,SAAS,aACzC,EAAE,MAAM,WAAW,GACnB,KACA;AACA,QAAM,0BAAsB;AAAA,IAC1B,MAAM,eAAe,CAAC;AAAA,IACtB,YAAY,OAAO,QAAQ,6BAAS,KAAK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O,WAAW,EAAE,YAAY,CAAC,GAAU,MAAM,MAAM,MAAM,UAAU,MAAM,MAAM,MAAM,KAAK,CAAC;AACjG;AAOA,SAAS,iBAAiB,EAAE,SAAS,GAAG,MAAM,GAAiB;AAC7D,WAAS,qBAAqBA,QAA2B;AACvD,WAAO,4CAAC,eAAY,aAAaA,OAAM,QAAQ,UAAU,SAAkB;AAAA,EAC7E;AAEA,QAAM,gBAAgB,QAAQ;AAAA,IAC5B,CAAC,UAAU,WAAW,CAACA,WAA8B;AACnD,YAAM,EAAE,SAAS,eAAAE,eAAc,IAAI;AAEnC,UAAI,SAAS,cAAc,QAAQA,kBAAiB;AAAM,eAAO,SAASF,MAAK;AAE/E,UAAI,QAAQ,mBAAmB;AAAM,eAAOE,eAAc,UAAU,MAAS,EAAEF,MAAK;AAEpF,aACE,4CAAC,+BAAa,YAAY,QAAQ,YAAY,MAAM,QAAQ,gBAAgBA,OAAM,OAAO,GACtF,qBAASE,eAAc,UAAU,KAAK,EAAEF,MAAK,GAChD;AAAA,IAEJ;AAAA,IACA;AAAA,EACF;AAEA,SAAO,cAAc,EAAE,YAAY,CAAC,GAAU,UAAU,MAAM,SAAS,MAAM,WAAW,CAAC;AAC3F;AAGA,SAAS,OAAO,MAAgC;AAC9C,MAAI,OAAO,SAAS,YAAY,UAAU;AAAM,WAAO;AAEvD,SAAO;AACT;AAEA,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AACF,GAGG;AACD,SACE,2EACG,sBAAY,IAAI,CAAC,YAAY,UAAU;AACtC,QAAI,OAAO,UAAU,GAAG;AACtB,aAAO,4CAAC,iBAA0B,SAAkB,MAAM,cAA/B,KAA2C;AAAA,IACxE;AAEA,WAAO,4CAAC,oBAA6B,YAAwB,WAA/B,KAAiD;AAAA,EACjF,CAAC,GACH;AAEJ;","names":["import_slate","props","renderLeaf","renderElement"]}
|
|
@@ -28,25 +28,28 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var rich_text_v2_exports = {};
|
|
30
30
|
__export(rich_text_v2_exports, {
|
|
31
|
-
|
|
31
|
+
renderRichTextV2: () => renderRichTextV2
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(rich_text_v2_exports);
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
35
|
var import_react = require("react");
|
|
36
36
|
var import_rich_text_v2 = require("../../../../controls/rich-text-v2");
|
|
37
|
-
var
|
|
37
|
+
var import_use_is_preview = require("../../../react/hooks/use-is-preview");
|
|
38
38
|
const EditableText = (0, import_react.lazy)(() => Promise.resolve().then(() => __toESM(require("./EditableTextV2"))));
|
|
39
39
|
const ReadOnlyText = (0, import_react.lazy)(() => Promise.resolve().then(() => __toESM(require("./ReadOnlyTextV2"))));
|
|
40
40
|
const ReadOnlyTextV1 = (0, import_react.lazy)(() => Promise.resolve().then(() => __toESM(require("../rich-text/ReadOnlyText"))));
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
function renderRichTextV2(data, definition, control) {
|
|
42
|
+
return import_rich_text_v2.RichTextV2Definition.isV1Data(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReadOnlyTextV1, { text: data }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RichTextV2, { data, definition, control });
|
|
43
|
+
}
|
|
44
|
+
function RichTextV2({
|
|
45
|
+
data,
|
|
46
|
+
definition,
|
|
47
|
+
control
|
|
48
|
+
}) {
|
|
49
|
+
return (0, import_use_is_preview.useIsPreview)() ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditableText, { text: data, definition, control }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReadOnlyText, { text: data, definition });
|
|
47
50
|
}
|
|
48
51
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
52
|
0 && (module.exports = {
|
|
50
|
-
|
|
53
|
+
renderRichTextV2
|
|
51
54
|
});
|
|
52
55
|
//# sourceMappingURL=rich-text-v2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/runtimes/react/controls/rich-text-v2/rich-text-v2.tsx"],"sourcesContent":["import { ReactNode, lazy } from 'react'\n\nimport { type DataType } from '@makeswift/controls'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/runtimes/react/controls/rich-text-v2/rich-text-v2.tsx"],"sourcesContent":["import { ReactNode, lazy } from 'react'\n\nimport { type DataType } from '@makeswift/controls'\nimport {\n RichTextV2Control,\n RichTextV2Definition,\n RichTextDataV2,\n} from '../../../../controls/rich-text-v2'\nimport { useIsPreview } from '../../../react/hooks/use-is-preview'\n\nexport type RichTextV2ControlValue = ReactNode\n\nexport type Descriptors = { text?: RichTextV2Definition }\n\nconst EditableText = lazy(() => import('./EditableTextV2'))\nconst ReadOnlyText = lazy(() => import('./ReadOnlyTextV2'))\n\nconst ReadOnlyTextV1 = lazy(() => import('../rich-text/ReadOnlyText'))\n\nexport function renderRichTextV2(\n data: DataType<RichTextV2Definition> | undefined,\n definition: RichTextV2Definition,\n control: RichTextV2Control | null,\n): ReactNode {\n return RichTextV2Definition.isV1Data(data) ? (\n <ReadOnlyTextV1 text={data} />\n ) : (\n <RichTextV2 data={data} definition={definition} control={control} />\n )\n}\n\nfunction RichTextV2({\n data,\n definition,\n control,\n}: {\n data: RichTextDataV2 | undefined\n definition: RichTextV2Definition\n control: RichTextV2Control | null\n}) {\n return useIsPreview() ? (\n <EditableText text={data} definition={definition} control={control} />\n ) : (\n <ReadOnlyText text={data} definition={definition} />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBI;AAzBJ,mBAAgC;AAGhC,0BAIO;AACP,4BAA6B;AAM7B,MAAM,mBAAe,mBAAK,MAAM,6CAAO,kBAAkB,GAAC;AAC1D,MAAM,mBAAe,mBAAK,MAAM,6CAAO,kBAAkB,GAAC;AAE1D,MAAM,qBAAiB,mBAAK,MAAM,6CAAO,2BAA2B,GAAC;AAE9D,SAAS,iBACd,MACA,YACA,SACW;AACX,SAAO,yCAAqB,SAAS,IAAI,IACvC,4CAAC,kBAAe,MAAM,MAAM,IAE5B,4CAAC,cAAW,MAAY,YAAwB,SAAkB;AAEtE;AAEA,SAAS,WAAW;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,aAAO,oCAAa,IAClB,4CAAC,gBAAa,MAAM,MAAM,YAAwB,SAAkB,IAEpE,4CAAC,gBAAa,MAAM,MAAM,YAAwB;AAEtD;","names":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
"use client";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -19,7 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
20
|
var slot_exports = {};
|
|
20
21
|
__export(slot_exports, {
|
|
21
22
|
Slot: () => Slot,
|
|
22
|
-
|
|
23
|
+
renderSlot: () => renderSlot
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(slot_exports);
|
|
25
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -30,8 +31,8 @@ var import_columns = require("../../../components/utils/columns");
|
|
|
30
31
|
var import_responsive_style = require("../../../components/utils/responsive-style");
|
|
31
32
|
var import_use_style = require("../use-style");
|
|
32
33
|
var import_poll_box_model = require("../poll-box-model");
|
|
33
|
-
function
|
|
34
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotValue, {
|
|
34
|
+
function renderSlot(props) {
|
|
35
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlotValue, { ...props });
|
|
35
36
|
}
|
|
36
37
|
const SlotValue = (0, import_react.memo)(
|
|
37
38
|
({
|
|
@@ -149,6 +150,6 @@ function SlotPlaceholder({ control }) {
|
|
|
149
150
|
// Annotate the CommonJS export names for ESM import in node:
|
|
150
151
|
0 && (module.exports = {
|
|
151
152
|
Slot,
|
|
152
|
-
|
|
153
|
+
renderSlot
|
|
153
154
|
});
|
|
154
155
|
//# sourceMappingURL=slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/controls/slot.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/controls/slot.tsx"],"sourcesContent":["'use client'\n\nimport { ComponentPropsWithoutRef, ElementType, ReactNode, useEffect, useState, memo } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { SlotDefinition, SlotControl, type DataType } from '@makeswift/controls'\n\nimport { Element } from '../components/Element'\nimport { getIndexes } from '../../../components/utils/columns'\nimport { useResponsiveStyle } from '../../../components/utils/responsive-style'\nimport { useStyle } from '../use-style'\nimport { pollBoxModel } from '../poll-box-model'\n\nexport function renderSlot(props: {\n data: DataType<SlotDefinition<ReactNode>> | undefined\n control: SlotControl | null\n}): ReactNode {\n return <SlotValue {...props} />\n}\n\nconst SlotValue = memo(\n ({\n data,\n control,\n }: {\n data: DataType<SlotDefinition<ReactNode>> | undefined\n control: SlotControl | null\n }): ReactNode => {\n // TODO(miguel): While the UI shouldn't allow the state, we should probably check that at least\n // one element is visible.\n if (data == null || data.elements.length === 0) {\n return <Slot.Placeholder control={control} />\n }\n\n return (\n <Slot control={control}>\n {data.elements.map((element, i) => (\n <Slot.Item key={element.key} control={control} grid={data.columns} index={i}>\n <Element element={element} />\n </Slot.Item>\n ))}\n </Slot>\n )\n },\n)\n\ntype SlotProps<T extends ElementType> = {\n as?: T\n control: SlotControl | null\n children?: ReactNode\n className?: string\n}\n\nexport function Slot<T extends ElementType = 'div'>({\n as,\n control,\n children,\n className,\n ...restOfProps\n}: SlotProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof SlotProps<T>>) {\n const As = as ?? 'div'\n const [element, setElement] = useState<Element | null>(null)\n const baseClassName = useStyle({\n display: 'flex',\n flexWrap: 'wrap',\n width: '100%',\n })\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeContainerBoxModel(boxModel),\n })\n }, [element, control])\n\n return (\n <As {...restOfProps} ref={setElement} className={cx(baseClassName, className)}>\n {children}\n </As>\n )\n}\n\nSlot.Placeholder = SlotPlaceholder\n\nSlot.Item = SlotItem\n\ntype SlotItemProps<T extends ElementType> = {\n as?: T\n control: SlotControl | null\n // @arvin: review for correctness\n grid: DataType<SlotDefinition<ReactNode>> extends undefined\n ? undefined\n : NonNullable<DataType<SlotDefinition<ReactNode>>>['columns']\n index: number\n children?: ReactNode\n className?: string\n}\n\nfunction SlotItem<T extends ElementType = 'div'>({\n as,\n control,\n grid,\n index,\n children,\n className,\n ...restOfProps\n}: SlotItemProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof SlotItemProps<T>>): JSX.Element {\n const As = as ?? 'div'\n const [element, setElement] = useState<Element | null>(null)\n const baseClassName = useStyle({\n display: 'flex',\n ...useResponsiveStyle([grid], ([{ count = 12, spans = [[12]] } = {}]) => {\n const [rowIndex, columnIndex] = getIndexes(spans, index)\n const span = spans[rowIndex][columnIndex]\n const flexBasis = `calc(100% * ${(span / count).toFixed(5)})`\n\n return span === 0 ? { display: 'none' } : { flexBasis, minWidth: flexBasis }\n }),\n })\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeItemBoxModel(index, boxModel),\n })\n }, [element, control, index])\n\n return (\n <As {...restOfProps} ref={setElement} className={cx(baseClassName, className)}>\n {children}\n </As>\n )\n}\n\ntype SlotPlaceholderProps = {\n control: SlotControl | null\n}\n\nfunction SlotPlaceholder({ control }: SlotPlaceholderProps): JSX.Element {\n const [element, setElement] = useState<Element | null>(null)\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeContainerBoxModel(boxModel),\n })\n }, [element, control])\n\n return (\n <div\n ref={setElement}\n className={useStyle({\n width: '100%',\n background: 'rgba(161, 168, 194, 0.18)',\n height: '80px',\n })}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"100%\"\n height=\"100%\"\n className={useStyle({ overflow: 'visible', padding: 8 })}\n >\n <rect\n x={0}\n y={0}\n width=\"100%\"\n height=\"100%\"\n strokeWidth={2}\n strokeDasharray=\"4 2\"\n fill=\"none\"\n stroke=\"rgba(161, 168, 194, 0.40)\"\n rx=\"4\"\n ry=\"4\"\n />\n </svg>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBS;AAfT,mBAA4F;AAC5F,iBAAmB;AAInB,qBAAwB;AACxB,qBAA2B;AAC3B,8BAAmC;AACnC,uBAAyB;AACzB,4BAA6B;AAEtB,SAAS,WAAW,OAGb;AACZ,SAAO,4CAAC,aAAW,GAAG,OAAO;AAC/B;AAEA,MAAM,gBAAY;AAAA,EAChB,CAAC;AAAA,IACC;AAAA,IACA;AAAA,EACF,MAGiB;AAGf,QAAI,QAAQ,QAAQ,KAAK,SAAS,WAAW,GAAG;AAC9C,aAAO,4CAAC,KAAK,aAAL,EAAiB,SAAkB;AAAA,IAC7C;AAEA,WACE,4CAAC,QAAK,SACH,eAAK,SAAS,IAAI,CAAC,SAAS,MAC3B,4CAAC,KAAK,MAAL,EAA4B,SAAkB,MAAM,KAAK,SAAS,OAAO,GACxE,sDAAC,0BAAQ,SAAkB,KADb,QAAQ,GAExB,CACD,GACH;AAAA,EAEJ;AACF;AASO,SAAS,KAAoC;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GA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MACA,kBAAkB,cAAY,QAAQ,mBAAmB,OAAO,QAAQ;AAAA,IAC1E,CAAC;AAAA,EACH,GAAG,CAAC,SAAS,SAAS,KAAK,CAAC;AAE5B,SACE,4CAAC,MAAI,GAAG,aAAa,KAAK,YAAY,eAAW,eAAG,eAAe,SAAS,GACzE,UACH;AAEJ;AAMA,SAAS,gBAAgB,EAAE,QAAQ,GAAsC;AACvE,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAyB,IAAI;AAE3D,8BAAU,MAAM;AACd,QAAI,WAAW,QAAQ,WAAW;AAAM;AAExC,eAAO,oCAAa;AAAA,MAClB;AAAA,MACA,kBAAkB,cAAY,QAAQ,wBAAwB,QAAQ;AAAA,IACxE,CAAC;AAAA,EACH,GAAG,CAAC,SAAS,OAAO,CAAC;AAErB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,eAAW,2BAAS;AAAA,QAClB,OAAO;AAAA,QACP,YAAY;AAAA,QACZ,QAAQ;AAAA,MACV,CAAC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACC,OAAM;AAAA,UACN,OAAM;AAAA,UACN,QAAO;AAAA,UACP,eAAW,2BAAS,EAAE,UAAU,WAAW,SAAS,EAAE,CAAC;AAAA,UAEvD;AAAA,YAAC;AAAA;AAAA,cACC,GAAG;AAAA,cACH,GAAG;AAAA,cACH,OAAM;AAAA,cACN,QAAO;AAAA,cACP,aAAa;AAAA,cACb,iBAAgB;AAAA,cAChB,MAAK;AAAA,cACL,QAAO;AAAA,cACP,IAAG;AAAA,cACH,IAAG;AAAA;AAAA,UACL;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,31 +15,18 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var style_exports = {};
|
|
30
20
|
__export(style_exports, {
|
|
31
|
-
|
|
21
|
+
styleV1Css: () => styleV1Css
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(style_exports);
|
|
34
|
-
var import_react = require("react");
|
|
35
24
|
var import_controls = require("@makeswift/controls");
|
|
36
|
-
var import_hooks = require("../../../components/hooks");
|
|
37
25
|
var import_colorToString = require("../../../components/utils/colorToString");
|
|
38
26
|
var import_responsive_style = require("../../../components/utils/responsive-style");
|
|
39
|
-
var import_use_style = require("../use-style");
|
|
40
27
|
var import_length_percentage = require("../../../css/length-percentage");
|
|
41
28
|
var import_margin = require("../../../css/margin");
|
|
42
29
|
var import_padding = require("../../../css/padding");
|
|
43
|
-
var import_box_model = require("../../../box-model");
|
|
44
|
-
var import_deepEqual = __toESM(require("../../../utils/deepEqual"));
|
|
45
30
|
const defaultMargin = {
|
|
46
31
|
marginTop: 0,
|
|
47
32
|
marginRight: "auto",
|
|
@@ -54,18 +39,18 @@ const defaultPadding = {
|
|
|
54
39
|
paddingBottom: 0,
|
|
55
40
|
paddingLeft: 0
|
|
56
41
|
};
|
|
57
|
-
function
|
|
58
|
-
const { properties } = controlDefinition.config;
|
|
42
|
+
function styleV1Css(breakpoints, style, properties) {
|
|
59
43
|
return {
|
|
60
44
|
...properties.includes(import_controls.Style.Width) && {
|
|
61
45
|
maxWidth: "100%"
|
|
62
46
|
},
|
|
63
|
-
...(0, import_responsive_style.
|
|
47
|
+
...(0, import_responsive_style.responsiveStyle)(
|
|
48
|
+
breakpoints,
|
|
64
49
|
[
|
|
65
50
|
style?.width,
|
|
66
51
|
style?.margin,
|
|
67
52
|
style?.padding,
|
|
68
|
-
|
|
53
|
+
style?.border,
|
|
69
54
|
style?.borderRadius,
|
|
70
55
|
style?.textStyle
|
|
71
56
|
],
|
|
@@ -118,34 +103,8 @@ function useStyleControlCssObject(style, controlDefinition) {
|
|
|
118
103
|
return `${fontSize.value}${fontSize.unit}`;
|
|
119
104
|
}
|
|
120
105
|
}
|
|
121
|
-
function useFormattedStyle(styleControlData, controlDefinition, control) {
|
|
122
|
-
const style = useStyleControlCssObject(styleControlData, controlDefinition);
|
|
123
|
-
const guid = (0, import_react.useId)().replaceAll(":", "");
|
|
124
|
-
const styleClassName = (0, import_use_style.useStyle)(style);
|
|
125
|
-
const classNames = `${styleClassName} ${guid}`;
|
|
126
|
-
(0, import_react.useEffect)(() => {
|
|
127
|
-
let currentBoxModel = null;
|
|
128
|
-
const handleAnimationFrameRequest = () => {
|
|
129
|
-
if (control == null)
|
|
130
|
-
return;
|
|
131
|
-
const element = document.querySelector(`.${guid}`);
|
|
132
|
-
const measuredBoxModel = element == null ? null : (0, import_box_model.getBox)(element);
|
|
133
|
-
if (!(0, import_deepEqual.default)(currentBoxModel, measuredBoxModel)) {
|
|
134
|
-
currentBoxModel = measuredBoxModel;
|
|
135
|
-
control.changeBoxModel(currentBoxModel);
|
|
136
|
-
}
|
|
137
|
-
animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
138
|
-
};
|
|
139
|
-
let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
140
|
-
return () => {
|
|
141
|
-
cancelAnimationFrame(animationFrameHandle);
|
|
142
|
-
control?.changeBoxModel(null);
|
|
143
|
-
};
|
|
144
|
-
}, [guid, control]);
|
|
145
|
-
return classNames;
|
|
146
|
-
}
|
|
147
106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
148
107
|
0 && (module.exports = {
|
|
149
|
-
|
|
108
|
+
styleV1Css
|
|
150
109
|
});
|
|
151
110
|
//# sourceMappingURL=style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/controls/style.ts"],"sourcesContent":["import { CSSObject } from '@emotion/css'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/controls/style.ts"],"sourcesContent":["import { CSSObject } from '@emotion/css'\nimport {\n Style,\n type StyleProperty,\n type ResolvedBorderSideData,\n type FontSizePropertyData,\n type WidthPropertyData,\n type ResolvedStyleData,\n} from '@makeswift/controls'\n\nimport { colorToString } from '../../../components/utils/colorToString'\nimport { responsiveStyle } from '../../../components/utils/responsive-style'\n\nimport { BorderRadiusLonghandPropertyData } from '../../../css/border-radius'\nimport { lengthPercentageDataToString } from '../../../css/length-percentage'\nimport { marginPropertyDataToStyle } from '../../../css/margin'\nimport { paddingPropertyDataToStyle } from '../../../css/padding'\nimport { Breakpoints } from '../../../state/modules/breakpoints'\n\nconst defaultMargin = {\n marginTop: 0,\n marginRight: 'auto',\n marginBottom: 0,\n marginLeft: 'auto',\n}\n\nconst defaultPadding = {\n paddingTop: 0,\n paddingRight: 0,\n paddingBottom: 0,\n paddingLeft: 0,\n}\n\nexport function styleV1Css(\n breakpoints: Breakpoints,\n style: ResolvedStyleData | undefined,\n properties: StyleProperty[],\n): CSSObject {\n return {\n ...(properties.includes(Style.Width) && {\n maxWidth: '100%',\n }),\n ...responsiveStyle(\n breakpoints,\n [\n style?.width,\n style?.margin,\n style?.padding,\n style?.border,\n style?.borderRadius,\n style?.textStyle,\n ] as const,\n ([width, margin, padding, border, borderRadius, textStyle]) => ({\n ...(properties.includes(Style.Width) && {\n width: widthToString(width) ?? '100%',\n }),\n ...(properties.includes(Style.Margin) &&\n marginPropertyDataToStyle(margin ?? defaultMargin, defaultMargin)),\n ...(properties.includes(Style.Padding) &&\n paddingPropertyDataToStyle(padding ?? defaultPadding, defaultPadding)),\n ...(properties.includes(Style.Border) && {\n borderTop: borderSideToString(border?.borderTop) ?? '0 solid black',\n borderRight: borderSideToString(border?.borderRight) ?? '0 solid black',\n borderBottom: borderSideToString(border?.borderBottom) ?? '0 solid black',\n borderLeft: borderSideToString(border?.borderLeft) ?? '0 solid black',\n }),\n ...(properties.includes(Style.BorderRadius) && {\n borderTopLeftRadius: borderRadiusToString(borderRadius?.borderTopLeftRadius) ?? 0,\n borderTopRightRadius: borderRadiusToString(borderRadius?.borderTopRightRadius) ?? 0,\n borderBottomRightRadius: borderRadiusToString(borderRadius?.borderBottomRightRadius) ?? 0,\n borderBottomLeftRadius: borderRadiusToString(borderRadius?.borderBottomLeftRadius) ?? 0,\n }),\n ...(properties.includes(Style.TextStyle) && {\n ...(textStyle?.fontFamily && { fontFamily: `\"${textStyle.fontFamily}\"` }),\n ...(textStyle?.letterSpacing && { letterSpacing: textStyle.letterSpacing }),\n ...(textStyle?.fontSize && { fontSize: fontSizeToString(textStyle.fontSize) }),\n ...(textStyle?.fontWeight && { fontWeight: textStyle.fontWeight }),\n textTransform: textStyle?.textTransform ?? [],\n fontStyle: textStyle?.fontStyle ?? [],\n }),\n }),\n ),\n }\n\n function widthToString(widthProperty: WidthPropertyData | undefined): string | null {\n if (widthProperty == null) return null\n\n return lengthPercentageDataToString(widthProperty)\n }\n\n function borderSideToString(\n borderSide: ResolvedBorderSideData | null | undefined,\n ): string | null {\n if (borderSide == null) return null\n\n const { width, color, style } = borderSide\n return `${width != null ? width : 0}px ${style} ${\n color != null ? colorToString(color) : 'black'\n }`\n }\n\n function borderRadiusToString(\n borderRadius: BorderRadiusLonghandPropertyData | null | undefined,\n ): string | null {\n if (borderRadius == null) return null\n\n return lengthPercentageDataToString(borderRadius)\n }\n\n function fontSizeToString(fontSize: NonNullable<FontSizePropertyData>) {\n return `${fontSize.value}${fontSize.unit}`\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAOO;AAEP,2BAA8B;AAC9B,8BAAgC;AAGhC,+BAA6C;AAC7C,oBAA0C;AAC1C,qBAA2C;AAG3C,MAAM,gBAAgB;AAAA,EACpB,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AACd;AAEA,MAAM,iBAAiB;AAAA,EACrB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AACf;AAEO,SAAS,WACd,aACA,OACA,YACW;AACX,SAAO;AAAA,IACL,GAAI,WAAW,SAAS,sBAAM,KAAK,KAAK;AAAA,MACtC,UAAU;AAAA,IACZ;AAAA,IACA,OAAG;AAAA,MACD;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,MACA,CAAC,CAAC,OAAO,QAAQ,SAAS,QAAQ,cAAc,SAAS,OAAO;AAAA,QAC9D,GAAI,WAAW,SAAS,sBAAM,KAAK,KAAK;AAAA,UACtC,OAAO,cAAc,KAAK,KAAK;AAAA,QACjC;AAAA,QACA,GAAI,WAAW,SAAS,sBAAM,MAAM,SAClC,yCAA0B,UAAU,eAAe,aAAa;AAAA,QAClE,GAAI,WAAW,SAAS,sBAAM,OAAO,SACnC,2CAA2B,WAAW,gBAAgB,cAAc;AAAA,QACtE,GAAI,WAAW,SAAS,sBAAM,MAAM,K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AM,aAAO;AAEjC,eAAO,uDAA6B,YAAY;AAAA,EAClD;AAEA,WAAS,iBAAiB,UAA6C;AACrE,WAAO,GAAG,SAAS,KAAK,GAAG,SAAS,IAAI;AAAA,EAC1C;AACF;","names":["style"]}
|
|
@@ -20,24 +20,24 @@ var typography_exports = {};
|
|
|
20
20
|
__export(typography_exports, {
|
|
21
21
|
default: () => useEnhancedTypography,
|
|
22
22
|
getTypographyStyleSwatchIds: () => getTypographyStyleSwatchIds,
|
|
23
|
+
typographyCss: () => typographyCss,
|
|
23
24
|
typographyFragementToTypographyControlData: () => typographyFragementToTypographyControlData,
|
|
24
|
-
useTypographyClassName: () => useTypographyClassName
|
|
25
|
-
useTypographyValue: () => useTypographyValue
|
|
25
|
+
useTypographyClassName: () => useTypographyClassName
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(typography_exports);
|
|
28
|
+
var import_controls = require("@makeswift/controls");
|
|
28
29
|
var import_makeswift_api = require("../hooks/makeswift-api");
|
|
29
30
|
var import_colorToString = require("../../../components/utils/colorToString");
|
|
30
31
|
var import_responsive_style = require("../../../components/utils/responsive-style");
|
|
31
|
-
var import_breakpoints = require("../../../state/modules/breakpoints");
|
|
32
32
|
var import_isNonNullable = require("../../../utils/isNonNullable");
|
|
33
33
|
var import_use_style = require("../use-style");
|
|
34
34
|
var import_use_breakpoints = require("../hooks/use-breakpoints");
|
|
35
|
-
function typographyFragementToTypographyControlData(
|
|
36
|
-
if (
|
|
35
|
+
function typographyFragementToTypographyControlData(fragment) {
|
|
36
|
+
if (fragment == null)
|
|
37
37
|
return void 0;
|
|
38
38
|
return {
|
|
39
|
-
id:
|
|
40
|
-
style:
|
|
39
|
+
id: fragment.id,
|
|
40
|
+
style: fragment.style.map(({ deviceId, value }) => ({
|
|
41
41
|
deviceId,
|
|
42
42
|
value: {
|
|
43
43
|
fontFamily: value.fontFamily ?? void 0,
|
|
@@ -79,13 +79,13 @@ const withColor = (swatches) => (deviceRawTypographyValue) => {
|
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
81
|
const getDeviceId = ({ deviceId }) => deviceId;
|
|
82
|
-
function useEnhancedTypography(
|
|
83
|
-
const typography = typographyFragementToTypographyControlData((0, import_makeswift_api.useTypography)(
|
|
82
|
+
function useEnhancedTypography(data) {
|
|
83
|
+
const typography = typographyFragementToTypographyControlData((0, import_makeswift_api.useTypography)(data?.id ?? null));
|
|
84
84
|
const source = typography?.style ?? [];
|
|
85
|
-
const override =
|
|
85
|
+
const override = data?.style ?? [];
|
|
86
86
|
const breakpoints = (0, import_use_breakpoints.useBreakpoints)();
|
|
87
87
|
const swatchIds = [
|
|
88
|
-
...getTypographyStyleSwatchIds(
|
|
88
|
+
...getTypographyStyleSwatchIds(data?.style),
|
|
89
89
|
...getTypographyStyleSwatchIds(typography?.style)
|
|
90
90
|
];
|
|
91
91
|
const swatches = (0, import_makeswift_api.useSwatches)(swatchIds).filter(import_isNonNullable.isNonNullable);
|
|
@@ -95,8 +95,8 @@ function useEnhancedTypography(value) {
|
|
|
95
95
|
...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId)))
|
|
96
96
|
];
|
|
97
97
|
return devices.map((deviceId) => {
|
|
98
|
-
const deviceSource = (0,
|
|
99
|
-
const deviceOverride = (0,
|
|
98
|
+
const deviceSource = (0, import_controls.findBreakpointOverride)(breakpoints, enhancedSource, deviceId)?.value;
|
|
99
|
+
const deviceOverride = (0, import_controls.findBreakpointOverride)(
|
|
100
100
|
breakpoints,
|
|
101
101
|
enhancedOverride,
|
|
102
102
|
deviceId,
|
|
@@ -121,50 +121,48 @@ function useEnhancedTypography(value) {
|
|
|
121
121
|
return null;
|
|
122
122
|
}).filter(import_isNonNullable.isNonNullable);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
import_breakpoints.shallowMergeFallbacks
|
|
156
|
-
)
|
|
124
|
+
function typographyToCssObject(value) {
|
|
125
|
+
let styles = {};
|
|
126
|
+
if (value.color != null)
|
|
127
|
+
styles.color = (0, import_colorToString.colorToString)(value.color);
|
|
128
|
+
if (value.fontFamily != null)
|
|
129
|
+
styles.fontFamily = value.fontFamily;
|
|
130
|
+
if (value.fontSize != null && value.fontSize.value != null && value.fontSize.unit != null)
|
|
131
|
+
styles.fontSize = `${value.fontSize.value}${value.fontSize.unit}`;
|
|
132
|
+
if (value.fontWeight != null)
|
|
133
|
+
styles.fontWeight = value.fontWeight;
|
|
134
|
+
if (value.lineHeight != null)
|
|
135
|
+
styles.lineHeight = value.lineHeight;
|
|
136
|
+
if (value.letterSpacing != null)
|
|
137
|
+
styles.letterSpacing = `${value.letterSpacing / 10}em`;
|
|
138
|
+
if (value.uppercase != null)
|
|
139
|
+
styles.textTransform = value.uppercase === true ? "uppercase" : "initial";
|
|
140
|
+
if (value.underline != null || value.strikethrough != null)
|
|
141
|
+
styles.textDecoration = [
|
|
142
|
+
Boolean(value.underline) && "underline",
|
|
143
|
+
Boolean(value.strikethrough) && "line-through"
|
|
144
|
+
].filter(Boolean).join(" ");
|
|
145
|
+
if (value.italic != null)
|
|
146
|
+
styles.fontStyle = value.italic === true ? "italic" : "initial";
|
|
147
|
+
return styles;
|
|
148
|
+
}
|
|
149
|
+
function typographyCss(breakpoints, style) {
|
|
150
|
+
return (0, import_responsive_style.responsiveStyle)(
|
|
151
|
+
breakpoints,
|
|
152
|
+
[style],
|
|
153
|
+
([value]) => value !== void 0 ? typographyToCssObject(value) : {},
|
|
154
|
+
import_controls.shallowMergeFallbacks
|
|
157
155
|
);
|
|
158
156
|
}
|
|
159
|
-
function
|
|
160
|
-
const
|
|
161
|
-
return
|
|
157
|
+
function useTypographyClassName(value) {
|
|
158
|
+
const breakpoints = (0, import_use_breakpoints.useBreakpoints)();
|
|
159
|
+
return (0, import_use_style.useStyle)(typographyCss(breakpoints, value));
|
|
162
160
|
}
|
|
163
161
|
// Annotate the CommonJS export names for ESM import in node:
|
|
164
162
|
0 && (module.exports = {
|
|
165
163
|
getTypographyStyleSwatchIds,
|
|
164
|
+
typographyCss,
|
|
166
165
|
typographyFragementToTypographyControlData,
|
|
167
|
-
useTypographyClassName
|
|
168
|
-
useTypographyValue
|
|
166
|
+
useTypographyClassName
|
|
169
167
|
});
|
|
170
168
|
//# sourceMappingURL=typography.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/controls/typography.ts"],"sourcesContent":["import { CSSObject } from '@emotion/serialize'\nimport { unstable_TypographyDefinition, type DataType } from '@makeswift/controls'\n\nimport { useSwatches, useTypography } from '../hooks/makeswift-api'\nimport { Typography, Swatch } from '../../../api'\nimport { colorToString } from '../../../components/utils/colorToString'\nimport { useResponsiveStyle } from '../../../components/utils/responsive-style'\nimport { ColorValue } from '../../../components/utils/types'\nimport { DeviceOverride, ResponsiveValue } from '../../../prop-controllers'\nimport { findBreakpointOverride, shallowMergeFallbacks } from '../../../state/modules/breakpoints'\nimport { isNonNullable } from '../../../utils/isNonNullable'\nimport { useStyle } from '../use-style'\nimport { useBreakpoints } from '../hooks/use-breakpoints'\n\nexport function typographyFragementToTypographyControlData(\n typography: Typography | null,\n): DataType<unstable_TypographyDefinition> | undefined {\n if (typography == null) return undefined\n return {\n id: typography.id,\n style: typography.style.map(({ deviceId, value }) => ({\n deviceId,\n value: {\n fontFamily: value.fontFamily ?? undefined,\n lineHeight: value.lineHeight ?? undefined,\n letterSpacing: value.letterSpacing ?? undefined,\n fontWeight: value.fontWeight ?? undefined,\n textAlign: value.textAlign ?? undefined,\n uppercase: value.uppercase ?? undefined,\n underline: value.underline ?? undefined,\n strikethrough: value.strikethrough ?? undefined,\n italic: value.italic ?? undefined,\n fontSize: value.fontSize ?? undefined,\n color: value.color ?? undefined,\n },\n })),\n }\n}\n\ntype EnhancedColor = {\n color?: ColorValue\n}\n\nexport type TypographyControlDataValue = Exclude<\n DataType<unstable_TypographyDefinition>,\n undefined\n>['style'][number]['value']\n\ntype EnhancedTypographyValue = Omit<TypographyControlDataValue, keyof EnhancedColor> & EnhancedColor\n\nexport type EnhancedTypography = Array<DeviceOverride<EnhancedTypographyValue>>\n\nexport function getTypographyStyleSwatchIds(\n style:\n | Exclude<DataType<unstable_TypographyDefinition>, undefined>['style']\n | Typography['style']\n | null\n | undefined,\n): string[] {\n return (\n style\n ?.map(override => override.value)\n .flatMap(typographyStyle => typographyStyle.color?.swatchId)\n .filter(isNonNullable) ?? []\n )\n}\n\nconst withColor =\n (swatches: Swatch[]) =>\n (\n deviceRawTypographyValue: DeviceOverride<TypographyControlDataValue>,\n ): DeviceOverride<EnhancedTypographyValue> => {\n const { value, deviceId } = deviceRawTypographyValue\n\n if (value.color == null) {\n const { color, ...nextValue } = value\n return {\n deviceId,\n value: nextValue,\n }\n }\n return {\n deviceId,\n value: {\n ...value,\n color: {\n swatch: swatches.find(s => s && s.id === value.color?.swatchId),\n alpha: value.color?.alpha ?? undefined,\n },\n },\n }\n }\n\nconst getDeviceId = ({ deviceId }: DeviceOverride<unknown>) => deviceId\n\n/**\n * `enhanced` here just means typography ids have been replaced with the related entity.\n */\nexport default function useEnhancedTypography(\n value?: DataType<unstable_TypographyDefinition> | null,\n): EnhancedTypography {\n const typography = typographyFragementToTypographyControlData(useTypography(value?.id ?? null))\n const source = typography?.style ?? []\n const override = value?.style ?? []\n const breakpoints = useBreakpoints()\n\n const swatchIds = [\n ...getTypographyStyleSwatchIds(value?.style),\n ...getTypographyStyleSwatchIds(typography?.style),\n ]\n const swatches = useSwatches(swatchIds).filter(isNonNullable)\n\n const enhancedSource = source.map(withColor(swatches))\n const enhancedOverride = override.map(withColor(swatches))\n\n const devices = [\n ...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId))),\n ]\n\n return devices\n .map(deviceId => {\n const deviceSource = findBreakpointOverride(breakpoints, enhancedSource, deviceId)?.value\n const deviceOverride = findBreakpointOverride(\n breakpoints,\n enhancedOverride,\n deviceId,\n v => v,\n )?.value\n\n if (deviceSource && deviceOverride) {\n return {\n deviceId,\n value: { ...deviceSource, ...deviceOverride },\n }\n } else if (deviceOverride) {\n return {\n deviceId,\n value: deviceOverride,\n }\n } else if (deviceSource) {\n return {\n deviceId,\n value: deviceSource,\n }\n }\n return null\n })\n .filter(isNonNullable)\n}\n\nexport function useTypographyClassName(value: EnhancedTypography): string {\n return useStyle(\n useResponsiveStyle<\n EnhancedTypographyValue,\n [ResponsiveValue<EnhancedTypographyValue> | null | undefined]\n >(\n [value],\n ([value]) => {\n if (value === undefined) return {}\n\n let styles: CSSObject = {}\n if (value.color != null) styles.color = colorToString(value.color)\n if (value.fontFamily != null) styles.fontFamily = value.fontFamily\n if (value.fontSize != null && value.fontSize.value != null && value.fontSize.unit != null)\n styles.fontSize = `${value.fontSize.value}${value.fontSize.unit}`\n if (value.fontWeight != null) styles.fontWeight = value.fontWeight\n if (value.lineHeight != null) styles.lineHeight = value.lineHeight\n if (value.letterSpacing != null) styles.letterSpacing = `${value.letterSpacing / 10}em`\n if (value.uppercase != null)\n styles.textTransform = value.uppercase === true ? 'uppercase' : 'initial'\n if (value.underline != null || value.strikethrough != null)\n styles.textDecoration = [\n Boolean(value.underline) && 'underline',\n Boolean(value.strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')\n if (value.italic != null) styles.fontStyle = value.italic === true ? 'italic' : 'initial'\n\n return styles\n },\n shallowMergeFallbacks,\n ),\n )\n}\n\nexport type TypographyControlValue = string\n\nexport function useTypographyValue(\n data: DataType<unstable_TypographyDefinition> | undefined,\n): TypographyControlValue {\n // for each breakpoint fetch related resources and merge its value with its override\n const enhancedTypography = useEnhancedTypography(data)\n\n // for each breakpoint shallow merge back up through the breakpoints and create a className\n return useTypographyClassName(enhancedTypography)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2BAA2C;AAE3C,2BAA8B;AAC9B,8BAAmC;AAGnC,yBAA8D;AAC9D,2BAA8B;AAC9B,uBAAyB;AACzB,6BAA+B;AAExB,SAAS,2CACd,YACqD;AACrD,MAAI,cAAc;AAAM,WAAO;AAC/B,SAAO;AAAA,IACL,IAAI,WAAW;AAAA,IACf,OAAO,WAAW,MAAM,IAAI,CAAC,EAAE,UAAU,MAAM,OAAO;AAAA,MACpD;AAAA,MACA,OAAO;AAAA,QACL,YAAY,MAAM,cAAc;AAAA,QAChC,YAAY,MAAM,cAAc;AAAA,QAChC,eAAe,MAAM,iBAAiB;AAAA,QACtC,YAAY,MAAM,cAAc;AAAA,QAChC,WAAW,MAAM,aAAa;AAAA,QAC9B,WAAW,MAAM,aAAa;AAAA,QAC9B,WAAW,MAAM,aAAa;AAAA,QAC9B,eAAe,MAAM,iBAAiB;AAAA,QACtC,QAAQ,MAAM,UAAU;AAAA,QACxB,UAAU,MAAM,YAAY;AAAA,QAC5B,OAAO,MAAM,SAAS;AAAA,MACxB;AAAA,IACF,EAAE;AAAA,EACJ;AACF;AAeO,SAAS,4BACd,OAKU;AACV,SACE,OACI,IAAI,cAAY,SAAS,KAAK,EAC/B,QAAQ,qBAAmB,gBAAgB,OAAO,QAAQ,EAC1D,OAAO,kCAAa,KAAK,CAAC;AAEjC;AAEA,MAAM,YACJ,CAAC,aACD,CACE,6BAC4C;AAC5C,QAAM,EAAE,OAAO,SAAS,IAAI;AAE5B,MAAI,MAAM,SAAS,MAAM;AACvB,UAAM,EAAE,OAAO,GAAG,UA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,IAAI;AAGrD,SAAO,uBAAuB,kBAAkB;AAClD;","names":["value"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/controls/typography.ts"],"sourcesContent":["import { CSSObject } from '@emotion/serialize'\nimport {\n unstable_TypographyDefinition,\n findBreakpointOverride,\n shallowMergeFallbacks,\n type DataType,\n type Breakpoints,\n type DeviceOverride,\n type ResponsiveValue,\n} from '@makeswift/controls'\n\nimport { useSwatches, useTypography } from '../hooks/makeswift-api'\nimport { Typography, Swatch } from '../../../api'\nimport { colorToString } from '../../../components/utils/colorToString'\nimport { responsiveStyle } from '../../../components/utils/responsive-style'\nimport { ColorValue } from '../../../components/utils/types'\nimport { isNonNullable } from '../../../utils/isNonNullable'\nimport { useStyle } from '../use-style'\nimport { useBreakpoints } from '../hooks/use-breakpoints'\n\nexport function typographyFragementToTypographyControlData(\n fragment: Typography | null,\n): DataType<unstable_TypographyDefinition> | undefined {\n if (fragment == null) return undefined\n return {\n id: fragment.id,\n style: fragment.style.map(({ deviceId, value }) => ({\n deviceId,\n value: {\n fontFamily: value.fontFamily ?? undefined,\n lineHeight: value.lineHeight ?? undefined,\n letterSpacing: value.letterSpacing ?? undefined,\n fontWeight: value.fontWeight ?? undefined,\n textAlign: value.textAlign ?? undefined,\n uppercase: value.uppercase ?? undefined,\n underline: value.underline ?? undefined,\n strikethrough: value.strikethrough ?? undefined,\n italic: value.italic ?? undefined,\n fontSize: value.fontSize ?? undefined,\n color: value.color ?? undefined,\n },\n })),\n }\n}\n\ntype EnhancedColor = {\n color?: ColorValue\n}\n\nexport type TypographyControlDataValue = Exclude<\n DataType<unstable_TypographyDefinition>,\n undefined\n>['style'][number]['value']\n\ntype EnhancedTypographyValue = Omit<TypographyControlDataValue, keyof EnhancedColor> & EnhancedColor\n\nexport type EnhancedTypography = Array<DeviceOverride<EnhancedTypographyValue>>\n\nexport function getTypographyStyleSwatchIds(\n style:\n | Exclude<DataType<unstable_TypographyDefinition>, undefined>['style']\n | Typography['style']\n | null\n | undefined,\n): string[] {\n return (\n style\n ?.map(override => override.value)\n .flatMap(typographyStyle => typographyStyle.color?.swatchId)\n .filter(isNonNullable) ?? []\n )\n}\n\nconst withColor =\n (swatches: Swatch[]) =>\n (\n deviceRawTypographyValue: DeviceOverride<TypographyControlDataValue>,\n ): DeviceOverride<EnhancedTypographyValue> => {\n const { value, deviceId } = deviceRawTypographyValue\n\n if (value.color == null) {\n const { color, ...nextValue } = value\n return {\n deviceId,\n value: nextValue,\n }\n }\n return {\n deviceId,\n value: {\n ...value,\n color: {\n swatch: swatches.find(s => s && s.id === value.color?.swatchId),\n alpha: value.color?.alpha ?? undefined,\n },\n },\n }\n }\n\nconst getDeviceId = ({ deviceId }: DeviceOverride<unknown>) => deviceId\n\n/**\n * `enhanced` here just means typography ids have been replaced with the related entity.\n */\nexport default function useEnhancedTypography(\n data?: DataType<unstable_TypographyDefinition> | null,\n): EnhancedTypography {\n const typography = typographyFragementToTypographyControlData(useTypography(data?.id ?? null))\n const source = typography?.style ?? []\n const override = data?.style ?? []\n const breakpoints = useBreakpoints()\n\n const swatchIds = [\n ...getTypographyStyleSwatchIds(data?.style),\n ...getTypographyStyleSwatchIds(typography?.style),\n ]\n const swatches = useSwatches(swatchIds).filter(isNonNullable)\n\n const enhancedSource = source.map(withColor(swatches))\n const enhancedOverride = override.map(withColor(swatches))\n\n const devices = [\n ...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId))),\n ]\n\n return devices\n .map(deviceId => {\n const deviceSource = findBreakpointOverride(breakpoints, enhancedSource, deviceId)?.value\n const deviceOverride = findBreakpointOverride(\n breakpoints,\n enhancedOverride,\n deviceId,\n v => v,\n )?.value\n\n if (deviceSource && deviceOverride) {\n return {\n deviceId,\n value: { ...deviceSource, ...deviceOverride },\n }\n } else if (deviceOverride) {\n return {\n deviceId,\n value: deviceOverride,\n }\n } else if (deviceSource) {\n return {\n deviceId,\n value: deviceSource,\n }\n }\n return null\n })\n .filter(isNonNullable)\n}\n\nfunction typographyToCssObject(value: EnhancedTypographyValue): CSSObject {\n let styles: CSSObject = {}\n if (value.color != null) styles.color = colorToString(value.color)\n if (value.fontFamily != null) styles.fontFamily = value.fontFamily\n if (value.fontSize != null && value.fontSize.value != null && value.fontSize.unit != null)\n styles.fontSize = `${value.fontSize.value}${value.fontSize.unit}`\n if (value.fontWeight != null) styles.fontWeight = value.fontWeight\n if (value.lineHeight != null) styles.lineHeight = value.lineHeight\n if (value.letterSpacing != null) styles.letterSpacing = `${value.letterSpacing / 10}em`\n if (value.uppercase != null)\n styles.textTransform = value.uppercase === true ? 'uppercase' : 'initial'\n if (value.underline != null || value.strikethrough != null)\n styles.textDecoration = [\n Boolean(value.underline) && 'underline',\n Boolean(value.strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')\n if (value.italic != null) styles.fontStyle = value.italic === true ? 'italic' : 'initial'\n\n return styles\n}\n\nexport function typographyCss(breakpoints: Breakpoints, style: EnhancedTypography): CSSObject {\n return responsiveStyle<\n EnhancedTypographyValue,\n [ResponsiveValue<EnhancedTypographyValue> | null | undefined]\n >(\n breakpoints,\n [style],\n ([value]) => (value !== undefined ? typographyToCssObject(value) : {}),\n shallowMergeFallbacks,\n )\n}\n\nexport function useTypographyClassName(value: EnhancedTypography): string {\n const breakpoints = useBreakpoints()\n return useStyle(typographyCss(breakpoints, value))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAQO;AAEP,2BAA2C;AAE3C,2BAA8B;AAC9B,8BAAgC;AAEhC,2BAA8B;AAC9B,uBAAyB;AACzB,6BAA+B;AAExB,SAAS,2CACd,UACqD;AACrD,MAAI,YAAY;AAAM,WAAO;AAC7B,SAAO;AAAA,IACL,IAAI,SAAS;AAAA,IACb,OAAO,SAAS,MAAM,IAAI,CAAC,EAAE,UAAU,MAAM,OAAO;AAAA,MAClD;AAAA,MACA,OAAO;AAAA,QAC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