@natachah/vanilla-frontend 0.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.
Files changed (104) hide show
  1. package/.gitlab-ci.yml +40 -0
  2. package/LICENSE.md +7 -0
  3. package/README.md +11 -0
  4. package/docs/index.html +36 -0
  5. package/docs/main.js +32 -0
  6. package/docs/pages/components/badge.html +154 -0
  7. package/docs/pages/components/button.html +186 -0
  8. package/docs/pages/components/card.html +184 -0
  9. package/docs/pages/components/dialog.html +334 -0
  10. package/docs/pages/components/disclosure.html +310 -0
  11. package/docs/pages/components/dropdown.html +255 -0
  12. package/docs/pages/components/form.html +331 -0
  13. package/docs/pages/components/list.html +140 -0
  14. package/docs/pages/components/loading.html +58 -0
  15. package/docs/pages/components/media.html +130 -0
  16. package/docs/pages/components/nav.html +119 -0
  17. package/docs/pages/components/progress.html +47 -0
  18. package/docs/pages/components/slider.html +311 -0
  19. package/docs/pages/components/table.html +168 -0
  20. package/docs/pages/javascript/autofill.html +170 -0
  21. package/docs/pages/javascript/checkall.html +59 -0
  22. package/docs/pages/javascript/comfort.html +134 -0
  23. package/docs/pages/javascript/consent.html +112 -0
  24. package/docs/pages/javascript/cookie.html +81 -0
  25. package/docs/pages/javascript/form.html +199 -0
  26. package/docs/pages/javascript/scroll.html +209 -0
  27. package/docs/pages/javascript/sidebar.html +53 -0
  28. package/docs/pages/javascript/sortable.html +148 -0
  29. package/docs/pages/javascript/toggle.html +191 -0
  30. package/docs/pages/javascript/tree.html +221 -0
  31. package/docs/pages/layout/grid.html +201 -0
  32. package/docs/pages/layout/reset.html +53 -0
  33. package/docs/pages/layout/typography.html +324 -0
  34. package/docs/pages/quick-start/conventions.html +112 -0
  35. package/docs/pages/quick-start/customization.html +187 -0
  36. package/docs/pages/quick-start/installation.html +95 -0
  37. package/docs/pages/quick-start/mixins.html +228 -0
  38. package/docs/pages/test.html +15 -0
  39. package/docs/src/js/demo.js +98 -0
  40. package/docs/src/js/doc-code.js +102 -0
  41. package/docs/src/js/doc-demo.js +14 -0
  42. package/docs/src/js/doc-layout.js +108 -0
  43. package/docs/src/scss/demo.scss +77 -0
  44. package/docs/src/scss/layout.scss +160 -0
  45. package/docs/src/scss/style.scss +278 -0
  46. package/docs/vite.config.mjs +23 -0
  47. package/esbuild.mjs +25 -0
  48. package/js/_autofill.js +131 -0
  49. package/js/_check-all.js +77 -0
  50. package/js/_comfort.js +174 -0
  51. package/js/_consent.js +84 -0
  52. package/js/_dialog.js +164 -0
  53. package/js/_dropdown.js +101 -0
  54. package/js/_scroll.js +184 -0
  55. package/js/_sidebar.js +97 -0
  56. package/js/_slider.js +249 -0
  57. package/js/_sortable.js +143 -0
  58. package/js/_tabpanel.js +88 -0
  59. package/js/_toggle.js +123 -0
  60. package/js/_tree.js +85 -0
  61. package/js/tests/autofill.test.js +157 -0
  62. package/js/tests/base-component.test.js +108 -0
  63. package/js/tests/check-all.test.js +88 -0
  64. package/js/tests/comfort.test.js +219 -0
  65. package/js/tests/consent.test.js +84 -0
  66. package/js/tests/cookie.test.js +102 -0
  67. package/js/tests/dialog.test.js +189 -0
  68. package/js/tests/dropdown.test.js +115 -0
  69. package/js/tests/form-helper.test.js +155 -0
  70. package/js/tests/scroll.test.js +203 -0
  71. package/js/tests/sidebar.test.js +99 -0
  72. package/js/tests/slider.test.js +307 -0
  73. package/js/tests/sortable.test.js +124 -0
  74. package/js/tests/tabpanel.test.js +114 -0
  75. package/js/tests/toggle.test.js +190 -0
  76. package/js/tests/tree.test.js +165 -0
  77. package/js/utilities/_base-component.js +101 -0
  78. package/js/utilities/_cookie.js +98 -0
  79. package/js/utilities/_error.js +80 -0
  80. package/js/utilities/_form-helper.js +101 -0
  81. package/package.json +42 -0
  82. package/scss/_badge.scss +37 -0
  83. package/scss/_button.scss +34 -0
  84. package/scss/_card.scss +122 -0
  85. package/scss/_dialog.scss +116 -0
  86. package/scss/_disclosure.scss +101 -0
  87. package/scss/_dropdown.scss +68 -0
  88. package/scss/_form.scss +197 -0
  89. package/scss/_grid.scss +40 -0
  90. package/scss/_group.scss +57 -0
  91. package/scss/_list.scss +18 -0
  92. package/scss/_loading.scss +49 -0
  93. package/scss/_media.scss +37 -0
  94. package/scss/_nav.scss +72 -0
  95. package/scss/_progress.scss +40 -0
  96. package/scss/_slider.scss +35 -0
  97. package/scss/_table.scss +36 -0
  98. package/scss/utilities/_mixin.scss +322 -0
  99. package/scss/utilities/_reset.scss +145 -0
  100. package/scss/utilities/_typography.scss +107 -0
  101. package/scss/vanilla-frontend.scss +23 -0
  102. package/scss/variables/_root.scss +70 -0
  103. package/scss/variables/_setting.scss +63 -0
  104. package/vitest.config.js +7 -0
