@g9tm/lynxcontrols 1.4.7 → 1.4.11

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.
Files changed (121) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/base/index.d.ts +1 -1
  3. package/dist/base/index.d.ts.map +1 -1
  4. package/dist/base/index.jsx +1 -1
  5. package/dist/base/selection-item.d.ts +9 -1
  6. package/dist/base/selection-item.d.ts.map +1 -1
  7. package/dist/base/selection-item.jsx +10 -1
  8. package/dist/base/selection-item.jsx.map +1 -1
  9. package/dist/button/button.css +20 -0
  10. package/dist/button/button.css.map +1 -1
  11. package/dist/button/header-action-button.d.ts +5 -0
  12. package/dist/button/header-action-button.d.ts.map +1 -1
  13. package/dist/button/header-action-button.jsx +6 -1
  14. package/dist/button/header-action-button.jsx.map +1 -1
  15. package/dist/button/visuals.d.ts.map +1 -1
  16. package/dist/button/visuals.jsx +1 -1
  17. package/dist/button/visuals.jsx.map +1 -1
  18. package/dist/fields/editor.d.ts.map +1 -1
  19. package/dist/fields/editor.jsx +2 -2
  20. package/dist/fields/editor.jsx.map +1 -1
  21. package/dist/fields/fields.css +21 -0
  22. package/dist/fields/fields.css.map +1 -1
  23. package/dist/fields/index.d.ts +1 -1
  24. package/dist/fields/index.d.ts.map +1 -1
  25. package/dist/fields/index.jsx +1 -1
  26. package/dist/fields/outlined-field.d.ts +27 -1
  27. package/dist/fields/outlined-field.d.ts.map +1 -1
  28. package/dist/fields/outlined-field.jsx +29 -2
  29. package/dist/fields/outlined-field.jsx.map +1 -1
  30. package/dist/fields/text-entry.d.ts.map +1 -1
  31. package/dist/fields/text-entry.jsx +2 -2
  32. package/dist/fields/text-entry.jsx.map +1 -1
  33. package/dist/pickers/combo-box.d.ts +8 -0
  34. package/dist/pickers/combo-box.d.ts.map +1 -1
  35. package/dist/pickers/combo-box.jsx +51 -9
  36. package/dist/pickers/combo-box.jsx.map +1 -1
  37. package/dist/pickers/date-time-picker.d.ts +2 -2
  38. package/dist/pickers/date-time-picker.d.ts.map +1 -1
  39. package/dist/pickers/date-time-picker.jsx +4 -3
  40. package/dist/pickers/date-time-picker.jsx.map +1 -1
  41. package/dist/pickers/date-time.d.ts +5 -2
  42. package/dist/pickers/date-time.d.ts.map +1 -1
  43. package/dist/pickers/date-time.jsx +1 -1
  44. package/dist/pickers/date-time.jsx.map +1 -1
  45. package/dist/pickers/picker-sheet.d.ts +6 -2
  46. package/dist/pickers/picker-sheet.d.ts.map +1 -1
  47. package/dist/pickers/picker-sheet.jsx +2 -3
  48. package/dist/pickers/picker-sheet.jsx.map +1 -1
  49. package/dist/pickers/picker.d.ts.map +1 -1
  50. package/dist/pickers/picker.jsx +3 -2
  51. package/dist/pickers/picker.jsx.map +1 -1
  52. package/dist/pickers/pickers.css +27 -0
  53. package/dist/pickers/pickers.css.map +1 -1
  54. package/dist/pickers/timespan-picker.d.ts.map +1 -1
  55. package/dist/pickers/timespan-picker.jsx +3 -2
  56. package/dist/pickers/timespan-picker.jsx.map +1 -1
  57. package/dist/pickers/trigger.d.ts +3 -1
  58. package/dist/pickers/trigger.d.ts.map +1 -1
  59. package/dist/pickers/trigger.jsx +6 -1
  60. package/dist/pickers/trigger.jsx.map +1 -1
  61. package/dist/provider/settings.d.ts +12 -0
  62. package/dist/provider/settings.d.ts.map +1 -1
  63. package/dist/provider/settings.jsx +6 -3
  64. package/dist/provider/settings.jsx.map +1 -1
  65. package/dist/provider/theme.css +4 -0
  66. package/dist/provider/theme.css.map +1 -1
  67. package/dist/range-slider/math.d.ts +14 -4
  68. package/dist/range-slider/math.d.ts.map +1 -1
  69. package/dist/range-slider/math.jsx +16 -4
  70. package/dist/range-slider/math.jsx.map +1 -1
  71. package/dist/range-slider/range-slider.css +17 -0
  72. package/dist/range-slider/range-slider.css.map +1 -1
  73. package/dist/range-slider/range-slider.d.ts +11 -0
  74. package/dist/range-slider/range-slider.d.ts.map +1 -1
  75. package/dist/range-slider/range-slider.jsx +35 -13
  76. package/dist/range-slider/range-slider.jsx.map +1 -1
  77. package/dist/selection/index.d.ts +2 -1
  78. package/dist/selection/index.d.ts.map +1 -1
  79. package/dist/selection/index.jsx +2 -1
  80. package/dist/selection/selection-sheet.d.ts +3 -1
  81. package/dist/selection/selection-sheet.d.ts.map +1 -1
  82. package/dist/selection/selection-sheet.jsx +57 -8
  83. package/dist/selection/selection-sheet.jsx.map +1 -1
  84. package/dist/selection/selection.css +7 -0
  85. package/dist/selection/selection.css.map +1 -1
  86. package/dist/selection/window.d.ts +29 -0
  87. package/dist/selection/window.d.ts.map +1 -0
  88. package/dist/selection/window.jsx +24 -0
  89. package/dist/selection/window.jsx.map +1 -0
  90. package/dist/sheet/frame.d.ts.map +1 -1
  91. package/dist/sheet/frame.jsx +8 -4
  92. package/dist/sheet/frame.jsx.map +1 -1
  93. package/dist/sheet/header.d.ts.map +1 -1
  94. package/dist/sheet/header.jsx +3 -1
  95. package/dist/sheet/header.jsx.map +1 -1
  96. package/dist/sheet/index.d.ts +1 -1
  97. package/dist/sheet/index.d.ts.map +1 -1
  98. package/dist/sheet/index.jsx +1 -1
  99. package/dist/sheet/options.d.ts +20 -0
  100. package/dist/sheet/options.d.ts.map +1 -1
  101. package/dist/sheet/options.jsx +2 -1
  102. package/dist/sheet/options.jsx.map +1 -1
  103. package/dist/sheet/service.d.ts +8 -0
  104. package/dist/sheet/service.d.ts.map +1 -1
  105. package/dist/sheet/service.jsx +15 -4
  106. package/dist/sheet/service.jsx.map +1 -1
  107. package/dist/sheet/sizing.d.ts +2 -0
  108. package/dist/sheet/sizing.d.ts.map +1 -1
  109. package/dist/sheet/sizing.jsx +2 -1
  110. package/dist/sheet/sizing.jsx.map +1 -1
  111. package/dist/toggle/chip-group.d.ts +9 -1
  112. package/dist/toggle/chip-group.d.ts.map +1 -1
  113. package/dist/toggle/chip-group.jsx +51 -12
  114. package/dist/toggle/chip-group.jsx.map +1 -1
  115. package/dist/toggle/switch.d.ts +1 -1
  116. package/dist/toggle/switch.d.ts.map +1 -1
  117. package/dist/toggle/switch.jsx +3 -2
  118. package/dist/toggle/switch.jsx.map +1 -1
  119. package/dist/toggle/toggle.css +20 -0
  120. package/dist/toggle/toggle.css.map +1 -1
  121. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"sheet/options.jsx","sources":["../../src/sheet/options.ts"],"sourcesContent":["import type { ReactNode } from '@lynx-js/react';\nimport type { G9BottomSheetLoadingSkeleton } from '../display/shimmer';\nimport type { G9IconInput } from '../icon/icon';\n\n// MAUI `G9BottomSheetOptions` / `G9BottomSheetSettings` and their enums (BottomSheet/G9BottomSheetOptions.cs).\n\n/** Detents (MAUI `G9BottomSheetState`): peek (collapsed height), medium (half), large (full). */\nexport type G9SheetDetent = 'peek' | 'medium' | 'large';\n/** Detent sizing or fit-to-content (MAUI `G9BottomSheetSizeMode`). */\nexport type G9SheetSizeMode = 'states' | 'fitToContent';\n/** Header title anchor (MAUI `G9BottomSheetHeaderTitlePlacement`). */\nexport type G9SheetHeaderTitlePlacement = 'center' | 'nearBack';\n/** Where a back request came from (MAUI `G9BottomSheetBackRequestSource` + drag-to-close). */\nexport type G9SheetBackSource = 'toolbarButton' | 'hardwareButton' | 'overlayTap' | 'drag';\n/** What `onBackRequested` decides (MAUI `G9BottomSheetBackAction`). */\nexport type G9SheetBackAction = 'close' | 'doNothing';\n/** Content width (MAUI `G9SheetViewContentWidthMode`). */\nexport type G9SheetContentWidthMode = 'full' | 'custom';\n\n/** A header toolbar action (MAUI `G9BottomSheetToolbarItem`). */\nexport interface G9SheetToolbarItem {\n /** Glyph/icon. */\n readonly icon?: G9IconInput;\n /** Text (when there is no icon). */\n readonly text?: string;\n /** The action (MAUI `AsyncAction`/`Command`); a returned promise keeps the item busy while `disableWhileBusy`. */\n readonly onPress?: () => unknown;\n readonly isBusy?: boolean;\n /** Spinner while busy. Default false. */\n readonly showBusyIndicator?: boolean;\n readonly isActive?: boolean;\n /** Dot while active. Default false. */\n readonly showActiveBadge?: boolean;\n /** Ignore presses while busy. Default true. */\n readonly disableWhileBusy?: boolean;\n /** Default true. */\n readonly animatePress?: boolean;\n /** 0 → 24. */\n readonly iconSize?: number;\n readonly accessibilityLabel?: string;\n /** Element id of the item (default `${sheet automationId}_ToolbarItem_${key or index}` when the sheet has one). */\n readonly automationId?: string;\n /** Stable key (default the index). */\n readonly key?: string;\n}\n\n/** Lifecycle callbacks of one sheet (MAUI `Opening/Opened/Closing/ClosedCommand`). */\nexport interface G9SheetLifecycle {\n /** When the sheet starts opening. */\n readonly onOpening?: () => void;\n /** After the open motion (or its timer fallback). */\n readonly onOpened?: () => void;\n /** Once, when closing starts (not on an in-place replace). */\n readonly onClosing?: () => void;\n /** Once, at cleanup. */\n readonly onClosed?: () => void;\n /** The sheet came to rest at another detent (MAUI `G9SheetView.StateChanged`), with its height in px. */\n readonly onStateChanged?: (detent: G9SheetDetent | 'fit', heightPx: number) => void;\n}\n\n/** Everything a sheet can be opened with (MAUI `G9BottomSheetOptions`; 77 properties + presets). */\nexport interface G9SheetOptions extends G9SheetLifecycle {\n // State and sizing\n /** Initial detent. Default `'medium'`. */\n readonly currentState?: G9SheetDetent;\n /** Allowed detents. Default `['medium', 'large']`. */\n readonly states?: ReadonlyArray<G9SheetDetent>;\n /** Default `'states'`. */\n readonly sizeMode?: G9SheetSizeMode;\n /** Dim scrim that blocks the page. Default true. */\n readonly isModal?: boolean;\n /** Overlay tap / drag may close. Default true. */\n readonly isCancelable?: boolean;\n /** Default true. */\n readonly isDraggable?: boolean;\n /** Grabber. Default true. */\n readonly hasHandle?: boolean;\n /** Peek height (dp). Default 100 (with `collapsedHeight`). */\n readonly peekHeight?: number | null;\n /** Alias of `peekHeight` (MAUI `CollapsedHeight`); wins when both are set. */\n readonly collapsedHeight?: number | null;\n /** Medium = host × ratio (0.1–0.9). Default 0.5. */\n readonly halfExpandedRatio?: number | null;\n /** Large = host × ratio (0.1–1). Default 1. */\n readonly fullExpandedRatio?: number | null;\n /** Cap of a fit sheet (0.2–1). Default 0.75. */\n readonly maxFitToContentHeightRatio?: number;\n /** The largest detent is sized to the content (states mode). Default false. */\n readonly expandedFitsContent?: boolean;\n /**\n * Grabber on a draggable sheet with ONE detent, which (as in MAUI) has none by default. For a sheet that has one detent\n * only here — MAUI's peek of a short content followed it down to the content, so MAUI showed two detents of one height\n * and a grabber; lynx-ui resolves its detents once, so the host asks for one fit detent and keeps the grabber with this.\n * Default false.\n */\n readonly handleOnSingleDetent?: boolean;\n /** A drag on a scroller expands the sheet first. Default true. */\n readonly scrollingExpandsSheet?: boolean;\n /**\n * The body is a vertical scroller (default true). `false` for content that scrolls itself — a `<list>` page, a map:\n * the body becomes a flex column and the content fills it, so the content's own scroller gets a definite height (MAUI\n * puts the content in the body as is; a CollectionView body scrolls itself). Lynx-only, additive. Use it with a\n * detent-sized sheet (full screen / states); a fit-to-content sheet has no height to give.\n */\n readonly scrollBody?: boolean;\n /**\n * The body's scroll bar: `'system'` (default) — the platform's, shown while a finger scrolls, then faded; `'always'` —\n * a thin thumb in the body's side inset at the inline end, visible whenever the content is taller than the body and\n * moving with it (a menu of full-width cards whose last card is cut off says «more below»). Lynx-only, additive.\n */\n readonly scrollIndicator?: 'system' | 'always';\n /** Height memory key (needed for factory content). */\n readonly heightMemoKey?: string | null;\n // Visual\n /** Body padding. Default 0. */\n readonly padding?: number;\n /** 10 px gap under the header hairline. Default true. */\n readonly useStandardBodyTopGap?: boolean;\n /** Top corners. Default 12. */\n readonly cornerRadius?: number;\n /** Body background. Default `var(--g9-surface-container)`. */\n readonly backgroundColor?: string | null;\n /** Scrim colour; its alpha replaces the maximum opacity. */\n readonly windowBackgroundColor?: string | null;\n /** Default `'full'`. */\n readonly contentWidthMode?: G9SheetContentWidthMode;\n /** Width in `'custom'` mode (MAUI `G9BottomSheetContentWidth`). */\n readonly contentWidth?: number | null;\n /**\n * Full-screen sheets, and detent sheets resting at a `large` detent that reaches under the top inset, reserve the\n * top inset (MAUI state-aware top padding). Default true.\n */\n readonly useTopSafeAreaPadding?: boolean;\n /**\n * The surface reserves the host's bottom safe inset (a visible navigation bar or gesture handle) below the content\n * and footer. 0 on an immersive host. Default true.\n */\n readonly useBottomSafeAreaPadding?: boolean;\n /** Default 0. */\n readonly additionalTopSafeAreaPadding?: number;\n /** Replaces the top padding (0 = flush). */\n readonly topSafeAreaPaddingOverride?: number | null;\n /** Grabber on full-screen toolbar sheets. Default true. */\n readonly showFullScreenDragHandle?: boolean;\n /** Page recede behind a tall primary sheet. Default true. */\n readonly enableBackdropCardEffect?: boolean;\n /** Visible ratio where the recede starts. Default 0.75. */\n readonly backdropCardEffectThreshold?: number;\n // Animation and loading\n /** Per-sheet open duration (ms); default the settings value. */\n readonly openAnimationDurationMs?: number | null;\n readonly closeAnimationDurationMs?: number | null;\n /** Factory content builds after the open motion (spinner/skeleton first). Default true. */\n readonly deferContent?: boolean;\n /** Delay before deferred content swaps in. Default 369. */\n readonly loadDelayMs?: number;\n /** The placeholder uses the full height. Default false. */\n readonly useFullScreenLoadingPlaceholder?: boolean;\n /** Known final body height for the placeholder. */\n readonly deferredLoadingPlaceholderHeight?: number | null;\n /** Covered crossfade reveal of deferred content. Default true. */\n readonly fadeDeferredContentIn?: boolean;\n /** Placeholder shape. Default `'none'` (spinner). */\n readonly loadingSkeleton?: G9BottomSheetLoadingSkeleton;\n /** 0 → the shape's default. */\n readonly loadingSkeletonRowCount?: number;\n // Stack and replace\n /** The parent sinks and fades when this sheet stacks on it. Default true. */\n readonly recedeParentOnStack?: boolean;\n /** Hand-off: replaces the one open sheet once this one is ready. Default false. */\n readonly replaceCurrentSheet?: boolean;\n // Header and footer\n /** Three-slot header. Default false. */\n readonly showToolbar?: boolean;\n /** Leading back (or close) button. Default false. */\n readonly showCloseButton?: boolean;\n /** × instead of the back arrow. Default false. */\n readonly useCloseIcon?: boolean;\n /**\n * Automation id of the sheet (MAUI `AutomationId`): the surface gets it, the header's back/close button\n * `${id}_Back`, toolbar items `${id}_ToolbarItem_${key or index}` (see `g9ChildId`). Keep it to `[A-Za-z0-9_-]`.\n */\n readonly automationId?: string;\n readonly title?: string | null;\n readonly toolbarItems?: ReadonlyArray<G9SheetToolbarItem> | null;\n /** Items built from the content once it exists. */\n readonly toolbarItemsFactory?: (() => ReadonlyArray<G9SheetToolbarItem>) | null;\n /** Default `'center'`. */\n readonly headerTitlePlacement?: G9SheetHeaderTitlePlacement;\n /** Star/Auto/Star columns. Default true. */\n readonly reserveEmptyHeaderSlots?: boolean;\n readonly headerView?: ReactNode;\n readonly headerLeadingView?: ReactNode;\n readonly headerTitleView?: ReactNode;\n readonly headerTrailingView?: ReactNode;\n readonly headerLeadingAndTitleView?: ReactNode;\n readonly headerTitleAndTrailingView?: ReactNode;\n /**\n * A footer that draws its own band (usually a component rendering {@link G9SheetFooterBar}, or nothing) — for\n * buttons that come and go while the sheet is open. Wins over `footerView` and `footerButtons`.\n */\n readonly footerBand?: ReactNode;\n /** Custom footer inside the standard band; wins over `footerButtons`. */\n readonly footerView?: ReactNode;\n /** Equal-width footer buttons. */\n readonly footerButtons?: ReadonlyArray<ReactNode> | null;\n /** Default 3. */\n readonly footerMaxButtonsPerRow?: number;\n /** Hardware back closes. Default true. */\n readonly hardwareBackCloses?: boolean;\n /** Intercepts every back request (disables drag). */\n readonly onBackRequested?: ((source: G9SheetBackSource) => G9SheetBackAction | Promise<G9SheetBackAction>) | null;\n // Platform specific (accepted; applied where Lynx has an equivalent)\n /** Max sheet width on Android (px). */\n readonly androidMaxWidth?: number | null;\n /** Max sheet height on Android (px). */\n readonly androidMaxHeight?: number | null;\n /** Margin around the sheet on Android `[l, t, r, b]`. */\n readonly androidMargin?: readonly [number, number, number, number] | null;\n /** Android half-expanded ratio override. */\n readonly androidHalfExpandedRatio?: number | null;\n /** Square the expanded corners on Android. */\n readonly androidShouldRemoveExpandedCorners?: boolean | null;\n readonly windowsMaxWidth?: number | null;\n readonly windowsMaxHeight?: number | null;\n readonly windowsMinWidth?: number | null;\n readonly windowsMinHeight?: number | null;\n /** Animate the scrim colour on iOS. Default true. */\n readonly animateOverlayToColorOnIos?: boolean;\n}\n\n/** App-wide sheet settings (MAUI `G9BottomSheetSettings`), `<G9Provider settings={{ sheets }}>`. */\nexport interface G9SheetSettings {\n /** Default black. */\n readonly modalOverlayColor?: string;\n /** Dim at the smallest detent (0–1). Default 0.3. */\n readonly modalOverlayMinimumOpacity?: number;\n /** Dim at full screen (0–1). Default 0.9. */\n readonly modalOverlayMaximumOpacity?: number;\n /** Default 300. */\n readonly openAnimationDurationMs?: number;\n /** Default 300. */\n readonly closeAnimationDurationMs?: number;\n /** Partial traversals take a proportional slice. Default true. */\n readonly sizeScaledAnimationDuration?: boolean;\n /** Global switch of the page recede. Default true. */\n readonly enableBackdropCardEffect?: boolean;\n /** Colour behind the receded page. Default black. */\n readonly backdropCardColor?: string;\n /** Staged pipeline: a `replaceCurrentSheet` successor hands off once it is ready. Default true. */\n readonly stageBeforeShow?: boolean;\n /** Longest a hand-off waits for the successor to open before the old sheet closes anyway (0–5000). Default 250. */\n readonly preOpenMaxHoldMs?: number;\n /** Prebuilt (non-factory) content also waits behind the loading placeholder until after the open motion. Default false. */\n readonly deferPrebuiltContent?: boolean;\n /** `'platformNative'` (lynx-ui's motion) or `'timed'` (tween over the durations). Default platformNative. */\n readonly motionStyle?: 'platformNative' | 'timed';\n /** The app version the persisted sheet heights belong to; another version discards them. Default `'0'`. */\n readonly heightMemoVersion?: string;\n /**\n * Side padding of the header band (MAUI `G9LayoutMetrics.EdgeSpacing`, which an app may scale — AgriPad's 10 × 1.3\n * = 13). Default 16.\n */\n readonly headerEdgeSpacing?: number;\n}\n\nconst clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));\nconst finite = (v: number | undefined, fallback: number) =>\n typeof v === 'number' && Number.isFinite(v) ? v : fallback;\n\n/** {@link G9SheetSettings} with defaults, clamped like MAUI `G9BottomSheetSettings.Normalize`. */\nexport function resolveSheetSettings(settings: G9SheetSettings | undefined): Required<G9SheetSettings> {\n const s = settings ?? {};\n let min = clamp(finite(s.modalOverlayMinimumOpacity, 0.3), 0, 1);\n let max = clamp(finite(s.modalOverlayMaximumOpacity, 0.9), 0, 1);\n if (min > max) [min, max] = [max, min];\n return Object.freeze({\n modalOverlayColor: s.modalOverlayColor ?? '#000000',\n modalOverlayMinimumOpacity: min,\n modalOverlayMaximumOpacity: max,\n openAnimationDurationMs: Math.max(0, finite(s.openAnimationDurationMs, 300)),\n closeAnimationDurationMs: Math.max(0, finite(s.closeAnimationDurationMs, 300)),\n sizeScaledAnimationDuration: s.sizeScaledAnimationDuration ?? true,\n enableBackdropCardEffect: s.enableBackdropCardEffect ?? true,\n backdropCardColor: s.backdropCardColor ?? '#000000',\n stageBeforeShow: s.stageBeforeShow ?? true,\n preOpenMaxHoldMs: clamp(finite(s.preOpenMaxHoldMs, 250), 0, 5000),\n deferPrebuiltContent: s.deferPrebuiltContent ?? false,\n motionStyle: s.motionStyle ?? 'platformNative',\n heightMemoVersion: s.heightMemoVersion ?? '0',\n headerEdgeSpacing: Math.max(0, finite(s.headerEdgeSpacing, 16)),\n });\n}\n\n/** MAUI `DefaultOptions()`: medium, `[medium, large]`, modal, cancelable, handle, draggable. */\nexport function defaultSheetOptions(): G9SheetOptions {\n return {\n currentState: 'medium',\n states: ['medium', 'large'],\n sizeMode: 'states',\n halfExpandedRatio: 0.5,\n fullExpandedRatio: 1,\n };\n}\n\n/** MAUI `FitToContentOptions()`: sized to a non-scrolling body, capped at 75 % of the host. */\nexport function fitToContentSheetOptions(): G9SheetOptions {\n return { sizeMode: 'fitToContent', isCancelable: true, hasHandle: true, isDraggable: true, deferContent: true };\n}\n\n/** MAUI `FullScreenWithoutHandleOptions()`. */\nexport function fullScreenWithoutHandleSheetOptions(): G9SheetOptions {\n return {\n currentState: 'large',\n states: ['large'],\n isCancelable: false,\n isDraggable: false,\n hasHandle: false,\n deferContent: true,\n };\n}\n\n/** MAUI `FullScreenModalOptions(title, showCloseButton, hardwareBackCloses, toolbarItems)`. */\nexport function fullScreenModalSheetOptions(\n title?: string | null,\n showCloseButton = true,\n hardwareBackCloses = true,\n toolbarItems?: ReadonlyArray<G9SheetToolbarItem> | null,\n): G9SheetOptions {\n return {\n currentState: 'large',\n states: ['large'],\n sizeMode: 'states',\n isCancelable: false,\n isDraggable: false,\n hasHandle: false,\n cornerRadius: 0,\n backgroundColor: 'var(--g9-background)',\n showToolbar: true,\n showCloseButton,\n title: title ?? null,\n toolbarItems: toolbarItems ?? null,\n hardwareBackCloses,\n };\n}\n\n/** MAUI `FullScreenEdgeToEdgeModalOptions(hardwareBackCloses)`: no header, flush top. */\nexport function fullScreenEdgeToEdgeModalSheetOptions(hardwareBackCloses = true): G9SheetOptions {\n return {\n ...fullScreenModalSheetOptions(null, false, hardwareBackCloses),\n showToolbar: false,\n useTopSafeAreaPadding: false,\n topSafeAreaPaddingOverride: 0,\n additionalTopSafeAreaPadding: 0,\n };\n}\n"],"names":["clamp","v","lo","hi","Math","finite","fallback","Number","resolveSheetSettings","settings","_s_modalOverlayColor","_s_sizeScaledAnimationDuration","_s_enableBackdropCardEffect","_s_backdropCardColor","_s_stageBeforeShow","_s_deferPrebuiltContent","_s_motionStyle","_s_heightMemoVersion","s","min","max","Object","defaultSheetOptions","fitToContentSheetOptions","fullScreenWithoutHandleSheetOptions","fullScreenModalSheetOptions","title","showCloseButton","hardwareBackCloses","toolbarItems","fullScreenEdgeToEdgeModalSheetOptions"],"mappings":"AA0QA,MAAMA,QAAQ,CAACC,GAAWC,IAAYC,KAAeC,KAAK,GAAG,CAACD,IAAIC,KAAK,GAAG,CAACF,IAAID;AAC/E,MAAMI,SAAS,CAACJ,GAAuBK,WACrC,AAAa,YAAb,OAAOL,KAAkBM,OAAO,QAAQ,CAACN,KAAKA,IAAIK;AAG7C,SAASE,qBAAqBC,QAAqC;QAMnDC,sBAKUC,gCACHC,6BACPC,sBACFC,oBAEKC,yBACTC,gBACMC;IAjBrB,MAAMC,IAAIT,QAAAA,WAAAA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AC3B,UAAU;QACV,mBAAmB;QACnB,mBAAmB;IACrB;AACF;AAGO,SAASC;IACd,OAAO;QAAE,UAAU;QAAgB,cAAc;QAAM,WAAW;QAAM,aAAa;QAAM,cAAc;IAAK;AAChH;AAGO,SAASC;IACd,OAAO;QACL,cAAc;QACd,QAAQ;YAAC;SAAQ;QACjB,cAAc;QACd,aAAa;QACb,WAAW;QACX,cAAc;IAChB;AACF;AAGO,SAASC,4BACdC,KAAqB,EACrBC,kBAAkB,IAAI,EACtBC,qBAAqB,IAAI,EACzBC,YAAuD;IAEvD,OAAO;QACL,cAAc;QACd,QAAQ;YAAC;SAAQ;QACjB,UAAU;QACV,cAAc;QACd,aAAa;QACb,WAAW;QACX,cAAc;QACd,iBAAiB;QACjB,aAAa;QACbF;QACA,OAAOD,QAAAA,QAAAA,QAAS;QAChB,cAAcG,QAAAA,eAAAA,eAAgB;QAC9BD;IACF;AACF;AAGO,SAASE,sCAAsCF,qBAAqB,IAAI;IAC7E,OAAO;QACL,GAAGH,4BAA4B,MAAM,OAAOG,mBAAmB;QAC/D,aAAa;QACb,uBAAuB;QACvB,4BAA4B;QAC5B,8BAA8B;IAChC;AACF"}
