lapikit 0.0.0-insiders.da3209a → 0.0.0-insiders.db064a9

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 (198) hide show
  1. package/README.md +117 -1
  2. package/bin/configuration.js +0 -1
  3. package/bin/helper.js +0 -38
  4. package/bin/index.js +1 -9
  5. package/bin/presets.js +1 -1
  6. package/bin/prompts.js +46 -79
  7. package/dist/actions/accordion.svelte.d.ts +9 -0
  8. package/dist/actions/index.d.ts +2 -1
  9. package/dist/actions/index.js +2 -1
  10. package/dist/actions/use-theme.d.ts +1 -0
  11. package/dist/actions/use-theme.js +18 -0
  12. package/dist/components/accordion/accordion.css +0 -77
  13. package/dist/components/accordion/accordion.svelte +5 -3
  14. package/dist/components/accordion/modules/accordion-item.css +68 -0
  15. package/dist/components/accordion/modules/accordion-item.svelte +4 -4
  16. package/dist/components/accordion/types.d.ts +1 -1
  17. package/dist/components/alert/alert.css +11 -18
  18. package/dist/components/alert/alert.svelte +4 -4
  19. package/dist/components/alert/types.d.ts +1 -1
  20. package/dist/components/app/app.css +12 -2
  21. package/dist/components/app/app.svelte +68 -37
  22. package/dist/components/app/app.svelte.d.ts +2 -5
  23. package/dist/components/app/types.d.ts +7 -1
  24. package/dist/components/appbar/appbar.css +8 -18
  25. package/dist/components/appbar/appbar.svelte +4 -4
  26. package/dist/components/appbar/types.d.ts +1 -1
  27. package/dist/components/aspect-ratio/aspect-ratio.svelte +0 -22
  28. package/dist/components/aspect-ratio/types.d.ts +1 -1
  29. package/dist/components/avatar/avatar.css +7 -14
  30. package/dist/components/avatar/avatar.svelte +4 -4
  31. package/dist/components/avatar/types.d.ts +1 -1
  32. package/dist/components/button/button.css +29 -36
  33. package/dist/components/button/button.svelte +5 -5
  34. package/dist/components/button/types.d.ts +1 -1
  35. package/dist/components/card/card.css +10 -20
  36. package/dist/components/card/card.svelte +9 -5
  37. package/dist/components/card/types.d.ts +3 -1
  38. package/dist/components/chip/chip.css +26 -33
  39. package/dist/components/chip/chip.svelte +5 -5
  40. package/dist/components/chip/types.d.ts +1 -1
  41. package/dist/components/dialog/dialog.css +13 -20
  42. package/dist/components/dialog/dialog.svelte +5 -5
  43. package/dist/components/dialog/types.d.ts +1 -1
  44. package/dist/components/dropdown/dropdown.css +3 -12
  45. package/dist/components/dropdown/dropdown.svelte +6 -7
  46. package/dist/components/dropdown/types.d.ts +1 -1
  47. package/dist/components/icon/icon.css +11 -12
  48. package/dist/components/icon/icon.svelte +2 -2
  49. package/dist/components/icon/types.d.ts +1 -1
  50. package/dist/components/list/list.css +19 -91
  51. package/dist/components/list/list.svelte +4 -4
  52. package/dist/components/list/modules/list-item.css +67 -0
  53. package/dist/components/list/modules/list-item.svelte +5 -5
  54. package/dist/components/list/types.d.ts +1 -1
  55. package/dist/components/modal/modal.css +15 -23
  56. package/dist/components/modal/modal.svelte +4 -5
  57. package/dist/components/modal/types.d.ts +1 -1
  58. package/dist/components/popover/popover.css +3 -12
  59. package/dist/components/popover/popover.svelte +6 -6
  60. package/dist/components/popover/types.d.ts +1 -1
  61. package/dist/components/separator/separator.css +19 -23
  62. package/dist/components/separator/separator.svelte +6 -6
  63. package/dist/components/separator/types.d.ts +6 -2
  64. package/dist/components/spacer/types.d.ts +1 -1
  65. package/dist/components/textfield/textfield.css +16 -23
  66. package/dist/components/textfield/textfield.svelte +4 -4
  67. package/dist/components/textfield/types.d.ts +1 -1
  68. package/dist/components/toolbar/toolbar.css +11 -34
  69. package/dist/components/toolbar/toolbar.svelte +4 -4
  70. package/dist/components/toolbar/types.d.ts +1 -1
  71. package/dist/components/tooltip/tooltip.css +5 -13
  72. package/dist/components/tooltip/tooltip.svelte +5 -5
  73. package/dist/components/tooltip/types.d.ts +1 -1
  74. package/dist/index.d.ts +2 -26
  75. package/dist/index.js +2 -6
  76. package/dist/internal/config/presets.d.ts +88 -47
  77. package/dist/internal/config/presets.js +89 -41
  78. package/dist/internal/config/variables.d.ts +1 -4
  79. package/dist/internal/config/variables.js +1 -4
  80. package/dist/internal/{assets.svelte.js → core/actions/assets.svelte.js} +4 -4
  81. package/dist/internal/core/actions/dropdown.svelte.d.ts +7 -0
  82. package/dist/internal/core/actions/popover.svelte.d.ts +7 -0
  83. package/dist/internal/core/actions/tooltip.svelte.d.ts +7 -0
  84. package/dist/internal/{ripple.js → core/animations/ripple.js} +3 -3
  85. package/dist/internal/core/css.d.ts +1 -0
  86. package/dist/internal/core/css.js +16 -0
  87. package/dist/internal/core/formatter/component.d.ts +1 -1
  88. package/dist/internal/core/formatter/component.js +25 -21
  89. package/dist/internal/core/formatter/device.d.ts +5 -0
  90. package/dist/internal/core/formatter/device.js +66 -0
  91. package/dist/internal/core/formatter/index.d.ts +3 -1
  92. package/dist/internal/core/formatter/index.js +14 -6
  93. package/dist/internal/core/formatter/{styles.d.ts → style.d.ts} +1 -1
  94. package/dist/internal/core/formatter/{styles.js → style.js} +3 -3
  95. package/dist/internal/core/formatter/theme.d.ts +1 -1
  96. package/dist/internal/core/formatter/theme.js +30 -6
  97. package/dist/internal/core/formatter/typography.d.ts +1 -1
  98. package/dist/internal/core/formatter/typography.js +2 -2
  99. package/dist/internal/core/standard-colors.d.ts +75 -0
  100. package/dist/internal/core/standard-colors.js +75 -0
  101. package/dist/internal/helpers/colors.d.ts +1 -0
  102. package/dist/internal/{colors.js → helpers/colors.js} +2 -2
  103. package/dist/internal/helpers/parser.js +21 -21
  104. package/dist/internal/{scroll.js → helpers/scroll.js} +1 -2
  105. package/dist/internal/plugins/vite.d.ts +2 -2
  106. package/dist/internal/plugins/vite.js +15 -7
  107. package/dist/internal/types/components.d.ts +14 -0
  108. package/dist/internal/types/configuration.d.ts +24 -1
  109. package/dist/internal/types/index.d.ts +1 -0
  110. package/dist/internal/types/index.js +1 -0
  111. package/dist/stores/components.js +1 -1
  112. package/dist/stores/index.d.ts +1 -0
  113. package/dist/stores/index.js +1 -0
  114. package/dist/stores/themes.d.ts +0 -6
  115. package/dist/stores/themes.js +1 -31
  116. package/dist/stores/viewport.d.ts +7 -0
  117. package/dist/stores/viewport.js +7 -0
  118. package/dist/styles/animation.css +33 -0
  119. package/dist/styles/keyframes.css +30 -0
  120. package/dist/{style/normalize.css → styles/reset.css} +15 -7
  121. package/dist/styles.css.d.ts +4 -0
  122. package/dist/themes.css.d.ts +4 -0
  123. package/package.json +128 -103
  124. package/bin/lapikit.js +0 -86
  125. package/bin/legacy.js +0 -34
  126. package/bin/modules/adapter.js +0 -52
  127. package/bin/modules/plugin.js +0 -223
  128. package/bin/modules/preset.js +0 -11
  129. package/dist/app.d.ts +0 -13
  130. package/dist/app.html +0 -12
  131. package/dist/internal/colors.d.ts +0 -1
  132. package/dist/internal/index.d.ts +0 -4
  133. package/dist/internal/index.js +0 -4
  134. package/dist/internal/types.d.ts +0 -57
  135. package/dist/internal/unit.d.ts +0 -1
  136. package/dist/internal/unit.js +0 -11
  137. package/dist/labs/index.d.ts +0 -4
  138. package/dist/labs/index.js +0 -5
  139. package/dist/labs/my-component-style-global.svelte +0 -6
  140. package/dist/labs/my-component-style-global.svelte.d.ts +0 -18
  141. package/dist/labs/my-component-style-import.svelte +0 -15
  142. package/dist/labs/my-component-style-import.svelte.d.ts +0 -18
  143. package/dist/labs/my-component-style-mixed.svelte +0 -23
  144. package/dist/labs/my-component-style-mixed.svelte.d.ts +0 -18
  145. package/dist/labs/my-component.svelte +0 -16
  146. package/dist/labs/my-component.svelte.d.ts +0 -18
  147. package/dist/labs/style-mixed.css +0 -7
  148. package/dist/labs/style.css +0 -7
  149. package/dist/labs.css +0 -25
  150. package/dist/plugin/css.d.ts +0 -1
  151. package/dist/plugin/css.js +0 -73
  152. package/dist/plugin/modules/config.d.ts +0 -2
  153. package/dist/plugin/modules/config.js +0 -54
  154. package/dist/plugin/modules/importer.d.ts +0 -1
  155. package/dist/plugin/modules/importer.js +0 -15
  156. package/dist/plugin/preset-v2.d.ts +0 -108
  157. package/dist/plugin/preset-v2.js +0 -126
  158. package/dist/plugin/vitejs.d.ts +0 -10
  159. package/dist/plugin/vitejs.js +0 -55
  160. package/dist/preset.d.ts +0 -2
  161. package/dist/preset.js +0 -92
  162. package/dist/style/animation.css +0 -62
  163. package/dist/style/css.d.ts +0 -2
  164. package/dist/style/css.js +0 -34
  165. package/dist/style/parser/color.d.ts +0 -5
  166. package/dist/style/parser/color.js +0 -88
  167. package/dist/style/parser/component.d.ts +0 -2
  168. package/dist/style/parser/component.js +0 -115
  169. package/dist/style/parser/device.d.ts +0 -2
  170. package/dist/style/parser/device.js +0 -40
  171. package/dist/style/parser/index.d.ts +0 -4
  172. package/dist/style/parser/index.js +0 -4
  173. package/dist/style/parser/variable.d.ts +0 -2
  174. package/dist/style/parser/variable.js +0 -25
  175. package/dist/style/variable.css +0 -12
  176. /package/dist/{components/accordion → actions}/accordion.svelte.js +0 -0
  177. /package/dist/internal/{assets.svelte.d.ts → core/actions/assets.svelte.d.ts} +0 -0
  178. /package/dist/{components/dropdown → internal/core/actions}/dropdown.svelte.js +0 -0
  179. /package/dist/{components/popover → internal/core/actions}/popover.svelte.js +0 -0
  180. /package/dist/{components/tooltip → internal/core/actions}/tooltip.svelte.js +0 -0
  181. /package/dist/internal/{ripple.d.ts → core/animations/ripple.d.ts} +0 -0
  182. /package/dist/internal/{ansi.d.ts → core/bin/ansi.d.ts} +0 -0
  183. /package/dist/internal/{ansi.js → core/bin/ansi.js} +0 -0
  184. /package/dist/internal/{terminal.d.ts → core/bin/terminal.d.ts} +0 -0
  185. /package/dist/internal/{terminal.js → core/bin/terminal.js} +0 -0
  186. /package/dist/internal/{minify.d.ts → core/minify.d.ts} +0 -0
  187. /package/dist/internal/{minify.js → core/minify.js} +0 -0
  188. /package/dist/{utils/x11.d.ts → internal/core/x11-colors.d.ts} +0 -0
  189. /package/dist/{utils/x11.js → internal/core/x11-colors.js} +0 -0
  190. /package/dist/{utils → internal/helpers}/convert.d.ts +0 -0
  191. /package/dist/{utils → internal/helpers}/convert.js +0 -0
  192. /package/dist/internal/{deepMerge.d.ts → helpers/deep-merge.d.ts} +0 -0
  193. /package/dist/internal/{deepMerge.js → helpers/deep-merge.js} +0 -0
  194. /package/dist/internal/{clickOutside.d.ts → helpers/outside.d.ts} +0 -0
  195. /package/dist/internal/{clickOutside.js → helpers/outside.js} +0 -0
  196. /package/dist/internal/{scroll.d.ts → helpers/scroll.d.ts} +0 -0
  197. /package/dist/internal/{types.js → types/components.js} +0 -0
  198. /package/dist/{colors.css → themes.css} +0 -0
