@oliasoft-open-source/react-ui-library 3.9.11-beta-1 → 3.9.11-beta-3

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/dist/index.js CHANGED
@@ -9700,7 +9700,7 @@ var shallowDiffers = function shallowDiffers2(a2, b2) {
9700
9700
  }
9701
9701
  return false;
9702
9702
  };
9703
- var _excluded$a = ["afterInjection", "beforeInjection", "evalScripts", "fallback", "httpRequestWithCredentials", "loading", "renumerateIRIElements", "src", "useRequestCache", "wrapper"];
9703
+ var _excluded$a = ["afterInjection", "beforeInjection", "desc", "evalScripts", "fallback", "httpRequestWithCredentials", "loading", "renumerateIRIElements", "src", "title", "useRequestCache", "wrapper"];
9704
9704
  var svgNamespace = "http://www.w3.org/2000/svg";
9705
9705
  var xlinkNamespace = "http://www.w3.org/1999/xlink";
9706
9706
  var ReactSVG = /* @__PURE__ */ function(_React$Component) {
@@ -9728,7 +9728,9 @@ var ReactSVG = /* @__PURE__ */ function(_React$Component) {
9728
9728
  _proto.renderSVG = function renderSVG2() {
9729
9729
  var _this2 = this;
9730
9730
  if (this.reactWrapper instanceof ownerWindow(this.reactWrapper).Node) {
9731
- var _this$props = this.props, beforeInjection2 = _this$props.beforeInjection, evalScripts = _this$props.evalScripts, httpRequestWithCredentials = _this$props.httpRequestWithCredentials, renumerateIRIElements = _this$props.renumerateIRIElements, src = _this$props.src, useRequestCache = _this$props.useRequestCache;
9731
+ var _this$props = this.props, desc = _this$props.desc, evalScripts = _this$props.evalScripts, httpRequestWithCredentials = _this$props.httpRequestWithCredentials, renumerateIRIElements = _this$props.renumerateIRIElements, src = _this$props.src, title2 = _this$props.title, useRequestCache = _this$props.useRequestCache;
9732
+ var onError3 = this.props.onError;
9733
+ var beforeInjection2 = this.props.beforeInjection;
9732
9734
  var afterInjection2 = this.props.afterInjection;
9733
9735
  var wrapper2 = this.props.wrapper;
9734
9736
  var nonReactWrapper;
@@ -9745,28 +9747,69 @@ var ReactSVG = /* @__PURE__ */ function(_React$Component) {
9745
9747
  nonReactWrapper.appendChild(nonReactTarget);
9746
9748
  nonReactTarget.dataset.src = src;
9747
9749
  this.nonReactWrapper = this.reactWrapper.appendChild(nonReactWrapper);
9750
+ var handleError = function handleError2(error2) {
9751
+ _this2.removeSVG();
9752
+ if (!_this2._isMounted) {
9753
+ onError3(error2);
9754
+ return;
9755
+ }
9756
+ _this2.setState(function() {
9757
+ return {
9758
+ hasError: true,
9759
+ isLoading: false
9760
+ };
9761
+ }, function() {
9762
+ onError3(error2);
9763
+ });
9764
+ };
9748
9765
  var afterEach = function afterEach2(error2, svg) {
9749
9766
  if (error2) {
9750
- _this2.removeSVG();
9751
- if (!_this2._isMounted) {
9752
- afterInjection2(error2);
9753
- return;
9754
- }
9767
+ handleError(error2);
9768
+ return;
9755
9769
  }
9756
9770
  if (_this2._isMounted) {
9757
9771
  _this2.setState(function() {
9758
9772
  return {
9759
- hasError: !!error2,
9760
9773
  isLoading: false
9761
9774
  };
9762
9775
  }, function() {
9763
- afterInjection2(error2, svg);
9776
+ try {
9777
+ afterInjection2(svg);
9778
+ } catch (afterInjectionError) {
9779
+ handleError(afterInjectionError);
9780
+ }
9764
9781
  });
9765
9782
  }
9766
9783
  };
9784
+ var beforeEach = function beforeEach2(svg) {
9785
+ svg.setAttribute("role", "img");
9786
+ if (desc) {
9787
+ var originalDesc = svg.querySelector(":scope > desc");
9788
+ if (originalDesc) {
9789
+ svg.removeChild(originalDesc);
9790
+ }
9791
+ var newDesc = document.createElement("desc");
9792
+ newDesc.innerHTML = desc;
9793
+ svg.prepend(newDesc);
9794
+ }
9795
+ if (title2) {
9796
+ var originalTitle = svg.querySelector(":scope > title");
9797
+ if (originalTitle) {
9798
+ svg.removeChild(originalTitle);
9799
+ }
9800
+ var newTitle = document.createElement("title");
9801
+ newTitle.innerHTML = title2;
9802
+ svg.prepend(newTitle);
9803
+ }
9804
+ try {
9805
+ beforeInjection2(svg);
9806
+ } catch (error2) {
9807
+ handleError(error2);
9808
+ }
9809
+ };
9767
9810
  SVGInjector(nonReactTarget, {
9768
9811
  afterEach,
9769
- beforeEach: beforeInjection2,
9812
+ beforeEach,
9770
9813
  cacheRequests: useRequestCache,
9771
9814
  evalScripts,
9772
9815
  httpRequestWithCredentials,
@@ -9804,12 +9847,14 @@ var ReactSVG = /* @__PURE__ */ function(_React$Component) {
9804
9847
  var _this$props2 = this.props;
9805
9848
  _this$props2.afterInjection;
9806
9849
  _this$props2.beforeInjection;
9850
+ _this$props2.desc;
9807
9851
  _this$props2.evalScripts;
9808
9852
  var Fallback = _this$props2.fallback;
9809
9853
  _this$props2.httpRequestWithCredentials;
9810
9854
  var Loading = _this$props2.loading;
9811
9855
  _this$props2.renumerateIRIElements;
9812
9856
  _this$props2.src;
9857
+ _this$props2.title;
9813
9858
  _this$props2.useRequestCache;
9814
9859
  var wrapper2 = _this$props2.wrapper, rest = _objectWithoutPropertiesLoose$6(_this$props2, _excluded$a);
9815
9860
  var Wrapper2 = wrapper2;
@@ -9829,23 +9874,31 @@ ReactSVG.defaultProps = {
9829
9874
  beforeInjection: function beforeInjection() {
9830
9875
  return void 0;
9831
9876
  },
9877
+ desc: "",
9832
9878
  evalScripts: "never",
9833
9879
  fallback: null,
9834
9880
  httpRequestWithCredentials: false,
9835
9881
  loading: null,
9882
+ onError: function onError() {
9883
+ return void 0;
9884
+ },
9836
9885
  renumerateIRIElements: true,
9886
+ title: "",
9837
9887
  useRequestCache: true,
9838
9888
  wrapper: "div"
9839
9889
  };
9840
9890
  ReactSVG.propTypes = {
9841
9891
  afterInjection: PropTypes.func,
9842
9892
  beforeInjection: PropTypes.func,
9893
+ desc: PropTypes.string,
9843
9894
  evalScripts: PropTypes.oneOf(["always", "once", "never"]),
9844
9895
  fallback: PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.string]),
9845
9896
  httpRequestWithCredentials: PropTypes.bool,
9846
9897
  loading: PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.string]),
9898
+ onError: PropTypes.func,
9847
9899
  renumerateIRIElements: PropTypes.bool,
9848
9900
  src: PropTypes.string.isRequired,
9901
+ title: PropTypes.string,
9849
9902
  useRequestCache: PropTypes.bool,
9850
9903
  wrapper: PropTypes.oneOf(["div", "span", "svg"])
9851
9904
  };
@@ -40659,8 +40712,8 @@ function getTextSelection(selection, doc2) {
40659
40712
  }
40660
40713
  var MAX_ATTEMPTS = 3;
40661
40714
  function createDocumentNode(props) {
40662
- const { content: content2, schema, document: document2, stringHandler: stringHandler2, onError: onError2, attempts = 0 } = props;
40663
- const attemptsRemaining = onError2 && attempts <= MAX_ATTEMPTS || attempts === 0;
40715
+ const { content: content2, schema, document: document2, stringHandler: stringHandler2, onError: onError3, attempts = 0 } = props;
40716
+ const attemptsRemaining = onError3 && attempts <= MAX_ATTEMPTS || attempts === 0;
40664
40717
  invariant$2(attemptsRemaining, {
40665
40718
  code: ErrorConstant.INVALID_CONTENT,
40666
40719
  message: "The invalid content has been called recursively more than ${MAX_ATTEMPTS} times. The content is invalid and the error handler has not been able to recover properly."
@@ -40683,7 +40736,7 @@ function createDocumentNode(props) {
40683
40736
  return schema.nodeFromJSON(content2);
40684
40737
  } catch (error2) {
40685
40738
  const details2 = getInvalidContent({ schema, error: error2, json: content2 });
40686
- const transformedContent = onError2 == null ? void 0 : onError2(details2);
40739
+ const transformedContent = onError3 == null ? void 0 : onError3(details2);
40687
40740
  invariant$2(transformedContent, {
40688
40741
  code: ErrorConstant.INVALID_CONTENT,
40689
40742
  message: `An error occurred when processing the content. Please provide an \`onError\` handler to process the invalid content: ${JSON.stringify(
@@ -45643,7 +45696,7 @@ var _RemirrorManager = class {
45643
45696
  return doc2;
45644
45697
  }
45645
45698
  createState(props = {}) {
45646
- const { onError: onError2, defaultSelection = "end" } = this.settings;
45699
+ const { onError: onError3, defaultSelection = "end" } = this.settings;
45647
45700
  const {
45648
45701
  content: content2 = this.createEmptyDoc(),
45649
45702
  selection = defaultSelection,
@@ -45654,7 +45707,7 @@ var _RemirrorManager = class {
45654
45707
  stringHandler: isString$2(stringHandler2) ? this.stringHandlers[stringHandler2] : stringHandler2,
45655
45708
  document: this.document,
45656
45709
  content: content2,
45657
- onError: onError2,
45710
+ onError: onError3,
45658
45711
  schema,
45659
45712
  selection
45660
45713
  });
@@ -51873,7 +51926,7 @@ __publicField(Hooks, "passThroughHooks", /* @__PURE__ */ new Set([
51873
51926
  "preprocess",
51874
51927
  "postprocess"
51875
51928
  ]));
51876
- function onError(silent, async, callback) {
51929
+ function onError2(silent, async, callback) {
51877
51930
  return (e2) => {
51878
51931
  e2.message += "\nPlease report this to https://github.com/markedjs/marked.";
51879
51932
  if (silent) {
@@ -51905,7 +51958,7 @@ function parseMarkdown(lexer2, parser2) {
51905
51958
  }
51906
51959
  const origOpt = { ...opt };
51907
51960
  opt = { ...marked.defaults, ...origOpt };
51908
- const throwError = onError(opt.silent, opt.async, callback);
51961
+ const throwError = onError2(opt.silent, opt.async, callback);
51909
51962
  if (typeof src === "undefined" || src === null) {
51910
51963
  return throwError(new Error("marked(): input parameter is undefined or null"));
51911
51964
  }
@@ -62557,8 +62610,8 @@ class RawTask {
62557
62610
  this.release(this);
62558
62611
  }
62559
62612
  }
62560
- constructor(onError2, release) {
62561
- this.onError = onError2;
62613
+ constructor(onError3, release) {
62614
+ this.onError = onError3;
62562
62615
  this.release = release;
62563
62616
  this.task = null;
62564
62617
  }
@@ -62573,8 +62626,8 @@ class TaskFactory {
62573
62626
  t1.task = task;
62574
62627
  return t1;
62575
62628
  }
62576
- constructor(onError2) {
62577
- this.onError = onError2;
62629
+ constructor(onError3) {
62630
+ this.onError = onError3;
62578
62631
  this.freeTasks = [];
62579
62632
  }
62580
62633
  }