1
+ {"version":3,"file":"sheet/options.jsx","sources":["../../src/sheet/options.ts"],"sourcesContent":["import type { ReactNode } from '@lynx-js/react';\nimport type { G9BottomSheetLoadingSkeleton } from '../display/shimmer';\nimport type { G9IconInput } from '../icon/icon';\n\n// MAUI `G9BottomSheetOptions` / `G9BottomSheetSettings` and their enums (BottomSheet/G9BottomSheetOptions.cs).\n\n/** Detents (MAUI `G9BottomSheetState`): peek (collapsed height), medium (half), large (full). */\nexport type G9SheetDetent = 'peek' | 'medium' | 'large';\n/** Detent sizing or fit-to-content (MAUI `G9BottomSheetSizeMode`). */\nexport type G9SheetSizeMode = 'states' | 'fitToContent';\n/** Header title anchor (MAUI `G9BottomSheetHeaderTitlePlacement`). */\nexport type G9SheetHeaderTitlePlacement = 'center' | 'nearBack';\n/** Where a back request came from (MAUI `G9BottomSheetBackRequestSource` + drag-to-close). */\nexport type G9SheetBackSource = 'toolbarButton' | 'hardwareButton' | 'overlayTap' | 'drag';\n/** What `onBackRequested` decides (MAUI `G9BottomSheetBackAction`). */\nexport type G9SheetBackAction = 'close' | 'doNothing';\n/** Content width (MAUI `G9SheetViewContentWidthMode`). */\nexport type G9SheetContentWidthMode = 'full' | 'custom';\n\n/** A header toolbar action (MAUI `G9BottomSheetToolbarItem`). */\nexport interface G9SheetToolbarItem {\n /** Glyph/icon. */\n readonly icon?: G9IconInput;\n /** Text (when there is no icon). */\n readonly text?: string;\n /** The action (MAUI `AsyncAction`/`Command`); a returned promise keeps the item busy while `disableWhileBusy`. */\n readonly onPress?: () => unknown;\n readonly isBusy?: boolean;\n /** Spinner while busy. Default false. */\n readonly showBusyIndicator?: boolean;\n readonly isActive?: boolean;\n /** Dot while active. Default false. */\n readonly showActiveBadge?: boolean;\n /**\n * A count on the action (MAUI 1.4.9 `BadgeText`: AgriPad's site filter shows its «۲» active filters): a small pill\n * with this text, shown whatever `showActiveBadge` / `isActive` say. Null / empty: the plain dot (or nothing).\n */\n readonly badgeText?: string | null;\n /** Ignore presses while busy. Default true. */\n readonly disableWhileBusy?: boolean;\n /** Default true. */\n readonly animatePress?: boolean;\n /** 0 → 24. */\n readonly iconSize?: number;\n readonly accessibilityLabel?: string;\n /** Element id of the item (default `${sheet automationId}_ToolbarItem_${key or index}` when the sheet has one). */\n readonly automationId?: string;\n /** Stable key (default the index). */\n readonly key?: string;\n}\n\n/** Lifecycle callbacks of one sheet (MAUI `Opening/Opened/Closing/ClosedCommand`). */\nexport interface G9SheetLifecycle {\n /** When the sheet starts opening. */\n readonly onOpening?: () => void;\n /** After the open motion (or its timer fallback). */\n readonly onOpened?: () => void;\n /** Once, when closing starts (not on an in-place replace). */\n readonly onClosing?: () => void;\n /** Once, at cleanup. */\n readonly onClosed?: () => void;\n /** The sheet came to rest at another detent (MAUI `G9SheetView.StateChanged`), with its height in px. */\n readonly onStateChanged?: (detent: G9SheetDetent | 'fit', heightPx: number) => void;\n}\n\n/** Everything a sheet can be opened with (MAUI `G9BottomSheetOptions`; 77 properties + presets). */\nexport interface G9SheetOptions extends G9SheetLifecycle {\n // State and sizing\n /** Initial detent. Default `'medium'`. */\n readonly currentState?: G9SheetDetent;\n /** Allowed detents. Default `['medium', 'large']`. */\n readonly states?: ReadonlyArray<G9SheetDetent>;\n /** Default `'states'`. */\n readonly sizeMode?: G9SheetSizeMode;\n /** Dim scrim that blocks the page. Default true. */\n readonly isModal?: boolean;\n /** Overlay tap / drag may close. Default true. */\n readonly isCancelable?: boolean;\n /** Default true. */\n readonly isDraggable?: boolean;\n /** Grabber. Default true. */\n readonly hasHandle?: boolean;\n /** Peek height (dp). Default 100 (with `collapsedHeight`). */\n readonly peekHeight?: number | null;\n /** Alias of `peekHeight` (MAUI `CollapsedHeight`); wins when both are set. */\n readonly collapsedHeight?: number | null;\n /** Medium = host × ratio (0.1–0.9). Default 0.5. */\n readonly halfExpandedRatio?: number | null;\n /** Large = host × ratio (0.1–1). Default 1. */\n readonly fullExpandedRatio?: number | null;\n /** Cap of a fit sheet (0.2–1). Default 0.75. */\n readonly maxFitToContentHeightRatio?: number;\n /** The largest detent is sized to the content (states mode). Default false. */\n readonly expandedFitsContent?: boolean;\n /**\n * Grabber on a draggable sheet with ONE detent, which (as in MAUI) has none by default. For a sheet that has one detent\n * only here — MAUI's peek of a short content followed it down to the content, so MAUI showed two detents of one height\n * and a grabber; lynx-ui resolves its detents once, so the host asks for one fit detent and keeps the grabber with this.\n * Default false.\n */\n readonly handleOnSingleDetent?: boolean;\n /** A drag on a scroller expands the sheet first. Default true. */\n readonly scrollingExpandsSheet?: boolean;\n /**\n * The body is a vertical scroller (default true). `false` for content that scrolls itself — a `<list>` page, a map:\n * the body becomes a flex column and the content fills it, so the content's own scroller gets a definite height (MAUI\n * puts the content in the body as is; a CollectionView body scrolls itself). Lynx-only, additive. Use it with a\n * detent-sized sheet (full screen / states); a fit-to-content sheet has no height to give.\n */\n readonly scrollBody?: boolean;\n /**\n * The body's scroll bar: `'system'` (default) — the platform's, shown while a finger scrolls, then faded; `'always'` —\n * a thin thumb in the body's side inset at the inline end, visible whenever the content is taller than the body and\n * moving with it (a menu of full-width cards whose last card is cut off says «more below»). Lynx-only, additive.\n */\n readonly scrollIndicator?: 'system' | 'always';\n /**\n * Called when the scrolling body comes within {@link scrollToEndThreshold} of its end — a body that renders a window\n * of a long list grows it here (the selection sheet's next page, MAUI 1.4.8 `OnItemsScrolled`). Not called for a\n * static body (`scrollBody: false`). Lynx-only, additive.\n */\n readonly onScrollToEnd?: () => void;\n /** Distance from the end (px) that counts as «at the end» for {@link onScrollToEnd}. Default 208 (four 52 px rows). */\n readonly scrollToEndThreshold?: number;\n /** Height memory key (needed for factory content). */\n readonly heightMemoKey?: string | null;\n // Visual\n /** Body padding. Default 0. */\n readonly padding?: number;\n /** 10 px gap under the header hairline. Default true. */\n readonly useStandardBodyTopGap?: boolean;\n /** Top corners. Default 12. */\n readonly cornerRadius?: number;\n /** Body background. Default `var(--g9-surface-container)`. */\n readonly backgroundColor?: string | null;\n /** Scrim colour; its alpha replaces the maximum opacity. */\n readonly windowBackgroundColor?: string | null;\n /** Default `'full'`. */\n readonly contentWidthMode?: G9SheetContentWidthMode;\n /** Width in `'custom'` mode (MAUI `G9BottomSheetContentWidth`). */\n readonly contentWidth?: number | null;\n /**\n * Full-screen sheets, and detent sheets resting at a `large` detent that reaches under the top inset, reserve the\n * top inset (MAUI state-aware top padding). Default true.\n */\n readonly useTopSafeAreaPadding?: boolean;\n /**\n * The surface reserves the host's bottom safe inset (a visible navigation bar or gesture handle) below the content\n * and footer. 0 on an immersive host. Default true.\n */\n readonly useBottomSafeAreaPadding?: boolean;\n /** Default 0. */\n readonly additionalTopSafeAreaPadding?: number;\n /** Replaces the top padding (0 = flush). */\n readonly topSafeAreaPaddingOverride?: number | null;\n /** Grabber on full-screen toolbar sheets. Default true. */\n readonly showFullScreenDragHandle?: boolean;\n /** Page recede behind a tall primary sheet. Default true. */\n readonly enableBackdropCardEffect?: boolean;\n /** Visible ratio where the recede starts. Default 0.75. */\n readonly backdropCardEffectThreshold?: number;\n // Animation and loading\n /** Per-sheet open duration (ms); default the settings value. */\n readonly openAnimationDurationMs?: number | null;\n readonly closeAnimationDurationMs?: number | null;\n /** Factory content builds after the open motion (spinner/skeleton first). Default true. */\n readonly deferContent?: boolean;\n /** Delay before deferred content swaps in. Default 369. */\n readonly loadDelayMs?: number;\n /** The placeholder uses the full height. Default false. */\n readonly useFullScreenLoadingPlaceholder?: boolean;\n /** Known final body height for the placeholder. */\n readonly deferredLoadingPlaceholderHeight?: number | null;\n /** Covered crossfade reveal of deferred content. Default true. */\n readonly fadeDeferredContentIn?: boolean;\n /** Placeholder shape. Default `'none'` (spinner). */\n readonly loadingSkeleton?: G9BottomSheetLoadingSkeleton;\n /** 0 → the shape's default. */\n readonly loadingSkeletonRowCount?: number;\n // Stack and replace\n /** The parent sinks and fades when this sheet stacks on it. Default true. */\n readonly recedeParentOnStack?: boolean;\n /** Hand-off: replaces the one open sheet once this one is ready. Default false. */\n readonly replaceCurrentSheet?: boolean;\n // Header and footer\n /** Three-slot header. Default false. */\n readonly showToolbar?: boolean;\n /** Leading back (or close) button. Default false. */\n readonly showCloseButton?: boolean;\n /** × instead of the back arrow. Default false. */\n readonly useCloseIcon?: boolean;\n /**\n * Automation id of the sheet (MAUI `AutomationId`): the surface gets it, the header's back/close button\n * `${id}_Back`, toolbar items `${id}_ToolbarItem_${key or index}` (see `g9ChildId`). Keep it to `[A-Za-z0-9_-]`.\n */\n readonly automationId?: string;\n readonly title?: string | null;\n readonly toolbarItems?: ReadonlyArray<G9SheetToolbarItem> | null;\n /** Items built from the content once it exists. */\n readonly toolbarItemsFactory?: (() => ReadonlyArray<G9SheetToolbarItem>) | null;\n /** Default `'center'`. */\n readonly headerTitlePlacement?: G9SheetHeaderTitlePlacement;\n /** Star/Auto/Star columns. Default true. */\n readonly reserveEmptyHeaderSlots?: boolean;\n readonly headerView?: ReactNode;\n readonly headerLeadingView?: ReactNode;\n readonly headerTitleView?: ReactNode;\n readonly headerTrailingView?: ReactNode;\n readonly headerLeadingAndTitleView?: ReactNode;\n readonly headerTitleAndTrailingView?: ReactNode;\n /**\n * A footer that draws its own band (usually a component rendering {@link G9SheetFooterBar}, or nothing) — for\n * buttons that come and go while the sheet is open. Wins over `footerView` and `footerButtons`.\n */\n readonly footerBand?: ReactNode;\n /** Custom footer inside the standard band; wins over `footerButtons`. */\n readonly footerView?: ReactNode;\n /** Equal-width footer buttons. */\n readonly footerButtons?: ReadonlyArray<ReactNode> | null;\n /** Default 3. */\n readonly footerMaxButtonsPerRow?: number;\n /** Hardware back closes. Default true. */\n readonly hardwareBackCloses?: boolean;\n /** Intercepts every back request (disables drag). */\n readonly onBackRequested?: ((source: G9SheetBackSource) => G9SheetBackAction | Promise<G9SheetBackAction>) | null;\n // Platform specific (accepted; applied where Lynx has an equivalent)\n /** Max sheet width on Android (px). */\n readonly androidMaxWidth?: number | null;\n /** Max sheet height on Android (px). */\n readonly androidMaxHeight?: number | null;\n /** Margin around the sheet on Android `[l, t, r, b]`. */\n readonly androidMargin?: readonly [number, number, number, number] | null;\n /** Android half-expanded ratio override. */\n readonly androidHalfExpandedRatio?: number | null;\n /** Square the expanded corners on Android. */\n readonly androidShouldRemoveExpandedCorners?: boolean | null;\n readonly windowsMaxWidth?: number | null;\n readonly windowsMaxHeight?: number | null;\n readonly windowsMinWidth?: number | null;\n readonly windowsMinHeight?: number | null;\n /** Animate the scrim colour on iOS. Default true. */\n readonly animateOverlayToColorOnIos?: boolean;\n}\n\n/** App-wide sheet settings (MAUI `G9BottomSheetSettings`), `<G9Provider settings={{ sheets }}>`. */\nexport interface G9SheetSettings {\n /** Default black. */\n readonly modalOverlayColor?: string;\n /** Dim at the smallest detent (0–1). Default 0.3. */\n readonly modalOverlayMinimumOpacity?: number;\n /** Dim at full screen (0–1). Default 0.9. */\n readonly modalOverlayMaximumOpacity?: number;\n /** Default 300. */\n readonly openAnimationDurationMs?: number;\n /** Default 300. */\n readonly closeAnimationDurationMs?: number;\n /** Partial traversals take a proportional slice. Default true. */\n readonly sizeScaledAnimationDuration?: boolean;\n /** Global switch of the page recede. Default true. */\n readonly enableBackdropCardEffect?: boolean;\n /**\n * The sheets rise above the soft keyboard (MAUI KeyboardInsetScope; G9MAUIControls 1.4.11 rule «every input in a bottom\n * sheet takes the keyboard shift»): while the keyboard is up the sheet layer ends at its top edge, so a fit sheet's field and\n * footer stay visible and a tall sheet gives up height. Only what the host has not already resized is lifted — a host that\n * pads its view by the IME inset (the gallery's `GalleryActivity`) shrinks the window itself. Default true.\n */\n readonly avoidKeyboard?: boolean;\n /** Colour behind the receded page. Default black. */\n readonly backdropCardColor?: string;\n /** Staged pipeline: a `replaceCurrentSheet` successor hands off once it is ready. Default true. */\n readonly stageBeforeShow?: boolean;\n /** Longest a hand-off waits for the successor to open before the old sheet closes anyway (0–5000). Default 250. */\n readonly preOpenMaxHoldMs?: number;\n /** Prebuilt (non-factory) content also waits behind the loading placeholder until after the open motion. Default false. */\n readonly deferPrebuiltContent?: boolean;\n /** `'platformNative'` (lynx-ui's motion) or `'timed'` (tween over the durations). Default platformNative. */\n readonly motionStyle?: 'platformNative' | 'timed';\n /** The app version the persisted sheet heights belong to; another version discards them. Default `'0'`. */\n readonly heightMemoVersion?: string;\n /**\n * Side padding of the header band (MAUI `G9LayoutMetrics.EdgeSpacing`, which an app may scale — AgriPad's 10 × 1.3\n * = 13). Default 16.\n */\n readonly headerEdgeSpacing?: number;\n}\n\nconst clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));\nconst finite = (v: number | undefined, fallback: number) =>\n typeof v === 'number' && Number.isFinite(v) ? v : fallback;\n\n/** {@link G9SheetSettings} with defaults, clamped like MAUI `G9BottomSheetSettings.Normalize`. */\nexport function resolveSheetSettings(settings: G9SheetSettings | undefined): Required<G9SheetSettings> {\n const s = settings ?? {};\n let min = clamp(finite(s.modalOverlayMinimumOpacity, 0.3), 0, 1);\n let max = clamp(finite(s.modalOverlayMaximumOpacity, 0.9), 0, 1);\n if (min > max) [min, max] = [max, min];\n return Object.freeze({\n modalOverlayColor: s.modalOverlayColor ?? '#000000',\n modalOverlayMinimumOpacity: min,\n modalOverlayMaximumOpacity: max,\n openAnimationDurationMs: Math.max(0, finite(s.openAnimationDurationMs, 300)),\n closeAnimationDurationMs: Math.max(0, finite(s.closeAnimationDurationMs, 300)),\n sizeScaledAnimationDuration: s.sizeScaledAnimationDuration ?? true,\n enableBackdropCardEffect: s.enableBackdropCardEffect ?? true,\n avoidKeyboard: s.avoidKeyboard ?? true,\n backdropCardColor: s.backdropCardColor ?? '#000000',\n stageBeforeShow: s.stageBeforeShow ?? true,\n preOpenMaxHoldMs: clamp(finite(s.preOpenMaxHoldMs, 250), 0, 5000),\n deferPrebuiltContent: s.deferPrebuiltContent ?? false,\n motionStyle: s.motionStyle ?? 'platformNative',\n heightMemoVersion: s.heightMemoVersion ?? '0',\n headerEdgeSpacing: Math.max(0, finite(s.headerEdgeSpacing, 16)),\n });\n}\n\n/** MAUI `DefaultOptions()`: medium, `[medium, large]`, modal, cancelable, handle, draggable. */\nexport function defaultSheetOptions(): G9SheetOptions {\n return {\n currentState: 'medium',\n states: ['medium', 'large'],\n sizeMode: 'states',\n halfExpandedRatio: 0.5,\n fullExpandedRatio: 1,\n };\n}\n\n/** MAUI `FitToContentOptions()`: sized to a non-scrolling body, capped at 75 % of the host. */\nexport function fitToContentSheetOptions(): G9SheetOptions {\n return { sizeMode: 'fitToContent', isCancelable: true, hasHandle: true, isDraggable: true, deferContent: true };\n}\n\n/** MAUI `FullScreenWithoutHandleOptions()`. */\nexport function fullScreenWithoutHandleSheetOptions(): G9SheetOptions {\n return {\n currentState: 'large',\n states: ['large'],\n isCancelable: false,\n isDraggable: false,\n hasHandle: false,\n deferContent: true,\n };\n}\n\n/** MAUI `FullScreenModalOptions(title, showCloseButton, hardwareBackCloses, toolbarItems)`. */\nexport function fullScreenModalSheetOptions(\n title?: string | null,\n showCloseButton = true,\n hardwareBackCloses = true,\n toolbarItems?: ReadonlyArray<G9SheetToolbarItem> | null,\n): G9SheetOptions {\n return {\n currentState: 'large',\n states: ['large'],\n sizeMode: 'states',\n isCancelable: false,\n isDraggable: false,\n hasHandle: false,\n cornerRadius: 0,\n backgroundColor: 'var(--g9-background)',\n showToolbar: true,\n showCloseButton,\n title: title ?? null,\n toolbarItems: toolbarItems ?? null,\n hardwareBackCloses,\n };\n}\n\n/** MAUI `FullScreenEdgeToEdgeModalOptions(hardwareBackCloses)`: no header, flush top. */\nexport function fullScreenEdgeToEdgeModalSheetOptions(hardwareBackCloses = true): G9SheetOptions {\n return {\n ...fullScreenModalSheetOptions(null, false, hardwareBackCloses),\n showToolbar: false,\n useTopSafeAreaPadding: false,\n topSafeAreaPaddingOverride: 0,\n additionalTopSafeAreaPadding: 0,\n };\n}\n"],"names":["clamp","v","lo","hi","Math","finite","fallback","Number","resolveSheetSettings","settings","_s_modalOverlayColor","_s_sizeScaledAnimationDuration","_s_enableBackdropCardEffect","_s_avoidKeyboard","_s_backdropCardColor","_s_stageBeforeShow","_s_deferPrebuiltContent","_s_motionStyle","_s_heightMemoVersion","s","min","max","Object","defaultSheetOptions","fitToContentSheetOptions","fullScreenWithoutHandleSheetOptions","fullScreenModalSheetOptions","title","showCloseButton","hardwareBackCloses","toolbarItems","fullScreenEdgeToEdgeModalSheetOptions"],"mappings":"AA8RA,MAAMA,QAAQ,CAACC,GAAWC,IAAYC,KAAeC,KAAK,GAAG,CAACD,IAAIC,KAAK,GAAG,CAACF,IAAID;AAC/E,MAAMI,SAAS,CAACJ,GAAuBK,WACrC,AAAa,YAAb,OAAOL,KAAkBM,OAAO,QAAQ,CAACN,KAAKA,IAAIK;AAG7C,SAASE,qBAAqBC,QAAqC;QAMnDC,sBAKUC,gCACHC,6BACXC,kBACIC,sBACFC,oBAEKC,yBACTC,gBACMC;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OAAOc,EAAE,iBAAiB,EAAE;IAC7D;AACF;AAGO,SAASI;IACd,OAAO;QACL,cAAc;QACd,QAAQ;YAAC;YAAU;SAAQ;QAC3B,UAAU;QACV,mBAAmB;QACnB,mBAAmB;IACrB;AACF;AAGO,SAASC;IACd,OAAO;QAAE,UAAU;QAAgB,cAAc;QAAM,WAAW;QAAM,aAAa;QAAM,cAAc;IAAK;AAChH;AAGO,SAASC;IACd,OAAO;QACL,cAAc;QACd,QAAQ;YAAC;SAAQ;QACjB,cAAc;QACd,aAAa;QACb,WAAW;QACX,cAAc;IAChB;AACF;AAGO,SAASC,4BACdC,KAAqB,EACrBC,kBAAkB,IAAI,EACtBC,qBAAqB,IAAI,EACzBC,YAAuD;IAEvD,OAAO;QACL,cAAc;QACd,QAAQ;YAAC;SAAQ;QACjB,UAAU;QACV,cAAc;QACd,aAAa;QACb,WAAW;QACX,cAAc;QACd,iBAAiB;QACjB,aAAa;QACbF;QACA,OAAOD,QAAAA,QAAAA,QAAS;QAChB,cAAcG,QAAAA,eAAAA,eAAgB;QAC9BD;IACF;AACF;AAGO,SAASE,sCAAsCF,qBAAqB,IAAI;IAC7E,OAAO;QACL,GAAGH,4BAA4B,MAAM,OAAOG,mBAAmB;QAC/D,aAAa;QACb,uBAAuB;QACvB,4BAA4B;QAC5B,8BAA8B;IAChC;AACF"}
@@ -40,6 +40,14 @@ export interface G9SheetService {
40
40
  /** The stack (advanced: rendering, tests). */
41
41
  readonly stack: G9SheetStack;
42
42
  }
