@lobb-js/studio 0.28.5 → 0.29.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 (92) hide show
  1. package/dist/components/Studio.svelte +7 -4
  2. package/dist/components/combobox.svelte +3 -3
  3. package/dist/components/confirmationDialog/confirmationDialog.svelte +1 -1
  4. package/dist/components/dataTable/dataTable.svelte +74 -82
  5. package/dist/components/dataTable/dataTable.svelte.d.ts +3 -19
  6. package/dist/components/dataTable/filter.svelte +1 -1
  7. package/dist/components/dataTable/filterButton.svelte +1 -1
  8. package/dist/components/dataTable/header.svelte +33 -54
  9. package/dist/components/dataTable/header.svelte.d.ts +3 -2
  10. package/dist/components/dataTable/sort.svelte +1 -1
  11. package/dist/components/dataTable/sortButton.svelte +2 -2
  12. package/dist/components/detailView/create/children.svelte +1 -1
  13. package/dist/components/detailView/create/createDetailView.svelte +77 -42
  14. package/dist/components/detailView/create/createDetailView.svelte.d.ts +2 -2
  15. package/dist/components/detailView/create/createDetailViewButton.svelte +2 -2
  16. package/dist/components/detailView/create/createDetailViewButton.svelte.d.ts +1 -1
  17. package/dist/components/detailView/create/createManyView.svelte +10 -6
  18. package/dist/components/detailView/fieldInput.svelte +1 -1
  19. package/dist/components/detailView/fieldInputReplacement.svelte +1 -1
  20. package/dist/components/detailView/update/detailViewChildren.svelte +15 -26
  21. package/dist/components/detailView/update/detailViewChildren.svelte.d.ts +3 -8
  22. package/dist/components/detailView/update/updateDetailView.svelte +85 -27
  23. package/dist/components/detailView/update/updateDetailView.svelte.d.ts +2 -2
  24. package/dist/components/detailView/update/updateDetailViewButton.svelte +3 -2
  25. package/dist/components/detailView/update/updateDetailViewButton.svelte.d.ts +1 -1
  26. package/dist/components/detailView/utils.d.ts +17 -0
  27. package/dist/components/miniSidebar.svelte +4 -4
  28. package/dist/components/rangeCalendarButton.svelte +3 -3
  29. package/dist/components/routes/collections/collection.svelte +3 -3
  30. package/dist/components/routes/collections/collections.svelte +2 -2
  31. package/dist/components/routes/data_model/dataModel.svelte +2 -2
  32. package/dist/components/routes/data_model/syncManager.svelte +4 -4
  33. package/dist/components/routes/extensions/extension.svelte +1 -1
  34. package/dist/components/routes/home.svelte +1 -1
  35. package/dist/components/routes/workflows/workflows.svelte +5 -5
  36. package/dist/components/selectRecord.svelte +2 -21
  37. package/dist/components/setServerPage.svelte +1 -1
  38. package/dist/components/ui/alert-dialog/alert-dialog-action.svelte +1 -1
  39. package/dist/components/ui/alert-dialog/alert-dialog-cancel.svelte +1 -1
  40. package/dist/components/ui/command/command-dialog.svelte +1 -1
  41. package/dist/components/ui/range-calendar/range-calendar-day.svelte +1 -1
  42. package/dist/components/ui/range-calendar/range-calendar-next-button.svelte +1 -1
  43. package/dist/components/ui/range-calendar/range-calendar-prev-button.svelte +1 -1
  44. package/dist/components/ui/select/select-separator.svelte +1 -1
  45. package/dist/components/workflowEditor.svelte +3 -3
  46. package/dist/store.types.d.ts +1 -1
  47. package/package.json +2 -2
  48. package/src/lib/components/Studio.svelte +7 -4
  49. package/src/lib/components/combobox.svelte +3 -3
  50. package/src/lib/components/confirmationDialog/confirmationDialog.svelte +1 -1
  51. package/src/lib/components/dataTable/dataTable.svelte +74 -82
  52. package/src/lib/components/dataTable/filter.svelte +1 -1
  53. package/src/lib/components/dataTable/filterButton.svelte +1 -1
  54. package/src/lib/components/dataTable/header.svelte +33 -54
  55. package/src/lib/components/dataTable/sort.svelte +1 -1
  56. package/src/lib/components/dataTable/sortButton.svelte +2 -2
  57. package/src/lib/components/detailView/create/children.svelte +1 -1
  58. package/src/lib/components/detailView/create/createDetailView.svelte +77 -42
  59. package/src/lib/components/detailView/create/createDetailViewButton.svelte +2 -2
  60. package/src/lib/components/detailView/create/createManyView.svelte +10 -6
  61. package/src/lib/components/detailView/fieldInput.svelte +1 -1
  62. package/src/lib/components/detailView/fieldInputReplacement.svelte +1 -1
  63. package/src/lib/components/detailView/update/detailViewChildren.svelte +15 -26
  64. package/src/lib/components/detailView/update/updateDetailView.svelte +85 -27
  65. package/src/lib/components/detailView/update/updateDetailViewButton.svelte +3 -2
  66. package/src/lib/components/detailView/utils.ts +13 -0
  67. package/src/lib/components/miniSidebar.svelte +4 -4
  68. package/src/lib/components/rangeCalendarButton.svelte +3 -3
  69. package/src/lib/components/routes/collections/collection.svelte +3 -3
  70. package/src/lib/components/routes/collections/collections.svelte +2 -2
  71. package/src/lib/components/routes/data_model/dataModel.svelte +2 -2
  72. package/src/lib/components/routes/data_model/syncManager.svelte +4 -4
  73. package/src/lib/components/routes/extensions/extension.svelte +1 -1
  74. package/src/lib/components/routes/home.svelte +1 -1
  75. package/src/lib/components/routes/workflows/workflows.svelte +5 -5
  76. package/src/lib/components/selectRecord.svelte +2 -21
  77. package/src/lib/components/setServerPage.svelte +1 -1
  78. package/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte +1 -1
  79. package/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte +1 -1
  80. package/src/lib/components/ui/command/command-dialog.svelte +1 -1
  81. package/src/lib/components/ui/range-calendar/range-calendar-day.svelte +1 -1
  82. package/src/lib/components/ui/range-calendar/range-calendar-next-button.svelte +1 -1
  83. package/src/lib/components/ui/range-calendar/range-calendar-prev-button.svelte +1 -1
  84. package/src/lib/components/ui/select/select-separator.svelte +1 -1
  85. package/src/lib/components/workflowEditor.svelte +3 -3
  86. package/src/lib/store.types.ts +1 -1
  87. package/vite-plugins/index.js +2 -4
  88. package/vite-plugins/lobb-extensions.js +12 -0
  89. package/vite-plugins/utils.js +15 -0
  90. package/vite-plugins/workspace-fs-allow.js +33 -0
  91. package/vite-plugins/contextual-lib-alias.js +0 -67
  92. package/vite-plugins/workspace-optimize.js +0 -106
