Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/techniq/svelte-ux
Browse files Browse the repository at this point in the history
  • Loading branch information
techniq committed Jul 14, 2024
2 parents 4ae2aab + c345d08 commit 1997b5f
Show file tree
Hide file tree
Showing 25 changed files with 188 additions and 211 deletions.
6 changes: 0 additions & 6 deletions .changeset/mean-maps-provide.md

This file was deleted.

6 changes: 6 additions & 0 deletions packages/create-svelte-ux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# create-svelte-ux

## 0.6.3

### Patch Changes

- Update dependencies ([`9be6afada9e247c0ad5f758a7907798bceeb29a1`](https://github.com/techniq/svelte-ux/commit/9be6afada9e247c0ad5f758a7907798bceeb29a1))

## 0.6.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte-ux/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-svelte-ux",
"version": "0.6.2",
"version": "0.6.3",
"description": "A CLI for creating new Svelte UX projects",
"repository": {
"type": "git",
Expand Down
10 changes: 10 additions & 0 deletions packages/svelte-ux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# svelte-ux

## 0.73.0

### Minor Changes

- Improve Svelte 5 compatibility, especially with docs (enabling `svelte-check` to pass) ([#399](https://github.com/techniq/svelte-ux/pull/399))

### Patch Changes

- Update dependencies ([`9be6afada9e247c0ad5f758a7907798bceeb29a1`](https://github.com/techniq/svelte-ux/commit/9be6afada9e247c0ad5f758a7907798bceeb29a1))

## 0.72.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-ux/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "Sean Lynch <[email protected]>",
"license": "MIT",
"repository": "techniq/svelte-ux",
"version": "0.72.4",
"version": "0.73.0",
"scripts": {
"dev": "vite dev",
"build": "vite build",
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte-ux/src/docs/ViewSourceButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
</script>

{#if source}
<Toggle let:on={open} let:toggle>
<Toggle let:on={open} let:toggle let:toggleOff>
<Button {icon} on:click={toggle} variant="fill-light" color="primary" size="sm">{label}</Button>
<Dialog
{open}
on:close={toggle}
on:close={toggleOff}
class="max-h-[98dvh] md:max-h-[90dvh] max-w-[98vw] md:max-w-[90vw] grid grid-rows-[auto,1fr,auto]"
>
<div class="grid grid-cols-[1fr,auto] gap-3 items-center p-4">
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-ux/src/lib/components/Badge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { cls } from '../utils/styles.js';
import { getComponentClasses } from './theme.js';
export let value: number = $$slots.value ? 1 : 0;
export let value = $$slots.value ? 1 : 0;
export let small = false;
export let circle = false;
export let dot = false;
Expand Down
8 changes: 4 additions & 4 deletions packages/svelte-ux/src/lib/components/BarStack.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
import { cls } from '../utils/styles.js';
import { getComponentClasses } from './index.js';
const dispatch = createEventDispatcher<{
itemClick: (typeof data)[number];
}>();
export let data: {
label: string;
value: number;
Expand All @@ -26,6 +22,10 @@
item?: string;
} = {};
const settingsClasses = getComponentClasses('BarStack');
const dispatch = createEventDispatcher<{
itemClick: (typeof data)[number];
}>();
</script>

<div class={cls('BarStack', 'flex gap-px', settingsClasses.root, classes.root, $$props.class)}>
Expand Down
48 changes: 26 additions & 22 deletions packages/svelte-ux/src/lib/components/SelectField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -561,17 +561,19 @@
</slot>
</svelte:fragment>

<slot name="empty" slot="empty" let:loading>
<div
class={cls(
'p-3 text-surface-content/5/50 italic text-sm',
settingsClasses.empty,
classes.empty
)}
>
{loading ? 'Loading...' : 'No options found'}
</div>
</slot>
<svelte:fragment slot="empty" let:loading>
<slot name="empty" {loading}>
<div
class={cls(
'p-3 text-surface-content/5/50 italic text-sm',
settingsClasses.empty,
classes.empty
)}
>
{loading ? 'Loading...' : 'No options found'}
</div>
</slot>
</svelte:fragment>
</SelectListOptions>

<slot name="actions" {hide} />
Expand Down Expand Up @@ -618,17 +620,19 @@
</slot>
</svelte:fragment>

<slot name="empty" slot="empty" let:loading>
<div
class={cls(
'p-3 text-surface-content/5/50 italic text-sm',
settingsClasses.empty,
classes.empty
)}
>
{loading ? 'Loading...' : 'No options found'}
</div>
</slot>
<svelte:fragment slot="empty" let:loading>
<slot name="empty" {loading}>
<div
class={cls(
'p-3 text-surface-content/5/50 italic text-sm',
settingsClasses.empty,
classes.empty
)}
>
{loading ? 'Loading...' : 'No options found'}
</div>
</slot>
</svelte:fragment>
</SelectListOptions>
{/if}
{/if}
Expand Down
5 changes: 2 additions & 3 deletions packages/svelte-ux/src/lib/stores/debounceStore.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { derived, get, type Stores } from 'svelte/store';
import { derived, get, type Readable } from 'svelte/store';

function debounceStore<T extends Stores>(original: T, timeout = 300) {
function debounceStore<T extends Readable<any>>(original: T, timeout = 300) {
return derived(
original,
($original, set) => {
Expand All @@ -10,7 +10,6 @@ function debounceStore<T extends Stores>(original: T, timeout = 300) {
clearTimeout(timer);
};
},
// @ts-expect-error
get(original)
);
}
Expand Down
57 changes: 2 additions & 55 deletions packages/svelte-ux/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
<svelte:fragment slot="nav">
<NavMenu />
<!-- Spacer -->
<div class="h-4" />
<div class="h-4"></div>
</svelte:fragment>

<AppBar {title}>
Expand Down Expand Up @@ -302,7 +302,7 @@
window.open(e.detail.value, '_blank');
}}
>
<span slot="selection" class="hidden" />
<span slot="selection" class="hidden"></span>
</MenuButton>
{/if}
</div>
Expand All @@ -312,56 +312,3 @@
<slot />
</main>
</AppLayout>

<style lang="postcss">
:global(html) {
@apply bg-surface-200 accent-primary;
/* background-image:
radial-gradient(at 0% 0%, hsl(var(--color-secondary) / 0.33) 0px, transparent 50%),
radial-gradient(at 98% 1%, hsl(var(--color-primary) / 0.33) 0px, transparent 50%); */
}
:global(nav h1) {
@apply py-2 pl-4 mt-4 text-sm text-surface-content font-bold bg-surface-200 border-t border-b;
}
:global(nav h2) {
@apply pt-4 pb-2 pl-4 text-xs text-surface-content font-bold;
}
:global(main :is(h1, h2, h3):not(.prose *, .related *, .ApiDocs *)) {
scroll-margin-top: calc(var(--headerHeight) + 148px); /* app header + docs header */
}
:global(main h1:not(.prose *, .related *, .ApiDocs *)) {
@apply text-xl font-semibold mt-4 mb-2 border-b pb-1;
}
:global(main h2:not(.prose *, .related *, .ApiDocs *)) {
@apply text-lg font-semibold mt-4 mb-1;
}
:global(main h3:not(.prose *, .related *, .ApiDocs *)) {
@apply text-xs text-surface-content/50 mb-1;
}
:global(main :not(.prose) h2 + h3) {
@apply -mt-1;
}
:global(main small) {
@apply text-xs text-surface-content/50 inline-block;
}
:global(.TableOfContents small) {
@apply hidden;
}
/* Code/Preview backgrounds */
:global(pre[class*='language-']) {
@apply bg-surface-content;
}
:global(.dark pre[class*='language-']) {
@apply bg-surface-300;
}
</style>
51 changes: 51 additions & 0 deletions packages/svelte-ux/src/routes/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

html {
@apply bg-surface-200 accent-primary scroll-smooth;
/* background-image:
radial-gradient(at 0% 0%, hsl(var(--color-secondary) / 0.33) 0px, transparent 50%),
radial-gradient(at 98% 1%, hsl(var(--color-primary) / 0.33) 0px, transparent 50%); */
}

nav h1 {
@apply py-2 pl-4 mt-4 text-sm text-surface-content font-bold bg-surface-200 border-t border-b;
}

nav h2 {
@apply pt-4 pb-2 pl-4 text-xs text-surface-content font-bold;
}

main :is(h1, h2, h3):not(.prose *, .related *, .ApiDocs *) {
scroll-margin-top: calc(var(--headerHeight) + 148px); /* app header + docs header */
}

main h1:not(.prose *, .related *, .ApiDocs *) {
@apply text-xl font-semibold mt-4 mb-2 border-b pb-1;
}

main h2:not(.prose *, .related *, .ApiDocs *) {
@apply text-lg font-semibold mt-4 mb-1;
}

main h3:not(.prose *, .related *, .ApiDocs *) {
@apply text-xs text-surface-content/50 mb-1;
}
main :not(.prose) h2 + h3 {
@apply -mt-1;
}

main small {
@apply text-xs text-surface-content/50 inline-block;
}

.TableOfContents small {
@apply hidden;
}

/* Code/Preview backgrounds */
pre[class*='language-'] {
@apply bg-surface-content;
}

.dark pre[class*='language-'] {
@apply bg-surface-300;
}
Loading

0 comments on commit 1997b5f

Please sign in to comment.