lapikit 0.0.0-insiders.e330f8d → 0.0.0-insiders.e552ce3

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 (147) hide show
  1. package/bin/configuration.js +152 -0
  2. package/bin/helper.js +23 -0
  3. package/bin/index.js +41 -0
  4. package/bin/lapikit.js +37 -5
  5. package/bin/legacy.js +34 -0
  6. package/bin/modules/adapter.js +3 -3
  7. package/bin/modules/plugin.js +223 -0
  8. package/bin/presets.js +23 -0
  9. package/bin/prompts.js +101 -0
  10. package/dist/actions/index.d.ts +1 -0
  11. package/dist/actions/index.js +1 -0
  12. package/dist/assets/icons/arrow-down.svelte +12 -0
  13. package/dist/assets/icons/arrow-down.svelte.d.ts +18 -0
  14. package/dist/assets/icons/arrow-up.svelte +12 -0
  15. package/dist/assets/icons/arrow-up.svelte.d.ts +18 -0
  16. package/dist/assets/icons/close-fill.svelte +12 -0
  17. package/dist/assets/icons/close-fill.svelte.d.ts +18 -0
  18. package/dist/assets/icons/loading-fill.svelte +31 -0
  19. package/dist/assets/icons/loading-fill.svelte.d.ts +18 -0
  20. package/dist/components/accordion/accordion.css +113 -0
  21. package/dist/components/accordion/accordion.svelte +37 -0
  22. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  23. package/dist/components/accordion/accordion.svelte.js +24 -0
  24. package/dist/components/accordion/modules/accordion-item.svelte +94 -0
  25. package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
  26. package/dist/components/accordion/types.d.ts +33 -0
  27. package/dist/components/accordion/types.js +1 -0
  28. package/dist/components/alert/alert.css +137 -0
  29. package/dist/components/alert/alert.svelte +89 -0
  30. package/dist/components/alert/alert.svelte.d.ts +4 -0
  31. package/dist/components/alert/types.d.ts +28 -0
  32. package/dist/components/alert/types.js +1 -0
  33. package/dist/components/app/app.css +16 -0
  34. package/dist/components/app/app.svelte +31 -2
  35. package/dist/components/appbar/appbar.css +48 -0
  36. package/dist/components/appbar/appbar.svelte +40 -0
  37. package/dist/components/appbar/appbar.svelte.d.ts +4 -0
  38. package/dist/components/appbar/types.d.ts +15 -0
  39. package/dist/components/appbar/types.js +1 -0
  40. package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
  41. package/dist/components/aspect-ratio/aspect-ratio.svelte +47 -0
  42. package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
  43. package/dist/components/aspect-ratio/types.d.ts +5 -0
  44. package/dist/components/aspect-ratio/types.js +1 -0
  45. package/dist/components/avatar/avatar.css +109 -0
  46. package/dist/components/avatar/avatar.svelte +46 -0
  47. package/dist/components/avatar/avatar.svelte.d.ts +4 -0
  48. package/dist/components/avatar/types.d.ts +22 -0
  49. package/dist/components/avatar/types.js +1 -0
  50. package/dist/components/button/button.css +168 -161
  51. package/dist/components/button/button.svelte +51 -30
  52. package/dist/components/button/button.svelte.d.ts +2 -2
  53. package/dist/components/button/types.d.ts +10 -5
  54. package/dist/components/card/card.css +115 -0
  55. package/dist/components/card/card.svelte +63 -0
  56. package/dist/components/card/card.svelte.d.ts +4 -0
  57. package/dist/components/card/types.d.ts +18 -0
  58. package/dist/components/card/types.js +1 -0
  59. package/dist/components/chip/chip.css +231 -0
  60. package/dist/components/chip/chip.svelte +129 -0
  61. package/dist/components/chip/chip.svelte.d.ts +4 -0
  62. package/dist/components/chip/types.d.ts +31 -0
  63. package/dist/components/chip/types.js +1 -0
  64. package/dist/components/dialog/dialog.css +134 -0
  65. package/dist/components/dialog/dialog.svelte +67 -0
  66. package/dist/components/dialog/dialog.svelte.d.ts +4 -0
  67. package/dist/components/dialog/types.d.ts +24 -0
  68. package/dist/components/dialog/types.js +1 -0
  69. package/dist/components/dropdown/dropdown.css +22 -0
  70. package/dist/components/dropdown/dropdown.svelte +116 -0
  71. package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
  72. package/dist/components/dropdown/dropdown.svelte.js +148 -0
  73. package/dist/components/dropdown/types.d.ts +26 -0
  74. package/dist/components/dropdown/types.js +1 -0
  75. package/dist/components/icon/icon.css +79 -0
  76. package/dist/components/icon/icon.svelte +49 -0
  77. package/dist/components/icon/icon.svelte.d.ts +4 -0
  78. package/dist/components/icon/types.d.ts +16 -0
  79. package/dist/components/icon/types.js +1 -0
  80. package/dist/components/index.d.ts +21 -1
  81. package/dist/components/index.js +21 -1
  82. package/dist/components/list/list.css +221 -0
  83. package/dist/components/list/list.svelte +44 -0
  84. package/dist/components/list/list.svelte.d.ts +4 -0
  85. package/dist/components/list/modules/list-item.svelte +76 -0
  86. package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
  87. package/dist/components/list/types.d.ts +33 -0
  88. package/dist/components/list/types.js +1 -0
  89. package/dist/components/modal/modal.css +144 -0
  90. package/dist/components/modal/modal.svelte +113 -0
  91. package/dist/components/modal/modal.svelte.d.ts +4 -0
  92. package/dist/components/modal/types.d.ts +26 -0
  93. package/dist/components/modal/types.js +1 -0
  94. package/dist/components/popover/popover.css +22 -0
  95. package/dist/components/popover/popover.svelte +73 -0
  96. package/dist/components/popover/popover.svelte.d.ts +4 -0
  97. package/dist/components/popover/popover.svelte.js +134 -0
  98. package/dist/components/popover/types.d.ts +20 -0
  99. package/dist/components/popover/types.js +1 -0
  100. package/dist/components/separator/separator.css +46 -0
  101. package/dist/components/separator/separator.svelte +37 -0
  102. package/dist/components/separator/separator.svelte.d.ts +4 -0
  103. package/dist/components/separator/types.d.ts +11 -0
  104. package/dist/components/separator/types.js +1 -0
  105. package/dist/components/spacer/spacer.css +3 -0
  106. package/dist/components/spacer/spacer.svelte +7 -0
  107. package/dist/components/spacer/spacer.svelte.d.ts +4 -0
  108. package/dist/components/spacer/types.d.ts +4 -0
  109. package/dist/components/spacer/types.js +1 -0
  110. package/dist/components/textfield/textfield.css +305 -0
  111. package/dist/components/textfield/textfield.svelte +193 -0
  112. package/dist/components/textfield/textfield.svelte.d.ts +4 -0
  113. package/dist/components/textfield/types.d.ts +37 -0
  114. package/dist/components/textfield/types.js +1 -0
  115. package/dist/components/toolbar/toolbar.css +129 -0
  116. package/dist/components/toolbar/toolbar.svelte +47 -0
  117. package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
  118. package/dist/components/toolbar/types.d.ts +27 -0
  119. package/dist/components/toolbar/types.js +1 -0
  120. package/dist/components/tooltip/tooltip.css +124 -0
  121. package/dist/components/tooltip/tooltip.svelte +113 -0
  122. package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
  123. package/dist/components/tooltip/tooltip.svelte.js +131 -0
  124. package/dist/components/tooltip/types.d.ts +23 -0
  125. package/dist/components/tooltip/types.js +1 -0
  126. package/dist/internal/assets.svelte.d.ts +1 -0
  127. package/dist/internal/assets.svelte.js +13 -0
  128. package/dist/internal/clickOutside.d.ts +9 -0
  129. package/dist/internal/clickOutside.js +34 -0
  130. package/dist/internal/index.d.ts +1 -0
  131. package/dist/internal/index.js +1 -0
  132. package/dist/internal/ripple.d.ts +12 -0
  133. package/dist/internal/ripple.js +93 -0
  134. package/dist/internal/scroll.d.ts +1 -0
  135. package/dist/internal/scroll.js +6 -0
  136. package/dist/internal/unit.d.ts +1 -0
  137. package/dist/internal/unit.js +11 -0
  138. package/dist/preset.js +2 -2
  139. package/dist/stores/index.d.ts +9 -3
  140. package/dist/stores/index.js +27 -3
  141. package/dist/style/animation.css +51 -0
  142. package/dist/style/css.js +3 -0
  143. package/dist/style/normalize.css +2 -0
  144. package/dist/style/parser/color.js +2 -2
  145. package/dist/style/parser/device.js +31 -19
  146. package/dist/style/variable.css +12 -0
  147. package/package.json +12 -4
