lapikit 0.0.0-insiders.0003d39

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/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/bin/helper.js +97 -0
  4. package/bin/index.js +113 -0
  5. package/bin/lapikit.js +86 -0
  6. package/bin/legacy.js +34 -0
  7. package/bin/modules/adapter.js +52 -0
  8. package/bin/modules/plugin.js +223 -0
  9. package/bin/modules/preset.js +11 -0
  10. package/dist/actions/index.d.ts +1 -0
  11. package/dist/actions/index.js +1 -0
  12. package/dist/app.d.ts +13 -0
  13. package/dist/app.html +12 -0
  14. package/dist/assets/icons/arrow-down.svelte +12 -0
  15. package/dist/assets/icons/arrow-down.svelte.d.ts +18 -0
  16. package/dist/assets/icons/arrow-up.svelte +12 -0
  17. package/dist/assets/icons/arrow-up.svelte.d.ts +18 -0
  18. package/dist/assets/icons/close-fill.svelte +12 -0
  19. package/dist/assets/icons/close-fill.svelte.d.ts +18 -0
  20. package/dist/assets/icons/loading-fill.svelte +31 -0
  21. package/dist/assets/icons/loading-fill.svelte.d.ts +18 -0
  22. package/dist/components/accordion/accordion.css +113 -0
  23. package/dist/components/accordion/accordion.svelte +37 -0
  24. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  25. package/dist/components/accordion/accordion.svelte.js +24 -0
  26. package/dist/components/accordion/modules/accordion-item.svelte +94 -0
  27. package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
  28. package/dist/components/accordion/types.d.ts +33 -0
  29. package/dist/components/accordion/types.js +1 -0
  30. package/dist/components/alert/alert.css +137 -0
  31. package/dist/components/alert/alert.svelte +89 -0
  32. package/dist/components/alert/alert.svelte.d.ts +4 -0
  33. package/dist/components/alert/types.d.ts +28 -0
  34. package/dist/components/alert/types.js +1 -0
  35. package/dist/components/app/app.css +16 -0
  36. package/dist/components/app/app.svelte +43 -0
  37. package/dist/components/app/app.svelte.d.ts +7 -0
  38. package/dist/components/app/types.d.ts +4 -0
  39. package/dist/components/app/types.js +1 -0
  40. package/dist/components/appbar/appbar.css +48 -0
  41. package/dist/components/appbar/appbar.svelte +40 -0
  42. package/dist/components/appbar/appbar.svelte.d.ts +4 -0
  43. package/dist/components/appbar/types.d.ts +15 -0
  44. package/dist/components/appbar/types.js +1 -0
  45. package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
  46. package/dist/components/aspect-ratio/aspect-ratio.svelte +47 -0
  47. package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
  48. package/dist/components/aspect-ratio/types.d.ts +5 -0
  49. package/dist/components/aspect-ratio/types.js +1 -0
  50. package/dist/components/avatar/avatar.css +109 -0
  51. package/dist/components/avatar/avatar.svelte +46 -0
  52. package/dist/components/avatar/avatar.svelte.d.ts +4 -0
  53. package/dist/components/avatar/types.d.ts +22 -0
  54. package/dist/components/avatar/types.js +1 -0
  55. package/dist/components/button/button.css +247 -0
  56. package/dist/components/button/button.svelte +102 -0
  57. package/dist/components/button/button.svelte.d.ts +4 -0
  58. package/dist/components/button/types.d.ts +29 -0
  59. package/dist/components/button/types.js +1 -0
  60. package/dist/components/card/card.css +115 -0
  61. package/dist/components/card/card.svelte +63 -0
  62. package/dist/components/card/card.svelte.d.ts +4 -0
  63. package/dist/components/card/types.d.ts +18 -0
  64. package/dist/components/card/types.js +1 -0
  65. package/dist/components/chip/chip.css +231 -0
  66. package/dist/components/chip/chip.svelte +129 -0
  67. package/dist/components/chip/chip.svelte.d.ts +4 -0
  68. package/dist/components/chip/types.d.ts +31 -0
  69. package/dist/components/chip/types.js +1 -0
  70. package/dist/components/dialog/dialog.css +134 -0
  71. package/dist/components/dialog/dialog.svelte +67 -0
  72. package/dist/components/dialog/dialog.svelte.d.ts +4 -0
  73. package/dist/components/dialog/types.d.ts +24 -0
  74. package/dist/components/dialog/types.js +1 -0
  75. package/dist/components/dropdown/dropdown.css +22 -0
  76. package/dist/components/dropdown/dropdown.svelte +116 -0
  77. package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
  78. package/dist/components/dropdown/dropdown.svelte.js +148 -0
  79. package/dist/components/dropdown/types.d.ts +26 -0
  80. package/dist/components/dropdown/types.js +1 -0
  81. package/dist/components/icon/icon.css +79 -0
  82. package/dist/components/icon/icon.svelte +49 -0
  83. package/dist/components/icon/icon.svelte.d.ts +4 -0
  84. package/dist/components/icon/types.d.ts +16 -0
  85. package/dist/components/icon/types.js +1 -0
  86. package/dist/components/index.d.ts +22 -0
  87. package/dist/components/index.js +23 -0
  88. package/dist/components/list/list.css +221 -0
  89. package/dist/components/list/list.svelte +44 -0
  90. package/dist/components/list/list.svelte.d.ts +4 -0
  91. package/dist/components/list/modules/list-item.svelte +76 -0
  92. package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
  93. package/dist/components/list/types.d.ts +33 -0
  94. package/dist/components/list/types.js +1 -0
  95. package/dist/components/modal/modal.css +144 -0
  96. package/dist/components/modal/modal.svelte +113 -0
  97. package/dist/components/modal/modal.svelte.d.ts +4 -0
  98. package/dist/components/modal/types.d.ts +26 -0
  99. package/dist/components/modal/types.js +1 -0
  100. package/dist/components/popover/popover.css +22 -0
  101. package/dist/components/popover/popover.svelte +73 -0
  102. package/dist/components/popover/popover.svelte.d.ts +4 -0
  103. package/dist/components/popover/popover.svelte.js +134 -0
  104. package/dist/components/popover/types.d.ts +20 -0
  105. package/dist/components/popover/types.js +1 -0
  106. package/dist/components/separator/separator.css +46 -0
  107. package/dist/components/separator/separator.svelte +37 -0
  108. package/dist/components/separator/separator.svelte.d.ts +4 -0
  109. package/dist/components/separator/types.d.ts +11 -0
  110. package/dist/components/separator/types.js +1 -0
  111. package/dist/components/spacer/spacer.css +3 -0
  112. package/dist/components/spacer/spacer.svelte +7 -0
  113. package/dist/components/spacer/spacer.svelte.d.ts +4 -0
  114. package/dist/components/spacer/types.d.ts +4 -0
  115. package/dist/components/spacer/types.js +1 -0
  116. package/dist/components/textfield/textfield.css +305 -0
  117. package/dist/components/textfield/textfield.svelte +193 -0
  118. package/dist/components/textfield/textfield.svelte.d.ts +4 -0
  119. package/dist/components/textfield/types.d.ts +37 -0
  120. package/dist/components/textfield/types.js +1 -0
  121. package/dist/components/toolbar/toolbar.css +129 -0
  122. package/dist/components/toolbar/toolbar.svelte +47 -0
  123. package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
  124. package/dist/components/toolbar/types.d.ts +27 -0
  125. package/dist/components/toolbar/types.js +1 -0
  126. package/dist/components/tooltip/tooltip.css +124 -0
  127. package/dist/components/tooltip/tooltip.svelte +113 -0
  128. package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
  129. package/dist/components/tooltip/tooltip.svelte.js +131 -0
  130. package/dist/components/tooltip/types.d.ts +23 -0
  131. package/dist/components/tooltip/types.js +1 -0
  132. package/dist/index.d.ts +1 -0
  133. package/dist/index.js +4 -0
  134. package/dist/internal/ansi.d.ts +40 -0
  135. package/dist/internal/ansi.js +44 -0
  136. package/dist/internal/assets.svelte.d.ts +8 -0
  137. package/dist/internal/assets.svelte.js +54 -0
  138. package/dist/internal/clickOutside.d.ts +9 -0
  139. package/dist/internal/clickOutside.js +34 -0
  140. package/dist/internal/colors.d.ts +1 -0
  141. package/dist/internal/colors.js +50 -0
  142. package/dist/internal/index.d.ts +4 -0
  143. package/dist/internal/index.js +4 -0
  144. package/dist/internal/minify.d.ts +1 -0
  145. package/dist/internal/minify.js +10 -0
  146. package/dist/internal/ripple.d.ts +12 -0
  147. package/dist/internal/ripple.js +93 -0
  148. package/dist/internal/scroll.d.ts +1 -0
  149. package/dist/internal/scroll.js +6 -0
  150. package/dist/internal/terminal.d.ts +1 -0
  151. package/dist/internal/terminal.js +12 -0
  152. package/dist/internal/types.d.ts +57 -0
  153. package/dist/internal/types.js +1 -0
  154. package/dist/internal/unit.d.ts +1 -0
  155. package/dist/internal/unit.js +11 -0
  156. package/dist/plugin/modules/config.d.ts +2 -0
  157. package/dist/plugin/modules/config.js +54 -0
  158. package/dist/plugin/modules/importer.d.ts +1 -0
  159. package/dist/plugin/modules/importer.js +15 -0
  160. package/dist/plugin/vitejs.d.ts +6 -0
  161. package/dist/plugin/vitejs.js +26 -0
  162. package/dist/preset.d.ts +2 -0
  163. package/dist/preset.js +92 -0
  164. package/dist/stores/index.d.ts +10 -0
  165. package/dist/stores/index.js +47 -0
  166. package/dist/style/animation.css +62 -0
  167. package/dist/style/css.d.ts +2 -0
  168. package/dist/style/css.js +34 -0
  169. package/dist/style/normalize.css +125 -0
  170. package/dist/style/parser/color.d.ts +5 -0
  171. package/dist/style/parser/color.js +88 -0
  172. package/dist/style/parser/component.d.ts +2 -0
  173. package/dist/style/parser/component.js +115 -0
  174. package/dist/style/parser/device.d.ts +2 -0
  175. package/dist/style/parser/device.js +40 -0
  176. package/dist/style/parser/index.d.ts +4 -0
  177. package/dist/style/parser/index.js +4 -0
  178. package/dist/style/parser/variable.d.ts +2 -0
  179. package/dist/style/parser/variable.js +25 -0
  180. package/dist/style/variable.css +12 -0
  181. package/dist/styles.css +0 -0
  182. package/dist/utils/x11.d.ts +4 -0
  183. package/dist/utils/x11.js +151 -0
  184. package/package.json +97 -0
