@webstudio-is/react-sdk 0.51.0 → 0.53.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/lib/cjs/components/{blockquote.cjs → blockquote.js} +2 -1
- package/lib/cjs/components/{blockquote.ws.cjs → blockquote.ws.js} +57 -35
- package/lib/cjs/components/{body.cjs → body.js} +2 -1
- package/lib/cjs/components/{body.ws.cjs → body.ws.js} +30 -46
- package/lib/cjs/components/{bold.cjs → bold.js} +2 -1
- package/lib/cjs/components/{bold.ws.cjs → bold.ws.js} +6 -1
- package/lib/cjs/components/{box.ws.cjs → box.ws.js} +11 -4
- package/lib/cjs/components/{button.cjs → button.js} +2 -1
- package/lib/cjs/components/{button.ws.cjs → button.ws.js} +6 -1
- package/lib/cjs/components/{code.cjs → code.js} +1 -0
- package/lib/cjs/components/{code.ws.cjs → code.ws.js} +31 -25
- package/lib/cjs/components/{form.cjs → form.js} +2 -1
- package/lib/cjs/components/{form.ws.cjs → form.ws.js} +8 -8
- package/lib/cjs/components/{heading.ws.cjs → heading.ws.js} +11 -1
- package/lib/cjs/components/{image.cjs → image.js} +2 -1
- package/lib/cjs/components/{image.ws.cjs → image.ws.js} +15 -11
- package/lib/cjs/components/{input.cjs → input.js} +2 -1
- package/lib/cjs/components/{input.ws.cjs → input.ws.js} +6 -1
- package/lib/cjs/components/{italic.cjs → italic.js} +2 -1
- package/lib/cjs/components/{italic.ws.cjs → italic.ws.js} +8 -4
- package/lib/cjs/components/{link-block.cjs → link-block.js} +3 -1
- package/lib/cjs/components/{link-block.ws.cjs → link-block.ws.js} +7 -7
- package/lib/cjs/components/{link.cjs → link.js} +3 -1
- package/lib/cjs/components/{link.ws.cjs → link.ws.js} +13 -9
- package/lib/cjs/components/{list-item.cjs → list-item.js} +2 -1
- package/lib/cjs/components/{list-item.ws.cjs → list-item.ws.js} +6 -1
- package/lib/cjs/components/{list.ws.cjs → list.ws.js} +29 -10
- package/lib/cjs/components/{paragraph.cjs → paragraph.js} +2 -1
- package/lib/cjs/components/{paragraph.ws.cjs → paragraph.ws.js} +6 -1
- package/lib/cjs/components/{separator.cjs → separator.js} +2 -1
- package/lib/cjs/components/{separator.ws.cjs → separator.ws.js} +27 -11
- package/lib/cjs/components/{span.cjs → span.js} +2 -1
- package/lib/cjs/components/{span.ws.cjs → span.ws.js} +6 -1
- package/lib/cjs/components/{subscript.cjs → subscript.js} +2 -1
- package/lib/cjs/components/{subscript.ws.cjs → subscript.ws.js} +6 -1
- package/lib/cjs/components/{superscript.cjs → superscript.js} +2 -1
- package/lib/cjs/components/{superscript.ws.cjs → superscript.ws.js} +6 -1
- package/lib/cjs/components/{text-block.cjs → text-block.js} +2 -1
- package/lib/cjs/components/{text-block.ws.cjs → text-block.ws.js} +9 -5
- package/lib/cjs/css/css.js +64 -0
- package/lib/cjs/css/global-rules.js +37 -0
- package/lib/cjs/css/{index.cjs → index.js} +3 -1
- package/lib/cjs/css/normalize-type-check.js +26 -0
- package/lib/cjs/css/normalize.js +358 -0
- package/lib/cjs/css/presets.js +61 -0
- package/lib/cjs/css/style-rules.js +62 -0
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/pubsub/{create.cjs → create.js} +6 -35
- package/lib/cjs/pubsub/raf-queue.js +45 -0
- package/lib/cjs/tree/{webstudio-component.cjs → webstudio-component.js} +1 -0
- package/lib/components/blockquote.js +2 -1
- package/lib/components/blockquote.ws.js +57 -35
- package/lib/components/body.js +2 -1
- package/lib/components/body.ws.js +30 -46
- package/lib/components/bold.js +2 -1
- package/lib/components/bold.ws.js +7 -2
- package/lib/components/box.ws.js +22 -4
- package/lib/components/button.js +2 -1
- package/lib/components/button.ws.js +7 -2
- package/lib/components/code.js +1 -0
- package/lib/components/code.ws.js +31 -25
- package/lib/components/form.js +2 -1
- package/lib/components/form.ws.js +8 -8
- package/lib/components/heading.ws.js +11 -1
- package/lib/components/image.js +2 -1
- package/lib/components/image.ws.js +15 -11
- package/lib/components/input.js +2 -1
- package/lib/components/input.ws.js +7 -2
- package/lib/components/italic.js +2 -1
- package/lib/components/italic.ws.js +9 -5
- package/lib/components/link-block.js +3 -1
- package/lib/components/link-block.ws.js +7 -7
- package/lib/components/link.js +3 -1
- package/lib/components/link.ws.js +14 -10
- package/lib/components/list-item.js +2 -1
- package/lib/components/list-item.ws.js +6 -1
- package/lib/components/list.ws.js +29 -10
- package/lib/components/paragraph.js +2 -1
- package/lib/components/paragraph.ws.js +6 -1
- package/lib/components/separator.js +2 -1
- package/lib/components/separator.ws.js +27 -11
- package/lib/components/span.js +2 -1
- package/lib/components/span.ws.js +7 -2
- package/lib/components/subscript.js +2 -1
- package/lib/components/subscript.ws.js +6 -1
- package/lib/components/superscript.js +2 -1
- package/lib/components/superscript.ws.js +6 -1
- package/lib/components/text-block.js +2 -1
- package/lib/components/text-block.ws.js +10 -6
- package/lib/css/css.js +44 -0
- package/lib/css/get-browser-style.js +3 -1
- package/lib/css/global-rules.js +20 -0
- package/lib/css/index.js +3 -1
- package/lib/css/normalize-type-check.js +3 -0
- package/lib/css/normalize.js +338 -0
- package/lib/css/presets.js +41 -0
- package/lib/css/style-rules.js +42 -0
- package/lib/pubsub/create.js +6 -25
- package/lib/pubsub/raf-queue.js +25 -0
- package/lib/tree/webstudio-component.js +1 -0
- package/lib/types/app/custom-components/image.d.ts +6 -0
- package/lib/types/app/custom-components/index.d.ts +26 -0
- package/lib/types/app/custom-components/link-block.d.ts +6 -0
- package/lib/types/app/custom-components/link.d.ts +6 -0
- package/lib/types/app/custom-components/rich-text-link.d.ts +6 -0
- package/lib/types/app/custom-components/shared/remix-link.d.ts +10 -0
- package/lib/types/app/handle-request.server.d.ts +2 -0
- package/lib/types/app/index.d.ts +3 -0
- package/lib/types/app/params.d.ts +5 -0
- package/lib/types/app/root.d.ts +8 -0
- package/lib/types/components/__generated__/blockquote.props.d.ts +2 -0
- package/lib/types/components/__generated__/body.props.d.ts +2 -0
- package/lib/types/components/__generated__/bold.props.d.ts +2 -0
- package/lib/types/components/__generated__/box.props.d.ts +2 -0
- package/lib/types/components/__generated__/button.props.d.ts +2 -0
- package/lib/types/components/__generated__/code.props.d.ts +2 -0
- package/lib/types/components/__generated__/form.props.d.ts +2 -0
- package/lib/types/components/__generated__/fragment.props.d.ts +2 -0
- package/lib/types/components/__generated__/heading.props.d.ts +2 -0
- package/lib/types/components/__generated__/image.props.d.ts +2 -0
- package/lib/types/components/__generated__/input.props.d.ts +2 -0
- package/lib/types/components/__generated__/italic.props.d.ts +2 -0
- package/lib/types/components/__generated__/link-block.props.d.ts +2 -0
- package/lib/types/components/__generated__/link.props.d.ts +2 -0
- package/lib/types/components/__generated__/list-item.props.d.ts +2 -0
- package/lib/types/components/__generated__/list.props.d.ts +2 -0
- package/lib/types/components/__generated__/paragraph.props.d.ts +2 -0
- package/lib/types/components/__generated__/rich-text-link.props.d.ts +2 -0
- package/lib/types/components/__generated__/separator.props.d.ts +2 -0
- package/lib/types/components/__generated__/slot.props.d.ts +2 -0
- package/lib/types/components/__generated__/span.props.d.ts +2 -0
- package/lib/types/components/__generated__/subscript.props.d.ts +2 -0
- package/lib/types/components/__generated__/superscript.props.d.ts +2 -0
- package/lib/types/components/__generated__/text-block.props.d.ts +2 -0
- package/lib/types/components/blockquote.d.ts +3 -0
- package/lib/types/components/blockquote.stories.d.ts +5 -0
- package/lib/types/components/blockquote.ws.d.ts +3 -0
- package/lib/types/components/body.d.ts +3 -0
- package/lib/types/components/body.stories.d.ts +6 -0
- package/lib/types/components/body.ws.d.ts +3 -0
- package/lib/types/components/bold.d.ts +3 -0
- package/lib/types/components/bold.stories.d.ts +5 -0
- package/lib/types/components/bold.ws.d.ts +3 -0
- package/lib/types/components/box.d.ts +7 -0
- package/lib/types/components/box.stories.d.ts +9 -0
- package/lib/types/components/box.ws.d.ts +3 -0
- package/lib/types/components/button.d.ts +7 -0
- package/lib/types/components/button.stories.d.ts +9 -0
- package/lib/types/components/button.ws.d.ts +3 -0
- package/lib/types/components/code.d.ts +9 -0
- package/lib/types/components/code.stories.d.ts +11 -0
- package/lib/types/components/code.ws.d.ts +3 -0
- package/lib/types/components/component-meta.d.ts +605 -0
- package/lib/types/components/components-utils.d.ts +34 -0
- package/lib/types/components/components.d.ts +31 -0
- package/lib/types/components/form.d.ts +3 -0
- package/lib/types/components/form.stories.d.ts +5 -0
- package/lib/types/components/form.ws.d.ts +3 -0
- package/lib/types/components/fragment.d.ts +6 -0
- package/lib/types/components/fragment.ws.d.ts +3 -0
- package/lib/types/components/heading.d.ts +7 -0
- package/lib/types/components/heading.stories.d.ts +9 -0
- package/lib/types/components/heading.ws.d.ts +3 -0
- package/lib/types/components/image.d.ts +3 -0
- package/lib/types/components/image.stories.d.ts +5 -0
- package/lib/types/components/image.ws.d.ts +3 -0
- package/lib/types/components/index.d.ts +17 -0
- package/lib/types/components/input.d.ts +3 -0
- package/lib/types/components/input.stories.d.ts +5 -0
- package/lib/types/components/input.ws.d.ts +3 -0
- package/lib/types/components/italic.d.ts +3 -0
- package/lib/types/components/italic.stories.d.ts +5 -0
- package/lib/types/components/italic.ws.d.ts +3 -0
- package/lib/types/components/link-block.d.ts +3 -0
- package/lib/types/components/link-block.stories.d.ts +13 -0
- package/lib/types/components/link-block.ws.d.ts +3 -0
- package/lib/types/components/link.d.ts +9 -0
- package/lib/types/components/link.stories.d.ts +13 -0
- package/lib/types/components/link.ws.d.ts +3 -0
- package/lib/types/components/list-item.d.ts +3 -0
- package/lib/types/components/list-item.stories.d.ts +5 -0
- package/lib/types/components/list-item.ws.d.ts +3 -0
- package/lib/types/components/list.d.ts +9 -0
- package/lib/types/components/list.stories.d.ts +9 -0
- package/lib/types/components/list.ws.d.ts +3 -0
- package/lib/types/components/paragraph.d.ts +3 -0
- package/lib/types/components/paragraph.stories.d.ts +5 -0
- package/lib/types/components/paragraph.ws.d.ts +3 -0
- package/lib/types/components/rich-text-link.d.ts +2 -0
- package/lib/types/components/rich-text-link.stories.d.ts +13 -0
- package/lib/types/components/rich-text-link.ws.d.ts +3 -0
- package/lib/types/components/separator.d.ts +3 -0
- package/lib/types/components/separator.stories.d.ts +5 -0
- package/lib/types/components/separator.ws.d.ts +3 -0
- package/lib/types/components/slot.d.ts +6 -0
- package/lib/types/components/slot.stories.d.ts +9 -0
- package/lib/types/components/slot.ws.d.ts +3 -0
- package/lib/types/components/span.d.ts +3 -0
- package/lib/types/components/span.stories.d.ts +5 -0
- package/lib/types/components/span.ws.d.ts +3 -0
- package/lib/types/components/subscript.d.ts +3 -0
- package/lib/types/components/subscript.stories.d.ts +5 -0
- package/lib/types/components/subscript.ws.d.ts +3 -0
- package/lib/types/components/superscript.d.ts +3 -0
- package/lib/types/components/superscript.stories.d.ts +5 -0
- package/lib/types/components/superscript.ws.d.ts +3 -0
- package/lib/types/components/text-block.d.ts +3 -0
- package/lib/types/components/text-block.stories.d.ts +5 -0
- package/lib/types/components/text-block.ws.d.ts +3 -0
- package/lib/types/context.d.ts +9 -0
- package/lib/types/css/css.d.ts +10 -0
- package/lib/types/css/get-browser-style.d.ts +2 -0
- package/lib/types/css/global-rules.d.ts +44 -0
- package/lib/types/css/index.d.ts +4 -0
- package/lib/types/css/normalize-type-check.d.ts +1 -0
- package/lib/types/css/normalize.d.ts +2429 -0
- package/lib/types/css/presets.d.ts +38 -0
- package/lib/types/css/style-rules.d.ts +248 -0
- package/lib/types/css/style-rules.test.d.ts +1 -0
- package/lib/types/index.d.ts +9 -0
- package/lib/types/props.d.ts +97 -0
- package/lib/types/props.test.d.ts +1 -0
- package/lib/types/pubsub/create.d.ts +28 -0
- package/lib/types/pubsub/index.d.ts +1 -0
- package/lib/types/pubsub/raf-queue.d.ts +1 -0
- package/lib/types/tree/create-elements-tree.d.ts +16 -0
- package/lib/types/tree/index.d.ts +3 -0
- package/lib/types/tree/root.d.ts +25 -0
- package/lib/types/tree/session-storage-polyfill.d.ts +2 -0
- package/lib/types/tree/webstudio-component.d.ts +15 -0
- package/package.json +20 -19
- package/src/components/blockquote.tsx +1 -1
- package/src/components/blockquote.ws.tsx +63 -36
- package/src/components/body.tsx +1 -1
- package/src/components/body.ws.tsx +39 -47
- package/src/components/bold.tsx +1 -1
- package/src/components/bold.ws.tsx +10 -2
- package/src/components/box.ws.ts +28 -5
- package/src/components/button.tsx +1 -1
- package/src/components/button.ws.tsx +10 -2
- package/src/components/code.tsx +1 -1
- package/src/components/code.ws.tsx +36 -28
- package/src/components/component-meta.ts +4 -1
- package/src/components/form.tsx +1 -1
- package/src/components/form.ws.tsx +11 -9
- package/src/components/heading.ws.tsx +16 -0
- package/src/components/image.tsx +1 -1
- package/src/components/image.ws.tsx +19 -12
- package/src/components/input.tsx +1 -1
- package/src/components/input.ws.tsx +10 -2
- package/src/components/italic.tsx +1 -1
- package/src/components/italic.ws.tsx +12 -6
- package/src/components/link-block.tsx +1 -0
- package/src/components/link-block.ws.tsx +10 -8
- package/src/components/link.tsx +2 -0
- package/src/components/link.ws.tsx +17 -11
- package/src/components/list-item.tsx +1 -1
- package/src/components/list-item.ws.tsx +8 -0
- package/src/components/list.tsx +2 -0
- package/src/components/list.ws.tsx +32 -11
- package/src/components/paragraph.tsx +1 -1
- package/src/components/paragraph.ws.tsx +8 -0
- package/src/components/separator.tsx +1 -1
- package/src/components/separator.ws.tsx +33 -12
- package/src/components/span.tsx +1 -1
- package/src/components/span.ws.tsx +10 -2
- package/src/components/subscript.tsx +1 -1
- package/src/components/subscript.ws.tsx +8 -0
- package/src/components/superscript.tsx +1 -1
- package/src/components/superscript.ws.tsx +8 -0
- package/src/components/text-block.tsx +1 -1
- package/src/components/text-block.ws.tsx +14 -7
- package/src/context.tsx +2 -1
- package/src/css/css.ts +57 -0
- package/src/css/get-browser-style.ts +6 -1
- package/src/css/global-rules.ts +29 -0
- package/src/css/index.ts +3 -1
- package/src/css/normalize-type-check.ts +13 -0
- package/src/css/normalize.ts +519 -0
- package/src/css/presets.ts +42 -0
- package/src/css/style-rules.test.ts +147 -0
- package/src/css/style-rules.ts +66 -0
- package/src/props.ts +0 -2
- package/src/pubsub/create.ts +7 -38
- package/src/pubsub/raf-queue.ts +31 -0
- package/src/tree/create-elements-tree.tsx +2 -1
- package/src/tree/webstudio-component.tsx +1 -0
- package/lib/cjs/css/categories.cjs +0 -250
- package/lib/css/categories.js +0 -230
- package/src/css/categories.ts +0 -254
- /package/lib/cjs/app/custom-components/{image.cjs → image.js} +0 -0
- /package/lib/cjs/app/custom-components/{index.cjs → index.js} +0 -0
- /package/lib/cjs/app/custom-components/{link-block.cjs → link-block.js} +0 -0
- /package/lib/cjs/app/custom-components/{link.cjs → link.js} +0 -0
- /package/lib/cjs/app/custom-components/{rich-text-link.cjs → rich-text-link.js} +0 -0
- /package/lib/cjs/app/custom-components/shared/{remix-link.cjs → remix-link.js} +0 -0
- /package/lib/cjs/app/{handle-request.server.cjs → handle-request.server.js} +0 -0
- /package/lib/cjs/app/{index.cjs → index.js} +0 -0
- /package/lib/cjs/app/{params.cjs → params.js} +0 -0
- /package/lib/cjs/app/{root.cjs → root.js} +0 -0
- /package/lib/cjs/components/__generated__/{blockquote.props.cjs → blockquote.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{body.props.cjs → body.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{bold.props.cjs → bold.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{box.props.cjs → box.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{button.props.cjs → button.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{code.props.cjs → code.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{form.props.cjs → form.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{fragment.props.cjs → fragment.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{heading.props.cjs → heading.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{image.props.cjs → image.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{input.props.cjs → input.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{italic.props.cjs → italic.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{link-block.props.cjs → link-block.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{link.props.cjs → link.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{list-item.props.cjs → list-item.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{list.props.cjs → list.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{paragraph.props.cjs → paragraph.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{rich-text-link.props.cjs → rich-text-link.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{separator.props.cjs → separator.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{slot.props.cjs → slot.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{span.props.cjs → span.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{subscript.props.cjs → subscript.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{superscript.props.cjs → superscript.props.js} +0 -0
- /package/lib/cjs/components/__generated__/{text-block.props.cjs → text-block.props.js} +0 -0
- /package/lib/cjs/components/{box.cjs → box.js} +0 -0
- /package/lib/cjs/components/{component-meta.cjs → component-meta.js} +0 -0
- /package/lib/cjs/components/{components-utils.cjs → components-utils.js} +0 -0
- /package/lib/cjs/components/{components.cjs → components.js} +0 -0
- /package/lib/cjs/components/{fragment.cjs → fragment.js} +0 -0
- /package/lib/cjs/components/{fragment.ws.cjs → fragment.ws.js} +0 -0
- /package/lib/cjs/components/{heading.cjs → heading.js} +0 -0
- /package/lib/cjs/components/{index.cjs → index.js} +0 -0
- /package/lib/cjs/components/{list.cjs → list.js} +0 -0
- /package/lib/cjs/components/{rich-text-link.cjs → rich-text-link.js} +0 -0
- /package/lib/cjs/components/{rich-text-link.ws.cjs → rich-text-link.ws.js} +0 -0
- /package/lib/cjs/components/{slot.cjs → slot.js} +0 -0
- /package/lib/cjs/components/{slot.ws.cjs → slot.ws.js} +0 -0
- /package/lib/cjs/{context.cjs → context.js} +0 -0
- /package/lib/cjs/css/{get-browser-style.cjs → get-browser-style.js} +0 -0
- /package/lib/cjs/{index.cjs → index.js} +0 -0
- /package/lib/cjs/{props.cjs → props.js} +0 -0
- /package/lib/cjs/pubsub/{index.cjs → index.js} +0 -0
- /package/lib/cjs/tree/{create-elements-tree.cjs → create-elements-tree.js} +0 -0
- /package/lib/cjs/tree/{index.cjs → index.js} +0 -0
- /package/lib/cjs/tree/{root.cjs → root.js} +0 -0
- /package/lib/cjs/tree/{session-storage-polyfill.cjs → session-storage-polyfill.js} +0 -0
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
import { ListIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { props } from "./__generated__/list.props";
|
|
3
|
+
import { ol, ul } from "../css/normalize";
|
|
3
4
|
const presetStyle = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
ol: {
|
|
6
|
+
...ol,
|
|
7
|
+
marginTop: {
|
|
8
|
+
type: "keyword",
|
|
9
|
+
value: "0"
|
|
10
|
+
},
|
|
11
|
+
marginBottom: {
|
|
12
|
+
type: "keyword",
|
|
13
|
+
value: "10px"
|
|
14
|
+
},
|
|
15
|
+
paddingLeft: {
|
|
16
|
+
type: "keyword",
|
|
17
|
+
value: "40px"
|
|
18
|
+
}
|
|
7
19
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
ul: {
|
|
21
|
+
...ul,
|
|
22
|
+
marginTop: {
|
|
23
|
+
type: "keyword",
|
|
24
|
+
value: "0"
|
|
25
|
+
},
|
|
26
|
+
marginBottom: {
|
|
27
|
+
type: "keyword",
|
|
28
|
+
value: "10px"
|
|
29
|
+
},
|
|
30
|
+
paddingLeft: {
|
|
31
|
+
type: "keyword",
|
|
32
|
+
value: "40px"
|
|
33
|
+
}
|
|
15
34
|
}
|
|
16
35
|
};
|
|
17
36
|
const meta = {
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { TextAlignLeftIcon } from "@webstudio-is/icons";
|
|
2
|
+
import { p } from "../css/normalize";
|
|
2
3
|
import { props } from "./__generated__/paragraph.props";
|
|
4
|
+
const presetStyle = {
|
|
5
|
+
p
|
|
6
|
+
};
|
|
3
7
|
const meta = {
|
|
4
8
|
category: "typography",
|
|
5
9
|
type: "rich-text",
|
|
6
10
|
label: "Paragraph",
|
|
7
11
|
Icon: TextAlignLeftIcon,
|
|
8
|
-
children: ["Pragraph you can edit"]
|
|
12
|
+
children: ["Pragraph you can edit"],
|
|
13
|
+
presetStyle
|
|
9
14
|
};
|
|
10
15
|
const propsMeta = {
|
|
11
16
|
props
|
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
import { DashIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { props } from "./__generated__/separator.props";
|
|
3
|
+
import { hr } from "../css/normalize";
|
|
3
4
|
const presetStyle = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
hr: {
|
|
6
|
+
...hr,
|
|
7
|
+
height: {
|
|
8
|
+
type: "keyword",
|
|
9
|
+
value: "1px"
|
|
10
|
+
},
|
|
11
|
+
backgroundColor: {
|
|
12
|
+
type: "keyword",
|
|
13
|
+
value: "gray"
|
|
14
|
+
},
|
|
15
|
+
borderTopStyle: {
|
|
16
|
+
type: "keyword",
|
|
17
|
+
value: "none"
|
|
18
|
+
},
|
|
19
|
+
borderRightStyle: {
|
|
20
|
+
type: "keyword",
|
|
21
|
+
value: "none"
|
|
22
|
+
},
|
|
23
|
+
borderLeftStyle: {
|
|
24
|
+
type: "keyword",
|
|
25
|
+
value: "none"
|
|
26
|
+
},
|
|
27
|
+
borderBottomStyle: {
|
|
28
|
+
type: "keyword",
|
|
29
|
+
value: "none"
|
|
30
|
+
}
|
|
15
31
|
}
|
|
16
32
|
};
|
|
17
33
|
const meta = {
|
package/lib/components/span.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PaintBrushIcon } from "@webstudio-is/icons";
|
|
2
|
+
import { span } from "../css/normalize";
|
|
2
3
|
import { props } from "./__generated__/span.props";
|
|
4
|
+
const presetStyle = {
|
|
5
|
+
span
|
|
6
|
+
};
|
|
3
7
|
const meta = {
|
|
4
8
|
type: "rich-text-child",
|
|
5
9
|
label: "Styled Text",
|
|
6
|
-
Icon:
|
|
10
|
+
Icon: PaintBrushIcon,
|
|
11
|
+
presetStyle
|
|
7
12
|
};
|
|
8
13
|
const propsMeta = {
|
|
9
14
|
props
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { SubscriptIcon } from "@webstudio-is/icons";
|
|
2
|
+
import { sub } from "../css/normalize";
|
|
2
3
|
import { props } from "./__generated__/subscript.props";
|
|
4
|
+
const presetStyle = {
|
|
5
|
+
sub
|
|
6
|
+
};
|
|
3
7
|
const meta = {
|
|
4
8
|
type: "rich-text-child",
|
|
5
9
|
label: "Subscript Text",
|
|
6
|
-
Icon: SubscriptIcon
|
|
10
|
+
Icon: SubscriptIcon,
|
|
11
|
+
presetStyle
|
|
7
12
|
};
|
|
8
13
|
const propsMeta = {
|
|
9
14
|
props
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { SuperscriptIcon } from "@webstudio-is/icons";
|
|
2
|
+
import { sup } from "../css/normalize";
|
|
2
3
|
import { props } from "./__generated__/superscript.props";
|
|
4
|
+
const presetStyle = {
|
|
5
|
+
sup
|
|
6
|
+
};
|
|
3
7
|
const meta = {
|
|
4
8
|
type: "rich-text-child",
|
|
5
9
|
label: "Superscript Text",
|
|
6
|
-
Icon: SuperscriptIcon
|
|
10
|
+
Icon: SuperscriptIcon,
|
|
11
|
+
presetStyle
|
|
7
12
|
};
|
|
8
13
|
const propsMeta = {
|
|
9
14
|
props
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TextBlockIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { props } from "./__generated__/text-block.props";
|
|
3
|
+
import { div } from "../css/normalize";
|
|
3
4
|
const presetStyle = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
div: {
|
|
6
|
+
...div,
|
|
7
|
+
minHeight: {
|
|
8
|
+
type: "unit",
|
|
9
|
+
unit: "em",
|
|
10
|
+
value: 1
|
|
11
|
+
}
|
|
8
12
|
}
|
|
9
13
|
};
|
|
10
14
|
const meta = {
|
|
11
15
|
category: "typography",
|
|
12
16
|
type: "rich-text",
|
|
13
17
|
label: "Text Block",
|
|
14
|
-
Icon:
|
|
18
|
+
Icon: TextBlockIcon,
|
|
15
19
|
presetStyle,
|
|
16
20
|
children: ["Block of text you can edit"]
|
|
17
21
|
};
|
package/lib/css/css.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createCssEngine } from "@webstudio-is/css-engine";
|
|
2
|
+
import { getComponentNames } from "../components/components-utils";
|
|
3
|
+
import { getComponentMeta } from "../components";
|
|
4
|
+
import { componentAttribute, idAttribute } from "../tree";
|
|
5
|
+
import { addGlobalRules } from "./global-rules";
|
|
6
|
+
import { getStyleRules } from "./style-rules";
|
|
7
|
+
const generateCssText = (data) => {
|
|
8
|
+
const assets = new Map(
|
|
9
|
+
data.assets.map((asset) => [asset.id, asset])
|
|
10
|
+
);
|
|
11
|
+
const breakpoints = new Map(data.breakpoints);
|
|
12
|
+
const styles = new Map(data.styles);
|
|
13
|
+
const styleSourceSelections = new Map(data.styleSourceSelections);
|
|
14
|
+
const engine = createCssEngine({ name: "ssr" });
|
|
15
|
+
addGlobalRules(engine, { assets });
|
|
16
|
+
for (const breakpoint of breakpoints.values()) {
|
|
17
|
+
engine.addMediaRule(breakpoint.id, breakpoint);
|
|
18
|
+
}
|
|
19
|
+
for (const component of getComponentNames()) {
|
|
20
|
+
const meta = getComponentMeta(component);
|
|
21
|
+
const presetStyle = meta?.presetStyle;
|
|
22
|
+
if (presetStyle !== void 0) {
|
|
23
|
+
for (const [tag, style] of Object.entries(presetStyle)) {
|
|
24
|
+
engine.addStyleRule(
|
|
25
|
+
`${tag}:where([${componentAttribute}=${component}])`,
|
|
26
|
+
{
|
|
27
|
+
style
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const styleRules = getStyleRules(styles, styleSourceSelections);
|
|
34
|
+
for (const { breakpointId, instanceId, style } of styleRules) {
|
|
35
|
+
engine.addStyleRule(`[${idAttribute}="${instanceId}"]`, {
|
|
36
|
+
breakpoint: breakpointId,
|
|
37
|
+
style
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return engine.cssText;
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
generateCssText
|
|
44
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { detectFont } from "detect-font";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
keywordValues
|
|
4
|
+
} from "@webstudio-is/css-data";
|
|
3
5
|
import { properties, units } from "@webstudio-is/css-data";
|
|
4
6
|
const unitsList = Object.values(units).flat();
|
|
5
7
|
const unitRegex = new RegExp(`${unitsList.join("|")}`);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FONT_FORMATS,
|
|
3
|
+
getFontFaces
|
|
4
|
+
} from "@webstudio-is/fonts";
|
|
5
|
+
const addGlobalRules = (engine, { assets }) => {
|
|
6
|
+
engine.addPlaintextRule("html {margin: 0; height: 100%}");
|
|
7
|
+
const fontAssets = [];
|
|
8
|
+
for (const asset of assets.values()) {
|
|
9
|
+
if (asset && FONT_FORMATS.has(asset.format)) {
|
|
10
|
+
fontAssets.push(asset);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const fontFaces = getFontFaces(fontAssets);
|
|
14
|
+
for (const fontFace of fontFaces) {
|
|
15
|
+
engine.addFontFaceRule(fontFace);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
addGlobalRules
|
|
20
|
+
};
|
package/lib/css/index.js
CHANGED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { borders } from "./presets";
|
|
2
|
+
const boxSizing = {
|
|
3
|
+
type: "keyword",
|
|
4
|
+
value: "border-box"
|
|
5
|
+
};
|
|
6
|
+
const baseStyle = {
|
|
7
|
+
boxSizing,
|
|
8
|
+
...borders
|
|
9
|
+
};
|
|
10
|
+
const div = baseStyle;
|
|
11
|
+
const address = baseStyle;
|
|
12
|
+
const article = baseStyle;
|
|
13
|
+
const aside = baseStyle;
|
|
14
|
+
const figure = baseStyle;
|
|
15
|
+
const footer = baseStyle;
|
|
16
|
+
const header = baseStyle;
|
|
17
|
+
const main = baseStyle;
|
|
18
|
+
const nav = baseStyle;
|
|
19
|
+
const section = baseStyle;
|
|
20
|
+
const form = baseStyle;
|
|
21
|
+
const h1 = baseStyle;
|
|
22
|
+
const h2 = baseStyle;
|
|
23
|
+
const h3 = baseStyle;
|
|
24
|
+
const h4 = baseStyle;
|
|
25
|
+
const h5 = baseStyle;
|
|
26
|
+
const h6 = baseStyle;
|
|
27
|
+
const i = baseStyle;
|
|
28
|
+
const img = baseStyle;
|
|
29
|
+
const a = baseStyle;
|
|
30
|
+
const li = baseStyle;
|
|
31
|
+
const ul = baseStyle;
|
|
32
|
+
const ol = baseStyle;
|
|
33
|
+
const p = baseStyle;
|
|
34
|
+
const span = baseStyle;
|
|
35
|
+
const html = {
|
|
36
|
+
/* 1 */
|
|
37
|
+
lineHeight: {
|
|
38
|
+
type: "unit",
|
|
39
|
+
value: 1.15,
|
|
40
|
+
unit: "number"
|
|
41
|
+
},
|
|
42
|
+
/* 2 */
|
|
43
|
+
textSizeAdjust: {
|
|
44
|
+
type: "unit",
|
|
45
|
+
value: 100,
|
|
46
|
+
unit: "%"
|
|
47
|
+
},
|
|
48
|
+
/* 3 */
|
|
49
|
+
tabSize: {
|
|
50
|
+
type: "unit",
|
|
51
|
+
value: 4,
|
|
52
|
+
unit: "number"
|
|
53
|
+
},
|
|
54
|
+
boxSizing,
|
|
55
|
+
...borders
|
|
56
|
+
};
|
|
57
|
+
const body = {
|
|
58
|
+
/* 1 */
|
|
59
|
+
marginTop: {
|
|
60
|
+
type: "unit",
|
|
61
|
+
value: 0,
|
|
62
|
+
unit: "number"
|
|
63
|
+
},
|
|
64
|
+
marginRight: {
|
|
65
|
+
type: "unit",
|
|
66
|
+
value: 0,
|
|
67
|
+
unit: "number"
|
|
68
|
+
},
|
|
69
|
+
marginBottom: {
|
|
70
|
+
type: "unit",
|
|
71
|
+
value: 0,
|
|
72
|
+
unit: "number"
|
|
73
|
+
},
|
|
74
|
+
marginLeft: {
|
|
75
|
+
type: "unit",
|
|
76
|
+
value: 0,
|
|
77
|
+
unit: "number"
|
|
78
|
+
},
|
|
79
|
+
/* 2 */
|
|
80
|
+
fontFamily: {
|
|
81
|
+
type: "keyword",
|
|
82
|
+
value: `system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'`
|
|
83
|
+
},
|
|
84
|
+
boxSizing,
|
|
85
|
+
...borders
|
|
86
|
+
};
|
|
87
|
+
const hr = {
|
|
88
|
+
/* 1 */
|
|
89
|
+
height: {
|
|
90
|
+
type: "unit",
|
|
91
|
+
value: 0,
|
|
92
|
+
unit: "number"
|
|
93
|
+
},
|
|
94
|
+
/* 2 */
|
|
95
|
+
color: { type: "keyword", value: "inherit" },
|
|
96
|
+
boxSizing,
|
|
97
|
+
...borders
|
|
98
|
+
};
|
|
99
|
+
const b = {
|
|
100
|
+
fontWeight: {
|
|
101
|
+
type: "keyword",
|
|
102
|
+
value: "bolder"
|
|
103
|
+
},
|
|
104
|
+
boxSizing,
|
|
105
|
+
...borders
|
|
106
|
+
};
|
|
107
|
+
const strong = b;
|
|
108
|
+
const code = {
|
|
109
|
+
/* 1 */
|
|
110
|
+
fontFamily: {
|
|
111
|
+
type: "keyword",
|
|
112
|
+
value: `ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace`
|
|
113
|
+
},
|
|
114
|
+
/* 2 */
|
|
115
|
+
fontSize: {
|
|
116
|
+
type: "unit",
|
|
117
|
+
value: 1,
|
|
118
|
+
unit: "em"
|
|
119
|
+
},
|
|
120
|
+
boxSizing,
|
|
121
|
+
...borders
|
|
122
|
+
};
|
|
123
|
+
const kbd = code;
|
|
124
|
+
const samp = code;
|
|
125
|
+
const pre = code;
|
|
126
|
+
const small = {
|
|
127
|
+
fontSize: {
|
|
128
|
+
type: "unit",
|
|
129
|
+
value: 80,
|
|
130
|
+
unit: "%"
|
|
131
|
+
},
|
|
132
|
+
boxSizing,
|
|
133
|
+
...borders
|
|
134
|
+
};
|
|
135
|
+
const subSupBase = {
|
|
136
|
+
fontSize: {
|
|
137
|
+
type: "unit",
|
|
138
|
+
value: 75,
|
|
139
|
+
unit: "%"
|
|
140
|
+
},
|
|
141
|
+
lineHeight: {
|
|
142
|
+
type: "unit",
|
|
143
|
+
value: 0,
|
|
144
|
+
unit: "number"
|
|
145
|
+
},
|
|
146
|
+
position: {
|
|
147
|
+
type: "keyword",
|
|
148
|
+
value: "relative"
|
|
149
|
+
},
|
|
150
|
+
verticalAlign: {
|
|
151
|
+
type: "keyword",
|
|
152
|
+
value: "baseline"
|
|
153
|
+
},
|
|
154
|
+
boxSizing,
|
|
155
|
+
...borders
|
|
156
|
+
};
|
|
157
|
+
const sub = {
|
|
158
|
+
...subSupBase,
|
|
159
|
+
bottom: {
|
|
160
|
+
type: "unit",
|
|
161
|
+
value: -0.25,
|
|
162
|
+
unit: "em"
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const sup = {
|
|
166
|
+
...subSupBase,
|
|
167
|
+
top: {
|
|
168
|
+
type: "unit",
|
|
169
|
+
value: -0.5,
|
|
170
|
+
unit: "em"
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const table = {
|
|
174
|
+
/* 1 */
|
|
175
|
+
textIndent: {
|
|
176
|
+
type: "unit",
|
|
177
|
+
value: 0,
|
|
178
|
+
unit: "number"
|
|
179
|
+
},
|
|
180
|
+
...borders,
|
|
181
|
+
/* 2 */
|
|
182
|
+
borderTopColor: {
|
|
183
|
+
type: "keyword",
|
|
184
|
+
value: "inherit"
|
|
185
|
+
},
|
|
186
|
+
borderRightColor: {
|
|
187
|
+
type: "keyword",
|
|
188
|
+
value: "inherit"
|
|
189
|
+
},
|
|
190
|
+
borderBottomColor: {
|
|
191
|
+
type: "keyword",
|
|
192
|
+
value: "inherit"
|
|
193
|
+
},
|
|
194
|
+
borderLeftColor: {
|
|
195
|
+
type: "keyword",
|
|
196
|
+
value: "inherit"
|
|
197
|
+
},
|
|
198
|
+
boxSizing
|
|
199
|
+
};
|
|
200
|
+
const buttonBase = {
|
|
201
|
+
/* 1 */
|
|
202
|
+
fontFamily: {
|
|
203
|
+
type: "keyword",
|
|
204
|
+
value: "inherit"
|
|
205
|
+
},
|
|
206
|
+
fontSize: {
|
|
207
|
+
type: "unit",
|
|
208
|
+
value: 100,
|
|
209
|
+
unit: "%"
|
|
210
|
+
},
|
|
211
|
+
lineHeight: {
|
|
212
|
+
type: "unit",
|
|
213
|
+
value: 1.15,
|
|
214
|
+
unit: "number"
|
|
215
|
+
},
|
|
216
|
+
/* 2 */
|
|
217
|
+
marginTop: {
|
|
218
|
+
type: "unit",
|
|
219
|
+
value: 0,
|
|
220
|
+
unit: "number"
|
|
221
|
+
},
|
|
222
|
+
marginRight: {
|
|
223
|
+
type: "unit",
|
|
224
|
+
value: 0,
|
|
225
|
+
unit: "number"
|
|
226
|
+
},
|
|
227
|
+
marginBottom: {
|
|
228
|
+
type: "unit",
|
|
229
|
+
value: 0,
|
|
230
|
+
unit: "number"
|
|
231
|
+
},
|
|
232
|
+
marginLeft: {
|
|
233
|
+
type: "unit",
|
|
234
|
+
value: 0,
|
|
235
|
+
unit: "number"
|
|
236
|
+
},
|
|
237
|
+
boxSizing,
|
|
238
|
+
...borders
|
|
239
|
+
};
|
|
240
|
+
const input = buttonBase;
|
|
241
|
+
const optgroup = buttonBase;
|
|
242
|
+
const textarea = buttonBase;
|
|
243
|
+
const button = {
|
|
244
|
+
...buttonBase,
|
|
245
|
+
textTransform: {
|
|
246
|
+
type: "keyword",
|
|
247
|
+
value: "none"
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
const select = button;
|
|
251
|
+
const legend = {
|
|
252
|
+
paddingTop: {
|
|
253
|
+
type: "unit",
|
|
254
|
+
value: 0,
|
|
255
|
+
unit: "number"
|
|
256
|
+
},
|
|
257
|
+
paddingRight: {
|
|
258
|
+
type: "unit",
|
|
259
|
+
value: 0,
|
|
260
|
+
unit: "number"
|
|
261
|
+
},
|
|
262
|
+
paddingBottom: {
|
|
263
|
+
type: "unit",
|
|
264
|
+
value: 0,
|
|
265
|
+
unit: "number"
|
|
266
|
+
},
|
|
267
|
+
paddingLeft: {
|
|
268
|
+
type: "unit",
|
|
269
|
+
value: 0,
|
|
270
|
+
unit: "number"
|
|
271
|
+
},
|
|
272
|
+
boxSizing,
|
|
273
|
+
...borders
|
|
274
|
+
};
|
|
275
|
+
const progress = {
|
|
276
|
+
verticalAlign: {
|
|
277
|
+
type: "keyword",
|
|
278
|
+
value: "baseline"
|
|
279
|
+
},
|
|
280
|
+
boxSizing,
|
|
281
|
+
...borders
|
|
282
|
+
};
|
|
283
|
+
const summary = {
|
|
284
|
+
display: {
|
|
285
|
+
type: "keyword",
|
|
286
|
+
value: "list-item"
|
|
287
|
+
},
|
|
288
|
+
boxSizing,
|
|
289
|
+
...borders
|
|
290
|
+
};
|
|
291
|
+
export {
|
|
292
|
+
a,
|
|
293
|
+
address,
|
|
294
|
+
article,
|
|
295
|
+
aside,
|
|
296
|
+
b,
|
|
297
|
+
body,
|
|
298
|
+
button,
|
|
299
|
+
code,
|
|
300
|
+
div,
|
|
301
|
+
figure,
|
|
302
|
+
footer,
|
|
303
|
+
form,
|
|
304
|
+
h1,
|
|
305
|
+
h2,
|
|
306
|
+
h3,
|
|
307
|
+
h4,
|
|
308
|
+
h5,
|
|
309
|
+
h6,
|
|
310
|
+
header,
|
|
311
|
+
hr,
|
|
312
|
+
html,
|
|
313
|
+
i,
|
|
314
|
+
img,
|
|
315
|
+
input,
|
|
316
|
+
kbd,
|
|
317
|
+
legend,
|
|
318
|
+
li,
|
|
319
|
+
main,
|
|
320
|
+
nav,
|
|
321
|
+
ol,
|
|
322
|
+
optgroup,
|
|
323
|
+
p,
|
|
324
|
+
pre,
|
|
325
|
+
progress,
|
|
326
|
+
samp,
|
|
327
|
+
section,
|
|
328
|
+
select,
|
|
329
|
+
small,
|
|
330
|
+
span,
|
|
331
|
+
strong,
|
|
332
|
+
sub,
|
|
333
|
+
summary,
|
|
334
|
+
sup,
|
|
335
|
+
table,
|
|
336
|
+
textarea,
|
|
337
|
+
ul
|
|
338
|
+
};
|