lapikit 0.0.0 → 0.0.2

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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Reexport your entry components here
2
2
  export function helloWorld() {
3
- console.log('Hello world!');
3
+ console.log('Hello world, this is lapikit!');
4
4
  }
@@ -0,0 +1,41 @@
1
+ export declare const ansi: {
2
+ color: {
3
+ red: (text: string) => string;
4
+ green: (text: string) => string;
5
+ yellow: (text: string) => string;
6
+ blue: (text: string) => string;
7
+ purple: (text: string) => string;
8
+ cyan: (text: string) => string;
9
+ };
10
+ variant: {
11
+ bold: (text: string) => string;
12
+ underline: (text: string) => string;
13
+ inverse: (text: string) => string;
14
+ };
15
+ bold: {
16
+ red: (text: string) => string;
17
+ green: (text: string) => string;
18
+ yellow: (text: string) => string;
19
+ blue: (text: string) => string;
20
+ purple: (text: string) => string;
21
+ cyan: (text: string) => string;
22
+ };
23
+ inverse: {
24
+ red: (text: string) => string;
25
+ green: (text: string) => string;
26
+ yellow: (text: string) => string;
27
+ blue: (text: string) => string;
28
+ purple: (text: string) => string;
29
+ cyan: (text: string) => string;
30
+ };
31
+ underline: {
32
+ red: (text: string) => string;
33
+ green: (text: string) => string;
34
+ yellow: (text: string) => string;
35
+ blue: (text: string) => string;
36
+ purple: (text: string) => string;
37
+ cyan: (text: string) => string;
38
+ };
39
+ };
40
+ export type Ansi = typeof ansi;
41
+ export declare const sendConsole: (type: "info" | "error" | "warn" | "success" | undefined, msg: string) => void;
@@ -0,0 +1,55 @@
1
+ const color = {
2
+ red: (text) => `\x1b[31m${text}\x1b[0m`,
3
+ green: (text) => `\x1b[32m${text}\x1b[0m`,
4
+ yellow: (text) => `\x1b[33m${text}\x1b[0m`,
5
+ blue: (text) => `\x1b[34m${text}\x1b[0m`,
6
+ purple: (text) => `\x1b[35m${text}\x1b[0m`,
7
+ cyan: (text) => `\x1b[36m${text}\x1b[0m`
8
+ };
9
+ const variant = {
10
+ bold: (text) => `\x1b[1m${text}\x1b[0m`,
11
+ underline: (text) => `\x1b[4m${text}\x1b[0m`,
12
+ inverse: (text) => `\x1b[7m${text}\x1b[0m`
13
+ };
14
+ const bold = {
15
+ red: (text) => `\x1b[1m\x1b[31m${text}\x1b[0m`,
16
+ green: (text) => `\x1b[1m\x1b[32m${text}\x1b[0m`,
17
+ yellow: (text) => `\x1b[1m\x1b[33m${text}\x1b[0m`,
18
+ blue: (text) => `\x1b[1m\x1b[34m${text}\x1b[0m`,
19
+ purple: (text) => `\x1b[1m\x1b[35m${text}\x1b[0m`,
20
+ cyan: (text) => `\x1b[1m\x1b[36m${text}\x1b[0m`
21
+ };
22
+ const inverse = {
23
+ red: (text) => `\x1b[7m\x1b[31m${text}\x1b[0m`,
24
+ green: (text) => `\x1b[7m\x1b[32m${text}\x1b[0m`,
25
+ yellow: (text) => `\x1b[7m\x1b[33m${text}\x1b[0m`,
26
+ blue: (text) => `\x1b[7m\x1b[34m${text}\x1b[0m`,
27
+ purple: (text) => `\x1b[7m\x1b[35m${text}\x1b[0m`,
28
+ cyan: (text) => `\x1b[7m\x1b[36m${text}\x1b[0m`
29
+ };
30
+ const underline = {
31
+ red: (text) => `\x1b[4m\x1b[31m${text}\x1b[0m`,
32
+ green: (text) => `\x1b[4m\x1b[32m${text}\x1b[0m`,
33
+ yellow: (text) => `\x1b[4m\x1b[33m${text}\x1b[0m`,
34
+ blue: (text) => `\x1b[4m\x1b[34m${text}\x1b[0m`,
35
+ purple: (text) => `\x1b[4m\x1b[35m${text}\x1b[0m`,
36
+ cyan: (text) => `\x1b[4m\x1b[36m${text}\x1b[0m`
37
+ };
38
+ export const ansi = {
39
+ color,
40
+ variant,
41
+ bold,
42
+ inverse,
43
+ underline
44
+ };
45
+ export const sendConsole = (type = 'info', msg) => {
46
+ const name = ansi.color.cyan('lapikit');
47
+ if (type === 'error')
48
+ console.error(name, ansi.bold.red('[error]'), msg);
49
+ else if (type === 'warn')
50
+ console.warn(name, ansi.bold.yellow('[warn]'), msg);
51
+ else if (type === 'success')
52
+ console.warn(name, ansi.bold.green('[success]'), msg);
53
+ else
54
+ console.log(name, ansi.bold.blue('[info]'), msg);
55
+ };
@@ -0,0 +1 @@
1
+ export declare const parseColor: (input: string) => string;
@@ -0,0 +1,50 @@
1
+ import { x11Colors } from './x11.js';
2
+ export const parseColor = (input) => {
3
+ input = input.trim();
4
+ if (input.startsWith('#')) {
5
+ const rgb = hexToRgb(input);
6
+ return rgbToOklch(rgb.r, rgb.g, rgb.b);
7
+ }
8
+ if (input.startsWith('rgb')) {
9
+ const parts = input
10
+ .replace(/rgba?|\(|\)|\s+/g, '')
11
+ .split(',')
12
+ .map(Number);
13
+ return rgbToOklch(parts[0], parts[1], parts[2]);
14
+ }
15
+ if (input.startsWith('oklch('))
16
+ return input;
17
+ if (x11Colors[input]) {
18
+ const hex = x11Colors[input];
19
+ const rgb = hexToRgb(hex);
20
+ return rgbToOklch(rgb.r, rgb.g, rgb.b);
21
+ }
22
+ return input;
23
+ };
24
+ const hexToRgb = (hex) => {
25
+ const clean = hex.replace('#', '');
26
+ const bigint = parseInt(clean, 16);
27
+ return {
28
+ r: (bigint >> 16) & 255,
29
+ g: (bigint >> 8) & 255,
30
+ b: bigint & 255
31
+ };
32
+ };
33
+ const srgbToLinear = (c) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4);
34
+ const rgbToOklch = (r, g, b) => {
35
+ r = srgbToLinear(r / 255);
36
+ g = srgbToLinear(g / 255);
37
+ b = srgbToLinear(b / 255);
38
+ const l = 0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b;
39
+ const m = 0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b;
40
+ const s = 0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b;
41
+ const l_ = Math.cbrt(l);
42
+ const m_ = Math.cbrt(m);
43
+ const s_ = Math.cbrt(s);
44
+ const L = 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_;
45
+ const a = 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_;
46
+ const b_ = 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_;
47
+ const C = Math.sqrt(a * a + b_ * b_);
48
+ const h = (Math.atan2(b_, a) * 180) / Math.PI;
49
+ return `oklch(${(L * 100).toFixed(3)}% ${C.toFixed(4)} ${((h + 360) % 360).toFixed(2)})`;
50
+ };
@@ -0,0 +1 @@
1
+ export declare const processCSS: (minified?: boolean, normalize?: boolean) => Promise<void>;
@@ -0,0 +1,141 @@
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 { ansi, sendConsole } from './ansi.js';
7
+ import { minify } from './minify.js';
8
+ import { colors } from './themes.js';
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+ const __components = path.resolve('src/components');
12
+ // temps
13
+ const breakpoints = {
14
+ _default: 0,
15
+ desktop: 1024,
16
+ tablet: '768vw',
17
+ mobile: 480
18
+ };
19
+ export const processCSS = async (minified, normalize) => {
20
+ console.log(ansi.bold.blue('Processing CSS...'));
21
+ const _normalize = fs.readFileSync(path.resolve(__dirname, '../../styles/normalize.css'), 'utf-8');
22
+ const _variables = fs.readFileSync(path.resolve(__dirname, '../../styles/variables.css'), 'utf-8');
23
+ let styles = `${_variables}\n`;
24
+ if (normalize)
25
+ styles += `${_normalize}\n`;
26
+ const colorScheme = colors();
27
+ styles += `${colorScheme.root}\n`;
28
+ styles += `${colorScheme.className}\n`;
29
+ if (fs.existsSync(__components) && fs.statSync(__components).isDirectory()) {
30
+ const tresholds = {
31
+ _default: '',
32
+ static: '',
33
+ min: '',
34
+ max: '',
35
+ all: ''
36
+ };
37
+ function loadComponentCSS(directory) {
38
+ fs.readdirSync(directory).forEach((File) => {
39
+ const absolutePath = path.join(directory, File);
40
+ if (fs.statSync(absolutePath).isDirectory())
41
+ return loadComponentCSS(absolutePath);
42
+ else if (absolutePath.endsWith('.css') && !absolutePath.includes('/_')) {
43
+ const content = parser(fs.readFileSync(absolutePath, 'utf-8'));
44
+ tresholds._default += content.allExtracted
45
+ .replaceAll('[breakpoint|min]', '[breakpoint]')
46
+ .replaceAll('[breakpoint|max]', '[breakpoint]')
47
+ .replaceAll('[breakpoint|all]', '[breakpoint]');
48
+ tresholds.static += content.defaultExtracted;
49
+ tresholds.min += content.minExtracted.replaceAll('[breakpoint|min]', '[breakpoint]');
50
+ tresholds.max += content.maxExtracted.replaceAll('[breakpoint|max]', '[breakpoint]');
51
+ tresholds.all += content.allModifierExtracted.replaceAll('[breakpoint|all]', '[breakpoint]');
52
+ return (styles += `${content.cleaned}\n`);
53
+ }
54
+ });
55
+ }
56
+ loadComponentCSS(path.resolve(__dirname, '../../components'));
57
+ for (const property in breakpoints) {
58
+ if (property !== '_default') {
59
+ const name = `.${/^\d/.test(property) ? `\\3${property}` : property}\\:`;
60
+ const value = typeof breakpoints[property] === 'number'
61
+ ? `${breakpoints[property]}px`
62
+ : breakpoints[property];
63
+ if (tresholds.static !== '' || tresholds.all !== '' || tresholds.min !== '') {
64
+ styles += `@media screen and (min-width: ${value}) {\n`;
65
+ if (tresholds.static !== '')
66
+ styles += tresholds.static.replaceAll('[breakpoint]', name);
67
+ if (tresholds.all !== '')
68
+ styles += tresholds.all.replaceAll('[breakpoint]', name);
69
+ if (tresholds.min !== '')
70
+ styles += tresholds.min.replaceAll('[breakpoint]', name);
71
+ styles += `}\n`;
72
+ }
73
+ if (tresholds.max !== '' || tresholds.all !== '') {
74
+ styles += `@media screen and (max-width: ${value}) {\n`;
75
+ if (tresholds.max !== '')
76
+ styles += tresholds.max.replaceAll('[breakpoint]', name);
77
+ if (tresholds.all !== '')
78
+ styles += tresholds.all.replaceAll('[breakpoint]', name);
79
+ styles += `}\n`;
80
+ }
81
+ }
82
+ else {
83
+ styles += tresholds._default.replaceAll('[breakpoint]', '.');
84
+ }
85
+ }
86
+ }
87
+ if (minified) {
88
+ styles = minify(styles);
89
+ sendConsole('success', 'css minified');
90
+ }
91
+ fsPromises.writeFile(path.resolve(__dirname, '../../styles.css'), styles);
92
+ };
93
+ const parser = (css) => {
94
+ const regex = /([^{]+)\{([^}]+)\}/g;
95
+ let match;
96
+ const matchesToRemove = [];
97
+ const extractedByType = {
98
+ allExtracted: [],
99
+ defaultExtracted: [],
100
+ minExtracted: [],
101
+ maxExtracted: [],
102
+ allModifierExtracted: []
103
+ };
104
+ while ((match = regex.exec(css)) !== null) {
105
+ const fullMatch = match[0];
106
+ const selectors = match[1].trim();
107
+ const body = match[2].trim();
108
+ const selectorsArray = selectors.split(',').map((sel) => sel.trim());
109
+ let matchedType = null;
110
+ if (selectorsArray.some((sel) => sel.includes('[breakpoint|min]'))) {
111
+ matchedType = 'minExtracted';
112
+ }
113
+ else if (selectorsArray.some((sel) => sel.includes('[breakpoint|max]'))) {
114
+ matchedType = 'maxExtracted';
115
+ }
116
+ else if (selectorsArray.some((sel) => sel.includes('[breakpoint|all]'))) {
117
+ matchedType = 'allModifierExtracted';
118
+ }
119
+ else if (selectorsArray.some((sel) => sel.includes('[breakpoint]'))) {
120
+ matchedType = 'defaultExtracted';
121
+ }
122
+ if (matchedType) {
123
+ const rule = `${selectors} {\n${body}\n}`;
124
+ extractedByType.allExtracted.push(rule);
125
+ extractedByType[matchedType].push(rule);
126
+ matchesToRemove.push(fullMatch);
127
+ }
128
+ }
129
+ let cleaned = css;
130
+ for (const rule of matchesToRemove) {
131
+ cleaned = cleaned.replace(rule, '').replace(/\n{2,}/g, '\n\n');
132
+ }
133
+ return {
134
+ allExtracted: extractedByType.allExtracted.join('\n\n').trim(),
135
+ defaultExtracted: extractedByType.defaultExtracted.join('\n\n').trim(),
136
+ minExtracted: extractedByType.minExtracted.join('\n\n').trim(),
137
+ maxExtracted: extractedByType.maxExtracted.join('\n\n').trim(),
138
+ allModifierExtracted: extractedByType.allModifierExtracted.join('\n\n').trim(),
139
+ cleaned: cleaned.trim()
140
+ };
141
+ };
@@ -0,0 +1 @@
1
+ export declare const importer: () => Promise<any>;
@@ -0,0 +1,13 @@
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+ import { ansi } from './ansi.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
+ console.error(ansi.color.cyan('lapikit'), ansi.bold.red('[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 content = await import(pathConfig);
12
+ return content.default;
13
+ };
@@ -0,0 +1 @@
1
+ export declare const minify: (css: string) => string;
@@ -0,0 +1,10 @@
1
+ export const minify = (css) => {
2
+ const minified = css
3
+ .replace(/\s+/g, ' ')
4
+ .replace(/\/\*.*?\*\//g, '')
5
+ .replace(/;\s*}/g, '}')
6
+ .replace(/:\s+/g, ':')
7
+ .replace(/\s*([{};:])\s*/g, '$1')
8
+ .trim();
9
+ return minified;
10
+ };
@@ -0,0 +1,4 @@
1
+ export declare const colors: () => {
2
+ root: string;
3
+ className: string;
4
+ };
@@ -0,0 +1,94 @@
1
+ import { parseColor } from './colors.js';
2
+ const colorsList = {
3
+ primary: { light: 'oklch(45% 0.24 277.023)', dark: 'oklch(45% 0.24 277.023)' },
4
+ secondary: { light: 'oklch(65% 0.241 354.308)', dark: 'oklch(65% 0.241 354.308)' },
5
+ tertiary: { light: 'oklch(77% 0.152 181.912)', dark: 'oklch(77% 0.152 181.912)' },
6
+ neutral: { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
7
+ info: { light: 'oklch(74% 0.16 232.661)', dark: 'oklch(74% 0.16 232.661)' },
8
+ success: { light: 'oklch(76% 0.177 163.223)', dark: 'oklch(76% 0.177 163.223)' },
9
+ warning: { light: 'oklch(82% 0.189 84.429)', dark: 'oklch(82% 0.189 84.429)' },
10
+ error: { light: 'oklch(71% 0.194 13.428)', dark: 'oklch(71% 0.194 13.428)' },
11
+ base: { light: 'oklch(100% 0 0)', dark: 'oklch(25.33% 0.016 252.42)' },
12
+ surface: { light: 'oklch(98% 0 0)', dark: 'oklch(23.26% 0.014 253.1)' },
13
+ container: { light: 'oklch(95% 0 0)', dark: 'oklch(21.15% 0.012 254.09)' },
14
+ shadow: 'black',
15
+ hexa: '#c1ec75',
16
+ rgb: 'rgb(238, 19, 121)',
17
+ rgba: 'rgba(19, 34, 238, 0.5)',
18
+ oklch: 'oklch(45% 0.24 277.023)'
19
+ };
20
+ export const colors = () => {
21
+ const schemes = {
22
+ light: {},
23
+ dark: {}
24
+ };
25
+ for (const [property, values] of Object.entries(colorsList)) {
26
+ if (typeof values === 'string') {
27
+ // for all color scheme
28
+ const _refColor = parseColor(values);
29
+ schemes['light'][property] = _refColor;
30
+ schemes['dark'][property] = _refColor;
31
+ }
32
+ else {
33
+ // with specification
34
+ if ('light' in values && 'dark' in values) {
35
+ schemes['light'][property] = parseColor(values.light);
36
+ schemes['dark'][property] = parseColor(values.dark);
37
+ }
38
+ else {
39
+ const _refColor = 'dark' in values ? parseColor(values['dark']) : parseColor(values['light']);
40
+ schemes['light'][property] = _refColor;
41
+ schemes['dark'][property] = _refColor;
42
+ }
43
+ }
44
+ }
45
+ const theming = 'mixed';
46
+ // css variables
47
+ let cssVariables = '';
48
+ if (theming === 'mixed') {
49
+ for (const [themeName, colors] of Object.entries(schemes)) {
50
+ const used = themeName;
51
+ const inversed = used === 'light' ? 'dark' : 'light';
52
+ cssVariables += `@media (prefers-color-scheme: ${used}) {\n`;
53
+ cssVariables += `:root, .${used} {\n`;
54
+ cssVariables += `color-scheme: ${used};\n`;
55
+ for (const [colorName, colorValue] of Object.entries(colors)) {
56
+ cssVariables += `--${colorName}: ${colorValue};\n`;
57
+ }
58
+ cssVariables += `}\n`;
59
+ cssVariables += `.${inversed} {\n`;
60
+ cssVariables += `color-scheme: ${used};\n`;
61
+ for (const [colorName, colorValue] of Object.entries(schemes[inversed])) {
62
+ cssVariables += `--${colorName}: ${colorValue};\n`;
63
+ }
64
+ cssVariables += `}\n`;
65
+ cssVariables += `}\n`;
66
+ }
67
+ }
68
+ else {
69
+ const used = theming;
70
+ const inversed = theming === 'light' ? 'dark' : 'light';
71
+ cssVariables += `:root, .${used} {\n`;
72
+ for (const [colorName, colorValue] of Object.entries(schemes[used])) {
73
+ cssVariables += `--${colorName}: ${colorValue};\n`;
74
+ }
75
+ cssVariables += `}\n`;
76
+ cssVariables += `.${inversed} {\n`;
77
+ for (const [colorName, colorValue] of Object.entries(schemes[inversed])) {
78
+ cssVariables += `--${colorName}: ${colorValue};\n`;
79
+ }
80
+ cssVariables += `}\n`;
81
+ }
82
+ // class
83
+ let classStyles = '';
84
+ for (const [property] of Object.entries(schemes.light)) {
85
+ classStyles += `.${property} {\n`;
86
+ classStyles += `--background-color: var(--${property});\n`;
87
+ classStyles += `--color: var(--${property});\n`;
88
+ classStyles += `}\n`;
89
+ }
90
+ return {
91
+ root: cssVariables,
92
+ className: classStyles
93
+ };
94
+ };
@@ -0,0 +1,4 @@
1
+ export declare const x11Colors: {
2
+ [key: string]: string;
3
+ };
4
+ export declare const x11ColorNames: string[];
@@ -0,0 +1,151 @@
1
+ export const x11Colors = {
2
+ aliceblue: '#F0F8FF',
3
+ antiquewhite: '#FAEBD7',
4
+ aqua: '#00FFFF',
5
+ aquamarine: '#7FFFD4',
6
+ azure: '#F0FFFF',
7
+ beige: '#F5F5DC',
8
+ bisque: '#FFE4C4',
9
+ black: '#000000',
10
+ blanchedalmond: '#FFEBCD',
11
+ blue: '#0000FF',
12
+ blueviolet: '#8A2BE2',
13
+ brown: '#A52A2A',
14
+ burlywood: '#DEB887',
15
+ cadetblue: '#5F9EA0',
16
+ chartreuse: '#7FFF00',
17
+ chocolate: '#D2691E',
18
+ coral: '#FF7F50',
19
+ cornflowerblue: '#6495ED',
20
+ cornsilk: '#FFF8DC',
21
+ crimson: '#DC143C',
22
+ cyan: '#00FFFF',
23
+ darkblue: '#00008B',
24
+ darkcyan: '#008B8B',
25
+ darkgoldenrod: '#B8860B',
26
+ darkgray: '#A9A9A9',
27
+ darkgrey: '#A9A9A9',
28
+ darkgreen: '#006400',
29
+ darkkhaki: '#BDB76B',
30
+ darkmagenta: '#8B008B',
31
+ darkolivegreen: '#556B2F',
32
+ darkorange: '#FF8C00',
33
+ darkorchid: '#9932CC',
34
+ darkred: '#8B0000',
35
+ darksalmon: '#E9967A',
36
+ darkseagreen: '#8FBC8F',
37
+ darkslateblue: '#483D8B',
38
+ darkslategray: '#2F4F4F',
39
+ darkslategrey: '#2F4F4F',
40
+ darkturquoise: '#00CED1',
41
+ darkviolet: '#9400D3',
42
+ deeppink: '#FF1493',
43
+ deepskyblue: '#00BFFF',
44
+ dimgray: '#696969',
45
+ dimgrey: '#696969',
46
+ dodgerblue: '#1E90FF',
47
+ firebrick: '#B22222',
48
+ floralwhite: '#FFFAF0',
49
+ forestgreen: '#228B22',
50
+ fuchsia: '#FF00FF',
51
+ gainsboro: '#DCDCDC',
52
+ ghostwhite: '#F8F8FF',
53
+ gold: '#FFD700',
54
+ goldenrod: '#DAA520',
55
+ gray: '#808080',
56
+ grey: '#808080',
57
+ green: '#008000',
58
+ greenyellow: '#ADFF2F',
59
+ honeydew: '#F0FFF0',
60
+ hotpink: '#FF69B4',
61
+ indianred: '#CD5C5C',
62
+ indigo: '#4B0082',
63
+ ivory: '#FFFFF0',
64
+ khaki: '#F0E68C',
65
+ lavender: '#E6E6FA',
66
+ lavenderblush: '#FFF0F5',
67
+ lawngreen: '#7CFC00',
68
+ lemonchiffon: '#FFFACD',
69
+ lightblue: '#ADD8E6',
70
+ lightcoral: '#F08080',
71
+ lightcyan: '#E0FFFF',
72
+ lightgoldenrodyellow: '#FAFAD2',
73
+ lightgray: '#D3D3D3',
74
+ lightgrey: '#D3D3D3',
75
+ lightgreen: '#90EE90',
76
+ lightpink: '#FFB6C1',
77
+ lightsalmon: '#FFA07A',
78
+ lightseagreen: '#20B2AA',
79
+ lightskyblue: '#87CEFA',
80
+ lightslategray: '#778899',
81
+ lightslategrey: '#778899',
82
+ lightsteelblue: '#B0C4DE',
83
+ lightyellow: '#FFFFE0',
84
+ lime: '#00FF00',
85
+ limegreen: '#32CD32',
86
+ linen: '#FAF0E6',
87
+ magenta: '#FF00FF',
88
+ maroon: '#800000',
89
+ mediumaquamarine: '#66CDAA',
90
+ mediumblue: '#0000CD',
91
+ mediumorchid: '#BA55D3',
92
+ mediumpurple: '#9370DB',
93
+ mediumseagreen: '#3CB371',
94
+ mediumslateblue: '#7B68EE',
95
+ mediumspringgreen: '#00FA9A',
96
+ mediumturquoise: '#48D1CC',
97
+ mediumvioletred: '#C71585',
98
+ midnightblue: '#191970',
99
+ mintcream: '#F5FFFA',
100
+ mistyrose: '#FFE4E1',
101
+ moccasin: '#FFE4B5',
102
+ navajowhite: '#FFDEAD',
103
+ navy: '#000080',
104
+ oldlace: '#FDF5E6',
105
+ olive: '#808000',
106
+ olivedrab: '#6B8E23',
107
+ orange: '#FFA500',
108
+ orangered: '#FF4500',
109
+ orchid: '#DA70D6',
110
+ palegoldenrod: '#EEE8AA',
111
+ palegreen: '#98FB98',
112
+ paleturquoise: '#AFEEEE',
113
+ palevioletred: '#DB7093',
114
+ papayawhip: '#FFEFD5',
115
+ peachpuff: '#FFDAB9',
116
+ peru: '#CD853F',
117
+ pink: '#FFC0CB',
118
+ plum: '#DDA0DD',
119
+ powderblue: '#B0E0E6',
120
+ purple: '#800080',
121
+ rebeccapurple: '#663399',
122
+ red: '#FF0000',
123
+ rosybrown: '#BC8F8F',
124
+ royalblue: '#4169E1',
125
+ saddlebrown: '#8B4513',
126
+ salmon: '#FA8072',
127
+ sandybrown: '#F4A460',
128
+ seagreen: '#2E8B57',
129
+ seashell: '#FFF5EE',
130
+ sienna: '#A0522D',
131
+ silver: '#C0C0C0',
132
+ skyblue: '#87CEEB',
133
+ slateblue: '#6A5ACD',
134
+ slategray: '#708090',
135
+ slategrey: '#708090',
136
+ snow: '#FFFAFA',
137
+ springgreen: '#00FF7F',
138
+ steelblue: '#4682B4',
139
+ tan: '#D2B48C',
140
+ teal: '#008080',
141
+ thistle: '#D8BFD8',
142
+ tomato: '#FF6347',
143
+ turquoise: '#40E0D0',
144
+ violet: '#EE82EE',
145
+ wheat: '#F5DEB3',
146
+ white: '#FFFFFF',
147
+ whitesmoke: '#F5F5F5',
148
+ yellow: '#FFFF00',
149
+ yellowgreen: '#9ACD32'
150
+ };
151
+ export const x11ColorNames = Object.keys(x11Colors);
@@ -0,0 +1,11 @@
1
+ import type { ViteDevServer } from 'vite';
2
+ interface LapikitPlugin {
3
+ normalize?: boolean;
4
+ minify?: boolean;
5
+ }
6
+ export declare function lapikit(options?: LapikitPlugin): Promise<{
7
+ name: string;
8
+ configResolved(): Promise<void>;
9
+ configureServer(server: ViteDevServer): Promise<void>;
10
+ }>;
11
+ export {};
@@ -0,0 +1,17 @@
1
+ import { ansi } from './modules/ansi.js';
2
+ import { importer } from './modules/importer.js';
3
+ import { processCSS } from './modules/css.js';
4
+ export async function lapikit(options = {}) {
5
+ return {
6
+ name: 'lapikit/vite.js',
7
+ async configResolved() {
8
+ console.log(ansi.bold.blue('Vite plugin loaded'), options);
9
+ const config = await importer();
10
+ await processCSS(options.minify, options.normalize);
11
+ // console.log('config', config);
12
+ },
13
+ async configureServer(server) {
14
+ // console.log(ansi.inverse.red('Vite server configured'), server);
15
+ }
16
+ };
17
+ }
@@ -0,0 +1,123 @@
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(--font-sans, var(--kit-font-family-sans));
7
+ }
8
+
9
+ pre,
10
+ code {
11
+ font-family: var(--font-mono, var(--kit-font-family-mono));
12
+ }
13
+
14
+ body {
15
+ margin: 0;
16
+ }
17
+
18
+ main {
19
+ display: block;
20
+ }
21
+
22
+ button,
23
+ input,
24
+ optgroup,
25
+ select,
26
+ textarea {
27
+ font: inherit;
28
+ }
29
+
30
+ button {
31
+ overflow: visible;
32
+ }
33
+
34
+ button,
35
+ [type='button'],
36
+ [type='reset'],
37
+ [type='submit'],
38
+ [role='button'] {
39
+ cursor: pointer;
40
+ color: inherit;
41
+ }
42
+
43
+ *:not(body) {
44
+ outline: none;
45
+ }
46
+
47
+ *,
48
+ ::after,
49
+ ::before,
50
+ ::backdrop {
51
+ box-sizing: border-box;
52
+ margin: 0;
53
+ padding: 0;
54
+ border: 0 solid;
55
+ }
56
+
57
+ *,
58
+ ::before,
59
+ ::after {
60
+ background-repeat: no-repeat;
61
+ box-sizing: inherit;
62
+ }
63
+
64
+ ::before,
65
+ ::after {
66
+ text-decoration: inherit;
67
+ vertical-align: inherit;
68
+ }
69
+
70
+ [type='search'] {
71
+ -webkit-appearance: textfield;
72
+ appearance: textfield;
73
+ outline-offset: -2px;
74
+ }
75
+
76
+ ol,
77
+ ul,
78
+ menu {
79
+ list-style: initial;
80
+ margin-left: calc(var(--kit-spacing) * 5);
81
+ }
82
+
83
+ ol ul,
84
+ ol ol,
85
+ ul ul,
86
+ ul ol {
87
+ padding-left: 1rem;
88
+ }
89
+
90
+ code {
91
+ border-radius: 0.25rem;
92
+ padding-block: 0.125rem;
93
+ padding-inline: 0.375rem;
94
+ position: relative;
95
+ }
96
+
97
+ sub,
98
+ sup {
99
+ font-size: 75%;
100
+ line-height: 0;
101
+ position: relative;
102
+ vertical-align: baseline;
103
+ }
104
+
105
+ sup {
106
+ top: -0.5em;
107
+ }
108
+
109
+ sub {
110
+ bottom: -0.25em;
111
+ }
112
+
113
+ img {
114
+ border-style: none;
115
+ }
116
+
117
+ button,
118
+ input,
119
+ select,
120
+ textarea {
121
+ background-color: transparent;
122
+ border-style: none;
123
+ }
@@ -0,0 +1,7 @@
1
+ :root {
2
+ --kit-font-family-sans:
3
+ system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
4
+ sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
5
+ --kit-font-family-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
6
+ --kit-spacing: 0.25rem;
7
+ }
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lapikit",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -32,7 +32,11 @@
32
32
  ".": {
33
33
  "types": "./dist/index.d.ts",
34
34
  "svelte": "./dist/index.js"
35
- }
35
+ },
36
+ "./vite": {
37
+ "default": "./dist/server/vite.js"
38
+ },
39
+ "./css": "./dist/styles.css"
36
40
  },
37
41
  "peerDependencies": {
38
42
  "svelte": "^5.0.0"