@nokecy/qc-ui 1.0.65 → 1.0.67

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 (197) hide show
  1. package/dist/cjs/RuleBuilder/LogicSelector.d.ts +23 -0
  2. package/dist/cjs/RuleBuilder/LogicSelector.js +54 -0
  3. package/dist/cjs/RuleBuilder/RuleBuilderContainer.d.ts +20 -0
  4. package/dist/cjs/RuleBuilder/RuleBuilderContainer.js +209 -0
  5. package/dist/cjs/RuleBuilder/RuleCard.d.ts +20 -0
  6. package/dist/cjs/RuleBuilder/RuleCard.js +196 -0
  7. package/dist/cjs/RuleBuilder/RuleGroupEditor.d.ts +25 -0
  8. package/dist/cjs/RuleBuilder/RuleGroupEditor.js +191 -0
  9. package/dist/cjs/RuleBuilder/constants/operators.d.ts +47 -0
  10. package/dist/cjs/RuleBuilder/constants/operators.js +172 -0
  11. package/dist/cjs/RuleBuilder/context/RuleBuilderContext.d.ts +72 -0
  12. package/dist/cjs/RuleBuilder/context/RuleBuilderContext.js +286 -0
  13. package/dist/cjs/RuleBuilder/index.d.ts +25 -0
  14. package/dist/cjs/RuleBuilder/index.js +308 -0
  15. package/dist/cjs/RuleBuilder/inputs/BetweenValueInput.d.ts +23 -0
  16. package/dist/cjs/RuleBuilder/inputs/BetweenValueInput.js +80 -0
  17. package/dist/cjs/RuleBuilder/inputs/MultiValueInput.d.ts +21 -0
  18. package/dist/cjs/RuleBuilder/inputs/MultiValueInput.js +128 -0
  19. package/dist/cjs/RuleBuilder/inputs/SingleValueInput.d.ts +25 -0
  20. package/dist/cjs/RuleBuilder/inputs/SingleValueInput.js +81 -0
  21. package/dist/cjs/RuleBuilder/inputs/ValueInput.d.ts +29 -0
  22. package/dist/cjs/RuleBuilder/inputs/ValueInput.js +80 -0
  23. package/dist/cjs/RuleBuilder/selectors/FieldSelector.d.ts +22 -0
  24. package/dist/cjs/RuleBuilder/selectors/FieldSelector.js +45 -0
  25. package/dist/cjs/RuleBuilder/selectors/OperatorSelector.d.ts +22 -0
  26. package/dist/cjs/RuleBuilder/selectors/OperatorSelector.js +51 -0
  27. package/dist/cjs/RuleBuilder/styles/index.module.less +443 -0
  28. package/dist/cjs/RuleBuilder/styles/index.module.less.d.ts +43 -0
  29. package/dist/cjs/RuleBuilder/types/index.d.ts +232 -0
  30. package/dist/cjs/RuleBuilder/types/index.js +83 -0
  31. package/dist/cjs/RuleBuilder/utils/pathHelpers.d.ts +65 -0
  32. package/dist/cjs/RuleBuilder/utils/pathHelpers.js +241 -0
  33. package/dist/cjs/RuleBuilder/utils/ruleHelpers.d.ts +47 -0
  34. package/dist/cjs/RuleBuilder/utils/ruleHelpers.js +154 -0
  35. package/dist/cjs/RuleBuilder/utils/validation.d.ts +25 -0
  36. package/dist/cjs/RuleBuilder/utils/validation.js +241 -0
  37. package/dist/cjs/components/RegexEditor/core/RegexEditor.d.ts +34 -0
  38. package/dist/cjs/components/RegexEditor/core/RegexEditor.js +223 -0
  39. package/dist/cjs/components/RegexEditor/core/RegexEditor.less +119 -0
  40. package/dist/cjs/components/RegexEditor/core/extensions/errorMarker.d.ts +49 -0
  41. package/dist/cjs/components/RegexEditor/core/extensions/errorMarker.js +158 -0
  42. package/dist/cjs/components/RegexEditor/core/types.d.ts +79 -0
  43. package/dist/cjs/components/RegexEditor/core/types.js +5 -0
  44. package/dist/cjs/components/RegexEditor/hooks/index.d.ts +9 -0
  45. package/dist/cjs/components/RegexEditor/hooks/index.js +19 -0
  46. package/dist/cjs/components/RegexEditor/hooks/useRegexTester.d.ts +95 -0
  47. package/dist/cjs/components/RegexEditor/hooks/useRegexTester.js +234 -0
  48. package/dist/cjs/components/RegexEditor/hooks/useRegexValidation.d.ts +71 -0
  49. package/dist/cjs/components/RegexEditor/hooks/useRegexValidation.js +215 -0
  50. package/dist/cjs/components/RegexEditor/hooks/useTemplateManager.d.ts +64 -0
  51. package/dist/cjs/components/RegexEditor/hooks/useTemplateManager.js +438 -0
  52. package/dist/cjs/components/RegexEditor/index.d.ts +16 -0
  53. package/dist/cjs/components/RegexEditor/index.js +232 -0
  54. package/dist/cjs/components/RegexEditor/templates/TemplateSelector.d.ts +36 -0
  55. package/dist/cjs/components/RegexEditor/templates/TemplateSelector.js +322 -0
  56. package/dist/cjs/components/RegexEditor/templates/builtinTemplates.d.ts +36 -0
  57. package/dist/cjs/components/RegexEditor/templates/builtinTemplates.js +340 -0
  58. package/dist/cjs/components/RegexEditor/templates/index.d.ts +10 -0
  59. package/dist/cjs/components/RegexEditor/templates/index.js +184 -0
  60. package/dist/cjs/components/RegexEditor/templates/storage.d.ts +74 -0
  61. package/dist/cjs/components/RegexEditor/templates/storage.js +337 -0
  62. package/dist/cjs/components/RegexEditor/templates/templateManager.d.ts +67 -0
  63. package/dist/cjs/components/RegexEditor/templates/templateManager.js +277 -0
  64. package/dist/cjs/components/RegexEditor/templates/types.d.ts +111 -0
  65. package/dist/cjs/components/RegexEditor/templates/types.js +94 -0
  66. package/dist/cjs/components/RegexEditor/testing/types.d.ts +55 -0
  67. package/dist/cjs/components/RegexEditor/testing/types.js +5 -0
  68. package/dist/cjs/components/RegexEditor/validation/complexity.d.ts +22 -0
  69. package/dist/cjs/components/RegexEditor/validation/complexity.js +196 -0
  70. package/dist/cjs/components/RegexEditor/validation/parser.d.ts +53 -0
  71. package/dist/cjs/components/RegexEditor/validation/parser.js +129 -0
  72. package/dist/cjs/components/RegexEditor/validation/types.d.ts +146 -0
  73. package/dist/cjs/components/RegexEditor/validation/types.js +5 -0
  74. package/dist/cjs/components/RegexEditor/validation/validator.d.ts +60 -0
  75. package/dist/cjs/components/RegexEditor/validation/validator.js +218 -0
  76. package/dist/cjs/components/RegexEditor/visualizer/FlagsSelector.d.ts +20 -0
  77. package/dist/cjs/components/RegexEditor/visualizer/FlagsSelector.js +98 -0
  78. package/dist/cjs/components/RegexEditor/visualizer/MatchItem.d.ts +25 -0
  79. package/dist/cjs/components/RegexEditor/visualizer/MatchItem.js +201 -0
  80. package/dist/cjs/components/RegexEditor/visualizer/RegexRailroadDiagram.d.ts +32 -0
  81. package/dist/cjs/components/RegexEditor/visualizer/RegexRailroadDiagram.js +192 -0
  82. package/dist/cjs/components/RegexEditor/visualizer/RegexTester.d.ts +22 -0
  83. package/dist/cjs/components/RegexEditor/visualizer/RegexTester.js +255 -0
  84. package/dist/cjs/components/RegexEditor/visualizer/astToRailroad.d.ts +19 -0
  85. package/dist/cjs/components/RegexEditor/visualizer/astToRailroad.js +155 -0
  86. package/dist/cjs/components/RegexEditor/visualizer/index.d.ts +12 -0
  87. package/dist/cjs/components/RegexEditor/visualizer/index.js +76 -0
  88. package/dist/cjs/components/RegexEditor/visualizer/types.d.ts +131 -0
  89. package/dist/cjs/components/RegexEditor/visualizer/types.js +5 -0
  90. package/dist/cjs/components/RegexEditor/visualizer/utils.d.ts +106 -0
  91. package/dist/cjs/components/RegexEditor/visualizer/utils.js +268 -0
  92. package/dist/cjs/index.d.ts +5 -1
  93. package/dist/cjs/index.js +62 -0
  94. package/dist/cjs/standardFormDialog/StandardFormDialog.js +26 -5
  95. package/dist/cjs/standardFormDialog/useStandardFormSchema.d.ts +1 -1
  96. package/dist/cjs/standardFormDialog/withStandardForm.d.ts +2 -2
  97. package/dist/cjs/types/railroad-diagrams.d.ts +59 -0
  98. package/dist/cjs/types/regexp-tree.d.ts +175 -0
  99. package/dist/esm/RuleBuilder/LogicSelector.d.ts +23 -0
  100. package/dist/esm/RuleBuilder/LogicSelector.js +47 -0
  101. package/dist/esm/RuleBuilder/RuleBuilderContainer.d.ts +20 -0
  102. package/dist/esm/RuleBuilder/RuleBuilderContainer.js +203 -0
  103. package/dist/esm/RuleBuilder/RuleCard.d.ts +20 -0
  104. package/dist/esm/RuleBuilder/RuleCard.js +191 -0
  105. package/dist/esm/RuleBuilder/RuleGroupEditor.d.ts +25 -0
  106. package/dist/esm/RuleBuilder/RuleGroupEditor.js +184 -0
  107. package/dist/esm/RuleBuilder/constants/operators.d.ts +47 -0
  108. package/dist/esm/RuleBuilder/constants/operators.js +169 -0
  109. package/dist/esm/RuleBuilder/context/RuleBuilderContext.d.ts +72 -0
  110. package/dist/esm/RuleBuilder/context/RuleBuilderContext.js +271 -0
  111. package/dist/esm/RuleBuilder/index.d.ts +25 -0
  112. package/dist/esm/RuleBuilder/index.js +42 -0
  113. package/dist/esm/RuleBuilder/inputs/BetweenValueInput.d.ts +23 -0
  114. package/dist/esm/RuleBuilder/inputs/BetweenValueInput.js +73 -0
  115. package/dist/esm/RuleBuilder/inputs/MultiValueInput.d.ts +21 -0
  116. package/dist/esm/RuleBuilder/inputs/MultiValueInput.js +121 -0
  117. package/dist/esm/RuleBuilder/inputs/SingleValueInput.d.ts +25 -0
  118. package/dist/esm/RuleBuilder/inputs/SingleValueInput.js +74 -0
  119. package/dist/esm/RuleBuilder/inputs/ValueInput.d.ts +29 -0
  120. package/dist/esm/RuleBuilder/inputs/ValueInput.js +73 -0
  121. package/dist/esm/RuleBuilder/selectors/FieldSelector.d.ts +22 -0
  122. package/dist/esm/RuleBuilder/selectors/FieldSelector.js +38 -0
  123. package/dist/esm/RuleBuilder/selectors/OperatorSelector.d.ts +22 -0
  124. package/dist/esm/RuleBuilder/selectors/OperatorSelector.js +44 -0
  125. package/dist/esm/RuleBuilder/styles/index.module.less +443 -0
  126. package/dist/esm/RuleBuilder/styles/index.module.less.d.ts +43 -0
  127. package/dist/esm/RuleBuilder/types/index.d.ts +232 -0
  128. package/dist/esm/RuleBuilder/types/index.js +91 -0
  129. package/dist/esm/RuleBuilder/utils/pathHelpers.d.ts +65 -0
  130. package/dist/esm/RuleBuilder/utils/pathHelpers.js +228 -0
  131. package/dist/esm/RuleBuilder/utils/ruleHelpers.d.ts +47 -0
  132. package/dist/esm/RuleBuilder/utils/ruleHelpers.js +145 -0
  133. package/dist/esm/RuleBuilder/utils/validation.d.ts +25 -0
  134. package/dist/esm/RuleBuilder/utils/validation.js +236 -0
  135. package/dist/esm/components/RegexEditor/core/RegexEditor.d.ts +34 -0
  136. package/dist/esm/components/RegexEditor/core/RegexEditor.js +214 -0
  137. package/dist/esm/components/RegexEditor/core/RegexEditor.less +119 -0
  138. package/dist/esm/components/RegexEditor/core/extensions/errorMarker.d.ts +49 -0
  139. package/dist/esm/components/RegexEditor/core/extensions/errorMarker.js +154 -0
  140. package/dist/esm/components/RegexEditor/core/types.d.ts +79 -0
  141. package/dist/esm/components/RegexEditor/core/types.js +1 -0
  142. package/dist/esm/components/RegexEditor/hooks/index.d.ts +9 -0
  143. package/dist/esm/components/RegexEditor/hooks/index.js +8 -0
  144. package/dist/esm/components/RegexEditor/hooks/useRegexTester.d.ts +95 -0
  145. package/dist/esm/components/RegexEditor/hooks/useRegexTester.js +230 -0
  146. package/dist/esm/components/RegexEditor/hooks/useRegexValidation.d.ts +71 -0
  147. package/dist/esm/components/RegexEditor/hooks/useRegexValidation.js +211 -0
  148. package/dist/esm/components/RegexEditor/hooks/useTemplateManager.d.ts +64 -0
  149. package/dist/esm/components/RegexEditor/hooks/useTemplateManager.js +430 -0
  150. package/dist/esm/components/RegexEditor/index.d.ts +16 -0
  151. package/dist/esm/components/RegexEditor/index.js +27 -0
  152. package/dist/esm/components/RegexEditor/templates/TemplateSelector.d.ts +36 -0
  153. package/dist/esm/components/RegexEditor/templates/TemplateSelector.js +316 -0
  154. package/dist/esm/components/RegexEditor/templates/builtinTemplates.d.ts +36 -0
  155. package/dist/esm/components/RegexEditor/templates/builtinTemplates.js +335 -0
  156. package/dist/esm/components/RegexEditor/templates/index.d.ts +10 -0
  157. package/dist/esm/components/RegexEditor/templates/index.js +19 -0
  158. package/dist/esm/components/RegexEditor/templates/storage.d.ts +74 -0
  159. package/dist/esm/components/RegexEditor/templates/storage.js +335 -0
  160. package/dist/esm/components/RegexEditor/templates/templateManager.d.ts +67 -0
  161. package/dist/esm/components/RegexEditor/templates/templateManager.js +274 -0
  162. package/dist/esm/components/RegexEditor/templates/types.d.ts +111 -0
  163. package/dist/esm/components/RegexEditor/templates/types.js +90 -0
  164. package/dist/esm/components/RegexEditor/testing/types.d.ts +55 -0
  165. package/dist/esm/components/RegexEditor/testing/types.js +1 -0
  166. package/dist/esm/components/RegexEditor/validation/complexity.d.ts +22 -0
  167. package/dist/esm/components/RegexEditor/validation/complexity.js +190 -0
  168. package/dist/esm/components/RegexEditor/validation/parser.d.ts +53 -0
  169. package/dist/esm/components/RegexEditor/validation/parser.js +123 -0
  170. package/dist/esm/components/RegexEditor/validation/types.d.ts +145 -0
  171. package/dist/esm/components/RegexEditor/validation/types.js +1 -0
  172. package/dist/esm/components/RegexEditor/validation/validator.d.ts +60 -0
  173. package/dist/esm/components/RegexEditor/validation/validator.js +213 -0
  174. package/dist/esm/components/RegexEditor/visualizer/FlagsSelector.d.ts +20 -0
  175. package/dist/esm/components/RegexEditor/visualizer/FlagsSelector.js +93 -0
  176. package/dist/esm/components/RegexEditor/visualizer/MatchItem.d.ts +25 -0
  177. package/dist/esm/components/RegexEditor/visualizer/MatchItem.js +194 -0
  178. package/dist/esm/components/RegexEditor/visualizer/RegexRailroadDiagram.d.ts +32 -0
  179. package/dist/esm/components/RegexEditor/visualizer/RegexRailroadDiagram.js +186 -0
  180. package/dist/esm/components/RegexEditor/visualizer/RegexTester.d.ts +22 -0
  181. package/dist/esm/components/RegexEditor/visualizer/RegexTester.js +248 -0
  182. package/dist/esm/components/RegexEditor/visualizer/astToRailroad.d.ts +18 -0
  183. package/dist/esm/components/RegexEditor/visualizer/astToRailroad.js +150 -0
  184. package/dist/esm/components/RegexEditor/visualizer/index.d.ts +12 -0
  185. package/dist/esm/components/RegexEditor/visualizer/index.js +17 -0
  186. package/dist/esm/components/RegexEditor/visualizer/types.d.ts +131 -0
  187. package/dist/esm/components/RegexEditor/visualizer/types.js +1 -0
  188. package/dist/esm/components/RegexEditor/visualizer/utils.d.ts +106 -0
  189. package/dist/esm/components/RegexEditor/visualizer/utils.js +256 -0
  190. package/dist/esm/index.d.ts +5 -1
  191. package/dist/esm/index.js +6 -2
  192. package/dist/esm/standardFormDialog/StandardFormDialog.js +26 -5
  193. package/dist/esm/types/railroad-diagrams.d.ts +59 -0
  194. package/dist/esm/types/regexp-tree.d.ts +175 -0
  195. package/dist/umd/qc-ui.min.css +1 -1
  196. package/dist/umd/qc-ui.min.js +1 -1
  197. package/package.json +23 -7
