@trishchuk/coolors-mcp 1.0.0 → 1.0.1

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 (66) hide show
  1. package/.claude/settings.local.json +2 -6
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +20 -8
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +22 -8
  4. package/.github/pull_request_template.md +33 -8
  5. package/.github/workflows/ci.yml +97 -97
  6. package/.github/workflows/deploy-docs.yml +9 -9
  7. package/.github/workflows/release.yml +15 -15
  8. package/README.md +26 -1
  9. package/TOOLS_UK.md +233 -0
  10. package/docs/.vitepress/cache/deps/@braintree_sanitize-url.js +30 -12
  11. package/docs/.vitepress/cache/deps/_metadata.json +1 -1
  12. package/docs/.vitepress/cache/deps/chunk-BUSYA2B4.js +9 -6
  13. package/docs/.vitepress/cache/deps/chunk-JD3CXNQ6.js +2543 -1612
  14. package/docs/.vitepress/cache/deps/chunk-SYPOPCWC.js +3508 -2529
  15. package/docs/.vitepress/cache/deps/cytoscape-cose-bilkent.js +1902 -1003
  16. package/docs/.vitepress/cache/deps/cytoscape.js +13303 -7347
  17. package/docs/.vitepress/cache/deps/dayjs.js +494 -272
  18. package/docs/.vitepress/cache/deps/debug.js +82 -38
  19. package/docs/.vitepress/cache/deps/prismjs.js +444 -272
  20. package/docs/.vitepress/cache/deps/prismjs_components_prism-bash.js +80 -73
  21. package/docs/.vitepress/cache/deps/prismjs_components_prism-javascript.js +93 -62
  22. package/docs/.vitepress/cache/deps/prismjs_components_prism-json.js +13 -13
  23. package/docs/.vitepress/cache/deps/prismjs_components_prism-python.js +34 -27
  24. package/docs/.vitepress/cache/deps/prismjs_components_prism-typescript.js +20 -17
  25. package/docs/.vitepress/cache/deps/prismjs_components_prism-yaml.js +75 -41
  26. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +2005 -1438
  27. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +2 -2
  28. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +566 -229
  29. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +382 -270
  30. package/docs/.vitepress/cache/deps/vitepress___minisearch.js +334 -125
  31. package/docs/.vitepress/cache/deps/vue.js +2 -2
  32. package/docs/.vitepress/components/ClientGrid.vue +9 -3
  33. package/docs/.vitepress/components/CodeBlock.vue +51 -44
  34. package/docs/.vitepress/components/ConfigModal.vue +151 -67
  35. package/docs/.vitepress/components/DiagramModal.vue +186 -154
  36. package/docs/.vitepress/components/TroubleshootingModal.vue +101 -96
  37. package/docs/.vitepress/config.js +171 -141
  38. package/docs/.vitepress/theme/FundingLayout.vue +65 -54
  39. package/docs/.vitepress/theme/Layout.vue +21 -21
  40. package/docs/.vitepress/theme/components/AdBanner.vue +73 -52
  41. package/docs/.vitepress/theme/components/AdPlaceholder.vue +3 -3
  42. package/docs/.vitepress/theme/components/FundingEffects.vue +77 -53
  43. package/docs/.vitepress/theme/components/FundingHero.vue +78 -63
  44. package/docs/.vitepress/theme/components/SupportSection.vue +106 -89
  45. package/docs/.vitepress/theme/custom-app.css +19 -12
  46. package/docs/.vitepress/theme/custom.css +33 -25
  47. package/docs/.vitepress/theme/index.js +19 -16
  48. package/docs/concepts/accessibility.md +59 -47
  49. package/docs/concepts/color-spaces.md +28 -6
  50. package/docs/concepts/distance-metrics.md +45 -30
  51. package/docs/concepts/hct.md +30 -27
  52. package/docs/concepts/image-analysis.md +52 -21
  53. package/docs/concepts/material-design.md +43 -17
  54. package/docs/concepts/theme-matching.md +64 -40
  55. package/docs/examples/basic-colors.md +92 -108
  56. package/docs/examples/creating-themes.md +104 -108
  57. package/docs/examples/css-refactoring.md +33 -29
  58. package/docs/examples/image-extraction.md +145 -138
  59. package/docs/getting-started.md +45 -34
  60. package/docs/index.md +5 -1
  61. package/docs/installation.md +15 -1
  62. package/docs/tools/accessibility.md +74 -68
  63. package/docs/tools/image-extraction.md +62 -54
  64. package/docs/tools/theme-matching.md +45 -42
  65. package/note.md +1 -2
  66. package/package.json +2 -2
