@grafloria/element 0.4.30 → 0.4.32

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.
@@ -1254,6 +1254,8 @@ export function bindDashboardSplit(api, group, options = {}) {
1254
1254
  // A split board has no cells to drop a torn-out page into: it refuses,
1255
1255
  // and the press stays a plain tab click.
1256
1256
  tearOutMember: (_pageId, _fromGroupId, _ev, _plan) => false,
1257
+ // …and it has no cells to move a section across: a strip press stays a selection.
1258
+ dragMember: () => false,
1257
1259
  containsWorld: (x, y) => worldInsideBoard(x, y),
1258
1260
  containsWorldExtended: (x, y) => worldInsideBoard(x, y),
1259
1261
  frameArea: () => {
@@ -132,6 +132,28 @@ const CSS = `
132
132
  box-shadow: 0 0 0 1px rgba(236, 238, 244, .16);
133
133
  }
134
134
  }
135
+ /* A tab held over ANOTHER group: it will join that group, not the board. The
136
+ group's frame lights up, and its strip marks the slot the tab will take —
137
+ a bar before the tab it lands in front of, or after the last one. */
138
+ .grafloria-html-layer > .axdb-join {
139
+ position: absolute;
140
+ z-index: 3;
141
+ pointer-events: none;
142
+ box-sizing: border-box;
143
+ border: 2px dashed var(--axdb-accent, #3b52d9);
144
+ background: var(--axdb-accent-soft, rgba(59, 82, 217, .08));
145
+ border-radius: var(--axdb-rs-radius, 3px);
146
+ }
147
+ .axdb-tabs.axdb-tabs--drop { box-shadow: inset 0 -2px 0 var(--axdb-accent, #3b52d9); }
148
+ .axdb-tab.axdb-tab--drop-before { position: relative; }
149
+ .axdb-tab.axdb-tab--drop-before::before {
150
+ content: ""; position: absolute; left: -3px; top: 4px; bottom: 4px; width: 3px;
151
+ border-radius: 2px; background: var(--axdb-accent, #3b52d9);
152
+ }
153
+ .axdb-tabs.axdb-tabs--drop-end::after {
154
+ content: ""; display: inline-block; width: 3px; height: 18px; margin: 0 4px;
155
+ border-radius: 2px; background: var(--axdb-accent, #3b52d9); vertical-align: middle; align-self: center;
156
+ }
135
157
 
136
158
  /* ===========================================================================
137
159
  BUILT-IN WIDGET CARDS — what widgets.ts paints when a page writes no
@@ -39,7 +39,7 @@ export declare function tabStripReserve(o: TabsOptions | undefined, pageCount: n
39
39
  * rebuild — and so a `click` listener survives between switches.
40
40
  */
41
41
  export declare function tabStripKey(pages: TabPage[], activeId: string, o: TabsOptions | undefined, rtl: boolean): string;
42
- export declare function paintTabStrip(strip: HTMLElement, pages: TabPage[], activeId: string, o: TabsOptions | undefined, rtl: boolean, onPick: (id: string) => void, onSelectContainer?: () => void,
42
+ export declare function paintTabStrip(strip: HTMLElement, pages: TabPage[], activeId: string, o: TabsOptions | undefined, rtl: boolean, onPick: (id: string) => void, onSelectContainer?: (e: PointerEvent) => void,
43
43
  /**
44
44
  * The tab is the PAGE's drag handle, as it is in VS Code: press one and
45
45
  * travel, and the whole page leaves — not the widget under the pointer,
@@ -61,7 +61,7 @@ onDrag) {
61
61
  var _a;
62
62
  if ((_a = e.target) === null || _a === void 0 ? void 0 : _a.closest('.axdb-tab'))
63
63
  return;
64
- onSelectContainer === null || onSelectContainer === void 0 ? void 0 : onSelectContainer();
64
+ onSelectContainer === null || onSelectContainer === void 0 ? void 0 : onSelectContainer(e);
65
65
  };
66
66
  for (const p of pages) {
67
67
  const b = doc.createElement('button');
package/src/lib/load.js CHANGED
@@ -151,7 +151,15 @@ export function fromDocument(document, options = {}) {
151
151
  // the group's slab `gridItem`, its children in its own membership.
152
152
  const meta = ((_b = childGroup.getMetadata('containerWidget')) !== null && _b !== void 0 ? _b : {});
153
153
  const cell = cellFromGridItem(childGroup.getMetadata('gridItem'));
154
- const ws = Object.assign(Object.assign(Object.assign({ id: childGroup.id }, meta), (cell ? { x: cell.x, y: cell.y, span: cell.w, rows: cell.h } : {})), { widgets: rebuildBoard(childGroup, viewId) });
154
+ const inner = rebuildBoard(childGroup, viewId);
155
+ // A tab container's pages keep the order they were REORDERED into
156
+ // (`order` on the container), not the order they joined the group.
157
+ const order = meta.order;
158
+ if (Array.isArray(order)) {
159
+ const rank = (id) => (order.indexOf(id) < 0 ? Number.MAX_SAFE_INTEGER : order.indexOf(id));
160
+ inner.sort((p, q) => rank(p.id) - rank(q.id));
161
+ }
162
+ const ws = Object.assign(Object.assign(Object.assign({ id: childGroup.id }, meta), (cell ? { x: cell.x, y: cell.y, span: cell.w, rows: cell.h } : {})), { widgets: inner });
155
163
  specById.set(ws.id, ws);
156
164
  viewOfWidget.set(ws.id, g.id);
157
165
  boardWidgets.set(ws.id, ws.widgets);