@exakt/ui 0.0.42 → 0.0.44

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/dist/module.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
3
  interface ModuleOptions {
4
+ hue: number;
4
5
  colors: {
5
6
  primary?: string;
6
7
  dark?: string;
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "exakt-ui",
3
3
  "configKey": "exakt",
4
- "version": "0.0.42"
4
+ "version": "0.0.44"
5
5
  }
package/dist/module.mjs CHANGED
@@ -2,6 +2,7 @@ import { defineNuxtModule, createResolver, addPlugin, extendViteConfig, addImpor
2
2
  import fs from 'fs';
3
3
 
4
4
  const defaults = {
5
+ hue: 9,
5
6
  colors: {
6
7
  primary: "#008dff",
7
8
  dark: "#212121",
@@ -38,7 +39,7 @@ const module = defineNuxtModule({
38
39
  );
39
40
  let SCSSvariables = "";
40
41
  let CSSvariables = ":root{";
41
- for (const [key, value] of Object.entries(options.colors)) {
42
+ for (const [key, value] of [["hue", options.hue + "deg"], ...Object.entries(options.colors)]) {
42
43
  SCSSvariables += `$root-${key}: ${value}; `;
43
44
  }
44
45
  for (const [key, value] of Object.entries(options.breakpoints)) {
@@ -14,7 +14,7 @@
14
14
  'my-2': solid,
15
15
  loading,
16
16
  fab,
17
- colored: background !== 'transparent' || color || solid,
17
+ ...backgroundClass
18
18
  }"
19
19
  >
20
20
  <div
@@ -41,8 +41,7 @@
41
41
  </button>
42
42
  </template>
43
43
  <script lang="ts" setup>
44
- import { computed, useNuxtApp, } from "#imports";
45
- //import { IonSpinner } from "@ionic/vue";
44
+ import { computed, useNuxtApp, } from "#imports";
46
45
  const { $exakt } = useNuxtApp();
47
46
  const props = withDefaults(
48
47
  defineProps<{
@@ -86,14 +85,32 @@ const backgroundColorRgb = computed(() => {
86
85
  if (!props.background || process.server) {
87
86
  return { r: 0, g: 0, b: 0 };
88
87
  }
89
- return parseColor(parsedBackgroundProp.value);
88
+ return parseColor($exakt.parseColor(props.background));
90
89
  });
91
90
 
92
- const parsedBackgroundProp = computed(() =>
93
- $exakt.parseColor(props.background)
94
- );
91
+ const isRootColor = computed(() => $exakt.rootColors.includes(props.background))
92
+ const backgroundClass = computed(() => {
93
+ const c: { [key: string]: boolean } = {}
94
+
95
+ if(props.background == 'transparent'){
96
+ c['transparent'] = true;
97
+ }else if (isRootColor.value) {
98
+ c["bg-" + props.background] = true
99
+ } else {
100
+ c['custom-color'] = true
101
+ }
95
102
 
103
+ return c
104
+ })
105
+ const backgroundColor = computed(() => {
106
+ if (isRootColor.value) { return 'unset' } else {
107
+ return props.background
108
+ }
109
+ })
96
110
  const textColor = computed(() => {
111
+ if (isRootColor.value) {
112
+ return 'unset';
113
+ }
97
114
  if (props.color) {
98
115
  return props.color;
99
116
  }
@@ -112,14 +129,7 @@ const textColor = computed(() => {
112
129
  return "#FFFFFF";
113
130
  });
114
131
 
115
- const hoverColor = computed(() => {
116
- if (parsedBackgroundProp.value === "transparent") {
117
- return "rgba(98, 98, 98, 0.15)";
118
- }
119
132
 
120
- const rgb = backgroundColorRgb.value;
121
- return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 0.9)`;
122
- });
123
133
  </script>
124
134
  <style lang="scss" scoped>
125
135
  .e-btn-content {
@@ -135,7 +145,6 @@ const hoverColor = computed(() => {
135
145
 
136
146
  .e-btn {
137
147
  user-select: none;
138
- background: rgba(0, 0, 0, 0);
139
148
  display: flex;
140
149
  font-size: 1rem;
141
150
 
@@ -144,7 +153,6 @@ const hoverColor = computed(() => {
144
153
  align-items: center;
145
154
  padding: 0.3rem var(--e-core-padding-x);
146
155
  overflow: hidden;
147
- color: var(--e-color-dark);
148
156
  outline: none;
149
157
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
150
158
  border: none;
@@ -159,6 +167,14 @@ const hoverColor = computed(() => {
159
167
 
160
168
  border: transparent solid 0.1rem;
161
169
 
170
+ &.transparent {
171
+ color: var(--e-color-dark);
172
+ background: rgba(0, 0, 0, 0);
173
+ &:hover {
174
+ background: rgba(98, 98, 98, 0.15);
175
+ }
176
+ }
177
+
162
178
  &:focus-visible {
163
179
  transition: border-width 0.2s;
164
180
  border: var(--e-color-dark) solid 0.1rem;
@@ -173,7 +189,8 @@ const hoverColor = computed(() => {
173
189
  }
174
190
 
175
191
  &:hover {
176
- background: rgba(98, 98, 98, 0.15);
192
+ // background: rgba(98, 98, 98, 0.15);
193
+ opacity: 0.7;
177
194
  border: transparent solid 0.1rem;
178
195
  }
179
196
 
@@ -198,13 +215,13 @@ const hoverColor = computed(() => {
198
215
  width: 100%;
199
216
  }
200
217
 
201
- &.colored {
202
- background-color: v-bind(parsedBackgroundProp);
218
+ &.custom-color {
219
+ background-color: v-bind(backgroundColor);
203
220
  color: v-bind(textColor);
204
221
 
205
- &:hover {
206
- background-color: v-bind(hoverColor);
207
- }
222
+ /* &:hover {
223
+ opacity: 0.9;
224
+ } */
208
225
  }
209
226
 
210
227
  &.solid {
@@ -29,13 +29,13 @@ const emit = defineEmits(["update:modelValue"]);
29
29
  //background-color: red;
30
30
 
31
31
  &.opaque-on-desktop {
32
- background-color: rgba(var(--e-color-light-rgb), 0.7);
32
+ background-color: rgba(var(--e-color-bg-rgb), 0.7);
33
33
  }
34
34
  }
35
35
 
36
36
  @media screen and (max-width: $e-md-screen-breakpoint) {
37
37
  .focus-sheet {
38
- background-color: rgba(var(--e-color-light-rgb), 0.7);
38
+ background-color: rgba(var(--e-color-bg-rgb), 0.7);
39
39
  }
40
40
  }
41
41
  </style>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div class="hr">
3
+ <slot />
4
+ </div>
5
+ </template>
6
+ <style scoped>
7
+ .hr {
8
+ display: flex;
9
+ align-items: center;
10
+ text-align: center;
11
+ }
12
+
13
+ .hr::before,
14
+ .hr::after {
15
+ content: '';
16
+ flex: 1;
17
+ border-bottom: .125em solid var(--e-color-elev);
18
+ }
19
+
20
+ .hr:not(:empty)::before {
21
+ margin-right: .75em;
22
+ }
23
+
24
+ .hr:not(:empty)::after {
25
+ margin-left: .75em;
26
+ }
27
+ </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <e-btn
3
- class="a-btn"
3
+ class="a-btn pa-1"
4
4
  :loading="loading"
5
5
  :solid="false"
6
6
  :type="type"
@@ -156,6 +156,7 @@ const transitionEnd = () => {
156
156
  color: var(--e-color-dark);
157
157
  font-family: var(--e-font-family);
158
158
  height: v-bind(height);
159
+ transition: outline ease-in-out 0.15s, background-color ease-in-out 0.15s;
159
160
 
160
161
  &:-webkit-autofill {
161
162
  // Expose a hook for JavaScript when auto fill is shown.
@@ -192,13 +193,24 @@ const transitionEnd = () => {
192
193
  background-color: transparent;
193
194
  color: var(--e-color-dark);
194
195
  padding: 10px;
196
+ outline: var(--e-color-i-outline) solid 0.1rem;
197
+ //box-shadow: 0 0 0 0.1rem var(--e-color-i-outline);
195
198
 
196
199
  overflow: clip;
200
+ transition: outline ease-in-out 0.15s, background-color ease-in-out 0.15s;
201
+ }
202
+
203
+ .wrapper.solid:has(:focus){
204
+ outline: var(--e-color-primary) solid 0.125rem;
205
+ //box-shadow: 0 0 0 0.125rem var(--e-color-primary);
206
+
207
+ background-color: var(--e-color-i-depressed-active);
208
+
197
209
  }
198
210
 
199
211
  .wrapper.solid {
200
212
  padding: 15px;
201
- background-color: var(--e-color-elev);
213
+ background-color: var(--e-color-i-depressed);
202
214
  }
203
215
 
204
216
  .fullwidth {
@@ -206,7 +218,8 @@ const transitionEnd = () => {
206
218
  }
207
219
 
208
220
  .wrapper:active {
209
- background-color: rgba(var(--e-color-elev-2-rgb), 0.4);
221
+ background-color: var(--e-color-i-depressed-2) !important;
222
+ outline: var(--e-color-primary) solid 0.2rem !important;
210
223
  }
211
224
 
212
225
  .input::-ms-reveal {
@@ -160,7 +160,7 @@ const background = computed(() =>
160
160
 
161
161
  .app-content {
162
162
  transition: transform var(--reveal-duration) ease-in-out;
163
- background-color: var(--e-color-light);
163
+ background-color: var(--e-color-bg);
164
164
  width: 100%;
165
165
  width: fill-available;
166
166
  height: 100%;
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <e-icon-button
3
- class="rounded pa-1"
3
+ class="rounded"
4
4
  size="20"
5
5
  :icon="modelValue ? 'visibility' : 'visibility_off'"
6
6
  @click.stop="emit('update:modelValue', !modelValue)"
@@ -42,6 +42,11 @@ $color-map: (
42
42
 
43
43
  .bg-#{$name} {
44
44
  background: $color;
45
+ @if (color.lightness($color) > 49%){
46
+ color: $root-dark
47
+ }@else{
48
+ color: $root-light
49
+ }
45
50
  }
46
51
 
47
52
  .color-#{$name} {
@@ -63,12 +68,40 @@ a,
63
68
  }
64
69
  }
65
70
 
66
- @mixin elev($source, $lightness) {
67
- $root-elev: color.scale($source, $lightness: $lightness);
68
- $root-elev-2: color.scale($source, $lightness: $lightness * 1.5);
69
- $root-elev-3: color.scale($source, $lightness: $lightness * 2);
71
+ @mixin elev($lightness, $light) {
72
+
73
+ $source: hsl($root-hue,15%, $lightness);
74
+ $source-i: color.change($source, $saturation: 20%);
75
+
76
+ $full: 0;
77
+ $factor: 1;
78
+ @if $light == 1 {
79
+ $full: 100;
80
+ $factor: -1;
81
+ }
82
+ $root-i-depressed: color.adjust($source-i, $lightness: -2.5%);
83
+ $root-i-depressed-2: color.adjust($source-i, $lightness: -7.5%);
84
+ $root-i-depressed-active: color.adjust($source-i, $lightness: -5%, $saturation: 2%);
85
+ //$root-depressed: color.change($source, $lightness: $full + $factor*20%, $saturation:22%);
86
+ --e-color-i-depressed: #{$root-i-depressed};
87
+ --e-color-i-depressed-active: #{$root-i-depressed-active};
88
+ //--e-color-depressed: #{$root-depressed};
89
+ --e-color-i-depressed-2: #{$root-i-depressed-2};
70
90
 
71
91
 
92
+ $root-i-outline: color.change($source, $lightness: $full + $factor*30%, $saturation: 20%);
93
+ --e-color-i-outline: #{$root-i-outline};
94
+
95
+ $root-bg: color.adjust($source, $lightness: -2%);
96
+ $root-fg: color.adjust($source, $lightness: 2%);
97
+ --e-color-fg: #{$root-fg};
98
+ --e-color-bg: #{$root-bg};
99
+
100
+
101
+ $root-elev: color.scale($source, $lightness: $lightness);
102
+ $root-elev-2: color.scale($source, $lightness: $lightness);
103
+ $root-elev-3: color.scale($source, $lightness: $lightness);
104
+
72
105
  --e-color-elev: #{$root-elev};
73
106
  --e-color-elev-rgb: #{red($root-elev), green($root-elev), blue($root-elev)};
74
107
 
@@ -84,23 +117,23 @@ a,
84
117
  :root {
85
118
  --e-color-primary-rgb: #{$root-primary-rgb};
86
119
 
87
- --e-color-light: #{$root-light};
88
- --e-color-light-rgb: #{$root-light-rgb};
120
+ --e-color-bg: #{$root-light};
121
+ --e-color-bg-rgb: #{$root-light-rgb};
89
122
 
90
123
  --e-color-dark: #{$root-dark};
91
124
  --e-color-dark-rgb: #{$root-dark-rgb};
92
125
 
93
- @include elev($root-light, -5%);
126
+ @include elev(83%, 1);
94
127
  }
95
128
 
96
129
  @media (prefers-color-scheme: dark) {
97
130
  :root {
98
- --e-color-light: #{$root-dark};
99
- --e-color-light-rgb: #{$root-dark-rgb};
131
+ --e-color-bg: #{$root-dark};
132
+ --e-color-bg-rgb: #{$root-dark-rgb};
100
133
 
101
134
  --e-color-dark: #{$root-light};
102
135
  --e-color-dark-rgb: #{$root-light-rgb};
103
136
  color-scheme: dark;
104
- @include elev($root-dark, 5%);
137
+ @include elev(18%, 0);
105
138
  }
106
139
  }
@@ -143,7 +143,7 @@ $directions: (
143
143
  /* Other */
144
144
 
145
145
  body {
146
- background-color: var(--e-color-light);
146
+ background-color: var(--e-color-bg);
147
147
  color: var(--e-color-dark);
148
148
  font-family: var(--e-font-family);
149
149
  font-weight: var(--e-font-weight);
@@ -34,6 +34,7 @@ export default defineNuxtPlugin(() => {
34
34
  }
35
35
  return p;
36
36
  },
37
+ rootColors: ["primary", "red", "dark", "light", "yellow"],
37
38
  /**
38
39
  * Generates an alphanumeric ID of a given length.
39
40
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exakt/ui",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "description": "A UI library for Nuxt.js",
5
5
  "license": "MIT",
6
6
  "type": "module",