@fragmentsx/render-react 1.6.3 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/hooks/layer/useReadVariables.d.ts.map +1 -1
  2. package/dist/hooks/layer/useResolvedLayerVariables.d.ts +1 -0
  3. package/dist/hooks/layer/useResolvedLayerVariables.d.ts.map +1 -1
  4. package/dist/hooks/layer-styles/useLayerStyles/index.d.ts +5 -1
  5. package/dist/hooks/layer-styles/useLayerStyles/index.d.ts.map +1 -1
  6. package/dist/hooks/layer-styles/useLayerStyles/useImagePaint.d.ts +1 -1
  7. package/dist/hooks/layer-styles/useLayerStyles/useImagePaint.d.ts.map +1 -1
  8. package/dist/hooks/layer-styles/useStyleRegistrar.d.ts +8 -0
  9. package/dist/hooks/layer-styles/useStyleRegistrar.d.ts.map +1 -0
  10. package/dist/hooks/utils/useClassnames.d.ts.map +1 -1
  11. package/dist/index.cjs.js +179 -107
  12. package/dist/index.es.js +179 -107
  13. package/dist/nodes/Collection/Collection.d.ts.map +1 -1
  14. package/dist/nodes/Collection/hooks/useCollection.d.ts +0 -1
  15. package/dist/nodes/Collection/hooks/useCollection.d.ts.map +1 -1
  16. package/dist/nodes/CollectionItem/CollectionItem.d.ts.map +1 -1
  17. package/dist/nodes/CollectionItem/hooks/useCollection.d.ts +0 -1
  18. package/dist/nodes/CollectionItem/hooks/useCollection.d.ts.map +1 -1
  19. package/dist/nodes/Frame/Frame.d.ts.map +1 -1
  20. package/dist/nodes/Frame/hooks/useFrame.d.ts +0 -1
  21. package/dist/nodes/Frame/hooks/useFrame.d.ts.map +1 -1
  22. package/dist/nodes/Instance/Instance.d.ts.map +1 -1
  23. package/dist/nodes/Instance/hooks/useInstance.d.ts +1 -1
  24. package/dist/nodes/Text/Text.d.ts +1 -0
  25. package/dist/nodes/Text/Text.d.ts.map +1 -1
  26. package/dist/nodes/Text/hooks/useTextAttributes.d.ts +0 -1
  27. package/dist/nodes/Text/hooks/useTextAttributes.d.ts.map +1 -1
  28. package/dist/providers/InstanceContext.d.ts +1 -0
  29. package/dist/providers/InstanceContext.d.ts.map +1 -1
  30. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"useReadVariables.d.ts","sourceRoot":"","sources":["../../../src/hooks/layer/useReadVariables.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAyBrE,eAAO,MAAM,gBAAgB,iBACb,OAAO,EAAE,kBACP,UAAU,GAAG,IAAI;;;GA2IlC,CAAC"}
