@lobb-js/studio 0.28.3 → 0.28.4

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 (38) hide show
  1. package/dist/actions.js +50 -137
  2. package/dist/components/dataTable/footer.svelte.d.ts +1 -1
  3. package/dist/components/dataTable/header.svelte.d.ts +1 -1
  4. package/dist/components/dataTable/utils.js +25 -29
  5. package/dist/components/detailView/utils.js +19 -21
  6. package/dist/components/landing.svelte.d.ts +1 -1
  7. package/dist/components/routes/data_model/utils.js +19 -23
  8. package/dist/components/ui/accordion/index.d.ts +1 -1
  9. package/dist/components/ui/accordion/index.js +1 -1
  10. package/dist/components/ui/alert-dialog/index.js +3 -3
  11. package/dist/components/ui/command/command-dialog.svelte.d.ts +1 -1
  12. package/dist/components/ui/command/command-input.svelte.d.ts +1 -1
  13. package/dist/components/ui/command/command.svelte.d.ts +1 -1
  14. package/dist/components/ui/command/index.js +1 -1
  15. package/dist/components/ui/dialog/index.js +4 -4
  16. package/dist/components/ui/input/input.svelte.d.ts +1 -1
  17. package/dist/components/ui/popover/index.js +3 -3
  18. package/dist/components/ui/range-calendar/range-calendar-day.svelte.d.ts +1 -1
  19. package/dist/components/ui/range-calendar/range-calendar.svelte.d.ts +1 -1
  20. package/dist/components/ui/select/index.d.ts +1 -1
  21. package/dist/components/ui/select/index.js +2 -2
  22. package/dist/components/ui/textarea/textarea.svelte.d.ts +1 -1
  23. package/dist/components/ui/tooltip/index.js +3 -3
  24. package/dist/context.js +1 -1
  25. package/dist/eventSystem.js +24 -84
  26. package/dist/extensions/extension.types.js +9 -1
  27. package/dist/extensions/extensionUtils.js +42 -112
  28. package/dist/relations.d.ts +1 -1
  29. package/dist/relations.js +9 -10
  30. package/dist/store.svelte.d.ts +2 -1
  31. package/dist/store.svelte.js +7 -53
  32. package/dist/utils.js +8 -13
  33. package/package.json +8 -5
  34. package/src/app.d.ts +19 -0
  35. package/src/app.html +13 -0
  36. package/src/routes/+page.svelte +6 -0
  37. package/src/App.svelte +0 -5
  38. 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
