inferred-types 0.55.16 → 0.55.18
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/modules/constants/dist/index.cjs +120 -0
- package/modules/constants/dist/index.cjs.map +1 -1
- package/modules/constants/dist/index.d.ts +10 -1
- package/modules/constants/dist/index.js +118 -0
- package/modules/constants/dist/index.js.map +1 -1
- package/modules/inferred-types/dist/index.cjs +326 -0
- package/modules/inferred-types/dist/index.cjs.map +1 -1
- package/modules/inferred-types/dist/index.d.ts +174 -77
- package/modules/inferred-types/dist/index.js +318 -0
- package/modules/inferred-types/dist/index.js.map +1 -1
- package/modules/runtime/dist/index.cjs +214 -0
- package/modules/runtime/dist/index.cjs.map +1 -1
- package/modules/runtime/dist/index.d.ts +84 -39
- package/modules/runtime/dist/index.js +208 -0
- package/modules/runtime/dist/index.js.map +1 -1
- package/modules/types/dist/index.d.ts +82 -39
- package/package.json +1 -1
|
@@ -100,6 +100,7 @@ __export(index_exports, {
|
|
|
100
100
|
handleDoneFn: () => handleDoneFn,
|
|
101
101
|
hasCountryCode: () => hasCountryCode,
|
|
102
102
|
hasDefaultValue: () => hasDefaultValue,
|
|
103
|
+
hasHtml: () => hasHtml,
|
|
103
104
|
hasIndexOf: () => hasIndexOf,
|
|
104
105
|
hasKeys: () => hasKeys,
|
|
105
106
|
hasOverlappingKeys: () => hasOverlappingKeys,
|
|
@@ -107,6 +108,7 @@ __export(index_exports, {
|
|
|
107
108
|
hasProtocolPrefix: () => hasProtocolPrefix,
|
|
108
109
|
hasUrlPort: () => hasUrlPort,
|
|
109
110
|
hasUrlQueryParameter: () => hasUrlQueryParameter,
|
|
111
|
+
hasValidHtml: () => hasValidHtml,
|
|
110
112
|
hasWhiteSpace: () => hasWhiteSpace,
|
|
111
113
|
idLiteral: () => idLiteral,
|
|
112
114
|
idTypeGuard: () => idTypeGuard,
|
|
@@ -219,6 +221,7 @@ __export(index_exports, {
|
|
|
219
221
|
isHexadecimal: () => isHexadecimal,
|
|
220
222
|
isHmUrl: () => isHmUrl,
|
|
221
223
|
isHomeDepotUrl: () => isHomeDepotUrl,
|
|
224
|
+
isHtml: () => isHtml,
|
|
222
225
|
isHtmlElement: () => isHtmlElement,
|
|
223
226
|
isIkeaUrl: () => isIkeaUrl,
|
|
224
227
|
isIndexable: () => isIndexable,
|
|
@@ -362,6 +365,9 @@ __export(index_exports, {
|
|
|
362
365
|
isUsPhoneNumber: () => isUsPhoneNumber,
|
|
363
366
|
isUsStateAbbreviation: () => isUsStateAbbreviation,
|
|
364
367
|
isUsStateName: () => isUsStateName,
|
|
368
|
+
isValidAtomicTag: () => isValidAtomicTag,
|
|
369
|
+
isValidBlockTag: () => isValidBlockTag,
|
|
370
|
+
isValidHtml: () => isValidHtml,
|
|
365
371
|
isVariable: () => isVariable,
|
|
366
372
|
isVisa: () => isVisa,
|
|
367
373
|
isVisaMastercard: () => isVisaMastercard,
|
|
@@ -832,6 +838,120 @@ var HASH_TABLE_CHAR = {
|
|
|
832
838
|
...HASH_TABLE_ALPHA_UPPER,
|
|
833
839
|
...HASH_TABLE_SPECIAL
|
|
834
840
|
};
|
|
841
|
+
var HTML_BLOCK_TAGS = [
|
|
842
|
+
"a",
|
|
843
|
+
"abbr",
|
|
844
|
+
"address",
|
|
845
|
+
"article",
|
|
846
|
+
"aside",
|
|
847
|
+
"b",
|
|
848
|
+
"bdi",
|
|
849
|
+
"bdo",
|
|
850
|
+
"blockquote",
|
|
851
|
+
"body",
|
|
852
|
+
"button",
|
|
853
|
+
"canvas",
|
|
854
|
+
"caption",
|
|
855
|
+
"cite",
|
|
856
|
+
"code",
|
|
857
|
+
"colgroup",
|
|
858
|
+
"data",
|
|
859
|
+
"datalist",
|
|
860
|
+
"dd",
|
|
861
|
+
"del",
|
|
862
|
+
"details",
|
|
863
|
+
"dfn",
|
|
864
|
+
"dialog",
|
|
865
|
+
"div",
|
|
866
|
+
"dl",
|
|
867
|
+
"dt",
|
|
868
|
+
"em",
|
|
869
|
+
"fieldset",
|
|
870
|
+
"figcaption",
|
|
871
|
+
"figure",
|
|
872
|
+
"footer",
|
|
873
|
+
"form",
|
|
874
|
+
"h1",
|
|
875
|
+
"h2",
|
|
876
|
+
"h3",
|
|
877
|
+
"h4",
|
|
878
|
+
"h5",
|
|
879
|
+
"h6",
|
|
880
|
+
"head",
|
|
881
|
+
"header",
|
|
882
|
+
"html",
|
|
883
|
+
"i",
|
|
884
|
+
"iframe",
|
|
885
|
+
"ins",
|
|
886
|
+
"kbd",
|
|
887
|
+
"label",
|
|
888
|
+
"legend",
|
|
889
|
+
"li",
|
|
890
|
+
"main",
|
|
891
|
+
"map",
|
|
892
|
+
"mark",
|
|
893
|
+
"menu",
|
|
894
|
+
"meter",
|
|
895
|
+
"nav",
|
|
896
|
+
"noscript",
|
|
897
|
+
"object",
|
|
898
|
+
"ol",
|
|
899
|
+
"optgroup",
|
|
900
|
+
"option",
|
|
901
|
+
"output",
|
|
902
|
+
"p",
|
|
903
|
+
"picture",
|
|
904
|
+
"pre",
|
|
905
|
+
"progress",
|
|
906
|
+
"q",
|
|
907
|
+
"rp",
|
|
908
|
+
"rt",
|
|
909
|
+
"ruby",
|
|
910
|
+
"s",
|
|
911
|
+
"samp",
|
|
912
|
+
"script",
|
|
913
|
+
"section",
|
|
914
|
+
"select",
|
|
915
|
+
"small",
|
|
916
|
+
"span",
|
|
917
|
+
"strong",
|
|
918
|
+
"style",
|
|
919
|
+
"sub",
|
|
920
|
+
"summary",
|
|
921
|
+
"sup",
|
|
922
|
+
"svg",
|
|
923
|
+
"table",
|
|
924
|
+
"tbody",
|
|
925
|
+
"td",
|
|
926
|
+
"template",
|
|
927
|
+
"textarea",
|
|
928
|
+
"tfoot",
|
|
929
|
+
"th",
|
|
930
|
+
"thead",
|
|
931
|
+
"time",
|
|
932
|
+
"title",
|
|
933
|
+
"tr",
|
|
934
|
+
"u",
|
|
935
|
+
"ul",
|
|
936
|
+
"var",
|
|
937
|
+
"video"
|
|
938
|
+
];
|
|
939
|
+
var HTML_ATOMIC_TAGS = [
|
|
940
|
+
"area",
|
|
941
|
+
"base",
|
|
942
|
+
"br",
|
|
943
|
+
"col",
|
|
944
|
+
"embed",
|
|
945
|
+
"hr",
|
|
946
|
+
"img",
|
|
947
|
+
"input",
|
|
948
|
+
"link",
|
|
949
|
+
"meta",
|
|
950
|
+
"param",
|
|
951
|
+
"source",
|
|
952
|
+
"track",
|
|
953
|
+
"wbr"
|
|
954
|
+
];
|
|
835
955
|
var ISO3166_1 = [
|
|
836
956
|
{ name: "Afghanistan", alpha2: "AF", countryCode: "004", alpha3: "AFG" },
|
|
837
957
|
{ name: "Albania", alpha2: "AL", countryCode: "008", alpha3: "ALB" },
|
|
@@ -3880,6 +4000,94 @@ function startsWith(startingWith) {
|
|
|
3880
4000
|
};
|
|
3881
4001
|
}
|
|
3882
4002
|
|
|
4003
|
+
// src/type-guards/html/hasHtml.ts
|
|
4004
|
+
function hasHtml(val) {
|
|
4005
|
+
if (typeof val !== "string")
|
|
4006
|
+
return false;
|
|
4007
|
+
const htmlTagRegex = /.*<(\w+)>.*/;
|
|
4008
|
+
return !!htmlTagRegex.test(val);
|
|
4009
|
+
}
|
|
4010
|
+
function hasValidHtml(val) {
|
|
4011
|
+
if (typeof val !== "string")
|
|
4012
|
+
return false;
|
|
4013
|
+
const trimmedVal = val.trim();
|
|
4014
|
+
const tagRegex = /<\/?(\w+)([^>]*)>/g;
|
|
4015
|
+
const stack = [];
|
|
4016
|
+
let match;
|
|
4017
|
+
match = tagRegex.exec(trimmedVal);
|
|
4018
|
+
while (match !== null) {
|
|
4019
|
+
const [, tagName] = match;
|
|
4020
|
+
const isClosingTag = match[0].startsWith("</");
|
|
4021
|
+
const isAtomicTag = HTML_ATOMIC_TAGS.includes(tagName);
|
|
4022
|
+
if (isAtomicTag) {
|
|
4023
|
+
match = tagRegex.exec(trimmedVal);
|
|
4024
|
+
continue;
|
|
4025
|
+
}
|
|
4026
|
+
if (isClosingTag) {
|
|
4027
|
+
const lastTag = stack.pop();
|
|
4028
|
+
if (lastTag !== tagName) {
|
|
4029
|
+
return false;
|
|
4030
|
+
}
|
|
4031
|
+
} else {
|
|
4032
|
+
if (!HTML_BLOCK_TAGS.includes(tagName)) {
|
|
4033
|
+
return false;
|
|
4034
|
+
}
|
|
4035
|
+
stack.push(tagName);
|
|
4036
|
+
}
|
|
4037
|
+
match = tagRegex.exec(trimmedVal);
|
|
4038
|
+
}
|
|
4039
|
+
return stack.length === 0 && tagRegex.test(trimmedVal);
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4042
|
+
// src/type-guards/html/html-tags.ts
|
|
4043
|
+
function isValidBlockTag(val) {
|
|
4044
|
+
return isString(val) && HTML_BLOCK_TAGS.includes(val.toLowerCase());
|
|
4045
|
+
}
|
|
4046
|
+
function isValidAtomicTag(val) {
|
|
4047
|
+
return isString(val) && HTML_ATOMIC_TAGS.includes(val.toLowerCase());
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
// src/type-guards/html/isHtml.ts
|
|
4051
|
+
function isHtml(val) {
|
|
4052
|
+
if (typeof val !== "string")
|
|
4053
|
+
return false;
|
|
4054
|
+
const trimmedVal = val.trim();
|
|
4055
|
+
const fullHtmlRegex = /^<(\w+).*<\/\1>$/;
|
|
4056
|
+
return fullHtmlRegex.test(trimmedVal);
|
|
4057
|
+
}
|
|
4058
|
+
function isValidHtml(val) {
|
|
4059
|
+
if (typeof val !== "string")
|
|
4060
|
+
return false;
|
|
4061
|
+
const trimmedVal = val.trim();
|
|
4062
|
+
const tagRegex = /<\/?(\w+)([^>]*)>/g;
|
|
4063
|
+
const stack = [];
|
|
4064
|
+
let match = tagRegex.exec(trimmedVal);
|
|
4065
|
+
while (match !== null) {
|
|
4066
|
+
const [, tagName] = match;
|
|
4067
|
+
const isClosingTag = match[0].startsWith("</");
|
|
4068
|
+
const isAtomicTag = HTML_ATOMIC_TAGS.includes(tagName);
|
|
4069
|
+
if (isAtomicTag) {
|
|
4070
|
+
match = tagRegex.exec(trimmedVal);
|
|
4071
|
+
continue;
|
|
4072
|
+
}
|
|
4073
|
+
if (isClosingTag) {
|
|
4074
|
+
const lastTag = stack.pop();
|
|
4075
|
+
if (lastTag !== tagName) {
|
|
4076
|
+
return false;
|
|
4077
|
+
}
|
|
4078
|
+
} else {
|
|
4079
|
+
if (!HTML_BLOCK_TAGS.includes(tagName)) {
|
|
4080
|
+
return false;
|
|
4081
|
+
}
|
|
4082
|
+
stack.push(tagName);
|
|
4083
|
+
}
|
|
4084
|
+
match = tagRegex.exec(trimmedVal);
|
|
4085
|
+
}
|
|
4086
|
+
const isBalanced = stack.length === 0;
|
|
4087
|
+
const validStructureRegex = /^<(\w+)[^>]*>[\s\S]*<\/\1>$/;
|
|
4088
|
+
return isBalanced && validStructureRegex.test(trimmedVal);
|
|
4089
|
+
}
|
|
4090
|
+
|
|
3883
4091
|
// src/type-guards/html/isHtmlElement.ts
|
|
3884
4092
|
function isHtmlElement(val) {
|
|
3885
4093
|
return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
|
|
@@ -6344,6 +6552,7 @@ function asVueRef(value) {
|
|
|
6344
6552
|
handleDoneFn,
|
|
6345
6553
|
hasCountryCode,
|
|
6346
6554
|
hasDefaultValue,
|
|
6555
|
+
hasHtml,
|
|
6347
6556
|
hasIndexOf,
|
|
6348
6557
|
hasKeys,
|
|
6349
6558
|
hasOverlappingKeys,
|
|
@@ -6351,6 +6560,7 @@ function asVueRef(value) {
|
|
|
6351
6560
|
hasProtocolPrefix,
|
|
6352
6561
|
hasUrlPort,
|
|
6353
6562
|
hasUrlQueryParameter,
|
|
6563
|
+
hasValidHtml,
|
|
6354
6564
|
hasWhiteSpace,
|
|
6355
6565
|
idLiteral,
|
|
6356
6566
|
idTypeGuard,
|
|
@@ -6463,6 +6673,7 @@ function asVueRef(value) {
|
|
|
6463
6673
|
isHexadecimal,
|
|
6464
6674
|
isHmUrl,
|
|
6465
6675
|
isHomeDepotUrl,
|
|
6676
|
+
isHtml,
|
|
6466
6677
|
isHtmlElement,
|
|
6467
6678
|
isIkeaUrl,
|
|
6468
6679
|
isIndexable,
|
|
@@ -6606,6 +6817,9 @@ function asVueRef(value) {
|
|
|
6606
6817
|
isUsPhoneNumber,
|
|
6607
6818
|
isUsStateAbbreviation,
|
|
6608
6819
|
isUsStateName,
|
|
6820
|
+
isValidAtomicTag,
|
|
6821
|
+
isValidBlockTag,
|
|
6822
|
+
isValidHtml,
|
|
6609
6823
|
isVariable,
|
|
6610
6824
|
isVisa,
|
|
6611
6825
|
isVisaMastercard,
|