@quaffui/quaff 1.0.0-beta6 → 1.0.0-beta9

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 (55) hide show
  1. package/README.md +2 -0
  2. package/dist/components/avatar/QAvatar.svelte +4 -0
  3. package/dist/components/breadcrumbs/QBreadcrumbs.svelte +28 -5
  4. package/dist/components/breadcrumbs/QBreadcrumbs.svelte.d.ts +23 -0
  5. package/dist/components/breadcrumbs/QBreadcrumbsEl.svelte +17 -14
  6. package/dist/components/button/QBtn.svelte +21 -11
  7. package/dist/components/card/QCard.svelte +9 -5
  8. package/dist/components/card/QCardActions.svelte +4 -0
  9. package/dist/components/card/QCardSection.svelte +2 -0
  10. package/dist/components/checkbox/QCheckbox.svelte +2 -0
  11. package/dist/components/chip/QChip.svelte +24 -14
  12. package/dist/components/codeBlock/QCodeBlock.svelte +8 -0
  13. package/dist/components/dialog/QDialog.svelte +12 -0
  14. package/dist/components/drawer/QDrawer.svelte +50 -39
  15. package/dist/components/expansion-item/QExpansionItem.svelte +16 -2
  16. package/dist/components/footer/QFooter.svelte +27 -22
  17. package/dist/components/header/QHeader.svelte +37 -28
  18. package/dist/components/icon/QIcon.svelte +4 -0
  19. package/dist/components/input/QInput.svelte +9 -2
  20. package/dist/components/layout/QLayout.svelte +243 -90
  21. package/dist/components/layout/QLayout.svelte.d.ts +64 -2
  22. package/dist/components/list/QItem.svelte +43 -24
  23. package/dist/components/list/QItem.svelte.d.ts +14 -0
  24. package/dist/components/list/QItemSection.svelte +16 -12
  25. package/dist/components/list/QList.svelte +28 -6
  26. package/dist/components/list/QList.svelte.d.ts +15 -0
  27. package/dist/components/private/ContextReseter.svelte +2 -3
  28. package/dist/components/private/QApi.svelte +15 -7
  29. package/dist/components/private/QDocs.svelte +40 -20
  30. package/dist/components/private/QDocs.svelte.d.ts +30 -0
  31. package/dist/components/private/QDocsSection.svelte +11 -7
  32. package/dist/components/progress/QCircularProgress.svelte +14 -5
  33. package/dist/components/progress/QLinearProgress.svelte +12 -6
  34. package/dist/components/radio/QRadio.svelte +2 -0
  35. package/dist/components/railbar/QRailbar.svelte +36 -35
  36. package/dist/components/select/QSelect.svelte +32 -23
  37. package/dist/components/separator/QSeparator.svelte +4 -0
  38. package/dist/components/switch/QSwitch.svelte +6 -0
  39. package/dist/components/table/QTable.svelte +23 -13
  40. package/dist/components/tabs/QTab.svelte +19 -22
  41. package/dist/components/tabs/QTabs.svelte +59 -32
  42. package/dist/components/tabs/QTabs.svelte.d.ts +15 -4
  43. package/dist/components/toolbar/QToolbar.svelte +2 -0
  44. package/dist/components/toolbar/QToolbarTitle.svelte +2 -0
  45. package/dist/components/tooltip/QTooltip.svelte +22 -8
  46. package/dist/components/tooltip/QTooltipBase.svelte +18 -8
  47. package/dist/composables/useRouterLink.d.ts +2 -1
  48. package/dist/css/index.css +1 -1
  49. package/dist/helpers/version.d.ts +1 -1
  50. package/dist/helpers/version.js +1 -1
  51. package/dist/utils/context.d.ts +49 -32
  52. package/dist/utils/context.js +82 -33
  53. package/package.json +28 -27
  54. package/dist/classes/QContext.svelte.d.ts +0 -42
  55. package/dist/classes/QContext.svelte.js +0 -63
@@ -1,8 +1,17 @@
1
- <script lang="ts">
2
- import { setContext } from "svelte";
3
- import { QListCtxName } from "../../utils";
1
+ <script lang="ts" module>
2
+ import { QContext } from "../../utils";
4
3
  import type { QListProps } from "./props";
5
4
 
