@webstudio-is/react-sdk 0.62.0 → 0.63.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/cjs/components/blockquote.ws.js +2 -0
- package/lib/cjs/components/body.ws.js +2 -0
- package/lib/cjs/components/bold.ws.js +2 -0
- package/lib/cjs/components/box.ws.js +2 -0
- package/lib/cjs/components/button.ws.js +2 -1
- package/lib/cjs/components/checkbox-field.ws.js +2 -0
- package/lib/cjs/components/checkbox.ws.js +2 -0
- package/lib/cjs/components/code.ws.js +2 -0
- package/lib/cjs/components/component-meta.js +12 -1
- package/lib/cjs/components/form.ws.js +2 -0
- package/lib/cjs/components/heading.ws.js +2 -0
- package/lib/cjs/components/image.ws.js +2 -0
- package/lib/cjs/components/input.ws.js +2 -0
- package/lib/cjs/components/italic.ws.js +2 -0
- package/lib/cjs/components/label.ws.js +2 -0
- package/lib/cjs/components/link.ws.js +13 -1
- package/lib/cjs/components/list-item.ws.js +2 -0
- package/lib/cjs/components/list.ws.js +2 -0
- package/lib/cjs/components/paragraph.ws.js +2 -0
- package/lib/cjs/components/radio-button-field.ws.js +2 -0
- package/lib/cjs/components/radio-button.ws.js +2 -0
- package/lib/cjs/components/separator.ws.js +2 -0
- package/lib/cjs/components/span.ws.js +2 -0
- package/lib/cjs/components/subscript.ws.js +2 -0
- package/lib/cjs/components/superscript.ws.js +2 -0
- package/lib/cjs/components/text-block.ws.js +2 -0
- package/lib/cjs/components/textarea.ws.js +2 -0
- package/lib/cjs/css/normalize.js +1 -1
- package/lib/cjs/css/presets.js +19 -1
- package/lib/cjs/index.js +2 -1
- package/lib/components/blockquote.ws.js +4 -0
- package/lib/components/body.ws.js +4 -0
- package/lib/components/bold.ws.js +4 -0
- package/lib/components/box.ws.js +4 -0
- package/lib/components/button.ws.js +4 -1
- package/lib/components/checkbox-field.ws.js +4 -0
- package/lib/components/checkbox.ws.js +4 -0
- package/lib/components/code.ws.js +4 -0
- package/lib/components/component-meta.js +12 -1
- package/lib/components/form.ws.js +4 -0
- package/lib/components/heading.ws.js +4 -0
- package/lib/components/image.ws.js +4 -0
- package/lib/components/input.ws.js +4 -0
- package/lib/components/italic.ws.js +4 -0
- package/lib/components/label.ws.js +4 -0
- package/lib/components/link.ws.js +15 -1
- package/lib/components/list-item.ws.js +4 -0
- package/lib/components/list.ws.js +4 -0
- package/lib/components/paragraph.ws.js +4 -0
- package/lib/components/radio-button-field.ws.js +4 -0
- package/lib/components/radio-button.ws.js +4 -0
- package/lib/components/separator.ws.js +4 -0
- package/lib/components/span.ws.js +4 -0
- package/lib/components/subscript.ws.js +4 -0
- package/lib/components/superscript.ws.js +4 -0
- package/lib/components/text-block.ws.js +4 -0
- package/lib/components/textarea.ws.js +4 -0
- package/lib/css/normalize.js +2 -2
- package/lib/css/presets.js +19 -1
- package/lib/index.js +4 -2
- package/lib/types/components/blockquote.ws.d.ts +1 -1
- package/lib/types/components/body.ws.d.ts +1 -1
- package/lib/types/components/bold.ws.d.ts +1 -1
- package/lib/types/components/box.ws.d.ts +1 -1
- package/lib/types/components/button.ws.d.ts +1 -1
- package/lib/types/components/checkbox-field.ws.d.ts +1 -1
- package/lib/types/components/checkbox.ws.d.ts +1 -1
- package/lib/types/components/code.ws.d.ts +1 -1
- package/lib/types/components/component-meta.d.ts +16 -6
- package/lib/types/components/form.ws.d.ts +1 -1
- package/lib/types/components/heading.ws.d.ts +1 -1
- package/lib/types/components/image.ws.d.ts +1 -1
- package/lib/types/components/input.ws.d.ts +1 -1
- package/lib/types/components/italic.ws.d.ts +1 -1
- package/lib/types/components/label.ws.d.ts +1 -1
- package/lib/types/components/link.ws.d.ts +1 -1
- package/lib/types/components/list-item.ws.d.ts +1 -1
- package/lib/types/components/list.ws.d.ts +1 -1
- package/lib/types/components/paragraph.ws.d.ts +1 -1
- package/lib/types/components/radio-button-field.ws.d.ts +1 -1
- package/lib/types/components/radio-button.ws.d.ts +1 -1
- package/lib/types/components/separator.ws.d.ts +1 -1
- package/lib/types/components/span.ws.d.ts +1 -1
- package/lib/types/components/subscript.ws.d.ts +1 -1
- package/lib/types/components/superscript.ws.d.ts +1 -1
- package/lib/types/components/text-block.ws.d.ts +1 -1
- package/lib/types/components/textarea.ws.d.ts +1 -1
- package/lib/types/css/normalize.d.ts +2 -0
- package/lib/types/css/presets.d.ts +3 -2
- package/lib/types/index.d.ts +1 -1
- package/package.json +11 -11
- package/src/components/blockquote.ws.tsx +6 -4
- package/src/components/body.ws.tsx +6 -4
- package/src/components/bold.ws.tsx +6 -4
- package/src/components/box.ws.ts +6 -4
- package/src/components/button.ws.tsx +6 -5
- package/src/components/checkbox-field.ws.tsx +6 -4
- package/src/components/checkbox.ws.tsx +6 -4
- package/src/components/code.ws.tsx +6 -4
- package/src/components/component-meta.ts +11 -0
- package/src/components/form.ws.tsx +6 -4
- package/src/components/heading.ws.tsx +6 -4
- package/src/components/image.ws.tsx +6 -4
- package/src/components/input.ws.tsx +6 -4
- package/src/components/italic.ws.tsx +6 -4
- package/src/components/label.ws.tsx +6 -4
- package/src/components/link.ws.tsx +17 -5
- package/src/components/list-item.ws.tsx +6 -4
- package/src/components/list.ws.tsx +6 -4
- package/src/components/paragraph.ws.tsx +6 -4
- package/src/components/radio-button-field.ws.tsx +6 -4
- package/src/components/radio-button.ws.tsx +6 -4
- package/src/components/separator.ws.tsx +6 -4
- package/src/components/span.ws.tsx +6 -4
- package/src/components/subscript.ws.tsx +6 -4
- package/src/components/superscript.ws.tsx +6 -4
- package/src/components/text-block.ws.tsx +6 -4
- package/src/components/textarea.ws.tsx +6 -4
- package/src/css/normalize.ts +20 -18
- package/src/css/presets.ts +20 -2
- package/src/index.ts +1 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SuperscriptIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { sup } from "../css/normalize";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import {
|
|
4
|
+
defaultStates,
|
|
5
|
+
type PresetStyle,
|
|
6
|
+
type WsComponentMeta,
|
|
7
|
+
type WsComponentPropsMeta,
|
|
7
8
|
} from "./component-meta";
|
|
8
9
|
import type { defaultTag } from "./superscript";
|
|
9
10
|
import { props } from "./__generated__/superscript.props";
|
|
@@ -16,6 +17,7 @@ export const meta: WsComponentMeta = {
|
|
|
16
17
|
type: "rich-text-child",
|
|
17
18
|
label: "Superscript Text",
|
|
18
19
|
Icon: SuperscriptIcon,
|
|
20
|
+
states: defaultStates,
|
|
19
21
|
presetStyle,
|
|
20
22
|
};
|
|
21
23
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TextBlockIcon } from "@webstudio-is/icons";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import {
|
|
3
|
+
defaultStates,
|
|
4
|
+
type PresetStyle,
|
|
5
|
+
type WsComponentMeta,
|
|
6
|
+
type WsComponentPropsMeta,
|
|
6
7
|
} from "./component-meta";
|
|
7
8
|
import { props } from "./__generated__/text-block.props";
|
|
8
9
|
import type { defaultTag } from "./text-block";
|
|
@@ -23,6 +24,7 @@ export const meta: WsComponentMeta = {
|
|
|
23
24
|
type: "rich-text",
|
|
24
25
|
label: "Text Block",
|
|
25
26
|
Icon: TextBlockIcon,
|
|
27
|
+
states: defaultStates,
|
|
26
28
|
presetStyle,
|
|
27
29
|
children: [{ type: "text", value: "Block of text you can edit" }],
|
|
28
30
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FormTextAreaIcon } from "@webstudio-is/icons";
|
|
2
2
|
import { textarea } from "../css/normalize";
|
|
3
|
-
import
|
|
4
|
-
WsComponentMeta,
|
|
5
|
-
WsComponentPropsMeta,
|
|
6
|
-
PresetStyle,
|
|
3
|
+
import {
|
|
4
|
+
type WsComponentMeta,
|
|
5
|
+
type WsComponentPropsMeta,
|
|
6
|
+
type PresetStyle,
|
|
7
|
+
defaultStates,
|
|
7
8
|
} from "./component-meta";
|
|
8
9
|
import type { defaultTag } from "./textarea";
|
|
9
10
|
import { props } from "./__generated__/textarea.props";
|
|
@@ -23,6 +24,7 @@ export const meta: WsComponentMeta = {
|
|
|
23
24
|
Icon: FormTextAreaIcon,
|
|
24
25
|
presetStyle,
|
|
25
26
|
states: [
|
|
27
|
+
...defaultStates,
|
|
26
28
|
{ selector: "::placeholder", label: "Placeholder" },
|
|
27
29
|
{ selector: ":valid", label: "Valid" },
|
|
28
30
|
{ selector: ":invalid", label: "Invalid" },
|
package/src/css/normalize.ts
CHANGED
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
// webstudio custom opinionated presets
|
|
19
|
-
import { borders } from "./presets";
|
|
19
|
+
import { borders, linkColors } from "./presets";
|
|
20
20
|
import type { EmbedTemplateStyleDecl } from "../embed-template";
|
|
21
21
|
|
|
22
|
+
export type Styles = EmbedTemplateStyleDecl[];
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
Use a better box model (opinionated).
|
|
24
26
|
*/
|
|
@@ -35,7 +37,7 @@ const boxSizing = {
|
|
|
35
37
|
* box-sizing: border-box;
|
|
36
38
|
}
|
|
37
39
|
*/
|
|
38
|
-
const baseStyle = [boxSizing, ...borders] satisfies
|
|
40
|
+
const baseStyle = [boxSizing, ...borders] satisfies Styles;
|
|
39
41
|
|
|
40
42
|
export const div = baseStyle;
|
|
41
43
|
export const address = baseStyle;
|
|
@@ -61,7 +63,7 @@ export const i = baseStyle;
|
|
|
61
63
|
|
|
62
64
|
export const img = baseStyle;
|
|
63
65
|
|
|
64
|
-
export const a =
|
|
66
|
+
export const a = [boxSizing, ...borders, ...linkColors];
|
|
65
67
|
export const li = baseStyle;
|
|
66
68
|
export const ul = baseStyle;
|
|
67
69
|
export const ol = baseStyle;
|
|
@@ -93,7 +95,7 @@ export const html = [
|
|
|
93
95
|
},
|
|
94
96
|
boxSizing,
|
|
95
97
|
...borders,
|
|
96
|
-
] satisfies
|
|
98
|
+
] satisfies Styles;
|
|
97
99
|
|
|
98
100
|
/**
|
|
99
101
|
1. Remove the margin in all browsers.
|
|
@@ -127,7 +129,7 @@ export const body = [
|
|
|
127
129
|
},
|
|
128
130
|
boxSizing,
|
|
129
131
|
...borders,
|
|
130
|
-
] satisfies
|
|
132
|
+
] satisfies Styles;
|
|
131
133
|
|
|
132
134
|
/**
|
|
133
135
|
1. Add the correct height in Firefox.
|
|
@@ -146,7 +148,7 @@ export const hr = [
|
|
|
146
148
|
},
|
|
147
149
|
boxSizing,
|
|
148
150
|
...borders,
|
|
149
|
-
] satisfies
|
|
151
|
+
] satisfies Styles;
|
|
150
152
|
|
|
151
153
|
/**
|
|
152
154
|
Add the correct text decoration in Chrome, Edge, and Safari.
|
|
@@ -168,7 +170,7 @@ export const b = [
|
|
|
168
170
|
},
|
|
169
171
|
boxSizing,
|
|
170
172
|
...borders,
|
|
171
|
-
] satisfies
|
|
173
|
+
] satisfies Styles;
|
|
172
174
|
export const strong = b;
|
|
173
175
|
|
|
174
176
|
/**
|
|
@@ -191,7 +193,7 @@ export const code = [
|
|
|
191
193
|
},
|
|
192
194
|
boxSizing,
|
|
193
195
|
...borders,
|
|
194
|
-
] satisfies
|
|
196
|
+
] satisfies Styles;
|
|
195
197
|
|
|
196
198
|
export const kbd = code;
|
|
197
199
|
export const samp = code;
|
|
@@ -208,7 +210,7 @@ export const small = [
|
|
|
208
210
|
},
|
|
209
211
|
boxSizing,
|
|
210
212
|
...borders,
|
|
211
|
-
] satisfies
|
|
213
|
+
] satisfies Styles;
|
|
212
214
|
|
|
213
215
|
/**
|
|
214
216
|
Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.
|
|
@@ -233,7 +235,7 @@ const subSupBase = [
|
|
|
233
235
|
},
|
|
234
236
|
boxSizing,
|
|
235
237
|
...borders,
|
|
236
|
-
] satisfies
|
|
238
|
+
] satisfies Styles;
|
|
237
239
|
|
|
238
240
|
export const sub = [
|
|
239
241
|
...subSupBase,
|
|
@@ -241,7 +243,7 @@ export const sub = [
|
|
|
241
243
|
property: "bottom",
|
|
242
244
|
value: { type: "unit", value: -0.25, unit: "em" },
|
|
243
245
|
},
|
|
244
|
-
] satisfies
|
|
246
|
+
] satisfies Styles;
|
|
245
247
|
|
|
246
248
|
export const sup = [
|
|
247
249
|
...subSupBase,
|
|
@@ -249,7 +251,7 @@ export const sup = [
|
|
|
249
251
|
property: "top",
|
|
250
252
|
value: { type: "unit", value: -0.5, unit: "em" },
|
|
251
253
|
},
|
|
252
|
-
] satisfies
|
|
254
|
+
] satisfies Styles;
|
|
253
255
|
|
|
254
256
|
/*
|
|
255
257
|
Tabular data
|
|
@@ -286,7 +288,7 @@ export const table = [
|
|
|
286
288
|
value: { type: "keyword", value: "inherit" },
|
|
287
289
|
},
|
|
288
290
|
boxSizing,
|
|
289
|
-
] satisfies
|
|
291
|
+
] satisfies Styles;
|
|
290
292
|
|
|
291
293
|
/*
|
|
292
294
|
Forms
|
|
@@ -331,7 +333,7 @@ const buttonBase = [
|
|
|
331
333
|
},
|
|
332
334
|
boxSizing,
|
|
333
335
|
...borders,
|
|
334
|
-
] satisfies
|
|
336
|
+
] satisfies Styles;
|
|
335
337
|
|
|
336
338
|
export const input = buttonBase;
|
|
337
339
|
export const optgroup = buttonBase;
|
|
@@ -346,7 +348,7 @@ export const button = [
|
|
|
346
348
|
property: "textTransform",
|
|
347
349
|
value: { type: "keyword", value: "none" },
|
|
348
350
|
},
|
|
349
|
-
] satisfies
|
|
351
|
+
] satisfies Styles;
|
|
350
352
|
|
|
351
353
|
export const select = button;
|
|
352
354
|
|
|
@@ -418,7 +420,7 @@ export const legend = [
|
|
|
418
420
|
},
|
|
419
421
|
boxSizing,
|
|
420
422
|
...borders,
|
|
421
|
-
] satisfies
|
|
423
|
+
] satisfies Styles;
|
|
422
424
|
|
|
423
425
|
/**
|
|
424
426
|
Add the correct vertical alignment in Chrome and Firefox.
|
|
@@ -431,7 +433,7 @@ export const progress = [
|
|
|
431
433
|
},
|
|
432
434
|
boxSizing,
|
|
433
435
|
...borders,
|
|
434
|
-
] satisfies
|
|
436
|
+
] satisfies Styles;
|
|
435
437
|
|
|
436
438
|
/**
|
|
437
439
|
Correct the cursor style of increment and decrement buttons in Safari.
|
|
@@ -494,4 +496,4 @@ export const summary = [
|
|
|
494
496
|
},
|
|
495
497
|
boxSizing,
|
|
496
498
|
...borders,
|
|
497
|
-
] satisfies
|
|
499
|
+
] satisfies Styles;
|
package/src/css/presets.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Styles } from "./normalize";
|
|
2
2
|
|
|
3
|
-
export const borders:
|
|
3
|
+
export const borders: Styles = [
|
|
4
4
|
{
|
|
5
5
|
property: "borderTopWidth",
|
|
6
6
|
value: { type: "unit", value: 1, unit: "px" },
|
|
@@ -18,3 +18,21 @@ export const borders: EmbedTemplateStyleDecl[] = [
|
|
|
18
18
|
value: { type: "unit", value: 1, unit: "px" },
|
|
19
19
|
},
|
|
20
20
|
];
|
|
21
|
+
|
|
22
|
+
export const linkColors: Styles = [
|
|
23
|
+
{
|
|
24
|
+
property: "color",
|
|
25
|
+
value: { type: "rgb", r: 0, g: 0, b: 238, alpha: 1 },
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
state: ":active",
|
|
29
|
+
property: "color",
|
|
30
|
+
// chrome and safari use rgb(255, 0, 0)
|
|
31
|
+
value: { type: "rgb", r: 238, g: 0, b: 0, alpha: 1 },
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
state: ":visited",
|
|
35
|
+
property: "color",
|
|
36
|
+
value: { type: "rgb", r: 85, g: 26, b: 139, alpha: 1 },
|
|
37
|
+
},
|
|
38
|
+
];
|