lapikit 0.2.3 → 0.2.4

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 (190) hide show
  1. package/bin/configuration.js +0 -1
  2. package/bin/helper.js +0 -38
  3. package/bin/index.js +1 -9
  4. package/bin/presets.js +1 -1
  5. package/bin/prompts.js +46 -79
  6. package/dist/actions/accordion.svelte.d.ts +9 -0
  7. package/dist/actions/index.d.ts +2 -1
  8. package/dist/actions/index.js +2 -1
  9. package/dist/actions/use-theme.d.ts +1 -0
  10. package/dist/actions/use-theme.js +18 -0
  11. package/dist/components/accordion/accordion.css +0 -77
  12. package/dist/components/accordion/accordion.svelte +5 -3
  13. package/dist/components/accordion/modules/accordion-item.css +68 -0
  14. package/dist/components/accordion/modules/accordion-item.svelte +4 -4
  15. package/dist/components/accordion/types.d.ts +1 -1
  16. package/dist/components/alert/alert.css +11 -18
  17. package/dist/components/alert/alert.svelte +4 -4
  18. package/dist/components/alert/types.d.ts +1 -1
  19. package/dist/components/app/app.css +1 -2
  20. package/dist/components/app/app.svelte +24 -28
  21. package/dist/components/app/app.svelte.d.ts +2 -0
  22. package/dist/components/appbar/appbar.css +8 -18
  23. package/dist/components/appbar/appbar.svelte +4 -4
  24. package/dist/components/appbar/types.d.ts +1 -1
  25. package/dist/components/aspect-ratio/aspect-ratio.svelte +0 -22
  26. package/dist/components/aspect-ratio/types.d.ts +1 -1
  27. package/dist/components/avatar/avatar.css +7 -14
  28. package/dist/components/avatar/avatar.svelte +4 -4
  29. package/dist/components/avatar/types.d.ts +1 -1
  30. package/dist/components/button/button.css +29 -36
  31. package/dist/components/button/button.svelte +5 -5
  32. package/dist/components/button/types.d.ts +1 -1
  33. package/dist/components/card/card.css +10 -20
  34. package/dist/components/card/card.svelte +5 -5
  35. package/dist/components/card/types.d.ts +1 -1
  36. package/dist/components/chip/chip.css +26 -33
  37. package/dist/components/chip/chip.svelte +5 -5
  38. package/dist/components/chip/types.d.ts +1 -1
  39. package/dist/components/dialog/dialog.css +13 -20
  40. package/dist/components/dialog/dialog.svelte +5 -5
  41. package/dist/components/dialog/types.d.ts +1 -1
  42. package/dist/components/dropdown/dropdown.css +3 -12
  43. package/dist/components/dropdown/dropdown.svelte +6 -7
  44. package/dist/components/dropdown/types.d.ts +1 -1
  45. package/dist/components/icon/icon.css +11 -12
  46. package/dist/components/icon/icon.svelte +2 -2
  47. package/dist/components/icon/types.d.ts +1 -1
  48. package/dist/components/list/list.css +19 -91
  49. package/dist/components/list/list.svelte +4 -4
  50. package/dist/components/list/modules/list-item.css +67 -0
  51. package/dist/components/list/modules/list-item.svelte +5 -5
  52. package/dist/components/list/types.d.ts +1 -1
  53. package/dist/components/modal/modal.css +15 -23
  54. package/dist/components/modal/modal.svelte +4 -5
  55. package/dist/components/modal/types.d.ts +1 -1
  56. package/dist/components/popover/popover.css +3 -12
  57. package/dist/components/popover/popover.svelte +6 -6
  58. package/dist/components/popover/types.d.ts +1 -1
  59. package/dist/components/separator/separator.css +4 -8
  60. package/dist/components/separator/separator.svelte +5 -5
  61. package/dist/components/separator/types.d.ts +1 -1
  62. package/dist/components/spacer/types.d.ts +1 -1
  63. package/dist/components/textfield/textfield.css +16 -23
  64. package/dist/components/textfield/textfield.svelte +4 -4
  65. package/dist/components/textfield/types.d.ts +1 -1
  66. package/dist/components/toolbar/toolbar.css +14 -26
  67. package/dist/components/toolbar/toolbar.svelte +4 -4
  68. package/dist/components/toolbar/types.d.ts +1 -1
  69. package/dist/components/tooltip/tooltip.css +5 -13
  70. package/dist/components/tooltip/tooltip.svelte +5 -5
  71. package/dist/components/tooltip/types.d.ts +1 -1
  72. package/dist/index.d.ts +2 -26
  73. package/dist/index.js +2 -6
  74. package/dist/internal/config/presets.d.ts +88 -47
  75. package/dist/internal/config/presets.js +89 -41
  76. package/dist/internal/config/variables.d.ts +1 -4
  77. package/dist/internal/config/variables.js +1 -4
  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} +3 -3
  83. package/dist/internal/core/css.d.ts +1 -0
  84. package/dist/internal/core/css.js +16 -0
  85. package/dist/internal/core/formatter/component.d.ts +1 -1
  86. package/dist/internal/core/formatter/component.js +25 -21
  87. package/dist/internal/core/formatter/device.d.ts +5 -0
  88. package/dist/internal/core/formatter/device.js +66 -0
  89. package/dist/internal/core/formatter/index.d.ts +5 -2
  90. package/dist/internal/core/formatter/index.js +15 -6
  91. package/dist/internal/core/formatter/{styles.d.ts → style.d.ts} +1 -1
  92. package/dist/internal/core/formatter/{styles.js → style.js} +3 -3
  93. package/dist/internal/core/formatter/theme.d.ts +1 -1
  94. package/dist/internal/core/formatter/theme.js +30 -6
  95. package/dist/internal/core/formatter/typography.d.ts +1 -1
  96. package/dist/internal/core/formatter/typography.js +2 -2
  97. package/dist/internal/core/standard-colors.d.ts +75 -0
  98. package/dist/internal/core/standard-colors.js +75 -0
  99. package/dist/internal/helpers/colors.d.ts +1 -0
  100. package/dist/internal/{colors.js → helpers/colors.js} +2 -2
  101. package/dist/internal/helpers/parser.d.ts +1 -0
  102. package/dist/internal/helpers/parser.js +43 -20
  103. package/dist/{plugin/vitejs.d.ts → internal/plugins/vite.d.ts} +1 -3
  104. package/dist/internal/plugins/vite.js +33 -0
  105. package/dist/internal/types/components.d.ts +14 -0
  106. package/dist/internal/types/configuration.d.ts +24 -1
  107. package/dist/internal/types/index.d.ts +1 -0
  108. package/dist/internal/types/index.js +1 -0
  109. package/dist/stores/components.js +1 -1
  110. package/dist/stores/themes.d.ts +0 -6
  111. package/dist/stores/themes.js +1 -31
  112. package/dist/styles/animation.css +33 -0
  113. package/dist/styles/keyframes.css +30 -0
  114. package/dist/{style/normalize.css → styles/reset.css} +15 -7
  115. package/package.json +7 -8
  116. package/bin/lapikit.js +0 -86
  117. package/bin/legacy.js +0 -34
  118. package/bin/modules/adapter.js +0 -52
  119. package/bin/modules/plugin.js +0 -223
  120. package/bin/modules/preset.js +0 -11
  121. package/dist/internal/colors.d.ts +0 -1
  122. package/dist/internal/core/parser-config.d.ts +0 -1
  123. package/dist/internal/core/parser-config.js +0 -24
  124. package/dist/internal/index.d.ts +0 -4
  125. package/dist/internal/index.js +0 -4
  126. package/dist/internal/types.d.ts +0 -57
  127. package/dist/internal/unit.d.ts +0 -1
  128. package/dist/internal/unit.js +0 -11
  129. package/dist/labs/index.d.ts +0 -4
  130. package/dist/labs/index.js +0 -5
  131. package/dist/labs/my-component-style-global.svelte +0 -6
  132. package/dist/labs/my-component-style-global.svelte.d.ts +0 -18
  133. package/dist/labs/my-component-style-import.svelte +0 -15
  134. package/dist/labs/my-component-style-import.svelte.d.ts +0 -18
  135. package/dist/labs/my-component-style-mixed.svelte +0 -23
  136. package/dist/labs/my-component-style-mixed.svelte.d.ts +0 -18
  137. package/dist/labs/my-component.svelte +0 -16
  138. package/dist/labs/my-component.svelte.d.ts +0 -18
  139. package/dist/labs/style-mixed.css +0 -7
  140. package/dist/labs/style.css +0 -7
  141. package/dist/labs.css +0 -25
  142. package/dist/plugin/css.d.ts +0 -1
  143. package/dist/plugin/css.js +0 -73
  144. package/dist/plugin/modules/config.d.ts +0 -2
  145. package/dist/plugin/modules/config.js +0 -54
  146. package/dist/plugin/modules/importer.d.ts +0 -1
  147. package/dist/plugin/modules/importer.js +0 -15
  148. package/dist/plugin/preset-v2.d.ts +0 -108
  149. package/dist/plugin/preset-v2.js +0 -126
  150. package/dist/plugin/vitejs.js +0 -55
  151. package/dist/preset.d.ts +0 -2
  152. package/dist/preset.js +0 -92
  153. package/dist/style/animation.css +0 -62
  154. package/dist/style/css.d.ts +0 -2
  155. package/dist/style/css.js +0 -34
  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/{components/accordion → actions}/accordion.svelte.js +0 -0
  168. /package/dist/internal/{assets.svelte.d.ts → core/actions/assets.svelte.d.ts} +0 -0
  169. /package/dist/{components/dropdown → internal/core/actions}/dropdown.svelte.js +0 -0
  170. /package/dist/{components/popover → internal/core/actions}/popover.svelte.js +0 -0
  171. /package/dist/{components/tooltip → internal/core/actions}/tooltip.svelte.js +0 -0
  172. /package/dist/internal/{ripple.d.ts → core/animations/ripple.d.ts} +0 -0
  173. /package/dist/internal/{ansi.d.ts → core/bin/ansi.d.ts} +0 -0
  174. /package/dist/internal/{ansi.js → core/bin/ansi.js} +0 -0
  175. /package/dist/internal/{terminal.d.ts → core/bin/terminal.d.ts} +0 -0
  176. /package/dist/internal/{terminal.js → core/bin/terminal.js} +0 -0
  177. /package/dist/internal/{minify.d.ts → core/minify.d.ts} +0 -0
  178. /package/dist/internal/{minify.js → core/minify.js} +0 -0
  179. /package/dist/{utils/x11.d.ts → internal/core/x11-colors.d.ts} +0 -0
  180. /package/dist/{utils/x11.js → internal/core/x11-colors.js} +0 -0
  181. /package/dist/{utils → internal/helpers}/convert.d.ts +0 -0
  182. /package/dist/{utils → internal/helpers}/convert.js +0 -0
  183. /package/dist/internal/{deepMerge.d.ts → helpers/deep-merge.d.ts} +0 -0
  184. /package/dist/internal/{deepMerge.js → helpers/deep-merge.js} +0 -0
  185. /package/dist/internal/{clickOutside.d.ts → helpers/outside.d.ts} +0 -0
  186. /package/dist/internal/{clickOutside.js → helpers/outside.js} +0 -0
  187. /package/dist/internal/{scroll.d.ts → helpers/scroll.d.ts} +0 -0
  188. /package/dist/internal/{scroll.js → helpers/scroll.js} +0 -0
  189. /package/dist/internal/{types.js → types/components.js} +0 -0
  190. /package/dist/{colors.css → themes.css} +0 -0