5
+ interface QListContext {
6
+ readonly activeClass: string | undefined;
7
+ readonly separatorOptions: QListProps["separatorOptions"];
8
+ }
9
+
10
+ export const listCtx = QContext<QListContext>("QList");
11
+ </script>
12
+
13
+ <script lang="ts">
14
+ // #region: --- Props
6
15
  let {
7
16
  bordered = false,
8
17
  roundedBorders = false,
@@ -15,15 +24,28 @@
15
24
  children,
16
25
  ...props
17
26
  }: QListProps = $props();
27
+ // #endregion: --- Props
18
28
 
19
- setContext(QListCtxName.activeClass, () => activeClass);
20
- setContext(QListCtxName.separator, separator ? separatorOptions : undefined);
21
-
29
+ // #region: --- Non-reactive variables
22
30
  let listEl: HTMLElement;
31
+ // #endregion: --- Non-reactive variables
32
+
33
+ // #region: --- Context
34
+ listCtx.set({
35
+ get activeClass() {
36
+ return activeClass;
37
+ },
38
+ get separatorOptions() {
39
+ return separator ? separatorOptions : undefined;
40
+ },
41
+ });
42
+ // #endregion: --- Context
23
43
 
44
+ // #region: --- Effects
24
45
  $effect(() => {
25
46
  listEl.querySelector(".q-separator__wrapper:first-child")?.remove();
26
47
  });
48
+ // #endregion: --- Effects
27
49
  </script>
28
50
 
29
51
  <svelte:element
@@ -1,4 +1,19 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
+ import type { QListProps } from "./props";
3
+ interface QListContext {
4
+ readonly activeClass: string | undefined;
5
+ readonly separatorOptions: QListProps["separatorOptions"];
6
+ }
7
+ export declare const listCtx: {
8
+ readonly symbol: symbol;
9
+ get(): QListContext | undefined;
10
+ assertGet(errorMsg?: string): QListContext;
11
+ set(context: QListContext): void;
12
+ reset(): void;
13
+ exists(): boolean;
14
+ updateEntry(key: keyof QListContext, value: string | Omit<import("../separator/props").QSeparatorHorizontalProps, "vertical"> | undefined): void;
15
+ updateEntries(updates: Partial<QListContext>): void;
16
+ };
2
17
  declare const __propDef: {
3
18
  props: Record<string, never>;
4
19
  events: {
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
- import { QContext } from "../../classes/QContext.svelte";
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) => QContext.reset(key));
13
+ keysArr.forEach((key) => setContext(key, undefined));
15
14
  </script>
16
15
 
17
16
  {@render children?.()}
@@ -21,12 +21,26 @@
21
21
  } from "../../utils";
22
22
  import type { ParsedProp, ParsedSnippet } from "../../../../docgen/props/parseInterface";
23
23
 
24
+ // #region: --- Props
24
25
  let { componentDocs }: { componentDocs: QComponentDocs[] } = $props();
26
+ // #endregion: --- Props
25
27
 
28
+ // #region: --- Reactive variables
26
29
  let api: (keyof QComponentDocs["docs"])[] = $state(
27
30
  componentDocs.map(() => "props"),
28
31
  );
32
+ // #endregion: --- Reactive variables
29
33
 
34
+ // #region: --- Effects
35
+ $effect(() => {
36
+ // Doesn't rerun if we don't use JSON.stringify
37
+ JSON.stringify(api);
38
+
39
+ attachTooltips();
40
+ });
41
+ // #endregion: --- Effects
42
+
43
+ // #region: --- Functions
30
44
  function getType(type: string) {
31
45
  type = type.replace("[]", "");
32
46
  let found = type in Types ? Types[type as keyof typeof Types] : undefined;
@@ -195,13 +209,7 @@
195
209
  });
196
210
  });
197
211
  }
198
-
199
- $effect(() => {
200
- // Doesn't rerun if we don't use JSON.stringify
201
- JSON.stringify(api);
202
-
203
- attachTooltips();
204
- });
212
+ // #endregion: --- Functions
205
213
  </script>
206
214
 
