lapikit 0.0.0-insiders.fbbc9f6 → 0.0.0-insiders.fbd9b54

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 (142) hide show
  1. package/bin/configuration.js +22 -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/prompts.js +101 -0
  9. package/dist/actions/index.d.ts +1 -0
  10. package/dist/actions/index.js +1 -0
  11. package/dist/assets/icons/arrow-down.svelte +12 -0
  12. package/dist/assets/icons/arrow-down.svelte.d.ts +18 -0
  13. package/dist/assets/icons/arrow-up.svelte +12 -0
  14. package/dist/assets/icons/arrow-up.svelte.d.ts +18 -0
  15. package/dist/assets/icons/close-fill.svelte +12 -0
  16. package/dist/assets/icons/close-fill.svelte.d.ts +18 -0
  17. package/dist/assets/icons/loading-fill.svelte +2 -0
  18. package/dist/assets/icons/loading-fill.svelte.d.ts +6 -14
  19. package/dist/components/accordion/accordion.css +113 -0
  20. package/dist/components/accordion/accordion.svelte +37 -0
  21. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  22. package/dist/components/accordion/accordion.svelte.js +24 -0
  23. package/dist/components/accordion/modules/accordion-item.svelte +94 -0
  24. package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
  25. package/dist/components/accordion/types.d.ts +33 -0
  26. package/dist/components/accordion/types.js +1 -0
  27. package/dist/components/alert/alert.css +137 -0
  28. package/dist/components/alert/alert.svelte +89 -0
  29. package/dist/components/alert/alert.svelte.d.ts +4 -0
  30. package/dist/components/alert/types.d.ts +28 -0
  31. package/dist/components/alert/types.js +1 -0
  32. package/dist/components/app/app.css +16 -0
  33. package/dist/components/app/app.svelte +31 -2
  34. package/dist/components/appbar/appbar.css +48 -0
  35. package/dist/components/appbar/appbar.svelte +40 -0
  36. package/dist/components/appbar/appbar.svelte.d.ts +4 -0
  37. package/dist/components/appbar/types.d.ts +15 -0
  38. package/dist/components/appbar/types.js +1 -0
  39. package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
  40. package/dist/components/aspect-ratio/aspect-ratio.svelte +47 -0
  41. package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
  42. package/dist/components/aspect-ratio/types.d.ts +5 -0
  43. package/dist/components/aspect-ratio/types.js +1 -0
  44. package/dist/components/avatar/avatar.css +109 -0
  45. package/dist/components/avatar/avatar.svelte +46 -0
  46. package/dist/components/avatar/avatar.svelte.d.ts +4 -0
  47. package/dist/components/avatar/types.d.ts +22 -0
  48. package/dist/components/avatar/types.js +1 -0
  49. package/dist/components/button/button.css +165 -194
  50. package/dist/components/button/button.svelte +39 -31
  51. package/dist/components/button/button.svelte.d.ts +2 -2
  52. package/dist/components/button/types.d.ts +7 -5
  53. package/dist/components/card/card.css +115 -0
  54. package/dist/components/card/card.svelte +63 -0
  55. package/dist/components/card/card.svelte.d.ts +4 -0
  56. package/dist/components/card/types.d.ts +18 -0
  57. package/dist/components/card/types.js +1 -0
  58. package/dist/components/chip/chip.css +231 -0
  59. package/dist/components/chip/chip.svelte +129 -0
  60. package/dist/components/chip/chip.svelte.d.ts +4 -0
  61. package/dist/components/chip/types.d.ts +31 -0
  62. package/dist/components/chip/types.js +1 -0
  63. package/dist/components/dialog/dialog.css +134 -0
  64. package/dist/components/dialog/dialog.svelte +67 -0
  65. package/dist/components/dialog/dialog.svelte.d.ts +4 -0
  66. package/dist/components/dialog/types.d.ts +24 -0
  67. package/dist/components/dialog/types.js +1 -0
  68. package/dist/components/dropdown/dropdown.css +22 -0
  69. package/dist/components/dropdown/dropdown.svelte +116 -0
  70. package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
  71. package/dist/components/dropdown/dropdown.svelte.js +148 -0
  72. package/dist/components/dropdown/types.d.ts +26 -0
  73. package/dist/components/dropdown/types.js +1 -0
  74. package/dist/components/icon/icon.css +14 -11
  75. package/dist/components/index.d.ts +20 -1
  76. package/dist/components/index.js +20 -1
  77. package/dist/components/list/list.css +221 -0
  78. package/dist/components/list/list.svelte +44 -0
  79. package/dist/components/list/list.svelte.d.ts +4 -0
  80. package/dist/components/list/modules/list-item.svelte +76 -0
  81. package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
  82. package/dist/components/list/types.d.ts +33 -0
  83. package/dist/components/list/types.js +1 -0
  84. package/dist/components/modal/modal.css +144 -0
  85. package/dist/components/modal/modal.svelte +113 -0
  86. package/dist/components/modal/modal.svelte.d.ts +4 -0
  87. package/dist/components/modal/types.d.ts +26 -0
  88. package/dist/components/modal/types.js +1 -0
  89. package/dist/components/popover/popover.css +22 -0
  90. package/dist/components/popover/popover.svelte +73 -0
  91. package/dist/components/popover/popover.svelte.d.ts +4 -0
  92. package/dist/components/popover/popover.svelte.js +134 -0
  93. package/dist/components/popover/types.d.ts +20 -0
  94. package/dist/components/popover/types.js +1 -0
  95. package/dist/components/separator/separator.css +46 -0
  96. package/dist/components/separator/separator.svelte +37 -0
  97. package/dist/components/separator/separator.svelte.d.ts +4 -0
  98. package/dist/components/separator/types.d.ts +11 -0
  99. package/dist/components/separator/types.js +1 -0
  100. package/dist/components/spacer/spacer.css +3 -0
  101. package/dist/components/spacer/spacer.svelte +7 -0
  102. package/dist/components/spacer/spacer.svelte.d.ts +4 -0
  103. package/dist/components/spacer/types.d.ts +4 -0
  104. package/dist/components/spacer/types.js +1 -0
  105. package/dist/components/textfield/textfield.css +305 -0
  106. package/dist/components/textfield/textfield.svelte +193 -0
  107. package/dist/components/textfield/textfield.svelte.d.ts +4 -0
  108. package/dist/components/textfield/types.d.ts +37 -0
  109. package/dist/components/textfield/types.js +1 -0
  110. package/dist/components/toolbar/toolbar.css +129 -0
  111. package/dist/components/toolbar/toolbar.svelte +47 -0
  112. package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
  113. package/dist/components/toolbar/types.d.ts +27 -0
  114. package/dist/components/toolbar/types.js +1 -0
  115. package/dist/components/tooltip/tooltip.css +124 -0
  116. package/dist/components/tooltip/tooltip.svelte +113 -0
  117. package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
  118. package/dist/components/tooltip/tooltip.svelte.js +131 -0
  119. package/dist/components/tooltip/types.d.ts +23 -0
  120. package/dist/components/tooltip/types.js +1 -0
  121. package/dist/internal/assets.svelte.d.ts +1 -0
  122. package/dist/internal/assets.svelte.js +13 -0
  123. package/dist/internal/clickOutside.d.ts +9 -0
  124. package/dist/internal/clickOutside.js +34 -0
  125. package/dist/internal/index.d.ts +1 -0
  126. package/dist/internal/index.js +1 -0
  127. package/dist/internal/ripple.d.ts +12 -0
  128. package/dist/internal/ripple.js +93 -0
  129. package/dist/internal/scroll.d.ts +1 -0
  130. package/dist/internal/scroll.js +6 -0
  131. package/dist/internal/unit.d.ts +1 -0
  132. package/dist/internal/unit.js +11 -0
  133. package/dist/preset.js +2 -2
  134. package/dist/stores/index.d.ts +9 -3
  135. package/dist/stores/index.js +27 -3
  136. package/dist/style/animation.css +42 -0
  137. package/dist/style/css.js +3 -0
  138. package/dist/style/normalize.css +2 -0
  139. package/dist/style/parser/color.js +2 -2
  140. package/dist/style/parser/device.js +31 -19
  141. package/dist/style/variable.css +12 -0
  142. package/package.json +12 -4
