@visulima/string 3.0.0-alpha.4 → 3.0.0-alpha.6

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 (63) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE.md +1 -1
  3. package/dist/align-text.d.ts +7 -10
  4. package/dist/case/camel-case.d.ts +3 -5
  5. package/dist/case/camel-case.js +2 -2
  6. package/dist/case/capital-case.d.ts +3 -5
  7. package/dist/case/capital-case.js +2 -2
  8. package/dist/case/constant-case.d.ts +3 -5
  9. package/dist/case/dot-case.d.ts +3 -5
  10. package/dist/case/flat-case.d.ts +3 -5
  11. package/dist/case/flip-case.d.ts +4 -7
  12. package/dist/case/flip-case.js +1 -1
  13. package/dist/case/identify-case.d.ts +3 -5
  14. package/dist/case/index.d.ts +22 -24
  15. package/dist/case/index.js +1 -1
  16. package/dist/case/kebab-case.d.ts +6 -9
  17. package/dist/case/kebab-case.js +2 -2
  18. package/dist/case/lower-first.d.ts +3 -5
  19. package/dist/case/no-case.d.ts +3 -5
  20. package/dist/case/pascal-case.d.ts +3 -5
  21. package/dist/case/pascal-case.js +2 -2
  22. package/dist/case/pascal-snake-case.d.ts +3 -5
  23. package/dist/case/path-case.d.ts +3 -5
  24. package/dist/case/sentence-case.d.ts +3 -5
  25. package/dist/case/sentence-case.js +2 -2
  26. package/dist/case/snake-case.d.ts +3 -5
  27. package/dist/case/split-by-case.d.ts +11 -14
  28. package/dist/case/split-by-case.js +1 -1
  29. package/dist/case/title-case.d.ts +3 -5
  30. package/dist/case/train-case.d.ts +3 -5
  31. package/dist/case/train-case.js +1 -1
  32. package/dist/case/upper-first.d.ts +3 -5
  33. package/dist/closest-string.d.ts +3 -5
  34. package/dist/compare-similarity.d.ts +3 -5
  35. package/dist/get-string-truncated-width.d.ts +18 -20
  36. package/dist/get-string-truncated-width.js +96 -15
  37. package/dist/get-string-width.d.ts +2 -5
  38. package/dist/index.d.ts +39 -49
  39. package/dist/index.js +3 -3
  40. package/dist/native-string-types.d.ts +129 -128
  41. package/dist/outdent.d.ts +9 -11
  42. package/dist/outdent.js +1 -1
  43. package/dist/packem_shared/{constants-CnXdp6qx.js → constants-D5qaproB.js} +1 -1
  44. package/dist/packem_shared/{excerpt-GvmR4ESb.js → excerpt-BUidaKYe.js} +37 -37
  45. package/dist/packem_shared/{joinSegments-B4H6oZ9b.js → joinSegments-BStLas0c.js} +1 -1
  46. package/dist/packem_shared/lru-cache.d-BsP6kbVJ.d.ts +13 -0
  47. package/dist/packem_shared/{transliterate-a6LLM_Ei.js → transliterate-DGlx-woj.js} +1 -1
  48. package/dist/packem_shared/{types-D2ydhHCv.d.ts → types.d-BVNv675q.d.ts} +17 -20
  49. package/dist/packem_shared/{types-CHpmpy8C.d.ts → types.d-DfgbcNKh.d.ts} +19 -21
  50. package/dist/slice.d.ts +5 -8
  51. package/dist/slice.js +1 -1
  52. package/dist/slugify.d.ts +1 -3
  53. package/dist/slugify.js +1 -1
  54. package/dist/test/utils.d.ts +20 -22
  55. package/dist/test/utils.js +2 -2
  56. package/dist/test/vitest.d.ts +3 -6
  57. package/dist/truncate.d.ts +7 -10
  58. package/dist/utilities.d.ts +2 -4
  59. package/dist/word-similarity-sort.d.ts +3 -5
  60. package/dist/word-wrap.d.ts +9 -11
  61. package/dist/word-wrap.js +1 -1
  62. package/package.json +1 -1
  63. package/dist/packem_shared/lru-cache-B_t27XwI.d.ts +0 -14
@@ -1218,20 +1218,20 @@ function ee(t) {
1218
1218
  }
1219
1219
  function G(t, m) {
1220
1220
  if (!t) return [];
1221
- if (Array.isArray(t)) return t.filter((y) => typeof y == "string" && y.trim());
1221
+ if (Array.isArray(t)) return t.filter((T) => typeof T == "string" && T.trim());
1222
1222
  if (typeof t == "string") return t.trim() ? [t] : [];
1223
1223
  throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_05] ${m} must be array containing zero or more strings or something falsey. Currently it's equal to: ${t}, that a type of ${typeof t}.`);
1224
1224
  }