207
215
  {#each componentDocs as QDocument, index (index)}
@@ -1,9 +1,29 @@
1
+ <script lang="ts" module>
2
+ import { QContext } from "../../utils";
3
+
4
+ interface Props {
5
+ children?: Snippet;
6
+ display?: Snippet;
7
+ pre?: Snippet;
8
+ usage?: Snippet;
9
+ snippets?: Record<string, string>;
10
+ componentDocs?: QComponentDocs | QComponentDocs[];
11
+ docName?: string;
12
+ docDescription?: string;
13
+ }
14
+
15
+ export const docsCtx = QContext<{ readonly snippets: Props["snippets"] }>(
16
+ "QDocs",
17
+ );
18
+ </script>
19
+
1
20
  <script lang="ts">
2
- import { setContext, type Snippet } from "svelte";
3
21
  import { QCard, QCardSection, QTheme, Quaff } from "../..";
4
- import { QColors, QDocsCtxName, type QComponentDocs } from "../../utils";
22
+ import { QColors, type QComponentDocs } from "../../utils";
5
23
  import QApi from "./QApi.svelte";
24
+ import type { Snippet } from "svelte";
6
25
 
26
+ // #region: --- Props
7
27
  let {
8
28
  children,
9
29
  display,
@@ -13,17 +33,16 @@
13
33
  componentDocs,
14
34
  docName,
15
35
  docDescription,
16
- }: {
17
- children?: Snippet;
18
- display?: Snippet;
19
- pre?: Snippet;
20
- usage?: Snippet;
21
- snippets?: Record<string, string>;
22
- componentDocs?: QComponentDocs | QComponentDocs[];
23
- docName?: string;
24
- docDescription?: string;
25
- } = $props();
36
+ }: Props = $props();
37
+ // #endregion: --- Props
38
+
39
+ // #region: --- Non-reactive variables
40
+ let principalDocument = Array.isArray(componentDocs)
41
+ ? componentDocs[0]
42
+ : componentDocs;
43
+ // #endregion: --- Non-reactive variables
26
44
 
45
+ // #region: --- Derived values
27
46
  const isDark = $derived(Quaff.darkMode.isActive);
28
47
 
29
48
  const hueRotate = $derived(
@@ -33,15 +52,16 @@
33
52
  ),
34
53
  );
35
54
 
36
- if (snippets) {
37
- setContext(QDocsCtxName.snippets, () => snippets);
38
- }
39
-
40
- let principalDocument = Array.isArray(componentDocs)
41
- ? componentDocs[0]
42
- : componentDocs;
43
-
44
55
  const brightness = $derived(Quaff.darkMode.isActive ? 0.7 : 1.2);
56
+ // #endregion: --- Derived values
57
+
58
+ // #region: --- Context
59
+ docsCtx.set({
60
+ get snippets() {
61
+ return snippets;
62
+ },
63
+ });
64
+ // #endregion: --- Context
45
65
  </script>
46
66
 
47
67
  <div