@@ -11,7 +11,6 @@ async function findReferenceFile(projectPath) {
11
11
  await fs.access(routesPath);
12
12
  } catch {
13
13
  terminal('error', `Lapikit cannot find the routes/ directory.`);
14
- // throw new Error('Lapikit cannot find the routes/ directory.');
15
14
  }
16
15
 
17
16
  const layoutFile = path.join(routesPath, '+layout.svelte');
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/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { initConfiguration } from './configuration.js';
3
3
  import { ansi, terminal } from './helper.js';
4
- import { legacyConfiguration } from './legacy.js';
5
4
  import { initPrompts } from './prompts.js';
6
5
 
7
6
  async function run() {
@@ -18,14 +17,7 @@ async function run() {
18
17
 
19
18
  const promptsConfig = await initPrompts();
20
19
 
21
- if (promptsConfig.env === 'current') {
22
- await legacyConfiguration(promptsConfig);
23
- }
24
-
25
- if (promptsConfig.env === 'experimental') {
26
- terminal('warn', `Experimental mode is not yet implemented.`);
27
- await initConfiguration(promptsConfig);
28
- }
20
+ await initConfiguration(promptsConfig);
29
21
  }
30
22
 
31
23
  run()
package/bin/presets.js CHANGED
@@ -9,7 +9,7 @@ function presets({ adapterCSS }) {
9
9
  if (adapterCSS === 'css') {
10
10
  content += `// Styles\n`;
11
11
  content += `import 'lapikit/styles';\n`;
12
- content += `import 'lapikit/css';\n\n`;
12
+ content += `import 'lapikit/themes';\n\n`;
13
13
  }
14
14
 
15
15
  content += `// Composables\n`;
package/bin/prompts.js CHANGED
@@ -16,85 +16,52 @@ export async function initPrompts() {
16
16
  terminal('warn', `installation canceled.`);
17
17
  process.exit(0);
18
18
  }
19
- // temps with legacy and new process install
20
- const { type } = await prompts({
21
- type: 'select',
22
- name: 'type',
23
- message: 'Select installation type:',
24
- choices: [
25
- { title: 'Classic install with lapikit.config.js', value: 'current' },
26
- {
27
- title: 'Preview install with new plugin/lapikit.(js|ts) <experimental>',
28
- value: 'experimental'
29
- }
30
- ]
31
- });
32
-
33
- if (type === 'current') {
34
- // Classic install
35
- const settings = await prompts([
36
- {
37
- type: 'text',
38
- name: 'pathCSS',
39
- message: 'Where would you like to import the lapikit CSS files?',
40
- initial: 'src/app.css',
41
- validate: (value) =>
42
- value.startsWith('src/') ? true : 'Please provide a valid path starting with src/'
43
- }
44
- ]);
45
19
 
46
- return {
47
- ...settings,
48
- env: 'current'
49
- };
50
- } else if (type === 'experimental') {
51
- // Preview install
52
- let settings = await prompts([
53
- {
54
- type: 'text',
55
- name: 'pathConfig',
56
- message: 'Where would you like to install the lapikit configuration files?',
57
- initial: 'src/plugins',
58
- validate: (value) =>
59
- value.startsWith('src/') ? true : 'Please provide a valid path starting with src/'
60
- },
61
- {
62
- type: 'toggle',
63
- name: 'typescript',
64
- message: 'Use TypeScript?',
65
- initial: true,
66
- active: 'Yes',
67
- inactive: 'No'
68
- },
69
- {
70
- type: 'select',
71
- name: 'formatCSS',
72
- message: 'What is your CSS format used on your app?',
73
- choices: [
74
- { title: 'Basic (classic import)', value: 'css' },
75
- {
76
- title: 'TailwindCSS (v4)',
77
- value: 'tailwind-v4'
78
- },
79
- {
80
- title: 'UnoCSS',
81
- value: 'unocss'
82
- }
83
- ]
84
- },
85
- {
86
- type: (prev) => (prev !== 'css' ? 'text' : null),
87
- name: 'pathCSS',
88
- message: 'Where would you like to import the lapikit CSS files?',
89
- initial: 'src/app.css',
90
- validate: (value) =>
91
- value.startsWith('src/') ? true : 'Please provide a valid path starting with src/'
92
- }
93
- ]);
20
+ // Preview install
21
+ let settings = await prompts([
22
+ {
23
+ type: 'text',
24
+ name: 'pathConfig',
25
+ message: 'Where would you like to install the lapikit configuration files?',
26
+ initial: 'src/plugins',
27
+ validate: (value) =>
28
+ value.startsWith('src/') ? true : 'Please provide a valid path starting with src/'
29
+ },
30
+ {
31
+ type: 'toggle',
32
+ name: 'typescript',
33
+ message: 'Use TypeScript?',
34
+ initial: true,
35
+ active: 'Yes',
36
+ inactive: 'No'
37
+ },
38
+ {
39
+ type: 'select',
40
+ name: 'formatCSS',
41
+ message: 'What is your CSS format used on your app?',
42
+ choices: [
43
+ { title: 'Basic (classic import)', value: 'css' },
44
+ {
45
+ title: 'TailwindCSS (v4)',
46
+ value: 'tailwind-v4'
47
+ },
48
+ {
49
+ title: 'UnoCSS',
50
+ value: 'unocss'
51
+ }
52
+ ]
53
+ },
54
+ {
55
+ type: (prev) => (prev !== 'css' ? 'text' : null),
56
+ name: 'pathCSS',
57
+ message: 'Where would you like to import the lapikit CSS files?',
58
+ initial: 'src/app.css',
59
+ validate: (value) =>
60
+ value.startsWith('src/') ? true : 'Please provide a valid path starting with src/'
61
+ }
62
+ ]);
94
63
 
95
- return {
96
- ...settings,
97
- env: 'experimental'
98
- };
99
- }
64
+ return {
65
+ ...settings
66
+ };
100
67
  }
@@ -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
+ }
@@ -1,8 +1,4 @@
1
1
  .kit-accordion {
2
- --accordion-color: var(--on, var(--kit-on-container));
3
- --accordion-background: var(--base, var(--kit-container));
4
- --accordion-radius: var(--shape, var(--kit-radius-md));
5
-
6
2
  display: flex;
7
3
  flex-wrap: wrap;
8
4
  justify-content: center;
@@ -38,76 +34,3 @@
38
34
  pointer-events: none;
39
35
  user-select: none;
40
36
  }
