@lobb-js/studio 0.33.0 → 0.35.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.
Files changed (119) hide show
  1. package/dist/applyUITheme.d.ts +2 -0
  2. package/dist/{applyStudioTheme.js → applyUITheme.js} +4 -4
  3. package/dist/components/LlmButton.svelte +4 -2
  4. package/dist/components/LlmButton.svelte.d.ts +1 -0
  5. package/dist/components/Studio.svelte +15 -7
  6. package/dist/components/codeEditor.svelte +1 -1
  7. package/dist/components/createManyButton.svelte +2 -2
  8. package/dist/components/dataTable/dataTable.svelte +1 -1
  9. package/dist/components/dataTable/dataTableTabs.svelte +1 -1
  10. package/dist/components/dataTable/filter.svelte +3 -2
  11. package/dist/components/dataTable/filterButton.svelte +1 -1
  12. package/dist/components/dataTable/footer.svelte +1 -1
  13. package/dist/components/dataTable/header.svelte +14 -21
  14. package/dist/components/dataTable/listViewChildren.svelte +1 -1
  15. package/dist/components/dataTable/sort.svelte +1 -1
  16. package/dist/components/dataTable/sortButton.svelte +1 -1
  17. package/dist/components/dataTable/table.svelte +8 -8
  18. package/dist/components/dataTable/utils.js +2 -1
  19. package/dist/components/dataTablePopup/dataTablePopup.svelte +1 -1
  20. package/dist/components/detailView/create/children.svelte +1 -1
  21. package/dist/components/detailView/create/createDetailView.svelte +2 -2
  22. package/dist/components/detailView/create/createDetailViewButton.svelte +2 -0
  23. package/dist/components/detailView/create/createDetailViewButton.svelte.d.ts +1 -0
  24. package/dist/components/detailView/create/createDetailViewChildren.svelte +4 -4
  25. package/dist/components/detailView/create/createManyView.svelte +4 -4
  26. package/dist/components/detailView/detailView.svelte +2 -1
  27. package/dist/components/detailView/fieldInput.svelte +10 -10
  28. package/dist/components/detailView/fieldInputReplacement.svelte +7 -7
  29. package/dist/components/detailView/passwordInput.svelte +1 -1
  30. package/dist/components/detailView/update/updateDetailView.svelte +2 -2
  31. package/dist/components/detailView/update/updateDetailViewButton.svelte +2 -0
  32. package/dist/components/detailView/update/updateDetailViewButton.svelte.d.ts +1 -0
  33. package/dist/components/detailView/update/updateDetailViewChildren.svelte +4 -4
  34. package/dist/components/diffViewer.svelte +1 -1
  35. package/dist/components/drawer.svelte +2 -2
  36. package/dist/components/foreingKeyInput.svelte +2 -2
  37. package/dist/components/horizontalNav.svelte +85 -0
  38. package/dist/components/horizontalNav.svelte.d.ts +3 -0
  39. package/dist/components/importButton.svelte +7 -7
  40. package/dist/components/mainNav.svelte +15 -0
  41. package/dist/components/mainNav.svelte.d.ts +6 -0
  42. package/dist/components/mainNavShared.d.ts +10 -0
  43. package/dist/components/mainNavShared.js +62 -0
  44. package/dist/components/polymorphicInput.svelte +1 -1
  45. package/dist/components/rangeCalendarButton.svelte +11 -12
  46. package/dist/components/richTextEditor.svelte +1 -1
  47. package/dist/components/routes/extensions/publicExtension.svelte +1 -1
  48. package/dist/components/routes/home.svelte +1 -1
  49. package/dist/components/routes/workflows/workflows.svelte +1 -1
  50. package/dist/components/setServerPage.svelte +1 -1
  51. package/dist/components/sidebar/sidebar.svelte +3 -3
  52. package/dist/components/sidebar/sidebarElements.svelte +4 -4
  53. package/dist/components/singletone.svelte +2 -2
  54. package/dist/components/ui/skeleton/skeleton.svelte +1 -1
  55. package/dist/components/ui/tooltip/tooltip-content.svelte +1 -1
  56. package/dist/components/verticalNav.svelte +174 -0
  57. package/dist/components/verticalNav.svelte.d.ts +3 -0
  58. package/dist/components/workflowEditor.svelte +2 -2
  59. package/dist/store.types.d.ts +4 -3
  60. package/dist/utils.d.ts +1 -0
  61. package/dist/utils.js +12 -0
  62. package/package.json +2 -2
  63. package/src/app.css +50 -76
  64. package/src/lib/{applyStudioTheme.ts → applyUITheme.ts} +5 -5
  65. package/src/lib/components/LlmButton.svelte +4 -2
  66. package/src/lib/components/Studio.svelte +15 -7
  67. package/src/lib/components/codeEditor.svelte +1 -1
  68. package/src/lib/components/createManyButton.svelte +2 -2
  69. package/src/lib/components/dataTable/dataTable.svelte +1 -1
  70. package/src/lib/components/dataTable/dataTableTabs.svelte +1 -1
  71. package/src/lib/components/dataTable/filter.svelte +3 -2
  72. package/src/lib/components/dataTable/filterButton.svelte +1 -1
  73. package/src/lib/components/dataTable/footer.svelte +1 -1
  74. package/src/lib/components/dataTable/header.svelte +14 -21
  75. package/src/lib/components/dataTable/listViewChildren.svelte +1 -1
  76. package/src/lib/components/dataTable/sort.svelte +1 -1
  77. package/src/lib/components/dataTable/sortButton.svelte +1 -1
  78. package/src/lib/components/dataTable/table.svelte +8 -8
  79. package/src/lib/components/dataTable/utils.ts +2 -1
  80. package/src/lib/components/dataTablePopup/dataTablePopup.svelte +1 -1
  81. package/src/lib/components/detailView/create/children.svelte +1 -1
  82. package/src/lib/components/detailView/create/createDetailView.svelte +2 -2
  83. package/src/lib/components/detailView/create/createDetailViewButton.svelte +2 -0
  84. package/src/lib/components/detailView/create/createDetailViewChildren.svelte +4 -4
  85. package/src/lib/components/detailView/create/createManyView.svelte +4 -4
  86. package/src/lib/components/detailView/detailView.svelte +2 -1
  87. package/src/lib/components/detailView/fieldInput.svelte +10 -10
  88. package/src/lib/components/detailView/fieldInputReplacement.svelte +7 -7
  89. package/src/lib/components/detailView/passwordInput.svelte +1 -1
  90. package/src/lib/components/detailView/update/updateDetailView.svelte +2 -2
  91. package/src/lib/components/detailView/update/updateDetailViewButton.svelte +2 -0
  92. package/src/lib/components/detailView/update/updateDetailViewChildren.svelte +4 -4
  93. package/src/lib/components/diffViewer.svelte +1 -1
  94. package/src/lib/components/drawer.svelte +2 -2
  95. package/src/lib/components/foreingKeyInput.svelte +2 -2
  96. package/src/lib/components/horizontalNav.svelte +85 -0
  97. package/src/lib/components/importButton.svelte +7 -7
  98. package/src/lib/components/mainNav.svelte +15 -0
  99. package/src/lib/components/mainNavShared.ts +67 -0
  100. package/src/lib/components/polymorphicInput.svelte +1 -1
  101. package/src/lib/components/rangeCalendarButton.svelte +11 -12
  102. package/src/lib/components/richTextEditor.svelte +1 -1
  103. package/src/lib/components/routes/extensions/publicExtension.svelte +1 -1
  104. package/src/lib/components/routes/home.svelte +1 -1
  105. package/src/lib/components/routes/workflows/workflows.svelte +1 -1
  106. package/src/lib/components/setServerPage.svelte +1 -1
  107. package/src/lib/components/sidebar/sidebar.svelte +3 -3
  108. package/src/lib/components/sidebar/sidebarElements.svelte +4 -4
  109. package/src/lib/components/singletone.svelte +2 -2
  110. package/src/lib/components/ui/skeleton/skeleton.svelte +1 -1
  111. package/src/lib/components/ui/tooltip/tooltip-content.svelte +1 -1
  112. package/src/lib/components/verticalNav.svelte +174 -0
  113. package/src/lib/components/workflowEditor.svelte +2 -2
  114. package/src/lib/store.types.ts +2 -2
  115. package/src/lib/utils.ts +12 -0
  116. package/dist/applyStudioTheme.d.ts +0 -2
  117. package/dist/components/miniSidebar.svelte +0 -300
  118. package/dist/components/miniSidebar.svelte.d.ts +0 -5
  119. package/src/lib/components/miniSidebar.svelte +0 -300
