@elementor/editor-global-classes 4.2.0-871 → 4.2.0-873

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.mjs CHANGED
@@ -2076,8 +2076,9 @@ var useFilteredCssClasses = () => {
2076
2076
  [cssClasses]
2077
2077
  );
2078
2078
  const filteredClasses = useMemo3(() => {
2079
- if (searchValue.length > 1) {
2080
- return lowercaseLabels.filter((cssClass) => cssClass.lowerLabel.includes(searchValue.toLowerCase()));
2079
+ const normalizedSearch = searchValue.replace(/[^a-zA-Z0-9_-]/g, "").toLowerCase();
2080
+ if (normalizedSearch.length > 1) {
2081
+ return lowercaseLabels.filter((cssClass) => cssClass.lowerLabel.includes(normalizedSearch));
2081
2082
  }
2082
2083
  return cssClasses;
2083
2084
  }, [searchValue, cssClasses, lowercaseLabels]);
@@ -2590,7 +2591,7 @@ async function fetchAndMergeClasses() {
2590
2591
  }
2591
2592
 
2592
2593
  // src/global-classes-styles-provider.ts
2593
- var MAX_CLASSES = 5e3;
2594
+ var MAX_CLASSES = 1e3;
2594
2595
  var GLOBAL_CLASSES_PROVIDER_KEY = "global-classes";
2595
2596
  var PREGENERATED_LINK_PATTERN = /^global-([0-9]+-)?(preview|frontend)-[a-zA-Z_-]+-css$/;
2596
2597
  var globalClassesStylesProvider = createStylesProvider({
@@ -2911,8 +2912,21 @@ function GlobalStylesImportListener() {
2911
2912
  return null;
2912
2913
  }
2913
2914
 
2915
+ // src/components/open-panel-from-event.tsx
2916
+ import { useEffect as useEffect6 } from "react";
2917
+ var EVENT_OPEN_GLOBAL_CLASSES_MANAGER = "elementor/open-global-classes-manager";
2918
+ function OpenPanelFromEvent() {
2919
+ const { open } = usePanelActions();
2920
+ useEffect6(() => {
2921
+ const handler2 = () => open();
2922
+ window.addEventListener(EVENT_OPEN_GLOBAL_CLASSES_MANAGER, handler2);
2923
+ return () => window.removeEventListener(EVENT_OPEN_GLOBAL_CLASSES_MANAGER, handler2);
2924
+ }, [open]);
2925
+ return null;
2926
+ }
2927
+
2914
2928
  // src/components/open-panel-from-url.tsx
2915
- import { useEffect as useEffect6, useRef as useRef3 } from "react";
2929
+ import { useEffect as useEffect7, useRef as useRef3 } from "react";
2916
2930
  import { __privateListenTo as listenTo, routeOpenEvent } from "@elementor/editor-v1-adapters";
2917
2931
  var ACTIVE_PANEL_PARAM = "active-panel";
2918
2932
  var PANEL_ID = "global-classes-manager";
@@ -2920,7 +2934,7 @@ var DEFAULT_PANEL_ROUTE = "panel/elements";
2920
2934
  function OpenPanelFromUrl() {
2921
2935
  const { open } = usePanelActions();
2922
2936
  const hasOpened = useRef3(false);
2923
- useEffect6(() => {
2937
+ useEffect7(() => {
2924
2938
  const urlParams = new URLSearchParams(window.location.search);
2925
2939
  const activePanel = urlParams.get(ACTIVE_PANEL_PARAM);
2926
2940
  if (activePanel !== PANEL_ID) {
@@ -2941,10 +2955,10 @@ function OpenPanelFromUrl() {
2941
2955
  }
2942
2956
 
2943
2957
  // src/components/populate-store.tsx
2944
- import { useEffect as useEffect7 } from "react";
2958
+ import { useEffect as useEffect8 } from "react";
2945
2959
  import { registerDataHook } from "@elementor/editor-v1-adapters";
2946
2960
  function PopulateStore() {
2947
- useEffect7(() => {
2961
+ useEffect8(() => {
2948
2962
  loadCurrentDocumentClasses();
2949
2963
  registerDataHook("after", "editor/documents/attach-preview", async () => {
2950
2964
  await loadCurrentDocumentClasses();
@@ -3380,7 +3394,7 @@ var initMcpIntegration = (reg, canvasMcpEntry) => {
3380
3394
  };
3381
3395
 
3382
3396
  // src/sync-with-document.tsx
3383
- import { useEffect as useEffect8 } from "react";
3397
+ import { useEffect as useEffect9 } from "react";
3384
3398
  import { __privateListenTo as listenTo2, isExperimentActive as isExperimentActive3, v1ReadyEvent } from "@elementor/editor-v1-adapters";
3385
3399
 
3386
3400
  // src/sync-with-document-save.ts
@@ -3445,7 +3459,7 @@ function isDirty() {
3445
3459
  // src/sync-with-document.tsx
3446
3460
  function SyncWithDocumentSave() {
3447
3461
  const { open: openClassPanel } = usePanelActions();
3448
- useEffect8(() => {
3462
+ useEffect9(() => {
3449
3463
  const unsubscribe = listenTo2(v1ReadyEvent(), () => {
3450
3464
  const open = isExperimentActive3("e_editor_design_system_panel") ? () => {
3451
3465
  window.dispatchEvent(new CustomEvent("elementor/open-global-classes-manager"));
@@ -3485,6 +3499,10 @@ function init() {
3485
3499
  id: "global-classes-open-panel-from-url",
3486
3500
  component: OpenPanelFromUrl
3487
3501
  });
3502
+ injectIntoLogic({
3503
+ id: "global-classes-open-panel-from-event",
3504
+ component: OpenPanelFromEvent
3505
+ });
3488
3506
  }
3489
3507
  injectIntoCssClassConvert({
3490
3508
  id: "global-classes-convert-from-local-class",