lapikit 0.0.0-insiders.6717134 → 0.0.0-insiders.687c781

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 (184) hide show
  1. package/README.md +117 -1
  2. package/bin/helper.js +0 -38
  3. package/bin/prompts.js +1 -1
  4. package/dist/actions/accordion.svelte.d.ts +9 -0
  5. package/dist/actions/index.d.ts +2 -1
  6. package/dist/actions/index.js +2 -1
  7. package/dist/actions/use-theme.d.ts +1 -0
  8. package/dist/actions/use-theme.js +18 -0
  9. package/dist/components/accordion/accordion.css +0 -73
  10. package/dist/components/accordion/accordion.svelte +2 -2
  11. package/dist/components/accordion/modules/accordion-item.css +68 -0
  12. package/dist/components/accordion/modules/accordion-item.svelte +4 -4
  13. package/dist/components/accordion/types.d.ts +1 -1
  14. package/dist/components/alert/alert.css +11 -11
  15. package/dist/components/alert/alert.svelte +2 -2
  16. package/dist/components/alert/types.d.ts +1 -1
  17. package/dist/components/app/app.css +12 -1
  18. package/dist/components/app/app.svelte +68 -37
  19. package/dist/components/app/app.svelte.d.ts +2 -5
  20. package/dist/components/app/types.d.ts +7 -1
  21. package/dist/components/appbar/appbar.css +4 -4
  22. package/dist/components/appbar/appbar.svelte +2 -2
  23. package/dist/components/appbar/types.d.ts +1 -1
  24. package/dist/components/aspect-ratio/types.d.ts +1 -1
  25. package/dist/components/avatar/avatar.css +7 -7
  26. package/dist/components/avatar/avatar.svelte +1 -1
  27. package/dist/components/avatar/types.d.ts +1 -1
  28. package/dist/components/button/button.css +15 -15
  29. package/dist/components/button/button.svelte +2 -2
  30. package/dist/components/button/types.d.ts +1 -1
  31. package/dist/components/card/card.css +6 -16
  32. package/dist/components/card/card.svelte +6 -2
  33. package/dist/components/card/types.d.ts +3 -1
  34. package/dist/components/chip/chip.css +17 -17
  35. package/dist/components/chip/chip.svelte +2 -2
  36. package/dist/components/chip/types.d.ts +1 -1
  37. package/dist/components/dialog/dialog.css +5 -5
  38. package/dist/components/dialog/dialog.svelte +2 -2
  39. package/dist/components/dialog/types.d.ts +1 -1
  40. package/dist/components/dropdown/dropdown.css +3 -3
  41. package/dist/components/dropdown/dropdown.svelte +3 -4
  42. package/dist/components/dropdown/types.d.ts +1 -1
  43. package/dist/components/icon/icon.css +6 -6
  44. package/dist/components/icon/icon.svelte +1 -1
  45. package/dist/components/icon/types.d.ts +1 -1
  46. package/dist/components/list/list.css +16 -77
  47. package/dist/components/list/list.svelte +1 -1
  48. package/dist/components/list/modules/list-item.css +67 -0
  49. package/dist/components/list/modules/list-item.svelte +2 -2
  50. package/dist/components/list/types.d.ts +1 -1
  51. package/dist/components/modal/modal.css +10 -11
  52. package/dist/components/modal/modal.svelte +1 -2
  53. package/dist/components/modal/types.d.ts +1 -1
  54. package/dist/components/popover/popover.css +3 -3
  55. package/dist/components/popover/popover.svelte +3 -3
  56. package/dist/components/popover/types.d.ts +1 -1
  57. package/dist/components/separator/separator.css +17 -17
  58. package/dist/components/separator/separator.svelte +2 -2
  59. package/dist/components/separator/types.d.ts +6 -2
  60. package/dist/components/spacer/types.d.ts +1 -1
  61. package/dist/components/textfield/textfield.css +8 -8
  62. package/dist/components/textfield/textfield.svelte +2 -2
  63. package/dist/components/textfield/types.d.ts +1 -1
  64. package/dist/components/toolbar/toolbar.css +5 -16
  65. package/dist/components/toolbar/toolbar.svelte +2 -2
  66. package/dist/components/toolbar/types.d.ts +1 -1
  67. package/dist/components/tooltip/tooltip.css +5 -5
  68. package/dist/components/tooltip/tooltip.svelte +3 -3
  69. package/dist/components/tooltip/types.d.ts +1 -1
  70. package/dist/entry-bundler.d.ts +9 -0
  71. package/dist/entry-bundler.js +64 -0
  72. package/dist/index.d.ts +2 -26
  73. package/dist/index.js +1 -5
  74. package/dist/internal/config/presets.d.ts +71 -49
  75. package/dist/internal/config/presets.js +72 -41
  76. package/dist/internal/config/variables.d.ts +1 -5
  77. package/dist/internal/config/variables.js +1 -5
  78. package/dist/internal/{assets.svelte.js → core/actions/assets.svelte.js} +4 -4
  79. package/dist/internal/core/actions/dropdown.svelte.d.ts +7 -0
  80. package/dist/internal/core/actions/popover.svelte.d.ts +7 -0
  81. package/dist/internal/core/actions/tooltip.svelte.d.ts +7 -0
  82. package/dist/internal/{ripple.js → core/animations/ripple.js} +1 -1
  83. package/dist/internal/core/formatter/component.js +0 -6
  84. package/dist/internal/core/formatter/device.js +37 -36
  85. package/dist/internal/core/formatter/index.d.ts +1 -1
  86. package/dist/internal/core/formatter/index.js +1 -1
  87. package/dist/internal/core/formatter/theme.js +20 -5
  88. package/dist/internal/core/formatter/typography.js +1 -1
  89. package/dist/internal/core/standard-colors.d.ts +75 -0
  90. package/dist/internal/core/standard-colors.js +75 -0
  91. package/dist/internal/helpers/parser.js +1 -1
  92. package/dist/internal/{scroll.js → helpers/scroll.js} +1 -2
  93. package/dist/internal/plugins/vite.js +5 -5
  94. package/dist/internal/types/components.d.ts +14 -0
  95. package/dist/internal/types/configuration.d.ts +24 -1
  96. package/dist/internal/types/index.d.ts +1 -0
  97. package/dist/internal/types/index.js +1 -0
  98. package/dist/labs/components/button/button.svelte +24 -0
  99. package/dist/labs/components/button/button.svelte.d.ts +5 -0
  100. package/dist/labs/components/index.d.ts +2 -0
  101. package/dist/labs/components/index.js +3 -0
  102. package/dist/stores/components.js +1 -1
  103. package/dist/stores/index.d.ts +1 -0
  104. package/dist/stores/index.js +1 -0
  105. package/dist/stores/themes.d.ts +0 -6
  106. package/dist/stores/themes.js +1 -31
  107. package/dist/stores/viewport.d.ts +7 -0
  108. package/dist/stores/viewport.js +7 -0
  109. package/dist/styles/reset.css +8 -6
  110. package/dist/styles.css.d.ts +4 -0
  111. package/dist/themes.css.d.ts +4 -0
  112. package/package.json +135 -96
  113. package/bin/lapikit.js +0 -86
  114. package/bin/legacy.js +0 -34
  115. package/bin/modules/adapter.js +0 -52
  116. package/bin/modules/plugin.js +0 -223
  117. package/bin/modules/preset.js +0 -11
  118. package/dist/app.d.ts +0 -13
  119. package/dist/app.html +0 -12
  120. package/dist/internal/colors.d.ts +0 -1
  121. package/dist/internal/colors.js +0 -50
  122. package/dist/internal/index.d.ts +0 -4
  123. package/dist/internal/index.js +0 -4
  124. package/dist/internal/types.d.ts +0 -57
  125. package/dist/internal/unit.d.ts +0 -1
  126. package/dist/internal/unit.js +0 -11
  127. package/dist/labs/index.d.ts +0 -4
  128. package/dist/labs/index.js +0 -5
  129. package/dist/labs/my-component-style-global.svelte +0 -6
  130. package/dist/labs/my-component-style-global.svelte.d.ts +0 -18
  131. package/dist/labs/my-component-style-import.svelte +0 -15
  132. package/dist/labs/my-component-style-import.svelte.d.ts +0 -18
  133. package/dist/labs/my-component-style-mixed.svelte +0 -23
  134. package/dist/labs/my-component-style-mixed.svelte.d.ts +0 -18
  135. package/dist/labs/my-component.svelte +0 -16
  136. package/dist/labs/my-component.svelte.d.ts +0 -18
  137. package/dist/labs/style-mixed.css +0 -7
  138. package/dist/labs/style.css +0 -7
  139. package/dist/labs.css +0 -1
  140. package/dist/plugin/css.d.ts +0 -1
  141. package/dist/plugin/css.js +0 -73
  142. package/dist/plugin/modules/config.d.ts +0 -2
  143. package/dist/plugin/modules/config.js +0 -54
  144. package/dist/plugin/modules/importer.d.ts +0 -1
  145. package/dist/plugin/modules/importer.js +0 -15
  146. package/dist/plugin/preset-v2.d.ts +0 -108
  147. package/dist/plugin/preset-v2.js +0 -126
  148. package/dist/plugin/vitejs.d.ts +0 -10
  149. package/dist/plugin/vitejs.js +0 -55
  150. package/dist/preset.d.ts +0 -2
  151. package/dist/preset.js +0 -92
  152. package/dist/style/animation.css +0 -62
  153. package/dist/style/css.d.ts +0 -2
  154. package/dist/style/css.js +0 -34
  155. package/dist/style/normalize.css +0 -125
  156. package/dist/style/parser/color.d.ts +0 -5
  157. package/dist/style/parser/color.js +0 -88
  158. package/dist/style/parser/component.d.ts +0 -2
  159. package/dist/style/parser/component.js +0 -115
  160. package/dist/style/parser/device.d.ts +0 -2
  161. package/dist/style/parser/device.js +0 -40
  162. package/dist/style/parser/index.d.ts +0 -4
  163. package/dist/style/parser/index.js +0 -4
  164. package/dist/style/parser/variable.d.ts +0 -2
  165. package/dist/style/parser/variable.js +0 -25
  166. package/dist/style/variable.css +0 -12
  167. package/dist/utils/x11.d.ts +0 -4
  168. package/dist/utils/x11.js +0 -151
  169. /package/dist/{components/accordion → actions}/accordion.svelte.js +0 -0
  170. /package/dist/internal/{assets.svelte.d.ts → core/actions/assets.svelte.d.ts} +0 -0
  171. /package/dist/{components/dropdown → internal/core/actions}/dropdown.svelte.js +0 -0
  172. /package/dist/{components/popover → internal/core/actions}/popover.svelte.js +0 -0
  173. /package/dist/{components/tooltip → internal/core/actions}/tooltip.svelte.js +0 -0
  174. /package/dist/internal/{ripple.d.ts → core/animations/ripple.d.ts} +0 -0
  175. /package/dist/internal/{ansi.d.ts → core/bin/ansi.d.ts} +0 -0
  176. /package/dist/internal/{ansi.js → core/bin/ansi.js} +0 -0
  177. /package/dist/internal/{terminal.d.ts → core/bin/terminal.d.ts} +0 -0
  178. /package/dist/internal/{terminal.js → core/bin/terminal.js} +0 -0
  179. /package/dist/{utils → internal/helpers}/convert.d.ts +0 -0
  180. /package/dist/{utils → internal/helpers}/convert.js +0 -0
  181. /package/dist/internal/{clickOutside.d.ts → helpers/outside.d.ts} +0 -0
  182. /package/dist/internal/{clickOutside.js → helpers/outside.js} +0 -0
  183. /package/dist/internal/{scroll.d.ts → helpers/scroll.d.ts} +0 -0
  184. /package/dist/internal/{types.js → types/components.js} +0 -0