@@ -1,67 +0,0 @@
1
- import path from "path";
2
- import fs from "fs";
3
-
4
- /**
5
- * Vite plugin that resolves $lib imports contextually based on the importing file's package.
6
- *
7
- * Walks up the directory tree from the importer to find the nearest package.json,
8
- * then checks if that package has a src/lib directory. If so, resolves $lib to that path.
9
- *
10
- * This allows any package using the src/lib convention to use $lib imports without conflicts.
11
- *
12
- * @returns {import('vite').Plugin}
13
- */
14
- export function contextualLibAlias() {
15
- const packageRootCache = new Map();
16
-
17
- function findPackageRoot(filePath) {
18
- const dir = path.dirname(filePath);
19
-
20
- // Check cache
21
- if (packageRootCache.has(dir)) {
22
- return packageRootCache.get(dir);
23
- }
24
-
25
- // Walk up directories to find package.json
26
- let currentDir = dir;
27
- const rootDir = path.parse(currentDir).root;
28
-
29
- while (currentDir !== rootDir) {
30
- const pkgPath = path.join(currentDir, "package.json");
31
- if (fs.existsSync(pkgPath)) {
32
- packageRootCache.set(dir, currentDir);
33
- return currentDir;
34
- }
35
- currentDir = path.dirname(currentDir);
36
- }
37
-
38
- // Not found
39
- packageRootCache.set(dir, null);
40
- return null;
41
- }
42
-
43
- return {
44
- name: "contextual-lib-alias",
45
- enforce: "pre",
46
-
47
- async resolveId(source, importer, options) {
48
- if (!source.startsWith("$lib")) return null;
49
- if (!importer) return null;
50
-
51
- // Find the package root for the importing file
52
- const packageRoot = findPackageRoot(importer);
53
- if (!packageRoot) return null;
54
-
55
- // Check if this package has src/lib
56
- const libPath = path.join(packageRoot, "src/lib");
57
- if (!fs.existsSync(libPath)) return null;
58
-
59
- // Resolve $lib to this package's src/lib
60
- const importPath = source.slice(4); // Remove "$lib"
61
- const resolvedPath = path.join(libPath, importPath);
62
-
63
- // Let Vite resolve the actual file (handles .js, .ts, .svelte extensions)
64
- return this.resolve(resolvedPath, importer, { skipSelf: true, ...options });
65
- }
66
- };
67
- }
@@ -1,106 +0,0 @@
1
- import { readdirSync, lstatSync, readFileSync, realpathSync } from "node:fs";
2
- import { join, resolve, dirname } from "node:path";
3
-
4
- /**
5
- * Auto-detects workspace-linked @lobb-js/* packages and configures Vite so
6
- * that monorepo dev and standalone npm-install users both work without manual
7
- * configuration:
8
- *
9
- * - exclude: Prevents vite-plugin-svelte's optimize-module from
10
- * running esbuild on raw .svelte source files.
11
- * - entries: Tells Vite to crawl workspace packages at startup so
12
- * all their deps are discovered and pre-bundled upfront
13
- * (avoids 504 timeouts on first browser load).
14
- * - holdUntilCrawlEnd: Blocks the first response until optimization is done.
15
- * - server.fs.allow: Allows Vite to serve files from the monorepo root
16
- * (needed to follow symlinks into workspace packages).
17
- *
18
- * For standalone users (real npm install, no symlinks) all lists are empty and
19
- * the config has no effect.
20
- *
21
- * @returns {import('vite').Plugin}
22
- */
23
- export function lobbWorkspaceOptimize() {
24
- return {
25
- name: "lobb-workspace-optimize",
26
- config(_, { command }) {
27
- if (command !== "serve") return;
28
-
29
- const workspacePkgs = getLobbWorkspacePackages();
30
- if (workspacePkgs.length === 0) return;
31
-
32
- return {
33
- optimizeDeps: {
34
- holdUntilCrawlEnd: true,
35
- entries: getWorkspaceEntries(workspacePkgs),
36
- exclude: workspacePkgs,
37
- },
38
- server: {
39
- fs: {
40
- allow: [getMonorepoRoot(workspacePkgs)].filter(Boolean),
41
- },
42
- },
43
- };
44
- },
45
- };
46
- }
47
-
48
- function getLobbWorkspacePackages() {
49
- const dir = resolve("node_modules/@lobb-js");
50
- try {
51
- return readdirSync(dir)
52
- .filter((pkg) => lstatSync(join(dir, pkg)).isSymbolicLink())
53
- .map((pkg) => `@lobb-js/${pkg}`);
54
- } catch {
55
- return [];
56
- }
57
- }
58
-
59
-
60
- function getMonorepoRoot(pkgNames) {
61
- for (const name of pkgNames) {
62
- try {
63
- const realPath = realpathSync(resolve(`node_modules/${name}`));
64
- // realPath is e.g. /root/lobb/packages/studio — go up to find the monorepo root
65
- let dir = realPath;
66
- for (let i = 0; i < 5; i++) {
67
- const parent = dirname(dir);
68
- if (parent === dir) break;
69
- const pkgJson = tryReadJson(join(parent, "package.json"));
70
- if (pkgJson?.workspaces) return parent;
71
- dir = parent;
72
- }
73
- } catch { /* skip */ }
74
- }
75
- return null;
76
- }
77
-
78
- function getWorkspaceEntries(pkgNames) {
79
- const entries = [];
80
- for (const name of pkgNames) {
81
- try {
82
- const realPath = realpathSync(resolve(`node_modules/${name}`));
83
- const pkg = tryReadJson(join(realPath, "package.json"));
84
- if (!pkg) continue;
85
- const exportsField = pkg.exports;
86
- const entry =
87
- pkg.svelte ??
88
- pkg.module ??
89
- pkg.main ??
90
- (typeof exportsField?.["."] === "string"
91
- ? exportsField["."]
92
- : exportsField?.["."]?.default);
93
- if (typeof entry === "string") entries.push(join(realPath, entry));
94
- } catch { /* skip */ }
95
- }
96
- return entries;
97
- }
98
-
99
-
100
- function tryReadJson(filePath) {
101
- try {
102
- return JSON.parse(readFileSync(filePath, "utf-8"));
103
- } catch {
104
- return null;
105
- }
106
- }