@fencyai/react 0.1.90 → 0.1.91

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.
Files changed (2) hide show
  1. package/dist/index.js +72 -64
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -4654,11 +4654,11 @@ function Ah(e, t, n) {
4654
4654
  function K(ie) {
4655
4655
  return _e;
4656
4656
  function _e(de) {
4657
- const Ae = de !== null && ie[de], V = de !== null && ie.null, Z = [
4657
+ const Ae = de !== null && ie[de], j = de !== null && ie.null, Z = [
4658
4658
  // To do: add more extension tests.
4659
4659
  /* c8 ignore next 2 */
4660
4660
  ...Array.isArray(Ae) ? Ae : Ae ? [Ae] : [],
4661
- ...Array.isArray(V) ? V : V ? [V] : []
4661
+ ...Array.isArray(j) ? j : j ? [j] : []
4662
4662
  ];
4663
4663
  return te(Z)(de);
4664
4664
  }
@@ -4848,7 +4848,7 @@ function Oh(e) {
4848
4848
  autolinkProtocol: M,
4849
4849
  autolinkEmail: M,
4850
4850
  atxHeading: i(Je),
4851
- blockQuote: i(V),
4851
+ blockQuote: i(j),
4852
4852
  characterEscape: M,
4853
4853
  characterReference: M,
4854
4854
  codeFenced: i(Z),
@@ -4946,7 +4946,7 @@ function Oh(e) {
4946
4946
  type: "root",
4947
4947
  children: []
4948
4948
  };
4949
- const j = {
4949
+ const V = {
4950
4950
  stack: [F],
4951
4951
  tokenStack: [],
4952
4952
  config: t,
@@ -4969,11 +4969,11 @@ function Oh(e) {
4969
4969
  const Ue = t[N[ne][0]];
4970
4970
  ep.call(Ue, N[ne][1].type) && Ue[N[ne][1].type].call(Object.assign({
4971
4971
  sliceSerialize: N[ne][2].sliceSerialize
4972
- }, j), N[ne][1]);
4972
+ }, V), N[ne][1]);
4973
4973
  }
4974
- if (j.tokenStack.length > 0) {
4975
- const Ue = j.tokenStack[j.tokenStack.length - 1];
4976
- (Ue[1] || hc).call(j, void 0, Ue[0]);
4974
+ if (V.tokenStack.length > 0) {
4975
+ const Ue = V.tokenStack[V.tokenStack.length - 1];
4976
+ (Ue[1] || hc).call(V, void 0, Ue[0]);
4977
4977
  }
4978
4978
  for (F.position = {
4979
4979
  start: ot(N.length > 0 ? N[0][1].start : {
@@ -4990,9 +4990,9 @@ function Oh(e) {
4990
4990
  F = t.transforms[ne](F) || F;
4991
4991
  return F;
4992
4992
  }
4993
- function a(N, F, j) {
4993
+ function a(N, F, V) {
4994
4994
  let Q = F - 1, ne = -1, Ue = !1, bt, et, Kt, Xt;
4995
- for (; ++Q <= j; ) {
4995
+ for (; ++Q <= V; ) {
4996
4996
  const Ne = N[Q];
4997
4997
  switch (Ne[1].type) {
4998
4998
  case "listUnordered":
@@ -5024,7 +5024,7 @@ function Oh(e) {
5024
5024
  et && (N[et][1].type = "lineEndingBlank", Ue = !0), tt[1].type = "lineEnding", et = vt;
5025
5025
  } else if (!(tt[1].type === "linePrefix" || tt[1].type === "blockQuotePrefix" || tt[1].type === "blockQuotePrefixWhitespace" || tt[1].type === "blockQuoteMarker" || tt[1].type === "listItemIndent")) break;
5026
5026
  }
5027
- Kt && (!et || Kt < et) && (bt._spread = !0), bt.end = Object.assign({}, et ? N[et][1].start : Ne[1].end), N.splice(et || Q, 0, ["exit", bt, Ne[2]]), Q++, j++;
5027
+ Kt && (!et || Kt < et) && (bt._spread = !0), bt.end = Object.assign({}, et ? N[et][1].start : Ne[1].end), N.splice(et || Q, 0, ["exit", bt, Ne[2]]), Q++, V++;
5028
5028
  }
5029
5029
  if (Ne[1].type === "listItemPrefix") {
5030
5030
  const vt = {
@@ -5034,15 +5034,15 @@ function Oh(e) {
5034
5034
  // @ts-expect-error: we’ll add `end` in a second.
5035
5035
  end: void 0
5036
5036
  };
5037
- bt = vt, N.splice(Q, 0, ["enter", vt, Ne[2]]), Q++, j++, Kt = void 0, Xt = !0;
5037
+ bt = vt, N.splice(Q, 0, ["enter", vt, Ne[2]]), Q++, V++, Kt = void 0, Xt = !0;
5038
5038
  }
5039
5039
  }
5040
5040
  }
5041
- return N[F][1]._spread = Ue, j;
5041
+ return N[F][1]._spread = Ue, V;
5042
5042
  }
5043
5043
  function i(N, F) {
5044
- return j;
5045
- function j(Q) {
5044
+ return V;
5045
+ function V(Q) {
5046
5046
  s.call(this, N(Q), Q), F && F.call(this, Q);
5047
5047
  }
5048
5048
  }
@@ -5052,8 +5052,8 @@ function Oh(e) {
5052
5052
  children: []
5053
5053
  });
5054
5054
  }
5055
- function s(N, F, j) {
5056
- this.stack[this.stack.length - 1].children.push(N), this.stack.push(N), this.tokenStack.push([F, j || void 0]), N.position = {
5055
+ function s(N, F, V) {
5056
+ this.stack[this.stack.length - 1].children.push(N), this.stack.push(N), this.tokenStack.push([F, V || void 0]), N.position = {
5057
5057
  start: ot(F.start),
5058
5058
  // @ts-expect-error: `end` will be patched later.
5059
5059
  end: void 0
@@ -5061,19 +5061,19 @@ function Oh(e) {
5061
5061
  }
5062
5062
  function u(N) {
5063
5063
  return F;
5064
- function F(j) {
5065
- N && N.call(this, j), l.call(this, j);
5064
+ function F(V) {
5065
+ N && N.call(this, V), l.call(this, V);
5066
5066
  }
5067
5067
  }
5068
5068
  function l(N, F) {
5069
- const j = this.stack.pop(), Q = this.tokenStack.pop();
5069
+ const V = this.stack.pop(), Q = this.tokenStack.pop();
5070
5070
  if (Q)
5071
5071
  Q[0].type !== N.type && (F ? F.call(this, N, Q[0]) : (Q[1] || hc).call(this, N, Q[0]));
5072
5072
  else throw new Error("Cannot close `" + N.type + "` (" + Jt({
5073
5073
  start: N.start,
5074
5074
  end: N.end
5075
5075
  }) + "): it’s not open");
5076
- j.position.end = ot(N.end);
5076
+ V.position.end = ot(N.end);
5077
5077
  }
5078
5078
  function p() {
5079
5079
  return Ta(this.stack.pop());
@@ -5107,8 +5107,8 @@ function Oh(e) {
5107
5107
  F.value = N.replace(/(\r?\n|\r)$/g, "");
5108
5108
  }
5109
5109
  function S(N) {
5110
- const F = this.resume(), j = this.stack[this.stack.length - 1];
5111
- j.label = F, j.identifier = Be(this.sliceSerialize(N)).toLowerCase();
5110
+ const F = this.resume(), V = this.stack[this.stack.length - 1];
5111
+ V.label = F, V.identifier = Be(this.sliceSerialize(N)).toLowerCase();
5112
5112
  }
5113
5113
  function A() {
5114
5114
  const N = this.resume(), F = this.stack[this.stack.length - 1];
@@ -5121,8 +5121,8 @@ function Oh(e) {
5121
5121
  function _(N) {
5122
5122
  const F = this.stack[this.stack.length - 1];
5123
5123
  if (!F.depth) {
5124
- const j = this.sliceSerialize(N).length;
5125
- F.depth = j;
5124
+ const V = this.sliceSerialize(N).length;
5125
+ F.depth = V;
5126
5126
  }
5127
5127
  }
5128
5128
  function T() {
@@ -5136,13 +5136,13 @@ function Oh(e) {
5136
5136
  this.data.setextHeadingSlurpLineEnding = void 0;
5137
5137
  }
5138
5138
  function M(N) {
5139
- const j = this.stack[this.stack.length - 1].children;
5140
- let Q = j[j.length - 1];
5139
+ const V = this.stack[this.stack.length - 1].children;
5140
+ let Q = V[V.length - 1];
5141
5141
  (!Q || Q.type !== "text") && (Q = qg(), Q.position = {
5142
5142
  start: ot(N.start),
5143
5143
  // @ts-expect-error: we’ll add `end` later.
5144
5144
  end: void 0
5145
- }, j.push(Q)), this.stack.push(Q);
5145
+ }, V.push(Q)), this.stack.push(Q);
5146
5146
  }
5147
5147
  function k(N) {
5148
5148
  const F = this.stack.pop();
@@ -5151,8 +5151,8 @@ function Oh(e) {
5151
5151
  function C(N) {
5152
5152
  const F = this.stack[this.stack.length - 1];
5153
5153
  if (this.data.atHardBreak) {
5154
- const j = F.children[F.children.length - 1];
5155
- j.position.end = ot(N.end), this.data.atHardBreak = void 0;
5154
+ const V = F.children[F.children.length - 1];
5155
+ V.position.end = ot(N.end), this.data.atHardBreak = void 0;
5156
5156
  return;
5157
5157
  }
5158
5158
  !this.data.setextHeadingSlurpLineEnding && t.canContainEols.includes(F.type) && (M.call(this, N), k.call(this, N));
@@ -5191,16 +5191,16 @@ function Oh(e) {
5191
5191
  this.data.referenceType = void 0;
5192
5192
  }
5193
5193
  function $(N) {
5194
- const F = this.sliceSerialize(N), j = this.stack[this.stack.length - 2];
5195
- j.label = Nh(F), j.identifier = Be(F).toLowerCase();
5194
+ const F = this.sliceSerialize(N), V = this.stack[this.stack.length - 2];
5195
+ V.label = Nh(F), V.identifier = Be(F).toLowerCase();
5196
5196
  }
5197
5197
  function W() {
5198
- const N = this.stack[this.stack.length - 1], F = this.resume(), j = this.stack[this.stack.length - 1];
5199
- if (this.data.inReference = !0, j.type === "link") {
5198
+ const N = this.stack[this.stack.length - 1], F = this.resume(), V = this.stack[this.stack.length - 1];
5199
+ if (this.data.inReference = !0, V.type === "link") {
5200
5200
  const Q = N.children;
5201
- j.children = Q;
5201
+ V.children = Q;
5202
5202
  } else
5203
- j.alt = F;
5203
+ V.alt = F;
5204
5204
  }
5205
5205
  function E() {
5206
5206
  const N = this.resume(), F = this.stack[this.stack.length - 1];
@@ -5217,16 +5217,16 @@ function Oh(e) {
5217
5217
  this.data.referenceType = "collapsed";
5218
5218
  }
5219
5219
  function ue(N) {
5220
- const F = this.resume(), j = this.stack[this.stack.length - 1];
5221
- j.label = F, j.identifier = Be(this.sliceSerialize(N)).toLowerCase(), this.data.referenceType = "full";
5220
+ const F = this.resume(), V = this.stack[this.stack.length - 1];
5221
+ V.label = F, V.identifier = Be(this.sliceSerialize(N)).toLowerCase(), this.data.referenceType = "full";
5222
5222
  }
5223
5223
  function ce(N) {
5224
5224
  this.data.characterReferenceType = N.type;
5225
5225
  }
5226
5226
  function ie(N) {
5227
- const F = this.sliceSerialize(N), j = this.data.characterReferenceType;
5227
+ const F = this.sliceSerialize(N), V = this.data.characterReferenceType;
5228
5228
  let Q;
5229
- j ? (Q = jd(F, j === "characterReferenceMarkerNumeric" ? 10 : 16), this.data.characterReferenceType = void 0) : Q = sn(F);
5229
+ V ? (Q = jd(F, V === "characterReferenceMarkerNumeric" ? 10 : 16), this.data.characterReferenceType = void 0) : Q = sn(F);
5230
5230
  const ne = this.stack[this.stack.length - 1];
5231
5231
  ne.value += Q;
5232
5232
  }
@@ -5244,7 +5244,7 @@ function Oh(e) {
5244
5244
  const F = this.stack[this.stack.length - 1];
5245
5245
  F.url = "mailto:" + this.sliceSerialize(N);
5246
5246
  }
5247
- function V() {
5247
+ function j() {
5248
5248
  return {
5249
5249
  type: "blockquote",
5250
5250
  children: []
@@ -7992,7 +7992,7 @@ function vE(e, t) {
7992
7992
  defaultCodeValue: _e
7993
7993
  });
7994
7994
  de.language === null && (de.value = _e);
7995
- var Ae = (a = (i = E.match(/\n/g)) === null || i === void 0 ? void 0 : i.length) !== null && a !== void 0 ? a : 0, V = _ + Ae, Z = AE(de, M, L, b, A, _, V, O, C);
7995
+ var Ae = (a = (i = E.match(/\n/g)) === null || i === void 0 ? void 0 : i.length) !== null && a !== void 0 ? a : 0, j = _ + Ae, Z = AE(de, M, L, b, A, _, j, O, C);
7996
7996
  return /* @__PURE__ */ je.createElement(G, ie, /* @__PURE__ */ je.createElement($, g, !A && w, U({
7997
7997
  rows: Z,
7998
7998
  stylesheet: l,
@@ -31310,7 +31310,15 @@ function SA({
31310
31310
  }), f += o(c.slice(b));
31311
31311
  } else
31312
31312
  f = o(c);
31313
- e.current.innerHTML = f || "<br>", d && requestAnimationFrame(() => {
31313
+ if (e.current.innerHTML = f || "<br>", !f || f === "<br>") {
31314
+ const y = window.getSelection();
31315
+ if (y && e.current) {
31316
+ e.current.innerHTML = "", e.current.innerHTML = "<br>";
31317
+ const b = document.createRange();
31318
+ b.setStart(e.current, 0), b.collapse(!0), y.removeAllRanges(), y.addRange(b);
31319
+ }
31320
+ }
31321
+ d && requestAnimationFrame(() => {
31314
31322
  a(g);
31315
31323
  });
31316
31324
  }, [e, t, n, r, a, o]), u = le((c) => {
@@ -33541,7 +33549,7 @@ var hg = "PopperAnchor", yg = R.forwardRef(
33541
33549
  yg.displayName = hg;
33542
33550
  var Hu = "PopperContent", [pk, gk] = gg(Hu), Eg = R.forwardRef(
33543
33551
  (e, t) => {
33544
- var _e, de, Ae, V, Z, Re;
33552
+ var _e, de, Ae, j, Z, Re;
33545
33553
  const {
33546
33554
  __scopePopper: n,
33547
33555
  side: r = "bottom",
@@ -33611,7 +33619,7 @@ var Hu = "PopperContent", [pk, gk] = gg(Hu), Eg = R.forwardRef(
33611
33619
  minWidth: "max-content",
33612
33620
  zIndex: ce,
33613
33621
  "--radix-popper-transform-origin": [
33614
- (V = $.transformOrigin) == null ? void 0 : V.x,
33622
+ (j = $.transformOrigin) == null ? void 0 : j.x,
33615
33623
  (Z = $.transformOrigin) == null ? void 0 : Z.y
33616
33624
  ].join(" "),
33617
33625
  // hide the content if using the hide middleware and should be hidden
@@ -34755,28 +34763,28 @@ const Iv = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20wid
34755
34763
  }) => {
34756
34764
  var Ae;
34757
34765
  const [s, u] = ee(""), [l, p] = ee(""), [c, d] = ee(""), [g, f] = ee(!1), [m, y] = ee(0), [b, S] = ee(0), [A, v] = ee(null), [_, T] = ee(0), [I, O] = ee(null), M = We(null), k = We(null), C = We(!1), [x, L] = ee([]), U = We(/* @__PURE__ */ new Map()), B = rn(() => {
34758
- const V = /* @__PURE__ */ new Map();
34766
+ const j = /* @__PURE__ */ new Map();
34759
34767
  return U.current.forEach((Z, Re) => {
34760
- V.set(Re, Z);
34768
+ j.set(Re, Z);
34761
34769
  }), o.forEach((Z) => {
34762
- V.set(Z.id, Z);
34763
- }), Array.from(V.values()).map((Z) => ({
34770
+ j.set(Z.id, Z);
34771
+ }), Array.from(j.values()).map((Z) => ({
34764
34772
  id: Z.id,
34765
34773
  label: Z.title ?? ""
34766
34774
  }));
34767
34775
  }, [o]);
34768
34776
  ke(() => {
34769
- const V = setTimeout(() => {
34777
+ const j = setTimeout(() => {
34770
34778
  d(l);
34771
34779
  }, 300);
34772
34780
  return () => {
34773
- clearTimeout(V);
34781
+ clearTimeout(j);
34774
34782
  };
34775
34783
  }, [l]);
34776
34784
  const G = rn(() => {
34777
- const V = I !== null || l !== "", Z = I === null && l === "";
34785
+ const j = I !== null || l !== "", Z = I === null && l === "";
34778
34786
  return [
34779
- ...V ? o.map((oe) => ({
34787
+ ...j ? o.map((oe) => ({
34780
34788
  type: "option",
34781
34789
  id: oe.id,
34782
34790
  label: oe.title ?? ""
@@ -34812,8 +34820,8 @@ const Iv = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20wid
34812
34820
  getCaretPosition: E,
34813
34821
  setCaretPosition: K
34814
34822
  });
34815
- function ie(V) {
34816
- const Z = G[V];
34823
+ function ie(j) {
34824
+ const Z = G[j];
34817
34825
  if (!Z) return;
34818
34826
  if (Z.type === "category") {
34819
34827
  O(Z.id), p("");
@@ -34835,12 +34843,12 @@ const Iv = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20wid
34835
34843
  const { handleKeyDown: _e } = yA({
34836
34844
  onArrowDown: () => {
34837
34845
  T(
34838
- (V) => (V + 1) % G.length
34846
+ (j) => (j + 1) % G.length
34839
34847
  );
34840
34848
  },
34841
34849
  onArrowUp: () => {
34842
34850
  T(
34843
- (V) => (V - 1 + G.length) % G.length
34851
+ (j) => (j - 1 + G.length) % G.length
34844
34852
  );
34845
34853
  },
34846
34854
  onEnter: () => {
@@ -34851,8 +34859,8 @@ const Iv = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20wid
34851
34859
  }
34852
34860
  }), de = le(() => {
34853
34861
  if (C.current) return;
34854
- const V = te(), Z = E();
34855
- u(V), e(V), z(V), y(Z), $(V, Z), ue(V) && w(V, !0);
34862
+ const j = te(), Z = E();
34863
+ u(j), e(j), z(j), y(Z), $(j, Z), (ue(j) || j.trim() === "") && w(j, !0);
34856
34864
  }, [
34857
34865
  te,
34858
34866
  E,
@@ -34881,8 +34889,8 @@ const Iv = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20wid
34881
34889
  {
34882
34890
  editableRef: M,
34883
34891
  onInput: de,
34884
- onKeyDown: (V) => {
34885
- g && _e(V);
34892
+ onKeyDown: (j) => {
34893
+ g && _e(j);
34886
34894
  },
34887
34895
  isComposingRef: C,
34888
34896
  handleInput: de
@@ -34908,12 +34916,12 @@ const Iv = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20wid
34908
34916
  caretElement: A,
34909
34917
  query: l,
34910
34918
  isInCategory: I !== null,
34911
- categoryName: I && ((Ae = i.find((V) => V.id === I)) == null ? void 0 : Ae.name) || null,
34919
+ categoryName: I && ((Ae = i.find((j) => j.id === I)) == null ? void 0 : Ae.name) || null,
34912
34920
  onResetQuery: () => {
34913
34921
  p(""), d(""), I && O(null);
34914
- const V = s, Z = V.slice(0, m), Re = V.slice(m), oe = Z.lastIndexOf("@");
34922
+ const j = s, Z = j.slice(0, m), Re = j.slice(m), oe = Z.lastIndexOf("@");
34915
34923
  if (oe !== -1) {
34916
- const Ie = V.slice(0, oe + 1) + Re, Je = oe + 1;
34924
+ const Ie = j.slice(0, oe + 1) + Re, Je = oe + 1;
34917
34925
  u(Ie), e(Ie), z(Ie), requestAnimationFrame(() => {
34918
34926
  w(Ie, !1), requestAnimationFrame(() => {
34919
34927
  var Pe;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fencyai/react",
3
- "version": "0.1.90",
3
+ "version": "0.1.91",
4
4
  "description": "> TODO: description",
5
5
  "author": "staklau <steinaageklaussen@gmail.com>",
6
6
  "homepage": "",
@@ -32,7 +32,7 @@
32
32
  "prepublishOnly": "npm run build"
33
33
  },
34
34
  "devDependencies": {
35
- "@fencyai/js": "^0.1.90",
35
+ "@fencyai/js": "^0.1.91",
36
36
  "@types/jest": "^29.5.11",
37
37
  "@types/node": "^20.10.5",
38
38
  "@types/react": "^18.2.45",
@@ -46,7 +46,7 @@
46
46
  "vite-plugin-lib-inject-css": "^2.1.1"
47
47
  },
48
48
  "peerDependencies": {
49
- "@fencyai/js": "^0.1.90",
49
+ "@fencyai/js": "^0.1.91",
50
50
  "@radix-ui/react-popover": "^1.1.15",
51
51
  "react": ">=16.8.0",
52
52
  "react-markdown": "^10.1.0",
@@ -60,5 +60,5 @@
60
60
  "optional": false
61
61
  }
62
62
  },
63
- "gitHead": "a01cd180b3c4d9d3810baf9de72c2d4dcaab7b5b"
63
+ "gitHead": "b8934dfec93249a698ae90a7a7f6cb4d4e3b6c9e"
64
64
  }