@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
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var normalize_exports = {};
|
|
20
|
+
__export(normalize_exports, {
|
|
21
|
+
a: () => a,
|
|
22
|
+
address: () => address,
|
|
23
|
+
article: () => article,
|
|
24
|
+
aside: () => aside,
|
|
25
|
+
b: () => b,
|
|
26
|
+
body: () => body,
|
|
27
|
+
button: () => button,
|
|
28
|
+
code: () => code,
|
|
29
|
+
div: () => div,
|
|
30
|
+
figure: () => figure,
|
|
31
|
+
footer: () => footer,
|
|
32
|
+
form: () => form,
|
|
33
|
+
h1: () => h1,
|
|
34
|
+
h2: () => h2,
|
|
35
|
+
h3: () => h3,
|
|
36
|
+
h4: () => h4,
|
|
37
|
+
h5: () => h5,
|
|
38
|
+
h6: () => h6,
|
|
39
|
+
header: () => header,
|
|
40
|
+
hr: () => hr,
|
|
41
|
+
html: () => html,
|
|
42
|
+
i: () => i,
|
|
43
|
+
img: () => img,
|
|
44
|
+
input: () => input,
|
|
45
|
+
kbd: () => kbd,
|
|
46
|
+
legend: () => legend,
|
|
47
|
+
li: () => li,
|
|
48
|
+
main: () => main,
|
|
49
|
+
nav: () => nav,
|
|
50
|
+
ol: () => ol,
|
|
51
|
+
optgroup: () => optgroup,
|
|
52
|
+
p: () => p,
|
|
53
|
+
pre: () => pre,
|
|
54
|
+
progress: () => progress,
|
|
55
|
+
samp: () => samp,
|
|
56
|
+
section: () => section,
|
|
57
|
+
select: () => select,
|
|
58
|
+
small: () => small,
|
|
59
|
+
span: () => span,
|
|
60
|
+
strong: () => strong,
|
|
61
|
+
sub: () => sub,
|
|
62
|
+
summary: () => summary,
|
|
63
|
+
sup: () => sup,
|
|
64
|
+
table: () => table,
|
|
65
|
+
textarea: () => textarea,
|
|
66
|
+
ul: () => ul
|
|
67
|
+
});
|
|
68
|
+
module.exports = __toCommonJS(normalize_exports);
|
|
69
|
+
var import_presets = require("./presets");
|
|
70
|
+
const boxSizing = {
|
|
71
|
+
type: "keyword",
|
|
72
|
+
value: "border-box"
|
|
73
|
+
};
|
|
74
|
+
const baseStyle = {
|
|
75
|
+
boxSizing,
|
|
76
|
+
...import_presets.borders
|
|
77
|
+
};
|
|
78
|
+
const div = baseStyle;
|
|
79
|
+
const address = baseStyle;
|
|
80
|
+
const article = baseStyle;
|
|
81
|
+
const aside = baseStyle;
|
|
82
|
+
const figure = baseStyle;
|
|
83
|
+
const footer = baseStyle;
|
|
84
|
+
const header = baseStyle;
|
|
85
|
+
const main = baseStyle;
|
|
86
|
+
const nav = baseStyle;
|
|
87
|
+
const section = baseStyle;
|
|
88
|
+
const form = baseStyle;
|
|
89
|
+
const h1 = baseStyle;
|
|
90
|
+
const h2 = baseStyle;
|
|
91
|
+
const h3 = baseStyle;
|
|
92
|
+
const h4 = baseStyle;
|
|
93
|
+
const h5 = baseStyle;
|
|
94
|
+
const h6 = baseStyle;
|
|
95
|
+
const i = baseStyle;
|
|
96
|
+
const img = baseStyle;
|
|
97
|
+
const a = baseStyle;
|
|
98
|
+
const li = baseStyle;
|
|
99
|
+
const ul = baseStyle;
|
|
100
|
+
const ol = baseStyle;
|
|
101
|
+
const p = baseStyle;
|
|
102
|
+
const span = baseStyle;
|
|
103
|
+
const html = {
|
|
104
|
+
/* 1 */
|
|
105
|
+
lineHeight: {
|
|
106
|
+
type: "unit",
|
|
107
|
+
value: 1.15,
|
|
108
|
+
unit: "number"
|
|
109
|
+
},
|
|
110
|
+
/* 2 */
|
|
111
|
+
textSizeAdjust: {
|
|
112
|
+
type: "unit",
|
|
113
|
+
value: 100,
|
|
114
|
+
unit: "%"
|
|
115
|
+
},
|
|
116
|
+
/* 3 */
|
|
117
|
+
tabSize: {
|
|
118
|
+
type: "unit",
|
|
119
|
+
value: 4,
|
|
120
|
+
unit: "number"
|
|
121
|
+
},
|
|
122
|
+
boxSizing,
|
|
123
|
+
...import_presets.borders
|
|
124
|
+
};
|
|
125
|
+
const body = {
|
|
126
|
+
/* 1 */
|
|
127
|
+
marginTop: {
|
|
128
|
+
type: "unit",
|
|
129
|
+
value: 0,
|
|
130
|
+
unit: "number"
|
|
131
|
+
},
|
|
132
|
+
marginRight: {
|
|
133
|
+
type: "unit",
|
|
134
|
+
value: 0,
|
|
135
|
+
unit: "number"
|
|
136
|
+
},
|
|
137
|
+
marginBottom: {
|
|
138
|
+
type: "unit",
|
|
139
|
+
value: 0,
|
|
140
|
+
unit: "number"
|
|
141
|
+
},
|
|
142
|
+
marginLeft: {
|
|
143
|
+
type: "unit",
|
|
144
|
+
value: 0,
|
|
145
|
+
unit: "number"
|
|
146
|
+
},
|
|
147
|
+
/* 2 */
|
|
148
|
+
fontFamily: {
|
|
149
|
+
type: "keyword",
|
|
150
|
+
value: `system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'`
|
|
151
|
+
},
|
|
152
|
+
boxSizing,
|
|
153
|
+
...import_presets.borders
|
|
154
|
+
};
|
|
155
|
+
const hr = {
|
|
156
|
+
/* 1 */
|
|
157
|
+
height: {
|
|
158
|
+
type: "unit",
|
|
159
|
+
value: 0,
|
|
160
|
+
unit: "number"
|
|
161
|
+
},
|
|
162
|
+
/* 2 */
|
|
163
|
+
color: { type: "keyword", value: "inherit" },
|
|
164
|
+
boxSizing,
|
|
165
|
+
...import_presets.borders
|
|
166
|
+
};
|
|
167
|
+
const b = {
|
|
168
|
+
fontWeight: {
|
|
169
|
+
type: "keyword",
|
|
170
|
+
value: "bolder"
|
|
171
|
+
},
|
|
172
|
+
boxSizing,
|
|
173
|
+
...import_presets.borders
|
|
174
|
+
};
|
|
175
|
+
const strong = b;
|
|
176
|
+
const code = {
|
|
177
|
+
/* 1 */
|
|
178
|
+
fontFamily: {
|
|
179
|
+
type: "keyword",
|
|
180
|
+
value: `ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace`
|
|
181
|
+
},
|
|
182
|
+
/* 2 */
|
|
183
|
+
fontSize: {
|
|
184
|
+
type: "unit",
|
|
185
|
+
value: 1,
|
|
186
|
+
unit: "em"
|
|
187
|
+
},
|
|
188
|
+
boxSizing,
|
|
189
|
+
...import_presets.borders
|
|
190
|
+
};
|
|
191
|
+
const kbd = code;
|
|
192
|
+
const samp = code;
|
|
193
|
+
const pre = code;
|
|
194
|
+
const small = {
|
|
195
|
+
fontSize: {
|
|
196
|
+
type: "unit",
|
|
197
|
+
value: 80,
|
|
198
|
+
unit: "%"
|
|
199
|
+
},
|
|
200
|
+
boxSizing,
|
|
201
|
+
...import_presets.borders
|
|
202
|
+
};
|
|
203
|
+
const subSupBase = {
|
|
204
|
+
fontSize: {
|
|
205
|
+
type: "unit",
|
|
206
|
+
value: 75,
|
|
207
|
+
unit: "%"
|
|
208
|
+
},
|
|
209
|
+
lineHeight: {
|
|
210
|
+
type: "unit",
|
|
211
|
+
value: 0,
|
|
212
|
+
unit: "number"
|
|
213
|
+
},
|
|
214
|
+
position: {
|
|
215
|
+
type: "keyword",
|
|
216
|
+
value: "relative"
|
|
217
|
+
},
|
|
218
|
+
verticalAlign: {
|
|
219
|
+
type: "keyword",
|
|
220
|
+
value: "baseline"
|
|
221
|
+
},
|
|
222
|
+
boxSizing,
|
|
223
|
+
...import_presets.borders
|
|
224
|
+
};
|
|
225
|
+
const sub = {
|
|
226
|
+
...subSupBase,
|
|
227
|
+
bottom: {
|
|
228
|
+
type: "unit",
|
|
229
|
+
value: -0.25,
|
|
230
|
+
unit: "em"
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
const sup = {
|
|
234
|
+
...subSupBase,
|
|
235
|
+
top: {
|
|
236
|
+
type: "unit",
|
|
237
|
+
value: -0.5,
|
|
238
|
+
unit: "em"
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
const table = {
|
|
242
|
+
/* 1 */
|
|
243
|
+
textIndent: {
|
|
244
|
+
type: "unit",
|
|
245
|
+
value: 0,
|
|
246
|
+
unit: "number"
|
|
247
|
+
},
|
|
248
|
+
...import_presets.borders,
|
|
249
|
+
/* 2 */
|
|
250
|
+
borderTopColor: {
|
|
251
|
+
type: "keyword",
|
|
252
|
+
value: "inherit"
|
|
253
|
+
},
|
|
254
|
+
borderRightColor: {
|
|
255
|
+
type: "keyword",
|
|
256
|
+
value: "inherit"
|
|
257
|
+
},
|
|
258
|
+
borderBottomColor: {
|
|
259
|
+
type: "keyword",
|
|
260
|
+
value: "inherit"
|
|
261
|
+
},
|
|
262
|
+
borderLeftColor: {
|
|
263
|
+
type: "keyword",
|
|
264
|
+
value: "inherit"
|
|
265
|
+
},
|
|
266
|
+
boxSizing
|
|
267
|
+
};
|
|
268
|
+
const buttonBase = {
|
|
269
|
+
/* 1 */
|
|
270
|
+
fontFamily: {
|
|
271
|
+
type: "keyword",
|
|
272
|
+
value: "inherit"
|
|
273
|
+
},
|
|
274
|
+
fontSize: {
|
|
275
|
+
type: "unit",
|
|
276
|
+
value: 100,
|
|
277
|
+
unit: "%"
|
|
278
|
+
},
|
|
279
|
+
lineHeight: {
|
|
280
|
+
type: "unit",
|
|
281
|
+
value: 1.15,
|
|
282
|
+
unit: "number"
|
|
283
|
+
},
|
|
284
|
+
/* 2 */
|
|
285
|
+
marginTop: {
|
|
286
|
+
type: "unit",
|
|
287
|
+
value: 0,
|
|
288
|
+
unit: "number"
|
|
289
|
+
},
|
|
290
|
+
marginRight: {
|
|
291
|
+
type: "unit",
|
|
292
|
+
value: 0,
|
|
293
|
+
unit: "number"
|
|
294
|
+
},
|
|
295
|
+
marginBottom: {
|
|
296
|
+
type: "unit",
|
|
297
|
+
value: 0,
|
|
298
|
+
unit: "number"
|
|
299
|
+
},
|
|
300
|
+
marginLeft: {
|
|
301
|
+
type: "unit",
|
|
302
|
+
value: 0,
|
|
303
|
+
unit: "number"
|
|
304
|
+
},
|
|
305
|
+
boxSizing,
|
|
306
|
+
...import_presets.borders
|
|
307
|
+
};
|
|
308
|
+
const input = buttonBase;
|
|
309
|
+
const optgroup = buttonBase;
|
|
310
|
+
const textarea = buttonBase;
|
|
311
|
+
const button = {
|
|
312
|
+
...buttonBase,
|
|
313
|
+
textTransform: {
|
|
314
|
+
type: "keyword",
|
|
315
|
+
value: "none"
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
const select = button;
|
|
319
|
+
const legend = {
|
|
320
|
+
paddingTop: {
|
|
321
|
+
type: "unit",
|
|
322
|
+
value: 0,
|
|
323
|
+
unit: "number"
|
|
324
|
+
},
|
|
325
|
+
paddingRight: {
|
|
326
|
+
type: "unit",
|
|
327
|
+
value: 0,
|
|
328
|
+
unit: "number"
|
|
329
|
+
},
|
|
330
|
+
paddingBottom: {
|
|
331
|
+
type: "unit",
|
|
332
|
+
value: 0,
|
|
333
|
+
unit: "number"
|
|
334
|
+
},
|
|
335
|
+
paddingLeft: {
|
|
336
|
+
type: "unit",
|
|
337
|
+
value: 0,
|
|
338
|
+
unit: "number"
|
|
339
|
+
},
|
|
340
|
+
boxSizing,
|
|
341
|
+
...import_presets.borders
|
|
342
|
+
};
|
|
343
|
+
const progress = {
|
|
344
|
+
verticalAlign: {
|
|
345
|
+
type: "keyword",
|
|
346
|
+
value: "baseline"
|
|
347
|
+
},
|
|
348
|
+
boxSizing,
|
|
349
|
+
...import_presets.borders
|
|
350
|
+
};
|
|
351
|
+
const summary = {
|
|
352
|
+
display: {
|
|
353
|
+
type: "keyword",
|
|
354
|
+
value: "list-item"
|
|
355
|
+
},
|
|
356
|
+
boxSizing,
|
|
357
|
+
...import_presets.borders
|
|
358
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var presets_exports = {};
|
|
20
|
+
__export(presets_exports, {
|
|
21
|
+
borders: () => borders
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(presets_exports);
|
|
24
|
+
const borders = {
|
|
25
|
+
borderTopColor: {
|
|
26
|
+
type: "keyword",
|
|
27
|
+
value: "currentColor"
|
|
28
|
+
},
|
|
29
|
+
borderRightColor: {
|
|
30
|
+
type: "keyword",
|
|
31
|
+
value: "currentColor"
|
|
32
|
+
},
|
|
33
|
+
borderBottomColor: {
|
|
34
|
+
type: "keyword",
|
|
35
|
+
value: "currentColor"
|
|
36
|
+
},
|
|
37
|
+
borderLeftColor: {
|
|
38
|
+
type: "keyword",
|
|
39
|
+
value: "currentColor"
|
|
40
|
+
},
|
|
41
|
+
borderTopWidth: {
|
|
42
|
+
type: "unit",
|
|
43
|
+
value: 1,
|
|
44
|
+
unit: "px"
|
|
45
|
+
},
|
|
46
|
+
borderRightWidth: {
|
|
47
|
+
type: "unit",
|
|
48
|
+
value: 1,
|
|
49
|
+
unit: "px"
|
|
50
|
+
},
|
|
51
|
+
borderBottomWidth: {
|
|
52
|
+
type: "unit",
|
|
53
|
+
value: 1,
|
|
54
|
+
unit: "px"
|
|
55
|
+
},
|
|
56
|
+
borderLeftWidth: {
|
|
57
|
+
type: "unit",
|
|
58
|
+
value: 1,
|
|
59
|
+
unit: "px"
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var style_rules_exports = {};
|
|
20
|
+
__export(style_rules_exports, {
|
|
21
|
+
getStyleRules: () => getStyleRules
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(style_rules_exports);
|
|
24
|
+
const getStyleRules = (styles, styleSourceSelections) => {
|
|
25
|
+
if (styles === void 0 || styleSourceSelections === void 0) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
const stylesByStyleSourceId = /* @__PURE__ */ new Map();
|
|
29
|
+
for (const styleDecl of styles.values()) {
|
|
30
|
+
const { styleSourceId } = styleDecl;
|
|
31
|
+
let styleSourceStyles = stylesByStyleSourceId.get(styleSourceId);
|
|
32
|
+
if (styleSourceStyles === void 0) {
|
|
33
|
+
styleSourceStyles = [];
|
|
34
|
+
stylesByStyleSourceId.set(styleSourceId, styleSourceStyles);
|
|
35
|
+
}
|
|
36
|
+
styleSourceStyles.push(styleDecl);
|
|
37
|
+
}
|
|
38
|
+
const styleRules = [];
|
|
39
|
+
for (const { instanceId, values } of styleSourceSelections.values()) {
|
|
40
|
+
const styleRuleByBreakpointId = /* @__PURE__ */ new Map();
|
|
41
|
+
for (const styleSourceId of values) {
|
|
42
|
+
const styleSourceStyles = stylesByStyleSourceId.get(styleSourceId);
|
|
43
|
+
if (styleSourceStyles === void 0) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
for (const { breakpointId, property, value } of styleSourceStyles) {
|
|
47
|
+
let styleRule = styleRuleByBreakpointId.get(breakpointId);
|
|
48
|
+
if (styleRule === void 0) {
|
|
49
|
+
styleRule = {
|
|
50
|
+
instanceId,
|
|
51
|
+
breakpointId,
|
|
52
|
+
style: {}
|
|
53
|
+
};
|
|
54
|
+
styleRuleByBreakpointId.set(breakpointId, styleRule);
|
|
55
|
+
}
|
|
56
|
+
styleRule.style[property] = value;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
styleRules.push(...styleRuleByBreakpointId.values());
|
|
60
|
+
}
|
|
61
|
+
return styleRules;
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -18,15 +18,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var props_exports = {};
|
|
20
20
|
__export(props_exports, {
|
|
21
|
+
getInstanceIdFromComponentProps: () => getInstanceIdFromComponentProps,
|
|
21
22
|
getPropsByInstanceId: () => getPropsByInstanceId,
|
|
23
|
+
resolveUrlProp: () => resolveUrlProp,
|
|
22
24
|
useInstanceProps: () => useInstanceProps,
|
|
23
|
-
usePropAsset: () => usePropAsset
|
|
25
|
+
usePropAsset: () => usePropAsset,
|
|
26
|
+
usePropUrl: () => usePropUrl
|
|
24
27
|
});
|
|
25
28
|
module.exports = __toCommonJS(props_exports);
|
|
26
29
|
var import_react = require("react");
|
|
27
30
|
var import_nanostores = require("nanostores");
|
|
28
31
|
var import_react2 = require("@nanostores/react");
|
|
29
32
|
var import_context = require("./context");
|
|
33
|
+
var import_webstudio_component = require("./tree/webstudio-component");
|
|
30
34
|
const getPropsByInstanceId = (props) => {
|
|
31
35
|
const propsByInstanceId = /* @__PURE__ */ new Map();
|
|
32
36
|
for (const prop of props.values()) {
|
|
@@ -61,7 +65,7 @@ const usePropAsset = (instanceId, name) => {
|
|
|
61
65
|
(propsByInstanceId, assets) => {
|
|
62
66
|
const instanceProps = propsByInstanceId.get(instanceId);
|
|
63
67
|
if (instanceProps === void 0) {
|
|
64
|
-
return
|
|
68
|
+
return;
|
|
65
69
|
}
|
|
66
70
|
for (const prop of instanceProps) {
|
|
67
71
|
if (prop.type === "asset" && prop.name === name) {
|
|
@@ -75,3 +79,40 @@ const usePropAsset = (instanceId, name) => {
|
|
|
75
79
|
const asset = (0, import_react2.useStore)(assetStore);
|
|
76
80
|
return asset;
|
|
77
81
|
};
|
|
82
|
+
const resolveUrlProp = (instanceId, name, propsByInstanceId, pages) => {
|
|
83
|
+
const instanceProps = propsByInstanceId.get(instanceId);
|
|
84
|
+
if (instanceProps === void 0) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
for (const prop of instanceProps) {
|
|
88
|
+
if (prop.name !== name) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (prop.type === "page") {
|
|
92
|
+
return pages.get(prop.value);
|
|
93
|
+
}
|
|
94
|
+
if (prop.type === "string") {
|
|
95
|
+
for (const page of pages.values()) {
|
|
96
|
+
if (page.path === prop.value) {
|
|
97
|
+
return page;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return prop.value;
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const usePropUrl = (instanceId, name) => {
|
|
106
|
+
const { propsByInstanceIdStore, pagesStore } = (0, import_react.useContext)(import_context.ReactSdkContext);
|
|
107
|
+
const pageStore = (0, import_react.useMemo)(
|
|
108
|
+
() => (0, import_nanostores.computed)(
|
|
109
|
+
[propsByInstanceIdStore, pagesStore],
|
|
110
|
+
(propsByInstanceId, pages) => resolveUrlProp(instanceId, name, propsByInstanceId, pages)
|
|
111
|
+
),
|
|
112
|
+
[propsByInstanceIdStore, pagesStore, instanceId, name]
|
|
113
|
+
);
|
|
114
|
+
return (0, import_react2.useStore)(pageStore);
|
|
115
|
+
};
|
|
116
|
+
const getInstanceIdFromComponentProps = (props) => {
|
|
117
|
+
return props[import_webstudio_component.idAttribute];
|
|
118
|
+
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,30 +15,23 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var create_exports = {};
|
|
30
20
|
__export(create_exports, {
|
|
31
21
|
createPubsub: () => createPubsub
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(create_exports);
|
|
34
|
-
var
|
|
24
|
+
var import_nanoevents = require("nanoevents");
|
|
35
25
|
var import_react = require("react");
|
|
26
|
+
var import_raf_queue = require("./raf-queue");
|
|
36
27
|
const createPubsub = () => {
|
|
37
|
-
const emitter = (0,
|
|
28
|
+
const emitter = (0, import_nanoevents.createNanoEvents)();
|
|
38
29
|
if (typeof window === "object") {
|
|
39
30
|
window.addEventListener(
|
|
40
31
|
"message",
|
|
41
32
|
(event) => {
|
|
42
33
|
if (typeof event.data?.type === "string") {
|
|
43
|
-
emitter.emit(event.data.type, event.data.payload);
|
|
34
|
+
(0, import_raf_queue.batchUpdate)(() => emitter.emit(event.data.type, event.data.payload));
|
|
44
35
|
}
|
|
45
36
|
},
|
|
46
37
|
false
|
|
@@ -77,31 +68,11 @@ const createPubsub = () => {
|
|
|
77
68
|
*/
|
|
78
69
|
useSubscribe(type, onAction) {
|
|
79
70
|
(0, import_react.useEffect)(() => {
|
|
80
|
-
emitter.on(type, onAction);
|
|
81
|
-
return () => {
|
|
82
|
-
emitter.off(type, onAction);
|
|
83
|
-
};
|
|
71
|
+
return emitter.on(type, onAction);
|
|
84
72
|
}, [type, onAction]);
|
|
85
73
|
},
|
|
86
|
-
useSubscribeAll(onAction) {
|
|
87
|
-
(0, import_react.useEffect)(() => {
|
|
88
|
-
emitter.on("*", onAction);
|
|
89
|
-
return () => {
|
|
90
|
-
emitter.off("*", onAction);
|
|
91
|
-
};
|
|
92
|
-
}, [onAction]);
|
|
93
|
-
},
|
|
94
74
|
subscribe(type, onAction) {
|
|
95
|
-
emitter.on(type, onAction);
|
|
96
|
-
return () => {
|
|
97
|
-
emitter.off(type, onAction);
|
|
98
|
-
};
|
|
99
|
-
},
|
|
100
|
-
subscribeAll(onAction) {
|
|
101
|
-
emitter.on("*", onAction);
|
|
102
|
-
return () => {
|
|
103
|
-
emitter.off("*", onAction);
|
|
104
|
-
};
|
|
75
|
+
return emitter.on(type, onAction);
|
|
105
76
|
}
|
|
106
77
|
};
|
|
107
78
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var raf_queue_exports = {};
|
|
20
|
+
__export(raf_queue_exports, {
|
|
21
|
+
batchUpdate: () => batchUpdate
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(raf_queue_exports);
|
|
24
|
+
var import_react_dom = require("react-dom");
|
|
25
|
+
let handle;
|
|
26
|
+
let updateQueue = [];
|
|
27
|
+
const processUpdates = (updates) => {
|
|
28
|
+
(0, import_react_dom.unstable_batchedUpdates)(() => {
|
|
29
|
+
for (const update of updates) {
|
|
30
|
+
update();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const batchUpdate = (update) => {
|
|
35
|
+
updateQueue.push(update);
|
|
36
|
+
if (handle !== void 0) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
handle = requestAnimationFrame(() => {
|
|
40
|
+
const updates = updateQueue;
|
|
41
|
+
updateQueue = [];
|
|
42
|
+
handle = void 0;
|
|
43
|
+
processUpdates(updates);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
@@ -31,6 +31,7 @@ const createElementsTree = ({
|
|
|
31
31
|
instance,
|
|
32
32
|
propsByInstanceIdStore,
|
|
33
33
|
assetsStore,
|
|
34
|
+
pagesStore,
|
|
34
35
|
Component,
|
|
35
36
|
getComponent
|
|
36
37
|
}) => {
|
|
@@ -55,7 +56,13 @@ const createElementsTree = ({
|
|
|
55
56
|
],
|
|
56
57
|
getComponent
|
|
57
58
|
});
|
|
58
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
import_context.ReactSdkContext.Provider,
|
|
61
|
+
{
|
|
62
|
+
value: { propsByInstanceIdStore, assetsStore, pagesStore },
|
|
63
|
+
children: root
|
|
64
|
+
}
|
|
65
|
+
);
|
|
59
66
|
};
|
|
60
67
|
const createInstanceChildrenElements = ({
|
|
61
68
|
instanceSelector,
|
|
@@ -75,6 +75,7 @@ const InstanceRoot = ({
|
|
|
75
75
|
(0, import_props.getPropsByInstanceId)(new Map(data.build.props))
|
|
76
76
|
),
|
|
77
77
|
assetsStore: (0, import_nanostores.atom)(new Map(data.assets.map((asset) => [asset.id, asset]))),
|
|
78
|
+
pagesStore: (0, import_nanostores.atom)(new Map(data.pages.map((page) => [page.id, page]))),
|
|
78
79
|
Component: Component ?? import_webstudio_component.WebstudioComponent,
|
|
79
80
|
getComponent
|
|
80
81
|
});
|