@@ -0,0 +1,54 @@
1
+ import { config } from '../../preset.js';
2
+ export const parseConfig = (props) => {
3
+ if (!props)
4
+ return config;
5
+ const newConfig = { ...config };
6
+ if (props?.options) {
7
+ if (props.options.normalize !== undefined)
8
+ newConfig.options.normalize = props.options.normalize;
9
+ if (props.options.minify !== undefined)
10
+ newConfig.options.minify = props.options.minify;
11
+ }
12
+ if (props?.theme) {
13
+ if (props.theme.colorScheme !== undefined)
14
+ newConfig.theme.colorScheme = props.theme.colorScheme;
15
+ if (props.theme.colors) {
16
+ newConfig.theme.colors = {
17
+ ...newConfig.theme.colors,
18
+ ...props.theme.colors
19
+ };
20
+ }
21
+ }
22
+ if (props?.breakpoints) {
23
+ if (props.breakpoints.mobileBreakpoint !== undefined)
24
+ newConfig.breakpoints.mobileBreakpoint = props.breakpoints.mobileBreakpoint;
25
+ if (props.breakpoints.tabletBreakpoint !== undefined)
26
+ newConfig.breakpoints.tabletBreakpoint = props.breakpoints.tabletBreakpoint;
27
+ if (props.breakpoints.laptopBreakpoint !== undefined)
28
+ newConfig.breakpoints.laptopBreakpoint = props.breakpoints.laptopBreakpoint;
29
+ if (props.breakpoints.thresholds)
30
+ newConfig.breakpoints.thresholds = {
31
+ ...newConfig.breakpoints.thresholds,
32
+ ...props.breakpoints.thresholds
33
+ };
34
+ }
35
+ if (props?.styles) {
36
+ if (props.styles.spacing !== undefined)
37
+ newConfig.styles.spacing = props.styles.spacing;
38
+ if (props.styles.corner !== undefined) {
39
+ if (props.styles.corner.active !== undefined)
40
+ newConfig.styles.corner.active = props.styles.corner.active;
41
+ if (props.styles.corner.radius)
42
+ newConfig.styles.corner.radius = {
43
+ ...newConfig.styles.corner.radius,
44
+ ...props.styles.corner.radius
45
+ };
46
+ }
47
+ if (props.styles.font)
48
+ newConfig.styles.font = {
49
+ ...newConfig.styles.font,
50
+ ...props.styles.font
51
+ };
52
+ }
53
+ return newConfig;
54
+ };
@@ -0,0 +1 @@
1
+ export declare const importer: () => Promise<any>;
@@ -0,0 +1,15 @@
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+ import { terminal, ansi } from '../../internal/index.js';
4
+ const app = process.cwd();
5
+ const pathConfig = path.resolve(app, 'lapikit.config.js');
6
+ export const importer = async () => {
7
+ if (!fs.existsSync(pathConfig)) {
8
+ terminal('error', `config file not found\n ${ansi.color.yellow('Could not find lapikit.config.js. See https://localhost/docs/kit/vite to learn more about the configuration file.')}\n\n${ansi.color.blue('for initializing a new lapikit config, run:')}\n ${ansi.variant.bold('npx lapikit init')} ${ansi.bold.yellow('(preview)')}\n\n`);
9
+ process.exit(1);
10
+ }
11
+ const timestamp = Date.now();
12
+ const fileUrl = `file://${pathConfig}?t=${timestamp}`;
13
+ const content = await import(fileUrl);
14
+ return content.default;
15
+ };
@@ -0,0 +1,6 @@
1
+ import type { ViteDevServer } from 'vite';
2
+ export declare function lapikit(): Promise<{
3
+ name: string;
4
+ configResolved(): Promise<void>;
5
+ configureServer(server: ViteDevServer): Promise<void>;
6
+ }>;
@@ -0,0 +1,26 @@
1
+ import { importer } from './modules/importer.js';
2
+ import { processCSS } from '../style/css.js';
3
+ import { parseConfig } from './modules/config.js';
4
+ import { terminal } from '../internal/terminal.js';
5
+ export async function lapikit() {
6
+ return {
7
+ name: 'lapikit/vite.js',
8
+ async configResolved() {
9
+ const config = await importer();
10
+ const result = await parseConfig(config);
11
+ await processCSS(result);
12
+ terminal('info', 'lapikit is up!');
13
+ },
14
+ async configureServer(server) {
15
+ server.watcher.add('./lapikit.config.js');
16
+ server.watcher.on('change', async (filePath) => {
17
+ if (String(filePath).includes('lapikit.config.js')) {
18
+ const config = await importer();
19
+ const result = await parseConfig(config);
20
+ await processCSS(result);
21
+ terminal('info', 'lapikit config reloaded');
22
+ }
23
+ });
24
+ }
25
+ };
26
+ }
@@ -0,0 +1,2 @@
1
+ import type { Lapikit } from './internal/types.js';
2
+ export declare const config: Lapikit;
package/dist/preset.js ADDED
@@ -0,0 +1,92 @@
1
+ export const config = {
2
+ options: {
3
+ normalize: true, // true | false
4
+ minify: false // true | false
5
+ },
6
+ theme: {
7
+ colorScheme: 'system', // 'light' | 'dark' | 'system'
8
+ colors: {
9
+ primary: { light: 'oklch(45% 0.24 277.023)', dark: 'oklch(45% 0.24 277.023)' },
10
+ 'on-primary': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
11
+ secondary: { light: 'oklch(65% 0.241 354.308)', dark: 'oklch(65% 0.241 354.308)' },
12
+ 'on-secondary': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
13
+ tertiary: { light: 'oklch(77% 0.152 181.912)', dark: 'oklch(77% 0.152 181.912)' },
14
+ 'on-tertiary': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
15
+ neutral: { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
16
+ 'on-neutral': { light: 'oklch(100% 0 0)', dark: 'oklch(100% 0 0)' },
17
+ info: { light: 'oklch(74% 0.16 232.661)', dark: 'oklch(74% 0.16 232.661)' },
18
+ 'on-info': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
19
+ success: { light: 'oklch(76% 0.177 163.223)', dark: 'oklch(76% 0.177 163.223)' },
20
+ 'on-success': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
21
+ warning: { light: 'oklch(82% 0.189 84.429)', dark: 'oklch(82% 0.189 84.429)' },
22
+ 'on-warning': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
23
+ error: { light: 'oklch(71% 0.194 13.428)', dark: 'oklch(71% 0.194 13.428)' },
24
+ 'on-error': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
25
+ base: { light: 'oklch(100% 0 0)', dark: 'oklch(25.33% 0.016 252.42)' },
26
+ 'on-base': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(100% 0 0)' },
27
+ surface: { light: 'oklch(98% 0 0)', dark: 'oklch(23.26% 0.014 253.1)' },
28
+ 'on-surface': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(100% 0 0)' },
29
+ container: { light: 'oklch(95% 0 0)', dark: 'oklch(21.15% 0.012 254.09)' },
30
+ 'on-container': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(100% 0 0)' },
31
+ shadow: 'black',
32
+ scrim: 'oklch(0.00% 0.000 0)'
33
+ }
34
+ },
35
+ breakpoints: {
36
+ mobileBreakpoint: 'sm',
37
+ tabletBreakpoint: 'md',
38
+ laptopBreakpoint: 'lg',
39
+ thresholds: {
40
+ _default: 0, // 0px
41
+ xs: '28rem', //448px
42
+ sm: '40rem', //640px
43
+ md: '48rem', //768px
44
+ lg: '64rem', //1024px
45
+ xl: '80rem', //1280px
46
+ '2xl': '96rem', //1536px
47
+ '3xl': '112rem' //1792px
48
+ }
49
+ },
50
+ styles: {
51
+ spacing: '0.125rem', // 2px
52
+ corner: {
53
+ active: true, // true | false
54
+ radius: {
55
+ sm: '0.125rem', // 2px
56
+ md: '0.25rem', // 4px
57
+ lg: '0.5rem', // 8px
58
+ xl: '0.75rem', // 12px
59
+ '2xl': '1rem', // 16px
60
+ '3xl': '1.5rem', // 24px
61
+ full: '9999px' // 9999px
62
+ }
63
+ },
64
+ font: {
65
+ sans: [
66
+ 'system-ui',
67
+ '-apple-system',
68
+ 'BlinkMacSystemFont',
69
+ 'Segoe UI',
70
+ 'Roboto',
71
+ 'Helvetica Neue',
72
+ 'Arial',
73
+ 'sans-serif',
74
+ 'Apple Color Emoji',
75
+ 'Segoe UI Emoji',
76
+ 'Segoe UI Symbol'
77
+ ],
78
+ mono: [
79
+ 'SFMono-Regular',
80
+ 'ui-monospace',
81
+ 'SF Mono',
82
+ 'Menlo',
83
+ 'Monaco',
84
+ 'Consolas',
85
+ 'Liberation Mono',
86
+ 'Courier New',
87
+ 'monospace'
88
+ ],
89
+ serif: ['Merriweather', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif']
90
+ }
91
+ }
92
+ };
@@ -0,0 +1,10 @@
1
+ import { type Writable } from 'svelte/store';
2
+ export declare const colorScheme: Writable<'system' | 'dark' | 'light'>;
3
+ export declare const colorSchemeSystem: Writable<'dark' | 'light'>;
4
+ export declare const modalOpen: Writable<boolean | 'persistent'>;
5
+ export declare const modalStack: Writable<string[]>;
6
+ export declare function updateThemeStore(update: 'system' | 'dark' | 'light'): void;
7
+ export declare function setColorScheme(scheme: 'system' | 'dark' | 'light'): void;
8
+ export declare function setOpenModal(state: boolean | 'persistent'): void;
9
+ export declare const pushModal: (id: string) => void;
10
+ export declare const popModal: (id: string) => void;
@@ -0,0 +1,47 @@
1
+ import { disabledScroll } from '../internal/scroll.js';
2
+ import { writable } from 'svelte/store';
3
+ // states
4
+ const colorScheme_default = 'system';
5
+ const modalOpen_default = false;
6
+ const isBrowser = typeof window !== 'undefined';
7
+ export const colorScheme = writable(colorScheme_default);
8
+ export const colorSchemeSystem = writable('light');
9
+ export const modalOpen = writable(modalOpen_default);
10
+ export const modalStack = writable([]);
11
+ export function updateThemeStore(update) {
12
+ colorScheme.update(() => {
13
+ if (isBrowser) {
14
+ const ref = document.documentElement.classList;
15
+ if (update === 'system')
16
+ ref.remove('light', 'dark');
17
+ else {
18
+ ref.remove(update === 'dark' ? 'light' : 'dark');
19
+ ref.add(update === 'dark' ? 'dark' : 'light');
20
+ }
21
+ localStorage.setItem('@lapikit/theme', update);
22
+ }
23
+ return update;
24
+ });
25
+ }
26
+ export function setColorScheme(scheme) {
27
+ updateThemeStore(scheme);
28
+ }
29
+ export function setOpenModal(state) {
30
+ modalOpen.set(state);
31
+ }
32
+ export const pushModal = (id) => {
33
+ modalStack.update((stack) => {
34
+ let values = stack;
35
+ if (!stack.includes(id))
36
+ values = [...stack, id];
37
+ disabledScroll(values.length !== 0 ? true : false);
38
+ return values;
39
+ });
40
+ };
41
+ export const popModal = (id) => {
42
+ modalStack.update((stack) => {
43
+ const newStack = stack.filter((m) => m !== id);
44
+ disabledScroll(newStack.length !== 0 ? true : false);
45
+ return newStack.length === 0 ? [] : newStack;
46
+ });
47
+ };
@@ -0,0 +1,62 @@
1
+ @keyframes button-click {
2
+ 0% {
3
+ transform: scale(0.98);
4
+ }
5
+ 40% {
6
+ transform: scale(1.02);
7
+ }
8
+ 100% {
9
+ transform: scale(1);
10
+ }
11
+ }
12
+
13
+ @keyframes icon-rotate {
14
+ 0% {
15
+ transform: rotate(10deg);
16
+ }
17
+ 100% {
18
+ transform: rotate(380deg);
19
+ }
20
+ }
21
+
22
+ .kit-ripple {
23
+ background-color: currentColor;
24
+ opacity: 0.1;
25
+ position: absolute;
26
+ border-radius: 50%;
27
+ pointer-events: none;
28
+ -webkit-transition: 0.6s;
29
+ transition: 0.6s;
30
+ -webkit-animation: lapikit-ripple var(--ripple-duration, 0.4s) cubic-bezier(0.4, 0, 0.2, 1);
31
+ animation: lapikit-ripple var(--ripple-duration, 0.4s) cubic-bezier(0.4, 0, 0.2, 1);
32
+ border-radius: var(--ripple-radius);
33
+ }
34
+
35
+ .kit-ripple--center {
36
+ top: 50% !important;
37
+ left: 50% !important;
38
+ translate: -50% -50% !important;
39
+ }
40
+
41
+ .kit-ripple--effect {
42
+ position: absolute;
43
+ left: 0;
44
+ right: 0;
45
+ top: 0;
46
+ bottom: 0;
47
+ overflow: hidden;
48
+ background: none;
49
+ pointer-events: none;
50
+ z-index: 999;
51
+ border-radius: var(--ripple-radius);
52
+ }
53
+
54
+ @keyframes lapikit-ripple {
55
+ from {
56
+ scale: 0;
57
+ }
58
+
59
+ to {
60
+ scale: 1;
61
+ }
62
+ }
@@ -0,0 +1,2 @@
1
+ import type { Lapikit } from '../internal/types.js';
2
+ export declare const processCSS: (config: Lapikit) => Promise<void>;
@@ -0,0 +1,34 @@
1
+ import { fileURLToPath } from 'url';
2
+ import { dirname } from 'path';
3
+ import fs from 'fs';
4
+ import fsPromises from 'fs/promises';
5
+ import path from 'path';
6
+ import { minify } from '../internal/minify.js';
7
+ import { colors, component, devices, variables } from './parser/index.js';
8
+ import { terminal } from '../internal/terminal.js';
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+ export const processCSS = async (config) => {
12
+ const _normalize = fs.readFileSync(path.resolve(__dirname, './normalize.css'), 'utf-8');
13
+ const _animation = fs.readFileSync(path.resolve(__dirname, './animation.css'), 'utf-8');
14
+ const _variables = fs.readFileSync(path.resolve(__dirname, './variable.css'), 'utf-8');
15
+ let styles = ``;
16
+ if (config.options.normalize)
17
+ styles += `${_normalize}\n`;
18
+ const colorScheme = colors(config);
19
+ const deviceDisplay = devices(config);
20
+ const variablesStyles = variables(config);
21
+ styles += `${colorScheme.root}\n`;
22
+ styles += `${variablesStyles}\n`;
23
+ styles += `${variablesStyles}\n`;
24
+ styles += `${_variables}\n`;
25
+ styles += `${colorScheme.className}\n`;
26
+ styles += `${deviceDisplay}\n`;
27
+ styles += component(config);
28
+ styles += `${_animation}\n`;
29
+ if (config.options.minify) {
30
+ styles = minify(styles);
31
+ terminal('success', 'css minified');
32
+ }
33
+ fsPromises.writeFile(path.resolve(__dirname, '../styles.css'), styles);
34
+ };
@@ -0,0 +1,125 @@
1
+ html {
2
+ -webkit-text-size-adjust: 100%;
3
+ tab-size: 4;
4
+ line-height: 1.5;
5
+ box-sizing: border-box;
6
+ font-family: var(--kit-font-family-sans);
7
+ background-color: var(--kit-base);
8
+ color: var(--kit-on-base);
9
+ }
10
+
11
+ pre,
12
+ code {
13
+ font-family: var(--kit-font-family-mono);
14
+ }
15
+
16
+ body {
17
+ margin: 0;
18
+ }
19
+
20
+ main {
21
+ display: block;
22
+ }
23
+
24
+ button,
25
+ input,
26
+ optgroup,
27
+ select,
28
+ textarea {
29
+ font: inherit;
30
+ }
31
+
32
+ button {
33
+ overflow: visible;
34
+ }
35
+
36
+ button,
37
+ [type='button'],
38
+ [type='reset'],
39
+ [type='submit'],
40
+ [role='button'] {
41
+ cursor: pointer;
42
+ color: inherit;
43
+ }
44
+
45
+ *:not(body) {
46
+ outline: none;
47
+ }
48
+
49
+ *,
50
+ ::after,
51
+ ::before,
52
+ ::backdrop {
53
+ box-sizing: border-box;
54
+ margin: 0;
55
+ padding: 0;
56
+ border: 0 solid;
57
+ }
58
+
59
+ *,
60
+ ::before,
61
+ ::after {
62
+ background-repeat: no-repeat;
63
+ box-sizing: inherit;
64
+ }
65
+
66
+ ::before,
67
+ ::after {
68
+ text-decoration: inherit;
69
+ vertical-align: inherit;
70
+ }
71
+
72
+ [type='search'] {
73
+ -webkit-appearance: textfield;
74
+ appearance: textfield;
75
+ outline-offset: -2px;
76
+ }
77
+
78
+ ol,
79
+ ul,
80
+ menu {
81
+ list-style: initial;
82
+ margin-left: calc(var(--kit-spacing) * 5);
83
+ }
84
+
85
+ ol ul,
86
+ ol ol,
87
+ ul ul,
88
+ ul ol {
89
+ padding-left: 1rem;
90
+ }
91
+
92
+ code {
93
+ border-radius: 0.25rem;
94
+ padding-block: 0.125rem;
95
+ padding-inline: 0.375rem;
96
+ position: relative;
97
+ }
98
+
99
+ sub,
100
+ sup {
101
+ font-size: 75%;
102
+ line-height: 0;
103
+ position: relative;
104
+ vertical-align: baseline;
105
+ }
106
+
107
+ sup {
108
+ top: -0.5em;
109
+ }
110
+
111
+ sub {
112
+ bottom: -0.25em;
113
+ }
114
+
115
+ img {
116
+ border-style: none;
117
+ }
118
+
119
+ button,
120
+ input,
121
+ select,
122
+ textarea {
123
+ background-color: transparent;
124
+ border-style: none;
125
+ }
@@ -0,0 +1,5 @@
1
+ import type { Lapikit } from '../../internal/types.js';
2
+ export declare const colors: (config: Lapikit) => {
3
+ root: string;
4
+ className: string;
5
+ };
@@ -0,0 +1,88 @@
1
+ import { parseColor } from '../../internal/colors.js';
2
+ export const colors = (config) => {
3
+ const schemes = {
4
+ light: {},
5
+ dark: {}
6
+ };
7
+ for (const [property, values] of Object.entries(config.theme.colors)) {
8
+ if (typeof values === 'string') {
9
+ // for all color scheme
10
+ const _refColor = parseColor(values);
11
+ schemes['light'][property] = _refColor;
12
+ schemes['dark'][property] = _refColor;
13
+ }
14
+ else {
15
+ // with specification
16
+ if ('light' in values && 'dark' in values) {
17
+ schemes['light'][property] = parseColor(values.light);
18
+ schemes['dark'][property] = parseColor(values.dark);
19
+ }
20
+ else {
21
+ const _refColor = 'dark' in values ? parseColor(values['dark']) : parseColor(values['light']);
22
+ schemes['light'][property] = _refColor;
23
+ schemes['dark'][property] = _refColor;
24
+ }
25
+ }
26
+ }
27
+ // css variables
28
+ let cssVariables = '';
29
+ if (config.theme.colorScheme === 'auto') {
30
+ for (const [themeName, colors] of Object.entries(schemes)) {
31
+ const used = themeName;
32
+ const inversed = used === 'light' ? 'dark' : 'light';
33
+ cssVariables += `@media (prefers-color-scheme: ${used}) {\n`;
34
+ cssVariables += `:root, .${used} {\n`;
35
+ cssVariables += `color-scheme: ${used};\n`;
36
+ for (const [colorName, colorValue] of Object.entries(colors)) {
37
+ cssVariables += `--kit-${colorName}: ${colorValue};\n`;
38
+ }
39
+ cssVariables += `}\n`;
40
+ cssVariables += `.${inversed} {\n`;
41
+ cssVariables += `color-scheme: ${inversed};\n`;
42
+ for (const [colorName, colorValue] of Object.entries(schemes[inversed])) {
43
+ cssVariables += `--kit-${colorName}: ${colorValue};\n`;
44
+ }
45
+ cssVariables += `}\n`;
46
+ cssVariables += `}\n`;
47
+ }
48
+ }
49
+ else {
50
+ const used = config.theme.colorScheme;
51
+ const inversed = config.theme.colorScheme === 'light' ? 'dark' : 'light';
52
+ cssVariables += `:root, .${used} {\n`;
53
+ cssVariables += `color-scheme: ${used};\n`;
54
+ for (const [colorName, colorValue] of Object.entries(schemes[used])) {
55
+ cssVariables += `--kit-${colorName}: ${colorValue};\n`;
56
+ }
57
+ cssVariables += `}\n`;
58
+ cssVariables += `.${inversed} {\n`;
59
+ cssVariables += `color-scheme: ${inversed};\n`;
60
+ for (const [colorName, colorValue] of Object.entries(schemes[inversed])) {
61
+ cssVariables += `--kit-${colorName}: ${colorValue};\n`;
62
+ }
63
+ cssVariables += `}\n`;
64
+ }
65
+ // class
66
+ let classStyles = '';
67
+ for (const [property] of Object.entries(schemes.light)) {
68
+ // classStyles += `.${property}:not([class*='--variant-']) {\n`;
69
+ // classStyles += `--background-color: var(--kit-${property});\n`;
70
+ // classStyles += `--color: var(--kit-on-${property}, var(--kit-${property}));\n`;
71
+ // classStyles += `}\n`;
72
+ // classStyles += `.${property}[class*='--variant-'] {\n`;
73
+ // classStyles += `--color: var(--kit-${property});\n`;
74
+ // classStyles += `}\n`;
75
+ classStyles += `.${property} {\n`;
76
+ classStyles += `--base: var(--kit-${property});\n`;
77
+ classStyles += `--on: var(--kit-on-${property}, var(--kit-${property}));\n`;
78
+ classStyles += `}\n`;
79
+ // classStyles += `.${property}:not([class*='kit-']) {\n`;
80
+ // classStyles += `background-color: var(--kit-${property});\n`;
81
+ // classStyles += `color: var(--kit-on-${property}, var(--kit-${property}));\n`;
82
+ // classStyles += `}\n`;
83
+ }
84
+ return {
85
+ root: cssVariables,
86
+ className: classStyles
87
+ };
88
+ };
@@ -0,0 +1,2 @@
1
+ import type { Lapikit } from '../../internal/types.js';
2
+ export declare const component: (config: Lapikit) => string;