lapikit 0.0.0-insiders.bd609af → 0.0.0-insiders.bf2813a

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 (95) hide show
  1. package/bin/configuration.js +39 -30
  2. package/bin/index.js +4 -4
  3. package/bin/presets.js +10 -7
  4. package/bin/prompts.js +5 -6
  5. package/dist/colors.css +0 -0
  6. package/dist/components/accordion/accordion.svelte +118 -0
  7. package/dist/components/alert/alert.svelte +122 -0
  8. package/dist/components/app/app.svelte +26 -3
  9. package/dist/components/appbar/appbar.css +4 -4
  10. package/dist/components/appbar/appbar.svelte +45 -0
  11. package/dist/components/aspect-ratio/aspect-ratio.svelte +23 -4
  12. package/dist/components/avatar/avatar.svelte +114 -0
  13. package/dist/components/button/button.css +14 -14
  14. package/dist/components/button/button.svelte +230 -0
  15. package/dist/components/card/card.css +4 -4
  16. package/dist/components/card/card.svelte +108 -0
  17. package/dist/components/chip/chip.css +13 -13
  18. package/dist/components/chip/chip.svelte +216 -3
  19. package/dist/components/chip/types.d.ts +1 -0
  20. package/dist/components/dialog/dialog.css +3 -1
  21. package/dist/components/dialog/dialog.svelte +144 -0
  22. package/dist/components/dropdown/dropdown.svelte +24 -0
  23. package/dist/components/icon/icon.css +5 -3
  24. package/dist/components/icon/icon.svelte +89 -0
  25. package/dist/components/list/list.css +8 -8
  26. package/dist/components/list/list.svelte +199 -0
  27. package/dist/components/list/modules/list-item.svelte +199 -0
  28. package/dist/components/modal/modal.css +7 -6
  29. package/dist/components/modal/modal.svelte +135 -0
  30. package/dist/components/popover/popover.svelte +24 -0
  31. package/dist/components/separator/separator.svelte +48 -0
  32. package/dist/components/spacer/spacer.svelte +5 -0
  33. package/dist/components/textfield/textfield.css +8 -8
  34. package/dist/components/textfield/textfield.svelte +270 -0
  35. package/dist/components/toolbar/toolbar.css +9 -9
  36. package/dist/components/toolbar/toolbar.svelte +135 -0
  37. package/dist/components/tooltip/tooltip.svelte +127 -0
  38. package/dist/index.d.ts +27 -1
  39. package/dist/index.js +27 -3
  40. package/dist/internal/config/presets.d.ts +136 -0
  41. package/dist/internal/config/presets.js +121 -0
  42. package/dist/internal/config/variables.d.ts +20 -0
  43. package/dist/internal/config/variables.js +20 -0
  44. package/dist/internal/core/formatter/component.d.ts +5 -0
  45. package/dist/internal/core/formatter/component.js +63 -0
  46. package/dist/internal/core/formatter/index.d.ts +6 -0
  47. package/dist/internal/core/formatter/index.js +30 -0
  48. package/dist/internal/core/formatter/styles.d.ts +4 -0
  49. package/dist/internal/core/formatter/styles.js +15 -0
  50. package/dist/internal/core/formatter/theme.d.ts +5 -0
  51. package/dist/internal/core/formatter/theme.js +28 -0
  52. package/dist/internal/core/formatter/typography.d.ts +5 -0
  53. package/dist/internal/core/formatter/typography.js +12 -0
  54. package/dist/internal/deepMerge.d.ts +44 -0
  55. package/dist/internal/deepMerge.js +80 -0
  56. package/dist/internal/helpers/parser.d.ts +10 -0
  57. package/dist/internal/helpers/parser.js +92 -0
  58. package/dist/internal/plugins/vite.d.ts +8 -0
  59. package/dist/internal/plugins/vite.js +25 -0
  60. package/dist/internal/types/configuration.d.ts +40 -0
  61. package/dist/internal/types/configuration.js +1 -0
  62. package/dist/internal/types/index.d.ts +1 -0
  63. package/dist/internal/types/index.js +1 -0
  64. package/dist/labs/index.d.ts +4 -0
  65. package/dist/labs/index.js +5 -0
  66. package/dist/labs/my-component-style-global.svelte +6 -0
  67. package/dist/labs/my-component-style-global.svelte.d.ts +18 -0
  68. package/dist/labs/my-component-style-import.svelte +15 -0
  69. package/dist/labs/my-component-style-import.svelte.d.ts +18 -0
  70. package/dist/labs/my-component-style-mixed.svelte +23 -0
  71. package/dist/labs/my-component-style-mixed.svelte.d.ts +18 -0
  72. package/dist/labs/my-component.svelte +16 -0
  73. package/dist/labs/my-component.svelte.d.ts +18 -0
  74. package/dist/labs/style-mixed.css +7 -0
  75. package/dist/labs/style.css +7 -0
  76. package/dist/labs.css +25 -0
  77. package/dist/plugin/css.d.ts +1 -0
  78. package/dist/plugin/css.js +73 -0
  79. package/dist/plugin/preset-v2.d.ts +108 -0
  80. package/dist/plugin/preset-v2.js +126 -0
  81. package/dist/plugin/vitejs.d.ts +5 -1
  82. package/dist/plugin/vitejs.js +32 -3
  83. package/dist/stores/breakpoints.d.ts +6 -0
  84. package/dist/stores/breakpoints.js +14 -0
  85. package/dist/stores/components.d.ts +8 -0
  86. package/dist/stores/components.js +26 -0
  87. package/dist/stores/devices.d.ts +6 -0
  88. package/dist/stores/devices.js +9 -0
  89. package/dist/stores/index.d.ts +4 -10
  90. package/dist/stores/index.js +4 -47
  91. package/dist/stores/themes.d.ts +8 -0
  92. package/dist/stores/themes.js +34 -0
  93. package/dist/utils/convert.d.ts +1 -0
  94. package/dist/utils/convert.js +17 -0
  95. package/package.json +10 -2
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { promises as fs } from 'fs';
3
3
  import path from 'path';