1225
- function j(t, m, y, c) {
1225
+ function j(t, m, T, c) {
1226
1226
  for (let f = m, b = t.length; f < b; f++) {
1227
- if (t.startsWith(y, f)) return true;
1227
+ if (t.startsWith(T, f)) return true;
1228
1228
  if (t.startsWith(c, f)) return false;
1229
1229
  }
1230
1230
  return false;
1231
1231
  }
1232
- function Y(t, m, y) {
1233
- !!t?.quotes?.value && !j(m, y + 1, t.quotes.value, ">"); !j(m, t?.quotes?.next - 1, t?.quotes?.value, ">");
1234
- return !t?.quotes || !j(m, y + 1, t.quotes.value, ">") && t?.quotes?.next !== -1 && j(m, t?.quotes?.next - 1, t?.quotes?.value, ">");
1232
+ function Y(t, m, T) {
1233
+ !!t?.quotes?.value && !j(m, T + 1, t.quotes.value, ">"); !j(m, t?.quotes?.next - 1, t?.quotes?.value, ">");
1234
+ return !t?.quotes || !j(m, T + 1, t.quotes.value, ">") && t?.quotes?.next !== -1 && j(m, t?.quotes?.next - 1, t?.quotes?.value, ">");
1235
1235
  }
1236
1236
  function ne(t, m) {
1237
1237
  return (m.match(new RegExp(t, "g")) || []).length;
@@ -1243,12 +1243,12 @@ var Q = /* @__PURE__ */ new Set([".", ",", "?", ";", ")", "…", '"', "»"]);
1243
1243
  var te = /* @__PURE__ */ new Set(["a", "abbr", "acronym", "audio", "b", "bdi", "bdo", "big", "button", "canvas", "cite", "code", "data", "datalist", "del", "dfn", "em", "embed", "i", "iframe", "input", "ins", "kbd", "label", "map", "mark", "meter", "noscript", "object", "output", "picture", "progress", "q", "ruby", "s", "samp", "select", "slot", "small", "span", "strong", "sub", "sup", "svg", "template", "textarea", "time", "u", "tt", "var", "video", "wbr"]);
1244
1244
  var ae = { ignoreTags: [], ignoreTagsWithTheirContents: [], onlyStripTags: [], stripTogetherWithTheirContents: ["script", "style", "xml"], skipHtmlDecoding: false, trimOnlySpaces: false, stripRecognisedHTMLOnly: false, dumpLinkHrefsNearby: { enabled: false, putOnNewLine: false, wrapHeads: "", wrapTails: "" }, ignoreIndentations: false, cb: null, reportProgressFunc: null, reportProgressFuncFrom: 0, reportProgressFuncTo: 100 };
1245
1245
  function fe(t, m) {
1246
- let y = Date.now(), c = [], f = [], b = [], $$1 = [], n = {};
1246
+ let T = Date.now(), c = [], f = [], b = [], $$1 = [], n = {};
1247
1247
  function re() {
1248
1248
  n = { attributes: [] };
1249
1249
  }
1250
1250
  re();
1251
- let V = null, w = null, N = null, J = false, o = {}, d = { tagName: "", hrefValue: "", openingTagEnds: void 0 }, E$1 = "", C = false, B = null, F = true;
1251
+ let D = null, w = null, N = null, J = false, o = {}, d = { tagName: "", hrefValue: "", openingTagEnds: void 0 }, E$1 = "", C = false, B = null, F = true;
1252
1252
  function v$1(e, s, a) {
1253
1253
  if (Array.isArray(s.stripTogetherWithTheirContents) && (s.stripTogetherWithTheirContents.includes(n.name) || s.stripTogetherWithTheirContents.includes("*"))) if (n.slashPresent && Array.isArray(c) && c.some((i) => i.name === n.name)) {
1254
1254
  for (let i = c.length; i--; ) if (c[i].name === n.name) {
@@ -1265,15 +1265,15 @@ function fe(t, m) {
1265
1265
  if (t.length === i && u && !l?.dumpLinkHrefsNearby?.enabled) return null;
1266
1266
  let p = "";
1267
1267
  if (Number.isInteger(a) && a < g && (p += e.slice(a, g)), Number.isInteger(i) && i > u + 1) {
1268
- let D = e.slice(u + 1, i);
1269
- i && !E(t, i - 1) && (D = D.trimEnd()), D.includes(`
1270
- `) && S(i, e) ? p += " " : p += D;
1268
+ let S = e.slice(u + 1, i);
1269
+ i && !E(t, i - 1) && (S = S.trimEnd()), S.includes(`
1270
+ `) && y(i, e) ? p += " " : p += S;
1271
1271
  }
1272
1272
  let W = !Q.has(e[s]), Z = e[i - 1] !== ">" || !e[a].trim(), X = !['"', "("].includes(e[g - 1]), ge = ![";", ".", ":", "!"].includes(e[s]);
1273
1273
  if ((W || Z && X && ge) && (Z || X) && e[s] !== "!" && (!te.has(n.name) || typeof a == "number" && a < g || typeof i == "number" && i > u + 1)) {
1274
- let D = p.match(/\n/g);
1275
- return Array.isArray(D) && D.length ? D.length === 1 ? `
1276
- ` : D.length === 2 ? `
1274
+ let S = p.match(/\n/g);
1275
+ return Array.isArray(S) && S.length ? S.length === 1 ? `
1276
+ ` : S.length === 2 ? `
1277
1277
 
1278
1278
  ` : `
1279
1279
 
@@ -1290,10 +1290,10 @@ function fe(t, m) {
1290
1290
  E$1 = `${a}${d.hrefValue}`, (typeof s != "number" || E(t, s - 1)) && (E$1 += a);
1291
1291
  }
1292
1292
  }
1293
- function S(e, s) {
1293
+ function y(e, s) {
1294
1294
  return s ? s[e] === "<" && s[e + 1] !== "%" : t[e] === "<" && t[e + 1] !== "%";
1295
1295
  }
1296
- function A(e) {
1296
+ function V(e) {
1297
1297
  return t[e] === ">" && t[e - 1] !== "%";
1298
1298
  }
1299
1299
  function M(e, s, a) {
@@ -1327,7 +1327,7 @@ ${JSON.stringify(m, null, 4)}`);
1327
1327
  });
1328
1328
  let r = new $({ limitToBeAddedWhitespace: true, limitLinebreaksCount: 2 });
1329
1329
  if (!l.skipHtmlDecoding) for (; t !== decode(t, { scope: "strict" }); ) t = decode(t, { scope: "strict" });
1330
- let R = false, k = false, H = 0, K = 0, h = t.length, ue = Math.floor(h / 2);
1330
+ let R = false, A = false, H = 0, K = 0, h = t.length, ue = Math.floor(h / 2);
1331
1331
  for (let e = 0; e < h; e++) {
1332
1332
  if (l.reportProgressFunc && (h > 1e3 && h < 2e3 ? e === ue && l.reportProgressFunc(Math.floor((l.reportProgressFuncTo - l.reportProgressFuncFrom) / 2)) : h >= 2e3 && (H = l.reportProgressFuncFrom + Math.floor(e / h * (l.reportProgressFuncTo - l.reportProgressFuncFrom)), H !== K && (K = H, l.reportProgressFunc(H)))), Object.keys(n).length > 1 && n.lastClosingBracketAt && n.lastClosingBracketAt < e && t[e] !== " " && B === null && (B = e), !R && t[e] === "%" && t[e - 1] === "{" && t.includes("%}", e + 1)) {
1333
1333
  N = null;
@@ -1337,8 +1337,8 @@ ${JSON.stringify(m, null, 4)}`);
1337
1337
  continue;
1338
1338
  }
1339
1339
  }
1340
- if (!R && A(e) && (!n || Object.keys(n).length < 2) && e > 1) {
1341
- for (let s = e; s--; ) if (t[s - 1] === void 0 || A(s)) {
1340
+ if (!R && V(e) && (!n || Object.keys(n).length < 2) && e > 1) {
1341
+ for (let s = e; s--; ) if (t[s - 1] === void 0 || V(s)) {
1342
1342
  let a = t[s - 1] === void 0 ? s : s + 1, i = t.slice(a, e + 1) || "";
1343
1343
  if ((i.includes("/>") || i.includes("/ >") || i.includes('="') || i.includes("='")) && t !== `<${trim(i.trim(), "/>")}>` && [...P].some((g) => trim(i.trim().split(/\s+/).filter((u) => u.trim()).filter((u, p) => p === 0), "/>").toLowerCase() === g) && fe(`<${i.trim()}>`, l).result === "") {
1344
1344
  (!b.length || b[b.length - 1][0] !== n.lastOpeningBracketAt) && b.push([a, e + 1]), (!$$1.length || $$1[$$1.length - 1][0] !== n.lastOpeningBracketAt) && $$1.push([a, e + 1]);
@@ -1354,7 +1354,7 @@ ${JSON.stringify(m, null, 4)}`);
1354
1354
  break;
1355
1355
  }
1356
1356
  }
1357
- if (!k && t[e] === "/" && !n.quotes?.value && Number.isInteger(n.lastOpeningBracketAt) && !Number.isInteger(n.lastClosingBracketAt) && (n.slashPresent = e), t[e] === '"' || t[e] === "'") if (!k && n.nameStarts && n?.quotes?.value === t[e]) if (o.valueStarts === void 0) o = {}, delete n.quotes;
1357
+ if (!A && t[e] === "/" && !n.quotes?.value && Number.isInteger(n.lastOpeningBracketAt) && !Number.isInteger(n.lastClosingBracketAt) && (n.slashPresent = e), t[e] === '"' || t[e] === "'") if (!A && n.nameStarts && n?.quotes?.value === t[e]) if (o.valueStarts === void 0) o = {}, delete n.quotes;
1358
1358
  else {
1359
1359
  o.valueEnds = e, o.value = t.slice(o.valueStarts, e), n.attributes.push(o), o = {}, delete n.quotes;
1360
1360
  let s;
@@ -1362,21 +1362,21 @@ ${JSON.stringify(m, null, 4)}`);
1362
1362
  if (typeof a.name == "string" && a.name.toLowerCase() === "href") return s = `${l.dumpLinkHrefsNearby?.wrapHeads || ""}${a.value}${l.dumpLinkHrefsNearby?.wrapTails || ""}`, true;
1363
1363
  }) && (d = { tagName: n.name, hrefValue: s, openingTagEnds: void 0 });
1364
1364
  }
1365
- else !k && !n.quotes && n.nameStarts && (n.quotes = {}, n.quotes.value = t[e], n.quotes.start = e, n.quotes.next = t.indexOf(t[e], e + 1), o.nameStarts && o.nameEnds && o.nameEnds < e && o.nameStarts < e && !o.valueStarts && (o.name = t.slice(o.nameStarts, o.nameEnds)));
1365
+ else !A && !n.quotes && n.nameStarts && (n.quotes = {}, n.quotes.value = t[e], n.quotes.start = e, n.quotes.next = t.indexOf(t[e], e + 1), o.nameStarts && o.nameEnds && o.nameEnds < e && o.nameStarts < e && !o.valueStarts && (o.name = t.slice(o.nameStarts, o.nameEnds)));
1366
1366
  if (n.nameStarts !== void 0 && n.nameEnds === void 0 && (!t[e].trim() || !ee(t[e]))) {
1367
- if (n.nameEnds = e, n.name = t.slice(n.nameStarts, n.nameEnds + (!A(e) && t[e] !== "/" && t[e + 1] === void 0 ? 1 : 0)), t[n.nameStarts - 1] !== "!" && !n.name.replace(/-/g, "").length || /^\d+$/.test(n.name[0])) {
1367
+ if (n.nameEnds = e, n.name = t.slice(n.nameStarts, n.nameEnds + (!V(e) && t[e] !== "/" && t[e + 1] === void 0 ? 1 : 0)), t[n.nameStarts - 1] !== "!" && !n.name.replace(/-/g, "").length || /^\d+$/.test(n.name[0])) {
1368
1368
  n = {};
1369
1369
  continue;
1370
1370
  }
1371
- if (typeof n.name == "string" && n.name.toLowerCase() === "doctype" && (k = true), S(e)) {
1371
+ if (typeof n.name == "string" && n.name.toLowerCase() === "doctype" && (A = true), y(e)) {
1372
1372
  U(l);
1373
1373
  let s = L(t, e, n.leftOuterWhitespace, e, n.lastOpeningBracketAt, e);
1374
1374
  (l.stripTogetherWithTheirContents.includes(n.name) || l.stripTogetherWithTheirContents.includes("*")) && ($$1 = $$1.filter(([a, i]) => !(a === n.leftOuterWhitespace && i === e))), l.cb({ tag: n, deleteFrom: n.leftOuterWhitespace, deleteTo: e, insert: `${s}${E$1}${s}`, rangesArr: r, proposedReturn: [n.leftOuterWhitespace, e, `${s}${E$1}${s}`] }), _$1(), v$1(e, l, r);
1375
1375
  }
1376
1376
  }
1377
- if (n.quotes?.start && n.quotes.start < e && !n.quotes.end && o.nameEnds && o.equalsAt && !o.valueStarts && (o.valueStarts = e), !n.quotes && o.nameEnds && t[e] === "=" && !o.valueStarts && !o.equalsAt && (o.equalsAt = e), !n.quotes && o.nameStarts && o.nameEnds && !o.valueStarts && t[e].trim() && t[e] !== "=" && (n.attributes.push(o), o = {}), !n.quotes && o.nameStarts && !o.nameEnds && (k && `'"`.includes(t[o.nameStarts]) ? o.nameStarts < e && t[e] === t[o.nameStarts] && (o.nameEnds = e + 1, o.name = t.slice(o.nameStarts, o.nameEnds)) : t[e].trim() ? t[e] === "=" ? o.equalsAt || (o.nameEnds = e, o.equalsAt = e, o.name = t.slice(o.nameStarts, o.nameEnds)) : t[e] === "/" || A(e) ? (o.nameEnds = e, o.name = t.slice(o.nameStarts, o.nameEnds), n.attributes.push(o), o = {}) : S(e) && (o.nameEnds = e, o.name = t.slice(o.nameStarts, o.nameEnds), n.attributes.push(o), o = {}) : (o.nameEnds = e, o.name = t.slice(o.nameStarts, o.nameEnds))), !n.quotes && n.nameEnds < e && !t[e - 1].trim() && t[e].trim() && !"<>/!".includes(t[e]) && !o.nameStarts && !n.lastClosingBracketAt && (o.nameStarts = e), n.lastOpeningBracketAt !== null && n.lastOpeningBracketAt < e && t[e] === "/" && n.onlyPlausible && (n.onlyPlausible = false), n.lastOpeningBracketAt !== null && n.lastOpeningBracketAt < e && t[e] !== "/" && (n.onlyPlausible === void 0 && ((!t[e].trim() || S(e)) && !n.slashPresent ? n.onlyPlausible = true : n.onlyPlausible = false), t[e].trim() && n.nameStarts === void 0 && !S(e) && t[e] !== "/" && !A(e) && t[e] !== "!" && (n.nameStarts = e, n.nameContainsLetters = false)), n.nameStarts && !n.quotes && typeof t[e] == "string" && t[e].toLowerCase() !== t[e].toUpperCase() && (n.nameContainsLetters = true), A(e) && (Y(n, t, e) || n.quotes.value && typeof n.lastOpeningBracketAt == "number" && ne(n.quotes.value, t.slice(n.lastOpeningBracketAt, e)) % 2 === 1 && !t.slice(n.lastOpeningBracketAt + 1, e).includes("<") && !t.slice(n.lastOpeningBracketAt + 1, e).includes(">")) && n.lastOpeningBracketAt !== void 0 && (n.lastClosingBracketAt = e, B = null, Object.keys(o).length && (n.attributes.push(o), o = {}), l.dumpLinkHrefsNearby?.enabled && d.tagName && !d.openingTagEnds && (d.openingTagEnds = e)), (!k || t[e] === ">") && n.lastOpeningBracketAt !== void 0) {
1377
+ if (n.quotes?.start && n.quotes.start < e && !n.quotes.end && o.nameEnds && o.equalsAt && !o.valueStarts && (o.valueStarts = e), !n.quotes && o.nameEnds && t[e] === "=" && !o.valueStarts && !o.equalsAt && (o.equalsAt = e), !n.quotes && o.nameStarts && o.nameEnds && !o.valueStarts && t[e].trim() && t[e] !== "=" && (n.attributes.push(o), o = {}), !n.quotes && o.nameStarts && !o.nameEnds && (A && `'"`.includes(t[o.nameStarts]) ? o.nameStarts < e && t[e] === t[o.nameStarts] && (o.nameEnds = e + 1, o.name = t.slice(o.nameStarts, o.nameEnds)) : t[e].trim() ? t[e] === "=" ? o.equalsAt || (o.nameEnds = e, o.equalsAt = e, o.name = t.slice(o.nameStarts, o.nameEnds)) : t[e] === "/" || V(e) ? (o.nameEnds = e, o.name = t.slice(o.nameStarts, o.nameEnds), n.attributes.push(o), o = {}) : y(e) && (o.nameEnds = e, o.name = t.slice(o.nameStarts, o.nameEnds), n.attributes.push(o), o = {}) : (o.nameEnds = e, o.name = t.slice(o.nameStarts, o.nameEnds))), !n.quotes && n.nameEnds < e && !t[e - 1].trim() && t[e].trim() && !"<>/!".includes(t[e]) && !o.nameStarts && !n.lastClosingBracketAt && (o.nameStarts = e), n.lastOpeningBracketAt !== null && n.lastOpeningBracketAt < e && t[e] === "/" && n.onlyPlausible && (n.onlyPlausible = false), n.lastOpeningBracketAt !== null && n.lastOpeningBracketAt < e && t[e] !== "/" && (n.onlyPlausible === void 0 && ((!t[e].trim() || y(e)) && !n.slashPresent ? n.onlyPlausible = true : n.onlyPlausible = false), t[e].trim() && n.nameStarts === void 0 && !y(e) && t[e] !== "/" && !V(e) && t[e] !== "!" && (n.nameStarts = e, n.nameContainsLetters = false)), n.nameStarts && !n.quotes && typeof t[e] == "string" && t[e].toLowerCase() !== t[e].toUpperCase() && (n.nameContainsLetters = true), V(e) && (Y(n, t, e) || n.quotes.value && typeof n.lastOpeningBracketAt == "number" && ne(n.quotes.value, t.slice(n.lastOpeningBracketAt, e)) % 2 === 1 && !t.slice(n.lastOpeningBracketAt + 1, e).includes("<") && !t.slice(n.lastOpeningBracketAt + 1, e).includes(">")) && n.lastOpeningBracketAt !== void 0 && (n.lastClosingBracketAt = e, B = null, Object.keys(o).length && (n.attributes.push(o), o = {}), l.dumpLinkHrefsNearby?.enabled && d.tagName && !d.openingTagEnds && (d.openingTagEnds = e)), (!A || t[e] === ">") && n.lastOpeningBracketAt !== void 0) {
1378
1378
  if (n.lastClosingBracketAt === void 0) {
1379
- if (n.lastOpeningBracketAt < e && !S(e) && (t[e + 1] === void 0 || S(e + 1) && !n?.quotes?.value) && n.nameContainsLetters && typeof n.nameStarts == "number") {
1379
+ if (n.lastOpeningBracketAt < e && !y(e) && (t[e + 1] === void 0 || y(e + 1) && !n?.quotes?.value) && n.nameContainsLetters && typeof n.nameStarts == "number") {
1380
1380
  if (n.name = t.slice(n.nameStarts, n.nameEnds || e + 1).toLowerCase(), (!b.length || b[b.length - 1][0] !== n.lastOpeningBracketAt) && b.push([n.lastOpeningBracketAt, e + 1]), l.ignoreTags.includes(n.name) || M(e, l, n) || !P.has(n.name) && (n.onlyPlausible || l.stripRecognisedHTMLOnly)) {
1381
1381
  n = {}, o = {};
1382
1382
  continue;
@@ -1426,17 +1426,17 @@ ${JSON.stringify(m, null, 4)}`);
1426
1426
  }
1427
1427
  l.cb({ tag: n, deleteFrom: n.leftOuterWhitespace, deleteTo: s + p, insert: u, rangesArr: r, proposedReturn: [n.leftOuterWhitespace, s + p, u] }), _$1(), v$1(e, l, r);
1428
1428
  } else n = {};
1429
- A(e) || (n = {});
1429
+ V(e) || (n = {});
1430
1430
  }
1431
- k && (k = false);
1431
+ A && (A = false);
1432
1432
  }
1433
- if ((!R || t[e] === "<" && E(t, E(t, e)) && t[E(t, e)] === "/" && t.startsWith("script", E(t, E(t, e)))) && S(e) && !S(e - 1) && !`'"`.includes(t[e + 1]) && (!`'"`.includes(t[e + 2]) || /\w/.test(t[e + 1])) && !(t[e + 1] === "c" && t[e + 2] === ":") && !(t[e + 1] === "f" && t[e + 2] === "m" && t[e + 3] === "t" && t[e + 4] === ":") && !(t[e + 1] === "s" && t[e + 2] === "q" && t[e + 3] === "l" && t[e + 4] === ":") && !(t[e + 1] === "x" && t[e + 2] === ":") && !(t[e + 1] === "f" && t[e + 2] === "n" && t[e + 3] === ":") && Y(n, t, e)) {
1434
- if (A(E(t, e))) continue;
1433
+ if ((!R || t[e] === "<" && E(t, E(t, e)) && t[E(t, e)] === "/" && t.startsWith("script", E(t, E(t, e)))) && y(e) && !y(e - 1) && !`'"`.includes(t[e + 1]) && (!`'"`.includes(t[e + 2]) || /\w/.test(t[e + 1])) && !(t[e + 1] === "c" && t[e + 2] === ":") && !(t[e + 1] === "f" && t[e + 2] === "m" && t[e + 3] === "t" && t[e + 4] === ":") && !(t[e + 1] === "s" && t[e + 2] === "q" && t[e + 3] === "l" && t[e + 4] === ":") && !(t[e + 1] === "x" && t[e + 2] === ":") && !(t[e + 1] === "f" && t[e + 2] === "n" && t[e + 3] === ":") && Y(n, t, e)) {
1434
+ if (V(E(t, e))) continue;
1435
1435
  if (n.nameEnds && n.nameEnds < e && !n.lastClosingBracketAt && (n.onlyPlausible === true && n.attributes?.length || n.onlyPlausible === false)) {
1436
1436
  let s = L(t, e, n.leftOuterWhitespace, e, n.lastOpeningBracketAt, e);
1437
1437
  l.cb({ tag: n, deleteFrom: n.leftOuterWhitespace, deleteTo: e, insert: s, rangesArr: r, proposedReturn: [n.leftOuterWhitespace, e, s] }), v$1(e, l, r), n = {}, o = {};
1438
1438
  }
1439
- if (n.lastOpeningBracketAt !== void 0 && n.onlyPlausible && n.name && !n.quotes && (n.lastOpeningBracketAt = void 0, n.name = void 0, n.onlyPlausible = false), (n.lastOpeningBracketAt === void 0 || !n.onlyPlausible) && !n.quotes && (n.lastOpeningBracketAt = e, n.slashPresent = false, n.attributes = [], V === null ? n.leftOuterWhitespace = e : l.trimOnlySpaces && V === 0 ? n.leftOuterWhitespace = w || e : n.leftOuterWhitespace = V, `${t[e + 1]}${t[e + 2]}${t[e + 3]}` == "!--" || `${t[e + 1]}${t[e + 2]}${t[e + 3]}${t[e + 4]}${t[e + 5]}${t[e + 6]}${t[e + 7]}${t[e + 8]}` == "![CDATA[")) {
1439
+ if (n.lastOpeningBracketAt !== void 0 && n.onlyPlausible && n.name && !n.quotes && (n.lastOpeningBracketAt = void 0, n.name = void 0, n.onlyPlausible = false), (n.lastOpeningBracketAt === void 0 || !n.onlyPlausible) && !n.quotes && (n.lastOpeningBracketAt = e, n.slashPresent = false, n.attributes = [], D === null ? n.leftOuterWhitespace = e : l.trimOnlySpaces && D === 0 ? n.leftOuterWhitespace = w || e : n.leftOuterWhitespace = D, `${t[e + 1]}${t[e + 2]}${t[e + 3]}` == "!--" || `${t[e + 1]}${t[e + 2]}${t[e + 3]}${t[e + 4]}${t[e + 5]}${t[e + 6]}${t[e + 7]}${t[e + 8]}` == "![CDATA[")) {
1440
1440
  let s = true;
1441
1441
  t[e + 2] === "-" && (s = false);
1442
1442
  let a;
@@ -1449,8 +1449,8 @@ ${JSON.stringify(m, null, 4)}`);
1449
1449
  }
1450
1450
  }
1451
1451
  }
1452
- !t[e].trim() || t[e].charCodeAt(0) === 847 ? (V === null && (V = e, n.lastOpeningBracketAt !== void 0 && n.lastOpeningBracketAt < e && n.nameStarts && n.nameStarts < n.lastOpeningBracketAt && e === n.lastOpeningBracketAt + 1 && !c.some((s) => s.name === n.name) && (n.onlyPlausible = true, n.name = void 0, n.nameStarts = void 0)), (t[e] === `
1453
- ` || t[e] === "\r") && (N = e, J && (J = false))) : (V !== null && (!n.quotes && o.equalsAt > V - 1 && o.nameEnds && o.equalsAt > o.nameEnds && t[e] !== '"' && t[e] !== "'" && (u(o) && n.attributes.push(o), o = {}, n.equalsSpottedAt = void 0), V = null), J || (J = true, F && !R && typeof N == "number" && e && N < e - 1 && (t.slice(N + 1, e).trim() ? N = null : l.ignoreIndentations || r.push([N + 1, e])))), t[e] === " " ? w === null && (w = e) : w !== null && (w = null), n.name === "script" && (R = !n.slashPresent);
1452
+ !t[e].trim() || t[e].charCodeAt(0) === 847 ? (D === null && (D = e, n.lastOpeningBracketAt !== void 0 && n.lastOpeningBracketAt < e && n.nameStarts && n.nameStarts < n.lastOpeningBracketAt && e === n.lastOpeningBracketAt + 1 && !c.some((s) => s.name === n.name) && (n.onlyPlausible = true, n.name = void 0, n.nameStarts = void 0)), (t[e] === `
1453
+ ` || t[e] === "\r") && (N = e, J && (J = false))) : (D !== null && (!n.quotes && o.equalsAt > D - 1 && o.nameEnds && o.equalsAt > o.nameEnds && t[e] !== '"' && t[e] !== "'" && (u(o) && n.attributes.push(o), o = {}, n.equalsSpottedAt = void 0), D = null), J || (J = true, F && !R && typeof N == "number" && e && N < e - 1 && (t.slice(N + 1, e).trim() ? N = null : l.ignoreIndentations || r.push([N + 1, e])))), t[e] === " " ? w === null && (w = e) : w !== null && (w = null), n.name === "script" && (R = !n.slashPresent);
1454
1454
  }
1455
1455
  if (t && !l.ignoreIndentations && (l.trimOnlySpaces && t[0] === " " || !l.trimOnlySpaces && !t[0].trim())) for (let e = 0; e < h; e++) if (l.trimOnlySpaces && t[e] !== " " || !l.trimOnlySpaces && t[e].trim()) {
1456
1456
  r.push([0, e]);
@@ -1462,12 +1462,12 @@ ${JSON.stringify(m, null, 4)}`);
1462
1462
  break;
1463
1463
  }
1464
1464
  }
1465
- let O = r.current();
1466
- if (!m?.cb && O) {
1467
- if (O[0] && !O[0][0]) {
1465
+ let k = r.current();
1466
+ if (!m?.cb && k) {
1467
+ if (k[0] && !k[0][0]) {
1468
1468
  r.ranges[0] = [r.ranges[0][0], r.ranges[0][1]];
1469
1469
  }
1470
- if (O[O.length - 1] && O[O.length - 1][1] === t.length) {
1470
+ if (k[k.length - 1]?.[1] === t.length) {
1471
1471
  if (r.ranges) {
1472
1472
  let s = r.ranges[r.ranges.length - 1][0];
1473
1473
  t[s - 1] && (l.trimOnlySpaces && t[s - 1] === " " || !l.trimOnlySpaces && !t[s - 1].trim()) && (s -= 1);
@@ -1476,7 +1476,7 @@ ${JSON.stringify(m, null, 4)}`);
1476
1476
  }
1477
1477
  }
1478
1478
  }
1479
- return { log: { timeTakenInMilliseconds: Date.now() - y }, result: _(t, r.current()), ranges: r.current(), allTagLocations: b, filteredTagLocations: $$1 };
1479
+ return { log: { timeTakenInMilliseconds: Date.now() - T }, result: _(t, r.current()), ranges: r.current(), allTagLocations: b, filteredTagLocations: $$1 };
1480
1480
  }
1481
1481
 
1482
1482
  const excerpt = (html, limit, options = {}) => {
@@ -1,4 +1,4 @@
1
- import { R as RE_FAST_ANSI } from './constants-CnXdp6qx.js';
1
+ import { R as RE_FAST_ANSI } from './constants-D5qaproB.js';
2
2
 
3
3
  const joinSegments = (segments, joiner) => {
4
4
  const { length } = segments;
@@ -0,0 +1,13 @@
1
+ declare class LRUCache<K, V> {
2
+ private readonly capacity;
3
+ private readonly cache;
4
+ private keyOrder;
5
+ constructor(capacity: number);
6
+ get(key: K): V | undefined;
7
+ has(key: K): boolean;
8
+ set(key: K, value: V): void;
9
+ delete(key: K): void;
10
+ clear(): void;
11
+ size(): number;
12
+ }
13
+ export { LRUCache as L };
@@ -1,4 +1,4 @@
1
- import { F as RE_THAI } from './constants-CnXdp6qx.js';
1
+ import { G as RE_THAI } from './constants-D5qaproB.js';
2
2
  import replaceString from './replaceString-BVlxk27d.js';
3
3
  import { findStringOccurrences, hasPunctuationOrSpace, hasChinese } from '../utilities.js';
4
4
 
@@ -4,12 +4,11 @@ type SliceStartType<T extends string, StartIndex extends number, Result extends
4
4
  type InternalEndsWithType<T extends string, S extends string, P extends number> = All<[IsStringLiteral<S>, IsNumberLiteral<P>]> extends true ? Math.IsNegative<P> extends false ? P extends Length<T> ? IsStringLiteral<T> extends true ? S extends Slice<T, Math.Subtract<Length<T>, Length<S>>, Length<T>> ? true : false : EndsWithNoPositionType<Slice<T, 0, P>, S> : EndsWithNoPositionType<Slice<T, 0, P>, S> : false : boolean;
5
5
  type EndsWithNoPositionType<T extends string, S extends string> = StartsWith<Reverse<T>, Reverse<S>>;
6
6
  declare namespace Math {
7
- type Subtract<A extends number, B extends number> = number extends A | B ? number : TupleOf<A> extends [...infer U, ...TupleOf<B>] ? U["length"] : 0;
8
- type IsNegative<T extends number> = number extends T ? boolean : `${T}` extends `-${number}` ? true : false;
9
- type Abs<T extends number> = `${T}` extends `-${infer U extends number}` ? U : T;
10
- type GetPositiveIndex<T extends string, I extends number> = IsNegative<I> extends false ? I : Subtract<Length<T>, Abs<I>>;
7
+ type Subtract<A extends number, B extends number> = number extends A | B ? number : TupleOf<A> extends [...infer U, ...TupleOf<B>] ? U["length"] : 0;
8
+ type IsNegative<T extends number> = number extends T ? boolean : `${T}` extends `-${number}` ? true : false;
9
+ type Abs<T extends number> = `${T}` extends `-${infer U extends number}` ? U : T;
10
+ type GetPositiveIndex<T extends string, I extends number> = IsNegative<I> extends false ? I : Subtract<Length<T>, Abs<I>>;
11
11
  }
12
-
13
12
  type IsNumberLiteral<T extends number> = [T] extends [number] ? ([number] extends [T] ? false : true) : false;
14
13
  type IsBooleanLiteral<T extends boolean> = [T] extends [boolean] ? ([boolean] extends [T] ? false : true) : false;
15
14
  type Reverse<T extends string, Accumulator extends string = ""> = T extends `${infer Head}${infer Tail}` ? Reverse<Tail, `${Head}${Accumulator}`> : Accumulator extends "" ? T : `${T}${Accumulator}`;
@@ -43,22 +42,20 @@ type OptionReplaceArray = [RegExp | string, string | undefined][];
43
42
  type OptionReplaceObject = Record<string, string>;
44
43
  type OptionReplaceCombined = OptionReplaceArray | OptionReplaceObject;
45
44
  interface OptionsTransliterate {
46
- fixChineseSpacing?: boolean;
47
- ignore?: string[];
48
- replaceAfter?: OptionReplaceCombined;
49
- replaceBefore?: OptionReplaceCombined;
50
- trim?: boolean;
51
- unknown?: string;
45
+ fixChineseSpacing?: boolean;
46
+ ignore?: string[];
47
+ replaceAfter?: OptionReplaceCombined;
48
+ replaceBefore?: OptionReplaceCombined;
49
+ trim?: boolean;
50
+ unknown?: string;
52
51
  }
53
52
  type Charmap = Record<string, string | undefined>;
54
53
  interface SlugifyOptions extends OptionsTransliterate {
55
- allowedChars?: string;
56
- fixChineseSpacing?: boolean;
57
- lowercase?: boolean;
58
- separator?: string;
59
- transliterate?: boolean;
60
- uppercase?: boolean;
54
+ allowedChars?: string;
55
+ fixChineseSpacing?: boolean;
56
+ lowercase?: boolean;
57
+ separator?: string;
58
+ transliterate?: boolean;
59
+ uppercase?: boolean;
61
60
  }
62
-
63
- export { Math as M };
64
- export type { All as A, CharAt as C, EndsWith as E, Includes as I, Join as J, Length as L, NodeLocale as N, OptionReplaceArray as O, PadEnd as P, Replace as R, Slice as S, ToLowerCase as T, Concat as a, PadStart as b, ReplaceAll as c, Split as d, StartsWith as e, ToUpperCase as f, Trim as g, TrimEnd as h, TrimStart as i, SlugifyOptions as j, IsStringLiteral as k, IntervalArray as l, OptionsTransliterate as m, Any as n, Charmap as o, Interval as p, IsBooleanLiteral as q, IsNumberLiteral as r, IsStringLiteralArray as s, OptionReplaceCombined as t, OptionReplaceObject as u, Repeat as v, Reverse as w };
61
+ export { All as A, CharAt as C, EndsWith as E, IsStringLiteral as I, Join as J, Length as L, Math as M, NodeLocale as N, OptionReplaceArray as O, PadEnd as P, Repeat as R, SlugifyOptions as S, ToLowerCase as T, IntervalArray as a, OptionsTransliterate as b, Any as c, Charmap as d, Concat as e, Includes as f, Interval as g, IsBooleanLiteral as h, IsNumberLiteral as i, IsStringLiteralArray as j, OptionReplaceCombined as k, OptionReplaceObject as l, PadStart as m, Replace as n, ReplaceAll as o, Reverse as p, Slice as q, Split as r, StartsWith as s, ToUpperCase as t, Trim as u, TrimEnd as v, TrimStart as w };
@@ -1,6 +1,5 @@
1
- import { N as NodeLocale, k as IsStringLiteral } from './types-D2ydhHCv.js';
2
- import { L as LRUCache } from './lru-cache-B_t27XwI.js';
3
-
1
+ import { I as IsStringLiteral, N as NodeLocale } from "./types.d-BVNv675q.js";
2
+ import { L as LRUCache } from "./lru-cache.d-BsP6kbVJ.js";
4
3
  type SplitterCharacter = " " | "_" | "-" | "." | "/";
5
4
  type LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;
6
5
  type RemoveLastOfArray<T extends any[]> = T extends [...infer F, any] ? F : never;
@@ -10,17 +9,17 @@ type SameLetterCase<X extends string, Y extends string> = IsUpperCase<X> extends
10
9
  type FirstOfString<S extends string> = S extends `${infer F}${string}` ? F : never;
11
10
  type RemoveFirstOfString<S extends string> = S extends `${string}${infer R}` ? R : never;
12
11
  interface LocaleOptions {
13
- locale?: NodeLocale;
12
+ locale?: NodeLocale;
14
13
  }
15
14
  interface CaseOptions extends LocaleOptions {
16
- cache?: boolean;
17
- cacheStore?: LRUCache<string, string>;
18
- handleAnsi?: boolean;
19
- handleEmoji?: boolean;
20
- knownAcronyms?: ReadonlyArray<string>;
21
- normalize?: boolean;
22
- stripAnsi?: boolean;
23
- stripEmoji?: boolean;
15
+ cache?: boolean;
16
+ cacheStore?: LRUCache<string, string>;
17
+ handleAnsi?: boolean;
18
+ handleEmoji?: boolean;
19
+ knownAcronyms?: ReadonlyArray<string>;
20
+ normalize?: boolean;
21
+ stripAnsi?: boolean;
22
+ stripEmoji?: boolean;
24
23
  }
25
24
  type CamelCase<T extends string> = IsStringLiteral<T> extends true ? T extends `${infer F}_${infer R}` ? `${Lowercase<F>}${Capitalize<CamelCase<R>>}` : T extends `${infer F}-${infer R}` ? `${Lowercase<F>}${Capitalize<CamelCase<R>>}` : T extends `${infer F} ${infer R}` ? `${Lowercase<F>}${Capitalize<CamelCase<R>>}` : Lowercase<T> : string;
26
25
  type PascalCase<T extends string> = IsStringLiteral<T> extends true ? Capitalize<CamelCase<T>> : string;
@@ -33,27 +32,26 @@ type UpperFirst<T extends string> = IsStringLiteral<T> extends true ? (T extends
33
32
  type LowerFirst<T extends string> = IsStringLiteral<T> extends true ? (T extends `${infer F}${infer R}` ? `${Lowercase<F>}${R}` : T) : string;
34
33
  type FlipCase<T extends string> = IsStringLiteral<T> extends true ? T extends `${infer C}${infer Rest}` ? `${C extends Uppercase<C> ? Lowercase<C> : Uppercase<C>}${FlipCase<Rest>}` : T : string;
35
34
  type DotCase<T extends string> = T & {
36
- __dot_case__: never;
35
+ __dot_case__: never;
37
36
  };
38
37
  type PathCase<T extends string> = T & {
39
- __path_case__: never;
38
+ __path_case__: never;
40
39
  };
41
40
  type NoCase<T extends string> = T & {
42
- __no_case__: never;
41
+ __no_case__: never;
43
42
  };
44
43
  type ConstantCase<T extends string> = T & {
45
- __constant_case__: never;
44
+ __constant_case__: never;
46
45
  };
47
46
  type CapitalCase<T extends string> = T & {
48
- __capital_case__: never;
47
+ __capital_case__: never;
49
48
  };
50
49
  type SentenceCase<T extends string> = T & {
51
- __sentence_case__: never;
50
+ __sentence_case__: never;
52
51
  };
53
52
  type PascalSnakeCase<T extends string> = T & {
54
- __pascal_snake_case__: never;
53
+ __pascal_snake_case__: never;
55
54
  };
56
55
  type IdentifyCase<T extends string> = IsStringLiteral<T> extends true ? T extends Lowercase<T> ? T extends `${string}_${string}` ? "snake" : T extends `${string}-${string}` ? "kebab" : T extends `${string}${string}` ? "flat" : "lower" : T extends Uppercase<T> ? "upper" : T extends Capitalize<string> ? T extends `${Uppercase<string>}${string}` ? T extends `${string}-${string}` ? "train" : "pascal" : T extends `${Lowercase<string>}${Capitalize<string>}` ? "camel" : T extends `${Capitalize<string>} ${Lowercase<string>}` ? "title" : "mixed" : "mixed" : string;
57
56
  type SplitByCase<T, Separator extends string = SplitterCharacter, Accumulator extends unknown[] = []> = string extends Separator ? string[] : T extends `${infer F}${infer R}` ? [LastOfArray<Accumulator>] extends [never] ? SplitByCase<R, Separator, [F]> : LastOfArray<Accumulator> extends string ? R extends "" ? SplitByCase<R, Separator, [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`]> : SameLetterCase<F, FirstOfString<R>> extends true ? F extends Separator ? FirstOfString<R> extends Separator ? SplitByCase<R, Separator, [...Accumulator, ""]> : IsUpperCase<FirstOfString<R>> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [...Accumulator, FirstOfString<R>]> : SplitByCase<R, Separator, [...Accumulator, ""]> : SplitByCase<R, Separator, [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`]> : IsLowerCase<F> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`, FirstOfString<R>]> : SplitByCase<R, Separator, [...Accumulator, F]> : never : Accumulator extends [] ? T extends "" ? [] : string[] : Accumulator;
58
-
59
- export type { CaseOptions as C, DotCase as D, FlatCase as F, IdentifyCase as I, KebabCase as K, LocaleOptions as L, NoCase as N, PascalCase as P, SentenceCase as S, TitleCase as T, UpperFirst as U, CamelCase as a, CapitalCase as b, ConstantCase as c, FlipCase as d, LowerFirst as e, PascalSnakeCase as f, PathCase as g, SnakeCase as h, SplitByCase as i, TrainCase as j };
57
+ export { CaseOptions as C, DotCase as D, FlatCase as F, IdentifyCase as I, KebabCase as K, LocaleOptions as L, NoCase as N, PascalCase as P, SentenceCase as S, TitleCase as T, UpperFirst as U, CamelCase as a, CapitalCase as b, ConstantCase as c, FlipCase as d, LowerFirst as e, PascalSnakeCase as f, PathCase as g, SnakeCase as h, SplitByCase as i, TrainCase as j };
package/dist/slice.d.ts CHANGED
@@ -1,11 +1,8 @@
1
- import { StringWidthOptions } from './get-string-width.js';
2
- import './get-string-truncated-width.js';
3
-
1
+ import { StringWidthOptions } from "./get-string-width.js";
2
+ import "./get-string-truncated-width.js";
4
3
  type SliceOptions = {
5
- segmenter?: Intl.Segmenter;
6
- width?: StringWidthOptions;
4
+ segmenter?: Intl.Segmenter;
5
+ width?: StringWidthOptions;
7
6
  };
8
7
  declare const slice: (inputString: string, startIndex?: number, endIndex?: number, options?: SliceOptions) => string;
9
-
10
- export { slice };
11
- export type { SliceOptions };
8
+ export { SliceOptions, slice };
package/dist/slice.js CHANGED
@@ -1,4 +1,4 @@
1
- import { g as RE_VALID_ANSI_PAIRS, h as RE_VALID_HYPERLINKS, i as RE_ANSI } from './packem_shared/constants-CnXdp6qx.js';
1
+ import { g as RE_VALID_ANSI_PAIRS, h as RE_VALID_HYPERLINKS, i as RE_ANSI } from './packem_shared/constants-D5qaproB.js';
2
2
  import { getStringWidth } from './get-string-width.js';
3
3
  import LRUCache from './packem_shared/LRUCache-3r3SovvR.js';
4
4
 
package/dist/slugify.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { j as SlugifyOptions } from './packem_shared/types-D2ydhHCv.js';
2
-
1
+ import { S as SlugifyOptions } from "./packem_shared/types.d-BVNv675q.js";
3
2
  declare const slugify: (input: string, options?: SlugifyOptions) => string;
4
-
5
3
  export { slugify as default };
package/dist/slugify.js CHANGED
@@ -1,4 +1,4 @@
1
- import transliterate from './packem_shared/transliterate-a6LLM_Ei.js';
1
+ import transliterate from './packem_shared/transliterate-DGlx-woj.js';
2
2
  import { escapeRegExp } from './utilities.js';
3
3
 
4
4
  const removeDisallowedChars = (input, allowedChars, separator) => {
@@ -1,31 +1,29 @@
1
1
  declare const formatAnsiString: (ansiString: string) => {
2
- ansi: string;
3
- json: string;
4
- lengthDifference: number;
5
- stripped: string;
6
- visible: string;
2
+ ansi: string;
3
+ json: string;
4
+ lengthDifference: number;
5
+ stripped: string;
6
+ visible: string;
7
7
  };
8
8
  interface ExpectationResult {
9
- actual?: unknown;
10
- expected?: unknown;
11
- message: () => string;
12
- pass: boolean;
9
+ actual?: unknown;
10
+ expected?: unknown;
11
+ message: () => string;
12
+ pass: boolean;
13
13
  }
14
14
  declare const expectAnsiStrings: (actual: string, expected: string) => ExpectationResult;
15
15
  declare const compareAnsiStrings: (actual: string, expected: string) => {
16
- actual: ReturnType<typeof formatAnsiString>;
16
+ actual: ReturnType<typeof formatAnsiString>;
17
+ ansiEqual: boolean;
18
+ expected: ReturnType<typeof formatAnsiString>;
19
+ strippedEqual: boolean;
20
+ summary: {
21
+ actualLength: number;
22
+ actualStrippedLength: number;
17
23
  ansiEqual: boolean;
18
- expected: ReturnType<typeof formatAnsiString>;
24
+ expectedLength: number;
25
+ expectedStrippedLength: number;
19
26
  strippedEqual: boolean;
20
- summary: {
21
- actualLength: number;
22
- actualStrippedLength: number;
23
- ansiEqual: boolean;
24
- expectedLength: number;
25
- expectedStrippedLength: number;
26
- strippedEqual: boolean;
27
- };
27
+ };
28
28
  };
29
-
30
- export { compareAnsiStrings, expectAnsiStrings, formatAnsiString };
31
- export type { ExpectationResult };
29
+ export { ExpectationResult, compareAnsiStrings, expectAnsiStrings, formatAnsiString };
@@ -18,8 +18,8 @@ const __cjs_getBuiltinModule = (module) => {
18
18
  };
19
19
 
20
20
  const {
21
- stripVTControlCharacters,
22
- format
21
+ format,
22
+ stripVTControlCharacters
23
23
  } = __cjs_getBuiltinModule("node:util");
24
24
  import { getStringWidth } from '../get-string-width.js';
25
25
 
@@ -1,9 +1,6 @@
1
- import { ExpectationResult } from './utils.js';
2
-
1
+ import { ExpectationResult } from "./utils.js";
3
2
  interface CustomMatchers {
4
- toEqualAnsi: (expected: string) => ExpectationResult;
3
+ toEqualAnsi: (expected: string) => ExpectationResult;
5
4
  }
6
5
  declare const toEqualAnsi: (actual: string, expected: string) => ExpectationResult;
7
-
8
- export { toEqualAnsi };
9
- export type { CustomMatchers };
6
+ export { CustomMatchers, toEqualAnsi };
@@ -1,13 +1,10 @@
1
- import { StringTruncatedWidthOptions } from './get-string-truncated-width.js';
2
-
1
+ import { StringTruncatedWidthOptions } from "./get-string-truncated-width.js";
3
2
  type TruncateOptions = {
4
- ellipsis?: string;
5
- ellipsisWidth?: number;
6
- position?: "end" | "middle" | "start";
7
- preferTruncationOnSpace?: boolean;
8
- width?: Omit<StringTruncatedWidthOptions, "ellipsis" | "ellipsisWidth" | "limit">;
3
+ ellipsis?: string;
4
+ ellipsisWidth?: number;
5
+ position?: "end" | "middle" | "start";
6
+ preferTruncationOnSpace?: boolean;
7
+ width?: Omit<StringTruncatedWidthOptions, "ellipsis" | "ellipsisWidth" | "limit">;
9
8
  };
10
9
  declare const truncate: (input: string, limit: number, options?: TruncateOptions) => string;
11
-
12
- export { truncate };
13
- export type { TruncateOptions };
10
+ export { TruncateOptions, truncate };
@@ -1,10 +1,8 @@
1
- import { l as IntervalArray } from './packem_shared/types-D2ydhHCv.js';
2
- export { L as LRUCache } from './packem_shared/lru-cache-B_t27XwI.js';
3
-
1
+ import { a as IntervalArray } from "./packem_shared/types.d-BVNv675q.js";
2
+ export { L as LRUCache } from "./packem_shared/lru-cache.d-BsP6kbVJ.js";
4
3
  declare const escapeRegExp: (char: string) => string;
5
4
  declare const inRange: (number_: number, ranges: IntervalArray) => boolean;
6
5
  declare const hasChinese: (char: string) => boolean;
7
6
  declare const hasPunctuationOrSpace: (char: string) => boolean;
8
7
  declare const findStringOccurrences: (source: string, needles: string[]) => IntervalArray;
9
-
10
8
  export { escapeRegExp, findStringOccurrences, hasChinese, hasPunctuationOrSpace, inRange };
@@ -1,8 +1,6 @@
1
1
  interface WordSimilaritySortOptions {
2
- caseSensitive?: boolean;
3
- compareFunction?: (a: string, b: string) => number;
2
+ caseSensitive?: boolean;
3
+ compareFunction?: (a: string, b: string) => number;
4
4
  }
5
5
  declare const wordSimilaritySort: (givenWord: string, possibleWords: ReadonlyArray<string>, options?: WordSimilaritySortOptions) => string[];
6
-
7
- export { wordSimilaritySort };
8
- export type { WordSimilaritySortOptions };
6
+ export { WordSimilaritySortOptions, wordSimilaritySort };
@@ -1,16 +1,14 @@
1
1
  declare const WrapMode: {
2
- readonly BREAK_AT_CHARACTERS: "BREAK_AT_CHARACTERS";
3
- readonly BREAK_WORDS: "BREAK_WORDS";
4
- readonly PRESERVE_WORDS: "PRESERVE_WORDS";
5
- readonly STRICT_WIDTH: "STRICT_WIDTH";
2
+ readonly BREAK_AT_CHARACTERS: "BREAK_AT_CHARACTERS";
3
+ readonly BREAK_WORDS: "BREAK_WORDS";
4
+ readonly PRESERVE_WORDS: "PRESERVE_WORDS";
5
+ readonly STRICT_WIDTH: "STRICT_WIDTH";
6
6
  };
7
7
  interface WordWrapOptions {
8
- removeZeroWidthCharacters?: boolean;
9
- trim?: boolean;
10
- width?: number;
11
- wrapMode?: keyof typeof WrapMode;
8
+ removeZeroWidthCharacters?: boolean;
9
+ trim?: boolean;
10
+ width?: number;
11
+ wrapMode?: keyof typeof WrapMode;
12
12
  }
13
13
  declare const wordWrap: (string: string, options?: WordWrapOptions) => string;
14
-
15
- export { WrapMode, wordWrap };
16
- export type { WordWrapOptions };
14
+ export { WordWrapOptions, WrapMode, wordWrap };
package/dist/word-wrap.js CHANGED
@@ -1,4 +1,4 @@
1
- import { O as ESCAPES, P as ANSI_ESCAPE_LINK, Q as ANSI_SGR_TERMINATOR, S as ANSI_ESCAPE_BELL, T as ANSI_CSI, U as RE_ESCAPE_PATTERN, V as ANSI_RESET_CODES, W as END_CODE, X as RE_ZERO_WIDTH } from './packem_shared/constants-CnXdp6qx.js';
1
+ import { O as ESCAPES, P as ANSI_ESCAPE_LINK, Q as ANSI_SGR_TERMINATOR, S as ANSI_ESCAPE_BELL, T as ANSI_CSI, U as RE_ESCAPE_PATTERN, V as ANSI_RESET_CODES, W as END_CODE, X as RE_ZERO_WIDTH } from './packem_shared/constants-D5qaproB.js';
2
2
  import { getStringWidth } from './get-string-width.js';
3
3
 
4
4
  class AnsiStateTracker {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/string",
3
- "version": "3.0.0-alpha.4",
3
+ "version": "3.0.0-alpha.6",
4
4
  "description": "Functions for manipulating strings.",
5
5
  "keywords": [
6
6
  "visulima",
@@ -1,14 +0,0 @@
1
- declare class LRUCache<K, V> {
2
- private readonly capacity;
3
- private readonly cache;
4
- private keyOrder;
5
- constructor(capacity: number);
6
- get(key: K): V | undefined;
7
- has(key: K): boolean;
8
- set(key: K, value: V): void;
9
- delete(key: K): void;
10
- clear(): void;
11
- size(): number;
12
- }
13
-
14
- export { LRUCache as L };