lapikit 0.0.0-insiders.e877f7f → 0.0.0-insiders.ee9a471

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 (186) hide show
  1. package/bin/configuration.js +304 -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 +26 -0
  9. package/bin/prompts.js +100 -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 +2 -0
  19. package/dist/assets/icons/loading-fill.svelte.d.ts +6 -14
  20. package/dist/colors.css +0 -0
  21. package/dist/components/accordion/accordion.css +113 -0
  22. package/dist/components/accordion/accordion.svelte +155 -0
  23. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  24. package/dist/components/accordion/accordion.svelte.js +24 -0
  25. package/dist/components/accordion/modules/accordion-item.svelte +94 -0
  26. package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
  27. package/dist/components/accordion/types.d.ts +33 -0
  28. package/dist/components/accordion/types.js +1 -0
  29. package/dist/components/alert/alert.css +137 -0
  30. package/dist/components/alert/alert.svelte +211 -0
  31. package/dist/components/alert/alert.svelte.d.ts +4 -0
  32. package/dist/components/alert/types.d.ts +28 -0
  33. package/dist/components/alert/types.js +1 -0
  34. package/dist/components/app/app.css +16 -0
  35. package/dist/components/app/app.svelte +55 -3
  36. package/dist/components/appbar/appbar.css +48 -0
  37. package/dist/components/appbar/appbar.svelte +85 -0
  38. package/dist/components/appbar/appbar.svelte.d.ts +4 -0
  39. package/dist/components/appbar/types.d.ts +15 -0
  40. package/dist/components/appbar/types.js +1 -0
  41. package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
  42. package/dist/components/aspect-ratio/aspect-ratio.svelte +66 -0
  43. package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
  44. package/dist/components/aspect-ratio/types.d.ts +5 -0
  45. package/dist/components/aspect-ratio/types.js +1 -0
  46. package/dist/components/avatar/avatar.css +109 -0
  47. package/dist/components/avatar/avatar.svelte +160 -0
  48. package/dist/components/avatar/avatar.svelte.d.ts +4 -0
  49. package/dist/components/avatar/types.d.ts +22 -0
  50. package/dist/components/avatar/types.js +1 -0
  51. package/dist/components/button/button.css +165 -194
  52. package/dist/components/button/button.svelte +269 -31
  53. package/dist/components/button/button.svelte.d.ts +2 -2
  54. package/dist/components/button/types.d.ts +7 -5
  55. package/dist/components/card/card.css +115 -0
  56. package/dist/components/card/card.svelte +171 -0
  57. package/dist/components/card/card.svelte.d.ts +4 -0
  58. package/dist/components/card/types.d.ts +18 -0
  59. package/dist/components/card/types.js +1 -0
  60. package/dist/components/chip/chip.css +231 -0
  61. package/dist/components/chip/chip.svelte +342 -0
  62. package/dist/components/chip/chip.svelte.d.ts +4 -0
  63. package/dist/components/chip/types.d.ts +32 -0
  64. package/dist/components/chip/types.js +1 -0
  65. package/dist/components/dialog/dialog.css +136 -0
  66. package/dist/components/dialog/dialog.svelte +211 -0
  67. package/dist/components/dialog/dialog.svelte.d.ts +4 -0
  68. package/dist/components/dialog/types.d.ts +24 -0
  69. package/dist/components/dialog/types.js +1 -0
  70. package/dist/components/dropdown/dropdown.css +4 -4
  71. package/dist/components/dropdown/dropdown.svelte +24 -0
  72. package/dist/components/icon/icon.css +16 -11
  73. package/dist/components/icon/icon.svelte +89 -0
  74. package/dist/components/index.d.ts +17 -1
  75. package/dist/components/index.js +17 -1
  76. package/dist/components/list/list.css +221 -0
  77. package/dist/components/list/list.svelte +243 -0
  78. package/dist/components/list/list.svelte.d.ts +4 -0
  79. package/dist/components/list/modules/list-item.svelte +275 -0
  80. package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
  81. package/dist/components/list/types.d.ts +33 -0
  82. package/dist/components/list/types.js +1 -0
  83. package/dist/components/modal/modal.css +145 -0
  84. package/dist/components/modal/modal.svelte +248 -0
  85. package/dist/components/modal/modal.svelte.d.ts +4 -0
  86. package/dist/components/modal/types.d.ts +26 -0
  87. package/dist/components/modal/types.js +1 -0
  88. package/dist/components/popover/popover.css +4 -4
  89. package/dist/components/popover/popover.svelte +24 -0
  90. package/dist/components/separator/separator.css +46 -0
  91. package/dist/components/separator/separator.svelte +85 -0
  92. package/dist/components/separator/separator.svelte.d.ts +4 -0
  93. package/dist/components/separator/types.d.ts +11 -0
  94. package/dist/components/separator/types.js +1 -0
  95. package/dist/components/spacer/spacer.css +3 -0
  96. package/dist/components/spacer/spacer.svelte +12 -0
  97. package/dist/components/spacer/spacer.svelte.d.ts +4 -0
  98. package/dist/components/spacer/types.d.ts +4 -0
  99. package/dist/components/spacer/types.js +1 -0
  100. package/dist/components/textfield/textfield.css +305 -0
  101. package/dist/components/textfield/textfield.svelte +463 -0
  102. package/dist/components/textfield/textfield.svelte.d.ts +4 -0
  103. package/dist/components/textfield/types.d.ts +37 -0
  104. package/dist/components/textfield/types.js +1 -0
  105. package/dist/components/toolbar/toolbar.css +129 -0
  106. package/dist/components/toolbar/toolbar.svelte +182 -0
  107. package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
  108. package/dist/components/toolbar/types.d.ts +27 -0
  109. package/dist/components/toolbar/types.js +1 -0
  110. package/dist/components/tooltip/tooltip.css +4 -4
  111. package/dist/components/tooltip/tooltip.svelte +127 -0
  112. package/dist/index.d.ts +27 -1
  113. package/dist/index.js +27 -3
  114. package/dist/internal/assets.svelte.d.ts +1 -0
  115. package/dist/internal/assets.svelte.js +13 -0
  116. package/dist/internal/config/presets.d.ts +136 -0
  117. package/dist/internal/config/presets.js +121 -0
  118. package/dist/internal/config/variables.d.ts +20 -0
  119. package/dist/internal/config/variables.js +20 -0
  120. package/dist/internal/core/formatter/component.d.ts +5 -0
  121. package/dist/internal/core/formatter/component.js +63 -0
  122. package/dist/internal/core/formatter/index.d.ts +6 -0
  123. package/dist/internal/core/formatter/index.js +30 -0
  124. package/dist/internal/core/formatter/styles.d.ts +4 -0
  125. package/dist/internal/core/formatter/styles.js +15 -0
  126. package/dist/internal/core/formatter/theme.d.ts +5 -0
  127. package/dist/internal/core/formatter/theme.js +28 -0
  128. package/dist/internal/core/formatter/typography.d.ts +5 -0
  129. package/dist/internal/core/formatter/typography.js +12 -0
  130. package/dist/internal/deepMerge.d.ts +44 -0
  131. package/dist/internal/deepMerge.js +80 -0
  132. package/dist/internal/helpers/parser.d.ts +10 -0
  133. package/dist/internal/helpers/parser.js +92 -0
  134. package/dist/internal/index.d.ts +1 -0
  135. package/dist/internal/index.js +1 -0
  136. package/dist/internal/plugins/vite.d.ts +8 -0
  137. package/dist/internal/plugins/vite.js +25 -0
  138. package/dist/internal/ripple.d.ts +12 -0
  139. package/dist/internal/ripple.js +93 -0
  140. package/dist/internal/scroll.d.ts +1 -0
  141. package/dist/internal/scroll.js +6 -0
  142. package/dist/internal/types/configuration.d.ts +40 -0
  143. package/dist/internal/types/configuration.js +1 -0
  144. package/dist/internal/types/index.d.ts +1 -0
  145. package/dist/internal/types/index.js +1 -0
  146. package/dist/internal/unit.d.ts +1 -0
  147. package/dist/internal/unit.js +11 -0
  148. package/dist/labs/index.d.ts +4 -0
  149. package/dist/labs/index.js +5 -0
  150. package/dist/labs/my-component-style-global.svelte +6 -0
  151. package/dist/labs/my-component-style-global.svelte.d.ts +18 -0
  152. package/dist/labs/my-component-style-import.svelte +15 -0
  153. package/dist/labs/my-component-style-import.svelte.d.ts +18 -0
  154. package/dist/labs/my-component-style-mixed.svelte +23 -0
  155. package/dist/labs/my-component-style-mixed.svelte.d.ts +18 -0
  156. package/dist/labs/my-component.svelte +16 -0
  157. package/dist/labs/my-component.svelte.d.ts +18 -0
  158. package/dist/labs/style-mixed.css +7 -0
  159. package/dist/labs/style.css +7 -0
  160. package/dist/labs.css +25 -0
  161. package/dist/plugin/css.d.ts +1 -0
  162. package/dist/plugin/css.js +73 -0
  163. package/dist/plugin/preset-v2.d.ts +108 -0
  164. package/dist/plugin/preset-v2.js +126 -0
  165. package/dist/plugin/vitejs.d.ts +5 -1
  166. package/dist/plugin/vitejs.js +32 -3
  167. package/dist/preset.js +2 -2
  168. package/dist/stores/breakpoints.d.ts +6 -0
  169. package/dist/stores/breakpoints.js +14 -0
  170. package/dist/stores/components.d.ts +8 -0
  171. package/dist/stores/components.js +26 -0
  172. package/dist/stores/devices.d.ts +6 -0
  173. package/dist/stores/devices.js +9 -0
  174. package/dist/stores/index.d.ts +4 -4
  175. package/dist/stores/index.js +4 -23
  176. package/dist/stores/themes.d.ts +8 -0
  177. package/dist/stores/themes.js +34 -0
  178. package/dist/style/animation.css +42 -0
  179. package/dist/style/css.js +3 -0
  180. package/dist/style/normalize.css +2 -0
  181. package/dist/style/parser/color.js +2 -2
  182. package/dist/style/parser/device.js +31 -19
  183. package/dist/style/variable.css +12 -0
  184. package/dist/utils/convert.d.ts +1 -0
  185. package/dist/utils/convert.js +17 -0
  186. package/package.json +21 -5
