inferred-types 0.55.18 → 0.55.20

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.
@@ -426,6 +426,7 @@ __export(index_exports, {
426
426
  isHmUrl: () => isHmUrl,
427
427
  isHomeDepotUrl: () => isHomeDepotUrl,
428
428
  isHtml: () => isHtml,
429
+ isHtmlComponentTag: () => isHtmlComponentTag,
429
430
  isHtmlElement: () => isHtmlElement,
430
431
  isIkeaUrl: () => isIkeaUrl,
431
432
  isIndexable: () => isIndexable,
@@ -572,6 +573,7 @@ __export(index_exports, {
572
573
  isValidAtomicTag: () => isValidAtomicTag,
573
574
  isValidBlockTag: () => isValidBlockTag,
574
575
  isValidHtml: () => isValidHtml,
576
+ isValidHtmlTag: () => isValidHtmlTag,
575
577
  isVariable: () => isVariable,
576
578
  isVisa: () => isVisa,
577
579
  isVisaMastercard: () => isVisaMastercard,
@@ -698,6 +700,7 @@ __export(index_exports, {
698
700
  unset: () => unset,
699
701
  uppercase: () => uppercase,
700
702
  urlMeta: () => urlMeta,
703
+ validHtmlAttributes: () => validHtmlAttributes,
701
704
  valuesOf: () => valuesOf,
702
705
  widen: () => widen,
703
706
  withDefaults: () => withDefaults,
@@ -3107,17 +3110,17 @@ var TW_HUE = {
3107
3110
  ...TW_HUE_STATIC
3108
3111
  };
3109
3112
  var TW_LUMINOSITY = {
3110
- 50: 97.78,
3111
- 100: 93.56,
3112
- 200: 88.11,
3113
- 300: 82.67,
3114
- 400: 74.22,
3115
- 500: 64.78,
3116
- 600: 57.33,
3117
- 700: 46.89,
3118
- 800: 39.44,
3119
- 900: 32,
3120
- 950: 23.78
3113
+ "50": 97.78,
3114
+ "100": 93.56,
3115
+ "200": 88.11,
3116
+ "300": 82.67,
3117
+ "400": 74.22,
3118
+ "500": 64.78,
3119
+ "600": 57.33,
3120
+ "700": 46.89,
3121
+ "800": 39.44,
3122
+ "900": 32,
3123
+ "950": 23.78
3121
3124
  };
3122
3125
  var TW_LUMIN_50 = TW_LUMINOSITY["50"];
3123
3126
  var TW_LUMIN_100 = TW_LUMINOSITY["100"];
@@ -3131,17 +3134,17 @@ var TW_LUMIN_800 = TW_LUMINOSITY["800"];
3131
3134
  var TW_LUMIN_900 = TW_LUMINOSITY["900"];
3132
3135
  var TW_LUMIN_950 = TW_LUMINOSITY["950"];
3133
3136
  var TW_CHROMA = {
3134
- 50: 0.0108,
3135
- 100: 0.0321,
3136
- 200: 0.0609,
3137
- 300: 0.0908,
3138
- 400: 0.1398,
3139
- 500: 0.1472,
3140
- 600: 0.1299,
3141
- 700: 0.1067,
3142
- 800: 0.0898,
3143
- 900: 0.0726,
3144
- 950: 0.054
3137
+ "50": 0.0108,
3138
+ "100": 0.0321,
3139
+ "200": 0.0609,
3140
+ "300": 0.0908,
3141
+ "400": 0.1398,
3142
+ "500": 0.1472,
3143
+ "600": 0.1299,
3144
+ "700": 0.1067,
3145
+ "800": 0.0898,
3146
+ "900": 0.0726,
3147
+ "950": 0.054
3145
3148
  };
3146
3149
  var TW_CHROMA_50 = TW_CHROMA["50"];
3147
3150
  var TW_CHROMA_100 = TW_CHROMA["100"];
@@ -5349,17 +5352,17 @@ var TW_HUE2 = {
5349
5352
  ...TW_HUE_STATIC2
5350
5353
  };
5351
5354
  var TW_LUMINOSITY2 = {
5352
- 50: 97.78,
5353
- 100: 93.56,
5354
- 200: 88.11,
5355
- 300: 82.67,
5356
- 400: 74.22,
5357
- 500: 64.78,
5358
- 600: 57.33,
5359
- 700: 46.89,
5360
- 800: 39.44,
5361
- 900: 32,
5362
- 950: 23.78
5355
+ "50": 97.78,
5356
+ "100": 93.56,
5357
+ "200": 88.11,
5358
+ "300": 82.67,
5359
+ "400": 74.22,
5360
+ "500": 64.78,
5361
+ "600": 57.33,
5362
+ "700": 46.89,
5363
+ "800": 39.44,
5364
+ "900": 32,
5365
+ "950": 23.78
5363
5366
  };
5364
5367
  var TW_LUMIN_502 = TW_LUMINOSITY2["50"];
5365
5368
  var TW_LUMIN_1002 = TW_LUMINOSITY2["100"];
@@ -5373,17 +5376,17 @@ var TW_LUMIN_8002 = TW_LUMINOSITY2["800"];
5373
5376
  var TW_LUMIN_9002 = TW_LUMINOSITY2["900"];
5374
5377
  var TW_LUMIN_9502 = TW_LUMINOSITY2["950"];
5375
5378
  var TW_CHROMA2 = {
5376
- 50: 0.0108,
5377
- 100: 0.0321,
5378
- 200: 0.0609,
5379
- 300: 0.0908,
5380
- 400: 0.1398,
5381
- 500: 0.1472,
5382
- 600: 0.1299,
5383
- 700: 0.1067,
5384
- 800: 0.0898,
5385
- 900: 0.0726,
5386
- 950: 0.054
5379
+ "50": 0.0108,
5380
+ "100": 0.0321,
5381
+ "200": 0.0609,
5382
+ "300": 0.0908,
5383
+ "400": 0.1398,
5384
+ "500": 0.1472,
5385
+ "600": 0.1299,
5386
+ "700": 0.1067,
5387
+ "800": 0.0898,
5388
+ "900": 0.0726,
5389
+ "950": 0.054
5387
5390
  };
5388
5391
  var TW_CHROMA_502 = TW_CHROMA2["50"];
5389
5392
  var TW_CHROMA_1002 = TW_CHROMA2["100"];
@@ -6675,6 +6678,34 @@ function startsWith(startingWith) {
6675
6678
  return isString(val) ? !!val.startsWith(startingWith) : isNumber(val) ? !!String(val).startsWith(startingWith) : false;
6676
6679
  };
6677
6680
  }
6681
+ function isHtmlComponentTag(...names) {
6682
+ return (val) => {
6683
+ if (typeof val !== "string")
6684
+ return false;
6685
+ const trimmedVal = val.trim();
6686
+ const tagRegex = /^<\/?([\w-]+)(.*?)>$/;
6687
+ const match = tagRegex.exec(trimmedVal);
6688
+ if (!match) {
6689
+ return false;
6690
+ }
6691
+ const [, tagName, attributes] = match;
6692
+ const isClosingTag = trimmedVal.startsWith("</");
6693
+ const isKebabCase = /^[a-z][a-z0-9-]*$/.test(tagName);
6694
+ const isPascalCase = /^[A-Z][a-zA-Z0-9]*$/.test(tagName);
6695
+ const normalizedKebabCase = toKebabCase(tagName);
6696
+ const normalizedPascalCase = toPascalCase(tagName);
6697
+ const isValidName = names.some(
6698
+ (name) => isKebabCase && normalizedKebabCase === toKebabCase(name) || isPascalCase && normalizedPascalCase === toPascalCase(name)
6699
+ );
6700
+ if (!isValidName) {
6701
+ return false;
6702
+ }
6703
+ if (isClosingTag) {
6704
+ return attributes.trim() === "";
6705
+ }
6706
+ return validHtmlAttributes(attributes);
6707
+ };
6708
+ }
6678
6709
  function hasHtml(val) {
6679
6710
  if (typeof val !== "string")
6680
6711
  return false;
@@ -6718,6 +6749,39 @@ function isValidBlockTag(val) {
6718
6749
  function isValidAtomicTag(val) {
6719
6750
  return isString(val) && HTML_ATOMIC_TAGS2.includes(val.toLowerCase());
6720
6751
  }
6752
+ function isValidHtmlTag(...tags) {
6753
+ return (val) => {
6754
+ if (typeof val !== "string")
6755
+ return false;
6756
+ const trimmedVal = val.trim();
6757
+ const tagRegex = /^<\/?(\w+)(.*?)>$/;
6758
+ const match = tagRegex.exec(trimmedVal);
6759
+ if (!match) {
6760
+ return false;
6761
+ }
6762
+ const [, tagName, attributes] = match;
6763
+ const normalizedTagName = tagName.toLowerCase();
6764
+ const isClosingTag = trimmedVal.startsWith("</");
6765
+ const isAtomicTag = HTML_ATOMIC_TAGS2.includes(normalizedTagName);
6766
+ const isBlockTag = HTML_BLOCK_TAGS2.includes(normalizedTagName);
6767
+ if (
6768
+ // Validate tag name is within the provided `tags` scope
6769
+ !tags.map((t) => t.toLowerCase()).includes(normalizedTagName)
6770
+ ) {
6771
+ return false;
6772
+ }
6773
+ if (isClosingTag) {
6774
+ return attributes.trim() === "" && !isAtomicTag;
6775
+ }
6776
+ if (isAtomicTag) {
6777
+ return attributes.trim() === "" || validHtmlAttributes(attributes);
6778
+ }
6779
+ if (isBlockTag) {
6780
+ return validHtmlAttributes(attributes);
6781
+ }
6782
+ return false;
6783
+ };
6784
+ }
6721
6785
  function isHtml(val) {
6722
6786
  if (typeof val !== "string")
6723
6787
  return false;
@@ -6760,6 +6824,14 @@ function isValidHtml(val) {
6760
6824
  function isHtmlElement(val) {
6761
6825
  return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
6762
6826
  }
6827
+ function validHtmlAttributes(val) {
6828
+ if (typeof val !== "string")
6829
+ return false;
6830
+ const quoteRegex = /["']/g;
6831
+ const unmatchedQuotes = (val.match(quoteRegex)?.length || 0) % 2 !== 0;
6832
+ const invalidAssignment = /(\w+=)(?=\s|>|$)/.test(val);
6833
+ return !val.includes(">") && !unmatchedQuotes && !invalidAssignment;
6834
+ }
6763
6835
  function isAlpha(value) {
6764
6836
  return isString(value) && split(value).every((v) => ALPHA_CHARS2.includes(v));
6765
6837
  }
@@ -9383,6 +9455,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
9383
9455
  isHmUrl,
9384
9456
  isHomeDepotUrl,
9385
9457
  isHtml,
9458
+ isHtmlComponentTag,
9386
9459
  isHtmlElement,
9387
9460
  isIkeaUrl,
9388
9461
  isIndexable,
@@ -9529,6 +9602,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
9529
9602
  isValidAtomicTag,
9530
9603
  isValidBlockTag,
9531
9604
  isValidHtml,
9605
+ isValidHtmlTag,
9532
9606
  isVariable,
9533
9607
  isVisa,
9534
9608
  isVisaMastercard,
@@ -9655,6 +9729,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
9655
9729
  unset,
9656
9730
  uppercase,
9657
9731
  urlMeta,
9732
+ validHtmlAttributes,
9658
9733
  valuesOf,
9659
9734
  widen,
9660
9735
  withDefaults,