lapikit 0.0.0-insiders.fd1a829 → 0.0.0-insiders.fd9617d

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 (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -1
  3. package/bin/configuration.js +303 -0
  4. package/bin/helper.js +59 -0
  5. package/bin/index.js +33 -0
  6. package/bin/presets.js +26 -0
  7. package/bin/prompts.js +67 -0
  8. package/dist/actions/accordion.svelte.d.ts +9 -0
  9. package/dist/actions/accordion.svelte.js +24 -0
  10. package/dist/actions/index.d.ts +2 -0
  11. package/dist/actions/index.js +2 -0
  12. package/dist/actions/use-theme.d.ts +1 -0
  13. package/dist/actions/use-theme.js +18 -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 +36 -0
  23. package/dist/components/accordion/accordion.svelte +39 -0
  24. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  25. package/dist/components/accordion/modules/accordion-item.css +68 -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 +130 -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 +26 -0
  36. package/dist/components/app/app.svelte +79 -0
  37. package/dist/components/app/app.svelte.d.ts +4 -0
  38. package/dist/components/app/types.d.ts +10 -0
  39. package/dist/components/app/types.js +1 -0
  40. package/dist/components/appbar/appbar.css +38 -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 +25 -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 +102 -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 +240 -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 +105 -0
  61. package/dist/components/card/card.svelte +67 -0
  62. package/dist/components/card/card.svelte.d.ts +4 -0
  63. package/dist/components/card/types.d.ts +20 -0
  64. package/dist/components/card/types.js +1 -0
  65. package/dist/components/chip/chip.css +224 -0
  66. package/dist/components/chip/chip.svelte +131 -0
  67. package/dist/components/chip/chip.svelte.d.ts +4 -0
  68. package/dist/components/chip/types.d.ts +32 -0
  69. package/dist/components/chip/types.js +1 -0
  70. package/dist/components/dialog/dialog.css +129 -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 +13 -0
  76. package/dist/components/dropdown/dropdown.svelte +115 -0
  77. package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
  78. package/dist/components/dropdown/types.d.ts +26 -0
  79. package/dist/components/dropdown/types.js +1 -0
  80. package/dist/components/icon/icon.css +78 -0
  81. package/dist/components/icon/icon.svelte +49 -0
  82. package/dist/components/icon/icon.svelte.d.ts +4 -0
  83. package/dist/components/icon/types.d.ts +16 -0
  84. package/dist/components/icon/types.js +1 -0
  85. package/dist/components/index.d.ts +22 -0
  86. package/dist/components/index.js +23 -0
  87. package/dist/components/list/list.css +149 -0
  88. package/dist/components/list/list.svelte +44 -0
  89. package/dist/components/list/list.svelte.d.ts +4 -0
  90. package/dist/components/list/modules/list-item.css +67 -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 +137 -0
  96. package/dist/components/modal/modal.svelte +112 -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 +13 -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/types.d.ts +20 -0
  104. package/dist/components/popover/types.js +1 -0
  105. package/dist/components/separator/separator.css +42 -0
  106. package/dist/components/separator/separator.svelte +37 -0
  107. package/dist/components/separator/separator.svelte.d.ts +4 -0
  108. package/dist/components/separator/types.d.ts +15 -0
  109. package/dist/components/separator/types.js +1 -0
  110. package/dist/components/spacer/spacer.css +3 -0
  111. package/dist/components/spacer/spacer.svelte +7 -0
  112. package/dist/components/spacer/spacer.svelte.d.ts +4 -0
  113. package/dist/components/spacer/types.d.ts +4 -0
  114. package/dist/components/spacer/types.js +1 -0
  115. package/dist/components/textfield/textfield.css +298 -0
  116. package/dist/components/textfield/textfield.svelte +193 -0
  117. package/dist/components/textfield/textfield.svelte.d.ts +4 -0
  118. package/dist/components/textfield/types.d.ts +37 -0
  119. package/dist/components/textfield/types.js +1 -0
  120. package/dist/components/toolbar/toolbar.css +106 -0
  121. package/dist/components/toolbar/toolbar.svelte +47 -0
  122. package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
  123. package/dist/components/toolbar/types.d.ts +27 -0
  124. package/dist/components/toolbar/types.js +1 -0
  125. package/dist/components/tooltip/tooltip.css +116 -0
  126. package/dist/components/tooltip/tooltip.svelte +113 -0
  127. package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
  128. package/dist/components/tooltip/types.d.ts +23 -0
  129. package/dist/components/tooltip/types.js +1 -0
  130. package/dist/entry-bundler.d.ts +12 -0
  131. package/dist/entry-bundler.js +107 -0
  132. package/dist/index.d.ts +3 -1
  133. package/dist/index.js +23 -3
  134. package/dist/internal/config/presets.d.ts +149 -0
  135. package/dist/internal/config/presets.js +169 -0
  136. package/dist/internal/config/variables.d.ts +3 -0
  137. package/dist/internal/config/variables.js +3 -0
  138. package/dist/internal/core/actions/assets.svelte.d.ts +8 -0
  139. package/dist/internal/core/actions/assets.svelte.js +54 -0
  140. package/dist/internal/core/actions/dropdown.svelte.d.ts +7 -0
  141. package/dist/internal/core/actions/dropdown.svelte.js +148 -0
  142. package/dist/internal/core/actions/popover.svelte.d.ts +7 -0
  143. package/dist/internal/core/actions/popover.svelte.js +134 -0
  144. package/dist/internal/core/actions/tooltip.svelte.d.ts +7 -0
  145. package/dist/internal/core/actions/tooltip.svelte.js +131 -0
  146. package/dist/internal/core/animations/ripple.d.ts +12 -0
  147. package/dist/internal/core/animations/ripple.js +93 -0
  148. package/dist/{server/modules → internal/core/bin}/ansi.d.ts +0 -1
  149. package/dist/{server/modules → internal/core/bin}/ansi.js +0 -11
  150. package/dist/internal/core/bin/terminal.d.ts +1 -0
  151. package/dist/internal/core/bin/terminal.js +12 -0
  152. package/dist/internal/core/css.d.ts +1 -0
  153. package/dist/internal/core/css.js +16 -0
  154. package/dist/internal/core/formatter/component.d.ts +5 -0
  155. package/dist/internal/core/formatter/component.js +60 -0
  156. package/dist/internal/core/formatter/device.d.ts +5 -0
  157. package/dist/internal/core/formatter/device.js +66 -0
  158. package/dist/internal/core/formatter/index.d.ts +7 -0
  159. package/dist/internal/core/formatter/index.js +35 -0
  160. package/dist/internal/core/formatter/style.d.ts +4 -0
  161. package/dist/internal/core/formatter/style.js +15 -0
  162. package/dist/internal/core/formatter/theme.d.ts +5 -0
  163. package/dist/internal/core/formatter/theme.js +44 -0
  164. package/dist/internal/core/formatter/typography.d.ts +5 -0
  165. package/dist/internal/core/formatter/typography.js +12 -0
  166. package/dist/internal/core/standard-colors.d.ts +75 -0
  167. package/dist/internal/core/standard-colors.js +75 -0
  168. package/dist/{server/modules/x11.d.ts → internal/core/x11-colors.d.ts} +1 -1
  169. package/dist/internal/helpers/colors.d.ts +1 -0
  170. package/dist/{server/modules → internal/helpers}/colors.js +2 -2
  171. package/dist/internal/helpers/convert.d.ts +1 -0
  172. package/dist/internal/helpers/convert.js +17 -0
  173. package/dist/internal/helpers/deep-merge.d.ts +44 -0
  174. package/dist/internal/helpers/deep-merge.js +80 -0
  175. package/dist/internal/helpers/outside.d.ts +9 -0
  176. package/dist/internal/helpers/outside.js +34 -0
  177. package/dist/internal/helpers/parser.d.ts +10 -0
  178. package/dist/internal/helpers/parser.js +93 -0
  179. package/dist/internal/helpers/scroll.d.ts +1 -0
  180. package/dist/internal/helpers/scroll.js +5 -0
  181. package/dist/internal/plugins/vite.d.ts +8 -0
  182. package/dist/internal/plugins/vite.js +33 -0
  183. package/dist/internal/types/components.d.ts +14 -0
  184. package/dist/internal/types/components.js +1 -0
  185. package/dist/internal/types/configuration.d.ts +63 -0
  186. package/dist/internal/types/configuration.js +1 -0
  187. package/dist/internal/types/index.d.ts +2 -0
  188. package/dist/internal/types/index.js +2 -0
  189. package/dist/labs/components/btn/btn.svelte +13 -0
  190. package/dist/labs/components/btn/btn.svelte.d.ts +5 -0
  191. package/dist/labs/components/index.d.ts +1 -0
  192. package/dist/labs/components/index.js +2 -0
  193. package/dist/stores/breakpoints.d.ts +6 -0
  194. package/dist/stores/breakpoints.js +14 -0
  195. package/dist/stores/components.d.ts +8 -0
  196. package/dist/stores/components.js +26 -0
  197. package/dist/stores/devices.d.ts +6 -0
  198. package/dist/stores/devices.js +9 -0
  199. package/dist/stores/index.d.ts +5 -0
  200. package/dist/stores/index.js +5 -0
  201. package/dist/stores/themes.d.ts +2 -0
  202. package/dist/stores/themes.js +4 -0
  203. package/dist/stores/viewport.d.ts +7 -0
  204. package/dist/stores/viewport.js +7 -0
  205. package/dist/styles/animation.css +33 -0
  206. package/dist/styles/keyframes.css +30 -0
  207. package/dist/styles/{normalize.css → reset.css} +15 -5
  208. package/dist/styles.css.d.ts +4 -0
  209. package/dist/themes.css +0 -0
  210. package/dist/themes.css.d.ts +4 -0
  211. package/package.json +135 -74
  212. package/dist/app.d.ts +0 -13
  213. package/dist/app.html +0 -12
  214. package/dist/server/modules/colors.d.ts +0 -1
  215. package/dist/server/modules/css.d.ts +0 -1
  216. package/dist/server/modules/css.js +0 -144
  217. package/dist/server/modules/devices.d.ts +0 -1
  218. package/dist/server/modules/devices.js +0 -43
  219. package/dist/server/modules/importer.d.ts +0 -1
  220. package/dist/server/modules/importer.js +0 -13
  221. package/dist/server/modules/themes.d.ts +0 -4
  222. package/dist/server/modules/themes.js +0 -94
  223. package/dist/server/vite.d.ts +0 -11
  224. package/dist/server/vite.js +0 -17
  225. package/dist/styles/variables.css +0 -7
  226. /package/dist/{server/modules → internal/core}/minify.d.ts +0 -0
  227. /package/dist/{server/modules → internal/core}/minify.js +0 -0
  228. /package/dist/{server/modules/x11.js → internal/core/x11-colors.js} +0 -0
@@ -0,0 +1,27 @@
1
+ import type { Component } from '../../internal/types/index.js';
2
+ type Variant = 'outline' | 'text' | 'dash';
3
+ type Density = 'compact' | 'comfortable' | 'default';
4
+ type Orientation = 'horizontal' | 'vertical';
5
+ type Location = 'top' | 'bottom';
6
+ export interface ToolbarProps extends Component {
7
+ is?: 'div' | 'header' | 'nav';
8
+ variant?: Variant | {
9
+ [key: string]: Variant;
10
+ };
11
+ rounded?: string;
12
+ density?: Density | {
13
+ [key: string]: Density;
14
+ };
15
+ dark?: boolean;
16
+ light?: boolean;
17
+ color?: string;
18
+ orientation?: Orientation | {
19
+ [key: string]: Orientation;
20
+ };
21
+ background?: string;
22
+ location?: Location | {
23
+ [key: string]: Location;
24
+ };
25
+ classContent?: string | string[] | undefined;
26
+ }
27
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,116 @@
1
+ .kit-tooltip {
2
+ inset: 0px auto auto 0px;
3
+ margin: 0px;
4
+ position: fixed;
5
+ z-index: 2000;
6
+ }
7
+
8
+ .kit-tooltip-content {
9
+ background-color: var(--tooltip-background, var(--kit-background-grouped-primary));
10
+ color: var(--tooltip-color, var(--kit-label-primary));
11
+ border-radius: var(--tooltip-shape, var(--system-shape-md));
12
+ border: 1px solid var(--tooltip-background, var(--kit-background-grouped-primary));
13
+ font-size: 0.875rem;
14
+ display: inline-block;
15
+ width: auto;
16
+ pointer-events: none;
17
+ overflow-wrap: break-word;
18
+ box-shadow: 0px 16px 29px -10px color-mix(in oklab, var(--kit-state-shadow) 60%, transparent);
19
+ }
20
+
21
+ /* density */
22
+ .kit-tooltip-content[breakpoint]kit-tooltip-content--density-default {
23
+ padding: 0.15rem 0.625rem;
24
+ }
25
+
26
+ .kit-tooltip-content[breakpoint]kit-tooltip-content--density-compact {
27
+ padding: 0.125rem 0.5rem;
28
+ }
29
+
30
+ .kit-tooltip-content[breakpoint]kit-tooltip-content--density-comfortable {
31
+ padding: 0.35rem 0.75rem;
32
+ }
33
+
34
+ .kit-tooltip-content--arrow::after {
35
+ content: ' ';
36
+ position: absolute;
37
+ border-style: solid;
38
+ }
39
+
40
+ .kit-tooltip-content--arrow.kit-tooltip-content--bottom::after,
41
+ .kit-tooltip-content--arrow.kit-tooltip-content--top::after {
42
+ left: 50%;
43
+ margin-left: -0.35rem;
44
+ border-width: 0.35rem;
45
+ }
46
+
47
+ .kit-tooltip-content--arrow.kit-tooltip-content--bottom::after {
48
+ bottom: 100%;
49
+ border-color: transparent transparent var(--tooltip-background) transparent;
50
+ }
51
+
52
+ .kit-tooltip-content--arrow.kit-tooltip-content--top::after {
53
+ top: 100%;
54
+ border-color: var(--tooltip-background) transparent transparent transparent;
55
+ }
56
+
57
+ .kit-tooltip-content--arrow.kit-tooltip-content--left::after,
58
+ .kit-tooltip-content--arrow.kit-tooltip-content--right::after {
59
+ top: 50%;
60
+ margin-top: -0.35rem;
61
+ border-width: 0.35rem;
62
+ }
63
+
64
+ .kit-tooltip-content--arrow.kit-tooltip-content--right::after {
65
+ right: 100%;
66
+ border-color: transparent var(--tooltip-background) transparent transparent;
67
+ }
68
+
69
+ .kit-tooltip-content--arrow.kit-tooltip-content--left::after {
70
+ left: 100%;
71
+ border-color: transparent transparent transparent var(--tooltip-background);
72
+ }
73
+
74
+ .kit-tooltip-content--top,
75
+ .kit-tooltip-content--bottom,
76
+ .kit-tooltip-content--right,
77
+ .kit-tooltip-content--left {
78
+ animation-duration: 150ms;
79
+ animation-name: enter;
80
+ }
81
+
82
+ .kit-tooltip-content--top {
83
+ --animate-enter-pos1: 0;
84
+ --animate-enter-pos2: 0.5rem;
85
+ --animate-enter-pos3: 0;
86
+ }
87
+
88
+ .kit-tooltip-content--bottom {
89
+ --animate-enter-pos1: 0;
90
+ --animate-enter-pos2: -0.5rem;
91
+ --animate-enter-pos3: 0;
92
+ }
93
+
94
+ .kit-tooltip-content--right {
95
+ --animate-enter-pos1: -0.5rem;
96
+ --animate-enter-pos2: 0;
97
+ --animate-enter-pos3: 0;
98
+ }
99
+
100
+ .kit-tooltip-content--left {
101
+ --animate-enter-pos1: 0.5rem;
102
+ --animate-enter-pos2: 0;
103
+ --animate-enter-pos3: 0;
104
+ }
105
+
106
+ @keyframes enter {
107
+ 0% {
108
+ opacity: 0;
109
+ transform: translate3d(
110
+ var(--animate-enter-pos1),
111
+ var(--animate-enter-pos2),
112
+ var(--animate-enter-pos3)
113
+ )
114
+ scale3d(0.95, 0.95, 0.95) rotate(0);
115
+ }
116
+ }
@@ -0,0 +1,113 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/core/actions/assets.svelte.js';
3
+ import { getPositionsTooltip } from '../../internal/core/actions/tooltip.svelte.js';
4
+ import type { PositionElement, TooltipProps } from './types.js';
5
+
6
+ let {
7
+ children,
8
+ tooltip,
9
+ open = $bindable(),
10
+ label,
11
+ dark,
12
+ light,
13
+ rounded,
14
+ color,
15
+ background,
16
+ location = 'bottom',
17
+ delayDuration = 850,
18
+ density = 'default',
19
+ variant,
20
+ disabled,
21
+ avoidCollisions = true,
22
+ forceMount,
23
+ ...rest
24
+ }: TooltipProps = $props();
25
+
26
+ const positionAxis = getPositionsTooltip();
27
+ const assets = getAssets();
28
+
29
+ let ref: HTMLElement | null = $state(null);
30
+ let refTooltip: HTMLElement | null = $state(null);
31
+ let timer: ReturnType<typeof setTimeout> | null = $state(null);
32
+ let axis: PositionElement = $state({ x: 0, y: 0, location: null });
33
+ let innerHeight = $state(0);
34
+ let innerWidth = $state(0);
35
+ let scrollX = $state(0);
36
+ let scrollY = $state(0);
37
+
38
+ axis = positionAxis?.values;
39
+
40
+ $effect(() => {
41
+ if (
42
+ open &&
43
+ ref &&
44
+ refTooltip &&
45
+ (scrollX > 0 || scrollY > 0 || innerHeight > 0 || innerWidth > 0)
46
+ ) {
47
+ positionAxis.update(ref, refTooltip, location, true, avoidCollisions);
48
+ }
49
+ });
50
+
51
+ $effect(() => {
52
+ if (tooltip) forceMount = true;
53
+ });
54
+
55
+ const handleMouse = (state: string) => {
56
+ if (disabled) return (open = false);
57
+ if (state === 'enter') {
58
+ timer = setTimeout(() => {
59
+ open = true;
60
+ }, delayDuration);
61
+ } else if (state === 'leave') {
62
+ if (timer) {
63
+ clearTimeout(timer);
64
+ timer = null;
65
+ }
66
+ open = false;
67
+ }
68
+ };
69
+ </script>
70
+
71
+ <svelte:window bind:innerHeight bind:innerWidth bind:scrollX bind:scrollY />
72
+
73
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
74
+ <span
75
+ bind:this={ref}
76
+ onmouseenter={() => handleMouse('enter')}
77
+ onmouseleave={() => handleMouse('leave')}
78
+ style:display="inline-flex"
79
+ >
80
+ {@render children?.()}
81
+ </span>
82
+
83
+ {#if open || forceMount}
84
+ <div
85
+ bind:this={refTooltip}
86
+ class={['kit-tooltip']}
87
+ role="tooltip"
88
+ aria-label={label}
89
+ style={`transform: translate(${axis.x}px, ${axis.y}px);display: ${open ? 'initial' : 'none'}`}
90
+ >
91
+ <div
92
+ class={[
93
+ 'kit-tooltip-content animate-in',
94
+ light && 'light',
95
+ dark && 'dark',
96
+ rounded && assets.shape(rounded),
97
+ axis?.location && `kit-tooltip-content--${axis?.location}`,
98
+ variant && `kit-tooltip-content--${variant}`,
99
+ density && assets.className('tooltip-content', 'density', density),
100
+ rest.class
101
+ ]}
102
+ style:--tooltip-background={assets.color(background)}
103
+ style:--tooltip-color={assets.color(color)}
104
+ style:--tooltip-shape={assets.shape(rounded)}
105
+ >
106
+ {#if tooltip}
107
+ {@render tooltip?.()}
108
+ {:else}
109
+ {label}
110
+ {/if}
111
+ </div>
112
+ </div>
113
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { TooltipProps } from './types.js';
2
+ declare const Tooltip: import("svelte").Component<TooltipProps, {}, "open">;
3
+ type Tooltip = ReturnType<typeof Tooltip>;
4
+ export default Tooltip;
@@ -0,0 +1,23 @@
1
+ import type { Component } from '../../internal/types/index.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,12 @@
1
+ type LapikitPreprocessOptions = {
2
+ plugins?: string[];
3
+ };
4
+ declare function lapikitPreprocess(options?: LapikitPreprocessOptions): {
5
+ markup({ content }: {
6
+ content: string;
7
+ filename?: string;
8
+ }): {
9
+ code: string;
10
+ } | undefined;
11
+ };
12
+ export { lapikitPreprocess };
@@ -0,0 +1,107 @@
1
+ const components = ['btn'];
2
+ function componentName(shortName) {
3
+ return 'Kit' + shortName.charAt(0).toUpperCase() + shortName.slice(1);
4
+ }
5
+ // plugins lapikit
6
+ const lapikitPlugins = {
7
+ repl: {
8
+ components: ['repl'],
9
+ ref: '@lapikit/repl'
10
+ }
11
+ };
12
+ function lapikitPreprocess(options) {
13
+ return {
14
+ markup({ content }) {
15
+ const allComponents = [...components];
16
+ const componentToRef = new Map();
17
+ components.forEach((comp) => {
18
+ componentToRef.set(comp, 'lapikit/labs/components');
19
+ });
20
+ // plugins
21
+ if (options?.plugins) {
22
+ options.plugins.forEach((pluginKey) => {
23
+ const plugin = lapikitPlugins[pluginKey];
24
+ if (plugin) {
25
+ plugin.components.forEach((comp) => {
26
+ if (!allComponents.includes(comp)) {
27
+ allComponents.push(comp);
28
+ }
29
+ componentToRef.set(comp, plugin.ref);
30
+ });
31
+ }
32
+ });
33
+ }
34
+ const hasComponent = allComponents.some((comp) => content.includes(`<kit:${comp}`));
35
+ if (!hasComponent)
36
+ return;
37
+ let processedContent = content;
38
+ const importedComponents = new Map();
39
+ let hasChanges = true;
40
+ while (hasChanges) {
41
+ hasChanges = false;
42
+ for (const shortName of allComponents) {
43
+ const componentNameStr = componentName(shortName);
44
+ const attrPattern = `(?:[^>"']|"[^"]*"|'[^']*')*?`;
45
+ const selfClosingRegex = new RegExp(`<kit:${shortName}(${attrPattern})\\s*/>`, 'g');
46
+ const pairRegex = new RegExp(`<kit:${shortName}(${attrPattern})>([\\s\\S]*?)<\\/kit:${shortName}\\s*>`, 'g');
47
+ let newContent = processedContent.replace(selfClosingRegex, (fullMatch, attrs) => {
48
+ hasChanges = true;
49
+ const ref = componentToRef.get(shortName) || 'lapikit/labs/components';
50
+ importedComponents.set(componentNameStr, ref);
51
+ return `<${componentNameStr}${attrs} />`;
52
+ });
53
+ newContent = newContent.replace(pairRegex, (fullMatch, attrs, children) => {
54
+ hasChanges = true;
55
+ const ref = componentToRef.get(shortName) || 'lapikit/labs/components';
56
+ importedComponents.set(componentNameStr, ref);
57
+ return `<${componentNameStr}${attrs}>${children}</${componentNameStr}>`;
58
+ });
59
+ if (newContent !== processedContent) {
60
+ processedContent = newContent;
61
+ }
62
+ }
63
+ }
64
+ if (processedContent === content)
65
+ return;
66
+ if (importedComponents.size > 0) {
67
+ const importsByRef = new Map();
68
+ importedComponents.forEach((ref, component) => {
69
+ if (!importsByRef.has(ref)) {
70
+ importsByRef.set(ref, []);
71
+ }
72
+ importsByRef.get(ref).push(component);
73
+ });
74
+ const importLines = Array.from(importsByRef.entries())
75
+ .map(([ref, components]) => {
76
+ const imports = components.join(', ');
77
+ return `\n\timport { ${imports} } from '${ref}';`;
78
+ })
79
+ .join('');
80
+ const scriptRegex = /<script(?![^>]*\bmodule\b)([^>]*)>/;
81
+ const scriptMatch = processedContent.match(scriptRegex);
82
+ if (scriptMatch && scriptMatch.index !== undefined) {
83
+ const insertPos = scriptMatch.index + scriptMatch[0].length;
84
+ processedContent =
85
+ processedContent.slice(0, insertPos) + importLines + processedContent.slice(insertPos);
86
+ }
87
+ else {
88
+ const moduleScriptMatch = processedContent.match(/<script[^>]*\bmodule\b[^>]*>/);
89
+ if (moduleScriptMatch && moduleScriptMatch.index !== undefined) {
90
+ const moduleScriptEnd = processedContent.indexOf('</script>', moduleScriptMatch.index) + '</script>'.length;
91
+ processedContent =
92
+ processedContent.slice(0, moduleScriptEnd) +
93
+ `\n\n<script>${importLines}\n</script>` +
94
+ processedContent.slice(moduleScriptEnd);
95
+ }
96
+ else {
97
+ processedContent = `<script>${importLines}\n</script>\n\n` + processedContent;
98
+ }
99
+ }
100
+ }
101
+ return {
102
+ code: processedContent
103
+ };
104
+ }
105
+ };
106
+ }
107
+ export { lapikitPreprocess };
package/dist/index.d.ts CHANGED
@@ -1 +1,3 @@
1
- export declare function helloWorld(): void;
1
+ import type { LapikitConfiguration } from './internal/types/configuration.js';
2
+ declare function createLapikit(lapikit: LapikitConfiguration): void;
3
+ export default createLapikit;
package/dist/index.js CHANGED
@@ -1,4 +1,24 @@
1
- // Reexport your entry components here
2
- export function helloWorld() {
3
- console.log('Hello world, this is lapikit!');
1
+ import { deepMerge } from './internal/helpers/deep-merge.js';
2
+ import { breakpoints } from './stores/breakpoints.js';
3
+ import { get } from 'svelte/store';
4
+ import { devices } from './stores/devices.js';
5
+ import { valueToPx } from './internal/helpers/convert.js';
6
+ function createLapikit(lapikit) {
7
+ if (lapikit?.breakpoints?.thresholds) {
8
+ const currentBreakpoints = get(breakpoints);
9
+ const breakpointMerged = deepMerge(currentBreakpoints, lapikit.breakpoints.thresholds);
10
+ const formattedBreakpoints = Object.fromEntries(Object.entries(breakpointMerged).map(([key, value]) => [key, valueToPx(value)]));
11
+ breakpoints.set(formattedBreakpoints);
12
+ }
13
+ if (lapikit?.breakpoints?.devices) {
14
+ const currentDevices = get(devices);
15
+ const currentBreakpoints = get(breakpoints);
16
+ const deviceMerged = deepMerge(currentDevices, lapikit.breakpoints.devices);
17
+ const formattedDevices = Object.fromEntries(Object.entries(deviceMerged).map(([key, deviceKey]) => {
18
+ const breakpointValue = currentBreakpoints[deviceKey];
19
+ return [key, valueToPx(breakpointValue)];
20
+ }));
21
+ devices.set(formattedDevices);
22
+ }
4
23
  }
24
+ export default createLapikit;
@@ -0,0 +1,149 @@
1
+ export declare const preset: {
2
+ breakpoints: {
3
+ devices: {
4
+ desktop: number;
5
+ tablet: number;
6
+ mobile: number;
7
+ };
8
+ thresholds: {
9
+ base: number;
10
+ xs: number;
11
+ sm: number;
12
+ md: number;
13
+ lg: number;
14
+ xl: number;
15
+ '2xl': number;
16
+ '3xl': number;
17
+ };
18
+ };
19
+ theme: {
20
+ defaultTheme: string;
21
+ colorScheme: boolean;
22
+ themes: {
23
+ light: {
24
+ dark: boolean;
25
+ colors: {
26
+ label: {
27
+ primary: string;
28
+ secondary: string;
29
+ tertiary: string;
30
+ quaternary: string;
31
+ };
32
+ accent: {
33
+ primary: string;
34
+ success: string;
35
+ warning: string;
36
+ destructive: string;
37
+ info: string;
38
+ };
39
+ separator: {
40
+ default: string;
41
+ opaque: string;
42
+ };
43
+ state: {
44
+ placeholder: string;
45
+ disabled: string;
46
+ link: string;
47
+ highlight: string;
48
+ shadow: string;
49
+ };
50
+ background: {
51
+ primary: string;
52
+ secondary: string;
53
+ tertiary: string;
54
+ grouped: {
55
+ primary: string;
56
+ secondary: string;
57
+ tertiary: string;
58
+ };
59
+ };
60
+ };
61
+ variables: {
62
+ 'test-variable': string;
63
+ };
64
+ };
65
+ dark: {
66
+ dark: boolean;
67
+ colors: {
68
+ pink: string;
69
+ label: {
70
+ primary: string;
71
+ secondary: string;
72
+ tertiary: string;
73
+ quaternary: string;
74
+ };
75
+ accent: {
76
+ primary: string;
77
+ success: string;
78
+ warning: string;
79
+ destructive: string;
80
+ info: string;
81
+ };
82
+ separator: {
83
+ default: string;
84
+ opaque: string;
85
+ };
86
+ state: {
87
+ placeholder: string;
88
+ disabled: string;
89
+ link: string;
90
+ highlight: string;
91
+ shadow: string;
92
+ };
93
+ background: {
94
+ primary: string;
95
+ secondary: string;
96
+ tertiary: string;
97
+ grouped: {
98
+ primary: string;
99
+ secondary: string;
100
+ tertiary: string;
101
+ };
102
+ };
103
+ };
104
+ variables: {
105
+ 'test-variable': string;
106
+ };
107
+ };
108
+ };
109
+ };
110
+ typography: {
111
+ defaultTypography: string;
112
+ fonts: {
113
+ default: {
114
+ sans: string[];
115
+ mono: string[];
116
+ serif: string[];
117
+ };
118
+ };
119
+ };
120
+ styles: {
121
+ spacing: string;
122
+ shape: {
123
+ sm: string;
124
+ md: string;
125
+ lg: string;
126
+ xl: string;
127
+ '2xl': string;
128
+ '3xl': string;
129
+ full: string;
130
+ };
131
+ dialog: {
132
+ xs: string;
133
+ sm: string;
134
+ md: string;
135
+ lg: string;
136
+ xl: string;
137
+ };
138
+ modal: {
139
+ xs: string;
140
+ sm: string;
141
+ md: string;
142
+ lg: string;
143
+ xl: string;
144
+ };
145
+ animation: {
146
+ 'ripple-duration': string;
147
+ };
148
+ };
149
+ };