@nxgt/material 3.101.0 → 3.103.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 +38 -0
- package/README.md +32 -2
- package/dist/{alert-dialog-DYzxchiS.js → alert-dialog-NFyAiSqc.js} +1 -1
- package/dist/{async-slice-drJyPvuM.js → async-slice-D35bX79S.js} +1 -1
- package/dist/{bubble-input-CQwVSoU3.js → bubble-input-BxI1WmNs.js} +17 -5
- package/dist/{button-GeIsUekU.js → button-Be7GZzF9.js} +2 -2
- package/dist/{calculator-BS4PAm6l.js → calculator-BGy1Q7rn.js} +261 -460
- package/dist/calculator-field.js +7 -7
- package/dist/{calculator-segment-CEdwE24M.js → calculator-segment-uixk6lBg.js} +1 -1
- package/dist/calculator.js +1 -1
- package/dist/charts.js +3 -3
- package/dist/{chip-BdEtFQ85.js → chip-3rWebZEM.js} +2 -2
- package/dist/{code-editor-BByXZOGy.js → code-editor-BqSVMfy-.js} +178 -177
- package/dist/code-editor.js +5 -5
- package/dist/{code-language-items-CSZX5zxD.js → code-language-items-Cf2LJVg2.js} +14 -5
- package/dist/components/ui/actions/action-card/action-card-tile.css +47 -0
- package/dist/components/ui/display/code/code-moonlight.css +10 -10
- package/dist/{components-DQ4MljCr.js → components-D2liJ9Yu.js} +17725 -17287
- package/dist/components.js +38 -37
- package/dist/{conversion-variant-DTQqAyDt.js → conversion-variant-clFZ6ZMJ.js} +5 -5
- package/dist/{currency-field-Dnju7ss2.js → currency-field-CBFEVNM1.js} +24 -23
- package/dist/{dialog-5_2__tu8.js → dialog-CrIIINTk.js} +3 -3
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-FdGC5kIP.js → dropdown-menu-BnfLWu8n.js} +1 -1
- package/dist/editor.js +9 -9
- package/dist/{empty-state-BoepPG5v.js → empty-state-CuUaCPY7.js} +1 -1
- package/dist/{field-blur-DkiZOVNV.js → field-blur-DMJwPLsg.js} +9 -9
- package/dist/field-blur-context-3rKussBQ.js +29 -0
- package/dist/{financial-variant-BhqJp5C-.js → financial-variant-BY_VCUuk.js} +5 -5
- package/dist/{hooks-DjcbJZiO.js → hooks-hHoZbL-4.js} +106 -61
- package/dist/hooks.js +3 -3
- package/dist/{hover-card-CmHJeBeY.js → hover-card-Do2-uzlF.js} +1 -1
- package/dist/i18n.js +3 -3
- package/dist/{icon-badge-LGUPQh_c.js → icon-badge-CHaVNEmb.js} +1 -1
- package/dist/{icon-button-BSVpO1jP.js → icon-button-BIAubLeJ.js} +1 -1
- package/dist/key-layout-D2goCDkD.js +31 -0
- package/dist/keypad.js +551 -0
- package/dist/label-DR-zZyGQ.js +47 -0
- package/dist/lib/components/ui/display/code/code-block-parts.d.ts +1 -1
- package/dist/lib/components/ui/display/code/code-block.d.ts +4 -1
- package/dist/lib/components/ui/display/code/languages.d.ts +2 -0
- package/dist/lib/components/ui/display/code/moonlight-tokens.d.ts +10 -10
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog-props.d.ts +73 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog-rules.d.ts +12 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog.d.ts +5 -61
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-footer.d.ts +12 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-phrase.d.ts +26 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/use-confirm-action.d.ts +1 -1
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
- package/dist/lib/components/ui/layout/index.d.ts +1 -0
- package/dist/lib/components/ui/layout/panel-card/index.d.ts +1 -0
- package/dist/lib/components/ui/layout/panel-card/panel-card.d.ts +21 -0
- package/dist/lib/components/ui/selection/index.d.ts +1 -0
- package/dist/lib/components/ui/selection/status-menu/index.d.ts +3 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-confirm.d.ts +12 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-icon.d.ts +6 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-items.d.ts +18 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-menu-list.d.ts +14 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-sheet-row.d.ts +11 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-sheet.d.ts +21 -0
- package/dist/lib/components/ui/selection/status-menu/partials/status-trigger.d.ts +18 -0
- package/dist/lib/components/ui/selection/status-menu/status-menu-data.d.ts +12 -0
- package/dist/lib/components/ui/selection/status-menu/status-menu-form-field.d.ts +20 -0
- package/dist/lib/components/ui/selection/status-menu/status-menu.d.ts +13 -0
- package/dist/lib/components/ui/selection/status-menu/types.d.ts +76 -0
- package/dist/lib/components/ui/selection/status-menu/use-status-change.d.ts +18 -0
- package/dist/lib/components/ui/selection/status-menu/use-status-menu.d.ts +30 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-keypad.d.ts +1 -5
- package/dist/lib/components/ui/widgets/calculator/variants/key-layout.d.ts +3 -49
- package/dist/lib/components/ui/widgets/keypad/cash-model.d.ts +16 -0
- package/dist/lib/components/ui/widgets/keypad/index.d.ts +5 -0
- package/dist/lib/components/ui/widgets/keypad/key-layout.d.ts +56 -0
- package/dist/lib/components/ui/widgets/keypad/keypad-binding.d.ts +32 -0
- package/dist/lib/components/ui/widgets/keypad/keypad-cash.d.ts +28 -0
- package/dist/lib/components/ui/widgets/keypad/keypad-display.d.ts +11 -0
- package/dist/lib/components/ui/widgets/keypad/keypad-entry.d.ts +39 -0
- package/dist/lib/components/ui/widgets/keypad/keypad-grid.d.ts +27 -0
- package/dist/lib/components/ui/widgets/{calculator/partials/calculator-key.d.ts → keypad/keypad-key.d.ts} +6 -3
- package/dist/lib/components/ui/widgets/keypad/keypad-layout.d.ts +19 -0
- package/dist/lib/components/ui/widgets/{calculator/partials → keypad}/keypad-navigation.d.ts +1 -1
- package/dist/lib/components/ui/widgets/keypad/keypad.d.ts +9 -0
- package/dist/lib/components/ui/widgets/keypad/keypad.types.d.ts +91 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad-cash.d.ts +14 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad-keyboard.d.ts +7 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad-number.d.ts +10 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad-quantity.d.ts +16 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad-value.d.ts +17 -0
- package/dist/lib/components/ui/widgets/keypad/use-keypad.d.ts +23 -0
- package/dist/lib/hooks/index.d.ts +1 -0
- package/dist/lib/hooks/use-barcode-scanner.d.ts +39 -0
- package/dist/lib/i18n/resources/en/en.d.ts +25 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +26 -1
- package/dist/lib/i18n/resources/fr/fr.d.ts +25 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +26 -1
- package/dist/lib/i18n/resources/resources.d.ts +50 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/keypad/index.d.ts +20 -0
- package/dist/lib.js +1 -1
- package/dist/main.js +54 -53
- package/dist/map.js +9 -9
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/{percent-field-DGlU_xii.js → percent-field-DU8eIMD3.js} +15 -14
- package/dist/{picker-surface-CGhqNR8a.js → picker-surface-XmA--JVI.js} +4 -4
- package/dist/{popover-ZxL7ktKk.js → popover-D8iHiAbl.js} +1 -1
- package/dist/{pos-types-BQ0QpYMp.js → pos-types-BEAY27Rm.js} +1 -1
- package/dist/{pos-variant-CKy8h_5i.js → pos-variant-ClGI92Lt.js} +25 -25
- package/dist/print.js +1 -1
- package/dist/{programmer-variant-CbHstE28.js → programmer-variant-Boq2O8hB.js} +30 -30
- package/dist/{public-D-tdOz4b.js → public-DOrXKmcL.js} +9 -9
- package/dist/{rich-code-block-CTPj1LuD.js → rich-code-block-Djj2XE_u.js} +18 -18
- package/dist/{scientific-variant-B8U9h3II.js → scientific-variant-BzF_aMQP.js} +8 -8
- package/dist/{sortable-provider-CSoWE7Ce.js → sortable-provider-DCZjsIIH.js} +2 -2
- package/dist/{spinner-ffuwBXHl.js → spinner-Cg0y_E_K.js} +1 -1
- package/dist/standard-layout-DTr9yy8Z.js +48 -0
- package/dist/{tabs-JgRq6ZJx.js → tabs-DpessV5s.js} +1 -1
- package/dist/{text-field-DURkIP-v.js → text-field-Dxk9lAKM.js} +16 -15
- package/dist/theme-picker.js +13 -13
- package/dist/{theme-toggle-n_Zg7JAA.js → theme-toggle-B6Jl5Kfn.js} +1 -1
- package/dist/{toolbar-items-IANZdcw4.js → toolbar-items-Cs1XrZsH.js} +4 -4
- package/dist/{translate-material-CMHUH5Ha.js → translate-material-Du0j0t97.js} +1 -1
- package/dist/{translator-9zA-Um3W.js → translator-BVs4n0Fz.js} +52 -2
- package/dist/use-calculator-keyboard-BZ1CA4Ut.js +222 -0
- package/dist/{use-chat-composer-BoIN7RCA.js → use-chat-composer-B4m3OEm1.js} +241 -240
- package/dist/{use-heading-spy-Ciw9GBHL.js → use-heading-spy-CO3_AtY9.js} +235 -154
- package/dist/{use-material-translation-CLNaMhUf.js → use-material-translation-uNc1FyC8.js} +1 -1
- package/dist/{use-return-focus-DWhbTGVe.js → use-return-focus-AfLRrUm-.js} +1 -1
- package/docs/README.md +1 -0
- package/docs/components/README.md +1 -0
- package/docs/components/buttons-and-actions.md +34 -2
- package/docs/components/data-display.md +4 -1
- package/docs/components/feedback-and-status.md +20 -0
- package/docs/components/navigation-and-layout.md +28 -0
- package/docs/components/rich-widgets.md +28 -0
- package/docs/components/selection-and-choice.md +120 -0
- package/docs/guides/calculator.md +1 -1
- package/docs/guides/cards-and-tiles.md +21 -24
- package/docs/guides/forms.md +1 -0
- package/docs/guides/helpers.md +49 -0
- package/docs/guides/keypad.md +225 -0
- package/docs/previews/data-display-codeblock.webp +0 -0
- package/docs/previews/data-display-codegroup.webp +0 -0
- package/docs/previews/data-display-jsonviewer.webp +0 -0
- package/docs/previews/navigation-layout-panelcard.webp +0 -0
- package/docs/previews/rich-widgets-keypad.webp +0 -0
- package/docs/previews/selection-choice-statusmenu.webp +0 -0
- package/docs/roadmap.md +21 -0
- package/docs/troubleshooting.md +63 -0
- package/lib/components/ui/actions/action-card/action-card-tile.css +47 -0
- package/lib/components/ui/display/code/code-moonlight.css +10 -10
- package/lib/components/ui/widgets/calculator/calculator.css +87 -0
- package/package.json +7 -2
- package/dist/field-blur-context-BLGgf_3z.js +0 -73
- package/dist/key-layout-cR79xfGE.js +0 -38
- package/dist/standard-layout-BuSRr3TY.js +0 -40
|
@@ -1,47 +1,46 @@
|
|
|
1
1
|
import { t as e } from "./utils-BLfntITJ.js";
|
|
2
|
-
import { d as t, n, r, t as i } from "./tabs-
|
|
3
|
-
import { t as a } from "./button-
|
|
4
|
-
import { t as o } from "./use-material-translation-
|
|
5
|
-
import { t as s } from "./icon-button-
|
|
2
|
+
import { d as t, n, r, t as i } from "./tabs-DpessV5s.js";
|
|
3
|
+
import { t as a } from "./button-Be7GZzF9.js";
|
|
4
|
+
import { t as o } from "./use-material-translation-uNc1FyC8.js";
|
|
5
|
+
import { t as s } from "./icon-button-BIAubLeJ.js";
|
|
6
6
|
import { t as c } from "./copy-to-clipboard-Be5Ffvs_.js";
|
|
7
|
-
import {
|
|
8
|
-
import { t as u } from "./
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { i as
|
|
15
|
-
import {
|
|
16
|
-
import { n as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { EMPTY_SESSION as A, calculate as ve, formatDecimal as j, formatExpression as M, historyEntry as N, keyFromEvent as P, localeSeparators as F, normaliseExpression as ye, parseDecimal as I, parseStoredHistory as be, press as L, pushHistory as xe, serializeHistory as Se, sessionOptions as Ce, toCanonical as R } from "@nxgt/material-core/calculator";
|
|
7
|
+
import { n as l } from "./use-slice-reducer-BGkeGtML.js";
|
|
8
|
+
import { t as u } from "./skeleton-DSdtr2qc.js";
|
|
9
|
+
import { t as d } from "./live-status-BGPaN8r8.js";
|
|
10
|
+
import { n as f, t as p } from "./calculator-context-BugcKuVG.js";
|
|
11
|
+
import { a as m, c as h, i as g, l as _, n as v, o as y, r as b, s as ee } from "./calculator-announce-DRd2c6Dq.js";
|
|
12
|
+
import { i as x, t as te } from "./pos-types-BEAY27Rm.js";
|
|
13
|
+
import { n as ne, t as re } from "./use-calculator-keyboard-BZ1CA4Ut.js";
|
|
14
|
+
import { i as ie, n as ae } from "./key-layout-D2goCDkD.js";
|
|
15
|
+
import { t as oe } from "./standard-layout-DTr9yy8Z.js";
|
|
16
|
+
import { n as S, r as se, t as C } from "./programmer-word-CNCF7DJF.js";
|
|
17
|
+
import { useCallback as w, useEffect as T, useId as E, useMemo as D, useRef as O, useSyncExternalStore as ce } from "react";
|
|
18
|
+
import { Fragment as le, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
19
|
+
import { ClipboardPaste as ue, Copy as de, History as fe, Trash2 as pe } from "lucide-react";
|
|
20
|
+
import { createSlice as me } from "@reduxjs/toolkit";
|
|
21
|
+
import { currencyFractionDigits as he } from "@nxgt/material-core/currency-digits";
|
|
22
|
+
import { EMPTY_SESSION as j, calculate as ge, formatDecimal as M, formatExpression as N, historyEntry as P, localeSeparators as F, normaliseExpression as I, parseDecimal as L, parseStoredHistory as _e, press as R, pushHistory as ve, serializeHistory as ye, sessionOptions as be, toCanonical as z } from "@nxgt/material-core/calculator";
|
|
24
23
|
//#region lib/components/ui/widgets/calculator/partials/calculator-announcer.tsx
|
|
25
|
-
function
|
|
26
|
-
let { t: e } = o(), { state: t } =
|
|
27
|
-
return /* @__PURE__ */
|
|
24
|
+
function xe() {
|
|
25
|
+
let { t: e } = o(), { state: t } = f(), n = t.announcement;
|
|
26
|
+
return /* @__PURE__ */ k(d, {
|
|
28
27
|
slot: "calculator-status",
|
|
29
28
|
children: n ? e(n.key, n.fallback, n.values) : null
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
//#endregion
|
|
33
32
|
//#region lib/components/ui/widgets/calculator/partials/calculator-memory.tsx
|
|
34
|
-
function
|
|
35
|
-
let { t: e } = o(), { hasMemory: t, state: n, locale: r } =
|
|
33
|
+
function Se() {
|
|
34
|
+
let { t: e } = o(), { hasMemory: t, state: n, locale: r } = f();
|
|
36
35
|
if (!t) return null;
|
|
37
|
-
let i =
|
|
38
|
-
return /* @__PURE__ */
|
|
36
|
+
let i = g(n.session.memory, r);
|
|
37
|
+
return /* @__PURE__ */ A("span", {
|
|
39
38
|
"data-slot": "calculator-memory",
|
|
40
39
|
className: "nxgt-calc-memory bg-primary-container text-foreground",
|
|
41
|
-
children: [/* @__PURE__ */
|
|
40
|
+
children: [/* @__PURE__ */ k("span", {
|
|
42
41
|
"aria-hidden": "true",
|
|
43
42
|
children: "M"
|
|
44
|
-
}), /* @__PURE__ */
|
|
43
|
+
}), /* @__PURE__ */ k("span", {
|
|
45
44
|
className: "sr-only",
|
|
46
45
|
children: e("material.calculator.display.memory", "Memory {value}", { value: i })
|
|
47
46
|
})]
|
|
@@ -49,31 +48,31 @@ function Te() {
|
|
|
49
48
|
}
|
|
50
49
|
//#endregion
|
|
51
50
|
//#region lib/components/ui/widgets/calculator/partials/calculator-tools.tsx
|
|
52
|
-
function
|
|
53
|
-
let { t } = o(), { display: n, copy: r, paste: i, toggleTape: a, state: c, toggleRef: l } =
|
|
54
|
-
return /* @__PURE__ */
|
|
51
|
+
function Ce({ tapeId: e }) {
|
|
52
|
+
let { t } = o(), { display: n, copy: r, paste: i, toggleTape: a, state: c, toggleRef: l } = f();
|
|
53
|
+
return /* @__PURE__ */ A("div", {
|
|
55
54
|
className: "nxgt-calc-tools",
|
|
56
55
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ k(Se, {}),
|
|
57
|
+
/* @__PURE__ */ k("span", { className: "nxgt-calc-grow" }),
|
|
58
|
+
/* @__PURE__ */ k(s, {
|
|
60
59
|
size: "sm",
|
|
61
60
|
variant: "ghost",
|
|
62
61
|
className: "nxgt-calc-tool",
|
|
63
62
|
"aria-label": t("material.calculator.copy", "Copy result"),
|
|
64
63
|
disabled: n.value === "",
|
|
65
64
|
onClick: r,
|
|
66
|
-
children: /* @__PURE__ */
|
|
65
|
+
children: /* @__PURE__ */ k(de, {})
|
|
67
66
|
}),
|
|
68
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ k(s, {
|
|
69
68
|
size: "sm",
|
|
70
69
|
variant: "ghost",
|
|
71
70
|
className: "nxgt-calc-tool",
|
|
72
71
|
"aria-label": t("material.calculator.paste", "Paste an expression"),
|
|
73
72
|
onClick: i,
|
|
74
|
-
children: /* @__PURE__ */
|
|
73
|
+
children: /* @__PURE__ */ k(ue, {})
|
|
75
74
|
}),
|
|
76
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ k(s, {
|
|
77
76
|
ref: l,
|
|
78
77
|
size: "sm",
|
|
79
78
|
variant: "ghost",
|
|
@@ -82,219 +81,59 @@ function Ee({ tapeId: e }) {
|
|
|
82
81
|
"aria-expanded": c.tapeOpen,
|
|
83
82
|
"aria-controls": e,
|
|
84
83
|
onClick: a,
|
|
85
|
-
children: /* @__PURE__ */
|
|
84
|
+
children: /* @__PURE__ */ k(fe, {})
|
|
86
85
|
})
|
|
87
86
|
]
|
|
88
87
|
});
|
|
89
88
|
}
|
|
90
89
|
//#endregion
|
|
91
90
|
//#region lib/components/ui/widgets/calculator/partials/calculator-display.tsx
|
|
92
|
-
function
|
|
93
|
-
return /* @__PURE__ */
|
|
91
|
+
function we({ tapeId: e }) {
|
|
92
|
+
return /* @__PURE__ */ A("div", {
|
|
94
93
|
"data-slot": "calculator-display",
|
|
95
94
|
className: "nxgt-calc-display bg-muted",
|
|
96
|
-
children: [/* @__PURE__ */
|
|
95
|
+
children: [/* @__PURE__ */ k(Ce, { tapeId: e }), /* @__PURE__ */ k(x, {})]
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
98
|
//#endregion
|
|
100
|
-
//#region lib/components/ui/widgets/calculator/partials/calculator-key.tsx
|
|
101
|
-
var Oe = {
|
|
102
|
-
digit: "bg-muted text-foreground",
|
|
103
|
-
operator: "bg-secondary-container text-foreground",
|
|
104
|
-
equals: "bg-primary text-primary-foreground",
|
|
105
|
-
utility: "bg-tertiary-container text-foreground",
|
|
106
|
-
function: "bg-muted text-foreground",
|
|
107
|
-
memory: "bg-muted text-foreground",
|
|
108
|
-
bracket: "bg-muted text-foreground"
|
|
109
|
-
};
|
|
110
|
-
function ke({ def: t, row: n, index: r, tabIndex: i, decimal: a, unavailable: s, onPress: c, onFocus: l, buttonRef: u }) {
|
|
111
|
-
let { t: d } = o();
|
|
112
|
-
return /* @__PURE__ */ O("button", {
|
|
113
|
-
ref: u,
|
|
114
|
-
type: "button",
|
|
115
|
-
"data-slot": "calculator-key",
|
|
116
|
-
"data-key": t.id,
|
|
117
|
-
"data-role": t.role,
|
|
118
|
-
"data-span": t.span,
|
|
119
|
-
"aria-disabled": s ? !0 : void 0,
|
|
120
|
-
tabIndex: i,
|
|
121
|
-
"aria-label": d(t.name.key, t.name.fallback),
|
|
122
|
-
className: e("nxgt-calc-key", Oe[t.role]),
|
|
123
|
-
onClick: () => !s && c(t),
|
|
124
|
-
onFocus: () => l(n, r),
|
|
125
|
-
children: /* @__PURE__ */ O("span", {
|
|
126
|
-
"aria-hidden": "true",
|
|
127
|
-
children: t.key === "." ? a : t.glyph
|
|
128
|
-
})
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region lib/components/ui/widgets/calculator/partials/keypad-navigation.ts
|
|
133
|
-
function Ae(e) {
|
|
134
|
-
return e.rows.map((e) => {
|
|
135
|
-
let t = 0;
|
|
136
|
-
return e.map((e) => {
|
|
137
|
-
let n = t;
|
|
138
|
-
return t += e.span ?? 1, {
|
|
139
|
-
start: n,
|
|
140
|
-
end: t
|
|
141
|
-
};
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
var z = (e) => Math.max(e - 1, 0);
|
|
146
|
-
function je(e, t, n, r) {
|
|
147
|
-
let i = t.row < r, a = i ? 0 : r, o = i ? r - 1 : z(e.length), s = e[t.row] ?? [];
|
|
148
|
-
if (n === "ArrowUp" || n === "ArrowDown") {
|
|
149
|
-
let e = t.row + (n === "ArrowUp" ? -1 : 1);
|
|
150
|
-
return e < a || e > o ? void 0 : null;
|
|
151
|
-
}
|
|
152
|
-
if (!(i ? n === "ArrowRight" && t.index === z(s.length) : n === "ArrowLeft" && t.index === 0)) return null;
|
|
153
|
-
let c = t.row - a, l = i ? [r, z(e.length)] : [0, r - 1], u = Math.min(l[0] + c, l[1]);
|
|
154
|
-
return {
|
|
155
|
-
row: u,
|
|
156
|
-
index: i ? 0 : z((e[u] ?? []).length)
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function Me(e, t, n, r = !1, i) {
|
|
160
|
-
let a = e[t.row] ?? [], o = a[t.index];
|
|
161
|
-
if (!o) return;
|
|
162
|
-
if (i && !(r && (n === "Home" || n === "End"))) {
|
|
163
|
-
let r = je(e, t, n, i);
|
|
164
|
-
if (r != null) return r;
|
|
165
|
-
if (r === void 0) return;
|
|
166
|
-
}
|
|
167
|
-
let s = z(e.length);
|
|
168
|
-
switch (n) {
|
|
169
|
-
case "ArrowLeft": return t.index > 0 ? {
|
|
170
|
-
row: t.row,
|
|
171
|
-
index: t.index - 1
|
|
172
|
-
} : void 0;
|
|
173
|
-
case "ArrowRight": return t.index < z(a.length) ? {
|
|
174
|
-
row: t.row,
|
|
175
|
-
index: t.index + 1
|
|
176
|
-
} : void 0;
|
|
177
|
-
case "ArrowUp":
|
|
178
|
-
case "ArrowDown": {
|
|
179
|
-
let r = t.row + (n === "ArrowUp" ? -1 : 1), i = e[r];
|
|
180
|
-
if (!i) return;
|
|
181
|
-
let a = i.findIndex((e) => e.start <= o.start && o.start < e.end);
|
|
182
|
-
return {
|
|
183
|
-
row: r,
|
|
184
|
-
index: Math.max(a, 0)
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
case "Home": return r ? {
|
|
188
|
-
row: 0,
|
|
189
|
-
index: 0
|
|
190
|
-
} : {
|
|
191
|
-
row: t.row,
|
|
192
|
-
index: 0
|
|
193
|
-
};
|
|
194
|
-
case "End": return r ? {
|
|
195
|
-
row: s,
|
|
196
|
-
index: z((e[s] ?? []).length)
|
|
197
|
-
} : {
|
|
198
|
-
row: t.row,
|
|
199
|
-
index: z(a.length)
|
|
200
|
-
};
|
|
201
|
-
default: return;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function Ne(e) {
|
|
205
|
-
let t = e.querySelectorAll("[data-pane]"), [n, r] = [t[0]?.firstElementChild, t[1]?.firstElementChild];
|
|
206
|
-
return !n || !r ? !1 : n.getBoundingClientRect().right <= r.getBoundingClientRect().left;
|
|
207
|
-
}
|
|
208
|
-
//#endregion
|
|
209
99
|
//#region lib/components/ui/widgets/calculator/partials/calculator-keypad.tsx
|
|
210
|
-
var
|
|
100
|
+
var Te = {
|
|
211
101
|
columns: 12,
|
|
212
102
|
rows: []
|
|
213
103
|
};
|
|
214
|
-
function
|
|
215
|
-
let r =
|
|
216
|
-
return
|
|
217
|
-
|
|
218
|
-
"
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
var Ie = /* @__PURE__ */ new Set([
|
|
227
|
-
"ArrowLeft",
|
|
228
|
-
"ArrowRight",
|
|
229
|
-
"ArrowUp",
|
|
230
|
-
"ArrowDown",
|
|
231
|
-
"Home",
|
|
232
|
-
"End"
|
|
233
|
-
]);
|
|
234
|
-
function Le({ helpId: e }) {
|
|
235
|
-
let { t } = o(), { definition: n, press: r, locale: i, state: a } = m(), s = n.layout ?? Pe, c = T(() => Ae(s), [s]), [l, u] = ue({
|
|
236
|
-
row: 0,
|
|
237
|
-
index: 0
|
|
238
|
-
}), d = c[l.row]?.[l.index] ? l : {
|
|
239
|
-
row: 0,
|
|
240
|
-
index: 0
|
|
241
|
-
}, f = E(/* @__PURE__ */ new Map()), p = F(i).decimal, h = n.programmer ? a.programmer.base : void 0;
|
|
242
|
-
function g(e) {
|
|
243
|
-
if (!Ie.has(e.key) || e.altKey || e.metaKey) return;
|
|
244
|
-
let t = Me(c, d, e.key, e.ctrlKey, Ne(e.currentTarget) ? s.split : void 0);
|
|
245
|
-
e.preventDefault(), t && f.current.get(`${t.row}:${t.index}`)?.focus();
|
|
246
|
-
}
|
|
247
|
-
return /* @__PURE__ */ O("div", {
|
|
248
|
-
role: "group",
|
|
249
|
-
"aria-label": t("material.calculator.keypad", "Keypad"),
|
|
250
|
-
"aria-describedby": e,
|
|
251
|
-
dir: "ltr",
|
|
252
|
-
"data-slot": "calculator-keypad",
|
|
253
|
-
"data-columns": s.columns,
|
|
254
|
-
className: "nxgt-calc-keys",
|
|
255
|
-
onKeyDown: g,
|
|
256
|
-
children: Fe(s.rows, s.split, (e, t) => e.map((e, n) => {
|
|
257
|
-
let i = oe(e, a.second);
|
|
258
|
-
return /* @__PURE__ */ O(ke, {
|
|
259
|
-
def: i,
|
|
260
|
-
row: t,
|
|
261
|
-
index: n,
|
|
262
|
-
decimal: p,
|
|
263
|
-
unavailable: h !== void 0 && x(i.key, h),
|
|
264
|
-
tabIndex: d.row === t && d.index === n ? 0 : -1,
|
|
265
|
-
buttonRef: (e) => {
|
|
266
|
-
f.current.set(`${t}:${n}`, e);
|
|
267
|
-
},
|
|
268
|
-
onFocus: (e, t) => u({
|
|
269
|
-
row: e,
|
|
270
|
-
index: t
|
|
271
|
-
}),
|
|
272
|
-
onPress: (e) => {
|
|
273
|
-
for (let t of ae(e)) r(t);
|
|
274
|
-
}
|
|
275
|
-
}, i.id);
|
|
276
|
-
}))
|
|
104
|
+
function Ee({ helpId: e }) {
|
|
105
|
+
let { t } = o(), { definition: n, press: r, locale: i, state: a } = f(), s = n.layout ?? Te, c = n.programmer ? a.programmer.base : void 0, l = a.second, u = D(() => (e) => ae(e, l), [l]);
|
|
106
|
+
return /* @__PURE__ */ k(ne, {
|
|
107
|
+
layout: s,
|
|
108
|
+
label: t("material.calculator.keypad", "Keypad"),
|
|
109
|
+
describedBy: e,
|
|
110
|
+
decimal: F(i).decimal,
|
|
111
|
+
faceOf: u,
|
|
112
|
+
unavailable: (e) => c !== void 0 && S(e.key, c),
|
|
113
|
+
onPress: (e) => {
|
|
114
|
+
for (let t of ie(e)) r(t);
|
|
115
|
+
}
|
|
277
116
|
});
|
|
278
117
|
}
|
|
279
118
|
//#endregion
|
|
280
119
|
//#region lib/components/ui/widgets/calculator/variants/variant-loader.ts
|
|
281
|
-
var
|
|
282
|
-
scientific: () => import("./scientific-variant-
|
|
283
|
-
pos: () => import("./pos-variant-
|
|
284
|
-
programmer: () => import("./programmer-variant-
|
|
285
|
-
financial: () => import("./financial-variant-
|
|
286
|
-
conversion: () => import("./conversion-variant-
|
|
120
|
+
var De = {
|
|
121
|
+
scientific: () => import("./scientific-variant-BzF_aMQP.js"),
|
|
122
|
+
pos: () => import("./pos-variant-ClGI92Lt.js"),
|
|
123
|
+
programmer: () => import("./programmer-variant-Boq2O8hB.js"),
|
|
124
|
+
financial: () => import("./financial-variant-BY_VCUuk.js"),
|
|
125
|
+
conversion: () => import("./conversion-variant-clFZ6ZMJ.js")
|
|
287
126
|
}, B = "failed", V = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), W = () => {
|
|
288
127
|
for (let e of U) e();
|
|
289
128
|
};
|
|
290
129
|
function G(e) {
|
|
291
|
-
let t =
|
|
130
|
+
let t = De[e];
|
|
292
131
|
if (!t || V.has(e) && V.get(e) !== B) return Promise.resolve();
|
|
293
132
|
let n = H.get(e);
|
|
294
133
|
if (n) return n;
|
|
295
134
|
V.get(e) === B && (V.delete(e), W());
|
|
296
135
|
let r = t().then(({ variant: t }) => {
|
|
297
|
-
t.logic &&
|
|
136
|
+
t.logic && _(e, t.logic), V.set(e, t.part);
|
|
298
137
|
}).catch(() => {
|
|
299
138
|
V.set(e, B);
|
|
300
139
|
}).finally(() => {
|
|
@@ -302,59 +141,59 @@ function G(e) {
|
|
|
302
141
|
});
|
|
303
142
|
return H.set(e, r), r;
|
|
304
143
|
}
|
|
305
|
-
var
|
|
144
|
+
var Oe = (e) => (U.add(e), () => {
|
|
306
145
|
U.delete(e);
|
|
307
146
|
});
|
|
308
|
-
function
|
|
309
|
-
let t =
|
|
310
|
-
return
|
|
147
|
+
function ke(e) {
|
|
148
|
+
let t = ce(Oe, () => V.get(e), () => void 0);
|
|
149
|
+
return T(() => {
|
|
311
150
|
V.has(e) || G(e);
|
|
312
151
|
}, [e]), t;
|
|
313
152
|
}
|
|
314
153
|
//#endregion
|
|
315
154
|
//#region lib/components/ui/widgets/calculator/partials/calculator-loading.tsx
|
|
316
|
-
var
|
|
317
|
-
function
|
|
318
|
-
let { t: e } = o(), { variant: t, definition: n } =
|
|
319
|
-
return /* @__PURE__ */
|
|
155
|
+
var Ae = 24;
|
|
156
|
+
function je() {
|
|
157
|
+
let { t: e } = o(), { variant: t, definition: n } = f(), r = n.pending === "failed", i = r ? e("material.calculator.load-failed", "This calculator could not be loaded.") : e("material.calculator.loading", "Loading the calculator");
|
|
158
|
+
return /* @__PURE__ */ k("div", {
|
|
320
159
|
className: "nxgt-calc-body nxgt-calc-loading",
|
|
321
160
|
"data-state": r ? "failed" : "loading",
|
|
322
161
|
role: "status",
|
|
323
|
-
children: /* @__PURE__ */
|
|
162
|
+
children: /* @__PURE__ */ A("div", {
|
|
324
163
|
className: "nxgt-calc-main",
|
|
325
|
-
children: [r ? /* @__PURE__ */
|
|
164
|
+
children: [r ? /* @__PURE__ */ A("div", {
|
|
326
165
|
className: "nxgt-calc-loading-message",
|
|
327
|
-
children: [/* @__PURE__ */
|
|
166
|
+
children: [/* @__PURE__ */ k("p", { children: i }), /* @__PURE__ */ k(a, {
|
|
328
167
|
type: "button",
|
|
329
168
|
variant: "outlined",
|
|
330
169
|
onClick: () => void G(t),
|
|
331
170
|
children: e("material.calculator.retry", "Try again")
|
|
332
171
|
})]
|
|
333
|
-
}) : /* @__PURE__ */
|
|
172
|
+
}) : /* @__PURE__ */ A(le, { children: [/* @__PURE__ */ k("p", {
|
|
334
173
|
className: "sr-only",
|
|
335
174
|
children: i
|
|
336
|
-
}), /* @__PURE__ */
|
|
175
|
+
}), /* @__PURE__ */ k(u, {
|
|
337
176
|
"aria-hidden": "true",
|
|
338
177
|
className: "nxgt-calc-loading-display"
|
|
339
|
-
})] }), /* @__PURE__ */
|
|
178
|
+
})] }), /* @__PURE__ */ k("div", {
|
|
340
179
|
className: "nxgt-calc-loading-pad",
|
|
341
180
|
"aria-hidden": "true",
|
|
342
181
|
"aria-busy": !r || void 0,
|
|
343
|
-
children: Array.from({ length:
|
|
182
|
+
children: Array.from({ length: Ae }, (e, t) => /* @__PURE__ */ k(u, {}, t))
|
|
344
183
|
})]
|
|
345
184
|
})
|
|
346
185
|
});
|
|
347
186
|
}
|
|
348
187
|
//#endregion
|
|
349
188
|
//#region lib/components/ui/widgets/calculator/partials/calculator-panel-body.tsx
|
|
350
|
-
function
|
|
351
|
-
return /* @__PURE__ */
|
|
189
|
+
function Me({ panel: e }) {
|
|
190
|
+
return /* @__PURE__ */ k("div", {
|
|
352
191
|
className: "nxgt-calc-body",
|
|
353
192
|
onKeyDown: (e) => e.stopPropagation(),
|
|
354
193
|
onPaste: (e) => e.stopPropagation(),
|
|
355
|
-
children: /* @__PURE__ */
|
|
194
|
+
children: /* @__PURE__ */ k("div", {
|
|
356
195
|
className: "nxgt-calc-main",
|
|
357
|
-
children: /* @__PURE__ */
|
|
196
|
+
children: /* @__PURE__ */ k(e, {})
|
|
358
197
|
})
|
|
359
198
|
});
|
|
360
199
|
}
|
|
@@ -392,10 +231,10 @@ var K = [
|
|
|
392
231
|
key: "material.calculator.variants.conversion",
|
|
393
232
|
fallback: "Conversion"
|
|
394
233
|
}
|
|
395
|
-
},
|
|
234
|
+
}, Ne = {
|
|
396
235
|
id: "standard",
|
|
397
236
|
label: q.standard,
|
|
398
|
-
layout:
|
|
237
|
+
layout: oe,
|
|
399
238
|
extraKeys: [
|
|
400
239
|
"(",
|
|
401
240
|
")",
|
|
@@ -403,11 +242,11 @@ var K = [
|
|
|
403
242
|
"ans"
|
|
404
243
|
]
|
|
405
244
|
};
|
|
406
|
-
function
|
|
245
|
+
function Pe() {
|
|
407
246
|
return K;
|
|
408
247
|
}
|
|
409
|
-
function
|
|
410
|
-
if (e === "standard") return
|
|
248
|
+
function Fe(e, t) {
|
|
249
|
+
if (e === "standard") return Ne;
|
|
411
250
|
let n = {
|
|
412
251
|
id: e,
|
|
413
252
|
label: q[e]
|
|
@@ -423,33 +262,33 @@ function Ke(e, t) {
|
|
|
423
262
|
...t
|
|
424
263
|
};
|
|
425
264
|
}
|
|
426
|
-
function
|
|
265
|
+
function Ie(e) {
|
|
427
266
|
let t = new Set(e.extraKeys ?? []);
|
|
428
267
|
for (let n of e.layout?.rows ?? []) for (let e of n) t.add(e.key), e.alt && t.add(e.alt.key);
|
|
429
268
|
return t;
|
|
430
269
|
}
|
|
431
270
|
//#endregion
|
|
432
271
|
//#region lib/components/ui/widgets/calculator/partials/calculator-switcher.tsx
|
|
433
|
-
function
|
|
434
|
-
let { t: a } = o(), { variant: s, variants: c, setVariant: l } =
|
|
435
|
-
return /* @__PURE__ */
|
|
272
|
+
function Le({ children: e }) {
|
|
273
|
+
let { t: a } = o(), { variant: s, variants: c, setVariant: l } = f();
|
|
274
|
+
return /* @__PURE__ */ A(i, {
|
|
436
275
|
value: s,
|
|
437
276
|
variant: "segmented",
|
|
438
277
|
className: "nxgt-calc-tabs",
|
|
439
278
|
onValueChange: (e) => l(e),
|
|
440
|
-
children: [/* @__PURE__ */
|
|
279
|
+
children: [/* @__PURE__ */ k(r, {
|
|
441
280
|
"aria-label": a("material.calculator.variants.label", "Calculator type"),
|
|
442
281
|
className: "nxgt-calc-switcher",
|
|
443
282
|
children: c.map((e) => {
|
|
444
283
|
let t = q[e];
|
|
445
|
-
return /* @__PURE__ */
|
|
284
|
+
return /* @__PURE__ */ k(n, {
|
|
446
285
|
value: e,
|
|
447
286
|
onPointerEnter: () => void G(e),
|
|
448
287
|
onFocus: () => void G(e),
|
|
449
288
|
children: a(t.key, t.fallback)
|
|
450
289
|
}, e);
|
|
451
290
|
})
|
|
452
|
-
}), /* @__PURE__ */
|
|
291
|
+
}), /* @__PURE__ */ k(t, {
|
|
453
292
|
value: s,
|
|
454
293
|
className: "nxgt-calc-panel",
|
|
455
294
|
children: e
|
|
@@ -463,34 +302,34 @@ var J = [
|
|
|
463
302
|
"bg-secondary-container",
|
|
464
303
|
"bg-tertiary-container"
|
|
465
304
|
];
|
|
466
|
-
function
|
|
467
|
-
let { t: n } = o(), { replay: r, reuse: i, locale: a } =
|
|
468
|
-
return /* @__PURE__ */
|
|
305
|
+
function Re({ entry: e, colour: t }) {
|
|
306
|
+
let { t: n } = o(), { replay: r, reuse: i, locale: a } = f(), s = N(e.expression, { locale: a }), c = L(e.result), l = c ? M(c, { locale: a }) : e.result;
|
|
307
|
+
return /* @__PURE__ */ A("li", {
|
|
469
308
|
"data-slot": "calculator-tape-entry",
|
|
470
309
|
className: `nxgt-calc-entry ${t}`,
|
|
471
|
-
children: [/* @__PURE__ */
|
|
310
|
+
children: [/* @__PURE__ */ k("button", {
|
|
472
311
|
type: "button",
|
|
473
312
|
dir: "ltr",
|
|
474
313
|
className: "nxgt-calc-entry-expression",
|
|
475
314
|
"aria-label": n("material.calculator.tape.replay", "Replay {expression}", { expression: s }),
|
|
476
315
|
onClick: () => r(e),
|
|
477
316
|
children: s
|
|
478
|
-
}), /* @__PURE__ */
|
|
317
|
+
}), /* @__PURE__ */ A("button", {
|
|
479
318
|
type: "button",
|
|
480
319
|
dir: "ltr",
|
|
481
320
|
className: "nxgt-calc-entry-result",
|
|
482
321
|
"aria-label": n("material.calculator.tape.reuse", "Use result {result}", { result: l }),
|
|
483
322
|
onClick: () => i(e),
|
|
484
|
-
children: [/* @__PURE__ */
|
|
323
|
+
children: [/* @__PURE__ */ k("span", {
|
|
485
324
|
"aria-hidden": "true",
|
|
486
325
|
children: "= "
|
|
487
326
|
}), l]
|
|
488
327
|
})]
|
|
489
328
|
});
|
|
490
329
|
}
|
|
491
|
-
function
|
|
492
|
-
let { t } = o(), { state: n, clearTape: r, tapeRef: i } =
|
|
493
|
-
return /* @__PURE__ */
|
|
330
|
+
function ze({ id: e }) {
|
|
331
|
+
let { t } = o(), { state: n, clearTape: r, tapeRef: i } = f(), { history: a } = n;
|
|
332
|
+
return /* @__PURE__ */ A("div", {
|
|
494
333
|
ref: i,
|
|
495
334
|
id: e,
|
|
496
335
|
role: "group",
|
|
@@ -498,30 +337,30 @@ function Y({ id: e }) {
|
|
|
498
337
|
"data-slot": "calculator-tape",
|
|
499
338
|
"aria-label": t("material.calculator.tape.label", "History"),
|
|
500
339
|
className: "nxgt-calc-tape",
|
|
501
|
-
children: [/* @__PURE__ */
|
|
340
|
+
children: [/* @__PURE__ */ A("header", {
|
|
502
341
|
className: "nxgt-calc-tape-head",
|
|
503
342
|
children: [
|
|
504
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ k("p", {
|
|
505
344
|
className: "nxgt-calc-tape-title",
|
|
506
345
|
children: t("material.calculator.tape.label", "History")
|
|
507
346
|
}),
|
|
508
|
-
/* @__PURE__ */
|
|
509
|
-
/* @__PURE__ */
|
|
347
|
+
/* @__PURE__ */ k("span", { className: "nxgt-calc-grow" }),
|
|
348
|
+
/* @__PURE__ */ k(s, {
|
|
510
349
|
size: "sm",
|
|
511
350
|
variant: "ghost",
|
|
512
351
|
className: "nxgt-calc-tool",
|
|
513
352
|
"aria-label": t("material.calculator.tape.clear", "Clear history"),
|
|
514
353
|
disabled: a.length === 0,
|
|
515
354
|
onClick: r,
|
|
516
|
-
children: /* @__PURE__ */
|
|
355
|
+
children: /* @__PURE__ */ k(pe, {})
|
|
517
356
|
})
|
|
518
357
|
]
|
|
519
|
-
}), a.length === 0 ? /* @__PURE__ */
|
|
358
|
+
}), a.length === 0 ? /* @__PURE__ */ k("p", {
|
|
520
359
|
className: "nxgt-calc-tape-empty text-muted-foreground",
|
|
521
360
|
children: t("material.calculator.tape.empty", "Your calculations appear here.")
|
|
522
|
-
}) : /* @__PURE__ */
|
|
361
|
+
}) : /* @__PURE__ */ k("ul", {
|
|
523
362
|
className: "nxgt-calc-entries",
|
|
524
|
-
children: a.map((e, t) => /* @__PURE__ */
|
|
363
|
+
children: a.map((e, t) => /* @__PURE__ */ k(Re, {
|
|
525
364
|
entry: e,
|
|
526
365
|
colour: J[(a.length - 1 - t) % J.length] ?? ""
|
|
527
366
|
}, e.id))
|
|
@@ -530,23 +369,23 @@ function Y({ id: e }) {
|
|
|
530
369
|
}
|
|
531
370
|
//#endregion
|
|
532
371
|
//#region lib/components/ui/widgets/calculator/partials/calculator-shell.tsx
|
|
533
|
-
function
|
|
534
|
-
let { t: a } = o(), { variant: s, variants: c, state: l, definition: u } =
|
|
372
|
+
function Be({ className: t, "aria-label": n, onKeyDown: r, onPaste: i }) {
|
|
373
|
+
let { t: a } = o(), { variant: s, variants: c, state: l, definition: u } = f(), d = u.toolbar, p = u.panel, m = E(), h = E(), g = u.display, _ = u.aside, v = u.pending !== void 0, y = !!p || v, b = v ? /* @__PURE__ */ k(je, {}) : p ? /* @__PURE__ */ k(Me, { panel: p }) : /* @__PURE__ */ A("div", {
|
|
535
374
|
className: "nxgt-calc-body",
|
|
536
|
-
children: [/* @__PURE__ */
|
|
375
|
+
children: [/* @__PURE__ */ A("div", {
|
|
537
376
|
className: "nxgt-calc-main",
|
|
538
377
|
children: [
|
|
539
|
-
g ? /* @__PURE__ */
|
|
540
|
-
d ? /* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
378
|
+
g ? /* @__PURE__ */ k(g, {}) : /* @__PURE__ */ k(we, { tapeId: h }),
|
|
379
|
+
d ? /* @__PURE__ */ k(d, {}) : null,
|
|
380
|
+
/* @__PURE__ */ k(Ee, { helpId: m })
|
|
542
381
|
]
|
|
543
|
-
}), _ ? /* @__PURE__ */
|
|
382
|
+
}), _ ? /* @__PURE__ */ k("div", {
|
|
544
383
|
"data-slot": "calculator-aside",
|
|
545
384
|
className: "nxgt-calc-aside",
|
|
546
|
-
children: /* @__PURE__ */
|
|
547
|
-
}) : /* @__PURE__ */
|
|
385
|
+
children: /* @__PURE__ */ k(_, {})
|
|
386
|
+
}) : /* @__PURE__ */ k(ze, { id: h })]
|
|
548
387
|
});
|
|
549
|
-
return /* @__PURE__ */
|
|
388
|
+
return /* @__PURE__ */ A("div", {
|
|
550
389
|
role: "group",
|
|
551
390
|
"aria-label": n ?? a("material.calculator.label", "Calculator"),
|
|
552
391
|
"data-slot": "calculator",
|
|
@@ -556,36 +395,36 @@ function Xe({ className: t, "aria-label": n, onKeyDown: r, onPaste: i }) {
|
|
|
556
395
|
onKeyDown: r,
|
|
557
396
|
onPaste: i,
|
|
558
397
|
children: [
|
|
559
|
-
c.length > 1 ? /* @__PURE__ */
|
|
560
|
-
y ? null : /* @__PURE__ */
|
|
561
|
-
id:
|
|
398
|
+
c.length > 1 ? /* @__PURE__ */ k(Le, { children: b }) : b,
|
|
399
|
+
y ? null : /* @__PURE__ */ k("p", {
|
|
400
|
+
id: m,
|
|
562
401
|
className: "sr-only",
|
|
563
402
|
children: a("material.calculator.help", "Type digits and operators. Enter calculates, Escape clears, Backspace deletes.")
|
|
564
403
|
}),
|
|
565
|
-
y ? null : /* @__PURE__ */
|
|
404
|
+
y ? null : /* @__PURE__ */ k(xe, {})
|
|
566
405
|
]
|
|
567
406
|
});
|
|
568
407
|
}
|
|
569
408
|
//#endregion
|
|
570
409
|
//#region lib/components/ui/widgets/calculator/engine.ts
|
|
571
|
-
function
|
|
410
|
+
function Y(e) {
|
|
572
411
|
let t = {};
|
|
573
412
|
e.precision !== void 0 && (t.precision = Math.min(Math.max(Math.trunc(e.precision), 1), 34)), e.rounding && (t.rounding = e.rounding);
|
|
574
413
|
let n = {
|
|
575
414
|
percent: e.percent,
|
|
576
415
|
ctx: t
|
|
577
416
|
};
|
|
578
|
-
return e.programmer ?
|
|
417
|
+
return e.programmer ? h("programmer")?.options?.(n, e) ?? n : e.scientific ? h("scientific")?.options?.(n, e) ?? n : n;
|
|
579
418
|
}
|
|
580
|
-
var
|
|
419
|
+
var Ve = {
|
|
581
420
|
auto: "auto",
|
|
582
421
|
sci: "scientific",
|
|
583
422
|
eng: "engineering"
|
|
584
|
-
},
|
|
585
|
-
function
|
|
586
|
-
let n = t.programmer ?
|
|
423
|
+
}, He = (e) => Ve[e ?? "auto"], Ue = /(?:\s*(?:mod|[-+*/^])\s*)+$/, We = /\d*\.?\d+$|\d+\.$/, Ge = (e) => e.replace(Ue, "").trim();
|
|
424
|
+
function Ke(e, t) {
|
|
425
|
+
let n = t.programmer ? h("programmer")?.display?.(e, t) : void 0;
|
|
587
426
|
if (n) return n;
|
|
588
|
-
let { session: r } = e, { locale: i } = t, a =
|
|
427
|
+
let { session: r } = e, { locale: i } = t, a = He(t.notation), o = N(r.expression, { locale: i });
|
|
589
428
|
if (r.error) return {
|
|
590
429
|
expression: o,
|
|
591
430
|
result: "",
|
|
@@ -593,10 +432,10 @@ function nt(e, t) {
|
|
|
593
432
|
value: "",
|
|
594
433
|
error: r.error
|
|
595
434
|
};
|
|
596
|
-
let s = r.justEvaluated ?
|
|
435
|
+
let s = r.justEvaluated ? L(r.result) : void 0;
|
|
597
436
|
if (s) return {
|
|
598
437
|
expression: o,
|
|
599
|
-
result:
|
|
438
|
+
result: M(s, {
|
|
600
439
|
locale: i,
|
|
601
440
|
notation: a
|
|
602
441
|
}),
|
|
@@ -604,7 +443,7 @@ function nt(e, t) {
|
|
|
604
443
|
value: r.result,
|
|
605
444
|
error: ""
|
|
606
445
|
};
|
|
607
|
-
let c =
|
|
446
|
+
let c = Ge(r.expression);
|
|
608
447
|
if (c === "") return {
|
|
609
448
|
expression: o,
|
|
610
449
|
result: "0",
|
|
@@ -612,65 +451,65 @@ function nt(e, t) {
|
|
|
612
451
|
value: "",
|
|
613
452
|
error: ""
|
|
614
453
|
};
|
|
615
|
-
let l =
|
|
454
|
+
let l = ge(c, be(r, Y(t)));
|
|
616
455
|
if (l.ok) return {
|
|
617
456
|
expression: o,
|
|
618
|
-
result:
|
|
457
|
+
result: M(l.value, {
|
|
619
458
|
locale: i,
|
|
620
459
|
notation: a
|
|
621
460
|
}),
|
|
622
461
|
kind: "preview",
|
|
623
|
-
value:
|
|
462
|
+
value: z(l.value),
|
|
624
463
|
error: ""
|
|
625
464
|
};
|
|
626
|
-
let u =
|
|
465
|
+
let u = We.exec(c)?.[0], d = u ? L(u) : void 0;
|
|
627
466
|
return {
|
|
628
467
|
expression: o,
|
|
629
|
-
result: d ?
|
|
468
|
+
result: d ? M(d, { locale: i }) : "0",
|
|
630
469
|
kind: "preview",
|
|
631
470
|
value: "",
|
|
632
471
|
error: ""
|
|
633
472
|
};
|
|
634
473
|
}
|
|
635
|
-
var
|
|
636
|
-
let t =
|
|
474
|
+
var qe = (e) => {
|
|
475
|
+
let t = L(e.session.memory);
|
|
637
476
|
return t !== void 0 && t.c !== 0n;
|
|
638
477
|
};
|
|
639
478
|
//#endregion
|
|
640
479
|
//#region lib/components/ui/widgets/calculator/calculator-variant-steps.ts
|
|
641
|
-
function
|
|
642
|
-
let { action: n, env: r, format: i } = t, a =
|
|
480
|
+
function Je(e, t) {
|
|
481
|
+
let { action: n, env: r, format: i } = t, a = h("pos");
|
|
643
482
|
if (!a?.reducePos || !a.announcePos) return;
|
|
644
483
|
let o = a.reducePos(e.pos, n, r);
|
|
645
484
|
e.announcement = a.announcePos(e.pos, o, n, r, i), e.pos = o;
|
|
646
485
|
}
|
|
647
|
-
function
|
|
648
|
-
let n =
|
|
486
|
+
function Ye(e, t) {
|
|
487
|
+
let n = h("programmer")?.reduce?.(e.session, e.programmer, t);
|
|
649
488
|
n && Object.assign(e, n);
|
|
650
489
|
}
|
|
651
490
|
//#endregion
|
|
652
491
|
//#region lib/components/ui/widgets/calculator/calculator.slice.ts
|
|
653
|
-
var
|
|
492
|
+
var Xe = {
|
|
654
493
|
variant: "standard",
|
|
655
|
-
session:
|
|
494
|
+
session: j,
|
|
656
495
|
history: [],
|
|
657
496
|
tapeOpen: !1,
|
|
658
497
|
angle: "deg",
|
|
659
498
|
notation: "auto",
|
|
660
499
|
second: !1,
|
|
661
|
-
pos:
|
|
662
|
-
programmer:
|
|
500
|
+
pos: te,
|
|
501
|
+
programmer: C,
|
|
663
502
|
announcement: null,
|
|
664
503
|
restored: !1
|
|
665
|
-
},
|
|
504
|
+
}, Ze = 1e3, X = me({
|
|
666
505
|
name: "calculator",
|
|
667
|
-
initialState:
|
|
506
|
+
initialState: Xe,
|
|
668
507
|
reducers: {
|
|
669
508
|
press: (e, t) => {
|
|
670
|
-
let { key: n, settings: r, id: i } = t.payload, a = e.session, o =
|
|
671
|
-
e.session = o, e.announcement =
|
|
672
|
-
let s = n === "=" && !a.justEvaluated ?
|
|
673
|
-
s && (e.history =
|
|
509
|
+
let { key: n, settings: r, id: i } = t.payload, a = e.session, o = R(a, n, Y(r));
|
|
510
|
+
e.session = o, e.announcement = b(n, a, o, r.locale, r.programmer);
|
|
511
|
+
let s = n === "=" && !a.justEvaluated ? P(o, e.variant, i) : void 0;
|
|
512
|
+
s && (e.history = ve(e.history, s));
|
|
674
513
|
},
|
|
675
514
|
setVariant: (e, t) => {
|
|
676
515
|
e.variant = t.payload;
|
|
@@ -685,35 +524,35 @@ var ot = {
|
|
|
685
524
|
}, e.announcement = null;
|
|
686
525
|
},
|
|
687
526
|
reuse: (e, t) => {
|
|
688
|
-
e.session =
|
|
527
|
+
e.session = R({
|
|
689
528
|
...e.session,
|
|
690
529
|
ans: t.payload.entry.result
|
|
691
|
-
}, "ans",
|
|
530
|
+
}, "ans", Y(t.payload.settings)), e.announcement = null;
|
|
692
531
|
},
|
|
693
532
|
paste: (e, t) => {
|
|
694
|
-
let n =
|
|
533
|
+
let n = I(t.payload.text.slice(0, Ze), t.payload.locale).trim();
|
|
695
534
|
n !== "" && (e.session = {
|
|
696
535
|
...e.session,
|
|
697
536
|
expression: n,
|
|
698
537
|
result: "",
|
|
699
538
|
error: "",
|
|
700
539
|
justEvaluated: !1
|
|
701
|
-
}, e.announcement =
|
|
540
|
+
}, e.announcement = m("pasted"));
|
|
702
541
|
},
|
|
703
542
|
setAngle: (e, t) => {
|
|
704
|
-
e.angle = t.payload, e.announcement =
|
|
543
|
+
e.angle = t.payload, e.announcement = v(t.payload);
|
|
705
544
|
},
|
|
706
545
|
setNotation: (e, t) => {
|
|
707
|
-
e.notation = t.payload, e.announcement =
|
|
546
|
+
e.notation = t.payload, e.announcement = y(t.payload);
|
|
708
547
|
},
|
|
709
548
|
toggleSecond: (e, t) => {
|
|
710
|
-
e.second = t.payload ?? !e.second, e.announcement =
|
|
549
|
+
e.second = t.payload ?? !e.second, e.announcement = ee(e.second);
|
|
711
550
|
},
|
|
712
551
|
pos: (e, t) => {
|
|
713
|
-
|
|
552
|
+
Je(e, t.payload);
|
|
714
553
|
},
|
|
715
554
|
programmer: (e, t) => {
|
|
716
|
-
|
|
555
|
+
Ye(e, t.payload);
|
|
717
556
|
},
|
|
718
557
|
announce: (e, t) => {
|
|
719
558
|
e.announcement = t.payload;
|
|
@@ -736,13 +575,13 @@ var ot = {
|
|
|
736
575
|
}
|
|
737
576
|
}
|
|
738
577
|
});
|
|
739
|
-
|
|
578
|
+
X.actions;
|
|
740
579
|
//#endregion
|
|
741
580
|
//#region lib/components/ui/widgets/calculator/calculator-clipboard.ts
|
|
742
|
-
async function
|
|
743
|
-
let i =
|
|
581
|
+
async function Qe(e, t, n, r) {
|
|
582
|
+
let i = L(e);
|
|
744
583
|
if (!i) return !1;
|
|
745
|
-
let a = r ?
|
|
584
|
+
let a = r ? h("programmer")?.copy?.(e, r) : M(i, {
|
|
746
585
|
locale: t,
|
|
747
586
|
grouping: !1
|
|
748
587
|
});
|
|
@@ -752,9 +591,9 @@ async function ct(e, t, n, r) {
|
|
|
752
591
|
} catch {
|
|
753
592
|
return !1;
|
|
754
593
|
}
|
|
755
|
-
return n.announce(
|
|
594
|
+
return n.announce(m("copied")), !0;
|
|
756
595
|
}
|
|
757
|
-
async function
|
|
596
|
+
async function $e(e) {
|
|
758
597
|
try {
|
|
759
598
|
return await e?.() ?? "";
|
|
760
599
|
} catch {
|
|
@@ -763,10 +602,10 @@ async function lt(e) {
|
|
|
763
602
|
}
|
|
764
603
|
//#endregion
|
|
765
604
|
//#region lib/components/ui/widgets/calculator/use-calculator-clipboard.ts
|
|
766
|
-
function
|
|
605
|
+
function et(e, t, n, r) {
|
|
767
606
|
let { announce: i, paste: a } = n;
|
|
768
607
|
return {
|
|
769
|
-
copy:
|
|
608
|
+
copy: w(() => Qe(e, t, {
|
|
770
609
|
write: c,
|
|
771
610
|
announce: i
|
|
772
611
|
}, r), [
|
|
@@ -775,14 +614,14 @@ function ut(e, t, n, r) {
|
|
|
775
614
|
e,
|
|
776
615
|
r
|
|
777
616
|
]),
|
|
778
|
-
paste:
|
|
779
|
-
let e = await
|
|
617
|
+
paste: w(async () => {
|
|
618
|
+
let e = await $e(() => navigator.clipboard.readText());
|
|
780
619
|
e && a({
|
|
781
620
|
text: e,
|
|
782
621
|
locale: t
|
|
783
622
|
});
|
|
784
623
|
}, [t, a]),
|
|
785
|
-
pasteEvent:
|
|
624
|
+
pasteEvent: w((e) => {
|
|
786
625
|
e && a({
|
|
787
626
|
text: e,
|
|
788
627
|
locale: t
|
|
@@ -792,8 +631,8 @@ function ut(e, t, n, r) {
|
|
|
792
631
|
}
|
|
793
632
|
//#endregion
|
|
794
633
|
//#region lib/components/ui/widgets/calculator/use-calculator-conversion.ts
|
|
795
|
-
function
|
|
796
|
-
return
|
|
634
|
+
function tt(e) {
|
|
635
|
+
return D(() => ({
|
|
797
636
|
currencyRates: e.currencyRates,
|
|
798
637
|
precision: e.precision,
|
|
799
638
|
rounding: e.rounding
|
|
@@ -803,12 +642,12 @@ function dt(e) {
|
|
|
803
642
|
e.rounding
|
|
804
643
|
]);
|
|
805
644
|
}
|
|
806
|
-
function
|
|
645
|
+
function nt(e, t) {
|
|
807
646
|
if (e) try {
|
|
808
647
|
e.haptics && !t.reducedMotion() && t.vibrate?.(8), e.sound && t.audio?.()?.tick();
|
|
809
648
|
} catch {}
|
|
810
649
|
}
|
|
811
|
-
function
|
|
650
|
+
function rt() {
|
|
812
651
|
let e;
|
|
813
652
|
return () => {
|
|
814
653
|
let t = window.AudioContext ?? window.webkitAudioContext;
|
|
@@ -822,7 +661,7 @@ function pt() {
|
|
|
822
661
|
} };
|
|
823
662
|
};
|
|
824
663
|
}
|
|
825
|
-
function
|
|
664
|
+
function it(e) {
|
|
826
665
|
return {
|
|
827
666
|
vibrate: (e) => navigator.vibrate?.(e) ?? !1,
|
|
828
667
|
reducedMotion: () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1,
|
|
@@ -831,13 +670,13 @@ function mt(e) {
|
|
|
831
670
|
}
|
|
832
671
|
//#endregion
|
|
833
672
|
//#region lib/components/ui/widgets/calculator/use-calculator-feedback.ts
|
|
834
|
-
function
|
|
835
|
-
let t =
|
|
836
|
-
return
|
|
837
|
-
!n && !r ||
|
|
673
|
+
function at(e) {
|
|
674
|
+
let t = D(() => rt(), []), n = e?.haptics, r = e?.sound;
|
|
675
|
+
return w(() => {
|
|
676
|
+
!n && !r || nt({
|
|
838
677
|
haptics: n,
|
|
839
678
|
sound: r
|
|
840
|
-
},
|
|
679
|
+
}, it(t));
|
|
841
680
|
}, [
|
|
842
681
|
n,
|
|
843
682
|
r,
|
|
@@ -846,30 +685,30 @@ function ht(e) {
|
|
|
846
685
|
}
|
|
847
686
|
//#endregion
|
|
848
687
|
//#region lib/components/ui/widgets/calculator/calculator-storage.ts
|
|
849
|
-
var
|
|
850
|
-
function
|
|
688
|
+
var ot = "nxgt-calculator:", Z = 1;
|
|
689
|
+
function Q() {
|
|
851
690
|
try {
|
|
852
691
|
return typeof window > "u" ? void 0 : window.localStorage;
|
|
853
692
|
} catch {
|
|
854
693
|
return;
|
|
855
694
|
}
|
|
856
695
|
}
|
|
857
|
-
function
|
|
858
|
-
return e === !1 ? void 0 : `${
|
|
696
|
+
function st(e) {
|
|
697
|
+
return e === !1 ? void 0 : `${ot}${typeof e == "object" ? e.key : "default"}`;
|
|
859
698
|
}
|
|
860
|
-
function
|
|
699
|
+
function ct(e) {
|
|
861
700
|
try {
|
|
862
|
-
let t = JSON.parse(e ?? ""), n = t.v ===
|
|
863
|
-
return typeof n == "string" && n.length <= 10100 &&
|
|
701
|
+
let t = JSON.parse(e ?? ""), n = t.v === Z ? t.memory : void 0;
|
|
702
|
+
return typeof n == "string" && n.length <= 10100 && L(n) ? n : "0";
|
|
864
703
|
} catch {
|
|
865
704
|
return "0";
|
|
866
705
|
}
|
|
867
706
|
}
|
|
868
|
-
function
|
|
707
|
+
function lt(e, t) {
|
|
869
708
|
try {
|
|
870
709
|
return {
|
|
871
|
-
history:
|
|
872
|
-
memory:
|
|
710
|
+
history: _e(e?.getItem(`${t}:history`)),
|
|
711
|
+
memory: ct(e?.getItem(`${t}:memory`) ?? null)
|
|
873
712
|
};
|
|
874
713
|
} catch {
|
|
875
714
|
return {
|
|
@@ -878,30 +717,30 @@ function yt(e, t) {
|
|
|
878
717
|
};
|
|
879
718
|
}
|
|
880
719
|
}
|
|
881
|
-
function
|
|
720
|
+
function ut(e, t, n) {
|
|
882
721
|
try {
|
|
883
|
-
e?.setItem(`${t}:history`,
|
|
884
|
-
v:
|
|
722
|
+
e?.setItem(`${t}:history`, ye(n.history)), e?.setItem(`${t}:memory`, JSON.stringify({
|
|
723
|
+
v: Z,
|
|
885
724
|
memory: n.memory
|
|
886
725
|
}));
|
|
887
726
|
} catch {}
|
|
888
727
|
}
|
|
889
728
|
//#endregion
|
|
890
729
|
//#region lib/components/ui/widgets/calculator/use-calculator-persistence.ts
|
|
891
|
-
var
|
|
892
|
-
function
|
|
893
|
-
let r =
|
|
894
|
-
|
|
730
|
+
var dt = 300;
|
|
731
|
+
function ft(e, t, n) {
|
|
732
|
+
let r = st(e), { restore: i, markRestored: a } = n;
|
|
733
|
+
T(() => {
|
|
895
734
|
if (!r) return a();
|
|
896
|
-
i(
|
|
735
|
+
i(lt(Q(), r));
|
|
897
736
|
}, [r]);
|
|
898
737
|
let { history: o } = t, { memory: s } = t.session;
|
|
899
|
-
|
|
738
|
+
T(() => {
|
|
900
739
|
if (!r || !t.restored) return;
|
|
901
|
-
let e = setTimeout(() =>
|
|
740
|
+
let e = setTimeout(() => ut(Q(), r, {
|
|
902
741
|
history: o,
|
|
903
742
|
memory: s
|
|
904
|
-
}),
|
|
743
|
+
}), dt);
|
|
905
744
|
return () => clearTimeout(e);
|
|
906
745
|
}, [
|
|
907
746
|
r,
|
|
@@ -912,8 +751,8 @@ function St(e, t, n) {
|
|
|
912
751
|
}
|
|
913
752
|
//#endregion
|
|
914
753
|
//#region lib/components/ui/widgets/calculator/use-calculator-pos.ts
|
|
915
|
-
function
|
|
916
|
-
let { vatRates: a, denominations: o, pricesIncludeVat: s, currency: c } = e, l = c ?
|
|
754
|
+
function pt(e, t, n, r, i) {
|
|
755
|
+
let { vatRates: a, denominations: o, pricesIncludeVat: s, currency: c } = e, l = c ? he(c) : 2, u = (a ?? []).join(" "), d = (o ?? []).join(" "), f = D(() => ({
|
|
917
756
|
currency: c,
|
|
918
757
|
digits: l,
|
|
919
758
|
rates: u === "" ? [] : u.split(" "),
|
|
@@ -923,7 +762,7 @@ function Ct(e, t, n, r, i) {
|
|
|
923
762
|
l,
|
|
924
763
|
u,
|
|
925
764
|
s
|
|
926
|
-
]), p =
|
|
765
|
+
]), p = D(() => ({
|
|
927
766
|
locale: t,
|
|
928
767
|
denominations: d === "" ? [] : d.split(" ")
|
|
929
768
|
}), [t, d]);
|
|
@@ -931,14 +770,14 @@ function Ct(e, t, n, r, i) {
|
|
|
931
770
|
props: e,
|
|
932
771
|
env: f,
|
|
933
772
|
format: p,
|
|
934
|
-
view:
|
|
773
|
+
view: D(() => r ? h("pos")?.selectPos?.(n, f, p.denominations, t) ?? null : null, [
|
|
935
774
|
r,
|
|
936
775
|
n,
|
|
937
776
|
f,
|
|
938
777
|
p,
|
|
939
778
|
t
|
|
940
779
|
]),
|
|
941
|
-
dispatch:
|
|
780
|
+
dispatch: w((e) => i({
|
|
942
781
|
action: e,
|
|
943
782
|
env: f,
|
|
944
783
|
format: p
|
|
@@ -951,12 +790,12 @@ function Ct(e, t, n, r, i) {
|
|
|
951
790
|
}
|
|
952
791
|
//#endregion
|
|
953
792
|
//#region lib/components/ui/widgets/calculator/use-calculator-press.ts
|
|
954
|
-
var
|
|
955
|
-
function
|
|
793
|
+
var mt = 0, ht = () => `${Date.now().toString(36)}-${(mt++).toString(36)}`;
|
|
794
|
+
function gt(e) {
|
|
956
795
|
let { actions: t, feel: n, settings: r, isPos: i, dispatchPos: a, t: o } = e;
|
|
957
|
-
return
|
|
958
|
-
if (r.programmer &&
|
|
959
|
-
let e =
|
|
796
|
+
return w((e) => {
|
|
797
|
+
if (r.programmer && S(e, r.programmer.base)) {
|
|
798
|
+
let e = h("programmer")?.refused?.(r.programmer.base, o);
|
|
960
799
|
e && t.announce(e);
|
|
961
800
|
return;
|
|
962
801
|
}
|
|
@@ -966,7 +805,7 @@ function Et(e) {
|
|
|
966
805
|
}) : t.press({
|
|
967
806
|
key: e,
|
|
968
807
|
settings: r,
|
|
969
|
-
id:
|
|
808
|
+
id: ht()
|
|
970
809
|
});
|
|
971
810
|
}, [
|
|
972
811
|
t,
|
|
@@ -979,26 +818,26 @@ function Et(e) {
|
|
|
979
818
|
}
|
|
980
819
|
//#endregion
|
|
981
820
|
//#region lib/components/ui/widgets/calculator/use-calculator-tape.ts
|
|
982
|
-
function
|
|
821
|
+
function _t(e, t, n) {
|
|
983
822
|
return !e || !t || t.getClientRects().length === 0 ? !1 : (n(), t.focus(), !0);
|
|
984
823
|
}
|
|
985
|
-
function
|
|
824
|
+
function vt(e, t, n, r) {
|
|
986
825
|
t && n && e?.(n, r);
|
|
987
826
|
}
|
|
988
|
-
function
|
|
989
|
-
let n =
|
|
990
|
-
return
|
|
827
|
+
function yt(e, t) {
|
|
828
|
+
let n = O(null), r = O(null), i = O(!1);
|
|
829
|
+
return T(() => {
|
|
991
830
|
e && !i.current && r.current?.focus(), i.current = e;
|
|
992
831
|
}, [e]), {
|
|
993
832
|
toggleRef: n,
|
|
994
833
|
tapeRef: r,
|
|
995
|
-
closeTapeOverlay:
|
|
834
|
+
closeTapeOverlay: w(() => _t(e, n.current, t), [t, e])
|
|
996
835
|
};
|
|
997
836
|
}
|
|
998
|
-
function
|
|
999
|
-
let i =
|
|
1000
|
-
i.current = e,
|
|
1001
|
-
|
|
837
|
+
function $(e, { justEvaluated: t, result: n, expression: r }) {
|
|
838
|
+
let i = O(e);
|
|
839
|
+
i.current = e, T(() => {
|
|
840
|
+
vt(i.current, t, n, r);
|
|
1002
841
|
}, [
|
|
1003
842
|
t,
|
|
1004
843
|
n,
|
|
@@ -1007,28 +846,28 @@ function At(e, { justEvaluated: t, result: n, expression: r }) {
|
|
|
1007
846
|
}
|
|
1008
847
|
//#endregion
|
|
1009
848
|
//#region lib/components/ui/widgets/calculator/use-calculator-value.ts
|
|
1010
|
-
function
|
|
1011
|
-
let t = e === void 0 ? void 0 :
|
|
1012
|
-
if (!t) return
|
|
1013
|
-
let n =
|
|
849
|
+
function bt(e) {
|
|
850
|
+
let t = e === void 0 ? void 0 : L(e.trim());
|
|
851
|
+
if (!t) return j;
|
|
852
|
+
let n = z(t);
|
|
1014
853
|
return {
|
|
1015
|
-
...
|
|
854
|
+
...j,
|
|
1016
855
|
expression: n,
|
|
1017
856
|
result: n,
|
|
1018
857
|
ans: n,
|
|
1019
858
|
justEvaluated: !0
|
|
1020
859
|
};
|
|
1021
860
|
}
|
|
1022
|
-
function
|
|
1023
|
-
let n =
|
|
1024
|
-
n.current = e,
|
|
861
|
+
function xt(e, t) {
|
|
862
|
+
let n = O(e);
|
|
863
|
+
n.current = e, T(() => {
|
|
1025
864
|
n.current?.(t);
|
|
1026
865
|
}, [t]);
|
|
1027
866
|
}
|
|
1028
867
|
//#endregion
|
|
1029
868
|
//#region lib/components/ui/widgets/calculator/use-calculator-variant.ts
|
|
1030
|
-
function
|
|
1031
|
-
let n =
|
|
869
|
+
function St(e, t) {
|
|
870
|
+
let n = Pe(), r = (e.variants ?? n).filter((e) => n.includes(e)), i = e.variant ?? t, a = r.includes(i) ? i : r[0] ?? "standard", o = ke(a), s = D(() => Fe(a, o), [a, o]), c = D(() => Ie(s), [s]);
|
|
1032
871
|
return {
|
|
1033
872
|
variant: a,
|
|
1034
873
|
variants: r,
|
|
@@ -1036,11 +875,11 @@ function Nt(e, t) {
|
|
|
1036
875
|
accepts: (e) => c.has(e)
|
|
1037
876
|
};
|
|
1038
877
|
}
|
|
1039
|
-
function
|
|
878
|
+
function Ct(e, t, n, r) {
|
|
1040
879
|
e !== t && (n(e), r?.(e));
|
|
1041
880
|
}
|
|
1042
|
-
function
|
|
1043
|
-
return
|
|
881
|
+
function wt(e, t, n) {
|
|
882
|
+
return w((r) => Ct(r, e, t, n), [
|
|
1044
883
|
e,
|
|
1045
884
|
t,
|
|
1046
885
|
n
|
|
@@ -1048,9 +887,9 @@ function Ft(e, t, n) {
|
|
|
1048
887
|
}
|
|
1049
888
|
//#endregion
|
|
1050
889
|
//#region lib/components/ui/widgets/calculator/use-engine-settings.ts
|
|
1051
|
-
function
|
|
890
|
+
function Tt(e, t, n, r) {
|
|
1052
891
|
let { percent: i, precision: a, rounding: o } = e, { angle: s, notation: c } = n, l = r.scientific === !0, u = r.programmer ? n.programmer : void 0;
|
|
1053
|
-
return
|
|
892
|
+
return D(() => ({
|
|
1054
893
|
locale: t,
|
|
1055
894
|
percent: i ?? (l ? "literal" : "contextual"),
|
|
1056
895
|
precision: a,
|
|
@@ -1072,29 +911,29 @@ function It(e, t, n, r) {
|
|
|
1072
911
|
}
|
|
1073
912
|
//#endregion
|
|
1074
913
|
//#region lib/components/ui/widgets/calculator/use-calculator.ts
|
|
1075
|
-
function
|
|
1076
|
-
let { language: t, t: n } = o(), r = e.locale ?? t, [i, a] =
|
|
914
|
+
function Et(e) {
|
|
915
|
+
let { language: t, t: n } = o(), r = e.locale ?? t, [i, a] = l(X, {
|
|
1077
916
|
variant: e.defaultVariant ?? "standard",
|
|
1078
917
|
programmer: se(e),
|
|
1079
|
-
session:
|
|
1080
|
-
}), s =
|
|
1081
|
-
|
|
1082
|
-
let
|
|
918
|
+
session: bt(e.defaultValue)
|
|
919
|
+
}), s = St(e, i.variant), c = Tt(e, r, i, s.definition), u = at(e.feedback);
|
|
920
|
+
ft(e.persist, i, a);
|
|
921
|
+
let d = D(() => Ke(i, c), [i, c]), f = et(d.value, r, a, c.programmer), p = s.variant === "pos" && !s.definition.pending, m = pt(e, r, i.pos, p, a.pos), h = tt(e), g = gt({
|
|
1083
922
|
actions: a,
|
|
1084
|
-
feel:
|
|
923
|
+
feel: u,
|
|
1085
924
|
settings: c,
|
|
1086
925
|
isPos: p,
|
|
1087
926
|
dispatchPos: m.dispatch,
|
|
1088
927
|
t: n
|
|
1089
|
-
}), _ =
|
|
1090
|
-
return
|
|
928
|
+
}), _ = wt(s.variant, a.setVariant, e.onVariantChange), { toggleRef: v, tapeRef: y, closeTapeOverlay: b } = yt(i.tapeOpen, () => a.toggleTape(!1));
|
|
929
|
+
return $(e.onResult, i.session), xt(e.onValueChange, d.value), {
|
|
1091
930
|
state: i,
|
|
1092
931
|
...s,
|
|
1093
932
|
locale: r,
|
|
1094
933
|
conversion: h,
|
|
1095
934
|
currency: e.currency,
|
|
1096
|
-
display:
|
|
1097
|
-
hasMemory:
|
|
935
|
+
display: d,
|
|
936
|
+
hasMemory: qe(i),
|
|
1098
937
|
press: g,
|
|
1099
938
|
setVariant: _,
|
|
1100
939
|
setAngle: a.setAngle,
|
|
@@ -1122,53 +961,15 @@ function Lt(e) {
|
|
|
1122
961
|
};
|
|
1123
962
|
}
|
|
1124
963
|
//#endregion
|
|
1125
|
-
//#region lib/components/ui/widgets/calculator/calculator-keyboard.ts
|
|
1126
|
-
var Rt = /* @__PURE__ */ new Set([
|
|
1127
|
-
"INPUT",
|
|
1128
|
-
"TEXTAREA",
|
|
1129
|
-
"SELECT"
|
|
1130
|
-
]);
|
|
1131
|
-
function zt(e) {
|
|
1132
|
-
return e ? Rt.has(e.tagName?.toUpperCase() ?? "") || e.isContentEditable === !0 : !1;
|
|
1133
|
-
}
|
|
1134
|
-
function Bt(e, t) {
|
|
1135
|
-
if (e.defaultPrevented) return null;
|
|
1136
|
-
let n = e.target;
|
|
1137
|
-
if (t.global && zt(n) || e.key === "Enter" && n?.closest?.("button")) return null;
|
|
1138
|
-
let r = P(e, {
|
|
1139
|
-
locale: t.locale,
|
|
1140
|
-
programmer: t.programmer
|
|
1141
|
-
});
|
|
1142
|
-
return r === null ? null : r === "copy" ? t.hasSelection?.() ? null : r : r === "paste" ? null : t.accepts(r) ? r : null;
|
|
1143
|
-
}
|
|
1144
|
-
//#endregion
|
|
1145
|
-
//#region lib/components/ui/widgets/calculator/use-calculator-keyboard.ts
|
|
1146
|
-
var Vt = () => (globalThis.getSelection?.()?.toString() ?? "") !== "";
|
|
1147
|
-
function Ht(e) {
|
|
1148
|
-
let t = u(e), n = S((e) => {
|
|
1149
|
-
let { locale: n, accepts: r, global: i, programmer: a, onKey: o, onCopy: s, beforeKey: c } = t.current;
|
|
1150
|
-
if (!e.defaultPrevented && c?.(e)) return e.preventDefault();
|
|
1151
|
-
let l = Bt(e, {
|
|
1152
|
-
locale: n,
|
|
1153
|
-
accepts: r,
|
|
1154
|
-
global: i,
|
|
1155
|
-
programmer: a,
|
|
1156
|
-
hasSelection: Vt
|
|
1157
|
-
});
|
|
1158
|
-
l !== null && (e.preventDefault(), l === "copy" ? s() : l !== "paste" && o(l));
|
|
1159
|
-
}, [t]);
|
|
1160
|
-
return l("keydown", S((e) => n(e), [n]), e.global && typeof window < "u" ? window : null), S((e) => n(e), [n]);
|
|
1161
|
-
}
|
|
1162
|
-
//#endregion
|
|
1163
964
|
//#region lib/components/ui/widgets/calculator/calculator.tsx
|
|
1164
|
-
function
|
|
1165
|
-
let r =
|
|
1166
|
-
return /* @__PURE__ */
|
|
965
|
+
function Dt({ className: e, "aria-label": t, ...n }) {
|
|
966
|
+
let r = Et(n);
|
|
967
|
+
return /* @__PURE__ */ k(p, {
|
|
1167
968
|
value: r,
|
|
1168
|
-
children: /* @__PURE__ */
|
|
969
|
+
children: /* @__PURE__ */ k(Be, {
|
|
1169
970
|
className: e,
|
|
1170
971
|
"aria-label": t,
|
|
1171
|
-
onKeyDown:
|
|
972
|
+
onKeyDown: re({
|
|
1172
973
|
locale: r.locale,
|
|
1173
974
|
accepts: r.accepts,
|
|
1174
975
|
programmer: r.definition.programmer,
|
|
@@ -1186,4 +987,4 @@ function Ut({ className: e, "aria-label": t, ...n }) {
|
|
|
1186
987
|
});
|
|
1187
988
|
}
|
|
1188
989
|
//#endregion
|
|
1189
|
-
export { K as n,
|
|
990
|
+
export { K as n, Dt as t };
|