@makeswift/runtime 0.28.8-canary.3 → 0.28.8-canary.4
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/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/link.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/style.js.map +1 -1
- package/dist/cjs/slate/utils/toText.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/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/client/index.js +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/link.js.map +1 -1
- package/dist/esm/runtimes/react/controls/style.js.map +1 -1
- package/dist/esm/slate/utils/toText.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/translations/index.js.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/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/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/translations/get.d.ts.map +1 -1
- package/dist/types/translations/index.d.ts +1 -1
- package/dist/types/translations/index.d.ts.map +1 -1
- package/package.json +5 -3
- package/react/builtins/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/controls/link.ts"],"sourcesContent":["import { z } from 'zod'\nimport { type MouseEvent } from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\n\nimport {\n type DeserializedRecord,\n LinkDefinition as BaseLinkDefinition,\n LinkSchema,\n} from '@makeswift/controls'\n\ntype DataType = z.infer<typeof LinkDefinition.schema.data>\ntype ScrollOptions = z.infer<typeof LinkSchema.scrollOptions>\ntype MouseEventType = MouseEvent<Element>\n\nexport function validateElementRef(href: string) {\n try {\n const hash = new URL(`http://www.example.com/${href}`).hash\n return href === hash ? hash : undefined\n } catch (error) {\n return undefined\n }\n}\n\nexport class LinkDefinition extends BaseLinkDefinition<MouseEventType> {\n static deserialize(data: DeserializedRecord): LinkDefinition {\n if (data.type !== LinkDefinition.type) {\n throw new Error(`Link: expected type ${LinkDefinition.type}, got ${data.type}`)\n }\n\n const { config } = LinkDefinition.schema.definition.parse(data)\n return Link(config)\n }\n\n resolveOnClick(\n data: DataType | undefined,\n href: string,\n scrollOptions: ScrollOptions | undefined,\n ) {\n const onClick = (event: MouseEvent<Element>) => {\n if (event.defaultPrevented) return\n\n if (data && data.type === 'SCROLL_TO_ELEMENT') {\n const hash = validateElementRef(href)\n if (hash == null) {\n console.error(`Scroll-to-element link received invalid href: ${href}`)\n return\n }\n\n event.preventDefault()\n const view = event.view as unknown as Window\n\n scrollIntoView(view.document.querySelector(hash)!, {\n behavior: 'smooth',\n block: scrollOptions?.block,\n })\n\n if (view.location.hash !== hash) view.history.pushState({}, '', hash)\n }\n }\n\n onClick.$scrollOptions = scrollOptions\n return onClick\n }\n}\n\nexport function Link(config?: { description?: string
|
|
1
|
+
{"version":3,"sources":["../../../src/controls/link.ts"],"sourcesContent":["import { z } from 'zod'\nimport { type MouseEvent } from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\n\nimport {\n type DeserializedRecord,\n LinkDefinition as BaseLinkDefinition,\n LinkSchema,\n} from '@makeswift/controls'\n\ntype DataType = z.infer<typeof LinkDefinition.schema.data>\ntype ScrollOptions = z.infer<typeof LinkSchema.scrollOptions>\ntype MouseEventType = MouseEvent<Element>\n\nexport function validateElementRef(href: string) {\n try {\n const hash = new URL(`http://www.example.com/${href}`).hash\n return href === hash ? hash : undefined\n } catch (error) {\n return undefined\n }\n}\n\nexport class LinkDefinition extends BaseLinkDefinition<MouseEventType> {\n static deserialize(data: DeserializedRecord): LinkDefinition {\n if (data.type !== LinkDefinition.type) {\n throw new Error(`Link: expected type ${LinkDefinition.type}, got ${data.type}`)\n }\n\n const { config } = LinkDefinition.schema.definition.parse(data)\n return Link(config)\n }\n\n resolveOnClick(\n data: DataType | undefined,\n href: string,\n scrollOptions: ScrollOptions | undefined,\n ) {\n const onClick = (event: MouseEvent<Element>) => {\n if (event.defaultPrevented) return\n\n if (data && data.type === 'SCROLL_TO_ELEMENT') {\n const hash = validateElementRef(href)\n if (hash == null) {\n console.error(`Scroll-to-element link received invalid href: ${href}`)\n return\n }\n\n event.preventDefault()\n const view = event.view as unknown as Window\n\n scrollIntoView(view.document.querySelector(hash)!, {\n behavior: 'smooth',\n block: scrollOptions?.block,\n })\n\n if (view.location.hash !== hash) view.history.pushState({}, '', hash)\n }\n }\n\n onClick.$scrollOptions = scrollOptions\n return onClick\n }\n}\n\nexport function Link(config?: { description?: string; label?: string }): LinkDefinition {\n return new LinkDefinition(config ?? {})\n}\n"],"mappings":"AAEA,OAAO,oBAAoB;AAE3B;AAAA,EAEE,kBAAkB;AAAA,OAEb;AAMA,SAAS,mBAAmB,MAAc;AAC/C,MAAI;AACF,UAAM,OAAO,IAAI,IAAI,0BAA0B,IAAI,EAAE,EAAE;AACvD,WAAO,SAAS,OAAO,OAAO;AAAA,EAChC,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAEO,MAAM,uBAAuB,mBAAmC;AAAA,EACrE,OAAO,YAAY,MAA0C;AAC3D,QAAI,KAAK,SAAS,eAAe,MAAM;AACrC,YAAM,IAAI,MAAM,uBAAuB,eAAe,IAAI,SAAS,KAAK,IAAI,EAAE;AAAA,IAChF;AAEA,UAAM,EAAE,OAAO,IAAI,eAAe,OAAO,WAAW,MAAM,IAAI;AAC9D,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAEA,eACE,MACA,MACA,eACA;AACA,UAAM,UAAU,CAAC,UAA+B;AAC9C,UAAI,MAAM;AAAkB;AAE5B,UAAI,QAAQ,KAAK,SAAS,qBAAqB;AAC7C,cAAM,OAAO,mBAAmB,IAAI;AACpC,YAAI,QAAQ,MAAM;AAChB,kBAAQ,MAAM,iDAAiD,IAAI,EAAE;AACrE;AAAA,QACF;AAEA,cAAM,eAAe;AACrB,cAAM,OAAO,MAAM;AAEnB,uBAAe,KAAK,SAAS,cAAc,IAAI,GAAI;AAAA,UACjD,UAAU;AAAA,UACV,OAAO,eAAe;AAAA,QACxB,CAAC;AAED,YAAI,KAAK,SAAS,SAAS;AAAM,eAAK,QAAQ,UAAU,CAAC,GAAG,IAAI,IAAI;AAAA,MACtE;AAAA,IACF;AAEA,YAAQ,iBAAiB;AACzB,WAAO;AAAA,EACT;AACF;AAEO,SAAS,KAAK,QAAmE;AACtF,SAAO,IAAI,eAAe,UAAU,CAAC,CAAC;AACxC;","names":[]}
|
|
@@ -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":"AACA;AAAA,EACE;AAAA,OAMK;AAEP,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAGhC,SAAS,oCAAoC;AAC7C,SAAS,iCAAiC;AAC1C,SAAS,kCAAkC;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,MAAM,KAAK,KAAK;AAAA,MACtC,UAAU;AAAA,IACZ;AAAA,IACA,GAAG;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,MAAM,KAAK,KAAK;AAAA,UACtC,OAAO,cAAc,KAAK,KAAK;AAAA,QACjC;AAAA,QACA,GAAI,WAAW,SAAS,MAAM,MAAM,KAClC,0BAA0B,UAAU,eAAe,aAAa;AAAA,QAClE,GAAI,WAAW,SAAS,MAAM,OAAO,KACnC,2BAA2B,WAAW,gBAAgB,cAAc;AAAA,QACtE,GAAI,WAAW,SAAS,MAAM,MAAM,KAAK;AAAA,UACvC,WAAW,mBAAmB,QAAQ,SAAS,KAAK;AAAA,UACpD,aAAa,mBAAmB,QAAQ,WAAW,KAAK;AAAA,UACxD,cAAc,mBAAmB,QAAQ,YAAY,KAAK;AAAA,UAC1D,YAAY,mBAAmB,QAAQ,UAA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S,IAAI;AAAA,EAC1C;AACF;","names":["style"]}
|
|
@@ -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":"AACA,SAAS,aAAa;AAEtB,SAAS,gBAAgC;AAEzC,SAAS,QAAQ,YAAmD;AAClE,MAAI,MAAM,OAAO,UAAU;AAAG,WAAO;AACrC,SAAO,MAAM,QAAQ,UAAU;AACjC;AAEA,SAAS,oBAAoB,YAAwB,MAA8B;AACjF,MAAI,MAAM,OAAO,UAAU,GAAG;AAC5B,WAAO,WAAW,QAAQ;AAAA,EAC5B;AAEA,MAAI,MAAM,iBAAiB,UAAU,GAAG;AACtC,WAAO,SAAS,SAAS,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,MAAM,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,MAAM,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"]}
|
|
@@ -158,32 +158,60 @@ function updateParentElements(elements, elementPaths, rootElement) {
|
|
|
158
158
|
elements.set(element.key, element);
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function getPropChildren(element, propName, descriptors) {
|
|
162
162
|
if (isElementReference(element))
|
|
163
|
-
return
|
|
163
|
+
return null;
|
|
164
164
|
const propDescriptor = descriptors.get(element.type)?.[propName];
|
|
165
165
|
if (propDescriptor == null)
|
|
166
|
-
return
|
|
167
|
-
|
|
168
|
-
return children.length > 0;
|
|
166
|
+
return null;
|
|
167
|
+
return Introspection.getElementChildren(propDescriptor, element.props[propName]);
|
|
169
168
|
}
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
169
|
+
function isChildrenProp(element, propName, descriptors) {
|
|
170
|
+
const children = getPropChildren(element, propName, descriptors);
|
|
171
|
+
return children != null;
|
|
172
|
+
}
|
|
173
|
+
function deleteElement({ elements, elementIds }, elementToDelete, descriptors) {
|
|
174
|
+
for (const element of traverseElementTree(elementToDelete, descriptors)) {
|
|
175
|
+
elements.delete(element.key);
|
|
176
|
+
elementIds.delete(element.key);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function deleteChildrenInProp(elementTree, parentElement, propName, descriptors) {
|
|
180
|
+
const childrenInProp = getPropChildren(parentElement, propName, descriptors);
|
|
181
|
+
if (childrenInProp == null) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
for (const child of childrenInProp) {
|
|
185
|
+
deleteElement(elementTree, child, descriptors);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function deleteElementOrProp({ elements, elementIds }, targetElement, propName, descriptors) {
|
|
189
|
+
if (propName == null) {
|
|
190
|
+
deleteElement({ elements, elementIds }, targetElement, descriptors);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (isChildrenProp(targetElement, propName, descriptors)) {
|
|
194
|
+
deleteChildrenInProp({ elements, elementIds }, targetElement, propName, descriptors);
|
|
195
|
+
}
|
|
196
|
+
const elementInTree = elements.get(targetElement.key);
|
|
197
|
+
if (!elementInTree) {
|
|
198
|
+
console.error(
|
|
199
|
+
`Attempting to remove prop ${propName} from element ${targetElement.key} not found in tree`
|
|
200
|
+
);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (!isElementReference(elementInTree)) {
|
|
204
|
+
const newProps = { ...elementInTree.props };
|
|
205
|
+
delete newProps[propName];
|
|
206
|
+
elements.set(targetElement.key, { ...elementInTree, props: newProps });
|
|
179
207
|
}
|
|
180
208
|
}
|
|
181
209
|
function applyDelete(elementTree, descriptors, rootElements, path) {
|
|
182
|
-
const [
|
|
183
|
-
const [
|
|
210
|
+
const [targetElementPath, ...parentElementPaths] = getChangedElementsPaths(path);
|
|
211
|
+
const [targetElement, propName] = getElementAndPropName(rootElements.before, targetElementPath);
|
|
184
212
|
const elements = new Map(elementTree.elements);
|
|
185
213
|
const elementIds = new Map(elementTree.elementIds);
|
|
186
|
-
|
|
214
|
+
deleteElementOrProp({ elements, elementIds }, targetElement, propName, descriptors);
|
|
187
215
|
updateParentElements(elements, parentElementPaths, rootElements.after);
|
|
188
216
|
return {
|
|
189
217
|
elements,
|
|
@@ -191,7 +219,7 @@ function applyDelete(elementTree, descriptors, rootElements, path) {
|
|
|
191
219
|
};
|
|
192
220
|
}
|
|
193
221
|
function insertElement({ elements, elementIds }, insertedElement, propName, descriptors) {
|
|
194
|
-
if (propName == null ||
|
|
222
|
+
if (propName == null || isChildrenProp(insertedElement, propName, descriptors)) {
|
|
195
223
|
for (const element of traverseElementTree(insertedElement, descriptors)) {
|
|
196
224
|
elements.set(element.key, element);
|
|
197
225
|
if (!isElementReference(element)) {
|
|
@@ -223,11 +251,11 @@ function applyInsert(elementTree, descriptors, rootElements, path) {
|
|
|
223
251
|
}
|
|
224
252
|
function applyUpdate(elementTree, descriptors, rootElements, path) {
|
|
225
253
|
const [updateElementPath, ...parentElementPaths] = getChangedElementsPaths(path);
|
|
226
|
-
const [
|
|
254
|
+
const [targetElement, propName] = getElementAndPropName(rootElements.before, updateElementPath);
|
|
227
255
|
const [insertedElement, _] = getElementAndPropName(rootElements.after, updateElementPath);
|
|
228
256
|
const elements = new Map(elementTree.elements);
|
|
229
257
|
const elementIds = new Map(elementTree.elementIds);
|
|
230
|
-
|
|
258
|
+
deleteElementOrProp({ elements, elementIds }, targetElement, propName, descriptors);
|
|
231
259
|
insertElement({ elements, elementIds }, insertedElement, propName, descriptors);
|
|
232
260
|
updateParentElements(elements, parentElementPaths, rootElements.after);
|
|
233
261
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/state/modules/element-trees.ts"],"sourcesContent":["import { type Operation } from 'ot-json0'\nimport { getIn, removeIn, setIn } from 'immutable'\n\nimport { type Element, type ElementData, isElementReference } from '@makeswift/controls'\n\nimport * as Introspection from '../../prop-controllers/introspection'\n\nimport { type Action, type UnknownAction, isKnownAction } from '../actions'\n\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-actions'\nimport { ReadWriteActionTypes } from '../actions/internal/read-write-actions'\n\nimport { getRootElement, type Document } from './read-only-documents'\nimport { type DescriptorsByComponentType } from './prop-controllers'\n\nexport type ElementTree = {\n elements: Map<string, Element>\n elementIds: Map<string, string>\n}\n\nexport type State = Map<string, ElementTree>\n\nexport function getInitialState(\n documents?: Map<string, Document>,\n descriptors?: DescriptorsByComponentType,\n): State {\n const state = new Map<string, ElementTree>()\n if (documents == null || descriptors == null) return state\n\n for (const [documentKey, document] of documents) {\n state.set(documentKey, buildElementTree(getRootElement(document), descriptors))\n }\n\n return state\n}\n\nfunction getElementTree(state: State, documentKey: string): ElementTree | null {\n return state.get(documentKey) ?? null\n}\n\nexport function getElements(state: State, documentKey: string): Map<string, Element> {\n return getElementTree(state, documentKey)?.elements ?? new Map()\n}\n\nexport function getElementIds(state: State, documentKey: string): Map<string, string> {\n return getElementTree(state, documentKey)?.elementIds ?? new Map()\n}\n\nexport function getElement(state: State, documentKey: string, elementKey: string): Element | null {\n return getElements(state, documentKey).get(elementKey) ?? null\n}\n\nexport function getElementId(state: State, documentKey: string, elementKey: string): string | null {\n return getElementIds(state, documentKey).get(elementKey) ?? 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.CREATE_ELEMENT_TREE: {\n const { document, descriptors } = action.payload\n return new Map(state).set(\n document.key,\n buildElementTree(getRootElement(document), descriptors),\n )\n }\n\n case ReadOnlyActionTypes.DELETE_ELEMENT_TREE: {\n const nextState = new Map(state)\n const deleted = nextState.delete(action.payload.documentKey)\n return deleted ? nextState : state\n }\n\n case ReadWriteActionTypes.CHANGE_ELEMENT_TREE: {\n const { oldDocument, newDocument, descriptors, operation } = action.payload\n const documentKey = oldDocument.key\n console.assert(\n documentKey === newDocument.key,\n `Mismatching document keys ${documentKey} !== ${newDocument.key}`,\n )\n\n const elementTree = state.get(documentKey)\n if (elementTree == null) return state\n\n const updatedElementTree = applyChanges(\n elementTree,\n descriptors,\n {\n old: getRootElement(oldDocument),\n new: getRootElement(newDocument),\n },\n operation,\n )\n\n return new Map(state).set(documentKey, updatedElementTree)\n }\n\n default:\n return state\n }\n}\n\nexport function* traverseElementTree(\n element: Element,\n descriptors: DescriptorsByComponentType,\n): Generator<Element> {\n yield element\n if (isElementReference(element)) return\n\n const elementDescriptors = descriptors.get(element.type)\n if (elementDescriptors == null) return\n\n for (const [propKey, descriptor] of Object.entries(elementDescriptors)) {\n const children = Introspection.getElementChildren(descriptor, element.props[propKey])\n for (const child of children) {\n yield* traverseElementTree(child, descriptors)\n }\n }\n}\n\nfunction getElementIdProp(\n element: ElementData,\n descriptors: DescriptorsByComponentType,\n): string | null {\n const elementDescriptors = descriptors.get(element.type)\n if (elementDescriptors == null) return null\n\n for (const [propName, descriptor] of Object.entries(elementDescriptors)) {\n const elementId = Introspection.getElementId(descriptor, element.props[propName])\n if (elementId != null) return elementId\n }\n\n return null\n}\n\nexport function buildElementTree(\n rootElement: Element,\n descriptors: DescriptorsByComponentType,\n): ElementTree {\n const elements = new Map<string, Element>()\n const elementIds = new Map<string, string>()\n\n for (const element of traverseElementTree(rootElement, descriptors)) {\n elements.set(element.key, element)\n if (!isElementReference(element)) {\n const elementId = getElementIdProp(element, descriptors)\n if (elementId != null) elementIds.set(element.key, elementId)\n }\n }\n\n return {\n elements,\n elementIds,\n }\n}\n\ntype OperationPath = Operation[number]['p']\n\n// performance-sensitive function, intentionally not using `elementData` schema here\nfunction isElement(item: unknown): item is Element {\n return (\n typeof item === 'object' &&\n item != null &&\n 'key' in item &&\n 'type' in item &&\n typeof item.key === 'string' &&\n typeof item.type === 'string'\n )\n}\n\ntype ElementOperationPath = { elementPath: OperationPath; propName: string | null }\n\nfunction getElementOperationPath(path: OperationPath): ElementOperationPath {\n if (path.length === 0) {\n return { elementPath: [], propName: null }\n }\n\n const i = path.findLastIndex(\n (fragment, i) =>\n typeof fragment === 'number' && (i === path.length - 1 || path[i + 1] === 'props'),\n )\n\n if ((i === -1 && path[0] !== 'props') || path.length - i < 3) {\n console.error('Operation path does not point to an element property', { path })\n return { elementPath: [], propName: null }\n }\n\n return { elementPath: path.slice(0, i + 1), propName: `${path.slice(i + 1).at(1)}` }\n}\n\nexport function getChangedElementsPaths(\n path: OperationPath,\n): [ElementOperationPath, ...ElementOperationPath[]] {\n let elementOp = getElementOperationPath(path)\n const result: [ElementOperationPath, ...ElementOperationPath[]] = [elementOp]\n while (elementOp.elementPath.length > 0) {\n elementOp = getElementOperationPath(elementOp.elementPath.slice(0, -1))\n result.push(elementOp)\n }\n\n return result\n}\n\nfunction getElementByPath(rootElement: Element, elementPath: OperationPath): Element | null {\n const item = getIn(rootElement, elementPath)\n if (!isElement(item)) {\n console.error('Expected an element, got', item, {\n rootElement,\n elementPath,\n })\n\n return null\n }\n\n return item\n}\n\nfunction getElementAndPropName(\n rootElement: Element,\n { elementPath, propName }: ElementOperationPath,\n): [Element, string | null] {\n const element = getElementByPath(rootElement, elementPath)\n return element != null ? [element, propName] : [rootElement, null]\n}\n\nfunction updateParentElements(\n elements: ElementTree['elements'],\n elementPaths: ElementOperationPath[],\n rootElement: Element,\n): void {\n elementPaths.forEach(({ elementPath }) => {\n const element = getElementByPath(rootElement, elementPath)\n if (element != null) elements.set(element.key, element)\n })\n}\n\nfunction hasChildren(\n element: Element,\n propName: string,\n descriptors: DescriptorsByComponentType,\n): boolean {\n if (isElementReference(element)) return false\n\n const propDescriptor = descriptors.get(element.type)?.[propName]\n if (propDescriptor == null) return false\n\n const children = Introspection.getElementChildren(propDescriptor, element.props[propName])\n return children.length > 0\n}\n\nfunction deleteElement(\n { elements, elementIds }: ElementTree,\n deletedElement: Element,\n propName: string | null,\n descriptors: DescriptorsByComponentType,\n) {\n if (propName == null || hasChildren(deletedElement, propName, descriptors)) {\n for (const element of traverseElementTree(deletedElement, descriptors)) {\n elements.delete(element.key)\n elementIds.delete(element.key)\n }\n } else {\n elements.delete(deletedElement.key)\n elementIds.delete(deletedElement.key)\n }\n}\n\nfunction applyDelete(\n elementTree: ElementTree,\n descriptors: DescriptorsByComponentType,\n rootElements: { before: Element; after: Element },\n path: OperationPath,\n): ElementTree {\n const [deleteElementPath, ...parentElementPaths] = getChangedElementsPaths(path)\n const [deletedElement, propName] = getElementAndPropName(rootElements.before, deleteElementPath)\n\n const elements = new Map(elementTree.elements)\n const elementIds = new Map(elementTree.elementIds)\n\n deleteElement({ elements, elementIds }, deletedElement, propName, descriptors)\n\n // Use the \"after\" state to efficiently update all of parent subtrees in the state\n updateParentElements(elements, parentElementPaths, rootElements.after)\n\n return {\n elements,\n elementIds,\n }\n}\n\nfunction insertElement(\n { elements, elementIds }: ElementTree,\n insertedElement: Element,\n propName: string | null,\n descriptors: DescriptorsByComponentType,\n) {\n if (propName == null || hasChildren(insertedElement, propName, descriptors)) {\n for (const element of traverseElementTree(insertedElement, descriptors)) {\n elements.set(element.key, element)\n if (!isElementReference(element)) {\n const elementId = getElementIdProp(element, descriptors)\n if (elementId != null) elementIds.set(element.key, elementId)\n }\n }\n } else {\n elements.set(insertedElement.key, insertedElement)\n if (!isElementReference(insertedElement)) {\n const elementId = getElementIdProp(insertedElement, descriptors)\n if (elementId != null) elementIds.set(insertedElement.key, elementId)\n }\n }\n}\n\nfunction applyInsert(\n elementTree: ElementTree,\n descriptors: DescriptorsByComponentType,\n rootElements: { before: Element; after: Element },\n path: OperationPath,\n): ElementTree {\n const [insertedElementPath, ...parentElementPaths] = getChangedElementsPaths(path)\n const [insertedElement, propName] = getElementAndPropName(rootElements.after, insertedElementPath)\n\n const elements = new Map(elementTree.elements)\n const elementIds = new Map(elementTree.elementIds)\n\n insertElement({ elements, elementIds }, insertedElement, propName, descriptors)\n\n // Use the \"after\" state to efficiently update all of parent subtrees in the state\n updateParentElements(elements, parentElementPaths, rootElements.after)\n\n return {\n elements,\n elementIds,\n }\n}\n\nfunction applyUpdate(\n elementTree: ElementTree,\n descriptors: DescriptorsByComponentType,\n rootElements: { before: Element; after: Element },\n path: OperationPath,\n): ElementTree {\n const [updateElementPath, ...parentElementPaths] = getChangedElementsPaths(path)\n const [deletedElement, propName] = getElementAndPropName(rootElements.before, updateElementPath)\n const [insertedElement, _] = getElementAndPropName(rootElements.after, updateElementPath)\n\n const elements = new Map(elementTree.elements)\n const elementIds = new Map(elementTree.elementIds)\n\n deleteElement({ elements, elementIds }, deletedElement, propName, descriptors)\n insertElement({ elements, elementIds }, insertedElement, propName, descriptors)\n\n // Use the \"after\" state to efficiently update all of parent subtrees in the state\n updateParentElements(elements, parentElementPaths, rootElements.after)\n\n return {\n elements,\n elementIds,\n }\n}\n\nfunction applyOpComponent(root: Element, component: Operation[number]): Element {\n let applied: Element = root\n\n if ('ld' in component || 'od' in component) {\n applied = removeIn(applied, component.p)\n }\n\n if ('li' in component) {\n applied = setIn(applied, component.p, component.li)\n }\n\n if ('oi' in component) {\n applied = setIn(applied, component.p, component.oi)\n }\n\n return applied\n}\n\nfunction selectTreeTransform(op: Operation[number]): typeof applyUpdate {\n const hasDelete = 'ld' in op || 'od' in op\n const hasInsert = 'li' in op || 'oi' in op\n\n if (hasDelete && hasInsert) return applyUpdate\n if (hasDelete) return applyDelete\n if (hasInsert) return applyInsert\n\n return elementTree => elementTree\n}\n\nfunction applyChanges(\n elementTree: ElementTree,\n descriptors: DescriptorsByComponentType,\n rootElements: { old: Element; new: Element },\n operation: Operation,\n): ElementTree {\n // Updates the element tree \"cache\" based on the provided operation, which can\n // be composed of 1-n component ops. We apply each component op sequentially\n // to the 'old' root element to determine the changed elements and update the\n // cache accordingly at each intermediate step.\n const result = operation.reduce(\n (acc, op) => {\n const rootBefore = acc.rootBefore\n\n // If there's only one component op, we can skip the application of the op\n // and assume that the result will be the 'new' root element provided to\n // us by the builder.\n const rootAfter = operation.length > 1 ? applyOpComponent(rootBefore, op) : rootElements.new\n\n const roots = { before: rootBefore, after: rootAfter }\n const applyChange = selectTreeTransform(op)\n\n return {\n elementTree: applyChange(acc.elementTree, descriptors, roots, op.p),\n rootBefore: rootAfter,\n }\n },\n { elementTree, rootBefore: rootElements.old },\n )\n\n return result.elementTree\n}\n"],"mappings":"AACA,SAAS,OAAO,UAAU,aAAa;AAEvC,SAAyC,0BAA0B;AAEnE,YAAY,mBAAmB;AAE/B,SAA0C,qBAAqB;AAE/D,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AAErC,SAAS,sBAAqC;AAUvC,SAAS,gBACd,WACA,aACO;AACP,QAAM,QAAQ,oBAAI,IAAyB;AAC3C,MAAI,aAAa,QAAQ,eAAe;AAAM,WAAO;AAErD,aAAW,CAAC,aAAa,QAAQ,KAAK,WAAW;AAC/C,UAAM,IAAI,aAAa,iBAAiB,eAAe,QAAQ,GAAG,WAAW,CAAC;AAAA,EAChF;AAEA,SAAO;AACT;AAEA,SAAS,eAAe,OAAc,aAAyC;AAC7E,SAAO,MAAM,IAAI,WAAW,KAAK;AACnC;AAEO,SAAS,YAAY,OAAc,aAA2C;AACnF,SAAO,eAAe,OAAO,WAAW,GAAG,YAAY,oBAAI,IAAI;AACjE;AAEO,SAAS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../../src/state/modules/element-trees.ts"],"sourcesContent":["import { type Operation } from 'ot-json0'\nimport { getIn, removeIn, setIn } from 'immutable'\n\nimport { type Element, type ElementData, isElementReference } from '@makeswift/controls'\n\nimport * as Introspection from '../../prop-controllers/introspection'\n\nimport { type Action, type UnknownAction, isKnownAction } from '../actions'\n\nimport { ReadOnlyActionTypes } from '../actions/internal/read-only-actions'\nimport { ReadWriteActionTypes } from '../actions/internal/read-write-actions'\n\nimport { getRootElement, type Document } from './read-only-documents'\nimport { type DescriptorsByComponentType } from './prop-controllers'\n\nexport type ElementTree = {\n elements: Map<string, Element>\n elementIds: Map<string, string>\n}\n\nexport type State = Map<string, ElementTree>\n\nexport function getInitialState(\n documents?: Map<string, Document>,\n descriptors?: DescriptorsByComponentType,\n): State {\n const state = new Map<string, ElementTree>()\n if (documents == null || descriptors == null) return state\n\n for (const [documentKey, document] of documents) {\n state.set(documentKey, buildElementTree(getRootElement(document), descriptors))\n }\n\n return state\n}\n\nfunction getElementTree(state: State, documentKey: string): ElementTree | null {\n return state.get(documentKey) ?? null\n}\n\nexport function getElements(state: State, documentKey: string): Map<string, Element> {\n return getElementTree(state, documentKey)?.elements ?? new Map()\n}\n\nexport function getElementIds(state: State, documentKey: string): Map<string, string> {\n return getElementTree(state, documentKey)?.elementIds ?? new Map()\n}\n\nexport function getElement(state: State, documentKey: string, elementKey: string): Element | null {\n return getElements(state, documentKey).get(elementKey) ?? null\n}\n\nexport function getElementId(state: State, documentKey: string, elementKey: string): string | null {\n return getElementIds(state, documentKey).get(elementKey) ?? 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.CREATE_ELEMENT_TREE: {\n const { document, descriptors } = action.payload\n return new Map(state).set(\n document.key,\n buildElementTree(getRootElement(document), descriptors),\n )\n }\n\n case ReadOnlyActionTypes.DELETE_ELEMENT_TREE: {\n const nextState = new Map(state)\n const deleted = nextState.delete(action.payload.documentKey)\n return deleted ? nextState : state\n }\n\n case ReadWriteActionTypes.CHANGE_ELEMENT_TREE: {\n const { oldDocument, newDocument, descriptors, operation } = action.payload\n const documentKey = oldDocument.key\n console.assert(\n documentKey === newDocument.key,\n `Mismatching document keys ${documentKey} !== ${newDocument.key}`,\n )\n\n const elementTree = state.get(documentKey)\n if (elementTree == null) return state\n\n const updatedElementTree = applyChanges(\n elementTree,\n descriptors,\n {\n old: getRootElement(oldDocument),\n new: getRootElement(newDocument),\n },\n operation,\n )\n\n return new Map(state).set(documentKey, updatedElementTree)\n }\n\n default:\n return state\n }\n}\n\nexport function* traverseElementTree(\n element: Element,\n descriptors: DescriptorsByComponentType,\n): Generator<Element> {\n yield element\n if (isElementReference(element)) return\n\n const elementDescriptors = descriptors.get(element.type)\n if (elementDescriptors == null) return\n\n for (const [propKey, descriptor] of Object.entries(elementDescriptors)) {\n const children = Introspection.getElementChildren(descriptor, element.props[propKey])\n for (const child of children) {\n yield* traverseElementTree(child, descriptors)\n }\n }\n}\n\nfunction getElementIdProp(\n element: ElementData,\n descriptors: DescriptorsByComponentType,\n): string | null {\n const elementDescriptors = descriptors.get(element.type)\n if (elementDescriptors == null) return null\n\n for (const [propName, descriptor] of Object.entries(elementDescriptors)) {\n const elementId = Introspection.getElementId(descriptor, element.props[propName])\n if (elementId != null) return elementId\n }\n\n return null\n}\n\nexport function buildElementTree(\n rootElement: Element,\n descriptors: DescriptorsByComponentType,\n): ElementTree {\n const elements = new Map<string, Element>()\n const elementIds = new Map<string, string>()\n\n for (const element of traverseElementTree(rootElement, descriptors)) {\n elements.set(element.key, element)\n if (!isElementReference(element)) {\n const elementId = getElementIdProp(element, descriptors)\n if (elementId != null) elementIds.set(element.key, elementId)\n }\n }\n\n return {\n elements,\n elementIds,\n }\n}\n\ntype OperationPath = Operation[number]['p']\n\n// performance-sensitive function, intentionally not using `elementData` schema here\nfunction isElement(item: unknown): item is Element {\n return (\n typeof item === 'object' &&\n item != null &&\n 'key' in item &&\n 'type' in item &&\n typeof item.key === 'string' &&\n typeof item.type === 'string'\n )\n}\n\ntype ElementOperationPath = { elementPath: OperationPath; propName: string | null }\n\nfunction getElementOperationPath(path: OperationPath): ElementOperationPath {\n if (path.length === 0) {\n return { elementPath: [], propName: null }\n }\n\n const i = path.findLastIndex(\n (fragment, i) =>\n typeof fragment === 'number' && (i === path.length - 1 || path[i + 1] === 'props'),\n )\n\n if ((i === -1 && path[0] !== 'props') || path.length - i < 3) {\n console.error('Operation path does not point to an element property', { path })\n return { elementPath: [], propName: null }\n }\n\n return { elementPath: path.slice(0, i + 1), propName: `${path.slice(i + 1).at(1)}` }\n}\n\nexport function getChangedElementsPaths(\n path: OperationPath,\n): [ElementOperationPath, ...ElementOperationPath[]] {\n let elementOp = getElementOperationPath(path)\n const result: [ElementOperationPath, ...ElementOperationPath[]] = [elementOp]\n while (elementOp.elementPath.length > 0) {\n elementOp = getElementOperationPath(elementOp.elementPath.slice(0, -1))\n result.push(elementOp)\n }\n\n return result\n}\n\nfunction getElementByPath(rootElement: Element, elementPath: OperationPath): Element | null {\n const item = getIn(rootElement, elementPath)\n if (!isElement(item)) {\n console.error('Expected an element, got', item, {\n rootElement,\n elementPath,\n })\n\n return null\n }\n\n return item\n}\n\nfunction getElementAndPropName(\n rootElement: Element,\n { elementPath, propName }: ElementOperationPath,\n): [Element, string | null] {\n const element = getElementByPath(rootElement, elementPath)\n return element != null ? [element, propName] : [rootElement, null]\n}\n\nfunction updateParentElements(\n elements: ElementTree['elements'],\n elementPaths: ElementOperationPath[],\n rootElement: Element,\n): void {\n elementPaths.forEach(({ elementPath }) => {\n const element = getElementByPath(rootElement, elementPath)\n if (element != null) elements.set(element.key, element)\n })\n}\n\nfunction getPropChildren(\n element: Element,\n propName: string,\n descriptors: DescriptorsByComponentType,\n): Element[] | null {\n if (isElementReference(element)) return null\n\n const propDescriptor = descriptors.get(element.type)?.[propName]\n if (propDescriptor == null) return null\n\n return Introspection.getElementChildren(propDescriptor, element.props[propName])\n}\n\nfunction isChildrenProp(\n element: Element,\n propName: string,\n descriptors: DescriptorsByComponentType,\n): boolean {\n const children = getPropChildren(element, propName, descriptors)\n return children != null\n}\n\nfunction deleteElement(\n { elements, elementIds }: ElementTree,\n elementToDelete: Element,\n descriptors: DescriptorsByComponentType,\n) {\n for (const element of traverseElementTree(elementToDelete, descriptors)) {\n elements.delete(element.key)\n elementIds.delete(element.key)\n }\n}\n\nfunction deleteChildrenInProp(\n elementTree: ElementTree,\n parentElement: Element,\n propName: string,\n descriptors: DescriptorsByComponentType,\n) {\n const childrenInProp = getPropChildren(parentElement, propName, descriptors)\n\n if (childrenInProp == null) {\n return\n }\n\n for (const child of childrenInProp) {\n deleteElement(elementTree, child, descriptors)\n }\n}\n\nfunction deleteElementOrProp(\n { elements, elementIds }: ElementTree,\n targetElement: Element,\n propName: string | null,\n descriptors: DescriptorsByComponentType,\n) {\n if (propName == null) {\n deleteElement({ elements, elementIds }, targetElement, descriptors)\n return\n }\n\n if (isChildrenProp(targetElement, propName, descriptors)) {\n deleteChildrenInProp({ elements, elementIds }, targetElement, propName, descriptors)\n }\n\n // The provided targetElement might refer to an element from the before/after documents,\n // not the actual element object from the ElementTree\n const elementInTree = elements.get(targetElement.key)\n\n if (!elementInTree) {\n console.error(\n `Attempting to remove prop ${propName} from element ${targetElement.key} not found in tree`,\n )\n return\n }\n\n if (!isElementReference(elementInTree)) {\n const newProps = { ...elementInTree.props }\n delete newProps[propName]\n elements.set(targetElement.key, { ...elementInTree, props: newProps })\n }\n}\n\nfunction applyDelete(\n elementTree: ElementTree,\n descriptors: DescriptorsByComponentType,\n rootElements: { before: Element; after: Element },\n path: OperationPath,\n): ElementTree {\n const [targetElementPath, ...parentElementPaths] = getChangedElementsPaths(path)\n const [targetElement, propName] = getElementAndPropName(rootElements.before, targetElementPath)\n\n const elements = new Map(elementTree.elements)\n const elementIds = new Map(elementTree.elementIds)\n\n deleteElementOrProp({ elements, elementIds }, targetElement, propName, descriptors)\n\n // Use the \"after\" state to efficiently update all of parent subtrees in the state\n updateParentElements(elements, parentElementPaths, rootElements.after)\n\n return {\n elements,\n elementIds,\n }\n}\n\nfunction insertElement(\n { elements, elementIds }: ElementTree,\n insertedElement: Element,\n propName: string | null,\n descriptors: DescriptorsByComponentType,\n) {\n if (propName == null || isChildrenProp(insertedElement, propName, descriptors)) {\n for (const element of traverseElementTree(insertedElement, descriptors)) {\n elements.set(element.key, element)\n if (!isElementReference(element)) {\n const elementId = getElementIdProp(element, descriptors)\n if (elementId != null) elementIds.set(element.key, elementId)\n }\n }\n } else {\n elements.set(insertedElement.key, insertedElement)\n if (!isElementReference(insertedElement)) {\n const elementId = getElementIdProp(insertedElement, descriptors)\n if (elementId != null) elementIds.set(insertedElement.key, elementId)\n }\n }\n}\n\nfunction applyInsert(\n elementTree: ElementTree,\n descriptors: DescriptorsByComponentType,\n rootElements: { before: Element; after: Element },\n path: OperationPath,\n): ElementTree {\n const [insertedElementPath, ...parentElementPaths] = getChangedElementsPaths(path)\n const [insertedElement, propName] = getElementAndPropName(rootElements.after, insertedElementPath)\n\n const elements = new Map(elementTree.elements)\n const elementIds = new Map(elementTree.elementIds)\n\n insertElement({ elements, elementIds }, insertedElement, propName, descriptors)\n\n // Use the \"after\" state to efficiently update all of parent subtrees in the state\n updateParentElements(elements, parentElementPaths, rootElements.after)\n\n return {\n elements,\n elementIds,\n }\n}\n\nfunction applyUpdate(\n elementTree: ElementTree,\n descriptors: DescriptorsByComponentType,\n rootElements: { before: Element; after: Element },\n path: OperationPath,\n): ElementTree {\n const [updateElementPath, ...parentElementPaths] = getChangedElementsPaths(path)\n const [targetElement, propName] = getElementAndPropName(rootElements.before, updateElementPath)\n const [insertedElement, _] = getElementAndPropName(rootElements.after, updateElementPath)\n\n const elements = new Map(elementTree.elements)\n const elementIds = new Map(elementTree.elementIds)\n\n deleteElementOrProp({ elements, elementIds }, targetElement, propName, descriptors)\n\n insertElement({ elements, elementIds }, insertedElement, propName, descriptors)\n\n // Use the \"after\" state to efficiently update all of parent subtrees in the state\n updateParentElements(elements, parentElementPaths, rootElements.after)\n\n return {\n elements,\n elementIds,\n }\n}\n\nfunction applyOpComponent(root: Element, component: Operation[number]): Element {\n let applied: Element = root\n\n if ('ld' in component || 'od' in component) {\n applied = removeIn(applied, component.p)\n }\n\n if ('li' in component) {\n applied = setIn(applied, component.p, component.li)\n }\n\n if ('oi' in component) {\n applied = setIn(applied, component.p, component.oi)\n }\n\n return applied\n}\n\nfunction selectTreeTransform(op: Operation[number]): typeof applyUpdate {\n const hasDelete = 'ld' in op || 'od' in op\n const hasInsert = 'li' in op || 'oi' in op\n\n if (hasDelete && hasInsert) return applyUpdate\n if (hasDelete) return applyDelete\n if (hasInsert) return applyInsert\n\n return elementTree => elementTree\n}\n\nfunction applyChanges(\n elementTree: ElementTree,\n descriptors: DescriptorsByComponentType,\n rootElements: { old: Element; new: Element },\n operation: Operation,\n): ElementTree {\n // Updates the element tree \"cache\" based on the provided operation, which can\n // be composed of 1-n component ops. We apply each component op sequentially\n // to the 'old' root element to determine the changed elements and update the\n // cache accordingly at each intermediate step.\n const result = operation.reduce(\n (acc, op) => {\n const rootBefore = acc.rootBefore\n\n // If there's only one component op, we can skip the application of the op\n // and assume that the result will be the 'new' root element provided to\n // us by the builder.\n const rootAfter = operation.length > 1 ? applyOpComponent(rootBefore, op) : rootElements.new\n\n const roots = { before: rootBefore, after: rootAfter }\n const applyChange = selectTreeTransform(op)\n\n return {\n elementTree: applyChange(acc.elementTree, descriptors, roots, op.p),\n rootBefore: rootAfter,\n }\n },\n { elementTree, rootBefore: rootElements.old },\n )\n\n return result.elementTree\n}\n"],"mappings":"AACA,SAAS,OAAO,UAAU,aAAa;AAEvC,SAAyC,0BAA0B;AAEnE,YAAY,mBAAmB;AAE/B,SAA0C,qBAAqB;AAE/D,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AAErC,SAAS,sBAAqC;AAUvC,SAAS,gBACd,WACA,aACO;AACP,QAAM,QAAQ,oBAAI,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;AAErE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEA,SAAS,iBAAiB,MAAe,WAAuC;AAC9E,MAAI,UAAmB;AAEvB,MAAI,QAAQ,aAAa,QAAQ,WAAW;AAC1C,cAAU,SAAS,SAAS,UAAU,CAAC;AAAA,EACzC;AAEA,MAAI,QAAQ,WAAW;AACrB,cAAU,MAAM,SAAS,UAAU,GAAG,UAAU,EAAE;AAAA,EACpD;AAEA,MAAI,QAAQ,WAAW;AACrB,cAAU,MAAM,SAAS,UAAU,GAAG,UAAU,EAAE;AAAA,EACpD;AAEA,SAAO;AACT;AAEA,SAAS,oBAAoB,IAA2C;AACtE,QAAM,YAAY,QAAQ,MAAM,QAAQ;AACxC,QAAM,YAAY,QAAQ,MAAM,QAAQ;AAExC,MAAI,aAAa;AAAW,WAAO;AACnC,MAAI;AAAW,WAAO;AACtB,MAAI;AAAW,WAAO;AAEtB,SAAO,iBAAe;AACxB;AAEA,SAAS,aACP,aACA,aACA,cACA,WACa;AAKb,QAAM,SAAS,UAAU;AAAA,IACvB,CAAC,KAAK,OAAO;AACX,YAAM,aAAa,IAAI;AAKvB,YAAM,YAAY,UAAU,SAAS,IAAI,iBAAiB,YAAY,EAAE,IAAI,aAAa;AAEzF,YAAM,QAAQ,EAAE,QAAQ,YAAY,OAAO,UAAU;AACrD,YAAM,cAAc,oBAAoB,EAAE;AAE1C,aAAO;AAAA,QACL,aAAa,YAAY,IAAI,aAAa,aAAa,OAAO,GAAG,CAAC;AAAA,QAClE,YAAY;AAAA,MACd;AAAA,IACF;AAAA,IACA,EAAE,aAAa,YAAY,aAAa,IAAI;AAAA,EAC9C;AAEA,SAAO,OAAO;AAChB;","names":["i"]}
|
|
@@ -3,10 +3,7 @@ import * as ElementTrees from "../modules/element-trees";
|
|
|
3
3
|
import { getTranslatableData } from "../../controls/control";
|
|
4
4
|
function getTranslatableContent(descriptors, elementTree) {
|
|
5
5
|
const translatableData = {};
|
|
6
|
-
for (const element of ElementTrees.traverseElementTree(
|
|
7
|
-
elementTree,
|
|
8
|
-
descriptors
|
|
9
|
-
)) {
|
|
6
|
+
for (const element of ElementTrees.traverseElementTree(elementTree, descriptors)) {
|
|
10
7
|
if (Documents.isElementReference(element))
|
|
11
8
|
continue;
|
|
12
9
|
const elementDescriptors = descriptors.get(element.type);
|
|
@@ -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-controllers'\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(
|
|
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-controllers'\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,YAAY,eAAe;AAC3B,YAAY,kBAAkB;AAC9B,SAAS,2BAA2B;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,uBAAuB,oBAAoB,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/translations/index.ts"],"sourcesContent":["export { getTranslatableContent } from '../state/translations/get'\nexport { mergeTranslatedContent } from '../state/translations/merge'\nexport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/translations/index.ts"],"sourcesContent":["export { getTranslatableContent } from '../state/translations/get'\nexport { mergeTranslatedContent } from '../state/translations/merge'\nexport type {\n DescriptorsByComponentType,\n DescriptorsByProp,\n} from '../state/modules/prop-controllers'\nexport type { ElementData, Data, Element } from '../state/read-only-state'\nexport type { TranslationDto } from '@makeswift/controls'\n"],"mappings":"AAAA,SAAS,8BAA8B;AACvC,SAAS,8BAA8B;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/builtin/Navigation/components/DropDownButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/builtin/Navigation/components/DropDownButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAKxB,SAAS,EACV,MAAM,OAAO,CAAA;AASd,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAC9C,OAAO,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
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/shared/BackgroundsContainer/components/BackgroundVideo/index.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/shared/BackgroundsContainer/components/BackgroundVideo/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,SAAS,EACV,MAAM,OAAO,CAAA;AA6Dd,KAAK,KAAK,GAAG;IACX,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,GAAQ,EACR,WAAoB,EACpB,IAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,GAAG,SAAS,CA+DnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toText.d.ts","sourceRoot":"","sources":["../../../../src/slate/utils/toText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAA;AAGvC,OAAO,EAAY,cAAc,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"toText.d.ts","sourceRoot":"","sources":["../../../../src/slate/utils/toText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,OAAO,CAAA;AAGvC,OAAO,EAAY,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAsCtE,wBAAgB,MAAM,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAE9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialized-descriptors-from-builder.d.ts","sourceRoot":"","sources":["../../../../../src/state/__tests__/fixtures/serialized-descriptors-from-builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,yCAAyC,EAAE,
|
|
1
|
+
{"version":3,"file":"serialized-descriptors-from-builder.d.ts","sourceRoot":"","sources":["../../../../../src/state/__tests__/fixtures/serialized-descriptors-from-builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,yCAAyC,EAAE,CACtD,iBAAiB,EAAE,MAAM,WAAW,KACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkgCzC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translatable-content-sample.d.ts","sourceRoot":"","sources":["../../../../../src/state/__tests__/fixtures/translatable-content-sample.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD,eAAO,MAAM,oCAAoC,EAAE,
|
|
1
|
+
{"version":3,"file":"translatable-content-sample.d.ts","sourceRoot":"","sources":["../../../../../src/state/__tests__/fixtures/translatable-content-sample.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD,eAAO,MAAM,oCAAoC,EAAE,WA6VlD,CAAA"}
|