4
+ import { terminal } from './helper.js';
4
5
  import presets from './presets.js';
5
6
 
6
7
  async function findReferenceFile(projectPath) {
@@ -9,7 +10,8 @@ async function findReferenceFile(projectPath) {
9
10
  try {
10
11
  await fs.access(routesPath);
11
12
  } catch {
12
- throw new Error('Lapikit cannot find the routes/ directory.');
13
+ terminal('error', `Lapikit cannot find the routes/ directory.`);
14
+ // throw new Error('Lapikit cannot find the routes/ directory.');
13
15
  }
14
16
 
15
17
  const layoutFile = path.join(routesPath, '+layout.svelte');
@@ -65,7 +67,7 @@ async function addImportToReferenceFile(targetFile, referenceFile) {
65
67
  const importStatement = `import "${relativePath.startsWith('.') ? relativePath : './' + relativePath}";\n`;
66
68
 
67
69
  if (content.includes(`import "${relativePath}"`)) {
68
- console.log(`import has already exist ${referenceFile}`);
70
+ terminal('info', `Import statement already exists in ${referenceFile}`);
69
71
  return;
70
72
  }
71
73
 
@@ -103,9 +105,9 @@ async function addImportToReferenceFile(targetFile, referenceFile) {
103
105
  const newContent = lines.join('\n');
104
106
 
105
107
  await fs.writeFile(referenceFile, newContent);
106
- console.log(`Import has added on ${referenceFile}`);
108
+ terminal('info', `Import has been added to ${referenceFile}`);
107
109
  } catch (error) {
108
- console.error(`Error adding import: ${error.message}`);
110
+ terminal('error', `Error adding import: ${error.message}`);
109
111
  throw error;
110
112
  }
111
113
  }
@@ -131,14 +133,16 @@ async function findViteConfigFile(projectPath, typescript) {
131
133
  }
132
134
  }
133
135
 
134
- async function addLapikitToViteConfig(viteConfigFile) {
136
+ async function addLapikitToViteConfig(viteConfigFile, pathConfig, typescript) {
135
137
  try {
136
138
  const content = await fs.readFile(viteConfigFile, 'utf-8');
137
139
  const lapikitImport = `import { lapikit } from 'lapikit/vite';`;
140
+ const configPath = `${pathConfig}/lapikit.${typescript ? 'ts' : 'js'}`;
141
+ const lapikitPlugin = `lapikit({ config: '${configPath}' })`;
138
142
 
139
143
  // Check if lapikit import already exists
140
144
  if (content.includes(lapikitImport) || content.includes(`from 'lapikit/vite'`)) {
141
- console.log(`Lapikit import already exists in ${viteConfigFile}`);
145
+ terminal('info', `Lapikit import already exists in ${viteConfigFile}`);
142
146
  return;
143
147
  }
144
148
 
@@ -181,10 +185,10 @@ async function addLapikitToViteConfig(viteConfigFile) {
181
185
  const pluginMatch = line.match(/plugins:\s*\[(.*)\]/);
182
186
  if (pluginMatch) {
183
187
  const pluginsContent = pluginMatch[1];
184
- if (!pluginsContent.includes('lapikit()')) {
188
+ if (!pluginsContent.includes('lapikit')) {
185
189
  const newPluginsContent = pluginsContent.replace(
186
190
  /sveltekit\(\)/,
187
- 'sveltekit(), lapikit()'
191
+ `sveltekit(), ${lapikitPlugin}`
188
192
  );
189
193
  lines[i] = line.replace(pluginsContent, newPluginsContent);
190
194
  pluginAdded = true;
@@ -198,24 +202,24 @@ async function addLapikitToViteConfig(viteConfigFile) {
198
202
  const pluginLine = lines[j].trim();
199
203
 
200
204
  if (pluginLine.includes('sveltekit()') && !pluginAdded) {
201
- // Check if lapikit() is not already present
205
+ // Check if lapikit is not already present
202
206
  let hasLapikit = false;
203
207
  for (let k = i; k < lines.length && !lines[k].includes(']'); k++) {
204
- if (lines[k].includes('lapikit()')) {
208
+ if (lines[k].includes('lapikit')) {
205
209
  hasLapikit = true;
206
210
  break;
207
211
  }
208
212
  }
209
213
 
210
214
  if (!hasLapikit) {
211
- // Add lapikit() after sveltekit()
215
+ // Add lapikit after sveltekit()
212
216
  if (pluginLine.includes(',')) {
213
- lines[j] = lines[j].replace('sveltekit()', 'sveltekit(), lapikit()');
217
+ lines[j] = lines[j].replace('sveltekit()', `sveltekit(), ${lapikitPlugin}`);
214
218
  } else {
215
219
  lines[j] = lines[j].replace('sveltekit()', 'sveltekit(),');
216
- // Insert lapikit() on the next line with proper indentation
220
+ // Insert lapikit on the next line with proper indentation
217
221
  const indentation = lines[j].match(/^\s*/)[0];
218
- lines.splice(j + 1, 0, `${indentation}lapikit()`);
222
+ lines.splice(j + 1, 0, `${indentation}${lapikitPlugin}`);
219
223
  }
220
224
  pluginAdded = true;
221
225
  }
@@ -231,21 +235,20 @@ async function addLapikitToViteConfig(viteConfigFile) {
231
235
  }
232
236
 
233
237
  if (!pluginAdded) {
234
- console.warn('Could not find sveltekit() in plugins array to add lapikit() after it');
238
+ terminal('warn', `Could not find sveltekit() in plugins array to add lapikit() after it`);
235
239
  }
236
240
 
237
241
  const newContent = lines.join('\n');
238
242
  await fs.writeFile(viteConfigFile, newContent);
239
- console.log(`Lapikit import and plugin added to ${viteConfigFile}`);
243
+ terminal('info', `Lapikit import and plugin added to ${viteConfigFile}`);
240
244
  } catch (error) {
241
- console.error(`Error adding lapikit to vite config: ${error.message}`);
245
+ terminal('error', `Error adding lapikit to vite config: ${error.message}`);
242
246
  throw error;
243
247
  }
244
248
  }
245
249
 
246
250
  export async function initConfiguration(options) {
247
- console.log('initConfiguration called with:', options);
248
- const { typescript, pathConfig, formatCSS } = options;
251
+ const { typescript, pathConfig, formatCSS, pathCSS } = options;
249
252
  const ext = typescript ? 'ts' : 'js';
250
253
  const targetDir = path.resolve(process.cwd(), pathConfig);
251
254
  const targetFile = path.join(targetDir, `lapikit.${ext}`);
@@ -253,30 +256,32 @@ export async function initConfiguration(options) {
253
256
  await fs.mkdir(targetDir, { recursive: true });
254
257
 
255
258
  let fileCreated = false;
259
+
260
+ // Create Lapikit config
256
261
  try {
257
- console.log(`Trying to access ${targetFile}`);
258
262
  await fs.access(targetFile);
259
- console.log(`File ${targetFile} already exists.`);
263
+ terminal('info', `File ${targetFile} already exists.`);
260
264
  } catch {
261
- console.log(`Creating file: ${targetFile}`);
265
+ terminal('info', `Creating file: ${targetFile}`);
262
266
  const content = presets({
263
- classic: formatCSS === 'global'
267
+ adapterCSS: formatCSS
264
268
  });
265
269
  await fs.writeFile(targetFile, content);
266
- console.log(`File created : ${targetFile}`);
270
+ terminal('info', `File created: ${targetFile}`);
267
271
  fileCreated = true;
268
272
  }
269
273
 
274
+ // Add Import Lapikit plugin
270
275
  try {
271
276
  const referenceFile = await findReferenceFile(process.cwd());
272
277
  await addImportToReferenceFile(targetFile, referenceFile);
273
278
  } catch (error) {
274
- console.error(`Error: ${error.message}`);
275
- // If the file was just created and we can't add the import, delete it
279
+ terminal('error', `Error adding import: ${error.message}`);
280
+
276
281
  if (fileCreated) {
277
282
  try {
278
283
  await fs.unlink(targetFile);
279
- console.log(`File ${targetFile} deleted due to error.`);
284
+ terminal('info', `File ${targetFile} deleted due to error.`);
280
285
  } catch {
281
286
  // Ignore deletion error
282
287
  }
@@ -284,12 +289,16 @@ export async function initConfiguration(options) {
284
289
  throw error;
285
290
  }
286
291
 
292
+ // Add Import Lapikit css
293
+ if (formatCSS !== 'css') {
294
+ console.log('need custom import (Preview)', pathCSS);
295
+ }
287
296
  // Add lapikit to vite.config file
288
297
  try {
289
298
  const viteConfigFile = await findViteConfigFile(process.cwd(), typescript);
290
- await addLapikitToViteConfig(viteConfigFile);
299
+ await addLapikitToViteConfig(viteConfigFile, pathConfig, typescript);
291
300
  } catch (error) {
292
- console.warn(`Warning: Could not update vite.config file: ${error.message}`);
293
- // This is not a critical error, so we don't throw it
301
+ terminal('warn', `Warning: Could not update vite.config file: ${error.message}`);
302
+ terminal('error', `Error adding lapikit to vite config: ${error.message}`);
294
303
  }
295
304
  }
package/bin/index.js CHANGED
@@ -30,12 +30,12 @@ async function run() {
30
30
 
31
31
  run()
32
32
  .then(() => {
33
- console.log('Website: https://lapikit.dev');
34
- console.log('Github: https://github.com/nycolaide/lapikit');
35
- console.log('Support the developement: https://buymeacoffee.com/nycolaide');
33
+ terminal('none', `\n\n\n\nWebsite: https://lapikit.dev`);
34
+ terminal('none', `Github: https://github.com/nycolaide/lapikit`);
35
+ terminal('none', `Support the developement: https://buymeacoffee.com/nycolaide`);
36
36
  process.exit(0);
37
37
  })
38
38
  .catch((error) => {
39
- console.error(`\n${red('')} ${error}\n`);
39
+ terminal('error', `Error: ${error}`);
40
40
  process.exit(1);
41
41
  });
package/bin/presets.js CHANGED
@@ -1,21 +1,24 @@
1
- function presets({ classic }) {
1
+ function presets({ adapterCSS }) {
2
2
  let content = '';
3
3
 
4
4
  content += `/**\n`;
5
- content += `\t* Lapikit\n`;
6
- content += `\t* Library documentation: https://lapikit.dev\n`;
5
+ content += ` * Lapikit\n`;
6
+ content += ` * Library documentation: https://lapikit.dev\n`;
7
7
  content += ` */\n\n`;
8
8
 
9
- if (classic) {
10
- content += `// Classic\n`;
9
+ if (adapterCSS === 'css') {
10
+ content += `// Styles\n`;
11
+ content += `import 'lapikit/styles';\n`;
11
12
  content += `import 'lapikit/css';\n\n`;
12
13
  }
13
14
 
14
15
  content += `// Composables\n`;
15
- content += `import { helloWorld } from 'lapikit';\n\n`;
16
+ content += `import createLapikit from 'lapikit';\n\n`;
16
17
 
17
18
  content += `// https://lapikit.dev/docs/getting-started\n`;
18
- content += `export default helloWorld();`;
19
+ content += `export default createLapikit({\n`;
20
+ content += `\tadapterCSS: "${adapterCSS}",\n`;
21
+ content += `\n});`;
19
22
 
20
23
  return content;
21
24
  }
package/bin/prompts.js CHANGED
@@ -1,18 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import prompts from 'prompts';
3
+ import { terminal } from './helper.js';
3
4
 
4
5
  export async function initPrompts() {
5
6
  const { confirm } = await prompts({
6
7
  type: 'toggle',
7
8
  name: 'confirm',
8
- message: 'Start install Lapikit on your app?',
9
+ message: 'Launch install Lapikit on your project?',
9
10
  initial: true,
10
11
  active: 'Yes',
11
12
  inactive: 'No'
12
13
  });
13
14
 
14
15
  if (!confirm) {
15
- console.log(' Installation canceled. See you soon.');
16
+ terminal('warn', `installation canceled.`);
16
17
  process.exit(0);
17
18
  }
18
19
  // temps with legacy and new process install
@@ -70,7 +71,7 @@ export async function initPrompts() {
70
71
  name: 'formatCSS',
71
72
  message: 'What is your CSS format used on your app?',
72
73
  choices: [
73
- { title: 'Basic (classic import)', value: 'global' },
74
+ { title: 'Basic (classic import)', value: 'css' },
74
75
  {
75
76
  title: 'TailwindCSS (v4)',
76
77
  value: 'tailwind-v4'
@@ -82,7 +83,7 @@ export async function initPrompts() {
82
83
  ]
83
84
  },
84
85
  {
85
- type: (prev) => (prev !== 'global' ? 'text' : null),
86
+ type: (prev) => (prev !== 'css' ? 'text' : null),
86
87
  name: 'pathCSS',
87
88
  message: 'Where would you like to import the lapikit CSS files?',
88
89
  initial: 'src/app.css',
@@ -91,8 +92,6 @@ export async function initPrompts() {
91
92
  }
92
93
  ]);
93
94
 
94
- console.log('response config', settings);
95
-
96
95
  return {
97
96
  ...settings,
98
97
  env: 'experimental'
File without changes
@@ -35,3 +35,121 @@
35
35
  >
36
36
  {@render children?.()}
37
37
  </svelte:element>
38
+
39
+ <style>.kit-accordion {
40
+ --accordion-color: var(--on, var(--kit-on-container));
41
+ --accordion-background: var(--base, var(--kit-container));
42
+ --accordion-radius: var(--shape, var(--kit-radius-md));
43
+
44
+ display: flex;
45
+ flex-wrap: wrap;
46
+ justify-content: center;
47
+ list-style-type: none;
48
+ padding: 0;
49
+ width: 100%;
50
+ position: relative;
51
+ z-index: 1;
52
+ }
53
+
54
+ .kit-accordion.kit-accordion--spacer .kit-accordion-item:first-child.kit-accordion-item--active {
55
+ margin-bottom: 1rem;
56
+ }
57
+
58
+ .kit-accordion.kit-accordion--spacer
59
+ .kit-accordion-item:not(:first-child):not(:last-child).kit-accordion-item--active {
60
+ margin-bottom: 1rem;
61
+ margin-top: 1rem;
62
+ }
63
+
64
+ .kit-accordion.kit-accordion--spacer .kit-accordion-item:last-child.kit-accordion-item--active {
65
+ margin-top: 1rem;
66
+ }
67
+
68
+ .kit-accordion.kit-accordion--hide-icon
69
+ .kit-accordion-item
70
+ .kit-accordion-item--title
71
+ > .kit-accordion-item--icon {
72
+ display: none !important;
73
+ }
74
+
75
+ .kit-accordion.kit-accordion--hide-icon .kit-accordion-item .kit-accordion-item--title {
76
+ cursor: default;
77
+ pointer-events: none;
78
+ user-select: none;
79
+ }
80
+
81
+ /* item */
82
+
83
+ .kit-accordion .kit-accordion-item {
84
+ flex: 1 0 100%;
85
+ max-width: 100%;
86
+ position: relative;
87
+ transition: 0.3s all cubic-bezier(0.4, 0, 0.2, 1);
88
+ transition-property: margin-top, border-radius, border, max-width;
89
+ border-radius: var(--shape, var(--accordion-radius, var(--kit-radius-md)));
90
+ color: var(--on, var(--accordion-color, var(--kit-on-container)));
91
+ background-color: var(--base, var(--accordion-background, var(--kit-container)));
92
+ /* transition:
93
+ color 0.5s,
94
+ background-color 0.5s; */
95
+ }
96
+
97
+ .kit-accordion .kit-accordion-item > button,
98
+ .kit-accordion .kit-accordion-item > [type='button'] {
99
+ font: inherit;
100
+ overflow: visible;
101
+ background-color: transparent;
102
+ border-style: none;
103
+ cursor: pointer;
104
+ color: inherit;
105
+ }
106
+
107
+ .kit-accordion .kit-accordion-item .kit-accordion-item--title {
108
+ align-items: center;
109
+ text-align: start;
110
+ border-radius: inherit;
111
+ display: flex;
112
+ font-size: 0.9375rem;
113
+ min-height: 3rem;
114
+ outline: none;
115
+ padding: 1rem 1.5rem;
116
+ position: relative;
117
+ transition: 0.3s min-height margin-bottom margin-top border-radius cubic-bezier(0.4, 0, 0.2, 1);
118
+ width: 100%;
119
+ justify-content: space-between;
120
+ }
121
+
122
+ .kit-accordion .kit-accordion-item .kit-accordion-item--text {
123
+ display: flex;
124
+ }
125
+
126
+ .kit-accordion .kit-accordion-item .kit-accordion-item--text .kit-accordion-item--text-wrapper {
127
+ padding: 0.5rem 1.5rem 1rem;
128
+ flex: 1 1 auto;
129
+ max-width: 100%;
130
+ }
131
+
132
+ .kit-accordion .kit-accordion-item .kit-accordion-item--icon {
133
+ display: inline-flex;
134
+ margin-bottom: -0.25rem;
135
+ margin-top: -0.25rem;
136
+ -webkit-user-select: none;
137
+ user-select: none;
138
+ margin-inline-start: auto;
139
+ }
140
+
141
+ /* disabled */
142
+
143
+ .kit-accordion .kit-accordion-item .kit-accordion-item--title.kit-accordion-item--disabled,
144
+ .kit-accordion .kit-accordion-item .kit-accordion-item--title[disabled],
145
+ .kit-accordion .kit-accordion-item .kit-accordion-item--title:disabled {
146
+ pointer-events: none;
147
+ user-select: none;
148
+ }
149
+
150
+ .kit-accordion .kit-accordion-item .kit-accordion-item--title.kit-accordion-item--disabled > *,
151
+ .kit-accordion .kit-accordion-item .kit-accordion-item--title[disabled] > *,
152
+ .kit-accordion .kit-accordion-item .kit-accordion-item--title:disabled > * {
153
+ opacity: 0.6;
154
+ }
155
+ </style>
@@ -87,3 +87,125 @@
87
87
  {/if}
88
88
  </svelte:element>
89
89
  {/if}
90
+
91
+ <style>/* root */
92
+ .kit-alert {
93
+ --alert-color: var(--on, var(--kit-on-container));
94
+ --alert-background: var(--base, var(--kit-container));
95
+ --alert-radius: var(--shape, var(--kit-radius-md));
96
+ }
97
+ .kit-alert {
98
+ display: grid;
99
+ flex: 1 1;
100
+ grid-template-areas:
101
+ 'prepend content append close'
102
+ '. content . .';
103
+ grid-template-columns: max-content minmax(0, 1fr) max-content max-content;
104
+ position: relative;
105
+ padding: 1rem;
106
+ overflow: hidden;
107
+ color: var(--alert-color);
108
+ background-color: var(--alert-background);
109
+ border-radius: var(--alert-radius);
110
+ line-height: 0;
111
+ }
112
+ .kit-alert .kit-alert--underlay {
113
+ grid-area: none;
114
+ position: absolute;
115
+ background-color: var(--alert-background);
116
+ border-radius: inherit;
117
+ top: 0;
118
+ right: 0;
119
+ bottom: 0;
120
+ left: 0;
121
+ z-index: -1;
122
+ }
123
+ .kit-alert.kit-alert--outline {
124
+ border: thin solid currentColor;
125
+ background-color: transparent;
126
+ }
127
+ /* density */
128
+ .kit-alert[breakpoint]kit-alert--density-default {
129
+ padding-bottom: 1rem;
130
+ padding-top: 1rem;
131
+ }
132
+ .kit-alert[breakpoint]kit-alert--density-compact {
133
+ padding-bottom: 0.5rem;
134
+ padding-top: 0.5rem;
135
+ }
136
+ .kit-alert[breakpoint]kit-alert--density-comfortable {
137
+ padding-bottom: 0.75rem;
138
+ padding-top: 0.75rem;
139
+ }
140
+ .kit-alert .kit-alert--prepend {
141
+ align-self: flex-start;
142
+ display: flex;
143
+ align-items: center;
144
+ grid-area: prepend;
145
+ margin-inline-end: 1rem;
146
+ }
147
+ .kit-alert .kit-alert--content {
148
+ align-self: flex-start;
149
+ grid-area: content;
150
+ overflow: hidden;
151
+ line-height: normal;
152
+ }
153
+ .kit-alert .kit-alert--close {
154
+ align-self: flex-start;
155
+ margin-inline-start: 1rem;
156
+ flex: 0 1 auto;
157
+ grid-area: close;
158
+ }
159
+ .kit-alert .kit-alert--append {
160
+ align-self: flex-start;
161
+ display: flex;
162
+ align-items: center;
163
+ grid-area: append;
164
+ margin-inline-start: 1rem;
165
+ }
166
+ /* state */
167
+ .kit-alert.kit-alert--info:not([class*='alert--variant-']) {
168
+ --on: var(--kit-on-info);
169
+ --base: var(--kit-info);
170
+ }
171
+ .kit-alert.kit-alert--info[class*='alert--variant-'] {
172
+ --base: var(--kit-info);
173
+ }
174
+ .kit-alert.kit-alert--success:not([class*='alert--variant-']) {
175
+ --on: var(--kit-on-success);
176
+ --base: var(--kit-success);
177
+ }
178
+ .kit-alert.kit-alert--success[class*='alert--variant-'] {
179
+ --base: var(--kit-success);
180
+ }
181
+ .kit-alert.kit-alert--warning:not([class*='alert--variant-']) {
182
+ --on: var(--kit-on-warning);
183
+ --base: var(--kit-warning);
184
+ }
185
+ .kit-alert.kit-alert--warning[class*='alert--variant-'] {
186
+ --base: var(--kit-warning);
187
+ }
188
+ .kit-alert.kit-alert--error:not([class*='alert--variant-']) {
189
+ --on: var(--kit-on-error);
190
+ --base: var(--kit-error);
191
+ }
192
+ .kit-alert.kit-alert--error[class*='alert--variant-'] {
193
+ --base: var(--kit-error);
194
+ }
195
+ /* variant */
196
+ .kit-alert[breakpoint]kit-alert--variant-outline {
197
+ --alert-color: var(--base, var(--kit-neutral));
198
+ background-color: transparent;
199
+ border: 1px solid currentColor;
200
+ }
201
+ .kit-alert[breakpoint]kit-alert--variant-text {
202
+ --alert-color: var(--base, var(--kit-neutral));
203
+ background-color: transparent;
204
+ border-color: transparent;
205
+ }
206
+ .kit-alert[breakpoint]kit-alert--variant-dash {
207
+ --alert-color: var(--base, var(--kit-neutral));
208
+ background-color: transparent;
209
+ border: 1px dashed currentColor;
210
+ }
211
+ </style>
@@ -4,7 +4,8 @@
4
4
  colorSchemeSystem,
5
5
  modalOpen,
6
6
  setOpenModal,
7
- updateThemeStore
7
+ useColorScheme,
8
+ useTheme
8
9
  } from '../../stores/index.js';
9
10
  import type { Snippet } from 'svelte';
10
11
  let { children }: { children: Snippet } = $props();
@@ -26,8 +27,12 @@
26
27
  });
27
28
 
28
29
  // local
29
- const local = localStorage.getItem('@lapikit/theme');
30
- if (local !== null) updateThemeStore(local as 'dark' | 'light' | 'system');
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);
31
36
  });
32
37
  </script>
33
38
 
@@ -41,3 +46,21 @@
41
46
  onclick={() => $modalOpen !== 'persistent' && setOpenModal(false)}
42
47
  ></div>
43
48
  {/if}
49
+
50
+ <style>.kit-overlay {
51
+ position: fixed;
52
+ top: 0;
53
+ left: 0;
54
+ height: 100%;
55
+ width: 100%;
56
+ background-color: color-mix(in oklab, var(--kit-shadow) 70%, transparent);
57
+ z-index: 9000;
58
+ cursor: default;
59
+ }
60
+
61
+ .kit-overlay.kit-overlay--persistent {
62
+ /* pointer-events: none; */
63
+ user-select: none;
64
+ cursor: default;
65
+ }
66
+ </style>
@@ -3,7 +3,7 @@
3
3
  --appbar-color: var(--on, var(--kit-on-surface));
4
4
  --appbar-background: var(--base, var(--kit-surface));
5
5
  --appbar-radius: var(--shape, 0);
6
- --appbar-padding-wrapper: var(--kit-spacing) * 4;
6
+ --appbar-padding-wrapper: var(--prism-spacing) * 4;
7
7
  }
8
8
 
9
9
  .kit-appbar {
@@ -34,15 +34,15 @@
34
34
  /* density */
35
35
  .kit-appbar[breakpoint]kit-appbar--density-default {
36
36
  height: 4rem;
37
- padding-inline: calc(var(--kit-spacing) * 1.5);
37
+ padding-inline: calc(var(--prism-spacing) * 1.5);
38
38
  }
39
39
 
40
40
  .kit-appbar[breakpoint]kit-appbar--density-compact {
41
41
  height: 3.5rem;
42
- padding-inline: calc(var(--kit-spacing) * 0.75);
42
+ padding-inline: calc(var(--prism-spacing) * 0.75);
43
43
  }
44
44
 
45
45
  .kit-appbar[breakpoint]kit-appbar--density-comfortable {
46
46
  height: 4.5rem;
47
- padding-inline: calc(var(--kit-spacing) * 2.25);
47
+ padding-inline: calc(var(--prism-spacing) * 2.25);
48
48
  }
@@ -38,3 +38,48 @@
38
38
  {@render children?.()}
39
39
  </div>
40
40
  </svelte:element>
41
+
42
+ <style>/* root default*/
43
+ .kit-appbar {
44
+ --appbar-color: var(--on, var(--kit-on-surface));
45
+ --appbar-background: var(--base, var(--kit-surface));
46
+ --appbar-radius: var(--shape, 0);
47
+ --appbar-padding-wrapper: var(--prism-spacing) * 4;
48
+ }
49
+ .kit-appbar {
50
+ display: flex;
51
+ align-items: center;
52
+ border-style: solid;
53
+ border-width: 1px;
54
+ border-radius: var(--appbar-radius);
55
+ color: var(--appbar-color);
56
+ background-color: var(--appbar-background);
57
+ border-color: var(--appbar-background);
58
+ /* transition:
59
+ color 0.5s,
60
+ border-color 0.5s,
61
+ background-color 0.5s; */
62
+ }
63
+ /* wrapper */
64
+ .kit-appbar .kit-appbar--wrapper {
65
+ display: flex;
66
+ align-items: center;
67
+ flex-direction: row;
68
+ height: calc(100% - (var(--appbar-padding-wrapper) * 2));
69
+ width: calc(100% - (var(--appbar-padding-wrapper) * 2));
70
+ margin: 0 auto;
71
+ }
72
+ /* density */
73
+ .kit-appbar[breakpoint]kit-appbar--density-default {
74
+ height: 4rem;
75
+ padding-inline: calc(var(--prism-spacing) * 1.5);
76
+ }
77
+ .kit-appbar[breakpoint]kit-appbar--density-compact {
78
+ height: 3.5rem;
79
+ padding-inline: calc(var(--prism-spacing) * 0.75);
80
+ }
81
+ .kit-appbar[breakpoint]kit-appbar--density-comfortable {
82
+ height: 4.5rem;
83
+ padding-inline: calc(var(--prism-spacing) * 2.25);
84
+ }
85
+ </style>