@@ -1,4 +1,34 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
+ interface Props {
3
+ children?: Snippet;
4
+ display?: Snippet;
5
+ pre?: Snippet;
6
+ usage?: Snippet;
7
+ snippets?: Record<string, string>;
8
+ componentDocs?: QComponentDocs | QComponentDocs[];
9
+ docName?: string;
10
+ docDescription?: string;
11
+ }
12
+ export declare const docsCtx: {
13
+ readonly symbol: symbol;
14
+ get(): {
15
+ readonly snippets: Props["snippets"];
16
+ } | undefined;
17
+ assertGet(errorMsg?: string): {
18
+ readonly snippets: Props["snippets"];
19
+ };
20
+ set(context: {
21
+ readonly snippets: Props["snippets"];
22
+ }): void;
23
+ reset(): void;
24
+ exists(): boolean;
25
+ updateEntry(key: "snippets", value: Record<string, string> | undefined): void;
26
+ updateEntries(updates: Partial<{
27
+ readonly snippets: Props["snippets"];
28
+ }>): void;
29
+ };
30
+ import { type QComponentDocs } from "../../utils";
31
+ import type { Snippet } from "svelte";
2
32
  declare const __propDef: {
3
33
  props: Record<string, never>;
4
34
  events: {
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
- import { getContext, type Snippet } from "svelte";
3
2
  import { QBtn, QCodeBlock, QDialog } from "../..";
4
- import { QDocsCtxName } from "../../utils";
3
+ import { docsCtx } from "./QDocs.svelte";
4
+ import type { Snippet } from "svelte";
5
5
 
6
6
  type QDocsSectionProps = {
7
7
  title: string;
@@ -10,23 +10,27 @@
10
10
  noCode?: boolean;
11
11
  };
12
12
 
13
+ // #region: --- Props
13
14
  let {
14
15
  title,
15
16
  noCode = false,
16
17
  sectionDescription,
17
18
  children,
18
19
  }: QDocsSectionProps = $props();
20
+ // #endregion: --- Props
19
21
 
20
- const snippets = getContext<undefined | (() => Record<string, string>)>(
21
- QDocsCtxName.snippets,
22
- );
22
+ // #region: --- Reactive variables
23
+ let dialog = $state(false);
23
24
 
24
- const code = $derived(snippets && snippets()[title]);
25
+ const ctx = docsCtx.get();
26
+ // #endregion: --- Reactive variables
25
27
 
26
- let dialog = $state(false);
28
+ // #region: --- Derived values
29
+ const code = $derived(ctx?.snippets?.[title]);
27
30
 
28
31
  // Create a kebab-case id from the title to be able to link to this section
29
32
  const id = $derived(title.toLowerCase().replaceAll(" ", "-"));
33
+ // #endregion: --- Derived values
30
34
  </script>
31
35
 
32
36
  <div {id} style="margin-bottom:48px">
@@ -10,11 +10,7 @@
10
10
  rounded?: boolean;
11
11
  };
12
12
 
13
- const radius = 50,
14
- diameter = 2 * radius,
15
- circumference = diameter * Math.PI,
16
- strokeDashArray = Math.round(circumference * 1000) / 1000;
17
-
13
+ // #region: --- Props
18
14
  let {
19
15
  value = $bindable(0),
20
16
  indeterminate = false,
@@ -33,7 +29,19 @@
33
29
  children = fallback,
34
30
  ...props
35
31
  }: QCircularProgressProps = $props();
32
+ // #endregion: --- Props
33
+
34
+ // #region: --- Non-reactive variables
35
+ const radius = 50;
36
+
37
+ const diameter = 2 * radius;
38
+
39
+ const circumference = diameter * Math.PI;
40
+
41
+ const strokeDashArray = Math.round(circumference * 1000) / 1000;
42
+ // #endregion: --- Non-reactive variables
36
43
 
44
+ // #region: --- Derived values
37
45
  const qSize = $derived(useSize(size, "q-circular-progress"));
38
46
 
39
47
  const parsedColor = $derived(
@@ -70,6 +78,7 @@
70
78
 
71
79
  return circumference * dashRatio + dashGap;
72
80
  });
81
+ // #endregion: --- Derived values
73
82
  </script>
74
83
 
75
84
  <div
@@ -2,12 +2,7 @@
2
2
  import { useSize } from "../../composables";
3
3
  import type { QLinearProgressProps } from "./props";
4
4
 
5
- function width(val: number, reverse: boolean) {
6
- return reverse
7
- ? `translateX(100%) scale3d(-${val}, 1, 1)`
8
- : `scale3d(${val}, 1, 1)`;
9
- }
10
-
5
+ // #region: --- Props
11
6
  let {
12
7
  value = $bindable(0),
13
8
  buffer,
@@ -21,7 +16,9 @@
21
16
  indeterminate = false,
22
17
  ...props
23
18
  }: QLinearProgressProps = $props();
19
+ // #endregion: --- Props
24
20
 
21
+ // #region: --- Derived values
25
22
  const normalized = $derived(value > 1 ? value / 100 : value);
