fix: Fix lint errors (#559)
* cleanup: postactions styling * misc: fix first round of errors * pkg: remove vitest * fix: fix lint errors stage 2 * fix: fix lint errors stage 3 * fix: fix lint errors, stage 3 * misc: update eslint rules to warn for writable derived
This commit is contained in:
1 parent
1824245f13
commit
76c581123a
225 files changed
+1553
-2352
No files matched your search
@@ -1,16 +1,13 @@
|
||||
<script lang="ts">
|
||||
import Material from '../materials/Material.svelte'
|
||||
import Popover, { type Origin } from '../popover/Popover.svelte'
|
||||
import {
|
||||
flip,
|
||||
offset,
|
||||
shift,
|
||||
type Middleware,
|
||||
type Placement,
|
||||
shift,
|
||||
type Strategy,
|
||||
flip,
|
||||
autoPlacement,
|
||||
size,
|
||||
} from '@floating-ui/core'
|
||||
import Popover from '../popover/Popover.svelte'
|
||||
|
||||
interface Props {
|
||||
openOnHover?: boolean
|
||||
@@ -22,7 +19,6 @@
|
||||
class?: string
|
||||
target?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let {
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte'
|
||||
import Button, {
|
||||
type ButtonAlignment,
|
||||
type ButtonColor,
|
||||
type ButtonProps,
|
||||
} from '../button/Button.svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
interface Props extends ButtonProps {
|
||||
color?: ButtonColor
|
||||
alignment?: ButtonAlignment
|
||||
href?: string | undefined
|
||||
disabled?: boolean
|
||||
class?: string
|
||||
icon?: IconSource
|
||||
prefix?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
suffix?: import('svelte').Snippet
|
||||
[key: string]: any
|
||||
prefix?: Snippet
|
||||
children?: Snippet
|
||||
suffix?: Snippet
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -25,9 +26,9 @@
|
||||
disabled = false,
|
||||
class: clazz = '',
|
||||
icon,
|
||||
prefix,
|
||||
prefix: passedPrefix,
|
||||
children,
|
||||
suffix,
|
||||
suffix: passedSuffix,
|
||||
...rest
|
||||
}: Props = $props()
|
||||
</script>
|
||||
@@ -55,12 +56,12 @@
|
||||
{#if icon}
|
||||
<Icon src={icon} micro size="16" />
|
||||
{:else}
|
||||
{@render prefix?.()}
|
||||
{@render passedPrefix?.()}
|
||||
{/if}
|
||||
</div>
|
||||
{/snippet}
|
||||
{@render children?.()}
|
||||
{#snippet suffix()}
|
||||
{@render suffix?.()}
|
||||
{@render passedSuffix?.()}
|
||||
{/snippet}
|
||||
</Button>
|
||||
@@ -12,22 +12,20 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { Material } from '../index'
|
||||
import { backOut, elasticIn, elasticOut, expoOut } from 'svelte/easing'
|
||||
import { fly, scale } from 'svelte/transition'
|
||||
import { createFloatingActions } from 'svelte-floating-ui'
|
||||
import {
|
||||
offset,
|
||||
type Middleware,
|
||||
flip,
|
||||
offset,
|
||||
shift,
|
||||
type Middleware,
|
||||
type Placement,
|
||||
type Strategy,
|
||||
size,
|
||||
} from '@floating-ui/core'
|
||||
import Portal from './Portal.svelte'
|
||||
import { createFloatingActions } from 'svelte-floating-ui'
|
||||
import { focusTrap } from 'svelte-focus-trap'
|
||||
import { tick } from 'svelte'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { scale } from 'svelte/transition'
|
||||
import { Material } from '../index'
|
||||
import Portal from './Portal.svelte'
|
||||
|
||||
interface Props {
|
||||
openOnHover?: boolean
|
||||
@@ -61,8 +59,8 @@
|
||||
|
||||
let canUseContents = $state(true)
|
||||
|
||||
let el: any = $state()
|
||||
let popoverEl: any = $state()
|
||||
let el = $state<HTMLElement>()
|
||||
let popoverEl = $state<HTMLElement>()
|
||||
|
||||
const [floatingRef, floatingContent] = createFloatingActions({
|
||||
strategy: strategy,
|
||||
@@ -79,7 +77,7 @@
|
||||
const customFloatingRef = (node: HTMLDivElement) => {
|
||||
const n = node.children.item(0)
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error svelte hell
|
||||
if (n) floatingRef(n)
|
||||
else {
|
||||
canUseContents = false
|
||||
@@ -89,11 +87,13 @@
|
||||
</script>
|
||||
|
||||
<svelte:body
|
||||
onclick={(e) => {
|
||||
onclick={e => {
|
||||
if (openOnHover) return
|
||||
|
||||
// @ts-expect-error svelte hell
|
||||
if (!el?.contains(e.target) && open) {
|
||||
if (!autoClose) {
|
||||
// @ts-expect-error svelte hell
|
||||
if (popoverEl && !popoverEl.contains(e.target)) {
|
||||
open = false
|
||||
}
|
||||
@@ -102,9 +102,10 @@
|
||||
}
|
||||
}
|
||||
}}
|
||||
onkeydown={async (e) => {
|
||||
onkeydown={async e => {
|
||||
if (open && e.key == 'Escape') {
|
||||
open = false
|
||||
// @ts-expect-error svelte hell
|
||||
el?.firstChild.focus()
|
||||
}
|
||||
}}
|
||||
@@ -117,7 +118,7 @@
|
||||
onfocus={() => (openOnHover ? (open = true) : false)}
|
||||
onfocusout={() => (openOnHover ? (open = false) : false)}
|
||||
onclick={() => (!openOnHover && !manual ? (open = !open) : false)}
|
||||
onkeydown={(e) => {
|
||||
onkeydown={e => {
|
||||
if (e.key == 'Escape') open = false
|
||||
}}
|
||||
tabindex="0"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
// https://github.com/sveltejs/svelte/issues/3088#issuecomment-505785516
|
||||
import { onMount, onDestroy, createEventDispatcher } from 'svelte'
|
||||
let slottedElements: HTMLDivElement = $state(),
|
||||
let slottedElements = $state<HTMLDivElement>(),
|
||||
portal: HTMLDivElement
|
||||
|
||||
const dispatch = createEventDispatcher<{ mounted: void }>()
|
||||
@@ -13,7 +13,7 @@
|
||||
portal = document?.createElement('div')
|
||||
if (portal) portal.className = 'portal-mount'
|
||||
document?.body.appendChild(portal)
|
||||
portal?.appendChild(slottedElements)
|
||||
if (slottedElements) portal?.appendChild(slottedElements)
|
||||
dispatch('mounted')
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user