43
+ /**
44
+ * How far the sheet layer rises above the soft keyboard: its height, less what the host already took off the window
45
+ * (`baselineHeight` = the window while the keyboard was hidden). 0 while hidden; never negative; never more than the window.
46
+ */
47
+ export declare function keyboardLift(keyboard: {
48
+ readonly visible: boolean;
49
+ readonly height: number;
50
+ }, baselineHeight: number, windowHeight: number): number;
43
51
  /** The sheet service of a host, created on first use. */
44
52
  export declare function sheetServiceOf(host: G9HostHandle, settings?: Required<G9SheetSettings>, preferences?: G9SheetMemo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,cAAc,CAC5B,IAAI,EAAE,YAAY,EAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,EACpC,WAAW,CAAC,EAAE,sBAAsB,GACnC,cAAc,CAIhB;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,cAAc,CAI5C;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,cAAc,CAEzC"}
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState, useSyncExternalStore } from "@lynx-js/reac
2
2
  import { startTimer, stopTimer } from "../base/timers.jsx";
3
3
  import { useG9Host, useG9HostInsets } from "../host/hooks.jsx";
4
4
  import { g9Hosts } from "../host/registry.jsx";
5
- import { useG9Culture, useG9Preferences, useG9Settings, useG9Theme, useG9Window } from "../provider/hooks.jsx";
5
+ import { useG9Culture, useG9Keyboard, useG9Preferences, useG9Settings, useG9Theme, useG9Window } from "../provider/hooks.jsx";
6
6
  import { G9SheetFrame } from "./frame.jsx";
