wave-ui 3.18.0 → 3.19.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.
@@ -1,3 +1,4 @@
1
+ @use "sass:math";
1
2
  @use 'variables' as *;
2
3
 
3
4
  // All these CSS classes will not be generated if the $use-layout-classes is set to false.
@@ -67,7 +68,7 @@
67
68
  .bd0 {border: none;}
68
69
 
69
70
  @for $i from 1 through 6 {
70
- .bdrs#{$i} {border-radius: round($i * $base-increment);}
71
+ .bdrs#{$i} {border-radius: math.round($i * $base-increment);}
71
72
  }
72
73
  .bdrsr {border-radius: 999em;}
73
74
  .bdrsm {border-radius: 100%;}
@@ -78,13 +79,13 @@
78
79
  // ----------------------------------------------
79
80
  @for $i from -6 through -1 {
80
81
  .sh#{$i} {
81
- box-shadow: 0 0 (-1 * round($i * $base-increment)) rgba(#000, max(0.15 * divide(-$i, 2), 0.15)) inset;
82
+ box-shadow: 0 0 (-1 * math.round($i * $base-increment)) rgba(#000, max(0.15 * divide(-$i, 2), 0.15)) inset;
82
83
  }
83
84
  }
84
85
  @for $i from 1 through 6 {
85
86
  .sh#{$i} {
86
87
  box-shadow: 0 0 1px rgba(#000, 0.1),
87
- round($base-increment * divide($i, 4)) round($base-increment * divide($i, 4)) round($i * $base-increment) rgba(#000, max(0.15 * divide($i, 2), 0.15));
88
+ math.round($base-increment * divide($i, 4)) math.round($base-increment * divide($i, 4)) math.round($i * $base-increment) rgba(#000, max(0.15 * divide($i, 2), 0.15));
88
89
  }
89
90
  }
90
91
  .sh0 {box-shadow: none;}
@@ -94,7 +95,7 @@
94
95
  // ----------------------------------------------
95
96
  // Margin.
96
97
  @for $i from 0 through 12 {
97
- $number: round($i * $base-increment);
98
+ $number: math.round($i * $base-increment);
98
99
  .ma#{$i} {margin: $number;}
99
100
  @if ($i > 0) {.ma-#{$i} {margin: -$number;}}
100
101
  }
@@ -102,7 +103,7 @@
102
103
  .ma0 {margin: 0;}
103
104
 
104
105
  @for $i from 0 through 12 {
105
- $number: round($i * $base-increment);
106
+ $number: math.round($i * $base-increment);
106
107
  .mx#{$i} {margin-left: $number;margin-right: $number;}
107
108
  .my#{$i} {margin-top: $number;margin-bottom: $number;}
108
109
  @if ($i > 0) {
@@ -116,7 +117,7 @@
116
117
  .my0 {margin-top: 0;margin-bottom: 0;}
117
118
 
118
119
  @for $i from 0 through 12 {
119
- $number: round($i * $base-increment);
120
+ $number: math.round($i * $base-increment);
120
121
  .mt#{$i} {margin-top: $number;}
121
122
  .mr#{$i} {margin-right: $number;}
122
123
  .mb#{$i} {margin-bottom: $number;}
@@ -139,13 +140,13 @@
139
140
 
140
141
  // Padding.
141
142
  @for $i from 1 through 12 {
142
- $number: round($i * $base-increment);
143
+ $number: math.round($i * $base-increment);
143
144
  .pa#{$i} {padding: $number;}
144
145
  }
145
146
  .pa0 {padding: 0;}
146
147
 
147
148
  @for $i from 0 through 12 {
148
- $number: round($i * $base-increment);
149
+ $number: math.round($i * $base-increment);
149
150
  .px#{$i} {padding-left: $number;padding-right: $number;}
150
151
  .py#{$i} {padding-top: $number;padding-bottom: $number;}
151
152
  }
@@ -153,7 +154,7 @@
153
154
  .py0 {padding-top: 0;padding-bottom: 0;}
154
155
 
155
156
  @for $i from 0 through 12 {
156
- $number: round($i * $base-increment);
157
+ $number: math.round($i * $base-increment);
157
158
  .pt#{$i} {padding-top: $number;}
158
159
  .pr#{$i} {padding-right: $number;}
159
160
  .pb#{$i} {padding-bottom: $number;}
@@ -167,14 +168,14 @@
167
168
 
168
169
  // Sizes.
169
170
  // ----------------------------------------------
170
- // In all the sizes below, round(x / 2) * 2 to always have even numbers.
171
+ // In all the sizes below, math.round(x / 2) * 2 to always have even numbers.
171
172
  // Different heights with a mix of odd and even numbers will misalign
172
173
  // when vertically centering (vertical-align or align-items center).
173
- .size--xs {font-size: round(0.8 * $base-font-size);}
174
- .size--sm {font-size: round(0.9 * $base-font-size);}
175
- .size--md {font-size: round(1 * $base-font-size);}
176
- .size--lg {font-size: round(1.2 * $base-font-size);}
177
- .size--xl {font-size: round(1.4 * $base-font-size);}
174
+ .size--xs {font-size: math.round(0.8 * $base-font-size);}
175
+ .size--sm {font-size: math.round(0.9 * $base-font-size);}
176
+ .size--md {font-size: math.round(1 * $base-font-size);}
177
+ .size--lg {font-size: math.round(1.2 * $base-font-size);}
178
+ .size--xl {font-size: math.round(1.4 * $base-font-size);}
178
179
  // ----------------------------------------------
179
180
 
180
181
  // Grid system.
@@ -211,6 +212,6 @@
211
212
  }
212
213
 
213
214
  @for $i from 1 through 12 {
214
- .w-flex.gap#{$i}, .w-grid.gap#{$i} {gap: round($base-increment * $i);}
215
+ .w-flex.gap#{$i}, .w-grid.gap#{$i} {gap: math.round($base-increment * $i);}
215
216
  }
216
217
  .w-flex.gap0, .w-grid.gap0 {gap: 0;}
@@ -1,28 +1,29 @@
1
+ @use "sass:math";
1
2
  @use 'variables' as *;
2
3
 
3
4
  #{$css-scope} {
4
5
  .headline, .title1 {
5
- font-size: round(2.2 * $base-font-size);
6
+ font-size: math.round(2.2 * $base-font-size);
6
7
  font-weight: 100;
7
8
  }
8
9
 
9
10
  .title2 {
10
- font-size: round(1.7 * $base-font-size);
11
+ font-size: math.round(1.7 * $base-font-size);
11
12
  font-weight: 400;
12
13
  }
13
14
 
14
15
  .title3 {
15
- font-size: round(1.4 * $base-font-size);
16
+ font-size: math.round(1.4 * $base-font-size);
16
17
  font-weight: 400;
17
18
  }
18
19
 
19
20
  .title4 {
20
- font-size: round(1.25 * $base-font-size);
21
+ font-size: math.round(1.25 * $base-font-size);
21
22
  font-weight: 400;
22
23
  }
23
24
 
24
25
  .title5 {
25
- font-size: round(1.1 * $base-font-size);
26
+ font-size: math.round(1.1 * $base-font-size);
26
27
  font-weight: 600;
27
28
  }
28
29
 
@@ -32,7 +33,7 @@
32
33
  }
33
34
 
34
35
  .caption {
35
- font-size: round(0.85 * $base-font-size);
36
+ font-size: math.round(0.85 * $base-font-size);
36
37
  font-style: italic;
37
38
  color: $caption-color;
38
39
  }
@@ -44,7 +44,7 @@ $css-scope: '.w-app' !default; // Allows control on CSS rules priority.
44
44
  $use-layout-classes: true !default;
45
45
 
46
46
  $base-font-size: 14px !default; // Must be a px unit.
47
- $base-increment: round(divide($base-font-size, 4)) !default;
47
+ $base-increment: math.round(divide($base-font-size, 4)) !default;
48
48
  $layout-padding: $base-increment * 4 !default; // Applied on the .content-wrap tag.
49
49
  $border-radius: 4px !default;
50
50
  $border-color: color-mix(in srgb, var(--w-contrast-bg-color) 12%, transparent) !default;
@@ -54,9 +54,9 @@ $fast-transition-duration: 0.15s !default;
54
54
  $box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
55
55
  0 2px 2px 0 rgba(0, 0, 0, 0.15),
56
56
  0 1px 5px 0 rgba(0, 0, 0, 0.15) !default;
57
- $form-field-height: round(2 * $base-font-size) !default;
57
+ $form-field-height: math.round(2 * $base-font-size) !default;
58
58
  // Always an even number for better vertical alignment. (Used in checkbox, radio, switch)
59
- $small-form-el-size: round(divide(1.3 * $base-font-size, 2)) * 2 !default;
59
+ $small-form-el-size: math.round(divide(1.3 * $base-font-size, 2)) * 2 !default;
60
60
 
61
61
  // Detachable elements are: w-tooltip, w-menu, w-confirm.
62
62
  $detachable-bg-color: $base-bg-color !default;
@@ -1,4 +1,4 @@
1
- import { createApp, defineComponent } from 'vue'
1
+ import { h, render } from 'vue'
2
2
  import WNotificationManager from '../components/w-notification-manager.vue'
3
3
 
4
4
  export class NotificationManager {
@@ -56,24 +56,17 @@ export class NotificationManager {
56
56
  /**
57
57
  * Injects the w-notification-manager in the DOM programmatically so the user does not have to do it.
58
58
  *
59
- * @param {Object} wApp The DOM element where to mount the w-notification-manager.
60
- * @param {Object} components All the Wave UI components to provide to the w-notification-manager,
61
- * so it can also use them.
62
- * @param {Object} $waveui the injected reactive instance of the WaveUI class.
59
+ * @param {Object} app The Vue app instance.
63
60
  */
64
- export const injectNotifManagerInDOM = (wApp, components, $waveui) => {
61
+ export const injectNotifManagerInDOM = app => {
65
62
  const div = document.createElement('div')
66
- wApp.appendChild(div)
63
+ document.body.appendChild(div) // Attach to body before teleporting.
67
64
 
68
- const WNotifManager = createApp(defineComponent({
69
- ...WNotificationManager,
70
- inject: ['$waveui']
71
- })).provide('$waveui', $waveui)
65
+ // Create a VNode for WNotificationManager and assign app._context to inherit global components.
66
+ const vnode = h(WNotificationManager)
67
+ vnode.appContext = app._context // ! \ Attach app context to inherit global components & provide()!
72
68
 
73
- for (const id in components) {
74
- const component = components[id]
75
- WNotifManager.component(component.name, { ...component, inject: ['$waveui'] })
76
- }
77
- WNotifManager.mount(div)
78
- div.remove() // The WNotificationManager contains a teleport to .w-app.
69
+ render(vnode, div) // Render inside the main app scope.
70
+
71
+ div.remove() // The WNotificationManager component teleports itself inside `.w-app`.
79
72
  }