@quaffui/quaff 1.0.0-beta1 → 1.0.0-beta13
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/classes/Quaff.svelte.d.ts +3 -0
- package/dist/classes/Quaff.svelte.js +21 -17
- 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,7 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getContext, hasContext } from "svelte";
|
|
3
2
|
import { QIcon } from "../..";
|
|
4
|
-
import { QContext } from "../../classes/QContext.svelte";
|
|
5
3
|
import { ripple } from "../../helpers";
|
|
6
4
|
import {
|
|
7
5
|
getClosestFocusableBlock,
|
|
@@ -11,36 +9,34 @@
|
|
|
11
9
|
isArrowKey,
|
|
12
10
|
isRouteActive,
|
|
13
11
|
isTabKey,
|
|
14
|
-
QTabsCtxName,
|
|
15
12
|
type Direction,
|
|
16
13
|
type QEvent,
|
|
17
14
|
} from "../../utils";
|
|
15
|
+
import { tabsCtx } from "./QTabs.svelte";
|
|
16
|
+
import type { QTabProps } from "./props";
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
import type { QTabProps, QTabsVariants } from "./props";
|
|
21
|
-
|
|
18
|
+
type QTabEl = HTMLAnchorElement | HTMLButtonElement;
|
|
22
19
|
type QTabEvent<T> = QEvent<T, QTabEl>;
|
|
23
20
|
|
|
21
|
+
// #region: --- Props
|
|
24
22
|
let { name, to, icon, children, ...props }: QTabProps = $props();
|
|
23
|
+
// #endregion: --- Props
|
|
25
24
|
|
|
25
|
+
// #region: --- Non-reactive variables
|
|
26
26
|
let qTab: QTabEl;
|
|
27
|
+
// #endregion: --- Non-reactive variables
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
// #region: --- Reactive variables
|
|
30
|
+
const ctx = tabsCtx.assertGet("QTab should be use inside QTabs.");
|
|
31
|
+
// #endregion: --- Reactive variables
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const qTabsRequestCtx = QContext.get<string | null>(QTabsCtxName.request)!;
|
|
33
|
+
// #region: --- Derived values
|
|
34
|
+
const tag = $derived(to ? "a" : "button");
|
|
35
35
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
)!;
|
|
39
|
-
const variant = getContext<QTabsVariants>(QTabsCtxName.variant);
|
|
40
|
-
const isActive = $derived(
|
|
41
|
-
to ? isRouteActive(to) : name === qTabsValueCtx.value,
|
|
42
|
-
);
|
|
36
|
+
const isActive = $derived(to ? isRouteActive(to) : name === ctx.value);
|
|
37
|
+
// #endregion: --- Derived values
|
|
43
38
|
|
|
39
|
+
// #region: --- Functions
|
|
44
40
|
function onclick(e: QTabEvent<MouseEvent>) {
|
|
45
41
|
props.onclick?.(e);
|
|
46
42
|
|
|
@@ -48,7 +44,7 @@
|
|
|
48
44
|
return;
|
|
49
45
|
}
|
|
50
46
|
|
|
51
|
-
|
|
47
|
+
ctx.request = name;
|
|
52
48
|
}
|
|
53
49
|
|
|
54
50
|
function onkeydown(e: QTabEvent<KeyboardEvent>) {
|
|
@@ -81,6 +77,7 @@
|
|
|
81
77
|
targetBlock?.focus();
|
|
82
78
|
}
|
|
83
79
|
}
|
|
80
|
+
// #endregion: --- Functions
|
|
84
81
|
</script>
|
|
85
82
|
|
|
86
83
|
<svelte:element
|
|
@@ -108,12 +105,12 @@
|
|
|
108
105
|
<span>{@render children?.()}</span>
|
|
109
106
|
{/if}
|
|
110
107
|
|
|
111
|
-
{#if variant === "primary"}
|
|
108
|
+
{#if ctx.variant === "primary"}
|
|
112
109
|
<div class="q-tab__indicator"></div>
|
|
113
110
|
{/if}
|
|
114
111
|
</div>
|
|
115
112
|
|
|
116
|
-
{#if variant !== "primary"}
|
|
113
|
+
{#if ctx.variant !== "primary"}
|
|
117
114
|
<div class="q-tab__indicator"></div>
|
|
118
115
|
{/if}
|
|
119
116
|
</svelte:element>
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
type QTabProps_ = typeof __propDef.props;
|
|
10
|
-
export { QTabProps_ as QTabProps };
|
|
11
|
-
export type QTabEvents = typeof __propDef.events;
|
|
12
|
-
export type QTabSlots = typeof __propDef.slots;
|
|
13
|
-
export default class QTab extends SvelteComponentTyped<QTabProps_, QTabEvents, QTabSlots> {
|
|
14
|
-
}
|
|
1
|
+
import type { QTabProps } from "./props";
|
|
2
|
+
declare const QTab: import("svelte").Component<QTabProps, {}, "">;
|
|
3
|
+
type QTab = ReturnType<typeof QTab>;
|
|
4
|
+
export default QTab;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { QContext } from "../../utils";
|
|
3
|
+
import type { QTabsProps } from "./props";
|
|
4
|
+
|
|
5
|
+
interface QTabsContext {
|
|
6
|
+
readonly variant: QTabsProps["variant"];
|
|
7
|
+
value: QTabsProps["value"];
|
|
8
|
+
request: string | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const tabsCtx = QContext<QTabsContext>("QTabs");
|
|
7
12
|
</script>
|
|
8
13
|
|
|
9
14
|
<script lang="ts">
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { QTabsCtxName, shouldReduceMotion } from "../../utils";
|
|
13
|
-
import type { QTabsProps } from "./props";
|
|
15
|
+
import { tick, untrack } from "svelte";
|
|
16
|
+
import { shouldReduceMotion } from "../../utils";
|
|
14
17
|
|
|
18
|
+
// #region: --- Props
|
|
15
19
|
let {
|
|
16
20
|
value = $bindable(),
|
|
17
21
|
variant = "primary",
|
|
@@ -19,28 +23,43 @@
|
|
|
19
23
|
children,
|
|
20
24
|
...props
|
|
21
25
|
}: QTabsProps = $props();
|
|
26
|
+
// #endregion: --- Props
|
|
22
27
|
|
|
28
|
+
// #region: --- Non-reactive variables
|
|
23
29
|
let qTabs: HTMLElement;
|
|
24
30
|
let tabList: HTMLElement[];
|
|
31
|
+
// #endregion: --- Non-reactive variables
|
|
32
|
+
|
|
33
|
+
// #region: --- Reactive variables
|
|
34
|
+
let request = $state<string | null>(null);
|
|
35
|
+
// #endregion: --- Reactive variables
|
|
36
|
+
|
|
37
|
+
// #region: --- Context
|
|
38
|
+
tabsCtx.set({
|
|
39
|
+
get value() {
|
|
40
|
+
return value;
|
|
41
|
+
},
|
|
42
|
+
set value(newValue) {
|
|
43
|
+
value = newValue;
|
|
44
|
+
},
|
|
45
|
+
get variant() {
|
|
46
|
+
return variant;
|
|
47
|
+
},
|
|
48
|
+
get request() {
|
|
49
|
+
return request;
|
|
50
|
+
},
|
|
51
|
+
set request(newValue) {
|
|
52
|
+
request = newValue;
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
// #endregion: --- Context
|
|
25
56
|
|
|
26
|
-
|
|
27
|
-
QTabsCtxName.value,
|
|
28
|
-
value,
|
|
29
|
-
);
|
|
30
|
-
const requestContext = new QContext<string | null>(
|
|
31
|
-
QTabsCtxName.request,
|
|
32
|
-
null,
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
// Set the variant context
|
|
36
|
-
setContext(QTabsCtxName.variant, variant);
|
|
37
|
-
|
|
57
|
+
// #region: --- Effects
|
|
38
58
|
$effect(() => {
|
|
39
59
|
tabList = Array.from(qTabs.querySelectorAll(".q-tab"));
|
|
40
60
|
});
|
|
41
61
|
|
|
42
|
-
|
|
43
|
-
$effect(() => {
|
|
62
|
+
$effect.pre(() => {
|
|
44
63
|
if (!value) {
|
|
45
64
|
return;
|
|
46
65
|
}
|
|
@@ -48,35 +67,40 @@
|
|
|
48
67
|
untrack(() => {
|
|
49
68
|
const newTab = getResquetingTab(value!);
|
|
50
69
|
animateIndicator(newTab);
|
|
51
|
-
|
|
52
|
-
valueContext.update(value);
|
|
53
70
|
});
|
|
54
71
|
});
|
|
55
72
|
|
|
56
73
|
// Try to update "value" when context changes from a QTab
|
|
57
74
|
$effect(() => {
|
|
58
|
-
const request = requestContext.value;
|
|
59
|
-
|
|
60
75
|
if (!request) {
|
|
61
76
|
return;
|
|
62
77
|
}
|
|
63
78
|
|
|
79
|
+
updateValue(request);
|
|
80
|
+
});
|
|
81
|
+
// #endregion: --- Effects
|
|
82
|
+
|
|
83
|
+
// #region: --- Functions
|
|
84
|
+
async function updateValue(req: string) {
|
|
85
|
+
await tick();
|
|
86
|
+
|
|
64
87
|
const defaultPrevented = !dispatchEvent(
|
|
65
88
|
new Event("change", { bubbles: true, cancelable: true }),
|
|
66
89
|
);
|
|
67
|
-
const requester = getResquetingTab(
|
|
90
|
+
const requester = getResquetingTab(req);
|
|
91
|
+
|
|
68
92
|
if (defaultPrevented || !requester) {
|
|
69
93
|
return;
|
|
70
94
|
}
|
|
71
95
|
|
|
72
96
|
untrack(() => {
|
|
73
|
-
value =
|
|
97
|
+
value = req;
|
|
74
98
|
});
|
|
75
|
-
}
|
|
99
|
+
}
|
|
76
100
|
|
|
77
101
|
function getResquetingTab(requestingTabName: string) {
|
|
78
102
|
return (
|
|
79
|
-
tabList
|
|
103
|
+
tabList?.find(
|
|
80
104
|
(tab) => tab.getAttribute("aria-label") === requestingTabName,
|
|
81
105
|
) ?? null
|
|
82
106
|
);
|
|
@@ -84,7 +108,8 @@
|
|
|
84
108
|
|
|
85
109
|
function getActiveTab() {
|
|
86
110
|
return (
|
|
87
|
-
tabList
|
|
111
|
+
tabList?.find((tab) => tab.getAttribute("aria-current") === "true") ??
|
|
112
|
+
null
|
|
88
113
|
);
|
|
89
114
|
}
|
|
90
115
|
|
|
@@ -141,6 +166,7 @@
|
|
|
141
166
|
!isNaN(scale)
|
|
142
167
|
) {
|
|
143
168
|
const translateAnimation = (fromPos - toPos).toFixed(4);
|
|
169
|
+
|
|
144
170
|
const scaleAnimation = scale.toFixed(4);
|
|
145
171
|
keyframe.transform = `translate${axis}(${translateAnimation}px) scale${axis}(${scaleAnimation})`;
|
|
146
172
|
} else {
|
|
@@ -151,6 +177,7 @@
|
|
|
151
177
|
// that can hide the animation.
|
|
152
178
|
return [keyframe, { transform: "none" }];
|
|
153
179
|
}
|
|
180
|
+
// #endregion: --- Functions
|
|
154
181
|
</script>
|
|
155
182
|
|
|
156
183
|
<nav
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
declare const __propDef: {
|
|
8
|
-
props: Record<string, never>;
|
|
9
|
-
events: {
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots: {};
|
|
13
|
-
};
|
|
14
|
-
type QTabsProps_ = typeof __propDef.props;
|
|
15
|
-
export { QTabsProps_ as QTabsProps };
|
|
16
|
-
export type QTabsEvents = typeof __propDef.events;
|
|
17
|
-
export type QTabsSlots = typeof __propDef.slots;
|
|
18
|
-
export default class QTabs extends SvelteComponentTyped<QTabsProps_, QTabsEvents, QTabsSlots> {
|
|
1
|
+
import type { QTabsProps } from "./props";
|
|
2
|
+
interface QTabsContext {
|
|
3
|
+
readonly variant: QTabsProps["variant"];
|
|
4
|
+
value: QTabsProps["value"];
|
|
5
|
+
request: string | null;
|
|
19
6
|
}
|
|
7
|
+
export declare const tabsCtx: {
|
|
8
|
+
readonly symbol: symbol;
|
|
9
|
+
get(): QTabsContext | undefined;
|
|
10
|
+
assertGet(errorMsg?: string): QTabsContext;
|
|
11
|
+
set(context: QTabsContext): void;
|
|
12
|
+
reset(): void;
|
|
13
|
+
exists(): boolean;
|
|
14
|
+
updateEntry(key: keyof QTabsContext, value: string | null | undefined): void;
|
|
15
|
+
updateEntries(updates: Partial<QTabsContext>): void;
|
|
16
|
+
};
|
|
17
|
+
declare const QTabs: import("svelte").Component<QTabsProps, {}, "value">;
|
|
18
|
+
type QTabs = ReturnType<typeof QTabs>;
|
|
19
|
+
export default QTabs;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { QToolbarProps } from "./props";
|
|
3
3
|
|
|
4
|
+
// #region: --- Props
|
|
4
5
|
let {
|
|
5
6
|
inset = false,
|
|
6
7
|
border = false,
|
|
@@ -9,6 +10,7 @@
|
|
|
9
10
|
children,
|
|
10
11
|
...props
|
|
11
12
|
}: QToolbarProps = $props();
|
|
13
|
+
// #endregion: --- Props
|
|
12
14
|
</script>
|
|
13
15
|
|
|
14
16
|
<nav
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
type QToolbarProps_ = typeof __propDef.props;
|
|
10
|
-
export { QToolbarProps_ as QToolbarProps };
|
|
11
|
-
export type QToolbarEvents = typeof __propDef.events;
|
|
12
|
-
export type QToolbarSlots = typeof __propDef.slots;
|
|
13
|
-
export default class QToolbar extends SvelteComponentTyped<QToolbarProps_, QToolbarEvents, QToolbarSlots> {
|
|
14
|
-
}
|
|
1
|
+
import type { QToolbarProps } from "./props";
|
|
2
|
+
declare const QToolbar: import("svelte").Component<QToolbarProps, {}, "">;
|
|
3
|
+
type QToolbar = ReturnType<typeof QToolbar>;
|
|
4
|
+
export default QToolbar;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
type QToolbarTitleProps_ = typeof __propDef.props;
|
|
10
|
-
export { QToolbarTitleProps_ as QToolbarTitleProps };
|
|
11
|
-
export type QToolbarTitleEvents = typeof __propDef.events;
|
|
12
|
-
export type QToolbarTitleSlots = typeof __propDef.slots;
|
|
13
|
-
export default class QToolbarTitle extends SvelteComponentTyped<QToolbarTitleProps_, QToolbarTitleEvents, QToolbarTitleSlots> {
|
|
14
|
-
}
|
|
1
|
+
import type { QToolbarTitleProps } from "./props";
|
|
2
|
+
declare const QToolbarTitle: import("svelte").Component<QToolbarTitleProps, {}, "">;
|
|
3
|
+
type QToolbarTitle = ReturnType<typeof QToolbarTitle>;
|
|
4
|
+
export default QToolbarTitle;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts" generics="T extends HTMLElement | string">
|
|
2
2
|
import { mount, onMount, unmount, untrack } from "svelte";
|
|
3
|
-
import {
|
|
3
|
+
import { on } from "svelte/events";
|
|
4
4
|
import QTooltipBase from "./QTooltipBase.svelte";
|
|
5
5
|
import type { QTooltipProps } from "./props";
|
|
6
6
|
|
|
7
|
+
// #region: --- Props
|
|
7
8
|
let {
|
|
8
9
|
target,
|
|
9
10
|
value = $bindable(false),
|
|
@@ -14,7 +15,21 @@
|
|
|
14
15
|
children,
|
|
15
16
|
...props
|
|
16
17
|
}: QTooltipProps<T> = $props();
|
|
18
|
+
// #endregion: --- Props
|
|
17
19
|
|
|
20
|
+
// #region: --- Non-reactive variables
|
|
21
|
+
let mountedTooltip: ReturnType<typeof mountTooltip> | null = null;
|
|
22
|
+
|
|
23
|
+
let removeTargetMouseEnterListener: (() => void) | undefined;
|
|
24
|
+
let removeTargetMouseLeaveListener: (() => void) | undefined;
|
|
25
|
+
let removeTooltipMouseEnterListener: (() => void) | undefined;
|
|
26
|
+
let removeTooltipMouseLeaveListener: (() => void) | undefined;
|
|
27
|
+
let removeWindowWheelListener: (() => void) | undefined;
|
|
28
|
+
|
|
29
|
+
const id = $props.id();
|
|
30
|
+
// #endregion: --- Non-reactive variables
|
|
31
|
+
|
|
32
|
+
// #region: --- Reactive variables
|
|
18
33
|
let tooltipHelperEl = $state<HTMLDivElement>();
|
|
19
34
|
let tooltipEl = $state<HTMLDivElement>();
|
|
20
35
|
|
|
@@ -22,25 +37,15 @@
|
|
|
22
37
|
|
|
23
38
|
let timerShow = $state<ReturnType<typeof setTimeout> | null>(null);
|
|
24
39
|
let timerHide = $state<ReturnType<typeof setTimeout> | null>(null);
|
|
40
|
+
// #endregion: --- Reactive variables
|
|
25
41
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
let targetMouseEnterListener: ReturnType<typeof addEventListener> | null =
|
|
29
|
-
null;
|
|
30
|
-
let targetMouseLeaveListener: ReturnType<typeof addEventListener> | null =
|
|
31
|
-
null;
|
|
32
|
-
let tooltipMouseEnterListener: ReturnType<typeof addEventListener> | null =
|
|
33
|
-
null;
|
|
34
|
-
let tooltipMouseLeaveListener: ReturnType<typeof addEventListener> | null =
|
|
35
|
-
null;
|
|
36
|
-
let windowWheelListener: ReturnType<typeof addEventListener> | null = null;
|
|
37
|
-
|
|
38
|
-
const id = Date.now();
|
|
39
|
-
|
|
42
|
+
// #region: --- Effects
|
|
40
43
|
$effect(() => {
|
|
41
44
|
value ? untrack(show) : untrack(hide);
|
|
42
45
|
});
|
|
46
|
+
// #endregion: --- Effects
|
|
43
47
|
|
|
48
|
+
// #region: --- Lifecycle
|
|
44
49
|
onMount(() => {
|
|
45
50
|
if (target) {
|
|
46
51
|
realTarget =
|
|
@@ -60,17 +65,19 @@
|
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
if (realTarget) {
|
|
69
|
+
removeTargetMouseEnterListener = on(realTarget, "mouseenter", show);
|
|
70
|
+
removeTargetMouseLeaveListener = on(realTarget, "mouseleave", hide);
|
|
71
|
+
}
|
|
65
72
|
|
|
66
73
|
return () => {
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
removeTargetMouseEnterListener?.();
|
|
75
|
+
removeTargetMouseLeaveListener?.();
|
|
69
76
|
|
|
70
|
-
|
|
71
|
-
|
|
77
|
+
removeTooltipMouseEnterListener?.();
|
|
78
|
+
removeTooltipMouseLeaveListener?.();
|
|
72
79
|
|
|
73
|
-
|
|
80
|
+
removeWindowWheelListener?.();
|
|
74
81
|
|
|
75
82
|
if (mountedTooltip) {
|
|
76
83
|
unmount(mountedTooltip);
|
|
@@ -85,7 +92,9 @@
|
|
|
85
92
|
}
|
|
86
93
|
};
|
|
87
94
|
});
|
|
95
|
+
// #endregion: --- Lifecycle
|
|
88
96
|
|
|
97
|
+
// #region: --- Methods
|
|
89
98
|
export function show() {
|
|
90
99
|
if (timerHide) {
|
|
91
100
|
clearTimeout(timerHide);
|
|
@@ -107,20 +116,18 @@
|
|
|
107
116
|
mountedTooltip = mountTooltip();
|
|
108
117
|
|
|
109
118
|
tooltipEl =
|
|
110
|
-
(document.getElementById(`
|
|
119
|
+
(document.getElementById(`q-tooltip-${id}`) as HTMLDivElement) ||
|
|
111
120
|
undefined;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
tooltipEl,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
windowWheelListener = addEventListener(window, "wheel", hide);
|
|
121
|
+
if (tooltipEl) {
|
|
122
|
+
removeTooltipMouseEnterListener = on(
|
|
123
|
+
tooltipEl,
|
|
124
|
+
"mouseenter",
|
|
125
|
+
abortHide,
|
|
126
|
+
);
|
|
127
|
+
removeTooltipMouseLeaveListener = on(tooltipEl, "mouseleave", hide);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
removeWindowWheelListener = on(window, "wheel", hide);
|
|
124
131
|
|
|
125
132
|
if (!value) {
|
|
126
133
|
value = true;
|
|
@@ -148,7 +155,7 @@
|
|
|
148
155
|
}
|
|
149
156
|
|
|
150
157
|
timerHide = setTimeout(() => {
|
|
151
|
-
|
|
158
|
+
removeTooltipMouseEnterListener?.();
|
|
152
159
|
|
|
153
160
|
if (!mountedTooltip) {
|
|
154
161
|
return;
|
|
@@ -156,7 +163,7 @@
|
|
|
156
163
|
|
|
157
164
|
unmount(mountedTooltip);
|
|
158
165
|
|
|
159
|
-
|
|
166
|
+
removeWindowWheelListener?.();
|
|
160
167
|
|
|
161
168
|
mountedTooltip = null;
|
|
162
169
|
timerHide = null;
|
|
@@ -170,7 +177,9 @@
|
|
|
170
177
|
export function toggle() {
|
|
171
178
|
value = !value;
|
|
172
179
|
}
|
|
180
|
+
// #endregion: --- Methods
|
|
173
181
|
|
|
182
|
+
// #region: --- Functions
|
|
174
183
|
function abortHide() {
|
|
175
184
|
if (timerHide) {
|
|
176
185
|
clearTimeout(timerHide);
|
|
@@ -191,11 +200,12 @@
|
|
|
191
200
|
position,
|
|
192
201
|
offset,
|
|
193
202
|
children,
|
|
194
|
-
id: `
|
|
203
|
+
id: `q-tooltip-${id}`,
|
|
195
204
|
...props,
|
|
196
205
|
},
|
|
197
206
|
});
|
|
198
207
|
}
|
|
208
|
+
// #endregion: --- Functions
|
|
199
209
|
</script>
|
|
200
210
|
|
|
201
211
|
{#if !target}
|
|
@@ -1,21 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare
|
|
3
|
-
props
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { QTooltipProps } from "./props";
|
|
2
|
+
declare function $$render<T extends HTMLElement | string>(): {
|
|
3
|
+
props: QTooltipProps<T>;
|
|
4
|
+
exports: {
|
|
5
|
+
show: () => void;
|
|
6
|
+
hide: () => void;
|
|
7
|
+
toggle: () => void;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
bindings: "value";
|
|
10
|
+
slots: {};
|
|
11
|
+
events: {};
|
|
12
|
+
};
|
|
13
|
+
declare class __sveltets_Render<T extends HTMLElement | string> {
|
|
14
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
15
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
16
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
17
|
+
bindings(): "value";
|
|
18
|
+
exports(): {
|
|
19
|
+
show: () => void;
|
|
20
|
+
hide: () => void;
|
|
21
|
+
toggle: () => void;
|
|
10
22
|
};
|
|
11
|
-
slots(): {};
|
|
12
23
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
get toggle(): () => void;
|
|
24
|
+
interface $$IsomorphicComponent {
|
|
25
|
+
new <T extends HTMLElement | string>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
26
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
27
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
28
|
+
<T extends HTMLElement | string>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
29
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
20
30
|
}
|
|
21
|
-
|
|
31
|
+
declare const QTooltip: $$IsomorphicComponent;
|
|
32
|
+
type QTooltip<T extends HTMLElement | string> = InstanceType<typeof QTooltip<T>>;
|
|
33
|
+
export default QTooltip;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { scale } from "svelte/transition";
|
|
4
4
|
import type { QTooltipProps } from "./props";
|
|
5
5
|
|
|
6
|
+
// #region: --- Props
|
|
6
7
|
let {
|
|
7
8
|
// At this point, target should be guaranteed to be a DOM element
|
|
8
9
|
target,
|
|
@@ -11,17 +12,13 @@
|
|
|
11
12
|
children,
|
|
12
13
|
...props
|
|
13
14
|
}: QTooltipProps<HTMLElement> = $props();
|
|
15
|
+
// #endregion: --- Props
|
|
14
16
|
|
|
17
|
+
// #region: --- Reactive variables
|
|
15
18
|
let tooltipEl = $state<HTMLDivElement>();
|
|
19
|
+
// #endregion: --- Reactive variables
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
setTimeout(() => {
|
|
19
|
-
if (tooltipEl) {
|
|
20
|
-
tooltipEl.style.opacity = "1";
|
|
21
|
-
}
|
|
22
|
-
}, 50);
|
|
23
|
-
});
|
|
24
|
-
|
|
21
|
+
// #region: --- Derived values
|
|
25
22
|
const tooltipPosition: Record<"top" | "left", number> | undefined =
|
|
26
23
|
$derived.by(() => {
|
|
27
24
|
if (!target || !tooltipEl) {
|
|
@@ -40,7 +37,19 @@
|
|
|
40
37
|
left: `${tooltipPosition.left}px`,
|
|
41
38
|
},
|
|
42
39
|
);
|
|
40
|
+
// #endregion: --- Derived values
|
|
41
|
+
|
|
42
|
+
// #region: --- Lifecycle
|
|
43
|
+
onMount(() => {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
if (tooltipEl) {
|
|
46
|
+
tooltipEl.style.opacity = "1";
|
|
47
|
+
}
|
|
48
|
+
}, 50);
|
|
49
|
+
});
|
|
50
|
+
// #endregion: --- Lifecycle
|
|
43
51
|
|
|
52
|
+
// #region: --- Functions
|
|
44
53
|
function calculatePosition(
|
|
45
54
|
anchor: HTMLElement,
|
|
46
55
|
tooltip: HTMLElement,
|
|
@@ -71,6 +80,7 @@
|
|
|
71
80
|
tooltip[tooltipDimension] / 2 +
|
|
72
81
|
(offsetToUse || 0);
|
|
73
82
|
}
|
|
83
|
+
// #endregion: --- Functions
|
|
74
84
|
</script>
|
|
75
85
|
|
|
76
86
|
<div
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
export type QTooltipBaseProps = typeof __propDef.props;
|
|
10
|
-
export type QTooltipBaseEvents = typeof __propDef.events;
|
|
11
|
-
export type QTooltipBaseSlots = typeof __propDef.slots;
|
|
12
|
-
export default class QTooltipBase extends SvelteComponentTyped<QTooltipBaseProps, QTooltipBaseEvents, QTooltipBaseSlots> {
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
1
|
+
import type { QTooltipProps } from "./props";
|
|
2
|
+
declare const QTooltipBase: import("svelte").Component<QTooltipProps<HTMLElement>, {}, "">;
|
|
3
|
+
type QTooltipBase = ReturnType<typeof QTooltipBase>;
|
|
4
|
+
export default QTooltipBase;
|