@@ -0,0 +1,4 @@
1
+ import type { ToolbarProps } from './types.js';
2
+ declare const Toolbar: import("svelte").Component<ToolbarProps, {}, "ref">;
3
+ type Toolbar = ReturnType<typeof Toolbar>;
4
+ export default Toolbar;
@@ -0,0 +1,27 @@
1
+ import type { Component } from '../../internal/types.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,124 @@
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
+ --tooltip-color: var(--on, var(--kit-on-surface));
10
+ --tooltip-background: var(--base, var(--kit-surface));
11
+ --tooltip-radius: var(--shape, var(--kit-radius-md));
12
+
13
+ background-color: var(--tooltip-background);
14
+ color: var(--tooltip-color);
15
+ border-radius: var(--tooltip-radius);
16
+ border: 1px solid var(--tooltip-background);
17
+ font-size: 0.875rem;
18
+ display: inline-block;
19
+ width: auto;
20
+ pointer-events: none;
21
+ overflow-wrap: break-word;
22
+ /* transition:
23
+ color 0.5s,
24
+ border-color 0.5s,
25
+ background-color 0.5s; */
26
+ box-shadow: 0px 16px 29px -10px color-mix(in oklab, var(--kit-scrim) 60%, transparent);
27
+ }
28
+
29
+ /* density */
30
+ .kit-tooltip-content[breakpoint]kit-tooltip-content--density-default {
31
+ padding: 0.15rem 0.625rem;
32
+ }
33
+
34
+ .kit-tooltip-content[breakpoint]kit-tooltip-content--density-compact {
35
+ padding: 0.125rem 0.5rem;
36
+ }
37
+
38
+ .kit-tooltip-content[breakpoint]kit-tooltip-content--density-comfortable {
39
+ padding: 0.35rem 0.75rem;
40
+ }
41
+
42
+ .kit-tooltip-content--arrow::after {
43
+ content: ' ';
44
+ position: absolute;
45
+ border-style: solid;
46
+ }
47
+
48
+ .kit-tooltip-content--arrow.kit-tooltip-content--bottom::after,
49
+ .kit-tooltip-content--arrow.kit-tooltip-content--top::after {
50
+ left: 50%;
51
+ margin-left: -0.35rem;
52
+ border-width: 0.35rem;
53
+ }
54
+
55
+ .kit-tooltip-content--arrow.kit-tooltip-content--bottom::after {
56
+ bottom: 100%;
57
+ border-color: transparent transparent var(--tooltip-background) transparent;
58
+ }
59
+
60
+ .kit-tooltip-content--arrow.kit-tooltip-content--top::after {
61
+ top: 100%;
62
+ border-color: var(--tooltip-background) transparent transparent transparent;
63
+ }
64
+
65
+ .kit-tooltip-content--arrow.kit-tooltip-content--left::after,
66
+ .kit-tooltip-content--arrow.kit-tooltip-content--right::after {
67
+ top: 50%;
68
+ margin-top: -0.35rem;
69
+ border-width: 0.35rem;
70
+ }
71
+
72
+ .kit-tooltip-content--arrow.kit-tooltip-content--right::after {
73
+ right: 100%;
74
+ border-color: transparent var(--tooltip-background) transparent transparent;
75
+ }
76
+
77
+ .kit-tooltip-content--arrow.kit-tooltip-content--left::after {
78
+ left: 100%;
79
+ border-color: transparent transparent transparent var(--tooltip-background);
80
+ }
81
+
82
+ .kit-tooltip-content--top,
83
+ .kit-tooltip-content--bottom,
84
+ .kit-tooltip-content--right,
85
+ .kit-tooltip-content--left {
86
+ animation-duration: 150ms;
87
+ animation-name: enter;
88
+ }
89
+
90
+ .kit-tooltip-content--top {
91
+ --animate-enter-pos1: 0;
92
+ --animate-enter-pos2: 0.5rem;
93
+ --animate-enter-pos3: 0;
94
+ }
95
+
96
+ .kit-tooltip-content--bottom {
97
+ --animate-enter-pos1: 0;
98
+ --animate-enter-pos2: -0.5rem;
99
+ --animate-enter-pos3: 0;
100
+ }
101
+
102
+ .kit-tooltip-content--right {
103
+ --animate-enter-pos1: -0.5rem;
104
+ --animate-enter-pos2: 0;
105
+ --animate-enter-pos3: 0;
106
+ }
107
+
108
+ .kit-tooltip-content--left {
109
+ --animate-enter-pos1: 0.5rem;
110
+ --animate-enter-pos2: 0;
111
+ --animate-enter-pos3: 0;
112
+ }
113
+
114
+ @keyframes enter {
115
+ 0% {
116
+ opacity: 0;
117
+ transform: translate3d(
118
+ var(--animate-enter-pos1),
119
+ var(--animate-enter-pos2),
120
+ var(--animate-enter-pos3)
121
+ )
122
+ scale3d(0.95, 0.95, 0.95) rotate(0);
123
+ }
124
+ }
@@ -0,0 +1,113 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/assets.svelte.js';
3
+ import { getPositionsTooltip } from './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:--base={assets.color(background)}
103
+ style:--on={assets.color(color)}
104
+ style:--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,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 {};
@@ -4,4 +4,5 @@ export declare function getAssets(): {
4
4
  [key: string]: string;
5
5
  }): string | undefined;