@@ -49,7 +49,7 @@
49
49
  placeholder={field.placeholder ? field.placeholder : "NULL"}
50
50
  type="text"
51
51
  class="
52
- bg-muted-soft text-xs
52
+ bg-muted text-xs
53
53
  {destructive ? 'border-destructive bg-destructive/10' : ''}
54
54
  "
55
55
  bind:value
@@ -64,7 +64,7 @@
64
64
  <Select.Trigger
65
65
  placeholder={field.placeholder ? field.placeholder : "NULL"}
66
66
  class="
67
- h-9 w-full bg-muted-soft pr-8
67
+ h-9 w-full bg-muted pr-8
68
68
  {destructive ? 'border-destructive bg-destructive/10' : ''}
69
69
  "
70
70
  >
@@ -84,7 +84,7 @@
84
84
  placeholder={field.placeholder ? field.placeholder : value === "" ? "EMPTY STRING" : "NULL"}
85
85
  rows={5}
86
86
  class="
87
- bg-muted-soft text-xs
87
+ bg-muted text-xs
88
88
  {destructive ? 'border-destructive bg-destructive/10' : ''}
89
89
  "
90
90
  bind:value
@@ -98,7 +98,7 @@
98
98
  <Input
99
99
  type="date"
100
100
  class="
101
- dateInput block w-full bg-muted-soft pr-9 text-xs
101
+ dateInput block w-full bg-muted pr-9 text-xs
102
102
  {destructive ? 'border-destructive bg-destructive/10' : ''}
