lapikit 0.0.0-insiders.fd1a829 → 0.0.0-insiders.fd9617d

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.
Files changed (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -1
  3. package/bin/configuration.js +303 -0
  4. package/bin/helper.js +59 -0
  5. package/bin/index.js +33 -0
  6. package/bin/presets.js +26 -0
  7. package/bin/prompts.js +67 -0
  8. package/dist/actions/accordion.svelte.d.ts +9 -0
  9. package/dist/actions/accordion.svelte.js +24 -0
  10. package/dist/actions/index.d.ts +2 -0
  11. package/dist/actions/index.js +2 -0
  12. package/dist/actions/use-theme.d.ts +1 -0
  13. package/dist/actions/use-theme.js +18 -0
  14. package/dist/assets/icons/arrow-down.svelte +12 -0
  15. package/dist/assets/icons/arrow-down.svelte.d.ts +18 -0
  16. package/dist/assets/icons/arrow-up.svelte +12 -0
  17. package/dist/assets/icons/arrow-up.svelte.d.ts +18 -0
  18. package/dist/assets/icons/close-fill.svelte +12 -0
  19. package/dist/assets/icons/close-fill.svelte.d.ts +18 -0
  20. package/dist/assets/icons/loading-fill.svelte +31 -0
  21. package/dist/assets/icons/loading-fill.svelte.d.ts +18 -0
  22. package/dist/components/accordion/accordion.css +36 -0
  23. package/dist/components/accordion/accordion.svelte +39 -0
  24. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  25. package/dist/components/accordion/modules/accordion-item.css +68 -0
  26. package/dist/components/accordion/modules/accordion-item.svelte +94 -0
  27. package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
  28. package/dist/components/accordion/types.d.ts +33 -0
  29. package/dist/components/accordion/types.js +1 -0
  30. package/dist/components/alert/alert.css +130 -0
  31. package/dist/components/alert/alert.svelte +89 -0
  32. package/dist/components/alert/alert.svelte.d.ts +4 -0
  33. package/dist/components/alert/types.d.ts +28 -0
  34. package/dist/components/alert/types.js +1 -0
  35. package/dist/components/app/app.css +26 -0
  36. package/dist/components/app/app.svelte +79 -0
  37. package/dist/components/app/app.svelte.d.ts +4 -0
  38. package/dist/components/app/types.d.ts +10 -0
  39. package/dist/components/app/types.js +1 -0
  40. package/dist/components/appbar/appbar.css +38 -0
  41. package/dist/components/appbar/appbar.svelte +40 -0
  42. package/dist/components/appbar/appbar.svelte.d.ts +4 -0
  43. package/dist/components/appbar/types.d.ts +15 -0
  44. package/dist/components/appbar/types.js +1 -0
  45. package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
  46. package/dist/components/aspect-ratio/aspect-ratio.svelte +25 -0
  47. package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
  48. package/dist/components/aspect-ratio/types.d.ts +5 -0
  49. package/dist/components/aspect-ratio/types.js +1 -0
  50. package/dist/components/avatar/avatar.css +102 -0
  51. package/dist/components/avatar/avatar.svelte +46 -0
  52. package/dist/components/avatar/avatar.svelte.d.ts +4 -0
  53. package/dist/components/avatar/types.d.ts +22 -0
  54. package/dist/components/avatar/types.js +1 -0
  55. package/dist/components/button/button.css +240 -0
  56. package/dist/components/button/button.svelte +102 -0
  57. package/dist/components/button/button.svelte.d.ts +4 -0
  58. package/dist/components/button/types.d.ts +29 -0
  59. package/dist/components/button/types.js +1 -0
  60. package/dist/components/card/card.css +105 -0
  61. package/dist/components/card/card.svelte +67 -0
  62. package/dist/components/card/card.svelte.d.ts +4 -0
  63. package/dist/components/card/types.d.ts +20 -0
  64. package/dist/components/card/types.js +1 -0
  65. package/dist/components/chip/chip.css +224 -0
  66. package/dist/components/chip/chip.svelte +131 -0
  67. package/dist/components/chip/chip.svelte.d.ts +4 -0
  68. package/dist/components/chip/types.d.ts +32 -0
  69. package/dist/components/chip/types.js +1 -0
  70. package/dist/components/dialog/dialog.css +129 -0
  71. package/dist/components/dialog/dialog.svelte +67 -0
  72. package/dist/components/dialog/dialog.svelte.d.ts +4 -0
  73. package/dist/components/dialog/types.d.ts +24 -0
  74. package/dist/components/dialog/types.js +1 -0
  75. package/dist/components/dropdown/dropdown.css +13 -0
  76. package/dist/components/dropdown/dropdown.svelte +115 -0
  77. package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
  78. package/dist/components/dropdown/types.d.ts +26 -0
  79. package/dist/components/dropdown/types.js +1 -0
  80. package/dist/components/icon/icon.css +78 -0
  81. package/dist/components/icon/icon.svelte +49 -0
  82. package/dist/components/icon/icon.svelte.d.ts +4 -0
  83. package/dist/components/icon/types.d.ts +16 -0
  84. package/dist/components/icon/types.js +1 -0
  85. package/dist/components/index.d.ts +22 -0
  86. package/dist/components/index.js +23 -0
  87. package/dist/components/list/list.css +149 -0
  88. package/dist/components/list/list.svelte +44 -0
  89. package/dist/components/list/list.svelte.d.ts +4 -0
  90. package/dist/components/list/modules/list-item.css +67 -0
  91. package/dist/components/list/modules/list-item.svelte +76 -0
  92. package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
  93. package/dist/components/list/types.d.ts +33 -0
  94. package/dist/components/list/types.js +1 -0
  95. package/dist/components/modal/modal.css +137 -0
  96. package/dist/components/modal/modal.svelte +112 -0
  97. package/dist/components/modal/modal.svelte.d.ts +4 -0
  98. package/dist/components/modal/types.d.ts +26 -0
  99. package/dist/components/modal/types.js +1 -0
  100. package/dist/components/popover/popover.css +13 -0
  101. package/dist/components/popover/popover.svelte +73 -0
  102. package/dist/components/popover/popover.svelte.d.ts +4 -0
  103. package/dist/components/popover/types.d.ts +20 -0
  104. package/dist/components/popover/types.js +1 -0
  105. package/dist/components/separator/separator.css +42 -0
  106. package/dist/components/separator/separator.svelte +37 -0
  107. package/dist/components/separator/separator.svelte.d.ts +4 -0
  108. package/dist/components/separator/types.d.ts +15 -0
  109. package/dist/components/separator/types.js +1 -0
  110. package/dist/components/spacer/spacer.css +3 -0
  111. package/dist/components/spacer/spacer.svelte +7 -0
  112. package/dist/components/spacer/spacer.svelte.d.ts +4 -0
  113. package/dist/components/spacer/types.d.ts +4 -0
  114. package/dist/components/spacer/types.js +1 -0
  115. package/dist/components/textfield/textfield.css +298 -0
  116. package/dist/components/textfield/textfield.svelte +193 -0
  117. package/dist/components/textfield/textfield.svelte.d.ts +4 -0
  118. package/dist/components/textfield/types.d.ts +37 -0
  119. package/dist/components/textfield/types.js +1 -0
  120. package/dist/components/toolbar/toolbar.css +106 -0
  121. package/dist/components/toolbar/toolbar.svelte +47 -0
  122. package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
  123. package/dist/components/toolbar/types.d.ts +27 -0
  124. package/dist/components/toolbar/types.js +1 -0
  125. package/dist/components/tooltip/tooltip.css +116 -0
  126. package/dist/components/tooltip/tooltip.svelte +113 -0
  127. package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
  128. package/dist/components/tooltip/types.d.ts +23 -0
  129. package/dist/components/tooltip/types.js +1 -0
  130. package/dist/entry-bundler.d.ts +12 -0
  131. package/dist/entry-bundler.js +107 -0
  132. package/dist/index.d.ts +3 -1
  133. package/dist/index.js +23 -3
  134. package/dist/internal/config/presets.d.ts +149 -0
  135. package/dist/internal/config/presets.js +169 -0
  136. package/dist/internal/config/variables.d.ts +3 -0
  137. package/dist/internal/config/variables.js +3 -0
  138. package/dist/internal/core/actions/assets.svelte.d.ts +8 -0
  139. package/dist/internal/core/actions/assets.svelte.js +54 -0
  140. package/dist/internal/core/actions/dropdown.svelte.d.ts +7 -0
  141. package/dist/internal/core/actions/dropdown.svelte.js +148 -0
  142. package/dist/internal/core/actions/popover.svelte.d.ts +7 -0
  143. package/dist/internal/core/actions/popover.svelte.js +134 -0
  144. package/dist/internal/core/actions/tooltip.svelte.d.ts +7 -0
  145. package/dist/internal/core/actions/tooltip.svelte.js +131 -0
  146. package/dist/internal/core/animations/ripple.d.ts +12 -0
  147. package/dist/internal/core/animations/ripple.js +93 -0
  148. package/dist/{server/modules → internal/core/bin}/ansi.d.ts +0 -1
  149. package/dist/{server/modules → internal/core/bin}/ansi.js +0 -11
  150. package/dist/internal/core/bin/terminal.d.ts +1 -0
  151. package/dist/internal/core/bin/terminal.js +12 -0
  152. package/dist/internal/core/css.d.ts +1 -0
  153. package/dist/internal/core/css.js +16 -0
  154. package/dist/internal/core/formatter/component.d.ts +5 -0
  155. package/dist/internal/core/formatter/component.js +60 -0
  156. package/dist/internal/core/formatter/device.d.ts +5 -0
  157. package/dist/internal/core/formatter/device.js +66 -0
  158. package/dist/internal/core/formatter/index.d.ts +7 -0
  159. package/dist/internal/core/formatter/index.js +35 -0
  160. package/dist/internal/core/formatter/style.d.ts +4 -0
  161. package/dist/internal/core/formatter/style.js +15 -0
  162. package/dist/internal/core/formatter/theme.d.ts +5 -0
  163. package/dist/internal/core/formatter/theme.js +44 -0
  164. package/dist/internal/core/formatter/typography.d.ts +5 -0
  165. package/dist/internal/core/formatter/typography.js +12 -0
  166. package/dist/internal/core/standard-colors.d.ts +75 -0
  167. package/dist/internal/core/standard-colors.js +75 -0
  168. package/dist/{server/modules/x11.d.ts → internal/core/x11-colors.d.ts} +1 -1
  169. package/dist/internal/helpers/colors.d.ts +1 -0
  170. package/dist/{server/modules → internal/helpers}/colors.js +2 -2
  171. package/dist/internal/helpers/convert.d.ts +1 -0
  172. package/dist/internal/helpers/convert.js +17 -0
  173. package/dist/internal/helpers/deep-merge.d.ts +44 -0
  174. package/dist/internal/helpers/deep-merge.js +80 -0
  175. package/dist/internal/helpers/outside.d.ts +9 -0
  176. package/dist/internal/helpers/outside.js +34 -0
  177. package/dist/internal/helpers/parser.d.ts +10 -0
  178. package/dist/internal/helpers/parser.js +93 -0
  179. package/dist/internal/helpers/scroll.d.ts +1 -0
  180. package/dist/internal/helpers/scroll.js +5 -0
  181. package/dist/internal/plugins/vite.d.ts +8 -0
  182. package/dist/internal/plugins/vite.js +33 -0
  183. package/dist/internal/types/components.d.ts +14 -0
  184. package/dist/internal/types/components.js +1 -0
  185. package/dist/internal/types/configuration.d.ts +63 -0
  186. package/dist/internal/types/configuration.js +1 -0
  187. package/dist/internal/types/index.d.ts +2 -0
  188. package/dist/internal/types/index.js +2 -0
  189. package/dist/labs/components/btn/btn.svelte +13 -0
  190. package/dist/labs/components/btn/btn.svelte.d.ts +5 -0
  191. package/dist/labs/components/index.d.ts +1 -0
  192. package/dist/labs/components/index.js +2 -0
  193. package/dist/stores/breakpoints.d.ts +6 -0
  194. package/dist/stores/breakpoints.js +14 -0
  195. package/dist/stores/components.d.ts +8 -0
  196. package/dist/stores/components.js +26 -0
  197. package/dist/stores/devices.d.ts +6 -0
  198. package/dist/stores/devices.js +9 -0
  199. package/dist/stores/index.d.ts +5 -0
  200. package/dist/stores/index.js +5 -0
  201. package/dist/stores/themes.d.ts +2 -0
  202. package/dist/stores/themes.js +4 -0
  203. package/dist/stores/viewport.d.ts +7 -0
  204. package/dist/stores/viewport.js +7 -0
  205. package/dist/styles/animation.css +33 -0
  206. package/dist/styles/keyframes.css +30 -0
  207. package/dist/styles/{normalize.css → reset.css} +15 -5
  208. package/dist/styles.css.d.ts +4 -0
  209. package/dist/themes.css +0 -0
  210. package/dist/themes.css.d.ts +4 -0
  211. package/package.json +135 -74
  212. package/dist/app.d.ts +0 -13
  213. package/dist/app.html +0 -12
  214. package/dist/server/modules/colors.d.ts +0 -1
  215. package/dist/server/modules/css.d.ts +0 -1
  216. package/dist/server/modules/css.js +0 -144
  217. package/dist/server/modules/devices.d.ts +0 -1
  218. package/dist/server/modules/devices.js +0 -43
  219. package/dist/server/modules/importer.d.ts +0 -1
  220. package/dist/server/modules/importer.js +0 -13
  221. package/dist/server/modules/themes.d.ts +0 -4
  222. package/dist/server/modules/themes.js +0 -94
  223. package/dist/server/vite.d.ts +0 -11
  224. package/dist/server/vite.js +0 -17
  225. package/dist/styles/variables.css +0 -7
  226. /package/dist/{server/modules → internal/core}/minify.d.ts +0 -0
  227. /package/dist/{server/modules → internal/core}/minify.js +0 -0
  228. /package/dist/{server/modules/x11.js → internal/core/x11-colors.js} +0 -0
@@ -0,0 +1,28 @@
1
+ import type { Component } from '../../internal/types/index.js';
2
+ import type { Snippet } from 'svelte';
3
+ type AlertDensity = 'compact' | 'comfortable' | 'default';
4
+ type AlertVariant = 'outline' | 'dash' | 'text';
5
+ export interface AlertProps extends Component {
6
+ append?: Snippet;
7
+ prepend?: Snippet;
8
+ close?: Snippet;
9
+ href?: string;
10
+ is?: 'div';
11
+ dark?: boolean;
12
+ light?: boolean;
13
+ variant?: AlertVariant | {
14
+ [key: string]: AlertVariant;
15
+ };
16
+ density?: AlertDensity | {
17
+ [key: string]: AlertDensity;
18
+ };
19
+ rounded?: string;
20
+ closable?: boolean;
21
+ color?: string;
22
+ background?: string;
23
+ warning?: boolean;
24
+ info?: boolean;
25
+ success?: boolean;
26
+ error?: boolean;
27
+ }
28
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ #kit-app,
2
+ .kit-application {
3
+ -webkit-text-size-adjust: 100%;
4
+ tab-size: 4;
5
+ line-height: 1.5;
6
+ box-sizing: border-box;
7
+ font-family: var(--kit-font-sans);
8
+ background-color: var(--kit-background-primary);
9
+ color: var(--kit-label-primary);
10
+ }
11
+
12
+ .kit-overlay {
13
+ position: fixed;
14
+ top: 0;
15
+ left: 0;
16
+ height: 100%;
17
+ width: 100%;
18
+ background-color: color-mix(in oklab, black 75%, transparent);
19
+ z-index: 9000;
20
+ cursor: default;
21
+ }
22
+
23
+ .kit-overlay.kit-overlay--persistent {
24
+ user-select: none;
25
+ cursor: default;
26
+ }
@@ -0,0 +1,79 @@
1
+ <script lang="ts">
2
+ const BROWSER = typeof window !== 'undefined';
3
+ import { useTheme } from '../../actions/use-theme.js';
4
+ import { modalOpen, setOpenModal } from '../../stores/components.js';
5
+
6
+ import { viewport } from '../../stores/viewport.js';
7
+ import type { AppProps } from './types.js';
8
+
9
+ let {
10
+ ref = $bindable(),
11
+ children,
12
+ themes,
13
+ storageKey = '@lapikit/theme',
14
+ light,
15
+ dark,
16
+ ...rest
17
+ }: AppProps = $props();
18
+
19
+ $effect.pre(() => {
20
+ if (!BROWSER) return;
21
+ const colorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches
22
+ ? 'dark'
23
+ : 'light';
24
+ const localTheme = localStorage.getItem(storageKey);
25
+
26
+ if (localTheme) {
27
+ useTheme(localTheme);
28
+ } else if (colorScheme) {
29
+ if (typeof themes === 'string') {
30
+ useTheme(themes);
31
+ } else if (typeof themes === 'object' && Array.isArray(themes)) {
32
+ if (colorScheme === 'dark') useTheme(themes[1] ?? themes[0]);
33
+ else useTheme(themes[0]);
34
+ } else {
35
+ useTheme(colorScheme);
36
+ }
37
+ }
38
+
39
+ // Met à jour le store viewport à l'init et sur resize
40
+ function updateViewport() {
41
+ viewport.set({
42
+ innerWidth: window.innerWidth,
43
+ outerWidth: window.outerWidth,
44
+ innerHeight: window.innerHeight,
45
+ outerHeight: window.outerHeight
46
+ });
47
+ }
48
+ updateViewport();
49
+ window.addEventListener('resize', updateViewport);
50
+ return () => {
51
+ window.removeEventListener('resize', updateViewport);
52
+ };
53
+ });
54
+ </script>
55
+
56
+ <div
57
+ id="kit-app"
58
+ bind:this={ref}
59
+ {...rest}
60
+ class={[
61
+ 'kit-application',
62
+ light && 'light',
63
+ dark && 'dark',
64
+ light && 'kit-theme--light',
65
+ dark && 'kit-theme--dark',
66
+ rest.class
67
+ ]}
68
+ >
69
+ {@render children?.()}
70
+
71
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
72
+ {#if $modalOpen}
73
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
74
+ <div
75
+ class={['kit-overlay', $modalOpen === 'persistent' && 'kit-overlay--persistent']}
76
+ onclick={() => $modalOpen !== 'persistent' && setOpenModal(false)}
77
+ ></div>
78
+ {/if}
79
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { AppProps } from './types.js';
2
+ declare const App: import("svelte").Component<AppProps, {}, "ref">;
3
+ type App = ReturnType<typeof App>;
4
+ export default App;
@@ -0,0 +1,10 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ export interface AppProps extends HTMLAttributes<HTMLDivElement> {
4
+ ref?: HTMLDivElement;
5
+ children?: Snippet;
6
+ themes?: string | string[];
7
+ storageKey?: string;
8
+ light?: boolean;
9
+ dark?: boolean;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ .kit-appbar {
2
+ --appbar-padding-wrapper: var(--system-spacing) * 4;
3
+
4
+ display: flex;
5
+ align-items: center;
6
+ border-style: solid;
7
+ border-width: 1px;
8
+ border-radius: var(--appbar-shape);
9
+ color: var(--appbar-color, var(--kit-label-primary));
10
+ background-color: var(--appbar-background, var(--kit-background-grouped-tertiary));
11
+ border-color: var(--appbar-background, var(--kit-background-grouped-tertiary));
12
+ }
13
+
14
+ /* wrapper */
15
+ .kit-appbar .kit-appbar--wrapper {
16
+ display: flex;
17
+ align-items: center;
18
+ flex-direction: row;
19
+ height: calc(100% - (var(--appbar-padding-wrapper) * 2));
20
+ width: calc(100% - (var(--appbar-padding-wrapper) * 2));
21
+ margin: 0 auto;
22
+ }
23
+
24
+ /* density */
25
+ .kit-appbar[breakpoint]kit-appbar--density-default {
26
+ height: 4rem;
27
+ padding-inline: calc(var(--system-spacing) * 1.5);
28
+ }
29
+
30
+ .kit-appbar[breakpoint]kit-appbar--density-compact {
31
+ height: 3.5rem;
32
+ padding-inline: calc(var(--system-spacing) * 0.75);
33
+ }
34
+
35
+ .kit-appbar[breakpoint]kit-appbar--density-comfortable {
36
+ height: 4.5rem;
37
+ padding-inline: calc(var(--system-spacing) * 2.25);
38
+ }
@@ -0,0 +1,40 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/core/actions/assets.svelte.js';
3
+ import type { AppbarProps } from './types.js';
4
+
5
+ let {
6
+ children,
7
+ ref = $bindable(),
8
+ is = 'header',
9
+ classContent,
10
+ light,
11
+ dark,
12
+ rounded,
13
+ background,
14
+ color,
15
+ density = 'default',
16
+ ...rest
17
+ }: AppbarProps = $props();
18
+
19
+ const assets = getAssets();
20
+ </script>
21
+
22
+ <svelte:element
23
+ this={is}
24
+ bind:this={ref}
25
+ {...rest}
26
+ class={[
27
+ 'kit-appbar',
28
+ light && 'light',
29
+ dark && 'dark',
30
+ density && assets.className('appbar', 'density', density),
31
+ rest.class
32
+ ]}
33
+ style:--appbar-background={assets.color(background)}
34
+ style:--appbar-color={assets.color(color)}
35
+ style:--appbar-shape={assets.shape(rounded)}
36
+ >
37
+ <div class={['kit-appbar--wrapper', classContent]}>
38
+ {@render children?.()}
39
+ </div>
40
+ </svelte:element>
@@ -0,0 +1,4 @@
1
+ import type { AppbarProps } from './types.js';
2
+ declare const Appbar: import("svelte").Component<AppbarProps, {}, "ref">;
3
+ type Appbar = ReturnType<typeof Appbar>;
4
+ export default Appbar;
@@ -0,0 +1,15 @@
1
+ import type { Component } from '../../internal/types/index.js';
2
+ type Density = 'compact' | 'comfortable' | 'default';
3
+ export interface AppbarProps extends Component {
4
+ is?: 'div' | 'header' | 'nav';
5
+ rounded?: string;
6
+ density?: Density | {
7
+ [key: string]: Density;
8
+ };
9
+ dark?: boolean;
10
+ light?: boolean;
11
+ color?: string;
12
+ background?: string;
13
+ classContent?: string | string[] | undefined;
14
+ }
15
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ .kit-aspect-ratio {
2
+ display: flex;
3
+ flex: 1 0 auto;
4
+ max-height: 100%;
5
+ max-width: 100%;
6
+ overflow: hidden;
7
+ position: relative;
8
+ }
9
+
10
+ .kit-aspect-ratio--inline {
11
+ display: inline-flex;
12
+ flex: 0 0 auto;
13
+ }
14
+
15
+ .kit-aspect-ratio--sizer {
16
+ flex: 1 0 0px;
17
+ transition: padding-bottom 0.2s cubic-bezier(0.4, 0, 0.2, 1);
18
+ pointer-events: none;
19
+ }
@@ -0,0 +1,25 @@
1
+ <script lang="ts">
2
+ import type { AspectRationProps } from './types.js';
3
+ let { children, aspectRatio, inline, ...rest }: AspectRationProps = $props();
4
+
5
+ let paddingBottom = $state(0);
6
+
7
+ $effect.pre(() => {
8
+ if (aspectRatio) {
9
+ const [width, height] = aspectRatio.split('/').map(Number);
10
+ paddingBottom = (height / width) * 100;
11
+ }
12
+ });
13
+
14
+ $effect(() => {
15
+ if (aspectRatio) {
16
+ const [width, height] = aspectRatio.split('/').map(Number);
17
+ paddingBottom = (height / width) * 100;
18
+ }
19
+ });
20
+ </script>
21
+
22
+ <div {...rest} class={['kit-aspect-ratio', inline && 'kit-aspect-ratio--inline', rest.class]}>
23
+ <div class="kit-aspect-ratio--sizer" style={`padding-bottom: ${paddingBottom}%;`}></div>
24
+ {@render children?.()}
25
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { AspectRationProps } from './types.js';
2
+ declare const AspectRatio: import("svelte").Component<AspectRationProps, {}, "">;
3
+ type AspectRatio = ReturnType<typeof AspectRatio>;
4
+ export default AspectRatio;
@@ -0,0 +1,5 @@
1
+ import type { Component } from '../../internal/types/index.js';
2
+ export interface AspectRationProps extends Component {
3
+ aspectRatio?: string;
4
+ inline?: boolean;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,102 @@
1
+ .kit-avatar {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ white-space: nowrap;
6
+ padding-top: var(--avatar-spacing-x);
7
+ padding-bottom: var(--avatar-spacing-x);
8
+ padding-right: var(--avatar-spacing-y);
9
+ padding-left: var(--avatar-spacing-y);
10
+ border-width: 1px;
11
+ border-style: solid;
12
+ border-radius: var(--avatar-shape, var(--system-shape-full));
13
+ color: var(--avatar-color, var(--kit-label-primary));
14
+ background-color: var(--avatar-background, var(--kit-background-secondary));
15
+ border-color: var(--avatar-background, var(--kit-background-secondary));
16
+ }
17
+
18
+ .kit-avatar.kit-avatar--image {
19
+ position: relative;
20
+ overflow: hidden;
21
+ }
22
+
23
+ .kit-avatar.kit-avatar--image img {
24
+ position: relative;
25
+ top: 0;
26
+ left: 0;
27
+ width: 100%;
28
+ height: 100%;
29
+ object-fit: cover;
30
+ }
31
+
32
+ /* size */
33
+ .kit-avatar[breakpoint]kit-avatar--size-xs {
34
+ --avatar-height: 1.75rem;
35
+ --avatar-multiplier-y: 2;
36
+ font-size: 0.75rem;
37
+ }
38
+
39
+ .kit-avatar[breakpoint]kit-avatar--size-sm {
40
+ --avatar-height: 2rem;
41
+ --avatar-multiplier-y: 3;
42
+ font-size: 0.875rem;
43
+ }
44
+
45
+ .kit-avatar[breakpoint]kit-avatar--size-md {
46
+ --avatar-height: 2.25rem;
47
+ --avatar-multiplier-y: 4;
48
+ font-size: 0.875rem;
49
+ }
50
+
51
+ .kit-avatar[breakpoint]kit-avatar--size-lg {
52
+ --avatar-height: 2.5rem;
53
+ --avatar-multiplier-y: 5;
54
+ font-size: 1rem;
55
+ }
56
+
57
+ .kit-avatar[breakpoint]kit-avatar--size-xl {
58
+ --avatar-height: 2.75rem;
59
+ --avatar-multiplier-y: 6;
60
+ font-size: 1.125rem;
61
+ }
62
+
63
+ /* density */
64
+ .kit-avatar[breakpoint]kit-avatar--density-default {
65
+ height: calc(var(--avatar-height));
66
+ width: calc(var(--avatar-height));
67
+ --avatar-spacing-x: 0;
68
+ --avatar-spacing-y: 0;
69
+ }
70
+
71
+ .kit-avatar[breakpoint]kit-avatar--density-compact {
72
+ height: calc(var(--avatar-height) - 0.25rem);
73
+ width: calc(var(--avatar-height) - 0.25rem);
74
+ --avatar-spacing-x: 0;
75
+ --avatar-spacing-y: 0;
76
+ }
77
+
78
+ .kit-avatar[breakpoint]kit-avatar--density-comfortable {
79
+ height: calc(var(--avatar-height) + 0.25rem);
80
+ width: calc(var(--avatar-height) + 0.25rem);
81
+ --avatar-spacing-x: 0;
82
+ --avatar-spacing-y: 0;
83
+ }
84
+
85
+ /* variant */
86
+ .kit-avatar[breakpoint]kit-avatar--variant-outline {
87
+ --avatar-color: var(--base, var(--kit-background-grouped-tertiary));
88
+ background-color: transparent;
89
+ border: 1px solid currentColor;
90
+ }
91
+
92
+ .kit-avatar[breakpoint]kit-avatar--variant-text {
93
+ --avatar-color: var(--base, var(--kit-background-grouped-tertiary));
94
+ background-color: transparent;
95
+ border-color: transparent;
96
+ }
97
+
98
+ .kit-avatar[breakpoint]kit-avatar--variant-dash {
99
+ --avatar-color: var(--base, var(--kit-background-grouped-tertiary));
100
+ background-color: transparent;
101
+ border: 1px dashed currentColor;
102
+ }
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/core/actions/assets.svelte.js';
3
+ import type { AvatarProps } from './types.js';
4
+ let {
5
+ children,
6
+ ref = $bindable(),
7
+ light,
8
+ dark,
9
+ size = 'md',
10
+ rounded,
11
+ alt,
12
+ background,
13
+ color,
14
+ src,
15
+ variant,
16
+ density = 'default',
17
+ ...rest
18
+ }: AvatarProps = $props();
19
+
20
+ const assets = getAssets();
21
+ </script>
22
+
23
+ <svelte:element
24
+ this={'div'}
25
+ bind:this={ref}
26
+ {...rest}
27
+ class={[
28
+ 'kit-avatar',
29
+ light && 'light',
30
+ dark && 'dark',
31
+ src && 'kit-avatar--image',
32
+ size && assets.className('avatar', 'size', size),
33
+ variant && assets.className('avatar', 'variant', variant),
34
+ density && assets.className('avatar', 'density', density),
35
+ rest.class
36
+ ]}
37
+ style:--avatar-background={assets.color(background)}
38
+ style:--avatar-color={assets.color(color)}
39
+ style:--avatar-shape={assets.shape(rounded)}
40
+ >
41
+ {#if src}
42
+ <img {src} {alt} />
43
+ {:else}
44
+ {@render children?.()}
45
+ {/if}
46
+ </svelte:element>
@@ -0,0 +1,4 @@
1
+ import type { AvatarProps } from './types.js';
2
+ declare const Avatar: import("svelte").Component<AvatarProps, {}, "ref">;
3
+ type Avatar = ReturnType<typeof Avatar>;
4
+ export default Avatar;
@@ -0,0 +1,22 @@
1
+ import type { Component } from '../../internal/types/index.js';
2
+ type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
3
+ type AvatarDensity = 'compact' | 'comfortable' | 'default';
4
+ type AvatarVariant = 'outline' | 'text' | 'dash';
5
+ export interface AvatarProps extends Component {
6
+ ref?: HTMLElement | null;
7
+ dark?: boolean;
8
+ light?: boolean;
9
+ color?: string;
10
+ background?: string;
11
+ src?: string;
12
+ size?: AvatarSize | {
13
+ [key: string]: AvatarSize;
14
+ };
15
+ variant?: AvatarVariant | {
16
+ [key: string]: AvatarVariant;
17
+ };
18
+ density?: AvatarDensity | {
19
+ [key: string]: AvatarDensity;
20
+ };
21
+ }
22
+ export {};
@@ -0,0 +1 @@
1
+ export {};