@elementor/editor-global-classes 3.33.0-99 → 3.35.0-324
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.js +990 -428
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +931 -365
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -18
- package/src/api.ts +4 -0
- package/src/components/class-manager/class-manager-button.tsx +15 -1
- package/src/components/class-manager/class-manager-panel.tsx +2 -2
- package/src/components/class-manager/delete-class.ts +9 -3
- package/src/components/class-manager/delete-confirmation-dialog.tsx +2 -2
- package/src/components/class-manager/duplicate-label-dialog.tsx +159 -0
- package/src/components/class-manager/global-classes-list.tsx +53 -22
- package/src/components/convert-local-class-to-global-class.tsx +7 -0
- package/src/components/css-class-usage/components/css-class-usage-popover.tsx +10 -1
- package/src/components/css-class-usage/components/css-class-usage-trigger.tsx +22 -7
- package/src/components/search-and-filter/components/filter/active-filters.tsx +8 -0
- package/src/components/search-and-filter/components/filter/clear-icon-button.tsx +12 -3
- package/src/components/search-and-filter/components/filter/css-class-filter.tsx +10 -0
- package/src/components/search-and-filter/components/filter/filter-list.tsx +7 -0
- package/src/components/search-and-filter/components/search/class-manager-search.tsx +6 -0
- package/src/components/search-and-filter/context.tsx +12 -2
- package/src/errors.ts +5 -0
- package/src/global-classes-styles-provider.ts +13 -3
- package/src/hooks/use-css-class-by-id.ts +8 -0
- package/src/hooks/use-prefetch-css-class-usage.ts +6 -0
- package/src/init.ts +14 -5
- package/src/mcp-integration/classes-resource.ts +20 -0
- package/src/mcp-integration/index.ts +15 -0
- package/src/mcp-integration/mcp-apply-unapply-global-classes.ts +117 -0
- package/src/mcp-integration/mcp-get-global-class-usages.ts +72 -0
- package/src/save-global-classes.tsx +55 -0
- package/src/store.ts +15 -0
- package/src/sync-with-document-save.ts +9 -6
- package/src/sync-with-document.tsx +19 -0
- package/src/utils/tracking.ts +206 -0
- package/src/components/class-manager/save-changes-dialog.tsx +0 -92
- package/src/save-global-classes.ts +0 -42
package/dist/index.js
CHANGED
|
@@ -36,23 +36,23 @@ module.exports = __toCommonJS(index_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/init.ts
|
|
38
38
|
var import_editor = require("@elementor/editor");
|
|
39
|
-
var
|
|
39
|
+
var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
|
|
40
40
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var import_store24 = require("@elementor/store");
|
|
41
|
+
var import_editor_styles_repository6 = require("@elementor/editor-styles-repository");
|
|
42
|
+
var import_store26 = require("@elementor/store");
|
|
44
43
|
|
|
45
44
|
// src/components/class-manager/class-manager-button.tsx
|
|
46
|
-
var
|
|
45
|
+
var React19 = __toESM(require("react"));
|
|
47
46
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
48
47
|
var import_editor_styles_repository3 = require("@elementor/editor-styles-repository");
|
|
48
|
+
var import_editor_ui9 = require("@elementor/editor-ui");
|
|
49
49
|
var import_ui16 = require("@elementor/ui");
|
|
50
|
-
var
|
|
50
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
51
51
|
|
|
52
52
|
// src/global-classes-styles-provider.ts
|
|
53
53
|
var import_editor_styles2 = require("@elementor/editor-styles");
|
|
54
54
|
var import_editor_styles_repository = require("@elementor/editor-styles-repository");
|
|
55
|
-
var
|
|
55
|
+
var import_store4 = require("@elementor/store");
|
|
56
56
|
var import_i18n = require("@wordpress/i18n");
|
|
57
57
|
|
|
58
58
|
// src/capabilities.ts
|
|
@@ -81,6 +81,10 @@ var GlobalClassLabelAlreadyExistsError = (0, import_utils.createError)({
|
|
|
81
81
|
code: "global_class_label_already_exists",
|
|
82
82
|
message: "Class with this name already exists."
|
|
83
83
|
});
|
|
84
|
+
var GlobalClassTrackingError = (0, import_utils.createError)({
|
|
85
|
+
code: "global_class_tracking_error",
|
|
86
|
+
message: "Error tracking global classes event."
|
|
87
|
+
});
|
|
84
88
|
|
|
85
89
|
// src/store.ts
|
|
86
90
|
var import_editor_props = require("@elementor/editor-props");
|
|
@@ -199,6 +203,13 @@ var slice = (0, import_store.__createSlice)({
|
|
|
199
203
|
state.data.items[payload.style.id] = mergedData;
|
|
200
204
|
state.isDirty = true;
|
|
201
205
|
},
|
|
206
|
+
updateMultiple(state, { payload }) {
|
|
207
|
+
localHistory.next(state.data);
|
|
208
|
+
Object.entries(payload).forEach(([id2, { modified }]) => {
|
|
209
|
+
state.data.items[id2].label = modified;
|
|
210
|
+
});
|
|
211
|
+
state.isDirty = false;
|
|
212
|
+
},
|
|
202
213
|
updateProps(state, {
|
|
203
214
|
payload
|
|
204
215
|
}) {
|
|
@@ -278,8 +289,161 @@ var selectEmptyCssClass = (0, import_store.__createSelector)(
|
|
|
278
289
|
({ items }) => Object.values(items).filter((cssClass) => cssClass.variants.length === 0)
|
|
279
290
|
);
|
|
280
291
|
|
|
292
|
+
// src/utils/tracking.ts
|
|
293
|
+
var import_mixpanel = require("@elementor/mixpanel");
|
|
294
|
+
var import_store2 = require("@elementor/store");
|
|
295
|
+
|
|
296
|
+
// src/api.ts
|
|
297
|
+
var import_http_client = require("@elementor/http-client");
|
|
298
|
+
var RESOURCE_URL = "/global-classes";
|
|
299
|
+
var BASE_URL = "elementor/v1";
|
|
300
|
+
var RESOURCE_USAGE_URL = `${RESOURCE_URL}/usage`;
|
|
301
|
+
var apiClient = {
|
|
302
|
+
usage: () => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_USAGE_URL}`),
|
|
303
|
+
all: (context2 = "preview") => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_URL}`, {
|
|
304
|
+
params: { context: context2 }
|
|
305
|
+
}),
|
|
306
|
+
publish: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
307
|
+
params: {
|
|
308
|
+
context: "frontend"
|
|
309
|
+
}
|
|
310
|
+
}),
|
|
311
|
+
saveDraft: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
312
|
+
params: {
|
|
313
|
+
context: "preview"
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
};
|
|
317
|
+
var API_ERROR_CODES = {
|
|
318
|
+
DUPLICATED_LABEL: "DUPLICATED_LABEL"
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// src/components/css-class-usage/utils.ts
|
|
322
|
+
var transformData = (data) => Object.entries(data).reduce((acc, [key, value]) => {
|
|
323
|
+
acc[key] = {
|
|
324
|
+
content: value || [],
|
|
325
|
+
total: value.reduce((total, val) => total + (val?.total || 0), 0)
|
|
326
|
+
};
|
|
327
|
+
return acc;
|
|
328
|
+
}, {});
|
|
329
|
+
|
|
330
|
+
// service/css-class-usage-service.ts
|
|
331
|
+
var fetchCssClassUsage = async () => {
|
|
332
|
+
const response = await apiClient.usage();
|
|
333
|
+
return transformData(response?.data?.data || {});
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// src/utils/tracking.ts
|
|
337
|
+
var trackGlobalClasses = async (payload) => {
|
|
338
|
+
const { runAction } = payload;
|
|
339
|
+
const data = await getSanitizedData(payload);
|
|
340
|
+
if (data) {
|
|
341
|
+
track(data);
|
|
342
|
+
if (data.event === "classCreated" && "classId" in data) {
|
|
343
|
+
fireClassApplied(data.classId);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
runAction?.();
|
|
347
|
+
};
|
|
348
|
+
var fireClassApplied = async (classId) => {
|
|
349
|
+
const appliedInfo = await getAppliedInfo(classId);
|
|
350
|
+
track({
|
|
351
|
+
event: "classApplied",
|
|
352
|
+
classId,
|
|
353
|
+
...appliedInfo,
|
|
354
|
+
totalInstancesAfterApply: 1
|
|
355
|
+
});
|
|
356
|
+
};
|
|
357
|
+
var getSanitizedData = async (payload) => {
|
|
358
|
+
switch (payload.event) {
|
|
359
|
+
case "classApplied":
|
|
360
|
+
if ("classId" in payload && payload.classId) {
|
|
361
|
+
const appliedInfo = await getAppliedInfo(payload.classId);
|
|
362
|
+
return { ...payload, ...appliedInfo };
|
|
363
|
+
}
|
|
364
|
+
break;
|
|
365
|
+
case "classRemoved":
|
|
366
|
+
if ("classId" in payload && payload.classId) {
|
|
367
|
+
const deleteInfo = getRemovedInfo(payload.classId);
|
|
368
|
+
return { ...payload, ...deleteInfo };
|
|
369
|
+
}
|
|
370
|
+
break;
|
|
371
|
+
case "classDeleted":
|
|
372
|
+
if ("classId" in payload && payload.classId) {
|
|
373
|
+
const deleteInfo = await trackDeleteClass(payload.classId);
|
|
374
|
+
return { ...payload, ...deleteInfo };
|
|
375
|
+
}
|
|
376
|
+
break;
|
|
377
|
+
case "classCreated":
|
|
378
|
+
if ("source" in payload && payload.source !== "created") {
|
|
379
|
+
if ("classId" in payload && payload.classId) {
|
|
380
|
+
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return payload;
|
|
384
|
+
case "classStateClicked":
|
|
385
|
+
if ("classId" in payload && payload.classId) {
|
|
386
|
+
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
387
|
+
}
|
|
388
|
+
break;
|
|
389
|
+
default:
|
|
390
|
+
return payload;
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
var track = (data) => {
|
|
394
|
+
const { dispatchEvent, config } = (0, import_mixpanel.getMixpanel)();
|
|
395
|
+
if (!config?.names?.global_classes?.[data.event]) {
|
|
396
|
+
console.error("Global class tracking event not found", { event: data.event });
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const name = config.names.global_classes[data.event];
|
|
400
|
+
const { event, ...eventData } = data;
|
|
401
|
+
try {
|
|
402
|
+
dispatchEvent?.(name, {
|
|
403
|
+
event,
|
|
404
|
+
properties: {
|
|
405
|
+
...eventData
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
} catch (error) {
|
|
409
|
+
throw new GlobalClassTrackingError({ cause: error });
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
var extractCssClassData = (classId) => {
|
|
413
|
+
const cssClass = getCssClass(classId);
|
|
414
|
+
const classTitle = cssClass.label;
|
|
415
|
+
return { classTitle };
|
|
416
|
+
};
|
|
417
|
+
var getCssClass = (classId) => {
|
|
418
|
+
const cssClass = selectClass((0, import_store2.__getState)(), classId);
|
|
419
|
+
if (!cssClass) {
|
|
420
|
+
throw new Error(`CSS class with ID ${classId} not found`);
|
|
421
|
+
}
|
|
422
|
+
return cssClass;
|
|
423
|
+
};
|
|
424
|
+
var trackDeleteClass = async (classId) => {
|
|
425
|
+
const totalInstances = await getTotalInstancesByCssClassID(classId);
|
|
426
|
+
const classTitle = getCssClass(classId).label;
|
|
427
|
+
return { totalInstances, classTitle };
|
|
428
|
+
};
|
|
429
|
+
var getTotalInstancesByCssClassID = async (classId) => {
|
|
430
|
+
const cssClassUsage = await fetchCssClassUsage();
|
|
431
|
+
return cssClassUsage[classId]?.total ?? 1;
|
|
432
|
+
};
|
|
433
|
+
var getAppliedInfo = async (classId) => {
|
|
434
|
+
const { classTitle } = extractCssClassData(classId);
|
|
435
|
+
const totalInstancesAfterApply = await getTotalInstancesByCssClassID(classId) + 1;
|
|
436
|
+
return { classTitle, totalInstancesAfterApply };
|
|
437
|
+
};
|
|
438
|
+
var getRemovedInfo = (classId) => {
|
|
439
|
+
const { classTitle } = extractCssClassData(classId);
|
|
440
|
+
return {
|
|
441
|
+
classTitle
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
|
|
281
445
|
// src/global-classes-styles-provider.ts
|
|
282
|
-
var MAX_CLASSES =
|
|
446
|
+
var MAX_CLASSES = 100;
|
|
283
447
|
var GLOBAL_CLASSES_PROVIDER_KEY = "global-classes";
|
|
284
448
|
var globalClassesStylesProvider = (0, import_editor_styles_repository.createStylesProvider)({
|
|
285
449
|
key: GLOBAL_CLASSES_PROVIDER_KEY,
|
|
@@ -292,20 +456,24 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
|
|
|
292
456
|
subscribe: (cb) => subscribeWithStates(cb),
|
|
293
457
|
capabilities: getCapabilities(),
|
|
294
458
|
actions: {
|
|
295
|
-
all: () =>
|
|
296
|
-
|
|
459
|
+
all: () => {
|
|
460
|
+
const selectAllClasses = selectOrderedClasses((0, import_store4.__getState)());
|
|
461
|
+
localStorage.setItem("elementor-global-classes", JSON.stringify(selectAllClasses));
|
|
462
|
+
return selectAllClasses;
|
|
463
|
+
},
|
|
464
|
+
get: (id2) => selectClass((0, import_store4.__getState)(), id2),
|
|
297
465
|
resolveCssName: (id2) => {
|
|
298
|
-
return selectClass((0,
|
|
466
|
+
return selectClass((0, import_store4.__getState)(), id2)?.label ?? id2;
|
|
299
467
|
},
|
|
300
468
|
create: (label, variants = []) => {
|
|
301
|
-
const classes = selectGlobalClasses((0,
|
|
469
|
+
const classes = selectGlobalClasses((0, import_store4.__getState)());
|
|
302
470
|
const existingLabels = Object.values(classes).map((style) => style.label);
|
|
303
471
|
if (existingLabels.includes(label)) {
|
|
304
472
|
throw new GlobalClassLabelAlreadyExistsError({ context: { label } });
|
|
305
473
|
}
|
|
306
474
|
const existingIds = Object.keys(classes);
|
|
307
475
|
const id2 = (0, import_editor_styles2.generateId)("g-", existingIds);
|
|
308
|
-
(0,
|
|
476
|
+
(0, import_store4.__dispatch)(
|
|
309
477
|
slice.actions.add({
|
|
310
478
|
id: id2,
|
|
311
479
|
type: "class",
|
|
@@ -316,17 +484,17 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
|
|
|
316
484
|
return id2;
|
|
317
485
|
},
|
|
318
486
|
update: (payload) => {
|
|
319
|
-
(0,
|
|
487
|
+
(0, import_store4.__dispatch)(
|
|
320
488
|
slice.actions.update({
|
|
321
489
|
style: payload
|
|
322
490
|
})
|
|
323
491
|
);
|
|
324
492
|
},
|
|
325
493
|
delete: (id2) => {
|
|
326
|
-
(0,
|
|
494
|
+
(0, import_store4.__dispatch)(slice.actions.delete(id2));
|
|
327
495
|
},
|
|
328
496
|
updateProps: (args) => {
|
|
329
|
-
(0,
|
|
497
|
+
(0, import_store4.__dispatch)(
|
|
330
498
|
slice.actions.updateProps({
|
|
331
499
|
id: args.id,
|
|
332
500
|
meta: args.meta,
|
|
@@ -335,7 +503,7 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
|
|
|
335
503
|
);
|
|
336
504
|
},
|
|
337
505
|
updateCustomCss: (args) => {
|
|
338
|
-
(0,
|
|
506
|
+
(0, import_store4.__dispatch)(
|
|
339
507
|
slice.actions.updateProps({
|
|
340
508
|
id: args.id,
|
|
341
509
|
meta: args.meta,
|
|
@@ -343,12 +511,17 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
|
|
|
343
511
|
props: {}
|
|
344
512
|
})
|
|
345
513
|
);
|
|
514
|
+
},
|
|
515
|
+
tracking: (data) => {
|
|
516
|
+
trackGlobalClasses(data).catch((error) => {
|
|
517
|
+
throw new GlobalClassTrackingError({ cause: error });
|
|
518
|
+
});
|
|
346
519
|
}
|
|
347
520
|
}
|
|
348
521
|
});
|
|
349
522
|
var subscribeWithStates = (cb) => {
|
|
350
|
-
let previousState = selectData((0,
|
|
351
|
-
return (0,
|
|
523
|
+
let previousState = selectData((0, import_store4.__getState)());
|
|
524
|
+
return (0, import_store4.__subscribeWithSelector)(
|
|
352
525
|
(state) => state.globalClasses,
|
|
353
526
|
(currentState) => {
|
|
354
527
|
cb(previousState.items, currentState.data.items);
|
|
@@ -360,43 +533,6 @@ var subscribeWithStates = (cb) => {
|
|
|
360
533
|
// src/hooks/use-prefetch-css-class-usage.ts
|
|
361
534
|
var import_query = require("@elementor/query");
|
|
362
535
|
|
|
363
|
-
// src/api.ts
|
|
364
|
-
var import_http_client = require("@elementor/http-client");
|
|
365
|
-
var RESOURCE_URL = "/global-classes";
|
|
366
|
-
var BASE_URL = "elementor/v1";
|
|
367
|
-
var RESOURCE_USAGE_URL = `${RESOURCE_URL}/usage`;
|
|
368
|
-
var apiClient = {
|
|
369
|
-
usage: () => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_USAGE_URL}`),
|
|
370
|
-
all: (context2 = "preview") => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_URL}`, {
|
|
371
|
-
params: { context: context2 }
|
|
372
|
-
}),
|
|
373
|
-
publish: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
374
|
-
params: {
|
|
375
|
-
context: "frontend"
|
|
376
|
-
}
|
|
377
|
-
}),
|
|
378
|
-
saveDraft: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
379
|
-
params: {
|
|
380
|
-
context: "preview"
|
|
381
|
-
}
|
|
382
|
-
})
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
// src/components/css-class-usage/utils.ts
|
|
386
|
-
var transformData = (data) => Object.entries(data).reduce((acc, [key, value]) => {
|
|
387
|
-
acc[key] = {
|
|
388
|
-
content: value || [],
|
|
389
|
-
total: value.reduce((total, val) => total + (val?.total || 0), 0)
|
|
390
|
-
};
|
|
391
|
-
return acc;
|
|
392
|
-
}, {});
|
|
393
|
-
|
|
394
|
-
// service/css-class-usage-service.ts
|
|
395
|
-
var fetchCssClassUsage = async () => {
|
|
396
|
-
const response = await apiClient.usage();
|
|
397
|
-
return transformData(response.data.data);
|
|
398
|
-
};
|
|
399
|
-
|
|
400
536
|
// src/components/css-class-usage/types.ts
|
|
401
537
|
var QUERY_KEY = "css-classes-usage";
|
|
402
538
|
|
|
@@ -409,30 +545,35 @@ function usePrefetchCssClassUsage() {
|
|
|
409
545
|
});
|
|
410
546
|
return { prefetchClassesUsage };
|
|
411
547
|
}
|
|
548
|
+
var PrefetchCssClassUsage = () => {
|
|
549
|
+
const { prefetchClassesUsage } = usePrefetchCssClassUsage();
|
|
550
|
+
prefetchClassesUsage();
|
|
551
|
+
return null;
|
|
552
|
+
};
|
|
412
553
|
|
|
413
554
|
// src/components/class-manager/class-manager-panel.tsx
|
|
414
|
-
var
|
|
415
|
-
var
|
|
555
|
+
var React18 = __toESM(require("react"));
|
|
556
|
+
var import_react8 = require("react");
|
|
416
557
|
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
417
558
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
418
|
-
var
|
|
559
|
+
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
419
560
|
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
420
561
|
var import_icons12 = require("@elementor/icons");
|
|
421
562
|
var import_query3 = require("@elementor/query");
|
|
422
|
-
var
|
|
563
|
+
var import_store20 = require("@elementor/store");
|
|
423
564
|
var import_ui15 = require("@elementor/ui");
|
|
424
|
-
var
|
|
565
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
425
566
|
|
|
426
567
|
// src/hooks/use-classes-order.ts
|
|
427
|
-
var
|
|
568
|
+
var import_store6 = require("@elementor/store");
|
|
428
569
|
var useClassesOrder = () => {
|
|
429
|
-
return (0,
|
|
570
|
+
return (0, import_store6.__useSelector)(selectOrder);
|
|
430
571
|
};
|
|
431
572
|
|
|
432
573
|
// src/hooks/use-dirty-state.ts
|
|
433
|
-
var
|
|
574
|
+
var import_store8 = require("@elementor/store");
|
|
434
575
|
var useDirtyState = () => {
|
|
435
|
-
return (0,
|
|
576
|
+
return (0, import_store8.__useSelector)(selectIsDirty);
|
|
436
577
|
};
|
|
437
578
|
|
|
438
579
|
// src/hooks/use-filters.ts
|
|
@@ -450,9 +591,17 @@ var INIT_CHECKED_FILTERS = {
|
|
|
450
591
|
};
|
|
451
592
|
var SearchAndFilterProvider = ({ children }) => {
|
|
452
593
|
const [filters, setFilters] = React.useState(INIT_CHECKED_FILTERS);
|
|
594
|
+
const getInitialSearchValue = () => {
|
|
595
|
+
const storedValue = localStorage.getItem("elementor-global-classes-search");
|
|
596
|
+
if (storedValue) {
|
|
597
|
+
localStorage.removeItem("elementor-global-classes-search");
|
|
598
|
+
return storedValue;
|
|
599
|
+
}
|
|
600
|
+
return "";
|
|
601
|
+
};
|
|
453
602
|
const { debouncedValue, inputValue, handleChange } = (0, import_utils3.useDebounceState)({
|
|
454
603
|
delay: 300,
|
|
455
|
-
initialValue:
|
|
604
|
+
initialValue: getInitialSearchValue()
|
|
456
605
|
});
|
|
457
606
|
const onClearSearch = () => {
|
|
458
607
|
handleChange("");
|
|
@@ -504,12 +653,12 @@ var useCssClassUsage = () => {
|
|
|
504
653
|
};
|
|
505
654
|
|
|
506
655
|
// src/hooks/use-empty-css-class.ts
|
|
507
|
-
var
|
|
656
|
+
var import_store10 = require("@elementor/store");
|
|
508
657
|
var useEmptyCssClass = () => {
|
|
509
|
-
return (0,
|
|
658
|
+
return (0, import_store10.__useSelector)(selectEmptyCssClass);
|
|
510
659
|
};
|
|
511
660
|
var useAllCssClassesIDs = () => {
|
|
512
|
-
const cssClasses = (0,
|
|
661
|
+
const cssClasses = (0, import_store10.__useSelector)(selectGlobalClasses);
|
|
513
662
|
return Object.keys(cssClasses);
|
|
514
663
|
};
|
|
515
664
|
|
|
@@ -583,25 +732,139 @@ var useFilters = () => {
|
|
|
583
732
|
}, [filters, allFilters]);
|
|
584
733
|
};
|
|
585
734
|
|
|
586
|
-
// src/save-global-classes.
|
|
587
|
-
var
|
|
735
|
+
// src/save-global-classes.tsx
|
|
736
|
+
var React3 = __toESM(require("react"));
|
|
737
|
+
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
738
|
+
var import_store12 = require("@elementor/store");
|
|
588
739
|
var import_utils4 = require("@elementor/utils");
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
740
|
+
|
|
741
|
+
// src/components/class-manager/duplicate-label-dialog.tsx
|
|
742
|
+
var React2 = __toESM(require("react"));
|
|
743
|
+
var import_editor_ui = require("@elementor/editor-ui");
|
|
744
|
+
var import_icons = require("@elementor/icons");
|
|
745
|
+
var import_ui = require("@elementor/ui");
|
|
746
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
747
|
+
var DUP_PREFIX = "DUP_";
|
|
748
|
+
var DuplicateLabelDialog = ({
|
|
749
|
+
modifiedLabels,
|
|
750
|
+
onApprove
|
|
751
|
+
}) => {
|
|
752
|
+
const handleButtonClick = () => {
|
|
753
|
+
localStorage.setItem("elementor-global-classes-search", DUP_PREFIX);
|
|
754
|
+
onApprove?.();
|
|
755
|
+
(0, import_editor_ui.closeDialog)();
|
|
756
|
+
};
|
|
757
|
+
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_i18n2.__)("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_i18n2.__)(
|
|
758
|
+
"Some new classes used the same names as existing ones. To prevent conflicts, we added the prefix",
|
|
759
|
+
"elementor"
|
|
760
|
+
), /* @__PURE__ */ React2.createElement("strong", null, " ", DUP_PREFIX)), /* @__PURE__ */ React2.createElement(import_ui.Box, null, /* @__PURE__ */ React2.createElement(
|
|
761
|
+
import_ui.Box,
|
|
762
|
+
{
|
|
763
|
+
sx: {
|
|
764
|
+
width: "100%",
|
|
765
|
+
display: "flex",
|
|
766
|
+
gap: 2,
|
|
767
|
+
alignItems: "flex-start"
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
/* @__PURE__ */ React2.createElement(
|
|
771
|
+
import_ui.Typography,
|
|
772
|
+
{
|
|
773
|
+
variant: "subtitle2",
|
|
774
|
+
sx: {
|
|
775
|
+
fontWeight: "bold",
|
|
776
|
+
flex: 1,
|
|
777
|
+
flexShrink: 1,
|
|
778
|
+
flexGrow: 1,
|
|
779
|
+
minWidth: 0
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
(0, import_i18n2.__)("Before", "elementor")
|
|
783
|
+
),
|
|
784
|
+
/* @__PURE__ */ React2.createElement(
|
|
785
|
+
import_ui.Typography,
|
|
786
|
+
{
|
|
787
|
+
variant: "subtitle2",
|
|
788
|
+
sx: {
|
|
789
|
+
minWidth: "200px",
|
|
790
|
+
fontWeight: "bold",
|
|
791
|
+
flexShrink: 0,
|
|
792
|
+
flexGrow: 0,
|
|
793
|
+
width: "200px",
|
|
794
|
+
maxWidth: "200px"
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
(0, import_i18n2.__)("After", "elementor")
|
|
798
|
+
)
|
|
799
|
+
), /* @__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(
|
|
800
|
+
import_ui.Box,
|
|
801
|
+
{
|
|
802
|
+
key: index,
|
|
803
|
+
sx: {
|
|
804
|
+
width: "100%",
|
|
805
|
+
display: "flex",
|
|
806
|
+
gap: 2,
|
|
807
|
+
alignItems: "flex-start"
|
|
808
|
+
}
|
|
809
|
+
},
|
|
810
|
+
/* @__PURE__ */ React2.createElement(
|
|
811
|
+
import_ui.Box,
|
|
812
|
+
{
|
|
813
|
+
sx: {
|
|
814
|
+
flex: 1,
|
|
815
|
+
flexShrink: 1,
|
|
816
|
+
flexGrow: 1,
|
|
817
|
+
minWidth: 0
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
/* @__PURE__ */ React2.createElement(import_editor_ui.EllipsisWithTooltip, { title: original }, /* @__PURE__ */ React2.createElement(import_ui.Typography, { variant: "body2", sx: { color: "text.secondary" } }, original))
|
|
821
|
+
),
|
|
822
|
+
/* @__PURE__ */ React2.createElement(
|
|
823
|
+
import_ui.Box,
|
|
824
|
+
{
|
|
825
|
+
sx: {
|
|
826
|
+
minWidth: "200px",
|
|
827
|
+
flexShrink: 0,
|
|
828
|
+
flexGrow: 0,
|
|
829
|
+
width: "200px",
|
|
830
|
+
maxWidth: "200px"
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
/* @__PURE__ */ React2.createElement(import_editor_ui.EllipsisWithTooltip, { title: modified }, /* @__PURE__ */ React2.createElement(import_ui.Typography, { variant: "body2", sx: { color: "text.primary" } }, modified))
|
|
834
|
+
)
|
|
835
|
+
))), /* @__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_i18n2.__)("Your designs and classes are safe.", "elementor")), (0, import_i18n2.__)(
|
|
836
|
+
"Only the prefixes were added. Find them in Class Manager by searching",
|
|
837
|
+
"elementor"
|
|
838
|
+
), /* @__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_i18n2.__)("Go to Class Manager", "elementor")), /* @__PURE__ */ React2.createElement(import_ui.Button, { color: "secondary", variant: "contained", onClick: import_editor_ui.closeDialog }, (0, import_i18n2.__)("Done", "elementor"))));
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
// src/save-global-classes.tsx
|
|
842
|
+
async function saveGlobalClasses({ context: context2, onApprove }) {
|
|
843
|
+
const state = selectData((0, import_store12.__getState)());
|
|
844
|
+
const apiAction = context2 === "preview" ? apiClient.saveDraft : apiClient.publish;
|
|
845
|
+
const currentContext = context2 === "preview" ? selectPreviewInitialData : selectFrontendInitialData;
|
|
846
|
+
const response = await apiAction({
|
|
847
|
+
items: state.items,
|
|
848
|
+
order: state.order,
|
|
849
|
+
changes: calculateChanges(state, currentContext((0, import_store12.__getState)()))
|
|
850
|
+
});
|
|
851
|
+
(0, import_store12.__dispatch)(slice.actions.reset({ context: context2 }));
|
|
852
|
+
if (response?.data?.data?.code === API_ERROR_CODES.DUPLICATED_LABEL) {
|
|
853
|
+
(0, import_store12.__dispatch)(slice.actions.updateMultiple(response.data.data.modifiedLabels));
|
|
854
|
+
trackGlobalClasses({
|
|
855
|
+
event: "classPublishConflict",
|
|
856
|
+
numOfConflicts: Object.keys(response.data.data.modifiedLabels).length
|
|
596
857
|
});
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
858
|
+
(0, import_editor_ui2.openDialog)({
|
|
859
|
+
component: /* @__PURE__ */ React3.createElement(
|
|
860
|
+
DuplicateLabelDialog,
|
|
861
|
+
{
|
|
862
|
+
modifiedLabels: response.data.data.modifiedLabels || [],
|
|
863
|
+
onApprove
|
|
864
|
+
}
|
|
865
|
+
)
|
|
602
866
|
});
|
|
603
867
|
}
|
|
604
|
-
(0, import_store10.__dispatch)(slice.actions.reset({ context: context2 }));
|
|
605
868
|
}
|
|
606
869
|
function calculateChanges(state, initialData) {
|
|
607
870
|
const stateIds = Object.keys(state.items);
|
|
@@ -616,21 +879,28 @@ function calculateChanges(state, initialData) {
|
|
|
616
879
|
}
|
|
617
880
|
|
|
618
881
|
// src/components/search-and-filter/components/filter/active-filters.tsx
|
|
619
|
-
var
|
|
620
|
-
var
|
|
621
|
-
var
|
|
882
|
+
var React6 = __toESM(require("react"));
|
|
883
|
+
var import_ui4 = require("@elementor/ui");
|
|
884
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
622
885
|
|
|
623
886
|
// src/components/search-and-filter/components/filter/clear-icon-button.tsx
|
|
624
|
-
var
|
|
625
|
-
var
|
|
626
|
-
var
|
|
627
|
-
var ClearIconButton = ({ tooltipText, sx }) => {
|
|
887
|
+
var React4 = __toESM(require("react"));
|
|
888
|
+
var import_icons2 = require("@elementor/icons");
|
|
889
|
+
var import_ui2 = require("@elementor/ui");
|
|
890
|
+
var ClearIconButton = ({ tooltipText, sx, trigger }) => {
|
|
628
891
|
const {
|
|
629
892
|
filters: { onClearFilter }
|
|
630
893
|
} = useSearchAndFilters();
|
|
631
|
-
|
|
894
|
+
const handleClearFilters = () => {
|
|
895
|
+
onClearFilter(trigger);
|
|
896
|
+
trackGlobalClasses({
|
|
897
|
+
event: "classManagerFilterCleared",
|
|
898
|
+
trigger
|
|
899
|
+
});
|
|
900
|
+
};
|
|
901
|
+
return /* @__PURE__ */ React4.createElement(import_ui2.Tooltip, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React4.createElement(import_ui2.Box, null, /* @__PURE__ */ React4.createElement(CustomIconButton, { "aria-label": tooltipText, size: "tiny", onClick: handleClearFilters, sx }, /* @__PURE__ */ React4.createElement(import_icons2.BrushBigIcon, { fontSize: "tiny" }))));
|
|
632
902
|
};
|
|
633
|
-
var CustomIconButton = (0,
|
|
903
|
+
var CustomIconButton = (0, import_ui2.styled)(import_ui2.IconButton)(({ theme }) => ({
|
|
634
904
|
"&.Mui-disabled": {
|
|
635
905
|
pointerEvents: "auto",
|
|
636
906
|
"&:hover": {
|
|
@@ -640,13 +910,13 @@ var CustomIconButton = (0, import_ui.styled)(import_ui.IconButton)(({ theme }) =
|
|
|
640
910
|
}));
|
|
641
911
|
|
|
642
912
|
// src/components/search-and-filter/components/filter/filter-list.tsx
|
|
643
|
-
var
|
|
644
|
-
var
|
|
645
|
-
var
|
|
913
|
+
var React5 = __toESM(require("react"));
|
|
914
|
+
var import_ui3 = require("@elementor/ui");
|
|
915
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
646
916
|
var filterConfig = {
|
|
647
|
-
unused: (0,
|
|
648
|
-
empty: (0,
|
|
649
|
-
onThisPage: (0,
|
|
917
|
+
unused: (0, import_i18n3.__)("Unused", "elementor"),
|
|
918
|
+
empty: (0, import_i18n3.__)("Empty", "elementor"),
|
|
919
|
+
onThisPage: (0, import_i18n3.__)("On this page", "elementor")
|
|
650
920
|
};
|
|
651
921
|
var FilterList = () => {
|
|
652
922
|
const {
|
|
@@ -655,32 +925,38 @@ var FilterList = () => {
|
|
|
655
925
|
const filteredCssClass = useFilteredCssClassUsage();
|
|
656
926
|
const handleOnClick = (value) => {
|
|
657
927
|
setFilters((prev) => ({ ...prev, [value]: !prev[value] }));
|
|
928
|
+
trackGlobalClasses({
|
|
929
|
+
event: "classManagerFilterUsed",
|
|
930
|
+
action: filters[value] ? "remove" : "apply",
|
|
931
|
+
type: value,
|
|
932
|
+
trigger: "menu"
|
|
933
|
+
});
|
|
658
934
|
};
|
|
659
|
-
return /* @__PURE__ */
|
|
935
|
+
return /* @__PURE__ */ React5.createElement(import_ui3.MenuList, null, /* @__PURE__ */ React5.createElement(import_ui3.MenuItem, { onClick: () => handleOnClick("unused") }, /* @__PURE__ */ React5.createElement(
|
|
660
936
|
LabeledCheckbox,
|
|
661
937
|
{
|
|
662
938
|
label: filterConfig.unused,
|
|
663
939
|
checked: filters.unused,
|
|
664
|
-
suffix: /* @__PURE__ */
|
|
940
|
+
suffix: /* @__PURE__ */ React5.createElement(import_ui3.Chip, { size: "tiny", sx: { ml: "auto" }, label: filteredCssClass.unused.length })
|
|
665
941
|
}
|
|
666
|
-
)), /* @__PURE__ */
|
|
942
|
+
)), /* @__PURE__ */ React5.createElement(import_ui3.MenuItem, { onClick: () => handleOnClick("empty") }, /* @__PURE__ */ React5.createElement(
|
|
667
943
|
LabeledCheckbox,
|
|
668
944
|
{
|
|
669
945
|
label: filterConfig.empty,
|
|
670
946
|
checked: filters.empty,
|
|
671
|
-
suffix: /* @__PURE__ */
|
|
947
|
+
suffix: /* @__PURE__ */ React5.createElement(import_ui3.Chip, { size: "tiny", sx: { ml: "auto" }, label: filteredCssClass.empty.length })
|
|
672
948
|
}
|
|
673
|
-
)), /* @__PURE__ */
|
|
949
|
+
)), /* @__PURE__ */ React5.createElement(import_ui3.MenuItem, { onClick: () => handleOnClick("onThisPage") }, /* @__PURE__ */ React5.createElement(
|
|
674
950
|
LabeledCheckbox,
|
|
675
951
|
{
|
|
676
952
|
label: filterConfig.onThisPage,
|
|
677
953
|
checked: filters.onThisPage,
|
|
678
|
-
suffix: /* @__PURE__ */
|
|
954
|
+
suffix: /* @__PURE__ */ React5.createElement(import_ui3.Chip, { size: "tiny", sx: { ml: "auto" }, label: filteredCssClass.onThisPage.length })
|
|
679
955
|
}
|
|
680
956
|
)));
|
|
681
957
|
};
|
|
682
|
-
var LabeledCheckbox = ({ label, suffix, checked }) => /* @__PURE__ */
|
|
683
|
-
|
|
958
|
+
var LabeledCheckbox = ({ label, suffix, checked }) => /* @__PURE__ */ React5.createElement(import_ui3.Stack, { direction: "row", alignItems: "center", gap: 0.5, flex: 1 }, /* @__PURE__ */ React5.createElement(
|
|
959
|
+
import_ui3.Checkbox,
|
|
684
960
|
{
|
|
685
961
|
size: "small",
|
|
686
962
|
checked,
|
|
@@ -692,7 +968,7 @@ var LabeledCheckbox = ({ label, suffix, checked }) => /* @__PURE__ */ React3.cre
|
|
|
692
968
|
}
|
|
693
969
|
}
|
|
694
970
|
}
|
|
695
|
-
), /* @__PURE__ */
|
|
971
|
+
), /* @__PURE__ */ React5.createElement(import_ui3.Typography, { variant: "caption", sx: { color: "text.secondary" } }, label), suffix);
|
|
696
972
|
|
|
697
973
|
// src/components/search-and-filter/components/filter/active-filters.tsx
|
|
698
974
|
var ActiveFilters = () => {
|
|
@@ -701,11 +977,17 @@ var ActiveFilters = () => {
|
|
|
701
977
|
} = useSearchAndFilters();
|
|
702
978
|
const handleRemove = (key) => {
|
|
703
979
|
setFilters((prev) => ({ ...prev, [key]: false }));
|
|
980
|
+
trackGlobalClasses({
|
|
981
|
+
event: "classManagerFilterUsed",
|
|
982
|
+
action: "remove",
|
|
983
|
+
type: key,
|
|
984
|
+
trigger: "header"
|
|
985
|
+
});
|
|
704
986
|
};
|
|
705
987
|
const activeKeys = Object.keys(filters).filter((key) => filters[key]);
|
|
706
988
|
const showClearIcon = activeKeys.length > 0;
|
|
707
|
-
return /* @__PURE__ */
|
|
708
|
-
|
|
989
|
+
return /* @__PURE__ */ React6.createElement(import_ui4.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React6.createElement(import_ui4.Stack, { direction: "row", gap: 0.5, alignItems: "center", flexWrap: "wrap" }, activeKeys.map((key) => /* @__PURE__ */ React6.createElement(
|
|
990
|
+
import_ui4.Chip,
|
|
709
991
|
{
|
|
710
992
|
key,
|
|
711
993
|
label: filterConfig[key],
|
|
@@ -713,10 +995,11 @@ var ActiveFilters = () => {
|
|
|
713
995
|
sx: chipSx,
|
|
714
996
|
size: "tiny"
|
|
715
997
|
}
|
|
716
|
-
))), showClearIcon && /* @__PURE__ */
|
|
998
|
+
))), showClearIcon && /* @__PURE__ */ React6.createElement(
|
|
717
999
|
ClearIconButton,
|
|
718
1000
|
{
|
|
719
|
-
|
|
1001
|
+
trigger: "header",
|
|
1002
|
+
tooltipText: (0, import_i18n4.__)("Clear Filters", "elementor"),
|
|
720
1003
|
sx: { margin: "0 0 auto auto" }
|
|
721
1004
|
}
|
|
722
1005
|
));
|
|
@@ -732,31 +1015,38 @@ var chipSx = {
|
|
|
732
1015
|
};
|
|
733
1016
|
|
|
734
1017
|
// src/components/search-and-filter/components/filter/css-class-filter.tsx
|
|
735
|
-
var
|
|
736
|
-
var
|
|
737
|
-
var
|
|
738
|
-
var
|
|
739
|
-
var
|
|
1018
|
+
var React7 = __toESM(require("react"));
|
|
1019
|
+
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1020
|
+
var import_icons3 = require("@elementor/icons");
|
|
1021
|
+
var import_ui5 = require("@elementor/ui");
|
|
1022
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
740
1023
|
var CssClassFilter = () => {
|
|
741
1024
|
const {
|
|
742
1025
|
filters: { filters }
|
|
743
1026
|
} = useSearchAndFilters();
|
|
744
|
-
const popupState = (0,
|
|
1027
|
+
const popupState = (0, import_ui5.usePopupState)({
|
|
745
1028
|
variant: "popover",
|
|
746
1029
|
disableAutoFocus: true
|
|
747
1030
|
});
|
|
1031
|
+
React7.useEffect(() => {
|
|
1032
|
+
if (popupState.isOpen) {
|
|
1033
|
+
trackGlobalClasses({
|
|
1034
|
+
event: "classManagerFiltersOpened"
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
}, [popupState.isOpen]);
|
|
748
1038
|
const showCleanIcon = Object.values(filters).some((value) => value);
|
|
749
|
-
return /* @__PURE__ */
|
|
750
|
-
|
|
1039
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui5.Tooltip, { title: (0, import_i18n5.__)("Filters", "elementor"), placement: "top" }, /* @__PURE__ */ React7.createElement(
|
|
1040
|
+
import_ui5.ToggleButton,
|
|
751
1041
|
{
|
|
752
1042
|
value: "filter",
|
|
753
1043
|
size: "tiny",
|
|
754
1044
|
selected: popupState.isOpen,
|
|
755
|
-
...(0,
|
|
1045
|
+
...(0, import_ui5.bindToggle)(popupState)
|
|
756
1046
|
},
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
)), /* @__PURE__ */
|
|
759
|
-
|
|
1047
|
+
/* @__PURE__ */ React7.createElement(import_icons3.FilterIcon, { fontSize: "tiny" })
|
|
1048
|
+
)), /* @__PURE__ */ React7.createElement(
|
|
1049
|
+
import_ui5.Popover,
|
|
760
1050
|
{
|
|
761
1051
|
sx: {
|
|
762
1052
|
maxWidth: "344px"
|
|
@@ -769,78 +1059,84 @@ var CssClassFilter = () => {
|
|
|
769
1059
|
vertical: "top",
|
|
770
1060
|
horizontal: -21
|
|
771
1061
|
},
|
|
772
|
-
...(0,
|
|
1062
|
+
...(0, import_ui5.bindPopover)(popupState)
|
|
773
1063
|
},
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
|
|
1064
|
+
/* @__PURE__ */ React7.createElement(
|
|
1065
|
+
import_editor_ui3.PopoverHeader,
|
|
776
1066
|
{
|
|
777
1067
|
actions: showCleanIcon ? [
|
|
778
|
-
/* @__PURE__ */
|
|
1068
|
+
/* @__PURE__ */ React7.createElement(
|
|
779
1069
|
ClearIconButton,
|
|
780
1070
|
{
|
|
1071
|
+
trigger: "menu",
|
|
781
1072
|
key: "clear-all-button",
|
|
782
|
-
tooltipText: (0,
|
|
1073
|
+
tooltipText: (0, import_i18n5.__)("Clear all", "elementor")
|
|
783
1074
|
}
|
|
784
1075
|
)
|
|
785
1076
|
] : [],
|
|
786
1077
|
onClose: popupState.close,
|
|
787
|
-
title: (0,
|
|
788
|
-
icon: /* @__PURE__ */
|
|
1078
|
+
title: (0, import_i18n5.__)("Filters", "elementor"),
|
|
1079
|
+
icon: /* @__PURE__ */ React7.createElement(import_icons3.FilterIcon, { fontSize: "tiny" })
|
|
789
1080
|
}
|
|
790
1081
|
),
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
|
|
1082
|
+
/* @__PURE__ */ React7.createElement(
|
|
1083
|
+
import_ui5.Divider,
|
|
793
1084
|
{
|
|
794
1085
|
sx: {
|
|
795
1086
|
borderWidth: "1px 0 0 0"
|
|
796
1087
|
}
|
|
797
1088
|
}
|
|
798
1089
|
),
|
|
799
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ React7.createElement(import_editor_ui3.PopoverBody, { width: 344, height: 125 }, /* @__PURE__ */ React7.createElement(FilterList, null))
|
|
800
1091
|
));
|
|
801
1092
|
};
|
|
802
1093
|
|
|
803
1094
|
// src/components/search-and-filter/components/search/class-manager-search.tsx
|
|
804
|
-
var
|
|
805
|
-
var
|
|
806
|
-
var
|
|
807
|
-
var
|
|
1095
|
+
var React8 = __toESM(require("react"));
|
|
1096
|
+
var import_icons4 = require("@elementor/icons");
|
|
1097
|
+
var import_ui6 = require("@elementor/ui");
|
|
1098
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
808
1099
|
var ClassManagerSearch = () => {
|
|
809
1100
|
const {
|
|
810
1101
|
search: { inputValue, handleChange }
|
|
811
1102
|
} = useSearchAndFilters();
|
|
812
|
-
return /* @__PURE__ */
|
|
813
|
-
|
|
1103
|
+
return /* @__PURE__ */ React8.createElement(import_ui6.Stack, { direction: "row", gap: 0.5, sx: { width: "100%" } }, /* @__PURE__ */ React8.createElement(import_ui6.Box, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React8.createElement(
|
|
1104
|
+
import_ui6.TextField,
|
|
814
1105
|
{
|
|
815
1106
|
role: "search",
|
|
816
1107
|
fullWidth: true,
|
|
817
1108
|
size: "tiny",
|
|
818
1109
|
value: inputValue,
|
|
819
|
-
|
|
1110
|
+
onFocus: () => {
|
|
1111
|
+
trackGlobalClasses({
|
|
1112
|
+
event: "classManagerSearched"
|
|
1113
|
+
});
|
|
1114
|
+
},
|
|
1115
|
+
placeholder: (0, import_i18n6.__)("Search", "elementor"),
|
|
820
1116
|
onChange: (e) => handleChange(e.target.value),
|
|
821
1117
|
InputProps: {
|
|
822
|
-
startAdornment: /* @__PURE__ */
|
|
1118
|
+
startAdornment: /* @__PURE__ */ React8.createElement(import_ui6.InputAdornment, { position: "start" }, /* @__PURE__ */ React8.createElement(import_icons4.SearchIcon, { fontSize: "tiny" }))
|
|
823
1119
|
}
|
|
824
1120
|
}
|
|
825
1121
|
)));
|
|
826
1122
|
};
|
|
827
1123
|
|
|
828
1124
|
// src/components/class-manager/class-manager-introduction.tsx
|
|
829
|
-
var
|
|
1125
|
+
var React9 = __toESM(require("react"));
|
|
830
1126
|
var import_react4 = require("react");
|
|
831
1127
|
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
832
|
-
var
|
|
833
|
-
var
|
|
834
|
-
var
|
|
1128
|
+
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1129
|
+
var import_ui7 = require("@elementor/ui");
|
|
1130
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
835
1131
|
var MESSAGE_KEY = "global-class-manager";
|
|
836
1132
|
var ClassManagerIntroduction = () => {
|
|
837
1133
|
const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user.useSuppressedMessage)(MESSAGE_KEY);
|
|
838
1134
|
const [shouldShowIntroduction, setShouldShowIntroduction] = (0, import_react4.useState)(!isMessageSuppressed);
|
|
839
|
-
return /* @__PURE__ */
|
|
840
|
-
|
|
1135
|
+
return /* @__PURE__ */ React9.createElement(
|
|
1136
|
+
import_editor_ui4.IntroductionModal,
|
|
841
1137
|
{
|
|
842
1138
|
open: shouldShowIntroduction,
|
|
843
|
-
title: (0,
|
|
1139
|
+
title: (0, import_i18n7.__)("Class Manager", "elementor"),
|
|
844
1140
|
handleClose: (shouldShowAgain) => {
|
|
845
1141
|
if (!shouldShowAgain) {
|
|
846
1142
|
suppressMessage();
|
|
@@ -848,22 +1144,22 @@ var ClassManagerIntroduction = () => {
|
|
|
848
1144
|
setShouldShowIntroduction(false);
|
|
849
1145
|
}
|
|
850
1146
|
},
|
|
851
|
-
/* @__PURE__ */
|
|
852
|
-
|
|
1147
|
+
/* @__PURE__ */ React9.createElement(
|
|
1148
|
+
import_ui7.Image,
|
|
853
1149
|
{
|
|
854
1150
|
sx: { width: "100%", aspectRatio: "16 / 9" },
|
|
855
1151
|
src: "https://assets.elementor.com/packages/v1/images/class-manager-intro.svg",
|
|
856
1152
|
alt: ""
|
|
857
1153
|
}
|
|
858
1154
|
),
|
|
859
|
-
/* @__PURE__ */
|
|
1155
|
+
/* @__PURE__ */ React9.createElement(IntroductionContent, null)
|
|
860
1156
|
);
|
|
861
1157
|
};
|
|
862
1158
|
var IntroductionContent = () => {
|
|
863
|
-
return /* @__PURE__ */
|
|
1159
|
+
return /* @__PURE__ */ React9.createElement(import_ui7.Box, { p: 3 }, /* @__PURE__ */ React9.createElement(import_ui7.Typography, { variant: "body2" }, (0, import_i18n7.__)(
|
|
864
1160
|
"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.",
|
|
865
1161
|
"elementor"
|
|
866
|
-
)), /* @__PURE__ */
|
|
1162
|
+
)), /* @__PURE__ */ React9.createElement("br", null), /* @__PURE__ */ React9.createElement(import_ui7.Typography, { variant: "body2" }, (0, import_i18n7.__)(
|
|
867
1163
|
"Remember, when editing an item within a specific class, any changes you make will apply across all elements in that class.",
|
|
868
1164
|
"elementor"
|
|
869
1165
|
)));
|
|
@@ -872,11 +1168,17 @@ var IntroductionContent = () => {
|
|
|
872
1168
|
// src/components/class-manager/delete-class.ts
|
|
873
1169
|
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
874
1170
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
875
|
-
var
|
|
1171
|
+
var import_store14 = require("@elementor/store");
|
|
876
1172
|
var isDeleted = false;
|
|
877
1173
|
var deleteClass = (id2) => {
|
|
878
|
-
(
|
|
879
|
-
|
|
1174
|
+
trackGlobalClasses({
|
|
1175
|
+
event: "classDeleted",
|
|
1176
|
+
classId: id2,
|
|
1177
|
+
runAction: () => {
|
|
1178
|
+
(0, import_store14.__dispatch)(slice.actions.delete(id2));
|
|
1179
|
+
isDeleted = true;
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
880
1182
|
};
|
|
881
1183
|
var onDelete = async () => {
|
|
882
1184
|
await reloadDocument();
|
|
@@ -895,39 +1197,39 @@ var reloadDocument = () => {
|
|
|
895
1197
|
};
|
|
896
1198
|
|
|
897
1199
|
// src/components/class-manager/flipped-color-swatch-icon.tsx
|
|
898
|
-
var
|
|
899
|
-
var
|
|
900
|
-
var FlippedColorSwatchIcon = ({ sx, ...props }) => /* @__PURE__ */
|
|
1200
|
+
var React10 = __toESM(require("react"));
|
|
1201
|
+
var import_icons5 = require("@elementor/icons");
|
|
1202
|
+
var FlippedColorSwatchIcon = ({ sx, ...props }) => /* @__PURE__ */ React10.createElement(import_icons5.ColorSwatchIcon, { sx: { transform: "rotate(90deg)", ...sx }, ...props });
|
|
901
1203
|
|
|
902
1204
|
// src/components/class-manager/global-classes-list.tsx
|
|
903
|
-
var
|
|
1205
|
+
var React17 = __toESM(require("react"));
|
|
904
1206
|
var import_react7 = require("react");
|
|
905
|
-
var
|
|
906
|
-
var
|
|
907
|
-
var
|
|
1207
|
+
var import_store18 = require("@elementor/store");
|
|
1208
|
+
var import_ui14 = require("@elementor/ui");
|
|
1209
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
908
1210
|
|
|
909
1211
|
// src/hooks/use-ordered-classes.ts
|
|
910
|
-
var
|
|
1212
|
+
var import_store16 = require("@elementor/store");
|
|
911
1213
|
var useOrderedClasses = () => {
|
|
912
|
-
return (0,
|
|
1214
|
+
return (0, import_store16.__useSelector)(selectOrderedClasses);
|
|
913
1215
|
};
|
|
914
1216
|
|
|
915
1217
|
// src/components/class-manager/class-item.tsx
|
|
916
|
-
var
|
|
1218
|
+
var React15 = __toESM(require("react"));
|
|
917
1219
|
var import_react6 = require("react");
|
|
918
1220
|
var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
|
|
919
|
-
var
|
|
920
|
-
var
|
|
921
|
-
var
|
|
922
|
-
var
|
|
1221
|
+
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
1222
|
+
var import_icons10 = require("@elementor/icons");
|
|
1223
|
+
var import_ui12 = require("@elementor/ui");
|
|
1224
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
923
1225
|
|
|
924
1226
|
// src/components/css-class-usage/components/css-class-usage-popover.tsx
|
|
925
|
-
var
|
|
1227
|
+
var React11 = __toESM(require("react"));
|
|
926
1228
|
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
927
|
-
var
|
|
928
|
-
var
|
|
929
|
-
var
|
|
930
|
-
var
|
|
1229
|
+
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
1230
|
+
var import_icons6 = require("@elementor/icons");
|
|
1231
|
+
var import_ui8 = require("@elementor/ui");
|
|
1232
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
931
1233
|
|
|
932
1234
|
// src/hooks/use-css-class-usage-by-id.ts
|
|
933
1235
|
var EMPTY_CLASS_USAGE = {
|
|
@@ -943,24 +1245,24 @@ var useCssClassUsageByID = (id2) => {
|
|
|
943
1245
|
// src/components/css-class-usage/components/css-class-usage-popover.tsx
|
|
944
1246
|
var iconMapper = {
|
|
945
1247
|
"wp-post": {
|
|
946
|
-
label: (0,
|
|
947
|
-
icon: /* @__PURE__ */
|
|
1248
|
+
label: (0, import_i18n8.__)("Post", "elementor"),
|
|
1249
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons6.PostTypeIcon, { fontSize: "inherit" })
|
|
948
1250
|
},
|
|
949
1251
|
"wp-page": {
|
|
950
|
-
label: (0,
|
|
951
|
-
icon: /* @__PURE__ */
|
|
1252
|
+
label: (0, import_i18n8.__)("Page", "elementor"),
|
|
1253
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons6.PagesIcon, { fontSize: "inherit" })
|
|
952
1254
|
},
|
|
953
1255
|
popup: {
|
|
954
|
-
label: (0,
|
|
955
|
-
icon: /* @__PURE__ */
|
|
1256
|
+
label: (0, import_i18n8.__)("Popup", "elementor"),
|
|
1257
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons6.PopupTemplateIcon, { fontSize: "inherit" })
|
|
956
1258
|
},
|
|
957
1259
|
header: {
|
|
958
|
-
label: (0,
|
|
959
|
-
icon: /* @__PURE__ */
|
|
1260
|
+
label: (0, import_i18n8.__)("Header", "elementor"),
|
|
1261
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons6.HeaderTemplateIcon, { fontSize: "inherit" })
|
|
960
1262
|
},
|
|
961
1263
|
footer: {
|
|
962
|
-
label: (0,
|
|
963
|
-
icon: /* @__PURE__ */
|
|
1264
|
+
label: (0, import_i18n8.__)("Footer", "elementor"),
|
|
1265
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons6.FooterTemplateIcon, { fontSize: "inherit" })
|
|
964
1266
|
}
|
|
965
1267
|
};
|
|
966
1268
|
var CssClassUsagePopover = ({
|
|
@@ -978,42 +1280,49 @@ var CssClassUsagePopover = ({
|
|
|
978
1280
|
docType: type
|
|
979
1281
|
})
|
|
980
1282
|
) ?? [];
|
|
981
|
-
|
|
982
|
-
|
|
1283
|
+
const handleSelect = (value) => {
|
|
1284
|
+
onNavigate(+value);
|
|
1285
|
+
trackGlobalClasses({
|
|
1286
|
+
event: "classUsageLocate",
|
|
1287
|
+
classId: cssClassID
|
|
1288
|
+
});
|
|
1289
|
+
};
|
|
1290
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
1291
|
+
import_editor_ui5.PopoverHeader,
|
|
983
1292
|
{
|
|
984
|
-
icon: /* @__PURE__ */
|
|
985
|
-
title: /* @__PURE__ */
|
|
1293
|
+
icon: /* @__PURE__ */ React11.createElement(import_icons6.CurrentLocationIcon, { fontSize: "tiny" }),
|
|
1294
|
+
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_i18n8.__)("Locator", "elementor")), /* @__PURE__ */ React11.createElement(import_ui8.Box, null, /* @__PURE__ */ React11.createElement(import_ui8.Chip, { sx: { lineHeight: 1 }, size: "tiny", label: classUsage.total }))),
|
|
986
1295
|
onClose
|
|
987
1296
|
}
|
|
988
|
-
), /* @__PURE__ */
|
|
989
|
-
|
|
1297
|
+
), /* @__PURE__ */ React11.createElement(import_ui8.Divider, null), /* @__PURE__ */ React11.createElement(import_editor_ui5.PopoverBody, { width: 300 }, /* @__PURE__ */ React11.createElement(
|
|
1298
|
+
import_editor_ui5.PopoverMenuList,
|
|
990
1299
|
{
|
|
991
|
-
onSelect:
|
|
1300
|
+
onSelect: handleSelect,
|
|
992
1301
|
items: cssClassUsageRecords,
|
|
993
1302
|
onClose: () => {
|
|
994
1303
|
},
|
|
995
1304
|
menuListTemplate: StyledCssClassUsageItem,
|
|
996
|
-
menuItemContentTemplate: (cssClassUsageRecord) => /* @__PURE__ */
|
|
997
|
-
|
|
1305
|
+
menuItemContentTemplate: (cssClassUsageRecord) => /* @__PURE__ */ React11.createElement(import_ui8.Stack, { flexDirection: "row", flex: 1, alignItems: "center" }, /* @__PURE__ */ React11.createElement(import_ui8.Box, { display: "flex", sx: { pr: 1 } }, /* @__PURE__ */ React11.createElement(
|
|
1306
|
+
import_ui8.Tooltip,
|
|
998
1307
|
{
|
|
999
1308
|
disableInteractive: true,
|
|
1000
1309
|
title: iconMapper?.[cssClassUsageRecord.docType]?.label ?? cssClassUsageRecord.docType,
|
|
1001
1310
|
placement: "top"
|
|
1002
1311
|
},
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
)), /* @__PURE__ */
|
|
1005
|
-
|
|
1312
|
+
/* @__PURE__ */ React11.createElement(import_ui8.Icon, { fontSize: "small" }, iconMapper?.[cssClassUsageRecord.docType]?.icon || /* @__PURE__ */ React11.createElement(import_icons6.PagesIcon, { fontSize: "inherit" }))
|
|
1313
|
+
)), /* @__PURE__ */ React11.createElement(import_ui8.Box, { sx: { pr: 0.5, maxWidth: "173px" }, display: "flex" }, /* @__PURE__ */ React11.createElement(
|
|
1314
|
+
import_editor_ui5.EllipsisWithTooltip,
|
|
1006
1315
|
{
|
|
1007
1316
|
title: cssClassUsageRecord.label,
|
|
1008
|
-
as:
|
|
1317
|
+
as: import_ui8.Typography,
|
|
1009
1318
|
variant: "caption",
|
|
1010
1319
|
maxWidth: "173px",
|
|
1011
1320
|
sx: {
|
|
1012
1321
|
lineHeight: 1
|
|
1013
1322
|
}
|
|
1014
1323
|
}
|
|
1015
|
-
)), /* @__PURE__ */
|
|
1016
|
-
|
|
1324
|
+
)), /* @__PURE__ */ React11.createElement(import_icons6.ExternalLinkIcon, { className: "hover-only-icon", fontSize: "tiny" }), /* @__PURE__ */ React11.createElement(
|
|
1325
|
+
import_ui8.Chip,
|
|
1017
1326
|
{
|
|
1018
1327
|
sx: {
|
|
1019
1328
|
ml: "auto"
|
|
@@ -1025,7 +1334,7 @@ var CssClassUsagePopover = ({
|
|
|
1025
1334
|
}
|
|
1026
1335
|
)));
|
|
1027
1336
|
};
|
|
1028
|
-
var StyledCssClassUsageItem = (0,
|
|
1337
|
+
var StyledCssClassUsageItem = (0, import_ui8.styled)(import_ui8.MenuList)(({ theme }) => ({
|
|
1029
1338
|
"& > li": {
|
|
1030
1339
|
display: "flex",
|
|
1031
1340
|
cursor: "pointer",
|
|
@@ -1059,37 +1368,49 @@ var StyledCssClassUsageItem = (0, import_ui7.styled)(import_ui7.MenuList)(({ the
|
|
|
1059
1368
|
}));
|
|
1060
1369
|
|
|
1061
1370
|
// src/components/css-class-usage/components/css-class-usage-trigger.tsx
|
|
1062
|
-
var
|
|
1063
|
-
var
|
|
1064
|
-
var
|
|
1065
|
-
var
|
|
1066
|
-
var
|
|
1371
|
+
var React12 = __toESM(require("react"));
|
|
1372
|
+
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
1373
|
+
var import_icons7 = require("@elementor/icons");
|
|
1374
|
+
var import_ui9 = require("@elementor/ui");
|
|
1375
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
1067
1376
|
var CssClassUsageTrigger = ({ id: id2, onClick }) => {
|
|
1068
1377
|
const {
|
|
1069
1378
|
data: { total },
|
|
1070
1379
|
isLoading
|
|
1071
1380
|
} = useCssClassUsageByID(id2);
|
|
1072
|
-
const cssClassUsagePopover = (0,
|
|
1381
|
+
const cssClassUsagePopover = (0, import_ui9.usePopupState)({ variant: "popover", popupId: "css-class-usage-popover" });
|
|
1073
1382
|
if (isLoading) {
|
|
1074
1383
|
return null;
|
|
1075
1384
|
}
|
|
1076
1385
|
const WrapperComponent = total !== 0 ? TooltipWrapper : InfoAlertMessage;
|
|
1077
|
-
|
|
1386
|
+
const handleMouseEnter = () => {
|
|
1387
|
+
trackGlobalClasses({
|
|
1388
|
+
event: "classUsageHovered",
|
|
1389
|
+
classId: id2,
|
|
1390
|
+
usage: total
|
|
1391
|
+
});
|
|
1392
|
+
};
|
|
1393
|
+
const handleClick = (e) => {
|
|
1394
|
+
if (total !== 0) {
|
|
1395
|
+
(0, import_ui9.bindTrigger)(cssClassUsagePopover).onClick(e);
|
|
1396
|
+
onClick(id2);
|
|
1397
|
+
trackGlobalClasses({
|
|
1398
|
+
event: "classUsageClicked",
|
|
1399
|
+
classId: id2
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(import_ui9.Box, { position: "relative", onMouseEnter: handleMouseEnter }, /* @__PURE__ */ React12.createElement(WrapperComponent, { total }, /* @__PURE__ */ React12.createElement(
|
|
1078
1404
|
CustomIconButton2,
|
|
1079
1405
|
{
|
|
1080
1406
|
disabled: total === 0,
|
|
1081
1407
|
size: "tiny",
|
|
1082
|
-
...(0,
|
|
1083
|
-
onClick:
|
|
1084
|
-
if (total !== 0) {
|
|
1085
|
-
(0, import_ui8.bindTrigger)(cssClassUsagePopover).onClick(e);
|
|
1086
|
-
onClick(id2);
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1408
|
+
...(0, import_ui9.bindTrigger)(cssClassUsagePopover),
|
|
1409
|
+
onClick: handleClick
|
|
1089
1410
|
},
|
|
1090
|
-
/* @__PURE__ */
|
|
1091
|
-
))), /* @__PURE__ */
|
|
1092
|
-
|
|
1411
|
+
/* @__PURE__ */ React12.createElement(import_icons7.CurrentLocationIcon, { fontSize: "tiny" })
|
|
1412
|
+
))), /* @__PURE__ */ React12.createElement(import_ui9.Box, null, /* @__PURE__ */ React12.createElement(
|
|
1413
|
+
import_ui9.Popover,
|
|
1093
1414
|
{
|
|
1094
1415
|
anchorOrigin: {
|
|
1095
1416
|
vertical: "center",
|
|
@@ -1099,13 +1420,13 @@ var CssClassUsageTrigger = ({ id: id2, onClick }) => {
|
|
|
1099
1420
|
vertical: 15,
|
|
1100
1421
|
horizontal: -50
|
|
1101
1422
|
},
|
|
1102
|
-
...(0,
|
|
1423
|
+
...(0, import_ui9.bindPopover)(cssClassUsagePopover),
|
|
1103
1424
|
onClose: () => {
|
|
1104
|
-
(0,
|
|
1425
|
+
(0, import_ui9.bindPopover)(cssClassUsagePopover).onClose();
|
|
1105
1426
|
onClick("");
|
|
1106
1427
|
}
|
|
1107
1428
|
},
|
|
1108
|
-
/* @__PURE__ */
|
|
1429
|
+
/* @__PURE__ */ React12.createElement(
|
|
1109
1430
|
CssClassUsagePopover,
|
|
1110
1431
|
{
|
|
1111
1432
|
onClose: cssClassUsagePopover.close,
|
|
@@ -1115,7 +1436,7 @@ var CssClassUsageTrigger = ({ id: id2, onClick }) => {
|
|
|
1115
1436
|
)
|
|
1116
1437
|
)));
|
|
1117
1438
|
};
|
|
1118
|
-
var CustomIconButton2 = (0,
|
|
1439
|
+
var CustomIconButton2 = (0, import_ui9.styled)(import_ui9.IconButton)(({ theme }) => ({
|
|
1119
1440
|
"&.Mui-disabled": {
|
|
1120
1441
|
pointerEvents: "auto",
|
|
1121
1442
|
// Enable hover
|
|
@@ -1127,72 +1448,72 @@ var CustomIconButton2 = (0, import_ui8.styled)(import_ui8.IconButton)(({ theme }
|
|
|
1127
1448
|
height: "22px",
|
|
1128
1449
|
width: "22px"
|
|
1129
1450
|
}));
|
|
1130
|
-
var TooltipWrapper = ({ children, total }) => /* @__PURE__ */
|
|
1131
|
-
|
|
1451
|
+
var TooltipWrapper = ({ children, total }) => /* @__PURE__ */ React12.createElement(
|
|
1452
|
+
import_ui9.Tooltip,
|
|
1132
1453
|
{
|
|
1133
1454
|
disableInteractive: true,
|
|
1134
1455
|
placement: "top",
|
|
1135
|
-
title: `${(0,
|
|
1456
|
+
title: `${(0, import_i18n9.__)("Show {{number}} {{locations}}", "elementor").replace("{{number}}", total.toString()).replace(
|
|
1136
1457
|
"{{locations}}",
|
|
1137
|
-
total === 1 ? (0,
|
|
1458
|
+
total === 1 ? (0, import_i18n9.__)("location", "elementor") : (0, import_i18n9.__)("locations", "elementor")
|
|
1138
1459
|
)}`
|
|
1139
1460
|
},
|
|
1140
|
-
/* @__PURE__ */
|
|
1461
|
+
/* @__PURE__ */ React12.createElement("span", null, children)
|
|
1141
1462
|
);
|
|
1142
|
-
var InfoAlertMessage = ({ children }) => /* @__PURE__ */
|
|
1143
|
-
|
|
1463
|
+
var InfoAlertMessage = ({ children }) => /* @__PURE__ */ React12.createElement(
|
|
1464
|
+
import_ui9.Infotip,
|
|
1144
1465
|
{
|
|
1145
1466
|
disableInteractive: true,
|
|
1146
1467
|
placement: "top",
|
|
1147
1468
|
color: "secondary",
|
|
1148
|
-
content: /* @__PURE__ */
|
|
1469
|
+
content: /* @__PURE__ */ React12.createElement(import_editor_ui6.InfoAlert, { sx: { mt: 1 } }, (0, import_i18n9.__)("This class isn\u2019t being used yet.", "elementor"))
|
|
1149
1470
|
},
|
|
1150
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ React12.createElement("span", null, children)
|
|
1151
1472
|
);
|
|
1152
1473
|
|
|
1153
1474
|
// src/components/class-manager/delete-confirmation-dialog.tsx
|
|
1154
|
-
var
|
|
1475
|
+
var React13 = __toESM(require("react"));
|
|
1155
1476
|
var import_react5 = require("react");
|
|
1156
|
-
var
|
|
1157
|
-
var
|
|
1158
|
-
var
|
|
1477
|
+
var import_icons8 = require("@elementor/icons");
|
|
1478
|
+
var import_ui10 = require("@elementor/ui");
|
|
1479
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1159
1480
|
var context = (0, import_react5.createContext)(null);
|
|
1160
1481
|
var DeleteConfirmationProvider = ({ children }) => {
|
|
1161
1482
|
const [dialogProps, setDialogProps] = (0, import_react5.useState)(null);
|
|
1162
|
-
const
|
|
1483
|
+
const openDialog2 = (props) => {
|
|
1163
1484
|
setDialogProps(props);
|
|
1164
1485
|
};
|
|
1165
|
-
const
|
|
1486
|
+
const closeDialog2 = () => {
|
|
1166
1487
|
setDialogProps(null);
|
|
1167
1488
|
};
|
|
1168
|
-
return /* @__PURE__ */
|
|
1489
|
+
return /* @__PURE__ */ React13.createElement(context.Provider, { value: { openDialog: openDialog2, closeDialog: closeDialog2, dialogProps } }, children, !!dialogProps && /* @__PURE__ */ React13.createElement(DeleteConfirmationDialog, { ...dialogProps }));
|
|
1169
1490
|
};
|
|
1170
1491
|
var TITLE_ID = "delete-class-dialog";
|
|
1171
1492
|
var DeleteConfirmationDialog = ({ label, id: id2 }) => {
|
|
1172
|
-
const { closeDialog } = useDeleteConfirmation();
|
|
1493
|
+
const { closeDialog: closeDialog2 } = useDeleteConfirmation();
|
|
1173
1494
|
const {
|
|
1174
1495
|
data: { total, content }
|
|
1175
1496
|
} = useCssClassUsageByID(id2);
|
|
1176
1497
|
const onConfirm = () => {
|
|
1498
|
+
closeDialog2();
|
|
1177
1499
|
deleteClass(id2);
|
|
1178
|
-
closeDialog();
|
|
1179
1500
|
};
|
|
1180
|
-
const text = total && content.length ? (0,
|
|
1501
|
+
const text = total && content.length ? (0, import_i18n10.__)(
|
|
1181
1502
|
"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.",
|
|
1182
1503
|
"elementor"
|
|
1183
|
-
).replace("%1", total.toString()).replace("%2", content.length.toString()) : (0,
|
|
1504
|
+
).replace("%1", total.toString()).replace("%2", content.length.toString()) : (0, import_i18n10.__)(
|
|
1184
1505
|
"Will permanently remove it from your project and may affect the design across all elements using it. This action cannot be undone.",
|
|
1185
1506
|
"elementor"
|
|
1186
1507
|
);
|
|
1187
|
-
return /* @__PURE__ */
|
|
1188
|
-
|
|
1508
|
+
return /* @__PURE__ */ React13.createElement(import_ui10.Dialog, { open: true, onClose: closeDialog2, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React13.createElement(import_ui10.DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React13.createElement(import_icons8.AlertOctagonFilledIcon, { color: "error" }), (0, import_i18n10.__)("Delete this class?", "elementor")), /* @__PURE__ */ React13.createElement(import_ui10.DialogContent, null, /* @__PURE__ */ React13.createElement(import_ui10.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n10.__)("Deleting", "elementor"), /* @__PURE__ */ React13.createElement(import_ui10.Typography, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), text)), /* @__PURE__ */ React13.createElement(import_ui10.DialogActions, null, /* @__PURE__ */ React13.createElement(import_ui10.Button, { color: "secondary", onClick: closeDialog2 }, (0, import_i18n10.__)("Not now", "elementor")), /* @__PURE__ */ React13.createElement(
|
|
1509
|
+
import_ui10.Button,
|
|
1189
1510
|
{
|
|
1190
1511
|
autoFocus: true,
|
|
1191
1512
|
variant: "contained",
|
|
1192
1513
|
color: "error",
|
|
1193
1514
|
onClick: onConfirm
|
|
1194
1515
|
},
|
|
1195
|
-
(0,
|
|
1516
|
+
(0, import_i18n10.__)("Delete", "elementor")
|
|
1196
1517
|
)));
|
|
1197
1518
|
};
|
|
1198
1519
|
var useDeleteConfirmation = () => {
|
|
@@ -1204,14 +1525,14 @@ var useDeleteConfirmation = () => {
|
|
|
1204
1525
|
};
|
|
1205
1526
|
|
|
1206
1527
|
// src/components/class-manager/sortable.tsx
|
|
1207
|
-
var
|
|
1208
|
-
var
|
|
1209
|
-
var
|
|
1210
|
-
var SortableProvider = (props) => /* @__PURE__ */
|
|
1211
|
-
var SortableTrigger = (props) => /* @__PURE__ */
|
|
1528
|
+
var React14 = __toESM(require("react"));
|
|
1529
|
+
var import_icons9 = require("@elementor/icons");
|
|
1530
|
+
var import_ui11 = require("@elementor/ui");
|
|
1531
|
+
var SortableProvider = (props) => /* @__PURE__ */ React14.createElement(import_ui11.UnstableSortableProvider, { restrictAxis: true, variant: "static", dragPlaceholderStyle: { opacity: "1" }, ...props });
|
|
1532
|
+
var SortableTrigger = (props) => /* @__PURE__ */ React14.createElement(StyledSortableTrigger, { ...props, role: "button", className: "class-item-sortable-trigger", "aria-label": "sort" }, /* @__PURE__ */ React14.createElement(import_icons9.GripVerticalIcon, { fontSize: "tiny" }));
|
|
1212
1533
|
var SortableItem = ({ children, id: id2, ...props }) => {
|
|
1213
|
-
return /* @__PURE__ */
|
|
1214
|
-
|
|
1534
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1535
|
+
import_ui11.UnstableSortableItem,
|
|
1215
1536
|
{
|
|
1216
1537
|
...props,
|
|
1217
1538
|
id: id2,
|
|
@@ -1226,8 +1547,8 @@ var SortableItem = ({ children, id: id2, ...props }) => {
|
|
|
1226
1547
|
isDragOverlay,
|
|
1227
1548
|
isDragPlaceholder
|
|
1228
1549
|
}) => {
|
|
1229
|
-
return /* @__PURE__ */
|
|
1230
|
-
|
|
1550
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1551
|
+
import_ui11.Box,
|
|
1231
1552
|
{
|
|
1232
1553
|
...itemProps,
|
|
1233
1554
|
style: itemStyle,
|
|
@@ -1245,20 +1566,20 @@ var SortableItem = ({ children, id: id2, ...props }) => {
|
|
|
1245
1566
|
triggerStyle,
|
|
1246
1567
|
isDragPlaceholder
|
|
1247
1568
|
}),
|
|
1248
|
-
showDropIndication && /* @__PURE__ */
|
|
1569
|
+
showDropIndication && /* @__PURE__ */ React14.createElement(SortableItemIndicator, { style: dropIndicationStyle })
|
|
1249
1570
|
);
|
|
1250
1571
|
}
|
|
1251
1572
|
}
|
|
1252
1573
|
);
|
|
1253
1574
|
};
|
|
1254
|
-
var StyledSortableTrigger = (0,
|
|
1575
|
+
var StyledSortableTrigger = (0, import_ui11.styled)("div")(({ theme }) => ({
|
|
1255
1576
|
position: "absolute",
|
|
1256
1577
|
left: 0,
|
|
1257
1578
|
top: "50%",
|
|
1258
1579
|
transform: `translate( -${theme.spacing(1.5)}, -50% )`,
|
|
1259
1580
|
color: theme.palette.action.active
|
|
1260
1581
|
}));
|
|
1261
|
-
var SortableItemIndicator = (0,
|
|
1582
|
+
var SortableItemIndicator = (0, import_ui11.styled)(import_ui11.Box)`
|
|
1262
1583
|
width: 100%;
|
|
1263
1584
|
height: 1px;
|
|
1264
1585
|
background-color: ${({ theme }) => theme.palette.text.primary};
|
|
@@ -1281,20 +1602,20 @@ var ClassItem = ({
|
|
|
1281
1602
|
isEditing,
|
|
1282
1603
|
error,
|
|
1283
1604
|
getProps: getEditableProps
|
|
1284
|
-
} = (0,
|
|
1605
|
+
} = (0, import_editor_ui7.useEditable)({
|
|
1285
1606
|
value: label,
|
|
1286
1607
|
onSubmit: renameClass,
|
|
1287
1608
|
validation: validateLabel
|
|
1288
1609
|
});
|
|
1289
1610
|
const [selectedCssUsage, setSelectedCssUsage] = (0, import_react6.useState)("");
|
|
1290
|
-
const { openDialog } = useDeleteConfirmation();
|
|
1291
|
-
const popupState = (0,
|
|
1611
|
+
const { openDialog: openDialog2 } = useDeleteConfirmation();
|
|
1612
|
+
const popupState = (0, import_ui12.usePopupState)({
|
|
1292
1613
|
variant: "popover",
|
|
1293
1614
|
disableAutoFocus: true
|
|
1294
1615
|
});
|
|
1295
1616
|
const isSelected = (selectedCssUsage === id2 || selected || popupState.isOpen) && !disabled;
|
|
1296
|
-
return /* @__PURE__ */
|
|
1297
|
-
|
|
1617
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(import_ui12.Stack, { p: 0 }, /* @__PURE__ */ React15.createElement(
|
|
1618
|
+
import_editor_ui7.WarningInfotip,
|
|
1298
1619
|
{
|
|
1299
1620
|
open: Boolean(error),
|
|
1300
1621
|
text: error ?? "",
|
|
@@ -1302,7 +1623,7 @@ var ClassItem = ({
|
|
|
1302
1623
|
width: itemRef.current?.getBoundingClientRect().width,
|
|
1303
1624
|
offset: [0, -15]
|
|
1304
1625
|
},
|
|
1305
|
-
/* @__PURE__ */
|
|
1626
|
+
/* @__PURE__ */ React15.createElement(
|
|
1306
1627
|
StyledListItemButton,
|
|
1307
1628
|
{
|
|
1308
1629
|
ref: itemRef,
|
|
@@ -1316,31 +1637,31 @@ var ClassItem = ({
|
|
|
1316
1637
|
disabled,
|
|
1317
1638
|
focusVisibleClassName: "visible-class-item"
|
|
1318
1639
|
},
|
|
1319
|
-
/* @__PURE__ */
|
|
1320
|
-
/* @__PURE__ */
|
|
1321
|
-
|
|
1640
|
+
/* @__PURE__ */ React15.createElement(SortableTrigger, { ...sortableTriggerProps }),
|
|
1641
|
+
/* @__PURE__ */ React15.createElement(Indicator, { isActive: isEditing, isError: !!error }, isEditing ? /* @__PURE__ */ React15.createElement(
|
|
1642
|
+
import_editor_ui7.EditableField,
|
|
1322
1643
|
{
|
|
1323
1644
|
ref: editableRef,
|
|
1324
|
-
as:
|
|
1645
|
+
as: import_ui12.Typography,
|
|
1325
1646
|
variant: "caption",
|
|
1326
1647
|
...getEditableProps()
|
|
1327
1648
|
}
|
|
1328
|
-
) : /* @__PURE__ */
|
|
1329
|
-
/* @__PURE__ */
|
|
1330
|
-
/* @__PURE__ */
|
|
1331
|
-
|
|
1649
|
+
) : /* @__PURE__ */ React15.createElement(import_editor_ui7.EllipsisWithTooltip, { title: label, as: import_ui12.Typography, variant: "caption" })),
|
|
1650
|
+
/* @__PURE__ */ React15.createElement(import_ui12.Box, { className: "class-item-locator" }, /* @__PURE__ */ React15.createElement(CssClassUsageTrigger, { id: id2, onClick: setSelectedCssUsage })),
|
|
1651
|
+
/* @__PURE__ */ React15.createElement(
|
|
1652
|
+
import_ui12.Tooltip,
|
|
1332
1653
|
{
|
|
1333
1654
|
placement: "top",
|
|
1334
1655
|
className: "class-item-more-actions",
|
|
1335
|
-
title: (0,
|
|
1656
|
+
title: (0, import_i18n11.__)("More actions", "elementor")
|
|
1336
1657
|
},
|
|
1337
|
-
/* @__PURE__ */
|
|
1658
|
+
/* @__PURE__ */ React15.createElement(import_ui12.IconButton, { size: "tiny", ...(0, import_ui12.bindTrigger)(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React15.createElement(import_icons10.DotsVerticalIcon, { fontSize: "tiny" }))
|
|
1338
1659
|
)
|
|
1339
1660
|
)
|
|
1340
|
-
)), /* @__PURE__ */
|
|
1341
|
-
|
|
1661
|
+
)), /* @__PURE__ */ React15.createElement(
|
|
1662
|
+
import_ui12.Menu,
|
|
1342
1663
|
{
|
|
1343
|
-
...(0,
|
|
1664
|
+
...(0, import_ui12.bindMenu)(popupState),
|
|
1344
1665
|
anchorOrigin: {
|
|
1345
1666
|
vertical: "bottom",
|
|
1346
1667
|
horizontal: "right"
|
|
@@ -1350,8 +1671,8 @@ var ClassItem = ({
|
|
|
1350
1671
|
horizontal: "right"
|
|
1351
1672
|
}
|
|
1352
1673
|
},
|
|
1353
|
-
/* @__PURE__ */
|
|
1354
|
-
|
|
1674
|
+
/* @__PURE__ */ React15.createElement(
|
|
1675
|
+
import_editor_ui7.MenuListItem,
|
|
1355
1676
|
{
|
|
1356
1677
|
sx: { minWidth: "160px" },
|
|
1357
1678
|
onClick: () => {
|
|
@@ -1359,21 +1680,21 @@ var ClassItem = ({
|
|
|
1359
1680
|
openEditMode();
|
|
1360
1681
|
}
|
|
1361
1682
|
},
|
|
1362
|
-
/* @__PURE__ */
|
|
1683
|
+
/* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0, import_i18n11.__)("Rename", "elementor"))
|
|
1363
1684
|
),
|
|
1364
|
-
/* @__PURE__ */
|
|
1365
|
-
|
|
1685
|
+
/* @__PURE__ */ React15.createElement(
|
|
1686
|
+
import_editor_ui7.MenuListItem,
|
|
1366
1687
|
{
|
|
1367
1688
|
onClick: () => {
|
|
1368
1689
|
popupState.close();
|
|
1369
|
-
|
|
1690
|
+
openDialog2({ id: id2, label });
|
|
1370
1691
|
}
|
|
1371
1692
|
},
|
|
1372
|
-
/* @__PURE__ */
|
|
1693
|
+
/* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "error.light" } }, (0, import_i18n11.__)("Delete", "elementor"))
|
|
1373
1694
|
)
|
|
1374
1695
|
));
|
|
1375
1696
|
};
|
|
1376
|
-
var StyledListItemButton = (0,
|
|
1697
|
+
var StyledListItemButton = (0, import_ui12.styled)(import_ui12.ListItemButton, {
|
|
1377
1698
|
shouldForwardProp: (prop) => !["showActions", "showSortIndicator"].includes(prop)
|
|
1378
1699
|
})(
|
|
1379
1700
|
({ showActions, showSortIndicator }) => `
|
|
@@ -1402,7 +1723,7 @@ var StyledListItemButton = (0, import_ui11.styled)(import_ui11.ListItemButton, {
|
|
|
1402
1723
|
}
|
|
1403
1724
|
`
|
|
1404
1725
|
);
|
|
1405
|
-
var Indicator = (0,
|
|
1726
|
+
var Indicator = (0, import_ui12.styled)(import_ui12.Box, {
|
|
1406
1727
|
shouldForwardProp: (prop) => !["isActive", "isError"].includes(prop)
|
|
1407
1728
|
})(({ theme, isActive, isError }) => ({
|
|
1408
1729
|
display: "flex",
|
|
@@ -1432,10 +1753,10 @@ var validateLabel = (newLabel) => {
|
|
|
1432
1753
|
};
|
|
1433
1754
|
|
|
1434
1755
|
// src/components/class-manager/not-found.tsx
|
|
1435
|
-
var
|
|
1436
|
-
var
|
|
1437
|
-
var
|
|
1438
|
-
var
|
|
1756
|
+
var React16 = __toESM(require("react"));
|
|
1757
|
+
var import_icons11 = require("@elementor/icons");
|
|
1758
|
+
var import_ui13 = require("@elementor/ui");
|
|
1759
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
1439
1760
|
var getNotFoundType = (searchValue, filters, filteredClasses) => {
|
|
1440
1761
|
const searchNotFound = filteredClasses.length <= 0 && searchValue.length > 1;
|
|
1441
1762
|
const filterNotFound = filters && filters.length === 0;
|
|
@@ -1453,19 +1774,19 @@ var getNotFoundType = (searchValue, filters, filteredClasses) => {
|
|
|
1453
1774
|
};
|
|
1454
1775
|
var notFound = {
|
|
1455
1776
|
filterAndSearch: {
|
|
1456
|
-
mainText: (0,
|
|
1457
|
-
sceneryText: (0,
|
|
1458
|
-
icon: /* @__PURE__ */
|
|
1777
|
+
mainText: (0, import_i18n12.__)("Sorry, nothing matched.", "elementor"),
|
|
1778
|
+
sceneryText: (0, import_i18n12.__)("Try something else.", "elementor"),
|
|
1779
|
+
icon: /* @__PURE__ */ React16.createElement(import_icons11.PhotoIcon, { color: "inherit", fontSize: "large" })
|
|
1459
1780
|
},
|
|
1460
1781
|
search: {
|
|
1461
|
-
mainText: (0,
|
|
1462
|
-
sceneryText: (0,
|
|
1463
|
-
icon: /* @__PURE__ */
|
|
1782
|
+
mainText: (0, import_i18n12.__)("Sorry, nothing matched", "elementor"),
|
|
1783
|
+
sceneryText: (0, import_i18n12.__)("Clear your input and try something else.", "elementor"),
|
|
1784
|
+
icon: /* @__PURE__ */ React16.createElement(import_icons11.PhotoIcon, { color: "inherit", fontSize: "large" })
|
|
1464
1785
|
},
|
|
1465
1786
|
filter: {
|
|
1466
|
-
mainText: (0,
|
|
1467
|
-
sceneryText: (0,
|
|
1468
|
-
icon: /* @__PURE__ */
|
|
1787
|
+
mainText: (0, import_i18n12.__)("Sorry, nothing matched that search.", "elementor"),
|
|
1788
|
+
sceneryText: (0, import_i18n12.__)("Clear the filters and try something else.", "elementor"),
|
|
1789
|
+
icon: /* @__PURE__ */ React16.createElement(import_icons11.ColorSwatchIcon, { color: "inherit", fontSize: "large" })
|
|
1469
1790
|
}
|
|
1470
1791
|
};
|
|
1471
1792
|
var NotFound = ({ notFoundType }) => {
|
|
@@ -1475,11 +1796,11 @@ var NotFound = ({ notFoundType }) => {
|
|
|
1475
1796
|
} = useSearchAndFilters();
|
|
1476
1797
|
switch (notFoundType) {
|
|
1477
1798
|
case "filter":
|
|
1478
|
-
return /* @__PURE__ */
|
|
1799
|
+
return /* @__PURE__ */ React16.createElement(NotFoundLayout, { ...notFound.filter, onClear: onClearFilter });
|
|
1479
1800
|
case "search":
|
|
1480
|
-
return /* @__PURE__ */
|
|
1801
|
+
return /* @__PURE__ */ React16.createElement(NotFoundLayout, { ...notFound.search, searchValue: inputValue, onClear: onClearSearch });
|
|
1481
1802
|
case "filterAndSearch":
|
|
1482
|
-
return /* @__PURE__ */
|
|
1803
|
+
return /* @__PURE__ */ React16.createElement(
|
|
1483
1804
|
NotFoundLayout,
|
|
1484
1805
|
{
|
|
1485
1806
|
...notFound.filterAndSearch,
|
|
@@ -1491,8 +1812,8 @@ var NotFound = ({ notFoundType }) => {
|
|
|
1491
1812
|
);
|
|
1492
1813
|
}
|
|
1493
1814
|
};
|
|
1494
|
-
var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) => /* @__PURE__ */
|
|
1495
|
-
|
|
1815
|
+
var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) => /* @__PURE__ */ React16.createElement(
|
|
1816
|
+
import_ui13.Stack,
|
|
1496
1817
|
{
|
|
1497
1818
|
color: "text.secondary",
|
|
1498
1819
|
pt: 5,
|
|
@@ -1502,16 +1823,16 @@ var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) =>
|
|
|
1502
1823
|
justifySelf: "center"
|
|
1503
1824
|
},
|
|
1504
1825
|
icon,
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
|
|
1826
|
+
/* @__PURE__ */ React16.createElement(
|
|
1827
|
+
import_ui13.Box,
|
|
1507
1828
|
{
|
|
1508
1829
|
sx: {
|
|
1509
1830
|
width: "100%"
|
|
1510
1831
|
}
|
|
1511
1832
|
},
|
|
1512
|
-
/* @__PURE__ */
|
|
1513
|
-
searchValue && /* @__PURE__ */
|
|
1514
|
-
|
|
1833
|
+
/* @__PURE__ */ React16.createElement(import_ui13.Typography, { align: "center", variant: "subtitle2", color: "inherit" }, mainText),
|
|
1834
|
+
searchValue && /* @__PURE__ */ React16.createElement(
|
|
1835
|
+
import_ui13.Typography,
|
|
1515
1836
|
{
|
|
1516
1837
|
variant: "subtitle2",
|
|
1517
1838
|
color: "inherit",
|
|
@@ -1521,8 +1842,8 @@ var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) =>
|
|
|
1521
1842
|
justifyContent: "center"
|
|
1522
1843
|
}
|
|
1523
1844
|
},
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1845
|
+
/* @__PURE__ */ React16.createElement("span", null, "\u201C"),
|
|
1846
|
+
/* @__PURE__ */ React16.createElement(
|
|
1526
1847
|
"span",
|
|
1527
1848
|
{
|
|
1528
1849
|
style: {
|
|
@@ -1533,11 +1854,11 @@ var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) =>
|
|
|
1533
1854
|
},
|
|
1534
1855
|
searchValue
|
|
1535
1856
|
),
|
|
1536
|
-
/* @__PURE__ */
|
|
1857
|
+
/* @__PURE__ */ React16.createElement("span", null, "\u201D.")
|
|
1537
1858
|
)
|
|
1538
1859
|
),
|
|
1539
|
-
/* @__PURE__ */
|
|
1540
|
-
/* @__PURE__ */
|
|
1860
|
+
/* @__PURE__ */ React16.createElement(import_ui13.Typography, { align: "center", variant: "caption", color: "inherit" }, sceneryText),
|
|
1861
|
+
/* @__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_i18n12.__)("Clear & try again", "elementor")))
|
|
1541
1862
|
);
|
|
1542
1863
|
|
|
1543
1864
|
// src/components/class-manager/global-classes-list.tsx
|
|
@@ -1546,9 +1867,11 @@ var GlobalClassesList = ({ disabled }) => {
|
|
|
1546
1867
|
search: { debouncedValue: searchValue }
|
|
1547
1868
|
} = useSearchAndFilters();
|
|
1548
1869
|
const cssClasses = useOrderedClasses();
|
|
1549
|
-
const dispatch5 = (0,
|
|
1870
|
+
const dispatch5 = (0, import_store18.__useDispatch)();
|
|
1550
1871
|
const filters = useFilters();
|
|
1551
|
-
const [
|
|
1872
|
+
const [draggedItemId, setDraggedItemId] = React17.useState(null);
|
|
1873
|
+
const draggedItemLabel = cssClasses.find((cssClass) => cssClass.id === draggedItemId)?.label ?? "";
|
|
1874
|
+
const [classesOrder, reorderClasses] = useReorder(draggedItemId, setDraggedItemId, draggedItemLabel ?? "");
|
|
1552
1875
|
const filteredCssClasses = useFilteredCssClasses();
|
|
1553
1876
|
(0, import_react7.useEffect)(() => {
|
|
1554
1877
|
const handler = (event) => {
|
|
@@ -1568,58 +1891,81 @@ var GlobalClassesList = ({ disabled }) => {
|
|
|
1568
1891
|
return () => window.removeEventListener("keydown", handler);
|
|
1569
1892
|
}, [dispatch5]);
|
|
1570
1893
|
if (!cssClasses?.length) {
|
|
1571
|
-
return /* @__PURE__ */
|
|
1894
|
+
return /* @__PURE__ */ React17.createElement(EmptyState, null);
|
|
1572
1895
|
}
|
|
1573
1896
|
const notFoundType = getNotFoundType(searchValue, filters, filteredCssClasses);
|
|
1574
1897
|
if (notFoundType) {
|
|
1575
|
-
return /* @__PURE__ */
|
|
1898
|
+
return /* @__PURE__ */ React17.createElement(NotFound, { notFoundType });
|
|
1576
1899
|
}
|
|
1577
1900
|
const isFiltersApplied = filters?.length || searchValue;
|
|
1578
1901
|
const allowSorting = filteredCssClasses.length > 1 && !isFiltersApplied;
|
|
1579
|
-
return /* @__PURE__ */
|
|
1902
|
+
return /* @__PURE__ */ React17.createElement(DeleteConfirmationProvider, null, /* @__PURE__ */ React17.createElement(import_ui14.List, { sx: { display: "flex", flexDirection: "column", gap: 0.5 } }, /* @__PURE__ */ React17.createElement(
|
|
1580
1903
|
SortableProvider,
|
|
1581
1904
|
{
|
|
1582
1905
|
value: classesOrder,
|
|
1583
1906
|
onChange: reorderClasses,
|
|
1584
1907
|
disableDragOverlay: !allowSorting
|
|
1585
1908
|
},
|
|
1586
|
-
filteredCssClasses?.map(({ id: id2, label }) => /* @__PURE__ */
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
id: id2,
|
|
1590
|
-
label,
|
|
1591
|
-
renameClass: (newLabel) => {
|
|
1592
|
-
dispatch5(
|
|
1593
|
-
slice.actions.update({
|
|
1594
|
-
style: {
|
|
1595
|
-
id: id2,
|
|
1596
|
-
label: newLabel
|
|
1597
|
-
}
|
|
1598
|
-
})
|
|
1599
|
-
);
|
|
1600
|
-
},
|
|
1601
|
-
selected: isDragged,
|
|
1602
|
-
disabled: disabled || isDragPlaceholder,
|
|
1603
|
-
sortableTriggerProps: { ...triggerProps, style: triggerStyle },
|
|
1604
|
-
showSortIndicator: allowSorting
|
|
1909
|
+
filteredCssClasses?.map(({ id: id2, label }) => /* @__PURE__ */ React17.createElement(SortableItem, { key: id2, id: id2 }, ({ isDragged, isDragPlaceholder, triggerProps, triggerStyle }) => {
|
|
1910
|
+
if (isDragged && !draggedItemId) {
|
|
1911
|
+
setDraggedItemId(id2);
|
|
1605
1912
|
}
|
|
1606
|
-
|
|
1913
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1914
|
+
ClassItem,
|
|
1915
|
+
{
|
|
1916
|
+
id: id2,
|
|
1917
|
+
label,
|
|
1918
|
+
renameClass: (newLabel) => {
|
|
1919
|
+
trackGlobalClasses({
|
|
1920
|
+
event: "classRenamed",
|
|
1921
|
+
classId: id2,
|
|
1922
|
+
oldValue: label,
|
|
1923
|
+
newValue: newLabel,
|
|
1924
|
+
source: "class-manager"
|
|
1925
|
+
});
|
|
1926
|
+
dispatch5(
|
|
1927
|
+
slice.actions.update({
|
|
1928
|
+
style: {
|
|
1929
|
+
id: id2,
|
|
1930
|
+
label: newLabel
|
|
1931
|
+
}
|
|
1932
|
+
})
|
|
1933
|
+
);
|
|
1934
|
+
},
|
|
1935
|
+
selected: isDragged,
|
|
1936
|
+
disabled: disabled || isDragPlaceholder,
|
|
1937
|
+
sortableTriggerProps: {
|
|
1938
|
+
...triggerProps,
|
|
1939
|
+
style: triggerStyle
|
|
1940
|
+
},
|
|
1941
|
+
showSortIndicator: allowSorting
|
|
1942
|
+
}
|
|
1943
|
+
);
|
|
1944
|
+
}))
|
|
1607
1945
|
)));
|
|
1608
1946
|
};
|
|
1609
|
-
var EmptyState = () => /* @__PURE__ */
|
|
1947
|
+
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_i18n13.__)("There are no global classes yet.", "elementor")), /* @__PURE__ */ React17.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n13.__)(
|
|
1610
1948
|
"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.",
|
|
1611
1949
|
"elementor"
|
|
1612
1950
|
)));
|
|
1613
|
-
var StyledHeader = (0,
|
|
1951
|
+
var StyledHeader = (0, import_ui14.styled)(import_ui14.Typography)(({ theme, variant }) => ({
|
|
1614
1952
|
"&.MuiTypography-root": {
|
|
1615
1953
|
...theme.typography[variant]
|
|
1616
1954
|
}
|
|
1617
1955
|
}));
|
|
1618
|
-
var useReorder = () => {
|
|
1619
|
-
const dispatch5 = (0,
|
|
1956
|
+
var useReorder = (draggedItemId, setDraggedItemId, draggedItemLabel) => {
|
|
1957
|
+
const dispatch5 = (0, import_store18.__useDispatch)();
|
|
1620
1958
|
const order = useClassesOrder();
|
|
1621
1959
|
const reorder = (newIds) => {
|
|
1622
1960
|
dispatch5(slice.actions.setOrder(newIds));
|
|
1961
|
+
if (draggedItemId) {
|
|
1962
|
+
trackGlobalClasses({
|
|
1963
|
+
event: "classManagerReorder",
|
|
1964
|
+
classId: draggedItemId,
|
|
1965
|
+
classTitle: draggedItemLabel
|
|
1966
|
+
});
|
|
1967
|
+
setDraggedItemId(null);
|
|
1968
|
+
}
|
|
1623
1969
|
};
|
|
1624
1970
|
return [order, reorder];
|
|
1625
1971
|
};
|
|
@@ -1660,37 +2006,6 @@ function unblockPanelInteractions() {
|
|
|
1660
2006
|
extendedWindow.$e?.components?.get?.("panel")?.unblockUserInteractions?.();
|
|
1661
2007
|
}
|
|
1662
2008
|
|
|
1663
|
-
// src/components/class-manager/save-changes-dialog.tsx
|
|
1664
|
-
var React16 = __toESM(require("react"));
|
|
1665
|
-
var import_react8 = require("react");
|
|
1666
|
-
var import_icons11 = require("@elementor/icons");
|
|
1667
|
-
var import_ui14 = require("@elementor/ui");
|
|
1668
|
-
var TITLE_ID2 = "save-changes-dialog";
|
|
1669
|
-
var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React16.createElement(import_ui14.Dialog, { open: true, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "xs" }, children);
|
|
1670
|
-
var SaveChangesDialogTitle = ({ children }) => /* @__PURE__ */ React16.createElement(import_ui14.DialogTitle, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React16.createElement(import_icons11.AlertTriangleFilledIcon, { color: "secondary" }), children);
|
|
1671
|
-
var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React16.createElement(import_ui14.DialogContent, null, children);
|
|
1672
|
-
var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React16.createElement(import_ui14.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
|
|
1673
|
-
var SaveChangesDialogActions = ({ actions }) => {
|
|
1674
|
-
const [isConfirming, setIsConfirming] = (0, import_react8.useState)(false);
|
|
1675
|
-
const { cancel, confirm, discard } = actions;
|
|
1676
|
-
const onConfirm = async () => {
|
|
1677
|
-
setIsConfirming(true);
|
|
1678
|
-
await confirm.action();
|
|
1679
|
-
setIsConfirming(false);
|
|
1680
|
-
};
|
|
1681
|
-
return /* @__PURE__ */ React16.createElement(import_ui14.DialogActions, null, cancel && /* @__PURE__ */ React16.createElement(import_ui14.Button, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React16.createElement(import_ui14.Button, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React16.createElement(import_ui14.Button, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
|
|
1682
|
-
};
|
|
1683
|
-
SaveChangesDialog.Title = SaveChangesDialogTitle;
|
|
1684
|
-
SaveChangesDialog.Content = SaveChangesDialogContent;
|
|
1685
|
-
SaveChangesDialog.ContentText = SaveChangesDialogContentText;
|
|
1686
|
-
SaveChangesDialog.Actions = SaveChangesDialogActions;
|
|
1687
|
-
var useDialog = () => {
|
|
1688
|
-
const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
|
|
1689
|
-
const open = () => setIsOpen(true);
|
|
1690
|
-
const close = () => setIsOpen(false);
|
|
1691
|
-
return { isOpen, open, close };
|
|
1692
|
-
};
|
|
1693
|
-
|
|
1694
2009
|
// src/components/class-manager/class-manager-panel.tsx
|
|
1695
2010
|
var id = "global-classes-manager";
|
|
1696
2011
|
var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
@@ -1704,19 +2019,20 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
|
|
|
1704
2019
|
onClose: () => {
|
|
1705
2020
|
(0, import_editor_v1_adapters3.changeEditMode)("edit");
|
|
1706
2021
|
unblockPanelInteractions();
|
|
1707
|
-
}
|
|
2022
|
+
},
|
|
2023
|
+
isOpenPreviousElement: true
|
|
1708
2024
|
});
|
|
1709
2025
|
function ClassManagerPanel() {
|
|
1710
2026
|
const isDirty2 = useDirtyState();
|
|
1711
2027
|
const { close: closePanel } = usePanelActions();
|
|
1712
|
-
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
|
|
2028
|
+
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui8.useDialog)();
|
|
1713
2029
|
const { mutateAsync: publish, isPending: isPublishing } = usePublish();
|
|
1714
2030
|
const resetAndClosePanel = () => {
|
|
1715
|
-
(0,
|
|
2031
|
+
(0, import_store20.__dispatch)(slice.actions.resetToInitialState({ context: "frontend" }));
|
|
1716
2032
|
closeSaveChangesDialog();
|
|
1717
2033
|
};
|
|
1718
2034
|
usePreventUnload();
|
|
1719
|
-
return /* @__PURE__ */
|
|
2035
|
+
return /* @__PURE__ */ React18.createElement(import_editor_ui8.ThemeProvider, null, /* @__PURE__ */ React18.createElement(import_ui15.ErrorBoundary, { fallback: /* @__PURE__ */ React18.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React18.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React18.createElement(SearchAndFilterProvider, null, /* @__PURE__ */ React18.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React18.createElement(import_ui15.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React18.createElement(import_ui15.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React18.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React18.createElement(FlippedColorSwatchIcon, { fontSize: "inherit" }), (0, import_i18n14.__)("Class Manager", "elementor")), /* @__PURE__ */ React18.createElement(TotalCssClassCounter, null)), /* @__PURE__ */ React18.createElement(
|
|
1720
2036
|
CloseButton,
|
|
1721
2037
|
{
|
|
1722
2038
|
sx: { marginLeft: "auto" },
|
|
@@ -1729,7 +2045,7 @@ function ClassManagerPanel() {
|
|
|
1729
2045
|
closePanel();
|
|
1730
2046
|
}
|
|
1731
2047
|
}
|
|
1732
|
-
))), /* @__PURE__ */
|
|
2048
|
+
))), /* @__PURE__ */ React18.createElement(
|
|
1733
2049
|
import_editor_panels.PanelBody,
|
|
1734
2050
|
{
|
|
1735
2051
|
sx: {
|
|
@@ -1738,9 +2054,9 @@ function ClassManagerPanel() {
|
|
|
1738
2054
|
height: "100%"
|
|
1739
2055
|
}
|
|
1740
2056
|
},
|
|
1741
|
-
/* @__PURE__ */
|
|
1742
|
-
/* @__PURE__ */
|
|
1743
|
-
/* @__PURE__ */
|
|
2057
|
+
/* @__PURE__ */ React18.createElement(import_ui15.Box, { px: 2, pb: 1 }, /* @__PURE__ */ React18.createElement(import_ui15.Stack, { direction: "row", justifyContent: "spaceBetween", gap: 0.5, sx: { pb: 0.5 } }, /* @__PURE__ */ React18.createElement(import_ui15.Box, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React18.createElement(ClassManagerSearch, null)), /* @__PURE__ */ React18.createElement(CssClassFilter, null)), /* @__PURE__ */ React18.createElement(ActiveFilters, null)),
|
|
2058
|
+
/* @__PURE__ */ React18.createElement(import_ui15.Divider, null),
|
|
2059
|
+
/* @__PURE__ */ React18.createElement(
|
|
1744
2060
|
import_ui15.Box,
|
|
1745
2061
|
{
|
|
1746
2062
|
px: 2,
|
|
@@ -1749,9 +2065,9 @@ function ClassManagerPanel() {
|
|
|
1749
2065
|
overflowY: "auto"
|
|
1750
2066
|
}
|
|
1751
2067
|
},
|
|
1752
|
-
/* @__PURE__ */
|
|
2068
|
+
/* @__PURE__ */ React18.createElement(GlobalClassesList, { disabled: isPublishing })
|
|
1753
2069
|
)
|
|
1754
|
-
), /* @__PURE__ */
|
|
2070
|
+
), /* @__PURE__ */ React18.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React18.createElement(
|
|
1755
2071
|
import_ui15.Button,
|
|
1756
2072
|
{
|
|
1757
2073
|
fullWidth: true,
|
|
@@ -1762,19 +2078,19 @@ function ClassManagerPanel() {
|
|
|
1762
2078
|
disabled: !isDirty2,
|
|
1763
2079
|
loading: isPublishing
|
|
1764
2080
|
},
|
|
1765
|
-
(0,
|
|
1766
|
-
))))), /* @__PURE__ */
|
|
1767
|
-
SaveChangesDialog.Actions,
|
|
2081
|
+
(0, import_i18n14.__)("Save changes", "elementor")
|
|
2082
|
+
))))), /* @__PURE__ */ React18.createElement(ClassManagerIntroduction, null), isSaveChangesDialogOpen && /* @__PURE__ */ React18.createElement(import_editor_ui8.SaveChangesDialog, null, /* @__PURE__ */ React18.createElement(import_ui15.DialogHeader, { onClose: closeSaveChangesDialog, logo: false }, /* @__PURE__ */ React18.createElement(import_editor_ui8.SaveChangesDialog.Title, null, (0, import_i18n14.__)("You have unsaved changes", "elementor"))), /* @__PURE__ */ React18.createElement(import_editor_ui8.SaveChangesDialog.Content, null, /* @__PURE__ */ React18.createElement(import_editor_ui8.SaveChangesDialog.ContentText, null, (0, import_i18n14.__)("You have unsaved changes in the Class Manager.", "elementor")), /* @__PURE__ */ React18.createElement(import_editor_ui8.SaveChangesDialog.ContentText, null, (0, import_i18n14.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React18.createElement(
|
|
2083
|
+
import_editor_ui8.SaveChangesDialog.Actions,
|
|
1768
2084
|
{
|
|
1769
2085
|
actions: {
|
|
1770
2086
|
discard: {
|
|
1771
|
-
label: (0,
|
|
2087
|
+
label: (0, import_i18n14.__)("Discard", "elementor"),
|
|
1772
2088
|
action: () => {
|
|
1773
2089
|
resetAndClosePanel();
|
|
1774
2090
|
}
|
|
1775
2091
|
},
|
|
1776
2092
|
confirm: {
|
|
1777
|
-
label: (0,
|
|
2093
|
+
label: (0, import_i18n14.__)("Save & Continue", "elementor"),
|
|
1778
2094
|
action: async () => {
|
|
1779
2095
|
await publish();
|
|
1780
2096
|
closeSaveChangesDialog();
|
|
@@ -1785,11 +2101,11 @@ function ClassManagerPanel() {
|
|
|
1785
2101
|
}
|
|
1786
2102
|
)));
|
|
1787
2103
|
}
|
|
1788
|
-
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */
|
|
1789
|
-
var ErrorBoundaryFallback = () => /* @__PURE__ */
|
|
2104
|
+
var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React18.createElement(import_ui15.IconButton, { size: "small", color: "secondary", onClick: onClose, "aria-label": "Close", ...props }, /* @__PURE__ */ React18.createElement(import_icons12.XIcon, { fontSize: "small" }));
|
|
2105
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React18.createElement(import_ui15.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React18.createElement(import_ui15.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React18.createElement("strong", null, (0, import_i18n14.__)("Something went wrong", "elementor"))));
|
|
1790
2106
|
var usePreventUnload = () => {
|
|
1791
2107
|
const isDirty2 = useDirtyState();
|
|
1792
|
-
(0,
|
|
2108
|
+
(0, import_react8.useEffect)(() => {
|
|
1793
2109
|
const handleBeforeUnload = (event) => {
|
|
1794
2110
|
if (isDirty2) {
|
|
1795
2111
|
event.preventDefault();
|
|
@@ -1815,7 +2131,7 @@ var usePublish = () => {
|
|
|
1815
2131
|
var TotalCssClassCounter = () => {
|
|
1816
2132
|
const filters = useFilters();
|
|
1817
2133
|
const cssClasses = useClassesOrder();
|
|
1818
|
-
return /* @__PURE__ */
|
|
2134
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1819
2135
|
import_ui15.Chip,
|
|
1820
2136
|
{
|
|
1821
2137
|
size: "small",
|
|
@@ -1825,11 +2141,17 @@ var TotalCssClassCounter = () => {
|
|
|
1825
2141
|
};
|
|
1826
2142
|
|
|
1827
2143
|
// src/components/class-manager/class-manager-button.tsx
|
|
2144
|
+
var trackGlobalClassesButton = () => {
|
|
2145
|
+
trackGlobalClasses({
|
|
2146
|
+
event: "classManagerOpened",
|
|
2147
|
+
source: "style-panel"
|
|
2148
|
+
});
|
|
2149
|
+
};
|
|
1828
2150
|
var ClassManagerButton = () => {
|
|
1829
2151
|
const document = (0, import_editor_documents5.__useActiveDocument)();
|
|
1830
2152
|
const { open: openPanel } = usePanelActions();
|
|
1831
2153
|
const { save: saveDocument } = (0, import_editor_documents5.__useActiveDocumentActions)();
|
|
1832
|
-
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
|
|
2154
|
+
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui9.useDialog)();
|
|
1833
2155
|
const { prefetchClassesUsage } = usePrefetchCssClassUsage();
|
|
1834
2156
|
const { userCan } = (0, import_editor_styles_repository3.useUserStylesCapability)();
|
|
1835
2157
|
const isUserAllowedToUpdateClass = userCan(globalClassesStylesProvider.getKey()).update;
|
|
@@ -1842,25 +2164,31 @@ var ClassManagerButton = () => {
|
|
|
1842
2164
|
return;
|
|
1843
2165
|
}
|
|
1844
2166
|
openPanel();
|
|
2167
|
+
trackGlobalClassesButton();
|
|
2168
|
+
trackGlobalClasses({
|
|
2169
|
+
event: "classManagerOpened",
|
|
2170
|
+
source: "style-panel"
|
|
2171
|
+
});
|
|
1845
2172
|
prefetchClassesUsage();
|
|
1846
2173
|
};
|
|
1847
|
-
return /* @__PURE__ */
|
|
2174
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_ui16.Tooltip, { title: (0, import_i18n15.__)("Class Manager", "elementor"), placement: "top" }, /* @__PURE__ */ React19.createElement(import_ui16.IconButton, { size: "tiny", onClick: handleOpenPanel, sx: { marginInlineEnd: -0.75 } }, /* @__PURE__ */ React19.createElement(FlippedColorSwatchIcon, { fontSize: "tiny" }))), isSaveChangesDialogOpen && /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog, null, /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.Title, null, (0, import_i18n15.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.Content, null, /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.ContentText, { sx: { mb: 2 } }, (0, import_i18n15.__)(
|
|
1848
2175
|
"To open the Class Manager, save your page first. You can't continue without saving.",
|
|
1849
2176
|
"elementor"
|
|
1850
|
-
))), /* @__PURE__ */
|
|
1851
|
-
SaveChangesDialog.Actions,
|
|
2177
|
+
))), /* @__PURE__ */ React19.createElement(
|
|
2178
|
+
import_editor_ui9.SaveChangesDialog.Actions,
|
|
1852
2179
|
{
|
|
1853
2180
|
actions: {
|
|
1854
2181
|
cancel: {
|
|
1855
|
-
label: (0,
|
|
2182
|
+
label: (0, import_i18n15.__)("Stay here", "elementor"),
|
|
1856
2183
|
action: closeSaveChangesDialog
|
|
1857
2184
|
},
|
|
1858
2185
|
confirm: {
|
|
1859
|
-
label: (0,
|
|
2186
|
+
label: (0, import_i18n15.__)("Save & Continue", "elementor"),
|
|
1860
2187
|
action: async () => {
|
|
1861
2188
|
await saveDocument();
|
|
1862
2189
|
closeSaveChangesDialog();
|
|
1863
2190
|
openPanel();
|
|
2191
|
+
trackGlobalClassesButton();
|
|
1864
2192
|
prefetchClassesUsage();
|
|
1865
2193
|
}
|
|
1866
2194
|
}
|
|
@@ -1870,11 +2198,11 @@ var ClassManagerButton = () => {
|
|
|
1870
2198
|
};
|
|
1871
2199
|
|
|
1872
2200
|
// src/components/convert-local-class-to-global-class.tsx
|
|
1873
|
-
var
|
|
2201
|
+
var React20 = __toESM(require("react"));
|
|
1874
2202
|
var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
|
|
1875
|
-
var
|
|
2203
|
+
var import_editor_ui10 = require("@elementor/editor-ui");
|
|
1876
2204
|
var import_ui17 = require("@elementor/ui");
|
|
1877
|
-
var
|
|
2205
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
1878
2206
|
var ConvertLocalClassToGlobalClass = (props) => {
|
|
1879
2207
|
const localStyleData = props.styleDef;
|
|
1880
2208
|
const handleConversion = () => {
|
|
@@ -1885,10 +2213,16 @@ var ConvertLocalClassToGlobalClass = (props) => {
|
|
|
1885
2213
|
const newId = globalClassesStylesProvider.actions.create?.(newClassName, localStyleData.variants);
|
|
1886
2214
|
if (newId) {
|
|
1887
2215
|
props.successCallback(newId);
|
|
2216
|
+
trackGlobalClasses({
|
|
2217
|
+
classId: newId,
|
|
2218
|
+
event: "classCreated",
|
|
2219
|
+
source: "converted",
|
|
2220
|
+
classTitle: newClassName
|
|
2221
|
+
});
|
|
1888
2222
|
}
|
|
1889
2223
|
};
|
|
1890
|
-
return /* @__PURE__ */
|
|
1891
|
-
|
|
2224
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
|
|
2225
|
+
import_editor_ui10.MenuListItem,
|
|
1892
2226
|
{
|
|
1893
2227
|
disabled: !props.canConvert,
|
|
1894
2228
|
onClick: handleConversion,
|
|
@@ -1901,8 +2235,8 @@ var ConvertLocalClassToGlobalClass = (props) => {
|
|
|
1901
2235
|
}
|
|
1902
2236
|
}
|
|
1903
2237
|
},
|
|
1904
|
-
(0,
|
|
1905
|
-
), /* @__PURE__ */
|
|
2238
|
+
(0, import_i18n16.__)("Convert to global class", "elementor")
|
|
2239
|
+
), /* @__PURE__ */ React20.createElement(import_ui17.Divider, null));
|
|
1906
2240
|
};
|
|
1907
2241
|
function createClassName(prefix) {
|
|
1908
2242
|
let i = 1;
|
|
@@ -1914,11 +2248,11 @@ function createClassName(prefix) {
|
|
|
1914
2248
|
}
|
|
1915
2249
|
|
|
1916
2250
|
// src/components/populate-store.tsx
|
|
1917
|
-
var
|
|
1918
|
-
var
|
|
2251
|
+
var import_react9 = require("react");
|
|
2252
|
+
var import_store22 = require("@elementor/store");
|
|
1919
2253
|
function PopulateStore() {
|
|
1920
|
-
const dispatch5 = (0,
|
|
1921
|
-
(0,
|
|
2254
|
+
const dispatch5 = (0, import_store22.__useDispatch)();
|
|
2255
|
+
(0, import_react9.useEffect)(() => {
|
|
1922
2256
|
Promise.all([apiClient.all("preview"), apiClient.all("frontend")]).then(
|
|
1923
2257
|
([previewRes, frontendRes]) => {
|
|
1924
2258
|
const { data: previewData } = previewRes;
|
|
@@ -1941,64 +2275,292 @@ function PopulateStore() {
|
|
|
1941
2275
|
return null;
|
|
1942
2276
|
}
|
|
1943
2277
|
|
|
2278
|
+
// src/mcp-integration/index.ts
|
|
2279
|
+
var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
2280
|
+
|
|
2281
|
+
// src/mcp-integration/classes-resource.ts
|
|
2282
|
+
var import_editor_mcp = require("@elementor/editor-mcp");
|
|
2283
|
+
var GLOBAL_CLASSES_URI = "elementor://classes";
|
|
2284
|
+
var initClassesResource = () => {
|
|
2285
|
+
const { mcpServer } = (0, import_editor_mcp.getMCPByDomain)("classes");
|
|
2286
|
+
mcpServer.resource(
|
|
2287
|
+
"global-classes",
|
|
2288
|
+
GLOBAL_CLASSES_URI,
|
|
2289
|
+
{
|
|
2290
|
+
description: "Global classes list."
|
|
2291
|
+
},
|
|
2292
|
+
async () => {
|
|
2293
|
+
return {
|
|
2294
|
+
contents: [{ uri: GLOBAL_CLASSES_URI, text: localStorage["elementor-global-classes"] ?? {} }]
|
|
2295
|
+
};
|
|
2296
|
+
}
|
|
2297
|
+
);
|
|
2298
|
+
};
|
|
2299
|
+
|
|
2300
|
+
// src/mcp-integration/mcp-apply-unapply-global-classes.ts
|
|
2301
|
+
var import_editor_editing_panel = require("@elementor/editor-editing-panel");
|
|
2302
|
+
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
2303
|
+
var import_schema = require("@elementor/schema");
|
|
2304
|
+
function initMcpApplyUnapplyGlobalClasses(server) {
|
|
2305
|
+
server.addTool({
|
|
2306
|
+
name: "list-all-global-classes",
|
|
2307
|
+
description: `List all classes applied to a specific element
|
|
2308
|
+
|
|
2309
|
+
## When to use this tool:
|
|
2310
|
+
- When a user requests to see which classes or global classes exists.
|
|
2311
|
+
- When you need the list of global classes to allow the user to select from.
|
|
2312
|
+
- At least once before applying or unapplying a class, to ensure the class ID is correct.
|
|
2313
|
+
|
|
2314
|
+
`,
|
|
2315
|
+
outputSchema: {
|
|
2316
|
+
appliedClasses: import_schema.z.array(
|
|
2317
|
+
import_schema.z.object({
|
|
2318
|
+
id: import_schema.z.string().describe("The ID of the class"),
|
|
2319
|
+
label: import_schema.z.string().describe("The label of the class"),
|
|
2320
|
+
variants: import_schema.z.array(
|
|
2321
|
+
import_schema.z.object({
|
|
2322
|
+
meta: import_schema.z.object({
|
|
2323
|
+
breakpoint: import_schema.z.string().optional(),
|
|
2324
|
+
state: import_schema.z.string().optional()
|
|
2325
|
+
}),
|
|
2326
|
+
props: import_schema.z.record(import_schema.z.any())
|
|
2327
|
+
})
|
|
2328
|
+
)
|
|
2329
|
+
})
|
|
2330
|
+
)
|
|
2331
|
+
},
|
|
2332
|
+
handler: async () => {
|
|
2333
|
+
const globalClassesProvider = import_editor_styles_repository5.stylesRepository.getProviderByKey("global-classes");
|
|
2334
|
+
if (!globalClassesProvider) {
|
|
2335
|
+
throw new Error("Global classes provider not found");
|
|
2336
|
+
}
|
|
2337
|
+
const result = [];
|
|
2338
|
+
globalClassesProvider.actions.all().forEach((style) => {
|
|
2339
|
+
const { id: id2, label, variants } = style;
|
|
2340
|
+
result.push({
|
|
2341
|
+
id: id2,
|
|
2342
|
+
label,
|
|
2343
|
+
variants: variants.map((variant) => ({
|
|
2344
|
+
meta: {
|
|
2345
|
+
breakpoint: variant.meta.breakpoint,
|
|
2346
|
+
state: variant.meta.state
|
|
2347
|
+
},
|
|
2348
|
+
props: variant.props
|
|
2349
|
+
}))
|
|
2350
|
+
});
|
|
2351
|
+
});
|
|
2352
|
+
return { appliedClasses: result };
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
server.addTool({
|
|
2356
|
+
schema: {
|
|
2357
|
+
classId: import_schema.z.string().describe("The ID of the class to apply"),
|
|
2358
|
+
elementId: import_schema.z.string().describe("The ID of the element to which the class will be applied")
|
|
2359
|
+
},
|
|
2360
|
+
name: "apply-global-class",
|
|
2361
|
+
description: `Apply a global class to the current element
|
|
2362
|
+
|
|
2363
|
+
## When to use this tool:
|
|
2364
|
+
- When a user requests to apply a global class or a class to an element in the Elementor editor.
|
|
2365
|
+
- When you need to add a specific class to an element's applied classes.
|
|
2366
|
+
|
|
2367
|
+
## Prerequisites:
|
|
2368
|
+
- Ensure you have the most up-to-date list of classes applied to the element to avoid duplicates. You can use the "list-applied-classes" tool to fetch the current classes.
|
|
2369
|
+
- Make sure you have the correct class ID that you want to apply.`,
|
|
2370
|
+
handler: async (params) => {
|
|
2371
|
+
const { classId, elementId } = params;
|
|
2372
|
+
const appliedClasses = (0, import_editor_editing_panel.doGetAppliedClasses)(elementId);
|
|
2373
|
+
(0, import_editor_editing_panel.doApplyClasses)(elementId, [...appliedClasses, classId]);
|
|
2374
|
+
return `Class ${classId} applied to element ${elementId} successfully.`;
|
|
2375
|
+
}
|
|
2376
|
+
});
|
|
2377
|
+
server.addTool({
|
|
2378
|
+
name: "unapply-global-class",
|
|
2379
|
+
schema: {
|
|
2380
|
+
classId: import_schema.z.string().describe("The ID of the class to unapply"),
|
|
2381
|
+
elementId: import_schema.z.string().describe("The ID of the element from which the class will be unapplied")
|
|
2382
|
+
},
|
|
2383
|
+
description: `Unapply a (global) class from the current element
|
|
2384
|
+
|
|
2385
|
+
## When to use this tool:
|
|
2386
|
+
- When a user requests to unapply a global class or a class from an element in the Elementor editor.
|
|
2387
|
+
- When you need to remove a specific class from an element's applied classes.
|
|
2388
|
+
|
|
2389
|
+
## Prerequisites:
|
|
2390
|
+
- Ensure you have the most up-to-date list of classes applied to the element to avoid errors. You can use the "list-global-classes" tool to fetch the all classes applied to all elements.
|
|
2391
|
+
- Make sure you have the correct class ID that you want to unapply.
|
|
2392
|
+
|
|
2393
|
+
<note>
|
|
2394
|
+
If the user want to unapply a class by it's name and not ID, please use the "list-global-classes" tool to get the class ID from the name first.
|
|
2395
|
+
</note>
|
|
2396
|
+
`,
|
|
2397
|
+
handler: async (params) => {
|
|
2398
|
+
const { classId, elementId } = params;
|
|
2399
|
+
const ok = (0, import_editor_editing_panel.doUnapplyClass)(elementId, classId);
|
|
2400
|
+
if (!ok) {
|
|
2401
|
+
throw new Error(`Class ${classId} is not applied to element ${elementId}, cannot unapply it.`);
|
|
2402
|
+
}
|
|
2403
|
+
return `Class ${classId} unapplied from element ${elementId} successfully.`;
|
|
2404
|
+
}
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
// src/mcp-integration/mcp-get-global-class-usages.ts
|
|
2409
|
+
var import_schema2 = require("@elementor/schema");
|
|
2410
|
+
function initMcpApplyGetGlobalClassUsages(reg) {
|
|
2411
|
+
const { addTool } = reg;
|
|
2412
|
+
const globalClassesUsageSchema = {
|
|
2413
|
+
usages: import_schema2.z.array(
|
|
2414
|
+
import_schema2.z.object({
|
|
2415
|
+
classId: import_schema2.z.string().describe(
|
|
2416
|
+
'The ID of the class, not visible to the user. To retreive the name of the class, use the "list-global-classes" tool'
|
|
2417
|
+
),
|
|
2418
|
+
usages: import_schema2.z.array(
|
|
2419
|
+
import_schema2.z.object({
|
|
2420
|
+
pageId: import_schema2.z.string().describe("The ID of the page where the class is used"),
|
|
2421
|
+
title: import_schema2.z.string().describe("The title of the page where the class is used"),
|
|
2422
|
+
total: import_schema2.z.number().describe("The number of times the class is used on this page"),
|
|
2423
|
+
elements: import_schema2.z.array(import_schema2.z.string()).describe("List of element IDs using this class on the page")
|
|
2424
|
+
})
|
|
2425
|
+
)
|
|
2426
|
+
})
|
|
2427
|
+
)
|
|
2428
|
+
};
|
|
2429
|
+
addTool({
|
|
2430
|
+
name: "get-global-class-usages",
|
|
2431
|
+
description: `Retreive the usage details of global classes within the Elementor editor, accross all pages.
|
|
2432
|
+
|
|
2433
|
+
## Prequisites:
|
|
2434
|
+
- Use "list-global-classes" tool to be able to match class IDs to class names/labels.
|
|
2435
|
+
|
|
2436
|
+
## When to use this tool:
|
|
2437
|
+
- When a user requests to see where a specific global class is being used accross the site.
|
|
2438
|
+
- When you need to manage or clean up unused global classes.
|
|
2439
|
+
- Before deleting a global class, to ensure it is not in use in any other pages.
|
|
2440
|
+
`,
|
|
2441
|
+
outputSchema: globalClassesUsageSchema,
|
|
2442
|
+
handler: async () => {
|
|
2443
|
+
const data = await fetchCssClassUsage();
|
|
2444
|
+
const result = {
|
|
2445
|
+
usages: []
|
|
2446
|
+
};
|
|
2447
|
+
Object.entries(data).forEach(
|
|
2448
|
+
([classId, usageDetails]) => {
|
|
2449
|
+
const newEntry = {
|
|
2450
|
+
classId,
|
|
2451
|
+
usages: []
|
|
2452
|
+
};
|
|
2453
|
+
if (typeof usageDetails !== "number") {
|
|
2454
|
+
const { content } = usageDetails;
|
|
2455
|
+
content.forEach((detail) => {
|
|
2456
|
+
newEntry.usages.push({
|
|
2457
|
+
pageId: String(detail.pageId),
|
|
2458
|
+
title: detail.title,
|
|
2459
|
+
total: detail.total,
|
|
2460
|
+
elements: detail.elements
|
|
2461
|
+
});
|
|
2462
|
+
});
|
|
2463
|
+
result.usages.push(newEntry);
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
);
|
|
2467
|
+
return result;
|
|
2468
|
+
}
|
|
2469
|
+
});
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
// src/mcp-integration/index.ts
|
|
2473
|
+
var initMcpIntegration = () => {
|
|
2474
|
+
const reg = (0, import_editor_mcp2.getMCPByDomain)("classes");
|
|
2475
|
+
reg.setMCPDescription(
|
|
2476
|
+
"Tools for managing and applying Global CSS classes to elements within the Elementor editor."
|
|
2477
|
+
);
|
|
2478
|
+
initMcpApplyUnapplyGlobalClasses(reg);
|
|
2479
|
+
initMcpApplyGetGlobalClassUsages(reg);
|
|
2480
|
+
initClassesResource();
|
|
2481
|
+
};
|
|
2482
|
+
|
|
2483
|
+
// src/sync-with-document.tsx
|
|
2484
|
+
var import_react10 = require("react");
|
|
2485
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
2486
|
+
|
|
1944
2487
|
// src/sync-with-document-save.ts
|
|
1945
2488
|
var import_editor_current_user2 = require("@elementor/editor-current-user");
|
|
1946
2489
|
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
1947
2490
|
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
1948
|
-
var
|
|
1949
|
-
function syncWithDocumentSave() {
|
|
2491
|
+
var import_store24 = require("@elementor/store");
|
|
2492
|
+
function syncWithDocumentSave(panelActions) {
|
|
1950
2493
|
const unsubscribe = syncDirtyState();
|
|
1951
|
-
bindSaveAction();
|
|
2494
|
+
bindSaveAction(panelActions);
|
|
1952
2495
|
return unsubscribe;
|
|
1953
2496
|
}
|
|
1954
2497
|
function syncDirtyState() {
|
|
1955
|
-
return (0,
|
|
2498
|
+
return (0, import_store24.__subscribeWithSelector)(selectIsDirty, () => {
|
|
1956
2499
|
if (!isDirty()) {
|
|
1957
2500
|
return;
|
|
1958
2501
|
}
|
|
1959
2502
|
(0, import_editor_documents6.setDocumentModifiedStatus)(true);
|
|
1960
2503
|
});
|
|
1961
2504
|
}
|
|
1962
|
-
function bindSaveAction() {
|
|
1963
|
-
(0, import_editor_v1_adapters4.registerDataHook)("
|
|
2505
|
+
function bindSaveAction(panelActions) {
|
|
2506
|
+
(0, import_editor_v1_adapters4.registerDataHook)("dependency", "document/save/save", (args) => {
|
|
1964
2507
|
const user = (0, import_editor_current_user2.getCurrentUser)();
|
|
1965
2508
|
const canEdit = user?.capabilities.includes(UPDATE_CLASS_CAPABILITY_KEY);
|
|
1966
2509
|
if (!canEdit) {
|
|
1967
|
-
return;
|
|
2510
|
+
return true;
|
|
1968
2511
|
}
|
|
1969
|
-
|
|
1970
|
-
context: args.status === "publish" ? "frontend" : "preview"
|
|
2512
|
+
saveGlobalClasses({
|
|
2513
|
+
context: args.status === "publish" ? "frontend" : "preview",
|
|
2514
|
+
onApprove: panelActions?.open
|
|
1971
2515
|
});
|
|
2516
|
+
return true;
|
|
1972
2517
|
});
|
|
1973
2518
|
}
|
|
1974
2519
|
function isDirty() {
|
|
1975
|
-
return selectIsDirty((0,
|
|
2520
|
+
return selectIsDirty((0, import_store24.__getState)());
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
// src/sync-with-document.tsx
|
|
2524
|
+
function SyncWithDocumentSave() {
|
|
2525
|
+
const panelActions = usePanelActions();
|
|
2526
|
+
(0, import_react10.useEffect)(() => {
|
|
2527
|
+
(0, import_editor_v1_adapters5.__privateListenTo)((0, import_editor_v1_adapters5.v1ReadyEvent)(), () => {
|
|
2528
|
+
syncWithDocumentSave(panelActions);
|
|
2529
|
+
});
|
|
2530
|
+
}, []);
|
|
2531
|
+
return null;
|
|
1976
2532
|
}
|
|
1977
2533
|
|
|
1978
2534
|
// src/init.ts
|
|
1979
2535
|
function init() {
|
|
1980
|
-
(0,
|
|
2536
|
+
(0, import_store26.__registerSlice)(slice);
|
|
1981
2537
|
(0, import_editor_panels2.__registerPanel)(panel);
|
|
1982
|
-
|
|
2538
|
+
import_editor_styles_repository6.stylesRepository.register(globalClassesStylesProvider);
|
|
1983
2539
|
(0, import_editor.injectIntoLogic)({
|
|
1984
2540
|
id: "global-classes-populate-store",
|
|
1985
2541
|
component: PopulateStore
|
|
1986
2542
|
});
|
|
1987
|
-
(0,
|
|
2543
|
+
(0, import_editor.injectIntoLogic)({
|
|
2544
|
+
id: "global-classes-sync-with-document",
|
|
2545
|
+
component: SyncWithDocumentSave
|
|
2546
|
+
});
|
|
2547
|
+
(0, import_editor.injectIntoLogic)({
|
|
2548
|
+
id: "global-classes-prefetch-css-class-usage",
|
|
2549
|
+
component: PrefetchCssClassUsage
|
|
2550
|
+
});
|
|
2551
|
+
(0, import_editor_editing_panel2.injectIntoCssClassConvert)({
|
|
1988
2552
|
id: "global-classes-convert-from-local-class",
|
|
1989
2553
|
component: ConvertLocalClassToGlobalClass
|
|
1990
2554
|
});
|
|
1991
|
-
(0,
|
|
2555
|
+
(0, import_editor_editing_panel2.injectIntoClassSelectorActions)({
|
|
1992
2556
|
id: "global-classes-manager-button",
|
|
1993
2557
|
component: ClassManagerButton
|
|
1994
2558
|
});
|
|
1995
|
-
(0,
|
|
2559
|
+
(0, import_editor_editing_panel2.registerStyleProviderToColors)(GLOBAL_CLASSES_PROVIDER_KEY, {
|
|
1996
2560
|
name: "global",
|
|
1997
2561
|
getThemeColor: (theme) => theme.palette.global.dark
|
|
1998
2562
|
});
|
|
1999
|
-
(
|
|
2000
|
-
syncWithDocumentSave();
|
|
2001
|
-
});
|
|
2563
|
+
initMcpIntegration();
|
|
2002
2564
|
}
|
|
2003
2565
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2004
2566
|
0 && (module.exports = {
|