6
6
  color(color?: string): string | undefined;
7
+ unit(value?: string | number): string | undefined;
7
8
  };
@@ -34,8 +34,21 @@ export function getAssets() {
34
34
  color.includes('oklch') ||
35
35
  x11ColorNames.includes(color.toLowerCase()))
36
36
  return color;
37
+ if (color.includes('transparent') || color.includes('inherit') || color.includes('initial'))
38
+ return color;
37
39
  return `var(--kit-${color})`;
38
40
  }
41
+ },
42
+ unit(value) {
43
+ if (typeof value === 'number')
44
+ return `${value}px`;
45
+ if (typeof value === 'string') {
46
+ const cleaned = value.trim();
47
+ const isOnlyNumericLike = /^[\d.,]+$/.test(cleaned);
48
+ if (isOnlyNumericLike)
49
+ return `${value}px`;
50
+ }
51
+ return value;
39
52
  }
40
53
  };
41
54
  }
@@ -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
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './terminal.js';
2
2
  export * from './ansi.js';
3
3
  export * from './assets.svelte.js';
4
+ export * from './scroll.js';
@@ -1,3 +1,4 @@
1
1
  export * from './terminal.js';
2
2
  export * from './ansi.js';
3
3
  export * from './assets.svelte.js';
4
+ export * from './scroll.js';
@@ -0,0 +1,12 @@
1
+ interface RippleOptions {
2
+ component?: string;
3
+ center?: boolean;
4
+ color?: string;
5
+ duration?: number;
6
+ disabled?: boolean;
7
+ }
8
+ export declare function ripple(el: HTMLElement, options?: RippleOptions): {
9
+ destroy(): void;
10
+ update(newOptions: RippleOptions): void;
11
+ };
12
+ export {};
@@ -0,0 +1,93 @@
1
+ const triggerEvents = ['pointerdown', 'touchstart', 'keydown'];
2
+ const cancelEvents = ['mouseleave', 'dragleave', 'touchmove', 'touchcancel', 'pointerup', 'keyup'];
3
+ export function ripple(el, options = {}) {
4
+ const rippleContainer = document.createElement('div');
5
+ addClasses();
6
+ setOptions(options);
7
+ function addClasses(center) {
8
+ const shouldBeCentered = center || options.center;
9
+ if (!rippleContainer.classList.contains('kit-ripple--effect')) {
10
+ rippleContainer.classList.add('kit-ripple--effect');
11
+ }
12
+ if (!shouldBeCentered && rippleContainer.classList.contains('kit-ripple--center')) {
13
+ rippleContainer.classList.remove('kit-ripple--center');
14
+ }
15
+ if (shouldBeCentered) {
16
+ rippleContainer.classList.add('kit-ripple--center');
17
+ }
18
+ }
19
+ function setOptions(options) {
20
+ if (options.disabled || el.hasAttribute('aria-disabled')) {
21
+ rippleContainer.remove();
22
+ }
23
+ else {
24
+ el.appendChild(rippleContainer);
25
+ }
26
+ if (options.duration && options.duration < 0) {
27
+ options.duration = undefined;
28
+ }
29
+ if (options.component) {
30
+ rippleContainer.style.setProperty('--ripple-radius', `var(--${options.component}-radius)`);
31
+ }
32
+ if (options.color) {
33
+ rippleContainer.style.setProperty('--ripple-color', options.color);
34
+ }
35
+ if (options.duration) {
36
+ rippleContainer.style.setProperty('--ripple-duration', `${options.duration}ms`);
37
+ }
38
+ }
39
+ function createRipple(e, center) {
40
+ if (options.disabled || el.hasAttribute('aria-disabled')) {
41
+ return;
42
+ }
43
+ if (e instanceof KeyboardEvent) {
44
+ if (!['Enter', 'Space'].includes(e.code) || e.repeat) {
45
+ return;
46
+ }
47
+ e.preventDefault();
48
+ const click = new PointerEvent('pointerdown');
49
+ createRipple(click, true);
50
+ return;
51
+ }
52
+ addClasses(center);
53
+ const rect = el.getBoundingClientRect();
54
+ const clientX = window.TouchEvent && e instanceof TouchEvent
55
+ ? e.touches[0].clientX
56
+ : e.clientX;
57
+ const clientY = window.TouchEvent && e instanceof TouchEvent
58
+ ? e.touches[0].clientY
59
+ : e.clientY;
60
+ const x = clientX - rect.left > el.offsetWidth / 2 ? 0 : el.offsetWidth;
61
+ const y = clientY - rect.top > el.offsetHeight / 2 ? 0 : el.offsetHeight;
62
+ const radius = Math.hypot(x - (clientX - rect.left), y - (clientY - rect.top));
63
+ const ripple = document.createElement('div');
64
+ ripple.classList.add('kit-ripple');
65
+ ripple.style.left = `${clientX - rect.left - radius}px`;
66
+ ripple.style.top = `${clientY - rect.top - radius}px`;
67
+ ripple.style.width = ripple.style.height = `${radius * 2}px`;
68
+ rippleContainer.appendChild(ripple);
69
+ function removeRipple() {
70
+ if (ripple === null) {
71
+ return;
72
+ }
73
+ ripple.style.opacity = '0';
74
+ setTimeout(() => {
75
+ ripple.remove();
76
+ }, options.duration || 1000);
77
+ cancelEvents.forEach((event) => el.removeEventListener(event, removeRipple));
78
+ }
79
+ cancelEvents.forEach((event) => el.addEventListener(event, removeRipple, { passive: true }));
80
+ }
81
+ triggerEvents.forEach((event) => el.addEventListener(event, createRipple, { passive: event === 'touchstart' }));
82
+ return {
83
+ destroy() {
84
+ triggerEvents.forEach((event) => {
85
+ el.removeEventListener(event, createRipple);
86
+ });
87
+ },
88
+ update(newOptions) {
89
+ options = newOptions;
90
+ setOptions(newOptions);
91
+ }
92
+ };
93
+ }
@@ -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 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
+ };
package/dist/preset.js CHANGED
@@ -4,7 +4,7 @@ export const config = {
4
4
  minify: false // true | false
5
5
  },
6
6
  theme: {
7
- colorScheme: 'dark', // 'light' | 'dark' | 'auto'
7
+ colorScheme: 'system', // 'light' | 'dark' | 'system'
8
8
  colors: {
9
9
  primary: { light: 'oklch(45% 0.24 277.023)', dark: 'oklch(45% 0.24 277.023)' },
10
10
  'on-primary': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
@@ -35,7 +35,7 @@ export const config = {
35
35
  breakpoints: {
36
36
  mobileBreakpoint: 'sm',
37
37
  tabletBreakpoint: 'md',
38
- laptopBreakpoint: 'xl',
38
+ laptopBreakpoint: 'lg',
39
39
  thresholds: {
40
40
  _default: 0, // 0px
41
41
  xs: '28rem', //448px