@x33025/sveltely 0.1.9 → 0.1.10
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/components/Library/Floating/Floating.svelte +6 -7
- package/dist/style/layout.d.ts +2 -2
- package/dist/style/layout.js +2 -3
- package/dist/style/loader.d.ts +2 -2
- package/dist/style/loader.js +2 -3
- package/dist/style/surface.d.ts +2 -2
- package/dist/style/surface.js +2 -3
- package/package.json +1 -1
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
function
|
|
306
|
+
function handleOutsidePointerDown(event: PointerEvent) {
|
|
307
307
|
if (!open) return;
|
|
308
308
|
if (isEventInFloatingTree(event)) return;
|
|
309
309
|
closePanel();
|
|
@@ -316,6 +316,7 @@
|
|
|
316
316
|
|
|
317
317
|
function handlePointerMove(event: MouseEvent) {
|
|
318
318
|
if (!closeOnPointerLeave) return;
|
|
319
|
+
if (!parentFloatingId) return;
|
|
319
320
|
if (!open || !triggerEl || !panelEl) return;
|
|
320
321
|
if (isEventInFloatingTree(event)) return;
|
|
321
322
|
if (hasOpenChild(floatingId)) return;
|
|
@@ -323,10 +324,10 @@
|
|
|
323
324
|
const pointer = { x: event.clientX, y: event.clientY };
|
|
324
325
|
const triggerRect = triggerEl.getBoundingClientRect();
|
|
325
326
|
const floatingRect = panelEl.getBoundingClientRect();
|
|
326
|
-
const safePolygon = getSafePolygon(triggerRect, floatingRect, resolvedAnchor);
|
|
327
327
|
|
|
328
328
|
if (isInsideRect(triggerRect, pointer.x, pointer.y)) return;
|
|
329
329
|
if (isInsideRect(floatingRect, pointer.x, pointer.y)) return;
|
|
330
|
+
const safePolygon = getSafePolygon(triggerRect, floatingRect, resolvedAnchor);
|
|
330
331
|
if (pointInPolygon(pointer, safePolygon)) return;
|
|
331
332
|
|
|
332
333
|
closePanel();
|
|
@@ -343,9 +344,11 @@
|
|
|
343
344
|
if (event.type === 'scroll' && isEventInFloatingTree(event)) return;
|
|
344
345
|
closePanel();
|
|
345
346
|
};
|
|
347
|
+
window.addEventListener('pointerdown', handleOutsidePointerDown, true);
|
|
346
348
|
window.addEventListener('scroll', handleWindowChange, true);
|
|
347
349
|
window.addEventListener('resize', handleWindowChange);
|
|
348
350
|
return () => {
|
|
351
|
+
window.removeEventListener('pointerdown', handleOutsidePointerDown, true);
|
|
349
352
|
window.removeEventListener('scroll', handleWindowChange, true);
|
|
350
353
|
window.removeEventListener('resize', handleWindowChange);
|
|
351
354
|
};
|
|
@@ -368,11 +371,7 @@
|
|
|
368
371
|
});
|
|
369
372
|
</script>
|
|
370
373
|
|
|
371
|
-
<svelte:window
|
|
372
|
-
onclick={handleOutsideClick}
|
|
373
|
-
onkeydown={handleEscape}
|
|
374
|
-
onmousemove={handlePointerMove}
|
|
375
|
-
/>
|
|
374
|
+
<svelte:window onkeydown={handleEscape} onmousemove={handlePointerMove} />
|
|
376
375
|
|
|
377
376
|
<div
|
|
378
377
|
bind:this={rootEl}
|
package/dist/style/layout.d.ts
CHANGED
|
@@ -39,9 +39,9 @@ export type LayoutProps = {
|
|
|
39
39
|
align?: LayoutAlignment;
|
|
40
40
|
justify?: LayoutJustification;
|
|
41
41
|
};
|
|
42
|
-
export declare const extractLayoutProps: <T extends Record<
|
|
42
|
+
export declare const extractLayoutProps: <T extends Record<string, unknown>>(props: T) => {
|
|
43
43
|
layoutProps: Partial<LayoutProps>;
|
|
44
|
-
restProps: Record<
|
|
44
|
+
restProps: Record<string, unknown>;
|
|
45
45
|
};
|
|
46
46
|
export declare const layoutStyle: (styles?: LayoutProps) => string;
|
|
47
47
|
export {};
|
package/dist/style/layout.js
CHANGED
|
@@ -69,9 +69,8 @@ const justifyValues = {
|
|
|
69
69
|
export const extractLayoutProps = (props) => {
|
|
70
70
|
const layoutProps = {};
|
|
71
71
|
const restProps = {};
|
|
72
|
-
for (const key of
|
|
73
|
-
|
|
74
|
-
if (typeof key === 'string' && LAYOUT_PROP_KEYS.has(key)) {
|
|
72
|
+
for (const [key, value] of Object.entries(props)) {
|
|
73
|
+
if (LAYOUT_PROP_KEYS.has(key)) {
|
|
75
74
|
layoutProps[key] = value;
|
|
76
75
|
continue;
|
|
77
76
|
}
|
package/dist/style/loader.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { LoaderOptions } from '../actions/loader';
|
|
|
2
2
|
export type LoaderProps = {
|
|
3
3
|
loader?: LoaderOptions;
|
|
4
4
|
};
|
|
5
|
-
export declare const extractLoaderProps: <T extends Record<
|
|
5
|
+
export declare const extractLoaderProps: <T extends Record<string, unknown>>(props: T) => {
|
|
6
6
|
loaderProps: LoaderProps;
|
|
7
|
-
restProps: Record<
|
|
7
|
+
restProps: Record<string, unknown>;
|
|
8
8
|
};
|
|
9
9
|
export declare const resolveLoaderOptions: (props?: LoaderProps) => LoaderOptions;
|
package/dist/style/loader.js
CHANGED
|
@@ -2,9 +2,8 @@ const LOADER_PROP_KEYS = new Set(['loader']);
|
|
|
2
2
|
export const extractLoaderProps = (props) => {
|
|
3
3
|
const loaderProps = {};
|
|
4
4
|
const restProps = {};
|
|
5
|
-
for (const key of
|
|
6
|
-
|
|
7
|
-
if (typeof key === 'string' && LOADER_PROP_KEYS.has(key)) {
|
|
5
|
+
for (const [key, value] of Object.entries(props)) {
|
|
6
|
+
if (LOADER_PROP_KEYS.has(key)) {
|
|
8
7
|
loaderProps[key] = value;
|
|
9
8
|
continue;
|
|
10
9
|
}
|
package/dist/style/surface.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export type StyleProps = {
|
|
|
10
10
|
color?: string;
|
|
11
11
|
};
|
|
12
12
|
export type SurfaceStyles = StyleProps;
|
|
13
|
-
export declare const extractStyleProps: <T extends Record<
|
|
13
|
+
export declare const extractStyleProps: <T extends Record<string, unknown>>(props: T) => {
|
|
14
14
|
styleProps: Partial<StyleProps>;
|
|
15
|
-
restProps: Record<
|
|
15
|
+
restProps: Record<string, unknown>;
|
|
16
16
|
};
|
|
17
17
|
export declare const surfaceStyle: (styles?: SurfaceStyles, prefix?: string) => string;
|
package/dist/style/surface.js
CHANGED
|
@@ -19,9 +19,8 @@ const pushVar = (declarations, name, value) => {
|
|
|
19
19
|
export const extractStyleProps = (props) => {
|
|
20
20
|
const styleProps = {};
|
|
21
21
|
const restProps = {};
|
|
22
|
-
for (const key of
|
|
23
|
-
|
|
24
|
-
if (typeof key === 'string' && STYLE_PROP_KEYS.has(key)) {
|
|
22
|
+
for (const [key, value] of Object.entries(props)) {
|
|
23
|
+
if (STYLE_PROP_KEYS.has(key)) {
|
|
25
24
|
styleProps[key] = value;
|
|
26
25
|
continue;
|
|
27
26
|
}
|