@quaffui/quaff 0.1.0-prealpha20 → 0.1.0-prealpha22

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.
Files changed (105) hide show
  1. package/dist/components/avatar/QAvatar.svelte +4 -1
  2. package/dist/components/avatar/QAvatar.svelte.d.ts +14 -2
  3. package/dist/components/breadcrumbs/QBreadcrumbs.svelte +7 -2
  4. package/dist/components/breadcrumbs/QBreadcrumbs.svelte.d.ts +14 -2
  5. package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte +16 -5
  6. package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte.d.ts +14 -2
  7. package/dist/components/button/QBtn.svelte +61 -11
  8. package/dist/components/button/QBtn.svelte.d.ts +14 -2
  9. package/dist/components/button/docs.props.js +37 -5
  10. package/dist/components/button/props.d.ts +24 -4
  11. package/dist/components/card/QCard.svelte +6 -2
  12. package/dist/components/card/QCard.svelte.d.ts +14 -2
  13. package/dist/components/card/QCardActions.svelte +9 -1
  14. package/dist/components/card/QCardActions.svelte.d.ts +14 -2
  15. package/dist/components/card/QCardSection.svelte +3 -1
  16. package/dist/components/card/QCardSection.svelte.d.ts +14 -2
  17. package/dist/components/checkbox/QCheckbox.svelte +8 -1
  18. package/dist/components/checkbox/QCheckbox.svelte.d.ts +14 -3
  19. package/dist/components/chip/QChip.svelte +30 -9
  20. package/dist/components/chip/QChip.svelte.d.ts +14 -3
  21. package/dist/components/codeBlock/QCodeBlock.svelte +37 -8
  22. package/dist/components/codeBlock/QCodeBlock.svelte.d.ts +14 -3
  23. package/dist/components/dialog/QDialog.svelte +20 -5
  24. package/dist/components/dialog/QDialog.svelte.d.ts +21 -7
  25. package/dist/components/drawer/QDrawer.svelte +36 -7
  26. package/dist/components/drawer/QDrawer.svelte.d.ts +21 -7
  27. package/dist/components/footer/QFooter.svelte +24 -6
  28. package/dist/components/footer/QFooter.svelte.d.ts +14 -3
  29. package/dist/components/header/QHeader.svelte +19 -6
  30. package/dist/components/header/QHeader.svelte.d.ts +14 -3
  31. package/dist/components/icon/QIcon.svelte +6 -1
  32. package/dist/components/icon/QIcon.svelte.d.ts +14 -2
  33. package/dist/components/input/QInput.svelte +23 -10
  34. package/dist/components/input/QInput.svelte.d.ts +14 -3
  35. package/dist/components/input/index.scss +1 -1
  36. package/dist/components/layout/QLayout.scss +2 -1
  37. package/dist/components/layout/QLayout.svelte +50 -8
  38. package/dist/components/layout/QLayout.svelte.d.ts +14 -3
  39. package/dist/components/list/QItem.svelte +11 -2
  40. package/dist/components/list/QItem.svelte.d.ts +14 -3
  41. package/dist/components/list/QItemSection.svelte +9 -3
  42. package/dist/components/list/QItemSection.svelte.d.ts +14 -3
  43. package/dist/components/list/QList.svelte +8 -3
  44. package/dist/components/list/QList.svelte.d.ts +14 -3
  45. package/dist/components/private/ContextReseter.svelte +10 -1
  46. package/dist/components/private/ContextReseter.svelte.d.ts +14 -6
  47. package/dist/components/private/QApi.svelte +32 -9
  48. package/dist/components/private/QApi.svelte.d.ts +14 -5
  49. package/dist/components/private/QDocs.svelte +18 -1
  50. package/dist/components/private/QDocs.svelte.d.ts +14 -10
  51. package/dist/components/private/QDocsSection.svelte +14 -2
  52. package/dist/components/private/QDocsSection.svelte.d.ts +14 -7
  53. package/dist/components/private/QIconSnippet.svelte +11 -1
  54. package/dist/components/private/QIconSnippet.svelte.d.ts +14 -8
  55. package/dist/components/progress/QCircularProgress.svelte +19 -3
  56. package/dist/components/progress/QCircularProgress.svelte.d.ts +14 -2
  57. package/dist/components/progress/QLinearProgress.svelte +12 -4
  58. package/dist/components/progress/QLinearProgress.svelte.d.ts +14 -2
  59. package/dist/components/radio/QRadio.svelte +3 -1
  60. package/dist/components/radio/QRadio.svelte.d.ts +14 -3
  61. package/dist/components/railbar/QRailbar.svelte +17 -4
  62. package/dist/components/railbar/QRailbar.svelte.d.ts +14 -3
  63. package/dist/components/select/QSelect.svelte +65 -23
  64. package/dist/components/select/QSelect.svelte.d.ts +14 -3
  65. package/dist/components/select/index.scss +1 -1
  66. package/dist/components/separator/QSeparator.svelte +4 -1
  67. package/dist/components/separator/QSeparator.svelte.d.ts +14 -3
  68. package/dist/components/switch/QSwitch.svelte +20 -6
  69. package/dist/components/switch/QSwitch.svelte.d.ts +14 -3
  70. package/dist/components/table/QTable.svelte +47 -19
  71. package/dist/components/table/QTable.svelte.d.ts +14 -3
  72. package/dist/components/tabs/QTab.svelte +32 -9
  73. package/dist/components/tabs/QTab.svelte.d.ts +14 -3
  74. package/dist/components/tabs/QTabs.svelte +58 -16
  75. package/dist/components/tabs/QTabs.svelte.d.ts +14 -3
  76. package/dist/components/toolbar/QToolbar.svelte +3 -1
  77. package/dist/components/toolbar/QToolbar.svelte.d.ts +14 -3
  78. package/dist/components/toolbar/QToolbarTitle.svelte +3 -1
  79. package/dist/components/toolbar/QToolbarTitle.svelte.d.ts +14 -3
  80. package/dist/components/tooltip/QTooltip.svelte +8 -1
  81. package/dist/components/tooltip/QTooltip.svelte.d.ts +14 -3
  82. package/dist/css/classes/_index.scss +7 -7
  83. package/dist/css/fonts.scss +3 -2
  84. package/dist/css/index.css +1 -1
  85. package/dist/css/index.scss +7 -5
  86. package/dist/css/mixins/_design.scss +5 -4
  87. package/dist/css/mixins/_image.scss +2 -1
  88. package/dist/css/mixins/_index.scss +9 -9
  89. package/dist/css/theme/_index.scss +12 -0
  90. package/dist/css/theme/_page.scss +17 -0
  91. package/dist/css/theme/{palette.scss → _palette.scss} +5 -3
  92. package/dist/helpers/version.d.ts +1 -1
  93. package/dist/helpers/version.js +1 -1
  94. package/dist/utils/types.json +1 -1
  95. package/package.json +32 -31
  96. package/dist/css/flex.scss +0 -41
  97. package/dist/css/theme/page.scss +0 -16
  98. package/dist/css/theme/theme.scss +0 -10
  99. /package/dist/css/theme/{colors.module.scss → _color-classes.scss} +0 -0
  100. /package/dist/css/theme/{css-variables.scss → _css-variables.scss} +0 -0
  101. /package/dist/css/theme/{elevate.scss → _elevate.scss} +0 -0
  102. /package/dist/css/theme/{reset.scss → _reset.scss} +0 -0
  103. /package/dist/css/theme/{typography.module.scss → _typography-classes.scss} +0 -0
  104. /package/dist/css/theme/{tokens.scss → _typography-variables.scss} +0 -0
  105. /package/dist/css/theme/{typography.scss → _typography.scss} +0 -0