41
-
42
- /* item */
43
- .kit-accordion .kit-accordion-item {
44
- flex: 1 0 100%;
45
- max-width: 100%;
46
- position: relative;
47
- transition: 0.3s all cubic-bezier(0.4, 0, 0.2, 1);
48
- transition-property: margin-top, border-radius, border, max-width;
49
- border-radius: var(--shape, var(--accordion-radius, var(--kit-radius-md)));
50
- color: var(--on, var(--accordion-color, var(--kit-on-container)));
51
- background-color: var(--base, var(--accordion-background, var(--kit-container)));
52
- /* transition:
53
- color 0.5s,
54
- background-color 0.5s; */
55
- }
56
-
57
- .kit-accordion .kit-accordion-item > button,
58
- .kit-accordion .kit-accordion-item > [type='button'] {
59
- font: inherit;
60
- overflow: visible;
61
- background-color: transparent;
62
- border-style: none;
63
- cursor: pointer;
64
- color: inherit;
65
- }
66
-
67
- .kit-accordion .kit-accordion-item .kit-accordion-item--title {
68
- align-items: center;
69
- text-align: start;
70
- border-radius: inherit;
71
- display: flex;
72
- font-size: 0.9375rem;
73
- min-height: 3rem;
74
- outline: none;
75
- padding: 1rem 1.5rem;
76
- position: relative;
77
- transition: 0.3s min-height margin-bottom margin-top border-radius cubic-bezier(0.4, 0, 0.2, 1);
78
- width: 100%;
79
- justify-content: space-between;
80
- }
81
-
82
- .kit-accordion .kit-accordion-item .kit-accordion-item--text {
83
- display: flex;
84
- }
85
-
86
- .kit-accordion .kit-accordion-item .kit-accordion-item--text .kit-accordion-item--text-wrapper {
87
- padding: 0.5rem 1.5rem 1rem;
88
- flex: 1 1 auto;
89
- max-width: 100%;
90
- }
91
-
92
- .kit-accordion .kit-accordion-item .kit-accordion-item--icon {
93
- display: inline-flex;
94
- margin-bottom: -0.25rem;
95
- margin-top: -0.25rem;
96
- -webkit-user-select: none;
97
- user-select: none;
98
- margin-inline-start: auto;
99
- }
100
-
101
- /* disabled */
102
- .kit-accordion .kit-accordion-item .kit-accordion-item--title.kit-accordion-item--disabled,
103
- .kit-accordion .kit-accordion-item .kit-accordion-item--title[disabled],
104
- .kit-accordion .kit-accordion-item .kit-accordion-item--title:disabled {
105
- pointer-events: none;
106
- user-select: none;
107
- }
108
-
109
- .kit-accordion .kit-accordion-item .kit-accordion-item--title.kit-accordion-item--disabled > *,
110
- .kit-accordion .kit-accordion-item .kit-accordion-item--title[disabled] > *,
111
- .kit-accordion .kit-accordion-item .kit-accordion-item--title:disabled > * {
112
- opacity: 0.6;
113
- }
@@ -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 {
@@ -12,6 +12,7 @@
12
12
  background,
13
13
  spacer,
14
14
  hideIcon,
15
+ rounded,
15
16
  ...rest
16
17
  }: AccordionProps = $props();
