@elementor/editor-global-classes 4.1.0-825 → 4.1.0-826
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.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +664 -567
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +676 -580
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/class-manager/class-manager-button.tsx +16 -6
- package/src/components/class-manager/class-manager-panel.tsx +196 -90
- package/src/index.ts +4 -0
- package/src/init.ts +11 -5
- package/src/sync-with-document.tsx +13 -5
package/dist/index.js
CHANGED
|
@@ -30,32 +30,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
ClassManagerPanelEmbedded: () => ClassManagerPanelEmbedded,
|
|
33
34
|
GLOBAL_CLASSES_URI: () => GLOBAL_CLASSES_URI,
|
|
34
35
|
init: () => init
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(index_exports);
|
|
37
38
|
|
|
38
|
-
// src/
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
// src/components/class-manager/class-manager-panel.tsx
|
|
40
|
+
var React19 = __toESM(require("react"));
|
|
41
|
+
var import_react10 = require("react");
|
|
42
|
+
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
43
|
+
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
44
|
+
var import_editor_panels = require("@elementor/editor-panels");
|
|
45
|
+
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
45
46
|
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
47
|
+
var import_icons11 = require("@elementor/icons");
|
|
48
|
+
var import_query2 = require("@elementor/query");
|
|
49
|
+
var import_store18 = require("@elementor/store");
|
|
50
|
+
var import_ui16 = require("@elementor/ui");
|
|
51
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
52
|
+
|
|
53
|
+
// src/hooks/use-classes-order.ts
|
|
54
|
+
var import_store2 = require("@elementor/store");
|
|
55
|
+
|
|
56
|
+
// src/store.ts
|
|
57
|
+
var import_editor_styles = require("@elementor/editor-styles");
|
|
58
|
+
var import_store = require("@elementor/store");
|
|
59
59
|
|
|
60
60
|
// src/errors.ts
|
|
61
61
|
var import_utils = require("@elementor/utils");
|
|
@@ -72,10 +72,6 @@ var GlobalClassTrackingError = (0, import_utils.createError)({
|
|
|
72
72
|
message: "Error tracking global classes event."
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
// src/store.ts
|
|
76
|
-
var import_editor_styles = require("@elementor/editor-styles");
|
|
77
|
-
var import_store = require("@elementor/store");
|
|
78
|
-
|
|
79
75
|
// src/utils/snapshot-history.ts
|
|
80
76
|
function createLink({ value, next, prev }) {
|
|
81
77
|
return {
|
|
@@ -263,402 +259,44 @@ var mergeProps = (current, updates) => {
|
|
|
263
259
|
const props = Array.isArray(current) ? {} : current;
|
|
264
260
|
Object.entries(updates).forEach(([key, value]) => {
|
|
265
261
|
if (value === null || value === void 0) {
|
|
266
|
-
delete props[key];
|
|
267
|
-
} else {
|
|
268
|
-
props[key] = value;
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
return props;
|
|
272
|
-
};
|
|
273
|
-
var getNonEmptyVariants = (style) => {
|
|
274
|
-
return style.variants.filter(
|
|
275
|
-
({ props, custom_css: customCss }) => Object.keys(props).length || customCss?.raw
|
|
276
|
-
);
|
|
277
|
-
};
|
|
278
|
-
var selectData = (state) => state[SLICE_NAME].data;
|
|
279
|
-
var selectFrontendInitialData = (state) => state[SLICE_NAME].initialData.frontend;
|
|
280
|
-
var selectPreviewInitialData = (state) => state[SLICE_NAME].initialData.preview;
|
|
281
|
-
var selectOrder = (0, import_store.__createSelector)(selectData, ({ order }) => order);
|
|
282
|
-
var selectGlobalClasses = (0, import_store.__createSelector)(selectData, ({ items }) => items);
|
|
283
|
-
var selectIsDirty = (state) => state[SLICE_NAME].isDirty;
|
|
284
|
-
var selectOrderedClasses = (0, import_store.__createSelector)(
|
|
285
|
-
selectGlobalClasses,
|
|
286
|
-
selectOrder,
|
|
287
|
-
(items, order) => order.map((id2) => items[id2])
|
|
288
|
-
);
|
|
289
|
-
var selectClass = (state, id2) => state[SLICE_NAME].data.items[id2] ?? null;
|
|
290
|
-
var selectEmptyCssClass = (0, import_store.__createSelector)(
|
|
291
|
-
selectData,
|
|
292
|
-
({ items }) => Object.values(items).filter((cssClass) => cssClass.variants.length === 0)
|
|
293
|
-
);
|
|
294
|
-
|
|
295
|
-
// src/utils/tracking.ts
|
|
296
|
-
var import_events = require("@elementor/events");
|
|
297
|
-
var import_store2 = require("@elementor/store");
|
|
298
|
-
|
|
299
|
-
// src/api.ts
|
|
300
|
-
var import_http_client = require("@elementor/http-client");
|
|
301
|
-
var RESOURCE_URL = "/global-classes";
|
|
302
|
-
var BASE_URL = "elementor/v1";
|
|
303
|
-
var RESOURCE_USAGE_URL = `${RESOURCE_URL}/usage`;
|
|
304
|
-
var apiClient = {
|
|
305
|
-
usage: () => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_USAGE_URL}`),
|
|
306
|
-
all: (context2 = "preview") => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_URL}`, {
|
|
307
|
-
params: { context: context2 }
|
|
308
|
-
}),
|
|
309
|
-
publish: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
310
|
-
params: {
|
|
311
|
-
context: "frontend"
|
|
312
|
-
}
|
|
313
|
-
}),
|
|
314
|
-
saveDraft: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
315
|
-
params: {
|
|
316
|
-
context: "preview"
|
|
317
|
-
}
|
|
318
|
-
})
|
|
319
|
-
};
|
|
320
|
-
var API_ERROR_CODES = {
|
|
321
|
-
DUPLICATED_LABEL: "DUPLICATED_LABEL"
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
// src/components/css-class-usage/utils.ts
|
|
325
|
-
var transformData = (data) => Object.entries(data).reduce((acc, [key, value]) => {
|
|
326
|
-
acc[key] = {
|
|
327
|
-
content: value || [],
|
|
328
|
-
total: value.reduce((total, val) => total + (val?.total || 0), 0)
|
|
329
|
-
};
|
|
330
|
-
return acc;
|
|
331
|
-
}, {});
|
|
332
|
-
|
|
333
|
-
// service/css-class-usage-service.ts
|
|
334
|
-
var fetchCssClassUsage = async () => {
|
|
335
|
-
const response = await apiClient.usage();
|
|
336
|
-
return transformData(response?.data?.data || {});
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
// src/utils/tracking.ts
|
|
340
|
-
var trackGlobalClasses = async (payload) => {
|
|
341
|
-
const { runAction } = payload;
|
|
342
|
-
const data = await getSanitizedData(payload);
|
|
343
|
-
if (data) {
|
|
344
|
-
track(data);
|
|
345
|
-
if (data.event === "classCreated" && "classId" in data) {
|
|
346
|
-
fireClassApplied(data.classId);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
runAction?.();
|
|
350
|
-
};
|
|
351
|
-
var fireClassApplied = async (classId) => {
|
|
352
|
-
const appliedInfo = await getAppliedInfo(classId);
|
|
353
|
-
track({
|
|
354
|
-
event: "classApplied",
|
|
355
|
-
classId,
|
|
356
|
-
...appliedInfo,
|
|
357
|
-
totalInstancesAfterApply: 1
|
|
358
|
-
});
|
|
359
|
-
};
|
|
360
|
-
var getSanitizedData = async (payload) => {
|
|
361
|
-
switch (payload.event) {
|
|
362
|
-
case "classApplied":
|
|
363
|
-
if ("classId" in payload && payload.classId) {
|
|
364
|
-
const appliedInfo = await getAppliedInfo(payload.classId);
|
|
365
|
-
return { ...payload, ...appliedInfo };
|
|
366
|
-
}
|
|
367
|
-
break;
|
|
368
|
-
case "classRemoved":
|
|
369
|
-
if ("classId" in payload && payload.classId) {
|
|
370
|
-
const deleteInfo = getRemovedInfo(payload.classId);
|
|
371
|
-
return { ...payload, ...deleteInfo };
|
|
372
|
-
}
|
|
373
|
-
break;
|
|
374
|
-
case "classDeleted":
|
|
375
|
-
if ("classId" in payload && payload.classId) {
|
|
376
|
-
const deleteInfo = await trackDeleteClass(payload.classId);
|
|
377
|
-
return { ...payload, ...deleteInfo };
|
|
378
|
-
}
|
|
379
|
-
break;
|
|
380
|
-
case "classCreated":
|
|
381
|
-
if ("source" in payload && payload.source !== "created") {
|
|
382
|
-
if ("classId" in payload && payload.classId) {
|
|
383
|
-
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
return payload;
|
|
387
|
-
case "classStateClicked":
|
|
388
|
-
if ("classId" in payload && payload.classId) {
|
|
389
|
-
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
390
|
-
}
|
|
391
|
-
break;
|
|
392
|
-
case "classSyncToV3PopupShown":
|
|
393
|
-
return {
|
|
394
|
-
...payload,
|
|
395
|
-
interaction_type: "popup_shown",
|
|
396
|
-
target_type: "popup",
|
|
397
|
-
target_name: "sync_to_v3_popup",
|
|
398
|
-
interaction_result: "popup_viewed",
|
|
399
|
-
target_location: "widget_panel",
|
|
400
|
-
location_l1: "class_manager"
|
|
401
|
-
};
|
|
402
|
-
case "classSyncToV3": {
|
|
403
|
-
const classLabel = getCssClass(payload.classId).label;
|
|
404
|
-
const isSync = payload.action === "sync";
|
|
405
|
-
return {
|
|
406
|
-
...payload,
|
|
407
|
-
interaction_type: "click",
|
|
408
|
-
target_type: classLabel,
|
|
409
|
-
target_name: isSync ? "sync_to_v3" : "unsync_to_v3",
|
|
410
|
-
interaction_result: isSync ? "class_is_synced_to_V3" : "class_is_unsynced_from_V3",
|
|
411
|
-
target_location: "widget_panel",
|
|
412
|
-
location_l1: "class_manager",
|
|
413
|
-
interaction_description: isSync ? `user_synced_${classLabel}_to_v3` : `user_unsync_${classLabel}_from_v3`
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
case "classSyncToV3PopupClick": {
|
|
417
|
-
const isSyncAction = payload.action === "sync";
|
|
418
|
-
return {
|
|
419
|
-
...payload,
|
|
420
|
-
interaction_type: "click",
|
|
421
|
-
target_type: "button",
|
|
422
|
-
target_name: isSyncAction ? "sync_to_v3" : "cancel",
|
|
423
|
-
interaction_result: isSyncAction ? "class_is_synced" : "cancel",
|
|
424
|
-
target_location: "sync_to_v3_popup"
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
default:
|
|
428
|
-
return payload;
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
var track = (data) => {
|
|
432
|
-
const { dispatchEvent, config } = (0, import_events.getMixpanel)();
|
|
433
|
-
if (!config?.names?.global_classes?.[data.event]) {
|
|
434
|
-
console.error("Global class tracking event not found", { event: data.event });
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
const name = config.names.global_classes[data.event];
|
|
438
|
-
const { event, ...eventData } = data;
|
|
439
|
-
try {
|
|
440
|
-
dispatchEvent?.(name, {
|
|
441
|
-
event,
|
|
442
|
-
...eventData
|
|
443
|
-
});
|
|
444
|
-
} catch (error) {
|
|
445
|
-
throw new GlobalClassTrackingError({ cause: error });
|
|
446
|
-
}
|
|
447
|
-
};
|
|
448
|
-
var extractCssClassData = (classId) => {
|
|
449
|
-
const cssClass = getCssClass(classId);
|
|
450
|
-
const classTitle = cssClass.label;
|
|
451
|
-
return { classTitle };
|
|
452
|
-
};
|
|
453
|
-
var getCssClass = (classId) => {
|
|
454
|
-
const cssClass = selectClass((0, import_store2.__getState)(), classId);
|
|
455
|
-
if (!cssClass) {
|
|
456
|
-
throw new Error(`CSS class with ID ${classId} not found`);
|
|
457
|
-
}
|
|
458
|
-
return cssClass;
|
|
459
|
-
};
|
|
460
|
-
var trackDeleteClass = async (classId) => {
|
|
461
|
-
const totalInstances = await getTotalInstancesByCssClassID(classId);
|
|
462
|
-
const classTitle = getCssClass(classId).label;
|
|
463
|
-
return { totalInstances, classTitle };
|
|
464
|
-
};
|
|
465
|
-
var getTotalInstancesByCssClassID = async (classId) => {
|
|
466
|
-
const cssClassUsage = await fetchCssClassUsage();
|
|
467
|
-
return cssClassUsage[classId]?.total ?? 1;
|
|
468
|
-
};
|
|
469
|
-
var getAppliedInfo = async (classId) => {
|
|
470
|
-
const { classTitle } = extractCssClassData(classId);
|
|
471
|
-
const totalInstancesAfterApply = await getTotalInstancesByCssClassID(classId) + 1;
|
|
472
|
-
return { classTitle, totalInstancesAfterApply };
|
|
473
|
-
};
|
|
474
|
-
var getRemovedInfo = (classId) => {
|
|
475
|
-
const { classTitle } = extractCssClassData(classId);
|
|
476
|
-
return {
|
|
477
|
-
classTitle
|
|
478
|
-
};
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
// src/global-classes-styles-provider.ts
|
|
482
|
-
var MAX_CLASSES = 100;
|
|
483
|
-
var GLOBAL_CLASSES_PROVIDER_KEY = "global-classes";
|
|
484
|
-
var PREGENERATED_LINK_PATTERN = /^global-(preview|frontend)-[a-zA-Z_-]+-css$/;
|
|
485
|
-
var globalClassesStylesProvider = (0, import_editor_styles_repository.createStylesProvider)({
|
|
486
|
-
key: GLOBAL_CLASSES_PROVIDER_KEY,
|
|
487
|
-
priority: 30,
|
|
488
|
-
limit: MAX_CLASSES,
|
|
489
|
-
isPregeneratedLink: ({ id: id2 }) => PREGENERATED_LINK_PATTERN.test(id2),
|
|
490
|
-
labels: {
|
|
491
|
-
singular: (0, import_i18n.__)("class", "elementor"),
|
|
492
|
-
plural: (0, import_i18n.__)("classes", "elementor")
|
|
493
|
-
},
|
|
494
|
-
subscribe: (cb) => subscribeWithStates(cb),
|
|
495
|
-
capabilities: getCapabilities(),
|
|
496
|
-
actions: {
|
|
497
|
-
all: () => selectOrderedClasses((0, import_store4.__getState)()),
|
|
498
|
-
get: (id2) => selectClass((0, import_store4.__getState)(), id2),
|
|
499
|
-
resolveCssName: (id2) => {
|
|
500
|
-
return selectClass((0, import_store4.__getState)(), id2)?.label ?? id2;
|
|
501
|
-
},
|
|
502
|
-
create: (label, variants = [], id2) => {
|
|
503
|
-
const classes = selectGlobalClasses((0, import_store4.__getState)());
|
|
504
|
-
const existingLabels = Object.values(classes).map((style) => style.label);
|
|
505
|
-
if (existingLabels.includes(label)) {
|
|
506
|
-
throw new GlobalClassLabelAlreadyExistsError({ context: { label } });
|
|
507
|
-
}
|
|
508
|
-
if (!id2) {
|
|
509
|
-
id2 = (0, import_editor_styles2.generateId)("g-", Object.keys(classes));
|
|
510
|
-
}
|
|
511
|
-
(0, import_store4.__dispatch)(
|
|
512
|
-
slice.actions.add({
|
|
513
|
-
id: id2,
|
|
514
|
-
type: "class",
|
|
515
|
-
label,
|
|
516
|
-
variants
|
|
517
|
-
})
|
|
518
|
-
);
|
|
519
|
-
return id2;
|
|
520
|
-
},
|
|
521
|
-
update: (payload) => {
|
|
522
|
-
(0, import_store4.__dispatch)(
|
|
523
|
-
slice.actions.update({
|
|
524
|
-
style: payload
|
|
525
|
-
})
|
|
526
|
-
);
|
|
527
|
-
},
|
|
528
|
-
delete: (id2) => {
|
|
529
|
-
(0, import_store4.__dispatch)(slice.actions.delete(id2));
|
|
530
|
-
},
|
|
531
|
-
updateProps: (args) => {
|
|
532
|
-
(0, import_store4.__dispatch)(
|
|
533
|
-
slice.actions.updateProps({
|
|
534
|
-
id: args.id,
|
|
535
|
-
meta: args.meta,
|
|
536
|
-
props: args.props,
|
|
537
|
-
mode: args.mode
|
|
538
|
-
})
|
|
539
|
-
);
|
|
540
|
-
},
|
|
541
|
-
updateCustomCss: (args) => {
|
|
542
|
-
(0, import_store4.__dispatch)(
|
|
543
|
-
slice.actions.updateProps({
|
|
544
|
-
id: args.id,
|
|
545
|
-
meta: args.meta,
|
|
546
|
-
custom_css: args.custom_css,
|
|
547
|
-
props: {}
|
|
548
|
-
})
|
|
549
|
-
);
|
|
550
|
-
},
|
|
551
|
-
tracking: (data) => {
|
|
552
|
-
trackGlobalClasses(data).catch((error) => {
|
|
553
|
-
throw new GlobalClassTrackingError({ cause: error });
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
var subscribeWithStates = (cb) => {
|
|
559
|
-
let previousState = selectData((0, import_store4.__getState)());
|
|
560
|
-
return (0, import_store4.__subscribeWithSelector)(
|
|
561
|
-
(state) => state.globalClasses,
|
|
562
|
-
(currentState) => {
|
|
563
|
-
cb(previousState.items, currentState.data.items);
|
|
564
|
-
previousState = currentState.data;
|
|
565
|
-
}
|
|
566
|
-
);
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
// src/mcp-integration/classes-resource.ts
|
|
570
|
-
var GLOBAL_CLASSES_URI = "elementor://global-classes";
|
|
571
|
-
var STORAGE_KEY = "elementor-global-classes";
|
|
572
|
-
var updateLocalStorageCache = () => {
|
|
573
|
-
const classes = globalClassesStylesProvider.actions.all();
|
|
574
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(classes));
|
|
575
|
-
};
|
|
576
|
-
var initClassesResource = (classesMcpEntry, canvasMcpEntry) => {
|
|
577
|
-
[canvasMcpEntry, classesMcpEntry].forEach((entry) => {
|
|
578
|
-
const { sendResourceUpdated, resource, waitForReady } = entry;
|
|
579
|
-
resource(
|
|
580
|
-
"global-classes",
|
|
581
|
-
GLOBAL_CLASSES_URI,
|
|
582
|
-
{
|
|
583
|
-
description: "Global classes list."
|
|
584
|
-
},
|
|
585
|
-
async () => {
|
|
586
|
-
return {
|
|
587
|
-
contents: [{ uri: GLOBAL_CLASSES_URI, text: localStorage[STORAGE_KEY] ?? "[]" }]
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
);
|
|
591
|
-
waitForReady().then(() => {
|
|
592
|
-
updateLocalStorageCache();
|
|
593
|
-
globalClassesStylesProvider.subscribe(() => {
|
|
594
|
-
updateLocalStorageCache();
|
|
595
|
-
sendResourceUpdated({ uri: GLOBAL_CLASSES_URI });
|
|
596
|
-
});
|
|
597
|
-
});
|
|
598
|
-
});
|
|
599
|
-
};
|
|
600
|
-
|
|
601
|
-
// src/init.ts
|
|
602
|
-
var import_editor = require("@elementor/editor");
|
|
603
|
-
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
604
|
-
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
605
|
-
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
606
|
-
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
607
|
-
var import_store28 = require("@elementor/store");
|
|
608
|
-
|
|
609
|
-
// src/components/class-manager/class-manager-button.tsx
|
|
610
|
-
var React20 = __toESM(require("react"));
|
|
611
|
-
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
612
|
-
var import_editor_styles_repository3 = require("@elementor/editor-styles-repository");
|
|
613
|
-
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
614
|
-
var import_ui17 = require("@elementor/ui");
|
|
615
|
-
var import_i18n16 = require("@wordpress/i18n");
|
|
616
|
-
|
|
617
|
-
// src/hooks/use-prefetch-css-class-usage.ts
|
|
618
|
-
var import_query = require("@elementor/query");
|
|
619
|
-
|
|
620
|
-
// src/components/css-class-usage/types.ts
|
|
621
|
-
var QUERY_KEY = "css-classes-usage";
|
|
622
|
-
|
|
623
|
-
// src/hooks/use-prefetch-css-class-usage.ts
|
|
624
|
-
function usePrefetchCssClassUsage() {
|
|
625
|
-
const queryClient = (0, import_query.useQueryClient)();
|
|
626
|
-
const prefetchClassesUsage = () => queryClient.prefetchQuery({
|
|
627
|
-
queryKey: [QUERY_KEY],
|
|
628
|
-
queryFn: fetchCssClassUsage
|
|
629
|
-
});
|
|
630
|
-
return { prefetchClassesUsage };
|
|
631
|
-
}
|
|
632
|
-
var PrefetchCssClassUsage = () => {
|
|
633
|
-
const { prefetchClassesUsage } = usePrefetchCssClassUsage();
|
|
634
|
-
prefetchClassesUsage();
|
|
635
|
-
return null;
|
|
636
|
-
};
|
|
637
|
-
|
|
638
|
-
// src/components/class-manager/class-manager-panel.tsx
|
|
639
|
-
var React19 = __toESM(require("react"));
|
|
640
|
-
var import_react10 = require("react");
|
|
641
|
-
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
642
|
-
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
643
|
-
var import_editor_panels = require("@elementor/editor-panels");
|
|
644
|
-
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
645
|
-
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
646
|
-
var import_icons11 = require("@elementor/icons");
|
|
647
|
-
var import_query3 = require("@elementor/query");
|
|
648
|
-
var import_store20 = require("@elementor/store");
|
|
649
|
-
var import_ui16 = require("@elementor/ui");
|
|
650
|
-
var import_i18n15 = require("@wordpress/i18n");
|
|
262
|
+
delete props[key];
|
|
263
|
+
} else {
|
|
264
|
+
props[key] = value;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
return props;
|
|
268
|
+
};
|
|
269
|
+
var getNonEmptyVariants = (style) => {
|
|
270
|
+
return style.variants.filter(
|
|
271
|
+
({ props, custom_css: customCss }) => Object.keys(props).length || customCss?.raw
|
|
272
|
+
);
|
|
273
|
+
};
|
|
274
|
+
var selectData = (state) => state[SLICE_NAME].data;
|
|
275
|
+
var selectFrontendInitialData = (state) => state[SLICE_NAME].initialData.frontend;
|
|
276
|
+
var selectPreviewInitialData = (state) => state[SLICE_NAME].initialData.preview;
|
|
277
|
+
var selectOrder = (0, import_store.__createSelector)(selectData, ({ order }) => order);
|
|
278
|
+
var selectGlobalClasses = (0, import_store.__createSelector)(selectData, ({ items }) => items);
|
|
279
|
+
var selectIsDirty = (state) => state[SLICE_NAME].isDirty;
|
|
280
|
+
var selectOrderedClasses = (0, import_store.__createSelector)(
|
|
281
|
+
selectGlobalClasses,
|
|
282
|
+
selectOrder,
|
|
283
|
+
(items, order) => order.map((id2) => items[id2])
|
|
284
|
+
);
|
|
285
|
+
var selectClass = (state, id2) => state[SLICE_NAME].data.items[id2] ?? null;
|
|
286
|
+
var selectEmptyCssClass = (0, import_store.__createSelector)(
|
|
287
|
+
selectData,
|
|
288
|
+
({ items }) => Object.values(items).filter((cssClass) => cssClass.variants.length === 0)
|
|
289
|
+
);
|
|
651
290
|
|
|
652
291
|
// src/hooks/use-classes-order.ts
|
|
653
|
-
var import_store6 = require("@elementor/store");
|
|
654
292
|
var useClassesOrder = () => {
|
|
655
|
-
return (0,
|
|
293
|
+
return (0, import_store2.__useSelector)(selectOrder);
|
|
656
294
|
};
|
|
657
295
|
|
|
658
296
|
// src/hooks/use-dirty-state.ts
|
|
659
|
-
var
|
|
297
|
+
var import_store4 = require("@elementor/store");
|
|
660
298
|
var useDirtyState = () => {
|
|
661
|
-
return (0,
|
|
299
|
+
return (0, import_store4.__useSelector)(selectIsDirty);
|
|
662
300
|
};
|
|
663
301
|
|
|
664
302
|
// src/hooks/use-filters.ts
|
|
@@ -667,7 +305,7 @@ var import_react3 = require("react");
|
|
|
667
305
|
// src/components/search-and-filter/context.tsx
|
|
668
306
|
var React = __toESM(require("react"));
|
|
669
307
|
var import_react = require("react");
|
|
670
|
-
var
|
|
308
|
+
var import_utils2 = require("@elementor/utils");
|
|
671
309
|
var SearchAndFilterContext = (0, import_react.createContext)(void 0);
|
|
672
310
|
var INIT_CHECKED_FILTERS = {
|
|
673
311
|
empty: false,
|
|
@@ -684,7 +322,7 @@ var SearchAndFilterProvider = ({ children }) => {
|
|
|
684
322
|
}
|
|
685
323
|
return "";
|
|
686
324
|
};
|
|
687
|
-
const { debouncedValue, inputValue, handleChange } = (0,
|
|
325
|
+
const { debouncedValue, inputValue, handleChange } = (0, import_utils2.useDebounceState)({
|
|
688
326
|
delay: 300,
|
|
689
327
|
initialValue: getInitialSearchValue()
|
|
690
328
|
});
|
|
@@ -727,9 +365,54 @@ var import_react2 = require("react");
|
|
|
727
365
|
var import_editor_documents = require("@elementor/editor-documents");
|
|
728
366
|
|
|
729
367
|
// src/hooks/use-css-class-usage.ts
|
|
730
|
-
var
|
|
368
|
+
var import_query = require("@elementor/query");
|
|
369
|
+
|
|
370
|
+
// src/api.ts
|
|
371
|
+
var import_http_client = require("@elementor/http-client");
|
|
372
|
+
var RESOURCE_URL = "/global-classes";
|
|
373
|
+
var BASE_URL = "elementor/v1";
|
|
374
|
+
var RESOURCE_USAGE_URL = `${RESOURCE_URL}/usage`;
|
|
375
|
+
var apiClient = {
|
|
376
|
+
usage: () => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_USAGE_URL}`),
|
|
377
|
+
all: (context2 = "preview") => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_URL}`, {
|
|
378
|
+
params: { context: context2 }
|
|
379
|
+
}),
|
|
380
|
+
publish: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
381
|
+
params: {
|
|
382
|
+
context: "frontend"
|
|
383
|
+
}
|
|
384
|
+
}),
|
|
385
|
+
saveDraft: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
386
|
+
params: {
|
|
387
|
+
context: "preview"
|
|
388
|
+
}
|
|
389
|
+
})
|
|
390
|
+
};
|
|
391
|
+
var API_ERROR_CODES = {
|
|
392
|
+
DUPLICATED_LABEL: "DUPLICATED_LABEL"
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
// src/components/css-class-usage/utils.ts
|
|
396
|
+
var transformData = (data) => Object.entries(data).reduce((acc, [key, value]) => {
|
|
397
|
+
acc[key] = {
|
|
398
|
+
content: value || [],
|
|
399
|
+
total: value.reduce((total, val) => total + (val?.total || 0), 0)
|
|
400
|
+
};
|
|
401
|
+
return acc;
|
|
402
|
+
}, {});
|
|
403
|
+
|
|
404
|
+
// service/css-class-usage-service.ts
|
|
405
|
+
var fetchCssClassUsage = async () => {
|
|
406
|
+
const response = await apiClient.usage();
|
|
407
|
+
return transformData(response?.data?.data || {});
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
// src/components/css-class-usage/types.ts
|
|
411
|
+
var QUERY_KEY = "css-classes-usage";
|
|
412
|
+
|
|
413
|
+
// src/hooks/use-css-class-usage.ts
|
|
731
414
|
var useCssClassUsage = () => {
|
|
732
|
-
return (0,
|
|
415
|
+
return (0, import_query.useQuery)({
|
|
733
416
|
queryKey: [QUERY_KEY],
|
|
734
417
|
queryFn: fetchCssClassUsage,
|
|
735
418
|
refetchOnMount: false,
|
|
@@ -738,12 +421,12 @@ var useCssClassUsage = () => {
|
|
|
738
421
|
};
|
|
739
422
|
|
|
740
423
|
// src/hooks/use-empty-css-class.ts
|
|
741
|
-
var
|
|
424
|
+
var import_store6 = require("@elementor/store");
|
|
742
425
|
var useEmptyCssClass = () => {
|
|
743
|
-
return (0,
|
|
426
|
+
return (0, import_store6.__useSelector)(selectEmptyCssClass);
|
|
744
427
|
};
|
|
745
428
|
var useAllCssClassesIDs = () => {
|
|
746
|
-
const cssClasses = (0,
|
|
429
|
+
const cssClasses = (0, import_store6.__useSelector)(selectGlobalClasses);
|
|
747
430
|
return Object.keys(cssClasses);
|
|
748
431
|
};
|
|
749
432
|
|
|
@@ -820,7 +503,7 @@ var useFilters = () => {
|
|
|
820
503
|
// src/save-global-classes.tsx
|
|
821
504
|
var React3 = __toESM(require("react"));
|
|
822
505
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
823
|
-
var
|
|
506
|
+
var import_store10 = require("@elementor/store");
|
|
824
507
|
var import_utils4 = require("@elementor/utils");
|
|
825
508
|
|
|
826
509
|
// src/components/class-manager/duplicate-label-dialog.tsx
|
|
@@ -828,7 +511,7 @@ var React2 = __toESM(require("react"));
|
|
|
828
511
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
829
512
|
var import_icons = require("@elementor/icons");
|
|
830
513
|
var import_ui = require("@elementor/ui");
|
|
831
|
-
var
|
|
514
|
+
var import_i18n = require("@wordpress/i18n");
|
|
832
515
|
var DUP_PREFIX = "DUP_";
|
|
833
516
|
var DuplicateLabelDialog = ({
|
|
834
517
|
modifiedLabels,
|
|
@@ -839,7 +522,7 @@ var DuplicateLabelDialog = ({
|
|
|
839
522
|
onApprove?.();
|
|
840
523
|
(0, import_editor_ui.closeDialog)();
|
|
841
524
|
};
|
|
842
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(import_ui.DialogHeader, { logo: false }, /* @__PURE__ */ React2.createElement(import_ui.Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React2.createElement(import_ui.Icon, { color: "secondary" }, /* @__PURE__ */ React2.createElement(import_icons.InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React2.createElement(import_ui.Typography, { variant: "subtitle1" }, (0,
|
|
525
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(import_ui.DialogHeader, { logo: false }, /* @__PURE__ */ React2.createElement(import_ui.Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React2.createElement(import_ui.Icon, { color: "secondary" }, /* @__PURE__ */ React2.createElement(import_icons.InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React2.createElement(import_ui.Typography, { variant: "subtitle1" }, (0, import_i18n.__)("We've published your page and updated class names.", "elementor")))), /* @__PURE__ */ React2.createElement(import_ui.DialogContent, null, /* @__PURE__ */ React2.createElement(import_ui.Stack, { spacing: 2, direction: "column" }, /* @__PURE__ */ React2.createElement(import_ui.Typography, { variant: "body2" }, (0, import_i18n.__)(
|
|
843
526
|
"Some new classes used the same names as existing ones. To prevent conflicts, we added the prefix",
|
|
844
527
|
"elementor"
|
|
845
528
|
), /* @__PURE__ */ React2.createElement("strong", null, " ", DUP_PREFIX)), /* @__PURE__ */ React2.createElement(import_ui.Box, null, /* @__PURE__ */ React2.createElement(
|
|
@@ -864,7 +547,7 @@ var DuplicateLabelDialog = ({
|
|
|
864
547
|
minWidth: 0
|
|
865
548
|
}
|
|
866
549
|
},
|
|
867
|
-
(0,
|
|
550
|
+
(0, import_i18n.__)("Before", "elementor")
|
|
868
551
|
),
|
|
869
552
|
/* @__PURE__ */ React2.createElement(
|
|
870
553
|
import_ui.Typography,
|
|
@@ -879,7 +562,7 @@ var DuplicateLabelDialog = ({
|
|
|
879
562
|
maxWidth: "200px"
|
|
880
563
|
}
|
|
881
564
|
},
|
|
882
|
-
(0,
|
|
565
|
+
(0, import_i18n.__)("After", "elementor")
|
|
883
566
|
)
|
|
884
567
|
), /* @__PURE__ */ React2.createElement(import_ui.Divider, { sx: { mt: 0.5, mb: 0.5 } }), /* @__PURE__ */ React2.createElement(import_ui.Stack, { direction: "column", gap: 0.5, sx: { pb: 2 } }, Object.values(modifiedLabels).map(({ original, modified }, index) => /* @__PURE__ */ React2.createElement(
|
|
885
568
|
import_ui.Box,
|
|
@@ -917,26 +600,170 @@ var DuplicateLabelDialog = ({
|
|
|
917
600
|
},
|
|
918
601
|
/* @__PURE__ */ React2.createElement(import_editor_ui.EllipsisWithTooltip, { title: modified }, /* @__PURE__ */ React2.createElement(import_ui.Typography, { variant: "body2", sx: { color: "text.primary" } }, modified))
|
|
919
602
|
)
|
|
920
|
-
))), /* @__PURE__ */ React2.createElement(import_ui.Box, null, /* @__PURE__ */ React2.createElement(import_ui.Alert, { severity: "info", size: "small", color: "secondary" }, /* @__PURE__ */ React2.createElement("strong", null, (0,
|
|
603
|
+
))), /* @__PURE__ */ React2.createElement(import_ui.Box, null, /* @__PURE__ */ React2.createElement(import_ui.Alert, { severity: "info", size: "small", color: "secondary" }, /* @__PURE__ */ React2.createElement("strong", null, (0, import_i18n.__)("Your designs and classes are safe.", "elementor")), (0, import_i18n.__)(
|
|
921
604
|
"Only the prefixes were added. Find them in Class Manager by searching",
|
|
922
605
|
"elementor"
|
|
923
|
-
), /* @__PURE__ */ React2.createElement("strong", null, DUP_PREFIX)))))), /* @__PURE__ */ React2.createElement(import_ui.DialogActions, null, /* @__PURE__ */ React2.createElement(import_ui.Button, { color: "secondary", variant: "text", onClick: handleButtonClick }, (0,
|
|
606
|
+
), /* @__PURE__ */ React2.createElement("strong", null, DUP_PREFIX)))))), /* @__PURE__ */ React2.createElement(import_ui.DialogActions, null, /* @__PURE__ */ React2.createElement(import_ui.Button, { color: "secondary", variant: "text", onClick: handleButtonClick }, (0, import_i18n.__)("Go to Class Manager", "elementor")), /* @__PURE__ */ React2.createElement(import_ui.Button, { color: "secondary", variant: "contained", onClick: import_editor_ui.closeDialog }, (0, import_i18n.__)("Done", "elementor"))));
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// src/utils/tracking.ts
|
|
610
|
+
var import_events = require("@elementor/events");
|
|
611
|
+
var import_store8 = require("@elementor/store");
|
|
612
|
+
var trackGlobalClasses = async (payload) => {
|
|
613
|
+
const { runAction } = payload;
|
|
614
|
+
const data = await getSanitizedData(payload);
|
|
615
|
+
if (data) {
|
|
616
|
+
track(data);
|
|
617
|
+
if (data.event === "classCreated" && "classId" in data) {
|
|
618
|
+
fireClassApplied(data.classId);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
runAction?.();
|
|
622
|
+
};
|
|
623
|
+
var fireClassApplied = async (classId) => {
|
|
624
|
+
const appliedInfo = await getAppliedInfo(classId);
|
|
625
|
+
track({
|
|
626
|
+
event: "classApplied",
|
|
627
|
+
classId,
|
|
628
|
+
...appliedInfo,
|
|
629
|
+
totalInstancesAfterApply: 1
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
var getSanitizedData = async (payload) => {
|
|
633
|
+
switch (payload.event) {
|
|
634
|
+
case "classApplied":
|
|
635
|
+
if ("classId" in payload && payload.classId) {
|
|
636
|
+
const appliedInfo = await getAppliedInfo(payload.classId);
|
|
637
|
+
return { ...payload, ...appliedInfo };
|
|
638
|
+
}
|
|
639
|
+
break;
|
|
640
|
+
case "classRemoved":
|
|
641
|
+
if ("classId" in payload && payload.classId) {
|
|
642
|
+
const deleteInfo = getRemovedInfo(payload.classId);
|
|
643
|
+
return { ...payload, ...deleteInfo };
|
|
644
|
+
}
|
|
645
|
+
break;
|
|
646
|
+
case "classDeleted":
|
|
647
|
+
if ("classId" in payload && payload.classId) {
|
|
648
|
+
const deleteInfo = await trackDeleteClass(payload.classId);
|
|
649
|
+
return { ...payload, ...deleteInfo };
|
|
650
|
+
}
|
|
651
|
+
break;
|
|
652
|
+
case "classCreated":
|
|
653
|
+
if ("source" in payload && payload.source !== "created") {
|
|
654
|
+
if ("classId" in payload && payload.classId) {
|
|
655
|
+
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
return payload;
|
|
659
|
+
case "classStateClicked":
|
|
660
|
+
if ("classId" in payload && payload.classId) {
|
|
661
|
+
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
662
|
+
}
|
|
663
|
+
break;
|
|
664
|
+
case "classSyncToV3PopupShown":
|
|
665
|
+
return {
|
|
666
|
+
...payload,
|
|
667
|
+
interaction_type: "popup_shown",
|
|
668
|
+
target_type: "popup",
|
|
669
|
+
target_name: "sync_to_v3_popup",
|
|
670
|
+
interaction_result: "popup_viewed",
|
|
671
|
+
target_location: "widget_panel",
|
|
672
|
+
location_l1: "class_manager"
|
|
673
|
+
};
|
|
674
|
+
case "classSyncToV3": {
|
|
675
|
+
const classLabel = getCssClass(payload.classId).label;
|
|
676
|
+
const isSync = payload.action === "sync";
|
|
677
|
+
return {
|
|
678
|
+
...payload,
|
|
679
|
+
interaction_type: "click",
|
|
680
|
+
target_type: classLabel,
|
|
681
|
+
target_name: isSync ? "sync_to_v3" : "unsync_to_v3",
|
|
682
|
+
interaction_result: isSync ? "class_is_synced_to_V3" : "class_is_unsynced_from_V3",
|
|
683
|
+
target_location: "widget_panel",
|
|
684
|
+
location_l1: "class_manager",
|
|
685
|
+
interaction_description: isSync ? `user_synced_${classLabel}_to_v3` : `user_unsync_${classLabel}_from_v3`
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
case "classSyncToV3PopupClick": {
|
|
689
|
+
const isSyncAction = payload.action === "sync";
|
|
690
|
+
return {
|
|
691
|
+
...payload,
|
|
692
|
+
interaction_type: "click",
|
|
693
|
+
target_type: "button",
|
|
694
|
+
target_name: isSyncAction ? "sync_to_v3" : "cancel",
|
|
695
|
+
interaction_result: isSyncAction ? "class_is_synced" : "cancel",
|
|
696
|
+
target_location: "sync_to_v3_popup"
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
default:
|
|
700
|
+
return payload;
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
var track = (data) => {
|
|
704
|
+
const { dispatchEvent, config } = (0, import_events.getMixpanel)();
|
|
705
|
+
if (!config?.names?.global_classes?.[data.event]) {
|
|
706
|
+
console.error("Global class tracking event not found", { event: data.event });
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
const name = config.names.global_classes[data.event];
|
|
710
|
+
const { event, ...eventData } = data;
|
|
711
|
+
try {
|
|
712
|
+
dispatchEvent?.(name, {
|
|
713
|
+
event,
|
|
714
|
+
...eventData
|
|
715
|
+
});
|
|
716
|
+
} catch (error) {
|
|
717
|
+
throw new GlobalClassTrackingError({ cause: error });
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
var extractCssClassData = (classId) => {
|
|
721
|
+
const cssClass = getCssClass(classId);
|
|
722
|
+
const classTitle = cssClass.label;
|
|
723
|
+
return { classTitle };
|
|
724
|
+
};
|
|
725
|
+
var getCssClass = (classId) => {
|
|
726
|
+
const cssClass = selectClass((0, import_store8.__getState)(), classId);
|
|
727
|
+
if (!cssClass) {
|
|
728
|
+
throw new Error(`CSS class with ID ${classId} not found`);
|
|
729
|
+
}
|
|
730
|
+
return cssClass;
|
|
731
|
+
};
|
|
732
|
+
var trackDeleteClass = async (classId) => {
|
|
733
|
+
const totalInstances = await getTotalInstancesByCssClassID(classId);
|
|
734
|
+
const classTitle = getCssClass(classId).label;
|
|
735
|
+
return { totalInstances, classTitle };
|
|
736
|
+
};
|
|
737
|
+
var getTotalInstancesByCssClassID = async (classId) => {
|
|
738
|
+
const cssClassUsage = await fetchCssClassUsage();
|
|
739
|
+
return cssClassUsage[classId]?.total ?? 1;
|
|
740
|
+
};
|
|
741
|
+
var getAppliedInfo = async (classId) => {
|
|
742
|
+
const { classTitle } = extractCssClassData(classId);
|
|
743
|
+
const totalInstancesAfterApply = await getTotalInstancesByCssClassID(classId) + 1;
|
|
744
|
+
return { classTitle, totalInstancesAfterApply };
|
|
745
|
+
};
|
|
746
|
+
var getRemovedInfo = (classId) => {
|
|
747
|
+
const { classTitle } = extractCssClassData(classId);
|
|
748
|
+
return {
|
|
749
|
+
classTitle
|
|
750
|
+
};
|
|
924
751
|
};
|
|
925
752
|
|
|
926
753
|
// src/save-global-classes.tsx
|
|
927
754
|
async function saveGlobalClasses({ context: context2, onApprove }) {
|
|
928
|
-
const state = selectData((0,
|
|
755
|
+
const state = selectData((0, import_store10.__getState)());
|
|
929
756
|
const apiAction = context2 === "preview" ? apiClient.saveDraft : apiClient.publish;
|
|
930
757
|
const currentContext = context2 === "preview" ? selectPreviewInitialData : selectFrontendInitialData;
|
|
931
758
|
const response = await apiAction({
|
|
932
759
|
items: state.items,
|
|
933
760
|
order: state.order,
|
|
934
|
-
changes: calculateChanges(state, currentContext((0,
|
|
761
|
+
changes: calculateChanges(state, currentContext((0, import_store10.__getState)()))
|
|
935
762
|
});
|
|
936
|
-
(0,
|
|
763
|
+
(0, import_store10.__dispatch)(slice.actions.reset({ context: context2 }));
|
|
937
764
|
window.dispatchEvent(new CustomEvent("classes:updated", { detail: { context: context2 } }));
|
|
938
765
|
if (response?.data?.data?.code === API_ERROR_CODES.DUPLICATED_LABEL) {
|
|
939
|
-
(0,
|
|
766
|
+
(0, import_store10.__dispatch)(slice.actions.updateMultiple(response.data.data.modifiedLabels));
|
|
940
767
|
trackGlobalClasses({
|
|
941
768
|
event: "classPublishConflict",
|
|
942
769
|
numOfConflicts: Object.keys(response.data.data.modifiedLabels).length
|
|
@@ -967,7 +794,7 @@ function calculateChanges(state, initialData) {
|
|
|
967
794
|
// src/components/search-and-filter/components/filter/active-filters.tsx
|
|
968
795
|
var React6 = __toESM(require("react"));
|
|
969
796
|
var import_ui4 = require("@elementor/ui");
|
|
970
|
-
var
|
|
797
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
971
798
|
|
|
972
799
|
// src/components/search-and-filter/components/filter/clear-icon-button.tsx
|
|
973
800
|
var React4 = __toESM(require("react"));
|
|
@@ -998,11 +825,11 @@ var CustomIconButton = (0, import_ui2.styled)(import_ui2.IconButton)(({ theme })
|
|
|
998
825
|
// src/components/search-and-filter/components/filter/filter-list.tsx
|
|
999
826
|
var React5 = __toESM(require("react"));
|
|
1000
827
|
var import_ui3 = require("@elementor/ui");
|
|
1001
|
-
var
|
|
828
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
1002
829
|
var filterConfig = {
|
|
1003
|
-
unused: (0,
|
|
1004
|
-
empty: (0,
|
|
1005
|
-
onThisPage: (0,
|
|
830
|
+
unused: (0, import_i18n2.__)("Unused", "elementor"),
|
|
831
|
+
empty: (0, import_i18n2.__)("Empty", "elementor"),
|
|
832
|
+
onThisPage: (0, import_i18n2.__)("On this page", "elementor")
|
|
1006
833
|
};
|
|
1007
834
|
var FilterList = () => {
|
|
1008
835
|
const {
|
|
@@ -1085,7 +912,7 @@ var ActiveFilters = () => {
|
|
|
1085
912
|
ClearIconButton,
|
|
1086
913
|
{
|
|
1087
914
|
trigger: "header",
|
|
1088
|
-
tooltipText: (0,
|
|
915
|
+
tooltipText: (0, import_i18n3.__)("Clear Filters", "elementor"),
|
|
1089
916
|
sx: { margin: "0 0 auto auto" }
|
|
1090
917
|
}
|
|
1091
918
|
));
|
|
@@ -1106,7 +933,7 @@ var import_react4 = require("react");
|
|
|
1106
933
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1107
934
|
var import_icons3 = require("@elementor/icons");
|
|
1108
935
|
var import_ui5 = require("@elementor/ui");
|
|
1109
|
-
var
|
|
936
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
1110
937
|
var CssClassFilter = () => {
|
|
1111
938
|
const {
|
|
1112
939
|
filters: { filters }
|
|
@@ -1123,7 +950,7 @@ var CssClassFilter = () => {
|
|
|
1123
950
|
}
|
|
1124
951
|
}, [popupState.isOpen]);
|
|
1125
952
|
const showCleanIcon = Object.values(filters).some((value) => value);
|
|
1126
|
-
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui5.Tooltip, { title: (0,
|
|
953
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui5.Tooltip, { title: (0, import_i18n4.__)("Filters", "elementor"), placement: "top" }, /* @__PURE__ */ React7.createElement(
|
|
1127
954
|
import_ui5.ToggleButton,
|
|
1128
955
|
{
|
|
1129
956
|
value: "filter",
|
|
@@ -1157,12 +984,12 @@ var CssClassFilter = () => {
|
|
|
1157
984
|
{
|
|
1158
985
|
trigger: "menu",
|
|
1159
986
|
key: "clear-all-button",
|
|
1160
|
-
tooltipText: (0,
|
|
987
|
+
tooltipText: (0, import_i18n4.__)("Clear all", "elementor")
|
|
1161
988
|
}
|
|
1162
989
|
)
|
|
1163
990
|
] : [],
|
|
1164
991
|
onClose: popupState.close,
|
|
1165
|
-
title: (0,
|
|
992
|
+
title: (0, import_i18n4.__)("Filters", "elementor"),
|
|
1166
993
|
icon: /* @__PURE__ */ React7.createElement(import_icons3.FilterIcon, { fontSize: "tiny" })
|
|
1167
994
|
}
|
|
1168
995
|
),
|
|
@@ -1182,7 +1009,7 @@ var CssClassFilter = () => {
|
|
|
1182
1009
|
var React8 = __toESM(require("react"));
|
|
1183
1010
|
var import_icons4 = require("@elementor/icons");
|
|
1184
1011
|
var import_ui6 = require("@elementor/ui");
|
|
1185
|
-
var
|
|
1012
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
1186
1013
|
var ClassManagerSearch = () => {
|
|
1187
1014
|
const {
|
|
1188
1015
|
search: { inputValue, handleChange }
|
|
@@ -1199,7 +1026,7 @@ var ClassManagerSearch = () => {
|
|
|
1199
1026
|
event: "classManagerSearched"
|
|
1200
1027
|
});
|
|
1201
1028
|
},
|
|
1202
|
-
placeholder: (0,
|
|
1029
|
+
placeholder: (0, import_i18n5.__)("Search", "elementor"),
|
|
1203
1030
|
onChange: (e) => handleChange(e.target.value),
|
|
1204
1031
|
InputProps: {
|
|
1205
1032
|
startAdornment: /* @__PURE__ */ React8.createElement(import_ui6.InputAdornment, { position: "start" }, /* @__PURE__ */ React8.createElement(import_icons4.SearchIcon, { fontSize: "tiny" }))
|
|
@@ -1214,7 +1041,7 @@ var import_react5 = require("react");
|
|
|
1214
1041
|
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
1215
1042
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1216
1043
|
var import_ui7 = require("@elementor/ui");
|
|
1217
|
-
var
|
|
1044
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
1218
1045
|
var MESSAGE_KEY = "global-class-manager";
|
|
1219
1046
|
var ClassManagerIntroduction = () => {
|
|
1220
1047
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user.useSuppressedMessage)(MESSAGE_KEY);
|
|
@@ -1223,7 +1050,7 @@ var ClassManagerIntroduction = () => {
|
|
|
1223
1050
|
import_editor_ui4.IntroductionModal,
|
|
1224
1051
|
{
|
|
1225
1052
|
open: shouldShowIntroduction,
|
|
1226
|
-
title: (0,
|
|
1053
|
+
title: (0, import_i18n6.__)("Class Manager", "elementor"),
|
|
1227
1054
|
handleClose: (shouldShowAgain) => {
|
|
1228
1055
|
if (!shouldShowAgain) {
|
|
1229
1056
|
suppressMessage();
|
|
@@ -1243,24 +1070,24 @@ var ClassManagerIntroduction = () => {
|
|
|
1243
1070
|
);
|
|
1244
1071
|
};
|
|
1245
1072
|
var IntroductionContent = () => {
|
|
1246
|
-
return /* @__PURE__ */ React9.createElement(import_ui7.Box, { p: 3 }, /* @__PURE__ */ React9.createElement(import_ui7.Typography, { variant: "body2" }, (0,
|
|
1073
|
+
return /* @__PURE__ */ React9.createElement(import_ui7.Box, { p: 3 }, /* @__PURE__ */ React9.createElement(import_ui7.Typography, { variant: "body2" }, (0, import_i18n6.__)(
|
|
1247
1074
|
"The Class Manager lets you see all the classes you've created, plus adjust their priority, rename them, and delete unused classes to keep your CSS structured.",
|
|
1248
1075
|
"elementor"
|
|
1249
|
-
)), /* @__PURE__ */ React9.createElement("br", null), /* @__PURE__ */ React9.createElement(import_ui7.Typography, { variant: "body2" }, (0,
|
|
1076
|
+
)), /* @__PURE__ */ React9.createElement("br", null), /* @__PURE__ */ React9.createElement(import_ui7.Typography, { variant: "body2" }, (0, import_i18n6.__)(
|
|
1250
1077
|
"Remember, when editing an item within a specific class, any changes you make will apply across all elements in that class.",
|
|
1251
1078
|
"elementor"
|
|
1252
1079
|
)));
|
|
1253
1080
|
};
|
|
1254
1081
|
|
|
1255
1082
|
// src/components/class-manager/delete-class.ts
|
|
1256
|
-
var
|
|
1083
|
+
var import_store12 = require("@elementor/store");
|
|
1257
1084
|
var isDeleted = false;
|
|
1258
1085
|
var deleteClass = (id2) => {
|
|
1259
1086
|
trackGlobalClasses({
|
|
1260
1087
|
event: "classDeleted",
|
|
1261
1088
|
classId: id2,
|
|
1262
1089
|
runAction: () => {
|
|
1263
|
-
(0,
|
|
1090
|
+
(0, import_store12.__dispatch)(slice.actions.delete(id2));
|
|
1264
1091
|
isDeleted = true;
|
|
1265
1092
|
}
|
|
1266
1093
|
});
|
|
@@ -1278,25 +1105,25 @@ var FlippedColorSwatchIcon = ({ sx, ...props }) => /* @__PURE__ */ React10.creat
|
|
|
1278
1105
|
// src/components/class-manager/global-classes-list.tsx
|
|
1279
1106
|
var React17 = __toESM(require("react"));
|
|
1280
1107
|
var import_react8 = require("react");
|
|
1281
|
-
var
|
|
1108
|
+
var import_store16 = require("@elementor/store");
|
|
1282
1109
|
var import_ui14 = require("@elementor/ui");
|
|
1283
1110
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
1284
|
-
var
|
|
1111
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
1285
1112
|
|
|
1286
1113
|
// src/hooks/use-ordered-classes.ts
|
|
1287
|
-
var
|
|
1114
|
+
var import_store14 = require("@elementor/store");
|
|
1288
1115
|
var useOrderedClasses = () => {
|
|
1289
|
-
return (0,
|
|
1116
|
+
return (0, import_store14.__useSelector)(selectOrderedClasses);
|
|
1290
1117
|
};
|
|
1291
1118
|
|
|
1292
1119
|
// src/components/class-manager/class-item.tsx
|
|
1293
1120
|
var React15 = __toESM(require("react"));
|
|
1294
1121
|
var import_react7 = require("react");
|
|
1295
|
-
var
|
|
1122
|
+
var import_editor_styles_repository = require("@elementor/editor-styles-repository");
|
|
1296
1123
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
1297
1124
|
var import_icons9 = require("@elementor/icons");
|
|
1298
1125
|
var import_ui12 = require("@elementor/ui");
|
|
1299
|
-
var
|
|
1126
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1300
1127
|
|
|
1301
1128
|
// src/components/css-class-usage/components/css-class-usage-popover.tsx
|
|
1302
1129
|
var React11 = __toESM(require("react"));
|
|
@@ -1304,7 +1131,7 @@ var import_editor_documents2 = require("@elementor/editor-documents");
|
|
|
1304
1131
|
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1305
1132
|
var import_icons6 = require("@elementor/icons");
|
|
1306
1133
|
var import_ui8 = require("@elementor/ui");
|
|
1307
|
-
var
|
|
1134
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
1308
1135
|
|
|
1309
1136
|
// src/hooks/use-css-class-usage-by-id.ts
|
|
1310
1137
|
var EMPTY_CLASS_USAGE = {
|
|
@@ -1320,23 +1147,23 @@ var useCssClassUsageByID = (id2) => {
|
|
|
1320
1147
|
// src/components/css-class-usage/components/css-class-usage-popover.tsx
|
|
1321
1148
|
var iconMapper = {
|
|
1322
1149
|
"wp-post": {
|
|
1323
|
-
label: (0,
|
|
1150
|
+
label: (0, import_i18n7.__)("Post", "elementor"),
|
|
1324
1151
|
icon: /* @__PURE__ */ React11.createElement(import_icons6.PostTypeIcon, { fontSize: "inherit" })
|
|
1325
1152
|
},
|
|
1326
1153
|
"wp-page": {
|
|
1327
|
-
label: (0,
|
|
1154
|
+
label: (0, import_i18n7.__)("Page", "elementor"),
|
|
1328
1155
|
icon: /* @__PURE__ */ React11.createElement(import_icons6.PagesIcon, { fontSize: "inherit" })
|
|
1329
1156
|
},
|
|
1330
1157
|
popup: {
|
|
1331
|
-
label: (0,
|
|
1158
|
+
label: (0, import_i18n7.__)("Popup", "elementor"),
|
|
1332
1159
|
icon: /* @__PURE__ */ React11.createElement(import_icons6.PopupTemplateIcon, { fontSize: "inherit" })
|
|
1333
1160
|
},
|
|
1334
1161
|
header: {
|
|
1335
|
-
label: (0,
|
|
1162
|
+
label: (0, import_i18n7.__)("Header", "elementor"),
|
|
1336
1163
|
icon: /* @__PURE__ */ React11.createElement(import_icons6.HeaderTemplateIcon, { fontSize: "inherit" })
|
|
1337
1164
|
},
|
|
1338
1165
|
footer: {
|
|
1339
|
-
label: (0,
|
|
1166
|
+
label: (0, import_i18n7.__)("Footer", "elementor"),
|
|
1340
1167
|
icon: /* @__PURE__ */ React11.createElement(import_icons6.FooterTemplateIcon, { fontSize: "inherit" })
|
|
1341
1168
|
}
|
|
1342
1169
|
};
|
|
@@ -1366,7 +1193,7 @@ var CssClassUsagePopover = ({
|
|
|
1366
1193
|
import_editor_ui5.PopoverHeader,
|
|
1367
1194
|
{
|
|
1368
1195
|
icon: /* @__PURE__ */ React11.createElement(import_icons6.CurrentLocationIcon, { fontSize: "tiny" }),
|
|
1369
|
-
title: /* @__PURE__ */ React11.createElement(import_ui8.Stack, { flexDirection: "row", gap: 1, alignItems: "center" }, /* @__PURE__ */ React11.createElement(import_ui8.Box, { "aria-label": "header-title" }, (0,
|
|
1196
|
+
title: /* @__PURE__ */ React11.createElement(import_ui8.Stack, { flexDirection: "row", gap: 1, alignItems: "center" }, /* @__PURE__ */ React11.createElement(import_ui8.Box, { "aria-label": "header-title" }, (0, import_i18n7.__)("Locator", "elementor")), /* @__PURE__ */ React11.createElement(import_ui8.Box, null, /* @__PURE__ */ React11.createElement(import_ui8.Chip, { sx: { lineHeight: 1 }, size: "tiny", label: classUsage.total }))),
|
|
1370
1197
|
onClose
|
|
1371
1198
|
}
|
|
1372
1199
|
), /* @__PURE__ */ React11.createElement(import_ui8.Divider, null), /* @__PURE__ */ React11.createElement(import_editor_ui5.PopoverBody, { width: 300 }, /* @__PURE__ */ React11.createElement(
|
|
@@ -1447,7 +1274,7 @@ var React12 = __toESM(require("react"));
|
|
|
1447
1274
|
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1448
1275
|
var import_icons7 = require("@elementor/icons");
|
|
1449
1276
|
var import_ui9 = require("@elementor/ui");
|
|
1450
|
-
var
|
|
1277
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1451
1278
|
var CssClassUsageTrigger = ({ id: id2, onClick }) => {
|
|
1452
1279
|
const {
|
|
1453
1280
|
data: { total },
|
|
@@ -1528,9 +1355,9 @@ var TooltipWrapper = ({ children, total }) => /* @__PURE__ */ React12.createElem
|
|
|
1528
1355
|
{
|
|
1529
1356
|
disableInteractive: true,
|
|
1530
1357
|
placement: "top",
|
|
1531
|
-
title: `${(0,
|
|
1358
|
+
title: `${(0, import_i18n8.__)("Show {{number}} {{locations}}", "elementor").replace("{{number}}", total.toString()).replace(
|
|
1532
1359
|
"{{locations}}",
|
|
1533
|
-
total === 1 ? (0,
|
|
1360
|
+
total === 1 ? (0, import_i18n8.__)("location", "elementor") : (0, import_i18n8.__)("locations", "elementor")
|
|
1534
1361
|
)}`
|
|
1535
1362
|
},
|
|
1536
1363
|
/* @__PURE__ */ React12.createElement("span", null, children)
|
|
@@ -1541,7 +1368,7 @@ var InfoAlertMessage = ({ children }) => /* @__PURE__ */ React12.createElement(
|
|
|
1541
1368
|
disableInteractive: true,
|
|
1542
1369
|
placement: "top",
|
|
1543
1370
|
color: "secondary",
|
|
1544
|
-
content: /* @__PURE__ */ React12.createElement(import_editor_ui6.InfoAlert, { sx: { mt: 1 } }, (0,
|
|
1371
|
+
content: /* @__PURE__ */ React12.createElement(import_editor_ui6.InfoAlert, { sx: { mt: 1 } }, (0, import_i18n8.__)("This class isn\u2019t being used yet.", "elementor"))
|
|
1545
1372
|
},
|
|
1546
1373
|
/* @__PURE__ */ React12.createElement("span", null, children)
|
|
1547
1374
|
);
|
|
@@ -1551,7 +1378,7 @@ var React13 = __toESM(require("react"));
|
|
|
1551
1378
|
var import_react6 = require("react");
|
|
1552
1379
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
1553
1380
|
var import_ui10 = require("@elementor/ui");
|
|
1554
|
-
var
|
|
1381
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
1555
1382
|
var context = (0, import_react6.createContext)(null);
|
|
1556
1383
|
var DeleteConfirmationProvider = ({ children }) => {
|
|
1557
1384
|
const [dialogProps, setDialogProps] = (0, import_react6.useState)(null);
|
|
@@ -1572,14 +1399,14 @@ var DeleteClassDialog = ({ label, id: id2 }) => {
|
|
|
1572
1399
|
closeDialog2();
|
|
1573
1400
|
deleteClass(id2);
|
|
1574
1401
|
};
|
|
1575
|
-
const text = total && content.length ? (0,
|
|
1402
|
+
const text = total && content.length ? (0, import_i18n9.__)(
|
|
1576
1403
|
"Will permanently remove it from your project and may affect the design across all elements using it. Used %1 times across %2 pages. This action cannot be undone.",
|
|
1577
1404
|
"elementor"
|
|
1578
|
-
).replace("%1", total.toString()).replace("%2", content.length.toString()) : (0,
|
|
1405
|
+
).replace("%1", total.toString()).replace("%2", content.length.toString()) : (0, import_i18n9.__)(
|
|
1579
1406
|
"Will permanently remove it from your project and may affect the design across all elements using it. This action cannot be undone.",
|
|
1580
1407
|
"elementor"
|
|
1581
1408
|
);
|
|
1582
|
-
return /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog, { open: true, onClose: closeDialog2 }, /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.Title, null, (0,
|
|
1409
|
+
return /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog, { open: true, onClose: closeDialog2 }, /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.Title, null, (0, import_i18n9.__)("Delete this class?", "elementor")), /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.Content, null, /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.ContentText, null, (0, import_i18n9.__)("Deleting", "elementor"), /* @__PURE__ */ React13.createElement(import_ui10.Typography, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), text)), /* @__PURE__ */ React13.createElement(import_editor_ui7.ConfirmationDialog.Actions, { onClose: closeDialog2, onConfirm: handleConfirm }));
|
|
1583
1410
|
};
|
|
1584
1411
|
var useDeleteConfirmation = () => {
|
|
1585
1412
|
const contextValue = (0, import_react6.useContext)(context);
|
|
@@ -1728,7 +1555,7 @@ var ClassItem = ({
|
|
|
1728
1555
|
{
|
|
1729
1556
|
placement: "top",
|
|
1730
1557
|
className: "class-item-more-actions",
|
|
1731
|
-
title: (0,
|
|
1558
|
+
title: (0, import_i18n10.__)("More actions", "elementor")
|
|
1732
1559
|
},
|
|
1733
1560
|
/* @__PURE__ */ React15.createElement(import_ui12.IconButton, { size: "tiny", ...(0, import_ui12.bindTrigger)(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React15.createElement(import_icons9.DotsVerticalIcon, { fontSize: "tiny" }))
|
|
1734
1561
|
)
|
|
@@ -1755,7 +1582,7 @@ var ClassItem = ({
|
|
|
1755
1582
|
openEditMode();
|
|
1756
1583
|
}
|
|
1757
1584
|
},
|
|
1758
|
-
/* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0,
|
|
1585
|
+
/* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0, import_i18n10.__)("Rename", "elementor"))
|
|
1759
1586
|
),
|
|
1760
1587
|
onToggleSync && /* @__PURE__ */ React15.createElement(
|
|
1761
1588
|
import_editor_ui8.MenuListItem,
|
|
@@ -1765,7 +1592,7 @@ var ClassItem = ({
|
|
|
1765
1592
|
onToggleSync(id2, !syncToV3);
|
|
1766
1593
|
}
|
|
1767
1594
|
},
|
|
1768
|
-
/* @__PURE__ */ React15.createElement(import_ui12.Stack, { direction: "row", alignItems: "center", gap: 1 }, syncToV3 ? /* @__PURE__ */ React15.createElement(import_icons9.RefreshOffIcon, { fontSize: "tiny" }) : /* @__PURE__ */ React15.createElement(import_icons9.RefreshIcon, { fontSize: "tiny" }), /* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "text.primary" } }, syncToV3 ? (0,
|
|
1595
|
+
/* @__PURE__ */ React15.createElement(import_ui12.Stack, { direction: "row", alignItems: "center", gap: 1 }, syncToV3 ? /* @__PURE__ */ React15.createElement(import_icons9.RefreshOffIcon, { fontSize: "tiny" }) : /* @__PURE__ */ React15.createElement(import_icons9.RefreshIcon, { fontSize: "tiny" }), /* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "text.primary" } }, syncToV3 ? (0, import_i18n10.__)("Stop syncing to Global Fonts", "elementor") : (0, import_i18n10.__)("Sync to Global Fonts", "elementor")))
|
|
1769
1596
|
),
|
|
1770
1597
|
/* @__PURE__ */ React15.createElement(
|
|
1771
1598
|
import_editor_ui8.MenuListItem,
|
|
@@ -1775,7 +1602,7 @@ var ClassItem = ({
|
|
|
1775
1602
|
openDialog2({ id: id2, label });
|
|
1776
1603
|
}
|
|
1777
1604
|
},
|
|
1778
|
-
/* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "error.light" } }, (0,
|
|
1605
|
+
/* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "error.light" } }, (0, import_i18n10.__)("Delete", "elementor"))
|
|
1779
1606
|
)
|
|
1780
1607
|
));
|
|
1781
1608
|
};
|
|
@@ -1830,7 +1657,7 @@ var getIndicatorBorder = ({ isActive, isError, theme }) => {
|
|
|
1830
1657
|
return "none";
|
|
1831
1658
|
};
|
|
1832
1659
|
var validateLabel = (newLabel) => {
|
|
1833
|
-
const result = (0,
|
|
1660
|
+
const result = (0, import_editor_styles_repository.validateStyleLabel)(newLabel, "rename");
|
|
1834
1661
|
if (result.isValid) {
|
|
1835
1662
|
return null;
|
|
1836
1663
|
}
|
|
@@ -1841,7 +1668,7 @@ var validateLabel = (newLabel) => {
|
|
|
1841
1668
|
var React16 = __toESM(require("react"));
|
|
1842
1669
|
var import_icons10 = require("@elementor/icons");
|
|
1843
1670
|
var import_ui13 = require("@elementor/ui");
|
|
1844
|
-
var
|
|
1671
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
1845
1672
|
var getNotFoundType = (searchValue, filters, filteredClasses) => {
|
|
1846
1673
|
const searchNotFound = filteredClasses.length <= 0 && searchValue.length > 1;
|
|
1847
1674
|
const filterNotFound = filters && filters.length === 0;
|
|
@@ -1859,18 +1686,18 @@ var getNotFoundType = (searchValue, filters, filteredClasses) => {
|
|
|
1859
1686
|
};
|
|
1860
1687
|
var notFound = {
|
|
1861
1688
|
filterAndSearch: {
|
|
1862
|
-
mainText: (0,
|
|
1863
|
-
sceneryText: (0,
|
|
1689
|
+
mainText: (0, import_i18n11.__)("Sorry, nothing matched.", "elementor"),
|
|
1690
|
+
sceneryText: (0, import_i18n11.__)("Try something else.", "elementor"),
|
|
1864
1691
|
icon: /* @__PURE__ */ React16.createElement(import_icons10.PhotoIcon, { color: "inherit", fontSize: "large" })
|
|
1865
1692
|
},
|
|
1866
1693
|
search: {
|
|
1867
|
-
mainText: (0,
|
|
1868
|
-
sceneryText: (0,
|
|
1694
|
+
mainText: (0, import_i18n11.__)("Sorry, nothing matched", "elementor"),
|
|
1695
|
+
sceneryText: (0, import_i18n11.__)("Clear your input and try something else.", "elementor"),
|
|
1869
1696
|
icon: /* @__PURE__ */ React16.createElement(import_icons10.PhotoIcon, { color: "inherit", fontSize: "large" })
|
|
1870
1697
|
},
|
|
1871
1698
|
filter: {
|
|
1872
|
-
mainText: (0,
|
|
1873
|
-
sceneryText: (0,
|
|
1699
|
+
mainText: (0, import_i18n11.__)("Sorry, nothing matched that search.", "elementor"),
|
|
1700
|
+
sceneryText: (0, import_i18n11.__)("Clear the filters and try something else.", "elementor"),
|
|
1874
1701
|
icon: /* @__PURE__ */ React16.createElement(import_icons10.ColorSwatchIcon, { color: "inherit", fontSize: "large" })
|
|
1875
1702
|
}
|
|
1876
1703
|
};
|
|
@@ -1943,7 +1770,7 @@ var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) =>
|
|
|
1943
1770
|
)
|
|
1944
1771
|
),
|
|
1945
1772
|
/* @__PURE__ */ React16.createElement(import_ui13.Typography, { align: "center", variant: "caption", color: "inherit" }, sceneryText),
|
|
1946
|
-
/* @__PURE__ */ React16.createElement(import_ui13.Typography, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React16.createElement(import_ui13.Link, { color: "secondary", variant: "caption", component: "button", onClick: onClear }, (0,
|
|
1773
|
+
/* @__PURE__ */ React16.createElement(import_ui13.Typography, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React16.createElement(import_ui13.Link, { color: "secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n11.__)("Clear & try again", "elementor")))
|
|
1947
1774
|
);
|
|
1948
1775
|
|
|
1949
1776
|
// src/components/class-manager/global-classes-list.tsx
|
|
@@ -1959,7 +1786,7 @@ var GlobalClassesList = ({
|
|
|
1959
1786
|
search: { debouncedValue: searchValue }
|
|
1960
1787
|
} = useSearchAndFilters();
|
|
1961
1788
|
const cssClasses = useOrderedClasses();
|
|
1962
|
-
const dispatch5 = (0,
|
|
1789
|
+
const dispatch5 = (0, import_store16.__useDispatch)();
|
|
1963
1790
|
const filters = useFilters();
|
|
1964
1791
|
const [draggedItemId, setDraggedItemId] = (0, import_react8.useState)(null);
|
|
1965
1792
|
const draggedItemLabel = cssClasses.find((cssClass) => cssClass.id === draggedItemId)?.label ?? "";
|
|
@@ -2098,7 +1925,7 @@ var GlobalClassesList = ({
|
|
|
2098
1925
|
)
|
|
2099
1926
|
));
|
|
2100
1927
|
};
|
|
2101
|
-
var EmptyState = () => /* @__PURE__ */ React17.createElement(import_ui14.Stack, { alignItems: "center", gap: 1.5, pt: 10, px: 0.5, maxWidth: "260px", margin: "auto" }, /* @__PURE__ */ React17.createElement(FlippedColorSwatchIcon, { fontSize: "large" }), /* @__PURE__ */ React17.createElement(StyledHeader, { variant: "subtitle2", component: "h2", color: "text.secondary" }, (0,
|
|
1928
|
+
var EmptyState = () => /* @__PURE__ */ React17.createElement(import_ui14.Stack, { alignItems: "center", gap: 1.5, pt: 10, px: 0.5, maxWidth: "260px", margin: "auto" }, /* @__PURE__ */ React17.createElement(FlippedColorSwatchIcon, { fontSize: "large" }), /* @__PURE__ */ React17.createElement(StyledHeader, { variant: "subtitle2", component: "h2", color: "text.secondary" }, (0, import_i18n12.__)("There are no global classes yet.", "elementor")), /* @__PURE__ */ React17.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n12.__)(
|
|
2102
1929
|
"CSS classes created in the editor panel will appear here. Once they are available, you can arrange their hierarchy, rename them, or delete them as needed.",
|
|
2103
1930
|
"elementor"
|
|
2104
1931
|
)));
|
|
@@ -2108,7 +1935,7 @@ var StyledHeader = (0, import_ui14.styled)(import_ui14.Typography)(({ theme, var
|
|
|
2108
1935
|
}
|
|
2109
1936
|
}));
|
|
2110
1937
|
var useReorder = (draggedItemId, setDraggedItemId, draggedItemLabel) => {
|
|
2111
|
-
const dispatch5 = (0,
|
|
1938
|
+
const dispatch5 = (0, import_store16.__useDispatch)();
|
|
2112
1939
|
const order = useClassesOrder();
|
|
2113
1940
|
const reorder = (newIds) => {
|
|
2114
1941
|
dispatch5(slice.actions.setOrder(newIds));
|
|
@@ -2164,7 +1991,7 @@ function unblockPanelInteractions() {
|
|
|
2164
1991
|
var React18 = __toESM(require("react"));
|
|
2165
1992
|
var import_react9 = require("react");
|
|
2166
1993
|
var import_ui15 = require("@elementor/ui");
|
|
2167
|
-
var
|
|
1994
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
2168
1995
|
var IMAGE_URL = "https://assets.elementor.com/packages/v1/images/class-manager-sync-modal.png";
|
|
2169
1996
|
var StartSyncToV3Modal = ({
|
|
2170
1997
|
externalOpen,
|
|
@@ -2196,7 +2023,7 @@ var StartSyncToV3Modal = ({
|
|
|
2196
2023
|
onConfirm?.();
|
|
2197
2024
|
onExternalClose?.();
|
|
2198
2025
|
};
|
|
2199
|
-
return /* @__PURE__ */ React18.createElement(import_ui15.Dialog, { open: !!externalOpen, onClose: handleClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React18.createElement(import_ui15.DialogContent, { sx: { p: 0 } }, /* @__PURE__ */ React18.createElement(import_ui15.Box, { component: "img", src: IMAGE_URL, alt: "", sx: { width: "100%", display: "block" } }), /* @__PURE__ */ React18.createElement(import_ui15.Box, { sx: { px: 3, pt: 4, pb: 1 } }, /* @__PURE__ */ React18.createElement(import_ui15.Typography, { variant: "h6" }, (0,
|
|
2026
|
+
return /* @__PURE__ */ React18.createElement(import_ui15.Dialog, { open: !!externalOpen, onClose: handleClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React18.createElement(import_ui15.DialogContent, { sx: { p: 0 } }, /* @__PURE__ */ React18.createElement(import_ui15.Box, { component: "img", src: IMAGE_URL, alt: "", sx: { width: "100%", display: "block" } }), /* @__PURE__ */ React18.createElement(import_ui15.Box, { sx: { px: 3, pt: 4, pb: 1 } }, /* @__PURE__ */ React18.createElement(import_ui15.Typography, { variant: "h6" }, (0, import_i18n13.__)("Sync class to Global Fonts", "elementor")), /* @__PURE__ */ React18.createElement(import_ui15.Typography, { variant: "body2", color: "secondary", sx: { mb: 2, pt: 1 } }, (0, import_i18n13.__)(
|
|
2200
2027
|
"Only typography settings supported in Global Fonts will be applied, including: font family, responsive font sizes, weight, text transform, decoration, line height, letter spacing, and word spacing. Changes made in the class will automatically apply to Global Fonts.",
|
|
2201
2028
|
"elementor"
|
|
2202
2029
|
)))), /* @__PURE__ */ React18.createElement(import_ui15.DialogActions, { sx: { justifyContent: "space-between", px: 3, pb: 2 } }, /* @__PURE__ */ React18.createElement(
|
|
@@ -2209,32 +2036,54 @@ var StartSyncToV3Modal = ({
|
|
|
2209
2036
|
onChange: (e) => setShouldShowAgain(!e.target.checked)
|
|
2210
2037
|
}
|
|
2211
2038
|
),
|
|
2212
|
-
label: /* @__PURE__ */ React18.createElement(import_ui15.Typography, { variant: "body2", color: "secondary" }, (0,
|
|
2039
|
+
label: /* @__PURE__ */ React18.createElement(import_ui15.Typography, { variant: "body2", color: "secondary" }, (0, import_i18n13.__)("Don't show again", "elementor"))
|
|
2213
2040
|
}
|
|
2214
|
-
), /* @__PURE__ */ React18.createElement(import_ui15.Box, { sx: { display: "flex", gap: 1 } }, /* @__PURE__ */ React18.createElement(import_ui15.Button, { onClick: handleClose, color: "secondary", size: "small" }, (0,
|
|
2041
|
+
), /* @__PURE__ */ React18.createElement(import_ui15.Box, { sx: { display: "flex", gap: 1 } }, /* @__PURE__ */ React18.createElement(import_ui15.Button, { onClick: handleClose, color: "secondary", size: "small" }, (0, import_i18n13.__)("Cancel", "elementor")), /* @__PURE__ */ React18.createElement(import_ui15.Button, { onClick: handleConfirm, variant: "contained", size: "small" }, (0, import_i18n13.__)("Sync to Global Fonts", "elementor")))));
|
|
2215
2042
|
};
|
|
2216
2043
|
|
|
2217
2044
|
// src/components/class-manager/class-manager-panel.tsx
|
|
2218
2045
|
var STOP_SYNC_MESSAGE_KEY = "stop-sync-class";
|
|
2219
2046
|
var id = "global-classes-manager";
|
|
2047
|
+
function ClassManagerPanelEmbedded({ onRequestClose, onExposeCloseAttempt }) {
|
|
2048
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2049
|
+
ClassManagerPanelRoot,
|
|
2050
|
+
{
|
|
2051
|
+
embedded: true,
|
|
2052
|
+
onRequestClose,
|
|
2053
|
+
onExposeCloseAttempt
|
|
2054
|
+
}
|
|
2055
|
+
);
|
|
2056
|
+
}
|
|
2057
|
+
function ClassManagerPanel() {
|
|
2058
|
+
return /* @__PURE__ */ React19.createElement(ClassManagerPanelRoot, null);
|
|
2059
|
+
}
|
|
2220
2060
|
var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
2221
2061
|
id,
|
|
2222
2062
|
component: ClassManagerPanel,
|
|
2223
2063
|
allowedEditModes: ["edit", id],
|
|
2224
2064
|
onOpen: () => {
|
|
2225
|
-
(0,
|
|
2065
|
+
(0, import_editor_v1_adapters.changeEditMode)(id);
|
|
2226
2066
|
blockPanelInteractions();
|
|
2227
2067
|
},
|
|
2228
2068
|
onClose: async () => {
|
|
2229
|
-
(0,
|
|
2069
|
+
(0, import_editor_v1_adapters.changeEditMode)("edit");
|
|
2230
2070
|
await (0, import_editor_documents3.reloadCurrentDocument)();
|
|
2231
2071
|
unblockPanelInteractions();
|
|
2232
2072
|
},
|
|
2233
2073
|
isOpenPreviousElement: true
|
|
2234
2074
|
});
|
|
2235
|
-
function
|
|
2075
|
+
function ClassManagerPanelRoot({
|
|
2076
|
+
embedded = false,
|
|
2077
|
+
onRequestClose,
|
|
2078
|
+
onExposeCloseAttempt
|
|
2079
|
+
} = {}) {
|
|
2236
2080
|
const isDirty2 = useDirtyState();
|
|
2237
|
-
const { close:
|
|
2081
|
+
const { close: closeStandalonePanel } = usePanelActions();
|
|
2082
|
+
const closePanel = (0, import_react10.useMemo)(
|
|
2083
|
+
() => embedded ? onRequestClose ?? (async () => {
|
|
2084
|
+
}) : closeStandalonePanel,
|
|
2085
|
+
[embedded, onRequestClose, closeStandalonePanel]
|
|
2086
|
+
);
|
|
2238
2087
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui9.useDialog)();
|
|
2239
2088
|
const [stopSyncConfirmation, setStopSyncConfirmation] = (0, import_react10.useState)(null);
|
|
2240
2089
|
const [startSyncConfirmation, setStartSyncConfirmation] = (0, import_react10.useState)(null);
|
|
@@ -2242,11 +2091,34 @@ function ClassManagerPanel() {
|
|
|
2242
2091
|
const [scrollElement, setScrollElement] = (0, import_react10.useState)(null);
|
|
2243
2092
|
const { mutateAsync: publish, isPending: isPublishing } = usePublish();
|
|
2244
2093
|
const resetAndClosePanel = () => {
|
|
2245
|
-
(0,
|
|
2094
|
+
(0, import_store18.__dispatch)(slice.actions.resetToInitialState({ context: "frontend" }));
|
|
2246
2095
|
closeSaveChangesDialog();
|
|
2247
2096
|
};
|
|
2097
|
+
const handleClosePanel = (0, import_react10.useCallback)(() => {
|
|
2098
|
+
if (isDirty2) {
|
|
2099
|
+
openSaveChangesDialog();
|
|
2100
|
+
return;
|
|
2101
|
+
}
|
|
2102
|
+
void closePanel();
|
|
2103
|
+
}, [isDirty2, openSaveChangesDialog, closePanel]);
|
|
2104
|
+
(0, import_react10.useEffect)(() => {
|
|
2105
|
+
if (!embedded || !onExposeCloseAttempt) {
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
onExposeCloseAttempt(() => handleClosePanel());
|
|
2109
|
+
return () => onExposeCloseAttempt(null);
|
|
2110
|
+
}, [embedded, onExposeCloseAttempt, handleClosePanel]);
|
|
2111
|
+
(0, import_react10.useEffect)(() => {
|
|
2112
|
+
if (!embedded) {
|
|
2113
|
+
return;
|
|
2114
|
+
}
|
|
2115
|
+
blockPanelInteractions();
|
|
2116
|
+
return () => {
|
|
2117
|
+
unblockPanelInteractions();
|
|
2118
|
+
};
|
|
2119
|
+
}, [embedded]);
|
|
2248
2120
|
const handleStopSync = (0, import_react10.useCallback)((classId) => {
|
|
2249
|
-
(0,
|
|
2121
|
+
(0, import_store18.__dispatch)(
|
|
2250
2122
|
slice.actions.update({
|
|
2251
2123
|
style: {
|
|
2252
2124
|
id: classId,
|
|
@@ -2258,7 +2130,7 @@ function ClassManagerPanel() {
|
|
|
2258
2130
|
setStopSyncConfirmation(null);
|
|
2259
2131
|
}, []);
|
|
2260
2132
|
const handleStartSync = (0, import_react10.useCallback)((classId) => {
|
|
2261
|
-
(0,
|
|
2133
|
+
(0, import_store18.__dispatch)(
|
|
2262
2134
|
slice.actions.update({
|
|
2263
2135
|
style: {
|
|
2264
2136
|
id: classId,
|
|
@@ -2280,51 +2152,29 @@ function ClassManagerPanel() {
|
|
|
2280
2152
|
[isStopSyncSuppressed, handleStopSync]
|
|
2281
2153
|
);
|
|
2282
2154
|
usePreventUnload();
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
sx: { marginLeft: "auto" },
|
|
2287
|
-
disabled: isPublishing,
|
|
2288
|
-
onClose: () => {
|
|
2289
|
-
if (isDirty2) {
|
|
2290
|
-
openSaveChangesDialog();
|
|
2291
|
-
return;
|
|
2292
|
-
}
|
|
2293
|
-
closePanel();
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
))), /* @__PURE__ */ React19.createElement(
|
|
2297
|
-
import_editor_panels.PanelBody,
|
|
2155
|
+
const searchFiltersBlock = /* @__PURE__ */ React19.createElement(import_ui16.Box, { px: 2, pb: 1 }, /* @__PURE__ */ React19.createElement(import_ui16.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 0.5, sx: { pb: 0.5 } }, /* @__PURE__ */ React19.createElement(import_ui16.Box, { sx: embedded ? { flexGrow: 1, minWidth: 0 } : { flexGrow: 1 } }, /* @__PURE__ */ React19.createElement(ClassManagerSearch, null)), /* @__PURE__ */ React19.createElement(CssClassFilter, null), embedded && /* @__PURE__ */ React19.createElement(TotalCssClassCounter, null)), /* @__PURE__ */ React19.createElement(ActiveFilters, null));
|
|
2156
|
+
const listArea = /* @__PURE__ */ React19.createElement(
|
|
2157
|
+
import_ui16.Box,
|
|
2298
2158
|
{
|
|
2159
|
+
ref: setScrollElement,
|
|
2160
|
+
px: 2,
|
|
2299
2161
|
sx: {
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2162
|
+
flexGrow: 1,
|
|
2163
|
+
overflowY: "auto",
|
|
2164
|
+
...embedded ? { minHeight: 0 } : {}
|
|
2303
2165
|
}
|
|
2304
2166
|
},
|
|
2305
|
-
/* @__PURE__ */ React19.createElement(import_ui16.Box, { px: 2, pb: 1 }, /* @__PURE__ */ React19.createElement(import_ui16.Stack, { direction: "row", justifyContent: "spaceBetween", gap: 0.5, sx: { pb: 0.5 } }, /* @__PURE__ */ React19.createElement(import_ui16.Box, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React19.createElement(ClassManagerSearch, null)), /* @__PURE__ */ React19.createElement(CssClassFilter, null)), /* @__PURE__ */ React19.createElement(ActiveFilters, null)),
|
|
2306
|
-
/* @__PURE__ */ React19.createElement(import_ui16.Divider, null),
|
|
2307
2167
|
/* @__PURE__ */ React19.createElement(
|
|
2308
|
-
|
|
2168
|
+
GlobalClassesList,
|
|
2309
2169
|
{
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
}
|
|
2316
|
-
},
|
|
2317
|
-
/* @__PURE__ */ React19.createElement(
|
|
2318
|
-
GlobalClassesList,
|
|
2319
|
-
{
|
|
2320
|
-
disabled: isPublishing,
|
|
2321
|
-
scrollElement,
|
|
2322
|
-
onStopSyncRequest: handleStopSyncRequest,
|
|
2323
|
-
onStartSyncRequest: (classId) => setStartSyncConfirmation(classId)
|
|
2324
|
-
}
|
|
2325
|
-
)
|
|
2170
|
+
disabled: isPublishing,
|
|
2171
|
+
scrollElement,
|
|
2172
|
+
onStopSyncRequest: handleStopSyncRequest,
|
|
2173
|
+
onStartSyncRequest: (classId) => setStartSyncConfirmation(classId)
|
|
2174
|
+
}
|
|
2326
2175
|
)
|
|
2327
|
-
)
|
|
2176
|
+
);
|
|
2177
|
+
const saveFooter = /* @__PURE__ */ React19.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React19.createElement(
|
|
2328
2178
|
import_ui16.Button,
|
|
2329
2179
|
{
|
|
2330
2180
|
fullWidth: true,
|
|
@@ -2335,8 +2185,9 @@ function ClassManagerPanel() {
|
|
|
2335
2185
|
disabled: !isDirty2,
|
|
2336
2186
|
loading: isPublishing
|
|
2337
2187
|
},
|
|
2338
|
-
(0,
|
|
2339
|
-
))
|
|
2188
|
+
(0, import_i18n14.__)("Save changes", "elementor")
|
|
2189
|
+
));
|
|
2190
|
+
const dialogs = /* @__PURE__ */ React19.createElement(React19.Fragment, null, startSyncConfirmation && /* @__PURE__ */ React19.createElement(
|
|
2340
2191
|
StartSyncToV3Modal,
|
|
2341
2192
|
{
|
|
2342
2193
|
externalOpen: true,
|
|
@@ -2351,30 +2202,84 @@ function ClassManagerPanel() {
|
|
|
2351
2202
|
onClose: () => setStopSyncConfirmation(null),
|
|
2352
2203
|
onConfirm: () => handleStopSync(stopSyncConfirmation)
|
|
2353
2204
|
}
|
|
2354
|
-
), isSaveChangesDialogOpen && /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog, null, /* @__PURE__ */ React19.createElement(import_ui16.DialogHeader, { onClose: closeSaveChangesDialog, logo: false }, /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.Title, null, (0,
|
|
2205
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog, null, /* @__PURE__ */ React19.createElement(import_ui16.DialogHeader, { onClose: closeSaveChangesDialog, logo: false }, /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.Title, null, (0, import_i18n14.__)("You have unsaved changes", "elementor"))), /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.Content, null, /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.ContentText, null, (0, import_i18n14.__)("You have unsaved changes in the Class Manager.", "elementor")), /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.ContentText, null, (0, import_i18n14.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React19.createElement(
|
|
2355
2206
|
import_editor_ui9.SaveChangesDialog.Actions,
|
|
2356
2207
|
{
|
|
2357
2208
|
actions: {
|
|
2358
2209
|
discard: {
|
|
2359
|
-
label: (0,
|
|
2210
|
+
label: (0, import_i18n14.__)("Discard", "elementor"),
|
|
2360
2211
|
action: () => {
|
|
2361
2212
|
resetAndClosePanel();
|
|
2362
2213
|
}
|
|
2363
2214
|
},
|
|
2364
2215
|
confirm: {
|
|
2365
|
-
label: (0,
|
|
2216
|
+
label: (0, import_i18n14.__)("Save & Continue", "elementor"),
|
|
2366
2217
|
action: async () => {
|
|
2367
2218
|
await publish();
|
|
2368
2219
|
closeSaveChangesDialog();
|
|
2369
|
-
closePanel();
|
|
2220
|
+
void closePanel();
|
|
2370
2221
|
}
|
|
2371
2222
|
}
|
|
2372
2223
|
}
|
|
2373
2224
|
}
|
|
2374
2225
|
)));
|
|
2226
|
+
const classManagerLayout = embedded ? /* @__PURE__ */ React19.createElement(
|
|
2227
|
+
import_ui16.Stack,
|
|
2228
|
+
{
|
|
2229
|
+
direction: "column",
|
|
2230
|
+
sx: {
|
|
2231
|
+
height: "100%",
|
|
2232
|
+
width: "100%",
|
|
2233
|
+
flex: 1,
|
|
2234
|
+
minHeight: 0,
|
|
2235
|
+
overflow: "hidden"
|
|
2236
|
+
}
|
|
2237
|
+
},
|
|
2238
|
+
searchFiltersBlock,
|
|
2239
|
+
/* @__PURE__ */ React19.createElement(import_ui16.Divider, null),
|
|
2240
|
+
listArea,
|
|
2241
|
+
saveFooter
|
|
2242
|
+
) : /* @__PURE__ */ React19.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React19.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React19.createElement(import_ui16.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React19.createElement(import_ui16.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React19.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React19.createElement(FlippedColorSwatchIcon, { fontSize: "inherit" }), (0, import_i18n14.__)("Class Manager", "elementor")), /* @__PURE__ */ React19.createElement(TotalCssClassCounter, null)), /* @__PURE__ */ React19.createElement(
|
|
2243
|
+
ClassPanelCloseButton,
|
|
2244
|
+
{
|
|
2245
|
+
disabled: isPublishing,
|
|
2246
|
+
onClose: () => {
|
|
2247
|
+
if (isDirty2) {
|
|
2248
|
+
openSaveChangesDialog();
|
|
2249
|
+
return;
|
|
2250
|
+
}
|
|
2251
|
+
void closeStandalonePanel();
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
))), /* @__PURE__ */ React19.createElement(
|
|
2255
|
+
import_editor_panels.PanelBody,
|
|
2256
|
+
{
|
|
2257
|
+
sx: {
|
|
2258
|
+
display: "flex",
|
|
2259
|
+
flexDirection: "column",
|
|
2260
|
+
height: "100%"
|
|
2261
|
+
}
|
|
2262
|
+
},
|
|
2263
|
+
searchFiltersBlock,
|
|
2264
|
+
/* @__PURE__ */ React19.createElement(import_ui16.Divider, null),
|
|
2265
|
+
listArea
|
|
2266
|
+
), saveFooter);
|
|
2267
|
+
const core = /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_ui16.ErrorBoundary, { fallback: /* @__PURE__ */ React19.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React19.createElement(SearchAndFilterProvider, null, classManagerLayout)), /* @__PURE__ */ React19.createElement(ClassManagerIntroduction, null), dialogs);
|
|
2268
|
+
return embedded ? core : /* @__PURE__ */ React19.createElement(import_editor_ui9.ThemeProvider, null, core);
|
|
2375
2269
|
}
|
|
2376
|
-
var
|
|
2377
|
-
|
|
2270
|
+
var ClassPanelCloseButton = ({ onClose, sx, ...props }) => /* @__PURE__ */ React19.createElement(
|
|
2271
|
+
import_ui16.IconButton,
|
|
2272
|
+
{
|
|
2273
|
+
size: "small",
|
|
2274
|
+
color: "secondary",
|
|
2275
|
+
onClick: onClose,
|
|
2276
|
+
"aria-label": "Close",
|
|
2277
|
+
sx: { marginLeft: "auto", ...sx },
|
|
2278
|
+
...props
|
|
2279
|
+
},
|
|
2280
|
+
/* @__PURE__ */ React19.createElement(import_icons11.XIcon, { fontSize: "small" })
|
|
2281
|
+
);
|
|
2282
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React19.createElement(import_ui16.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React19.createElement(import_ui16.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React19.createElement("strong", null, (0, import_i18n14.__)("Something went wrong", "elementor"))));
|
|
2378
2283
|
var usePreventUnload = () => {
|
|
2379
2284
|
const isDirty2 = useDirtyState();
|
|
2380
2285
|
(0, import_react10.useEffect)(() => {
|
|
@@ -2390,7 +2295,7 @@ var usePreventUnload = () => {
|
|
|
2390
2295
|
}, [isDirty2]);
|
|
2391
2296
|
};
|
|
2392
2297
|
var usePublish = () => {
|
|
2393
|
-
return (0,
|
|
2298
|
+
return (0, import_query2.useMutation)({
|
|
2394
2299
|
mutationFn: () => saveGlobalClasses({ context: "frontend" }),
|
|
2395
2300
|
onSuccess: async () => {
|
|
2396
2301
|
(0, import_editor_documents3.setDocumentModifiedStatus)(false);
|
|
@@ -2413,7 +2318,7 @@ var TotalCssClassCounter = () => {
|
|
|
2413
2318
|
};
|
|
2414
2319
|
var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
|
|
2415
2320
|
const [, suppressStopSyncMessage] = (0, import_editor_current_user2.useSuppressedMessage)(STOP_SYNC_MESSAGE_KEY);
|
|
2416
|
-
return /* @__PURE__ */ React19.createElement(import_editor_ui9.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React19.createElement(import_editor_ui9.ConfirmationDialog.Title, { icon: FlippedColorSwatchIcon, iconColor: "primary" }, (0,
|
|
2321
|
+
return /* @__PURE__ */ React19.createElement(import_editor_ui9.ConfirmationDialog, { open, onClose }, /* @__PURE__ */ React19.createElement(import_editor_ui9.ConfirmationDialog.Title, { icon: FlippedColorSwatchIcon, iconColor: "primary" }, (0, import_i18n14.__)("Un-sync typography class", "elementor")), /* @__PURE__ */ React19.createElement(import_editor_ui9.ConfirmationDialog.Content, null, /* @__PURE__ */ React19.createElement(import_editor_ui9.ConfirmationDialog.ContentText, null, (0, import_i18n14.__)("You're about to stop syncing a typography class to Global Fonts.", "elementor")), /* @__PURE__ */ React19.createElement(import_editor_ui9.ConfirmationDialog.ContentText, { sx: { mt: 1 } }, (0, import_i18n14.__)(
|
|
2417
2322
|
"Note that if it's being used anywhere, the affected elements will inherit the default typography.",
|
|
2418
2323
|
"elementor"
|
|
2419
2324
|
))), /* @__PURE__ */ React19.createElement(
|
|
@@ -2421,15 +2326,191 @@ var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
|
|
|
2421
2326
|
{
|
|
2422
2327
|
onClose,
|
|
2423
2328
|
onConfirm,
|
|
2424
|
-
cancelLabel: (0,
|
|
2425
|
-
confirmLabel: (0,
|
|
2329
|
+
cancelLabel: (0, import_i18n14.__)("Cancel", "elementor"),
|
|
2330
|
+
confirmLabel: (0, import_i18n14.__)("Got it", "elementor"),
|
|
2426
2331
|
color: "primary",
|
|
2427
2332
|
onSuppressMessage: suppressStopSyncMessage,
|
|
2428
|
-
suppressLabel: (0,
|
|
2333
|
+
suppressLabel: (0, import_i18n14.__)("Don't show again", "elementor")
|
|
2429
2334
|
}
|
|
2430
2335
|
));
|
|
2431
2336
|
};
|
|
2432
2337
|
|
|
2338
|
+
// src/global-classes-styles-provider.ts
|
|
2339
|
+
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
2340
|
+
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
2341
|
+
var import_store20 = require("@elementor/store");
|
|
2342
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2343
|
+
|
|
2344
|
+
// src/capabilities.ts
|
|
2345
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
2346
|
+
var EXPERIMENT_KEY = "global_classes_should_enforce_capabilities";
|
|
2347
|
+
var UPDATE_CLASS_CAPABILITY_KEY = "elementor_global_classes_update_class";
|
|
2348
|
+
var getCapabilities = () => {
|
|
2349
|
+
const shouldEnforceCapabilities = (0, import_editor_v1_adapters2.isExperimentActive)(EXPERIMENT_KEY);
|
|
2350
|
+
if (shouldEnforceCapabilities) {
|
|
2351
|
+
return {
|
|
2352
|
+
update: UPDATE_CLASS_CAPABILITY_KEY,
|
|
2353
|
+
create: UPDATE_CLASS_CAPABILITY_KEY,
|
|
2354
|
+
delete: UPDATE_CLASS_CAPABILITY_KEY,
|
|
2355
|
+
updateProps: UPDATE_CLASS_CAPABILITY_KEY
|
|
2356
|
+
};
|
|
2357
|
+
}
|
|
2358
|
+
};
|
|
2359
|
+
|
|
2360
|
+
// src/global-classes-styles-provider.ts
|
|
2361
|
+
var MAX_CLASSES = 100;
|
|
2362
|
+
var GLOBAL_CLASSES_PROVIDER_KEY = "global-classes";
|
|
2363
|
+
var PREGENERATED_LINK_PATTERN = /^global-(preview|frontend)-[a-zA-Z_-]+-css$/;
|
|
2364
|
+
var globalClassesStylesProvider = (0, import_editor_styles_repository2.createStylesProvider)({
|
|
2365
|
+
key: GLOBAL_CLASSES_PROVIDER_KEY,
|
|
2366
|
+
priority: 30,
|
|
2367
|
+
limit: MAX_CLASSES,
|
|
2368
|
+
isPregeneratedLink: ({ id: id2 }) => PREGENERATED_LINK_PATTERN.test(id2),
|
|
2369
|
+
labels: {
|
|
2370
|
+
singular: (0, import_i18n15.__)("class", "elementor"),
|
|
2371
|
+
plural: (0, import_i18n15.__)("classes", "elementor")
|
|
2372
|
+
},
|
|
2373
|
+
subscribe: (cb) => subscribeWithStates(cb),
|
|
2374
|
+
capabilities: getCapabilities(),
|
|
2375
|
+
actions: {
|
|
2376
|
+
all: () => selectOrderedClasses((0, import_store20.__getState)()),
|
|
2377
|
+
get: (id2) => selectClass((0, import_store20.__getState)(), id2),
|
|
2378
|
+
resolveCssName: (id2) => {
|
|
2379
|
+
return selectClass((0, import_store20.__getState)(), id2)?.label ?? id2;
|
|
2380
|
+
},
|
|
2381
|
+
create: (label, variants = [], id2) => {
|
|
2382
|
+
const classes = selectGlobalClasses((0, import_store20.__getState)());
|
|
2383
|
+
const existingLabels = Object.values(classes).map((style) => style.label);
|
|
2384
|
+
if (existingLabels.includes(label)) {
|
|
2385
|
+
throw new GlobalClassLabelAlreadyExistsError({ context: { label } });
|
|
2386
|
+
}
|
|
2387
|
+
if (!id2) {
|
|
2388
|
+
id2 = (0, import_editor_styles2.generateId)("g-", Object.keys(classes));
|
|
2389
|
+
}
|
|
2390
|
+
(0, import_store20.__dispatch)(
|
|
2391
|
+
slice.actions.add({
|
|
2392
|
+
id: id2,
|
|
2393
|
+
type: "class",
|
|
2394
|
+
label,
|
|
2395
|
+
variants
|
|
2396
|
+
})
|
|
2397
|
+
);
|
|
2398
|
+
return id2;
|
|
2399
|
+
},
|
|
2400
|
+
update: (payload) => {
|
|
2401
|
+
(0, import_store20.__dispatch)(
|
|
2402
|
+
slice.actions.update({
|
|
2403
|
+
style: payload
|
|
2404
|
+
})
|
|
2405
|
+
);
|
|
2406
|
+
},
|
|
2407
|
+
delete: (id2) => {
|
|
2408
|
+
(0, import_store20.__dispatch)(slice.actions.delete(id2));
|
|
2409
|
+
},
|
|
2410
|
+
updateProps: (args) => {
|
|
2411
|
+
(0, import_store20.__dispatch)(
|
|
2412
|
+
slice.actions.updateProps({
|
|
2413
|
+
id: args.id,
|
|
2414
|
+
meta: args.meta,
|
|
2415
|
+
props: args.props,
|
|
2416
|
+
mode: args.mode
|
|
2417
|
+
})
|
|
2418
|
+
);
|
|
2419
|
+
},
|
|
2420
|
+
updateCustomCss: (args) => {
|
|
2421
|
+
(0, import_store20.__dispatch)(
|
|
2422
|
+
slice.actions.updateProps({
|
|
2423
|
+
id: args.id,
|
|
2424
|
+
meta: args.meta,
|
|
2425
|
+
custom_css: args.custom_css,
|
|
2426
|
+
props: {}
|
|
2427
|
+
})
|
|
2428
|
+
);
|
|
2429
|
+
},
|
|
2430
|
+
tracking: (data) => {
|
|
2431
|
+
trackGlobalClasses(data).catch((error) => {
|
|
2432
|
+
throw new GlobalClassTrackingError({ cause: error });
|
|
2433
|
+
});
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
});
|
|
2437
|
+
var subscribeWithStates = (cb) => {
|
|
2438
|
+
let previousState = selectData((0, import_store20.__getState)());
|
|
2439
|
+
return (0, import_store20.__subscribeWithSelector)(
|
|
2440
|
+
(state) => state.globalClasses,
|
|
2441
|
+
(currentState) => {
|
|
2442
|
+
cb(previousState.items, currentState.data.items);
|
|
2443
|
+
previousState = currentState.data;
|
|
2444
|
+
}
|
|
2445
|
+
);
|
|
2446
|
+
};
|
|
2447
|
+
|
|
2448
|
+
// src/mcp-integration/classes-resource.ts
|
|
2449
|
+
var GLOBAL_CLASSES_URI = "elementor://global-classes";
|
|
2450
|
+
var STORAGE_KEY = "elementor-global-classes";
|
|
2451
|
+
var updateLocalStorageCache = () => {
|
|
2452
|
+
const classes = globalClassesStylesProvider.actions.all();
|
|
2453
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(classes));
|
|
2454
|
+
};
|
|
2455
|
+
var initClassesResource = (classesMcpEntry, canvasMcpEntry) => {
|
|
2456
|
+
[canvasMcpEntry, classesMcpEntry].forEach((entry) => {
|
|
2457
|
+
const { sendResourceUpdated, resource, waitForReady } = entry;
|
|
2458
|
+
resource(
|
|
2459
|
+
"global-classes",
|
|
2460
|
+
GLOBAL_CLASSES_URI,
|
|
2461
|
+
{
|
|
2462
|
+
description: "Global classes list."
|
|
2463
|
+
},
|
|
2464
|
+
async () => {
|
|
2465
|
+
return {
|
|
2466
|
+
contents: [{ uri: GLOBAL_CLASSES_URI, text: localStorage[STORAGE_KEY] ?? "[]" }]
|
|
2467
|
+
};
|
|
2468
|
+
}
|
|
2469
|
+
);
|
|
2470
|
+
waitForReady().then(() => {
|
|
2471
|
+
updateLocalStorageCache();
|
|
2472
|
+
globalClassesStylesProvider.subscribe(() => {
|
|
2473
|
+
updateLocalStorageCache();
|
|
2474
|
+
sendResourceUpdated({ uri: GLOBAL_CLASSES_URI });
|
|
2475
|
+
});
|
|
2476
|
+
});
|
|
2477
|
+
});
|
|
2478
|
+
};
|
|
2479
|
+
|
|
2480
|
+
// src/init.ts
|
|
2481
|
+
var import_editor = require("@elementor/editor");
|
|
2482
|
+
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
2483
|
+
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
2484
|
+
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
2485
|
+
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
2486
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
2487
|
+
var import_store28 = require("@elementor/store");
|
|
2488
|
+
|
|
2489
|
+
// src/components/class-manager/class-manager-button.tsx
|
|
2490
|
+
var React20 = __toESM(require("react"));
|
|
2491
|
+
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
2492
|
+
var import_editor_styles_repository3 = require("@elementor/editor-styles-repository");
|
|
2493
|
+
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
2494
|
+
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
2495
|
+
var import_ui17 = require("@elementor/ui");
|
|
2496
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2497
|
+
|
|
2498
|
+
// src/hooks/use-prefetch-css-class-usage.ts
|
|
2499
|
+
var import_query3 = require("@elementor/query");
|
|
2500
|
+
function usePrefetchCssClassUsage() {
|
|
2501
|
+
const queryClient = (0, import_query3.useQueryClient)();
|
|
2502
|
+
const prefetchClassesUsage = () => queryClient.prefetchQuery({
|
|
2503
|
+
queryKey: [QUERY_KEY],
|
|
2504
|
+
queryFn: fetchCssClassUsage
|
|
2505
|
+
});
|
|
2506
|
+
return { prefetchClassesUsage };
|
|
2507
|
+
}
|
|
2508
|
+
var PrefetchCssClassUsage = () => {
|
|
2509
|
+
const { prefetchClassesUsage } = usePrefetchCssClassUsage();
|
|
2510
|
+
prefetchClassesUsage();
|
|
2511
|
+
return null;
|
|
2512
|
+
};
|
|
2513
|
+
|
|
2433
2514
|
// src/components/class-manager/class-manager-button.tsx
|
|
2434
2515
|
var trackGlobalClassesButton = () => {
|
|
2435
2516
|
trackGlobalClasses({
|
|
@@ -2448,17 +2529,24 @@ var ClassManagerButton = () => {
|
|
|
2448
2529
|
if (!isUserAllowedToUpdateClass) {
|
|
2449
2530
|
return null;
|
|
2450
2531
|
}
|
|
2532
|
+
const toggleClassesManagerPanel = () => {
|
|
2533
|
+
if ((0, import_editor_v1_adapters3.isExperimentActive)("e_editor_design_system_panel")) {
|
|
2534
|
+
window.dispatchEvent(
|
|
2535
|
+
new CustomEvent("elementor/toggle-design-system", {
|
|
2536
|
+
detail: { tab: "classes" }
|
|
2537
|
+
})
|
|
2538
|
+
);
|
|
2539
|
+
} else {
|
|
2540
|
+
openPanel();
|
|
2541
|
+
}
|
|
2542
|
+
};
|
|
2451
2543
|
const handleOpenPanel = () => {
|
|
2452
2544
|
if (document?.isDirty) {
|
|
2453
2545
|
openSaveChangesDialog();
|
|
2454
2546
|
return;
|
|
2455
2547
|
}
|
|
2456
|
-
|
|
2548
|
+
toggleClassesManagerPanel();
|
|
2457
2549
|
trackGlobalClassesButton();
|
|
2458
|
-
trackGlobalClasses({
|
|
2459
|
-
event: "classManagerOpened",
|
|
2460
|
-
source: "style-panel"
|
|
2461
|
-
});
|
|
2462
2550
|
prefetchClassesUsage();
|
|
2463
2551
|
};
|
|
2464
2552
|
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(import_ui17.Tooltip, { title: (0, import_i18n16.__)("Class Manager", "elementor"), placement: "top" }, /* @__PURE__ */ React20.createElement(import_ui17.IconButton, { size: "tiny", onClick: handleOpenPanel, sx: { marginInlineEnd: -0.75 } }, /* @__PURE__ */ React20.createElement(FlippedColorSwatchIcon, { fontSize: "tiny" }))), isSaveChangesDialogOpen && /* @__PURE__ */ React20.createElement(import_editor_ui10.SaveChangesDialog, null, /* @__PURE__ */ React20.createElement(import_editor_ui10.SaveChangesDialog.Title, null, (0, import_i18n16.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React20.createElement(import_editor_ui10.SaveChangesDialog.Content, null, /* @__PURE__ */ React20.createElement(import_editor_ui10.SaveChangesDialog.ContentText, { sx: { mb: 2 } }, (0, import_i18n16.__)(
|
|
@@ -2477,7 +2565,7 @@ var ClassManagerButton = () => {
|
|
|
2477
2565
|
action: async () => {
|
|
2478
2566
|
await saveDocument();
|
|
2479
2567
|
closeSaveChangesDialog();
|
|
2480
|
-
|
|
2568
|
+
toggleClassesManagerPanel();
|
|
2481
2569
|
trackGlobalClassesButton();
|
|
2482
2570
|
prefetchClassesUsage();
|
|
2483
2571
|
}
|
|
@@ -2588,7 +2676,7 @@ function GlobalStylesImportListener() {
|
|
|
2588
2676
|
|
|
2589
2677
|
// src/components/open-panel-from-url.tsx
|
|
2590
2678
|
var import_react12 = require("react");
|
|
2591
|
-
var
|
|
2679
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2592
2680
|
var ACTIVE_PANEL_PARAM = "active-panel";
|
|
2593
2681
|
var PANEL_ID = "global-classes-manager";
|
|
2594
2682
|
var DEFAULT_PANEL_ROUTE = "panel/elements";
|
|
@@ -2601,7 +2689,7 @@ function OpenPanelFromUrl() {
|
|
|
2601
2689
|
if (activePanel !== PANEL_ID) {
|
|
2602
2690
|
return;
|
|
2603
2691
|
}
|
|
2604
|
-
const cleanup = (0,
|
|
2692
|
+
const cleanup = (0, import_editor_v1_adapters4.__privateListenTo)((0, import_editor_v1_adapters4.routeOpenEvent)(DEFAULT_PANEL_ROUTE), () => {
|
|
2605
2693
|
if (hasOpened.current) {
|
|
2606
2694
|
return;
|
|
2607
2695
|
}
|
|
@@ -3090,12 +3178,12 @@ var initMcpIntegration = (reg, canvasMcpEntry) => {
|
|
|
3090
3178
|
|
|
3091
3179
|
// src/sync-with-document.tsx
|
|
3092
3180
|
var import_react14 = require("react");
|
|
3093
|
-
var
|
|
3181
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3094
3182
|
|
|
3095
3183
|
// src/sync-with-document-save.ts
|
|
3096
3184
|
var import_editor_current_user3 = require("@elementor/editor-current-user");
|
|
3097
3185
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
3098
|
-
var
|
|
3186
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
3099
3187
|
var import_store26 = require("@elementor/store");
|
|
3100
3188
|
var pendingSave = null;
|
|
3101
3189
|
function syncWithDocumentSave(panelActions) {
|
|
@@ -3132,7 +3220,7 @@ function triggerSave(panelActions, context2 = "preview") {
|
|
|
3132
3220
|
return promise;
|
|
3133
3221
|
}
|
|
3134
3222
|
function bindSaveAction(panelActions) {
|
|
3135
|
-
(0,
|
|
3223
|
+
(0, import_editor_v1_adapters5.registerDataHook)("dependency", "document/save/save", (args) => {
|
|
3136
3224
|
triggerSave(panelActions, args.status === "publish" ? "frontend" : "preview");
|
|
3137
3225
|
return true;
|
|
3138
3226
|
});
|
|
@@ -3153,11 +3241,15 @@ function isDirty() {
|
|
|
3153
3241
|
|
|
3154
3242
|
// src/sync-with-document.tsx
|
|
3155
3243
|
function SyncWithDocumentSave() {
|
|
3156
|
-
const
|
|
3244
|
+
const { open: openClassPanel } = usePanelActions();
|
|
3157
3245
|
(0, import_react14.useEffect)(() => {
|
|
3158
|
-
(0,
|
|
3159
|
-
|
|
3246
|
+
const unsubscribe = (0, import_editor_v1_adapters6.__privateListenTo)((0, import_editor_v1_adapters6.v1ReadyEvent)(), () => {
|
|
3247
|
+
const open = (0, import_editor_v1_adapters6.isExperimentActive)("e_editor_design_system_panel") ? () => {
|
|
3248
|
+
window.dispatchEvent(new CustomEvent("elementor/open-global-classes-manager"));
|
|
3249
|
+
} : openClassPanel;
|
|
3250
|
+
syncWithDocumentSave({ open });
|
|
3160
3251
|
});
|
|
3252
|
+
return unsubscribe;
|
|
3161
3253
|
}, []);
|
|
3162
3254
|
return null;
|
|
3163
3255
|
}
|
|
@@ -3165,7 +3257,9 @@ function SyncWithDocumentSave() {
|
|
|
3165
3257
|
// src/init.ts
|
|
3166
3258
|
function init() {
|
|
3167
3259
|
(0, import_store28.__registerSlice)(slice);
|
|
3168
|
-
(0,
|
|
3260
|
+
if (!(0, import_editor_v1_adapters7.isExperimentActive)("e_editor_design_system_panel")) {
|
|
3261
|
+
(0, import_editor_panels2.__registerPanel)(panel);
|
|
3262
|
+
}
|
|
3169
3263
|
import_editor_styles_repository5.stylesRepository.register(globalClassesStylesProvider);
|
|
3170
3264
|
(0, import_editor.injectIntoLogic)({
|
|
3171
3265
|
id: "global-classes-populate-store",
|
|
@@ -3183,10 +3277,12 @@ function init() {
|
|
|
3183
3277
|
id: "global-classes-prefetch-css-class-usage",
|
|
3184
3278
|
component: PrefetchCssClassUsage
|
|
3185
3279
|
});
|
|
3186
|
-
(0,
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3280
|
+
if (!(0, import_editor_v1_adapters7.isExperimentActive)("e_editor_design_system_panel")) {
|
|
3281
|
+
(0, import_editor.injectIntoLogic)({
|
|
3282
|
+
id: "global-classes-open-panel-from-url",
|
|
3283
|
+
component: OpenPanelFromUrl
|
|
3284
|
+
});
|
|
3285
|
+
}
|
|
3190
3286
|
(0, import_editor_editing_panel2.injectIntoCssClassConvert)({
|
|
3191
3287
|
id: "global-classes-convert-from-local-class",
|
|
3192
3288
|
component: ConvertLocalClassToGlobalClass
|
|
@@ -3206,6 +3302,7 @@ function init() {
|
|
|
3206
3302
|
}
|
|
3207
3303
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3208
3304
|
0 && (module.exports = {
|
|
3305
|
+
ClassManagerPanelEmbedded,
|
|
3209
3306
|
GLOBAL_CLASSES_URI,
|
|
3210
3307
|
init
|
|
3211
3308
|
});
|