lapikit 0.0.0-insiders.dcdfb82 → 0.0.0-insiders.dd024f5

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 (210) hide show
  1. package/LICENSE +21 -0
  2. package/bin/configuration.js +304 -0
  3. package/bin/helper.js +64 -32
  4. package/bin/index.js +41 -0
  5. package/bin/lapikit.js +42 -10
  6. package/bin/legacy.js +34 -0
  7. package/bin/modules/adapter.js +5 -5
  8. package/bin/modules/plugin.js +223 -0
  9. package/bin/presets.js +26 -0
  10. package/bin/prompts.js +100 -0
  11. package/dist/actions/index.d.ts +1 -0
  12. package/dist/actions/index.js +1 -0
  13. package/dist/assets/icons/arrow-down.svelte +12 -0
  14. package/dist/assets/icons/arrow-down.svelte.d.ts +18 -0
  15. package/dist/assets/icons/arrow-up.svelte +12 -0
  16. package/dist/assets/icons/arrow-up.svelte.d.ts +18 -0
  17. package/dist/assets/icons/close-fill.svelte +12 -0
  18. package/dist/assets/icons/close-fill.svelte.d.ts +18 -0
  19. package/dist/assets/icons/loading-fill.svelte +31 -0
  20. package/dist/assets/icons/loading-fill.svelte.d.ts +18 -0
  21. package/dist/colors.css +0 -0
  22. package/dist/components/accordion/accordion.css +113 -0
  23. package/dist/components/accordion/accordion.svelte +155 -0
  24. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  25. package/dist/components/accordion/accordion.svelte.js +24 -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 +137 -0
  31. package/dist/components/alert/alert.svelte +211 -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 +16 -0
  36. package/dist/components/app/app.svelte +66 -0
  37. package/dist/components/app/app.svelte.d.ts +7 -0
  38. package/dist/components/app/types.d.ts +4 -0
  39. package/dist/components/app/types.js +1 -0
  40. package/dist/components/appbar/appbar.css +48 -0
  41. package/dist/components/appbar/appbar.svelte +85 -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 +66 -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 +109 -0
  51. package/dist/components/avatar/avatar.svelte +160 -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 +247 -0
  56. package/dist/components/button/button.svelte +332 -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 +115 -0
  61. package/dist/components/card/card.svelte +171 -0
  62. package/dist/components/card/card.svelte.d.ts +4 -0
  63. package/dist/components/card/types.d.ts +18 -0
  64. package/dist/components/card/types.js +1 -0
  65. package/dist/components/chip/chip.css +231 -0
  66. package/dist/components/chip/chip.svelte +342 -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 +136 -0
  71. package/dist/components/dialog/dialog.svelte +211 -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 +22 -0
  76. package/dist/components/dropdown/dropdown.svelte +140 -0
  77. package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
  78. package/dist/components/dropdown/dropdown.svelte.js +148 -0
  79. package/dist/components/dropdown/types.d.ts +26 -0
  80. package/dist/components/dropdown/types.js +1 -0
  81. package/dist/components/icon/icon.css +81 -0
  82. package/dist/components/icon/icon.svelte +138 -0
  83. package/dist/components/icon/icon.svelte.d.ts +4 -0
  84. package/dist/components/icon/types.d.ts +16 -0
  85. package/dist/components/icon/types.js +1 -0
  86. package/dist/components/index.d.ts +22 -0
  87. package/dist/components/index.js +23 -0
  88. package/dist/components/list/list.css +221 -0
  89. package/dist/components/list/list.svelte +243 -0
  90. package/dist/components/list/list.svelte.d.ts +4 -0
  91. package/dist/components/list/modules/list-item.svelte +275 -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 +145 -0
  96. package/dist/components/modal/modal.svelte +248 -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 +22 -0
  101. package/dist/components/popover/popover.svelte +97 -0
  102. package/dist/components/popover/popover.svelte.d.ts +4 -0
  103. package/dist/components/popover/popover.svelte.js +134 -0
  104. package/dist/components/popover/types.d.ts +20 -0
  105. package/dist/components/popover/types.js +1 -0
  106. package/dist/components/separator/separator.css +46 -0
  107. package/dist/components/separator/separator.svelte +85 -0
  108. package/dist/components/separator/separator.svelte.d.ts +4 -0
  109. package/dist/components/separator/types.d.ts +11 -0
  110. package/dist/components/separator/types.js +1 -0
  111. package/dist/components/spacer/spacer.css +3 -0
  112. package/dist/components/spacer/spacer.svelte +12 -0
  113. package/dist/components/spacer/spacer.svelte.d.ts +4 -0
  114. package/dist/components/spacer/types.d.ts +4 -0
  115. package/dist/components/spacer/types.js +1 -0
  116. package/dist/components/textfield/textfield.css +305 -0
  117. package/dist/components/textfield/textfield.svelte +463 -0
  118. package/dist/components/textfield/textfield.svelte.d.ts +4 -0
  119. package/dist/components/textfield/types.d.ts +37 -0
  120. package/dist/components/textfield/types.js +1 -0
  121. package/dist/components/toolbar/toolbar.css +129 -0
  122. package/dist/components/toolbar/toolbar.svelte +182 -0
  123. package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
  124. package/dist/components/toolbar/types.d.ts +27 -0
  125. package/dist/components/toolbar/types.js +1 -0
  126. package/dist/components/tooltip/tooltip.css +124 -0
  127. package/dist/components/tooltip/tooltip.svelte +240 -0
  128. package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
  129. package/dist/components/tooltip/tooltip.svelte.js +131 -0
  130. package/dist/components/tooltip/types.d.ts +23 -0
  131. package/dist/components/tooltip/types.js +1 -0
  132. package/dist/index.d.ts +27 -1
  133. package/dist/index.js +27 -3
  134. package/dist/internal/assets.svelte.d.ts +8 -0
  135. package/dist/internal/assets.svelte.js +54 -0
  136. package/dist/internal/clickOutside.d.ts +9 -0
  137. package/dist/internal/clickOutside.js +34 -0
  138. package/dist/internal/config/presets.d.ts +136 -0
  139. package/dist/internal/config/presets.js +121 -0
  140. package/dist/internal/config/variables.d.ts +20 -0
  141. package/dist/internal/config/variables.js +20 -0
  142. package/dist/internal/core/formatter/component.d.ts +5 -0
  143. package/dist/internal/core/formatter/component.js +63 -0
  144. package/dist/internal/core/formatter/index.d.ts +6 -0
  145. package/dist/internal/core/formatter/index.js +30 -0
  146. package/dist/internal/core/formatter/styles.d.ts +4 -0
  147. package/dist/internal/core/formatter/styles.js +16 -0
  148. package/dist/internal/core/formatter/theme.d.ts +5 -0
  149. package/dist/internal/core/formatter/theme.js +20 -0
  150. package/dist/internal/core/formatter/typography.d.ts +5 -0
  151. package/dist/internal/core/formatter/typography.js +12 -0
  152. package/dist/internal/deepMerge.d.ts +44 -0
  153. package/dist/internal/deepMerge.js +80 -0
  154. package/dist/internal/helpers/parser.d.ts +10 -0
  155. package/dist/internal/helpers/parser.js +92 -0
  156. package/dist/internal/index.d.ts +2 -0
  157. package/dist/internal/index.js +2 -0
  158. package/dist/internal/plugins/vite.d.ts +8 -0
  159. package/dist/internal/plugins/vite.js +25 -0
  160. package/dist/internal/ripple.d.ts +12 -0
  161. package/dist/internal/ripple.js +93 -0
  162. package/dist/internal/scroll.d.ts +1 -0
  163. package/dist/internal/scroll.js +6 -0
  164. package/dist/internal/types/configuration.d.ts +40 -0
  165. package/dist/internal/types/configuration.js +1 -0
  166. package/dist/internal/types/index.d.ts +1 -0
  167. package/dist/internal/types/index.js +1 -0
  168. package/dist/internal/types.d.ts +13 -0
  169. package/dist/internal/unit.d.ts +1 -0
  170. package/dist/internal/unit.js +11 -0
  171. package/dist/labs/index.d.ts +4 -0
  172. package/dist/labs/index.js +5 -0
  173. package/dist/labs/my-component-style-global.svelte +6 -0
  174. package/dist/labs/my-component-style-global.svelte.d.ts +18 -0
  175. package/dist/labs/my-component-style-import.svelte +15 -0
  176. package/dist/labs/my-component-style-import.svelte.d.ts +18 -0
  177. package/dist/labs/my-component-style-mixed.svelte +23 -0
  178. package/dist/labs/my-component-style-mixed.svelte.d.ts +18 -0
  179. package/dist/labs/my-component.svelte +16 -0
  180. package/dist/labs/my-component.svelte.d.ts +18 -0
  181. package/dist/labs/style-mixed.css +7 -0
  182. package/dist/labs/style.css +7 -0
  183. package/dist/labs.css +25 -0
  184. package/dist/plugin/css.d.ts +1 -0
  185. package/dist/plugin/css.js +73 -0
  186. package/dist/plugin/preset-v2.d.ts +108 -0
  187. package/dist/plugin/preset-v2.js +126 -0
  188. package/dist/plugin/vitejs.d.ts +5 -1
  189. package/dist/plugin/vitejs.js +32 -3
  190. package/dist/preset.js +16 -4
  191. package/dist/stores/breakpoints.d.ts +6 -0
  192. package/dist/stores/breakpoints.js +14 -0
  193. package/dist/stores/components.d.ts +8 -0
  194. package/dist/stores/components.js +26 -0
  195. package/dist/stores/devices.d.ts +6 -0
  196. package/dist/stores/devices.js +9 -0
  197. package/dist/stores/index.d.ts +4 -0
  198. package/dist/stores/index.js +4 -0
  199. package/dist/stores/themes.d.ts +8 -0
  200. package/dist/stores/themes.js +34 -0
  201. package/dist/style/animation.css +62 -0
  202. package/dist/style/css.js +6 -3
  203. package/dist/style/normalize.css +2 -0
  204. package/dist/style/parser/color.js +15 -4
  205. package/dist/style/parser/device.js +31 -19
  206. package/dist/style/variable.css +12 -0
  207. package/dist/utils/convert.d.ts +1 -0
  208. package/dist/utils/convert.js +17 -0
  209. package/dist/utils/x11.d.ts +1 -1
  210. package/package.json +29 -4
