@elementor/editor-canvas 3.35.0-358 → 3.35.0-359
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 +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +6 -10
- package/dist/index.mjs +8 -15
- package/package.json +18 -18
- package/src/index.ts +1 -0
- package/src/renderers/__tests__/__snapshots__/create-styles-renderer.test.ts.snap +1 -1
- package/src/renderers/create-styles-renderer.ts +5 -15
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,8 @@ import { V1Element, V1ElementConfig, V1ElementModelProps } from '@elementor/edit
|
|
|
2
2
|
import { TwingArrayLoader, TwingEnvironment } from '@elementor/twing';
|
|
3
3
|
import * as _elementor_editor_props from '@elementor/editor-props';
|
|
4
4
|
import { Props, PropTypeKey, PropsSchema, AnyTransformable } from '@elementor/editor-props';
|
|
5
|
+
import * as _elementor_utils from '@elementor/utils';
|
|
6
|
+
import { StyleDefinitionState } from '@elementor/editor-styles';
|
|
5
7
|
|
|
6
8
|
declare const BREAKPOINTS_SCHEMA_URI = "elementor://breakpoints/list";
|
|
7
9
|
|
|
@@ -206,4 +208,37 @@ declare const DOCUMENT_STRUCTURE_URI = "elementor://document/structure";
|
|
|
206
208
|
|
|
207
209
|
declare function createTransformer<TValue = never>(cb: TValue extends AnyTransformable ? 'Transformable values are invalid, use the actual value instead.' : UnbrandedTransformer<TValue>): Transformer<NoInfer<TValue>>;
|
|
208
210
|
|
|
209
|
-
|
|
211
|
+
declare const UnknownStyleTypeError: {
|
|
212
|
+
new ({ cause, context }?: {
|
|
213
|
+
cause?: _elementor_utils.ElementorErrorOptions["cause"];
|
|
214
|
+
context?: {
|
|
215
|
+
type: string;
|
|
216
|
+
} | undefined;
|
|
217
|
+
} | undefined): {
|
|
218
|
+
readonly context: _elementor_utils.ElementorErrorOptions["context"];
|
|
219
|
+
readonly code: _elementor_utils.ElementorErrorOptions["code"];
|
|
220
|
+
name: string;
|
|
221
|
+
message: string;
|
|
222
|
+
stack?: string;
|
|
223
|
+
cause?: unknown;
|
|
224
|
+
};
|
|
225
|
+
isError(error: unknown): error is Error;
|
|
226
|
+
};
|
|
227
|
+
declare const UnknownStyleStateError: {
|
|
228
|
+
new ({ cause, context }?: {
|
|
229
|
+
cause?: _elementor_utils.ElementorErrorOptions["cause"];
|
|
230
|
+
context?: {
|
|
231
|
+
state: StyleDefinitionState;
|
|
232
|
+
} | undefined;
|
|
233
|
+
} | undefined): {
|
|
234
|
+
readonly context: _elementor_utils.ElementorErrorOptions["context"];
|
|
235
|
+
readonly code: _elementor_utils.ElementorErrorOptions["code"];
|
|
236
|
+
name: string;
|
|
237
|
+
message: string;
|
|
238
|
+
stack?: string;
|
|
239
|
+
cause?: unknown;
|
|
240
|
+
};
|
|
241
|
+
isError(error: unknown): error is Error;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export { type AnyTransformer, BREAKPOINTS_SCHEMA_URI, type BackboneModel, type CreateTemplatedElementTypeOptions, DOCUMENT_STRUCTURE_URI, type ElementModel, ElementType, ElementView, type LegacyWindow, type PropsResolver, RenderContext, STYLE_SCHEMA_URI, UnknownStyleStateError, UnknownStyleTypeError, WIDGET_SCHEMA_URI, createPropsResolver, createTemplatedElementView, createTransformer, createTransformersRegistry, endDragElementFromPanel, getCanvasIframeDocument, init, registerElementType, settingsTransformersRegistry, startDragElementFromPanel, styleTransformersRegistry };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { V1Element, V1ElementConfig, V1ElementModelProps } from '@elementor/edit
|
|
|
2
2
|
import { TwingArrayLoader, TwingEnvironment } from '@elementor/twing';
|
|
3
3
|
import * as _elementor_editor_props from '@elementor/editor-props';
|
|
4
4
|
import { Props, PropTypeKey, PropsSchema, AnyTransformable } from '@elementor/editor-props';
|
|
5
|
+
import * as _elementor_utils from '@elementor/utils';
|
|
6
|
+
import { StyleDefinitionState } from '@elementor/editor-styles';
|
|
5
7
|
|
|
6
8
|
declare const BREAKPOINTS_SCHEMA_URI = "elementor://breakpoints/list";
|
|
7
9
|
|
|
@@ -206,4 +208,37 @@ declare const DOCUMENT_STRUCTURE_URI = "elementor://document/structure";
|
|
|
206
208
|
|
|
207
209
|
declare function createTransformer<TValue = never>(cb: TValue extends AnyTransformable ? 'Transformable values are invalid, use the actual value instead.' : UnbrandedTransformer<TValue>): Transformer<NoInfer<TValue>>;
|
|
208
210
|
|
|
209
|
-
|
|
211
|
+
declare const UnknownStyleTypeError: {
|
|
212
|
+
new ({ cause, context }?: {
|
|
213
|
+
cause?: _elementor_utils.ElementorErrorOptions["cause"];
|
|
214
|
+
context?: {
|
|
215
|
+
type: string;
|
|
216
|
+
} | undefined;
|
|
217
|
+
} | undefined): {
|
|
218
|
+
readonly context: _elementor_utils.ElementorErrorOptions["context"];
|
|
219
|
+
readonly code: _elementor_utils.ElementorErrorOptions["code"];
|
|
220
|
+
name: string;
|
|
221
|
+
message: string;
|
|
222
|
+
stack?: string;
|
|
223
|
+
cause?: unknown;
|
|
224
|
+
};
|
|
225
|
+
isError(error: unknown): error is Error;
|
|
226
|
+
};
|
|
227
|
+
declare const UnknownStyleStateError: {
|
|
228
|
+
new ({ cause, context }?: {
|
|
229
|
+
cause?: _elementor_utils.ElementorErrorOptions["cause"];
|
|
230
|
+
context?: {
|
|
231
|
+
state: StyleDefinitionState;
|
|
232
|
+
} | undefined;
|
|
233
|
+
} | undefined): {
|
|
234
|
+
readonly context: _elementor_utils.ElementorErrorOptions["context"];
|
|
235
|
+
readonly code: _elementor_utils.ElementorErrorOptions["code"];
|
|
236
|
+
name: string;
|
|
237
|
+
message: string;
|
|
238
|
+
stack?: string;
|
|
239
|
+
cause?: unknown;
|
|
240
|
+
};
|
|
241
|
+
isError(error: unknown): error is Error;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export { type AnyTransformer, BREAKPOINTS_SCHEMA_URI, type BackboneModel, type CreateTemplatedElementTypeOptions, DOCUMENT_STRUCTURE_URI, type ElementModel, ElementType, ElementView, type LegacyWindow, type PropsResolver, RenderContext, STYLE_SCHEMA_URI, UnknownStyleStateError, UnknownStyleTypeError, WIDGET_SCHEMA_URI, createPropsResolver, createTemplatedElementView, createTransformer, createTransformersRegistry, endDragElementFromPanel, getCanvasIframeDocument, init, registerElementType, settingsTransformersRegistry, startDragElementFromPanel, styleTransformersRegistry };
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,8 @@ __export(index_exports, {
|
|
|
34
34
|
DOCUMENT_STRUCTURE_URI: () => DOCUMENT_STRUCTURE_URI,
|
|
35
35
|
RenderContext: () => RenderContext,
|
|
36
36
|
STYLE_SCHEMA_URI: () => STYLE_SCHEMA_URI,
|
|
37
|
+
UnknownStyleStateError: () => UnknownStyleStateError,
|
|
38
|
+
UnknownStyleTypeError: () => UnknownStyleTypeError,
|
|
37
39
|
WIDGET_SCHEMA_URI: () => WIDGET_SCHEMA_URI,
|
|
38
40
|
createPropsResolver: () => createPropsResolver,
|
|
39
41
|
createTemplatedElementView: () => createTemplatedElementView,
|
|
@@ -862,16 +864,8 @@ function createStyleWrapper(value = "", wrapper) {
|
|
|
862
864
|
},
|
|
863
865
|
withPrefix: (prefix) => createStyleWrapper([prefix, value].filter(Boolean).join(" "), wrapper),
|
|
864
866
|
withState: (state) => {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
}
|
|
868
|
-
if ((0, import_editor_styles3.isClassState)(state)) {
|
|
869
|
-
return createStyleWrapper(`${value}.${state}`, wrapper);
|
|
870
|
-
}
|
|
871
|
-
if ((0, import_editor_styles3.isPseudoState)(state)) {
|
|
872
|
-
return createStyleWrapper(`${value}:${state}`, wrapper);
|
|
873
|
-
}
|
|
874
|
-
throw new UnknownStyleStateError({ context: { state } });
|
|
867
|
+
const selector = (0, import_editor_styles3.getSelectorWithState)(value, state);
|
|
868
|
+
return createStyleWrapper(selector, wrapper);
|
|
875
869
|
},
|
|
876
870
|
withMediaQuery: (breakpoint) => {
|
|
877
871
|
if (!breakpoint?.type) {
|
|
@@ -3576,6 +3570,8 @@ var getLegacyPanelElementView = ({ settings, ...rest }) => {
|
|
|
3576
3570
|
DOCUMENT_STRUCTURE_URI,
|
|
3577
3571
|
RenderContext,
|
|
3578
3572
|
STYLE_SCHEMA_URI,
|
|
3573
|
+
UnknownStyleStateError,
|
|
3574
|
+
UnknownStyleTypeError,
|
|
3579
3575
|
WIDGET_SCHEMA_URI,
|
|
3580
3576
|
createPropsResolver,
|
|
3581
3577
|
createTemplatedElementView,
|
package/dist/index.mjs
CHANGED
|
@@ -587,7 +587,7 @@ function getLinkAttrs(el) {
|
|
|
587
587
|
// src/hooks/use-style-items.ts
|
|
588
588
|
import { useEffect as useEffect6, useMemo as useMemo4, useState as useState3 } from "react";
|
|
589
589
|
import { getBreakpoints } from "@elementor/editor-responsive";
|
|
590
|
-
import { isClassState
|
|
590
|
+
import { isClassState } from "@elementor/editor-styles";
|
|
591
591
|
import { stylesRepository as stylesRepository2 } from "@elementor/editor-styles-repository";
|
|
592
592
|
import { registerDataHook as registerDataHook2 } from "@elementor/editor-v1-adapters";
|
|
593
593
|
|
|
@@ -774,8 +774,7 @@ import { useBreakpointsMap } from "@elementor/editor-responsive";
|
|
|
774
774
|
|
|
775
775
|
// src/renderers/create-styles-renderer.ts
|
|
776
776
|
import {
|
|
777
|
-
|
|
778
|
-
isPseudoState
|
|
777
|
+
getSelectorWithState
|
|
779
778
|
} from "@elementor/editor-styles";
|
|
780
779
|
import { decodeString } from "@elementor/utils";
|
|
781
780
|
|
|
@@ -824,16 +823,8 @@ function createStyleWrapper(value = "", wrapper) {
|
|
|
824
823
|
},
|
|
825
824
|
withPrefix: (prefix) => createStyleWrapper([prefix, value].filter(Boolean).join(" "), wrapper),
|
|
826
825
|
withState: (state) => {
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
}
|
|
830
|
-
if (isClassState(state)) {
|
|
831
|
-
return createStyleWrapper(`${value}.${state}`, wrapper);
|
|
832
|
-
}
|
|
833
|
-
if (isPseudoState(state)) {
|
|
834
|
-
return createStyleWrapper(`${value}:${state}`, wrapper);
|
|
835
|
-
}
|
|
836
|
-
throw new UnknownStyleStateError({ context: { state } });
|
|
826
|
+
const selector = getSelectorWithState(value, state);
|
|
827
|
+
return createStyleWrapper(selector, wrapper);
|
|
837
828
|
},
|
|
838
829
|
withMediaQuery: (breakpoint) => {
|
|
839
830
|
if (!breakpoint?.type) {
|
|
@@ -927,10 +918,10 @@ function sortByBreakpoint(breakpointsOrder) {
|
|
|
927
918
|
return ({ breakpoint: breakpointA }, { breakpoint: breakpointB }) => breakpointsOrder.indexOf(breakpointA) - breakpointsOrder.indexOf(breakpointB);
|
|
928
919
|
}
|
|
929
920
|
function sortByStateType({ state: stateA }, { state: stateB }) {
|
|
930
|
-
if (
|
|
921
|
+
if (isClassState(stateA) && !isClassState(stateB)) {
|
|
931
922
|
return -1;
|
|
932
923
|
}
|
|
933
|
-
if (!
|
|
924
|
+
if (!isClassState(stateA) && isClassState(stateB)) {
|
|
934
925
|
return 1;
|
|
935
926
|
}
|
|
936
927
|
return 0;
|
|
@@ -3569,6 +3560,8 @@ export {
|
|
|
3569
3560
|
DOCUMENT_STRUCTURE_URI,
|
|
3570
3561
|
RenderContext,
|
|
3571
3562
|
STYLE_SCHEMA_URI,
|
|
3563
|
+
UnknownStyleStateError,
|
|
3564
|
+
UnknownStyleTypeError,
|
|
3572
3565
|
WIDGET_SCHEMA_URI,
|
|
3573
3566
|
createPropsResolver,
|
|
3574
3567
|
createTemplatedElementView,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-canvas",
|
|
3
3
|
"description": "Elementor Editor Canvas",
|
|
4
|
-
"version": "3.35.0-
|
|
4
|
+
"version": "3.35.0-359",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "3.35.0-
|
|
41
|
-
"@elementor/editor-controls": "3.35.0-
|
|
42
|
-
"@elementor/editor-documents": "3.35.0-
|
|
43
|
-
"@elementor/editor-elements": "3.35.0-
|
|
44
|
-
"@elementor/editor-interactions": "3.35.0-
|
|
45
|
-
"@elementor/editor-mcp": "3.35.0-
|
|
46
|
-
"@elementor/editor-notifications": "3.35.0-
|
|
47
|
-
"@elementor/editor-props": "3.35.0-
|
|
48
|
-
"@elementor/editor-responsive": "3.35.0-
|
|
49
|
-
"@elementor/editor-styles": "3.35.0-
|
|
50
|
-
"@elementor/editor-styles-repository": "3.35.0-
|
|
51
|
-
"@elementor/editor-ui": "3.35.0-
|
|
52
|
-
"@elementor/editor-v1-adapters": "3.35.0-
|
|
53
|
-
"@elementor/schema": "3.35.0-
|
|
54
|
-
"@elementor/twing": "3.35.0-
|
|
40
|
+
"@elementor/editor": "3.35.0-359",
|
|
41
|
+
"@elementor/editor-controls": "3.35.0-359",
|
|
42
|
+
"@elementor/editor-documents": "3.35.0-359",
|
|
43
|
+
"@elementor/editor-elements": "3.35.0-359",
|
|
44
|
+
"@elementor/editor-interactions": "3.35.0-359",
|
|
45
|
+
"@elementor/editor-mcp": "3.35.0-359",
|
|
46
|
+
"@elementor/editor-notifications": "3.35.0-359",
|
|
47
|
+
"@elementor/editor-props": "3.35.0-359",
|
|
48
|
+
"@elementor/editor-responsive": "3.35.0-359",
|
|
49
|
+
"@elementor/editor-styles": "3.35.0-359",
|
|
50
|
+
"@elementor/editor-styles-repository": "3.35.0-359",
|
|
51
|
+
"@elementor/editor-ui": "3.35.0-359",
|
|
52
|
+
"@elementor/editor-v1-adapters": "3.35.0-359",
|
|
53
|
+
"@elementor/schema": "3.35.0-359",
|
|
54
|
+
"@elementor/twing": "3.35.0-359",
|
|
55
55
|
"@elementor/ui": "1.36.17",
|
|
56
|
-
"@elementor/utils": "3.35.0-
|
|
57
|
-
"@elementor/wp-media": "3.35.0-
|
|
56
|
+
"@elementor/utils": "3.35.0-359",
|
|
57
|
+
"@elementor/wp-media": "3.35.0-359",
|
|
58
58
|
"@floating-ui/react": "^0.27.5",
|
|
59
59
|
"@wordpress/i18n": "^5.13.0"
|
|
60
60
|
},
|
package/src/index.ts
CHANGED
|
@@ -21,3 +21,4 @@ export * from './legacy/types';
|
|
|
21
21
|
export { createTransformer } from './transformers/create-transformer';
|
|
22
22
|
export { createTransformersRegistry } from './transformers/create-transformers-registry';
|
|
23
23
|
export { type AnyTransformer } from './transformers/types';
|
|
24
|
+
export { UnknownStyleTypeError, UnknownStyleStateError } from './renderers/errors';
|
|
@@ -6,7 +6,7 @@ exports[`renderStyles should render styles 1`] = `
|
|
|
6
6
|
"breakpoint": "desktop",
|
|
7
7
|
"id": "test",
|
|
8
8
|
"state": null,
|
|
9
|
-
"value": ".test{font-size:10px;}.test:hover{font-size:20px;}@media(max-width:992px){.test{font-size:30px;}}@media(max-width:768px){.test:focus{font-size:40px;}}",
|
|
9
|
+
"value": ".test{font-size:10px;}.test:hover,.test:focus-visible{font-size:20px;}@media(max-width:992px){.test{font-size:30px;}}@media(max-width:768px){.test:focus{font-size:40px;}}",
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"breakpoint": "desktop",
|
|
@@ -2,8 +2,7 @@ import type { Props } from '@elementor/editor-props';
|
|
|
2
2
|
import { type Breakpoint, type BreakpointsMap } from '@elementor/editor-responsive';
|
|
3
3
|
import {
|
|
4
4
|
type CustomCss,
|
|
5
|
-
|
|
6
|
-
isPseudoState,
|
|
5
|
+
getSelectorWithState,
|
|
7
6
|
type StyleDefinition,
|
|
8
7
|
type StyleDefinitionState,
|
|
9
8
|
type StyleDefinitionType,
|
|
@@ -11,7 +10,7 @@ import {
|
|
|
11
10
|
import { decodeString } from '@elementor/utils';
|
|
12
11
|
|
|
13
12
|
import { type PropsResolver } from './create-props-resolver';
|
|
14
|
-
import {
|
|
13
|
+
import { UnknownStyleTypeError } from './errors';
|
|
15
14
|
|
|
16
15
|
export type StyleItem = {
|
|
17
16
|
id: string;
|
|
@@ -92,20 +91,11 @@ function createStyleWrapper( value: string = '', wrapper?: ( css: string ) => st
|
|
|
92
91
|
createStyleWrapper( [ prefix, value ].filter( Boolean ).join( ' ' ), wrapper ),
|
|
93
92
|
|
|
94
93
|
withState: ( state: StyleDefinitionState ) => {
|
|
95
|
-
|
|
96
|
-
return createStyleWrapper( value, wrapper );
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if ( isClassState( state ) ) {
|
|
100
|
-
return createStyleWrapper( `${ value }.${ state }`, wrapper );
|
|
101
|
-
}
|
|
94
|
+
const selector = getSelectorWithState( value, state );
|
|
102
95
|
|
|
103
|
-
|
|
104
|
-
return createStyleWrapper( `${ value }:${ state }`, wrapper );
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
throw new UnknownStyleStateError( { context: { state } } );
|
|
96
|
+
return createStyleWrapper( selector, wrapper );
|
|
108
97
|
},
|
|
98
|
+
|
|
109
99
|
withMediaQuery: ( breakpoint: Breakpoint | null ) => {
|
|
110
100
|
if ( ! breakpoint?.type ) {
|
|
111
101
|
return createStyleWrapper( value, wrapper );
|