@natachah/vanilla-frontend 0.4.0 → 0.4.1

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.
@@ -28,109 +28,112 @@
28
28
  <doc-code data-type="css">
29
29
  :root {
30
30
 
31
- // Typography
32
- --font-size: 16px;
33
- --line-height: 1.5;
34
- --font-family: Arial;
35
- --font-weight: normal;
36
- --font-weight-light: 300;
37
- --font-weight-medium: 500;
38
- --font-weight-bold: 600;
39
-
40
- --font-size-h1: 2.25em; // 36px
41
- --font-size-h2: 2.00em; // 32px
42
- --font-size-h3: 1.75em; // 28px
43
- --font-size-h4: 1.50em; // 24px
44
- --font-size-h5: 1.25em; // 20px
45
- --font-size-h6: 1.125em; // 18px
46
- --font-size-large: 1.25em;
47
- --font-size-medium: 1.125em;
48
- --font-size-small: .875em;
49
-
50
- // Anchor
51
- --decoration: none;
52
-
53
- // Layouts
54
- --padding-inline: .75em;
55
- --padding-block: .5em;
56
-
57
- // Border
58
- --border-size: 1px;
59
- --border-style: solid;
60
- --border-radius: .25rem;
61
-
62
- // Outline (:focus)
63
- --outline-size: 3px;
64
- --outline-style: solid;
65
- --outline-offset: 0;
66
- //--outline-color: var(--color-primary); To override default behavior
67
-
68
- // Backdrop
69
- --backdrop-color: rgba(255, 255, 255, .5);
70
-
71
- // Hover (color-mix)
72
- --hover-color: black;
73
- --hover-percent: 5%;
74
-
75
- // Active (color-mix)
76
- --active-color: black;
77
- --active-percent: 10%;
78
-
79
- // Focus (color-mix)
80
- --focus-color: currentColor;
81
- --focus-percent: 50%;
82
-
83
- // Disabled
84
- --disabled-opacity: 50%;
85
-
86
- // Colors
87
- --color-body: white;
88
- --color-font: black;
89
- --color-primary: #B790E5;
90
- --color-error: #DC3030;
91
- --color-success: #008A00;
92
- --color-warning: #FFA500;
93
-
94
- // Contrasts
95
- --color-warning-contrast: black;
96
-
97
- // Form
98
- --form-border-color: currentColor;
99
- --form-active-background: color-mix(in srgb, var(--form-background, transparent), var(--active-color, currentColor) 40%);
100
-
101
- // Icons
102
- --icon-external: url('data:image/svg+xml,...');
103
- --icon-date: url('data:image/svg+xml,...');
104
- --icon-time: url('data:image/svg+xml,...');
105
- --icon-file: url('data:image/svg+xml,...');
106
- --icon-select: url('data:image/svg+xml,...');
107
- --icon-radio: url('data:image/svg+xml,...');
108
- --icon-check: url('data:image/svg+xml,...');
109
- --icon-switch: var(--icon-radio);
110
-
111
- // Layout
112
- --layout-width: 1280px;
113
- --layout-gap-block: 1rem;
114
- --layout-gap-inline: 1rem;
115
- --layout-columns: 1;
116
-
117
- @media (min-width: 720px) {
118
- --layout-columns: 6;
119
- --layout-gap-block: 1rem;
120
- --layout-gap-inline: 1rem;
121
- }
122
-
123
- @media (min-width: 1024px) {
124
- --layout-columns: 12;
125
- --layout-gap-block: 2rem;
126
- --layout-gap-inline: 2rem;
127
- }
128
-
129
- @media (min-width: 1440px) {
130
- --layout-columns: 12;
131
- --layout-gap-block: 4rem;
132
- --layout-gap-inline: 2rem;
133
- }
31
+ // Typography
32
+ --font-size: 16px;
33
+ --line-height: 1.5;
34
+ --font-family: Arial;
35
+ --font-weight: normal;
36
+ --font-weight-light: 300;
37
+ --font-weight-medium: 500;
38
+ --font-weight-bold: 600;
39
+
40
+ --font-size-h1: 2.25em; // 36px
41
+ --font-size-h2: 2.00em; // 32px
42
+ --font-size-h3: 1.75em; // 28px
43
+ --font-size-h4: 1.50em; // 24px
44
+ --font-size-h5: 1.25em; // 20px
45
+ --font-size-h6: 1.125em; // 18px
46
+ --font-size-large: 1.25em;
47
+ --font-size-medium: 1.125em;
48
+ --font-size-small: .875em;
49
+
50
+ --word-spacing: normal;
51
+ --letter-spacing: normal;
52
+
53
+ // Anchor
54
+ --decoration: none;
55
+
56
+ // Layouts
57
+ --padding-inline: .75em;
58
+ --padding-block: .5em;
59
+
60
+ // Border
61
+ --border-size: 1px;
62
+ --border-style: solid;
63
+ --border-radius: .25rem;
64
+
65
+ // Outline (:focus)
66
+ --outline-size: 3px;
67
+ --outline-style: solid;
68
+ --outline-offset: 0;
69
+ //--outline-color: var(--color-primary); To override default behavior
70
+
71
+ // Backdrop
72
+ --backdrop-color: rgba(255, 255, 255, .5);
73
+
74
+ // Hover (color-mix)
75
+ --hover-color: black;
76
+ --hover-percent: 5%;
77
+
78
+ // Active (color-mix)
79
+ --active-color: black;
80
+ --active-percent: 10%;
81
+
82
+ // Focus (color-mix)
83
+ --focus-color: currentColor;
84
+ --focus-percent: 50%;
85
+
86
+ // Disabled
87
+ --disabled-opacity: 50%;
88
+
89
+ // Colors
90
+ --color-body: white;
91
+ --color-font: black;
92
+ --color-primary: #B790E5;
93
+ --color-error: #DC3030;
94
+ --color-success: #008A00;
95
+ --color-warning: #FFA500;
96
+
97
+ // Contrasts
98
+ --color-warning-contrast: black;
99
+
100
+ // Form
101
+ --form-border-color: currentColor;
102
+ --form-active-background: color-mix(in srgb, var(--form-background, transparent), var(--active-color, currentColor) 40%);
103
+
104
+ // Icons
105
+ --icon-external: url('data:image/svg+xml,...');
106
+ --icon-date: url('data:image/svg+xml,...');
107
+ --icon-time: url('data:image/svg+xml,...');
108
+ --icon-file: url('data:image/svg+xml,...');
109
+ --icon-select: url('data:image/svg+xml,...');
110
+ --icon-radio: url('data:image/svg+xml,...');
111
+ --icon-check: url('data:image/svg+xml,...');
112
+ --icon-switch: var(--icon-radio);
113
+
114
+ // Layout
115
+ --layout-width: 1280px;
116
+ --layout-gap-block: 1rem;
117
+ --layout-gap-inline: 1rem;
118
+ --layout-columns: 1;
119
+
120
+ @media (min-width: 720px) {
121
+ --layout-columns: 6;
122
+ --layout-gap-block: 1rem;
123
+ --layout-gap-inline: 1rem;
124
+ }
125
+
126
+ @media (min-width: 1024px) {
127
+ --layout-columns: 12;
128
+ --layout-gap-block: 2rem;
129
+ --layout-gap-inline: 2rem;
130
+ }
131
+
132
+ @media (min-width: 1440px) {
133
+ --layout-columns: 12;
134
+ --layout-gap-block: 4rem;
135
+ --layout-gap-inline: 2rem;
136
+ }
134
137
 
135
138
  }
