@lowdefy/block-utils 4.0.0-alpha.26 → 4.0.0-alpha.29
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/package.json +6 -6
- package/dist/HtmlComponent.js +0 -59
- package/dist/blockDefaultProps.js +0 -38
- package/dist/blockSchema.js +0 -247
- package/dist/index.js +0 -21
- package/dist/makeCssClass.js +0 -19
- package/dist/mediaToCssObject.js +0 -87
- package/dist/renderHtml.js +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/block-utils",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.29",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy Block Utils",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -34,22 +34,22 @@
|
|
|
34
34
|
"dist/*"
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build": "
|
|
37
|
+
"build": "swc src --out-dir dist --config-file ../../../.swcrc --delete-dir-on-start && pnpm copyfiles",
|
|
38
38
|
"clean": "rm -rf dist",
|
|
39
39
|
"copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
|
|
40
|
-
"
|
|
41
|
-
"swc": "swc src --out-dir dist --config-file ../../../.swcrc --delete-dir-on-start && yarn copyfiles",
|
|
40
|
+
"prepublishOnly": "pnpm build",
|
|
42
41
|
"test:watch": "jest --coverage --watch",
|
|
43
42
|
"test": "jest --coverage"
|
|
44
43
|
},
|
|
45
44
|
"dependencies": {
|
|
46
45
|
"@emotion/css": "11.9.0",
|
|
47
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
46
|
+
"@lowdefy/helpers": "4.0.0-alpha.29",
|
|
48
47
|
"dompurify": "2.3.8",
|
|
49
48
|
"react": "18.1.0",
|
|
50
49
|
"react-dom": "18.1.0"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
52
|
+
"@babel/core": "7.19.0",
|
|
53
53
|
"@emotion/jest": "11.9.1",
|
|
54
54
|
"@swc/cli": "0.1.57",
|
|
55
55
|
"@swc/core": "1.2.194",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "621a191ebc0a1569ee6669dc74c12f8be5a8c7f3"
|
|
69
69
|
}
|
package/dist/HtmlComponent.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import React from 'react';
|
|
16
|
-
import DOMPurify from 'dompurify';
|
|
17
|
-
import { type } from '@lowdefy/helpers';
|
|
18
|
-
let HtmlComponent = class HtmlComponent extends React.Component {
|
|
19
|
-
componentDidMount() {
|
|
20
|
-
const htmlString = type.isNone(this.props.html) ? '' : this.props.html.toString();
|
|
21
|
-
this.div.innerHTML = DOMPurify.sanitize(htmlString);
|
|
22
|
-
}
|
|
23
|
-
componentDidUpdate() {
|
|
24
|
-
const htmlString = type.isNone(this.props.html) ? '' : this.props.html.toString();
|
|
25
|
-
this.div.innerHTML = DOMPurify.sanitize(htmlString);
|
|
26
|
-
}
|
|
27
|
-
render() {
|
|
28
|
-
const { div , id , methods , style } = this.props;
|
|
29
|
-
if (div === true) {
|
|
30
|
-
return /*#__PURE__*/ React.createElement("div", {
|
|
31
|
-
id: id,
|
|
32
|
-
"data-testid": id,
|
|
33
|
-
ref: (el)=>{
|
|
34
|
-
if (el) {
|
|
35
|
-
this.div = el;
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
className: methods.makeCssClass(style)
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return /*#__PURE__*/ React.createElement("span", {
|
|
42
|
-
id: id,
|
|
43
|
-
"data-testid": id,
|
|
44
|
-
ref: (el)=>{
|
|
45
|
-
if (el) {
|
|
46
|
-
this.div = el;
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
className: methods.makeCssClass(style)
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
constructor(props){
|
|
53
|
-
super(props);
|
|
54
|
-
this.div = {
|
|
55
|
-
innerHTML: ''
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
export default HtmlComponent;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import makeCssClass from './makeCssClass.js';
|
|
16
|
-
const blockDefaultProps = {
|
|
17
|
-
basePath: '',
|
|
18
|
-
blockId: 'undefined_id',
|
|
19
|
-
components: {},
|
|
20
|
-
content: {},
|
|
21
|
-
events: {},
|
|
22
|
-
list: [],
|
|
23
|
-
menus: [],
|
|
24
|
-
methods: {
|
|
25
|
-
makeCssClass: makeCssClass,
|
|
26
|
-
registerEvent: ()=>undefined,
|
|
27
|
-
registerMethod: ()=>undefined,
|
|
28
|
-
triggerEvent: ()=>undefined
|
|
29
|
-
},
|
|
30
|
-
properties: {},
|
|
31
|
-
required: false,
|
|
32
|
-
validation: {
|
|
33
|
-
status: null,
|
|
34
|
-
errors: [],
|
|
35
|
-
warnings: []
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
export default blockDefaultProps;
|
package/dist/blockSchema.js
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ export default {
|
|
16
|
-
type: 'object',
|
|
17
|
-
additionalProperties: false,
|
|
18
|
-
required: [
|
|
19
|
-
'id',
|
|
20
|
-
'type'
|
|
21
|
-
],
|
|
22
|
-
properties: {
|
|
23
|
-
id: {
|
|
24
|
-
type: 'string'
|
|
25
|
-
},
|
|
26
|
-
required: {
|
|
27
|
-
type: [
|
|
28
|
-
'boolean',
|
|
29
|
-
'object'
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
type: {
|
|
33
|
-
type: 'string'
|
|
34
|
-
},
|
|
35
|
-
properties: {
|
|
36
|
-
type: 'object'
|
|
37
|
-
},
|
|
38
|
-
style: {
|
|
39
|
-
type: 'object'
|
|
40
|
-
},
|
|
41
|
-
layout: {
|
|
42
|
-
type: 'object'
|
|
43
|
-
},
|
|
44
|
-
blocks: {
|
|
45
|
-
type: 'array',
|
|
46
|
-
items: {
|
|
47
|
-
type: 'object'
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
events: {
|
|
51
|
-
type: 'object'
|
|
52
|
-
},
|
|
53
|
-
menus: {
|
|
54
|
-
type: 'array',
|
|
55
|
-
items: {
|
|
56
|
-
type: 'object',
|
|
57
|
-
required: [
|
|
58
|
-
'id'
|
|
59
|
-
],
|
|
60
|
-
properties: {
|
|
61
|
-
id: {
|
|
62
|
-
type: 'string',
|
|
63
|
-
description: 'Menu id.'
|
|
64
|
-
},
|
|
65
|
-
links: {
|
|
66
|
-
type: 'array',
|
|
67
|
-
items: {
|
|
68
|
-
type: 'object',
|
|
69
|
-
required: [
|
|
70
|
-
'id',
|
|
71
|
-
'type'
|
|
72
|
-
],
|
|
73
|
-
properties: {
|
|
74
|
-
id: {
|
|
75
|
-
type: 'string',
|
|
76
|
-
description: 'Menu item id.'
|
|
77
|
-
},
|
|
78
|
-
type: {
|
|
79
|
-
type: 'string',
|
|
80
|
-
enum: [
|
|
81
|
-
'MenuDivider',
|
|
82
|
-
'MenuLink',
|
|
83
|
-
'MenuGroup'
|
|
84
|
-
],
|
|
85
|
-
description: 'Menu item type.'
|
|
86
|
-
},
|
|
87
|
-
pageId: {
|
|
88
|
-
type: 'string',
|
|
89
|
-
description: 'Page to link to.'
|
|
90
|
-
},
|
|
91
|
-
style: {
|
|
92
|
-
type: 'object',
|
|
93
|
-
description: 'Css style to applied to link.'
|
|
94
|
-
},
|
|
95
|
-
properties: {
|
|
96
|
-
type: 'object',
|
|
97
|
-
description: 'properties from menu item.',
|
|
98
|
-
properties: {
|
|
99
|
-
title: {
|
|
100
|
-
type: 'string',
|
|
101
|
-
description: 'Menu item title.'
|
|
102
|
-
},
|
|
103
|
-
icon: {
|
|
104
|
-
type: [
|
|
105
|
-
'string',
|
|
106
|
-
'object'
|
|
107
|
-
],
|
|
108
|
-
description: 'Name of an React-Icon (See <a href="https://react-icons.github.io/react-icons/">all icons</a>) or properties of an Icon block to customize icon on menu item.'
|
|
109
|
-
},
|
|
110
|
-
danger: {
|
|
111
|
-
type: 'boolean',
|
|
112
|
-
description: 'Apply danger style to menu item.'
|
|
113
|
-
},
|
|
114
|
-
dashed: {
|
|
115
|
-
type: 'boolean',
|
|
116
|
-
default: false,
|
|
117
|
-
description: 'Whether the divider line is dashed.'
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
links: {
|
|
122
|
-
type: 'array',
|
|
123
|
-
items: {
|
|
124
|
-
type: 'object',
|
|
125
|
-
required: [
|
|
126
|
-
'id',
|
|
127
|
-
'type'
|
|
128
|
-
],
|
|
129
|
-
properties: {
|
|
130
|
-
id: {
|
|
131
|
-
type: 'string',
|
|
132
|
-
description: 'Menu item id.'
|
|
133
|
-
},
|
|
134
|
-
type: {
|
|
135
|
-
type: 'string',
|
|
136
|
-
enum: [
|
|
137
|
-
'MenuDivider',
|
|
138
|
-
'MenuLink',
|
|
139
|
-
'MenuGroup'
|
|
140
|
-
],
|
|
141
|
-
description: 'Menu item type.'
|
|
142
|
-
},
|
|
143
|
-
style: {
|
|
144
|
-
type: 'object',
|
|
145
|
-
description: 'Css style to applied to sub-link.'
|
|
146
|
-
},
|
|
147
|
-
pageId: {
|
|
148
|
-
type: 'string',
|
|
149
|
-
description: 'Page to link to.'
|
|
150
|
-
},
|
|
151
|
-
properties: {
|
|
152
|
-
type: 'object',
|
|
153
|
-
description: 'properties from menu item.',
|
|
154
|
-
properties: {
|
|
155
|
-
title: {
|
|
156
|
-
type: 'string',
|
|
157
|
-
description: 'Menu item title.'
|
|
158
|
-
},
|
|
159
|
-
danger: {
|
|
160
|
-
type: 'boolean',
|
|
161
|
-
description: 'Apply danger style to menu item.'
|
|
162
|
-
},
|
|
163
|
-
dashed: {
|
|
164
|
-
type: 'boolean',
|
|
165
|
-
default: false,
|
|
166
|
-
description: 'Whether the divider line is dashed.'
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
links: {
|
|
170
|
-
type: 'array',
|
|
171
|
-
items: {
|
|
172
|
-
type: 'object',
|
|
173
|
-
required: [
|
|
174
|
-
'id',
|
|
175
|
-
'type'
|
|
176
|
-
],
|
|
177
|
-
properties: {
|
|
178
|
-
id: {
|
|
179
|
-
type: 'string',
|
|
180
|
-
description: 'Menu item id.'
|
|
181
|
-
},
|
|
182
|
-
type: {
|
|
183
|
-
type: 'string',
|
|
184
|
-
enum: [
|
|
185
|
-
'MenuDivider',
|
|
186
|
-
'MenuLink'
|
|
187
|
-
],
|
|
188
|
-
description: 'Menu item type.'
|
|
189
|
-
},
|
|
190
|
-
style: {
|
|
191
|
-
type: 'object',
|
|
192
|
-
description: 'Css style to applied to sub-link.'
|
|
193
|
-
},
|
|
194
|
-
pageId: {
|
|
195
|
-
type: 'string',
|
|
196
|
-
description: 'Page to link to.'
|
|
197
|
-
},
|
|
198
|
-
properties: {
|
|
199
|
-
type: 'object',
|
|
200
|
-
description: 'properties from menu item.',
|
|
201
|
-
properties: {
|
|
202
|
-
title: {
|
|
203
|
-
type: 'string',
|
|
204
|
-
description: 'Menu item title.'
|
|
205
|
-
},
|
|
206
|
-
danger: {
|
|
207
|
-
type: 'boolean',
|
|
208
|
-
description: 'Apply danger style to menu item.'
|
|
209
|
-
},
|
|
210
|
-
dashed: {
|
|
211
|
-
type: 'boolean',
|
|
212
|
-
default: false,
|
|
213
|
-
description: 'Whether the divider line is dashed.'
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
areas: {
|
|
231
|
-
type: 'object',
|
|
232
|
-
patternProperties: {
|
|
233
|
-
'^.*$': {
|
|
234
|
-
type: 'object',
|
|
235
|
-
properties: {
|
|
236
|
-
blocks: {
|
|
237
|
-
type: 'array',
|
|
238
|
-
items: {
|
|
239
|
-
type: 'object'
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
};
|
package/dist/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import blockDefaultProps from './blockDefaultProps.js';
|
|
16
|
-
import blockSchema from './blockSchema.js';
|
|
17
|
-
import HtmlComponent from './HtmlComponent.js';
|
|
18
|
-
import makeCssClass from './makeCssClass.js';
|
|
19
|
-
import mediaToCssObject from './mediaToCssObject.js';
|
|
20
|
-
import renderHtml from './renderHtml.js';
|
|
21
|
-
export { blockDefaultProps, blockSchema, HtmlComponent, makeCssClass, mediaToCssObject, renderHtml };
|
package/dist/makeCssClass.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import { css } from '@emotion/css';
|
|
16
|
-
import { mergeObjects } from '@lowdefy/helpers';
|
|
17
|
-
import mediaToCssObject from './mediaToCssObject.js';
|
|
18
|
-
const makeCssClass = (styles, styleObjectOnly)=>styleObjectOnly ? mediaToCssObject(mergeObjects(styles), true)[0] : css(mediaToCssObject(styles));
|
|
19
|
-
export default makeCssClass;
|
package/dist/mediaToCssObject.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-undef */ /*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
-
const breakpoints = {
|
|
17
|
-
xs: 576,
|
|
18
|
-
sm: 768,
|
|
19
|
-
md: 992,
|
|
20
|
-
lg: 1200,
|
|
21
|
-
xl: 1600
|
|
22
|
-
};
|
|
23
|
-
const mediaReact = {
|
|
24
|
-
xs: `@media screen and (maxWidth: ${breakpoints.xs}px)`,
|
|
25
|
-
sm: `@media screen and (minWidth: ${breakpoints.xs}px)`,
|
|
26
|
-
md: `@media screen and (minWidth: ${breakpoints.sm}px)`,
|
|
27
|
-
lg: `@media screen and (minWidth: ${breakpoints.md}px)`,
|
|
28
|
-
xl: `@media screen and (minWidth: ${breakpoints.lg}px)`,
|
|
29
|
-
xxl: `@media screen and (minWidth: ${breakpoints.xl}px)`
|
|
30
|
-
};
|
|
31
|
-
const media = {
|
|
32
|
-
xs: `@media screen and (max-width: ${breakpoints.xs}px)`,
|
|
33
|
-
sm: `@media screen and (min-width: ${breakpoints.xs}px)`,
|
|
34
|
-
md: `@media screen and (min-width: ${breakpoints.sm}px)`,
|
|
35
|
-
lg: `@media screen and (min-width: ${breakpoints.md}px)`,
|
|
36
|
-
xl: `@media screen and (min-width: ${breakpoints.lg}px)`,
|
|
37
|
-
xxl: `@media screen and (min-width: ${breakpoints.xl}px)`
|
|
38
|
-
};
|
|
39
|
-
const mediaRegex = /@media\s+(xs|sm|md|lg|xl|xxl)\s*{/gm;
|
|
40
|
-
const setReplacer = (_, group)=>media[group] + ' {';
|
|
41
|
-
const mediaToCssObject = (styles, styleObjectOnly)=>{
|
|
42
|
-
if (type.isString(styles)) {
|
|
43
|
-
return styles.replace(mediaRegex, setReplacer);
|
|
44
|
-
}
|
|
45
|
-
let styleObjects = styles;
|
|
46
|
-
if (type.isObject(styles)) {
|
|
47
|
-
styleObjects = [
|
|
48
|
-
styles
|
|
49
|
-
];
|
|
50
|
-
}
|
|
51
|
-
if (!type.isArray(styleObjects)) {
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
return styleObjects.map((style)=>{
|
|
55
|
-
if (type.isString(style)) {
|
|
56
|
-
return style.replace(mediaRegex, setReplacer);
|
|
57
|
-
}
|
|
58
|
-
if (!type.isObject(style)) {
|
|
59
|
-
return {};
|
|
60
|
-
}
|
|
61
|
-
let mq = media;
|
|
62
|
-
if (styleObjectOnly) {
|
|
63
|
-
mq = mediaReact;
|
|
64
|
-
}
|
|
65
|
-
const { xs , sm , md , lg , xl , xxl , ...others } = style;
|
|
66
|
-
if (xs) {
|
|
67
|
-
others[mq.xs] = xs;
|
|
68
|
-
}
|
|
69
|
-
if (sm) {
|
|
70
|
-
others[mq.sm] = sm;
|
|
71
|
-
}
|
|
72
|
-
if (md) {
|
|
73
|
-
others[mq.md] = md;
|
|
74
|
-
}
|
|
75
|
-
if (lg) {
|
|
76
|
-
others[mq.lg] = lg;
|
|
77
|
-
}
|
|
78
|
-
if (xl) {
|
|
79
|
-
others[mq.xl] = xl;
|
|
80
|
-
}
|
|
81
|
-
if (xxl) {
|
|
82
|
-
others[mq.xxl] = xxl;
|
|
83
|
-
}
|
|
84
|
-
return others;
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
export default mediaToCssObject;
|
package/dist/renderHtml.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import React from 'react';
|
|
16
|
-
import { type } from '@lowdefy/helpers';
|
|
17
|
-
import HtmlComponent from './HtmlComponent.js';
|
|
18
|
-
const renderHtml = ({ div , html , id , methods , style })=>type.isNone(html) ? undefined : /*#__PURE__*/ React.createElement(HtmlComponent, {
|
|
19
|
-
div: div,
|
|
20
|
-
html: html,
|
|
21
|
-
id: id,
|
|
22
|
-
methods: methods,
|
|
23
|
-
style: style
|
|
24
|
-
});
|
|
25
|
-
export default renderHtml;
|