@@ -1,223 +0,0 @@
1
- import { promises as fs } from 'fs';
2
- import path from 'path';
3
- import { terminal } from '../helper.js';
4
-
5
- const lapikitTsTemplate = `import type { Config } from 'lapikit';
6
-
7
- /**
8
- * Custom configuration for Lapikit
9
- * @see https://lapikit.dev/docs/customize
10
- */
11
- const config: Config = {
12
- theme: {
13
- colorScheme: 'light',
14
- colors: {
15
- primary: '#3b82f6',
16
- secondary: '#6b7280'
17
- }
18
- }
19
- };
20
-
21
- export default config;
22
- `;
23
-
24
- const lapikitJsTemplate = `/**
25
- * Custom configuration for Lapikit
26
- * @see https://lapikit.dev/docs/customize
27
- * @type {import('lapikit').Config}
28
- */
29
- const config = {
30
- theme: {
31
- colorScheme: 'light',
32
- colors: {
33
- primary: '#3b82f6',
34
- secondary: '#6b7280'
35
- }
36
- }
37
- };
38
-
39
- export default config;
40
- `;
41
-
42
- export async function createPluginStructure(pluginPath, isTypescript) {
43
- const resolvedPluginPath = path.resolve(process.cwd(), pluginPath);
44
- const lapikitFileName = isTypescript ? 'lapikit.ts' : 'lapikit.js';
45
- const lapikitFilePath = path.join(resolvedPluginPath, lapikitFileName);
46
-
47
- try {
48
- // Verify plugin directory
49
- try {
50
- await fs.access(resolvedPluginPath);
51
- terminal('info', `The folder ${pluginPath} already exists.`);
52
- } catch {
53
- await fs.mkdir(resolvedPluginPath, { recursive: true });
54
- terminal('success', `Folder ${pluginPath} created successfully.`);
55
- }
56
-
57
- // Create lapikit.ts or lapikit.js
58
- const template = isTypescript ? lapikitTsTemplate : lapikitJsTemplate;
59
- await fs.writeFile(lapikitFilePath, template.trim() + '\n', 'utf8');
60
-
61
- terminal('success', `File ${lapikitFileName} created in ${pluginPath}.`);
62
- } catch (error) {
63
- terminal('error', `Error creating plugin structure: ${error.message}`);
64
- throw error;
65
- }
66
- }
67
-
68
- export async function setupSvelteKitIntegration(pluginPath, isTypescript) {
69
- const srcRoutesPath = path.resolve(process.cwd(), 'src/routes');
70
-
71
- try {
72
- // Check if the src/routes directory exists
73
- await fs.access(srcRoutesPath);
74
- terminal('info', 'Folder src/routes found, configuring SvelteKit...');
75
- } catch {
76
- terminal('info', 'Folder src/routes not found, no SvelteKit configuration needed.');
77
- return;
78
- }
79
-
80
- const layoutPath = path.join(srcRoutesPath, '+layout.svelte');
81
- const pagePath = path.join(srcRoutesPath, '+page.svelte');
82
-
83
- let targetFile = null;
84
- let targetFileName = '';
85
-
86
- try {
87
- await fs.access(layoutPath);
88
- targetFile = layoutPath;
89
- targetFileName = '+layout.svelte';
90
- } catch {
91
- try {
92
- await fs.access(pagePath);
93
- targetFile = pagePath;
94
- targetFileName = '+page.svelte';
95
- } catch {
96
- terminal('warn', 'No +layout.svelte or +page.svelte file found in src/routes.');
97
- return;
98
- }
99
- }
100
-
101
- // Read content
102
- let fileContent = await fs.readFile(targetFile, 'utf8');
103
-
104
- // Get Path
105
- const relativePath = path.relative(
106
- path.dirname(targetFile),
107
- path.resolve(process.cwd(), pluginPath)
108
- );
109
- const lapikitFileName = isTypescript ? 'lapikit' : 'lapikit.js';
110
- const configImportPath = `${relativePath}/${lapikitFileName}`.replace(/\\/g, '/');
111
-
112
- // Imports
113
- const createLapikitImport = `\n\timport { createLapikit } from 'lapikit';`;
114
- const configImport = `\timport config from '${configImportPath}';`;
115
-
116
- const scriptLang = isTypescript ? ' lang="ts"' : '';
117
- const effectCode = `\n\t$effect.pre(() => {\n\t\tcreateLapikit(config);\n\t});`;
118
-
119
- // search balise
120
- const scriptRegex = /<script(\s+lang="ts")?>([\s\S]*?)<\/script>/;
121
- const scriptMatch = fileContent.match(scriptRegex);
122
-
123
- if (scriptMatch) {
124
- // If have script balise , add import
125
- let scriptContent = scriptMatch[2];
126
-
127
- // Add imports if they don't already exist
128
- if (!scriptContent.includes('createLapikit')) {
129
- scriptContent = `${createLapikitImport}\n${configImport}\n${scriptContent}`;
130
- }
131
-
132
- // Add effect
133
- if (!scriptContent.includes('createLapikit(config)')) {
134
- scriptContent += effectCode;
135
- }
136
-
137
- // Replace script balise
138
- const newScript = `<script${scriptMatch[1] || scriptLang}>${scriptContent}\n</script>`;
139
- fileContent = fileContent.replace(scriptRegex, newScript);
140
- } else {
141
- // If no script tag exists, create one
142
- const newScript = `<script${scriptLang}>\n${createLapikitImport}\n${configImport}${effectCode}\n</script>\n\n`;
143
- fileContent = newScript + fileContent;
144
- }
145
-
146
- // Write the modified file
147
- await fs.writeFile(targetFile, fileContent, 'utf8');
148
- terminal('success', `Config added ${targetFileName}.`);
149
- }
150
-
151
- const [, , command] = process.argv;
152
- const typescriptEnabled = envTypescript();
153
- const args = process.argv.slice(2);
154
- const previewMode = args.includes('--preview');
155
-
156
- if (process.argv.includes('--help') || process.argv.includes('-h')) {
157
- terminal(
158
- 'info',
159
- `usage: ${ansi.color.yellow('npx lapikit init {cssPath} [--plugin-path {pluginPath}] [--preview]')}\n\n ${ansi.variant.bold('options:')}\n
160
- - {cssPath}: (${ansi.color.cyan('src/app.css')}) customize path on your origin css file.
161
- - --plugin-path, -p: (${ansi.color.cyan('src/plugin')}) customize path for the plugin directory.
162
- - --preview: active preview mode (plugin + SvelteKit integration)\n\n`
163
- );
164
- process.exit(0);
165
- } else if (command === 'init') {
166
- console.log(' _ _ _ _ _ ');
167
- console.log(' | | (_) | (_) | ');
168
- console.log(' | | __ _ _ __ _| | ___| |_ ');
169
- console.log(" | | / _` | '_ \\| | |/ / | __|");
170
- console.log(' | |___| (_| | |_) | | <| | |_ ');
171
- console.log(' |______\\__,_| .__/|_|_|\\_\\_|\\__|');
172
- console.log(' | | ');
173
- console.log(' |_| \n');
174
-
175
- terminal('none', `${ansi.bold.blue('LAPIKIT')} - Component Library for Svelte\n\n`);
176
-
177
- if (previewMode) {
178
- // Mode preview
179
- const pluginPath = getLapikitPathFromArgs();
180
- const pathValidation = validatePluginPath(pluginPath);
181
- if (!pathValidation.valid) {
182
- terminal('error', `Invalid path: ${pathValidation.error}`);
183
- process.exit(1);
184
- }
185
- try {
186
- await createPluginStructure(pluginPath, typescriptEnabled);
187
- } catch (error) {
188
- terminal('error', `Create plugin structure not working : ${error.message}`);
189
- }
190
- try {
191
- await setupSvelteKitIntegration(pluginPath, typescriptEnabled);
192
- } catch (error) {
193
- terminal('error', `SvelteKit integration setup failed: ${error.message}`);
194
- }
195
- } else {
196
- // Mode classic
197
- const configPath = path.resolve(process.cwd(), 'lapikit.config.js');
198
- try {
199
- await fs.writeFile(configPath, preset.trim() + '\n', 'utf8');
200
- terminal('success', `has create lapikit.config.js on your project.`);
201
- } catch (error) {
202
- terminal('error', `failed to create configuration file:\n\n ${error}`);
203
- terminal(
204
- 'warn',
205
- `you can create lapikit.config.js manually, please visite https://lapikit.dev/docs/getting-started for more information`
206
- );
207
- }
208
- await adapterCSSConfig();
209
- }
210
-
211
- await adapterViteConfig(typescriptEnabled);
212
-
213
- terminal(
214
- 'info',
215
- `${ansi.bold.blue('Thank to use lapikit, discover all posibility with lapikit on https://lapikit.dev')}\n\n`
216
- );
217
-
218
- console.log('Website: https://lapikit.dev');
219
- console.log('Github: https://github.com/nycolaide/lapikit');
220
- console.log('Support the developement: https://buymeacoffee.com/nycolaide');
221
- } else {
222
- terminal('error', `Command not recognized. Try 'npx lapikit -h'`);
223
- }
@@ -1,11 +0,0 @@
1
- export const preset = `
2
- /** @type {import('lapikit').Config} */
3
- export default {
4
- theme: {
5
- colorScheme: 'light',
6
- colors: {
7
- svelte: '#ff3e00'
8
- }
9
- }
10
- };
11
- `;
package/dist/app.d.ts DELETED
@@ -1,13 +0,0 @@
1
- // See https://svelte.dev/docs/kit/types#app.d.ts
2
- // for information about these interfaces
3
- declare global {
4
- namespace App {
5
- // interface Error {}
6
- // interface Locals {}
7
- // interface PageData {}
8
- // interface PageState {}
9
- // interface Platform {}
10
- }
11
- }
12
-
13
- export {};
package/dist/app.html DELETED
@@ -1,12 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="%sveltekit.assets%/favicon.png" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- %sveltekit.head%
8
- </head>
9
- <body data-sveltekit-preload-data="hover">
10
- <div>%sveltekit.body%</div>
11
- </body>
12
- </html>
@@ -1 +0,0 @@
1
- export declare const parseColor: (input: string) => string;
@@ -1,4 +0,0 @@
1
- export * from './terminal.js';
2
- export * from './ansi.js';
3
- export * from './assets.svelte.js';
4
- export * from './scroll.js';
@@ -1,4 +0,0 @@
1
- export * from './terminal.js';
2
- export * from './ansi.js';
3
- export * from './assets.svelte.js';
4
- export * from './scroll.js';
@@ -1,57 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- type IdElementType = string | undefined;
3
- type ClassNameType = string | string[] | undefined;
4
- type StylePropertiesType = string | undefined;
5
- export interface Base {
6
- id?: IdElementType;
7
- class?: ClassNameType;
8
- style?: StylePropertiesType;
9
- [key: string]: any;
10
- }
11
- export interface Component extends Base {
12
- children?: Snippet;
13
- }
14
- export type FontFamily = {
15
- [key: string]: string | string[];
16
- };
17
- export type Colors = {
18
- [key: string]: {
19
- light: string;
20
- dark: string;
21
- } | string;
22
- };
23
- export type Thresholds = {
24
- [key: string]: number | string;
25
- };
26
- export type Radius = {
27
- [key: string]: number | string;
28
- };
29
- export interface Lapikit {
30
- options: {
31
- normalize: boolean;
32
- minify: boolean;
33
- };
34
- theme: {
35
- colorScheme: string;
36
- colors: Colors;
37
- };
38
- breakpoints: {
39
- mobileBreakpoint: string;
40
- tabletBreakpoint: string;
41
- laptopBreakpoint: string;
42
- thresholds: Thresholds;
43
- };
44
- styles: {
45
- spacing: string;
46
- corner: {
47
- active: boolean;
48
- radius: Radius;
49
- };
50
- font: FontFamily;
51
- };
52
- }
53
- type DeepOptional<T> = {
54
- [P in keyof T]?: T[P] extends (infer U)[] ? DeepOptional<U>[] : T[P] extends object ? DeepOptional<T[P]> : T[P];
55
- };
56
- export type LapikitConfig = DeepOptional<Lapikit>;
57
- export {};
@@ -1 +0,0 @@
1
- export declare const setUnit: (value: string | number) => string;
@@ -1,11 +0,0 @@
1
- export const setUnit = (value) => {
2
- if (typeof value === 'number')
3
- return `${value}px`;
4
- if (typeof value === 'string') {
5
- const cleaned = value.trim();
6
- const isOnlyNumericLike = /^[\d.,]+$/.test(cleaned);
7
- if (isOnlyNumericLike)
8
- return `${value}px`;
9
- }
10
- return value;
11
- };
@@ -1,4 +0,0 @@
1
- export { default as CompoGlobal } from './my-component-style-global.svelte';
2
- export { default as CompoMixed } from './my-component-style-mixed.svelte';
3
- export { default as CompoLocal } from './my-component.svelte';
4
- export { default as CompoImport } from './my-component-style-import.svelte';
@@ -1,5 +0,0 @@
1
- // components
2
- export { default as CompoGlobal } from './my-component-style-global.svelte';
3
- export { default as CompoMixed } from './my-component-style-mixed.svelte';
4
- export { default as CompoLocal } from './my-component.svelte';
5
- export { default as CompoImport } from './my-component-style-import.svelte';
@@ -1,6 +0,0 @@
1
- <script lang="ts">
2
- </script>
3
-
4
- <div class="my-compo-style-global">
5
- <h1>Hello World Lapikit Global</h1>
6
- </div>
@@ -1,18 +0,0 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const MyComponentStyleGlobal: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {}, {}, string>;
17
- type MyComponentStyleGlobal = InstanceType<typeof MyComponentStyleGlobal>;
18
- export default MyComponentStyleGlobal;
@@ -1,15 +0,0 @@
1
- <script lang="ts">
2
- </script>
3
-
4
- <div class="my-compo-style-import">
5
- <h1>Hello World Lapikit (import styles)</h1>
6
- </div>
7
-
8
- <style>.my-compo-style-import {
9
- padding: 2.5rem;
10
- }
11
-
12
- .my-compo-style-import h1 {
13
- color: orangered;
14
- }
15
- </style>
@@ -1,18 +0,0 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const MyComponentStyleImport: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {}, {}, string>;
17
- type MyComponentStyleImport = InstanceType<typeof MyComponentStyleImport>;
18
- export default MyComponentStyleImport;
@@ -1,23 +0,0 @@
1
- <script lang="ts">
2
- </script>
3
-
4
- <div class="my-compo-style-mixed">
5
- <h1>Hello World Lapikit Mixed</h1>
6
- </div>
7
-
8
- <style>.my-compo-style-mixed {
9
- padding: 5.5rem;
10
- }
11
-
12
- .my-compo-style-mixed h1 {
13
- color: rgb(101, 52, 218);
14
- }
15
-
16
- div {
17
- padding: 2rem;
18
- }
19
-
20
- h1 {
21
- color: rgb(101, 52, 218);
22
- }
23
- </style>
@@ -1,18 +0,0 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const MyComponentStyleMixed: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {}, {}, string>;
17
- type MyComponentStyleMixed = InstanceType<typeof MyComponentStyleMixed>;
18
- export default MyComponentStyleMixed;
@@ -1,16 +0,0 @@
1
- <script lang="ts">
2
- </script>
3
-
4
- <div class="my-compo-style-local">
5
- <h1>Hello World Lapikit</h1>
6
- </div>
7
-
8
- <style>
9
- div {
10
- padding: 2rem;
11
- }
12
-
13
- h1 {
14
- color: purple;
15
- }
16
- </style>
@@ -1,18 +0,0 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const MyComponent: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {}, {}, string>;
17
- type MyComponent = InstanceType<typeof MyComponent>;
18
- export default MyComponent;
@@ -1,7 +0,0 @@
1
- .my-compo-style-mixed {
2
- padding: 5.5rem;
3
- }
4
-
5
- .my-compo-style-mixed h1 {
6
- color: rgb(101, 52, 218);
7
- }
@@ -1,7 +0,0 @@
1
- .my-compo-style-import {
2
- padding: 2.5rem;
3
- }
4
-
5
- .my-compo-style-import h1 {
6
- color: orangered;
7
- }
package/dist/labs.css DELETED
@@ -1,25 +0,0 @@
1
- /* The future of css lapikit */
2
-
3
- .my-compo-style-global {
4
- padding: 1.5rem;
5
- }
6
-
7
- .my-compo-style-global h1 {
8
- color: greenyellow;
9
- }
10
-
11
- @media (max-width: 480px) {
12
- :root {
13
- --active-bp: sm;
14
- }
15
- }
16
- @media (max-width: 768px) {
17
- :root {
18
- --active-bp: md;
19
- }
20
- }
21
- @media (max-width: 1024px) {
22
- :root {
23
- --active-bp: lg;
24
- }
25
- }
@@ -1 +0,0 @@
1
- export declare function css(configuration: any): Promise<void>;
@@ -1,73 +0,0 @@
1
- import { deepMerge } from '../internal/deepMerge.js';
2
- import { preset } from './preset-v2.js';
3
- import { fileURLToPath } from 'url';
4
- import { dirname } from 'path';
5
- import fsPromises from 'fs/promises';
6
- import path from 'path';
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = dirname(__filename);
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
- export async function css(configuration) {
11
- console.log('VALUE configuration', configuration);
12
- console.log('configuration?.theme?.themes', configuration?.theme?.themes);
13
- // states
14
- const defaultTheme = configuration?.theme?.defaultTheme || preset.theme.defaultTheme;
15
- const themesMerged = deepMerge(preset.theme.themes, configuration?.theme?.themes || {});
16
- let response = '';
17
- console.log('VALUE themesMerged', themesMerged);
18
- for (const [name, values] of Object.entries(themesMerged)) {
19
- let css = defaultTheme === name ? `:root,\n.${name} {\n` : `.${name} {\n`;
20
- // ref
21
- const ref = values?.dark ? preset.theme.themes.dark : preset.theme.themes.light;
22
- // colors
23
- css += ` color-scheme: ${values?.dark ? 'dark' : 'light'};\n`;
24
- for (const [varName, varValue] of Object.entries(deepMerge(ref.colors, values?.colors) || {})) {
25
- css += ` --system-${varName}: ${varValue};\n`;
26
- }
27
- // console.log('VALUE', values, deepMerge(values?.variables, ref.variables));
28
- // variables
29
- for (const [name, varValue] of Object.entries(deepMerge(ref.variables, values?.variables) || {})) {
30
- css += ` --kit-${name}: ${varValue};\n`;
31
- }
32
- css += '}\n';
33
- // console.log(`Themes colors (${name}):`, css);
34
- response += css;
35
- }
36
- // console.log('All themes CSS:', response);
37
- //typography
38
- // states
39
- const defaultTypography = configuration?.typography?.defaultTypography || preset.typography.defaultTypography;
40
- for (const [name, values] of Object.entries(deepMerge(preset.typography.fonts, configuration?.typography?.fonts || {}))) {
41
- let css = '';
42
- css += defaultTypography === name ? `:root {\n` : `.${name} {\n`;
43
- // fonts
44
- for (const [fontName, fontValue] of Object.entries(values || {})) {
45
- css += ` --kit-font-${fontName}: ${parser(fontValue)};\n`;
46
- }
47
- css += '}\n';
48
- response += css;
49
- }
50
- //styles
51
- response += `:root {\n`;
52
- for (const [name, values] of Object.entries(deepMerge(preset.styles, configuration?.styles || {}))) {
53
- let css = '';
54
- if (values && typeof values === 'object') {
55
- for (const [styleName, styleValue] of Object.entries(values || {})) {
56
- css += ` --prism-${name}-${styleName}: ${parser(styleValue)};\n`;
57
- }
58
- }
59
- else {
60
- css += ` --prism-${name}: ${parser(values)};\n`;
61
- }
62
- response += css;
63
- }
64
- response += '}\n';
65
- fsPromises.writeFile(path.resolve(__dirname, '../colors.css'), response);
66
- }
67
- const parser = (value) => {
68
- if (typeof value === 'number')
69
- return `${value}px`;
70
- if (Array.isArray(value))
71
- return value.join(', ');
72
- return value;
73
- };
@@ -1,2 +0,0 @@
1
- import type { LapikitConfig } from '../../internal/types.js';
2
- export declare const parseConfig: (props?: LapikitConfig) => import("../../internal/types.js").Lapikit;