@g9tm/lynxcontrols 1.4.4 → 1.4.7

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 (72) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/base/pressable.d.ts.map +1 -1
  3. package/dist/base/pressable.jsx +2 -1
  4. package/dist/base/pressable.jsx.map +1 -1
  5. package/dist/cascade/cascade-panel.d.ts.map +1 -1
  6. package/dist/cascade/cascade-panel.jsx +2 -2
  7. package/dist/cascade/cascade-panel.jsx.map +1 -1
  8. package/dist/edge-panel/edge-panel.jsx +5 -5
  9. package/dist/edge-panel/edge-panel.jsx.map +1 -1
  10. package/dist/expander/expander.d.ts.map +1 -1
  11. package/dist/expander/expander.jsx +2 -1
  12. package/dist/expander/expander.jsx.map +1 -1
  13. package/dist/fields/index.d.ts +1 -1
  14. package/dist/fields/index.d.ts.map +1 -1
  15. package/dist/fields/index.jsx +1 -1
  16. package/dist/fields/use-text-input.d.ts +14 -1
  17. package/dist/fields/use-text-input.d.ts.map +1 -1
  18. package/dist/fields/use-text-input.jsx +17 -3
  19. package/dist/fields/use-text-input.jsx.map +1 -1
  20. package/dist/host/host.css.map +1 -1
  21. package/dist/host/host.d.ts +3 -2
  22. package/dist/host/host.d.ts.map +1 -1
  23. package/dist/host/host.jsx +2 -2
  24. package/dist/host/host.jsx.map +1 -1
  25. package/dist/plus-button/model.d.ts.map +1 -1
  26. package/dist/plus-button/model.jsx +5 -1
  27. package/dist/plus-button/model.jsx.map +1 -1
  28. package/dist/popup/frame.jsx +2 -2
  29. package/dist/popup/frame.jsx.map +1 -1
  30. package/dist/popup/service.d.ts.map +1 -1
  31. package/dist/popup/service.jsx +2 -2
  32. package/dist/popup/service.jsx.map +1 -1
  33. package/dist/provider/provider.css +4 -0
  34. package/dist/provider/provider.css.map +1 -1
  35. package/dist/provider/provider.d.ts.map +1 -1
  36. package/dist/provider/provider.jsx +4 -2
  37. package/dist/provider/provider.jsx.map +1 -1
  38. package/dist/selection/selection-sheet.d.ts +5 -0
  39. package/dist/selection/selection-sheet.d.ts.map +1 -1
  40. package/dist/selection/selection-sheet.jsx +7 -3
  41. package/dist/selection/selection-sheet.jsx.map +1 -1
  42. package/dist/sheet/frame.d.ts.map +1 -1
  43. package/dist/sheet/frame.jsx +30 -8
  44. package/dist/sheet/frame.jsx.map +1 -1
  45. package/dist/sheet/index.d.ts +1 -0
  46. package/dist/sheet/index.d.ts.map +1 -1
  47. package/dist/sheet/index.jsx +1 -0
  48. package/dist/sheet/motion.d.ts.map +1 -1
  49. package/dist/sheet/motion.jsx +14 -0
  50. package/dist/sheet/motion.jsx.map +1 -1
  51. package/dist/sheet/options.d.ts +13 -0
  52. package/dist/sheet/options.d.ts.map +1 -1
  53. package/dist/sheet/options.jsx.map +1 -1
  54. package/dist/sheet/scroll-indicator.d.ts +33 -0
  55. package/dist/sheet/scroll-indicator.d.ts.map +1 -0
  56. package/dist/sheet/scroll-indicator.jsx +84 -0
  57. package/dist/sheet/scroll-indicator.jsx.map +1 -0
  58. package/dist/sheet/sheet.css +14 -0
  59. package/dist/sheet/sheet.css.map +1 -1
  60. package/dist/sheet/sizing.d.ts +1 -1
  61. package/dist/sheet/sizing.d.ts.map +1 -1
  62. package/dist/sheet/sizing.jsx +2 -2
  63. package/dist/sheet/sizing.jsx.map +1 -1
  64. package/dist/tab-bar/tab-bar.d.ts.map +1 -1
  65. package/dist/tab-bar/tab-bar.jsx +11 -6
  66. package/dist/tab-bar/tab-bar.jsx.map +1 -1
  67. package/dist/toast/service.jsx +3 -3
  68. package/dist/toast/service.jsx.map +1 -1
  69. package/dist/toast/store.d.ts.map +1 -1
  70. package/dist/toast/store.jsx +3 -2
  71. package/dist/toast/store.jsx.map +1 -1
  72. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"popup/service.jsx","sources":["../../src/popup/service.tsx"],"sourcesContent":["import './popup.css';\nimport { createCulture, createStrings, type G9ErrorPopupRequest, G9StringKey } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { g9RowStyle, g9SafeId, g9TextStart } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport { startTimer, stopTimer } from '../base/timers';\nimport { G9ActivityIndicator } from '../display/activity-indicator';\nimport { useG9Host } from '../host/hooks';\nimport { type G9HostHandle, g9Hosts } from '../host/registry';\nimport { G9IconSlot } from '../icon/slot';\nimport { useG9Diagnostics, useG9Direction, useG9Settings, useG9Strings, useG9Window } from '../provider/hooks';\nimport { g9DefaultErrorPresenter } from '../provider/settings';\nimport { type G9PopupViewOpenOptions, PopupFrame } from './frame';\nimport { type G9PopupInputOptions, type G9PopupInputResult, g9PopupInputResult } from './input';\nimport { createPopupFormStore, PopupInputForm } from './input-form';\nimport { type G9PopupEntry, type G9PopupOutcome, G9PopupQueue } from './queue';\nimport {\n createPopupVisualProfile,\n customPopup,\n type G9PopupAnimationType,\n type G9PopupButton,\n type G9PopupDescriptor,\n type G9PopupResult,\n type G9PopupSettings,\n type G9PopupType,\n type G9PopupVisualProfile,\n g9PopupResult,\n presetPopup,\n resolvePopupSettings,\n} from './types';\n\n/** Most buttons a `row` footer shows (MAUI); more are dropped with a warning. */\nexport const g9PopupRowButtonLimit = 3;\n\n/** Options of `showConfirm` (MAUI `ShowConfirmAsync`). */\nexport interface G9ConfirmOptions {\n readonly title?: string | null;\n readonly okCallback?: ((context: { readonly aborted: boolean }) => unknown) | null;\n readonly cancelCallback?: ((context: { readonly aborted: boolean }) => unknown) | null;\n /** Default `'information'`; `'warning'` for a lossy confirm (sign out, discard). */\n readonly type?: G9PopupType;\n readonly okText?: string;\n readonly cancelText?: string;\n}\n\n/** The popups of a host (MAUI `G9PopupHelper`). */\nexport interface G9PopupService {\n /** Information popup (MAUI `ShowG9PopupAsync`); resolves the result of the button that closed it. */\n show(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n showSuccess(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n showWarning(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n showError(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n /** Any content in the body (MAUI `ShowCustomG9PopupAsync`). */\n showCustom(\n content: ReactNode | (() => ReactNode),\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n /** Any descriptor; resolves how it ended. */\n showDescriptor(descriptor: G9PopupDescriptor): Promise<G9PopupOutcome>;\n /** A validated form (MAUI `ShowInputG9PopupAsync`). */\n showInput(options: G9PopupInputOptions): Promise<G9PopupInputResult>;\n /** OK/Cancel: `true` only for OK; every other exit is `false` (MAUI `ShowConfirmAsync`). */\n showConfirm(message: string, options?: G9ConfirmOptions): Promise<boolean>;\n /** Hardware back: `true` when a popup is on screen (closed unless `closeOnBackButton: false`). */\n handleHardwareBack(): boolean;\n /** Closes the popup on screen. */\n closeActive(): void;\n /** Drops waiting popups; the one on screen stays. */\n clearQueue(): void;\n /** Closes everything. */\n dismissAll(): void;\n readonly queue: G9PopupQueue;\n}\n\nconst FEATURE = 'g9.popups';\n\ninterface State {\n service: G9PopupService;\n defaults: G9PopupSettings;\n /** Strings and diagnostics of the provider; refreshed by the layer on every render. */\n strings: (key: G9StringKey) => string;\n warn?: (message: string) => void;\n report?: (error: unknown) => void;\n}\n\nconst fallbackStrings = createStrings({ culture: createCulture('en') });\n\nfunction PopupButtonView(props: {\n readonly button: G9PopupButton;\n /** Element id: the button's `testId` made selector-safe, else `G9Popup_Button_<index>`. */\n readonly id: string;\n readonly profile: G9PopupVisualProfile;\n readonly busy: boolean;\n readonly stacked: boolean;\n readonly onPress: () => void;\n}): ReactNode {\n const { button, profile } = props;\n const primary = button.isPrimary !== false;\n const press = useG9Press(props.onPress, { source: 'G9Popup', guardMs: 0 });\n const background = button.backgroundColor ?? (primary ? profile.buttonBackground : 'transparent');\n const color = button.textColor ?? (primary ? profile.buttonTextColor : 'var(--g9-on-surface)');\n return (\n <view\n className={`g9-popup__button${primary ? ' g9-popup__button--primary' : ' g9-popup__button--outline'}${props.stacked ? ' g9-popup__button--stacked' : ''}${props.busy ? ' g9-popup__button--busy' : ''}`}\n style={{ backgroundColor: background }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={button.text}\n {...(button.testId ? { 'data-testid': button.testId } : {})}\n id={props.id}\n bindtap={press}\n >\n {button.icon || button.iconImage ? (\n <G9IconSlot icon={button.icon} image={button.iconImage ?? null} size={18} color={color} />\n ) : null}\n <text className=\"g9-popup__button-text\" style={{ color }}>\n {button.text}\n </text>\n </view>\n );\n}\n\n/** Header, body and footer of a queued popup (MAUI helper templates). */\nfunction PopupCardContent(props: {\n readonly entry: G9PopupEntry;\n readonly settings: G9PopupSettings;\n readonly profile: G9PopupVisualProfile;\n readonly state: State;\n}): ReactNode {\n const { entry, settings, profile, state } = props;\n const strings = useG9Strings();\n const d = entry.descriptor;\n const close = useG9Press(() => state.service.queue.closeActive(), { source: 'G9Popup', guardMs: 0 });\n const glyphs = useG9Settings().glyphs;\n const buttons = d.buttons;\n const stacked = settings.footerButtonLayout === 'stacked';\n const shown = stacked ? buttons : buttons.slice(0, g9PopupRowButtonLimit);\n const warned = useRef(false);\n if (!stacked && buttons.length > g9PopupRowButtonLimit && !warned.current) {\n warned.current = true;\n state.warn?.(\n `A row footer shows at most ${g9PopupRowButtonLimit} buttons; ${buttons.length - g9PopupRowButtonLimit} dropped.`,\n );\n }\n const title = d.title?.trim()\n ? d.title\n : strings.get(\n d.type === 'success'\n ? G9StringKey.Success\n : d.type === 'warning'\n ? G9StringKey.Warning\n : d.type === 'error'\n ? G9StringKey.Error\n : G9StringKey.Information,\n );\n const content = typeof d.content === 'function' ? (d.content as () => ReactNode)() : d.content;\n const direction = useG9Direction();\n const row = g9RowStyle(direction);\n return (\n <view className=\"g9-popup__content\">\n {settings.showHeader !== false ? (\n <view className=\"g9-popup__header\" style={row}>\n <view className=\"g9-popup__badge\" accessibility-label={profile.semanticIconDescription}>\n <view className=\"g9-popup__badge-tint\" style={{ backgroundColor: profile.iconColor }} />\n <G9IconSlot icon={profile.icon} size={17} color={profile.iconColor} />\n </view>\n <text\n className=\"g9-popup__title\"\n text-maxline=\"1\"\n style={{ color: profile.titleColor, ...g9TextStart(direction) }}\n >\n {title}\n </text>\n {settings.showCloseButton ? (\n <view\n className=\"g9-popup__close\"\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={strings.get(G9StringKey.Close)}\n bindtap={close}\n >\n <G9IconSlot icon={glyphs.clear} size={20} color=\"var(--g9-on-surface-variant)\" />\n </view>\n ) : null}\n </view>\n ) : null}\n {settings.showHeader !== false ? <view className=\"g9-popup__divider\" /> : null}\n {d.message ? (\n <text className=\"g9-popup__message\" style={{ color: profile.messageColor, ...g9TextStart(direction) }}>\n {d.message}\n </text>\n ) : null}\n {content !== null && content !== undefined ? <view className=\"g9-popup__body\">{content}</view> : null}\n {settings.showFooter !== false ? (\n <view className={`g9-popup__footer${stacked ? ' g9-popup__footer--stacked' : ''}`} style={stacked ? {} : row}>\n {shown.map((button, i) => (\n <PopupButtonView\n key={i}\n id={button.testId ? g9SafeId(button.testId) : `G9Popup_Button_${i}`}\n button={button}\n profile={profile}\n busy={entry.busy}\n stacked={stacked}\n onPress={() => void state.service.queue.press(entry.id, i)}\n />\n ))}\n {entry.busy ? <G9ActivityIndicator running size={18} /> : null}\n </view>\n ) : null}\n </view>\n );\n}\n\n/** The popup layer: the active popup's frame; motion phases from the queue phase. */\nfunction PopupLayer(props: { readonly state: State }): ReactNode {\n const { state } = props;\n const settingsAll = useG9Settings();\n const diagnostics = useG9Diagnostics();\n state.defaults = settingsAll.popups;\n const glyphs = settingsAll.glyphs;\n const strings = useG9Strings();\n state.strings = (k) => strings.get(k);\n state.warn = (message) => diagnostics.log({ level: 'warning', message, source: 'G9Popup' });\n state.report = (error) =>\n diagnostics.log({ level: 'error', message: 'A popup callback failed.', source: 'G9Popup', error });\n const win = useG9Window();\n const queue = state.service.queue;\n const entry = useSyncExternalStore(\n (l) => queue.subscribe(l),\n () => queue.getSnapshot(),\n );\n // `enter` for one frame per show, then `open` (the transition runs), `leave` while closing.\n const [entered, setEntered] = useState<string | null>(null);\n const showKey = entry ? `${entry.id}:${entry.showCount}` : null;\n useEffect(() => {\n if (!showKey) return;\n const t = startTimer(() => setEntered(showKey), 16);\n return () => stopTimer(t);\n }, [showKey]);\n const settings = entry ? resolvePopupSettings(entry.descriptor, state.defaults) : null;\n const duration = settings?.animationDuration ?? 240;\n useEffect(() => {\n if (!entry || entered !== showKey || entry.phase !== 'opening') return;\n const t = startTimer(() => queue.markOpened(entry.id), duration);\n return () => stopTimer(t);\n }, [entered, showKey, entry?.phase]);\n useEffect(() => () => queue.dispose(), [queue]);\n if (!entry || !settings) return null;\n const profile = createPopupVisualProfile(entry.descriptor, settings, glyphs, (k) =>\n strings.get(\n k === 'success'\n ? G9StringKey.Success\n : k === 'warning'\n ? G9StringKey.Warning\n : k === 'error'\n ? G9StringKey.Error\n : G9StringKey.Information,\n ),\n );\n const options: G9PopupViewOpenOptions = {\n width: profile.width,\n height: profile.height,\n cornerRadius: profile.cornerRadius,\n padding: profile.padding,\n autoSizeMode: settings.autoSizeMode ?? 'height',\n cardBackground: profile.cardBackground,\n borderColor: profile.borderColor,\n overlayMode: settings.overlayMode ?? 'transparent',\n blurIntensity: settings.blurIntensity ?? 'none',\n overlayColor: profile.overlayColor,\n overlayOpacity: profile.overlayOpacity,\n animation: profile.animation,\n animationEasing: settings.animationEasing ?? 'sinOut',\n animationDuration: duration,\n };\n const phase = entry.phase === 'closing' ? 'leave' : entered === showKey ? 'open' : 'enter';\n return (\n <PopupFrame\n key={showKey as string}\n options={options}\n phase={phase}\n hostWidth={win.width}\n onBackgroundTap={() => queue.backgroundTap(entry.id)}\n >\n <PopupCardContent entry={entry} settings={settings} profile={profile} state={state} />\n </PopupFrame>\n );\n}\n\nfunction createPopupService(host: G9HostHandle): State {\n const state = { defaults: {}, strings: fallbackStrings.get } as unknown as State;\n const strings = (k: G9StringKey) => state.strings(k);\n const queue = new G9PopupQueue({\n setTimer: (cb, ms) => startTimer(cb, ms),\n clearTimer: (h) => stopTimer(h as never),\n closeDurationMs: (d) =>\n resolvePopupSettings(d, state.defaults).animation === 'none'\n ? 0\n : (resolvePopupSettings(d, state.defaults).animationDuration ?? 240),\n autoCloseMs: (d) => resolvePopupSettings(d, state.defaults).autoCloseDuration ?? 0,\n closesOnBack: (d) => resolvePopupSettings(d, state.defaults).closeOnBackButton !== false,\n closesOnBackgroundTap: (d) => resolvePopupSettings(d, state.defaults).closeOnBackgroundClick === true,\n onError: (error) => state.report?.(error),\n });\n // A popup without buttons gets an OK button (MAUI presets).\n const withOk = (d: G9PopupDescriptor): G9PopupDescriptor =>\n d.buttons.length > 0 ? d : { ...d, buttons: [{ text: strings(G9StringKey.Ok), isPrimary: true }] };\n const preset =\n (type: G9PopupType) =>\n (\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ) =>\n queue.show(withOk(presetPopup(type, message, title, buttons, settings, animation ?? null))).then((o) => o.result);\n const service: G9PopupService = {\n queue,\n show: preset('information'),\n showSuccess: preset('success'),\n showWarning: preset('warning'),\n showError: preset('error'),\n showCustom: (content, title, buttons, settings, animation) =>\n queue.show(withOk(customPopup(content, title, buttons, settings, animation ?? null))).then((o) => o.result),\n showDescriptor: (descriptor) => queue.show(withOk(descriptor)),\n async showInput(options) {\n const store = createPopupFormStore(options.fields);\n let result = g9PopupInputResult.cancel();\n const cancel: G9PopupButton = {\n ...(options.cancelButton ?? { text: options.cancelButtonText ?? strings(G9StringKey.Cancel) }),\n isPrimary: false,\n callback: () => {\n result = g9PopupInputResult.cancel();\n return g9PopupResult.close();\n },\n };\n const submit: G9PopupButton = {\n ...(options.submitButton ?? { text: options.submitButtonText ?? strings(G9StringKey.Save) }),\n isPrimary: true,\n callback: () => {\n const v = store.validate({\n requiredSuffix: strings(G9StringKey.RequiredSuffix),\n invalidEmail: strings(G9StringKey.InvalidEmail),\n });\n result = v.valid\n ? g9PopupInputResult.submit(v.values, v.arrayValues)\n : g9PopupInputResult.validationFailed(v.values, v.arrayValues, v.errors);\n return v.valid ? g9PopupResult.close() : g9PopupResult.noAction();\n },\n };\n const settings: G9PopupSettings = {\n showHeader: true,\n showFooter: true,\n showCloseButton: false,\n closeOnBackgroundClick: false,\n autoSizeMode: 'height',\n padding: [20, 12, 20, 8],\n ...Object.fromEntries(Object.entries(options.settings ?? {}).filter(([, v]) => v !== undefined && v !== null)),\n };\n await queue.show({\n type: options.type ?? 'information',\n title: options.title ?? null,\n message: options.message ?? null,\n content: () => <PopupInputForm store={store} focusFirst={options.focusFirstFieldOnOpen !== false} />,\n buttons: [cancel, submit],\n settings,\n animation: options.animation ?? null,\n form: {\n fieldKeys: options.fields.map((f) => f.key),\n setText: (key, value) => store.setText(key, value),\n getText: (key) => store.getState().form.text[key] ?? null,\n },\n });\n return result;\n },\n async showConfirm(message, options = {}) {\n let ok = false;\n await queue.show(\n presetPopup(options.type ?? 'information', message, options.title ?? null, [\n {\n text: options.cancelText ?? strings(G9StringKey.Cancel),\n isPrimary: false,\n callback: async (c) => {\n await options.cancelCallback?.(c);\n return g9PopupResult.close();\n },\n },\n {\n text: options.okText ?? strings(G9StringKey.Ok),\n isPrimary: true,\n callback: async (c) => {\n await options.okCallback?.(c);\n ok = true;\n return g9PopupResult.close();\n },\n },\n ]),\n );\n return ok;\n },\n handleHardwareBack: () => queue.handleBack(),\n closeActive: () => queue.closeActive(),\n clearQueue: () => queue.clearQueue(),\n dismissAll: () => queue.dismissAll(),\n };\n state.service = service;\n host.attachFeature(FEATURE, state);\n host.registerLayerItem('popups', { key: FEATURE, element: <PopupLayer state={state} />, order: 0 });\n host.back.push(() => (queue.handleBack() ? 'handled' : 'pass'), { layer: 'popups' });\n return state;\n}\n\n/** The popup service of a host (created once as a host feature). */\nexport function popupServiceOf(host: G9HostHandle): G9PopupService {\n const existing = host.getFeature(FEATURE) as State | undefined;\n return (existing ?? createPopupService(host)).service;\n}\n\n/** The popups of the nearest `G9Host` (MAUI `G9PopupHelper`): one card at a time, FIFO, in the `popups` layer. */\nexport function useG9Popups(): G9PopupService {\n return popupServiceOf(useG9Host());\n}\n\n/** The popups of the active host, for code outside components. Throws `host-missing` without a host. */\nexport function g9Popups(): G9PopupService {\n return popupServiceOf(g9Hosts.require());\n}\n\n/**\n * The default error presenter (installed when this module loads): the executor's error popup as an error-type popup\n * on the active host, with More details when diagnostics are available. Without a host it does nothing.\n */\nexport function presentErrorPopup(request: G9ErrorPopupRequest): Promise<void> | undefined {\n const host = g9Hosts.active();\n if (!host) return undefined;\n const popups = popupServiceOf(host);\n const buttons: G9PopupButton[] = [];\n if (request.moreDetails) {\n const more = request.moreDetails;\n buttons.push({ text: more.text, isPrimary: false, callback: async () => void (await more.open()) });\n }\n buttons.push({ text: request.okText, isPrimary: true });\n return popups.showError(request.message, request.title, buttons).then(() => undefined);\n}\n\ng9DefaultErrorPresenter.current = presentErrorPopup;\n"],"names":["g9PopupRowButtonLimit","FEATURE","fallbackStrings","createStrings","createCulture","PopupButtonView","props","_button_backgroundColor","_button_textColor","_button_iconImage","button","profile","primary","press","useG9Press","background","color","view","G9IconSlot","text","PopupCardContent","_d_title","entry","settings","state","strings","useG9Strings","d","close","glyphs","useG9Settings","buttons","stacked","shown","warned","useRef","title","G9StringKey","content","direction","useG9Direction","row","g9RowStyle","g9TextStart","i","g9SafeId","G9ActivityIndicator","PopupLayer","_settings_autoSizeMode","_settings_overlayMode","_settings_blurIntensity","_settings_animationEasing","settingsAll","diagnostics","useG9Diagnostics","k","message","error","win","useG9Window","queue","useSyncExternalStore","l","entered","setEntered","useState","showKey","useEffect","t","startTimer","stopTimer","resolvePopupSettings","duration","createPopupVisualProfile","options","phase","PopupFrame","createPopupService","host","G9PopupQueue","cb","ms","h","_resolvePopupSettings_animationDuration","_resolvePopupSettings_autoCloseDuration","withOk","preset","type","animation","presetPopup","o","service","customPopup","descriptor","_options_cancelButton","_options_cancelButtonText","_options_submitButton","_options_submitButtonText","_options_settings","_options_type","_options_title","_options_message","_options_animation","store","createPopupFormStore","result","g9PopupInputResult","cancel","g9PopupResult","submit","v","Object","PopupInputForm","f","key","value","_store_getState_form_text_key","_options_cancelText","_options_okText","ok","c","popupServiceOf","existing","useG9Popups","useG9Host","g9Popups","g9Hosts","presentErrorPopup","request","popups","more","undefined","g9DefaultErrorPresenter"],"mappings":";;;;;;;;;;;;;;;;;AAgCO,MAAMA,wBAAwB;AAqErC,MAAMC,UAAU;AAWhB,MAAMC,kBAAkBC,cAAc;IAAE,SAASC,cAAc;AAAM;AAErE,SAASC,gBAAgBC,KAQxB;QAIoBC,yBACLC,mBAa8BC;IAjB5C,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGL;IAC5B,MAAMM,UAAUF,AAAqB,UAArBA,OAAO,SAAS;IAChC,MAAMG,QAAQC,WAAWR,MAAM,OAAO,EAAE;QAAE,QAAQ;QAAW,SAAS;IAAE;IACxE,MAAMS,aAAa,QAAAR,CAAAA,0BAAAA,OAAO,eAAe,AAAD,IAArBA,0BAA2BK,UAAUD,QAAQ,gBAAgB,GAAG;IACnF,MAAMK,QAAQ,QAAAR,CAAAA,oBAAAA,OAAO,SAAS,AAAD,IAAfA,oBAAqBI,UA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AE,KAAK7E;QAAS,UAAU8C,WAAW,OAAOvB;QAAW,OAAO;IAAE;IACjGsD,KAAK,IAAI,CAAC,IAAI,CAAC,IAAOlB,MAAM,UAAU,KAAK,YAAY,QAAS;QAAE,OAAO;IAAS;IAClF,OAAOpC;AACT;AAGO,SAASiG,eAAe3C,IAAkB;IAC/C,MAAM4C,WAAW5C,KAAK,UAAU,CAAC7E;IACjC,OAAO,AAACyH,CAAAA,QAAAA,WAAAA,WAAY7C,mBAAmBC,KAAI,EAAG,OAAO;AACvD;AAGO,SAAS6C;IACd,OAAOF,eAAeG;AACxB;AAGO,SAASC;IACd,OAAOJ,eAAeK,QAAQ,OAAO;AACvC;AAMO,SAASC,kBAAkBC,OAA4B;IAC5D,MAAMlD,OAAOgD,QAAQ,MAAM;IAC3B,IAAI,CAAChD,MAAM;IACX,MAAMmD,SAASR,eAAe3C;IAC9B,MAAM/C,UAA2B,EAAE;IACnC,IAAIiG,QAAQ,WAAW,EAAE;QACvB,MAAME,OAAOF,QAAQ,WAAW;QAChCjG,QAAQ,IAAI,CAAC;YAAE,MAAMmG,KAAK,IAAI;YAAE,WAAW;YAAO,UAAU,UAAY,KAAM,MAAMA,KAAK,IAAI;QAAI;IACnG;IACAnG,QAAQ,IAAI,CAAC;QAAE,MAAMiG,QAAQ,MAAM;QAAE,WAAW;IAAK;IACrD,OAAOC,OAAO,SAAS,CAACD,QAAQ,OAAO,EAAEA,QAAQ,KAAK,EAAEjG,SAAS,IAAI,CAAC,IAAMoG;AAC9E;AAEAC,wBAAwB,OAAO,GAAGL"}
1
+ {"version":3,"file":"popup/service.jsx","sources":["../../src/popup/service.tsx"],"sourcesContent":["import './popup.css';\nimport {\n createCulture,\n createStrings,\n type G9ErrorPopupRequest,\n G9StringKey,\n g9Ms,\n} from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { g9RowStyle, g9SafeId, g9TextStart } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport { startTimer, stopTimer } from '../base/timers';\nimport { G9ActivityIndicator } from '../display/activity-indicator';\nimport { useG9Host } from '../host/hooks';\nimport { type G9HostHandle, g9Hosts } from '../host/registry';\nimport { G9IconSlot } from '../icon/slot';\nimport { useG9Diagnostics, useG9Direction, useG9Settings, useG9Strings, useG9Window } from '../provider/hooks';\nimport { g9DefaultErrorPresenter } from '../provider/settings';\nimport { type G9PopupViewOpenOptions, PopupFrame } from './frame';\nimport { type G9PopupInputOptions, type G9PopupInputResult, g9PopupInputResult } from './input';\nimport { createPopupFormStore, PopupInputForm } from './input-form';\nimport { type G9PopupEntry, type G9PopupOutcome, G9PopupQueue } from './queue';\nimport {\n createPopupVisualProfile,\n customPopup,\n type G9PopupAnimationType,\n type G9PopupButton,\n type G9PopupDescriptor,\n type G9PopupResult,\n type G9PopupSettings,\n type G9PopupType,\n type G9PopupVisualProfile,\n g9PopupResult,\n presetPopup,\n resolvePopupSettings,\n} from './types';\n\n/** Most buttons a `row` footer shows (MAUI); more are dropped with a warning. */\nexport const g9PopupRowButtonLimit = 3;\n\n/** Options of `showConfirm` (MAUI `ShowConfirmAsync`). */\nexport interface G9ConfirmOptions {\n readonly title?: string | null;\n readonly okCallback?: ((context: { readonly aborted: boolean }) => unknown) | null;\n readonly cancelCallback?: ((context: { readonly aborted: boolean }) => unknown) | null;\n /** Default `'information'`; `'warning'` for a lossy confirm (sign out, discard). */\n readonly type?: G9PopupType;\n readonly okText?: string;\n readonly cancelText?: string;\n}\n\n/** The popups of a host (MAUI `G9PopupHelper`). */\nexport interface G9PopupService {\n /** Information popup (MAUI `ShowG9PopupAsync`); resolves the result of the button that closed it. */\n show(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n showSuccess(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n showWarning(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n showError(\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n /** Any content in the body (MAUI `ShowCustomG9PopupAsync`). */\n showCustom(\n content: ReactNode | (() => ReactNode),\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ): Promise<G9PopupResult>;\n /** Any descriptor; resolves how it ended. */\n showDescriptor(descriptor: G9PopupDescriptor): Promise<G9PopupOutcome>;\n /** A validated form (MAUI `ShowInputG9PopupAsync`). */\n showInput(options: G9PopupInputOptions): Promise<G9PopupInputResult>;\n /** OK/Cancel: `true` only for OK; every other exit is `false` (MAUI `ShowConfirmAsync`). */\n showConfirm(message: string, options?: G9ConfirmOptions): Promise<boolean>;\n /** Hardware back: `true` when a popup is on screen (closed unless `closeOnBackButton: false`). */\n handleHardwareBack(): boolean;\n /** Closes the popup on screen. */\n closeActive(): void;\n /** Drops waiting popups; the one on screen stays. */\n clearQueue(): void;\n /** Closes everything. */\n dismissAll(): void;\n readonly queue: G9PopupQueue;\n}\n\nconst FEATURE = 'g9.popups';\n\ninterface State {\n service: G9PopupService;\n defaults: G9PopupSettings;\n /** Strings and diagnostics of the provider; refreshed by the layer on every render. */\n strings: (key: G9StringKey) => string;\n warn?: (message: string) => void;\n report?: (error: unknown) => void;\n}\n\nconst fallbackStrings = createStrings({ culture: createCulture('en') });\n\nfunction PopupButtonView(props: {\n readonly button: G9PopupButton;\n /** Element id: the button's `testId` made selector-safe, else `G9Popup_Button_<index>`. */\n readonly id: string;\n readonly profile: G9PopupVisualProfile;\n readonly busy: boolean;\n readonly stacked: boolean;\n readonly onPress: () => void;\n}): ReactNode {\n const { button, profile } = props;\n const primary = button.isPrimary !== false;\n const press = useG9Press(props.onPress, { source: 'G9Popup', guardMs: 0 });\n const background = button.backgroundColor ?? (primary ? profile.buttonBackground : 'transparent');\n const color = button.textColor ?? (primary ? profile.buttonTextColor : 'var(--g9-on-surface)');\n return (\n <view\n className={`g9-popup__button${primary ? ' g9-popup__button--primary' : ' g9-popup__button--outline'}${props.stacked ? ' g9-popup__button--stacked' : ''}${props.busy ? ' g9-popup__button--busy' : ''}`}\n style={{ backgroundColor: background }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={button.text}\n {...(button.testId ? { 'data-testid': button.testId } : {})}\n id={props.id}\n bindtap={press}\n >\n {button.icon || button.iconImage ? (\n <G9IconSlot icon={button.icon} image={button.iconImage ?? null} size={18} color={color} />\n ) : null}\n <text className=\"g9-popup__button-text\" style={{ color }}>\n {button.text}\n </text>\n </view>\n );\n}\n\n/** Header, body and footer of a queued popup (MAUI helper templates). */\nfunction PopupCardContent(props: {\n readonly entry: G9PopupEntry;\n readonly settings: G9PopupSettings;\n readonly profile: G9PopupVisualProfile;\n readonly state: State;\n}): ReactNode {\n const { entry, settings, profile, state } = props;\n const strings = useG9Strings();\n const d = entry.descriptor;\n const close = useG9Press(() => state.service.queue.closeActive(), { source: 'G9Popup', guardMs: 0 });\n const glyphs = useG9Settings().glyphs;\n const buttons = d.buttons;\n const stacked = settings.footerButtonLayout === 'stacked';\n const shown = stacked ? buttons : buttons.slice(0, g9PopupRowButtonLimit);\n const warned = useRef(false);\n if (!stacked && buttons.length > g9PopupRowButtonLimit && !warned.current) {\n warned.current = true;\n state.warn?.(\n `A row footer shows at most ${g9PopupRowButtonLimit} buttons; ${buttons.length - g9PopupRowButtonLimit} dropped.`,\n );\n }\n const title = d.title?.trim()\n ? d.title\n : strings.get(\n d.type === 'success'\n ? G9StringKey.Success\n : d.type === 'warning'\n ? G9StringKey.Warning\n : d.type === 'error'\n ? G9StringKey.Error\n : G9StringKey.Information,\n );\n const content = typeof d.content === 'function' ? (d.content as () => ReactNode)() : d.content;\n const direction = useG9Direction();\n const row = g9RowStyle(direction);\n return (\n <view className=\"g9-popup__content\">\n {settings.showHeader !== false ? (\n <view className=\"g9-popup__header\" style={row}>\n <view className=\"g9-popup__badge\" accessibility-label={profile.semanticIconDescription}>\n <view className=\"g9-popup__badge-tint\" style={{ backgroundColor: profile.iconColor }} />\n <G9IconSlot icon={profile.icon} size={17} color={profile.iconColor} />\n </view>\n <text\n className=\"g9-popup__title\"\n text-maxline=\"1\"\n style={{ color: profile.titleColor, ...g9TextStart(direction) }}\n >\n {title}\n </text>\n {settings.showCloseButton ? (\n <view\n className=\"g9-popup__close\"\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={strings.get(G9StringKey.Close)}\n bindtap={close}\n >\n <G9IconSlot icon={glyphs.clear} size={20} color=\"var(--g9-on-surface-variant)\" />\n </view>\n ) : null}\n </view>\n ) : null}\n {settings.showHeader !== false ? <view className=\"g9-popup__divider\" /> : null}\n {d.message ? (\n <text className=\"g9-popup__message\" style={{ color: profile.messageColor, ...g9TextStart(direction) }}>\n {d.message}\n </text>\n ) : null}\n {content !== null && content !== undefined ? <view className=\"g9-popup__body\">{content}</view> : null}\n {settings.showFooter !== false ? (\n <view className={`g9-popup__footer${stacked ? ' g9-popup__footer--stacked' : ''}`} style={stacked ? {} : row}>\n {shown.map((button, i) => (\n <PopupButtonView\n key={i}\n id={button.testId ? g9SafeId(button.testId) : `G9Popup_Button_${i}`}\n button={button}\n profile={profile}\n busy={entry.busy}\n stacked={stacked}\n onPress={() => void state.service.queue.press(entry.id, i)}\n />\n ))}\n {entry.busy ? <G9ActivityIndicator running size={18} /> : null}\n </view>\n ) : null}\n </view>\n );\n}\n\n/** The popup layer: the active popup's frame; motion phases from the queue phase. */\nfunction PopupLayer(props: { readonly state: State }): ReactNode {\n const { state } = props;\n const settingsAll = useG9Settings();\n const diagnostics = useG9Diagnostics();\n state.defaults = settingsAll.popups;\n const glyphs = settingsAll.glyphs;\n const strings = useG9Strings();\n state.strings = (k) => strings.get(k);\n state.warn = (message) => diagnostics.log({ level: 'warning', message, source: 'G9Popup' });\n state.report = (error) =>\n diagnostics.log({ level: 'error', message: 'A popup callback failed.', source: 'G9Popup', error });\n const win = useG9Window();\n const queue = state.service.queue;\n const entry = useSyncExternalStore(\n (l) => queue.subscribe(l),\n () => queue.getSnapshot(),\n );\n // `enter` for one frame per show, then `open` (the transition runs), `leave` while closing.\n const [entered, setEntered] = useState<string | null>(null);\n const showKey = entry ? `${entry.id}:${entry.showCount}` : null;\n useEffect(() => {\n if (!showKey) return;\n const t = startTimer(() => setEntered(showKey), 16);\n return () => stopTimer(t);\n }, [showKey]);\n const settings = entry ? resolvePopupSettings(entry.descriptor, state.defaults) : null;\n const duration = settings?.animationDuration ?? 240;\n useEffect(() => {\n if (!entry || entered !== showKey || entry.phase !== 'opening') return;\n const t = startTimer(() => queue.markOpened(entry.id), duration);\n return () => stopTimer(t);\n }, [entered, showKey, entry?.phase]);\n useEffect(() => () => queue.dispose(), [queue]);\n if (!entry || !settings) return null;\n const profile = createPopupVisualProfile(entry.descriptor, settings, glyphs, (k) =>\n strings.get(\n k === 'success'\n ? G9StringKey.Success\n : k === 'warning'\n ? G9StringKey.Warning\n : k === 'error'\n ? G9StringKey.Error\n : G9StringKey.Information,\n ),\n );\n const options: G9PopupViewOpenOptions = {\n width: profile.width,\n height: profile.height,\n cornerRadius: profile.cornerRadius,\n padding: profile.padding,\n autoSizeMode: settings.autoSizeMode ?? 'height',\n cardBackground: profile.cardBackground,\n borderColor: profile.borderColor,\n overlayMode: settings.overlayMode ?? 'transparent',\n blurIntensity: settings.blurIntensity ?? 'none',\n overlayColor: profile.overlayColor,\n overlayOpacity: profile.overlayOpacity,\n animation: profile.animation,\n animationEasing: settings.animationEasing ?? 'sinOut',\n animationDuration: duration,\n };\n const phase = entry.phase === 'closing' ? 'leave' : entered === showKey ? 'open' : 'enter';\n return (\n <PopupFrame\n key={showKey as string}\n options={options}\n phase={phase}\n hostWidth={win.width}\n onBackgroundTap={() => queue.backgroundTap(entry.id)}\n >\n <PopupCardContent entry={entry} settings={settings} profile={profile} state={state} />\n </PopupFrame>\n );\n}\n\nfunction createPopupService(host: G9HostHandle): State {\n const state = { defaults: {}, strings: fallbackStrings.get } as unknown as State;\n const strings = (k: G9StringKey) => state.strings(k);\n const queue = new G9PopupQueue({\n setTimer: (cb, ms) => startTimer(cb, ms),\n clearTimer: (h) => stopTimer(h as never),\n closeDurationMs: (d) =>\n resolvePopupSettings(d, state.defaults).animation === 'none'\n ? 0\n : g9Ms(resolvePopupSettings(d, state.defaults).animationDuration ?? 240),\n autoCloseMs: (d) => resolvePopupSettings(d, state.defaults).autoCloseDuration ?? 0,\n closesOnBack: (d) => resolvePopupSettings(d, state.defaults).closeOnBackButton !== false,\n closesOnBackgroundTap: (d) => resolvePopupSettings(d, state.defaults).closeOnBackgroundClick === true,\n onError: (error) => state.report?.(error),\n });\n // A popup without buttons gets an OK button (MAUI presets).\n const withOk = (d: G9PopupDescriptor): G9PopupDescriptor =>\n d.buttons.length > 0 ? d : { ...d, buttons: [{ text: strings(G9StringKey.Ok), isPrimary: true }] };\n const preset =\n (type: G9PopupType) =>\n (\n message: string,\n title?: string | null,\n buttons?: ReadonlyArray<G9PopupButton> | null,\n settings?: G9PopupSettings | null,\n animation?: G9PopupAnimationType | null,\n ) =>\n queue.show(withOk(presetPopup(type, message, title, buttons, settings, animation ?? null))).then((o) => o.result);\n const service: G9PopupService = {\n queue,\n show: preset('information'),\n showSuccess: preset('success'),\n showWarning: preset('warning'),\n showError: preset('error'),\n showCustom: (content, title, buttons, settings, animation) =>\n queue.show(withOk(customPopup(content, title, buttons, settings, animation ?? null))).then((o) => o.result),\n showDescriptor: (descriptor) => queue.show(withOk(descriptor)),\n async showInput(options) {\n const store = createPopupFormStore(options.fields);\n let result = g9PopupInputResult.cancel();\n const cancel: G9PopupButton = {\n ...(options.cancelButton ?? { text: options.cancelButtonText ?? strings(G9StringKey.Cancel) }),\n isPrimary: false,\n callback: () => {\n result = g9PopupInputResult.cancel();\n return g9PopupResult.close();\n },\n };\n const submit: G9PopupButton = {\n ...(options.submitButton ?? { text: options.submitButtonText ?? strings(G9StringKey.Save) }),\n isPrimary: true,\n callback: () => {\n const v = store.validate({\n requiredSuffix: strings(G9StringKey.RequiredSuffix),\n invalidEmail: strings(G9StringKey.InvalidEmail),\n });\n result = v.valid\n ? g9PopupInputResult.submit(v.values, v.arrayValues)\n : g9PopupInputResult.validationFailed(v.values, v.arrayValues, v.errors);\n return v.valid ? g9PopupResult.close() : g9PopupResult.noAction();\n },\n };\n const settings: G9PopupSettings = {\n showHeader: true,\n showFooter: true,\n showCloseButton: false,\n closeOnBackgroundClick: false,\n autoSizeMode: 'height',\n padding: [20, 12, 20, 8],\n ...Object.fromEntries(Object.entries(options.settings ?? {}).filter(([, v]) => v !== undefined && v !== null)),\n };\n await queue.show({\n type: options.type ?? 'information',\n title: options.title ?? null,\n message: options.message ?? null,\n content: () => <PopupInputForm store={store} focusFirst={options.focusFirstFieldOnOpen !== false} />,\n buttons: [cancel, submit],\n settings,\n animation: options.animation ?? null,\n form: {\n fieldKeys: options.fields.map((f) => f.key),\n setText: (key, value) => store.setText(key, value),\n getText: (key) => store.getState().form.text[key] ?? null,\n },\n });\n return result;\n },\n async showConfirm(message, options = {}) {\n let ok = false;\n await queue.show(\n presetPopup(options.type ?? 'information', message, options.title ?? null, [\n {\n text: options.cancelText ?? strings(G9StringKey.Cancel),\n isPrimary: false,\n callback: async (c) => {\n await options.cancelCallback?.(c);\n return g9PopupResult.close();\n },\n },\n {\n text: options.okText ?? strings(G9StringKey.Ok),\n isPrimary: true,\n callback: async (c) => {\n await options.okCallback?.(c);\n ok = true;\n return g9PopupResult.close();\n },\n },\n ]),\n );\n return ok;\n },\n handleHardwareBack: () => queue.handleBack(),\n closeActive: () => queue.closeActive(),\n clearQueue: () => queue.clearQueue(),\n dismissAll: () => queue.dismissAll(),\n };\n state.service = service;\n host.attachFeature(FEATURE, state);\n host.registerLayerItem('popups', { key: FEATURE, element: <PopupLayer state={state} />, order: 0 });\n host.back.push(() => (queue.handleBack() ? 'handled' : 'pass'), { layer: 'popups' });\n return state;\n}\n\n/** The popup service of a host (created once as a host feature). */\nexport function popupServiceOf(host: G9HostHandle): G9PopupService {\n const existing = host.getFeature(FEATURE) as State | undefined;\n return (existing ?? createPopupService(host)).service;\n}\n\n/** The popups of the nearest `G9Host` (MAUI `G9PopupHelper`): one card at a time, FIFO, in the `popups` layer. */\nexport function useG9Popups(): G9PopupService {\n return popupServiceOf(useG9Host());\n}\n\n/** The popups of the active host, for code outside components. Throws `host-missing` without a host. */\nexport function g9Popups(): G9PopupService {\n return popupServiceOf(g9Hosts.require());\n}\n\n/**\n * The default error presenter (installed when this module loads): the executor's error popup as an error-type popup\n * on the active host, with More details when diagnostics are available. Without a host it does nothing.\n */\nexport function presentErrorPopup(request: G9ErrorPopupRequest): Promise<void> | undefined {\n const host = g9Hosts.active();\n if (!host) return undefined;\n const popups = popupServiceOf(host);\n const buttons: G9PopupButton[] = [];\n if (request.moreDetails) {\n const more = request.moreDetails;\n buttons.push({ text: more.text, isPrimary: false, callback: async () => void (await more.open()) });\n }\n buttons.push({ text: request.okText, isPrimary: true });\n return popups.showError(request.message, request.title, buttons).then(() => undefined);\n}\n\ng9DefaultErrorPresenter.current = presentErrorPopup;\n"],"names":["g9PopupRowButtonLimit","FEATURE","fallbackStrings","createStrings","createCulture","PopupButtonView","props","_button_backgroundColor","_button_textColor","_button_iconImage","button","profile","primary","press","useG9Press","background","color","view","G9IconSlot","text","PopupCardContent","_d_title","entry","settings","state","strings","useG9Strings","d","close","glyphs","useG9Settings","buttons","stacked","shown","warned","useRef","title","G9StringKey","content","direction","useG9Direction","row","g9RowStyle","g9TextStart","i","g9SafeId","G9ActivityIndicator","PopupLayer","_settings_autoSizeMode","_settings_overlayMode","_settings_blurIntensity","_settings_animationEasing","settingsAll","diagnostics","useG9Diagnostics","k","message","error","win","useG9Window","queue","useSyncExternalStore","l","entered","setEntered","useState","showKey","useEffect","t","startTimer","stopTimer","resolvePopupSettings","duration","createPopupVisualProfile","options","phase","PopupFrame","createPopupService","host","G9PopupQueue","cb","ms","h","_resolvePopupSettings_animationDuration","g9Ms","_resolvePopupSettings_autoCloseDuration","withOk","preset","type","animation","presetPopup","o","service","customPopup","descriptor","_options_cancelButton","_options_cancelButtonText","_options_submitButton","_options_submitButtonText","_options_settings","_options_type","_options_title","_options_message","_options_animation","store","createPopupFormStore","result","g9PopupInputResult","cancel","g9PopupResult","submit","v","Object","PopupInputForm","f","key","value","_store_getState_form_text_key","_options_cancelText","_options_okText","ok","c","popupServiceOf","existing","useG9Popups","useG9Host","g9Popups","g9Hosts","presentErrorPopup","request","popups","more","undefined","g9DefaultErrorPresenter"],"mappings":";;;;;;;;;;;;;;;;;AAsCO,MAAMA,wBAAwB;AAqErC,MAAMC,UAAU;AAWhB,MAAMC,kBAAkBC,cAAc;IAAE,SAASC,cAAc;AAAM;AAErE,SAASC,gBAAgBC,KAQxB;QAIoBC,yBACLC,mBAa8BC;IAjB5C,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGL;IAC5B,MAAMM,UAAUF,AAAqB,UAArBA,OAAO,SAAS;IAChC,MAAMG,QAAQC,WAAWR,MAAM,OAAO,EAAE;QAAE,QAAQ;QAAW,SAAS;IAAE;IACxE,MAAMS,aAAa,QAAAR,CAAAA,0BAAAA,OAAO,eAAe,AAAD,IAArBA,0BAA2BK,UAAUD,QAAQ,gBAAgB,GAAG;IACnF,MAAMK,QAAQ,QAAAR,CAAAA,oBAAAA,OAAO,SAAS,AAAD,IAAfA,oBAAqBI,UAAUD,QAAQ,eAAe,GAAG;IACvE,QACGM,KACC,WAAW,CAAC,gBAAgB,EAAEL,UAAU,+BAA+B,+BAA+BN,MAAM,OAAO,GAAG,+BAA+B,K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OlB,MAAM,UAAU,KAAK,YAAY,QAAS;QAAE,OAAO;IAAS;IAClF,OAAOpC;AACT;AAGO,SAASkG,eAAe5C,IAAkB;IAC/C,MAAM6C,WAAW7C,KAAK,UAAU,CAAC7E;IACjC,OAAO,AAAC0H,CAAAA,QAAAA,WAAAA,WAAY9C,mBAAmBC,KAAI,EAAG,OAAO;AACvD;AAGO,SAAS8C;IACd,OAAOF,eAAeG;AACxB;AAGO,SAASC;IACd,OAAOJ,eAAeK,QAAQ,OAAO;AACvC;AAMO,SAASC,kBAAkBC,OAA4B;IAC5D,MAAMnD,OAAOiD,QAAQ,MAAM;IAC3B,IAAI,CAACjD,MAAM;IACX,MAAMoD,SAASR,eAAe5C;IAC9B,MAAM/C,UAA2B,EAAE;IACnC,IAAIkG,QAAQ,WAAW,EAAE;QACvB,MAAME,OAAOF,QAAQ,WAAW;QAChClG,QAAQ,IAAI,CAAC;YAAE,MAAMoG,KAAK,IAAI;YAAE,WAAW;YAAO,UAAU,UAAY,KAAM,MAAMA,KAAK,IAAI;QAAI;IACnG;IACApG,QAAQ,IAAI,CAAC;QAAE,MAAMkG,QAAQ,MAAM;QAAE,WAAW;IAAK;IACrD,OAAOC,OAAO,SAAS,CAACD,QAAQ,OAAO,EAAEA,QAAQ,KAAK,EAAElG,SAAS,IAAI,CAAC,IAAMqG;AAC9E;AAEAC,wBAAwB,OAAO,GAAGL"}
@@ -14,5 +14,9 @@
14
14
  direction: rtl;
15
15
  }
16
16
 
17
+ .g9-motion-off .g9-deferred__cover, .g9-motion-off .g9-progress__fill, .g9-motion-off .g9-expander__chevron, .g9-motion-off .g9-expander__clip, .g9-motion-off .g9-field__label, .g9-motion-off .g9-page-loading, .g9-motion-off .g9-toast__fill, .g9-motion-off .g9-switch__track, .g9-motion-off .g9-switch__thumb, .g9-motion-off .g9-chip, .g9-motion-off .g9-chip__check {
18
+ transition-duration: 0s;
19
+ }
20
+
17
21
 
18
22
  /*# sourceMappingURL=provider.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://./src/provider/provider.css"],"names":[],"mappings":"AACA;EAAE,sBAAsB;EACtB,OAAO;EACP,WAAW;EACX,YAAY;EACZ,aAAa;AACf;;AAIA;EADE,cAAc;AAChB;;AAIA;EADE,cAAc;AAChB","sourcesContent":["/* G9Provider root: fills the LynxView and carries the theme variables (set inline / with setProperty). */\n.g9-provider {\n display: flex;\n flex-direction: column;\n flex: 1;\n width: 100%;\n height: 100%;\n}\n\n/* direction does not inherit in Lynx (plan/specs/02 §2): every G9 root sets it; these are the provider's. */\n.g9-dir-ltr {\n direction: ltr;\n}\n\n.g9-dir-rtl {\n direction: rtl;\n}\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack://./src/provider/provider.css"],"names":[],"mappings":"AACA;EAAE,sBAAsB;EACtB,OAAO;EACP,WAAW;EACX,YAAY;EACZ,aAAa;AACf;;AAIA;EADE,cAAc;AAChB;;AAIA;EADE,cAAc;AAChB;;AAOA;EAJE,uBAAuB;AACzB","sourcesContent":["/* G9Provider root: fills the LynxView and carries the theme variables (set inline / with setProperty). */\n.g9-provider {\n display: flex;\n flex-direction: column;\n flex: 1;\n width: 100%;\n height: 100%;\n}\n\n/* direction does not inherit in Lynx (plan/specs/02 §2): every G9 root sets it; these are the provider's. */\n.g9-dir-ltr {\n direction: ltr;\n}\n\n.g9-dir-rtl {\n direction: rtl;\n}\n\n/* Reduced motion (setG9MotionScale(0), the provider's `g9-motion-off`): every CSS transition of the kit ends at once, as\n the JS-timed motion does. Listed one by one (no universal selector); a new transition in a component belongs here too\n (provider-motion.test.ts checks); another package lists its own in its own stylesheet (progress-overlay.css). The infinite spinners keep turning: they say «busy», they move nothing a test waits for. */\n.g9-motion-off .g9-deferred__cover,\n.g9-motion-off .g9-progress__fill,\n.g9-motion-off .g9-expander__chevron,\n.g9-motion-off .g9-expander__clip,\n.g9-motion-off .g9-field__label,\n.g9-motion-off .g9-page-loading,\n.g9-motion-off .g9-toast__fill,\n.g9-motion-off .g9-switch__track,\n.g9-motion-off .g9-switch__thumb,\n.g9-motion-off .g9-chip,\n.g9-motion-off .g9-chip__check {\n transition-duration: 0ms;\n}\n"],"sourceRoot":""}
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAGlB,KAAK,cAAc,EACnB,KAAK,YAAY,EAIlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAA8D,MAAM,gBAAgB,CAAC;AAgB5G,OAAO,EAAE,KAAK,UAAU,EAA4C,MAAM,YAAY,CAAC;AAEvF,OAAO,gBAAgB,CAAC;AACxB,OAAO,aAAa,CAAC;AAErB,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC;IAC/C,kHAAkH;IAClH,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AA6BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CA8N5D"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAGlB,KAAK,cAAc,EACnB,KAAK,YAAY,EAMlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,SAAS,EAA8D,MAAM,gBAAgB,CAAC;AAgB5G,OAAO,EAAE,KAAK,UAAU,EAA4C,MAAM,YAAY,CAAC;AAEvF,OAAO,gBAAgB,CAAC;AACxB,OAAO,aAAa,CAAC;AAErB,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC;IAC/C,kHAAkH;IAClH,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AA6BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAmO5D"}
@@ -1,4 +1,4 @@
1
- import { assertRequiredCapabilities, createCultureStore, createDiagnostics, createIconFontRegistry, createPreferences, createSafeExecutor, createStrings, createThemeStore, toCssVariables, toLayoutCssVariables, toMetricCssVariables } from "@g9tm/lynxcontrols-foundation";
1
+ import { assertRequiredCapabilities, createCultureStore, createDiagnostics, createIconFontRegistry, createPreferences, createSafeExecutor, createStrings, createThemeStore, g9MotionScale, subscribeG9Motion, toCssVariables, toLayoutCssVariables, toMetricCssVariables } from "@g9tm/lynxcontrols-foundation";
2
2
  import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "@lynx-js/react";
3
3
  import { useStableCallback } from "../base/use-stable-callback.jsx";
4
4
  import { g9Hosts } from "../host/registry.jsx";
@@ -265,6 +265,8 @@ function G9Provider(props) {
265
265
  settings.backEventName,
266
266
  onBack
267
267
  ]);
268
+ const [motionOff, setMotionOff] = useState(()=>0 === g9MotionScale());
269
+ useEffect(()=>subscribeG9Motion((s)=>setMotionOff(0 === s)), []);
268
270
  const rootStyle = null != fallbackVariables ? fallbackVariables : initialVariables;
269
271
  const directionClass = 'rtl' === culture.direction ? 'g9-dir-rtl' : 'g9-dir-ltr';
270
272
  return <G9CoreContext.Provider value={core}>
@@ -274,7 +276,7 @@ function G9Provider(props) {
274
276
  <G9KeyboardContext.Provider value={keyboard}>
275
277
  <G9WindowContext.Provider value={windowState}>
276
278
  <G9InsetsContext.Provider value={insets}>
277
- <view id={rootId} className={`g9-provider g9-theme-${initialScheme} ${directionClass}${props.className ? ` ${props.className}` : ''}`} style={rootStyle}>
279
+ <view id={rootId} className={`g9-provider g9-theme-${initialScheme} ${directionClass}${motionOff ? ' g9-motion-off' : ''}${props.className ? ` ${props.className}` : ''}`} style={rootStyle}>
278
280
  {props.children}
279
281
  </view>
280
282
  </G9InsetsContext.Provider>
@@ -1 +1 @@
1
- {"version":3,"file":"provider/provider.jsx","sources":["../../src/provider/provider.tsx"],"sourcesContent":["import {\n assertRequiredCapabilities,\n createCultureStore,\n createDiagnostics,\n createIconFontRegistry,\n createPreferences,\n createSafeExecutor,\n createStrings,\n createThemeStore,\n type G9Capabilities,\n type G9ColorScheme,\n type G9CssVariables,\n type G9Culture,\n type G9CultureStore,\n type G9Diagnostics,\n type G9SafeInsets,\n type G9ThemeMode,\n type G9ThemeOptions,\n type G9ThemeStore,\n toCssVariables,\n toLayoutCssVariables,\n toMetricCssVariables,\n} from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useMemo, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { useStableCallback } from '../base/use-stable-callback';\nimport { g9Hosts } from '../host/registry';\nimport {\n G9CoreContext,\n G9CultureContext,\n G9DiagnosticsContext,\n G9InsetsContext,\n G9KeyboardContext,\n type G9KeyboardState,\n type G9ProviderCore,\n G9SettingsContext,\n G9WindowContext,\n type G9WindowState,\n} from './contexts';\nimport { addGlobalListener } from './global-events';\nimport { type G9Settings, g9DefaultErrorPresenter, resolveSettings } from './settings';\nimport { applyThemeVariables, changedVariables } from './theme-root';\nimport './provider.css';\nimport './theme.css';\n\n/** Props of {@link G9Provider}. */\nexport interface G9ProviderProps {\n /**\n * The app's platform services (plan/specs/01 §8). `clock`, `preferences` and `host` are required: a missing one\n * throws `G9CapabilityMissingError` naming it when the provider mounts. Pass a stable object.\n */\n readonly services: Partial<G9Capabilities>;\n /**\n * The culture: a store the app drives (`createCultureStore`), or a culture value / locale tag the provider keeps in\n * its own store (a new value switches it). Default `'en'`.\n */\n readonly culture?: G9CultureStore | G9Culture | string;\n /**\n * The theme: a store the app drives (`createThemeStore`), or options for the provider's own store (changes to\n * `mode`, `systemScheme`, `palettes`, `overrides` are applied to it). Default: system mode, stock palettes.\n */\n readonly theme?: G9ThemeStore | G9ThemeOptions;\n /** The platform's current colour scheme (MAUI `RequestedThemeChanged`); followed while the mode is `'system'`. */\n readonly systemScheme?: G9ColorScheme;\n /**\n * Save the theme mode in preferences and restore it at mount (MAUI `G9Theme.ChangeTheme` / `Init`, key\n * `g9controls.theme`, values 0 system, 1 light, 2 dark). Default `true`.\n */\n readonly persistTheme?: boolean;\n /** App-wide settings (plan/specs/03 §6). Validated at mount and on change. */\n readonly settings?: G9Settings;\n /** The diagnostics hub. Default: a hub the provider creates. */\n readonly diagnostics?: G9Diagnostics;\n readonly className?: string;\n readonly children?: ReactNode;\n}\n\nconst THEME_PREFERENCE_KEY = 'theme';\nconst THEME_MODES: readonly G9ThemeMode[] = ['system', 'light', 'dark'];\n\nlet providerSequence = 0;\n\nfunction isCultureStore(value: G9ProviderProps['culture']): value is G9CultureStore {\n return typeof value === 'object' && value !== null && typeof (value as G9CultureStore).getSnapshot === 'function';\n}\n\nfunction isThemeStore(value: G9ProviderProps['theme']): value is G9ThemeStore {\n return typeof value === 'object' && value !== null && typeof (value as G9ThemeStore).getSnapshot === 'function';\n}\n\n/** The logical window size the platform reports at startup (`SystemInfo` is in physical pixels). */\nfunction initialWindow(): G9WindowState {\n const info = (globalThis as { SystemInfo?: { pixelWidth?: number; pixelHeight?: number; pixelRatio?: number } })\n .SystemInfo;\n const ratio = info?.pixelRatio && info.pixelRatio > 0 ? info.pixelRatio : 1;\n return Object.freeze({ width: (info?.pixelWidth ?? 0) / ratio, height: (info?.pixelHeight ?? 0) / ratio });\n}\n\nconst HIDDEN_KEYBOARD: G9KeyboardState = Object.freeze({ visible: false, height: 0, compatHeight: 0 });\n\nfunction finite(value: unknown): number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0;\n}\n\n/**\n * The root every G9 component lives in (plan/specs/01 §5, MAUI `G9Theme`/`G9Culture`/`G9Strings` statics,\n * `G9ServiceProvider`, `G9ScreenHelper`, `G9KeyboardHelper`): culture and strings, the theme as CSS variables on one\n * root `<view>`, settings, services and capabilities, the diagnostics hub, the shared safe executor, keyboard, window\n * and safe-area state, and the dispatch of the system back event to the active `G9Host`. Mount it once per LynxView.\n *\n * - A theme change updates the root's CSS variables with `setProperty`: nothing re-renders except `useG9Theme`\n * readers. A culture change re-renders culture readers.\n * - One `keyboardstatuschanged` and one `onWindowResize` listener for the whole tree.\n * - The back event (`settings.backEventName`, default `g9:back`) goes to the active host's back stack; when nothing\n * handles it, `services.host.exit()` runs (desktop hosts send the same event for Escape).\n * - Unmounting removes every listener, subscription and timer it created.\n */\nexport function G9Provider(props: G9ProviderProps): ReactNode {\n const { services, persistTheme = true } = props;\n assertRequiredCapabilities(services);\n\n const [ownDiagnostics] = useState(createDiagnostics);\n const diagnostics = props.diagnostics ?? ownDiagnostics;\n const [iconFonts] = useState(createIconFontRegistry);\n const settings = useMemo(() => resolveSettings(props.settings, iconFonts), [props.settings, iconFonts]);\n\n // Culture: the app's store, or one the provider keeps in step with the prop.\n const cultureProp = props.culture ?? 'en';\n const [ownCulture] = useState(() => createCultureStore(isCultureStore(cultureProp) ? 'en' : cultureProp));\n const cultureStore = isCultureStore(cultureProp) ? cultureProp : ownCulture;\n useEffect(() => {\n if (!isCultureStore(cultureProp)) ownCulture.setCulture(cultureProp);\n }, [cultureProp, ownCulture]);\n const culture = useSyncExternalStore(cultureStore.subscribe, cultureStore.getSnapshot);\n const strings = useMemo(() => createStrings({ ...settings.strings, culture }), [settings.strings, culture]);\n const cultureValue = useMemo(() => ({ culture, strings, store: cultureStore }), [culture, strings, cultureStore]);\n\n // Theme: the app's store, or one the provider keeps in step with the options.\n const themeProp = props.theme;\n const [ownTheme] = useState(() => createThemeStore(isThemeStore(themeProp) ? {} : (themeProp ?? {})));\n const themeStore = isThemeStore(themeProp) ? themeProp : ownTheme;\n const options = isThemeStore(themeProp) ? undefined : themeProp;\n useEffect(() => {\n if (!options) return;\n ownTheme.beginBatch();\n try {\n if (options.mode !== undefined) ownTheme.setMode(options.mode);\n if (options.systemScheme !== undefined) ownTheme.setSystemScheme(options.systemScheme);\n ownTheme.setPalettes(options.palettes);\n ownTheme.setOverrides(options.overrides);\n } finally {\n ownTheme.endBatch();\n }\n // Field-wise on purpose: an inline `theme={{ … }}` object must not re-apply (and undo a restored mode) per render.\n }, [ownTheme, options?.mode, options?.systemScheme, options?.palettes, options?.overrides]);\n useEffect(() => {\n if (props.systemScheme !== undefined) themeStore.setSystemScheme(props.systemScheme);\n }, [themeStore, props.systemScheme]);\n\n const executorStrings = useRef(strings);\n executorStrings.current = strings;\n const [rootId] = useState(() => {\n providerSequence += 1;\n return `g9-provider-${providerSequence}`;\n });\n\n const core = useMemo<G9ProviderCore>(() => {\n const preferences = createPreferences({\n store: services.preferences,\n onStoreError: (error, failure) =>\n diagnostics.log({\n level: 'warning',\n message: `Preference ${failure.operation} failed for '${failure.key}'.`,\n source: 'G9Provider',\n error,\n }),\n });\n const executorSettings = settings.executor;\n const executor = createSafeExecutor({\n clock: services.clock,\n diagnostics,\n strings: { get: (key) => executorStrings.current.get(key) },\n // No app presenter: the default one (the error popup, registered by `@g9tm/lynxcontrols/popup`) if loaded.\n showError:\n executorSettings.showError ??\n ((request) => {\n const presenter = g9DefaultErrorPresenter.current;\n if (presenter) return presenter(request);\n diagnostics.log({\n level: 'warning',\n message: `No error presenter is configured; not shown: ${request.message}`,\n source: request.source,\n });\n return undefined;\n }),\n ...(executorSettings.diagnosticsHandler ? { diagnosticsHandler: executorSettings.diagnosticsHandler } : {}),\n ...(executorSettings.diagnosticsAvailable ? { diagnosticsAvailable: executorSettings.diagnosticsAvailable } : {}),\n ...(executorSettings.defaults ? { defaults: executorSettings.defaults } : {}),\n });\n return Object.freeze({ services, themeStore, preferences, diagnostics, executor, rootId });\n }, [services, themeStore, diagnostics, settings.executor, rootId]);\n useEffect(() => () => core.executor.dispose(), [core]);\n\n // Theme root. The Lynx engine drops custom properties in an inline style object (page config\n // `enableCSSInlineVariables` is off and not exposed), so the first frame takes the stock palette of the initial\n // scheme and the default metrics from theme.css classes; the inline copy below only serves engines that honour it.\n // At mount every variable is then written with setProperty (custom palettes, overrides, layout), and each later\n // theme change sends only what changed (no re-render).\n const [initialVariables] = useState<G9CssVariables>(() => ({\n ...toMetricCssVariables(),\n ...toLayoutCssVariables(),\n ...toCssVariables(themeStore.getSnapshot()),\n }));\n const [initialScheme] = useState(() => themeStore.getSnapshot().scheme);\n const applied = useRef<G9CssVariables>({});\n const [fallbackVariables, setFallbackVariables] = useState<G9CssVariables | null>(null);\n useEffect(() => {\n const apply = () => {\n const next = { ...initialVariables, ...applied.current, ...toCssVariables(themeStore.getSnapshot()) };\n const diff = changedVariables(applied.current, next);\n applied.current = next;\n if (!diff) return;\n // Without the element API (a host that lacks it), re-render the root's style instead: still no child render.\n if (!applyThemeVariables(rootId, diff)) setFallbackVariables(next);\n };\n apply();\n return themeStore.subscribe(apply);\n }, [themeStore, rootId, initialVariables]);\n\n // Theme persistence (MAUI ChangeTheme wrote the AppTheme number, Init read it back).\n useEffect(() => {\n if (!persistTheme) return;\n let alive = true;\n const save = () => {\n const value = THEME_MODES.indexOf(themeStore.getSnapshot().mode);\n if (core.preferences.getInt(THEME_PREFERENCE_KEY, -1) !== value) {\n void core.preferences.setInt(THEME_PREFERENCE_KEY, value);\n }\n };\n let lastMode = themeStore.getSnapshot().mode;\n const unsubscribe = themeStore.subscribe((theme) => {\n if (theme.mode === lastMode) return;\n lastMode = theme.mode;\n save();\n });\n core.preferences.hydrate().then(\n () => {\n if (!alive) return;\n const stored = THEME_MODES[core.preferences.getInt(THEME_PREFERENCE_KEY, -1)];\n if (stored) themeStore.setMode(stored);\n },\n (error: unknown) =>\n diagnostics.log({ level: 'warning', message: 'Theme restore failed.', source: 'G9Provider', error }),\n );\n return () => {\n alive = false;\n unsubscribe();\n };\n }, [persistTheme, themeStore, core, diagnostics]);\n\n // Keyboard and window: one listener each for the whole tree.\n const [keyboard, setKeyboard] = useState<G9KeyboardState>(HIDDEN_KEYBOARD);\n useEffect(\n () =>\n addGlobalListener(\n 'keyboardstatuschanged',\n (status: unknown, height: unknown, compatHeight: unknown) => {\n setKeyboard(\n status === 'on'\n ? Object.freeze({ visible: true, height: finite(height), compatHeight: finite(compatHeight) })\n : HIDDEN_KEYBOARD,\n );\n },\n // A host without keyboard detection (windowless Lynxtron): the keyboard simply stays hidden.\n (error) =>\n diagnostics.log({\n level: 'warning',\n message: 'Keyboard events are unavailable on this host.',\n source: 'G9Provider',\n error,\n }),\n ),\n [diagnostics],\n );\n const [windowState, setWindowState] = useState<G9WindowState>(initialWindow);\n useEffect(\n () =>\n addGlobalListener('onWindowResize', (width: unknown, height: unknown) => {\n setWindowState((current) => {\n const next = {\n width: typeof width === 'number' && width >= 0 ? width : current.width,\n height: typeof height === 'number' && height >= 0 ? height : current.height,\n };\n return next.width === current.width && next.height === current.height ? current : Object.freeze(next);\n });\n }),\n [],\n );\n\n // Safe-area insets from the host service.\n const [insets, setInsets] = useState<G9SafeInsets>(() => services.host.getSafeInsets());\n useEffect(() => {\n setInsets(services.host.getSafeInsets());\n return services.host.subscribeSafeInsets((next) => setInsets(next));\n }, [services.host]);\n\n // System back: the active host of this provider first, then exit.\n const onBack = useStableCallback(() => {\n const host = g9Hosts.active();\n if (host && host.services === services && host.back.dispatch() === 'handled') return;\n services.host.exit();\n });\n useEffect(() => addGlobalListener(settings.backEventName, onBack), [settings.backEventName, onBack]);\n\n const rootStyle = fallbackVariables ?? initialVariables;\n const directionClass = culture.direction === 'rtl' ? 'g9-dir-rtl' : 'g9-dir-ltr';\n return (\n <G9CoreContext.Provider value={core}>\n <G9DiagnosticsContext.Provider value={diagnostics}>\n <G9SettingsContext.Provider value={settings}>\n <G9CultureContext.Provider value={cultureValue}>\n <G9KeyboardContext.Provider value={keyboard}>\n <G9WindowContext.Provider value={windowState}>\n <G9InsetsContext.Provider value={insets}>\n <view\n id={rootId}\n className={`g9-provider g9-theme-${initialScheme} ${directionClass}${props.className ? ` ${props.className}` : ''}`}\n style={rootStyle}\n >\n {props.children}\n </view>\n </G9InsetsContext.Provider>\n </G9WindowContext.Provider>\n </G9KeyboardContext.Provider>\n </G9CultureContext.Provider>\n </G9SettingsContext.Provider>\n </G9DiagnosticsContext.Provider>\n </G9CoreContext.Provider>\n );\n}\n"],"names":["THEME_PREFERENCE_KEY","THEME_MODES","providerSequence","isCultureStore","value","isThemeStore","initialWindow","info","globalThis","ratio","Object","HIDDEN_KEYBOARD","finite","Number","G9Provider","props","_props_diagnostics","_props_culture","services","persistTheme","assertRequiredCapabilities","ownDiagnostics","useState","createDiagnostics","diagnostics","iconFonts","createIconFontRegistry","settings","useMemo","resolveSettings","cultureProp","ownCulture","createCultureStore","cultureStore","useEffect","culture","useSyncExternalStore","strings","createStrings","cultureValue","themeProp","ownTheme","createThemeStore","themeStore","options","undefined","executorStrings","useRef","rootId","core","_executorSettings_showError","preferences","createPreferences","error","failure","executorSettings","executor","createSafeExecutor","key","request","presenter","g9DefaultErrorPresenter","initialVariables","toMetricCssVariables","toLayoutCssVariables","toCssVariables","initialScheme","applied","fallbackVariables","setFallbackVariables","apply","next","diff","changedVariables","applyThemeVariables","alive","save","lastMode","unsubscribe","theme","stored","keyboard","setKeyboard","addGlobalListener","status","height","compatHeight","windowState","setWindowState","width","current","insets","setInsets","onBack","useStableCallback","host","g9Hosts","rootStyle","directionClass","G9CoreContext","G9DiagnosticsContext","G9SettingsContext","G9CultureContext","G9KeyboardContext","G9WindowContext","G9InsetsContext","view"],"mappings":";;;;;;;;;;AA4EA,MAAMA,uBAAuB;AAC7B,MAAMC,cAAsC;IAAC;IAAU;IAAS;CAAO;AAEvE,IAAIC,mBAAmB;AAEvB,SAASC,eAAeC,KAAiC;IACvD,OAAO,AAAiB,YAAjB,OAAOA,SAAsBA,AAAU,SAAVA,SAAkB,AAAiD,cAAjD,OAAQA,MAAyB,WAAW;AACpG;AAEA,SAASC,aAAaD,KAA+B;IACnD,OAAO,AAAiB,YAAjB,OAAOA,SAAsBA,AAAU,SAAVA,SAAkB,AAA+C,cAA/C,OAAQA,MAAuB,WAAW;AAClG;AAGA,SAASE;;IACP,MAAMC,OAAQC,WACX,UAAU;IACb,MAAMC,QAAQF,AAAAA,CAAAA,QAAAA,OAAAA,KAAAA,IAAAA,KAAM,UAAU,AAAD,KAAKA,KAAK,UAAU,GAAG,IAAIA,KAAK,UAAU,GAAG;IAC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AAED,iBAAiB,SAAS;QAC9B,EAAED,kBAAkB,SAAS;MAC/B,EAAED,qBAAqB,SAAS;IAClC,EAAED,cAAc;AAEpB"}
1
+ {"version":3,"file":"provider/provider.jsx","sources":["../../src/provider/provider.tsx"],"sourcesContent":["import {\n assertRequiredCapabilities,\n createCultureStore,\n createDiagnostics,\n createIconFontRegistry,\n createPreferences,\n createSafeExecutor,\n createStrings,\n createThemeStore,\n type G9Capabilities,\n type G9ColorScheme,\n type G9CssVariables,\n type G9Culture,\n type G9CultureStore,\n type G9Diagnostics,\n type G9SafeInsets,\n type G9ThemeMode,\n type G9ThemeOptions,\n type G9ThemeStore,\n g9MotionScale,\n subscribeG9Motion,\n toCssVariables,\n toLayoutCssVariables,\n toMetricCssVariables,\n} from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useMemo, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { useStableCallback } from '../base/use-stable-callback';\nimport { g9Hosts } from '../host/registry';\nimport {\n G9CoreContext,\n G9CultureContext,\n G9DiagnosticsContext,\n G9InsetsContext,\n G9KeyboardContext,\n type G9KeyboardState,\n type G9ProviderCore,\n G9SettingsContext,\n G9WindowContext,\n type G9WindowState,\n} from './contexts';\nimport { addGlobalListener } from './global-events';\nimport { type G9Settings, g9DefaultErrorPresenter, resolveSettings } from './settings';\nimport { applyThemeVariables, changedVariables } from './theme-root';\nimport './provider.css';\nimport './theme.css';\n\n/** Props of {@link G9Provider}. */\nexport interface G9ProviderProps {\n /**\n * The app's platform services (plan/specs/01 §8). `clock`, `preferences` and `host` are required: a missing one\n * throws `G9CapabilityMissingError` naming it when the provider mounts. Pass a stable object.\n */\n readonly services: Partial<G9Capabilities>;\n /**\n * The culture: a store the app drives (`createCultureStore`), or a culture value / locale tag the provider keeps in\n * its own store (a new value switches it). Default `'en'`.\n */\n readonly culture?: G9CultureStore | G9Culture | string;\n /**\n * The theme: a store the app drives (`createThemeStore`), or options for the provider's own store (changes to\n * `mode`, `systemScheme`, `palettes`, `overrides` are applied to it). Default: system mode, stock palettes.\n */\n readonly theme?: G9ThemeStore | G9ThemeOptions;\n /** The platform's current colour scheme (MAUI `RequestedThemeChanged`); followed while the mode is `'system'`. */\n readonly systemScheme?: G9ColorScheme;\n /**\n * Save the theme mode in preferences and restore it at mount (MAUI `G9Theme.ChangeTheme` / `Init`, key\n * `g9controls.theme`, values 0 system, 1 light, 2 dark). Default `true`.\n */\n readonly persistTheme?: boolean;\n /** App-wide settings (plan/specs/03 §6). Validated at mount and on change. */\n readonly settings?: G9Settings;\n /** The diagnostics hub. Default: a hub the provider creates. */\n readonly diagnostics?: G9Diagnostics;\n readonly className?: string;\n readonly children?: ReactNode;\n}\n\nconst THEME_PREFERENCE_KEY = 'theme';\nconst THEME_MODES: readonly G9ThemeMode[] = ['system', 'light', 'dark'];\n\nlet providerSequence = 0;\n\nfunction isCultureStore(value: G9ProviderProps['culture']): value is G9CultureStore {\n return typeof value === 'object' && value !== null && typeof (value as G9CultureStore).getSnapshot === 'function';\n}\n\nfunction isThemeStore(value: G9ProviderProps['theme']): value is G9ThemeStore {\n return typeof value === 'object' && value !== null && typeof (value as G9ThemeStore).getSnapshot === 'function';\n}\n\n/** The logical window size the platform reports at startup (`SystemInfo` is in physical pixels). */\nfunction initialWindow(): G9WindowState {\n const info = (globalThis as { SystemInfo?: { pixelWidth?: number; pixelHeight?: number; pixelRatio?: number } })\n .SystemInfo;\n const ratio = info?.pixelRatio && info.pixelRatio > 0 ? info.pixelRatio : 1;\n return Object.freeze({ width: (info?.pixelWidth ?? 0) / ratio, height: (info?.pixelHeight ?? 0) / ratio });\n}\n\nconst HIDDEN_KEYBOARD: G9KeyboardState = Object.freeze({ visible: false, height: 0, compatHeight: 0 });\n\nfunction finite(value: unknown): number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0;\n}\n\n/**\n * The root every G9 component lives in (plan/specs/01 §5, MAUI `G9Theme`/`G9Culture`/`G9Strings` statics,\n * `G9ServiceProvider`, `G9ScreenHelper`, `G9KeyboardHelper`): culture and strings, the theme as CSS variables on one\n * root `<view>`, settings, services and capabilities, the diagnostics hub, the shared safe executor, keyboard, window\n * and safe-area state, and the dispatch of the system back event to the active `G9Host`. Mount it once per LynxView.\n *\n * - A theme change updates the root's CSS variables with `setProperty`: nothing re-renders except `useG9Theme`\n * readers. A culture change re-renders culture readers.\n * - One `keyboardstatuschanged` and one `onWindowResize` listener for the whole tree.\n * - The back event (`settings.backEventName`, default `g9:back`) goes to the active host's back stack; when nothing\n * handles it, `services.host.exit()` runs (desktop hosts send the same event for Escape).\n * - Unmounting removes every listener, subscription and timer it created.\n */\nexport function G9Provider(props: G9ProviderProps): ReactNode {\n const { services, persistTheme = true } = props;\n assertRequiredCapabilities(services);\n\n const [ownDiagnostics] = useState(createDiagnostics);\n const diagnostics = props.diagnostics ?? ownDiagnostics;\n const [iconFonts] = useState(createIconFontRegistry);\n const settings = useMemo(() => resolveSettings(props.settings, iconFonts), [props.settings, iconFonts]);\n\n // Culture: the app's store, or one the provider keeps in step with the prop.\n const cultureProp = props.culture ?? 'en';\n const [ownCulture] = useState(() => createCultureStore(isCultureStore(cultureProp) ? 'en' : cultureProp));\n const cultureStore = isCultureStore(cultureProp) ? cultureProp : ownCulture;\n useEffect(() => {\n if (!isCultureStore(cultureProp)) ownCulture.setCulture(cultureProp);\n }, [cultureProp, ownCulture]);\n const culture = useSyncExternalStore(cultureStore.subscribe, cultureStore.getSnapshot);\n const strings = useMemo(() => createStrings({ ...settings.strings, culture }), [settings.strings, culture]);\n const cultureValue = useMemo(() => ({ culture, strings, store: cultureStore }), [culture, strings, cultureStore]);\n\n // Theme: the app's store, or one the provider keeps in step with the options.\n const themeProp = props.theme;\n const [ownTheme] = useState(() => createThemeStore(isThemeStore(themeProp) ? {} : (themeProp ?? {})));\n const themeStore = isThemeStore(themeProp) ? themeProp : ownTheme;\n const options = isThemeStore(themeProp) ? undefined : themeProp;\n useEffect(() => {\n if (!options) return;\n ownTheme.beginBatch();\n try {\n if (options.mode !== undefined) ownTheme.setMode(options.mode);\n if (options.systemScheme !== undefined) ownTheme.setSystemScheme(options.systemScheme);\n ownTheme.setPalettes(options.palettes);\n ownTheme.setOverrides(options.overrides);\n } finally {\n ownTheme.endBatch();\n }\n // Field-wise on purpose: an inline `theme={{ … }}` object must not re-apply (and undo a restored mode) per render.\n }, [ownTheme, options?.mode, options?.systemScheme, options?.palettes, options?.overrides]);\n useEffect(() => {\n if (props.systemScheme !== undefined) themeStore.setSystemScheme(props.systemScheme);\n }, [themeStore, props.systemScheme]);\n\n const executorStrings = useRef(strings);\n executorStrings.current = strings;\n const [rootId] = useState(() => {\n providerSequence += 1;\n return `g9-provider-${providerSequence}`;\n });\n\n const core = useMemo<G9ProviderCore>(() => {\n const preferences = createPreferences({\n store: services.preferences,\n onStoreError: (error, failure) =>\n diagnostics.log({\n level: 'warning',\n message: `Preference ${failure.operation} failed for '${failure.key}'.`,\n source: 'G9Provider',\n error,\n }),\n });\n const executorSettings = settings.executor;\n const executor = createSafeExecutor({\n clock: services.clock,\n diagnostics,\n strings: { get: (key) => executorStrings.current.get(key) },\n // No app presenter: the default one (the error popup, registered by `@g9tm/lynxcontrols/popup`) if loaded.\n showError:\n executorSettings.showError ??\n ((request) => {\n const presenter = g9DefaultErrorPresenter.current;\n if (presenter) return presenter(request);\n diagnostics.log({\n level: 'warning',\n message: `No error presenter is configured; not shown: ${request.message}`,\n source: request.source,\n });\n return undefined;\n }),\n ...(executorSettings.diagnosticsHandler ? { diagnosticsHandler: executorSettings.diagnosticsHandler } : {}),\n ...(executorSettings.diagnosticsAvailable ? { diagnosticsAvailable: executorSettings.diagnosticsAvailable } : {}),\n ...(executorSettings.defaults ? { defaults: executorSettings.defaults } : {}),\n });\n return Object.freeze({ services, themeStore, preferences, diagnostics, executor, rootId });\n }, [services, themeStore, diagnostics, settings.executor, rootId]);\n useEffect(() => () => core.executor.dispose(), [core]);\n\n // Theme root. The Lynx engine drops custom properties in an inline style object (page config\n // `enableCSSInlineVariables` is off and not exposed), so the first frame takes the stock palette of the initial\n // scheme and the default metrics from theme.css classes; the inline copy below only serves engines that honour it.\n // At mount every variable is then written with setProperty (custom palettes, overrides, layout), and each later\n // theme change sends only what changed (no re-render).\n const [initialVariables] = useState<G9CssVariables>(() => ({\n ...toMetricCssVariables(),\n ...toLayoutCssVariables(),\n ...toCssVariables(themeStore.getSnapshot()),\n }));\n const [initialScheme] = useState(() => themeStore.getSnapshot().scheme);\n const applied = useRef<G9CssVariables>({});\n const [fallbackVariables, setFallbackVariables] = useState<G9CssVariables | null>(null);\n useEffect(() => {\n const apply = () => {\n const next = { ...initialVariables, ...applied.current, ...toCssVariables(themeStore.getSnapshot()) };\n const diff = changedVariables(applied.current, next);\n applied.current = next;\n if (!diff) return;\n // Without the element API (a host that lacks it), re-render the root's style instead: still no child render.\n if (!applyThemeVariables(rootId, diff)) setFallbackVariables(next);\n };\n apply();\n return themeStore.subscribe(apply);\n }, [themeStore, rootId, initialVariables]);\n\n // Theme persistence (MAUI ChangeTheme wrote the AppTheme number, Init read it back).\n useEffect(() => {\n if (!persistTheme) return;\n let alive = true;\n const save = () => {\n const value = THEME_MODES.indexOf(themeStore.getSnapshot().mode);\n if (core.preferences.getInt(THEME_PREFERENCE_KEY, -1) !== value) {\n void core.preferences.setInt(THEME_PREFERENCE_KEY, value);\n }\n };\n let lastMode = themeStore.getSnapshot().mode;\n const unsubscribe = themeStore.subscribe((theme) => {\n if (theme.mode === lastMode) return;\n lastMode = theme.mode;\n save();\n });\n core.preferences.hydrate().then(\n () => {\n if (!alive) return;\n const stored = THEME_MODES[core.preferences.getInt(THEME_PREFERENCE_KEY, -1)];\n if (stored) themeStore.setMode(stored);\n },\n (error: unknown) =>\n diagnostics.log({ level: 'warning', message: 'Theme restore failed.', source: 'G9Provider', error }),\n );\n return () => {\n alive = false;\n unsubscribe();\n };\n }, [persistTheme, themeStore, core, diagnostics]);\n\n // Keyboard and window: one listener each for the whole tree.\n const [keyboard, setKeyboard] = useState<G9KeyboardState>(HIDDEN_KEYBOARD);\n useEffect(\n () =>\n addGlobalListener(\n 'keyboardstatuschanged',\n (status: unknown, height: unknown, compatHeight: unknown) => {\n setKeyboard(\n status === 'on'\n ? Object.freeze({ visible: true, height: finite(height), compatHeight: finite(compatHeight) })\n : HIDDEN_KEYBOARD,\n );\n },\n // A host without keyboard detection (windowless Lynxtron): the keyboard simply stays hidden.\n (error) =>\n diagnostics.log({\n level: 'warning',\n message: 'Keyboard events are unavailable on this host.',\n source: 'G9Provider',\n error,\n }),\n ),\n [diagnostics],\n );\n const [windowState, setWindowState] = useState<G9WindowState>(initialWindow);\n useEffect(\n () =>\n addGlobalListener('onWindowResize', (width: unknown, height: unknown) => {\n setWindowState((current) => {\n const next = {\n width: typeof width === 'number' && width >= 0 ? width : current.width,\n height: typeof height === 'number' && height >= 0 ? height : current.height,\n };\n return next.width === current.width && next.height === current.height ? current : Object.freeze(next);\n });\n }),\n [],\n );\n\n // Safe-area insets from the host service.\n const [insets, setInsets] = useState<G9SafeInsets>(() => services.host.getSafeInsets());\n useEffect(() => {\n setInsets(services.host.getSafeInsets());\n return services.host.subscribeSafeInsets((next) => setInsets(next));\n }, [services.host]);\n\n // System back: the active host of this provider first, then exit.\n const onBack = useStableCallback(() => {\n const host = g9Hosts.active();\n if (host && host.services === services && host.back.dispatch() === 'handled') return;\n services.host.exit();\n });\n useEffect(() => addGlobalListener(settings.backEventName, onBack), [settings.backEventName, onBack]);\n\n // setG9MotionScale(0) (reduced motion; a screen that holds still for tests): the CSS transitions end at once too — the\n // root carries `g9-motion-off` and theme.css sets their durations to 0 (JS-timed motion already follows g9Ms).\n const [motionOff, setMotionOff] = useState(() => g9MotionScale() === 0);\n useEffect(() => subscribeG9Motion((s) => setMotionOff(s === 0)), []);\n\n const rootStyle = fallbackVariables ?? initialVariables;\n const directionClass = culture.direction === 'rtl' ? 'g9-dir-rtl' : 'g9-dir-ltr';\n return (\n <G9CoreContext.Provider value={core}>\n <G9DiagnosticsContext.Provider value={diagnostics}>\n <G9SettingsContext.Provider value={settings}>\n <G9CultureContext.Provider value={cultureValue}>\n <G9KeyboardContext.Provider value={keyboard}>\n <G9WindowContext.Provider value={windowState}>\n <G9InsetsContext.Provider value={insets}>\n <view\n id={rootId}\n className={`g9-provider g9-theme-${initialScheme} ${directionClass}${motionOff ? ' g9-motion-off' : ''}${props.className ? ` ${props.className}` : ''}`}\n style={rootStyle}\n >\n {props.children}\n </view>\n </G9InsetsContext.Provider>\n </G9WindowContext.Provider>\n </G9KeyboardContext.Provider>\n </G9CultureContext.Provider>\n </G9SettingsContext.Provider>\n </G9DiagnosticsContext.Provider>\n </G9CoreContext.Provider>\n );\n}\n"],"names":["THEME_PREFERENCE_KEY","THEME_MODES","providerSequence","isCultureStore","value","isThemeStore","initialWindow","info","globalThis","ratio","Object","HIDDEN_KEYBOARD","finite","Number","G9Provider","props","_props_diagnostics","_props_culture","services","persistTheme","assertRequiredCapabilities","ownDiagnostics","useState","createDiagnostics","diagnostics","iconFonts","createIconFontRegistry","settings","useMemo","resolveSettings","cultureProp","ownCulture","createCultureStore","cultureStore","useEffect","culture","useSyncExternalStore","strings","createStrings","cultureValue","themeProp","ownTheme","createThemeStore","themeStore","options","undefined","executorStrings","useRef","rootId","core","_executorSettings_showError","preferences","createPreferences","error","failure","executorSettings","executor","createSafeExecutor","key","request","presenter","g9DefaultErrorPresenter","initialVariables","toMetricCssVariables","toLayoutCssVariables","toCssVariables","initialScheme","applied","fallbackVariables","setFallbackVariables","apply","next","diff","changedVariables","applyThemeVariables","alive","save","lastMode","unsubscribe","theme","stored","keyboard","setKeyboard","addGlobalListener","status","height","compatHeight","windowState","setWindowState","width","current","insets","setInsets","onBack","useStableCallback","host","g9Hosts","motionOff","setMotionOff","g9MotionScale","subscribeG9Motion","s","rootStyle","directionClass","G9CoreContext","G9DiagnosticsContext","G9SettingsContext","G9CultureContext","G9KeyboardContext","G9WindowContext","G9InsetsContext","view"],"mappings":";;;;;;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yC,iBAAiBpE,AAAsB,UAAtBA,QAAQ,SAAS,GAAa,eAAe;IACpE,QACGqE,cAAc,SAAS,OAAOvD,MAAM;MACnC,CAACwD,qBAAqB,SAAS,OAAOjF,aAAa;QACjD,CAACkF,kBAAkB,SAAS,OAAO/E,UAAU;UAC3C,CAACgF,iBAAiB,SAAS,OAAOpE,cAAc;YAC9C,CAACqE,kBAAkB,SAAS,OAAO3B,UAAU;cAC3C,CAAC4B,gBAAgB,SAAS,OAAOtB,aAAa;gBAC5C,CAACuB,gBAAgB,SAAS,OAAOnB,QAAQ;kBACvC,CAACoB,KACC,IAAI/D,QACJ,WAAW,CAAC,qBAAqB,EAAEkB,cAAc,CAAC,EAAEqC,iBAAiBN,YAAY,mBAAmB,KAAKlF,MAAM,SAAS,GAAG,CAAC,CAAC,EAAEA,MAAM,SAAS,EAAE,GAAG,IAAI,EACvJ,OAAOuF,WACR;oBACC,CAACvF,MAAM,QAAQ,CAAC;kBAClB,EAAEgG,KAAK;gBACT,EAAED,gBAAgB,SAAS;cAC7B,EAAED,gBAAgB,SAAS;YAC7B,EAAED,kBAAkB,SAAS;UAC/B,EAAED,iBAAiB,SAAS;QAC9B,EAAED,kBAAkB,SAAS;MAC/B,EAAED,qBAAqB,SAAS;IAClC,EAAED,cAAc;AAEpB"}
@@ -45,6 +45,11 @@ export interface G9SelectionSheetRequest<T extends G9SelectionItem> {
45
45
  readonly resetSelection?: ReadonlyArray<T> | null;
46
46
  /** Count pill label (multi). Default `"{n} {selected}"`. */
47
47
  readonly countLabel?: (count: number) => string;
48
+ /**
49
+ * Multi: Done stays disabled until at least this many items are ticked (MAUI `minimumSelected`, G9MAUIControls 1.4.7) —
50
+ * the sheet never closes on an answer the caller would refuse and reopen. Default 0.
51
+ */
52
+ readonly minimumSelected?: number;
48
53
  /** Extra sheet options (merged over the defaults). */
49
54
  readonly options?: G9SheetOptions;
50
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"selection-sheet.d.ts","sourceRoot":"","sources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,eAAe;IAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB;IACpB,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAC1C,+EAA+E;IAC/E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,wGAAwG;IACxG,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,eAAe,EACrD,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC7B,OAAO,CAAC,CAAC,EAAE,CAAC,CAiEd"}
@@ -152,6 +152,7 @@ function showSelectionSheet(sheets, request) {
152
152
  isEnabled: (item)=>false !== item.isEnabled
153
153
  });
154
154
  return new Promise((resolve)=>{
155
+ var _request_minimumSelected;
155
156
  let draft = initial;
156
157
  const draftListeners = new Set();
157
158
  const draftStore = {
@@ -211,9 +212,12 @@ function showSelectionSheet(sheets, request) {
211
212
  title: request.title,
212
213
  headerTitlePlacement: 'nearBack',
213
214
  ...multiple || reset ? {
214
- headerTrailingView: <SelectionHeaderActions multiple={multiple} draft={draftStore} {...request.countLabel ? {
215
+ headerTrailingView: <SelectionHeaderActions multiple={multiple} draft={draftStore} minimum={Math.max(0, null != (_request_minimumSelected = request.minimumSelected) ? _request_minimumSelected : 0)} {...request.countLabel ? {
215
216
  countLabel: request.countLabel
216
- } : {}} onDone={()=>complete(draft.selectedKeys, true)} {...reset ? {
217
+ } : {}} onDone={()=>{
218
+ var _request_minimumSelected;
219
+ if (draft.selectedKeys.length >= Math.max(0, null != (_request_minimumSelected = request.minimumSelected) ? _request_minimumSelected : 0)) complete(draft.selectedKeys, true);
220
+ }} {...reset ? {
217
221
  onReset: ()=>{
218
222
  settle([], true, reset);
219
223
  null == handle || handle.close();
@@ -242,7 +246,7 @@ function SelectionHeaderActions(props) {
242
246
  {props.countLabel ? props.countLabel(n) : `${n} ${strings.get(G9StringKey.Selected)}`}
243
247
  </text>
244
248
  </view> : null}
245
- {props.multiple ? <G9Button text={strings.get(G9StringKey.Done)} variant="text" size="small" onPress={props.onDone}/> : null}
249
+ {props.multiple ? <G9Button text={strings.get(G9StringKey.Done)} variant="text" size="small" disabled={n < props.minimum} onPress={props.onDone}/> : null}
246
250
  </view>;
247
251
  }
248
252
  function showListSheet(sheets, request) {
@@ -1 +1 @@
1
- {"version":3,"file":"selection/selection-sheet.jsx","sources":["../../src/selection/selection-sheet.tsx"],"sourcesContent":["import './selection.css';\nimport { formatColor, G9StringKey, type G9TextInputDirection, withAlpha } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { g9ChildId, g9RowStyle, g9TextStart } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport type { G9SelectionItem } from '../base/selection-item';\nimport { type G9TimerHandle, startTimer, stopTimer } from '../base/timers';\nimport { G9Button } from '../button/button';\nimport { G9SearchEntry } from '../fields/search-entry';\nimport { G9TextEntry } from '../fields/text-entry';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { G9Swatch } from '../icon/swatch';\nimport { useG9Direction, useG9Settings, useG9Strings, useG9Theme } from '../provider/hooks';\nimport { fitToContentSheetOptions, fullScreenWithoutHandleSheetOptions, type G9SheetOptions } from '../sheet/options';\nimport type { G9SheetService } from '../sheet/service';\nimport type { G9SheetHandle } from '../sheet/stack';\nimport { createSelectionModel, type G9SelectionModel } from './model';\n\n/** MAUI `G9SelectionSheet.EagerBuildItemLimit`: lists up to 40 items are built at once; longer lists defer. */\nexport const g9SelectionEagerBuildItemLimit = 40;\n/** Row height of the selection sheet (MAUI 52). */\nexport const g9SelectionRowHeight = 52;\n/** Search debounce of the selection sheet (MAUI 150 ms). */\nexport const g9SelectionSearchDebounceMs = 150;\n/** Wait after a close-on-select pick before closing (MAUI 120 ms). */\nexport const g9SelectionCloseDelayMs = 120;\n\n/** The outcome of a selection sheet (MAUI `G9SelectionSheetResult`). */\nexport interface G9SelectionSheetResult<T extends G9SelectionItem = G9SelectionItem> {\n /** A pick on a close-on-select sheet, Done, or Reset; `false` for every dismissal. */\n readonly wasAccepted: boolean;\n /** The selection differs from the opening one. */\n readonly selectionChanged: boolean;\n /** The final selection (opening items that are not listed or disabled stay unless deselected). */\n readonly items: ReadonlyArray<T>;\n}\n\n/**\n * The selection identity of an item inside one list (MAUI `G9SelectionSheet.KeyOf`): `k:<key>` when the key is set,\n * else `t:<text>` when the text is unique among key-less items, else the position (`i:<n>`). Keys and texts never\n * match each other.\n */\nexport function selectionIdentities(items: ReadonlyArray<G9SelectionItem>): string[] {\n const counts = new Map<string, number>();\n for (const item of items) {\n if (item.key == null || item.key.trim() === '') counts.set(item.text, (counts.get(item.text) ?? 0) + 1);\n }\n return items.map((item, i) =>\n item.key != null && item.key.trim() !== ''\n ? `k:${item.key}`\n : (counts.get(item.text) ?? 0) > 1\n ? `i:${i}`\n : `t:${item.text}`,\n );\n}\n\n/** Estimated body height (MAUI `EstimateContentHeight`): rows × 52 + chrome, clamped to [2 rows + chrome, 520]. */\nexport function estimateSelectionHeight(count: number, showSearch: boolean): number {\n const chrome = (showSearch ? 64 : 0) + 18;\n return Math.min(520, Math.max(2 * g9SelectionRowHeight + chrome, count * g9SelectionRowHeight + chrome));\n}\n\n/** Arguments of {@link showSelectionSheet} (MAUI `ShowForResultAsync`). */\nexport interface G9SelectionSheetRequest<T extends G9SelectionItem> {\n readonly title: string;\n readonly items: ReadonlyArray<T>;\n readonly selectedItems?: ReadonlyArray<T>;\n readonly allowMultiple?: boolean;\n /** Single mode: a pick completes and closes after 120 ms. Default true. */\n readonly closeOnSingleSelection?: boolean;\n readonly showSearch?: boolean;\n /** No-results text. Default the `noResults` string. */\n readonly emptyText?: string | null;\n /** Row text direction. Default `'matchParent'`. */\n readonly itemTextDirection?: G9TextInputDirection;\n /** A non-empty reset selection adds a Reset toolbar item that completes with it. */\n readonly resetSelection?: ReadonlyArray<T> | null;\n /** Count pill label (multi). Default `\"{n} {selected}\"`. */\n readonly countLabel?: (count: number) => string;\n /** Extra sheet options (merged over the defaults). */\n readonly options?: G9SheetOptions;\n}\n\ninterface BodyProps<T extends G9SelectionItem> {\n readonly request: G9SelectionSheetRequest<T>;\n readonly ids: ReadonlyArray<string>;\n readonly initial: G9SelectionModel<T>;\n readonly onComplete: (keys: ReadonlyArray<string>, accepted: boolean) => void;\n readonly onDraft: (model: G9SelectionModel<T>) => void;\n readonly done: { current: boolean };\n}\n\nfunction SelectionRow(props: {\n readonly item: G9SelectionItem;\n /** Element id (`${sheet automationId}_Item_${key}`), so automation finds the row like a person sees it. */\n readonly elementId?: string | undefined;\n readonly selected: boolean;\n readonly direction: 'ltr' | 'rtl';\n readonly onTap: () => void;\n}): ReactNode {\n const palette = useG9Theme().palette;\n const glyphs = useG9Settings().glyphs;\n const { item, selected } = props;\n const press = useG9Press(props.onTap, { blocked: item.isEnabled === false, source: 'G9SelectionSheet', guardMs: 0 });\n const icon = { emoji: item.emoji, icon: item.icon, imagePath: item.iconPath, image: item.iconImage };\n const iconColor = item.iconTintColor ?? (selected ? palette.Primary : palette.TextSecondary);\n return (\n <view\n {...(props.elementId ? { id: props.elementId } : {})}\n className={`g9-selection-row${selected ? ' g9-selection-row--selected' : ''}`}\n style={selected ? { backgroundColor: formatColor(withAlpha(palette.Primary, 0.1)) } : {}}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={item.text}\n {...(selected ? { 'accessibility-value': 'selected' } : {})}\n bindtap={press}\n >\n <view\n className={`g9-selection-row__inner g9-dir-${props.direction}`}\n style={{ ...g9RowStyle(props.direction), ...(item.isEnabled === false ? { opacity: 0.45 } : {}) }}\n >\n {hasIconSlot(icon) ? (\n <G9IconSlot {...icon} size={18} color={iconColor} />\n ) : item.swatchFirstColor?.trim() || item.swatchSecondColor?.trim() ? (\n <G9Swatch first={item.swatchFirstColor} second={item.swatchSecondColor} direction={props.direction} />\n ) : (\n // MAUI's row is a Grid of ColumnSpacing 12 whose icon column stays when empty: its spacing still sits before\n // the text, so an icon-less row's text starts 16 + 12 dp in, level with nothing but the same in every picker.\n <view className=\"g9-selection-row__icon-gap\" />\n )}\n <text\n className=\"g9-selection-row__text\"\n text-maxline=\"1\"\n style={{\n color: selected ? palette.Primary : palette.TextPrimary,\n fontWeight: selected ? 'bold' : 'normal',\n ...g9TextStart(props.direction),\n }}\n >\n {item.text}\n </text>\n <view style={{ opacity: selected ? 1 : 0 }}>\n <G9IconSlot icon={glyphs.check} size={18} color={palette.Primary} />\n </view>\n </view>\n </view>\n );\n}\n\nfunction SelectionBody<T extends G9SelectionItem>(props: BodyProps<T>): ReactNode {\n const strings = useG9Strings();\n const parentDir = useG9Direction();\n const { request, ids } = props;\n const [model, setModel] = useState(props.initial);\n const [query, setQuery] = useState('');\n const [applied, setApplied] = useState('');\n const timer = useRef<G9TimerHandle | null>(null);\n const picking = useRef(false);\n useEffect(\n () => () => {\n if (timer.current !== null) stopTimer(timer.current);\n },\n [],\n );\n const visible = request.showSearch ? model.withItems(request.items).filter(applied) : request.items;\n const visibleIds = new Set(visible.map((item) => ids[request.items.indexOf(item)]));\n const dir =\n request.itemTextDirection === 'leftToRight'\n ? 'ltr'\n : request.itemTextDirection === 'rightToLeft'\n ? 'rtl'\n : parentDir;\n const multiple = request.allowMultiple === true;\n const onQuery = (value: string) => {\n setQuery(value);\n if (timer.current !== null) stopTimer(timer.current);\n if (value.trim() === '') {\n setApplied(value);\n return;\n }\n timer.current = startTimer(() => setApplied(value), g9SelectionSearchDebounceMs);\n };\n const tap = (id: string) => {\n if (props.done.current || picking.current) return;\n const next = model.toggle(id);\n if (next === model) return;\n setModel(next);\n props.onDraft(next);\n if (!multiple && request.closeOnSingleSelection !== false) {\n picking.current = true;\n startTimer(() => props.onComplete(next.selectedKeys, true), g9SelectionCloseDelayMs);\n }\n };\n return (\n <view className=\"g9-selection\">\n {request.showSearch ? (\n <view className=\"g9-selection__search\">\n <G9TextEntry\n placeholder={strings.get(G9StringKey.Search)}\n leadingIcon=\"search\"\n value={query}\n onValueChange={onQuery}\n />\n </view>\n ) : null}\n {visible.length > 0 ? (\n <view className=\"g9-selection__items\">\n {request.items.map((item, i) => {\n const id = ids[i] as string;\n if (!visibleIds.has(id)) return null;\n return (\n <SelectionRow\n key={id}\n item={item}\n elementId={g9ChildId(request.options?.automationId, `Item_${item.key ?? i}`)}\n selected={model.isSelected(id)}\n direction={dir}\n onTap={() => tap(id)}\n />\n );\n })}\n </view>\n ) : null}\n {visible.length === 0 ? (\n <text className=\"g9-selection__empty\">{request.emptyText ?? strings.get(G9StringKey.NoResults)}</text>\n ) : null}\n </view>\n );\n}\n\n/**\n * Shows the selection sheet (MAUI `G9SelectionSheet.ShowForResultAsync`): a fit sheet with a header (title near the\n * close button), optional search (150 ms debounce, text match, hidden selected rows stay selected), rows with icon or\n * swatch, check mark and selection tint. Single mode with `closeOnSingleSelection` completes on a pick; multi mode\n * shows a count pill and Done; a reset selection adds Reset. Any dismissal resolves `wasAccepted: false` with the\n * current draft (or the opening selection when the sheet never built).\n */\nexport function showSelectionSheet<T extends G9SelectionItem>(\n sheets: G9SheetService,\n request: G9SelectionSheetRequest<T>,\n): Promise<G9SelectionSheetResult<T>> {\n const items = [...request.items];\n const ids = selectionIdentities(items);\n const opening = request.selectedItems ?? [];\n // Opening items match listed items by identity; the rest are kept as \"not listed\".\n const openingIds = selectionIdentities([...items, ...opening]).slice(items.length);\n const listedIds = new Set(ids);\n const initialKeys = openingIds.filter((id) => listedIds.has(id));\n const unlisted = opening.filter((_, i) => !listedIds.has(openingIds[i] as string));\n const multiple = request.allowMultiple === true;\n const initial = createSelectionModel<T>({\n items,\n getKey: (item) => ids[items.indexOf(item)] as string,\n getText: (item) => item.text,\n mode: multiple ? 'multiple' : 'single',\n selectedKeys: initialKeys,\n isEnabled: (item) => item.isEnabled !== false,\n });\n return new Promise((resolve) => {\n let draft = initial;\n const draftListeners = new Set<() => void>();\n const draftStore = {\n subscribe: (l: () => void) => {\n draftListeners.add(l);\n return () => {\n draftListeners.delete(l);\n };\n },\n count: () => draft.selectedKeys.length,\n };\n let settled = false;\n const done = { current: false };\n const startKeys = new Set(initialKeys);\n const collect = (keys: ReadonlyArray<string>): T[] => {\n const set = new Set(keys);\n return [...items.filter((_, i) => set.has(ids[i] as string)), ...unlisted];\n };\n const settle = (keys: ReadonlyArray<string>, accepted: boolean, explicit?: ReadonlyArray<T>) => {\n if (settled) return;\n settled = true;\n done.current = true;\n const result = explicit ?? collect(keys);\n const changed = explicit !== undefined || keys.length !== startKeys.size || keys.some((k) => !startKeys.has(k));\n resolve({ wasAccepted: accepted, selectionChanged: changed, items: result });\n };\n let handle: G9SheetHandle | null = null;\n const complete = (keys: ReadonlyArray<string>, accepted: boolean) => {\n settle(keys, accepted);\n handle?.close();\n };\n const reset = request.resetSelection && request.resetSelection.length > 0 ? request.resetSelection : null;\n const body = () => (\n <SelectionBody\n request={request}\n ids={ids}\n initial={initial}\n done={done}\n onDraft={(m) => {\n draft = m;\n for (const l of [...draftListeners]) l();\n }}\n onComplete={complete}\n />\n );\n const options: G9SheetOptions = {\n ...fitToContentSheetOptions(),\n deferContent: items.length > g9SelectionEagerBuildItemLimit,\n deferredLoadingPlaceholderHeight: estimateSelectionHeight(items.length, request.showSearch === true),\n loadingSkeleton: 'listRows',\n loadingSkeletonRowCount: items.length,\n backgroundColor: 'var(--g9-surface)',\n showToolbar: true,\n showCloseButton: true,\n title: request.title,\n headerTitlePlacement: 'nearBack',\n ...(multiple || reset\n ? {\n headerTrailingView: (\n <SelectionHeaderActions\n multiple={multiple}\n draft={draftStore}\n {...(request.countLabel ? { countLabel: request.countLabel } : {})}\n onDone={() => complete(draft.selectedKeys, true)}\n {...(reset\n ? {\n onReset: () => {\n settle([], true, reset);\n handle?.close();\n },\n }\n : {})}\n />\n ),\n }\n : {}),\n ...request.options,\n onClosed: () => {\n request.options?.onClosed?.();\n settle(draft.selectedKeys, false);\n },\n };\n handle = sheets.show(items.length > g9SelectionEagerBuildItemLimit ? body : body(), options);\n if (!handle) settle(initialKeys, false);\n });\n}\n\nfunction SelectionHeaderActions(props: {\n readonly multiple: boolean;\n readonly draft: { subscribe(listener: () => void): () => void; count(): number };\n readonly countLabel?: (n: number) => string;\n readonly onDone: () => void;\n readonly onReset?: () => void;\n}): ReactNode {\n const strings = useG9Strings();\n const direction = useG9Direction();\n const n = useSyncExternalStore(props.draft.subscribe, props.draft.count);\n return (\n <view className=\"g9-selection__actions\" style={g9RowStyle(direction)}>\n {props.onReset ? (\n <G9Button text={strings.get(G9StringKey.Reset)} variant=\"text\" size=\"small\" onPress={props.onReset} />\n ) : null}\n {props.multiple && n > 0 ? (\n <view className=\"g9-selection__count\">\n <text className=\"g9-selection__count-text\">\n {props.countLabel ? props.countLabel(n) : `${n} ${strings.get(G9StringKey.Selected)}`}\n </text>\n </view>\n ) : null}\n {props.multiple ? (\n <G9Button text={strings.get(G9StringKey.Done)} variant=\"text\" size=\"small\" onPress={props.onDone} />\n ) : null}\n </view>\n );\n}\n\n/** Arguments of {@link showListSheet} (MAUI `ShowListG9BottomSheetAsync`). */\nexport interface G9ListSheetRequest<T extends G9SelectionItem> {\n readonly title: string;\n readonly items: ReadonlyArray<T>;\n readonly selected?: ReadonlyArray<T>;\n readonly multiple?: boolean;\n /** Default true. */\n readonly closeOnSingleSelection?: boolean;\n /** Shows the search field (250 ms debounce, trimmed) with this placeholder. */\n readonly searchPlaceholder?: string | null;\n /** Default full screen without a handle (MAUI). A fit-to-content `sizeMode` keeps the sheet compact. */\n readonly options?: G9SheetOptions;\n /** Apply button text (multi). Default the `save` string. */\n readonly applyButtonText?: string;\n}\n\n/**\n * The shared list picker (MAUI `ShowListG9BottomSheetAsync` / `G9BottomSheetListPickerModal`): search field with\n * placeholder, rows with a selection tint (no check mark), Apply in multi mode, close-on-select after 120 ms. Resolves\n * with the selection when it completes or closes (no accepted/dismissed distinction, as MAUI); `[]` when throttled.\n */\nexport function showListSheet<T extends G9SelectionItem>(\n sheets: G9SheetService,\n request: G9ListSheetRequest<T>,\n): Promise<T[]> {\n const items = [...request.items];\n const keyOf = (item: G9SelectionItem) => (item.key != null && item.key.trim() !== '' ? item.key : item.text);\n const multiple = request.multiple === true;\n const initial = createSelectionModel<T>({\n items,\n getKey: keyOf,\n getText: (item) => item.text,\n mode: multiple ? 'multiple' : 'single',\n selectedKeys: (request.selected ?? []).map(keyOf),\n isEnabled: (item) => item.isEnabled !== false,\n });\n return new Promise((resolve) => {\n let draft = initial;\n let settled = false;\n let handle: G9SheetHandle | null = null;\n const settle = () => {\n if (settled) return;\n settled = true;\n resolve(draft.selectedItems());\n };\n const complete = () => {\n settle();\n handle?.close();\n };\n const body = () => (\n <ListPickerBody\n request={request}\n initial={initial}\n keyOf={keyOf}\n onDraft={(m) => {\n draft = m;\n }}\n onComplete={complete}\n />\n );\n const base = request.options ?? fullScreenWithoutHandleSheetOptions();\n const fit = base.sizeMode === 'fitToContent';\n const options: G9SheetOptions = {\n ...base,\n ...(fit\n ? {}\n : {\n states: ['large'],\n currentState: 'large',\n hasHandle: false,\n isDraggable: true,\n useFullScreenLoadingPlaceholder: true,\n }),\n showToolbar: true,\n showCloseButton: true,\n title: request.title,\n headerTitlePlacement: 'nearBack',\n deferContent: true,\n onClosed: () => {\n base.onClosed?.();\n settle();\n },\n };\n handle = sheets.show(body, options);\n if (!handle) {\n settled = true;\n resolve([]);\n }\n });\n}\n\nfunction ListPickerBody<T extends G9SelectionItem>(props: {\n readonly request: G9ListSheetRequest<T>;\n readonly initial: G9SelectionModel<T>;\n readonly keyOf: (item: G9SelectionItem) => string;\n readonly onDraft: (model: G9SelectionModel<T>) => void;\n readonly onComplete: () => void;\n}): ReactNode {\n const strings = useG9Strings();\n const palette = useG9Theme().palette;\n const [model, setModel] = useState(props.initial);\n const [query, setQuery] = useState('');\n const picking = useRef(false);\n const { request } = props;\n const visible = model.filter(query, { trim: true });\n const tap = (item: T) => {\n if (picking.current || item.isEnabled === false) return;\n const next = model.toggle(props.keyOf(item));\n setModel(next);\n props.onDraft(next);\n if (!request.multiple && request.closeOnSingleSelection !== false) {\n picking.current = true;\n startTimer(props.onComplete, g9SelectionCloseDelayMs);\n }\n };\n return (\n <view className=\"g9-list-picker\">\n {request.searchPlaceholder ? (\n <view className=\"g9-selection__search\">\n <G9SearchEntry\n placeholder={request.searchPlaceholder}\n voiceEnabled={false}\n onDebouncedValueChange={setQuery}\n />\n </view>\n ) : null}\n {visible.map((item) => (\n <ListPickerRow\n key={props.keyOf(item)}\n item={item}\n selected={model.isSelected(props.keyOf(item))}\n tint={palette.PrimaryContainer}\n onTap={() => tap(item)}\n />\n ))}\n {request.multiple ? (\n <view className=\"g9-list-picker__apply\">\n <G9Button\n text={request.applyButtonText ?? strings.get(G9StringKey.Save)}\n size=\"hero\"\n onPress={props.onComplete}\n />\n </view>\n ) : null}\n </view>\n );\n}\n\nfunction ListPickerRow(props: {\n readonly item: G9SelectionItem;\n readonly selected: boolean;\n readonly tint: string;\n readonly onTap: () => void;\n}): ReactNode {\n const press = useG9Press(props.onTap, {\n source: 'G9ListPicker',\n guardMs: 0,\n blocked: props.item.isEnabled === false,\n });\n const icon = { icon: props.item.icon, imagePath: props.item.iconPath, image: props.item.iconImage };\n const direction = useG9Direction();\n return (\n <view\n className={`g9-list-picker__row${props.selected ? ' g9-list-picker__row--selected' : ''}`}\n style={{ ...g9RowStyle(direction), ...(props.selected ? { backgroundColor: props.tint } : {}) }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={props.item.text}\n bindtap={press}\n >\n {hasIconSlot(icon) ? <G9IconSlot {...icon} size={20} color=\"var(--g9-on-surface-variant)\" /> : null}\n <text className=\"g9-list-picker__text\" text-maxline=\"1\" style={g9TextStart(direction)}>\n {props.item.text}\n </text>\n </view>\n );\n}\n"],"names":["g9SelectionEagerBuildItemLimit","g9SelectionRowHeight","g9SelectionSearchDebounceMs","g9SelectionCloseDelayMs","selectionIdentities","items","counts","Map","item","_counts_get","i","estimateSelectionHeight","count","showSearch","chrome","Math","SelectionRow","props","_item_iconTintColor","_item_swatchFirstColor","_item_swatchSecondColor","palette","useG9Theme","glyphs","useG9Settings","selected","press","useG9Press","icon","iconColor","view","formatColor","withAlpha","g9RowStyle","hasIconSlot","G9IconSlot","G9Swatch","text","g9TextStart","SelectionBody","_request_emptyText","strings","useG9Strings","parentDir","useG9Direction","request","ids","model","setModel","useState","query","setQuery","applied","setApplied","timer","useRef","picking","useEffect","stopTimer","visible","visibleIds","Set","dir","multiple","onQuery","value","startTimer","tap","id","next","G9TextEntry","G9StringKey","_item_key","_request_options","g9ChildId","showSelectionSheet","sheets","_request_selectedItems","opening","openingIds","listedIds","initialKeys","unlisted","_","initial","createSelectionModel","Promise","resolve","draft","draftListeners","draftStore","l","settled","done","startKeys","collect","keys","set","settle","accepted","explicit","result","changed","undefined","k","handle","complete","reset","body","m","options","fitToContentSheetOptions","SelectionHeaderActions","direction","n","useSyncExternalStore","G9Button","showListSheet","_request_selected","keyOf","ListPickerBody","base","fullScreenWithoutHandleSheetOptions","fit","_request_applyButtonText","G9SearchEntry","ListPickerRow"],"mappings":";;;;;;;;;;;;;;AAmBO,MAAMA,iCAAiC;AAEvC,MAAMC,uBAAuB;AAE7B,MAAMC,8BAA8B;AAEpC,MAAMC,0BAA0B;AAiBhC,SAASC,oBAAoBC,KAAqC;IACvE,MAAMC,SAAS,IAAIC;IACnB,KAAK,MAAMC,QAAQH,MAAO;YAC+CI;QAAvE,IAAID,AAAY,QAAZA,KAAK,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IAAI,CAAC,CAAC;IAAE,GAC9F,uBAAuB,MACvB,qBAAqB,SACrB,qBAAqBA,MAAM,IAAI,CAAC,IAAI,EACpC,SAASS,OACV;MACC,CAACQ,YAAYN,SAASO,YAAY,GAAGP,IAAI,EAAE,MAAM,IAAI,MAAM,mCAAoC,KAAK;MACpG,CAACS,KAAK,UAAU,uBAAuB,aAAa,IAAI,OAAOC,YAAY2E,YAAY;QACrF,CAAChG,MAAM,IAAI,CAAC,IAAI,CAAC;MACnB,EAAEoB,KAAK;IACT,EAAEP;AAEN"}
1
+ {"version":3,"file":"selection/selection-sheet.jsx","sources":["../../src/selection/selection-sheet.tsx"],"sourcesContent":["import './selection.css';\nimport { formatColor, G9StringKey, type G9TextInputDirection, withAlpha } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useEffect, useRef, useState, useSyncExternalStore } from '@lynx-js/react';\nimport { g9ChildId, g9RowStyle, g9TextStart } from '../base/control';\nimport { useG9Press } from '../base/press';\nimport type { G9SelectionItem } from '../base/selection-item';\nimport { type G9TimerHandle, startTimer, stopTimer } from '../base/timers';\nimport { G9Button } from '../button/button';\nimport { G9SearchEntry } from '../fields/search-entry';\nimport { G9TextEntry } from '../fields/text-entry';\nimport { G9IconSlot, hasIconSlot } from '../icon/slot';\nimport { G9Swatch } from '../icon/swatch';\nimport { useG9Direction, useG9Settings, useG9Strings, useG9Theme } from '../provider/hooks';\nimport { fitToContentSheetOptions, fullScreenWithoutHandleSheetOptions, type G9SheetOptions } from '../sheet/options';\nimport type { G9SheetService } from '../sheet/service';\nimport type { G9SheetHandle } from '../sheet/stack';\nimport { createSelectionModel, type G9SelectionModel } from './model';\n\n/** MAUI `G9SelectionSheet.EagerBuildItemLimit`: lists up to 40 items are built at once; longer lists defer. */\nexport const g9SelectionEagerBuildItemLimit = 40;\n/** Row height of the selection sheet (MAUI 52). */\nexport const g9SelectionRowHeight = 52;\n/** Search debounce of the selection sheet (MAUI 150 ms). */\nexport const g9SelectionSearchDebounceMs = 150;\n/** Wait after a close-on-select pick before closing (MAUI 120 ms). */\nexport const g9SelectionCloseDelayMs = 120;\n\n/** The outcome of a selection sheet (MAUI `G9SelectionSheetResult`). */\nexport interface G9SelectionSheetResult<T extends G9SelectionItem = G9SelectionItem> {\n /** A pick on a close-on-select sheet, Done, or Reset; `false` for every dismissal. */\n readonly wasAccepted: boolean;\n /** The selection differs from the opening one. */\n readonly selectionChanged: boolean;\n /** The final selection (opening items that are not listed or disabled stay unless deselected). */\n readonly items: ReadonlyArray<T>;\n}\n\n/**\n * The selection identity of an item inside one list (MAUI `G9SelectionSheet.KeyOf`): `k:<key>` when the key is set,\n * else `t:<text>` when the text is unique among key-less items, else the position (`i:<n>`). Keys and texts never\n * match each other.\n */\nexport function selectionIdentities(items: ReadonlyArray<G9SelectionItem>): string[] {\n const counts = new Map<string, number>();\n for (const item of items) {\n if (item.key == null || item.key.trim() === '') counts.set(item.text, (counts.get(item.text) ?? 0) + 1);\n }\n return items.map((item, i) =>\n item.key != null && item.key.trim() !== ''\n ? `k:${item.key}`\n : (counts.get(item.text) ?? 0) > 1\n ? `i:${i}`\n : `t:${item.text}`,\n );\n}\n\n/** Estimated body height (MAUI `EstimateContentHeight`): rows × 52 + chrome, clamped to [2 rows + chrome, 520]. */\nexport function estimateSelectionHeight(count: number, showSearch: boolean): number {\n const chrome = (showSearch ? 64 : 0) + 18;\n return Math.min(520, Math.max(2 * g9SelectionRowHeight + chrome, count * g9SelectionRowHeight + chrome));\n}\n\n/** Arguments of {@link showSelectionSheet} (MAUI `ShowForResultAsync`). */\nexport interface G9SelectionSheetRequest<T extends G9SelectionItem> {\n readonly title: string;\n readonly items: ReadonlyArray<T>;\n readonly selectedItems?: ReadonlyArray<T>;\n readonly allowMultiple?: boolean;\n /** Single mode: a pick completes and closes after 120 ms. Default true. */\n readonly closeOnSingleSelection?: boolean;\n readonly showSearch?: boolean;\n /** No-results text. Default the `noResults` string. */\n readonly emptyText?: string | null;\n /** Row text direction. Default `'matchParent'`. */\n readonly itemTextDirection?: G9TextInputDirection;\n /** A non-empty reset selection adds a Reset toolbar item that completes with it. */\n readonly resetSelection?: ReadonlyArray<T> | null;\n /** Count pill label (multi). Default `\"{n} {selected}\"`. */\n readonly countLabel?: (count: number) => string;\n /**\n * Multi: Done stays disabled until at least this many items are ticked (MAUI `minimumSelected`, G9MAUIControls 1.4.7) —\n * the sheet never closes on an answer the caller would refuse and reopen. Default 0.\n */\n readonly minimumSelected?: number;\n /** Extra sheet options (merged over the defaults). */\n readonly options?: G9SheetOptions;\n}\n\ninterface BodyProps<T extends G9SelectionItem> {\n readonly request: G9SelectionSheetRequest<T>;\n readonly ids: ReadonlyArray<string>;\n readonly initial: G9SelectionModel<T>;\n readonly onComplete: (keys: ReadonlyArray<string>, accepted: boolean) => void;\n readonly onDraft: (model: G9SelectionModel<T>) => void;\n readonly done: { current: boolean };\n}\n\nfunction SelectionRow(props: {\n readonly item: G9SelectionItem;\n /** Element id (`${sheet automationId}_Item_${key}`), so automation finds the row like a person sees it. */\n readonly elementId?: string | undefined;\n readonly selected: boolean;\n readonly direction: 'ltr' | 'rtl';\n readonly onTap: () => void;\n}): ReactNode {\n const palette = useG9Theme().palette;\n const glyphs = useG9Settings().glyphs;\n const { item, selected } = props;\n const press = useG9Press(props.onTap, { blocked: item.isEnabled === false, source: 'G9SelectionSheet', guardMs: 0 });\n const icon = { emoji: item.emoji, icon: item.icon, imagePath: item.iconPath, image: item.iconImage };\n const iconColor = item.iconTintColor ?? (selected ? palette.Primary : palette.TextSecondary);\n return (\n <view\n {...(props.elementId ? { id: props.elementId } : {})}\n className={`g9-selection-row${selected ? ' g9-selection-row--selected' : ''}`}\n style={selected ? { backgroundColor: formatColor(withAlpha(palette.Primary, 0.1)) } : {}}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={item.text}\n {...(selected ? { 'accessibility-value': 'selected' } : {})}\n bindtap={press}\n >\n <view\n className={`g9-selection-row__inner g9-dir-${props.direction}`}\n style={{ ...g9RowStyle(props.direction), ...(item.isEnabled === false ? { opacity: 0.45 } : {}) }}\n >\n {hasIconSlot(icon) ? (\n <G9IconSlot {...icon} size={18} color={iconColor} />\n ) : item.swatchFirstColor?.trim() || item.swatchSecondColor?.trim() ? (\n <G9Swatch first={item.swatchFirstColor} second={item.swatchSecondColor} direction={props.direction} />\n ) : (\n // MAUI's row is a Grid of ColumnSpacing 12 whose icon column stays when empty: its spacing still sits before\n // the text, so an icon-less row's text starts 16 + 12 dp in, level with nothing but the same in every picker.\n <view className=\"g9-selection-row__icon-gap\" />\n )}\n <text\n className=\"g9-selection-row__text\"\n text-maxline=\"1\"\n style={{\n color: selected ? palette.Primary : palette.TextPrimary,\n fontWeight: selected ? 'bold' : 'normal',\n ...g9TextStart(props.direction),\n }}\n >\n {item.text}\n </text>\n <view style={{ opacity: selected ? 1 : 0 }}>\n <G9IconSlot icon={glyphs.check} size={18} color={palette.Primary} />\n </view>\n </view>\n </view>\n );\n}\n\nfunction SelectionBody<T extends G9SelectionItem>(props: BodyProps<T>): ReactNode {\n const strings = useG9Strings();\n const parentDir = useG9Direction();\n const { request, ids } = props;\n const [model, setModel] = useState(props.initial);\n const [query, setQuery] = useState('');\n const [applied, setApplied] = useState('');\n const timer = useRef<G9TimerHandle | null>(null);\n const picking = useRef(false);\n useEffect(\n () => () => {\n if (timer.current !== null) stopTimer(timer.current);\n },\n [],\n );\n const visible = request.showSearch ? model.withItems(request.items).filter(applied) : request.items;\n const visibleIds = new Set(visible.map((item) => ids[request.items.indexOf(item)]));\n const dir =\n request.itemTextDirection === 'leftToRight'\n ? 'ltr'\n : request.itemTextDirection === 'rightToLeft'\n ? 'rtl'\n : parentDir;\n const multiple = request.allowMultiple === true;\n const onQuery = (value: string) => {\n setQuery(value);\n if (timer.current !== null) stopTimer(timer.current);\n if (value.trim() === '') {\n setApplied(value);\n return;\n }\n timer.current = startTimer(() => setApplied(value), g9SelectionSearchDebounceMs);\n };\n const tap = (id: string) => {\n if (props.done.current || picking.current) return;\n const next = model.toggle(id);\n if (next === model) return;\n setModel(next);\n props.onDraft(next);\n if (!multiple && request.closeOnSingleSelection !== false) {\n picking.current = true;\n startTimer(() => props.onComplete(next.selectedKeys, true), g9SelectionCloseDelayMs);\n }\n };\n return (\n <view className=\"g9-selection\">\n {request.showSearch ? (\n <view className=\"g9-selection__search\">\n <G9TextEntry\n placeholder={strings.get(G9StringKey.Search)}\n leadingIcon=\"search\"\n value={query}\n onValueChange={onQuery}\n />\n </view>\n ) : null}\n {visible.length > 0 ? (\n <view className=\"g9-selection__items\">\n {request.items.map((item, i) => {\n const id = ids[i] as string;\n if (!visibleIds.has(id)) return null;\n return (\n <SelectionRow\n key={id}\n item={item}\n elementId={g9ChildId(request.options?.automationId, `Item_${item.key ?? i}`)}\n selected={model.isSelected(id)}\n direction={dir}\n onTap={() => tap(id)}\n />\n );\n })}\n </view>\n ) : null}\n {visible.length === 0 ? (\n <text className=\"g9-selection__empty\">{request.emptyText ?? strings.get(G9StringKey.NoResults)}</text>\n ) : null}\n </view>\n );\n}\n\n/**\n * Shows the selection sheet (MAUI `G9SelectionSheet.ShowForResultAsync`): a fit sheet with a header (title near the\n * close button), optional search (150 ms debounce, text match, hidden selected rows stay selected), rows with icon or\n * swatch, check mark and selection tint. Single mode with `closeOnSingleSelection` completes on a pick; multi mode\n * shows a count pill and Done; a reset selection adds Reset. Any dismissal resolves `wasAccepted: false` with the\n * current draft (or the opening selection when the sheet never built).\n */\nexport function showSelectionSheet<T extends G9SelectionItem>(\n sheets: G9SheetService,\n request: G9SelectionSheetRequest<T>,\n): Promise<G9SelectionSheetResult<T>> {\n const items = [...request.items];\n const ids = selectionIdentities(items);\n const opening = request.selectedItems ?? [];\n // Opening items match listed items by identity; the rest are kept as \"not listed\".\n const openingIds = selectionIdentities([...items, ...opening]).slice(items.length);\n const listedIds = new Set(ids);\n const initialKeys = openingIds.filter((id) => listedIds.has(id));\n const unlisted = opening.filter((_, i) => !listedIds.has(openingIds[i] as string));\n const multiple = request.allowMultiple === true;\n const initial = createSelectionModel<T>({\n items,\n getKey: (item) => ids[items.indexOf(item)] as string,\n getText: (item) => item.text,\n mode: multiple ? 'multiple' : 'single',\n selectedKeys: initialKeys,\n isEnabled: (item) => item.isEnabled !== false,\n });\n return new Promise((resolve) => {\n let draft = initial;\n const draftListeners = new Set<() => void>();\n const draftStore = {\n subscribe: (l: () => void) => {\n draftListeners.add(l);\n return () => {\n draftListeners.delete(l);\n };\n },\n count: () => draft.selectedKeys.length,\n };\n let settled = false;\n const done = { current: false };\n const startKeys = new Set(initialKeys);\n const collect = (keys: ReadonlyArray<string>): T[] => {\n const set = new Set(keys);\n return [...items.filter((_, i) => set.has(ids[i] as string)), ...unlisted];\n };\n const settle = (keys: ReadonlyArray<string>, accepted: boolean, explicit?: ReadonlyArray<T>) => {\n if (settled) return;\n settled = true;\n done.current = true;\n const result = explicit ?? collect(keys);\n const changed = explicit !== undefined || keys.length !== startKeys.size || keys.some((k) => !startKeys.has(k));\n resolve({ wasAccepted: accepted, selectionChanged: changed, items: result });\n };\n let handle: G9SheetHandle | null = null;\n const complete = (keys: ReadonlyArray<string>, accepted: boolean) => {\n settle(keys, accepted);\n handle?.close();\n };\n const reset = request.resetSelection && request.resetSelection.length > 0 ? request.resetSelection : null;\n const body = () => (\n <SelectionBody\n request={request}\n ids={ids}\n initial={initial}\n done={done}\n onDraft={(m) => {\n draft = m;\n for (const l of [...draftListeners]) l();\n }}\n onComplete={complete}\n />\n );\n const options: G9SheetOptions = {\n ...fitToContentSheetOptions(),\n deferContent: items.length > g9SelectionEagerBuildItemLimit,\n deferredLoadingPlaceholderHeight: estimateSelectionHeight(items.length, request.showSearch === true),\n loadingSkeleton: 'listRows',\n loadingSkeletonRowCount: items.length,\n backgroundColor: 'var(--g9-surface)',\n showToolbar: true,\n showCloseButton: true,\n title: request.title,\n headerTitlePlacement: 'nearBack',\n ...(multiple || reset\n ? {\n headerTrailingView: (\n <SelectionHeaderActions\n multiple={multiple}\n draft={draftStore}\n minimum={Math.max(0, request.minimumSelected ?? 0)}\n {...(request.countLabel ? { countLabel: request.countLabel } : {})}\n onDone={() => {\n if (draft.selectedKeys.length >= Math.max(0, request.minimumSelected ?? 0))\n complete(draft.selectedKeys, true);\n }}\n {...(reset\n ? {\n onReset: () => {\n settle([], true, reset);\n handle?.close();\n },\n }\n : {})}\n />\n ),\n }\n : {}),\n ...request.options,\n onClosed: () => {\n request.options?.onClosed?.();\n settle(draft.selectedKeys, false);\n },\n };\n handle = sheets.show(items.length > g9SelectionEagerBuildItemLimit ? body : body(), options);\n if (!handle) settle(initialKeys, false);\n });\n}\n\nfunction SelectionHeaderActions(props: {\n readonly multiple: boolean;\n readonly draft: { subscribe(listener: () => void): () => void; count(): number };\n readonly minimum: number;\n readonly countLabel?: (n: number) => string;\n readonly onDone: () => void;\n readonly onReset?: () => void;\n}): ReactNode {\n const strings = useG9Strings();\n const direction = useG9Direction();\n const n = useSyncExternalStore(props.draft.subscribe, props.draft.count);\n return (\n <view className=\"g9-selection__actions\" style={g9RowStyle(direction)}>\n {props.onReset ? (\n <G9Button text={strings.get(G9StringKey.Reset)} variant=\"text\" size=\"small\" onPress={props.onReset} />\n ) : null}\n {props.multiple && n > 0 ? (\n <view className=\"g9-selection__count\">\n <text className=\"g9-selection__count-text\">\n {props.countLabel ? props.countLabel(n) : `${n} ${strings.get(G9StringKey.Selected)}`}\n </text>\n </view>\n ) : null}\n {props.multiple ? (\n <G9Button\n text={strings.get(G9StringKey.Done)}\n variant=\"text\"\n size=\"small\"\n disabled={n < props.minimum}\n onPress={props.onDone}\n />\n ) : null}\n </view>\n );\n}\n\n/** Arguments of {@link showListSheet} (MAUI `ShowListG9BottomSheetAsync`). */\nexport interface G9ListSheetRequest<T extends G9SelectionItem> {\n readonly title: string;\n readonly items: ReadonlyArray<T>;\n readonly selected?: ReadonlyArray<T>;\n readonly multiple?: boolean;\n /** Default true. */\n readonly closeOnSingleSelection?: boolean;\n /** Shows the search field (250 ms debounce, trimmed) with this placeholder. */\n readonly searchPlaceholder?: string | null;\n /** Default full screen without a handle (MAUI). A fit-to-content `sizeMode` keeps the sheet compact. */\n readonly options?: G9SheetOptions;\n /** Apply button text (multi). Default the `save` string. */\n readonly applyButtonText?: string;\n}\n\n/**\n * The shared list picker (MAUI `ShowListG9BottomSheetAsync` / `G9BottomSheetListPickerModal`): search field with\n * placeholder, rows with a selection tint (no check mark), Apply in multi mode, close-on-select after 120 ms. Resolves\n * with the selection when it completes or closes (no accepted/dismissed distinction, as MAUI); `[]` when throttled.\n */\nexport function showListSheet<T extends G9SelectionItem>(\n sheets: G9SheetService,\n request: G9ListSheetRequest<T>,\n): Promise<T[]> {\n const items = [...request.items];\n const keyOf = (item: G9SelectionItem) => (item.key != null && item.key.trim() !== '' ? item.key : item.text);\n const multiple = request.multiple === true;\n const initial = createSelectionModel<T>({\n items,\n getKey: keyOf,\n getText: (item) => item.text,\n mode: multiple ? 'multiple' : 'single',\n selectedKeys: (request.selected ?? []).map(keyOf),\n isEnabled: (item) => item.isEnabled !== false,\n });\n return new Promise((resolve) => {\n let draft = initial;\n let settled = false;\n let handle: G9SheetHandle | null = null;\n const settle = () => {\n if (settled) return;\n settled = true;\n resolve(draft.selectedItems());\n };\n const complete = () => {\n settle();\n handle?.close();\n };\n const body = () => (\n <ListPickerBody\n request={request}\n initial={initial}\n keyOf={keyOf}\n onDraft={(m) => {\n draft = m;\n }}\n onComplete={complete}\n />\n );\n const base = request.options ?? fullScreenWithoutHandleSheetOptions();\n const fit = base.sizeMode === 'fitToContent';\n const options: G9SheetOptions = {\n ...base,\n ...(fit\n ? {}\n : {\n states: ['large'],\n currentState: 'large',\n hasHandle: false,\n isDraggable: true,\n useFullScreenLoadingPlaceholder: true,\n }),\n showToolbar: true,\n showCloseButton: true,\n title: request.title,\n headerTitlePlacement: 'nearBack',\n deferContent: true,\n onClosed: () => {\n base.onClosed?.();\n settle();\n },\n };\n handle = sheets.show(body, options);\n if (!handle) {\n settled = true;\n resolve([]);\n }\n });\n}\n\nfunction ListPickerBody<T extends G9SelectionItem>(props: {\n readonly request: G9ListSheetRequest<T>;\n readonly initial: G9SelectionModel<T>;\n readonly keyOf: (item: G9SelectionItem) => string;\n readonly onDraft: (model: G9SelectionModel<T>) => void;\n readonly onComplete: () => void;\n}): ReactNode {\n const strings = useG9Strings();\n const palette = useG9Theme().palette;\n const [model, setModel] = useState(props.initial);\n const [query, setQuery] = useState('');\n const picking = useRef(false);\n const { request } = props;\n const visible = model.filter(query, { trim: true });\n const tap = (item: T) => {\n if (picking.current || item.isEnabled === false) return;\n const next = model.toggle(props.keyOf(item));\n setModel(next);\n props.onDraft(next);\n if (!request.multiple && request.closeOnSingleSelection !== false) {\n picking.current = true;\n startTimer(props.onComplete, g9SelectionCloseDelayMs);\n }\n };\n return (\n <view className=\"g9-list-picker\">\n {request.searchPlaceholder ? (\n <view className=\"g9-selection__search\">\n <G9SearchEntry\n placeholder={request.searchPlaceholder}\n voiceEnabled={false}\n onDebouncedValueChange={setQuery}\n />\n </view>\n ) : null}\n {visible.map((item) => (\n <ListPickerRow\n key={props.keyOf(item)}\n item={item}\n selected={model.isSelected(props.keyOf(item))}\n tint={palette.PrimaryContainer}\n onTap={() => tap(item)}\n />\n ))}\n {request.multiple ? (\n <view className=\"g9-list-picker__apply\">\n <G9Button\n text={request.applyButtonText ?? strings.get(G9StringKey.Save)}\n size=\"hero\"\n onPress={props.onComplete}\n />\n </view>\n ) : null}\n </view>\n );\n}\n\nfunction ListPickerRow(props: {\n readonly item: G9SelectionItem;\n readonly selected: boolean;\n readonly tint: string;\n readonly onTap: () => void;\n}): ReactNode {\n const press = useG9Press(props.onTap, {\n source: 'G9ListPicker',\n guardMs: 0,\n blocked: props.item.isEnabled === false,\n });\n const icon = { icon: props.item.icon, imagePath: props.item.iconPath, image: props.item.iconImage };\n const direction = useG9Direction();\n return (\n <view\n className={`g9-list-picker__row${props.selected ? ' g9-list-picker__row--selected' : ''}`}\n style={{ ...g9RowStyle(direction), ...(props.selected ? { backgroundColor: props.tint } : {}) }}\n accessibility-element={true}\n accessibility-traits=\"button\"\n accessibility-label={props.item.text}\n bindtap={press}\n >\n {hasIconSlot(icon) ? <G9IconSlot {...icon} size={20} color=\"var(--g9-on-surface-variant)\" /> : null}\n <text className=\"g9-list-picker__text\" text-maxline=\"1\" style={g9TextStart(direction)}>\n {props.item.text}\n </text>\n </view>\n );\n}\n"],"names":["g9SelectionEagerBuildItemLimit","g9SelectionRowHeight","g9SelectionSearchDebounceMs","g9SelectionCloseDelayMs","selectionIdentities","items","counts","Map","item","_counts_get","i","estimateSelectionHeight","count","showSearch","chrome","Math","SelectionRow","props","_item_iconTintColor","_item_swatchFirstColor","_item_swatchSecondColor","palette","useG9Theme","glyphs","useG9Settings","selected","press","useG9Press","icon","iconColor","view","formatColor","withAlpha","g9RowStyle","hasIconSlot","G9IconSlot","G9Swatch","text","g9TextStart","SelectionBody","_request_emptyText","strings","useG9Strings","parentDir","useG9Direction","request","ids","model","setModel","useState","query","setQuery","applied","setApplied","timer","useRef","picking","useEffect","stopTimer","visible","visibleIds","Set","dir","multiple","onQuery","value","startTimer","tap","id","next","G9TextEntry","G9StringKey","_item_key","_request_options","g9ChildId","showSelectionSheet","sheets","_request_selectedItems","opening","openingIds","listedIds","initialKeys","unlisted","_","initial","createSelectionModel","Promise","resolve","_request_minimumSelected","draft","draftListeners","draftStore","l","settled","done","startKeys","collect","keys","set","settle","accepted","explicit","result","changed","undefined","k","handle","complete","reset","body","m","options","fitToContentSheetOptions","SelectionHeaderActions","direction","n","useSyncExternalStore","G9Button","showListSheet","_request_selected","keyOf","ListPickerBody","base","fullScreenWithoutHandleSheetOptions","fit","_request_applyButtonText","G9SearchEntry","ListPickerRow"],"mappings":";;;;;;;;;;;;;;AAmBO,MAAMA,iCAAiC;AAEvC,MAAMC,uBAAuB;AAE7B,MAAMC,8BAA8B;AAEpC,MAAMC,0BAA0B;AAiBhC,SAASC,oBAAoBC,KAAqC;IACvE,MAAMC,SAAS,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