tinywidgets 0.0.6 → 0.0.8

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/index.css.ts CHANGED
@@ -1 +1 @@
1
- export {accent, accentContrast, theme} from './src/index.css.ts';
1
+ export {accentHue, theme} from './src/index.css.ts';
package/media.ts CHANGED
@@ -1 +1 @@
1
- export {large} from './src/index.ts';
1
+ export {large, small} from './src/index.ts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinywidgets",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinywidgets",
6
6
  "module": "index.ts",
@@ -1,6 +1,6 @@
1
- import { style } from '@vanilla-extract/css';
2
- import { dimensions, paddingLike, theme } from '../../../index.css.ts';
3
- import { large } from '../../../index.ts';
1
+ import {style} from '@vanilla-extract/css';
2
+ import {dimensions, paddingLike, theme} from '../../../index.css.ts';
3
+ import {large} from '../../../index.ts';
4
4
 
5
5
  export const sideNav = style([
6
6
  paddingLike,
@@ -11,9 +11,9 @@ export const sideNav = style([
11
11
  borderRight: `1px solid ${theme.border}`,
12
12
  width: dimensions.sideNavWidth,
13
13
  bottom: 0,
14
- left: '-' + dimensions.sideNavWidth,
14
+ left: dimensions.sideNavWidthHidden,
15
15
  top: dimensions.topNavHeight,
16
- height: `calc(100vh - ${dimensions.topNavHeight})`,
16
+ height: `calc(100dvh - ${dimensions.topNavHeight})`,
17
17
  overscrollBehavior: 'contain',
18
18
  transition: 'left .2s ease-in-out',
19
19
  },
@@ -1,9 +1,9 @@
1
- import { style } from '@vanilla-extract/css';
2
- import { theme } from '../index.css.ts';
1
+ import {style} from '@vanilla-extract/css';
2
+ import {theme} from '../index.css.ts';
3
3
 
4
4
  export const ui = style({
5
5
  display: 'flex',
6
- height: '100vh',
7
- width: '100vw',
6
+ height: '100dvh',
7
+ width: '100dvw',
8
8
  color: theme.foreground,
9
9
  });
package/src/index.css.ts CHANGED
@@ -6,12 +6,16 @@ import {
6
6
  globalStyle,
7
7
  style,
8
8
  } from '@vanilla-extract/css';
9
+ import {small} from './';
9
10
 
10
- export const accent = createVar();
11
- export const accentContrast = createVar();
11
+ export const accentHue = createVar();
12
12
 
13
13
  export const theme = createThemeContract({
14
+ accentHue: null,
15
+ backgroundHue: null,
14
16
  accent: null,
17
+ accentLight: null,
18
+ accentHover: null,
15
19
  accentContrast: null,
16
20
  underneath: null,
17
21
  background: null,
@@ -22,37 +26,41 @@ export const theme = createThemeContract({
22
26
  foreground2: null,
23
27
  border: null,
24
28
  shadow: null,
25
- accentHover: null,
26
29
  });
27
30
 
31
+ const themeCommon = {
32
+ accentHue: fallbackVar(accentHue, '8'),
33
+ backgroundHue: `calc(${theme.accentHue} + 180)`,
34
+ accent: `oklch(50% .11 ${theme.accentHue})`,
35
+ accentLight: `oklch(71% .16 ${theme.accentHue})`,
36
+ accentHover: `oklch(45% .1 ${theme.accentHue})`,
37
+ accentContrast: '#fff',
38
+ };
39
+
28
40
  const light = {
29
- accent: fallbackVar(accent, '#d81b60'),
30
- accentContrast: fallbackVar(accentContrast, `#fff`),
41
+ ...themeCommon,
31
42
  underneath: '#fff',
32
- background: `oklch(from ${theme.accent} 98% 1% calc(h + 180))`,
33
- background2: `oklch(from ${theme.accent} 95% 1% calc(h + 180))`,
34
- backgroundHaze: `oklch(from ${theme.background} l c h / .5)`,
35
- backgroundHover: `oklch(from ${theme.accent} 90% 1% calc(h + 180))`,
36
- foreground: `oklch(from ${theme.accent} 30% 1% h)`,
37
- foreground2: `oklch(from ${theme.accent} 50% 1% h)`,
38
- border: `oklch(from ${theme.accent} 90% 1% calc(h + 180))`,
43
+ background: `oklch(99% .01 ${theme.backgroundHue})`,
44
+ background2: `oklch(95% .01 ${theme.backgroundHue})`,
45
+ backgroundHaze: `oklch(99% .01 ${theme.backgroundHue} / .5)`,
46
+ backgroundHover: `oklch(90% .01 ${theme.backgroundHue})`,
47
+ foreground: `oklch(30% .01 ${theme.accentHue})`,
48
+ foreground2: `oklch(50% .01 ${theme.accentHue})`,
49
+ border: `oklch(90% .01 ${theme.backgroundHue})`,
39
50
  shadow: '0 1px 4px 0 hsl(0 0 20 / .1)',
40
- accentHover: `oklch(from ${theme.accent} calc(l * 90%) c h)`,
41
51
  };
42
52
 
43
53
  const dark = {
44
- accent: fallbackVar(accent, '#d81b60'),
45
- accentContrast: fallbackVar(accentContrast, `#fff`),
54
+ ...themeCommon,
46
55
  underneath: '#000',
47
- background: `oklch(from ${theme.accent} 20% 1% calc(h + 180))`,
48
- background2: `oklch(from ${theme.accent} 15% 1% calc(h + 180))`,
49
- backgroundHaze: `oklch(from ${theme.background} 21% 0% h / .5)`,
50
- backgroundHover: `oklch(from ${theme.accent} 25% 1% calc(h + 180))`,
51
- foreground: `oklch(from ${theme.accent} 90% 1% h)`,
52
- foreground2: `oklch(from ${theme.accent} 50% 1% h)`,
53
- border: `oklch(from ${theme.accent} 30% 1% calc(h + 180))`,
56
+ background: `oklch(20% .01 ${theme.backgroundHue})`,
57
+ background2: `oklch(15% .01 ${theme.backgroundHue})`,
58
+ backgroundHaze: `oklch(21% 0% ${theme.backgroundHue} / .5)`,
59
+ backgroundHover: `oklch(25% .01 ${theme.backgroundHue})`,
60
+ foreground: `oklch(90% .01 ${theme.accentHue})`,
61
+ foreground2: `oklch(50% .01 ${theme.accentHue})`,
62
+ border: `oklch(30% .01 ${theme.backgroundHue})`,
54
63
  shadow: '0 1px 4px 0 #000',
55
- accentHover: `oklch(from ${theme.accent} calc(l * 90%) c h)`,
56
64
  };
57
65
 
58
66
  export const dimensions = {
@@ -60,6 +68,7 @@ export const dimensions = {
60
68
  radius: '0.5rem',
61
69
  titleWidth: '18rem',
62
70
  sideNavWidth: '20rem',
71
+ sideNavWidthHidden: '-30rem',
63
72
  topNavHeight: '4rem',
64
73
  articleWidth: '60rem',
65
74
  footerHeight: '10rem',
@@ -103,6 +112,9 @@ globalStyle('html', {
103
112
  lineHeight: '1.5em',
104
113
  textRendering: 'optimizeLegibility',
105
114
  fontWeight: 400,
115
+ ...small({
116
+ fontSize: '12px',
117
+ }),
106
118
  });
107
119
 
108
120
  globalStyle('h1', {fontSize: '1.5rem'});
package/src/index.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import type {StyleRule} from '@vanilla-extract/css';
3
3
 
4
- const LARGE = 'screen and (min-width: 1000px)';
4
+ const LARGE = 'screen and (min-width: 768px)';
5
+ const SMALL = 'screen and (max-width: 450px)';
5
6
 
6
7
  export const {
7
8
  createElement,
@@ -14,9 +15,11 @@ export const {
14
15
  } = React;
15
16
 
16
17
  export const large = (style: StyleRule) => ({
17
- '@media': {
18
- [LARGE]: style,
19
- },
18
+ '@media': {[LARGE]: style},
19
+ });
20
+
21
+ export const small = (style: StyleRule) => ({
22
+ '@media': {[SMALL]: style},
20
23
  });
21
24
 
22
25
  export const classNames = (...classes: (string | boolean | undefined)[]) =>