@@ -30,7 +30,14 @@ var DOMIterator = class _DOMIterator {
30
30
  * @access public
31
31
  */
32
32
  static matches(element, selector) {
33
- const selectors = typeof selector === "string" ? [selector] : selector, fn = element.matches || element.matchesSelector || element.msMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector || element.webkitMatchesSelector;
33
+ const selectors = typeof selector === "string" ? [selector] : selector,
34
+ fn =
35
+ element.matches ||
36
+ element.matchesSelector ||
37
+ element.msMatchesSelector ||
38
+ element.mozMatchesSelector ||
39
+ element.oMatchesSelector ||
40
+ element.webkitMatchesSelector;
34
41
  if (fn) {
35
42
  let match = false;
36
43
  selectors.every((sel) => {
@@ -51,7 +58,8 @@ var DOMIterator = class _DOMIterator {
51
58
  * @access protected
52
59
  */
53
60
  getContexts() {
54
- let ctx, filteredCtx = [];
61
+ let ctx,
62
+ filteredCtx = [];
55
63
  if (typeof this.ctx === "undefined" || !this.ctx) {
56
64
  ctx = [];
57
65
  } else if (NodeList.prototype.isPrototypeOf(this.ctx)) {
@@ -59,16 +67,15 @@ var DOMIterator = class _DOMIterator {
59
67
  } else if (Array.isArray(this.ctx)) {
60
68
  ctx = this.ctx;
61
69
  } else if (typeof this.ctx === "string") {
62
- ctx = Array.prototype.slice.call(
63
- document.querySelectorAll(this.ctx)
64
- );
70
+ ctx = Array.prototype.slice.call(document.querySelectorAll(this.ctx));
65
71
  } else {
66
72
  ctx = [this.ctx];
67
73
  }
68
74
  ctx.forEach((ctx2) => {
69
- const isDescendant = filteredCtx.filter((contexts) => {
70
- return contexts.contains(ctx2);
71
- }).length > 0;
75
+ const isDescendant =
76
+ filteredCtx.filter((contexts) => {
77
+ return contexts.contains(ctx2);
78
+ }).length > 0;
72
79
  if (filteredCtx.indexOf(ctx2) === -1 && !isDescendant) {
73
80
  filteredCtx.push(ctx2);
74
81
  }
@@ -87,8 +94,7 @@ var DOMIterator = class _DOMIterator {
87
94
  * @param {function} [errorFn]
88
95
  * @access protected
89
96
  */
90
- getIframeContents(ifr, successFn, errorFn = () => {
91
- }) {
97
+ getIframeContents(ifr, successFn, errorFn = () => {}) {
92
98
  let doc;
93
99
  try {
94
100
  const ifrWin = ifr.contentWindow;
@@ -110,7 +116,9 @@ var DOMIterator = class _DOMIterator {
110
116
  * @access protected
111
117
  */
112
118
  isIframeBlank(ifr) {
113
- const bl = "about:blank", src = ifr.getAttribute("src").trim(), href = ifr.contentWindow.location.href;
119
+ const bl = "about:blank",
120
+ src = ifr.getAttribute("src").trim(),
121
+ href = ifr.contentWindow.location.href;
114
122
  return href === bl && src !== bl && src;
115
123
  }
116
124
  /**
@@ -124,7 +132,8 @@ var DOMIterator = class _DOMIterator {
124
132
  * @access protected
125
133
  */
126
134
  observeIframeLoad(ifr, successFn, errorFn) {
127
- let called = false, tout = null;
135
+ let called = false,
136
+ tout = null;
128
137
  const listener = () => {
129
138
  if (called) {
130
139
  return;
@@ -189,18 +198,23 @@ var DOMIterator = class _DOMIterator {
189
198
  */
190
199
  waitForIframes(ctx, done) {
191
200
  let eachCalled = 0;
192
- this.forEachIframe(ctx, () => true, (ifr) => {
193
- eachCalled++;
194
- this.waitForIframes(ifr.querySelector("html"), () => {
195
- if (!--eachCalled) {
201
+ this.forEachIframe(
202
+ ctx,
203
+ () => true,
204
+ (ifr) => {
205
+ eachCalled++;
206
+ this.waitForIframes(ifr.querySelector("html"), () => {
207
+ if (!--eachCalled) {
208
+ done();
209
+ }
210
+ });
211
+ },
212
+ (handled) => {
213
+ if (!handled) {
196
214
  done();
197
215
  }
198
- });
199
- }, (handled) => {
200
- if (!handled) {
201
- done();
202
- }
203
- });
216
+ },
217
+ );
204
218
  }
205
219
  /**
206
220
  * Callback allowing to filter an iframe. Must return true when the element
@@ -229,9 +243,10 @@ var DOMIterator = class _DOMIterator {
229
243
  * @param {DOMIterator~forEachIframeEndCallback} [end] - End callback
230
244
  * @access protected
231
245
  */
232
- forEachIframe(ctx, filter, each, end = () => {
233
- }) {
234
- let ifr = ctx.querySelectorAll("iframe"), open = ifr.length, handled = 0;
246
+ forEachIframe(ctx, filter, each, end = () => {}) {
247
+ let ifr = ctx.querySelectorAll("iframe"),
248
+ open = ifr.length,
249
+ handled = 0;
235
250
  ifr = Array.prototype.slice.call(ifr);
236
251
  const checkEnd = () => {
237
252
  if (--open <= 0) {
@@ -245,13 +260,17 @@ var DOMIterator = class _DOMIterator {
245
260
  if (_DOMIterator.matches(ifr2, this.exclude)) {
246
261
  checkEnd();
247
262
  } else {
248
- this.onIframeReady(ifr2, (con) => {
249
- if (filter(ifr2)) {
250
- handled++;
251
- each(con);
252
- }
253
- checkEnd();
254
- }, checkEnd);
263
+ this.onIframeReady(
264
+ ifr2,
265
+ (con) => {
266
+ if (filter(ifr2)) {
267
+ handled++;
268
+ each(con);
269
+ }
270
+ checkEnd();
271
+ },
272
+ checkEnd,
273
+ );
255
274
  }
256
275
  });
257
276
  }
@@ -287,10 +306,12 @@ var DOMIterator = class _DOMIterator {
287
306
  * @access protected
288
307
  */
289
308
  compareNodeIframe(node, prevNode, ifr) {
290
- const compCurr = node.compareDocumentPosition(ifr), prev = Node.DOCUMENT_POSITION_PRECEDING;
309
+ const compCurr = node.compareDocumentPosition(ifr),
310
+ prev = Node.DOCUMENT_POSITION_PRECEDING;
291
311
  if (compCurr & prev) {
292
312
  if (prevNode !== null) {
293
- const compPrev = prevNode.compareDocumentPosition(ifr), after = Node.DOCUMENT_POSITION_FOLLOWING;
313
+ const compPrev = prevNode.compareDocumentPosition(ifr),
314
+ after = Node.DOCUMENT_POSITION_FOLLOWING;
294
315
  if (compPrev & after) {
295
316
  return true;
296
317
  }
@@ -323,7 +344,7 @@ var DOMIterator = class _DOMIterator {
323
344
  }
324
345
  return {
325
346
  prevNode,
326
- node
347
+ node,
327
348
  };
328
349
  }
329
350
  /**
@@ -353,7 +374,8 @@ var DOMIterator = class _DOMIterator {
353
374
  * @access protected
354
375
  */
355
376
  checkIframeFilter(node, prevNode, currIfr, ifr) {
356
- let key = false, handled = false;
377
+ let key = false,
378
+ handled = false;
357
379
  ifr.forEach((ifrDict, i) => {
358
380
  if (ifrDict.val === currIfr) {
359
381
  key = i;
@@ -364,7 +386,7 @@ var DOMIterator = class _DOMIterator {
364
386
  if (key === false && !handled) {
365
387
  ifr.push({
366
388
  val: currIfr,
367
- handled: true
389
+ handled: true,
368
390
  });
369
391
  } else if (key !== false && !handled) {
370
392
  ifr[key].handled = true;
@@ -374,7 +396,7 @@ var DOMIterator = class _DOMIterator {
374
396
  if (key === false) {
375
397
  ifr.push({
376
398
  val: currIfr,
377
- handled: false
399
+ handled: false,
378
400
  });
379
401
  }
380
402
  return false;
@@ -392,11 +414,7 @@ var DOMIterator = class _DOMIterator {
392
414
  ifr.forEach((ifrDict) => {
393
415
  if (!ifrDict.handled) {
394
416
  this.getIframeContents(ifrDict.val, (con) => {
395
- this.createInstanceOnIframe(con).forEachNode(
396
- whatToShow,
397
- eCb,
398
- fCb
399
- );
417
+ this.createInstanceOnIframe(con).forEachNode(whatToShow, eCb, fCb);
400
418
  });
401
419
  }
402
420
  });
@@ -413,24 +431,29 @@ var DOMIterator = class _DOMIterator {
413
431
  */
414
432
  iterateThroughNodes(whatToShow, ctx, eachCb, filterCb, doneCb) {
415
433
  const itr = this.createIterator(ctx, whatToShow, filterCb);
416
- let ifr = [], elements = [], node, prevNode, retrieveNodes = () => {
417
- ({
418
- prevNode,
419
- node
420
- } = this.getIteratorNode(itr));
421
- return node;
422
- };
434
+ let ifr = [],
435
+ elements = [],
436
+ node,
437
+ prevNode,
438
+ retrieveNodes = () => {
439
+ ({ prevNode, node } = this.getIteratorNode(itr));
440
+ return node;
441
+ };
423
442
  while (retrieveNodes()) {
424
443
  if (this.iframes) {
425
- this.forEachIframe(ctx, (currIfr) => {
426
- return this.checkIframeFilter(node, prevNode, currIfr, ifr);
427
- }, (con) => {
428
- this.createInstanceOnIframe(con).forEachNode(
429
- whatToShow,
430
- (ifrNode) => elements.push(ifrNode),
431
- filterCb
432
- );
433
- });
444
+ this.forEachIframe(
445
+ ctx,
446
+ (currIfr) => {
447
+ return this.checkIframeFilter(node, prevNode, currIfr, ifr);
448
+ },
449
+ (con) => {
450
+ this.createInstanceOnIframe(con).forEachNode(
451
+ whatToShow,
452
+ (ifrNode) => elements.push(ifrNode),
453
+ filterCb,
454
+ );
455
+ },
456
+ );
434
457
  }
435
458
  elements.push(node);
436
459
  }
@@ -460,8 +483,7 @@ var DOMIterator = class _DOMIterator {
460
483
  * @param {DOMIterator~forEachNodeEndCallback} done - End callback
461
484
  * @access public
462
485
  */
463
- forEachNode(whatToShow, each, filter, done = () => {
464
- }) {
486
+ forEachNode(whatToShow, each, filter, done = () => {}) {
465
487
  const contexts = this.getContexts();
466
488
  let open = contexts.length;
467
489
  if (!open) {
@@ -520,32 +542,33 @@ var Mark = class {
520
542
  * @access protected
521
543
  */
522
544
  set opt(val) {
523
- this._opt = Object.assign({}, {
524
- "element": "",
525
- "className": "",
526
- "exclude": [],
527
- "iframes": false,
528
- "iframesTimeout": 5e3,
529
- "separateWordSearch": true,
530
- "diacritics": true,
531
- "synonyms": {},
532
- "accuracy": "partially",
533
- "acrossElements": false,
534
- "caseSensitive": false,
535
- "ignoreJoiners": false,
536
- "ignoreGroups": 0,
537
- "ignorePunctuation": [],
538
- "wildcards": "disabled",
539
- "each": () => {
545
+ this._opt = Object.assign(
546
+ {},
547
+ {
548
+ element: "",
549
+ className: "",
550
+ exclude: [],
551
+ iframes: false,
552
+ iframesTimeout: 5e3,
553
+ separateWordSearch: true,
554
+ diacritics: true,
555
+ synonyms: {},
556
+ accuracy: "partially",
557
+ acrossElements: false,
558
+ caseSensitive: false,
559
+ ignoreJoiners: false,
560
+ ignoreGroups: 0,
561
+ ignorePunctuation: [],
562
+ wildcards: "disabled",
563
+ each: () => {},
564
+ noMatch: () => {},
565
+ filter: () => true,
566
+ done: () => {},
567
+ debug: false,
568
+ log: window.console,
540
569
  },
541
- "noMatch": () => {
542
- },
543
- "filter": () => true,
544
- "done": () => {
545
- },
546
- "debug": false,
547
- "log": window.console
548
- }, val);
570
+ val,
571
+ );
549
572
  }
550
573
  get opt() {
551
574
  return this._opt;
@@ -560,7 +583,7 @@ var Mark = class {
560
583
  this.ctx,
561
584
  this.opt.iframes,
562
585
  this.opt.exclude,
563
- this.opt.iframesTimeout
586
+ this.opt.iframesTimeout,
564
587
  );
565
588
  }
566
589
  /**
@@ -626,17 +649,30 @@ var Mark = class {
626
649
  * @access protected
627
650
  */
628
651
  createSynonymsRegExp(str) {
629
- const syn = this.opt.synonyms, sens = this.opt.caseSensitive ? "" : "i", joinerPlaceholder = this.opt.ignoreJoiners || this.opt.ignorePunctuation.length ? "\0" : "";
652
+ const syn = this.opt.synonyms,
653
+ sens = this.opt.caseSensitive ? "" : "i",
654
+ joinerPlaceholder =
655
+ this.opt.ignoreJoiners || this.opt.ignorePunctuation.length ? "\0" : "";
630
656
  for (let index in syn) {
631
657
  if (syn.hasOwnProperty(index)) {
632
- const value = syn[index], k1 = this.opt.wildcards !== "disabled" ? this.setupWildcardsRegExp(index) : this.escapeStr(index), k2 = this.opt.wildcards !== "disabled" ? this.setupWildcardsRegExp(value) : this.escapeStr(value);
658
+ const value = syn[index],
659
+ k1 =
660
+ this.opt.wildcards !== "disabled"
661
+ ? this.setupWildcardsRegExp(index)
662
+ : this.escapeStr(index),
663
+ k2 =
664
+ this.opt.wildcards !== "disabled"
665
+ ? this.setupWildcardsRegExp(value)
666
+ : this.escapeStr(value);
633
667
  if (k1 !== "" && k2 !== "") {
634
668
  str = str.replace(
635
669
  new RegExp(
636
670
  `(${this.escapeStr(k1)}|${this.escapeStr(k2)})`,
637
- `gm${sens}`
671
+ `gm${sens}`,
638
672
  ),
639
- joinerPlaceholder + `(${this.processSynomyms(k1)}|${this.processSynomyms(k2)})` + joinerPlaceholder
673
+ joinerPlaceholder +
674
+ `(${this.processSynomyms(k1)}|${this.processSynomyms(k2)})` +
675
+ joinerPlaceholder,
640
676
  );
641
677
  }
642
678
  }
@@ -678,7 +714,9 @@ var Mark = class {
678
714
  */
679
715
  createWildcardsRegExp(str) {
680
716
  let spaces = this.opt.wildcards === "withSpaces";
681
- return str.replace(/\u0001/g, spaces ? "[\\S\\s]?" : "\\S?").replace(/\u0002/g, spaces ? "[\\S\\s]*?" : "\\S*");
717
+ return str
718
+ .replace(/\u0001/g, spaces ? "[\\S\\s]?" : "\\S?")
719
+ .replace(/\u0002/g, spaces ? "[\\S\\s]*?" : "\\S*");
682
720
  }
683
721
  /**
684
722
  * Sets up the regular expression string to allow later insertion of
@@ -715,7 +753,9 @@ var Mark = class {
715
753
  if (this.opt.ignoreJoiners) {
716
754
  joiner.push("\\u00ad\\u200b\\u200c\\u200d");
717
755
  }
718
- return joiner.length ? str.split(/\u0000+/).join(`[${joiner.join("")}]*`) : str;
756
+ return joiner.length
757
+ ? str.split(/\u0000+/).join(`[${joiner.join("")}]*`)
758
+ : str;
719
759
  }
720
760
  /**
721
761
  * Creates a regular expression string to match diacritics
@@ -724,51 +764,54 @@ var Mark = class {
724
764
  * @access protected
725
765
  */
726
766
  createDiacriticsRegExp(str) {
727
- const sens = this.opt.caseSensitive ? "" : "i", dct = this.opt.caseSensitive ? [
728
- "aàáảãạăằắẳẵặâầấẩẫậäåāą",
729
- "AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ",
730
- "cçćč",
731
- "CÇĆČ",
732
- "dđď",
733
- "DĐĎ",
734
- "eèéẻẽẹêềếểễệëěēę",
735
- "EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ",
736
- "iìíỉĩịîïī",
737
- "IÌÍỈĨỊÎÏĪ",
738
- "",
739
- "",
740
- "nñňń",
741
- "NÑŇŃ",
742
- "oòóỏõọôồốổỗộơởỡớờợöøō",
743
- "OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ",
744
- "",
745
- "",
746
- "sšśșş",
747
- "SŠŚȘŞ",
748
- "tťțţ",
749
- "TŤȚŢ",
750
- "uùúủũụưừứửữựûüůū",
751
- "UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ",
752
- "yýỳỷỹỵÿ",
753
- "YÝỲỶỸỴŸ",
754
- "zžżź",
755
- "ZŽŻŹ"
756
- ] : [
757
- "aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ",
758
- "cçćčCÇĆČ",
759
- "dđďDĐĎ",
760
- "eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ",
761
- "iìíỉĩịîïīIÌÍỈĨỊÎÏĪ",
762
- "lłLŁ",
763
- "nñňńNÑŇŃ",
764
- "oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ",
765
- "rřRŘ",
766
- "sšśșşSŠŚȘŞ",
767
- "tťțţTŤȚŢ",
768
- "uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ",
769
- "yýỳỷỹỵÿYÝỲỶỸỴŸ",
770
- "zžżźZŽŻŹ"
771
- ];
767
+ const sens = this.opt.caseSensitive ? "" : "i",
768
+ dct = this.opt.caseSensitive
769
+ ? [
770
+ "aàáảãạăằắẳẵặâầấẩẫậäåāą",
771
+ "AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ",
772
+ "cçćč",
773
+ "CÇĆČ",
774
+ "dđď",
775
+ "DĐĎ",
776
+ "eèéẻẽẹêềếểễệëěēę",
777
+ "EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ",
778
+ "iìíỉĩịîïī",
779
+ "IÌÍỈĨỊÎÏĪ",
780
+ "",
781
+ "",
782
+ "nñňń",
783
+ "NÑŇŃ",
784
+ "oòóỏõọôồốổỗộơởỡớờợöøō",
785
+ "OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ",
786
+ "",
787
+ "",
788
+ "sšśșş",
789
+ "SŠŚȘŞ",
790
+ "tťțţ",
791
+ "TŤȚŢ",
792
+ "uùúủũụưừứửữựûüůū",
793
+ "UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ",
794
+ "yýỳỷỹỵÿ",
795
+ "YÝỲỶỸỴŸ",
796
+ "zžżź",
797
+ "ZŽŻŹ",
798
+ ]
799
+ : [
800
+ "aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ",
801
+ "cçćčCÇĆČ",
802
+ "dđďDĐĎ",
803
+ "eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ",
804
+ "iìíỉĩịîïīIÌÍỈĨỊÎÏĪ",
805
+ "lłLŁ",
806
+ "nñňńNÑŇŃ",
807
+ "oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ",
808
+ "rřRŘ",
809
+ "sšśșşSŠŚȘŞ",
810
+ "tťțţTŤȚŢ",
811
+ "uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ",
812
+ "yýỳỷỹỵÿYÝỲỶỸỴŸ",
813
+ "zžżźZŽŻŹ",
814
+ ];
772
815
  let handled = [];
773
816
  str.split("").forEach((ch) => {
774
817
  dct.every((dct2) => {
@@ -776,10 +819,7 @@ var Mark = class {
776
819
  if (handled.indexOf(dct2) > -1) {
777
820
  return false;
778
821
  }
779
- str = str.replace(
780
- new RegExp(`[${dct2}]`, `gm${sens}`),
781
- `[${dct2}]`
782
- );
822
+ str = str.replace(new RegExp(`[${dct2}]`, `gm${sens}`), `[${dct2}]`);
783
823
  handled.push(dct2);
784
824
  }
785
825
  return true;
@@ -796,7 +836,7 @@ var Mark = class {
796
836
  * @access protected
797
837
  */
798
838
  createMergedBlanksRegExp(str) {
799
- return str.replace(/[\s]+/gmi, "[\\s]+");
839
+ return str.replace(/[\s]+/gim, "[\\s]+");
800
840
  }
801
841
  /**
802
842
  * Creates a regular expression string to match the specified string with
@@ -810,7 +850,10 @@ var Mark = class {
810
850
  */
811
851
  createAccuracyRegExp(str) {
812
852
  const chars = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿";
813
- let acc = this.opt.accuracy, val = typeof acc === "string" ? acc : acc.value, ls = typeof acc === "string" ? [] : acc.limiters, lsJoin = "";
853
+ let acc = this.opt.accuracy,
854
+ val = typeof acc === "string" ? acc : acc.value,
855
+ ls = typeof acc === "string" ? [] : acc.limiters,
856
+ lsJoin = "";
814
857
  ls.forEach((limiter) => {
815
858
  lsJoin += `|${this.escapeStr(limiter)}`;
816
859
  });
@@ -855,10 +898,10 @@ var Mark = class {
855
898
  });
856
899
  return {
857
900
  // sort because of https://git.io/v6USg
858
- "keywords": stack.sort((a, b) => {
901
+ keywords: stack.sort((a, b) => {
859
902
  return b.length - a.length;
860
903
  }),
861
- "length": stack.length
904
+ length: stack.length,
862
905
  };
863
906
  }
864
907
  /**
@@ -893,24 +936,29 @@ var Mark = class {
893
936
  * @access protected
894
937
  */
895
938
  checkRanges(array) {
896
- if (!Array.isArray(array) || Object.prototype.toString.call(array[0]) !== "[object Object]") {
939
+ if (
940
+ !Array.isArray(array) ||
941
+ Object.prototype.toString.call(array[0]) !== "[object Object]"
942
+ ) {
897
943
  this.log("markRanges() will only accept an array of objects");
898
944
  this.opt.noMatch(array);
899
945
  return [];
900
946
  }
901
947
  const stack = [];
902
948
  let last = 0;
903
- array.sort((a, b) => {
904
- return a.start - b.start;
905
- }).forEach((item) => {
906
- let { start, end, valid } = this.callNoMatchOnInvalidRanges(item, last);
907
- if (valid) {
908
- item.start = start;
909
- item.length = end - start;
910
- stack.push(item);
911
- last = end;
912
- }
913
- });
949
+ array
950
+ .sort((a, b) => {
951
+ return a.start - b.start;
952
+ })
953
+ .forEach((item) => {
954
+ let { start, end, valid } = this.callNoMatchOnInvalidRanges(item, last);
955
+ if (valid) {
956
+ item.start = start;
957
+ item.length = end - start;
958
+ stack.push(item);
959
+ last = end;
960
+ }
961
+ });
914
962
  return stack;
915
963
  }
916
964
  /**
@@ -923,24 +971,31 @@ var Mark = class {
923
971
  * calculated end range is valid
924
972
  */
925
973
  /**
926
- * Initial validation of ranges for markRanges. Preliminary checks are done
927
- * to ensure the start and length values exist and are not zero or non-
928
- * numeric
929
- * @param {Mark~rangeObject} range - the current range object
930
- * @param {number} last - last index of range
931
- * @return {Mark~validObject}
932
- * @access protected
933
- */
974
+ * Initial validation of ranges for markRanges. Preliminary checks are done
975
+ * to ensure the start and length values exist and are not zero or non-
976
+ * numeric
977
+ * @param {Mark~rangeObject} range - the current range object
978
+ * @param {number} last - last index of range
979
+ * @return {Mark~validObject}
980
+ * @access protected
981
+ */
934
982
  callNoMatchOnInvalidRanges(range, last) {
935
- let start, end, valid = false;
983
+ let start,
984
+ end,
985
+ valid = false;
936
986
  if (range && typeof range.start !== "undefined") {
937
987
  start = parseInt(range.start, 10);
938
988
  end = start + parseInt(range.length, 10);
939
- if (this.isNumeric(range.start) && this.isNumeric(range.length) && end - last > 0 && end - start > 0) {
989
+ if (
990
+ this.isNumeric(range.start) &&
991
+ this.isNumeric(range.length) &&
992
+ end - last > 0 &&
993
+ end - start > 0
994
+ ) {
940
995
  valid = true;
941
996
  } else {
942
997
  this.log(
943
- `Ignoring invalid or overlapping range: ${JSON.stringify(range)}`
998
+ `Ignoring invalid or overlapping range: ${JSON.stringify(range)}`,
944
999
  );
945
1000
  this.opt.noMatch(range);
946
1001
  }
@@ -951,7 +1006,7 @@ var Mark = class {
951
1006
  return {
952
1007
  start,
953
1008
  end,
954
- valid
1009
+ valid,
955
1010
  };
956
1011
  }
957
1012
  /**
@@ -966,7 +1021,11 @@ var Mark = class {
966
1021
  * @access protected
967
1022
  */
968
1023
  checkWhitespaceRanges(range, originalLength, string) {
969
- let end, valid = true, max = string.length, offset = originalLength - max, start = parseInt(range.start, 10) - offset;
1024
+ let end,
1025
+ valid = true,
1026
+ max = string.length,
1027
+ offset = originalLength - max,
1028
+ start = parseInt(range.start, 10) - offset;
970
1029
  start = start > max ? max : start;
971
1030
  end = start + parseInt(range.length, 10);
972
1031
  if (end > max) {
@@ -985,7 +1044,7 @@ var Mark = class {
985
1044
  return {
986
1045
  start,
987
1046
  end,
988
- valid
1047
+ valid,
989
1048
  };
990
1049
  }
991
1050
  /**
@@ -1012,25 +1071,31 @@ var Mark = class {
1012
1071
  * @access protected
1013
1072
  */
1014
1073
  getTextNodes(cb) {
1015
- let val = "", nodes = [];
1016
- this.iterator.forEachNode(NodeFilter.SHOW_TEXT, (node) => {
1017
- nodes.push({
1018
- start: val.length,
1019
- end: (val += node.textContent).length,
1020
- node
1021
- });
1022
- }, (node) => {
1023
- if (this.matchesExclude(node.parentNode)) {
1024
- return NodeFilter.FILTER_REJECT;
1025
- } else {
1026
- return NodeFilter.FILTER_ACCEPT;
1027
- }
1028
- }, () => {
1029
- cb({
1030
- value: val,
1031
- nodes
1032
- });
1033
- });
1074
+ let val = "",
1075
+ nodes = [];
1076
+ this.iterator.forEachNode(
1077
+ NodeFilter.SHOW_TEXT,
1078
+ (node) => {
1079
+ nodes.push({
1080
+ start: val.length,
1081
+ end: (val += node.textContent).length,
1082
+ node,
1083
+ });
1084
+ },
1085
+ (node) => {
1086
+ if (this.matchesExclude(node.parentNode)) {
1087
+ return NodeFilter.FILTER_REJECT;
1088
+ } else {
1089
+ return NodeFilter.FILTER_ACCEPT;
1090
+ }
1091
+ },
1092
+ () => {
1093
+ cb({
1094
+ value: val,
1095
+ nodes,
1096
+ });
1097
+ },
1098
+ );
1034
1099
  }
1035
1100
  /**
1036
1101
  * Checks if an element matches any of the specified exclude selectors. Also
@@ -1041,14 +1106,17 @@ var Mark = class {
1041
1106
  * @access protected
1042
1107
  */
1043
1108
  matchesExclude(el) {
1044
- return DOMIterator.matches(el, this.opt.exclude.concat([
1045
- // ignores the elements itself, not their childrens (selector *)
1046
- "script",
1047
- "style",
1048
- "title",
1049
- "head",
1050
- "html"
1051
- ]));
1109
+ return DOMIterator.matches(
1110
+ el,
1111
+ this.opt.exclude.concat([
1112
+ // ignores the elements itself, not their childrens (selector *)
1113
+ "script",
1114
+ "style",
1115
+ "title",
1116
+ "head",
1117
+ "html",
1118
+ ]),
1119
+ );
1052
1120
  }
1053
1121
  /**
1054
1122
  * Wraps the instance element and class around matches that fit the start
@@ -1061,7 +1129,9 @@ var Mark = class {
1061
1129
  * @access protected
1062
1130
  */
1063
1131
  wrapRangeInTextNode(node, start, end) {
1064
- const hEl = !this.opt.element ? "mark" : this.opt.element, startNode = node.splitText(start), ret = startNode.splitText(end - start);
1132
+ const hEl = !this.opt.element ? "mark" : this.opt.element,
1133
+ startNode = node.splitText(start),
1134
+ ret = startNode.splitText(end - start);
1065
1135
  let repl = document.createElement(hEl);
1066
1136
  repl.setAttribute("data-markjs", "true");
1067
1137
  if (this.opt.className) {
@@ -1112,7 +1182,10 @@ var Mark = class {
1112
1182
  if (!filterCb(n.node)) {
1113
1183
  return false;
1114
1184
  }
1115
- const s = start - n.start, e = (end > n.end ? n.end : end) - n.start, startStr = dict.value.substr(0, n.start), endStr = dict.value.substr(e + n.start);
1185
+ const s = start - n.start,
1186
+ e = (end > n.end ? n.end : end) - n.start,
1187
+ startStr = dict.value.substr(0, n.start),
1188
+ endStr = dict.value.substr(e + n.start);
1116
1189
  n.node = this.wrapRangeInTextNode(n.node, s, e);
1117
1190
  dict.value = startStr + endStr;
1118
1191
  dict.nodes.forEach((k, j) => {
@@ -1166,7 +1239,10 @@ var Mark = class {
1166
1239
  dict.nodes.forEach((node) => {
1167
1240
  node = node.node;
1168
1241
  let match;
1169
- while ((match = regex.exec(node.textContent)) !== null && match[matchIdx] !== "") {
1242
+ while (
1243
+ (match = regex.exec(node.textContent)) !== null &&
1244
+ match[matchIdx] !== ""
1245
+ ) {
1170
1246
  if (!filterCb(match[matchIdx], node)) {
1171
1247
  continue;
1172
1248
  }
@@ -1179,7 +1255,7 @@ var Mark = class {
1179
1255
  node = this.wrapRangeInTextNode(
1180
1256
  node,
1181
1257
  pos,
1182
- pos + match[matchIdx].length
1258
+ pos + match[matchIdx].length,
1183
1259
  );
1184
1260
  eachCb(node.previousSibling);
1185
1261
  regex.lastIndex = 0;
@@ -1218,7 +1294,10 @@ var Mark = class {
1218
1294
  const matchIdx = ignoreGroups === 0 ? 0 : ignoreGroups + 1;
1219
1295
  this.getTextNodes((dict) => {
1220
1296
  let match;
1221
- while ((match = regex.exec(dict.value)) !== null && match[matchIdx] !== "") {
1297
+ while (
1298
+ (match = regex.exec(dict.value)) !== null &&
1299
+ match[matchIdx] !== ""
1300
+ ) {
1222
1301
  let start = match.index;
1223
1302
  if (matchIdx !== 0) {
1224
1303
  for (let i = 1; i < matchIdx; i++) {
@@ -1226,12 +1305,18 @@ var Mark = class {
1226
1305
  }
1227
1306
  }
1228
1307
  const end = start + match[matchIdx].length;
1229
- this.wrapRangeInMappedTextNode(dict, start, end, (node) => {
1230
- return filterCb(match[matchIdx], node);
1231
- }, (node, lastIndex) => {
1232
- regex.lastIndex = lastIndex;
1233
- eachCb(node);
1234
- });
1308
+ this.wrapRangeInMappedTextNode(
1309
+ dict,
1310
+ start,
1311
+ end,
1312
+ (node) => {
1313
+ return filterCb(match[matchIdx], node);
1314
+ },
1315
+ (node, lastIndex) => {
1316
+ regex.lastIndex = lastIndex;
1317
+ eachCb(node);
1318
+ },
1319
+ );
1235
1320
  }
1236
1321
  endCb();
1237
1322
  });
@@ -1271,19 +1356,25 @@ var Mark = class {
1271
1356
  let { start, end, valid } = this.checkWhitespaceRanges(
1272
1357
  range,
1273
1358
  originalLength,
1274
- dict.value
1359
+ dict.value,
1275
1360
  );
1276
1361
  if (valid) {
1277
- this.wrapRangeInMappedTextNode(dict, start, end, (node) => {
1278
- return filterCb(
1279
- node,
1280
- range,
1281
- dict.value.substring(start, end),
1282
- counter
1283
- );
1284
- }, (node) => {
1285
- eachCb(node, range);
1286
- });
1362
+ this.wrapRangeInMappedTextNode(
1363
+ dict,
1364
+ start,
1365
+ end,
1366
+ (node) => {
1367
+ return filterCb(
1368
+ node,
1369
+ range,
1370
+ dict.value.substring(start, end),
1371
+ counter,
1372
+ );
1373
+ },
1374
+ (node) => {
1375
+ eachCb(node, range);
1376
+ },
1377
+ );
1287
1378
  }
1288
1379
  });
1289
1380
  endCb();
@@ -1384,7 +1475,8 @@ var Mark = class {
1384
1475
  markRegExp(regexp, opt) {
1385
1476
  this.opt = opt;
1386
1477
  this.log(`Searching with expression "${regexp}"`);
1387
- let totalMatches = 0, fn = "wrapMatches";
1478
+ let totalMatches = 0,
1479
+ fn = "wrapMatches";
1388
1480
  const eachCb = (element) => {
1389
1481
  totalMatches++;
1390
1482
  this.opt.each(element);
@@ -1392,14 +1484,20 @@ var Mark = class {
1392
1484
  if (this.opt.acrossElements) {
1393
1485
  fn = "wrapMatchesAcrossElements";
1394
1486
  }
1395
- this[fn](regexp, this.opt.ignoreGroups, (match, node) => {
1396
- return this.opt.filter(node, match, totalMatches);
1397
- }, eachCb, () => {
1398
- if (totalMatches === 0) {
1399
- this.opt.noMatch(regexp);
1400
- }
1401
- this.opt.done(totalMatches);
1402
- });
1487
+ this[fn](
1488
+ regexp,
1489
+ this.opt.ignoreGroups,
1490
+ (match, node) => {
1491
+ return this.opt.filter(node, match, totalMatches);
1492
+ },
1493
+ eachCb,
1494
+ () => {
1495
+ if (totalMatches === 0) {
1496
+ this.opt.noMatch(regexp);
1497
+ }
1498
+ this.opt.done(totalMatches);
1499
+ },
1500
+ );
1403
1501
  }
1404
1502
  /**
1405
1503
  * Callback for each marked element
@@ -1519,30 +1617,39 @@ var Mark = class {
1519
1617
  */
1520
1618
  mark(sv, opt) {
1521
1619
  this.opt = opt;
1522
- let totalMatches = 0, fn = "wrapMatches";
1523
- const {
1524
- keywords: kwArr,
1525
- length: kwArrLen
1526
- } = this.getSeparatedKeywords(typeof sv === "string" ? [sv] : sv), sens = this.opt.caseSensitive ? "" : "i", handler = (kw) => {
1527
- let regex = new RegExp(this.createRegExp(kw), `gm${sens}`), matches = 0;
1528
- this.log(`Searching with expression "${regex}"`);
1529
- this[fn](regex, 1, (term, node) => {
1530
- return this.opt.filter(node, kw, totalMatches, matches);
1531
- }, (element) => {
1532
- matches++;
1533
- totalMatches++;
1534
- this.opt.each(element);
1535
- }, () => {
1536
- if (matches === 0) {
1537
- this.opt.noMatch(kw);
1538
- }
1539
- if (kwArr[kwArrLen - 1] === kw) {
1540
- this.opt.done(totalMatches);
1541
- } else {
1542
- handler(kwArr[kwArr.indexOf(kw) + 1]);
1543
- }
1544
- });
1545
- };
1620
+ let totalMatches = 0,
1621
+ fn = "wrapMatches";
1622
+ const { keywords: kwArr, length: kwArrLen } = this.getSeparatedKeywords(
1623
+ typeof sv === "string" ? [sv] : sv,
1624
+ ),
1625
+ sens = this.opt.caseSensitive ? "" : "i",
1626
+ handler = (kw) => {
1627
+ let regex = new RegExp(this.createRegExp(kw), `gm${sens}`),
1628
+ matches = 0;
1629
+ this.log(`Searching with expression "${regex}"`);
1630
+ this[fn](
1631
+ regex,
1632
+ 1,
1633
+ (term, node) => {
1634
+ return this.opt.filter(node, kw, totalMatches, matches);
1635
+ },
1636
+ (element) => {
1637
+ matches++;
1638
+ totalMatches++;
1639
+ this.opt.each(element);
1640
+ },
1641
+ () => {
1642
+ if (matches === 0) {
1643
+ this.opt.noMatch(kw);
1644
+ }
1645
+ if (kwArr[kwArrLen - 1] === kw) {
1646
+ this.opt.done(totalMatches);
1647
+ } else {
1648
+ handler(kwArr[kwArr.indexOf(kw) + 1]);
1649
+ }
1650
+ },
1651
+ );
1652
+ };
1546
1653
  if (this.opt.acrossElements) {
1547
1654
  fn = "wrapMatchesAcrossElements";
1548
1655
  }
@@ -1591,10 +1698,11 @@ var Mark = class {
1591
1698
  */
1592
1699
  markRanges(rawRanges, opt) {
1593
1700
  this.opt = opt;
1594
- let totalMatches = 0, ranges = this.checkRanges(rawRanges);
1701
+ let totalMatches = 0,
1702
+ ranges = this.checkRanges(rawRanges);
1595
1703
  if (ranges && ranges.length) {
1596
1704
  this.log(
1597
- "Starting to mark with the following ranges: " + JSON.stringify(ranges)
1705
+ "Starting to mark with the following ranges: " + JSON.stringify(ranges),
1598
1706
  );
1599
1707
  this.wrapRangeFromIndex(
1600
1708
  ranges,
@@ -1607,7 +1715,7 @@ var Mark = class {
1607
1715
  },
1608
1716
  () => {
1609
1717
  this.opt.done(totalMatches);
1610
- }
1718
+ },
1611
1719
  );
1612
1720
  } else {
1613
1721
  this.opt.done(totalMatches);
@@ -1627,16 +1735,22 @@ var Mark = class {
1627
1735
  sel += `.${this.opt.className}`;
1628
1736
  }
1629
1737
  this.log(`Removal selector "${sel}"`);
1630
- this.iterator.forEachNode(NodeFilter.SHOW_ELEMENT, (node) => {
1631
- this.unwrapMatches(node);
1632
- }, (node) => {
1633
- const matchesSel = DOMIterator.matches(node, sel), matchesExclude = this.matchesExclude(node);
1634
- if (!matchesSel || matchesExclude) {
1635
- return NodeFilter.FILTER_REJECT;
1636
- } else {
1637
- return NodeFilter.FILTER_ACCEPT;
1638
- }
1639
- }, this.opt.done);
1738
+ this.iterator.forEachNode(
1739
+ NodeFilter.SHOW_ELEMENT,
1740
+ (node) => {
1741
+ this.unwrapMatches(node);
1742
+ },
1743
+ (node) => {
1744
+ const matchesSel = DOMIterator.matches(node, sel),
1745
+ matchesExclude = this.matchesExclude(node);
1746
+ if (!matchesSel || matchesExclude) {
1747
+ return NodeFilter.FILTER_REJECT;
1748
+ } else {
1749
+ return NodeFilter.FILTER_ACCEPT;
1750
+ }
1751
+ },
1752
+ this.opt.done,
1753
+ );
1640
1754
  }
1641
1755
  };
1642
1756
 
@@ -1661,7 +1775,5 @@ function Mark2(ctx) {
1661
1775
  };
1662
1776
  return this;
1663
1777
  }
1664
- export {
1665
- Mark2 as default
1666
- };
1778
+ export { Mark2 as default };
1667
1779
  //# sourceMappingURL=vitepress___mark__js_src_vanilla__js.js.map