17
18
 
@@ -30,8 +31,9 @@
30
31
  dark && 'dark',
31
32
  rest.class
32
33
  ]}
33
- style:--base={assets.color(background)}
34
- style:--on={assets.color(color)}
34
+ style:--accordion-shape={assets.shape(rounded)}
35
+ style:--accordion-background={assets.color(background)}
36
+ style:--accordion-color={assets.color(color)}
35
37
  >
36
38
  {@render children?.()}
37
39
  </svelte:element>
@@ -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;
@@ -1,10 +1,3 @@
1
- /* root */
2
- .kit-alert {
3
- --alert-color: var(--on, var(--kit-on-container));
4
- --alert-background: var(--base, var(--kit-container));
5
- --alert-radius: var(--shape, var(--kit-radius-md));
6
- }
7
-
8
1
  .kit-alert {
9
2
  display: grid;
10
3
  flex: 1 1;
@@ -15,9 +8,9 @@
15
8
  position: relative;
16
9
  padding: 1rem;
17
10
  overflow: hidden;
18
- color: var(--alert-color);
19
- background-color: var(--alert-background);
20
- border-radius: var(--alert-radius);
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));
21
14
  line-height: 0;
22
15
  }
23
16
 
@@ -87,34 +80,34 @@
87
80
  /* state */
