@nordcode/ui 1.1.6 → 1.2.0
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/CHANGELOG.md +6 -0
- package/out/bundle.css +99 -16
- package/out/bundle_configless.css +99 -16
- package/out/complete.css +132 -22
- package/out/complete_configless.css +132 -22
- package/out/src/assets/fonts/DMMono-Regular.woff +0 -0
- package/out/src/assets/fonts/DMMono-Regular.woff2 +0 -0
- package/out/src/assets/fonts/fonts.css +7 -0
- package/out/src/assets/icons/ArrowRightSolid.svelte +1 -0
- package/out/src/assets/icons/arrow-right-solid.svg +1 -0
- package/out/src/assets/icons/favicon.png +0 -0
- package/out/src/assets/icons/favicon.svg +8 -0
- package/out/src/assets/logos/nordcode-logo-icon.svg +3 -0
- package/out/src/assets/logos/nordcode-logo.svg +17 -0
- package/out/src/modules/copyButtons/ts/copyButtons.ts +9 -0
- package/out/src/modules/dialogs/svelte/dialog.svelte +27 -0
- package/out/src/modules/dialogs/ts/LICENCE +171 -0
- package/out/src/modules/dialogs/ts/dialogs.ts +111 -0
- package/out/src/modules/notifications/js/notifications.js +294 -0
- package/out/src/modules/notifications/svelte/NotificationCenter.svelte +18 -0
- package/out/src/modules/notifications/svelte/NotificationTemplate.svelte +16 -0
- package/out/src/modules/sectionObserver/ts/sectionOberserver.ts +34 -0
- package/out/src/styles/bundle.css +7 -0
- package/out/src/styles/bundle_configless.css +5 -0
- package/out/src/styles/complete.css +5 -0
- package/out/src/styles/complete_configless.css +5 -0
- package/out/src/styles/components/alerts.css +20 -0
- package/out/src/styles/components/badges.css +14 -0
- package/out/src/styles/components/breadcrumbs.css +37 -0
- package/out/src/styles/components/bundle.css +13 -0
- package/out/src/styles/components/buttons.css +260 -0
- package/out/src/styles/components/card.css +55 -0
- package/out/src/styles/components/dialogs.css +138 -0
- package/out/src/styles/components/forms.css +41 -0
- package/out/src/styles/components/gallery.css +66 -0
- package/out/src/styles/components/icons.css +60 -0
- package/out/src/styles/components/inputs/base.css +249 -0
- package/out/src/styles/components/inputs/bundle.css +5 -0
- package/out/src/styles/components/inputs/fields.css +76 -0
- package/out/src/styles/components/inputs/segmented.css +114 -0
- package/out/src/styles/components/inputs/switch.css +42 -0
- package/out/src/styles/components/inputs/tag-select.css +41 -0
- package/out/src/styles/components/lists.css +40 -0
- package/out/src/styles/components/notifications.css +135 -0
- package/out/src/styles/components/tables.css +7 -0
- package/out/src/styles/config/bundle.css +2 -0
- package/out/src/styles/config/config.css +700 -0
- package/out/src/styles/config/extras.css +12 -0
- package/out/src/styles/exceptions/bundle.css +3 -0
- package/out/src/styles/exceptions/misc.css +21 -0
- package/out/src/styles/exceptions/spacings.css +15 -0
- package/out/src/styles/exceptions/typography.css +57 -0
- package/out/src/styles/theme/colors.css +165 -0
- package/out/src/styles/theme/colors_processed.css +87 -0
- package/out/src/styles/utils/base.css +415 -0
- package/out/src/styles/utils/bundle.css +6 -0
- package/out/src/styles/utils/easings.css +364 -0
- package/out/src/styles/utils/layouts.css +281 -0
- package/out/src/styles/utils/media.css +55 -0
- package/out/src/styles/utils/reset.css +145 -0
- package/out/src/styles/utils/theme.css +125 -0
- package/package.json +1 -1
- package/src/styles/components/card.css +29 -0
- package/src/styles/exceptions/typography.css +15 -0
- package/src/styles/utils/base.css +103 -9
- package/src/styles/utils/reset.css +4 -6
|
@@ -136,6 +136,10 @@
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
:where(body) {
|
|
139
|
+
-webkit-text-decoration-skip-ink: auto;
|
|
140
|
+
text-decoration-skip-ink: auto;
|
|
141
|
+
font-optical-sizing: auto;
|
|
142
|
+
font-kerning: normal;
|
|
139
143
|
min-block-size: 100vh;
|
|
140
144
|
}
|
|
141
145
|
|
|
@@ -148,8 +152,6 @@
|
|
|
148
152
|
}
|
|
149
153
|
|
|
150
154
|
:where(a:not([class])) {
|
|
151
|
-
-webkit-text-decoration-skip-ink: auto;
|
|
152
|
-
text-decoration-skip-ink: auto;
|
|
153
155
|
color: currentColor;
|
|
154
156
|
}
|
|
155
157
|
|
|
@@ -190,11 +192,6 @@
|
|
|
190
192
|
letter-spacing: inherit;
|
|
191
193
|
}
|
|
192
194
|
|
|
193
|
-
:where(p) {
|
|
194
|
-
text-wrap: pretty;
|
|
195
|
-
max-inline-size: var(--measure-base);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
195
|
:where(html):has(dialog:modal) {
|
|
199
196
|
scrollbar-gutter: stable;
|
|
200
197
|
overflow: hidden;
|
|
@@ -224,7 +221,7 @@
|
|
|
224
221
|
}
|
|
225
222
|
|
|
226
223
|
:where(dl:not([class]), .nc-description-list) {
|
|
227
|
-
|
|
224
|
+
overflow-wrap: anywhere;
|
|
228
225
|
grid-template-columns: .25fr .75fr;
|
|
229
226
|
align-items: flex-start;
|
|
230
227
|
row-gap: .5lh;
|
|
@@ -280,13 +277,13 @@
|
|
|
280
277
|
:where(figcaption) {
|
|
281
278
|
color: var(--color-surface-subtle);
|
|
282
279
|
background-color: var(--color-text-base);
|
|
283
|
-
padding: .
|
|
280
|
+
padding: .25lh 1ch;
|
|
284
281
|
display: block;
|
|
285
282
|
}
|
|
286
283
|
|
|
287
284
|
:where(details) {
|
|
288
285
|
--p-x-details: 2ch;
|
|
289
|
-
--p-y-details: .
|
|
286
|
+
--p-y-details: .75lh;
|
|
290
287
|
--b-r-details: var(--border-radius-medium);
|
|
291
288
|
background-color: var(--color-surface-muted);
|
|
292
289
|
border-radius: var(--b-r-details);
|
|
@@ -442,6 +439,9 @@
|
|
|
442
439
|
:where(abbr) {
|
|
443
440
|
-webkit-text-decoration-color: var(--color-brand-primary-base);
|
|
444
441
|
text-decoration-color: var(--color-brand-primary-base);
|
|
442
|
+
font-variant-numeric: oldstyle-nums;
|
|
443
|
+
font-size: 110%;
|
|
444
|
+
font-variant-caps: all-small-caps;
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
:where([aria-disabled="true"], .disabled, :disabled) {
|
|
@@ -468,8 +468,7 @@
|
|
|
468
468
|
tab-size: 4;
|
|
469
469
|
text-align: left;
|
|
470
470
|
word-spacing: normal;
|
|
471
|
-
|
|
472
|
-
word-wrap: normal;
|
|
471
|
+
overflow-wrap: normal;
|
|
473
472
|
max-inline-size: fit-content;
|
|
474
473
|
padding-block: .125lh;
|
|
475
474
|
font-style: normal;
|
|
@@ -581,6 +580,10 @@
|
|
|
581
580
|
background-color: var(--color-surface-muted);
|
|
582
581
|
}
|
|
583
582
|
|
|
583
|
+
:where(td, math, time[datetime*=":"]) {
|
|
584
|
+
font-variant-numeric: tabular-nums lining-nums slashed-zero;
|
|
585
|
+
}
|
|
586
|
+
|
|
584
587
|
:target {
|
|
585
588
|
scroll-margin-block-start: 2ex;
|
|
586
589
|
}
|
|
@@ -613,7 +616,72 @@
|
|
|
613
616
|
}
|
|
614
617
|
|
|
615
618
|
:where(li > :is(ul, ol)) {
|
|
616
|
-
margin-block-start: .
|
|
619
|
+
margin-block-start: .25lh;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
@supports (font-variant-position: sub) {
|
|
623
|
+
:where(sub) {
|
|
624
|
+
vertical-align: baseline;
|
|
625
|
+
font-size: 100%;
|
|
626
|
+
line-height: inherit;
|
|
627
|
+
font-variant-position: sub;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
@supports (font-variant-position: super) {
|
|
632
|
+
:where(sup) {
|
|
633
|
+
vertical-align: baseline;
|
|
634
|
+
font-size: 100%;
|
|
635
|
+
line-height: inherit;
|
|
636
|
+
font-variant-position: super;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
:lang(en) > * {
|
|
641
|
+
quotes: "“" "”" "‘" "’";
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
:lang(de) > * {
|
|
645
|
+
quotes: "„" "“" "‚" "‘";
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
:where() {
|
|
649
|
+
content: open-quote;
|
|
650
|
+
content: close-quote;
|
|
651
|
+
content: "“";
|
|
652
|
+
content: "”";
|
|
653
|
+
margin-inline-start: -.87ch;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
:where(.quoted p) {
|
|
657
|
+
hanging-punctuation: first last;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
@supports (hanging-punctuation: first last) {
|
|
661
|
+
:where() {
|
|
662
|
+
margin-inline-start: 0;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
:where(.prose) {
|
|
667
|
+
-webkit-hyphens: auto;
|
|
668
|
+
hyphens: auto;
|
|
669
|
+
hyphenate-limit-chars: 7 4 3;
|
|
670
|
+
hyphenate-limit-lines: 2;
|
|
671
|
+
hyphenate-limit-zone: 8%;
|
|
672
|
+
hyphenate-limit-last: always;
|
|
673
|
+
text-wrap: pretty;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
:where(.prose p) {
|
|
677
|
+
text-wrap: pretty;
|
|
678
|
+
font-variant-numeric: oldstyle-nums proportional-nums;
|
|
679
|
+
max-inline-size: var(--measure-base);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
:where(.prose pre, .prose code, .prose var, .prose samp, .prose kbd, .prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6) {
|
|
683
|
+
-webkit-hyphens: manual;
|
|
684
|
+
hyphens: manual;
|
|
617
685
|
}
|
|
618
686
|
}
|
|
619
687
|
|
|
@@ -671,7 +739,7 @@
|
|
|
671
739
|
}
|
|
672
740
|
|
|
673
741
|
:where(.nc-flow) > * + * {
|
|
674
|
-
margin-block-start: var(--flow-gap,
|
|
742
|
+
margin-block-start: var(--flow-gap, 1lh);
|
|
675
743
|
}
|
|
676
744
|
|
|
677
745
|
:where(.nc-flow) > * {
|
|
@@ -680,11 +748,11 @@
|
|
|
680
748
|
|
|
681
749
|
:where(.nc-flow) > :is(h1, h2, h3, h4, h5, h6) {
|
|
682
750
|
max-inline-size: var(--flow-headline-meassure, 32ch);
|
|
683
|
-
--flow-gap: 1.
|
|
751
|
+
--flow-gap: 1.5lh;
|
|
684
752
|
}
|
|
685
753
|
|
|
686
754
|
:where(.nc-flow) > :is(h1, h2, h3, h4, h5, h6) + :not([class]) {
|
|
687
|
-
--flow-gap: .
|
|
755
|
+
--flow-gap: .5lh;
|
|
688
756
|
}
|
|
689
757
|
|
|
690
758
|
:where(.nc-flow) > figure {
|
|
@@ -1082,6 +1150,21 @@
|
|
|
1082
1150
|
text-transform: capitalize;
|
|
1083
1151
|
}
|
|
1084
1152
|
|
|
1153
|
+
.centered {
|
|
1154
|
+
text-align: center;
|
|
1155
|
+
text-wrap: balance;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
.uppercase {
|
|
1159
|
+
text-transform: uppercase;
|
|
1160
|
+
--opentype-case: on;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
.smallcaps {
|
|
1164
|
+
font-variant-numeric: oldstyle-nums;
|
|
1165
|
+
font-variant-caps: all-small-caps;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1085
1168
|
.strong {
|
|
1086
1169
|
font-weight: var(--font-weight-strong);
|
|
1087
1170
|
}
|
|
@@ -1496,6 +1579,33 @@
|
|
|
1496
1579
|
:where(.nc-card):is([href], button):hover {
|
|
1497
1580
|
border-color: var(--color-brand-primary-base);
|
|
1498
1581
|
}
|
|
1582
|
+
|
|
1583
|
+
:where(.nc-clickable-card) {
|
|
1584
|
+
cursor: pointer;
|
|
1585
|
+
position: relative;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
:where(.nc-clickable-card):focus-within, :where(.nc-clickable-card):hover {
|
|
1589
|
+
outline: var(--border-width-medium) solid var(--color-brand-primary-base);
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
:where(.nc-clickable-card) a[data-link="main"] {
|
|
1593
|
+
text-decoration: none;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
:where(.nc-clickable-card) a[data-link="main"]:focus-within:focus-visible, :where(.nc-clickable-card) a[data-link="main"]:hover {
|
|
1597
|
+
outline: none;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
:where(.nc-clickable-card) a[data-link="main"]:before {
|
|
1601
|
+
content: "";
|
|
1602
|
+
position: absolute;
|
|
1603
|
+
inset: 0;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
:where(.nc-clickable-card) a[data-link="extra"] {
|
|
1607
|
+
position: relative;
|
|
1608
|
+
}
|
|
1499
1609
|
}
|
|
1500
1610
|
|
|
1501
1611
|
@layer components.dialogs {
|
|
@@ -1761,7 +1871,7 @@
|
|
|
1761
1871
|
}
|
|
1762
1872
|
|
|
1763
1873
|
:where(.nc-icon)[data-size="inline"] {
|
|
1764
|
-
--icon-size: .
|
|
1874
|
+
--icon-size: .75lh;
|
|
1765
1875
|
}
|
|
1766
1876
|
|
|
1767
1877
|
:where(.nc-icon)[data-size="button"] {
|
|
@@ -1795,7 +1905,7 @@
|
|
|
1795
1905
|
color: var(--color-text-base);
|
|
1796
1906
|
font-size: inherit;
|
|
1797
1907
|
align-items: center;
|
|
1798
|
-
gap:
|
|
1908
|
+
gap: 0;
|
|
1799
1909
|
display: inline-flex;
|
|
1800
1910
|
}
|
|
1801
1911
|
|
|
@@ -1993,7 +2103,7 @@
|
|
|
1993
2103
|
--_tag-select-checked-text-color: var(--tag-select-checked-text-color, var(--color-brand-primary-contrast));
|
|
1994
2104
|
--_tag-select-checked-surface-color: var(--tag-select-checked-surface-color, var(--color-brand-primary-base));
|
|
1995
2105
|
--_tag-select-border-radius: var(--tag-select-border-radius, var(--_input-border-radius));
|
|
1996
|
-
--nc-legend-spacing: .
|
|
2106
|
+
--nc-legend-spacing: .25lh;
|
|
1997
2107
|
}
|
|
1998
2108
|
|
|
1999
2109
|
:where(.nc-tag-select-field):focus-within:has(:focus-visible) {
|
|
@@ -2034,12 +2144,12 @@
|
|
|
2034
2144
|
max-inline-size: var(--input-field-max-inline-size);
|
|
2035
2145
|
grid-template-columns: minmax(0, 1fr);
|
|
2036
2146
|
place-items: start;
|
|
2037
|
-
gap: .
|
|
2147
|
+
gap: .25lh;
|
|
2038
2148
|
display: grid;
|
|
2039
2149
|
}
|
|
2040
2150
|
|
|
2041
2151
|
:where(.nc-input-field) > label, :where(.nc-input-field) > .nc-stack {
|
|
2042
|
-
gap:
|
|
2152
|
+
gap: 0;
|
|
2043
2153
|
}
|
|
2044
2154
|
|
|
2045
2155
|
:where(.nc-input-field) > .nc-cluster {
|
|
@@ -2107,7 +2217,7 @@
|
|
|
2107
2217
|
--_segmented-control-border-radius: var(--segmented-control-border-radius, var(--_input-border-radius));
|
|
2108
2218
|
--_segmented-control-checked-text-color: var(--segmented-control-checked-text-color, var(--color-brand-primary-contrast));
|
|
2109
2219
|
--_segmented-control-checked-surface-color: var(--segmented-control-checked-surface-color, var(--color-brand-primary-base));
|
|
2110
|
-
--nc-legend-spacing: .
|
|
2220
|
+
--nc-legend-spacing: .25lh;
|
|
2111
2221
|
container: segmented-control / inline-size;
|
|
2112
2222
|
}
|
|
2113
2223
|
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg class="nc-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="currentColor"><path d="M 18.71875 6.78125 L 17.28125 8.21875 L 24.0625 15 L 4 15 L 4 17 L 24.0625 17 L 17.28125 23.78125 L 18.71875 25.21875 L 27.21875 16.71875 L 27.90625 16 L 27.21875 15.28125 Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="currentColor"><path d="M 18.71875 6.78125 L 17.28125 8.21875 L 24.0625 15 L 4 15 L 4 17 L 24.0625 17 L 17.28125 23.78125 L 18.71875 25.21875 L 27.21875 16.71875 L 27.90625 16 L 27.21875 15.28125 Z"/></svg>
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 1234 1234"><path fill-rule="evenodd" d="M717 217c0 112.561-37.194 216.434-99.963 300H1017v200.164C855.944 722.438 727 854.661 727 1017H517c0-112.561 37.194-216.434 99.963-300H217V516.836c3.32.109 6.654.164 10 .164 165.685 0 300-134.315 300-300h190Z" clip-rule="evenodd"/>
|
|
2
|
+
<style>
|
|
3
|
+
path { fill: #000; }
|
|
4
|
+
@media (prefers-color-scheme: dark) {
|
|
5
|
+
path { fill: #FFF; }
|
|
6
|
+
}
|
|
7
|
+
</style>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.5 0C22.5 5.06523 20.8262 9.73953 18.0016 13.5H36V22.5V22.5074C28.7525 22.7447 22.95 28.6947 22.95 36H13.5C13.5 30.9348 15.1738 26.2605 17.9984 22.5H0V13.5V13.4926C0.149399 13.4975 0.299411 13.5 0.45 13.5C7.90584 13.5 13.95 7.45584 13.95 0H22.5Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<svg width="240" height="37" viewBox="0 0 240 37" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M56.9893 30.0889V9.36099H60.834L61.2101 12.4535H61.419C61.9762 11.4505 62.8399 10.6008 64.01 9.90427C65.1801 9.20776 66.5313 8.85951 68.0637 8.85951C70.5989 8.85951 72.5073 9.62567 73.7889 11.158C75.0705 12.6903 75.7112 14.9469 75.7112 17.928V30.0889H71.2815V18.4712C71.2815 16.7439 70.9193 15.4066 70.1949 14.4594C69.4706 13.5122 68.3283 13.0385 66.7682 13.0385C65.2358 13.0385 63.9543 13.5539 62.9235 14.5848C61.9205 15.6156 61.419 17.1061 61.419 19.0563V30.0889H56.9893Z" fill="black"/>
|
|
3
|
+
<path d="M89.6528 30.5904C87.6748 30.5904 85.9057 30.1446 84.3455 29.2531C82.7853 28.3616 81.5595 27.1079 80.668 25.492C79.7764 23.8482 79.3307 21.9259 79.3307 19.725C79.3307 17.524 79.7764 15.6156 80.668 13.9997C81.5595 12.356 82.7853 11.0883 84.3455 10.1968C85.9057 9.30528 87.6887 8.85951 89.6946 8.85951C91.7006 8.85951 93.4697 9.30528 95.002 10.1968C96.5621 11.0883 97.7741 12.356 98.6377 13.9997C99.5293 15.6156 99.975 17.524 99.975 19.725C99.975 21.9259 99.5293 23.8482 98.6377 25.492C97.7462 27.1079 96.5204 28.3616 94.9602 29.2531C93.4279 30.1446 91.6588 30.5904 89.6528 30.5904ZM89.6528 26.3696C90.7115 26.3696 91.6866 26.1328 92.5781 25.6592C93.4697 25.1855 94.1801 24.4612 94.7095 23.4861C95.2667 22.4831 95.5453 21.2294 95.5453 19.725C95.5453 18.1926 95.2667 16.9389 94.7095 15.9638C94.1801 14.9887 93.4697 14.2644 92.5781 13.7908C91.7145 13.3171 90.7533 13.0803 89.6946 13.0803C88.6359 13.0803 87.6608 13.3171 86.7693 13.7908C85.8778 14.2644 85.1534 14.9887 84.5962 15.9638C84.0669 16.9389 83.8022 18.1926 83.8022 19.725C83.8022 22.0095 84.3733 23.695 85.5156 24.7816C86.6857 25.8402 88.0648 26.3696 89.6528 26.3696Z" fill="black"/>
|
|
4
|
+
<path d="M103.72 30.0889V26.2442H108.776V14.5848C108.776 13.6654 108.331 13.2057 107.439 13.2057H104.138V9.36099H109.111C110.253 9.36099 111.186 9.69532 111.911 10.364C112.635 11.0047 112.997 11.9102 112.997 13.0803V13.5818H113.206C113.513 12.0216 114.167 10.8515 115.17 10.0714C116.201 9.26348 117.692 8.85951 119.642 8.85951H122.86V13.54H118.346C116.703 13.54 115.435 14.1111 114.543 15.2534C113.652 16.3957 113.206 17.7608 113.206 19.3488V26.2442H119.642V30.0889H103.72Z" fill="black"/>
|
|
5
|
+
<path d="M135.297 30.5904C133.569 30.5904 132.023 30.1864 130.658 29.3785C129.293 28.5427 128.206 27.3168 127.398 25.7009C126.618 24.0851 126.228 22.0931 126.228 19.725C126.228 17.3568 126.632 15.3648 127.44 13.749C128.248 12.1331 129.335 10.9212 130.7 10.1132C132.093 9.27741 133.639 8.85951 135.339 8.85951C136.927 8.85951 138.236 9.16597 139.267 9.7789C140.298 10.364 141.064 11.1162 141.565 12.0356V0H145.995V30.0889H142.192L141.816 27.0382H141.565C141.008 28.1248 140.214 28.9884 139.183 29.6292C138.18 30.27 136.885 30.5904 135.297 30.5904ZM136.216 26.3696C137.804 26.3696 139.114 25.8124 140.144 24.698C141.203 23.5836 141.733 21.9259 141.733 19.725C141.733 17.4961 141.203 15.8385 140.144 14.7519C139.114 13.6375 137.804 13.0803 136.216 13.0803C134.628 13.0803 133.305 13.6375 132.246 14.7519C131.215 15.8663 130.7 17.5379 130.7 19.7667C130.7 21.9677 131.215 23.6254 132.246 24.7398C133.305 25.8263 134.628 26.3696 136.216 26.3696Z" fill="black"/>
|
|
6
|
+
<path d="M160.104 30.5904C158.182 30.5904 156.454 30.1446 154.922 29.2531C153.417 28.3616 152.233 27.1079 151.37 25.492C150.506 23.8482 150.074 21.9259 150.074 19.725C150.074 17.524 150.506 15.6156 151.37 13.9997C152.261 12.3838 153.459 11.1301 154.964 10.2386C156.468 9.31921 158.182 8.85951 160.104 8.85951C162.751 8.85951 164.882 9.52816 166.498 10.8654C168.142 12.1749 169.186 13.9858 169.632 16.2982H164.993C164.715 15.2952 164.144 14.5012 163.28 13.9161C162.444 13.3311 161.371 13.0385 160.062 13.0385C159.115 13.0385 158.209 13.2893 157.346 13.7908C156.51 14.2922 155.827 15.0445 155.298 16.0474C154.797 17.0225 154.546 18.2484 154.546 19.725C154.546 21.1737 154.797 22.3995 155.298 23.4025C155.827 24.4055 156.51 25.1716 157.346 25.7009C158.209 26.2024 159.115 26.4532 160.062 26.4532C161.399 26.4532 162.472 26.1606 163.28 25.5756C164.088 24.9905 164.659 24.1826 164.993 23.1517H169.632C169.075 25.4363 167.988 27.2472 166.372 28.5845C164.757 29.9218 162.667 30.5904 160.104 30.5904Z" fill="black"/>
|
|
7
|
+
<path d="M183.197 30.5904C181.219 30.5904 179.45 30.1446 177.89 29.2531C176.33 28.3616 175.104 27.1079 174.213 25.492C173.321 23.8482 172.875 21.9259 172.875 19.725C172.875 17.524 173.321 15.6156 174.213 13.9997C175.104 12.356 176.33 11.0883 177.89 10.1968C179.45 9.30528 181.233 8.85951 183.239 8.85951C185.245 8.85951 187.014 9.30528 188.547 10.1968C190.107 11.0883 191.319 12.356 192.182 13.9997C193.074 15.6156 193.52 17.524 193.52 19.725C193.52 21.9259 193.074 23.8482 192.182 25.492C191.291 27.1079 190.065 28.3616 188.505 29.2531C186.973 30.1446 185.203 30.5904 183.197 30.5904ZM183.197 26.3696C184.256 26.3696 185.231 26.1328 186.123 25.6592C187.014 25.1855 187.725 24.4612 188.254 23.4861C188.811 22.4831 189.09 21.2294 189.09 19.725C189.09 18.1926 188.811 16.9389 188.254 15.9638C187.725 14.9887 187.014 14.2644 186.123 13.7908C185.259 13.3171 184.298 13.0803 183.239 13.0803C182.181 13.0803 181.205 13.3171 180.314 13.7908C179.422 14.2644 178.698 14.9887 178.141 15.9638C177.612 16.9389 177.347 18.1926 177.347 19.725C177.347 22.0095 177.918 23.695 179.06 24.7816C180.23 25.8402 181.609 26.3696 183.197 26.3696Z" fill="black"/>
|
|
8
|
+
<path d="M205.455 30.5904C203.728 30.5904 202.182 30.1864 200.817 29.3785C199.451 28.5427 198.365 27.3168 197.557 25.7009C196.777 24.0851 196.387 22.0931 196.387 19.725C196.387 17.3568 196.791 15.3648 197.599 13.749C198.407 12.1331 199.493 10.9212 200.858 10.1132C202.251 9.27741 203.798 8.85951 205.497 8.85951C207.085 8.85951 208.395 9.16597 209.425 9.7789C210.456 10.364 211.222 11.1162 211.724 12.0356V0H216.154V30.0889H212.351L211.975 27.0382H211.724C211.167 28.1248 210.373 28.9884 209.342 29.6292C208.339 30.27 207.043 30.5904 205.455 30.5904ZM206.375 26.3696C207.963 26.3696 209.272 25.8124 210.303 24.698C211.362 23.5836 211.891 21.9259 211.891 19.725C211.891 17.4961 211.362 15.8385 210.303 14.7519C209.272 13.6375 207.963 13.0803 206.375 13.0803C204.787 13.0803 203.463 13.6375 202.405 14.7519C201.374 15.8663 200.858 17.5379 200.858 19.7667C200.858 21.9677 201.374 23.6254 202.405 24.7398C203.463 25.8263 204.787 26.3696 206.375 26.3696Z" fill="black"/>
|
|
9
|
+
<path d="M230.221 30.5904C228.215 30.5904 226.446 30.1446 224.913 29.2531C223.381 28.3337 222.183 27.0661 221.319 25.4502C220.456 23.8343 220.024 21.9538 220.024 19.8085C220.024 17.6354 220.442 15.727 221.277 14.0833C222.141 12.4395 223.339 11.158 224.871 10.2386C226.432 9.31921 228.229 8.85951 230.262 8.85951C232.268 8.85951 233.996 9.31921 235.444 10.2386C236.893 11.1301 238.007 12.3281 238.788 13.8325C239.595 15.337 239.999 16.9947 239.999 18.8056C239.999 19.0842 239.999 19.3906 239.999 19.725C239.999 20.0314 239.986 20.3797 239.958 20.7697H224.37C224.509 22.6921 225.136 24.1547 226.25 25.1577C227.365 26.1328 228.674 26.6203 230.179 26.6203C231.488 26.6203 232.519 26.3557 233.271 25.8263C234.051 25.2691 234.622 24.5169 234.985 23.5696H239.456C238.955 25.5477 237.91 27.2193 236.322 28.5845C234.734 29.9218 232.7 30.5904 230.221 30.5904ZM230.221 12.7042C228.855 12.7042 227.643 13.1221 226.585 13.9579C225.526 14.7659 224.844 15.9081 224.537 17.3847H235.57C235.458 15.9917 234.915 14.8634 233.94 13.9997C232.965 13.136 231.725 12.7042 230.221 12.7042Z" fill="black"/>
|
|
10
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.3876 0.835938C22.3876 5.87586 20.7222 10.5268 17.9117 14.2685H35.8201V23.2235V23.2308C28.6088 23.467 22.8353 29.3873 22.8353 36.6561H13.4325C13.4325 31.6162 15.0979 26.9652 17.9084 23.2235H0V14.2685V14.2612C0.148652 14.266 0.297915 14.2685 0.447752 14.2685C7.86634 14.2685 13.8803 8.25453 13.8803 0.835938H22.3876Z" fill="black"/>
|
|
11
|
+
<style>
|
|
12
|
+
path { fill: #000; }
|
|
13
|
+
@media (prefers-color-scheme: dark) {
|
|
14
|
+
path { fill: #FFF; }
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const htmlEl = document.documentElement;
|
|
2
|
+
htmlEl?.addEventListener('click', (e: MouseEvent) => {
|
|
3
|
+
const el = e.target as HTMLElement;
|
|
4
|
+
|
|
5
|
+
if (el.hasAttribute('data-copy-target')) {
|
|
6
|
+
const copyTarget = el.dataset.copyTarget;
|
|
7
|
+
navigator.clipboard.writeText(copyTarget);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface DialogProps {
|
|
3
|
+
heading: string;
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
let { heading, id }: DialogProps = $props();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<dialog
|
|
12
|
+
class="nc-dialog"
|
|
13
|
+
{id}
|
|
14
|
+
data-level="1"
|
|
15
|
+
inert
|
|
16
|
+
>
|
|
17
|
+
<form method="dialog" class="dialog-container">
|
|
18
|
+
<div class="dialog-header">
|
|
19
|
+
<h2 class="dialog-title">{heading}</h2>
|
|
20
|
+
<button data-closes-dialog>×</button>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="dialog-content">
|
|
23
|
+
<slot />
|
|
24
|
+
<button data-opens-dialog="dialog-2">Show me the next dialog</button>
|
|
25
|
+
</div>
|
|
26
|
+
</form>
|
|
27
|
+
</dialog>
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Copyright 2023 Adam Argyle
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
1. Definitions.
|
|
8
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
9
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
11
|
+
the copyright owner that is granting the License.
|
|
12
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
13
|
+
other entities that control, are controlled by, or are under common
|
|
14
|
+
control with that entity. For the purposes of this definition,
|
|
15
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
16
|
+
direction or management of such entity, whether by contract or
|
|
17
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
18
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
19
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
20
|
+
exercising permissions granted by this License.
|
|
21
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
22
|
+
including but not limited to software source code, documentation
|
|
23
|
+
source, and configuration files.
|
|
24
|
+
"Object" form shall mean any form resulting from mechanical
|
|
25
|
+
transformation or translation of a Source form, including but
|
|
26
|
+
not limited to compiled object code, generated documentation,
|
|
27
|
+
and conversions to other media types.
|
|
28
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
29
|
+
Object form, made available under the License, as indicated by a
|
|
30
|
+
copyright notice that is included in or attached to the work
|
|
31
|
+
(an example is provided in the Appendix below).
|
|
32
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
33
|
+
form, that is based on (or derived from) the Work and for which the
|
|
34
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
35
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
36
|
+
of this License, Derivative Works shall not include works that remain
|
|
37
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
38
|
+
the Work and Derivative Works thereof.
|
|
39
|
+
"Contribution" shall mean any work of authorship, including
|
|
40
|
+
the original version of the Work and any modifications or additions
|
|
41
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
42
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
43
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
44
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
45
|
+
means any form of electronic, verbal, or written communication sent
|
|
46
|
+
to the Licensor or its representatives, including but not limited to
|
|
47
|
+
communication on electronic mailing lists, source code control systems,
|
|
48
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
49
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
50
|
+
excluding communication that is conspicuously marked or otherwise
|
|
51
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
52
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
53
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
54
|
+
subsequently incorporated within the Work.
|
|
55
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
56
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
57
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
58
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
59
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
60
|
+
Work and such Derivative Works in Source or Object form.
|
|
61
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
62
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
63
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
64
|
+
(except as stated in this section) patent license to make, have made,
|
|
65
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
66
|
+
where such license applies only to those patent claims licensable
|
|
67
|
+
by such Contributor that are necessarily infringed by their
|
|
68
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
69
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
70
|
+
institute patent litigation against any entity (including a
|
|
71
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
72
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
73
|
+
or contributory patent infringement, then any patent licenses
|
|
74
|
+
granted to You under this License for that Work shall terminate
|
|
75
|
+
as of the date such litigation is filed.
|
|
76
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
77
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
78
|
+
modifications, and in Source or Object form, provided that You
|
|
79
|
+
meet the following conditions:
|
|
80
|
+
(a) You must give any other recipients of the Work or
|
|
81
|
+
Derivative Works a copy of this License; and
|
|
82
|
+
(b) You must cause any modified files to carry prominent notices
|
|
83
|
+
stating that You changed the files; and
|
|
84
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
85
|
+
that You distribute, all copyright, patent, trademark, and
|
|
86
|
+
attribution notices from the Source form of the Work,
|
|
87
|
+
excluding those notices that do not pertain to any part of
|
|
88
|
+
the Derivative Works; and
|
|
89
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
90
|
+
distribution, then any Derivative Works that You distribute must
|
|
91
|
+
include a readable copy of the attribution notices contained
|
|
92
|
+
within such NOTICE file, excluding those notices that do not
|
|
93
|
+
pertain to any part of the Derivative Works, in at least one
|
|
94
|
+
of the following places: within a NOTICE text file distributed
|
|
95
|
+
as part of the Derivative Works; within the Source form or
|
|
96
|
+
documentation, if provided along with the Derivative Works; or,
|
|
97
|
+
within a display generated by the Derivative Works, if and
|
|
98
|
+
wherever such third-party notices normally appear. The contents
|
|
99
|
+
of the NOTICE file are for informational purposes only and
|
|
100
|
+
do not modify the License. You may add Your own attribution
|
|
101
|
+
notices within Derivative Works that You distribute, alongside
|
|
102
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
103
|
+
that such additional attribution notices cannot be construed
|
|
104
|
+
as modifying the License.
|
|
105
|
+
You may add Your own copyright statement to Your modifications and
|
|
106
|
+
may provide additional or different license terms and conditions
|
|
107
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
108
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
109
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
110
|
+
the conditions stated in this License.
|
|
111
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
112
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
113
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
114
|
+
this License, without any additional terms or conditions.
|
|
115
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
116
|
+
the terms of any separate license agreement you may have executed
|
|
117
|
+
with Licensor regarding such Contributions.
|
|
118
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
119
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
120
|
+
except as required for reasonable and customary use in describing the
|
|
121
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
122
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
123
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
124
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
125
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
126
|
+
implied, including, without limitation, any warranties or conditions
|
|
127
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
128
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
129
|
+
appropriateness of using or redistributing the Work and assume any
|
|
130
|
+
risks associated with Your exercise of permissions under this License.
|
|
131
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
132
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
133
|
+
unless required by applicable law (such as deliberate and grossly
|
|
134
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
135
|
+
liable to You for damages, including any direct, indirect, special,
|
|
136
|
+
incidental, or consequential damages of any character arising as a
|
|
137
|
+
result of this License or out of the use or inability to use the
|
|
138
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
139
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
140
|
+
other commercial damages or losses), even if such Contributor
|
|
141
|
+
has been advised of the possibility of such damages.
|
|
142
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
143
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
144
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
145
|
+
or other liability obligations and/or rights consistent with this
|
|
146
|
+
License. However, in accepting such obligations, You may act only
|
|
147
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
148
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
149
|
+
defend, and hold each Contributor harmless for any liability
|
|
150
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
151
|
+
of your accepting any such warranty or additional liability.
|
|
152
|
+
END OF TERMS AND CONDITIONS
|
|
153
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
154
|
+
To apply the Apache License to your work, attach the following
|
|
155
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
156
|
+
replaced with your own identifying information. (Don't include
|
|
157
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
158
|
+
comment syntax for the file format. We also recommend that a
|
|
159
|
+
file or class name and description of purpose be included on the
|
|
160
|
+
same "printed page" as the copyright notice for easier
|
|
161
|
+
identification within third-party archives.
|
|
162
|
+
Copyright [yyyy] [name of copyright owner]
|
|
163
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
164
|
+
you may not use this file except in compliance with the License.
|
|
165
|
+
You may obtain a copy of the License at
|
|
166
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
167
|
+
Unless required by applicable law or agreed to in writing, software
|
|
168
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
169
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
170
|
+
See the License for the specific language governing permissions and
|
|
171
|
+
limitations under the License.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// custom events to be added to <dialog>
|
|
2
|
+
const dialogClosingEvent = new Event('closing')
|
|
3
|
+
const dialogClosedEvent = new Event('closed')
|
|
4
|
+
const dialogOpeningEvent = new Event('opening')
|
|
5
|
+
const dialogOpenedEvent = new Event('opened')
|
|
6
|
+
const dialogRemovedEvent = new Event('removed')
|
|
7
|
+
|
|
8
|
+
// track opening
|
|
9
|
+
const dialogAttrObserver = new MutationObserver((mutations, observer) => {
|
|
10
|
+
mutations.forEach(async mutation => {
|
|
11
|
+
if (mutation.attributeName === 'open') {
|
|
12
|
+
const dialog = mutation.target as HTMLDialogElement;
|
|
13
|
+
|
|
14
|
+
const isOpen = dialog.hasAttribute('open')
|
|
15
|
+
if (!isOpen) return
|
|
16
|
+
|
|
17
|
+
dialog.removeAttribute('inert')
|
|
18
|
+
|
|
19
|
+
// set focus
|
|
20
|
+
const focusTarget = dialog.querySelector('[autofocus]') as HTMLDialogElement;
|
|
21
|
+
focusTarget
|
|
22
|
+
? focusTarget?.focus()
|
|
23
|
+
: dialog?.querySelector('button')?.focus()
|
|
24
|
+
|
|
25
|
+
dialog.dispatchEvent(dialogOpeningEvent)
|
|
26
|
+
await animationsComplete(dialog)
|
|
27
|
+
dialog.dispatchEvent(dialogOpenedEvent)
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// track deletion
|
|
33
|
+
const dialogDeleteObserver = new MutationObserver((mutations, observer) => {
|
|
34
|
+
mutations.forEach(mutation => {
|
|
35
|
+
mutation.removedNodes.forEach(removedNode => {
|
|
36
|
+
if (removedNode.nodeName === 'DIALOG') {
|
|
37
|
+
removedNode.removeEventListener('click', lightDismiss)
|
|
38
|
+
removedNode.removeEventListener('close', dialogClose)
|
|
39
|
+
removedNode.dispatchEvent(dialogRemovedEvent)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
// wait for all dialog animations to complete their promises
|
|
46
|
+
const animationsComplete = (element: HTMLDialogElement) =>
|
|
47
|
+
Promise.allSettled(
|
|
48
|
+
element.getAnimations().map((animation: Animation) =>
|
|
49
|
+
animation.finished))
|
|
50
|
+
|
|
51
|
+
// click outside the dialog handler
|
|
52
|
+
const lightDismiss = ({ target: dialog }) => {
|
|
53
|
+
if (dialog.nodeName === 'DIALOG')
|
|
54
|
+
dialog.close('dismiss')
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const dialogClose = async ({target:dialog}) => {
|
|
58
|
+
dialog.setAttribute('inert', '')
|
|
59
|
+
dialog.dispatchEvent(dialogClosingEvent)
|
|
60
|
+
|
|
61
|
+
await animationsComplete(dialog)
|
|
62
|
+
|
|
63
|
+
dialog.dispatchEvent(dialogClosedEvent)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// page load dialogs setup
|
|
67
|
+
export async function initDialog(dialog: HTMLDialogElement) {
|
|
68
|
+
dialog.addEventListener('click', lightDismiss)
|
|
69
|
+
dialog.addEventListener('close', dialogClose)
|
|
70
|
+
|
|
71
|
+
dialogAttrObserver.observe(dialog, {
|
|
72
|
+
attributes: true,
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
dialogDeleteObserver.observe(document.body, {
|
|
76
|
+
attributes: false,
|
|
77
|
+
subtree: false,
|
|
78
|
+
childList: true,
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// remove visibility:hidden style
|
|
82
|
+
// prevent page load @keyframes playing
|
|
83
|
+
await animationsComplete(dialog);
|
|
84
|
+
// dialog.style.removeProperty('visibility');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const dialogRemoved = ({ target: dialog }) => {
|
|
88
|
+
dialog.removeEventListener('removed', dialogRemoved)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// SETUP
|
|
92
|
+
document.querySelectorAll('dialog').forEach((dialog: HTMLDialogElement) => {
|
|
93
|
+
// sugar up <dialog> elements
|
|
94
|
+
initDialog(dialog);
|
|
95
|
+
|
|
96
|
+
dialog.addEventListener('removed', dialogRemoved, { once: true });
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const htmlEl = document.documentElement;
|
|
100
|
+
htmlEl?.addEventListener('click', (e: MouseEvent) => {
|
|
101
|
+
const el = e.target as HTMLElement;
|
|
102
|
+
|
|
103
|
+
if (el.hasAttribute('data-dialogtarget')) {
|
|
104
|
+
const dialogId = el.getAttribute('data-dialogtarget');
|
|
105
|
+
if (dialogId) window[dialogId].showModal();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (el.hasAttribute('data-closes-dialog')) {
|
|
109
|
+
(el as HTMLButtonElement)?.closest('dialog')?.close('close');
|
|
110
|
+
}
|
|
111
|
+
});
|