@floegence/floe-webapp-core 0.36.74 → 0.36.76

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/full.js CHANGED
@@ -141,24 +141,25 @@ import { configureMermaidWorker as Lf, configureSyncMermaid as Rf, renderMermaid
141
141
  import { configureShikiWorker as Of, configureSyncHighlighter as Wf, highlightCode as Mf, terminateShikiWorker as Nf, useCodeHighlight as wf } from "./components/chat/hooks/useCodeHighlight.js";
142
142
  import { createFloatingPresence as Hf } from "./components/ui/floatingPresence.js";
143
143
  import { createSimpleContext as Gf } from "./context/createSimpleContext.js";
144
- import { deferAfterPaint as Kf, deferNonBlocking as zf } from "./utils/defer.js";
145
- import { duration as Zf, easing as Yf, fadeIn as Qf, listContainer as jf, listItem as qf, panelResize as Jf, popIn as $f, scaleIn as ed, sidebarVariants as od, slideInFromBottom as rd, slideInFromLeft as td, slideInFromRight as id, slideInFromTop as nd, springConfig as ad } from "./utils/animations.js";
146
- import { formatKeybind as ld, isMacLikePlatform as md, isPrimaryModKeyPressed as sd, matchKeybind as pd, parseKeybind as fd } from "./utils/keybind.js";
147
- import { isTypingElement as Td, shouldIgnoreHotkeys as Id } from "./utils/dom.js";
148
- import { lockBodyStyle as Cd } from "./utils/bodyStyleLock.js";
149
- import { registerCommandContributions as gd, useCommandContributions as ud } from "./hooks/useCommandContributions.js";
150
- import { resolveFloatingWindowViewport as hd } from "./components/ui/floatingWindowGeometry.js";
151
- import { startPointerSession as Ed } from "./components/ui/pointerSession.js";
152
- import { useAttachments as Pd } from "./components/chat/hooks/useAttachments.js";
153
- import { useAutoScroll as Ld } from "./components/chat/hooks/useAutoScroll.js";
154
- import { useDebounce as _d } from "./hooks/useDebounce.js";
155
- import { useDeckDrag as yd } from "./hooks/useDeckDrag.js";
156
- import { useFileBrowserDropTarget as Od, useFileBrowserItemDrag as Wd } from "./hooks/useFileBrowserDrag.js";
157
- import { useKeybind as Nd } from "./hooks/useKeybind.js";
158
- import { useMediaQuery as bd } from "./hooks/useMediaQuery.js";
159
- import { usePersisted as Ud } from "./hooks/usePersisted.js";
160
- import { useResizeObserver as Vd } from "./hooks/useResizeObserver.js";
161
- import { useVirtualList as zd } from "./components/chat/hooks/useVirtualList.js";
144
+ import { createUIFirstSelection as Kf } from "./utils/uiFirstSelection.js";
145
+ import { deferAfterPaint as Xf, deferNonBlocking as Zf } from "./utils/defer.js";
146
+ import { duration as Qf, easing as jf, fadeIn as qf, listContainer as Jf, listItem as $f, panelResize as ed, popIn as od, scaleIn as rd, sidebarVariants as td, slideInFromBottom as id, slideInFromLeft as nd, slideInFromRight as ad, slideInFromTop as cd, springConfig as ld } from "./utils/animations.js";
147
+ import { formatKeybind as sd, isMacLikePlatform as pd, isPrimaryModKeyPressed as fd, matchKeybind as dd, parseKeybind as Td } from "./utils/keybind.js";
148
+ import { isTypingElement as xd, shouldIgnoreHotkeys as Cd } from "./utils/dom.js";
149
+ import { lockBodyStyle as gd } from "./utils/bodyStyleLock.js";
150
+ import { registerCommandContributions as kd, useCommandContributions as hd } from "./hooks/useCommandContributions.js";
151
+ import { resolveFloatingWindowViewport as Ed } from "./components/ui/floatingWindowGeometry.js";
152
+ import { startPointerSession as Pd } from "./components/ui/pointerSession.js";
153
+ import { useAttachments as Ld } from "./components/chat/hooks/useAttachments.js";
154
+ import { useAutoScroll as _d } from "./components/chat/hooks/useAutoScroll.js";
155
+ import { useDebounce as yd } from "./hooks/useDebounce.js";
156
+ import { useDeckDrag as Od } from "./hooks/useDeckDrag.js";
157
+ import { useFileBrowserDropTarget as Md, useFileBrowserItemDrag as Nd } from "./hooks/useFileBrowserDrag.js";
158
+ import { useKeybind as bd } from "./hooks/useKeybind.js";
159
+ import { useMediaQuery as Ud } from "./hooks/useMediaQuery.js";
160
+ import { usePersisted as Vd } from "./hooks/usePersisted.js";
161
+ import { useResizeObserver as zd } from "./hooks/useResizeObserver.js";
162
+ import { useVirtualList as Zd } from "./components/chat/hooks/useVirtualList.js";
162
163
  export {
163
164
  F as Activity,
164
165
  bt as ActivityAppsMain,
@@ -639,17 +640,18 @@ export {
639
640
  Rt as createTerminalTokenSuggestion,
640
641
  Js as createTerminalWidget,
641
642
  tp as createThemeService,
643
+ Kf as createUIFirstSelection,
642
644
  af as createViewportFromZoomAnchor,
643
645
  Pp as createWidgetRegistry,
644
- Kf as deferAfterPaint,
645
- zf as deferNonBlocking,
646
+ Xf as deferAfterPaint,
647
+ Zf as deferNonBlocking,
646
648
  st as deleteTerminalTextBackward,
647
649
  Ct as dispatchTerminalSessionKey,
648
- Zf as duration,
649
- Yf as easing,
650
+ Qf as duration,
651
+ jf as easing,
650
652
  sa as ensureSurfacePortalInteractionTracking,
651
653
  lm as estimateNotesContextMenuHeight,
652
- Qf as fadeIn,
654
+ qf as fadeIn,
653
655
  $p as findFreePosition,
654
656
  f as floeColorTokenCategories,
655
657
  d as floeDesignTokens,
@@ -660,7 +662,7 @@ export {
660
662
  S as floeSpacingTokens,
661
663
  g as floeThemeColorVariables,
662
664
  u as floeTypographyTokens,
663
- ld as formatKeybind,
665
+ sd as formatKeybind,
664
666
  vi as getFileIcon,
665
667
  k as getFloeColorTokenValue,
666
668
  Gp as getGridCellSize,
@@ -678,17 +680,17 @@ export {
678
680
  Mf as highlightCode,
679
681
  pt as insertTerminalText,
680
682
  en as isLocalInteractionSurfaceTarget,
681
- md as isMacLikePlatform,
683
+ pd as isMacLikePlatform,
682
684
  cf as isPointInsideCanvasRect,
683
- sd as isPrimaryModKeyPressed,
685
+ fd as isPrimaryModKeyPressed,
684
686
  Qp as isStreamEvent,
685
687
  pa as isSurfacePortalMode,
686
- Td as isTypingElement,
687
- jf as listContainer,
688
- qf as listItem,
688
+ xd as isTypingElement,
689
+ Jf as listContainer,
690
+ $f as listItem,
689
691
  lf as localToCanvasWorld,
690
- Cd as lockBodyStyle,
691
- pd as matchKeybind,
692
+ gd as lockBodyStyle,
693
+ dd as matchKeybind,
692
694
  vt as matchesTerminalSuggestionPrefix,
693
695
  hm as mergeBoardBounds,
694
696
  c as mergeThemeTokenMaps,
@@ -698,16 +700,16 @@ export {
698
700
  Em as normalizeNotesSnapshot,
699
701
  at as normalizeTerminalWorkspaceProfile,
700
702
  Am as noteBucketMetrics,
701
- Jf as panelResize,
702
- fd as parseKeybind,
703
+ ed as panelResize,
704
+ Td as parseKeybind,
703
705
  yt as parseTerminalSuggestionContext,
704
706
  Vp as pixelDeltaToGridDelta,
705
- $f as popIn,
707
+ od as popIn,
706
708
  Kp as positionToGridArea,
707
709
  fa as projectSurfacePortalPosition,
708
710
  da as projectSurfacePortalRect,
709
711
  Pm as promoteLocalItem,
710
- gd as registerCommandContributions,
712
+ kd as registerCommandContributions,
711
713
  Dm as removeSnapshotItem,
712
714
  Lm as removeSnapshotTopic,
713
715
  Rm as removeSnapshotTrashItem,
@@ -718,7 +720,7 @@ export {
718
720
  vm as replaceSnapshotTopic,
719
721
  ym as replaceSnapshotTrashItem,
720
722
  yi as resolveFileItemIcon,
721
- hd as resolveFloatingWindowViewport,
723
+ Ed as resolveFloatingWindowViewport,
722
724
  on as resolveSurfaceInteractionTargetRole,
723
725
  Ta as resolveSurfacePortalBoundaryRect,
724
726
  Ia as resolveSurfacePortalHost,
@@ -733,20 +735,20 @@ export {
733
735
  Ft as runTerminalMockCommand,
734
736
  of as sameGridPosition,
735
737
  Ha as sanitizeDisplayMode,
736
- ed as scaleIn,
738
+ rd as scaleIn,
737
739
  Bm as screenToWorld,
738
740
  ut as setTerminalSessionInputValue,
739
741
  cn as shouldActivateWorkbenchWidgetLocalTarget,
740
- Id as shouldIgnoreHotkeys,
741
- od as sidebarVariants,
742
- rd as slideInFromBottom,
743
- td as slideInFromLeft,
744
- id as slideInFromRight,
745
- nd as slideInFromTop,
742
+ Cd as shouldIgnoreHotkeys,
743
+ td as sidebarVariants,
744
+ id as slideInFromBottom,
745
+ nd as slideInFromLeft,
746
+ ad as slideInFromRight,
747
+ cd as slideInFromTop,
746
748
  zp as snapToGrid,
747
- ad as springConfig,
749
+ ld as springConfig,
748
750
  gc as startHotInteraction,
749
- Ed as startPointerSession,
751
+ Pd as startPointerSession,
750
752
  kt as submitTerminalSession,
751
753
  s as syncThemeTokenOverrides,
752
754
  Bt as terminalCommandTokenSuggestionProvider,
@@ -758,36 +760,36 @@ export {
758
760
  Af as terminateMarkdownWorker,
759
761
  vf as terminateMermaidWorker,
760
762
  Nf as terminateShikiWorker,
761
- Pd as useAttachments,
762
- Ld as useAutoScroll,
763
+ Ld as useAttachments,
764
+ _d as useAutoScroll,
763
765
  Tn as useChatContext,
764
766
  wf as useCodeHighlight,
765
767
  Wn as useCommand,
766
- ud as useCommandContributions,
768
+ hd as useCommandContributions,
767
769
  Hn as useComponentContextFactory,
768
770
  Un as useComponentRegistry,
769
771
  yp as useCurrentWidgetId,
770
- _d as useDebounce,
772
+ yd as useDebounce,
771
773
  Da as useDeck,
772
- yd as useDeckDrag,
774
+ Od as useDeckDrag,
773
775
  yc as useFileBrowser,
774
776
  Rc as useFileBrowserDrag,
775
- Od as useFileBrowserDropTarget,
776
- Wd as useFileBrowserItemDrag,
777
+ Md as useFileBrowserDropTarget,
778
+ Nd as useFileBrowserItemDrag,
777
779
  ea as useFloeConfig,
778
780
  fl as useFormSubmitting,
779
- Nd as useKeybind,
781
+ bd as useKeybind,
780
782
  Ol as useLayout,
781
- bd as useMediaQuery,
783
+ Ud as useMediaQuery,
782
784
  yf as useMermaid,
783
785
  Qm as useNotification,
784
786
  Gn as useOptionalComponentRegistry,
785
- Ud as usePersisted,
786
- Vd as useResizeObserver,
787
+ Vd as usePersisted,
788
+ zd as useResizeObserver,
787
789
  oa as useResolvedFloeConfig,
788
790
  ip as useTheme,
789
791
  Cp as useViewActivation,
790
- zd as useVirtualList,
792
+ Zd as useVirtualList,
791
793
  Dp as useWidgetRegistry,
792
794
  Bp as useWidgetState,
793
795
  Op as useWidgetStateContext,
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { FloeProvider as r } from "./app/FloeProvider.js";
2
2
  import { applyTheme as i, builtInThemes as s, getSystemTheme as n, mergeThemeTokenMaps as a, resolveThemeTokenOverrides as m, resolveThemeTokens as p, syncThemeTokenOverrides as l } from "./styles/themes/index.js";
3
- import { floeColorTokenCategories as d, floeDesignTokens as g, floeFontFamilyTokens as T, floeMotionTokens as u, floeRadiusTokens as x, floeSharedCssVariables as c, floeSpacingTokens as C, floeThemeColorVariables as y, floeTypographyTokens as v, getFloeColorTokenValue as F } from "./styles/tokens.js";
3
+ import { floeColorTokenCategories as d, floeDesignTokens as g, floeFontFamilyTokens as c, floeMotionTokens as x, floeRadiusTokens as T, floeSharedCssVariables as u, floeSpacingTokens as C, floeThemeColorVariables as y, floeTypographyTokens as v, getFloeColorTokenValue as F } from "./styles/tokens.js";
4
4
  import { CommandProvider as h, createCommandService as P, useCommand as R } from "./context/CommandContext.js";
5
5
  import { ComponentRegistryProvider as I, createComponentRegistry as S, hasComponentRegistryContext as b, useComponentContextFactory as O, useComponentRegistry as A, useOptionalComponentRegistry as E } from "./context/ComponentRegistry.js";
6
6
  import { DEFAULT_FLOE_CONFIG as B, FloeConfigProvider as N, useFloeConfig as _, useResolvedFloeConfig as w } from "./context/FloeConfigContext.js";
@@ -11,25 +11,26 @@ import { LayoutProvider as X, createLayoutService as Z, useLayout as $ } from ".
11
11
  import { NotificationContainer as oe, NotificationProvider as re, createNotificationService as te, useNotification as ie } from "./context/NotificationContext.js";
12
12
  import { ThemeProvider as ne, createThemeService as ae, useTheme as me } from "./context/ThemeContext.js";
13
13
  import { ViewActivationProvider as le, useViewActivation as fe } from "./context/ViewActivationContext.js";
14
- import { WidgetRegistryProvider as ge, createWidgetRegistry as Te, useWidgetRegistry as ue } from "./context/WidgetRegistry.js";
15
- import { WidgetStateProvider as ce, useCurrentWidgetId as Ce, useWidgetState as ye, useWidgetStateContext as ve } from "./context/WidgetStateContext.js";
14
+ import { WidgetRegistryProvider as ge, createWidgetRegistry as ce, useWidgetRegistry as xe } from "./context/WidgetRegistry.js";
15
+ import { WidgetStateProvider as ue, useCurrentWidgetId as Ce, useWidgetState as ye, useWidgetStateContext as ve } from "./context/WidgetStateContext.js";
16
16
  import { applyDragDelta as ke, applyResizeDelta as he, getGridCellSize as Pe, pixelDeltaToGridDelta as Re, positionToGridArea as De, snapToGrid as Ie } from "./utils/gridLayout.js";
17
17
  import { checkCollision as be, constrainPosition as Oe, findFreePosition as Ae, hasCollision as Ee, sameGridPosition as Le } from "./utils/gridCollision.js";
18
18
  import { cn as Ne } from "./utils/cn.js";
19
19
  import { createSimpleContext as we } from "./context/createSimpleContext.js";
20
- import { deferAfterPaint as We, deferNonBlocking as Me } from "./utils/defer.js";
21
- import { duration as Ke, easing as ze, fadeIn as He, listContainer as Ue, listItem as Qe, panelResize as Ye, popIn as je, scaleIn as qe, sidebarVariants as Je, slideInFromBottom as Xe, slideInFromLeft as Ze, slideInFromRight as $e, slideInFromTop as eo, springConfig as oo } from "./utils/animations.js";
22
- import { formatKeybind as to, isMacLikePlatform as io, isPrimaryModKeyPressed as so, matchKeybind as no, parseKeybind as ao } from "./utils/keybind.js";
23
- import { isTypingElement as po, shouldIgnoreHotkeys as lo } from "./utils/dom.js";
24
- import { lockBodyStyle as go } from "./utils/bodyStyleLock.js";
25
- import { registerCommandContributions as uo, useCommandContributions as xo } from "./hooks/useCommandContributions.js";
26
- import { useDebounce as Co } from "./hooks/useDebounce.js";
27
- import { useDeckDrag as vo } from "./hooks/useDeckDrag.js";
28
- import { useFileBrowserDropTarget as ko, useFileBrowserItemDrag as ho } from "./hooks/useFileBrowserDrag.js";
29
- import { useKeybind as Ro } from "./hooks/useKeybind.js";
30
- import { useMediaQuery as Io } from "./hooks/useMediaQuery.js";
31
- import { usePersisted as bo } from "./hooks/usePersisted.js";
32
- import { useResizeObserver as Ao } from "./hooks/useResizeObserver.js";
20
+ import { createUIFirstSelection as We } from "./utils/uiFirstSelection.js";
21
+ import { deferAfterPaint as Ve, deferNonBlocking as Ke } from "./utils/defer.js";
22
+ import { duration as He, easing as Ue, fadeIn as Qe, listContainer as Ye, listItem as je, panelResize as qe, popIn as Je, scaleIn as Xe, sidebarVariants as Ze, slideInFromBottom as $e, slideInFromLeft as eo, slideInFromRight as oo, slideInFromTop as ro, springConfig as to } from "./utils/animations.js";
23
+ import { formatKeybind as so, isMacLikePlatform as no, isPrimaryModKeyPressed as ao, matchKeybind as mo, parseKeybind as po } from "./utils/keybind.js";
24
+ import { isTypingElement as fo, shouldIgnoreHotkeys as go } from "./utils/dom.js";
25
+ import { lockBodyStyle as xo } from "./utils/bodyStyleLock.js";
26
+ import { registerCommandContributions as uo, useCommandContributions as Co } from "./hooks/useCommandContributions.js";
27
+ import { useDebounce as vo } from "./hooks/useDebounce.js";
28
+ import { useDeckDrag as ko } from "./hooks/useDeckDrag.js";
29
+ import { useFileBrowserDropTarget as Po, useFileBrowserItemDrag as Ro } from "./hooks/useFileBrowserDrag.js";
30
+ import { useKeybind as Io } from "./hooks/useKeybind.js";
31
+ import { useMediaQuery as bo } from "./hooks/useMediaQuery.js";
32
+ import { usePersisted as Ao } from "./hooks/usePersisted.js";
33
+ import { useResizeObserver as Lo } from "./hooks/useResizeObserver.js";
33
34
  export {
34
35
  h as CommandProvider,
35
36
  I as ComponentRegistryProvider,
@@ -46,7 +47,7 @@ export {
46
47
  ne as ThemeProvider,
47
48
  le as ViewActivationProvider,
48
49
  ge as WidgetRegistryProvider,
49
- ce as WidgetStateProvider,
50
+ ue as WidgetStateProvider,
50
51
  ke as applyDragDelta,
51
52
  he as applyResizeDelta,
52
53
  i as applyTheme,
@@ -61,80 +62,81 @@ export {
61
62
  te as createNotificationService,
62
63
  we as createSimpleContext,
63
64
  ae as createThemeService,
64
- Te as createWidgetRegistry,
65
- We as deferAfterPaint,
66
- Me as deferNonBlocking,
67
- Ke as duration,
68
- ze as easing,
69
- He as fadeIn,
65
+ We as createUIFirstSelection,
66
+ ce as createWidgetRegistry,
67
+ Ve as deferAfterPaint,
68
+ Ke as deferNonBlocking,
69
+ He as duration,
70
+ Ue as easing,
71
+ Qe as fadeIn,
70
72
  Ae as findFreePosition,
71
73
  d as floeColorTokenCategories,
72
74
  g as floeDesignTokens,
73
- T as floeFontFamilyTokens,
74
- u as floeMotionTokens,
75
- x as floeRadiusTokens,
76
- c as floeSharedCssVariables,
75
+ c as floeFontFamilyTokens,
76
+ x as floeMotionTokens,
77
+ T as floeRadiusTokens,
78
+ u as floeSharedCssVariables,
77
79
  C as floeSpacingTokens,
78
80
  y as floeThemeColorVariables,
79
81
  v as floeTypographyTokens,
80
- to as formatKeybind,
82
+ so as formatKeybind,
81
83
  F as getFloeColorTokenValue,
82
84
  Pe as getGridCellSize,
83
85
  n as getSystemTheme,
84
86
  Ee as hasCollision,
85
87
  b as hasComponentRegistryContext,
86
88
  j as hasFileBrowserDragContext,
87
- io as isMacLikePlatform,
88
- so as isPrimaryModKeyPressed,
89
- po as isTypingElement,
90
- Ue as listContainer,
91
- Qe as listItem,
92
- go as lockBodyStyle,
93
- no as matchKeybind,
89
+ no as isMacLikePlatform,
90
+ ao as isPrimaryModKeyPressed,
91
+ fo as isTypingElement,
92
+ Ye as listContainer,
93
+ je as listItem,
94
+ xo as lockBodyStyle,
95
+ mo as matchKeybind,
94
96
  a as mergeThemeTokenMaps,
95
- Ye as panelResize,
96
- ao as parseKeybind,
97
+ qe as panelResize,
98
+ po as parseKeybind,
97
99
  Re as pixelDeltaToGridDelta,
98
- je as popIn,
100
+ Je as popIn,
99
101
  De as positionToGridArea,
100
102
  uo as registerCommandContributions,
101
103
  m as resolveThemeTokenOverrides,
102
104
  p as resolveThemeTokens,
103
105
  Le as sameGridPosition,
104
- qe as scaleIn,
105
- lo as shouldIgnoreHotkeys,
106
- Je as sidebarVariants,
107
- Xe as slideInFromBottom,
108
- Ze as slideInFromLeft,
109
- $e as slideInFromRight,
110
- eo as slideInFromTop,
106
+ Xe as scaleIn,
107
+ go as shouldIgnoreHotkeys,
108
+ Ze as sidebarVariants,
109
+ $e as slideInFromBottom,
110
+ eo as slideInFromLeft,
111
+ oo as slideInFromRight,
112
+ ro as slideInFromTop,
111
113
  Ie as snapToGrid,
112
- oo as springConfig,
114
+ to as springConfig,
113
115
  U as startHotInteraction,
114
116
  l as syncThemeTokenOverrides,
115
117
  R as useCommand,
116
- xo as useCommandContributions,
118
+ Co as useCommandContributions,
117
119
  O as useComponentContextFactory,
118
120
  A as useComponentRegistry,
119
121
  Ce as useCurrentWidgetId,
120
- Co as useDebounce,
122
+ vo as useDebounce,
121
123
  V as useDeck,
122
- vo as useDeckDrag,
124
+ ko as useDeckDrag,
123
125
  q as useFileBrowserDrag,
124
- ko as useFileBrowserDropTarget,
125
- ho as useFileBrowserItemDrag,
126
+ Po as useFileBrowserDropTarget,
127
+ Ro as useFileBrowserItemDrag,
126
128
  _ as useFloeConfig,
127
- Ro as useKeybind,
129
+ Io as useKeybind,
128
130
  $ as useLayout,
129
- Io as useMediaQuery,
131
+ bo as useMediaQuery,
130
132
  ie as useNotification,
131
133
  E as useOptionalComponentRegistry,
132
- bo as usePersisted,
133
- Ao as useResizeObserver,
134
+ Ao as usePersisted,
135
+ Lo as useResizeObserver,
134
136
  w as useResolvedFloeConfig,
135
137
  me as useTheme,
136
138
  fe as useViewActivation,
137
- ue as useWidgetRegistry,
139
+ xe as useWidgetRegistry,
138
140
  ye as useWidgetState,
139
141
  ve as useWidgetStateContext
140
142
  };
@@ -7,3 +7,4 @@ export * from './dom';
7
7
  export * from './gridCollision';
8
8
  export * from './gridLayout';
9
9
  export * from './hotInteraction';
10
+ export * from './uiFirstSelection';
@@ -0,0 +1,31 @@
1
+ import { type Accessor } from 'solid-js';
2
+ export type UIFirstSelectionPhase = 'requested' | 'intent_presented' | 'commit_started' | 'committed' | 'content_presented' | 'cancelled';
3
+ export interface UIFirstSelectionEvent<T, M = undefined> {
4
+ phase: UIFirstSelectionPhase;
5
+ value: T;
6
+ metadata: M | undefined;
7
+ transactionId: number;
8
+ startedAt: number;
9
+ timestamp: number;
10
+ elapsedMs: number;
11
+ }
12
+ export interface CreateUIFirstSelectionOptions<T, M = undefined> {
13
+ committed: Accessor<T>;
14
+ commit: (value: T, metadata: M | undefined) => void;
15
+ equals?: (left: T, right: T) => boolean;
16
+ /** Run the deferred commit even when the requested value already equals canonical state. */
17
+ commitEqualRequests?: boolean;
18
+ onEvent?: (event: UIFirstSelectionEvent<T, M>) => void;
19
+ scheduleAfterPaint?: (callback: () => void) => void;
20
+ }
21
+ export interface UIFirstSelectionController<T, M = undefined> {
22
+ visual: Accessor<T>;
23
+ committed: Accessor<T>;
24
+ pending: Accessor<boolean>;
25
+ preview: (value: T) => void;
26
+ resetPreview: () => void;
27
+ request: (value: T, metadata?: M) => void;
28
+ commitNow: (value: T, metadata?: M) => void;
29
+ cancel: () => void;
30
+ }
31
+ export declare function createUIFirstSelection<T, M = undefined>(options: CreateUIFirstSelectionOptions<T, M>): UIFirstSelectionController<T, M>;
@@ -0,0 +1,70 @@
1
+ import { untrack as p, createSignal as v, createEffect as x, onCleanup as C } from "solid-js";
2
+ import { deferAfterPaint as E } from "./defer.js";
3
+ function w() {
4
+ return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
5
+ }
6
+ function b(a) {
7
+ const m = a.equals ?? Object.is, u = a.scheduleAfterPaint ?? E;
8
+ let o = p(a.committed);
9
+ const [A, i] = v(o, { equals: m }), [q, d] = v(!1);
10
+ let c = null, g = 1, r = !1, f = !1;
11
+ const s = (t, n) => {
12
+ const e = w();
13
+ a.onEvent?.({
14
+ phase: t,
15
+ value: n.value,
16
+ metadata: n.metadata,
17
+ transactionId: n.id,
18
+ startedAt: n.startedAt,
19
+ timestamp: e,
20
+ elapsedMs: Math.max(0, e - n.startedAt)
21
+ });
22
+ }, l = (t) => {
23
+ const n = c;
24
+ c = null, f = !1, d(!1), n && s("cancelled", n), t && !r && i(() => a.committed());
25
+ }, P = (t, n) => {
26
+ if (r) return;
27
+ if (c && l(!1), f = !1, i(() => t), m(t, a.committed()) && !a.commitEqualRequests) {
28
+ d(!1);
29
+ return;
30
+ }
31
+ const e = {
32
+ id: g,
33
+ value: t,
34
+ metadata: n,
35
+ startedAt: w(),
36
+ committing: !1
37
+ };
38
+ g += 1, c = e, d(!0), s("requested", e), u(() => {
39
+ r || c !== e || (s("intent_presented", e), s("commit_started", e), e.committing = !0, a.commit(e.value, e.metadata), e.committing = !1, !(r || c !== e) && (s("committed", e), u(() => {
40
+ r || c !== e || (s("content_presented", e), c = null, d(!1), i(() => a.committed()));
41
+ })));
42
+ });
43
+ }, h = (t, n) => {
44
+ r || (l(!1), f = !1, i(() => t), m(t, a.committed()) || a.commit(t, n), i(() => a.committed()));
45
+ };
46
+ return x(() => {
47
+ const t = a.committed(), n = !m(t, o);
48
+ o = t;
49
+ const e = c;
50
+ e && e.committing && m(t, e.value) || (e && n && !m(t, e.value) && l(!1), (!c || !m(t, c.value)) && (f = !1, i(() => t)));
51
+ }), C(() => {
52
+ r = !0, l(!1);
53
+ }), {
54
+ visual: A,
55
+ committed: a.committed,
56
+ pending: q,
57
+ preview: (t) => {
58
+ r || c || (f = !0, i(() => t));
59
+ },
60
+ resetPreview: () => {
61
+ r || !f || c || (f = !1, i(() => a.committed()));
62
+ },
63
+ request: P,
64
+ commitNow: h,
65
+ cancel: () => l(!0)
66
+ };
67
+ }
68
+ export {
69
+ b as createUIFirstSelection
70
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.36.74",
3
+ "version": "0.36.76",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",