lapikit 0.0.0-insiders.83afa82 → 0.0.0-insiders.fd1a829

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.
@@ -38,3 +38,4 @@ export declare const ansi: {
38
38
  };
39
39
  };
40
40
  export type Ansi = typeof ansi;
41
+ export declare const sendConsole: (type: "info" | "error" | "warn" | "success" | undefined, msg: string) => void;
@@ -42,3 +42,14 @@ export const ansi = {
42
42
  inverse,
43
43
  underline
44
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,144 @@
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
+ import { devices } from './devices.js';
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
12
+ const __components = path.resolve('src/components');
13
+ // temps
14
+ const breakpoints = {
15
+ _default: 0,
16
+ desktop: 1024,
17
+ tablet: '768vw',
18
+ mobile: 480
19
+ };
20
+ export const processCSS = async (minified, normalize) => {
21
+ console.log(ansi.bold.blue('Processing CSS...'));
22
+ const _normalize = fs.readFileSync(path.resolve(__dirname, '../../styles/normalize.css'), 'utf-8');
23
+ const _variables = fs.readFileSync(path.resolve(__dirname, '../../styles/variables.css'), 'utf-8');
24
+ let styles = `${_variables}\n`;
25
+ if (normalize)
26
+ styles += `${_normalize}\n`;
27
+ const colorScheme = colors();
28
+ const deviceDisplay = devices();
29
+ styles += `${colorScheme.root}\n`;
30
+ styles += `${colorScheme.className}\n`;
31
+ styles += `${deviceDisplay}\n`;
32
+ if (fs.existsSync(__components) && fs.statSync(__components).isDirectory()) {
33
+ const tresholds = {
34
+ _default: '',
35
+ static: '',
36
+ min: '',
37
+ max: '',
38
+ all: ''
39
+ };
40
+ function loadComponentCSS(directory) {
41
+ fs.readdirSync(directory).forEach((File) => {
42
+ const absolutePath = path.join(directory, File);
43
+ if (fs.statSync(absolutePath).isDirectory())
44
+ return loadComponentCSS(absolutePath);
45
+ else if (absolutePath.endsWith('.css') && !absolutePath.includes('/_')) {
46
+ const content = parser(fs.readFileSync(absolutePath, 'utf-8'));
47
+ tresholds._default += content.allExtracted
48
+ .replaceAll('[breakpoint|min]', '[breakpoint]')
49
+ .replaceAll('[breakpoint|max]', '[breakpoint]')
50
+ .replaceAll('[breakpoint|all]', '[breakpoint]');
51
+ tresholds.static += content.defaultExtracted;
52
+ tresholds.min += content.minExtracted.replaceAll('[breakpoint|min]', '[breakpoint]');
53
+ tresholds.max += content.maxExtracted.replaceAll('[breakpoint|max]', '[breakpoint]');
54
+ tresholds.all += content.allModifierExtracted.replaceAll('[breakpoint|all]', '[breakpoint]');
55
+ return (styles += `${content.cleaned}\n`);
56
+ }
57
+ });
58
+ }
59
+ loadComponentCSS(path.resolve(__dirname, '../../components'));
60
+ for (const property in breakpoints) {
61
+ if (property !== '_default') {
62
+ const name = `.${/^\d/.test(property) ? `\\3${property}` : property}\\:`;
63
+ const value = typeof breakpoints[property] === 'number'
64
+ ? `${breakpoints[property]}px`
65
+ : breakpoints[property];
66
+ if (tresholds.static !== '' || tresholds.all !== '' || tresholds.min !== '') {
67
+ styles += `@media screen and (min-width: ${value}) {\n`;
68
+ if (tresholds.static !== '')
69
+ styles += tresholds.static.replaceAll('[breakpoint]', name);
70
+ if (tresholds.all !== '')
71
+ styles += tresholds.all.replaceAll('[breakpoint]', name);
72
+ if (tresholds.min !== '')
73
+ styles += tresholds.min.replaceAll('[breakpoint]', name);
74
+ styles += `}\n`;
75
+ }
76
+ if (tresholds.max !== '' || tresholds.all !== '') {
77
+ styles += `@media screen and (max-width: ${value}) {\n`;
78
+ if (tresholds.max !== '')
79
+ styles += tresholds.max.replaceAll('[breakpoint]', name);
80
+ if (tresholds.all !== '')
81
+ styles += tresholds.all.replaceAll('[breakpoint]', name);
82
+ styles += `}\n`;
83
+ }
84
+ }
85
+ else {
86
+ styles += tresholds._default.replaceAll('[breakpoint]', '.');
87
+ }
88
+ }
89
+ }
90
+ if (minified) {
91
+ styles = minify(styles);
92
+ sendConsole('success', 'css minified');
93
+ }
94
+ fsPromises.writeFile(path.resolve(__dirname, '../../styles.css'), styles);
95
+ };
96
+ const parser = (css) => {
97
+ const regex = /([^{]+)\{([^}]+)\}/g;
98
+ let match;
99
+ const matchesToRemove = [];
100
+ const extractedByType = {
101
+ allExtracted: [],
102
+ defaultExtracted: [],
103
+ minExtracted: [],
104
+ maxExtracted: [],
105
+ allModifierExtracted: []
106
+ };
107
+ while ((match = regex.exec(css)) !== null) {
108
+ const fullMatch = match[0];
109
+ const selectors = match[1].trim();
110
+ const body = match[2].trim();
111
+ const selectorsArray = selectors.split(',').map((sel) => sel.trim());
112
+ let matchedType = null;
113
+ if (selectorsArray.some((sel) => sel.includes('[breakpoint|min]'))) {
114
+ matchedType = 'minExtracted';
115
+ }
116
+ else if (selectorsArray.some((sel) => sel.includes('[breakpoint|max]'))) {
117
+ matchedType = 'maxExtracted';
118
+ }
119
+ else if (selectorsArray.some((sel) => sel.includes('[breakpoint|all]'))) {
120
+ matchedType = 'allModifierExtracted';
121
+ }
122
+ else if (selectorsArray.some((sel) => sel.includes('[breakpoint]'))) {
123
+ matchedType = 'defaultExtracted';
124
+ }
125
+ if (matchedType) {
126
+ const rule = `${selectors} {\n${body}\n}`;
127
+ extractedByType.allExtracted.push(rule);
128
+ extractedByType[matchedType].push(rule);
129
+ matchesToRemove.push(fullMatch);
130
+ }
131
+ }
132
+ let cleaned = css;
133
+ for (const rule of matchesToRemove) {
134
+ cleaned = cleaned.replace(rule, '').replace(/\n{2,}/g, '\n\n');
135
+ }
136
+ return {
137
+ allExtracted: extractedByType.allExtracted.join('\n\n').trim(),
138
+ defaultExtracted: extractedByType.defaultExtracted.join('\n\n').trim(),
139
+ minExtracted: extractedByType.minExtracted.join('\n\n').trim(),
140
+ maxExtracted: extractedByType.maxExtracted.join('\n\n').trim(),
141
+ allModifierExtracted: extractedByType.allModifierExtracted.join('\n\n').trim(),
142
+ cleaned: cleaned.trim()
143
+ };
144
+ };
@@ -0,0 +1 @@
1
+ export declare const devices: () => string;
@@ -0,0 +1,43 @@
1
+ const breakpoints = {
2
+ mobileBreakpoint: 'sm',
3
+ tabletBreakpoint: 'md',
4
+ laptopBreakpoint: 'xl',
5
+ thresholds: {
6
+ none: 0, // 0px
7
+ xs: '28rem', //448px
8
+ sm: '40rem', //640px
9
+ md: '48rem', //768px
10
+ lg: '64rem', //1024px
11
+ xl: '80rem', //1280px
12
+ '2xl': '96rem', //1536px
13
+ '3xl': '112rem' //1792px
14
+ }
15
+ };
16
+ export const devices = () => {
17
+ let css = ``;
18
+ const list = {
19
+ mobile: breakpoints.mobileBreakpoint,
20
+ tablet: breakpoints.tabletBreakpoint,
21
+ laptop: breakpoints.laptopBreakpoint
22
+ };
23
+ for (const [key, value] of Object.entries(list)) {
24
+ const breakpointValue = breakpoints.thresholds[value];
25
+ const breakpointValueMax = key !== 'laptop'
26
+ ? breakpoints.thresholds[key === 'mobile' ? list.tablet : key == 'tablet' ? list.laptop : '']
27
+ : undefined;
28
+ css += `.device-${key}, .only-on-${key} {\n`;
29
+ css += `display: none;\n`;
30
+ css += `}\n`;
31
+ css += `@media screen and (min-width: ${typeof breakpointValue === 'number' ? breakpointValue + 'px' : breakpointValue}) {\n`;
32
+ css += `.device-${key} {\n`;
33
+ css += `display: inherit !important;\n`;
34
+ css += `}\n`;
35
+ css += `}\n`;
36
+ css += `@media screen and (min-width: ${typeof breakpointValue === 'number' ? breakpointValue + 'px' : breakpointValue}) ${breakpointValueMax ? ('and (max-width:' + typeof breakpointValue === 'number' ? breakpointValue + 'px' : breakpointValue + ')') : ''} {\n`;
37
+ css += `.only-on-${key} {\n`;
38
+ css += `display: inherit !important;\n`;
39
+ css += `}\n`;
40
+ css += `}\n`;
41
+ }
42
+ return css;
43
+ };
@@ -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);
@@ -1,6 +1,6 @@
1
1
  import type { ViteDevServer } from 'vite';