@@ -0,0 +1,275 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../../internal/index.js';
3
+ import type { ListItemProps } from '../types.js';
4
+
5
+ // external
6
+ import { ripple } from '../../../internal/ripple.js';
7
+
8
+ let {
9
+ children,
10
+ append,
11
+ prepend,
12
+ ref = $bindable(),
13
+ is = 'div',
14
+ dark,
15
+ light,
16
+ background,
17
+ color,
18
+ rounded,
19
+ disabled,
20
+ active,
21
+ href,
22
+ noRipple,
23
+ ...rest
24
+ }: ListItemProps = $props();
25
+
26
+ const assets = getAssets();
27
+
28
+ $effect(() => {
29
+ const refProps = { ...rest };
30
+ if (refProps?.onclick) is = 'button';
31
+ });
32
+ </script>
33
+
34
+ <svelte:element
35
+ this={href ? 'a' : is}
36
+ bind:this={ref}
37
+ {...rest}
38
+ href={href && !disabled ? href : undefined}
39
+ class={[
40
+ 'kit-list-item',
41
+ light && 'light',
42
+ dark && 'dark',
43
+ append && 'kit-list-item--append',
44
+ prepend && 'kit-list-item--prepend',
45
+ active && 'kit-list-item--active',
46
+ disabled && 'kit-list-item--disabled',
47
+ rest.class
48
+ ]}
49
+ use:ripple={{
50
+ component: 'list-item',
51
+ disabled: noRipple || disabled || is === 'div'
52
+ }}
53
+ role={is === 'button' ? 'listitem' : undefined}
54
+ tabindex={href && disabled ? -2 : 0}
55
+ aria-disabled={href ? disabled : undefined}
56
+ disabled={href ? undefined : disabled}
57
+ style:--base={assets.color(background)}
58
+ style:--on={assets.color(color)}
59
+ style:--shape={assets.shape(rounded)}
60
+ >
61
+ {#if append}
62
+ <div class="kit-list-item-content--append">
63
+ {@render append?.()}
64
+ </div>
65
+ {/if}
66
+
67
+ <div class="kit-list-item-content--content">
68
+ {@render children?.()}
69
+ </div>
70
+
71
+ {#if prepend}
72
+ <div class="kit-list-item-content--prepend">
73
+ {@render prepend?.()}
74
+ </div>
75
+ {/if}
76
+ </svelte:element>
77
+
78
+ <style>/* root */
79
+ .kit-list {
80
+ --list-color: var(--on, var(--kit-on-container));
81
+ --list-background: var(--base, var(--kit-container));
82
+ --list-radius: var(--shape, var(--kit-radius-md));
83
+ }
84
+ .kit-list {
85
+ position: relative;
86
+ flex-direction: column;
87
+ width: 100%;
88
+ display: flex;
89
+ border: none;
90
+ outline: none;
91
+ }
92
+ .kit-list-item {
93
+ --list-item-radius: var(--shape, var(--list-radius, var(--kit-radius-md)));
94
+ }
95
+ .kit-list-item {
96
+ position: relative;
97
+ border: none;
98
+ outline: none;
99
+ padding-top: var(--list-spacing-x);
100
+ padding-bottom: var(--list-spacing-x);
101
+ padding-right: var(--list-spacing-y);
102
+ padding-left: var(--list-spacing-y);
103
+ color: var(--list-item-color);
104
+ border-radius: var(--list-item-radius);
105
+ font-weight: 500;
106
+ text-decoration: none;
107
+ }
108
+ .kit-list-item:not(div) {
109
+ cursor: pointer;
110
+ }
111
+ .kit-list-item,
112
+ .kit-list-item .kit-list-item-content--content,
113
+ .kit-list-item .kit-list-item-content--append,
114
+ .kit-list-item .kit-list-item-content--prepend {
115
+ display: inline-flex;
116
+ align-items: center;
117
+ white-space: nowrap;
118
+ gap: calc(var(--prism-spacing) * var(--list-multiplier-gap));
119
+ font-size: calc(var(--prism-spacing) * var(--list-multiplier-font-size));
120
+ }
121
+ .kit-list-item.kit-list-item--append:not(.kit-list-item--prepend) {
122
+ display: grid;
123
+ grid-template-columns: auto 1fr;
124
+ }
125
+ .kit-list-item.kit-list-item--prepend:not(.kit-list-item--append) {
126
+ display: grid;
127
+ grid-template-columns: 1fr auto;
128
+ }
129
+ .kit-list-item.kit-list-item--prepend.kit-list-item--append {
130
+ display: grid;
131
+ grid-template-columns: auto 1fr auto;
132
+ }
133
+ .kit-list-item::after {
134
+ content: '';
135
+ position: absolute;
136
+ inset: 0;
137
+ background-color: currentColor;
138
+ opacity: 0;
139
+ transition: opacity 150ms ease;
140
+ pointer-events: none;
141
+ border-radius: inherit;
142
+ }
143
+ .kit-list-item:not(div):hover::after {
144
+ opacity: 0.08;
145
+ }
146
+ .kit-list-item:not(div):active::after {
147
+ opacity: 0.12;
148
+ }
149
+ .kit-list-item:not(div):focus-visible::after {
150
+ opacity: 0.12;
151
+ }
152
+ .kit-list.kit-list--nav {
153
+ padding-top: 8px;
154
+ padding-bottom: 8px;
155
+ padding-inline: 8px;
156
+ }
157
+ /* size */
158
+ .kit-list[breakpoint]kit-list--size-xs {
159
+ --list-multiplier-x: 16;
160
+ --list-multiplier-y: 4;
161
+ --list-multiplier-gap: 2;
162
+ --list-multiplier-font-size: 6;
163
+ }
164
+ .kit-list[breakpoint]kit-list--size-xs .kit-icon[class*='kit-icon--size-md'] {
165
+ --icon-multiplier-parent-size: 6;
166
+ }
167
+ .kit-list[breakpoint]kit-list--size-sm {
168
+ --list-multiplier-x: 20;
169
+ --list-multiplier-y: 5;
170
+ --list-multiplier-gap: 4;
171
+ --list-multiplier-font-size: 7;
172
+ }
173
+ .kit-list[breakpoint]kit-list--size-sm .kit-icon[class*='kit-icon--size-md'] {
174
+ --icon-multiplier-parent-size: 7;
175
+ }
176
+ .kit-list[breakpoint]kit-list--size-md {
177
+ --list-multiplier-x: 24;
178
+ --list-multiplier-y: 6;
179
+ --list-multiplier-gap: 4;
180
+ --list-multiplier-font-size: 8;
181
+ }
182
+ .kit-list[breakpoint]kit-list--size-md .kit-icon[class*='kit-icon--size-md'] {
183
+ --icon-multiplier-parent-size: 8;
184
+ }
185
+ .kit-list[breakpoint]kit-list--size-lg {
186
+ --list-multiplier-x: 28;
187
+ --list-multiplier-y: 7;
188
+ --list-multiplier-gap: 4;
189
+ --list-multiplier-font-size: 9;
190
+ }
191
+ .kit-list[breakpoint]kit-list--size-lg .kit-icon[class*='kit-icon--size-md'] {
192
+ --icon-multiplier-parent-size: 9;
193
+ }
194
+ .kit-list[breakpoint]kit-list--size-xl {
195
+ --list-multiplier-x: 32;
196
+ --list-multiplier-y: 8;
197
+ --list-multiplier-gap: 5;
198
+ --list-multiplier-font-size: 10;
199
+ }
200
+ .kit-list[breakpoint]kit-list--size-xl .kit-icon[class*='kit-icon--size-md'] {
201
+ --icon-multiplier-parent-size: 10;
202
+ }
203
+ /* density */
204
+ .kit-list[breakpoint]kit-list--density-default .kit-list-item {
205
+ height: calc(var(--prism-spacing) * var(--list-multiplier-x));
206
+ --list-spacing-x: 0;
207
+ --list-spacing-y: calc(var(--prism-spacing) * var(--list-multiplier-y));
208
+ }
209
+ .kit-list[breakpoint]kit-list--density-compact .kit-list-item {
210
+ height: calc(var(--prism-spacing) * var(--list-multiplier-x) - 0.25rem);
211
+ --list-spacing-x: 0;
212
+ --list-spacing-y: calc(var(--prism-spacing) * var(--list-multiplier-y) - 0.25rem);
213
+ }
214
+ .kit-list[breakpoint]kit-list--density-comfortable .kit-list-item {
215
+ height: calc(var(--prism-spacing) * var(--list-multiplier-x) + 0.25rem);
216
+ --list-spacing-x: 0;
217
+ --list-spacing-y: calc(var(--prism-spacing) * var(--list-multiplier-y) + 0.25rem);
218
+ }
219
+ /* variant */
220
+ .kit-list[breakpoint]kit-list--variant-filled .kit-list-item {
221
+ --list-item-color: var(--on, var(--list-color, var(--kit-on-container)));
222
+ --list-item-background: var(--base, var(--list-background, var(--kit-container)));
223
+ background-color: var(--list-item-background);
224
+ }
225
+ .kit-list[breakpoint]kit-list--variant-outline .kit-list-item {
226
+ --list-item-color: var(--base, var(--list-color, var(--kit-on-container)));
227
+ background-color: transparent;
228
+ }
229
+ .kit-list[breakpoint]kit-list--variant-outline .kit-list-item::before {
230
+ content: '';
231
+ position: absolute;
232
+ inset: 0;
233
+ border: 1px solid currentColor;
234
+ pointer-events: none;
235
+ border-radius: inherit;
236
+ }
237
+ .kit-list[breakpoint]kit-list--variant-text .kit-list-item {
238
+ --list-item-color: var(--base, var(--list-color, var(--kit-on-container)));
239
+ background-color: transparent;
240
+ border-color: transparent;
241
+ }
242
+ /* events */
243
+ .kit-list[class*='list--variant-filled'] .kit-list-item.kit-list-item--active:not(div),
244
+ .kit-list[class*='list--variant-filled'] .kit-list-item:active:not(div) {
245
+ background-color: color-mix(in oklab, var(--list-item-background) 90%, var(--kit-scrim));
246
+ border-color: color-mix(in oklab, var(--list-item-background) 90%, var(--kit-scrim));
247
+ }
248
+ .kit-list[class*='list--variant-']:not([class*='variant-filled'])
249
+ .kit-list-item.kit-list-item--active:not(div),
250
+ .kit-list[class*='list--variant-']:not([class*='variant-filled']) .kit-list-item:active:not(div) {
251
+ background-color: color-mix(in oklab, currentColor 15%, transparent);
252
+ border-color: color-mix(in oklab, currentColor 15%, transparent);
253
+ }
254
+ /* disabled */
255
+ .kit-list .kit-list-item.kit-list-item--disabled,
256
+ .kit-list .kit-list-item[disabled],
257
+ .kit-list.kit-list--disabled .kit-list-item {
258
+ pointer-events: none;
259
+ user-select: none;
260
+ cursor: default;
261
+ }
262
+ .kit-list[class*='list--variant-filled'] .kit-list-item.kit-list-item--disabled,
263
+ .kit-list[class*='list--variant-filled'] .kit-list-item.kit-list-item--disabled {
264
+ color: color-mix(in oklab, var(--list-item-color) 40%, transparent) !important;
265
+ background-color: color-mix(in oklab, var(--list-item-background) 70%, transparent) !important;
266
+ border-color: color-mix(in oklab, var(--list-item-background) 70%, transparent) !important;
267
+ }
268
+ .kit-list[class*='list--variant-']:not([class*='variant-filled'])
269
+ .kit-list-item.kit-list-item--disabled,
270
+ .kit-list[class*='list--variant-']:not([class*='variant-filled'])
271
+ .kit-list-item.kit-list-item--disabled
272
+ i:before {
273
+ color: color-mix(in oklab, var(--list-item-background) 40%, transparent) !important;
274
+ }
275
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { ListItemProps } from '../types.js';
2
+ declare const ListItem: import("svelte").Component<ListItemProps, {}, "ref">;
3
+ type ListItem = ReturnType<typeof ListItem>;
4
+ export default ListItem;
@@ -0,0 +1,33 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ import type { Snippet } from 'svelte';
3
+ type ListSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
4
+ type ListDensity = 'compact' | 'comfortable' | 'default';
5
+ export interface ListProps extends Component {
6
+ ref?: HTMLElement | null;
7
+ is?: 'div' | 'nav';
8
+ dark?: boolean;
9
+ light?: boolean;
10
+ size?: ListSize | {
11
+ [key: string]: ListSize;
12
+ };
13
+ variant?: 'outline' | 'text' | 'filled';
14
+ density?: ListDensity | {
15
+ [key: string]: ListDensity;
16
+ };
17
+ nav?: boolean;
18
+ }
19
+ export interface ListItemProps extends Component {
20
+ ref?: HTMLElement | null;
21
+ is?: 'div' | 'a' | 'button';
22
+ href?: string;
23
+ dark?: boolean;
24
+ light?: boolean;
25
+ append?: Snippet;
26
+ prepend?: Snippet;
27
+ color?: string;
28
+ background?: string;
29
+ active?: boolean;
30
+ disabled?: boolean;
31
+ noRipple?: boolean;
32
+ }
33
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,145 @@
1
+ /* root */
2
+ .kit-modal {
3
+ --modal-color: var(--on, var(--kit-on-surface));
4
+ --modal-background: var(--base, var(--kit-surface));
5
+ --modal-radius: var(--shape, var(--kit-radius-md));
6
+ --modal-translate-x: -50%;
7
+ --modal-translate-y: -50%;
8
+ }
9
+
10
+ .kit-modal {
11
+ width: 100%;
12
+ height: 100%;
13
+ position: absolute;
14
+ }
15
+
16
+ .kit-modal-container {
17
+ position: fixed;
18
+ overflow-y: auto;
19
+ z-index: 9100;
20
+ width: 100%;
21
+ height: 100%;
22
+ padding-top: var(--modal-spacing-x);
23
+ padding-bottom: var(--modal-spacing-x);
24
+ padding-right: var(--modal-spacing-y);
25
+ padding-left: var(--modal-spacing-y);
26
+
27
+ /* theme */
28
+ color: var(--modal-color);
29
+ background-color: var(--modal-background);
30
+ border-color: var(--modal-background);
31
+ }
32
+
33
+ .kit-modal.kit-modal--contain {
34
+ position: absolute;
35
+ top: 0;
36
+ }
37
+
38
+ .kit-modal.kit-modal--contain .kit-overlay {
39
+ position: absolute;
40
+ }
41
+
42
+ .kit-modal.kit-modal--contain .kit-modal-container {
43
+ position: absolute;
44
+ }
45
+
46
+ /* size */
47
+ .kit-modal [breakpoint]kit-modal-container--size-xs {
48
+ max-width: var(--kit-modal-size-xs);
49
+ max-height: calc(100% - 3rem);
50
+ height: fit-content;
51
+ margin: 0 auto;
52
+ left: 50%;
53
+ bottom: initial;
54
+ translate: var(--modal-translate-x) var(--modal-translate-y);
55
+ border-radius: var(--modal-radius);
56
+ }
57
+ .kit-modal [breakpoint]kit-modal-container--size-sm {
58
+ max-width: var(--kit-modal-size-sm);
59
+ max-height: calc(100% - 3rem);
60
+ height: fit-content;
61
+ margin: 0 auto;
62
+ left: 50%;
63
+ bottom: initial;
64
+ translate: var(--modal-translate-x) var(--modal-translate-y);
65
+ border-radius: var(--modal-radius);
66
+ }
67
+ .kit-modal [breakpoint]kit-modal-container--size-md {
68
+ max-width: var(--kit-modal-size-md);
69
+ max-height: calc(100% - 3rem);
70
+ height: fit-content;
71
+ margin: 0 auto;
72
+ left: 50%;
73
+ bottom: initial;
74
+ translate: var(--modal-translate-x) var(--modal-translate-y);
75
+ border-radius: var(--modal-radius);
76
+ }
77
+ .kit-modal [breakpoint]kit-modal-container--size-lg {
78
+ max-width: var(--kit-modal-size-lg);
79
+ max-height: calc(100% - 3rem);
80
+ height: fit-content;
81
+ margin: 0 auto;
82
+ left: 50%;
83
+ bottom: initial;
84
+ translate: var(--modal-translate-x) var(--modal-translate-y);
85
+ border-radius: var(--modal-radius);
86
+ }
87
+ .kit-modal [breakpoint]kit-modal-container--size-xl {
88
+ max-width: var(--kit-modal-size-xl);
89
+ max-height: calc(100% - 3rem);
90
+ height: fit-content;
91
+ margin: 0 auto;
92
+ left: 50%;
93
+ bottom: initial;
94
+ translate: var(--modal-translate-x) var(--modal-translate-y);
95
+ border-radius: var(--modal-radius);
96
+ }
97
+ .kit-modal [breakpoint]kit-modal-container--size-full {
98
+ max-width: 100%;
99
+ max-height: calc(100% - 3rem);
100
+ margin: 0 auto;
101
+ bottom: 0;
102
+ translate: 0 0;
103
+ left: 0;
104
+ top: initial;
105
+ height: 100%;
106
+ border-radius: var(--modal-radius) var(--modal-radius) 0 0;
107
+ }
108
+
109
+ /* density */
110
+ .kit-modal [breakpoint]kit-modal-container--density-default {
111
+ --modal-spacing-x: 0.5rem;
112
+ --modal-spacing-y: 0.5rem;
113
+ }
114
+
115
+ .kit-modal [breakpoint]kit-modal-container--density-compact {
116
+ --modal-spacing-x: 0.25rem;
117
+ --modal-spacing-y: 0.25rem;
118
+ }
119
+
120
+ .kit-modal [breakpoint]kit-modal-container--density-comfortable {
121
+ --modal-spacing-x: 0.75rem;
122
+ --modal-spacing-y: 0.75rem;
123
+ }
124
+
125
+ /* position */
126
+ .kit-modal [breakpoint]kit-modal-container--position-bottom {
127
+ --modal-translate-y: 0;
128
+ margin: auto;
129
+ top: initial;
130
+ bottom: 0;
131
+ }
132
+
133
+ .kit-modal [breakpoint]kit-modal-container--position-top {
134
+ --modal-translate-y: 0;
135
+ margin: auto;
136
+ top: 0;
137
+ bottom: initial;
138
+ }
139
+
140
+ .kit-modal [breakpoint]kit-modal-container--position-center {
141
+ --modal-translate-y: -50%;
142
+ margin: auto;
143
+ top: 50%;
144
+ bottom: initial;
145
+ }
@@ -0,0 +1,248 @@
1
+ <script lang="ts">
2
+ // import { disabledScroll } from '../../internal/index.js';
3
+ import { getAssets } from '../../internal/index.js';
4
+ import { modalOpen, modalStack, popModal, pushModal, setOpenModal } from '../../stores/index.js';
5
+ import { onDestroy } from 'svelte';
6
+ import type { ModalProps } from './types.js';
7
+ import { get } from 'svelte/store';
8
+
9
+ const modalId = crypto.randomUUID();
10
+ let wasPushed = $state(false);
11
+
12
+ let {
13
+ children,
14
+ ref = $bindable(),
15
+ open = $bindable(),
16
+ contain,
17
+ size = 'md',
18
+ persistent,
19
+ dark,
20
+ light,
21
+ classContent,
22
+ color,
23
+ background,
24
+ position = 'center',
25
+ rounded,
26
+ density = 'default',
27
+ closeWithEsc,
28
+ ...rest
29
+ }: ModalProps = $props();
30
+
31
+ const assets = getAssets();
32
+
33
+ $effect(() => {
34
+ if (open && !wasPushed) {
35
+ pushModal(modalId);
36
+ wasPushed = true;
37
+ } else if (!open && wasPushed) {
38
+ popModal(modalId);
39
+ wasPushed = false;
40
+ }
41
+ });
42
+
43
+ onDestroy(() => {
44
+ if (wasPushed) popModal(modalId);
45
+ });
46
+
47
+ $effect(() => {
48
+ if (open !== undefined && !contain)
49
+ setOpenModal(open ? (persistent ? 'persistent' : open) : open);
50
+ });
51
+
52
+ $effect(() => {
53
+ if ($modalOpen === false && !contain) open = false;
54
+ });
55
+
56
+ $effect(() => {
57
+ if (!closeWithEsc || persistent || !open) return;
58
+
59
+ const onKeyDown = (event: KeyboardEvent) => {
60
+ const stack = get(modalStack);
61
+ const isTop = stack[stack.length - 1] === modalId;
62
+
63
+ if (event.key === 'Escape' && isTop) {
64
+ event.preventDefault();
65
+ open = false;
66
+ }
67
+ };
68
+
69
+ document.addEventListener('keydown', onKeyDown);
70
+ return () => {
71
+ document.removeEventListener('keydown', onKeyDown);
72
+ };
73
+ });
74
+
75
+ const handleClose = () => {
76
+ if (!persistent) open = false;
77
+ };
78
+ </script>
79
+
80
+ {#if open}
81
+ <div
82
+ bind:this={ref}
83
+ {...rest}
84
+ class={['kit-modal', contain && 'kit-modal--contain', rest.class]}
85
+ role="dialog"
86
+ >
87
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
88
+ {#if contain}
89
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
90
+ <div
91
+ class={['kit-overlay', persistent && 'kit-overlay--persistent']}
92
+ onclick={() => handleClose()}
93
+ ></div>
94
+ {/if}
95
+
96
+ <div
97
+ class={[
98
+ 'kit-modal-container',
99
+ classContent,
100
+ light && 'light',
101
+ dark && 'dark',
102
+ size && assets.className('modal-container', 'size', size),
103
+ density && assets.className('modal-container', 'density', density),
104
+ position && assets.className('modal-container', 'position', position)
105
+ ]}
106
+ style:--base={assets.color(background)}
107
+ style:--on={assets.color(color)}
108
+ style:--shape={assets.shape(rounded)}
109
+ >
110
+ {@render children?.()}
111
+ </div>
112
+ </div>
113
+ {/if}
114
+
115
+ <style>/* root */
116
+ .kit-modal {
117
+ --modal-color: var(--on, var(--kit-on-surface));
118
+ --modal-background: var(--base, var(--kit-surface));
119
+ --modal-radius: var(--shape, var(--kit-radius-md));
120
+ --modal-translate-x: -50%;
121
+ --modal-translate-y: -50%;
122
+ }
123
+ .kit-modal {
124
+ width: 100%;
125
+ height: 100%;
126
+ position: absolute;
127
+ }
128
+ .kit-modal-container {
129
+ position: fixed;
130
+ overflow-y: auto;
131
+ z-index: 9100;
132
+ width: 100%;
133
+ height: 100%;
134
+ padding-top: var(--modal-spacing-x);
135
+ padding-bottom: var(--modal-spacing-x);
136
+ padding-right: var(--modal-spacing-y);
137
+ padding-left: var(--modal-spacing-y);
138
+
139
+ /* theme */
140
+ color: var(--modal-color);
141
+ background-color: var(--modal-background);
142
+ border-color: var(--modal-background);
143
+ }
144
+ .kit-modal.kit-modal--contain {
145
+ position: absolute;
146
+ top: 0;
147
+ }
148
+ .kit-modal.kit-modal--contain .kit-overlay {
149
+ position: absolute;
150
+ }
151
+ .kit-modal.kit-modal--contain .kit-modal-container {
152
+ position: absolute;
153
+ }
154
+ /* size */
155
+ .kit-modal [breakpoint]kit-modal-container--size-xs {
156
+ max-width: var(--kit-modal-size-xs);
157
+ max-height: calc(100% - 3rem);
158
+ height: fit-content;
159
+ margin: 0 auto;
160
+ left: 50%;
161
+ bottom: initial;
162
+ translate: var(--modal-translate-x) var(--modal-translate-y);
163
+ border-radius: var(--modal-radius);
164
+ }
165
+ .kit-modal [breakpoint]kit-modal-container--size-sm {
166
+ max-width: var(--kit-modal-size-sm);
167
+ max-height: calc(100% - 3rem);
168
+ height: fit-content;
169
+ margin: 0 auto;
170
+ left: 50%;
171
+ bottom: initial;
172
+ translate: var(--modal-translate-x) var(--modal-translate-y);
173
+ border-radius: var(--modal-radius);
174
+ }
175
+ .kit-modal [breakpoint]kit-modal-container--size-md {
176
+ max-width: var(--kit-modal-size-md);
177
+ max-height: calc(100% - 3rem);
178
+ height: fit-content;
179
+ margin: 0 auto;
180
+ left: 50%;
181
+ bottom: initial;
182
+ translate: var(--modal-translate-x) var(--modal-translate-y);
183
+ border-radius: var(--modal-radius);
184
+ }
185
+ .kit-modal [breakpoint]kit-modal-container--size-lg {
186
+ max-width: var(--kit-modal-size-lg);
187
+ max-height: calc(100% - 3rem);
188
+ height: fit-content;
189
+ margin: 0 auto;
190
+ left: 50%;
191
+ bottom: initial;
192
+ translate: var(--modal-translate-x) var(--modal-translate-y);
193
+ border-radius: var(--modal-radius);
194
+ }
195
+ .kit-modal [breakpoint]kit-modal-container--size-xl {
196
+ max-width: var(--kit-modal-size-xl);
197
+ max-height: calc(100% - 3rem);
198
+ height: fit-content;
199
+ margin: 0 auto;
200
+ left: 50%;
201
+ bottom: initial;
202
+ translate: var(--modal-translate-x) var(--modal-translate-y);
203
+ border-radius: var(--modal-radius);
204
+ }
205
+ .kit-modal [breakpoint]kit-modal-container--size-full {
206
+ max-width: 100%;
207
+ max-height: calc(100% - 3rem);
208
+ margin: 0 auto;
209
+ bottom: 0;
210
+ translate: 0 0;
211
+ left: 0;
212
+ top: initial;
213
+ height: 100%;
214
+ border-radius: var(--modal-radius) var(--modal-radius) 0 0;
215
+ }
216
+ /* density */
217
+ .kit-modal [breakpoint]kit-modal-container--density-default {
218
+ --modal-spacing-x: 0.5rem;
219
+ --modal-spacing-y: 0.5rem;
220
+ }
221
+ .kit-modal [breakpoint]kit-modal-container--density-compact {
222
+ --modal-spacing-x: 0.25rem;
223
+ --modal-spacing-y: 0.25rem;
224
+ }
225
+ .kit-modal [breakpoint]kit-modal-container--density-comfortable {
226
+ --modal-spacing-x: 0.75rem;
227
+ --modal-spacing-y: 0.75rem;
228
+ }
229
+ /* position */
230
+ .kit-modal [breakpoint]kit-modal-container--position-bottom {
231
+ --modal-translate-y: 0;
232
+ margin: auto;
233
+ top: initial;
234
+ bottom: 0;
235
+ }
236
+ .kit-modal [breakpoint]kit-modal-container--position-top {
237
+ --modal-translate-y: 0;
238
+ margin: auto;
239
+ top: 0;
240
+ bottom: initial;
241
+ }
242
+ .kit-modal [breakpoint]kit-modal-container--position-center {
243
+ --modal-translate-y: -50%;
244
+ margin: auto;
245
+ top: 50%;
246
+ bottom: initial;
247
+ }
248
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { ModalProps } from './types.js';
2
+ declare const Modal: import("svelte").Component<ModalProps, {}, "ref" | "open">;
3
+ type Modal = ReturnType<typeof Modal>;
4
+ export default Modal;