@quaffui/quaff 1.0.0-alpha2 → 1.0.0-beta12
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/README.md +2 -0
- package/dist/classes/QScrollObserver.svelte.d.ts +4 -4
- package/dist/classes/QScrollObserver.svelte.js +26 -13
- package/dist/components/avatar/QAvatar.svelte +4 -0
- package/dist/components/avatar/QAvatar.svelte.d.ts +4 -14
- package/dist/components/breadcrumbs/QBreadcrumbs.scss +9 -5
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte +46 -16
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte.d.ts +24 -12
- package/dist/components/breadcrumbs/QBreadcrumbsEl.scss +22 -3
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte +50 -38
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte.d.ts +4 -14
- package/dist/components/breadcrumbs/props.d.ts +4 -4
- package/dist/components/button/QBtn.scss +3 -1
- package/dist/components/button/QBtn.svelte +38 -22
- package/dist/components/button/QBtn.svelte.d.ts +4 -14
- package/dist/components/button/props.d.ts +9 -2
- package/dist/components/card/QCard.svelte +9 -5
- package/dist/components/card/QCard.svelte.d.ts +4 -14
- package/dist/components/card/QCardActions.svelte +4 -0
- package/dist/components/card/QCardActions.svelte.d.ts +4 -14
- package/dist/components/card/QCardSection.svelte +2 -0
- package/dist/components/card/QCardSection.svelte.d.ts +4 -14
- package/dist/components/checkbox/QCheckbox.svelte +6 -4
- package/dist/components/checkbox/QCheckbox.svelte.d.ts +4 -14
- package/dist/components/checkbox/props.d.ts +1 -1
- package/dist/components/chip/QChip.scss +3 -1
- package/dist/components/chip/QChip.svelte +24 -14
- package/dist/components/chip/QChip.svelte.d.ts +4 -14
- package/dist/components/codeBlock/QCodeBlock.svelte +8 -0
- package/dist/components/codeBlock/QCodeBlock.svelte.d.ts +4 -14
- package/dist/components/dialog/QDialog.scss +17 -0
- package/dist/components/dialog/QDialog.svelte +34 -9
- package/dist/components/dialog/QDialog.svelte.d.ts +8 -21
- package/dist/components/drawer/QDrawer.scss +2 -2
- package/dist/components/drawer/QDrawer.svelte +124 -69
- package/dist/components/drawer/QDrawer.svelte.d.ts +8 -21
- package/dist/components/drawer/props.d.ts +3 -3
- package/dist/components/expansion-item/QExpansionItem.scss +59 -0
- package/dist/components/expansion-item/QExpansionItem.svelte +319 -0
- package/dist/components/expansion-item/QExpansionItem.svelte.d.ts +8 -0
- package/dist/components/expansion-item/docs.d.ts +2 -0
- package/dist/components/expansion-item/docs.js +17 -0
- package/dist/components/expansion-item/props.d.ts +129 -0
- package/dist/components/expansion-item/props.js +1 -0
- package/dist/components/footer/QFooter.scss +1 -1
- package/dist/components/footer/QFooter.svelte +32 -28
- package/dist/components/footer/QFooter.svelte.d.ts +4 -14
- package/dist/components/header/QHeader.scss +1 -1
- package/dist/components/header/QHeader.svelte +41 -33
- package/dist/components/header/QHeader.svelte.d.ts +4 -14
- package/dist/components/icon/QIcon.svelte +6 -4
- package/dist/components/icon/QIcon.svelte.d.ts +4 -14
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +3 -1
- package/dist/components/input/QInput.svelte +139 -17
- package/dist/components/input/QInput.svelte.d.ts +4 -14
- package/dist/components/input/docs.js +2 -2
- package/dist/components/input/mask.d.ts +10 -0
- package/dist/components/input/mask.js +204 -0
- package/dist/components/input/props.d.ts +37 -4
- package/dist/components/layout/QLayout.svelte +248 -93
- package/dist/components/layout/QLayout.svelte.d.ts +67 -15
- package/dist/components/layout/props.d.ts +1 -1
- package/dist/components/list/QItem.scss +7 -4
- package/dist/components/list/QItem.svelte +44 -24
- package/dist/components/list/QItem.svelte.d.ts +17 -13
- package/dist/components/list/QItemSection.scss +24 -3
- package/dist/components/list/QItemSection.svelte +19 -21
- package/dist/components/list/QItemSection.svelte.d.ts +4 -14
- package/dist/components/list/QList.scss +17 -4
- package/dist/components/list/QList.svelte +30 -8
- package/dist/components/list/QList.svelte.d.ts +17 -13
- package/dist/components/list/props.d.ts +3 -3
- package/dist/components/menu/QMenu.scss +37 -0
- package/dist/components/menu/QMenu.svelte +314 -0
- package/dist/components/menu/QMenu.svelte.d.ts +8 -0
- package/dist/components/menu/docs.d.ts +2 -0
- package/dist/components/menu/docs.js +27 -0
- package/dist/components/menu/props.d.ts +48 -0
- package/dist/components/menu/props.js +1 -0
- package/dist/components/progress/QCircularProgress.svelte +17 -14
- package/dist/components/progress/QCircularProgress.svelte.d.ts +4 -14
- package/dist/components/progress/QLinearProgress.svelte +15 -15
- package/dist/components/progress/QLinearProgress.svelte.d.ts +4 -14
- package/dist/components/radio/QRadio.svelte +6 -4
- package/dist/components/radio/QRadio.svelte.d.ts +4 -14
- package/dist/components/radio/props.d.ts +1 -1
- package/dist/components/railbar/QRailbar.scss +1 -1
- package/dist/components/railbar/QRailbar.svelte +36 -35
- package/dist/components/railbar/QRailbar.svelte.d.ts +4 -14
- package/dist/components/select/QSelect.svelte +316 -102
- package/dist/components/select/QSelect.svelte.d.ts +4 -14
- package/dist/components/select/filter.d.ts +13 -0
- package/dist/components/select/filter.js +73 -0
- package/dist/components/select/index.scss +28 -27
- package/dist/components/select/option.d.ts +9 -0
- package/dist/components/select/option.js +59 -0
- package/dist/components/select/props.d.ts +40 -7
- package/dist/components/separator/QSeparator.scss +2 -0
- package/dist/components/separator/QSeparator.svelte +9 -8
- package/dist/components/separator/QSeparator.svelte.d.ts +4 -14
- package/dist/components/switch/QSwitch.scss +12 -6
- package/dist/components/switch/QSwitch.svelte +7 -1
- package/dist/components/switch/QSwitch.svelte.d.ts +4 -14
- package/dist/components/table/QTable.svelte +31 -19
- package/dist/components/table/QTable.svelte.d.ts +4 -14
- package/dist/components/table/index.scss +1 -1
- package/dist/components/tabs/QTab.scss +2 -0
- package/dist/components/tabs/QTab.svelte +19 -22
- package/dist/components/tabs/QTab.svelte.d.ts +4 -14
- package/dist/components/tabs/QTabs.svelte +59 -32
- package/dist/components/tabs/QTabs.svelte.d.ts +18 -18
- package/dist/components/toolbar/QToolbar.svelte +2 -0
- package/dist/components/toolbar/QToolbar.svelte.d.ts +4 -14
- package/dist/components/toolbar/QToolbarTitle.svelte +2 -0
- package/dist/components/toolbar/QToolbarTitle.svelte.d.ts +4 -14
- package/dist/components/tooltip/QTooltip.svelte +48 -38
- package/dist/components/tooltip/QTooltip.svelte.d.ts +29 -17
- package/dist/components/tooltip/QTooltipBase.svelte +18 -8
- package/dist/components/tooltip/QTooltipBase.svelte.d.ts +4 -14
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.js +2 -0
- package/dist/composables/useColor.d.ts +1 -0
- package/dist/composables/useColor.js +19 -0
- package/dist/composables/useRevealScrollObserver.svelte.d.ts +9 -0
- package/dist/composables/useRevealScrollObserver.svelte.js +25 -0
- package/dist/composables/useRouterLink.d.ts +3 -2
- package/dist/composables/useRouterLink.js +2 -2
- package/dist/css/_components.scss +2 -0
- package/dist/css/classes/_grid.scss +12 -1
- package/dist/css/index.css +1 -1
- package/dist/css/mixins/_design.scss +1 -1
- package/dist/css/mixins/_field.scss +3 -2
- package/dist/css/mixins/_table.scss +1 -1
- package/dist/css/mixins/_toolbar.scss +1 -1
- package/dist/css/shared/q-field.scss +7 -6
- package/dist/css/theme/_page.scss +8 -6
- package/dist/css/theme/_reset.scss +2 -1
- package/dist/helpers/clickOutside.js +5 -4
- package/dist/helpers/ripple.js +5 -6
- package/dist/helpers/version.d.ts +1 -1
- package/dist/helpers/version.js +1 -1
- package/dist/{components/private/ContextReseter.svelte → internal/ContextResetter.svelte} +2 -3
- package/dist/internal/ContextResetter.svelte.d.ts +8 -0
- package/dist/{components/private → internal}/QIconSnippet.svelte +2 -2
- package/dist/internal/QIconSnippet.svelte.d.ts +10 -0
- package/dist/utils/context.d.ts +49 -32
- package/dist/utils/context.js +82 -33
- package/dist/utils/dom.d.ts +6 -0
- package/dist/utils/dom.js +33 -0
- package/dist/utils/events.d.ts +0 -24
- package/dist/utils/events.js +0 -24
- package/package.json +44 -38
- package/dist/classes/QContext.svelte.d.ts +0 -42
- package/dist/classes/QContext.svelte.js +0 -63
- package/dist/components/avatar/docs.props.d.ts +0 -3
- package/dist/components/avatar/docs.props.js +0 -87
- package/dist/components/breadcrumbs/docs.props.d.ts +0 -5
- package/dist/components/breadcrumbs/docs.props.js +0 -144
- package/dist/components/button/docs.props.d.ts +0 -3
- package/dist/components/button/docs.props.js +0 -227
- package/dist/components/card/docs.props.d.ts +0 -7
- package/dist/components/card/docs.props.js +0 -89
- package/dist/components/checkbox/docs.props.d.ts +0 -3
- package/dist/components/checkbox/docs.props.js +0 -41
- package/dist/components/chip/docs.props.d.ts +0 -3
- package/dist/components/chip/docs.props.js +0 -137
- package/dist/components/codeBlock/docs.props.d.ts +0 -3
- package/dist/components/codeBlock/docs.props.js +0 -83
- package/dist/components/dialog/docs.props.d.ts +0 -3
- package/dist/components/dialog/docs.props.js +0 -65
- package/dist/components/drawer/docs.props.d.ts +0 -3
- package/dist/components/drawer/docs.props.js +0 -149
- package/dist/components/footer/docs.props.d.ts +0 -3
- package/dist/components/footer/docs.props.js +0 -65
- package/dist/components/header/docs.props.d.ts +0 -7
- package/dist/components/header/docs.props.js +0 -131
- package/dist/components/icon/docs.props.d.ts +0 -3
- package/dist/components/icon/docs.props.js +0 -107
- package/dist/components/input/docs.props.d.ts +0 -3
- package/dist/components/input/docs.props.js +0 -162
- package/dist/components/layout/docs.props.d.ts +0 -3
- package/dist/components/layout/docs.props.js +0 -81
- package/dist/components/list/docs.props.d.ts +0 -11
- package/dist/components/list/docs.props.js +0 -434
- package/dist/components/private/ContextReseter.svelte.d.ts +0 -14
- package/dist/components/private/QApi.svelte +0 -296
- package/dist/components/private/QApi.svelte.d.ts +0 -14
- package/dist/components/private/QDocs.svelte +0 -155
- package/dist/components/private/QDocs.svelte.d.ts +0 -14
- package/dist/components/private/QDocsSection.svelte +0 -62
- package/dist/components/private/QDocsSection.svelte.d.ts +0 -14
- package/dist/components/private/QIconSnippet.svelte.d.ts +0 -14
- package/dist/components/private/index.d.ts +0 -6
- package/dist/components/private/index.js +0 -6
- package/dist/components/progress/docs.props.d.ts +0 -5
- package/dist/components/progress/docs.props.js +0 -314
- package/dist/components/radio/docs.props.d.ts +0 -3
- package/dist/components/radio/docs.props.js +0 -53
- package/dist/components/railbar/docs.props.d.ts +0 -3
- package/dist/components/railbar/docs.props.js +0 -47
- package/dist/components/select/docs.props.d.ts +0 -3
- package/dist/components/select/docs.props.js +0 -198
- package/dist/components/separator/docs.props.d.ts +0 -5
- package/dist/components/separator/docs.props.js +0 -196
- package/dist/components/switch/docs.props.d.ts +0 -3
- package/dist/components/switch/docs.props.js +0 -119
- package/dist/components/table/docs.props.d.ts +0 -3
- package/dist/components/table/docs.props.js +0 -94
- package/dist/components/tabs/docs.props.d.ts +0 -5
- package/dist/components/tabs/docs.props.js +0 -86
- package/dist/components/toolbar/docs.props.d.ts +0 -5
- package/dist/components/toolbar/docs.props.js +0 -68
- package/dist/components/tooltip/docs.props.d.ts +0 -3
- package/dist/components/tooltip/docs.props.js +0 -77
- package/dist/utils/types.json +0 -31
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
};
|
|
13
|
-
type QDialogProps_ = typeof __propDef.props;
|
|
14
|
-
export { QDialogProps_ as QDialogProps };
|
|
15
|
-
export type QDialogEvents = typeof __propDef.events;
|
|
16
|
-
export type QDialogSlots = typeof __propDef.slots;
|
|
17
|
-
export default class QDialog extends SvelteComponentTyped<QDialogProps_, QDialogEvents, QDialogSlots> {
|
|
18
|
-
get hide(): () => void;
|
|
19
|
-
get show(): () => void;
|
|
20
|
-
get toggle(): () => void;
|
|
21
|
-
}
|
|
1
|
+
import type { QDialogProps } from "./props";
|
|
2
|
+
declare const QDialog: import("svelte").Component<QDialogProps, {
|
|
3
|
+
hide: () => void;
|
|
4
|
+
show: () => void;
|
|
5
|
+
toggle: () => void;
|
|
6
|
+
}, "value">;
|
|
7
|
+
type QDialog = ReturnType<typeof QDialog>;
|
|
8
|
+
export default QDialog;
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
&.q-drawer--#{$side} {
|
|
35
35
|
#{$side}: 0;
|
|
36
36
|
width: var(--#{$side}-drawer-width);
|
|
37
|
-
transform: translate(if($side == "left"
|
|
37
|
+
transform: translate(if(sass($side == "left"): -100%; else: 100%));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
&:not(.q-drawer--#{$side}).q-drawer--bordered {
|
|
41
|
-
@include mixins.border(
|
|
41
|
+
@include mixins.border($position: $side);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { onMount, untrack } from "svelte";
|
|
3
3
|
import { on } from "svelte/events";
|
|
4
|
+
import { innerWidth } from "svelte/reactivity/window";
|
|
4
5
|
import { navigating } from "$app/state";
|
|
5
6
|
import { useSize } from "../../composables";
|
|
6
|
-
import {
|
|
7
|
-
import { QLayoutCtxName } from "../../utils";
|
|
8
|
-
import type { QLayoutProps } from "../layout/props";
|
|
9
|
-
import type { DrawerContext } from "../layout/QLayout.svelte";
|
|
10
|
-
import type { QDrawerProps } from "./props";
|
|
7
|
+
import { leftDrawerCtx, rightDrawerCtx } from "../layout/QLayout.svelte";
|
|
11
8
|
|
|
9
|
+
// #region: --- Props
|
|
12
10
|
let {
|
|
13
11
|
value = $bindable(false),
|
|
14
12
|
side = "left",
|
|
15
13
|
width = 300,
|
|
14
|
+
breakpoint = 1023,
|
|
15
|
+
behavior = "default",
|
|
16
16
|
bordered = false,
|
|
17
17
|
overlay = false,
|
|
18
18
|
persistent = false,
|
|
@@ -21,86 +21,101 @@
|
|
|
21
21
|
children,
|
|
22
22
|
...props
|
|
23
23
|
}: QDrawerProps = $props();
|
|
24
|
+
// #endregion: --- Props
|
|
25
|
+
import type { QDrawerProps } from "./props";
|
|
24
26
|
|
|
27
|
+
// #region: --- Non-reactive variables
|
|
25
28
|
const PEEK_THRESHOLD = 30; // How far the drawer peeks out when cursor is near the edge
|
|
26
29
|
const TRANSITION = "top 0.3s, bottom 0.3s, transform 0.3s";
|
|
27
30
|
|
|
28
|
-
let
|
|
29
|
-
let
|
|
30
|
-
let
|
|
31
|
-
let
|
|
32
|
-
let
|
|
31
|
+
let clickTimer: ReturnType<typeof setTimeout> | undefined;
|
|
32
|
+
let removeWindowClickListener: (() => void) | undefined;
|
|
33
|
+
let removePointerdownListener: (() => void) | undefined;
|
|
34
|
+
let removePointermoveListener: (() => void) | undefined;
|
|
35
|
+
let removePointerupListener: (() => void) | undefined;
|
|
36
|
+
let removePointercancelListener: (() => void) | undefined;
|
|
37
|
+
// #endregion: --- Non-reactive variables
|
|
33
38
|
|
|
39
|
+
// #region: --- Reactive variables
|
|
34
40
|
let drawerEl = $state<HTMLDivElement>();
|
|
35
41
|
let swipeAreaEl = $state<HTMLDivElement>();
|
|
36
42
|
|
|
37
43
|
let isSwiping = $state(false);
|
|
38
44
|
let startX = $state(0);
|
|
39
45
|
let dragOffset = $state(0);
|
|
46
|
+
// #endregion: --- Reactive variables
|
|
40
47
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const layoutView = getContext<{ value: NonNullable<QLayoutProps["view"]> }>(
|
|
45
|
-
QLayoutCtxName.view,
|
|
48
|
+
// #region: --- Derived values
|
|
49
|
+
const drawerCtxToUse = $derived(
|
|
50
|
+
side === "left" ? leftDrawerCtx : rightDrawerCtx,
|
|
46
51
|
);
|
|
52
|
+
const drawerContext = $derived(drawerCtxToUse.get());
|
|
47
53
|
|
|
48
54
|
const canHideOnClickOutside = $derived((value && !persistent) || overlay);
|
|
49
55
|
|
|
50
56
|
const hideOnRouteChange = $derived(!persistent || overlay);
|
|
51
57
|
|
|
58
|
+
const isBelowBreakpoint = $derived.by(() => {
|
|
59
|
+
if (behavior === "mobile") {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (behavior === "desktop") {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const currentWidth = innerWidth.current;
|
|
68
|
+
return currentWidth ? currentWidth <= breakpoint : false;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const canSwipe = $derived(!noSwipe && isBelowBreakpoint);
|
|
72
|
+
|
|
52
73
|
const offsetTop = $derived.by(() => {
|
|
53
74
|
const charPos = side === "left" ? 0 : 2;
|
|
54
|
-
return
|
|
75
|
+
return drawerContext?.view.charAt(charPos) === "h";
|
|
55
76
|
});
|
|
56
77
|
const offsetBottom = $derived.by(() => {
|
|
57
78
|
const charPos = side === "left" ? 8 : 10;
|
|
58
|
-
return
|
|
79
|
+
return drawerContext?.view.charAt(charPos) === "f";
|
|
59
80
|
});
|
|
60
81
|
|
|
61
|
-
|
|
62
|
-
if (!value) {
|
|
63
|
-
value = true;
|
|
64
|
-
e?.stopPropagation();
|
|
65
|
-
}
|
|
66
|
-
};
|
|
82
|
+
const widthStyle = $derived(!drawerContext ? useSize(width).style : null);
|
|
67
83
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
};
|
|
84
|
+
const drawerWidthStyle = $derived(
|
|
85
|
+
widthStyle === null ? "" : `--${side}-drawer-width: ${widthStyle};`,
|
|
86
|
+
);
|
|
73
87
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
e?.stopPropagation();
|
|
77
|
-
};
|
|
88
|
+
const style = $derived(`${drawerWidthStyle}${props.style ?? ""}`);
|
|
89
|
+
// #endregion: --- Derived values
|
|
78
90
|
|
|
91
|
+
// #region: --- Lifecycle
|
|
79
92
|
onMount(() => {
|
|
80
93
|
setTimeout(() => {
|
|
81
94
|
drawerEl?.style.setProperty("transition", TRANSITION);
|
|
82
95
|
}, 100);
|
|
83
96
|
|
|
84
97
|
return () => {
|
|
85
|
-
|
|
86
|
-
|
|
98
|
+
clearClickListener();
|
|
99
|
+
clearPointerdownListener();
|
|
87
100
|
|
|
88
101
|
if (isSwiping) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
102
|
+
removePointermoveListener?.();
|
|
103
|
+
removePointerupListener?.();
|
|
104
|
+
removePointercancelListener?.();
|
|
92
105
|
|
|
93
106
|
resetBodyStyles();
|
|
94
107
|
}
|
|
95
108
|
|
|
96
|
-
|
|
97
|
-
width: 0,
|
|
109
|
+
drawerCtxToUse.updateEntries({
|
|
98
110
|
takesSpace: false,
|
|
111
|
+
width: 0,
|
|
99
112
|
ready: false,
|
|
100
113
|
});
|
|
101
114
|
};
|
|
102
115
|
});
|
|
116
|
+
// #endregion: --- Lifecycle
|
|
103
117
|
|
|
118
|
+
// #region: --- Effects
|
|
104
119
|
$effect(() => {
|
|
105
120
|
if (navigating.type && hideOnRouteChange) {
|
|
106
121
|
hide();
|
|
@@ -108,52 +123,69 @@
|
|
|
108
123
|
});
|
|
109
124
|
|
|
110
125
|
$effect(() => {
|
|
126
|
+
clearClickListener();
|
|
127
|
+
clearPointerdownListener();
|
|
128
|
+
|
|
111
129
|
if (value) {
|
|
112
|
-
setTimeout(() => {
|
|
113
|
-
|
|
130
|
+
clickTimer = setTimeout(() => {
|
|
131
|
+
removeWindowClickListener = on(window, "click", tryClose);
|
|
132
|
+
clickTimer = undefined;
|
|
114
133
|
}, 150);
|
|
115
134
|
|
|
116
135
|
untrack(() => {
|
|
117
|
-
if (
|
|
118
|
-
|
|
136
|
+
if (canSwipe && !persistent) {
|
|
137
|
+
addPointerdownListener(drawerEl);
|
|
119
138
|
swipeAreaEl?.style.setProperty("z-index", "-1");
|
|
120
139
|
}
|
|
121
140
|
});
|
|
122
141
|
} else {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (!noSwipe) {
|
|
126
|
-
unlistenPointerdown = on(
|
|
127
|
-
swipeAreaEl!,
|
|
128
|
-
"pointerdown",
|
|
129
|
-
handlePointerDown,
|
|
130
|
-
);
|
|
142
|
+
if (canSwipe) {
|
|
143
|
+
addPointerdownListener(swipeAreaEl);
|
|
131
144
|
swipeAreaEl?.style.setProperty("z-index", "10");
|
|
132
145
|
}
|
|
133
146
|
}
|
|
147
|
+
|
|
148
|
+
return () => {
|
|
149
|
+
clearClickListener();
|
|
150
|
+
clearPointerdownListener();
|
|
151
|
+
};
|
|
134
152
|
});
|
|
135
153
|
|
|
136
154
|
$effect(() => {
|
|
137
155
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
138
156
|
[value, overlay, width];
|
|
139
157
|
|
|
140
|
-
untrack(() =>
|
|
141
|
-
|
|
158
|
+
untrack(() => {
|
|
159
|
+
drawerCtxToUse.updateEntries({
|
|
142
160
|
takesSpace: !!value && !overlay,
|
|
143
161
|
width,
|
|
144
162
|
ready: true,
|
|
145
|
-
})
|
|
146
|
-
);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
147
165
|
});
|
|
166
|
+
// #endregion: --- Effects
|
|
148
167
|
|
|
149
|
-
|
|
168
|
+
// #region: --- Methods
|
|
169
|
+
export const show = (e?: MouseEvent) => {
|
|
170
|
+
if (!value) {
|
|
171
|
+
value = true;
|
|
172
|
+
e?.stopPropagation();
|
|
173
|
+
}
|
|
174
|
+
};
|
|
150
175
|
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
176
|
+
export const hide = () => {
|
|
177
|
+
if (value) {
|
|
178
|
+
value = false;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
154
181
|
|
|
155
|
-
const
|
|
182
|
+
export const toggle = (e?: MouseEvent) => {
|
|
183
|
+
value = !value;
|
|
184
|
+
e?.stopPropagation();
|
|
185
|
+
};
|
|
186
|
+
// #endregion: --- Methods
|
|
156
187
|
|
|
188
|
+
// #region: --- Functions
|
|
157
189
|
function tryClose(e: MouseEvent) {
|
|
158
190
|
const isTargetDrawer = e.target === drawerEl;
|
|
159
191
|
const isTargetInsideDrawer = drawerEl?.contains(e.target as Node);
|
|
@@ -164,9 +196,31 @@
|
|
|
164
196
|
}
|
|
165
197
|
}
|
|
166
198
|
|
|
199
|
+
function clearClickListener() {
|
|
200
|
+
if (clickTimer) {
|
|
201
|
+
clearTimeout(clickTimer);
|
|
202
|
+
clickTimer = undefined;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
removeWindowClickListener?.();
|
|
206
|
+
removeWindowClickListener = undefined;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function clearPointerdownListener() {
|
|
210
|
+
removePointerdownListener?.();
|
|
211
|
+
removePointerdownListener = undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function addPointerdownListener(target?: HTMLElement) {
|
|
215
|
+
if (target) {
|
|
216
|
+
removePointerdownListener = on(target, "pointerdown", handlePointerDown);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
167
220
|
function handlePointerDown(e: PointerEvent) {
|
|
168
221
|
if (
|
|
169
222
|
noSwipe ||
|
|
223
|
+
!isBelowBreakpoint ||
|
|
170
224
|
!drawerEl ||
|
|
171
225
|
!swipeAreaEl ||
|
|
172
226
|
(e.pointerType === "mouse" && e.buttons !== 1) ||
|
|
@@ -183,7 +237,7 @@
|
|
|
183
237
|
return;
|
|
184
238
|
}
|
|
185
239
|
|
|
186
|
-
let swipeAllowed
|
|
240
|
+
let swipeAllowed;
|
|
187
241
|
startX = e.clientX;
|
|
188
242
|
|
|
189
243
|
if (!value) {
|
|
@@ -220,12 +274,12 @@
|
|
|
220
274
|
|
|
221
275
|
swipeAreaEl?.style.setProperty("width", "100vw"); // Expand swipe area to full width
|
|
222
276
|
|
|
223
|
-
|
|
277
|
+
removePointermoveListener = on(
|
|
224
278
|
e.target as HTMLElement,
|
|
225
279
|
"pointermove",
|
|
226
280
|
handlePointerMove,
|
|
227
281
|
);
|
|
228
|
-
|
|
282
|
+
removePointerupListener = on(
|
|
229
283
|
e.target as HTMLElement,
|
|
230
284
|
"pointerup",
|
|
231
285
|
handlePointerUp,
|
|
@@ -233,7 +287,7 @@
|
|
|
233
287
|
passive: true,
|
|
234
288
|
},
|
|
235
289
|
);
|
|
236
|
-
|
|
290
|
+
removePointercancelListener = on(
|
|
237
291
|
e.target as HTMLElement,
|
|
238
292
|
"pointercancel",
|
|
239
293
|
handlePointerUp,
|
|
@@ -306,15 +360,16 @@
|
|
|
306
360
|
|
|
307
361
|
dragOffset = 0;
|
|
308
362
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
363
|
+
removePointercancelListener?.();
|
|
364
|
+
removePointermoveListener?.();
|
|
365
|
+
removePointerupListener?.();
|
|
312
366
|
}
|
|
313
367
|
|
|
314
368
|
function resetBodyStyles() {
|
|
315
369
|
document.body.style.removeProperty("cursor");
|
|
316
370
|
document.body.style.removeProperty("user-select");
|
|
317
371
|
}
|
|
372
|
+
// #endregion: --- Functions
|
|
318
373
|
</script>
|
|
319
374
|
|
|
320
375
|
<div
|
|
@@ -336,7 +391,7 @@
|
|
|
336
391
|
{@render children?.()}
|
|
337
392
|
</div>
|
|
338
393
|
|
|
339
|
-
{#if
|
|
394
|
+
{#if canSwipe}
|
|
340
395
|
<div
|
|
341
396
|
bind:this={swipeAreaEl}
|
|
342
397
|
class="q-drawer__swipearea q-drawer__swipearea--{side}"
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
};
|
|
13
|
-
type QDrawerProps_ = typeof __propDef.props;
|
|
14
|
-
export { QDrawerProps_ as QDrawerProps };
|
|
15
|
-
export type QDrawerEvents = typeof __propDef.events;
|
|
16
|
-
export type QDrawerSlots = typeof __propDef.slots;
|
|
17
|
-
export default class QDrawer extends SvelteComponentTyped<QDrawerProps_, QDrawerEvents, QDrawerSlots> {
|
|
18
|
-
get show(): (e?: MouseEvent) => void;
|
|
19
|
-
get hide(): () => void;
|
|
20
|
-
get toggle(): (e?: MouseEvent) => void;
|
|
21
|
-
}
|
|
1
|
+
import type { QDrawerProps } from "./props";
|
|
2
|
+
declare const QDrawer: import("svelte").Component<QDrawerProps, {
|
|
3
|
+
show: (e?: MouseEvent) => void;
|
|
4
|
+
hide: () => void;
|
|
5
|
+
toggle: (e?: MouseEvent) => void;
|
|
6
|
+
}, "value">;
|
|
7
|
+
type QDrawer = ReturnType<typeof QDrawer>;
|
|
8
|
+
export default QDrawer;
|
|
@@ -19,7 +19,7 @@ export interface QDrawerProps extends NativeProps, HTMLAttributes<HTMLDivElement
|
|
|
19
19
|
*/
|
|
20
20
|
width?: number;
|
|
21
21
|
/**
|
|
22
|
-
* The
|
|
22
|
+
* The viewport width below which swipe gestures are enabled.
|
|
23
23
|
* @default 1023
|
|
24
24
|
*/
|
|
25
25
|
breakpoint?: number;
|
|
@@ -29,7 +29,7 @@ export interface QDrawerProps extends NativeProps, HTMLAttributes<HTMLDivElement
|
|
|
29
29
|
*/
|
|
30
30
|
showIfAbove?: boolean;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Controls swipe behavior: "default" follows the breakpoint, "mobile" enables swiping and "desktop" disables it.
|
|
33
33
|
* @default "default"
|
|
34
34
|
*/
|
|
35
35
|
behavior?: QDrawerBehaviorOptions;
|
|
@@ -44,7 +44,7 @@ export interface QDrawerProps extends NativeProps, HTMLAttributes<HTMLDivElement
|
|
|
44
44
|
*/
|
|
45
45
|
elevated?: boolean;
|
|
46
46
|
/**
|
|
47
|
-
* Determines whether the
|
|
47
|
+
* Determines whether the drawer should behave like an overlay (opening above the content) or not (pushing the content while opening).
|
|
48
48
|
* @default false
|
|
49
49
|
*/
|
|
50
50
|
overlay?: boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@use "$css/mixins";
|
|
2
|
+
@use "$css/variables";
|
|
3
|
+
|
|
4
|
+
.q-expansion-item {
|
|
5
|
+
width: 100%;
|
|
6
|
+
padding: 0;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
|
|
9
|
+
border-radius: 0;
|
|
10
|
+
|
|
11
|
+
&:first-child {
|
|
12
|
+
border-top-left-radius: inherit;
|
|
13
|
+
border-top-right-radius: inherit;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&:last-child {
|
|
17
|
+
border-bottom-left-radius: inherit;
|
|
18
|
+
border-bottom-right-radius: inherit;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&[aria-disabled] :is(.q-item__section, .q-item__section *) {
|
|
22
|
+
color: unset;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
& summary::marker,
|
|
26
|
+
& summary::-webkit-details-marker {
|
|
27
|
+
display: none;
|
|
28
|
+
content: "";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&::details-content {
|
|
32
|
+
transition: content-visibility var(--duration) allow-discrete;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&__toggle-icon {
|
|
36
|
+
margin: 0;
|
|
37
|
+
z-index: 1;
|
|
38
|
+
|
|
39
|
+
&:is(.q-btn) {
|
|
40
|
+
margin-right: -0.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:not(.q-btn),
|
|
44
|
+
&.q-btn .q-icon {
|
|
45
|
+
transition: rotate var(--duration);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&--rotate:not(.q-btn),
|
|
49
|
+
&--rotate.q-btn .q-icon {
|
|
50
|
+
rotate: 180deg;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&__content {
|
|
55
|
+
@include mixins.padding("x-md", "y-sm");
|
|
56
|
+
width: 100%;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
}
|
|
59
|
+
}
|