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.
@@ -2394,17 +2394,17 @@ var TW_HUE = {
2394
2394
  ...TW_HUE_STATIC
2395
2395
  };
2396
2396
  var TW_LUMINOSITY = {
2397
- 50: 97.78,
2398
- 100: 93.56,
2399
- 200: 88.11,
2400
- 300: 82.67,
2401
- 400: 74.22,
2402
- 500: 64.78,
2403
- 600: 57.33,
2404
- 700: 46.89,
2405
- 800: 39.44,
2406
- 900: 32,
2407
- 950: 23.78
2397
+ "50": 97.78,
2398
+ "100": 93.56,
2399
+ "200": 88.11,
2400
+ "300": 82.67,
2401
+ "400": 74.22,
2402
+ "500": 64.78,
2403
+ "600": 57.33,
2404
+ "700": 46.89,
2405
+ "800": 39.44,
2406
+ "900": 32,
2407
+ "950": 23.78
2408
2408
  };
2409
2409
  var TW_LUMIN_50 = TW_LUMINOSITY["50"];
2410
2410
  var TW_LUMIN_100 = TW_LUMINOSITY["100"];
@@ -2418,17 +2418,17 @@ var TW_LUMIN_800 = TW_LUMINOSITY["800"];
2418
2418
  var TW_LUMIN_900 = TW_LUMINOSITY["900"];
2419
2419
  var TW_LUMIN_950 = TW_LUMINOSITY["950"];
2420
2420
  var TW_CHROMA = {
2421
- 50: 0.0108,
2422
- 100: 0.0321,
2423
- 200: 0.0609,
2424
- 300: 0.0908,
2425
- 400: 0.1398,
2426
- 500: 0.1472,
2427
- 600: 0.1299,
2428
- 700: 0.1067,
2429
- 800: 0.0898,
2430
- 900: 0.0726,
2431
- 950: 0.054
2421
+ "50": 0.0108,
2422
+ "100": 0.0321,
2423
+ "200": 0.0609,
2424
+ "300": 0.0908,
2425
+ "400": 0.1398,
2426
+ "500": 0.1472,
2427
+ "600": 0.1299,
2428
+ "700": 0.1067,
2429
+ "800": 0.0898,
2430
+ "900": 0.0726,
2431
+ "950": 0.054
2432
2432
  };
2433
2433
  var TW_CHROMA_50 = TW_CHROMA["50"];
2434
2434
  var TW_CHROMA_100 = TW_CHROMA["100"];
@@ -4636,17 +4636,17 @@ var TW_HUE2 = {
4636
4636
  ...TW_HUE_STATIC2
4637
4637
  };
4638
4638
  var TW_LUMINOSITY2 = {
4639
- 50: 97.78,
4640
- 100: 93.56,
4641
- 200: 88.11,
4642
- 300: 82.67,
4643
- 400: 74.22,
4644
- 500: 64.78,
4645
- 600: 57.33,
4646
- 700: 46.89,
4647
- 800: 39.44,
4648
- 900: 32,
4649
- 950: 23.78
4639
+ "50": 97.78,
4640
+ "100": 93.56,
4641
+ "200": 88.11,
4642
+ "300": 82.67,
4643
+ "400": 74.22,
4644
+ "500": 64.78,
4645
+ "600": 57.33,
4646
+ "700": 46.89,
4647
+ "800": 39.44,
4648
+ "900": 32,
4649
+ "950": 23.78
4650
4650
  };
4651
4651
  var TW_LUMIN_502 = TW_LUMINOSITY2["50"];
4652
4652
  var TW_LUMIN_1002 = TW_LUMINOSITY2["100"];
@@ -4660,17 +4660,17 @@ var TW_LUMIN_8002 = TW_LUMINOSITY2["800"];
4660
4660
  var TW_LUMIN_9002 = TW_LUMINOSITY2["900"];
4661
4661
  var TW_LUMIN_9502 = TW_LUMINOSITY2["950"];
4662
4662
  var TW_CHROMA2 = {
4663
- 50: 0.0108,
4664
- 100: 0.0321,
4665
- 200: 0.0609,
4666
- 300: 0.0908,
4667
- 400: 0.1398,
4668
- 500: 0.1472,
4669
- 600: 0.1299,
4670
- 700: 0.1067,
4671
- 800: 0.0898,
4672
- 900: 0.0726,
4673
- 950: 0.054
4663
+ "50": 0.0108,
4664
+ "100": 0.0321,
4665
+ "200": 0.0609,
4666
+ "300": 0.0908,
4667
+ "400": 0.1398,
4668
+ "500": 0.1472,
4669
+ "600": 0.1299,
4670
+ "700": 0.1067,
4671
+ "800": 0.0898,
4672
+ "900": 0.0726,
4673
+ "950": 0.054
4674
4674
  };
4675
4675
  var TW_CHROMA_502 = TW_CHROMA2["50"];
4676
4676
  var TW_CHROMA_1002 = TW_CHROMA2["100"];
@@ -5962,6 +5962,34 @@ function startsWith(startingWith) {
5962
5962
  return isString(val) ? !!val.startsWith(startingWith) : isNumber(val) ? !!String(val).startsWith(startingWith) : false;
5963
5963
  };
