@elementor/editor-global-classes 4.1.0-825 → 4.1.0-827
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +664 -567
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +676 -580
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/class-manager/class-manager-button.tsx +16 -6
- package/src/components/class-manager/class-manager-panel.tsx +196 -90
- package/src/index.ts +4 -0
- package/src/init.ts +11 -5
- package/src/sync-with-document.tsx +13 -5
package/dist/index.mjs
CHANGED
|
@@ -1,30 +1,45 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/components/class-manager/class-manager-panel.tsx
|
|
2
|
+
import * as React19 from "react";
|
|
3
|
+
import { useCallback, useEffect as useEffect4, useMemo as useMemo4, useState as useState7 } from "react";
|
|
4
|
+
import { useSuppressedMessage as useSuppressedMessage2 } from "@elementor/editor-current-user";
|
|
5
|
+
import { reloadCurrentDocument, setDocumentModifiedStatus } from "@elementor/editor-documents";
|
|
2
6
|
import {
|
|
3
|
-
|
|
7
|
+
__createPanel as createPanel,
|
|
8
|
+
Panel,
|
|
9
|
+
PanelBody,
|
|
10
|
+
PanelFooter,
|
|
11
|
+
PanelHeader,
|
|
12
|
+
PanelHeaderTitle
|
|
13
|
+
} from "@elementor/editor-panels";
|
|
14
|
+
import { ConfirmationDialog as ConfirmationDialog2, SaveChangesDialog, ThemeProvider, useDialog } from "@elementor/editor-ui";
|
|
15
|
+
import { changeEditMode } from "@elementor/editor-v1-adapters";
|
|
16
|
+
import { XIcon } from "@elementor/icons";
|
|
17
|
+
import { useMutation } from "@elementor/query";
|
|
18
|
+
import { __dispatch as dispatch3 } from "@elementor/store";
|
|
19
|
+
import {
|
|
20
|
+
Alert as Alert2,
|
|
21
|
+
Box as Box11,
|
|
22
|
+
Button as Button3,
|
|
23
|
+
Chip as Chip4,
|
|
24
|
+
DialogHeader as DialogHeader2,
|
|
25
|
+
Divider as Divider4,
|
|
26
|
+
ErrorBoundary,
|
|
27
|
+
IconButton as IconButton4,
|
|
28
|
+
Stack as Stack9
|
|
29
|
+
} from "@elementor/ui";
|
|
30
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
31
|
+
|
|
32
|
+
// src/hooks/use-classes-order.ts
|
|
33
|
+
import { __useSelector as useSelector } from "@elementor/store";
|
|
34
|
+
|
|
35
|
+
// src/store.ts
|
|
36
|
+
import {
|
|
37
|
+
getVariantByMeta
|
|
4
38
|
} from "@elementor/editor-styles";
|
|
5
|
-
import { createStylesProvider } from "@elementor/editor-styles-repository";
|
|
6
39
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__subscribeWithSelector as subscribeWithSelector
|
|
40
|
+
__createSelector as createSelector,
|
|
41
|
+
__createSlice as createSlice
|
|
10
42
|
} from "@elementor/store";
|
|
11
|
-
import { __ } from "@wordpress/i18n";
|
|
12
|
-
|
|
13
|
-
// src/capabilities.ts
|
|
14
|
-
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
15
|
-
var EXPERIMENT_KEY = "global_classes_should_enforce_capabilities";
|
|
16
|
-
var UPDATE_CLASS_CAPABILITY_KEY = "elementor_global_classes_update_class";
|
|
17
|
-
var getCapabilities = () => {
|
|
18
|
-
const shouldEnforceCapabilities = isExperimentActive(EXPERIMENT_KEY);
|
|
19
|
-
if (shouldEnforceCapabilities) {
|
|
20
|
-
return {
|
|
21
|
-
update: UPDATE_CLASS_CAPABILITY_KEY,
|
|
22
|
-
create: UPDATE_CLASS_CAPABILITY_KEY,
|
|
23
|
-
delete: UPDATE_CLASS_CAPABILITY_KEY,
|
|
24
|
-
updateProps: UPDATE_CLASS_CAPABILITY_KEY
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
43
|
|
|
29
44
|
// src/errors.ts
|
|
30
45
|
import { createError } from "@elementor/utils";
|
|
@@ -41,15 +56,6 @@ var GlobalClassTrackingError = createError({
|
|
|
41
56
|
message: "Error tracking global classes event."
|
|
42
57
|
});
|
|
43
58
|
|
|
44
|
-
// src/store.ts
|
|
45
|
-
import {
|
|
46
|
-
getVariantByMeta
|
|
47
|
-
} from "@elementor/editor-styles";
|
|
48
|
-
import {
|
|
49
|
-
__createSelector as createSelector,
|
|
50
|
-
__createSlice as createSlice
|
|
51
|
-
} from "@elementor/store";
|
|
52
|
-
|
|
53
59
|
// src/utils/snapshot-history.ts
|
|
54
60
|
function createLink({ value, next, prev }) {
|
|
55
61
|
return {
|
|
@@ -232,423 +238,41 @@ var slice = createSlice({
|
|
|
232
238
|
}
|
|
233
239
|
}
|
|
234
240
|
}
|
|
235
|
-
});
|
|
236
|
-
var mergeProps = (current, updates) => {
|
|
237
|
-
const props = Array.isArray(current) ? {} : current;
|
|
238
|
-
Object.entries(updates).forEach(([key, value]) => {
|
|
239
|
-
if (value === null || value === void 0) {
|
|
240
|
-
delete props[key];
|
|
241
|
-
} else {
|
|
242
|
-
props[key] = value;
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
return props;
|
|
246
|
-
};
|
|
247
|
-
var getNonEmptyVariants = (style) => {
|
|
248
|
-
return style.variants.filter(
|
|
249
|
-
({ props, custom_css: customCss }) => Object.keys(props).length || customCss?.raw
|
|
250
|
-
);
|
|
251
|
-
};
|
|
252
|
-
var selectData = (state) => state[SLICE_NAME].data;
|
|
253
|
-
var selectFrontendInitialData = (state) => state[SLICE_NAME].initialData.frontend;
|
|
254
|
-
var selectPreviewInitialData = (state) => state[SLICE_NAME].initialData.preview;
|
|
255
|
-
var selectOrder = createSelector(selectData, ({ order }) => order);
|
|
256
|
-
var selectGlobalClasses = createSelector(selectData, ({ items }) => items);
|
|
257
|
-
var selectIsDirty = (state) => state[SLICE_NAME].isDirty;
|
|
258
|
-
var selectOrderedClasses = createSelector(
|
|
259
|
-
selectGlobalClasses,
|
|
260
|
-
selectOrder,
|
|
261
|
-
(items, order) => order.map((id2) => items[id2])
|
|
262
|
-
);
|
|
263
|
-
var selectClass = (state, id2) => state[SLICE_NAME].data.items[id2] ?? null;
|
|
264
|
-
var selectEmptyCssClass = createSelector(
|
|
265
|
-
selectData,
|
|
266
|
-
({ items }) => Object.values(items).filter((cssClass) => cssClass.variants.length === 0)
|
|
267
|
-
);
|
|
268
|
-
|
|
269
|
-
// src/utils/tracking.ts
|
|
270
|
-
import { getMixpanel } from "@elementor/events";
|
|
271
|
-
import { __getState as getState } from "@elementor/store";
|
|
272
|
-
|
|
273
|
-
// src/api.ts
|
|
274
|
-
import { httpService } from "@elementor/http-client";
|
|
275
|
-
var RESOURCE_URL = "/global-classes";
|
|
276
|
-
var BASE_URL = "elementor/v1";
|
|
277
|
-
var RESOURCE_USAGE_URL = `${RESOURCE_URL}/usage`;
|
|
278
|
-
var apiClient = {
|
|
279
|
-
usage: () => httpService().get(`${BASE_URL}${RESOURCE_USAGE_URL}`),
|
|
280
|
-
all: (context2 = "preview") => httpService().get(`${BASE_URL}${RESOURCE_URL}`, {
|
|
281
|
-
params: { context: context2 }
|
|
282
|
-
}),
|
|
283
|
-
publish: (payload) => httpService().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
284
|
-
params: {
|
|
285
|
-
context: "frontend"
|
|
286
|
-
}
|
|
287
|
-
}),
|
|
288
|
-
saveDraft: (payload) => httpService().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
289
|
-
params: {
|
|
290
|
-
context: "preview"
|
|
291
|
-
}
|
|
292
|
-
})
|
|
293
|
-
};
|
|
294
|
-
var API_ERROR_CODES = {
|
|
295
|
-
DUPLICATED_LABEL: "DUPLICATED_LABEL"
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
// src/components/css-class-usage/utils.ts
|
|
299
|
-
var transformData = (data) => Object.entries(data).reduce((acc, [key, value]) => {
|
|
300
|
-
acc[key] = {
|
|
301
|
-
content: value || [],
|
|
302
|
-
total: value.reduce((total, val) => total + (val?.total || 0), 0)
|
|
303
|
-
};
|
|
304
|
-
return acc;
|
|
305
|
-
}, {});
|
|
306
|
-
|
|
307
|
-
// service/css-class-usage-service.ts
|
|
308
|
-
var fetchCssClassUsage = async () => {
|
|
309
|
-
const response = await apiClient.usage();
|
|
310
|
-
return transformData(response?.data?.data || {});
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
// src/utils/tracking.ts
|
|
314
|
-
var trackGlobalClasses = async (payload) => {
|
|
315
|
-
const { runAction } = payload;
|
|
316
|
-
const data = await getSanitizedData(payload);
|
|
317
|
-
if (data) {
|
|
318
|
-
track(data);
|
|
319
|
-
if (data.event === "classCreated" && "classId" in data) {
|
|
320
|
-
fireClassApplied(data.classId);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
runAction?.();
|
|
324
|
-
};
|
|
325
|
-
var fireClassApplied = async (classId) => {
|
|
326
|
-
const appliedInfo = await getAppliedInfo(classId);
|
|
327
|
-
track({
|
|
328
|
-
event: "classApplied",
|
|
329
|
-
classId,
|
|
330
|
-
...appliedInfo,
|
|
331
|
-
totalInstancesAfterApply: 1
|
|
332
|
-
});
|
|
333
|
-
};
|
|
334
|
-
var getSanitizedData = async (payload) => {
|
|
335
|
-
switch (payload.event) {
|
|
336
|
-
case "classApplied":
|
|
337
|
-
if ("classId" in payload && payload.classId) {
|
|
338
|
-
const appliedInfo = await getAppliedInfo(payload.classId);
|
|
339
|
-
return { ...payload, ...appliedInfo };
|
|
340
|
-
}
|
|
341
|
-
break;
|
|
342
|
-
case "classRemoved":
|
|
343
|
-
if ("classId" in payload && payload.classId) {
|
|
344
|
-
const deleteInfo = getRemovedInfo(payload.classId);
|
|
345
|
-
return { ...payload, ...deleteInfo };
|
|
346
|
-
}
|
|
347
|
-
break;
|
|
348
|
-
case "classDeleted":
|
|
349
|
-
if ("classId" in payload && payload.classId) {
|
|
350
|
-
const deleteInfo = await trackDeleteClass(payload.classId);
|
|
351
|
-
return { ...payload, ...deleteInfo };
|
|
352
|
-
}
|
|
353
|
-
break;
|
|
354
|
-
case "classCreated":
|
|
355
|
-
if ("source" in payload && payload.source !== "created") {
|
|
356
|
-
if ("classId" in payload && payload.classId) {
|
|
357
|
-
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
return payload;
|
|
361
|
-
case "classStateClicked":
|
|
362
|
-
if ("classId" in payload && payload.classId) {
|
|
363
|
-
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
364
|
-
}
|
|
365
|
-
break;
|
|
366
|
-
case "classSyncToV3PopupShown":
|
|
367
|
-
return {
|
|
368
|
-
...payload,
|
|
369
|
-
interaction_type: "popup_shown",
|
|
370
|
-
target_type: "popup",
|
|
371
|
-
target_name: "sync_to_v3_popup",
|
|
372
|
-
interaction_result: "popup_viewed",
|
|
373
|
-
target_location: "widget_panel",
|
|
374
|
-
location_l1: "class_manager"
|
|
375
|
-
};
|
|
376
|
-
case "classSyncToV3": {
|
|
377
|
-
const classLabel = getCssClass(payload.classId).label;
|
|
378
|
-
const isSync = payload.action === "sync";
|
|
379
|
-
return {
|
|
380
|
-
...payload,
|
|
381
|
-
interaction_type: "click",
|
|
382
|
-
target_type: classLabel,
|
|
383
|
-
target_name: isSync ? "sync_to_v3" : "unsync_to_v3",
|
|
384
|
-
interaction_result: isSync ? "class_is_synced_to_V3" : "class_is_unsynced_from_V3",
|
|
385
|
-
target_location: "widget_panel",
|
|
386
|
-
location_l1: "class_manager",
|
|
387
|
-
interaction_description: isSync ? `user_synced_${classLabel}_to_v3` : `user_unsync_${classLabel}_from_v3`
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
case "classSyncToV3PopupClick": {
|
|
391
|
-
const isSyncAction = payload.action === "sync";
|
|
392
|
-
return {
|
|
393
|
-
...payload,
|
|
394
|
-
interaction_type: "click",
|
|
395
|
-
target_type: "button",
|
|
396
|
-
target_name: isSyncAction ? "sync_to_v3" : "cancel",
|
|
397
|
-
interaction_result: isSyncAction ? "class_is_synced" : "cancel",
|
|
398
|
-
target_location: "sync_to_v3_popup"
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
default:
|
|
402
|
-
return payload;
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
var track = (data) => {
|
|
406
|
-
const { dispatchEvent, config } = getMixpanel();
|
|
407
|
-
if (!config?.names?.global_classes?.[data.event]) {
|
|
408
|
-
console.error("Global class tracking event not found", { event: data.event });
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
const name = config.names.global_classes[data.event];
|
|
412
|
-
const { event, ...eventData } = data;
|
|
413
|
-
try {
|
|
414
|
-
dispatchEvent?.(name, {
|
|
415
|
-
event,
|
|
416
|
-
...eventData
|
|
417
|
-
});
|
|
418
|
-
} catch (error) {
|
|
419
|
-
throw new GlobalClassTrackingError({ cause: error });
|
|
420
|
-
}
|
|
421
|
-
};
|
|
422
|
-
var extractCssClassData = (classId) => {
|
|
423
|
-
const cssClass = getCssClass(classId);
|
|
424
|
-
const classTitle = cssClass.label;
|
|
425
|
-
return { classTitle };
|
|
426
|
-
};
|
|
427
|
-
var getCssClass = (classId) => {
|
|
428
|
-
const cssClass = selectClass(getState(), classId);
|
|
429
|
-
if (!cssClass) {
|
|
430
|
-
throw new Error(`CSS class with ID ${classId} not found`);
|
|
431
|
-
}
|
|
432
|
-
return cssClass;
|
|
433
|
-
};
|
|
434
|
-
var trackDeleteClass = async (classId) => {
|
|
435
|
-
const totalInstances = await getTotalInstancesByCssClassID(classId);
|
|
436
|
-
const classTitle = getCssClass(classId).label;
|
|
437
|
-
return { totalInstances, classTitle };
|
|
438
|
-
};
|
|
439
|
-
var getTotalInstancesByCssClassID = async (classId) => {
|
|
440
|
-
const cssClassUsage = await fetchCssClassUsage();
|
|
441
|
-
return cssClassUsage[classId]?.total ?? 1;
|
|
442
|
-
};
|
|
443
|
-
var getAppliedInfo = async (classId) => {
|
|
444
|
-
const { classTitle } = extractCssClassData(classId);
|
|
445
|
-
const totalInstancesAfterApply = await getTotalInstancesByCssClassID(classId) + 1;
|
|
446
|
-
return { classTitle, totalInstancesAfterApply };
|
|
447
|
-
};
|
|
448
|
-
var getRemovedInfo = (classId) => {
|
|
449
|
-
const { classTitle } = extractCssClassData(classId);
|
|
450
|
-
return {
|
|
451
|
-
classTitle
|
|
452
|
-
};
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
// src/global-classes-styles-provider.ts
|
|
456
|
-
var MAX_CLASSES = 100;
|
|
457
|
-
var GLOBAL_CLASSES_PROVIDER_KEY = "global-classes";
|
|
458
|
-
var PREGENERATED_LINK_PATTERN = /^global-(preview|frontend)-[a-zA-Z_-]+-css$/;
|
|
459
|
-
var globalClassesStylesProvider = createStylesProvider({
|
|
460
|
-
key: GLOBAL_CLASSES_PROVIDER_KEY,
|
|
461
|
-
priority: 30,
|
|
462
|
-
limit: MAX_CLASSES,
|
|
463
|
-
isPregeneratedLink: ({ id: id2 }) => PREGENERATED_LINK_PATTERN.test(id2),
|
|
464
|
-
labels: {
|
|
465
|
-
singular: __("class", "elementor"),
|
|
466
|
-
plural: __("classes", "elementor")
|
|
467
|
-
},
|
|
468
|
-
subscribe: (cb) => subscribeWithStates(cb),
|
|
469
|
-
capabilities: getCapabilities(),
|
|
470
|
-
actions: {
|
|
471
|
-
all: () => selectOrderedClasses(getState2()),
|
|
472
|
-
get: (id2) => selectClass(getState2(), id2),
|
|
473
|
-
resolveCssName: (id2) => {
|
|
474
|
-
return selectClass(getState2(), id2)?.label ?? id2;
|
|
475
|
-
},
|
|
476
|
-
create: (label, variants = [], id2) => {
|
|
477
|
-
const classes = selectGlobalClasses(getState2());
|
|
478
|
-
const existingLabels = Object.values(classes).map((style) => style.label);
|
|
479
|
-
if (existingLabels.includes(label)) {
|
|
480
|
-
throw new GlobalClassLabelAlreadyExistsError({ context: { label } });
|
|
481
|
-
}
|
|
482
|
-
if (!id2) {
|
|
483
|
-
id2 = generateId("g-", Object.keys(classes));
|
|
484
|
-
}
|
|
485
|
-
dispatch(
|
|
486
|
-
slice.actions.add({
|
|
487
|
-
id: id2,
|
|
488
|
-
type: "class",
|
|
489
|
-
label,
|
|
490
|
-
variants
|
|
491
|
-
})
|
|
492
|
-
);
|
|
493
|
-
return id2;
|
|
494
|
-
},
|
|
495
|
-
update: (payload) => {
|
|
496
|
-
dispatch(
|
|
497
|
-
slice.actions.update({
|
|
498
|
-
style: payload
|
|
499
|
-
})
|
|
500
|
-
);
|
|
501
|
-
},
|
|
502
|
-
delete: (id2) => {
|
|
503
|
-
dispatch(slice.actions.delete(id2));
|
|
504
|
-
},
|
|
505
|
-
updateProps: (args) => {
|
|
506
|
-
dispatch(
|
|
507
|
-
slice.actions.updateProps({
|
|
508
|
-
id: args.id,
|
|
509
|
-
meta: args.meta,
|
|
510
|
-
props: args.props,
|
|
511
|
-
mode: args.mode
|
|
512
|
-
})
|
|
513
|
-
);
|
|
514
|
-
},
|
|
515
|
-
updateCustomCss: (args) => {
|
|
516
|
-
dispatch(
|
|
517
|
-
slice.actions.updateProps({
|
|
518
|
-
id: args.id,
|
|
519
|
-
meta: args.meta,
|
|
520
|
-
custom_css: args.custom_css,
|
|
521
|
-
props: {}
|
|
522
|
-
})
|
|
523
|
-
);
|
|
524
|
-
},
|
|
525
|
-
tracking: (data) => {
|
|
526
|
-
trackGlobalClasses(data).catch((error) => {
|
|
527
|
-
throw new GlobalClassTrackingError({ cause: error });
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
});
|
|
532
|
-
var subscribeWithStates = (cb) => {
|
|
533
|
-
let previousState = selectData(getState2());
|
|
534
|
-
return subscribeWithSelector(
|
|
535
|
-
(state) => state.globalClasses,
|
|
536
|
-
(currentState) => {
|
|
537
|
-
cb(previousState.items, currentState.data.items);
|
|
538
|
-
previousState = currentState.data;
|
|
539
|
-
}
|
|
540
|
-
);
|
|
541
|
-
};
|
|
542
|
-
|
|
543
|
-
// src/mcp-integration/classes-resource.ts
|
|
544
|
-
var GLOBAL_CLASSES_URI = "elementor://global-classes";
|
|
545
|
-
var STORAGE_KEY = "elementor-global-classes";
|
|
546
|
-
var updateLocalStorageCache = () => {
|
|
547
|
-
const classes = globalClassesStylesProvider.actions.all();
|
|
548
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(classes));
|
|
549
|
-
};
|
|
550
|
-
var initClassesResource = (classesMcpEntry, canvasMcpEntry) => {
|
|
551
|
-
[canvasMcpEntry, classesMcpEntry].forEach((entry) => {
|
|
552
|
-
const { sendResourceUpdated, resource, waitForReady } = entry;
|
|
553
|
-
resource(
|
|
554
|
-
"global-classes",
|
|
555
|
-
GLOBAL_CLASSES_URI,
|
|
556
|
-
{
|
|
557
|
-
description: "Global classes list."
|
|
558
|
-
},
|
|
559
|
-
async () => {
|
|
560
|
-
return {
|
|
561
|
-
contents: [{ uri: GLOBAL_CLASSES_URI, text: localStorage[STORAGE_KEY] ?? "[]" }]
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
);
|
|
565
|
-
waitForReady().then(() => {
|
|
566
|
-
updateLocalStorageCache();
|
|
567
|
-
globalClassesStylesProvider.subscribe(() => {
|
|
568
|
-
updateLocalStorageCache();
|
|
569
|
-
sendResourceUpdated({ uri: GLOBAL_CLASSES_URI });
|
|
570
|
-
});
|
|
571
|
-
});
|
|
572
|
-
});
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
// src/init.ts
|
|
576
|
-
import { injectIntoLogic } from "@elementor/editor";
|
|
577
|
-
import {
|
|
578
|
-
injectIntoClassSelectorActions,
|
|
579
|
-
injectIntoCssClassConvert,
|
|
580
|
-
registerStyleProviderToColors
|
|
581
|
-
} from "@elementor/editor-editing-panel";
|
|
582
|
-
import { getMCPByDomain } from "@elementor/editor-mcp";
|
|
583
|
-
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
584
|
-
import { stylesRepository } from "@elementor/editor-styles-repository";
|
|
585
|
-
import { __registerSlice as registerSlice } from "@elementor/store";
|
|
586
|
-
|
|
587
|
-
// src/components/class-manager/class-manager-button.tsx
|
|
588
|
-
import * as React20 from "react";
|
|
589
|
-
import {
|
|
590
|
-
__useActiveDocument as useActiveDocument2,
|
|
591
|
-
__useActiveDocumentActions as useActiveDocumentActions
|
|
592
|
-
} from "@elementor/editor-documents";
|
|
593
|
-
import { useUserStylesCapability } from "@elementor/editor-styles-repository";
|
|
594
|
-
import { SaveChangesDialog as SaveChangesDialog2, useDialog as useDialog2 } from "@elementor/editor-ui";
|
|
595
|
-
import { IconButton as IconButton5, Tooltip as Tooltip6 } from "@elementor/ui";
|
|
596
|
-
import { __ as __16 } from "@wordpress/i18n";
|
|
597
|
-
|
|
598
|
-
// src/hooks/use-prefetch-css-class-usage.ts
|
|
599
|
-
import { useQueryClient } from "@elementor/query";
|
|
600
|
-
|
|
601
|
-
// src/components/css-class-usage/types.ts
|
|
602
|
-
var QUERY_KEY = "css-classes-usage";
|
|
603
|
-
|
|
604
|
-
// src/hooks/use-prefetch-css-class-usage.ts
|
|
605
|
-
function usePrefetchCssClassUsage() {
|
|
606
|
-
const queryClient = useQueryClient();
|
|
607
|
-
const prefetchClassesUsage = () => queryClient.prefetchQuery({
|
|
608
|
-
queryKey: [QUERY_KEY],
|
|
609
|
-
queryFn: fetchCssClassUsage
|
|
610
|
-
});
|
|
611
|
-
return { prefetchClassesUsage };
|
|
612
|
-
}
|
|
613
|
-
var PrefetchCssClassUsage = () => {
|
|
614
|
-
const { prefetchClassesUsage } = usePrefetchCssClassUsage();
|
|
615
|
-
prefetchClassesUsage();
|
|
616
|
-
return null;
|
|
617
|
-
};
|
|
618
|
-
|
|
619
|
-
// src/components/class-manager/class-manager-panel.tsx
|
|
620
|
-
import * as React19 from "react";
|
|
621
|
-
import { useCallback, useEffect as useEffect4, useState as useState7 } from "react";
|
|
622
|
-
import { useSuppressedMessage as useSuppressedMessage2 } from "@elementor/editor-current-user";
|
|
623
|
-
import { reloadCurrentDocument, setDocumentModifiedStatus } from "@elementor/editor-documents";
|
|
624
|
-
import {
|
|
625
|
-
__createPanel as createPanel,
|
|
626
|
-
Panel,
|
|
627
|
-
PanelBody,
|
|
628
|
-
PanelFooter,
|
|
629
|
-
PanelHeader,
|
|
630
|
-
PanelHeaderTitle
|
|
631
|
-
} from "@elementor/editor-panels";
|
|
632
|
-
import { ConfirmationDialog as ConfirmationDialog2, SaveChangesDialog, ThemeProvider, useDialog } from "@elementor/editor-ui";
|
|
633
|
-
import { changeEditMode } from "@elementor/editor-v1-adapters";
|
|
634
|
-
import { XIcon } from "@elementor/icons";
|
|
635
|
-
import { useMutation } from "@elementor/query";
|
|
636
|
-
import { __dispatch as dispatch4 } from "@elementor/store";
|
|
637
|
-
import {
|
|
638
|
-
Alert as Alert2,
|
|
639
|
-
Box as Box11,
|
|
640
|
-
Button as Button3,
|
|
641
|
-
Chip as Chip4,
|
|
642
|
-
DialogHeader as DialogHeader2,
|
|
643
|
-
Divider as Divider4,
|
|
644
|
-
ErrorBoundary,
|
|
645
|
-
IconButton as IconButton4,
|
|
646
|
-
Stack as Stack9
|
|
647
|
-
} from "@elementor/ui";
|
|
648
|
-
import { __ as __15 } from "@wordpress/i18n";
|
|
241
|
+
});
|
|
242
|
+
var mergeProps = (current, updates) => {
|
|
243
|
+
const props = Array.isArray(current) ? {} : current;
|
|
244
|
+
Object.entries(updates).forEach(([key, value]) => {
|
|
245
|
+
if (value === null || value === void 0) {
|
|
246
|
+
delete props[key];
|
|
247
|
+
} else {
|
|
248
|
+
props[key] = value;
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
return props;
|
|
252
|
+
};
|
|
253
|
+
var getNonEmptyVariants = (style) => {
|
|
254
|
+
return style.variants.filter(
|
|
255
|
+
({ props, custom_css: customCss }) => Object.keys(props).length || customCss?.raw
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
var selectData = (state) => state[SLICE_NAME].data;
|
|
259
|
+
var selectFrontendInitialData = (state) => state[SLICE_NAME].initialData.frontend;
|
|
260
|
+
var selectPreviewInitialData = (state) => state[SLICE_NAME].initialData.preview;
|
|
261
|
+
var selectOrder = createSelector(selectData, ({ order }) => order);
|
|
262
|
+
var selectGlobalClasses = createSelector(selectData, ({ items }) => items);
|
|
263
|
+
var selectIsDirty = (state) => state[SLICE_NAME].isDirty;
|
|
264
|
+
var selectOrderedClasses = createSelector(
|
|
265
|
+
selectGlobalClasses,
|
|
266
|
+
selectOrder,
|
|
267
|
+
(items, order) => order.map((id2) => items[id2])
|
|
268
|
+
);
|
|
269
|
+
var selectClass = (state, id2) => state[SLICE_NAME].data.items[id2] ?? null;
|
|
270
|
+
var selectEmptyCssClass = createSelector(
|
|
271
|
+
selectData,
|
|
272
|
+
({ items }) => Object.values(items).filter((cssClass) => cssClass.variants.length === 0)
|
|
273
|
+
);
|
|
649
274
|
|
|
650
275
|
// src/hooks/use-classes-order.ts
|
|
651
|
-
import { __useSelector as useSelector } from "@elementor/store";
|
|
652
276
|
var useClassesOrder = () => {
|
|
653
277
|
return useSelector(selectOrder);
|
|
654
278
|
};
|
|
@@ -726,6 +350,51 @@ import { __useActiveDocument as useActiveDocument } from "@elementor/editor-docu
|
|
|
726
350
|
|
|
727
351
|
// src/hooks/use-css-class-usage.ts
|
|
728
352
|
import { useQuery } from "@elementor/query";
|
|
353
|
+
|
|
354
|
+
// src/api.ts
|
|
355
|
+
import { httpService } from "@elementor/http-client";
|
|
356
|
+
var RESOURCE_URL = "/global-classes";
|
|
357
|
+
var BASE_URL = "elementor/v1";
|
|
358
|
+
var RESOURCE_USAGE_URL = `${RESOURCE_URL}/usage`;
|
|
359
|
+
var apiClient = {
|
|
360
|
+
usage: () => httpService().get(`${BASE_URL}${RESOURCE_USAGE_URL}`),
|
|
361
|
+
all: (context2 = "preview") => httpService().get(`${BASE_URL}${RESOURCE_URL}`, {
|
|
362
|
+
params: { context: context2 }
|
|
363
|
+
}),
|
|
364
|
+
publish: (payload) => httpService().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
365
|
+
params: {
|
|
366
|
+
context: "frontend"
|
|
367
|
+
}
|
|
368
|
+
}),
|
|
369
|
+
saveDraft: (payload) => httpService().put("elementor/v1" + RESOURCE_URL, payload, {
|
|
370
|
+
params: {
|
|
371
|
+
context: "preview"
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
};
|
|
375
|
+
var API_ERROR_CODES = {
|
|
376
|
+
DUPLICATED_LABEL: "DUPLICATED_LABEL"
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
// src/components/css-class-usage/utils.ts
|
|
380
|
+
var transformData = (data) => Object.entries(data).reduce((acc, [key, value]) => {
|
|
381
|
+
acc[key] = {
|
|
382
|
+
content: value || [],
|
|
383
|
+
total: value.reduce((total, val) => total + (val?.total || 0), 0)
|
|
384
|
+
};
|
|
385
|
+
return acc;
|
|
386
|
+
}, {});
|
|
387
|
+
|
|
388
|
+
// service/css-class-usage-service.ts
|
|
389
|
+
var fetchCssClassUsage = async () => {
|
|
390
|
+
const response = await apiClient.usage();
|
|
391
|
+
return transformData(response?.data?.data || {});
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
// src/components/css-class-usage/types.ts
|
|
395
|
+
var QUERY_KEY = "css-classes-usage";
|
|
396
|
+
|
|
397
|
+
// src/hooks/use-css-class-usage.ts
|
|
729
398
|
var useCssClassUsage = () => {
|
|
730
399
|
return useQuery({
|
|
731
400
|
queryKey: [QUERY_KEY],
|
|
@@ -818,7 +487,7 @@ var useFilters = () => {
|
|
|
818
487
|
// src/save-global-classes.tsx
|
|
819
488
|
import * as React3 from "react";
|
|
820
489
|
import { openDialog } from "@elementor/editor-ui";
|
|
821
|
-
import { __dispatch as
|
|
490
|
+
import { __dispatch as dispatch, __getState as getState2 } from "@elementor/store";
|
|
822
491
|
import { hash } from "@elementor/utils";
|
|
823
492
|
|
|
824
493
|
// src/components/class-manager/duplicate-label-dialog.tsx
|
|
@@ -837,7 +506,7 @@ import {
|
|
|
837
506
|
Stack,
|
|
838
507
|
Typography
|
|
839
508
|
} from "@elementor/ui";
|
|
840
|
-
import { __
|
|
509
|
+
import { __ } from "@wordpress/i18n";
|
|
841
510
|
var DUP_PREFIX = "DUP_";
|
|
842
511
|
var DuplicateLabelDialog = ({
|
|
843
512
|
modifiedLabels,
|
|
@@ -848,7 +517,7 @@ var DuplicateLabelDialog = ({
|
|
|
848
517
|
onApprove?.();
|
|
849
518
|
closeDialog();
|
|
850
519
|
};
|
|
851
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React2.createElement(Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React2.createElement(Icon, { color: "secondary" }, /* @__PURE__ */ React2.createElement(InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React2.createElement(Typography, { variant: "subtitle1" },
|
|
520
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React2.createElement(Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React2.createElement(Icon, { color: "secondary" }, /* @__PURE__ */ React2.createElement(InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React2.createElement(Typography, { variant: "subtitle1" }, __("We've published your page and updated class names.", "elementor")))), /* @__PURE__ */ React2.createElement(DialogContent, null, /* @__PURE__ */ React2.createElement(Stack, { spacing: 2, direction: "column" }, /* @__PURE__ */ React2.createElement(Typography, { variant: "body2" }, __(
|
|
852
521
|
"Some new classes used the same names as existing ones. To prevent conflicts, we added the prefix",
|
|
853
522
|
"elementor"
|
|
854
523
|
), /* @__PURE__ */ React2.createElement("strong", null, " ", DUP_PREFIX)), /* @__PURE__ */ React2.createElement(Box, null, /* @__PURE__ */ React2.createElement(
|
|
@@ -873,7 +542,7 @@ var DuplicateLabelDialog = ({
|
|
|
873
542
|
minWidth: 0
|
|
874
543
|
}
|
|
875
544
|
},
|
|
876
|
-
|
|
545
|
+
__("Before", "elementor")
|
|
877
546
|
),
|
|
878
547
|
/* @__PURE__ */ React2.createElement(
|
|
879
548
|
Typography,
|
|
@@ -888,7 +557,7 @@ var DuplicateLabelDialog = ({
|
|
|
888
557
|
maxWidth: "200px"
|
|
889
558
|
}
|
|
890
559
|
},
|
|
891
|
-
|
|
560
|
+
__("After", "elementor")
|
|
892
561
|
)
|
|
893
562
|
), /* @__PURE__ */ React2.createElement(Divider, { sx: { mt: 0.5, mb: 0.5 } }), /* @__PURE__ */ React2.createElement(Stack, { direction: "column", gap: 0.5, sx: { pb: 2 } }, Object.values(modifiedLabels).map(({ original, modified }, index) => /* @__PURE__ */ React2.createElement(
|
|
894
563
|
Box,
|
|
@@ -926,26 +595,170 @@ var DuplicateLabelDialog = ({
|
|
|
926
595
|
},
|
|
927
596
|
/* @__PURE__ */ React2.createElement(EllipsisWithTooltip, { title: modified }, /* @__PURE__ */ React2.createElement(Typography, { variant: "body2", sx: { color: "text.primary" } }, modified))
|
|
928
597
|
)
|
|
929
|
-
))), /* @__PURE__ */ React2.createElement(Box, null, /* @__PURE__ */ React2.createElement(Alert, { severity: "info", size: "small", color: "secondary" }, /* @__PURE__ */ React2.createElement("strong", null,
|
|
598
|
+
))), /* @__PURE__ */ React2.createElement(Box, null, /* @__PURE__ */ React2.createElement(Alert, { severity: "info", size: "small", color: "secondary" }, /* @__PURE__ */ React2.createElement("strong", null, __("Your designs and classes are safe.", "elementor")), __(
|
|
930
599
|
"Only the prefixes were added. Find them in Class Manager by searching",
|
|
931
600
|
"elementor"
|
|
932
|
-
), /* @__PURE__ */ React2.createElement("strong", null, DUP_PREFIX)))))), /* @__PURE__ */ React2.createElement(DialogActions, null, /* @__PURE__ */ React2.createElement(Button, { color: "secondary", variant: "text", onClick: handleButtonClick },
|
|
601
|
+
), /* @__PURE__ */ React2.createElement("strong", null, DUP_PREFIX)))))), /* @__PURE__ */ React2.createElement(DialogActions, null, /* @__PURE__ */ React2.createElement(Button, { color: "secondary", variant: "text", onClick: handleButtonClick }, __("Go to Class Manager", "elementor")), /* @__PURE__ */ React2.createElement(Button, { color: "secondary", variant: "contained", onClick: closeDialog }, __("Done", "elementor"))));
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
// src/utils/tracking.ts
|
|
605
|
+
import { getMixpanel } from "@elementor/events";
|
|
606
|
+
import { __getState as getState } from "@elementor/store";
|
|
607
|
+
var trackGlobalClasses = async (payload) => {
|
|
608
|
+
const { runAction } = payload;
|
|
609
|
+
const data = await getSanitizedData(payload);
|
|
610
|
+
if (data) {
|
|
611
|
+
track(data);
|
|
612
|
+
if (data.event === "classCreated" && "classId" in data) {
|
|
613
|
+
fireClassApplied(data.classId);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
runAction?.();
|
|
617
|
+
};
|
|
618
|
+
var fireClassApplied = async (classId) => {
|
|
619
|
+
const appliedInfo = await getAppliedInfo(classId);
|
|
620
|
+
track({
|
|
621
|
+
event: "classApplied",
|
|
622
|
+
classId,
|
|
623
|
+
...appliedInfo,
|
|
624
|
+
totalInstancesAfterApply: 1
|
|
625
|
+
});
|
|
626
|
+
};
|
|
627
|
+
var getSanitizedData = async (payload) => {
|
|
628
|
+
switch (payload.event) {
|
|
629
|
+
case "classApplied":
|
|
630
|
+
if ("classId" in payload && payload.classId) {
|
|
631
|
+
const appliedInfo = await getAppliedInfo(payload.classId);
|
|
632
|
+
return { ...payload, ...appliedInfo };
|
|
633
|
+
}
|
|
634
|
+
break;
|
|
635
|
+
case "classRemoved":
|
|
636
|
+
if ("classId" in payload && payload.classId) {
|
|
637
|
+
const deleteInfo = getRemovedInfo(payload.classId);
|
|
638
|
+
return { ...payload, ...deleteInfo };
|
|
639
|
+
}
|
|
640
|
+
break;
|
|
641
|
+
case "classDeleted":
|
|
642
|
+
if ("classId" in payload && payload.classId) {
|
|
643
|
+
const deleteInfo = await trackDeleteClass(payload.classId);
|
|
644
|
+
return { ...payload, ...deleteInfo };
|
|
645
|
+
}
|
|
646
|
+
break;
|
|
647
|
+
case "classCreated":
|
|
648
|
+
if ("source" in payload && payload.source !== "created") {
|
|
649
|
+
if ("classId" in payload && payload.classId) {
|
|
650
|
+
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
return payload;
|
|
654
|
+
case "classStateClicked":
|
|
655
|
+
if ("classId" in payload && payload.classId) {
|
|
656
|
+
return { ...payload, classTitle: getCssClass(payload.classId).label };
|
|
657
|
+
}
|
|
658
|
+
break;
|
|
659
|
+
case "classSyncToV3PopupShown":
|
|
660
|
+
return {
|
|
661
|
+
...payload,
|
|
662
|
+
interaction_type: "popup_shown",
|
|
663
|
+
target_type: "popup",
|
|
664
|
+
target_name: "sync_to_v3_popup",
|
|
665
|
+
interaction_result: "popup_viewed",
|
|
666
|
+
target_location: "widget_panel",
|
|
667
|
+
location_l1: "class_manager"
|
|
668
|
+
};
|
|
669
|
+
case "classSyncToV3": {
|
|
670
|
+
const classLabel = getCssClass(payload.classId).label;
|
|
671
|
+
const isSync = payload.action === "sync";
|
|
672
|
+
return {
|
|
673
|
+
...payload,
|
|
674
|
+
interaction_type: "click",
|
|
675
|
+
target_type: classLabel,
|
|
676
|
+
target_name: isSync ? "sync_to_v3" : "unsync_to_v3",
|
|
677
|
+
interaction_result: isSync ? "class_is_synced_to_V3" : "class_is_unsynced_from_V3",
|
|
678
|
+
target_location: "widget_panel",
|
|
679
|
+
location_l1: "class_manager",
|
|
680
|
+
interaction_description: isSync ? `user_synced_${classLabel}_to_v3` : `user_unsync_${classLabel}_from_v3`
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
case "classSyncToV3PopupClick": {
|
|
684
|
+
const isSyncAction = payload.action === "sync";
|
|
685
|
+
return {
|
|
686
|
+
...payload,
|
|
687
|
+
interaction_type: "click",
|
|
688
|
+
target_type: "button",
|
|
689
|
+
target_name: isSyncAction ? "sync_to_v3" : "cancel",
|
|
690
|
+
interaction_result: isSyncAction ? "class_is_synced" : "cancel",
|
|
691
|
+
target_location: "sync_to_v3_popup"
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
default:
|
|
695
|
+
return payload;
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
var track = (data) => {
|
|
699
|
+
const { dispatchEvent, config } = getMixpanel();
|
|
700
|
+
if (!config?.names?.global_classes?.[data.event]) {
|
|
701
|
+
console.error("Global class tracking event not found", { event: data.event });
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
const name = config.names.global_classes[data.event];
|
|
705
|
+
const { event, ...eventData } = data;
|
|
706
|
+
try {
|
|
707
|
+
dispatchEvent?.(name, {
|
|
708
|
+
event,
|
|
709
|
+
...eventData
|
|
710
|
+
});
|
|
711
|
+
} catch (error) {
|
|
712
|
+
throw new GlobalClassTrackingError({ cause: error });
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
var extractCssClassData = (classId) => {
|
|
716
|
+
const cssClass = getCssClass(classId);
|
|
717
|
+
const classTitle = cssClass.label;
|
|
718
|
+
return { classTitle };
|
|
719
|
+
};
|
|
720
|
+
var getCssClass = (classId) => {
|
|
721
|
+
const cssClass = selectClass(getState(), classId);
|
|
722
|
+
if (!cssClass) {
|
|
723
|
+
throw new Error(`CSS class with ID ${classId} not found`);
|
|
724
|
+
}
|
|
725
|
+
return cssClass;
|
|
726
|
+
};
|
|
727
|
+
var trackDeleteClass = async (classId) => {
|
|
728
|
+
const totalInstances = await getTotalInstancesByCssClassID(classId);
|
|
729
|
+
const classTitle = getCssClass(classId).label;
|
|
730
|
+
return { totalInstances, classTitle };
|
|
731
|
+
};
|
|
732
|
+
var getTotalInstancesByCssClassID = async (classId) => {
|
|
733
|
+
const cssClassUsage = await fetchCssClassUsage();
|
|
734
|
+
return cssClassUsage[classId]?.total ?? 1;
|
|
735
|
+
};
|
|
736
|
+
var getAppliedInfo = async (classId) => {
|
|
737
|
+
const { classTitle } = extractCssClassData(classId);
|
|
738
|
+
const totalInstancesAfterApply = await getTotalInstancesByCssClassID(classId) + 1;
|
|
739
|
+
return { classTitle, totalInstancesAfterApply };
|
|
740
|
+
};
|
|
741
|
+
var getRemovedInfo = (classId) => {
|
|
742
|
+
const { classTitle } = extractCssClassData(classId);
|
|
743
|
+
return {
|
|
744
|
+
classTitle
|
|
745
|
+
};
|
|
933
746
|
};
|
|
934
747
|
|
|
935
748
|
// src/save-global-classes.tsx
|
|
936
749
|
async function saveGlobalClasses({ context: context2, onApprove }) {
|
|
937
|
-
const state = selectData(
|
|
750
|
+
const state = selectData(getState2());
|
|
938
751
|
const apiAction = context2 === "preview" ? apiClient.saveDraft : apiClient.publish;
|
|
939
752
|
const currentContext = context2 === "preview" ? selectPreviewInitialData : selectFrontendInitialData;
|
|
940
753
|
const response = await apiAction({
|
|
941
754
|
items: state.items,
|
|
942
755
|
order: state.order,
|
|
943
|
-
changes: calculateChanges(state, currentContext(
|
|
756
|
+
changes: calculateChanges(state, currentContext(getState2()))
|
|
944
757
|
});
|
|
945
|
-
|
|
758
|
+
dispatch(slice.actions.reset({ context: context2 }));
|
|
946
759
|
window.dispatchEvent(new CustomEvent("classes:updated", { detail: { context: context2 } }));
|
|
947
760
|
if (response?.data?.data?.code === API_ERROR_CODES.DUPLICATED_LABEL) {
|
|
948
|
-
|
|
761
|
+
dispatch(slice.actions.updateMultiple(response.data.data.modifiedLabels));
|
|
949
762
|
trackGlobalClasses({
|
|
950
763
|
event: "classPublishConflict",
|
|
951
764
|
numOfConflicts: Object.keys(response.data.data.modifiedLabels).length
|
|
@@ -976,7 +789,7 @@ function calculateChanges(state, initialData) {
|
|
|
976
789
|
// src/components/search-and-filter/components/filter/active-filters.tsx
|
|
977
790
|
import * as React6 from "react";
|
|
978
791
|
import { Chip as Chip2, Stack as Stack3 } from "@elementor/ui";
|
|
979
|
-
import { __ as
|
|
792
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
980
793
|
|
|
981
794
|
// src/components/search-and-filter/components/filter/clear-icon-button.tsx
|
|
982
795
|
import * as React4 from "react";
|
|
@@ -1007,11 +820,11 @@ var CustomIconButton = styled(IconButton)(({ theme }) => ({
|
|
|
1007
820
|
// src/components/search-and-filter/components/filter/filter-list.tsx
|
|
1008
821
|
import * as React5 from "react";
|
|
1009
822
|
import { Checkbox, Chip, MenuItem, MenuList, Stack as Stack2, Typography as Typography2 } from "@elementor/ui";
|
|
1010
|
-
import { __ as
|
|
823
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
1011
824
|
var filterConfig = {
|
|
1012
|
-
unused:
|
|
1013
|
-
empty:
|
|
1014
|
-
onThisPage:
|
|
825
|
+
unused: __2("Unused", "elementor"),
|
|
826
|
+
empty: __2("Empty", "elementor"),
|
|
827
|
+
onThisPage: __2("On this page", "elementor")
|
|
1015
828
|
};
|
|
1016
829
|
var FilterList = () => {
|
|
1017
830
|
const {
|
|
@@ -1094,7 +907,7 @@ var ActiveFilters = () => {
|
|
|
1094
907
|
ClearIconButton,
|
|
1095
908
|
{
|
|
1096
909
|
trigger: "header",
|
|
1097
|
-
tooltipText:
|
|
910
|
+
tooltipText: __3("Clear Filters", "elementor"),
|
|
1098
911
|
sx: { margin: "0 0 auto auto" }
|
|
1099
912
|
}
|
|
1100
913
|
));
|
|
@@ -1115,7 +928,7 @@ import { useEffect } from "react";
|
|
|
1115
928
|
import { PopoverBody, PopoverHeader } from "@elementor/editor-ui";
|
|
1116
929
|
import { FilterIcon } from "@elementor/icons";
|
|
1117
930
|
import { bindPopover, bindToggle, Divider as Divider2, Popover, ToggleButton, Tooltip as Tooltip2, usePopupState } from "@elementor/ui";
|
|
1118
|
-
import { __ as
|
|
931
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
1119
932
|
var CssClassFilter = () => {
|
|
1120
933
|
const {
|
|
1121
934
|
filters: { filters }
|
|
@@ -1132,7 +945,7 @@ var CssClassFilter = () => {
|
|
|
1132
945
|
}
|
|
1133
946
|
}, [popupState.isOpen]);
|
|
1134
947
|
const showCleanIcon = Object.values(filters).some((value) => value);
|
|
1135
|
-
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Tooltip2, { title:
|
|
948
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Tooltip2, { title: __4("Filters", "elementor"), placement: "top" }, /* @__PURE__ */ React7.createElement(
|
|
1136
949
|
ToggleButton,
|
|
1137
950
|
{
|
|
1138
951
|
value: "filter",
|
|
@@ -1166,12 +979,12 @@ var CssClassFilter = () => {
|
|
|
1166
979
|
{
|
|
1167
980
|
trigger: "menu",
|
|
1168
981
|
key: "clear-all-button",
|
|
1169
|
-
tooltipText:
|
|
982
|
+
tooltipText: __4("Clear all", "elementor")
|
|
1170
983
|
}
|
|
1171
984
|
)
|
|
1172
985
|
] : [],
|
|
1173
986
|
onClose: popupState.close,
|
|
1174
|
-
title:
|
|
987
|
+
title: __4("Filters", "elementor"),
|
|
1175
988
|
icon: /* @__PURE__ */ React7.createElement(FilterIcon, { fontSize: "tiny" })
|
|
1176
989
|
}
|
|
1177
990
|
),
|
|
@@ -1191,7 +1004,7 @@ var CssClassFilter = () => {
|
|
|
1191
1004
|
import * as React8 from "react";
|
|
1192
1005
|
import { SearchIcon } from "@elementor/icons";
|
|
1193
1006
|
import { Box as Box3, InputAdornment, Stack as Stack4, TextField } from "@elementor/ui";
|
|
1194
|
-
import { __ as
|
|
1007
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
1195
1008
|
var ClassManagerSearch = () => {
|
|
1196
1009
|
const {
|
|
1197
1010
|
search: { inputValue, handleChange }
|
|
@@ -1208,7 +1021,7 @@ var ClassManagerSearch = () => {
|
|
|
1208
1021
|
event: "classManagerSearched"
|
|
1209
1022
|
});
|
|
1210
1023
|
},
|
|
1211
|
-
placeholder:
|
|
1024
|
+
placeholder: __5("Search", "elementor"),
|
|
1212
1025
|
onChange: (e) => handleChange(e.target.value),
|
|
1213
1026
|
InputProps: {
|
|
1214
1027
|
startAdornment: /* @__PURE__ */ React8.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React8.createElement(SearchIcon, { fontSize: "tiny" }))
|
|
@@ -1223,7 +1036,7 @@ import { useState as useState2 } from "react";
|
|
|
1223
1036
|
import { useSuppressedMessage } from "@elementor/editor-current-user";
|
|
1224
1037
|
import { IntroductionModal } from "@elementor/editor-ui";
|
|
1225
1038
|
import { Box as Box4, Image, Typography as Typography3 } from "@elementor/ui";
|
|
1226
|
-
import { __ as
|
|
1039
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
1227
1040
|
var MESSAGE_KEY = "global-class-manager";
|
|
1228
1041
|
var ClassManagerIntroduction = () => {
|
|
1229
1042
|
const [isMessageSuppressed, suppressMessage] = useSuppressedMessage(MESSAGE_KEY);
|
|
@@ -1232,7 +1045,7 @@ var ClassManagerIntroduction = () => {
|
|
|
1232
1045
|
IntroductionModal,
|
|
1233
1046
|
{
|
|
1234
1047
|
open: shouldShowIntroduction,
|
|
1235
|
-
title:
|
|
1048
|
+
title: __6("Class Manager", "elementor"),
|
|
1236
1049
|
handleClose: (shouldShowAgain) => {
|
|
1237
1050
|
if (!shouldShowAgain) {
|
|
1238
1051
|
suppressMessage();
|
|
@@ -1252,24 +1065,24 @@ var ClassManagerIntroduction = () => {
|
|
|
1252
1065
|
);
|
|
1253
1066
|
};
|
|
1254
1067
|
var IntroductionContent = () => {
|
|
1255
|
-
return /* @__PURE__ */ React9.createElement(Box4, { p: 3 }, /* @__PURE__ */ React9.createElement(Typography3, { variant: "body2" },
|
|
1068
|
+
return /* @__PURE__ */ React9.createElement(Box4, { p: 3 }, /* @__PURE__ */ React9.createElement(Typography3, { variant: "body2" }, __6(
|
|
1256
1069
|
"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.",
|
|
1257
1070
|
"elementor"
|
|
1258
|
-
)), /* @__PURE__ */ React9.createElement("br", null), /* @__PURE__ */ React9.createElement(Typography3, { variant: "body2" },
|
|
1071
|
+
)), /* @__PURE__ */ React9.createElement("br", null), /* @__PURE__ */ React9.createElement(Typography3, { variant: "body2" }, __6(
|
|
1259
1072
|
"Remember, when editing an item within a specific class, any changes you make will apply across all elements in that class.",
|
|
1260
1073
|
"elementor"
|
|
1261
1074
|
)));
|
|
1262
1075
|
};
|
|
1263
1076
|
|
|
1264
1077
|
// src/components/class-manager/delete-class.ts
|
|
1265
|
-
import { __dispatch as
|
|
1078
|
+
import { __dispatch as dispatch2 } from "@elementor/store";
|
|
1266
1079
|
var isDeleted = false;
|
|
1267
1080
|
var deleteClass = (id2) => {
|
|
1268
1081
|
trackGlobalClasses({
|
|
1269
1082
|
event: "classDeleted",
|
|
1270
1083
|
classId: id2,
|
|
1271
1084
|
runAction: () => {
|
|
1272
|
-
|
|
1085
|
+
dispatch2(slice.actions.delete(id2));
|
|
1273
1086
|
isDeleted = true;
|
|
1274
1087
|
}
|
|
1275
1088
|
});
|
|
@@ -1290,7 +1103,7 @@ import { useEffect as useEffect2, useMemo as useMemo3, useState as useState5 } f
|
|
|
1290
1103
|
import { __useDispatch as useDispatch } from "@elementor/store";
|
|
1291
1104
|
import { List, Stack as Stack8, styled as styled6, Typography as Typography8 } from "@elementor/ui";
|
|
1292
1105
|
import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
|
|
1293
|
-
import { __ as
|
|
1106
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1294
1107
|
|
|
1295
1108
|
// src/hooks/use-ordered-classes.ts
|
|
1296
1109
|
import { __useSelector as useSelector3 } from "@elementor/store";
|
|
@@ -1317,7 +1130,7 @@ import {
|
|
|
1317
1130
|
Typography as Typography6,
|
|
1318
1131
|
usePopupState as usePopupState3
|
|
1319
1132
|
} from "@elementor/ui";
|
|
1320
|
-
import { __ as
|
|
1133
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
1321
1134
|
|
|
1322
1135
|
// src/components/css-class-usage/components/css-class-usage-popover.tsx
|
|
1323
1136
|
import * as React11 from "react";
|
|
@@ -1338,7 +1151,7 @@ import {
|
|
|
1338
1151
|
PostTypeIcon
|
|
1339
1152
|
} from "@elementor/icons";
|
|
1340
1153
|
import { Box as Box5, Chip as Chip3, Divider as Divider3, Icon as Icon2, MenuList as MenuList2, Stack as Stack5, styled as styled2, Tooltip as Tooltip3, Typography as Typography4 } from "@elementor/ui";
|
|
1341
|
-
import { __ as
|
|
1154
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
1342
1155
|
|
|
1343
1156
|
// src/hooks/use-css-class-usage-by-id.ts
|
|
1344
1157
|
var EMPTY_CLASS_USAGE = {
|
|
@@ -1354,23 +1167,23 @@ var useCssClassUsageByID = (id2) => {
|
|
|
1354
1167
|
// src/components/css-class-usage/components/css-class-usage-popover.tsx
|
|
1355
1168
|
var iconMapper = {
|
|
1356
1169
|
"wp-post": {
|
|
1357
|
-
label:
|
|
1170
|
+
label: __7("Post", "elementor"),
|
|
1358
1171
|
icon: /* @__PURE__ */ React11.createElement(PostTypeIcon, { fontSize: "inherit" })
|
|
1359
1172
|
},
|
|
1360
1173
|
"wp-page": {
|
|
1361
|
-
label:
|
|
1174
|
+
label: __7("Page", "elementor"),
|
|
1362
1175
|
icon: /* @__PURE__ */ React11.createElement(PagesIcon, { fontSize: "inherit" })
|
|
1363
1176
|
},
|
|
1364
1177
|
popup: {
|
|
1365
|
-
label:
|
|
1178
|
+
label: __7("Popup", "elementor"),
|
|
1366
1179
|
icon: /* @__PURE__ */ React11.createElement(PopupTemplateIcon, { fontSize: "inherit" })
|
|
1367
1180
|
},
|
|
1368
1181
|
header: {
|
|
1369
|
-
label:
|
|
1182
|
+
label: __7("Header", "elementor"),
|
|
1370
1183
|
icon: /* @__PURE__ */ React11.createElement(HeaderTemplateIcon, { fontSize: "inherit" })
|
|
1371
1184
|
},
|
|
1372
1185
|
footer: {
|
|
1373
|
-
label:
|
|
1186
|
+
label: __7("Footer", "elementor"),
|
|
1374
1187
|
icon: /* @__PURE__ */ React11.createElement(FooterTemplateIcon, { fontSize: "inherit" })
|
|
1375
1188
|
}
|
|
1376
1189
|
};
|
|
@@ -1400,7 +1213,7 @@ var CssClassUsagePopover = ({
|
|
|
1400
1213
|
PopoverHeader2,
|
|
1401
1214
|
{
|
|
1402
1215
|
icon: /* @__PURE__ */ React11.createElement(CurrentLocationIcon, { fontSize: "tiny" }),
|
|
1403
|
-
title: /* @__PURE__ */ React11.createElement(Stack5, { flexDirection: "row", gap: 1, alignItems: "center" }, /* @__PURE__ */ React11.createElement(Box5, { "aria-label": "header-title" },
|
|
1216
|
+
title: /* @__PURE__ */ React11.createElement(Stack5, { flexDirection: "row", gap: 1, alignItems: "center" }, /* @__PURE__ */ React11.createElement(Box5, { "aria-label": "header-title" }, __7("Locator", "elementor")), /* @__PURE__ */ React11.createElement(Box5, null, /* @__PURE__ */ React11.createElement(Chip3, { sx: { lineHeight: 1 }, size: "tiny", label: classUsage.total }))),
|
|
1404
1217
|
onClose
|
|
1405
1218
|
}
|
|
1406
1219
|
), /* @__PURE__ */ React11.createElement(Divider3, null), /* @__PURE__ */ React11.createElement(PopoverBody2, { width: 300 }, /* @__PURE__ */ React11.createElement(
|
|
@@ -1491,7 +1304,7 @@ import {
|
|
|
1491
1304
|
Tooltip as Tooltip4,
|
|
1492
1305
|
usePopupState as usePopupState2
|
|
1493
1306
|
} from "@elementor/ui";
|
|
1494
|
-
import { __ as
|
|
1307
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
1495
1308
|
var CssClassUsageTrigger = ({ id: id2, onClick }) => {
|
|
1496
1309
|
const {
|
|
1497
1310
|
data: { total },
|
|
@@ -1572,9 +1385,9 @@ var TooltipWrapper = ({ children, total }) => /* @__PURE__ */ React12.createElem
|
|
|
1572
1385
|
{
|
|
1573
1386
|
disableInteractive: true,
|
|
1574
1387
|
placement: "top",
|
|
1575
|
-
title: `${
|
|
1388
|
+
title: `${__8("Show {{number}} {{locations}}", "elementor").replace("{{number}}", total.toString()).replace(
|
|
1576
1389
|
"{{locations}}",
|
|
1577
|
-
total === 1 ?
|
|
1390
|
+
total === 1 ? __8("location", "elementor") : __8("locations", "elementor")
|
|
1578
1391
|
)}`
|
|
1579
1392
|
},
|
|
1580
1393
|
/* @__PURE__ */ React12.createElement("span", null, children)
|
|
@@ -1585,7 +1398,7 @@ var InfoAlertMessage = ({ children }) => /* @__PURE__ */ React12.createElement(
|
|
|
1585
1398
|
disableInteractive: true,
|
|
1586
1399
|
placement: "top",
|
|
1587
1400
|
color: "secondary",
|
|
1588
|
-
content: /* @__PURE__ */ React12.createElement(InfoAlert, { sx: { mt: 1 } },
|
|
1401
|
+
content: /* @__PURE__ */ React12.createElement(InfoAlert, { sx: { mt: 1 } }, __8("This class isn\u2019t being used yet.", "elementor"))
|
|
1589
1402
|
},
|
|
1590
1403
|
/* @__PURE__ */ React12.createElement("span", null, children)
|
|
1591
1404
|
);
|
|
@@ -1595,7 +1408,7 @@ import * as React13 from "react";
|
|
|
1595
1408
|
import { createContext as createContext2, useContext as useContext2, useState as useState3 } from "react";
|
|
1596
1409
|
import { ConfirmationDialog } from "@elementor/editor-ui";
|
|
1597
1410
|
import { Typography as Typography5 } from "@elementor/ui";
|
|
1598
|
-
import { __ as
|
|
1411
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
1599
1412
|
var context = createContext2(null);
|
|
1600
1413
|
var DeleteConfirmationProvider = ({ children }) => {
|
|
1601
1414
|
const [dialogProps, setDialogProps] = useState3(null);
|
|
@@ -1616,14 +1429,14 @@ var DeleteClassDialog = ({ label, id: id2 }) => {
|
|
|
1616
1429
|
closeDialog2();
|
|
1617
1430
|
deleteClass(id2);
|
|
1618
1431
|
};
|
|
1619
|
-
const text = total && content.length ?
|
|
1432
|
+
const text = total && content.length ? __9(
|
|
1620
1433
|
"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.",
|
|
1621
1434
|
"elementor"
|
|
1622
|
-
).replace("%1", total.toString()).replace("%2", content.length.toString()) :
|
|
1435
|
+
).replace("%1", total.toString()).replace("%2", content.length.toString()) : __9(
|
|
1623
1436
|
"Will permanently remove it from your project and may affect the design across all elements using it. This action cannot be undone.",
|
|
1624
1437
|
"elementor"
|
|
1625
1438
|
);
|
|
1626
|
-
return /* @__PURE__ */ React13.createElement(ConfirmationDialog, { open: true, onClose: closeDialog2 }, /* @__PURE__ */ React13.createElement(ConfirmationDialog.Title, null,
|
|
1439
|
+
return /* @__PURE__ */ React13.createElement(ConfirmationDialog, { open: true, onClose: closeDialog2 }, /* @__PURE__ */ React13.createElement(ConfirmationDialog.Title, null, __9("Delete this class?", "elementor")), /* @__PURE__ */ React13.createElement(ConfirmationDialog.Content, null, /* @__PURE__ */ React13.createElement(ConfirmationDialog.ContentText, null, __9("Deleting", "elementor"), /* @__PURE__ */ React13.createElement(Typography5, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), text)), /* @__PURE__ */ React13.createElement(ConfirmationDialog.Actions, { onClose: closeDialog2, onConfirm: handleConfirm }));
|
|
1627
1440
|
};
|
|
1628
1441
|
var useDeleteConfirmation = () => {
|
|
1629
1442
|
const contextValue = useContext2(context);
|
|
@@ -1777,7 +1590,7 @@ var ClassItem = ({
|
|
|
1777
1590
|
{
|
|
1778
1591
|
placement: "top",
|
|
1779
1592
|
className: "class-item-more-actions",
|
|
1780
|
-
title:
|
|
1593
|
+
title: __10("More actions", "elementor")
|
|
1781
1594
|
},
|
|
1782
1595
|
/* @__PURE__ */ React15.createElement(IconButton3, { size: "tiny", ...bindTrigger2(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React15.createElement(DotsVerticalIcon, { fontSize: "tiny" }))
|
|
1783
1596
|
)
|
|
@@ -1804,7 +1617,7 @@ var ClassItem = ({
|
|
|
1804
1617
|
openEditMode();
|
|
1805
1618
|
}
|
|
1806
1619
|
},
|
|
1807
|
-
/* @__PURE__ */ React15.createElement(Typography6, { variant: "caption", sx: { color: "text.primary" } },
|
|
1620
|
+
/* @__PURE__ */ React15.createElement(Typography6, { variant: "caption", sx: { color: "text.primary" } }, __10("Rename", "elementor"))
|
|
1808
1621
|
),
|
|
1809
1622
|
onToggleSync && /* @__PURE__ */ React15.createElement(
|
|
1810
1623
|
MenuListItem,
|
|
@@ -1814,7 +1627,7 @@ var ClassItem = ({
|
|
|
1814
1627
|
onToggleSync(id2, !syncToV3);
|
|
1815
1628
|
}
|
|
1816
1629
|
},
|
|
1817
|
-
/* @__PURE__ */ React15.createElement(Stack6, { direction: "row", alignItems: "center", gap: 1 }, syncToV3 ? /* @__PURE__ */ React15.createElement(RefreshOffIcon, { fontSize: "tiny" }) : /* @__PURE__ */ React15.createElement(RefreshIcon, { fontSize: "tiny" }), /* @__PURE__ */ React15.createElement(Typography6, { variant: "caption", sx: { color: "text.primary" } }, syncToV3 ?
|
|
1630
|
+
/* @__PURE__ */ React15.createElement(Stack6, { direction: "row", alignItems: "center", gap: 1 }, syncToV3 ? /* @__PURE__ */ React15.createElement(RefreshOffIcon, { fontSize: "tiny" }) : /* @__PURE__ */ React15.createElement(RefreshIcon, { fontSize: "tiny" }), /* @__PURE__ */ React15.createElement(Typography6, { variant: "caption", sx: { color: "text.primary" } }, syncToV3 ? __10("Stop syncing to Global Fonts", "elementor") : __10("Sync to Global Fonts", "elementor")))
|
|
1818
1631
|
),
|
|
1819
1632
|
/* @__PURE__ */ React15.createElement(
|
|
1820
1633
|
MenuListItem,
|
|
@@ -1824,7 +1637,7 @@ var ClassItem = ({
|
|
|
1824
1637
|
openDialog2({ id: id2, label });
|
|
1825
1638
|
}
|
|
1826
1639
|
},
|
|
1827
|
-
/* @__PURE__ */ React15.createElement(Typography6, { variant: "caption", sx: { color: "error.light" } },
|
|
1640
|
+
/* @__PURE__ */ React15.createElement(Typography6, { variant: "caption", sx: { color: "error.light" } }, __10("Delete", "elementor"))
|
|
1828
1641
|
)
|
|
1829
1642
|
));
|
|
1830
1643
|
};
|
|
@@ -1890,7 +1703,7 @@ var validateLabel = (newLabel) => {
|
|
|
1890
1703
|
import * as React16 from "react";
|
|
1891
1704
|
import { ColorSwatchIcon as ColorSwatchIcon2, PhotoIcon } from "@elementor/icons";
|
|
1892
1705
|
import { Box as Box9, Link, Stack as Stack7, Typography as Typography7 } from "@elementor/ui";
|
|
1893
|
-
import { __ as
|
|
1706
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
1894
1707
|
var getNotFoundType = (searchValue, filters, filteredClasses) => {
|
|
1895
1708
|
const searchNotFound = filteredClasses.length <= 0 && searchValue.length > 1;
|
|
1896
1709
|
const filterNotFound = filters && filters.length === 0;
|
|
@@ -1908,18 +1721,18 @@ var getNotFoundType = (searchValue, filters, filteredClasses) => {
|
|
|
1908
1721
|
};
|
|
1909
1722
|
var notFound = {
|
|
1910
1723
|
filterAndSearch: {
|
|
1911
|
-
mainText:
|
|
1912
|
-
sceneryText:
|
|
1724
|
+
mainText: __11("Sorry, nothing matched.", "elementor"),
|
|
1725
|
+
sceneryText: __11("Try something else.", "elementor"),
|
|
1913
1726
|
icon: /* @__PURE__ */ React16.createElement(PhotoIcon, { color: "inherit", fontSize: "large" })
|
|
1914
1727
|
},
|
|
1915
1728
|
search: {
|
|
1916
|
-
mainText:
|
|
1917
|
-
sceneryText:
|
|
1729
|
+
mainText: __11("Sorry, nothing matched", "elementor"),
|
|
1730
|
+
sceneryText: __11("Clear your input and try something else.", "elementor"),
|
|
1918
1731
|
icon: /* @__PURE__ */ React16.createElement(PhotoIcon, { color: "inherit", fontSize: "large" })
|
|
1919
1732
|
},
|
|
1920
1733
|
filter: {
|
|
1921
|
-
mainText:
|
|
1922
|
-
sceneryText:
|
|
1734
|
+
mainText: __11("Sorry, nothing matched that search.", "elementor"),
|
|
1735
|
+
sceneryText: __11("Clear the filters and try something else.", "elementor"),
|
|
1923
1736
|
icon: /* @__PURE__ */ React16.createElement(ColorSwatchIcon2, { color: "inherit", fontSize: "large" })
|
|
1924
1737
|
}
|
|
1925
1738
|
};
|
|
@@ -1992,7 +1805,7 @@ var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) =>
|
|
|
1992
1805
|
)
|
|
1993
1806
|
),
|
|
1994
1807
|
/* @__PURE__ */ React16.createElement(Typography7, { align: "center", variant: "caption", color: "inherit" }, sceneryText),
|
|
1995
|
-
/* @__PURE__ */ React16.createElement(Typography7, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React16.createElement(Link, { color: "secondary", variant: "caption", component: "button", onClick: onClear },
|
|
1808
|
+
/* @__PURE__ */ React16.createElement(Typography7, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React16.createElement(Link, { color: "secondary", variant: "caption", component: "button", onClick: onClear }, __11("Clear & try again", "elementor")))
|
|
1996
1809
|
);
|
|
1997
1810
|
|
|
1998
1811
|
// src/components/class-manager/global-classes-list.tsx
|
|
@@ -2147,7 +1960,7 @@ var GlobalClassesList = ({
|
|
|
2147
1960
|
)
|
|
2148
1961
|
));
|
|
2149
1962
|
};
|
|
2150
|
-
var EmptyState = () => /* @__PURE__ */ React17.createElement(Stack8, { 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" },
|
|
1963
|
+
var EmptyState = () => /* @__PURE__ */ React17.createElement(Stack8, { 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" }, __12("There are no global classes yet.", "elementor")), /* @__PURE__ */ React17.createElement(Typography8, { align: "center", variant: "caption", color: "text.secondary" }, __12(
|
|
2151
1964
|
"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.",
|
|
2152
1965
|
"elementor"
|
|
2153
1966
|
)));
|
|
@@ -2222,7 +2035,7 @@ import {
|
|
|
2222
2035
|
FormControlLabel,
|
|
2223
2036
|
Typography as Typography9
|
|
2224
2037
|
} from "@elementor/ui";
|
|
2225
|
-
import { __ as
|
|
2038
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
2226
2039
|
var IMAGE_URL = "https://assets.elementor.com/packages/v1/images/class-manager-sync-modal.png";
|
|
2227
2040
|
var StartSyncToV3Modal = ({
|
|
2228
2041
|
externalOpen,
|
|
@@ -2254,7 +2067,7 @@ var StartSyncToV3Modal = ({
|
|
|
2254
2067
|
onConfirm?.();
|
|
2255
2068
|
onExternalClose?.();
|
|
2256
2069
|
};
|
|
2257
|
-
return /* @__PURE__ */ React18.createElement(Dialog, { open: !!externalOpen, onClose: handleClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React18.createElement(DialogContent2, { sx: { p: 0 } }, /* @__PURE__ */ React18.createElement(Box10, { component: "img", src: IMAGE_URL, alt: "", sx: { width: "100%", display: "block" } }), /* @__PURE__ */ React18.createElement(Box10, { sx: { px: 3, pt: 4, pb: 1 } }, /* @__PURE__ */ React18.createElement(Typography9, { variant: "h6" },
|
|
2070
|
+
return /* @__PURE__ */ React18.createElement(Dialog, { open: !!externalOpen, onClose: handleClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React18.createElement(DialogContent2, { sx: { p: 0 } }, /* @__PURE__ */ React18.createElement(Box10, { component: "img", src: IMAGE_URL, alt: "", sx: { width: "100%", display: "block" } }), /* @__PURE__ */ React18.createElement(Box10, { sx: { px: 3, pt: 4, pb: 1 } }, /* @__PURE__ */ React18.createElement(Typography9, { variant: "h6" }, __13("Sync class to Global Fonts", "elementor")), /* @__PURE__ */ React18.createElement(Typography9, { variant: "body2", color: "secondary", sx: { mb: 2, pt: 1 } }, __13(
|
|
2258
2071
|
"Only typography settings supported in Global Fonts will be applied, including: font family, responsive font sizes, weight, text transform, decoration, line height, letter spacing, and word spacing. Changes made in the class will automatically apply to Global Fonts.",
|
|
2259
2072
|
"elementor"
|
|
2260
2073
|
)))), /* @__PURE__ */ React18.createElement(DialogActions2, { sx: { justifyContent: "space-between", px: 3, pb: 2 } }, /* @__PURE__ */ React18.createElement(
|
|
@@ -2267,14 +2080,27 @@ var StartSyncToV3Modal = ({
|
|
|
2267
2080
|
onChange: (e) => setShouldShowAgain(!e.target.checked)
|
|
2268
2081
|
}
|
|
2269
2082
|
),
|
|
2270
|
-
label: /* @__PURE__ */ React18.createElement(Typography9, { variant: "body2", color: "secondary" },
|
|
2083
|
+
label: /* @__PURE__ */ React18.createElement(Typography9, { variant: "body2", color: "secondary" }, __13("Don't show again", "elementor"))
|
|
2271
2084
|
}
|
|
2272
|
-
), /* @__PURE__ */ React18.createElement(Box10, { sx: { display: "flex", gap: 1 } }, /* @__PURE__ */ React18.createElement(Button2, { onClick: handleClose, color: "secondary", size: "small" },
|
|
2085
|
+
), /* @__PURE__ */ React18.createElement(Box10, { sx: { display: "flex", gap: 1 } }, /* @__PURE__ */ React18.createElement(Button2, { onClick: handleClose, color: "secondary", size: "small" }, __13("Cancel", "elementor")), /* @__PURE__ */ React18.createElement(Button2, { onClick: handleConfirm, variant: "contained", size: "small" }, __13("Sync to Global Fonts", "elementor")))));
|
|
2273
2086
|
};
|
|
2274
2087
|
|
|
2275
2088
|
// src/components/class-manager/class-manager-panel.tsx
|
|
2276
2089
|
var STOP_SYNC_MESSAGE_KEY = "stop-sync-class";
|
|
2277
2090
|
var id = "global-classes-manager";
|
|
2091
|
+
function ClassManagerPanelEmbedded({ onRequestClose, onExposeCloseAttempt }) {
|
|
2092
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2093
|
+
ClassManagerPanelRoot,
|
|
2094
|
+
{
|
|
2095
|
+
embedded: true,
|
|
2096
|
+
onRequestClose,
|
|
2097
|
+
onExposeCloseAttempt
|
|
2098
|
+
}
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2101
|
+
function ClassManagerPanel() {
|
|
2102
|
+
return /* @__PURE__ */ React19.createElement(ClassManagerPanelRoot, null);
|
|
2103
|
+
}
|
|
2278
2104
|
var { panel, usePanelActions } = createPanel({
|
|
2279
2105
|
id,
|
|
2280
2106
|
component: ClassManagerPanel,
|
|
@@ -2290,9 +2116,18 @@ var { panel, usePanelActions } = createPanel({
|
|
|
2290
2116
|
},
|
|
2291
2117
|
isOpenPreviousElement: true
|
|
2292
2118
|
});
|
|
2293
|
-
function
|
|
2119
|
+
function ClassManagerPanelRoot({
|
|
2120
|
+
embedded = false,
|
|
2121
|
+
onRequestClose,
|
|
2122
|
+
onExposeCloseAttempt
|
|
2123
|
+
} = {}) {
|
|
2294
2124
|
const isDirty2 = useDirtyState();
|
|
2295
|
-
const { close:
|
|
2125
|
+
const { close: closeStandalonePanel } = usePanelActions();
|
|
2126
|
+
const closePanel = useMemo4(
|
|
2127
|
+
() => embedded ? onRequestClose ?? (async () => {
|
|
2128
|
+
}) : closeStandalonePanel,
|
|
2129
|
+
[embedded, onRequestClose, closeStandalonePanel]
|
|
2130
|
+
);
|
|
2296
2131
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
|
|
2297
2132
|
const [stopSyncConfirmation, setStopSyncConfirmation] = useState7(null);
|
|
2298
2133
|
const [startSyncConfirmation, setStartSyncConfirmation] = useState7(null);
|
|
@@ -2300,11 +2135,34 @@ function ClassManagerPanel() {
|
|
|
2300
2135
|
const [scrollElement, setScrollElement] = useState7(null);
|
|
2301
2136
|
const { mutateAsync: publish, isPending: isPublishing } = usePublish();
|
|
2302
2137
|
const resetAndClosePanel = () => {
|
|
2303
|
-
|
|
2138
|
+
dispatch3(slice.actions.resetToInitialState({ context: "frontend" }));
|
|
2304
2139
|
closeSaveChangesDialog();
|
|
2305
2140
|
};
|
|
2141
|
+
const handleClosePanel = useCallback(() => {
|
|
2142
|
+
if (isDirty2) {
|
|
2143
|
+
openSaveChangesDialog();
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
void closePanel();
|
|
2147
|
+
}, [isDirty2, openSaveChangesDialog, closePanel]);
|
|
2148
|
+
useEffect4(() => {
|
|
2149
|
+
if (!embedded || !onExposeCloseAttempt) {
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
onExposeCloseAttempt(() => handleClosePanel());
|
|
2153
|
+
return () => onExposeCloseAttempt(null);
|
|
2154
|
+
}, [embedded, onExposeCloseAttempt, handleClosePanel]);
|
|
2155
|
+
useEffect4(() => {
|
|
2156
|
+
if (!embedded) {
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2159
|
+
blockPanelInteractions();
|
|
2160
|
+
return () => {
|
|
2161
|
+
unblockPanelInteractions();
|
|
2162
|
+
};
|
|
2163
|
+
}, [embedded]);
|
|
2306
2164
|
const handleStopSync = useCallback((classId) => {
|
|
2307
|
-
|
|
2165
|
+
dispatch3(
|
|
2308
2166
|
slice.actions.update({
|
|
2309
2167
|
style: {
|
|
2310
2168
|
id: classId,
|
|
@@ -2316,7 +2174,7 @@ function ClassManagerPanel() {
|
|
|
2316
2174
|
setStopSyncConfirmation(null);
|
|
2317
2175
|
}, []);
|
|
2318
2176
|
const handleStartSync = useCallback((classId) => {
|
|
2319
|
-
|
|
2177
|
+
dispatch3(
|
|
2320
2178
|
slice.actions.update({
|
|
2321
2179
|
style: {
|
|
2322
2180
|
id: classId,
|
|
@@ -2338,51 +2196,29 @@ function ClassManagerPanel() {
|
|
|
2338
2196
|
[isStopSyncSuppressed, handleStopSync]
|
|
2339
2197
|
);
|
|
2340
2198
|
usePreventUnload();
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
sx: { marginLeft: "auto" },
|
|
2345
|
-
disabled: isPublishing,
|
|
2346
|
-
onClose: () => {
|
|
2347
|
-
if (isDirty2) {
|
|
2348
|
-
openSaveChangesDialog();
|
|
2349
|
-
return;
|
|
2350
|
-
}
|
|
2351
|
-
closePanel();
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
|
-
))), /* @__PURE__ */ React19.createElement(
|
|
2355
|
-
PanelBody,
|
|
2199
|
+
const searchFiltersBlock = /* @__PURE__ */ React19.createElement(Box11, { px: 2, pb: 1 }, /* @__PURE__ */ React19.createElement(Stack9, { direction: "row", alignItems: "center", justifyContent: "space-between", gap: 0.5, sx: { pb: 0.5 } }, /* @__PURE__ */ React19.createElement(Box11, { sx: embedded ? { flexGrow: 1, minWidth: 0 } : { flexGrow: 1 } }, /* @__PURE__ */ React19.createElement(ClassManagerSearch, null)), /* @__PURE__ */ React19.createElement(CssClassFilter, null), embedded && /* @__PURE__ */ React19.createElement(TotalCssClassCounter, null)), /* @__PURE__ */ React19.createElement(ActiveFilters, null));
|
|
2200
|
+
const listArea = /* @__PURE__ */ React19.createElement(
|
|
2201
|
+
Box11,
|
|
2356
2202
|
{
|
|
2203
|
+
ref: setScrollElement,
|
|
2204
|
+
px: 2,
|
|
2357
2205
|
sx: {
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2206
|
+
flexGrow: 1,
|
|
2207
|
+
overflowY: "auto",
|
|
2208
|
+
...embedded ? { minHeight: 0 } : {}
|
|
2361
2209
|
}
|
|
2362
2210
|
},
|
|
2363
|
-
/* @__PURE__ */ React19.createElement(Box11, { px: 2, pb: 1 }, /* @__PURE__ */ React19.createElement(Stack9, { direction: "row", justifyContent: "spaceBetween", gap: 0.5, sx: { pb: 0.5 } }, /* @__PURE__ */ React19.createElement(Box11, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React19.createElement(ClassManagerSearch, null)), /* @__PURE__ */ React19.createElement(CssClassFilter, null)), /* @__PURE__ */ React19.createElement(ActiveFilters, null)),
|
|
2364
|
-
/* @__PURE__ */ React19.createElement(Divider4, null),
|
|
2365
2211
|
/* @__PURE__ */ React19.createElement(
|
|
2366
|
-
|
|
2212
|
+
GlobalClassesList,
|
|
2367
2213
|
{
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
}
|
|
2374
|
-
},
|
|
2375
|
-
/* @__PURE__ */ React19.createElement(
|
|
2376
|
-
GlobalClassesList,
|
|
2377
|
-
{
|
|
2378
|
-
disabled: isPublishing,
|
|
2379
|
-
scrollElement,
|
|
2380
|
-
onStopSyncRequest: handleStopSyncRequest,
|
|
2381
|
-
onStartSyncRequest: (classId) => setStartSyncConfirmation(classId)
|
|
2382
|
-
}
|
|
2383
|
-
)
|
|
2214
|
+
disabled: isPublishing,
|
|
2215
|
+
scrollElement,
|
|
2216
|
+
onStopSyncRequest: handleStopSyncRequest,
|
|
2217
|
+
onStartSyncRequest: (classId) => setStartSyncConfirmation(classId)
|
|
2218
|
+
}
|
|
2384
2219
|
)
|
|
2385
|
-
)
|
|
2220
|
+
);
|
|
2221
|
+
const saveFooter = /* @__PURE__ */ React19.createElement(PanelFooter, null, /* @__PURE__ */ React19.createElement(
|
|
2386
2222
|
Button3,
|
|
2387
2223
|
{
|
|
2388
2224
|
fullWidth: true,
|
|
@@ -2393,8 +2229,9 @@ function ClassManagerPanel() {
|
|
|
2393
2229
|
disabled: !isDirty2,
|
|
2394
2230
|
loading: isPublishing
|
|
2395
2231
|
},
|
|
2396
|
-
|
|
2397
|
-
))
|
|
2232
|
+
__14("Save changes", "elementor")
|
|
2233
|
+
));
|
|
2234
|
+
const dialogs = /* @__PURE__ */ React19.createElement(React19.Fragment, null, startSyncConfirmation && /* @__PURE__ */ React19.createElement(
|
|
2398
2235
|
StartSyncToV3Modal,
|
|
2399
2236
|
{
|
|
2400
2237
|
externalOpen: true,
|
|
@@ -2409,30 +2246,84 @@ function ClassManagerPanel() {
|
|
|
2409
2246
|
onClose: () => setStopSyncConfirmation(null),
|
|
2410
2247
|
onConfirm: () => handleStopSync(stopSyncConfirmation)
|
|
2411
2248
|
}
|
|
2412
|
-
), isSaveChangesDialogOpen && /* @__PURE__ */ React19.createElement(SaveChangesDialog, null, /* @__PURE__ */ React19.createElement(DialogHeader2, { onClose: closeSaveChangesDialog, logo: false }, /* @__PURE__ */ React19.createElement(SaveChangesDialog.Title, null,
|
|
2249
|
+
), isSaveChangesDialogOpen && /* @__PURE__ */ React19.createElement(SaveChangesDialog, null, /* @__PURE__ */ React19.createElement(DialogHeader2, { onClose: closeSaveChangesDialog, logo: false }, /* @__PURE__ */ React19.createElement(SaveChangesDialog.Title, null, __14("You have unsaved changes", "elementor"))), /* @__PURE__ */ React19.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React19.createElement(SaveChangesDialog.ContentText, null, __14("You have unsaved changes in the Class Manager.", "elementor")), /* @__PURE__ */ React19.createElement(SaveChangesDialog.ContentText, null, __14("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React19.createElement(
|
|
2413
2250
|
SaveChangesDialog.Actions,
|
|
2414
2251
|
{
|
|
2415
2252
|
actions: {
|
|
2416
2253
|
discard: {
|
|
2417
|
-
label:
|
|
2254
|
+
label: __14("Discard", "elementor"),
|
|
2418
2255
|
action: () => {
|
|
2419
2256
|
resetAndClosePanel();
|
|
2420
2257
|
}
|
|
2421
2258
|
},
|
|
2422
2259
|
confirm: {
|
|
2423
|
-
label:
|
|
2260
|
+
label: __14("Save & Continue", "elementor"),
|
|
2424
2261
|
action: async () => {
|
|
2425
2262
|
await publish();
|
|
2426
2263
|
closeSaveChangesDialog();
|
|
2427
|
-
closePanel();
|
|
2264
|
+
void closePanel();
|
|
2428
2265
|
}
|
|
2429
2266
|
}
|
|
2430
2267
|
}
|
|
2431
2268
|
}
|
|
2432
2269
|
)));
|
|
2270
|
+
const classManagerLayout = embedded ? /* @__PURE__ */ React19.createElement(
|
|
2271
|
+
Stack9,
|
|
2272
|
+
{
|
|
2273
|
+
direction: "column",
|
|
2274
|
+
sx: {
|
|
2275
|
+
height: "100%",
|
|
2276
|
+
width: "100%",
|
|
2277
|
+
flex: 1,
|
|
2278
|
+
minHeight: 0,
|
|
2279
|
+
overflow: "hidden"
|
|
2280
|
+
}
|
|
2281
|
+
},
|
|
2282
|
+
searchFiltersBlock,
|
|
2283
|
+
/* @__PURE__ */ React19.createElement(Divider4, null),
|
|
2284
|
+
listArea,
|
|
2285
|
+
saveFooter
|
|
2286
|
+
) : /* @__PURE__ */ React19.createElement(Panel, null, /* @__PURE__ */ React19.createElement(PanelHeader, null, /* @__PURE__ */ React19.createElement(Stack9, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React19.createElement(Stack9, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React19.createElement(PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React19.createElement(FlippedColorSwatchIcon, { fontSize: "inherit" }), __14("Class Manager", "elementor")), /* @__PURE__ */ React19.createElement(TotalCssClassCounter, null)), /* @__PURE__ */ React19.createElement(
|
|
2287
|
+
ClassPanelCloseButton,
|
|
2288
|
+
{
|
|
2289
|
+
disabled: isPublishing,
|
|
2290
|
+
onClose: () => {
|
|
2291
|
+
if (isDirty2) {
|
|
2292
|
+
openSaveChangesDialog();
|
|
2293
|
+
return;
|
|
2294
|
+
}
|
|
2295
|
+
void closeStandalonePanel();
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
))), /* @__PURE__ */ React19.createElement(
|
|
2299
|
+
PanelBody,
|
|
2300
|
+
{
|
|
2301
|
+
sx: {
|
|
2302
|
+
display: "flex",
|
|
2303
|
+
flexDirection: "column",
|
|
2304
|
+
height: "100%"
|
|
2305
|
+
}
|
|
2306
|
+
},
|
|
2307
|
+
searchFiltersBlock,
|
|
2308
|
+
/* @__PURE__ */ React19.createElement(Divider4, null),
|
|
2309
|
+
listArea
|
|
2310
|
+
), saveFooter);
|
|
2311
|
+
const core = /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(ErrorBoundary, { fallback: /* @__PURE__ */ React19.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React19.createElement(SearchAndFilterProvider, null, classManagerLayout)), /* @__PURE__ */ React19.createElement(ClassManagerIntroduction, null), dialogs);
|
|
2312
|
+
return embedded ? core : /* @__PURE__ */ React19.createElement(ThemeProvider, null, core);
|
|
2433
2313
|
}
|
|
2434
|
-
var
|
|
2435
|
-
|
|
2314
|
+
var ClassPanelCloseButton = ({ onClose, sx, ...props }) => /* @__PURE__ */ React19.createElement(
|
|
2315
|
+
IconButton4,
|
|
2316
|
+
{
|
|
2317
|
+
size: "small",
|
|
2318
|
+
color: "secondary",
|
|
2319
|
+
onClick: onClose,
|
|
2320
|
+
"aria-label": "Close",
|
|
2321
|
+
sx: { marginLeft: "auto", ...sx },
|
|
2322
|
+
...props
|
|
2323
|
+
},
|
|
2324
|
+
/* @__PURE__ */ React19.createElement(XIcon, { fontSize: "small" })
|
|
2325
|
+
);
|
|
2326
|
+
var ErrorBoundaryFallback = () => /* @__PURE__ */ React19.createElement(Box11, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React19.createElement(Alert2, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React19.createElement("strong", null, __14("Something went wrong", "elementor"))));
|
|
2436
2327
|
var usePreventUnload = () => {
|
|
2437
2328
|
const isDirty2 = useDirtyState();
|
|
2438
2329
|
useEffect4(() => {
|
|
@@ -2471,7 +2362,7 @@ var TotalCssClassCounter = () => {
|
|
|
2471
2362
|
};
|
|
2472
2363
|
var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
|
|
2473
2364
|
const [, suppressStopSyncMessage] = useSuppressedMessage2(STOP_SYNC_MESSAGE_KEY);
|
|
2474
|
-
return /* @__PURE__ */ React19.createElement(ConfirmationDialog2, { open, onClose }, /* @__PURE__ */ React19.createElement(ConfirmationDialog2.Title, { icon: FlippedColorSwatchIcon, iconColor: "primary" },
|
|
2365
|
+
return /* @__PURE__ */ React19.createElement(ConfirmationDialog2, { open, onClose }, /* @__PURE__ */ React19.createElement(ConfirmationDialog2.Title, { icon: FlippedColorSwatchIcon, iconColor: "primary" }, __14("Un-sync typography class", "elementor")), /* @__PURE__ */ React19.createElement(ConfirmationDialog2.Content, null, /* @__PURE__ */ React19.createElement(ConfirmationDialog2.ContentText, null, __14("You're about to stop syncing a typography class to Global Fonts.", "elementor")), /* @__PURE__ */ React19.createElement(ConfirmationDialog2.ContentText, { sx: { mt: 1 } }, __14(
|
|
2475
2366
|
"Note that if it's being used anywhere, the affected elements will inherit the default typography.",
|
|
2476
2367
|
"elementor"
|
|
2477
2368
|
))), /* @__PURE__ */ React19.createElement(
|
|
@@ -2479,15 +2370,204 @@ var StopSyncConfirmationDialog = ({ open, onClose, onConfirm }) => {
|
|
|
2479
2370
|
{
|
|
2480
2371
|
onClose,
|
|
2481
2372
|
onConfirm,
|
|
2482
|
-
cancelLabel:
|
|
2483
|
-
confirmLabel:
|
|
2373
|
+
cancelLabel: __14("Cancel", "elementor"),
|
|
2374
|
+
confirmLabel: __14("Got it", "elementor"),
|
|
2484
2375
|
color: "primary",
|
|
2485
2376
|
onSuppressMessage: suppressStopSyncMessage,
|
|
2486
|
-
suppressLabel:
|
|
2377
|
+
suppressLabel: __14("Don't show again", "elementor")
|
|
2487
2378
|
}
|
|
2488
2379
|
));
|
|
2489
2380
|
};
|
|
2490
2381
|
|
|
2382
|
+
// src/global-classes-styles-provider.ts
|
|
2383
|
+
import {
|
|
2384
|
+
generateId
|
|
2385
|
+
} from "@elementor/editor-styles";
|
|
2386
|
+
import { createStylesProvider } from "@elementor/editor-styles-repository";
|
|
2387
|
+
import {
|
|
2388
|
+
__dispatch as dispatch4,
|
|
2389
|
+
__getState as getState3,
|
|
2390
|
+
__subscribeWithSelector as subscribeWithSelector
|
|
2391
|
+
} from "@elementor/store";
|
|
2392
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
2393
|
+
|
|
2394
|
+
// src/capabilities.ts
|
|
2395
|
+
import { isExperimentActive } from "@elementor/editor-v1-adapters";
|
|
2396
|
+
var EXPERIMENT_KEY = "global_classes_should_enforce_capabilities";
|
|
2397
|
+
var UPDATE_CLASS_CAPABILITY_KEY = "elementor_global_classes_update_class";
|
|
2398
|
+
var getCapabilities = () => {
|
|
2399
|
+
const shouldEnforceCapabilities = isExperimentActive(EXPERIMENT_KEY);
|
|
2400
|
+
if (shouldEnforceCapabilities) {
|
|
2401
|
+
return {
|
|
2402
|
+
update: UPDATE_CLASS_CAPABILITY_KEY,
|
|
2403
|
+
create: UPDATE_CLASS_CAPABILITY_KEY,
|
|
2404
|
+
delete: UPDATE_CLASS_CAPABILITY_KEY,
|
|
2405
|
+
updateProps: UPDATE_CLASS_CAPABILITY_KEY
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
|
|
2410
|
+
// src/global-classes-styles-provider.ts
|
|
2411
|
+
var MAX_CLASSES = 100;
|
|
2412
|
+
var GLOBAL_CLASSES_PROVIDER_KEY = "global-classes";
|
|
2413
|
+
var PREGENERATED_LINK_PATTERN = /^global-(preview|frontend)-[a-zA-Z_-]+-css$/;
|
|
2414
|
+
var globalClassesStylesProvider = createStylesProvider({
|
|
2415
|
+
key: GLOBAL_CLASSES_PROVIDER_KEY,
|
|
2416
|
+
priority: 30,
|
|
2417
|
+
limit: MAX_CLASSES,
|
|
2418
|
+
isPregeneratedLink: ({ id: id2 }) => PREGENERATED_LINK_PATTERN.test(id2),
|
|
2419
|
+
labels: {
|
|
2420
|
+
singular: __15("class", "elementor"),
|
|
2421
|
+
plural: __15("classes", "elementor")
|
|
2422
|
+
},
|
|
2423
|
+
subscribe: (cb) => subscribeWithStates(cb),
|
|
2424
|
+
capabilities: getCapabilities(),
|
|
2425
|
+
actions: {
|
|
2426
|
+
all: () => selectOrderedClasses(getState3()),
|
|
2427
|
+
get: (id2) => selectClass(getState3(), id2),
|
|
2428
|
+
resolveCssName: (id2) => {
|
|
2429
|
+
return selectClass(getState3(), id2)?.label ?? id2;
|
|
2430
|
+
},
|
|
2431
|
+
create: (label, variants = [], id2) => {
|
|
2432
|
+
const classes = selectGlobalClasses(getState3());
|
|
2433
|
+
const existingLabels = Object.values(classes).map((style) => style.label);
|
|
2434
|
+
if (existingLabels.includes(label)) {
|
|
2435
|
+
throw new GlobalClassLabelAlreadyExistsError({ context: { label } });
|
|
2436
|
+
}
|
|
2437
|
+
if (!id2) {
|
|
2438
|
+
id2 = generateId("g-", Object.keys(classes));
|
|
2439
|
+
}
|
|
2440
|
+
dispatch4(
|
|
2441
|
+
slice.actions.add({
|
|
2442
|
+
id: id2,
|
|
2443
|
+
type: "class",
|
|
2444
|
+
label,
|
|
2445
|
+
variants
|
|
2446
|
+
})
|
|
2447
|
+
);
|
|
2448
|
+
return id2;
|
|
2449
|
+
},
|
|
2450
|
+
update: (payload) => {
|
|
2451
|
+
dispatch4(
|
|
2452
|
+
slice.actions.update({
|
|
2453
|
+
style: payload
|
|
2454
|
+
})
|
|
2455
|
+
);
|
|
2456
|
+
},
|
|
2457
|
+
delete: (id2) => {
|
|
2458
|
+
dispatch4(slice.actions.delete(id2));
|
|
2459
|
+
},
|
|
2460
|
+
updateProps: (args) => {
|
|
2461
|
+
dispatch4(
|
|
2462
|
+
slice.actions.updateProps({
|
|
2463
|
+
id: args.id,
|
|
2464
|
+
meta: args.meta,
|
|
2465
|
+
props: args.props,
|
|
2466
|
+
mode: args.mode
|
|
2467
|
+
})
|
|
2468
|
+
);
|
|
2469
|
+
},
|
|
2470
|
+
updateCustomCss: (args) => {
|
|
2471
|
+
dispatch4(
|
|
2472
|
+
slice.actions.updateProps({
|
|
2473
|
+
id: args.id,
|
|
2474
|
+
meta: args.meta,
|
|
2475
|
+
custom_css: args.custom_css,
|
|
2476
|
+
props: {}
|
|
2477
|
+
})
|
|
2478
|
+
);
|
|
2479
|
+
},
|
|
2480
|
+
tracking: (data) => {
|
|
2481
|
+
trackGlobalClasses(data).catch((error) => {
|
|
2482
|
+
throw new GlobalClassTrackingError({ cause: error });
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
});
|
|
2487
|
+
var subscribeWithStates = (cb) => {
|
|
2488
|
+
let previousState = selectData(getState3());
|
|
2489
|
+
return subscribeWithSelector(
|
|
2490
|
+
(state) => state.globalClasses,
|
|
2491
|
+
(currentState) => {
|
|
2492
|
+
cb(previousState.items, currentState.data.items);
|
|
2493
|
+
previousState = currentState.data;
|
|
2494
|
+
}
|
|
2495
|
+
);
|
|
2496
|
+
};
|
|
2497
|
+
|
|
2498
|
+
// src/mcp-integration/classes-resource.ts
|
|
2499
|
+
var GLOBAL_CLASSES_URI = "elementor://global-classes";
|
|
2500
|
+
var STORAGE_KEY = "elementor-global-classes";
|
|
2501
|
+
var updateLocalStorageCache = () => {
|
|
2502
|
+
const classes = globalClassesStylesProvider.actions.all();
|
|
2503
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(classes));
|
|
2504
|
+
};
|
|
2505
|
+
var initClassesResource = (classesMcpEntry, canvasMcpEntry) => {
|
|
2506
|
+
[canvasMcpEntry, classesMcpEntry].forEach((entry) => {
|
|
2507
|
+
const { sendResourceUpdated, resource, waitForReady } = entry;
|
|
2508
|
+
resource(
|
|
2509
|
+
"global-classes",
|
|
2510
|
+
GLOBAL_CLASSES_URI,
|
|
2511
|
+
{
|
|
2512
|
+
description: "Global classes list."
|
|
2513
|
+
},
|
|
2514
|
+
async () => {
|
|
2515
|
+
return {
|
|
2516
|
+
contents: [{ uri: GLOBAL_CLASSES_URI, text: localStorage[STORAGE_KEY] ?? "[]" }]
|
|
2517
|
+
};
|
|
2518
|
+
}
|
|
2519
|
+
);
|
|
2520
|
+
waitForReady().then(() => {
|
|
2521
|
+
updateLocalStorageCache();
|
|
2522
|
+
globalClassesStylesProvider.subscribe(() => {
|
|
2523
|
+
updateLocalStorageCache();
|
|
2524
|
+
sendResourceUpdated({ uri: GLOBAL_CLASSES_URI });
|
|
2525
|
+
});
|
|
2526
|
+
});
|
|
2527
|
+
});
|
|
2528
|
+
};
|
|
2529
|
+
|
|
2530
|
+
// src/init.ts
|
|
2531
|
+
import { injectIntoLogic } from "@elementor/editor";
|
|
2532
|
+
import {
|
|
2533
|
+
injectIntoClassSelectorActions,
|
|
2534
|
+
injectIntoCssClassConvert,
|
|
2535
|
+
registerStyleProviderToColors
|
|
2536
|
+
} from "@elementor/editor-editing-panel";
|
|
2537
|
+
import { getMCPByDomain } from "@elementor/editor-mcp";
|
|
2538
|
+
import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
2539
|
+
import { stylesRepository } from "@elementor/editor-styles-repository";
|
|
2540
|
+
import { isExperimentActive as isExperimentActive4 } from "@elementor/editor-v1-adapters";
|
|
2541
|
+
import { __registerSlice as registerSlice } from "@elementor/store";
|
|
2542
|
+
|
|
2543
|
+
// src/components/class-manager/class-manager-button.tsx
|
|
2544
|
+
import * as React20 from "react";
|
|
2545
|
+
import {
|
|
2546
|
+
__useActiveDocument as useActiveDocument2,
|
|
2547
|
+
__useActiveDocumentActions as useActiveDocumentActions
|
|
2548
|
+
} from "@elementor/editor-documents";
|
|
2549
|
+
import { useUserStylesCapability } from "@elementor/editor-styles-repository";
|
|
2550
|
+
import { SaveChangesDialog as SaveChangesDialog2, useDialog as useDialog2 } from "@elementor/editor-ui";
|
|
2551
|
+
import { isExperimentActive as isExperimentActive2 } from "@elementor/editor-v1-adapters";
|
|
2552
|
+
import { IconButton as IconButton5, Tooltip as Tooltip6 } from "@elementor/ui";
|
|
2553
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2554
|
+
|
|
2555
|
+
// src/hooks/use-prefetch-css-class-usage.ts
|
|
2556
|
+
import { useQueryClient } from "@elementor/query";
|
|
2557
|
+
function usePrefetchCssClassUsage() {
|
|
2558
|
+
const queryClient = useQueryClient();
|
|
2559
|
+
const prefetchClassesUsage = () => queryClient.prefetchQuery({
|
|
2560
|
+
queryKey: [QUERY_KEY],
|
|
2561
|
+
queryFn: fetchCssClassUsage
|
|
2562
|
+
});
|
|
2563
|
+
return { prefetchClassesUsage };
|
|
2564
|
+
}
|
|
2565
|
+
var PrefetchCssClassUsage = () => {
|
|
2566
|
+
const { prefetchClassesUsage } = usePrefetchCssClassUsage();
|
|
2567
|
+
prefetchClassesUsage();
|
|
2568
|
+
return null;
|
|
2569
|
+
};
|
|
2570
|
+
|
|
2491
2571
|
// src/components/class-manager/class-manager-button.tsx
|
|
2492
2572
|
var trackGlobalClassesButton = () => {
|
|
2493
2573
|
trackGlobalClasses({
|
|
@@ -2506,17 +2586,24 @@ var ClassManagerButton = () => {
|
|
|
2506
2586
|
if (!isUserAllowedToUpdateClass) {
|
|
2507
2587
|
return null;
|
|
2508
2588
|
}
|
|
2589
|
+
const toggleClassesManagerPanel = () => {
|
|
2590
|
+
if (isExperimentActive2("e_editor_design_system_panel")) {
|
|
2591
|
+
window.dispatchEvent(
|
|
2592
|
+
new CustomEvent("elementor/toggle-design-system", {
|
|
2593
|
+
detail: { tab: "classes" }
|
|
2594
|
+
})
|
|
2595
|
+
);
|
|
2596
|
+
} else {
|
|
2597
|
+
openPanel();
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2509
2600
|
const handleOpenPanel = () => {
|
|
2510
2601
|
if (document?.isDirty) {
|
|
2511
2602
|
openSaveChangesDialog();
|
|
2512
2603
|
return;
|
|
2513
2604
|
}
|
|
2514
|
-
|
|
2605
|
+
toggleClassesManagerPanel();
|
|
2515
2606
|
trackGlobalClassesButton();
|
|
2516
|
-
trackGlobalClasses({
|
|
2517
|
-
event: "classManagerOpened",
|
|
2518
|
-
source: "style-panel"
|
|
2519
|
-
});
|
|
2520
2607
|
prefetchClassesUsage();
|
|
2521
2608
|
};
|
|
2522
2609
|
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Tooltip6, { title: __16("Class Manager", "elementor"), placement: "top" }, /* @__PURE__ */ React20.createElement(IconButton5, { size: "tiny", onClick: handleOpenPanel, sx: { marginInlineEnd: -0.75 } }, /* @__PURE__ */ React20.createElement(FlippedColorSwatchIcon, { fontSize: "tiny" }))), isSaveChangesDialogOpen && /* @__PURE__ */ React20.createElement(SaveChangesDialog2, null, /* @__PURE__ */ React20.createElement(SaveChangesDialog2.Title, null, __16("You have unsaved changes", "elementor")), /* @__PURE__ */ React20.createElement(SaveChangesDialog2.Content, null, /* @__PURE__ */ React20.createElement(SaveChangesDialog2.ContentText, { sx: { mb: 2 } }, __16(
|
|
@@ -2535,7 +2622,7 @@ var ClassManagerButton = () => {
|
|
|
2535
2622
|
action: async () => {
|
|
2536
2623
|
await saveDocument();
|
|
2537
2624
|
closeSaveChangesDialog();
|
|
2538
|
-
|
|
2625
|
+
toggleClassesManagerPanel();
|
|
2539
2626
|
trackGlobalClassesButton();
|
|
2540
2627
|
prefetchClassesUsage();
|
|
2541
2628
|
}
|
|
@@ -3148,7 +3235,7 @@ var initMcpIntegration = (reg, canvasMcpEntry) => {
|
|
|
3148
3235
|
|
|
3149
3236
|
// src/sync-with-document.tsx
|
|
3150
3237
|
import { useEffect as useEffect8 } from "react";
|
|
3151
|
-
import { __privateListenTo as listenTo2, v1ReadyEvent } from "@elementor/editor-v1-adapters";
|
|
3238
|
+
import { __privateListenTo as listenTo2, isExperimentActive as isExperimentActive3, v1ReadyEvent } from "@elementor/editor-v1-adapters";
|
|
3152
3239
|
|
|
3153
3240
|
// src/sync-with-document-save.ts
|
|
3154
3241
|
import { getCurrentUser } from "@elementor/editor-current-user";
|
|
@@ -3211,11 +3298,15 @@ function isDirty() {
|
|
|
3211
3298
|
|
|
3212
3299
|
// src/sync-with-document.tsx
|
|
3213
3300
|
function SyncWithDocumentSave() {
|
|
3214
|
-
const
|
|
3301
|
+
const { open: openClassPanel } = usePanelActions();
|
|
3215
3302
|
useEffect8(() => {
|
|
3216
|
-
listenTo2(v1ReadyEvent(), () => {
|
|
3217
|
-
|
|
3303
|
+
const unsubscribe = listenTo2(v1ReadyEvent(), () => {
|
|
3304
|
+
const open = isExperimentActive3("e_editor_design_system_panel") ? () => {
|
|
3305
|
+
window.dispatchEvent(new CustomEvent("elementor/open-global-classes-manager"));
|
|
3306
|
+
} : openClassPanel;
|
|
3307
|
+
syncWithDocumentSave({ open });
|
|
3218
3308
|
});
|
|
3309
|
+
return unsubscribe;
|
|
3219
3310
|
}, []);
|
|
3220
3311
|
return null;
|
|
3221
3312
|
}
|
|
@@ -3223,7 +3314,9 @@ function SyncWithDocumentSave() {
|
|
|
3223
3314
|
// src/init.ts
|
|
3224
3315
|
function init() {
|
|
3225
3316
|
registerSlice(slice);
|
|
3226
|
-
|
|
3317
|
+
if (!isExperimentActive4("e_editor_design_system_panel")) {
|
|
3318
|
+
registerPanel(panel);
|
|
3319
|
+
}
|
|
3227
3320
|
stylesRepository.register(globalClassesStylesProvider);
|
|
3228
3321
|
injectIntoLogic({
|
|
3229
3322
|
id: "global-classes-populate-store",
|
|
@@ -3241,10 +3334,12 @@ function init() {
|
|
|
3241
3334
|
id: "global-classes-prefetch-css-class-usage",
|
|
3242
3335
|
component: PrefetchCssClassUsage
|
|
3243
3336
|
});
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3337
|
+
if (!isExperimentActive4("e_editor_design_system_panel")) {
|
|
3338
|
+
injectIntoLogic({
|
|
3339
|
+
id: "global-classes-open-panel-from-url",
|
|
3340
|
+
component: OpenPanelFromUrl
|
|
3341
|
+
});
|
|
3342
|
+
}
|
|
3248
3343
|
injectIntoCssClassConvert({
|
|
3249
3344
|
id: "global-classes-convert-from-local-class",
|
|
3250
3345
|
component: ConvertLocalClassToGlobalClass
|
|
@@ -3263,6 +3358,7 @@ function init() {
|
|
|
3263
3358
|
);
|
|
3264
3359
|
}
|
|
3265
3360
|
export {
|
|
3361
|
+
ClassManagerPanelEmbedded,
|
|
3266
3362
|
GLOBAL_CLASSES_URI,
|
|
3267
3363
|
init
|
|
3268
3364
|
};
|