88
81
  .kit-alert.kit-alert--info:not([class*='alert--variant-']) {
89
82
  --on: var(--kit-on-info);
90
- --base: var(--kit-info);
83
+ --base: var(--kit-accent-info);
91
84
  }
92
85
  .kit-alert.kit-alert--info[class*='alert--variant-'] {
93
- --base: var(--kit-info);
86
+ --base: var(--kit-accent-info);
94
87
  }
95
88
 
96
89
  .kit-alert.kit-alert--success:not([class*='alert--variant-']) {
97
90
  --on: var(--kit-on-success);
98
- --base: var(--kit-success);
91
+ --base: var(--kit-accent-successs);
99
92
  }
100
93
  .kit-alert.kit-alert--success[class*='alert--variant-'] {
101
- --base: var(--kit-success);
94
+ --base: var(--kit-accent-successs);
102
95
  }
103
96
 
104
97
  .kit-alert.kit-alert--warning:not([class*='alert--variant-']) {
105
98
  --on: var(--kit-on-warning);
106
- --base: var(--kit-warning);
99
+ --base: var(--kit-accent-warning);
107
100
  }
108
101
  .kit-alert.kit-alert--warning[class*='alert--variant-'] {
109
- --base: var(--kit-warning);
102
+ --base: var(--kit-accent-warning);
110
103
  }
