@webstudio-is/react-sdk 0.9.0 → 0.10.1
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/lib/app/custom-components/image.js +37 -13
- package/lib/app/custom-components/index.js +18 -1
- package/lib/app/custom-components/link.js +6 -0
- package/lib/app/custom-components/rich-text-link.js +6 -0
- package/lib/app/custom-components/shared/remix-link.js +29 -0
- package/lib/app/handle-request.server.js +16 -8
- package/lib/app/params.js +7 -3
- package/lib/app/root.js +37 -6
- package/lib/cjs/app/custom-components/image.cjs +62 -24
- package/lib/cjs/app/custom-components/index.cjs +35 -24
- package/lib/cjs/app/custom-components/link.cjs +26 -0
- package/lib/cjs/app/custom-components/rich-text-link.cjs +26 -0
- package/lib/cjs/app/custom-components/shared/remix-link.cjs +49 -0
- package/lib/cjs/app/handle-request.server.cjs +36 -12
- package/lib/cjs/app/index.cjs +18 -17
- package/lib/cjs/app/params.cjs +24 -5
- package/lib/cjs/app/root.cjs +58 -11
- package/lib/cjs/components/__generated__/body.props.json +489 -489
- package/lib/cjs/components/__generated__/bold.props.json +489 -489
- package/lib/cjs/components/__generated__/box.props.json +506 -506
- package/lib/cjs/components/__generated__/button.props.json +545 -545
- package/lib/cjs/components/__generated__/form.props.json +529 -529
- package/lib/cjs/components/__generated__/heading.props.json +495 -495
- package/lib/cjs/components/__generated__/image.props.json +558 -558
- package/lib/cjs/components/__generated__/input.props.json +655 -655
- package/lib/cjs/components/__generated__/italic.props.json +489 -489
- package/lib/cjs/components/__generated__/link.props.json +545 -545
- package/lib/cjs/components/__generated__/paragraph.props.json +489 -489
- package/lib/cjs/components/__generated__/rich-text-link.props.json +547 -0
- package/lib/cjs/components/__generated__/span.props.json +489 -489
- package/lib/cjs/components/__generated__/subscript.props.json +489 -489
- package/lib/cjs/components/__generated__/superscript.props.json +489 -489
- package/lib/cjs/components/__generated__/text-block.props.json +489 -489
- package/lib/cjs/components/body.cjs +29 -6
- package/lib/cjs/components/body.ws.cjs +83 -59
- package/lib/cjs/components/bold.cjs +29 -6
- package/lib/cjs/components/bold.ws.cjs +35 -11
- package/lib/cjs/components/box.cjs +29 -7
- package/lib/cjs/components/box.ws.cjs +40 -16
- package/lib/cjs/components/button.cjs +33 -8
- package/lib/cjs/components/button.ws.cjs +36 -12
- package/lib/cjs/components/component-type.cjs +77 -27
- package/lib/cjs/components/form.cjs +29 -6
- package/lib/cjs/components/form.ws.cjs +45 -21
- package/lib/cjs/components/heading.cjs +29 -7
- package/lib/cjs/components/heading.ws.cjs +36 -12
- package/lib/cjs/components/image.cjs +39 -14
- package/lib/cjs/components/image.ws.cjs +45 -24
- package/lib/cjs/components/index.cjs +133 -67
- package/lib/cjs/components/input.cjs +29 -6
- package/lib/cjs/components/input.ws.cjs +35 -11
- package/lib/cjs/components/italic.cjs +29 -6
- package/lib/cjs/components/italic.ws.cjs +40 -16
- package/lib/cjs/components/link.cjs +32 -7
- package/lib/cjs/components/link.ws.cjs +46 -22
- package/lib/cjs/components/paragraph.cjs +29 -6
- package/lib/cjs/components/paragraph.ws.cjs +36 -12
- package/lib/cjs/components/rich-text-link.cjs +33 -0
- package/lib/cjs/components/rich-text-link.ws.cjs +38 -0
- package/lib/cjs/components/span.cjs +29 -6
- package/lib/cjs/components/span.ws.cjs +35 -11
- package/lib/cjs/components/subscript.cjs +29 -6
- package/lib/cjs/components/subscript.ws.cjs +35 -11
- package/lib/cjs/components/superscript.cjs +29 -6
- package/lib/cjs/components/superscript.ws.cjs +35 -11
- package/lib/cjs/components/text-block.cjs +29 -6
- package/lib/cjs/components/text-block.ws.cjs +42 -18
- package/lib/cjs/css/breakpoints.cjs +27 -7
- package/lib/cjs/css/categories.cjs +218 -203
- package/lib/cjs/css/get-browser-style.cjs +59 -41
- package/lib/cjs/css/index.cjs +18 -17
- package/lib/cjs/db/index.cjs +17 -16
- package/lib/cjs/db/instance.cjs +37 -17
- package/lib/cjs/db/types.cjs +15 -1
- package/lib/cjs/index.cjs +30 -35
- package/lib/cjs/pubsub/create.cjs +77 -61
- package/lib/cjs/pubsub/index.cjs +16 -15
- package/lib/cjs/tree/create-elements-tree.cjs +90 -48
- package/lib/cjs/tree/index.cjs +18 -17
- package/lib/cjs/tree/root.cjs +42 -42
- package/lib/cjs/tree/session-storage-polyfill.cjs +60 -37
- package/lib/cjs/tree/wrapper-component.cjs +55 -24
- package/lib/cjs/user-props/all-user-props.cjs +35 -17
- package/lib/cjs/user-props/index.cjs +19 -18
- package/lib/cjs/user-props/schema.cjs +52 -31
- package/lib/cjs/user-props/types.cjs +15 -1
- package/lib/cjs/user-props/use-user-props-asset.cjs +40 -19
- package/lib/cjs/user-props/use-user-props.cjs +39 -20
- package/lib/components/__generated__/body.props.json +489 -489
- package/lib/components/__generated__/bold.props.json +489 -489
- package/lib/components/__generated__/box.props.json +506 -506
- package/lib/components/__generated__/button.props.json +545 -545
- package/lib/components/__generated__/form.props.json +529 -529
- package/lib/components/__generated__/heading.props.json +495 -495
- package/lib/components/__generated__/image.props.json +558 -558
- package/lib/components/__generated__/input.props.json +655 -655
- package/lib/components/__generated__/italic.props.json +489 -489
- package/lib/components/__generated__/link.props.json +545 -545
- package/lib/components/__generated__/paragraph.props.json +489 -489
- package/lib/components/__generated__/rich-text-link.props.json +547 -0
- package/lib/components/__generated__/span.props.json +489 -489
- package/lib/components/__generated__/subscript.props.json +489 -489
- package/lib/components/__generated__/superscript.props.json +489 -489
- package/lib/components/__generated__/text-block.props.json +489 -489
- package/lib/components/body.js +8 -2
- package/lib/components/body.ws.js +57 -57
- package/lib/components/bold.js +8 -2
- package/lib/components/bold.ws.js +9 -9
- package/lib/components/box.js +11 -3
- package/lib/components/box.ws.js +14 -14
- package/lib/components/button.js +11 -3
- package/lib/components/button.ws.js +10 -10
- package/lib/components/component-type.js +54 -21
- package/lib/components/form.js +8 -2
- package/lib/components/form.ws.js +19 -19
- package/lib/components/heading.js +11 -3
- package/lib/components/heading.ws.js +10 -10
- package/lib/components/image.js +17 -9
- package/lib/components/image.ws.js +19 -22
- package/lib/components/index.js +111 -61
- package/lib/components/input.js +8 -2
- package/lib/components/input.ws.js +9 -9
- package/lib/components/italic.js +8 -2
- package/lib/components/italic.ws.js +14 -14
- package/lib/components/link.js +11 -3
- package/lib/components/link.ws.js +20 -20
- package/lib/components/paragraph.js +8 -2
- package/lib/components/paragraph.ws.js +10 -10
- package/lib/components/rich-text-link.js +13 -0
- package/lib/components/rich-text-link.ws.js +12 -0
- package/lib/components/span.js +8 -2
- package/lib/components/span.ws.js +9 -9
- package/lib/components/subscript.js +8 -2
- package/lib/components/subscript.ws.js +9 -9
- package/lib/components/superscript.js +8 -2
- package/lib/components/superscript.ws.js +9 -9
- package/lib/components/text-block.js +8 -2
- package/lib/components/text-block.ws.js +16 -16
- package/lib/css/breakpoints.js +8 -5
- package/lib/css/categories.js +198 -200
- package/lib/css/get-browser-style.js +38 -36
- package/lib/db/instance.js +14 -10
- package/lib/db/types.js +0 -1
- package/lib/index.js +8 -2
- package/lib/pubsub/create.js +52 -55
- package/lib/tree/create-elements-tree.js +68 -42
- package/lib/tree/root.js +19 -12
- package/lib/tree/session-storage-polyfill.js +41 -34
- package/lib/tree/wrapper-component.js +34 -18
- package/lib/user-props/all-user-props.js +15 -13
- package/lib/user-props/schema.js +33 -29
- package/lib/user-props/types.js +0 -1
- package/lib/user-props/use-user-props-asset.js +20 -15
- package/lib/user-props/use-user-props.js +19 -16
- package/package.json +11 -19
- package/src/app/custom-components/image.tsx +65 -0
- package/src/app/custom-components/index.ts +17 -0
- package/src/app/custom-components/link.tsx +4 -0
- package/src/app/custom-components/rich-text-link.tsx +4 -0
- package/src/app/custom-components/shared/remix-link.tsx +40 -0
- package/src/app/handle-request.server.tsx +21 -0
- package/{lib/app/index.d.ts → src/app/index.ts} +0 -1
- package/src/app/params.ts +13 -0
- package/src/app/root.tsx +27 -0
- package/src/components/__generated__/body.props.json +491 -0
- package/src/components/__generated__/bold.props.json +491 -0
- package/src/components/__generated__/box.props.json +508 -0
- package/src/components/__generated__/button.props.json +547 -0
- package/src/components/__generated__/form.props.json +531 -0
- package/src/components/__generated__/heading.props.json +497 -0
- package/src/components/__generated__/image.props.json +560 -0
- package/src/components/__generated__/input.props.json +657 -0
- package/src/components/__generated__/italic.props.json +491 -0
- package/src/components/__generated__/link.props.json +547 -0
- package/src/components/__generated__/paragraph.props.json +491 -0
- package/src/components/__generated__/rich-text-link.props.json +547 -0
- package/src/components/__generated__/span.props.json +491 -0
- package/src/components/__generated__/subscript.props.json +491 -0
- package/src/components/__generated__/superscript.props.json +491 -0
- package/src/components/__generated__/text-block.props.json +491 -0
- package/src/components/body.stories.tsx +11 -0
- package/src/components/body.tsx +10 -0
- package/src/components/body.ws.tsx +63 -0
- package/src/components/bold.stories.tsx +16 -0
- package/src/components/bold.tsx +10 -0
- package/src/components/bold.ws.tsx +12 -0
- package/src/components/box.stories.tsx +17 -0
- package/src/components/box.tsx +31 -0
- package/src/components/box.ws.ts +20 -0
- package/src/components/button.stories.tsx +17 -0
- package/src/components/button.tsx +14 -0
- package/src/components/button.ws.tsx +13 -0
- package/src/components/component-type.ts +89 -0
- package/src/components/form.stories.tsx +14 -0
- package/src/components/form.tsx +10 -0
- package/src/components/form.ws.tsx +25 -0
- package/src/components/heading.stories.tsx +16 -0
- package/src/components/heading.tsx +20 -0
- package/src/components/heading.ws.tsx +13 -0
- package/src/components/image.stories.tsx +15 -0
- package/src/components/image.tsx +52 -0
- package/src/components/image.ws.tsx +28 -0
- package/src/components/index.test.ts +28 -0
- package/src/components/index.ts +159 -0
- package/src/components/input.stories.tsx +14 -0
- package/src/components/input.tsx +11 -0
- package/src/components/input.ws.tsx +12 -0
- package/src/components/italic.stories.tsx +16 -0
- package/src/components/italic.tsx +10 -0
- package/src/components/italic.ws.tsx +20 -0
- package/src/components/link.stories.tsx +16 -0
- package/src/components/link.tsx +9 -0
- package/src/components/link.ws.tsx +26 -0
- package/src/components/paragraph.stories.tsx +16 -0
- package/src/components/paragraph.tsx +10 -0
- package/src/components/paragraph.ws.tsx +13 -0
- package/src/components/rich-text-link.stories.tsx +16 -0
- package/src/components/rich-text-link.tsx +9 -0
- package/src/components/rich-text-link.ws.tsx +12 -0
- package/src/components/span.stories.tsx +16 -0
- package/src/components/span.tsx +10 -0
- package/src/components/span.ws.tsx +12 -0
- package/src/components/subscript.stories.tsx +16 -0
- package/src/components/subscript.tsx +10 -0
- package/src/components/subscript.ws.tsx +12 -0
- package/src/components/superscript.stories.tsx +16 -0
- package/src/components/superscript.tsx +10 -0
- package/src/components/superscript.ws.tsx +12 -0
- package/src/components/text-block.stories.tsx +16 -0
- package/src/components/text-block.tsx +10 -0
- package/src/components/text-block.ws.tsx +22 -0
- package/src/css/breakpoints.ts +10 -0
- package/src/css/categories.ts +254 -0
- package/src/css/get-browser-style.ts +56 -0
- package/{lib/cjs/css/index.d.ts → src/css/index.ts} +0 -1
- package/{lib/cjs/db/index.d.ts → src/db/index.ts} +0 -1
- package/src/db/instance.ts +34 -0
- package/src/db/types.ts +18 -0
- package/{lib/cjs/index.d.ts → src/index.ts} +5 -3
- package/src/pubsub/create.ts +86 -0
- package/src/pubsub/index.ts +1 -0
- package/src/tree/create-elements-tree.tsx +102 -0
- package/{lib/cjs/tree/index.d.ts → src/tree/index.ts} +0 -1
- package/src/tree/root.ts +45 -0
- package/src/tree/session-storage-polyfill.tsx +50 -0
- package/src/tree/wrapper-component.tsx +50 -0
- package/src/user-props/all-user-props.ts +22 -0
- package/{lib/cjs/user-props/index.d.ts → src/user-props/index.ts} +0 -1
- package/src/user-props/schema.ts +35 -0
- package/src/user-props/types.ts +14 -0
- package/src/user-props/use-user-props-asset.ts +35 -0
- package/src/user-props/use-user-props.ts +32 -0
- package/lib/app/custom-components/image.d.ts +0 -9
- package/lib/app/custom-components/image.d.ts.map +0 -1
- package/lib/app/custom-components/index.d.ts +0 -2
- package/lib/app/custom-components/index.d.ts.map +0 -1
- package/lib/app/handle-request.server.d.ts +0 -3
- package/lib/app/handle-request.server.d.ts.map +0 -1
- package/lib/app/index.d.ts.map +0 -1
- package/lib/app/params.d.ts +0 -6
- package/lib/app/params.d.ts.map +0 -1
- package/lib/app/root.d.ts +0 -9
- package/lib/app/root.d.ts.map +0 -1
- package/lib/cjs/app/custom-components/image.d.ts +0 -9
- package/lib/cjs/app/custom-components/image.d.ts.map +0 -1
- package/lib/cjs/app/custom-components/index.d.ts +0 -2
- package/lib/cjs/app/custom-components/index.d.ts.map +0 -1
- package/lib/cjs/app/handle-request.server.d.ts +0 -3
- package/lib/cjs/app/handle-request.server.d.ts.map +0 -1
- package/lib/cjs/app/index.d.ts +0 -4
- package/lib/cjs/app/index.d.ts.map +0 -1
- package/lib/cjs/app/params.d.ts +0 -6
- package/lib/cjs/app/params.d.ts.map +0 -1
- package/lib/cjs/app/root.d.ts +0 -9
- package/lib/cjs/app/root.d.ts.map +0 -1
- package/lib/cjs/components/body.d.ts +0 -3
- package/lib/cjs/components/body.d.ts.map +0 -1
- package/lib/cjs/components/body.stories.cjs +0 -11
- package/lib/cjs/components/body.stories.d.ts +0 -7
- package/lib/cjs/components/body.stories.d.ts.map +0 -1
- package/lib/cjs/components/body.ws.d.ts +0 -5
- package/lib/cjs/components/body.ws.d.ts.map +0 -1
- package/lib/cjs/components/bold.d.ts +0 -3
- package/lib/cjs/components/bold.d.ts.map +0 -1
- package/lib/cjs/components/bold.stories.cjs +0 -14
- package/lib/cjs/components/bold.stories.d.ts +0 -6
- package/lib/cjs/components/bold.stories.d.ts.map +0 -1
- package/lib/cjs/components/bold.ws.d.ts +0 -5
- package/lib/cjs/components/bold.ws.d.ts.map +0 -1
- package/lib/cjs/components/box.d.ts +0 -8
- package/lib/cjs/components/box.d.ts.map +0 -1
- package/lib/cjs/components/box.stories.cjs +0 -12
- package/lib/cjs/components/box.stories.d.ts +0 -10
- package/lib/cjs/components/box.stories.d.ts.map +0 -1
- package/lib/cjs/components/box.ws.d.ts +0 -5
- package/lib/cjs/components/box.ws.d.ts.map +0 -1
- package/lib/cjs/components/button.d.ts +0 -3
- package/lib/cjs/components/button.d.ts.map +0 -1
- package/lib/cjs/components/button.stories.cjs +0 -14
- package/lib/cjs/components/button.stories.d.ts +0 -6
- package/lib/cjs/components/button.stories.d.ts.map +0 -1
- package/lib/cjs/components/button.ws.d.ts +0 -5
- package/lib/cjs/components/button.ws.d.ts.map +0 -1
- package/lib/cjs/components/component-type.d.ts +0 -17
- package/lib/cjs/components/component-type.d.ts.map +0 -1
- package/lib/cjs/components/form.d.ts +0 -3
- package/lib/cjs/components/form.d.ts.map +0 -1
- package/lib/cjs/components/form.stories.cjs +0 -12
- package/lib/cjs/components/form.stories.d.ts +0 -6
- package/lib/cjs/components/form.stories.d.ts.map +0 -1
- package/lib/cjs/components/form.ws.d.ts +0 -5
- package/lib/cjs/components/form.ws.d.ts.map +0 -1
- package/lib/cjs/components/heading.d.ts +0 -8
- package/lib/cjs/components/heading.d.ts.map +0 -1
- package/lib/cjs/components/heading.stories.cjs +0 -14
- package/lib/cjs/components/heading.stories.d.ts +0 -10
- package/lib/cjs/components/heading.stories.d.ts.map +0 -1
- package/lib/cjs/components/heading.ws.d.ts +0 -5
- package/lib/cjs/components/heading.ws.d.ts.map +0 -1
- package/lib/cjs/components/image.d.ts +0 -3
- package/lib/cjs/components/image.d.ts.map +0 -1
- package/lib/cjs/components/image.stories.cjs +0 -12
- package/lib/cjs/components/image.stories.d.ts +0 -6
- package/lib/cjs/components/image.stories.d.ts.map +0 -1
- package/lib/cjs/components/image.ws.d.ts +0 -5
- package/lib/cjs/components/image.ws.d.ts.map +0 -1
- package/lib/cjs/components/index.d.ts +0 -90
- package/lib/cjs/components/index.d.ts.map +0 -1
- package/lib/cjs/components/index.test.cjs +0 -7
- package/lib/cjs/components/index.test.d.ts +0 -2
- package/lib/cjs/components/index.test.d.ts.map +0 -1
- package/lib/cjs/components/input.d.ts +0 -3
- package/lib/cjs/components/input.d.ts.map +0 -1
- package/lib/cjs/components/input.stories.cjs +0 -12
- package/lib/cjs/components/input.stories.d.ts +0 -6
- package/lib/cjs/components/input.stories.d.ts.map +0 -1
- package/lib/cjs/components/input.ws.d.ts +0 -5
- package/lib/cjs/components/input.ws.d.ts.map +0 -1
- package/lib/cjs/components/italic.d.ts +0 -3
- package/lib/cjs/components/italic.d.ts.map +0 -1
- package/lib/cjs/components/italic.stories.cjs +0 -14
- package/lib/cjs/components/italic.stories.d.ts +0 -6
- package/lib/cjs/components/italic.stories.d.ts.map +0 -1
- package/lib/cjs/components/italic.ws.d.ts +0 -5
- package/lib/cjs/components/italic.ws.d.ts.map +0 -1
- package/lib/cjs/components/link.d.ts +0 -8
- package/lib/cjs/components/link.d.ts.map +0 -1
- package/lib/cjs/components/link.stories.cjs +0 -14
- package/lib/cjs/components/link.stories.d.ts +0 -10
- package/lib/cjs/components/link.stories.d.ts.map +0 -1
- package/lib/cjs/components/link.ws.d.ts +0 -5
- package/lib/cjs/components/link.ws.d.ts.map +0 -1
- package/lib/cjs/components/meta.cjs +0 -42
- package/lib/cjs/components/meta.d.ts +0 -7464
- package/lib/cjs/components/meta.d.ts.map +0 -1
- package/lib/cjs/components/paragraph.d.ts +0 -3
- package/lib/cjs/components/paragraph.d.ts.map +0 -1
- package/lib/cjs/components/paragraph.stories.cjs +0 -14
- package/lib/cjs/components/paragraph.stories.d.ts +0 -6
- package/lib/cjs/components/paragraph.stories.d.ts.map +0 -1
- package/lib/cjs/components/paragraph.ws.d.ts +0 -5
- package/lib/cjs/components/paragraph.ws.d.ts.map +0 -1
- package/lib/cjs/components/span.d.ts +0 -3
- package/lib/cjs/components/span.d.ts.map +0 -1
- package/lib/cjs/components/span.stories.cjs +0 -14
- package/lib/cjs/components/span.stories.d.ts +0 -6
- package/lib/cjs/components/span.stories.d.ts.map +0 -1
- package/lib/cjs/components/span.ws.d.ts +0 -5
- package/lib/cjs/components/span.ws.d.ts.map +0 -1
- package/lib/cjs/components/subscript.d.ts +0 -3
- package/lib/cjs/components/subscript.d.ts.map +0 -1
- package/lib/cjs/components/subscript.stories.cjs +0 -14
- package/lib/cjs/components/subscript.stories.d.ts +0 -6
- package/lib/cjs/components/subscript.stories.d.ts.map +0 -1
- package/lib/cjs/components/subscript.ws.d.ts +0 -5
- package/lib/cjs/components/subscript.ws.d.ts.map +0 -1
- package/lib/cjs/components/superscript.d.ts +0 -3
- package/lib/cjs/components/superscript.d.ts.map +0 -1
- package/lib/cjs/components/superscript.stories.cjs +0 -14
- package/lib/cjs/components/superscript.stories.d.ts +0 -6
- package/lib/cjs/components/superscript.stories.d.ts.map +0 -1
- package/lib/cjs/components/superscript.ws.d.ts +0 -5
- package/lib/cjs/components/superscript.ws.d.ts.map +0 -1
- package/lib/cjs/components/text-block.d.ts +0 -3
- package/lib/cjs/components/text-block.d.ts.map +0 -1
- package/lib/cjs/components/text-block.stories.cjs +0 -14
- package/lib/cjs/components/text-block.stories.d.ts +0 -6
- package/lib/cjs/components/text-block.stories.d.ts.map +0 -1
- package/lib/cjs/components/text-block.ws.d.ts +0 -5
- package/lib/cjs/components/text-block.ws.d.ts.map +0 -1
- package/lib/cjs/css/breakpoints.d.ts +0 -4
- package/lib/cjs/css/breakpoints.d.ts.map +0 -1
- package/lib/cjs/css/categories.d.ts +0 -409
- package/lib/cjs/css/categories.d.ts.map +0 -1
- package/lib/cjs/css/get-browser-style.d.ts +0 -3
- package/lib/cjs/css/get-browser-style.d.ts.map +0 -1
- package/lib/cjs/css/index.d.ts.map +0 -1
- package/lib/cjs/db/index.d.ts.map +0 -1
- package/lib/cjs/db/instance.d.ts +0 -14
- package/lib/cjs/db/instance.d.ts.map +0 -1
- package/lib/cjs/db/types.d.ts +0 -17
- package/lib/cjs/db/types.d.ts.map +0 -1
- package/lib/cjs/index.d.ts.map +0 -1
- package/lib/cjs/pubsub/create.d.ts +0 -29
- package/lib/cjs/pubsub/create.d.ts.map +0 -1
- package/lib/cjs/pubsub/index.d.ts +0 -2
- package/lib/cjs/pubsub/index.d.ts.map +0 -1
- package/lib/cjs/tree/create-elements-tree.d.ts +0 -19
- package/lib/cjs/tree/create-elements-tree.d.ts.map +0 -1
- package/lib/cjs/tree/index.d.ts.map +0 -1
- package/lib/cjs/tree/root.d.ts +0 -20
- package/lib/cjs/tree/root.d.ts.map +0 -1
- package/lib/cjs/tree/session-storage-polyfill.d.ts +0 -3
- package/lib/cjs/tree/session-storage-polyfill.d.ts.map +0 -1
- package/lib/cjs/tree/wrapper-component.d.ts +0 -13
- package/lib/cjs/tree/wrapper-component.d.ts.map +0 -1
- package/lib/cjs/user-props/all-user-props.d.ts +0 -8
- package/lib/cjs/user-props/all-user-props.d.ts.map +0 -1
- package/lib/cjs/user-props/index.d.ts.map +0 -1
- package/lib/cjs/user-props/schema.d.ts +0 -72
- package/lib/cjs/user-props/schema.d.ts.map +0 -1
- package/lib/cjs/user-props/types.d.ts +0 -13
- package/lib/cjs/user-props/types.d.ts.map +0 -1
- package/lib/cjs/user-props/use-user-props-asset.d.ts +0 -8
- package/lib/cjs/user-props/use-user-props-asset.d.ts.map +0 -1
- package/lib/cjs/user-props/use-user-props.d.ts +0 -12
- package/lib/cjs/user-props/use-user-props.d.ts.map +0 -1
- package/lib/components/body.d.ts +0 -3
- package/lib/components/body.d.ts.map +0 -1
- package/lib/components/body.stories.d.ts +0 -7
- package/lib/components/body.stories.d.ts.map +0 -1
- package/lib/components/body.stories.js +0 -7
- package/lib/components/body.ws.d.ts +0 -5
- package/lib/components/body.ws.d.ts.map +0 -1
- package/lib/components/bold.d.ts +0 -3
- package/lib/components/bold.d.ts.map +0 -1
- package/lib/components/bold.stories.d.ts +0 -6
- package/lib/components/bold.stories.d.ts.map +0 -1
- package/lib/components/bold.stories.js +0 -11
- package/lib/components/bold.ws.d.ts +0 -5
- package/lib/components/bold.ws.d.ts.map +0 -1
- package/lib/components/box.d.ts +0 -8
- package/lib/components/box.d.ts.map +0 -1
- package/lib/components/box.stories.d.ts +0 -10
- package/lib/components/box.stories.d.ts.map +0 -1
- package/lib/components/box.stories.js +0 -9
- package/lib/components/box.ws.d.ts +0 -5
- package/lib/components/box.ws.d.ts.map +0 -1
- package/lib/components/button.d.ts +0 -3
- package/lib/components/button.d.ts.map +0 -1
- package/lib/components/button.stories.d.ts +0 -6
- package/lib/components/button.stories.d.ts.map +0 -1
- package/lib/components/button.stories.js +0 -11
- package/lib/components/button.ws.d.ts +0 -5
- package/lib/components/button.ws.d.ts.map +0 -1
- package/lib/components/component-type.d.ts +0 -17
- package/lib/components/component-type.d.ts.map +0 -1
- package/lib/components/form.d.ts +0 -3
- package/lib/components/form.d.ts.map +0 -1
- package/lib/components/form.stories.d.ts +0 -6
- package/lib/components/form.stories.d.ts.map +0 -1
- package/lib/components/form.stories.js +0 -9
- package/lib/components/form.ws.d.ts +0 -5
- package/lib/components/form.ws.d.ts.map +0 -1
- package/lib/components/heading.d.ts +0 -8
- package/lib/components/heading.d.ts.map +0 -1
- package/lib/components/heading.stories.d.ts +0 -10
- package/lib/components/heading.stories.d.ts.map +0 -1
- package/lib/components/heading.stories.js +0 -11
- package/lib/components/heading.ws.d.ts +0 -5
- package/lib/components/heading.ws.d.ts.map +0 -1
- package/lib/components/image.d.ts +0 -3
- package/lib/components/image.d.ts.map +0 -1
- package/lib/components/image.stories.d.ts +0 -6
- package/lib/components/image.stories.d.ts.map +0 -1
- package/lib/components/image.stories.js +0 -9
- package/lib/components/image.ws.d.ts +0 -5
- package/lib/components/image.ws.d.ts.map +0 -1
- package/lib/components/index.d.ts +0 -90
- package/lib/components/index.d.ts.map +0 -1
- package/lib/components/index.test.d.ts +0 -2
- package/lib/components/index.test.d.ts.map +0 -1
- package/lib/components/index.test.js +0 -5
- package/lib/components/input.d.ts +0 -3
- package/lib/components/input.d.ts.map +0 -1
- package/lib/components/input.stories.d.ts +0 -6
- package/lib/components/input.stories.d.ts.map +0 -1
- package/lib/components/input.stories.js +0 -9
- package/lib/components/input.ws.d.ts +0 -5
- package/lib/components/input.ws.d.ts.map +0 -1
- package/lib/components/italic.d.ts +0 -3
- package/lib/components/italic.d.ts.map +0 -1
- package/lib/components/italic.stories.d.ts +0 -6
- package/lib/components/italic.stories.d.ts.map +0 -1
- package/lib/components/italic.stories.js +0 -11
- package/lib/components/italic.ws.d.ts +0 -5
- package/lib/components/italic.ws.d.ts.map +0 -1
- package/lib/components/link.d.ts +0 -8
- package/lib/components/link.d.ts.map +0 -1
- package/lib/components/link.stories.d.ts +0 -10
- package/lib/components/link.stories.d.ts.map +0 -1
- package/lib/components/link.stories.js +0 -11
- package/lib/components/link.ws.d.ts +0 -5
- package/lib/components/link.ws.d.ts.map +0 -1
- package/lib/components/meta.d.ts +0 -7464
- package/lib/components/meta.d.ts.map +0 -1
- package/lib/components/meta.js +0 -35
- package/lib/components/paragraph.d.ts +0 -3
- package/lib/components/paragraph.d.ts.map +0 -1
- package/lib/components/paragraph.stories.d.ts +0 -6
- package/lib/components/paragraph.stories.d.ts.map +0 -1
- package/lib/components/paragraph.stories.js +0 -11
- package/lib/components/paragraph.ws.d.ts +0 -5
- package/lib/components/paragraph.ws.d.ts.map +0 -1
- package/lib/components/span.d.ts +0 -3
- package/lib/components/span.d.ts.map +0 -1
- package/lib/components/span.stories.d.ts +0 -6
- package/lib/components/span.stories.d.ts.map +0 -1
- package/lib/components/span.stories.js +0 -11
- package/lib/components/span.ws.d.ts +0 -5
- package/lib/components/span.ws.d.ts.map +0 -1
- package/lib/components/subscript.d.ts +0 -3
- package/lib/components/subscript.d.ts.map +0 -1
- package/lib/components/subscript.stories.d.ts +0 -6
- package/lib/components/subscript.stories.d.ts.map +0 -1
- package/lib/components/subscript.stories.js +0 -11
- package/lib/components/subscript.ws.d.ts +0 -5
- package/lib/components/subscript.ws.d.ts.map +0 -1
- package/lib/components/superscript.d.ts +0 -3
- package/lib/components/superscript.d.ts.map +0 -1
- package/lib/components/superscript.stories.d.ts +0 -6
- package/lib/components/superscript.stories.d.ts.map +0 -1
- package/lib/components/superscript.stories.js +0 -11
- package/lib/components/superscript.ws.d.ts +0 -5
- package/lib/components/superscript.ws.d.ts.map +0 -1
- package/lib/components/text-block.d.ts +0 -3
- package/lib/components/text-block.d.ts.map +0 -1
- package/lib/components/text-block.stories.d.ts +0 -6
- package/lib/components/text-block.stories.d.ts.map +0 -1
- package/lib/components/text-block.stories.js +0 -11
- package/lib/components/text-block.ws.d.ts +0 -5
- package/lib/components/text-block.ws.d.ts.map +0 -1
- package/lib/css/breakpoints.d.ts +0 -4
- package/lib/css/breakpoints.d.ts.map +0 -1
- package/lib/css/categories.d.ts +0 -409
- package/lib/css/categories.d.ts.map +0 -1
- package/lib/css/get-browser-style.d.ts +0 -3
- package/lib/css/get-browser-style.d.ts.map +0 -1
- package/lib/css/index.d.ts +0 -4
- package/lib/css/index.d.ts.map +0 -1
- package/lib/db/index.d.ts +0 -3
- package/lib/db/index.d.ts.map +0 -1
- package/lib/db/instance.d.ts +0 -14
- package/lib/db/instance.d.ts.map +0 -1
- package/lib/db/types.d.ts +0 -17
- package/lib/db/types.d.ts.map +0 -1
- package/lib/index.d.ts +0 -10
- package/lib/index.d.ts.map +0 -1
- package/lib/pubsub/create.d.ts +0 -29
- package/lib/pubsub/create.d.ts.map +0 -1
- package/lib/pubsub/index.d.ts +0 -2
- package/lib/pubsub/index.d.ts.map +0 -1
- package/lib/tree/create-elements-tree.d.ts +0 -19
- package/lib/tree/create-elements-tree.d.ts.map +0 -1
- package/lib/tree/index.d.ts +0 -4
- package/lib/tree/index.d.ts.map +0 -1
- package/lib/tree/root.d.ts +0 -20
- package/lib/tree/root.d.ts.map +0 -1
- package/lib/tree/session-storage-polyfill.d.ts +0 -3
- package/lib/tree/session-storage-polyfill.d.ts.map +0 -1
- package/lib/tree/wrapper-component.d.ts +0 -13
- package/lib/tree/wrapper-component.d.ts.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/user-props/all-user-props.d.ts +0 -8
- package/lib/user-props/all-user-props.d.ts.map +0 -1
- package/lib/user-props/index.d.ts +0 -5
- package/lib/user-props/index.d.ts.map +0 -1
- package/lib/user-props/schema.d.ts +0 -72
- package/lib/user-props/schema.d.ts.map +0 -1
- package/lib/user-props/types.d.ts +0 -13
- package/lib/user-props/types.d.ts.map +0 -1
- package/lib/user-props/use-user-props-asset.d.ts +0 -8
- package/lib/user-props/use-user-props-asset.d.ts.map +0 -1
- package/lib/user-props/use-user-props.d.ts +0 -12
- package/lib/user-props/use-user-props.d.ts.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
const defaultTag = "p";
|
|
4
|
+
|
|
5
|
+
export const Paragraph = forwardRef<
|
|
6
|
+
ElementRef<typeof defaultTag>,
|
|
7
|
+
ComponentProps<typeof defaultTag>
|
|
8
|
+
>((props, ref) => <p {...props} ref={ref} />);
|
|
9
|
+
|
|
10
|
+
Paragraph.displayName = "Paragraph";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TextAlignLeftIcon } from "@webstudio-is/icons";
|
|
2
|
+
import type { WsComponentMeta, MetaProps } from "./component-type";
|
|
3
|
+
import props from "./__generated__/paragraph.props.json";
|
|
4
|
+
|
|
5
|
+
const meta: WsComponentMeta = {
|
|
6
|
+
type: "rich-text",
|
|
7
|
+
label: "Paragraph",
|
|
8
|
+
Icon: TextAlignLeftIcon,
|
|
9
|
+
children: ["Pragraph you can edit"],
|
|
10
|
+
props: props as MetaProps,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { RichTextLink as LinkPrimitive } from "./rich-text-link";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/RichTextLink",
|
|
6
|
+
component: LinkPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof LinkPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof LinkPrimitive> = (args) => (
|
|
10
|
+
<LinkPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const RichTextLink = Template.bind({});
|
|
14
|
+
RichTextLink.args = {
|
|
15
|
+
children: "RichTextLink",
|
|
16
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
type Props = Omit<ComponentProps<"a">, "href"> & { href?: string };
|
|
4
|
+
|
|
5
|
+
export const RichTextLink = forwardRef<ElementRef<"a">, Props>(
|
|
6
|
+
({ href = "", ...props }, ref) => <a {...props} href={href} ref={ref} />
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
RichTextLink.displayName = "RichTextLink";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Link2Icon } from "@webstudio-is/icons";
|
|
2
|
+
import type { WsComponentMeta, MetaProps } from "./component-type";
|
|
3
|
+
import props from "./__generated__/rich-text-link.props.json";
|
|
4
|
+
|
|
5
|
+
const meta: WsComponentMeta = {
|
|
6
|
+
type: "rich-text-child",
|
|
7
|
+
label: "Link",
|
|
8
|
+
Icon: Link2Icon,
|
|
9
|
+
props: props as MetaProps,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { Span as SpanPrimitive } from "./span";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Span",
|
|
6
|
+
component: SpanPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof SpanPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof SpanPrimitive> = (args) => (
|
|
10
|
+
<SpanPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const Span = Template.bind({});
|
|
14
|
+
Span.args = {
|
|
15
|
+
children: "some span text",
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
const defaultTag = "span";
|
|
4
|
+
|
|
5
|
+
export const Span = forwardRef<
|
|
6
|
+
ElementRef<typeof defaultTag>,
|
|
7
|
+
ComponentProps<typeof defaultTag>
|
|
8
|
+
>((props, ref) => <span {...props} ref={ref} />);
|
|
9
|
+
|
|
10
|
+
Span.displayName = "Span";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BrushIcon } from "@webstudio-is/icons";
|
|
2
|
+
import type { WsComponentMeta, MetaProps } from "./component-type";
|
|
3
|
+
import props from "./__generated__/span.props.json";
|
|
4
|
+
|
|
5
|
+
const meta: WsComponentMeta = {
|
|
6
|
+
type: "rich-text-child",
|
|
7
|
+
label: "Styled Text",
|
|
8
|
+
Icon: BrushIcon,
|
|
9
|
+
props: props as MetaProps,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { Bold as BoldPrimitive } from "./bold";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Bold",
|
|
6
|
+
component: BoldPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof BoldPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof BoldPrimitive> = (args) => (
|
|
10
|
+
<BoldPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const Bold = Template.bind({});
|
|
14
|
+
Bold.args = {
|
|
15
|
+
children: "some bold text",
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
const defaultTag = "sub";
|
|
4
|
+
|
|
5
|
+
export const Subscript = forwardRef<
|
|
6
|
+
ElementRef<typeof defaultTag>,
|
|
7
|
+
ComponentProps<typeof defaultTag>
|
|
8
|
+
>((props, ref) => <sub {...props} ref={ref} />);
|
|
9
|
+
|
|
10
|
+
Subscript.displayName = "Subscript";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SubscriptIcon } from "@webstudio-is/icons";
|
|
2
|
+
import type { WsComponentMeta, MetaProps } from "./component-type";
|
|
3
|
+
import props from "./__generated__/subscript.props.json";
|
|
4
|
+
|
|
5
|
+
const meta: WsComponentMeta = {
|
|
6
|
+
type: "rich-text-child",
|
|
7
|
+
label: "Subscript Text",
|
|
8
|
+
Icon: SubscriptIcon,
|
|
9
|
+
props: props as MetaProps,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { Superscript as SuperscriptPrimitive } from "./superscript";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Superscript",
|
|
6
|
+
component: SuperscriptPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof SuperscriptPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof SuperscriptPrimitive> = (args) => (
|
|
10
|
+
<SuperscriptPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const Superscript = Template.bind({});
|
|
14
|
+
Superscript.args = {
|
|
15
|
+
children: "some superscript text",
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
const defaultTag = "sup";
|
|
4
|
+
|
|
5
|
+
export const Superscript = forwardRef<
|
|
6
|
+
ElementRef<typeof defaultTag>,
|
|
7
|
+
ComponentProps<typeof defaultTag>
|
|
8
|
+
>((props, ref) => <sup {...props} ref={ref} />);
|
|
9
|
+
|
|
10
|
+
Superscript.displayName = "Bold";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SuperscriptIcon } from "@webstudio-is/icons";
|
|
2
|
+
import type { WsComponentMeta, MetaProps } from "./component-type";
|
|
3
|
+
import props from "./__generated__/superscript.props.json";
|
|
4
|
+
|
|
5
|
+
const meta: WsComponentMeta = {
|
|
6
|
+
type: "rich-text-child",
|
|
7
|
+
label: "Superscript Text",
|
|
8
|
+
Icon: SuperscriptIcon,
|
|
9
|
+
props: props as MetaProps,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
2
|
+
import { TextBlock as TextBlockPrimitive } from "./text-block";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/TextBlock",
|
|
6
|
+
component: TextBlockPrimitive,
|
|
7
|
+
} as ComponentMeta<typeof TextBlockPrimitive>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof TextBlockPrimitive> = (args) => (
|
|
10
|
+
<TextBlockPrimitive {...args} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const TextBlock = Template.bind({});
|
|
14
|
+
TextBlock.args = {
|
|
15
|
+
children: "text",
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { forwardRef, type ElementRef, type ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
const defaultTag = "div";
|
|
4
|
+
|
|
5
|
+
export const TextBlock = forwardRef<
|
|
6
|
+
ElementRef<typeof defaultTag>,
|
|
7
|
+
ComponentProps<typeof defaultTag>
|
|
8
|
+
>((props, ref) => <div {...props} ref={ref} />);
|
|
9
|
+
|
|
10
|
+
TextBlock.displayName = "TextBlock";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TextIcon } from "@webstudio-is/icons";
|
|
2
|
+
import type { WsComponentMeta, MetaProps } from "./component-type";
|
|
3
|
+
import props from "./__generated__/text-block.props.json";
|
|
4
|
+
|
|
5
|
+
const defaultStyle = {
|
|
6
|
+
minHeight: {
|
|
7
|
+
type: "unit",
|
|
8
|
+
unit: "em",
|
|
9
|
+
value: 1,
|
|
10
|
+
},
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
const meta: WsComponentMeta = {
|
|
14
|
+
type: "rich-text",
|
|
15
|
+
label: "Text Block",
|
|
16
|
+
Icon: TextIcon,
|
|
17
|
+
defaultStyle,
|
|
18
|
+
children: ["Block of text you can edit"],
|
|
19
|
+
props: props as MetaProps,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Breakpoint } from "@webstudio-is/css-data";
|
|
2
|
+
|
|
3
|
+
export type BaseBreakpoint = Pick<Breakpoint, "label" | "minWidth">;
|
|
4
|
+
|
|
5
|
+
export const initialBreakpoints: Array<BaseBreakpoint> = [
|
|
6
|
+
{ label: "Mobile", minWidth: 360 },
|
|
7
|
+
{ label: "Tablet", minWidth: 768 },
|
|
8
|
+
{ label: "Laptop", minWidth: 1024 },
|
|
9
|
+
{ label: "Desktop", minWidth: 1280 },
|
|
10
|
+
];
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import type { StyleProperty } from "@webstudio-is/css-data";
|
|
2
|
+
|
|
3
|
+
const layout = [
|
|
4
|
+
"display",
|
|
5
|
+
// Flex
|
|
6
|
+
"flexDirection",
|
|
7
|
+
"flexWrap",
|
|
8
|
+
// Flex or grid
|
|
9
|
+
"alignItems",
|
|
10
|
+
"justifyContent",
|
|
11
|
+
"alignContent",
|
|
12
|
+
// Grid
|
|
13
|
+
"placeContent",
|
|
14
|
+
"justifyItems",
|
|
15
|
+
"rowGap",
|
|
16
|
+
"columnGap",
|
|
17
|
+
"gridAutoFlow",
|
|
18
|
+
"gridAutoRows",
|
|
19
|
+
"gridAutoColumns",
|
|
20
|
+
"gridTemplateColumns",
|
|
21
|
+
"gridTemplateRows",
|
|
22
|
+
"gridTemplateAreas",
|
|
23
|
+
] as const;
|
|
24
|
+
|
|
25
|
+
const flexChild = [
|
|
26
|
+
"flexShrink",
|
|
27
|
+
"flexGrow",
|
|
28
|
+
"flexBasis",
|
|
29
|
+
"alignSelf",
|
|
30
|
+
"order",
|
|
31
|
+
] as const;
|
|
32
|
+
|
|
33
|
+
const gridChild = [
|
|
34
|
+
"gridRowEnd",
|
|
35
|
+
"gridRowStart",
|
|
36
|
+
"gridColumnStart",
|
|
37
|
+
"gridColumnEnd",
|
|
38
|
+
"alignSelf",
|
|
39
|
+
"justifySelf",
|
|
40
|
+
"order",
|
|
41
|
+
] as const;
|
|
42
|
+
|
|
43
|
+
const spacing = [
|
|
44
|
+
"marginTop",
|
|
45
|
+
"marginRight",
|
|
46
|
+
"marginBottom",
|
|
47
|
+
"marginLeft",
|
|
48
|
+
"paddingTop",
|
|
49
|
+
"paddingRight",
|
|
50
|
+
"paddingBottom",
|
|
51
|
+
"paddingLeft",
|
|
52
|
+
] as const;
|
|
53
|
+
|
|
54
|
+
const size = [
|
|
55
|
+
"width",
|
|
56
|
+
"height",
|
|
57
|
+
"minWidth",
|
|
58
|
+
"minHeight",
|
|
59
|
+
"maxWidth",
|
|
60
|
+
"maxHeight",
|
|
61
|
+
"overflow",
|
|
62
|
+
"objectFit",
|
|
63
|
+
"aspectRatio",
|
|
64
|
+
] as const;
|
|
65
|
+
|
|
66
|
+
const position = [
|
|
67
|
+
"position",
|
|
68
|
+
"top",
|
|
69
|
+
"right",
|
|
70
|
+
"bottom",
|
|
71
|
+
"left",
|
|
72
|
+
"zIndex",
|
|
73
|
+
"float",
|
|
74
|
+
"clear",
|
|
75
|
+
] as const;
|
|
76
|
+
|
|
77
|
+
const typography = [
|
|
78
|
+
"fontFamily",
|
|
79
|
+
"fontWeight",
|
|
80
|
+
"fontSize",
|
|
81
|
+
"lineHeight",
|
|
82
|
+
"color",
|
|
83
|
+
"textAlign",
|
|
84
|
+
"fontStyle",
|
|
85
|
+
"textDecorationColor",
|
|
86
|
+
"textDecorationLine",
|
|
87
|
+
"textDecorationStyle",
|
|
88
|
+
|
|
89
|
+
"letterSpacing",
|
|
90
|
+
"textIndent",
|
|
91
|
+
|
|
92
|
+
"columnCount",
|
|
93
|
+
"columnGap",
|
|
94
|
+
"columnRuleStyle",
|
|
95
|
+
"columnRuleWidth",
|
|
96
|
+
"columnRuleColor",
|
|
97
|
+
|
|
98
|
+
"textTransform",
|
|
99
|
+
"direction",
|
|
100
|
+
"whiteSpace",
|
|
101
|
+
"textShadow",
|
|
102
|
+
|
|
103
|
+
// More
|
|
104
|
+
"fontSizeAdjust",
|
|
105
|
+
"fontStretch",
|
|
106
|
+
"fontVariant",
|
|
107
|
+
"textAlignLast",
|
|
108
|
+
"textJustify",
|
|
109
|
+
"textOverflow",
|
|
110
|
+
"textSizeAdjust",
|
|
111
|
+
"verticalAlign",
|
|
112
|
+
"wordSpacing",
|
|
113
|
+
"wordBreak",
|
|
114
|
+
"wordWrap",
|
|
115
|
+
] as const;
|
|
116
|
+
|
|
117
|
+
const backgrounds = [
|
|
118
|
+
"backgroundAttachment",
|
|
119
|
+
"backgroundClip",
|
|
120
|
+
"backgroundColor",
|
|
121
|
+
"backgroundImage",
|
|
122
|
+
"backgroundOrigin",
|
|
123
|
+
"backgroundPositionX",
|
|
124
|
+
"backgroundPositionY",
|
|
125
|
+
"backgroundRepeat",
|
|
126
|
+
"backgroundSize",
|
|
127
|
+
] as const;
|
|
128
|
+
|
|
129
|
+
const borders = [
|
|
130
|
+
"borderTopLeftRadius",
|
|
131
|
+
"borderTopRightRadius",
|
|
132
|
+
"borderBottomLeftRadius",
|
|
133
|
+
"borderBottomRightRadius",
|
|
134
|
+
|
|
135
|
+
"borderTopStyle",
|
|
136
|
+
"borderRightStyle",
|
|
137
|
+
"borderBottomStyle",
|
|
138
|
+
"borderLeftStyle",
|
|
139
|
+
|
|
140
|
+
"borderTopColor",
|
|
141
|
+
"borderRightColor",
|
|
142
|
+
"borderBottomColor",
|
|
143
|
+
"borderLeftColor",
|
|
144
|
+
|
|
145
|
+
"borderTopWidth",
|
|
146
|
+
"borderRightWidth",
|
|
147
|
+
"borderBottomWidth",
|
|
148
|
+
"borderLeftWidth",
|
|
149
|
+
|
|
150
|
+
// More
|
|
151
|
+
"borderImageSlice",
|
|
152
|
+
"borderImageWidth",
|
|
153
|
+
"borderImageOutset",
|
|
154
|
+
"borderImageRepeat",
|
|
155
|
+
"borderImageSource",
|
|
156
|
+
] as const;
|
|
157
|
+
|
|
158
|
+
const effects = [
|
|
159
|
+
"mixBlendMode",
|
|
160
|
+
"opacity",
|
|
161
|
+
"outlineColor",
|
|
162
|
+
"outlineOffset",
|
|
163
|
+
"outlineStyle",
|
|
164
|
+
"outlineWidth",
|
|
165
|
+
"boxShadow",
|
|
166
|
+
"transform",
|
|
167
|
+
"filter",
|
|
168
|
+
"backdropFilter",
|
|
169
|
+
"cursor",
|
|
170
|
+
// More
|
|
171
|
+
"animationDelay",
|
|
172
|
+
"animationDirection",
|
|
173
|
+
"animationDuration",
|
|
174
|
+
"animationFillMode",
|
|
175
|
+
"animationIterationCount",
|
|
176
|
+
"animationName",
|
|
177
|
+
"animationPlayState",
|
|
178
|
+
"animationTimingFunction",
|
|
179
|
+
"transitionDelay",
|
|
180
|
+
"transitionDuration",
|
|
181
|
+
"transitionProperty",
|
|
182
|
+
"transitionTimingFunction",
|
|
183
|
+
] as const;
|
|
184
|
+
|
|
185
|
+
const other = [
|
|
186
|
+
"resize",
|
|
187
|
+
"clip",
|
|
188
|
+
"visibility",
|
|
189
|
+
"boxSizing",
|
|
190
|
+
"content",
|
|
191
|
+
"quotes",
|
|
192
|
+
"counterReset",
|
|
193
|
+
"counterIncrement",
|
|
194
|
+
"inlineSize",
|
|
195
|
+
"blockSize",
|
|
196
|
+
"minInlineSize",
|
|
197
|
+
"minBlockSize",
|
|
198
|
+
"maxInlineSize",
|
|
199
|
+
"maxBlockSize",
|
|
200
|
+
"userSelect",
|
|
201
|
+
"pointerEvents",
|
|
202
|
+
] as const;
|
|
203
|
+
|
|
204
|
+
export const categories = {
|
|
205
|
+
layout: {
|
|
206
|
+
label: "Layout",
|
|
207
|
+
properties: layout,
|
|
208
|
+
moreFrom: "",
|
|
209
|
+
},
|
|
210
|
+
flexChild: {
|
|
211
|
+
label: "Flex Child",
|
|
212
|
+
properties: flexChild,
|
|
213
|
+
moreFrom: "",
|
|
214
|
+
},
|
|
215
|
+
gridChild: {
|
|
216
|
+
label: "Grid Child",
|
|
217
|
+
properties: gridChild,
|
|
218
|
+
moreFrom: "",
|
|
219
|
+
},
|
|
220
|
+
spacing: { label: "Spacing", properties: spacing, moreFrom: "" },
|
|
221
|
+
size: { label: "Size", properties: size, moreFrom: "" },
|
|
222
|
+
position: { label: "Position", properties: position, moreFrom: "" },
|
|
223
|
+
typography: {
|
|
224
|
+
label: "Typography",
|
|
225
|
+
properties: typography,
|
|
226
|
+
moreFrom: "fontSizeAdjust",
|
|
227
|
+
},
|
|
228
|
+
backgrounds: { label: "Backgrounds", properties: backgrounds, moreFrom: "" },
|
|
229
|
+
borders: {
|
|
230
|
+
label: "Borders",
|
|
231
|
+
properties: borders,
|
|
232
|
+
moreFrom: "borderImageSlice",
|
|
233
|
+
},
|
|
234
|
+
effects: {
|
|
235
|
+
label: "Effects",
|
|
236
|
+
properties: effects,
|
|
237
|
+
moreFrom: "animationDelay",
|
|
238
|
+
},
|
|
239
|
+
other: { label: "Other", properties: other, moreFrom: "" },
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export const propertyCategoryMap = {} as {
|
|
243
|
+
[property in StyleProperty]: Category;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
let category: Category;
|
|
247
|
+
for (category in categories) {
|
|
248
|
+
for (const property of categories[category].properties) {
|
|
249
|
+
// We are widening the type here
|
|
250
|
+
propertyCategoryMap[property as StyleProperty] = category;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export type Category = keyof typeof categories;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { detectFont } from "detect-font";
|
|
2
|
+
import type { Style, StyleValue, Unit } from "@webstudio-is/css-data";
|
|
3
|
+
import { properties, units } from "@webstudio-is/css-data";
|
|
4
|
+
|
|
5
|
+
const unitRegex = new RegExp(`${units.join("|")}`);
|
|
6
|
+
|
|
7
|
+
// @todo use a parser
|
|
8
|
+
const parseValue = (
|
|
9
|
+
property: keyof typeof properties,
|
|
10
|
+
value: string
|
|
11
|
+
): StyleValue => {
|
|
12
|
+
const number = parseFloat(value);
|
|
13
|
+
const parsedUnit = unitRegex.exec(value);
|
|
14
|
+
if (value === "rgba(0, 0, 0, 0)") {
|
|
15
|
+
value = "transparent";
|
|
16
|
+
}
|
|
17
|
+
if (isNaN(number) || parsedUnit === null) {
|
|
18
|
+
return {
|
|
19
|
+
type: "keyword",
|
|
20
|
+
value,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (number === 0 && property in properties) {
|
|
25
|
+
return properties[property].initial;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
type: "unit",
|
|
30
|
+
unit: parsedUnit[0] as Unit,
|
|
31
|
+
value: number,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const getBrowserStyle = (element?: Element): Style => {
|
|
36
|
+
const browserStyle: Style = {};
|
|
37
|
+
if (element === undefined) {
|
|
38
|
+
return browserStyle;
|
|
39
|
+
}
|
|
40
|
+
let knownProperty: keyof typeof properties;
|
|
41
|
+
const computedStyle = getComputedStyle(element);
|
|
42
|
+
for (knownProperty in properties) {
|
|
43
|
+
if (knownProperty in computedStyle === false) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
// Typescript doesn't know we can access CSSStyleDeclaration properties by keys
|
|
47
|
+
const computedValue = computedStyle[knownProperty as unknown as number];
|
|
48
|
+
browserStyle[knownProperty] = parseValue(knownProperty, computedValue);
|
|
49
|
+
}
|
|
50
|
+
// We need a single font-family that is actually rendered. Computed style will return a list of potential fonts.
|
|
51
|
+
browserStyle.fontFamily = {
|
|
52
|
+
type: "fontFamily",
|
|
53
|
+
value: [detectFont(element)],
|
|
54
|
+
};
|
|
55
|
+
return browserStyle;
|
|
56
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CssRule } from "@webstudio-is/css-data";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ComponentName } from "../components";
|
|
4
|
+
|
|
5
|
+
// This should be used when passing a lot of data is potentially costly.
|
|
6
|
+
// For example, when passing data from an iframe.
|
|
7
|
+
export type BaseInstance = {
|
|
8
|
+
id: string;
|
|
9
|
+
component: ComponentName;
|
|
10
|
+
cssRules: Array<CssRule>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type Instance = BaseInstance & {
|
|
14
|
+
children: Array<Instance | string>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const toBaseInstance = (instance: Instance): BaseInstance => {
|
|
18
|
+
return {
|
|
19
|
+
id: instance.id,
|
|
20
|
+
component: instance.component,
|
|
21
|
+
cssRules: instance.cssRules,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const Instance = z.lazy(
|
|
26
|
+
() =>
|
|
27
|
+
z.object({
|
|
28
|
+
id: z.string(),
|
|
29
|
+
component: z.string(),
|
|
30
|
+
children: z.array(z.union([Instance, z.string()])),
|
|
31
|
+
cssRules: z.array(CssRule),
|
|
32
|
+
})
|
|
33
|
+
// @todo can't figure out how to make component to be z.enum(Object.keys(components))
|
|
34
|
+
) as z.ZodType<Instance>;
|
package/src/db/types.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InstanceProps as DbInstanceProps } from "@webstudio-is/prisma-client";
|
|
2
|
+
import type { UserProp } from "../user-props";
|
|
3
|
+
import type { Instance } from "./instance";
|
|
4
|
+
|
|
5
|
+
export type Tree = {
|
|
6
|
+
id: string;
|
|
7
|
+
root: Instance;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type Props = {
|
|
11
|
+
props: string;
|
|
12
|
+
id: string;
|
|
13
|
+
instanceId: string;
|
|
14
|
+
treeId: string;
|
|
15
|
+
};
|
|
16
|
+
export type InstanceProps = Omit<DbInstanceProps, "props"> & {
|
|
17
|
+
props: Array<UserProp>;
|
|
18
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export * from "./css";
|
|
2
2
|
export * from "./tree";
|
|
3
3
|
export * from "./components";
|
|
4
|
-
export * from "./components/meta";
|
|
5
4
|
export * from "./user-props";
|
|
6
5
|
export * from "./pubsub";
|
|
7
6
|
export * from "./db";
|
|
8
7
|
export * from "./app";
|
|
9
|
-
export
|
|
10
|
-
|
|
8
|
+
export {
|
|
9
|
+
customComponents,
|
|
10
|
+
customComponentsMeta,
|
|
11
|
+
} from "./app/custom-components";
|
|
12
|
+
export type { MetaProps } from "./components/component-type";
|