@@ -0,0 +1,108 @@
1
+ class DocLayout extends HTMLElement {
2
+ constructor() {
3
+ super()
4
+ this.innerHTML = `
5
+ <div id="backdrop"></div>
6
+ <header>
7
+ <button aria-expanded="false" aria-pressed="false" aria-controls="sidebar" aria-label="Toggle the sidebar navigation">
8
+ <svg viewbox="0 0 100 100" width="100%">
9
+ <rect width="100" height="10" x="0" y="10" rx="0"></rect>
10
+ <rect width="100" height="10" x="0" y="45" rx="0"></rect>
11
+ <rect width="100" height="10" x="0" y="80" rx="0"></rect>
12
+ </svg>
13
+ </button>
14
+ <nav aria-label="Mainbar navigation">
15
+ <ul>
16
+ <li>
17
+ <span class="badge">
18
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pin-angle" viewBox="0 0 16 16">
19
+ <path d="M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a6 6 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707s.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a6 6 0 0 1 1.013.16l3.134-3.133a3 3 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146m.122 2.112v-.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a5 5 0 0 0-.288-.076 5 5 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a5 5 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034q.172.002.343-.04L9.927 2.028q-.042.172-.04.343a1.8 1.8 0 0 0 .062.46z"/>
20
+ </svg>
21
+ 0.0.1
22
+ </span>
23
+ </li>
24
+ <li>
25
+ <a href="https://gitlab.com/packages4913705/vanilla-frontend" aria-label="Go to Gitlab">
26
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gitlab" viewBox="0 0 16 16">
27
+ <path d="m15.734 6.1-.022-.058L13.534.358a.57.57 0 0 0-.563-.356.6.6 0 0 0-.328.122.6.6 0 0 0-.193.294l-1.47 4.499H5.025l-1.47-4.5A.572.572 0 0 0 2.47.358L.289 6.04l-.022.057A4.044 4.044 0 0 0 1.61 10.77l.007.006.02.014 3.318 2.485 1.64 1.242 1 .755a.67.67 0 0 0 .814 0l1-.755 1.64-1.242 3.338-2.5.009-.007a4.05 4.05 0 0 0 1.34-4.668Z"/>
28
+ </svg>
29
+ </a>
30
+ </li>
31
+ <li>
32
+ <a href="https://www.npmjs.com/package/@natachah/vanilla-frontend" aria-label="Go to NPMJS">
33
+ <svg viewBox="0 0 27.23 27.23" aria-hidden="true"><rect fill="currentColor" width="27.23" height="27.23" rx="2"></rect><polygon fill="#fff" points="5.8 21.75 13.66 21.75 13.67 9.98 17.59 9.98 17.58 21.76 21.51 21.76 21.52 6.06 5.82 6.04 5.8 21.75"></polygon></svg>
34
+ </a>
35
+ </li>
36
+ </ul>
37
+ </nav>
38
+ </header>
39
+ <aside id="sidebar" tabindex="0" hidden>
40
+ <header>
41
+ <a href="/index.html">
42
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-rocket" viewBox="0 0 16 16">
43
+ <path d="M8 8c.828 0 1.5-.895 1.5-2S8.828 4 8 4s-1.5.895-1.5 2S7.172 8 8 8"/>
44
+ <path d="M11.953 8.81c-.195-3.388-.968-5.507-1.777-6.819C9.707 1.233 9.23.751 8.857.454a3.5 3.5 0 0 0-.463-.315A2 2 0 0 0 8.25.064.55.55 0 0 0 8 0a.55.55 0 0 0-.266.073 2 2 0 0 0-.142.08 4 4 0 0 0-.459.33c-.37.308-.844.803-1.31 1.57-.805 1.322-1.577 3.433-1.774 6.756l-1.497 1.826-.004.005A2.5 2.5 0 0 0 2 12.202V15.5a.5.5 0 0 0 .9.3l1.125-1.5c.166-.222.42-.4.752-.57.214-.108.414-.192.625-.281l.198-.084c.7.428 1.55.635 2.4.635s1.7-.207 2.4-.635q.1.044.196.083c.213.09.413.174.627.282.332.17.586.348.752.57l1.125 1.5a.5.5 0 0 0 .9-.3v-3.298a2.5 2.5 0 0 0-.548-1.562zM12 10.445v.055c0 .866-.284 1.585-.75 2.14.146.064.292.13.425.199.39.197.8.46 1.1.86L13 14v-1.798a1.5 1.5 0 0 0-.327-.935zM4.75 12.64C4.284 12.085 4 11.366 4 10.5v-.054l-.673.82a1.5 1.5 0 0 0-.327.936V14l.225-.3c.3-.4.71-.664 1.1-.861.133-.068.279-.135.425-.199M8.009 1.073q.096.06.226.163c.284.226.683.621 1.09 1.28C10.137 3.836 11 6.237 11 10.5c0 .858-.374 1.48-.943 1.893C9.517 12.786 8.781 13 8 13s-1.517-.214-2.057-.607C5.373 11.979 5 11.358 5 10.5c0-4.182.86-6.586 1.677-7.928.409-.67.81-1.082 1.096-1.32q.136-.113.236-.18Z"/>
45
+ <path d="M9.479 14.361c-.48.093-.98.139-1.479.139s-.999-.046-1.479-.139L7.6 15.8a.5.5 0 0 0 .8 0z"/>
46
+ </svg>
47
+ Vanilla Frontend
48
+ </a>
49
+ </header>
50
+ <nav aria-label="Sidebar navigation">
51
+ <h2>Quick start</h2>
52
+ <ul>
53
+ <li><a href="/pages/quick-start/installation.html">Installation</a></li>
54
+ <li><a href="/pages/quick-start/customization.html">Customization</a></li>
55
+ <li><a href="/pages/quick-start/mixins.html">SCSS Mixins</a></li>
56
+ <li><a href="/pages/quick-start/conventions.html">Conventions</a></li>
57
+ </ul>
58
+ <h2>Layout</h2>
59
+ <ul>
60
+ <li><a href="/pages/layout/reset.html">Reset</a></li>
61
+ <li><a href="/pages/layout/typography.html">Typography</a></li>
62
+ <li><a href="/pages/layout/grid.html">Grid</a></li>
63
+ </ul>
64
+ <h2>Components</h2>
65
+ <ul>
66
+ <li><a href="/pages/components/badge.html">Badge</a></li>
67
+ <li><a href="/pages/components/button.html">Button</a></li>
68
+ <li><a href="/pages/components/card.html">Card</a></li>
69
+ <li><a href="/pages/components/dialog.html">Dialog</a></li>
70
+ <li><a href="/pages/components/disclosure.html">Disclosure</a></li>
71
+ <li><a href="/pages/components/dropdown.html">Dropdown</a></li>
72
+ <li><a href="/pages/components/form.html">Form</a></li>
73
+ <li><a href="/pages/components/list.html">List</a></li>
74
+ <li><a href="/pages/components/loading.html">Loading</a></li>
75
+ <li><a href="/pages/components/media.html">Media</a></li>
76
+ <li><a href="/pages/components/nav.html">Nav</a></li>
77
+ <li><a href="/pages/components/progress.html">Progress</a></li>
78
+ <li><a href="/pages/components/slider.html">Slider</a></li>
79
+ <li><a href="/pages/components/table.html">Table</a></li>
80
+ </ul>
81
+ <h2>Javascript</h2>
82
+ <ul>
83
+ <li><a href="/pages/javascript/autofill.html">Autofill</a></li>
84
+ <li><a href="/pages/javascript/checkall.html">Check all</a></li>
85
+ <li><a href="/pages/javascript/comfort.html">Comfort</a></li>
86
+ <li><a href="/pages/javascript/consent.html">Consent</a></li>
87
+ <li><a href="/pages/javascript/cookie.html">Cookie</a></li>
88
+ <li><a href="/pages/javascript/form.html">Form helper</a></li>
89
+ <li><a href="/pages/javascript/scroll.html">Scroll</a></li>
90
+ <li><a href="/pages/javascript/sidebar.html">Sidebar</a></li>
91
+ <li><a href="/pages/javascript/sortable.html">Sortable</a></li>
92
+ <li><a href="/pages/javascript/toggle.html">Toggle</a></li>
93
+ <li><a href="/pages/javascript/tree.html">Tree</a></li>
94
+ </ul>
95
+ <div id="copyright">
96
+ Released under the MIT License.<br>
97
+ Copyright © 2024-present <a href="https://natachaherth.ch">Natacha Herth</a>
98
+ </div>
99
+ </nav>
100
+ </aside>
101
+ <main>
102
+ ${this.innerHTML}
103
+ </main>
104
+ `
105
+ }
106
+ }
107
+
108
+ customElements.define('doc-layout', DocLayout)
@@ -0,0 +1,77 @@
1
+ ////
2
+ /// ------------------------------------------------------------------
3
+ /// Demo
4
+ /// ------------------------------------------------------------------
5
+ /// This is the style for demonstration bloc
6
+ ///
7
+ /// @author Natacha Herth
8
+ /// @since 1.0.0
9
+ ///
10
+ ////
11
+
12
+ @import './../../../scss/utilities/_mixin.scss';
13
+
14
+ // Demo for grid offset
15
+ #flexGridDemoOffset {
16
+ @include flex-grid-offset-column()
17
+ }
18
+
19
+ // Demo for grid wider
20
+ #flexGridDemoWider {
21
+ @include flex-grid-wider-column()
22
+ }
23
+
24
+ // Demo for fade slider
25
+ .slider-fade-demo {
26
+ --image-width: 100%;
27
+ --image-ratio: 4/3;
28
+ background-position: center;
29
+ background-repeat: no-repeat;
30
+ background-size: cover;
31
+
32
+ > * {
33
+ transition: all 2s ease-out;
34
+
35
+ &[aria-hidden=true] {
36
+ filter: blur(1rem);
37
+ opacity: 0;
38
+ }
39
+
40
+ &[aria-hidden=false] {
41
+ opacity: 1;
42
+ }
43
+ }
44
+ }
45
+
46
+ // Create a container
47
+ .as-container {
48
+ container-type: inline-size;
49
+ min-height: 300px;
50
+ overflow: hidden;
51
+ }
52
+
53
+ // Demo for responsive table
54
+ @container (max-width:800px) {
55
+ #demoTable {
56
+ @include as-responsive-table()
57
+ }
58
+ }
59
+
60
+ // Demo for grid
61
+ doc-demo {
62
+
63
+ .grid,
64
+ .flex-grid {
65
+ &:not(.demo-inline) > * {
66
+ background-color: #eee;
67
+ text-align: center;
68
+ padding-block: 1rem;
69
+ }
70
+
71
+ &.demo-inline {
72
+ --grid-columns: 3
73
+ }
74
+
75
+ }
76
+
77
+ }
@@ -0,0 +1,160 @@
1
+ ////
2
+ /// ------------------------------------------------------------------
3
+ /// Layout
4
+ /// ------------------------------------------------------------------
5
+ /// This is the style for the basic layout with a sidebar
6
+ ///
7
+ /// @author Natacha Herth
8
+ /// @since 1.0.0
9
+ ///
10
+ ////
11
+
12
+ doc-layout {
13
+
14
+ height: 100vh;
15
+ display: grid;
16
+ grid-template-columns: 0px 1fr;
17
+ grid-template-rows: max-content 1fr;
18
+ grid-template-areas: "aside header" "aside main" "aside footer";
19
+ overflow: hidden;
20
+ transition: all .5s ease-in-out;
21
+
22
+ > header,
23
+ > aside > header {
24
+ grid-area: header;
25
+ }
26
+
27
+ > footer,
28
+ > aside > footer {
29
+ grid-area: footer;
30
+ }
31
+
32
+ // The open/close button for the sidebar
33
+ > header button {
34
+
35
+ rect {
36
+ transition: y .25s ease-in-out .25s, rotate .25s ease-in-out, opacity 0ms .25s;
37
+ transform-origin: center;
38
+ }
39
+
40
+ // Active
41
+ &[aria-expanded=true] {
42
+
43
+ // Define the rectangle transition for the reverse animation
44
+ rect {
45
+ transition: y .25s ease-in-out, rotate .25s ease-in-out .25s, opacity 0ms .25s;
46
+ }
47
+
48
+ // Remove the middle bar
49
+ rect:not(:first-child, :last-child) {
50
+ opacity: 0;
51
+ }
52
+
53
+ // Change the first bar
54
+ rect:first-child {
55
+ y: calc(50% - var(--svg-line-size, 10px) / 2);
56
+ rotate: 45deg;
57
+ }
58
+
59
+ // Change the last bar
60
+ rect:last-child {
61
+ y: calc(50% - var(--svg-line-size, 10px) / 2);
62
+ rotate: -45deg;
63
+ }
64
+
65
+ }
66
+
67
+ }
68
+
69
+ > main {
70
+ grid-area: main;
71
+ overflow-y: auto;
72
+ }
73
+
74
+ aside {
75
+
76
+ // Set the grid for the sidebar based on the parent grid
77
+ grid-area: aside;
78
+ display: grid !important;
79
+ grid-template-rows: subgrid;
80
+ grid-template-areas: "header" "main" "footer";
81
+
82
+ // Make the sidebar as stiky for mobile
83
+ position: sticky;
84
+ z-index: 2;
85
+ top: 0;
86
+ width: 320px;
87
+ max-width: 80vw;
88
+ height: 100vh;
89
+
90
+ // Animation
91
+ transition: all .5s ease-in-out;
92
+ transform-origin: left;
93
+ transform: none;
94
+
95
+ // Show the sidebar
96
+ pointer-events: initial;
97
+ visibility: visible;
98
+ transform: translateX(0);
99
+
100
+ // Hide the sidebar
101
+ &[hidden] {
102
+ pointer-events: none;
103
+ overflow: hidden auto;
104
+ visibility: hidden;
105
+ transform: translateX(-100%);
106
+ }
107
+
108
+ // Design the nav
109
+ > nav {
110
+ overflow-y: auto;
111
+ }
112
+
113
+ }
114
+
115
+ * {
116
+ // Hide scrollbar for IE, Edge and Firefox
117
+ -ms-overflow-style: none;
118
+ scrollbar-width: none;
119
+
120
+ //Hide scrollbar for Chrome, Safari and Opera
121
+ &::-webkit-scrollbar {
122
+ display: none;
123
+ }
124
+ }
125
+
126
+ #backdrop {
127
+ // Design the backdrop
128
+ position: fixed;
129
+ inset: 0;
130
+ z-index: 1;
131
+ background-color: rgba(0, 0, 0, .25);
132
+ backdrop-filter: blur(.25rem);
133
+
134
+ // Animation
135
+ transition: all .5s ease-in-out;
136
+
137
+ // By default it's hidden
138
+ pointer-events: none;
139
+ visibility: hidden;
140
+ opacity: 0;
141
+ }
142
+
143
+ // Make backdrop visible if breakpoint
144
+ @media (max-width:960px) {
145
+ &:has(aside:not([hidden])) {
146
+ #backdrop {
147
+ visibility: visible;
148
+ pointer-events: initial;
149
+ opacity: 1;
150
+ }
151
+ }
152
+ }
153
+
154
+ @media (min-width: 960px) {
155
+ &:has(aside:not([hidden])) {
156
+ grid-template-columns: 320px 1fr;
157
+ }
158
+ }
159
+
160
+ }
@@ -0,0 +1,278 @@
1
+ ////
2
+ /// ------------------------------------------------------------------
3
+ /// Style
4
+ /// ------------------------------------------------------------------
5
+ /// This is the style for the website
6
+ ///
7
+ /// @author Natacha Herth
8
+ /// @since 1.0.0
9
+ ///
10
+ ////
11
+
12
+ @import './../../../scss/utilities/_mixin.scss';
13
+
14
+ :root {
15
+
16
+ --doc-header-padding-block: 1rem;
17
+ --doc-main-padding-block: 2rem;
18
+ --doc-sidebar-padding-inline: 2rem;
19
+ --doc-main-padding-inline: 4rem;
20
+
21
+ --doc-bloc-padding: 1.5rem;
22
+ --doc-bloc-radius: .75rem;
23
+ --doc-code-background: #282c34;
24
+ --doc-border-color: #e2e2e2;
25
+
26
+ --color-font: #535353;
27
+ --heading-color: #3c3c3c;
28
+ --dialog-index: 3;
29
+ --line-height: 1.75;
30
+ --heading-line-height: 1.5;
31
+
32
+ }
33
+
34
+ doc-layout {
35
+
36
+ > header {
37
+
38
+ // For the icon link
39
+ --nav-color: rgba(0, 0, 0, .5);
40
+ --nav-hover-color: black;
41
+
42
+ // Display inline
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: space-between;
46
+ padding: var(--doc-header-padding-block) var(--doc-main-padding-inline);
47
+ border-bottom: 1px solid var(--doc-border-color);
48
+ }
49
+
50
+ > aside {
51
+
52
+ background-color: var(--color-body, white);
53
+ border-right: 1px solid var(--doc-border-color);
54
+
55
+ > header {
56
+
57
+ padding: var(--doc-header-padding-block) var(--doc-sidebar-padding-inline);
58
+ font-size: var(--font-size-h3);
59
+
60
+ svg {
61
+ transition: all .25s ease-in-out;
62
+ color: var(--color-primary)
63
+ }
64
+
65
+ a {
66
+ display: block;
67
+ width: 100%;
68
+ white-space: nowrap; // For bug when hide sidebar ≠ change the height of header
69
+
70
+ &:hover svg {
71
+ transform: rotate(25deg);
72
+ }
73
+ }
74
+
75
+ }
76
+
77
+ > nav {
78
+
79
+ --nav-direction: column;
80
+ --nav-align: start;
81
+ --nav-gap: .25rem;
82
+ --nav-hover-color: var(--color-primary);
83
+
84
+ // Display flex to make sure copyright will always at the bottom
85
+ display: flex;
86
+ flex-direction: column;
87
+ padding: var(--doc-main-padding-block) var(--doc-sidebar-padding-inline);
88
+
89
+ > h2 {
90
+ margin-bottom: .25em;
91
+ font-size: var(--font-size);
92
+ font-weight: bold;
93
+ }
94
+
95
+ > ul:not(:last-child) {
96
+ margin-bottom: 1.5rem;
97
+ }
98
+
99
+ }
100
+
101
+ #copyright {
102
+ font-size: var(--font-size-small);
103
+ text-align: center;
104
+ margin-top: auto;
105
+ padding-block: .5rem;
106
+ font-style: italic;
107
+ }
108
+
109
+ }
110
+
111
+ > main {
112
+
113
+ container-type: inline-size;
114
+ padding: var(--doc-main-padding-block) var(--doc-main-padding-inline);
115
+
116
+ :not(doc-demo) a {
117
+ --anchor-color: var(--color-primary);
118
+ --anchor-decoration: underline;
119
+ }
120
+
121
+ > h2 {
122
+ margin-block: 2em .25em;
123
+ padding-top: .5em;
124
+ border-top: 1px solid var(--doc-border-color);
125
+
126
+ &:before {
127
+ content: '# ';
128
+ }
129
+ }
130
+
131
+ > h3 {
132
+ margin-block: 1em .25em;
133
+ }
134
+
135
+ > h2 + *,
136
+ > h3 + * {
137
+ margin-top: 0 !important;
138
+ }
139
+
140
+ > p,
141
+ > ul,
142
+ > hr,
143
+ > blockquote,
144
+ > table,
145
+ > doc-demo,
146
+ > doc-code,
147
+ > .code-group {
148
+ margin-block: 1.75rem;
149
+ }
150
+
151
+ > blockquote {
152
+
153
+ border-left: 3px solid var(--blockquote-color, var(--color-primary));
154
+ padding-left: var(--doc-bloc-padding);
155
+
156
+ &:is(.tip, .warning, .todo) {
157
+
158
+ background-color: color-mix(in srgb, var(--blockquote-color), transparent 90%);
159
+ border-radius: var(--doc-bloc-radius);
160
+ border-left: none;
161
+ padding: var(--doc-bloc-padding);
162
+
163
+ &:before {
164
+ font-weight: bold;
165
+ text-transform: uppercase;
166
+ color: var(--blockquote-color);
167
+ content: attr(class);
168
+ }
169
+
170
+ }
171
+
172
+ &.tip {
173
+ --blockquote-color: var(--color-primary);
174
+ }
175
+
176
+ &.warning {
177
+ --blockquote-color: var(--color-warning);
178
+ }
179
+
180
+ &.todo {
181
+ --blockquote-color: var(--color-error);
182
+ }
183
+
184
+ }
185
+
186
+ > table {
187
+ th {
188
+ font-weight: bold;
189
+ }
190
+
191
+ tr:nth-child(odd) td {
192
+ background-color: rgba(0, 0, 0, .05);
193
+ }
194
+ }
195
+
196
+ > doc-demo {
197
+ display: block;
198
+ padding: var(--doc-bloc-padding);
199
+ border-radius: var(--doc-bloc-radius);
200
+ border: 1px solid var(--doc-border-color);
201
+ }
202
+
203
+ // Simple code bloc => add the type on the bottom
204
+ > doc-code {
205
+
206
+ display: block;
207
+ position: relative;
208
+ padding: var(--doc-bloc-padding);
209
+ background-color: var(--doc-code-background);
210
+ border-radius: var(--doc-bloc-radius);
211
+
212
+ &::before {
213
+ content: attr(data-type, 'html');
214
+ position: absolute;
215
+ bottom: .5rem;
216
+ right: .75rem;
217
+ font-size: 12px;
218
+ color: white;
219
+ opacity: .5;
220
+ }
221
+
222
+ }
223
+
224
+ // Tab nav code bloc
225
+ > .code-group {
226
+
227
+ position: relative;
228
+ padding: calc(var(--doc-bloc-padding) / 2) var(--doc-bloc-padding);
229
+ background-color: var(--doc-code-background);
230
+ border-radius: var(--doc-bloc-radius);
231
+
232
+ doc-code:not([hidden]) {
233
+ display: block;
234
+ padding: .5rem;
235
+ }
236
+
237
+ [role=tablist] {
238
+ --button-color: white;
239
+ --button-active-color: var(--color-primary);
240
+ --button-hover-background: rgba(255, 255, 255, .25);
241
+ --button-padding-inline: .5rem;
242
+ --button-padding-block: .25rem;
243
+ font-size: 12px;
244
+ margin-bottom: .25rem;
245
+ }
246
+
247
+ }
248
+
249
+ }
250
+
251
+ }
252
+
253
+ @media (max-width:630px) {
254
+ :root {
255
+ --doc-header-padding-block: 1rem;
256
+ --doc-main-padding-block: 1rem;
257
+ --doc-sidebar-padding-inline: 1rem;
258
+ --doc-main-padding-inline: 1.5rem;
259
+
260
+ --font-size: 14px;
261
+ --line-height: 1.5;
262
+ --heading-line-height: 1.25;
263
+ }
264
+ }
265
+
266
+ @container (max-width:576px) {
267
+ table {
268
+
269
+ --table-padding-block: 0.125em;
270
+
271
+ @include as-responsive-table();
272
+
273
+ td[data-label]:before {
274
+ font-weight: bold;
275
+ }
276
+
277
+ }
278
+ }
@@ -0,0 +1,23 @@
1
+ import { defineConfig } from 'vite'
2
+ import glob from 'fast-glob'
3
+ import path from 'node:path'
4
+ import { fileURLToPath } from 'node:url'
5
+
6
+ export default defineConfig({
7
+ build: {
8
+ target: 'esnext', //browsers can handle the latest ES features
9
+ cssCodeSplit: false,
10
+ rollupOptions: {
11
+ input: Object.fromEntries(
12
+ glob.sync(['./*.html', './pages/**/*.html']).map(file => [
13
+ // This remove `pages/` as well as the file extension from each
14
+ // file, so e.g. pages/nested/foo.html becomes nested/foo
15
+ path.relative(__dirname, file.slice(0, file.length - path.extname(file).length)),
16
+ // This expands the relative paths to absolute paths, so e.g.
17
+ // src/nested/foo becomes /project/src/nested/foo.js
18
+ fileURLToPath(new URL(file, import.meta.url)),
19
+ ]),
20
+ ),
21
+ },
22
+ }
23
+ })
package/esbuild.mjs ADDED
@@ -0,0 +1,25 @@
1
+ import esbuild from "esbuild"
2
+ import { sassPlugin } from "esbuild-sass-plugin"
3
+ import postcss from 'postcss'
4
+ import autoprefixer from 'autoprefixer'
5
+
6
+ esbuild
7
+ .build({
8
+ entryPoints: ["scss/vanilla-frontend.scss", "js/vanilla-frontend.js"],
9
+ entryNames: '[name]',
10
+ outbase: "./",
11
+ outdir: './bundles',
12
+ bundle: true,
13
+ metafile: true,
14
+ minify: true,
15
+ plugins: [
16
+ sassPlugin({
17
+ async transform(source) {
18
+ const { css } = await postcss([autoprefixer]).process(source)
19
+ return css
20
+ },
21
+ }),
22
+ ],
23
+ })
24
+ .then(() => console.log("⚡ Build complete! ⚡"))
25
+ .catch(() => process.exit(1))