111
104
 
112
105
  .kit-alert.kit-alert--error:not([class*='alert--variant-']) {
113
106
  --on: var(--kit-on-error);
114
- --base: var(--kit-error);
107
+ --base: var(--kit-accent-destructive);
115
108
  }
116
109
  .kit-alert.kit-alert--error[class*='alert--variant-'] {
117
- --base: var(--kit-error);
110
+ --base: var(--kit-accent-destructive);
118
111
  }
119
112
 
120
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
@@ -51,9 +51,9 @@
51
51
  rest.class
52
52
  ]}
53
53
  role="alert"
54
- style:--base={assets.color(background)}
55
- style:--on={assets.color(color)}
56
- style:--shape={assets.shape(rounded)}
54
+ style:--alert-background={assets.color(background)}
55
+ style:--alert-color={assets.color(color)}
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';
@@ -4,13 +4,12 @@
4
4
  left: 0;
5
5
  height: 100%;
6
6
  width: 100%;
7
- background-color: color-mix(in oklab, var(--kit-shadow) 70%, transparent);
7
+ background-color: color-mix(in oklab, var(--kit-state-shadow) 70%, transparent);
8
8
  z-index: 9000;
9
9
  cursor: default;
10
10
  }
11
11
 
12
12
  .kit-overlay.kit-overlay--persistent {
13
- /* pointer-events: none; */
14
13
  user-select: none;
15
14
  cursor: default;
16
15
  }