@@ -0,0 +1,211 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ import _debounce from "lodash-es/debounce";
3
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
4
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+ /**
13
+ * useRegexValidation Hook
14
+ *
15
+ * @description
16
+ * React Hook 用于正则表达式验证,集成解析、验证、复杂度分析。
17
+ * 提供去抖优化和完整的状态管理。
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * const { validationResult, complexity, isValidating } = useRegexValidation(pattern);
22
+ *
23
+ * if (validationResult?.valid) {
24
+ * console.log('验证通过');
25
+ * } else {
26
+ * console.error('错误:', validationResult?.errors);
27
+ * }
28
+ *
29
+ * if (complexity?.backtrackingRisk === 'high') {
30
+ * console.warn('高回溯风险:', complexity.suggestions);
31
+ * }
32
+ * ```
33
+ */
34
+
35
+ import { useState, useEffect, useCallback, useRef } from 'react';
36
+ import { parseRegex } from "../validation/parser";
37
+ import { validateRegex } from "../validation/validator";
38
+ import { analyzeComplexity } from "../validation/complexity";
39
+
40
+ /**
41
+ * useRegexValidation Hook 返回值
42
+ */
43
+
44
+ /**
45
+ * 正则表达式验证 Hook
46
+ *
47
+ * @param pattern - 正则表达式字符串
48
+ * @param options - 配置选项
49
+ * @param options.debounceMs - 去抖延迟时间(默认 300ms)
50
+ * @returns {UseRegexValidationResult} 验证结果和方法
51
+ *
52
+ * @remarks
53
+ * 该 Hook 提供以下功能:
54
+ * - 自动验证: 监听 pattern 变化并自动触发验证
55
+ * - 去抖优化: 300ms 防抖延迟,避免频繁验证
56
+ * - 完整状态: validationResult, complexity, isValidating
57
+ * - 手动验证: 提供 validate 方法支持手动触发
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * function MyComponent() {
62
+ * const [pattern, setPattern] = useState('');
63
+ * const { validationResult, complexity, isValidating } = useRegexValidation(pattern);
64
+ *
65
+ * return (
66
+ * <div>
67
+ * <input value={pattern} onChange={e => setPattern(e.target.value)} />
68
+ * {isValidating && <Spin />}
69
+ * {validationResult?.errors.map(err => <Alert key={err.type} message={err.message} />)}
70
+ * {complexity && <Badge>性能评分: {complexity.performanceScore}</Badge>}
71
+ * </div>
72
+ * );
73
+ * }
74
+ * ```
75
+ */
76
+ export var useRegexValidation = function useRegexValidation(pattern) {
77
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
78
+ var _options$debounceMs = options.debounceMs,
79
+ debounceMs = _options$debounceMs === void 0 ? 300 : _options$debounceMs;
80
+
81
+ // 状态
82
+ var _useState = useState(null),
83
+ _useState2 = _slicedToArray(_useState, 2),
84
+ validationResult = _useState2[0],
85
+ setValidationResult = _useState2[1];
86
+ var _useState3 = useState(null),
87
+ _useState4 = _slicedToArray(_useState3, 2),
88
+ complexity = _useState4[0],
89
+ setComplexity = _useState4[1];
90
+ var _useState5 = useState(false),
91
+ _useState6 = _slicedToArray(_useState5, 2),
92
+ isValidating = _useState6[0],
93
+ setIsValidating = _useState6[1];
94
+
95
+ // 验证函数
96
+ var validate = useCallback( /*#__PURE__*/function () {
97
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {
98
+ var parseResult, allErrors, errors, warnings, infos, complexityMetrics;
99
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
100
+ while (1) switch (_context.prev = _context.next) {
101
+ case 0:
102
+ if (value) {
103
+ _context.next = 4;
104
+ break;
105
+ }
106
+ setValidationResult(null);
107
+ setComplexity(null);
108
+ return _context.abrupt("return");
109
+ case 4:
110
+ setIsValidating(true);
111
+ _context.prev = 5;
112
+ // 1. 解析正则表达式
113
+ parseResult = parseRegex(value);
114
+ if (parseResult.success) {
115
+ _context.next = 11;
116
+ break;
117
+ }
118
+ // 解析失败
119
+ setValidationResult({
120
+ valid: false,
121
+ errors: [parseResult.error],
122
+ warnings: [],
123
+ infos: [],
124
+ pattern: value
125
+ });
126
+ setComplexity(null);
127
+ return _context.abrupt("return");
128
+ case 11:
129
+ // 2. 语法验证
130
+ allErrors = validateRegex(parseResult.ast); // 3. 分类错误、警告和信息
131
+ errors = allErrors.filter(function (e) {
132
+ return e.severity === 'error';
133
+ });
134
+ warnings = allErrors.filter(function (e) {
135
+ return e.severity === 'warning';
136
+ });
137
+ infos = allErrors.filter(function (e) {
138
+ return e.severity === 'info';
139
+ }); // 4. 复杂度分析
140
+ complexityMetrics = analyzeComplexity(parseResult.ast); // 5. 更新状态
141
+ setValidationResult({
142
+ valid: errors.length === 0,
143
+ // 只有错误才影响 valid 状态
144
+ errors: errors,
145
+ warnings: warnings,
146
+ infos: infos,
147
+ pattern: value
148
+ });
149
+ setComplexity(complexityMetrics);
150
+ _context.next = 25;
151
+ break;
152
+ case 20:
153
+ _context.prev = 20;
154
+ _context.t0 = _context["catch"](5);
155
+ // 异常处理
156
+ console.error('Validation error:', _context.t0);
157
+ setValidationResult({
158
+ valid: false,
159
+ errors: [{
160
+ type: 'unknown_error',
161
+ message: '验证过程出错',
162
+ position: {
163
+ start: 0,
164
+ end: value.length
165
+ },
166
+ severity: 'error'
167
+ }],
168
+ warnings: [],
169
+ infos: [],
170
+ pattern: value
171
+ });
172
+ setComplexity(null);
173
+ case 25:
174
+ _context.prev = 25;
175
+ setIsValidating(false);
176
+ return _context.finish(25);
177
+ case 28:
178
+ case "end":
179
+ return _context.stop();
180
+ }
181
+ }, _callee, null, [[5, 20, 25, 28]]);
182
+ }));
183
+ return function (_x) {
184
+ return _ref.apply(this, arguments);
185
+ };
186
+ }(), []);
187
+
188
+ // 防抖验证函数
189
+ // 使用 useRef 保存防抖函数,避免在每次渲染时重新创建
190
+ var debouncedValidateRef = useRef(_debounce(function (value) {
191
+ validate(value);
192
+ }, debounceMs));
193
+
194
+ // 监听 pattern 变化
195
+ useEffect(function () {
196
+ debouncedValidateRef.current(pattern);
197
+
198
+ // 清理函数: 组件卸载时取消防抖
199
+ return function () {
200
+ debouncedValidateRef.current.cancel();
201
+ };
202
+ }, [pattern]);
203
+
204
+ // 返回结果
205
+ return {
206
+ validationResult: validationResult,
207
+ complexity: complexity,
208
+ isValidating: isValidating,
209
+ validate: validate
210
+ };
211
+ };
@@ -0,0 +1,64 @@
1
+ /**
2
+ * useTemplateManager Hook
3
+ * 提供完整的模板管理功能,包括加载、创建、更新、删除、搜索等
4
+ */
5
+ import type { RegexTemplate } from '../templates/types';
6
+ import { TemplateCategory } from '../templates/types';
7
+ import { getTemplateStats } from '../templates';
8
+ export interface UseTemplateManagerOptions {
9
+ /**
10
+ * 是否自动加载模板
11
+ * @default true
12
+ */
13
+ autoLoad?: boolean;
14
+ /**
15
+ * 初始搜索关键词
16
+ */
17
+ initialKeyword?: string;
18
+ /**
19
+ * 初始分类过滤
20
+ */
21
+ initialCategory?: TemplateCategory | 'all';
22
+ /**
23
+ * 初始排序方式
24
+ */
25
+ initialSortBy?: 'default' | 'popular' | 'recent';
26
+ }
27
+ export interface UseTemplateManagerReturn {
28
+ templates: RegexTemplate[];
29
+ filteredTemplates: RegexTemplate[];
30
+ selectedTemplate: RegexTemplate | null;
31
+ searchKeyword: string;
32
+ selectedCategory: TemplateCategory | 'all';
33
+ sortBy: 'default' | 'popular' | 'recent';
34
+ stats: ReturnType<typeof getTemplateStats>;
35
+ isStorageAvailable: boolean;
36
+ loading: boolean;
37
+ error: string | null;
38
+ selectTemplate: (id: string) => void;
39
+ clearSelection: () => void;
40
+ useTemplate: (id: string) => RegexTemplate | undefined;
41
+ setSearchKeyword: (keyword: string) => void;
42
+ setSelectedCategory: (category: TemplateCategory | 'all') => void;
43
+ setSortBy: (sortBy: 'default' | 'popular' | 'recent') => void;
44
+ resetFilters: () => void;
45
+ createTemplate: (template: Omit<RegexTemplate, 'id' | 'isCustom' | 'useCount' | 'lastUsed'>) => Promise<RegexTemplate>;
46
+ updateTemplate: (id: string, updates: Partial<Omit<RegexTemplate, 'id' | 'isCustom'>>) => Promise<boolean>;
47
+ deleteTemplate: (id: string) => Promise<boolean>;
48
+ duplicateTemplate: (id: string, newName?: string) => Promise<RegexTemplate | null>;
49
+ deleteMultipleTemplates: (ids: string[]) => Promise<boolean>;
50
+ clearAllCustomTemplates: () => Promise<boolean>;
51
+ exportTemplates: () => string;
52
+ importTemplates: (jsonString: string, merge?: boolean) => Promise<boolean>;
53
+ validateTemplate: (template: Partial<RegexTemplate>) => {
54
+ valid: boolean;
55
+ errors: string[];
56
+ };
57
+ getMostUsedTemplates: (limit?: number) => RegexTemplate[];
58
+ getRecentlyUsedTemplates: (limit?: number) => RegexTemplate[];
59
+ refresh: () => void;
60
+ }
61
+ /**
62
+ * useTemplateManager Hook
63
+ */
64
+ export declare const useTemplateManager: (options?: UseTemplateManagerOptions) => UseTemplateManagerReturn;