@esportsplus/ui 0.51.6 → 0.53.0

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 (183) hide show
  1. package/.github/workflows/bump.yml +4 -1
  2. package/.github/workflows/publish.yml +4 -0
  3. package/README.md +2 -3
  4. package/build/components/accordion/index.d.ts +22 -16
  5. package/build/components/accordion/index.js +10 -36
  6. package/build/components/accordion/scss/index.scss +1 -1
  7. package/build/components/back/index.d.ts +16 -13
  8. package/build/components/back/index.js +11 -11
  9. package/build/components/button/index.d.ts +22 -22
  10. package/build/components/button/index.js +25 -25
  11. package/build/components/checkbox/index.d.ts +1 -1
  12. package/build/components/checkbox/index.js +27 -23
  13. package/build/components/clipboard/index.d.ts +23 -20
  14. package/build/components/clipboard/index.js +1 -0
  15. package/build/components/clipboard/onclick.d.ts +1 -1
  16. package/build/components/clipboard/onclick.js +16 -16
  17. package/build/components/clipboard/write.d.ts +1 -1
  18. package/build/components/counter/index.d.ts +5 -5
  19. package/build/components/counter/index.js +34 -34
  20. package/build/components/ellipsis/index.d.ts +1 -1
  21. package/build/components/ellipsis/index.js +5 -5
  22. package/build/components/form/action.d.ts +3 -3
  23. package/build/components/form/action.js +8 -8
  24. package/build/components/form/index.d.ts +2 -2
  25. package/build/components/form/input.d.ts +8 -6
  26. package/build/components/form/input.js +3 -3
  27. package/build/components/frame/index.d.ts +16 -15
  28. package/build/components/frame/index.js +11 -5
  29. package/build/components/highlight/index.d.ts +17 -16
  30. package/build/components/highlight/index.js +16 -16
  31. package/build/components/icon/index.d.ts +11 -11
  32. package/build/components/icon/index.js +8 -8
  33. package/build/components/index.d.ts +1 -4
  34. package/build/components/index.js +1 -4
  35. package/build/components/input/index.d.ts +1 -1
  36. package/build/components/input/index.js +21 -21
  37. package/build/components/json/download.d.ts +1 -1
  38. package/build/components/loader/index.d.ts +17 -16
  39. package/build/components/loader/index.js +35 -35
  40. package/build/components/loader/scss/index.scss +1 -1
  41. package/build/components/loading/index.d.ts +1 -1
  42. package/build/components/loading/index.js +5 -5
  43. package/build/components/overlay/index.d.ts +16 -15
  44. package/build/components/overlay/index.js +11 -5
  45. package/build/components/overlay/scss/index.scss +1 -1
  46. package/build/components/page/scss/index.scss +1 -1
  47. package/build/components/radio/index.js +1 -1
  48. package/build/components/range/index.d.ts +1 -1
  49. package/build/components/range/index.js +26 -26
  50. package/build/components/root/index.d.ts +1 -4
  51. package/build/components/root/onclick.d.ts +4 -4
  52. package/build/components/root/scss/index.scss +1 -1
  53. package/build/components/select/index.d.ts +4 -7
  54. package/build/components/select/index.js +92 -98
  55. package/build/components/sidebar/index.d.ts +16 -15
  56. package/build/components/sidebar/index.js +11 -5
  57. package/build/components/sidebar/scss/index.scss +1 -1
  58. package/build/components/switch/index.js +1 -1
  59. package/build/components/textarea/index.d.ts +1 -1
  60. package/build/components/textarea/index.js +21 -21
  61. package/build/components/toast/index.d.ts +9 -0
  62. package/build/components/toast/index.js +157 -0
  63. package/build/components/toast/manager.d.ts +60 -0
  64. package/build/components/toast/manager.js +203 -0
  65. package/build/components/toast/scss/index.scss +2 -0
  66. package/build/components/toast/svg/check.svg +1 -0
  67. package/build/components/toast/svg/chevron.svg +1 -0
  68. package/build/components/toast/svg/close.svg +1 -0
  69. package/build/components/toast/svg/copy.svg +1 -0
  70. package/build/components/toast/svg/error.svg +1 -0
  71. package/build/components/toast/svg/info.svg +1 -0
  72. package/build/components/toast/svg/loading.svg +1 -0
  73. package/build/components/toast/svg/success.svg +1 -0
  74. package/build/components/toast/svg/warning.svg +1 -0
  75. package/build/components/tooltip/index.d.ts +40 -40
  76. package/build/components/tooltip/menu.d.ts +11 -12
  77. package/build/components/tooltip/menu.js +38 -24
  78. package/build/components/tooltip/onclick.d.ts +1151 -1151
  79. package/build/components/tooltip/onclick.js +17 -17
  80. package/build/components/tooltip/onhover.d.ts +17 -16
  81. package/build/components/tooltip/onhover.js +17 -17
  82. package/build/components/typewriter/index.d.ts +11 -11
  83. package/build/components/typewriter/index.js +16 -16
  84. package/build/css-utilities/index.scss +1 -1
  85. package/build/css-utilities/scroll-fade/scss/index.scss +2 -0
  86. package/build/css-utilities/scrollbar/scss/index.scss +2 -0
  87. package/build/themes/dark/back.d.ts +8 -4
  88. package/build/themes/dark/index.d.ts +0 -1
  89. package/build/themes/dark/index.js +0 -1
  90. package/build/themes/dark/input.d.ts +2 -2
  91. package/build/themes/dark/select.d.ts +60 -110
  92. package/build/themes/dark/textarea.d.ts +2 -2
  93. package/package.json +15 -15
  94. package/pnpm-workspace.yaml +11 -0
  95. package/src/components/accordion/index.ts +7 -30
  96. package/src/components/accordion/scss/index.scss +9 -12
  97. package/src/components/back/index.ts +4 -5
  98. package/src/components/button/index.ts +2 -3
  99. package/src/components/checkbox/index.ts +7 -2
  100. package/src/components/clipboard/index.ts +2 -1
  101. package/src/components/clipboard/onclick.ts +3 -4
  102. package/src/components/form/input.ts +4 -4
  103. package/src/components/frame/index.ts +9 -5
  104. package/src/components/highlight/index.ts +2 -3
  105. package/src/components/icon/index.ts +2 -3
  106. package/src/components/index.ts +1 -4
  107. package/src/components/loader/index.ts +5 -6
  108. package/src/components/loader/scss/index.scss +1 -1
  109. package/src/components/overlay/index.ts +9 -5
  110. package/src/components/overlay/scss/index.scss +0 -1
  111. package/src/components/page/scss/index.scss +1 -1
  112. package/src/components/root/scss/index.scss +35 -4
  113. package/src/components/root/scss/variables.scss +1 -2
  114. package/src/components/select/index.ts +71 -83
  115. package/src/components/sidebar/index.ts +9 -5
  116. package/src/components/sidebar/scss/index.scss +0 -1
  117. package/src/components/toast/index.ts +188 -0
  118. package/src/components/toast/manager.ts +312 -0
  119. package/src/components/toast/scss/index.scss +276 -0
  120. package/src/components/toast/scss/variables.scss +19 -0
  121. package/src/components/toast/svg/check.svg +1 -0
  122. package/src/components/toast/svg/chevron.svg +1 -0
  123. package/src/components/toast/svg/close.svg +1 -0
  124. package/src/components/toast/svg/copy.svg +1 -0
  125. package/src/components/toast/svg/error.svg +1 -0
  126. package/src/components/toast/svg/info.svg +1 -0
  127. package/src/components/toast/svg/loading.svg +1 -0
  128. package/src/components/toast/svg/success.svg +1 -0
  129. package/src/components/toast/svg/warning.svg +1 -0
  130. package/src/components/tooltip/menu.ts +8 -4
  131. package/src/components/tooltip/onclick.ts +3 -4
  132. package/src/components/tooltip/onhover.ts +2 -3
  133. package/src/components/typewriter/index.ts +2 -3
  134. package/src/css-utilities/index.scss +3 -2
  135. package/src/css-utilities/scroll-fade/scss/index.scss +47 -0
  136. package/src/css-utilities/scroll-fade/scss/variables.scss +3 -0
  137. package/src/css-utilities/scrollbar/scss/index.scss +53 -0
  138. package/src/css-utilities/scrollbar/scss/variables.scss +5 -0
  139. package/src/themes/dark/index.ts +0 -1
  140. package/src/tokens/scss/color.scss +14 -14
  141. package/src/tokens/scss/font-size.scss +12 -11
  142. package/src/tokens/scss/line-height.scss +7 -4
  143. package/src/tokens/scss/scale.scss +22 -0
  144. package/src/tokens/scss/size.scss +12 -9
  145. package/src/tokens/scss/spacer.scss +9 -9
  146. package/storage/svg/bolt.svg +1 -0
  147. package/storage/svg/star.svg +1 -0
  148. package/tsconfig.json +6 -2
  149. package/vite-env.d.ts +1 -0
  150. package/vite.config.ts +73 -72
  151. package/build/components/alert/index.d.ts +0 -19
  152. package/build/components/alert/index.js +0 -151
  153. package/build/components/alert/scss/index.scss +0 -2
  154. package/build/components/alert/svg/check.svg +0 -11
  155. package/build/components/alert/svg/close.svg +0 -12
  156. package/build/components/alert/svg/error.svg +0 -18
  157. package/build/components/scrollbar/index.d.ts +0 -27
  158. package/build/components/scrollbar/index.js +0 -56
  159. package/build/components/scrollbar/scss/index.scss +0 -2
  160. package/build/components/site/index.d.ts +0 -20
  161. package/build/components/site/index.js +0 -9
  162. package/build/components/site/scss/index.scss +0 -2
  163. package/build/components/template/index.d.ts +0 -13
  164. package/build/components/template/index.js +0 -21
  165. package/build/css-utilities/scroller/scss/index.scss +0 -2
  166. package/build/themes/dark/alert.d.ts +0 -11
  167. package/build/themes/dark/alert.js +0 -20
  168. package/src/components/accordion/scss/variables.scss +0 -9
  169. package/src/components/alert/index.ts +0 -165
  170. package/src/components/alert/scss/index.scss +0 -25
  171. package/src/components/alert/scss/variables.scss +0 -3
  172. package/src/components/alert/svg/check.svg +0 -11
  173. package/src/components/alert/svg/close.svg +0 -12
  174. package/src/components/alert/svg/error.svg +0 -18
  175. package/src/components/scrollbar/index.ts +0 -70
  176. package/src/components/scrollbar/scss/index.scss +0 -82
  177. package/src/components/scrollbar/scss/variables.scss +0 -6
  178. package/src/components/site/index.ts +0 -11
  179. package/src/components/site/scss/index.scss +0 -3
  180. package/src/components/template/index.ts +0 -40
  181. package/src/css-utilities/scroller/scss/index.scss +0 -8
  182. package/src/css-utilities/scroller/scss/variables.scss +0 -4
  183. package/src/themes/dark/alert.ts +0 -23
