@makeswift/runtime 0.28.8-canary.12 → 0.28.8-canary.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/graphql-api-client.js +1 -1
- package/dist/cjs/api/rest-api-client.js +1 -1
- package/dist/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/builder/host-to-builder-actions.js +5 -5
- package/dist/cjs/builder/host-to-builder-actions.js.map +1 -1
- package/dist/cjs/client/index.js +1 -1
- package/dist/cjs/components/builtin/Form/Form.js.map +1 -1
- package/dist/cjs/controls/rich-text/control.js +9 -3
- package/dist/cjs/controls/rich-text/control.js.map +1 -1
- package/dist/cjs/controls/rich-text-v2/control.js +6 -0
- package/dist/cjs/controls/rich-text-v2/control.js.map +1 -1
- package/dist/cjs/next/testing/breakpoints.js +3 -15
- package/dist/cjs/next/testing/breakpoints.js.map +1 -1
- package/dist/cjs/next/testing/element-data.js +3 -82
- package/dist/cjs/next/testing/element-data.js.map +1 -1
- package/dist/cjs/next/testing/react-runtime.js.map +1 -1
- package/dist/cjs/prop-controllers/instances.js +6 -0
- package/dist/cjs/prop-controllers/instances.js.map +1 -1
- package/dist/cjs/runtimes/react/components/Element.js +21 -6
- package/dist/cjs/runtimes/react/components/Element.js.map +1 -1
- package/dist/cjs/runtimes/react/components/ElementRegistration.js +5 -3
- package/dist/cjs/runtimes/react/components/ElementRegistration.js.map +1 -1
- package/dist/cjs/runtimes/react/components/resolve-props.js +5 -1
- package/dist/cjs/runtimes/react/components/resolve-props.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js +2 -2
- package/dist/cjs/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
- package/dist/cjs/runtimes/react/element-imperative-handle.js +2 -2
- package/dist/cjs/runtimes/react/element-imperative-handle.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-control-instances.js +4 -3
- package/dist/cjs/runtimes/react/hooks/use-control-instances.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js +10 -9
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js.map +1 -1
- package/dist/cjs/runtimes/react/testing/index.js +25 -0
- package/dist/cjs/runtimes/react/testing/index.js.map +1 -0
- package/dist/cjs/runtimes/react/testing/react-provider.js +38 -0
- package/dist/cjs/runtimes/react/testing/react-provider.js.map +1 -0
- package/dist/cjs/state/actions/index.js +4 -4
- package/dist/cjs/state/actions/index.js.map +1 -1
- package/dist/cjs/state/actions/internal/action-types.js +34 -0
- package/dist/cjs/state/actions/internal/action-types.js.map +1 -0
- package/dist/cjs/state/actions/internal/index.js +0 -17
- package/dist/cjs/state/actions/internal/index.js.map +1 -1
- package/dist/cjs/state/actions/internal/read-only-action-types.js +44 -0
- package/dist/cjs/state/actions/internal/read-only-action-types.js.map +1 -0
- package/dist/cjs/state/actions/internal/read-only-actions.js +13 -92
- package/dist/cjs/state/actions/internal/read-only-actions.js.map +1 -1
- package/dist/cjs/state/actions/internal/read-write-action-types.js +41 -0
- package/dist/cjs/state/actions/internal/read-write-action-types.js.map +1 -0
- package/dist/cjs/state/actions/internal/read-write-actions.js +62 -14
- package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -1
- package/dist/cjs/state/builder-api/action-types.js +49 -0
- package/dist/cjs/state/builder-api/action-types.js.map +1 -0
- package/dist/cjs/state/builder-api/actions.js +14 -36
- package/dist/cjs/state/builder-api/actions.js.map +1 -1
- package/dist/cjs/state/builder-api/proxy.js +2 -1
- package/dist/cjs/state/builder-api/proxy.js.map +1 -1
- package/dist/cjs/state/host-api/action-types.js +43 -0
- package/dist/cjs/state/host-api/action-types.js.map +1 -0
- package/dist/cjs/state/{host-api.js → host-api/actions.js} +17 -33
- package/dist/cjs/state/host-api/actions.js.map +1 -0
- package/dist/cjs/state/host-api/index.js +25 -0
- package/dist/cjs/state/host-api/index.js.map +1 -0
- package/dist/cjs/state/middleware/read-write/builder-api/index.js +15 -15
- package/dist/cjs/state/middleware/read-write/builder-api/index.js.map +1 -1
- package/dist/cjs/state/middleware/read-write/measure-box-models.js +3 -3
- package/dist/cjs/state/middleware/read-write/measure-box-models.js.map +1 -1
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js +12 -13
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js.map +1 -1
- package/dist/cjs/state/modules/api-resources.js +5 -5
- package/dist/cjs/state/modules/api-resources.js.map +1 -1
- package/dist/cjs/state/modules/breakpoints.js +4 -4
- package/dist/cjs/state/modules/breakpoints.js.map +1 -1
- package/dist/cjs/state/modules/components-meta.js +3 -3
- package/dist/cjs/state/modules/components-meta.js.map +1 -1
- package/dist/cjs/state/modules/element-trees.js +5 -5
- package/dist/cjs/state/modules/element-trees.js.map +1 -1
- package/dist/cjs/state/modules/is-in-builder.js +2 -2
- package/dist/cjs/state/modules/is-in-builder.js.map +1 -1
- package/dist/cjs/state/modules/is-read-only.js +2 -2
- package/dist/cjs/state/modules/is-read-only.js.map +1 -1
- package/dist/cjs/state/modules/locale.js +2 -2
- package/dist/cjs/state/modules/locale.js.map +1 -1
- package/dist/cjs/state/modules/localized-resources-map.js +3 -3
- package/dist/cjs/state/modules/localized-resources-map.js.map +1 -1
- package/dist/cjs/state/modules/{prop-controllers.js → prop-controller-descriptors.js} +7 -7
- package/dist/cjs/state/modules/prop-controller-descriptors.js.map +1 -0
- package/dist/cjs/state/modules/react-components.js +3 -3
- package/dist/cjs/state/modules/react-components.js.map +1 -1
- package/dist/cjs/state/modules/read-write/box-models.js +5 -5
- package/dist/cjs/state/modules/read-write/box-models.js.map +1 -1
- package/dist/cjs/state/modules/read-write/element-imperative-handles.js +3 -3
- package/dist/cjs/state/modules/read-write/element-imperative-handles.js.map +1 -1
- package/dist/cjs/state/modules/{prop-controller-handles.js → read-write/prop-controllers.js} +5 -5
- package/dist/cjs/state/modules/read-write/prop-controllers.js.map +1 -0
- package/dist/cjs/state/read-only-state.js +9 -44
- package/dist/cjs/state/read-only-state.js.map +1 -1
- package/dist/cjs/state/read-write-state.js +37 -0
- package/dist/cjs/state/read-write-state.js.map +1 -1
- package/dist/cjs/state/shared-api/action-types.js +33 -0
- package/dist/cjs/state/shared-api/action-types.js.map +1 -0
- package/dist/cjs/state/{shared-api.js → shared-api/actions.js} +8 -14
- package/dist/cjs/state/shared-api/actions.js.map +1 -0
- package/dist/cjs/state/shared-api/index.js +25 -0
- package/dist/cjs/state/shared-api/index.js.map +1 -0
- package/dist/cjs/state/store.js +3 -3
- package/dist/cjs/state/store.js.map +1 -1
- package/dist/cjs/state/translations/get.js.map +1 -1
- package/dist/cjs/state/translations/merge.js.map +1 -1
- package/dist/cjs/state/unified-state.js +12 -0
- package/dist/cjs/state/unified-state.js.map +1 -1
- package/dist/cjs/testing/breakpoints.js +35 -0
- package/dist/cjs/testing/breakpoints.js.map +1 -0
- package/dist/cjs/testing/element-data.js +102 -0
- package/dist/cjs/testing/element-data.js.map +1 -0
- package/dist/cjs/translations/index.js.map +1 -1
- package/dist/esm/api/graphql-api-client.js +1 -1
- package/dist/esm/api/rest-api-client.js +1 -1
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/builder/host-to-builder-actions.js +2 -4
- package/dist/esm/builder/host-to-builder-actions.js.map +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/components/builtin/Form/Form.js.map +1 -1
- package/dist/esm/controls/rich-text/control.js +9 -3
- package/dist/esm/controls/rich-text/control.js.map +1 -1
- package/dist/esm/controls/rich-text-v2/control.js +6 -0
- package/dist/esm/controls/rich-text-v2/control.js.map +1 -1
- package/dist/esm/next/testing/breakpoints.js +1 -8
- package/dist/esm/next/testing/breakpoints.js.map +1 -1
- package/dist/esm/next/testing/element-data.js +1 -75
- package/dist/esm/next/testing/element-data.js.map +1 -1
- package/dist/esm/next/testing/react-runtime.js.map +1 -1
- package/dist/esm/prop-controllers/instances.js +6 -0
- package/dist/esm/prop-controllers/instances.js.map +1 -1
- package/dist/esm/runtimes/react/components/Element.js +18 -6
- package/dist/esm/runtimes/react/components/Element.js.map +1 -1
- package/dist/esm/runtimes/react/components/ElementRegistration.js +4 -2
- package/dist/esm/runtimes/react/components/ElementRegistration.js.map +1 -1
- package/dist/esm/runtimes/react/components/resolve-props.js +5 -1
- package/dist/esm/runtimes/react/components/resolve-props.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/EditableText/editable-text.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/rich-text.js +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/rich-text.js.map +1 -1
- package/dist/esm/runtimes/react/element-imperative-handle.js +1 -1
- package/dist/esm/runtimes/react/element-imperative-handle.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-control-instances.js +3 -2
- package/dist/esm/runtimes/react/hooks/use-control-instances.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js +10 -9
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js.map +1 -1
- package/dist/esm/runtimes/react/testing/index.js +3 -0
- package/dist/esm/runtimes/react/testing/index.js.map +1 -0
- package/dist/esm/runtimes/react/testing/react-provider.js +14 -0
- package/dist/esm/runtimes/react/testing/react-provider.js.map +1 -0
- package/dist/esm/state/actions/index.js +2 -2
- package/dist/esm/state/actions/index.js.map +1 -1
- package/dist/esm/state/actions/internal/action-types.js +10 -0
- package/dist/esm/state/actions/internal/action-types.js.map +1 -0
- package/dist/esm/state/actions/internal/index.js +0 -9
- package/dist/esm/state/actions/internal/index.js.map +1 -1
- package/dist/esm/state/actions/internal/read-only-action-types.js +20 -0
- package/dist/esm/state/actions/internal/read-only-action-types.js.map +1 -0
- package/dist/esm/state/actions/internal/read-only-actions.js +1 -73
- package/dist/esm/state/actions/internal/read-only-actions.js.map +1 -1
- package/dist/esm/state/actions/internal/read-write-action-types.js +17 -0
- package/dist/esm/state/actions/internal/read-write-action-types.js.map +1 -0
- package/dist/esm/state/actions/internal/read-write-actions.js +51 -8
- package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -1
- package/dist/esm/state/builder-api/action-types.js +25 -0
- package/dist/esm/state/builder-api/action-types.js.map +1 -0
- package/dist/esm/state/builder-api/actions.js +1 -24
- package/dist/esm/state/builder-api/actions.js.map +1 -1
- package/dist/esm/state/builder-api/proxy.js +2 -1
- package/dist/esm/state/builder-api/proxy.js.map +1 -1
- package/dist/esm/state/host-api/action-types.js +19 -0
- package/dist/esm/state/host-api/action-types.js.map +1 -0
- package/dist/esm/state/{host-api.js → host-api/actions.js} +2 -17
- package/dist/esm/state/host-api/actions.js.map +1 -0
- package/dist/esm/state/host-api/index.js +3 -0
- package/dist/esm/state/host-api/index.js.map +1 -0
- package/dist/esm/state/middleware/read-write/builder-api/index.js +1 -1
- package/dist/esm/state/middleware/read-write/builder-api/index.js.map +1 -1
- package/dist/esm/state/middleware/read-write/measure-box-models.js +3 -3
- package/dist/esm/state/middleware/read-write/measure-box-models.js.map +1 -1
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js +19 -13
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js.map +1 -1
- package/dist/esm/state/modules/api-resources.js +2 -2
- package/dist/esm/state/modules/api-resources.js.map +1 -1
- package/dist/esm/state/modules/breakpoints.js +2 -2
- package/dist/esm/state/modules/breakpoints.js.map +1 -1
- package/dist/esm/state/modules/components-meta.js +1 -1
- package/dist/esm/state/modules/components-meta.js.map +1 -1
- package/dist/esm/state/modules/element-trees.js +2 -2
- package/dist/esm/state/modules/element-trees.js.map +1 -1
- package/dist/esm/state/modules/is-in-builder.js +1 -1
- package/dist/esm/state/modules/is-in-builder.js.map +1 -1
- package/dist/esm/state/modules/is-read-only.js +1 -1
- package/dist/esm/state/modules/is-read-only.js.map +1 -1
- package/dist/esm/state/modules/locale.js +1 -1
- package/dist/esm/state/modules/locale.js.map +1 -1
- package/dist/esm/state/modules/localized-resources-map.js +1 -1
- package/dist/esm/state/modules/localized-resources-map.js.map +1 -1
- package/dist/esm/state/modules/{prop-controllers.js → prop-controller-descriptors.js} +2 -2
- package/dist/esm/state/modules/prop-controller-descriptors.js.map +1 -0
- package/dist/esm/state/modules/react-components.js +1 -1
- package/dist/esm/state/modules/react-components.js.map +1 -1
- package/dist/esm/state/modules/read-write/box-models.js +2 -2
- package/dist/esm/state/modules/read-write/box-models.js.map +1 -1
- package/dist/esm/state/modules/read-write/element-imperative-handles.js +3 -3
- package/dist/esm/state/modules/read-write/element-imperative-handles.js.map +1 -1
- package/dist/esm/state/modules/{prop-controller-handles.js → read-write/prop-controllers.js} +2 -2
- package/dist/esm/state/modules/read-write/prop-controllers.js.map +1 -0
- package/dist/esm/state/read-only-state.js +9 -41
- package/dist/esm/state/read-only-state.js.map +1 -1
- package/dist/esm/state/read-write-state.js +34 -0
- package/dist/esm/state/read-write-state.js.map +1 -1
- package/dist/esm/state/shared-api/action-types.js +9 -0
- package/dist/esm/state/shared-api/action-types.js.map +1 -0
- package/dist/esm/state/{shared-api.js → shared-api/actions.js} +2 -7
- package/dist/esm/state/shared-api/actions.js.map +1 -0
- package/dist/esm/state/shared-api/index.js +3 -0
- package/dist/esm/state/shared-api/index.js.map +1 -0
- package/dist/esm/state/store.js +1 -1
- package/dist/esm/state/store.js.map +1 -1
- package/dist/esm/state/translations/get.js.map +1 -1
- package/dist/esm/state/translations/merge.js +3 -1
- package/dist/esm/state/translations/merge.js.map +1 -1
- package/dist/esm/state/unified-state.js +4 -0
- package/dist/esm/state/unified-state.js.map +1 -1
- package/dist/esm/testing/breakpoints.js +9 -0
- package/dist/esm/testing/breakpoints.js.map +1 -0
- package/dist/esm/testing/element-data.js +76 -0
- package/dist/esm/testing/element-data.js.map +1 -0
- package/dist/esm/translations/index.js.map +1 -1
- package/dist/types/api/schema/page-pathname-slice.d.ts +2 -2
- package/dist/types/api-handler/handlers/webhook/diff-projection.d.ts +6 -6
- package/dist/types/api-handler/handlers/webhook/types.d.ts +20 -20
- package/dist/types/builder/host-to-builder-actions.d.ts.map +1 -1
- package/dist/types/components/builtin/Form/Form.d.ts +1 -1
- package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
- package/dist/types/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/types/components/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/types/controls/rich-text/control.d.ts +3 -1
- package/dist/types/controls/rich-text/control.d.ts.map +1 -1
- package/dist/types/controls/rich-text-v2/control.d.ts +2 -0
- package/dist/types/controls/rich-text-v2/control.d.ts.map +1 -1
- package/dist/types/locale.d.ts +1 -1
- package/dist/types/next/testing/breakpoints.d.ts +1 -3
- package/dist/types/next/testing/breakpoints.d.ts.map +1 -1
- package/dist/types/next/testing/element-data.d.ts +1 -54
- package/dist/types/next/testing/element-data.d.ts.map +1 -1
- package/dist/types/next/testing/react-runtime.d.ts.map +1 -1
- package/dist/types/prop-controllers/instances.d.ts +2 -0
- package/dist/types/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/Element.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/ElementRegistration.d.ts +1 -1
- package/dist/types/runtimes/react/components/ElementRegistration.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/resolve-props.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts +1 -1
- package/dist/types/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -1
- package/dist/types/runtimes/react/element-imperative-handle.d.ts +1 -1
- package/dist/types/runtimes/react/element-imperative-handle.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-control-instances.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts +4 -3
- package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-store.d.ts +2 -4
- package/dist/types/runtimes/react/hooks/use-store.d.ts.map +1 -1
- package/dist/types/runtimes/react/testing/index.d.ts +3 -0
- package/dist/types/runtimes/react/testing/index.d.ts.map +1 -0
- package/dist/types/runtimes/react/testing/react-provider.d.ts +8 -0
- package/dist/types/runtimes/react/testing/react-provider.d.ts.map +1 -0
- package/dist/types/state/__tests__/test-store.d.ts +2 -4
- package/dist/types/state/__tests__/test-store.d.ts.map +1 -1
- package/dist/types/state/actions/index.d.ts +6 -6
- package/dist/types/state/actions/index.d.ts.map +1 -1
- package/dist/types/state/actions/internal/action-types.d.ts +26 -0
- package/dist/types/state/actions/internal/action-types.d.ts.map +1 -0
- package/dist/types/state/actions/internal/index.d.ts +0 -25
- package/dist/types/state/actions/internal/index.d.ts.map +1 -1
- package/dist/types/state/actions/internal/read-only-action-types.d.ts +15 -0
- package/dist/types/state/actions/internal/read-only-action-types.d.ts.map +1 -0
- package/dist/types/state/actions/internal/read-only-actions.d.ts +3 -76
- package/dist/types/state/actions/internal/read-only-actions.d.ts.map +1 -1
- package/dist/types/state/actions/internal/read-write-action-types.d.ts +14 -0
- package/dist/types/state/actions/internal/read-write-action-types.d.ts.map +1 -0
- package/dist/types/state/actions/internal/read-write-actions.d.ts +57 -9
- package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -1
- package/dist/types/state/builder-api/action-types.d.ts +22 -0
- package/dist/types/state/builder-api/action-types.d.ts.map +1 -0
- package/dist/types/state/builder-api/actions.d.ts +1 -21
- package/dist/types/state/builder-api/actions.d.ts.map +1 -1
- package/dist/types/state/builder-api/proxy.d.ts.map +1 -1
- package/dist/types/state/host-api/action-types.d.ts +17 -0
- package/dist/types/state/host-api/action-types.d.ts.map +1 -0
- package/dist/types/state/{host-api.d.ts → host-api/actions.d.ts} +7 -22
- package/dist/types/state/host-api/actions.d.ts.map +1 -0
- package/dist/types/state/host-api/index.d.ts +3 -0
- package/dist/types/state/host-api/index.d.ts.map +1 -0
- package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts.map +1 -1
- package/dist/types/state/modules/element-trees.d.ts +1 -1
- package/dist/types/state/modules/element-trees.d.ts.map +1 -1
- package/dist/types/state/modules/{prop-controllers.d.ts → prop-controller-descriptors.d.ts} +1 -1
- package/dist/types/state/modules/prop-controller-descriptors.d.ts.map +1 -0
- package/dist/types/state/modules/{prop-controller-handles.d.ts → read-write/prop-controllers.d.ts} +4 -4
- package/dist/types/state/modules/{prop-controller-handles.d.ts.map → read-write/prop-controllers.d.ts.map} +1 -1
- package/dist/types/state/read-only-state.d.ts +6 -70
- package/dist/types/state/read-only-state.d.ts.map +1 -1
- package/dist/types/state/read-write-state.d.ts +67 -4
- package/dist/types/state/read-write-state.d.ts.map +1 -1
- package/dist/types/state/shared-api/action-types.d.ts +6 -0
- package/dist/types/state/shared-api/action-types.d.ts.map +1 -0
- package/dist/types/state/{shared-api.d.ts → shared-api/actions.d.ts} +3 -7
- package/dist/types/state/shared-api/actions.d.ts.map +1 -0
- package/dist/types/state/shared-api/index.d.ts +3 -0
- package/dist/types/state/shared-api/index.d.ts.map +1 -0
- package/dist/types/state/store.d.ts +4 -8
- package/dist/types/state/store.d.ts.map +1 -1
- package/dist/types/state/translations/get.d.ts +1 -1
- package/dist/types/state/translations/get.d.ts.map +1 -1
- package/dist/types/state/translations/merge.d.ts +1 -1
- package/dist/types/state/translations/merge.d.ts.map +1 -1
- package/dist/types/state/unified-state.d.ts +1 -0
- package/dist/types/state/unified-state.d.ts.map +1 -1
- package/dist/types/testing/breakpoints.d.ts +4 -0
- package/dist/types/testing/breakpoints.d.ts.map +1 -0
- package/dist/types/testing/element-data.d.ts +55 -0
- package/dist/types/testing/element-data.d.ts.map +1 -0
- package/dist/types/translations/index.d.ts +1 -1
- package/dist/types/translations/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/cjs/state/host-api.js.map +0 -1
- package/dist/cjs/state/modules/prop-controller-handles.js.map +0 -1
- package/dist/cjs/state/modules/prop-controllers.js.map +0 -1
- package/dist/cjs/state/shared-api.js.map +0 -1
- package/dist/esm/state/host-api.js.map +0 -1
- package/dist/esm/state/modules/prop-controller-handles.js.map +0 -1
- package/dist/esm/state/modules/prop-controllers.js.map +0 -1
- package/dist/esm/state/shared-api.js.map +0 -1
- package/dist/types/state/host-api.d.ts.map +0 -1
- package/dist/types/state/modules/prop-controllers.d.ts.map +0 -1
- package/dist/types/state/shared-api.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/state/modules/read-write/prop-controllers.ts"],"sourcesContent":["import { ControlInstance } from '@makeswift/controls'\nimport { type Action, type UnknownAction, ActionTypes, isKnownAction } from '../../actions'\nimport type { DescriptorsPropControllers } from '../../../prop-controllers/instances'\nimport type { Descriptor } from '../../../prop-controllers/descriptors'\n\nexport interface PropControllersHandle<\n T extends Record<string, Descriptor> = Record<string, Descriptor>,\n> {\n setPropControllers(propControllers: DescriptorsPropControllers<T> | null): void\n}\n\nexport function isPropControllersHandle(value: unknown): value is PropControllersHandle {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'setPropControllers' in value &&\n typeof (value as { setPropControllers: unknown }).setPropControllers === 'function'\n ) {\n return true\n }\n\n return false\n}\n\nexport type State = {\n handles: Map<string, Map<string, PropControllersHandle>>\n instances: Map<string, Map<string, Record<string, ControlInstance>>>\n}\n\nexport function getInitialState(): State {\n return { handles: new Map(), instances: new Map() }\n}\n\nexport function getPropControllersHandle(\n state: State,\n documentKey: string,\n elementKey: string,\n): PropControllersHandle | null {\n return state.handles.get(documentKey)?.get(elementKey) ?? null\n}\n\nexport function getPropControllers(\n state: State,\n documentKey: string,\n elementKey: string,\n): Record<string, ControlInstance> | null {\n return state.instances.get(documentKey)?.get(elementKey) ?? null\n}\n\nexport function getPropController(\n state: State,\n documentKey: string,\n elementKey: string,\n propName: string,\n): ControlInstance | null {\n return getPropControllers(state, documentKey, elementKey)?.[propName] ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction): State {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey, handle } = action.payload\n\n return {\n ...state,\n handles: new Map(state.handles).set(\n documentKey,\n new Map(state.handles.get(documentKey) ?? []).set(elementKey, handle),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const nextHandles = new Map(state.handles.get(documentKey) ?? [])\n\n const deleted = nextHandles.delete(elementKey)\n\n return deleted\n ? { ...state, handles: new Map(state.handles).set(documentKey, nextHandles) }\n : state\n }\n\n case ActionTypes.REGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey, propControllers } = action.payload\n\n return {\n ...state,\n instances: new Map(state.instances).set(\n documentKey,\n new Map(state.instances.get(documentKey) ?? []).set(elementKey, propControllers),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey } = action.payload\n const nextInstances = new Map(state.instances.get(documentKey) ?? [])\n\n const deleted = nextInstances.delete(elementKey)\n\n return deleted\n ? { ...state, instances: new Map(state.instances).set(documentKey, nextInstances) }\n : state\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAA4E;AAUrE,SAAS,wBAAwB,OAAgD;AACtF,MACE,OAAO,UAAU,YACjB,UAAU,QACV,wBAAwB,SACxB,OAAQ,MAA0C,uBAAuB,YACzE;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAOO,SAAS,kBAAyB;AACvC,SAAO,EAAE,SAAS,oBAAI,IAAI,GAAG,WAAW,oBAAI,IAAI,EAAE;AACpD;AAEO,SAAS,yBACd,OACA,aACA,YAC8B;AAC9B,SAAO,MAAM,QAAQ,IAAI,WAAW,GAAG,IAAI,UAAU,KAAK;AAC5D;AAEO,SAAS,mBACd,OACA,aACA,YACwC;AACxC,SAAO,MAAM,UAAU,IAAI,WAAW,GAAG,IAAI,UAAU,KAAK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AI,MAAM,UAAU,IAAI,WAAW,KAAK,CAAC,CAAC;AAEpE,YAAM,UAAU,cAAc,OAAO,UAAU;AAE/C,aAAO,UACH,EAAE,GAAG,OAAO,WAAW,IAAI,IAAI,MAAM,SAAS,EAAE,IAAI,aAAa,aAAa,EAAE,IAChF;AAAA,IACN;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
|
|
@@ -47,10 +47,7 @@ __export(read_only_state_exports, {
|
|
|
47
47
|
getIsInBuilder: () => getIsInBuilder,
|
|
48
48
|
getIsReadOnly: () => getIsReadOnly,
|
|
49
49
|
getLocale: () => getLocale,
|
|
50
|
-
getPropController: () => getPropController,
|
|
51
50
|
getPropControllerDescriptors: () => getPropControllerDescriptors,
|
|
52
|
-
getPropControllers: () => getPropControllers,
|
|
53
|
-
getPropControllersHandle: () => getPropControllersHandle,
|
|
54
51
|
getReactComponent: () => getReactComponent,
|
|
55
52
|
getRootElement: () => import_read_only_documents.getRootElement,
|
|
56
53
|
isElementReference: () => import_read_only_documents.isElementReference,
|
|
@@ -64,8 +61,7 @@ var Documents = __toESM(require("./modules/read-only-documents"));
|
|
|
64
61
|
var ElementTrees = __toESM(require("./modules/element-trees"));
|
|
65
62
|
var ReactComponents = __toESM(require("./modules/react-components"));
|
|
66
63
|
var ComponentsMeta = __toESM(require("./modules/components-meta"));
|
|
67
|
-
var
|
|
68
|
-
var PropControllerHandles = __toESM(require("./modules/prop-controller-handles"));
|
|
64
|
+
var PropControllerDescriptors = __toESM(require("./modules/prop-controller-descriptors"));
|
|
69
65
|
var IsInBuilder = __toESM(require("./modules/is-in-builder"));
|
|
70
66
|
var IsReadOnly = __toESM(require("./modules/is-read-only"));
|
|
71
67
|
var BuilderEditMode = __toESM(require("./modules/builder-edit-mode"));
|
|
@@ -79,8 +75,7 @@ const reducers = {
|
|
|
79
75
|
elementTrees: ElementTrees.reducer,
|
|
80
76
|
reactComponents: ReactComponents.reducer,
|
|
81
77
|
componentsMeta: ComponentsMeta.reducer,
|
|
82
|
-
|
|
83
|
-
propControllerHandles: PropControllerHandles.reducer,
|
|
78
|
+
propControllerDescriptors: PropControllerDescriptors.reducer,
|
|
84
79
|
isInBuilder: IsInBuilder.reducer,
|
|
85
80
|
builderEditMode: BuilderEditMode.reducer,
|
|
86
81
|
breakpoints: Breakpoints.reducer
|
|
@@ -115,47 +110,20 @@ function getComponentsMeta(state) {
|
|
|
115
110
|
function getComponentMeta(state, type) {
|
|
116
111
|
return ComponentsMeta.getComponentMeta(getComponentsMetaStateSlice(state), type);
|
|
117
112
|
}
|
|
118
|
-
function
|
|
119
|
-
return state.
|
|
113
|
+
function getPropControllerDescriptorsStateSlice(state) {
|
|
114
|
+
return state.propControllerDescriptors;
|
|
120
115
|
}
|
|
121
116
|
function getPropControllerDescriptors(state) {
|
|
122
|
-
return
|
|
117
|
+
return PropControllerDescriptors.getPropControllerDescriptors(
|
|
118
|
+
getPropControllerDescriptorsStateSlice(state)
|
|
119
|
+
);
|
|
123
120
|
}
|
|
124
121
|
function getComponentPropControllerDescriptors(state, componentType) {
|
|
125
|
-
return
|
|
126
|
-
|
|
122
|
+
return PropControllerDescriptors.getComponentPropControllerDescriptors(
|
|
123
|
+
getPropControllerDescriptorsStateSlice(state),
|
|
127
124
|
componentType
|
|
128
125
|
);
|
|
129
126
|
}
|
|
130
|
-
function getPropControllerHandlesStateSlice(state) {
|
|
131
|
-
return state.propControllerHandles;
|
|
132
|
-
}
|
|
133
|
-
function getPropControllers(state, { documentKey, elementKey }) {
|
|
134
|
-
return PropControllerHandles.getPropControllers(
|
|
135
|
-
getPropControllerHandlesStateSlice(state),
|
|
136
|
-
documentKey,
|
|
137
|
-
elementKey
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
function getPropControllersHandle(state, { documentKey, elementKey }) {
|
|
141
|
-
return PropControllerHandles.getPropControllersHandle(
|
|
142
|
-
getPropControllerHandlesStateSlice(state),
|
|
143
|
-
documentKey,
|
|
144
|
-
elementKey
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
function getPropController(state, {
|
|
148
|
-
documentKey,
|
|
149
|
-
elementKey,
|
|
150
|
-
propName
|
|
151
|
-
}) {
|
|
152
|
-
return PropControllerHandles.getPropController(
|
|
153
|
-
getPropControllerHandlesStateSlice(state),
|
|
154
|
-
documentKey,
|
|
155
|
-
elementKey,
|
|
156
|
-
propName
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
127
|
const getDocumentKeysSortedByDepth = (0, import_reselect.createSelector)(
|
|
160
128
|
[getDocumentsStateSlice, getElementTreesSlice],
|
|
161
129
|
(documents, elementTrees) => {
|
|
@@ -219,10 +187,7 @@ function getLocale(state) {
|
|
|
219
187
|
getIsInBuilder,
|
|
220
188
|
getIsReadOnly,
|
|
221
189
|
getLocale,
|
|
222
|
-
getPropController,
|
|
223
190
|
getPropControllerDescriptors,
|
|
224
|
-
getPropControllers,
|
|
225
|
-
getPropControllersHandle,
|
|
226
191
|
getReactComponent,
|
|
227
192
|
getRootElement,
|
|
228
193
|
isElementReference,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/read-only-state.ts"],"sourcesContent":["import { type ThunkDispatch } from '@reduxjs/toolkit'\n\nimport { createSelector } from 'reselect'\n\nimport * as SiteVersion from './modules/site-version'\nimport * as Locale from './modules/locale'\nimport * as Documents from './modules/read-only-documents'\nimport * as ElementTrees from './modules/element-trees'\nimport * as ReactComponents from './modules/react-components'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllers from './modules/prop-controllers'\nimport * as PropControllerHandles from './modules/prop-controller-handles'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as IsReadOnly from './modules/is-read-only'\nimport * as BuilderEditMode from './modules/builder-edit-mode'\nimport * as Breakpoints from './modules/breakpoints'\n\nimport { type Action } from './actions'\n\nexport type {\n Data,\n Document,\n DocumentReference,\n Element,\n ElementData,\n ElementReference,\n} from './modules/read-only-documents'\n\nexport {\n createBaseDocument,\n createDocumentReference,\n getRootElement,\n isElementReference,\n} from './modules/read-only-documents'\n\nexport type { ComponentType } from './modules/react-components'\nexport type { ComponentMeta } from './modules/components-meta'\n\nexport const reducers = {\n siteVersion: SiteVersion.reducer,\n isReadOnly: IsReadOnly.reducer,\n locale: Locale.reducer,\n documents: Documents.reducer,\n elementTrees: ElementTrees.reducer,\n reactComponents: ReactComponents.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllers: PropControllers.reducer,\n propControllerHandles: PropControllerHandles.reducer,\n isInBuilder: IsInBuilder.reducer,\n builderEditMode: BuilderEditMode.reducer,\n breakpoints: Breakpoints.reducer,\n}\n\nexport type State = {\n siteVersion: SiteVersion.State\n isReadOnly: IsReadOnly.State\n locale: Locale.State\n documents: Documents.State\n elementTrees: ElementTrees.State\n reactComponents: ReactComponents.State\n componentsMeta: ComponentsMeta.State\n propControllers: PropControllers.State\n propControllerHandles: PropControllerHandles.State\n isInBuilder: IsInBuilder.State\n builderEditMode: BuilderEditMode.State\n breakpoints: Breakpoints.State\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction getDocumentsStateSlice(state: State): Documents.State {\n return state.documents\n}\n\nexport function getDocument(state: State, documentKey: string): Documents.Document | null {\n return Documents.getDocument(getDocumentsStateSlice(state), documentKey)\n}\n\nfunction getElementTreesSlice(state: State): ElementTrees.State {\n return state.elementTrees\n}\n\nexport function getElements(\n state: State,\n documentKey: string,\n): ElementTrees.ElementTree['elements'] {\n return ElementTrees.getElements(getElementTreesSlice(state), documentKey)\n}\n\nexport function getElementIds(\n state: State,\n documentKey: string,\n): ElementTrees.ElementTree['elementIds'] {\n return ElementTrees.getElementIds(getElementTreesSlice(state), documentKey)\n}\n\nfunction getReactComponentsStateSlice(state: State): ReactComponents.State {\n return state.reactComponents\n}\n\nexport function getReactComponent(\n state: State,\n type: string,\n): ReactComponents.ComponentType | null {\n return ReactComponents.getReactComponent(getReactComponentsStateSlice(state), type)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nexport function getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nexport function getComponentMeta(state: State, type: string): ComponentsMeta.ComponentMeta | null {\n return ComponentsMeta.getComponentMeta(getComponentsMetaStateSlice(state), type)\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nexport function getPropControllerDescriptors(state: State): PropControllers.State {\n return PropControllers.getPropControllerDescriptors(getPropControllersStateSlice(state))\n}\n\nexport function getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): PropControllers.DescriptorsByProp | null {\n return PropControllers.getComponentPropControllerDescriptors(\n getPropControllersStateSlice(state),\n componentType,\n )\n}\n\nfunction getPropControllerHandlesStateSlice(state: State): PropControllerHandles.State {\n return state.propControllerHandles\n}\n\nexport function getPropControllers(\n state: State,\n { documentKey, elementKey }: { documentKey: string; elementKey: string },\n) {\n return PropControllerHandles.getPropControllers(\n getPropControllerHandlesStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nexport function getPropControllersHandle(\n state: State,\n { documentKey, elementKey }: { documentKey: string; elementKey: string },\n) {\n return PropControllerHandles.getPropControllersHandle(\n getPropControllerHandlesStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nexport function getPropController(\n state: State,\n {\n documentKey,\n elementKey,\n propName,\n }: { documentKey: string; elementKey: string; propName: string },\n) {\n return PropControllerHandles.getPropController(\n getPropControllerHandlesStateSlice(state),\n documentKey,\n elementKey,\n propName,\n )\n}\n\n/**\n * Returns all document keys sorted by depth, i.e., parent documents come before child documents.\n */\nexport const getDocumentKeysSortedByDepth: (state: State) => string[] = createSelector(\n [getDocumentsStateSlice, getElementTreesSlice],\n (documents, elementTrees) => {\n return [...documents.keys()].sort((a, b) => (elementTrees.get(a)?.elements.has(b) ? -1 : 1))\n },\n)\n\nexport function getElement(\n state: State,\n documentKey: string,\n elementKey: string,\n): Documents.Element | null {\n return ElementTrees.getElement(getElementTreesSlice(state), documentKey, elementKey)\n}\n\nexport function getElementId(state: State, documentKey: string, elementKey: string): string | null {\n return ElementTrees.getElementId(getElementTreesSlice(state), documentKey, elementKey)\n}\n\nexport function getElementPropControllerDescriptors(\n state: State,\n documentKey: string,\n elementKey: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n const element = getElement(state, documentKey, elementKey)\n\n if (element == null || Documents.isElementReference(element)) return null\n\n return getComponentPropControllerDescriptors(state, element.type)\n}\n\nexport function getIsInBuilder(state: State): boolean {\n return state.isInBuilder\n}\n\nexport function getIsReadOnly(state: State): boolean {\n return state.isReadOnly\n}\n\nexport function getBuilderEditMode(state: State): BuilderEditMode.State {\n return state.builderEditMode\n}\n\nfunction getBreakpointsStateSlice(state: State): Breakpoints.State {\n return state.breakpoints\n}\n\nexport function getBreakpoints(state: State): Breakpoints.Breakpoints {\n return getBreakpointsStateSlice(state).breakpoints\n}\n\nexport function getBaseBreakpoint(state: State): Breakpoints.BreakpointId {\n return getBreakpointsStateSlice(state).baseBreakpoint\n}\n\nexport function getClientBreakpoint(state: State): Breakpoints.BreakpointId {\n return getBreakpointsStateSlice(state).clientBreakpoint\n}\n\nexport function getLocale(state: State): string | null {\n return state.locale\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAA+B;AAE/B,kBAA6B;AAC7B,aAAwB;AACxB,gBAA2B;AAC3B,mBAA8B;AAC9B,sBAAiC;AACjC,qBAAgC;AAChC,sBAAiC;AACjC,4BAAuC;AACvC,kBAA6B;AAC7B,iBAA4B;AAC5B,sBAAiC;AACjC,kBAA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AM;AACf;AAEO,SAAS,cAAc,OAAuB;AACnD,SAAO,MAAM;AACf;AAEO,SAAS,mBAAmB,OAAqC;AACtE,SAAO,MAAM;AACf;AAEA,SAAS,yBAAyB,OAAiC;AACjE,SAAO,MAAM;AACf;AAEO,SAAS,eAAe,OAAuC;AACpE,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,kBAAkB,OAAwC;AACxE,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,oBAAoB,OAAwC;AAC1E,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,UAAU,OAA6B;AACrD,SAAO,MAAM;AACf;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/state/read-only-state.ts"],"sourcesContent":["import { type ThunkDispatch } from '@reduxjs/toolkit'\n\nimport { createSelector } from 'reselect'\n\nimport * as SiteVersion from './modules/site-version'\nimport * as Locale from './modules/locale'\nimport * as Documents from './modules/read-only-documents'\nimport * as ElementTrees from './modules/element-trees'\nimport * as ReactComponents from './modules/react-components'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllerDescriptors from './modules/prop-controller-descriptors'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as IsReadOnly from './modules/is-read-only'\nimport * as BuilderEditMode from './modules/builder-edit-mode'\nimport * as Breakpoints from './modules/breakpoints'\n\nimport { type Action } from './actions'\n\nexport type {\n Data,\n Document,\n DocumentReference,\n Element,\n ElementData,\n ElementReference,\n} from './modules/read-only-documents'\n\nexport {\n createBaseDocument,\n createDocumentReference,\n getRootElement,\n isElementReference,\n} from './modules/read-only-documents'\n\nexport type { ComponentType } from './modules/react-components'\nexport type { ComponentMeta } from './modules/components-meta'\n\nexport const reducers = {\n siteVersion: SiteVersion.reducer,\n isReadOnly: IsReadOnly.reducer,\n locale: Locale.reducer,\n documents: Documents.reducer,\n elementTrees: ElementTrees.reducer,\n reactComponents: ReactComponents.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllerDescriptors: PropControllerDescriptors.reducer,\n isInBuilder: IsInBuilder.reducer,\n builderEditMode: BuilderEditMode.reducer,\n breakpoints: Breakpoints.reducer,\n}\n\nexport type State = {\n siteVersion: SiteVersion.State\n isReadOnly: IsReadOnly.State\n locale: Locale.State\n documents: Documents.State\n elementTrees: ElementTrees.State\n reactComponents: ReactComponents.State\n componentsMeta: ComponentsMeta.State\n propControllerDescriptors: PropControllerDescriptors.State\n isInBuilder: IsInBuilder.State\n builderEditMode: BuilderEditMode.State\n breakpoints: Breakpoints.State\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction getDocumentsStateSlice(state: State): Documents.State {\n return state.documents\n}\n\nexport function getDocument(state: State, documentKey: string): Documents.Document | null {\n return Documents.getDocument(getDocumentsStateSlice(state), documentKey)\n}\n\nfunction getElementTreesSlice(state: State): ElementTrees.State {\n return state.elementTrees\n}\n\nexport function getElements(\n state: State,\n documentKey: string,\n): ElementTrees.ElementTree['elements'] {\n return ElementTrees.getElements(getElementTreesSlice(state), documentKey)\n}\n\nexport function getElementIds(\n state: State,\n documentKey: string,\n): ElementTrees.ElementTree['elementIds'] {\n return ElementTrees.getElementIds(getElementTreesSlice(state), documentKey)\n}\n\nfunction getReactComponentsStateSlice(state: State): ReactComponents.State {\n return state.reactComponents\n}\n\nexport function getReactComponent(\n state: State,\n type: string,\n): ReactComponents.ComponentType | null {\n return ReactComponents.getReactComponent(getReactComponentsStateSlice(state), type)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nexport function getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nexport function getComponentMeta(state: State, type: string): ComponentsMeta.ComponentMeta | null {\n return ComponentsMeta.getComponentMeta(getComponentsMetaStateSlice(state), type)\n}\n\nfunction getPropControllerDescriptorsStateSlice(state: State): PropControllerDescriptors.State {\n return state.propControllerDescriptors\n}\n\nexport function getPropControllerDescriptors(state: State): PropControllerDescriptors.State {\n return PropControllerDescriptors.getPropControllerDescriptors(\n getPropControllerDescriptorsStateSlice(state),\n )\n}\n\nexport function getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): PropControllerDescriptors.DescriptorsByProp | null {\n return PropControllerDescriptors.getComponentPropControllerDescriptors(\n getPropControllerDescriptorsStateSlice(state),\n componentType,\n )\n}\n\n/**\n * Returns all document keys sorted by depth, i.e., parent documents come before child documents.\n */\nexport const getDocumentKeysSortedByDepth: (state: State) => string[] = createSelector(\n [getDocumentsStateSlice, getElementTreesSlice],\n (documents, elementTrees) => {\n return [...documents.keys()].sort((a, b) => (elementTrees.get(a)?.elements.has(b) ? -1 : 1))\n },\n)\n\nexport function getElement(\n state: State,\n documentKey: string,\n elementKey: string,\n): Documents.Element | null {\n return ElementTrees.getElement(getElementTreesSlice(state), documentKey, elementKey)\n}\n\nexport function getElementId(state: State, documentKey: string, elementKey: string): string | null {\n return ElementTrees.getElementId(getElementTreesSlice(state), documentKey, elementKey)\n}\n\nexport function getElementPropControllerDescriptors(\n state: State,\n documentKey: string,\n elementKey: string,\n): Record<string, PropControllerDescriptors.PropControllerDescriptor> | null {\n const element = getElement(state, documentKey, elementKey)\n\n if (element == null || Documents.isElementReference(element)) return null\n\n return getComponentPropControllerDescriptors(state, element.type)\n}\n\nexport function getIsInBuilder(state: State): boolean {\n return state.isInBuilder\n}\n\nexport function getIsReadOnly(state: State): boolean {\n return state.isReadOnly\n}\n\nexport function getBuilderEditMode(state: State): BuilderEditMode.State {\n return state.builderEditMode\n}\n\nfunction getBreakpointsStateSlice(state: State): Breakpoints.State {\n return state.breakpoints\n}\n\nexport function getBreakpoints(state: State): Breakpoints.Breakpoints {\n return getBreakpointsStateSlice(state).breakpoints\n}\n\nexport function getBaseBreakpoint(state: State): Breakpoints.BreakpointId {\n return getBreakpointsStateSlice(state).baseBreakpoint\n}\n\nexport function getClientBreakpoint(state: State): Breakpoints.BreakpointId {\n return getBreakpointsStateSlice(state).clientBreakpoint\n}\n\nexport function getLocale(state: State): string | null {\n return state.locale\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAA+B;AAE/B,kBAA6B;AAC7B,aAAwB;AACxB,gBAA2B;AAC3B,mBAA8B;AAC9B,sBAAiC;AACjC,qBAAgC;AAChC,gCAA2C;AAC3C,kBAA6B;AAC7B,iBAA4B;AAC5B,sBAAiC;AACjC,kBAA6B;AAa7B,iCAKO;AAKA,MAAM,WAAW;AAAA,EACtB,aAAa,YAAY;AAAA,EACzB,YAAY,WAAW;AAAA,EACvB,QAAQ,OAAO;AAAA,EACf,WAAW,UAAU;AAAA,EACrB,cAAc,aAAa;AAAA,EAC3B,iBAAiB,gBAAgB;AAAA,EACjC,gBAAgB,eAAe;AAAA,EAC/B,2BAA2B,0BAA0B;AAAA,EACrD,aAAa,YAAY;AAAA,EACzB,iBAAiB,gBAAgB;AAAA,EACjC,aAAa,YAAY;AAC3B;AAkBA,SAAS,uBAAuB,OAA+B;AAC7D,SAAO,MAAM;AACf;AAEO,SAAS,YAAY,OAAc,aAAgD;AACxF,SAAO,UAAU,YAAY,uBAAuB,KAAK,GAAG,WAAW;AACzE;AAEA,SAAS,qBAAqB,OAAkC;AAC9D,SAAO,MAAM;AACf;AAEO,SAAS,YACd,OACA,aACsC;AACtC,SAAO,aAAa,YAAY,qBAAqB,KAAK,GAAG,WAAW;AAC1E;AAEO,SAAS,cACd,OACA,aACwC;AACxC,SAAO,aAAa,cAAc,qBAAqB,KAAK,GAAG,WAAW;AAC5E;AAEA,SAAS,6BAA6B,OAAqC;AACzE,SAAO,MAAM;AACf;AAEO,SAAS,kBACd,OACA,MAC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AAuB;AACnD,SAAO,MAAM;AACf;AAEO,SAAS,mBAAmB,OAAqC;AACtE,SAAO,MAAM;AACf;AAEA,SAAS,yBAAyB,OAAiC;AACjE,SAAO,MAAM;AACf;AAEO,SAAS,eAAe,OAAuC;AACpE,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,kBAAkB,OAAwC;AACxE,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,oBAAoB,OAAwC;AAC1E,SAAO,yBAAyB,KAAK,EAAE;AACzC;AAEO,SAAS,UAAU,OAA6B;AACrD,SAAO,MAAM;AACf;","names":[]}
|
|
@@ -39,6 +39,9 @@ __export(read_write_state_exports, {
|
|
|
39
39
|
getElementImperativeHandlesContainingElement: () => getElementImperativeHandlesContainingElement,
|
|
40
40
|
getMeasurables: () => getMeasurables,
|
|
41
41
|
getPointer: () => getPointer,
|
|
42
|
+
getPropController: () => getPropController,
|
|
43
|
+
getPropControllers: () => getPropControllers,
|
|
44
|
+
getPropControllersHandle: () => getPropControllersHandle,
|
|
42
45
|
parse: () => import_box_models.parse,
|
|
43
46
|
setupBuilderProxy: () => setupBuilderProxy
|
|
44
47
|
});
|
|
@@ -47,6 +50,7 @@ var import_toolkit = require("@reduxjs/toolkit");
|
|
|
47
50
|
var Documents = __toESM(require("./modules/read-write/read-write-documents"));
|
|
48
51
|
var BoxModels = __toESM(require("./modules/read-write/box-models"));
|
|
49
52
|
var Pointer = __toESM(require("./modules/read-write/pointer"));
|
|
53
|
+
var PropControllers = __toESM(require("./modules/read-write/prop-controllers"));
|
|
50
54
|
var ElementImperativeHandles = __toESM(require("./modules/read-write/element-imperative-handles"));
|
|
51
55
|
var ReadOnlyState = __toESM(require("./read-only-state"));
|
|
52
56
|
var import_box_models = require("./modules/read-write/box-models");
|
|
@@ -55,6 +59,7 @@ const reducers = {
|
|
|
55
59
|
documents: Documents.reducer,
|
|
56
60
|
boxModels: BoxModels.reducer,
|
|
57
61
|
pointer: Pointer.reducer,
|
|
62
|
+
propControllers: PropControllers.reducer,
|
|
58
63
|
elementImperativeHandles: ElementImperativeHandles.reducer
|
|
59
64
|
};
|
|
60
65
|
function createRootReducer() {
|
|
@@ -104,6 +109,35 @@ function getElementImperativeHandlesContainingElement(state, element) {
|
|
|
104
109
|
}
|
|
105
110
|
return filteredElementImperativeHandles;
|
|
106
111
|
}
|
|
112
|
+
function getPropControllersStateSlice(state) {
|
|
113
|
+
return state.propControllers;
|
|
114
|
+
}
|
|
115
|
+
function getPropControllers(state, { documentKey, elementKey }) {
|
|
116
|
+
return PropControllers.getPropControllers(
|
|
117
|
+
getPropControllersStateSlice(state),
|
|
118
|
+
documentKey,
|
|
119
|
+
elementKey
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
function getPropControllersHandle(state, { documentKey, elementKey }) {
|
|
123
|
+
return PropControllers.getPropControllersHandle(
|
|
124
|
+
getPropControllersStateSlice(state),
|
|
125
|
+
documentKey,
|
|
126
|
+
elementKey
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
function getPropController(state, {
|
|
130
|
+
documentKey,
|
|
131
|
+
elementKey,
|
|
132
|
+
propName
|
|
133
|
+
}) {
|
|
134
|
+
return PropControllers.getPropController(
|
|
135
|
+
getPropControllersStateSlice(state),
|
|
136
|
+
documentKey,
|
|
137
|
+
elementKey,
|
|
138
|
+
propName
|
|
139
|
+
);
|
|
140
|
+
}
|
|
107
141
|
function setupBuilderProxy(builderProxy) {
|
|
108
142
|
return (dispatch) => {
|
|
109
143
|
return builderProxy.setup({ onHostAction: (action) => dispatch(action) });
|
|
@@ -122,6 +156,9 @@ function setupBuilderProxy(builderProxy) {
|
|
|
122
156
|
getElementImperativeHandlesContainingElement,
|
|
123
157
|
getMeasurables,
|
|
124
158
|
getPointer,
|
|
159
|
+
getPropController,
|
|
160
|
+
getPropControllers,
|
|
161
|
+
getPropControllersHandle,
|
|
125
162
|
parse,
|
|
126
163
|
setupBuilderProxy
|
|
127
164
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/read-write-state.ts"],"sourcesContent":["import { combineReducers, type ThunkAction, type ThunkDispatch } from '@reduxjs/toolkit'\n\nimport * as Documents from './modules/read-write/read-write-documents'\nimport * as BoxModels from './modules/read-write/box-models'\nimport * as Pointer from './modules/read-write/pointer'\nimport * as ElementImperativeHandles from './modules/read-write/element-imperative-handles'\n\nimport { type Action } from './actions'\n\nimport { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle'\n\nimport { BuilderAPIProxy } from './builder-api/proxy'\nimport * as ReadOnlyState from './read-only-state'\n\nexport type { Operation } from './modules/read-write/read-write-documents'\nexport type { BoxModelHandle } from './modules/read-write/box-models'\nexport { createBox, getBox, parse } from './modules/read-write/box-models'\n\nconst reducers = {\n ...ReadOnlyState.reducers,\n documents: Documents.reducer,\n boxModels: BoxModels.reducer,\n pointer: Pointer.reducer,\n elementImperativeHandles: ElementImperativeHandles.reducer,\n}\n\nexport function createRootReducer() {\n return combineReducers(reducers)\n}\n\nexport type State = Omit<ReadOnlyState.State, 'documents'> & {\n documents: Documents.State\n boxModels: BoxModels.State\n pointer: Pointer.State\n elementImperativeHandles: ElementImperativeHandles.State\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction getDocumentsStateSlice(state: State): Documents.State {\n return state.documents\n}\n\nexport function getDocuments(state: State): Documents.State {\n return Documents.getDocuments(getDocumentsStateSlice(state))\n}\n\nexport function getDocument(state: State, documentKey: string): Documents.Document | null {\n return Documents.getDocument(getDocumentsStateSlice(state), documentKey)\n}\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nexport function getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nexport function getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxDisplayModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nexport function getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxDisplayModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nexport function getPointer(state: State): Pointer.Point | null {\n return Pointer.getPointer(state.pointer)\n}\n\nexport function getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return ElementImperativeHandles.getElementImperativeHandles(state.elementImperativeHandles)\n}\n\nexport function getElementImperativeHandlesContainingElement(\n state: State,\n element: Element,\n): Map<string, Map<string, ElementImperativeHandle>> {\n const elementImperativeHandles = getElementImperativeHandles(state)\n const filteredElementImperativeHandles = new Map<string, Map<string, ElementImperativeHandle>>()\n\n for (const [documentKey, byElementKey] of elementImperativeHandles) {\n const filteredByElementKey = new Map<string, ElementImperativeHandle>()\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n const handleElement = elementImperativeHandle.getDomNode()\n\n if (handleElement?.contains(element)) {\n filteredByElementKey.set(elementKey, elementImperativeHandle)\n }\n }\n\n if (filteredByElementKey.size > 0) {\n filteredElementImperativeHandles.set(documentKey, filteredByElementKey)\n }\n }\n\n return filteredElementImperativeHandles\n}\n\nexport function setupBuilderProxy(\n builderProxy: BuilderAPIProxy,\n): ThunkAction<VoidFunction, State, unknown, Action> {\n return dispatch => {\n return builderProxy.setup({ onHostAction: action => dispatch(action) })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAsE;AAEtE,gBAA2B;AAC3B,gBAA2B;AAC3B,cAAyB;AACzB,+BAA0C;AAO1C,oBAA+B;AAI/B,wBAAyC;AAEzC,MAAM,WAAW;AAAA,EACf,GAAG,cAAc;AAAA,EACjB,WAAW,UAAU;AAAA,EACrB,WAAW,UAAU;AAAA,EACrB,SAAS,QAAQ;AAAA,EACjB,0BAA0B,yBAAyB;AACrD;AAEO,SAAS,oBAAoB;AAClC,aAAO,gCAAgB,QAAQ;AACjC;
|
|
1
|
+
{"version":3,"sources":["../../../src/state/read-write-state.ts"],"sourcesContent":["import { combineReducers, type ThunkAction, type ThunkDispatch } from '@reduxjs/toolkit'\n\nimport * as Documents from './modules/read-write/read-write-documents'\nimport * as BoxModels from './modules/read-write/box-models'\nimport * as Pointer from './modules/read-write/pointer'\nimport * as PropControllers from './modules/read-write/prop-controllers'\nimport * as ElementImperativeHandles from './modules/read-write/element-imperative-handles'\n\nimport { type Action } from './actions'\n\nimport { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle'\n\nimport { BuilderAPIProxy } from './builder-api/proxy'\nimport * as ReadOnlyState from './read-only-state'\n\nexport type { Operation } from './modules/read-write/read-write-documents'\nexport type { BoxModelHandle } from './modules/read-write/box-models'\nexport { createBox, getBox, parse } from './modules/read-write/box-models'\n\nconst reducers = {\n ...ReadOnlyState.reducers,\n documents: Documents.reducer,\n boxModels: BoxModels.reducer,\n pointer: Pointer.reducer,\n propControllers: PropControllers.reducer,\n elementImperativeHandles: ElementImperativeHandles.reducer,\n}\n\nexport function createRootReducer() {\n return combineReducers(reducers)\n}\n\nexport type State = Omit<ReadOnlyState.State, 'documents'> & {\n documents: Documents.State\n boxModels: BoxModels.State\n pointer: Pointer.State\n propControllers: PropControllers.State\n elementImperativeHandles: ElementImperativeHandles.State\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction getDocumentsStateSlice(state: State): Documents.State {\n return state.documents\n}\n\nexport function getDocuments(state: State): Documents.State {\n return Documents.getDocuments(getDocumentsStateSlice(state))\n}\n\nexport function getDocument(state: State, documentKey: string): Documents.Document | null {\n return Documents.getDocument(getDocumentsStateSlice(state), documentKey)\n}\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nexport function getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nexport function getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxDisplayModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nexport function getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxDisplayModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nexport function getPointer(state: State): Pointer.Point | null {\n return Pointer.getPointer(state.pointer)\n}\n\nexport function getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return ElementImperativeHandles.getElementImperativeHandles(state.elementImperativeHandles)\n}\n\nexport function getElementImperativeHandlesContainingElement(\n state: State,\n element: Element,\n): Map<string, Map<string, ElementImperativeHandle>> {\n const elementImperativeHandles = getElementImperativeHandles(state)\n const filteredElementImperativeHandles = new Map<string, Map<string, ElementImperativeHandle>>()\n\n for (const [documentKey, byElementKey] of elementImperativeHandles) {\n const filteredByElementKey = new Map<string, ElementImperativeHandle>()\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n const handleElement = elementImperativeHandle.getDomNode()\n\n if (handleElement?.contains(element)) {\n filteredByElementKey.set(elementKey, elementImperativeHandle)\n }\n }\n\n if (filteredByElementKey.size > 0) {\n filteredElementImperativeHandles.set(documentKey, filteredByElementKey)\n }\n }\n\n return filteredElementImperativeHandles\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nexport function getPropControllers(\n state: State,\n { documentKey, elementKey }: { documentKey: string; elementKey: string },\n) {\n return PropControllers.getPropControllers(\n getPropControllersStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nexport function getPropControllersHandle(\n state: State,\n { documentKey, elementKey }: { documentKey: string; elementKey: string },\n) {\n return PropControllers.getPropControllersHandle(\n getPropControllersStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nexport function getPropController(\n state: State,\n {\n documentKey,\n elementKey,\n propName,\n }: { documentKey: string; elementKey: string; propName: string },\n) {\n return PropControllers.getPropController(\n getPropControllersStateSlice(state),\n documentKey,\n elementKey,\n propName,\n )\n}\n\nexport function setupBuilderProxy(\n builderProxy: BuilderAPIProxy,\n): ThunkAction<VoidFunction, State, unknown, Action> {\n return dispatch => {\n return builderProxy.setup({ onHostAction: action => dispatch(action) })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAsE;AAEtE,gBAA2B;AAC3B,gBAA2B;AAC3B,cAAyB;AACzB,sBAAiC;AACjC,+BAA0C;AAO1C,oBAA+B;AAI/B,wBAAyC;AAEzC,MAAM,WAAW;AAAA,EACf,GAAG,cAAc;AAAA,EACjB,WAAW,UAAU;AAAA,EACrB,WAAW,UAAU;AAAA,EACrB,SAAS,QAAQ;AAAA,EACjB,iBAAiB,gBAAgB;AAAA,EACjC,0BAA0B,yBAAyB;AACrD;AAEO,SAAS,oBAAoB;AAClC,aAAO,gCAAgB,QAAQ;AACjC;AAYA,SAAS,uBAAuB,OAA+B;AAC7D,SAAO,MAAM;AACf;AAEO,SAAS,aAAa,OAA+B;AAC1D,SAAO,UAAU,aAAa,uBAAuB,KAAK,CAAC;AAC7D;AAEO,SAAS,YAAY,OAAc,aAAgD;AACxF,SAAO,UAAU,YAAY,uBAAuB,KAAK,GAAG,WAAW;AACzE;AAEA,SAAS,uBAAuB,OAA+B;AAC7D,SAAO,MAAM;AACf;AAEO,SAAS,eAAe,OAA8D;AAC3F,SAAO,UAAU,eAAe,uBAAuB,KAAK,CAAC;AAC/D;AAEO,SAAS,aAAa,OAAmE;AAC9F,SAAO,UAAU,aAAa,uBAAuB,KAAK,CAAC;AAC7D;AAEO,SAAS,YACd,OACA,aACA,YACkC;AAClC,SAAO,UAAU,YAAY,uBAAuB,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;AACF;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 action_types_exports = {};
|
|
20
|
+
__export(action_types_exports, {
|
|
21
|
+
SharedActionTypes: () => SharedActionTypes
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(action_types_exports);
|
|
24
|
+
const SharedActionTypes = {
|
|
25
|
+
MAKESWIFT_CONNECTION_INIT: "MAKESWIFT_CONNECTION_INIT",
|
|
26
|
+
REGISTER_DOCUMENT: "REGISTER_DOCUMENT",
|
|
27
|
+
UNREGISTER_DOCUMENT: "UNREGISTER_DOCUMENT"
|
|
28
|
+
};
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
SharedActionTypes
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=action-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/shared-api/action-types.ts"],"sourcesContent":["// bidirectional action types, both the host and the builder can dispatch these actions\nexport const SharedActionTypes = {\n MAKESWIFT_CONNECTION_INIT: 'MAKESWIFT_CONNECTION_INIT',\n\n REGISTER_DOCUMENT: 'REGISTER_DOCUMENT',\n UNREGISTER_DOCUMENT: 'UNREGISTER_DOCUMENT',\n} as const\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,MAAM,oBAAoB;AAAA,EAC/B,2BAA2B;AAAA,EAE3B,mBAAmB;AAAA,EACnB,qBAAqB;AACvB;","names":[]}
|
|
@@ -16,33 +16,28 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
SharedActionTypes: () => SharedActionTypes,
|
|
19
|
+
var actions_exports = {};
|
|
20
|
+
__export(actions_exports, {
|
|
22
21
|
makeswiftConnectionInit: () => makeswiftConnectionInit,
|
|
23
22
|
registerDocument: () => registerDocument,
|
|
24
23
|
registerDocumentsEffect: () => registerDocumentsEffect,
|
|
25
24
|
unregisterDocument: () => unregisterDocument
|
|
26
25
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
28
|
-
|
|
29
|
-
MAKESWIFT_CONNECTION_INIT: "MAKESWIFT_CONNECTION_INIT",
|
|
30
|
-
REGISTER_DOCUMENT: "REGISTER_DOCUMENT",
|
|
31
|
-
UNREGISTER_DOCUMENT: "UNREGISTER_DOCUMENT"
|
|
32
|
-
};
|
|
26
|
+
module.exports = __toCommonJS(actions_exports);
|
|
27
|
+
var import_action_types = require("./action-types");
|
|
33
28
|
function makeswiftConnectionInit() {
|
|
34
29
|
return {
|
|
35
|
-
type: SharedActionTypes.MAKESWIFT_CONNECTION_INIT
|
|
30
|
+
type: import_action_types.SharedActionTypes.MAKESWIFT_CONNECTION_INIT
|
|
36
31
|
};
|
|
37
32
|
}
|
|
38
33
|
function registerDocument(document) {
|
|
39
34
|
return {
|
|
40
|
-
type: SharedActionTypes.REGISTER_DOCUMENT,
|
|
35
|
+
type: import_action_types.SharedActionTypes.REGISTER_DOCUMENT,
|
|
41
36
|
payload: { documentKey: document.key, document }
|
|
42
37
|
};
|
|
43
38
|
}
|
|
44
39
|
function unregisterDocument(documentKey) {
|
|
45
|
-
return { type: SharedActionTypes.UNREGISTER_DOCUMENT, payload: { documentKey } };
|
|
40
|
+
return { type: import_action_types.SharedActionTypes.UNREGISTER_DOCUMENT, payload: { documentKey } };
|
|
46
41
|
}
|
|
47
42
|
function registerDocumentsEffect(documents) {
|
|
48
43
|
return (dispatch) => {
|
|
@@ -54,10 +49,9 @@ function registerDocumentsEffect(documents) {
|
|
|
54
49
|
}
|
|
55
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
51
|
0 && (module.exports = {
|
|
57
|
-
SharedActionTypes,
|
|
58
52
|
makeswiftConnectionInit,
|
|
59
53
|
registerDocument,
|
|
60
54
|
registerDocumentsEffect,
|
|
61
55
|
unregisterDocument
|
|
62
56
|
});
|
|
63
|
-
//# sourceMappingURL=
|
|
57
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/shared-api/actions.ts"],"sourcesContent":["import { type ThunkAction } from '@reduxjs/toolkit'\n\nimport { type Element, type Document, EMBEDDED_DOCUMENT_TYPE } from '../modules/read-only-documents'\n\nimport { SharedActionTypes } from './action-types'\n\ntype DocumentPayloadBaseDocument = {\n key: string\n rootElement: Element\n locale?: string | null // older versions of the runtime may not provide this field\n}\n\ntype DocumentPayloadEmbeddedDocument = {\n key: string\n locale: string | null\n id: string\n type: string\n name: string\n rootElement: Element\n meta: { allowLocaleFallback: boolean; requestedLocale: string | null; description?: string }\n __type: typeof EMBEDDED_DOCUMENT_TYPE\n}\n\nexport type DocumentPayload = DocumentPayloadBaseDocument | DocumentPayloadEmbeddedDocument\n\ntype MakeswiftConnectionInitAction = { type: typeof SharedActionTypes.MAKESWIFT_CONNECTION_INIT }\n\ntype RegisterDocumentAction = {\n type: typeof SharedActionTypes.REGISTER_DOCUMENT\n payload: { documentKey: string; document: DocumentPayload }\n}\n\ntype UnregisterDocumentAction = {\n type: typeof SharedActionTypes.UNREGISTER_DOCUMENT\n payload: { documentKey: string }\n}\n\nexport type SharedAction =\n | MakeswiftConnectionInitAction\n | RegisterDocumentAction\n | UnregisterDocumentAction\n\nexport function makeswiftConnectionInit(): MakeswiftConnectionInitAction {\n return {\n type: SharedActionTypes.MAKESWIFT_CONNECTION_INIT,\n }\n}\n\nexport function registerDocument(document: Document): RegisterDocumentAction {\n return {\n type: SharedActionTypes.REGISTER_DOCUMENT,\n payload: { documentKey: document.key, document },\n }\n}\n\nexport function unregisterDocument(documentKey: string): UnregisterDocumentAction {\n return { type: SharedActionTypes.UNREGISTER_DOCUMENT, payload: { documentKey } }\n}\n\nexport function registerDocumentsEffect(\n documents: Document[],\n): ThunkAction<() => void, unknown, unknown, SharedAction> {\n return dispatch => {\n documents.forEach(document => dispatch(registerDocument(document)))\n\n return () => {\n documents.forEach(document => dispatch(unregisterDocument(document.key)))\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,0BAAkC;AAsC3B,SAAS,0BAAyD;AACvE,SAAO;AAAA,IACL,MAAM,sCAAkB;AAAA,EAC1B;AACF;AAEO,SAAS,iBAAiB,UAA4C;AAC3E,SAAO;AAAA,IACL,MAAM,sCAAkB;AAAA,IACxB,SAAS,EAAE,aAAa,SAAS,KAAK,SAAS;AAAA,EACjD;AACF;AAEO,SAAS,mBAAmB,aAA+C;AAChF,SAAO,EAAE,MAAM,sCAAkB,qBAAqB,SAAS,EAAE,YAAY,EAAE;AACjF;AAEO,SAAS,wBACd,WACyD;AACzD,SAAO,cAAY;AACjB,cAAU,QAAQ,cAAY,SAAS,iBAAiB,QAAQ,CAAC,CAAC;AAElE,WAAO,MAAM;AACX,gBAAU,QAAQ,cAAY,SAAS,mBAAmB,SAAS,GAAG,CAAC,CAAC;AAAA,IAC1E;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var shared_api_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(shared_api_exports);
|
|
18
|
+
__reExport(shared_api_exports, require("./action-types"), module.exports);
|
|
19
|
+
__reExport(shared_api_exports, require("./actions"), module.exports);
|
|
20
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
+
0 && (module.exports = {
|
|
22
|
+
...require("./action-types"),
|
|
23
|
+
...require("./actions")
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/shared-api/index.ts"],"sourcesContent":["export * from './action-types'\nexport * from './actions'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,2BAAd;AACA,+BAAc,sBADd;","names":[]}
|
package/dist/cjs/state/store.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(store_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(store_exports);
|
|
36
36
|
var import_toolkit = require("@reduxjs/toolkit");
|
|
37
37
|
var import_toolkit2 = require("./toolkit");
|
|
38
|
-
var
|
|
38
|
+
var import_action_types = require("./builder-api/action-types");
|
|
39
39
|
var import_host_api = require("./host-api");
|
|
40
40
|
var Breakpoints = __toESM(require("./modules/breakpoints"));
|
|
41
41
|
var import_read_only_element_tree = require("./middleware/read-only-element-tree");
|
|
@@ -60,8 +60,8 @@ const configureStore = ({
|
|
|
60
60
|
name: `${name} (${(/* @__PURE__ */ new Date()).toISOString()})`,
|
|
61
61
|
actionsDenylist: [
|
|
62
62
|
import_host_api.HostActionTypes.BUILDER_POINTER_MOVE,
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
import_action_types.BuilderActionTypes.HANDLE_POINTER_MOVE,
|
|
64
|
+
import_action_types.BuilderActionTypes.ELEMENT_FROM_POINT_CHANGE
|
|
65
65
|
]
|
|
66
66
|
})
|
|
67
67
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/store.ts"],"sourcesContent":["import {\n type Middleware,\n type StoreEnhancer,\n type MiddlewareAPI,\n Tuple,\n configureStore as configureReduxStore,\n combineReducers,\n compose,\n} from '@reduxjs/toolkit'\n\nimport { ApiResourcesClient } from '../api/api-resources-client'\n\nimport { actionMiddleware, middlewareOptions, devToolsConfig } from './toolkit'\nimport { BuilderActionTypes } from './builder-api/actions'\nimport { HostActionTypes } from './host-api'\n\nimport * as Breakpoints from './modules/breakpoints'\n\nimport { readOnlyElementTreeMiddleware } from './middleware/read-only-element-tree'\nimport { makeswiftApiClientSyncMiddleware } from './middleware/makeswift-api-client-sync'\nimport { type BreakpointWatch, breakpointWatchMixin } from './mixins/breakpoint-watch'\n\nimport { type Action } from './actions'\n\nimport { type State as ReadWriteState } from './read-write-state'\nimport * as ReadOnlyState from './read-only-state'\nimport {\n type State,\n type Dispatch,\n type ReadOnlyReducer,\n type ReadWriteDispatch,\n} from './unified-state'\n\nexport { type State } from './unified-state'\n\nconst configureStore = <Items extends readonly StoreEnhancer[] = []>({\n name,\n preloadedState,\n enhancers,\n middleware,\n}: {\n name: string\n preloadedState: Partial<State>\n enhancers: () => Tuple<Items>\n middleware?: () => Middleware[]\n}) => {\n const store = configureReduxStore({\n reducer: combineReducers(ReadOnlyState.reducers),\n preloadedState,\n\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware(middlewareOptions).concat([\n readOnlyElementTreeMiddleware(),\n ...(middleware ? middleware() : []),\n ]),\n\n enhancers: getDefaultEnhancers => getDefaultEnhancers().concat(enhancers()),\n\n devTools: devToolsConfig({\n name: `${name} (${new Date().toISOString()})`,\n actionsDenylist: [\n HostActionTypes.BUILDER_POINTER_MOVE,\n BuilderActionTypes.HANDLE_POINTER_MOVE,\n BuilderActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n }),\n })\n\n return store\n}\n\nexport function configureProtoStore({\n name,\n breakpoints,\n}: {\n name: string\n breakpoints: Breakpoints.Breakpoints | undefined\n}) {\n return configureStore({\n name,\n preloadedState: {\n breakpoints: Breakpoints.getInitialState(breakpoints),\n },\n enhancers: () => new Tuple(),\n })\n}\n\nexport type ProtoStore = ReturnType<typeof configureProtoStore>\n\ntype ReadWriteMiddleware = ReturnType<\n typeof import('./middleware/read-write').createReadWriteMiddleware\n>\n\ntype ReadWriteMiddlewareRef = {\n current: ReadWriteMiddleware | null\n}\n\nexport function conditionalReadWriteMiddleware(\n middlewareRef: ReadWriteMiddlewareRef,\n): Middleware<Dispatch, State, Dispatch> {\n let readWriteActionBuffer: Action[] = []\n let middlewares: ReadWriteMiddleware | null = null\n let enhancedDispatch: Dispatch | null = null\n\n return actionMiddleware(({ dispatch, getState }) => next => {\n return (action: Action) => {\n const state = getState()\n\n if (middlewareRef.current == null) {\n if (!state.isReadOnly) {\n // because switching to the read-write state is an asynchronous operation,\n // we need to buffer all actions dispatched after the isReadOnly state is\n // set to false but before the read-write middleware is installed\n readWriteActionBuffer.push(action)\n }\n\n return next(action)\n }\n\n if (state.isReadOnly) {\n console.error('Read-write state mismatch', {\n isReadOnly: state.isReadOnly,\n middlewareRef: middlewareRef.current,\n siteVersion: state.siteVersion,\n })\n }\n\n // build and cache the enhanced dispatch chain when read-write middleware is installed\n if (enhancedDispatch == null || middlewares !== middlewareRef.current) {\n middlewares = middlewareRef.current\n\n const middlewareApi = { dispatch, getState } as MiddlewareAPI<\n ReadWriteDispatch,\n ReadWriteState\n >\n\n enhancedDispatch = compose<Dispatch>(...middlewares.map(mw => mw(middlewareApi)))(next)\n }\n\n // dispatch buffered actions, if any\n if (readWriteActionBuffer.length > 0) {\n const readWriteActions = [...readWriteActionBuffer]\n readWriteActionBuffer = []\n\n // Note that we're rerunning the actions through the entire middleware chain,\n // including the read-only middleware and the reducers, some of which have\n // already processed these actions once. This is safe to do because actions that\n // are run as part of page initialization are idempotent.\n for (const bufferedAction of readWriteActions) {\n enhancedDispatch(bufferedAction)\n }\n }\n\n return enhancedDispatch(action)\n }\n })\n}\n\nexport interface ReadWriteStateMixin {\n readonly apiResourcesClient: ApiResourcesClient\n\n loadReadWriteStateIfNeeded(): Promise<() => void>\n}\n\nfunction withMixin<M extends {}>(mixin: M): StoreEnhancer<M> {\n return next => (reducer, preloadedState?) => ({\n ...next(reducer, preloadedState),\n ...mixin,\n })\n}\n\nexport function configureReadWriteStore({\n name,\n appOrigin,\n apiResourcesClient,\n preloadedState,\n}: {\n name: string\n appOrigin: string\n apiResourcesClient: ApiResourcesClient\n preloadedState: Partial<State>\n}) {\n const readWriteMiddlewareRef: ReadWriteMiddlewareRef = {\n current: null,\n }\n\n let refCount = 0\n let readWriteCleanup: (() => void) | null = null\n let readWriteSetupPromise: Promise<void> | null = null\n\n const loadReadWriteState = async (): Promise<void> => {\n if (readWriteCleanup != null) {\n return\n }\n\n if (readWriteSetupPromise != null) {\n await readWriteSetupPromise\n return\n }\n\n readWriteSetupPromise = (async () => {\n // import all the modules needed for read-write mode before proceeding with\n // the setup to avoid race conditions when `setup` is called concurrently\n // in two different page regions\n const { BuilderAPIProxy } = await import('./builder-api/proxy')\n const { createRootReducer, setupBuilderProxy } = await import('./read-write-state')\n const { createReadWriteMiddleware } = await import('./middleware/read-write')\n\n // IMPORTANT: only synchronous code after this point\n\n // with all modules imported, check if another concurrent setup already\n // initialized the read-write middleware\n if (readWriteMiddlewareRef.current != null) {\n return\n }\n\n store.replaceReducer(createRootReducer() as ReadOnlyReducer)\n\n const builderProxy = new BuilderAPIProxy({ appOrigin })\n readWriteMiddlewareRef.current = createReadWriteMiddleware({ builderProxy })\n\n const dispatch = store.dispatch as ReadWriteDispatch\n const builderProxyCleanup = dispatch(setupBuilderProxy(builderProxy))\n\n readWriteCleanup = () => {\n readWriteMiddlewareRef.current = null\n builderProxyCleanup()\n }\n })()\n\n try {\n await readWriteSetupPromise\n } finally {\n readWriteSetupPromise = null\n }\n }\n\n const store = configureStore({\n name,\n preloadedState,\n\n middleware: () => [\n makeswiftApiClientSyncMiddleware(apiResourcesClient),\n conditionalReadWriteMiddleware(readWriteMiddlewareRef),\n ],\n\n enhancers: () =>\n new Tuple(\n withMixin<BreakpointWatch>(\n breakpointWatchMixin({\n dispatch: (...args: Parameters<Dispatch>) => store.dispatch(...args),\n getState: (): State => store.getState(),\n subscribe: (listener): VoidFunction => store.subscribe(listener),\n }),\n ),\n\n withMixin<ReadWriteStateMixin>({\n apiResourcesClient,\n loadReadWriteStateIfNeeded: async () => {\n const { isReadOnly } = store.getState()\n\n if (isReadOnly) {\n if (refCount > 0) {\n console.error('Read-write state mismatch', { isReadOnly, refCount })\n }\n\n return () => {}\n }\n\n await loadReadWriteState()\n refCount += 1\n\n let didCleanup = false\n return () => {\n if (didCleanup) {\n return\n }\n\n didCleanup = true\n refCount -= 1\n if (refCount === 0 && readWriteCleanup != null) {\n readWriteCleanup()\n readWriteCleanup = null\n }\n }\n },\n }),\n ),\n })\n\n return store\n}\n\nexport type Store = ReturnType<typeof configureReadWriteStore>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAQO;AAIP,IAAAA,kBAAoE;AACpE,qBAAmC;AACnC,sBAAgC;AAEhC,kBAA6B;AAE7B,oCAA8C;AAC9C,uCAAiD;AACjD,8BAA2D;AAK3D,oBAA+B;AAU/B,MAAM,iBAAiB,CAA8C;AAAA,EACnE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAKM;AACJ,QAAM,YAAQ,eAAAC,gBAAoB;AAAA,IAChC,aAAS,gCAAgB,cAAc,QAAQ;AAAA,IAC/C;AAAA,IAEA,YAAY,0BACV,qBAAqB,iCAAiB,EAAE,OAAO;AAAA,UAC7C,6DAA8B;AAAA,MAC9B,GAAI,aAAa,WAAW,IAAI,CAAC;AAAA,IACnC,CAAC;AAAA,IAEH,WAAW,yBAAuB,oBAAoB,EAAE,OAAO,UAAU,CAAC;AAAA,IAE1E,cAAU,gCAAe;AAAA,MACvB,MAAM,GAAG,IAAI,MAAK,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA,MAC1C,iBAAiB;AAAA,QACf,gCAAgB;AAAA,QAChB,kCAAmB;AAAA,QACnB,kCAAmB;AAAA,MACrB;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;AAEO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AACF,GAGG;AACD,SAAO,eAAe;AAAA,IACpB;AAAA,IACA,gBAAgB;AAAA,MACd,aAAa,YAAY,gBAAgB,WAAW;AAAA,IACtD;AAAA,IACA,WAAW,MAAM,IAAI,qBAAM;AAAA,EAC7B,CAAC;AACH;AAYO,SAAS,+BACd,eACuC;AACvC,MAAI,wBAAkC,CAAC;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Q,MAAM,6BAA6B,EAAE,YAAY,SAAS,CAAC;AAAA,YACrE;AAEA,mBAAO,MAAM;AAAA,YAAC;AAAA,UAChB;AAEA,gBAAM,mBAAmB;AACzB,sBAAY;AAEZ,cAAI,aAAa;AACjB,iBAAO,MAAM;AACX,gBAAI,YAAY;AACd;AAAA,YACF;AAEA,yBAAa;AACb,wBAAY;AACZ,gBAAI,aAAa,KAAK,oBAAoB,MAAM;AAC9C,+BAAiB;AACjB,iCAAmB;AAAA,YACrB;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACJ,CAAC;AAED,SAAO;AACT;","names":["import_toolkit","configureReduxStore"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/state/store.ts"],"sourcesContent":["import {\n type Middleware,\n type StoreEnhancer,\n type MiddlewareAPI,\n Tuple,\n configureStore as configureReduxStore,\n combineReducers,\n compose,\n} from '@reduxjs/toolkit'\n\nimport { ApiResourcesClient } from '../api/api-resources-client'\n\nimport { actionMiddleware, middlewareOptions, devToolsConfig } from './toolkit'\nimport { BuilderActionTypes } from './builder-api/action-types'\nimport { HostActionTypes } from './host-api'\n\nimport * as Breakpoints from './modules/breakpoints'\n\nimport { readOnlyElementTreeMiddleware } from './middleware/read-only-element-tree'\nimport { makeswiftApiClientSyncMiddleware } from './middleware/makeswift-api-client-sync'\nimport { type BreakpointWatch, breakpointWatchMixin } from './mixins/breakpoint-watch'\n\nimport { type Action } from './actions'\n\nimport { type State as ReadWriteState } from './read-write-state'\nimport * as ReadOnlyState from './read-only-state'\nimport {\n type State,\n type Dispatch,\n type ReadOnlyReducer,\n type ReadWriteDispatch,\n} from './unified-state'\n\nexport { type State } from './unified-state'\n\nconst configureStore = <Items extends readonly StoreEnhancer[] = []>({\n name,\n preloadedState,\n enhancers,\n middleware,\n}: {\n name: string\n preloadedState: Partial<State>\n enhancers: () => Tuple<Items>\n middleware?: () => Middleware[]\n}) => {\n const store = configureReduxStore({\n reducer: combineReducers(ReadOnlyState.reducers),\n preloadedState,\n\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware(middlewareOptions).concat([\n readOnlyElementTreeMiddleware(),\n ...(middleware ? middleware() : []),\n ]),\n\n enhancers: getDefaultEnhancers => getDefaultEnhancers().concat(enhancers()),\n\n devTools: devToolsConfig({\n name: `${name} (${new Date().toISOString()})`,\n actionsDenylist: [\n HostActionTypes.BUILDER_POINTER_MOVE,\n BuilderActionTypes.HANDLE_POINTER_MOVE,\n BuilderActionTypes.ELEMENT_FROM_POINT_CHANGE,\n ],\n }),\n })\n\n return store\n}\n\nexport function configureProtoStore({\n name,\n breakpoints,\n}: {\n name: string\n breakpoints: Breakpoints.Breakpoints | undefined\n}) {\n return configureStore({\n name,\n preloadedState: {\n breakpoints: Breakpoints.getInitialState(breakpoints),\n },\n enhancers: () => new Tuple(),\n })\n}\n\nexport type ProtoStore = ReturnType<typeof configureProtoStore>\n\ntype ReadWriteMiddleware = ReturnType<\n typeof import('./middleware/read-write').createReadWriteMiddleware\n>\n\ntype ReadWriteMiddlewareRef = {\n current: ReadWriteMiddleware | null\n}\n\nexport function conditionalReadWriteMiddleware(\n middlewareRef: ReadWriteMiddlewareRef,\n): Middleware<Dispatch, State, Dispatch> {\n let readWriteActionBuffer: Action[] = []\n let middlewares: ReadWriteMiddleware | null = null\n let enhancedDispatch: Dispatch | null = null\n\n return actionMiddleware(({ dispatch, getState }) => next => {\n return (action: Action) => {\n const state = getState()\n\n if (middlewareRef.current == null) {\n if (!state.isReadOnly) {\n // because switching to the read-write state is an asynchronous operation,\n // we need to buffer all actions dispatched after the isReadOnly state is\n // set to false but before the read-write middleware is installed\n readWriteActionBuffer.push(action)\n }\n\n return next(action)\n }\n\n if (state.isReadOnly) {\n console.error('Read-write state mismatch', {\n isReadOnly: state.isReadOnly,\n middlewareRef: middlewareRef.current,\n siteVersion: state.siteVersion,\n })\n }\n\n // build and cache the enhanced dispatch chain when read-write middleware is installed\n if (enhancedDispatch == null || middlewares !== middlewareRef.current) {\n middlewares = middlewareRef.current\n\n const middlewareApi = { dispatch, getState } as MiddlewareAPI<\n ReadWriteDispatch,\n ReadWriteState\n >\n\n enhancedDispatch = compose<Dispatch>(...middlewares.map(mw => mw(middlewareApi)))(next)\n }\n\n // dispatch buffered actions, if any\n if (readWriteActionBuffer.length > 0) {\n const readWriteActions = [...readWriteActionBuffer]\n readWriteActionBuffer = []\n\n // Note that we're rerunning the actions through the entire middleware chain,\n // including the read-only middleware and the reducers, some of which have\n // already processed these actions once. This is safe to do because actions that\n // are run as part of page initialization are idempotent.\n for (const bufferedAction of readWriteActions) {\n enhancedDispatch(bufferedAction)\n }\n }\n\n return enhancedDispatch(action)\n }\n })\n}\n\nexport interface ReadWriteStateMixin {\n readonly apiResourcesClient: ApiResourcesClient\n\n loadReadWriteStateIfNeeded(): Promise<() => void>\n}\n\nfunction withMixin<M extends {}>(mixin: M): StoreEnhancer<M> {\n return next => (reducer, preloadedState?) => ({\n ...next(reducer, preloadedState),\n ...mixin,\n })\n}\n\nexport function configureReadWriteStore({\n name,\n appOrigin,\n apiResourcesClient,\n preloadedState,\n}: {\n name: string\n appOrigin: string\n apiResourcesClient: ApiResourcesClient\n preloadedState: Partial<State>\n}) {\n const readWriteMiddlewareRef: ReadWriteMiddlewareRef = {\n current: null,\n }\n\n let refCount = 0\n let readWriteCleanup: (() => void) | null = null\n let readWriteSetupPromise: Promise<void> | null = null\n\n const loadReadWriteState = async (): Promise<void> => {\n if (readWriteCleanup != null) {\n return\n }\n\n if (readWriteSetupPromise != null) {\n await readWriteSetupPromise\n return\n }\n\n readWriteSetupPromise = (async () => {\n // import all the modules needed for read-write mode before proceeding with\n // the setup to avoid race conditions when `setup` is called concurrently\n // in two different page regions\n const { BuilderAPIProxy } = await import('./builder-api/proxy')\n const { createRootReducer, setupBuilderProxy } = await import('./read-write-state')\n const { createReadWriteMiddleware } = await import('./middleware/read-write')\n\n // IMPORTANT: only synchronous code after this point\n\n // with all modules imported, check if another concurrent setup already\n // initialized the read-write middleware\n if (readWriteMiddlewareRef.current != null) {\n return\n }\n\n store.replaceReducer(createRootReducer() as ReadOnlyReducer)\n\n const builderProxy = new BuilderAPIProxy({ appOrigin })\n readWriteMiddlewareRef.current = createReadWriteMiddleware({ builderProxy })\n\n const dispatch = store.dispatch as ReadWriteDispatch\n const builderProxyCleanup = dispatch(setupBuilderProxy(builderProxy))\n\n readWriteCleanup = () => {\n readWriteMiddlewareRef.current = null\n builderProxyCleanup()\n }\n })()\n\n try {\n await readWriteSetupPromise\n } finally {\n readWriteSetupPromise = null\n }\n }\n\n const store = configureStore({\n name,\n preloadedState,\n\n middleware: () => [\n makeswiftApiClientSyncMiddleware(apiResourcesClient),\n conditionalReadWriteMiddleware(readWriteMiddlewareRef),\n ],\n\n enhancers: () =>\n new Tuple(\n withMixin<BreakpointWatch>(\n breakpointWatchMixin({\n dispatch: (...args: Parameters<Dispatch>) => store.dispatch(...args),\n getState: (): State => store.getState(),\n subscribe: (listener): VoidFunction => store.subscribe(listener),\n }),\n ),\n\n withMixin<ReadWriteStateMixin>({\n apiResourcesClient,\n loadReadWriteStateIfNeeded: async () => {\n const { isReadOnly } = store.getState()\n\n if (isReadOnly) {\n if (refCount > 0) {\n console.error('Read-write state mismatch', { isReadOnly, refCount })\n }\n\n return () => {}\n }\n\n await loadReadWriteState()\n refCount += 1\n\n let didCleanup = false\n return () => {\n if (didCleanup) {\n return\n }\n\n didCleanup = true\n refCount -= 1\n if (refCount === 0 && readWriteCleanup != null) {\n readWriteCleanup()\n readWriteCleanup = null\n }\n }\n },\n }),\n ),\n })\n\n return store\n}\n\nexport type Store = ReturnType<typeof configureReadWriteStore>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAQO;AAIP,IAAAA,kBAAoE;AACpE,0BAAmC;AACnC,sBAAgC;AAEhC,kBAA6B;AAE7B,oCAA8C;AAC9C,uCAAiD;AACjD,8BAA2D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;AAAA,IACH;AAAA,EACJ,CAAC;AAED,SAAO;AACT;","names":["import_toolkit","configureReduxStore"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/state/translations/get.ts"],"sourcesContent":["import * as Documents from '../modules/read-only-documents'\nimport * as ElementTrees from '../modules/element-trees'\nimport { getTranslatableData } from '../../controls/control'\nimport type { DescriptorsByComponentType } from '../modules/prop-
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/translations/get.ts"],"sourcesContent":["import * as Documents from '../modules/read-only-documents'\nimport * as ElementTrees from '../modules/element-trees'\nimport { getTranslatableData } from '../../controls/control'\nimport type { DescriptorsByComponentType } from '../modules/prop-controller-descriptors'\n\nexport function getTranslatableContent(\n descriptors: DescriptorsByComponentType,\n elementTree: Documents.ElementData,\n): Record<string, Documents.Data> {\n const translatableData: Record<string, Documents.Data> = {}\n\n for (const element of ElementTrees.traverseElementTree(elementTree, descriptors)) {\n if (Documents.isElementReference(element)) continue\n\n const elementDescriptors = descriptors.get(element.type)\n if (elementDescriptors == null) continue\n\n Object.entries(elementDescriptors).forEach(([propName, descriptor]) => {\n const translatablePropData = getTranslatableData(descriptor, element.props[propName])\n\n if (translatablePropData != null) {\n translatableData[`${element.key}:${propName}`] = translatablePropData\n }\n })\n }\n\n return translatableData\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,mBAA8B;AAC9B,qBAAoC;AAG7B,SAAS,uBACd,aACA,aACgC;AAChC,QAAM,mBAAmD,CAAC;AAE1D,aAAW,WAAW,aAAa,oBAAoB,aAAa,WAAW,GAAG;AAChF,QAAI,UAAU,mBAAmB,OAAO;AAAG;AAE3C,UAAM,qBAAqB,YAAY,IAAI,QAAQ,IAAI;AACvD,QAAI,sBAAsB;AAAM;AAEhC,WAAO,QAAQ,kBAAkB,EAAE,QAAQ,CAAC,CAAC,UAAU,UAAU,MAAM;AACrE,YAAM,2BAAuB,oCAAoB,YAAY,QAAQ,MAAM,QAAQ,CAAC;AAEpF,UAAI,wBAAwB,MAAM;AAChC,yBAAiB,GAAG,QAAQ,GAAG,IAAI,QAAQ,EAAE,IAAI;AAAA,MACnD;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/state/translations/merge.ts"],"sourcesContent":["import { MergeTranslatableDataContext, type TranslationDto, type Data } from '@makeswift/controls'\nimport * as Documents from '../modules/read-only-documents'\nimport {\n GridPropControllerData,\n mergeGridPropControllerTranslatedData,\n Types as PropControllerTypes,\n} from '@makeswift/prop-controllers'\nimport { ReactMergeTranslationsVisitor } from '../../controls/visitors/merge-translations-visitor'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/translations/merge.ts"],"sourcesContent":["import { MergeTranslatableDataContext, type TranslationDto, type Data } from '@makeswift/controls'\nimport * as Documents from '../modules/read-only-documents'\nimport {\n GridPropControllerData,\n mergeGridPropControllerTranslatedData,\n Types as PropControllerTypes,\n} from '@makeswift/prop-controllers'\nimport { ReactMergeTranslationsVisitor } from '../../controls/visitors/merge-translations-visitor'\nimport {\n isLegacyDescriptor,\n Descriptor as PropControllerDescriptor,\n} from '../../prop-controllers/descriptors'\nimport type { DescriptorsByComponentType } from '../modules/prop-controller-descriptors'\n\nexport function mergeTranslatedContent(\n descriptors: DescriptorsByComponentType,\n elementTree: Documents.ElementData,\n translatedData: TranslationDto,\n): Documents.Element {\n function merge(descriptorsByType: DescriptorsByComponentType, translatedData: TranslationDto) {\n return function (node: Documents.Element): Documents.Element {\n if (Documents.isElementReference(node)) return node\n\n const elementDescriptors = descriptorsByType.get(node.type)\n\n if (elementDescriptors == null) {\n throw new Error(`Can't merge element of type \"${node.type}\" because it has no descriptors`)\n }\n\n const context: MergeTranslatableDataContext = {\n translatedData: translatedData,\n mergeTranslatedData: merge(descriptorsByType, translatedData),\n }\n const props = {} as Record<string, Documents.Data>\n\n for (const propName of Object.keys(elementDescriptors)) {\n const descriptor = elementDescriptors[propName]\n\n props[propName] = mergeTranslatedData(\n descriptor,\n node.props[propName],\n translatedData[`${node.key}:${propName}`],\n context,\n )\n }\n\n return { ...node, props }\n }\n }\n return merge(descriptors, translatedData)(elementTree)\n}\n\nexport function mergeTranslatedData(\n definition: PropControllerDescriptor,\n data: Data,\n translatedData: Data,\n context: MergeTranslatableDataContext,\n): Data {\n if (data == null) return data\n if (!isLegacyDescriptor(definition)) {\n const mergeTranslationsVisitor = new ReactMergeTranslationsVisitor(context)\n return definition.accept(mergeTranslationsVisitor, data, translatedData)\n }\n\n switch (definition.type) {\n case PropControllerTypes.TextInput:\n case PropControllerTypes.TextArea:\n if (translatedData == null) return data\n return translatedData\n\n case PropControllerTypes.Grid:\n return mergeGridPropControllerTranslatedData(data as GridPropControllerData, context)\n\n default:\n return data\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAA2B;AAC3B,8BAIO;AACP,wCAA8C;AAC9C,yBAGO;AAGA,SAAS,uBACd,aACA,aACA,gBACmB;AACnB,WAAS,MAAM,mBAA+CA,iBAAgC;AAC5F,WAAO,SAAU,MAA4C;AAC3D,UAAI,UAAU,mBAAmB,IAAI;AAAG,eAAO;AAE/C,YAAM,qBAAqB,kBAAkB,IAAI,KAAK,IAAI;AAE1D,UAAI,sBAAsB,MAAM;AAC9B,cAAM,IAAI,MAAM,gCAAgC,KAAK,IAAI,iCAAiC;AAAA,MAC5F;AAEA,YAAM,UAAwC;AAAA,QAC5C,gBAAgBA;AAAA,QAChB,qBAAqB,MAAM,mBAAmBA,eAAc;AAAA,MAC9D;AACA,YAAM,QAAQ,CAAC;AAEf,iBAAW,YAAY,OAAO,KAAK,kBAAkB,GAAG;AACtD,cAAM,aAAa,mBAAmB,QAAQ;AAE9C,cAAM,QAAQ,IAAI;AAAA,UAChB;AAAA,UACA,KAAK,MAAM,QAAQ;AAAA,UACnBA,gBAAe,GAAG,KAAK,GAAG,IAAI,QAAQ,EAAE;AAAA,UACxC;AAAA,QACF;AAAA,MACF;AAEA,aAAO,EAAE,GAAG,MAAM,MAAM;AAAA,IAC1B;AAAA,EACF;AACA,SAAO,MAAM,aAAa,cAAc,EAAE,WAAW;AACvD;AAEO,SAAS,oBACd,YACA,MACA,gBACA,SACM;AACN,MAAI,QAAQ;AAAM,WAAO;AACzB,MAAI,KAAC,uCAAmB,UAAU,GAAG;AACnC,UAAM,2BAA2B,IAAI,gEAA8B,OAAO;AAC1E,WAAO,WAAW,OAAO,0BAA0B,MAAM,cAAc;AAAA,EACzE;AAEA,UAAQ,WAAW,MAAM;AAAA,IACvB,KAAK,wBAAAC,MAAoB;AAAA,IACzB,KAAK,wBAAAA,MAAoB;AACvB,UAAI,kBAAkB;AAAM,eAAO;AACnC,aAAO;AAAA,IAET,KAAK,wBAAAA,MAAoB;AACvB,iBAAO,+DAAsC,MAAgC,OAAO;AAAA,IAEtF;AACE,aAAO;AAAA,EACX;AACF;","names":["translatedData","PropControllerTypes"]}
|
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
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
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -13,5 +17,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
17
|
};
|
|
14
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
19
|
var unified_state_exports = {};
|
|
20
|
+
__export(unified_state_exports, {
|
|
21
|
+
isReadWriteState: () => isReadWriteState
|
|
22
|
+
});
|
|
16
23
|
module.exports = __toCommonJS(unified_state_exports);
|
|
24
|
+
const isReadWriteState = (state) => "boxModels" in state;
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
isReadWriteState
|
|
28
|
+
});
|
|
17
29
|
//# sourceMappingURL=unified-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/unified-state.ts"],"sourcesContent":["import { type ThunkDispatch, type Reducer } from '@reduxjs/toolkit'\n\nimport { type State as ReadOnlyState } from './read-only-state'\nimport { type State as ReadWriteState } from './read-write-state'\nimport { type Action } from './actions'\n\nexport type State = ReadOnlyState | ReadWriteState\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\nexport type ReadOnlyReducer = Reducer<ReadOnlyState>\nexport type ReadWriteDispatch = ThunkDispatch<ReadWriteState, unknown, Action>\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/state/unified-state.ts"],"sourcesContent":["import { type ThunkDispatch, type Reducer } from '@reduxjs/toolkit'\n\nimport { type State as ReadOnlyState } from './read-only-state'\nimport { type State as ReadWriteState } from './read-write-state'\nimport { type Action } from './actions'\n\nexport type State = ReadOnlyState | ReadWriteState\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\nexport type ReadOnlyReducer = Reducer<ReadOnlyState>\nexport type ReadWriteDispatch = ThunkDispatch<ReadWriteState, unknown, Action>\n\nexport const isReadWriteState = (state: State): state is ReadWriteState => 'boxModels' in state\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWO,MAAM,mBAAmB,CAAC,UAA0C,eAAe;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 breakpoints_exports = {};
|
|
20
|
+
__export(breakpoints_exports, {
|
|
21
|
+
DESKTOP_MEDIA_QUERY: () => DESKTOP_MEDIA_QUERY,
|
|
22
|
+
MOBILE_MEDIA_QUERY: () => MOBILE_MEDIA_QUERY,
|
|
23
|
+
TABLET_MEDIA_QUERY: () => TABLET_MEDIA_QUERY
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(breakpoints_exports);
|
|
26
|
+
const DESKTOP_MEDIA_QUERY = "only screen and (min-width: 769px)";
|
|
27
|
+
const TABLET_MEDIA_QUERY = "only screen and (min-width: 769px)";
|
|
28
|
+
const MOBILE_MEDIA_QUERY = "only screen and (min-width: 769px)";
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
DESKTOP_MEDIA_QUERY,
|
|
32
|
+
MOBILE_MEDIA_QUERY,
|
|
33
|
+
TABLET_MEDIA_QUERY
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=breakpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/testing/breakpoints.ts"],"sourcesContent":["export const DESKTOP_MEDIA_QUERY = 'only screen and (min-width: 769px)'\nexport const TABLET_MEDIA_QUERY = 'only screen and (min-width: 769px)'\nexport const MOBILE_MEDIA_QUERY = 'only screen and (min-width: 769px)'\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;","names":[]}
|