@nxgt/material 3.75.0 → 3.76.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 +40 -0
- package/README.md +37 -1
- package/dist/{alert-dialog-BfO_ri-N.js → alert-dialog-653apk3f.js} +8 -7
- package/dist/{async-slice-roMAJVzG.js → async-slice-CXLbQuOc.js} +1 -1
- package/dist/{bubble-input-B7BVd9fX.js → bubble-input-CQwVSoU3.js} +30 -29
- package/dist/{button-DgenqmpS.js → button-3op3rtZh.js} +5 -4
- package/dist/calculator-BaSMe0SK.js +1189 -0
- package/dist/calculator-announce-DRd2c6Dq.js +89 -0
- package/dist/calculator-context-BugcKuVG.js +10 -0
- package/dist/calculator-field.js +172 -0
- package/dist/calculator-panel-announce-AZSnZUSr.js +29 -0
- package/dist/calculator-segment-BlJE1LaS.js +22 -0
- package/dist/calculator.js +2 -0
- package/dist/charts.js +3 -3
- package/dist/{chip-CiDczNxO.js → chip-MuKDwtkG.js} +2 -2
- package/dist/{code-editor-CohlhFsA.js → code-editor-Bp2RrdNx.js} +13 -13
- package/dist/code-editor.js +37 -37
- package/dist/{code-language-items-Cs8GLYDp.js → code-language-items-B7WR5ua_.js} +19 -24
- package/dist/components/base-content.css +9 -4
- package/dist/components/ui/collections/server-table/server-table-phone-row.css +10 -3
- package/dist/{components-zJdfH4im.js → components-Ci3Zo8kC.js} +15837 -17245
- package/dist/components.js +37 -28
- package/dist/conversion-variant-BDFAxqe9.js +529 -0
- package/dist/copy-to-clipboard-Be5Ffvs_.js +7 -0
- package/dist/currency-B-r3ig11.js +16 -0
- package/dist/currency-field-BJ9rSrif.js +285 -0
- package/dist/{number.utils-BG_eEt5g.js → date.utils-DUvqcjan.js} +1 -7
- package/dist/dialog-Bm5LvVlB.js +166 -0
- package/dist/dist-BZe2evxL.js +139 -0
- package/dist/dist-CxhKjOYm.js +28 -0
- package/dist/dist-DHdUUM1w.js +241 -0
- package/dist/{dist-C4wtXCjf.js → dist-DOK3zo5C.js} +33 -32
- package/dist/dist-DWZXlCZR.js +182 -0
- package/dist/dist-DkQbkF9T.js +33 -0
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-CzR6JP31.js → dropdown-menu-xlZ6NYUA.js} +160 -159
- package/dist/editor.js +299 -298
- package/dist/{empty-state-DjHGMp5F.js → empty-state-C0kviQdW.js} +2 -2
- package/dist/{field-blur-CdASxjL7.js → field-blur-DkiZOVNV.js} +178 -180
- package/dist/{field-blur-context-kZ4SD7xu.js → field-blur-context-BLGgf_3z.js} +2 -2
- package/dist/financial-variant-BsZEa5sF.js +459 -0
- package/dist/{hooks-Dqq8O3Az.js → hooks-Dg94jPRq.js} +12 -12
- package/dist/hooks.js +2 -2
- package/dist/{hover-card-BPKqte4a.js → hover-card-B1g55Hi6.js} +44 -43
- package/dist/i18n.js +3 -3
- package/dist/icon-badge-BcW66bRk.js +17 -0
- package/dist/{icon-button-Cr-DyDGg.js → icon-button-Cogxy1cy.js} +5 -4
- package/dist/{in-dialog-Vwkyp-M5.js → in-dialog-D61Yeaol.js} +2 -1
- package/dist/input-CC2joTjB.js +56 -0
- package/dist/key-layout-cR79xfGE.js +38 -0
- package/dist/lib/calculator/index.d.ts +16 -0
- package/dist/lib/calculator-field/index.d.ts +12 -0
- package/dist/lib/components/ui/collections/filter/use-filter-field-config.d.ts +2 -2
- package/dist/lib/components/ui/feedback/moment/moment-body.d.ts +17 -2
- package/dist/lib/components/ui/feedback/moment/moment-passive.d.ts +13 -0
- package/dist/lib/components/ui/feedback/moment/moment.d.ts +16 -2
- package/dist/lib/components/ui/fields/calculator-field/apply-calculated.d.ts +17 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field-content.d.ts +16 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field-trigger.d.ts +4 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field.d.ts +12 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field.types.d.ts +31 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-form-field.d.ts +4 -0
- package/dist/lib/components/ui/fields/calculator-field/index.d.ts +3 -0
- package/dist/lib/components/ui/fields/calculator-field/use-calculator-field.d.ts +15 -0
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
- package/dist/lib/components/ui/fields/currency-field/currency-field.d.ts +7 -1
- package/dist/lib/components/ui/layout/app-shell/app-sidebar-context.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-announce.d.ts +27 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-clipboard.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-context.d.ts +49 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-feedback.d.ts +18 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-keyboard.d.ts +30 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-storage.d.ts +17 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-variant-steps.d.ts +16 -0
- package/dist/lib/components/ui/widgets/calculator/calculator.d.ts +11 -0
- package/dist/lib/components/ui/widgets/calculator/calculator.selectors.d.ts +23 -0
- package/dist/lib/components/ui/widgets/calculator/calculator.slice.d.ts +1881 -0
- package/dist/lib/components/ui/widgets/calculator/currency.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/engine.d.ts +22 -0
- package/dist/lib/components/ui/widgets/calculator/index.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-announcer.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-display.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-key.d.ts +17 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-keypad.d.ts +8 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-loading.d.ts +6 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-memory.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-announce.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-body.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-screen.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-segment.d.ts +21 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-shell.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-switcher.d.ts +5 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-tape.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-tools.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/partials/keypad-navigation.d.ts +24 -0
- package/dist/lib/components/ui/widgets/calculator/types.d.ts +102 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-clipboard.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-conversion.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-feedback.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-keyboard.d.ts +22 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-persistence.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-pos.d.ts +25 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-press.d.ts +26 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-tape.d.ts +29 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-value.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-variant.d.ts +23 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/use-engine-settings.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-fields.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-labels.d.ts +17 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-math.d.ts +31 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-names.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-panel.d.ts +7 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-rates.d.ts +29 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-result.d.ts +15 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-state.d.ts +36 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/use-conversion.d.ts +24 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-change.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-figures.d.ts +43 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-format.d.ts +12 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan-math.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-margin.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-math.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-panel.d.ts +7 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-parts.d.ts +35 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-table.d.ts +7 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-vat.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/key-layout.d.ts +51 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-announce.d.ts +16 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-aside.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-display.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-fields.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-layout.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-line.d.ts +6 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-names.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-state.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-tender.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket-data.d.ts +41 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket.d.ts +5 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-totals.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-types.d.ts +76 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-vat.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-view.d.ts +28 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-announce.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-base.d.ts +11 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-bitpad.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-display.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-layout.d.ts +6 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-names.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-readouts.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-reduce.d.ts +29 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-state.d.ts +22 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-toolbar.d.ts +5 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-word.d.ts +15 -0
- package/dist/lib/components/ui/widgets/calculator/variants/registry.d.ts +21 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-layout.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-names.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-toolbar.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/standard/standard-layout.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/variant-loader.d.ts +34 -0
- package/dist/lib/components/ui/widgets/calculator/variants/variant-logic.d.ts +40 -0
- package/dist/lib/components/ui/widgets/calculator/variants/variant-types.d.ts +62 -0
- package/dist/lib/i18n/resources/en/en.d.ts +412 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +412 -0
- package/dist/lib/i18n/resources/fr/fr.d.ts +412 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +412 -0
- package/dist/lib/i18n/resources/resources.d.ts +824 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib.js +4 -3
- package/dist/main.js +50 -40
- package/dist/map.js +66 -65
- package/dist/material.css +1 -1
- package/dist/native-select-w_FlBLHV.js +40 -0
- package/dist/number.utils-CSueQZcv.js +7 -0
- package/dist/pdf-reader.js +1 -1
- package/dist/percent-field-lahyDJDG.js +14 -0
- package/dist/picker-surface-CV09H7Nb.js +1220 -0
- package/dist/popover-Cd7DkND4.js +233 -0
- package/dist/pos-types-DKCkOTYy.js +49 -0
- package/dist/pos-variant-GrUfbTTP.js +603 -0
- package/dist/print.js +1 -1
- package/dist/programmer-variant-eKJNKENL.js +501 -0
- package/dist/programmer-word-CNCF7DJF.js +15 -0
- package/dist/{public-DC9VQw4Z.js → public-y6g4ddxd.js} +895 -892
- package/dist/{rich-code-block-DBSL9zEN.js → rich-code-block-CRQ0iyLb.js} +5 -5
- package/dist/scientific-variant-2y3UxAAU.js +149 -0
- package/dist/{sortable-provider-C4tk5esY.js → sortable-provider-DdiI3Fwk.js} +2 -2
- package/dist/{spinner-B2MubVWb.js → spinner-C1QIewWv.js} +133 -159
- package/dist/standard-layout-BuSRr3TY.js +40 -0
- package/dist/tabs-DzEqMb1W.js +383 -0
- package/dist/{icon-badge-B9uvDoyY.js → text-field-BAdY-kpO.js} +20 -34
- package/dist/theme-picker.js +3 -3
- package/dist/{theme-toggle-BInlu21G.js → theme-toggle-C_VeiiCm.js} +2 -2
- package/dist/toggle-FeCCJqbg.js +40 -0
- package/dist/{toggle-group-DXXlqid2.js → toggle-group-CVMxEpWi.js} +1 -1
- package/dist/{toolbar-items-CRJSx1MU.js → toolbar-items-D310xDuM.js} +333 -554
- package/dist/{translate-material-pVlPJ1v4.js → translate-material-BypJJ1l5.js} +1 -1
- package/dist/{translator-BoYCward.js → translator-DJkf4J7t.js} +824 -0
- package/dist/{typography-B6YMbCge.js → typography-CYEquVeb.js} +1 -1
- package/dist/{use-chat-composer-BvWQogJe.js → use-chat-composer-DMXu9E1O.js} +4198 -4600
- package/dist/{use-heading-spy-B_Z4ArDh.js → use-heading-spy-DJR8YYm6.js} +19 -19
- package/dist/{use-material-translation-CIS2n3RB.js → use-material-translation-CD6QoVal.js} +1 -1
- package/dist/{use-return-focus-DNQtADAR.js → use-return-focus-Cevw_6yq.js} +106 -105
- package/dist/useLatest-C2PnQEeD.js +8 -0
- package/docs/README.md +1 -0
- package/docs/components/feedback-and-status.md +10 -1
- package/docs/components/form-fields.md +1 -0
- package/docs/components/rich-widgets.md +108 -0
- package/docs/getting-started.md +1 -0
- package/docs/guides/calculator.md +468 -0
- package/docs/guides/forms.md +4 -2
- package/docs/guides/i18n.md +5 -0
- package/docs/previews/rich-widgets-calculator-conversion.webp +0 -0
- package/docs/previews/rich-widgets-calculator-point-of-sale.webp +0 -0
- package/docs/previews/rich-widgets-calculator.webp +0 -0
- package/docs/roadmap.md +9 -3
- package/docs/troubleshooting.md +134 -0
- package/lib/components/base-content.css +9 -4
- package/lib/components/ui/collections/server-table/server-table-phone-row.css +10 -3
- package/lib/components/ui/widgets/calculator/calculator-bands.css +146 -0
- package/lib/components/ui/widgets/calculator/calculator-display.css +83 -0
- package/lib/components/ui/widgets/calculator/calculator-keys.css +118 -0
- package/lib/components/ui/widgets/calculator/calculator-pos-ticket.css +185 -0
- package/lib/components/ui/widgets/calculator/calculator-pos.css +38 -0
- package/lib/components/ui/widgets/calculator/calculator-tape.css +71 -0
- package/lib/components/ui/widgets/calculator/calculator.css +97 -0
- package/lib/components/ui/widgets/calculator/variants/conversion/conversion.css +98 -0
- package/lib/components/ui/widgets/calculator/variants/financial/financial.css +162 -0
- package/lib/components/ui/widgets/calculator/variants/programmer/programmer.css +162 -0
- package/package.json +17 -3
- package/dist/dialog-AGsB3bv4.js +0 -219
- package/dist/dist-B7RjY7SL.js +0 -158
- package/dist/dist-lmHmz_bu.js +0 -419
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CalcSession } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { Base, WordSize } from '@nxgt/material-core/calculator/programmer';
|
|
3
|
+
import { Announcement } from '../../calculator-announce.js';
|
|
4
|
+
import { ProgrammerState } from './programmer-state.js';
|
|
5
|
+
/** What the chrome can do: change the base or the word, flip one bit. */
|
|
6
|
+
export type ProgrammerAction = {
|
|
7
|
+
type: 'base';
|
|
8
|
+
base: Base;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'size';
|
|
11
|
+
size: WordSize;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'signed';
|
|
14
|
+
signed: boolean;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'bit';
|
|
17
|
+
index: number;
|
|
18
|
+
};
|
|
19
|
+
export type ProgrammerStep = {
|
|
20
|
+
programmer: ProgrammerState;
|
|
21
|
+
session: CalcSession;
|
|
22
|
+
announcement: Announcement | null;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* One chrome action. The number being edited follows: a new base rewrites it
|
|
26
|
+
* in that base, a narrower or re-signed word cuts it (and says so), a bit
|
|
27
|
+
* flips in the word's two's complement. Pure; strings and numbers only.
|
|
28
|
+
*/
|
|
29
|
+
export declare function reduceProgrammer(session: CalcSession, p: ProgrammerState, action: ProgrammerAction): ProgrammerStep;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CalcSession } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { Base, Word } from '@nxgt/material-core/calculator/programmer';
|
|
3
|
+
import { ProgrammerState } from './programmer-word.js';
|
|
4
|
+
export { aboveBase, INITIAL_PROGRAMMER, type ProgrammerState, startingWord, } from './programmer-word.js';
|
|
5
|
+
export declare const wordOf: (p: ProgrammerState) => Word;
|
|
6
|
+
/** The `calculate` / `press` options of `p`. */
|
|
7
|
+
export declare const programmerEngine: (p: ProgrammerState) => import('@nxgt/material-core/calculator').CalcOptions;
|
|
8
|
+
/** The expression without the operator the user is about to follow with a number. */
|
|
9
|
+
export declare const withoutOperator: (expression: string) => string;
|
|
10
|
+
/** The canonical integer text as a bigint; `undefined` when it is not one. */
|
|
11
|
+
export declare const toBigInt: (canonical: string) => bigint | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The value the display stands for: the last result, or what the expression
|
|
14
|
+
* calculates now; `undefined` while it does not calculate (or is empty).
|
|
15
|
+
*/
|
|
16
|
+
export declare function sessionValue(session: CalcSession, p: ProgrammerState): bigint | undefined;
|
|
17
|
+
/** `value` as the digits the keys type in `base` (no grouping, lower case). */
|
|
18
|
+
export declare const typedIn: (value: bigint, base: Base, word: Word) => string;
|
|
19
|
+
/** `value` as it is read: upper case, grouped. */
|
|
20
|
+
export declare const readIn: (value: bigint, base: Base, word: Word) => string;
|
|
21
|
+
/** The session holding `value` as the number being edited. */
|
|
22
|
+
export declare function holding(session: CalcSession, value: bigint, p: ProgrammerState): CalcSession;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Base, WordSize } from '@nxgt/material-core/calculator/programmer';
|
|
2
|
+
/** The Programmer variant's chrome: the base the keys type in, and the word. */
|
|
3
|
+
export type ProgrammerState = {
|
|
4
|
+
readonly base: Base;
|
|
5
|
+
readonly size: WordSize;
|
|
6
|
+
readonly signed: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const INITIAL_PROGRAMMER: ProgrammerState;
|
|
9
|
+
/** The word the props start with. */
|
|
10
|
+
export declare const startingWord: (props: {
|
|
11
|
+
defaultWordSize?: WordSize;
|
|
12
|
+
defaultSigned?: boolean;
|
|
13
|
+
}) => ProgrammerState;
|
|
14
|
+
/** A digit key above the base: `9` in octal, `a` in decimal. */
|
|
15
|
+
export declare function aboveBase(key: string, base: Base): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CalcKey } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { CalculatorMessage, CalculatorVariant } from '../types.js';
|
|
3
|
+
import { loadedPart } from './variant-loader.js';
|
|
4
|
+
import { VariantDefinition } from './variant-types.js';
|
|
5
|
+
export type { VariantDefinition } from './variant-types.js';
|
|
6
|
+
/**
|
|
7
|
+
* The variants and their labels. Light on purpose: only Standard has its keys
|
|
8
|
+
* here; the others bring theirs when their chunk loads (`variant-loader`).
|
|
9
|
+
*/
|
|
10
|
+
export declare const VARIANT_LABELS: Readonly<Record<CalculatorVariant, CalculatorMessage>>;
|
|
11
|
+
/** The variants that exist now, in the order of `CALCULATOR_VARIANTS`. */
|
|
12
|
+
export declare function availableVariants(): readonly CalculatorVariant[];
|
|
13
|
+
/**
|
|
14
|
+
* The definition of `id` from what is loaded: a variant whose chunk has not
|
|
15
|
+
* arrived (or failed) is a `pending` one, with no keys and no body of its own.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveDefinition(id: CalculatorVariant, entry: ReturnType<typeof loadedPart>): VariantDefinition;
|
|
18
|
+
/** The definition of `id` as loaded now (see `resolveDefinition`). */
|
|
19
|
+
export declare const variantDefinition: (id: CalculatorVariant) => VariantDefinition;
|
|
20
|
+
/** The keys `definition` takes: its keypad's, and its extras. */
|
|
21
|
+
export declare function acceptedKeys(definition: VariantDefinition): ReadonlySet<CalcKey>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** The spoken names of the scientific keys: `material.calculator.keys.<name>`. */
|
|
2
|
+
export declare const SCIENTIFIC_NAMES: readonly ["sine", "cosine", "tangent", "arcsine", "arccosine", "arctangent", "sinh", "cosh", "tanh", "arsinh", "arcosh", "artanh", "ln", "log", "log2", "ten-power", "exp", "abs", "square", "power", "sqrt", "root", "factorial", "reciprocal", "pi", "euler", "exponent", "modulo", "separator", "answer"];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CalculatorVariant } from '../types.js';
|
|
2
|
+
import { VariantLogic } from './variant-logic.js';
|
|
3
|
+
import { VariantPart } from './variant-types.js';
|
|
4
|
+
/** What a variant's chunk exports: its part of the definition, and its logic. */
|
|
5
|
+
export type VariantModule = {
|
|
6
|
+
readonly part: VariantPart;
|
|
7
|
+
readonly logic?: VariantLogic;
|
|
8
|
+
};
|
|
9
|
+
type Loader = () => Promise<{
|
|
10
|
+
variant: VariantModule;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Every variant but Standard is its own chunk, fetched the first time it is
|
|
14
|
+
* shown (by the `variant` prop, `defaultVariant`, or the switcher). Its UI and
|
|
15
|
+
* its `@nxgt/material-core/calculator/*` engine come in with it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const VARIANT_LOADERS: Partial<Record<CalculatorVariant, Loader>>;
|
|
18
|
+
declare const FAILED = "failed";
|
|
19
|
+
type Entry = VariantPart | typeof FAILED;
|
|
20
|
+
/** Loads `id` (once); resolves when its part and logic are in place, even on failure. */
|
|
21
|
+
export declare function loadVariant(id: CalculatorVariant): Promise<void>;
|
|
22
|
+
/** The loaded part of `id`, `'failed'` after a failure, `undefined` while it loads. */
|
|
23
|
+
export declare const loadedPart: (id: CalculatorVariant) => Entry | undefined;
|
|
24
|
+
/** Listens to the store like a component does. Tests only. */
|
|
25
|
+
export declare const subscribeForTest: (listener: () => void) => () => void;
|
|
26
|
+
/**
|
|
27
|
+
* The part of `id`, loading it on first use. The server and the hydration pass
|
|
28
|
+
* see `undefined` (the loading state), so the markup matches; a part already
|
|
29
|
+
* loaded by another calculator shows right after.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useVariantPart(id: CalculatorVariant): Entry | undefined;
|
|
32
|
+
/** Forgets what was loaded, so a test can watch a variant arrive again. Tests only. */
|
|
33
|
+
export declare function resetVariantsForTest(): void;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CalcOptions } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { DisplayModel } from '../calculator.selectors.js';
|
|
3
|
+
import { CalculatorState } from '../calculator.slice.js';
|
|
4
|
+
import { EngineSettings } from '../engine.js';
|
|
5
|
+
import { CalculatorVariant } from '../types.js';
|
|
6
|
+
import { announcePos } from './pos/pos-announce.js';
|
|
7
|
+
import { reducePos } from './pos/pos-state.js';
|
|
8
|
+
import { selectPos } from './pos/pos-view.js';
|
|
9
|
+
import { programmerResult, unavailableDigit } from './programmer/programmer-announce.js';
|
|
10
|
+
import { reduceProgrammer } from './programmer/programmer-reduce.js';
|
|
11
|
+
import { ProgrammerState } from './programmer/programmer-word.js';
|
|
12
|
+
/**
|
|
13
|
+
* What a variant adds to the shared pipeline (engine options, display, copy,
|
|
14
|
+
* announcements, reducers). A variant loaded on demand registers its logic
|
|
15
|
+
* when its code arrives; until then the pipeline behaves as Standard, which is
|
|
16
|
+
* all a variant that is not shown can need.
|
|
17
|
+
*/
|
|
18
|
+
export type VariantLogic = {
|
|
19
|
+
/** The engine options of the variant, on top of the shared `base`. */
|
|
20
|
+
options?: (base: CalcOptions, settings: EngineSettings) => CalcOptions;
|
|
21
|
+
/** Another display model than the expression and the result. */
|
|
22
|
+
display?: (state: CalculatorState, settings: EngineSettings) => DisplayModel;
|
|
23
|
+
/** The result announcement, with the value written as the variant shows it. */
|
|
24
|
+
said?: typeof programmerResult;
|
|
25
|
+
/** The text Copy writes for a canonical `value`, or `undefined`. */
|
|
26
|
+
copy?: (value: string, p: ProgrammerState) => string | undefined;
|
|
27
|
+
/** What a digit refused by the base says. */
|
|
28
|
+
refused?: typeof unavailableDigit;
|
|
29
|
+
/** One Programmer action: the state it changes. */
|
|
30
|
+
reduce?: typeof reduceProgrammer;
|
|
31
|
+
/** The point-of-sale ticket: its reducer, announcements and view. */
|
|
32
|
+
reducePos?: typeof reducePos;
|
|
33
|
+
announcePos?: typeof announcePos;
|
|
34
|
+
selectPos?: typeof selectPos;
|
|
35
|
+
};
|
|
36
|
+
export declare const registerVariantLogic: (id: CalculatorVariant, logic: VariantLogic) => void;
|
|
37
|
+
/** The logic of `id` once its code is loaded; `undefined` before. */
|
|
38
|
+
export declare const logicOf: (id: CalculatorVariant) => VariantLogic | undefined;
|
|
39
|
+
/** Drops every registered logic. Tests only. */
|
|
40
|
+
export declare const resetVariantLogic: () => void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CalcKey } from '@nxgt/material-core/calculator';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import { CalculatorMessage, CalculatorVariant } from '../types.js';
|
|
4
|
+
import { KeyLayout } from './key-layout.js';
|
|
5
|
+
export type VariantBase = {
|
|
6
|
+
readonly id: CalculatorVariant;
|
|
7
|
+
readonly label: CalculatorMessage;
|
|
8
|
+
};
|
|
9
|
+
/** A variant on the shared display and keypad. */
|
|
10
|
+
export type KeypadVariant = VariantBase & {
|
|
11
|
+
readonly layout: KeyLayout;
|
|
12
|
+
/** Keys the physical keyboard takes beyond the ones on the keypad. */
|
|
13
|
+
readonly extraKeys: readonly CalcKey[];
|
|
14
|
+
/** Calculates with the scientific functions and constants. */
|
|
15
|
+
readonly scientific?: boolean;
|
|
16
|
+
/** Calculates in a word of 8 to 64 bits (bitwise operators, a base per digit). */
|
|
17
|
+
readonly programmer?: boolean;
|
|
18
|
+
/** Controls above the keys (angle unit, 2nd, notation). */
|
|
19
|
+
readonly toolbar?: ComponentType;
|
|
20
|
+
/** Another display than the expression and the result (point of sale). */
|
|
21
|
+
readonly display?: ComponentType;
|
|
22
|
+
/** Beside the keypad (below on a phone), in place of the tape (point of sale). */
|
|
23
|
+
readonly aside?: ComponentType;
|
|
24
|
+
readonly panel?: undefined;
|
|
25
|
+
readonly pending?: undefined;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A variant with a body of its own, in place of the display, the keypad and
|
|
29
|
+
* the tape (the Financial forms). It has no keys: the engine keys, the paste
|
|
30
|
+
* and the global keyboard do not reach it. POS and Programmer keep the keypad
|
|
31
|
+
* and add a `toolbar` instead.
|
|
32
|
+
*/
|
|
33
|
+
export type PanelVariant = VariantBase & {
|
|
34
|
+
readonly panel: ComponentType;
|
|
35
|
+
readonly layout?: undefined;
|
|
36
|
+
readonly extraKeys?: undefined;
|
|
37
|
+
readonly scientific?: undefined;
|
|
38
|
+
readonly programmer?: undefined;
|
|
39
|
+
readonly toolbar?: undefined;
|
|
40
|
+
readonly display?: undefined;
|
|
41
|
+
readonly aside?: undefined;
|
|
42
|
+
readonly pending?: undefined;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* A variant whose code is still loading (or failed to load): no keys, no body
|
|
46
|
+
* of its own; the shell shows a loading state in its place.
|
|
47
|
+
*/
|
|
48
|
+
export type PendingVariant = VariantBase & {
|
|
49
|
+
readonly pending: 'loading' | 'failed';
|
|
50
|
+
readonly layout?: undefined;
|
|
51
|
+
readonly extraKeys?: undefined;
|
|
52
|
+
readonly scientific?: undefined;
|
|
53
|
+
readonly programmer?: undefined;
|
|
54
|
+
readonly toolbar?: undefined;
|
|
55
|
+
readonly display?: undefined;
|
|
56
|
+
readonly aside?: undefined;
|
|
57
|
+
readonly panel?: undefined;
|
|
58
|
+
};
|
|
59
|
+
/** What a variant brings to the shell. */
|
|
60
|
+
export type VariantDefinition = KeypadVariant | PanelVariant | PendingVariant;
|
|
61
|
+
/** A variant's definition without its id and label, which stay in the registry. */
|
|
62
|
+
export type VariantPart = Omit<KeypadVariant, 'id' | 'label'> | Omit<PanelVariant, 'id' | 'label'>;
|