@quaffui/quaff 0.1.0-prealpha16 → 0.1.0-prealpha19
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 +6 -6
- package/dist/classes/QContext.svelte.d.ts +42 -0
- package/dist/classes/QContext.svelte.js +63 -0
- package/dist/classes/QScrollObserver.svelte.d.ts +44 -0
- package/dist/classes/QScrollObserver.svelte.js +95 -0
- package/dist/classes/QTheme.svelte.d.ts +11 -0
- package/dist/classes/QTheme.svelte.js +49 -0
- package/dist/classes/Quaff.svelte.d.ts +14 -0
- package/dist/classes/Quaff.svelte.js +35 -0
- package/dist/components/avatar/QAvatar.scss +97 -0
- package/dist/components/avatar/QAvatar.svelte +35 -60
- package/dist/components/avatar/QAvatar.svelte.d.ts +2 -25
- package/dist/components/avatar/docs.props.js +21 -5
- package/dist/components/avatar/index.scss +5 -3
- package/dist/components/avatar/props.d.ts +24 -7
- package/dist/components/breadcrumbs/QBreadcrumbs.scss +10 -0
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte +24 -9
- package/dist/components/breadcrumbs/QBreadcrumbs.svelte.d.ts +2 -22
- package/dist/components/breadcrumbs/QBreadcrumbsEl.scss +10 -0
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte +64 -38
- package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte.d.ts +2 -25
- package/dist/components/breadcrumbs/docs.props.js +27 -27
- package/dist/components/breadcrumbs/props.d.ts +25 -24
- package/dist/components/button/QBtn.scss +133 -0
- package/dist/components/button/QBtn.svelte +88 -48
- package/dist/components/button/QBtn.svelte.d.ts +2 -33
- package/dist/components/button/docs.props.js +26 -18
- package/dist/components/button/props.d.ts +21 -15
- package/dist/components/card/QCard.scss +25 -0
- package/dist/components/card/QCard.svelte +25 -16
- package/dist/components/card/QCard.svelte.d.ts +2 -25
- package/dist/components/card/QCardActions.scss +10 -0
- package/dist/components/card/QCardActions.svelte +11 -8
- package/dist/components/card/QCardActions.svelte.d.ts +2 -21
- package/dist/components/card/QCardSection.scss +10 -0
- package/dist/components/card/QCardSection.svelte +8 -6
- package/dist/components/card/QCardSection.svelte.d.ts +2 -22
- package/dist/components/card/docs.props.js +6 -14
- package/dist/components/card/props.d.ts +9 -15
- package/dist/components/checkbox/QCheckbox.svelte +8 -3
- package/dist/components/checkbox/QCheckbox.svelte.d.ts +2 -20
- package/dist/components/checkbox/docs.props.js +1 -1
- package/dist/components/checkbox/index.scss +3 -1
- package/dist/components/checkbox/props.d.ts +1 -2
- package/dist/components/chip/QChip.scss +179 -0
- package/dist/components/chip/QChip.svelte +95 -70
- package/dist/components/chip/QChip.svelte.d.ts +2 -35
- package/dist/components/chip/docs.props.js +23 -47
- package/dist/components/chip/props.d.ts +21 -34
- package/dist/components/codeBlock/QCodeBlock.svelte +64 -42
- package/dist/components/codeBlock/QCodeBlock.svelte.d.ts +2 -20
- package/dist/components/codeBlock/docs.props.js +10 -2
- package/dist/components/codeBlock/props.d.ts +6 -1
- package/dist/components/dialog/{index.scss → QDialog.scss} +9 -7
- package/dist/components/dialog/QDialog.svelte +72 -70
- package/dist/components/dialog/QDialog.svelte.d.ts +6 -36
- package/dist/components/dialog/docs.props.d.ts +0 -8
- package/dist/components/dialog/docs.props.js +1 -131
- package/dist/components/dialog/props.d.ts +0 -16
- package/dist/components/drawer/QDrawer.scss +45 -0
- package/dist/components/drawer/QDrawer.svelte +87 -91
- package/dist/components/drawer/QDrawer.svelte.d.ts +6 -32
- package/dist/components/drawer/docs.props.js +3 -3
- package/dist/components/drawer/props.d.ts +2 -2
- package/dist/components/footer/QFooter.scss +42 -0
- package/dist/components/footer/QFooter.svelte +62 -23
- package/dist/components/footer/QFooter.svelte.d.ts +2 -23
- package/dist/components/footer/docs.props.js +14 -6
- package/dist/components/footer/props.d.ts +8 -5
- package/dist/components/header/QHeader.scss +54 -0
- package/dist/components/header/QHeader.svelte +52 -24
- package/dist/components/header/QHeader.svelte.d.ts +2 -23
- package/dist/components/header/docs.props.js +23 -7
- package/dist/components/header/props.d.ts +11 -3
- package/dist/components/icon/{index.scss → QIcon.scss} +2 -4
- package/dist/components/icon/QIcon.svelte +29 -16
- package/dist/components/icon/QIcon.svelte.d.ts +2 -27
- package/dist/components/icon/docs.props.js +3 -3
- package/dist/components/icon/props.d.ts +4 -4
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +2 -2
- package/dist/components/input/QInput.svelte +52 -25
- package/dist/components/input/QInput.svelte.d.ts +2 -32
- package/dist/components/input/docs.props.js +33 -1
- package/dist/components/input/props.d.ts +5 -12
- package/dist/components/input/props.js +1 -12
- package/dist/components/layout/QLayout.scss +178 -0
- package/dist/components/layout/QLayout.svelte +100 -80
- package/dist/components/layout/QLayout.svelte.d.ts +16 -43
- package/dist/components/layout/docs.props.js +57 -1
- package/dist/components/layout/props.d.ts +8 -0
- package/dist/components/list/QItem.scss +61 -0
- package/dist/components/list/QItem.svelte +65 -46
- package/dist/components/list/QItem.svelte.d.ts +2 -30
- package/dist/components/list/QItemSection.scss +45 -0
- package/dist/components/list/QItemSection.svelte +48 -33
- package/dist/components/list/QItemSection.svelte.d.ts +2 -24
- package/dist/components/list/QList.scss +30 -0
- package/dist/components/list/QList.svelte +25 -14
- package/dist/components/list/QList.svelte.d.ts +2 -28
- package/dist/components/list/docs.props.js +36 -4
- package/dist/components/list/props.d.ts +9 -8
- package/dist/components/list/props.js +1 -25
- package/dist/components/private/ContextReseter.svelte +6 -11
- package/dist/components/private/ContextReseter.svelte.d.ts +6 -18
- package/dist/components/private/QApi.svelte +117 -103
- package/dist/components/private/QApi.svelte.d.ts +4 -16
- package/dist/components/private/QDocs.svelte +67 -48
- package/dist/components/private/QDocs.svelte.d.ts +9 -20
- package/dist/components/private/QDocsSection.svelte +15 -14
- package/dist/components/private/QDocsSection.svelte.d.ts +7 -19
- package/dist/components/private/QIconSnippet.svelte +12 -0
- package/dist/components/private/QIconSnippet.svelte.d.ts +8 -0
- package/dist/components/progress/QCircularProgress.scss +63 -0
- package/dist/components/progress/QCircularProgress.svelte +104 -28
- package/dist/components/progress/QCircularProgress.svelte.d.ts +2 -22
- package/dist/components/progress/QLinearProgress.scss +75 -0
- package/dist/components/progress/QLinearProgress.svelte +55 -13
- package/dist/components/progress/QLinearProgress.svelte.d.ts +2 -20
- package/dist/components/progress/docs.props.js +138 -10
- package/dist/components/progress/props.d.ts +75 -12
- package/dist/components/radio/QRadio.svelte +14 -3
- package/dist/components/radio/QRadio.svelte.d.ts +2 -21
- package/dist/components/radio/docs.props.js +1 -1
- package/dist/components/radio/index.scss +3 -1
- package/dist/components/radio/props.d.ts +1 -3
- package/dist/components/radio/props.js +1 -8
- package/dist/components/railbar/QRailbar.scss +54 -0
- package/dist/components/railbar/QRailbar.svelte +43 -66
- package/dist/components/railbar/QRailbar.svelte.d.ts +2 -22
- package/dist/components/railbar/docs.props.js +4 -4
- package/dist/components/railbar/props.d.ts +3 -3
- package/dist/components/select/QSelect.svelte +121 -88
- package/dist/components/select/QSelect.svelte.d.ts +2 -34
- package/dist/components/select/docs.js +7 -0
- package/dist/components/select/docs.props.js +41 -1
- package/dist/components/select/index.scss +8 -6
- package/dist/components/select/props.d.ts +6 -12
- package/dist/components/select/props.js +1 -12
- package/dist/components/separator/QSeparator.scss +54 -0
- package/dist/components/separator/QSeparator.svelte +38 -45
- package/dist/components/separator/QSeparator.svelte.d.ts +2 -24
- package/dist/components/separator/docs.props.js +4 -4
- package/dist/components/separator/props.d.ts +5 -7
- package/dist/components/separator/props.js +1 -9
- package/dist/components/switch/QSwitch.scss +305 -0
- package/dist/components/switch/QSwitch.svelte +96 -0
- package/dist/components/switch/QSwitch.svelte.d.ts +3 -0
- package/dist/components/{toggle → switch}/docs.d.ts +1 -1
- package/dist/components/{toggle → switch}/docs.js +3 -3
- package/dist/components/{toggle → switch}/docs.props.d.ts +1 -1
- package/dist/components/{toggle → switch}/docs.props.js +30 -6
- package/dist/components/switch/props.d.ts +13 -0
- package/dist/components/switch/props.js +1 -0
- package/dist/components/table/QTable.svelte +99 -85
- package/dist/components/table/QTable.svelte.d.ts +3 -29
- package/dist/components/table/docs.props.js +9 -1
- package/dist/components/table/index.scss +3 -1
- package/dist/components/table/props.d.ts +10 -0
- package/dist/components/tabs/QTab.scss +71 -0
- package/dist/components/tabs/QTab.svelte +74 -90
- package/dist/components/tabs/QTab.svelte.d.ts +2 -25
- package/dist/components/tabs/QTabs.scss +40 -0
- package/dist/components/tabs/QTabs.svelte +110 -58
- package/dist/components/tabs/QTabs.svelte.d.ts +6 -31
- package/dist/components/tabs/docs.props.js +3 -3
- package/dist/components/tabs/index.scss +4 -2
- package/dist/components/tabs/props.d.ts +5 -4
- package/dist/components/toolbar/QToolbar.svelte +15 -12
- package/dist/components/toolbar/QToolbar.svelte.d.ts +2 -23
- package/dist/components/toolbar/QToolbarTitle.svelte +8 -7
- package/dist/components/toolbar/QToolbarTitle.svelte.d.ts +2 -21
- package/dist/components/toolbar/docs.props.js +4 -4
- package/dist/components/toolbar/index.scss +12 -14
- package/dist/components/toolbar/props.d.ts +4 -5
- package/dist/components/tooltip/QTooltip.svelte +5 -9
- package/dist/components/tooltip/QTooltip.svelte.d.ts +2 -21
- package/dist/components/tooltip/docs.props.js +1 -1
- package/dist/components/tooltip/index.scss +3 -1
- package/dist/components/tooltip/props.d.ts +1 -1
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/index.js +1 -1
- package/dist/composables/useSize.d.ts +10 -9
- package/dist/composables/useSize.js +32 -20
- package/dist/composables/useSizeLegacy.d.ts +9 -0
- package/dist/composables/useSizeLegacy.js +25 -0
- package/dist/css/_components.scss +31 -0
- package/dist/css/_disabled.scss +18 -0
- package/dist/css/{ripple.scss → _ripple.scss} +1 -1
- package/dist/css/_variables.scss +73 -0
- package/dist/css/classes/_design.scss +57 -0
- package/dist/css/classes/_flex.scss +62 -0
- package/dist/css/classes/_grid.scss +35 -0
- package/dist/css/classes/_index.scss +7 -0
- package/dist/css/classes/_overflow.scss +7 -0
- package/dist/css/classes/_position.scss +7 -0
- package/dist/css/classes/_select.scss +6 -0
- package/dist/css/classes/_spaces.scss +23 -0
- package/dist/css/index.css +1 -1
- package/dist/css/index.scss +15 -94
- package/dist/css/mixins/_design.scss +63 -0
- package/dist/css/mixins/{field-mixins.scss → _field.scss} +16 -5
- package/dist/css/mixins/_image.scss +63 -0
- package/dist/css/mixins/_index.scss +9 -0
- package/dist/css/mixins/_layout.scss +20 -0
- package/dist/css/mixins/{menu.scss → _menu.scss} +4 -2
- package/dist/css/mixins/{selection.scss → _selection.scss} +7 -67
- package/dist/css/mixins/_spaces.scss +36 -0
- package/dist/css/mixins/_typography.scss +7 -0
- package/dist/css/shared/q-field.scss +62 -32
- package/dist/css/theme/_colors.scss +173 -0
- package/dist/css/theme/css-variables.scss +5 -0
- package/dist/css/theme/page.scss +3 -3
- package/dist/css/theme/reset.scss +17 -1
- package/dist/css/theme/theme.scss +2 -3
- package/dist/css/theme/tokens.scss +0 -159
- package/dist/helpers/clickOutside.js +2 -1
- package/dist/helpers/ripple.d.ts +1 -1
- package/dist/helpers/ripple.js +13 -4
- package/dist/helpers/version.d.ts +1 -1
- package/dist/helpers/version.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/stores/index.d.ts +0 -2
- package/dist/stores/index.js +1 -2
- package/dist/utils/colors.d.ts +71 -0
- package/dist/utils/colors.js +101 -14
- package/dist/utils/dom.d.ts +2 -0
- package/dist/utils/dom.js +6 -0
- package/dist/utils/number.d.ts +2 -0
- package/dist/utils/number.js +9 -0
- package/dist/utils/props.js +3 -1
- package/dist/utils/router.d.ts +17 -0
- package/dist/utils/router.js +23 -0
- package/dist/utils/string.d.ts +1 -0
- package/dist/utils/string.js +3 -0
- package/dist/utils/types.d.ts +6 -1
- package/dist/utils/types.js +0 -3
- package/dist/utils/types.json +8 -5
- package/dist/utils/watchable.d.ts +0 -1
- package/package.json +40 -37
- package/dist/components/breadcrumbs/index.scss +0 -20
- package/dist/components/button/index.scss +0 -103
- package/dist/components/card/index.scss +0 -56
- package/dist/components/chip/index.scss +0 -103
- package/dist/components/drawer/index.scss +0 -59
- package/dist/components/footer/index.scss +0 -28
- package/dist/components/layout/index.scss +0 -387
- package/dist/components/list/index.scss +0 -144
- package/dist/components/progress/index.scss +0 -82
- package/dist/components/railbar/index.scss +0 -39
- package/dist/components/separator/index.scss +0 -52
- package/dist/components/toggle/QToggle.svelte +0 -34
- package/dist/components/toggle/QToggle.svelte.d.ts +0 -23
- package/dist/components/toggle/index.scss +0 -31
- package/dist/components/toggle/props.d.ts +0 -9
- package/dist/components/toggle/props.js +0 -9
- package/dist/css/grid.scss +0 -50
- package/dist/css/mixins.scss +0 -137
- package/dist/css/states.scss +0 -75
- package/dist/css/theme/bridge.scss +0 -15
- package/dist/css/theme/theme.dark.scss +0 -39
- package/dist/css/theme/theme.light.scss +0 -39
- package/dist/css/variables-sass.scss +0 -16
- package/dist/stores/QTheme.d.ts +0 -42
- package/dist/stores/QTheme.js +0 -59
- package/dist/stores/Quaff.d.ts +0 -32
- package/dist/stores/Quaff.js +0 -58
- /package/dist/css/mixins/{table.scss → _table.scss} +0 -0
package/dist/helpers/ripple.js
CHANGED
|
@@ -4,7 +4,6 @@ export function ripple(el, options = {}) {
|
|
|
4
4
|
const rippleContainer = document.createElement("div");
|
|
5
5
|
addClasses();
|
|
6
6
|
setOptions(options);
|
|
7
|
-
el.appendChild(rippleContainer);
|
|
8
7
|
function addClasses(center) {
|
|
9
8
|
const shouldBeCentered = center || options.center;
|
|
10
9
|
if (!rippleContainer.classList.contains("q-ripple--effect")) {
|
|
@@ -13,9 +12,17 @@ export function ripple(el, options = {}) {
|
|
|
13
12
|
if (!shouldBeCentered && rippleContainer.classList.contains("q-ripple--center")) {
|
|
14
13
|
rippleContainer.classList.remove("q-ripple--center");
|
|
15
14
|
}
|
|
16
|
-
|
|
15
|
+
if (shouldBeCentered) {
|
|
16
|
+
rippleContainer.classList.add("q-ripple--center");
|
|
17
|
+
}
|
|
17
18
|
}
|
|
18
19
|
function setOptions(options) {
|
|
20
|
+
if (options.disabled || el.hasAttribute("aria-disabled")) {
|
|
21
|
+
rippleContainer.remove();
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
el.appendChild(rippleContainer);
|
|
25
|
+
}
|
|
19
26
|
if (options.duration && options.duration < 0) {
|
|
20
27
|
options.duration = undefined;
|
|
21
28
|
}
|
|
@@ -27,8 +34,9 @@ export function ripple(el, options = {}) {
|
|
|
27
34
|
}
|
|
28
35
|
}
|
|
29
36
|
function createRipple(e, center) {
|
|
30
|
-
if (options.
|
|
37
|
+
if (options.disabled || el.hasAttribute("aria-disabled")) {
|
|
31
38
|
return;
|
|
39
|
+
}
|
|
32
40
|
if (e instanceof KeyboardEvent) {
|
|
33
41
|
if (!["Enter", "Space"].includes(e.code) || e.repeat) {
|
|
34
42
|
return;
|
|
@@ -56,8 +64,9 @@ export function ripple(el, options = {}) {
|
|
|
56
64
|
ripple.style.width = ripple.style.height = `${radius * 2}px`;
|
|
57
65
|
rippleContainer.appendChild(ripple);
|
|
58
66
|
function removeRipple() {
|
|
59
|
-
if (ripple === null)
|
|
67
|
+
if (ripple === null) {
|
|
60
68
|
return;
|
|
69
|
+
}
|
|
61
70
|
ripple.style.opacity = "0";
|
|
62
71
|
setTimeout(() => {
|
|
63
72
|
ripple.remove();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.1.0-
|
|
1
|
+
declare const _default: "0.1.0-prealpha19";
|
|
2
2
|
export default _default;
|
package/dist/helpers/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default "0.1.0-
|
|
1
|
+
export default "0.1.0-prealpha19";
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/stores/index.d.ts
CHANGED
package/dist/stores/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "./Quaff";
|
|
1
|
+
"use strict";
|
package/dist/utils/colors.d.ts
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
|
+
export type Mode = "light" | "dark";
|
|
2
|
+
export type HexValue = `#${string}`;
|
|
3
|
+
type BaseColorNames = [
|
|
4
|
+
"error",
|
|
5
|
+
"error-container",
|
|
6
|
+
"neutral",
|
|
7
|
+
"neutral-container",
|
|
8
|
+
"neutral-variant",
|
|
9
|
+
"neutral-variant-container",
|
|
10
|
+
"on-error",
|
|
11
|
+
"on-error-container",
|
|
12
|
+
"on-neutral",
|
|
13
|
+
"on-neutral-container",
|
|
14
|
+
"on-neutral-variant",
|
|
15
|
+
"on-neutral-variant-container",
|
|
16
|
+
"on-primary",
|
|
17
|
+
"on-primary-container",
|
|
18
|
+
"on-secondary",
|
|
19
|
+
"on-secondary-container",
|
|
20
|
+
"on-tertiary",
|
|
21
|
+
"on-tertiary-container",
|
|
22
|
+
"primary",
|
|
23
|
+
"primary-container",
|
|
24
|
+
"secondary",
|
|
25
|
+
"secondary-container",
|
|
26
|
+
"tertiary",
|
|
27
|
+
"tertiary-container"
|
|
28
|
+
];
|
|
29
|
+
type BaseColors = Record<BaseColorNames[number], HexValue>;
|
|
30
|
+
type ToneColorNames = [
|
|
31
|
+
"background",
|
|
32
|
+
"inverse-on-surface",
|
|
33
|
+
"inverse-primary",
|
|
34
|
+
"inverse-surface",
|
|
35
|
+
"on-background",
|
|
36
|
+
"on-primary-fixed",
|
|
37
|
+
"on-primary-fixed-variant",
|
|
38
|
+
"on-secondary-fixed",
|
|
39
|
+
"on-secondary-fixed-variant",
|
|
40
|
+
"on-surface",
|
|
41
|
+
"on-surface-variant",
|
|
42
|
+
"on-tertiary-fixed",
|
|
43
|
+
"on-tertiary-fixed-variant",
|
|
44
|
+
"outline",
|
|
45
|
+
"outline-variant",
|
|
46
|
+
"primary-fixed",
|
|
47
|
+
"primary-fixed-dim",
|
|
48
|
+
"scrim",
|
|
49
|
+
"secondary-fixed",
|
|
50
|
+
"secondary-fixed-dim",
|
|
51
|
+
"shadow",
|
|
52
|
+
"surface",
|
|
53
|
+
"surface-bright",
|
|
54
|
+
"surface-container",
|
|
55
|
+
"surface-container-high",
|
|
56
|
+
"surface-container-highest",
|
|
57
|
+
"surface-container-low",
|
|
58
|
+
"surface-container-lowest",
|
|
59
|
+
"surface-dim",
|
|
60
|
+
"surface-tint",
|
|
61
|
+
"surface-variant",
|
|
62
|
+
"tertiary-fixed",
|
|
63
|
+
"tertiary-fixed-dim"
|
|
64
|
+
];
|
|
65
|
+
type ToneColors = Record<ToneColorNames[number], HexValue>;
|
|
66
|
+
export type QuaffColorNames = [...BaseColorNames, ...ToneColorNames];
|
|
67
|
+
export type QuaffColors = BaseColors & ToneColors;
|
|
68
|
+
export declare function generateColors(from: string): {
|
|
69
|
+
light: QuaffColors;
|
|
70
|
+
dark: QuaffColors;
|
|
71
|
+
};
|
|
1
72
|
declare class QColors {
|
|
2
73
|
private static hexRegex;
|
|
3
74
|
private static isValidRgb;
|
package/dist/utils/colors.js
CHANGED
|
@@ -1,10 +1,88 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { argbFromHex, hexFromArgb, themeFromSourceColor, } from "@material/material-color-utilities";
|
|
2
|
+
import { isNumeric } from "./number.js";
|
|
3
|
+
import { convertCase } from "./string.js";
|
|
4
|
+
const COLOR_TONES = {
|
|
5
|
+
background: { fromColor: "neutral", light: 98, dark: 6 },
|
|
6
|
+
"inverse-on-surface": { fromColor: "neutral", light: 95, dark: 20 },
|
|
7
|
+
"inverse-primary": { fromColor: "primary", light: 80, dark: 40 },
|
|
8
|
+
"inverse-surface": { fromColor: "neutral", light: 20, dark: 90 },
|
|
9
|
+
"on-background": { fromColor: "neutral", light: 10, dark: 90 },
|
|
10
|
+
"on-primary-fixed": { fromColor: "primary", light: 10, dark: 10 },
|
|
11
|
+
"on-primary-fixed-variant": { fromColor: "primary", light: 30, dark: 30 },
|
|
12
|
+
"on-secondary-fixed": { fromColor: "secondary", light: 10, dark: 10 },
|
|
13
|
+
"on-secondary-fixed-variant": { fromColor: "secondary", light: 30, dark: 30 },
|
|
14
|
+
"on-surface": { fromColor: "neutral", light: 10, dark: 90 },
|
|
15
|
+
"on-surface-variant": { fromColor: "neutralVariant", light: 30, dark: 80 },
|
|
16
|
+
"on-tertiary-fixed": { fromColor: "tertiary", light: 10, dark: 10 },
|
|
17
|
+
"on-tertiary-fixed-variant": { fromColor: "tertiary", light: 30, dark: 30 },
|
|
18
|
+
outline: { fromColor: "neutralVariant", light: 50, dark: 60 },
|
|
19
|
+
"outline-variant": { fromColor: "neutralVariant", light: 80, dark: 30 },
|
|
20
|
+
"primary-fixed": { fromColor: "primary", light: 90, dark: 90 },
|
|
21
|
+
"primary-fixed-dim": { fromColor: "primary", light: 80, dark: 80 },
|
|
22
|
+
scrim: { fromColor: "neutral", light: 0, dark: 0 },
|
|
23
|
+
"secondary-fixed": { fromColor: "secondary", light: 90, dark: 90 },
|
|
24
|
+
"secondary-fixed-dim": { fromColor: "secondary", light: 80, dark: 80 },
|
|
25
|
+
shadow: { fromColor: "neutral", light: 0, dark: 0 },
|
|
26
|
+
surface: { fromColor: "neutral", light: 98, dark: 6 },
|
|
27
|
+
"surface-bright": { fromColor: "neutral", light: 98, dark: 24 },
|
|
28
|
+
"surface-container": { fromColor: "neutral", light: 94, dark: 12 },
|
|
29
|
+
"surface-container-high": { fromColor: "neutral", light: 92, dark: 17 },
|
|
30
|
+
"surface-container-highest": { fromColor: "neutral", light: 90, dark: 22 },
|
|
31
|
+
"surface-container-low": { fromColor: "neutral", light: 96, dark: 10 },
|
|
32
|
+
"surface-container-lowest": { fromColor: "neutral", light: 100, dark: 4 },
|
|
33
|
+
"surface-dim": { fromColor: "neutral", light: 87, dark: 6 },
|
|
34
|
+
"surface-tint": { fromColor: "primary", light: 40, dark: 80 },
|
|
35
|
+
"surface-variant": { fromColor: "neutral", light: 90, dark: 30 },
|
|
36
|
+
"tertiary-fixed": { fromColor: "tertiary", light: 90, dark: 90 },
|
|
37
|
+
"tertiary-fixed-dim": { fromColor: "tertiary", light: 80, dark: 80 },
|
|
38
|
+
};
|
|
39
|
+
export function generateColors(from) {
|
|
40
|
+
const argb = argbFromHex(from);
|
|
41
|
+
const palettes = themeFromSourceColor(argb).palettes;
|
|
42
|
+
return {
|
|
43
|
+
light: getColors(palettes, "light"),
|
|
44
|
+
dark: getColors(palettes, "dark"),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function getColors(palettes, mode) {
|
|
48
|
+
const tones = mode === "light"
|
|
49
|
+
? {
|
|
50
|
+
base: 40,
|
|
51
|
+
onBase: 100,
|
|
52
|
+
baseContainer: 90,
|
|
53
|
+
onBaseContainer: 10,
|
|
54
|
+
}
|
|
55
|
+
: {
|
|
56
|
+
base: 80,
|
|
57
|
+
onBase: 20,
|
|
58
|
+
baseContainer: 30,
|
|
59
|
+
onBaseContainer: 90,
|
|
60
|
+
};
|
|
61
|
+
const getColor = (color, palette) => {
|
|
62
|
+
color = convertCase(color, "pascal", "kebab");
|
|
63
|
+
return [
|
|
64
|
+
[color, palette.tone(tones.base)],
|
|
65
|
+
[`on-${color}`, palette.tone(tones.onBase)],
|
|
66
|
+
[`${color}-container`, palette.tone(tones.baseContainer)],
|
|
67
|
+
[`on-${color}-container`, palette.tone(tones.onBaseContainer)],
|
|
68
|
+
];
|
|
69
|
+
};
|
|
70
|
+
const results = Object.fromEntries(Object.entries(palettes)
|
|
71
|
+
.map(([color, palette]) => getColor(color, palette))
|
|
72
|
+
.flat(1));
|
|
73
|
+
let toneColor;
|
|
74
|
+
for (toneColor in COLOR_TONES) {
|
|
75
|
+
const toneInfo = COLOR_TONES[toneColor];
|
|
76
|
+
results[toneColor] = palettes[toneInfo.fromColor].tone(toneInfo[mode]);
|
|
77
|
+
}
|
|
78
|
+
return Object.fromEntries(Object.entries(results).map(([color, value]) => [color, hexFromArgb(value)]));
|
|
79
|
+
}
|
|
2
80
|
class QColors {
|
|
3
81
|
static hexRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
4
82
|
static isValidRgb(r, g, b) {
|
|
5
|
-
return (
|
|
6
|
-
|
|
7
|
-
|
|
83
|
+
return (isNumeric(r) &&
|
|
84
|
+
isNumeric(g) &&
|
|
85
|
+
isNumeric(b) &&
|
|
8
86
|
+r >= 0 &&
|
|
9
87
|
+r <= 255 &&
|
|
10
88
|
+g >= 0 &&
|
|
@@ -13,9 +91,9 @@ class QColors {
|
|
|
13
91
|
+b <= 255);
|
|
14
92
|
}
|
|
15
93
|
static isValidHsl(h, s, l) {
|
|
16
|
-
return (
|
|
17
|
-
|
|
18
|
-
|
|
94
|
+
return (isNumeric(h) &&
|
|
95
|
+
isNumeric(s) &&
|
|
96
|
+
isNumeric(l) &&
|
|
19
97
|
+h >= 0 &&
|
|
20
98
|
+h <= 360 &&
|
|
21
99
|
+s >= 0 &&
|
|
@@ -42,7 +120,9 @@ class QColors {
|
|
|
42
120
|
if (!QColors.isValidRgb(r, g, b)) {
|
|
43
121
|
throw new Error("Invalid RGB values. They should be in the range 0-255.");
|
|
44
122
|
}
|
|
45
|
-
|
|
123
|
+
r = +r / 255;
|
|
124
|
+
g = +g / 255;
|
|
125
|
+
b = +b / 255;
|
|
46
126
|
const max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
47
127
|
const l = (max + min) / 2;
|
|
48
128
|
let h, s;
|
|
@@ -73,22 +153,29 @@ class QColors {
|
|
|
73
153
|
throw new Error("Invalid HSL values. Hue should be in the range 0-360, saturation and lightness in the range 0-100.");
|
|
74
154
|
}
|
|
75
155
|
let r, g, b;
|
|
76
|
-
|
|
156
|
+
h = +h / 360;
|
|
157
|
+
s = +s / 100;
|
|
158
|
+
l = +l / 100;
|
|
77
159
|
if (s === 0) {
|
|
78
160
|
r = g = b = l; // achromatic
|
|
79
161
|
}
|
|
80
162
|
else {
|
|
81
163
|
const hue2rgb = (p, q, t) => {
|
|
82
|
-
if (t < 0)
|
|
164
|
+
if (t < 0) {
|
|
83
165
|
t += 1;
|
|
84
|
-
|
|
166
|
+
}
|
|
167
|
+
if (t > 1) {
|
|
85
168
|
t -= 1;
|
|
86
|
-
|
|
169
|
+
}
|
|
170
|
+
if (t < 1 / 6) {
|
|
87
171
|
return p + (q - p) * 6 * t;
|
|
88
|
-
|
|
172
|
+
}
|
|
173
|
+
if (t < 1 / 2) {
|
|
89
174
|
return q;
|
|
90
|
-
|
|
175
|
+
}
|
|
176
|
+
if (t < 2 / 3) {
|
|
91
177
|
return p + (q - p) * (2 / 3 - t) * 6;
|
|
178
|
+
}
|
|
92
179
|
return p;
|
|
93
180
|
};
|
|
94
181
|
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
package/dist/utils/dom.d.ts
CHANGED
|
@@ -7,3 +7,5 @@ export declare function getClosestFocusableChild(el: HTMLElement): HTMLElement;
|
|
|
7
7
|
export declare function getClosestFocusableSibling<T extends HTMLElement>(el: T, direction: Direction): HTMLElement;
|
|
8
8
|
export declare function getClosestFocusableBlock(el: HTMLElement, direction: Direction): HTMLElement;
|
|
9
9
|
export declare function movementDirection(from: HTMLElement, to: HTMLElement): Direction;
|
|
10
|
+
export declare function shouldReduceMotion(): boolean;
|
|
11
|
+
export declare function elFromSelector<T extends HTMLElement>(selector: string | T | null | typeof window | Document): Document | (Window & typeof globalThis) | T | null;
|
package/dist/utils/dom.js
CHANGED
|
@@ -73,3 +73,9 @@ export function movementDirection(from, to) {
|
|
|
73
73
|
const relativePosition = from.compareDocumentPosition(to);
|
|
74
74
|
return relativePosition === 2 ? "previous" : "next";
|
|
75
75
|
}
|
|
76
|
+
export function shouldReduceMotion() {
|
|
77
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
78
|
+
}
|
|
79
|
+
export function elFromSelector(selector) {
|
|
80
|
+
return typeof selector === "string" ? document.querySelector(selector) : selector;
|
|
81
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function isNumeric(input) {
|
|
2
|
+
return typeof input === "number" || !isNaN(Number(input));
|
|
3
|
+
}
|
|
4
|
+
export function between(value, min, max) {
|
|
5
|
+
if (max < min) {
|
|
6
|
+
console.warn(`max (${max}) should not be smaller than min (${min}).`);
|
|
7
|
+
}
|
|
8
|
+
return max <= min ? min : Math.min(max, Math.max(min, value));
|
|
9
|
+
}
|
package/dist/utils/props.js
CHANGED
|
@@ -8,7 +8,9 @@ export function createStyles(styleObj, userStyles) {
|
|
|
8
8
|
}
|
|
9
9
|
toJoin.push(`${convertCase(styleName, "camel", "kebab")}: ${styleVal}`);
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
if (userStyles) {
|
|
12
|
+
toJoin.push(userStyles);
|
|
13
|
+
}
|
|
12
14
|
if (toJoin.length === 0) {
|
|
13
15
|
return null;
|
|
14
16
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Readable } from "svelte/store";
|
|
2
|
+
export interface RouterProps {
|
|
3
|
+
activeClass?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
href?: string;
|
|
6
|
+
replace?: boolean;
|
|
7
|
+
to?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const isRouteActive: Readable<(route?: string) => boolean>;
|
|
10
|
+
export declare function getRouterInfo<T extends RouterProps>(props: T): {
|
|
11
|
+
hasLink: boolean;
|
|
12
|
+
linkAttributes: {
|
|
13
|
+
href: string | undefined;
|
|
14
|
+
"data-sveltekit-reload": boolean | undefined;
|
|
15
|
+
};
|
|
16
|
+
linkClasses: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { derived } from "svelte/store";
|
|
2
|
+
import { page } from "$app/stores";
|
|
3
|
+
export const isRouteActive = derived(page, ($page) => {
|
|
4
|
+
return (route) => {
|
|
5
|
+
if (!route) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return $page.url.pathname === route || $page.url.pathname.startsWith(`${route}/`);
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
export function getRouterInfo(props) {
|
|
12
|
+
const hasLink = [props.to, props.href].some((entry) => entry !== undefined);
|
|
13
|
+
const linkClasses = `${hasLink ? "q-link" : ""} ${props.disabled ? "disabled" : ""}`.trim();
|
|
14
|
+
const linkAttributes = {
|
|
15
|
+
href: props.to || props.href,
|
|
16
|
+
"data-sveltekit-reload": props.replace ? true : undefined,
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
hasLink,
|
|
20
|
+
linkAttributes,
|
|
21
|
+
linkClasses,
|
|
22
|
+
};
|
|
23
|
+
}
|
package/dist/utils/string.d.ts
CHANGED
package/dist/utils/string.js
CHANGED
package/dist/utils/types.d.ts
CHANGED
|
@@ -42,4 +42,9 @@ export interface QComponentMethod {
|
|
|
42
42
|
type: string;
|
|
43
43
|
description: string;
|
|
44
44
|
}
|
|
45
|
-
export
|
|
45
|
+
export type Entries<T> = {
|
|
46
|
+
[K in keyof T]: [K, T[K]];
|
|
47
|
+
}[keyof T][];
|
|
48
|
+
export type QEvent<T, E> = T & {
|
|
49
|
+
currentTarget: EventTarget & E;
|
|
50
|
+
};
|
package/dist/utils/types.js
CHANGED
package/dist/utils/types.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"QAvatarShapeOptions": "type QAvatarShapeOptions =\n | \"circle\"\n | \"rounded\"\n | \"top-round\"\n | \"left-round\"\n | \"right-round\"\n | \"bottom-round\"\n | \"top-left-round\"\n | \"top-right-round\"\n | \"bottom-left-round\"\n | \"bottom-right-round\"",
|
|
3
|
-
"QAvatarSizeOptions": "type QAvatarSizeOptions =
|
|
4
|
-
"QBreadcrumbsGutterOptions": "type QBreadcrumbsGutterOptions =
|
|
5
|
-
"
|
|
3
|
+
"QAvatarSizeOptions": "type QAvatarSizeOptions = Q.Size | Q.CssValue | number",
|
|
4
|
+
"QBreadcrumbsGutterOptions": "type QBreadcrumbsGutterOptions = Exclude<Q.Size, \"xs\" | \"xl\">",
|
|
5
|
+
"QBtnDesignOptions": "type QBtnDesignOptions = \"elevated\" | \"filled\" | \"tonal\" | \"outlined\" | \"flat\"",
|
|
6
|
+
"QBtnSizeOptions": "type QBtnSizeOptions = Exclude<Q.Size, \"xs\">",
|
|
6
7
|
"QCardFillColors": "type QCardFillColors = \"primary\" | \"secondary\" | \"tertiary\"",
|
|
7
|
-
"
|
|
8
|
+
"QChipFillOptions": "type QChipFillOptions =\n | \"primary\"\n | \"secondary\"\n | \"tertiary\"\n | \"neutral\"\n | \"neutral-variant\"\n | \"error\"",
|
|
9
|
+
"QChipKindOptions": "type QChipKindOptions = \"assist\" | \"filter\" | \"input\" | \"suggestion\"",
|
|
10
|
+
"QChipSizeOptions": "type QChipSizeOptions = Exclude<Q.Size, \"xs\" | \"xl\" | \"none\">",
|
|
8
11
|
"QDialogPositionOptions": "type QDialogPositionOptions = \"default\" | \"top\" | \"right\" | \"bottom\" | \"left\"",
|
|
9
12
|
"QDrawerBehaviorOptions": "type QDrawerBehaviorOptions = \"default\" | \"desktop\" | \"mobile\"",
|
|
10
13
|
"QDrawerSideOptions": "type QDrawerSideOptions = \"left\" | \"right\"",
|
|
11
|
-
"QIconSizeOptions": "type QIconSizeOptions =
|
|
14
|
+
"QIconSizeOptions": "type QIconSizeOptions = Q.Size | Q.CssValue | number",
|
|
12
15
|
"QIconTypeOptions": "type QIconTypeOptions = \"outlined\" | \"sharp\" | \"rounded\"",
|
|
13
16
|
"QItemSectionTypes": "type QItemSectionTypes =\n | \"thumbnail\"\n | \"video\"\n | \"avatar\"\n | \"toggle\"\n | \"icon\"\n | \"trailingIcon\"\n | \"trailingText\"\n | \"content\"",
|
|
14
17
|
"QLayoutEvents": "type QLayoutEvents = \"resize\" | \"scroll\" | \"scrollHeight\"",
|
package/package.json
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quaffui/quaff",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-prealpha19",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"open": "vite dev --open",
|
|
7
|
-
"build": "vite build &&
|
|
7
|
+
"build": "vite build && bun run package && bun run build:css",
|
|
8
8
|
"build:css": "vite build --config vite.config.scss.ts",
|
|
9
9
|
"preview": "vite preview",
|
|
10
10
|
"package": "svelte-kit sync && svelte-package && publint",
|
|
11
|
-
"prepublishOnly": "
|
|
11
|
+
"prepublishOnly": "bun run build",
|
|
12
12
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
13
13
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
14
14
|
"test:unit": "vitest",
|
|
15
15
|
"lint": "prettier --plugin prettier-plugin-svelte . --check . && eslint .",
|
|
16
16
|
"format": "prettier --plugin prettier-plugin-svelte . --write .",
|
|
17
|
-
"docgen": "
|
|
18
|
-
"
|
|
19
|
-
"
|
|
17
|
+
"docgen-props": "bun scripts/docgenProps.ts",
|
|
18
|
+
"colorgen": "bun scripts/colorgen.ts",
|
|
19
|
+
"docgen-snippets": "bun scripts/docgenSnippets.ts",
|
|
20
|
+
"write-version": "bun scripts/writeVersion.ts"
|
|
20
21
|
},
|
|
21
22
|
"exports": {
|
|
22
23
|
".": {
|
|
@@ -34,38 +35,40 @@
|
|
|
34
35
|
"svelte": "^4.0.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"@fontsource/roboto": "^5.0
|
|
38
|
-
"@
|
|
39
|
-
"@sveltejs/
|
|
40
|
-
"@sveltejs/
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@types/
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"eslint": "^8.
|
|
47
|
-
"eslint
|
|
48
|
-
"eslint
|
|
49
|
-
"eslint-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
38
|
+
"@fontsource/roboto": "^5.1.0",
|
|
39
|
+
"@material/material-color-utilities": "^0.3.0",
|
|
40
|
+
"@sveltejs/adapter-auto": "^3.2.5",
|
|
41
|
+
"@sveltejs/kit": "^2.5.28",
|
|
42
|
+
"@sveltejs/package": "^2.3.5",
|
|
43
|
+
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
|
44
|
+
"@types/bun": "^1.1.11",
|
|
45
|
+
"@types/prettier": "^3.0.0",
|
|
46
|
+
"@types/prismjs": "^1.26.4",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
|
48
|
+
"@typescript-eslint/parser": "^8.7.0",
|
|
49
|
+
"eslint": "^9.11.1",
|
|
50
|
+
"eslint-config-prettier": "^9.1.0",
|
|
51
|
+
"eslint-plugin-import-x": "^4.3.0",
|
|
52
|
+
"eslint-plugin-svelte": "^2.44.0",
|
|
53
|
+
"eslint-plugin-unicorn": "^55.0.0",
|
|
54
|
+
"estree-walker": "^3.0.3",
|
|
55
|
+
"globals": "^15.9.0",
|
|
56
|
+
"magic-string": "^0.30.11",
|
|
57
|
+
"material-symbols": "^0.23.0",
|
|
58
|
+
"prettier": "^3.3.3",
|
|
59
|
+
"prettier-plugin-svelte": "^3.2.6",
|
|
60
|
+
"publint": "^0.2.11",
|
|
61
|
+
"sass": "^1.79.3",
|
|
62
|
+
"shiki": "^1.21.0",
|
|
63
|
+
"svelte": "5.0.0-next.257",
|
|
64
|
+
"svelte-check": "^4.0.3",
|
|
65
|
+
"svelte-eslint-parser": "^0.41.1",
|
|
66
|
+
"tslib": "^2.7.0",
|
|
67
|
+
"typescript": "^5.6.2",
|
|
68
|
+
"vite": "^5.4.7",
|
|
69
|
+
"vitest": "^2.1.1"
|
|
62
70
|
},
|
|
63
71
|
"svelte": "./dist/index.js",
|
|
64
72
|
"types": "./dist/index.d.ts",
|
|
65
|
-
"type": "module"
|
|
66
|
-
"dependencies": {
|
|
67
|
-
"highlight.js": "^11.8.0",
|
|
68
|
-
"material-dynamic-colors": "^1.0.1",
|
|
69
|
-
"svelte-highlight": "^7.3.0"
|
|
70
|
-
}
|
|
73
|
+
"type": "module"
|
|
71
74
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// QBreadcrumbs
|
|
2
|
-
.q-breadcrumbs {
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
|
|
7
|
-
&__separator:first-child {
|
|
8
|
-
display: none;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// QBreadcrumbsEl
|
|
13
|
-
.q-breadcrumbs.q-breadcrumbs__el {
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
|
|
17
|
-
& > .q-icon {
|
|
18
|
-
@include margin("r");
|
|
19
|
-
}
|
|
20
|
-
}
|