@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
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
box-shadow: 0 $elevate * $coeff $elevate 0 with-alpha(var(--shadow), calc(24% + (8% * $strength)));
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
@mixin border($color: var(--outline), $position: variables.$border-positions) {
|
|
14
|
+
@mixin border($color: var(--outline-variant), $position: variables.$border-positions) {
|
|
15
15
|
@if list.index($list: $position, $value: top) {
|
|
16
16
|
border-top: 0.0625rem solid $color;
|
|
17
17
|
}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
@mixin border-substitute($variant: "outlined", $wrapper-height, $dense: false) {
|
|
25
|
-
$border-radius: if($variant == "outlined"
|
|
25
|
+
$border-radius: if(sass($variant == "outlined"): 0.25rem; else: math.div($wrapper-height, 2));
|
|
26
26
|
|
|
27
27
|
&::before,
|
|
28
28
|
&::after {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
border-top-color: var(--decorator-color);
|
|
37
37
|
border-radius: $border-radius;
|
|
38
38
|
box-sizing: border-box;
|
|
39
|
+
pointer-events: none;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
&::before {
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
border-top-right-radius: 0px;
|
|
44
45
|
border-bottom-right-radius: 0px;
|
|
45
46
|
$clip-height: 0.25rem;
|
|
46
|
-
$clip-width: if($variant == "outlined"
|
|
47
|
+
$clip-width: if(sass($variant == "outlined"): 0.9375rem; else: 0.25rem);
|
|
47
48
|
|
|
48
49
|
@if $dense == true and $variant == "outlined" {
|
|
49
50
|
$clip-width: math.div($clip-width, 1.4);
|
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
$wrapper-height-dense: 2.5rem;
|
|
8
8
|
|
|
9
9
|
display: flex;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
max-width: 100%;
|
|
10
12
|
|
|
11
13
|
&__inner {
|
|
12
14
|
display: flex;
|
|
13
15
|
flex-direction: column;
|
|
14
16
|
flex-grow: 1;
|
|
17
|
+
min-width: 0;
|
|
18
|
+
max-width: 100%;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
&__wrapper {
|
|
@@ -19,6 +23,8 @@
|
|
|
19
23
|
display: flex;
|
|
20
24
|
position: relative;
|
|
21
25
|
height: $wrapper-height;
|
|
26
|
+
min-width: 0;
|
|
27
|
+
max-width: 100%;
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
&--dense &__wrapper {
|
|
@@ -268,11 +274,6 @@
|
|
|
268
274
|
padding-top: 0.9375rem;
|
|
269
275
|
}
|
|
270
276
|
|
|
271
|
-
&--focus#{&}--default &__input,
|
|
272
|
-
&--focus#{&}--filled &__input {
|
|
273
|
-
padding-top: 1rem;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
277
|
&--rounded &__input {
|
|
277
278
|
padding: 0 1.4375rem;
|
|
278
279
|
}
|
|
@@ -341,7 +342,7 @@
|
|
|
341
342
|
padding-left: 0.75rem;
|
|
342
343
|
}
|
|
343
344
|
|
|
344
|
-
&--
|
|
345
|
+
&--disabled {
|
|
345
346
|
opacity: 0.5;
|
|
346
347
|
&,
|
|
347
348
|
* {
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
@use "$css/variables";
|
|
3
3
|
|
|
4
4
|
.q-page {
|
|
5
|
+
width: 100%;
|
|
5
6
|
max-width: 75rem;
|
|
6
|
-
margin:
|
|
7
|
-
padding:
|
|
7
|
+
margin-inline: auto;
|
|
8
|
+
padding-block: variables.$space-lg;
|
|
9
|
+
padding-inline: variables.$space-md;
|
|
8
10
|
line-height: 1.5;
|
|
9
11
|
|
|
10
|
-
@media only screen and (
|
|
11
|
-
padding:
|
|
12
|
+
@media only screen and (min-width: #{map.get(variables.$breakpoints, sm)}) {
|
|
13
|
+
padding-inline: variables.$space-lg;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
@media only screen and (min-width: #{map.get(variables.$breakpoints,
|
|
15
|
-
padding:
|
|
16
|
+
@media only screen and (min-width: #{map.get(variables.$breakpoints, lg)}) {
|
|
17
|
+
padding-block: 2rem;
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { on } from "svelte/events";
|
|
1
2
|
export function clickOutside(node, onEventFunction) {
|
|
2
3
|
const handleClick = (event) => {
|
|
3
4
|
const path = event.composedPath();
|
|
@@ -5,10 +6,10 @@ export function clickOutside(node, onEventFunction) {
|
|
|
5
6
|
onEventFunction();
|
|
6
7
|
}
|
|
7
8
|
};
|
|
8
|
-
document
|
|
9
|
+
const removeClickListener = on(document, "click", handleClick);
|
|
9
10
|
return {
|
|
10
11
|
destroy() {
|
|
11
|
-
|
|
12
|
+
removeClickListener();
|
|
12
13
|
},
|
|
13
14
|
};
|
|
14
15
|
}
|
|
@@ -26,10 +27,10 @@ export function clickOutsideDialog(node, onEventFunction) {
|
|
|
26
27
|
onEventFunction();
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
|
-
document
|
|
30
|
+
const removeClickListener = on(document, "click", handleClick);
|
|
30
31
|
return {
|
|
31
32
|
destroy() {
|
|
32
|
-
|
|
33
|
+
removeClickListener();
|
|
33
34
|
},
|
|
34
35
|
};
|
|
35
36
|
}
|
package/dist/helpers/ripple.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { on } from "svelte/events";
|
|
1
2
|
const triggerEvents = ["pointerdown", "touchstart", "keydown"];
|
|
2
3
|
const cancelEvents = ["mouseleave", "dragleave", "touchmove", "touchcancel", "pointerup", "keyup"];
|
|
3
4
|
export function ripple(el, options = {}) {
|
|
@@ -71,16 +72,14 @@ export function ripple(el, options = {}) {
|
|
|
71
72
|
setTimeout(() => {
|
|
72
73
|
ripple.remove();
|
|
73
74
|
}, options.duration || 1000);
|
|
74
|
-
|
|
75
|
+
removeCancelListeners.forEach((removeCancelListener) => removeCancelListener());
|
|
75
76
|
}
|
|
76
|
-
cancelEvents.
|
|
77
|
+
const removeCancelListeners = cancelEvents.map((event) => on(el, event, removeRipple, { passive: true }));
|
|
77
78
|
}
|
|
78
|
-
triggerEvents.
|
|
79
|
+
const removeTriggerListeners = triggerEvents.map((event) => on(el, event, createRipple, { passive: event === "touchstart" }));
|
|
79
80
|
return {
|
|
80
81
|
destroy() {
|
|
81
|
-
|
|
82
|
-
el.removeEventListener(event, createRipple);
|
|
83
|
-
});
|
|
82
|
+
removeTriggerListeners.forEach((removeTriggerListener) => removeTriggerListener());
|
|
84
83
|
},
|
|
85
84
|
update(newOptions) {
|
|
86
85
|
options = newOptions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.0.0-
|
|
1
|
+
declare const _default: "1.0.0-beta13";
|
|
2
2
|
export default _default;
|
package/dist/helpers/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default "1.0.0-
|
|
1
|
+
export default "1.0.0-beta13";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { Snippet } from "svelte";
|
|
2
|
+
import { setContext, type Snippet } from "svelte";
|
|
4
3
|
|
|
5
4
|
let {
|
|
6
5
|
keys,
|
|
@@ -11,7 +10,7 @@
|
|
|
11
10
|
} = $props();
|
|
12
11
|
|
|
13
12
|
const keysArr = Array.isArray(keys) ? keys : [keys];
|
|
14
|
-
keysArr.forEach((key) =>
|
|
13
|
+
keysArr.forEach((key) => setContext(key, undefined));
|
|
15
14
|
</script>
|
|
16
15
|
|
|
17
16
|
{@render children?.()}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Snippet } from "svelte";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
keys: symbol | symbol[];
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const ContextResetter: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type ContextResetter = ReturnType<typeof ContextResetter>;
|
|
8
|
+
export default ContextResetter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- This component should be used when an icon can be set from props. The icon can either be undefined, a string or a Snippet so this componnet handles it all. -->
|
|
2
2
|
<script lang="ts">
|
|
3
|
-
import QIcon from "../icon/QIcon.svelte";
|
|
4
|
-
import type { QIconProps } from "../icon/props";
|
|
3
|
+
import QIcon from "../components/icon/QIcon.svelte";
|
|
4
|
+
import type { QIconProps } from "../components/icon/props";
|
|
5
5
|
import type { MaterialSymbol } from "material-symbols";
|
|
6
6
|
import type { Snippet } from "svelte";
|
|
7
7
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { QIconProps } from "../components/icon/props";
|
|
2
|
+
import type { MaterialSymbol } from "material-symbols";
|
|
3
|
+
import type { Snippet } from "svelte";
|
|
4
|
+
interface IconSnippetProps extends Omit<QIconProps, "name"> {
|
|
5
|
+
icon?: MaterialSymbol | Snippet;
|
|
6
|
+
defaultIcon?: MaterialSymbol | Snippet;
|
|
7
|
+
}
|
|
8
|
+
declare const QIconSnippet: import("svelte").Component<IconSnippetProps, {}, "">;
|
|
9
|
+
type QIconSnippet = ReturnType<typeof QIconSnippet>;
|
|
10
|
+
export default QIconSnippet;
|
package/dist/utils/context.d.ts
CHANGED
|
@@ -1,33 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This function allows to manipulate contexts more easily.
|
|
3
|
+
* Coupled with the class preprocessor, it avoids having to bother with reactivity as it automatically creates getters and setters from a typed interface.
|
|
4
|
+
*/
|
|
5
|
+
export declare function QContext<T>(name: string): {
|
|
6
|
+
/**
|
|
7
|
+
* The inner symbol used to identify the context.
|
|
8
|
+
*/
|
|
9
|
+
readonly symbol: symbol;
|
|
10
|
+
/**
|
|
11
|
+
* Get the context value.
|
|
12
|
+
* @returns The context value or undefined if not found.
|
|
13
|
+
*/
|
|
14
|
+
get(): T | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Get the context value or throw an error if not found.
|
|
17
|
+
*
|
|
18
|
+
* @param errorMsg Optional error message to throw if context is not found.
|
|
19
|
+
* @returns The context value.
|
|
20
|
+
* @throws Error if context is not found.
|
|
21
|
+
*/
|
|
22
|
+
assertGet(errorMsg?: string): NonNullable<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Set the context value.
|
|
25
|
+
* @param context The context value to set.
|
|
26
|
+
*/
|
|
27
|
+
set(context: T): void;
|
|
28
|
+
/**
|
|
29
|
+
* Reset the context value.
|
|
30
|
+
*/
|
|
31
|
+
reset(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Checks whether the context exists.
|
|
34
|
+
* @returns True if the context exists, false otherwise.
|
|
35
|
+
*/
|
|
36
|
+
exists(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Update one entry of the context.
|
|
39
|
+
*
|
|
40
|
+
* @param key The key of the entry to update.
|
|
41
|
+
* @param value The new value for the entry.
|
|
42
|
+
*/
|
|
43
|
+
updateEntry(key: keyof T, value: NonNullable<T>[keyof T]): void;
|
|
44
|
+
/**
|
|
45
|
+
* Update multiple entries of the context.
|
|
46
|
+
*
|
|
47
|
+
* @param updates The key/value pairs to update in the context.
|
|
48
|
+
*/
|
|
49
|
+
updateEntries(updates: Partial<T>): void;
|
|
33
50
|
};
|
package/dist/utils/context.js
CHANGED
|
@@ -1,33 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
1
|
+
import { getContext, hasContext, setContext } from "svelte";
|
|
2
|
+
/**
|
|
3
|
+
* This function allows to manipulate contexts more easily.
|
|
4
|
+
* Coupled with the class preprocessor, it avoids having to bother with reactivity as it automatically creates getters and setters from a typed interface.
|
|
5
|
+
*/
|
|
6
|
+
export function QContext(name) {
|
|
7
|
+
const sym = Symbol(name);
|
|
8
|
+
return {
|
|
9
|
+
/**
|
|
10
|
+
* The inner symbol used to identify the context.
|
|
11
|
+
*/
|
|
12
|
+
get symbol() {
|
|
13
|
+
return sym;
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* Get the context value.
|
|
17
|
+
* @returns The context value or undefined if not found.
|
|
18
|
+
*/
|
|
19
|
+
get() {
|
|
20
|
+
return getContext(sym);
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Get the context value or throw an error if not found.
|
|
24
|
+
*
|
|
25
|
+
* @param errorMsg Optional error message to throw if context is not found.
|
|
26
|
+
* @returns The context value.
|
|
27
|
+
* @throws Error if context is not found.
|
|
28
|
+
*/
|
|
29
|
+
assertGet(errorMsg) {
|
|
30
|
+
const ctx = getContext(sym);
|
|
31
|
+
if (!ctx) {
|
|
32
|
+
throw new Error(errorMsg || `Context "${name}" not found`);
|
|
33
|
+
}
|
|
34
|
+
return ctx;
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Set the context value.
|
|
38
|
+
* @param context The context value to set.
|
|
39
|
+
*/
|
|
40
|
+
set(context) {
|
|
41
|
+
setContext(sym, context);
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Reset the context value.
|
|
45
|
+
*/
|
|
46
|
+
reset() {
|
|
47
|
+
setContext(sym, undefined);
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Checks whether the context exists.
|
|
51
|
+
* @returns True if the context exists, false otherwise.
|
|
52
|
+
*/
|
|
53
|
+
exists() {
|
|
54
|
+
return hasContext(sym);
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Update one entry of the context.
|
|
58
|
+
*
|
|
59
|
+
* @param key The key of the entry to update.
|
|
60
|
+
* @param value The new value for the entry.
|
|
61
|
+
*/
|
|
62
|
+
updateEntry(key, value) {
|
|
63
|
+
const ctx = getContext(sym);
|
|
64
|
+
if (!ctx) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
ctx[key] = value;
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Update multiple entries of the context.
|
|
71
|
+
*
|
|
72
|
+
* @param updates The key/value pairs to update in the context.
|
|
73
|
+
*/
|
|
74
|
+
updateEntries(updates) {
|
|
75
|
+
const ctx = getContext(sym);
|
|
76
|
+
if (!ctx) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
Object.assign(ctx, updates);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
package/dist/utils/dom.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Direction } from "./events";
|
|
2
|
+
import type { Action } from "svelte/action";
|
|
3
|
+
export type PortalTarget = ParentNode | undefined;
|
|
4
|
+
export declare const usePortal: Action<HTMLElement, PortalTarget>;
|
|
5
|
+
export declare function getDialogOverlayRoot(dialog: HTMLDialogElement): ParentNode;
|
|
6
|
+
export declare function doesOverlayUsePopover(from: HTMLElement | null | undefined): boolean;
|
|
7
|
+
export declare function getOverlayPortalTarget(from: HTMLElement | null | undefined): ParentNode;
|
|
2
8
|
export declare function getParentElement(el: HTMLElement): HTMLElement;
|
|
3
9
|
export declare function getAllChildren(el: HTMLElement): HTMLElement[];
|
|
4
10
|
export declare function isFocusable(el: HTMLElement): boolean;
|
package/dist/utils/dom.js
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
function resolvePortalTarget(target) {
|
|
2
|
+
return target ?? document.body;
|
|
3
|
+
}
|
|
4
|
+
export const usePortal = (node, target) => {
|
|
5
|
+
resolvePortalTarget(target).appendChild(node);
|
|
6
|
+
return {
|
|
7
|
+
update(newTarget) {
|
|
8
|
+
const parent = resolvePortalTarget(newTarget);
|
|
9
|
+
if (node.parentNode !== parent) {
|
|
10
|
+
node.remove();
|
|
11
|
+
parent.appendChild(node);
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
destroy() {
|
|
15
|
+
node.remove();
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export function getDialogOverlayRoot(dialog) {
|
|
20
|
+
return dialog.querySelector("[data-quaff-overlay-root]") ?? dialog;
|
|
21
|
+
}
|
|
22
|
+
export function doesOverlayUsePopover(from) {
|
|
23
|
+
return (typeof HTMLElement !== "undefined" &&
|
|
24
|
+
"showPopover" in HTMLElement.prototype &&
|
|
25
|
+
!!from?.closest("dialog")?.open);
|
|
26
|
+
}
|
|
27
|
+
export function getOverlayPortalTarget(from) {
|
|
28
|
+
const dialog = from?.closest("dialog");
|
|
29
|
+
if (dialog?.open) {
|
|
30
|
+
return getDialogOverlayRoot(dialog);
|
|
31
|
+
}
|
|
32
|
+
return document.body;
|
|
33
|
+
}
|
|
1
34
|
export function getParentElement(el) {
|
|
2
35
|
let parent = el.parentNode;
|
|
3
36
|
while (parent && parent.nodeType !== 1) {
|
package/dist/utils/events.d.ts
CHANGED
|
@@ -11,27 +11,3 @@ export declare function isTabKey(e: KeyboardEvent): e is KeyboardEvent & {
|
|
|
11
11
|
export declare function getDirection(e: KeyboardEvent & {
|
|
12
12
|
code: "ArrowUp" | "ArrowDown" | "ArrowLeft" | "ArrowRight";
|
|
13
13
|
}): Direction;
|
|
14
|
-
type EventMap<T> = T extends HTMLElement ? HTMLElementEventMap : T extends typeof window ? WindowEventMap : DocumentEventMap;
|
|
15
|
-
/**
|
|
16
|
-
* Adds an event listener to an element.
|
|
17
|
-
*
|
|
18
|
-
* @param el The element to add the event listener to. If `null` or `undefined`, nothing is added.
|
|
19
|
-
* @param event The event to listen for.
|
|
20
|
-
* @param callback The function to call when the event is triggered.
|
|
21
|
-
* @returns An object with a single method, `remove()`, which removes the event listener.
|
|
22
|
-
*/
|
|
23
|
-
export declare function addEventListener<T extends HTMLElement | typeof window | typeof document, K extends keyof EventMap<T>>(el: T | undefined | null, event: K, callback: (e: EventMap<T>[K]) => void): {
|
|
24
|
-
remove: () => void;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Adds multiple event listeners to an element.
|
|
28
|
-
*
|
|
29
|
-
* @param el The element to add the event listener to. If `null` or `undefined`, nothing is added.
|
|
30
|
-
* @param events The events to listen for.
|
|
31
|
-
* @param callback The function to call when any of the events are triggered.
|
|
32
|
-
* @returns An object with a single method, `remove()`, which removes the event listeners.
|
|
33
|
-
*/
|
|
34
|
-
export declare function addEventListener<T extends HTMLElement | typeof window | typeof document, K extends keyof EventMap<T>>(el: T | undefined | null, events: K[], callback: (e: EventMap<T>[K]) => void): {
|
|
35
|
-
remove: () => void;
|
|
36
|
-
};
|
|
37
|
-
export {};
|
package/dist/utils/events.js
CHANGED
|
@@ -11,27 +11,3 @@ export function isTabKey(e) {
|
|
|
11
11
|
export function getDirection(e) {
|
|
12
12
|
return ["ArrowDown", "ArrowRight"].includes(e.code) ? "next" : "previous";
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Adds one or more event listeners to an element.
|
|
16
|
-
*
|
|
17
|
-
* @param el The element to add the event listener(s) to. If `null` or `undefined`, no action is taken.
|
|
18
|
-
* @param events An event or an array of events to listen for.
|
|
19
|
-
* @param callback The function to call when the event(s) are triggered.
|
|
20
|
-
* @returns An object with a `remove()` method to remove the event listener(s) added.
|
|
21
|
-
*/
|
|
22
|
-
export function addEventListener(el, events, callback) {
|
|
23
|
-
if (!el) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (Array.isArray(events)) {
|
|
27
|
-
const listeners = events.map((event) => addEventListener(el, event, callback));
|
|
28
|
-
return {
|
|
29
|
-
remove: () => listeners.forEach((listener) => listener.remove()),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
// Type casting to align with the broader compatibility between HTMLElement, Window, and Document
|
|
33
|
-
el.addEventListener(events, callback);
|
|
34
|
-
return {
|
|
35
|
-
remove: () => el.removeEventListener(events, callback),
|
|
36
|
-
};
|
|
37
|
-
}
|