svelte-floating-ui
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import type { ComputePositionConfig, ComputePositionReturn, Middleware, Padding, VirtualElement } from "@floating-ui/core"; | ||
import type { ComputePositionConfig, ComputePositionReturn, Middleware, Padding, VirtualElement } from "./core"; | ||
import type { Options } from "@floating-ui/dom/src/autoUpdate"; | ||
@@ -3,0 +3,0 @@ import type { Writable } from "svelte/store"; |
10
index.js
//@ts-ignore | ||
import { arrow as arrowCore } from "@floating-ui/core"; | ||
import { autoUpdate as _autoUpdate, computePosition } from "@floating-ui/dom"; | ||
import { arrow as arrowCore } from "./core"; | ||
import { autoUpdate as _autoUpdate, computePosition } from "./dom"; | ||
import { get } from "svelte/store"; | ||
import { onDestroy } from 'svelte'; | ||
import { onDestroy, tick } from 'svelte'; | ||
export function createFloatingActions(initOptions) { | ||
@@ -55,3 +55,5 @@ let referenceElement; | ||
if (autoUpdate !== false) { | ||
return _autoUpdate(referenceElement, floatingElement, () => updatePosition(options), (autoUpdate === true ? {} : autoUpdate)); | ||
tick().then(() => { | ||
return _autoUpdate(referenceElement, floatingElement, () => updatePosition(options), (autoUpdate === true ? {} : autoUpdate)); | ||
}); | ||
} | ||
@@ -58,0 +60,0 @@ return; |
{ | ||
"name": "svelte-floating-ui", | ||
"description": "Svelte actions for working with floating ui", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"license": "MIT", | ||
@@ -22,29 +22,30 @@ "main": "./index.js", | ||
"devDependencies": { | ||
"@sveltejs/adapter-auto": "next", | ||
"@sveltejs/kit": "next", | ||
"@sveltejs/kit": "1.0.0-next.589", | ||
"@sveltejs/package": "^1.0.2", | ||
"@typescript-eslint/eslint-plugin": "^5.48.1", | ||
"@typescript-eslint/parser": "^5.48.1", | ||
"eslint": "^8.31.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"@typescript-eslint/eslint-plugin": "^5.55.0", | ||
"@typescript-eslint/parser": "^5.55.0", | ||
"eslint": "^8.36.0", | ||
"eslint-config-prettier": "^8.7.0", | ||
"eslint-plugin-svelte3": "^4.0.0", | ||
"prettier": "^2.8.2", | ||
"prettier": "^2.8.4", | ||
"prettier-plugin-svelte": "^2.9.0", | ||
"svelte": "^3.55.1", | ||
"svelte": "^3.57.0", | ||
"svelte-check": "^2.10.3", | ||
"svelte-preprocess": "^4.10.7", | ||
"tslib": "^2.4.1", | ||
"typescript": "^4.9.4", | ||
"vite": "^4.0.4", | ||
"svelte2tsx": "^0.5.23" | ||
"svelte2tsx": "^0.5.23", | ||
"tslib": "^2.5.0", | ||
"typescript": "^4.9.5", | ||
"vite": "^4.2.0" | ||
}, | ||
"type": "module", | ||
"dependencies": { | ||
"@floating-ui/core": "^1.1.0", | ||
"@floating-ui/dom": "^1.1.0" | ||
"@floating-ui/core": "^1.2.4", | ||
"@floating-ui/dom": "^1.2.4" | ||
}, | ||
"exports": { | ||
"./package.json": "./package.json", | ||
"./core": "./core/index.js", | ||
"./dom": "./dom/index.js", | ||
".": "./index.js" | ||
} | ||
} |
@@ -27,3 +27,3 @@ <p align="center"> | ||
<script lang="ts"> | ||
import { offset, flip, shift } from "@floating-ui/dom"; | ||
import { offset, flip, shift } from "svelte-floating-ui/dom"; | ||
import { createFloatingActions } from "svelte-floating-ui"; | ||
@@ -94,3 +94,3 @@ | ||
<script> | ||
import { offset, flip, shift } from "@floating-ui/dom"; | ||
import { offset, flip, shift } from "svelte-floating-ui/dom"; | ||
import { createFloatingActions } from "svelte-floating-ui"; | ||
@@ -138,4 +138,4 @@ | ||
<script lang='ts'> | ||
import type { ClientRectObject, VirtualElement } from 'svelte-floating-ui/core' | ||
import { createFloatingActions } from 'svelte-floating-ui' | ||
import type { ClientRectObject, VirtualElement } from '@floating-ui/core' | ||
import { writable } from 'svelte/store' | ||
@@ -142,0 +142,0 @@ |
14640
1.56%16
-5.88%9
80%133
4.72%Updated
Updated