@pie-lib/math-input-mathlive 2.0.1-next.20261109082044 → 2.0.1-next.20261109091947

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.
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/ar.ts
2
+ var e = { enterAnswerA11y: "إدخال الإجابة" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/cy.ts
2
+ var e = { enterAnswerA11y: "Rhowch ateb" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/en-AU.ts
2
+ var e = { enterAnswerA11y: "Enter answer" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/en-GB.ts
2
+ var e = { enterAnswerA11y: "Enter answer" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,6 @@
1
+ /** The interface strings `@pie-lib/math-input-mathlive` renders; the source for every other locale. */
2
+ declare const _default: {
3
+ /** Accessible name of a `<math-field>` and of the keyboard input inside it. */
4
+ enterAnswerA11y: string;
5
+ };
6
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/en-US.ts
2
+ var e = { enterAnswerA11y: "Enter answer" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/es.ts
2
+ var e = { enterAnswerA11y: "Escribe la respuesta" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/fr.ts
2
+ var e = { enterAnswerA11y: "Saisir la réponse" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,3 @@
1
+ export declare const catalogs: import("@pie-element/shared-i18n").Catalogs<{
2
+ enterAnswerA11y: string;
3
+ }>;
@@ -0,0 +1,67 @@
1
+ import e from "./en-US.js";
2
+ import { defineCatalogs as t } from "@pie-element/shared-i18n";
3
+ //#region src/i18n/index.ts
4
+ var n = t({
5
+ packageName: "@pie-lib/math-input-mathlive",
6
+ source: e,
7
+ loaders: {
8
+ es: () => import(
9
+ /* webpackMode: "eager" */
10
+ "./es.js"
11
+ ),
12
+ "th-TH": () => import(
13
+ /* webpackMode: "eager" */
14
+ "./th-TH.js"
15
+ ),
16
+ "en-GB": () => import(
17
+ /* webpackMode: "eager" */
18
+ "./en-GB.js"
19
+ ),
20
+ "en-AU": () => import(
21
+ /* webpackMode: "eager" */
22
+ "./en-AU.js"
23
+ ),
24
+ fr: () => import(
25
+ /* webpackMode: "eager" */
26
+ "./fr.js"
27
+ ),
28
+ ar: () => import(
29
+ /* webpackMode: "eager" */
30
+ "./ar.js"
31
+ ),
32
+ pt: () => import(
33
+ /* webpackMode: "eager" */
34
+ "./pt.js"
35
+ ),
36
+ ko: () => import(
37
+ /* webpackMode: "eager" */
38
+ "./ko.js"
39
+ ),
40
+ ja: () => import(
41
+ /* webpackMode: "eager" */
42
+ "./ja.js"
43
+ ),
44
+ zh: () => import(
45
+ /* webpackMode: "eager" */
46
+ "./zh.js"
47
+ ),
48
+ cy: () => import(
49
+ /* webpackMode: "eager" */
50
+ "./cy.js"
51
+ ),
52
+ sv: () => import(
53
+ /* webpackMode: "eager" */
54
+ "./sv.js"
55
+ ),
56
+ "nl-NL": () => import(
57
+ /* webpackMode: "eager" */
58
+ "./nl-NL.js"
59
+ ),
60
+ ro: () => import(
61
+ /* webpackMode: "eager" */
62
+ "./ro.js"
63
+ )
64
+ }
65
+ });
66
+ //#endregion
67
+ export { n as catalogs };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/ja.ts
2
+ var e = { enterAnswerA11y: "解答を入力" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/ko.ts
2
+ var e = { enterAnswerA11y: "답 입력" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/nl-NL.ts
2
+ var e = { enterAnswerA11y: "Antwoord invoeren" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/pt.ts
2
+ var e = { enterAnswerA11y: "Inserir resposta" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/ro.ts
2
+ var e = { enterAnswerA11y: "Introdu răspunsul" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/sv.ts
2
+ var e = { enterAnswerA11y: "Ange svar" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/th-TH.ts
2
+ var e = { enterAnswerA11y: "ป้อนคำตอบ" };
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ enterAnswerA11y: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ //#region src/i18n/zh.ts
2
+ var e = { enterAnswerA11y: "输入答案" };
3
+ //#endregion
4
+ export { e as default };
@@ -10,7 +10,10 @@
10
10
  * The field is a group around that textbox. With MathLive's own `math` role, which it sets
11
11
  * through ElementInternals, a focusable field holding a focusable textbox is a nested
12
12
  * interactive control.
13
+ *
14
+ * The name follows `language`. A locale that is not resident names the field in English and
15
+ * starts loading; `onLoad` runs once it settles, so a component passes its own relabel there.
13
16
  */
14
- export declare function labelMathField(mathField: Element | null | undefined, language?: string): void;
17
+ export declare function labelMathField(mathField: Element | null | undefined, language?: string, onLoad?: () => void): void;
15
18
  /** Points a `<math-field>` at the element that describes it, or drops the reference. */
16
19
  export declare function describeMathField(mathField: Element | null | undefined, describedBy?: string): void;
@@ -1,13 +1,12 @@
1
- import e from "@pie-lib/translator";
1
+ import { catalogs as e } from "../i18n/index.js";
2
2
  //#region src/mf/field-label.ts
3
- var { translator: t } = e;
4
- function n(e, n) {
5
- if (!e) return;
6
- let r = t.t("mathInput.enterAnswer", { lng: n });
7
- e.setAttribute("role", "group"), e.setAttribute("aria-label", r), e.shadowRoot?.querySelector(".ML__keyboard-sink")?.setAttribute("aria-label", r);
3
+ function t(t, n, r) {
4
+ if (!t) return;
5
+ let i = e.forLocale(n, r).t("enterAnswerA11y");
6
+ t.setAttribute("role", "group"), t.setAttribute("aria-label", i), t.shadowRoot?.querySelector(".ML__keyboard-sink")?.setAttribute("aria-label", i);
8
7
  }
9
- function r(e, t) {
8
+ function n(e, t) {
10
9
  e && (t ? e.setAttribute("aria-describedby", t) : e.removeAttribute("aria-describedby"));
11
10
  }
12
11
  //#endregion
13
- export { r as describeMathField, n as labelMathField };
12
+ export { n as describeMathField, t as labelMathField };
@@ -20,6 +20,8 @@ export declare class Input extends React.Component {
20
20
  readOnly: PropTypes.Requireable<boolean>;
21
21
  innerRef: PropTypes.Requireable<(...args: any[]) => any>;
22
22
  };
23
+ /** Renames the field once the language's catalog lands, for an element that did not preload it. */
24
+ relabel: () => void;
23
25
  constructor(props: any);
24
26
  componentDidMount(): Promise<void>;
25
27
  componentDidUpdate(prevProps: any): void;
package/dist/mf/input.js CHANGED
@@ -30,17 +30,18 @@ var _ = h("pie-lib:math-input-mathlive:input"), v = /([0-9])\\ (\\frac\{[^{}]*\}
30
30
  readOnly: p.bool,
31
31
  innerRef: p.func
32
32
  };
33
+ relabel = () => u(this.mathField, this.props.language);
33
34
  constructor(e) {
34
35
  super(e), this.holderRef = f.createRef(), this.lastEmitted = void 0;
35
36
  }
36
37
  async componentDidMount() {
37
38
  let e = this.mountGeneration = (this.mountGeneration || 0) + 1, t = await s();
38
- e === this.mountGeneration && t?.MathfieldElement && this.holderRef.current && !this.mathField && (this.mathField = o(t), u(this.mathField, this.props.language), l(this.mathField, this.props.ariaDescribedBy), this.mathField.value = r(this.props.latex || ""), this.props.readOnly && (this.mathField.readOnly = !0), this.mathField.mathVirtualKeyboardPolicy = "manual", this.mathField.mathModeSpace = "\\ ", this.mathField.smartSuperscript = !1, a(this.mathField), this.untrackCaret = c(this.mathField), this.untrackSelection = d(this.mathField), this.untrackLongDivision = i(this.mathField), this.mathField.addEventListener("input", this.onInputEdit), this.holderRef.current.replaceChildren(this.mathField), u(this.mathField, this.props.language), this.props.innerRef && this.props.innerRef(this), this.pendingFocus && (this.pendingFocus = !1, this.mathField.focus()));
39
+ e === this.mountGeneration && t?.MathfieldElement && this.holderRef.current && !this.mathField && (this.mathField = o(t), u(this.mathField, this.props.language, this.relabel), l(this.mathField, this.props.ariaDescribedBy), this.mathField.value = r(this.props.latex || ""), this.props.readOnly && (this.mathField.readOnly = !0), this.mathField.mathVirtualKeyboardPolicy = "manual", this.mathField.mathModeSpace = "\\ ", this.mathField.smartSuperscript = !1, a(this.mathField), this.untrackCaret = c(this.mathField), this.untrackSelection = d(this.mathField), this.untrackLongDivision = i(this.mathField), this.mathField.addEventListener("input", this.onInputEdit), this.holderRef.current.replaceChildren(this.mathField), u(this.mathField, this.props.language, this.relabel), this.props.innerRef && this.props.innerRef(this), this.pendingFocus && (this.pendingFocus = !1, this.mathField.focus()));
39
40
  }
40
41
  componentDidUpdate(e) {
41
42
  if (!this.mathField) return;
42
43
  let { latex: t, readOnly: n, language: i } = this.props;
43
- if (i !== e.language && u(this.mathField, i), this.props.ariaDescribedBy !== e.ariaDescribedBy && l(this.mathField, this.props.ariaDescribedBy), n !== e.readOnly && (this.mathField.readOnly = !!n), t != null && t !== this.lastEmitted) {
44
+ if (i !== e.language && u(this.mathField, i, this.relabel), this.props.ariaDescribedBy !== e.ariaDescribedBy && l(this.mathField, this.props.ariaDescribedBy), n !== e.readOnly && (this.mathField.readOnly = !!n), t != null && t !== this.lastEmitted) {
44
45
  let e = r(t);
45
46
  e !== this.mathField.value && (this.mathField.value = e);
46
47
  }
@@ -31,6 +31,8 @@ export default class Static extends React.Component {
31
31
  static defaultProps: {
32
32
  getFieldName: () => void;
33
33
  };
34
+ /** Renames the field once the language's catalog lands, for an element that did not preload it. */
35
+ relabel: () => void;
34
36
  constructor(props: any);
35
37
  componentDidMount(): void;
36
38
  /** Render display markup, or mount a live field when the latex has answer blocks. */
package/dist/mf/static.js CHANGED
@@ -35,6 +35,7 @@ var E = w("pie-lib:math-input-mathlive:static"), D = "position:absolute;width:1p
35
35
  setInput: S.func
36
36
  };
37
37
  static defaultProps = { getFieldName: () => {} };
38
+ relabel = () => b(this.mathField, this.props.language);
38
39
  constructor(e) {
39
40
  super(e), this.holderRef = x.createRef(), this.state = { markup: "" }, this.promptValues = {};
40
41
  }
@@ -48,10 +49,10 @@ var E = w("pie-lib:math-input-mathlive:static"), D = "position:absolute;width:1p
48
49
  return;
49
50
  }
50
51
  let t = await _();
51
- e === this.mountGeneration && t?.MathfieldElement && this.holderRef.current && !this.mathField && (this.mathField = m(t), b(this.mathField, this.props.language), y(this.mathField, this.props.ariaDescribedBy), this.mathField.readOnly = !0, this.mathField.mathVirtualKeyboardPolicy = "manual", this.mathField.mathModeSpace = "\\ ", this.mathField.smartSuperscript = !1, this.mathField.value = s(this.props.latex), p(this.mathField), this.untrackCaret = v(this.mathField), this.untrackLongDivision = f(this.mathField), this.mathField.addEventListener("input", this.onPromptInput), this.mathField.addEventListener("pointerdown", this.onPointerDown, !0), this.mathField.addEventListener("focusin", this.onPromptFocus), this.mathField.addEventListener("selection-change", this.onSelectionChange), this.mathField.addEventListener("keydown", this.onKeyDown), this.holderRef.current.replaceChildren(this.mathField), b(this.mathField, this.props.language), this.parkCaret(), this.createLiveRegion());
52
+ e === this.mountGeneration && t?.MathfieldElement && this.holderRef.current && !this.mathField && (this.mathField = m(t), b(this.mathField, this.props.language, this.relabel), y(this.mathField, this.props.ariaDescribedBy), this.mathField.readOnly = !0, this.mathField.mathVirtualKeyboardPolicy = "manual", this.mathField.mathModeSpace = "\\ ", this.mathField.smartSuperscript = !1, this.mathField.value = s(this.props.latex), p(this.mathField), this.untrackCaret = v(this.mathField), this.untrackLongDivision = f(this.mathField), this.mathField.addEventListener("input", this.onPromptInput), this.mathField.addEventListener("pointerdown", this.onPointerDown, !0), this.mathField.addEventListener("focusin", this.onPromptFocus), this.mathField.addEventListener("selection-change", this.onSelectionChange), this.mathField.addEventListener("keydown", this.onKeyDown), this.holderRef.current.replaceChildren(this.mathField), b(this.mathField, this.props.language, this.relabel), this.parkCaret(), this.createLiveRegion());
52
53
  }
53
54
  componentDidUpdate(e, t) {
54
- !this.mathField && this.state.markup !== (t && t.markup) && d(this.holderRef.current), this.mathField && e.language !== this.props.language && b(this.mathField, this.props.language), this.mathField && e.ariaDescribedBy !== this.props.ariaDescribedBy && y(this.mathField, this.props.ariaDescribedBy), e.latex !== this.props.latex && (this.isInteractive() === this.interactive ? this.mathField ? n(this.props.latex) === n(e.latex) ? this.syncPrompts() : (this.mathField.value = s(this.props.latex), this.parkCaret()) : this.renderMarkup() : (this.unmountField(), this.setState({ markup: "" }), this.mount()));
55
+ !this.mathField && this.state.markup !== (t && t.markup) && d(this.holderRef.current), this.mathField && e.language !== this.props.language && b(this.mathField, this.props.language, this.relabel), this.mathField && e.ariaDescribedBy !== this.props.ariaDescribedBy && y(this.mathField, this.props.ariaDescribedBy), e.latex !== this.props.latex && (this.isInteractive() === this.interactive ? this.mathField ? n(this.props.latex) === n(e.latex) ? this.syncPrompts() : (this.mathField.value = s(this.props.latex), this.parkCaret()) : this.renderMarkup() : (this.unmountField(), this.setState({ markup: "" }), this.mount()));
55
56
  }
56
57
  parkCaret() {
57
58
  if (!this.mathField || this.mathField.hasFocus?.()) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/math-input-mathlive",
3
- "version": "2.0.1-next.20261109082044",
3
+ "version": "2.0.1-next.20261109091947",
4
4
  "description": "MathLive-based math input (drop-in alternative to @pie-lib/math-input)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,8 +17,8 @@
17
17
  "mathlive": "0.110.0",
18
18
  "prop-types": "^15.7.2",
19
19
  "@pie-element/shared-lodash": "0.1.4-next.20261026212738",
20
- "@pie-lib/render-ui": "8.0.8-next.20261109082044",
21
- "@pie-lib/translator": "5.0.3-next.20261109072207"
20
+ "@pie-lib/render-ui": "8.0.8-next.20261109091947",
21
+ "@pie-element/shared-i18n": "0.1.3-next.20261109082044"
22
22
  },
23
23
  "type": "module",
24
24
  "main": "./dist/index.js",