@@ -0,0 +1,182 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/index.js';
3
+ import type { ToolbarProps } from './types.js';
4
+
5
+ let {
6
+ children,
7
+ ref = $bindable(),
8
+ is = 'div',
9
+ classContent,
10
+ light,
11
+ dark,
12
+ variant,
13
+ rounded,
14
+ background,
15
+ color,
16
+ density = 'default',
17
+ orientation = 'horizontal',
18
+ location,
19
+ ...rest
20
+ }: ToolbarProps = $props();
21
+
22
+ const assets = getAssets();
23
+ </script>
24
+
25
+ <svelte:element
26
+ this={is}
27
+ bind:this={ref}
28
+ {...rest}
29
+ role="toolbar"
30
+ class={[
31
+ 'kit-toolbar',
32
+ light && 'light',
33
+ dark && 'dark',
34
+ variant && assets.className('toolbar', 'variant', variant),
35
+ density && assets.className('toolbar', 'density', density),
36
+ orientation && assets.className('toolbar', 'orientation', orientation),
37
+ location && assets.className('toolbar', 'location', location),
38
+ rest.class
39
+ ]}
40
+ style:--base={assets.color(background)}
41
+ style:--on={assets.color(color)}
42
+ style:--shape={assets.shape(rounded)}
43
+ >
44
+ <div class={['kit-toolbar--wrapper', classContent]}>
45
+ {@render children?.()}
46
+ </div>
47
+ </svelte:element>
48
+
49
+ <style>.kit-toolbar {
50
+ --toolbar-color: var(--on, var(--kit-on-surface));
51
+ --toolbar-background: var(--base, var(--kit-surface));
52
+ --toolbar-radius: var(--shape, var(--kit-radius-md));
53
+
54
+ display: flex;
55
+ align-items: center;
56
+ /* min-width: max-content; */
57
+ border-style: solid;
58
+ /* transition:
59
+ color 0.5s,
60
+ border-color 0.5s,
61
+ background-color 0.5s; */
62
+
63
+ border-width: 1px;
64
+ border-style: solid;
65
+ border-radius: var(--toolbar-radius);
66
+
67
+ /* theme */
68
+ color: var(--toolbar-color);
69
+ background-color: var(--toolbar-background);
70
+ border-color: var(--toolbar-background);
71
+ }
72
+
73
+ /* density */
74
+
75
+ .kit-toolbar[breakpoint]kit-toolbar--density-default {
76
+ border-radius: calc(var(--prism-spacing) * 2.25);
77
+ }
78
+
79
+ .kit-toolbar[breakpoint]kit-toolbar--density-default:not([class*='toolbar--orientation-vertical']) {
80
+ height: 3rem;
81
+ padding-inline: calc(var(--prism-spacing) * 1.5);
82
+ }
83
+
84
+ .kit-toolbar[breakpoint]kit-toolbar--density-default[class*='toolbar--orientation-vertical'] {
85
+ width: 3rem;
86
+ padding: calc(var(--prism-spacing) * 1.5) 0;
87
+ }
88
+
89
+ .kit-toolbar[breakpoint]kit-toolbar--density-compact {
90
+ border-radius: calc(var(--prism-spacing) * 1.75);
91
+ }
92
+
93
+ .kit-toolbar[breakpoint]kit-toolbar--density-compact:not([class*='toolbar--orientation-vertical']) {
94
+ height: 2.625rem;
95
+ padding-inline: calc(var(--prism-spacing) * 0.75);
96
+ }
97
+
98
+ .kit-toolbar[breakpoint]kit-toolbar--density-compact[class*='toolbar--orientation-vertical'] {
99
+ width: 2.625rem;
100
+ padding: calc(var(--prism-spacing) * 0.75) 0;
101
+ }
102
+
103
+ .kit-toolbar[breakpoint]kit-toolbar--density-comfortable {
104
+ border-radius: calc(var(--prism-spacing) * 3.5);
105
+ }
106
+
107
+ .kit-toolbar[breakpoint]kit-toolbar--density-comfortable:not(
108
+ [class*='toolbar--orientation-vertical']
109
+ ) {
110
+ height: 3.5rem;
111
+ padding-inline: calc(var(--prism-spacing) * 2.25);
112
+ }
113
+
114
+ .kit-toolbar[breakpoint]kit-toolbar--density-comfortable[class*='toolbar--orientation-vertical'] {
115
+ width: 3.5rem;
116
+ padding: calc(var(--prism-spacing) * 2.25) 0;
117
+ }
118
+
119
+ .kit-toolbar[breakpoint]kit-toolbar--variant-text,
120
+ .kit-toolbar[breakpoint]kit-toolbar--variant-outline,
121
+ .kit-toolbar[breakpoint]kit-toolbar--variant-dash {
122
+ --toolbar-color: var(--base, var(--kit-surface));
123
+ background-color: transparent;
124
+ }
125
+
126
+ .kit-toolbar[breakpoint]kit-toolbar--variant-outline {
127
+ border-color: currentColor;
128
+ }
129
+
130
+ .kit-toolbar[breakpoint]kit-toolbar--variant-dash {
131
+ border-style: dashed;
132
+ border-color: currentColor;
133
+ }
134
+
135
+ .kit-toolbar[breakpoint]kit-toolbar--orientation-horizontal {
136
+ flex-direction: row;
137
+ width: 100%;
138
+ }
139
+
140
+ .kit-toolbar[breakpoint]kit-toolbar--orientation-vertical {
141
+ flex-direction: column;
142
+ min-height: fit-content;
143
+ width: fit-content;
144
+ }
145
+
146
+ /* wrapper */
147
+
148
+ .kit-toolbar .kit-toolbar--wrapper {
149
+ display: flex;
150
+ align-items: center;
151
+ /* margin-left: auto;
152
+ margin-right: auto; */
153
+ flex-direction: row;
154
+ height: auto;
155
+ width: 100%;
156
+ }
157
+
158
+ .kit-toolbar[breakpoint]kit-toolbar--orientation-vertical .kit-toolbar--wrapper {
159
+ flex-direction: column;
160
+ height: 100%;
161
+ }
162
+
163
+ /* location */
164
+
165
+ .kit-toolbar[breakpoint]kit-toolbar--location-top {
166
+ top: 0px;
167
+ z-index: 1004;
168
+ transform: translateY(0px);
169
+ position: fixed;
170
+ left: 0px;
171
+ width: calc(100% + 0px);
172
+ }
173
+
174
+ .kit-toolbar[breakpoint]kit-toolbar--location-bottom {
175
+ z-index: 1004;
176
+ transform: translateY(0px);
177
+ position: fixed;
178
+ left: 0px;
179
+ width: calc(100% + 0px);
180
+ bottom: 0px;
181
+ }
182
+ </style>
@@ -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,240 @@
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}
114
+
115
+ <style>.kit-tooltip {
116
+ inset: 0px auto auto 0px;
117
+ margin: 0px;
118
+ position: fixed;
119
+ z-index: 2000;
120
+ }
121
+
122
+ .kit-tooltip-content {
123
+ --tooltip-color: var(--on, var(--kit-on-surface));
124
+ --tooltip-background: var(--base, var(--kit-surface));
125
+ --tooltip-radius: var(--shape, var(--kit-radius-md));
126
+
127
+ background-color: var(--tooltip-background);
128
+ color: var(--tooltip-color);
129
+ border-radius: var(--tooltip-radius);
130
+ border: 1px solid var(--tooltip-background);
131
+ font-size: 0.875rem;
132
+ display: inline-block;
133
+ width: auto;
134
+ pointer-events: none;
135
+ overflow-wrap: break-word;
136
+ /* transition:
137
+ color 0.5s,
138
+ border-color 0.5s,
139
+ background-color 0.5s; */
140
+ box-shadow: 0px 16px 29px -10px color-mix(in oklab, var(--kit-scrim) 60%, transparent);
141
+ }
142
+
143
+ /* density */
144
+
145
+ .kit-tooltip-content[breakpoint]kit-tooltip-content--density-default {
146
+ padding: 0.15rem 0.625rem;
147
+ }
148
+
149
+ .kit-tooltip-content[breakpoint]kit-tooltip-content--density-compact {
150
+ padding: 0.125rem 0.5rem;
151
+ }
152
+
153
+ .kit-tooltip-content[breakpoint]kit-tooltip-content--density-comfortable {
154
+ padding: 0.35rem 0.75rem;
155
+ }
156
+
157
+ .kit-tooltip-content--arrow::after {
158
+ content: ' ';
159
+ position: absolute;
160
+ border-style: solid;
161
+ }
162
+
163
+ .kit-tooltip-content--arrow.kit-tooltip-content--bottom::after,
164
+ .kit-tooltip-content--arrow.kit-tooltip-content--top::after {
165
+ left: 50%;
166
+ margin-left: -0.35rem;
167
+ border-width: 0.35rem;
168
+ }
169
+
170
+ .kit-tooltip-content--arrow.kit-tooltip-content--bottom::after {
171
+ bottom: 100%;
172
+ border-color: transparent transparent var(--tooltip-background) transparent;
173
+ }
174
+
175
+ .kit-tooltip-content--arrow.kit-tooltip-content--top::after {
176
+ top: 100%;
177
+ border-color: var(--tooltip-background) transparent transparent transparent;
178
+ }
179
+
180
+ .kit-tooltip-content--arrow.kit-tooltip-content--left::after,
181
+ .kit-tooltip-content--arrow.kit-tooltip-content--right::after {
182
+ top: 50%;
183
+ margin-top: -0.35rem;
184
+ border-width: 0.35rem;
185
+ }
186
+
187
+ .kit-tooltip-content--arrow.kit-tooltip-content--right::after {
188
+ right: 100%;
189
+ border-color: transparent var(--tooltip-background) transparent transparent;
190
+ }
191
+
192
+ .kit-tooltip-content--arrow.kit-tooltip-content--left::after {
193
+ left: 100%;
194
+ border-color: transparent transparent transparent var(--tooltip-background);
195
+ }
196
+
197
+ .kit-tooltip-content--top,
198
+ .kit-tooltip-content--bottom,
199
+ .kit-tooltip-content--right,
200
+ .kit-tooltip-content--left {
201
+ animation-duration: 150ms;
202
+ animation-name: enter;
203
+ }
204
+
205
+ .kit-tooltip-content--top {
206
+ --animate-enter-pos1: 0;
207
+ --animate-enter-pos2: 0.5rem;
208
+ --animate-enter-pos3: 0;
209
+ }
210
+
211
+ .kit-tooltip-content--bottom {
212
+ --animate-enter-pos1: 0;
213
+ --animate-enter-pos2: -0.5rem;
214
+ --animate-enter-pos3: 0;
215
+ }
216
+
217
+ .kit-tooltip-content--right {
218
+ --animate-enter-pos1: -0.5rem;
219
+ --animate-enter-pos2: 0;
220
+ --animate-enter-pos3: 0;
221
+ }
222
+
223
+ .kit-tooltip-content--left {
224
+ --animate-enter-pos1: 0.5rem;
225
+ --animate-enter-pos2: 0;
226
+ --animate-enter-pos3: 0;
227
+ }
228
+
229
+ @keyframes enter {
230
+ 0% {
231
+ opacity: 0;
232
+ transform: translate3d(
233
+ var(--animate-enter-pos1),
234
+ var(--animate-enter-pos2),
235
+ var(--animate-enter-pos3)
236
+ )
237
+ scale3d(0.95, 0.95, 0.95) rotate(0);
238
+ }
239
+ }
240
+ </style>
@@ -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;