@elementor/editor-styles 0.4.0 → 0.5.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @elementor/editor-styles
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a2245c5: Change prop provider infra to support nested props.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [a2245c5]
12
+ - @elementor/editor-props@0.6.0
13
+
3
14
  ## 0.4.0
4
15
 
5
16
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as _elementor_editor_props from '@elementor/editor-props';
1
2
  import { Props } from '@elementor/editor-props';
2
3
  import { BreakpointId } from '@elementor/editor-responsive';
3
4
 
@@ -21,4 +22,6 @@ type StyleDefinitionsMap = Record<StyleDefinition['id'], StyleDefinition>;
21
22
 
22
23
  declare function generateId(prefix?: string, existingIds?: string[]): string;
23
24
 
24
- export { type StyleDefinition, type StyleDefinitionID, type StyleDefinitionsMap, type StyleState, type StyleVariant, generateId };
25
+ declare const getStylesSchema: () => Record<string, _elementor_editor_props.PropType>;
26
+
27
+ export { type StyleDefinition, type StyleDefinitionID, type StyleDefinitionsMap, type StyleState, type StyleVariant, generateId, getStylesSchema };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as _elementor_editor_props from '@elementor/editor-props';
1
2
  import { Props } from '@elementor/editor-props';
2
3
  import { BreakpointId } from '@elementor/editor-responsive';
3
4
 
@@ -21,4 +22,6 @@ type StyleDefinitionsMap = Record<StyleDefinition['id'], StyleDefinition>;
21
22
 
22
23
  declare function generateId(prefix?: string, existingIds?: string[]): string;
23
24
 
24
- export { type StyleDefinition, type StyleDefinitionID, type StyleDefinitionsMap, type StyleState, type StyleVariant, generateId };
25
+ declare const getStylesSchema: () => Record<string, _elementor_editor_props.PropType>;
26
+
27
+ export { type StyleDefinition, type StyleDefinitionID, type StyleDefinitionsMap, type StyleState, type StyleVariant, generateId, getStylesSchema };
package/dist/index.js CHANGED
@@ -20,11 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- generateId: () => generateId
23
+ generateId: () => generateId,
24
+ getStylesSchema: () => getStylesSchema
24
25
  });
25
26
  module.exports = __toCommonJS(index_exports);
26
27
 
