@zthun/trilean-web 2.0.0 → 2.0.2
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/assets/icons.js +17 -14
- package/dist/assets/icons.svg +1 -1
- package/dist/assets/main.js +5 -4
- package/dist/assets/search.js +1 -1
- package/dist/assets/style.css +67 -31
- package/dist/classes/ZTrilean.html +18 -18
- package/dist/index.html +14 -10
- package/dist/media/README.md +55 -0
- package/dist/modules.html +2 -2
- package/dist/types/ZIntrinsic.html +3 -3
- package/dist/types/indeterminate.html +6 -5
- package/dist/types/trilean.html +3 -3
- package/package.json +6 -6
package/dist/assets/style.css
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
--light-color-text: #222;
|
|
11
11
|
--light-color-text-aside: #6e6e6e;
|
|
12
12
|
--light-color-link: #1f70c2;
|
|
13
|
+
--light-color-focus-outline: #3584e4;
|
|
13
14
|
|
|
14
15
|
--light-color-ts-keyword: #056bd6;
|
|
15
16
|
--light-color-ts-project: #b111c9;
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
--light-color-ts-set-signature: var(--light-color-ts-accessor);
|
|
36
37
|
--light-color-ts-type-alias: #d51270;
|
|
37
38
|
/* reference not included as links will be colored with the kind that it points to */
|
|
39
|
+
--light-color-document: #000000;
|
|
38
40
|
|
|
39
41
|
--light-external-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='10' height='10'><path fill-opacity='0' stroke='%23000' stroke-width='10' d='m43,35H5v60h60V57M45,5v10l10,10-30,30 20,20 30-30 10,10h10V5z'/></svg>");
|
|
40
42
|
--light-color-scheme: light;
|
|
@@ -50,6 +52,7 @@
|
|
|
50
52
|
--dark-color-text: #f5f5f5;
|
|
51
53
|
--dark-color-text-aside: #dddddd;
|
|
52
54
|
--dark-color-link: #00aff4;
|
|
55
|
+
--dark-color-focus-outline: #4c97f2;
|
|
53
56
|
|
|
54
57
|
--dark-color-ts-keyword: #3399ff;
|
|
55
58
|
--dark-color-ts-project: #e358ff;
|
|
@@ -75,6 +78,7 @@
|
|
|
75
78
|
--dark-color-ts-set-signature: var(--dark-color-ts-accessor);
|
|
76
79
|
--dark-color-ts-type-alias: #ff6492;
|
|
77
80
|
/* reference not included as links will be colored with the kind that it points to */
|
|
81
|
+
--dark-color-document: #ffffff;
|
|
78
82
|
|
|
79
83
|
--dark-external-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='10' height='10'><path fill-opacity='0' stroke='%23fff' stroke-width='10' d='m43,35H5v60h60V57M45,5v10l10,10-30,30 20,20 30-30 10,10h10V5z'/></svg>");
|
|
80
84
|
--dark-color-scheme: dark;
|
|
@@ -92,6 +96,7 @@
|
|
|
92
96
|
--color-text: var(--light-color-text);
|
|
93
97
|
--color-text-aside: var(--light-color-text-aside);
|
|
94
98
|
--color-link: var(--light-color-link);
|
|
99
|
+
--color-focus-outline: var(--light-color-focus-outline);
|
|
95
100
|
|
|
96
101
|
--color-ts-keyword: var(--light-color-ts-keyword);
|
|
97
102
|
--color-ts-module: var(--light-color-ts-module);
|
|
@@ -116,6 +121,7 @@
|
|
|
116
121
|
--color-ts-get-signature: var(--light-color-ts-get-signature);
|
|
117
122
|
--color-ts-set-signature: var(--light-color-ts-set-signature);
|
|
118
123
|
--color-ts-type-alias: var(--light-color-ts-type-alias);
|
|
124
|
+
--color-document: var(--light-color-document);
|
|
119
125
|
|
|
120
126
|
--external-icon: var(--light-external-icon);
|
|
121
127
|
--color-scheme: var(--light-color-scheme);
|
|
@@ -134,6 +140,7 @@
|
|
|
134
140
|
--color-text: var(--dark-color-text);
|
|
135
141
|
--color-text-aside: var(--dark-color-text-aside);
|
|
136
142
|
--color-link: var(--dark-color-link);
|
|
143
|
+
--color-focus-outline: var(--dark-color-focus-outline);
|
|
137
144
|
|
|
138
145
|
--color-ts-keyword: var(--dark-color-ts-keyword);
|
|
139
146
|
--color-ts-module: var(--dark-color-ts-module);
|
|
@@ -158,6 +165,7 @@
|
|
|
158
165
|
--color-ts-get-signature: var(--dark-color-ts-get-signature);
|
|
159
166
|
--color-ts-set-signature: var(--dark-color-ts-set-signature);
|
|
160
167
|
--color-ts-type-alias: var(--dark-color-ts-type-alias);
|
|
168
|
+
--color-document: var(--dark-color-document);
|
|
161
169
|
|
|
162
170
|
--external-icon: var(--dark-external-icon);
|
|
163
171
|
--color-scheme: var(--dark-color-scheme);
|
|
@@ -183,6 +191,7 @@ body {
|
|
|
183
191
|
--color-text: var(--light-color-text);
|
|
184
192
|
--color-text-aside: var(--light-color-text-aside);
|
|
185
193
|
--color-link: var(--light-color-link);
|
|
194
|
+
--color-focus-outline: var(--light-color-focus-outline);
|
|
186
195
|
|
|
187
196
|
--color-ts-keyword: var(--light-color-ts-keyword);
|
|
188
197
|
--color-ts-module: var(--light-color-ts-module);
|
|
@@ -207,6 +216,7 @@ body {
|
|
|
207
216
|
--color-ts-get-signature: var(--light-color-ts-get-signature);
|
|
208
217
|
--color-ts-set-signature: var(--light-color-ts-set-signature);
|
|
209
218
|
--color-ts-type-alias: var(--light-color-ts-type-alias);
|
|
219
|
+
--color-document: var(--light-color-document);
|
|
210
220
|
|
|
211
221
|
--external-icon: var(--light-external-icon);
|
|
212
222
|
--color-scheme: var(--light-color-scheme);
|
|
@@ -223,6 +233,7 @@ body {
|
|
|
223
233
|
--color-text: var(--dark-color-text);
|
|
224
234
|
--color-text-aside: var(--dark-color-text-aside);
|
|
225
235
|
--color-link: var(--dark-color-link);
|
|
236
|
+
--color-focus-outline: var(--dark-color-focus-outline);
|
|
226
237
|
|
|
227
238
|
--color-ts-keyword: var(--dark-color-ts-keyword);
|
|
228
239
|
--color-ts-module: var(--dark-color-ts-module);
|
|
@@ -247,11 +258,17 @@ body {
|
|
|
247
258
|
--color-ts-get-signature: var(--dark-color-ts-get-signature);
|
|
248
259
|
--color-ts-set-signature: var(--dark-color-ts-set-signature);
|
|
249
260
|
--color-ts-type-alias: var(--dark-color-ts-type-alias);
|
|
261
|
+
--color-document: var(--dark-color-document);
|
|
250
262
|
|
|
251
263
|
--external-icon: var(--dark-external-icon);
|
|
252
264
|
--color-scheme: var(--dark-color-scheme);
|
|
253
265
|
}
|
|
254
266
|
|
|
267
|
+
*:focus-visible,
|
|
268
|
+
.tsd-accordion-summary:focus-visible svg {
|
|
269
|
+
outline: 2px solid var(--color-focus-outline);
|
|
270
|
+
}
|
|
271
|
+
|
|
255
272
|
.always-visible,
|
|
256
273
|
.always-visible .tsd-signatures {
|
|
257
274
|
display: inherit !important;
|
|
@@ -266,16 +283,6 @@ h6 {
|
|
|
266
283
|
line-height: 1.2;
|
|
267
284
|
}
|
|
268
285
|
|
|
269
|
-
h1 > a:not(.link),
|
|
270
|
-
h2 > a:not(.link),
|
|
271
|
-
h3 > a:not(.link),
|
|
272
|
-
h4 > a:not(.link),
|
|
273
|
-
h5 > a:not(.link),
|
|
274
|
-
h6 > a:not(.link) {
|
|
275
|
-
text-decoration: none;
|
|
276
|
-
color: var(--color-text);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
286
|
h1 {
|
|
280
287
|
font-size: 1.875rem;
|
|
281
288
|
margin: 0.67rem 0;
|
|
@@ -306,10 +313,6 @@ h6 {
|
|
|
306
313
|
margin: 2.33rem 0;
|
|
307
314
|
}
|
|
308
315
|
|
|
309
|
-
.uppercase {
|
|
310
|
-
text-transform: uppercase;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
316
|
dl,
|
|
314
317
|
menu,
|
|
315
318
|
ol,
|
|
@@ -333,7 +336,7 @@ footer {
|
|
|
333
336
|
padding-bottom: 1rem;
|
|
334
337
|
max-height: 3.5rem;
|
|
335
338
|
}
|
|
336
|
-
|
|
339
|
+
footer > p {
|
|
337
340
|
margin: 0 1em;
|
|
338
341
|
}
|
|
339
342
|
|
|
@@ -421,6 +424,9 @@ a.external[target="_blank"] {
|
|
|
421
424
|
background-repeat: no-repeat;
|
|
422
425
|
padding-right: 13px;
|
|
423
426
|
}
|
|
427
|
+
a.tsd-anchor-link {
|
|
428
|
+
color: var(--color-text);
|
|
429
|
+
}
|
|
424
430
|
|
|
425
431
|
code,
|
|
426
432
|
pre {
|
|
@@ -580,13 +586,13 @@ dl.tsd-comment-tag-group p {
|
|
|
580
586
|
}
|
|
581
587
|
.tsd-filter-input {
|
|
582
588
|
display: flex;
|
|
583
|
-
width: fit-content;
|
|
584
589
|
width: -moz-fit-content;
|
|
590
|
+
width: fit-content;
|
|
585
591
|
align-items: center;
|
|
586
|
-
user-select: none;
|
|
587
592
|
-webkit-user-select: none;
|
|
588
593
|
-moz-user-select: none;
|
|
589
594
|
-ms-user-select: none;
|
|
595
|
+
user-select: none;
|
|
590
596
|
cursor: pointer;
|
|
591
597
|
}
|
|
592
598
|
.tsd-filter-input input[type="checkbox"] {
|
|
@@ -609,11 +615,8 @@ dl.tsd-comment-tag-group p {
|
|
|
609
615
|
Don't remove unless you know what you're doing. */
|
|
610
616
|
opacity: 0.99;
|
|
611
617
|
}
|
|
612
|
-
.tsd-filter-input input[type="checkbox"]:focus + svg {
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
.tsd-filter-input input[type="checkbox"]:focus:not(:focus-visible) + svg {
|
|
616
|
-
transform: scale(1);
|
|
618
|
+
.tsd-filter-input input[type="checkbox"]:focus-visible + svg {
|
|
619
|
+
outline: 2px solid var(--color-focus-outline);
|
|
617
620
|
}
|
|
618
621
|
.tsd-checkbox-background {
|
|
619
622
|
fill: var(--color-accent);
|
|
@@ -630,13 +633,18 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark {
|
|
|
630
633
|
stroke: var(--color-accent);
|
|
631
634
|
}
|
|
632
635
|
|
|
633
|
-
.
|
|
634
|
-
|
|
636
|
+
.settings-label {
|
|
637
|
+
font-weight: bold;
|
|
638
|
+
text-transform: uppercase;
|
|
639
|
+
display: inline-block;
|
|
635
640
|
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
641
|
+
|
|
642
|
+
.tsd-filter-visibility .settings-label {
|
|
643
|
+
margin: 0.75rem 0 0.5rem 0;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
.tsd-theme-toggle .settings-label {
|
|
647
|
+
margin: 0.75rem 0.75rem 0 0;
|
|
640
648
|
}
|
|
641
649
|
|
|
642
650
|
.tsd-hierarchy {
|
|
@@ -769,6 +777,9 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark {
|
|
|
769
777
|
padding: 0;
|
|
770
778
|
max-width: 100%;
|
|
771
779
|
}
|
|
780
|
+
.tsd-navigation .tsd-nav-link {
|
|
781
|
+
display: none;
|
|
782
|
+
}
|
|
772
783
|
.tsd-nested-navigation {
|
|
773
784
|
margin-left: 3rem;
|
|
774
785
|
}
|
|
@@ -782,6 +793,15 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark {
|
|
|
782
793
|
margin-left: -1.5rem;
|
|
783
794
|
}
|
|
784
795
|
|
|
796
|
+
.tsd-page-navigation-section {
|
|
797
|
+
margin-left: 10px;
|
|
798
|
+
}
|
|
799
|
+
.tsd-page-navigation-section > summary {
|
|
800
|
+
padding: 0.25rem;
|
|
801
|
+
}
|
|
802
|
+
.tsd-page-navigation-section > div {
|
|
803
|
+
margin-left: 20px;
|
|
804
|
+
}
|
|
785
805
|
.tsd-page-navigation ul {
|
|
786
806
|
padding-left: 1.75rem;
|
|
787
807
|
}
|
|
@@ -812,10 +832,10 @@ a.tsd-index-link {
|
|
|
812
832
|
}
|
|
813
833
|
.tsd-accordion-summary,
|
|
814
834
|
.tsd-accordion-summary a {
|
|
815
|
-
user-select: none;
|
|
816
835
|
-moz-user-select: none;
|
|
817
836
|
-webkit-user-select: none;
|
|
818
837
|
-ms-user-select: none;
|
|
838
|
+
user-select: none;
|
|
819
839
|
|
|
820
840
|
cursor: pointer;
|
|
821
841
|
}
|
|
@@ -828,8 +848,9 @@ a.tsd-index-link {
|
|
|
828
848
|
padding-top: 0;
|
|
829
849
|
padding-bottom: 0;
|
|
830
850
|
}
|
|
831
|
-
.tsd-
|
|
851
|
+
.tsd-accordion .tsd-accordion-summary > svg {
|
|
832
852
|
margin-left: 0.25rem;
|
|
853
|
+
vertical-align: text-top;
|
|
833
854
|
}
|
|
834
855
|
.tsd-index-content > :not(:first-child) {
|
|
835
856
|
margin-top: 0.75rem;
|
|
@@ -877,7 +898,7 @@ a.tsd-index-link {
|
|
|
877
898
|
}
|
|
878
899
|
|
|
879
900
|
.tsd-panel-group {
|
|
880
|
-
margin:
|
|
901
|
+
margin: 2rem 0;
|
|
881
902
|
}
|
|
882
903
|
.tsd-panel-group.tsd-index-group {
|
|
883
904
|
margin: 2rem 0;
|
|
@@ -885,6 +906,9 @@ a.tsd-index-link {
|
|
|
885
906
|
.tsd-panel-group.tsd-index-group details {
|
|
886
907
|
margin: 2rem 0;
|
|
887
908
|
}
|
|
909
|
+
.tsd-panel-group > .tsd-accordion-summary {
|
|
910
|
+
margin-bottom: 1rem;
|
|
911
|
+
}
|
|
888
912
|
|
|
889
913
|
#tsd-search {
|
|
890
914
|
transition: background-color 0.2s;
|
|
@@ -1034,6 +1058,12 @@ a.tsd-index-link {
|
|
|
1034
1058
|
border-width: 1px 0;
|
|
1035
1059
|
transition: background-color 0.1s;
|
|
1036
1060
|
}
|
|
1061
|
+
.tsd-signatures .tsd-index-signature:not(:last-child) {
|
|
1062
|
+
margin-bottom: 1em;
|
|
1063
|
+
}
|
|
1064
|
+
.tsd-signatures .tsd-index-signature .tsd-signature {
|
|
1065
|
+
border-width: 1px;
|
|
1066
|
+
}
|
|
1037
1067
|
.tsd-description .tsd-signatures .tsd-signature {
|
|
1038
1068
|
border-width: 1px;
|
|
1039
1069
|
}
|
|
@@ -1347,6 +1377,12 @@ img {
|
|
|
1347
1377
|
.has-menu .tsd-navigation {
|
|
1348
1378
|
max-height: 100%;
|
|
1349
1379
|
}
|
|
1380
|
+
#tsd-toolbar-links {
|
|
1381
|
+
display: none;
|
|
1382
|
+
}
|
|
1383
|
+
.tsd-navigation .tsd-nav-link {
|
|
1384
|
+
display: flex;
|
|
1385
|
+
}
|
|
1350
1386
|
}
|
|
1351
1387
|
|
|
1352
1388
|
/* one sidebar */
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><head><meta
|
|
2
|
-
</head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@zthun/trilean</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@zthun/trilean</a></li><li><a href="ZTrilean.html">ZTrilean</a></li></ul><h1>Class ZTrilean<code class="tsd-tag
|
|
3
|
-
</div><div class="tsd-comment tsd-typography"></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ZTrilean | @zthun/trilean</title><meta name="description" content="Documentation for @zthun/trilean"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><link rel="icon" href="../trilean.svg" />
|
|
2
|
+
</head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@zthun/trilean</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@zthun/trilean</a></li><li><a href="ZTrilean.html">ZTrilean</a></li></ul><h1>Class ZTrilean<code class="tsd-tag">Abstract</code></h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>A utility class for trilean values.</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/6989f86f7d123b6e382b4535ddb44da5f61a94c1/packages/trilean/src/trilean.mts#L33">trilean.mts:33</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="ZTrilean.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
|
|
4
4
|
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="ZTrilean.html#Indeterminate" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>Indeterminate</span></a>
|
|
5
5
|
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="ZTrilean.html#convert" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>convert</span></a>
|
|
6
6
|
<a href="ZTrilean.html#is" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is</span></a>
|
|
7
7
|
<a href="ZTrilean.html#isIndeterminate" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Indeterminate</span></a>
|
|
8
8
|
<a href="ZTrilean.html#parse" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>parse</span></a>
|
|
9
9
|
<a href="ZTrilean.html#stringify" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>stringify</span></a>
|
|
10
|
-
</div></section></div></details></section></section><
|
|
11
|
-
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/
|
|
10
|
+
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="constructor.new_ZTrilean" class="tsd-anchor"></a><span class="tsd-kind-constructor-signature">new ZTrilean</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ZTrilean.html" class="tsd-signature-type tsd-kind-class">ZTrilean</a><a href="#constructor.new_ZTrilean" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><h4 class="tsd-returns-title">Returns <a href="ZTrilean.html" class="tsd-signature-type tsd-kind-class">ZTrilean</a></h4></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="Indeterminate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code> <code class="tsd-tag">Readonly</code><span>Indeterminate</span><a href="#Indeterminate" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">Indeterminate</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"indeterminate"</span><span class="tsd-signature-symbol"> = "indeterminate"</span></div><div class="tsd-comment tsd-typography"><p>A constant value that represents an indeterminate value.</p>
|
|
11
|
+
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/6989f86f7d123b6e382b4535ddb44da5f61a94c1/packages/trilean/src/trilean.mts#L37">trilean.mts:37</a></li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="convert" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>convert</span><a href="#convert" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="convert.convert-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">convert</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">val</span>, <span class="tsd-kind-parameter">fallback</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a><a href="#convert.convert-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Converts from a value to a trilean value.</p>
|
|
12
12
|
<p>This is similar to parse, but it also supports non
|
|
13
13
|
string inputs which will be converted to a boolean.</p>
|
|
14
14
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">val</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The value to convert.</p>
|
|
15
15
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">fallback</span>: <a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a><span class="tsd-signature-symbol"> = false</span></span><div class="tsd-comment tsd-typography"><p>The fallback value in the case that val cannot be converted. This will
|
|
16
|
-
|
|
16
|
+
only be used in the case that val is a string, null, or undefined.</p>
|
|
17
17
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a></h4><p>The trilean value of val. If val is null or undefined, then
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/
|
|
18
|
+
fallback is returned. If val is a string, then the return value of
|
|
19
|
+
<a href="ZTrilean.html#parse" class="tsd-kind-method">parse</a> will be used. If val is a boolean, then it will be
|
|
20
|
+
directly returned. If val is equal to <a href="ZTrilean.html#Indeterminate" class="tsd-kind-property">Indeterminate</a>, then
|
|
21
|
+
<a href="ZTrilean.html#Indeterminate" class="tsd-kind-property">Indeterminate</a> will be returned. Otherwise, the truthy
|
|
22
|
+
nature of value will be returned.</p>
|
|
23
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/6989f86f7d123b6e382b4535ddb44da5f61a94c1/packages/trilean/src/trilean.mts#L124">trilean.mts:124</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="is" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>is</span><a href="#is" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="is.is-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">is</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">val</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-kind-parameter">val</span><span class="tsd-signature-keyword"> is </span><a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a><a href="#is.is-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets a value that determines if val is a trilean supported value.</p>
|
|
24
24
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">val</span>: <span class="tsd-signature-type">any</span></span><div class="tsd-comment tsd-typography"><p>The value to test.</p>
|
|
25
25
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-kind-parameter">val</span><span class="tsd-signature-keyword"> is </span><a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a></h4><p>True if val is a trilean value. False otherwise.</p>
|
|
26
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/
|
|
27
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">val</span>: <a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-kind-parameter">val</span><span class="tsd-signature-keyword"> is </span><span class="tsd-signature-type">"indeterminate"</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/
|
|
26
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/6989f86f7d123b6e382b4535ddb44da5f61a94c1/packages/trilean/src/trilean.mts#L93">trilean.mts:93</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="isIndeterminate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>is<wbr/>Indeterminate</span><a href="#isIndeterminate" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="isIndeterminate.isIndeterminate-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">is<wbr/>Indeterminate</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">val</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-kind-parameter">val</span><span class="tsd-signature-keyword"> is </span><span class="tsd-signature-type">"indeterminate"</span><a href="#isIndeterminate.isIndeterminate-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets whether val is the indeterminate value.</p>
|
|
27
|
+
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">val</span>: <a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-kind-parameter">val</span><span class="tsd-signature-keyword"> is </span><span class="tsd-signature-type">"indeterminate"</span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/6989f86f7d123b6e382b4535ddb44da5f61a94c1/packages/trilean/src/trilean.mts#L100">trilean.mts:100</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="parse" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>parse</span><a href="#parse" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="parse.parse-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">parse</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">str</span>, <span class="tsd-kind-parameter">fallback</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a><a href="#parse.parse-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Converts a string to a trilean value.</p>
|
|
28
28
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">str</span>: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The text to parse.</p>
|
|
29
29
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">fallback</span>: <a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a><span class="tsd-signature-symbol"> = false</span></span><div class="tsd-comment tsd-typography"><p>The fallback in the case that str is not a parsable value.</p>
|
|
30
30
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a></h4><p>The parsed trilean value or fallback if str is not a valid
|
|
31
|
-
|
|
32
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/
|
|
31
|
+
trilean value.</p>
|
|
32
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/6989f86f7d123b6e382b4535ddb44da5f61a94c1/packages/trilean/src/trilean.mts#L65">trilean.mts:65</a></li></ul></aside></li></ul></section><section class="tsd-panel tsd-member"><a id="stringify" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Static</code><span>stringify</span><a href="#stringify" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="stringify.stringify-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">stringify</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">x</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#stringify.stringify-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Converts a trilean value to a string.</p>
|
|
33
33
|
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">x</span>: <a href="../types/trilean.html" class="tsd-signature-type tsd-kind-type-alias">trilean</a></span><div class="tsd-comment tsd-typography"><p>The value to convert.</p>
|
|
34
34
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>A string of true if x is true, false if x is false,
|
|
35
|
-
|
|
36
|
-
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/
|
|
35
|
+
and indeterminate if x is the indeterminate symbol.</p>
|
|
36
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/zthun/trilean/blob/6989f86f7d123b6e382b4535ddb44da5f61a94c1/packages/trilean/src/trilean.mts#L49">trilean.mts:49</a></li></ul></aside></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#Indeterminate" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>Indeterminate</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="tsd-otp-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#convert" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>convert</span></a><a href="#is" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is</span></a><a href="#isIndeterminate" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>is<wbr/>Indeterminate</span></a><a href="#parse" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>parse</span></a><a href="#stringify" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>stringify</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@zthun/trilean</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
package/dist/index.html
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><head><meta
|
|
2
|
-
</head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">@zthun/trilean</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h2>@zthun/trilean</h2></div><div class="tsd-panel tsd-typography"><a id="md:trilean" class="tsd-anchor"></a><h1
|
|
3
|
-
you will find that it has an
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@zthun/trilean</title><meta name="description" content="Documentation for @zthun/trilean"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script defer src="assets/main.js"></script><script async src="assets/icons.js" id="tsd-icons-script"></script><script async src="assets/search.js" id="tsd-search-script"></script><script async src="assets/navigation.js" id="tsd-nav-script"></script><link rel="icon" href="trilean.svg" />
|
|
2
|
+
</head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">@zthun/trilean</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><h2>@zthun/trilean</h2></div><div class="tsd-panel tsd-typography"><a id="md:trilean" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Trilean<a href="#md:trilean" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="assets/icons.svg#icon-anchor"></use></svg></a></h1><p>One day, I wanted to play around with writing a colorful checkbox component. If
|
|
3
|
+
you look at the docs for an HTML input, you will find that it has an
|
|
4
|
+
<a href="https://www.w3schools.com/jsref/prop_checkbox_indeterminate.asp">indeterminate</a>
|
|
5
|
+
property.</p>
|
|
6
|
+
<p>This is great and is what I needed, except that now my input can have this
|
|
7
|
+
bizarre mystery state of what happens when value is true and indeterminate is
|
|
8
|
+
true? What happens if checked then returns true and indeterminate returns true.
|
|
9
|
+
You can't set this property via html; you have to set it with JavaScript.</p>
|
|
10
|
+
<p>This is goofy as you have competing variables where you have to force a
|
|
11
|
+
priority. The solution to this is to change the actual value type, thus, I
|
|
12
|
+
created this library which implements a
|
|
9
13
|
<a href="https://en.wikipedia.org/wiki/Three-valued_logic"><em>trilean</em></a> type.</p>
|
|
10
|
-
<p>See <a href="
|
|
11
|
-
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-
|
|
14
|
+
<p>See <a href="media/README.md">@zthun/trilean</a> for more information.</p>
|
|
15
|
+
</div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#md:trilean"><span>Trilean</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>@zthun/trilean</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Trilean
|
|
2
|
+
|
|
3
|
+
Adds a three state logic type. The values can be true, false, and indeterminate.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
# NPM
|
|
9
|
+
npm install @zthun/trilean
|
|
10
|
+
# Yarn
|
|
11
|
+
yarn add @zthun/trilean
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { trilean, ZTrilean } from "@zthun/trilean";
|
|
18
|
+
|
|
19
|
+
const checked: trilean = true;
|
|
20
|
+
const unchecked: trilean = false;
|
|
21
|
+
const indeterminate: trilean = ZTrilean.Indeterminate;
|
|
22
|
+
|
|
23
|
+
// Returns 'true'
|
|
24
|
+
ZTrilean.stringify(checked);
|
|
25
|
+
// Returns 'false'
|
|
26
|
+
ZTrilean.stringify(unchecked);
|
|
27
|
+
// Returns 'indeterminate'
|
|
28
|
+
ZTrilean.stringify(indeterminate);
|
|
29
|
+
|
|
30
|
+
// Returns true
|
|
31
|
+
ZTrilean.parse("true");
|
|
32
|
+
// Returns false
|
|
33
|
+
ZTrilean.parse("false");
|
|
34
|
+
// Returns ZTrilean.Indeterminate
|
|
35
|
+
ZTrilean.parse("indeterminate");
|
|
36
|
+
// Returns false
|
|
37
|
+
ZTrilean.parse(null);
|
|
38
|
+
// Returns true fallback.
|
|
39
|
+
ZTrilean.parse("not-a-trilean", true);
|
|
40
|
+
|
|
41
|
+
// Returns true
|
|
42
|
+
ZTrilean.is(true);
|
|
43
|
+
ZTrilean.is(false);
|
|
44
|
+
ZTrilean.is(ZTrilean.Indeterminate);
|
|
45
|
+
// Returns false
|
|
46
|
+
ZTrilean.is("string is not a trilean");
|
|
47
|
+
// Returns true - This is mostly for
|
|
48
|
+
// typescript type guard support.
|
|
49
|
+
ZTrilean.isIndeterminate(ZTrilean.Indeterminate);
|
|
50
|
+
|
|
51
|
+
// Convert any value to a trilean.
|
|
52
|
+
const kindaTrue = ZTrilean.convert("A truthy value");
|
|
53
|
+
const kindaFalse = ZTrilean.convert(0);
|
|
54
|
+
const alsoIndeterminate = ZTrilean.convert(ZTrilean.Indeterminate);
|
|
55
|
+
```
|