lapikit 0.0.0-insiders.116f092

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 (174) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/bin/helper.js +74 -0
  4. package/bin/lapikit.js +54 -0
  5. package/bin/modules/adapter.js +52 -0
  6. package/bin/modules/preset.js +11 -0
  7. package/dist/actions/index.d.ts +1 -0
  8. package/dist/actions/index.js +1 -0
  9. package/dist/app.d.ts +13 -0
  10. package/dist/app.html +12 -0
  11. package/dist/assets/icons/arrow-down.svelte +10 -0
  12. package/dist/assets/icons/arrow-down.svelte.d.ts +26 -0
  13. package/dist/assets/icons/arrow-up.svelte +10 -0
  14. package/dist/assets/icons/arrow-up.svelte.d.ts +26 -0
  15. package/dist/assets/icons/close-fill.svelte +10 -0
  16. package/dist/assets/icons/close-fill.svelte.d.ts +26 -0
  17. package/dist/assets/icons/loading-fill.svelte +29 -0
  18. package/dist/assets/icons/loading-fill.svelte.d.ts +26 -0
  19. package/dist/components/accordion/accordion.css +113 -0
  20. package/dist/components/accordion/accordion.svelte +37 -0
  21. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  22. package/dist/components/accordion/accordion.svelte.js +24 -0
  23. package/dist/components/accordion/modules/accordion-item.svelte +94 -0
  24. package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
  25. package/dist/components/accordion/types.d.ts +33 -0
  26. package/dist/components/accordion/types.js +1 -0
  27. package/dist/components/alert/alert.css +127 -0
  28. package/dist/components/alert/alert.svelte +89 -0
  29. package/dist/components/alert/alert.svelte.d.ts +4 -0
  30. package/dist/components/alert/types.d.ts +28 -0
  31. package/dist/components/alert/types.js +1 -0
  32. package/dist/components/app/app.css +16 -0
  33. package/dist/components/app/app.svelte +25 -0
  34. package/dist/components/app/app.svelte.d.ts +7 -0
  35. package/dist/components/app/types.d.ts +4 -0
  36. package/dist/components/app/types.js +1 -0
  37. package/dist/components/appbar/appbar.css +49 -0
  38. package/dist/components/appbar/appbar.svelte +41 -0
  39. package/dist/components/appbar/appbar.svelte.d.ts +4 -0
  40. package/dist/components/appbar/types.d.ts +15 -0
  41. package/dist/components/appbar/types.js +1 -0
  42. package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
  43. package/dist/components/aspect-ratio/aspect-ratio.svelte +48 -0
  44. package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
  45. package/dist/components/aspect-ratio/types.d.ts +5 -0
  46. package/dist/components/aspect-ratio/types.js +1 -0
  47. package/dist/components/avatar/avatar.css +109 -0
  48. package/dist/components/avatar/avatar.svelte +46 -0
  49. package/dist/components/avatar/avatar.svelte.d.ts +4 -0
  50. package/dist/components/avatar/types.d.ts +22 -0
  51. package/dist/components/avatar/types.js +1 -0
  52. package/dist/components/button/button.css +276 -0
  53. package/dist/components/button/button.svelte +94 -0
  54. package/dist/components/button/button.svelte.d.ts +4 -0
  55. package/dist/components/button/types.d.ts +27 -0
  56. package/dist/components/button/types.js +1 -0
  57. package/dist/components/card/card.css +109 -0
  58. package/dist/components/card/card.svelte +50 -0
  59. package/dist/components/card/card.svelte.d.ts +4 -0
  60. package/dist/components/card/types.d.ts +18 -0
  61. package/dist/components/card/types.js +1 -0
  62. package/dist/components/chip/chip.css +199 -0
  63. package/dist/components/chip/chip.svelte +118 -0
  64. package/dist/components/chip/chip.svelte.d.ts +4 -0
  65. package/dist/components/chip/types.d.ts +30 -0
  66. package/dist/components/chip/types.js +1 -0
  67. package/dist/components/dialog/dialog.css +134 -0
  68. package/dist/components/dialog/dialog.svelte +67 -0
  69. package/dist/components/dialog/dialog.svelte.d.ts +4 -0
  70. package/dist/components/dialog/types.d.ts +24 -0
  71. package/dist/components/dialog/types.js +1 -0
  72. package/dist/components/dropdown/dropdown.css +22 -0
  73. package/dist/components/dropdown/dropdown.svelte +116 -0
  74. package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
  75. package/dist/components/dropdown/dropdown.svelte.js +148 -0
  76. package/dist/components/dropdown/types.d.ts +26 -0
  77. package/dist/components/dropdown/types.js +1 -0
  78. package/dist/components/icon/icon.css +76 -0
  79. package/dist/components/icon/icon.svelte +49 -0
  80. package/dist/components/icon/icon.svelte.d.ts +4 -0
  81. package/dist/components/icon/types.d.ts +16 -0
  82. package/dist/components/icon/types.js +1 -0
  83. package/dist/components/index.d.ts +21 -0
  84. package/dist/components/index.js +22 -0
  85. package/dist/components/list/list.css +195 -0
  86. package/dist/components/list/list.svelte +46 -0
  87. package/dist/components/list/list.svelte.d.ts +4 -0
  88. package/dist/components/list/modules/list-item.svelte +68 -0
  89. package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
  90. package/dist/components/list/types.d.ts +36 -0
  91. package/dist/components/list/types.js +1 -0
  92. package/dist/components/modal/modal.css +140 -0
  93. package/dist/components/modal/modal.svelte +112 -0
  94. package/dist/components/modal/modal.svelte.d.ts +4 -0
  95. package/dist/components/modal/types.d.ts +26 -0
  96. package/dist/components/modal/types.js +1 -0
  97. package/dist/components/popover/popover.css +22 -0
  98. package/dist/components/popover/popover.svelte +73 -0
  99. package/dist/components/popover/popover.svelte.d.ts +4 -0
  100. package/dist/components/popover/popover.svelte.js +134 -0
  101. package/dist/components/popover/types.d.ts +20 -0
  102. package/dist/components/popover/types.js +1 -0
  103. package/dist/components/separator/separator.css +46 -0
  104. package/dist/components/separator/separator.svelte +37 -0
  105. package/dist/components/separator/separator.svelte.d.ts +4 -0
  106. package/dist/components/separator/types.d.ts +11 -0
  107. package/dist/components/separator/types.js +1 -0
  108. package/dist/components/spacer/spacer.css +3 -0
  109. package/dist/components/spacer/spacer.svelte +7 -0
  110. package/dist/components/spacer/spacer.svelte.d.ts +4 -0
  111. package/dist/components/spacer/types.d.ts +4 -0
  112. package/dist/components/spacer/types.js +1 -0
  113. package/dist/components/toolbar/toolbar.css +129 -0
  114. package/dist/components/toolbar/toolbar.svelte +47 -0
  115. package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
  116. package/dist/components/toolbar/types.d.ts +27 -0
  117. package/dist/components/toolbar/types.js +1 -0
  118. package/dist/components/tooltip/tooltip.css +124 -0
  119. package/dist/components/tooltip/tooltip.svelte +113 -0
  120. package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
  121. package/dist/components/tooltip/tooltip.svelte.js +131 -0
  122. package/dist/components/tooltip/types.d.ts +23 -0
  123. package/dist/components/tooltip/types.js +1 -0
  124. package/dist/index.d.ts +1 -0
  125. package/dist/index.js +4 -0
  126. package/dist/internal/ansi.d.ts +40 -0
  127. package/dist/internal/ansi.js +44 -0
  128. package/dist/internal/assets.svelte.d.ts +8 -0
  129. package/dist/internal/assets.svelte.js +52 -0
  130. package/dist/internal/clickOutside.d.ts +9 -0
  131. package/dist/internal/clickOutside.js +34 -0
  132. package/dist/internal/colors.d.ts +1 -0
  133. package/dist/internal/colors.js +50 -0
  134. package/dist/internal/index.d.ts +4 -0
  135. package/dist/internal/index.js +4 -0
  136. package/dist/internal/minify.d.ts +1 -0
  137. package/dist/internal/minify.js +10 -0
  138. package/dist/internal/scroll.d.ts +1 -0
  139. package/dist/internal/scroll.js +6 -0
  140. package/dist/internal/terminal.d.ts +1 -0
  141. package/dist/internal/terminal.js +12 -0
  142. package/dist/internal/types.d.ts +57 -0
  143. package/dist/internal/types.js +1 -0
  144. package/dist/internal/unit.d.ts +1 -0
  145. package/dist/internal/unit.js +11 -0
  146. package/dist/plugin/modules/config.d.ts +2 -0
  147. package/dist/plugin/modules/config.js +54 -0
  148. package/dist/plugin/modules/importer.d.ts +1 -0
  149. package/dist/plugin/modules/importer.js +15 -0
  150. package/dist/plugin/vitejs.d.ts +6 -0
  151. package/dist/plugin/vitejs.js +26 -0
  152. package/dist/preset.d.ts +2 -0
  153. package/dist/preset.js +92 -0
  154. package/dist/stores/index.d.ts +9 -0
  155. package/dist/stores/index.js +42 -0
  156. package/dist/style/animation.css +20 -0
  157. package/dist/style/css.d.ts +2 -0
  158. package/dist/style/css.js +34 -0
  159. package/dist/style/normalize.css +123 -0
  160. package/dist/style/parser/color.d.ts +5 -0
  161. package/dist/style/parser/color.js +88 -0
  162. package/dist/style/parser/component.d.ts +2 -0
  163. package/dist/style/parser/component.js +115 -0
  164. package/dist/style/parser/device.d.ts +2 -0
  165. package/dist/style/parser/device.js +40 -0
  166. package/dist/style/parser/index.d.ts +4 -0
  167. package/dist/style/parser/index.js +4 -0
  168. package/dist/style/parser/variable.d.ts +2 -0
  169. package/dist/style/parser/variable.js +25 -0
  170. package/dist/style/variable.css +12 -0
  171. package/dist/styles.css +0 -0
  172. package/dist/utils/x11.d.ts +4 -0
  173. package/dist/utils/x11.js +151 -0
  174. package/package.json +93 -0
