@reforma/components 0.5.0 → 0.6.1

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 (35) hide show
  1. package/dist/SortableList/SortableList.d.ts +9 -3
  2. package/dist/SortableList/SortableList.d.ts.map +1 -1
  3. package/dist/SortableList/SortableList.js +178 -163
  4. package/dist/SortableList/SortableList.js.map +1 -1
  5. package/dist/chat/ComposerBanner/ComposerBanner.d.ts +1 -1
  6. package/dist/chat/ComposerBanner/ComposerBanner.d.ts.map +1 -1
  7. package/dist/chat/ComposerBanner/ComposerBanner.js.map +1 -1
  8. package/dist/chat/ComposerBanner/ComposerBanner.module.css +1 -1
  9. package/dist/chat/ComposerBanner/ComposerBanner.module.css.js +5 -5
  10. package/dist/chat/Message/segments/MessagePhaseSection.module.css +1 -1
  11. package/dist/chat/Message/turn/MessageAssistantBody.d.ts +2 -1
  12. package/dist/chat/Message/turn/MessageAssistantBody.d.ts.map +1 -1
  13. package/dist/chat/Message/turn/MessageAssistantBody.js +62 -58
  14. package/dist/chat/Message/turn/MessageAssistantBody.js.map +1 -1
  15. package/dist/chat/Message/turn/workedCollapse.d.ts +6 -2
  16. package/dist/chat/Message/turn/workedCollapse.d.ts.map +1 -1
  17. package/dist/chat/Message/turn/workedCollapse.js +24 -18
  18. package/dist/chat/Message/turn/workedCollapse.js.map +1 -1
  19. package/dist/chat/Tool/agent/AgentTool.js +5 -5
  20. package/dist/chat/Tool/agent/AgentTool.js.map +1 -1
  21. package/dist/chat/Tool/bash/BashTool.d.ts.map +1 -1
  22. package/dist/chat/Tool/bash/BashTool.js +50 -57
  23. package/dist/chat/Tool/bash/BashTool.js.map +1 -1
  24. package/dist/chat/Tool/bash/BashTool.module.css +1 -1
  25. package/dist/chat/Tool/bash/BashTool.module.css.js +4 -8
  26. package/dist/chat/Tool/bash/BashTool.module.css.js.map +1 -1
  27. package/dist/chat/Tool/image-asset/ImageAssetTool.js +1 -1
  28. package/dist/chat/Tool/image-asset/ImageAssetTool.js.map +1 -1
  29. package/dist/chat/Tool/shell/ToolShell.js +1 -1
  30. package/dist/chat/Tool/shell/ToolShell.js.map +1 -1
  31. package/dist/chat/Tool/shell/ToolShellCard.js +7 -7
  32. package/dist/chat/Tool/shell/ToolShellCard.js.map +1 -1
  33. package/dist/openui/functions/index.d.ts +59 -59
  34. package/dist/openui/functions/index.d.ts.map +1 -1
  35. package/package.json +2 -2
@@ -35,13 +35,19 @@ interface SortableListBaseProps<T> {
35
35
  items: readonly T[];
36
36
  getKey?: (item: T, path: readonly number[]) => string;
37
37
  getTextValue: (item: T) => string;
38
- onChange: (items: T[]) => void;
38
+ /** `move` is the dragged item and its index among its new siblings. */
39
+ onChange: (items: T[], move: {
40
+ item: T;
41
+ index: number;
42
+ }) => void;
39
43
  children: (item: T, props: SortableListItemRenderProps<T>) => ReactNode;
40
44
  canDrop?: (context: SortableListDropContext<T>) => boolean;
41
45
  getDragHandleOptions?: (item: T, context: SortableListItemContext<T>) => SortableListDragHandleOptions;
42
46
  className?: string;
43
47
  gap?: 'sm' | 'md';
44
48
  nestedGap?: 'sm' | 'md';
49
+ /** `false` drops the grip: the whole item starts a drag. Default `true`. */
50
+ handle?: boolean;
45
51
  'aria-label': string;
46
52
  }
