@singi-labs/sifa-sdk 0.9.3 → 0.9.4

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.cjs CHANGED
@@ -693,6 +693,10 @@ function getWorkplaceTypeLabel(value) {
693
693
  var PLATFORM_LABELS = {
694
694
  bluesky: "Bluesky",
695
695
  github: "GitHub",
696
+ codeberg: "Codeberg",
697
+ gitlab: "GitLab",
698
+ forgejo: "Forgejo",
699
+ gitea: "Gitea",
696
700
  linkedin: "LinkedIn",
697
701
  youtube: "YouTube",
698
702
  twitter: "X (Twitter)",
@@ -957,6 +961,31 @@ function detectPdsProvider(handle) {
957
961
  return null;
958
962
  }
959
963
 
964
+ // src/format/text-sanitize.ts
965
+ var COMBINING_MARK = /\p{M}/u;
966
+ var BIDI_CONTROLS = /[‎‏‪-‮⁦-⁩]/gu;
967
+ function limitCombiningMarks(value, maxPerBase = 4) {
968
+ if (!value || !COMBINING_MARK.test(value)) return value;
969
+ let out = "";
970
+ let combiningRun = 0;
971
+ for (const char of value) {
972
+ if (/\p{M}/u.test(char)) {
973
+ if (combiningRun < maxPerBase) {
974
+ out += char;
975
+ combiningRun += 1;
976
+ }
977
+ } else {
978
+ out += char;
979
+ combiningRun = 0;
980
+ }
981
+ }
982
+ return out;
983
+ }
984
+ function sanitizeDisplayText(value, maxCombiningPerBase = 4) {
985
+ if (!value) return value;
986
+ return limitCombiningMarks(value.replace(BIDI_CONTROLS, ""), maxCombiningPerBase);
987
+ }
988
+
960
989
  // src/format/text-truncate.ts
961
990
  var ELLIPSIS = "\u2026";
962
991
  function truncateGraphemes(value, maxLen) {
@@ -1231,7 +1260,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
1231
1260
  });
1232
1261
 
1233
1262
  // src/index.ts
1234
- var SIFA_SDK_VERSION = "0.9.3";
1263
+ var SIFA_SDK_VERSION = "0.9.4";
1235
1264
 
1236
1265
  exports.CATEGORY_LABELS = CATEGORY_LABELS;
1237
1266
  exports.CATEGORY_ORDER = CATEGORY_ORDER;
@@ -1300,6 +1329,7 @@ exports.isKnownPlatform = isKnownPlatform;
1300
1329
  exports.isValidRgbColor = isValidRgbColor;
1301
1330
  exports.languageTagSchema = languageTagSchema;
1302
1331
  exports.lexiconDateExtractor = lexiconDateExtractor;
1332
+ exports.limitCombiningMarks = limitCombiningMarks;
1303
1333
  exports.maxGraphemes = maxGraphemes;
1304
1334
  exports.meetsContrastAA = meetsContrastAA;
1305
1335
  exports.parseLocationString = parseLocationString;
@@ -1307,6 +1337,7 @@ exports.pdsProviderFromApi = pdsProviderFromApi;
1307
1337
  exports.profileToDimensionInputs = profileToDimensionInputs;
1308
1338
  exports.relativeLuminance = relativeLuminance;
1309
1339
  exports.rgbToString = rgbToString;
1340
+ exports.sanitizeDisplayText = sanitizeDisplayText;
1310
1341
  exports.sanitizeHandleInput = sanitizeHandleInput;
1311
1342
  exports.selfLabelsSchema = selfLabelsSchema;
1312
1343
  exports.singleDateExtractor = singleDateExtractor;