package/README.md CHANGED
@@ -1 +1,117 @@
1
- # Lapikit
1
+ <a href="https://lapikit.dev">
2
+ <img src="https://raw.githubusercontent.com/Nycolaide/lapikit/main/.github/lapikit.svg" alt="Lapikit Logo" width="125">
3
+ </a>
4
+
5
+ # Lapikit - Svelte components library
6
+
7
+ [![][discover-lapikit-npm]](https://www.npmjs.com/package/lapikit)
8
+ [![][subscribe-to-instagram]](https://www.instagram.com/lapikit/)
9
+ [![][join-discord-lapikit]](https://discord.gg/gn9ZGtDtK4)
10
+
11
+ [![][version]](https://github.com/nycolaide/lapikit/releases?q=lapikit&expanded=true)
12
+ [![][installs]](https://www.npmjs.com/package/lapikit)
13
+ [![][installs-this-month]](https://www.npmjs.com/package/lapikit)
14
+ [![][license]](https://github.com/nycolaide/lapikit/blob/main/LICENSE)
15
+ [![][discord]](https://discord.gg/gn9ZGtDtK4)
16
+
17
+ Lapikit is a comprehensive Svelte components library that provides developers with a wide range of pre-built, customizable UI components to streamline the development process. Whether you're building a simple website or a complex web application, Lapikit has the tools you need to create beautiful and functional user interfaces with ease.
18
+
19
+ ## 🖥️ Documentation
20
+
21
+ To check out the documentation, visit [lapikit.dev](https://lapikit.dev)
22
+
23
+ ## ✨Quick Start
24
+
25
+ Getting started with Lapikit is easy. After create you SvelteKit project, you can install Lapikit using your preferred package manager:
26
+
27
+ Usage [bun](https://bun.sh/):
28
+
29
+ ```bash
30
+ bun add -d lapikit
31
+ npx lapikit
32
+ ```
33
+
34
+ Using [npm](https://www.npmjs.com/):
35
+
36
+ ```bash
37
+ npm i -D lapikit
38
+ npx lapikit
39
+ ```
40
+
41
+ Using [yarn](https://yarnpkg.com/):
42
+
43
+ ```bash
44
+ yarn add -D lapikit
45
+ npx lapikit
46
+ ```
47
+
48
+ Using [pnpm](https://pnpm.io/):
49
+
50
+ ```bash
51
+ pnpm add -D lapikit
52
+ npx lapikit
53
+ ```
54
+
55
+ ## 🚩Table of Contents
56
+
57
+ - [Lapikit - Svelte components library](#lapikit---svelte-components-library)
58
+ - [🖥️ Documentation](#️-documentation)
59
+ - [✨Quick Start](#quick-start)
60
+ - [🚩Table of Contents](#table-of-contents)
61
+ - [🤯Motivation](#motivation)
62
+ - [💖Community](#community)
63
+ - [💁‍♂️Contributing](#️contributing)
64
+ - [🖖Core Team Lapikit](#core-team-lapikit)
65
+ - [📄License](#license)
66
+ - [🪧We support these projects](#we-support-these-projects)
67
+
68
+ ## 🤯Motivation
69
+
70
+ Lapikit has created to help Svelte developers save time and effort when building user interfaces. By providing a wide range of pre-built components, Lapikit allows developers to focus on building their applications rather than spending time designing and coding UI elements from scratch.
71
+
72
+ ## 💖Community
73
+
74
+ Join our growing community on [Discord](https://discord.gg/gn9ZGtDtK4) and [GitHub Discussions](https://github.com/nycolaide/lapikit/discussions) where we discuss and collaborate on all things Lapikit. Don't be shy, jump right in and be part of the discussion!
75
+
76
+ ## 💁‍♂️Contributing
77
+
78
+ Be part of the next revolution in code editing by contributing to the project. This is a community-led effort, so we welcome as many contributors who can help. Read the Contribution Guide for more information.
79
+
80
+ ## 🖖Core Team Lapikit
81
+
82
+ [@Nycolaide](https://github.com/Nycolaide)
83
+ [@Simone](https://github.com/fersimone)
84
+
85
+ ## 📄License
86
+
87
+ Licensed under the [MIT license](https://github.com/nycolaide/lapikit/blob/main/LICENSE).
88
+
89
+ Copyright © 2025 Nycolaide
90
+
91
+ ## 🪧We support these projects
92
+
93
+ We are proud supporters of the open-source community and contribute to several projects that help make the web a better place. Here are some of the projects we support:
94
+
95
+ <table>
96
+ <tr>
97
+ <td>
98
+ <a href="https://www.w3.org/">
99
+ <img src="https://raw.githubusercontent.com/Nycolaide/lapikit/main/.github/w3c.svg" alt="W3C" width="75">
100
+ </a>
101
+ </td>
102
+ <td>
103
+ <a href="https://humanstxt.org/">
104
+ <img src="https://raw.githubusercontent.com/Nycolaide/lapikit/main/.github/humans.png" alt="Humans.txt" width="115">
105
+ </a>
106
+ </td>
107
+ </tr>
108
+ </table>
109
+
110
+ [discover-lapikit-npm]: https://img.shields.io/badge/Lapikit-black.svg?style=for-the-badge&logo=NPM
111
+ [join-discord-lapikit]: https://img.shields.io/badge/Join%20the%20community-black.svg?style=for-the-badge&logo=Discord
112
+ [subscribe-to-instagram]: https://img.shields.io/badge/Follow%20@Lapikit-black.svg?style=for-the-badge&logo=Instagram
113
+ [version]: https://img.shields.io/npm/v/lapikit.svg?label=Version&color=f58142
114
+ [license]: https://badgen.net/github/license/nycolaide/lapikit?label=License&color=cc5640
115
+ [installs]: https://badgen.net/npm/dt/lapikit?label=NPM%20installs&color=40ba12
116
+ [installs-this-month]: https://badgen.net/npm/dm/lapikit?label=NPM%20installs&color=40ba12
117
+ [discord]: https://img.shields.io/discord/1383879204671721492?color=5865F2&label=Discord&logo=discord&logoColor=white
package/bin/helper.js CHANGED
@@ -1,6 +1,3 @@
1
- import { promises as fs } from 'fs';
2
- import path from 'path';
3
-
4
1
  const color = {
5
2
  red: (text) => `\x1b[31m${text}\x1b[0m`,
6
3
  green: (text) => `\x1b[32m${text}\x1b[0m`,
@@ -60,38 +57,3 @@ export const terminal = (type = 'info', msg) => {
60
57
  else if (type === 'none') console.log(msg);
61
58
  else console.log(name, ansi.bold.blue('[info]'), msg);
62
59
  };
63
-
64
- export function getCssPathFromArgs() {
65
- const args = process.argv.slice(2);
66
- return args[1] || 'src/app.css';
67
- }
68
-
69
- export function getLapikitPathFromArgs() {
70
- const args = process.argv.slice(2);
71
- // Search argument after --plugin-path or -p
72
- const pluginPathIndex = args.findIndex((arg) => arg === '--plugin-path' || arg === '-p');
73
- if (pluginPathIndex !== -1 && args[pluginPathIndex + 1]) {
74
- return args[pluginPathIndex + 1];
75
- }
76
- return 'src/plugin';
77
- }
78
-
79
- export function validatePluginPath(pluginPath) {
80
- if (!pluginPath.startsWith('src/')) {
81
- return {
82
- valid: false,
83
- error: 'The path must start with "src/"'
84
- };
85
- }
86
- return { valid: true };
87
- }
88
-
89
- export async function envTypescript() {
90
- const directory = process.cwd();
91
- try {
92
- await fs.readFile(path.resolve(directory, 'tsconfig.json'), 'utf-8');
93
- return true;
94
- } catch {
95
- return false;
96
- }
97
- }
package/bin/prompts.js CHANGED
@@ -18,7 +18,7 @@ export async function initPrompts() {
18
18
  }
19
19
 
20
20
  // Preview install
21
- let settings = await prompts([
21
+ const settings = await prompts([
22
22
  {
23
23
  type: 'text',
24
24
  name: 'pathConfig',
@@ -0,0 +1,9 @@
1
+ type AccordionOptions = {
2
+ multiple?: boolean;
3
+ readOnly?: boolean;
4
+ };
5
+ export declare function useAccordion({ multiple, readOnly }?: AccordionOptions): {
6
+ readonly values: (string | number)[];
7
+ toggle(id: string | number): void;
8
+ };
9
+ export {};
@@ -1 +1,2 @@
1
- export * from '../components/accordion/accordion.svelte.js';
1
+ export * from './accordion.svelte.js';
2
+ export * from './use-theme.js';
@@ -1 +1,2 @@
1
- export * from '../components/accordion/accordion.svelte.js';
1
+ export * from './accordion.svelte.js';
2
+ export * from './use-theme.js';
@@ -0,0 +1 @@
1
+ export declare function useTheme(name: string, key?: string): void;
@@ -0,0 +1,18 @@
1
+ import { theme } from '../stores/themes.js';
2
+ // states
3
+ const isBrowser = typeof window !== 'undefined';
4
+ export function useTheme(name, key = '@lapikit/theme') {
5
+ theme.update(() => {
6
+ if (isBrowser) {
7
+ const html = document.documentElement;
8
+ html.classList.forEach((cls) => {
9
+ if (cls.startsWith('kit-theme--')) {
10
+ html.classList.remove(cls);
11
+ }
12
+ });
13
+ html.classList.add(`kit-theme--${name}`);
14
+ localStorage.setItem(key, name);
15
+ }
16
+ return name;
17
+ });
18
+ }
@@ -34,76 +34,3 @@
34
34
  pointer-events: none;
35
35
  user-select: none;
36
36
  }
37
-
38
- /* item */
39
- .kit-accordion .kit-accordion-item {
40
- flex: 1 0 100%;
41
- max-width: 100%;
42
- position: relative;
43
- transition: 0.3s all cubic-bezier(0.4, 0, 0.2, 1);
44
- transition-property: margin-top, border-radius, border, max-width;
45
- border-radius: var(--accordion-radius, var(--system-shape-md));
46
- color: var(--accordion-color, var(--system-label));
47
- background-color: var(--accordion-background, var(--system-secondary-background));
48
- /* transition:
49
- color 0.5s,
50
- background-color 0.5s; */
51
- }
52
-
53
- .kit-accordion .kit-accordion-item > button,
54
- .kit-accordion .kit-accordion-item > [type='button'] {
55
- font: inherit;
56
- overflow: visible;
57
- background-color: transparent;
58
- border-style: none;
59
- cursor: pointer;
60
- color: inherit;
61
- }
62
-
63
- .kit-accordion .kit-accordion-item .kit-accordion-item--title {
64
- align-items: center;
65
- text-align: start;
66
- border-radius: inherit;
67
- display: flex;
68
- font-size: 0.9375rem;
69
- min-height: 3rem;
70
- outline: none;
71
- padding: 1rem 1.5rem;
72
- position: relative;
73
- transition: 0.3s min-height margin-bottom margin-top border-radius cubic-bezier(0.4, 0, 0.2, 1);
74
- width: 100%;
75
- justify-content: space-between;
76
- }
77
-
78
- .kit-accordion .kit-accordion-item .kit-accordion-item--text {
79
- display: flex;
80
- }
81
-
82
- .kit-accordion .kit-accordion-item .kit-accordion-item--text .kit-accordion-item--text-wrapper {
83
- padding: 0.5rem 1.5rem 1rem;
84
- flex: 1 1 auto;
85
- max-width: 100%;
86
- }
87
-
88
- .kit-accordion .kit-accordion-item .kit-accordion-item--icon {
89
- display: inline-flex;
90
- margin-bottom: -0.25rem;
91
- margin-top: -0.25rem;
92
- -webkit-user-select: none;
93
- user-select: none;
94
- margin-inline-start: auto;
95
- }
96
-
97
- /* disabled */
98
- .kit-accordion .kit-accordion-item .kit-accordion-item--title.kit-accordion-item--disabled,
99
- .kit-accordion .kit-accordion-item .kit-accordion-item--title[disabled],
100
- .kit-accordion .kit-accordion-item .kit-accordion-item--title:disabled {
101
- pointer-events: none;
102
- user-select: none;
103
- }
104
-
105
- .kit-accordion .kit-accordion-item .kit-accordion-item--title.kit-accordion-item--disabled > *,
106
- .kit-accordion .kit-accordion-item .kit-accordion-item--title[disabled] > *,
107
- .kit-accordion .kit-accordion-item .kit-accordion-item--title:disabled > * {
108
- opacity: 0.6;
109
- }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { getAssets } from '../../internal/assets.svelte.js';
2
+ import { getAssets } from '../../internal/core/actions/assets.svelte.js';
3
3
  import type { AccordionProps } from './types.js';
4
4
 
5
5
  let {
@@ -31,7 +31,7 @@
31
31
  dark && 'dark',
32
32
  rest.class
33
33
  ]}
34
- style:--accordion-radius={assets.shape(rounded)}
34
+ style:--accordion-shape={assets.shape(rounded)}
35
35
  style:--accordion-background={assets.color(background)}
36
36
  style:--accordion-color={assets.color(color)}
37
37
  >
@@ -0,0 +1,68 @@
1
+ .kit-accordion-item {
2
+ flex: 1 0 100%;
3
+ max-width: 100%;
4
+ position: relative;
5
+ transition: 0.3s all cubic-bezier(0.4, 0, 0.2, 1);
6
+ transition-property: margin-top, border-radius, border, max-width;
7
+ border-radius: var(--accordion-shape, var(--system-shape-md));
8
+ color: var(--accordion-color, var(--kit-label-primary));
9
+ background-color: var(--accordion-background, var(--kit-background-grouped-primary));
10
+ }
11
+
12
+ .kit-accordion-item > button,
13
+ .kit-accordion-item > [type='button'] {
14
+ font: inherit;
15
+ overflow: visible;
16
+ background-color: transparent;
17
+ border-style: none;
18
+ cursor: pointer;
19
+ color: inherit;
20
+ }
21
+
22
+ .kit-accordion-item .kit-accordion-item--title {
23
+ align-items: center;
24
+ text-align: start;
25
+ border-radius: inherit;
26
+ display: flex;
27
+ font-size: 0.9375rem;
28
+ min-height: 3rem;
29
+ outline: none;
30
+ padding: 1rem 1.5rem;
31
+ position: relative;
32
+ transition: 0.3s min-height margin-bottom margin-top border-radius cubic-bezier(0.4, 0, 0.2, 1);
33
+ width: 100%;
34
+ justify-content: space-between;
35
+ }
36
+
37
+ .kit-accordion-item .kit-accordion-item--text {
38
+ display: flex;
39
+ }
40
+
41
+ .kit-accordion-item .kit-accordion-item--text .kit-accordion-item--text-wrapper {
42
+ padding: 0.5rem 1.5rem 1rem;
43
+ flex: 1 1 auto;
44
+ max-width: 100%;
45
+ }
46
+
47
+ .kit-accordion-item .kit-accordion-item--icon {
48
+ display: inline-flex;
49
+ margin-bottom: -0.25rem;
50
+ margin-top: -0.25rem;
51
+ -webkit-user-select: none;
52
+ user-select: none;
53
+ margin-inline-start: auto;
54
+ }
55
+
56
+ /* disabled */
57
+ .kit-accordion-item .kit-accordion-item--title.kit-accordion-item--disabled,
58
+ .kit-accordion-item .kit-accordion-item--title[disabled],
59
+ .kit-accordion-item .kit-accordion-item--title:disabled {
60
+ pointer-events: none;
61
+ user-select: none;
62
+ }
63
+
64
+ .kit-accordion-item .kit-accordion-item--title.kit-accordion-item--disabled > *,
65
+ .kit-accordion-item .kit-accordion-item--title[disabled] > *,
66
+ .kit-accordion-item .kit-accordion-item--title:disabled > * {
67
+ opacity: 0.6;
68
+ }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { getAssets } from '../../../internal/assets.svelte.js';
2
+ import { getAssets } from '../../../internal/core/actions/assets.svelte.js';
3
3
  import type { AccordionItemProps, ModelAccordionItemProps } from '../types.js';
4
4
 
5
5
  // components
@@ -49,9 +49,9 @@
49
49
  open && 'kit-accordion-item--active',
50
50
  rest.class
51
51
  ]}
52
- style:--base={assets.color(background)}
53
- style:--on={assets.color(color)}
54
- style:--shape={assets.shape(rounded)}
52
+ style:--accordion--item-shape={assets.shape(rounded)}
53
+ style:--accordion--item-background={assets.color(background)}
54
+ style:--accordion--item-color={assets.color(color)}
55
55
  >
56
56
  <button
57
57
  class={[
@@ -1,4 +1,4 @@
1
- import type { Component } from '../../internal/types.js';
1
+ import type { Component } from '../../internal/types/index.js';
2
2
  import type { Snippet } from 'svelte';
3
3
  export interface AccordionProps extends Component {
4
4
  ref?: HTMLElement | null;
@@ -8,9 +8,9 @@
8
8
  position: relative;
9
9
  padding: 1rem;
10
10
  overflow: hidden;
11
- color: var(--alert-color, var(--system-label));
12
- background-color: var(--alert-background, var(--system-tertiary-background));
13
- border-radius: var(--alert-radius, var(--system-shape-md));
11
+ color: var(--alert-color, var(--kit-label-primary));
12
+ background-color: var(--alert-background, var(--kit-background-grouped-tertiary));
13
+ border-radius: var(--alert-shape, var(--system-shape-md));
14
14
  line-height: 0;
15
15
  }
16
16
 
@@ -80,34 +80,34 @@
80
80
  /* state */
81
81
  .kit-alert.kit-alert--info:not([class*='alert--variant-']) {
82
82
  --on: var(--kit-on-info);
83
- --base: var(--kit-info);
83
+ --base: var(--kit-accent-info);
84
84
  }
85
85
  .kit-alert.kit-alert--info[class*='alert--variant-'] {
86
- --base: var(--kit-info);
86
+ --base: var(--kit-accent-info);
87
87
  }
88
88
 
89
89
  .kit-alert.kit-alert--success:not([class*='alert--variant-']) {
90
90
  --on: var(--kit-on-success);
91
- --base: var(--kit-success);
91
+ --base: var(--kit-accent-successs);
92
92
  }
93
93
  .kit-alert.kit-alert--success[class*='alert--variant-'] {
94
- --base: var(--kit-success);
94
+ --base: var(--kit-accent-successs);
95
95
  }
96
96
 
97
97
  .kit-alert.kit-alert--warning:not([class*='alert--variant-']) {
98
98
  --on: var(--kit-on-warning);
99
- --base: var(--kit-warning);
99
+ --base: var(--kit-accent-warning);
100
100
  }
101
101
  .kit-alert.kit-alert--warning[class*='alert--variant-'] {
102
- --base: var(--kit-warning);
102
+ --base: var(--kit-accent-warning);
103
103
  }
104
104
 
105
105
  .kit-alert.kit-alert--error:not([class*='alert--variant-']) {
106
106
  --on: var(--kit-on-error);
107
- --base: var(--kit-error);
107
+ --base: var(--kit-accent-destructive);
108
108
  }
109
109
  .kit-alert.kit-alert--error[class*='alert--variant-'] {
110
- --base: var(--kit-error);
110
+ --base: var(--kit-accent-destructive);
111
111
  }
112
112
 
113
113
  /* variant */
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { getAssets } from '../../internal/assets.svelte.js';
2
+ import { getAssets } from '../../internal/core/actions/assets.svelte.js';
3
3
  import type { AlertProps } from './types.js';
4
4
 
5
5
  // components
@@ -53,7 +53,7 @@
53
53
  role="alert"
54
54
  style:--alert-background={assets.color(background)}
55
55
  style:--alert-color={assets.color(color)}
56
- style:--alert-radius={assets.shape(rounded)}
56
+ style:--alert-shape={assets.shape(rounded)}
57
57
  >
58
58
  {#if prepend}
59
59
  <div class="kit-alert--prepend">
@@ -1,4 +1,4 @@
1
- import type { Component } from '../../internal/types.js';
1
+ import type { Component } from '../../internal/types/index.js';
2
2
  import type { Snippet } from 'svelte';
3
3
  type AlertDensity = 'compact' | 'comfortable' | 'default';
4
4
  type AlertVariant = 'outline' | 'dash' | 'text';
@@ -1,10 +1,21 @@
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
+
1
12
  .kit-overlay {
2
13
  position: fixed;
3
14
  top: 0;
4
15
  left: 0;
5
16
  height: 100%;
6
17
  width: 100%;
7
- background-color: color-mix(in oklab, var(--l-theme-scrim) 70%, transparent);
18
+ background-color: color-mix(in oklab, black 70%, transparent);
8
19
  z-index: 9000;
9
20
  cursor: default;
10
21
  }
@@ -1,48 +1,79 @@
1
1
  <script lang="ts">
2
- import { BROWSER } from 'esm-env';
3
- import {
4
- colorSchemeSystem,
5
- modalOpen,
6
- setOpenModal,
7
- useColorScheme,
8
- useTheme
9
- } from '../../stores/index.js';
10
- import type { Snippet } from 'svelte';
11
- let { children }: { children: Snippet } = $props();
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();
12
18
 
13
19
  $effect.pre(() => {
14
20
  if (!BROWSER) return;
15
- // system
16
- if (window.matchMedia) {
17
- colorSchemeSystem.set(
18
- window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
19
- );
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
+ }
20
37
  }
21
38
 
22
- // listener
23
- window
24
- .matchMedia('(prefers-color-scheme: dark)')
25
- .addEventListener('change', (event: MediaQueryListEvent) => {
26
- colorSchemeSystem.set(event.matches ? 'dark' : 'light');
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
27
46
  });
28
-
29
- // local
30
- const localColorScheme = localStorage.getItem('@lapikit/color-scheme');
31
- const localTheme = localStorage.getItem('@lapikit/theme');
32
-
33
- // apply local settings
34
- if (localColorScheme !== null) useColorScheme(localColorScheme as 'dark' | 'light' | 'system');
35
- if (localTheme !== null) useTheme(localTheme as string);
47
+ }
48
+ updateViewport();
49
+ window.addEventListener('resize', updateViewport);
50
+ return () => {
51
+ window.removeEventListener('resize', updateViewport);
52
+ };
36
53
  });
37
54
  </script>
38
55
 
39
- {@render children?.()}
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?.()}
40
70
 
41
- <!-- svelte-ignore a11y_no_static_element_interactions -->
42
- {#if $modalOpen}
43
- <!-- svelte-ignore a11y_click_events_have_key_events -->
44
- <div
45
- class={['kit-overlay', $modalOpen === 'persistent' && 'kit-overlay--persistent']}
46
- onclick={() => $modalOpen !== 'persistent' && setOpenModal(false)}
47
- ></div>
48
- {/if}
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>
@@ -1,7 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- type $$ComponentProps = {
3
- children: Snippet;
4
- };
5
- declare const App: import("svelte").Component<$$ComponentProps, {}, "">;
1
+ import type { AppProps } from './types.js';
2
+ declare const App: import("svelte").Component<AppProps, {}, "ref">;
6
3
  type App = ReturnType<typeof App>;
7
4
  export default App;
@@ -1,4 +1,10 @@
1
1
  import type { Snippet } from 'svelte';
2
- export interface AppProps {
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ export interface AppProps extends HTMLAttributes<HTMLDivElement> {
4
+ ref?: HTMLDivElement;
3
5
  children?: Snippet;
6
+ themes?: string | string[];
7
+ storageKey?: string;
8
+ light?: boolean;
9
+ dark?: boolean;
4
10
  }
@@ -5,10 +5,10 @@
5
5
  align-items: center;
6
6
  border-style: solid;
7
7
  border-width: 1px;
8
- border-radius: var(--appbar-radius, 0);
9
- color: var(--appbar-color, var(--system-label));
10
- background-color: var(--appbar-background, var(--system-tertiary-background));
11
- border-color: var(--appbar-background, var(--system-tertiary-background));
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
12
  }
13
13
 
14
14
  /* wrapper */