@@ -1,16 +1,40 @@
1
1
  <script lang="ts">
2
- import { codeToHtml } from "shiki";
2
+ import { onMount } from "svelte";
3
3
  import { copy } from "../../utils";
4
4
  import { QBtn } from "../..";
5
+ import type { CodeToHastOptions, BundledLanguage, BundledTheme } from "shiki";
6
+ import type { QCodeBlockProps } from "./props";
7
+
5
8
  let {
6
9
  language,
7
10
  theme = "github-dark-default",
8
11
  code = "/* No code found */",
9
- title = void 0,
10
- copiable = void 0,
11
- } = $props();
12
+ title = undefined,
13
+ copiable = undefined,
14
+ }: QCodeBlockProps = $props();
15
+
12
16
  let btnContent = $state("Copy");
13
17
  let btnColor = $state("primary");
18
+
19
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
20
+ let codeToHtml = async (
21
+ str: string,
22
+ opts: CodeToHastOptions<BundledLanguage, BundledTheme>,
23
+ ) => "";
24
+
25
+ async function loadShiki() {
26
+ try {
27
+ // prevent vite "optimization", which would lead to errors here
28
+ const shikiPackage = "shiki";
29
+ const { codeToHtml: codeToHtmlShiki } = await import(
30
+ /* @vite-ignore */ shikiPackage
31
+ );
32
+ codeToHtml = codeToHtmlShiki;
33
+ } catch (e) {
34
+ console.error("error loading shiki, please make sure it is installed", e);
35
+ }
36
+ }
37
+
14
38
  const html = $derived.by(
15
39
  async () =>
16
40
  await codeToHtml(code, {
@@ -18,7 +42,8 @@
18
42
  theme,
19
43
  }),
20
44
  );