27
- // src/generate-id.ts
28
+ // src/utils/generate-id.ts
28
29
  function generateId(prefix = "", existingIds = []) {
29
30
  let id;
30
31
  do {
@@ -32,8 +33,20 @@ function generateId(prefix = "", existingIds = []) {
32
33
  } while (existingIds.includes(id));
33
34
  return id;
34
35
  }
36
+
37
+ // src/utils/get-styles-schema.ts
38
+ var getElementorConfig = () => {
39
+ const extendedWindow = window;
40
+ return extendedWindow.elementor?.config ?? {};
41
+ };
42
+ var getStylesSchema = () => {
43
+ const config = getElementorConfig();
44
+ const styleSchema = config?.atomic?.styles_schema ?? {};
45
+ return styleSchema;
46
+ };
35
47
  // Annotate the CommonJS export names for ESM import in node:
36
48
  0 && (module.exports = {
37
- generateId
49
+ generateId,
50
+ getStylesSchema
38
51
  });
39
52
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/generate-id.ts"],"sourcesContent":["// types\nexport * from './types';\n\n// utils\nexport { generateId } from './generate-id';\n","export function generateId( prefix: string = '', existingIds: string[] = [] ) {\n\tlet id: string;\n\n\tdo {\n\t\tid = prefix + Math.random().toString( 16 ).slice( 2, 9 );\n\t} while ( existingIds.includes( id ) );\n\n\treturn id;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,WAAY,SAAiB,IAAI,cAAwB,CAAC,GAAI;AAC7E,MAAI;AAEJ,KAAG;AACF,SAAK,SAAS,KAAK,OAAO,EAAE,SAAU,EAAG,EAAE,MAAO,GAAG,CAAE;AAAA,EACxD,SAAU,YAAY,SAAU,EAAG;AAEnC,SAAO;AACR;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/utils/generate-id.ts","../src/utils/get-styles-schema.ts"],"sourcesContent":["// types\nexport * from './types';\n\n// utils\nexport { generateId } from './utils/generate-id';\nexport { getStylesSchema } from './utils/get-styles-schema';\n","export function generateId( prefix: string = '', existingIds: string[] = [] ) {\n\tlet id: string;\n\n\tdo {\n\t\tid = prefix + Math.random().toString( 16 ).slice( 2, 9 );\n\t} while ( existingIds.includes( id ) );\n\n\treturn id;\n}\n","import { type ExtendedWindow } from './types';\n\nconst getElementorConfig = () => {\n\tconst extendedWindow = window as unknown as ExtendedWindow;\n\n\treturn extendedWindow.elementor?.config ?? {};\n};\n\nexport const getStylesSchema = () => {\n\tconst config = getElementorConfig();\n\tconst styleSchema = config?.atomic?.styles_schema ?? {};\n\n\treturn styleSchema;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,SAAS,WAAY,SAAiB,IAAI,cAAwB,CAAC,GAAI;AAC7E,MAAI;AAEJ,KAAG;AACF,SAAK,SAAS,KAAK,OAAO,EAAE,SAAU,EAAG,EAAE,MAAO,GAAG,CAAE;AAAA,EACxD,SAAU,YAAY,SAAU,EAAG;AAEnC,SAAO;AACR;;;ACNA,IAAM,qBAAqB,MAAM;AAChC,QAAM,iBAAiB;AAEvB,SAAO,eAAe,WAAW,UAAU,CAAC;AAC7C;AAEO,IAAM,kBAAkB,MAAM;AACpC,QAAM,SAAS,mBAAmB;AAClC,QAAM,cAAc,QAAQ,QAAQ,iBAAiB,CAAC;AAEtD,SAAO;AACR;","names":[]}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // src/generate-id.ts
1
+ // src/utils/generate-id.ts
2
2
  function generateId(prefix = "", existingIds = []) {
3
3
  let id;
4
4
  do {
@@ -6,7 +6,19 @@ function generateId(prefix = "", existingIds = []) {
6
6
  } while (existingIds.includes(id));
7
7
  return id;
8
8
  }
9
+
10
+ // src/utils/get-styles-schema.ts
11
+ var getElementorConfig = () => {
12
+ const extendedWindow = window;
13
+ return extendedWindow.elementor?.config ?? {};
14
+ };
15
+ var getStylesSchema = () => {
16
+ const config = getElementorConfig();
17
+ const styleSchema = config?.atomic?.styles_schema ?? {};
18
+ return styleSchema;
19
+ };
9
20
  export {
10
- generateId
21
+ generateId,
22
+ getStylesSchema
11
23
  };
12
24
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/generate-id.ts"],"sourcesContent":["export function generateId( prefix: string = '', existingIds: string[] = [] ) {\n\tlet id: string;\n\n\tdo {\n\t\tid = prefix + Math.random().toString( 16 ).slice( 2, 9 );\n\t} while ( existingIds.includes( id ) );\n\n\treturn id;\n}\n"],"mappings":";AAAO,SAAS,WAAY,SAAiB,IAAI,cAAwB,CAAC,GAAI;AAC7E,MAAI;AAEJ,KAAG;AACF,SAAK,SAAS,KAAK,OAAO,EAAE,SAAU,EAAG,EAAE,MAAO,GAAG,CAAE;AAAA,EACxD,SAAU,YAAY,SAAU,EAAG;AAEnC,SAAO;AACR;","names":[]}
1
+ {"version":3,"sources":["../src/utils/generate-id.ts","../src/utils/get-styles-schema.ts"],"sourcesContent":["export function generateId( prefix: string = '', existingIds: string[] = [] ) {\n\tlet id: string;\n\n\tdo {\n\t\tid = prefix + Math.random().toString( 16 ).slice( 2, 9 );\n\t} while ( existingIds.includes( id ) );\n\n\treturn id;\n}\n","import { type ExtendedWindow } from './types';\n\nconst getElementorConfig = () => {\n\tconst extendedWindow = window as unknown as ExtendedWindow;\n\n\treturn extendedWindow.elementor?.config ?? {};\n};\n\nexport const getStylesSchema = () => {\n\tconst config = getElementorConfig();\n\tconst styleSchema = config?.atomic?.styles_schema ?? {};\n\n\treturn styleSchema;\n};\n"],"mappings":";AAAO,SAAS,WAAY,SAAiB,IAAI,cAAwB,CAAC,GAAI;AAC7E,MAAI;AAEJ,KAAG;AACF,SAAK,SAAS,KAAK,OAAO,EAAE,SAAU,EAAG,EAAE,MAAO,GAAG,CAAE;AAAA,EACxD,SAAU,YAAY,SAAU,EAAG;AAEnC,SAAO;AACR;;;ACNA,IAAM,qBAAqB,MAAM;AAChC,QAAM,iBAAiB;AAEvB,SAAO,eAAe,WAAW,UAAU,CAAC;AAC7C;AAEO,IAAM,kBAAkB,MAAM;AACpC,QAAM,SAAS,mBAAmB;AAClC,QAAM,cAAc,QAAQ,QAAQ,iBAAiB,CAAC;AAEtD,SAAO;AACR;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-styles",
3
3
  "description": "This package contains the styles model for the Elementor editor",
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,7 +40,7 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor-props": "0.5.1",
43
+ "@elementor/editor-props": "0.6.0",
44
44
  "@elementor/editor-responsive": "0.12.4"
45
45
  }
46
46
  }
package/src/index.ts CHANGED
@@ -2,4 +2,5 @@
2
2
  export * from './types';
3
3
 
4
4
  // utils
5
- export { generateId } from './generate-id';
5
+ export { generateId } from './utils/generate-id';
6
+ export { getStylesSchema } from './utils/get-styles-schema';
@@ -0,0 +1,14 @@
1
+ import { type ExtendedWindow } from './types';
2
+
3
+ const getElementorConfig = () => {
4
+ const extendedWindow = window as unknown as ExtendedWindow;
5
+
6
+ return extendedWindow.elementor?.config ?? {};
7
+ };
8
+
9
+ export const getStylesSchema = () => {
10
+ const config = getElementorConfig();
11
+ const styleSchema = config?.atomic?.styles_schema ?? {};
12
+
13
+ return styleSchema;
14
+ };
@@ -0,0 +1,11 @@
1
+ import { type PropType } from '@elementor/editor-props';
2
+
3
+ export type ExtendedWindow = Window & {
4
+ elementor: {
5
+ config: {
6
+ atomic?: {
7
+ styles_schema: Record< string, PropType >;
8
+ };
9
+ };
10
+ };
11
+ };
File without changes