@lobb-js/studio 0.1.31
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.
- package/.env.example +1 -0
- package/.storybook/main.ts +31 -0
- package/.storybook/preview.ts +21 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/README.md +47 -0
- package/components.json +16 -0
- package/docker-entrypoint.sh +7 -0
- package/dockerfile +27 -0
- package/index.html +13 -0
- package/package.json +77 -0
- package/public/lobb.svg +15 -0
- package/src/Studio.svelte +150 -0
- package/src/app.css +121 -0
- package/src/components-export.ts +21 -0
- package/src/extensions/extension.types.ts +93 -0
- package/src/extensions/extensionUtils.ts +192 -0
- package/src/lib/Lobb.ts +241 -0
- package/src/lib/components/LlmButton.svelte +136 -0
- package/src/lib/components/alertView.svelte +20 -0
- package/src/lib/components/breadCrumbs.svelte +60 -0
- package/src/lib/components/combobox.svelte +92 -0
- package/src/lib/components/confirmationDialog/confirmationDialog.svelte +33 -0
- package/src/lib/components/confirmationDialog/store.svelte.ts +28 -0
- package/src/lib/components/createManyButton.svelte +107 -0
- package/src/lib/components/dataTable/childRecords.svelte +140 -0
- package/src/lib/components/dataTable/dataTable.svelte +223 -0
- package/src/lib/components/dataTable/fieldCell.svelte +74 -0
- package/src/lib/components/dataTable/filter.svelte +282 -0
- package/src/lib/components/dataTable/filterButton.svelte +39 -0
- package/src/lib/components/dataTable/footer.svelte +84 -0
- package/src/lib/components/dataTable/header.svelte +154 -0
- package/src/lib/components/dataTable/sort.svelte +171 -0
- package/src/lib/components/dataTable/sortButton.svelte +36 -0
- package/src/lib/components/dataTable/table.svelte +337 -0
- package/src/lib/components/dataTable/utils.ts +127 -0
- package/src/lib/components/detailView/create/children.svelte +68 -0
- package/src/lib/components/detailView/create/createDetailView.svelte +226 -0
- package/src/lib/components/detailView/create/createDetailViewButton.svelte +32 -0
- package/src/lib/components/detailView/create/createManyView.svelte +250 -0
- package/src/lib/components/detailView/create/subRecords.svelte +48 -0
- package/src/lib/components/detailView/detailViewForm.svelte +104 -0
- package/src/lib/components/detailView/fieldCustomInput.svelte +23 -0
- package/src/lib/components/detailView/fieldInput.svelte +287 -0
- package/src/lib/components/detailView/fieldInputReplacement.svelte +199 -0
- package/src/lib/components/detailView/store.svelte.ts +61 -0
- package/src/lib/components/detailView/update/children.svelte +94 -0
- package/src/lib/components/detailView/update/updateDetailView.svelte +175 -0
- package/src/lib/components/detailView/update/updateDetailViewButton.svelte +32 -0
- package/src/lib/components/detailView/utils.ts +177 -0
- package/src/lib/components/diffViewer.svelte +102 -0
- package/src/lib/components/drawer.svelte +28 -0
- package/src/lib/components/extensionsComponents.svelte +31 -0
- package/src/lib/components/foreingKeyInput.svelte +80 -0
- package/src/lib/components/header.svelte +45 -0
- package/src/lib/components/loadingTypesForMonacoEditor.ts +36 -0
- package/src/lib/components/miniSidebar.svelte +238 -0
- package/src/lib/components/monacoEditor.svelte +181 -0
- package/src/lib/components/rangeCalendarButton.svelte +257 -0
- package/src/lib/components/selectRecord.svelte +126 -0
- package/src/lib/components/setServerPage.svelte +48 -0
- package/src/lib/components/sidebar/index.ts +4 -0
- package/src/lib/components/sidebar/sidebar.svelte +149 -0
- package/src/lib/components/sidebar/sidebarElements.svelte +144 -0
- package/src/lib/components/sidebar/sidebarTrigger.svelte +33 -0
- package/src/lib/components/singletone.svelte +69 -0
- package/src/lib/components/ui/accordion/accordion-content.svelte +22 -0
- package/src/lib/components/ui/accordion/accordion-item.svelte +12 -0
- package/src/lib/components/ui/accordion/accordion-trigger.svelte +31 -0
- package/src/lib/components/ui/accordion/index.ts +17 -0
- package/src/lib/components/ui/alert/alert-description.svelte +16 -0
- package/src/lib/components/ui/alert/alert-title.svelte +24 -0
- package/src/lib/components/ui/alert/alert.svelte +39 -0
- package/src/lib/components/ui/alert/index.ts +14 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte +13 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte +17 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte +26 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte +16 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte +20 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte +20 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte +19 -0
- package/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte +18 -0
- package/src/lib/components/ui/alert-dialog/index.ts +40 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-ellipsis.svelte +23 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-item.svelte +16 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-link.svelte +31 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-list.svelte +23 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-page.svelte +23 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb-separator.svelte +27 -0
- package/src/lib/components/ui/breadcrumb/breadcrumb.svelte +15 -0
- package/src/lib/components/ui/breadcrumb/index.ts +25 -0
- package/src/lib/components/ui/button/button.svelte +110 -0
- package/src/lib/components/ui/button/index.ts +17 -0
- package/src/lib/components/ui/checkbox/checkbox.svelte +35 -0
- package/src/lib/components/ui/checkbox/index.ts +6 -0
- package/src/lib/components/ui/command/command-dialog.svelte +35 -0
- package/src/lib/components/ui/command/command-empty.svelte +12 -0
- package/src/lib/components/ui/command/command-group.svelte +31 -0
- package/src/lib/components/ui/command/command-input.svelte +25 -0
- package/src/lib/components/ui/command/command-item.svelte +19 -0
- package/src/lib/components/ui/command/command-link-item.svelte +19 -0
- package/src/lib/components/ui/command/command-list.svelte +16 -0
- package/src/lib/components/ui/command/command-separator.svelte +12 -0
- package/src/lib/components/ui/command/command-shortcut.svelte +20 -0
- package/src/lib/components/ui/command/command.svelte +21 -0
- package/src/lib/components/ui/command/index.ts +40 -0
- package/src/lib/components/ui/dialog/dialog-content.svelte +38 -0
- package/src/lib/components/ui/dialog/dialog-description.svelte +16 -0
- package/src/lib/components/ui/dialog/dialog-footer.svelte +20 -0
- package/src/lib/components/ui/dialog/dialog-header.svelte +20 -0
- package/src/lib/components/ui/dialog/dialog-overlay.svelte +19 -0
- package/src/lib/components/ui/dialog/dialog-title.svelte +16 -0
- package/src/lib/components/ui/dialog/index.ts +37 -0
- package/src/lib/components/ui/input/index.ts +7 -0
- package/src/lib/components/ui/input/input.svelte +46 -0
- package/src/lib/components/ui/label/index.ts +7 -0
- package/src/lib/components/ui/label/label.svelte +19 -0
- package/src/lib/components/ui/popover/index.ts +17 -0
- package/src/lib/components/ui/popover/popover-content.svelte +28 -0
- package/src/lib/components/ui/range-calendar/index.ts +30 -0
- package/src/lib/components/ui/range-calendar/range-calendar-cell.svelte +19 -0
- package/src/lib/components/ui/range-calendar/range-calendar-day.svelte +35 -0
- package/src/lib/components/ui/range-calendar/range-calendar-grid-body.svelte +12 -0
- package/src/lib/components/ui/range-calendar/range-calendar-grid-head.svelte +12 -0
- package/src/lib/components/ui/range-calendar/range-calendar-grid-row.svelte +12 -0
- package/src/lib/components/ui/range-calendar/range-calendar-grid.svelte +16 -0
- package/src/lib/components/ui/range-calendar/range-calendar-head-cell.svelte +16 -0
- package/src/lib/components/ui/range-calendar/range-calendar-header.svelte +16 -0
- package/src/lib/components/ui/range-calendar/range-calendar-heading.svelte +16 -0
- package/src/lib/components/ui/range-calendar/range-calendar-months.svelte +20 -0
- package/src/lib/components/ui/range-calendar/range-calendar-next-button.svelte +27 -0
- package/src/lib/components/ui/range-calendar/range-calendar-prev-button.svelte +27 -0
- package/src/lib/components/ui/range-calendar/range-calendar.svelte +57 -0
- package/src/lib/components/ui/select/index.ts +34 -0
- package/src/lib/components/ui/select/select-content.svelte +38 -0
- package/src/lib/components/ui/select/select-group-heading.svelte +16 -0
- package/src/lib/components/ui/select/select-item.svelte +37 -0
- package/src/lib/components/ui/select/select-scroll-down-button.svelte +19 -0
- package/src/lib/components/ui/select/select-scroll-up-button.svelte +19 -0
- package/src/lib/components/ui/select/select-separator.svelte +13 -0
- package/src/lib/components/ui/select/select-trigger.svelte +24 -0
- package/src/lib/components/ui/separator/index.ts +7 -0
- package/src/lib/components/ui/separator/separator.svelte +22 -0
- package/src/lib/components/ui/skeleton/index.ts +7 -0
- package/src/lib/components/ui/skeleton/skeleton.svelte +22 -0
- package/src/lib/components/ui/sonner/index.ts +1 -0
- package/src/lib/components/ui/sonner/sonner.svelte +20 -0
- package/src/lib/components/ui/switch/index.ts +7 -0
- package/src/lib/components/ui/switch/switch.svelte +27 -0
- package/src/lib/components/ui/textarea/index.ts +7 -0
- package/src/lib/components/ui/textarea/textarea.svelte +22 -0
- package/src/lib/components/ui/tooltip/index.ts +18 -0
- package/src/lib/components/ui/tooltip/tooltip-content.svelte +21 -0
- package/src/lib/components/workflowEditor.svelte +187 -0
- package/src/lib/eventSystem.ts +38 -0
- package/src/lib/index.ts +40 -0
- package/src/lib/store.svelte.ts +21 -0
- package/src/lib/store.types.ts +28 -0
- package/src/lib/utils.ts +84 -0
- package/src/main.ts +18 -0
- package/src/routes/collections/collection.svelte +46 -0
- package/src/routes/collections/collections.svelte +43 -0
- package/src/routes/data_model/dataModel.svelte +40 -0
- package/src/routes/data_model/flow.css +22 -0
- package/src/routes/data_model/flow.svelte +82 -0
- package/src/routes/data_model/syncManager.svelte +93 -0
- package/src/routes/data_model/utils.ts +35 -0
- package/src/routes/extensions/extension.svelte +16 -0
- package/src/routes/home.svelte +36 -0
- package/src/routes/workflows/workflows.svelte +135 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/detailView/detailViewForm.stories.svelte +79 -0
- package/src/stories/examples/Button.stories.svelte +31 -0
- package/src/stories/examples/Button.svelte +30 -0
- package/src/stories/examples/Header.stories.svelte +26 -0
- package/src/stories/examples/Header.svelte +45 -0
- package/src/stories/examples/Page.stories.svelte +29 -0
- package/src/stories/examples/Page.svelte +70 -0
- package/src/stories/examples/button.css +30 -0
- package/src/stories/examples/header.css +32 -0
- package/src/stories/examples/page.css +68 -0
- package/src/vite-env.d.ts +2 -0
- package/svelte.config.js +7 -0
- package/todo.md +24 -0
- package/tsconfig.app.json +25 -0
- package/tsconfig.json +14 -0
- package/tsconfig.node.json +24 -0
- package/vite-plugin-contextual-lib.js +66 -0
- package/vite.build.svelte.config.ts +18 -0
- package/vite.config.ts +84 -0
- package/vite.extension.config.ts +81 -0
- package/vite_utils.ts +28 -0
- package/vitest.shims.d.ts +1 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import './page.css';
|
|
3
|
+
import Header from './Header.svelte';
|
|
4
|
+
|
|
5
|
+
let user = $state<{ name: string }>();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<article>
|
|
9
|
+
<Header
|
|
10
|
+
{user}
|
|
11
|
+
onLogin={() => (user = { name: 'Jane Doe' })}
|
|
12
|
+
onLogout={() => (user = undefined)}
|
|
13
|
+
onCreateAccount={() => (user = { name: 'Jane Doe' })}
|
|
14
|
+
/>
|
|
15
|
+
|
|
16
|
+
<section class="storybook-page">
|
|
17
|
+
<h2>Pages in Storybook</h2>
|
|
18
|
+
<p>
|
|
19
|
+
We recommend building UIs with a
|
|
20
|
+
<a
|
|
21
|
+
href="https://blog.hichroma.com/component-driven-development-ce1109d56c8e"
|
|
22
|
+
target="_blank"
|
|
23
|
+
rel="noopener noreferrer"
|
|
24
|
+
>
|
|
25
|
+
<strong>component-driven</strong>
|
|
26
|
+
</a>
|
|
27
|
+
process starting with atomic components and ending with pages.
|
|
28
|
+
</p>
|
|
29
|
+
<p>
|
|
30
|
+
Render pages with mock data. This makes it easy to build and review page states without
|
|
31
|
+
needing to navigate to them in your app. Here are some handy patterns for managing page data
|
|
32
|
+
in Storybook:
|
|
33
|
+
</p>
|
|
34
|
+
<ul>
|
|
35
|
+
<li>
|
|
36
|
+
Use a higher-level connected component. Storybook helps you compose such data from the
|
|
37
|
+
"args" of child component stories
|
|
38
|
+
</li>
|
|
39
|
+
<li>
|
|
40
|
+
Assemble data in the page component from your services. You can mock these services out
|
|
41
|
+
using Storybook.
|
|
42
|
+
</li>
|
|
43
|
+
</ul>
|
|
44
|
+
<p>
|
|
45
|
+
Get a guided tutorial on component-driven development at
|
|
46
|
+
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
|
47
|
+
Storybook tutorials
|
|
48
|
+
</a>
|
|
49
|
+
. Read more in the
|
|
50
|
+
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">docs</a>
|
|
51
|
+
.
|
|
52
|
+
</p>
|
|
53
|
+
<div class="tip-wrapper">
|
|
54
|
+
<span class="tip">Tip</span>
|
|
55
|
+
Adjust the width of the canvas with the
|
|
56
|
+
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
|
57
|
+
<g fill="none" fill-rule="evenodd">
|
|
58
|
+
<path
|
|
59
|
+
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0
|
|
60
|
+
01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0
|
|
61
|
+
010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
|
|
62
|
+
id="a"
|
|
63
|
+
fill="#999"
|
|
64
|
+
/>
|
|
65
|
+
</g>
|
|
66
|
+
</svg>
|
|
67
|
+
Viewports addon in the toolbar
|
|
68
|
+
</div>
|
|
69
|
+
</section>
|
|
70
|
+
</article>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.storybook-button {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
border: 0;
|
|
5
|
+
border-radius: 3em;
|
|
6
|
+
font-weight: 700;
|
|
7
|
+
line-height: 1;
|
|
8
|
+
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
9
|
+
}
|
|
10
|
+
.storybook-button--primary {
|
|
11
|
+
background-color: #555ab9;
|
|
12
|
+
color: white;
|
|
13
|
+
}
|
|
14
|
+
.storybook-button--secondary {
|
|
15
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
|
|
16
|
+
background-color: transparent;
|
|
17
|
+
color: #333;
|
|
18
|
+
}
|
|
19
|
+
.storybook-button--small {
|
|
20
|
+
padding: 10px 16px;
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
}
|
|
23
|
+
.storybook-button--medium {
|
|
24
|
+
padding: 11px 20px;
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
}
|
|
27
|
+
.storybook-button--large {
|
|
28
|
+
padding: 12px 24px;
|
|
29
|
+
font-size: 16px;
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.storybook-header {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
align-items: center;
|
|
5
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
6
|
+
padding: 15px 20px;
|
|
7
|
+
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.storybook-header svg {
|
|
11
|
+
display: inline-block;
|
|
12
|
+
vertical-align: top;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.storybook-header h1 {
|
|
16
|
+
display: inline-block;
|
|
17
|
+
vertical-align: top;
|
|
18
|
+
margin: 6px 0 6px 10px;
|
|
19
|
+
font-weight: 700;
|
|
20
|
+
font-size: 20px;
|
|
21
|
+
line-height: 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.storybook-header button + button {
|
|
25
|
+
margin-left: 10px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.storybook-header .welcome {
|
|
29
|
+
margin-right: 10px;
|
|
30
|
+
color: #333;
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
.storybook-page {
|
|
2
|
+
margin: 0 auto;
|
|
3
|
+
padding: 48px 20px;
|
|
4
|
+
max-width: 600px;
|
|
5
|
+
color: #333;
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
line-height: 24px;
|
|
8
|
+
font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.storybook-page h2 {
|
|
12
|
+
display: inline-block;
|
|
13
|
+
vertical-align: top;
|
|
14
|
+
margin: 0 0 4px;
|
|
15
|
+
font-weight: 700;
|
|
16
|
+
font-size: 32px;
|
|
17
|
+
line-height: 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.storybook-page p {
|
|
21
|
+
margin: 1em 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.storybook-page a {
|
|
25
|
+
color: inherit;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.storybook-page ul {
|
|
29
|
+
margin: 1em 0;
|
|
30
|
+
padding-left: 30px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.storybook-page li {
|
|
34
|
+
margin-bottom: 8px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.storybook-page .tip {
|
|
38
|
+
display: inline-block;
|
|
39
|
+
vertical-align: top;
|
|
40
|
+
margin-right: 10px;
|
|
41
|
+
border-radius: 1em;
|
|
42
|
+
background: #e7fdd8;
|
|
43
|
+
padding: 4px 12px;
|
|
44
|
+
color: #357a14;
|
|
45
|
+
font-weight: 700;
|
|
46
|
+
font-size: 11px;
|
|
47
|
+
line-height: 12px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.storybook-page .tip-wrapper {
|
|
51
|
+
margin-top: 40px;
|
|
52
|
+
margin-bottom: 40px;
|
|
53
|
+
font-size: 13px;
|
|
54
|
+
line-height: 20px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.storybook-page .tip-wrapper svg {
|
|
58
|
+
display: inline-block;
|
|
59
|
+
vertical-align: top;
|
|
60
|
+
margin-top: 3px;
|
|
61
|
+
margin-right: 4px;
|
|
62
|
+
width: 12px;
|
|
63
|
+
height: 12px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.storybook-page .tip-wrapper svg path {
|
|
67
|
+
fill: #1ea7fd;
|
|
68
|
+
}
|
package/svelte.config.js
ADDED
package/todo.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# THE GOAL
|
|
2
|
+
|
|
3
|
+
- instead of passing lobb components to the exntesions one by one and specifying it there .. you can just dynamically specify everything in a directory automatically. without adding each new or old component you forgot gradually
|
|
4
|
+
- make the ui of lobb look a bit like the UI of zed text editor
|
|
5
|
+
|
|
6
|
+
# high priority
|
|
7
|
+
|
|
8
|
+
- when the screen gets smaller the sidebar in the collections page collapses and the main unselected part shows. thats not a good ui/ux. its better to do like the whatsup app. where it instead shows the sidebar as the main app and then you can click on pages and its going to slide from right to left
|
|
9
|
+
- the mass delete doesnt show a notification when the operation isnt successfull
|
|
10
|
+
- instead of removing the hash of generated js files that will be used by the imported extension views. its better to not remove it (because its a good way to not cache the js files when there is change to them). and just track those library files with their hashes in the build process and save them in a variable and update the import map you will add in the index.html accordangly. this way you dont need deal with the rist of using an outdated cached version of the `index-client.js` file for example
|
|
11
|
+
- I think the best thing to do regarding the datatable compoenent is to unmount it and re-mounted again when a user navigates to another table. its the safest and a better thing todo for consistancies
|
|
12
|
+
- try to make the extender vite extension work in dev mode too
|
|
13
|
+
- you removed the hash part of the svelte libraries in order to be able to use them on the build version. check if you can use `?v=21212` instead to keep the ability of removing the cache. we need this to be mainly added for other components that use those svelte library internally whithin the app. the compiled extension components can add that easily by themselves
|
|
14
|
+
- prepare the auth extension views in here to be properly ordered and organized for dynamic views and extensions that will be added dynamically from extensions
|
|
15
|
+
- create e2e tests for the sort and the filters and the dataTable component because its not stable
|
|
16
|
+
- make the row height in the tableData component smaller
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
- added the ability to resize width of the columns and add specific width size based on the field type
|
|
20
|
+
- make the cell hight smaller
|
|
21
|
+
- sorting the id field doesnt work. check why
|
|
22
|
+
- in order to have date and datetime field just add an addiotional property for the ui to treat them like that. you dont need to add another
|
|
23
|
+
- think of the proper fonts
|
|
24
|
+
- I need to show a meaningfull error message if the dashboard couldnt connect to the lobb server
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsconfig/svelte/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
/**
|
|
9
|
+
* Typecheck JS in `.svelte` and `.js` files by default.
|
|
10
|
+
* Disable checkJs if you'd like to use dynamic types in JS.
|
|
11
|
+
* Note that setting allowJs false does not prevent the use
|
|
12
|
+
* of JS in `.svelte` files.
|
|
13
|
+
*/
|
|
14
|
+
"allowJs": true,
|
|
15
|
+
"checkJs": true,
|
|
16
|
+
"isolatedModules": true,
|
|
17
|
+
"moduleDetection": "force",
|
|
18
|
+
"baseUrl": ".",
|
|
19
|
+
"paths": {
|
|
20
|
+
"$lib": ["./src/lib"],
|
|
21
|
+
"$lib/*": ["./src/lib/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"]
|
|
25
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"moduleDetection": "force",
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
/* Linting */
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"noUncheckedSideEffectImports": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["vite.config.ts"]
|
|
24
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Vite plugin that resolves $lib imports contextually based on the importing file location.
|
|
10
|
+
*
|
|
11
|
+
* - Files inside the consuming project -> resolve to local ./src/lib
|
|
12
|
+
* - Files outside the project (e.g., Studio package) -> resolve to Studio's src/lib
|
|
13
|
+
*
|
|
14
|
+
* This allows shadcn components to work in both the Studio package and consuming projects
|
|
15
|
+
* without conflicts.
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} options - Plugin options
|
|
18
|
+
* @param {string} [options.studioLibPath] - The path to the studio's src/lib directory (used for external imports)
|
|
19
|
+
* @returns {import('vite').Plugin}
|
|
20
|
+
*/
|
|
21
|
+
export function contextualLibAlias(options = {}) {
|
|
22
|
+
let projectRoot;
|
|
23
|
+
let localLibPath;
|
|
24
|
+
let studioLibPath;
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
name: "contextual-lib-alias",
|
|
28
|
+
enforce: "pre",
|
|
29
|
+
|
|
30
|
+
configResolved(config) {
|
|
31
|
+
projectRoot = config.root;
|
|
32
|
+
localLibPath = path.resolve(projectRoot, "./src/lib");
|
|
33
|
+
|
|
34
|
+
// Use provided studioLibPath or default to this package's src/lib
|
|
35
|
+
studioLibPath = options.studioLibPath || path.resolve(__dirname, "./src/lib");
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
async resolveId(source, importer, options) {
|
|
39
|
+
if (!source.startsWith("$lib")) return null;
|
|
40
|
+
if (!importer) return null;
|
|
41
|
+
|
|
42
|
+
// Determine if the importing file is inside this project or external (e.g., Studio package)
|
|
43
|
+
const isLocalImport = importer.startsWith(projectRoot);
|
|
44
|
+
|
|
45
|
+
let targetPath;
|
|
46
|
+
|
|
47
|
+
if (isLocalImport && fs.existsSync(localLibPath)) {
|
|
48
|
+
// Local file importing $lib -> resolve to local src/lib
|
|
49
|
+
targetPath = localLibPath;
|
|
50
|
+
} else if (fs.existsSync(studioLibPath)) {
|
|
51
|
+
// External file (e.g., Studio) importing $lib -> resolve to Studio's src/lib
|
|
52
|
+
targetPath = studioLibPath;
|
|
53
|
+
} else {
|
|
54
|
+
// Neither path exists, let default resolution handle it
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Extract the import path after $lib (e.g., "$lib/store.svelte" -> "/store.svelte")
|
|
59
|
+
const importPath = source.slice(4); // Remove "$lib"
|
|
60
|
+
const resolvedPath = path.join(targetPath, importPath);
|
|
61
|
+
|
|
62
|
+
// Let Vite resolve the actual file (handles .js, .ts, .svelte extensions)
|
|
63
|
+
return this.resolve(resolvedPath, importer, { skipSelf: true, ...options });
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import { getSvelteExportedLibraries } from './vite_utils';
|
|
3
|
+
|
|
4
|
+
const exports = await getSvelteExportedLibraries();
|
|
5
|
+
|
|
6
|
+
// https://vite.dev/config/
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
build: {
|
|
9
|
+
outDir: 'dist/svelte',
|
|
10
|
+
lib: {
|
|
11
|
+
formats: ['es'],
|
|
12
|
+
entry: exports,
|
|
13
|
+
},
|
|
14
|
+
rollupOptions: {
|
|
15
|
+
treeshake: false,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
})
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
3
|
+
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
|
4
|
+
import { getSvelteExportedLibraries, getSvelteVersion } from './vite_utils';
|
|
5
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
6
|
+
|
|
7
|
+
const importMap: any = {
|
|
8
|
+
imports: {}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const svelteVersion = await getSvelteVersion()
|
|
12
|
+
const svelteExports = await getSvelteExportedLibraries();
|
|
13
|
+
const svelteExternals = Object.keys(svelteExports).map((item) => item.replaceAll("_", "/"));
|
|
14
|
+
|
|
15
|
+
export default defineConfig(({ mode }) => {
|
|
16
|
+
const env = loadEnv(mode, process.cwd(), '')
|
|
17
|
+
return {
|
|
18
|
+
build: {
|
|
19
|
+
minify: true,
|
|
20
|
+
emptyOutDir: false,
|
|
21
|
+
rollupOptions: {
|
|
22
|
+
external: svelteExternals,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
resolve: {
|
|
26
|
+
alias: {
|
|
27
|
+
$lib: path.resolve("./src/lib"),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
plugins: [
|
|
31
|
+
tailwindcss(),
|
|
32
|
+
svelte(),
|
|
33
|
+
{
|
|
34
|
+
name: 'insert-import-map',
|
|
35
|
+
apply: 'serve',
|
|
36
|
+
async transformIndexHtml(html) {
|
|
37
|
+
for (let index = 0; index < svelteExternals.length; index++) {
|
|
38
|
+
const svelteLibName = svelteExternals[index];
|
|
39
|
+
const importValue = `/node_modules/.vite/deps/${svelteLibName.replaceAll("/", "_")}.js?v=${svelteVersion}`
|
|
40
|
+
importMap.imports[svelteLibName] = importValue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const importMapScript = `<script type="importmap">${JSON.stringify(importMap)}</script>`;
|
|
44
|
+
return html.replace(
|
|
45
|
+
/<\/head>/,
|
|
46
|
+
`${importMapScript}</head>`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'create-svelte-import-map',
|
|
52
|
+
apply: 'build',
|
|
53
|
+
async configResolved(config) {
|
|
54
|
+
for (let index = 0; index < svelteExternals.length; index++) {
|
|
55
|
+
const svelteLibName = svelteExternals[index];
|
|
56
|
+
const importValue = `/svelte/${svelteLibName.replaceAll("/", "_")}.js?v=${svelteVersion}`
|
|
57
|
+
importMap.imports[svelteLibName] = importValue;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'insert-import-map',
|
|
63
|
+
apply: 'build',
|
|
64
|
+
transformIndexHtml(html) {
|
|
65
|
+
const importMapScript = `<script type="importmap">${JSON.stringify(importMap)}</script>`;
|
|
66
|
+
return html.replace(
|
|
67
|
+
/<\/head>/,
|
|
68
|
+
`${importMapScript}</head>`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'insert-APP_ENV',
|
|
74
|
+
async transformIndexHtml(html) {
|
|
75
|
+
const importMapScript = `<script>window.APP_ENV = {LOBB_URL: "${mode === 'development' ? env.LOBB_URL ?? "" : "%LOBB_URL%"}"}</script>`;
|
|
76
|
+
return html.replace(
|
|
77
|
+
/<\/head>/,
|
|
78
|
+
`${importMapScript}</head>`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
}
|
|
84
|
+
})
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { defineConfig } from "vite";
|
|
4
|
+
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
5
|
+
import { getSvelteExportedLibraries } from "./vite_utils";
|
|
6
|
+
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
|
|
7
|
+
|
|
8
|
+
const exports = await getSvelteExportedLibraries();
|
|
9
|
+
const externals = Object.keys(exports).map((item) => item.replaceAll("_", "/"));
|
|
10
|
+
|
|
11
|
+
const availableExtensions = fs.readdirSync("src/extensions").filter((name) => {
|
|
12
|
+
const fullPath = path.join("src/extensions", name);
|
|
13
|
+
return fs.statSync(fullPath).isDirectory();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
if (availableExtensions.length > 1) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"The extensions directory should have only one extension when executing the npm `build_extension`",
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
resolve: {
|
|
24
|
+
alias: {
|
|
25
|
+
$lib: path.resolve("./src/lib"),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
build: {
|
|
29
|
+
minify: true,
|
|
30
|
+
lib: {
|
|
31
|
+
entry: `src/extensions/${availableExtensions[0]}/index.ts`,
|
|
32
|
+
fileName: availableExtensions[0],
|
|
33
|
+
formats: ["es"],
|
|
34
|
+
},
|
|
35
|
+
rollupOptions: {
|
|
36
|
+
external: externals,
|
|
37
|
+
output: {
|
|
38
|
+
inlineDynamicImports: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
plugins: [
|
|
43
|
+
svelte(),
|
|
44
|
+
cssInjectedByJsPlugin(),
|
|
45
|
+
{
|
|
46
|
+
name: "vite-plugin-generate-dashboard-json",
|
|
47
|
+
apply: "build",
|
|
48
|
+
closeBundle() {
|
|
49
|
+
const distDir = path.resolve(__dirname, "dist");
|
|
50
|
+
const extensionFilePath = path.join(
|
|
51
|
+
distDir,
|
|
52
|
+
`${availableExtensions[0]}.js`,
|
|
53
|
+
);
|
|
54
|
+
const outputJsonPath = path.join(__dirname, "../dashboard.json");
|
|
55
|
+
|
|
56
|
+
if (!fs.existsSync(extensionFilePath)) {
|
|
57
|
+
console.warn(
|
|
58
|
+
`⚠️ ${availableExtensions[0]}.js not found in dist directory.`,
|
|
59
|
+
);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!fs.existsSync(outputJsonPath)) {
|
|
64
|
+
console.warn(
|
|
65
|
+
`Couldn't find the dashboard.json file in the upper directory (it indicates that this lobb studio project is not inside an extension).`,
|
|
66
|
+
);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const jsContent = fs.readFileSync(extensionFilePath, "utf-8");
|
|
71
|
+
const json = {
|
|
72
|
+
extension: jsContent,
|
|
73
|
+
};
|
|
74
|
+
fs.writeFileSync(outputJsonPath, JSON.stringify(json, null, 2));
|
|
75
|
+
console.log(
|
|
76
|
+
`✅ the dashboard.json of the (${availableExtensions[0]}) extension was overwritten successfully`,
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
});
|
package/vite_utils.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
export async function getSvelteExportedLibraries() {
|
|
5
|
+
const svelteLocation = 'node_modules/svelte';
|
|
6
|
+
const sveltePackage = await fs.readFile(`${svelteLocation}/package.json`, 'utf-8');
|
|
7
|
+
const metadata = JSON.parse(sveltePackage);
|
|
8
|
+
|
|
9
|
+
const svelteExports: any = {};
|
|
10
|
+
for (const [key, value] of Object.entries(metadata.exports)) {
|
|
11
|
+
const svelteLibName = key.replace(".", 'svelte');
|
|
12
|
+
const editedSvelteLibName = svelteLibName.replaceAll("/", '_');
|
|
13
|
+
if (value.browser) {
|
|
14
|
+
svelteExports[editedSvelteLibName] = path.resolve(svelteLocation, value.browser);
|
|
15
|
+
} else if (value.default) {
|
|
16
|
+
svelteExports[editedSvelteLibName] = path.resolve(svelteLocation, value.default);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return svelteExports;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function getSvelteVersion() {
|
|
24
|
+
const svelteLocation = 'node_modules/svelte';
|
|
25
|
+
const sveltePackage = await fs.readFile(`${svelteLocation}/package.json`, 'utf-8');
|
|
26
|
+
const metadata = JSON.parse(sveltePackage);
|
|
27
|
+
return metadata.version;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="@vitest/browser-playwright" />
|