21
- function setBtn(type) {
45
+
46
+ function setBtn(type: "base" | "error" | "success") {
22
47
  switch (type) {
23
48
  case "error":
24
49
  btnContent = "Error while copying...";
@@ -34,16 +59,20 @@
34
59
  break;
35
60
  }
36
61
  }
62
+
37
63
  async function copyCode() {
38
64
  await copy(code).catch(() => {
39
65
  setBtn("error");
40
- setTimeout(() => setBtn("base"), 3e3);
66
+ setTimeout(() => setBtn("base"), 3000);
41
67
  });
68
+
42
69
  setBtn("success");
43
70
  setTimeout(() => {
44
71
  setBtn("base");
45
- }, 3e3);
72
+ }, 3000);
46
73
  }
74
+
75
+ onMount(() => loadShiki());
47
76
  </script>
48
77
 
49
78
  <div class="q-code-block">
@@ -60,7 +89,7 @@
60
89
  class="border-{btnColor} text-{btnColor}"
61
90
  size="sm"
62
91
  icon="content_copy"
63
- design="outlined"
92
+ variant="outlined"
64
93
  onclick={copyCode}
65
94
  >
66
95
  {btnContent}
@@ -1,3 +1,14 @@
1
- import type { QCodeBlockProps } from "./props";
2
- declare const QCodeBlock: import("svelte").Component<QCodeBlockProps, {}, "">;
3
- export default QCodeBlock;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ type QCodeBlockProps_ = typeof __propDef.props;
10
+ export { QCodeBlockProps_ as QCodeBlockProps };
11
+ export type QCodeBlockEvents = typeof __propDef.events;
12
+ export type QCodeBlockSlots = typeof __propDef.slots;
13
+ export default class QCodeBlock extends SvelteComponentTyped<QCodeBlockProps_, QCodeBlockEvents, QCodeBlockSlots> {
14
+ }
@@ -1,4 +1,6 @@
1
1
  <script lang="ts">
