@pie-element/shared-controller-utils 0.1.5-next.20261026212738 → 0.1.5-next.20261110055344

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var e = Object.defineProperty, t = (t, n) => {
3
3
  let r = {};
4
4
  for (var i in t) e(r, i, {
@@ -7,8 +7,7 @@ var e = Object.defineProperty, t = (t, n) => {
7
7
  });
8
8
  return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
9
  };
10
- //#endregion
11
- //#region src/persistence.ts
10
+ // src/persistence.ts
12
11
  function n(e) {
13
12
  return Array.isArray(e) ? e.filter((e) => e != null) : [];
14
13
  }
@@ -43,14 +42,12 @@ async function a(e, t, a, o = "value") {
43
42
  function o(e, t, n) {
44
43
  return !!(e.lockChoiceOrder || n?.["@pie-element"]?.lockChoiceOrder);
45
44
  }
46
- //#endregion
47
- //#region src/partial-scoring.ts
45
+ // src/partial-scoring.ts
48
46
  var s = /* @__PURE__ */ t({ enabled: () => c });
49
47
  function c(e, t, n) {
50
48
  return e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != "boolean" || n;
51
49
  }
52
- //#endregion
53
- //#region src/response-normalizer.ts
50
+ // src/response-normalizer.ts
54
51
  var l = /[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069\u0640]/g, u = /[\uFB50-\uFDFF\uFE70-\uFEFC]+/g, d = /\p{Nd}/u, f = /(?![0-9])\p{Nd}/gu, p = /\u066B/g, m = /\u066C/g, h = /[\u0622\u0623\u0625\u0671]/g, g = /[\u064B-\u065F\u0670]/g, _ = /* @__PURE__ */ new Map(), v = (e) => {
55
52
  let t = _.get(e);
56
53
  if (t !== void 0) return t;
@@ -88,7 +85,6 @@ var l = /[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069\u0640]/g, u = /[\uFB50-\u
88
85
  }
89
86
  }, E = (e, t = {}) => {
90
87
  let n = S(t.language), r = (t.ignoreCase ? T(e, t.language) : e).replace(l, "").replace(u, (e) => e.normalize("NFKC")).normalize("NFC");
91
- return r = y(r).replace(p, n.decimal).replace(m, n.group), t.foldLetterVariants && (r = r.replace(g, "").replace(h, "ا").replace(/\u0629/g, "ه").replace(/\u0649/g, "ي")), r;
88
+ return r = y(r).replace(p, n.decimal).replace(m, n.group), t.foldLetterVariants && (r = r.replace(g, "").replace(h, "ا").replace(/\u0629/g, "ه").replace(/\u0649/g, "ي")), t.ignoreAccents && (r = r.normalize("NFD").replace(/[\u0300-\u036F]/g, "").normalize("NFC")), t.collapseWhitespace && (r = r.replace(/\s+/g, " ").trim()), t.ignoreSlashSpacing && (r = r.replace(/\s*\/\s*/g, "/")), r;
92
89
  };
93
- //#endregion
94
90
  export { C as contentLanguage, T as foldCase, y as foldDigits, a as getShuffledChoices, o as lockChoices, E as normalizeResponse, s as partialScoring };
@@ -24,6 +24,12 @@ export interface NormalizeOptions {
24
24
  * because it changes what counts as correct spelling.
25
25
  */
26
26
  foldLetterVariants?: boolean;
27
+ /** Collapse each run of whitespace, non-breaking spaces included, to one space and trim the ends. */
28
+ collapseWhitespace?: boolean;
29
+ /** Remove whitespace around `/`, so `3 / 4` compares equal to `3/4`. */
30
+ ignoreSlashSpacing?: boolean;
31
+ /** Remove the combining diacritics U+0300–U+036F, so `é` compares equal to `e`. */
32
+ ignoreAccents?: boolean;
27
33
  }
28
34
  /** Every Unicode decimal digit (`\p{Nd}`) replaced by its ASCII digit. */
29
35
  export declare const foldDigits: (value: string) => string;
@@ -43,6 +49,7 @@ export declare const foldCase: (value: string, language?: string) => string;
43
49
  * when the options ask for it; bidi controls and tatweel removed; Arabic
44
50
  * presentation forms folded to base letters; NFC; every decimal digit folded
45
51
  * to 0–9; `٫` and `٬` replaced by the content language's decimal and group
46
- * marks. Arabic letter variants fold only when the options ask for it.
52
+ * marks. Arabic letter variants, accents, whitespace runs and the spacing
53
+ * around `/` fold only when the options ask for it.
47
54
  */
48
55
  export declare const normalizeResponse: (value: string, options?: NormalizeOptions) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/shared-controller-utils",
3
- "version": "0.1.5-next.20261026212738",
3
+ "version": "0.1.5-next.20261110055344",
4
4
  "description": "Controller utility functions for PIE elements",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "clean": "rm -rf dist"
22
22
  },
23
23
  "dependencies": {
24
- "@pie-element/shared-types": "0.2.4-next.20261026212738"
24
+ "@pie-element/shared-types": "0.2.4-next.20261109184540"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"