@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,324 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Documentations: Layout > Typography</title>
8
+ </head>
9
+
10
+ <body data-preload>
11
+ <doc-layout>
12
+
13
+ <h1>Typography</h1>
14
+
15
+ <p>All website have some typographic elements, here some basic styling.</p>
16
+
17
+ <p>To use it, import this file:</p>
18
+
19
+ <doc-code data-type="scss">
20
+ @import '@natachah/vanilla-frontend/scss/layout/_typography'
21
+ </doc-code>
22
+
23
+ <h2>Heading</h2>
24
+
25
+ <p>The headings use the default <code>&lt;h*&gt;</code> tags.</p>
26
+
27
+ <doc-demo>
28
+ <h1>Heading 1</h1>
29
+ <h2>Heading 2</h2>
30
+ <h3>Heading 3</h3>
31
+ <h4>Heading 4</h4>
32
+ <h5>Heading 5</h5>
33
+ <h6>Heading 6</h6>
34
+ </doc-demo>
35
+
36
+ <p>You can also group them inside a <code>&lt;hgroup&gt;</code> tag.</p>
37
+
38
+ <doc-demo>
39
+ <hgroup>
40
+ <h2>Frankenstein</h2>
41
+ <p>Or the modern Prometheus</p>
42
+ </hgroup>
43
+ </doc-demo>
44
+
45
+ <div class="code-group">
46
+ <div role="tablist">
47
+ <button role="tab" aria-controls="html">HTML</button>
48
+ <button role="tab" aria-controls="css">CSS</button>
49
+ </div>
50
+ <doc-code id="html" data-type="html" role="tabpanel">
51
+ <h1>Heading 1</h1>
52
+ <h2>Heading 2</h2>
53
+ <h3>Heading 3</h3>
54
+ <h4>Heading 4</h4>
55
+ <h5>Heading 5</h5>
56
+ <h6>Heading 6</h6>
57
+
58
+ <hgroup>
59
+ <h2>Frankenstein</h2>
60
+ <p>Or the modern Prometheus</p>
61
+ </hgroup>
62
+ </doc-code>
63
+ <doc-code id="css" data-type="css" role="tabpanel">
64
+ --font-size-h*
65
+ --heading-font-weight
66
+ --heading-line-height
67
+ --heading-color
68
+ </doc-code>
69
+ </div>
70
+
71
+ <h2>Paragraph</h2>
72
+
73
+ <p>The paragraph use the default <code>&lt;p&gt;</code> tag.</p>
74
+
75
+ <p>As each website is uniq, there is no default <code>margin-block</code> for the paragraph.</p>
76
+
77
+ <doc-demo>
78
+ <p>Paragraph ! Lorem ipsum sit amet consectetur adipisicing elit. Quos consequatur omnis velit saepe suscipit? Ab ut assumenda nesciunt, veritatis beatae temporibus facilis quis earum vero officia explicabo veniam tempore voluptatibus?</p>
79
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Id rem placeat suscipit a consequatur ipsam nam quis eveniet vel nobis sunt praesentium explicabo alias obcaecati, perferendis nostrum ut veritatis mollitia.</p>
80
+ <p>Accusamus sit saepe laborum, veniam doloribus aliquid, commodi odio corrupti, repellendus pariatur modi. Saepe recusandae, natus fuga quidem ab iusto beatae molestias tempore rem esse aspernatur aut quasi deserunt atque.</p>
81
+ </doc-demo>
82
+
83
+ <h2>Anchor</h2>
84
+
85
+ <p>Use the default <code>&lt;a&gt;</code> tag to create links.</p>
86
+
87
+ <p>You can add the <code>aria-current</code> or <code>aria-selected</code> attribute to make the link with an active state.</p>
88
+
89
+ <p>By default if there is no <code>href</code> attribute, it will render as disabled state.</p>
90
+
91
+ <doc-demo>
92
+ <a href="#">Anchor</a>
93
+ <a href="#" aria-current="page">Active</a>
94
+ <a>Disabled</a>
95
+ </doc-demo>
96
+
97
+ <div class="code-group">
98
+ <div role="tablist">
99
+ <button role="tab" aria-controls="html">HTML</button>
100
+ <button role="tab" aria-controls="css">CSS</button>
101
+ </div>
102
+ <doc-code id="html" data-type="html" role="tabpanel">
103
+ <a href="#">Anchor</a>
104
+ <a href="#" aria-current="page">Active</a>
105
+ <a>Disabled</a>
106
+ </doc-code>
107
+ <doc-code id="css" data-type="css" role="tabpanel">
108
+ --anchor-decoration
109
+ --anchor-color
110
+ --anchor-hover-color
111
+ --anchor-active-color
112
+ --anchor-disabled-opacity
113
+ </doc-code>
114
+ </div>
115
+
116
+ <h2>Inline</h2>
117
+
118
+ <doc-demo>
119
+ <div class="grid demo-inline">
120
+ <p><abbr title="Abbreviation">Abbr.</abbr></p>
121
+ <p><small>Small</small></p>
122
+ <p><q>An inline quote</q></p>
123
+ <p><b>Bold</b></p>
124
+ <p><strong>Strong</strong></p>
125
+ <p><em>Emphasis</em></p>
126
+ <p><i>Idiomatic</i></p>
127
+ <p><s>Strikethrough</s></p>
128
+ <p><u>Underline</u></p>
129
+ <p><span>Text <sub>Sub</sub></span></p>
130
+ <p><span>Text <sup>Sup</sup></span></p>
131
+ <p><cite>Citation</cite></p>
132
+ <p><mark>Highlight</mark></p>
133
+ <p><kbd>Ctrl + S</kbd></p>
134
+ <p><code>&lt;Code&gt;</code></p>
135
+ <p><ins>Inserted</ins></p>
136
+ <p><del>Deleted</del></p>
137
+ </div>
138
+ </doc-demo>
139
+
140
+ <div class="code-group">
141
+ <div role="tablist">
142
+ <button role="tab" aria-controls="html">HTML</button>
143
+ <button role="tab" aria-controls="css">CSS</button>
144
+ </div>
145
+ <doc-code id="html" data-type="html" role="tabpanel">
146
+ <p><abbr title="Abbreviation">Abbr.</abbr></p>
147
+ <p><small>Small</small></p>
148
+ <p><q>An inline quote</q></p>
149
+ <p><b>Bold</b></p>
150
+ <p><b>b</b></p>
151
+ <p><em>Emphasis</em></p>
152
+ <p><i>Idiomatic</i></p>
153
+ <p><s>Strikethrough</s></p>
154
+ <p><u>Underline</u></p>
155
+ <p><span>Text <sub>Sub</sub></span></p>
156
+ <p><span>Text <sup>Sup</sup></span></p>
157
+ <p><cite>Citation</cite></p>
158
+ <p><mark>Highlight</mark></p>
159
+ <p><kbd>Ctrl + S</kbd></p>
160
+ <p><code>&lt;Code&gt;</code></p>
161
+ <p><ins>Inserted</ins></p>
162
+ <p><del>Deleted</del></p>
163
+ </doc-code>
164
+ <doc-code id="css" data-type="css" role="tabpanel">
165
+ --mark-padding-block
166
+ --mark-padding-inline
167
+ --mark-background
168
+ --kbd-padding-block
169
+ --kbd-padding-inline
170
+ --kbd-font-family
171
+ --kbd-color
172
+ --kbd-background
173
+ --kbd-border-radius
174
+ --code-padding-block
175
+ --code-padding-inline
176
+ --code-font-family
177
+ --code-color
178
+ --code-background
179
+ --code-border-radius
180
+ </doc-code>
181
+ </div>
182
+
183
+ <h2>Blockquote</h2>
184
+
185
+ <p>The quotes use the default <code>&lt;blockquote&gt;</code> tag.
186
+ Because the blockquote is usully design per website, their is no custom properties for them.</p>
187
+
188
+ <doc-demo>
189
+ <blockquote>
190
+ <p>
191
+ “It's only after we've lost everything that we're free to do anything.”
192
+ </p>
193
+ <footer>
194
+ - Chuck Palahniuk, <cite>Fight Club</cite>
195
+ </footer>
196
+ </blockquote>
197
+ </doc-demo>
198
+
199
+ <doc-code>
200
+ <blockquote>
201
+ It was a bright cold day in April, and the clocks were striking thirteen.
202
+ </blockquote>
203
+
204
+ <blockquote>
205
+ <p>
206
+ “It's only after we've lost everything that we're free to do anything.”
207
+ </p>
208
+ <footer>
209
+ - Chuck Palahniuk, <cite>Fight Club</cite>
210
+ </footer>
211
+ </blockquote>
212
+ </doc-code>
213
+
214
+ <h2>Code</h2>
215
+ <p>Use the <code>&lt;pre&gt;</code> tag with a <code>&lt;code&gt;</code> tag inside.
216
+ The design of a block of code is not the same as the inline element.</p>
217
+
218
+ <doc-demo>
219
+ <pre><code><!--
220
+ -->&lt;p&gt;Sample text here...&lt;/p&gt;<br><!--
221
+ -->&lt;p&gt;And another line of sample text here...&lt;/p&gt;</code></pre>
222
+ </doc-demo>
223
+
224
+ <div class="code-group">
225
+ <div role="tablist">
226
+ <button role="tab" aria-controls="html">HTML</button>
227
+ <button role="tab" aria-controls="css">CSS</button>
228
+ </div>
229
+ <doc-code id="html" data-type="html" role="tabpanel">
230
+ <pre><code><!--
231
+ -->&lt;p&gt;Sample text here...&lt;/p&gt;<br><!--
232
+ -->&lt;p&gt;And another line of sample text here...&lt;/p&gt;</code></pre>
233
+ </doc-code>
234
+ <doc-code id="css" data-type="css" role="tabpanel">
235
+ --pre-padding-block
236
+ --pre-padding-inline
237
+ --pre-font-family
238
+ --pre-color
239
+ --pre-background
240
+ --pre-border-radius
241
+ </doc-code>
242
+ </div>
243
+
244
+ <h2>List</h2>
245
+ <p>The lists use the default <code>&lt;ul&gt;</code> <code>&lt;ol&gt;</code> and <code>&lt;dl&gt;</code> tags.
246
+ Because the lists are usully design per website/situation, their is not too much custom properties for them.</p>
247
+
248
+ <doc-demo>
249
+ <ul>
250
+ <li>Lorem ipsum dolor sit. Lorem ipsum dolor sit amet consectetur adipisicing elit. Officiis dolores eligendi assumenda eaque sint nemo non laudantium quidem, voluptate ipsum sapiente accusantium mollitia vitae quia tenetur cupiditate voluptatibus maxime fugiat?</li>
251
+ <li>Velit ipsam blanditiis ducimus?</li>
252
+ <li>Porro impedit provident at!</li>
253
+ </ul>
254
+ <ol>
255
+ <li>Lorem, ipsum dolor.</li>
256
+ <li>Obcaecati, a impedit!</li>
257
+ <li>Quo, eligendi veritatis?</li>
258
+ </ol>
259
+ <dl>
260
+ <dt>Coffee</dt>
261
+ <dd>Black hot drink</dd>
262
+ <dt>Milk</dt>
263
+ <dd>White cold drink</dd>
264
+ </dl>
265
+ </doc-demo>
266
+
267
+ <div class="code-group">
268
+ <div role="tablist">
269
+ <button role="tab" aria-controls="html">HTML</button>
270
+ <button role="tab" aria-controls="css">CSS</button>
271
+ </div>
272
+ <doc-code id="html" data-type="html" role="tabpanel">
273
+ <ul>
274
+ <li>Coffee</li>
275
+ <li>Milk</li>
276
+ <li>...</li>
277
+ </ul>
278
+
279
+ <ol>
280
+ <li>Make coffee</li>
281
+ <li>Add the milk</li>
282
+ <li>Drink it !</li>
283
+ </ol>
284
+
285
+ <dl>
286
+ <dt>Coffee</dt>
287
+ <dd>Black hot drink</dd>
288
+ <dt>Milk</dt>
289
+ <dd>White cold drink</dd>
290
+ </dl>
291
+ </doc-code>
292
+ <doc-code id="css" data-type="css" role="tabpanel">
293
+ --list-bullet
294
+ --list-offset
295
+ </doc-code>
296
+ </div>
297
+
298
+ <h2>Line</h2>
299
+ <p>Use the default <code>&lt;hr&gt;</code> tag render a horizontal line.</p>
300
+
301
+ <doc-demo>
302
+ <hr>
303
+ </doc-demo>
304
+
305
+ <div class="code-group">
306
+ <div role="tablist">
307
+ <button role="tab" aria-controls="html">HTML</button>
308
+ <button role="tab" aria-controls="css">CSS</button>
309
+ </div>
310
+ <doc-code id="html" data-type="html" role="tabpanel">
311
+ <hr>
312
+ </doc-code>
313
+ <doc-code id="css" data-type="css" role="tabpanel">
314
+ --hr-border-size
315
+ --hr-border-style
316
+ --hr-border-color
317
+ </doc-code>
318
+ </div>
319
+
320
+ </doc-layout>
321
+ <script type="module" src="/main.js"></script>
322
+ </body>
323
+
324
+ </html>
@@ -0,0 +1,112 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Documentations: Quick start > Naming conventions</title>
8
+ </head>
9
+
10
+ <body data-preload>
11
+ <doc-layout>
12
+
13
+ <h1>Naming conventions</h1>
14
+
15
+ <p>Because all project should have some little rules...</p>
16
+
17
+ <h2>Classless</h2>
18
+
19
+ <p>The framework try to be classless as much as possible, this are the exeptions:</p>
20
+
21
+ <ul>
22
+ <li>.card</li>
23
+ <li>.dropdown</li>
24
+ <li>.grid</li>
25
+ <li>.flex-grid</li>
26
+ <li>.slider</li>
27
+ <li>.group</li>
28
+ <li>.list</li>
29
+ </ul>
30
+
31
+ <p>And for variations:</p>
32
+
33
+ <ul>
34
+ <li>.outline</li>
35
+ <li>.COLORNAME (e.g.: .primary)</li>
36
+ </ul>
37
+
38
+ <blockquote>
39
+ <p>For good practice avoid as much it's possible classes !</p>
40
+ </blockquote>
41
+
42
+ <h2>CSS and SCSS</h2>
43
+
44
+ <ul>
45
+ <li>The custom properties and variable must be <b>kebab-case</b></li>
46
+ <li>Private properties start with an <b>underscore</b></li>
47
+ <li>The classes must be <b>kebab-case</b></li>
48
+ <li>The IDs must be <b>camelCase</b></li>
49
+ <li>Use comment like in <a href="http://sassdoc.com/" target="_blank">SassDoc</a></li>
50
+ </ul>
51
+
52
+ <doc-code data-type="css">
53
+ :root {
54
+ --global-property: red;
55
+ }
56
+
57
+ .my-class {
58
+ background-color: var(--global-property)
59
+ }
60
+
61
+ #myId {
62
+ --_private-property: green;
63
+ background-color: var(--_private-property);
64
+ }
65
+ </doc-code>
66
+
67
+ <blockquote class="warning">
68
+ <p>Limit the number of <b>custom properties defined</b>, using too many of them can impact performance. Avoid unnecessary complexity.</p>
69
+ </blockquote>
70
+
71
+ <doc-code data-type="scss">
72
+ /// Description of the mixin
73
+ ///
74
+ /// @example something(red) // color: red
75
+ /// @link http://sassdoc.com/annotations/
76
+ /// @require {mixin} something
77
+ /// @param {name} $name - The description
78
+ /// @access public
79
+ ///
80
+ @mixin something($name){
81
+ color: $name
82
+ }
83
+ </doc-code>
84
+
85
+ <h2>Javascript</h2>
86
+
87
+ <ul>
88
+ <li>The variable and method name must be <b>camelCase</b></li>
89
+ <li>Use comment like in <a href="https://jsdoc.app/" target="_blank">JSDoc</a></li>
90
+ <li>Use single quote</li>
91
+ <li>Avoid semicolon</li>
92
+ </ul>
93
+
94
+ <doc-code data-type="js">
95
+ /**
96
+ * Explaination of the method
97
+ *
98
+ * @param {number} length - The length of the rectangle
99
+ * @param {number} width - The width of the rectangle
100
+ * @returns {number} - The area of the rectangle
101
+ */
102
+ function calculate(length, width) {
103
+ const myVariable = 'nothing'
104
+ return length * height
105
+ }
106
+ </doc-code>
107
+
108
+ </doc-layout>
109
+ <script type="module" src="/main.js"></script>
110
+ </body>
111
+
112
+ </html>
@@ -0,0 +1,187 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Documentations: Quick start > Customization</title>
8
+ </head>
9
+
10
+ <body data-preload>
11
+ <doc-layout>
12
+
13
+ <h1>Customization</h1>
14
+
15
+ <p>The framework make you able to customize almost everything. But keep in mind that most of the work will be to create you own components per website !</p>
16
+
17
+ <h2>CSS custom properties</h2>
18
+
19
+ <p>There is a bunch of default CSS custom properties, and (almost) each component have their own properties if needed.</p>
20
+
21
+ <h3>Root</h3>
22
+
23
+ <p>In the <code>:root</code> set the default CSS properties that are global to all your website.</p>
24
+ <p>You also can split in multiple files, e.g.: <code>root.scss</code> and <code>color.scss</code></p>
25
+
26
+ <p>You can use the default file <code>@natachah/vanilla-frontend/scss/variables/_root.scss</code>, or copy this code in your own file:</p>
27
+
28
+ <doc-code data-type="scss">
29
+ :root {
30
+
31
+ // Typography
32
+ --font-size: 16px;
33
+ --line-height: 1.5;
34
+ --font-family: Arial;
35
+ --font-weight: normal;
36
+
37
+ --font-size-h1: 2.25em; // 36px
38
+ --font-size-h2: 2.00em; // 32px
39
+ --font-size-h3: 1.75em; // 28px
40
+ --font-size-h4: 1.50em; // 24px
41
+ --font-size-h5: 1.25em; // 20px
42
+ --font-size-h6: 1.125em; // 18px
43
+ --font-size-large: 1.125em; // 18px
44
+ --font-size-small: .875em; // 14px
45
+
46
+ // Anchor
47
+ --decoration: none;
48
+
49
+ // Layouts
50
+ --padding-inline: .75em;
51
+ --padding-block: .5em;
52
+
53
+ // Border
54
+ --border-size: 1px;
55
+ --border-style: solid;
56
+ --border-radius: .25rem;
57
+
58
+ // Focus (outline)
59
+ --focus-size: 3px;
60
+ --focus-style: solid;
61
+ --focus-offset: 0;
62
+ --focus-opacity: 50%;
63
+
64
+ // Hover (color-mix)
65
+ --hover-color: black;
66
+ --hover-percent: 5%;
67
+
68
+ // Active (color-mix)
69
+ --active-color: black;
70
+ --active-percent: 10%;
71
+
72
+ // Disabled
73
+ --disabled-opacity: 50%;
74
+
75
+ // Colors
76
+ --color-body: white;
77
+ --color-font: black;
78
+ --color-primary: #B790E5;
79
+ --color-error: #DC3030;
80
+ --color-success: #008A00;
81
+ --color-warning: #FFA500;
82
+
83
+ // Contrasts
84
+ --color-warning-contrast: black;
85
+
86
+ }
87
+ </doc-code>
88
+
89
+ <h3>Themes</h3>
90
+ <p>You can define some CSS properties per theme with the attribute <code>[data-theme=MYTHEME]</code>:</p>
91
+
92
+ <doc-code data-type="scss">
93
+ // This is the light theme (or if there is none)
94
+ html[data-theme=light],
95
+ html:not([data-theme]) {
96
+ --color-body: white;
97
+ --color-font: black;
98
+ }
99
+
100
+ // This is for the dark theme
101
+ html[data-theme=dark] {
102
+ --color-body: black;
103
+ --color-font: white;
104
+ }
105
+
106
+ // This is for the dark theme
107
+ html[data-theme=my-custom-theme] {
108
+ --color-body: white;
109
+ --color-font: orange;
110
+ }
111
+ </doc-code>
112
+
113
+ <blockquote>
114
+ <p>In best practive it will be better to have a file per theme.</p>
115
+ </blockquote>
116
+
117
+ <h2>SCSS setting</h2>
118
+
119
+ <p>A few settings are set via the SCSS, they are for variations and for default style as:</p>
120
+
121
+ <ul>
122
+ <li><code>$color-variations</code> enable color variation for components</li>
123
+ <li><code>$outline-variations</code>> enable outline variation for components</li>
124
+ <li><code>$default-item-properties</code>> define the default properties to use for items <em>(see mixins)</em></li>
125
+ </ul>
126
+
127
+ <p>You can use the default file <code>@natachah/vanilla-frontend/scss/variables/_setting.scss</code>, or copy this code in your own file:</p>
128
+
129
+ <doc-code data-type="scss">
130
+ /// Define the default list of colors available
131
+ ///
132
+ /// @access public
133
+ ///
134
+ $colors: (
135
+ primary,
136
+ success,
137
+ error,
138
+ warning
139
+ );
140
+
141
+ /// Define the components that have some color variations
142
+ ///
143
+ /// @example button: (error) // <button class="error"></button>
144
+ /// @access public
145
+ ///
146
+ $color-variations: (
147
+ badge: $colors,
148
+ button: $colors,
149
+ card: $colors,
150
+ disclosure: $colors,
151
+ list: $colors
152
+ );
153
+
154
+ /// Define the components that have an outline variation
155
+ ///
156
+ /// @example button // <button class="outline"></button>
157
+ /// @access public
158
+ ///
159
+ $outline-variations: (
160
+ badge,
161
+ button,
162
+ card,
163
+ disclosure,
164
+ list
165
+ );
166
+
167
+ /// Define the default properties for item
168
+ ///
169
+ /// @access public
170
+ ///
171
+ $default-item-properties: (
172
+ color: var(--color-font),
173
+ background: transparent,
174
+ border-size: var(--border-size),
175
+ border-style: var(--border-style),
176
+ border-color: transparent,
177
+ border-radius: var(--border-radius),
178
+ padding-inline: var(--padding-inline),
179
+ padding-block: var(--padding-block)
180
+ );
181
+ </doc-code>
182
+
183
+ </doc-layout>
184
+ <script type="module" src="/main.js"></script>
185
+ </body>
186
+
187
+ </html>