2
+ import type { QDialogProps } from "./props";
3
+
2
4
  let {
3
5
  value = $bindable(false),
4
6
  position = "default",
@@ -7,30 +9,38 @@
7
9
  persistent = false,
8
10
  children,
9
11
  ...props
10
- } = $props();
11
- let dialogEl;
12
+ }: QDialogProps = $props();
13
+
14
+ let dialogEl: HTMLDialogElement;
15
+
12
16
  const canHide = $derived(value && !persistent);
17
+
13
18
  $effect(() => {
14
19
  if (value) {
15
20
  dialogEl?.[modal ? "showModal" : "show"]();
21
+
16
22
  setTimeout(() => {
17
23
  window.addEventListener("click", tryCancel);
18
24
  }, 150);
19
25
  } else {
20
26
  dialogEl?.close();
27
+
21
28
  window.removeEventListener("click", tryCancel);
22
29
  }
23
30
  });
31
+
24
32
  export function hide() {
25
33
  if (dialogEl.open) {
26
34
  value = false;
27
35
  }
28
36
  }
37
+
29
38
  export function show() {
30
39
  if (!dialogEl.open) {
31
40
  value = true;
32
41
  }
33
42
  }
43
+
34
44
  export function toggle() {
35
45
  if (dialogEl.open) {
36
46
  hide();
@@ -38,23 +48,28 @@
38
48
  show();
39
49
  }
40
50
  }
51
+
41
52
  function addAnimation() {
42
53
  if (persistent && value) {
43
54
  dialogEl.classList.add("q-dialog--animating");
55
+
44
56
  setTimeout(() => {
45
57
  dialogEl.classList.remove("q-dialog--animating");
46
58
  }, 150);
47
59
  }
48
60
  }
