@webstudio-is/react-sdk 0.59.0 → 0.61.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/lib/app/custom-components/shared/remix-link.js +2 -2
- package/lib/app/index.js +0 -1
- package/lib/cjs/app/custom-components/shared/remix-link.js +2 -2
- package/lib/cjs/app/index.js +0 -1
- package/lib/cjs/components/__generated__/blockquote.props.js +5 -0
- package/lib/cjs/components/__generated__/body.props.js +5 -0
- package/lib/cjs/components/__generated__/bold.props.js +5 -0
- package/lib/cjs/components/__generated__/box.props.js +5 -0
- package/lib/cjs/components/__generated__/button.props.js +5 -1
- package/lib/cjs/components/__generated__/code.props.js +5 -0
- package/lib/cjs/components/__generated__/form.props.js +5 -0
- package/lib/cjs/components/__generated__/heading.props.js +5 -0
- package/lib/cjs/components/__generated__/image.props.js +5 -0
- package/lib/cjs/components/__generated__/input.props.js +11 -2
- package/lib/cjs/components/__generated__/italic.props.js +5 -0
- package/lib/cjs/components/__generated__/link-block.props.js +5 -1
- package/lib/cjs/components/__generated__/link.props.js +5 -1
- package/lib/cjs/components/__generated__/list-item.props.js +5 -0
- package/lib/cjs/components/__generated__/list.props.js +5 -0
- package/lib/cjs/components/__generated__/paragraph.props.js +5 -0
- package/lib/cjs/components/__generated__/rich-text-link.props.js +5 -1
- package/lib/cjs/components/__generated__/separator.props.js +5 -0
- package/lib/cjs/components/__generated__/span.props.js +5 -0
- package/lib/cjs/components/__generated__/subscript.props.js +5 -0
- package/lib/cjs/components/__generated__/superscript.props.js +5 -0
- package/lib/cjs/components/__generated__/text-block.props.js +5 -0
- package/lib/cjs/components/blockquote.ws.js +36 -48
- package/lib/cjs/components/body.ws.js +19 -24
- package/lib/cjs/components/button.ws.js +1 -1
- package/lib/cjs/components/code.ws.js +20 -28
- package/lib/cjs/components/component-meta.js +2 -1
- package/lib/cjs/components/form.ws.js +14 -7
- package/lib/cjs/components/heading.ws.js +1 -1
- package/lib/cjs/components/image.ws.js +8 -9
- package/lib/cjs/components/italic.ws.js +5 -5
- package/lib/cjs/components/link-block.ws.js +5 -5
- package/lib/cjs/components/link.js +1 -1
- package/lib/cjs/components/link.ws.js +9 -10
- package/lib/cjs/components/list-item.ws.js +1 -1
- package/lib/cjs/components/list.ws.js +22 -22
- package/lib/cjs/components/paragraph.ws.js +1 -1
- package/lib/cjs/components/separator.ws.js +20 -20
- package/lib/cjs/components/text-block.ws.js +6 -7
- package/lib/cjs/css/css.js +6 -9
- package/lib/cjs/css/normalize.js +166 -185
- package/lib/cjs/css/presets.js +14 -34
- package/lib/cjs/css/style-rules.js +17 -0
- package/lib/cjs/embed-template.js +160 -0
- package/lib/cjs/index.js +1 -0
- package/lib/components/__generated__/blockquote.props.js +5 -0
- package/lib/components/__generated__/body.props.js +5 -0
- package/lib/components/__generated__/bold.props.js +5 -0
- package/lib/components/__generated__/box.props.js +5 -0
- package/lib/components/__generated__/button.props.js +5 -1
- package/lib/components/__generated__/code.props.js +5 -0
- package/lib/components/__generated__/form.props.js +5 -0
- package/lib/components/__generated__/heading.props.js +5 -0
- package/lib/components/__generated__/image.props.js +5 -0
- package/lib/components/__generated__/input.props.js +11 -2
- package/lib/components/__generated__/italic.props.js +5 -0
- package/lib/components/__generated__/link-block.props.js +5 -1
- package/lib/components/__generated__/link.props.js +5 -1
- package/lib/components/__generated__/list-item.props.js +5 -0
- package/lib/components/__generated__/list.props.js +5 -0
- package/lib/components/__generated__/paragraph.props.js +5 -0
- package/lib/components/__generated__/rich-text-link.props.js +5 -1
- package/lib/components/__generated__/separator.props.js +5 -0
- package/lib/components/__generated__/span.props.js +5 -0
- package/lib/components/__generated__/subscript.props.js +5 -0
- package/lib/components/__generated__/superscript.props.js +5 -0
- package/lib/components/__generated__/text-block.props.js +5 -0
- package/lib/components/blockquote.ws.js +36 -48
- package/lib/components/body.ws.js +19 -24
- package/lib/components/button.ws.js +1 -1
- package/lib/components/code.ws.js +20 -28
- package/lib/components/component-meta.js +2 -1
- package/lib/components/form.ws.js +14 -7
- package/lib/components/heading.ws.js +1 -1
- package/lib/components/image.ws.js +8 -9
- package/lib/components/italic.ws.js +5 -5
- package/lib/components/link-block.ws.js +5 -5
- package/lib/components/link.js +1 -1
- package/lib/components/link.ws.js +9 -10
- package/lib/components/list-item.ws.js +1 -1
- package/lib/components/list.ws.js +22 -22
- package/lib/components/paragraph.ws.js +1 -1
- package/lib/components/separator.ws.js +20 -20
- package/lib/components/text-block.ws.js +6 -7
- package/lib/css/css.js +8 -11
- package/lib/css/normalize.js +166 -185
- package/lib/css/presets.js +14 -34
- package/lib/css/style-rules.js +17 -0
- package/lib/embed-template.js +140 -0
- package/lib/index.js +1 -0
- package/lib/types/app/index.d.ts +0 -1
- package/lib/types/components/box.stories.d.ts +2 -2
- package/lib/types/components/component-meta.d.ts +20 -5
- package/lib/types/components/components-utils.d.ts +1 -1
- package/lib/types/css/normalize.d.ts +8786 -2286
- package/lib/types/css/presets.d.ts +2 -38
- package/lib/types/css/style-rules.d.ts +11 -9
- package/lib/types/embed-template.d.ts +1725 -0
- package/lib/types/embed-template.test.d.ts +1 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +16 -19
- package/src/app/custom-components/shared/remix-link.tsx +2 -2
- package/src/app/index.ts +0 -1
- package/src/components/__generated__/blockquote.props.ts +5 -0
- package/src/components/__generated__/body.props.ts +5 -0
- package/src/components/__generated__/bold.props.ts +5 -0
- package/src/components/__generated__/box.props.ts +5 -0
- package/src/components/__generated__/button.props.ts +5 -1
- package/src/components/__generated__/code.props.ts +5 -0
- package/src/components/__generated__/form.props.ts +5 -0
- package/src/components/__generated__/heading.props.ts +5 -0
- package/src/components/__generated__/image.props.ts +5 -0
- package/src/components/__generated__/input.props.ts +11 -2
- package/src/components/__generated__/italic.props.ts +5 -0
- package/src/components/__generated__/link-block.props.ts +5 -1
- package/src/components/__generated__/link.props.ts +5 -1
- package/src/components/__generated__/list-item.props.ts +5 -0
- package/src/components/__generated__/list.props.ts +5 -0
- package/src/components/__generated__/paragraph.props.ts +5 -0
- package/src/components/__generated__/rich-text-link.props.ts +5 -1
- package/src/components/__generated__/separator.props.ts +5 -0
- package/src/components/__generated__/span.props.ts +5 -0
- package/src/components/__generated__/subscript.props.ts +5 -0
- package/src/components/__generated__/superscript.props.ts +5 -0
- package/src/components/__generated__/text-block.props.ts +5 -0
- package/src/components/blockquote.ws.tsx +42 -52
- package/src/components/body.ws.tsx +25 -32
- package/src/components/bold.ws.tsx +6 -3
- package/src/components/box.ws.ts +6 -3
- package/src/components/button.ws.tsx +7 -4
- package/src/components/code.ws.tsx +26 -32
- package/src/components/component-meta.ts +5 -3
- package/src/components/form.ws.tsx +19 -9
- package/src/components/heading.ws.tsx +7 -4
- package/src/components/image.ws.tsx +14 -12
- package/src/components/input.ws.tsx +6 -3
- package/src/components/italic.ws.tsx +11 -8
- package/src/components/link-block.ws.tsx +11 -8
- package/src/components/link.tsx +1 -1
- package/src/components/link.ws.tsx +15 -13
- package/src/components/list-item.ws.tsx +7 -4
- package/src/components/list.ws.tsx +28 -25
- package/src/components/paragraph.ws.tsx +7 -4
- package/src/components/separator.ws.tsx +26 -25
- package/src/components/span.ws.tsx +6 -3
- package/src/components/subscript.ws.tsx +6 -3
- package/src/components/superscript.ws.tsx +6 -3
- package/src/components/text-block.ws.tsx +12 -11
- package/src/css/css.ts +8 -11
- package/src/css/normalize.ts +165 -188
- package/src/css/presets.ts +15 -37
- package/src/css/style-rules.ts +24 -0
- package/src/embed-template.test.ts +210 -0
- package/src/embed-template.ts +187 -0
- package/src/index.ts +1 -0
- package/lib/app/handle-request.server.js +0 -16
- package/lib/cjs/app/handle-request.server.js +0 -36
- package/lib/types/app/handle-request.server.d.ts +0 -2
- package/src/app/handle-request.server.tsx +0 -21
|
@@ -26,33 +26,33 @@ var import_icons = require("@webstudio-is/icons");
|
|
|
26
26
|
var import_separator = require("./__generated__/separator.props");
|
|
27
27
|
var import_normalize = require("../css/normalize");
|
|
28
28
|
const presetStyle = {
|
|
29
|
-
hr:
|
|
29
|
+
hr: [
|
|
30
30
|
...import_normalize.hr,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
value: "1px"
|
|
31
|
+
{
|
|
32
|
+
property: "height",
|
|
33
|
+
value: { type: "keyword", value: "1px" }
|
|
34
34
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
value: "gray"
|
|
35
|
+
{
|
|
36
|
+
property: "backgroundColor",
|
|
37
|
+
value: { type: "keyword", value: "gray" }
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
value: "none"
|
|
39
|
+
{
|
|
40
|
+
property: "borderTopStyle",
|
|
41
|
+
value: { type: "keyword", value: "none" }
|
|
42
42
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
value: "none"
|
|
43
|
+
{
|
|
44
|
+
property: "borderRightStyle",
|
|
45
|
+
value: { type: "keyword", value: "none" }
|
|
46
46
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
value: "none"
|
|
47
|
+
{
|
|
48
|
+
property: "borderLeftStyle",
|
|
49
|
+
value: { type: "keyword", value: "none" }
|
|
50
50
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
value: "none"
|
|
51
|
+
{
|
|
52
|
+
property: "borderBottomStyle",
|
|
53
|
+
value: { type: "keyword", value: "none" }
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
]
|
|
56
56
|
};
|
|
57
57
|
const meta = {
|
|
58
58
|
category: "general",
|
|
@@ -26,14 +26,13 @@ var import_icons = require("@webstudio-is/icons");
|
|
|
26
26
|
var import_text_block = require("./__generated__/text-block.props");
|
|
27
27
|
var import_normalize = require("../css/normalize");
|
|
28
28
|
const presetStyle = {
|
|
29
|
-
div:
|
|
29
|
+
div: [
|
|
30
30
|
...import_normalize.div,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
unit: "em",
|
|
34
|
-
value: 1
|
|
31
|
+
{
|
|
32
|
+
property: "minHeight",
|
|
33
|
+
value: { type: "unit", unit: "em", value: 1 }
|
|
35
34
|
}
|
|
36
|
-
|
|
35
|
+
]
|
|
37
36
|
};
|
|
38
37
|
const meta = {
|
|
39
38
|
category: "typography",
|
|
@@ -41,7 +40,7 @@ const meta = {
|
|
|
41
40
|
label: "Text Block",
|
|
42
41
|
Icon: import_icons.TextBlockIcon,
|
|
43
42
|
presetStyle,
|
|
44
|
-
children: ["Block of text you can edit"]
|
|
43
|
+
children: [{ type: "text", value: "Block of text you can edit" }]
|
|
45
44
|
};
|
|
46
45
|
const propsMeta = {
|
|
47
46
|
props: import_text_block.props
|
package/lib/cjs/css/css.js
CHANGED
|
@@ -64,15 +64,12 @@ const generateCssText = (data, options) => {
|
|
|
64
64
|
for (const component of (0, import_components_utils.getComponentNames)()) {
|
|
65
65
|
const meta = (0, import_components.getComponentMeta)(component);
|
|
66
66
|
const presetStyle = meta?.presetStyle;
|
|
67
|
-
if (presetStyle
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
67
|
+
if (presetStyle === void 0) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const rules = (0, import_style_rules.getPresetStyleRules)(component, presetStyle);
|
|
71
|
+
for (const [selector, style] of rules) {
|
|
72
|
+
engine.addStyleRule(selector, { style });
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
const styleRules = (0, import_style_rules.getStyleRules)(styles, styleSourceSelections);
|
package/lib/cjs/css/normalize.js
CHANGED
|
@@ -68,13 +68,10 @@ __export(normalize_exports, {
|
|
|
68
68
|
module.exports = __toCommonJS(normalize_exports);
|
|
69
69
|
var import_presets = require("./presets");
|
|
70
70
|
const boxSizing = {
|
|
71
|
-
|
|
72
|
-
value: "border-box"
|
|
73
|
-
};
|
|
74
|
-
const baseStyle = {
|
|
75
|
-
boxSizing,
|
|
76
|
-
...import_presets.borders
|
|
71
|
+
property: "boxSizing",
|
|
72
|
+
value: { type: "keyword", value: "border-box" }
|
|
77
73
|
};
|
|
74
|
+
const baseStyle = [boxSizing, ...import_presets.borders];
|
|
78
75
|
const div = baseStyle;
|
|
79
76
|
const address = baseStyle;
|
|
80
77
|
const article = baseStyle;
|
|
@@ -100,259 +97,243 @@ const ul = baseStyle;
|
|
|
100
97
|
const ol = baseStyle;
|
|
101
98
|
const p = baseStyle;
|
|
102
99
|
const span = baseStyle;
|
|
103
|
-
const html =
|
|
100
|
+
const html = [
|
|
104
101
|
/* 1 */
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
value: 1.15,
|
|
108
|
-
unit: "number"
|
|
102
|
+
{
|
|
103
|
+
property: "lineHeight",
|
|
104
|
+
value: { type: "unit", value: 1.15, unit: "number" }
|
|
109
105
|
},
|
|
110
106
|
/* 2 */
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
value: 100,
|
|
114
|
-
unit: "%"
|
|
107
|
+
{
|
|
108
|
+
property: "textSizeAdjust",
|
|
109
|
+
value: { type: "unit", value: 100, unit: "%" }
|
|
115
110
|
},
|
|
116
111
|
/* 3 */
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
value: 4,
|
|
120
|
-
unit: "number"
|
|
112
|
+
{
|
|
113
|
+
property: "tabSize",
|
|
114
|
+
value: { type: "unit", value: 4, unit: "number" }
|
|
121
115
|
},
|
|
122
116
|
boxSizing,
|
|
123
117
|
...import_presets.borders
|
|
124
|
-
|
|
125
|
-
const body =
|
|
118
|
+
];
|
|
119
|
+
const body = [
|
|
126
120
|
/* 1 */
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
value: 0,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
type: "unit",
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
marginLeft: {
|
|
143
|
-
type: "unit",
|
|
144
|
-
value: 0,
|
|
145
|
-
unit: "number"
|
|
121
|
+
{
|
|
122
|
+
property: "marginTop",
|
|
123
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
property: "marginRight",
|
|
127
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
property: "marginBottom",
|
|
131
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
property: "marginLeft",
|
|
135
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
146
136
|
},
|
|
147
137
|
/* 2 */
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
value:
|
|
138
|
+
{
|
|
139
|
+
property: "fontFamily",
|
|
140
|
+
value: {
|
|
141
|
+
type: "keyword",
|
|
142
|
+
value: `system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'`
|
|
143
|
+
}
|
|
151
144
|
},
|
|
152
145
|
boxSizing,
|
|
153
146
|
...import_presets.borders
|
|
154
|
-
|
|
155
|
-
const hr =
|
|
147
|
+
];
|
|
148
|
+
const hr = [
|
|
156
149
|
/* 1 */
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
value: 0,
|
|
160
|
-
unit: "number"
|
|
150
|
+
{
|
|
151
|
+
property: "height",
|
|
152
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
161
153
|
},
|
|
162
154
|
/* 2 */
|
|
163
|
-
|
|
155
|
+
{
|
|
156
|
+
property: "color",
|
|
157
|
+
value: { type: "keyword", value: "inherit" }
|
|
158
|
+
},
|
|
164
159
|
boxSizing,
|
|
165
160
|
...import_presets.borders
|
|
166
|
-
|
|
167
|
-
const b =
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
value: "
|
|
161
|
+
];
|
|
162
|
+
const b = [
|
|
163
|
+
{
|
|
164
|
+
property: "fontWeight",
|
|
165
|
+
value: { type: "keyword", value: "700" }
|
|
171
166
|
},
|
|
172
167
|
boxSizing,
|
|
173
168
|
...import_presets.borders
|
|
174
|
-
|
|
169
|
+
];
|
|
175
170
|
const strong = b;
|
|
176
|
-
const code =
|
|
171
|
+
const code = [
|
|
177
172
|
/* 1 */
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
value:
|
|
173
|
+
{
|
|
174
|
+
property: "fontFamily",
|
|
175
|
+
value: {
|
|
176
|
+
type: "keyword",
|
|
177
|
+
value: `ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace`
|
|
178
|
+
}
|
|
181
179
|
},
|
|
182
180
|
/* 2 */
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
value: 1,
|
|
186
|
-
unit: "em"
|
|
181
|
+
{
|
|
182
|
+
property: "fontSize",
|
|
183
|
+
value: { type: "unit", value: 1, unit: "em" }
|
|
187
184
|
},
|
|
188
185
|
boxSizing,
|
|
189
186
|
...import_presets.borders
|
|
190
|
-
|
|
187
|
+
];
|
|
191
188
|
const kbd = code;
|
|
192
189
|
const samp = code;
|
|
193
190
|
const pre = code;
|
|
194
|
-
const small =
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
value: 80,
|
|
198
|
-
unit: "%"
|
|
191
|
+
const small = [
|
|
192
|
+
{
|
|
193
|
+
property: "fontSize",
|
|
194
|
+
value: { type: "unit", value: 80, unit: "%" }
|
|
199
195
|
},
|
|
200
196
|
boxSizing,
|
|
201
197
|
...import_presets.borders
|
|
202
|
-
|
|
203
|
-
const subSupBase =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
value: 75,
|
|
207
|
-
unit: "%"
|
|
198
|
+
];
|
|
199
|
+
const subSupBase = [
|
|
200
|
+
{
|
|
201
|
+
property: "fontSize",
|
|
202
|
+
value: { type: "unit", value: 75, unit: "%" }
|
|
208
203
|
},
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
value: 0,
|
|
212
|
-
unit: "number"
|
|
204
|
+
{
|
|
205
|
+
property: "lineHeight",
|
|
206
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
213
207
|
},
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
value: "relative"
|
|
208
|
+
{
|
|
209
|
+
property: "position",
|
|
210
|
+
value: { type: "keyword", value: "relative" }
|
|
217
211
|
},
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
value: "baseline"
|
|
212
|
+
{
|
|
213
|
+
property: "verticalAlign",
|
|
214
|
+
value: { type: "keyword", value: "baseline" }
|
|
221
215
|
},
|
|
222
216
|
boxSizing,
|
|
223
217
|
...import_presets.borders
|
|
224
|
-
|
|
225
|
-
const sub =
|
|
218
|
+
];
|
|
219
|
+
const sub = [
|
|
226
220
|
...subSupBase,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
value: -0.25,
|
|
230
|
-
unit: "em"
|
|
221
|
+
{
|
|
222
|
+
property: "bottom",
|
|
223
|
+
value: { type: "unit", value: -0.25, unit: "em" }
|
|
231
224
|
}
|
|
232
|
-
|
|
233
|
-
const sup =
|
|
225
|
+
];
|
|
226
|
+
const sup = [
|
|
234
227
|
...subSupBase,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
value: -0.5,
|
|
238
|
-
unit: "em"
|
|
228
|
+
{
|
|
229
|
+
property: "top",
|
|
230
|
+
value: { type: "unit", value: -0.5, unit: "em" }
|
|
239
231
|
}
|
|
240
|
-
|
|
241
|
-
const table =
|
|
232
|
+
];
|
|
233
|
+
const table = [
|
|
242
234
|
/* 1 */
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
value: 0,
|
|
246
|
-
unit: "number"
|
|
235
|
+
{
|
|
236
|
+
property: "textIndent",
|
|
237
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
247
238
|
},
|
|
248
239
|
...import_presets.borders,
|
|
249
240
|
/* 2 */
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
value: "inherit"
|
|
241
|
+
{
|
|
242
|
+
property: "borderTopColor",
|
|
243
|
+
value: { type: "keyword", value: "inherit" }
|
|
253
244
|
},
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
value: "inherit"
|
|
245
|
+
{
|
|
246
|
+
property: "borderRightColor",
|
|
247
|
+
value: { type: "keyword", value: "inherit" }
|
|
257
248
|
},
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
value: "inherit"
|
|
249
|
+
{
|
|
250
|
+
property: "borderBottomColor",
|
|
251
|
+
value: { type: "keyword", value: "inherit" }
|
|
261
252
|
},
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
value: "inherit"
|
|
253
|
+
{
|
|
254
|
+
property: "borderLeftColor",
|
|
255
|
+
value: { type: "keyword", value: "inherit" }
|
|
265
256
|
},
|
|
266
257
|
boxSizing
|
|
267
|
-
|
|
268
|
-
const buttonBase =
|
|
258
|
+
];
|
|
259
|
+
const buttonBase = [
|
|
269
260
|
/* 1 */
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
value: "inherit"
|
|
261
|
+
{
|
|
262
|
+
property: "fontFamily",
|
|
263
|
+
value: { type: "keyword", value: "inherit" }
|
|
273
264
|
},
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
value: 100,
|
|
277
|
-
unit: "%"
|
|
265
|
+
{
|
|
266
|
+
property: "fontSize",
|
|
267
|
+
value: { type: "unit", value: 100, unit: "%" }
|
|
278
268
|
},
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
value: 1.15,
|
|
282
|
-
unit: "number"
|
|
269
|
+
{
|
|
270
|
+
property: "lineHeight",
|
|
271
|
+
value: { type: "unit", value: 1.15, unit: "number" }
|
|
283
272
|
},
|
|
284
273
|
/* 2 */
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
value: 0,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
type: "unit",
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
marginLeft: {
|
|
301
|
-
type: "unit",
|
|
302
|
-
value: 0,
|
|
303
|
-
unit: "number"
|
|
274
|
+
{
|
|
275
|
+
property: "marginTop",
|
|
276
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
property: "marginRight",
|
|
280
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
property: "marginBottom",
|
|
284
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
property: "marginLeft",
|
|
288
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
304
289
|
},
|
|
305
290
|
boxSizing,
|
|
306
291
|
...import_presets.borders
|
|
307
|
-
|
|
292
|
+
];
|
|
308
293
|
const input = buttonBase;
|
|
309
294
|
const optgroup = buttonBase;
|
|
310
295
|
const textarea = buttonBase;
|
|
311
|
-
const button =
|
|
296
|
+
const button = [
|
|
312
297
|
...buttonBase,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
value: "none"
|
|
298
|
+
{
|
|
299
|
+
property: "textTransform",
|
|
300
|
+
value: { type: "keyword", value: "none" }
|
|
316
301
|
}
|
|
317
|
-
|
|
302
|
+
];
|
|
318
303
|
const select = button;
|
|
319
|
-
const legend =
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
value: 0,
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
type: "unit",
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
paddingLeft: {
|
|
336
|
-
type: "unit",
|
|
337
|
-
value: 0,
|
|
338
|
-
unit: "number"
|
|
304
|
+
const legend = [
|
|
305
|
+
{
|
|
306
|
+
property: "paddingTop",
|
|
307
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
property: "paddingRight",
|
|
311
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
property: "paddingBottom",
|
|
315
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
property: "paddingLeft",
|
|
319
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
339
320
|
},
|
|
340
321
|
boxSizing,
|
|
341
322
|
...import_presets.borders
|
|
342
|
-
|
|
343
|
-
const progress =
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
value: "baseline"
|
|
323
|
+
];
|
|
324
|
+
const progress = [
|
|
325
|
+
{
|
|
326
|
+
property: "verticalAlign",
|
|
327
|
+
value: { type: "keyword", value: "baseline" }
|
|
347
328
|
},
|
|
348
329
|
boxSizing,
|
|
349
330
|
...import_presets.borders
|
|
350
|
-
|
|
351
|
-
const summary =
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
value: "list-item"
|
|
331
|
+
];
|
|
332
|
+
const summary = [
|
|
333
|
+
{
|
|
334
|
+
property: "display",
|
|
335
|
+
value: { type: "keyword", value: "list-item" }
|
|
355
336
|
},
|
|
356
337
|
boxSizing,
|
|
357
338
|
...import_presets.borders
|
|
358
|
-
|
|
339
|
+
];
|
package/lib/cjs/css/presets.js
CHANGED
|
@@ -21,41 +21,21 @@ __export(presets_exports, {
|
|
|
21
21
|
borders: () => borders
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(presets_exports);
|
|
24
|
-
const borders =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
value: "
|
|
24
|
+
const borders = [
|
|
25
|
+
{
|
|
26
|
+
property: "borderTopWidth",
|
|
27
|
+
value: { type: "unit", value: 1, unit: "px" }
|
|
28
28
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
value: "
|
|
29
|
+
{
|
|
30
|
+
property: "borderRightWidth",
|
|
31
|
+
value: { type: "unit", value: 1, unit: "px" }
|
|
32
32
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
value: "
|
|
33
|
+
{
|
|
34
|
+
property: "borderBottomWidth",
|
|
35
|
+
value: { type: "unit", value: 1, unit: "px" }
|
|
36
36
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
value: "
|
|
40
|
-
},
|
|
41
|
-
borderTopWidth: {
|
|
42
|
-
type: "unit",
|
|
43
|
-
value: 1,
|
|
44
|
-
unit: "px"
|
|
45
|
-
},
|
|
46
|
-
borderRightWidth: {
|
|
47
|
-
type: "unit",
|
|
48
|
-
value: 1,
|
|
49
|
-
unit: "px"
|
|
50
|
-
},
|
|
51
|
-
borderBottomWidth: {
|
|
52
|
-
type: "unit",
|
|
53
|
-
value: 1,
|
|
54
|
-
unit: "px"
|
|
55
|
-
},
|
|
56
|
-
borderLeftWidth: {
|
|
57
|
-
type: "unit",
|
|
58
|
-
value: 1,
|
|
59
|
-
unit: "px"
|
|
37
|
+
{
|
|
38
|
+
property: "borderLeftWidth",
|
|
39
|
+
value: { type: "unit", value: 1, unit: "px" }
|
|
60
40
|
}
|
|
61
|
-
|
|
41
|
+
];
|
|
@@ -18,9 +18,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var style_rules_exports = {};
|
|
20
20
|
__export(style_rules_exports, {
|
|
21
|
+
getPresetStyleRules: () => getPresetStyleRules,
|
|
21
22
|
getStyleRules: () => getStyleRules
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(style_rules_exports);
|
|
25
|
+
var import_tree = require("../tree");
|
|
24
26
|
const getStyleRules = (styles, styleSourceSelections) => {
|
|
25
27
|
if (styles === void 0 || styleSourceSelections === void 0) {
|
|
26
28
|
return [];
|
|
@@ -67,3 +69,18 @@ const getStyleRules = (styles, styleSourceSelections) => {
|
|
|
67
69
|
}
|
|
68
70
|
return styleRules;
|
|
69
71
|
};
|
|
72
|
+
const getPresetStyleRules = (component, presetStyle) => {
|
|
73
|
+
const presetStyleRules = /* @__PURE__ */ new Map();
|
|
74
|
+
for (const [tag, styles] of Object.entries(presetStyle)) {
|
|
75
|
+
for (const styleDecl of styles) {
|
|
76
|
+
const selector = `${tag}:where([${import_tree.componentAttribute}=${component}])${styleDecl.state ?? ""}`;
|
|
77
|
+
let rule = presetStyleRules.get(selector);
|
|
78
|
+
if (rule === void 0) {
|
|
79
|
+
rule = {};
|
|
80
|
+
presetStyleRules.set(selector, rule);
|
|
81
|
+
}
|
|
82
|
+
rule[styleDecl.property] = styleDecl.value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return presetStyleRules;
|
|
86
|
+
};
|