@@ -0,0 +1,131 @@
1
+ import { innerWidth, innerHeight } from 'svelte/reactivity/window';
2
+ export function getPositionsTooltip() {
3
+ // state
4
+ const axis = $state({
5
+ x: 0,
6
+ y: 0,
7
+ location: null
8
+ });
9
+ return {
10
+ get values() {
11
+ return axis;
12
+ },
13
+ update(activator, element, location, centered, avoidCollisions) {
14
+ if (!activator || !element)
15
+ return;
16
+ const elementRect = element.getBoundingClientRect();
17
+ const activatorRect = activator.getBoundingClientRect();
18
+ const spacing = 6;
19
+ if (location === 'top' || location === 'bottom') {
20
+ if (avoidCollisions) {
21
+ if (location === 'top') {
22
+ if (activatorRect.y - (elementRect.height + spacing) < 0) {
23
+ axis.y = activatorRect.bottom + spacing;
24
+ axis.location = 'bottom';
25
+ }
26
+ else {
27
+ axis.y = activatorRect.top - (elementRect.height + spacing);
28
+ axis.location = 'top';
29
+ }
30
+ }
31
+ else {
32
+ if (activatorRect.y + activatorRect.height + (elementRect.height + spacing) >
33
+ innerHeight.current) {
34
+ axis.y = activatorRect.top - (elementRect.height + spacing);
35
+ axis.location = 'top';
36
+ }
37
+ else {
38
+ axis.y = activatorRect.bottom + spacing;
39
+ axis.location = 'bottom';
40
+ }
41
+ }
42
+ }
43
+ else {
44
+ if (location === 'top') {
45
+ axis.y = activatorRect.top - (elementRect.height + spacing);
46
+ axis.location = 'top';
47
+ }
48
+ else {
49
+ axis.y = activatorRect.bottom + spacing;
50
+ axis.location = 'bottom';
51
+ }
52
+ }
53
+ if (centered &&
54
+ activatorRect.left - (elementRect.width - activatorRect.width) / 2 > 0 &&
55
+ activatorRect.left + elementRect.width < innerWidth.current) {
56
+ axis.x = activatorRect.left - (elementRect.width - activatorRect.width) / 2;
57
+ }
58
+ else if (activatorRect.left + elementRect.width > innerWidth.current) {
59
+ axis.x = activatorRect.left - (elementRect.width - activatorRect.width);
60
+ }
61
+ else {
62
+ axis.x = activatorRect.left;
63
+ }
64
+ }
65
+ else if (location === 'left' || location === 'right') {
66
+ if (avoidCollisions) {
67
+ if (location === 'left' && !(activatorRect.left - elementRect.width < 0)) {
68
+ axis.x = activatorRect.left - (elementRect.width + spacing);
69
+ axis.location = 'left';
70
+ }
71
+ else {
72
+ if (activatorRect.left + activatorRect.width + elementRect.width + spacing >
73
+ innerWidth.current) {
74
+ axis.x = activatorRect.left - (elementRect.width + spacing);
75
+ axis.location = 'left';
76
+ }
77
+ else {
78
+ axis.x = activatorRect.left + activatorRect.width + spacing;
79
+ axis.location = 'right';
80
+ }
81
+ }
82
+ }
83
+ else {
84
+ if (location === 'left') {
85
+ axis.x = activatorRect.left - (elementRect.width + spacing);
86
+ axis.location = 'left';
87
+ }
88
+ else {
89
+ axis.x = activatorRect.left + activatorRect.width + spacing;
90
+ axis.location = 'right';
91
+ }
92
+ }
93
+ if (centered &&
94
+ activatorRect.top - (elementRect.height - activatorRect.height) / 2 > 0 &&
95
+ activatorRect.top + elementRect.height < innerHeight.current) {
96
+ axis.y = activatorRect.top - (elementRect.height - activatorRect.height) / 2;
97
+ }
98
+ else if (activatorRect.y + elementRect.height > innerHeight.current) {
99
+ axis.y = activatorRect.y - elementRect.height + activatorRect.height;
100
+ }
101
+ else {
102
+ axis.y = activatorRect.y;
103
+ }
104
+ }
105
+ else {
106
+ if (centered &&
107
+ activatorRect.left - (elementRect.width - activatorRect.width) / 2 > 0 &&
108
+ activatorRect.left + elementRect.width < innerWidth.current) {
109
+ axis.x = activatorRect.left - (elementRect.width - activatorRect.width) / 2;
110
+ }
111
+ else if (activatorRect.left + elementRect.width > innerWidth.current) {
112
+ axis.x = activatorRect.left - (elementRect.width - activatorRect.width);
113
+ }
114
+ else {
115
+ axis.x = activatorRect.left;
116
+ }
117
+ if (centered &&
118
+ activatorRect.top - (elementRect.height - activatorRect.height) / 2 > 0 &&
119
+ activatorRect.top + elementRect.height < innerHeight.current) {
120
+ axis.y = activatorRect.top - (elementRect.height - activatorRect.height) / 2;
121
+ }
122
+ else if (activatorRect.bottom + elementRect.height > innerHeight.current) {
123
+ axis.y = activatorRect.top - elementRect.height;
124
+ }
125
+ else {
126
+ axis.y = activatorRect.bottom;
127
+ }
128
+ }
129
+ }
130
+ };
131
+ }
@@ -0,0 +1,23 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ import type { Snippet } from 'svelte';
3
+ export interface TooltipProps extends Component {
4
+ open?: boolean;
5
+ dark?: boolean;
6
+ light?: boolean;
7
+ rounded?: string;
8
+ label?: string;
9
+ location?: 'top' | 'bottom' | 'left' | 'right';
10
+ color?: string;
11
+ background?: string;
12
+ delayDuration?: number;
13
+ variant?: 'arrow';
14
+ density?: 'compact' | 'comfortable' | 'default';
15
+ disabled?: boolean;
16
+ avoidCollisions?: boolean;
17
+ tooltip?: Snippet;
18
+ }
19
+ export type PositionElement = {
20
+ x: number;
21
+ y: number;
22
+ location: string | null;
23
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function helloWorld(): void;
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // Reexport your entry components here
2
+ export function helloWorld() {
3
+ console.log('Hello world, this is lapikit!');
4
+ }
@@ -0,0 +1,40 @@
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;
@@ -0,0 +1,44 @@
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
+ };
@@ -0,0 +1,8 @@
1
+ export declare function getAssets(): {
2
+ shape(params?: string): string | undefined;
3
+ className(key: string, type: string, value: string | boolean | Array<string> | {
4
+ [key: string]: string;
5
+ }): string | undefined;
6
+ color(color?: string): string | undefined;
7
+ unit(value?: string | number): string | undefined;
8
+ };
@@ -0,0 +1,52 @@
1
+ import { x11ColorNames } from '../utils/x11.js';
2
+ export function getAssets() {
3
+ return {
4
+ shape(params) {
5
+ if (params) {
6
+ if (params === 'none' || params == '0')
7
+ return '0';
8
+ return `var(--kit-radius-${params})`;
9
+ }
10
+ },
11
+ className(key, type, value) {
12
+ if (typeof value === 'string')
13
+ return `kit-${key}--${type}-${value}`;
14
+ else if (typeof value === 'boolean' && value)
15
+ return `kit-${key}--${type}`;
16
+ else if (typeof value === 'object') {
17
+ if (Array.isArray(value)) {
18
+ return value
19
+ .map((media) => `${media === '_default' ? '' : `${media}:`}kit--${type}`)
20
+ .join(' ');
21
+ }
22
+ else {
23
+ return Object.entries(value)
24
+ .map(([media, value]) => `${media === '_default' ? '' : `${media}:`}kit-${key}--${type}-${value}`)
25
+ .join(' ');
26
+ }
27
+ }
28
+ },
29
+ color(color) {
30
+ if (color) {
31
+ if (color.includes('#') ||
32
+ color.includes('rgb') ||
33
+ color.includes('rgba') ||
34
+ color.includes('oklch') ||
35
+ x11ColorNames.includes(color.toLowerCase()))
36
+ return color;
37
+ return `var(--kit-${color})`;
38
+ }
39
+ },
40
+ unit(value) {
41
+ if (typeof value === 'number')
42
+ return `${value}px`;
43
+ if (typeof value === 'string') {
44
+ const cleaned = value.trim();
45
+ const isOnlyNumericLike = /^[\d.,]+$/.test(cleaned);
46
+ if (isOnlyNumericLike)
47
+ return `${value}px`;
48
+ }
49
+ return value;
50
+ }
51
+ };
52
+ }
@@ -0,0 +1,9 @@
1
+ type ClickOutsideOptions = {
2
+ exclude?: (HTMLElement | PointerEvent | null)[];
3
+ onClose: () => void;
4
+ };
5
+ export declare function clickOutside(node: HTMLElement, options: ClickOutsideOptions): {
6
+ update(newOptions: ClickOutsideOptions): void;
7
+ destroy(): void;
8
+ };
9
+ export {};
@@ -0,0 +1,34 @@
1
+ export function clickOutside(node, options) {
2
+ let { exclude = [], onClose } = options;
3
+ function isTargetExcluded(target) {
4
+ return exclude.some((ex) => {
5
+ if (!ex)
6
+ return false;
7
+ if (ex instanceof HTMLElement) {
8
+ return ex.contains(target);
9
+ }
10
+ if (ex instanceof PointerEvent && ex.target instanceof Node) {
11
+ return ex.target.contains(target);
12
+ }
13
+ return false;
14
+ });
15
+ }
16
+ const handleClick = (event) => {
17
+ const target = event.target;
18
+ const isExcluded = isTargetExcluded(target);
19
+ const isInside = node.contains(target);
20
+ if (!isInside && !isExcluded) {
21
+ onClose();
22
+ }
23
+ };
24
+ document.addEventListener('click', handleClick, true);
25
+ return {
26
+ update(newOptions) {
27
+ exclude = newOptions.exclude || [];
28
+ onClose = newOptions.onClose;
29
+ },
30
+ destroy() {
31
+ document.removeEventListener('click', handleClick, true);
32
+ }
33
+ };
34
+ }
@@ -0,0 +1 @@
1
+ export declare const parseColor: (input: string) => string;
@@ -0,0 +1,50 @@
1
+ import { x11Colors } from '../utils/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,4 @@
1
+ export * from './terminal.js';
2
+ export * from './ansi.js';
3
+ export * from './assets.svelte.js';
4
+ export * from './scroll.js';
@@ -0,0 +1,4 @@
1
+ export * from './terminal.js';
2
+ export * from './ansi.js';
3
+ export * from './assets.svelte.js';
4
+ export * from './scroll.js';
@@ -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 @@
1
+ export declare function disabledScroll(state: boolean): void;
@@ -0,0 +1,6 @@
1
+ import { BROWSER } from 'esm-env';
2
+ export function disabledScroll(state) {
3
+ if (BROWSER) {
4
+ document.body.style.overflow = state ? 'hidden' : '';
5
+ }
6
+ }
@@ -0,0 +1 @@
1
+ export declare const terminal: (type: "info" | "error" | "warn" | "success" | undefined, msg: string) => void;
@@ -0,0 +1,12 @@
1
+ import { ansi } from './ansi.js';
2
+ export const terminal = (type = 'info', msg) => {
3
+ const name = ansi.color.cyan('lapikit');
4
+ if (type === 'error')
5
+ console.error(name, ansi.bold.red('[error]'), msg);
6
+ else if (type === 'warn')
7
+ console.warn(name, ansi.bold.yellow('[warn]'), msg);
8
+ else if (type === 'success')
9
+ console.warn(name, ansi.bold.green('[success]'), msg);
10
+ else
11
+ console.log(name, ansi.bold.blue('[info]'), msg);
12
+ };
@@ -0,0 +1,57 @@
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 {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const setUnit: (value: string | number) => string;
@@ -0,0 +1,11 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ import type { LapikitConfig } from '../../internal/types.js';
2
+ export declare const parseConfig: (props?: LapikitConfig) => import("../../internal/types.js").Lapikit;
@@ -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;