7
7
  import { createSheetHeightMemo } from "./height-memo.jsx";
8
8
  import { fitToContentSheetOptions, fullScreenModalSheetOptions, resolveSheetSettings } from "./options.jsx";
@@ -17,6 +17,10 @@ function StackView(props) {
17
17
  const win = useG9Window();
18
18
  const insets = useG9HostInsets();
19
19
  const culture = useG9Culture();
20
+ const keyboard = useG9Keyboard();
21
+ const baseline = useRef(win.height);
22
+ if (!keyboard.visible) baseline.current = win.height;
23
+ const lift = state.settings.avoidKeyboard ? keyboardLift(keyboard, baseline.current, win.height) : 0;
20
24
  const stack = state.service.stack;
21
25
  const entries = useSyncExternalStore((l)=>stack.subscribe(l), ()=>stack.getSnapshot());
22
26
  const host = useG9Host();
@@ -51,13 +55,20 @@ function StackView(props) {
51
55
  const top = [
52
56
  ...entries
53
57
  ].reverse().find((e)=>'opening' === e.status || 'open' === e.status);
54
- return <view className="g9-sheet-stack">
55
- {entries.map((entry)=><G9SheetFrame key={entry.frameKey} entry={entry} stack={stack} hostHeight={win.height} hostWidth={win.width} topInset={insets.top} bottomInset={insets.bottom} settings={state.settings} memo={state.service.heightMemo} culture={culture.locale} isTop={entry === top} onRest={(heightPx)=>setRest({
58
+ return <view className="g9-sheet-stack" style={{
59
+ bottom: `${lift}px`
60
+ }}>
61
+ {entries.map((entry)=><G9SheetFrame key={entry.frameKey} entry={entry} stack={stack} hostHeight={win.height - lift} hostWidth={win.width} topInset={insets.top} bottomInset={lift > 0 ? 0 : insets.bottom} settings={state.settings} memo={state.service.heightMemo} culture={culture.locale} isTop={entry === top} onRest={(heightPx)=>setRest({
56
62
  id: entry.id,
57
63
  heightPx
58
64
  })}/>)}
59
65
  </view>;
60
66
  }
67
+ function keyboardLift(keyboard, baselineHeight, windowHeight) {
68
+ if (!keyboard.visible || !(keyboard.height > 0)) return 0;
69
+ const resized = Math.max(0, baselineHeight - windowHeight);
70
+ return Math.round(Math.min(Math.max(0, windowHeight - 1), Math.max(0, keyboard.height - resized)));
71
+ }
61
72
  function createSheetService(host, settings, preferences) {
62
73
  const clock = host.services.clock;
63
74
  const state = {
@@ -138,6 +149,6 @@ function useG9Sheets() {
138
149
  function g9Sheets() {
139
150
  return sheetServiceOf(g9Hosts.require());
140
151
  }
141
- export { g9Sheets, sheetServiceOf, useG9Sheets };
152
+ export { g9Sheets, keyboardLift, sheetServiceOf, useG9Sheets };
142
153
 
143
154
  //# sourceMappingURL=service.jsx.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet/service.jsx","sources":["../../src/sheet/service.tsx"],"sourcesContent":["import { type ReactNode, useEffect, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { startTimer, stopTimer } from '../base/timers';\nimport { useG9Host, useG9HostInsets } from '../host/hooks';\nimport { type G9HostHandle, g9Hosts } from '../host/registry';\nimport { useG9Culture, useG9Preferences, useG9Settings, useG9Theme, useG9Window } from '../provider/hooks';\nimport { G9SheetFrame } from './frame';\nimport { createSheetHeightMemo, type G9SheetHeightMemo, type G9SheetMemoPreferences } from './height-memo';\nimport {\n fitToContentSheetOptions,\n fullScreenModalSheetOptions,\n type G9SheetOptions,\n type G9SheetSettings,\n resolveSheetSettings,\n} from './options';\nimport { type G9ProcessingBuild, type G9ProcessingErrorHandler, G9ProcessingSheetContent } from './processing';\nimport { backdropCardTransform, sheetVisibleRatio } from './sizing';\nimport { type G9SheetContent, type G9SheetHandle, G9SheetStack } from './stack';\n\n/** The sheet API of one host (MAUI `G9BottomSheetHelper` + `G9BottomSheetExtensions`). */\nexport interface G9SheetService {\n /**\n * Opens a sheet (MAUI `ShowG9BottomSheet`): auto-stacks over an open sheet, hands off with `replaceCurrentSheet`,\n * otherwise opens as primary. `content` may be a factory, built after the open motion (`deferContent`). Returns the\n * sheet-scoped handle, or `null` when throttled (a second show/replace within 369 ms).\n */\n show(content: G9SheetContent, options?: G9SheetOptions): G9SheetHandle | null;\n /** `show` as a promise (MAUI `ShowG9BottomSheetAsync`): resolves with the handle (or `null`). */\n showAsync(content: G9SheetContent, options?: G9SheetOptions): Promise<G9SheetHandle | null>;\n /** Replaces the open sheet in place when it can morph, else back-closes it and opens (MAUI `ReplaceG9BottomSheet`). */\n replace(content: G9SheetContent, options?: G9SheetOptions): G9SheetHandle | null;\n /**\n * Opens at once with a spinner, then builds the body (MAUI `ShowProcessingG9BottomSheet`): `build(handle, signal)`\n * returns the body (the sheet grows to fit), `null` (closes quietly) or throws (`onError`, else error popup + close).\n * Default options: fit to content, not deferred.\n */\n showProcessing(\n build: G9ProcessingBuild,\n options?: G9SheetOptions,\n onError?: G9ProcessingErrorHandler,\n loadingHeight?: number,\n ): G9SheetHandle | null;\n /** Full-screen modal sheet, not throttled (MAUI `ShowFullScreenAsync`). */\n showFullScreen(content: G9SheetContent, options?: G9SheetOptions): G9SheetHandle;\n /** Back-routes the top sheet (MAUI `CloseTopG9BottomSheet`). */\n closeTop(): void;\n /** Closes every sheet (MAUI `CloseG9BottomSheet`). */\n closeAll(): void;\n /** Open sheets (MAUI `GetOpenSheetCount`). */\n getOpenCount(): number;\n /** Routes hardware back to the top sheet; `false` when none is open (MAUI `HandleHardwareBackPressed`). */\n handleHardwareBack(): boolean;\n /** `true` while a hand-off successor is replacing this sheet (MAUI `IsBeingReplaced`). */\n isBeingReplaced(handle: G9SheetHandle | null | undefined): boolean;\n /** The scrim colour behind receded pages (MAUI `GetBackdropCardColor`). */\n getBackdropCardColor(): string;\n /** The height memory of this host's sheets. */\n readonly heightMemo: G9SheetHeightMemo;\n /** The stack (advanced: rendering, tests). */\n readonly stack: G9SheetStack;\n}\n\nconst FEATURE = 'g9.sheets';\n\ninterface ServiceState {\n readonly service: G9SheetService;\n settings: Required<G9SheetSettings>;\n}\n\nfunction StackView(props: { readonly state: ServiceState }): ReactNode {\n const { state } = props;\n state.settings = useG9Settings().sheets;\n const win = useG9Window();\n const insets = useG9HostInsets();\n const culture = useG9Culture();\n const stack = state.service.stack;\n const entries = useSyncExternalStore(\n (l) => stack.subscribe(l),\n () => stack.getSnapshot(),\n );\n const host = useG9Host();\n // Backdrop card: the page recedes behind a tall primary sheet (not fit, not stacked over) once its visible ratio\n // reaches `backdropCardEffectThreshold` (default 0.75): the opening detent first, then where the sheet came to rest.\n const [rest, setRest] = useState<{ readonly id: number; readonly heightPx: number } | null>(null);\n const primary = entries.find((e) => e.status === 'opening' || e.status === 'open');\n const card =\n state.settings.enableBackdropCardEffect &&\n primary !== undefined &&\n primary.options.enableBackdropCardEffect !== false &&\n primary.options.sizeMode !== 'fitToContent' &&\n backdropCardTransform(\n sheetVisibleRatio(primary.options, win.height, rest?.id === primary.id ? rest.heightPx : null),\n Math.min(0.99, Math.max(0.1, primary.options.backdropCardEffectThreshold ?? 0.75)),\n );\n const effectOn = card && card.scale < 1 ? card : null;\n const effect = effectOn\n ? {\n scale: Math.round(effectOn.scale * 1000) / 1000,\n translateY: Math.round(effectOn.translateY * 10) / 10,\n durationMs: state.settings.openAnimationDurationMs,\n backdropColor: state.settings.backdropCardColor,\n }\n : null;\n const effectKey = effect ? `${effect.scale}|${effect.translateY}|${effect.durationMs}|${effect.backdropColor}` : '';\n useEffect(() => {\n host.setContentEffect(effect);\n }, [effectKey]);\n useEffect(() => () => stack.dispose(), [stack]);\n // Learned heights belong to one look: a theme change re-measures (viewport and culture are part of the key).\n const scheme = useG9Theme().scheme;\n const lastScheme = useRef(scheme);\n useEffect(() => {\n if (lastScheme.current === scheme) return;\n lastScheme.current = scheme;\n state.service.heightMemo.invalidate();\n }, [scheme]);\n const top = [...entries].reverse().find((e) => e.status === 'opening' || e.status === 'open');\n return (\n <view className=\"g9-sheet-stack\">\n {entries.map((entry) => (\n <G9SheetFrame\n key={entry.frameKey}\n entry={entry}\n stack={stack}\n hostHeight={win.height}\n hostWidth={win.width}\n topInset={insets.top}\n bottomInset={insets.bottom}\n settings={state.settings}\n memo={state.service.heightMemo}\n culture={culture.locale}\n isTop={entry === top}\n onRest={(heightPx) => setRest({ id: entry.id, heightPx })}\n />\n ))}\n </view>\n );\n}\n\n/** Creates the sheet service of a host (attached once as a host feature). */\nfunction createSheetService(\n host: G9HostHandle,\n settings?: Required<G9SheetSettings>,\n preferences?: G9SheetMemoPreferences,\n): ServiceState {\n const clock = host.services.clock;\n const state = { settings: settings ?? resolveSheetSettings(undefined) } as ServiceState;\n const stack = new G9SheetStack({\n now: () => clock.monotonicNow(),\n setTimer: (cb, ms) => startTimer(cb, ms),\n clearTimer: (h) => stopTimer(h),\n durations: (o) => ({\n open: o.openAnimationDurationMs ?? state.settings.openAnimationDurationMs,\n close: o.closeAnimationDurationMs ?? state.settings.closeAnimationDurationMs,\n }),\n stageBeforeShow: () => state.settings.stageBeforeShow,\n preOpenMaxHoldMs: () => state.settings.preOpenMaxHoldMs,\n });\n const heightMemo = createSheetHeightMemo({\n ...(preferences ? { preferences } : {}),\n appVersion: state.settings.heightMemoVersion,\n setTimer: (cb, ms) => startTimer(cb, ms),\n clearTimer: (h) => stopTimer(h),\n });\n const service: G9SheetService = {\n stack,\n heightMemo,\n show: (content, options) => stack.show(content, options ?? {}),\n showAsync: (content, options) => Promise.resolve(stack.show(content, options ?? {})),\n replace: (content, options) => stack.replace(content, options ?? fitToContentSheetOptions()),\n showProcessing(build, options, onError, loadingHeight) {\n let handle: G9SheetHandle | null = null;\n const content = () => (\n <G9ProcessingSheetContent\n build={build}\n {...(onError ? { onError } : {})}\n loadingHeight={loadingHeight && loadingHeight > 0 ? loadingHeight : 160}\n handle={() => handle}\n />\n );\n handle = stack.show(content, { ...(options ?? fitToContentSheetOptions()), deferContent: false });\n return handle;\n },\n showFullScreen: (content, options) =>\n stack.show(content, options ?? fullScreenModalSheetOptions(), false) as G9SheetHandle,\n closeTop: () => stack.closeTop(),\n closeAll: () => stack.closeAll(),\n getOpenCount: () => stack.openCount(),\n handleHardwareBack: () => stack.handleHardwareBack(),\n isBeingReplaced: (handle) => {\n if (!handle) return false;\n const entry = stack.getSnapshot().find((e) => e.id === handle.id);\n return entry?.handingOff === true;\n },\n getBackdropCardColor: () => state.settings.backdropCardColor,\n };\n (state as { service: G9SheetService }).service = service;\n host.attachFeature(FEATURE, state);\n host.registerLayerItem('sheets', { key: FEATURE, element: <StackView state={state} />, order: 0 });\n host.back.push(() => (stack.handleHardwareBack() ? 'handled' : 'pass'), { layer: 'sheets' });\n return state;\n}\n\n/** The sheet service of a host, created on first use. */\nexport function sheetServiceOf(\n host: G9HostHandle,\n settings?: Required<G9SheetSettings>,\n preferences?: G9SheetMemoPreferences,\n): G9SheetService {\n const existing = host.getFeature(FEATURE) as ServiceState | undefined;\n if (existing && settings) existing.settings = settings;\n return (existing ?? createSheetService(host, settings, preferences)).service;\n}\n\n/**\n * The sheets of the nearest `G9Host` (MAUI `G9BottomSheetHelper` for that page). Sheets render in the host's\n * `sheets` layer; hardware back closes the top sheet first; the host's unmount settles every open sheet.\n */\nexport function useG9Sheets(): G9SheetService {\n const settings = useG9Settings().sheets;\n // Learned heights persist in the provider's preferences (key `g9controls.sheet-heights`).\n return sheetServiceOf(useG9Host(), settings, useG9Preferences());\n}\n\n/**\n * The sheets of the active host for code outside components (MAUI's static `G9BottomSheetHelper`): view models,\n * services. Throws `host-missing` when no host is mounted.\n */\nexport function g9Sheets(): G9SheetService {\n return sheetServiceOf(g9Hosts.require());\n}\n"],"names":["FEATURE","StackView","props","_primary_options_backdropCardEffectThreshold","state","useG9Settings","win","useG9Window","insets","useG9HostInsets","culture","useG9Culture","stack","entries","useSyncExternalStore","l","host","useG9Host","rest","setRest","useState","primary","e","card","undefined","backdropCardTransform","sheetVisibleRatio","Math","effectOn","effect","effectKey","useEffect","scheme","useG9Theme","lastScheme","useRef","top","view","entry","G9SheetFrame","heightPx","createSheetService","settings","preferences","clock","resolveSheetSettings","G9SheetStack","cb","ms","startTimer","h","stopTimer","o","_o_openAnimationDurationMs","_o_closeAnimationDurationMs","heightMemo","createSheetHeightMemo","service","content","options","Promise","fitToContentSheetOptions","build","onError","loadingHeight","handle","G9ProcessingSheetContent","fullScreenModalSheetOptions","sheetServiceOf","existing","useG9Sheets","useG9Preferences","g9Sheets","g9Hosts"],"mappings":";;;;;;;;;;;AA6DA,MAAMA,UAAU;AAOhB,SAASC,UAAUC,KAAuC;QAuBvBC;IAtBjC,MAAM,EAAEC,KAAK,EAAE,GAAGF;IAClBE,MAAM,QAAQ,GAAGC,gBAAgB,MAAM;IACvC,MAAMC,MAAMC;IACZ,MAAMC,SAASC;IACf,MAAMC,UAAUC;IAChB,MAAMC,QAAQR,MAAM,OAAO,CAAC,KAAK;IACjC,MAAMS,UAAUC,qBACd,CAACC,IAAMH,MAAM,SAAS,CAACG,IACvB,IAAMH,MAAM,WAAW;IAEzB,MAAMI,OAAOC;IAGb,MAAM,CAACC,MAAMC,QAAQ,GAAGC,SAAoE;IAC5F,MAAMC,UAAUR,QAAQ,IAAI,CAAC,CAACS,IAAMA,AAAa,cAAbA,EAAE,MAAM,IAAkBA,AAAa,WAAbA,EAAE,MAAM;IACtE,MAAMC,OACJnB,MAAM,QAAQ,CAAC,wBAAwB,IACvCiB,AAAYG,WAAZH,WACAA,AAA6C,UAA7CA,QAAQ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AE;YAChE,OAAO3B,AAAAA,CAAAA,QAAAA,QAAAA,KAAAA,IAAAA,MAAO,UAAU,AAAD,MAAM;QAC/B;QACA,sBAAsB,IAAMlC,MAAM,QAAQ,CAAC,iBAAiB;IAC9D;IACCA,MAAsC,OAAO,GAAGqD;IACjDzC,KAAK,aAAa,CAAChB,SAASI;IAC5BY,KAAK,iBAAiB,CAAC,UAAU;QAAE,KAAKhB;QAAS,UAAUC,UAAU,OAAOG;QAAW,OAAO;IAAE;IAChGY,KAAK,IAAI,CAAC,IAAI,CAAC,IAAOJ,MAAM,kBAAkB,KAAK,YAAY,QAAS;QAAE,OAAO;IAAS;IAC1F,OAAOR;AACT;AAGO,SAASgE,eACdpD,IAAkB,EAClB0B,QAAoC,EACpCC,WAAoC;IAEpC,MAAM0B,WAAWrD,KAAK,UAAU,CAAChB;IACjC,IAAIqE,YAAY3B,UAAU2B,SAAS,QAAQ,GAAG3B;IAC9C,OAAO,AAAC2B,CAAAA,QAAAA,WAAAA,WAAY5B,mBAAmBzB,MAAM0B,UAAUC,YAAW,EAAG,OAAO;AAC9E;AAMO,SAAS2B;IACd,MAAM5B,WAAWrC,gBAAgB,MAAM;IAEvC,OAAO+D,eAAenD,aAAayB,UAAU6B;AAC/C;AAMO,SAASC;IACd,OAAOJ,eAAeK,QAAQ,OAAO;AACvC"}
1
+ {"version":3,"file":"sheet/service.jsx","sources":["../../src/sheet/service.tsx"],"sourcesContent":["import { type ReactNode, useEffect, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { startTimer, stopTimer } from '../base/timers';\nimport { useG9Host, useG9HostInsets } from '../host/hooks';\nimport { type G9HostHandle, g9Hosts } from '../host/registry';\nimport {\n useG9Culture,\n useG9Keyboard,\n useG9Preferences,\n useG9Settings,\n useG9Theme,\n useG9Window,\n} from '../provider/hooks';\nimport { G9SheetFrame } from './frame';\nimport { createSheetHeightMemo, type G9SheetHeightMemo, type G9SheetMemoPreferences } from './height-memo';\nimport {\n fitToContentSheetOptions,\n fullScreenModalSheetOptions,\n type G9SheetOptions,\n type G9SheetSettings,\n resolveSheetSettings,\n} from './options';\nimport { type G9ProcessingBuild, type G9ProcessingErrorHandler, G9ProcessingSheetContent } from './processing';\nimport { backdropCardTransform, sheetVisibleRatio } from './sizing';\nimport { type G9SheetContent, type G9SheetHandle, G9SheetStack } from './stack';\n\n/** The sheet API of one host (MAUI `G9BottomSheetHelper` + `G9BottomSheetExtensions`). */\nexport interface G9SheetService {\n /**\n * Opens a sheet (MAUI `ShowG9BottomSheet`): auto-stacks over an open sheet, hands off with `replaceCurrentSheet`,\n * otherwise opens as primary. `content` may be a factory, built after the open motion (`deferContent`). Returns the\n * sheet-scoped handle, or `null` when throttled (a second show/replace within 369 ms).\n */\n show(content: G9SheetContent, options?: G9SheetOptions): G9SheetHandle | null;\n /** `show` as a promise (MAUI `ShowG9BottomSheetAsync`): resolves with the handle (or `null`). */\n showAsync(content: G9SheetContent, options?: G9SheetOptions): Promise<G9SheetHandle | null>;\n /** Replaces the open sheet in place when it can morph, else back-closes it and opens (MAUI `ReplaceG9BottomSheet`). */\n replace(content: G9SheetContent, options?: G9SheetOptions): G9SheetHandle | null;\n /**\n * Opens at once with a spinner, then builds the body (MAUI `ShowProcessingG9BottomSheet`): `build(handle, signal)`\n * returns the body (the sheet grows to fit), `null` (closes quietly) or throws (`onError`, else error popup + close).\n * Default options: fit to content, not deferred.\n */\n showProcessing(\n build: G9ProcessingBuild,\n options?: G9SheetOptions,\n onError?: G9ProcessingErrorHandler,\n loadingHeight?: number,\n ): G9SheetHandle | null;\n /** Full-screen modal sheet, not throttled (MAUI `ShowFullScreenAsync`). */\n showFullScreen(content: G9SheetContent, options?: G9SheetOptions): G9SheetHandle;\n /** Back-routes the top sheet (MAUI `CloseTopG9BottomSheet`). */\n closeTop(): void;\n /** Closes every sheet (MAUI `CloseG9BottomSheet`). */\n closeAll(): void;\n /** Open sheets (MAUI `GetOpenSheetCount`). */\n getOpenCount(): number;\n /** Routes hardware back to the top sheet; `false` when none is open (MAUI `HandleHardwareBackPressed`). */\n handleHardwareBack(): boolean;\n /** `true` while a hand-off successor is replacing this sheet (MAUI `IsBeingReplaced`). */\n isBeingReplaced(handle: G9SheetHandle | null | undefined): boolean;\n /** The scrim colour behind receded pages (MAUI `GetBackdropCardColor`). */\n getBackdropCardColor(): string;\n /** The height memory of this host's sheets. */\n readonly heightMemo: G9SheetHeightMemo;\n /** The stack (advanced: rendering, tests). */\n readonly stack: G9SheetStack;\n}\n\nconst FEATURE = 'g9.sheets';\n\ninterface ServiceState {\n readonly service: G9SheetService;\n settings: Required<G9SheetSettings>;\n}\n\nfunction StackView(props: { readonly state: ServiceState }): ReactNode {\n const { state } = props;\n state.settings = useG9Settings().sheets;\n const win = useG9Window();\n const insets = useG9HostInsets();\n const culture = useG9Culture();\n // The keyboard's lift (settings.avoidKeyboard): the window height while the keyboard was hidden is the baseline, so a host\n // that already shrank the window for the IME is not lifted twice.\n const keyboard = useG9Keyboard();\n const baseline = useRef(win.height);\n if (!keyboard.visible) baseline.current = win.height;\n const lift = state.settings.avoidKeyboard ? keyboardLift(keyboard, baseline.current, win.height) : 0;\n const stack = state.service.stack;\n const entries = useSyncExternalStore(\n (l) => stack.subscribe(l),\n () => stack.getSnapshot(),\n );\n const host = useG9Host();\n // Backdrop card: the page recedes behind a tall primary sheet (not fit, not stacked over) once its visible ratio\n // reaches `backdropCardEffectThreshold` (default 0.75): the opening detent first, then where the sheet came to rest.\n const [rest, setRest] = useState<{ readonly id: number; readonly heightPx: number } | null>(null);\n const primary = entries.find((e) => e.status === 'opening' || e.status === 'open');\n const card =\n state.settings.enableBackdropCardEffect &&\n primary !== undefined &&\n primary.options.enableBackdropCardEffect !== false &&\n primary.options.sizeMode !== 'fitToContent' &&\n backdropCardTransform(\n sheetVisibleRatio(primary.options, win.height, rest?.id === primary.id ? rest.heightPx : null),\n Math.min(0.99, Math.max(0.1, primary.options.backdropCardEffectThreshold ?? 0.75)),\n );\n const effectOn = card && card.scale < 1 ? card : null;\n const effect = effectOn\n ? {\n scale: Math.round(effectOn.scale * 1000) / 1000,\n translateY: Math.round(effectOn.translateY * 10) / 10,\n durationMs: state.settings.openAnimationDurationMs,\n backdropColor: state.settings.backdropCardColor,\n }\n : null;\n const effectKey = effect ? `${effect.scale}|${effect.translateY}|${effect.durationMs}|${effect.backdropColor}` : '';\n useEffect(() => {\n host.setContentEffect(effect);\n }, [effectKey]);\n useEffect(() => () => stack.dispose(), [stack]);\n // Learned heights belong to one look: a theme change re-measures (viewport and culture are part of the key).\n const scheme = useG9Theme().scheme;\n const lastScheme = useRef(scheme);\n useEffect(() => {\n if (lastScheme.current === scheme) return;\n lastScheme.current = scheme;\n state.service.heightMemo.invalidate();\n }, [scheme]);\n const top = [...entries].reverse().find((e) => e.status === 'opening' || e.status === 'open');\n return (\n <view className=\"g9-sheet-stack\" style={{ bottom: `${lift}px` }}>\n {entries.map((entry) => (\n <G9SheetFrame\n key={entry.frameKey}\n entry={entry}\n stack={stack}\n hostHeight={win.height - lift}\n hostWidth={win.width}\n topInset={insets.top}\n // The keyboard covers the bottom bar: no inset under a lifted sheet.\n bottomInset={lift > 0 ? 0 : insets.bottom}\n settings={state.settings}\n memo={state.service.heightMemo}\n culture={culture.locale}\n isTop={entry === top}\n onRest={(heightPx) => setRest({ id: entry.id, heightPx })}\n />\n ))}\n </view>\n );\n}\n\n/**\n * How far the sheet layer rises above the soft keyboard: its height, less what the host already took off the window\n * (`baselineHeight` = the window while the keyboard was hidden). 0 while hidden; never negative; never more than the window.\n */\nexport function keyboardLift(\n keyboard: { readonly visible: boolean; readonly height: number },\n baselineHeight: number,\n windowHeight: number,\n): number {\n if (!keyboard.visible || !(keyboard.height > 0)) return 0;\n const resized = Math.max(0, baselineHeight - windowHeight);\n return Math.round(Math.min(Math.max(0, windowHeight - 1), Math.max(0, keyboard.height - resized)));\n}\n\n/** Creates the sheet service of a host (attached once as a host feature). */\nfunction createSheetService(\n host: G9HostHandle,\n settings?: Required<G9SheetSettings>,\n preferences?: G9SheetMemoPreferences,\n): ServiceState {\n const clock = host.services.clock;\n const state = { settings: settings ?? resolveSheetSettings(undefined) } as ServiceState;\n const stack = new G9SheetStack({\n now: () => clock.monotonicNow(),\n setTimer: (cb, ms) => startTimer(cb, ms),\n clearTimer: (h) => stopTimer(h),\n durations: (o) => ({\n open: o.openAnimationDurationMs ?? state.settings.openAnimationDurationMs,\n close: o.closeAnimationDurationMs ?? state.settings.closeAnimationDurationMs,\n }),\n stageBeforeShow: () => state.settings.stageBeforeShow,\n preOpenMaxHoldMs: () => state.settings.preOpenMaxHoldMs,\n });\n const heightMemo = createSheetHeightMemo({\n ...(preferences ? { preferences } : {}),\n appVersion: state.settings.heightMemoVersion,\n setTimer: (cb, ms) => startTimer(cb, ms),\n clearTimer: (h) => stopTimer(h),\n });\n const service: G9SheetService = {\n stack,\n heightMemo,\n show: (content, options) => stack.show(content, options ?? {}),\n showAsync: (content, options) => Promise.resolve(stack.show(content, options ?? {})),\n replace: (content, options) => stack.replace(content, options ?? fitToContentSheetOptions()),\n showProcessing(build, options, onError, loadingHeight) {\n let handle: G9SheetHandle | null = null;\n const content = () => (\n <G9ProcessingSheetContent\n build={build}\n {...(onError ? { onError } : {})}\n loadingHeight={loadingHeight && loadingHeight > 0 ? loadingHeight : 160}\n handle={() => handle}\n />\n );\n handle = stack.show(content, { ...(options ?? fitToContentSheetOptions()), deferContent: false });\n return handle;\n },\n showFullScreen: (content, options) =>\n stack.show(content, options ?? fullScreenModalSheetOptions(), false) as G9SheetHandle,\n closeTop: () => stack.closeTop(),\n closeAll: () => stack.closeAll(),\n getOpenCount: () => stack.openCount(),\n handleHardwareBack: () => stack.handleHardwareBack(),\n isBeingReplaced: (handle) => {\n if (!handle) return false;\n const entry = stack.getSnapshot().find((e) => e.id === handle.id);\n return entry?.handingOff === true;\n },\n getBackdropCardColor: () => state.settings.backdropCardColor,\n };\n (state as { service: G9SheetService }).service = service;\n host.attachFeature(FEATURE, state);\n host.registerLayerItem('sheets', { key: FEATURE, element: <StackView state={state} />, order: 0 });\n host.back.push(() => (stack.handleHardwareBack() ? 'handled' : 'pass'), { layer: 'sheets' });\n return state;\n}\n\n/** The sheet service of a host, created on first use. */\nexport function sheetServiceOf(\n host: G9HostHandle,\n settings?: Required<G9SheetSettings>,\n preferences?: G9SheetMemoPreferences,\n): G9SheetService {\n const existing = host.getFeature(FEATURE) as ServiceState | undefined;\n if (existing && settings) existing.settings = settings;\n return (existing ?? createSheetService(host, settings, preferences)).service;\n}\n\n/**\n * The sheets of the nearest `G9Host` (MAUI `G9BottomSheetHelper` for that page). Sheets render in the host's\n * `sheets` layer; hardware back closes the top sheet first; the host's unmount settles every open sheet.\n */\nexport function useG9Sheets(): G9SheetService {\n const settings = useG9Settings().sheets;\n // Learned heights persist in the provider's preferences (key `g9controls.sheet-heights`).\n return sheetServiceOf(useG9Host(), settings, useG9Preferences());\n}\n\n/**\n * The sheets of the active host for code outside components (MAUI's static `G9BottomSheetHelper`): view models,\n * services. Throws `host-missing` when no host is mounted.\n */\nexport function g9Sheets(): G9SheetService {\n return sheetServiceOf(g9Hosts.require());\n}\n"],"names":["FEATURE","StackView","props","_primary_options_backdropCardEffectThreshold","state","useG9Settings","win","useG9Window","insets","useG9HostInsets","culture","useG9Culture","keyboard","useG9Keyboard","baseline","useRef","lift","keyboardLift","stack","entries","useSyncExternalStore","l","host","useG9Host","rest","setRest","useState","primary","e","card","undefined","backdropCardTransform","sheetVisibleRatio","Math","effectOn","effect","effectKey","useEffect","scheme","useG9Theme","lastScheme","top","view","entry","G9SheetFrame","heightPx","baselineHeight","windowHeight","resized","createSheetService","settings","preferences","clock","resolveSheetSettings","G9SheetStack","cb","ms","startTimer","h","stopTimer","o","_o_openAnimationDurationMs","_o_closeAnimationDurationMs","heightMemo","createSheetHeightMemo","service","content","options","Promise","fitToContentSheetOptions","build","onError","loadingHeight","handle","G9ProcessingSheetContent","fullScreenModalSheetOptions","sheetServiceOf","existing","useG9Sheets","useG9Prefer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WAAW,GAAG,IAAI,CAAC,CAACU,IAAMA,EAAE,EAAE,KAAK6C,OAAO,EAAE;YAChE,OAAO9B,AAAAA,CAAAA,QAAAA,QAAAA,KAAAA,IAAAA,MAAO,UAAU,AAAD,MAAM;QAC/B;QACA,sBAAsB,IAAMvC,MAAM,QAAQ,CAAC,iBAAiB;IAC9D;IACCA,MAAsC,OAAO,GAAG6D;IACjD3C,KAAK,aAAa,CAACtB,SAASI;IAC5BkB,KAAK,iBAAiB,CAAC,UAAU;QAAE,KAAKtB;QAAS,UAAUC,UAAU,OAAOG;QAAW,OAAO;IAAE;IAChGkB,KAAK,IAAI,CAAC,IAAI,CAAC,IAAOJ,MAAM,kBAAkB,KAAK,YAAY,QAAS;QAAE,OAAO;IAAS;IAC1F,OAAOd;AACT;AAGO,SAASwE,eACdtD,IAAkB,EAClB4B,QAAoC,EACpCC,WAAoC;IAEpC,MAAM0B,WAAWvD,KAAK,UAAU,CAACtB;IACjC,IAAI6E,YAAY3B,UAAU2B,SAAS,QAAQ,GAAG3B;IAC9C,OAAO,AAAC2B,CAAAA,QAAAA,WAAAA,WAAY5B,mBAAmB3B,MAAM4B,UAAUC,YAAW,EAAG,OAAO;AAC9E;AAMO,SAAS2B;IACd,MAAM5B,WAAW7C,gBAAgB,MAAM;IAEvC,OAAOuE,eAAerD,aAAa2B,UAAU6B;AAC/C;AAMO,SAASC;IACd,OAAOJ,eAAeK,QAAQ,OAAO;AACvC"}
@@ -3,6 +3,8 @@ import type { G9SheetDetent, G9SheetOptions } from './options.js';
3
3
  export declare const g9SheetDefaultPeekHeight = 100;
4
4
  /** Absolute minimum of an authoritative fit height (MAUI helper :81). */
5
5
  export declare const g9SheetFitMinHeight = 80;
6
+ /** Default `scrollToEndThreshold`: four 52 px rows from the end (MAUI 1.4.8 selection sheet, `OnItemsScrolled`). */
7
+ export declare const g9SheetScrollToEndThreshold = 208;
6
8
  /** Floor while the height is unknown (loading window). */
7
9
  export declare const g9SheetFitLoadingMinHeight = 180;
8
10
  /** Finger travel at release that requests a close (MAUI `DragCloseThreshold`). */
@@ -1 +1 @@
1
- {"version":3,"file":"sizing.d.ts","sourceRoot":"","sources":["../../src/sheet/sizing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAI/D,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,0DAA0D;AAC1D,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,kFAAkF;AAClF,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAI3C,wGAAwG;AACxG,wBAAgB,eAAe,IAAI,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAQrF;AAED,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC5B,oFAAoF;IACpF,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,wFAAwF;IACxF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,qCAAqC;IACrC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,+FAA+F;IAC/F,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,yDAAyD;IACzD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,QAAQ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Ac,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIjF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,YAAY,GAAG,KAAK,CAAC,EACjD,OAAO,EAAE,aAAa,GAAG,KAAK,EAC9B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAWR;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAE9F;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,CAI3G;AAED,gHAAgH;AAChH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,cAAc,EACvB,QAAQ,sDAAoB,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBxB"}
@@ -1,5 +1,6 @@
1
1
  const g9SheetDefaultPeekHeight = 100;
2
2
  const g9SheetFitMinHeight = 80;
3
+ const g9SheetScrollToEndThreshold = 208;
3
4
  const g9SheetFitLoadingMinHeight = 180;
4
5
  const g9SheetDragCloseThreshold = 72;
5
6
  const g9SheetTopSafeAreaBaseGap = 3;
@@ -156,6 +157,6 @@ function platformSheetConstraints(options, platform = currentPlatform()) {
156
157
  }
157
158
  return style;
158
159
  }
159
- export { backdropCardTransform, clampFitHeight, currentPlatform, g9SheetDefaultPeekHeight, g9SheetDragCloseThreshold, g9SheetFitLoadingMinHeight, g9SheetFitMinHeight, g9SheetTopSafeAreaBaseGap, parentRecedeOffset, platformSheetConstraints, resolveSheetLayout, scaledSheetDuration, sheetOverlayOpacity, sheetSurfaceBottomPadding, sheetSurfaceTopPadding, sheetTopPadding, sheetVisibleRatio };
160
+ export { backdropCardTransform, clampFitHeight, currentPlatform, g9SheetDefaultPeekHeight, g9SheetDragCloseThreshold, g9SheetFitLoadingMinHeight, g9SheetFitMinHeight, g9SheetScrollToEndThreshold, g9SheetTopSafeAreaBaseGap, parentRecedeOffset, platformSheetConstraints, resolveSheetLayout, scaledSheetDuration, sheetOverlayOpacity, sheetSurfaceBottomPadding, sheetSurfaceTopPadding, sheetTopPadding, sheetVisibleRatio };
160
161
 
161
162
  //# sourceMappingURL=sizing.jsx.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet/sizing.jsx","sources":["../../src/sheet/sizing.ts"],"sourcesContent":["import type { G9SheetDetent, G9SheetOptions } from './options';\n\n// Pure sizing rules of the G9 sheet (MAUI G9SheetView + G9BottomSheetHelper sizing; guide 650–980, ADR-0019/0026).\n\n/** MAUI `G9SheetView.MinimizedHeight`: default peek height. */\nexport const g9SheetDefaultPeekHeight = 100;\n/** Absolute minimum of an authoritative fit height (MAUI helper :81). */\nexport const g9SheetFitMinHeight = 80;\n/** Floor while the height is unknown (loading window). */\nexport const g9SheetFitLoadingMinHeight = 180;\n/** Finger travel at release that requests a close (MAUI `DragCloseThreshold`). */\nexport const g9SheetDragCloseThreshold = 72;\n/**\n * Gap between the top safe-area inset and a full-screen sheet's header. MAUI reserves the inset alone\n * (`ResolveFullScreenSheetTopPadding`), but its Android inset is the status-bar band, a few dp below the cutout an\n * immersive Lynx host reports: measured side by side on a Pixel 9 Pro XL (2026-10-10), MAUI's header sat 3 dp lower.\n * (It was 8, which put every full-screen header 5 dp below MAUI's.)\n */\nexport const g9SheetTopSafeAreaBaseGap = 3;\n\nconst clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));\n\n/** The platform the app runs on (Lynx `SystemInfo.platform`), lower-cased; `'unknown'` outside Lynx. */\nexport function currentPlatform(): 'android' | 'ios' | 'windows' | 'macos' | 'unknown' {\n const info = (globalThis as { SystemInfo?: { platform?: string } }).SystemInfo;\n const p = (info?.platform ?? '').toLowerCase();\n if (p === 'android') return 'android';\n if (p === 'ios') return 'ios';\n if (p.startsWith('win')) return 'windows';\n if (p === 'macos' || p === 'mac' || p === 'osx') return 'macos';\n return 'unknown';\n}\n\n/** What the adapter passes to lynx-ui `SheetRoot` and how the frame behaves. */\nexport interface G9SheetLayout {\n /** lynx-ui snap points, small to large: pixels, `'NN%'` of the host, or `'fit'`. */\n readonly snapPoints: Array<number | string>;\n readonly initialSnap: number;\n /** One detent, or fit-to-content (MAUI \"fixed\"): no grabber, no detent dragging. */\n readonly fixed: boolean;\n readonly fit: boolean;\n /** Grabber visible (`hasHandle && isDraggable && (!fixed || handleOnSingleDetent)`). */\n readonly showHandle: boolean;\n readonly dragDisabled: boolean;\n /** Drag past the lowest detent may request a close. */\n readonly enableDragToClose: boolean;\n /** Backdrop tap requests a close. */\n readonly closeOnOverlayTap: boolean;\n /** The resting body cap for a fit sheet (`maxFitToContentHeightRatio × host`), else `null`. */\n readonly fitMaxHeight: number | null;\n /** Whether the sheet's largest detent is full screen. */\n readonly fullScreen: boolean;\n /**\n * The body fills the surface, so the footer rests at the sheet's bottom edge: a full-screen sheet, or one fixed detent\n * (`states: ['large']` with `fullExpandedRatio: 0.9`) — its surface has a definite height. A sheet that can move between\n * detents or fits its content keeps a body as tall as the content.\n */\n readonly fillBody: boolean;\n}\n\nconst pct = (ratio: number) => `${Math.round(ratio * 10000) / 100}%`;\n\n/**\n * Maps G9 options to a lynx-ui layout (the agreed mapping of MAUI `ApplyOptions`): fit → `['fit']` capped at\n * `maxFitToContentHeightRatio`; states → peek pixels / half ratio / full ratio for the allowed detents, the initial\n * detent from `currentState`. The MAUI quirks (a hidden 100 dp detent under `[medium, large]`, a peek-only sheet that\n * may expand) are not carried over: the detents are exactly `states` (docs/sheets.md \"deliberate differences\").\n */\nexport function resolveSheetLayout(\n options: G9SheetOptions,\n hostHeight: number,\n platform = currentPlatform(),\n): G9SheetLayout {\n const fit = options.sizeMode === 'fitToContent';\n const draggable = options.isDraggable !== false;\n const cancelable = options.isCancelable !== false;\n const intercepted = options.onBackRequested != null;\n if (fit) {\n const ratio = clamp(options.maxFitToContentHeightRatio ?? 0.75, 0.2, 1);\n return {\n snapPoints: ['fit'],\n initialSnap: 0,\n fixed: true,\n fit: true,\n showHandle: false,\n dragDisabled: true,\n enableDragToClose: false,\n closeOnOverlayTap: cancelable,\n fitMaxHeight: Math.max(g9SheetFitMinHeight, Math.floor(hostHeight * ratio)),\n fullScreen: false,\n fillBody: false,\n };\n }\n const order: G9SheetDetent[] = ['peek', 'medium', 'large'];\n const requested = options.states && options.states.length > 0 ? options.states : ['medium', 'large'];\n const states = order.filter((d) => requested.includes(d));\n const androidHalf = platform === 'android' ? options.androidHalfExpandedRatio : null;\n const half = clamp(androidHalf ?? options.halfExpandedRatio ?? 0.5, 0.1, 0.9);\n const full = clamp(options.fullExpandedRatio ?? 1, 0.1, 1);\n const peek = Math.max(1, options.collapsedHeight ?? options.peekHeight ?? g9SheetDefaultPeekHeight);\n const snap = (d: G9SheetDetent): number | string =>\n d === 'peek' ? Math.min(peek, Math.max(1, hostHeight)) : d === 'medium' ? pct(half) : pct(full);\n const snapPoints = states.map(snap);\n if (options.expandedFitsContent && snapPoints.length > 0) snapPoints[snapPoints.length - 1] = 'fit';\n const current = options.currentState ?? 'medium';\n const index = states.indexOf(current);\n const fixed = states.length <= 1;\n return {\n snapPoints,\n initialSnap: index >= 0 ? index : 0,\n fixed,\n fit: false,\n showHandle: options.hasHandle !== false && draggable && (!fixed || options.handleOnSingleDetent === true),\n dragDisabled: !draggable || intercepted,\n enableDragToClose: cancelable && draggable && !intercepted,\n closeOnOverlayTap: cancelable,\n fitMaxHeight: options.expandedFitsContent\n ? Math.max(\n g9SheetFitMinHeight,\n Math.floor(hostHeight * clamp(options.maxFitToContentHeightRatio ?? 0.75, 0.2, 1)),\n )\n : null,\n // One 'large' detent sized to its content is not full screen (no status-bar padding above a short sheet).\n fullScreen: states.length === 1 && states[0] === 'large' && full >= 1 && options.expandedFitsContent !== true,\n fillBody: fixed && !options.expandedFitsContent,\n };\n}\n\n/** Clamps a measured fit body height: `[80, cap]`, or `[180, cap]` while loading (MAUI fit engine). */\nexport function clampFitHeight(natural: number, cap: number, loading: boolean): number {\n const min = loading ? g9SheetFitLoadingMinHeight : g9SheetFitMinHeight;\n if (!(natural > 0)) return Math.min(min, cap);\n return clamp(natural, Math.min(min, cap), cap);\n}\n\n/**\n * Scrim opacity for a visible ratio (MAUI helper overlay rule): between the smallest and the largest detent it runs\n * from `min` to `max`; a single detent uses `max`; below the smallest detent it fades with the ratio.\n */\nexport function sheetOverlayOpacity(\n visibleRatio: number,\n detentRatios: ReadonlyArray<number>,\n min: number,\n max: number,\n): number {\n if (detentRatios.length === 0) return max;\n const lo = Math.min(...detentRatios);\n const hi = Math.max(...detentRatios);\n if (visibleRatio < lo) return (detentRatios.length === 1 ? max : min) * clamp(visibleRatio / lo, 0, 1);\n if (hi === lo) return max;\n return min + (max - min) * clamp((visibleRatio - lo) / (hi - lo), 0, 1);\n}\n\n/** The page recede behind a tall primary sheet (MAUI backdrop card): scale 1 → 0.93, translateY 0 → 12. */\nexport function backdropCardTransform(visibleRatio: number, threshold = 0.75): { scale: number; translateY: number } {\n const raw = clamp((visibleRatio - threshold) / Math.max(1e-6, 1 - threshold), 0, 1);\n const progress = raw <= 0 ? 0 : 1 - (1 - raw) ** (1 / 3);\n return { scale: 1 - 0.07 * progress, translateY: 12 * progress };\n}\n\n/**\n * The visible share of the host a detent sheet covers: its resting height when known, else its opening detent\n * (peek = peek height, medium = half ratio, large = full ratio; `expandedFitsContent` large counts as the fit cap).\n */\nexport function sheetVisibleRatio(\n options: G9SheetOptions,\n hostHeight: number,\n restingHeightPx: number | null,\n platform = currentPlatform(),\n): number {\n const host = Math.max(1, hostHeight);\n if (restingHeightPx != null) return clamp(restingHeightPx / host, 0, 1);\n const layout = resolveSheetLayout(options, host, platform);\n const point = layout.snapPoints[layout.initialSnap];\n if (typeof point === 'number') return clamp(point / host, 0, 1);\n if (point === 'fit' || point === undefined) return (layout.fitMaxHeight ?? 0) / host;\n return clamp(Number.parseFloat(point) / 100, 0, 1);\n}\n\n/** How far a receded parent sheet sinks: `max(24, visible × 0.25)` (MAUI stack recede). */\nexport function parentRecedeOffset(visibleHeight: number): number {\n return Math.max(24, visibleHeight * 0.25);\n}\n\n/** Top padding of a full-screen sheet (MAUI safe-area rule). */\nexport function sheetTopPadding(options: G9SheetOptions, topInset: number): number {\n if (options.topSafeAreaPaddingOverride != null) return Math.max(0, options.topSafeAreaPaddingOverride);\n const inset = options.useTopSafeAreaPadding === false ? 0 : Math.max(0, topInset);\n return inset + g9SheetTopSafeAreaBaseGap + Math.max(0, options.additionalTopSafeAreaPadding ?? 0);\n}\n\n/**\n * Top padding of the sheet surface where it rests. A full-screen sheet always reserves {@link sheetTopPadding}. A\n * detent sheet resting at its `large` detent reserves it too when that detent reaches under the top inset (MAUI\n * state-aware top padding, `G9BottomSheetHelper.ApplyStateAwareTopPadding`): its content never sits under the status\n * bar or the camera cutout. Opted out like MAUI: `useTopSafeAreaPadding: false` with no additional/override padding.\n */\nexport function sheetSurfaceTopPadding(\n options: G9SheetOptions,\n layout: Pick<G9SheetLayout, 'fullScreen' | 'fit'>,\n resting: G9SheetDetent | 'fit',\n topInset: number,\n hostHeight: number,\n): number {\n if (layout.fullScreen) return sheetTopPadding(options, topInset);\n if (layout.fit || resting !== 'large') return 0;\n const opted =\n options.useTopSafeAreaPadding !== false ||\n (options.additionalTopSafeAreaPadding ?? 0) > 0 ||\n (options.topSafeAreaPaddingOverride ?? 0) > 0;\n if (!opted) return 0;\n const full = clamp(options.fullExpandedRatio ?? 1, 0.1, 1);\n const top = Math.max(0, hostHeight) * (1 - full);\n return top < Math.max(0, topInset) + g9SheetTopSafeAreaBaseGap ? sheetTopPadding(options, topInset) : 0;\n}\n\n/**\n * Bottom padding of the sheet surface: the host's bottom safe inset (a visible navigation bar or gesture handle), so\n * the last row and the footer stay above it. `useBottomSafeAreaPadding: false` lets content run under it. An\n * immersive host (system bars hidden, as the AgriPad MAUI app) reports 0 and nothing changes.\n */\nexport function sheetSurfaceBottomPadding(options: G9SheetOptions, bottomInset: number): number {\n return options.useBottomSafeAreaPadding === false ? 0 : Math.max(0, bottomInset);\n}\n\n/**\n * Size-scaled animation duration (MAUI `SizeScaledAnimationDuration`): a partial traversal takes the matching slice\n * of the full duration (at least 1 ms unless the duration is 0).\n */\nexport function scaledSheetDuration(durationMs: number, traversedRatio: number, sizeScaled: boolean): number {\n if (durationMs <= 0) return 0;\n if (!sizeScaled) return durationMs;\n return Math.max(1, Math.round(durationMs * clamp(traversedRatio, 0, 1)));\n}\n\n/** Platform size constraints of the sheet surface (MAUI Android/Windows options, applied where they belong). */\nexport function platformSheetConstraints(\n options: G9SheetOptions,\n platform = currentPlatform(),\n): Record<string, string> {\n const px = (n: number) => `${n}px`;\n const style: Record<string, string> = {};\n if (platform === 'android') {\n if (options.androidMaxWidth != null) style.maxWidth = px(options.androidMaxWidth);\n if (options.androidMaxHeight != null) style.maxHeight = px(options.androidMaxHeight);\n if (options.androidMargin) {\n const [l, t, r, b] = options.androidMargin;\n style.margin = `${t}px ${r}px ${b}px ${l}px`;\n }\n }\n if (platform === 'windows') {\n if (options.windowsMaxWidth != null) style.maxWidth = px(options.windowsMaxWidth);\n if (options.windowsMaxHeight != null) style.maxHeight = px(options.windowsMaxHeight);\n if (options.windowsMinWidth != null) style.minWidth = px(options.windowsMinWidth);\n if (options.windowsMinHeight != null) style.minHeight = px(options.windowsMinHeight);\n }\n if (options.contentWidthMode === 'custom') {\n style.width = px(options.contentWidth ?? 300);\n style.alignSelf = 'center';\n }\n return style;\n}\n"],"names":["g9SheetDefaultPeekHeight","g9SheetFitMinHeight","g9SheetFitLoadingMinHeight","g9SheetDragCloseThreshold","g9SheetTopSafeAreaBaseGap","clamp","v","lo","hi","Math","currentPlatform","info","globalThis","p","pct","ratio","resolveSheetLayout","options","hostHeight","platform","_ref","_options_fullExpandedRatio","_ref1","_options_currentState","_options_maxFitToContentHeightRatio","fit","draggable","cancelable","intercepted","_options_maxFitToContentHeightRatio1","order","requested","states","d","androidHalf","half","full","peek","snap","snapPoints","current","index","fixed","clampFitHeight","natural","cap","loading","min","sheetOverlayOpacity","visibleRatio","detentRatios","max","backdropCardTransform","threshold","raw","progress","sheetVisibleRatio","restingHeightPx","_layout_fitMaxHeight","host","layout","point","undefined","Number","parentRecedeOffset","visibleHeight","sheetTopPadding","topInset","_options_additionalTopSafeAreaPadding","inset","sheetSurfaceTopPadding","resting","_options_topSafeAreaPaddingOverride","opted","top","sheetSurfaceBottomPadding","bottomInset","scaledSheetDuration","durationMs","traversedRatio","sizeScaled","platformSheetConstraints","px","n","style","l","t","r","b","_options_contentWidth"],"mappings":"AAKO,MAAMA,2BAA2B;AAEjC,MAAMC,sBAAsB;AAE5B,MAAMC,6BAA6B;AAEnC,MAAMC,4BAA4B;AAOlC,MAAMC,4BAA4B;AAEzC,MAAMC,QAAQ,CAACC,GAAWC,IAAYC,KAAeC,KAAK,GAAG,CAACD,IAAIC,KAAK,GAAG,CAACF,IAAID;AAGxE,SAASI;;IACd,MAAMC,OAAQC,WAAsD,UAAU;IAC9E,MAAMC,IAAI,AAAC,SAAD,QAACF,QAAAA,OAAAA,KAAAA,IAAAA,KAAM,QAAQ,AAAD,IAAC,OAAI,EAAC,EAAG,WAAW;IAC5C,IAAIE,AAAM,cAANA,GAAiB,OAAO;IAC5B,IAAIA,AAAM,UAANA,GAAa,OAAO;IACxB,IAAIA,EAAE,UAAU,CAAC,QAAQ,OAAO;IAChC,IAAIA,AAAM,YAANA,KAAiBA,AAAM,UAANA,KAAeA,AAAM,UAANA,GAAa,OAAO;IACxD,OAAO;AACT;AA6BA,MAAMC,MAAM,CAACC,QAAkB,GAAGN,KAAK,KAAK,CAACM,AAAQ,QAARA,SAAiB,IAAI,CAAC,CAAC;AAQ7D,SAASC,mBACdC,OAAuB,EACvBC,UAAkB,EAClBC,WAAWT,iBAAiB;QA0BTU,MACAC,4BACMC,OAAAA,0BAKTC,uBAesBC;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AAa,cAAbA,UAAwB;QAC1B,IAAIF,AAA2B,QAA3BA,QAAQ,eAAe,EAAUmE,MAAM,QAAQ,GAAGF,GAAGjE,QAAQ,eAAe;QAChF,IAAIA,AAA4B,QAA5BA,QAAQ,gBAAgB,EAAUmE,MAAM,SAAS,GAAGF,GAAGjE,QAAQ,gBAAgB;QACnF,IAAIA,AAA2B,QAA3BA,QAAQ,eAAe,EAAUmE,MAAM,QAAQ,GAAGF,GAAGjE,QAAQ,eAAe;QAChF,IAAIA,AAA4B,QAA5BA,QAAQ,gBAAgB,EAAUmE,MAAM,SAAS,GAAGF,GAAGjE,QAAQ,gBAAgB;IACrF;IACA,IAAIA,AAA6B,aAA7BA,QAAQ,gBAAgB,EAAe;YACxBwE;QAAjBL,MAAM,KAAK,GAAGF,GAAG,QAAAO,CAAAA,wBAAAA,QAAQ,YAAY,AAAD,IAAnBA,wBAAwB;QACzCL,MAAM,SAAS,GAAG;IACpB;IACA,OAAOA;AACT"}
1
+ {"version":3,"file":"sheet/sizing.jsx","sources":["../../src/sheet/sizing.ts"],"sourcesContent":["import type { G9SheetDetent, G9SheetOptions } from './options';\n\n// Pure sizing rules of the G9 sheet (MAUI G9SheetView + G9BottomSheetHelper sizing; guide 650–980, ADR-0019/0026).\n\n/** MAUI `G9SheetView.MinimizedHeight`: default peek height. */\nexport const g9SheetDefaultPeekHeight = 100;\n/** Absolute minimum of an authoritative fit height (MAUI helper :81). */\nexport const g9SheetFitMinHeight = 80;\n/** Default `scrollToEndThreshold`: four 52 px rows from the end (MAUI 1.4.8 selection sheet, `OnItemsScrolled`). */\nexport const g9SheetScrollToEndThreshold = 208;\n/** Floor while the height is unknown (loading window). */\nexport const g9SheetFitLoadingMinHeight = 180;\n/** Finger travel at release that requests a close (MAUI `DragCloseThreshold`). */\nexport const g9SheetDragCloseThreshold = 72;\n/**\n * Gap between the top safe-area inset and a full-screen sheet's header. MAUI reserves the inset alone\n * (`ResolveFullScreenSheetTopPadding`), but its Android inset is the status-bar band, a few dp below the cutout an\n * immersive Lynx host reports: measured side by side on a Pixel 9 Pro XL (2026-10-10), MAUI's header sat 3 dp lower.\n * (It was 8, which put every full-screen header 5 dp below MAUI's.)\n */\nexport const g9SheetTopSafeAreaBaseGap = 3;\n\nconst clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));\n\n/** The platform the app runs on (Lynx `SystemInfo.platform`), lower-cased; `'unknown'` outside Lynx. */\nexport function currentPlatform(): 'android' | 'ios' | 'windows' | 'macos' | 'unknown' {\n const info = (globalThis as { SystemInfo?: { platform?: string } }).SystemInfo;\n const p = (info?.platform ?? '').toLowerCase();\n if (p === 'android') return 'android';\n if (p === 'ios') return 'ios';\n if (p.startsWith('win')) return 'windows';\n if (p === 'macos' || p === 'mac' || p === 'osx') return 'macos';\n return 'unknown';\n}\n\n/** What the adapter passes to lynx-ui `SheetRoot` and how the frame behaves. */\nexport interface G9SheetLayout {\n /** lynx-ui snap points, small to large: pixels, `'NN%'` of the host, or `'fit'`. */\n readonly snapPoints: Array<number | string>;\n readonly initialSnap: number;\n /** One detent, or fit-to-content (MAUI \"fixed\"): no grabber, no detent dragging. */\n readonly fixed: boolean;\n readonly fit: boolean;\n /** Grabber visible (`hasHandle && isDraggable && (!fixed || handleOnSingleDetent)`). */\n readonly showHandle: boolean;\n readonly dragDisabled: boolean;\n /** Drag past the lowest detent may request a close. */\n readonly enableDragToClose: boolean;\n /** Backdrop tap requests a close. */\n readonly closeOnOverlayTap: boolean;\n /** The resting body cap for a fit sheet (`maxFitToContentHeightRatio × host`), else `null`. */\n readonly fitMaxHeight: number | null;\n /** Whether the sheet's largest detent is full screen. */\n readonly fullScreen: boolean;\n /**\n * The body fills the surface, so the footer rests at the sheet's bottom edge: a full-screen sheet, or one fixed detent\n * (`states: ['large']` with `fullExpandedRatio: 0.9`) — its surface has a definite height. A sheet that can move between\n * detents or fits its content keeps a body as tall as the content.\n */\n readonly fillBody: boolean;\n}\n\nconst pct = (ratio: number) => `${Math.round(ratio * 10000) / 100}%`;\n\n/**\n * Maps G9 options to a lynx-ui layout (the agreed mapping of MAUI `ApplyOptions`): fit → `['fit']` capped at\n * `maxFitToContentHeightRatio`; states → peek pixels / half ratio / full ratio for the allowed detents, the initial\n * detent from `currentState`. The MAUI quirks (a hidden 100 dp detent under `[medium, large]`, a peek-only sheet that\n * may expand) are not carried over: the detents are exactly `states` (docs/sheets.md \"deliberate differences\").\n */\nexport function resolveSheetLayout(\n options: G9SheetOptions,\n hostHeight: number,\n platform = currentPlatform(),\n): G9SheetLayout {\n const fit = options.sizeMode === 'fitToContent';\n const draggable = options.isDraggable !== false;\n const cancelable = options.isCancelable !== false;\n const intercepted = options.onBackRequested != null;\n if (fit) {\n const ratio = clamp(options.maxFitToContentHeightRatio ?? 0.75, 0.2, 1);\n return {\n snapPoints: ['fit'],\n initialSnap: 0,\n fixed: true,\n fit: true,\n showHandle: false,\n dragDisabled: true,\n enableDragToClose: false,\n closeOnOverlayTap: cancelable,\n fitMaxHeight: Math.max(g9SheetFitMinHeight, Math.floor(hostHeight * ratio)),\n fullScreen: false,\n fillBody: false,\n };\n }\n const order: G9SheetDetent[] = ['peek', 'medium', 'large'];\n const requested = options.states && options.states.length > 0 ? options.states : ['medium', 'large'];\n const states = order.filter((d) => requested.includes(d));\n const androidHalf = platform === 'android' ? options.androidHalfExpandedRatio : null;\n const half = clamp(androidHalf ?? options.halfExpandedRatio ?? 0.5, 0.1, 0.9);\n const full = clamp(options.fullExpandedRatio ?? 1, 0.1, 1);\n const peek = Math.max(1, options.collapsedHeight ?? options.peekHeight ?? g9SheetDefaultPeekHeight);\n const snap = (d: G9SheetDetent): number | string =>\n d === 'peek' ? Math.min(peek, Math.max(1, hostHeight)) : d === 'medium' ? pct(half) : pct(full);\n const snapPoints = states.map(snap);\n if (options.expandedFitsContent && snapPoints.length > 0) snapPoints[snapPoints.length - 1] = 'fit';\n const current = options.currentState ?? 'medium';\n const index = states.indexOf(current);\n const fixed = states.length <= 1;\n return {\n snapPoints,\n initialSnap: index >= 0 ? index : 0,\n fixed,\n fit: false,\n showHandle: options.hasHandle !== false && draggable && (!fixed || options.handleOnSingleDetent === true),\n dragDisabled: !draggable || intercepted,\n enableDragToClose: cancelable && draggable && !intercepted,\n closeOnOverlayTap: cancelable,\n fitMaxHeight: options.expandedFitsContent\n ? Math.max(\n g9SheetFitMinHeight,\n Math.floor(hostHeight * clamp(options.maxFitToContentHeightRatio ?? 0.75, 0.2, 1)),\n )\n : null,\n // One 'large' detent sized to its content is not full screen (no status-bar padding above a short sheet).\n fullScreen: states.length === 1 && states[0] === 'large' && full >= 1 && options.expandedFitsContent !== true,\n fillBody: fixed && !options.expandedFitsContent,\n };\n}\n\n/** Clamps a measured fit body height: `[80, cap]`, or `[180, cap]` while loading (MAUI fit engine). */\nexport function clampFitHeight(natural: number, cap: number, loading: boolean): number {\n const min = loading ? g9SheetFitLoadingMinHeight : g9SheetFitMinHeight;\n if (!(natural > 0)) return Math.min(min, cap);\n return clamp(natural, Math.min(min, cap), cap);\n}\n\n/**\n * Scrim opacity for a visible ratio (MAUI helper overlay rule): between the smallest and the largest detent it runs\n * from `min` to `max`; a single detent uses `max`; below the smallest detent it fades with the ratio.\n */\nexport function sheetOverlayOpacity(\n visibleRatio: number,\n detentRatios: ReadonlyArray<number>,\n min: number,\n max: number,\n): number {\n if (detentRatios.length === 0) return max;\n const lo = Math.min(...detentRatios);\n const hi = Math.max(...detentRatios);\n if (visibleRatio < lo) return (detentRatios.length === 1 ? max : min) * clamp(visibleRatio / lo, 0, 1);\n if (hi === lo) return max;\n return min + (max - min) * clamp((visibleRatio - lo) / (hi - lo), 0, 1);\n}\n\n/** The page recede behind a tall primary sheet (MAUI backdrop card): scale 1 → 0.93, translateY 0 → 12. */\nexport function backdropCardTransform(visibleRatio: number, threshold = 0.75): { scale: number; translateY: number } {\n const raw = clamp((visibleRatio - threshold) / Math.max(1e-6, 1 - threshold), 0, 1);\n const progress = raw <= 0 ? 0 : 1 - (1 - raw) ** (1 / 3);\n return { scale: 1 - 0.07 * progress, translateY: 12 * progress };\n}\n\n/**\n * The visible share of the host a detent sheet covers: its resting height when known, else its opening detent\n * (peek = peek height, medium = half ratio, large = full ratio; `expandedFitsContent` large counts as the fit cap).\n */\nexport function sheetVisibleRatio(\n options: G9SheetOptions,\n hostHeight: number,\n restingHeightPx: number | null,\n platform = currentPlatform(),\n): number {\n const host = Math.max(1, hostHeight);\n if (restingHeightPx != null) return clamp(restingHeightPx / host, 0, 1);\n const layout = resolveSheetLayout(options, host, platform);\n const point = layout.snapPoints[layout.initialSnap];\n if (typeof point === 'number') return clamp(point / host, 0, 1);\n if (point === 'fit' || point === undefined) return (layout.fitMaxHeight ?? 0) / host;\n return clamp(Number.parseFloat(point) / 100, 0, 1);\n}\n\n/** How far a receded parent sheet sinks: `max(24, visible × 0.25)` (MAUI stack recede). */\nexport function parentRecedeOffset(visibleHeight: number): number {\n return Math.max(24, visibleHeight * 0.25);\n}\n\n/** Top padding of a full-screen sheet (MAUI safe-area rule). */\nexport function sheetTopPadding(options: G9SheetOptions, topInset: number): number {\n if (options.topSafeAreaPaddingOverride != null) return Math.max(0, options.topSafeAreaPaddingOverride);\n const inset = options.useTopSafeAreaPadding === false ? 0 : Math.max(0, topInset);\n return inset + g9SheetTopSafeAreaBaseGap + Math.max(0, options.additionalTopSafeAreaPadding ?? 0);\n}\n\n/**\n * Top padding of the sheet surface where it rests. A full-screen sheet always reserves {@link sheetTopPadding}. A\n * detent sheet resting at its `large` detent reserves it too when that detent reaches under the top inset (MAUI\n * state-aware top padding, `G9BottomSheetHelper.ApplyStateAwareTopPadding`): its content never sits under the status\n * bar or the camera cutout. Opted out like MAUI: `useTopSafeAreaPadding: false` with no additional/override padding.\n */\nexport function sheetSurfaceTopPadding(\n options: G9SheetOptions,\n layout: Pick<G9SheetLayout, 'fullScreen' | 'fit'>,\n resting: G9SheetDetent | 'fit',\n topInset: number,\n hostHeight: number,\n): number {\n if (layout.fullScreen) return sheetTopPadding(options, topInset);\n if (layout.fit || resting !== 'large') return 0;\n const opted =\n options.useTopSafeAreaPadding !== false ||\n (options.additionalTopSafeAreaPadding ?? 0) > 0 ||\n (options.topSafeAreaPaddingOverride ?? 0) > 0;\n if (!opted) return 0;\n const full = clamp(options.fullExpandedRatio ?? 1, 0.1, 1);\n const top = Math.max(0, hostHeight) * (1 - full);\n return top < Math.max(0, topInset) + g9SheetTopSafeAreaBaseGap ? sheetTopPadding(options, topInset) : 0;\n}\n\n/**\n * Bottom padding of the sheet surface: the host's bottom safe inset (a visible navigation bar or gesture handle), so\n * the last row and the footer stay above it. `useBottomSafeAreaPadding: false` lets content run under it. An\n * immersive host (system bars hidden, as the AgriPad MAUI app) reports 0 and nothing changes.\n */\nexport function sheetSurfaceBottomPadding(options: G9SheetOptions, bottomInset: number): number {\n return options.useBottomSafeAreaPadding === false ? 0 : Math.max(0, bottomInset);\n}\n\n/**\n * Size-scaled animation duration (MAUI `SizeScaledAnimationDuration`): a partial traversal takes the matching slice\n * of the full duration (at least 1 ms unless the duration is 0).\n */\nexport function scaledSheetDuration(durationMs: number, traversedRatio: number, sizeScaled: boolean): number {\n if (durationMs <= 0) return 0;\n if (!sizeScaled) return durationMs;\n return Math.max(1, Math.round(durationMs * clamp(traversedRatio, 0, 1)));\n}\n\n/** Platform size constraints of the sheet surface (MAUI Android/Windows options, applied where they belong). */\nexport function platformSheetConstraints(\n options: G9SheetOptions,\n platform = currentPlatform(),\n): Record<string, string> {\n const px = (n: number) => `${n}px`;\n const style: Record<string, string> = {};\n if (platform === 'android') {\n if (options.androidMaxWidth != null) style.maxWidth = px(options.androidMaxWidth);\n if (options.androidMaxHeight != null) style.maxHeight = px(options.androidMaxHeight);\n if (options.androidMargin) {\n const [l, t, r, b] = options.androidMargin;\n style.margin = `${t}px ${r}px ${b}px ${l}px`;\n }\n }\n if (platform === 'windows') {\n if (options.windowsMaxWidth != null) style.maxWidth = px(options.windowsMaxWidth);\n if (options.windowsMaxHeight != null) style.maxHeight = px(options.windowsMaxHeight);\n if (options.windowsMinWidth != null) style.minWidth = px(options.windowsMinWidth);\n if (options.windowsMinHeight != null) style.minHeight = px(options.windowsMinHeight);\n }\n if (options.contentWidthMode === 'custom') {\n style.width = px(options.contentWidth ?? 300);\n style.alignSelf = 'center';\n }\n return style;\n}\n"],"names":["g9SheetDefaultPeekHeight","g9SheetFitMinHeight","g9SheetScrollToEndThreshold","g9SheetFitLoadingMinHeight","g9SheetDragCloseThreshold","g9SheetTopSafeAreaBaseGap","clamp","v","lo","hi","Math","currentPlatform","info","globalThis","p","pct","ratio","resolveSheetLayout","options","hostHeight","platform","_ref","_options_fullExpandedRatio","_ref1","_options_currentState","_options_maxFitToContentHeightRatio","fit","draggable","cancelable","intercepted","_options_maxFitToContentHeightRatio1","order","requested","states","d","androidHalf","half","full","peek","snap","snapPoints","current","index","fixed","clampFitHeight","natural","cap","loading","min","sheetOverlayOpacity","visibleRatio","detentRatios","max","backdropCardTransform","threshold","raw","progress","sheetVisibleRatio","restingHeightPx","_layout_fitMaxHeight","host","layout","point","undefined","Number","parentRecedeOffset","visibleHeight","sheetTopPadding","topInset","_options_additionalTopSafeAreaPadding","inset","sheetSurfaceTopPadding","resting","_options_topSafeAreaPaddingOverride","opted","top","sheetSurfaceBottomPadding","bottomInset","scaledSheetDuration","durationMs","traversedRatio","sizeScaled","platformSheetConstraints","px","n","style","l","t","r","b","_options_contentWidth"],"mappings":"AAKO,MAAMA,2BAA2B;AAEjC,MAAMC,sBAAsB;AAE5B,MAAMC,8BAA8B;AAEpC,MAAMC,6BAA6B;AAEnC,MAAMC,4BAA4B;AAOlC,MAAMC,4BAA4B;AAEzC,MAAMC,QAAQ,CAACC,GAAWC,IAAYC,KAAeC,KAAK,GAAG,CAACD,IAAIC,KAAK,GAAG,CAACF,IAAID;AAGxE,SAASI;;IACd,MAAMC,OAAQC,WAAsD,UAAU;IAC9E,MAAMC,IAAI,AAAC,SAAD,QAACF,QAAAA,OAAAA,KAAAA,IAAAA,KAAM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AAC;IACvC,IAAIjE,AAAa,cAAbA,UAAwB;QAC1B,IAAIF,AAA2B,QAA3BA,QAAQ,eAAe,EAAUmE,MAAM,QAAQ,GAAGF,GAAGjE,QAAQ,eAAe;QAChF,IAAIA,AAA4B,QAA5BA,QAAQ,gBAAgB,EAAUmE,MAAM,SAAS,GAAGF,GAAGjE,QAAQ,gBAAgB;QACnF,IAAIA,QAAQ,aAAa,EAAE;YACzB,MAAM,CAACoE,GAAGC,GAAGC,GAAGC,EAAE,GAAGvE,QAAQ,aAAa;YAC1CmE,MAAM,MAAM,GAAG,GAAGE,EAAE,GAAG,EAAEC,EAAE,GAAG,EAAEC,EAAE,GAAG,EAAEH,EAAE,EAAE,CAAC;QAC9C;IACF;IACA,IAAIlE,AAAa,cAAbA,UAAwB;QAC1B,IAAIF,AAA2B,QAA3BA,QAAQ,eAAe,EAAUmE,MAAM,QAAQ,GAAGF,GAAGjE,QAAQ,eAAe;QAChF,IAAIA,AAA4B,QAA5BA,QAAQ,gBAAgB,EAAUmE,MAAM,SAAS,GAAGF,GAAGjE,QAAQ,gBAAgB;QACnF,IAAIA,AAA2B,QAA3BA,QAAQ,eAAe,EAAUmE,MAAM,QAAQ,GAAGF,GAAGjE,QAAQ,eAAe;QAChF,IAAIA,AAA4B,QAA5BA,QAAQ,gBAAgB,EAAUmE,MAAM,SAAS,GAAGF,GAAGjE,QAAQ,gBAAgB;IACrF;IACA,IAAIA,AAA6B,aAA7BA,QAAQ,gBAAgB,EAAe;YACxBwE;QAAjBL,MAAM,KAAK,GAAGF,GAAG,QAAAO,CAAAA,wBAAAA,QAAQ,YAAY,AAAD,IAAnBA,wBAAwB;QACzCL,MAAM,SAAS,GAAG;IACpB;IACA,OAAOA;AACT"}
@@ -29,8 +29,16 @@ export interface G9ChipGroupProps extends G9ControlBaseProps {
29
29
  readonly selectedBackground?: string | null;
30
30
  /** Group-wide selected text colour. Default on-primary. */
31
31
  readonly selectedTextColor?: string | null;
32
- /** `'wrap'` (default) or one horizontally scrolling line. */
32
+ /**
33
+ * `'wrap'` (default), one horizontally scrolling line, or (MAUI 1.4.9) `'segmented'`: equal flat cells that share each
34
+ * row — AgriPad's design for short exclusive choices.
35
+ */
33
36
  readonly layoutMode?: G9ChipGroupLayoutMode;
37
+ /**
38
+ * `'segmented'` only: how many equal cells one row holds; more items wrap onto the next row in the same columns (the
39
+ * design's «مرتب‌سازی بر اساس», three a row). `0` (default) = every item on one row.
40
+ */
41
+ readonly segmentColumns?: number;
34
42
  /** Default 9 (`G9LayoutMetrics.ControlCornerRadius`). */
35
43
  readonly chipCornerRadius?: number;
36
44
  /** Check mark at the trailing edge of selected chips. Default true. */
@@ -1 +1 @@
1
- {"version":3,"file":"chip-group.d.ts","sourceRoot":"","sources":["../../src/toggle/chip-group.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAI9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,KAAK,kBAAkB,EAAkD,MAAM,iBAAiB,CAAC;AAE1G,OAAO,EAAE,KAAK,eAAe,EAAgB,MAAM,wBAAwB,CAAC;AAK5E,yDAAyD;AACzD,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D,iHAAiH;IACjH,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC/C,kCAAkC;IAClC,QAAQ,CAAC,aAAa,CAAC,EAAE,wBAAwB,CAAC;IAClD,mEAAmE;IACnE,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,IAAI,C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AkF;IAClF,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,2DAA2D;IAC3D,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IAC5C;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,yDAAyD;IACzD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,uEAAuE;IACvE,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;CAC9E;AAID;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CA+I9D"}
@@ -1,5 +1,5 @@
1
1
  import "./toggle.css";
2
- import { G9Metrics, G9StringKey, buildSolidOrGradient, fillToCss, formatColor, tryParseColor } from "@g9tm/lynxcontrols-foundation";
2
+ import { G9Metrics, G9StringKey, buildSolidOrGradient, fillToCss, formatColor, mix, tryParseColor } from "@g9tm/lynxcontrols-foundation";
3
3
  import { g9ChildId, g9IdProps, g9RowStyle, useG9Control } from "../base/control.jsx";
4
4
  import { useG9Press } from "../base/press.jsx";
5
5
  import { selectionKey } from "../base/selection-item.jsx";
@@ -52,16 +52,49 @@ function G9ChipGroup(props) {
52
52
  const iconSize = null != (_props_iconSize = props.iconSize) ? _props_iconSize : G9Metrics.ChipIconSize;
53
53
  const radius = null != (_props_chipCornerRadius = props.chipCornerRadius) ? _props_chipCornerRadius : 9;
54
54
  const checkmark = false !== props.showSelectionCheckmark;
55
+ const segmented = 'segmented' === props.layoutMode;
55
56
  const chips = props.items.map((item)=>{
56
- var _ref, _item_selectedColor, _ref1, _item_selectedTextColor;
57
57
  const selected = isSelected(item);
58
- const bg = null != (_ref = null != (_item_selectedColor = item.selectedColor) ? _item_selectedColor : props.selectedBackground) ? _ref : palette.Primary;
59
- const fg = null != (_ref1 = null != (_item_selectedTextColor = item.selectedTextColor) ? _item_selectedTextColor : props.selectedTextColor) ? _ref1 : palette.OnPrimary;
60
- const parsed = tryParseColor(bg);
61
- const background = selected ? parsed ? fillToCss(buildSolidOrGradient(parsed, true)) : bg : palette.Surface;
62
- const color = selected ? fg : palette.TextSecondary;
63
- return <Chip key={selectionKey(item)} direction={control.direction} item={item} selected={selected} background={background} stroke={selected ? parsed ? formatColor(parsed) : bg : palette.OutlineVariant} color={color} height={height} spacing={spacing} iconSize={iconSize} radius={radius} checkmark={checkmark} checkIcon={glyphs.check} groupDisabled={control.disabled} selectedLabel={strings.get(G9StringKey.Selected)} onTap={tap} id={g9ChildId(props.id, selectionKey(item))}/>;
58
+ let background;
59
+ let stroke;
60
+ let color;
61
+ if (segmented) {
62
+ var _ref, _item_selectedColor, _ref1, _item_selectedTextColor;
63
+ const accent = null != (_ref = null != (_item_selectedColor = item.selectedColor) ? _item_selectedColor : props.selectedBackground) ? _ref : palette.Primary;
64
+ const parsedAccent = tryParseColor(accent);
65
+ background = selected ? parsedAccent ? formatColor(mix(palette.Surface, parsedAccent, 0.08)) : accent : palette.SurfaceContainer;
66
+ stroke = selected ? parsedAccent ? formatColor(parsedAccent) : accent : palette.OutlineVariant;
67
+ color = selected ? null != (_ref1 = null != (_item_selectedTextColor = item.selectedTextColor) ? _item_selectedTextColor : props.selectedTextColor) ? _ref1 : palette.TextPrimary : palette.TextSecondary;
68
+ } else {
69
+ var _ref2, _item_selectedColor1, _ref3, _item_selectedTextColor1;
70
+ const bg = null != (_ref2 = null != (_item_selectedColor1 = item.selectedColor) ? _item_selectedColor1 : props.selectedBackground) ? _ref2 : palette.Primary;
71
+ const fg = null != (_ref3 = null != (_item_selectedTextColor1 = item.selectedTextColor) ? _item_selectedTextColor1 : props.selectedTextColor) ? _ref3 : palette.OnPrimary;
72
+ const parsed = tryParseColor(bg);
73
+ background = selected ? parsed ? fillToCss(buildSolidOrGradient(parsed, true)) : bg : palette.Surface;
74
+ stroke = selected ? parsed ? formatColor(parsed) : bg : palette.OutlineVariant;
75
+ color = selected ? fg : palette.TextSecondary;
76
+ }
77
+ return <Chip key={selectionKey(item)} direction={control.direction} item={item} selected={selected} background={background} stroke={stroke} color={color} height={segmented ? Math.max(height, G9Metrics.SegmentHeight) : height} spacing={spacing} iconSize={iconSize} radius={segmented ? G9Metrics.SegmentCornerRadius : radius} checkmark={checkmark && !segmented} segment={segmented} checkIcon={glyphs.check} groupDisabled={control.disabled} selectedLabel={strings.get(G9StringKey.Selected)} onTap={tap} id={g9ChildId(props.id, selectionKey(item))}/>;
64
78
  });
79
+ if (segmented) {
80
+ const columns = props.segmentColumns && props.segmentColumns > 0 ? Math.min(props.segmentColumns, Math.max(1, chips.length)) : Math.max(1, chips.length);
81
+ const rows = [];
82
+ for(let start = 0; start < chips.length; start += columns){
83
+ const cells = chips.slice(start, start + columns);
84
+ while(cells.length < columns)cells.push(<view key={`fill-${cells.length}`} className="g9-chip-group__segment-fill"/>);
85
+ rows.push(<view key={`row-${start}`} className="g9-chip-group__segment-row" style={{
86
+ ...g9RowStyle(control.direction),
87
+ columnGap: `${spacing}px`
88
+ }}>
89
+ {cells}
90
+ </view>);
91
+ }
92
+ return <view className={`${control.className} g9-chip-group--segmented`} {...control.idProps} style={{
93
+ rowGap: `${spacing}px`
94
+ }}>
95
+ {rows}
96
+ </view>;
97
+ }
65
98
  const scroll = 'singleLineScroll' === props.layoutMode;
66
99
  return scroll ? <scroll-view className={`${control.className} g9-chip-group--scroll`} {...control.idProps} scroll-orientation="horizontal">
67
100
  <view className="g9-chip-group__line" style={g9RowStyle(control.direction)}>
@@ -79,12 +112,14 @@ function Chip(props) {
79
112
  source: 'G9ChipGroup',
80
113
  guardMs: 0
81
114
  });
82
- return <view className={`g9-chip${props.selected ? ' g9-chip--selected' : ''}${false === item.isEnabled ? ' g9-chip--disabled' : ''}`} {...g9IdProps(props.id)} style={{
115
+ return <view className={`g9-chip${props.segment ? ' g9-chip--segment' : ''}${props.selected ? ' g9-chip--selected' : ''}${false === item.isEnabled ? ' g9-chip--disabled' : ''}`} {...g9IdProps(props.id)} style={{
83
116
  ...g9RowStyle(props.direction),
84
117
  height: `${props.height}px`,
85
118
  minHeight: `${props.height}px`,
86
- ['rtl' === props.direction ? 'marginLeft' : 'marginRight']: `${props.spacing}px`,
87
- marginBottom: `${props.spacing}px`,
119
+ ...props.segment ? {} : {
120
+ ['rtl' === props.direction ? 'marginLeft' : 'marginRight']: `${props.spacing}px`,
121
+ marginBottom: `${props.spacing}px`
122
+ },
88
123
  borderRadius: `${props.radius}px`,
89
124
  background: props.background,
90
125
  borderColor: props.stroke
@@ -99,7 +134,11 @@ function Chip(props) {
99
134
  image: item.iconImage
100
135
  }) ? <G9IconSlot emoji={item.emoji} icon={item.icon} imagePath={item.iconPath} image={item.iconImage} size={props.iconSize} color={props.color}/> : null}
101
136
  <text className="g9-chip__text" style={{
102
- color: props.color
137
+ color: props.color,
138
+ ...props.segment ? {
139
+ fontSize: `${G9Metrics.SegmentFontSize}px`,
140
+ fontWeight: props.selected ? 'bold' : 'normal'
141
+ } : {}
103
142
  }}>
104
143
  {item.text}
105
144
  </text>