1
+ {"version":3,"file":"useReadVariables.d.ts","sourceRoot":"","sources":["../../../src/hooks/layer/useReadVariables.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAyBrE,eAAO,MAAM,gBAAgB,iBACb,OAAO,EAAE,kBACP,UAAU,GAAG,IAAI;;;GA+IlC,CAAC"}
@@ -2,6 +2,7 @@ export interface ResolvedVariables {
2
2
  values: Record<string, any>;
3
3
  cssVariableValues: Record<string, any>;
4
4
  rawValues: Record<string, any>;
5
+ isVariable: Record<string, boolean>;
5
6
  }
6
7
  export declare const useResolvedLayerVariables: (layer: any, rawLayer: any, _customScopes?: unknown[]) => ResolvedVariables;
7
8
  //# sourceMappingURL=useResolvedLayerVariables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useResolvedLayerVariables.d.ts","sourceRoot":"","sources":["../../../src/hooks/layer/useResolvedLayerVariables.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AA8BD,eAAO,MAAM,yBAAyB,UAC7B,GAAG,YACA,GAAG,kBACG,OAAO,EAAE,KACxB,iBA2DF,CAAC"}
1
+ {"version":3,"file":"useResolvedLayerVariables.d.ts","sourceRoot":"","sources":["../../../src/hooks/layer/useResolvedLayerVariables.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AA+BD,eAAO,MAAM,yBAAyB,UAC7B,GAAG,YACA,GAAG,kBACG,OAAO,EAAE,KACxB,iBA6DF,CAAC"}
@@ -1,3 +1,7 @@
1
1
  import { LinkKey } from '@graph-state/core';
2
- export declare const useLayerStyles: (layerKey: LinkKey) => any;
2
+ interface UseLayerStylesOptions {
3
+ collectStyle?: boolean;
4
+ }
5
+ export declare const useLayerStyles: (layerKey: LinkKey, options?: UseLayerStylesOptions) => void;
6
+ export {};
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/layer-styles/useLayerStyles/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAwB5C,eAAO,MAAM,cAAc,aAAc,OAAO,QA2I/C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/layer-styles/useLayerStyles/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAyB5C,UAAU,qBAAqB;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,aACf,OAAO,YACP,qBAAqB,SAuMhC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { LinkKey } from '@graph-state/core';
2
2
  import { ResolvedVariables } from '../../layer/useResolvedLayerVariables';
3
3
  export declare const calcImagePaint: (imageVars: ResolvedVariables) => {
4
- background: any;
4
+ background: unknown;
5
5
  backgroundRepeat: string;
6
6
  backgroundSize: any;
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useImagePaint.d.ts","sourceRoot":"","sources":["../../../../src/hooks/layer-styles/useLayerStyles/useImagePaint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,eAAO,MAAM,cAAc,cAAe,iBAAiB;;;;CAM1D,CAAC;AAEF,eAAO,MAAM,aAAa,iBAAkB,OAAO;;;;CAUlD,CAAC"}
1
+ {"version":3,"file":"useImagePaint.d.ts","sourceRoot":"","sources":["../../../../src/hooks/layer-styles/useLayerStyles/useImagePaint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAM5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,eAAO,MAAM,cAAc,cAAe,iBAAiB;;;;CAM1D,CAAC;AAEF,eAAO,MAAM,aAAa,iBAAkB,OAAO;;;;CAUlD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { LinkKey } from '@graph-state/core';
2
+ export declare const useStyleRegistrar: (layerKey: LinkKey) => {
3
+ add(prop: string, value: any, isDynamic: boolean): void;
4
+ addAll(styles: Record<string, any>, isDynamic: boolean): void;
5
+ flush(): void;
6
+ getStyles(): Record<string, any>;
7
+ };
8
+ //# sourceMappingURL=useStyleRegistrar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStyleRegistrar.d.ts","sourceRoot":"","sources":["../../../src/hooks/layer-styles/useStyleRegistrar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAI5C,eAAO,MAAM,iBAAiB,aAAc,OAAO;cAWrC,MAAM,SAAS,GAAG,aAAa,OAAO;mBAIjC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,aAAa,OAAO;;iBAkBzC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAInC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useClassnames.d.ts","sourceRoot":"","sources":["../../../src/hooks/utils/useClassnames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAMxD,eAAO,MAAM,aAAa,aAAc,OAAO,WAAW,UAAU,kBAsBnE,CAAC"}
1
+ {"version":3,"file":"useClassnames.d.ts","sourceRoot":"","sources":["../../../src/hooks/utils/useClassnames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAQxD,eAAO,MAAM,aAAa,aAAc,OAAO,WAAW,UAAU,kBAyBnE,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -23,7 +23,8 @@ const InstanceContext = react.createContext({
23
23
  innerManager: null,
24
24
  props: {},
25
25
  definitions: [],
26
- onChangeProps: null
26
+ onChangeProps: null,
27
+ instanceId: null
27
28
  });
28
29
  const RenderTargetContext = react.createContext(
29
30
  definition.definition.renderTarget.document
@@ -930,21 +931,22 @@ const useReadVariables = (variableKeys, customManager) => {
930
931
  return filterKeys.map((variableKey, index) => {
931
932
  var _a2, _b2;
932
933
  variableLayers[index];
933
- const layer = ((_a2 = getNormalizeLayer(variableKey, resultManager)) == null ? void 0 : _a2.layer) ?? null;
934
- const { _id: propertyId } = layer ?? {};
935
- let collectionItemProp = void 0;
936
- if (lastCollectionItem && propertyId) {
937
- collectionItemProp = utils.isPrimitive(lastCollectionItem == null ? void 0 : lastCollectionItem.value) && ((_b2 = core.entityOfKey(lastCollectionItem == null ? void 0 : lastCollectionItem.sourceDefinition)) == null ? void 0 : _b2._id) === propertyId ? lastCollectionItem == null ? void 0 : lastCollectionItem.value : extractVariableValue(lastCollectionItem == null ? void 0 : lastCollectionItem.value, propertyId);
938
- }
939
- const instanceProp = (instanceProps == null ? void 0 : instanceProps[propertyId]) ?? null;
940
934
  const campaignLayer = campaignManager == null ? void 0 : campaignManager.resolve(variableKey);
941
935
  const campaignProp = (campaignLayer == null ? void 0 : campaignLayer.defaultValue) ?? null;
942
936
  const areaLayer = areaManager == null ? void 0 : areaManager.resolve(variableKey);
943
937
  const areaProp = (areaLayer == null ? void 0 : areaLayer.defaultValue) ?? null;
944
938
  const globalLayer = globalManager == null ? void 0 : globalManager.resolve(variableKey);
945
939
  const globalProp = (globalLayer == null ? void 0 : globalLayer.defaultValue) ?? null;
946
- const required = (layer == null ? void 0 : layer.required) ?? false;
947
- const defaultValue = (layer == null ? void 0 : layer.defaultValue) ?? null;
940
+ const fragmentLayer = ((_a2 = getNormalizeLayer(variableKey, resultManager)) == null ? void 0 : _a2.layer) ?? null;
941
+ const layer = fragmentLayer ?? campaignLayer ?? areaLayer ?? globalLayer ?? null;
942
+ const { _id: propertyId } = layer ?? {};
943
+ let collectionItemProp = void 0;
944
+ if (lastCollectionItem && propertyId) {
945
+ collectionItemProp = utils.isPrimitive(lastCollectionItem == null ? void 0 : lastCollectionItem.value) && ((_b2 = core.entityOfKey(lastCollectionItem == null ? void 0 : lastCollectionItem.sourceDefinition)) == null ? void 0 : _b2._id) === propertyId ? lastCollectionItem == null ? void 0 : lastCollectionItem.value : extractVariableValue(lastCollectionItem == null ? void 0 : lastCollectionItem.value, propertyId);
946
+ }
947
+ const instanceProp = (instanceProps == null ? void 0 : instanceProps[propertyId]) ?? null;
948
+ const required = (fragmentLayer == null ? void 0 : fragmentLayer.required) ?? (layer == null ? void 0 : layer.required) ?? false;
949
+ const defaultValue = (fragmentLayer == null ? void 0 : fragmentLayer.defaultValue) ?? (layer == null ? void 0 : layer.defaultValue) ?? null;
948
950
  const currentValue = collectionItemProp ?? (variableKey === instanceProp ? null : instanceProp) ?? campaignProp ?? areaProp ?? globalProp ?? null;
949
951
  const resultValue = required ? currentValue : currentValue ?? defaultValue;
950
952
  if (definition.isVariableLink(resultValue)) {
@@ -968,7 +970,8 @@ const useReadVariables = (variableKeys, customManager) => {
968
970
  const EMPTY_RESOLVED = {
969
971
  values: {},
970
972
  cssVariableValues: {},
971
- rawValues: {}
973
+ rawValues: {},
974
+ isVariable: {}
972
975
  };
973
976
  const collectVariableKeys = (layer) => {
974
977
  const keys = [];
@@ -1003,9 +1006,11 @@ const useResolvedLayerVariables = (layer, rawLayer, _customScopes) => {
1003
1006
  const values = {};
1004
1007
  const cssVariableValues = {};
1005
1008
  const rawValues = {};
1009
+ const isVariable = {};
1006
1010
  const resolveField = (fieldPath, value, raw) => {
1007
1011
  var _a2;
1008
1012
  rawValues[fieldPath] = raw;
1013
+ isVariable[fieldPath] = definition.isVariableLink(value);
1009
1014
  if (definition.isVariableLink(value)) {
1010
1015
  const resolvedValue = value in resolvedByKey ? resolvedByKey[value] : value;
1011
1016
  values[fieldPath] = resolvedValue;
@@ -1031,7 +1036,7 @@ const useResolvedLayerVariables = (layer, rawLayer, _customScopes) => {
1031
1036
  }
1032
1037
  }
1033
1038
  }
1034
- return { values, cssVariableValues, rawValues };
1039
+ return { values, cssVariableValues, rawValues, isVariable };
1035
1040
  };
1036
1041
  const useRenderTarget = () => {
1037
1042
  const renderTarget = react.useContext(RenderTargetContext);
@@ -1271,10 +1276,10 @@ const useLayerLinearGradient = (linearGradientLink) => {
1271
1276
  const stopsPosition = useLayersValue(stops, "position");
1272
1277
  const stopValues = react.useMemo(
1273
1278
  () => (stops == null ? void 0 : stops.flatMap((stop, index) => {
1274
- var _a, _b, _c;
1279
+ var _a, _b;
1275
1280
  return [
1276
- (_b = (_a = stopsValue == null ? void 0 : stopsValue.at(index)) == null ? void 0 : _a.at(2)) == null ? void 0 : _b.cssVariableValue,
1277
- (_c = stopsPosition == null ? void 0 : stopsPosition.at(index)) == null ? void 0 : _c.at(0)
1281
+ (_a = stopsValue == null ? void 0 : stopsValue.at(index)) == null ? void 0 : _a.at(0),
1282
+ (_b = stopsPosition == null ? void 0 : stopsPosition.at(index)) == null ? void 0 : _b.at(0)
1278
1283
  ];
1279
1284
  })) ?? [],
1280
1285
  [stops, stopsValue, stopsPosition]
@@ -1286,6 +1291,38 @@ const useLayerLinearGradient = (linearGradientLink) => {
1286
1291
  [angle, stopValues]
1287
1292
  );
1288
1293
  };
1294
+ const useStyleRegistrar = (layerKey) => {
1295
+ const { manager } = react.useContext(FragmentContext);
1296
+ const { instanceId } = react.useContext(InstanceContext);
1297
+ const baseline = {};
1298
+ const instance = {};
1299
+ const hasInstance = !!instanceId;
1300
+ return {
1301
+ add(prop, value, isDynamic) {
1302
+ (isDynamic && hasInstance ? instance : baseline)[prop] = value;
1303
+ },
1304
+ addAll(styles, isDynamic) {
1305
+ if (styles) {
1306
+ Object.assign(isDynamic && hasInstance ? instance : baseline, styles);
1307
+ }
1308
+ },
1309
+ flush() {
1310
+ var _a, _b, _c, _d;
1311
+ (_b = (_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.addBaselineStyle) == null ? void 0 : _b.call(_a, layerKey, baseline);
1312
+ if (instanceId && Object.keys(instance).length > 0) {
1313
+ (_d = (_c = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _c.addInstanceStyle) == null ? void 0 : _d.call(
1314
+ _c,
1315
+ layerKey,
1316
+ instanceId,
1317
+ instance
1318
+ );
1319
+ }
1320
+ },
1321
+ getStyles() {
1322
+ return { ...baseline, ...instance };
1323
+ }
1324
+ };
1325
+ };
1289
1326
  const processOptionalSize = (value, type) => {
1290
1327
  if (value === -1) return "";
1291
1328
  if (type === definition.definition.sizing.Fixed) return utils.toPx(value);
@@ -1517,7 +1554,7 @@ const useLayerPosition = (layerKey) => {
1517
1554
  const calcImagePaint = (imageVars) => {
1518
1555
  var _a, _b;
1519
1556
  return {
1520
- background: imageVars.cssVariableValues.src,
1557
+ background: transformCssValue(imageVars.values.src),
1521
1558
  backgroundRepeat: "no-repeat",
1522
1559
  backgroundSize: (_b = (_a = imageVars.values.scale) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a)
1523
1560
  };
@@ -1535,16 +1572,16 @@ const useImagePaint = (imageLinkKey) => {
1535
1572
  };
1536
1573
  const calcLayerBackground = (paintVars, imageVars, imageSizeVars, linearGradient) => {
1537
1574
  const fillType = paintVars.values.type;
1538
- const cssSolidFill = paintVars.cssVariableValues.solid;
1539
- const cssImageSize = imageSizeVars.cssVariableValues.imageSize;
1575
+ const solidFill = paintVars.values.solid;
1576
+ const imageSize = imageSizeVars.values.imageSize;
1540
1577
  if (fillType === definition.definition.paintMode.Solid) {
1541
- return { background: cssSolidFill };
1578
+ return { background: solidFill };
1542
1579
  }
1543
1580
  if (fillType === definition.definition.paintMode.Image) {
1544
1581
  const image = calcImagePaint(imageVars);
1545
1582
  return {
1546
1583
  ...image,
1547
- backgroundSize: cssImageSize ?? image.backgroundSize
1584
+ backgroundSize: imageSize ?? image.backgroundSize
1548
1585
  };
1549
1586
  }
1550
1587
  if (fillType === definition.definition.paintMode.LinearGradient) {
@@ -1662,7 +1699,7 @@ const calcLayerBorder = (borderVars, borderPaintVars, borderLinearGradient, pain
1662
1699
  };
1663
1700
  }
1664
1701
  if (borderPaint.type === definition.definition.paintMode.Solid) {
1665
- return calcBorderSides(type, width, borderPaint.solidCssValue);
1702
+ return calcBorderSides(type, width, borderPaint.solid);
1666
1703
  }
1667
1704
  return { border: null };
1668
1705
  };
@@ -1807,7 +1844,9 @@ const useLayerFlex = (layerKey) => {
1807
1844
  };
1808
1845
  };
1809
1846
  const SKIP_OVERRIDE = { skipOverrideCheck: true };
1810
- const useLayerStyles = (layerKey) => {
1847
+ const useLayerStyles = (layerKey, options) => {
1848
+ const collectStyle = (options == null ? void 0 : options.collectStyle) ?? true;
1849
+ const reg = useStyleRegistrar(layerKey);
1811
1850
  try {
1812
1851
  if (!layerKey) throw new Error("Empty layer key");
1813
1852
  const { manager: fragmentManager } = react.useContext(FragmentContext);
@@ -1906,24 +1945,47 @@ const useLayerStyles = (layerKey) => {
1906
1945
  const layout = calcLayerLayout(vars);
1907
1946
  const textStyles = calcLayerTextStyles(vars);
1908
1947
  const layerFlex = calcLayerFlex(vars, parentVars);
1909
- return {
1910
- ...background,
1911
- ...border,
1912
- ...position,
1913
- opacity: vars.values.opacity,
1914
- overflow: vars.values.overflow,
1915
- rotate: utils.isValue(vars.values.rotate) ? `${vars.values.rotate}deg` : null,
1916
- "border-radius": utils.isValue(vars.rawValues.borderRadius) ? vars.values.borderRadius : null,
1917
- "white-space": vars.values.whiteSpace,
1918
- "z-index": vars.values.zIndex !== -1 ? vars.values.zIndex : null,
1919
- ...layout,
1920
- ...layerSize,
1921
- ...textStyles,
1922
- ...layerFlex,
1923
- display
1924
- };
1948
+ reg.add("opacity", vars.values.opacity, vars.isVariable.opacity);
1949
+ reg.add("overflow", vars.values.overflow, vars.isVariable.overflow);
1950
+ reg.add(
1951
+ "border-radius",
1952
+ utils.isValue(vars.rawValues.borderRadius) ? vars.values.borderRadius : null,
1953
+ vars.isVariable.borderRadius
1954
+ );
1955
+ reg.add("white-space", vars.values.whiteSpace, vars.isVariable.whiteSpace);
1956
+ reg.add(
1957
+ "rotate",
1958
+ utils.isValue(vars.values.rotate) ? `${vars.values.rotate}deg` : null,
1959
+ vars.isVariable.rotate
1960
+ );
1961
+ reg.add(
1962
+ "z-index",
1963
+ vars.values.zIndex !== -1 ? vars.values.zIndex : null,
1964
+ vars.isVariable.zIndex
1965
+ );
1966
+ const bgDynamic = paintVars.isVariable.solid || paintVars.isVariable.type || imageVars.isVariable.src;
1967
+ reg.addAll(background, bgDynamic);
1968
+ const borderDynamic = borderPaintVars.isVariable.solid || borderVars.isVariable.type;
1969
+ reg.addAll(border, borderDynamic);
1970
+ const posDynamic = vars.isVariable.width || vars.isVariable.height || vars.isVariable.position || vars.isVariable.widthType || vars.isVariable.heightType;
1971
+ reg.addAll(position, posDynamic);
1972
+ const layoutDynamic = vars.isVariable.layerMode || vars.isVariable.layerDirection || vars.isVariable.layerDistribute || vars.isVariable.layerAlign || vars.isVariable.padding || vars.isVariable.layerGap;
1973
+ reg.addAll(layout, layoutDynamic);
1974
+ const flexDynamic = vars.isVariable.widthType || vars.isVariable.heightType || parentVars.isVariable.layerDirection;
1975
+ reg.addAll(layerFlex, flexDynamic);
1976
+ const sizeDynamic = vars.isVariable.minWidth || vars.isVariable.maxWidth || vars.isVariable.minHeight || vars.isVariable.maxHeight;
1977
+ reg.addAll(layerSize, sizeDynamic);
1978
+ const textDynamic = vars.isVariable["attributes.color"];
1979
+ reg.addAll(textStyles, textDynamic);
1980
+ reg.add(
1981
+ "display",
1982
+ display,
1983
+ vars.isVariable.visible || vars.isVariable.layerMode
1984
+ );
1985
+ if (collectStyle) {
1986
+ reg.flush();
1987
+ }
1925
1988
  } catch (e) {
1926
- return {};
1927
1989
  }
1928
1990
  };
1929
1991
  const MAX_NESTING_DEPTH = 5;
@@ -2030,6 +2092,7 @@ const useHash = (layerKey, manager) => {
2030
2092
  };
2031
2093
  const useClassnames = (layerKey, manager) => {
2032
2094
  const hash = useHash(layerKey, manager);
2095
+ const { instanceId } = react.useContext(InstanceContext);
2033
2096
  const [classnames] = useLayerValue(layerKey, "classnames", { manager });
2034
2097
  const values = useLayersValue(classnames, "value");
2035
2098
  const enables = useLayersValue(classnames, "enabled");
@@ -2041,40 +2104,13 @@ const useClassnames = (layerKey, manager) => {
2041
2104
  [values, enables]
2042
2105
  );
2043
2106
  if (!layerKey || !manager) return null;
2044
- let base = [hash];
2107
+ const instanceHash = instanceId ? utils.hashGenerator(instanceId) : null;
2108
+ let base = [hash, instanceHash].filter(Boolean);
2045
2109
  if (classnames == null ? void 0 : classnames.length) {
2046
2110
  base = [...base, ...list];
2047
2111
  }
2048
2112
  return base.join(" ");
2049
2113
  };
2050
- const useStyleSheet = (manager) => {
2051
- var _a, _b;
2052
- const addLayerStyle = react.useCallback(
2053
- (layerKey, styles, layer) => {
2054
- var _a2, _b2;
2055
- if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addStyle" in (manager == null ? void 0 : manager.$styleSheet)) {
2056
- (_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addStyle) == null ? void 0 : _b2.call(_a2, layerKey, styles, layer);
2057
- }
2058
- },
2059
- [manager]
2060
- );
2061
- const addCssChunk = react.useCallback(
2062
- (id) => {
2063
- var _a2, _b2;
2064
- if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addCssChunk" in (manager == null ? void 0 : manager.$styleSheet)) {
2065
- return (_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addCssChunk) == null ? void 0 : _b2.call(_a2, id);
2066
- }
2067
- return utils.noop;
2068
- },
2069
- [manager]
2070
- );
2071
- return {
2072
- addLayerStyle,
2073
- addCssChunk,
2074
- mount: ((_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.mount) ?? utils.noop,
2075
- unmount: ((_b = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _b.unmount) ?? utils.noop
2076
- };
2077
- };
2078
2114
  const useGlobalManager = (globalManager) => {
2079
2115
  var _a;
2080
2116
  const currentGlobalManager = react.useContext(GlobalManagerContext);
@@ -2257,20 +2293,15 @@ const useTextHighlight = (layerKey, options) => {
2257
2293
  const useTextAttributes = (layerKey, options) => {
2258
2294
  const collectStyle = (options == null ? void 0 : options.collectStyle) ?? true;
2259
2295
  const { manager: fragmentManager } = react.useContext(FragmentContext);
2260
- const styles = useLayerStyles(layerKey);
2296
+ useLayerStyles(layerKey, { collectStyle });
2261
2297
  const highlight = useTextHighlight(layerKey);
2262
2298
  const content = useTextContent(layerKey);
2263
2299
  const classnames = useClassnames(layerKey, fragmentManager);
2264
2300
  const hash = useHash(layerKey, fragmentManager);
2265
- const { addLayerStyle } = useStyleSheet(fragmentManager);
2266
2301
  const events = useLayerInteractions(layerKey, options);
2267
- if (collectStyle) {
2268
- addLayerStyle(layerKey, styles, fragmentManager.resolve(layerKey));
2269
- }
2270
2302
  return {
2271
2303
  hash,
2272
2304
  events,
2273
- styles,
2274
2305
  classnames,
2275
2306
  content,
2276
2307
  highlight
@@ -2297,32 +2328,22 @@ const Text = ({
2297
2328
  }
2298
2329
  }
2299
2330
  ),
2300
- /* @__PURE__ */ jsxRuntime.jsx(
2301
- "div",
2302
- {
2303
- dangerouslySetInnerHTML: { __html: content }
2304
- }
2305
- )
2331
+ /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: content } })
2306
2332
  ] });
2307
2333
  };
2308
2334
  const useFrame = (layerKey, options) => {
2309
2335
  const collectStyle = (options == null ? void 0 : options.collectStyle) ?? true;
2310
2336
  const { manager: fragmentManager } = react.useContext(FragmentContext);
2311
2337
  const layer = fragmentManager.entityOfKey(layerKey);
2312
- const styles = useLayerStyles(layerKey);
2338
+ useLayerStyles(layerKey, { collectStyle });
2313
2339
  const children = useLayerChildren(layerKey);
2314
2340
  const classnames = useClassnames(layerKey, fragmentManager);
2315
- const { addLayerStyle } = useStyleSheet(fragmentManager);
2316
2341
  const events = useLayerInteractions(layerKey, options);
2317
2342
  const link = useLayerLink(layerKey);
2318
- if (collectStyle) {
2319
- addLayerStyle(layerKey, styles, fragmentManager.resolve(layerKey));
2320
- }
2321
2343
  return {
2322
2344
  Tag: (link == null ? void 0 : link.isLink) ? (options == null ? void 0 : options.FrameTag) ?? "a" : (options == null ? void 0 : options.FrameTag) ?? "div",
2323
2345
  type: layer == null ? void 0 : layer._type,
2324
2346
  classnames,
2325
- styles,
2326
2347
  children,
2327
2348
  events,
2328
2349
  linkProps: link.linkProps
@@ -2659,12 +2680,15 @@ const CollectionItem = ({
2659
2680
  FrameElement,
2660
2681
  children,
2661
2682
  sourceDefinition,
2683
+ index,
2662
2684
  ...restProps
2663
2685
  }) => {
2664
- var _a;
2686
+ var _a, _b;
2665
2687
  core.keyOfEntity(layer);
2666
2688
  const definitionId = ((_a = core.entityOfKey(sourceDefinition)) == null ? void 0 : _a._id) ?? "";
2667
2689
  const value = layer.value ?? layer;
2690
+ const itemId = ((_b = core.entityOfKey(layer)) == null ? void 0 : _b._id) ?? index;
2691
+ const collectionInstanceId = `ci:${itemId}`;
2668
2692
  const inputProps = {
2669
2693
  [definitionId]: value
2670
2694
  };
@@ -2690,17 +2714,31 @@ const CollectionItem = ({
2690
2714
  value: expandedProps,
2691
2715
  manager
2692
2716
  },
2693
- children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
2694
- "div",
2717
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2718
+ InstanceContext.Provider,
2695
2719
  {
2696
- style: {
2697
- display: "contents",
2698
- ...cssVars
2720
+ value: {
2721
+ layerKey: null,
2722
+ parentManager: null,
2723
+ innerManager: null,
2724
+ props: {},
2725
+ definitions: [],
2726
+ onChangeProps: null,
2727
+ instanceId: collectionInstanceId
2699
2728
  },
2700
- children: /* @__PURE__ */ jsxRuntime.jsx(FrameElement, { ...restProps, layerKey: child })
2701
- },
2702
- child
2703
- ))
2729
+ children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
2730
+ "div",
2731
+ {
2732
+ style: {
2733
+ display: "contents",
2734
+ ...cssVars
2735
+ },
2736
+ children: /* @__PURE__ */ jsxRuntime.jsx(FrameElement, { ...restProps, layerKey: child })
2737
+ },
2738
+ child
2739
+ ))
2740
+ }
2741
+ )
2704
2742
  }
2705
2743
  );
2706
2744
  };
@@ -2742,6 +2780,7 @@ const Collection = ({
2742
2780
  children: (_a = sourceValue == null ? void 0 : sourceValue.map) == null ? void 0 : _a.call(sourceValue, (itemValue, index) => /* @__PURE__ */ jsxRuntime.jsx(
2743
2781
  CollectionItem,
2744
2782
  {
2783
+ index,
2745
2784
  layer: itemValue,
2746
2785
  manager: fragmentManager,
2747
2786
  source,
@@ -2773,11 +2812,13 @@ const Frame = ({
2773
2812
  pauseInteractions,
2774
2813
  ...restProps
2775
2814
  }) => {
2776
- const { styles, classnames, children, type, events, linkProps, Tag } = useFrame(layerKey, {
2777
- ...restProps,
2778
- pauseInteractions
2779
- });
2780
- const resultStyles = inputStyles ?? styles;
2815
+ const { classnames, children, type, events, linkProps, Tag } = useFrame(
2816
+ layerKey,
2817
+ {
2818
+ ...restProps,
2819
+ pauseInteractions
2820
+ }
2821
+ );
2781
2822
  const isMounted = useMounted();
2782
2823
  if (isMounted && hidden) {
2783
2824
  return /* @__PURE__ */ jsxRuntime.jsx("div", {});
@@ -2800,10 +2841,7 @@ const Frame = ({
2800
2841
  {
2801
2842
  className: classnames,
2802
2843
  "data-key": layerKey,
2803
- style: {
2804
- ...resultStyles,
2805
- display: hidden ? "none" : resultStyles.display
2806
- },
2844
+ style: inputStyles ? { ...inputStyles, display: hidden ? "none" : inputStyles.display } : hidden ? { display: "none" } : restProps == null ? void 0 : restProps.style,
2807
2845
  ...events,
2808
2846
  ...linkProps,
2809
2847
  ...restProps,
@@ -2811,6 +2849,34 @@ const Frame = ({
2811
2849
  }
2812
2850
  );
2813
2851
  };
2852
+ const useStyleSheet = (manager) => {
2853
+ var _a, _b;
2854
+ const addLayerStyle = react.useCallback(
2855
+ (layerKey, styles, layer) => {
2856
+ var _a2, _b2;
2857
+ if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addStyle" in (manager == null ? void 0 : manager.$styleSheet)) {
2858
+ (_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addStyle) == null ? void 0 : _b2.call(_a2, layerKey, styles, layer);
2859
+ }
2860
+ },
2861
+ [manager]
2862
+ );
2863
+ const addCssChunk = react.useCallback(
2864
+ (id) => {
2865
+ var _a2, _b2;
2866
+ if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addCssChunk" in (manager == null ? void 0 : manager.$styleSheet)) {
2867
+ return (_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addCssChunk) == null ? void 0 : _b2.call(_a2, id);
2868
+ }
2869
+ return utils.noop;
2870
+ },
2871
+ [manager]
2872
+ );
2873
+ return {
2874
+ addLayerStyle,
2875
+ addCssChunk,
2876
+ mount: ((_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.mount) ?? utils.noop,
2877
+ unmount: ((_b = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _b.unmount) ?? utils.noop
2878
+ };
2879
+ };
2814
2880
  const useCssChunk = (linkKey) => {
2815
2881
  const { manager } = react.useContext(FragmentContext);
2816
2882
  const [chunkId] = useLayerValue(linkKey, "chunkId", { manager });
@@ -3277,6 +3343,10 @@ const InstanceInitial = ({
3277
3343
  var _a;
3278
3344
  const ssr = ((_a = instanceProps == null ? void 0 : instanceProps.options) == null ? void 0 : _a.ssr) ?? true;
3279
3345
  const link = useLayerLink(instanceProps.layerKey);
3346
+ const parentInstanceId = react.useContext(InstanceContext).instanceId;
3347
+ const isTopInstance = !(instanceProps == null ? void 0 : instanceProps.layerKey);
3348
+ const instanceIdRef = react.useRef(isTopInstance ? crypto.randomUUID() : null);
3349
+ const instanceId = parentInstanceId ? `${parentInstanceId}:${instanceProps.layerKey}` : instanceIdRef.current ?? instanceProps.layerKey;
3280
3350
  const Tag = (link == null ? void 0 : link.isLink) ? inputTag ?? "a" : inputTag ?? "div";
3281
3351
  const {
3282
3352
  fragmentId,
@@ -3315,7 +3385,8 @@ const InstanceInitial = ({
3315
3385
  innerManager,
3316
3386
  parentManager,
3317
3387
  props: expandedProps,
3318
- onChangeProps
3388
+ onChangeProps,
3389
+ instanceId
3319
3390
  }),
3320
3391
  [
3321
3392
  instanceProps.layerKey,
@@ -3323,7 +3394,8 @@ const InstanceInitial = ({
3323
3394
  innerManager,
3324
3395
  parentManager,
3325
3396
  expandedProps,
3326
- onChangeProps
3397
+ onChangeProps,
3398
+ instanceId
3327
3399
  ]
3328
3400
  );
3329
3401
  return /* @__PURE__ */ jsxRuntime.jsx(InstanceContext.Provider, { value: instanceContextValue, children: parentManager ? /* @__PURE__ */ jsxRuntime.jsx(
package/dist/index.es.js CHANGED
@@ -21,7 +21,8 @@ const InstanceContext = createContext({
21
21
  innerManager: null,
22
22
  props: {},
23
23
  definitions: [],
24
- onChangeProps: null
24
+ onChangeProps: null,
25
+ instanceId: null
25
26
  });
26
27
  const RenderTargetContext = createContext(
27
28
  definition.renderTarget.document
@@ -928,21 +929,22 @@ const useReadVariables = (variableKeys, customManager) => {
928
929
  return filterKeys.map((variableKey, index) => {
929
930
  var _a2, _b2;
930
931
  variableLayers[index];
931
- const layer = ((_a2 = getNormalizeLayer(variableKey, resultManager)) == null ? void 0 : _a2.layer) ?? null;
932
- const { _id: propertyId } = layer ?? {};
933
- let collectionItemProp = void 0;
934
- if (lastCollectionItem && propertyId) {
935
- collectionItemProp = isPrimitive(lastCollectionItem == null ? void 0 : lastCollectionItem.value) && ((_b2 = entityOfKey(lastCollectionItem == null ? void 0 : lastCollectionItem.sourceDefinition)) == null ? void 0 : _b2._id) === propertyId ? lastCollectionItem == null ? void 0 : lastCollectionItem.value : extractVariableValue(lastCollectionItem == null ? void 0 : lastCollectionItem.value, propertyId);
936
- }
937
- const instanceProp = (instanceProps == null ? void 0 : instanceProps[propertyId]) ?? null;
938
932
  const campaignLayer = campaignManager == null ? void 0 : campaignManager.resolve(variableKey);
939
933
  const campaignProp = (campaignLayer == null ? void 0 : campaignLayer.defaultValue) ?? null;
940
934
  const areaLayer = areaManager == null ? void 0 : areaManager.resolve(variableKey);
941
935
  const areaProp = (areaLayer == null ? void 0 : areaLayer.defaultValue) ?? null;
942
936
  const globalLayer = globalManager == null ? void 0 : globalManager.resolve(variableKey);
943
937
  const globalProp = (globalLayer == null ? void 0 : globalLayer.defaultValue) ?? null;
944
- const required = (layer == null ? void 0 : layer.required) ?? false;
945
- const defaultValue = (layer == null ? void 0 : layer.defaultValue) ?? null;
938
+ const fragmentLayer = ((_a2 = getNormalizeLayer(variableKey, resultManager)) == null ? void 0 : _a2.layer) ?? null;
939
+ const layer = fragmentLayer ?? campaignLayer ?? areaLayer ?? globalLayer ?? null;
940
+ const { _id: propertyId } = layer ?? {};
941
+ let collectionItemProp = void 0;
942
+ if (lastCollectionItem && propertyId) {
943
+ collectionItemProp = isPrimitive(lastCollectionItem == null ? void 0 : lastCollectionItem.value) && ((_b2 = entityOfKey(lastCollectionItem == null ? void 0 : lastCollectionItem.sourceDefinition)) == null ? void 0 : _b2._id) === propertyId ? lastCollectionItem == null ? void 0 : lastCollectionItem.value : extractVariableValue(lastCollectionItem == null ? void 0 : lastCollectionItem.value, propertyId);
944
+ }
945
+ const instanceProp = (instanceProps == null ? void 0 : instanceProps[propertyId]) ?? null;
946
+ const required = (fragmentLayer == null ? void 0 : fragmentLayer.required) ?? (layer == null ? void 0 : layer.required) ?? false;
947
+ const defaultValue = (fragmentLayer == null ? void 0 : fragmentLayer.defaultValue) ?? (layer == null ? void 0 : layer.defaultValue) ?? null;
946
948
  const currentValue = collectionItemProp ?? (variableKey === instanceProp ? null : instanceProp) ?? campaignProp ?? areaProp ?? globalProp ?? null;
947
949
  const resultValue = required ? currentValue : currentValue ?? defaultValue;
948
950
  if (isVariableLink$1(resultValue)) {
@@ -966,7 +968,8 @@ const useReadVariables = (variableKeys, customManager) => {
966
968
  const EMPTY_RESOLVED = {
967
969
  values: {},
968
970
  cssVariableValues: {},
969
- rawValues: {}
971
+ rawValues: {},
972
+ isVariable: {}
970
973
  };
971
974
  const collectVariableKeys = (layer) => {
972
975
  const keys = [];
@@ -1001,9 +1004,11 @@ const useResolvedLayerVariables = (layer, rawLayer, _customScopes) => {
1001
1004
  const values = {};
1002
1005
  const cssVariableValues = {};
1003
1006
  const rawValues = {};
1007
+ const isVariable = {};
1004
1008
  const resolveField = (fieldPath, value, raw) => {
1005
1009
  var _a2;
1006
1010
  rawValues[fieldPath] = raw;
1011
+ isVariable[fieldPath] = isVariableLink$1(value);
1007
1012
  if (isVariableLink$1(value)) {
1008
1013
  const resolvedValue = value in resolvedByKey ? resolvedByKey[value] : value;
1009
1014
  values[fieldPath] = resolvedValue;
@@ -1029,7 +1034,7 @@ const useResolvedLayerVariables = (layer, rawLayer, _customScopes) => {
1029
1034
  }
1030
1035
  }
1031
1036
  }
1032
- return { values, cssVariableValues, rawValues };
1037
+ return { values, cssVariableValues, rawValues, isVariable };
1033
1038
  };
1034
1039
  const useRenderTarget = () => {
1035
1040
  const renderTarget = useContext(RenderTargetContext);
@@ -1269,10 +1274,10 @@ const useLayerLinearGradient = (linearGradientLink) => {
1269
1274
  const stopsPosition = useLayersValue(stops, "position");
1270
1275
  const stopValues = useMemo(
1271
1276
  () => (stops == null ? void 0 : stops.flatMap((stop, index) => {
1272
- var _a, _b, _c;
1277
+ var _a, _b;
1273
1278
  return [
1274
- (_b = (_a = stopsValue == null ? void 0 : stopsValue.at(index)) == null ? void 0 : _a.at(2)) == null ? void 0 : _b.cssVariableValue,
1275
- (_c = stopsPosition == null ? void 0 : stopsPosition.at(index)) == null ? void 0 : _c.at(0)
1279
+ (_a = stopsValue == null ? void 0 : stopsValue.at(index)) == null ? void 0 : _a.at(0),
1280
+ (_b = stopsPosition == null ? void 0 : stopsPosition.at(index)) == null ? void 0 : _b.at(0)
1276
1281
  ];
1277
1282
  })) ?? [],
1278
1283
  [stops, stopsValue, stopsPosition]
@@ -1284,6 +1289,38 @@ const useLayerLinearGradient = (linearGradientLink) => {
1284
1289
  [angle, stopValues]
1285
1290
  );
1286
1291
  };
1292
+ const useStyleRegistrar = (layerKey) => {
1293
+ const { manager } = useContext(FragmentContext);
1294
+ const { instanceId } = useContext(InstanceContext);
1295
+ const baseline = {};
1296
+ const instance = {};
1297
+ const hasInstance = !!instanceId;
1298
+ return {
1299
+ add(prop, value, isDynamic) {
1300
+ (isDynamic && hasInstance ? instance : baseline)[prop] = value;
1301
+ },
1302
+ addAll(styles, isDynamic) {
1303
+ if (styles) {
1304
+ Object.assign(isDynamic && hasInstance ? instance : baseline, styles);
1305
+ }
1306
+ },
1307
+ flush() {
1308
+ var _a, _b, _c, _d;
1309
+ (_b = (_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.addBaselineStyle) == null ? void 0 : _b.call(_a, layerKey, baseline);
1310
+ if (instanceId && Object.keys(instance).length > 0) {
1311
+ (_d = (_c = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _c.addInstanceStyle) == null ? void 0 : _d.call(
1312
+ _c,
1313
+ layerKey,
1314
+ instanceId,
1315
+ instance
1316
+ );
1317
+ }
1318
+ },
1319
+ getStyles() {
1320
+ return { ...baseline, ...instance };
1321
+ }
1322
+ };
1323
+ };
1287
1324
  const processOptionalSize = (value, type) => {
1288
1325
  if (value === -1) return "";
1289
1326
  if (type === definition.sizing.Fixed) return toPx(value);
@@ -1515,7 +1552,7 @@ const useLayerPosition = (layerKey) => {
1515
1552
  const calcImagePaint = (imageVars) => {
1516
1553
  var _a, _b;
1517
1554
  return {
1518
- background: imageVars.cssVariableValues.src,
1555
+ background: transformCssValue(imageVars.values.src),
1519
1556
  backgroundRepeat: "no-repeat",
1520
1557
  backgroundSize: (_b = (_a = imageVars.values.scale) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a)
1521
1558
  };
@@ -1533,16 +1570,16 @@ const useImagePaint = (imageLinkKey) => {
1533
1570
  };
1534
1571
  const calcLayerBackground = (paintVars, imageVars, imageSizeVars, linearGradient) => {
1535
1572
  const fillType = paintVars.values.type;
1536
- const cssSolidFill = paintVars.cssVariableValues.solid;
1537
- const cssImageSize = imageSizeVars.cssVariableValues.imageSize;
1573
+ const solidFill = paintVars.values.solid;
1574
+ const imageSize = imageSizeVars.values.imageSize;
1538
1575
  if (fillType === definition.paintMode.Solid) {
1539
- return { background: cssSolidFill };
1576
+ return { background: solidFill };
1540
1577
  }
1541
1578
  if (fillType === definition.paintMode.Image) {
1542
1579
  const image = calcImagePaint(imageVars);
1543
1580
  return {
1544
1581
  ...image,
1545
- backgroundSize: cssImageSize ?? image.backgroundSize
1582
+ backgroundSize: imageSize ?? image.backgroundSize
1546
1583
  };
1547
1584
  }
1548
1585
  if (fillType === definition.paintMode.LinearGradient) {
@@ -1660,7 +1697,7 @@ const calcLayerBorder = (borderVars, borderPaintVars, borderLinearGradient, pain
1660
1697
  };
1661
1698
  }
1662
1699
  if (borderPaint.type === definition.paintMode.Solid) {
1663
- return calcBorderSides(type, width, borderPaint.solidCssValue);
1700
+ return calcBorderSides(type, width, borderPaint.solid);
1664
1701
  }
1665
1702
  return { border: null };
1666
1703
  };
@@ -1805,7 +1842,9 @@ const useLayerFlex = (layerKey) => {
1805
1842
  };
1806
1843
  };
1807
1844
  const SKIP_OVERRIDE = { skipOverrideCheck: true };
1808
- const useLayerStyles = (layerKey) => {
1845
+ const useLayerStyles = (layerKey, options) => {
1846
+ const collectStyle = (options == null ? void 0 : options.collectStyle) ?? true;
1847
+ const reg = useStyleRegistrar(layerKey);
1809
1848
  try {
1810
1849
  if (!layerKey) throw new Error("Empty layer key");
1811
1850
  const { manager: fragmentManager } = useContext(FragmentContext);
@@ -1904,24 +1943,47 @@ const useLayerStyles = (layerKey) => {
1904
1943
  const layout = calcLayerLayout(vars);
1905
1944
  const textStyles = calcLayerTextStyles(vars);
1906
1945
  const layerFlex = calcLayerFlex(vars, parentVars);
1907
- return {
1908
- ...background,
1909
- ...border,
1910
- ...position,
1911
- opacity: vars.values.opacity,
1912
- overflow: vars.values.overflow,
1913
- rotate: isValue(vars.values.rotate) ? `${vars.values.rotate}deg` : null,
1914
- "border-radius": isValue(vars.rawValues.borderRadius) ? vars.values.borderRadius : null,
1915
- "white-space": vars.values.whiteSpace,
1916
- "z-index": vars.values.zIndex !== -1 ? vars.values.zIndex : null,
1917
- ...layout,
1918
- ...layerSize,
1919
- ...textStyles,
1920
- ...layerFlex,
1921
- display
1922
- };
1946
+ reg.add("opacity", vars.values.opacity, vars.isVariable.opacity);
1947
+ reg.add("overflow", vars.values.overflow, vars.isVariable.overflow);
1948
+ reg.add(
1949
+ "border-radius",
1950
+ isValue(vars.rawValues.borderRadius) ? vars.values.borderRadius : null,
1951
+ vars.isVariable.borderRadius
1952
+ );
1953
+ reg.add("white-space", vars.values.whiteSpace, vars.isVariable.whiteSpace);
1954
+ reg.add(
1955
+ "rotate",
1956
+ isValue(vars.values.rotate) ? `${vars.values.rotate}deg` : null,
1957
+ vars.isVariable.rotate
1958
+ );
1959
+ reg.add(
1960
+ "z-index",
1961
+ vars.values.zIndex !== -1 ? vars.values.zIndex : null,
1962
+ vars.isVariable.zIndex
1963
+ );
1964
+ const bgDynamic = paintVars.isVariable.solid || paintVars.isVariable.type || imageVars.isVariable.src;
1965
+ reg.addAll(background, bgDynamic);
1966
+ const borderDynamic = borderPaintVars.isVariable.solid || borderVars.isVariable.type;
1967
+ reg.addAll(border, borderDynamic);
1968
+ const posDynamic = vars.isVariable.width || vars.isVariable.height || vars.isVariable.position || vars.isVariable.widthType || vars.isVariable.heightType;
1969
+ reg.addAll(position, posDynamic);
1970
+ const layoutDynamic = vars.isVariable.layerMode || vars.isVariable.layerDirection || vars.isVariable.layerDistribute || vars.isVariable.layerAlign || vars.isVariable.padding || vars.isVariable.layerGap;
1971
+ reg.addAll(layout, layoutDynamic);
1972
+ const flexDynamic = vars.isVariable.widthType || vars.isVariable.heightType || parentVars.isVariable.layerDirection;
1973
+ reg.addAll(layerFlex, flexDynamic);
1974
+ const sizeDynamic = vars.isVariable.minWidth || vars.isVariable.maxWidth || vars.isVariable.minHeight || vars.isVariable.maxHeight;
1975
+ reg.addAll(layerSize, sizeDynamic);
1976
+ const textDynamic = vars.isVariable["attributes.color"];
1977
+ reg.addAll(textStyles, textDynamic);
1978
+ reg.add(
1979
+ "display",
1980
+ display,
1981
+ vars.isVariable.visible || vars.isVariable.layerMode
1982
+ );
1983
+ if (collectStyle) {
1984
+ reg.flush();
1985
+ }
1923
1986
  } catch (e) {
1924
- return {};
1925
1987
  }
1926
1988
  };
1927
1989
  const MAX_NESTING_DEPTH = 5;
@@ -2028,6 +2090,7 @@ const useHash = (layerKey, manager) => {
2028
2090
  };
2029
2091
  const useClassnames = (layerKey, manager) => {
2030
2092
  const hash = useHash(layerKey, manager);
2093
+ const { instanceId } = useContext(InstanceContext);
2031
2094
  const [classnames] = useLayerValue(layerKey, "classnames", { manager });
2032
2095
  const values = useLayersValue(classnames, "value");
2033
2096
  const enables = useLayersValue(classnames, "enabled");
@@ -2039,40 +2102,13 @@ const useClassnames = (layerKey, manager) => {
2039
2102
  [values, enables]
2040
2103
  );
2041
2104
  if (!layerKey || !manager) return null;
2042
- let base = [hash];
2105
+ const instanceHash = instanceId ? hashGenerator$1(instanceId) : null;
2106
+ let base = [hash, instanceHash].filter(Boolean);
2043
2107
  if (classnames == null ? void 0 : classnames.length) {
2044
2108
  base = [...base, ...list];
2045
2109
  }
2046
2110
  return base.join(" ");
2047
2111
  };
2048
- const useStyleSheet = (manager) => {
2049
- var _a, _b;
2050
- const addLayerStyle = useCallback(
2051
- (layerKey, styles, layer) => {
2052
- var _a2, _b2;
2053
- if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addStyle" in (manager == null ? void 0 : manager.$styleSheet)) {
2054
- (_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addStyle) == null ? void 0 : _b2.call(_a2, layerKey, styles, layer);
2055
- }
2056
- },
2057
- [manager]
2058
- );
2059
- const addCssChunk = useCallback(
2060
- (id) => {
2061
- var _a2, _b2;
2062
- if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addCssChunk" in (manager == null ? void 0 : manager.$styleSheet)) {
2063
- return (_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addCssChunk) == null ? void 0 : _b2.call(_a2, id);
2064
- }
2065
- return noop;
2066
- },
2067
- [manager]
2068
- );
2069
- return {
2070
- addLayerStyle,
2071
- addCssChunk,
2072
- mount: ((_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.mount) ?? noop,
2073
- unmount: ((_b = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _b.unmount) ?? noop
2074
- };
2075
- };
2076
2112
  const useGlobalManager = (globalManager) => {
2077
2113
  var _a;
2078
2114
  const currentGlobalManager = useContext(GlobalManagerContext);
@@ -2255,20 +2291,15 @@ const useTextHighlight = (layerKey, options) => {
2255
2291
  const useTextAttributes = (layerKey, options) => {
2256
2292
  const collectStyle = (options == null ? void 0 : options.collectStyle) ?? true;
2257
2293
  const { manager: fragmentManager } = useContext(FragmentContext);
2258
- const styles = useLayerStyles(layerKey);
2294
+ useLayerStyles(layerKey, { collectStyle });
2259
2295
  const highlight = useTextHighlight(layerKey);
2260
2296
  const content = useTextContent(layerKey);
2261
2297
  const classnames = useClassnames(layerKey, fragmentManager);
2262
2298
  const hash = useHash(layerKey, fragmentManager);
2263
- const { addLayerStyle } = useStyleSheet(fragmentManager);
2264
2299
  const events = useLayerInteractions(layerKey, options);
2265
- if (collectStyle) {
2266
- addLayerStyle(layerKey, styles, fragmentManager.resolve(layerKey));
2267
- }
2268
2300
  return {
2269
2301
  hash,
2270
2302
  events,
2271
- styles,
2272
2303
  classnames,
2273
2304
  content,
2274
2305
  highlight
@@ -2295,32 +2326,22 @@ const Text = ({
2295
2326
  }
2296
2327
  }
2297
2328
  ),
2298
- /* @__PURE__ */ jsx(
2299
- "div",
2300
- {
2301
- dangerouslySetInnerHTML: { __html: content }
2302
- }
2303
- )
2329
+ /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: content } })
2304
2330
  ] });
2305
2331
  };
2306
2332
  const useFrame = (layerKey, options) => {
2307
2333
  const collectStyle = (options == null ? void 0 : options.collectStyle) ?? true;
2308
2334
  const { manager: fragmentManager } = useContext(FragmentContext);
2309
2335
  const layer = fragmentManager.entityOfKey(layerKey);
2310
- const styles = useLayerStyles(layerKey);
2336
+ useLayerStyles(layerKey, { collectStyle });
2311
2337
  const children = useLayerChildren(layerKey);
2312
2338
  const classnames = useClassnames(layerKey, fragmentManager);
2313
- const { addLayerStyle } = useStyleSheet(fragmentManager);
2314
2339
  const events = useLayerInteractions(layerKey, options);
2315
2340
  const link = useLayerLink(layerKey);
2316
- if (collectStyle) {
2317
- addLayerStyle(layerKey, styles, fragmentManager.resolve(layerKey));
2318
- }
2319
2341
  return {
2320
2342
  Tag: (link == null ? void 0 : link.isLink) ? (options == null ? void 0 : options.FrameTag) ?? "a" : (options == null ? void 0 : options.FrameTag) ?? "div",
2321
2343
  type: layer == null ? void 0 : layer._type,
2322
2344
  classnames,
2323
- styles,
2324
2345
  children,
2325
2346
  events,
2326
2347
  linkProps: link.linkProps
@@ -2657,12 +2678,15 @@ const CollectionItem = ({
2657
2678
  FrameElement,
2658
2679
  children,
2659
2680
  sourceDefinition,
2681
+ index,
2660
2682
  ...restProps
2661
2683
  }) => {
2662
- var _a;
2684
+ var _a, _b;
2663
2685
  keyOfEntity(layer);
2664
2686
  const definitionId = ((_a = entityOfKey(sourceDefinition)) == null ? void 0 : _a._id) ?? "";
2665
2687
  const value = layer.value ?? layer;
2688
+ const itemId = ((_b = entityOfKey(layer)) == null ? void 0 : _b._id) ?? index;
2689
+ const collectionInstanceId = `ci:${itemId}`;
2666
2690
  const inputProps = {
2667
2691
  [definitionId]: value
2668
2692
  };
@@ -2688,17 +2712,31 @@ const CollectionItem = ({
2688
2712
  value: expandedProps,
2689
2713
  manager
2690
2714
  },
2691
- children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ jsx(
2692
- "div",
2715
+ children: /* @__PURE__ */ jsx(
2716
+ InstanceContext.Provider,
2693
2717
  {
2694
- style: {
2695
- display: "contents",
2696
- ...cssVars
2718
+ value: {
2719
+ layerKey: null,
2720
+ parentManager: null,
2721
+ innerManager: null,
2722
+ props: {},
2723
+ definitions: [],
2724
+ onChangeProps: null,
2725
+ instanceId: collectionInstanceId
2697
2726
  },
2698
- children: /* @__PURE__ */ jsx(FrameElement, { ...restProps, layerKey: child })
2699
- },
2700
- child
2701
- ))
2727
+ children: children == null ? void 0 : children.map((child) => /* @__PURE__ */ jsx(
2728
+ "div",
2729
+ {
2730
+ style: {
2731
+ display: "contents",
2732
+ ...cssVars
2733
+ },
2734
+ children: /* @__PURE__ */ jsx(FrameElement, { ...restProps, layerKey: child })
2735
+ },
2736
+ child
2737
+ ))
2738
+ }
2739
+ )
2702
2740
  }
2703
2741
  );
2704
2742
  };
@@ -2740,6 +2778,7 @@ const Collection = ({
2740
2778
  children: (_a = sourceValue == null ? void 0 : sourceValue.map) == null ? void 0 : _a.call(sourceValue, (itemValue, index) => /* @__PURE__ */ jsx(
2741
2779
  CollectionItem,
2742
2780
  {
2781
+ index,
2743
2782
  layer: itemValue,
2744
2783
  manager: fragmentManager,
2745
2784
  source,
@@ -2771,11 +2810,13 @@ const Frame = ({
2771
2810
  pauseInteractions,
2772
2811
  ...restProps
2773
2812
  }) => {
2774
- const { styles, classnames, children, type, events, linkProps, Tag } = useFrame(layerKey, {
2775
- ...restProps,
2776
- pauseInteractions
2777
- });
2778
- const resultStyles = inputStyles ?? styles;
2813
+ const { classnames, children, type, events, linkProps, Tag } = useFrame(
2814
+ layerKey,
2815
+ {
2816
+ ...restProps,
2817
+ pauseInteractions
2818
+ }
2819
+ );
2779
2820
  const isMounted = useMounted();
2780
2821
  if (isMounted && hidden) {
2781
2822
  return /* @__PURE__ */ jsx("div", {});
@@ -2798,10 +2839,7 @@ const Frame = ({
2798
2839
  {
2799
2840
  className: classnames,
2800
2841
  "data-key": layerKey,
2801
- style: {
2802
- ...resultStyles,
2803
- display: hidden ? "none" : resultStyles.display
2804
- },
2842
+ style: inputStyles ? { ...inputStyles, display: hidden ? "none" : inputStyles.display } : hidden ? { display: "none" } : restProps == null ? void 0 : restProps.style,
2805
2843
  ...events,
2806
2844
  ...linkProps,
2807
2845
  ...restProps,
@@ -2809,6 +2847,34 @@ const Frame = ({
2809
2847
  }
2810
2848
  );
2811
2849
  };
2850
+ const useStyleSheet = (manager) => {
2851
+ var _a, _b;
2852
+ const addLayerStyle = useCallback(
2853
+ (layerKey, styles, layer) => {
2854
+ var _a2, _b2;
2855
+ if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addStyle" in (manager == null ? void 0 : manager.$styleSheet)) {
2856
+ (_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addStyle) == null ? void 0 : _b2.call(_a2, layerKey, styles, layer);
2857
+ }
2858
+ },
2859
+ [manager]
2860
+ );
2861
+ const addCssChunk = useCallback(
2862
+ (id) => {
2863
+ var _a2, _b2;
2864
+ if (!!(manager == null ? void 0 : manager.$styleSheet) && manager && "addCssChunk" in (manager == null ? void 0 : manager.$styleSheet)) {
2865
+ return (_b2 = (_a2 = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a2.addCssChunk) == null ? void 0 : _b2.call(_a2, id);
2866
+ }
2867
+ return noop;
2868
+ },
2869
+ [manager]
2870
+ );
2871
+ return {
2872
+ addLayerStyle,
2873
+ addCssChunk,
2874
+ mount: ((_a = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _a.mount) ?? noop,
2875
+ unmount: ((_b = manager == null ? void 0 : manager.$styleSheet) == null ? void 0 : _b.unmount) ?? noop
2876
+ };
2877
+ };
2812
2878
  const useCssChunk = (linkKey) => {
2813
2879
  const { manager } = useContext(FragmentContext);
2814
2880
  const [chunkId] = useLayerValue(linkKey, "chunkId", { manager });
@@ -3275,6 +3341,10 @@ const InstanceInitial = ({
3275
3341
  var _a;
3276
3342
  const ssr = ((_a = instanceProps == null ? void 0 : instanceProps.options) == null ? void 0 : _a.ssr) ?? true;
3277
3343
  const link = useLayerLink(instanceProps.layerKey);
3344
+ const parentInstanceId = useContext(InstanceContext).instanceId;
3345
+ const isTopInstance = !(instanceProps == null ? void 0 : instanceProps.layerKey);
3346
+ const instanceIdRef = useRef(isTopInstance ? crypto.randomUUID() : null);
3347
+ const instanceId = parentInstanceId ? `${parentInstanceId}:${instanceProps.layerKey}` : instanceIdRef.current ?? instanceProps.layerKey;
3278
3348
  const Tag = (link == null ? void 0 : link.isLink) ? inputTag ?? "a" : inputTag ?? "div";
3279
3349
  const {
3280
3350
  fragmentId,
@@ -3313,7 +3383,8 @@ const InstanceInitial = ({
3313
3383
  innerManager,
3314
3384
  parentManager,
3315
3385
  props: expandedProps,
3316
- onChangeProps
3386
+ onChangeProps,
3387
+ instanceId
3317
3388
  }),
3318
3389
  [
3319
3390
  instanceProps.layerKey,
@@ -3321,7 +3392,8 @@ const InstanceInitial = ({
3321
3392
  innerManager,
3322
3393
  parentManager,
3323
3394
  expandedProps,
3324
- onChangeProps
3395
+ onChangeProps,
3396
+ instanceId
3325
3397
  ]
3326
3398
  );
3327
3399
  return /* @__PURE__ */ jsx(InstanceContext.Provider, { value: instanceContextValue, children: parentManager ? /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../../../src/nodes/Collection/Collection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAE,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAS,UAAU,EAAE,MAAM,eAAe,CAAC;AAKlD,UAAU,eAAgB,SAAQ,UAAU;CAAG;AAE/C,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAiD1C,CAAC"}
1
+ {"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../../../src/nodes/Collection/Collection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAE,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAS,UAAU,EAAE,MAAM,eAAe,CAAC;AAKlD,UAAU,eAAgB,SAAQ,UAAU;CAAG;AAE/C,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAkD1C,CAAC"}
@@ -4,7 +4,6 @@ export declare const useCollection: (layerKey: LinkKey, options?: UseFrameOption
4
4
  Tag: string | import('react').ComponentClass<any, any> | import('react').FunctionComponent<any>;
5
5
  type: any;
6
6
  classnames: string | null;
7
- styles: any;
8
7
  children: any;
9
8
  events: {
10
9
  onClick?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useCollection.d.ts","sourceRoot":"","sources":["../../../../src/nodes/Collection/hooks/useCollection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAY,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAKzE,eAAO,MAAM,aAAa,aAAc,OAAO,YAAY,eAAe;;;;;;;;;;;;;;;;;;;;;;CA8BzE,CAAC"}
1
+ {"version":3,"file":"useCollection.d.ts","sourceRoot":"","sources":["../../../../src/nodes/Collection/hooks/useCollection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAY,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAKzE,eAAO,MAAM,aAAa,aAAc,OAAO,YAAY,eAAe;;;;;;;;;;;;;;;;;;;;;CA8BzE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionItem.d.ts","sourceRoot":"","sources":["../../../src/nodes/CollectionItem/CollectionItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAW,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAS,UAAU,EAAE,MAAM,eAAe,CAAC;AAMlD,UAAU,eAAgB,SAAQ,UAAU;CAAG;AAE/C,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,eAAe,CAqD9C,CAAC"}
1
+ {"version":3,"file":"CollectionItem.d.ts","sourceRoot":"","sources":["../../../src/nodes/CollectionItem/CollectionItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAW,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAS,UAAU,EAAE,MAAM,eAAe,CAAC;AAOlD,UAAU,eAAgB,SAAQ,UAAU;CAAG;AAE/C,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,eAAe,CAoE9C,CAAC"}
@@ -4,7 +4,6 @@ export declare const useCollection: (layerKey: LinkKey, options?: UseFrameOption
4
4
  Tag: string | import('react').ComponentClass<any, any> | import('react').FunctionComponent<any>;
5
5
  type: any;
6
6
  classnames: string | null;
7
- styles: any;
8
7
  children: any;
9
8
  events: {
10
9
  onClick?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useCollection.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CollectionItem/hooks/useCollection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAY,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAKzE,eAAO,MAAM,aAAa,aAAc,OAAO,YAAY,eAAe;;;;;;;;;;;;;;;;;;;;;;CAyBzE,CAAC"}
1
+ {"version":3,"file":"useCollection.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CollectionItem/hooks/useCollection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAY,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAKzE,eAAO,MAAM,aAAa,aAAc,OAAO,YAAY,eAAe;;;;;;;;;;;;;;;;;;;;;CAyBzE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Frame.d.ts","sourceRoot":"","sources":["../../../src/nodes/Frame/Frame.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAM5C,OAAO,EAAY,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,WAAW,UAAW,SAAQ,eAAe;IACjD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAsDhC,CAAC"}
1
+ {"version":3,"file":"Frame.d.ts","sourceRoot":"","sources":["../../../src/nodes/Frame/Frame.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAM5C,OAAO,EAAY,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE7D,MAAM,WAAW,UAAW,SAAQ,eAAe;IACjD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CA0DhC,CAAC"}
@@ -9,7 +9,6 @@ export declare const useFrame: (layerKey: LinkKey, options?: UseFrameOptions) =>
9
9
  Tag: string | import('react').ComponentClass<any, any> | import('react').FunctionComponent<any>;
10
10
  type: any;
11
11
  classnames: string | null;
12
- styles: any;
13
12
  children: any;
14
13
  events: {
15
14
  onClick?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useFrame.d.ts","sourceRoot":"","sources":["../../../../src/nodes/Frame/hooks/useFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAc,MAAM,OAAO,CAAC;AAKhD,OAAO,EAEL,2BAA2B,EAC5B,MAAM,oCAAoC,CAAC;AAG5C,MAAM,WAAW,eAAgB,SAAQ,2BAA2B;IAClE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CACjC;AAED,eAAO,MAAM,QAAQ,aAAc,OAAO,YAAY,eAAe;;;;;;;;;;;;;;;;;;CAwBpE,CAAC"}
1
+ {"version":3,"file":"useFrame.d.ts","sourceRoot":"","sources":["../../../../src/nodes/Frame/hooks/useFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAc,MAAM,OAAO,CAAC;AAIhD,OAAO,EAEL,2BAA2B,EAC5B,MAAM,oCAAoC,CAAC;AAG5C,MAAM,WAAW,eAAgB,SAAQ,2BAA2B;IAClE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CACjC;AAED,eAAO,MAAM,QAAQ,aAAc,OAAO,YAAY,eAAe;;;;;;;;;;;;;;;;;CAkBpE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Instance.d.ts","sourceRoot":"","sources":["../../../src/nodes/Instance/Instance.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,WAAW,EAKZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAkB,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAc,OAAO,EAAe,MAAM,mBAAmB,CAAC;AAuErE,UAAU,eAAe;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACpE,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,OAAO,UAAU,CAAC,YAAY,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9D;AAkGD,eAAO,MAAM,QAAQ,yDAoBpB,CAAC"}
1
+ {"version":3,"file":"Instance.d.ts","sourceRoot":"","sources":["../../../src/nodes/Instance/Instance.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,WAAW,EAMZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAkB,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAc,OAAO,EAAe,MAAM,mBAAmB,CAAC;AAuErE,UAAU,eAAe;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACpE,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,OAAO,UAAU,CAAC,YAAY,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9D;AA0GD,eAAO,MAAM,QAAQ,yDAoBpB,CAAC"}
@@ -2,7 +2,7 @@ interface UseInstanceOptions extends UseLayerInteractionsOptions {
2
2
  }
3
3
  export declare const useInstance: (instanceProps: UseInstanceOptions) => {
4
4
  classnames: string | null;
5
- styles: any;
5
+ styles: void;
6
6
  events: {
7
7
  onClick?: undefined;
8
8
  } | {
@@ -1,5 +1,6 @@
1
1
  import { LinkKey } from '@graph-state/core';
2
2
  import { ComponentPropsWithoutRef, ElementType, FC } from 'react';
3
+ import { UseTextAttributes } from './hooks/useTextAttributes';
3
4
  interface TextProps extends ComponentPropsWithoutRef<"div">, UseTextAttributes {
4
5
  Tag?: string | ElementType;
5
6
  layerKey: LinkKey;
@@ -1 +1 @@
1
- {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/nodes/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIlE,UAAU,SAAU,SAAQ,wBAAwB,CAAC,KAAK,CAAC,EAAE,iBAAiB;IAC5E,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CA0B9B,CAAC"}
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/nodes/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEjF,UAAU,SAAU,SAAQ,wBAAwB,CAAC,KAAK,CAAC,EAAE,iBAAiB;IAC5E,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAuB9B,CAAC"}
@@ -9,7 +9,6 @@ export declare const useTextAttributes: (layerKey: LinkKey, options?: UseTextAtt
9
9
  } | {
10
10
  onClick: () => void;
11
11
  };
12
- styles: any;
13
12
  classnames: string | null;
14
13
  content: string;
15
14
  highlight: {
@@ -1 +1 @@
1
- {"version":3,"file":"useTextAttributes.d.ts","sourceRoot":"","sources":["../../../../src/nodes/Text/hooks/useTextAttributes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAU5C,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,aAClB,OAAO,YACP,iBAAiB;;;;;;;;;;;;;CAyB5B,CAAC"}
1
+ {"version":3,"file":"useTextAttributes.d.ts","sourceRoot":"","sources":["../../../../src/nodes/Text/hooks/useTextAttributes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAS5C,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,aAClB,OAAO,YACP,iBAAiB;;;;;;;;;;;;CAmB5B,CAAC"}
@@ -5,5 +5,6 @@ export declare const InstanceContext: import('react').Context<{
5
5
  props: {};
6
6
  definitions: never[];
7
7
  onChangeProps: ((variableId: string, value: unknown) => void) | null;
8
+ instanceId: string | null;
8
9
  }>;
9
10
  //# sourceMappingURL=InstanceContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InstanceContext.d.ts","sourceRoot":"","sources":["../../src/providers/InstanceContext.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;mBAMH,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI;EAC5E,CAAC"}
1
+ {"version":3,"file":"InstanceContext.d.ts","sourceRoot":"","sources":["../../src/providers/InstanceContext.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;mBAMH,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI;gBACxD,MAAM,GAAG,IAAI;EACjC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fragmentsx/render-react",
3
3
  "private": false,
4
- "version": "1.6.3",
4
+ "version": "1.7.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -27,7 +27,7 @@
27
27
  "@graph-state/core": "^0.13.2",
28
28
  "@graph-state/react": "^0.8.3",
29
29
  "react-use-measure": "^2.1.7",
30
- "@fragmentsx/client-core": "0.4.3",
30
+ "@fragmentsx/client-core": "0.5.0",
31
31
  "@fragmentsx/definition": "0.2.2",
32
32
  "@fragmentsx/utils": "0.2.0"
33
33
  },