lapikit 0.2.4 → 0.2.6

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.
@@ -4,6 +4,8 @@
4
4
  import { useTheme } from '../../actions/use-theme.js';
5
5
  import { modalOpen, setOpenModal } from '../../stores/components.js';
6
6
 
7
+ import { viewport } from '../../stores/viewport.js';
8
+
7
9
  let {
8
10
  children,
9
11
  themes,
@@ -29,6 +31,21 @@
29
31
  useTheme(colorScheme);
30
32
  }
31
33
  }
34
+
35
+ // Met à jour le store viewport à l'init et sur resize
36
+ function updateViewport() {
37
+ viewport.set({
38
+ innerWidth: window.innerWidth,
39
+ outerWidth: window.outerWidth,
40
+ innerHeight: window.innerHeight,
41
+ outerHeight: window.outerHeight
42
+ });
43
+ }
44
+ updateViewport();
45
+ window.addEventListener('resize', updateViewport);
46
+ return () => {
47
+ window.removeEventListener('resize', updateViewport);
48
+ };
32
49
  });
33
50
  </script>
34
51
 
@@ -58,7 +58,7 @@
58
58
  }
59
59
 
60
60
  .kit-card[breakpoint]kit-card--variant-outline {
61
- --card-color: var(--base, var(--kit-label-primary));
61
+ --card-color: var(--card-background, var(--kit-label-primary));
62
62
  background-color: transparent;
63
63
  }
64
64
  .kit-card[breakpoint]kit-card--variant-outline::before {
@@ -71,7 +71,7 @@
71
71
  }
72
72
 
73
73
  .kit-card[breakpoint]kit-card--variant-text {
74
- --card-color: var(--base, var(--kit-label-primary));
74
+ --card-color: var(--card-background, var(--kit-label-primary));
75
75
  background-color: transparent;
76
76
  border: none;
77
77
  }
@@ -20,6 +20,8 @@
20
20
  color,
21
21
  background,
22
22
  noRipple,
23
+ width,
24
+ height,
23
25
  ...rest
24
26
  }: CardProps = $props();
25
27
 
@@ -58,6 +60,8 @@
58
60
  style:--card-background={assets.color(background)}
59
61
  style:--card-color={assets.color(color)}
60
62
  style:--card-shape={assets.shape(rounded)}
63
+ style:width
64
+ style:height
61
65
  >
62
66
  {@render children?.()}
63
67
  </svelte:element>
@@ -14,5 +14,7 @@ export interface CardProps extends Component {
14
14
  rounded?: string;
15
15
  color?: string;
16
16
  background?: string;
17
+ width?: string | number;
18
+ height?: string | number;
17
19
  }
18
20
  export {};
@@ -9,11 +9,11 @@
9
9
  }
10
10
 
11
11
  .kit-icon:before {
12
- color: var(--icon-color, currentColor);
12
+ color: var(--icon-color-state, var(--icon-color, currentColor)) !important;
13
13
  }
14
14
 
15
15
  .kit-icon svg {
16
- color: var(--icon-color, currentColor);
16
+ color: var(--icon-color-state, var(--icon-color, currentColor)) !important;
17
17
  }
18
18
 
19
19
  .kit-icon svg,
@@ -49,16 +49,16 @@
49
49
 
50
50
  /* state */
51
51
  .kit-icon.kit-icon--info {
52
- --base: var(--kit-accent-info);
52
+ --icon-color-state: var(--kit-accent-info);
53
53
  }
54
54
  .kit-icon.kit-icon--success {
55
- --base: var(--kit-accent-successs);
55
+ --icon-color-state: var(--kit-accent-success);
56
56
  }
57
57
  .kit-icon.kit-icon--warning {
58
- --base: var(--kit-accent-warning);
58
+ --icon-color-state: var(--kit-accent-warning);
59
59
  }
60
60
  .kit-icon.kit-icon--error {
61
- --base: var(--kit-accent-destructive);
61
+ --icon-color-state: var(--kit-accent-destructive);
62
62
  }
63
63
 
64
64
  /* disabled */
@@ -9,11 +9,26 @@
9
9
  border-style: solid;
10
10
  }
11
11
 
12
+ .kit-separator--inset:not(.kit-separator--orientation-vertical) {
13
+ max-width: calc(100% - 4.5rem);
14
+ margin-inline-start: 4.5rem;
15
+ }
16
+
17
+ .kit-separator--inset.kit-separator--orientation-vertical {
18
+ margin-bottom: 0.5rem;
19
+ margin-top: 0.5rem;
20
+ max-height: calc(100% - 1rem);
21
+ }
22
+
12
23
  .kit-separator:not(.kit-separator--orientation-vertical) {
24
+ width: 100%;
25
+ }
26
+
27
+ .kit-separator[breakpoint]kit-separator--orientation-horizontal {
13
28
  border-width: var(--separator-top-width, thin) 0 0 0;
14
29
  }