136
139
  </doc-code>
@@ -142,20 +145,20 @@
142
145
  // This is the light theme (or if there is none)
143
146
  html[data-theme=light],
144
147
  html:not([data-theme]) {
145
- --color-body: white;
146
- --color-font: black;
148
+ --color-body: white;
149
+ --color-font: black;
147
150
  }
148
151
 
149
152
  // This is for the dark theme
150
153
  html[data-theme=dark] {
151
- --color-body: black;
152
- --color-font: white;
154
+ --color-body: black;
155
+ --color-font: white;
153
156
  }
154
157
 
155
158
  // This is for the dark theme
156
159
  html[data-theme=my-custom-theme] {
157
- --color-body: white;
158
- --color-font: orange;
160
+ --color-body: white;
161
+ --color-font: orange;
159
162
  }
160
163
  </doc-code>
161
164
 
@@ -18,7 +18,7 @@ class DocLayout extends HTMLElement {
18
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
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
20
  </svg>
21
- 0.4.0v
21
+ 0.4.1v
22
22
  </span>
23
23
  </li>
24
24
  <li>
package/esbuild.mjs CHANGED
@@ -5,7 +5,7 @@ import autoprefixer from 'autoprefixer'
5
5
 
6
6
  esbuild
7
7
  .build({
8
- entryPoints: ["scss/vanilla-frontend.scss"],
8
+ entryPoints: ["scss/vanilla-frontend.scss", "js/vanilla-frontend.js"],
9
9
  entryNames: '[name]',
10
10
  outbase: "./",
11
11
  outdir: './bundles',
@@ -0,0 +1,108 @@
1
+ // If you need to create some component, you can use this
2
+ import BaseComponent from "./utilities/_base-component"
3
+ import ErrorMessage from "./utilities/_error"
4
+ import Cookie from "./utilities/_cookie"
5
+
6
+ // Here the helpers
7
+ import FormHelper from "./utilities/_form-helper"
8
+
9
+ // Here the components
10
+ import Autofill from "./_autofill"
11
+ import CheckAll from "./_check-all"
12
+ import Comfort from "./_comfort"
13
+ import Consent from "./_consent"
14
+ import Dialog from "./_dialog"
15
+ import Dropdown from "./_dropdown"
16
+ import Drawer from "./_drawer"
17
+ import Scroll from "./_scroll"
18
+ import Slider from "./_slider"
19
+ import Sortable from "./_sortable"
20
+ import Toggle from "./_toggle"
21
+ import Tree from "./_tree"
22
+
23
+ const dialogs = document.querySelectorAll('.demo-dialog')
24
+ if (dialogs) dialogs.forEach(dialog => new Dialog(dialog))
25
+
26
+ const demoDialogFormJS = document.getElementById('demoDialogFormJs')
27
+ if (demoDialogFormJS) {
28
+ demoDialogFormJS.addEventListener('dialog:submited', (e) => {
29
+ const value = e.detail.form.querySelector('input').value
30
+ document.getElementById('favorite').innerText = value
31
+ })
32
+ }
33
+
34
+ const dropdowns = document.querySelectorAll('.demo-dropdown')
35
+ if (dropdowns) dropdowns.forEach(dropdown => new Dropdown(dropdown))
36
+
37
+ //if (sliders) sliders.forEach(slider => new Slider(slider))
38
+ const sliderFull = document.getElementById('sliderFull')
39
+ if (sliderFull) new Slider(sliderFull, {
40
+ //behavior: 'instant',
41
+ loop: true,
42
+ //autoplay: 1500
43
+ })
44
+
45
+ const sliderFade = document.getElementById('sliderFade')
46
+ if (sliderFade) {
47
+ const mySliderObj = new Slider(sliderFade, {
48
+ behavior: 'instant',
49
+ loop: true,
50
+ autoplay: 4000
51
+ })
52
+ sliderFade.addEventListener('slider:changed', (ev) => {
53
+ const src = mySliderObj._slides[ev.detail.previous].querySelector('img').getAttribute('src')
54
+ sliderFade.style.backgroundImage = `url("${src}")`
55
+ })
56
+ }
57
+
58
+ const autofills = document.querySelectorAll('.demo-autofill')
59
+ if (autofills) autofills.forEach(autofill => new Autofill(autofill))
60
+
61
+ const checkboxAll = document.getElementById('demoCheckboxAll')
62
+ if (checkboxAll) new CheckAll(checkboxAll)
63
+
64
+ const demoConfort = new Comfort('demo-confort')
65
+
66
+ if (document.getElementById('resetConfort')) {
67
+ document.getElementById('resetConfort').addEventListener('click', () => {
68
+ demoConfort.reset()
69
+ })
70
+ }
71
+
72
+ if (document.getElementById('demoCookies')) {
73
+ new Consent('demo-consent', 'demoCookies', 'demoCookiesPreferences')
74
+ }
75
+
76
+ const passwordButton = document.getElementById('demoPassword')
77
+ if (passwordButton) passwordButton.addEventListener('click', () => FormHelper.togglePassword(passwordButton))
78
+ const demoToggleFormButton = document.getElementById('demoToggleFormButton')
79
+ const demoToggleFormContent = document.getElementById('demoToggleFormContent')
80
+
81
+ if (demoToggleFormButton && demoToggleFormContent) {
82
+ const fields = demoToggleFormContent.querySelectorAll('input,select,textarea')
83
+ new Toggle(demoToggleFormButton)
84
+ demoToggleFormButton.addEventListener('toggle:changed', (e) => {
85
+ FormHelper.toggleAttributes(fields, !demoToggleFormContent.hidden, {
86
+ reset: true,
87
+ disabled: true,
88
+ required: ['test'],
89
+ unchanged: ['test']
90
+ })
91
+ })
92
+ }
93
+
94
+ const scrollSpy = document.getElementById('demoScrollSpy')
95
+ if (scrollSpy) {
96
+ new Scroll(scrollSpy, {
97
+ navigation: 'demoScrollNav'
98
+ })
99
+ }
100
+
101
+ const sortables = document.querySelectorAll('.demo-sortable')
102
+ if (sortables) sortables.forEach(sortable => new Sortable(sortable))
103
+
104
+ const toggles = document.querySelectorAll('.demo-toggle')
105
+ if (toggles) toggles.forEach(toggle => new Toggle(toggle))
106
+
107
+ const trees = document.querySelectorAll('.demo-tree')
108
+ if (trees) trees.forEach(tree => new Tree(tree))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natachah/vanilla-frontend",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "A vanilla frontend framework",
6
6
  "keywords": [
@@ -111,6 +111,8 @@ body {
111
111
  line-height: var(--line-height, 1.5);
112
112
  font-family: var(--font-family, default);
113
113
  font-weight: var(--font-weight, normal);
114
+ word-spacing: var(--word-spacing, normal);
115
+ letter-spacing: var(--letter-spacing, normal);
114
116
 
115
117
  // Define color
116
118
  color: var(--color-font, black);
@@ -30,6 +30,9 @@
30
30
  --font-size-medium: 1.125em;
31
31
  --font-size-small: .875em;
32
32
 
33
+ --word-spacing: normal;
34
+ --letter-spacing: normal;
35
+
33
36
  // Anchor
34
37
  --decoration: none;
35
38
 
Binary file