@stacksjs/components 0.2.342 → 0.2.344
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.
- package/dist/{Accordion-8tv78bh9.stx → Accordion-ccye7erw.stx} +23 -3
- package/dist/{Audio-y0sgq50z.stx → Audio-tnjd6anm.stx} +7 -7
- package/dist/{Avatar-e43x17z1.stx → Avatar-7vegrsg6.stx} +3 -3
- package/dist/Badge-439n5p0a.stx +74 -0
- package/dist/{Breadcrumb-csf164sd.stx → Breadcrumb-7hwnfyyw.stx} +21 -6
- package/dist/Button-y8fnx29x.stx +193 -0
- package/dist/{Calendar-gjjhhfnt.stx → Calendar-8q76ees6.stx} +6 -6
- package/dist/{Card-7byck6ep.stx → Card-r55zpjqh.stx} +6 -6
- package/dist/{Checkbox-2s2a7n4h.stx → Checkbox-xnm8ax5q.stx} +9 -9
- package/dist/{ComboboxInput-z1293bbh.stx → ComboboxInput-9q87fb22.stx} +2 -2
- package/dist/{ComboboxOption-6yh7xk7q.stx → ComboboxOption-qm38e8e9.stx} +2 -2
- package/dist/{ComboboxOptions-sq5360ae.stx → ComboboxOptions-nbndbrxz.stx} +1 -1
- package/dist/{CommandPalette-fzfv1pme.stx → CommandPalette-mkqqep2s.stx} +4 -4
- package/dist/{DefaultPaymentMethod-6qrem3sg.stx → DefaultPaymentMethod-v11254p4.stx} +8 -8
- package/dist/Dialog-d1020hj6.stx +268 -0
- package/dist/DialogBackdrop-de5m5m4w.stx +12 -0
- package/dist/DialogPanel-vhdqymc2.stx +19 -0
- package/dist/{DialogTitle-x0r6k8x9.stx → DialogTitle-0jjdk5ra.stx} +1 -1
- package/dist/{Drawer-9jx39xef.stx → Drawer-rymajw9v.stx} +86 -21
- package/dist/{DropdownButton-wcz67dxy.stx → DropdownButton-n6gsmcte.stx} +2 -2
- package/dist/{DropdownItem-d8ht2bp5.stx → DropdownItem-qs772agw.stx} +1 -1
- package/dist/{DropdownItems-1sxnd5qn.stx → DropdownItems-yf25hdh1.stx} +1 -1
- package/dist/{EmailInput-vak3kkmk.stx → EmailInput-agb8kqae.stx} +4 -4
- package/dist/{FilterChip-h896vrxm.stx → FilterChip-ww5nkepm.stx} +26 -2
- package/dist/{Image-4ezne2xj.stx → Image-79xyzb5j.stx} +3 -3
- package/dist/{ListRow-v45ymhcn.stx → ListRow-8d3e1yxh.stx} +2 -2
- package/dist/{Listbox-0cyysv0f.stx → Listbox-e5jreb0a.stx} +1 -1
- package/dist/{ListboxButton-keb8gm0q.stx → ListboxButton-w3vfvte7.stx} +2 -2
- package/dist/{RadioGroupLabel-7mymt1b8.stx → ListboxLabel-ka0hfm7b.stx} +1 -1
- package/dist/{ListboxOption-4j070101.stx → ListboxOption-ea0j02a8.stx} +2 -2
- package/dist/{ListboxOptions-ejkatcfg.stx → ListboxOptions-qxrkrb8z.stx} +1 -1
- package/dist/{Login-2cp65d41.stx → Login-hh53d6tw.stx} +14 -14
- package/dist/{NavBar-wcb6f2d3.stx → NavBar-qqrrhdnk.stx} +24 -0
- package/dist/{Navigator-smpa7my4.stx → Navigator-55wpcpx1.stx} +2 -2
- package/dist/{Notification-03vfh3k6.stx → Notification-7wgk0sw6.stx} +6 -6
- package/dist/{NumberInput-j9p5bm5y.stx → NumberInput-54d23rq0.stx} +21 -11
- package/dist/{Pagination-ff7nzp7d.stx → Pagination-0ra20dja.stx} +4 -4
- package/dist/{PasswordInput-4qykq1dz.stx → PasswordInput-3snyppj4.stx} +24 -14
- package/dist/{PaymentMethods-2xy66bwk.stx → PaymentMethods-zwa7c6kh.stx} +10 -10
- package/dist/{PopoverButton-mffzc9pr.stx → PopoverButton-panmcysh.stx} +2 -2
- package/dist/{PopoverPanel-054yh38h.stx → PopoverPanel-7771yf35.stx} +2 -2
- package/dist/{Portal-yghnqdj8.stx → Portal-m73vz879.stx} +1 -1
- package/dist/{Progress-twhhzsd9.stx → Progress-cj0z83rx.stx} +47 -18
- package/dist/{Radio-ccm07b2m.stx → Radio-m2wz5ny6.stx} +8 -8
- package/dist/{RadioGroup-82ytfqdb.stx → RadioGroup-jg9s4ttg.stx} +1 -1
- package/dist/{ListboxLabel-7mymt1b8.stx → RadioGroupLabel-ka0hfm7b.stx} +1 -1
- package/dist/{RadioGroupOption-7pq7rw84.stx → RadioGroupOption-zvp0y9sn.stx} +2 -2
- package/dist/{SearchInput-pdx7agn0.stx → SearchInput-psbjk2ye.stx} +3 -3
- package/dist/{SectionCard-r73hvvbc.stx → SectionCard-8ctdacjr.stx} +28 -1
- package/dist/{Select-zt72gg1e.stx → Select-pj584jza.stx} +19 -9
- package/dist/{Sidebar-f1tff5p3.stx → Sidebar-ve2asgf3.stx} +6 -6
- package/dist/{SidebarHeader-3dppxxjh.stx → SidebarHeader-esvby82n.stx} +3 -3
- package/dist/{SidebarItem-5v8atp7p.stx → SidebarItem-r4f2pref.stx} +4 -4
- package/dist/{SidebarSection-sqz49ary.stx → SidebarSection-5sqza2j6.stx} +2 -2
- package/dist/{SidebarSpace-nmbvgrky.stx → SidebarSpace-bwv98azf.stx} +3 -3
- package/dist/{SidebarSpaceSwitcher-v5e472j0.stx → SidebarSpaceSwitcher-1mycft2g.stx} +1 -1
- package/dist/{SidebarSpaces-6v3p9htw.stx → SidebarSpaces-mdtrynr2.stx} +2 -2
- package/dist/{Signup-cbncrtvd.stx → Signup-egdrk3rh.stx} +11 -11
- package/dist/{Skeleton-y9tycz2h.stx → Skeleton-me2hwqrc.stx} +4 -4
- package/dist/{Spinner-reb6rse4.stx → Spinner-grahbp9a.stx} +9 -9
- package/dist/{StepperStep-3ahq4d9m.stx → StepperStep-xw55xjh0.stx} +9 -4
- package/dist/{SubscriptionCheckout-7fdkwf04.stx → SubscriptionCheckout-wj4s182k.stx} +13 -13
- package/dist/{Switch-cgy7hy0s.stx → Switch-fxbw7s16.stx} +7 -4
- package/dist/{TabBarItem-hd2r2ayy.stx → TabBarItem-cnxhgy92.stx} +25 -1
- package/dist/{Table-0mc3fdek.stx → Table-akbk3t5q.stx} +1 -1
- package/dist/{TableHeader-sxc77b4d.stx → TableHeader-qsc3e208.stx} +1 -1
- package/dist/{Tabs-b4xsba1w.stx → Tabs-2cjt68my.stx} +28 -8
- package/dist/{Teleport-3gnjtsjf.stx → Teleport-c8nn3757.stx} +2 -2
- package/dist/{TextInput-hbe2ynzj.stx → TextInput-9wqzeeg1.stx} +23 -13
- package/dist/{Textarea-xcdym703.stx → Textarea-xwkdg8se.stx} +11 -11
- package/dist/{Tooltip-y0kzkwh4.stx → Tooltip-14gt4f1w.stx} +9 -6
- package/dist/{Transition-7smenaz8.stx → Transition-yrvqbhjy.stx} +1 -1
- package/dist/{TwoFactorChallenge-y7n4yrk9.stx → TwoFactorChallenge-0200pjc0.stx} +5 -5
- package/dist/{Video-a0aeyexv.stx → Video-rhy7dskw.stx} +6 -6
- package/dist/{VirtualTable-jvm1784g.stx → VirtualTable-jvje0ybn.stx} +4 -4
- package/dist/composables/index.js +2 -2
- package/dist/index.js +13 -13
- package/dist/utils/highlighter.d.ts +1 -0
- package/dist/utils/highlighter.js +1 -1
- package/package.json +3 -3
- package/src/components/CodeBlock.stx +7 -1
- package/src/components/Footer.stx +1 -1
- package/src/components/Hero.stx +2 -2
- package/src/components/Installation.stx +4 -4
- package/src/ui/accordion/Accordion.stx +23 -3
- package/src/ui/audio/Audio.stx +7 -7
- package/src/ui/auth/Login.stx +14 -14
- package/src/ui/auth/Signup.stx +11 -11
- package/src/ui/auth/TwoFactorChallenge.stx +5 -5
- package/src/ui/avatar/Avatar.stx +3 -3
- package/src/ui/badge/Badge.stx +31 -19
- package/src/ui/breadcrumb/Breadcrumb.stx +21 -6
- package/src/ui/button/Button.stx +148 -29
- package/src/ui/calendar/Calendar.stx +6 -6
- package/src/ui/card/Card.stx +6 -6
- package/src/ui/checkbox/Checkbox.stx +9 -9
- package/src/ui/combobox/ComboboxInput.stx +2 -2
- package/src/ui/combobox/ComboboxOption.stx +2 -2
- package/src/ui/combobox/ComboboxOptions.stx +1 -1
- package/src/ui/command-palette/CommandPalette.stx +4 -4
- package/src/ui/dialog/Dialog.stx +231 -4
- package/src/ui/dialog/DialogBackdrop.stx +5 -2
- package/src/ui/dialog/DialogPanel.stx +5 -2
- package/src/ui/dialog/DialogTitle.stx +1 -1
- package/src/ui/dialog/README.md +15 -4
- package/src/ui/drawer/Drawer.stx +86 -21
- package/src/ui/dropdown/DropdownButton.stx +2 -2
- package/src/ui/dropdown/DropdownItem.stx +1 -1
- package/src/ui/dropdown/DropdownItems.stx +1 -1
- package/src/ui/heatmap/Heatmap.stx +1 -1
- package/src/ui/image/Image.stx +3 -3
- package/src/ui/input/EmailInput.stx +4 -4
- package/src/ui/input/NumberInput.stx +21 -11
- package/src/ui/input/PasswordInput.stx +24 -14
- package/src/ui/input/SearchInput.stx +3 -3
- package/src/ui/input/TextInput.stx +23 -13
- package/src/ui/listbox/Listbox.stx +1 -1
- package/src/ui/listbox/ListboxButton.stx +2 -2
- package/src/ui/listbox/ListboxLabel.stx +1 -1
- package/src/ui/listbox/ListboxOption.stx +2 -2
- package/src/ui/listbox/ListboxOptions.stx +1 -1
- package/src/ui/mobile/FilterChip.stx +26 -2
- package/src/ui/mobile/ListRow.stx +2 -2
- package/src/ui/mobile/NavBar.stx +24 -0
- package/src/ui/mobile/SectionCard.stx +28 -1
- package/src/ui/mobile/TabBarItem.stx +25 -1
- package/src/ui/navigator/Navigator.stx +2 -2
- package/src/ui/notification/Notification.stx +6 -6
- package/src/ui/pagination/Pagination.stx +4 -4
- package/src/ui/payment/DefaultPaymentMethod.stx +8 -8
- package/src/ui/payment/PaymentMethods.stx +10 -10
- package/src/ui/payment/SubscriptionCheckout.stx +13 -13
- package/src/ui/popover/PopoverButton.stx +2 -2
- package/src/ui/popover/PopoverPanel.stx +2 -2
- package/src/ui/portal/Portal.stx +1 -1
- package/src/ui/progress/Progress.stx +47 -18
- package/src/ui/radio/Radio.stx +8 -8
- package/src/ui/radio-group/RadioGroup.stx +1 -1
- package/src/ui/radio-group/RadioGroupLabel.stx +1 -1
- package/src/ui/radio-group/RadioGroupOption.stx +2 -2
- package/src/ui/select/Select.stx +19 -9
- package/src/ui/sidebar/Sidebar.stx +6 -6
- package/src/ui/sidebar/SidebarHeader.stx +3 -3
- package/src/ui/sidebar/SidebarItem.stx +4 -4
- package/src/ui/sidebar/SidebarSection.stx +2 -2
- package/src/ui/sidebar/SidebarSpace.stx +3 -3
- package/src/ui/sidebar/SidebarSpaceSwitcher.stx +1 -1
- package/src/ui/sidebar/SidebarSpaces.stx +2 -2
- package/src/ui/skeleton/Skeleton.stx +4 -4
- package/src/ui/spinner/Spinner.stx +9 -9
- package/src/ui/stepper/StepperStep.stx +9 -4
- package/src/ui/switch/Switch.stx +7 -4
- package/src/ui/table/Table.stx +1 -1
- package/src/ui/table/TableHeader.stx +1 -1
- package/src/ui/tabs/Tabs.stx +28 -8
- package/src/ui/teleport/Teleport.stx +2 -2
- package/src/ui/textarea/Textarea.stx +11 -11
- package/src/ui/tooltip/Tooltip.stx +9 -6
- package/src/ui/transition/Transition.stx +1 -1
- package/src/ui/video/Video.stx +6 -6
- package/src/ui/virtual-table/VirtualTable.stx +4 -4
- package/src/utils/highlighter.ts +65 -4
- package/dist/Badge-xwjeq24d.stx +0 -62
- package/dist/Button-h2mk4wfw.stx +0 -74
- package/dist/Dialog-y5rz2vrq.stx +0 -41
- package/dist/DialogBackdrop-rxax3sec.stx +0 -9
- package/dist/DialogPanel-44d8jeqy.stx +0 -16
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export const products = $props.products || []
|
|
3
3
|
export const stripePublicKey = $props.stripePublicKey || ''
|
|
4
4
|
export const apiUrl = $props.apiUrl || ''
|
|
5
|
-
export const showRemoveProduct = $props.showRemoveProduct
|
|
5
|
+
export const showRemoveProduct = $bool($props.showRemoveProduct, true)
|
|
6
6
|
export const shipping = $props.shipping || 0
|
|
7
7
|
export const taxes = $props.taxes || 0
|
|
8
8
|
export const className = $props.className || ''
|
|
@@ -10,7 +10,7 @@ export const className = $props.className || ''
|
|
|
10
10
|
export const subtotal = products.reduce((sum, product) => sum + (product.price * (product.quantity || 1)), 0)
|
|
11
11
|
export const total = subtotal + shipping + taxes
|
|
12
12
|
|
|
13
|
-
export const containerClasses = `bg-
|
|
13
|
+
export const containerClasses = `bg-neutral-50 dark:bg-neutral-900 ${className}`.trim()
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<script client>
|
|
@@ -130,7 +130,7 @@ onMount(() => initializeStripe())
|
|
|
130
130
|
name="email-address"
|
|
131
131
|
autocomplete="email"
|
|
132
132
|
required
|
|
133
|
-
class="block w-full border border-line-strong rounded-
|
|
133
|
+
class="block w-full border border-line-strong rounded-control p-2 shadow-sm bg-field text-fg focus:border-indigo-500 dark:focus:border-indigo-400 sm:text-sm focus:ring-indigo-500 dark:focus:ring-indigo-400"
|
|
134
134
|
/>
|
|
135
135
|
</div>
|
|
136
136
|
</div>
|
|
@@ -154,14 +154,14 @@ onMount(() => initializeStripe())
|
|
|
154
154
|
name="card-name"
|
|
155
155
|
autocomplete="cc-name"
|
|
156
156
|
required
|
|
157
|
-
class="block w-full border border-line-strong rounded-
|
|
157
|
+
class="block w-full border border-line-strong rounded-control p-2 shadow-sm bg-field text-fg focus:border-indigo-500 sm:text-sm focus:ring-indigo-500"
|
|
158
158
|
/>
|
|
159
159
|
</div>
|
|
160
160
|
</div>
|
|
161
161
|
|
|
162
162
|
<!-- Stripe Element Mount Point -->
|
|
163
163
|
<div class="sm:col-span-2">
|
|
164
|
-
<div id="payment-element" class="mt-2 border border-line-strong rounded-
|
|
164
|
+
<div id="payment-element" class="mt-2 border border-line-strong rounded-control bg-field p-3"></div>
|
|
165
165
|
</div>
|
|
166
166
|
</div>
|
|
167
167
|
</div>
|
|
@@ -198,7 +198,7 @@ onMount(() => initializeStripe())
|
|
|
198
198
|
Order summary
|
|
199
199
|
</h2>
|
|
200
200
|
|
|
201
|
-
<div class="mt-4 border border-line rounded-
|
|
201
|
+
<div class="mt-4 border border-line rounded-panel bg-panel shadow-sm">
|
|
202
202
|
<h3 class="sr-only">Items in your cart</h3>
|
|
203
203
|
|
|
204
204
|
<!-- Product List -->
|
|
@@ -207,10 +207,10 @@ onMount(() => initializeStripe())
|
|
|
207
207
|
<li class="flex px-4 py-6 sm:px-6">
|
|
208
208
|
<div class="flex-shrink-0">
|
|
209
209
|
@if(product.images)
|
|
210
|
-
<img src="{{ product.images }}" alt="{{ product.name }}" class="w-20 rounded-
|
|
210
|
+
<img src="{{ product.images }}" alt="{{ product.name }}" class="w-20 rounded-control" />
|
|
211
211
|
@else
|
|
212
|
-
<div class="w-20 h-20 bg-surface-sunken rounded-
|
|
213
|
-
<svg class="h-8 w-8 text-
|
|
212
|
+
<div class="w-20 h-20 bg-surface-sunken rounded-control flex items-center justify-center">
|
|
213
|
+
<svg class="h-8 w-8 text-neutral-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
214
214
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
|
215
215
|
</svg>
|
|
216
216
|
</div>
|
|
@@ -222,7 +222,7 @@ onMount(() => initializeStripe())
|
|
|
222
222
|
<div class="min-w-0 flex-1">
|
|
223
223
|
<h4 class="text-sm">
|
|
224
224
|
@if(product.href)
|
|
225
|
-
<StxLink to="{{ product.href }}" class="text-fg-strong font-medium hover:text-
|
|
225
|
+
<StxLink to="{{ product.href }}" class="text-fg-strong font-medium hover:text-neutral-800 dark:hover:text-neutral-200">
|
|
226
226
|
{{ product.name }}
|
|
227
227
|
</StxLink>
|
|
228
228
|
@else
|
|
@@ -237,7 +237,7 @@ onMount(() => initializeStripe())
|
|
|
237
237
|
<div class="ml-4 flow-root flex-shrink-0">
|
|
238
238
|
<button
|
|
239
239
|
type="button"
|
|
240
|
-
class="flex items-center justify-center bg-
|
|
240
|
+
class="flex items-center justify-center bg-field p-2.5 text-fg-subtle -m-2.5 hover:text-fg-soft"
|
|
241
241
|
@click="onRemoveProduct('{{ product.id }}')"
|
|
242
242
|
title="Remove"
|
|
243
243
|
>
|
|
@@ -260,7 +260,7 @@ onMount(() => initializeStripe())
|
|
|
260
260
|
<select
|
|
261
261
|
id="quantity-{{ product.id }}"
|
|
262
262
|
name="quantity"
|
|
263
|
-
class="border border-line-strong rounded-
|
|
263
|
+
class="border border-line-strong rounded-control text-left text-base text-fg-strong font-medium shadow-sm bg-field focus:border-indigo-500 sm:text-sm focus:outline-none focus:ring-1 focus:ring-indigo-500"
|
|
264
264
|
>
|
|
265
265
|
<option value="1" {{ (product.quantity || 1) === 1 ? 'selected' : '' }}>1</option>
|
|
266
266
|
<option value="2" {{ (product.quantity || 1) === 2 ? 'selected' : '' }}>2</option>
|
|
@@ -317,7 +317,7 @@ onMount(() => initializeStripe())
|
|
|
317
317
|
<div class="border-t border-line px-4 py-6 sm:px-6">
|
|
318
318
|
<button
|
|
319
319
|
type="submit"
|
|
320
|
-
class="w-full border border-transparent rounded-
|
|
320
|
+
class="w-full border border-transparent rounded-control bg-accent-solid px-4 py-3 text-base text-white font-medium shadow-sm hover:bg-indigo-700 dark:hover:bg-indigo-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 focus:ring-offset-gray-50 dark:focus:ring-offset-gray-900"
|
|
321
321
|
>
|
|
322
322
|
Confirm order
|
|
323
323
|
</button>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script server>
|
|
2
|
-
export const checked = $props.checked
|
|
3
|
-
export const disabled = $props.disabled
|
|
2
|
+
export const checked = $bool($props.checked)
|
|
3
|
+
export const disabled = $bool($props.disabled)
|
|
4
4
|
export const size = $props.size || 'md'
|
|
5
5
|
export const className = $props.className || ''
|
|
6
6
|
export const label = $props.label || ''
|
|
@@ -11,7 +11,10 @@ const sizeConfig = {
|
|
|
11
11
|
lg: { track: 'h-12 w-24', thumb: 'h-11 w-11', translate: 'translate-x-12' },
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// Falls back rather than indexing to undefined: `size="huge"` is a typo, and
|
|
15
|
+
// without this it became `const config = {{ config }}` in the client script --
|
|
16
|
+
// a SyntaxError that killed the whole component rather than mis-sizing it.
|
|
17
|
+
export const config = sizeConfig[size] || sizeConfig.md
|
|
15
18
|
|
|
16
19
|
export const trackBaseClasses = 'relative inline-flex shrink-0 cursor-pointer border-2 border-transparent rounded-full transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2 focus-visible:ring-offset-neutral-300 dark:focus-visible:ring-offset-neutral-700'
|
|
17
20
|
export const trackDisabledClasses = disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : ''
|
|
@@ -37,7 +40,7 @@ function toggle() {
|
|
|
37
40
|
|
|
38
41
|
function trackClasses() {
|
|
39
42
|
const stateClass = isChecked()
|
|
40
|
-
? 'bg-
|
|
43
|
+
? 'bg-accent-solid'
|
|
41
44
|
: 'bg-neutral-400 dark:bg-neutral-600'
|
|
42
45
|
return `${trackBase} ${stateClass} ${trackDisabled} ${config.track} ${extraClass}`.trim()
|
|
43
46
|
}
|
|
@@ -9,12 +9,33 @@
|
|
|
9
9
|
export const label = $props.label || ''
|
|
10
10
|
export const href = $props.href || '#'
|
|
11
11
|
export const icon = $props.icon || ''
|
|
12
|
-
export const active = $props.active
|
|
12
|
+
export const active = $bool($props.active)
|
|
13
13
|
/** A count, or any short string. Zero and empty are not rendered. */
|
|
14
14
|
export const badge = $props.badge || ''
|
|
15
15
|
|
|
16
16
|
export const hasBadge = badge !== '' && badge !== 0 && badge !== '0'
|
|
17
17
|
|
|
18
|
+
/*
|
|
19
|
+
* Whether the router should own this link.
|
|
20
|
+
*
|
|
21
|
+
* The SPA router intercepts `[data-stx-link]` and nothing else, so a plain
|
|
22
|
+
* `<a href>` here was a full document load: the runtime rebooted, every signal
|
|
23
|
+
* and store was discarded, and the screen flashed white. On a phone this is
|
|
24
|
+
* the primary navigation control, so the app's main interaction was its worst
|
|
25
|
+
* one - the single largest reason a wrapped build feels like a browser rather
|
|
26
|
+
* than an app. stacksjs/stx#1988
|
|
27
|
+
*
|
|
28
|
+
* An absolute URL, a scheme (mailto:, tel:), a protocol-relative URL and a
|
|
29
|
+
* bare fragment are left to the browser: the router does not handle those, and
|
|
30
|
+
* claiming them would break a tab that points off-site.
|
|
31
|
+
*/
|
|
32
|
+
function routerOwns(url) {
|
|
33
|
+
if (!url || url === '#') return false
|
|
34
|
+
return !/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(url)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const routerOwned = routerOwns(href)
|
|
38
|
+
|
|
18
39
|
/*
|
|
19
40
|
* The active state is a filled pill behind the item rather than a colour
|
|
20
41
|
* change alone. Colour alone is the one distinction that disappears for the
|
|
@@ -32,6 +53,9 @@ export const itemClasses = `
|
|
|
32
53
|
href="{{ href }}"
|
|
33
54
|
class="{{ itemClasses }}"
|
|
34
55
|
data-stx-tab-bar-item
|
|
56
|
+
@if (routerOwned)
|
|
57
|
+
data-stx-link
|
|
58
|
+
@endif
|
|
35
59
|
@if (active)
|
|
36
60
|
aria-current="page"
|
|
37
61
|
@endif
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const className = $props.className || ''
|
|
3
|
-
export const striped = $props.striped
|
|
3
|
+
export const striped = $bool($props.striped)
|
|
4
4
|
export const hoverable = $props.hoverable !== false
|
|
5
5
|
|
|
6
6
|
const baseClasses = 'min-w-full divide-y divide-line'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const className = $props.className || ''
|
|
3
|
-
export const sortable = $props.sortable
|
|
3
|
+
export const sortable = $bool($props.sortable)
|
|
4
4
|
|
|
5
5
|
const baseClasses = 'px-6 py-3 text-left text-xs font-medium text-fg-soft uppercase tracking-wider'
|
|
6
6
|
const sortableClasses = sortable ? 'cursor-pointer hover:text-fg-strong' : ''
|
|
@@ -25,12 +25,12 @@ const tabListOrientationClasses = {
|
|
|
25
25
|
|
|
26
26
|
const variantClasses = {
|
|
27
27
|
line: 'border-line',
|
|
28
|
-
pills: 'gap-2 border-0 bg-surface-raised p-1 rounded-
|
|
28
|
+
pills: 'gap-2 border-0 bg-surface-raised p-1 rounded-panel',
|
|
29
29
|
enclosed: 'border-line',
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export const containerClasses = `flex ${orientationClasses[orientation]} ${className}`.trim()
|
|
33
|
-
export const tabListClasses = `flex ${tabListOrientationClasses[orientation]} ${variantClasses[variant]}`.trim()
|
|
32
|
+
export const containerClasses = `flex ${orientationClasses[orientation] || orientationClasses.horizontal} ${className}`.trim()
|
|
33
|
+
export const tabListClasses = `flex ${tabListOrientationClasses[orientation] || tabListOrientationClasses.horizontal} ${variantClasses[variant] || variantClasses.line}`.trim()
|
|
34
34
|
export const tabPanelClasses = `p-4 focus:outline-none`.trim()
|
|
35
35
|
// True when the parent passes a non-empty `tabs` array — switches to the
|
|
36
36
|
// legacy render path so existing snapshots stay byte-identical.
|
|
@@ -43,12 +43,30 @@ const tabs = {{ tabs }}
|
|
|
43
43
|
const variant = {{ variant }}
|
|
44
44
|
const orientation = {{ orientation }}
|
|
45
45
|
const hasPropTabs = {{ hasPropTabs }}
|
|
46
|
-
|
|
46
|
+
// useRef takes the NAME the x-ref attribute uses. Called with no
|
|
47
|
+
// argument it read $refs[undefined], which nothing ever fills, so
|
|
48
|
+
// containerRef.value was null forever - the mount hook found no panels,
|
|
49
|
+
// the list stayed empty, and the component rendered nothing.
|
|
50
|
+
// stacksjs/stx#1979
|
|
51
|
+
const containerRef = useRef('containerRef')
|
|
47
52
|
// In slot mode, `discoveredTabs` is populated from child <TabPanel> data
|
|
48
53
|
// attributes on mount. In prop mode, it mirrors the `tabs` prop so the
|
|
49
54
|
// rendering loop works the same in both modes.
|
|
50
55
|
const discoveredTabs = state(hasPropTabs ? tabs : [])
|
|
51
56
|
const activeTab = state({{ defaultTab }})
|
|
57
|
+
/*
|
|
58
|
+
* Whether the mount hook has run.
|
|
59
|
+
*
|
|
60
|
+
* The effect below reaches into the DOM through containerRef, and an effect's
|
|
61
|
+
* first run happens while the setup function is still executing - before
|
|
62
|
+
* hydration has wired x-ref, so containerRef.value is null and the query can
|
|
63
|
+
* only come back empty. Nothing else it reads ever changed afterwards, so it
|
|
64
|
+
* never ran again and the DOM was never touched: every panel kept the hidden
|
|
65
|
+
* attribute it was served with, forever. Reading this makes the effect re-run
|
|
66
|
+
* once the DOM is actually reachable. stacksjs/stx#1979
|
|
67
|
+
*/
|
|
68
|
+
const mounted = state(false)
|
|
69
|
+
|
|
52
70
|
|
|
53
71
|
// Walk only direct descendants of THIS container (not nested Tabs').
|
|
54
72
|
function findOwnPanels() {
|
|
@@ -68,12 +86,14 @@ onMount(() => {
|
|
|
68
86
|
icon: p.dataset.icon || '',
|
|
69
87
|
}))
|
|
70
88
|
discoveredTabs.set(list)
|
|
89
|
+
mounted.set(true)
|
|
71
90
|
})
|
|
72
91
|
|
|
73
92
|
// In slot mode, toggle each panel's `hidden` attribute as activeTab changes.
|
|
74
93
|
// Prop mode is handled inline by the @foreach loop's :show binding below.
|
|
75
94
|
effect(() => {
|
|
76
95
|
if (hasPropTabs) return
|
|
96
|
+
if (!mounted()) return
|
|
77
97
|
const panels = findOwnPanels()
|
|
78
98
|
const idx = activeTab()
|
|
79
99
|
panels.forEach((p, i) => {
|
|
@@ -97,14 +117,14 @@ function getTabClasses(index) {
|
|
|
97
117
|
const base = 'px-4 py-2 font-medium text-sm transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900'
|
|
98
118
|
if (variant === 'line') {
|
|
99
119
|
const border = orientation === 'horizontal' ? 'border-b-2' : 'border-r-2'
|
|
100
|
-
return `${base} ${border} ${isActiveTab ? 'border-blue-500 text-
|
|
120
|
+
return `${base} ${border} ${isActiveTab ? 'border-blue-500 text-accent' : 'border-transparent text-fg-muted hover:text-fg hover:border-line-strong'}`
|
|
101
121
|
}
|
|
102
122
|
if (variant === 'pills') {
|
|
103
|
-
return `${base} rounded-
|
|
123
|
+
return `${base} rounded-control ${isActiveTab ? 'bg-field text-fg shadow-sm' : 'text-fg-muted hover:text-fg'}`
|
|
104
124
|
}
|
|
105
125
|
if (variant === 'enclosed') {
|
|
106
|
-
const borders = orientation === 'horizontal' ? 'border-t border-l border-r rounded-t-
|
|
107
|
-
return `${base} ${borders} ${isActiveTab ? 'bg-
|
|
126
|
+
const borders = orientation === 'horizontal' ? 'border-t border-l border-r rounded-t-control' : 'border-t border-l border-b rounded-l-control'
|
|
127
|
+
return `${base} ${borders} ${isActiveTab ? 'bg-panel border-line -mb-px' : 'bg-surface border-transparent hover:border-line'}`
|
|
108
128
|
}
|
|
109
129
|
return base
|
|
110
130
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const to = $props.to || 'body'
|
|
3
|
-
export const disabled = $props.disabled
|
|
4
|
-
export const defer = $props.defer
|
|
3
|
+
export const disabled = $bool($props.disabled)
|
|
4
|
+
export const defer = $bool($props.defer)
|
|
5
5
|
|
|
6
6
|
export const teleportId = $uid
|
|
7
7
|
</script>
|
|
@@ -1,39 +1,49 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const value = $props.value || ''
|
|
3
3
|
export const placeholder = $props.placeholder || ''
|
|
4
|
-
export const disabled = $props.disabled
|
|
5
|
-
export const readonly = $props.readonly
|
|
4
|
+
export const disabled = $bool($props.disabled)
|
|
5
|
+
export const readonly = $bool($props.readonly)
|
|
6
6
|
export const size = $props.size || 'md'
|
|
7
|
-
export const error = $props.error
|
|
7
|
+
export const error = $bool($props.error)
|
|
8
8
|
export const label = $props.label || ''
|
|
9
9
|
export const helperText = $props.helperText || ''
|
|
10
|
-
export const required = $props.required
|
|
10
|
+
export const required = $bool($props.required)
|
|
11
11
|
export const leftIcon = $props.leftIcon || ''
|
|
12
12
|
export const rightIcon = $props.rightIcon || ''
|
|
13
|
-
export const clearable = $props.clearable
|
|
13
|
+
export const clearable = $bool($props.clearable)
|
|
14
14
|
export const maxLength = $props.maxLength
|
|
15
|
-
export const showCount = $props.showCount
|
|
15
|
+
export const showCount = $bool($props.showCount)
|
|
16
16
|
export const className = $props.className || ''
|
|
17
17
|
export const inputClassName = $props.inputClassName || ''
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/*
|
|
20
|
+
* Padding decides the height here too, with no `h-*` to override it: an app
|
|
21
|
+
* passing its own `py-1.5` got the padding it asked for and the height it did
|
|
22
|
+
* not, and `className` cannot beat `h-10` at equal specificity
|
|
23
|
+
* (stacksjs/stx#1993).
|
|
24
|
+
*
|
|
25
|
+
* `lg` also needed a padding step adjusted - py-3 around a 1.75rem line-height
|
|
26
|
+
* is 3.25rem of content inside a declared 3rem box - so py-2.5 lands on the
|
|
27
|
+
* 3rem it always claimed. sm and md were already exact.
|
|
28
|
+
*/
|
|
29
|
+
const sizeClasses = { sm: 'px-3 py-1.5 text-sm', md: 'px-4 py-2 text-base', lg: 'px-5 py-2.5 text-lg' }
|
|
20
30
|
const iconSizeClasses = { sm: 'h-4 w-4', md: 'h-5 w-5', lg: 'h-6 w-6' }
|
|
21
31
|
|
|
22
|
-
const baseClasses = 'block w-full border-0 rounded-
|
|
32
|
+
const baseClasses = 'block w-full border-0 rounded-control shadow-sm ring-1 ring-inset transition-colors duration-200 focus:ring-2 focus:ring-inset dark:bg-neutral-700 dark:text-neutral-100'
|
|
23
33
|
const stateClasses = error
|
|
24
|
-
? 'ring-
|
|
34
|
+
? 'ring-danger-line text-danger-fg placeholder-danger-fg-subtle focus:ring-danger-focus'
|
|
25
35
|
: 'ring-line-strong text-fg placeholder-fg-subtle focus:ring-accent'
|
|
26
36
|
const disabledClasses = disabled
|
|
27
37
|
? 'opacity-50 cursor-not-allowed bg-surface'
|
|
28
38
|
: readonly
|
|
29
39
|
? 'bg-surface cursor-default'
|
|
30
|
-
: 'bg-
|
|
40
|
+
: 'bg-field'
|
|
31
41
|
const paddingClasses = leftIcon ? 'pl-10' : rightIcon || clearable ? 'pr-10' : ''
|
|
32
42
|
|
|
33
|
-
export const inputClasses = `${baseClasses} ${sizeClasses[size]} ${stateClasses} ${disabledClasses} ${paddingClasses} ${inputClassName}`.trim()
|
|
43
|
+
export const inputClasses = `${baseClasses} ${sizeClasses[size] || sizeClasses.md} ${stateClasses} ${disabledClasses} ${paddingClasses} ${inputClassName}`.trim()
|
|
34
44
|
export const labelClasses = `block text-sm font-medium leading-6 mb-2 ${error ? 'text-danger' : 'text-fg'}`.trim()
|
|
35
45
|
export const helperClasses = `mt-2 text-sm ${error ? 'text-danger' : 'text-fg-soft'}`.trim()
|
|
36
|
-
export const iconClasses = iconSizeClasses[size]
|
|
46
|
+
export const iconClasses = iconSizeClasses[size] || iconSizeClasses.md
|
|
37
47
|
export const inputId = `input-${label}`
|
|
38
48
|
</script>
|
|
39
49
|
|
|
@@ -69,7 +79,7 @@ defineExpose({ value: inputValue, clear: onClear })
|
|
|
69
79
|
<label for="{{ inputId }}" class="{{ labelClasses }}">
|
|
70
80
|
{{ label }}
|
|
71
81
|
@if(required)
|
|
72
|
-
<span class="text-
|
|
82
|
+
<span class="text-danger ml-1">*</span>
|
|
73
83
|
@endif
|
|
74
84
|
</label>
|
|
75
85
|
@endif
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const value = $props.value || ''
|
|
3
3
|
export const placeholder = $props.placeholder || ''
|
|
4
|
-
export const disabled = $props.disabled
|
|
5
|
-
export const readonly = $props.readonly
|
|
4
|
+
export const disabled = $bool($props.disabled)
|
|
5
|
+
export const readonly = $bool($props.readonly)
|
|
6
6
|
export const rows = $props.rows || 4
|
|
7
|
-
export const autoResize = $props.autoResize
|
|
7
|
+
export const autoResize = $bool($props.autoResize)
|
|
8
8
|
export const maxRows = $props.maxRows || 10
|
|
9
|
-
export const error = $props.error
|
|
9
|
+
export const error = $bool($props.error)
|
|
10
10
|
export const label = $props.label || ''
|
|
11
11
|
export const helperText = $props.helperText || ''
|
|
12
|
-
export const required = $props.required
|
|
12
|
+
export const required = $bool($props.required)
|
|
13
13
|
export const maxLength = $props.maxLength
|
|
14
|
-
export const showCount = $props.showCount
|
|
14
|
+
export const showCount = $bool($props.showCount)
|
|
15
15
|
export const resize = $props.resize || 'vertical'
|
|
16
16
|
export const className = $props.className || ''
|
|
17
17
|
|
|
18
18
|
const resizeClasses = { none: 'resize-none', vertical: 'resize-y', horizontal: 'resize-x', both: 'resize' }
|
|
19
|
-
const baseClasses = 'block w-full border-0 rounded-
|
|
19
|
+
const baseClasses = 'block w-full border-0 rounded-control shadow-sm ring-1 ring-inset transition-colors duration-200 focus:ring-2 focus:ring-inset px-4 py-2 text-base dark:bg-neutral-700 dark:text-neutral-100'
|
|
20
20
|
const stateClasses = error
|
|
21
|
-
? 'ring-
|
|
21
|
+
? 'ring-danger-line text-danger-fg placeholder-danger-fg-subtle focus:ring-danger-focus'
|
|
22
22
|
: 'ring-line-strong text-fg placeholder-fg-subtle focus:ring-accent'
|
|
23
23
|
const disabledClasses = disabled
|
|
24
24
|
? 'opacity-50 cursor-not-allowed bg-surface'
|
|
25
25
|
: readonly
|
|
26
26
|
? 'bg-surface cursor-default'
|
|
27
|
-
: 'bg-
|
|
27
|
+
: 'bg-field'
|
|
28
28
|
|
|
29
|
-
export const textareaClasses = `${baseClasses} ${stateClasses} ${disabledClasses} ${resizeClasses[resize]} ${className}`.trim()
|
|
29
|
+
export const textareaClasses = `${baseClasses} ${stateClasses} ${disabledClasses} ${resizeClasses[resize] || resizeClasses.vertical} ${className}`.trim()
|
|
30
30
|
export const labelClasses = `block text-sm font-medium leading-6 mb-2 ${error ? 'text-danger' : 'text-fg'}`.trim()
|
|
31
31
|
export const helperClasses = `mt-2 text-sm ${error ? 'text-danger' : 'text-fg-soft'}`.trim()
|
|
32
32
|
</script>
|
|
@@ -71,7 +71,7 @@ defineExpose({ value: inputValue })
|
|
|
71
71
|
<label for="textarea-input" class="{{ labelClasses }}">
|
|
72
72
|
{{ label }}
|
|
73
73
|
@if(required)
|
|
74
|
-
<span class="text-
|
|
74
|
+
<span class="text-danger ml-1">*</span>
|
|
75
75
|
@endif
|
|
76
76
|
</label>
|
|
77
77
|
@endif
|
|
@@ -3,8 +3,8 @@ export const content = $props.content || ''
|
|
|
3
3
|
export const position = $props.position || 'top'
|
|
4
4
|
export const delay = $props.delay || 0
|
|
5
5
|
export const className = $props.className || ''
|
|
6
|
-
export const show = $props.show
|
|
7
|
-
export const disabled = $props.disabled
|
|
6
|
+
export const show = $bool($props.show)
|
|
7
|
+
export const disabled = $bool($props.disabled)
|
|
8
8
|
|
|
9
9
|
const positionClasses = {
|
|
10
10
|
top: 'bottom-full left-1/2 -translate-x-1/2 mb-2',
|
|
@@ -20,19 +20,22 @@ const arrowClasses = {
|
|
|
20
20
|
right: 'right-full top-1/2 -translate-y-1/2 border-r-gray-900 dark:border-r-gray-700',
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export const tooltipClasses = `absolute z-50 px-3 py-2 text-sm font-medium text-white bg-
|
|
24
|
-
export const arrowClass = `absolute w-0 h-0 border-4 border-transparent ${arrowClasses[position]}`.trim()
|
|
23
|
+
export const tooltipClasses = `absolute z-50 px-3 py-2 text-sm font-medium text-white bg-neutral-900 dark:bg-neutral-700 rounded-panel shadow-lg whitespace-nowrap pointer-events-none transition-opacity duration-200 ${positionClasses[position] || positionClasses.top} ${className}`.trim()
|
|
24
|
+
export const arrowClass = `absolute w-0 h-0 border-4 border-transparent ${arrowClasses[position] || arrowClasses.top}`.trim()
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
27
|
<script client>
|
|
28
28
|
const delay = {{ delay }}
|
|
29
|
-
|
|
29
|
+
// A live prop: a tooltip is commonly suppressed by state the page only learns
|
|
30
|
+
// about later — while a field is being edited, or once a hint has been read —
|
|
31
|
+
// and frozen it could only ever reflect the state the page was built in.
|
|
32
|
+
const isDisabled = useReactiveProp('disabled', {{ disabled }})
|
|
30
33
|
// Reactive prop binding — parent can drive `show` via signals. See #1704.
|
|
31
34
|
const isVisible = useReactiveProp('show', {{ show }})
|
|
32
35
|
let timeoutId = null
|
|
33
36
|
|
|
34
37
|
function showTooltip() {
|
|
35
|
-
if (isDisabled) return
|
|
38
|
+
if (isDisabled()) return
|
|
36
39
|
if (delay > 0) {
|
|
37
40
|
timeoutId = setTimeout(() => isVisible.set(true), delay)
|
|
38
41
|
}
|
|
@@ -6,7 +6,7 @@ export const enterTo = $props.enterTo || 'opacity-100'
|
|
|
6
6
|
export const leave = $props.leave || 'transition-opacity duration-200'
|
|
7
7
|
export const leaveFrom = $props.leaveFrom || 'opacity-100'
|
|
8
8
|
export const leaveTo = $props.leaveTo || 'opacity-0'
|
|
9
|
-
export const appear = $props.appear
|
|
9
|
+
export const appear = $bool($props.appear)
|
|
10
10
|
export const duration = $props.duration || 300
|
|
11
11
|
export const delay = $props.delay || 0
|
|
12
12
|
export const preset = $props.preset || ''
|
|
@@ -3,10 +3,10 @@ export const headingText = $props.headingText || 'Two Factor Authentication'
|
|
|
3
3
|
export const labelText = $props.labelText || 'Authentication code'
|
|
4
4
|
export const instructionText = $props.instructionText || 'Open your Symantec 2FA app to view your authentication code.'
|
|
5
5
|
export const codeLength = $props.codeLength || 6
|
|
6
|
-
export const showRecoveryCode = $props.showRecoveryCode
|
|
6
|
+
export const showRecoveryCode = $bool($props.showRecoveryCode, true)
|
|
7
7
|
export const className = $props.className || ''
|
|
8
8
|
|
|
9
|
-
export const containerClasses = `py-32 dark:bg-
|
|
9
|
+
export const containerClasses = `py-32 dark:bg-neutral-900 ${className}`.trim()
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<script client>
|
|
@@ -53,7 +53,7 @@ function onRecoveryCode(event) {
|
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
55
|
<div class="{{ containerClasses }}">
|
|
56
|
-
<div class="mx-auto max-w-sm rounded-
|
|
56
|
+
<div class="mx-auto max-w-sm rounded-control px-8 py-4 shadow-md bg-panel">
|
|
57
57
|
<div class="card-body">
|
|
58
58
|
<div>
|
|
59
59
|
<h3 class="text-center text-sm text-fg font-semibold">
|
|
@@ -63,7 +63,7 @@ function onRecoveryCode(event) {
|
|
|
63
63
|
{{ labelText }}
|
|
64
64
|
</label>
|
|
65
65
|
<form @submit="onSubmit($event)">
|
|
66
|
-
<div class="mt-2 flex rounded-
|
|
66
|
+
<div class="mt-2 flex rounded-control shadow-sm space-x-2">
|
|
67
67
|
@for(i in Array(codeLength).keys())
|
|
68
68
|
<input
|
|
69
69
|
id="code-{{ i }}"
|
|
@@ -71,7 +71,7 @@ function onRecoveryCode(event) {
|
|
|
71
71
|
maxlength="1"
|
|
72
72
|
name="code-{{ i }}"
|
|
73
73
|
placeholder="-"
|
|
74
|
-
class="block w-full border-0 rounded-
|
|
74
|
+
class="block w-full border-0 rounded-control px-2 py-2 text-center text-fg ring-1 ring-line-strong ring-inset sm:text-sm placeholder:text-fg-subtle sm:leading-6 focus:ring-2 focus:ring-indigo-600 focus:ring-inset dark:bg-neutral-700"
|
|
75
75
|
@input="onCodeInput($event, {{ i }})"
|
|
76
76
|
@keydown="onKeyDown($event, {{ i }})"
|
|
77
77
|
/>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const src = $props.src || ''
|
|
3
3
|
export const poster = $props.poster || ''
|
|
4
|
-
export const autoplay = $props.autoplay
|
|
5
|
-
export const loop = $props.loop
|
|
6
|
-
export const muted = $props.muted
|
|
7
|
-
export const controls = $props.controls
|
|
4
|
+
export const autoplay = $bool($props.autoplay)
|
|
5
|
+
export const loop = $bool($props.loop)
|
|
6
|
+
export const muted = $bool($props.muted)
|
|
7
|
+
export const controls = $bool($props.controls, true)
|
|
8
8
|
export const preload = $props.preload || 'metadata'
|
|
9
9
|
export const width = $props.width
|
|
10
10
|
export const height = $props.height
|
|
@@ -12,8 +12,8 @@ export const aspectRatio = $props.aspectRatio || '16/9'
|
|
|
12
12
|
export const className = $props.className || ''
|
|
13
13
|
export const title = $props.title || ''
|
|
14
14
|
|
|
15
|
-
export const containerClasses = `relative w-full overflow-hidden rounded-
|
|
16
|
-
export const videoClasses = 'w-full h-full object-cover bg-
|
|
15
|
+
export const containerClasses = `relative w-full overflow-hidden rounded-panel ${className}`.trim()
|
|
16
|
+
export const videoClasses = 'w-full h-full object-cover bg-neutral-900 dark:bg-neutral-950'
|
|
17
17
|
export const aspectRatioClass = aspectRatio === '16/9' ? 'aspect-video' : aspectRatio === '4/3' ? 'aspect-[4/3]' : aspectRatio === '1/1' ? 'aspect-square' : ''
|
|
18
18
|
</script>
|
|
19
19
|
|
|
@@ -5,15 +5,15 @@ export const rowHeight = $props.rowHeight || 48
|
|
|
5
5
|
export const height = $props.height || 600
|
|
6
6
|
export const headerHeight = $props.headerHeight || 56
|
|
7
7
|
export const overscan = $props.overscan || 5
|
|
8
|
-
export const striped = $props.striped
|
|
9
|
-
export const hoverable = $props.hoverable
|
|
8
|
+
export const striped = $bool($props.striped)
|
|
9
|
+
export const hoverable = $bool($props.hoverable, true)
|
|
10
10
|
export const className = $props.className || ''
|
|
11
11
|
|
|
12
12
|
export const totalHeight = data.length * rowHeight
|
|
13
|
-
export const containerClasses = `border border-line rounded-
|
|
13
|
+
export const containerClasses = `border border-line rounded-panel overflow-hidden ${className}`.trim()
|
|
14
14
|
export const headerClasses = `bg-surface border-b border-line flex`.trim()
|
|
15
15
|
export const headerCellClasses = `px-6 py-3 text-left text-xs font-medium text-fg-soft uppercase tracking-wider`.trim()
|
|
16
|
-
export const bodyClasses = `overflow-auto bg-white dark:bg-
|
|
16
|
+
export const bodyClasses = `overflow-auto bg-white dark:bg-neutral-900`.trim()
|
|
17
17
|
export const rowClasses = `absolute left-0 right-0 flex border-b border-line ${hoverable ? 'hover:bg-surface' : ''}`.trim()
|
|
18
18
|
export const cellClasses = `px-6 py-4 text-sm text-fg`.trim()
|
|
19
19
|
</script>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
3
|
-
`)}function P(j){return j.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
2
|
+
var I=import.meta.require;function H(j){let{code:x,onSuccess:O,onError:J,timeout:U=2000}=j,G=!1,Y=null;return{copied:G,copy:async()=>{try{if(!navigator.clipboard)throw Error("Clipboard API not available");await navigator.clipboard.writeText(x),G=!0,O?.(),Y=setTimeout(()=>{G=!1,Y=null},U)}catch(X){let z=X instanceof Error?X:Error("Failed to copy code");J?.(z),console.error("Failed to copy code:",z)}},reset:()=>{if(G=!1,Y)clearTimeout(Y),Y=null}}}async function M(j){try{return await navigator.clipboard.writeText(j),!0}catch(x){return console.error("Failed to copy to clipboard:",x),!1}}function Q(){if(typeof window>"u")return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function A(j){return j==="system"?Q():j}function T(j={}){let{storageKey:x="theme",defaultTheme:O="system"}=j,J=O;if(typeof window<"u"&&typeof localStorage<"u"){let N=localStorage.getItem(x);if(N)J=N}let U=A(J)==="dark",G=(N)=>{let X=A(N);if(typeof document<"u")if(X==="dark")document.documentElement.classList.add("dark");else document.documentElement.classList.remove("dark");if(typeof localStorage<"u")localStorage.setItem(x,N)},Y=(N)=>{J=N,G(N)},Z=()=>{let X=A(J)==="dark"?"light":"dark";Y(X)};if(G(J),typeof window<"u"&&J==="system")window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(N)=>{if(J==="system")G("system")});return{isDark:U,theme:J,toggle:Z,setTheme:Y}}function S(j,x){if(typeof document>"u")return;document.title=x?x.replace("%s",j):j}function D(j,x,O=!1){if(typeof document>"u")return;let J=O?"property":"name",U=document.querySelector(`meta[${J}="${j}"]`);if(!U)U=document.createElement("meta"),U.setAttribute(J,j),document.head.appendChild(U);U.setAttribute("content",x)}function C(j,x){if(typeof document>"u")return;let O=document.querySelector(`link[rel="${j}"]`);if(!O)O=document.createElement("link"),O.setAttribute("rel",j),document.head.appendChild(O);O.setAttribute("href",x)}function b(j){let{title:x,description:O,author:J,keywords:U,ogImage:G,ogImageWidth:Y,ogImageHeight:Z,twitterCard:N="summary_large_image",twitterSite:X,twitterCreator:z,canonical:_}=j;if(x)S(x),D("og:title",x,!0),D("twitter:title",x);if(O)D("description",O),D("og:description",O,!0),D("twitter:description",O);if(J)D("author",J);if(U&&U.length>0)D("keywords",U.join(", "));if(G)D("og:image",G,!0),D("twitter:image",G);if(Y)D("og:image:width",Y,!0);if(Z)D("og:image:height",Z,!0);if(D("twitter:card",N),X)D("twitter:site",X);if(z)D("twitter:creator",z);if(_)C("canonical",_);if(D("og:type","website",!0),typeof window<"u")D("og:url",window.location.href,!0)}function w(j){let x=[],{title:O,description:J,author:U,keywords:G,ogImage:Y,ogImageWidth:Z,ogImageHeight:N,twitterCard:X="summary_large_image",twitterSite:z,twitterCreator:_,canonical:q}=j;if(O)x.push(`<title>${P(O)}</title>`),x.push(`<meta property="og:title" content="${P(O)}" />`),x.push(`<meta name="twitter:title" content="${P(O)}" />`);if(J)x.push(`<meta name="description" content="${P(J)}" />`),x.push(`<meta property="og:description" content="${P(J)}" />`),x.push(`<meta name="twitter:description" content="${P(J)}" />`);if(U)x.push(`<meta name="author" content="${P(U)}" />`);if(G&&G.length>0)x.push(`<meta name="keywords" content="${P(G.join(", "))}" />`);if(Y)x.push(`<meta property="og:image" content="${P(Y)}" />`),x.push(`<meta name="twitter:image" content="${P(Y)}" />`);if(Z)x.push(`<meta property="og:image:width" content="${P(Z)}" />`);if(N)x.push(`<meta property="og:image:height" content="${P(N)}" />`);if(x.push(`<meta name="twitter:card" content="${P(X)}" />`),z)x.push(`<meta name="twitter:site" content="${P(z)}" />`);if(_)x.push(`<meta name="twitter:creator" content="${P(_)}" />`);if(q)x.push(`<link rel="canonical" href="${P(q)}" />`);return x.push('<meta property="og:type" content="website" />'),x.join(`
|
|
3
|
+
`)}function P(j){return j.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function f(j,x,O={}){let{enabled:J=!0,ignore:U=[]}=O,G=(Y)=>{if(!J||!j)return;let Z=Y.target;if(!j.contains(Z)){if(!U.some((X)=>{let z=document.querySelectorAll(X);return Array.from(z).some((_)=>_.contains(Z))}))x(Y)}};if(typeof document<"u")document.addEventListener("mousedown",G),document.addEventListener("touchstart",G);return()=>{if(typeof document<"u")document.removeEventListener("mousedown",G),document.removeEventListener("touchstart",G)}}function v(j,x={}){let{enabled:O=!0,initialFocus:J=null,returnFocus:U=!0,fallbackFocus:G=null}=x,Y=null,Z=!1;function N(){if(!j)return[];let $=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(j.querySelectorAll($))}function X($){if(!O||!Z||!j)return;let K=N();if(K.length===0){$.preventDefault();return}let F=K[0],L=K[K.length-1];if($.shiftKey){if(document.activeElement===F||document.activeElement===j)$.preventDefault(),L.focus()}else if(document.activeElement===L)$.preventDefault(),F.focus()}function z($){if($.key==="Escape"&&O&&Z)q()}function _(){if(!O||!j||Z)return;if(Y=document.activeElement,J)J.focus();else{let $=N();if($.length>0)$[0].focus();else if(G)G.focus();else j.focus()}document.addEventListener("keydown",X),document.addEventListener("keydown",z),Z=!0}function q(){if(!Z)return;if(document.removeEventListener("keydown",X),document.removeEventListener("keydown",z),U&&Y)Y.focus();Z=!1}return{activate:_,deactivate:q}}function p(j,x={}){let{enabled:O=!0,preventDefault:J=!0,stopPropagation:U=!1,target:G=typeof document<"u"?document:null}=x,Y=Array.isArray(j)?j:[j],Z=(N)=>{if(!O)return;Y.forEach((X)=>{if(!(Array.isArray(X.key)?X.key:[X.key]).some((q)=>q.toLowerCase()===N.key.toLowerCase()))return;if(X.ctrl!==void 0&&X.ctrl!==N.ctrlKey)return;if(X.shift!==void 0&&X.shift!==N.shiftKey)return;if(X.alt!==void 0&&X.alt!==N.altKey)return;if(X.meta!==void 0&&X.meta!==N.metaKey)return;if(J)N.preventDefault();if(U)N.stopPropagation();X.handler(N)})};if(G)G.addEventListener("keydown",Z);return()=>{if(G)G.removeEventListener("keydown",Z)}}var u={ESCAPE:"Escape",ENTER:"Enter",SPACE:" ",TAB:"Tab",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",HOME:"Home",END:"End",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown"};function d(j,x,O={}){let{serializer:J=JSON.stringify,deserializer:U=JSON.parse,onError:G=console.error}=O,Y=x;try{if(typeof window<"u"){let _=window.localStorage.getItem(j);if(_!==null)Y=U(_)}}catch(_){G(_)}let Z=Y,N=new Set;function X(_){try{let q=typeof _==="function"?_(Z):_;if(Z=q,typeof window<"u")window.localStorage.setItem(j,J(q));N.forEach(($)=>$(q))}catch(q){G(q)}}function z(){try{if(Z=x,typeof window<"u")window.localStorage.removeItem(j);N.forEach((_)=>_(x))}catch(_){G(_)}}if(typeof window<"u"){let _=(q)=>{if(q.key===j&&q.newValue!==null)try{let $=U(q.newValue);Z=$,N.forEach((K)=>K($))}catch($){G($)}else if(q.key===j&&q.newValue===null)Z=x,N.forEach(($)=>$(x))};window.addEventListener("storage",_)}return{value:Z,setValue:X,removeValue:z}}function W(j,x={}){let{defaultValue:O=!1}=x,J=O,U=null;if(typeof window<"u"&&"matchMedia"in window){U=window.matchMedia(j),J=U.matches;let Y=(Z)=>{J=Z.matches};if(U.addEventListener)U.addEventListener("change",Y);else U.addListener(Y)}function G(){if(U)J=U.matches}return{matches:J,updateMatches:G}}var B={xs:"(min-width: 320px)",sm:"(min-width: 640px)",md:"(min-width: 768px)",lg:"(min-width: 1024px)",xl:"(min-width: 1280px)","2xl":"(min-width: 1536px)",mobile:"(max-width: 767px)",tablet:"(min-width: 768px) and (max-width: 1023px)",desktop:"(min-width: 1024px)",dark:"(prefers-color-scheme: dark)",light:"(prefers-color-scheme: light)",reducedMotion:"(prefers-reduced-motion: reduce)",portrait:"(orientation: portrait)",landscape:"(orientation: landscape)"};function c(j){return W(B[j])}function o(){return W(B.mobile)}function l(){return W(B.desktop)}function s(){return W(B.dark)}function r(){return W(B.reducedMotion)}export{b as useSEO,r as usePrefersReducedMotion,W as useMediaQuery,d as useLocalStorage,p as useKeyboard,o as useIsMobile,l as useIsDesktop,s as useIsDarkMode,v as useFocusTrap,T as useDarkMode,H as useCopyCode,f as useClickOutside,c as useBreakpoint,S as setTitle,D as setMeta,C as setLink,Q as getSystemTheme,A as getEffectiveTheme,w as generateSEOTags,M as copyToClipboard,u as KeyboardShortcuts,B as Breakpoints};
|