@x33025/sveltely 0.0.40 → 0.0.42

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.
@@ -233,8 +233,8 @@
233
233
 
234
234
  <div
235
235
  bind:this={rootEl}
236
- class="chip-row flex w-full flex-wrap items-center"
237
- class:chip-disabled={disabled}
236
+ class="chip-input hstack w-full flex-wrap items-center"
237
+ class:chip-input-disabled={disabled}
238
238
  aria-disabled={disabled}
239
239
  >
240
240
  {#each tags as tag, index (tag)}
@@ -243,7 +243,7 @@
243
243
  bind:this={editingEl}
244
244
  bind:value={editingValue}
245
245
  size={Math.max(editingValue.length, 1)}
246
- class="chip-surface chip-input-field outline-none"
246
+ class="chip chip-input-field outline-none"
247
247
  {disabled}
248
248
  onblur={() => commitEdit('blur', tag)}
249
249
  onkeydown={(event) => onEditKeydown(event, tag)}
@@ -251,7 +251,7 @@
251
251
  {:else if selectionEnabled}
252
252
  <button
253
253
  type="button"
254
- class="chip-surface inline-flex items-center gap-2"
254
+ class="chip inline-flex items-center gap-2"
255
255
  class:chip-selected={selection?.includes(tag)}
256
256
  class:chip-hovered={isPointerSelecting && dragHoverIndex === index}
257
257
  onpointerdown={(event) => beginRangeSelection(event, index)}
@@ -266,7 +266,7 @@
266
266
  {:else}
267
267
  <button
268
268
  type="button"
269
- class="chip-surface inline-flex items-center gap-2"
269
+ class="chip inline-flex items-center gap-2"
270
270
  {disabled}
271
271
  ondblclick={() => startEditing(tag)}>{tag}</button
272
272
  >
@@ -278,7 +278,7 @@
278
278
  bind:this={inputEl}
279
279
  bind:value={inputValue}
280
280
  size={Math.max(inputValue.length, placeholder.length, 1)}
281
- class="chip-surface chip-input-field outline-none"
281
+ class="chip chip-input-field outline-none"
282
282
  {placeholder}
283
283
  {disabled}
284
284
  onkeydown={onKeydown}
@@ -287,12 +287,12 @@
287
287
  {:else}
288
288
  <button
289
289
  type="button"
290
- class="chip-surface chip-input-action inline-flex items-center justify-center font-semibold"
290
+ class="chip chip-input-action inline-flex items-center justify-center font-semibold"
291
291
  aria-label="Add tag"
292
292
  {disabled}
293
293
  onclick={openInput}
294
294
  >
295
- <Plus style="width: var(--chip-input-font-size); height: var(--chip-input-font-size);" />
295
+ <Plus class="size-3" />
296
296
  </button>
297
297
  {/if}
298
298
 
@@ -300,48 +300,3 @@
300
300
  {@render action()}
301
301
  {/if}
302
302
  </div>
303
-
304
- <style>
305
- .chip-row {
306
- gap: var(--chip-input-gap);
307
- }
308
-
309
- .chip-surface {
310
- background: var(--chip-input-background);
311
- color: var(--chip-input-text);
312
- font-size: var(--chip-input-font-size);
313
- border-radius: var(--chip-input-border-radius);
314
- padding: var(--chip-input-padding);
315
- border: 1px solid var(--chip-input-border-color);
316
- white-space: nowrap;
317
- }
318
-
319
- .chip-selected {
320
- border-color: var(--chip-input-highlight);
321
- }
322
-
323
- .chip-surface:hover {
324
- background: var(--chip-input-hover);
325
- }
326
-
327
- .chip-hovered {
328
- background: var(--chip-input-hover);
329
- }
330
-
331
- .chip-input-field:hover {
332
- background: var(--chip-input-background);
333
- }
334
-
335
- .chip-disabled .chip-surface {
336
- cursor: not-allowed;
337
- opacity: 0.55;
338
- }
339
-
340
- .chip-disabled {
341
- pointer-events: none;
342
- }
343
-
344
- .chip-disabled .chip-surface:hover {
345
- background: var(--chip-input-background);
346
- }
347
- </style>
@@ -187,7 +187,7 @@
187
187
  function handleOutsideClick(event: MouseEvent) {
188
188
  if (!isOpen) return;
189
189
  const target = event.target as HTMLElement;
190
- if (target.closest('.dropdown-container') || target.closest('.dropdown-menu')) return;
190
+ if (target.closest('[data-dropdown-root]') || target.closest('[data-dropdown]')) return;
191
191
  close();
192
192
  }
193
193
 
@@ -230,7 +230,7 @@
230
230
  onmousemove={handlePointerMove}
231
231
  />
232
232
 
233
- <div class="dropdown-container relative inline-block text-left {className}">
233
+ <div class="relative inline-block text-left {className}" data-dropdown-root>
234
234
  <div bind:this={triggerEl}>
235
235
  <button
236
236
  type="button"
@@ -246,21 +246,16 @@
246
246
  {#if isOpen}
247
247
  <div
248
248
  use:portalContent
249
- class="dropdown-menu fixed z-50 border border-gray-200 focus:outline-none"
249
+ class="dropdown fixed z-50 overflow-auto focus:outline-none"
250
+ data-dropdown
250
251
  style="top: {menuCoords.top}px; left: {menuCoords.left}px; transform: {menuTransform}; border-radius: {computedMenuRadius ??
251
- 'var(--dropdown-border-radius)'}; background: var(--dropdown-background); box-shadow: var(--dropdown-shadow);"
252
+ '0.375rem'};"
252
253
  role="menu"