2
2
  interface LapikitPlugin {
3
- extends?: 'tailwindcss';
3
+ normalize?: boolean;
4
4
  minify?: boolean;
5
5
  }
6
6
  export declare function lapikit(options?: LapikitPlugin): Promise<{
@@ -1,11 +1,13 @@
1
1
  import { ansi } from './modules/ansi.js';
2
2
  import { importer } from './modules/importer.js';
3
+ import { processCSS } from './modules/css.js';
3
4
  export async function lapikit(options = {}) {
4
5
  return {
5
6
  name: 'lapikit/vite.js',
6
7
  async configResolved() {
7
8
  console.log(ansi.bold.blue('Vite plugin loaded'), options);
8
9
  const config = await importer();
10
+ await processCSS(options.minify, options.normalize);
9
11
  console.log('config', config);
10
12
  },
11
13
  async configureServer(server) {
@@ -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
+ }
package/dist/styles.css CHANGED
@@ -1,80 +0,0 @@
1
- html {
2
- -webkit-text-size-adjust: 100%;
3
- tab-size: 4;
4
- line-height: 1.5;
5
- box-sizing: border-box;
6
- }
7
-
8
- body {
9
- margin: 0;
10
- }
11
-
12
- main {
13
- display: block;
14
- }
15
-
16
- button,
17
- input,
18
- optgroup,
19
- select,
20
- textarea {
21
- font: inherit;
22
- }
23
-
24
- button {
25
- overflow: visible;
26
- }
27
-
28
- button,
29
- [type='button'],
30
- [type='reset'],
31
- [type='submit'],
32
- [role='button'] {
33
- cursor: pointer;
34
- color: inherit;
35
- }
36
-
37
- button,
38
- input,
39
- select,
40
- textarea {
41
- background-color: transparent;
42
- border-style: none;
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
- img {
60
- border-style: none;
61
- }
62
-
63
- *,
64
- ::before,
65
- ::after {
66
- background-repeat: no-repeat;
67
- box-sizing: inherit;
68
- }
69
-
70
- ::before,
71
- ::after {
72
- text-decoration: inherit;
73
- vertical-align: inherit;
74
- }
75
-
76
- [type='search'] {
77
- -webkit-appearance: textfield;
78
- appearance: textfield;
79
- outline-offset: -2px;
80
- }
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "name": "lapikit",
3
- "version": "0.0.0-insiders.83afa82",
3
+ "version": "0.0.0-insiders.fd1a829",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Nycolaide/lapikit",
10
+ "directory": "packages/lapikit"
11
+ },
4
12
  "scripts": {
5
13
  "dev": "vite dev",
6
14
  "build": "vite build && npm run prepack",
@@ -14,9 +22,6 @@
14
22
  "test:unit": "vitest",
15
23
  "test": "npm run test:unit -- --run"
16
24
  },
17
- "publishConfig": {
18
- "access": "public"
19
- },
20
25
  "files": [
21
26
  "dist",
22
27
  "!dist/**/*.test.*",