@floegence/floe-webapp-core 0.54.1 → 0.55.0

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
@@ -142,38 +142,39 @@ import { WidgetTypeSwitcher as Df } from "./components/deck/WidgetTypeSwitcher.j
142
142
  import { WorkingIndicator as yf } from "./components/chat/status/WorkingIndicator.js";
143
143
  import { applyDragDelta as Bf, applyResizeDelta as Mf, getGridCellSize as Of, pixelDeltaToGridDelta as Wf, positionToGridArea as Nf, snapToGrid as bf } from "./utils/gridLayout.js";
144
144
  import { buildAssistantNoticeEvents as Uf, createStreamEventBuilder as Hf, isStreamEvent as Gf } from "./components/chat/streamEvents.js";
145
- import { checkCollision as Kf, constrainPosition as zf, findFreePosition as Xf, hasCollision as Zf, sameGridPosition as Qf } from "./utils/gridCollision.js";
146
- import { classifyArchiveFileName as qf } from "./components/file-browser/archiveFiles.js";
147
- import { clientToCanvasLocal as Jf, clientToCanvasWorld as $f, createViewportFromZoomAnchor as ed, isPointInsideCanvasRect as od, localToCanvasWorld as rd } from "./components/ui/canvasGeometry.js";
148
- import { cn as id } from "./utils/cn.js";
149
- import { computeCodeDiff as ad, computeCodeDiffSync as cd, configureDiffWorker as ld, createDiffWorker as md, hasDiffWorker as sd, terminateDiffWorker as pd, waitForDiffWorker as fd } from "./components/chat/hooks/useCodeDiff.js";
150
- import { configureMarkdownWorker as Td, createMarkdownWorker as Sd, hasMarkdownWorker as Id, renderMarkdown as xd, renderMarkdownSync as Cd, terminateMarkdownWorker as ud, waitForMarkdownWorker as gd } from "./components/chat/hooks/useMarkdown.js";
151
- import { configureMermaidWorker as kd, configureSyncMermaid as Fd, renderMermaid as Ed, terminateMermaidWorker as Pd, useMermaid as Ad } from "./components/chat/hooks/useMermaid.js";
152
- import { configureShikiWorker as _d, configureSyncHighlighter as Dd, highlightCode as Rd, terminateShikiWorker as yd, useCodeHighlight as vd } from "./components/chat/hooks/useCodeHighlight.js";
153
- import { createFloatingPresence as Md } from "./components/ui/floatingPresence.js";
154
- import { createLongPressContextMenuHandlers as Wd } from "./components/file-browser/longPressContextMenu.js";
155
- import { createSimpleContext as bd } from "./context/createSimpleContext.js";
156
- import { createUIFirstSelection as Ud } from "./utils/uiFirstSelection.js";
157
- import { deferAfterPaint as Gd, deferNonBlocking as Vd } from "./utils/defer.js";
158
- import { duration as zd, easing as Xd, fadeIn as Zd, listContainer as Qd, listItem as Yd, panelResize as qd, popIn as jd, scaleIn as Jd, sidebarVariants as $d, slideInFromBottom as eT, slideInFromLeft as oT, slideInFromRight as rT, slideInFromTop as tT, springConfig as iT } from "./utils/animations.js";
159
- import { formatKeybind as aT, isMacLikePlatform as cT, isPrimaryModKeyPressed as lT, matchKeybind as mT, parseKeybind as sT } from "./utils/keybind.js";
160
- import { intersectSurfaceRects as fT } from "./components/ui/surfaceFloatingBoundary.js";
161
- import { isTypingElement as TT, shouldIgnoreHotkeys as ST } from "./utils/dom.js";
162
- import { lockBodyStyle as xT } from "./utils/bodyStyleLock.js";
163
- import { registerCommandContributions as uT, useCommandContributions as gT } from "./hooks/useCommandContributions.js";
164
- import { resolveFloatingWindowViewport as kT } from "./components/ui/floatingWindowGeometry.js";
165
- import { secureRandomUUID as ET } from "./utils/secureRandom.js";
166
- import { startPointerSession as AT } from "./components/ui/pointerSession.js";
167
- import { useAttachments as _T } from "./components/chat/hooks/useAttachments.js";
168
- import { useAutoScroll as RT } from "./components/chat/hooks/useAutoScroll.js";
169
- import { useDebounce as vT } from "./hooks/useDebounce.js";
170
- import { useDeckDrag as MT } from "./hooks/useDeckDrag.js";
171
- import { useFileBrowserDropTarget as WT, useFileBrowserItemDrag as NT } from "./hooks/useFileBrowserDrag.js";
172
- import { useKeybind as wT } from "./hooks/useKeybind.js";
173
- import { useMediaQuery as HT } from "./hooks/useMediaQuery.js";
174
- import { usePersisted as VT } from "./hooks/usePersisted.js";
175
- import { useResizeObserver as zT } from "./hooks/useResizeObserver.js";
176
- import { useVirtualList as ZT } from "./components/chat/hooks/useVirtualList.js";
145
+ import { calculateFitScale as Kf } from "./utils/fitScale.js";
146
+ import { checkCollision as Xf, constrainPosition as Zf, findFreePosition as Qf, hasCollision as Yf, sameGridPosition as qf } from "./utils/gridCollision.js";
147
+ import { classifyArchiveFileName as Jf } from "./components/file-browser/archiveFiles.js";
148
+ import { clientToCanvasLocal as ed, clientToCanvasWorld as od, createViewportFromZoomAnchor as rd, isPointInsideCanvasRect as td, localToCanvasWorld as id } from "./components/ui/canvasGeometry.js";
149
+ import { cn as ad } from "./utils/cn.js";
150
+ import { computeCodeDiff as ld, computeCodeDiffSync as md, configureDiffWorker as sd, createDiffWorker as pd, hasDiffWorker as fd, terminateDiffWorker as dd, waitForDiffWorker as Td } from "./components/chat/hooks/useCodeDiff.js";
151
+ import { configureMarkdownWorker as Id, createMarkdownWorker as xd, hasMarkdownWorker as Cd, renderMarkdown as ud, renderMarkdownSync as gd, terminateMarkdownWorker as hd, waitForMarkdownWorker as kd } from "./components/chat/hooks/useMarkdown.js";
152
+ import { configureMermaidWorker as Ed, configureSyncMermaid as Pd, renderMermaid as Ad, terminateMermaidWorker as Ld, useMermaid as _d } from "./components/chat/hooks/useMermaid.js";
153
+ import { configureShikiWorker as Rd, configureSyncHighlighter as yd, highlightCode as vd, terminateShikiWorker as Bd, useCodeHighlight as Md } from "./components/chat/hooks/useCodeHighlight.js";
154
+ import { createFloatingPresence as Wd } from "./components/ui/floatingPresence.js";
155
+ import { createLongPressContextMenuHandlers as bd } from "./components/file-browser/longPressContextMenu.js";
156
+ import { createSimpleContext as Ud } from "./context/createSimpleContext.js";
157
+ import { createUIFirstSelection as Gd } from "./utils/uiFirstSelection.js";
158
+ import { deferAfterPaint as Kd, deferNonBlocking as zd } from "./utils/defer.js";
159
+ import { duration as Zd, easing as Qd, fadeIn as Yd, listContainer as qd, listItem as jd, panelResize as Jd, popIn as $d, scaleIn as eT, sidebarVariants as oT, slideInFromBottom as rT, slideInFromLeft as tT, slideInFromRight as iT, slideInFromTop as nT, springConfig as aT } from "./utils/animations.js";
160
+ import { formatKeybind as lT, isMacLikePlatform as mT, isPrimaryModKeyPressed as sT, matchKeybind as pT, parseKeybind as fT } from "./utils/keybind.js";
161
+ import { intersectSurfaceRects as TT } from "./components/ui/surfaceFloatingBoundary.js";
162
+ import { isTypingElement as IT, shouldIgnoreHotkeys as xT } from "./utils/dom.js";
163
+ import { lockBodyStyle as uT } from "./utils/bodyStyleLock.js";
164
+ import { registerCommandContributions as hT, useCommandContributions as kT } from "./hooks/useCommandContributions.js";
165
+ import { resolveFloatingWindowViewport as ET } from "./components/ui/floatingWindowGeometry.js";
166
+ import { secureRandomUUID as AT } from "./utils/secureRandom.js";
167
+ import { startPointerSession as _T } from "./components/ui/pointerSession.js";
168
+ import { useAttachments as RT } from "./components/chat/hooks/useAttachments.js";
169
+ import { useAutoScroll as vT } from "./components/chat/hooks/useAutoScroll.js";
170
+ import { useDebounce as MT } from "./hooks/useDebounce.js";
171
+ import { useDeckDrag as WT } from "./hooks/useDeckDrag.js";
172
+ import { useFileBrowserDropTarget as bT, useFileBrowserItemDrag as wT } from "./hooks/useFileBrowserDrag.js";
173
+ import { useKeybind as HT } from "./hooks/useKeybind.js";
174
+ import { useMediaQuery as VT } from "./hooks/useMediaQuery.js";
175
+ import { usePersisted as zT } from "./hooks/usePersisted.js";
176
+ import { useResizeObserver as ZT } from "./hooks/useResizeObserver.js";
177
+ import { useVirtualList as YT } from "./components/chat/hooks/useVirtualList.js";
177
178
  export {
178
179
  _ as Activity,
179
180
  Zt as ActivityAppsMain,
@@ -639,37 +640,38 @@ export {
639
640
  Uf as buildAssistantNoticeEvents,
640
641
  Xi as builtInShellThemePresets,
641
642
  c as builtInThemes,
643
+ Kf as calculateFitScale,
642
644
  es as centerViewportOnWorldPoint,
643
- Kf as checkCollision,
645
+ Xf as checkCollision,
644
646
  os as clampScale,
645
647
  It as clampTerminalCursor,
646
- qf as classifyArchiveFileName,
647
- Jf as clientToCanvasLocal,
648
- $f as clientToCanvasWorld,
649
- id as cn,
648
+ Jf as classifyArchiveFileName,
649
+ ed as clientToCanvasLocal,
650
+ od as clientToCanvasWorld,
651
+ ad as cn,
650
652
  rs as computeBoardBounds,
651
- ad as computeCodeDiff,
652
- cd as computeCodeDiffSync,
653
- ld as configureDiffWorker,
654
- Td as configureMarkdownWorker,
655
- kd as configureMermaidWorker,
656
- _d as configureShikiWorker,
657
- Dd as configureSyncHighlighter,
658
- Fd as configureSyncMermaid,
659
- zf as constrainPosition,
653
+ ld as computeCodeDiff,
654
+ md as computeCodeDiffSync,
655
+ sd as configureDiffWorker,
656
+ Id as configureMarkdownWorker,
657
+ Ed as configureMermaidWorker,
658
+ Rd as configureShikiWorker,
659
+ yd as configureSyncHighlighter,
660
+ Pd as configureSyncMermaid,
661
+ Zf as constrainPosition,
660
662
  oa as createCommandService,
661
663
  na as createComponentRegistry,
662
664
  Za as createDeckService,
663
665
  ts as createDefaultNotesSnapshot,
664
- md as createDiffWorker,
666
+ pd as createDiffWorker,
665
667
  Hs as createFilesystemPickerDataSource,
666
- Md as createFloatingPresence,
668
+ Wd as createFloatingPresence,
667
669
  sm as createLayoutService,
668
- Wd as createLongPressContextMenuHandlers,
669
- Sd as createMarkdownWorker,
670
+ bd as createLongPressContextMenuHandlers,
671
+ xd as createMarkdownWorker,
670
672
  ys as createNotificationService,
671
673
  Zi as createShellThemePreset,
672
- bd as createSimpleContext,
674
+ Ud as createSimpleContext,
673
675
  Hf as createStreamEventBuilder,
674
676
  xt as createTerminalEditorState,
675
677
  Wt as createTerminalFullLineSuggestion,
@@ -677,19 +679,19 @@ export {
677
679
  Nt as createTerminalTokenSuggestion,
678
680
  Kp as createTerminalWidget,
679
681
  Yp as createThemeService,
680
- Ud as createUIFirstSelection,
681
- ed as createViewportFromZoomAnchor,
682
+ Gd as createUIFirstSelection,
683
+ rd as createViewportFromZoomAnchor,
682
684
  uf as createWidgetRegistry,
683
- Gd as deferAfterPaint,
684
- Vd as deferNonBlocking,
685
+ Kd as deferAfterPaint,
686
+ zd as deferNonBlocking,
685
687
  Ct as deleteTerminalTextBackward,
686
688
  Pt as dispatchTerminalSessionKey,
687
- zd as duration,
688
- Xd as easing,
689
+ Zd as duration,
690
+ Qd as easing,
689
691
  ya as ensureSurfacePortalInteractionTracking,
690
692
  zm as estimateNotesContextMenuHeight,
691
- Zd as fadeIn,
692
- Xf as findFreePosition,
693
+ Yd as fadeIn,
694
+ Qf as findFreePosition,
693
695
  I as floeColorTokenCategories,
694
696
  x as floeDesignTokens,
695
697
  C as floeFontFamilyTokens,
@@ -701,7 +703,7 @@ export {
701
703
  E as floeThemeColorVariables,
702
704
  P as floeTypographyTokens,
703
705
  Cm as focusMenuItem,
704
- aT as formatKeybind,
706
+ lT as formatKeybind,
705
707
  Gs as formatPickerPath,
706
708
  vi as getFileIcon,
707
709
  A as getFloeColorTokenValue,
@@ -715,28 +717,28 @@ export {
715
717
  bt as getTerminalSuggestions,
716
718
  is as groupTrashItems,
717
719
  gm as handleMenuKeyboardNavigation,
718
- Zf as hasCollision,
720
+ Yf as hasCollision,
719
721
  aa as hasComponentRegistryContext,
720
- sd as hasDiffWorker,
722
+ fd as hasDiffWorker,
721
723
  jc as hasFileBrowserDragContext,
722
- Id as hasMarkdownWorker,
723
- Rd as highlightCode,
724
+ Cd as hasMarkdownWorker,
725
+ vd as highlightCode,
724
726
  ut as insertTerminalText,
725
- fT as intersectSurfaceRects,
727
+ TT as intersectSurfaceRects,
726
728
  m as isFloeSurfaceStyle,
727
729
  kn as isLocalInteractionSurfaceTarget,
728
- cT as isMacLikePlatform,
729
- od as isPointInsideCanvasRect,
730
- lT as isPrimaryModKeyPressed,
730
+ mT as isMacLikePlatform,
731
+ td as isPointInsideCanvasRect,
732
+ sT as isPrimaryModKeyPressed,
731
733
  Gf as isStreamEvent,
732
734
  va as isSurfacePortalMode,
733
735
  s as isThemeType,
734
- TT as isTypingElement,
735
- Qd as listContainer,
736
- Yd as listItem,
737
- rd as localToCanvasWorld,
738
- xT as lockBodyStyle,
739
- mT as matchKeybind,
736
+ IT as isTypingElement,
737
+ qd as listContainer,
738
+ jd as listItem,
739
+ id as localToCanvasWorld,
740
+ uT as lockBodyStyle,
741
+ pT as matchKeybind,
740
742
  wt as matchesTerminalSuggestionPrefix,
741
743
  ns as mergeBoardBounds,
742
744
  p as mergeThemeTokenMaps,
@@ -749,29 +751,29 @@ export {
749
751
  Yi as normalizeShellThemeSelection,
750
752
  Tt as normalizeTerminalWorkspaceProfile,
751
753
  ls as noteBucketMetrics,
752
- qd as panelResize,
753
- sT as parseKeybind,
754
+ Jd as panelResize,
755
+ fT as parseKeybind,
754
756
  Vs as parsePickerPath,
755
757
  Ut as parseTerminalSuggestionContext,
756
758
  Wf as pixelDeltaToGridDelta,
757
- jd as popIn,
759
+ $d as popIn,
758
760
  Nf as positionToGridArea,
759
761
  qi as presetSupportsMode,
760
762
  Ba as projectSurfacePortalPosition,
761
763
  Ma as projectSurfacePortalRect,
762
764
  ms as promoteLocalItem,
763
- uT as registerCommandContributions,
765
+ hT as registerCommandContributions,
764
766
  ss as removeSnapshotItem,
765
767
  ps as removeSnapshotTopic,
766
768
  fs as removeSnapshotTrashItem,
767
- xd as renderMarkdown,
768
- Cd as renderMarkdownSync,
769
- Ed as renderMermaid,
769
+ ud as renderMarkdown,
770
+ gd as renderMarkdownSync,
771
+ Ad as renderMermaid,
770
772
  ds as replaceSnapshotItem,
771
773
  Ts as replaceSnapshotTopic,
772
774
  Ss as replaceSnapshotTrashItem,
773
775
  Bi as resolveFileItemIcon,
774
- kT as resolveFloatingWindowViewport,
776
+ ET as resolveFloatingWindowViewport,
775
777
  ji as resolveShellThemePresetName,
776
778
  Fn as resolveSurfaceInteractionTargetRole,
777
779
  Oa as resolveSurfacePortalBoundaryRect,
@@ -785,23 +787,23 @@ export {
785
787
  An as resolveWorkbenchWidgetLocalTypingTarget,
786
788
  Ln as resolveWorkbenchWidgetTextSelectionTarget,
787
789
  yt as runTerminalMockCommand,
788
- Qf as sameGridPosition,
790
+ qf as sameGridPosition,
789
791
  mc as sanitizeDisplayMode,
790
- Jd as scaleIn,
792
+ eT as scaleIn,
791
793
  Is as screenToWorld,
792
- ET as secureRandomUUID,
794
+ AT as secureRandomUUID,
793
795
  _t as setTerminalSessionInputValue,
794
796
  _n as shouldActivateWorkbenchWidgetLocalTarget,
795
- ST as shouldIgnoreHotkeys,
796
- $d as sidebarVariants,
797
- eT as slideInFromBottom,
798
- oT as slideInFromLeft,
799
- rT as slideInFromRight,
800
- tT as slideInFromTop,
797
+ xT as shouldIgnoreHotkeys,
798
+ oT as sidebarVariants,
799
+ rT as slideInFromBottom,
800
+ tT as slideInFromLeft,
801
+ iT as slideInFromRight,
802
+ nT as slideInFromTop,
801
803
  bf as snapToGrid,
802
- iT as springConfig,
804
+ aT as springConfig,
803
805
  Gc as startHotInteraction,
804
- AT as startPointerSession,
806
+ _T as startPointerSession,
805
807
  Dt as submitTerminalSession,
806
808
  T as syncThemeTokenOverrides,
807
809
  Ht as terminalCommandTokenSuggestionProvider,
@@ -809,48 +811,48 @@ export {
809
811
  Vt as terminalPathSuggestionProvider,
810
812
  Kt as terminalRootSuggestionProvider,
811
813
  zt as terminalSnippetSuggestionProvider,
812
- pd as terminateDiffWorker,
813
- ud as terminateMarkdownWorker,
814
- Pd as terminateMermaidWorker,
815
- yd as terminateShikiWorker,
814
+ dd as terminateDiffWorker,
815
+ hd as terminateMarkdownWorker,
816
+ Ld as terminateMermaidWorker,
817
+ Bd as terminateShikiWorker,
816
818
  Sl as updateFileOpenSelection,
817
- _T as useAttachments,
818
- RT as useAutoScroll,
819
+ RT as useAttachments,
820
+ vT as useAutoScroll,
819
821
  On as useChatContext,
820
- vd as useCodeHighlight,
822
+ Md as useCodeHighlight,
821
823
  ra as useCommand,
822
- gT as useCommandContributions,
824
+ kT as useCommandContributions,
823
825
  ca as useComponentContextFactory,
824
826
  la as useComponentRegistry,
825
827
  Pf as useCurrentWidgetId,
826
- vT as useDebounce,
828
+ MT as useDebounce,
827
829
  Qa as useDeck,
828
- MT as useDeckDrag,
830
+ WT as useDeckDrag,
829
831
  ol as useFileBrowser,
830
832
  Jc as useFileBrowserDrag,
831
- WT as useFileBrowserDropTarget,
832
- NT as useFileBrowserItemDrag,
833
+ bT as useFileBrowserDropTarget,
834
+ wT as useFileBrowserItemDrag,
833
835
  ha as useFloeConfig,
834
836
  Vl as useFormSubmitting,
835
- wT as useKeybind,
837
+ HT as useKeybind,
836
838
  pm as useLayout,
837
- HT as useMediaQuery,
838
- Ad as useMermaid,
839
+ VT as useMediaQuery,
840
+ _d as useMermaid,
839
841
  vs as useNotification,
840
842
  ma as useOptionalComponentRegistry,
841
- VT as usePersisted,
842
- zT as useResizeObserver,
843
+ zT as usePersisted,
844
+ ZT as useResizeObserver,
843
845
  ka as useResolvedFloeConfig,
844
846
  qp as useTheme,
845
847
  sf as useViewActivation,
846
- ZT as useVirtualList,
848
+ YT as useVirtualList,
847
849
  gf as useWidgetRegistry,
848
850
  Af as useWidgetState,
849
851
  Lf as useWidgetStateContext,
850
852
  Ep as useWizard,
851
853
  xs as visibleWorldRect,
852
- fd as waitForDiffWorker,
853
- gd as waitForMarkdownWorker,
854
+ Td as waitForDiffWorker,
855
+ kd as waitForMarkdownWorker,
854
856
  Cs as worldToScreen,
855
857
  us as zoomViewportAtPoint
856
858
  };
@@ -4,6 +4,7 @@ export interface Size {
4
4
  height: number;
5
5
  }
6
6
  /**
7
- * Track element dimensions
7
+ * Track the usable content box in local CSS pixels, excluding padding and
8
+ * scrollbars. CSS transforms on the element or its ancestors do not affect it.
8
9
  */
9
10
  export declare function useResizeObserver(element: Accessor<HTMLElement | null | undefined>): Accessor<Size | null>;
@@ -1,25 +1,29 @@
1
- import { createSignal as h, createEffect as g, onCleanup as s } from "solid-js";
2
- function w(c) {
3
- const [d, n] = h(null);
4
- return g(() => {
5
- const e = c();
6
- if (!e) return;
7
- const r = e.getBoundingClientRect();
8
- if (n({ width: r.width, height: r.height }), typeof ResizeObserver > "u") {
9
- const t = () => n({ width: e.getBoundingClientRect().width, height: e.getBoundingClientRect().height });
10
- typeof window < "u" && (window.addEventListener("resize", t), s(() => window.removeEventListener("resize", t)));
1
+ import { createSignal as u, createEffect as h, onCleanup as s } from "solid-js";
2
+ function f(d) {
3
+ const [a, r] = u(null, {
4
+ equals: (e, t) => e?.width === t?.width && e?.height === t?.height
5
+ });
6
+ return h(() => {
7
+ const e = d();
8
+ if (!e) {
9
+ r(null);
11
10
  return;
12
11
  }
13
- const o = new ResizeObserver((t) => {
14
- const i = t[0];
15
- i && n({
16
- width: i.contentRect.width,
17
- height: i.contentRect.height
12
+ const t = () => {
13
+ const n = e.ownerDocument.defaultView.getComputedStyle(e), i = (c) => Number.parseFloat(c) || 0;
14
+ r({
15
+ width: Math.max(0, e.clientWidth - i(n.paddingLeft) - i(n.paddingRight)),
16
+ height: Math.max(0, e.clientHeight - i(n.paddingTop) - i(n.paddingBottom))
18
17
  });
19
- });
18
+ };
19
+ if (t(), typeof ResizeObserver > "u") {
20
+ typeof window < "u" && (window.addEventListener("resize", t), s(() => window.removeEventListener("resize", t)));
21
+ return;
22
+ }
23
+ const o = new ResizeObserver(t);
20
24
  o.observe(e), s(() => o.disconnect());
21
- }), d;
25
+ }), a;
22
26
  }
23
27
  export {
24
- w as useResizeObserver
28
+ f as useResizeObserver
25
29
  };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FloeProvider as r } from "./app/FloeProvider.js";
2
- import { applyShellThemeAttribute as i, applySurfaceStyleAttribute as s, applyTheme as n, builtInThemes as a, getSystemTheme as m, isFloeSurfaceStyle as l, isThemeType as p, mergeThemeTokenMaps as f, resolveThemeTokenOverrides as d, resolveThemeTokens as T, syncThemeTokenOverrides as u } from "./styles/themes/index.js";
2
+ import { applyShellThemeAttribute as i, applySurfaceStyleAttribute as s, applyTheme as n, builtInThemes as a, getSystemTheme as m, isFloeSurfaceStyle as l, isThemeType as p, mergeThemeTokenMaps as f, resolveThemeTokenOverrides as d, resolveThemeTokens as T, syncThemeTokenOverrides as c } from "./styles/themes/index.js";
3
3
  import { floeColorTokenCategories as g, floeDesignTokens as x, floeFontFamilyTokens as y, floeMotionTokens as C, floeRadiusTokens as h, floeSharedCssVariables as S, floeSpacingTokens as F, floeSurfaceTokens as v, floeThemeColorVariables as P, floeTypographyTokens as k, getFloeColorTokenValue as I } from "./styles/tokens.js";
4
4
  import { BUILT_IN_SHELL_THEME_DEFAULTS as D, REQUIRED_SHELL_THEME_TOKENS as E, assertUniqueThemePresetNames as b, builtInShellThemePresets as L, createShellThemePreset as _, getShellThemePresetsForMode as A, normalizeShellThemeSelection as N, presetSupportsMode as O, resolveShellThemePresetName as M } from "./styles/themes/presets.js";
5
5
  import { CommandProvider as U, createCommandService as w, useCommand as G } from "./context/CommandContext.js";
@@ -8,31 +8,32 @@ import { DEFAULT_FLOE_CONFIG as j, FloeConfigProvider as J, useFloeConfig as X,
8
8
  import { DeckProvider as ee, createDeckService as oe, useDeck as re } from "./context/DeckContext.js";
9
9
  import { FLOE_GEOMETRY_SURFACE_ATTR as ie, FLOE_HOT_INTERACTION_ATTR as se, startHotInteraction as ne } from "./utils/hotInteraction.js";
10
10
  import { FileBrowserDragProvider as me, hasFileBrowserDragContext as le, useFileBrowserDrag as pe } from "./context/FileBrowserDragContext.js";
11
- import { LayoutProvider as de, createLayoutService as Te, useLayout as ue } from "./context/LayoutContext.js";
11
+ import { LayoutProvider as de, createLayoutService as Te, useLayout as ce } from "./context/LayoutContext.js";
12
12
  import { NotificationContainer as ge, NotificationProvider as xe, createNotificationService as ye, useNotification as Ce } from "./context/NotificationContext.js";
13
13
  import { ThemeProvider as Se, createThemeService as Fe, useTheme as ve } from "./context/ThemeContext.js";
14
14
  import { ViewActivationProvider as ke, useViewActivation as Ie } from "./context/ViewActivationContext.js";
15
15
  import { WidgetRegistryProvider as De, createWidgetRegistry as Ee, useWidgetRegistry as be } from "./context/WidgetRegistry.js";
16
16
  import { WidgetStateProvider as _e, useCurrentWidgetId as Ae, useWidgetState as Ne, useWidgetStateContext as Oe } from "./context/WidgetStateContext.js";
17
17
  import { applyDragDelta as Be, applyResizeDelta as Ue, getGridCellSize as we, pixelDeltaToGridDelta as Ge, positionToGridArea as He, snapToGrid as We } from "./utils/gridLayout.js";
18
- import { checkCollision as Ve, constrainPosition as ze, findFreePosition as Qe, hasCollision as qe, sameGridPosition as Ye } from "./utils/gridCollision.js";
19
- import { cn as Je } from "./utils/cn.js";
20
- import { createSimpleContext as Ze } from "./context/createSimpleContext.js";
21
- import { createUIFirstSelection as eo } from "./utils/uiFirstSelection.js";
22
- import { deferAfterPaint as ro, deferNonBlocking as to } from "./utils/defer.js";
23
- import { duration as so, easing as no, fadeIn as ao, listContainer as mo, listItem as lo, panelResize as po, popIn as fo, scaleIn as To, sidebarVariants as uo, slideInFromBottom as co, slideInFromLeft as go, slideInFromRight as xo, slideInFromTop as yo, springConfig as Co } from "./utils/animations.js";
24
- import { formatKeybind as So, isMacLikePlatform as Fo, isPrimaryModKeyPressed as vo, matchKeybind as Po, parseKeybind as ko } from "./utils/keybind.js";
25
- import { isTypingElement as Ro, shouldIgnoreHotkeys as Do } from "./utils/dom.js";
26
- import { lockBodyStyle as bo } from "./utils/bodyStyleLock.js";
27
- import { registerCommandContributions as _o, useCommandContributions as Ao } from "./hooks/useCommandContributions.js";
28
- import { secureRandomUUID as Oo } from "./utils/secureRandom.js";
29
- import { useDebounce as Bo } from "./hooks/useDebounce.js";
30
- import { useDeckDrag as wo } from "./hooks/useDeckDrag.js";
31
- import { useFileBrowserDropTarget as Ho, useFileBrowserItemDrag as Wo } from "./hooks/useFileBrowserDrag.js";
32
- import { useKeybind as Vo } from "./hooks/useKeybind.js";
33
- import { useMediaQuery as Qo } from "./hooks/useMediaQuery.js";
34
- import { usePersisted as Yo } from "./hooks/usePersisted.js";
35
- import { useResizeObserver as Jo } from "./hooks/useResizeObserver.js";
18
+ import { calculateFitScale as Ve } from "./utils/fitScale.js";
19
+ import { checkCollision as Qe, constrainPosition as qe, findFreePosition as Ye, hasCollision as je, sameGridPosition as Je } from "./utils/gridCollision.js";
20
+ import { cn as Ze } from "./utils/cn.js";
21
+ import { createSimpleContext as eo } from "./context/createSimpleContext.js";
22
+ import { createUIFirstSelection as ro } from "./utils/uiFirstSelection.js";
23
+ import { deferAfterPaint as io, deferNonBlocking as so } from "./utils/defer.js";
24
+ import { duration as ao, easing as mo, fadeIn as lo, listContainer as po, listItem as fo, panelResize as To, popIn as co, scaleIn as uo, sidebarVariants as go, slideInFromBottom as xo, slideInFromLeft as yo, slideInFromRight as Co, slideInFromTop as ho, springConfig as So } from "./utils/animations.js";
25
+ import { formatKeybind as vo, isMacLikePlatform as Po, isPrimaryModKeyPressed as ko, matchKeybind as Io, parseKeybind as Ro } from "./utils/keybind.js";
26
+ import { isTypingElement as Eo, shouldIgnoreHotkeys as bo } from "./utils/dom.js";
27
+ import { lockBodyStyle as _o } from "./utils/bodyStyleLock.js";
28
+ import { registerCommandContributions as No, useCommandContributions as Oo } from "./hooks/useCommandContributions.js";
29
+ import { secureRandomUUID as Bo } from "./utils/secureRandom.js";
30
+ import { useDebounce as wo } from "./hooks/useDebounce.js";
31
+ import { useDeckDrag as Ho } from "./hooks/useDeckDrag.js";
32
+ import { useFileBrowserDropTarget as Ko, useFileBrowserItemDrag as Vo } from "./hooks/useFileBrowserDrag.js";
33
+ import { useKeybind as Qo } from "./hooks/useKeybind.js";
34
+ import { useMediaQuery as Yo } from "./hooks/useMediaQuery.js";
35
+ import { usePersisted as Jo } from "./hooks/usePersisted.js";
36
+ import { useResizeObserver as Zo } from "./hooks/useResizeObserver.js";
36
37
  export {
37
38
  D as BUILT_IN_SHELL_THEME_DEFAULTS,
38
39
  U as CommandProvider,
@@ -60,25 +61,26 @@ export {
60
61
  b as assertUniqueThemePresetNames,
61
62
  L as builtInShellThemePresets,
62
63
  a as builtInThemes,
63
- Ve as checkCollision,
64
- Je as cn,
65
- ze as constrainPosition,
64
+ Ve as calculateFitScale,
65
+ Qe as checkCollision,
66
+ Ze as cn,
67
+ qe as constrainPosition,
66
68
  w as createCommandService,
67
69
  K as createComponentRegistry,
68
70
  oe as createDeckService,
69
71
  Te as createLayoutService,
70
72
  ye as createNotificationService,
71
73
  _ as createShellThemePreset,
72
- Ze as createSimpleContext,
74
+ eo as createSimpleContext,
73
75
  Fe as createThemeService,
74
- eo as createUIFirstSelection,
76
+ ro as createUIFirstSelection,
75
77
  Ee as createWidgetRegistry,
76
- ro as deferAfterPaint,
77
- to as deferNonBlocking,
78
- so as duration,
79
- no as easing,
80
- ao as fadeIn,
81
- Qe as findFreePosition,
78
+ io as deferAfterPaint,
79
+ so as deferNonBlocking,
80
+ ao as duration,
81
+ mo as easing,
82
+ lo as fadeIn,
83
+ Ye as findFreePosition,
82
84
  g as floeColorTokenCategories,
83
85
  x as floeDesignTokens,
84
86
  y as floeFontFamilyTokens,
@@ -89,67 +91,67 @@ export {
89
91
  v as floeSurfaceTokens,
90
92
  P as floeThemeColorVariables,
91
93
  k as floeTypographyTokens,
92
- So as formatKeybind,
94
+ vo as formatKeybind,
93
95
  I as getFloeColorTokenValue,
94
96
  we as getGridCellSize,
95
97
  A as getShellThemePresetsForMode,
96
98
  m as getSystemTheme,
97
- qe as hasCollision,
99
+ je as hasCollision,
98
100
  V as hasComponentRegistryContext,
99
101
  le as hasFileBrowserDragContext,
100
102
  l as isFloeSurfaceStyle,
101
- Fo as isMacLikePlatform,
102
- vo as isPrimaryModKeyPressed,
103
+ Po as isMacLikePlatform,
104
+ ko as isPrimaryModKeyPressed,
103
105
  p as isThemeType,
104
- Ro as isTypingElement,
105
- mo as listContainer,
106
- lo as listItem,
107
- bo as lockBodyStyle,
108
- Po as matchKeybind,
106
+ Eo as isTypingElement,
107
+ po as listContainer,
108
+ fo as listItem,
109
+ _o as lockBodyStyle,
110
+ Io as matchKeybind,
109
111
  f as mergeThemeTokenMaps,
110
112
  N as normalizeShellThemeSelection,
111
- po as panelResize,
112
- ko as parseKeybind,
113
+ To as panelResize,
114
+ Ro as parseKeybind,
113
115
  Ge as pixelDeltaToGridDelta,
114
- fo as popIn,
116
+ co as popIn,
115
117
  He as positionToGridArea,
116
118
  O as presetSupportsMode,
117
- _o as registerCommandContributions,
119
+ No as registerCommandContributions,
118
120
  M as resolveShellThemePresetName,
119
121
  d as resolveThemeTokenOverrides,
120
122
  T as resolveThemeTokens,
121
- Ye as sameGridPosition,
122
- To as scaleIn,
123
- Oo as secureRandomUUID,
124
- Do as shouldIgnoreHotkeys,
125
- uo as sidebarVariants,
126
- co as slideInFromBottom,
127
- go as slideInFromLeft,
128
- xo as slideInFromRight,
129
- yo as slideInFromTop,
123
+ Je as sameGridPosition,
124
+ uo as scaleIn,
125
+ Bo as secureRandomUUID,
126
+ bo as shouldIgnoreHotkeys,
127
+ go as sidebarVariants,
128
+ xo as slideInFromBottom,
129
+ yo as slideInFromLeft,
130
+ Co as slideInFromRight,
131
+ ho as slideInFromTop,
130
132
  We as snapToGrid,
131
- Co as springConfig,
133
+ So as springConfig,
132
134
  ne as startHotInteraction,
133
- u as syncThemeTokenOverrides,
135
+ c as syncThemeTokenOverrides,
134
136
  G as useCommand,
135
- Ao as useCommandContributions,
137
+ Oo as useCommandContributions,
136
138
  z as useComponentContextFactory,
137
139
  Q as useComponentRegistry,
138
140
  Ae as useCurrentWidgetId,
139
- Bo as useDebounce,
141
+ wo as useDebounce,
140
142
  re as useDeck,
141
- wo as useDeckDrag,
143
+ Ho as useDeckDrag,
142
144
  pe as useFileBrowserDrag,
143
- Ho as useFileBrowserDropTarget,
144
- Wo as useFileBrowserItemDrag,
145
+ Ko as useFileBrowserDropTarget,
146
+ Vo as useFileBrowserItemDrag,
145
147
  X as useFloeConfig,
146
- Vo as useKeybind,
147
- ue as useLayout,
148
- Qo as useMediaQuery,
148
+ Qo as useKeybind,
149
+ ce as useLayout,
150
+ Yo as useMediaQuery,
149
151
  Ce as useNotification,
150
152
  q as useOptionalComponentRegistry,
151
- Yo as usePersisted,
152
- Jo as useResizeObserver,
153
+ Jo as usePersisted,
154
+ Zo as useResizeObserver,
153
155
  Z as useResolvedFloeConfig,
154
156
  ve as useTheme,
155
157
  Ie as useViewActivation,
@@ -0,0 +1,10 @@
1
+ export interface FitScaleSize {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ /** Fit local content dimensions without capping enlargement or rounding scale. */
6
+ export declare function calculateFitScale(options: {
7
+ content: FitScaleSize;
8
+ viewport: FitScaleSize;
9
+ mode: 'contain' | 'width';
10
+ }): number | null;
@@ -0,0 +1,9 @@
1
+ function c(n) {
2
+ const { content: t, viewport: i, mode: r } = n;
3
+ if (![t.width, t.height, i.width, i.height].every((h) => Number.isFinite(h) && h > 0)) return null;
4
+ const e = r === "width" ? i.width / t.width : Math.min(i.width / t.width, i.height / t.height);
5
+ return Number.isFinite(e) && e > 0 ? e : null;
6
+ }
7
+ export {
8
+ c as calculateFitScale
9
+ };
@@ -1,4 +1,5 @@
1
1
  export { cn } from './cn';
2
+ export { calculateFitScale, type FitScaleSize } from './fitScale';
2
3
  export * from './defer';
3
4
  export * from './keybind';
4
5
  export * from './bodyStyleLock';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.54.1",
3
+ "version": "0.55.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",