@lavalogic/scoria 0.23.0 → 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,16 +4,39 @@
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 {
10
12
  // name: _name, //FIXME why is this not implemented?
11
13
  tabComponent,
12
- options,
14
+ tabs,
13
15
  selected,
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
@@ -23,11 +46,11 @@
23
46
  >
24
47
  <div class="tabs">
25
48
  {#if tabComponent}
26
- {#each options as option (option)}
49
+ {#each tabs as option (option)}
27
50
  {@render tabComponent(option, selected === option)}
28
51
  {/each}
29
52
  {:else}
30
- {#each options as option (option)}
53
+ {#each tabs as option (option)}
31
54
  <HorizontalTabGroupButton
32
55
  {option}
33
56
  selected={selected === option}
@@ -47,7 +47,7 @@
47
47
  if (typeof option.visible === 'boolean') {
48
48
  visible = option.visible;
49
49
  } else if (option.visible == undefined) {
50
- visible = false;
50
+ visible = true;
51
51
  } else {
52
52
  option.visible
53
53
  .then((v) => {
@@ -5,6 +5,6 @@ export interface HorizontalTabGroupProps<CommonDenominator> {
5
5
  tabComponent?: Snippet<[TabOption<CommonDenominator>, boolean]>;
6
6
  noRadius?: boolean;
7
7
  grow?: boolean;
8
- options: Array<TabOption<CommonDenominator>>;
8
+ tabs: Array<TabOption<CommonDenominator>>;
9
9
  selected: TabOption<CommonDenominator> | undefined;
10
10
  }
@@ -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}
@@ -45,7 +45,7 @@
45
45
  if (typeof option.visible === 'boolean') {
46
46
  visible = option.visible;
47
47
  } else if (option.visible == undefined) {
48
- visible = false;
48
+ visible = true;
49
49
  } else {
50
50
  option.visible
51
51
  .then((v) => {
@@ -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.0",
4
+ "version": "0.24.0",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },