@lavalogic/scoria 0.23.1 → 0.24.0

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.
@@ -4,6 +4,8 @@
4
4
  lang="ts"
5
5
  generics="CommonDenominator"
6
6
  >
7
+ import { dev } from '$app/environment';
8
+
7
9
  import HorizontalTabGroupButton from './HorizontalTabGroupButton.svelte';
8
10
  import type { HorizontalTabGroupProps } from './HorizontalTabGroupProps.js';
9
11
  let {
@@ -14,6 +16,27 @@
14
16
  noRadius = false,
15
17
  grow = false,
16
18
  }: HorizontalTabGroupProps<CommonDenominator> = $props();
19
+
20
+ $effect(() => {
21
+ if (!dev) {
22
+ return;
23
+ }
24
+ for (const tab of tabs) {
25
+ if (tab.debug) {
26
+ $inspect(
27
+ tab.label,
28
+ tab.content,
29
+ tab.onclick,
30
+ tab.args,
31
+ tab.iconLeft,
32
+ tab.iconRight,
33
+ tab.isValid,
34
+ tab.disabled,
35
+ tab.visible
36
+ );
37
+ }
38
+ }
39
+ });
17
40
  </script>
18
41
 
19
42
  <div
@@ -1,12 +1,19 @@
1
1
  <svelte:options runes />
2
2
 
3
- <script lang="ts" module>
3
+ <script
4
+ lang="ts"
5
+ module
6
+ >
7
+ import { dev } from '$app/environment';
4
8
  import { onMount, untrack } from 'svelte';
5
9
  import VerticalTabGroupButton from './VerticalTabGroupButton.svelte';
6
10
  import type { VerticalTabGroupProps } from './VerticalTabGroupProps.js';
7
11
  </script>
8
12
 
9
- <script lang="ts" generics="CommonDenominator">
13
+ <script
14
+ lang="ts"
15
+ generics="CommonDenominator"
16
+ >
10
17
  let {
11
18
  name,
12
19
  tabs,
@@ -14,9 +21,30 @@
14
21
  style,
15
22
  noscroll,
16
23
  noTabMessage,
17
- nohistory = false
24
+ nohistory = false,
18
25
  }: VerticalTabGroupProps<CommonDenominator> = $props();
19
26
 
27
+ $effect(() => {
28
+ if (!dev) {
29
+ return;
30
+ }
31
+ for (const tab of tabs) {
32
+ if (tab.debug) {
33
+ $inspect(
34
+ tab.label,
35
+ tab.content,
36
+ tab.onclick,
37
+ tab.args,
38
+ tab.iconLeft,
39
+ tab.iconRight,
40
+ tab.isValid,
41
+ tab.disabled,
42
+ tab.visible
43
+ );
44
+ }
45
+ }
46
+ });
47
+
20
48
  onMount(() => {
21
49
  if (name && !nohistory) {
22
50
  const tabName = sessionStorage.getItem(`${name}-active-tab`);
@@ -35,14 +63,24 @@
35
63
  });
36
64
  </script>
37
65
 
38
- <div class="wrapper" class:noscroll {style}>
66
+ <div
67
+ class="wrapper"
68
+ class:noscroll
69
+ {style}
70
+ >
39
71
  <div class="tabs">
40
72
  {#each tabs as option (option)}
41
- <VerticalTabGroupButton {option} selected={selected?.label === option.label} />
73
+ <VerticalTabGroupButton
74
+ {option}
75
+ selected={selected?.label === option.label}
76
+ />
42
77
  {/each}
43
78
  </div>
44
79
 
45
- <div class="content" class:noscroll>
80
+ <div
81
+ class="content"
82
+ class:noscroll
83
+ >
46
84
  {#if selected}
47
85
  {@render selected.content(selected.args)}
48
86
  {:else}
@@ -5,6 +5,7 @@ export interface TabOption<Args> {
5
5
  content: Snippet<[Args]>;
6
6
  onclick: () => void;
7
7
  args: Args;
8
+ debug?: boolean;
8
9
  iconLeft?: IconProps;
9
10
  iconRight?: IconProps;
10
11
  isValid?: boolean | Promise<boolean>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lavalogic/scoria",
3
3
  "description": "Svelte components used for the FloWMS Web Frontend",
4
- "version": "0.23.1",
4
+ "version": "0.24.0",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },