@g9tm/lynxcontrols 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/fields/search-entry.d.ts +7 -1
- package/dist/fields/search-entry.d.ts.map +1 -1
- package/dist/fields/search-entry.jsx +16 -4
- package/dist/fields/search-entry.jsx.map +1 -1
- package/dist/fields/use-text-input.d.ts +1 -1
- package/dist/fields/use-text-input.d.ts.map +1 -1
- package/dist/fields/use-text-input.jsx +28 -1
- package/dist/fields/use-text-input.jsx.map +1 -1
- package/dist/guide/confirm-sheet.d.ts +26 -0
- package/dist/guide/confirm-sheet.d.ts.map +1 -0
- package/dist/guide/confirm-sheet.jsx +146 -0
- package/dist/guide/confirm-sheet.jsx.map +1 -0
- package/dist/guide/guide.css +63 -88
- package/dist/guide/guide.css.map +1 -1
- package/dist/guide/journey.d.ts.map +1 -1
- package/dist/guide/journey.jsx +10 -12
- package/dist/guide/journey.jsx.map +1 -1
- package/dist/guide/service.d.ts +11 -1
- package/dist/guide/service.d.ts.map +1 -1
- package/dist/guide/service.jsx +44 -98
- package/dist/guide/service.jsx.map +1 -1
- package/dist/guide/settings.d.ts +20 -2
- package/dist/guide/settings.d.ts.map +1 -1
- package/dist/guide/settings.jsx +10 -4
- package/dist/guide/settings.jsx.map +1 -1
- package/dist/sheet/frame.d.ts.map +1 -1
- package/dist/sheet/frame.jsx +2 -1
- package/dist/sheet/frame.jsx.map +1 -1
- package/package.json +2 -2
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
import { G9StringKey, createAbortController, isAbortError } from "@g9tm/lynxcontrols-foundation";
|
|
2
|
-
import { forwardRef, useEffect, useImperativeHandle, useRef } from "@lynx-js/react";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "@lynx-js/react";
|
|
3
3
|
import { startTimer, stopTimer } from "../base/timers.jsx";
|
|
4
4
|
import { useControllableState } from "../base/use-controllable-state.jsx";
|
|
5
5
|
import { useG9Diagnostics, useG9Settings, useG9Strings } from "../provider/hooks.jsx";
|
|
6
6
|
import { TextEntryBody } from "./text-entry.jsx";
|
|
7
7
|
const search_entry_G9SearchEntry = forwardRef(function(props, ref) {
|
|
8
|
-
var _props_defaultValue, _props_clearButton, _props_voiceEnabled, _props_reserveFloatingLabelClearance;
|
|
8
|
+
var _props_defaultValue, _props_value, _props_clearButton, _props_voiceEnabled, _props_reserveFloatingLabelClearance;
|
|
9
9
|
const glyphs = useG9Settings().glyphs;
|
|
10
10
|
const strings = useG9Strings();
|
|
11
11
|
const diagnostics = useG9Diagnostics();
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const follows = void 0 !== props.value && void 0 === props.onValueChange;
|
|
13
|
+
const [controllable, setControllable] = useControllableState({
|
|
14
|
+
value: follows ? void 0 : props.value,
|
|
14
15
|
defaultValue: null != (_props_defaultValue = props.defaultValue) ? _props_defaultValue : '',
|
|
15
16
|
onChange: props.onValueChange,
|
|
16
17
|
name: 'G9SearchEntry.value'
|
|
17
18
|
});
|
|
19
|
+
const [typed, setTyped] = useState(null != (_props_value = props.value) ? _props_value : '');
|
|
20
|
+
useEffect(()=>{
|
|
21
|
+
if (follows && void 0 !== props.value) setTyped(props.value);
|
|
22
|
+
}, [
|
|
23
|
+
props.value
|
|
24
|
+
]);
|
|
25
|
+
const text = follows ? typed : controllable;
|
|
26
|
+
const setText = (value, details)=>{
|
|
27
|
+
if (follows) setTyped(value);
|
|
28
|
+
else setControllable(value, details);
|
|
29
|
+
};
|
|
18
30
|
const latest = useRef({
|
|
19
31
|
text,
|
|
20
32
|
props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields/search-entry.jsx","sources":["../../src/fields/search-entry.tsx"],"sourcesContent":["import {\n createAbortController,\n type G9AbortController,\n type G9AbortSignal,\n G9StringKey,\n isAbortError,\n} from '@g9tm/lynxcontrols-foundation';\nimport { forwardRef, type ReactNode, useEffect, useImperativeHandle, useRef } from '@lynx-js/react';\nimport { type G9TimerHandle, startTimer, stopTimer } from '../base/timers';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { useG9Diagnostics, useG9Settings, useG9Strings } from '../provider/hooks';\nimport { type G9EntryVariant, type G9TextEntryHandle, type G9TextEntryProps, TextEntryBody } from './text-entry';\nimport type { G9ValueChangeDetails } from './use-text-input';\n\n/** Context of one search (`onSearch`). */\nexport interface G9SearchContext {\n /** Aborted when a newer query fires or the field unmounts: drop this query's results. */\n readonly signal: G9AbortSignal;\n /** Increases with every fired query; compare to discard a stale result. */\n readonly version: number;\n}\n\n/** Props of {@link G9SearchEntry} (MAUI `G9SearchEntry`). */\nexport interface G9SearchEntryProps extends G9TextEntryProps {\n /** Quiet time after the last change before the query fires; `0` fires on every change. Default 250. */\n readonly debounceMs?: number;\n /** The debounced text (MAUI `DebouncedTextChanged`). */\n readonly onDebouncedValueChange?: (value: string) => void;\n /**\n * Runs the search (MAUI `SearchCommand`): after the debounce, on the keyboard's search key and on `submit()`.\n * A newer query aborts the previous one's signal (query versioning). A thrown error or rejected promise (other\n * than an abort) goes to the provider's diagnostics.\n */\n readonly onSearch?: (query: string, context: G9SearchContext) => unknown;\n}\n\n/** Imperative handle of {@link G9SearchEntry}. */\nexport interface G9SearchEntryHandle extends G9TextEntryHandle {\n /** Fires the current text now, skipping the debounce (MAUI `Submit`). */\n submit(): void;\n}\n\n/**\n * Search field (MAUI `G9SearchEntry`): a `G9TextEntry` with a leading search glyph, the clear button, dictation on,\n * the localized `search` placeholder, the floating-label clearance reserved, the keyboard's search key, and a\n * debounced query. Every change of the text (typing, dictation, clear, a new `value` from the parent) restarts the\n * debounce; the search key and `submit()` fire at once. Pending queries never fire after unmount.\n */\nexport const G9SearchEntry = forwardRef<G9SearchEntryHandle, G9SearchEntryProps>(\n function G9SearchEntry(props, ref): ReactNode {\n const glyphs = useG9Settings().glyphs;\n const strings = useG9Strings();\n const diagnostics = useG9Diagnostics();\n const [text, setText] = useControllableState<string, [G9ValueChangeDetails]>({\n value: props.value,\n defaultValue: props.defaultValue ?? '',\n onChange: props.onValueChange,\n name: 'G9SearchEntry.value',\n });\n const latest = useRef({ text, props });\n latest.current = { text, props };\n const timer = useRef<G9TimerHandle | null>(null);\n const current = useRef<G9AbortController | null>(null);\n const version = useRef(0);\n const inner = useRef<G9TextEntryHandle | null>(null);\n\n const stopDebounce = () => {\n if (timer.current !== null) {\n stopTimer(timer.current);\n timer.current = null;\n }\n };\n const report = (error: unknown) => {\n if (isAbortError(error)) return;\n diagnostics.log({ level: 'error', message: 'G9SearchEntry.onSearch failed.', source: 'G9SearchEntry', error });\n };\n const fire = (value: string) => {\n const p = latest.current.props;\n current.current?.abort();\n const controller = createAbortController();\n current.current = controller;\n version.current += 1;\n try {\n p.onDebouncedValueChange?.(value);\n const result = p.onSearch?.(value, { signal: controller.signal, version: version.current });\n if (result && typeof (result as PromiseLike<unknown>).then === 'function') {\n (result as PromiseLike<unknown>).then(undefined, report);\n }\n } catch (error) {\n report(error);\n }\n };\n const submit = () => {\n stopDebounce();\n fire(latest.current.text);\n };\n\n const first = useRef(true);\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n const ms = latest.current.props.debounceMs ?? 250;\n stopDebounce();\n if (ms <= 0) {\n fire(text);\n return;\n }\n timer.current = startTimer(() => {\n timer.current = null;\n fire(latest.current.text);\n }, ms);\n }, [text]);\n\n useEffect(\n () => () => {\n stopDebounce();\n current.current?.abort();\n },\n [],\n );\n\n useImperativeHandle(ref, () => {\n const base = inner.current as G9TextEntryHandle;\n return {\n focus: () => base.focus(),\n blur: () => base.blur(),\n validate: () => base.validate(),\n get isListening() {\n return base.isListening;\n },\n toggleVoice: () => base.toggleVoice(),\n startVoice: () => base.startVoice(),\n stopVoice: () => base.stopVoice(),\n get element() {\n return base.element;\n },\n submit,\n };\n });\n\n const variant: G9EntryVariant = {\n name: 'G9SearchEntry.value',\n restingTone: 'placeholder',\n confirmType: 'search',\n onConfirm: submit,\n };\n return (\n <TextEntryBody\n {...props}\n leadingIcon={props.leadingIcon === undefined ? glyphs.search : props.leadingIcon}\n clearButton={props.clearButton ?? true}\n voiceEnabled={props.voiceEnabled ?? true}\n placeholder={props.placeholder === undefined ? strings.get(G9StringKey.Search) : props.placeholder}\n reserveFloatingLabelClearance={props.reserveFloatingLabelClearance ?? true}\n value={text}\n onValueChange={(value, details) => setText(value, details)}\n variant={variant}\n ref={inner}\n />\n );\n },\n);\n"],"names":["G9SearchEntry","forwardRef","props","ref","_props_defaultValue","_props_clearButton","_props_voiceEnabled","_props_reserveFloatingLabelClearance","glyphs","useG9Settings","strings","useG9Strings","diagnostics","useG9Diagnostics","text","setText","useControllableState","latest","useRef","timer","current","version","inner","stopDebounce","stopTimer","report","error","isAbortError","fire","value","_current_current","p","controller","createAbortController","result","undefined","submit","first","useEffect","_latest_current_props_debounceMs","ms","startTimer","useImperativeHandle","base","variant","TextEntryBody","G9StringKey","details"],"mappings":";;;;;;AAgDO,MAAMA,6BAAgBC,WAC3B,SAAuBC,KAAK,EAAEC,GAAG;QAMfC,qBAiGCC,oBACCC,qBAEiBC;IAzGnC,MAAMC,SAASC,gBAAgB,MAAM;IACrC,MAAMC,UAAUC;IAChB,MAAMC,cAAcC;IACpB,MAAM,CAACC,MAAMC,QAAQ,GAAGC,qBAAqD;QAC3E,OAAOd,MAAM,KAAK;QAClB,cAAc,QAAAE,CAAAA,sBAAAA,MAAM,YAAY,AAAD,IAAjBA,sBAAsB;QACpC,UAAUF,MAAM,aAAa;QAC7B,MAAM;IACR;IACA,MAAMe,SAASC,OAAO;QAAEJ;QAAMZ;IAAM;IACpCe,OAAO,OAAO,GAAG;QAAEH;QAAMZ;IAAM;IAC/B,MAAMiB,QAAQD,OAA6B;IAC3C,MAAME,UAAUF,OAAiC;IACjD,MAAMG,UAAUH,OAAO;IACvB,MAAMI,QAAQJ,OAAiC;IAE/C,MAAMK,eAAe;QACnB,IAAIJ,AAAkB,SAAlBA,MA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.tsx"],"sourcesContent":["import {\n createAbortController,\n type G9AbortController,\n type G9AbortSignal,\n G9StringKey,\n isAbortError,\n} from '@g9tm/lynxcontrols-foundation';\nimport { forwardRef, type ReactNode, useEffect, useImperativeHandle, useRef, useState } from '@lynx-js/react';\nimport { type G9TimerHandle, startTimer, stopTimer } from '../base/timers';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { useG9Diagnostics, useG9Settings, useG9Strings } from '../provider/hooks';\nimport { type G9EntryVariant, type G9TextEntryHandle, type G9TextEntryProps, TextEntryBody } from './text-entry';\nimport type { G9ValueChangeDetails } from './use-text-input';\n\n/** Context of one search (`onSearch`). */\nexport interface G9SearchContext {\n /** Aborted when a newer query fires or the field unmounts: drop this query's results. */\n readonly signal: G9AbortSignal;\n /** Increases with every fired query; compare to discard a stale result. */\n readonly version: number;\n}\n\n/**\n * Props of {@link G9SearchEntry} (MAUI `G9SearchEntry`).\n *\n * `value` WITHOUT `onValueChange` is the query the parent knows (it learns the typing through `onSearch`, MAUI's two-way\n * `Text` binding): the field keeps what is typed itself and follows `value` whenever the parent changes it (a reset, a\n * restored filter). With `onValueChange` it is an ordinary controlled field.\n */\nexport interface G9SearchEntryProps extends G9TextEntryProps {\n /** Quiet time after the last change before the query fires; `0` fires on every change. Default 250. */\n readonly debounceMs?: number;\n /** The debounced text (MAUI `DebouncedTextChanged`). */\n readonly onDebouncedValueChange?: (value: string) => void;\n /**\n * Runs the search (MAUI `SearchCommand`): after the debounce, on the keyboard's search key and on `submit()`.\n * A newer query aborts the previous one's signal (query versioning). A thrown error or rejected promise (other\n * than an abort) goes to the provider's diagnostics.\n */\n readonly onSearch?: (query: string, context: G9SearchContext) => unknown;\n}\n\n/** Imperative handle of {@link G9SearchEntry}. */\nexport interface G9SearchEntryHandle extends G9TextEntryHandle {\n /** Fires the current text now, skipping the debounce (MAUI `Submit`). */\n submit(): void;\n}\n\n/**\n * Search field (MAUI `G9SearchEntry`): a `G9TextEntry` with a leading search glyph, the clear button, dictation on,\n * the localized `search` placeholder, the floating-label clearance reserved, the keyboard's search key, and a\n * debounced query. Every change of the text (typing, dictation, clear, a new `value` from the parent) restarts the\n * debounce; the search key and `submit()` fire at once. Pending queries never fire after unmount.\n */\nexport const G9SearchEntry = forwardRef<G9SearchEntryHandle, G9SearchEntryProps>(\n function G9SearchEntry(props, ref): ReactNode {\n const glyphs = useG9Settings().glyphs;\n const strings = useG9Strings();\n const diagnostics = useG9Diagnostics();\n // `value` without `onValueChange`: the parent hears the typing only through `onSearch`. Held as a controlled value\n // the field showed the parent's old text after every keystroke — nothing could be typed into AgriPad's five search\n // fields on a phone (2026-11-12; QA set the value directly and never noticed).\n const follows = props.value !== undefined && props.onValueChange === undefined;\n const [controllable, setControllable] = useControllableState<string, [G9ValueChangeDetails]>({\n value: follows ? undefined : props.value,\n defaultValue: props.defaultValue ?? '',\n onChange: props.onValueChange,\n name: 'G9SearchEntry.value',\n });\n const [typed, setTyped] = useState(props.value ?? '');\n useEffect(() => {\n if (follows && props.value !== undefined) setTyped(props.value);\n }, [props.value]);\n const text = follows ? typed : controllable;\n const setText = (value: string, details: G9ValueChangeDetails) => {\n if (follows) setTyped(value);\n else setControllable(value, details);\n };\n const latest = useRef({ text, props });\n latest.current = { text, props };\n const timer = useRef<G9TimerHandle | null>(null);\n const current = useRef<G9AbortController | null>(null);\n const version = useRef(0);\n const inner = useRef<G9TextEntryHandle | null>(null);\n\n const stopDebounce = () => {\n if (timer.current !== null) {\n stopTimer(timer.current);\n timer.current = null;\n }\n };\n const report = (error: unknown) => {\n if (isAbortError(error)) return;\n diagnostics.log({ level: 'error', message: 'G9SearchEntry.onSearch failed.', source: 'G9SearchEntry', error });\n };\n const fire = (value: string) => {\n const p = latest.current.props;\n current.current?.abort();\n const controller = createAbortController();\n current.current = controller;\n version.current += 1;\n try {\n p.onDebouncedValueChange?.(value);\n const result = p.onSearch?.(value, { signal: controller.signal, version: version.current });\n if (result && typeof (result as PromiseLike<unknown>).then === 'function') {\n (result as PromiseLike<unknown>).then(undefined, report);\n }\n } catch (error) {\n report(error);\n }\n };\n const submit = () => {\n stopDebounce();\n fire(latest.current.text);\n };\n\n const first = useRef(true);\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n const ms = latest.current.props.debounceMs ?? 250;\n stopDebounce();\n if (ms <= 0) {\n fire(text);\n return;\n }\n timer.current = startTimer(() => {\n timer.current = null;\n fire(latest.current.text);\n }, ms);\n }, [text]);\n\n useEffect(\n () => () => {\n stopDebounce();\n current.current?.abort();\n },\n [],\n );\n\n useImperativeHandle(ref, () => {\n const base = inner.current as G9TextEntryHandle;\n return {\n focus: () => base.focus(),\n blur: () => base.blur(),\n validate: () => base.validate(),\n get isListening() {\n return base.isListening;\n },\n toggleVoice: () => base.toggleVoice(),\n startVoice: () => base.startVoice(),\n stopVoice: () => base.stopVoice(),\n get element() {\n return base.element;\n },\n submit,\n };\n });\n\n const variant: G9EntryVariant = {\n name: 'G9SearchEntry.value',\n restingTone: 'placeholder',\n confirmType: 'search',\n onConfirm: submit,\n };\n return (\n <TextEntryBody\n {...props}\n leadingIcon={props.leadingIcon === undefined ? glyphs.search : props.leadingIcon}\n clearButton={props.clearButton ?? true}\n voiceEnabled={props.voiceEnabled ?? true}\n placeholder={props.placeholder === undefined ? strings.get(G9StringKey.Search) : props.placeholder}\n reserveFloatingLabelClearance={props.reserveFloatingLabelClearance ?? true}\n value={text}\n onValueChange={(value, details) => setText(value, details)}\n variant={variant}\n ref={inner}\n />\n );\n },\n);\n"],"names":["G9SearchEntry","forwardRef","props","ref","_props_defaultValue","_props_value","_props_clearButton","_props_voiceEnabled","_props_reserveFloatingLabelClearance","glyphs","useG9Settings","strings","useG9Strings","diagnostics","useG9Diagnostics","follows","undefined","controllable","setControllable","useControllableState","typed","setTyped","useState","useEffect","text","setText","value","details","latest","useRef","timer","current","version","inner","stopDebounce","stopTimer","report","error","isAbortError","fire","_current_current","p","controller","createAbortController","result","submit","first","_latest_current_props_debounceMs","ms","startTimer","useIm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K;IAETD,UACE,IAAM;gBAEJiB;YADAN;oBACAM,CAAAA,mBAAAA,QAAQ,OAAO,AAAD,KAAdA,iBAAiB,KAAK;QACxB,GACA,EAAE;IAGJU,oBAAoB/C,KAAK;QACvB,MAAMgD,OAAOlB,MAAM,OAAO;QAC1B,OAAO;YACL,OAAO,IAAMkB,KAAK,KAAK;YACvB,MAAM,IAAMA,KAAK,IAAI;YACrB,UAAU,IAAMA,KAAK,QAAQ;YAC7B,IAAI;gBACF,OAAOA,KAAK,WAAW;YACzB;YACA,aAAa,IAAMA,KAAK,WAAW;YACnC,YAAY,IAAMA,KAAK,UAAU;YACjC,WAAW,IAAMA,KAAK,SAAS;YAC/B,IAAI;gBACF,OAAOA,KAAK,OAAO;YACrB;YACAN;QACF;IACF;IAEA,MAAMO,UAA0B;QAC9B,MAAM;QACN,aAAa;QACb,aAAa;QACb,WAAWP;IACb;IACA,QACGQ,eACE,GAAGnD,KAAK,EACT,aAAaA,AAAsBc,WAAtBd,MAAM,WAAW,GAAiBO,OAAO,MAAM,GAAGP,MAAM,WAAW,EAChF,aAAa,QAAAI,CAAAA,qBAAAA,MAAM,WAAW,AAAD,IAAhBA,qBAAqB,MAClC,cAAc,QAAAC,CAAAA,sBAAAA,MAAM,YAAY,AAAD,IAAjBA,sBAAsB,MACpC,aAAaL,AAAsBc,WAAtBd,MAAM,WAAW,GAAiBS,QAAQ,GAAG,CAAC2C,YAAY,MAAM,IAAIpD,MAAM,WAAW,EAClG,+BAA+B,QAAAM,CAAAA,uCAAAA,MAAM,6BAA6B,AAAD,IAAlCA,uCAAuC,MACtE,OAAOgB,MACP,eAAe,CAACE,OAAOC,UAAYF,QAAQC,OAAOC,UAClD,SAASyB,SACT,KAAKnB;AAGX"}
|
|
@@ -156,7 +156,7 @@ export declare function useTextInput(props: G9TextInputProps, options: G9TextInp
|
|
|
156
156
|
ref: (node: NodesRef | null) => void;
|
|
157
157
|
'data-g9keyboard': "target";
|
|
158
158
|
};
|
|
159
|
-
textDirection: "
|
|
159
|
+
textDirection: "rtl" | "ltr";
|
|
160
160
|
font: string | undefined;
|
|
161
161
|
};
|
|
162
162
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-text-input.d.ts","sourceRoot":"","sources":["../../src/fields/use-text-input.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,cAAc,EACnB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAW/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,aAAa,CAAC;AAErE,yDAAyD;AACzD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,cAAc,CAAC;AAElF,kCAAkC;AAClC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAED,mHAAmH;AACnH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC5D,sGAAsG;IACtG,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAChF,oHAAoH;IACpH,QAAQ,CAAC,YAAY,CAAC,EAAE,cAAc,CAAC;IACvC,2FAA2F;IAC3F,QAAQ,CAAC,SAAS,CAAC,EAAE,WAAW,CAAC;IACjC,uFAAuF;IACvF,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,wFAAwF;IACxF,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM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,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,sBAAsB;;;;;;;;;;;;;;;;IAgPjF,4EAA4E;;;;;;2BAnItD;YAAE,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE;;;;;;;oBAnBnB,QAAQ,GAAG,IAAI;;;;;EAyK7C"}
|
|
@@ -66,6 +66,7 @@ function useTextInput(props, options) {
|
|
|
66
66
|
const elementRef = useRef(null);
|
|
67
67
|
const native = useRef('');
|
|
68
68
|
const composingRef = useRef(false);
|
|
69
|
+
const composedFrom = useRef(null);
|
|
69
70
|
const [focused, setFocused] = useState(false);
|
|
70
71
|
const focusedRef = useRef(false);
|
|
71
72
|
const [passwordVisible, setPasswordVisible] = useState(false);
|
|
@@ -117,6 +118,7 @@ function useTextInput(props, options) {
|
|
|
117
118
|
const sync = ()=>{
|
|
118
119
|
const value = latestText.current;
|
|
119
120
|
if (native.current === value) return;
|
|
121
|
+
if (composingRef.current && composedFrom.current === value) return;
|
|
120
122
|
if (invokeNode(elementRef, 'setValue', {
|
|
121
123
|
value
|
|
122
124
|
})) {
|
|
@@ -159,7 +161,20 @@ function useTextInput(props, options) {
|
|
|
159
161
|
composingRef.current = composing;
|
|
160
162
|
if (echo) return;
|
|
161
163
|
native.current = raw;
|
|
162
|
-
if (composing)
|
|
164
|
+
if (composing) {
|
|
165
|
+
const kept = sanitize(raw) === raw;
|
|
166
|
+
if (kept) {
|
|
167
|
+
latestText.current = raw;
|
|
168
|
+
setText(raw, {
|
|
169
|
+
source: 'user'
|
|
170
|
+
});
|
|
171
|
+
if (options.validateOnTextChanged) runValidation(raw);
|
|
172
|
+
}
|
|
173
|
+
composedFrom.current = latestText.current;
|
|
174
|
+
bump((n)=>n + 1);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
composedFrom.current = null;
|
|
163
178
|
const clean = sanitize(raw);
|
|
164
179
|
latestText.current = clean;
|
|
165
180
|
setText(clean, {
|
|
@@ -180,6 +195,18 @@ function useTextInput(props, options) {
|
|
|
180
195
|
var _keyboardAware_onInputBlurred, _props_onBlur;
|
|
181
196
|
focusedRef.current = false;
|
|
182
197
|
setFocused(false);
|
|
198
|
+
if (composingRef.current) {
|
|
199
|
+
composingRef.current = false;
|
|
200
|
+
composedFrom.current = null;
|
|
201
|
+
const clean = sanitize(native.current);
|
|
202
|
+
if (clean !== latestText.current) {
|
|
203
|
+
latestText.current = clean;
|
|
204
|
+
setText(clean, {
|
|
205
|
+
source: 'user'
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
bump((n)=>n + 1);
|
|
209
|
+
}
|
|
183
210
|
null == (_keyboardAware_onInputBlurred = keyboardAware.onInputBlurred) || _keyboardAware_onInputBlurred.call(keyboardAware);
|
|
184
211
|
if (hasRule && '' !== latestText.current) runValidation(latestText.current);
|
|
185
212
|
null == (_props_onBlur = props.onBlur) || _props_onBlur.call(props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields/use-text-input.jsx","sources":["../../src/fields/use-text-input.ts"],"sourcesContent":["import {\n G9InputType,\n type G9KeyboardType,\n G9NumberingSystem,\n G9TextInputDirection,\n} from '@g9tm/lynxcontrols-foundation';\nimport { KeyboardAwareTriggerContext } from '@lynx-js/lynx-ui-input';\nimport { useContext, useEffect, useRef, useState } from '@lynx-js/react';\nimport type { NodesRef } from '@lynx-js/types';\nimport { startTimer } from '../base/timers';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { g9KeyboardTargetProps } from '../host/keyboard';\nimport { useG9Culture, useG9Strings } from '../provider/hooks';\nimport {\n inputTypeHasValidationRule,\n inputTypePrefersLeftToRight,\n sanitizeInputText,\n validateInputText,\n} from './input-policy';\nimport type { G9OutlinedFieldProps } from './outlined-field';\nimport { useDictation } from './use-dictation';\nimport { type G9TextValidator, runTextValidator } from './validator';\n\n/** Where a value change came from (plan/specs/03 §3). */\nexport type G9ValueChangeSource = 'user' | 'dictation' | 'clear' | 'programmatic';\n\n/** Payload of `onValueChange`. */\nexport interface G9ValueChangeDetails {\n readonly source: G9ValueChangeSource;\n}\n\n/** Props the text inputs (`G9TextEntry`, `G9Editor`, `G9SearchEntry`) share on top of the outlined-field props. */\nexport interface G9TextInputProps extends G9OutlinedFieldProps {\n /** The text (controlled; MAUI `Text`). Present, the caller owns it and must apply `onValueChange`. */\n readonly value?: string;\n /** Initial text while uncontrolled. Default `''`. */\n readonly defaultValue?: string;\n /**\n * Once per change of the field's value, with where it came from: `'user'` (typing, paste), `'dictation'`,\n * `'clear'` (the clear button) or `'programmatic'` (the field re-filtered a value it was given, e.g. after an\n * `inputType` change). Never for a value the parent pushed in that needed no filtering.\n */\n readonly onValueChange?: (value: string, details: G9ValueChangeDetails) => void;\n /** On-screen keyboard; used when `inputType` is `'default'` (any other type picks its own). Default `'default'`. */\n readonly keyboardType?: G9KeyboardType;\n /** Semantic input type: keyboard, live filter and blur validation. Default `'default'`. */\n readonly inputType?: G9InputType;\n /** Per-character filter regex (a single character class) for `inputType: 'custom'`. */\n readonly allowedCharsPattern?: string | null;\n /** Blur validation regex for `inputType: 'custom'`. An invalid pattern fails closed. */\n readonly validationPattern?: string | null;\n /** Message for a failed type validation; default the culture's `invalidEmail` / `invalidUrl` / `invalidValue`. */\n readonly validationErrorText?: string | null;\n /** Direction of the entered text; `'matchParent'` (default) pins numbers, phone, email, URL and passwords LTR. */\n readonly inputTextDirection?: G9TextInputDirection;\n /** Font family of the entered text; default the culture's font. */\n readonly customFont?: string | null;\n /** Offer dictation through `services.speech` (hidden without the service or recogniser). Default false. */\n readonly voiceEnabled?: boolean;\n /** Locale to recognise (MAUI `VoiceCulture`); default the active culture. */\n readonly voiceLocale?: string | null;\n readonly onVoiceListeningStarted?: () => void;\n readonly onVoiceListeningEnded?: () => void;\n /** Dictation could not run or finish; a localized message for a toast. */\n readonly onVoiceFailed?: (message: string) => void;\n /** Validation ran (blur, `validateOnTextChanged` or `validate()`): the message, or `null` when valid. */\n readonly onValidationChange?: (message: string | null) => void;\n readonly onFocus?: () => void;\n readonly onBlur?: () => void;\n /** The keyboard's confirm key was pressed. */\n readonly onConfirm?: (value: string) => void;\n /** Element id of the inner `<input>`/`<textarea>`. */\n readonly inputId?: string;\n}\n\n/** Imperative handle of the text inputs (MAUI public methods). */\nexport interface G9TextInputHandle {\n /** Focuses the inner element (raises the keyboard). */\n focus(): void;\n /** Removes focus (hides the keyboard). */\n blur(): void;\n /** Runs the validator and the type rule now; sets or clears the error; `true` when valid (MAUI `Validate`). */\n validate(): boolean;\n /** `true` while dictating (MAUI `IsListening`). */\n readonly isListening: boolean;\n /** MAUI `ToggleVoiceAsync`. */\n toggleVoice(): Promise<void>;\n /** MAUI `StartVoiceAsync`. */\n startVoice(): Promise<void>;\n /** MAUI `StopVoiceAsync`; safe when nothing runs. */\n stopVoice(): Promise<void>;\n /** The inner element's node ref (MAUI `InnerEntry` / `InnerEditor`), for `invoke` calls G9 does not wrap. */\n readonly element: G9NodeRef | null;\n}\n\n/** The Lynx node ref of a field's inner element. */\nexport type G9NodeRef = NodesRef;\n\n/** Lynx input event detail. */\ninterface InputDetail {\n readonly value?: string;\n readonly isComposing?: boolean;\n}\n\n/** Resolves the entered text's direction (MAUI `ResolveInputFlowDirection`). */\nexport function resolveInputTextDirection(\n inputTextDirection: G9TextInputDirection,\n inputType: G9InputType,\n isPassword: boolean,\n cultureDirection: 'ltr' | 'rtl',\n): 'ltr' | 'rtl' {\n if (inputTextDirection === G9TextInputDirection.LeftToRight) return 'ltr';\n if (inputTextDirection === G9TextInputDirection.RightToLeft) return 'rtl';\n if (inputTypePrefersLeftToRight(inputType) || isPassword) return 'ltr';\n return cultureDirection;\n}\n\n/** What the native field draws for its ASCII digits: `g9-digits` / `g9-decimal-separator` (lynxcontrols-native). */\nexport interface G9FieldDigits {\n readonly system: G9NumberingSystem;\n readonly decimalSeparator: string;\n}\n\n/**\n * The digits a field DRAWS (MAUI: the culture's FaNum font draws «15» as «۱۵» in every entry): the culture's numbering\n * system, and «٫» for the '.' of a decimal field. The text stays ASCII — what is typed, the value events and what is\n * stored never change (AgriPad owner, 2026-11-02). A custom font or a password draws ASCII, as in MAUI.\n */\nexport function resolveFieldDigits(\n numberingSystem: G9NumberingSystem,\n inputType: G9InputType,\n hasCustomFont: boolean,\n isPassword: boolean,\n): G9FieldDigits {\n if (hasCustomFont || isPassword || numberingSystem === G9NumberingSystem.Latin) {\n return { system: G9NumberingSystem.Latin, decimalSeparator: '' };\n }\n const decimal = inputType === G9InputType.Decimal || inputType === G9InputType.SignedDecimal;\n return { system: numberingSystem, decimalSeparator: decimal ? '٫' : '' };\n}\n\n/** Calls a UI method on a node; a missing node or a failing call is ignored (the element is gone). */\nexport function invokeNode(\n ref: { current: G9NodeRef | null },\n method: string,\n params?: Record<string, unknown>,\n): boolean {\n const node = ref.current;\n if (!node) return false;\n try {\n node\n .invoke({\n method,\n ...(params ? { params } : {}),\n success: () => {},\n fail: () => {},\n })\n .exec();\n } catch {\n // The element was unmounted between the call and its execution.\n return false;\n }\n return true;\n}\n\n/**\n * {@link invokeNode}, retried on the next ticks (up to `attempts` times) while the element is not created natively\n * yet, e.g. a focus requested during the first commit.\n */\nexport function invokeNodeWhenReady(\n ref: { current: G9NodeRef | null },\n method: string,\n params?: Record<string, unknown>,\n attempts = 5,\n): void {\n if (invokeNode(ref, method, params) || attempts <= 0) return;\n startTimer(() => invokeNodeWhenReady(ref, method, params, attempts - 1), 0);\n}\n\ninterface ValidationResult {\n readonly message: string | null;\n // The external error props this result overrides; new props from the parent win again.\n readonly hasError: boolean | undefined;\n readonly errorText: string | null | undefined;\n}\n\n/** Options of {@link useTextInput}. */\nexport interface G9TextInputCoreOptions {\n /** Name for the controlled/uncontrolled diagnostic, e.g. `'G9TextEntry.value'`. */\n readonly name: string;\n /** Whether the microphone is shown, given the dictation and value state. */\n readonly showMic: (state: { available: boolean; listening: boolean; hasValue: boolean }) => boolean;\n /** Extra validator (`G9TextEntry.validator`; the editor has none). */\n readonly validator?: G9TextValidator | null;\n /** Validate on every change (`G9TextEntry.validateOnTextChanged`). */\n readonly validateOnTextChanged?: boolean;\n /** A password field (its text is pinned LTR). */\n readonly isPassword?: boolean;\n}\n\n/**\n * The state machine behind the text inputs: value ownership, the live filter, the native element sync, focus,\n * validation and dictation. Returns what the input element and the outlined frame need.\n */\nexport function useTextInput(props: G9TextInputProps, options: G9TextInputCoreOptions) {\n const culture = useG9Culture();\n const strings = useG9Strings();\n const keyboardAware = useContext(KeyboardAwareTriggerContext);\n const inputType = props.inputType ?? G9InputType.Default;\n // The decimal separator the FIELD holds is always the ASCII '.', whatever the culture: Lynx's native `digit` input\n // accepts only ASCII digits and '.', and silently dropped the Persian '٫' — 1.6 showed (and would be edited) as 16\n // (AgriPad's harvest weights, 2026-11-02). A typed '٫' still normalises to '.' (filterDecimal); the digits themselves\n // are drawn Persian by the app's font. decimalSeparatorFor stays for callers that format text for display.\n const separator = '.';\n const sanitize = (raw: string) => sanitizeInputText(inputType, raw, props.allowedCharsPattern, separator);\n\n const [text, setText] = useControllableState<string, [G9ValueChangeDetails]>({\n value: props.value,\n defaultValue: props.defaultValue ?? '',\n onChange: props.onValueChange,\n name: options.name,\n });\n const display = sanitize(text);\n const latestText = useRef(display);\n latestText.current = display;\n\n const elementRef = useRef<NodesRef | null>(null);\n const native = useRef('');\n /** The last native input event was an IME composition (its commit may repeat the composed text). */\n const composingRef = useRef(false);\n const [focused, setFocused] = useState(false);\n const focusedRef = useRef(false);\n const [passwordVisible, setPasswordVisible] = useState(false);\n const [, bump] = useState(0);\n const [validation, setValidation] = useState<ValidationResult | null>(null);\n const hasValue = display !== '';\n\n const runValidation = (value: string): boolean => {\n const message =\n runTextValidator(options.validator, value) ??\n validateInputText(inputType, value, props.validationPattern, props.validationErrorText, strings);\n setValidation({ message, hasError: props.hasError, errorText: props.errorText });\n props.onValidationChange?.(message);\n return message === null;\n };\n const hasRule = options.validator != null || inputTypeHasValidationRule(inputType, props.validationPattern);\n\n const dictation = useDictation({\n enabled: props.voiceEnabled === true,\n locale: props.voiceLocale ?? null,\n readText: () => latestText.current,\n writeText: (value) => {\n setText(sanitize(value), { source: 'dictation' });\n },\n ...(props.onVoiceListeningStarted ? { onListeningStarted: props.onVoiceListeningStarted } : {}),\n ...(props.onVoiceListeningEnded ? { onListeningEnded: props.onVoiceListeningEnded } : {}),\n ...(props.onVoiceFailed ? { onFailed: props.onVoiceFailed } : {}),\n });\n\n // A value the field was given that its filter rejects is replaced once (MAUI OnTextChanged writes it back).\n const refiltered = useRef<string | null>(null);\n useEffect(() => {\n if (display !== text && refiltered.current !== text) {\n refiltered.current = text;\n setText(display, { source: 'programmatic' });\n }\n });\n\n // Keep the native element showing the field's value (lynx-ui pattern: `invoke('setValue')`). The node ref can\n // attach after the first effect, so attaching syncs too.\n const retries = useRef(0);\n const sync = () => {\n const value = latestText.current;\n if (native.current === value) return;\n if (invokeNode(elementRef, 'setValue', { value })) {\n native.current = value;\n retries.current = 0;\n } else if (elementRef.current && retries.current < 5) {\n // The element is not created natively yet (first commit): try again on the next tick.\n retries.current += 1;\n startTimer(() => syncRef.current(), 0);\n }\n };\n const syncRef = useRef(sync);\n syncRef.current = sync;\n const attach = useRef((node: NodesRef | null) => {\n elementRef.current = node;\n if (node) syncRef.current();\n }).current;\n useEffect(() => {\n sync();\n });\n\n // Clearing the value re-masks a revealed password (MAUI OnTextChanged).\n useEffect(() => {\n if (!hasValue && passwordVisible) setPasswordVisible(false);\n }, [hasValue, passwordVisible]);\n\n // New external error props win over an earlier validation result.\n const validationCurrent =\n validation !== null && validation.hasError === props.hasError && validation.errorText === props.errorText;\n const hasError = validationCurrent ? validation.message !== null : props.hasError === true;\n const errorText = validationCurrent && validation.message !== null ? validation.message : props.errorText;\n\n const onInput = (event: { detail?: InputDetail }) => {\n const raw = event.detail?.value ?? '';\n // Not an edit: the native element reports what it already holds (Android emits an empty `input` when a read-only\n // field is created, before `setValue` lands), or the user cannot type here at all. Forwarding it would wipe a\n // controlled value (a barcode field opened on an existing code came up empty).\n if (props.readOnly === true) {\n // Nobody types here: the native element drifted (Android clears a read-only input it just created) — show the\n // field's value again.\n native.current = raw;\n if (raw !== latestText.current) syncRef.current();\n return;\n }\n const composing = event.detail?.isComposing === true;\n const echo = !composing && !composingRef.current && raw === native.current;\n composingRef.current = composing;\n if (echo) return;\n native.current = raw;\n // IME composition is never interrupted: the composed text is filtered when it is committed.\n if (composing) return;\n const clean = sanitize(raw);\n latestText.current = clean;\n setText(clean, { source: 'user' });\n if (options.validateOnTextChanged) runValidation(clean);\n bump((n) => n + 1);\n };\n const onFocus = () => {\n focusedRef.current = true;\n setFocused(true);\n keyboardAware.onInputFocused?.();\n // Tapping the field while dictating means typing: end the session (ADR-0024).\n if (dictation.listening) void dictation.stop();\n props.onFocus?.();\n };\n const onBlur = () => {\n focusedRef.current = false;\n setFocused(false);\n keyboardAware.onInputBlurred?.();\n // Only fields with a rule validate on blur, so an externally set error survives.\n if (hasRule && latestText.current !== '') runValidation(latestText.current);\n props.onBlur?.();\n };\n const onConfirm = () => props.onConfirm?.(latestText.current);\n\n const focus = () => {\n if (props.disabled) return;\n invokeNode(elementRef, 'focus');\n };\n const blur = () => invokeNode(elementRef, 'blur');\n\n const showMic = options.showMic({ available: dictation.available, listening: dictation.listening, hasValue });\n const pressMic = () => {\n // The microphone never focuses the field, and starting takes the keyboard down (ADR-0024).\n if (!dictation.listening && focusedRef.current) blur();\n void dictation.toggle();\n };\n\n const direction = resolveInputTextDirection(\n props.inputTextDirection ?? G9TextInputDirection.MatchParent,\n inputType,\n options.isPassword === true,\n culture.direction,\n );\n const font =\n props.customFont && props.customFont.trim() !== ''\n ? props.customFont\n : culture.direction === 'rtl'\n ? culture.rtlFontFamily\n : culture.ltrFontFamily;\n\n const digits = resolveFieldDigits(\n culture.numberingSystem,\n inputType,\n Boolean(props.customFont && props.customFont.trim() !== ''),\n options.isPassword === true,\n );\n\n const handle: G9TextInputHandle = {\n focus,\n blur,\n validate: () => runValidation(latestText.current),\n get isListening() {\n return dictation.listening;\n },\n toggleVoice: () => dictation.toggle(),\n startVoice: () => dictation.start(),\n stopVoice: () => dictation.stop(),\n get element() {\n return elementRef.current;\n },\n };\n\n return {\n text: display,\n setText,\n hasValue,\n focused,\n hasError,\n errorText,\n passwordVisible,\n setPasswordVisible,\n dictation,\n showMic,\n pressMic,\n focus,\n blur,\n handle,\n inputType,\n /** Element attributes and handlers shared by `<input>` and `<textarea>`. */\n elementProps: {\n ...g9KeyboardTargetProps,\n ref: attach,\n ...(props.inputId ? { id: props.inputId } : {}),\n 'ignore-focus': true,\n readonly: props.readOnly === true,\n disabled: props.disabled === true,\n maxlength: props.maxLength !== undefined && props.maxLength > 0 ? props.maxLength : 2147483647,\n bindinput: onInput,\n bindfocus: onFocus,\n bindblur: onBlur,\n bindconfirm: onConfirm,\n 'g9-digits': digits.system,\n 'g9-decimal-separator': digits.decimalSeparator,\n },\n textDirection: direction,\n font,\n };\n}\n"],"names":["resolveInputTextDirection","inputTextDirection","inputType","isPassword","cultureDirection","G9TextInputDirection","inputTypePrefersLeftToRight","resolveFieldDigits","numberingSystem","hasCustomFont","G9NumberingSystem","decimal","G9InputType","invokeNode","ref","method","params","node","invokeNodeWhenReady","attempts","startTimer","useTextInput","props","options","_props_inputType","_props_defaultValue","_props_voiceLocale","_props_inputTextDirection","culture","useG9Culture","strings","useG9Strings","keyboardAware","useContext","KeyboardAwareTriggerContext","separator","sanitize","raw","sanitizeInputText","text","setText","useControllableState","display","latestText","useRef","elementRef","native","composingRef","focused","setFocused","useState","focusedRef","passwordVisible","setPasswordVisible","bump","validation","setValidation","hasValue","runValidation","value","_runTextValidator","message","validateInputText","hasRule","inputTypeHasValidationRule","dictation","useDictation","refiltered","useEffect","retries","sync","syncRef","attach","validationCurrent","hasError","errorText","onInput","event","_event_detail","_event_detail1","composing","echo","clean","n","onFocus","onBlur","onConfirm","focus","blur","showMic","pressMic","direction","font","digits","Boolean","handle","g9KeyboardTargetProps","undefined"],"mappings":";;;;;;;;;;AAyGO,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;QACfC;IACF;AACF"}
|
|
1
|
+
{"version":3,"file":"fields/use-text-input.jsx","sources":["../../src/fields/use-text-input.ts"],"sourcesContent":["import {\n G9InputType,\n type G9KeyboardType,\n G9NumberingSystem,\n G9TextInputDirection,\n} from '@g9tm/lynxcontrols-foundation';\nimport { KeyboardAwareTriggerContext } from '@lynx-js/lynx-ui-input';\nimport { useContext, useEffect, useRef, useState } from '@lynx-js/react';\nimport type { NodesRef } from '@lynx-js/types';\nimport { startTimer } from '../base/timers';\nimport { useControllableState } from '../base/use-controllable-state';\nimport { g9KeyboardTargetProps } from '../host/keyboard';\nimport { useG9Culture, useG9Strings } from '../provider/hooks';\nimport {\n inputTypeHasValidationRule,\n inputTypePrefersLeftToRight,\n sanitizeInputText,\n validateInputText,\n} from './input-policy';\nimport type { G9OutlinedFieldProps } from './outlined-field';\nimport { useDictation } from './use-dictation';\nimport { type G9TextValidator, runTextValidator } from './validator';\n\n/** Where a value change came from (plan/specs/03 §3). */\nexport type G9ValueChangeSource = 'user' | 'dictation' | 'clear' | 'programmatic';\n\n/** Payload of `onValueChange`. */\nexport interface G9ValueChangeDetails {\n readonly source: G9ValueChangeSource;\n}\n\n/** Props the text inputs (`G9TextEntry`, `G9Editor`, `G9SearchEntry`) share on top of the outlined-field props. */\nexport interface G9TextInputProps extends G9OutlinedFieldProps {\n /** The text (controlled; MAUI `Text`). Present, the caller owns it and must apply `onValueChange`. */\n readonly value?: string;\n /** Initial text while uncontrolled. Default `''`. */\n readonly defaultValue?: string;\n /**\n * Once per change of the field's value, with where it came from: `'user'` (typing, paste), `'dictation'`,\n * `'clear'` (the clear button) or `'programmatic'` (the field re-filtered a value it was given, e.g. after an\n * `inputType` change). Never for a value the parent pushed in that needed no filtering.\n */\n readonly onValueChange?: (value: string, details: G9ValueChangeDetails) => void;\n /** On-screen keyboard; used when `inputType` is `'default'` (any other type picks its own). Default `'default'`. */\n readonly keyboardType?: G9KeyboardType;\n /** Semantic input type: keyboard, live filter and blur validation. Default `'default'`. */\n readonly inputType?: G9InputType;\n /** Per-character filter regex (a single character class) for `inputType: 'custom'`. */\n readonly allowedCharsPattern?: string | null;\n /** Blur validation regex for `inputType: 'custom'`. An invalid pattern fails closed. */\n readonly validationPattern?: string | null;\n /** Message for a failed type validation; default the culture's `invalidEmail` / `invalidUrl` / `invalidValue`. */\n readonly validationErrorText?: string | null;\n /** Direction of the entered text; `'matchParent'` (default) pins numbers, phone, email, URL and passwords LTR. */\n readonly inputTextDirection?: G9TextInputDirection;\n /** Font family of the entered text; default the culture's font. */\n readonly customFont?: string | null;\n /** Offer dictation through `services.speech` (hidden without the service or recogniser). Default false. */\n readonly voiceEnabled?: boolean;\n /** Locale to recognise (MAUI `VoiceCulture`); default the active culture. */\n readonly voiceLocale?: string | null;\n readonly onVoiceListeningStarted?: () => void;\n readonly onVoiceListeningEnded?: () => void;\n /** Dictation could not run or finish; a localized message for a toast. */\n readonly onVoiceFailed?: (message: string) => void;\n /** Validation ran (blur, `validateOnTextChanged` or `validate()`): the message, or `null` when valid. */\n readonly onValidationChange?: (message: string | null) => void;\n readonly onFocus?: () => void;\n readonly onBlur?: () => void;\n /** The keyboard's confirm key was pressed. */\n readonly onConfirm?: (value: string) => void;\n /** Element id of the inner `<input>`/`<textarea>`. */\n readonly inputId?: string;\n}\n\n/** Imperative handle of the text inputs (MAUI public methods). */\nexport interface G9TextInputHandle {\n /** Focuses the inner element (raises the keyboard). */\n focus(): void;\n /** Removes focus (hides the keyboard). */\n blur(): void;\n /** Runs the validator and the type rule now; sets or clears the error; `true` when valid (MAUI `Validate`). */\n validate(): boolean;\n /** `true` while dictating (MAUI `IsListening`). */\n readonly isListening: boolean;\n /** MAUI `ToggleVoiceAsync`. */\n toggleVoice(): Promise<void>;\n /** MAUI `StartVoiceAsync`. */\n startVoice(): Promise<void>;\n /** MAUI `StopVoiceAsync`; safe when nothing runs. */\n stopVoice(): Promise<void>;\n /** The inner element's node ref (MAUI `InnerEntry` / `InnerEditor`), for `invoke` calls G9 does not wrap. */\n readonly element: G9NodeRef | null;\n}\n\n/** The Lynx node ref of a field's inner element. */\nexport type G9NodeRef = NodesRef;\n\n/** Lynx input event detail. */\ninterface InputDetail {\n readonly value?: string;\n readonly isComposing?: boolean;\n}\n\n/** Resolves the entered text's direction (MAUI `ResolveInputFlowDirection`). */\nexport function resolveInputTextDirection(\n inputTextDirection: G9TextInputDirection,\n inputType: G9InputType,\n isPassword: boolean,\n cultureDirection: 'ltr' | 'rtl',\n): 'ltr' | 'rtl' {\n if (inputTextDirection === G9TextInputDirection.LeftToRight) return 'ltr';\n if (inputTextDirection === G9TextInputDirection.RightToLeft) return 'rtl';\n if (inputTypePrefersLeftToRight(inputType) || isPassword) return 'ltr';\n return cultureDirection;\n}\n\n/** What the native field draws for its ASCII digits: `g9-digits` / `g9-decimal-separator` (lynxcontrols-native). */\nexport interface G9FieldDigits {\n readonly system: G9NumberingSystem;\n readonly decimalSeparator: string;\n}\n\n/**\n * The digits a field DRAWS (MAUI: the culture's FaNum font draws «15» as «۱۵» in every entry): the culture's numbering\n * system, and «٫» for the '.' of a decimal field. The text stays ASCII — what is typed, the value events and what is\n * stored never change (AgriPad owner, 2026-11-02). A custom font or a password draws ASCII, as in MAUI.\n */\nexport function resolveFieldDigits(\n numberingSystem: G9NumberingSystem,\n inputType: G9InputType,\n hasCustomFont: boolean,\n isPassword: boolean,\n): G9FieldDigits {\n if (hasCustomFont || isPassword || numberingSystem === G9NumberingSystem.Latin) {\n return { system: G9NumberingSystem.Latin, decimalSeparator: '' };\n }\n const decimal = inputType === G9InputType.Decimal || inputType === G9InputType.SignedDecimal;\n return { system: numberingSystem, decimalSeparator: decimal ? '٫' : '' };\n}\n\n/** Calls a UI method on a node; a missing node or a failing call is ignored (the element is gone). */\nexport function invokeNode(\n ref: { current: G9NodeRef | null },\n method: string,\n params?: Record<string, unknown>,\n): boolean {\n const node = ref.current;\n if (!node) return false;\n try {\n node\n .invoke({\n method,\n ...(params ? { params } : {}),\n success: () => {},\n fail: () => {},\n })\n .exec();\n } catch {\n // The element was unmounted between the call and its execution.\n return false;\n }\n return true;\n}\n\n/**\n * {@link invokeNode}, retried on the next ticks (up to `attempts` times) while the element is not created natively\n * yet, e.g. a focus requested during the first commit.\n */\nexport function invokeNodeWhenReady(\n ref: { current: G9NodeRef | null },\n method: string,\n params?: Record<string, unknown>,\n attempts = 5,\n): void {\n if (invokeNode(ref, method, params) || attempts <= 0) return;\n startTimer(() => invokeNodeWhenReady(ref, method, params, attempts - 1), 0);\n}\n\ninterface ValidationResult {\n readonly message: string | null;\n // The external error props this result overrides; new props from the parent win again.\n readonly hasError: boolean | undefined;\n readonly errorText: string | null | undefined;\n}\n\n/** Options of {@link useTextInput}. */\nexport interface G9TextInputCoreOptions {\n /** Name for the controlled/uncontrolled diagnostic, e.g. `'G9TextEntry.value'`. */\n readonly name: string;\n /** Whether the microphone is shown, given the dictation and value state. */\n readonly showMic: (state: { available: boolean; listening: boolean; hasValue: boolean }) => boolean;\n /** Extra validator (`G9TextEntry.validator`; the editor has none). */\n readonly validator?: G9TextValidator | null;\n /** Validate on every change (`G9TextEntry.validateOnTextChanged`). */\n readonly validateOnTextChanged?: boolean;\n /** A password field (its text is pinned LTR). */\n readonly isPassword?: boolean;\n}\n\n/**\n * The state machine behind the text inputs: value ownership, the live filter, the native element sync, focus,\n * validation and dictation. Returns what the input element and the outlined frame need.\n */\nexport function useTextInput(props: G9TextInputProps, options: G9TextInputCoreOptions) {\n const culture = useG9Culture();\n const strings = useG9Strings();\n const keyboardAware = useContext(KeyboardAwareTriggerContext);\n const inputType = props.inputType ?? G9InputType.Default;\n // The decimal separator the FIELD holds is always the ASCII '.', whatever the culture: Lynx's native `digit` input\n // accepts only ASCII digits and '.', and silently dropped the Persian '٫' — 1.6 showed (and would be edited) as 16\n // (AgriPad's harvest weights, 2026-11-02). A typed '٫' still normalises to '.' (filterDecimal); the digits themselves\n // are drawn Persian by the app's font. decimalSeparatorFor stays for callers that format text for display.\n const separator = '.';\n const sanitize = (raw: string) => sanitizeInputText(inputType, raw, props.allowedCharsPattern, separator);\n\n const [text, setText] = useControllableState<string, [G9ValueChangeDetails]>({\n value: props.value,\n defaultValue: props.defaultValue ?? '',\n onChange: props.onValueChange,\n name: options.name,\n });\n const display = sanitize(text);\n const latestText = useRef(display);\n latestText.current = display;\n\n const elementRef = useRef<NodesRef | null>(null);\n const native = useRef('');\n /** The last native input event was an IME composition (its commit may repeat the composed text). */\n const composingRef = useRef(false);\n /**\n * The field's value while the keyboard composes. A re-render that still shows it must not write it over the native text:\n * that wiped what was being typed. A keyboard with suggestions keeps a whole word, even «4041234», composing until the\n * focus moves, and moving the focus re-renders the form. The sign-in fields emptied themselves on a real phone (AgriPad,\n * 2026-11-12). `adb input text` never composes, so an emulator could not show it.\n */\n const composedFrom = useRef<string | null>(null);\n const [focused, setFocused] = useState(false);\n const focusedRef = useRef(false);\n const [passwordVisible, setPasswordVisible] = useState(false);\n const [, bump] = useState(0);\n const [validation, setValidation] = useState<ValidationResult | null>(null);\n const hasValue = display !== '';\n\n const runValidation = (value: string): boolean => {\n const message =\n runTextValidator(options.validator, value) ??\n validateInputText(inputType, value, props.validationPattern, props.validationErrorText, strings);\n setValidation({ message, hasError: props.hasError, errorText: props.errorText });\n props.onValidationChange?.(message);\n return message === null;\n };\n const hasRule = options.validator != null || inputTypeHasValidationRule(inputType, props.validationPattern);\n\n const dictation = useDictation({\n enabled: props.voiceEnabled === true,\n locale: props.voiceLocale ?? null,\n readText: () => latestText.current,\n writeText: (value) => {\n setText(sanitize(value), { source: 'dictation' });\n },\n ...(props.onVoiceListeningStarted ? { onListeningStarted: props.onVoiceListeningStarted } : {}),\n ...(props.onVoiceListeningEnded ? { onListeningEnded: props.onVoiceListeningEnded } : {}),\n ...(props.onVoiceFailed ? { onFailed: props.onVoiceFailed } : {}),\n });\n\n // A value the field was given that its filter rejects is replaced once (MAUI OnTextChanged writes it back).\n const refiltered = useRef<string | null>(null);\n useEffect(() => {\n if (display !== text && refiltered.current !== text) {\n refiltered.current = text;\n setText(display, { source: 'programmatic' });\n }\n });\n\n // Keep the native element showing the field's value (lynx-ui pattern: `invoke('setValue')`). The node ref can\n // attach after the first effect, so attaching syncs too.\n const retries = useRef(0);\n const sync = () => {\n const value = latestText.current;\n if (native.current === value) return;\n // Mid-composition the native text is the truth: only a NEW value (a clear, a parent's change) is written over it.\n if (composingRef.current && composedFrom.current === value) return;\n if (invokeNode(elementRef, 'setValue', { value })) {\n native.current = value;\n retries.current = 0;\n } else if (elementRef.current && retries.current < 5) {\n // The element is not created natively yet (first commit): try again on the next tick.\n retries.current += 1;\n startTimer(() => syncRef.current(), 0);\n }\n };\n const syncRef = useRef(sync);\n syncRef.current = sync;\n const attach = useRef((node: NodesRef | null) => {\n elementRef.current = node;\n if (node) syncRef.current();\n }).current;\n useEffect(() => {\n sync();\n });\n\n // Clearing the value re-masks a revealed password (MAUI OnTextChanged).\n useEffect(() => {\n if (!hasValue && passwordVisible) setPasswordVisible(false);\n }, [hasValue, passwordVisible]);\n\n // New external error props win over an earlier validation result.\n const validationCurrent =\n validation !== null && validation.hasError === props.hasError && validation.errorText === props.errorText;\n const hasError = validationCurrent ? validation.message !== null : props.hasError === true;\n const errorText = validationCurrent && validation.message !== null ? validation.message : props.errorText;\n\n const onInput = (event: { detail?: InputDetail }) => {\n const raw = event.detail?.value ?? '';\n // Not an edit: the native element reports what it already holds (Android emits an empty `input` when a read-only\n // field is created, before `setValue` lands), or the user cannot type here at all. Forwarding it would wipe a\n // controlled value (a barcode field opened on an existing code came up empty).\n if (props.readOnly === true) {\n // Nobody types here: the native element drifted (Android clears a read-only input it just created) — show the\n // field's value again.\n native.current = raw;\n if (raw !== latestText.current) syncRef.current();\n return;\n }\n const composing = event.detail?.isComposing === true;\n const echo = !composing && !composingRef.current && raw === native.current;\n composingRef.current = composing;\n if (echo) return;\n native.current = raw;\n if (composing) {\n // The text so far is the field's value: reported as typed when the filter keeps it as it is (MAUI's Entry reports\n // composing text too). Text the filter would change waits for the commit: writing it back now would interrupt the\n // keyboard.\n const kept = sanitize(raw) === raw;\n if (kept) {\n latestText.current = raw;\n setText(raw, { source: 'user' });\n if (options.validateOnTextChanged) runValidation(raw);\n }\n composedFrom.current = latestText.current;\n bump((n) => n + 1);\n return;\n }\n composedFrom.current = null;\n const clean = sanitize(raw);\n latestText.current = clean;\n setText(clean, { source: 'user' });\n if (options.validateOnTextChanged) runValidation(clean);\n bump((n) => n + 1);\n };\n const onFocus = () => {\n focusedRef.current = true;\n setFocused(true);\n keyboardAware.onInputFocused?.();\n // Tapping the field while dictating means typing: end the session (ADR-0024).\n if (dictation.listening) void dictation.stop();\n props.onFocus?.();\n };\n const onBlur = () => {\n focusedRef.current = false;\n setFocused(false);\n // A keyboard that ends the composition without a final input event: what it shows is what was typed.\n if (composingRef.current) {\n composingRef.current = false;\n composedFrom.current = null;\n const clean = sanitize(native.current);\n if (clean !== latestText.current) {\n latestText.current = clean;\n setText(clean, { source: 'user' });\n }\n bump((n) => n + 1);\n }\n keyboardAware.onInputBlurred?.();\n // Only fields with a rule validate on blur, so an externally set error survives.\n if (hasRule && latestText.current !== '') runValidation(latestText.current);\n props.onBlur?.();\n };\n const onConfirm = () => props.onConfirm?.(latestText.current);\n\n const focus = () => {\n if (props.disabled) return;\n invokeNode(elementRef, 'focus');\n };\n const blur = () => invokeNode(elementRef, 'blur');\n\n const showMic = options.showMic({ available: dictation.available, listening: dictation.listening, hasValue });\n const pressMic = () => {\n // The microphone never focuses the field, and starting takes the keyboard down (ADR-0024).\n if (!dictation.listening && focusedRef.current) blur();\n void dictation.toggle();\n };\n\n const direction = resolveInputTextDirection(\n props.inputTextDirection ?? G9TextInputDirection.MatchParent,\n inputType,\n options.isPassword === true,\n culture.direction,\n );\n const font =\n props.customFont && props.customFont.trim() !== ''\n ? props.customFont\n : culture.direction === 'rtl'\n ? culture.rtlFontFamily\n : culture.ltrFontFamily;\n\n const digits = resolveFieldDigits(\n culture.numberingSystem,\n inputType,\n Boolean(props.customFont && props.customFont.trim() !== ''),\n options.isPassword === true,\n );\n\n const handle: G9TextInputHandle = {\n focus,\n blur,\n validate: () => runValidation(latestText.current),\n get isListening() {\n return dictation.listening;\n },\n toggleVoice: () => dictation.toggle(),\n startVoice: () => dictation.start(),\n stopVoice: () => dictation.stop(),\n get element() {\n return elementRef.current;\n },\n };\n\n return {\n text: display,\n setText,\n hasValue,\n focused,\n hasError,\n errorText,\n passwordVisible,\n setPasswordVisible,\n dictation,\n showMic,\n pressMic,\n focus,\n blur,\n handle,\n inputType,\n /** Element attributes and handlers shared by `<input>` and `<textarea>`. */\n elementProps: {\n ...g9KeyboardTargetProps,\n ref: attach,\n ...(props.inputId ? { id: props.inputId } : {}),\n 'ignore-focus': true,\n readonly: props.readOnly === true,\n disabled: props.disabled === true,\n maxlength: props.maxLength !== undefined && props.maxLength > 0 ? props.maxLength : 2147483647,\n bindinput: onInput,\n bindfocus: onFocus,\n bindblur: onBlur,\n bindconfirm: onConfirm,\n 'g9-digits': digits.system,\n 'g9-decimal-separator': digits.decimalSeparator,\n },\n textDirection: direction,\n font,\n };\n}\n"],"names":["resolveInputTextDirection","inputTextDirection","inputType","isPassword","cultureDirection","G9TextInputDirection","inputTypePrefersLeftToRight","resolveFieldDigits","numberingSystem","hasCustomFont","G9NumberingSystem","decimal","G9InputType","invokeNode","ref","method","params","node","invokeNodeWhenReady","attempts","startTimer","useTextInput","props","options","_props_inputType","_props_defaultValue","_props_voiceLocale","_props_inputTextDirection","culture","useG9Culture","strings","useG9Strings","keyboardAware","useContext","KeyboardAwareTriggerContext","separator","sanitize","raw","sanitizeInputText","text","setText","useControllableState","display","latestText","useRef","elementRef","native","composingRef","composedFrom","focused","setFocused","useState","focusedRef","passwordVisible","setPasswordVisible","bump","validation","setValidation","hasValue","runValidation","value","_runTextValidator","message","validateInputText","hasRule","inputTypeHasValidationRule","dictation","useDictation","refiltered","useEffect","retries","sync","syncRef","attach","validationCurrent","hasError","errorText","onInput","event","_event_detail","_event_detail1","composing","echo","kept","n","clean","onFocus","onBlur","onConfirm","focus","blur","showMic","pressMic","direction","font","digits","Boolean","handle","g9KeyboardTargetProps","undefined"],"mappings":";;;;;;;;;;AAyGO,SAASA,0BACdC,kBAAwC,EACxCC,SAAsB,EACtBC,UAAmB,EACnBC,gBAA+B;IAE/B,IAAIH,uBAAuBI,qBAAqB,WAAW,EAAE,OAAO;IACpE,IAAIJ,uBAAuBI,qBAAqB,WAAW,EAAE,OAAO;IACpE,IAAIC,4BAA4BJ,cAAcC,YAAY,OAAO;IACjE,OAAOC;AACT;AAaO,SAASG,mBACdC,eAAkC,EAClCN,SAAsB,EACtBO,aAAsB,EACtBN,UAAmB;IAEnB,IAAIM,iBAAiBN,cAAcK,oBAAoBE,kBAAkB,KAAK,EAC5E,OAAO;QAAE,QAAQA,kBAAkB,KAAK;QAAE,kBAAkB;IAAG;IAEjE,MAAMC,UAAUT,cAAcU,YAAY,OAAO,IAAIV,cAAcU,YAAY,aAAa;IAC5F,OAAO;QAAE,QAAQJ;QAAiB,kBAAkBG,UAAU,MAAM;IAAG;AACzE;AAGO,SAASE,WACdC,GAAkC,EAClCC,MAAc,EACdC,MAAgC;IAEhC,MAAMC,OAAOH,IAAI,OAAO;IACxB,IAAI,CAACG,MAAM,OAAO;IAClB,IAAI;QACFA,KACG,MAAM,CAAC;YACNF;YACA,GAAIC,SAAS;gBAAEA;YAAO,IAAI,CAAC,CAAC;YAC5B,SAAS,KAAO;YAChB,MAAM,KAAO;QACf,GACC,IAAI;IACT,EAAE,OAAM;QAEN,OAAO;IACT;IACA,OAAO;AACT;AAMO,SAASE,oBACdJ,GAAkC,EAClCC,MAAc,EACdC,MAAgC,EAChCG,WAAW,CAAC;IAEZ,IAAIN,WAAWC,KAAKC,QAAQC,WAAWG,YAAY,GAAG;IACtDC,WAAW,IAAMF,oBAAoBJ,KAAKC,QAAQC,QAAQG,WAAW,IAAI;AAC3E;AA2BO,SAASE,aAAaC,KAAuB,EAAEC,OAA+B;QAIjEC,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U,IAAM/B,cAAchB,WAAW,OAAO;QAChD,IAAI;YACF,OAAOuB,UAAU,SAAS;QAC5B;QACA,aAAa,IAAMA,UAAU,MAAM;QACnC,YAAY,IAAMA,UAAU,KAAK;QACjC,WAAW,IAAMA,UAAU,IAAI;QAC/B,IAAI;YACF,OAAOrB,WAAW,OAAO;QAC3B;IACF;IAEA,OAAO;QACL,MAAMH;QACNF;QACAkB;QACAT;QACA0B;QACAC;QACAvB;QACAC;QACAY;QACAyB;QACAC;QACAH;QACAC;QACAO;QACA/F;QAEA,cAAc;YACZ,GAAGgG,qBAAqB;YACxB,KAAKzB;YACL,GAAInD,MAAM,OAAO,GAAG;gBAAE,IAAIA,MAAM,OAAO;YAAC,IAAI,CAAC,CAAC;YAC9C,gBAAgB;YAChB,UAAUA,AAAmB,SAAnBA,MAAM,QAAQ;YACxB,UAAUA,AAAmB,SAAnBA,MAAM,QAAQ;YACxB,WAAWA,AAAoB6E,WAApB7E,MAAM,SAAS,IAAkBA,MAAM,SAAS,GAAG,IAAIA,MAAM,SAAS,GAAG;YACpF,WAAWuD;YACX,WAAWS;YACX,UAAUC;YACV,aAAaC;YACb,aAAaO,OAAO,MAAM;YAC1B,wBAAwBA,OAAO,gBAAgB;QACjD;QACA,eAAeF;QACfC;IACF;AACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type G9ChangeLine, type G9JourneySource } from '@g9tm/lynxcontrols-foundation';
|
|
2
|
+
import type { G9HostHandle } from '../host/registry.js';
|
|
3
|
+
import { type G9ResolvedGuideSettings } from './settings.js';
|
|
4
|
+
/** What the sheet shows (the guide's `G9ConfirmRequest`). */
|
|
5
|
+
export interface G9ConfirmSheetRequest {
|
|
6
|
+
readonly title: string;
|
|
7
|
+
readonly source: G9JourneySource;
|
|
8
|
+
readonly changes: readonly G9ChangeLine[];
|
|
9
|
+
readonly seconds: number;
|
|
10
|
+
readonly destructive: boolean;
|
|
11
|
+
readonly progress?: {
|
|
12
|
+
readonly index: number;
|
|
13
|
+
readonly total: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** An open confirmation: closes it as declined. */
|
|
17
|
+
export interface G9ConfirmSheetPresentation {
|
|
18
|
+
dismiss(): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Opens the confirmation sheet on the host's sheet stack (stacked over an open sheet, never throttled). `decide` is
|
|
22
|
+
* called exactly once, after the sheet has left the screen: true only for the unlocked confirm; the other button, the
|
|
23
|
+
* header's close, a tap on the dim and Android back all decline (a fit sheet is never draggable).
|
|
24
|
+
*/
|
|
25
|
+
export declare function presentConfirmSheet(host: G9HostHandle, settings: G9ResolvedGuideSettings, request: G9ConfirmSheetRequest, decide: (ok: boolean) => void): G9ConfirmSheetPresentation;
|
|
26
|
+
//# sourceMappingURL=confirm-sheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-sheet.d.ts","sourceRoot":"","sources":["../../src/guide/confirm-sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAmB,MAAM,+BAA+B,CAAC;AAGzG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAKrD,OAAO,EAAsC,KAAK,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAY9F,6DAA6D;AAC7D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACxE;AAED,mDAAmD;AACnD,MAAM,WAAW,0BAA0B;IACzC,OAAO,IAAI,IAAI,CAAC;CACjB;AAOD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,uBAAuB,EACjC,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,GAC5B,0BAA0B,CAgF5B"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { g9RuntimeTimers } from "@g9tm/lynxcontrols-foundation";
|
|
2
|
+
import { useSyncExternalStore } from "@lynx-js/react";
|
|
3
|
+
import { G9Button } from "../button/button.jsx";
|
|
4
|
+
import { useG9Direction, useG9Settings } from "../provider/hooks.jsx";
|
|
5
|
+
import { sheetServiceOf } from "../sheet/service.jsx";
|
|
6
|
+
import { formatGuideText } from "./settings.jsx";
|
|
7
|
+
function presentConfirmSheet(host, settings, request, decide) {
|
|
8
|
+
let left = Math.max(0, Math.round(request.seconds));
|
|
9
|
+
const listeners = new Set();
|
|
10
|
+
const countdown = {
|
|
11
|
+
get: ()=>left,
|
|
12
|
+
subscribe (l) {
|
|
13
|
+
listeners.add(l);
|
|
14
|
+
return ()=>{
|
|
15
|
+
listeners.delete(l);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
let timer = null;
|
|
20
|
+
const tick = ()=>{
|
|
21
|
+
left = Math.max(0, left - 1);
|
|
22
|
+
timer = left > 0 ? g9RuntimeTimers.setTimeout(tick, 1000) : null;
|
|
23
|
+
for (const l of Array.from(listeners))l();
|
|
24
|
+
};
|
|
25
|
+
if (left > 0) timer = g9RuntimeTimers.setTimeout(tick, 1000);
|
|
26
|
+
const stop = ()=>{
|
|
27
|
+
if (null !== timer) g9RuntimeTimers.clearTimeout(timer);
|
|
28
|
+
timer = null;
|
|
29
|
+
};
|
|
30
|
+
let chosen = null;
|
|
31
|
+
let handle = null;
|
|
32
|
+
const choose = (ok)=>{
|
|
33
|
+
if (null !== chosen || (null == handle ? void 0 : handle.isOpen) === false || ok && left > 0) return;
|
|
34
|
+
chosen = ok;
|
|
35
|
+
stop();
|
|
36
|
+
null == handle || handle.close();
|
|
37
|
+
};
|
|
38
|
+
const texts = settings.texts;
|
|
39
|
+
const fontSize = settings.confirmButtonFontSize;
|
|
40
|
+
const options = {
|
|
41
|
+
sizeMode: 'fitToContent',
|
|
42
|
+
maxFitToContentHeightRatio: 0.75,
|
|
43
|
+
isCancelable: true,
|
|
44
|
+
isDraggable: true,
|
|
45
|
+
hasHandle: true,
|
|
46
|
+
deferContent: false,
|
|
47
|
+
showToolbar: true,
|
|
48
|
+
showCloseButton: true,
|
|
49
|
+
headerTitlePlacement: 'center',
|
|
50
|
+
scrollIndicator: 'always',
|
|
51
|
+
automationId: 'G9GuideConfirm',
|
|
52
|
+
...settings.confirmSheet(),
|
|
53
|
+
title: request.title,
|
|
54
|
+
footerButtons: [
|
|
55
|
+
<G9Button key="cancel" text={texts.cancel} variant="outline" size="hero" {...null !== fontSize ? {
|
|
56
|
+
fontSize
|
|
57
|
+
} : {}} onPress={()=>choose(false)}/>,
|
|
58
|
+
<ConfirmButton key="confirm" countdown={countdown} texts={texts} destructive={request.destructive} fontSize={fontSize} onPress={()=>choose(true)}/>
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
handle = sheetServiceOf(host).stack.show(<ConfirmBody request={request} texts={texts}/>, options, false);
|
|
62
|
+
const settle = ()=>{
|
|
63
|
+
stop();
|
|
64
|
+
decide(true === chosen);
|
|
65
|
+
};
|
|
66
|
+
if (handle) handle.result.then(settle);
|
|
67
|
+
else settle();
|
|
68
|
+
return {
|
|
69
|
+
dismiss: ()=>choose(false)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function ConfirmButton(props) {
|
|
73
|
+
const left = useSyncExternalStore((l)=>props.countdown.subscribe(l), ()=>props.countdown.get());
|
|
74
|
+
const ready = left <= 0;
|
|
75
|
+
return <G9Button text={ready ? props.texts.confirm : formatGuideText(props.texts.confirmIn, left)} variant={props.destructive ? 'error' : 'primary'} size="hero" {...null !== props.fontSize ? {
|
|
76
|
+
fontSize: props.fontSize
|
|
77
|
+
} : {}} disabled={!ready} onPress={props.onPress}/>;
|
|
78
|
+
}
|
|
79
|
+
function ConfirmBody(props) {
|
|
80
|
+
const { request, texts } = props;
|
|
81
|
+
const rtl = 'rtl' === useG9Direction();
|
|
82
|
+
const edge = useG9Settings().sheets.headerEdgeSpacing;
|
|
83
|
+
const align = {
|
|
84
|
+
textAlign: rtl ? 'right' : 'left'
|
|
85
|
+
};
|
|
86
|
+
const row = {
|
|
87
|
+
flexDirection: rtl ? 'row-reverse' : 'row',
|
|
88
|
+
direction: 'ltr'
|
|
89
|
+
};
|
|
90
|
+
const lines = request.changes.length > 0 ? request.changes : [
|
|
91
|
+
{
|
|
92
|
+
action: 'other',
|
|
93
|
+
subject: texts.undescribed
|
|
94
|
+
}
|
|
95
|
+
];
|
|
96
|
+
const progress = request.progress && request.progress.total > 1 ? request.progress : null;
|
|
97
|
+
return <view className="g9-guide-confirm" style={{
|
|
98
|
+
paddingLeft: `${edge}px`,
|
|
99
|
+
paddingRight: `${edge}px`,
|
|
100
|
+
direction: rtl ? 'rtl' : 'ltr'
|
|
101
|
+
}}>
|
|
102
|
+
<view className="g9-guide-confirm__meta" style={row}>
|
|
103
|
+
<text className="g9-guide-confirm__source" style={align}>
|
|
104
|
+
{texts.sources[request.source]}
|
|
105
|
+
</text>
|
|
106
|
+
{progress ? <text className="g9-guide-confirm__progress">
|
|
107
|
+
{formatGuideText(texts.confirmProgress, progress.index, progress.total)}
|
|
108
|
+
</text> : null}
|
|
109
|
+
</view>
|
|
110
|
+
{'link' === request.source ? <view className="g9-guide-confirm__warning">
|
|
111
|
+
<text className="g9-guide-confirm__warning-text" style={align}>
|
|
112
|
+
{texts.linkWarning}
|
|
113
|
+
</text>
|
|
114
|
+
</view> : null}
|
|
115
|
+
<text className="g9-guide-confirm__heading" style={align}>
|
|
116
|
+
{lines.length > 1 ? `${texts.changesTitle} (${lines.length})` : texts.changesTitle}
|
|
117
|
+
</text>
|
|
118
|
+
<view className="g9-guide-confirm__lines">
|
|
119
|
+
{lines.map((c, i)=>{
|
|
120
|
+
var _c_from, _c_to;
|
|
121
|
+
return <view key={`c${i}`} className={`g9-guide-confirm__line${0 === i ? ' g9-guide-confirm__line--first' : ''}`} style={row}>
|
|
122
|
+
<view className={`g9-guide-confirm__verb g9-guide-confirm__verb--${c.action}`}>
|
|
123
|
+
<text className={`g9-guide-confirm__verb-text g9-guide-confirm__verb-text--${c.action}`}>
|
|
124
|
+
{texts.actions[c.action]}
|
|
125
|
+
</text>
|
|
126
|
+
</view>
|
|
127
|
+
<view className="g9-guide-confirm__line-body">
|
|
128
|
+
<text className="g9-guide-confirm__subject" style={align}>
|
|
129
|
+
{c.field ? `${c.subject} · ${c.field}` : c.subject}
|
|
130
|
+
</text>
|
|
131
|
+
{void 0 !== c.from || void 0 !== c.to ? <text className="g9-guide-confirm__value" style={align}>
|
|
132
|
+
{}
|
|
133
|
+
{`${null != (_c_from = c.from) ? _c_from : '—'} ${rtl ? '←' : '→'} ${null != (_c_to = c.to) ? _c_to : '—'}`}
|
|
134
|
+
</text> : null}
|
|
135
|
+
{c.note ? <text className="g9-guide-confirm__note" style={align}>
|
|
136
|
+
{c.note}
|
|
137
|
+
</text> : null}
|
|
138
|
+
</view>
|
|
139
|
+
</view>;
|
|
140
|
+
})}
|
|
141
|
+
</view>
|
|
142
|
+
</view>;
|
|
143
|
+
}
|
|
144
|
+
export { presentConfirmSheet };
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=confirm-sheet.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guide/confirm-sheet.jsx","sources":["../../src/guide/confirm-sheet.tsx"],"sourcesContent":["import { type G9ChangeLine, type G9JourneySource, g9RuntimeTimers } from '@g9tm/lynxcontrols-foundation';\nimport { type ReactNode, useSyncExternalStore } from '@lynx-js/react';\nimport { G9Button } from '../button/button';\nimport type { G9HostHandle } from '../host/registry';\nimport { useG9Direction, useG9Settings } from '../provider/hooks';\nimport type { G9SheetOptions } from '../sheet/options';\nimport { sheetServiceOf } from '../sheet/service';\nimport type { G9SheetHandle } from '../sheet/stack';\nimport { formatGuideText, type G9GuideTexts, type G9ResolvedGuideSettings } from './settings';\n\n// The guided-save confirmation as the app's own kind of sheet (owner, 2026-11-12): a fit-to-content G9 sheet that grows\n// with what it lists up to 75 % of the screen and is smaller when there is less; the title fixed in the header, the body\n// (who asked, the link warning, every change) scrolling with a visible thumb once it is taller than the sheet allows; the\n// two G9 buttons fixed in the footer — the safe one leading (under the right thumb in Persian), the confirm one counting\n// down. It replaced a hand-drawn card whose buttons were not the app's and that had no height limit: a long list of\n// changes pushed its buttons off the screen.\n//\n// ⛔ The buttons carry no element id: an id makes a control an anchor, and an anchor is something a journey can press —\n// the confirm button must only ever be pressed by the person.\n\n/** What the sheet shows (the guide's `G9ConfirmRequest`). */\nexport interface G9ConfirmSheetRequest {\n readonly title: string;\n readonly source: G9JourneySource;\n readonly changes: readonly G9ChangeLine[];\n readonly seconds: number;\n readonly destructive: boolean;\n readonly progress?: { readonly index: number; readonly total: number };\n}\n\n/** An open confirmation: closes it as declined. */\nexport interface G9ConfirmSheetPresentation {\n dismiss(): void;\n}\n\ninterface Countdown {\n get(): number;\n subscribe(l: () => void): () => void;\n}\n\n/**\n * Opens the confirmation sheet on the host's sheet stack (stacked over an open sheet, never throttled). `decide` is\n * called exactly once, after the sheet has left the screen: true only for the unlocked confirm; the other button, the\n * header's close, a tap on the dim and Android back all decline (a fit sheet is never draggable).\n */\nexport function presentConfirmSheet(\n host: G9HostHandle,\n settings: G9ResolvedGuideSettings,\n request: G9ConfirmSheetRequest,\n decide: (ok: boolean) => void,\n): G9ConfirmSheetPresentation {\n let left = Math.max(0, Math.round(request.seconds));\n const listeners = new Set<() => void>();\n const countdown: Countdown = {\n get: () => left,\n subscribe(l) {\n listeners.add(l);\n return () => {\n listeners.delete(l);\n };\n },\n };\n let timer: unknown = null;\n const tick = () => {\n left = Math.max(0, left - 1);\n timer = left > 0 ? g9RuntimeTimers.setTimeout(tick, 1000) : null;\n for (const l of Array.from(listeners)) l();\n };\n if (left > 0) timer = g9RuntimeTimers.setTimeout(tick, 1000);\n const stop = () => {\n if (timer !== null) g9RuntimeTimers.clearTimeout(timer);\n timer = null;\n };\n\n // The answer: set once by a button (a second press, or one after the sheet started closing, is ignored), reported\n // once the sheet has left the screen. A close that no button made — the header, the dim, back — declines.\n let chosen: boolean | null = null;\n let handle: G9SheetHandle | null = null;\n const choose = (ok: boolean) => {\n // The confirm button is disabled while counting; this holds even for a press that reached it some other way.\n if (chosen !== null || handle?.isOpen === false || (ok && left > 0)) return;\n chosen = ok;\n stop();\n handle?.close();\n };\n\n const texts = settings.texts;\n const fontSize = settings.confirmButtonFontSize;\n const options: G9SheetOptions = {\n sizeMode: 'fitToContent',\n maxFitToContentHeightRatio: 0.75,\n isCancelable: true,\n isDraggable: true,\n hasHandle: true,\n deferContent: false,\n showToolbar: true,\n showCloseButton: true,\n headerTitlePlacement: 'center',\n scrollIndicator: 'always',\n automationId: 'G9GuideConfirm',\n ...settings.confirmSheet(),\n title: request.title,\n footerButtons: [\n <G9Button\n key=\"cancel\"\n text={texts.cancel}\n variant=\"outline\"\n size=\"hero\"\n {...(fontSize !== null ? { fontSize } : {})}\n onPress={() => choose(false)}\n />,\n <ConfirmButton\n key=\"confirm\"\n countdown={countdown}\n texts={texts}\n destructive={request.destructive}\n fontSize={fontSize}\n onPress={() => choose(true)}\n />,\n ],\n };\n handle = sheetServiceOf(host).stack.show(<ConfirmBody request={request} texts={texts} />, options, false);\n const settle = () => {\n stop();\n decide(chosen === true);\n };\n // No sheet (the host's stack is gone): nothing was asked, nothing is confirmed.\n if (handle) void handle.result.then(settle);\n else settle();\n return { dismiss: () => choose(false) };\n}\n\nfunction ConfirmButton(props: {\n readonly countdown: Countdown;\n readonly texts: G9GuideTexts;\n readonly destructive: boolean;\n readonly fontSize: number | null;\n readonly onPress: () => void;\n}): ReactNode {\n const left = useSyncExternalStore(\n (l) => props.countdown.subscribe(l),\n () => props.countdown.get(),\n );\n const ready = left <= 0;\n return (\n <G9Button\n text={ready ? props.texts.confirm : formatGuideText(props.texts.confirmIn, left)}\n variant={props.destructive ? 'error' : 'primary'}\n size=\"hero\"\n {...(props.fontSize !== null ? { fontSize: props.fontSize } : {})}\n disabled={!ready}\n onPress={props.onPress}\n />\n );\n}\n\n/** Who asked, the link's warning, then every change — the part that scrolls. */\nfunction ConfirmBody(props: { readonly request: G9ConfirmSheetRequest; readonly texts: G9GuideTexts }): ReactNode {\n const { request, texts } = props;\n const rtl = useG9Direction() === 'rtl';\n // The header's own side spacing (MAUI EdgeSpacing, an app may scale it): the body lines up under the title.\n const edge = useG9Settings().sheets.headerEdgeSpacing;\n const align = { textAlign: rtl ? ('right' as const) : ('left' as const) };\n const row = { flexDirection: rtl ? ('row-reverse' as const) : ('row' as const), direction: 'ltr' as const };\n const lines: readonly G9ChangeLine[] =\n request.changes.length > 0 ? request.changes : [{ action: 'other', subject: texts.undescribed }];\n const progress = request.progress && request.progress.total > 1 ? request.progress : null;\n return (\n <view\n className=\"g9-guide-confirm\"\n style={{ paddingLeft: `${edge}px`, paddingRight: `${edge}px`, direction: rtl ? 'rtl' : 'ltr' }}\n >\n <view className=\"g9-guide-confirm__meta\" style={row}>\n <text className=\"g9-guide-confirm__source\" style={align}>\n {texts.sources[request.source]}\n </text>\n {progress ? (\n <text className=\"g9-guide-confirm__progress\">\n {formatGuideText(texts.confirmProgress, progress.index, progress.total)}\n </text>\n ) : null}\n </view>\n {request.source === 'link' ? (\n <view className=\"g9-guide-confirm__warning\">\n <text className=\"g9-guide-confirm__warning-text\" style={align}>\n {texts.linkWarning}\n </text>\n </view>\n ) : null}\n <text className=\"g9-guide-confirm__heading\" style={align}>\n {lines.length > 1 ? `${texts.changesTitle} (${lines.length})` : texts.changesTitle}\n </text>\n <view className=\"g9-guide-confirm__lines\">\n {lines.map((c, i) => (\n <view\n key={`c${i}`}\n className={`g9-guide-confirm__line${i === 0 ? ' g9-guide-confirm__line--first' : ''}`}\n style={row}\n >\n <view className={`g9-guide-confirm__verb g9-guide-confirm__verb--${c.action}`}>\n <text className={`g9-guide-confirm__verb-text g9-guide-confirm__verb-text--${c.action}`}>\n {texts.actions[c.action]}\n </text>\n </view>\n <view className=\"g9-guide-confirm__line-body\">\n <text className=\"g9-guide-confirm__subject\" style={align}>\n {c.field ? `${c.subject} · ${c.field}` : c.subject}\n </text>\n {c.from !== undefined || c.to !== undefined ? (\n <text className=\"g9-guide-confirm__value\" style={align}>\n {/* The arrow points from the old value to the new one in the reading direction (→ drawn in a\n right-to-left line pointed back at the old value). */}\n {`${c.from ?? '—'} ${rtl ? '←' : '→'} ${c.to ?? '—'}`}\n </text>\n ) : null}\n {c.note ? (\n <text className=\"g9-guide-confirm__note\" style={align}>\n {c.note}\n </text>\n ) : null}\n </view>\n </view>\n ))}\n </view>\n </view>\n );\n}\n"],"names":["presentConfirmSheet","host","settings","request","decide","left","Math","listeners","Set","countdown","l","timer","tick","g9RuntimeTimers","Array","stop","chosen","handle","choose","ok","texts","fontSize","options","G9Button","ConfirmButton","sheetServiceOf","ConfirmBody","settle","props","useSyncExternalStore","ready","formatGuideText","rtl","useG9Direction","edge","useG9Settings","align","row","lines","progress","view","text","c","i","_c_from","_c_to","undefined"],"mappings":";;;;;;AA6CO,SAASA,oBACdC,IAAkB,EAClBC,QAAiC,EACjCC,OAA8B,EAC9BC,MAA6B;IAE7B,IAAIC,OAAOC,KAAK,GAAG,CAAC,GAAGA,KAAK,KAAK,CAACH,QAAQ,OAAO;IACjD,MAAMI,YAAY,IAAIC;IACtB,MAAMC,YAAuB;QAC3B,KAAK,IAAMJ;QACX,WAAUK,CAAC;YACTH,UAAU,GAAG,CAACG;YACd,OAAO;gBACLH,UAA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