47
53
  interface FlatSortableListProps {
@@ -56,12 +62,12 @@ interface NestedSortableListProps<T> {
56
62
  }
57
63
  export type SortableListProps<T> = SortableListBaseProps<T> & (FlatSortableListProps | NestedSortableListProps<T>);
58
64
  /**
59
- * Sortable collection with a dedicated pointer handle and optional child groups.
65
+ * Sortable collection with a pointer handle (or whole-item drag) and optional child groups.
60
66
  *
61
67
  * The rendered item is the complete draggable surface. Child collections can
62
68
  * accept moves when the caller's drop rules allow it.
63
69
  */
64
- export declare function SortableList<T>({ items, getKey: getItemKey, getTextValue, getChildren, setChildren, canHaveChildren, onChange, children, canDrop, getDragHandleOptions, className, gap, nestedGap, 'aria-label': ariaLabel, }: SortableListProps<T>): import("react").JSX.Element;
70
+ export declare function SortableList<T>({ items, getKey: getItemKey, getTextValue, getChildren, setChildren, canHaveChildren, onChange, children, canDrop, getDragHandleOptions, className, gap, nestedGap, handle, 'aria-label': ariaLabel, }: SortableListProps<T>): import("react").JSX.Element;
65
71
  export declare namespace SortableList {
66
72
  var displayName: string;
67
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SortableList.d.ts","sourceRoot":"","sources":["../../src/SortableList/SortableList.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,MAAM,MAAM,+BAA+B,GAAG,QAAQ,GAAG,KAAK,CAAC;AAC/D,MAAM,MAAM,gCAAgC,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AACpE,MAAM,MAAM,6BAA6B,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,6BAA6B;IAC1C,SAAS,CAAC,EAAE,+BAA+B,CAAC;IAC5C,UAAU,CAAC,EAAE,gCAAgC,CAAC;IAC9C,OAAO,CAAC,EAAE,6BAA6B,CAAC;CAC3C;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B,CAAC,CAAC,CAAE,SAAQ,uBAAuB,CAAC,CAAC,CAAC;IAC9E,WAAW,EAAE,SAAS,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACtC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;I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,CAAC,CAAC,+BAgKtB;yBAhLe,YAAY"}
@@ -1,192 +1,203 @@
1
- import { DragDropProvider as Z, PointerSensor as G, DragOverlay as ee, useDroppable as ne } from "@dnd-kit/react";
2
- import { isSortable as _, useSortable as te } from "@dnd-kit/react/sortable";
3
- import { DotsDrag as re } from "@reforma/icons/14";
4
- import { cn as ie } from "@reforma/lib";
5
- import { useRef as j, useCallback as oe, useMemo as ae } from "react";
6
- import { For as F } from "../For/For.js";
1
+ import { DragDropProvider as ee, PointerSensor as ne, DragOverlay as te, useDroppable as re } from "@dnd-kit/react";
2
+ import { isSortable as _, useSortable as ie } from "@dnd-kit/react/sortable";
3
+ import { DotsDrag as oe } from "@reforma/icons/14";
4
+ import { cn as ae } from "@reforma/lib";
5
+ import { useCallback as le, useMemo as se, useState as de } from "react";
6
+ import { For as j } from "../For/For.js";
7
+ import { Show as ce } from "../Show/Show.js";
7
8
  import f from "./SortableList.module.css.js";
8
- import { buildSortableTree as le, moveSortableTreeNodeToIndex as se, restoreSortableTree as ce, findSortableTreeNode as $ } from "./sortableTree.js";
9
- import { jsxs as w, jsx as o } from "react/jsx-runtime";
10
- const A = "reforma-sortable:root", D = "reforma-sortable:children:", de = "reforma-sortable:item", ue = "reforma-sortable:collection", fe = [G], me = "sortable:primitive:";
11
- function ge({
9
+ import { buildSortableTree as ue, moveSortableTreeNodeToIndex as fe, restoreSortableTree as me, findSortableTreeNode as $ } from "./sortableTree.js";
10
+ import { jsxs as A, jsx as o } from "react/jsx-runtime";
11
+ const H = "reforma-sortable:root", D = "reforma-sortable:children:", ve = "reforma-sortable:item", pe = "reforma-sortable:collection", ge = [ne], he = "sortable:primitive:", w = /* @__PURE__ */ new WeakMap();
12
+ let F = 0;
13
+ function be({
12
14
  items: e,
13
15
  getKey: n,
14
16
  getTextValue: t,
15
17
  getChildren: r,
16
18
  setChildren: i,
17
19
  canHaveChildren: a,
18
- onChange: u,
19
- children: h,
20
- canDrop: m,
20
+ onChange: c,
21
+ children: m,
22
+ canDrop: v,
21
23
  getDragHandleOptions: x,
22
24
  className: P,
23
- gap: y = "md",
24
- nestedGap: s = y,
25
- "aria-label": S
25
+ gap: b = "md",
26
+ nestedGap: S = b,
27
+ handle: u = !0,
28
+ "aria-label": I
26
29
  }) {
27
- const g = j({
28
- nextId: 0,
29
- objectKeys: /* @__PURE__ */ new WeakMap()
30
- }), T = oe((c, v) => {
31
- const C = n?.(c, v);
32
- if (C != null)
33
- return C;
34
- if (typeof c != "object" || c == null)
35
- return `${me}${v.join(".")}`;
36
- const d = g.current.objectKeys.get(c);
30
+ const y = le((s, g) => {
31
+ const E = n?.(s, g);
32
+ if (E != null)
33
+ return E;
34
+ if (typeof s != "object" || s == null)
35
+ return `${he}${g.join(".")}`;
36
+ const d = w.get(s);
37
37
  if (d)
38
38
  return d;
39
- const b = `sortable:item:${g.current.nextId}`;
40
- return g.current.nextId += 1, g.current.objectKeys.set(c, b), b;
41
- }, [n]), p = ae(() => le(e, {
42
- getKey: T,
39
+ const h = `sortable:item:${F}`;
40
+ return F += 1, w.set(s, h), h;
41
+ }, [n]), p = se(() => ue(e, {
42
+ getKey: y,
43
43
  getTextValue: t,
44
44
  getChildren: r,
45
45
  canHaveChildren: a
46
- }), [a, r, T, t, e]), I = j({
46
+ }), [a, r, y, t, e]), [N, Q] = de({
47
47
  items: e,
48
48
  revision: 0
49
49
  });
50
- I.current.items !== e && (I.current = {
50
+ N.items !== e && Q({
51
51
  items: e,
52
- revision: I.current.revision + 1
52
+ revision: N.revision + 1
53
53
  });
54
- function J(c) {
54
+ function U(s) {
55
55
  const {
56
- canceled: v,
57
- operation: C
58
- } = c, {
56
+ canceled: g,
57
+ operation: E
58
+ } = s, {
59
59
  source: d,
60
- target: b
61
- } = C;
62
- if (v || !d || !_(d))
60
+ target: h
61
+ } = E;
62
+ if (g || !d || !_(d))
63
63
  return;
64
- const E = O(d)?.node;
65
- if (!E)
64
+ const T = O(d)?.node;
65
+ if (!T)
66
66
  return;
67
- const N = q(b), L = N?.kind === "node" ? N.node : null;
67
+ const C = J(h), L = C?.kind === "node" ? C.node : null;
68
68
  let l;
69
- if (N?.kind === "collection" ? l = {
70
- parentNode: N.parentNode,
71
- index: N.parentNode?.children.length ?? p.length,
69
+ if (C?.kind === "collection" ? l = {
70
+ parentNode: C.parentNode,
71
+ index: C.parentNode?.children.length ?? p.length,
72
72
  dropPosition: "end"
73
- } : L && b && _(b) ? l = ve(p, b.group, d.index, L) : l = null, !l)
73
+ } : L && h && _(h) ? l = xe(p, h.group, d.index, L) : l = null, !l)
74
74
  return;
75
- const Q = W(E, l.parentNode, L, l.dropPosition);
76
- if (!X(E, l.parentNode) || m && !m(Q))
75
+ const Z = X(T, l.parentNode, L, l.dropPosition);
76
+ if (!z(T, l.parentNode) || v && !v(Z))
77
77
  return;
78
- const K = V(d.initialGroup), R = l.parentNode?.id ?? null;
78
+ const K = q(d.initialGroup), R = l.parentNode?.id ?? null;
79
79
  if (K !== void 0 && K === R && d.initialIndex === l.index)
80
80
  return;
81
- const U = se(p, E.id, R, l.index);
82
- u(ce(U, i));
81
+ const G = fe(p, T.id, R, l.index);
82
+ c(me(G, i), {
83
+ item: T.value,
84
+ index: l.index
85
+ });
83
86
  }
84
- return /* @__PURE__ */ w(Z, {
85
- sensors: fe,
86
- onDragEnd: J,
87
- children: [/* @__PURE__ */ o(H, {
88
- nodes: p,
89
- rootNodes: p,
90
- parentNode: null,
91
- renderItem: h,
92
- canDrop: m,
93
- getDragHandleOptions: x,
94
- className: P,
95
- gap: y,
96
- nestedGap: s,
97
- ariaLabel: S
98
- }), /* @__PURE__ */ o(ee, {
99
- className: f.dragOverlay,
100
- dropAnimation: {
101
- duration: 160,
102
- easing: "cubic-bezier(0.25, 1, 0.5, 1)"
103
- },
104
- children: (c) => {
105
- const v = O(c)?.node;
106
- return v ? /* @__PURE__ */ o(M, {
107
- node: v,
108
- renderItem: h,
109
- nestedGap: s
110
- }) : null;
111
- }
112
- })]
113
- }, I.current.revision);
87
+ return /* @__PURE__ */ A(
88
+ ee,
89
+ {
90
+ sensors: ge,
91
+ onDragEnd: U,
92
+ children: [/* @__PURE__ */ o(M, {
93
+ nodes: p,
94
+ rootNodes: p,
95
+ parentNode: null,
96
+ renderItem: m,
97
+ canDrop: v,
98
+ getDragHandleOptions: x,
99
+ className: P,
100
+ gap: b,
101
+ nestedGap: S,
102
+ handle: u,
103
+ ariaLabel: I
104
+ }), /* @__PURE__ */ o(te, {
105
+ className: f.dragOverlay,
106
+ dropAnimation: {
107
+ duration: 160,
108
+ easing: "cubic-bezier(0.25, 1, 0.5, 1)"
109
+ },
110
+ children: (s) => {
111
+ const g = O(s)?.node;
112
+ return g ? /* @__PURE__ */ o(Y, {
113
+ node: g,
114
+ renderItem: m,
115
+ nestedGap: S
116
+ }) : null;
117
+ }
118
+ })]
119
+ },
120
+ r ? N.revision : void 0
121
+ );
114
122
  }
115
- function H({
123
+ function M({
116
124
  nodes: e,
117
125
  rootNodes: n,
118
126
  parentNode: t,
119
127
  renderItem: r,
120
128
  canDrop: i,
121
129
  getDragHandleOptions: a,
122
- className: u,
123
- gap: h,
124
- nestedGap: m,
125
- ariaLabel: x
130
+ className: c,
131
+ gap: m,
132
+ nestedGap: v,
133
+ handle: x,
134
+ ariaLabel: P
126
135
  }) {
127
136
  const {
128
- ref: P,
129
- isDropTarget: y
130
- } = ne({
131
- id: be(t),
132
- type: ue,
137
+ ref: b,
138
+ isDropTarget: S
139
+ } = re({
140
+ id: Pe(t),
141
+ type: pe,
133
142
  data: {
134
143
  kind: "collection",
135
144
  parentNode: t
136
145
  },
137
146
  disabled: e.length > 0,
138
147
  collisionPriority: 1,
139
- accept: (s) => B(s, t, null, "end", i)
148
+ accept: (u) => W(u, t, null, "end", i)
140
149
  });
141
150
  return /* @__PURE__ */ o("div", {
142
- ref: P,
151
+ ref: b,
143
152
  role: "list",
144
- className: ie(f.list, u),
145
- "data-gap": h,
146
- "data-drop-target": y || void 0,
147
- "aria-label": x,
148
- children: /* @__PURE__ */ o(F, {
153
+ className: ae(f.list, c),
154
+ "data-gap": m,
155
+ "data-drop-target": S || void 0,
156
+ "aria-label": P,
157
+ children: /* @__PURE__ */ o(j, {
149
158
  each: e,
150
- children: (s) => /* @__PURE__ */ o(pe, {
151
- node: s,
159
+ children: (u) => /* @__PURE__ */ o(Se, {
160
+ node: u,
152
161
  rootNodes: n,
153
162
  renderItem: r,
154
163
  canDrop: i,
155
164
  getDragHandleOptions: a,
156
- nestedGap: m
157
- }, s.id)
165
+ nestedGap: v,
166
+ handle: x
167
+ }, u.id)
158
168
  })
159
169
  });
160
170
  }
161
- function pe({
171
+ function Se({
162
172
  node: e,
163
173
  rootNodes: n,
164
174
  renderItem: t,
165
175
  canDrop: r,
166
176
  getDragHandleOptions: i,
167
- nestedGap: a
177
+ nestedGap: a,
178
+ handle: c
168
179
  }) {
169
- const u = Y(e), {
170
- alignment: h = "center",
171
- edgeOffset: m = "none",
172
- variant: x = "plain"
173
- } = i?.(e.value, u) ?? {}, {
174
- handleRef: P,
175
- ref: y,
176
- targetRef: s,
177
- isDragging: S,
178
- isDropTarget: g
179
- } = te({
180
+ const m = B(e), {
181
+ alignment: v = "center",
182
+ edgeOffset: x = "none",
183
+ variant: P = "plain"
184
+ } = i?.(e.value, m) ?? {}, {
185
+ handleRef: b,
186
+ ref: S,
187
+ targetRef: u,
188
+ isDragging: I,
189
+ isDropTarget: y
190
+ } = ie({
180
191
  id: e.id,
181
192
  index: e.index,
182
- group: z(he(n, e)),
183
- type: de,
193
+ group: V(ye(n, e)),
194
+ type: ve,
184
195
  data: {
185
196
  kind: "node",
186
197
  node: e
187
198
  },
188
- accept: (p) => B(p, e.parent == null ? null : k(n, e), e, "before", r)
189
- }), T = e.canHaveChildren ? /* @__PURE__ */ o(H, {
199
+ accept: (N) => W(N, e.parent == null ? null : k(n, e), e, "before", r)
200
+ }), p = e.canHaveChildren ? /* @__PURE__ */ o(M, {
190
201
  nodes: e.children,
191
202
  rootNodes: n,
192
203
  parentNode: e,
@@ -195,44 +206,48 @@ function pe({
195
206
  getDragHandleOptions: i,
196
207
  gap: a,
197
208
  nestedGap: a,
209
+ handle: c,
198
210
  ariaLabel: `${e.textValue} items`
199
211
  }) : null;
200
- return /* @__PURE__ */ w("div", {
201
- ref: y,
212
+ return /* @__PURE__ */ A("div", {
213
+ ref: S,
202
214
  role: "listitem",
203
215
  className: f.item,
204
216
  "data-level": e.level,
205
- "data-dragging": S || void 0,
206
- "data-drop-target": g || void 0,
217
+ "data-dragging": I || void 0,
218
+ "data-drop-target": y || void 0,
207
219
  children: [/* @__PURE__ */ o("div", {
208
- ref: s,
220
+ ref: u,
209
221
  className: f.dropTarget,
210
222
  "data-container": e.canHaveChildren || void 0,
211
223
  "aria-hidden": !0
212
- }), /* @__PURE__ */ o("span", {
213
- ref: P,
214
- className: f.dragHandle,
215
- "data-alignment": h,
216
- "data-edge-offset": m,
217
- "data-variant": x,
218
- "aria-hidden": !0,
219
- children: /* @__PURE__ */ o(re, {
224
+ }), /* @__PURE__ */ o(ce, {
225
+ when: c,
226
+ children: /* @__PURE__ */ o("span", {
227
+ ref: b,
228
+ className: f.dragHandle,
229
+ "data-alignment": v,
230
+ "data-edge-offset": x,
231
+ "data-variant": P,
220
232
  "aria-hidden": !0,
221
- width: 14,
222
- height: 14
233
+ children: /* @__PURE__ */ o(oe, {
234
+ "aria-hidden": !0,
235
+ width: 14,
236
+ height: 14
237
+ })
223
238
  })
224
239
  }), /* @__PURE__ */ o("div", {
225
240
  className: f.content,
226
241
  children: t(e.value, {
227
- ...u,
228
- nestedItems: T,
229
- isDragging: S,
230
- isDropTarget: g
242
+ ...m,
243
+ nestedItems: p,
244
+ isDragging: I,
245
+ isDropTarget: y
231
246
  })
232
247
  })]
233
248
  });
234
249
  }
235
- function M({
250
+ function Y({
236
251
  node: e,
237
252
  renderItem: n,
238
253
  nestedGap: t
@@ -240,9 +255,9 @@ function M({
240
255
  const r = e.canHaveChildren ? /* @__PURE__ */ o("div", {
241
256
  className: f.previewList,
242
257
  "data-gap": t,
243
- children: /* @__PURE__ */ o(F, {
258
+ children: /* @__PURE__ */ o(j, {
244
259
  each: e.children,
245
- children: (i) => /* @__PURE__ */ o(M, {
260
+ children: (i) => /* @__PURE__ */ o(Y, {
246
261
  node: i,
247
262
  renderItem: n,
248
263
  nestedGap: t
@@ -252,14 +267,14 @@ function M({
252
267
  return /* @__PURE__ */ o("div", {
253
268
  className: f.dragPreviewItem,
254
269
  children: n(e.value, {
255
- ...Y(e),
270
+ ...B(e),
256
271
  nestedItems: r,
257
272
  isDragging: !1,
258
273
  isDropTarget: !1
259
274
  })
260
275
  });
261
276
  }
262
- function Y(e) {
277
+ function B(e) {
263
278
  return {
264
279
  level: e.level,
265
280
  parent: e.parent,
@@ -271,11 +286,11 @@ function Y(e) {
271
286
  canHaveChildren: e.canHaveChildren
272
287
  };
273
288
  }
274
- function B(e, n, t, r, i) {
289
+ function W(e, n, t, r, i) {
275
290
  const a = O(e)?.node;
276
- return !a || !X(a, n) ? !1 : i?.(W(a, n, t, r)) ?? !0;
291
+ return !a || !z(a, n) ? !1 : i?.(X(a, n, t, r)) ?? !0;
277
292
  }
278
- function W(e, n, t, r) {
293
+ function X(e, n, t, r) {
279
294
  return {
280
295
  items: [e.value],
281
296
  target: t?.value ?? null,
@@ -286,36 +301,36 @@ function W(e, n, t, r) {
286
301
  dropPosition: r
287
302
  };
288
303
  }
289
- function X(e, n) {
304
+ function z(e, n) {
290
305
  return n == null || n.id !== e.id && $(e.children, n.id) == null;
291
306
  }
292
- function ve(e, n, t, r) {
293
- const i = V(n);
307
+ function xe(e, n, t, r) {
308
+ const i = q(n);
294
309
  if (i === void 0)
295
310
  return null;
296
311
  const a = i == null ? null : $(e, i);
297
312
  if (i != null && !a)
298
313
  return null;
299
- const u = r != null && t > r.index;
314
+ const c = r != null && t > r.index;
300
315
  return {
301
316
  parentNode: a,
302
317
  index: t,
303
- dropPosition: u ? "after" : "before"
318
+ dropPosition: c ? "after" : "before"
304
319
  };
305
320
  }
306
- function be(e) {
307
- return z(e?.id ?? null);
308
- }
309
- function z(e) {
310
- return e == null ? A : `${D}${e}`;
321
+ function Pe(e) {
322
+ return V(e?.id ?? null);
311
323
  }
312
324
  function V(e) {
313
- if (e === A)
325
+ return e == null ? H : `${D}${e}`;
326
+ }
327
+ function q(e) {
328
+ if (e === H)
314
329
  return null;
315
330
  if (typeof e == "string" && e.startsWith(D))
316
331
  return e.slice(D.length);
317
332
  }
318
- function he(e, n) {
333
+ function ye(e, n) {
319
334
  return k(e, n)?.id ?? null;
320
335
  }
321
336
  function k(e, n) {
@@ -328,7 +343,7 @@ function k(e, n) {
328
343
  }
329
344
  return null;
330
345
  }
331
- function q(e) {
346
+ function J(e) {
332
347
  const n = e?.data;
333
348
  return n?.kind === "node" && "node" in n ? {
334
349
  kind: "node",
@@ -339,11 +354,11 @@ function q(e) {
339
354
  } : null;
340
355
  }
341
356
  function O(e) {
342
- const n = q(e);
357
+ const n = J(e);
343
358
  return n?.kind === "node" ? n : null;
344
359
  }
345
- ge.displayName = "SortableList";
360
+ be.displayName = "SortableList";
346
361
  export {
347
- ge as SortableList
362
+ be as SortableList
348
363
  };
349
364
  //# sourceMappingURL=SortableList.js.map