@fragmentsx/render-react 1.1.2 → 1.1.3
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/index.cjs.js +107 -56
- package/dist/index.es.js +107 -56
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -392,6 +392,7 @@ const renderMode = createConstants("viewport", "parent", "fixed");
|
|
|
392
392
|
const interactions = createConstants("click", "mouseover", "appear");
|
|
393
393
|
const eventMode = createConstants("goal", "callback", "tracker");
|
|
394
394
|
const scopeTypes = createConstants(
|
|
395
|
+
"AreaScope",
|
|
395
396
|
"InstanceScope",
|
|
396
397
|
"FragmentScope",
|
|
397
398
|
"CollectionScope",
|
|
@@ -1282,7 +1283,8 @@ const SceneSchema = /* @__PURE__ */ object({
|
|
|
1282
1283
|
}),
|
|
1283
1284
|
visible: layerField(/* @__PURE__ */ boolean(), { fallback: true, variable: true }),
|
|
1284
1285
|
rotate: layerField(/* @__PURE__ */ number(), { fallback: null }),
|
|
1285
|
-
zIndex: layerField(/* @__PURE__ */ number(), { fallback:
|
|
1286
|
+
zIndex: layerField(/* @__PURE__ */ number(), { fallback: null }),
|
|
1287
|
+
classnames: layerField(/* @__PURE__ */ array(/* @__PURE__ */ number()), { fallback: [] })
|
|
1286
1288
|
});
|
|
1287
1289
|
const FillSchema = /* @__PURE__ */ object({
|
|
1288
1290
|
fillType: layerField(/* @__PURE__ */ picklist(Object.keys(paintMode)), {
|
|
@@ -2194,6 +2196,8 @@ function isFiniteNumber(value) {
|
|
|
2194
2196
|
}
|
|
2195
2197
|
var setKey$1 = (v2) => `$${v2}`;
|
|
2196
2198
|
function hashGenerator(layerKey) {
|
|
2199
|
+
if (!(layerKey == null ? void 0 : layerKey.length))
|
|
2200
|
+
return layerKey;
|
|
2197
2201
|
let hash = 0;
|
|
2198
2202
|
for (let i2 = 0; i2 < layerKey.length; i2++) {
|
|
2199
2203
|
hash = (hash << 5) - hash + layerKey.charCodeAt(i2);
|
|
@@ -2230,7 +2234,7 @@ const useGlobalManager = (globalManager) => {
|
|
|
2230
2234
|
setRenderTarget
|
|
2231
2235
|
};
|
|
2232
2236
|
};
|
|
2233
|
-
const useFragmentManager = (fragmentId, inputGlobalManager
|
|
2237
|
+
const useFragmentManager = (fragmentId, inputGlobalManager) => {
|
|
2234
2238
|
var _a;
|
|
2235
2239
|
const {
|
|
2236
2240
|
fragmentsGraph,
|
|
@@ -2321,7 +2325,7 @@ const cloneLayer = (manager, layer, externalProps = {}, _parent) => {
|
|
|
2321
2325
|
_type: layerGraph._type,
|
|
2322
2326
|
overrideFrom: setKey(layerKey),
|
|
2323
2327
|
parent: setKey(layerParent),
|
|
2324
|
-
...(layerGraph == null ? void 0 : layerGraph._type) === index.nodes.Instance ? pick(layerGraph, "fragment") : {},
|
|
2328
|
+
...(layerGraph == null ? void 0 : layerGraph._type) === index.nodes.Instance ? pick(layerGraph, "fragment", "props") : {},
|
|
2325
2329
|
...externalProps
|
|
2326
2330
|
},
|
|
2327
2331
|
true
|
|
@@ -3010,7 +3014,11 @@ const useCalcLayerBorder = (layerKey) => {
|
|
|
3010
3014
|
const useLayerBorder = (layerKey) => {
|
|
3011
3015
|
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3012
3016
|
const [borderWidth] = useLayerValue(layerKey, "borderWidth", fragmentManager);
|
|
3013
|
-
const [borderColor] = useLayerValue(
|
|
3017
|
+
const [, , { cssVariableValue: borderColor }] = useLayerValue(
|
|
3018
|
+
layerKey,
|
|
3019
|
+
"borderColor",
|
|
3020
|
+
fragmentManager
|
|
3021
|
+
);
|
|
3014
3022
|
const calcBorder = useCalcLayerBorder(layerKey);
|
|
3015
3023
|
return require$$0.useMemo(
|
|
3016
3024
|
() => calcBorder(borderWidth, borderColor),
|
|
@@ -3091,12 +3099,14 @@ const useLayerStyles = (layerKey) => {
|
|
|
3091
3099
|
);
|
|
3092
3100
|
const [whiteSpace2] = useLayerValue(layerKey, "whiteSpace", fragmentManager);
|
|
3093
3101
|
const textStyles = useLayerTextStyles(layerKey);
|
|
3102
|
+
const [overflow2] = useLayerValue(layerKey, "overflow", fragmentManager);
|
|
3094
3103
|
return {
|
|
3095
3104
|
// ...(props ?? {}),
|
|
3096
3105
|
...border,
|
|
3097
3106
|
...background,
|
|
3098
3107
|
...position,
|
|
3099
3108
|
opacity,
|
|
3109
|
+
overflow: overflow2,
|
|
3100
3110
|
rotate: isValue(rotate) ? `${rotate}deg` : null,
|
|
3101
3111
|
"border-radius": borderRadius,
|
|
3102
3112
|
"white-space": whiteSpace2,
|
|
@@ -3121,12 +3131,6 @@ const useFragmentProperties = (fragmentId) => {
|
|
|
3121
3131
|
manager
|
|
3122
3132
|
};
|
|
3123
3133
|
};
|
|
3124
|
-
const useHash = (layerKey, manager) => {
|
|
3125
|
-
if (!layerKey || !manager) return null;
|
|
3126
|
-
const layer = manager.resolve(layerKey);
|
|
3127
|
-
const overrideFrom = getKey(layer == null ? void 0 : layer.overrideFrom);
|
|
3128
|
-
return hashGenerator(overrideFrom ?? layerKey);
|
|
3129
|
-
};
|
|
3130
3134
|
const useInstanceProps = (instanceProps) => {
|
|
3131
3135
|
const isTopInstance = !(instanceProps == null ? void 0 : instanceProps.layerKey);
|
|
3132
3136
|
const { manager: loadedManager } = useFragmentManager(
|
|
@@ -3160,10 +3164,32 @@ const useInstanceProps = (instanceProps) => {
|
|
|
3160
3164
|
cssProps: getCssVariables(mergedProps)
|
|
3161
3165
|
};
|
|
3162
3166
|
};
|
|
3167
|
+
const useLayerScopes = (fragmentManager, layerKey) => {
|
|
3168
|
+
var _a, _b, _c, _d;
|
|
3169
|
+
if (!fragmentManager || !layerKey) return [];
|
|
3170
|
+
const layerParents = getAllParents(fragmentManager, layerKey);
|
|
3171
|
+
const resultScopes = [(_b = (_a = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a.scopes) == null ? void 0 : _b.get(void 0)];
|
|
3172
|
+
layerParents.forEach((parent) => {
|
|
3173
|
+
var _a2, _b2, _c2, _d2;
|
|
3174
|
+
const parentLink = core.keyOfEntity(parent);
|
|
3175
|
+
if ((_b2 = (_a2 = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a2.scopes) == null ? void 0 : _b2.has(parentLink)) {
|
|
3176
|
+
resultScopes.push((_d2 = (_c2 = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _c2.scopes) == null ? void 0 : _d2.get(parentLink));
|
|
3177
|
+
}
|
|
3178
|
+
});
|
|
3179
|
+
const areaScope = (_d = (_c = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _c.scopes) == null ? void 0 : _d.get("Area");
|
|
3180
|
+
if (areaScope) {
|
|
3181
|
+
resultScopes.push(areaScope);
|
|
3182
|
+
}
|
|
3183
|
+
return resultScopes;
|
|
3184
|
+
};
|
|
3163
3185
|
const useLayerInteractions = (layerKey, options2) => {
|
|
3164
3186
|
const pause = (options2 == null ? void 0 : options2.pauseInteractions) ?? false;
|
|
3165
3187
|
const { manager: globalManager } = useGlobalManager();
|
|
3166
3188
|
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3189
|
+
const scopes = useLayerScopes(fragmentManager, layerKey);
|
|
3190
|
+
const areaScope = scopes.find(
|
|
3191
|
+
(scope) => (scope == null ? void 0 : scope.type) === index.scopeTypes.AreaScope
|
|
3192
|
+
);
|
|
3167
3193
|
const [interactions2] = useLayerValue(
|
|
3168
3194
|
layerKey,
|
|
3169
3195
|
"interactions",
|
|
@@ -3173,10 +3199,14 @@ const useLayerInteractions = (layerKey, options2) => {
|
|
|
3173
3199
|
const fireEvent = require$$0.useCallback(
|
|
3174
3200
|
(eventLink) => {
|
|
3175
3201
|
var _a, _b, _c, _d;
|
|
3202
|
+
if (!areaScope) return null;
|
|
3176
3203
|
const event = fragmentManager.resolve(eventLink);
|
|
3177
3204
|
const { value: eventValue } = readVariable(eventLink);
|
|
3178
|
-
if ((event == null ? void 0 : event.mode) === index.eventMode.goal && (eventValue == null ? void 0 : eventValue.
|
|
3179
|
-
(_b = (_a = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _a.reachGoal) == null ? void 0 : _b.call(_a,
|
|
3205
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.goal && (eventValue == null ? void 0 : eventValue.goalId)) {
|
|
3206
|
+
(_b = (_a = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _a.reachGoal) == null ? void 0 : _b.call(_a, {
|
|
3207
|
+
goalId: eventValue == null ? void 0 : eventValue.goalId,
|
|
3208
|
+
...pick(areaScope, "variantId", "campaignId", "areaId")
|
|
3209
|
+
});
|
|
3180
3210
|
}
|
|
3181
3211
|
if ((event == null ? void 0 : event.mode) === index.eventMode.tracker && eventValue) {
|
|
3182
3212
|
(_d = (_c = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _c.trackAdPixel) == null ? void 0 : _d.call(_c, eventValue);
|
|
@@ -3185,13 +3215,13 @@ const useLayerInteractions = (layerKey, options2) => {
|
|
|
3185
3215
|
eventValue();
|
|
3186
3216
|
}
|
|
3187
3217
|
},
|
|
3188
|
-
[globalManager, fragmentManager]
|
|
3218
|
+
[globalManager, fragmentManager, areaScope]
|
|
3189
3219
|
);
|
|
3190
3220
|
require$$0.useEffect(() => {
|
|
3191
3221
|
if (!pause && Array.isArray(interactions2)) {
|
|
3192
3222
|
interactions2 == null ? void 0 : interactions2.filter((el) => (el == null ? void 0 : el.on) === index.interactions.appear).map((el) => el.event).forEach(fireEvent);
|
|
3193
3223
|
}
|
|
3194
|
-
}, [pause]);
|
|
3224
|
+
}, [pause, areaScope]);
|
|
3195
3225
|
return require$$0.useMemo(() => {
|
|
3196
3226
|
if (!pause && !interactions2 || !Array.isArray(interactions2)) return {};
|
|
3197
3227
|
if (pause) return {};
|
|
@@ -3203,6 +3233,22 @@ const useLayerInteractions = (layerKey, options2) => {
|
|
|
3203
3233
|
};
|
|
3204
3234
|
}, [interactions2, fireEvent, pause]);
|
|
3205
3235
|
};
|
|
3236
|
+
const useHash = (layerKey, manager) => {
|
|
3237
|
+
if (!layerKey || !manager) return null;
|
|
3238
|
+
const layer = manager.resolve(layerKey);
|
|
3239
|
+
const overrideFrom = getKey(layer == null ? void 0 : layer.overrideFrom);
|
|
3240
|
+
return hashGenerator(overrideFrom ?? layerKey);
|
|
3241
|
+
};
|
|
3242
|
+
const useClassnames = (layerKey, manager) => {
|
|
3243
|
+
const hash = useHash(layerKey, manager);
|
|
3244
|
+
const [classnames] = useLayerValue(layerKey, "classnames", { manager });
|
|
3245
|
+
if (!layerKey || !manager) return null;
|
|
3246
|
+
let base = [hash];
|
|
3247
|
+
if (classnames == null ? void 0 : classnames.length) {
|
|
3248
|
+
base = [...base, ...classnames];
|
|
3249
|
+
}
|
|
3250
|
+
return base.join(" ");
|
|
3251
|
+
};
|
|
3206
3252
|
const useInstance = (instanceProps) => {
|
|
3207
3253
|
const { manager: parentManager } = require$$0.useContext(FragmentContext);
|
|
3208
3254
|
const [instanceLayer] = y(parentManager, instanceProps.layerKey);
|
|
@@ -3214,9 +3260,12 @@ const useInstance = (instanceProps) => {
|
|
|
3214
3260
|
const resultFragmentId = (instanceProps == null ? void 0 : instanceProps.fragmentId) ?? (instanceLayer == null ? void 0 : instanceLayer.fragment);
|
|
3215
3261
|
const { properties: definitions, manager: innerFragmentManager } = useFragmentProperties(resultFragmentId);
|
|
3216
3262
|
const { props, cssProps } = useInstanceProps(instanceProps);
|
|
3217
|
-
const
|
|
3263
|
+
const classnames = useClassnames(
|
|
3264
|
+
instanceProps.layerKey,
|
|
3265
|
+
innerFragmentManager
|
|
3266
|
+
);
|
|
3218
3267
|
return {
|
|
3219
|
-
|
|
3268
|
+
classnames,
|
|
3220
3269
|
styles: styles2,
|
|
3221
3270
|
events,
|
|
3222
3271
|
definitions,
|
|
@@ -3312,9 +3361,11 @@ const useFragment = (fragmentId, globalManager) => {
|
|
|
3312
3361
|
(_a = fragmentContext.manager) == null ? void 0 : _a.resolve(fragmentContext.fragmentLayerKey),
|
|
3313
3362
|
(_b = fragmentContext.manager) == null ? void 0 : _b.key
|
|
3314
3363
|
);
|
|
3315
|
-
mount();
|
|
3316
3364
|
}
|
|
3317
3365
|
require$$0.useEffect(() => {
|
|
3366
|
+
if (fragmentContext.manager) {
|
|
3367
|
+
mount();
|
|
3368
|
+
}
|
|
3318
3369
|
return () => {
|
|
3319
3370
|
unmount();
|
|
3320
3371
|
};
|
|
@@ -3359,7 +3410,7 @@ const useFrame = (layerKey, options2) => {
|
|
|
3359
3410
|
const layer = fragmentManager.entityOfKey(layerKey);
|
|
3360
3411
|
const styles2 = useLayerStyles(layerKey);
|
|
3361
3412
|
const children = useLayerChildren(layerKey);
|
|
3362
|
-
const
|
|
3413
|
+
const classnames = useClassnames(layerKey, fragmentManager);
|
|
3363
3414
|
const { addLayerStyle } = useStyleSheet(fragmentManager);
|
|
3364
3415
|
const events = useLayerInteractions(layerKey, options2);
|
|
3365
3416
|
const link = useLayerLink(layerKey);
|
|
@@ -3369,7 +3420,7 @@ const useFrame = (layerKey, options2) => {
|
|
|
3369
3420
|
return {
|
|
3370
3421
|
Tag: (link == null ? void 0 : link.isLink) ? (options2 == null ? void 0 : options2.FrameTag) ?? "a" : (options2 == null ? void 0 : options2.FrameTag) ?? "div",
|
|
3371
3422
|
type: layer == null ? void 0 : layer._type,
|
|
3372
|
-
|
|
3423
|
+
classnames,
|
|
3373
3424
|
styles: {},
|
|
3374
3425
|
//isBrowser ? pick(styles, "background") : {},
|
|
3375
3426
|
children,
|
|
@@ -3422,14 +3473,14 @@ const useTextAttributes = (layerKey, options2) => {
|
|
|
3422
3473
|
const { manager: fragmentManager } = require$$0.useContext(FragmentContext);
|
|
3423
3474
|
const styles2 = useLayerStyles(layerKey);
|
|
3424
3475
|
const content = useTextContent(layerKey);
|
|
3425
|
-
const
|
|
3476
|
+
const classnames = useClassnames(layerKey, fragmentManager);
|
|
3426
3477
|
const { addLayerStyle } = useStyleSheet(fragmentManager);
|
|
3427
3478
|
if (collectStyle) {
|
|
3428
3479
|
addLayerStyle(layerKey, styles2, fragmentManager.resolve(layerKey));
|
|
3429
3480
|
}
|
|
3430
3481
|
return {
|
|
3431
3482
|
styles: styles2,
|
|
3432
|
-
|
|
3483
|
+
classnames,
|
|
3433
3484
|
content
|
|
3434
3485
|
};
|
|
3435
3486
|
};
|
|
@@ -3515,19 +3566,6 @@ function useInjectedStyle() {
|
|
|
3515
3566
|
injectStyle
|
|
3516
3567
|
};
|
|
3517
3568
|
}
|
|
3518
|
-
const useLayerScopes = (fragmentManager, layerKey) => {
|
|
3519
|
-
var _a, _b;
|
|
3520
|
-
const layerParents = getAllParents(fragmentManager, layerKey);
|
|
3521
|
-
const resultScopes = [(_b = (_a = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a.scopes) == null ? void 0 : _b.get(void 0)];
|
|
3522
|
-
layerParents.forEach((parent) => {
|
|
3523
|
-
var _a2, _b2, _c, _d;
|
|
3524
|
-
const parentLink = core.keyOfEntity(parent);
|
|
3525
|
-
if ((_b2 = (_a2 = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a2.scopes) == null ? void 0 : _b2.has(parentLink)) {
|
|
3526
|
-
resultScopes.push((_d = (_c = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _c.scopes) == null ? void 0 : _d.get(parentLink));
|
|
3527
|
-
}
|
|
3528
|
-
});
|
|
3529
|
-
return resultScopes;
|
|
3530
|
-
};
|
|
3531
3569
|
function cssToJsStyle(cssKey) {
|
|
3532
3570
|
return cssKey.replace(/-([a-z])/g, (_2, letter) => letter.toUpperCase());
|
|
3533
3571
|
}
|
|
@@ -3555,6 +3593,10 @@ const useArea = (options2) => {
|
|
|
3555
3593
|
options2 == null ? void 0 : options2.globalManager
|
|
3556
3594
|
);
|
|
3557
3595
|
const [areaData, setAreaData] = require$$0.useState(queryArea(options2.areaCode));
|
|
3596
|
+
const { manager: fragmentManager } = useFragmentManager(
|
|
3597
|
+
areaData.fragmentId,
|
|
3598
|
+
resultGlobalManager
|
|
3599
|
+
);
|
|
3558
3600
|
const resultProps = require$$0.useMemo(
|
|
3559
3601
|
() => ({ ...(areaData == null ? void 0 : areaData.props) ?? {}, ...(options2 == null ? void 0 : options2.props) ?? [] }),
|
|
3560
3602
|
[areaData, options2]
|
|
@@ -3569,6 +3611,7 @@ const useArea = (options2) => {
|
|
|
3569
3611
|
}, []);
|
|
3570
3612
|
return {
|
|
3571
3613
|
...areaData,
|
|
3614
|
+
fragmentManager,
|
|
3572
3615
|
props: resultProps,
|
|
3573
3616
|
globalManager: resultGlobalManager
|
|
3574
3617
|
};
|
|
@@ -3603,8 +3646,8 @@ const Text = ({
|
|
|
3603
3646
|
collectStyle,
|
|
3604
3647
|
...restProps
|
|
3605
3648
|
}) => {
|
|
3606
|
-
const {
|
|
3607
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Tag, { className:
|
|
3649
|
+
const { classnames, content } = useTextAttributes(layerKey, { collectStyle });
|
|
3650
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Tag, { className: classnames, "data-key": layerKey, ...restProps, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3608
3651
|
"div",
|
|
3609
3652
|
{
|
|
3610
3653
|
className: styles.text,
|
|
@@ -3634,7 +3677,7 @@ const Collection = ({
|
|
|
3634
3677
|
fragmentManager,
|
|
3635
3678
|
styles: styles2,
|
|
3636
3679
|
sourceDefinition,
|
|
3637
|
-
|
|
3680
|
+
classnames,
|
|
3638
3681
|
source,
|
|
3639
3682
|
children,
|
|
3640
3683
|
sourceValue
|
|
@@ -3655,7 +3698,7 @@ const Collection = ({
|
|
|
3655
3698
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3656
3699
|
FrameTag,
|
|
3657
3700
|
{
|
|
3658
|
-
className:
|
|
3701
|
+
className: classnames,
|
|
3659
3702
|
"data-key": layerKey,
|
|
3660
3703
|
style: resultStyles,
|
|
3661
3704
|
...restProps,
|
|
@@ -3693,16 +3736,13 @@ const Frame = ({
|
|
|
3693
3736
|
layerKey,
|
|
3694
3737
|
styles: inputStyles,
|
|
3695
3738
|
hidden,
|
|
3696
|
-
|
|
3739
|
+
pauseInteractions,
|
|
3697
3740
|
...restProps
|
|
3698
3741
|
}) => {
|
|
3699
|
-
const { styles: styles2,
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
pauseInteractions: !interactive
|
|
3704
|
-
}
|
|
3705
|
-
);
|
|
3742
|
+
const { styles: styles2, classnames, children, type, events, linkProps, Tag } = useFrame(layerKey, {
|
|
3743
|
+
...restProps,
|
|
3744
|
+
pauseInteractions
|
|
3745
|
+
});
|
|
3706
3746
|
const resultStyles = inputStyles ?? styles2;
|
|
3707
3747
|
const isMounted = useMounted();
|
|
3708
3748
|
if (isMounted && hidden) {
|
|
@@ -3724,7 +3764,7 @@ const Frame = ({
|
|
|
3724
3764
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3725
3765
|
Tag,
|
|
3726
3766
|
{
|
|
3727
|
-
className:
|
|
3767
|
+
className: classnames,
|
|
3728
3768
|
"data-key": layerKey,
|
|
3729
3769
|
style: {
|
|
3730
3770
|
...resultStyles,
|
|
@@ -3740,7 +3780,7 @@ const Frame = ({
|
|
|
3740
3780
|
const FragmentInternal = ({
|
|
3741
3781
|
fragmentId,
|
|
3742
3782
|
globalManager,
|
|
3743
|
-
|
|
3783
|
+
pauseInteractions,
|
|
3744
3784
|
collectStyle,
|
|
3745
3785
|
FrameElement = Frame
|
|
3746
3786
|
}) => {
|
|
@@ -3772,7 +3812,7 @@ const FragmentInternal = ({
|
|
|
3772
3812
|
FrameElement,
|
|
3773
3813
|
{
|
|
3774
3814
|
layerKey: childLink,
|
|
3775
|
-
|
|
3815
|
+
pauseInteractions,
|
|
3776
3816
|
collectStyle,
|
|
3777
3817
|
hidden: !isResize && !isPrimary && !isTopFragment,
|
|
3778
3818
|
style: { display: isPrimary ? null : "none" }
|
|
@@ -3797,7 +3837,7 @@ const Fragment = (props) => {
|
|
|
3797
3837
|
const InstanceInitial = ({
|
|
3798
3838
|
Tag: inputTag,
|
|
3799
3839
|
style = {},
|
|
3800
|
-
|
|
3840
|
+
pauseInteractions,
|
|
3801
3841
|
FrameElement,
|
|
3802
3842
|
...instanceProps
|
|
3803
3843
|
}) => {
|
|
@@ -3811,13 +3851,13 @@ const InstanceInitial = ({
|
|
|
3811
3851
|
parentManager,
|
|
3812
3852
|
events,
|
|
3813
3853
|
props,
|
|
3814
|
-
|
|
3854
|
+
classnames,
|
|
3815
3855
|
innerManager,
|
|
3816
3856
|
definitions,
|
|
3817
3857
|
globalManager
|
|
3818
3858
|
} = useInstance({
|
|
3819
3859
|
...instanceProps,
|
|
3820
|
-
pauseInteractions
|
|
3860
|
+
pauseInteractions
|
|
3821
3861
|
});
|
|
3822
3862
|
if (ssr) {
|
|
3823
3863
|
(_c = (_b = globalManager == null ? void 0 : globalManager.$load) == null ? void 0 : _b.loadFragment) == null ? void 0 : _c.call(_b, fragmentId, { suspense: true });
|
|
@@ -3848,7 +3888,7 @@ const InstanceInitial = ({
|
|
|
3848
3888
|
children: parentManager ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3849
3889
|
Tag,
|
|
3850
3890
|
{
|
|
3851
|
-
className:
|
|
3891
|
+
className: classnames,
|
|
3852
3892
|
"data-key": instanceProps.layerKey,
|
|
3853
3893
|
style: { ...style, ...cssProps },
|
|
3854
3894
|
...link.linkProps,
|
|
@@ -3859,7 +3899,7 @@ const InstanceInitial = ({
|
|
|
3859
3899
|
fragmentId,
|
|
3860
3900
|
globalManager,
|
|
3861
3901
|
FrameElement,
|
|
3862
|
-
|
|
3902
|
+
pauseInteractions
|
|
3863
3903
|
}
|
|
3864
3904
|
)
|
|
3865
3905
|
}
|
|
@@ -3869,7 +3909,7 @@ const InstanceInitial = ({
|
|
|
3869
3909
|
fragmentId,
|
|
3870
3910
|
globalManager,
|
|
3871
3911
|
FrameElement,
|
|
3872
|
-
|
|
3912
|
+
pauseInteractions
|
|
3873
3913
|
}
|
|
3874
3914
|
) })
|
|
3875
3915
|
}
|
|
@@ -3892,7 +3932,18 @@ const AreaInitial = (areaProps) => {
|
|
|
3892
3932
|
}
|
|
3893
3933
|
const areaData = useArea(areaProps);
|
|
3894
3934
|
if (!areaData) return null;
|
|
3895
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3935
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3936
|
+
Scope,
|
|
3937
|
+
{
|
|
3938
|
+
fragmentManager: areaData.fragmentManager,
|
|
3939
|
+
layerKey: "Area",
|
|
3940
|
+
value: {
|
|
3941
|
+
type: definition.definition.scopeTypes.AreaScope,
|
|
3942
|
+
...areaData ?? {}
|
|
3943
|
+
},
|
|
3944
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Instance, { fragmentId: areaData.fragmentId, props: areaData == null ? void 0 : areaData.props })
|
|
3945
|
+
}
|
|
3946
|
+
);
|
|
3896
3947
|
};
|
|
3897
3948
|
const Area = (props) => {
|
|
3898
3949
|
return "globalManager" in props ? /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(GlobalManager, { value: props.globalManager, children: /* @__PURE__ */ jsxRuntime.jsx(AreaInitial, { ...props }) }) }) : /* @__PURE__ */ jsxRuntime.jsx(require$$0.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(AreaInitial, { ...props }) });
|
package/dist/index.es.js
CHANGED
|
@@ -390,6 +390,7 @@ const renderMode = createConstants("viewport", "parent", "fixed");
|
|
|
390
390
|
const interactions = createConstants("click", "mouseover", "appear");
|
|
391
391
|
const eventMode = createConstants("goal", "callback", "tracker");
|
|
392
392
|
const scopeTypes = createConstants(
|
|
393
|
+
"AreaScope",
|
|
393
394
|
"InstanceScope",
|
|
394
395
|
"FragmentScope",
|
|
395
396
|
"CollectionScope",
|
|
@@ -1280,7 +1281,8 @@ const SceneSchema = /* @__PURE__ */ object({
|
|
|
1280
1281
|
}),
|
|
1281
1282
|
visible: layerField(/* @__PURE__ */ boolean(), { fallback: true, variable: true }),
|
|
1282
1283
|
rotate: layerField(/* @__PURE__ */ number(), { fallback: null }),
|
|
1283
|
-
zIndex: layerField(/* @__PURE__ */ number(), { fallback:
|
|
1284
|
+
zIndex: layerField(/* @__PURE__ */ number(), { fallback: null }),
|
|
1285
|
+
classnames: layerField(/* @__PURE__ */ array(/* @__PURE__ */ number()), { fallback: [] })
|
|
1284
1286
|
});
|
|
1285
1287
|
const FillSchema = /* @__PURE__ */ object({
|
|
1286
1288
|
fillType: layerField(/* @__PURE__ */ picklist(Object.keys(paintMode)), {
|
|
@@ -2192,6 +2194,8 @@ function isFiniteNumber(value) {
|
|
|
2192
2194
|
}
|
|
2193
2195
|
var setKey$1 = (v2) => `$${v2}`;
|
|
2194
2196
|
function hashGenerator(layerKey) {
|
|
2197
|
+
if (!(layerKey == null ? void 0 : layerKey.length))
|
|
2198
|
+
return layerKey;
|
|
2195
2199
|
let hash = 0;
|
|
2196
2200
|
for (let i2 = 0; i2 < layerKey.length; i2++) {
|
|
2197
2201
|
hash = (hash << 5) - hash + layerKey.charCodeAt(i2);
|
|
@@ -2228,7 +2232,7 @@ const useGlobalManager = (globalManager) => {
|
|
|
2228
2232
|
setRenderTarget
|
|
2229
2233
|
};
|
|
2230
2234
|
};
|
|
2231
|
-
const useFragmentManager = (fragmentId, inputGlobalManager
|
|
2235
|
+
const useFragmentManager = (fragmentId, inputGlobalManager) => {
|
|
2232
2236
|
var _a;
|
|
2233
2237
|
const {
|
|
2234
2238
|
fragmentsGraph,
|
|
@@ -2319,7 +2323,7 @@ const cloneLayer = (manager, layer, externalProps = {}, _parent) => {
|
|
|
2319
2323
|
_type: layerGraph._type,
|
|
2320
2324
|
overrideFrom: setKey(layerKey),
|
|
2321
2325
|
parent: setKey(layerParent),
|
|
2322
|
-
...(layerGraph == null ? void 0 : layerGraph._type) === index.nodes.Instance ? pick(layerGraph, "fragment") : {},
|
|
2326
|
+
...(layerGraph == null ? void 0 : layerGraph._type) === index.nodes.Instance ? pick(layerGraph, "fragment", "props") : {},
|
|
2323
2327
|
...externalProps
|
|
2324
2328
|
},
|
|
2325
2329
|
true
|
|
@@ -3008,7 +3012,11 @@ const useCalcLayerBorder = (layerKey) => {
|
|
|
3008
3012
|
const useLayerBorder = (layerKey) => {
|
|
3009
3013
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
3010
3014
|
const [borderWidth] = useLayerValue(layerKey, "borderWidth", fragmentManager);
|
|
3011
|
-
const [borderColor] = useLayerValue(
|
|
3015
|
+
const [, , { cssVariableValue: borderColor }] = useLayerValue(
|
|
3016
|
+
layerKey,
|
|
3017
|
+
"borderColor",
|
|
3018
|
+
fragmentManager
|
|
3019
|
+
);
|
|
3012
3020
|
const calcBorder = useCalcLayerBorder(layerKey);
|
|
3013
3021
|
return useMemo(
|
|
3014
3022
|
() => calcBorder(borderWidth, borderColor),
|
|
@@ -3089,12 +3097,14 @@ const useLayerStyles = (layerKey) => {
|
|
|
3089
3097
|
);
|
|
3090
3098
|
const [whiteSpace2] = useLayerValue(layerKey, "whiteSpace", fragmentManager);
|
|
3091
3099
|
const textStyles = useLayerTextStyles(layerKey);
|
|
3100
|
+
const [overflow2] = useLayerValue(layerKey, "overflow", fragmentManager);
|
|
3092
3101
|
return {
|
|
3093
3102
|
// ...(props ?? {}),
|
|
3094
3103
|
...border,
|
|
3095
3104
|
...background,
|
|
3096
3105
|
...position,
|
|
3097
3106
|
opacity,
|
|
3107
|
+
overflow: overflow2,
|
|
3098
3108
|
rotate: isValue(rotate) ? `${rotate}deg` : null,
|
|
3099
3109
|
"border-radius": borderRadius,
|
|
3100
3110
|
"white-space": whiteSpace2,
|
|
@@ -3119,12 +3129,6 @@ const useFragmentProperties = (fragmentId) => {
|
|
|
3119
3129
|
manager
|
|
3120
3130
|
};
|
|
3121
3131
|
};
|
|
3122
|
-
const useHash = (layerKey, manager) => {
|
|
3123
|
-
if (!layerKey || !manager) return null;
|
|
3124
|
-
const layer = manager.resolve(layerKey);
|
|
3125
|
-
const overrideFrom = getKey(layer == null ? void 0 : layer.overrideFrom);
|
|
3126
|
-
return hashGenerator(overrideFrom ?? layerKey);
|
|
3127
|
-
};
|
|
3128
3132
|
const useInstanceProps = (instanceProps) => {
|
|
3129
3133
|
const isTopInstance = !(instanceProps == null ? void 0 : instanceProps.layerKey);
|
|
3130
3134
|
const { manager: loadedManager } = useFragmentManager(
|
|
@@ -3158,10 +3162,32 @@ const useInstanceProps = (instanceProps) => {
|
|
|
3158
3162
|
cssProps: getCssVariables(mergedProps)
|
|
3159
3163
|
};
|
|
3160
3164
|
};
|
|
3165
|
+
const useLayerScopes = (fragmentManager, layerKey) => {
|
|
3166
|
+
var _a, _b, _c, _d;
|
|
3167
|
+
if (!fragmentManager || !layerKey) return [];
|
|
3168
|
+
const layerParents = getAllParents(fragmentManager, layerKey);
|
|
3169
|
+
const resultScopes = [(_b = (_a = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a.scopes) == null ? void 0 : _b.get(void 0)];
|
|
3170
|
+
layerParents.forEach((parent) => {
|
|
3171
|
+
var _a2, _b2, _c2, _d2;
|
|
3172
|
+
const parentLink = keyOfEntity(parent);
|
|
3173
|
+
if ((_b2 = (_a2 = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a2.scopes) == null ? void 0 : _b2.has(parentLink)) {
|
|
3174
|
+
resultScopes.push((_d2 = (_c2 = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _c2.scopes) == null ? void 0 : _d2.get(parentLink));
|
|
3175
|
+
}
|
|
3176
|
+
});
|
|
3177
|
+
const areaScope = (_d = (_c = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _c.scopes) == null ? void 0 : _d.get("Area");
|
|
3178
|
+
if (areaScope) {
|
|
3179
|
+
resultScopes.push(areaScope);
|
|
3180
|
+
}
|
|
3181
|
+
return resultScopes;
|
|
3182
|
+
};
|
|
3161
3183
|
const useLayerInteractions = (layerKey, options2) => {
|
|
3162
3184
|
const pause = (options2 == null ? void 0 : options2.pauseInteractions) ?? false;
|
|
3163
3185
|
const { manager: globalManager } = useGlobalManager();
|
|
3164
3186
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
3187
|
+
const scopes = useLayerScopes(fragmentManager, layerKey);
|
|
3188
|
+
const areaScope = scopes.find(
|
|
3189
|
+
(scope) => (scope == null ? void 0 : scope.type) === index.scopeTypes.AreaScope
|
|
3190
|
+
);
|
|
3165
3191
|
const [interactions2] = useLayerValue(
|
|
3166
3192
|
layerKey,
|
|
3167
3193
|
"interactions",
|
|
@@ -3171,10 +3197,14 @@ const useLayerInteractions = (layerKey, options2) => {
|
|
|
3171
3197
|
const fireEvent = useCallback(
|
|
3172
3198
|
(eventLink) => {
|
|
3173
3199
|
var _a, _b, _c, _d;
|
|
3200
|
+
if (!areaScope) return null;
|
|
3174
3201
|
const event = fragmentManager.resolve(eventLink);
|
|
3175
3202
|
const { value: eventValue } = readVariable(eventLink);
|
|
3176
|
-
if ((event == null ? void 0 : event.mode) === index.eventMode.goal && (eventValue == null ? void 0 : eventValue.
|
|
3177
|
-
(_b = (_a = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _a.reachGoal) == null ? void 0 : _b.call(_a,
|
|
3203
|
+
if ((event == null ? void 0 : event.mode) === index.eventMode.goal && (eventValue == null ? void 0 : eventValue.goalId)) {
|
|
3204
|
+
(_b = (_a = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _a.reachGoal) == null ? void 0 : _b.call(_a, {
|
|
3205
|
+
goalId: eventValue == null ? void 0 : eventValue.goalId,
|
|
3206
|
+
...pick(areaScope, "variantId", "campaignId", "areaId")
|
|
3207
|
+
});
|
|
3178
3208
|
}
|
|
3179
3209
|
if ((event == null ? void 0 : event.mode) === index.eventMode.tracker && eventValue) {
|
|
3180
3210
|
(_d = (_c = globalManager == null ? void 0 : globalManager.$metrics) == null ? void 0 : _c.trackAdPixel) == null ? void 0 : _d.call(_c, eventValue);
|
|
@@ -3183,13 +3213,13 @@ const useLayerInteractions = (layerKey, options2) => {
|
|
|
3183
3213
|
eventValue();
|
|
3184
3214
|
}
|
|
3185
3215
|
},
|
|
3186
|
-
[globalManager, fragmentManager]
|
|
3216
|
+
[globalManager, fragmentManager, areaScope]
|
|
3187
3217
|
);
|
|
3188
3218
|
useEffect(() => {
|
|
3189
3219
|
if (!pause && Array.isArray(interactions2)) {
|
|
3190
3220
|
interactions2 == null ? void 0 : interactions2.filter((el) => (el == null ? void 0 : el.on) === index.interactions.appear).map((el) => el.event).forEach(fireEvent);
|
|
3191
3221
|
}
|
|
3192
|
-
}, [pause]);
|
|
3222
|
+
}, [pause, areaScope]);
|
|
3193
3223
|
return useMemo(() => {
|
|
3194
3224
|
if (!pause && !interactions2 || !Array.isArray(interactions2)) return {};
|
|
3195
3225
|
if (pause) return {};
|
|
@@ -3201,6 +3231,22 @@ const useLayerInteractions = (layerKey, options2) => {
|
|
|
3201
3231
|
};
|
|
3202
3232
|
}, [interactions2, fireEvent, pause]);
|
|
3203
3233
|
};
|
|
3234
|
+
const useHash = (layerKey, manager) => {
|
|
3235
|
+
if (!layerKey || !manager) return null;
|
|
3236
|
+
const layer = manager.resolve(layerKey);
|
|
3237
|
+
const overrideFrom = getKey(layer == null ? void 0 : layer.overrideFrom);
|
|
3238
|
+
return hashGenerator(overrideFrom ?? layerKey);
|
|
3239
|
+
};
|
|
3240
|
+
const useClassnames = (layerKey, manager) => {
|
|
3241
|
+
const hash = useHash(layerKey, manager);
|
|
3242
|
+
const [classnames] = useLayerValue(layerKey, "classnames", { manager });
|
|
3243
|
+
if (!layerKey || !manager) return null;
|
|
3244
|
+
let base = [hash];
|
|
3245
|
+
if (classnames == null ? void 0 : classnames.length) {
|
|
3246
|
+
base = [...base, ...classnames];
|
|
3247
|
+
}
|
|
3248
|
+
return base.join(" ");
|
|
3249
|
+
};
|
|
3204
3250
|
const useInstance = (instanceProps) => {
|
|
3205
3251
|
const { manager: parentManager } = useContext(FragmentContext);
|
|
3206
3252
|
const [instanceLayer] = y(parentManager, instanceProps.layerKey);
|
|
@@ -3212,9 +3258,12 @@ const useInstance = (instanceProps) => {
|
|
|
3212
3258
|
const resultFragmentId = (instanceProps == null ? void 0 : instanceProps.fragmentId) ?? (instanceLayer == null ? void 0 : instanceLayer.fragment);
|
|
3213
3259
|
const { properties: definitions, manager: innerFragmentManager } = useFragmentProperties(resultFragmentId);
|
|
3214
3260
|
const { props, cssProps } = useInstanceProps(instanceProps);
|
|
3215
|
-
const
|
|
3261
|
+
const classnames = useClassnames(
|
|
3262
|
+
instanceProps.layerKey,
|
|
3263
|
+
innerFragmentManager
|
|
3264
|
+
);
|
|
3216
3265
|
return {
|
|
3217
|
-
|
|
3266
|
+
classnames,
|
|
3218
3267
|
styles: styles2,
|
|
3219
3268
|
events,
|
|
3220
3269
|
definitions,
|
|
@@ -3310,9 +3359,11 @@ const useFragment = (fragmentId, globalManager) => {
|
|
|
3310
3359
|
(_a = fragmentContext.manager) == null ? void 0 : _a.resolve(fragmentContext.fragmentLayerKey),
|
|
3311
3360
|
(_b = fragmentContext.manager) == null ? void 0 : _b.key
|
|
3312
3361
|
);
|
|
3313
|
-
mount();
|
|
3314
3362
|
}
|
|
3315
3363
|
useEffect(() => {
|
|
3364
|
+
if (fragmentContext.manager) {
|
|
3365
|
+
mount();
|
|
3366
|
+
}
|
|
3316
3367
|
return () => {
|
|
3317
3368
|
unmount();
|
|
3318
3369
|
};
|
|
@@ -3357,7 +3408,7 @@ const useFrame = (layerKey, options2) => {
|
|
|
3357
3408
|
const layer = fragmentManager.entityOfKey(layerKey);
|
|
3358
3409
|
const styles2 = useLayerStyles(layerKey);
|
|
3359
3410
|
const children = useLayerChildren(layerKey);
|
|
3360
|
-
const
|
|
3411
|
+
const classnames = useClassnames(layerKey, fragmentManager);
|
|
3361
3412
|
const { addLayerStyle } = useStyleSheet(fragmentManager);
|
|
3362
3413
|
const events = useLayerInteractions(layerKey, options2);
|
|
3363
3414
|
const link = useLayerLink(layerKey);
|
|
@@ -3367,7 +3418,7 @@ const useFrame = (layerKey, options2) => {
|
|
|
3367
3418
|
return {
|
|
3368
3419
|
Tag: (link == null ? void 0 : link.isLink) ? (options2 == null ? void 0 : options2.FrameTag) ?? "a" : (options2 == null ? void 0 : options2.FrameTag) ?? "div",
|
|
3369
3420
|
type: layer == null ? void 0 : layer._type,
|
|
3370
|
-
|
|
3421
|
+
classnames,
|
|
3371
3422
|
styles: {},
|
|
3372
3423
|
//isBrowser ? pick(styles, "background") : {},
|
|
3373
3424
|
children,
|
|
@@ -3420,14 +3471,14 @@ const useTextAttributes = (layerKey, options2) => {
|
|
|
3420
3471
|
const { manager: fragmentManager } = useContext(FragmentContext);
|
|
3421
3472
|
const styles2 = useLayerStyles(layerKey);
|
|
3422
3473
|
const content = useTextContent(layerKey);
|
|
3423
|
-
const
|
|
3474
|
+
const classnames = useClassnames(layerKey, fragmentManager);
|
|
3424
3475
|
const { addLayerStyle } = useStyleSheet(fragmentManager);
|
|
3425
3476
|
if (collectStyle) {
|
|
3426
3477
|
addLayerStyle(layerKey, styles2, fragmentManager.resolve(layerKey));
|
|
3427
3478
|
}
|
|
3428
3479
|
return {
|
|
3429
3480
|
styles: styles2,
|
|
3430
|
-
|
|
3481
|
+
classnames,
|
|
3431
3482
|
content
|
|
3432
3483
|
};
|
|
3433
3484
|
};
|
|
@@ -3513,19 +3564,6 @@ function useInjectedStyle() {
|
|
|
3513
3564
|
injectStyle
|
|
3514
3565
|
};
|
|
3515
3566
|
}
|
|
3516
|
-
const useLayerScopes = (fragmentManager, layerKey) => {
|
|
3517
|
-
var _a, _b;
|
|
3518
|
-
const layerParents = getAllParents(fragmentManager, layerKey);
|
|
3519
|
-
const resultScopes = [(_b = (_a = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a.scopes) == null ? void 0 : _b.get(void 0)];
|
|
3520
|
-
layerParents.forEach((parent) => {
|
|
3521
|
-
var _a2, _b2, _c, _d;
|
|
3522
|
-
const parentLink = keyOfEntity(parent);
|
|
3523
|
-
if ((_b2 = (_a2 = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _a2.scopes) == null ? void 0 : _b2.has(parentLink)) {
|
|
3524
|
-
resultScopes.push((_d = (_c = fragmentManager == null ? void 0 : fragmentManager.$scopes) == null ? void 0 : _c.scopes) == null ? void 0 : _d.get(parentLink));
|
|
3525
|
-
}
|
|
3526
|
-
});
|
|
3527
|
-
return resultScopes;
|
|
3528
|
-
};
|
|
3529
3567
|
function cssToJsStyle(cssKey) {
|
|
3530
3568
|
return cssKey.replace(/-([a-z])/g, (_2, letter) => letter.toUpperCase());
|
|
3531
3569
|
}
|
|
@@ -3553,6 +3591,10 @@ const useArea = (options2) => {
|
|
|
3553
3591
|
options2 == null ? void 0 : options2.globalManager
|
|
3554
3592
|
);
|
|
3555
3593
|
const [areaData, setAreaData] = useState(queryArea(options2.areaCode));
|
|
3594
|
+
const { manager: fragmentManager } = useFragmentManager(
|
|
3595
|
+
areaData.fragmentId,
|
|
3596
|
+
resultGlobalManager
|
|
3597
|
+
);
|
|
3556
3598
|
const resultProps = useMemo(
|
|
3557
3599
|
() => ({ ...(areaData == null ? void 0 : areaData.props) ?? {}, ...(options2 == null ? void 0 : options2.props) ?? [] }),
|
|
3558
3600
|
[areaData, options2]
|
|
@@ -3567,6 +3609,7 @@ const useArea = (options2) => {
|
|
|
3567
3609
|
}, []);
|
|
3568
3610
|
return {
|
|
3569
3611
|
...areaData,
|
|
3612
|
+
fragmentManager,
|
|
3570
3613
|
props: resultProps,
|
|
3571
3614
|
globalManager: resultGlobalManager
|
|
3572
3615
|
};
|
|
@@ -3601,8 +3644,8 @@ const Text = ({
|
|
|
3601
3644
|
collectStyle,
|
|
3602
3645
|
...restProps
|
|
3603
3646
|
}) => {
|
|
3604
|
-
const {
|
|
3605
|
-
return /* @__PURE__ */ jsx(Tag, { className:
|
|
3647
|
+
const { classnames, content } = useTextAttributes(layerKey, { collectStyle });
|
|
3648
|
+
return /* @__PURE__ */ jsx(Tag, { className: classnames, "data-key": layerKey, ...restProps, children: /* @__PURE__ */ jsx(
|
|
3606
3649
|
"div",
|
|
3607
3650
|
{
|
|
3608
3651
|
className: styles.text,
|
|
@@ -3632,7 +3675,7 @@ const Collection = ({
|
|
|
3632
3675
|
fragmentManager,
|
|
3633
3676
|
styles: styles2,
|
|
3634
3677
|
sourceDefinition,
|
|
3635
|
-
|
|
3678
|
+
classnames,
|
|
3636
3679
|
source,
|
|
3637
3680
|
children,
|
|
3638
3681
|
sourceValue
|
|
@@ -3653,7 +3696,7 @@ const Collection = ({
|
|
|
3653
3696
|
children: /* @__PURE__ */ jsx(
|
|
3654
3697
|
FrameTag,
|
|
3655
3698
|
{
|
|
3656
|
-
className:
|
|
3699
|
+
className: classnames,
|
|
3657
3700
|
"data-key": layerKey,
|
|
3658
3701
|
style: resultStyles,
|
|
3659
3702
|
...restProps,
|
|
@@ -3691,16 +3734,13 @@ const Frame = ({
|
|
|
3691
3734
|
layerKey,
|
|
3692
3735
|
styles: inputStyles,
|
|
3693
3736
|
hidden,
|
|
3694
|
-
|
|
3737
|
+
pauseInteractions,
|
|
3695
3738
|
...restProps
|
|
3696
3739
|
}) => {
|
|
3697
|
-
const { styles: styles2,
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
pauseInteractions: !interactive
|
|
3702
|
-
}
|
|
3703
|
-
);
|
|
3740
|
+
const { styles: styles2, classnames, children, type, events, linkProps, Tag } = useFrame(layerKey, {
|
|
3741
|
+
...restProps,
|
|
3742
|
+
pauseInteractions
|
|
3743
|
+
});
|
|
3704
3744
|
const resultStyles = inputStyles ?? styles2;
|
|
3705
3745
|
const isMounted = useMounted();
|
|
3706
3746
|
if (isMounted && hidden) {
|
|
@@ -3722,7 +3762,7 @@ const Frame = ({
|
|
|
3722
3762
|
return /* @__PURE__ */ jsx(
|
|
3723
3763
|
Tag,
|
|
3724
3764
|
{
|
|
3725
|
-
className:
|
|
3765
|
+
className: classnames,
|
|
3726
3766
|
"data-key": layerKey,
|
|
3727
3767
|
style: {
|
|
3728
3768
|
...resultStyles,
|
|
@@ -3738,7 +3778,7 @@ const Frame = ({
|
|
|
3738
3778
|
const FragmentInternal = ({
|
|
3739
3779
|
fragmentId,
|
|
3740
3780
|
globalManager,
|
|
3741
|
-
|
|
3781
|
+
pauseInteractions,
|
|
3742
3782
|
collectStyle,
|
|
3743
3783
|
FrameElement = Frame
|
|
3744
3784
|
}) => {
|
|
@@ -3770,7 +3810,7 @@ const FragmentInternal = ({
|
|
|
3770
3810
|
FrameElement,
|
|
3771
3811
|
{
|
|
3772
3812
|
layerKey: childLink,
|
|
3773
|
-
|
|
3813
|
+
pauseInteractions,
|
|
3774
3814
|
collectStyle,
|
|
3775
3815
|
hidden: !isResize && !isPrimary && !isTopFragment,
|
|
3776
3816
|
style: { display: isPrimary ? null : "none" }
|
|
@@ -3795,7 +3835,7 @@ const Fragment = (props) => {
|
|
|
3795
3835
|
const InstanceInitial = ({
|
|
3796
3836
|
Tag: inputTag,
|
|
3797
3837
|
style = {},
|
|
3798
|
-
|
|
3838
|
+
pauseInteractions,
|
|
3799
3839
|
FrameElement,
|
|
3800
3840
|
...instanceProps
|
|
3801
3841
|
}) => {
|
|
@@ -3809,13 +3849,13 @@ const InstanceInitial = ({
|
|
|
3809
3849
|
parentManager,
|
|
3810
3850
|
events,
|
|
3811
3851
|
props,
|
|
3812
|
-
|
|
3852
|
+
classnames,
|
|
3813
3853
|
innerManager,
|
|
3814
3854
|
definitions,
|
|
3815
3855
|
globalManager
|
|
3816
3856
|
} = useInstance({
|
|
3817
3857
|
...instanceProps,
|
|
3818
|
-
pauseInteractions
|
|
3858
|
+
pauseInteractions
|
|
3819
3859
|
});
|
|
3820
3860
|
if (ssr) {
|
|
3821
3861
|
(_c = (_b = globalManager == null ? void 0 : globalManager.$load) == null ? void 0 : _b.loadFragment) == null ? void 0 : _c.call(_b, fragmentId, { suspense: true });
|
|
@@ -3846,7 +3886,7 @@ const InstanceInitial = ({
|
|
|
3846
3886
|
children: parentManager ? /* @__PURE__ */ jsx(
|
|
3847
3887
|
Tag,
|
|
3848
3888
|
{
|
|
3849
|
-
className:
|
|
3889
|
+
className: classnames,
|
|
3850
3890
|
"data-key": instanceProps.layerKey,
|
|
3851
3891
|
style: { ...style, ...cssProps },
|
|
3852
3892
|
...link.linkProps,
|
|
@@ -3857,7 +3897,7 @@ const InstanceInitial = ({
|
|
|
3857
3897
|
fragmentId,
|
|
3858
3898
|
globalManager,
|
|
3859
3899
|
FrameElement,
|
|
3860
|
-
|
|
3900
|
+
pauseInteractions
|
|
3861
3901
|
}
|
|
3862
3902
|
)
|
|
3863
3903
|
}
|
|
@@ -3867,7 +3907,7 @@ const InstanceInitial = ({
|
|
|
3867
3907
|
fragmentId,
|
|
3868
3908
|
globalManager,
|
|
3869
3909
|
FrameElement,
|
|
3870
|
-
|
|
3910
|
+
pauseInteractions
|
|
3871
3911
|
}
|
|
3872
3912
|
) })
|
|
3873
3913
|
}
|
|
@@ -3890,7 +3930,18 @@ const AreaInitial = (areaProps) => {
|
|
|
3890
3930
|
}
|
|
3891
3931
|
const areaData = useArea(areaProps);
|
|
3892
3932
|
if (!areaData) return null;
|
|
3893
|
-
return /* @__PURE__ */ jsx(
|
|
3933
|
+
return /* @__PURE__ */ jsx(
|
|
3934
|
+
Scope,
|
|
3935
|
+
{
|
|
3936
|
+
fragmentManager: areaData.fragmentManager,
|
|
3937
|
+
layerKey: "Area",
|
|
3938
|
+
value: {
|
|
3939
|
+
type: definition.scopeTypes.AreaScope,
|
|
3940
|
+
...areaData ?? {}
|
|
3941
|
+
},
|
|
3942
|
+
children: /* @__PURE__ */ jsx(Instance, { fragmentId: areaData.fragmentId, props: areaData == null ? void 0 : areaData.props })
|
|
3943
|
+
}
|
|
3944
|
+
);
|
|
3894
3945
|
};
|
|
3895
3946
|
const Area = (props) => {
|
|
3896
3947
|
return "globalManager" in props ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(GlobalManager, { value: props.globalManager, children: /* @__PURE__ */ jsx(AreaInitial, { ...props }) }) }) : /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(AreaInitial, { ...props }) });
|