253
254
  aria-orientation="vertical"
254
255
  tabindex="-1"
255
256
  bind:this={menuEl}
256
257
  >
257
- <div
258
- class="overflow-auto"
259
- style="padding: var(--dropdown-content-padding);"
260
- role="none"
261
- onclick={handleSelect}
262
- bind:this={contentEl}
263
- >
258
+ <div role="none" onclick={handleSelect} bind:this={contentEl}>
264
259
  {@render children()}
265
260
  </div>
266
261
  </div>
@@ -25,11 +25,7 @@
25
25
  }
26
26
  </script>
27
27
 
28
- <button
29
- onclick={handleClick}
30
- class="rounded p-1.5 hover:bg-zinc-100 {className}"
31
- title="Toggle {side} sidebar"
32
- >
28
+ <button onclick={handleClick} class="sidebar-toggle {className}" title="Toggle {side} sidebar">
33
29
  {#if children}
34
30
  {@render children()}
35
31
  {:else if side === 'left'}
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
2
  import { goto } from '$app/navigation';
3
3
  import {
4
- ArrowLeftIcon,
5
- ArrowRightIcon,
4
+ ChevronLeftIcon,
5
+ ChevronRightIcon,
6
6
  ChevronsLeftIcon,
7
7
  ChevronsRightIcon
8
8
  } from '@lucide/svelte';
@@ -41,6 +41,11 @@
41
41
  const maxPage = () => Math.max(1, data.totalPages);
42
42
  const safePage = () => Math.min(Math.max(data.page, 1), maxPage());
43
43
  const hasNext = () => (typeof data.hasNext === 'boolean' ? data.hasNext : safePage() < maxPage());
44
+ const hasPrevious = () => safePage() > 1;
45
+ const buttonClass = () =>
46
+ `pagination-button action disabled:bg-zinc-200 disabled:text-zinc-500 inline-flex items-center justify-center leading-none ${
47
+ styleMode === 'icon' ? 'h-8 w-8 p-0' : 'padding-sm'
48
+ }`;
44
49
 
45
50
  const goToPage = (targetPage: number) => {
46
51
  const clamped = clampedPage(targetPage);
@@ -67,55 +72,37 @@
67
72
  };
68
73
  </script>
69
74
 
70
- <div class={`hstack items-center ${className}`} style="gap: var(--pagination-gap);">
75
+ <div class={`pagination hstack items-center ${className}`}>
71
76
  {#if showFirstLast}
72
- {#if safePage() > 1}
73
- <button
74
- type="button"
75
- class="pagination-button action padding-sm"
76
- onclick={() => goToPage(1)}
77
- aria-label="First page"
78
- >
79
- {#if styleMode === 'icon'}
80
- <ChevronsLeftIcon class="size-4" />
81
- {:else}
82
- First
83
- {/if}
84
- </button>
85
- {:else}
86
- <span class="pagination-button action padding-sm bg-zinc-400">
87
- {#if styleMode === 'icon'}
88
- <ChevronsLeftIcon class="size-4" />
89
- {:else}
90
- First
91
- {/if}
92
- </span>
93
- {/if}
94
- {/if}
95
-
96
- {#if safePage() > 1}
97
77
  <button
98
78
  type="button"
99
- class="pagination-button action padding-sm"
100
- onclick={() => goToPage(safePage() - 1)}
101
- aria-label="Previous page"
79
+ class={buttonClass()}
80
+ onclick={() => goToPage(1)}
81
+ aria-label="First page"
82
+ disabled={!hasPrevious()}
102
83
  >
103
84
  {#if styleMode === 'icon'}
104
- <ArrowLeftIcon class="size-4" />
85
+ <ChevronsLeftIcon class="size-4 -translate-x-px" />
105
86
  {:else}
106
- Previous
87
+ First
107
88
  {/if}
108
89
  </button>
109
- {:else}
110
- <span class="pagination-button action padding-sm bg-zinc-400">
111
- {#if styleMode === 'icon'}
112
- <ArrowLeftIcon class="size-4" />
113
- {:else}
114
- Previous
115
- {/if}
116
- </span>
117
90
  {/if}
118
91
 
92
+ <button
93
+ type="button"
94
+ class={buttonClass()}
95
+ onclick={() => goToPage(safePage() - 1)}
96
+ aria-label="Previous page"
97
+ disabled={!hasPrevious()}
98
+ >
99
+ {#if styleMode === 'icon'}
100
+ <ChevronLeftIcon class="size-4 -translate-x-px" />
101
+ {:else}
102
+ Previous
103
+ {/if}
104
+ </button>
105
+
119
106
  <span>Page</span>
120
107
 
121
108
  <form method="GET" style="display: inline;" novalidate onsubmit={handleSubmit}>
@@ -125,51 +112,33 @@
125
112
 
126
113
  <span>of {maxPage()}</span>
127
114
 
128
- {#if hasNext()}
115
+ <button
116
+ type="button"
117
+ class={buttonClass()}
118
+ onclick={() => goToPage(safePage() + 1)}
119
+ aria-label="Next page"
120
+ disabled={!hasNext()}
121
+ >
122
+ {#if styleMode === 'icon'}
123
+ <ChevronRightIcon class="size-4 translate-x-px" />
124
+ {:else}
125
+ Next
126
+ {/if}
127
+ </button>
128
+
129
+ {#if showFirstLast}
129
130
  <button
130
131
  type="button"
131
- class="pagination-button action padding-sm"
132
- onclick={() => goToPage(safePage() + 1)}
133
- aria-label="Next page"
132
+ class={buttonClass()}
133
+ onclick={() => goToPage(maxPage())}
134
+ aria-label="Last page"
135
+ disabled={!hasNext()}
134
136
  >
135
137
  {#if styleMode === 'icon'}
136
- <ArrowRightIcon class="size-4" />
138
+ <ChevronsRightIcon class="size-4 translate-x-px" />
137
139
  {:else}
138
- Next
140
+ Last
139
141
  {/if}
140
142
  </button>
141
- {:else}
142
- <span class="pagination-button action padding-sm bg-zinc-400">
143
- {#if styleMode === 'icon'}
144
- <ArrowRightIcon class="size-4" />
145
- {:else}
146
- Next
147
- {/if}
148
- </span>
149
- {/if}
150
-
151
- {#if showFirstLast}
152
- {#if hasNext()}
153
- <button
154
- type="button"
155
- class="pagination-button action padding-sm"
156
- onclick={() => goToPage(maxPage())}
157
- aria-label="Last page"
158
- >
159
- {#if styleMode === 'icon'}
160
- <ChevronsRightIcon class="size-4" />
161
- {:else}
162
- Last
163
- {/if}
164
- </button>
165
- {:else}
166
- <span class="pagination-button action padding-sm bg-zinc-400">
167
- {#if styleMode === 'icon'}
168
- <ChevronsRightIcon class="size-4" />
169
- {:else}
170
- Last
171
- {/if}
172
- </span>
173
- {/if}
174
143
  {/if}
175
144
  </div>
@@ -18,35 +18,17 @@
18
18
  </script>
19
19
 
20
20
  <div
21
- class={`hstack w-fit ${className}`}
22
- style="
23
- padding: var(--segmented-picker-outer-padding);
24
- border-radius: var(--segmented-picker-border-radius);
25
- background: var(--segmented-picker-background);
26
- gap: var(--segmented-picker-item-gap);
27
- opacity: {disabled ? '0.5' : '1'};
28
- filter: {disabled ? 'grayscale(1)' : 'none'};
29
- "
21
+ class={`segmented-picker hstack w-fit ${className}`}
22
+ class:segmented-picker-disabled={disabled}
30
23
  >
31
24
  {#each options as option}
32
25
  {#if option.value === value}
33
- <span
34
- class=""
35
- style="
36
- padding: var(--segmented-picker-inner-padding);
37
- border-radius: var(--segmented-picker-inner-border-radius);
38
- background: var(--segmented-picker-active-background);
39
- box-shadow: var(--segmented-picker-active-shadow);
40
- ">{option.label}</span
41
- >
26
+ <span class="segmented-picker-button segmented-picker-button-active">{option.label}</span>
42
27
  {:else}
43
28
  <button
44
29
  type="button"
45
30
  {disabled}
46
- style="
47
- padding: var(--segmented-picker-inner-padding);
48
- border-radius: var(--segmented-picker-inner-border-radius);
49
- "
31
+ class="segmented-picker-button"
50
32
  onclick={() => {
51
33
  if (disabled) return;
52
34
  value = option.value;
@@ -40,18 +40,17 @@
40
40
  <button
41
41
  type="button"
42
42
  aria-label="Close dialog"
43
- class="absolute inset-0"
44
- style="background: var(--sheet-overlay); backdrop-filter: blur(var(--sheet-blur));"
43
+ class="sheet-overlay absolute inset-0"
45
44
  onclick={close}
46
45
  ></button>
47
46
  <div
48
47
  role="dialog"
49
48
  aria-modal="true"
50
49
  aria-label={label}
51
- style={`border-radius: var(--sheet-border-radius); box-shadow: var(--sheet-shadow); max-width: ${maxWidth};`}
52
- class="relative z-10 flex max-h-full w-full flex-col overflow-hidden bg-[var(--sheet-background)] ring-1 ring-[var(--sheet-border-color)] {className}"
50
+ style={`max-width: ${maxWidth};`}
51
+ class="sheet relative z-10 flex max-h-full w-full flex-col overflow-auto {className}"
53
52
  >
54
- <div class="flex-1 overflow-auto" style="padding: var(--sheet-content-padding);">
53
+ <div class="flex-1">
55
54
  {#if children}
56
55
  {@render children()}
57
56
  {/if}
@@ -45,70 +45,3 @@
45
45
  style={sliderStyle}
46
46
  {...props}
47
47
  />
48
-
49
- <style>
50
- .slider {
51
- appearance: none;
52
- height: 6px;
53
- border-radius: 9999px;
54
- background: transparent;
55
- outline: none;
56
- cursor: pointer;
57
- }
58
-
59
- .slider:focus-visible {
60
- outline: 2px solid color-mix(in oklab, var(--color-gray-900) 35%, white);
61
- outline-offset: 4px;
62
- }
63
-
64
- .slider:disabled {
65
- opacity: 0.5;
66
- cursor: not-allowed;
67
- }
68
-
69
- .slider::-webkit-slider-runnable-track {
70
- height: 6px;
71
- border-radius: 9999px;
72
- background: linear-gradient(
73
- to right,
74
- var(--slider-fill) 0%,
75
- var(--slider-fill) var(--slider-pct),
76
- var(--slider-track) var(--slider-pct),
77
- var(--slider-track) 100%
78
- );
79
- }
80
-
81
- .slider::-webkit-slider-thumb {
82
- appearance: none;
83
- width: 16px;
84
- height: 16px;
85
- border-radius: 9999px;
86
- border: 2px solid var(--slider-thumb-outer);
87
- background: var(--slider-thumb-inner);
88
- box-shadow: var(--slider-shadow);
89
- margin-top: -5px;
90
- }
91
-
92
- .slider::-moz-range-track {
93
- height: 6px;
94
- border: none;
95
- border-radius: 9999px;
96
- background: var(--slider-track);
97
- }
98
-
99
- .slider::-moz-range-progress {
100
- height: 6px;
101
- border: none;
102
- border-radius: 9999px;
103
- background: var(--slider-fill);
104
- }
105
-
106
- .slider::-moz-range-thumb {
107
- width: 16px;
108
- height: 16px;
109
- border-radius: 9999px;
110
- border: 2px solid var(--slider-thumb-outer);
111
- background: var(--slider-thumb-inner);
112
- box-shadow: var(--slider-shadow);
113
- }
114
- </style>
@@ -13,51 +13,15 @@
13
13
  > = $props();
14
14
  </script>
15
15
 
16
- <span class="tooltip {className}" aria-label={!disabled ? label : undefined} {...props}>
16
+ <span
17
+ class="tooltip-trigger relative inline-flex items-center {className}"
18
+ aria-label={!disabled ? label : undefined}
19
+ {...props}
20
+ >
17
21
  {@render children()}
18
22
  {#if !disabled}
19
- <span class="tooltip-content" role="tooltip">{label}</span>
23
+ <span class="tooltip" role="tooltip">
24
+ {label}
25
+ </span>
20
26
  {/if}
21
27
  </span>
22
-
23
- <style>
24
- .tooltip {
25
- position: relative;
26
- display: inline-flex;
27
- align-items: center;
28
- }
29
-
30
- .tooltip-content {
31
- position: absolute;
32
- left: 50%;
33
- bottom: calc(100% + 6px);
34
- transform: translateX(-50%);
35
- padding: var(--tooltip-padding);
36
- border-radius: var(--tooltip-border-radius);
37
- background: var(--tooltip-background);
38
- color: var(--tooltip-text);
39
- font-size: var(--tooltip-font-size);
40
- white-space: nowrap;
41
- opacity: 0;
42
- pointer-events: none;
43
- z-index: 10;
44
- }
45
-
46
- .tooltip-content::after {
47
- content: '';
48
- position: absolute;
49
- top: calc(100% - 5px);
50
- left: 50%;
51
- width: 10px;
52
- height: 10px;
53
- transform: translateX(-50%) rotate(45deg);
54
- background: var(--tooltip-background);
55
- border-radius: 0;
56
- border-bottom-right-radius: calc(var(--tooltip-border-radius) / 2);
57
- }
58
-
59
- .tooltip:hover .tooltip-content,
60
- .tooltip:focus-within .tooltip-content {
61
- opacity: 1;
62
- }
63
- </style>