@marigold/system 0.5.1 → 0.6.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 +12 -0
- package/dist/index.d.ts +23 -12
- package/dist/index.js +23 -15
- package/dist/index.mjs +23 -15
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @marigold/system
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1817](https://github.com/marigold-ui/marigold/pull/1817) [`4cc0ad3b`](https://github.com/marigold-ui/marigold/commit/4cc0ad3b85b993e01b4d85b6f30b1a81cdee2351) Thanks [@sebald](https://github.com/sebald)! - feat(system): Add textSizeAdjust to globals
|
|
8
|
+
|
|
9
|
+
* [#1842](https://github.com/marigold-ui/marigold/pull/1842) [`e053b7b9`](https://github.com/marigold-ui/marigold/commit/e053b7b903f02c56cf10e6b9aecbedd29399895d) Thanks [@ti10le](https://github.com/ti10le)! - feat: extend svg fill prop to handle theme color
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1809](https://github.com/marigold-ui/marigold/pull/1809) [`539d4198`](https://github.com/marigold-ui/marigold/commit/539d41987118db125ee37a4a83231335ea15830a) Thanks [@sebald](https://github.com/sebald)! - feat(create-theme): Introduce helper package to create themes with sensible defaults
|
|
14
|
+
|
|
3
15
|
## 0.5.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -210,13 +210,21 @@ declare type ScaleValue<T> = T | T[] | NestedScaleDict<T> | undefined;
|
|
|
210
210
|
* descriptive name for the scale (e.g. `small`/`medium`/.. or `body`/`heading`/...),
|
|
211
211
|
* and the value is the CSS value.
|
|
212
212
|
*/
|
|
213
|
-
|
|
213
|
+
interface Scale<T> {
|
|
214
214
|
[key: string]: ScaleValue<T>;
|
|
215
|
-
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* A {@link Scale} that also includes a required `none` value, which is
|
|
218
|
+
* usually used to define the blank value (e.g `0`).
|
|
219
|
+
*/
|
|
220
|
+
interface ZeroScale<T> extends Scale<T> {
|
|
221
|
+
none: ScaleValue<T>;
|
|
222
|
+
}
|
|
216
223
|
/**
|
|
217
224
|
* Predefined {@link Scale} scale which uses size values.
|
|
218
225
|
*/
|
|
219
|
-
|
|
226
|
+
interface SizeScale<T> {
|
|
227
|
+
regular?: ScaleValue<T>;
|
|
220
228
|
xxsmall?: ScaleValue<T>;
|
|
221
229
|
xsmall?: ScaleValue<T>;
|
|
222
230
|
small?: ScaleValue<T>;
|
|
@@ -224,14 +232,17 @@ declare type SizeScale<T> = {
|
|
|
224
232
|
large?: ScaleValue<T>;
|
|
225
233
|
xlarge?: ScaleValue<T>;
|
|
226
234
|
xxlarge?: ScaleValue<T>;
|
|
227
|
-
|
|
235
|
+
xxxlarge?: ScaleValue<T>;
|
|
236
|
+
huge?: ScaleValue<T>;
|
|
237
|
+
epic?: ScaleValue<T>;
|
|
238
|
+
}
|
|
228
239
|
/**
|
|
229
240
|
* A {@link SizeScale} that also includes a required `none` value, which is
|
|
230
241
|
* usually used to define the blank value (e.g `0`).
|
|
231
242
|
*/
|
|
232
|
-
|
|
243
|
+
interface ZeroSizeScale<T> extends SizeScale<T> {
|
|
233
244
|
none: ScaleValue<T>;
|
|
234
|
-
}
|
|
245
|
+
}
|
|
235
246
|
/**
|
|
236
247
|
* Base theme with typings for available scales properties.
|
|
237
248
|
*/
|
|
@@ -248,7 +259,7 @@ interface Theme {
|
|
|
248
259
|
* ```ts
|
|
249
260
|
* {
|
|
250
261
|
* breakpoints: [
|
|
251
|
-
* '40em', '
|
|
262
|
+
* '40em', '50em', '64em',
|
|
252
263
|
* ],
|
|
253
264
|
* }
|
|
254
265
|
* ```
|
|
@@ -259,7 +270,7 @@ interface Theme {
|
|
|
259
270
|
* Used to define a scale for whitspace values,
|
|
260
271
|
* like `padding`, `margin`, `gap`, etc.
|
|
261
272
|
*/
|
|
262
|
-
space?:
|
|
273
|
+
space?: ZeroSizeScale<CSS.Property.Margin<number | string>>;
|
|
263
274
|
/**
|
|
264
275
|
* Used to define a `font-size` scale.
|
|
265
276
|
*/
|
|
@@ -279,12 +290,12 @@ interface Theme {
|
|
|
279
290
|
/**
|
|
280
291
|
* Used to define a `letter-spacing` scale.
|
|
281
292
|
*/
|
|
282
|
-
letterSpacings?:
|
|
293
|
+
letterSpacings?: Scale<CSS.Property.LetterSpacing<string | 0 | number>>;
|
|
283
294
|
/**
|
|
284
295
|
* Used to define a scale for size values,
|
|
285
296
|
* like `height`, `width`, `flexBasis`, etc.
|
|
286
297
|
*/
|
|
287
|
-
sizes?:
|
|
298
|
+
sizes?: ZeroSizeScale<CSS.Property.Height<{}> | CSS.Property.Width<{}>>;
|
|
288
299
|
/**
|
|
289
300
|
* Used to define different `border` styles.
|
|
290
301
|
*/
|
|
@@ -316,7 +327,7 @@ interface Theme {
|
|
|
316
327
|
/**
|
|
317
328
|
* Used to define a `transition` styles.
|
|
318
329
|
*/
|
|
319
|
-
transitions?:
|
|
330
|
+
transitions?: Scale<CSS.Property.Transition>;
|
|
320
331
|
}
|
|
321
332
|
|
|
322
333
|
/**
|
|
@@ -370,4 +381,4 @@ declare const appendVariantState: (variant: string, state: keyof State) => strin
|
|
|
370
381
|
*/
|
|
371
382
|
declare const conditional: (variant: string, { disabled, ...states }: State) => string[];
|
|
372
383
|
|
|
373
|
-
export { Box, BoxOwnProps, BoxProps, CSSObject, CSSProperties, Global, NormalizedElement, ResponsiveStyleValue, SVG, SVGProps, Scale, ScaleValue, SizeScale, State, StyleObject, StyleProps, Theme, ThemeProvider, ThemeProviderProps, ZeroScale, __defaultTheme, appendVariantState, conditional, ensureArray, ensureArrayVariant, ensureVariantDefault, getNormalizedStyles, normalize, useResponsiveValue, useTheme };
|
|
384
|
+
export { Box, BoxOwnProps, BoxProps, CSSObject, CSSProperties, Global, NormalizedElement, ResponsiveStyleValue, SVG, SVGProps, Scale, ScaleValue, SizeScale, State, StyleObject, StyleProps, Theme, ThemeProvider, ThemeProviderProps, ZeroScale, ZeroSizeScale, __defaultTheme, appendVariantState, conditional, ensureArray, ensureArrayVariant, ensureVariantDefault, getNormalizedStyles, normalize, useResponsiveValue, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -165,13 +165,13 @@ var conditional = (variant, _a) => {
|
|
|
165
165
|
|
|
166
166
|
// src/Box.tsx
|
|
167
167
|
var isNotEmpty = (val) => !(val && Object.keys(val).length === 0 && val.constructor === Object);
|
|
168
|
-
var createThemedStyle = ({ as, __baseCSS, variant, styles, css
|
|
168
|
+
var createThemedStyle = ({ as, __baseCSS, variant, styles, css }) => (theme) => {
|
|
169
169
|
return [
|
|
170
170
|
getNormalizedStyles(as),
|
|
171
171
|
(0, import_css.css)(__baseCSS)(theme),
|
|
172
172
|
...ensureArrayVariant(variant).map((v) => (0, import_css.css)({ variant: v })(theme)),
|
|
173
173
|
(0, import_css.css)(styles)(theme),
|
|
174
|
-
(0, import_css.css)(
|
|
174
|
+
(0, import_css.css)(css)(theme)
|
|
175
175
|
].filter(isNotEmpty);
|
|
176
176
|
};
|
|
177
177
|
var Box = (0, import_react2.forwardRef)((_a, ref) => {
|
|
@@ -180,7 +180,7 @@ var Box = (0, import_react2.forwardRef)((_a, ref) => {
|
|
|
180
180
|
children,
|
|
181
181
|
__baseCSS,
|
|
182
182
|
variant,
|
|
183
|
-
css
|
|
183
|
+
css = {},
|
|
184
184
|
display,
|
|
185
185
|
height,
|
|
186
186
|
width,
|
|
@@ -269,7 +269,7 @@ var Box = (0, import_react2.forwardRef)((_a, ref) => {
|
|
|
269
269
|
as,
|
|
270
270
|
__baseCSS,
|
|
271
271
|
variant,
|
|
272
|
-
css
|
|
272
|
+
css,
|
|
273
273
|
styles: {
|
|
274
274
|
display,
|
|
275
275
|
height,
|
|
@@ -327,8 +327,8 @@ var __defaultTheme = {};
|
|
|
327
327
|
var InternalContext = (0, import_react3.createContext)(__defaultTheme);
|
|
328
328
|
var useTheme = () => {
|
|
329
329
|
const theme = (0, import_react3.useContext)(InternalContext);
|
|
330
|
-
const
|
|
331
|
-
return { theme, css
|
|
330
|
+
const css = (0, import_react3.useCallback)((style) => (0, import_css2.css)(style)(theme), [theme]);
|
|
331
|
+
return { theme, css };
|
|
332
332
|
};
|
|
333
333
|
function ThemeProvider({
|
|
334
334
|
theme,
|
|
@@ -352,10 +352,11 @@ var reduceMotionStyles = {
|
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
354
|
var Global = () => {
|
|
355
|
-
const { css
|
|
356
|
-
const styles =
|
|
355
|
+
const { css } = useTheme();
|
|
356
|
+
const styles = css({
|
|
357
357
|
html: {
|
|
358
358
|
height: "100%",
|
|
359
|
+
textSizeAdjust: "none",
|
|
359
360
|
variant: "root.html"
|
|
360
361
|
},
|
|
361
362
|
body: {
|
|
@@ -372,17 +373,24 @@ var Global = () => {
|
|
|
372
373
|
|
|
373
374
|
// src/SVG.tsx
|
|
374
375
|
var import_react7 = require("@emotion/react");
|
|
375
|
-
var
|
|
376
|
+
var normalizedStyles = getNormalizedStyles("svg");
|
|
376
377
|
var SVG = (_a) => {
|
|
377
|
-
var _b = _a, {
|
|
378
|
-
|
|
378
|
+
var _b = _a, {
|
|
379
|
+
size = 24,
|
|
380
|
+
fill = "currentcolor",
|
|
381
|
+
children
|
|
382
|
+
} = _b, props = __objRest(_b, [
|
|
383
|
+
"size",
|
|
384
|
+
"fill",
|
|
385
|
+
"children"
|
|
386
|
+
]);
|
|
387
|
+
const { css } = useTheme();
|
|
388
|
+
return (0, import_react7.jsx)("svg", __spreadValues({
|
|
379
389
|
width: size,
|
|
380
390
|
height: size,
|
|
381
391
|
viewBox: "0 0 24 24",
|
|
382
|
-
|
|
383
|
-
}, props),
|
|
384
|
-
css
|
|
385
|
-
}), children);
|
|
392
|
+
css: css(__spreadValues({ fill }, normalizedStyles))
|
|
393
|
+
}, props), children);
|
|
386
394
|
};
|
|
387
395
|
|
|
388
396
|
// src/useResponsiveValue.ts
|
package/dist/index.mjs
CHANGED
|
@@ -121,13 +121,13 @@ var conditional = (variant, _a) => {
|
|
|
121
121
|
|
|
122
122
|
// src/Box.tsx
|
|
123
123
|
var isNotEmpty = (val) => !(val && Object.keys(val).length === 0 && val.constructor === Object);
|
|
124
|
-
var createThemedStyle = ({ as, __baseCSS, variant, styles, css
|
|
124
|
+
var createThemedStyle = ({ as, __baseCSS, variant, styles, css }) => (theme) => {
|
|
125
125
|
return [
|
|
126
126
|
getNormalizedStyles(as),
|
|
127
127
|
transformStyleObject(__baseCSS)(theme),
|
|
128
128
|
...ensureArrayVariant(variant).map((v) => transformStyleObject({ variant: v })(theme)),
|
|
129
129
|
transformStyleObject(styles)(theme),
|
|
130
|
-
transformStyleObject(
|
|
130
|
+
transformStyleObject(css)(theme)
|
|
131
131
|
].filter(isNotEmpty);
|
|
132
132
|
};
|
|
133
133
|
var Box = forwardRef((_a, ref) => {
|
|
@@ -136,7 +136,7 @@ var Box = forwardRef((_a, ref) => {
|
|
|
136
136
|
children,
|
|
137
137
|
__baseCSS,
|
|
138
138
|
variant,
|
|
139
|
-
css
|
|
139
|
+
css = {},
|
|
140
140
|
display,
|
|
141
141
|
height,
|
|
142
142
|
width,
|
|
@@ -225,7 +225,7 @@ var Box = forwardRef((_a, ref) => {
|
|
|
225
225
|
as,
|
|
226
226
|
__baseCSS,
|
|
227
227
|
variant,
|
|
228
|
-
css
|
|
228
|
+
css,
|
|
229
229
|
styles: {
|
|
230
230
|
display,
|
|
231
231
|
height,
|
|
@@ -287,8 +287,8 @@ var __defaultTheme = {};
|
|
|
287
287
|
var InternalContext = createContext(__defaultTheme);
|
|
288
288
|
var useTheme = () => {
|
|
289
289
|
const theme = useContext(InternalContext);
|
|
290
|
-
const
|
|
291
|
-
return { theme, css
|
|
290
|
+
const css = useCallback((style) => transformStyleObject2(style)(theme), [theme]);
|
|
291
|
+
return { theme, css };
|
|
292
292
|
};
|
|
293
293
|
function ThemeProvider({
|
|
294
294
|
theme,
|
|
@@ -312,10 +312,11 @@ var reduceMotionStyles = {
|
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
314
|
var Global = () => {
|
|
315
|
-
const { css
|
|
316
|
-
const styles =
|
|
315
|
+
const { css } = useTheme();
|
|
316
|
+
const styles = css({
|
|
317
317
|
html: {
|
|
318
318
|
height: "100%",
|
|
319
|
+
textSizeAdjust: "none",
|
|
319
320
|
variant: "root.html"
|
|
320
321
|
},
|
|
321
322
|
body: {
|
|
@@ -332,17 +333,24 @@ var Global = () => {
|
|
|
332
333
|
|
|
333
334
|
// src/SVG.tsx
|
|
334
335
|
import { jsx as jsx2 } from "@emotion/react";
|
|
335
|
-
var
|
|
336
|
+
var normalizedStyles = getNormalizedStyles("svg");
|
|
336
337
|
var SVG = (_a) => {
|
|
337
|
-
var _b = _a, {
|
|
338
|
-
|
|
338
|
+
var _b = _a, {
|
|
339
|
+
size = 24,
|
|
340
|
+
fill = "currentcolor",
|
|
341
|
+
children
|
|
342
|
+
} = _b, props = __objRest(_b, [
|
|
343
|
+
"size",
|
|
344
|
+
"fill",
|
|
345
|
+
"children"
|
|
346
|
+
]);
|
|
347
|
+
const { css } = useTheme();
|
|
348
|
+
return jsx2("svg", __spreadValues({
|
|
339
349
|
width: size,
|
|
340
350
|
height: size,
|
|
341
351
|
viewBox: "0 0 24 24",
|
|
342
|
-
|
|
343
|
-
}, props),
|
|
344
|
-
css
|
|
345
|
-
}), children);
|
|
352
|
+
css: css(__spreadValues({ fill }, normalizedStyles))
|
|
353
|
+
}, props), children);
|
|
346
354
|
};
|
|
347
355
|
|
|
348
356
|
// src/useResponsiveValue.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marigold/system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Marigold System Library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@emotion/react": "11.7.1",
|
|
30
30
|
"@marigold/types": "0.4.0",
|
|
31
31
|
"@theme-ui/css": "0.13.1",
|
|
32
|
-
"csstype": "3.0.
|
|
32
|
+
"csstype": "3.0.11"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^16.x || ^17.0.0",
|