@floegence/floe-webapp-core 0.36.47 → 0.36.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.
@@ -87,6 +87,12 @@ export interface WorkbenchWidgetBodyActivation {
87
87
  pointerType?: string;
88
88
  }
89
89
  export type WorkbenchWidgetLifecycle = 'hot' | 'warm' | 'cold';
90
+ export type WorkbenchWidgetMotionPhase = 'enter';
91
+ export interface WorkbenchWidgetMotionIntent {
92
+ widgetId: string;
93
+ phase: WorkbenchWidgetMotionPhase;
94
+ reason?: string;
95
+ }
90
96
  export interface WorkbenchWidgetBodyProps<TWidgetType extends string = WorkbenchWidgetType> {
91
97
  widgetId: string;
92
98
  title: string;
@@ -94,6 +100,7 @@ export interface WorkbenchWidgetBodyProps<TWidgetType extends string = Workbench
94
100
  surfaceMetrics?: Accessor<WorkbenchWidgetSurfaceMetrics | undefined>;
95
101
  activation?: WorkbenchWidgetBodyActivation;
96
102
  lifecycle?: WorkbenchWidgetLifecycle;
103
+ motion?: WorkbenchWidgetMotionIntent | null;
97
104
  selected?: boolean;
98
105
  filtered?: boolean;
99
106
  requestActivate?: () => void;
@@ -0,0 +1,3 @@
1
+ import { type Accessor } from 'solid-js';
2
+ import type { WorkbenchWidgetMotionIntent } from './types';
3
+ export declare function createWorkbenchWidgetEnterMotionTracker(widgetIds: Accessor<readonly string[]>): Accessor<Record<string, WorkbenchWidgetMotionIntent | null>>;
@@ -0,0 +1,60 @@
1
+ import { createSignal as m, createEffect as T, onCleanup as g } from "solid-js";
2
+ const h = 140;
3
+ function E(c) {
4
+ return String(c ?? "").trim();
5
+ }
6
+ function M(c) {
7
+ const [f, a] = m({}), n = /* @__PURE__ */ new Map();
8
+ let i = /* @__PURE__ */ new Set(), l = !1;
9
+ const d = (t) => {
10
+ const e = n.get(t);
11
+ e && (globalThis.clearTimeout(e), n.delete(t));
12
+ }, u = (t) => {
13
+ a((e) => {
14
+ if (!e[t])
15
+ return e;
16
+ const r = { ...e };
17
+ return delete r[t], r;
18
+ });
19
+ };
20
+ return T(() => {
21
+ const t = new Set(
22
+ c().map(E).filter(Boolean)
23
+ );
24
+ if (!l) {
25
+ l = !0, i = t;
26
+ return;
27
+ }
28
+ a((e) => {
29
+ let r = !1;
30
+ const o = { ...e };
31
+ for (const s of Object.keys(e))
32
+ t.has(s) || (d(s), delete o[s], r = !0);
33
+ return r ? o : e;
34
+ });
35
+ for (const e of t) {
36
+ if (i.has(e) || n.has(e))
37
+ continue;
38
+ a((o) => o[e]?.phase === "enter" ? o : {
39
+ ...o,
40
+ [e]: {
41
+ widgetId: e,
42
+ phase: "enter",
43
+ reason: "widget_add"
44
+ }
45
+ });
46
+ const r = globalThis.setTimeout(() => {
47
+ n.delete(e), u(e);
48
+ }, h);
49
+ n.set(e, r);
50
+ }
51
+ i = t;
52
+ }), g(() => {
53
+ for (const t of n.values())
54
+ globalThis.clearTimeout(t);
55
+ n.clear();
56
+ }), f;
57
+ }
58
+ export {
59
+ M as createWorkbenchWidgetEnterMotionTracker
60
+ };