@rokkit/ui 1.0.0-next.133 → 1.0.0-next.136

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.
@@ -81,64 +81,64 @@
81
81
  {@const content = resolveSnippet(snippets, proxy, ITEM_SNIPPET)}
82
82
 
83
83
  <div
84
- data-tree-node
85
- data-tree-path={node.key}
86
- data-tree-level={node.level - 1}
87
- data-tree-has-children={node.isExpandable || undefined}
88
- data-active={isActive || undefined}
89
- role="treeitem"
90
- aria-expanded={node.isExpandable ? proxy.expanded : undefined}
91
- aria-selected={isActive}
92
- aria-level={node.level}
93
- >
94
- <div data-tree-node-row>
95
- {#each node.lineTypes as lineType, lineIndex (lineIndex)}
96
- {#if lineType === 'icon'}
97
- <button
98
- type="button"
99
- data-tree-toggle-btn
100
- onclick={() => wrapper.toggle(node.key)}
101
- aria-label={proxy.expanded ? labels.collapse : labels.expand}
102
- tabindex={-1}
103
- >
104
- <span class={proxy.expanded ? icons.opened : icons.closed} aria-hidden="true"></span>
105
- </button>
106
- {:else}
107
- <Connector type={lineType} />
108
- {/if}
109
- {/each}
110
-
111
- {#if proxy.get('href')}
112
- <a
113
- href={proxy.get('href')}
114
- data-tree-item-content
115
- data-path={node.key}
116
- data-active={isActive || undefined}
117
- aria-label={proxy.label}
118
- aria-current={isActive ? 'page' : undefined}
119
- >
120
- {#if content}
121
- {@render content(proxy)}
122
- {:else}
123
- <ItemContent {proxy} showIcon={!node.isExpandable} showSubtext={false} />
124
- {/if}
125
- </a>
126
- {:else}
84
+ data-tree-node
85
+ data-tree-path={node.key}
86
+ data-tree-level={node.level - 1}
87
+ data-tree-has-children={node.isExpandable || undefined}
88
+ data-active={isActive || undefined}
89
+ role="treeitem"
90
+ aria-expanded={node.isExpandable ? proxy.expanded : undefined}
91
+ aria-selected={isActive}
92
+ aria-level={node.level}
93
+ >
94
+ <div data-tree-node-row>
95
+ {#each node.lineTypes as lineType, lineIndex (lineIndex)}
96
+ {#if lineType === 'icon'}
127
97
  <button
128
98
  type="button"
129
- data-tree-item-content
130
- data-path={node.key}
131
- data-active={isActive || undefined}
132
- aria-label={proxy.label}
99
+ data-tree-toggle-btn
100
+ onclick={() => wrapper.toggle(node.key)}
101
+ aria-label={proxy.expanded ? labels.collapse : labels.expand}
102
+ tabindex={-1}
133
103
  >
134
- {#if content}
135
- {@render content(proxy)}
136
- {:else}
137
- <ItemContent {proxy} showIcon={!node.isExpandable} showSubtext={false} />
138
- {/if}
104
+ <span class={proxy.expanded ? icons.opened : icons.closed} aria-hidden="true"></span>
139
105
  </button>
106
+ {:else}
107
+ <Connector type={lineType} />
140
108
  {/if}
141
- </div>
109
+ {/each}
110
+
111
+ {#if proxy.get('href')}
112
+ <a
113
+ href={proxy.get('href')}
114
+ data-tree-item-content
115
+ data-path={node.key}
116
+ data-active={isActive || undefined}
117
+ aria-label={proxy.label}
118
+ aria-current={isActive ? 'page' : undefined}
119
+ >
120
+ {#if content}
121
+ {@render content(proxy)}
122
+ {:else}
123
+ <ItemContent {proxy} showIcon={!node.isExpandable} showSubtext={false} />
124
+ {/if}
125
+ </a>
126
+ {:else}
127
+ <button
128
+ type="button"
129
+ data-tree-item-content
130
+ data-path={node.key}
131
+ data-active={isActive || undefined}
132
+ aria-label={proxy.label}
133
+ >
134
+ {#if content}
135
+ {@render content(proxy)}
136
+ {:else}
137
+ <ItemContent {proxy} showIcon={!node.isExpandable} showSubtext={false} />
138
+ {/if}
139
+ </button>
140
+ {/if}
142
141
  </div>
142
+ </div>
143
143
  {/each}
144
144
  </div>
@@ -28,7 +28,7 @@
28
28
  onretry,
29
29
  onremove,
30
30
  labels: userLabels = {} as Record<string, string>,
31
- icons: userIcons = {} as Record<string, string>,
31
+ icons: userIcons = {} as Record<string, string>
32
32
  }: UploadFileStatusProps = $props()
33
33
 
34
34
  const labels = $derived({ ...messages.current.uploadProgress, ...userLabels })
@@ -36,13 +36,17 @@
36
36
  cancel: DEFAULT_STATE_ICONS.action.cancel,
37
37
  retry: DEFAULT_STATE_ICONS.action.retry,
38
38
  remove: DEFAULT_STATE_ICONS.action.remove,
39
- ...userIcons,
39
+ ...userIcons
40
40
  })
41
41
 
42
42
  const status = $derived(String(proxy.get('status') ?? 'unknown'))
43
43
  const progress = $derived(Number(proxy.get('progress') ?? 0))
44
44
  const size = $derived(Number(proxy.get('size') ?? 0))
45
- const fileIcon = $derived(proxy.get('icon') ? String(proxy.get('icon')) : inferIcon(proxy.get('type') as string | undefined))
45
+ const fileIcon = $derived(
46
+ proxy.get('icon')
47
+ ? String(proxy.get('icon'))
48
+ : inferIcon(proxy.get('type') as string | undefined)
49
+ )
46
50
  const statusLabel = $derived(labels[status] ?? status)
47
51
 
48
52
  const showBar = $derived(progress > 0 && progress < 100)
@@ -64,17 +68,32 @@
64
68
  {#if showCancel || showRetry || showRemove}
65
69
  <div data-upload-actions>
66
70
  {#if showCancel}
67
- <button type="button" data-upload-cancel aria-label="{labels.cancel} {proxy.label}" onclick={() => oncancel?.(proxy)}>
71
+ <button
72
+ type="button"
73
+ data-upload-cancel
74
+ aria-label="{labels.cancel} {proxy.label}"
75
+ onclick={() => oncancel?.(proxy)}
76
+ >
68
77
  <span class={icons.cancel} aria-hidden="true"></span>
69
78
  </button>
70
79
  {/if}
71
80
  {#if showRetry}
72
- <button type="button" data-upload-retry aria-label="{labels.retry} {proxy.label}" onclick={() => onretry?.(proxy)}>
81
+ <button
82
+ type="button"
83
+ data-upload-retry
84
+ aria-label="{labels.retry} {proxy.label}"
85
+ onclick={() => onretry?.(proxy)}
86
+ >
73
87
  <span class={icons.retry} aria-hidden="true"></span>
74
88
  </button>
75
89
  {/if}
76
90
  {#if showRemove}
77
- <button type="button" data-upload-remove aria-label="{labels.remove} {proxy.label}" onclick={() => onremove?.(proxy)}>
91
+ <button
92
+ type="button"
93
+ data-upload-remove
94
+ aria-label="{labels.remove} {proxy.label}"
95
+ onclick={() => onremove?.(proxy)}
96
+ >
78
97
  <span class={icons.remove} aria-hidden="true"></span>
79
98
  </button>
80
99
  {/if}
@@ -51,7 +51,7 @@
51
51
  progress: userFields.progress ?? 'progress',
52
52
  size: userFields.size ?? 'size',
53
53
  type: userFields.type ?? 'type',
54
- error: userFields.error ?? 'error',
54
+ error: userFields.error ?? 'error'
55
55
  })
56
56
 
57
57
  // ─── Status summary ──────────────────────────────────────────────────────
@@ -101,11 +101,7 @@
101
101
  />
102
102
  {/snippet}
103
103
 
104
- <div
105
- data-upload-progress
106
- data-upload-view={view}
107
- class={className || undefined}
108
- >
104
+ <div data-upload-progress data-upload-view={view} class={className || undefined}>
109
105
  <!-- Header -->
110
106
  <div data-upload-header>
111
107
  <span>{files.length} files — {statusSummary}</span>
@@ -32,7 +32,7 @@
32
32
 
33
33
  const resolvedLabels = $derived({
34
34
  ...messages.current.uploadTarget,
35
- ...labels,
35
+ ...labels
36
36
  })
37
37
 
38
38
  let inputRef = $state<HTMLInputElement | null>(null)
@@ -20,7 +20,18 @@ export interface HSL {
20
20
  l: number
21
21
  }
22
22
 
23
- export type ShadeKey = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | '950'
23
+ export type ShadeKey =
24
+ | '50'
25
+ | '100'
26
+ | '200'
27
+ | '300'
28
+ | '400'
29
+ | '500'
30
+ | '600'
31
+ | '700'
32
+ | '800'
33
+ | '900'
34
+ | '950'
24
35
 
25
36
  export type Shades = Record<ShadeKey, string>
26
37
 
@@ -64,7 +75,7 @@ export function hexToRgb(hex: string): RGB {
64
75
  export function rgbToHex(rgb: RGB): string {
65
76
  const toHex = (n: number) => {
66
77
  const hex = Math.round(Math.max(0, Math.min(255, n))).toString(16)
67
- return hex.length === 1 ? `0${ hex}` : hex
78
+ return hex.length === 1 ? `0${hex}` : hex
68
79
  }
69
80
  return `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`
70
81
  }
@@ -173,7 +184,7 @@ export function generateShades(hex: string): Shades {
173
184
  '500': [1.0, hsl.l], // Keep original lightness
174
185
  '600': [1.02, Math.max(hsl.l * 0.82, 25)],
175
186
  '700': [1.04, Math.max(hsl.l * 0.65, 20)],
176
- '800': [1.06, Math.max(hsl.l * 0.50, 15)],
187
+ '800': [1.06, Math.max(hsl.l * 0.5, 15)],
177
188
  '900': [1.08, Math.max(hsl.l * 0.35, 12)],
178
189
  '950': [1.12, Math.max(hsl.l * 0.22, 8)]
179
190
  }
@@ -539,10 +550,31 @@ export function applyPalette(
539
550
  * Remove custom palette CSS variables (reset to theme defaults)
540
551
  */
541
552
  export function resetPalette(
542
- roles: ColorRole[] = ['primary', 'secondary', 'accent', 'surface', 'success', 'warning', 'danger', 'info'],
553
+ roles: ColorRole[] = [
554
+ 'primary',
555
+ 'secondary',
556
+ 'accent',
557
+ 'surface',
558
+ 'success',
559
+ 'warning',
560
+ 'danger',
561
+ 'info'
562
+ ],
543
563
  element: HTMLElement = document.documentElement
544
564
  ): void {
545
- const shadeKeys: ShadeKey[] = ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900', '950']
565
+ const shadeKeys: ShadeKey[] = [
566
+ '50',
567
+ '100',
568
+ '200',
569
+ '300',
570
+ '400',
571
+ '500',
572
+ '600',
573
+ '700',
574
+ '800',
575
+ '900',
576
+ '950'
577
+ ]
546
578
 
547
579
  for (const role of roles) {
548
580
  element.style.removeProperty(`--color-${role}`)
@@ -14,7 +14,10 @@ const ARCHIVE_TYPES = new Set(['application/zip', 'application/gzip', 'applicati
14
14
  export function matchesAccept(file, accept) {
15
15
  if (!accept) return true
16
16
 
17
- const tokens = accept.split(',').map((t) => t.trim()).filter(Boolean)
17
+ const tokens = accept
18
+ .split(',')
19
+ .map((t) => t.trim())
20
+ .filter(Boolean)
18
21
  if (tokens.length === 0) return true
19
22
 
20
23
  return tokens.some((token) => {