15
30
 
16
- .kit-separator--orientation-vertical {
31
+ .kit-separator[breakpoint]kit-separator--orientation-vertical {
17
32
  align-self: stretch;
18
33
  border-width: 0 thin 0 0;
19
34
  display: inline-flex;
@@ -25,18 +40,3 @@
25
40
  width: 0px;
26
41
  border-width: 0 var(--separator-right-width, thin) 0 0;
27
42
  }
28
-
29
- .kit-separator--inset:not(.kit-separator--orientation-vertical) {
30
- max-width: calc(100% - 4.5rem);
31
- margin-inline-start: 4.5rem;
32
- }
33
-
34
- .kit-separator--inset.kit-separator--orientation-vertical {
35
- margin-bottom: 0.5rem;
36
- margin-top: 0.5rem;
37
- max-height: calc(100% - 1rem);
38
- }
39
-
40
- .kit-separator:not(.kit-separator--orientation-vertical) {
41
- width: 100%;
42
- }
@@ -28,7 +28,7 @@
28
28
  orientation && assets.className('separator', 'orientation', orientation),
29
29
  rest.class
30
30
  ]}
31
- aria-orientation={orientation}
31
+ aria-orientation={typeof orientation === 'string' ? orientation : undefined}
32
32
  role="separator"
33
33
  style:--separator-color={assets.color(color)}
34
34
  style:--separator-opacity={opacity}
@@ -1,4 +1,5 @@
1
1
  import type { Base } from '../../internal/types/index.js';
2
+ type Orientation = 'horizontal' | 'vertical';
2
3
  export interface SeparatorProps extends Base {
3
4
  is?: 'div' | 'hr';
4
5
  light?: boolean;
@@ -7,5 +8,8 @@ export interface SeparatorProps extends Base {
7
8
  thickness?: string;
8
9
  opacity?: string | number;
9
10
  color?: string;
10
- orientation?: 'horizontal' | 'vertical';
11
+ orientation?: Orientation | {
12
+ [key: string]: Orientation;
13
+ };
11
14
  }
15
+ export {};
@@ -11,9 +11,6 @@
11
11
  }
12
12
 
13
13
  /* density */
14
- .kit-toolbar[breakpoint]kit-toolbar--density-default {
15
- border-radius: calc(var(--system-spacing) * 2.25);
16
- }
17
14
  .kit-toolbar[breakpoint]kit-toolbar--density-default:not([class*='toolbar--orientation-vertical']) {
18
15
  height: 3rem;
19
16
  padding-inline: calc(var(--system-spacing) * 1.5);
@@ -24,10 +21,6 @@
24
21
  padding: calc(var(--system-spacing) * 1.5) 0;
25
22
  }
26
23
 
27
- .kit-toolbar[breakpoint]kit-toolbar--density-compact {
28
- border-radius: calc(var(--system-spacing) * 1.75);
29
- }
30
-
31
24
  .kit-toolbar[breakpoint]kit-toolbar--density-compact:not([class*='toolbar--orientation-vertical']) {
32
25
  height: 2.625rem;
33
26
  padding-inline: calc(var(--system-spacing) * 0.75);
@@ -38,10 +31,6 @@
38
31
  padding: calc(var(--system-spacing) * 0.75) 0;
39
32
  }
40
33
 
41
- .kit-toolbar[breakpoint]kit-toolbar--density-comfortable {
42
- border-radius: calc(var(--system-spacing) * 3.5);
43
- }
44
-
45
34
  .kit-toolbar[breakpoint]kit-toolbar--density-comfortable:not(
46
35
  [class*='toolbar--orientation-vertical']
47
36
  ) {
@@ -2,3 +2,4 @@ export * from './breakpoints.js';
2
2
  export * from './devices.js';
3
3
  export * from './themes.js';
4
4
  export * from './components.js';
5
+ export * from './viewport.js';
@@ -2,3 +2,4 @@ export * from './breakpoints.js';
2
2
  export * from './devices.js';
3
3
  export * from './themes.js';
4
4
  export * from './components.js';
5
+ export * from './viewport.js';
@@ -0,0 +1,7 @@
1
+ export type Viewport = {
2
+ innerWidth: number;
3
+ outerWidth: number;
4
+ innerHeight: number;
5
+ outerHeight: number;
6
+ };
7
+ export declare const viewport: import("svelte/store").Writable<Viewport>;
@@ -0,0 +1,7 @@
1
+ import { writable } from 'svelte/store';
2
+ export const viewport = writable({
3
+ innerWidth: 0,
4
+ outerWidth: 0,
5
+ innerHeight: 0,
6
+ outerHeight: 0
7
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lapikit",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"