103
103
  "
104
104
  bind:value={
@@ -116,7 +116,7 @@
116
116
  <Input
117
117
  type="time"
118
118
  class="
119
- dateInput block w-full bg-muted-soft pr-9 text-xs
119
+ dateInput block w-full bg-muted pr-9 text-xs
120
120
  {destructive ? 'border-destructive bg-destructive/10' : ''}
121
121
  "
122
122
  bind:value={
@@ -133,7 +133,7 @@
133
133
  <Input
134
134
  type="datetime-local"
135
135
  class="
136
- dateInput block w-full bg-muted-soft pr-9 text-xs
136
+ dateInput block w-full bg-muted pr-9 text-xs
137
137
  {destructive ? 'border-destructive bg-destructive/10' : ''}
138
138
  "
139
139
  bind:value={
@@ -154,7 +154,7 @@
154
154
  <Select.Root type="single" bind:value>
155
155
  <Select.Trigger
156
156
  class="
157
- bg-muted-soft pr-9
157
+ bg-muted pr-9
158
158
  {destructive ? 'border-destructive bg-destructive/10' : ''}
159
159
  "
160
160
  >
@@ -21,7 +21,7 @@
21
21
  <Input
22
22
  type="password"
23
23
  placeholder="••••••"
24
- class="bg-muted-soft text-xs {destructive ? 'border-destructive bg-destructive/10' : ''}"
24
+ class="bg-muted text-xs {destructive ? 'border-destructive bg-destructive/10' : ''}"
25
25
  value={displayValue}
26
26
  oninput={onInput}
27
27
  />
@@ -180,14 +180,14 @@
180
180
  <Button
181
181
  variant="outline"
182
182
  onclick={handleCancel}
183
- class="h-7 px-3 text-xs font-normal"
183
+ size="sm"
184
184
  Icon={X}
185
185
  >
186
186
  Cancel
187
187
  </Button>
188
188
  <Button
189
189
  variant="default"
190
- class="h-7 px-3 text-xs font-normal"
190
+ size="sm"
191
191
  Icon={submitButton?.icon ? submitButton.icon : Pencil}
192
192
  onclick={handleSave}
193
193
  disabled={!hasChanges}
@@ -7,6 +7,7 @@
7
7
 
8
8
  interface LocalProp extends UpdateDetailViewProp {
9
9
  variant?: ButtonProps["variant"];
10
+ size?: ButtonProps["size"];
10
11
  class?: ButtonProps["class"];
11
12
  Icon?: ButtonProps["Icon"];
12
13
  children?: ButtonProps["children"];
@@ -33,6 +34,7 @@
33
34
 
34
35
  <Button
35
36
  variant={props.variant}
37
+ size={props.size}
36
38
  class={props.class}
37
39
  Icon={props.Icon}
38
40
  onclick={openView}
@@ -2,6 +2,7 @@ import type { UpdateDetailViewProp } from "./updateDetailView.svelte";
2
2
  import type { ButtonProps } from "../../ui/button/button.svelte";
3
3
  interface LocalProp extends UpdateDetailViewProp {
4
4
  variant?: ButtonProps["variant"];
5
+ size?: ButtonProps["size"];
5
6
  class?: ButtonProps["class"];
6
7
  Icon?: ButtonProps["Icon"];
7
8
  children?: ButtonProps["children"];
@@ -62,7 +62,7 @@
62
62
  {@const localAdditions = (localChildren[child.collection]?.created.length ?? 0) + (localChildren[child.collection]?.linked.length ?? 0)}
63
63
  {@const showEmpty = serverCount !== undefined && serverCount === 0 && localAdditions === 0}
64
64
  {#if showEmpty}
65
- <div class="rounded-lg border bg-muted-soft overflow-hidden flex flex-col">
65
+ <div class="rounded-lg border bg-muted overflow-hidden flex flex-col">
66
66
  <div class="flex flex-col items-center justify-center gap-3 py-6 px-4">
67
67
  <div class="flex flex-col items-center gap-2 text-center">
68
68
  <div class="flex items-center gap-1.5 text-sm font-medium text-muted-foreground">
@@ -75,7 +75,7 @@
75
75
  <SelectRecord
76
76
  collectionName={child.collection}
77
77
  variant="outline"
78
- class="h-7 px-3 text-xs font-normal"
78
+ size="sm"
79
79
  Icon={Link}
80
80
  onSelect={(r) => handleEmptyLink(child.collection, r)}
81
81
  >
@@ -84,7 +84,7 @@
84
84
  <CreateDetailViewButton
85
85
  collectionName={child.collection}
86
86
  variant="default"
87
- class="h-7 px-3 text-xs font-normal"
87
+ size="sm"
88
88
  Icon={Plus}
89
89
  onChanges={(c) => handleEmptyCreate(child.collection, c)}
90
90
  >
@@ -94,7 +94,7 @@
94
94
  </div>
95
95
  </div>
96
96
  {:else}
97
- <div class="rounded-lg border bg-background overflow-hidden flex flex-col max-h-96">
97
+ <div class="rounded-lg border bg-card overflow-hidden flex flex-col max-h-96">
98
98
  <DataTable
99
99
  collectionName={child.collection}
100
100
  searchParams={{ children_of: collectionName, parent_id: entry.id }}
@@ -96,7 +96,7 @@
96
96
  });
97
97
  </script>
98
98
 
99
- <div class={cn("w-full resize-y rounded-md border bg-muted-soft shadow-sm", className)}>
99
+ <div class={cn("w-full resize-y rounded-md border bg-muted shadow-sm", className)}>
100
100
  <div
101
101
  bind:this={editorContainer}
102
102
  class="editor pl-2"
@@ -38,8 +38,8 @@
38
38
  <div
39
39
  transition:slide={{ axis: position === "bottom" ? "y" : "x" }}
40
40
  class={position === "bottom"
41
- ? "fixed bottom-0 left-0 z-40 flex h-[60vh] w-full flex-col border-t bg-background"
42
- : "fixed right-0 top-0 z-40 flex h-full w-full flex-col border-l bg-background"}
41
+ ? "fixed bottom-0 left-0 z-40 flex h-[60vh] w-full flex-col border-t bg-card"
42
+ : "fixed right-0 top-0 z-40 flex h-full w-full flex-col border-l bg-card"}
43
43
  style={position === "side" ? `max-width: ${calculateDrawerWidth()}px;` : ""}
44
44
  >
45
45
  {@render children?.()}
@@ -85,7 +85,7 @@
85
85
  placeholder={"NULL"}
86
86
  type="number"
87
87
  class="
88
- bg-muted-soft text-xs
88
+ bg-muted text-xs
89
89
  {destructive ? 'border-destructive bg-destructive/10' : ''}
90
90
  "
91
91
  bind:value={
@@ -98,7 +98,7 @@
98
98
  <div class="relative z-10">
99
99
  <Input
100
100
  placeholder={"PARENT ID"}
101
- class="bg-muted-soft text-xs"
101
+ class="bg-muted text-xs"
102
102
  disabled={true}
103
103
  />
104
104
  </div>
@@ -0,0 +1,85 @@
1
+ <script lang="ts">
2
+ import { onMount } from "svelte";
3
+ import { page } from "$app/state";
4
+ import Button from "./ui/button/button.svelte";
5
+ import Separator from "./ui/separator/separator.svelte";
6
+ import * as Popover from "./ui/popover";
7
+ import { getStudioContext } from "../context";
8
+ import { buildNavSections, isItemActive, type NavItem } from "./mainNavShared";
9
+
10
+ const { lobb, ctx } = getStudioContext();
11
+
12
+ let sections: NavItem[][] = $state([[], [], []]);
13
+ onMount(async () => {
14
+ sections = await buildNavSections(lobb, ctx);
15
+ });
16
+
17
+ const currentPath = $derived(page.url.pathname.replace(/\/$/, "") || "/");
18
+ </script>
19
+
20
+ {#snippet section(section: NavItem[])}
21
+ <div class="flex flex-row items-center gap-1">
22
+ {#each section as item}
23
+ {@const active = isItemActive(currentPath, item)}
24
+ {#if !item.navs}
25
+ <Button
26
+ onclick={() => { if (item.onclick) item.onclick(); }}
27
+ href={item.href}
28
+ class="h-8 px-2.5 text-xs font-normal {active
29
+ ? 'bg-accent text-foreground'
30
+ : 'text-foreground/70 hover:bg-accent/50 hover:text-foreground'}"
31
+ variant="ghost"
32
+ Icon={item.icon}
33
+ >
34
+ {item.label}
35
+ </Button>
36
+ {:else}
37
+ <Popover.Root>
38
+ <Popover.Trigger>
39
+ <Button
40
+ class="h-8 px-2.5 text-xs font-normal {active
41
+ ? 'bg-accent text-accent-foreground'
42
+ : 'text-muted-foreground'}"
43
+ variant="ghost"
44
+ Icon={item.icon}
45
+ >
46
+ {item.label}
47
+ </Button>
48
+ </Popover.Trigger>
49
+ <Popover.Content sideOffset={6} side="bottom" align="start" class="w-60 p-0">
50
+ <div class="py-1">
51
+ {#each item.navs as childItem}
52
+ {@const childActive = isItemActive(currentPath, childItem)}
53
+ <div class="px-1 text-xs text-muted-foreground">
54
+ <Button
55
+ variant="ghost"
56
+ class="flex h-7 w-full justify-start p-2 text-xs font-normal {childActive
57
+ ? 'bg-accent text-accent-foreground'
58
+ : 'text-muted-foreground'}"
59
+ Icon={childItem.icon}
60
+ onclick={() => { if (childItem.onclick) childItem.onclick(); }}
61
+ href={childItem.href}
62
+ >
63
+ {childItem.label}
64
+ </Button>
65
+ </div>
66
+ {/each}
67
+ </div>
68
+ </Popover.Content>
69
+ </Popover.Root>
70
+ {/if}
71
+ {/each}
72
+ </div>
73
+ {/snippet}
74
+
75
+ <div class="relative border-b border-border bg-card text-foreground h-12 w-full px-3 flex items-center justify-between gap-2">
76
+ <div class="flex flex-row items-center gap-2">
77
+ {@render section(sections[0])}
78
+ {#if sections[1].length > 0}
79
+ <Separator orientation="vertical" class="h-6 bg-border" />
80
+ {@render section(sections[1])}
81
+ {/if}
82
+ </div>
83
+
84
+ {@render section(sections[2])}
85
+ </div>
@@ -0,0 +1,3 @@
1
+ declare const HorizontalNav: import("svelte").Component<Record<string, never>, {}, "">;
2
+ type HorizontalNav = ReturnType<typeof HorizontalNav>;
3
+ export default HorizontalNav;
@@ -170,7 +170,7 @@
170
170
  }
171
171
  </script>
172
172
 
173
- <Button variant={rest.variant} class={rest.class} onclick={showDrawer}>
173
+ <Button variant={rest.variant} size={rest.size} class={rest.class} onclick={showDrawer}>
174
174
  <ExtensionsComponents
175
175
  name="collections.import.button.content"
176
176
  utils={getExtensionUtils(lobb, ctx)}
@@ -249,7 +249,7 @@
249
249
  />
250
250
  {:else}
251
251
  <textarea
252
- class="block h-56 w-full resize-none rounded-md border bg-muted-soft p-3 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-ring"
252
+ class="block h-56 w-full resize-none rounded-md border bg-muted p-3 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-ring"
253
253
  placeholder="Paste CSV or JSON here..."
254
254
  bind:value={pasteContent}
255
255
  ></textarea>
@@ -264,11 +264,11 @@
264
264
  </div>
265
265
 
266
266
  <div class="flex h-12 shrink-0 items-center justify-end gap-2 border-t px-4">
267
- <Button variant="outline" onclick={hideDrawer} class="h-7 px-3 text-xs font-normal" Icon={X}>
267
+ <Button variant="outline" onclick={hideDrawer} size="sm" Icon={X}>
268
268
  Cancel
269
269
  </Button>
270
270
  {#if activeTab === "paste"}
271
- <Button onclick={() => processContent(pasteContent)} class="h-7 px-3 text-xs font-normal" Icon={FileText}>
271
+ <Button onclick={() => processContent(pasteContent)} size="sm" Icon={FileText}>
272
272
  Parse
273
273
  </Button>
274
274
  {/if}
@@ -289,10 +289,10 @@
289
289
  </div>
290
290
 
291
291
  <div class="flex h-12 shrink-0 items-center justify-end gap-2 border-t px-4">
292
- <Button variant="outline" onclick={() => (step = "input")} class="h-7 px-3 text-xs font-normal" Icon={X}>
292
+ <Button variant="outline" onclick={() => (step = "input")} size="sm" Icon={X}>
293
293
  Cancel
294
294
  </Button>
295
- <Button onclick={handleImport} class="h-7 px-3 text-xs font-normal" Icon={Check}>
295
+ <Button onclick={handleImport} size="sm" Icon={Check}>
296
296
  Import {transformedRows.length} records
297
297
  </Button>
298
298
  </div>
@@ -345,7 +345,7 @@
345
345
  </div>
346
346
  {/if}
347
347
  <div class="flex h-12 shrink-0 items-center justify-end gap-2 border-t px-4">
348
- <Button onclick={hideDrawer} class="h-7 px-3 text-xs font-normal" Icon={Check}>
348
+ <Button onclick={hideDrawer} size="sm" Icon={Check}>
349
349
  Done
350
350
  </Button>
351
351
  </div>
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import VerticalNav from "./verticalNav.svelte";
3
+ import HorizontalNav from "./horizontalNav.svelte";
4
+
5
+ interface Props {
6
+ orientation?: "vertical" | "horizontal";
7
+ }
8
+ const { orientation = "vertical" }: Props = $props();
9
+ </script>
10
+
11
+ {#if orientation === "horizontal"}
12
+ <HorizontalNav />
13
+ {:else}
14
+ <VerticalNav />
15
+ {/if}
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ orientation?: "vertical" | "horizontal";
3
+ }
4
+ declare const MainNav: import("svelte").Component<Props, {}, "">;
5
+ type MainNav = ReturnType<typeof MainNav>;
6
+ export default MainNav;
@@ -0,0 +1,10 @@
1
+ export type NavItem = {
2
+ label: string;
3
+ href?: string;
4
+ icon: any;
5
+ represents?: string;
6
+ onclick?: () => void;
7
+ navs?: NavItem[];
8
+ };
9
+ export declare function buildNavSections(lobb: any, ctx: any): Promise<NavItem[][]>;
10
+ export declare function isItemActive(currentPath: string, item: NavItem): boolean;
@@ -0,0 +1,62 @@
1
+ import { House, Layers, Library, Workflow } from "lucide-svelte";
2
+ import { emitEvent } from "../eventSystem";
3
+ import { getDashboardNavs } from "../extensions/extensionUtils";
4
+ async function isItemVisible(lobb, ctx, item) {
5
+ if (!item.represents)
6
+ return true;
7
+ const res = await emitEvent({ lobb, ctx }, "auth.canAccess", {
8
+ collection: item.represents,
9
+ action: "read",
10
+ });
11
+ return res === true;
12
+ }
13
+ export async function buildNavSections(lobb, ctx) {
14
+ const rawSections = [
15
+ [
16
+ { label: "Home", href: "/studio", icon: House },
17
+ { label: "Collections", href: "/studio/collections", icon: Library },
18
+ { label: "Data Model", href: "/studio/datamodel", icon: Layers, represents: "core_data_model" },
19
+ { label: "Workflows", href: "/studio/workflows", icon: Workflow, represents: "core_workflows" },
20
+ ],
21
+ [],
22
+ [],
23
+ ];
24
+ const navs = getDashboardNavs(ctx);
25
+ if (navs.top)
26
+ rawSections[0].push(...navs.top);
27
+ if (navs.middle)
28
+ rawSections[1].push(...navs.middle);
29
+ if (navs.bottom)
30
+ rawSections[2].push(...navs.bottom);
31
+ const result = [[], [], []];
32
+ for (let i = 0; i < rawSections.length; i++) {
33
+ for (const item of rawSections[i]) {
34
+ if (item.navs) {
35
+ const visibleChildren = [];
36
+ for (const child of item.navs) {
37
+ if (await isItemVisible(lobb, ctx, child))
38
+ visibleChildren.push(child);
39
+ }
40
+ if (visibleChildren.length && (await isItemVisible(lobb, ctx, item))) {
41
+ result[i].push({ ...item, navs: visibleChildren });
42
+ }
43
+ }
44
+ else if (await isItemVisible(lobb, ctx, item)) {
45
+ result[i].push(item);
46
+ }
47
+ }
48
+ }
49
+ return result;
50
+ }
51
+ export function isItemActive(currentPath, item) {
52
+ if (item.navs)
53
+ return item.navs.some((c) => isItemActive(currentPath, c));
54
+ if (!item.href)
55
+ return false;
56
+ const itemHref = item.href.replace(/\/$/, "") || "/";
57
+ // "/studio" needs an exact match — it's a prefix of every other
58
+ // route, so startsWith would always light it up.
59
+ if (itemHref === "/studio")
60
+ return currentPath === "/studio";
61
+ return currentPath === itemHref || currentPath.startsWith(itemHref + "/");
62
+ }
@@ -70,7 +70,7 @@
70
70
  }
71
71
  </script>
72
72
 
73
- <div class="flex h-9 w-full items-center gap-1.5 rounded-md border pl-1.5 pr-9 text-xs bg-muted-soft {destructive ? 'border-destructive bg-destructive/10' : ''}">
73
+ <div class="flex h-9 w-full items-center gap-1.5 rounded-md border pl-1.5 pr-9 text-xs bg-muted {destructive ? 'border-destructive bg-destructive/10' : ''}">
74
74
  <!-- Collection picker -->
75
75
  <Popover.Root bind:open={collectionPopoverOpen}>
76
76
  <Popover.Trigger>
@@ -33,9 +33,8 @@
33
33
  <Popover.Root>
34
34
  <Popover.Trigger
35
35
  class={cn(
36
- buttonVariants({ variant: "outline" }),
36
+ buttonVariants({ variant: "outline", size: "sm" }),
37
37
  !value && "text-muted-foreground",
38
- "h-7 px-3 text-xs font-normal",
39
38
  )}
40
39
  >
41
40
  <CalendarIcon class="mr-2 size-4" />
@@ -59,7 +58,7 @@
59
58
  class="flex flex-col overflow-hidden text-muted-foreground"
60
59
  >
61
60
  <button
62
- class="text-start text-sm py-2 px-2 hover:bg-muted-soft hover:text-primary"
61
+ class="text-start text-sm py-2 px-2 hover:bg-muted hover:text-primary"
63
62
  onclick={() => {
64
63
  const currentDate = today(getLocalTimeZone());
65
64
  value = {
@@ -71,7 +70,7 @@
71
70
  Today
72
71
  </button>
73
72
  <button
74
- class="text-start text-sm py-2 px-2 hover:bg-muted-soft hover:text-primary"
73
+ class="text-start text-sm py-2 px-2 hover:bg-muted hover:text-primary"
75
74
  onclick={() => {
76
75
  const currentDate = today(getLocalTimeZone());
77
76
  value = {
@@ -83,7 +82,7 @@
83
82
  Yesterday
84
83
  </button>
85
84
  <button
86
- class="text-start text-sm py-2 px-2 hover:bg-muted-soft hover:text-primary"
85
+ class="text-start text-sm py-2 px-2 hover:bg-muted hover:text-primary"
87
86
  onclick={() => {
88
87
  const currentDate = today(getLocalTimeZone());
89
88
  const weekStart = startOfWeek(currentDate, "en-US");
@@ -96,7 +95,7 @@
96
95
  This week (Sun - Today)
97
96
  </button>
98
97
  <button
99
- class="text-start text-sm py-2 px-2 hover:bg-muted-soft hover:text-primary"
98
+ class="text-start text-sm py-2 px-2 hover:bg-muted hover:text-primary"
100
99
  onclick={() => {
101
100
  const currentDate = today(getLocalTimeZone());
102
101
  const thisWeekStart = startOfWeek(
@@ -119,7 +118,7 @@
119
118
  Last week (Sun - Sat)
120
119
  </button>
121
120
  <button
122
- class="text-start text-sm py-2 px-2 hover:bg-muted-soft hover:text-primary"
121
+ class="text-start text-sm py-2 px-2 hover:bg-muted hover:text-primary"
123
122
  onclick={() => {
124
123
  const currentDate = today(getLocalTimeZone());
125
124
  value = {
@@ -131,7 +130,7 @@
131
130
  Last 7 days
132
131
  </button>
133
132
  <button
134
- class="text-start text-sm py-2 px-2 hover:bg-muted-soft hover:text-primary"
133
+ class="text-start text-sm py-2 px-2 hover:bg-muted hover:text-primary"
135
134
  onclick={() => {
136
135
  const currentDate = today(getLocalTimeZone());
137
136
  value = {
@@ -143,7 +142,7 @@
143
142
  Last 30 days
144
143
  </button>
145
144
  <button
146
- class="text-start text-sm py-2 px-2 hover:bg-muted-soft hover:text-primary"
145
+ class="text-start text-sm py-2 px-2 hover:bg-muted hover:text-primary"
147
146
  onclick={() => {
148
147
  const currentDate = today(getLocalTimeZone());
149
148
  value = {
@@ -155,7 +154,7 @@
155
154
  Last 90 days
156
155
  </button>
157
156
  <button
158
- class="text-start text-sm py-2 px-2 hover:bg-muted-soft hover:text-primary"
157
+ class="text-start text-sm py-2 px-2 hover:bg-muted hover:text-primary"
159
158
  onclick={() => {
160
159
  const currentDate = today(getLocalTimeZone());
161
160
  value = {
@@ -167,7 +166,7 @@
167
166
  Last 12 months
168
167
  </button>
169
168
  <button
170
- class="text-start text-sm py-2 px-2 hover:bg-muted-soft hover:text-primary"
169
+ class="text-start text-sm py-2 px-2 hover:bg-muted hover:text-primary"
171
170
  onclick={() => {
172
171
  const currentDate = today(getLocalTimeZone());
173
172
  const lastYearStart = currentDate
@@ -185,7 +184,7 @@
185
184
  Last Calendar year
186
185
  </button>
187
186
  <button
188
- class="text-start text-sm py-2 px-2 hover:bg-muted-soft hover:text-primary"
187
+ class="text-start text-sm py-2 px-2 hover:bg-muted hover:text-primary"
189
188
  onclick={() => {
190
189
  const currentDate = today(getLocalTimeZone());
191
190
  const yearStart = currentDate.set({
@@ -122,7 +122,7 @@
122
122
  }
123
123
  </script>
124
124
 
125
- <div class="flex flex-col rounded-md border bg-muted-soft">
125
+ <div class="flex flex-col rounded-md border bg-muted">
126
126
  <div class="flex flex-wrap items-center gap-0.5 border-b p-1.5">
127
127
  {#if editor}
128
128
  <button
@@ -8,7 +8,7 @@
8
8
  const { lobb, ctx } = getStudioContext();
9
9
  </script>
10
10
 
11
- <div class="grid h-full w-full overflow-auto bg-background">
11
+ <div class="grid h-full w-full overflow-hidden bg-background">
12
12
  {#key extension && page}
13
13
  <ExtensionsComponents
14
14
  name="publicPages.{page}"
@@ -33,7 +33,7 @@
33
33
  <Button
34
34
  Icon={ArrowRight}
35
35
  variant="outline"
36
- class="h-7 px-3 text-xs font-normal"
36
+ size="sm"
37
37
  onclick={() => goto("/studio/collections")}
38
38
  >
39
39
  Go to collections
@@ -103,7 +103,7 @@
103
103
  {#snippet belowSearch()}
104
104
  <div class="pb-4 px-2">
105
105
  <Button
106
- class="h-7 px-3 text-xs font-normal w-full"
106
+ size="sm" class="w-full"
107
107
  variant="outline"
108
108
  onclick={() => goto("/studio/workflows/new")}
109
109
  Icon={Plus}
@@ -34,7 +34,7 @@
34
34
  <div class="text-4xl">Welcome back</div>
35
35
  <div>Sign in to your account</div>
36
36
  </div>
37
- <div class="flex flex-col gap-6 rounded-md border bg-white p-6">
37
+ <div class="flex flex-col gap-6 rounded-md border bg-card p-6">
38
38
  <div class="flex flex-col gap-2">
39
39
  <div>
40
40
  <div class="mb-1 text-sm font-medium">Server</div>
@@ -90,7 +90,7 @@
90
90
  >
91
91
  <div
92
92
  class="
93
- bg-background border-r overflow-hidden
93
+ bg-card border-r overflow-hidden
94
94
  "
95
95
  style="
96
96
  {sidebarProperties.collapsed ? 'border-right-width: 0px; padding: 0px;' : ''}
@@ -107,7 +107,7 @@
107
107
  {#if showSearch}
108
108
  <div class="p-2">
109
109
  <div
110
- class="flex items-center px-4 py-1 text-muted-foreground bg-muted-soft border rounded-md"
110
+ class="flex items-center px-4 py-1 text-muted-foreground bg-muted border rounded-md"
111
111
  >
112
112
  <input
113
113
  type="text"
@@ -123,7 +123,7 @@
123
123
  </div>
124
124
  <div
125
125
  class="
126
- text-primary p-2 overflow-y-auto overflow-x-clip
126
+ text-foreground p-2 overflow-y-auto overflow-x-clip
127
127
  "
128
128
  style="max-height: {sidebarBodyHeight}px;"
129
129
  >
@@ -58,7 +58,7 @@
58
58
  {#each data as node, index}
59
59
  {#if node.type === "directory"}
60
60
  <button
61
- class="flex items-center justify-between p-2 gap-2 text-muted-foreground rounded-md hover:bg-muted-soft cursor-pointer"
61
+ class="flex items-center justify-between p-2 gap-2 text-muted-foreground rounded-md hover:bg-muted cursor-pointer"
62
62
  onclick={() => toggleDir(index)}
63
63
  >
64
64
  <div class="flex items-center gap-2">
@@ -89,8 +89,8 @@
89
89
  href={node.href}
90
90
  variant="ghost"
91
91
  class="
92
- flex items-center justify-between p-2 gap-2 hover:bg-muted-soft text-muted-foreground
93
- rounded-md {isselected ? 'bg-muted' : ''}
92
+ flex items-center justify-between p-2 gap-2 text-muted-foreground
93
+ rounded-md {isselected ? 'bg-accent' : 'hover:bg-muted'}
94
94
  "
95
95
  title={node.name}
96
96
  >
@@ -98,7 +98,7 @@
98
98
  {#if node.icon}
99
99
  <node.icon size="17.5" />
100
100
  {/if}
101
- <div class="text-xs {isselected ? 'text-primary font-medium' : ''}">
101
+ <div class="text-xs {isselected ? 'text-foreground font-medium' : ''}">
102
102
  {node.name}
103
103
  </div>
104
104
  </div>