@tutti-os/workbench-surface 0.0.46 → 0.0.48

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/index.js CHANGED
@@ -10161,6 +10161,7 @@ function WorkbenchHostDock({
10161
10161
  "aria-disabled": clickResolution.kind === "blocked" ? true : void 0,
10162
10162
  className: "desktop-dock__btn",
10163
10163
  "data-interactive": clickResolution.kind === "blocked" ? "false" : "true",
10164
+ "data-dock-hover-panel-trigger": hasHoverPanel ? "true" : void 0,
10164
10165
  type: "button",
10165
10166
  onPointerDown: (event) => {
10166
10167
  if (event.button !== 0) {
@@ -11359,9 +11360,40 @@ function WorkbenchHostDockHoverPanel({
11359
11360
  setPendingActionKeys,
11360
11361
  state
11361
11362
  }) {
11363
+ const lastPointerActionAtRef = useRef8(/* @__PURE__ */ new Map());
11362
11364
  if (!entry) {
11363
11365
  return null;
11364
11366
  }
11367
+ const hoverPanelEntry = entry;
11368
+ const runHoverAction = (actionKey, actionId, disabled) => {
11369
+ if (disabled || pendingActionKeys.has(actionKey)) {
11370
+ return;
11371
+ }
11372
+ setPendingActionKeys((current) => {
11373
+ const next = new Set(current);
11374
+ next.add(actionKey);
11375
+ return next;
11376
+ });
11377
+ void (async () => {
11378
+ try {
11379
+ await onDockEntryAction?.({
11380
+ actionId,
11381
+ entryId: hoverPanelEntry.id,
11382
+ host
11383
+ });
11384
+ } catch {
11385
+ } finally {
11386
+ setPendingActionKeys((current) => {
11387
+ if (!current.has(actionKey)) {
11388
+ return current;
11389
+ }
11390
+ const next = new Set(current);
11391
+ next.delete(actionKey);
11392
+ return next;
11393
+ });
11394
+ }
11395
+ })();
11396
+ };
11365
11397
  return /* @__PURE__ */ jsxs8(
11366
11398
  "div",
11367
11399
  {
@@ -11394,36 +11426,34 @@ function WorkbenchHostDockHoverPanel({
11394
11426
  className: "desktop-dock__hover-action",
11395
11427
  disabled: action.disabled || isLocallyPending,
11396
11428
  type: "button",
11429
+ onPointerDown: (event) => {
11430
+ if (event.button !== 0) {
11431
+ return;
11432
+ }
11433
+ event.preventDefault();
11434
+ event.stopPropagation();
11435
+ lastPointerActionAtRef.current.set(
11436
+ actionKey,
11437
+ performance.now()
11438
+ );
11439
+ runHoverAction(
11440
+ actionKey,
11441
+ action.id,
11442
+ action.disabled === true
11443
+ );
11444
+ },
11397
11445
  onClick: (event) => {
11398
11446
  event.preventDefault();
11399
11447
  event.stopPropagation();
11400
- if (action.disabled === true || pendingActionKeys.has(actionKey)) {
11448
+ const lastPointerAt = lastPointerActionAtRef.current.get(actionKey);
11449
+ if (lastPointerAt !== void 0 && performance.now() - lastPointerAt < 700) {
11401
11450
  return;
11402
11451
  }
11403
- setPendingActionKeys((current) => {
11404
- const next = new Set(current);
11405
- next.add(actionKey);
11406
- return next;
11407
- });
11408
- void (async () => {
11409
- try {
11410
- await onDockEntryAction?.({
11411
- actionId: action.id,
11412
- entryId: entry.id,
11413
- host
11414
- });
11415
- } catch {
11416
- } finally {
11417
- setPendingActionKeys((current) => {
11418
- if (!current.has(actionKey)) {
11419
- return current;
11420
- }
11421
- const next = new Set(current);
11422
- next.delete(actionKey);
11423
- return next;
11424
- });
11425
- }
11426
- })();
11452
+ runHoverAction(
11453
+ actionKey,
11454
+ action.id,
11455
+ action.disabled === true
11456
+ );
11427
11457
  },
11428
11458
  children: isPending ? action.pendingLabel ?? action.label : action.label
11429
11459
  },