@@ -0,0 +1,157 @@
1
+ import * as template_u1 from '@esportsplus/template';
2
+ import * as reactivity_u0 from '@esportsplus/reactivity';
3
+ import clipboard from '../clipboard/index.js';
4
+ import icon from '../icon/index.js';
5
+ import { buildVisibleToastLayout, remove, state, toast } from './manager.js';
6
+ import { toasts } from './manager.js';
7
+ import check from './svg/check.svg';
8
+ import close from './svg/close.svg';
9
+ import copy from './svg/copy.svg';
10
+ import error from './svg/error.svg';
11
+ import info from './svg/info.svg';
12
+ import loading from './svg/loading.svg';
13
+ import success from './svg/success.svg';
14
+ import warning from './svg/warning.svg';
15
+ import './scss/index.scss';
16
+ const template_1ali9cs2 = template_u1.template(`<div class='toast-description '>`);
17
+ const template_1ali9cs5 = template_u1.template(`<div class='toast-action button button--primary'>`);
18
+ const template_1ali9cs8 = template_u1.template(`<button class='toast-close' aria-label='Dismiss'>`);
19
+ const template_1ali9csb = template_u1.template(`<div ><div class='toast-content'><!--$--><div class='--flex-column --flex-fill'><div class='toast-title'></div></div><!--$-->`);
20
+ const template_1ali9csj = template_u1.template(`<div class='toaster ' data-position='' >`);
21
+ class ReactiveObject_1ali9cs0 extends reactivity_u0.ReactiveObject {
22
+ #direction = this[reactivity_u0.SIGNAL]('');
23
+ #x = this[reactivity_u0.SIGNAL](0);
24
+ #y = this[reactivity_u0.SIGNAL](0);
25
+ constructor() {
26
+ super(null);
27
+ }
28
+ get direction() {
29
+ return reactivity_u0.read(this.#direction);
30
+ }
31
+ set direction(_v0) {
32
+ reactivity_u0.write(this.#direction, _v0);
33
+ }
34
+ get x() {
35
+ return reactivity_u0.read(this.#x);
36
+ }
37
+ set x(_v1) {
38
+ reactivity_u0.write(this.#x, _v1);
39
+ }
40
+ get y() {
41
+ return reactivity_u0.read(this.#y);
42
+ }
43
+ set y(_v2) {
44
+ reactivity_u0.write(this.#y, _v2);
45
+ }
46
+ }
47
+ const ICONS = { error, info, loading, success, warning };
48
+ const dismiss = toast.dismiss;
49
+ function row(toast, position) {
50
+ let swipe = new ReactiveObject_1ali9cs0(), horizontal = position.endsWith('left') || position.endsWith('right'), pointerId = -1, pressed = false, startX = 0, startY = 0, swiping = false, top = position.startsWith('top');
51
+ const finish = () => {
52
+ pressed = false;
53
+ if (!swiping) {
54
+ return;
55
+ }
56
+ swiping = false;
57
+ if (Math.hypot(swipe.x, swipe.y) > 80) {
58
+ swipe.direction = Math.abs(swipe.x) > Math.abs(swipe.y)
59
+ ? (swipe.x < 0 ? 'left' : 'right')
60
+ : (swipe.y < 0 ? 'up' : 'down');
61
+ dismiss(toast.id);
62
+ }
63
+ else {
64
+ swipe.direction = '';
65
+ swipe.x = 0;
66
+ swipe.y = 0;
67
+ }
68
+ };
69
+ return (() => {
70
+ let root_1ali9csa = template_1ali9csb(), element_1ali9csc = root_1ali9csa.firstChild, element_1ali9csd = element_1ali9csc.firstElementChild.firstChild, element_1ali9cse = element_1ali9csc.firstElementChild.firstElementChild.firstElementChild, element_1ali9csf = element_1ali9csc.firstElementChild.firstElementChild, element_1ali9csg = element_1ali9csd.nextSibling.nextSibling, element_1ali9csh = element_1ali9csc.firstElementChild;
71
+ template_u1.setList(element_1ali9csc, 'class', () => `toast toast--${toast.type}${toast.status === 'starting' ? ' toast--starting' : toast.status === 'ending' ? ' toast--ending' : ''}${swipe.x !== 0 || swipe.y !== 0 ? ' toast--swiping' : ''}`);
72
+ template_u1.setList(element_1ali9csc, 'style', () => {
73
+ let item = buildVisibleToastLayout([...toasts]).items.find((i) => i.toast === toast), visibleIndex = item?.visibleIndex ?? 0, offsetY = item?.offsetY ?? 0;
74
+ return `
75
+ --toast-index:${visibleIndex};
76
+ --toast-offset-y:${offsetY}px;
77
+ --toast-height:${toast.height}px;
78
+ --toast-swipe-x:${swipe.x}px;
79
+ --toast-swipe-y:${swipe.y}px;`;
80
+ });
81
+ template_u1.setProperty(element_1ali9csc, 'data-swipe-direction', () => swipe.direction);
82
+ template_u1.onconnect(element_1ali9csc, (el) => {
83
+ let observer = new ResizeObserver(() => { toast.height = el.offsetHeight; });
84
+ el.__toastObserver = observer;
85
+ observer.observe(el);
86
+ });
87
+ template_u1.ondisconnect(element_1ali9csc, (el) => {
88
+ el.__toastObserver?.disconnect();
89
+ });
90
+ template_u1.delegate(element_1ali9csc, 'pointerdown', (e) => {
91
+ pointerId = e.pointerId;
92
+ pressed = true;
93
+ startX = e.clientX;
94
+ startY = e.clientY;
95
+ });
96
+ template_u1.delegate(element_1ali9csc, 'pointermove', (e) => {
97
+ if (!pressed) {
98
+ return;
99
+ }
100
+ let x = horizontal ? e.clientX - startX : 0, y = top ? Math.min(0, e.clientY - startY) : Math.max(0, e.clientY - startY);
101
+ if (!swiping) {
102
+ if (Math.hypot(x, y) < 6) {
103
+ return;
104
+ }
105
+ swiping = true;
106
+ e.currentTarget.setPointerCapture(pointerId);
107
+ }
108
+ swipe.x = x;
109
+ swipe.y = y;
110
+ });
111
+ template_u1.delegate(element_1ali9csc, 'pointerup', finish);
112
+ template_u1.delegate(element_1ali9csc, 'pointercancel', finish);
113
+ template_u1.slot(element_1ali9csd, toast.type !== 'message' ? icon({ class: 'toast-icon' }, ICONS[toast.type]) : '');
114
+ template_u1.slot(element_1ali9cse, toast.title, 1);
115
+ template_u1.slot(element_1ali9csf, toast.description && (() => {
116
+ let root_1ali9cs1 = template_1ali9cs2(), element_1ali9cs3 = root_1ali9cs1.firstChild;
117
+ template_u1.setList(element_1ali9cs3, 'class', toast.type === 'error' && typeof toast.description === 'string' && toast.description.length > 180 && 'toast-description--clamp');
118
+ template_u1.slot(element_1ali9cs3, toast.description, 1);
119
+ return root_1ali9cs1;
120
+ })(), 2);
121
+ template_u1.slot(element_1ali9csg, toast.type === 'error' && typeof toast.description === 'string' && clipboard.onclick({
122
+ class: 'toast-copy button',
123
+ value: String(toast.description)
124
+ }, (state) => icon(state.copied ? check : copy)));
125
+ template_u1.slot(element_1ali9csh, toast.action && (() => {
126
+ let root_1ali9cs4 = template_1ali9cs5(), element_1ali9cs6 = root_1ali9cs4.firstChild;
127
+ template_u1.delegate(element_1ali9cs6, 'click', () => {
128
+ toast.action?.onclick();
129
+ dismiss(toast.id);
130
+ });
131
+ template_u1.slot(element_1ali9cs6, toast.action?.label, 1);
132
+ return root_1ali9cs4;
133
+ })(), 2);
134
+ new template_u1.EffectSlot(element_1ali9csc, () => toast.dismissible && (() => {
135
+ let root_1ali9cs7 = template_1ali9cs8(), element_1ali9cs9 = root_1ali9cs7.firstChild;
136
+ template_u1.delegate(element_1ali9cs9, 'click', () => dismiss(toast.id));
137
+ template_u1.slot(element_1ali9cs9, icon(close), 1);
138
+ return root_1ali9cs7;
139
+ })(), 2);
140
+ return root_1ali9csa;
141
+ })();
142
+ }
143
+ const toaster = (options) => {
144
+ let position = options?.position ?? 'top-right';
145
+ return (() => {
146
+ let root_1ali9csi = template_1ali9csj(), element_1ali9csk = root_1ali9csi.firstChild;
147
+ template_u1.setList(element_1ali9csk, 'class', () => state.active ? '--active' : '');
148
+ template_u1.setProperty(element_1ali9csk, 'data-position', position);
149
+ template_u1.setList(element_1ali9csk, 'style', () => `--toast-frontmost-height:${buildVisibleToastLayout([...toasts]).frontmostHeight}px;`);
150
+ template_u1.on(element_1ali9csk, 'mouseenter', () => { state.active = true; });
151
+ template_u1.on(element_1ali9csk, 'mouseleave', () => { state.active = false; });
152
+ element_1ali9csk.appendChild(new template_u1.ArraySlot(toasts, (value) => row(value, position), true).fragment);
153
+ return root_1ali9csi;
154
+ })();
155
+ };
156
+ export default toaster;
157
+ export { remove, toast };
@@ -0,0 +1,60 @@
1
+ import * as reactivity_u0 from '@esportsplus/reactivity';
2
+ import { ReactiveArray } from '@esportsplus/reactivity';
3
+ import { type Renderable } from '@esportsplus/template';
4
+ declare class ReactiveObject_0ktzs5p0 extends reactivity_u0.ReactiveObject<any> {
5
+ #private;
6
+ constructor();
7
+ get active(): boolean;
8
+ set active(_v0: boolean);
9
+ }
10
+ type Action = {
11
+ label: string;
12
+ onclick: () => void;
13
+ };
14
+ type Options = {
15
+ action?: Action;
16
+ description?: Renderable<unknown> | string;
17
+ dismissible?: boolean;
18
+ duration?: number;
19
+ id?: string;
20
+ priority?: 'low' | 'high';
21
+ };
22
+ type Status = 'ending' | 'starting' | 'visible';
23
+ type Toast = {
24
+ action?: Action;
25
+ createdAt: number;
26
+ description?: Renderable<unknown> | string;
27
+ dismissible: boolean;
28
+ duration: number;
29
+ height: number;
30
+ id: string;
31
+ priority: 'low' | 'high';
32
+ status: Status;
33
+ title: Renderable<unknown> | string;
34
+ type: Type;
35
+ };
36
+ type Type = 'success' | 'error' | 'info' | 'warning' | 'loading' | 'message';
37
+ declare function buildVisibleToastLayout(toasts: Toast[]): {
38
+ frontmostHeight: number;
39
+ items: {
40
+ offsetY: number;
41
+ toast: Toast;
42
+ visibleIndex: number;
43
+ }[];
44
+ };
45
+ declare function remove(id: string): void;
46
+ declare function update(id: string, options: Options): void;
47
+ declare const state: ReactiveObject_0ktzs5p0;
48
+ declare const toasts: ReactiveArray<Toast>;
49
+ declare const toast: {
50
+ dismiss: (id?: string) => void;
51
+ error: (title: Renderable<unknown> | string, options?: Options) => string;
52
+ info: (title: Renderable<unknown> | string, options?: Options) => string;
53
+ loading: (title: Renderable<unknown> | string, options?: Options) => string;
54
+ message: (title: Renderable<unknown> | string, options?: Options) => string;
55
+ success: (title: Renderable<unknown> | string, options?: Options) => string;
56
+ update: typeof update;
57
+ warning: (title: Renderable<unknown> | string, options?: Options) => string;
58
+ };
59
+ export { buildVisibleToastLayout, remove, state, toast, toasts };
60
+ export type { Options, Toast, Type };
@@ -0,0 +1,203 @@
1
+ import * as reactivity_u0 from '@esportsplus/reactivity';
2
+ import { ReactiveArray, effect } from '@esportsplus/reactivity';
3
+ class ReactiveObject_0ktzs5p0 extends reactivity_u0.ReactiveObject {
4
+ #active = this[reactivity_u0.SIGNAL](false);
5
+ constructor() {
6
+ super(null);
7
+ }
8
+ get active() {
9
+ return reactivity_u0.read(this.#active);
10
+ }
11
+ set active(_v0) {
12
+ reactivity_u0.write(this.#active, _v0);
13
+ }
14
+ }
15
+ const DURATIONS = {
16
+ error: 6000,
17
+ info: 4000,
18
+ loading: 0,
19
+ message: 4000,
20
+ success: 4000,
21
+ warning: 6000
22
+ };
23
+ const EXIT_DURATION = 300;
24
+ let counter = 0, paused = false, timers = new Map();
25
+ function buildVisibleToastLayout(toasts) {
26
+ let fullIndex = 0, fullOffsetY = 0, liveIndex = 0, liveOffsetY = 0, items = toasts.map((toast) => {
27
+ let height = normalizeToastHeight(toast.height), item;
28
+ if (toast.status === 'ending') {
29
+ item = {
30
+ offsetY: fullOffsetY,
31
+ toast,
32
+ visibleIndex: fullIndex
33
+ };
34
+ fullOffsetY += height;
35
+ fullIndex += 1;
36
+ return item;
37
+ }
38
+ item = {
39
+ offsetY: liveOffsetY,
40
+ toast,
41
+ visibleIndex: liveIndex
42
+ };
43
+ fullOffsetY += height;
44
+ fullIndex += 1;
45
+ liveOffsetY += height;
46
+ liveIndex += 1;
47
+ return item;
48
+ }), frontmostLiveToast = toasts.find((toast) => toast.status !== 'ending');
49
+ return {
50
+ frontmostHeight: normalizeToastHeight(frontmostLiveToast?.height),
51
+ items
52
+ };
53
+ }
54
+ function clearTimer(id) {
55
+ let timer = timers.get(id);
56
+ if (!timer) {
57
+ return;
58
+ }
59
+ if (timer.handle !== undefined) {
60
+ clearTimeout(timer.handle);
61
+ }
62
+ timers.delete(id);
63
+ }
64
+ function create(type, title, options = {}) {
65
+ let id = options.id ?? `toast-${++counter}`, toast = reactivity_u0.reactive({
66
+ action: options.action,
67
+ createdAt: Date.now(),
68
+ description: options.description,
69
+ dismissible: options.dismissible ?? true,
70
+ duration: options.duration ?? DURATIONS[type],
71
+ height: 0,
72
+ id,
73
+ priority: options.priority ?? 'low',
74
+ status: 'starting',
75
+ title,
76
+ type
77
+ });
78
+ toasts.push(toast);
79
+ queueMicrotask(() => {
80
+ if (toast.status === 'starting' && toasts.includes(toast)) {
81
+ toast.status = 'visible';
82
+ }
83
+ });
84
+ if (type !== 'loading' && toast.duration > 0) {
85
+ schedule(toast);
86
+ }
87
+ return id;
88
+ }
89
+ function dismiss(id) {
90
+ let toast = toasts.find((value) => value.id === id);
91
+ if (!toast || toast.status === 'ending') {
92
+ return;
93
+ }
94
+ clearTimer(id);
95
+ toast.status = 'ending';
96
+ setTimeout(() => remove(id), EXIT_DURATION);
97
+ }
98
+ function normalizeToastHeight(height) {
99
+ return typeof height === 'number' && Number.isFinite(height) && height > 0 ? height : 0;
100
+ }
101
+ function pause() {
102
+ for (let timer of timers.values()) {
103
+ if (timer.handle === undefined) {
104
+ continue;
105
+ }
106
+ clearTimeout(timer.handle);
107
+ timer.remaining = Math.max(0, timer.remaining - (performance.now() - timer.started));
108
+ timer.handle = undefined;
109
+ }
110
+ }
111
+ function remove(id) {
112
+ let index = toasts.findIndex((toast) => toast.id === id);
113
+ clearTimer(id);
114
+ if (index !== -1) {
115
+ toasts.splice(index, 1);
116
+ }
117
+ }
118
+ function resume() {
119
+ for (let [id, timer] of timers) {
120
+ if (timer.handle !== undefined) {
121
+ continue;
122
+ }
123
+ timer.started = performance.now();
124
+ timer.handle = setTimeout(() => dismiss(id), timer.remaining);
125
+ }
126
+ }
127
+ function schedule(toast) {
128
+ if (toast.duration <= 0) {
129
+ return;
130
+ }
131
+ if (state.active) {
132
+ timers.set(toast.id, {
133
+ handle: undefined,
134
+ remaining: toast.duration,
135
+ started: 0
136
+ });
137
+ return;
138
+ }
139
+ timers.set(toast.id, {
140
+ handle: setTimeout(() => dismiss(toast.id), toast.duration),
141
+ remaining: toast.duration,
142
+ started: performance.now()
143
+ });
144
+ }
145
+ function update(id, options) {
146
+ let toast = toasts.find((value) => value.id === id);
147
+ if (!toast) {
148
+ return;
149
+ }
150
+ if (options.action !== undefined) {
151
+ toast.action = options.action;
152
+ }
153
+ if (options.description !== undefined) {
154
+ toast.description = options.description;
155
+ }
156
+ if (options.dismissible !== undefined) {
157
+ toast.dismissible = options.dismissible;
158
+ }
159
+ if (options.priority !== undefined) {
160
+ toast.priority = options.priority;
161
+ }
162
+ if (options.duration !== undefined) {
163
+ toast.duration = options.duration;
164
+ clearTimer(id);
165
+ if (toast.type !== 'loading' && toast.duration > 0 && toast.status !== 'ending') {
166
+ schedule(toast);
167
+ }
168
+ }
169
+ }
170
+ const state = new ReactiveObject_0ktzs5p0();
171
+ const toasts = new ReactiveArray();
172
+ effect(() => {
173
+ let active = state.active;
174
+ if (active === paused) {
175
+ return;
176
+ }
177
+ paused = active;
178
+ if (active) {
179
+ pause();
180
+ }
181
+ else {
182
+ resume();
183
+ }
184
+ });
185
+ const toast = {
186
+ dismiss: (id) => {
187
+ if (id === undefined) {
188
+ for (let value of [...toasts]) {
189
+ dismiss(value.id);
190
+ }
191
+ return;
192
+ }
193
+ dismiss(id);
194
+ },
195
+ error: (title, options) => create('error', title, options),
196
+ info: (title, options) => create('info', title, options),
197
+ loading: (title, options) => create('loading', title, options),
198
+ message: (title, options) => create('message', title, options),
199
+ success: (title, options) => create('success', title, options),
200
+ update,
201
+ warning: (title, options) => create('warning', title, options)
202
+ };
203
+ export { buildVisibleToastLayout, remove, state, toast, toasts };
@@ -0,0 +1,2 @@
1
+ @layer components {.toaster{--toast-gap:var(--size-300);--toast-inset:var(--size-500);--toast-peek:var(--size-300)}.toast{--toast-calc-height:max(var(--toast-frontmost-height,var(--toast-height,0px)), var(--toast-height,0px));--toast-calc-offset-y:calc(var(--toast-offset-y,0px) + (var(--toast-index,0) * var(--toast-gap)) + var(--toast-swipe-y,0px));--toast-color:var(--color-text-300);--toast-height:0px;--toast-index:0;--toast-offset-y:0px;--toast-scale:max(0, 1 - (var(--toast-index,0) * .06));--toast-shrink:calc(1 - var(--toast-scale));--toast-swipe-x:0px;--toast-swipe-y:0px}.toaster{width:min(360px, 100% - var(--toast-inset) * 2);z-index:9999;position:fixed;inset:auto}.toaster[data-position^=top]{top:var(--toast-inset)}.toaster[data-position^=bottom]{bottom:var(--toast-inset)}.toaster[data-position$=left]{left:var(--toast-inset)}.toaster[data-position$=right]{right:var(--toast-inset)}.toaster[data-position$=center]{left:50%;transform:translate(-50%)}.toast{background:var(--background);border:1px solid var(--color-border-400);border-radius:var(--border-radius-500);box-shadow:var(--box-shadow-300);color:var(--color-text-400);transform:translateX(var(--toast-swipe-x)) translateY(calc(var(--toast-swipe-y) + var(--toast-index) * var(--toast-peek) + var(--toast-shrink) * var(--toast-calc-height))) scale(var(--toast-scale));-webkit-user-select:none;user-select:none;width:100%;z-index:calc(9999 - var(--toast-index,0));transition:transform .4s cubic-bezier(.22,1,.36,1),opacity .3s,height .2s;position:absolute;left:0;right:0;overflow:visible}[data-position*=top] .toast{transform-origin:top;top:0;bottom:auto}[data-position*=bottom] .toast{--toast-calc-offset-y:calc((var(--toast-offset-y,0px) * -1) + (var(--toast-index,0) * var(--toast-gap) * -1) + var(--toast-swipe-y,0px));transform:translateX(var(--toast-swipe-x)) translateY(calc(var(--toast-swipe-y) - var(--toast-index) * var(--toast-peek) - var(--toast-shrink) * var(--toast-calc-height))) scale(var(--toast-scale));transform-origin:bottom;top:auto;bottom:0}.toast:after{content:"";height:calc(var(--toast-gap) + 1px);width:100%;position:absolute;left:0}[data-position*=top] .toast:after{top:100%}[data-position*=bottom] .toast:after{bottom:100%}.toast-action{flex-shrink:0}.toast-close{background:var(--background);border:1px solid var(--color-border-400);border-radius:var(--border-radius-circle);color:var(--color-text-500);height:var(--size-500);right:calc(var(--size-200) * -1);top:calc(var(--size-200) * -1);width:var(--size-500);z-index:1;justify-content:center;align-items:center;display:flex;position:absolute}.toast-content{align-items:center;gap:var(--size-300);min-height:0;opacity:max(0, 1 - var(--toast-index,0));padding:var(--size-400);justify-content:space-between;transition:opacity .3s;display:flex;overflow:clip visible}.toast-copy{justify-content:center;align-items:center;display:inline-flex}.toast-description{color:var(--color-text-300);overflow-wrap:anywhere}.toast-description--clamp{-webkit-line-clamp:4;line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.toast-details{margin-top:var(--size-200);max-height:160px;overflow-y:auto}.toast-details-toggle{cursor:pointer;align-items:center;gap:var(--size-200);display:flex}.toast-icon{color:var(--toast-color);flex-shrink:0;width:18px;height:18px}.toast-title{font-weight:var(--font-weight-400);overflow-wrap:anywhere}.toast--error{--toast-color:var(--color-red-400);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toast--warning{--toast-color:var(--color-yellow-400);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toast--success{--toast-color:var(--color-green-400);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toast--info{--toast-color:var(--color-blue-400);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toast--loading{--toast-color:var(--color-grey-500);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toast--loading .toast-icon{animation:1s linear infinite toast-spin}.toast--message{--toast-color:var(--color-text-300);border-color:color-mix(in oklab, var(--toast-color) 30%, var(--color-border-400))}.toaster.--active .toast{height:auto;transform:translateX(var(--toast-swipe-x)) translateY(var(--toast-calc-offset-y))}.toaster.--active .toast-content{opacity:1}.toaster .toast.toast--starting{opacity:0}.toaster[data-position*=top] .toast.toast--starting{transform:translateY(-120%)}.toaster[data-position*=bottom] .toast.toast--starting{transform:translateY(120%)}.toaster .toast.toast--ending{opacity:0}.toaster[data-position*=top] .toast.toast--ending{transform:translateY(calc(-100% - var(--toast-inset)))}.toaster[data-position*=bottom] .toast.toast--ending{transform:translateY(calc(100% + var(--toast-inset)))}.toaster .toast.toast--ending[data-swipe-direction=left]{transform:translateX(calc(var(--toast-swipe-x) - 100% - var(--toast-inset))) translateY(var(--toast-calc-offset-y))}.toaster .toast.toast--ending[data-swipe-direction=right]{transform:translateX(calc(var(--toast-swipe-x) + 100% + var(--toast-inset))) translateY(var(--toast-calc-offset-y))}.toaster .toast.toast--ending[data-swipe-direction=up]{transform:translateY(calc(var(--toast-swipe-y) - 100% - var(--toast-inset)))}.toaster .toast.toast--ending[data-swipe-direction=down]{transform:translateY(calc(var(--toast-swipe-y) + 100% + var(--toast-inset)))}.toast--swiping{transition:none}@keyframes toast-spin{to{transform:rotate(360deg)}}}
2
+ /*$vite$:1*/
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>