@pie-element/inline-dropdown 11.0.1-next.20261002222413 → 11.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/inline-dropdown/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
  alternateResponse: {};
@@ -1,11 +1,3 @@
1
- /**
2
- * @synced-from pie-elements/packages/inline-dropdown/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 InlineDropdown extends HTMLElement {
10
2
  static prepareModel: (model?: {}) => {
11
3
  slateMarkup: any;
@@ -1,11 +1,3 @@
1
- /**
2
- * @synced-from pie-elements/packages/inline-dropdown/configure/src/inline-dropdown-toolbar.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 class RespAreaToolbar extends React.Component {
@@ -1,11 +1,3 @@
1
- /**
2
- * @synced-from pie-elements/packages/inline-dropdown/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/inline-dropdown/configure/src/markupUtils.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 declare const removeUnwantedCharacters: (markup: any) => any;
10
2
  export declare const createElementFromHTML: (htmlString: any) => HTMLDivElement;
11
3
  export declare const processMarkup: (markup: any) => string;
@@ -1,11 +1,3 @@
1
- /**
2
- * @synced-from pie-elements/packages/inline-dropdown/configure/src/response-area.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 class ResponseAreaComponent extends React.Component {
@@ -1,10 +1,2 @@
1
- /**
2
- * @synced-from pie-elements/packages/inline-dropdown/configure/src/utils.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 declare const generateValidationMessage: (config: any) => string;
10
2
  export declare const getPluginProps: (props?: {}, baseInputConfiguration?: {}) => {};
@@ -19465,11 +19465,20 @@ oE.propTypes = {
19465
19465
  };
19466
19466
  //#endregion
19467
19467
  //#region ../../lib-react/editable-html-tip-tap/dist/extensions/responseArea.js
19468
- var sE = {}, cE = (e) => String(e || "").replace(/-/g, "_"), lE = (e) => e && e.attrs && e.attrs.index != null ? String(e.attrs.index) : null, uE = (e, t) => {
19468
+ var sE = (e) => String(e || "").replace(/-/g, "_"), cE = (e) => e && e.attrs && e.attrs.index != null ? String(e.attrs.index) : null, lE = (e, t) => {
19469
+ let n = 0;
19470
+ return e.descendants((e) => {
19471
+ if (e.type && e.type.name === t) {
19472
+ let t = parseInt(cE(e), 10);
19473
+ !Number.isNaN(t) && t > n && (n = t);
19474
+ }
19475
+ return !0;
19476
+ }), n;
19477
+ }, uE = (e, t) => {
19469
19478
  let n = [];
19470
19479
  return e.descendants((e, r) => {
19471
19480
  if (e.type && e.type.name === t) {
19472
- let t = lE(e);
19481
+ let t = cE(e);
19473
19482
  t != null && n.push({
19474
19483
  index: t,
19475
19484
  pos: r,
@@ -19502,59 +19511,53 @@ var sE = {}, cE = (e) => String(e || "").replace(/-/g, "_"), lE = (e) => e && e.
19502
19511
  onHandleAreaChange: null
19503
19512
  };
19504
19513
  },
19514
+ addStorage() {
19515
+ return { lastIndexMap: {} };
19516
+ },
19505
19517
  addProseMirrorPlugins() {
19506
19518
  if (!this.options.type) return [];
19507
- let e = cE(this.options.type);
19519
+ let e = sE(this.options.type);
19508
19520
  return [new To({
19509
19521
  key: new Oo(`response-area-watcher:${e}`),
19510
- view: (t) => (sE[e] === void 0 && (sE[e] = 0, t.state.doc.descendants((t) => {
19511
- if (t.type && t.type.name === e) {
19512
- let n = lE(t);
19513
- if (n != null) {
19514
- let t = parseInt(n, 10);
19515
- !Number.isNaN(t) && t > sE[e] && (sE[e] = t);
19522
+ view: (t) => {
19523
+ let { lastIndexMap: n } = this.storage;
19524
+ return n[e] = Math.max(n[e] ?? 0, lE(t.state.doc, e)), { update: (t, n) => {
19525
+ let r = t.state;
19526
+ if (n.doc.eq(r.doc)) return;
19527
+ let i = uE(r.doc, e), a = uE(n.doc, e);
19528
+ if (this.options.toolbar && (this.options.toolbar.disabled = i.length >= this.options.maxResponseAreas), a.length > i.length) {
19529
+ let e = new Set(i.map((e) => e.index)), t = a.filter((t) => !e.has(t.index));
19530
+ t.length && typeof this.options.onHandleAreaChange == "function" && this.options.onHandleAreaChange(t);
19516
19531
  }
19517
- }
19518
- return !0;
19519
- })), { update: (t, n) => {
19520
- let r = t.state;
19521
- if (n.doc.eq(r.doc)) return;
19522
- let i = uE(r.doc, e), a = uE(n.doc, e);
19523
- if (this.options.toolbar && (this.options.toolbar.disabled = i.length >= this.options.maxResponseAreas), a.length > i.length) {
19524
- let e = new Set(i.map((e) => e.index)), t = a.filter((t) => !e.has(t.index));
19525
- t.length && typeof this.options.onHandleAreaChange == "function" && this.options.onHandleAreaChange(t);
19526
- }
19527
- } })
19532
+ } };
19533
+ }
19528
19534
  })];
19529
19535
  },
19530
19536
  addCommands() {
19531
19537
  return {
19532
19538
  insertResponseArea: (e) => ({ tr: t, state: n, dispatch: r, commands: i }) => {
19533
- let a = cE(e);
19539
+ let a = sE(e);
19534
19540
  if (dE(n.doc, a) >= this.options.maxResponseAreas) return !1;
19535
- sE[a] === void 0 && (sE[a] = 0);
19536
- let o = sE[a] + 1;
19537
- sE[a] += 1;
19538
- let s = fE({
19541
+ let { lastIndexMap: o } = this.storage, s = Math.max(o[a] ?? 0, lE(n.doc, a)) + 1, c = fE({
19539
19542
  schema: n.schema,
19540
19543
  typeName: a,
19541
- index: o
19544
+ index: s
19542
19545
  });
19543
- if (!s) return !1;
19544
- let { selection: c } = n, l = c.from, u = (e) => {
19546
+ if (!c) return !1;
19547
+ let { selection: l } = n, u = l.from, d = (e) => {
19545
19548
  try {
19546
- return t.insert(e, s), e;
19549
+ return t.insert(e, c), e;
19547
19550
  } catch {
19548
19551
  return null;
19549
19552
  }
19550
- }, d = u(l);
19551
- if (d ??= u(t.doc.content.size), d == null) return !1;
19552
- if (["inline_dropdown", "explicit_constructed_response"].includes(a)) t.setSelection(B.create(t.doc, d));
19553
+ }, f = d(u);
19554
+ if (f ??= d(t.doc.content.size), f == null) return !1;
19555
+ if (["inline_dropdown", "explicit_constructed_response"].includes(a)) t.setSelection(B.create(t.doc, f));
19553
19556
  else {
19554
- let e = d + s.nodeSize;
19557
+ let e = f + c.nodeSize;
19555
19558
  t.setSelection(pE(t.doc, e));
19556
19559
  }
19557
- return r && (i.focus(), r(t)), !0;
19560
+ return r && (o[a] = s, i.focus(), r(t)), !0;
19558
19561
  },
19559
19562
  refreshResponseArea: () => ({ tr: e, state: t, commands: n, dispatch: r }) => {
19560
19563
  let { selection: i } = t, a = i.$from.nodeAfter, o = i.from;