@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/app/ActivityAppsMain.d.ts +2 -0
- package/dist/app/ActivityAppsMain.js +15 -12
- package/dist/components/layout/ActivityBar.js +1 -1
- package/dist/components/layout/KeepAliveStack.d.ts +2 -0
- package/dist/components/layout/KeepAliveStack.js +109 -96
- package/dist/components/layout/Shell.d.ts +2 -0
- package/dist/components/layout/Shell.js +167 -139
- package/dist/components/ui/Tabs.js +102 -103
- package/dist/components/workbench/WorkbenchCanvas.d.ts +1 -0
- package/dist/components/workbench/WorkbenchCanvas.js +34 -25
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +1 -0
- package/dist/components/workbench/WorkbenchCanvasField.js +18 -12
- package/dist/components/workbench/WorkbenchSurface.d.ts +6 -0
- package/dist/components/workbench/WorkbenchSurface.js +198 -161
- package/dist/components/workbench/WorkbenchWidget.d.ts +1 -0
- package/dist/components/workbench/WorkbenchWidget.js +183 -176
- package/dist/full.js +59 -57
- package/dist/index.js +58 -56
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/uiFirstSelection.d.ts +31 -0
- package/dist/utils/uiFirstSelection.js +70 -0
- package/package.json +1 -1
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 {
|
|
145
|
-
import {
|
|
146
|
-
import {
|
|
147
|
-
import {
|
|
148
|
-
import {
|
|
149
|
-
import {
|
|
150
|
-
import {
|
|
151
|
-
import {
|
|
152
|
-
import {
|
|
153
|
-
import {
|
|
154
|
-
import {
|
|
155
|
-
import {
|
|
156
|
-
import {
|
|
157
|
-
import {
|
|
158
|
-
import {
|
|
159
|
-
import {
|
|
160
|
-
import {
|
|
161
|
-
import {
|
|
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
|
-
|
|
645
|
-
|
|
646
|
+
Xf as deferAfterPaint,
|
|
647
|
+
Zf as deferNonBlocking,
|
|
646
648
|
st as deleteTerminalTextBackward,
|
|
647
649
|
Ct as dispatchTerminalSessionKey,
|
|
648
|
-
|
|
649
|
-
|
|
650
|
+
Qf as duration,
|
|
651
|
+
jf as easing,
|
|
650
652
|
sa as ensureSurfacePortalInteractionTracking,
|
|
651
653
|
lm as estimateNotesContextMenuHeight,
|
|
652
|
-
|
|
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
|
-
|
|
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
|
-
|
|
683
|
+
pd as isMacLikePlatform,
|
|
682
684
|
cf as isPointInsideCanvasRect,
|
|
683
|
-
|
|
685
|
+
fd as isPrimaryModKeyPressed,
|
|
684
686
|
Qp as isStreamEvent,
|
|
685
687
|
pa as isSurfacePortalMode,
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
688
|
+
xd as isTypingElement,
|
|
689
|
+
Jf as listContainer,
|
|
690
|
+
$f as listItem,
|
|
689
691
|
lf as localToCanvasWorld,
|
|
690
|
-
|
|
691
|
-
|
|
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
|
-
|
|
702
|
-
|
|
703
|
+
ed as panelResize,
|
|
704
|
+
Td as parseKeybind,
|
|
703
705
|
yt as parseTerminalSuggestionContext,
|
|
704
706
|
Vp as pixelDeltaToGridDelta,
|
|
705
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
738
|
+
rd as scaleIn,
|
|
737
739
|
Bm as screenToWorld,
|
|
738
740
|
ut as setTerminalSessionInputValue,
|
|
739
741
|
cn as shouldActivateWorkbenchWidgetLocalTarget,
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
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
|
-
|
|
749
|
+
ld as springConfig,
|
|
748
750
|
gc as startHotInteraction,
|
|
749
|
-
|
|
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
|
-
|
|
762
|
-
|
|
763
|
+
Ld as useAttachments,
|
|
764
|
+
_d as useAutoScroll,
|
|
763
765
|
Tn as useChatContext,
|
|
764
766
|
wf as useCodeHighlight,
|
|
765
767
|
Wn as useCommand,
|
|
766
|
-
|
|
768
|
+
hd as useCommandContributions,
|
|
767
769
|
Hn as useComponentContextFactory,
|
|
768
770
|
Un as useComponentRegistry,
|
|
769
771
|
yp as useCurrentWidgetId,
|
|
770
|
-
|
|
772
|
+
yd as useDebounce,
|
|
771
773
|
Da as useDeck,
|
|
772
|
-
|
|
774
|
+
Od as useDeckDrag,
|
|
773
775
|
yc as useFileBrowser,
|
|
774
776
|
Rc as useFileBrowserDrag,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
+
Md as useFileBrowserDropTarget,
|
|
778
|
+
Nd as useFileBrowserItemDrag,
|
|
777
779
|
ea as useFloeConfig,
|
|
778
780
|
fl as useFormSubmitting,
|
|
779
|
-
|
|
781
|
+
bd as useKeybind,
|
|
780
782
|
Ol as useLayout,
|
|
781
|
-
|
|
783
|
+
Ud as useMediaQuery,
|
|
782
784
|
yf as useMermaid,
|
|
783
785
|
Qm as useNotification,
|
|
784
786
|
Gn as useOptionalComponentRegistry,
|
|
785
|
-
|
|
786
|
-
|
|
787
|
+
Vd as usePersisted,
|
|
788
|
+
zd as useResizeObserver,
|
|
787
789
|
oa as useResolvedFloeConfig,
|
|
788
790
|
ip as useTheme,
|
|
789
791
|
Cp as useViewActivation,
|
|
790
|
-
|
|
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
|
|
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
|
|
15
|
-
import { WidgetStateProvider as
|
|
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 {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Ke as
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
+
qe as panelResize,
|
|
98
|
+
po as parseKeybind,
|
|
97
99
|
Re as pixelDeltaToGridDelta,
|
|
98
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
114
|
+
to as springConfig,
|
|
113
115
|
U as startHotInteraction,
|
|
114
116
|
l as syncThemeTokenOverrides,
|
|
115
117
|
R as useCommand,
|
|
116
|
-
|
|
118
|
+
Co as useCommandContributions,
|
|
117
119
|
O as useComponentContextFactory,
|
|
118
120
|
A as useComponentRegistry,
|
|
119
121
|
Ce as useCurrentWidgetId,
|
|
120
|
-
|
|
122
|
+
vo as useDebounce,
|
|
121
123
|
V as useDeck,
|
|
122
|
-
|
|
124
|
+
ko as useDeckDrag,
|
|
123
125
|
q as useFileBrowserDrag,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
Po as useFileBrowserDropTarget,
|
|
127
|
+
Ro as useFileBrowserItemDrag,
|
|
126
128
|
_ as useFloeConfig,
|
|
127
|
-
|
|
129
|
+
Io as useKeybind,
|
|
128
130
|
$ as useLayout,
|
|
129
|
-
|
|
131
|
+
bo as useMediaQuery,
|
|
130
132
|
ie as useNotification,
|
|
131
133
|
E as useOptionalComponentRegistry,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
Ao as usePersisted,
|
|
135
|
+
Lo as useResizeObserver,
|
|
134
136
|
w as useResolvedFloeConfig,
|
|
135
137
|
me as useTheme,
|
|
136
138
|
fe as useViewActivation,
|
|
137
|
-
|
|
139
|
+
xe as useWidgetRegistry,
|
|
138
140
|
ye as useWidgetState,
|
|
139
141
|
ve as useWidgetStateContext
|
|
140
142
|
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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
|
+
};
|