@lobb-js/studio 0.28.3 → 0.28.5
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/dist/actions.js +50 -137
- package/dist/components/dataTable/footer.svelte.d.ts +1 -1
- package/dist/components/dataTable/header.svelte.d.ts +1 -1
- package/dist/components/dataTable/utils.js +25 -29
- package/dist/components/detailView/utils.js +19 -21
- package/dist/components/landing.svelte.d.ts +1 -1
- package/dist/components/routes/data_model/utils.js +19 -23
- package/dist/components/ui/accordion/index.d.ts +1 -1
- package/dist/components/ui/accordion/index.js +1 -1
- package/dist/components/ui/alert-dialog/index.js +3 -3
- package/dist/components/ui/command/command-dialog.svelte.d.ts +1 -1
- package/dist/components/ui/command/command-input.svelte.d.ts +1 -1
- package/dist/components/ui/command/command.svelte.d.ts +1 -1
- package/dist/components/ui/command/index.js +1 -1
- package/dist/components/ui/dialog/index.js +4 -4
- package/dist/components/ui/input/input.svelte.d.ts +1 -1
- package/dist/components/ui/popover/index.js +3 -3
- package/dist/components/ui/range-calendar/range-calendar-day.svelte.d.ts +1 -1
- package/dist/components/ui/range-calendar/range-calendar.svelte.d.ts +1 -1
- package/dist/components/ui/select/index.d.ts +1 -1
- package/dist/components/ui/select/index.js +2 -2
- package/dist/components/ui/textarea/textarea.svelte.d.ts +1 -1
- package/dist/components/ui/tooltip/index.js +3 -3
- package/dist/context.js +1 -1
- package/dist/eventSystem.js +24 -84
- package/dist/extensions/extension.types.js +9 -1
- package/dist/extensions/extensionUtils.js +42 -112
- package/dist/relations.d.ts +1 -1
- package/dist/relations.js +9 -10
- package/dist/store.svelte.d.ts +2 -1
- package/dist/store.svelte.js +7 -53
- package/dist/utils.js +8 -13
- package/package.json +11 -8
- package/src/app.d.ts +19 -0
- package/src/app.html +13 -0
- package/src/routes/+page.svelte +6 -0
- package/vite-plugins/lobb-extensions.js +0 -11
- package/src/App.svelte +0 -5
- package/src/main.ts +0 -18
package/dist/actions.js
CHANGED
|
@@ -1,50 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
1
|
import { mount, unmount } from "svelte";
|
|
49
2
|
import ConfirmationDialog from "./components/confirmationDialog/confirmationDialog.svelte";
|
|
50
3
|
import CreateDetailView from "./components/detailView/create/createDetailView.svelte";
|
|
@@ -53,117 +6,77 @@ import DataTableDrawer from "./components/dataTableDrawer/dataTableDrawer.svelte
|
|
|
53
6
|
import { createStudioContextMap } from "./context";
|
|
54
7
|
import { getCollectionParamsFields } from "./components/dataTable/utils";
|
|
55
8
|
export function showDialog(title, description) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var targetElement = document.querySelector("main");
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
const targetElement = document.querySelector("main");
|
|
59
11
|
if (!targetElement)
|
|
60
12
|
throw new Error("main html element doesn't exist");
|
|
61
|
-
|
|
13
|
+
const mounted = mount(ConfirmationDialog, {
|
|
62
14
|
target: targetElement,
|
|
63
15
|
props: {
|
|
64
|
-
title
|
|
65
|
-
description
|
|
66
|
-
onDecision:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
resolve(result);
|
|
71
|
-
return [4 /*yield*/, unmount(mounted, { outro: true })];
|
|
72
|
-
case 1:
|
|
73
|
-
_a.sent();
|
|
74
|
-
return [2 /*return*/];
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}); },
|
|
16
|
+
title,
|
|
17
|
+
description,
|
|
18
|
+
onDecision: async (result) => {
|
|
19
|
+
resolve(result);
|
|
20
|
+
await unmount(mounted, { outro: true });
|
|
21
|
+
},
|
|
78
22
|
},
|
|
79
23
|
});
|
|
80
24
|
});
|
|
81
25
|
}
|
|
82
26
|
export function openCreateDetailView(studioContext, props) {
|
|
83
|
-
|
|
84
|
-
var targetElement = document.querySelector("main");
|
|
27
|
+
const targetElement = document.querySelector("main");
|
|
85
28
|
if (!targetElement)
|
|
86
29
|
throw new Error("main html element doesn't exist");
|
|
87
|
-
|
|
30
|
+
const mounted = mount(CreateDetailView, {
|
|
88
31
|
target: targetElement,
|
|
89
32
|
context: createStudioContextMap(studioContext),
|
|
90
|
-
props:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
case 1:
|
|
98
|
-
_b.sent();
|
|
99
|
-
return [2 /*return*/];
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}); } }),
|
|
33
|
+
props: {
|
|
34
|
+
...props,
|
|
35
|
+
onCancel: async () => {
|
|
36
|
+
props.onCancel?.();
|
|
37
|
+
await unmount(mounted, { outro: true });
|
|
38
|
+
},
|
|
39
|
+
},
|
|
103
40
|
});
|
|
104
41
|
}
|
|
105
|
-
export function openUpdateDetailView(studioContext, props) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
target: targetElement,
|
|
130
|
-
context: createStudioContextMap(studioContext),
|
|
131
|
-
props: __assign(__assign({}, props), { onCancel: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
132
|
-
var _a;
|
|
133
|
-
return __generator(this, function (_b) {
|
|
134
|
-
switch (_b.label) {
|
|
135
|
-
case 0:
|
|
136
|
-
(_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
137
|
-
return [4 /*yield*/, unmount(mounted, { outro: true })];
|
|
138
|
-
case 1:
|
|
139
|
-
_b.sent();
|
|
140
|
-
return [2 /*return*/];
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}); }, values: entry }),
|
|
144
|
-
});
|
|
145
|
-
return [2 /*return*/];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
42
|
+
export async function openUpdateDetailView(studioContext, props) {
|
|
43
|
+
const { lobb, ctx } = studioContext;
|
|
44
|
+
const params = {
|
|
45
|
+
fields: getCollectionParamsFields(ctx, props.collectionName, true),
|
|
46
|
+
filter: { id: props.recordId },
|
|
47
|
+
limit: 1,
|
|
48
|
+
};
|
|
49
|
+
const response = await lobb.findAll(props.collectionName, params);
|
|
50
|
+
const result = await response.json();
|
|
51
|
+
const entry = result.data[0];
|
|
52
|
+
const targetElement = document.querySelector("main");
|
|
53
|
+
if (!targetElement)
|
|
54
|
+
throw new Error("main html element doesn't exist");
|
|
55
|
+
const mounted = mount(UpdateDetailView, {
|
|
56
|
+
target: targetElement,
|
|
57
|
+
context: createStudioContextMap(studioContext),
|
|
58
|
+
props: {
|
|
59
|
+
...props,
|
|
60
|
+
onCancel: async () => {
|
|
61
|
+
props.onCancel?.();
|
|
62
|
+
await unmount(mounted, { outro: true });
|
|
63
|
+
},
|
|
64
|
+
values: entry,
|
|
65
|
+
},
|
|
148
66
|
});
|
|
149
67
|
}
|
|
150
68
|
export function openDataTableDrawer(studioContext, props) {
|
|
151
|
-
|
|
152
|
-
var targetElement = document.querySelector("main");
|
|
69
|
+
const targetElement = document.querySelector("main");
|
|
153
70
|
if (!targetElement)
|
|
154
71
|
throw new Error("main html element doesn't exist");
|
|
155
|
-
|
|
72
|
+
const mounted = mount(DataTableDrawer, {
|
|
156
73
|
target: targetElement,
|
|
157
74
|
context: createStudioContextMap(studioContext),
|
|
158
|
-
props:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
return [2 /*return*/];
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
}); } }),
|
|
75
|
+
props: {
|
|
76
|
+
...props,
|
|
77
|
+
onClose: async () => {
|
|
78
|
+
await unmount(mounted, { outro: true });
|
|
79
|
+
},
|
|
80
|
+
},
|
|
168
81
|
});
|
|
169
82
|
}
|
|
@@ -3,6 +3,6 @@ interface Props {
|
|
|
3
3
|
totalCount: number;
|
|
4
4
|
currentPage: number;
|
|
5
5
|
}
|
|
6
|
-
declare const Footer: import("svelte").Component<Props, {}, "
|
|
6
|
+
declare const Footer: import("svelte").Component<Props, {}, "limit" | "currentPage">;
|
|
7
7
|
type Footer = ReturnType<typeof Footer>;
|
|
8
8
|
export default Footer;
|
|
@@ -9,6 +9,6 @@ interface Props {
|
|
|
9
9
|
showImport?: boolean;
|
|
10
10
|
left?: Snippet<[]>;
|
|
11
11
|
}
|
|
12
|
-
declare const Header: import("svelte").Component<Props, {}, "
|
|
12
|
+
declare const Header: import("svelte").Component<Props, {}, "selectedRecords" | "params">;
|
|
13
13
|
type Header = ReturnType<typeof Header>;
|
|
14
14
|
export default Header;
|
|
@@ -2,12 +2,11 @@ import { getFieldRelationTarget } from "../../relations";
|
|
|
2
2
|
import { Binary, Braces, Brackets, Calendar, CalendarClock, Clock, Hash, Key, Link, Text, Type, } from "lucide-svelte/icons";
|
|
3
3
|
import { icons } from "lucide-svelte";
|
|
4
4
|
export function getCollectionColumns(ctx, collectionName) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if ((_a = field.ui) === null || _a === void 0 ? void 0 : _a.hidden)
|
|
5
|
+
const collectionFields = getFields(ctx, collectionName);
|
|
6
|
+
const headers = [];
|
|
7
|
+
for (const fieldName in collectionFields) {
|
|
8
|
+
const field = collectionFields[fieldName];
|
|
9
|
+
if (field.ui?.hidden)
|
|
11
10
|
continue;
|
|
12
11
|
headers.push({
|
|
13
12
|
id: field.key,
|
|
@@ -18,9 +17,8 @@ export function getCollectionColumns(ctx, collectionName) {
|
|
|
18
17
|
return headers;
|
|
19
18
|
}
|
|
20
19
|
export function getFieldIcon(ctx, fieldName, collectionName) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var uiIcon = (_a = field.ui) === null || _a === void 0 ? void 0 : _a.icon;
|
|
20
|
+
const field = getField(ctx, fieldName, collectionName);
|
|
21
|
+
const uiIcon = field.ui?.icon;
|
|
24
22
|
if (uiIcon && uiIcon in icons)
|
|
25
23
|
return icons[uiIcon];
|
|
26
24
|
if (fieldName === "id") {
|
|
@@ -42,9 +40,9 @@ export function getFieldIcon(ctx, fieldName, collectionName) {
|
|
|
42
40
|
return Binary;
|
|
43
41
|
}
|
|
44
42
|
else if (field.type === "integer") {
|
|
45
|
-
|
|
43
|
+
const target = getFieldRelationTarget(ctx, collectionName, fieldName);
|
|
46
44
|
if (target) {
|
|
47
|
-
|
|
45
|
+
const targetIcon = ctx.meta.collections[target]?.ui?.icon;
|
|
48
46
|
if (targetIcon && targetIcon in icons)
|
|
49
47
|
return icons[targetIcon];
|
|
50
48
|
return Link;
|
|
@@ -80,43 +78,41 @@ export function getField(ctx, fieldName, collectionName) {
|
|
|
80
78
|
export function getCollectionPrimaryField(ctx, collectionName) {
|
|
81
79
|
if (!ctx.meta.collections[collectionName])
|
|
82
80
|
return undefined;
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
const collectionFields = ctx.meta.collections[collectionName].fields;
|
|
82
|
+
const primaryFieldObject = Object.values(collectionFields).find((field) => field.type === "string");
|
|
85
83
|
if (primaryFieldObject &&
|
|
86
84
|
typeof primaryFieldObject === "object" &&
|
|
87
85
|
"key" in primaryFieldObject) {
|
|
88
|
-
|
|
86
|
+
const fieldName = primaryFieldObject.key;
|
|
89
87
|
return fieldName;
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
|
-
export function getCollectionParamsFields(ctx, collectionName, allFields) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
.filter(function (relation) {
|
|
90
|
+
export function getCollectionParamsFields(ctx, collectionName, allFields = false) {
|
|
91
|
+
const relations = ctx.meta.relations;
|
|
92
|
+
const foreignFields = relations
|
|
93
|
+
.filter((relation) => {
|
|
97
94
|
return relation.type !== "polymorphic" && relation.from.collection === collectionName;
|
|
98
95
|
})
|
|
99
|
-
.map(
|
|
96
|
+
.map((relation) => {
|
|
100
97
|
return {
|
|
101
98
|
field: relation.from.field,
|
|
102
99
|
collection: relation.to.collection,
|
|
103
100
|
};
|
|
104
101
|
});
|
|
105
|
-
|
|
106
|
-
for (
|
|
107
|
-
var foreignField = foreignFields_1[_i];
|
|
102
|
+
const columns = [];
|
|
103
|
+
for (const foreignField of foreignFields) {
|
|
108
104
|
if (!foreignField.collection || !ctx.meta.collections[foreignField.collection])
|
|
109
105
|
continue;
|
|
110
106
|
if (allFields) {
|
|
111
|
-
columns.push(
|
|
107
|
+
columns.push(`${foreignField.field}.*`);
|
|
112
108
|
}
|
|
113
109
|
else {
|
|
114
|
-
columns.push(
|
|
115
|
-
|
|
110
|
+
columns.push(`${foreignField.field}.id`);
|
|
111
|
+
const primaryField = getCollectionPrimaryField(ctx, foreignField.collection);
|
|
116
112
|
if (primaryField)
|
|
117
|
-
columns.push(
|
|
113
|
+
columns.push(`${foreignField.field}.${primaryField}`);
|
|
118
114
|
}
|
|
119
115
|
}
|
|
120
|
-
|
|
121
|
-
return
|
|
116
|
+
const foreignColumns = columns.join(",");
|
|
117
|
+
return `*${foreignColumns ? `,${foreignColumns}` : ""}`;
|
|
122
118
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import Mustache from "mustache";
|
|
2
2
|
import { getField } from "../dataTable/utils";
|
|
3
3
|
export function getDefaultEntry(ctx, fieldNames, collectionName, values) {
|
|
4
|
-
return Object.fromEntries(fieldNames.map(
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
return Object.fromEntries(fieldNames.map((fieldName) => {
|
|
5
|
+
let value = null;
|
|
6
|
+
const field = getField(ctx, fieldName, collectionName);
|
|
7
7
|
if (values && values[fieldName] !== undefined) {
|
|
8
8
|
value = values[fieldName];
|
|
9
9
|
}
|
|
10
10
|
else if (field.default !== undefined && field.default !== null) {
|
|
11
|
-
|
|
11
|
+
const defualtValue = field.default;
|
|
12
12
|
if (typeof defualtValue === "string") {
|
|
13
13
|
value = Mustache.render(defualtValue, {
|
|
14
14
|
now: new Date().toISOString(),
|
|
@@ -22,19 +22,18 @@ export function getDefaultEntry(ctx, fieldNames, collectionName, values) {
|
|
|
22
22
|
}));
|
|
23
23
|
}
|
|
24
24
|
export function buildChildren(ctx, collectionName, entry) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
for (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (!(childEntries === null || childEntries === void 0 ? void 0 : childEntries.length))
|
|
25
|
+
const childrenRelations = ctx.meta.relations.filter((relation) => relation.type !== "polymorphic" && relation.to.collection === collectionName);
|
|
26
|
+
const children = {};
|
|
27
|
+
for (const relation of childrenRelations) {
|
|
28
|
+
const childCollection = relation.from.collection;
|
|
29
|
+
const childEntries = entry[childCollection];
|
|
30
|
+
if (!childEntries?.length)
|
|
32
31
|
continue;
|
|
33
|
-
|
|
34
|
-
.filter(
|
|
35
|
-
|
|
36
|
-
.filter(
|
|
37
|
-
.map(
|
|
32
|
+
const toCreate = childEntries
|
|
33
|
+
.filter((e) => !e.id);
|
|
34
|
+
const toLink = childEntries
|
|
35
|
+
.filter((e) => e.id)
|
|
36
|
+
.map((e) => e.id);
|
|
38
37
|
if (toCreate.length || toLink.length) {
|
|
39
38
|
children[childCollection] = {};
|
|
40
39
|
if (toCreate.length)
|
|
@@ -46,11 +45,10 @@ export function buildChildren(ctx, collectionName, entry) {
|
|
|
46
45
|
return Object.keys(children).length ? children : undefined;
|
|
47
46
|
}
|
|
48
47
|
export function getCollectionFields(ctx, collectionName) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
for (
|
|
53
|
-
var fieldName = _a[_i][0];
|
|
48
|
+
let returnedData = [];
|
|
49
|
+
const collectionFields = ctx.meta.collections[collectionName].fields;
|
|
50
|
+
const isSingleton = ctx.meta.collections[collectionName].singleton;
|
|
51
|
+
for (const [fieldName] of Object.entries(collectionFields)) {
|
|
54
52
|
if (isSingleton && fieldName === "id") {
|
|
55
53
|
continue;
|
|
56
54
|
}
|
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import Dagre from '@dagrejs/dagre';
|
|
13
2
|
export function getLayoutedElements(nodes, edges) {
|
|
14
|
-
|
|
3
|
+
const g = new Dagre.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
|
|
15
4
|
g.setGraph({ rankdir: "LR" });
|
|
16
|
-
edges.forEach(
|
|
17
|
-
nodes.forEach(
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
edges.forEach((edge) => g.setEdge(edge.source, edge.target));
|
|
6
|
+
nodes.forEach((node) => {
|
|
7
|
+
return g.setNode(node.id, {
|
|
8
|
+
...node,
|
|
9
|
+
width: node.measured?.width ?? 0,
|
|
10
|
+
height: node.measured?.height ?? 0,
|
|
11
|
+
});
|
|
20
12
|
});
|
|
21
13
|
Dagre.layout(g);
|
|
22
14
|
return {
|
|
23
|
-
nodes: nodes.map(
|
|
24
|
-
|
|
25
|
-
var position = g.node(node.id);
|
|
15
|
+
nodes: nodes.map((node) => {
|
|
16
|
+
const position = g.node(node.id);
|
|
26
17
|
// We are shifting the dagre node position (anchor=center center) to the top left
|
|
27
18
|
// so it matches the Svelte Flow node anchor point (top left).
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return
|
|
19
|
+
const x = position.x - (node.measured?.width ?? 0) / 2;
|
|
20
|
+
const y = position.y - (node.measured?.height ?? 0) / 2;
|
|
21
|
+
return {
|
|
22
|
+
...node,
|
|
23
|
+
position: { x, y },
|
|
24
|
+
targetPosition: "left",
|
|
25
|
+
sourcePosition: "right",
|
|
26
|
+
};
|
|
31
27
|
}),
|
|
32
|
-
edges
|
|
28
|
+
edges,
|
|
33
29
|
};
|
|
34
30
|
}
|
|
@@ -2,5 +2,5 @@ import { Accordion as AccordionPrimitive } from "bits-ui";
|
|
|
2
2
|
import Content from "./accordion-content.svelte";
|
|
3
3
|
import Item from "./accordion-item.svelte";
|
|
4
4
|
import Trigger from "./accordion-trigger.svelte";
|
|
5
|
-
declare const Root: import("svelte").Component<AccordionPrimitive.RootProps, {}, "
|
|
5
|
+
declare const Root: import("svelte").Component<AccordionPrimitive.RootProps, {}, "ref" | "value">;
|
|
6
6
|
export { Root, Content, Item, Trigger, Root as Accordion, Content as AccordionContent, Item as AccordionItem, Trigger as AccordionTrigger, };
|
|
@@ -2,7 +2,7 @@ import { Accordion as AccordionPrimitive } from "bits-ui";
|
|
|
2
2
|
import Content from "./accordion-content.svelte";
|
|
3
3
|
import Item from "./accordion-item.svelte";
|
|
4
4
|
import Trigger from "./accordion-trigger.svelte";
|
|
5
|
-
|
|
5
|
+
const Root = AccordionPrimitive.Root;
|
|
6
6
|
export { Root, Content, Item, Trigger,
|
|
7
7
|
//
|
|
8
8
|
Root as Accordion, Content as AccordionContent, Item as AccordionItem, Trigger as AccordionTrigger, };
|
|
@@ -7,9 +7,9 @@ import Header from "./alert-dialog-header.svelte";
|
|
|
7
7
|
import Overlay from "./alert-dialog-overlay.svelte";
|
|
8
8
|
import Content from "./alert-dialog-content.svelte";
|
|
9
9
|
import Description from "./alert-dialog-description.svelte";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const Root = AlertDialogPrimitive.Root;
|
|
11
|
+
const Trigger = AlertDialogPrimitive.Trigger;
|
|
12
|
+
const Portal = AlertDialogPrimitive.Portal;
|
|
13
13
|
export { Root, Title, Action, Cancel, Portal, Footer, Header, Trigger, Overlay, Content, Description,
|
|
14
14
|
//
|
|
15
15
|
Root as AlertDialog, Title as AlertDialogTitle, Action as AlertDialogAction, Cancel as AlertDialogCancel, Portal as AlertDialogPortal, Footer as AlertDialogFooter, Header as AlertDialogHeader, Trigger as AlertDialogTrigger, Overlay as AlertDialogOverlay, Content as AlertDialogContent, Description as AlertDialogDescription, };
|
|
@@ -4,6 +4,6 @@ type $$ComponentProps = WithoutChildrenOrChild<DialogPrimitive.RootProps> & With
|
|
|
4
4
|
portalProps?: DialogPrimitive.PortalProps;
|
|
5
5
|
children: Snippet;
|
|
6
6
|
};
|
|
7
|
-
declare const CommandDialog: import("svelte").Component<$$ComponentProps, {}, "
|
|
7
|
+
declare const CommandDialog: import("svelte").Component<$$ComponentProps, {}, "ref" | "value" | "open">;
|
|
8
8
|
type CommandDialog = ReturnType<typeof CommandDialog>;
|
|
9
9
|
export default CommandDialog;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Command as CommandPrimitive } from "bits-ui";
|
|
2
|
-
declare const CommandInput: import("svelte").Component<CommandPrimitive.InputProps, {}, "
|
|
2
|
+
declare const CommandInput: import("svelte").Component<CommandPrimitive.InputProps, {}, "ref" | "value">;
|
|
3
3
|
type CommandInput = ReturnType<typeof CommandInput>;
|
|
4
4
|
export default CommandInput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Command as CommandPrimitive } from "bits-ui";
|
|
2
|
-
declare const Command: import("svelte").Component<CommandPrimitive.RootProps, {}, "
|
|
2
|
+
declare const Command: import("svelte").Component<CommandPrimitive.RootProps, {}, "ref" | "value">;
|
|
3
3
|
type Command = ReturnType<typeof Command>;
|
|
4
4
|
export default Command;
|
|
@@ -9,7 +9,7 @@ import List from "./command-list.svelte";
|
|
|
9
9
|
import Separator from "./command-separator.svelte";
|
|
10
10
|
import Shortcut from "./command-shortcut.svelte";
|
|
11
11
|
import LinkItem from "./command-link-item.svelte";
|
|
12
|
-
|
|
12
|
+
const Loading = CommandPrimitive.Loading;
|
|
13
13
|
export { Root, Dialog, Empty, Group, Item, LinkItem, Input, List, Separator, Shortcut, Loading,
|
|
14
14
|
//
|
|
15
15
|
Root as Command, Dialog as CommandDialog, Empty as CommandEmpty, Group as CommandGroup, Item as CommandItem, LinkItem as CommandLinkItem, Input as CommandInput, List as CommandList, Separator as CommandSeparator, Shortcut as CommandShortcut, Loading as CommandLoading, };
|
|
@@ -5,10 +5,10 @@ import Header from "./dialog-header.svelte";
|
|
|
5
5
|
import Overlay from "./dialog-overlay.svelte";
|
|
6
6
|
import Content from "./dialog-content.svelte";
|
|
7
7
|
import Description from "./dialog-description.svelte";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const Root = DialogPrimitive.Root;
|
|
9
|
+
const Trigger = DialogPrimitive.Trigger;
|
|
10
|
+
const Close = DialogPrimitive.Close;
|
|
11
|
+
const Portal = DialogPrimitive.Portal;
|
|
12
12
|
export { Root, Title, Portal, Footer, Header, Trigger, Overlay, Content, Description, Close,
|
|
13
13
|
//
|
|
14
14
|
Root as Dialog, Title as DialogTitle, Portal as DialogPortal, Footer as DialogFooter, Header as DialogHeader, Trigger as DialogTrigger, Overlay as DialogOverlay, Content as DialogContent, Description as DialogDescription, Close as DialogClose, };
|
|
@@ -8,6 +8,6 @@ type Props = WithElementRef<Omit<HTMLInputAttributes, "type"> & ({
|
|
|
8
8
|
type?: InputType;
|
|
9
9
|
files?: undefined;
|
|
10
10
|
})>;
|
|
11
|
-
declare const Input: import("svelte").Component<Props, {}, "
|
|
11
|
+
declare const Input: import("svelte").Component<Props, {}, "ref" | "value" | "files">;
|
|
12
12
|
type Input = ReturnType<typeof Input>;
|
|
13
13
|
export default Input;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Popover as PopoverPrimitive } from "bits-ui";
|
|
2
2
|
import Content from "./popover-content.svelte";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const Root = PopoverPrimitive.Root;
|
|
4
|
+
const Trigger = PopoverPrimitive.Trigger;
|
|
5
|
+
const Close = PopoverPrimitive.Close;
|
|
6
6
|
export { Root, Content, Trigger, Close,
|
|
7
7
|
//
|
|
8
8
|
Root as Popover, Content as PopoverContent, Trigger as PopoverTrigger, Close as PopoverClose, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
2
|
declare const RangeCalendarDay: import("svelte").Component<RangeCalendarPrimitive.DayProps, {
|
|
3
|
-
class: import("svelte/elements
|
|
3
|
+
class: import("svelte/elements").ClassValue | null | undefined;
|
|
4
4
|
}, "ref">;
|
|
5
5
|
type RangeCalendarDay = ReturnType<typeof RangeCalendarDay>;
|
|
6
6
|
export default RangeCalendarDay;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
|
|
2
2
|
import * as RangeCalendar from "./index.js";
|
|
3
|
-
declare const RangeCalendar: import("svelte").Component<Omit<Omit<RangeCalendarPrimitive.RootProps, "child">, "children">, {}, "
|
|
3
|
+
declare const RangeCalendar: import("svelte").Component<Omit<Omit<RangeCalendarPrimitive.RootProps, "child">, "children">, {}, "placeholder" | "ref" | "value">;
|
|
4
4
|
type RangeCalendar = ReturnType<typeof RangeCalendar>;
|
|
5
5
|
export default RangeCalendar;
|
|
@@ -6,6 +6,6 @@ import Trigger from "./select-trigger.svelte";
|
|
|
6
6
|
import Separator from "./select-separator.svelte";
|
|
7
7
|
import ScrollDownButton from "./select-scroll-down-button.svelte";
|
|
8
8
|
import ScrollUpButton from "./select-scroll-up-button.svelte";
|
|
9
|
-
declare const Root: import("svelte").Component<import("bits-ui").ComboboxRootPropsWithoutHTML, {}, "
|
|
9
|
+
declare const Root: import("svelte").Component<import("bits-ui").ComboboxRootPropsWithoutHTML, {}, "value" | "open">;
|
|
10
10
|
declare const Group: import("svelte").Component<SelectPrimitive.GroupProps, {}, "ref">;
|
|
11
11
|
export { Root, Item, Group, GroupHeading, Content, Trigger, Separator, ScrollDownButton, ScrollUpButton, Root as Select, Item as SelectItem, Group as SelectGroup, GroupHeading as SelectGroupHeading, Content as SelectContent, Trigger as SelectTrigger, Separator as SelectSeparator, ScrollDownButton as SelectScrollDownButton, ScrollUpButton as SelectScrollUpButton, };
|
|
@@ -6,8 +6,8 @@ import Trigger from "./select-trigger.svelte";
|
|
|
6
6
|
import Separator from "./select-separator.svelte";
|
|
7
7
|
import ScrollDownButton from "./select-scroll-down-button.svelte";
|
|
8
8
|
import ScrollUpButton from "./select-scroll-up-button.svelte";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const Root = SelectPrimitive.Root;
|
|
10
|
+
const Group = SelectPrimitive.Group;
|
|
11
11
|
export { Root, Item, Group, GroupHeading, Content, Trigger, Separator, ScrollDownButton, ScrollUpButton,
|
|
12
12
|
//
|
|
13
13
|
Root as Select, Item as SelectItem, Group as SelectGroup, GroupHeading as SelectGroupHeading, Content as SelectContent, Trigger as SelectTrigger, Separator as SelectSeparator, ScrollDownButton as SelectScrollDownButton, ScrollUpButton as SelectScrollUpButton, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WithElementRef } from "bits-ui";
|
|
2
2
|
import type { HTMLTextareaAttributes } from "svelte/elements";
|
|
3
|
-
declare const Textarea: import("svelte").Component<Omit<WithElementRef<HTMLTextareaAttributes>, "children">, {}, "
|
|
3
|
+
declare const Textarea: import("svelte").Component<Omit<WithElementRef<HTMLTextareaAttributes>, "children">, {}, "ref" | "value">;
|
|
4
4
|
type Textarea = ReturnType<typeof Textarea>;
|
|
5
5
|
export default Textarea;
|