5964
5964
  }
5965
+ function isHtmlComponentTag(...names) {
5966
+ return (val) => {
5967
+ if (typeof val !== "string")
5968
+ return false;
5969
+ const trimmedVal = val.trim();
5970
+ const tagRegex = /^<\/?([\w-]+)(.*?)>$/;
5971
+ const match = tagRegex.exec(trimmedVal);
5972
+ if (!match) {
5973
+ return false;
5974
+ }
5975
+ const [, tagName, attributes] = match;
5976
+ const isClosingTag = trimmedVal.startsWith("</");
5977
+ const isKebabCase = /^[a-z][a-z0-9-]*$/.test(tagName);
5978
+ const isPascalCase = /^[A-Z][a-zA-Z0-9]*$/.test(tagName);
5979
+ const normalizedKebabCase = toKebabCase(tagName);
5980
+ const normalizedPascalCase = toPascalCase(tagName);
5981
+ const isValidName = names.some(
5982
+ (name) => isKebabCase && normalizedKebabCase === toKebabCase(name) || isPascalCase && normalizedPascalCase === toPascalCase(name)
5983
+ );
5984
+ if (!isValidName) {
5985
+ return false;
5986
+ }
5987
+ if (isClosingTag) {
5988
+ return attributes.trim() === "";
5989
+ }
5990
+ return validHtmlAttributes(attributes);
5991
+ };
5992
+ }
5965
5993
  function hasHtml(val) {
5966
5994
  if (typeof val !== "string")
5967
5995
  return false;
@@ -6005,6 +6033,39 @@ function isValidBlockTag(val) {
6005
6033
  function isValidAtomicTag(val) {
6006
6034
  return isString(val) && HTML_ATOMIC_TAGS2.includes(val.toLowerCase());
6007
6035
  }
6036
+ function isValidHtmlTag(...tags) {
6037
+ return (val) => {
6038
+ if (typeof val !== "string")
6039
+ return false;
6040
+ const trimmedVal = val.trim();
6041
+ const tagRegex = /^<\/?(\w+)(.*?)>$/;
6042
+ const match = tagRegex.exec(trimmedVal);
6043
+ if (!match) {
6044
+ return false;
6045
+ }
6046
+ const [, tagName, attributes] = match;
6047
+ const normalizedTagName = tagName.toLowerCase();
6048
+ const isClosingTag = trimmedVal.startsWith("</");
6049
+ const isAtomicTag = HTML_ATOMIC_TAGS2.includes(normalizedTagName);
6050
+ const isBlockTag = HTML_BLOCK_TAGS2.includes(normalizedTagName);
6051
+ if (
6052
+ // Validate tag name is within the provided `tags` scope
6053
+ !tags.map((t) => t.toLowerCase()).includes(normalizedTagName)
6054
+ ) {
6055
+ return false;
6056
+ }
6057
+ if (isClosingTag) {
6058
+ return attributes.trim() === "" && !isAtomicTag;
6059
+ }
6060
+ if (isAtomicTag) {
6061
+ return attributes.trim() === "" || validHtmlAttributes(attributes);
6062
+ }
6063
+ if (isBlockTag) {
6064
+ return validHtmlAttributes(attributes);
6065
+ }
6066
+ return false;
6067
+ };
6068
+ }
6008
6069
  function isHtml(val) {
6009
6070
  if (typeof val !== "string")
6010
6071
  return false;
@@ -6047,6 +6108,14 @@ function isValidHtml(val) {
6047
6108
  function isHtmlElement(val) {
6048
6109
  return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
6049
6110
  }
6111
+ function validHtmlAttributes(val) {
6112
+ if (typeof val !== "string")
6113
+ return false;
6114
+ const quoteRegex = /["']/g;
6115
+ const unmatchedQuotes = (val.match(quoteRegex)?.length || 0) % 2 !== 0;
6116
+ const invalidAssignment = /(\w+=)(?=\s|>|$)/.test(val);
6117
+ return !val.includes(">") && !unmatchedQuotes && !invalidAssignment;
6118
+ }
6050
6119
  function isAlpha(value) {
6051
6120
  return isString(value) && split(value).every((v) => ALPHA_CHARS2.includes(v));
6052
6121
  }
@@ -8669,6 +8738,7 @@ export {
8669
8738
  isHmUrl,
8670
8739
  isHomeDepotUrl,
8671
8740
  isHtml,
8741
+ isHtmlComponentTag,
8672
8742
  isHtmlElement,
8673
8743
  isIkeaUrl,
8674
8744
  isIndexable,
@@ -8815,6 +8885,7 @@ export {
8815
8885
  isValidAtomicTag,
8816
8886
  isValidBlockTag,
8817
8887
  isValidHtml,
8888
+ isValidHtmlTag,
8818
8889
  isVariable,
8819
8890
  isVisa,
8820
8891
  isVisaMastercard,
@@ -8941,6 +9012,7 @@ export {
8941
9012
  unset,
8942
9013
  uppercase,
8943
9014
  urlMeta,
9015
+ validHtmlAttributes,
8944
9016
  valuesOf,
8945
9017
  widen,
8946
9018
  withDefaults,