- var _this = this;
57
- return new Promise(function (resolve) {
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
- var mounted = mount(ConfirmationDialog, {
13
+ const mounted = mount(ConfirmationDialog, {
62
14
  target: targetElement,
63
15
  props: {
64
- title: title,
65
- description: description,
66
- onDecision: function (result) { return __awaiter(_this, void 0, void 0, function () {
67
- return __generator(this, function (_a) {
68
- switch (_a.label) {
69
- case 0:
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
- var _this = this;
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
- var mounted = mount(CreateDetailView, {
30
+ const mounted = mount(CreateDetailView, {
88
31
  target: targetElement,
89
32
  context: createStudioContextMap(studioContext),
90
- props: __assign(__assign({}, props), { onCancel: function () { return __awaiter(_this, void 0, void 0, function () {
91
- var _a;
92
- return __generator(this, function (_b) {
93
- switch (_b.label) {
94
- case 0:
95
- (_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props);
96
- return [4 /*yield*/, unmount(mounted, { outro: true })];
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
- return __awaiter(this, void 0, void 0, function () {
107
- var lobb, ctx, params, response, result, entry, targetElement, mounted;
108
- var _this = this;
109
- return __generator(this, function (_a) {
110
- switch (_a.label) {
111
- case 0:
112
- lobb = studioContext.lobb, ctx = studioContext.ctx;
113
- params = {
114
- fields: getCollectionParamsFields(ctx, props.collectionName, true),
115
- filter: { id: props.recordId },
116
- limit: 1,
117
- };
118
- return [4 /*yield*/, lobb.findAll(props.collectionName, params)];
119
- case 1:
120
- response = _a.sent();
121
- return [4 /*yield*/, response.json()];
122
- case 2:
123
- result = _a.sent();
124
- entry = result.data[0];
125
- targetElement = document.querySelector("main");
126
- if (!targetElement)
127
- throw new Error("main html element doesn't exist");
128
- mounted = mount(UpdateDetailView, {
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
- var _this = this;
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
- var mounted = mount(DataTableDrawer, {
72
+ const mounted = mount(DataTableDrawer, {
156
73
  target: targetElement,
157
74
  context: createStudioContextMap(studioContext),
158
- props: __assign(__assign({}, props), { onClose: function () { return __awaiter(_this, void 0, void 0, function () {
159
- return __generator(this, function (_a) {
160
- switch (_a.label) {
161
- case 0: return [4 /*yield*/, unmount(mounted, { outro: true })];
162
- case 1:
163
- _a.sent();
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, {}, "currentPage" | "limit">;
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, {}, "params" | "selectedRecords">;
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
- var _a;
6
- var collectionFields = getFields(ctx, collectionName);
7
- var headers = [];
8
- for (var fieldName in collectionFields) {
9
- var field = collectionFields[fieldName];
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
- var _a, _b, _c;
22
- var field = getField(ctx, fieldName, collectionName);
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
- var target = getFieldRelationTarget(ctx, collectionName, fieldName);
43
+ const target = getFieldRelationTarget(ctx, collectionName, fieldName);
46
44
  if (target) {
47
- var targetIcon = (_c = (_b = ctx.meta.collections[target]) === null || _b === void 0 ? void 0 : _b.ui) === null || _c === void 0 ? void 0 : _c.icon;
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
- var collectionFields = ctx.meta.collections[collectionName].fields;
84
- var primaryFieldObject = Object.values(collectionFields).find(function (field) { return field.type === "string"; });
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
- var fieldName = primaryFieldObject.key;
86
+ const fieldName = primaryFieldObject.key;
89
87
  return fieldName;
90
88
  }
91
89
  }
92
- export function getCollectionParamsFields(ctx, collectionName, allFields) {
93
- if (allFields === void 0) { allFields = false; }
94
- var relations = ctx.meta.relations;
95
- var foreignFields = relations
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(function (relation) {
96
+ .map((relation) => {
100
97
  return {
101
98
  field: relation.from.field,
102
99
  collection: relation.to.collection,
103
100
  };
104
101
  });
105
- var columns = [];
106
- for (var _i = 0, foreignFields_1 = foreignFields; _i < foreignFields_1.length; _i++) {
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("".concat(foreignField.field, ".*"));
107
+ columns.push(`${foreignField.field}.*`);
112
108
  }
113
109
  else {
114
- columns.push("".concat(foreignField.field, ".id"));
115
- var primaryField = getCollectionPrimaryField(ctx, foreignField.collection);
110
+ columns.push(`${foreignField.field}.id`);
111
+ const primaryField = getCollectionPrimaryField(ctx, foreignField.collection);
116
112
  if (primaryField)
117
- columns.push("".concat(foreignField.field, ".").concat(primaryField));
113
+ columns.push(`${foreignField.field}.${primaryField}`);
118
114
  }
119
115
  }
120
- var foreignColumns = columns.join(",");
121
- return "*".concat(foreignColumns ? ",".concat(foreignColumns) : "");
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(function (fieldName) {
5
- var value = null;
6
- var field = getField(ctx, fieldName, collectionName);
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
- var defualtValue = field.default;
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
- var childrenRelations = ctx.meta.relations.filter(function (relation) { return relation.type !== "polymorphic" && relation.to.collection === collectionName; });
26
- var children = {};
27
- for (var _i = 0, childrenRelations_1 = childrenRelations; _i < childrenRelations_1.length; _i++) {
28
- var relation = childrenRelations_1[_i];
29
- var childCollection = relation.from.collection;
30
- var childEntries = entry[childCollection];
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
- var toCreate = childEntries
34
- .filter(function (e) { return !e.id; });
35
- var toLink = childEntries
36
- .filter(function (e) { return e.id; })
37
- .map(function (e) { return e.id; });
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
- var returnedData = [];
50
- var collectionFields = ctx.meta.collections[collectionName].fields;
51
- var isSingleton = ctx.meta.collections[collectionName].singleton;
52
- for (var _i = 0, _a = Object.entries(collectionFields); _i < _a.length; _i++) {
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
  }
@@ -4,7 +4,7 @@ type Landing = SvelteComponent<{
4
4
  }, {
5
5
  [evt: string]: CustomEvent<any>;
6
6
  }, {}> & {
7
- $$bindings?: string;
7
+ $$bindings?: string | undefined;
8
8
  };
9
9
  declare const Landing: $$__sveltets_2_IsomorphicComponent<{
10
10
  [x: string]: never;
@@ -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
- var g = new Dagre.graphlib.Graph().setDefaultEdgeLabel(function () { return ({}); });
3
+ const g = new Dagre.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
15
4
  g.setGraph({ rankdir: "LR" });
16
- edges.forEach(function (edge) { return g.setEdge(edge.source, edge.target); });
17
- nodes.forEach(function (node) {
18
- var _a, _b, _c, _d;
19
- return g.setNode(node.id, __assign(__assign({}, node), { width: (_b = (_a = node.measured) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 0, height: (_d = (_c = node.measured) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 0 }));
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(function (node) {
24
- var _a, _b, _c, _d;
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
- var x = position.x - ((_b = (_a = node.measured) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : 0) / 2;
29
- var y = position.y - ((_d = (_c = node.measured) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 0) / 2;
30
- return __assign(__assign({}, node), { position: { x: x, y: y }, targetPosition: "left", sourcePosition: "right" });
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: 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, {}, "value" | "ref">;
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
- var Root = AccordionPrimitive.Root;
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
- var Root = AlertDialogPrimitive.Root;
11
- var Trigger = AlertDialogPrimitive.Trigger;
12
- var Portal = AlertDialogPrimitive.Portal;
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, {}, "open" | "value" | "ref">;
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, {}, "value" | "ref">;
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, {}, "value" | "ref">;
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
- var Loading = CommandPrimitive.Loading;
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
- var Root = DialogPrimitive.Root;
9
- var Trigger = DialogPrimitive.Trigger;
10
- var Close = DialogPrimitive.Close;
11
- var Portal = DialogPrimitive.Portal;
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, {}, "value" | "ref" | "files">;
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
- var Root = PopoverPrimitive.Root;
4
- var Trigger = PopoverPrimitive.Trigger;
5
- var Close = PopoverPrimitive.Close;
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.js").ClassValue;
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">, {}, "value" | "ref" | "placeholder">;
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, {}, "open" | "value">;
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
- var Root = SelectPrimitive.Root;
10
- var Group = SelectPrimitive.Group;
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">, {}, "value" | "ref">;
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;