@makeswift/runtime 0.28.8-canary.1 → 0.28.8-canary.10
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/client/index.js +1 -1
- package/dist/cjs/components/builtin/Embed/Embed.js +2 -1
- package/dist/cjs/components/builtin/Embed/Embed.js.map +1 -1
- package/dist/cjs/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
- package/dist/cjs/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map +1 -1
- package/dist/cjs/controls/index.js +4 -0
- package/dist/cjs/controls/index.js.map +1 -1
- package/dist/cjs/controls/link.js.map +1 -1
- package/dist/cjs/controls/rich-text/rich-text.js +2 -2
- package/dist/cjs/controls/rich-text/rich-text.js.map +1 -1
- package/dist/cjs/controls/rich-text-v2/control.js +2 -2
- package/dist/cjs/controls/rich-text-v2/control.js.map +1 -1
- package/dist/cjs/controls/rich-text-v2/rich-text-v2.js +2 -2
- package/dist/cjs/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/cjs/controls/serialization/base/index.js +1 -0
- package/dist/cjs/controls/serialization/base/index.js.map +1 -1
- package/dist/cjs/next/components/framework-provider/app-router/index.js +0 -2
- package/dist/cjs/next/components/framework-provider/app-router/index.js.map +1 -1
- package/dist/cjs/next/components/framework-provider/index.js +1 -1
- package/dist/cjs/next/components/framework-provider/index.js.map +1 -1
- package/dist/cjs/prop-controllers/instances.js +7 -4
- package/dist/cjs/prop-controllers/instances.js.map +1 -1
- package/dist/cjs/runtimes/react/components/framework-context.js +18 -12
- package/dist/cjs/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/cjs/runtimes/react/components/hooks/use-framework-context.js +1 -5
- package/dist/cjs/runtimes/react/components/hooks/use-framework-context.js.map +1 -1
- package/dist/cjs/runtimes/react/components/resolve-props.js +8 -1
- package/dist/cjs/runtimes/react/components/resolve-props.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js +4 -2
- package/dist/cjs/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/style.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-control-instances.js +39 -0
- package/dist/cjs/runtimes/react/hooks/use-control-instances.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js +11 -28
- package/dist/cjs/runtimes/react/hooks/use-resolved-props.js.map +1 -1
- package/dist/cjs/runtimes/react/hooks/use-stylesheet-factory.js +3 -3
- package/dist/cjs/runtimes/react/hooks/use-stylesheet-factory.js.map +1 -1
- package/dist/cjs/runtimes/react/react-runtime-core.js +2 -1
- package/dist/cjs/runtimes/react/react-runtime-core.js.map +1 -1
- package/dist/cjs/runtimes/react/stylesheet-factory.js +17 -0
- package/dist/cjs/runtimes/react/stylesheet-factory.js.map +1 -0
- package/dist/cjs/slate/TypographyPlugin/normalizeTypographyUp.js.map +1 -1
- package/dist/cjs/slate/selectors.js.map +1 -1
- package/dist/cjs/slate/utils/toText.js.map +1 -1
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js +4 -3
- package/dist/cjs/state/middleware/read-write/prop-controller-handles.js.map +1 -1
- package/dist/cjs/state/modules/components-meta.js.map +1 -1
- package/dist/cjs/state/modules/element-trees.js +48 -20
- package/dist/cjs/state/modules/element-trees.js.map +1 -1
- package/dist/cjs/state/translations/get.js +1 -4
- package/dist/cjs/state/translations/get.js.map +1 -1
- package/dist/cjs/testing/fixtures/index.js +4 -2
- package/dist/cjs/testing/fixtures/index.js.map +1 -1
- package/dist/cjs/{utils/is.js → testing/fixtures/snippet.js} +17 -7
- package/dist/cjs/testing/fixtures/snippet.js.map +1 -0
- package/dist/cjs/translations/index.js.map +1 -1
- package/dist/cjs/unstable-framework-support/index.js +2 -8
- package/dist/cjs/unstable-framework-support/index.js.map +1 -1
- package/dist/cjs/utils/intersection.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/client/index.js +1 -1
- package/dist/esm/components/builtin/Embed/Embed.js +3 -2
- package/dist/esm/components/builtin/Embed/Embed.js.map +1 -1
- package/dist/esm/components/builtin/Navigation/components/DropDownButton/index.js +5 -1
- package/dist/esm/components/builtin/Navigation/components/DropDownButton/index.js.map +1 -1
- package/dist/esm/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js +5 -1
- package/dist/esm/components/shared/BackgroundsContainer/components/BackgroundVideo/index.js.map +1 -1
- package/dist/esm/controls/index.js +4 -0
- package/dist/esm/controls/index.js.map +1 -1
- package/dist/esm/controls/link.js.map +1 -1
- package/dist/esm/controls/rich-text/rich-text.js +2 -2
- package/dist/esm/controls/rich-text/rich-text.js.map +1 -1
- package/dist/esm/controls/rich-text-v2/control.js +2 -2
- package/dist/esm/controls/rich-text-v2/control.js.map +1 -1
- package/dist/esm/controls/rich-text-v2/rich-text-v2.js +2 -2
- package/dist/esm/controls/rich-text-v2/rich-text-v2.js.map +1 -1
- package/dist/esm/controls/serialization/base/index.js +2 -0
- package/dist/esm/controls/serialization/base/index.js.map +1 -1
- package/dist/esm/next/components/framework-provider/app-router/index.js +0 -4
- package/dist/esm/next/components/framework-provider/app-router/index.js.map +1 -1
- package/dist/esm/next/components/framework-provider/index.js +4 -2
- package/dist/esm/next/components/framework-provider/index.js.map +1 -1
- package/dist/esm/prop-controllers/instances.js +7 -4
- package/dist/esm/prop-controllers/instances.js.map +1 -1
- package/dist/esm/runtimes/react/components/framework-context.js +19 -8
- package/dist/esm/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/esm/runtimes/react/components/hooks/use-framework-context.js +1 -5
- package/dist/esm/runtimes/react/components/hooks/use-framework-context.js.map +1 -1
- package/dist/esm/runtimes/react/components/resolve-props.js +8 -1
- package/dist/esm/runtimes/react/components/resolve-props.js.map +1 -1
- package/dist/esm/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js +4 -2
- package/dist/esm/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.js.map +1 -1
- package/dist/esm/runtimes/react/controls/style.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-control-instances.js +15 -0
- package/dist/esm/runtimes/react/hooks/use-control-instances.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js +10 -17
- package/dist/esm/runtimes/react/hooks/use-resolved-props.js.map +1 -1
- package/dist/esm/runtimes/react/hooks/use-stylesheet-factory.js +3 -3
- package/dist/esm/runtimes/react/hooks/use-stylesheet-factory.js.map +1 -1
- package/dist/esm/runtimes/react/react-runtime-core.js +2 -1
- package/dist/esm/runtimes/react/react-runtime-core.js.map +1 -1
- package/dist/esm/runtimes/react/stylesheet-factory.js +1 -0
- package/dist/esm/runtimes/react/stylesheet-factory.js.map +1 -0
- package/dist/esm/slate/TypographyPlugin/normalizeTypographyUp.js.map +1 -1
- package/dist/esm/slate/selectors.js.map +1 -1
- package/dist/esm/slate/utils/toText.js.map +1 -1
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js +4 -3
- package/dist/esm/state/middleware/read-write/prop-controller-handles.js.map +1 -1
- package/dist/esm/state/modules/components-meta.js.map +1 -1
- package/dist/esm/state/modules/element-trees.js +48 -20
- package/dist/esm/state/modules/element-trees.js.map +1 -1
- package/dist/esm/state/translations/get.js +1 -4
- package/dist/esm/state/translations/get.js.map +1 -1
- package/dist/esm/testing/fixtures/index.js +2 -1
- package/dist/esm/testing/fixtures/index.js.map +1 -1
- package/dist/esm/testing/fixtures/snippet.js +12 -0
- package/dist/esm/testing/fixtures/snippet.js.map +1 -0
- package/dist/esm/translations/index.js.map +1 -1
- package/dist/esm/unstable-framework-support/index.js +2 -8
- package/dist/esm/unstable-framework-support/index.js.map +1 -1
- package/dist/esm/utils/intersection.js.map +1 -1
- package/dist/types/components/builtin/Embed/Embed.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts.map +1 -1
- package/dist/types/components/shared/BackgroundsContainer/components/BackgroundVideo/index.d.ts.map +1 -1
- package/dist/types/controls/index.d.ts +1 -1
- package/dist/types/controls/index.d.ts.map +1 -1
- package/dist/types/controls/rich-text/rich-text.d.ts +2 -2
- package/dist/types/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/controls/rich-text-v2/control.d.ts +2 -2
- package/dist/types/controls/rich-text-v2/control.d.ts.map +1 -1
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts +2 -2
- package/dist/types/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/controls/serialization/base/index.d.ts.map +1 -1
- package/dist/types/next/components/framework-provider/app-router/index.d.ts +1 -1
- package/dist/types/next/components/framework-provider/app-router/index.d.ts.map +1 -1
- package/dist/types/next/components/framework-provider/index.d.ts.map +1 -1
- package/dist/types/prop-controllers/instances.d.ts +4 -2
- package/dist/types/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/__tests__/framework-context.test.d.ts +3 -0
- package/dist/types/runtimes/react/components/__tests__/framework-context.test.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/framework-context.d.ts +4 -6
- package/dist/types/runtimes/react/components/framework-context.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/hooks/use-framework-context.d.ts +1 -2
- package/dist/types/runtimes/react/components/hooks/use-framework-context.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/useSyncWithBuilder.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-control-instances.d.ts +3 -0
- package/dist/types/runtimes/react/hooks/use-control-instances.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts +7 -1
- package/dist/types/runtimes/react/hooks/use-resolved-props.d.ts.map +1 -1
- package/dist/types/runtimes/react/hooks/use-stylesheet-factory.d.ts +1 -5
- package/dist/types/runtimes/react/hooks/use-stylesheet-factory.d.ts.map +1 -1
- package/dist/types/runtimes/react/react-runtime-core.d.ts +9 -1
- package/dist/types/runtimes/react/react-runtime-core.d.ts.map +1 -1
- package/dist/types/runtimes/react/stylesheet-factory.d.ts +6 -0
- package/dist/types/runtimes/react/stylesheet-factory.d.ts.map +1 -0
- package/dist/types/slate/LinkPlugin/getValue.d.ts.map +1 -1
- package/dist/types/slate/LinkPlugin/index.d.ts.map +1 -1
- package/dist/types/slate/TypographyPlugin/getValue.d.ts.map +1 -1
- package/dist/types/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/slate/selectors.d.ts +2 -2
- package/dist/types/slate/selectors.d.ts.map +1 -1
- package/dist/types/slate/utils/toText.d.ts.map +1 -1
- package/dist/types/state/__tests__/fixtures/serialized-descriptors-from-builder.d.ts.map +1 -1
- package/dist/types/state/__tests__/fixtures/translatable-content-sample.d.ts.map +1 -1
- package/dist/types/state/middleware/read-write/prop-controller-handles.d.ts.map +1 -1
- package/dist/types/state/modules/__tests__/fixtures/element-trees.d.ts +737 -0
- package/dist/types/state/modules/__tests__/fixtures/element-trees.d.ts.map +1 -1
- package/dist/types/state/modules/components-meta.d.ts +3 -0
- package/dist/types/state/modules/components-meta.d.ts.map +1 -1
- package/dist/types/state/translations/get.d.ts.map +1 -1
- package/dist/types/testing/fixtures/index.d.ts +2 -1
- package/dist/types/testing/fixtures/index.d.ts.map +1 -1
- package/dist/types/testing/fixtures/snippet.d.ts +6 -0
- package/dist/types/testing/fixtures/snippet.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/dist/types/unstable-framework-support/index.d.ts +1 -1
- package/dist/types/unstable-framework-support/index.d.ts.map +1 -1
- package/dist/types/utils/intersection.d.ts +2 -1
- package/dist/types/utils/intersection.d.ts.map +1 -1
- package/package.json +8 -5
- package/react/builtins/package.json +1 -1
- package/dist/cjs/runtimes/react/controls/group.js +0 -45
- package/dist/cjs/runtimes/react/controls/group.js.map +0 -1
- package/dist/cjs/utils/is.js.map +0 -1
- package/dist/esm/runtimes/react/controls/group.js +0 -23
- package/dist/esm/runtimes/react/controls/group.js.map +0 -1
- package/dist/esm/utils/is.js +0 -6
- package/dist/esm/utils/is.js.map +0 -1
- package/dist/types/runtimes/react/controls/group.d.ts +0 -11
- package/dist/types/runtimes/react/controls/group.d.ts.map +0 -1
- package/dist/types/utils/is.d.ts +0 -3
- package/dist/types/utils/is.d.ts.map +0 -1
|
@@ -23,13 +23,20 @@ __export(resolve_props_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(resolve_props_exports);
|
|
24
24
|
var import_use_control_defs = require("../hooks/use-control-defs");
|
|
25
25
|
var import_use_resolved_props = require("../hooks/use-resolved-props");
|
|
26
|
+
var import_use_stylesheet_factory = require("../hooks/use-stylesheet-factory");
|
|
26
27
|
var import_legacy_controls = require("../legacy-controls");
|
|
27
28
|
function ResolveProps({
|
|
28
29
|
element,
|
|
29
30
|
children: renderComponent
|
|
30
31
|
}) {
|
|
31
32
|
const [legacyDescriptors, definitions] = (0, import_use_control_defs.useControlDefs)({ elementType: element.type });
|
|
32
|
-
const
|
|
33
|
+
const stylesheetFactory = (0, import_use_stylesheet_factory.useStylesheetFactory)();
|
|
34
|
+
const resolvedProps = (0, import_use_resolved_props.useResolvedProps)({
|
|
35
|
+
propDefs: definitions,
|
|
36
|
+
propData: element.props,
|
|
37
|
+
elementKey: element.key,
|
|
38
|
+
stylesheetFactory
|
|
39
|
+
});
|
|
33
40
|
const renderFn = Object.entries(legacyDescriptors).reduceRight(
|
|
34
41
|
(renderFn2, [propName, descriptor]) => (props) => (0, import_legacy_controls.resolveLegacyDescriptorProp)(descriptor, propName, element.props[propName], props, renderFn2),
|
|
35
42
|
renderComponent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/components/resolve-props.tsx"],"sourcesContent":["import { type ReactNode } from 'react'\n\nimport { type ElementData } from '../../../state/read-only-state'\n\nimport { useControlDefs } from '../hooks/use-control-defs'\nimport { useResolvedProps } from '../hooks/use-resolved-props'\n\nimport { resolveLegacyDescriptorProp } from '../legacy-controls'\n\nexport function ResolveProps({\n element,\n children: renderComponent,\n}: {\n element: ElementData\n children: (props: Record<string, unknown>) => ReactNode\n}): ReactNode {\n const [legacyDescriptors, definitions] = useControlDefs({ elementType: element.type })\n\n const resolvedProps = useResolvedProps(definitions
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/components/resolve-props.tsx"],"sourcesContent":["import { type ReactNode } from 'react'\n\nimport { type ElementData } from '../../../state/read-only-state'\n\nimport { useControlDefs } from '../hooks/use-control-defs'\nimport { useResolvedProps } from '../hooks/use-resolved-props'\nimport { useStylesheetFactory } from '../hooks/use-stylesheet-factory'\n\nimport { resolveLegacyDescriptorProp } from '../legacy-controls'\n\nexport function ResolveProps({\n element,\n children: renderComponent,\n}: {\n element: ElementData\n children: (props: Record<string, unknown>) => ReactNode\n}): ReactNode {\n const [legacyDescriptors, definitions] = useControlDefs({ elementType: element.type })\n\n const stylesheetFactory = useStylesheetFactory()\n const resolvedProps = useResolvedProps({\n propDefs: definitions,\n propData: element.props,\n elementKey: element.key,\n stylesheetFactory,\n })\n\n const renderFn = Object.entries(legacyDescriptors).reduceRight(\n (renderFn, [propName, descriptor]) =>\n props =>\n resolveLegacyDescriptorProp(descriptor, propName, element.props[propName], props, renderFn),\n renderComponent,\n )\n\n return renderFn(resolvedProps)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,8BAA+B;AAC/B,gCAAiC;AACjC,oCAAqC;AAErC,6BAA4C;AAErC,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA,UAAU;AACZ,GAGc;AACZ,QAAM,CAAC,mBAAmB,WAAW,QAAI,wCAAe,EAAE,aAAa,QAAQ,KAAK,CAAC;AAErF,QAAM,wBAAoB,oDAAqB;AAC/C,QAAM,oBAAgB,4CAAiB;AAAA,IACrC,UAAU;AAAA,IACV,UAAU,QAAQ;AAAA,IAClB,YAAY,QAAQ;AAAA,IACpB;AAAA,EACF,CAAC;AAED,QAAM,WAAW,OAAO,QAAQ,iBAAiB,EAAE;AAAA,IACjD,CAACA,WAAU,CAAC,UAAU,UAAU,MAC9B,eACE,oDAA4B,YAAY,UAAU,QAAQ,MAAM,QAAQ,GAAG,OAAOA,SAAQ;AAAA,IAC9F;AAAA,EACF;AAEA,SAAO,SAAS,aAAa;AAC/B;","names":["renderFn"]}
|
|
@@ -32,6 +32,7 @@ __export(useSyncWithBuilder_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(useSyncWithBuilder_exports);
|
|
34
34
|
var import_react = require("react");
|
|
35
|
+
var import_slate = require("slate");
|
|
35
36
|
var import_controls = require("@makeswift/controls");
|
|
36
37
|
var import_use_is_in_builder = require("../../../hooks/use-is-in-builder");
|
|
37
38
|
var import_deepEqual = __toESM(require("../../../../../utils/deepEqual"));
|
|
@@ -43,13 +44,14 @@ function useSyncWithBuilder(editor, text) {
|
|
|
43
44
|
if (shouldCommit && text && isInBuilder) {
|
|
44
45
|
const nextValue = (0, import_controls.richTextDTOtoDAO)(text);
|
|
45
46
|
const nextSelection = (0, import_controls.richTextDTOtoSelection)(text);
|
|
46
|
-
|
|
47
|
+
const sameSelection = editor.selection == null || nextSelection == null ? editor.selection == nextSelection : import_slate.Range.equals(editor.selection, nextSelection);
|
|
48
|
+
if (!(0, import_deepEqual.default)(editor.children, nextValue) || !sameSelection) {
|
|
47
49
|
editor.children = nextValue;
|
|
48
50
|
editor.selection = nextSelection;
|
|
49
51
|
editor.onChange();
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
|
-
}, [editor, shouldCommit, text]);
|
|
54
|
+
}, [editor, isInBuilder, shouldCommit, text]);
|
|
53
55
|
(0, import_react.useEffect)(() => {
|
|
54
56
|
if (shouldCommit)
|
|
55
57
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.tsx"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react'\nimport { Editor } from 'slate'\nimport { type RichTextDTO, richTextDTOtoDAO, richTextDTOtoSelection } from '@makeswift/controls'\n\nimport { useIsInBuilder } from '../../../hooks/use-is-in-builder'\nimport deepEqual from '../../../../../utils/deepEqual'\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\n/**\n * Compare new prop value with current editor and update editor\n * if the values are not equal.\n */\nexport function useSyncWithBuilder(editor: Editor, text?: RichTextDTO) {\n const [shouldCommit, setShouldCommit] = useState(true)\n const isInBuilder = useIsInBuilder()\n\n useEffect(() => {\n if (shouldCommit && text && isInBuilder) {\n const nextValue = richTextDTOtoDAO(text)\n const nextSelection = richTextDTOtoSelection(text)\n if (!deepEqual(editor.children, nextValue) || !
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.tsx"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react'\nimport { Editor, Range } from 'slate'\nimport { type RichTextDTO, richTextDTOtoDAO, richTextDTOtoSelection } from '@makeswift/controls'\n\nimport { useIsInBuilder } from '../../../hooks/use-is-in-builder'\nimport deepEqual from '../../../../../utils/deepEqual'\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\n/**\n * Compare new prop value with current editor and update editor\n * if the values are not equal.\n */\nexport function useSyncWithBuilder(editor: Editor, text?: RichTextDTO) {\n const [shouldCommit, setShouldCommit] = useState(true)\n const isInBuilder = useIsInBuilder()\n\n useEffect(() => {\n if (shouldCommit && text && isInBuilder) {\n const nextValue = richTextDTOtoDAO(text)\n const nextSelection = richTextDTOtoSelection(text)\n const sameSelection =\n editor.selection == null || nextSelection == null\n ? editor.selection == nextSelection\n : Range.equals(editor.selection, nextSelection)\n\n if (!deepEqual(editor.children, nextValue) || !sameSelection) {\n editor.children = nextValue\n editor.selection = nextSelection\n editor.onChange()\n }\n }\n }, [editor, isInBuilder, shouldCommit, text])\n\n useEffect(() => {\n if (shouldCommit) return\n\n const timeoutId = window.setTimeout(() => {\n setShouldCommit(true)\n }, COMMIT_DEBOUNCE_DELAY)\n\n return () => {\n window.clearTimeout(timeoutId)\n }\n }, [shouldCommit])\n\n return useCallback(() => setShouldCommit(false), [])\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiD;AACjD,mBAA8B;AAC9B,sBAA2E;AAE3E,+BAA+B;AAC/B,uBAAsB;AAEtB,MAAM,wBAAwB;AAMvB,SAAS,mBAAmB,QAAgB,MAAoB;AACrE,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAS,IAAI;AACrD,QAAM,kBAAc,yCAAe;AAEnC,8BAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ,aAAa;AACvC,YAAM,gBAAY,kCAAiB,IAAI;AACvC,YAAM,oBAAgB,wCAAuB,IAAI;AACjD,YAAM,gBACJ,OAAO,aAAa,QAAQ,iBAAiB,OACzC,OAAO,aAAa,gBACpB,mBAAM,OAAO,OAAO,WAAW,aAAa;AAElD,UAAI,KAAC,iBAAAA,SAAU,OAAO,UAAU,SAAS,KAAK,CAAC,eAAe;AAC5D,eAAO,WAAW;AAClB,eAAO,YAAY;AACnB,eAAO,SAAS;AAAA,MAClB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,aAAa,cAAc,IAAI,CAAC;AAE5C,8BAAU,MAAM;AACd,QAAI;AAAc;AAElB,UAAM,YAAY,OAAO,WAAW,MAAM;AACxC,sBAAgB,IAAI;AAAA,IACtB,GAAG,qBAAqB;AAExB,WAAO,MAAM;AACX,aAAO,aAAa,SAAS;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,YAAY,CAAC;AAEjB,aAAO,0BAAY,MAAM,gBAAgB,KAAK,GAAG,CAAC,CAAC;AACrD;","names":["deepEqual"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/controls/style.ts"],"sourcesContent":["import { type CSSObject } from '@emotion/serialize'\nimport {\n Style,\n type StyleProperty,\n type ResolvedBorderSideData,\n type FontSizePropertyData,\n type WidthPropertyData,\n type ResolvedStyleData,\n} from '@makeswift/controls'\n\nimport { colorToString } from '../../../components/utils/colorToString'\nimport { responsiveStyle } from '../../../components/utils/responsive-style'\n\nimport { BorderRadiusLonghandPropertyData } from '../../../css/border-radius'\nimport { lengthPercentageDataToString } from '../../../css/length-percentage'\nimport { marginPropertyDataToStyle } from '../../../css/margin'\nimport { paddingPropertyDataToStyle } from '../../../css/padding'\nimport { Breakpoints } from '../../../state/modules/breakpoints'\n\nconst defaultMargin = {\n marginTop: 0,\n marginRight: 'auto',\n marginBottom: 0,\n marginLeft: 'auto',\n}\n\nconst defaultPadding = {\n paddingTop: 0,\n paddingRight: 0,\n paddingBottom: 0,\n paddingLeft: 0,\n}\n\nexport function styleV1Css(\n breakpoints: Breakpoints,\n style: ResolvedStyleData | undefined,\n properties: StyleProperty[],\n): CSSObject {\n return {\n ...(properties.includes(Style.Width) && {\n maxWidth: '100%',\n }),\n ...responsiveStyle(\n breakpoints,\n [\n style?.width,\n style?.margin,\n style?.padding,\n style?.border,\n style?.borderRadius,\n style?.textStyle,\n ] as const,\n ([width, margin, padding, border, borderRadius, textStyle]) => ({\n ...(properties.includes(Style.Width) && {\n width: widthToString(width) ?? '100%',\n }),\n ...(properties.includes(Style.Margin) &&\n marginPropertyDataToStyle(margin ?? defaultMargin, defaultMargin)),\n ...(properties.includes(Style.Padding) &&\n paddingPropertyDataToStyle(padding ?? defaultPadding, defaultPadding)),\n ...(properties.includes(Style.Border) && {\n borderTop: borderSideToString(border?.borderTop) ?? '0 solid black',\n borderRight: borderSideToString(border?.borderRight) ?? '0 solid black',\n borderBottom: borderSideToString(border?.borderBottom) ?? '0 solid black',\n borderLeft: borderSideToString(border?.borderLeft) ?? '0 solid black',\n }),\n ...(properties.includes(Style.BorderRadius) && {\n borderTopLeftRadius: borderRadiusToString(borderRadius?.borderTopLeftRadius) ?? 0,\n borderTopRightRadius: borderRadiusToString(borderRadius?.borderTopRightRadius) ?? 0,\n borderBottomRightRadius: borderRadiusToString(borderRadius?.borderBottomRightRadius) ?? 0,\n borderBottomLeftRadius: borderRadiusToString(borderRadius?.borderBottomLeftRadius) ?? 0,\n }),\n ...(properties.includes(Style.TextStyle) && {\n ...(textStyle?.fontFamily && {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/controls/style.ts"],"sourcesContent":["import { type CSSObject } from '@emotion/serialize'\nimport {\n Style,\n type StyleProperty,\n type ResolvedBorderSideData,\n type FontSizePropertyData,\n type WidthPropertyData,\n type ResolvedStyleData,\n} from '@makeswift/controls'\n\nimport { colorToString } from '../../../components/utils/colorToString'\nimport { responsiveStyle } from '../../../components/utils/responsive-style'\n\nimport { BorderRadiusLonghandPropertyData } from '../../../css/border-radius'\nimport { lengthPercentageDataToString } from '../../../css/length-percentage'\nimport { marginPropertyDataToStyle } from '../../../css/margin'\nimport { paddingPropertyDataToStyle } from '../../../css/padding'\nimport { Breakpoints } from '../../../state/modules/breakpoints'\n\nconst defaultMargin = {\n marginTop: 0,\n marginRight: 'auto',\n marginBottom: 0,\n marginLeft: 'auto',\n}\n\nconst defaultPadding = {\n paddingTop: 0,\n paddingRight: 0,\n paddingBottom: 0,\n paddingLeft: 0,\n}\n\nexport function styleV1Css(\n breakpoints: Breakpoints,\n style: ResolvedStyleData | undefined,\n properties: StyleProperty[],\n): CSSObject {\n return {\n ...(properties.includes(Style.Width) && {\n maxWidth: '100%',\n }),\n ...responsiveStyle(\n breakpoints,\n [\n style?.width,\n style?.margin,\n style?.padding,\n style?.border,\n style?.borderRadius,\n style?.textStyle,\n ] as const,\n ([width, margin, padding, border, borderRadius, textStyle]) => ({\n ...(properties.includes(Style.Width) && {\n width: widthToString(width) ?? '100%',\n }),\n ...(properties.includes(Style.Margin) &&\n marginPropertyDataToStyle(margin ?? defaultMargin, defaultMargin)),\n ...(properties.includes(Style.Padding) &&\n paddingPropertyDataToStyle(padding ?? defaultPadding, defaultPadding)),\n ...(properties.includes(Style.Border) && {\n borderTop: borderSideToString(border?.borderTop) ?? '0 solid black',\n borderRight: borderSideToString(border?.borderRight) ?? '0 solid black',\n borderBottom: borderSideToString(border?.borderBottom) ?? '0 solid black',\n borderLeft: borderSideToString(border?.borderLeft) ?? '0 solid black',\n }),\n ...(properties.includes(Style.BorderRadius) && {\n borderTopLeftRadius: borderRadiusToString(borderRadius?.borderTopLeftRadius) ?? 0,\n borderTopRightRadius: borderRadiusToString(borderRadius?.borderTopRightRadius) ?? 0,\n borderBottomRightRadius: borderRadiusToString(borderRadius?.borderBottomRightRadius) ?? 0,\n borderBottomLeftRadius: borderRadiusToString(borderRadius?.borderBottomLeftRadius) ?? 0,\n }),\n ...(properties.includes(Style.TextStyle) && {\n ...(textStyle?.fontFamily && {\n fontFamily: textStyle.fontFamily.toLowerCase().startsWith('var(')\n ? textStyle.fontFamily\n : `\"${textStyle.fontFamily}\"`,\n }),\n ...(textStyle?.letterSpacing && { letterSpacing: textStyle.letterSpacing }),\n ...(textStyle?.fontSize && { fontSize: fontSizeToString(textStyle.fontSize) }),\n ...(textStyle?.fontWeight && { fontWeight: textStyle.fontWeight }),\n textTransform: textStyle?.textTransform ?? [],\n fontStyle: textStyle?.fontStyle ?? [],\n }),\n }),\n ),\n }\n\n function widthToString(widthProperty: WidthPropertyData | undefined): string | null {\n if (widthProperty == null) return null\n\n return lengthPercentageDataToString(widthProperty)\n }\n\n function borderSideToString(\n borderSide: ResolvedBorderSideData | null | undefined,\n ): string | null {\n if (borderSide == null) return null\n\n const { width, color, style } = borderSide\n return `${width != null ? width : 0}px ${style} ${\n color != null ? colorToString(color) : 'black'\n }`\n }\n\n function borderRadiusToString(\n borderRadius: BorderRadiusLonghandPropertyData | null | undefined,\n ): string | null {\n if (borderRadius == null) return null\n\n return lengthPercentageDataToString(borderRadius)\n }\n\n function fontSizeToString(fontSize: NonNullable<FontSizePropertyData>) {\n return `${fontSize.value}${fontSize.unit}`\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAOO;AAEP,2BAA8B;AAC9B,8BAAgC;AAGhC,+BAA6C;AAC7C,oBAA0C;AAC1C,qBAA2C;AAG3C,MAAM,gBAAgB;AAAA,EACpB,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AACd;AAEA,MAAM,iBAAiB;AAAA,EACrB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AACf;AAEO,SAAS,WACd,aACA,OACA,YACW;AACX,SAAO;AAAA,IACL,GAAI,WAAW,SAAS,sBAAM,KAAK,KAAK;AAAA,MACtC,UAAU;AAAA,IACZ;AAAA,IACA,OAAG;AAAA,MACD;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,MACA,CAAC,CAAC,OAAO,QAAQ,SAAS,QAAQ,cAAc,SAAS,OAAO;AAAA,QAC9D,GAAI,WAAW,SAAS,sBAAM,KAAK,KAAK;AAAA,UACtC,OAAO,cAAc,KAAK,KAAK;AAAA,QACjC;AAAA,QACA,GAAI,WAAW,SAAS,sBAAM,MAAM,SAClC,yCAA0B,UAAU,eAAe,aAAa;AAAA,QAClE,GAAI,WAAW,SAAS,sBAAM,OAAO,SACnC,2CAA2B,WAAW,gBAAgB,cAAc;AAAA,QACtE,GAAI,WAAW,SAAS,sBAAM,MAAM,KAAK;AAAA,UACvC,WAAW,mBAAmB,QAAQ,SAAS,KAAK;AAAA,UACp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AgB;AAAM,aAAO;AAEjC,eAAO,uDAA6B,YAAY;AAAA,EAClD;AAEA,WAAS,iBAAiB,UAA6C;AACrE,WAAO,GAAG,SAAS,KAAK,GAAG,SAAS,IAAI;AAAA,EAC1C;AACF;","names":["style"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 use_control_instances_exports = {};
|
|
20
|
+
__export(use_control_instances_exports, {
|
|
21
|
+
useControlInstances: () => useControlInstances
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(use_control_instances_exports);
|
|
24
|
+
var import_read_only_state = require("../../../state/read-only-state");
|
|
25
|
+
var import_use_document_context = require("./use-document-context");
|
|
26
|
+
var import_use_selector = require("./use-selector");
|
|
27
|
+
function useControlInstances(elementKey) {
|
|
28
|
+
const documentKey = (0, import_use_document_context.useDocumentKey)();
|
|
29
|
+
return (0, import_use_selector.useSelector)((state) => {
|
|
30
|
+
if (documentKey == null)
|
|
31
|
+
return null;
|
|
32
|
+
return (0, import_read_only_state.getPropControllers)(state, { documentKey, elementKey });
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
useControlInstances
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=use-control-instances.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-control-instances.ts"],"sourcesContent":["import { ControlInstance } from '@makeswift/controls'\n\nimport { getPropControllers } from '../../../state/read-only-state'\nimport { useDocumentKey } from './use-document-context'\nimport { useSelector } from './use-selector'\n\nexport function useControlInstances(elementKey: string): Record<string, ControlInstance> | null {\n const documentKey = useDocumentKey()\n\n return useSelector(state => {\n if (documentKey == null) return null\n\n return getPropControllers(state, { documentKey, elementKey })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,6BAAmC;AACnC,kCAA+B;AAC/B,0BAA4B;AAErB,SAAS,oBAAoB,YAA4D;AAC9F,QAAM,kBAAc,4CAAe;AAEnC,aAAO,iCAAY,WAAS;AAC1B,QAAI,eAAe;AAAM,aAAO;AAEhC,eAAO,2CAAmB,OAAO,EAAE,aAAa,WAAW,CAAC;AAAA,EAC9D,CAAC;AACH;","names":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var use_resolved_props_exports = {};
|
|
30
20
|
__export(use_resolved_props_exports, {
|
|
@@ -33,29 +23,22 @@ __export(use_resolved_props_exports, {
|
|
|
33
23
|
module.exports = __toCommonJS(use_resolved_props_exports);
|
|
34
24
|
var import_react = require("react");
|
|
35
25
|
var import_controls = require("@makeswift/controls");
|
|
36
|
-
var ReactPage = __toESM(require("../../../state/read-only-state"));
|
|
37
26
|
var import_use_resource_resolver = require("./use-resource-resolver");
|
|
38
|
-
var import_use_document_context = require("./use-document-context");
|
|
39
|
-
var import_use_selector = require("./use-selector");
|
|
40
|
-
var import_use_stylesheet_factory = require("./use-stylesheet-factory");
|
|
41
|
-
var import_use_resolvable_record = require("./use-resolvable-record");
|
|
42
27
|
var import_prop_error_handling_proxy = require("../utils/prop-error-handling-proxy");
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
function useResolvedProps(propDefs, elementData, elementKey) {
|
|
52
|
-
const stylesheetFactory = (0, import_use_stylesheet_factory.useStylesheetFactory)();
|
|
28
|
+
var import_use_control_instances = require("./use-control-instances");
|
|
29
|
+
var import_use_resolvable_record = require("./use-resolvable-record");
|
|
30
|
+
function useResolvedProps({
|
|
31
|
+
propDefs,
|
|
32
|
+
propData,
|
|
33
|
+
elementKey,
|
|
34
|
+
stylesheetFactory
|
|
35
|
+
}) {
|
|
53
36
|
const resourceResolver = (0, import_use_resource_resolver.useResourceResolver)();
|
|
54
|
-
const controls = useControlInstances(elementKey);
|
|
37
|
+
const controls = (0, import_use_control_instances.useControlInstances)(elementKey);
|
|
55
38
|
const cache = (0, import_react.useRef)({}).current;
|
|
56
39
|
const resolveProp = (0, import_react.useCallback)(
|
|
57
40
|
(def, propName) => {
|
|
58
|
-
const data =
|
|
41
|
+
const data = propData[propName];
|
|
59
42
|
const control = controls?.[propName];
|
|
60
43
|
if (cache[propName] != null && data === cache[propName].data && control === cache[propName].control) {
|
|
61
44
|
return cache[propName].resolvedValue;
|
|
@@ -69,7 +52,7 @@ function useResolvedProps(propDefs, elementData, elementKey) {
|
|
|
69
52
|
cache[propName] = { data, control, resolvedValue };
|
|
70
53
|
return resolvedValue;
|
|
71
54
|
},
|
|
72
|
-
[controls,
|
|
55
|
+
[controls, propData, resourceResolver, stylesheetFactory]
|
|
73
56
|
);
|
|
74
57
|
const resolvables = (0, import_react.useMemo)(
|
|
75
58
|
() => (0, import_controls.mapValues)(propDefs, (def, propName) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-resolved-props.ts"],"sourcesContent":["import { useMemo, useEffect, useRef, useSyncExternalStore, useCallback } from 'react'\nimport {\n ControlDefinition,\n ControlInstance,\n mapValues,\n type Data,\n type Resolvable,\n} from '@makeswift/controls'\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-resolved-props.ts"],"sourcesContent":["import { useMemo, useEffect, useRef, useSyncExternalStore, useCallback } from 'react'\nimport {\n ControlDefinition,\n ControlInstance,\n mapValues,\n type Data,\n type Resolvable,\n} from '@makeswift/controls'\n\nimport { useResourceResolver } from './use-resource-resolver'\n\nimport { type StylesheetFactory } from '../stylesheet-factory'\nimport { propErrorHandlingProxy } from '../utils/prop-error-handling-proxy'\n\nimport { useControlInstances } from './use-control-instances'\nimport { useResolvableRecord } from './use-resolvable-record'\n\ntype CacheItem = {\n data: Data\n control: ControlInstance | undefined\n resolvedValue: Resolvable<unknown>\n}\n\nexport function useResolvedProps({\n propDefs,\n propData,\n elementKey,\n stylesheetFactory,\n}: {\n propDefs: Record<string, ControlDefinition>\n propData: Record<string, Data>\n elementKey: string\n stylesheetFactory: StylesheetFactory\n}): Record<string, unknown> {\n const resourceResolver = useResourceResolver()\n const controls = useControlInstances(elementKey)\n\n const cache = useRef<Record<string, CacheItem>>({}).current\n const resolveProp = useCallback(\n (def: ControlDefinition, propName: string) => {\n const data = propData[propName]\n const control = controls?.[propName]\n\n if (\n cache[propName] != null &&\n data === cache[propName].data &&\n control === cache[propName].control\n ) {\n return cache[propName].resolvedValue\n }\n\n const resolvedValue = def.resolveValue(\n data,\n resourceResolver,\n stylesheetFactory.get(propName),\n control,\n )\n\n cache[propName] = { data, control, resolvedValue }\n return resolvedValue\n },\n [controls, propData, resourceResolver, stylesheetFactory],\n )\n\n const resolvables = useMemo<Record<string, Resolvable<unknown>>>(\n () =>\n mapValues(propDefs, (def, propName) => {\n const defaultValue = (def.config as any)?.defaultValue\n return propErrorHandlingProxy(resolveProp(def, propName), defaultValue, error => {\n console.warn(\n `Error reading value for prop \"${propName}\", falling back to \\`${defaultValue}\\`.`,\n { control: def, error },\n )\n })\n }),\n [propDefs, resolveProp],\n )\n\n const props = useResolvableRecord(resolvables)\n\n // no need to call `triggerResolve` on the server, all the resources should already be in\n // the host API client's cache (populated from the snapshot's cache)\n useEffect(() => {\n props.triggerResolve()\n }, [props])\n\n // the order is important here, the styles are defined in the process of the props resolution,\n // calling `useDefinedStyles` before the props are resolved would effectively be a noop\n const resolvedProps = useSyncExternalStore(props.subscribe, props.readStable, props.readStable)\n\n stylesheetFactory.useDefinedStyles()\n\n return resolvedProps\n}\n"],"mappings":";;;;;;;;;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AA,EACvB,GAAG,CAAC,KAAK,CAAC;AAIV,QAAM,oBAAgB,mCAAqB,MAAM,WAAW,MAAM,YAAY,MAAM,UAAU;AAE9F,oBAAkB,iBAAiB;AAEnC,SAAO;AACT;","names":[]}
|
|
@@ -24,12 +24,12 @@ module.exports = __toCommonJS(use_stylesheet_factory_exports);
|
|
|
24
24
|
var import_react = require("react");
|
|
25
25
|
var import_serialize = require("@emotion/serialize");
|
|
26
26
|
var import_controls = require("@makeswift/controls");
|
|
27
|
-
var import_root_style_registry = require("../root-style-registry");
|
|
28
27
|
var import_resolved_style_to_css = require("../lib/resolved-style-to-css");
|
|
28
|
+
var import_poll_box_model = require("../poll-box-model");
|
|
29
|
+
var import_root_style_registry = require("../root-style-registry");
|
|
30
|
+
var import_use_style = require("../use-style");
|
|
29
31
|
var import_use_breakpoints = require("./use-breakpoints");
|
|
30
32
|
var import_use_css_id = require("./use-css-id");
|
|
31
|
-
var import_use_style = require("../use-style");
|
|
32
|
-
var import_poll_box_model = require("../poll-box-model");
|
|
33
33
|
function useStylesheetFactory() {
|
|
34
34
|
const breakpoints = (0, import_use_breakpoints.useBreakpoints)();
|
|
35
35
|
const cache = (0, import_root_style_registry.useCache)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-stylesheet-factory.ts"],"sourcesContent":["import { useMemo, useEffect, useRef } from 'react'\nimport { serializeStyles } from '@emotion/serialize'\nimport { type EmotionCache } from '@emotion/cache'\nimport { type SerializedStyles } from '@emotion/utils'\n\nimport {\n type BoxDisplayModel,\n type Breakpoints,\n type Stylesheet,\n type ResolvedStyle,\n isNotNil,\n} from '@makeswift/controls'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-stylesheet-factory.ts"],"sourcesContent":["import { useMemo, useEffect, useRef } from 'react'\nimport { serializeStyles } from '@emotion/serialize'\nimport { type EmotionCache } from '@emotion/cache'\nimport { type SerializedStyles } from '@emotion/utils'\n\nimport {\n type BoxDisplayModel,\n type Breakpoints,\n type Stylesheet,\n type ResolvedStyle,\n isNotNil,\n} from '@makeswift/controls'\n\nimport { resolvedStyleToCss } from '../lib/resolved-style-to-css'\nimport { pollBoxModel } from '../poll-box-model'\nimport { useCache } from '../root-style-registry'\nimport { type StylesheetFactory } from '../stylesheet-factory'\nimport { useStyles, serializedStyleClassName } from '../use-style'\n\nimport { useBreakpoints } from './use-breakpoints'\nimport { useCssId } from './use-css-id'\n\nexport function useStylesheetFactory(): StylesheetFactory {\n const breakpoints = useBreakpoints()\n const cache = useCache()\n const componentUid = useCssId()\n\n const computedStyles = useRef<Record<string, SerializedStyles>>({}).current\n const boxModelCallbacks = useRef<Record<string, (boxModel: BoxDisplayModel | null) => void>>(\n {},\n ).current\n\n return useMemo(() => {\n const getStylesheet = (styleSheetId: string): Stylesheet => ({\n breakpoints(): Breakpoints {\n return breakpoints\n },\n\n defineStyle(\n style: ResolvedStyle,\n onBoxModelChange?: (boxModel: BoxDisplayModel | null) => void,\n ): string {\n const serialized = serializeStyle(breakpoints, style, cache)\n const uid = `u-${componentUid}-${styleSheetId}`\n computedStyles[uid] = serialized\n\n const className = serializedStyleClassName(cache, serialized)\n if (!onBoxModelChange) return className\n\n boxModelCallbacks[uid] = onBoxModelChange\n return `${className} ${uid}`\n },\n\n child(id: string): Stylesheet {\n return getStylesheet(`${styleSheetId}-${id}`)\n },\n })\n\n return {\n get(propName: string): Stylesheet {\n return getStylesheet(propName)\n },\n\n useDefinedStyles() {\n useStyles(cache, Object.values(computedStyles))\n\n useEffect(() => {\n const unsubscribes = Object.entries(boxModelCallbacks)\n .map(([uid, callback]) =>\n callback != null\n ? pollBoxModel({\n element: document.querySelector(`.${uid}`),\n onBoxModelChange: callback,\n })\n : undefined,\n )\n .filter(isNotNil)\n\n return () => unsubscribes.forEach(fn => fn())\n }, [Object.keys(boxModelCallbacks).join(' ')])\n },\n }\n }, [breakpoints, cache, componentUid])\n}\n\nfunction serializeStyle(\n breakpoints: Breakpoints,\n style: ResolvedStyle,\n cache: EmotionCache,\n): SerializedStyles {\n const css = resolvedStyleToCss(breakpoints, style)\n return serializeStyles([css], cache.registered)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2C;AAC3C,uBAAgC;AAIhC,sBAMO;AAEP,mCAAmC;AACnC,4BAA6B;AAC7B,iCAAyB;AAEzB,uBAAoD;AAEpD,6BAA+B;AAC/B,wBAAyB;AAElB,SAAS,uBAA0C;AACxD,QAAM,kBAAc,uCAAe;AACnC,QAAM,YAAQ,qCAAS;AACvB,QAAM,mBAAe,4BAAS;AAE9B,QAAM,qBAAiB,qBAAyC,CAAC,CAAC,EAAE;AACpE,QAAM,wBAAoB;AAAA,IACxB,CAAC;AAAA,EACH,EAAE;AAEF,aAAO,sBAAQ,MAAM;AACnB,UAAM,gBAAgB,CAAC,kBAAsC;AAAA,MAC3D,cAA2B;AACzB,eAAO;AAAA,MACT;AAAA,MAEA,YACE,OACA,kBACQ;AACR,cAAM,aAAa,eAAe,aAAa,OAAO,KAAK;AAC3D,cAAM,MAAM,KAAK,YAAY,IAAI,YAAY;AAC7C,uBAAe,GAAG,IAAI;AAEtB,cAAM,gBAAY,2CAAyB,OAAO,UAAU;AAC5D,YAAI,CAAC;AAAkB,iBAAO;AAE9B,0BAAkB,GAAG,IAAI;AACzB,eAAO,GAAG,SAAS,IAAI,GAAG;AAAA,MAC5B;AAAA,MAEA,MAAM,IAAwB;AAC5B,eAAO,cAAc,GAAG,YAAY,IAAI,EAAE,EAAE;AAAA,MAC9C;AAAA,IACF;AAEA,WAAO;AAAA,MACL,IAAI,UAA8B;AAChC,eAAO,cAAc,QAAQ;AAAA,MAC/B;AAAA,MAEA,mBAAmB;AACjB,wCAAU,OAAO,OAAO,OAAO,cAAc,CAAC;AAE9C,oCAAU,MAAM;AACd,gBAAM,eAAe,OAAO,QAAQ,iBAAiB,EAClD;AAAA,YAAI,CAAC,CAAC,KAAK,QAAQ,MAClB,YAAY,WACR,oCAAa;AAAA,cACX,SAAS,SAAS,cAAc,IAAI,GAAG,EAAE;AAAA,cACzC,kBAAkB;AAAA,YACpB,CAAC,IACD;AAAA,UACN,EACC,OAAO,wBAAQ;AAElB,iBAAO,MAAM,aAAa,QAAQ,QAAM,GAAG,CAAC;AAAA,QAC9C,GAAG,CAAC,OAAO,KAAK,iBAAiB,EAAE,KAAK,GAAG,CAAC,CAAC;AAAA,MAC/C;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,OAAO,YAAY,CAAC;AACvC;AAEA,SAAS,eACP,aACA,OACA,OACkB;AAClB,QAAM,UAAM,iDAAmB,aAAa,KAAK;AACjD,aAAO,kCAAgB,CAAC,GAAG,GAAG,MAAM,UAAU;AAChD;","names":[]}
|
|
@@ -41,13 +41,14 @@ class ReactRuntimeCore extends import_runtime_core.RuntimeCore {
|
|
|
41
41
|
hidden = false,
|
|
42
42
|
description,
|
|
43
43
|
builtinSuspense,
|
|
44
|
+
unstable_migration,
|
|
44
45
|
props
|
|
45
46
|
}) {
|
|
46
47
|
validateComponentType(type, component);
|
|
47
48
|
const unregisterComponent = this.protoStore.dispatch(
|
|
48
49
|
(0, import_read_only_actions.registerComponentEffect)(
|
|
49
50
|
type,
|
|
50
|
-
{ label, icon, hidden, description, builtinSuspense },
|
|
51
|
+
{ label, icon, hidden, description, builtinSuspense, unstable_migration },
|
|
51
52
|
props ?? {}
|
|
52
53
|
)
|
|
53
54
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/react/react-runtime-core.ts"],"sourcesContent":["import { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls'\n\nimport { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors'\n\nimport { supportsActivity } from './components/activity-with-fallback'\n\nimport {\n registerComponentEffect,\n registerReactComponentEffect,\n} from '../../state/actions/internal/read-only-actions'\n\nimport { ComponentIcon } from '../../state/modules/components-meta'\nimport type { ComponentType } from '../../state/read-only-state'\n\nimport { RuntimeCore } from './runtime-core'\n\nfunction validateComponentType(type: string, component?: ComponentType): void {\n const componentName = component?.name ?? 'Component'\n if (typeof type !== 'string' || type === '') {\n throw new Error(\n `${componentName}: A non-empty string \\`type\\` is required for component registration, got ${type}`,\n )\n }\n}\n\nexport class ReactRuntimeCore extends RuntimeCore {\n registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Cube,\n hidden = false,\n description,\n builtinSuspense,\n props,\n }: {\n type: string\n label: string\n icon?: ComponentIcon\n hidden?: boolean\n description?: string\n /**\n * In React <= 19.1, controls the default `<Suspense>` boundary.\n * Ignored in React >= 19.2; components are always wrapped in `<Activity>`.\n * Defaults to `true`.\n */\n builtinSuspense?: boolean\n props?: P\n },\n ): () => void {\n validateComponentType(type, component as unknown as ComponentType)\n\n const unregisterComponent = this.protoStore.dispatch(\n registerComponentEffect(\n type,\n { label, icon, hidden, description, builtinSuspense },\n props ?? {},\n ),\n )\n\n if (supportsActivity() && builtinSuspense !== undefined) {\n console.warn(\n 'builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>.',\n )\n }\n\n const unregisterReactComponent = this.protoStore.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oCAAiC;AAEjC,+BAGO;AAEP,6BAA8B;AAG9B,0BAA4B;AAE5B,SAAS,sBAAsB,MAAc,WAAiC;AAC5E,QAAM,gBAAgB,WAAW,QAAQ;AACzC,MAAI,OAAO,SAAS,YAAY,SAAS,IAAI;AAC3C,UAAM,IAAI;AAAA,MACR,GAAG,aAAa,6EAA6E,IAAI;AAAA,IACnG;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,gCAAY;AAAA,EAChD,kBAKE,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO,qCAAc;AAAA,IACrB,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,EACF,
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/react/react-runtime-core.ts"],"sourcesContent":["import { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls'\n\nimport { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors'\n\nimport { supportsActivity } from './components/activity-with-fallback'\n\nimport {\n registerComponentEffect,\n registerReactComponentEffect,\n} from '../../state/actions/internal/read-only-actions'\n\nimport { ComponentIcon } from '../../state/modules/components-meta'\nimport type { ComponentType } from '../../state/read-only-state'\n\nimport { RuntimeCore } from './runtime-core'\n\nfunction validateComponentType(type: string, component?: ComponentType): void {\n const componentName = component?.name ?? 'Component'\n if (typeof type !== 'string' || type === '') {\n throw new Error(\n `${componentName}: A non-empty string \\`type\\` is required for component registration, got ${type}`,\n )\n }\n}\n\nexport class ReactRuntimeCore extends RuntimeCore {\n registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Cube,\n hidden = false,\n description,\n builtinSuspense,\n unstable_migration,\n props,\n }: {\n type: string\n label: string\n icon?: ComponentIcon\n hidden?: boolean\n description?: string\n /**\n * In React <= 19.1, controls the default `<Suspense>` boundary.\n * Ignored in React >= 19.2; components are always wrapped in `<Activity>`.\n * Defaults to `true`.\n */\n builtinSuspense?: boolean\n /**\n * Marks this registration as superseded by `replacementType`. When\n * `replacementType` differs from `type`, the builder offers a way to\n * update existing instances.\n */\n unstable_migration?: { replacementType: string }\n props?: P\n },\n ): () => void {\n validateComponentType(type, component as unknown as ComponentType)\n\n const unregisterComponent = this.protoStore.dispatch(\n registerComponentEffect(\n type,\n { label, icon, hidden, description, builtinSuspense, unstable_migration },\n props ?? {},\n ),\n )\n\n if (supportsActivity() && builtinSuspense !== undefined) {\n console.warn(\n 'builtinSuspense is ignored in React >= 19.2; components are always wrapped in <Activity>.',\n )\n }\n\n const unregisterReactComponent = this.protoStore.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oCAAiC;AAEjC,+BAGO;AAEP,6BAA8B;AAG9B,0BAA4B;AAE5B,SAAS,sBAAsB,MAAc,WAAiC;AAC5E,QAAM,gBAAgB,WAAW,QAAQ;AACzC,MAAI,OAAO,SAAS,YAAY,SAAS,IAAI;AAC3C,UAAM,IAAI;AAAA,MACR,GAAG,aAAa,6EAA6E,IAAI;AAAA,IACnG;AAAA,EACF;AACF;AAEO,MAAM,yBAAyB,gCAAY;AAAA,EAChD,kBAKE,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO,qCAAc;AAAA,IACrB,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAoBY;AACZ,0BAAsB,MAAM,SAAqC;AAEjE,UAAM,sBAAsB,KAAK,WAAW;AAAA,UAC1C;AAAA,QACE;AAAA,QACA,EAAE,OAAO,MAAM,QAAQ,aAAa,iBAAiB,mBAAmB;AAAA,QACxE,SAAS,CAAC;AAAA,MACZ;AAAA,IACF;AAEA,YAAI,gDAAiB,KAAK,oBAAoB,QAAW;AACvD,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAEA,UAAM,2BAA2B,KAAK,WAAW;AAAA,UAC/C,uDAA6B,MAAM,SAAqC;AAAA,IAC1E;AAEA,WAAO,MAAM;AACX,0BAAoB;AACpB,+BAAyB;AAAA,IAC3B;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var stylesheet_factory_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(stylesheet_factory_exports);
|
|
17
|
+
//# sourceMappingURL=stylesheet-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/react/stylesheet-factory.ts"],"sourcesContent":["import { type Stylesheet } from '@makeswift/controls'\n\nexport type StylesheetFactory = {\n get(propName: string): Stylesheet\n useDefinedStyles(): void\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/slate/TypographyPlugin/normalizeTypographyUp.ts"],"sourcesContent":["import { Editor, Element, NodeEntry, Transforms, Node, Text } from 'slate'\nimport { RichTextTypography } from '@makeswift/controls'\n\nimport { MakeswiftEditor } from '../types'\nimport keys from '../../utils/keys'\nimport deepEqual from '../../utils/deepEqual'\nimport { shallowMergeTypographies } from './normalizeTypographyDown'\n\nfunction shallowAnd<A extends Record<string,
|
|
1
|
+
{"version":3,"sources":["../../../../src/slate/TypographyPlugin/normalizeTypographyUp.ts"],"sourcesContent":["import { Editor, Element, NodeEntry, Transforms, Node, Text } from 'slate'\nimport { type Data, RichTextTypography } from '@makeswift/controls'\n\nimport { MakeswiftEditor } from '../types'\nimport keys from '../../utils/keys'\nimport deepEqual from '../../utils/deepEqual'\nimport { shallowMergeTypographies } from './normalizeTypographyDown'\n\nfunction shallowAnd<A extends Record<string, Data>, B extends Record<string, Data>>(\n a: A,\n b: B,\n): A & B {\n const bKeys = keys(b)\n const aPrime = { ...a } as A & B\n const and = {} as A & B\n\n bKeys.forEach(key => {\n if (deepEqual(aPrime[key], b[key])) and[key] = aPrime[key]\n })\n\n return and\n}\n\nfunction shallowAndTypographies(...typographies: RichTextTypography[]): RichTextTypography {\n return {\n id: typographies.every(typography => typography?.id === typographies.at(0)?.id)\n ? typographies.at(0)?.id\n : undefined,\n style: [\n ...new Set(\n typographies.flatMap(typography => typography?.style.map(node => node.deviceId) ?? []),\n ),\n ].flatMap(deviceId => {\n const stylesForThisDevice = typographies\n .map(typography => typography.style.find(s => s.deviceId === deviceId)?.value)\n .filter((typography): typography is RichTextTypography['style'][number]['value'] =>\n Boolean(typography),\n )\n\n if (typographies.length !== stylesForThisDevice.length) return []\n\n const value = stylesForThisDevice.reduce(\n (acc, curr) => {\n return shallowAnd(acc, curr)\n },\n stylesForThisDevice.at(0) as RichTextTypography['style'][number]['value'],\n )\n\n if (value == null || Object.keys(value).length === 0) {\n return []\n }\n\n return [\n {\n deviceId,\n value,\n },\n ]\n }),\n }\n}\n\nfunction shallowInverseAnd<A extends Record<string, Data>, B extends Record<string, Data>>(\n a: A,\n b: B,\n): A & B {\n const bKeys = Array.from(new Set([...keys(b), ...keys(a)]))\n const aPrime = { ...a } as A & B\n const bPrime = { ...b } as A & B\n const xor = {} as A & B\n\n bKeys.forEach(key => {\n if (!deepEqual(aPrime[key], bPrime[key])) xor[key] = aPrime[key]\n })\n\n return xor\n}\n\nfunction shallowInverseAndTypographies(\n a: RichTextTypography,\n b: RichTextTypography,\n): RichTextTypography {\n const typography = { style: [] } as RichTextTypography\n if (a?.id !== b.id) {\n typography.id = a?.id\n }\n\n if (a && a.style.length > 0) {\n const styles: RichTextTypography['style'] = []\n for (const style of a.style) {\n const bDeviceTypography = b.style.find(s => s.deviceId === style.deviceId)\n if (bDeviceTypography == null) {\n styles.push(style)\n } else {\n const uniquePropertiesOfA = shallowInverseAnd(style.value, bDeviceTypography.value)\n\n if (Object.keys(uniquePropertiesOfA).length > 0) {\n styles.push({\n deviceId: style.deviceId,\n value: uniquePropertiesOfA,\n })\n }\n }\n }\n typography.style = styles\n }\n\n return typography\n}\n\n/**\n * If a text is empty then don't include it in our comparison.\n */\nfunction isException(node: Node): boolean {\n return Text.isText(node) && node.text === ''\n}\n\nexport function normalizeTypographyUp(editor: MakeswiftEditor, entry: NodeEntry): boolean {\n const [node, path] = entry\n if (Element.isElement(node) && node.children.length) {\n const typographiesOfChildren = node.children\n .filter(child => !isException(child))\n .map(child => child.typography)\n\n const definedTypographiesOfChildren = typographiesOfChildren.filter(\n (typography): typography is RichTextTypography => Boolean(typography),\n )\n if (typographiesOfChildren.length === definedTypographiesOfChildren.length) {\n let sharedTypography: RichTextTypography = shallowAndTypographies(\n ...definedTypographiesOfChildren,\n )\n\n if (sharedTypography.style.length > 0 || sharedTypography.id != null) {\n const rootTypography: RichTextTypography = shallowMergeTypographies(\n sharedTypography,\n node.typography,\n )\n Editor.withoutNormalizing(editor, () => {\n Transforms.setNodes(editor, { typography: rootTypography }, { at: path })\n for (let i = 0; i < node.children.length; i++) {\n const typography: RichTextTypography = shallowInverseAndTypographies(\n node.children.at(i)?.typography ?? { style: [] },\n sharedTypography,\n )\n\n Transforms.setNodes(editor, { typography }, { at: [...path, i] })\n }\n })\n return true\n }\n }\n }\n return false\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAmE;AAInE,k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M,yBAAyB,KAAK,SACjC,OAAO,WAAS,CAAC,YAAY,KAAK,CAAC,EACnC,IAAI,WAAS,MAAM,UAAU;AAEhC,UAAM,gCAAgC,uBAAuB;AAAA,MAC3D,CAAC,eAAiD,QAAQ,UAAU;AAAA,IACtE;AACA,QAAI,uBAAuB,WAAW,8BAA8B,QAAQ;AAC1E,UAAI,mBAAuC;AAAA,QACzC,GAAG;AAAA,MACL;AAEA,UAAI,iBAAiB,MAAM,SAAS,KAAK,iBAAiB,MAAM,MAAM;AACpE,cAAM,qBAAqC;AAAA,UACzC;AAAA,UACA,KAAK;AAAA,QACP;AACA,4BAAO,mBAAmB,QAAQ,MAAM;AACtC,kCAAW,SAAS,QAAQ,EAAE,YAAY,eAAe,GAAG,EAAE,IAAI,KAAK,CAAC;AACxE,mBAAS,IAAI,GAAG,IAAI,KAAK,SAAS,QAAQ,KAAK;AAC7C,kBAAM,aAAiC;AAAA,cACrC,KAAK,SAAS,GAAG,CAAC,GAAG,cAAc,EAAE,OAAO,CAAC,EAAE;AAAA,cAC/C;AAAA,YACF;AAEA,oCAAW,SAAS,QAAQ,EAAE,WAAW,GAAG,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC;AAAA,UAClE;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":["keys","deepEqual"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/slate/selectors.ts"],"sourcesContent":["import { Editor, NodeEntry, Range, Text } from 'slate'\nimport {\n type Breakpoints,\n type BreakpointId,\n findBreakpointOverride,\n Slate,\n} from '@makeswift/controls'\n\nimport { EditableBlockKey } from './BlockPlugin/types'\n\nimport unhangRange from './utils/unhangRange'\nimport shallowEqual from '../utils/shallowEqual'\nimport { isNonNullable } from '../utils/isNonNullable'\n\nimport deepEqual from '../utils/deepEqual'\nimport keys from '../utils/keys'\n\nexport function getSelection(editor: Editor): Range {\n if (editor.selection) return unhangRange(editor, editor.selection)\n return {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n }\n}\n\nexport function getBlocksInSelection(editor: Editor): NodeEntry<Slate.RootBlock>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Slate.isRootBlock(node),\n }),\n ).filter((entry): entry is NodeEntry<Slate.RootBlock> => Slate.isRootBlock(entry[0]))\n}\n\nexport function getInlinesInSelection(editor: Editor): NodeEntry<Slate.Inline>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Slate.isInline(node),\n }),\n ).filter((entry): entry is NodeEntry<Slate.Inline> => Slate.isInline(entry[0]))\n}\n\nexport function getActiveBlockType(editor: Editor): Slate.RootBlockType | null {\n const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type)\n\n return rootBlocks.reduce<Slate.RootBlockType | null>(\n (a, b) => (a === b ? b : null),\n rootBlocks.at(0) ?? null,\n )\n}\n\nexport function getActiveBlockValue(editor: Editor, key: EditableBlockKey) {\n const blocks = getBlocksInSelection(editor)\n\n const active = blocks.map(\n ([block]) => block[key] ?? null,\n ) as (Slate.ResponsiveBlockTextAlignment | null)[]\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\nexport function getActiveBlockDeviceOverrideValue(\n editor: Editor,\n key: EditableBlockKey,\n breakpoints: Breakpoints,\n deviceId: BreakpointId,\n) {\n const active: (Slate.BlockTextAlignment | null)[] = []\n const blocks = getBlocksInSelection(editor)\n\n blocks.forEach(([block]) => {\n const deviceOverride =\n findBreakpointOverride<Slate.BlockTextAlignment>(breakpoints, block[key], deviceId) || null\n active.push(deviceOverride?.value ?? null)\n })\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\n// Typography\n\nconst concat = (a: unknown[], b: unknown[]) => a.concat(b)\n\n// TODO: This is more cruft from trying to remove null from the typography type. This optimization is not worth it.\n/**\n * This is a c/p of the intersection of the utils from the root utils folder.\n * The only change is defaulting to undefined instead of to null.\n */\nexport default function intersection<A extends Record<string,
|
|
1
|
+
{"version":3,"sources":["../../../src/slate/selectors.ts"],"sourcesContent":["import { Editor, NodeEntry, Range, Text } from 'slate'\nimport {\n type Breakpoints,\n type BreakpointId,\n type Data,\n findBreakpointOverride,\n Slate,\n} from '@makeswift/controls'\n\nimport { EditableBlockKey } from './BlockPlugin/types'\n\nimport unhangRange from './utils/unhangRange'\nimport shallowEqual from '../utils/shallowEqual'\nimport { isNonNullable } from '../utils/isNonNullable'\n\nimport deepEqual from '../utils/deepEqual'\nimport keys from '../utils/keys'\n\nexport function getSelection(editor: Editor): Range {\n if (editor.selection) return unhangRange(editor, editor.selection)\n return {\n anchor: Editor.start(editor, []),\n focus: Editor.end(editor, []),\n }\n}\n\nexport function getBlocksInSelection(editor: Editor): NodeEntry<Slate.RootBlock>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Slate.isRootBlock(node),\n }),\n ).filter((entry): entry is NodeEntry<Slate.RootBlock> => Slate.isRootBlock(entry[0]))\n}\n\nexport function getInlinesInSelection(editor: Editor): NodeEntry<Slate.Inline>[] {\n return Array.from(\n Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Slate.isInline(node),\n }),\n ).filter((entry): entry is NodeEntry<Slate.Inline> => Slate.isInline(entry[0]))\n}\n\nexport function getActiveBlockType(editor: Editor): Slate.RootBlockType | null {\n const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type)\n\n return rootBlocks.reduce<Slate.RootBlockType | null>(\n (a, b) => (a === b ? b : null),\n rootBlocks.at(0) ?? null,\n )\n}\n\nexport function getActiveBlockValue(editor: Editor, key: EditableBlockKey) {\n const blocks = getBlocksInSelection(editor)\n\n const active = blocks.map(\n ([block]) => block[key] ?? null,\n ) as (Slate.ResponsiveBlockTextAlignment | null)[]\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\nexport function getActiveBlockDeviceOverrideValue(\n editor: Editor,\n key: EditableBlockKey,\n breakpoints: Breakpoints,\n deviceId: BreakpointId,\n) {\n const active: (Slate.BlockTextAlignment | null)[] = []\n const blocks = getBlocksInSelection(editor)\n\n blocks.forEach(([block]) => {\n const deviceOverride =\n findBreakpointOverride<Slate.BlockTextAlignment>(breakpoints, block[key], deviceId) || null\n active.push(deviceOverride?.value ?? null)\n })\n\n return active.length === 0 ? null : active.reduce((a, b) => (shallowEqual(a, b) ? b : null))\n}\n\n// Typography\n\nconst concat = (a: unknown[], b: unknown[]) => a.concat(b)\n\n// TODO: This is more cruft from trying to remove null from the typography type. This optimization is not worth it.\n/**\n * This is a c/p of the intersection of the utils from the root utils folder.\n * The only change is defaulting to undefined instead of to null.\n */\nexport default function intersection<A extends Record<string, Data>, B extends A>(\n a: A,\n b: B,\n isEqual: (a: Data, b: Data) => boolean = deepEqual,\n): { [K in keyof A]: A[K] | undefined } {\n const allKeys = [...new Set([...keys(a), ...keys(b)])] as (keyof A)[]\n\n return allKeys.reduce(\n (acc, k) => {\n if (isEqual(a[k], b[k])) acc[k] = a[k]\n else acc[k] = undefined\n\n return acc\n },\n {} as { [K in keyof A]: A[K] | undefined },\n )\n}\n\nconst fuseTypographyMarks = (\n values: Array<Slate.Typography | null | undefined>,\n breakpoints: Breakpoints,\n): Slate.Typography => {\n const devices = [\n ...new Set(\n values\n .filter(isNonNullable)\n .map(({ style }) => style.map(({ deviceId }) => deviceId))\n .reduce(concat, []),\n ),\n ] as BreakpointId[]\n\n return {\n id: values.map(v => v && v.id).reduce((a, b) => (a === b ? a : undefined)) ?? undefined,\n style: devices.map(deviceId =>\n values\n .map(\n v =>\n (v && findBreakpointOverride(breakpoints, v.style, deviceId)) || {\n deviceId,\n value: {},\n },\n )\n .reduce((acc, { value }) => {\n const a = intersection(acc.value, value)\n return {\n deviceId,\n value: a,\n }\n }),\n ),\n }\n}\n\nexport function getActiveTypographyMark(\n editor: Editor,\n breakpoints: Breakpoints,\n): Slate.Typography {\n const active: Slate.Typography[] = []\n\n const textNodes = Editor.nodes(editor, {\n at: getSelection(editor),\n match: node => Text.isText(node),\n })\n\n for (const [node] of textNodes) {\n if (Text.isText(node) && 'typography' in node && node.typography != undefined) {\n active.push(node.typography)\n }\n }\n return active.length === 0 ? { style: [] } : fuseTypographyMarks(active, breakpoints)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+C;AAC/C,sBAMO;AAIP,yBAAwB;AACxB,0BAAyB;AACzB,2BAA8B;AAE9B,uBAAsB;AACtB,kBAAiB;AAEV,SAAS,aAAa,QAAuB;AAClD,MAAI,OAAO;AAAW,eAAO,mBAAAA,SAAY,QAAQ,OAAO,SAAS;AACjE,SAAO;AAAA,IACL,QAAQ,oBAAO,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC/B,OAAO,oBAAO,IAAI,QAAQ,CAAC,CAAC;AAAA,EAC9B;AACF;AAEO,SAAS,qBAAqB,QAA8C;AACjF,SAAO,MAAM;AAAA,IACX,oBAAO,MAAM,QAAQ;AAAA,MACnB,IAAI,aAAa,MAAM;AAAA,MACvB,OAAO,UAAQ,sBAAM,YAAY,IAAI;AAAA,IACvC,CAAC;AAAA,EACH,EAAE,OAAO,CAAC,UAA+C,sBAAM,YAAY,MAAM,CAAC,CAAC,CAAC;AACtF;AAEO,SAAS,sBAAsB,QAA2C;AAC/E,SAAO,MAAM;AAAA,IACX,oBAAO,MAAM,QAAQ;AAAA,MACnB,IAAI,aAAa,MAAM;AAAA,MACvB,OAAO,UAAQ,sBAAM,SAAS,IAAI;AAAA,IACpC,CAAC;AAAA,EACH,EAAE,OAAO,CAAC,UAA4C,sBAAM,SAAS,MAAM,CAAC,CAAC,CAAC;AAChF;AAEO,SAAS,mBAAmB,QAA4C;AAC7E,QAAM,aAAa,qBAAqB,MAAM,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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/slate/utils/toText.ts"],"sourcesContent":["import { type Descendant } from 'slate'\nimport { Slate } from '@makeswift/controls'\n\nimport { RichText, RichTextV2Mode } from '../../controls/rich-text-v2'\n\nfunction isBlock(descendant: Descendant): descendant is Slate.Block {\n if (Slate.isText(descendant)) return false\n return Slate.isBlock(descendant)\n}\n\nfunction getTextByDescendant(descendant: Descendant, mode: RichTextV2Mode): string {\n if (Slate.isText(descendant)) {\n return descendant.text ?? ''\n }\n\n if (Slate.isDefaultElement(descendant)) {\n return mode === RichText.Mode.Inline\n ? descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('')
|
|
1
|
+
{"version":3,"sources":["../../../../src/slate/utils/toText.ts"],"sourcesContent":["import { type Descendant } from 'slate'\nimport { Slate } from '@makeswift/controls'\n\nimport { RichText, RichTextV2Mode } from '../../controls/rich-text-v2'\n\nfunction isBlock(descendant: Descendant): descendant is Slate.Block {\n if (Slate.isText(descendant)) return false\n return Slate.isBlock(descendant)\n}\n\nfunction getTextByDescendant(descendant: Descendant, mode: RichTextV2Mode): string {\n if (Slate.isText(descendant)) {\n return descendant.text ?? ''\n }\n\n if (Slate.isDefaultElement(descendant)) {\n return mode === RichText.Mode.Inline\n ? (descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('') ??\n '')\n : (descendant.children\n .map(descendant => getTextByDescendant(descendant, mode))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? '')\n }\n\n if (Slate.isBlock(descendant)) {\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant, mode))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n }\n\n if (Slate.isInline(descendant)) {\n return (\n descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('') ?? ''\n )\n }\n\n return ''\n}\n\nexport function toText(descendants: Descendant[], mode: RichTextV2Mode): string {\n return descendants.map(node => getTextByDescendant(node, mode)).join('\\n')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAsB;AAEtB,0BAAyC;AAEzC,SAAS,QAAQ,YAAmD;AAClE,MAAI,sBAAM,OAAO,UAAU;AAAG,WAAO;AACrC,SAAO,sBAAM,QAAQ,UAAU;AACjC;AAEA,SAAS,oBAAoB,YAAwB,MAA8B;AACjF,MAAI,sBAAM,OAAO,UAAU,GAAG;AAC5B,WAAO,WAAW,QAAQ;AAAA,EAC5B;AAEA,MAAI,sBAAM,iBAAiB,UAAU,GAAG;AACtC,WAAO,SAAS,6BAAS,KAAK,SACzB,WAAW,SAAS,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EAAE,KAAK,EAAE,KACnF,KACD,WAAW,SACT,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EACvD,KAAK,WAAW,SAAS,MAAM,OAAO,IAAI,OAAO,EAAE,KAAK;AAAA,EACjE;AAEA,MAAI,sBAAM,QAAQ,UAAU,GAAG;AAC7B,WACE,WAAW,SACR,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EACvD,KAAK,WAAW,SAAS,MAAM,OAAO,IAAI,OAAO,EAAE,KAAK;AAAA,EAE/D;AAEA,MAAI,sBAAM,SAAS,UAAU,GAAG;AAC9B,WACE,WAAW,SAAS,IAAI,CAAAA,gBAAc,oBAAoBA,aAAY,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK;AAAA,EAE7F;AAEA,SAAO;AACT;AAEO,SAAS,OAAO,aAA2B,MAA8B;AAC9E,SAAO,YAAY,IAAI,UAAQ,oBAAoB,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI;AAC3E;","names":["descendant"]}
|
|
@@ -50,12 +50,13 @@ function createAndRegisterPropControllers(documentKey, elementKey) {
|
|
|
50
50
|
return null;
|
|
51
51
|
const propControllers = Object.entries(descriptors).reduce(
|
|
52
52
|
(acc, [propName, descriptor]) => {
|
|
53
|
-
const propController = (0, import_instances.createPropController)(
|
|
53
|
+
const propController = (0, import_instances.createPropController)({
|
|
54
54
|
descriptor,
|
|
55
|
-
|
|
55
|
+
instanceKey: { elementKey, propPath: propName },
|
|
56
|
+
sendMessage: (message) => dispatch(
|
|
56
57
|
Builder.messageBuilderPropController(documentKey, elementKey, propName, message)
|
|
57
58
|
)
|
|
58
|
-
);
|
|
59
|
+
});
|
|
59
60
|
return { ...acc, [propName]: propController };
|
|
60
61
|
},
|
|
61
62
|
{}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/state/middleware/read-write/prop-controller-handles.ts"],"sourcesContent":["import { type Middleware, type ThunkAction } from '@reduxjs/toolkit'\n\nimport { ControlInstance } from '@makeswift/controls'\n\nimport * as PropControllerHandles from '../../modules/prop-controller-handles'\n\nimport { type Action } from '../../actions'\n\nimport * as Builder from '../../builder-api/actions'\n\nimport { ReadOnlyActionTypes } from '../../actions/internal/read-only-actions'\nimport * as ReadOnly from '../../actions/internal/read-only-actions'\n\nimport { actionMiddleware } from '../../toolkit'\n\nimport { createPropController } from '../../../prop-controllers/instances'\nimport { HostActionTypes } from '../../host-api'\n\nimport * as ReadOnlyState from '../../read-only-state'\nimport { type State, type Dispatch } from '../../read-write-state'\n\nfunction createAndRegisterPropControllers(\n documentKey: string,\n elementKey: string,\n): ThunkAction<Record<string, ControlInstance> | null, State, unknown, Action> {\n return (dispatch, getState) => {\n const descriptors = ReadOnlyState.getElementPropControllerDescriptors(\n getState(),\n documentKey,\n elementKey,\n )\n\n if (descriptors == null) return null\n\n const propControllers = Object.entries(descriptors).reduce(\n (acc, [propName, descriptor]) => {\n const propController = createPropController(descriptor, message =>\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/state/middleware/read-write/prop-controller-handles.ts"],"sourcesContent":["import { type Middleware, type ThunkAction } from '@reduxjs/toolkit'\n\nimport { ControlInstance } from '@makeswift/controls'\n\nimport * as PropControllerHandles from '../../modules/prop-controller-handles'\n\nimport { type Action } from '../../actions'\n\nimport * as Builder from '../../builder-api/actions'\n\nimport { ReadOnlyActionTypes } from '../../actions/internal/read-only-actions'\nimport * as ReadOnly from '../../actions/internal/read-only-actions'\n\nimport { actionMiddleware } from '../../toolkit'\n\nimport { createPropController } from '../../../prop-controllers/instances'\nimport { HostActionTypes } from '../../host-api'\n\nimport * as ReadOnlyState from '../../read-only-state'\nimport { type State, type Dispatch } from '../../read-write-state'\n\nfunction createAndRegisterPropControllers(\n documentKey: string,\n elementKey: string,\n): ThunkAction<Record<string, ControlInstance> | null, State, unknown, Action> {\n return (dispatch, getState) => {\n const descriptors = ReadOnlyState.getElementPropControllerDescriptors(\n getState(),\n documentKey,\n elementKey,\n )\n\n if (descriptors == null) return null\n\n const propControllers = Object.entries(descriptors).reduce(\n (acc, [propName, descriptor]) => {\n const propController = createPropController({\n descriptor,\n instanceKey: { elementKey, propPath: propName },\n sendMessage: message =>\n dispatch(\n Builder.messageBuilderPropController(documentKey, elementKey, propName, message),\n ),\n }) as ControlInstance\n\n return { ...acc, [propName]: propController }\n },\n {} as Record<string, ControlInstance>,\n )\n\n dispatch(ReadOnly.registerPropControllers(documentKey, elementKey, propControllers))\n\n return propControllers\n }\n}\n\nexport function propControllerHandlesMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return actionMiddleware(({ dispatch, getState }) => next => {\n return (action: Action) => {\n switch (action.type) {\n case ReadOnlyActionTypes.REGISTER_COMPONENT_HANDLE: {\n const { documentKey, elementKey, componentHandle } = action.payload\n const element = ReadOnlyState.getElement(getState(), documentKey, elementKey)\n const propControllers = dispatch(\n createAndRegisterPropControllers(documentKey, elementKey),\n )\n\n if (\n element != null &&\n !ReadOnlyState.isElementReference(element) &&\n PropControllerHandles.isPropControllersHandle(componentHandle)\n ) {\n dispatch(\n ReadOnly.registerPropControllersHandle(documentKey, elementKey, componentHandle),\n )\n componentHandle.setPropControllers(propControllers)\n }\n\n break\n }\n\n case ReadOnlyActionTypes.UNREGISTER_COMPONENT_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const handle = ReadOnlyState.getPropControllersHandle(getState(), {\n documentKey,\n elementKey,\n })\n\n handle?.setPropControllers(null)\n\n dispatch(ReadOnly.unregisterPropControllers(documentKey, elementKey))\n\n break\n }\n\n case HostActionTypes.MESSAGE_HOST_PROP_CONTROLLER: {\n const { documentKey, elementKey, propName, message } = action.payload\n const propController = ReadOnlyState.getPropController(getState(), {\n documentKey,\n elementKey,\n propName,\n })\n\n if (propController) propController.recv(message)\n }\n }\n\n return next(action)\n }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,4BAAuC;AAIvC,cAAyB;AAEzB,+BAAoC;AACpC,eAA0B;AAE1B,IAAAA,kBAAiC;AAEjC,uBAAqC;AACrC,sBAAgC;AAEhC,oBAA+B;AAG/B,SAAS,iCACP,aACA,YAC6E;AAC7E,SAAO,CAAC,UAAU,aAAa;AAC7B,UAAM,cAAc,cAAc;AAAA,MAChC,SAAS;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAEA,QAAI,eAAe;AAAM,aAAO;AAEhC,UAAM,kBAAkB,OAAO,QAAQ,WAAW,EAAE;AAAA,MAClD,CAAC,KAAK,CAAC,UAAU,UAAU,MAAM;AAC/B,cAAM,qBAAiB,uCAAqB;AAAA,UAC1C;AAAA,UACA,aAAa,EAAE,YAAY,UAAU,SAAS;AAAA,UAC9C,aAAa,aACX;AAAA,YACE,QAAQ,6BAA6B,aAAa,YAAY,UAAU,OAAO;AAAA,UACjF;AAAA,QACJ,CAAC;AAED,eAAO,EAAE,GAAG,KAAK,CAAC,QAAQ,GAAG,eAAe;AAAA,MAC9C;AAAA,MACA,CAAC;AAAA,IACH;AAEA,aAAS,SAAS,wBAAwB,aAAa,YAAY,eAAe,CAAC;AAEnF,WAAO;AAAA,EACT;AACF;AAEO,SAAS,kCAAyE;AACvF,aAAO,kCAAiB,CAAC,EAAE,UAAU,SAAS,MAAM,UAAQ;AAC1D,WAAO,CAAC,WAAmB;AACzB,cAAQ,OAAO,MAAM;AAAA,QACnB,KAAK,6CAAoB,2BAA2B;AAClD,gBAAM,EAAE,aAAa,YAAY,gBAAgB,IAAI,OAAO;AAC5D,gBAAM,UAAU,cAAc,WAAW,SAAS,GAAG,aAAa,UAAU;AAC5E,gBAAM,kBAAkB;AAAA,YACtB,iCAAiC,aAAa,UAAU;AAAA,UAC1D;AAEA,cACE,WAAW,QACX,CAAC,cAAc,mBAAmB,OAAO,KACzC,sBAAsB,wBAAwB,eAAe,GAC7D;AACA;AAAA,cACE,SAAS,8BAA8B,aAAa,YAAY,eAAe;AAAA,YACjF;AACA,4BAAgB,mBAAmB,eAAe;AAAA,UACpD;AAEA;AAAA,QACF;AAAA,QAEA,KAAK,6CAAoB,6BAA6B;AACpD,gBAAM,EAAE,aAAa,WAAW,IAAI,OAAO;AAC3C,gBAAM,SAAS,cAAc,yBAAyB,SAAS,GAAG;AAAA,YAChE;AAAA,YACA;AAAA,UACF,CAAC;AAED,kBAAQ,mBAAmB,IAAI;AAE/B,mBAAS,SAAS,0BAA0B,aAAa,UAAU,CAAC;AAEpE;AAAA,QACF;AAAA,QAEA,KAAK,gCAAgB,8BAA8B;AACjD,gBAAM,EAAE,aAAa,YAAY,UAAU,QAAQ,IAAI,OAAO;AAC9D,gBAAM,iBAAiB,cAAc,kBAAkB,SAAS,GAAG;AAAA,YACjE;AAAA,YACA;AAAA,YACA;AAAA,UACF,CAAC;AAED,cAAI;AAAgB,2BAAe,KAAK,OAAO;AAAA,QACjD;AAAA,MACF;AAEA,aAAO,KAAK,MAAM;AAAA,IACpB;AAAA,EACF,CAAC;AACH;","names":["import_toolkit"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/state/modules/components-meta.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-actions'\n\nexport const ComponentIcon = {\n Accordion: 'accordion',\n Audio: 'audio',\n Billing: 'billing',\n Bolt: 'bolt',\n Button: 'button',\n Card: 'card',\n Cards: 'cards',\n Carousel: 'carousel',\n Chats: 'chats',\n Code: 'code',\n Countdown: 'countdown',\n Cube: 'cube',\n Database: 'database',\n Divider: 'divider',\n Form: 'form',\n Gallery: 'gallery',\n Grid: 'grid',\n Help: 'help',\n Image: 'image',\n Layout: 'layout',\n Lock: 'lock',\n Marker: 'marker',\n Navigation: 'navigation',\n Palette: 'palette',\n SocialLinks: 'social-links',\n Star: 'star',\n Table: 'table',\n Tabs: 'tabs',\n Text: 'text',\n Users: 'users',\n Video: 'video',\n} as const\n\nexport type ComponentIcon = (typeof ComponentIcon)[keyof typeof ComponentIcon]\n\nexport type ComponentMeta = {\n label: string\n icon: ComponentIcon\n hidden: boolean\n description?: string\n builtinSuspense?: boolean\n}\n\nexport type State = Map<string, ComponentMeta>\n\nexport function getInitialState({\n componentsMeta = new Map(),\n}: { componentsMeta?: Map<string, ComponentMeta> } = {}): State {\n return componentsMeta\n}\n\nexport function getComponentsMeta(state: State): Map<string, ComponentMeta> {\n return state\n}\n\nexport function getComponentMeta(state: State, type: string): ComponentMeta | null {\n return getComponentsMeta(state).get(type) ?? 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 ReadOnlyActionTypes.REGISTER_COMPONENT:\n return new Map(state).set(action.payload.type, action.payload.meta)\n\n case ReadOnlyActionTypes.UNREGISTER_COMPONENT: {\n const nextState = new Map(state)\n\n const deleted = nextState.delete(action.payload.type)\n\n return deleted ? nextState : state\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+D;AAC/D,+BAAoC;AAE7B,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACT;
|
|
1
|
+
{"version":3,"sources":["../../../../src/state/modules/components-meta.ts"],"sourcesContent":["import { type Action, type UnknownAction, isKnownAction } from '../actions'\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-actions'\n\nexport const ComponentIcon = {\n Accordion: 'accordion',\n Audio: 'audio',\n Billing: 'billing',\n Bolt: 'bolt',\n Button: 'button',\n Card: 'card',\n Cards: 'cards',\n Carousel: 'carousel',\n Chats: 'chats',\n Code: 'code',\n Countdown: 'countdown',\n Cube: 'cube',\n Database: 'database',\n Divider: 'divider',\n Form: 'form',\n Gallery: 'gallery',\n Grid: 'grid',\n Help: 'help',\n Image: 'image',\n Layout: 'layout',\n Lock: 'lock',\n Marker: 'marker',\n Navigation: 'navigation',\n Palette: 'palette',\n SocialLinks: 'social-links',\n Star: 'star',\n Table: 'table',\n Tabs: 'tabs',\n Text: 'text',\n Users: 'users',\n Video: 'video',\n} as const\n\nexport type ComponentIcon = (typeof ComponentIcon)[keyof typeof ComponentIcon]\n\nexport type ComponentMeta = {\n label: string\n icon: ComponentIcon\n hidden: boolean\n description?: string\n builtinSuspense?: boolean\n unstable_migration?: {\n replacementType: string\n }\n}\n\nexport type State = Map<string, ComponentMeta>\n\nexport function getInitialState({\n componentsMeta = new Map(),\n}: { componentsMeta?: Map<string, ComponentMeta> } = {}): State {\n return componentsMeta\n}\n\nexport function getComponentsMeta(state: State): Map<string, ComponentMeta> {\n return state\n}\n\nexport function getComponentMeta(state: State, type: string): ComponentMeta | null {\n return getComponentsMeta(state).get(type) ?? 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 ReadOnlyActionTypes.REGISTER_COMPONENT:\n return new Map(state).set(action.payload.type, action.payload.meta)\n\n case ReadOnlyActionTypes.UNREGISTER_COMPONENT: {\n const nextState = new Map(state)\n\n const deleted = nextState.delete(action.payload.type)\n\n return deleted ? nextState : state\n }\n\n default:\n return state\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA+D;AAC/D,+BAAoC;AAE7B,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACT;AAiBO,SAAS,gBAAgB;AAAA,EAC9B,iBAAiB,oBAAI,IAAI;AAC3B,IAAqD,CAAC,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