@@ -1,38 +1,34 @@
1
1
  <script lang="ts">
2
2
  import { BROWSER } from 'esm-env';
3
- import {
4
- colorSchemeSystem,
5
- modalOpen,
6
- setOpenModal,
7
- useColorScheme,
8
- useTheme
9
- } from '../../stores/index.js';
10
3
  import type { Snippet } from 'svelte';
11
- let { children }: { children: Snippet } = $props();
4
+ import { useTheme } from '../../actions/use-theme.js';
5
+ import { modalOpen, setOpenModal } from '../../stores/components.js';
6
+
7
+ let {
8
+ children,
9
+ themes,
10
+ storageKey = '@lapikit/theme'
11
+ }: { children: Snippet; themes?: string | string[]; storageKey?: string } = $props();
12
12
 
13
13
  $effect.pre(() => {
14
14
  if (!BROWSER) return;
15
- // system
16
- if (window.matchMedia) {
17
- colorSchemeSystem.set(
18
- window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
19
- );
20
- }
21
-
22
- // listener
23
- window
24
- .matchMedia('(prefers-color-scheme: dark)')
25
- .addEventListener('change', (event: MediaQueryListEvent) => {
26
- colorSchemeSystem.set(event.matches ? 'dark' : 'light');
27
- });
15
+ const colorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches
16
+ ? 'dark'
17
+ : 'light';
18
+ const localTheme = localStorage.getItem(storageKey);
28
19
 
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);
20
+ if (localTheme) {
21
+ useTheme(localTheme);
22
+ } else if (colorScheme) {
23
+ if (typeof themes === 'string') {
24
+ useTheme(themes);
25
+ } else if (typeof themes === 'object' && Array.isArray(themes)) {
26
+ if (colorScheme === 'dark') useTheme(themes[1] ?? themes[0]);
27
+ else useTheme(themes[0]);
28
+ } else {
29
+ useTheme(colorScheme);
30
+ }
31
+ }
36
32
  });
37
33
  </script>
38
34
 
@@ -1,6 +1,8 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  type $$ComponentProps = {
3
3
  children: Snippet;
4
+ themes?: string | string[];
5
+ storageKey?: string;
4
6
  };
5
7
  declare const App: import("svelte").Component<$$ComponentProps, {}, "">;
6
8
  type App = ReturnType<typeof App>;