@elementor/editor-props 0.2.0 → 0.3.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 +6 -0
- package/dist/index.d.mts +450 -1499
- package/dist/index.d.ts +450 -1499
- package/dist/index.js +134 -100
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -88
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/prop-types/background-image.ts +11 -0
- package/src/prop-types/border-radius.ts +9 -7
- package/src/prop-types/border-width.ts +9 -7
- package/src/prop-types/box-shadow.ts +4 -3
- package/src/prop-types/classes.ts +4 -3
- package/src/prop-types/color-gradient.ts +13 -0
- package/src/prop-types/color.ts +3 -2
- package/src/prop-types/image-attachment-id.ts +1 -0
- package/src/prop-types/image-src.ts +7 -6
- package/src/prop-types/image.ts +7 -7
- package/src/prop-types/index.ts +4 -0
- package/src/prop-types/linked-dimensions.ts +10 -8
- package/src/prop-types/number.ts +7 -0
- package/src/prop-types/shadow.ts +11 -11
- package/src/prop-types/size.ts +5 -4
- package/src/prop-types/string.ts +7 -0
- package/src/prop-types/stroke.ts +7 -7
- package/src/prop-types/url.ts +3 -2
- package/src/prop-types/utils.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -20,26 +20,30 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
backgroundImagePropTypeUtil: () => backgroundImagePropTypeUtil,
|
|
24
|
+
borderRadiusPropTypeUtil: () => borderRadiusPropTypeUtil,
|
|
25
|
+
borderWidthPropTypeUtil: () => borderWidthPropTypeUtil,
|
|
26
|
+
boxShadowPropTypeUtil: () => boxShadowPropTypeUtil,
|
|
27
|
+
classesPropTypeUtil: () => classesPropTypeUtil,
|
|
28
|
+
colorGradientPropTypeUtil: () => colorGradientPropTypeUtil,
|
|
29
|
+
colorPropTypeUtil: () => colorPropTypeUtil,
|
|
28
30
|
createPropUtils: () => createPropUtils,
|
|
29
31
|
imageAttachmentIdPropType: () => imageAttachmentIdPropType,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
imagePropTypeUtil: () => imagePropTypeUtil,
|
|
33
|
+
imageSrcPropTypeUtil: () => imageSrcPropTypeUtil,
|
|
32
34
|
isTransformable: () => isTransformable,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
linkedDimensionsPropTypeUtil: () => linkedDimensionsPropTypeUtil,
|
|
36
|
+
numberPropTypeUtil: () => numberPropTypeUtil,
|
|
37
|
+
shadowPropTypeUtil: () => shadowPropTypeUtil,
|
|
38
|
+
sizePropTypeUtil: () => sizePropTypeUtil,
|
|
39
|
+
stringPropTypeUtil: () => stringPropTypeUtil,
|
|
40
|
+
strokePropTypeUtil: () => strokePropTypeUtil,
|
|
41
|
+
urlPropTypeUtil: () => urlPropTypeUtil
|
|
38
42
|
});
|
|
39
43
|
module.exports = __toCommonJS(src_exports);
|
|
40
44
|
|
|
41
45
|
// src/prop-types/box-shadow.ts
|
|
42
|
-
var
|
|
46
|
+
var import_schema4 = require("@elementor/schema");
|
|
43
47
|
|
|
44
48
|
// src/utils/create-prop-utils.ts
|
|
45
49
|
var import_schema = require("@elementor/schema");
|
|
@@ -75,151 +79,181 @@ function createPropUtils(key, valueSchema) {
|
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
// src/prop-types/shadow.ts
|
|
78
|
-
var
|
|
82
|
+
var import_schema3 = require("@elementor/schema");
|
|
79
83
|
|
|
80
|
-
// src/prop-types/
|
|
84
|
+
// src/prop-types/utils.ts
|
|
81
85
|
var import_schema2 = require("@elementor/schema");
|
|
82
|
-
var
|
|
83
|
-
"size",
|
|
84
|
-
import_schema2.z.object({
|
|
85
|
-
unit: import_schema2.z.enum(["px", "em", "rem", "%", "vw", "vh"]),
|
|
86
|
-
size: import_schema2.z.number()
|
|
87
|
-
})
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// src/prop-types/color.ts
|
|
91
|
-
var import_schema3 = require("@elementor/schema");
|
|
92
|
-
var colorPropType = createPropUtils("color", import_schema3.z.string());
|
|
86
|
+
var unknownChildrenSchema = import_schema2.z.any().nullable();
|
|
93
87
|
|
|
94
88
|
// src/prop-types/shadow.ts
|
|
95
|
-
var
|
|
89
|
+
var shadowPropTypeUtil = createPropUtils(
|
|
96
90
|
"shadow",
|
|
97
|
-
|
|
98
|
-
position:
|
|
99
|
-
hOffset:
|
|
100
|
-
vOffset:
|
|
101
|
-
blur:
|
|
102
|
-
spread:
|
|
103
|
-
color:
|
|
91
|
+
import_schema3.z.strictObject({
|
|
92
|
+
position: unknownChildrenSchema,
|
|
93
|
+
hOffset: unknownChildrenSchema,
|
|
94
|
+
vOffset: unknownChildrenSchema,
|
|
95
|
+
blur: unknownChildrenSchema,
|
|
96
|
+
spread: unknownChildrenSchema,
|
|
97
|
+
color: unknownChildrenSchema
|
|
104
98
|
})
|
|
105
99
|
);
|
|
106
100
|
|
|
107
101
|
// src/prop-types/box-shadow.ts
|
|
108
|
-
var
|
|
102
|
+
var boxShadowPropTypeUtil = createPropUtils("box-shadow", import_schema4.z.array(shadowPropTypeUtil.schema));
|
|
109
103
|
|
|
110
104
|
// src/prop-types/border-radius.ts
|
|
111
|
-
var
|
|
112
|
-
var
|
|
105
|
+
var import_schema5 = require("@elementor/schema");
|
|
106
|
+
var borderRadiusPropTypeUtil = createPropUtils(
|
|
113
107
|
"border-radius",
|
|
114
|
-
|
|
115
|
-
"top-left":
|
|
116
|
-
"top-right":
|
|
117
|
-
"bottom-right":
|
|
118
|
-
"bottom-left":
|
|
108
|
+
import_schema5.z.strictObject({
|
|
109
|
+
"top-left": unknownChildrenSchema,
|
|
110
|
+
"top-right": unknownChildrenSchema,
|
|
111
|
+
"bottom-right": unknownChildrenSchema,
|
|
112
|
+
"bottom-left": unknownChildrenSchema
|
|
119
113
|
})
|
|
120
114
|
);
|
|
121
115
|
|
|
122
116
|
// src/prop-types/border-width.ts
|
|
123
|
-
var
|
|
124
|
-
var
|
|
117
|
+
var import_schema6 = require("@elementor/schema");
|
|
118
|
+
var borderWidthPropTypeUtil = createPropUtils(
|
|
125
119
|
"border-width",
|
|
126
|
-
|
|
127
|
-
top:
|
|
128
|
-
right:
|
|
129
|
-
bottom:
|
|
130
|
-
left:
|
|
120
|
+
import_schema6.z.strictObject({
|
|
121
|
+
top: unknownChildrenSchema,
|
|
122
|
+
right: unknownChildrenSchema,
|
|
123
|
+
bottom: unknownChildrenSchema,
|
|
124
|
+
left: unknownChildrenSchema
|
|
131
125
|
})
|
|
132
126
|
);
|
|
133
127
|
|
|
134
128
|
// src/prop-types/classes.ts
|
|
129
|
+
var import_schema7 = require("@elementor/schema");
|
|
130
|
+
var classesPropTypeUtil = createPropUtils("classes", import_schema7.z.array(import_schema7.z.string().regex(/^[a-z][a-z-_0-9]*$/i)));
|
|
131
|
+
|
|
132
|
+
// src/prop-types/color.ts
|
|
135
133
|
var import_schema8 = require("@elementor/schema");
|
|
136
|
-
var
|
|
134
|
+
var colorPropTypeUtil = createPropUtils("color", import_schema8.z.string());
|
|
137
135
|
|
|
138
136
|
// src/prop-types/image.ts
|
|
139
|
-
var import_schema12 = require("@elementor/schema");
|
|
140
|
-
|
|
141
|
-
// src/prop-types/image-src.ts
|
|
142
|
-
var import_schema11 = require("@elementor/schema");
|
|
143
|
-
|
|
144
|
-
// src/prop-types/url.ts
|
|
145
137
|
var import_schema9 = require("@elementor/schema");
|
|
146
|
-
var
|
|
138
|
+
var imagePropTypeUtil = createPropUtils(
|
|
139
|
+
"image",
|
|
140
|
+
import_schema9.z.strictObject({
|
|
141
|
+
src: unknownChildrenSchema,
|
|
142
|
+
size: unknownChildrenSchema
|
|
143
|
+
})
|
|
144
|
+
);
|
|
147
145
|
|
|
148
146
|
// src/prop-types/image-attachment-id.ts
|
|
149
147
|
var import_schema10 = require("@elementor/schema");
|
|
150
148
|
var imageAttachmentIdPropType = createPropUtils("image-attachment-id", import_schema10.z.number());
|
|
151
149
|
|
|
152
150
|
// src/prop-types/image-src.ts
|
|
153
|
-
var
|
|
151
|
+
var import_schema12 = require("@elementor/schema");
|
|
152
|
+
|
|
153
|
+
// src/prop-types/url.ts
|
|
154
|
+
var import_schema11 = require("@elementor/schema");
|
|
155
|
+
var urlPropTypeUtil = createPropUtils("url", import_schema11.z.string());
|
|
156
|
+
|
|
157
|
+
// src/prop-types/image-src.ts
|
|
158
|
+
var imageSrcPropTypeUtil = createPropUtils(
|
|
154
159
|
"image-src",
|
|
155
|
-
|
|
160
|
+
import_schema12.z.strictObject({
|
|
156
161
|
id: imageAttachmentIdPropType.schema,
|
|
157
|
-
url:
|
|
162
|
+
url: import_schema12.z.null()
|
|
158
163
|
}).or(
|
|
159
|
-
|
|
160
|
-
id:
|
|
161
|
-
url:
|
|
164
|
+
import_schema12.z.strictObject({
|
|
165
|
+
id: import_schema12.z.null(),
|
|
166
|
+
url: urlPropTypeUtil.schema
|
|
162
167
|
})
|
|
163
168
|
)
|
|
164
169
|
);
|
|
165
170
|
|
|
166
|
-
// src/prop-types/image.ts
|
|
167
|
-
var imagePropType = createPropUtils(
|
|
168
|
-
"image",
|
|
169
|
-
import_schema12.z.object({
|
|
170
|
-
src: imageSrcPropType.schema,
|
|
171
|
-
size: sizePropType.schema
|
|
172
|
-
})
|
|
173
|
-
);
|
|
174
|
-
|
|
175
171
|
// src/prop-types/linked-dimensions.ts
|
|
176
172
|
var import_schema13 = require("@elementor/schema");
|
|
177
|
-
var
|
|
173
|
+
var linkedDimensionsPropTypeUtil = createPropUtils(
|
|
178
174
|
"linked-dimensions",
|
|
179
|
-
import_schema13.z.
|
|
180
|
-
isLinked:
|
|
181
|
-
top:
|
|
182
|
-
right:
|
|
183
|
-
bottom:
|
|
184
|
-
left:
|
|
175
|
+
import_schema13.z.strictObject({
|
|
176
|
+
isLinked: unknownChildrenSchema,
|
|
177
|
+
top: unknownChildrenSchema,
|
|
178
|
+
right: unknownChildrenSchema,
|
|
179
|
+
bottom: unknownChildrenSchema,
|
|
180
|
+
left: unknownChildrenSchema
|
|
185
181
|
})
|
|
186
182
|
);
|
|
187
183
|
|
|
188
|
-
// src/prop-types/
|
|
184
|
+
// src/prop-types/number.ts
|
|
189
185
|
var import_schema14 = require("@elementor/schema");
|
|
190
|
-
var
|
|
186
|
+
var numberPropTypeUtil = createPropUtils("number", import_schema14.z.number());
|
|
187
|
+
|
|
188
|
+
// src/prop-types/size.ts
|
|
189
|
+
var import_schema15 = require("@elementor/schema");
|
|
190
|
+
var sizePropTypeUtil = createPropUtils(
|
|
191
|
+
"size",
|
|
192
|
+
import_schema15.z.strictObject({
|
|
193
|
+
unit: import_schema15.z.enum(["px", "em", "rem", "%", "vw", "vh"]),
|
|
194
|
+
size: import_schema15.z.number().nullable()
|
|
195
|
+
})
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
// src/prop-types/string.ts
|
|
199
|
+
var import_schema16 = require("@elementor/schema");
|
|
200
|
+
var stringPropTypeUtil = createPropUtils("string", import_schema16.z.string());
|
|
201
|
+
|
|
202
|
+
// src/prop-types/stroke.ts
|
|
203
|
+
var import_schema17 = require("@elementor/schema");
|
|
204
|
+
var strokePropTypeUtil = createPropUtils(
|
|
191
205
|
"stroke",
|
|
192
|
-
|
|
193
|
-
color:
|
|
194
|
-
width:
|
|
206
|
+
import_schema17.z.strictObject({
|
|
207
|
+
color: unknownChildrenSchema,
|
|
208
|
+
width: unknownChildrenSchema
|
|
195
209
|
})
|
|
196
210
|
);
|
|
197
211
|
|
|
212
|
+
// src/prop-types/color-gradient.ts
|
|
213
|
+
var import_schema18 = require("@elementor/schema");
|
|
214
|
+
var colorGradientPropTypeUtil = createPropUtils(
|
|
215
|
+
"background-overlay",
|
|
216
|
+
import_schema18.z.strictObject({
|
|
217
|
+
color: unknownChildrenSchema
|
|
218
|
+
})
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
// src/prop-types/background-image.ts
|
|
222
|
+
var import_schema19 = require("@elementor/schema");
|
|
223
|
+
var backgroundImagePropTypeUtil = createPropUtils(
|
|
224
|
+
"background-image",
|
|
225
|
+
import_schema19.z.array(colorGradientPropTypeUtil.schema)
|
|
226
|
+
);
|
|
227
|
+
|
|
198
228
|
// src/utils/is-transformable.ts
|
|
199
|
-
var
|
|
200
|
-
var transformableSchema =
|
|
201
|
-
$$type:
|
|
202
|
-
value:
|
|
229
|
+
var import_schema20 = require("@elementor/schema");
|
|
230
|
+
var transformableSchema = import_schema20.z.object({
|
|
231
|
+
$$type: import_schema20.z.string(),
|
|
232
|
+
value: import_schema20.z.any()
|
|
203
233
|
});
|
|
204
234
|
var isTransformable = (value) => {
|
|
205
235
|
return transformableSchema.safeParse(value).success;
|
|
206
236
|
};
|
|
207
237
|
// Annotate the CommonJS export names for ESM import in node:
|
|
208
238
|
0 && (module.exports = {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
239
|
+
backgroundImagePropTypeUtil,
|
|
240
|
+
borderRadiusPropTypeUtil,
|
|
241
|
+
borderWidthPropTypeUtil,
|
|
242
|
+
boxShadowPropTypeUtil,
|
|
243
|
+
classesPropTypeUtil,
|
|
244
|
+
colorGradientPropTypeUtil,
|
|
245
|
+
colorPropTypeUtil,
|
|
214
246
|
createPropUtils,
|
|
215
247
|
imageAttachmentIdPropType,
|
|
216
|
-
|
|
217
|
-
|
|
248
|
+
imagePropTypeUtil,
|
|
249
|
+
imageSrcPropTypeUtil,
|
|
218
250
|
isTransformable,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
251
|
+
linkedDimensionsPropTypeUtil,
|
|
252
|
+
numberPropTypeUtil,
|
|
253
|
+
shadowPropTypeUtil,
|
|
254
|
+
sizePropTypeUtil,
|
|
255
|
+
stringPropTypeUtil,
|
|
256
|
+
strokePropTypeUtil,
|
|
257
|
+
urlPropTypeUtil
|
|
224
258
|
});
|
|
225
259
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/prop-types/box-shadow.ts","../src/utils/create-prop-utils.ts","../src/prop-types/shadow.ts","../src/prop-types/size.ts","../src/prop-types/color.ts","../src/prop-types/border-radius.ts","../src/prop-types/border-width.ts","../src/prop-types/classes.ts","../src/prop-types/image.ts","../src/prop-types/image-src.ts","../src/prop-types/url.ts","../src/prop-types/image-attachment-id.ts","../src/prop-types/linked-dimensions.ts","../src/prop-types/stroke.ts","../src/utils/is-transformable.ts"],"sourcesContent":["// types\nexport * from './types';\n\n// prop types\nexport * from './prop-types';\n\n// utils\nexport { createPropUtils } from './utils/create-prop-utils';\nexport { isTransformable } from './utils/is-transformable';\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { shadowPropType } from './shadow';\n\nexport const boxShadowPropType = createPropUtils( 'box-shadow', z.array( shadowPropType.schema ) );\n\nexport type BoxShadowPropValue = z.infer< typeof boxShadowPropType.schema >;\n","import { z, type ZodTypeAny } from '@elementor/schema';\n\ntype Updater< T > = ( prev?: T ) => T;\n\n/**\n * Usage example:\n *\n * ```ts\n * const elementsPropUtils = createPropUtils( 'elements', z.array( z.string() ) );\n *\n * elementsPropUtils.isValid( element.props?.children );\n * elementsPropUtils.create( [ 'a', 'b' ] );\n * elementsPropUtils.create( ( prev = [] ) => [ ...prev, 'c' ], element.props?.children );\n * ```\n */\n\nexport function createPropUtils< TKey extends string, TValue extends ZodTypeAny >( key: TKey, valueSchema: TValue ) {\n\tconst schema = z.object( {\n\t\t$$type: z.literal( key ),\n\t\tvalue: valueSchema,\n\t} );\n\n\ttype Prop = z.infer< typeof schema >;\n\n\tfunction isValid( prop: unknown ): prop is Prop {\n\t\treturn schema.safeParse( prop ).success;\n\t}\n\n\tfunction create( value: Prop[ 'value' ] ): Prop;\n\tfunction create( value: Updater< Prop[ 'value' ] >, base: unknown ): Prop;\n\tfunction create( value: Prop[ 'value' ] | Updater< Prop[ 'value' ] >, base?: unknown ): Prop {\n\t\tconst fn = ( typeof value === 'function' ? value : () => value ) as Updater< Prop[ 'value' ] >;\n\n\t\tif ( ! base ) {\n\t\t\treturn {\n\t\t\t\t$$type: key,\n\t\t\t\tvalue: fn(),\n\t\t\t};\n\t\t}\n\n\t\tif ( ! isValid( base ) ) {\n\t\t\tthrow new Error( `Cannot create prop based on invalid value: ${ JSON.stringify( base ) }` );\n\t\t}\n\n\t\treturn {\n\t\t\t$$type: key,\n\t\t\tvalue: fn( base.value ),\n\t\t};\n\t}\n\n\treturn {\n\t\tisValid,\n\t\tcreate,\n\t\tschema,\n\t};\n}\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { sizePropType } from './size';\nimport { colorPropType } from './color';\n\nexport const shadowPropType = createPropUtils(\n\t'shadow',\n\tz.object( {\n\t\tposition: z.nullable( z.literal( 'inset' ) ),\n\t\thOffset: sizePropType.schema,\n\t\tvOffset: sizePropType.schema,\n\t\tblur: sizePropType.schema,\n\t\tspread: sizePropType.schema,\n\t\tcolor: colorPropType.schema,\n\t} )\n);\n\nexport type ShadowPropValue = z.infer< typeof shadowPropType.schema >;\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const sizePropType = createPropUtils(\n\t'size',\n\tz.object( {\n\t\tunit: z.enum( [ 'px', 'em', 'rem', '%', 'vw', 'vh' ] ),\n\t\tsize: z.number(),\n\t} )\n);\n\nexport type SizePropValue = z.infer< typeof sizePropType.schema >;\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const colorPropType = createPropUtils( 'color', z.string() );\n\nexport type ColorPropValue = z.infer< typeof colorPropType.schema >;\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const borderRadiusPropType = createPropUtils(\n\t'border-radius',\n\tz.object( {\n\t\t'top-left': z.any(),\n\t\t'top-right': z.any(),\n\t\t'bottom-right': z.any(),\n\t\t'bottom-left': z.any(),\n\t} )\n);\n\nexport type BorderRadiusPropValue = z.infer< typeof borderRadiusPropType.schema >;\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const borderWidthPropType = createPropUtils(\n\t'border-width',\n\tz.object( {\n\t\ttop: z.any(),\n\t\tright: z.any(),\n\t\tbottom: z.any(),\n\t\tleft: z.any(),\n\t} )\n);\n\nexport type BorderWidthPropValue = z.infer< typeof borderWidthPropType.schema >;\n","import { createPropUtils } from '../utils/create-prop-utils';\nimport { z } from '@elementor/schema';\n\nexport const classesPropType = createPropUtils( 'classes', z.array( z.string().regex( /^[a-z][a-z-_0-9]*$/i ) ) );\n\nexport type ClassesPropValue = z.infer< typeof classesPropType.schema >;\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { imageSrcPropType } from './image-src';\nimport { sizePropType } from './size';\n\nexport const imagePropType = createPropUtils(\n\t'image',\n\tz.object( {\n\t\tsrc: imageSrcPropType.schema,\n\t\tsize: sizePropType.schema,\n\t} )\n);\n\nexport type ImagePropValue = z.infer< typeof imagePropType.schema >;\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { urlPropType } from './url';\nimport { imageAttachmentIdPropType } from './image-attachment-id';\n\nexport const imageSrcPropType = createPropUtils(\n\t'image-src',\n\tz\n\t\t.object( {\n\t\t\tid: imageAttachmentIdPropType.schema,\n\t\t\turl: z.null(),\n\t\t} )\n\t\t.or(\n\t\t\tz.object( {\n\t\t\t\tid: z.null(),\n\t\t\t\turl: urlPropType.schema,\n\t\t\t} )\n\t\t)\n);\n\nexport type ImageSrcPropValue = z.infer< typeof imageSrcPropType.schema >;\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const urlPropType = createPropUtils( 'url', z.string() );\n\nexport type UrlPropValue = z.infer< typeof urlPropType.schema >;\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const imageAttachmentIdPropType = createPropUtils( 'image-attachment-id', z.number() );\n\nexport type ImageAttachmentIdPropValue = z.infer< typeof imageAttachmentIdPropType.schema >;\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const linkedDimensionsPropType = createPropUtils(\n\t'linked-dimensions',\n\tz.object( {\n\t\tisLinked: z.boolean(),\n\t\ttop: z.any(),\n\t\tright: z.any(),\n\t\tbottom: z.any(),\n\t\tleft: z.any(),\n\t} )\n);\n\nexport type LinkedDimensionsPropValue = z.infer< typeof linkedDimensionsPropType.schema >;\n","import { z } from '@elementor/schema';\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { colorPropType } from './color';\nimport { sizePropType } from './size';\n\nexport const strokePropType = createPropUtils(\n\t'stroke',\n\tz.object( {\n\t\tcolor: colorPropType.schema,\n\t\twidth: sizePropType.schema,\n\t} )\n);\n\nexport type StrokePropValue = z.infer< typeof strokePropType.schema >;\n","import { z } from '@elementor/schema';\n\nconst transformableSchema = z.object( {\n\t$$type: z.string(),\n\tvalue: z.any(),\n} );\n\ntype TransformablePropValue = z.infer< typeof transformableSchema >;\n\nexport const isTransformable = ( value: unknown ): value is TransformablePropValue => {\n\treturn transformableSchema.safeParse( value ).success;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,iBAAkB;;;ACAlB,oBAAmC;AAgB5B,SAAS,gBAAmE,KAAW,aAAsB;AACnH,QAAM,SAAS,gBAAE,OAAQ;AAAA,IACxB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ACA,kBAAE,OAAQ;AAAA,IACT,UAAU,kBAAE,QAAQ;AAAA,IACpB,KAAK,kBAAE,IAAI;AAAA,IACX,OAAO,kBAAE,IAAI;AAAA,IACb,QAAQ,kBAAE,IAAI;AAAA,IACd,MAAM,kBAAE,IAAI;AAAA,EACb,CAAE;AACH;;;ACZA,IAAAC,kBAAkB;AAKX,IAAM,iBAAiB;AAAA,EAC7B;AAAA,EACA,kBAAE,OAAQ;AAAA,IACT,OAAO,cAAc;AAAA,IACrB,OAAO,aAAa;AAAA,EACrB,CAAE;AACH;;;ACXA,IAAAC,kBAAkB;AAElB,IAAM,sBAAsB,kBAAE,OAAQ;AAAA,EACrC,QAAQ,kBAAE,OAAO;AAAA,EACjB,OAAO,kBAAE,IAAI;AACd,CAAE;AAIK,IAAM,kBAAkB,CAAE,UAAqD;AACrF,SAAO,oBAAoB,UAAW,KAAM,EAAE;AAC/C;","names":["import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/prop-types/box-shadow.ts","../src/utils/create-prop-utils.ts","../src/prop-types/shadow.ts","../src/prop-types/utils.ts","../src/prop-types/border-radius.ts","../src/prop-types/border-width.ts","../src/prop-types/classes.ts","../src/prop-types/color.ts","../src/prop-types/image.ts","../src/prop-types/image-attachment-id.ts","../src/prop-types/image-src.ts","../src/prop-types/url.ts","../src/prop-types/linked-dimensions.ts","../src/prop-types/number.ts","../src/prop-types/size.ts","../src/prop-types/string.ts","../src/prop-types/stroke.ts","../src/prop-types/color-gradient.ts","../src/prop-types/background-image.ts","../src/utils/is-transformable.ts"],"sourcesContent":["// types\nexport * from './types';\n\n// prop types\nexport * from './prop-types';\n\n// utils\nexport { createPropUtils } from './utils/create-prop-utils';\nexport { isTransformable } from './utils/is-transformable';\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { shadowPropTypeUtil } from './shadow';\n\nexport const boxShadowPropTypeUtil = createPropUtils( 'box-shadow', z.array( shadowPropTypeUtil.schema ) );\n\nexport type BoxShadowPropValue = z.infer< typeof boxShadowPropTypeUtil.schema >;\n","import { z, type ZodTypeAny } from '@elementor/schema';\n\ntype Updater< T > = ( prev?: T ) => T;\n\n/**\n * Usage example:\n *\n * ```ts\n * const elementsPropUtils = createPropUtils( 'elements', z.array( z.string() ) );\n *\n * elementsPropUtils.isValid( element.props?.children );\n * elementsPropUtils.create( [ 'a', 'b' ] );\n * elementsPropUtils.create( ( prev = [] ) => [ ...prev, 'c' ], element.props?.children );\n * ```\n */\n\nexport function createPropUtils< TKey extends string, TValue extends ZodTypeAny >( key: TKey, valueSchema: TValue ) {\n\tconst schema = z.object( {\n\t\t$$type: z.literal( key ),\n\t\tvalue: valueSchema,\n\t} );\n\n\ttype Prop = z.infer< typeof schema >;\n\n\tfunction isValid( prop: unknown ): prop is Prop {\n\t\treturn schema.safeParse( prop ).success;\n\t}\n\n\tfunction create( value: Prop[ 'value' ] ): Prop;\n\tfunction create( value: Updater< Prop[ 'value' ] >, base: unknown ): Prop;\n\tfunction create( value: Prop[ 'value' ] | Updater< Prop[ 'value' ] >, base?: unknown ): Prop {\n\t\tconst fn = ( typeof value === 'function' ? value : () => value ) as Updater< Prop[ 'value' ] >;\n\n\t\tif ( ! base ) {\n\t\t\treturn {\n\t\t\t\t$$type: key,\n\t\t\t\tvalue: fn(),\n\t\t\t};\n\t\t}\n\n\t\tif ( ! isValid( base ) ) {\n\t\t\tthrow new Error( `Cannot create prop based on invalid value: ${ JSON.stringify( base ) }` );\n\t\t}\n\n\t\treturn {\n\t\t\t$$type: key,\n\t\t\tvalue: fn( base.value ),\n\t\t};\n\t}\n\n\treturn {\n\t\tisValid,\n\t\tcreate,\n\t\tschema,\n\t};\n}\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const shadowPropTypeUtil = createPropUtils(\n\t'shadow',\n\tz.strictObject( {\n\t\tposition: unknownChildrenSchema,\n\t\thOffset: unknownChildrenSchema,\n\t\tvOffset: unknownChildrenSchema,\n\t\tblur: unknownChildrenSchema,\n\t\tspread: unknownChildrenSchema,\n\t\tcolor: unknownChildrenSchema,\n\t} )\n);\n\nexport type ShadowPropValue = z.infer< typeof shadowPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nexport const unknownChildrenSchema = z.any().nullable();\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const borderRadiusPropTypeUtil = createPropUtils(\n\t'border-radius',\n\tz.strictObject( {\n\t\t'top-left': unknownChildrenSchema,\n\t\t'top-right': unknownChildrenSchema,\n\t\t'bottom-right': unknownChildrenSchema,\n\t\t'bottom-left': unknownChildrenSchema,\n\t} )\n);\n\nexport type BorderRadiusPropValue = z.infer< typeof borderRadiusPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const borderWidthPropTypeUtil = createPropUtils(\n\t'border-width',\n\tz.strictObject( {\n\t\ttop: unknownChildrenSchema,\n\t\tright: unknownChildrenSchema,\n\t\tbottom: unknownChildrenSchema,\n\t\tleft: unknownChildrenSchema,\n\t} )\n);\n\nexport type BorderWidthPropValue = z.infer< typeof borderWidthPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const classesPropTypeUtil = createPropUtils( 'classes', z.array( z.string().regex( /^[a-z][a-z-_0-9]*$/i ) ) );\n\nexport type ClassesPropValue = z.infer< typeof classesPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const colorPropTypeUtil = createPropUtils( 'color', z.string() );\n\nexport type ColorPropValue = z.infer< typeof colorPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const imagePropTypeUtil = createPropUtils(\n\t'image',\n\tz.strictObject( {\n\t\tsrc: unknownChildrenSchema,\n\t\tsize: unknownChildrenSchema,\n\t} )\n);\n\nexport type ImagePropValue = z.infer< typeof imagePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const imageAttachmentIdPropType = createPropUtils( 'image-attachment-id', z.number() );\n\nexport type ImageAttachmentIdPropValue = z.infer< typeof imageAttachmentIdPropType.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { imageAttachmentIdPropType } from './image-attachment-id';\nimport { urlPropTypeUtil } from './url';\n\nexport const imageSrcPropTypeUtil = createPropUtils(\n\t'image-src',\n\tz\n\t\t.strictObject( {\n\t\t\tid: imageAttachmentIdPropType.schema,\n\t\t\turl: z.null(),\n\t\t} )\n\t\t.or(\n\t\t\tz.strictObject( {\n\t\t\t\tid: z.null(),\n\t\t\t\turl: urlPropTypeUtil.schema,\n\t\t\t} )\n\t\t)\n);\n\nexport type ImageSrcPropValue = z.infer< typeof imageSrcPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const urlPropTypeUtil = createPropUtils( 'url', z.string() );\n\nexport type UrlPropValue = z.infer< typeof urlPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const linkedDimensionsPropTypeUtil = createPropUtils(\n\t'linked-dimensions',\n\tz.strictObject( {\n\t\tisLinked: unknownChildrenSchema,\n\t\ttop: unknownChildrenSchema,\n\t\tright: unknownChildrenSchema,\n\t\tbottom: unknownChildrenSchema,\n\t\tleft: unknownChildrenSchema,\n\t} )\n);\n\nexport type LinkedDimensionsPropValue = z.infer< typeof linkedDimensionsPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const numberPropTypeUtil = createPropUtils( 'number', z.number() );\n\nexport type NumberPropValue = z.infer< typeof numberPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const sizePropTypeUtil = createPropUtils(\n\t'size',\n\tz.strictObject( {\n\t\tunit: z.enum( [ 'px', 'em', 'rem', '%', 'vw', 'vh' ] ),\n\t\tsize: z.number().nullable(),\n\t} )\n);\n\nexport type SizePropValue = z.infer< typeof sizePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const stringPropTypeUtil = createPropUtils( 'string', z.string() );\n\nexport type StringPropValue = z.infer< typeof stringPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const strokePropTypeUtil = createPropUtils(\n\t'stroke',\n\tz.strictObject( {\n\t\tcolor: unknownChildrenSchema,\n\t\twidth: unknownChildrenSchema,\n\t} )\n);\n\nexport type StrokePropValue = z.infer< typeof strokePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const colorGradientPropTypeUtil = createPropUtils(\n\t'background-overlay',\n\tz.strictObject( {\n\t\tcolor: unknownChildrenSchema,\n\t} )\n);\n\nexport type ColorGradientPropValue = z.infer< typeof colorGradientPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { colorGradientPropTypeUtil } from './color-gradient';\n\nexport const backgroundImagePropTypeUtil = createPropUtils(\n\t'background-image',\n\tz.array( colorGradientPropTypeUtil.schema )\n);\n\nexport type backgroundImageTypePropValue = z.infer< typeof backgroundImagePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nconst transformableSchema = z.object( {\n\t$$type: z.string(),\n\tvalue: z.any(),\n} );\n\ntype TransformablePropValue = z.infer< typeof transformableSchema >;\n\nexport const isTransformable = ( value: unknown ): value is TransformablePropValue => {\n\treturn transformableSchema.safeParse( value ).success;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,iBAAkB;;;ACAlB,oBAAmC;AAgB5B,SAAS,gBAAmE,KAAW,aAAsB;AACnH,QAAM,SAAS,gBAAE,OAAQ;AAAA,IACxB,QAAQ,gBAAE,QAAS,GAAI;AAAA,IACvB,OAAO;AAAA,EACR,CAAE;AAIF,WAAS,QAAS,MAA8B;AAC/C,WAAO,OAAO,UAAW,IAAK,EAAE;AAAA,EACjC;AAIA,WAAS,OAAQ,OAAqD,MAAuB;AAC5F,UAAM,KAAO,OAAO,UAAU,aAAa,QAAQ,MAAM;AAEzD,QAAK,CAAE,MAAO;AACb,aAAO;AAAA,QACN,QAAQ;AAAA,QACR,OAAO,GAAG;AAAA,MACX;AAAA,IACD;AAEA,QAAK,CAAE,QAAS,IAAK,GAAI;AACxB,YAAM,IAAI,MAAO,8CAA+C,KAAK,UAAW,IAAK,CAAE,EAAG;AAAA,IAC3F;AAEA,WAAO;AAAA,MACN,QAAQ;AAAA,MACR,OAAO,GAAI,KAAK,KAAM;AAAA,IACvB;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;;;ACvDA,IAAAC,iBAAkB;;;ACAlB,IAAAC,iBAAkB;AAEX,IAAM,wBAAwB,iBAAE,IAAI,EAAE,SAAS;;;ADG/C,IAAM,qBAAqB;AAAA,EACjC;AAAA,E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,EAAE;AAC/C;","names":["import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/prop-types/box-shadow.ts
|
|
2
|
-
import { z as
|
|
2
|
+
import { z as z4 } from "@elementor/schema";
|
|
3
3
|
|
|
4
4
|
// src/utils/create-prop-utils.ts
|
|
5
5
|
import { z } from "@elementor/schema";
|
|
@@ -35,150 +35,180 @@ function createPropUtils(key, valueSchema) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// src/prop-types/shadow.ts
|
|
38
|
-
import { z as
|
|
38
|
+
import { z as z3 } from "@elementor/schema";
|
|
39
39
|
|
|
40
|
-
// src/prop-types/
|
|
40
|
+
// src/prop-types/utils.ts
|
|
41
41
|
import { z as z2 } from "@elementor/schema";
|
|
42
|
-
var
|
|
43
|
-
"size",
|
|
44
|
-
z2.object({
|
|
45
|
-
unit: z2.enum(["px", "em", "rem", "%", "vw", "vh"]),
|
|
46
|
-
size: z2.number()
|
|
47
|
-
})
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
// src/prop-types/color.ts
|
|
51
|
-
import { z as z3 } from "@elementor/schema";
|
|
52
|
-
var colorPropType = createPropUtils("color", z3.string());
|
|
42
|
+
var unknownChildrenSchema = z2.any().nullable();
|
|
53
43
|
|
|
54
44
|
// src/prop-types/shadow.ts
|
|
55
|
-
var
|
|
45
|
+
var shadowPropTypeUtil = createPropUtils(
|
|
56
46
|
"shadow",
|
|
57
|
-
|
|
58
|
-
position:
|
|
59
|
-
hOffset:
|
|
60
|
-
vOffset:
|
|
61
|
-
blur:
|
|
62
|
-
spread:
|
|
63
|
-
color:
|
|
47
|
+
z3.strictObject({
|
|
48
|
+
position: unknownChildrenSchema,
|
|
49
|
+
hOffset: unknownChildrenSchema,
|
|
50
|
+
vOffset: unknownChildrenSchema,
|
|
51
|
+
blur: unknownChildrenSchema,
|
|
52
|
+
spread: unknownChildrenSchema,
|
|
53
|
+
color: unknownChildrenSchema
|
|
64
54
|
})
|
|
65
55
|
);
|
|
66
56
|
|
|
67
57
|
// src/prop-types/box-shadow.ts
|
|
68
|
-
var
|
|
58
|
+
var boxShadowPropTypeUtil = createPropUtils("box-shadow", z4.array(shadowPropTypeUtil.schema));
|
|
69
59
|
|
|
70
60
|
// src/prop-types/border-radius.ts
|
|
71
|
-
import { z as
|
|
72
|
-
var
|
|
61
|
+
import { z as z5 } from "@elementor/schema";
|
|
62
|
+
var borderRadiusPropTypeUtil = createPropUtils(
|
|
73
63
|
"border-radius",
|
|
74
|
-
|
|
75
|
-
"top-left":
|
|
76
|
-
"top-right":
|
|
77
|
-
"bottom-right":
|
|
78
|
-
"bottom-left":
|
|
64
|
+
z5.strictObject({
|
|
65
|
+
"top-left": unknownChildrenSchema,
|
|
66
|
+
"top-right": unknownChildrenSchema,
|
|
67
|
+
"bottom-right": unknownChildrenSchema,
|
|
68
|
+
"bottom-left": unknownChildrenSchema
|
|
79
69
|
})
|
|
80
70
|
);
|
|
81
71
|
|
|
82
72
|
// src/prop-types/border-width.ts
|
|
83
|
-
import { z as
|
|
84
|
-
var
|
|
73
|
+
import { z as z6 } from "@elementor/schema";
|
|
74
|
+
var borderWidthPropTypeUtil = createPropUtils(
|
|
85
75
|
"border-width",
|
|
86
|
-
|
|
87
|
-
top:
|
|
88
|
-
right:
|
|
89
|
-
bottom:
|
|
90
|
-
left:
|
|
76
|
+
z6.strictObject({
|
|
77
|
+
top: unknownChildrenSchema,
|
|
78
|
+
right: unknownChildrenSchema,
|
|
79
|
+
bottom: unknownChildrenSchema,
|
|
80
|
+
left: unknownChildrenSchema
|
|
91
81
|
})
|
|
92
82
|
);
|
|
93
83
|
|
|
94
84
|
// src/prop-types/classes.ts
|
|
85
|
+
import { z as z7 } from "@elementor/schema";
|
|
86
|
+
var classesPropTypeUtil = createPropUtils("classes", z7.array(z7.string().regex(/^[a-z][a-z-_0-9]*$/i)));
|
|
87
|
+
|
|
88
|
+
// src/prop-types/color.ts
|
|
95
89
|
import { z as z8 } from "@elementor/schema";
|
|
96
|
-
var
|
|
90
|
+
var colorPropTypeUtil = createPropUtils("color", z8.string());
|
|
97
91
|
|
|
98
92
|
// src/prop-types/image.ts
|
|
99
|
-
import { z as z12 } from "@elementor/schema";
|
|
100
|
-
|
|
101
|
-
// src/prop-types/image-src.ts
|
|
102
|
-
import { z as z11 } from "@elementor/schema";
|
|
103
|
-
|
|
104
|
-
// src/prop-types/url.ts
|
|
105
93
|
import { z as z9 } from "@elementor/schema";
|
|
106
|
-
var
|
|
94
|
+
var imagePropTypeUtil = createPropUtils(
|
|
95
|
+
"image",
|
|
96
|
+
z9.strictObject({
|
|
97
|
+
src: unknownChildrenSchema,
|
|
98
|
+
size: unknownChildrenSchema
|
|
99
|
+
})
|
|
100
|
+
);
|
|
107
101
|
|
|
108
102
|
// src/prop-types/image-attachment-id.ts
|
|
109
103
|
import { z as z10 } from "@elementor/schema";
|
|
110
104
|
var imageAttachmentIdPropType = createPropUtils("image-attachment-id", z10.number());
|
|
111
105
|
|
|
112
106
|
// src/prop-types/image-src.ts
|
|
113
|
-
|
|
107
|
+
import { z as z12 } from "@elementor/schema";
|
|
108
|
+
|
|
109
|
+
// src/prop-types/url.ts
|
|
110
|
+
import { z as z11 } from "@elementor/schema";
|
|
111
|
+
var urlPropTypeUtil = createPropUtils("url", z11.string());
|
|
112
|
+
|
|
113
|
+
// src/prop-types/image-src.ts
|
|
114
|
+
var imageSrcPropTypeUtil = createPropUtils(
|
|
114
115
|
"image-src",
|
|
115
|
-
|
|
116
|
+
z12.strictObject({
|
|
116
117
|
id: imageAttachmentIdPropType.schema,
|
|
117
|
-
url:
|
|
118
|
+
url: z12.null()
|
|
118
119
|
}).or(
|
|
119
|
-
|
|
120
|
-
id:
|
|
121
|
-
url:
|
|
120
|
+
z12.strictObject({
|
|
121
|
+
id: z12.null(),
|
|
122
|
+
url: urlPropTypeUtil.schema
|
|
122
123
|
})
|
|
123
124
|
)
|
|
124
125
|
);
|
|
125
126
|
|
|
126
|
-
// src/prop-types/image.ts
|
|
127
|
-
var imagePropType = createPropUtils(
|
|
128
|
-
"image",
|
|
129
|
-
z12.object({
|
|
130
|
-
src: imageSrcPropType.schema,
|
|
131
|
-
size: sizePropType.schema
|
|
132
|
-
})
|
|
133
|
-
);
|
|
134
|
-
|
|
135
127
|
// src/prop-types/linked-dimensions.ts
|
|
136
128
|
import { z as z13 } from "@elementor/schema";
|
|
137
|
-
var
|
|
129
|
+
var linkedDimensionsPropTypeUtil = createPropUtils(
|
|
138
130
|
"linked-dimensions",
|
|
139
|
-
z13.
|
|
140
|
-
isLinked:
|
|
141
|
-
top:
|
|
142
|
-
right:
|
|
143
|
-
bottom:
|
|
144
|
-
left:
|
|
131
|
+
z13.strictObject({
|
|
132
|
+
isLinked: unknownChildrenSchema,
|
|
133
|
+
top: unknownChildrenSchema,
|
|
134
|
+
right: unknownChildrenSchema,
|
|
135
|
+
bottom: unknownChildrenSchema,
|
|
136
|
+
left: unknownChildrenSchema
|
|
145
137
|
})
|
|
146
138
|
);
|
|
147
139
|
|
|
148
|
-
// src/prop-types/
|
|
140
|
+
// src/prop-types/number.ts
|
|
149
141
|
import { z as z14 } from "@elementor/schema";
|
|
150
|
-
var
|
|
142
|
+
var numberPropTypeUtil = createPropUtils("number", z14.number());
|
|
143
|
+
|
|
144
|
+
// src/prop-types/size.ts
|
|
145
|
+
import { z as z15 } from "@elementor/schema";
|
|
146
|
+
var sizePropTypeUtil = createPropUtils(
|
|
147
|
+
"size",
|
|
148
|
+
z15.strictObject({
|
|
149
|
+
unit: z15.enum(["px", "em", "rem", "%", "vw", "vh"]),
|
|
150
|
+
size: z15.number().nullable()
|
|
151
|
+
})
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
// src/prop-types/string.ts
|
|
155
|
+
import { z as z16 } from "@elementor/schema";
|
|
156
|
+
var stringPropTypeUtil = createPropUtils("string", z16.string());
|
|
157
|
+
|
|
158
|
+
// src/prop-types/stroke.ts
|
|
159
|
+
import { z as z17 } from "@elementor/schema";
|
|
160
|
+
var strokePropTypeUtil = createPropUtils(
|
|
151
161
|
"stroke",
|
|
152
|
-
|
|
153
|
-
color:
|
|
154
|
-
width:
|
|
162
|
+
z17.strictObject({
|
|
163
|
+
color: unknownChildrenSchema,
|
|
164
|
+
width: unknownChildrenSchema
|
|
155
165
|
})
|
|
156
166
|
);
|
|
157
167
|
|
|
168
|
+
// src/prop-types/color-gradient.ts
|
|
169
|
+
import { z as z18 } from "@elementor/schema";
|
|
170
|
+
var colorGradientPropTypeUtil = createPropUtils(
|
|
171
|
+
"background-overlay",
|
|
172
|
+
z18.strictObject({
|
|
173
|
+
color: unknownChildrenSchema
|
|
174
|
+
})
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
// src/prop-types/background-image.ts
|
|
178
|
+
import { z as z19 } from "@elementor/schema";
|
|
179
|
+
var backgroundImagePropTypeUtil = createPropUtils(
|
|
180
|
+
"background-image",
|
|
181
|
+
z19.array(colorGradientPropTypeUtil.schema)
|
|
182
|
+
);
|
|
183
|
+
|
|
158
184
|
// src/utils/is-transformable.ts
|
|
159
|
-
import { z as
|
|
160
|
-
var transformableSchema =
|
|
161
|
-
$$type:
|
|
162
|
-
value:
|
|
185
|
+
import { z as z20 } from "@elementor/schema";
|
|
186
|
+
var transformableSchema = z20.object({
|
|
187
|
+
$$type: z20.string(),
|
|
188
|
+
value: z20.any()
|
|
163
189
|
});
|
|
164
190
|
var isTransformable = (value) => {
|
|
165
191
|
return transformableSchema.safeParse(value).success;
|
|
166
192
|
};
|
|
167
193
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
194
|
+
backgroundImagePropTypeUtil,
|
|
195
|
+
borderRadiusPropTypeUtil,
|
|
196
|
+
borderWidthPropTypeUtil,
|
|
197
|
+
boxShadowPropTypeUtil,
|
|
198
|
+
classesPropTypeUtil,
|
|
199
|
+
colorGradientPropTypeUtil,
|
|
200
|
+
colorPropTypeUtil,
|
|
173
201
|
createPropUtils,
|
|
174
202
|
imageAttachmentIdPropType,
|
|
175
|
-
|
|
176
|
-
|
|
203
|
+
imagePropTypeUtil,
|
|
204
|
+
imageSrcPropTypeUtil,
|
|
177
205
|
isTransformable,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
206
|
+
linkedDimensionsPropTypeUtil,
|
|
207
|
+
numberPropTypeUtil,
|
|
208
|
+
shadowPropTypeUtil,
|
|
209
|
+
sizePropTypeUtil,
|
|
210
|
+
stringPropTypeUtil,
|
|
211
|
+
strokePropTypeUtil,
|
|
212
|
+
urlPropTypeUtil
|
|
183
213
|
};
|
|
184
214
|
//# sourceMappingURL=index.mjs.map
|