@fragiola/primitives 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/{index-CGThV_Md.d.ts → index-xxjUk2wl.d.ts} +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{number-BFUio97d.js → number-2v2_PnXO.js} +6 -3
- package/dist/number-2v2_PnXO.js.map +1 -0
- package/dist/number.d.ts +1 -1
- package/dist/number.js +1 -1
- package/package.json +1 -1
- package/dist/number-BFUio97d.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @fragiola/primitives
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#123](https://github.com/fragiola/primitives/pull/123) [`18fd0ff`](https://github.com/fragiola/primitives/commit/18fd0ff180f8b7af9586db77b67b105281b89242) Thanks [@maurodesouza](https://github.com/maurodesouza)! - NumberField reports the committed value: `onValueCommitted` (Vue `@value-committed`, Angular `(valueCommitted)`) is called once a change is complete, on blur after typing, at a key or wheel step, at the release of a button press or a scrub. The toolkit's `watchAutoRepeat` takes an `onEnd` callback.
|
|
8
|
+
|
|
9
|
+
Combobox takes `autoHighlight`: typing highlights the first item the text keeps, so Enter chooses it, as Autocomplete's.
|
|
10
|
+
|
|
3
11
|
## 0.1.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -5,6 +5,11 @@ interface AutoRepeatOptions {
|
|
|
5
5
|
* `false` to stop the repeat (a bound reached).
|
|
6
6
|
*/
|
|
7
7
|
onStep: (event: Event) => boolean | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* The press is over: released, canceled, left, the window blurred, or stopped at a bound; and
|
|
10
|
+
* after the single step of a click no press started. A NumberField commits its value here.
|
|
11
|
+
*/
|
|
12
|
+
onEnd?: (event: Event) => void;
|
|
8
13
|
/** How long a press lasts before the repeat starts, in ms (default 400, Base UI). */
|
|
9
14
|
delay?: number;
|
|
10
15
|
/** The time between two repeated steps, in ms (default 60, Base UI). */
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ import { n as ImageSourceOptions, r as watchImageStatus, t as ImageLoadingStatus
|
|
|
22
22
|
import { n as blockOutsidePointer, t as inertOutside } from "./index-BNlMm-0u.js";
|
|
23
23
|
import { a as watchFocusOutside, i as interceptEscape, n as LayerOptions, r as pushLayer, t as Layer } from "./index-DeHcNdjC.js";
|
|
24
24
|
import { a as PlainYear, c as YearRange, d as monthIndex, f as toIsoYear, i as formatYearSpan, l as currentYearMonth, n as formatYear, o as PlainYearMonth, p as toIsoYearMonth, r as formatYearMonth, s as YearMonthRange, t as formatMonthName, u as fromMonthIndex } from "./index-BapNrjY9.js";
|
|
25
|
-
import { a as clampNumber, c as parseNumber, d as numberFormatOptions, f as AutoRepeatOptions, i as NumberStepOptions, l as NumberFormatOptions, n as ScrubPoint, o as stepNumber, p as watchAutoRepeat, r as watchScrub, s as isNumberText, t as ScrubOptions, u as formatNumber } from "./index-
|
|
25
|
+
import { a as clampNumber, c as parseNumber, d as numberFormatOptions, f as AutoRepeatOptions, i as NumberStepOptions, l as NumberFormatOptions, n as ScrubPoint, o as stepNumber, p as watchAutoRepeat, r as watchScrub, s as isNumberText, t as ScrubOptions, u as formatNumber } from "./index-xxjUk2wl.js";
|
|
26
26
|
import { a as openOverlaySession, i as OverlaySessionOptions, n as DismissReason, r as OverlaySession, t as DismissEvent } from "./index-HIksgK0e.js";
|
|
27
27
|
import { a as pageCount, i as clampPage, n as PaginationItem, o as paginationRange, r as PaginationRangeOptions, t as PageCountOptions } from "./index-raSUg9U7.js";
|
|
28
28
|
import { a as watchLongPress, c as isInSafeArea, i as LongPressOptions, l as DragSessionOptions, n as HoverBridgeCallbacks, o as isInHoverBridge, r as trackHoverBridge, s as Point, t as watchPointerExit, u as startDrag } from "./index-IZB0mlZl.js";
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import { n as blockOutsidePointer, t as inertOutside } from "./inert-DlGToy3q.js
|
|
|
23
23
|
import { n as watchFocusOutside, t as pushLayer } from "./layer-stack-BEtzaFC1.js";
|
|
24
24
|
import { t as interceptEscape } from "./layers-C-N4rrZX.js";
|
|
25
25
|
import { a as UNIT_PAGE_SIZE, c as unitRows, d as monthIndex, f as toIsoYear, i as formatYearSpan, l as currentYearMonth, n as formatYear, o as unitKeyTarget, p as toIsoYearMonth, r as formatYearMonth, s as unitPageStart, t as formatMonthName, u as fromMonthIndex } from "./month-year-BG5imFUq.js";
|
|
26
|
-
import { a as parseNumber, c as watchAutoRepeat, i as isNumberText, n as clampNumber, o as formatNumber, r as stepNumber, s as numberFormatOptions, t as watchScrub } from "./number-
|
|
26
|
+
import { a as parseNumber, c as watchAutoRepeat, i as isNumberText, n as clampNumber, o as formatNumber, r as stepNumber, s as numberFormatOptions, t as watchScrub } from "./number-2v2_PnXO.js";
|
|
27
27
|
import { t as openOverlaySession } from "./overlay-BwPyiM3T.js";
|
|
28
28
|
import { n as pageCount, r as paginationRange, t as clampPage } from "./pagination-BkVzaIGP.js";
|
|
29
29
|
import { a as isInHoverBridge, i as watchLongPress, n as watchPointerExit, r as isInSafeArea, t as trackHoverBridge } from "./pointer-CuDtD9XA.js";
|
|
@@ -13,7 +13,7 @@ function watchAutoRepeat(element, options) {
|
|
|
13
13
|
let timer;
|
|
14
14
|
let pressed = false;
|
|
15
15
|
let swallowClick = false;
|
|
16
|
-
const stop = () => {
|
|
16
|
+
const stop = (event) => {
|
|
17
17
|
if (timer !== void 0) {
|
|
18
18
|
view?.clearTimeout(timer);
|
|
19
19
|
view?.clearInterval(timer);
|
|
@@ -28,6 +28,7 @@ function watchAutoRepeat(element, options) {
|
|
|
28
28
|
doc.removeEventListener("pointercancel", stop, true);
|
|
29
29
|
element.removeEventListener("pointerleave", stop);
|
|
30
30
|
view?.removeEventListener("blur", stop);
|
|
31
|
+
if (event !== void 0) options.onEnd?.(event);
|
|
31
32
|
};
|
|
32
33
|
const onDown = (event) => {
|
|
33
34
|
if (event.button !== 0 || !event.isPrimary) return;
|
|
@@ -37,6 +38,7 @@ function watchAutoRepeat(element, options) {
|
|
|
37
38
|
view?.setTimeout(() => {
|
|
38
39
|
swallowClick = false;
|
|
39
40
|
}, 1e3);
|
|
41
|
+
options.onEnd?.(event);
|
|
40
42
|
return;
|
|
41
43
|
}
|
|
42
44
|
pressed = true;
|
|
@@ -46,7 +48,7 @@ function watchAutoRepeat(element, options) {
|
|
|
46
48
|
view?.addEventListener("blur", stop);
|
|
47
49
|
timer = view?.setTimeout(() => {
|
|
48
50
|
timer = view?.setInterval(() => {
|
|
49
|
-
if (options.onStep(event) === false) stop();
|
|
51
|
+
if (options.onStep(event) === false) stop(event);
|
|
50
52
|
}, interval);
|
|
51
53
|
}, delay);
|
|
52
54
|
};
|
|
@@ -56,6 +58,7 @@ function watchAutoRepeat(element, options) {
|
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
58
60
|
options.onStep(event);
|
|
61
|
+
options.onEnd?.(event);
|
|
59
62
|
};
|
|
60
63
|
const onMouseDown = (event) => {
|
|
61
64
|
if (event.button === 0) event.preventDefault();
|
|
@@ -313,4 +316,4 @@ function watchScrub(element, options) {
|
|
|
313
316
|
}
|
|
314
317
|
export { parseNumber as a, watchAutoRepeat as c, isNumberText as i, clampNumber as n, formatNumber as o, stepNumber as r, numberFormatOptions as s, watchScrub as t };
|
|
315
318
|
|
|
316
|
-
//# sourceMappingURL=number-
|
|
319
|
+
//# sourceMappingURL=number-2v2_PnXO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-2v2_PnXO.js","names":[],"sources":["../src/number/auto-repeat.ts","../src/number/number-format.ts","../src/number/number-parse.ts","../src/number/number-step.ts","../src/number/scrub.ts"],"sourcesContent":["export interface AutoRepeatOptions {\n /**\n * One step: at the press, then again every `interval` once the press lasted `delay`; a click\n * that no pointer press started (the keyboard, assistive technology) steps once. Return\n * `false` to stop the repeat (a bound reached).\n */\n onStep: (event: Event) => boolean | undefined;\n /**\n * The press is over: released, canceled, left, the window blurred, or stopped at a bound; and\n * after the single step of a click no press started. A NumberField commits its value here.\n */\n onEnd?: (event: Event) => void;\n /** How long a press lasts before the repeat starts, in ms (default 400, Base UI). */\n delay?: number;\n /** The time between two repeated steps, in ms (default 60, Base UI). */\n interval?: number;\n}\n\n/**\n * Press and hold on `element` (spec/number-field.md, \"Pointer\": an Increment or Decrement button):\n * a primary pointer's press steps at once, and keeps stepping while it is held, until it is\n * released, canceled or leaves the element, or the window loses focus. A mouse press keeps the\n * focus where it is (its `mousedown` default is prevented), so the field's input stays focused. The `click`\n * that ends a pointer press steps no more; any other click steps once. Returns the cleanup.\n */\nexport function watchAutoRepeat(\n element: Element,\n options: AutoRepeatOptions,\n): () => void {\n const { delay = 400, interval = 60 } = options;\n const doc = element.ownerDocument;\n const view = doc.defaultView;\n let timer: number | undefined;\n let pressed = false;\n // the click that follows a pointer press, already stepped at its pointerdown\n let swallowClick = false;\n\n const stop = (event?: Event) => {\n if (timer !== undefined) {\n view?.clearTimeout(timer);\n view?.clearInterval(timer);\n timer = undefined;\n }\n if (!pressed) {\n return;\n }\n pressed = false;\n // the click a release sends comes before this task ends; a press that sends none\n // (released outside, a long touch, a button disabled at its bound) swallows no later\n // click\n view?.setTimeout(() => {\n swallowClick = false;\n });\n doc.removeEventListener(\"pointerup\", stop, true);\n doc.removeEventListener(\"pointercancel\", stop, true);\n element.removeEventListener(\"pointerleave\", stop);\n view?.removeEventListener(\"blur\", stop);\n if (event !== undefined) {\n options.onEnd?.(event);\n }\n };\n const onDown = (event: PointerEvent) => {\n if (event.button !== 0 || !event.isPrimary) {\n return;\n }\n stop();\n swallowClick = true;\n if (options.onStep(event) === false) {\n view?.setTimeout(() => {\n swallowClick = false;\n }, 1000);\n options.onEnd?.(event);\n return;\n }\n pressed = true;\n doc.addEventListener(\"pointerup\", stop, true);\n doc.addEventListener(\"pointercancel\", stop, true);\n element.addEventListener(\"pointerleave\", stop);\n view?.addEventListener(\"blur\", stop);\n timer = view?.setTimeout(() => {\n timer = view?.setInterval(() => {\n if (options.onStep(event) === false) {\n stop(event);\n }\n }, interval);\n }, delay);\n };\n const onClick = (event: Event) => {\n if (swallowClick) {\n swallowClick = false;\n return;\n }\n options.onStep(event);\n options.onEnd?.(event);\n };\n // a mouse press moves no focus: the field's input keeps it (APG: focus stays on the text\n // field)\n const onMouseDown = (event: MouseEvent) => {\n if (event.button === 0) {\n event.preventDefault();\n }\n };\n // a held touch opens no context menu\n const onContextMenu = (event: Event) => {\n if (pressed) {\n event.preventDefault();\n }\n };\n element.addEventListener(\"pointerdown\", onDown as EventListener);\n element.addEventListener(\"mousedown\", onMouseDown as EventListener);\n element.addEventListener(\"click\", onClick);\n element.addEventListener(\"contextmenu\", onContextMenu);\n return () => {\n stop();\n element.removeEventListener(\"pointerdown\", onDown as EventListener);\n element.removeEventListener(\"mousedown\", onMouseDown as EventListener);\n element.removeEventListener(\"click\", onClick);\n element.removeEventListener(\"contextmenu\", onContextMenu);\n };\n}\n","/** How a number field writes and reads its value (spec/number-field.md, \"API\"). */\nexport interface NumberFormatOptions {\n /** The locale (BCP 47; default: the runtime's). */\n locale?: string | undefined;\n /** `Intl.NumberFormat` options; without them, the plain number with every decimal it has. */\n format?: Intl.NumberFormatOptions | undefined;\n}\n\n/** The `Intl.NumberFormat` options a field formats with: `format`, else every decimal kept. */\nexport function numberFormatOptions(\n format: Intl.NumberFormatOptions | undefined,\n): Intl.NumberFormatOptions {\n return format ?? { maximumFractionDigits: 20 };\n}\n\n/**\n * `value` as the field writes it (spec/number-field.md): `Intl.NumberFormat` of the locale and\n * the format; `\"\"` for `null` (an empty field).\n */\nexport function formatNumber(\n value: number | null,\n options: NumberFormatOptions = {},\n): string {\n if (value === null || Number.isNaN(value)) {\n return \"\";\n }\n return new Intl.NumberFormat(\n options.locale,\n numberFormatOptions(options.format),\n ).format(value);\n}\n","import {\n type NumberFormatOptions,\n numberFormatOptions,\n} from \"./number-format.ts\";\n\n/** The text a locale and a format write numbers with (spec/number-field.md, \"Typing\"). */\ninterface NumberSymbols {\n /** Each localized digit, mapped to its ASCII digit. */\n digits: Map<string, string>;\n group: string;\n decimal: string;\n /** The characters of the format's other text: currency, unit, percent sign, literals. */\n text: Set<string>;\n percent: boolean;\n accounting: boolean;\n}\n\n// the minus signs and plus signs a user may type, whatever the locale writes\nconst MINUS = \"-−‐‑‒–﹣-\";\nconst PLUS = \"++\";\n// the percent signs a percent field accepts beside the locale's\nconst PERCENT = \"%٪﹪%\";\n// bidirectional marks, which some locales write around a sign (ar-EG: U+061C)\nconst BIDI = /[--]/g;\n// the Arabic-Indic and Extended Arabic-Indic digits, read in every locale (as the ASCII ones)\nconst ARABIC = \"٠١٢٣٤٥٦٧٨٩\";\nconst PERSIAN = \"۰۱۲۳۴۵۶۷۸۹\";\n\nfunction symbolsOf(options: NumberFormatOptions): NumberSymbols {\n const format = numberFormatOptions(options.format);\n const formatter = new Intl.NumberFormat(options.locale, {\n ...format,\n useGrouping: true,\n });\n const { numberingSystem } = formatter.resolvedOptions();\n const digitFormatter = new Intl.NumberFormat(options.locale, {\n numberingSystem,\n useGrouping: false,\n });\n const digits = new Map<string, string>();\n for (let digit = 0; digit <= 9; digit += 1) {\n digits.set(String(digit), String(digit));\n digits.set(digitFormatter.format(digit), String(digit));\n digits.set(ARABIC[digit] as string, String(digit));\n digits.set(PERSIAN[digit] as string, String(digit));\n }\n let group = \"\";\n let decimal = \".\";\n const text = new Set<string>();\n for (const part of formatter.formatToParts(-12345.6)) {\n if (part.type === \"group\") {\n group = part.value;\n } else if (part.type === \"decimal\") {\n decimal = part.value;\n } else if (\n part.type === \"currency\" ||\n part.type === \"unit\" ||\n part.type === \"percentSign\" ||\n part.type === \"literal\"\n ) {\n for (const character of part.value) {\n text.add(character);\n }\n }\n }\n const percent = format.style === \"percent\";\n if (percent) {\n for (const character of PERCENT) {\n text.add(character);\n }\n }\n return {\n digits,\n group,\n decimal,\n text,\n percent,\n accounting: format.currencySign === \"accounting\",\n };\n}\n\n/**\n * The text reduced to ASCII digits, `.` and `-` (and whatever else was typed), or `null` when a\n * character is none a number of this locale and format can hold.\n */\nfunction normalize(text: string, symbols: NumberSymbols): string | null {\n let negative = false;\n let result = \"\";\n const source = text.replace(BIDI, \"\").replace(/\\s/g, \"\");\n const groupIsSpace = /^\\s*$/.test(symbols.group.replace(BIDI, \"\"));\n for (const character of source) {\n const digit = symbols.digits.get(character);\n if (digit !== undefined) {\n result += digit;\n } else if (character === symbols.decimal) {\n result += \".\";\n } else if (!groupIsSpace && character === symbols.group) {\n // a grouping separator carries no value\n } else if (character === \".\" || character === \",\") {\n // the other separator, where the locale's group is not it: a decimal point (`1.5` in\n // ar-EG, whose own is U+066B)\n result += \".\";\n } else if (MINUS.includes(character)) {\n negative = !negative;\n } else if (PLUS.includes(character)) {\n // a plus sign changes nothing\n } else if (\n symbols.accounting &&\n (character === \"(\" || character === \")\")\n ) {\n if (character === \"(\") {\n negative = !negative;\n }\n } else if (symbols.text.has(character)) {\n // the currency, the unit, the percent sign: text of the format, not of the value\n } else {\n return null;\n }\n }\n return `${negative ? \"-\" : \"\"}${result}`;\n}\n\n/**\n * Whether `text` holds only what a number of this locale and format is written with (the\n * localized digits, the group and decimal separators, the signs, the format's own text), so a\n * field accepts it while it is typed (spec/number-field.md, \"Typing\"): `\"1.2\"`, `\"-\"` and `\"\"`\n * pass, `\"12a\"` does not.\n */\nexport function isNumberText(\n text: string,\n options: NumberFormatOptions = {},\n): boolean {\n return normalize(text, symbolsOf(options)) !== null;\n}\n\n/**\n * The number `text` writes in this locale and format (spec/number-field.md, \"Typing\"): the\n * localized digits (Arabic-Indic, ...), the group and decimal separators, any minus sign, the\n * currency, unit and percent text; a percent format reads `25%` as `0.25`. `null` for a text with\n * no digit (empty, or a sign alone), `NaN` for one that is no number (`1.2.3`, `12a`).\n */\nexport function parseNumber(\n text: string,\n options: NumberFormatOptions = {},\n): number | null {\n const symbols = symbolsOf(options);\n const normalized = normalize(text, symbols);\n if (normalized === null) {\n return Number.NaN;\n }\n if (!/\\d/.test(normalized)) {\n return normalized.replace(\"-\", \"\") === \"\" ? null : Number.NaN;\n }\n if (!/^-?(\\d+\\.?\\d*|\\.\\d+)$/.test(normalized)) {\n return Number.NaN;\n }\n const value = Number(normalized);\n if (!symbols.percent) {\n return value === 0 ? 0 : value;\n }\n // 25% is 0.25: divided by 100 with the decimals it had, so no floating-point noise is added\n const decimals = (normalized.split(\".\")[1] ?? \"\").length;\n const fraction = Number((value / 100).toFixed(decimals + 2));\n return fraction === 0 ? 0 : fraction;\n}\n","/** The bounds and grid a number field steps within (spec/number-field.md, \"API\"). */\nexport interface NumberStepOptions {\n /** The lowest value; none when not given. */\n min?: number | undefined;\n /** The highest value; none when not given. */\n max?: number | undefined;\n /** Step to the grid of `|amount|` (counted from `min`, else from 0) instead of by `amount`. */\n snapOnStep?: boolean | undefined;\n}\n\nfunction decimalsOf(value: number): number {\n if (!Number.isFinite(value)) {\n return 0;\n }\n const text = String(value);\n const exponent = /e-(\\d+)$/.exec(text);\n if (exponent !== null) {\n return (\n Number(exponent[1]) +\n (text.split(\".\")[1]?.split(\"e\")[0] ?? \"\").length\n );\n }\n return (text.split(\".\")[1] ?? \"\").length;\n}\n\n/** `value` rounded to `decimals`, without floating-point noise (0.1 + 0.2). */\nfunction roundTo(value: number, decimals: number): number {\n const rounded = Number(value.toFixed(Math.min(decimals, 20)));\n return rounded === 0 ? 0 : rounded;\n}\n\n/** `value` within `[min, max]` (either bound may be missing). */\nexport function clampNumber(\n value: number,\n min: number | undefined,\n max: number | undefined,\n): number {\n let result = value;\n if (max !== undefined && result > max) {\n result = max;\n }\n if (min !== undefined && result < min) {\n result = min;\n }\n return result;\n}\n\n/**\n * The value one step of `amount` away (negative: down), clamped to `[min, max]`\n * (spec/number-field.md, \"Stepping\"). An empty field (`null`) starts at 0, clamped, with no step\n * (Base UI). With `snapOnStep`, a value off the grid of `|amount|` goes to the next grid point in\n * the step's direction (`1.5` up by 1 gives `2`, down gives `1`).\n */\nexport function stepNumber(\n value: number | null,\n amount: number,\n options: NumberStepOptions = {},\n): number {\n const { min, max, snapOnStep = false } = options;\n if (value === null || Number.isNaN(value)) {\n return clampNumber(0, min, max);\n }\n const decimals = Math.max(\n decimalsOf(value),\n decimalsOf(amount),\n decimalsOf(min ?? 0),\n );\n if (!snapOnStep || amount === 0) {\n return clampNumber(roundTo(value + amount, decimals), min, max);\n }\n const grid = Math.abs(amount);\n const base = min ?? 0;\n // the grid index, without the noise of a division (2.9999999 is 3)\n const index = roundTo((value - base) / grid, 10);\n const target = amount > 0 ? Math.floor(index) + 1 : Math.ceil(index) - 1;\n const gridDecimals = Math.max(decimalsOf(grid), decimalsOf(base));\n return clampNumber(roundTo(base + target * grid, gridDecimals), min, max);\n}\n","/** A point in the viewport, in CSS pixels. */\nexport interface ScrubPoint {\n x: number;\n y: number;\n}\n\nexport interface ScrubOptions {\n /** The axis the pointer scrubs along (default `\"horizontal\"`). */\n direction?: \"horizontal\" | \"vertical\";\n /** The distance one step takes, in px (default 2, Base UI). */\n pixelSensitivity?: number;\n /** A press starts a scrub unless this returns `false` (a disabled or read-only field). */\n onStart: (event: PointerEvent) => boolean | undefined;\n /**\n * The pointer moved by `steps` sensitivities along the axis: right or up is positive. Called\n * once per move that crosses at least one.\n */\n onScrub: (steps: number, event: PointerEvent) => void;\n /** The scrub ended: the pointer was released or canceled. */\n onEnd: (event: PointerEvent) => void;\n /**\n * Where the virtual cursor is while the pointer is locked (the real one is hidden), wrapped\n * around the viewport's edges; `null` once it is unlocked or the scrub ended.\n */\n onCursor?: (point: ScrubPoint | null) => void;\n}\n\n/**\n * Scrubbing on `element` (spec/number-field.md, \"Scrub\"): a primary pointer's press starts it,\n * and every `pixelSensitivity` pixels of movement along `direction` is a step, until the pointer\n * is released. A mouse asks for the pointer lock (the movement then never meets the screen's\n * edges, and `onCursor` follows a virtual cursor); a denied lock only leaves the real cursor.\n * The press's default is prevented, so no text is selected. Returns the cleanup.\n */\nexport function watchScrub(\n element: Element,\n options: ScrubOptions,\n): () => void {\n const { direction = \"horizontal\", pixelSensitivity = 2 } = options;\n const doc = element.ownerDocument;\n const view = doc.defaultView;\n let active: { pointerId: number } | null = null;\n let last: ScrubPoint = { x: 0, y: 0 };\n let cursor: ScrubPoint = { x: 0, y: 0 };\n let pending = 0;\n\n const locked = () => doc.pointerLockElement === element;\n const end = (event: PointerEvent) => {\n if (active === null || event.pointerId !== active.pointerId) {\n return;\n }\n active = null;\n doc.removeEventListener(\"pointermove\", onMove, true);\n doc.removeEventListener(\"pointerup\", end, true);\n doc.removeEventListener(\"pointercancel\", end, true);\n if (locked()) {\n doc.exitPointerLock();\n }\n options.onCursor?.(null);\n options.onEnd(event);\n };\n const onMove = (event: PointerEvent) => {\n if (active === null || event.pointerId !== active.pointerId) {\n return;\n }\n // locked, the pointer stays where it was: its movement is the event's own\n const isLocked = locked();\n const dx = isLocked ? event.movementX : event.clientX - last.x;\n const dy = isLocked ? event.movementY : event.clientY - last.y;\n last = { x: event.clientX, y: event.clientY };\n if (isLocked && view !== null) {\n const width = view.innerWidth;\n const height = view.innerHeight;\n cursor = {\n x: (((cursor.x + dx) % width) + width) % width,\n y: (((cursor.y + dy) % height) + height) % height,\n };\n options.onCursor?.(cursor);\n }\n pending += direction === \"vertical\" ? -dy : dx;\n const steps = Math.trunc(pending / pixelSensitivity);\n if (steps !== 0) {\n pending -= steps * pixelSensitivity;\n options.onScrub(steps, event);\n }\n };\n const onDown = (event: PointerEvent) => {\n if (event.button !== 0 || !event.isPrimary || active !== null) {\n return;\n }\n if (options.onStart(event) === false) {\n return;\n }\n event.preventDefault();\n active = { pointerId: event.pointerId };\n last = { x: event.clientX, y: event.clientY };\n cursor = { ...last };\n pending = 0;\n doc.addEventListener(\"pointermove\", onMove, true);\n doc.addEventListener(\"pointerup\", end, true);\n doc.addEventListener(\"pointercancel\", end, true);\n if (event.pointerType === \"mouse\") {\n try {\n const request = (\n element as Element & {\n requestPointerLock?: () => Promise<void> | undefined;\n }\n ).requestPointerLock?.();\n request?.then(\n () => {\n if (!locked()) {\n return;\n }\n if (active === null) {\n // granted after a quick click ended the scrub: never kept\n doc.exitPointerLock();\n } else {\n options.onCursor?.(cursor);\n }\n },\n () => {},\n );\n } catch {\n // a denied lock leaves the real cursor\n }\n }\n };\n // a lock granted with no promise (Firefox) after the scrub ended is released too\n const onLockChange = () => {\n if (active === null && locked()) {\n doc.exitPointerLock();\n }\n };\n element.addEventListener(\"pointerdown\", onDown as EventListener);\n doc.addEventListener(\"pointerlockchange\", onLockChange);\n return () => {\n element.removeEventListener(\"pointerdown\", onDown as EventListener);\n doc.removeEventListener(\"pointerlockchange\", onLockChange);\n doc.removeEventListener(\"pointermove\", onMove, true);\n doc.removeEventListener(\"pointerup\", end, true);\n doc.removeEventListener(\"pointercancel\", end, true);\n if (active !== null && locked()) {\n doc.exitPointerLock();\n }\n active = null;\n };\n}\n"],"mappings":";;;;;;;;AAyBA,SAAgB,gBACZ,SACA,SACU;CACV,MAAM,EAAE,QAAQ,KAAK,WAAW,OAAO;CACvC,MAAM,MAAM,QAAQ;CACpB,MAAM,OAAO,IAAI;CACjB,IAAI;CACJ,IAAI,UAAU;CAEd,IAAI,eAAe;CAEnB,MAAM,QAAQ,UAAkB;EAC5B,IAAI,UAAU,KAAA,GAAW;GACrB,MAAM,aAAa,KAAK;GACxB,MAAM,cAAc,KAAK;GACzB,QAAQ,KAAA;EACZ;EACA,IAAI,CAAC,SACD;EAEJ,UAAU;EAIV,MAAM,iBAAiB;GACnB,eAAe;EACnB,CAAC;EACD,IAAI,oBAAoB,aAAa,MAAM,IAAI;EAC/C,IAAI,oBAAoB,iBAAiB,MAAM,IAAI;EACnD,QAAQ,oBAAoB,gBAAgB,IAAI;EAChD,MAAM,oBAAoB,QAAQ,IAAI;EACtC,IA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qBAAqB,YAAY;CACtD,aAAa;EACT,QAAQ,oBAAoB,eAAe,MAAuB;EAClE,IAAI,oBAAoB,qBAAqB,YAAY;EACzD,IAAI,oBAAoB,eAAe,QAAQ,IAAI;EACnD,IAAI,oBAAoB,aAAa,KAAK,IAAI;EAC9C,IAAI,oBAAoB,iBAAiB,KAAK,IAAI;EAClD,IAAI,WAAW,QAAQ,OAAO,GAC1B,IAAI,gBAAgB;EAExB,SAAS;CACb;AACJ"}
|
package/dist/number.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as clampNumber, c as parseNumber, d as numberFormatOptions, f as AutoRepeatOptions, i as NumberStepOptions, l as NumberFormatOptions, n as ScrubPoint, o as stepNumber, p as watchAutoRepeat, r as watchScrub, s as isNumberText, t as ScrubOptions, u as formatNumber } from "./index-
|
|
1
|
+
import { a as clampNumber, c as parseNumber, d as numberFormatOptions, f as AutoRepeatOptions, i as NumberStepOptions, l as NumberFormatOptions, n as ScrubPoint, o as stepNumber, p as watchAutoRepeat, r as watchScrub, s as isNumberText, t as ScrubOptions, u as formatNumber } from "./index-xxjUk2wl.js";
|
|
2
2
|
export { type AutoRepeatOptions, type NumberFormatOptions, type NumberStepOptions, type ScrubOptions, type ScrubPoint, clampNumber, formatNumber, isNumberText, numberFormatOptions, parseNumber, stepNumber, watchAutoRepeat, watchScrub };
|
package/dist/number.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as clampNumber, o as formatNumber, i as isNumberText, s as numberFormatOptions, a as parseNumber, r as stepNumber, c as watchAutoRepeat, t as watchScrub } from "./number-
|
|
1
|
+
export { n as clampNumber, o as formatNumber, i as isNumberText, s as numberFormatOptions, a as parseNumber, r as stepNumber, c as watchAutoRepeat, t as watchScrub } from "./number-2v2_PnXO.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fragiola/primitives",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "The framework-free DOM toolkit of Fragiola Primitives: overlays, layers, focus, scroll lock, positioning, collections, dates and more, one entry per mechanism.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"headless",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number-BFUio97d.js","names":[],"sources":["../src/number/auto-repeat.ts","../src/number/number-format.ts","../src/number/number-parse.ts","../src/number/number-step.ts","../src/number/scrub.ts"],"sourcesContent":["export interface AutoRepeatOptions {\n /**\n * One step: at the press, then again every `interval` once the press lasted `delay`; a click\n * that no pointer press started (the keyboard, assistive technology) steps once. Return\n * `false` to stop the repeat (a bound reached).\n */\n onStep: (event: Event) => boolean | undefined;\n /** How long a press lasts before the repeat starts, in ms (default 400, Base UI). */\n delay?: number;\n /** The time between two repeated steps, in ms (default 60, Base UI). */\n interval?: number;\n}\n\n/**\n * Press and hold on `element` (spec/number-field.md, \"Pointer\": an Increment or Decrement button):\n * a primary pointer's press steps at once, and keeps stepping while it is held, until it is\n * released, canceled or leaves the element, or the window loses focus. A mouse press keeps the\n * focus where it is (its `mousedown` default is prevented), so the field's input stays focused. The `click`\n * that ends a pointer press steps no more; any other click steps once. Returns the cleanup.\n */\nexport function watchAutoRepeat(\n element: Element,\n options: AutoRepeatOptions,\n): () => void {\n const { delay = 400, interval = 60 } = options;\n const doc = element.ownerDocument;\n const view = doc.defaultView;\n let timer: number | undefined;\n let pressed = false;\n // the click that follows a pointer press, already stepped at its pointerdown\n let swallowClick = false;\n\n const stop = () => {\n if (timer !== undefined) {\n view?.clearTimeout(timer);\n view?.clearInterval(timer);\n timer = undefined;\n }\n if (!pressed) {\n return;\n }\n pressed = false;\n // the click a release sends comes before this task ends; a press that sends none\n // (released outside, a long touch, a button disabled at its bound) swallows no later\n // click\n view?.setTimeout(() => {\n swallowClick = false;\n });\n doc.removeEventListener(\"pointerup\", stop, true);\n doc.removeEventListener(\"pointercancel\", stop, true);\n element.removeEventListener(\"pointerleave\", stop);\n view?.removeEventListener(\"blur\", stop);\n };\n const onDown = (event: PointerEvent) => {\n if (event.button !== 0 || !event.isPrimary) {\n return;\n }\n stop();\n swallowClick = true;\n if (options.onStep(event) === false) {\n view?.setTimeout(() => {\n swallowClick = false;\n }, 1000);\n return;\n }\n pressed = true;\n doc.addEventListener(\"pointerup\", stop, true);\n doc.addEventListener(\"pointercancel\", stop, true);\n element.addEventListener(\"pointerleave\", stop);\n view?.addEventListener(\"blur\", stop);\n timer = view?.setTimeout(() => {\n timer = view?.setInterval(() => {\n if (options.onStep(event) === false) {\n stop();\n }\n }, interval);\n }, delay);\n };\n const onClick = (event: Event) => {\n if (swallowClick) {\n swallowClick = false;\n return;\n }\n options.onStep(event);\n };\n // a mouse press moves no focus: the field's input keeps it (APG: focus stays on the text\n // field)\n const onMouseDown = (event: MouseEvent) => {\n if (event.button === 0) {\n event.preventDefault();\n }\n };\n // a held touch opens no context menu\n const onContextMenu = (event: Event) => {\n if (pressed) {\n event.preventDefault();\n }\n };\n element.addEventListener(\"pointerdown\", onDown as EventListener);\n element.addEventListener(\"mousedown\", onMouseDown as EventListener);\n element.addEventListener(\"click\", onClick);\n element.addEventListener(\"contextmenu\", onContextMenu);\n return () => {\n stop();\n element.removeEventListener(\"pointerdown\", onDown as EventListener);\n element.removeEventListener(\"mousedown\", onMouseDown as EventListener);\n element.removeEventListener(\"click\", onClick);\n element.removeEventListener(\"contextmenu\", onContextMenu);\n };\n}\n","/** How a number field writes and reads its value (spec/number-field.md, \"API\"). */\nexport interface NumberFormatOptions {\n /** The locale (BCP 47; default: the runtime's). */\n locale?: string | undefined;\n /** `Intl.NumberFormat` options; without them, the plain number with every decimal it has. */\n format?: Intl.NumberFormatOptions | undefined;\n}\n\n/** The `Intl.NumberFormat` options a field formats with: `format`, else every decimal kept. */\nexport function numberFormatOptions(\n format: Intl.NumberFormatOptions | undefined,\n): Intl.NumberFormatOptions {\n return format ?? { maximumFractionDigits: 20 };\n}\n\n/**\n * `value` as the field writes it (spec/number-field.md): `Intl.NumberFormat` of the locale and\n * the format; `\"\"` for `null` (an empty field).\n */\nexport function formatNumber(\n value: number | null,\n options: NumberFormatOptions = {},\n): string {\n if (value === null || Number.isNaN(value)) {\n return \"\";\n }\n return new Intl.NumberFormat(\n options.locale,\n numberFormatOptions(options.format),\n ).format(value);\n}\n","import {\n type NumberFormatOptions,\n numberFormatOptions,\n} from \"./number-format.ts\";\n\n/** The text a locale and a format write numbers with (spec/number-field.md, \"Typing\"). */\ninterface NumberSymbols {\n /** Each localized digit, mapped to its ASCII digit. */\n digits: Map<string, string>;\n group: string;\n decimal: string;\n /** The characters of the format's other text: currency, unit, percent sign, literals. */\n text: Set<string>;\n percent: boolean;\n accounting: boolean;\n}\n\n// the minus signs and plus signs a user may type, whatever the locale writes\nconst MINUS = \"-−‐‑‒–﹣-\";\nconst PLUS = \"++\";\n// the percent signs a percent field accepts beside the locale's\nconst PERCENT = \"%٪﹪%\";\n// bidirectional marks, which some locales write around a sign (ar-EG: U+061C)\nconst BIDI = /[--]/g;\n// the Arabic-Indic and Extended Arabic-Indic digits, read in every locale (as the ASCII ones)\nconst ARABIC = \"٠١٢٣٤٥٦٧٨٩\";\nconst PERSIAN = \"۰۱۲۳۴۵۶۷۸۹\";\n\nfunction symbolsOf(options: NumberFormatOptions): NumberSymbols {\n const format = numberFormatOptions(options.format);\n const formatter = new Intl.NumberFormat(options.locale, {\n ...format,\n useGrouping: true,\n });\n const { numberingSystem } = formatter.resolvedOptions();\n const digitFormatter = new Intl.NumberFormat(options.locale, {\n numberingSystem,\n useGrouping: false,\n });\n const digits = new Map<string, string>();\n for (let digit = 0; digit <= 9; digit += 1) {\n digits.set(String(digit), String(digit));\n digits.set(digitFormatter.format(digit), String(digit));\n digits.set(ARABIC[digit] as string, String(digit));\n digits.set(PERSIAN[digit] as string, String(digit));\n }\n let group = \"\";\n let decimal = \".\";\n const text = new Set<string>();\n for (const part of formatter.formatToParts(-12345.6)) {\n if (part.type === \"group\") {\n group = part.value;\n } else if (part.type === \"decimal\") {\n decimal = part.value;\n } else if (\n part.type === \"currency\" ||\n part.type === \"unit\" ||\n part.type === \"percentSign\" ||\n part.type === \"literal\"\n ) {\n for (const character of part.value) {\n text.add(character);\n }\n }\n }\n const percent = format.style === \"percent\";\n if (percent) {\n for (const character of PERCENT) {\n text.add(character);\n }\n }\n return {\n digits,\n group,\n decimal,\n text,\n percent,\n accounting: format.currencySign === \"accounting\",\n };\n}\n\n/**\n * The text reduced to ASCII digits, `.` and `-` (and whatever else was typed), or `null` when a\n * character is none a number of this locale and format can hold.\n */\nfunction normalize(text: string, symbols: NumberSymbols): string | null {\n let negative = false;\n let result = \"\";\n const source = text.replace(BIDI, \"\").replace(/\\s/g, \"\");\n const groupIsSpace = /^\\s*$/.test(symbols.group.replace(BIDI, \"\"));\n for (const character of source) {\n const digit = symbols.digits.get(character);\n if (digit !== undefined) {\n result += digit;\n } else if (character === symbols.decimal) {\n result += \".\";\n } else if (!groupIsSpace && character === symbols.group) {\n // a grouping separator carries no value\n } else if (character === \".\" || character === \",\") {\n // the other separator, where the locale's group is not it: a decimal point (`1.5` in\n // ar-EG, whose own is U+066B)\n result += \".\";\n } else if (MINUS.includes(character)) {\n negative = !negative;\n } else if (PLUS.includes(character)) {\n // a plus sign changes nothing\n } else if (\n symbols.accounting &&\n (character === \"(\" || character === \")\")\n ) {\n if (character === \"(\") {\n negative = !negative;\n }\n } else if (symbols.text.has(character)) {\n // the currency, the unit, the percent sign: text of the format, not of the value\n } else {\n return null;\n }\n }\n return `${negative ? \"-\" : \"\"}${result}`;\n}\n\n/**\n * Whether `text` holds only what a number of this locale and format is written with (the\n * localized digits, the group and decimal separators, the signs, the format's own text), so a\n * field accepts it while it is typed (spec/number-field.md, \"Typing\"): `\"1.2\"`, `\"-\"` and `\"\"`\n * pass, `\"12a\"` does not.\n */\nexport function isNumberText(\n text: string,\n options: NumberFormatOptions = {},\n): boolean {\n return normalize(text, symbolsOf(options)) !== null;\n}\n\n/**\n * The number `text` writes in this locale and format (spec/number-field.md, \"Typing\"): the\n * localized digits (Arabic-Indic, ...), the group and decimal separators, any minus sign, the\n * currency, unit and percent text; a percent format reads `25%` as `0.25`. `null` for a text with\n * no digit (empty, or a sign alone), `NaN` for one that is no number (`1.2.3`, `12a`).\n */\nexport function parseNumber(\n text: string,\n options: NumberFormatOptions = {},\n): number | null {\n const symbols = symbolsOf(options);\n const normalized = normalize(text, symbols);\n if (normalized === null) {\n return Number.NaN;\n }\n if (!/\\d/.test(normalized)) {\n return normalized.replace(\"-\", \"\") === \"\" ? null : Number.NaN;\n }\n if (!/^-?(\\d+\\.?\\d*|\\.\\d+)$/.test(normalized)) {\n return Number.NaN;\n }\n const value = Number(normalized);\n if (!symbols.percent) {\n return value === 0 ? 0 : value;\n }\n // 25% is 0.25: divided by 100 with the decimals it had, so no floating-point noise is added\n const decimals = (normalized.split(\".\")[1] ?? \"\").length;\n const fraction = Number((value / 100).toFixed(decimals + 2));\n return fraction === 0 ? 0 : fraction;\n}\n","/** The bounds and grid a number field steps within (spec/number-field.md, \"API\"). */\nexport interface NumberStepOptions {\n /** The lowest value; none when not given. */\n min?: number | undefined;\n /** The highest value; none when not given. */\n max?: number | undefined;\n /** Step to the grid of `|amount|` (counted from `min`, else from 0) instead of by `amount`. */\n snapOnStep?: boolean | undefined;\n}\n\nfunction decimalsOf(value: number): number {\n if (!Number.isFinite(value)) {\n return 0;\n }\n const text = String(value);\n const exponent = /e-(\\d+)$/.exec(text);\n if (exponent !== null) {\n return (\n Number(exponent[1]) +\n (text.split(\".\")[1]?.split(\"e\")[0] ?? \"\").length\n );\n }\n return (text.split(\".\")[1] ?? \"\").length;\n}\n\n/** `value` rounded to `decimals`, without floating-point noise (0.1 + 0.2). */\nfunction roundTo(value: number, decimals: number): number {\n const rounded = Number(value.toFixed(Math.min(decimals, 20)));\n return rounded === 0 ? 0 : rounded;\n}\n\n/** `value` within `[min, max]` (either bound may be missing). */\nexport function clampNumber(\n value: number,\n min: number | undefined,\n max: number | undefined,\n): number {\n let result = value;\n if (max !== undefined && result > max) {\n result = max;\n }\n if (min !== undefined && result < min) {\n result = min;\n }\n return result;\n}\n\n/**\n * The value one step of `amount` away (negative: down), clamped to `[min, max]`\n * (spec/number-field.md, \"Stepping\"). An empty field (`null`) starts at 0, clamped, with no step\n * (Base UI). With `snapOnStep`, a value off the grid of `|amount|` goes to the next grid point in\n * the step's direction (`1.5` up by 1 gives `2`, down gives `1`).\n */\nexport function stepNumber(\n value: number | null,\n amount: number,\n options: NumberStepOptions = {},\n): number {\n const { min, max, snapOnStep = false } = options;\n if (value === null || Number.isNaN(value)) {\n return clampNumber(0, min, max);\n }\n const decimals = Math.max(\n decimalsOf(value),\n decimalsOf(amount),\n decimalsOf(min ?? 0),\n );\n if (!snapOnStep || amount === 0) {\n return clampNumber(roundTo(value + amount, decimals), min, max);\n }\n const grid = Math.abs(amount);\n const base = min ?? 0;\n // the grid index, without the noise of a division (2.9999999 is 3)\n const index = roundTo((value - base) / grid, 10);\n const target = amount > 0 ? Math.floor(index) + 1 : Math.ceil(index) - 1;\n const gridDecimals = Math.max(decimalsOf(grid), decimalsOf(base));\n return clampNumber(roundTo(base + target * grid, gridDecimals), min, max);\n}\n","/** A point in the viewport, in CSS pixels. */\nexport interface ScrubPoint {\n x: number;\n y: number;\n}\n\nexport interface ScrubOptions {\n /** The axis the pointer scrubs along (default `\"horizontal\"`). */\n direction?: \"horizontal\" | \"vertical\";\n /** The distance one step takes, in px (default 2, Base UI). */\n pixelSensitivity?: number;\n /** A press starts a scrub unless this returns `false` (a disabled or read-only field). */\n onStart: (event: PointerEvent) => boolean | undefined;\n /**\n * The pointer moved by `steps` sensitivities along the axis: right or up is positive. Called\n * once per move that crosses at least one.\n */\n onScrub: (steps: number, event: PointerEvent) => void;\n /** The scrub ended: the pointer was released or canceled. */\n onEnd: (event: PointerEvent) => void;\n /**\n * Where the virtual cursor is while the pointer is locked (the real one is hidden), wrapped\n * around the viewport's edges; `null` once it is unlocked or the scrub ended.\n */\n onCursor?: (point: ScrubPoint | null) => void;\n}\n\n/**\n * Scrubbing on `element` (spec/number-field.md, \"Scrub\"): a primary pointer's press starts it,\n * and every `pixelSensitivity` pixels of movement along `direction` is a step, until the pointer\n * is released. A mouse asks for the pointer lock (the movement then never meets the screen's\n * edges, and `onCursor` follows a virtual cursor); a denied lock only leaves the real cursor.\n * The press's default is prevented, so no text is selected. Returns the cleanup.\n */\nexport function watchScrub(\n element: Element,\n options: ScrubOptions,\n): () => void {\n const { direction = \"horizontal\", pixelSensitivity = 2 } = options;\n const doc = element.ownerDocument;\n const view = doc.defaultView;\n let active: { pointerId: number } | null = null;\n let last: ScrubPoint = { x: 0, y: 0 };\n let cursor: ScrubPoint = { x: 0, y: 0 };\n let pending = 0;\n\n const locked = () => doc.pointerLockElement === element;\n const end = (event: PointerEvent) => {\n if (active === null || event.pointerId !== active.pointerId) {\n return;\n }\n active = null;\n doc.removeEventListener(\"pointermove\", onMove, true);\n doc.removeEventListener(\"pointerup\", end, true);\n doc.removeEventListener(\"pointercancel\", end, true);\n if (locked()) {\n doc.exitPointerLock();\n }\n options.onCursor?.(null);\n options.onEnd(event);\n };\n const onMove = (event: PointerEvent) => {\n if (active === null || event.pointerId !== active.pointerId) {\n return;\n }\n // locked, the pointer stays where it was: its movement is the event's own\n const isLocked = locked();\n const dx = isLocked ? event.movementX : event.clientX - last.x;\n const dy = isLocked ? event.movementY : event.clientY - last.y;\n last = { x: event.clientX, y: event.clientY };\n if (isLocked && view !== null) {\n const width = view.innerWidth;\n const height = view.innerHeight;\n cursor = {\n x: (((cursor.x + dx) % width) + width) % width,\n y: (((cursor.y + dy) % height) + height) % height,\n };\n options.onCursor?.(cursor);\n }\n pending += direction === \"vertical\" ? -dy : dx;\n const steps = Math.trunc(pending / pixelSensitivity);\n if (steps !== 0) {\n pending -= steps * pixelSensitivity;\n options.onScrub(steps, event);\n }\n };\n const onDown = (event: PointerEvent) => {\n if (event.button !== 0 || !event.isPrimary || active !== null) {\n return;\n }\n if (options.onStart(event) === false) {\n return;\n }\n event.preventDefault();\n active = { pointerId: event.pointerId };\n last = { x: event.clientX, y: event.clientY };\n cursor = { ...last };\n pending = 0;\n doc.addEventListener(\"pointermove\", onMove, true);\n doc.addEventListener(\"pointerup\", end, true);\n doc.addEventListener(\"pointercancel\", end, true);\n if (event.pointerType === \"mouse\") {\n try {\n const request = (\n element as Element & {\n requestPointerLock?: () => Promise<void> | undefined;\n }\n ).requestPointerLock?.();\n request?.then(\n () => {\n if (!locked()) {\n return;\n }\n if (active === null) {\n // granted after a quick click ended the scrub: never kept\n doc.exitPointerLock();\n } else {\n options.onCursor?.(cursor);\n }\n },\n () => {},\n );\n } catch {\n // a denied lock leaves the real cursor\n }\n }\n };\n // a lock granted with no promise (Firefox) after the scrub ended is released too\n const onLockChange = () => {\n if (active === null && locked()) {\n doc.exitPointerLock();\n }\n };\n element.addEventListener(\"pointerdown\", onDown as EventListener);\n doc.addEventListener(\"pointerlockchange\", onLockChange);\n return () => {\n element.removeEventListener(\"pointerdown\", onDown as EventListener);\n doc.removeEventListener(\"pointerlockchange\", onLockChange);\n doc.removeEventListener(\"pointermove\", onMove, true);\n doc.removeEventListener(\"pointerup\", end, true);\n doc.removeEventListener(\"pointercancel\", end, true);\n if (active !== null && locked()) {\n doc.exitPointerLock();\n }\n active = null;\n };\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgB,gBACZ,SACA,SACU;CACV,MAAM,EAAE,QAAQ,KAAK,WAAW,OAAO;CACvC,MAAM,MAAM,QAAQ;CACpB,MAAM,OAAO,IAAI;CACjB,IAAI;CACJ,IAAI,UAAU;CAEd,IAAI,eAAe;CAEnB,MAAM,aAAa;EACf,IAAI,UAAU,KAAA,GAAW;GACrB,MAAM,aAAa,KAAK;GACxB,MAAM,cAAc,KAAK;GACzB,QAAQ,KAAA;EACZ;EACA,IAAI,CAAC,SACD;EAEJ,UAAU;EAIV,MAAM,iBAAiB;GACnB,eAAe;EACnB,CAAC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