49
- function handleClickInside(e) {
61
+
62
+ function handleClickInside(e: MouseEvent) {
50
63
  e.stopPropagation();
51
64
  }
52
- function onkeydown(e) {
65
+
66
+ function onkeydown(e: KeyboardEvent) {
53
67
  if (e.key === "Escape") {
54
68
  tryCancel(e);
55
69
  }
56
70
  }
57
- function tryCancel(e) {
71
+
72
+ function tryCancel(e: Event) {
58
73
  if (canHide) {
59
74
  hide();
60
75
  } else {
@@ -1,7 +1,21 @@
1
- import type { QDialogProps } from "./props";
2
- declare const QDialog: import("svelte").Component<QDialogProps, {
3
- hide: () => void;
4
- show: () => void;
5
- toggle: () => void;
6
- }, "value">;
7
- export default QDialog;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ hide?: () => void;
5
+ show?: () => void;
6
+ toggle?: () => void;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ type QDialogProps_ = typeof __propDef.props;
14
+ export { QDialogProps_ as QDialogProps };
15
+ export type QDialogEvents = typeof __propDef.events;
16
+ export type QDialogSlots = typeof __propDef.slots;
17
+ export default class QDialog extends SvelteComponentTyped<QDialogProps_, QDialogEvents, QDialogSlots> {
18
+ get hide(): () => void;
19
+ get show(): () => void;
20
+ get toggle(): () => void;
21
+ }
@@ -4,6 +4,10 @@
4
4
  import { useSize } from "../../composables";
5
5
  import { clickOutside } from "../../helpers";
6
6
  import QContext from "../../classes/QContext.svelte";
7
+ import type { QLayoutProps } from "../layout/props";
8
+ import type { DrawerContext, LayoutContext } from "../layout/QLayout.svelte";
9
+ import type { QDrawerProps } from "./props";
10
+
7
11
  let {
8
12
  value = $bindable(false),
9
13
  side = "left",
@@ -13,14 +17,23 @@
13
17
  persistent = false,
14
18
  children,
15
19
  ...props
16
- } = $props();
17
- const drawerContext = QContext.get(`QDrawer-${side}`);
18
- const layoutView = getContext("view");
19
- const ctx = QContext.get("layout");
20
+ }: QDrawerProps = $props();
21
+
22
+ const drawerContext = QContext.get<DrawerContext>(`QDrawer-${side}`);
23
+ const layoutView = getContext<{ value: NonNullable<QLayoutProps["view"]> }>(
24
+ "view",
25
+ );
26
+
27
+ const ctx = QContext.get<LayoutContext>("layout");
28
+
20
29
  const drawerType = $derived(side === "left" ? "drawerLeft" : "drawerRight");
30
+
21
31
  const drawerCtx = $derived(ctx?.value?.[drawerType]);
32
+
22
33
  const canHideOnClickOutside = $derived((value && !persistent) || overlay);
34
+
23
35
  const hideOnRouteChange = $derived(!persistent || overlay);
36
+
24
37
  const offsetTop = $derived.by(() => {
25
38
  const charPos = side === "left" ? 0 : 2;
26
39
  return layoutView?.value.charAt(charPos) === "h";
@@ -29,34 +42,44 @@
29
42
  const charPos = side === "left" ? 8 : 10;
30
43
  return layoutView?.value.charAt(charPos) === "f";
31
44
  });
32
- export const show = (e) => {
45
+
46
+ export const show = (e?: MouseEvent) => {
33
47
  if (!value) {
34
48
  value = true;
35
49
  e?.stopPropagation();
36
50
  }
37
51
  };
52
+
38
53
  export const hide = () => {
39
54
  if (value) {
40
55
  value = false;
41
56
  }
42
57
  };
43
- export const toggle = (e) => {
58
+
59
+ export const toggle = (e?: MouseEvent) => {
44
60
  value = !value;
45
61
  e?.stopPropagation();
46
62
  };
63
+
47
64
  $effect(() => {
48
65
  if ($navigating && hideOnRouteChange) {
49
66
  hide();
50
67
  }
51
68
  });
69
+
52
70
  onDestroy(() => {
53
71
  drawerContext?.updateEntries({
54
72
  width: 0,
55
73
  takesSpace: false,
56
74
  });
57
75
  });
76
+
58
77
  $effect(() => {
78
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
59
79
  [value, overlay, width];
80
+
81
+ // TODO: Try to make it work without console.debug
82
+ // writing untrack(() => drawerContext)?.updateEntries(...) doesn't work (infinite $effect loop)
60
83
  untrack(() =>
61
84
  drawerContext?.updateEntries({
62
85
  takesSpace: !!value && !overlay,
@@ -64,14 +87,20 @@
64
87
  }),
65
88
  );
66
89
  });
67
- const shouldHaveRadius = (pos) => {
90
+
91
+ const shouldHaveRadius = (pos: "top" | "bottom") => {
68
92
  const appBarEl = pos === "top" ? ctx?.value?.header : ctx?.value?.footer;
93
+
94
+ // This is an overlay, or there is no header/footer, or there is an offset top/bottom
69
95
  return overlay || !appBarEl?.display || drawerCtx?.offset[pos];
70
96
  };
97
+
71
98
  const widthStyle = $derived(!ctx ? useSize(width).style : null);
99
+
72
100
  const drawerWidthStyle = $derived(
73
101
  widthStyle === null ? "" : `--${side}-drawer-width: ${widthStyle};`,
74
102
  );
103
+
75
104
  const style = $derived(`${drawerWidthStyle}${props.style ?? ""}`);
76
105
  </script>
77
106
 
@@ -1,7 +1,21 @@
1
- import type { QDrawerProps } from "./props";
2
- declare const QDrawer: import("svelte").Component<QDrawerProps, {
3
- show: (e?: MouseEvent) => void;
4
- hide: () => void;
5
- toggle: (e?: MouseEvent) => void;
6
- }, "value">;
7
- export default QDrawer;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ show?: (e?: MouseEvent) => void;
5
+ hide?: () => void;
6
+ toggle?: (e?: MouseEvent) => void;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ type QDrawerProps_ = typeof __propDef.props;
14
+ export { QDrawerProps_ as QDrawerProps };
15
+ export type QDrawerEvents = typeof __propDef.events;
16
+ export type QDrawerSlots = typeof __propDef.slots;
17
+ export default class QDrawer extends SvelteComponentTyped<QDrawerProps_, QDrawerEvents, QDrawerSlots> {
18
+ get show(): (e?: MouseEvent) => void;
19
+ get hide(): () => void;
20
+ get toggle(): (e?: MouseEvent) => void;
21
+ }
@@ -2,8 +2,13 @@
2
2
  import { getContext, onDestroy, onMount, untrack } from "svelte";
3
3
  import QContext from "../../classes/QContext.svelte";
4
4
  import QScrollObserver from "../../classes/QScrollObserver.svelte";
5
+ import type { QLayoutProps } from "../layout/props";
5
6
  import QToolbar from "../toolbar/QToolbar.svelte";
7
+ import type { AppbarContext } from "../layout/QLayout.svelte";
8
+ import type { QFooterProps } from "./props";
9
+
6
10
  const footerIdentifier = Date.now();
11
+
7
12
  let {
8
13
  value = $bindable(true),
9
14
  bordered = false,
@@ -12,39 +17,52 @@
12
17
  height = 80,
13
18
  children,
14
19
  ...props
15
- } = $props();
16
- const footerContext = QContext.get("QFooter");
17
- const layoutView = getContext("view");
20
+ }: QFooterProps = $props();
21
+
22
+ const footerContext = QContext.get<AppbarContext>("QFooter");
23
+ const layoutView = getContext<{ value: NonNullable<QLayoutProps["view"]> }>(
24
+ "view",
25
+ );
26
+
18
27
  if (!footerContext || !layoutView) {
19
28
  throw new Error("QFooter should be used inside QLayout");
20
29
  }
30
+
21
31
  const scroll = $derived(
22
32
  reveal
23
33
  ? new QScrollObserver(
24
34
  `.q-footer--${footerIdentifier} ~ .q-layout__content`,
25
35
  )
26
- : void 0,
36
+ : undefined,
27
37
  );
28
38
  let contentScrollHeight = $state(0);
29
- const offset = $derived(scroll ? scroll.position + height : void 0);
39
+
40
+ const offset = $derived(scroll ? scroll.position + height : undefined);
41
+ // Collapse the footer `${reavealOffset}px` above the bottom of layout content when scrolling up
30
42
  const collapsed = $derived(
31
43
  reveal &&
32
44
  scroll?.direction === "up" &&
33
- offset + revealOffset < contentScrollHeight,
45
+ offset! + revealOffset < contentScrollHeight,
34
46
  );
47
+
35
48
  const leftOffset = () => layoutView.value.charAt(8) === "l";
36
49
  const rightOffset = () => layoutView.value.charAt(10) === "r";
50
+
37
51
  $effect.pre(() => {
38
52
  untrack(() => footerContext).updateEntries({ height, collapsed });
39
53
  });
54
+
40
55
  onMount(() => {
56
+ // Calculating the layout content's height
41
57
  const content = document.querySelector(
42
58
  `.q-footer--${footerIdentifier} ~ .q-layout__content`,
43
59
  );
60
+
44
61
  contentScrollHeight = content
45
62
  ? content.scrollHeight - content.clientHeight
46
63
  : 0;
47
64
  });
65
+
48
66
  onDestroy(() => {
49
67
  untrack(() => footerContext).updateEntries({ height: 0, collapsed: false });
50
68
  });
@@ -1,3 +1,14 @@
1
- import type { QFooterProps } from "./props";
2
- declare const QFooter: import("svelte").Component<QFooterProps, {}, "value">;
3
- export default QFooter;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ type QFooterProps_ = typeof __propDef.props;
10
+ export { QFooterProps_ as QFooterProps };
11
+ export type QFooterEvents = typeof __propDef.events;
12
+ export type QFooterSlots = typeof __propDef.slots;
13
+ export default class QFooter extends SvelteComponentTyped<QFooterProps_, QFooterEvents, QFooterSlots> {
14
+ }
@@ -3,7 +3,12 @@
3
3
  import QToolbar from "../toolbar/QToolbar.svelte";
4
4
  import QContext from "../../classes/QContext.svelte";
5
5
  import QScrollObserver from "../../classes/QScrollObserver.svelte";
6
+ import type { AppbarContext } from "../layout/QLayout.svelte";
7
+ import type { QLayoutProps } from "../layout/props";
8
+ import type { QHeaderProps } from "./props";
9
+
6
10
  const headerIdentifier = Date.now();
11
+
7
12
  let {
8
13
  elevated = false,
9
14
  inset = false,
@@ -12,28 +17,36 @@
12
17
  height = 64,
13
18
  children,
14
19
  ...props
15
- } = $props();
16
- const headerContext = QContext.get("QHeader");
17
- const layoutView = getContext("view");
20
+ }: QHeaderProps = $props();
21
+
22
+ const headerContext = QContext.get<AppbarContext>("QHeader");
23
+ const layoutView = getContext<{ value: NonNullable<QLayoutProps["view"]> }>(
24
+ "view",
25
+ );
18
26
  if (!headerContext || !layoutView) {
19
27
  throw new Error("QHeader should be used inside QLayout");
20
28
  }
29
+
21
30
  const scroll = $derived(
22
31
  reveal
23
32
  ? new QScrollObserver(
24
33
  `.q-header--${headerIdentifier} ~ .q-layout__content`,
25
34
  )
26
- : void 0,
35
+ : undefined,
27
36
  );
28
- const offset = $derived(scroll ? scroll.position - height : void 0);
37
+ const offset = $derived(scroll ? scroll.position - height : undefined);
38
+ // Collapse the header `${reavealOffset}px` below the top of layout content when scrolling down
29
39
  const collapsed = $derived(
30
- reveal && scroll?.direction === "down" && offset - revealOffset > 0,
40
+ reveal && scroll?.direction === "down" && offset! - revealOffset > 0,
31
41
  );
42
+
32
43
  const leftOffset = () => layoutView.value.charAt(0) === "l";
33
44
  const rightOffset = () => layoutView.value.charAt(2) === "r";
45
+
34
46
  $effect.pre(() => {
35
47
  untrack(() => headerContext).updateEntries({ height, collapsed });
36
48
  });
49
+
37
50
  onDestroy(() => {
38
51
  untrack(() => headerContext).updateEntries({ height: 0, collapsed: false });
39
52
  });
@@ -1,3 +1,14 @@
1
- import type { QHeaderProps } from "./props";
2
- declare const QHeader: import("svelte").Component<QHeaderProps, {}, "">;
3
- export default QHeader;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ type QHeaderProps_ = typeof __propDef.props;
10
+ export { QHeaderProps_ as QHeaderProps };
11
+ export type QHeaderEvents = typeof __propDef.events;
12
+ export type QHeaderSlots = typeof __propDef.slots;
13
+ export default class QHeader extends SvelteComponentTyped<QHeaderProps_, QHeaderEvents, QHeaderSlots> {
14
+ }
@@ -2,6 +2,8 @@
2
2
 
3
3
  <script lang="ts">
4
4
  import { useSize } from "../../composables/useSize";
5
+ import type { QIconProps } from "./props";
6
+
5
7
  let {
6
8
  size = "md",
7
9
  name,
@@ -13,12 +15,15 @@
13
15
  color,
14
16
  children,
15
17
  ...props
16
- } = $props();
18
+ }: QIconProps = $props();
19
+
17
20
  const qSize = $derived(useSize(size, "q-icon"));
21
+
18
22
  const imgAttrs = $derived({
19
23
  alt: "Quaff Image Icon",
20
24
  ...imgAttributes,
21
25
  });
26
+
22
27
  const typeClass = $derived(`q-icon--${type}`);
23
28
  </script>
24
29
 
@@ -1,3 +1,15 @@
1
+ import { SvelteComponentTyped } from "svelte";
1
2
  import type { QIconProps } from "./props";
2
- declare const QIcon: import("svelte").Component<QIconProps, {}, "">;
3
- export default QIcon;
3
+ declare const __propDef: {
4
+ props: QIconProps;
5
+ events: {
6
+ [evt: string]: CustomEvent<any>;
7
+ };
8
+ slots: {};
9
+ };
10
+ type QIconProps_ = typeof __propDef.props;
11
+ export { QIconProps_ as QIconProps };
12
+ export type QIconEvents = typeof __propDef.events;
13
+ export type QIconSlots = typeof __propDef.slots;
14
+ export default class QIcon extends SvelteComponentTyped<QIconProps_, QIconEvents, QIconSlots> {
15
+ }
@@ -1,32 +1,45 @@
1
1
  <script lang="ts">
2
+ import type { QEvent } from "../../utils";
3
+
4
+ type QInputFocusEvent = QEvent<FocusEvent, HTMLDivElement>;
5
+
2
6
  let focus = $state(false);
7
+
3
8
  let snippetPrependWidth = $state(0);
9
+
10
+ import type { QInputProps } from "../input/props";
11
+
4
12
  let {
5
13
  dense = false,
6
14
  disable = false,
7
15
  error = false,
8
- errorMessage = void 0,
16
+ errorMessage = undefined,
9
17
  filled = false,
10
- hint = void 0,
11
- label = void 0,
18
+ hint = undefined,
19
+ label = undefined,
12
20
  outlined = false,
13
21
  rounded = false,
14
- before = void 0,
15
- prepend = void 0,
16
- append = void 0,
17
- after = void 0,
22
+ before = undefined,
23
+ prepend = undefined,
24
+ append = undefined,
25
+ after = undefined,
18
26
  value = $bindable(),
19
27
  ...props
20
- } = $props();
28
+ }: QInputProps = $props();
29
+
21
30
  const active = $derived(value || focus);
22
- function onFocus(e) {
31
+
32
+ function onFocus(e: QInputFocusEvent) {
23
33
  focus = true;
24
34
  props.onfocus?.(e);
25
35
  }
26
- function onBlur(e) {
36
+
37
+ function onBlur(e: QInputFocusEvent) {
27
38
  focus = false;
28
39
  props.onblur?.(e);
29
40
  }
41
+
42
+ // q-field here, q-input in classes
30
43
  </script>
31
44
 
32
45
  <div
@@ -1,3 +1,14 @@
1
- import type { QInputProps } from "../input/props";
2
- declare const QInput: import("svelte").Component<QInputProps, {}, "value">;
3
- export default QInput;
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ type QInputProps_ = typeof __propDef.props;
10
+ export { QInputProps_ as QInputProps };
11
+ export type QInputEvents = typeof __propDef.events;
12
+ export type QInputSlots = typeof __propDef.slots;
13
+ export default class QInput extends SvelteComponentTyped<QInputProps_, QInputEvents, QInputSlots> {
14
+ }
@@ -1 +1 @@
1
- @import "$css/shared/q-field.scss";
1
+ @use "$css/shared/q-field.scss";
@@ -1,3 +1,4 @@
1
+ @use "sass:string";
1
2
  @use "$css/mixins";
2
3
  @use "$css/variables";
3
4
 
@@ -92,7 +93,7 @@
92
93
  @error 'The position "#{$pos}" is incorrect, should be "top" or "bottom"';
93
94
  }
94
95
 
95
- @return unquote(
96
+ @return string.unquote(
96
97
  ":is(.q-drawer--overlay,.q-drawer--offset-#{$pos},:not(:has(~ .q-header)),:has(~ .q-header--collapsed))"
97
98
  );
98
99
  }