@@ -0,0 +1,221 @@
1
+ /* root */
2
+ .kit-list {
3
+ --list-color: var(--on, var(--kit-on-container));
4
+ --list-background: var(--base, var(--kit-container));
5
+ --list-radius: var(--shape, var(--kit-radius-md));
6
+ }
7
+
8
+ .kit-list {
9
+ position: relative;
10
+ flex-direction: column;
11
+ width: 100%;
12
+ display: flex;
13
+ border: none;
14
+ outline: none;
15
+ }
16
+
17
+ .kit-list-item {
18
+ --list-item-radius: var(--shape, var(--list-radius, var(--kit-radius-md)));
19
+ }
20
+
21
+ .kit-list-item {
22
+ position: relative;
23
+ border: none;
24
+ outline: none;
25
+ padding-top: var(--list-spacing-x);
26
+ padding-bottom: var(--list-spacing-x);
27
+ padding-right: var(--list-spacing-y);
28
+ padding-left: var(--list-spacing-y);
29
+ color: var(--list-item-color);
30
+ border-radius: var(--list-item-radius);
31
+ font-weight: 500;
32
+ text-decoration: none;
33
+ }
34
+
35
+ .kit-list-item:not(div) {
36
+ cursor: pointer;
37
+ }
38
+
39
+ .kit-list-item,
40
+ .kit-list-item .kit-list-item-content--content,
41
+ .kit-list-item .kit-list-item-content--append,
42
+ .kit-list-item .kit-list-item-content--prepend {
43
+ display: inline-flex;
44
+ align-items: center;
45
+ white-space: nowrap;
46
+ gap: calc(var(--kit-spacing) * var(--list-multiplier-gap));
47
+ font-size: calc(var(--kit-spacing) * var(--list-multiplier-font-size));
48
+ }
49
+
50
+ .kit-list-item.kit-list-item--append:not(.kit-list-item--prepend) {
51
+ display: grid;
52
+ grid-template-columns: auto 1fr;
53
+ }
54
+
55
+ .kit-list-item.kit-list-item--prepend:not(.kit-list-item--append) {
56
+ display: grid;
57
+ grid-template-columns: 1fr auto;
58
+ }
59
+
60
+ .kit-list-item.kit-list-item--prepend.kit-list-item--append {
61
+ display: grid;
62
+ grid-template-columns: auto 1fr auto;
63
+ }
64
+
65
+ .kit-list-item::after {
66
+ content: '';
67
+ position: absolute;
68
+ inset: 0;
69
+ background-color: currentColor;
70
+ opacity: 0;
71
+ transition: opacity 150ms ease;
72
+ pointer-events: none;
73
+ border-radius: inherit;
74
+ }
75
+ .kit-list-item:not(div):hover::after {
76
+ opacity: 0.08;
77
+ }
78
+ .kit-list-item:not(div):active::after {
79
+ opacity: 0.12;
80
+ }
81
+ .kit-list-item:not(div):focus-visible::after {
82
+ opacity: 0.12;
83
+ }
84
+
85
+ .kit-list.kit-list--nav {
86
+ padding-top: 8px;
87
+ padding-bottom: 8px;
88
+ padding-inline: 8px;
89
+ }
90
+
91
+ /* size */
92
+ .kit-list[breakpoint]kit-list--size-xs {
93
+ --list-multiplier-x: 16;
94
+ --list-multiplier-y: 4;
95
+ --list-multiplier-gap: 2;
96
+ --list-multiplier-font-size: 6;
97
+ }
98
+ .kit-list[breakpoint]kit-list--size-xs .kit-icon[class*='kit-icon--size-md'] {
99
+ --icon-multiplier-parent-size: 6;
100
+ }
101
+
102
+ .kit-list[breakpoint]kit-list--size-sm {
103
+ --list-multiplier-x: 20;
104
+ --list-multiplier-y: 5;
105
+ --list-multiplier-gap: 4;
106
+ --list-multiplier-font-size: 7;
107
+ }
108
+ .kit-list[breakpoint]kit-list--size-sm .kit-icon[class*='kit-icon--size-md'] {
109
+ --icon-multiplier-parent-size: 7;
110
+ }
111
+
112
+ .kit-list[breakpoint]kit-list--size-md {
113
+ --list-multiplier-x: 24;
114
+ --list-multiplier-y: 6;
115
+ --list-multiplier-gap: 4;
116
+ --list-multiplier-font-size: 8;
117
+ }
118
+ .kit-list[breakpoint]kit-list--size-md .kit-icon[class*='kit-icon--size-md'] {
119
+ --icon-multiplier-parent-size: 8;
120
+ }
121
+
122
+ .kit-list[breakpoint]kit-list--size-lg {
123
+ --list-multiplier-x: 28;
124
+ --list-multiplier-y: 7;
125
+ --list-multiplier-gap: 4;
126
+ --list-multiplier-font-size: 9;
127
+ }
128
+ .kit-list[breakpoint]kit-list--size-lg .kit-icon[class*='kit-icon--size-md'] {
129
+ --icon-multiplier-parent-size: 9;
130
+ }
131
+
132
+ .kit-list[breakpoint]kit-list--size-xl {
133
+ --list-multiplier-x: 32;
134
+ --list-multiplier-y: 8;
135
+ --list-multiplier-gap: 5;
136
+ --list-multiplier-font-size: 10;
137
+ }
138
+ .kit-list[breakpoint]kit-list--size-xl .kit-icon[class*='kit-icon--size-md'] {
139
+ --icon-multiplier-parent-size: 10;
140
+ }
141
+
142
+ /* density */
143
+ .kit-list[breakpoint]kit-list--density-default .kit-list-item {
144
+ height: calc(var(--kit-spacing) * var(--list-multiplier-x));
145
+ --list-spacing-x: 0;
146
+ --list-spacing-y: calc(var(--kit-spacing) * var(--list-multiplier-y));
147
+ }
148
+
149
+ .kit-list[breakpoint]kit-list--density-compact .kit-list-item {
150
+ height: calc(var(--kit-spacing) * var(--list-multiplier-x) - 0.25rem);
151
+ --list-spacing-x: 0;
152
+ --list-spacing-y: calc(var(--kit-spacing) * var(--list-multiplier-y) - 0.25rem);
153
+ }
154
+
155
+ .kit-list[breakpoint]kit-list--density-comfortable .kit-list-item {
156
+ height: calc(var(--kit-spacing) * var(--list-multiplier-x) + 0.25rem);
157
+ --list-spacing-x: 0;
158
+ --list-spacing-y: calc(var(--kit-spacing) * var(--list-multiplier-y) + 0.25rem);
159
+ }
160
+
161
+ /* variant */
162
+ .kit-list[breakpoint]kit-list--variant-filled .kit-list-item {
163
+ --list-item-color: var(--on, var(--list-color, var(--kit-on-container)));
164
+ --list-item-background: var(--base, var(--list-background, var(--kit-container)));
165
+ background-color: var(--list-item-background);
166
+ }
167
+
168
+ .kit-list[breakpoint]kit-list--variant-outline .kit-list-item {
169
+ --list-item-color: var(--base, var(--list-color, var(--kit-on-container)));
170
+ background-color: transparent;
171
+ }
172
+ .kit-list[breakpoint]kit-list--variant-outline .kit-list-item::before {
173
+ content: '';
174
+ position: absolute;
175
+ inset: 0;
176
+ border: 1px solid currentColor;
177
+ pointer-events: none;
178
+ border-radius: inherit;
179
+ }
180
+
181
+ .kit-list[breakpoint]kit-list--variant-text .kit-list-item {
182
+ --list-item-color: var(--base, var(--list-color, var(--kit-on-container)));
183
+ background-color: transparent;
184
+ border-color: transparent;
185
+ }
186
+
187
+ /* events */
188
+ .kit-list[class*='list--variant-filled'] .kit-list-item.kit-list-item--active:not(div),
189
+ .kit-list[class*='list--variant-filled'] .kit-list-item:active:not(div) {
190
+ background-color: color-mix(in oklab, var(--list-item-background) 90%, var(--kit-scrim));
191
+ border-color: color-mix(in oklab, var(--list-item-background) 90%, var(--kit-scrim));
192
+ }
193
+ .kit-list[class*='list--variant-']:not([class*='variant-filled'])
194
+ .kit-list-item.kit-list-item--active:not(div),
195
+ .kit-list[class*='list--variant-']:not([class*='variant-filled']) .kit-list-item:active:not(div) {
196
+ background-color: color-mix(in oklab, currentColor 15%, transparent);
197
+ border-color: color-mix(in oklab, currentColor 15%, transparent);
198
+ }
199
+
200
+ /* disabled */
201
+ .kit-list .kit-list-item.kit-list-item--disabled,
202
+ .kit-list .kit-list-item[disabled],
203
+ .kit-list.kit-list--disabled .kit-list-item {
204
+ pointer-events: none;
205
+ user-select: none;
206
+ cursor: default;
207
+ }
208
+ .kit-list[class*='list--variant-filled'] .kit-list-item.kit-list-item--disabled,
209
+ .kit-list[class*='list--variant-filled'] .kit-list-item.kit-list-item--disabled {
210
+ color: color-mix(in oklab, var(--list-item-color) 40%, transparent) !important;
211
+ background-color: color-mix(in oklab, var(--list-item-background) 70%, transparent) !important;
212
+ border-color: color-mix(in oklab, var(--list-item-background) 70%, transparent) !important;
213
+ }
214
+
215
+ .kit-list[class*='list--variant-']:not([class*='variant-filled'])
216
+ .kit-list-item.kit-list-item--disabled,
217
+ .kit-list[class*='list--variant-']:not([class*='variant-filled'])
218
+ .kit-list-item.kit-list-item--disabled
219
+ i:before {
220
+ color: color-mix(in oklab, var(--list-item-background) 40%, transparent) !important;
221
+ }
@@ -0,0 +1,44 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/index.js';
3
+ import type { ListProps } from './types.js';
4
+
5
+ let {
6
+ children,
7
+ ref = $bindable(),
8
+ is = 'div',
9
+ dark,
10
+ light,
11
+ background,
12
+ color,
13
+ rounded,
14
+ size = 'md',
15
+ density = 'default',
16
+ variant = 'filled',
17
+ nav,
18
+ ...rest
19
+ }: ListProps = $props();
20
+
21
+ const assets = getAssets();
22
+ </script>
23
+
24
+ <svelte:element
25
+ this={is}
26
+ bind:this={ref}
27
+ {...rest}
28
+ class={[
29
+ 'kit-list',
30
+ light && 'light',
31
+ dark && 'dark',
32
+ size && assets.className('list', 'size', size),
33
+ variant && assets.className('list', 'variant', variant),
34
+ density && assets.className('list', 'density', density),
35
+ nav && 'kit-list--nav',
36
+ rest.class
37
+ ]}
38
+ role="listbox"
39
+ style:--base={assets.color(background)}
40
+ style:--on={assets.color(color)}
41
+ style:--shape={assets.shape(rounded)}
42
+ >
43
+ {@render children?.()}
44
+ </svelte:element>
@@ -0,0 +1,4 @@
1
+ import type { ListProps } from './types.js';
2
+ declare const List: import("svelte").Component<ListProps, {}, "ref">;
3
+ type List = ReturnType<typeof List>;
4
+ export default List;
@@ -0,0 +1,76 @@
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>
@@ -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,144 @@
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
+ top: 50%;
53
+ left: 50%;
54
+ bottom: initial;
55
+ translate: var(--modal-translate-x) var(--modal-translate-y);
56
+ border-radius: var(--modal-radius);
57
+ }
58
+ .kit-modal [breakpoint]kit-modal-container--size-sm {
59
+ max-width: var(--kit-modal-size-sm);
60
+ max-height: calc(100% - 3rem);
61
+ height: fit-content;
62
+ margin: 0 auto;
63
+ top: 50%;
64
+ left: 50%;
65
+ bottom: initial;
66
+ translate: var(--modal-translate-x) var(--modal-translate-y);
67
+ border-radius: var(--modal-radius);
68
+ }
69
+ .kit-modal [breakpoint]kit-modal-container--size-md {
70
+ max-width: var(--kit-modal-size-md);
71
+ max-height: calc(100% - 3rem);
72
+ height: fit-content;
73
+ margin: 0 auto;
74
+ top: 50%;
75
+ left: 50%;
76
+ bottom: initial;
77
+ translate: var(--modal-translate-x) var(--modal-translate-y);
78
+ border-radius: var(--modal-radius);
79
+ }
80
+ .kit-modal [breakpoint]kit-modal-container--size-lg {
81
+ max-width: var(--kit-modal-size-lg);
82
+ max-height: calc(100% - 3rem);
83
+ height: fit-content;
84
+ margin: 0 auto;
85
+ top: 50%;
86
+ left: 50%;
87
+ bottom: initial;
88
+ translate: var(--modal-translate-x) var(--modal-translate-y);
89
+ border-radius: var(--modal-radius);
90
+ }
91
+ .kit-modal [breakpoint]kit-modal-container--size-xl {
92
+ max-width: var(--kit-modal-size-xl);
93
+ max-height: calc(100% - 3rem);
94
+ height: fit-content;
95
+ margin: 0 auto;
96
+ top: 50%;
97
+ left: 50%;
98
+ bottom: initial;
99
+ translate: var(--modal-translate-x) var(--modal-translate-y);
100
+ border-radius: var(--modal-radius);
101
+ }
102
+ .kit-modal [breakpoint]kit-modal-container--size-full {
103
+ max-width: 100%;
104
+ max-height: calc(100% - 3rem);
105
+ margin: 0 auto;
106
+ bottom: 0;
107
+ translate: 0 0;
108
+ left: 0;
109
+ top: initial;
110
+ height: 100%;
111
+ border-radius: var(--modal-radius) var(--modal-radius) 0 0;
112
+ }
113
+
114
+ /* density */
115
+ .kit-modal [breakpoint]kit-modal-container--density-default {
116
+ --modal-spacing-x: 0.5rem;
117
+ --modal-spacing-y: 0.5rem;
118
+ }
119
+
120
+ .kit-modal [breakpoint]kit-modal-container--density-compact {
121
+ --modal-spacing-x: 0.25rem;
122
+ --modal-spacing-y: 0.25rem;
123
+ }
124
+
125
+ .kit-modal [breakpoint]kit-modal-container--density-comfortable {
126
+ --modal-spacing-x: 0.75rem;
127
+ --modal-spacing-y: 0.75rem;
128
+ }
129
+
130
+ /* position */
131
+ .kit-modal [breakpoint]kit-modal-container--position-bottom {
132
+ --modal-translate-y: 0;
133
+ bottom: 0;
134
+ top: initial;
135
+ }
136
+
137
+ .kit-modal [breakpoint]kit-modal-container--position-top {
138
+ --modal-translate-y: 0;
139
+ top: 0;
140
+ }
141
+
142
+ .kit-modal [breakpoint]kit-modal-container--position-center {
143
+ margin: auto;
144
+ }
@@ -0,0 +1,113 @@
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}
@@ -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;
@@ -0,0 +1,26 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ type ModalSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
3
+ type ModalPosition = 'bottom' | 'center' | 'top';
4
+ type ModalDensity = 'compact' | 'comfortable' | 'default';
5
+ export interface ModalProps extends Component {
6
+ ref?: HTMLDivElement;
7
+ open?: boolean;
8
+ classContent?: string | string[] | undefined;
9
+ size?: ModalSize | {
10
+ [key: string]: ModalSize;
11
+ };
12
+ persistent?: boolean;
13
+ position?: ModalPosition | {
14
+ [key: string]: ModalPosition;
15
+ };
16
+ dark?: boolean;
17
+ light?: boolean;
18
+ color?: string;
19
+ background?: string;
20
+ density?: ModalDensity | {
21
+ [key: string]: ModalDensity;
22
+ };
23
+ contain?: boolean;
24
+ closeWithEsc?: boolean;
25
+ }
26
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ .kit-popover-content {
2
+ --popover-color: var(--on, var(--kit-on-container));
3
+ --popover-background: var(--base, var(--kit-container));
4
+ --popover-radius: var(--shape, var(--kit-radius-md));
5
+
6
+ inset: 0px auto auto 0px;
7
+ margin: 0px;
8
+ position: fixed;
9
+ z-index: 9999;
10
+ display: inline-block;
11
+ width: auto;
12
+ opacity: 1;
13
+ transition-property: opacity, transform;
14
+ /* transition:
15
+ color 0.5s,
16
+ background-color 0.5s; */
17
+
18
+ /* theme */
19
+ background-color: var(--popover-background);
20
+ color: var(--popover-color);
21
+ border-radius: var(--popover-radius);
22
+ }