@webstudio-is/react-sdk 0.50.0 → 0.52.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/app/custom-components/image.js +2 -4
- package/lib/app/custom-components/shared/remix-link.js +7 -23
- package/lib/cjs/app/custom-components/{image.cjs → image.js} +1 -3
- package/lib/cjs/app/custom-components/shared/{remix-link.cjs → remix-link.js} +6 -22
- package/lib/cjs/components/__generated__/{link.props.cjs → link.props.js} +6 -6
- 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} +13 -9
- package/lib/cjs/components/{link.cjs → link.js} +15 -6
- package/lib/cjs/components/{link.ws.cjs → link.ws.js} +21 -10
- 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/{rich-text-link.ws.cjs → rich-text-link.ws.js} +5 -2
- 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/{context.cjs → context.js} +2 -1
- 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/{props.cjs → props.js} +43 -2
- package/lib/cjs/pubsub/{create.cjs → create.js} +6 -35
- package/lib/cjs/pubsub/raf-queue.js +45 -0
- package/lib/cjs/tree/{create-elements-tree.cjs → create-elements-tree.js} +8 -1
- package/lib/cjs/tree/{root.cjs → root.js} +1 -0
- package/lib/cjs/tree/{webstudio-component.cjs → webstudio-component.js} +1 -0
- package/lib/components/__generated__/link-block.props.js +5 -5
- package/lib/components/__generated__/link.props.js +6 -6
- package/lib/components/__generated__/rich-text-link.props.js +5 -5
- 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 +13 -9
- package/lib/components/link.js +15 -6
- package/lib/components/link.ws.js +22 -11
- 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/rich-text-link.ws.js +6 -3
- 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/context.js +2 -1
- 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/props.js +43 -2
- package/lib/pubsub/create.js +6 -25
- package/lib/pubsub/raf-queue.js +25 -0
- package/lib/tree/create-elements-tree.js +8 -1
- package/lib/tree/root.js +1 -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/app/custom-components/image.tsx +4 -7
- package/src/app/custom-components/shared/remix-link.tsx +12 -48
- package/src/components/__generated__/link-block.props.ts +5 -5
- package/src/components/__generated__/link.props.ts +6 -6
- package/src/components/__generated__/rich-text-link.props.ts +5 -5
- 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 +16 -10
- package/src/components/link.tsx +14 -6
- package/src/components/link.ws.tsx +25 -12
- 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/rich-text-link.ws.tsx +6 -3
- 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 +4 -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.test.ts +95 -0
- package/src/props.ts +59 -5
- package/src/pubsub/create.ts +7 -38
- package/src/pubsub/raf-queue.ts +31 -0
- package/src/tree/create-elements-tree.tsx +7 -2
- package/src/tree/root.ts +2 -0
- 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/{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/{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} +5 -5
- 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} +5 -5
- /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/{slot.cjs → slot.js} +0 -0
- /package/lib/cjs/components/{slot.ws.cjs → slot.ws.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/pubsub/{index.cjs → index.js} +0 -0
- /package/lib/cjs/tree/{index.cjs → index.js} +0 -0
- /package/lib/cjs/tree/{session-storage-polyfill.cjs → session-storage-polyfill.js} +0 -0
package/src/css/css.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createCssEngine } from "@webstudio-is/css-engine";
|
|
2
|
+
import type { Asset } from "@webstudio-is/asset-uploader";
|
|
3
|
+
import type { Build } from "@webstudio-is/project-build";
|
|
4
|
+
import { getComponentNames } from "../components/components-utils";
|
|
5
|
+
import { getComponentMeta } from "../components";
|
|
6
|
+
import { componentAttribute, idAttribute } from "../tree";
|
|
7
|
+
import { addGlobalRules } from "./global-rules";
|
|
8
|
+
import { getStyleRules } from "./style-rules";
|
|
9
|
+
|
|
10
|
+
type Data = {
|
|
11
|
+
assets: Asset[];
|
|
12
|
+
breakpoints?: Build["breakpoints"];
|
|
13
|
+
styles?: Build["styles"];
|
|
14
|
+
styleSourceSelections?: Build["styleSourceSelections"];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const generateCssText = (data: Data) => {
|
|
18
|
+
const assets = new Map<Asset["id"], Asset>(
|
|
19
|
+
data.assets.map((asset) => [asset.id, asset])
|
|
20
|
+
);
|
|
21
|
+
const breakpoints = new Map(data.breakpoints);
|
|
22
|
+
const styles = new Map(data.styles);
|
|
23
|
+
const styleSourceSelections = new Map(data.styleSourceSelections);
|
|
24
|
+
|
|
25
|
+
const engine = createCssEngine({ name: "ssr" });
|
|
26
|
+
|
|
27
|
+
addGlobalRules(engine, { assets });
|
|
28
|
+
|
|
29
|
+
for (const breakpoint of breakpoints.values()) {
|
|
30
|
+
engine.addMediaRule(breakpoint.id, breakpoint);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
for (const component of getComponentNames()) {
|
|
34
|
+
const meta = getComponentMeta(component);
|
|
35
|
+
const presetStyle = meta?.presetStyle;
|
|
36
|
+
if (presetStyle !== undefined) {
|
|
37
|
+
for (const [tag, style] of Object.entries(presetStyle)) {
|
|
38
|
+
engine.addStyleRule(
|
|
39
|
+
`${tag}:where([${componentAttribute}=${component}])`,
|
|
40
|
+
{
|
|
41
|
+
style,
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const styleRules = getStyleRules(styles, styleSourceSelections);
|
|
49
|
+
for (const { breakpointId, instanceId, style } of styleRules) {
|
|
50
|
+
engine.addStyleRule(`[${idAttribute}="${instanceId}"]`, {
|
|
51
|
+
breakpoint: breakpointId,
|
|
52
|
+
style,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return engine.cssText;
|
|
57
|
+
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { detectFont } from "detect-font";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type Style,
|
|
4
|
+
type StyleValue,
|
|
5
|
+
type Unit,
|
|
6
|
+
keywordValues,
|
|
7
|
+
} from "@webstudio-is/css-data";
|
|
3
8
|
import { properties, units } from "@webstudio-is/css-data";
|
|
4
9
|
|
|
5
10
|
const unitsList = Object.values(units).flat();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CssEngine } from "@webstudio-is/css-engine";
|
|
2
|
+
import type { Assets, FontAsset } from "@webstudio-is/asset-uploader";
|
|
3
|
+
import {
|
|
4
|
+
type FontFormat,
|
|
5
|
+
FONT_FORMATS,
|
|
6
|
+
getFontFaces,
|
|
7
|
+
} from "@webstudio-is/fonts";
|
|
8
|
+
|
|
9
|
+
export const addGlobalRules = (
|
|
10
|
+
engine: CssEngine,
|
|
11
|
+
{ assets }: { assets: Assets }
|
|
12
|
+
) => {
|
|
13
|
+
// @todo we need to figure out all global resets while keeping
|
|
14
|
+
// the engine aware of all of them.
|
|
15
|
+
// Ideally, the user is somehow aware and in control of the reset
|
|
16
|
+
engine.addPlaintextRule("html {margin: 0; height: 100%}");
|
|
17
|
+
|
|
18
|
+
const fontAssets: Array<FontAsset> = [];
|
|
19
|
+
for (const asset of assets.values()) {
|
|
20
|
+
if (asset && FONT_FORMATS.has(asset.format as FontFormat)) {
|
|
21
|
+
fontAssets.push(asset as FontAsset);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const fontFaces = getFontFaces(fontAssets);
|
|
26
|
+
for (const fontFace of fontFaces) {
|
|
27
|
+
engine.addFontFaceRule(fontFace);
|
|
28
|
+
}
|
|
29
|
+
};
|
package/src/css/index.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as normalize from "./normalize";
|
|
2
|
+
import type { htmlTags as HtmlTags } from "html-tags";
|
|
3
|
+
import type { Style } from "@webstudio-is/css-data";
|
|
4
|
+
|
|
5
|
+
// no way I found to check exports https://github.com/microsoft/TypeScript/issues/38511
|
|
6
|
+
// we can check here that all exports represents a valid html tag
|
|
7
|
+
const normalizeWithKeyof = { ...normalize };
|
|
8
|
+
|
|
9
|
+
type ExportedTags = keyof typeof normalizeWithKeyof;
|
|
10
|
+
|
|
11
|
+
type ValidTags = ExportedTags extends HtmlTags ? ExportedTags : false;
|
|
12
|
+
|
|
13
|
+
normalizeWithKeyof satisfies Record<ValidTags, Style>;
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on https://github.com/sindresorhus/modern-normalize
|
|
3
|
+
*
|
|
4
|
+
* Attributions
|
|
5
|
+
*
|
|
6
|
+
* The MIT License (MIT)
|
|
7
|
+
* Copyright (c) Nicolas Gallagher
|
|
8
|
+
* Copyright (c) Jonathan Neal
|
|
9
|
+
* Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
10
|
+
*
|
|
11
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Style } from "@webstudio-is/css-data";
|
|
19
|
+
|
|
20
|
+
// webstudio custom opinionated presets
|
|
21
|
+
import { borders } from "./presets";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
Use a better box model (opinionated).
|
|
25
|
+
*/
|
|
26
|
+
const boxSizing = {
|
|
27
|
+
type: "keyword",
|
|
28
|
+
value: "border-box",
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* We dont support rules like this now, implement boxSizing for each used element
|
|
33
|
+
* *,
|
|
34
|
+
* ::before,
|
|
35
|
+
* ::after {
|
|
36
|
+
* box-sizing: border-box;
|
|
37
|
+
}
|
|
38
|
+
*/
|
|
39
|
+
const baseStyle = {
|
|
40
|
+
boxSizing,
|
|
41
|
+
...borders,
|
|
42
|
+
} as const satisfies Style;
|
|
43
|
+
|
|
44
|
+
export const div = baseStyle;
|
|
45
|
+
export const address = baseStyle;
|
|
46
|
+
export const article = baseStyle;
|
|
47
|
+
export const aside = baseStyle;
|
|
48
|
+
export const figure = baseStyle;
|
|
49
|
+
export const footer = baseStyle;
|
|
50
|
+
export const header = baseStyle;
|
|
51
|
+
export const main = baseStyle;
|
|
52
|
+
export const nav = baseStyle;
|
|
53
|
+
export const section = baseStyle;
|
|
54
|
+
export const form = baseStyle;
|
|
55
|
+
|
|
56
|
+
export const h1 = baseStyle;
|
|
57
|
+
export const h2 = baseStyle;
|
|
58
|
+
export const h3 = baseStyle;
|
|
59
|
+
export const h4 = baseStyle;
|
|
60
|
+
export const h5 = baseStyle;
|
|
61
|
+
export const h6 = baseStyle;
|
|
62
|
+
|
|
63
|
+
export const i = baseStyle;
|
|
64
|
+
|
|
65
|
+
export const img = baseStyle;
|
|
66
|
+
|
|
67
|
+
export const a = baseStyle;
|
|
68
|
+
export const li = baseStyle;
|
|
69
|
+
export const ul = baseStyle;
|
|
70
|
+
export const ol = baseStyle;
|
|
71
|
+
|
|
72
|
+
export const p = baseStyle;
|
|
73
|
+
export const span = baseStyle;
|
|
74
|
+
|
|
75
|
+
// @todo for now not applied to html, as we don't have html element
|
|
76
|
+
/**
|
|
77
|
+
1. Correct the line height in all browsers.
|
|
78
|
+
2. Prevent adjustments of font size after orientation changes in iOS.
|
|
79
|
+
3. Use a more readable tab size (opinionated).
|
|
80
|
+
*/
|
|
81
|
+
export const html = {
|
|
82
|
+
/* 1 */
|
|
83
|
+
lineHeight: {
|
|
84
|
+
type: "unit",
|
|
85
|
+
value: 1.15,
|
|
86
|
+
unit: "number",
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
/* 2 */
|
|
90
|
+
textSizeAdjust: {
|
|
91
|
+
type: "unit",
|
|
92
|
+
value: 100,
|
|
93
|
+
unit: "%",
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
/* 3 */
|
|
97
|
+
tabSize: {
|
|
98
|
+
type: "unit",
|
|
99
|
+
value: 4,
|
|
100
|
+
unit: "number",
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
boxSizing,
|
|
104
|
+
...borders,
|
|
105
|
+
} as const satisfies Style;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
1. Remove the margin in all browsers.
|
|
109
|
+
2. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
|
|
110
|
+
*/
|
|
111
|
+
export const body = {
|
|
112
|
+
/* 1 */
|
|
113
|
+
marginTop: {
|
|
114
|
+
type: "unit",
|
|
115
|
+
value: 0,
|
|
116
|
+
unit: "number",
|
|
117
|
+
},
|
|
118
|
+
marginRight: {
|
|
119
|
+
type: "unit",
|
|
120
|
+
value: 0,
|
|
121
|
+
unit: "number",
|
|
122
|
+
},
|
|
123
|
+
marginBottom: {
|
|
124
|
+
type: "unit",
|
|
125
|
+
value: 0,
|
|
126
|
+
unit: "number",
|
|
127
|
+
},
|
|
128
|
+
marginLeft: {
|
|
129
|
+
type: "unit",
|
|
130
|
+
value: 0,
|
|
131
|
+
unit: "number",
|
|
132
|
+
},
|
|
133
|
+
/* 2 */
|
|
134
|
+
fontFamily: {
|
|
135
|
+
type: "keyword",
|
|
136
|
+
value: `system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'`,
|
|
137
|
+
},
|
|
138
|
+
boxSizing,
|
|
139
|
+
...borders,
|
|
140
|
+
} as const satisfies Style;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
1. Add the correct height in Firefox.
|
|
144
|
+
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
|
145
|
+
*/
|
|
146
|
+
export const hr = {
|
|
147
|
+
/* 1 */
|
|
148
|
+
height: {
|
|
149
|
+
type: "unit",
|
|
150
|
+
value: 0,
|
|
151
|
+
unit: "number",
|
|
152
|
+
},
|
|
153
|
+
/* 2 */
|
|
154
|
+
color: { type: "keyword", value: "inherit" },
|
|
155
|
+
boxSizing,
|
|
156
|
+
...borders,
|
|
157
|
+
} as const satisfies Style;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
Add the correct text decoration in Chrome, Edge, and Safari.
|
|
161
|
+
|
|
162
|
+
!!!Skipped as we don't support this logic!!!
|
|
163
|
+
|
|
164
|
+
abbr[title] {
|
|
165
|
+
text-decoration: underline dotted;
|
|
166
|
+
}
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
Add the correct font weight in Edge and Safari.
|
|
171
|
+
*/
|
|
172
|
+
export const b = {
|
|
173
|
+
fontWeight: {
|
|
174
|
+
type: "keyword",
|
|
175
|
+
value: "bolder",
|
|
176
|
+
},
|
|
177
|
+
boxSizing,
|
|
178
|
+
...borders,
|
|
179
|
+
} as const satisfies Style;
|
|
180
|
+
export const strong = b;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
|
|
184
|
+
2. Correct the odd 'em' font sizing in all browsers.
|
|
185
|
+
*/
|
|
186
|
+
export const code = {
|
|
187
|
+
/* 1 */
|
|
188
|
+
fontFamily: {
|
|
189
|
+
type: "keyword",
|
|
190
|
+
value: `ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace`,
|
|
191
|
+
},
|
|
192
|
+
/* 2 */
|
|
193
|
+
fontSize: {
|
|
194
|
+
type: "unit",
|
|
195
|
+
value: 1,
|
|
196
|
+
unit: "em",
|
|
197
|
+
},
|
|
198
|
+
boxSizing,
|
|
199
|
+
...borders,
|
|
200
|
+
} as const satisfies Style;
|
|
201
|
+
|
|
202
|
+
export const kbd = code;
|
|
203
|
+
export const samp = code;
|
|
204
|
+
export const pre = code;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
Add the correct font size in all browsers.
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
export const small = {
|
|
211
|
+
fontSize: {
|
|
212
|
+
type: "unit",
|
|
213
|
+
value: 80,
|
|
214
|
+
unit: "%",
|
|
215
|
+
},
|
|
216
|
+
boxSizing,
|
|
217
|
+
...borders,
|
|
218
|
+
} as const satisfies Style;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
const subSupBase = {
|
|
225
|
+
fontSize: {
|
|
226
|
+
type: "unit",
|
|
227
|
+
value: 75,
|
|
228
|
+
unit: "%",
|
|
229
|
+
},
|
|
230
|
+
lineHeight: {
|
|
231
|
+
type: "unit",
|
|
232
|
+
value: 0,
|
|
233
|
+
unit: "number",
|
|
234
|
+
},
|
|
235
|
+
position: {
|
|
236
|
+
type: "keyword",
|
|
237
|
+
value: "relative",
|
|
238
|
+
},
|
|
239
|
+
verticalAlign: {
|
|
240
|
+
type: "keyword",
|
|
241
|
+
value: "baseline",
|
|
242
|
+
},
|
|
243
|
+
boxSizing,
|
|
244
|
+
...borders,
|
|
245
|
+
} as const satisfies Style;
|
|
246
|
+
|
|
247
|
+
export const sub = {
|
|
248
|
+
...subSupBase,
|
|
249
|
+
bottom: {
|
|
250
|
+
type: "unit",
|
|
251
|
+
value: -0.25,
|
|
252
|
+
unit: "em",
|
|
253
|
+
},
|
|
254
|
+
} as const satisfies Style;
|
|
255
|
+
|
|
256
|
+
export const sup = {
|
|
257
|
+
...subSupBase,
|
|
258
|
+
top: {
|
|
259
|
+
type: "unit",
|
|
260
|
+
value: -0.5,
|
|
261
|
+
unit: "em",
|
|
262
|
+
},
|
|
263
|
+
} as const satisfies Style;
|
|
264
|
+
|
|
265
|
+
/*
|
|
266
|
+
Tabular data
|
|
267
|
+
============
|
|
268
|
+
*/
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
|
272
|
+
2. Correct table border color inheritance in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
export const table = {
|
|
276
|
+
/* 1 */
|
|
277
|
+
textIndent: {
|
|
278
|
+
type: "unit",
|
|
279
|
+
value: 0,
|
|
280
|
+
unit: "number",
|
|
281
|
+
},
|
|
282
|
+
...borders,
|
|
283
|
+
/* 2 */
|
|
284
|
+
borderTopColor: {
|
|
285
|
+
type: "keyword",
|
|
286
|
+
value: "inherit",
|
|
287
|
+
},
|
|
288
|
+
borderRightColor: {
|
|
289
|
+
type: "keyword",
|
|
290
|
+
value: "inherit",
|
|
291
|
+
},
|
|
292
|
+
borderBottomColor: {
|
|
293
|
+
type: "keyword",
|
|
294
|
+
value: "inherit",
|
|
295
|
+
},
|
|
296
|
+
borderLeftColor: {
|
|
297
|
+
type: "keyword",
|
|
298
|
+
value: "inherit",
|
|
299
|
+
},
|
|
300
|
+
boxSizing,
|
|
301
|
+
} as const satisfies Style;
|
|
302
|
+
|
|
303
|
+
/*
|
|
304
|
+
Forms
|
|
305
|
+
=====
|
|
306
|
+
*/
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
1. Change the font styles in all browsers.
|
|
310
|
+
2. Remove the margin in Firefox and Safari.
|
|
311
|
+
*/
|
|
312
|
+
|
|
313
|
+
const buttonBase = {
|
|
314
|
+
/* 1 */
|
|
315
|
+
fontFamily: {
|
|
316
|
+
type: "keyword",
|
|
317
|
+
value: "inherit",
|
|
318
|
+
},
|
|
319
|
+
fontSize: {
|
|
320
|
+
type: "unit",
|
|
321
|
+
value: 100,
|
|
322
|
+
unit: "%",
|
|
323
|
+
},
|
|
324
|
+
lineHeight: {
|
|
325
|
+
type: "unit",
|
|
326
|
+
value: 1.15,
|
|
327
|
+
unit: "number",
|
|
328
|
+
},
|
|
329
|
+
/* 2 */
|
|
330
|
+
marginTop: {
|
|
331
|
+
type: "unit",
|
|
332
|
+
value: 0,
|
|
333
|
+
unit: "number",
|
|
334
|
+
},
|
|
335
|
+
marginRight: {
|
|
336
|
+
type: "unit",
|
|
337
|
+
value: 0,
|
|
338
|
+
unit: "number",
|
|
339
|
+
},
|
|
340
|
+
marginBottom: {
|
|
341
|
+
type: "unit",
|
|
342
|
+
value: 0,
|
|
343
|
+
unit: "number",
|
|
344
|
+
},
|
|
345
|
+
marginLeft: {
|
|
346
|
+
type: "unit",
|
|
347
|
+
value: 0,
|
|
348
|
+
unit: "number",
|
|
349
|
+
},
|
|
350
|
+
boxSizing,
|
|
351
|
+
...borders,
|
|
352
|
+
} as const satisfies Style;
|
|
353
|
+
|
|
354
|
+
export const input = buttonBase;
|
|
355
|
+
export const optgroup = buttonBase;
|
|
356
|
+
export const textarea = buttonBase;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
Remove the inheritance of text transform in Edge and Firefox.
|
|
360
|
+
*/
|
|
361
|
+
export const button = {
|
|
362
|
+
...buttonBase,
|
|
363
|
+
textTransform: {
|
|
364
|
+
type: "keyword",
|
|
365
|
+
value: "none",
|
|
366
|
+
},
|
|
367
|
+
} as const satisfies Style;
|
|
368
|
+
|
|
369
|
+
export const select = button;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
Correct the inability to style clickable types in iOS and Safari.
|
|
373
|
+
|
|
374
|
+
!!!Skipped as we don't support this logic!!!
|
|
375
|
+
|
|
376
|
+
buttonBase,
|
|
377
|
+
[type='button'],
|
|
378
|
+
[type='reset'],
|
|
379
|
+
[type='submit'] {
|
|
380
|
+
-webkit-appearance: buttonBase;
|
|
381
|
+
}
|
|
382
|
+
*/
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
Remove the inner border and padding in Firefox.
|
|
386
|
+
|
|
387
|
+
!!!Skipped as we don't support this logic!!!
|
|
388
|
+
|
|
389
|
+
::-moz-focus-inner {
|
|
390
|
+
border-style: none;
|
|
391
|
+
padding: 0;
|
|
392
|
+
}
|
|
393
|
+
*/
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
Restore the focus styles unset by the previous rule.
|
|
397
|
+
|
|
398
|
+
!!!Skipped as we don't support this logic!!!
|
|
399
|
+
|
|
400
|
+
:-moz-focusring {
|
|
401
|
+
outline: 1px dotted ButtonText;
|
|
402
|
+
}
|
|
403
|
+
*/
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
Remove the additional ':invalid' styles in Firefox.
|
|
407
|
+
See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737
|
|
408
|
+
|
|
409
|
+
!!!Skipped as we don't support this logic!!!
|
|
410
|
+
|
|
411
|
+
:-moz-ui-invalid {
|
|
412
|
+
box-shadow: none;
|
|
413
|
+
}
|
|
414
|
+
*/
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers.
|
|
418
|
+
*/
|
|
419
|
+
|
|
420
|
+
export const legend = {
|
|
421
|
+
paddingTop: {
|
|
422
|
+
type: "unit",
|
|
423
|
+
value: 0,
|
|
424
|
+
unit: "number",
|
|
425
|
+
},
|
|
426
|
+
paddingRight: {
|
|
427
|
+
type: "unit",
|
|
428
|
+
value: 0,
|
|
429
|
+
unit: "number",
|
|
430
|
+
},
|
|
431
|
+
paddingBottom: {
|
|
432
|
+
type: "unit",
|
|
433
|
+
value: 0,
|
|
434
|
+
unit: "number",
|
|
435
|
+
},
|
|
436
|
+
paddingLeft: {
|
|
437
|
+
type: "unit",
|
|
438
|
+
value: 0,
|
|
439
|
+
unit: "number",
|
|
440
|
+
},
|
|
441
|
+
boxSizing,
|
|
442
|
+
...borders,
|
|
443
|
+
} as const satisfies Style;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
Add the correct vertical alignment in Chrome and Firefox.
|
|
447
|
+
*/
|
|
448
|
+
|
|
449
|
+
export const progress = {
|
|
450
|
+
verticalAlign: {
|
|
451
|
+
type: "keyword",
|
|
452
|
+
value: "baseline",
|
|
453
|
+
},
|
|
454
|
+
boxSizing,
|
|
455
|
+
...borders,
|
|
456
|
+
} as const satisfies Style;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
Correct the cursor style of increment and decrement buttons in Safari.
|
|
460
|
+
|
|
461
|
+
!!!Skipped as we don't support this logic!!!
|
|
462
|
+
|
|
463
|
+
::-webkit-inner-spin-buttonBase,
|
|
464
|
+
::-webkit-outer-spin-buttonBase {
|
|
465
|
+
height: auto;
|
|
466
|
+
}
|
|
467
|
+
*/
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
1. Correct the odd appearance in Chrome and Safari.
|
|
471
|
+
2. Correct the outline style in Safari.
|
|
472
|
+
|
|
473
|
+
!!!Skipped as we don't support this logic!!!
|
|
474
|
+
|
|
475
|
+
[type='search'] {
|
|
476
|
+
-webkit-appearance: textfield;
|
|
477
|
+
outline-offset: -2px;
|
|
478
|
+
}
|
|
479
|
+
*/
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
Remove the inner padding in Chrome and Safari on macOS.
|
|
483
|
+
|
|
484
|
+
!!!Skipped as we don't support this logic!!!
|
|
485
|
+
|
|
486
|
+
::-webkit-search-decoration {
|
|
487
|
+
-webkit-appearance: none;
|
|
488
|
+
}
|
|
489
|
+
*/
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
1. Correct the inability to style clickable types in iOS and Safari.
|
|
493
|
+
2. Change font properties to 'inherit' in Safari.
|
|
494
|
+
|
|
495
|
+
!!!Skipped as we don't support this logic!!!
|
|
496
|
+
|
|
497
|
+
::-webkit-file-upload-buttonBase {
|
|
498
|
+
-webkit-appearance: buttonBase;
|
|
499
|
+
font: inherit;
|
|
500
|
+
}
|
|
501
|
+
*/
|
|
502
|
+
|
|
503
|
+
/*
|
|
504
|
+
Interactive
|
|
505
|
+
===========
|
|
506
|
+
*/
|
|
507
|
+
|
|
508
|
+
/*
|
|
509
|
+
Add the correct display in Chrome and Safari.
|
|
510
|
+
*/
|
|
511
|
+
|
|
512
|
+
export const summary = {
|
|
513
|
+
display: {
|
|
514
|
+
type: "keyword",
|
|
515
|
+
value: "list-item",
|
|
516
|
+
},
|
|
517
|
+
boxSizing,
|
|
518
|
+
...borders,
|
|
519
|
+
} as const satisfies Style;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Style } from "@webstudio-is/css-data";
|
|
2
|
+
|
|
3
|
+
export const borders = {
|
|
4
|
+
borderTopColor: {
|
|
5
|
+
type: "keyword",
|
|
6
|
+
value: "currentColor",
|
|
7
|
+
},
|
|
8
|
+
borderRightColor: {
|
|
9
|
+
type: "keyword",
|
|
10
|
+
value: "currentColor",
|
|
11
|
+
},
|
|
12
|
+
borderBottomColor: {
|
|
13
|
+
type: "keyword",
|
|
14
|
+
value: "currentColor",
|
|
15
|
+
},
|
|
16
|
+
borderLeftColor: {
|
|
17
|
+
type: "keyword",
|
|
18
|
+
value: "currentColor",
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
borderTopWidth: {
|
|
22
|
+
type: "unit",
|
|
23
|
+
value: 1,
|
|
24
|
+
unit: "px",
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
borderRightWidth: {
|
|
28
|
+
type: "unit",
|
|
29
|
+
value: 1,
|
|
30
|
+
unit: "px",
|
|
31
|
+
},
|
|
32
|
+
borderBottomWidth: {
|
|
33
|
+
type: "unit",
|
|
34
|
+
value: 1,
|
|
35
|
+
unit: "px",
|
|
36
|
+
},
|
|
37
|
+
borderLeftWidth: {
|
|
38
|
+
type: "unit",
|
|
39
|
+
value: 1,
|
|
40
|
+
unit: "px",
|
|
41
|
+
},
|
|
42
|
+
} as const satisfies Style;
|