svelte-multiselect 11.4.0 → 11.5.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.
@@ -1,547 +0,0 @@
1
- import {} from 'svelte/attachments';
2
- // Svelte 5 attachment factory to make an element draggable
3
- // @param options - Configuration options for dragging behavior
4
- // @returns Attachment function that sets up dragging on an element
5
- export const draggable = (options = {}) => (element) => {
6
- if (options.disabled)
7
- return;
8
- const node = element;
9
- // Use simple variables for maximum performance
10
- let dragging = false;
11
- let start = { x: 0, y: 0 };
12
- const initial = { left: 0, top: 0 };
13
- const handle = options.handle_selector
14
- ? node.querySelector(options.handle_selector)
15
- : node;
16
- if (!handle) {
17
- console.warn(`Draggable: handle not found with selector "${options.handle_selector}"`);
18
- return;
19
- }
20
- function handle_mousedown(event) {
21
- // Only drag if mousedown is on the handle or its children
22
- if (!handle?.contains?.(event.target))
23
- return;
24
- dragging = true;
25
- // For position: fixed elements, use getBoundingClientRect for viewport-relative position
26
- const computed_style = getComputedStyle(node);
27
- if (computed_style.position === `fixed`) {
28
- const rect = node.getBoundingClientRect();
29
- initial.left = rect.left;
30
- initial.top = rect.top;
31
- }
32
- else {
33
- // For other positioning, use offset values
34
- initial.left = node.offsetLeft;
35
- initial.top = node.offsetTop;
36
- }
37
- node.style.left = `${initial.left}px`;
38
- node.style.top = `${initial.top}px`;
39
- node.style.right = `auto`; // Prevent conflict with left
40
- start = { x: event.clientX, y: event.clientY };
41
- document.body.style.userSelect = `none`; // Prevent text selection during drag
42
- if (handle)
43
- handle.style.cursor = `grabbing`;
44
- globalThis.addEventListener(`mousemove`, handle_mousemove);
45
- globalThis.addEventListener(`mouseup`, handle_mouseup);
46
- options.on_drag_start?.(event); // Call optional callback
47
- }
48
- function handle_mousemove(event) {
49
- if (!dragging)
50
- return;
51
- // Use the exact same calculation as the fast old implementation
52
- const dx = event.clientX - start.x;
53
- const dy = event.clientY - start.y;
54
- node.style.left = `${initial.left + dx}px`;
55
- node.style.top = `${initial.top + dy}px`;
56
- // Only call callback if it exists (minimize overhead)
57
- if (options.on_drag)
58
- options.on_drag(event);
59
- }
60
- function handle_mouseup(event) {
61
- if (!dragging)
62
- return;
63
- dragging = false;
64
- event.stopPropagation();
65
- document.body.style.userSelect = ``;
66
- if (handle)
67
- handle.style.cursor = `grab`;
68
- globalThis.removeEventListener(`mousemove`, handle_mousemove);
69
- globalThis.removeEventListener(`mouseup`, handle_mouseup);
70
- options.on_drag_end?.(event); // Call optional callback
71
- }
72
- if (handle) {
73
- handle.addEventListener(`mousedown`, handle_mousedown);
74
- handle.style.cursor = `grab`;
75
- }
76
- // Return cleanup function (this is the attachment pattern)
77
- return () => {
78
- globalThis.removeEventListener(`mousemove`, handle_mousemove);
79
- globalThis.removeEventListener(`mouseup`, handle_mouseup);
80
- if (handle) {
81
- handle.removeEventListener(`mousedown`, handle_mousedown);
82
- handle.style.cursor = ``; // Reset cursor
83
- }
84
- };
85
- };
86
- export function get_html_sort_value(element) {
87
- if (element.dataset.sortValue !== undefined) {
88
- return element.dataset.sortValue;
89
- }
90
- for (const child of Array.from(element.children)) {
91
- const child_val = get_html_sort_value(child);
92
- if (child_val !== ``)
93
- return child_val;
94
- }
95
- return element.textContent ?? ``;
96
- }
97
- export const sortable = (options = {}) => (node) => {
98
- const { header_selector = `thead th`, asc_class = `table-sort-asc`, desc_class = `table-sort-desc`, sorted_style = { backgroundColor: `rgba(255, 255, 255, 0.1)` }, disabled = false, } = options;
99
- if (disabled)
100
- return;
101
- // This action can be applied to standard HTML tables to make them sortable by
102
- // clicking on column headers (and clicking again to toggle sorting direction)
103
- const headers = Array.from(node.querySelectorAll(header_selector));
104
- let sort_col_idx;
105
- let sort_dir = 1; // 1 = asc, -1 = desc
106
- // Store original state for cleanup
107
- const header_state = [];
108
- for (const [idx, header] of headers.entries()) {
109
- const original_text = header.textContent ?? ``;
110
- const original_style = header.getAttribute(`style`) ?? ``;
111
- header.style.cursor = `pointer`; // add cursor pointer to headers
112
- const click_handler = () => {
113
- // reset all headers to unsorted state
114
- for (const { header: hdr, original_text, original_style } of header_state) {
115
- hdr.textContent = original_text;
116
- hdr.classList.remove(asc_class, desc_class);
117
- if (original_style) {
118
- hdr.setAttribute(`style`, original_style);
119
- }
120
- else {
121
- hdr.removeAttribute(`style`);
122
- }
123
- hdr.style.cursor = `pointer`;
124
- }
125
- if (idx === sort_col_idx) {
126
- sort_dir *= -1; // reverse sort direction
127
- }
128
- else {
129
- sort_col_idx = idx; // set new sort column index
130
- sort_dir = 1; // reset sort direction
131
- }
132
- header.classList.add(sort_dir > 0 ? asc_class : desc_class);
133
- Object.assign(header.style, sorted_style);
134
- header.textContent = `${header.textContent?.replace(/ ↑| ↓/, ``)} ${sort_dir > 0 ? `↑` : `↓`}`;
135
- const table_body = node.querySelector(`tbody`);
136
- if (!table_body)
137
- return;
138
- // re-sort table
139
- const rows = Array.from(table_body.querySelectorAll(`tr`));
140
- rows.sort((row_1, row_2) => {
141
- const cell_1 = row_1.cells[sort_col_idx];
142
- const cell_2 = row_2.cells[sort_col_idx];
143
- const val_1 = get_html_sort_value(cell_1);
144
- const val_2 = get_html_sort_value(cell_2);
145
- if (val_1 === val_2)
146
- return 0;
147
- if (val_1 === ``)
148
- return 1; // treat empty string as lower than any value
149
- if (val_2 === ``)
150
- return -1; // any value is considered higher than empty string
151
- const num_1 = Number(val_1);
152
- const num_2 = Number(val_2);
153
- if (isNaN(num_1) && isNaN(num_2)) {
154
- return sort_dir * val_1.localeCompare(val_2, undefined, { numeric: true });
155
- }
156
- return sort_dir * (num_1 - num_2);
157
- });
158
- for (const row of rows)
159
- table_body.appendChild(row);
160
- };
161
- header.addEventListener(`click`, click_handler);
162
- header_state.push({ header, handler: click_handler, original_text, original_style });
163
- }
164
- // Return cleanup function that fully restores original state
165
- return () => {
166
- for (const { header, handler, original_text, original_style } of header_state) {
167
- header.removeEventListener(`click`, handler);
168
- header.textContent = original_text;
169
- header.classList.remove(asc_class, desc_class);
170
- if (original_style) {
171
- header.setAttribute(`style`, original_style);
172
- }
173
- else {
174
- header.removeAttribute(`style`);
175
- }
176
- }
177
- };
178
- };
179
- export const highlight_matches = (ops) => (node) => {
180
- const { query = ``, disabled = false, fuzzy = false, node_filter = () => NodeFilter.FILTER_ACCEPT, css_class = `highlight-match`, } = ops;
181
- // abort if CSS highlight API not supported
182
- if (typeof CSS === `undefined` || !CSS.highlights)
183
- return;
184
- // always clear our own highlight first
185
- CSS.highlights.delete(css_class);
186
- // if disabled or empty query, stop after cleanup
187
- if (!query || disabled)
188
- return;
189
- const tree_walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT, {
190
- acceptNode: node_filter,
191
- });
192
- const text_nodes = [];
193
- let current_node = tree_walker.nextNode();
194
- while (current_node) {
195
- text_nodes.push(current_node);
196
- current_node = tree_walker.nextNode();
197
- }
198
- // iterate over all text nodes and find matches
199
- const ranges = text_nodes.map((el) => {
200
- const text = el.textContent?.toLowerCase();
201
- if (!text)
202
- return [];
203
- const search = query.toLowerCase();
204
- if (fuzzy) {
205
- // Fuzzy highlighting: highlight individual characters that match in order
206
- const matching_indices = [];
207
- let search_idx = 0;
208
- let target_idx = 0;
209
- // Find matching character indices
210
- while (search_idx < search.length && target_idx < text.length) {
211
- if (search[search_idx] === text[target_idx]) {
212
- matching_indices.push(target_idx);
213
- search_idx++;
214
- }
215
- target_idx++;
216
- }
217
- // Only create ranges if we found all characters in order
218
- if (search_idx === search.length) {
219
- return matching_indices.map((index) => {
220
- const range = new Range();
221
- range.setStart(el, index);
222
- range.setEnd(el, index + 1); // highlight single character
223
- return range;
224
- });
225
- }
226
- return [];
227
- }
228
- else {
229
- // Substring highlighting: highlight consecutive substrings
230
- const indices = [];
231
- let start_pos = 0;
232
- while (start_pos < text.length) {
233
- const index = text.indexOf(search, start_pos);
234
- if (index === -1)
235
- break;
236
- indices.push(index);
237
- start_pos = index + search.length;
238
- }
239
- // create range object for each substring found in the text node
240
- return indices.map((index) => {
241
- const range = new Range();
242
- range.setStart(el, index);
243
- range.setEnd(el, index + search.length);
244
- return range;
245
- });
246
- }
247
- });
248
- // create Highlight object from ranges and add to registry
249
- CSS.highlights.set(css_class, new Highlight(...ranges.flat()));
250
- // Return cleanup function
251
- return () => CSS.highlights.delete(css_class);
252
- };
253
- // Global tooltip state to ensure only one tooltip is shown at a time
254
- let current_tooltip = null;
255
- let show_timeout;
256
- let hide_timeout;
257
- function clear_tooltip() {
258
- if (show_timeout)
259
- clearTimeout(show_timeout);
260
- if (hide_timeout)
261
- clearTimeout(hide_timeout);
262
- if (current_tooltip) {
263
- current_tooltip.remove();
264
- current_tooltip = null;
265
- }
266
- }
267
- export const tooltip = (options = {}) => (node) => {
268
- // Handle null/undefined elements
269
- if (!node || !(node instanceof HTMLElement))
270
- return;
271
- // Handle null/undefined options
272
- const safe_options = options || {};
273
- const cleanup_functions = [];
274
- function setup_tooltip(element) {
275
- if (!element || safe_options.disabled)
276
- return;
277
- // Use let so content can be updated reactively
278
- let content = safe_options.content || element.title ||
279
- element.getAttribute(`aria-label`) || element.getAttribute(`data-title`);
280
- if (!content)
281
- return;
282
- // Store original title and remove it to prevent default tooltip
283
- // Only store title if we're not using custom content
284
- if (element.title && !safe_options.content) {
285
- element.setAttribute(`data-original-title`, element.title);
286
- element.removeAttribute(`title`);
287
- }
288
- // Reactively update content when tooltip attributes change
289
- const tooltip_attrs = [`title`, `aria-label`, `data-title`];
290
- const observer = new MutationObserver((mutations) => {
291
- if (safe_options.content)
292
- return; // custom content takes precedence
293
- for (const { type, attributeName } of mutations) {
294
- if (type !== `attributes` || !attributeName)
295
- continue;
296
- const new_content = element.getAttribute(attributeName);
297
- // null = attribute removed (by us), skip entirely
298
- if (new_content === null)
299
- continue;
300
- // Always remove title to prevent browser's native tooltip (even if empty)
301
- // Disconnect observer temporarily to avoid re-entrancy from our own removal
302
- if (attributeName === `title`) {
303
- observer.disconnect();
304
- element.removeAttribute(`title`);
305
- observer.observe(element, { attributes: true, attributeFilter: tooltip_attrs });
306
- }
307
- // Only update content if non-empty
308
- if (!new_content)
309
- continue;
310
- content = new_content;
311
- // Only update tooltip if this element owns it
312
- if (current_tooltip?._owner === element) {
313
- current_tooltip.innerHTML = content.replace(/\r/g, `<br/>`);
314
- }
315
- }
316
- });
317
- observer.observe(element, { attributes: true, attributeFilter: tooltip_attrs });
318
- function show_tooltip() {
319
- clear_tooltip();
320
- show_timeout = setTimeout(() => {
321
- const tooltip = document.createElement(`div`);
322
- tooltip.className = `custom-tooltip`;
323
- const placement = safe_options.placement || `bottom`;
324
- tooltip.setAttribute(`data-placement`, placement);
325
- // Apply base styles
326
- tooltip.style.cssText = `
327
- position: absolute; z-index: 9999; opacity: 0;
328
- background: var(--tooltip-bg, #333); color: var(--text-color, white); border: var(--tooltip-border, none);
329
- padding: var(--tooltip-padding, 6px 10px); border-radius: var(--tooltip-radius, 6px); font-size: var(--tooltip-font-size, 13px); line-height: 1.4;
330
- max-width: var(--tooltip-max-width, 280px); word-wrap: break-word; text-wrap: balance; pointer-events: none;
331
- filter: var(--tooltip-shadow, drop-shadow(0 2px 8px rgba(0,0,0,0.25))); transition: opacity 0.15s ease-out;
332
- `;
333
- // Apply custom styles if provided (these will override base styles due to CSS specificity)
334
- if (safe_options.style) {
335
- // Parse and apply custom styles as individual properties for better control
336
- const custom_styles = safe_options.style.split(`;`).filter((style) => style.trim());
337
- custom_styles.forEach((style) => {
338
- const [property, value] = style.split(`:`).map((s) => s.trim());
339
- if (property && value)
340
- tooltip.style.setProperty(property, value);
341
- });
342
- }
343
- tooltip.innerHTML = content?.replace(/\r/g, `<br/>`) ?? ``;
344
- // Mirror CSS custom properties from the trigger node onto the tooltip element
345
- const trigger_styles = getComputedStyle(element);
346
- [
347
- `--tooltip-bg`,
348
- `--text-color`,
349
- `--tooltip-border`,
350
- `--tooltip-padding`,
351
- `--tooltip-radius`,
352
- `--tooltip-font-size`,
353
- `--tooltip-shadow`,
354
- `--tooltip-max-width`,
355
- `--tooltip-opacity`,
356
- `--tooltip-arrow-size`,
357
- ].forEach((name) => {
358
- const value = trigger_styles.getPropertyValue(name).trim();
359
- if (value)
360
- tooltip.style.setProperty(name, value);
361
- });
362
- // Append early so we can read computed border styles for arrow border
363
- document.body.appendChild(tooltip);
364
- // Arrow elements: optional border triangle behind fill triangle
365
- const tooltip_styles = getComputedStyle(tooltip);
366
- const arrow = document.createElement(`div`);
367
- arrow.className = `custom-tooltip-arrow`;
368
- arrow.style.cssText =
369
- `position: absolute; width: 0; height: 0; pointer-events: none;`;
370
- const arrow_size_raw = trigger_styles.getPropertyValue(`--tooltip-arrow-size`)
371
- .trim();
372
- const arrow_size_num = Number.parseInt(arrow_size_raw || ``, 10);
373
- const arrow_px = Number.isFinite(arrow_size_num) ? arrow_size_num : 6;
374
- const border_color = tooltip_styles.borderTopColor;
375
- const border_width_num = Number.parseFloat(tooltip_styles.borderTopWidth || `0`);
376
- const has_border = !!border_color && border_color !== `rgba(0, 0, 0, 0)` &&
377
- border_width_num > 0;
378
- const maybe_append_border_arrow = () => {
379
- if (!has_border)
380
- return;
381
- const border_arrow = document.createElement(`div`);
382
- border_arrow.className = `custom-tooltip-arrow-border`;
383
- border_arrow.style.cssText =
384
- `position: absolute; width: 0; height: 0; pointer-events: none;`;
385
- const border_size = arrow_px + (border_width_num * 1.4);
386
- if (placement === `top`) {
387
- border_arrow.style.left = `calc(50% - ${border_size}px)`;
388
- border_arrow.style.bottom = `-${border_size}px`;
389
- border_arrow.style.borderLeft = `${border_size}px solid transparent`;
390
- border_arrow.style.borderRight = `${border_size}px solid transparent`;
391
- border_arrow.style.borderTop = `${border_size}px solid ${border_color}`;
392
- }
393
- else if (placement === `left`) {
394
- border_arrow.style.top = `calc(50% - ${border_size}px)`;
395
- border_arrow.style.right = `-${border_size}px`;
396
- border_arrow.style.borderTop = `${border_size}px solid transparent`;
397
- border_arrow.style.borderBottom = `${border_size}px solid transparent`;
398
- border_arrow.style.borderLeft = `${border_size}px solid ${border_color}`;
399
- }
400
- else if (placement === `right`) {
401
- border_arrow.style.top = `calc(50% - ${border_size}px)`;
402
- border_arrow.style.left = `-${border_size}px`;
403
- border_arrow.style.borderTop = `${border_size}px solid transparent`;
404
- border_arrow.style.borderBottom = `${border_size}px solid transparent`;
405
- border_arrow.style.borderRight = `${border_size}px solid ${border_color}`;
406
- }
407
- else { // bottom
408
- border_arrow.style.left = `calc(50% - ${border_size}px)`;
409
- border_arrow.style.top = `-${border_size}px`;
410
- border_arrow.style.borderLeft = `${border_size}px solid transparent`;
411
- border_arrow.style.borderRight = `${border_size}px solid transparent`;
412
- border_arrow.style.borderBottom = `${border_size}px solid ${border_color}`;
413
- }
414
- tooltip.appendChild(border_arrow);
415
- };
416
- // Create the fill arrow on top
417
- if (placement === `top`) {
418
- arrow.style.left = `calc(50% - ${arrow_px}px)`;
419
- arrow.style.bottom = `-${arrow_px}px`;
420
- arrow.style.borderLeft = `${arrow_px}px solid transparent`;
421
- arrow.style.borderRight = `${arrow_px}px solid transparent`;
422
- arrow.style.borderTop = `${arrow_px}px solid var(--tooltip-bg, #333)`;
423
- }
424
- else if (placement === `left`) {
425
- arrow.style.top = `calc(50% - ${arrow_px}px)`;
426
- arrow.style.right = `-${arrow_px}px`;
427
- arrow.style.borderTop = `${arrow_px}px solid transparent`;
428
- arrow.style.borderBottom = `${arrow_px}px solid transparent`;
429
- arrow.style.borderLeft = `${arrow_px}px solid var(--tooltip-bg, #333)`;
430
- }
431
- else if (placement === `right`) {
432
- arrow.style.top = `calc(50% - ${arrow_px}px)`;
433
- arrow.style.left = `-${arrow_px}px`;
434
- arrow.style.borderTop = `${arrow_px}px solid transparent`;
435
- arrow.style.borderBottom = `${arrow_px}px solid transparent`;
436
- arrow.style.borderRight = `${arrow_px}px solid var(--tooltip-bg, #333)`;
437
- }
438
- else { // bottom
439
- arrow.style.left = `calc(50% - ${arrow_px}px)`;
440
- arrow.style.top = `-${arrow_px}px`;
441
- arrow.style.borderLeft = `${arrow_px}px solid transparent`;
442
- arrow.style.borderRight = `${arrow_px}px solid transparent`;
443
- arrow.style.borderBottom = `${arrow_px}px solid var(--tooltip-bg, #333)`;
444
- }
445
- maybe_append_border_arrow();
446
- tooltip.appendChild(arrow);
447
- // Position tooltip
448
- const rect = element.getBoundingClientRect();
449
- const tooltip_rect = tooltip.getBoundingClientRect();
450
- const margin = 12;
451
- let top = 0, left = 0;
452
- if (placement === `top`) {
453
- top = rect.top - tooltip_rect.height - margin;
454
- left = rect.left + rect.width / 2 - tooltip_rect.width / 2;
455
- }
456
- else if (placement === `left`) {
457
- top = rect.top + rect.height / 2 - tooltip_rect.height / 2;
458
- left = rect.left - tooltip_rect.width - margin;
459
- }
460
- else if (placement === `right`) {
461
- top = rect.top + rect.height / 2 - tooltip_rect.height / 2;
462
- left = rect.right + margin;
463
- }
464
- else { // bottom
465
- top = rect.bottom + margin;
466
- left = rect.left + rect.width / 2 - tooltip_rect.width / 2;
467
- }
468
- // Keep in viewport
469
- left = Math.max(8, Math.min(left, globalThis.innerWidth - tooltip_rect.width - 8));
470
- top = Math.max(8, Math.min(top, globalThis.innerHeight - tooltip_rect.height - 8));
471
- tooltip.style.left = `${left + globalThis.scrollX}px`;
472
- tooltip.style.top = `${top + globalThis.scrollY}px`;
473
- const custom_opacity = trigger_styles.getPropertyValue(`--tooltip-opacity`).trim();
474
- tooltip.style.opacity = custom_opacity || `1`;
475
- current_tooltip = Object.assign(tooltip, { _owner: element });
476
- }, safe_options.delay || 100);
477
- }
478
- function hide_tooltip() {
479
- clear_tooltip();
480
- if (current_tooltip) {
481
- current_tooltip.style.opacity = `0`;
482
- if (current_tooltip) {
483
- current_tooltip.remove();
484
- current_tooltip = null;
485
- }
486
- }
487
- }
488
- function handle_scroll(event) {
489
- // Hide if document or any ancestor scrolls (would move element). Skip internal element scrolls.
490
- const target = event.target;
491
- if (target instanceof Node && target !== element && target.contains(element)) {
492
- hide_tooltip();
493
- }
494
- }
495
- const events = [`mouseenter`, `mouseleave`, `focus`, `blur`];
496
- const handlers = [show_tooltip, hide_tooltip, show_tooltip, hide_tooltip];
497
- events.forEach((event, idx) => element.addEventListener(event, handlers[idx]));
498
- // Hide tooltip when user scrolls the page (not element-level scrolls like input fields)
499
- globalThis.addEventListener(`scroll`, handle_scroll, true);
500
- return () => {
501
- observer.disconnect();
502
- events.forEach((event, idx) => element.removeEventListener(event, handlers[idx]));
503
- globalThis.removeEventListener(`scroll`, handle_scroll, true);
504
- const original_title = element.getAttribute(`data-original-title`);
505
- if (original_title) {
506
- element.setAttribute(`title`, original_title);
507
- element.removeAttribute(`data-original-title`);
508
- }
509
- };
510
- }
511
- // Setup tooltip for main node and children
512
- const main_cleanup = setup_tooltip(node);
513
- if (main_cleanup)
514
- cleanup_functions.push(main_cleanup);
515
- node.querySelectorAll(`[title], [aria-label], [data-title]`).forEach((element) => {
516
- const child_cleanup = setup_tooltip(element);
517
- if (child_cleanup)
518
- cleanup_functions.push(child_cleanup);
519
- });
520
- if (cleanup_functions.length === 0)
521
- return;
522
- return () => {
523
- cleanup_functions.forEach((cleanup) => cleanup());
524
- clear_tooltip();
525
- };
526
- };
527
- export const click_outside = (config = {}) => (node) => {
528
- const { callback, enabled = true, exclude = [] } = config;
529
- if (!enabled)
530
- return; // Early return avoids registering unused listener
531
- function handle_click(event) {
532
- const target = event.target;
533
- const path = event.composedPath();
534
- // Check if click target is the node or inside it
535
- if (path.includes(node))
536
- return;
537
- // Check excluded selectors
538
- if (exclude.some((selector) => target.closest(selector)))
539
- return;
540
- // Execute callback if provided, passing node and full config
541
- callback?.(node, { callback, enabled, exclude });
542
- // Dispatch custom event if click was outside
543
- node.dispatchEvent(new CustomEvent(`outside-click`));
544
- }
545
- document.addEventListener(`click`, handle_click, true);
546
- return () => document.removeEventListener(`click`, handle_click, true);
547
- };
package/dist/icons.d.ts DELETED
@@ -1,47 +0,0 @@
1
- export declare const icon_data: {
2
- readonly Alert: {
3
- readonly viewBox: "0 0 16 16";
4
- readonly path: "M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z";
5
- };
6
- readonly Check: {
7
- readonly viewBox: "0 0 12 16";
8
- readonly path: "M12 5l-8 8l-4-4l1.5-1.5L4 10l6.5-6.5L12 5z";
9
- };
10
- readonly ChevronExpand: {
11
- readonly viewBox: "0 0 16 16";
12
- readonly path: "M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708zm0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708z";
13
- };
14
- readonly Collapse: {
15
- readonly viewBox: "0 0 24 24";
16
- readonly path: "M12 7.59L7.05 2.64L5.64 4.05L12 10.41l6.36-6.36l-1.41-1.41L12 7.59zM5.64 19.95l1.41 1.41L12 16.41l4.95 4.95l1.41-1.41L12 13.59l-6.36 6.36z";
17
- };
18
- readonly Copy: {
19
- readonly viewBox: "0 0 16 16";
20
- readonly path: "M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z";
21
- };
22
- readonly Cross: {
23
- readonly viewBox: "0 0 24 24";
24
- readonly path: "M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59L7.11 5.7A.996.996 0 1 0 5.7 7.11L10.59 12L5.7 16.89a.996.996 0 1 0 1.41 1.41L12 13.41l4.89 4.89a.996.996 0 1 0 1.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z";
25
- };
26
- readonly Disabled: {
27
- readonly viewBox: "0 0 24 24";
28
- readonly path: "M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10Zm-4.906-3.68L18.32 7.094A8 8 0 0 1 7.094 18.32ZM5.68 16.906A8 8 0 0 1 16.906 5.68L5.68 16.906Z";
29
- };
30
- readonly Expand: {
31
- readonly viewBox: "0 0 24 24";
32
- readonly path: "m12 19.24l-4.95-4.95l-1.41 1.42L12 22.07l6.36-6.36l-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95l1.41-1.42L12 1.93L5.64 8.29z";
33
- };
34
- readonly GitHub: {
35
- readonly viewBox: "0 0 24 24";
36
- readonly path: "M8.422 20.081c0 .896.01 1.753.016 2.285a.617.617 0 0 0 .422.58c2.078.686 4.317.718 6.414.091l.292-.087a.67.67 0 0 0 .478-.638c.005-.733.017-2.017.017-3.53c0-1.372-.477-2.25-1.031-2.707c3.399-.366 6.97-1.61 6.97-7.227c0-1.61-.592-2.91-1.566-3.934c.153-.366.688-1.866-.153-3.878c0 0-1.28-.403-4.201 1.5a14.76 14.76 0 0 0-3.82-.494c-1.298 0-2.597.165-3.819.494C5.52.65 4.24 1.036 4.24 1.036c-.84 2.012-.306 3.512-.153 3.878a5.565 5.565 0 0 0-1.566 3.934c0 5.598 3.552 6.86 6.951 7.227c-.439.366-.84 1.006-.973 1.957c-.879.384-3.075 1.006-4.45-1.207c-.286-.44-1.146-1.519-2.349-1.5c-1.28.018-.516.695.02.97c.648.347 1.393 1.646 1.565 2.067c.306.823 1.299 2.396 5.137 1.72Z";
37
- };
38
- readonly StackBlitz: {
39
- readonly viewBox: "0 0 24 24";
40
- readonly path: "M10.797 14.182H3.635L16.728 0l-3.525 9.818h7.162L7.272 24l3.524-9.818Z";
41
- };
42
- readonly Svelte: {
43
- readonly viewBox: "0 0 24 24";
44
- readonly path: "M10.354 21.125a4.44 4.44 0 0 1-4.765-1.767a4.109 4.109 0 0 1-.703-3.107a3.898 3.898 0 0 1 .134-.522l.105-.321l.287.21a7.21 7.21 0 0 0 2.186 1.092l.208.063l-.02.208a1.253 1.253 0 0 0 .226.83a1.337 1.337 0 0 0 1.435.533a1.231 1.231 0 0 0 .343-.15l5.59-3.562a1.164 1.164 0 0 0 .524-.778a1.242 1.242 0 0 0-.211-.937a1.338 1.338 0 0 0-1.435-.533a1.23 1.23 0 0 0-.343.15l-2.133 1.36a4.078 4.078 0 0 1-1.135.499a4.44 4.44 0 0 1-4.765-1.766a4.108 4.108 0 0 1-.702-3.108a3.855 3.855 0 0 1 1.742-2.582l5.589-3.563a4.072 4.072 0 0 1 1.135-.499a4.44 4.44 0 0 1 4.765 1.767a4.109 4.109 0 0 1 .703 3.107a3.943 3.943 0 0 1-.134.522l-.105.321l-.286-.21a7.204 7.204 0 0 0-2.187-1.093l-.208-.063l.02-.207a1.255 1.255 0 0 0-.226-.831a1.337 1.337 0 0 0-1.435-.532a1.231 1.231 0 0 0-.343.15L8.62 9.368a1.162 1.162 0 0 0-.524.778a1.24 1.24 0 0 0 .211.937a1.338 1.338 0 0 0 1.435.533a1.235 1.235 0 0 0 .344-.151l2.132-1.36a4.067 4.067 0 0 1 1.135-.498a4.44 4.44 0 0 1 4.765 1.766a4.108 4.108 0 0 1 .702 3.108a3.857 3.857 0 0 1-1.742 2.583l-5.589 3.562a4.072 4.072 0 0 1-1.135.499m10.358-17.95C18.484-.015 14.082-.96 10.9 1.068L5.31 4.63a6.412 6.412 0 0 0-2.896 4.295a6.753 6.753 0 0 0 .666 4.336a6.43 6.43 0 0 0-.96 2.396a6.833 6.833 0 0 0 1.168 5.167c2.229 3.19 6.63 4.135 9.812 2.108l5.59-3.562a6.41 6.41 0 0 0 2.896-4.295a6.756 6.756 0 0 0-.665-4.336a6.429 6.429 0 0 0 .958-2.396a6.831 6.831 0 0 0-1.167-5.168Z";
45
- };
46
- };
47
- export type IconName = keyof typeof icon_data;
package/dist/icons.js DELETED
@@ -1,46 +0,0 @@
1
- export const icon_data = {
2
- Alert: {
3
- viewBox: `0 0 16 16`,
4
- path: `M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z`,
5
- },
6
- Check: {
7
- viewBox: `0 0 12 16`,
8
- path: `M12 5l-8 8l-4-4l1.5-1.5L4 10l6.5-6.5L12 5z`,
9
- },
10
- ChevronExpand: {
11
- viewBox: `0 0 16 16`,
12
- path: `M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708zm0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708z`,
13
- },
14
- Collapse: {
15
- viewBox: `0 0 24 24`,
16
- path: `M12 7.59L7.05 2.64L5.64 4.05L12 10.41l6.36-6.36l-1.41-1.41L12 7.59zM5.64 19.95l1.41 1.41L12 16.41l4.95 4.95l1.41-1.41L12 13.59l-6.36 6.36z`,
17
- },
18
- Copy: {
19
- viewBox: `0 0 16 16`,
20
- path: `M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z`,
21
- },
22
- Cross: {
23
- viewBox: `0 0 24 24`,
24
- path: `M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59L7.11 5.7A.996.996 0 1 0 5.7 7.11L10.59 12L5.7 16.89a.996.996 0 1 0 1.41 1.41L12 13.41l4.89 4.89a.996.996 0 1 0 1.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z`,
25
- },
26
- Disabled: {
27
- viewBox: `0 0 24 24`,
28
- path: `M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10Zm-4.906-3.68L18.32 7.094A8 8 0 0 1 7.094 18.32ZM5.68 16.906A8 8 0 0 1 16.906 5.68L5.68 16.906Z`,
29
- },
30
- Expand: {
31
- viewBox: `0 0 24 24`,
32
- path: `m12 19.24l-4.95-4.95l-1.41 1.42L12 22.07l6.36-6.36l-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95l1.41-1.42L12 1.93L5.64 8.29z`,
33
- },
34
- GitHub: {
35
- viewBox: `0 0 24 24`,
36
- path: `M8.422 20.081c0 .896.01 1.753.016 2.285a.617.617 0 0 0 .422.58c2.078.686 4.317.718 6.414.091l.292-.087a.67.67 0 0 0 .478-.638c.005-.733.017-2.017.017-3.53c0-1.372-.477-2.25-1.031-2.707c3.399-.366 6.97-1.61 6.97-7.227c0-1.61-.592-2.91-1.566-3.934c.153-.366.688-1.866-.153-3.878c0 0-1.28-.403-4.201 1.5a14.76 14.76 0 0 0-3.82-.494c-1.298 0-2.597.165-3.819.494C5.52.65 4.24 1.036 4.24 1.036c-.84 2.012-.306 3.512-.153 3.878a5.565 5.565 0 0 0-1.566 3.934c0 5.598 3.552 6.86 6.951 7.227c-.439.366-.84 1.006-.973 1.957c-.879.384-3.075 1.006-4.45-1.207c-.286-.44-1.146-1.519-2.349-1.5c-1.28.018-.516.695.02.97c.648.347 1.393 1.646 1.565 2.067c.306.823 1.299 2.396 5.137 1.72Z`,
37
- },
38
- StackBlitz: {
39
- viewBox: `0 0 24 24`,
40
- path: `M10.797 14.182H3.635L16.728 0l-3.525 9.818h7.162L7.272 24l3.524-9.818Z`,
41
- },
42
- Svelte: {
43
- viewBox: `0 0 24 24`,
44
- path: `M10.354 21.125a4.44 4.44 0 0 1-4.765-1.767a4.109 4.109 0 0 1-.703-3.107a3.898 3.898 0 0 1 .134-.522l.105-.321l.287.21a7.21 7.21 0 0 0 2.186 1.092l.208.063l-.02.208a1.253 1.253 0 0 0 .226.83a1.337 1.337 0 0 0 1.435.533a1.231 1.231 0 0 0 .343-.15l5.59-3.562a1.164 1.164 0 0 0 .524-.778a1.242 1.242 0 0 0-.211-.937a1.338 1.338 0 0 0-1.435-.533a1.23 1.23 0 0 0-.343.15l-2.133 1.36a4.078 4.078 0 0 1-1.135.499a4.44 4.44 0 0 1-4.765-1.766a4.108 4.108 0 0 1-.702-3.108a3.855 3.855 0 0 1 1.742-2.582l5.589-3.563a4.072 4.072 0 0 1 1.135-.499a4.44 4.44 0 0 1 4.765 1.767a4.109 4.109 0 0 1 .703 3.107a3.943 3.943 0 0 1-.134.522l-.105.321l-.286-.21a7.204 7.204 0 0 0-2.187-1.093l-.208-.063l.02-.207a1.255 1.255 0 0 0-.226-.831a1.337 1.337 0 0 0-1.435-.532a1.231 1.231 0 0 0-.343.15L8.62 9.368a1.162 1.162 0 0 0-.524.778a1.24 1.24 0 0 0 .211.937a1.338 1.338 0 0 0 1.435.533a1.235 1.235 0 0 0 .344-.151l2.132-1.36a4.067 4.067 0 0 1 1.135-.498a4.44 4.44 0 0 1 4.765 1.766a4.108 4.108 0 0 1 .702 3.108a3.857 3.857 0 0 1-1.742 2.583l-5.589 3.562a4.072 4.072 0 0 1-1.135.499m10.358-17.95C18.484-.015 14.082-.96 10.9 1.068L5.31 4.63a6.412 6.412 0 0 0-2.896 4.295a6.753 6.753 0 0 0 .666 4.336a6.43 6.43 0 0 0-.96 2.396a6.833 6.833 0 0 0 1.168 5.167c2.229 3.19 6.63 4.135 9.812 2.108l5.59-3.562a6.41 6.41 0 0 0 2.896-4.295a6.756 6.756 0 0 0-.665-4.336a6.429 6.429 0 0 0 .958-2.396a6.831 6.831 0 0 0-1.167-5.168Z`,
45
- },
46
- };
package/dist/index.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export * from './attachments';
2
- export { default as CircleSpinner } from './CircleSpinner.svelte';
3
- export { default as CmdPalette } from './CmdPalette.svelte';
4
- export { default as CodeExample } from './CodeExample.svelte';
5
- export { default as CopyButton } from './CopyButton.svelte';
6
- export { default as FileDetails } from './FileDetails.svelte';
7
- export { default as GitHubCorner } from './GitHubCorner.svelte';
8
- export { default as Icon } from './Icon.svelte';
9
- export { default, default as MultiSelect } from './MultiSelect.svelte';
10
- export { default as Nav } from './Nav.svelte';
11
- export { default as PrevNext } from './PrevNext.svelte';
12
- export { default as Toggle } from './Toggle.svelte';
13
- export * from './types';
14
- export * from './utils';
15
- export { default as Wiggle } from './Wiggle.svelte';
16
- export declare function scroll_into_view_if_needed_polyfill(element: Element, centerIfNeeded?: boolean): IntersectionObserver;