@pie-element/fraction-model 7.0.1-next.20261002222413 → 7.0.1-next.20261003061051

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.
@@ -1,11 +1,3 @@
1
- /**
2
- * @synced-from pie-elements/packages/fraction-model/configure/src/card-bar.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
1
  import React from 'react';
10
2
  import PropTypes from 'prop-types';
11
3
  declare const CardBar: {
@@ -1,11 +1,3 @@
1
- /**
2
- * @synced-from pie-elements/packages/fraction-model/configure/src/defaults.js
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
1
  declare const _default: {
10
2
  model: {
11
3
  correctResponse: never[];
@@ -1,11 +1,3 @@
1
- /**
2
- * @synced-from pie-elements/packages/fraction-model/configure/src/index.js
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
1
  export default class FractionModelConfigure extends HTMLElement {
10
2
  /**
11
3
  * This function makes sure you set the default values on the model
@@ -1,11 +1,3 @@
1
- /**
2
- * @synced-from pie-elements/packages/fraction-model/configure/src/main.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
1
  import React from 'react';
10
2
  import PropTypes from 'prop-types';
11
3
  export declare class Main extends React.Component {
@@ -1,11 +1,3 @@
1
- /**
2
- * @synced-from pie-elements/packages/fraction-model/configure/src/model-options.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
1
  import React from 'react';
10
2
  import PropTypes from 'prop-types';
11
3
  export declare class ModelOptions extends React.Component {
@@ -1,11 +1,3 @@
1
- /**
2
- * @synced-from pie-elements/packages/fraction-model/configure/src/number-text-field.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
1
  import React from 'react';
10
2
  export declare class NumberTextField extends React.Component {
11
3
  static propTypes: {};
@@ -22868,11 +22868,20 @@ Mk.propTypes = {
22868
22868
  };
22869
22869
  //#endregion
22870
22870
  //#region ../../lib-react/editable-html-tip-tap/dist/extensions/responseArea.js
22871
- var Nk = {}, Pk = (e) => String(e || "").replace(/-/g, "_"), Fk = (e) => e && e.attrs && e.attrs.index != null ? String(e.attrs.index) : null, Ik = (e, t) => {
22871
+ var Nk = (e) => String(e || "").replace(/-/g, "_"), Pk = (e) => e && e.attrs && e.attrs.index != null ? String(e.attrs.index) : null, Fk = (e, t) => {
22872
+ let n = 0;
22873
+ return e.descendants((e) => {
22874
+ if (e.type && e.type.name === t) {
22875
+ let t = parseInt(Pk(e), 10);
22876
+ !Number.isNaN(t) && t > n && (n = t);
22877
+ }
22878
+ return !0;
22879
+ }), n;
22880
+ }, Ik = (e, t) => {
22872
22881
  let n = [];
22873
22882
  return e.descendants((e, r) => {
22874
22883
  if (e.type && e.type.name === t) {
22875
- let t = Fk(e);
22884
+ let t = Pk(e);
22876
22885
  t != null && n.push({
22877
22886
  index: t,
22878
22887
  pos: r,
@@ -22905,59 +22914,53 @@ var Nk = {}, Pk = (e) => String(e || "").replace(/-/g, "_"), Fk = (e) => e && e.
22905
22914
  onHandleAreaChange: null
22906
22915
  };
22907
22916
  },
22917
+ addStorage() {
22918
+ return { lastIndexMap: {} };
22919
+ },
22908
22920
  addProseMirrorPlugins() {
22909
22921
  if (!this.options.type) return [];
22910
- let e = Pk(this.options.type);
22922
+ let e = Nk(this.options.type);
22911
22923
  return [new Wc({
22912
22924
  key: new qc(`response-area-watcher:${e}`),
22913
- view: (t) => (Nk[e] === void 0 && (Nk[e] = 0, t.state.doc.descendants((t) => {
22914
- if (t.type && t.type.name === e) {
22915
- let n = Fk(t);
22916
- if (n != null) {
22917
- let t = parseInt(n, 10);
22918
- !Number.isNaN(t) && t > Nk[e] && (Nk[e] = t);
22925
+ view: (t) => {
22926
+ let { lastIndexMap: n } = this.storage;
22927
+ return n[e] = Math.max(n[e] ?? 0, Fk(t.state.doc, e)), { update: (t, n) => {
22928
+ let r = t.state;
22929
+ if (n.doc.eq(r.doc)) return;
22930
+ let i = Ik(r.doc, e), a = Ik(n.doc, e);
22931
+ if (this.options.toolbar && (this.options.toolbar.disabled = i.length >= this.options.maxResponseAreas), a.length > i.length) {
22932
+ let e = new Set(i.map((e) => e.index)), t = a.filter((t) => !e.has(t.index));
22933
+ t.length && typeof this.options.onHandleAreaChange == "function" && this.options.onHandleAreaChange(t);
22919
22934
  }
22920
- }
22921
- return !0;
22922
- })), { update: (t, n) => {
22923
- let r = t.state;
22924
- if (n.doc.eq(r.doc)) return;
22925
- let i = Ik(r.doc, e), a = Ik(n.doc, e);
22926
- if (this.options.toolbar && (this.options.toolbar.disabled = i.length >= this.options.maxResponseAreas), a.length > i.length) {
22927
- let e = new Set(i.map((e) => e.index)), t = a.filter((t) => !e.has(t.index));
22928
- t.length && typeof this.options.onHandleAreaChange == "function" && this.options.onHandleAreaChange(t);
22929
- }
22930
- } })
22935
+ } };
22936
+ }
22931
22937
  })];
22932
22938
  },
22933
22939
  addCommands() {
22934
22940
  return {
22935
22941
  insertResponseArea: (e) => ({ tr: t, state: n, dispatch: r, commands: i }) => {
22936
- let a = Pk(e);
22942
+ let a = Nk(e);
22937
22943
  if (Lk(n.doc, a) >= this.options.maxResponseAreas) return !1;
22938
- Nk[a] === void 0 && (Nk[a] = 0);
22939
- let o = Nk[a] + 1;
22940
- Nk[a] += 1;
22941
- let s = Rk({
22944
+ let { lastIndexMap: o } = this.storage, s = Math.max(o[a] ?? 0, Fk(n.doc, a)) + 1, c = Rk({
22942
22945
  schema: n.schema,
22943
22946
  typeName: a,
22944
- index: o
22947
+ index: s
22945
22948
  });
22946
- if (!s) return !1;
22947
- let { selection: c } = n, l = c.from, u = (e) => {
22949
+ if (!c) return !1;
22950
+ let { selection: l } = n, u = l.from, d = (e) => {
22948
22951
  try {
22949
- return t.insert(e, s), e;
22952
+ return t.insert(e, c), e;
22950
22953
  } catch {
22951
22954
  return null;
22952
22955
  }
22953
- }, d = u(l);
22954
- if (d ??= u(t.doc.content.size), d == null) return !1;
22955
- if (["inline_dropdown", "explicit_constructed_response"].includes(a)) t.setSelection(I.create(t.doc, d));
22956
+ }, f = d(u);
22957
+ if (f ??= d(t.doc.content.size), f == null) return !1;
22958
+ if (["inline_dropdown", "explicit_constructed_response"].includes(a)) t.setSelection(I.create(t.doc, f));
22956
22959
  else {
22957
- let e = d + s.nodeSize;
22960
+ let e = f + c.nodeSize;
22958
22961
  t.setSelection(zk(t.doc, e));
22959
22962
  }
22960
- return r && (i.focus(), r(t)), !0;
22963
+ return r && (o[a] = s, i.focus(), r(t)), !0;
22961
22964
  },
22962
22965
  refreshResponseArea: () => ({ tr: e, state: t, commands: n, dispatch: r }) => {
22963
22966
  let { selection: i } = t, a = i.$from.nodeAfter, o = i.from;