webadwaita 0.2.0 → 0.2.2
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/README.md +25 -32
- package/dist/native/Box/index.js +120 -0
- package/{src/Button/index.tsx → dist/native/Button/index.js} +32 -50
- package/{src/Card/index.tsx → dist/native/Card/index.js} +25 -25
- package/{src/Checkbox/index.tsx → dist/native/Checkbox/index.js} +41 -48
- package/{src/Entry/index.tsx → dist/native/Entry/index.js} +24 -42
- package/{src/HeaderBar/index.tsx → dist/native/HeaderBar/index.js} +31 -30
- package/{src/Switch/index.tsx → dist/native/Switch/index.js} +31 -37
- package/dist/native/index.js +8 -0
- package/{src/theme.ts → dist/native/theme.js} +4 -7
- package/{src/tokens.css.ts → dist/native/tokens.css.js} +3 -17
- package/dist/types/Box/index.d.ts +23 -0
- package/dist/types/Box/index.d.ts.map +1 -0
- package/dist/types/Button/index.d.ts +22 -0
- package/dist/types/Button/index.d.ts.map +1 -0
- package/dist/types/Card/index.d.ts +14 -0
- package/dist/types/Card/index.d.ts.map +1 -0
- package/dist/types/Checkbox/index.d.ts +13 -0
- package/dist/types/Checkbox/index.d.ts.map +1 -0
- package/dist/types/Entry/index.d.ts +17 -0
- package/dist/types/Entry/index.d.ts.map +1 -0
- package/dist/types/HeaderBar/index.d.ts +16 -0
- package/dist/types/HeaderBar/index.d.ts.map +1 -0
- package/dist/types/Switch/index.d.ts +13 -0
- package/dist/types/Switch/index.d.ts.map +1 -0
- package/{src/index.ts → dist/types/index.d.ts} +1 -7
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/theme.d.ts +77 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/tokens.css.d.ts +76 -0
- package/dist/types/tokens.css.d.ts.map +1 -0
- package/dist/web/Box/index.js +150 -0
- package/dist/web/Box/styles.css +39 -0
- package/dist/web/Button/index.js +132 -0
- package/dist/web/Button/styles.css +81 -0
- package/dist/web/Card/index.js +75 -0
- package/dist/web/Card/styles.css +91 -0
- package/dist/web/Checkbox/index.js +116 -0
- package/dist/web/Checkbox/styles.css +99 -0
- package/dist/web/Entry/index.js +74 -0
- package/dist/web/Entry/styles.css +113 -0
- package/dist/web/HeaderBar/index.js +87 -0
- package/dist/web/HeaderBar/styles.css +117 -0
- package/dist/web/Switch/index.js +86 -0
- package/dist/web/Switch/styles.css +134 -0
- package/dist/web/_rsd/index.js +484 -0
- package/dist/web/_rsd/runtime.js +322 -0
- package/dist/web/_tokens/styles.css +32 -0
- package/dist/web/index.js +8 -0
- package/dist/web/theme.js +16 -0
- package/dist/web/tokens.css.js +79 -0
- package/package.json +29 -9
- package/babel.config.cjs +0 -23
- package/src/Box/index.tsx +0 -105
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license react-strict-dom
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
import * as stylex from '@stylexjs/stylex';
|
|
12
|
+
var styleq$1 = {};
|
|
13
|
+
Object.defineProperty(styleq$1, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
var styleq_2 = styleq$1.styleq = void 0;
|
|
17
|
+
var cache = new WeakMap();
|
|
18
|
+
var compiledKey = '$$css';
|
|
19
|
+
function createStyleq(options) {
|
|
20
|
+
var disableCache;
|
|
21
|
+
var disableMix;
|
|
22
|
+
var transform;
|
|
23
|
+
if (options != null) {
|
|
24
|
+
disableCache = options.disableCache === true;
|
|
25
|
+
disableMix = options.disableMix === true;
|
|
26
|
+
transform = options.transform;
|
|
27
|
+
}
|
|
28
|
+
return function styleq() {
|
|
29
|
+
var definedProperties = [];
|
|
30
|
+
var className = '';
|
|
31
|
+
var inlineStyle = null;
|
|
32
|
+
var debugString = '';
|
|
33
|
+
var nextCache = disableCache ? null : cache;
|
|
34
|
+
var styles = new Array(arguments.length);
|
|
35
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
36
|
+
styles[i] = arguments[i];
|
|
37
|
+
}
|
|
38
|
+
while (styles.length > 0) {
|
|
39
|
+
var possibleStyle = styles.pop();
|
|
40
|
+
if (possibleStyle == null || possibleStyle === false) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (Array.isArray(possibleStyle)) {
|
|
44
|
+
for (var _i = 0; _i < possibleStyle.length; _i++) {
|
|
45
|
+
styles.push(possibleStyle[_i]);
|
|
46
|
+
}
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
var style = transform != null ? transform(possibleStyle) : possibleStyle;
|
|
50
|
+
if (style.$$css != null) {
|
|
51
|
+
var classNameChunk = '';
|
|
52
|
+
if (nextCache != null && nextCache.has(style)) {
|
|
53
|
+
var cacheEntry = nextCache.get(style);
|
|
54
|
+
if (cacheEntry != null) {
|
|
55
|
+
classNameChunk = cacheEntry[0];
|
|
56
|
+
debugString = cacheEntry[2];
|
|
57
|
+
definedProperties.push.apply(definedProperties, cacheEntry[1]);
|
|
58
|
+
nextCache = cacheEntry[3];
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
var definedPropertiesChunk = [];
|
|
62
|
+
for (var prop in style) {
|
|
63
|
+
var value = style[prop];
|
|
64
|
+
if (prop === compiledKey) {
|
|
65
|
+
var compiledKeyValue = style[prop];
|
|
66
|
+
if (compiledKeyValue !== true) {
|
|
67
|
+
debugString = debugString ? compiledKeyValue + '; ' + debugString : compiledKeyValue;
|
|
68
|
+
}
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (typeof value === 'string' || value === null) {
|
|
72
|
+
if (!definedProperties.includes(prop)) {
|
|
73
|
+
definedProperties.push(prop);
|
|
74
|
+
if (nextCache != null) {
|
|
75
|
+
definedPropertiesChunk.push(prop);
|
|
76
|
+
}
|
|
77
|
+
if (typeof value === 'string') {
|
|
78
|
+
classNameChunk += classNameChunk ? ' ' + value : value;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
console.error("styleq: ".concat(prop, " typeof ").concat(String(value), " is not \"string\" or \"null\"."));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (nextCache != null) {
|
|
86
|
+
var weakMap = new WeakMap();
|
|
87
|
+
nextCache.set(style, [classNameChunk, definedPropertiesChunk, debugString, weakMap]);
|
|
88
|
+
nextCache = weakMap;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (classNameChunk) {
|
|
92
|
+
className = className ? classNameChunk + ' ' + className : classNameChunk;
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
if (disableMix) {
|
|
96
|
+
if (inlineStyle == null) {
|
|
97
|
+
inlineStyle = {};
|
|
98
|
+
}
|
|
99
|
+
inlineStyle = Object.assign({}, style, inlineStyle);
|
|
100
|
+
} else {
|
|
101
|
+
var subStyle = null;
|
|
102
|
+
for (var _prop in style) {
|
|
103
|
+
var _value = style[_prop];
|
|
104
|
+
if (_value !== undefined) {
|
|
105
|
+
if (!definedProperties.includes(_prop)) {
|
|
106
|
+
if (_value != null) {
|
|
107
|
+
if (inlineStyle == null) {
|
|
108
|
+
inlineStyle = {};
|
|
109
|
+
}
|
|
110
|
+
if (subStyle == null) {
|
|
111
|
+
subStyle = {};
|
|
112
|
+
}
|
|
113
|
+
subStyle[_prop] = _value;
|
|
114
|
+
}
|
|
115
|
+
definedProperties.push(_prop);
|
|
116
|
+
nextCache = null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (subStyle != null) {
|
|
121
|
+
inlineStyle = Object.assign(subStyle, inlineStyle);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
var styleProps = [className, inlineStyle, debugString];
|
|
127
|
+
return styleProps;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
var styleq = styleq_2 = styleq$1.styleq = createStyleq();
|
|
131
|
+
styleq.factory = createStyleq;
|
|
132
|
+
const optimizedStyleq = styleq_2.factory({
|
|
133
|
+
disableMix: true
|
|
134
|
+
});
|
|
135
|
+
function merge(...styles) {
|
|
136
|
+
const [className, style, dataStyleSrc] = optimizedStyleq(styles);
|
|
137
|
+
const result = {};
|
|
138
|
+
if (className != null && className !== '') {
|
|
139
|
+
result.className = className;
|
|
140
|
+
}
|
|
141
|
+
if (style != null) {
|
|
142
|
+
result.style = style;
|
|
143
|
+
}
|
|
144
|
+
if (dataStyleSrc != null && dataStyleSrc !== '') {
|
|
145
|
+
const chunks = dataStyleSrc.split(';');
|
|
146
|
+
const pathsMap = {};
|
|
147
|
+
for (const chunk of chunks) {
|
|
148
|
+
const trimmed = chunk.trim();
|
|
149
|
+
const [path, line] = trimmed.split(':');
|
|
150
|
+
if (line != null) {
|
|
151
|
+
pathsMap[path] = pathsMap[path] != null ? `${pathsMap[path]},${line}` : line;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
result['data-style-src'] = Object.keys(pathsMap).map(path => `${path}:${pathsMap[path]}`).join('; ');
|
|
155
|
+
}
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
const styles = {
|
|
159
|
+
block: {
|
|
160
|
+
kogj98: "x1ghz6dp",
|
|
161
|
+
kmVPX3: "x1717udv",
|
|
162
|
+
$$css: true
|
|
163
|
+
},
|
|
164
|
+
inline: {
|
|
165
|
+
kogj98: "x1ghz6dp",
|
|
166
|
+
kmVPX3: "x1717udv",
|
|
167
|
+
kybGjl: "x1hl2dhg",
|
|
168
|
+
k9WMMc: "x16tdsg8",
|
|
169
|
+
kD5eJx: "x1vvkbs",
|
|
170
|
+
$$css: true
|
|
171
|
+
},
|
|
172
|
+
inlineblock: {
|
|
173
|
+
ksu8eU: "x1y0btm7",
|
|
174
|
+
kogj98: "x1ghz6dp",
|
|
175
|
+
kmVPX3: "x1717udv",
|
|
176
|
+
$$css: true
|
|
177
|
+
},
|
|
178
|
+
button: {
|
|
179
|
+
kMzoRj: "xmkeg23",
|
|
180
|
+
$$css: true
|
|
181
|
+
},
|
|
182
|
+
codePre: {
|
|
183
|
+
kMv6JI: "x1lxnp44",
|
|
184
|
+
kGuDYH: "xrv4cvt",
|
|
185
|
+
kVQacm: "xysyzu8",
|
|
186
|
+
$$css: true
|
|
187
|
+
},
|
|
188
|
+
heading: {
|
|
189
|
+
kGuDYH: "xngnso2",
|
|
190
|
+
kD5eJx: "x1vvkbs",
|
|
191
|
+
$$css: true
|
|
192
|
+
},
|
|
193
|
+
hr: {
|
|
194
|
+
kWkggS: "x42x0ya",
|
|
195
|
+
ksu8eU: "xng3xce",
|
|
196
|
+
kMzoRj: "xc342km",
|
|
197
|
+
kB7OPa: "x9f619",
|
|
198
|
+
kZKoxP: "xjm9jq1",
|
|
199
|
+
$$css: true
|
|
200
|
+
},
|
|
201
|
+
img: {
|
|
202
|
+
kOBAk4: "xuw900x",
|
|
203
|
+
kZKoxP: "xt7dq6l",
|
|
204
|
+
ks0D6T: "x193iq5w",
|
|
205
|
+
$$css: true
|
|
206
|
+
},
|
|
207
|
+
input: {
|
|
208
|
+
kMzoRj: "xmkeg23",
|
|
209
|
+
ksu8eU: "x1y0btm7",
|
|
210
|
+
$$css: true
|
|
211
|
+
},
|
|
212
|
+
list: {
|
|
213
|
+
kB88ic: "xe8uvvx",
|
|
214
|
+
$$css: true
|
|
215
|
+
},
|
|
216
|
+
strong: {
|
|
217
|
+
k63SB2: "x117nqv4",
|
|
218
|
+
$$css: true
|
|
219
|
+
},
|
|
220
|
+
textarea: {
|
|
221
|
+
kMzoRj: "xmkeg23",
|
|
222
|
+
ksu8eU: "x1y0btm7",
|
|
223
|
+
kHenm0: "x288g5",
|
|
224
|
+
$$css: true
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
const a = styles.inline;
|
|
228
|
+
const article = styles.block;
|
|
229
|
+
const aside = styles.block;
|
|
230
|
+
const b = styles.inline;
|
|
231
|
+
const bdi = styles.inline;
|
|
232
|
+
const bdo = styles.inline;
|
|
233
|
+
const blockquote = styles.block;
|
|
234
|
+
const br = null;
|
|
235
|
+
const button = [styles.inlineblock, styles.button];
|
|
236
|
+
const code = [styles.inline, styles.codePre];
|
|
237
|
+
const del = null;
|
|
238
|
+
const div = styles.block;
|
|
239
|
+
const em = styles.inline;
|
|
240
|
+
const fieldset = styles.block;
|
|
241
|
+
const footer = styles.block;
|
|
242
|
+
const form = styles.block;
|
|
243
|
+
const heading = [styles.block, styles.heading];
|
|
244
|
+
const header = styles.block;
|
|
245
|
+
const hr = [styles.block, styles.hr];
|
|
246
|
+
const i = styles.inline;
|
|
247
|
+
const img = styles.img;
|
|
248
|
+
const input = [styles.inlineblock, styles.input];
|
|
249
|
+
const ins = null;
|
|
250
|
+
const kbd = null;
|
|
251
|
+
const label = styles.inline;
|
|
252
|
+
const li = styles.block;
|
|
253
|
+
const main = styles.block;
|
|
254
|
+
const mark = styles.inline;
|
|
255
|
+
const nav = styles.block;
|
|
256
|
+
const ol = [styles.list, styles.block];
|
|
257
|
+
const optgroup = null;
|
|
258
|
+
const option = null;
|
|
259
|
+
const p = styles.block;
|
|
260
|
+
const pre = [styles.block, styles.codePre];
|
|
261
|
+
const s = null;
|
|
262
|
+
const section = styles.block;
|
|
263
|
+
const select = styles.inlineblock;
|
|
264
|
+
const span = styles.inline;
|
|
265
|
+
const strong = [styles.inline, styles.strong];
|
|
266
|
+
const sub = styles.inline;
|
|
267
|
+
const sup = styles.inline;
|
|
268
|
+
const textarea = [styles.inlineblock, styles.textarea];
|
|
269
|
+
const u = null;
|
|
270
|
+
const ul = [styles.list, styles.block];
|
|
271
|
+
const defaultStyles = {
|
|
272
|
+
a: a,
|
|
273
|
+
article: article,
|
|
274
|
+
aside: aside,
|
|
275
|
+
b: b,
|
|
276
|
+
bdi: bdi,
|
|
277
|
+
bdo: bdo,
|
|
278
|
+
blockquote: blockquote,
|
|
279
|
+
br: br,
|
|
280
|
+
button: button,
|
|
281
|
+
code: code,
|
|
282
|
+
del: del,
|
|
283
|
+
div: div,
|
|
284
|
+
em: em,
|
|
285
|
+
fieldset: fieldset,
|
|
286
|
+
footer: footer,
|
|
287
|
+
form: form,
|
|
288
|
+
h1: heading,
|
|
289
|
+
h2: heading,
|
|
290
|
+
h3: heading,
|
|
291
|
+
h4: heading,
|
|
292
|
+
h5: heading,
|
|
293
|
+
h6: heading,
|
|
294
|
+
header: header,
|
|
295
|
+
hr: hr,
|
|
296
|
+
i: i,
|
|
297
|
+
img: img,
|
|
298
|
+
input: input,
|
|
299
|
+
ins: ins,
|
|
300
|
+
kbd: kbd,
|
|
301
|
+
label: label,
|
|
302
|
+
li: li,
|
|
303
|
+
main: main,
|
|
304
|
+
mark: mark,
|
|
305
|
+
nav: nav,
|
|
306
|
+
ol: ol,
|
|
307
|
+
optgroup: optgroup,
|
|
308
|
+
option: option,
|
|
309
|
+
p: p,
|
|
310
|
+
pre: pre,
|
|
311
|
+
s: s,
|
|
312
|
+
section: section,
|
|
313
|
+
select: select,
|
|
314
|
+
span: span,
|
|
315
|
+
strong: strong,
|
|
316
|
+
sub: sub,
|
|
317
|
+
sup: sup,
|
|
318
|
+
textarea: textarea,
|
|
319
|
+
u: u,
|
|
320
|
+
ul: ul
|
|
321
|
+
};
|
|
322
|
+
export { defaultStyles, merge };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
@layer priority1, priority2, priority3, priority4;
|
|
3
|
+
@layer priority1{
|
|
4
|
+
.x1ghz6dp{margin:0}
|
|
5
|
+
.x1717udv{padding:0}
|
|
6
|
+
}
|
|
7
|
+
@layer priority2{
|
|
8
|
+
.xng3xce{border-style:none}
|
|
9
|
+
.x1y0btm7{border-style:solid}
|
|
10
|
+
.xc342km{border-width:0}
|
|
11
|
+
.xmkeg23{border-width:1px}
|
|
12
|
+
.xe8uvvx{list-style:none}
|
|
13
|
+
.xysyzu8{overflow:auto}
|
|
14
|
+
.x1hl2dhg{text-decoration:none}
|
|
15
|
+
}
|
|
16
|
+
@layer priority3{
|
|
17
|
+
.xuw900x{aspect-ratio:attr(width) / attr(height)}
|
|
18
|
+
.x42x0ya{background-color:black}
|
|
19
|
+
.x9f619{box-sizing:border-box}
|
|
20
|
+
.x1lxnp44{font-family:monospace,"monospace"}
|
|
21
|
+
.xngnso2{font-size:1.5rem}
|
|
22
|
+
.xrv4cvt{font-size:1em}
|
|
23
|
+
.x117nqv4{font-weight:bold}
|
|
24
|
+
.x288g5{resize:vertical}
|
|
25
|
+
.x16tdsg8{text-align:inherit}
|
|
26
|
+
.x1vvkbs{word-wrap:break-word}
|
|
27
|
+
}
|
|
28
|
+
@layer priority4{
|
|
29
|
+
.xjm9jq1{height:1px}
|
|
30
|
+
.xt7dq6l{height:auto}
|
|
31
|
+
.x193iq5w{max-width:100%}
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Button } from './Button';
|
|
2
|
+
export { Entry } from './Entry';
|
|
3
|
+
export { Switch } from './Switch';
|
|
4
|
+
export { Checkbox } from './Checkbox';
|
|
5
|
+
export { Card } from './Card';
|
|
6
|
+
export { HeaderBar } from './HeaderBar';
|
|
7
|
+
export { Box } from './Box';
|
|
8
|
+
export { theme, palette, radius, spacing, typography, motion } from './theme';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export of the design tokens for runtime use by consumer code (e.g. for
|
|
3
|
+
* computing inline styles, reading the accent color in a custom component).
|
|
4
|
+
*
|
|
5
|
+
* The stylex-aware tokens live in `tokens.stylex.ts`. At runtime, defineConsts
|
|
6
|
+
* returns a plain object with the same keys/values — so we just re-export.
|
|
7
|
+
*/
|
|
8
|
+
export { palette, radius, spacing, typography, motion } from './tokens.css';
|
|
9
|
+
import { palette, radius, spacing, typography, motion } from './tokens.css';
|
|
10
|
+
export const theme = {
|
|
11
|
+
palette,
|
|
12
|
+
radius,
|
|
13
|
+
spacing,
|
|
14
|
+
typography,
|
|
15
|
+
motion
|
|
16
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import './_tokens/styles.css';
|
|
2
|
+
import { defaultStyles as _rsdDefaultStyles, merge as _rsdMerge } from "./_rsd/runtime.js";
|
|
3
|
+
import { css } from './_rsd/index.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Adwaita-inspired design tokens, exposed via `css.defineConsts` so they can
|
|
7
|
+
* be referenced inside `css.create({...})` calls. StyleX requires shared
|
|
8
|
+
* values to live in a `.stylex.ts` file and to be defined this way.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: defineConsts only accepts string values. Numeric tokens (sizes,
|
|
11
|
+
* weights, line heights) are encoded as strings — CSS accepts them either
|
|
12
|
+
* way, and react-strict-dom forwards them through to RN as well.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const palette = {
|
|
16
|
+
accentBg: "#3584e4",
|
|
17
|
+
accentBgHover: "#4a90e9",
|
|
18
|
+
accentBgActive: "#1a6bb8",
|
|
19
|
+
accentFg: "#ffffff",
|
|
20
|
+
destructiveBg: "#e01b24",
|
|
21
|
+
destructiveBgHover: "#e8434b",
|
|
22
|
+
destructiveBgActive: "#b81920",
|
|
23
|
+
destructiveFg: "#ffffff",
|
|
24
|
+
successBg: "#26a269",
|
|
25
|
+
warningBg: "#cd9309",
|
|
26
|
+
windowBg: "#fafafa",
|
|
27
|
+
viewBg: "#ffffff",
|
|
28
|
+
cardBg: "#ffffff",
|
|
29
|
+
headerbarBg: "#ebebeb",
|
|
30
|
+
sidebarBg: "#ebebeb",
|
|
31
|
+
fg: "rgba(0, 0, 0, 0.8)",
|
|
32
|
+
fgMuted: "rgba(0, 0, 0, 0.55)",
|
|
33
|
+
fgDisabled: "rgba(0, 0, 0, 0.35)",
|
|
34
|
+
fgOnAccent: "#ffffff",
|
|
35
|
+
border: "rgba(0, 0, 0, 0.15)",
|
|
36
|
+
borderStrong: "rgba(0, 0, 0, 0.25)",
|
|
37
|
+
shadow: "rgba(0, 0, 0, 0.07)",
|
|
38
|
+
subtleBg: "rgba(0, 0, 0, 0.07)",
|
|
39
|
+
subtleBgHover: "rgba(0, 0, 0, 0.12)",
|
|
40
|
+
subtleBgActive: "rgba(0, 0, 0, 0.18)"
|
|
41
|
+
};
|
|
42
|
+
export const radius = {
|
|
43
|
+
sm: "6px",
|
|
44
|
+
md: "9px",
|
|
45
|
+
lg: "12px",
|
|
46
|
+
pill: "9999px"
|
|
47
|
+
};
|
|
48
|
+
export const spacing = {
|
|
49
|
+
xs: "4px",
|
|
50
|
+
sm: "8px",
|
|
51
|
+
md: "12px",
|
|
52
|
+
lg: "16px",
|
|
53
|
+
xl: "24px",
|
|
54
|
+
xxl: "32px"
|
|
55
|
+
};
|
|
56
|
+
export const typography = {
|
|
57
|
+
fontFamily: "\"Adwaita Sans\", \"Cantarell\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif",
|
|
58
|
+
fontFamilyMono: "\"Adwaita Mono\", \"Source Code Pro\", ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
59
|
+
weightRegular: "400",
|
|
60
|
+
weightStrong: "600",
|
|
61
|
+
weightBold: "700",
|
|
62
|
+
bodySize: "14px",
|
|
63
|
+
bodyLineHeight: "1.5",
|
|
64
|
+
captionSize: "12px",
|
|
65
|
+
captionLineHeight: "1.4",
|
|
66
|
+
title4Size: "16px",
|
|
67
|
+
title4LineHeight: "1.3",
|
|
68
|
+
title3Size: "18px",
|
|
69
|
+
title3LineHeight: "1.3",
|
|
70
|
+
title2Size: "22px",
|
|
71
|
+
title2LineHeight: "1.25",
|
|
72
|
+
title1Size: "28px",
|
|
73
|
+
title1LineHeight: "1.2"
|
|
74
|
+
};
|
|
75
|
+
export const motion = {
|
|
76
|
+
durationFast: "120ms",
|
|
77
|
+
durationBase: "180ms",
|
|
78
|
+
easing: "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
79
|
+
};
|
package/package.json
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webadwaita",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Cross-platform Adwaita-styled UI components built on react-strict-dom.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"sideEffects":
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.css"
|
|
8
|
+
],
|
|
7
9
|
"files": [
|
|
8
|
-
"
|
|
9
|
-
"babel.config.cjs",
|
|
10
|
+
"dist",
|
|
10
11
|
"README.md",
|
|
11
12
|
"LICENSE"
|
|
12
13
|
],
|
|
13
|
-
"main": "./
|
|
14
|
+
"main": "./dist/web/index.js",
|
|
15
|
+
"module": "./dist/web/index.js",
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
14
17
|
"exports": {
|
|
15
|
-
".":
|
|
16
|
-
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/types/index.d.ts",
|
|
20
|
+
"react-native": "./dist/native/index.js",
|
|
21
|
+
"default": "./dist/web/index.js"
|
|
22
|
+
},
|
|
17
23
|
"./package.json": "./package.json"
|
|
18
24
|
},
|
|
19
25
|
"scripts": {
|
|
26
|
+
"build": "node scripts/build.mjs",
|
|
20
27
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
28
|
+
"prepack": "npm run build",
|
|
21
29
|
"storybook:web": "npm --prefix apps/storybook-web run storybook",
|
|
22
30
|
"storybook:native": "npm --prefix apps/storybook-native run start"
|
|
23
31
|
},
|
|
@@ -28,12 +36,24 @@
|
|
|
28
36
|
"react-strict-dom": ">=0.0.50"
|
|
29
37
|
},
|
|
30
38
|
"peerDependenciesMeta": {
|
|
31
|
-
"react-dom": {
|
|
32
|
-
|
|
39
|
+
"react-dom": {
|
|
40
|
+
"optional": true
|
|
41
|
+
},
|
|
42
|
+
"react-native": {
|
|
43
|
+
"optional": true
|
|
44
|
+
}
|
|
33
45
|
},
|
|
34
46
|
"devDependencies": {
|
|
47
|
+
"@babel/cli": "^7.28.6",
|
|
48
|
+
"@babel/core": "^7.29.0",
|
|
49
|
+
"@babel/preset-env": "^7.29.5",
|
|
50
|
+
"@babel/preset-react": "^7.28.5",
|
|
51
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
52
|
+
"@stylexjs/babel-plugin": "^0.18.3",
|
|
35
53
|
"@types/react": "^19.2.5",
|
|
36
54
|
"@types/react-dom": "^19.2.3",
|
|
55
|
+
"postcss": "^8.5.14",
|
|
56
|
+
"postcss-react-strict-dom": "^0.0.55",
|
|
37
57
|
"react": "^19.2.0",
|
|
38
58
|
"react-dom": "^19.2.0",
|
|
39
59
|
"react-strict-dom": "^0.0.55",
|
package/babel.config.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared babel config used by Vite (web library build) and consumers
|
|
3
|
-
* who want to bundle WebAdwaita source through the react-strict-dom
|
|
4
|
-
* preset (e.g. Metro / Vite / Next.js postcss pipelines).
|
|
5
|
-
*/
|
|
6
|
-
const dev = process.env.NODE_ENV !== 'production';
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
parserOpts: {
|
|
10
|
-
plugins: ['typescript', 'jsx']
|
|
11
|
-
},
|
|
12
|
-
presets: [
|
|
13
|
-
[
|
|
14
|
-
'react-strict-dom/babel-preset',
|
|
15
|
-
{
|
|
16
|
-
debug: dev,
|
|
17
|
-
dev,
|
|
18
|
-
rootDir: process.cwd(),
|
|
19
|
-
platform: process.env.WEBADWAITA_PLATFORM || 'web'
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
]
|
|
23
|
-
};
|
package/src/Box/index.tsx
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { css, html } from 'react-strict-dom';
|
|
3
|
-
import { spacing } from '../tokens.css';
|
|
4
|
-
|
|
5
|
-
type SpacingKey = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
6
|
-
type Direction = 'row' | 'column';
|
|
7
|
-
type Align = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
|
|
8
|
-
type Justify =
|
|
9
|
-
| 'flex-start'
|
|
10
|
-
| 'center'
|
|
11
|
-
| 'flex-end'
|
|
12
|
-
| 'space-between'
|
|
13
|
-
| 'space-around'
|
|
14
|
-
| 'space-evenly';
|
|
15
|
-
|
|
16
|
-
export type BoxProps = {
|
|
17
|
-
children?: React.ReactNode;
|
|
18
|
-
direction?: Direction;
|
|
19
|
-
gap?: SpacingKey;
|
|
20
|
-
padding?: SpacingKey;
|
|
21
|
-
align?: Align;
|
|
22
|
-
justify?: Justify;
|
|
23
|
-
grow?: boolean;
|
|
24
|
-
wrap?: boolean;
|
|
25
|
-
style?: any;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Layout primitive — a flex container, the building block for everything else.
|
|
30
|
-
* Adwaita-inspired apps lean heavily on simple horizontal/vertical stacks.
|
|
31
|
-
*/
|
|
32
|
-
export function Box(props: BoxProps) {
|
|
33
|
-
const {
|
|
34
|
-
children,
|
|
35
|
-
direction = 'column',
|
|
36
|
-
gap,
|
|
37
|
-
padding,
|
|
38
|
-
align,
|
|
39
|
-
justify,
|
|
40
|
-
grow,
|
|
41
|
-
wrap,
|
|
42
|
-
style
|
|
43
|
-
} = props;
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<html.div
|
|
47
|
-
style={[
|
|
48
|
-
styles.base,
|
|
49
|
-
direction === 'row' ? styles.row : styles.column,
|
|
50
|
-
wrap && styles.wrap,
|
|
51
|
-
grow && styles.grow,
|
|
52
|
-
align != null && alignStyles[align],
|
|
53
|
-
justify != null && justifyStyles[justify],
|
|
54
|
-
gap != null && gapStyles[gap],
|
|
55
|
-
padding != null && paddingStyles[padding],
|
|
56
|
-
style
|
|
57
|
-
]}
|
|
58
|
-
>
|
|
59
|
-
{children}
|
|
60
|
-
</html.div>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const styles = css.create({
|
|
65
|
-
base: { display: 'flex', minWidth: 0 },
|
|
66
|
-
row: { flexDirection: 'row' },
|
|
67
|
-
column: { flexDirection: 'column' },
|
|
68
|
-
wrap: { flexWrap: 'wrap' },
|
|
69
|
-
grow: { flexGrow: 1 }
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const alignStyles = css.create({
|
|
73
|
-
'flex-start': { alignItems: 'flex-start' },
|
|
74
|
-
center: { alignItems: 'center' },
|
|
75
|
-
'flex-end': { alignItems: 'flex-end' },
|
|
76
|
-
stretch: { alignItems: 'stretch' },
|
|
77
|
-
baseline: { alignItems: 'baseline' }
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const justifyStyles = css.create({
|
|
81
|
-
'flex-start': { justifyContent: 'flex-start' },
|
|
82
|
-
center: { justifyContent: 'center' },
|
|
83
|
-
'flex-end': { justifyContent: 'flex-end' },
|
|
84
|
-
'space-between': { justifyContent: 'space-between' },
|
|
85
|
-
'space-around': { justifyContent: 'space-around' },
|
|
86
|
-
'space-evenly': { justifyContent: 'space-evenly' }
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const gapStyles = css.create({
|
|
90
|
-
xs: { gap: spacing.xs },
|
|
91
|
-
sm: { gap: spacing.sm },
|
|
92
|
-
md: { gap: spacing.md },
|
|
93
|
-
lg: { gap: spacing.lg },
|
|
94
|
-
xl: { gap: spacing.xl },
|
|
95
|
-
xxl: { gap: spacing.xxl }
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const paddingStyles = css.create({
|
|
99
|
-
xs: { padding: spacing.xs },
|
|
100
|
-
sm: { padding: spacing.sm },
|
|
101
|
-
md: { padding: spacing.md },
|
|
102
|
-
lg: { padding: spacing.lg },
|
|
103
|
-
xl: { padding: spacing.xl },
|
|
104
|
-
xxl: { padding: spacing.xxl }
|
|
105
|
-
});
|