26
23
  const normalizedBuffer = $derived(
27
24
  buffer && buffer > 1 ? buffer / 100 : buffer,
@@ -49,6 +46,15 @@
49
46
  const indicatorTransform = $derived(
50
47
  width(+indeterminate || normalized, reverse),
51
48
  );
49
+ // #endregion: --- Derived values
50
+
51
+ // #region: --- Functions
52
+ function width(val: number, reverse: boolean) {
53
+ return reverse
54
+ ? `translateX(100%) scale3d(-${val}, 1, 1)`
55
+ : `scale3d(${val}, 1, 1)`;
56
+ }
57
+ // #endregion: --- Functions
52
58
  </script>
53
59
 
54
60
  <div
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { QRadioProps } from "./props";
3
3
 
4
+ // #region: --- Props
4
5
  let {
5
6
  value = "",
6
7
  label = "",
@@ -8,6 +9,7 @@
8
9
  disable = false,
9
10
  ...props
10
11
  }: QRadioProps = $props();
12
+ // #endregion: --- Props
11
13
  </script>
12
14
 
13
15
  <label
@@ -1,11 +1,9 @@
1
1
  <script lang="ts">
2
- import { getContext, onDestroy, onMount, untrack } from "svelte";
3
- import { QContext } from "../../classes/QContext.svelte";
4
- import { QLayoutCtxName } from "../../utils";
5
- import type { QLayoutProps } from "../layout/props";
6
- import type { DrawerContext } from "../layout/QLayout.svelte";
2
+ import { onMount } from "svelte";
3
+ import { leftRailbarCtx, rightRailbarCtx } from "../layout/QLayout.svelte";
7
4
  import type { QRailbarProps } from "./props";
8
5
 
6
+ // #region: --- Props
9
7
  let {
10
8
  width = 88,
11
9
  side = "left",
@@ -13,50 +11,53 @@
13
11
  children,
14
12
  ...props
15
13
  }: QRailbarProps = $props();
14
+ // #endregion: --- Props
16
15
 
17
- const railbarCtx = QContext.get<DrawerContext>(QLayoutCtxName.railbar[side]);
18
- const layoutView = getContext<{ value: NonNullable<QLayoutProps["view"]> }>(
19
- QLayoutCtxName.view,
20
- );
21
-
16
+ // #region: --- Non-reactive variables
22
17
  let railbarEl: HTMLElement;
18
+ // #endregion: --- Non-reactive variables
23
19
 
24
- onMount(() => {
25
- if (railbarCtx) {
26
- setTimeout(() => {
27
- railbarEl.style.transition = "top 0.3s, bottom 0.3s, transform 0.3s";
28
- }, 100);
29
- }
30
- });
31
-
32
- onDestroy(() => {
33
- untrack(() => railbarCtx)?.updateEntries({
34
- width: 0,
35
- takesSpace: false,
36
- ready: false,
37
- });
38
- });
39
-
40
- $effect.pre(() => {
41
- untrack(() => railbarCtx)?.updateEntries({
42
- width,
43
- takesSpace: railbarEl?.style.display !== "none" || false,
44
- ready: true,
45
- });
46
- });
20
+ // #region: --- Derived values
21
+ const railbarCtxToUse = $derived(
22
+ side === "left" ? leftRailbarCtx : rightRailbarCtx,
23
+ );
24
+ const railbarCtx = $derived(railbarCtxToUse.get());
47
25
 
48
26
  const offsetTop = $derived.by(() => {
49
27
  const charPos = side === "left" ? 0 : 2;
50
- return layoutView?.value.charAt(charPos) === "h";
28
+ return railbarCtx?.view.charAt(charPos) === "h";
51
29
  });
52
30
  const offsetBottom = $derived.by(() => {
53
31
  const charPos = side === "left" ? 8 : 10;
54
- return layoutView?.value.charAt(charPos) === "f";
32
+ return railbarCtx?.view.charAt(charPos) === "f";
55
33
  });
56
34
 
57
35
  const railbarWidthStyle = $derived(`--${side}-railbar-width: ${width}px`);
58
36
 
59
37
  const style = $derived(`${railbarWidthStyle};${props.style ?? ""}`);
38
+ // #endregion: --- Derived values
39
+
40
+ // #region: --- Lifecycle
41
+ onMount(() => {
42
+ railbarCtxToUse.updateEntries({
43
+ width,
44
+ takesSpace: railbarEl.style.display !== "none" || false,
45
+ ready: true,
46
+ });
47
+
48
+ setTimeout(() => {
49
+ railbarEl.style.transition = "top 0.3s, bottom 0.3s, transform 0.3s";
50
+ }, 100);
51
+
52
+ return () => {
53
+ railbarCtxToUse.updateEntries({
54
+ width: 0,
55
+ takesSpace: false,
56
+ ready: false,
57
+ });
58
+ };
59
+ });
60
+ // #endregion: --- Lifecycle
60
61
  </script>
61
62
 
62
63
  <nav
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { onDestroy, onMount } from "svelte";
2
+ import { onMount } from "svelte";
3
3
  import { browser } from "$app/environment";
4
4
  import { QIcon } from "../..";
5
5
  import type { QEvent } from "../../utils";
@@ -7,6 +7,7 @@
7
7
 
8
8
  type QSelectEvent<T> = QEvent<T, HTMLDivElement>;
9
9
 
10
+ // #region: --- Props
10
11
  let {
11
12
  options,
12
13
  multiple = false,
@@ -28,9 +29,19 @@
28
29
  value = $bindable(),
29
30
  ...props
30
31
  }: QSelectProps = $props();
32
+ // #endregion: --- Props
31
33
 
34
+ // #region: --- Reactive variables
32
35
  let focus = $state(false);
33
36
 
37
+ let wrapper: HTMLDivElement | null = $state(null);
38
+ let isMenuOpen = $state(false);
39
+ let wasClicked = $state(false);
40
+ let preventClose = $state(false);
41
+ let snippetPrependWidth = $state(0);
42
+ // #endregion: --- Reactive variables
43
+
44
+ // #region: --- Derived values
34
45
  const currentDisplayValue = $derived.by(() => {
35
46
  if (displayValue !== undefined) {
36
47
  return displayValue;
@@ -47,11 +58,26 @@
47
58
 
48
59
  const active = $derived(currentDisplayValue || focus);
49
60
 
50
- let wrapper: HTMLDivElement | null = $state(null);
51
- let isMenuOpen = $state(false);
52
- let wasClicked = $state(false);
53
- let preventClose = $state(false);
61
+ const selectedOptions: boolean[] = $derived(
62
+ options.map((option) => isSelected(option), value),
63
+ );
64
+ // #endregion: --- Derived values
54
65
 
66
+ // #region: --- Lifecycle
67
+ onMount(() => {
68
+ if (browser) {
69
+ window.document.addEventListener("click", handleClickOutside);
70
+ }
71
+
72
+ return () => {
73
+ if (browser) {
74
+ document.removeEventListener("click", handleClickOutside);
75
+ }
76
+ };
77
+ });
78
+ // #endregion: --- Lifecycle
79
+
80
+ // #region: --- Functions
55
81
  function handleMousedown(e: QSelectEvent<MouseEvent>) {
56
82
  isMenuOpen = !isMenuOpen;
57
83
  wasClicked = true;
@@ -78,12 +104,6 @@
78
104
  props.onblur?.(e);
79
105
  }
80
106
 
81
- const selectedOptions: boolean[] = $derived(
82
- options.map((option) => isSelected(option), value),
83
- );
84
-
85
- let snippetPrependWidth = $state(0);
86
-
87
107
  function compareValues<T extends QSelectOption>(a: T, b: T) {
88
108
  return getOptionValue(a) === getOptionValue(b);
89
109
  }
@@ -139,18 +159,7 @@
139
159
  isMenuOpen = false;
140
160
  }
141
161
  }
142
-
143
- onMount(() => {
144
- if (browser) {
145
- window.document.addEventListener("click", handleClickOutside);
146
- }
147
- });
148
-
149
- onDestroy(() => {
150
- if (browser) {
151
- document.removeEventListener("click", handleClickOutside);
152
- }
153
- });
162
+ // #endregion: --- Functions
154
163
 
155
164
  // q-field here, q-select in classes
156
165
  </script>
@@ -2,6 +2,7 @@
2
2
  import { useSize } from "../../composables";
3
3
  import type { QSeparatorProps } from "./props";
4
4
 
5
+ // #region: --- Props
5
6
  let {
6
7
  spacing = "none",
7
8
  inset = false,
@@ -12,9 +13,12 @@
12
13
  textAlign = vertical ? "middle" : "center",
13
14
  ...props
14
15
  }: QSeparatorProps = $props();
16
+ // #endregion: --- Props
15
17
 
18
+ // #region: --- Derived values
16
19
  const orientation = $derived(vertical ? "vertical" : "horizontal");
17
20
  const qSize = $derived(useSize(spacing, "q-separator__spacing"));
21
+ // #endregion: --- Derived values
18
22
  </script>
19
23
 
20
24
  <div
@@ -6,6 +6,7 @@
6
6
 
7
7
  type QSwitchEvent<T> = QEvent<T, HTMLDivElement>;
8
8
 
9
+ // #region: --- Props
9
10
  let {
10
11
  value = $bindable(),
11
12
  label = undefined,
@@ -17,10 +18,14 @@
17
18
  uncheckedIcon,
18
19
  ...props
19
20
  }: QSwitchProps = $props();
21
+ // #endregion: --- Props
20
22
 
23
+ // #region: --- Non-reactive variables
21
24
  let qSwitch: HTMLDivElement;
22
25
  let qSwitchInput: HTMLInputElement;
26
+ // #endregion: --- Non-reactive variables
23
27
 
28
+ // #region: --- Functions
24
29
  function toggle() {
25
30
  value = !value;
26
31
 
@@ -53,6 +58,7 @@
53
58
  event.preventDefault();
54
59
  qSwitch.click();
55
60
  }
61
+ // #endregion: --- Functions
56
62
  </script>
57
63
 
58
64
  <div