@nightshadeui/components 3.0.0 → 3.1.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.
- package/dist/components/BaseMenu.vue.d.ts +5 -1
- package/dist/components/Btn.vue.d.ts +6 -1
- package/dist/components/Btn.vue.d.ts.map +1 -1
- package/dist/components/ContextMenu.vue.d.ts +5 -1
- package/dist/components/RouterBtn.vue.d.ts +5 -1
- package/dist/components.css +1 -1
- package/dist/components.mjs +155 -140
- package/dist/helpers/props.d.ts.map +1 -1
- package/dist/types/MenuItem.d.ts +0 -1
- package/dist/types/MenuItem.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/Btn.vue +26 -3
- package/src/components/Bubble.vue +2 -2
- package/src/components/Checkbox.vue +5 -5
- package/src/components/InputBase.vue +1 -2
- package/src/components/InputGroup.vue +5 -2
- package/src/components/InputText.vue +1 -0
- package/src/components/InputTextarea.vue +1 -0
- package/src/components/Slider.vue +1 -1
- package/src/components/Tab.vue +2 -2
- package/src/components/Toggle.vue +2 -2
- package/src/helpers/props.ts +6 -4
- package/src/types/MenuItem.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/helpers/props.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/helpers/props.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,eAAe;;;;;;;;;CAY3B,CAAC;AAEF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAiBrF;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQrF"}
|
package/dist/types/MenuItem.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../src/types/MenuItem.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACrB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../src/types/MenuItem.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACrB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nightshadeui/components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Standard Nightshade components: opt-in Vue primitives that read the styles",
|
|
5
5
|
"author": "Boris Okunskiy",
|
|
6
6
|
"license": "ISC",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nightshadeui/util": "3.
|
|
35
|
-
"@nightshadeui/stylesheets": "3.
|
|
34
|
+
"@nightshadeui/util": "3.1.0",
|
|
35
|
+
"@nightshadeui/stylesheets": "3.1.0"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/components/Btn.vue
CHANGED
|
@@ -15,15 +15,18 @@
|
|
|
15
15
|
'Btn-translucent': effectiveStyle.translucent && !effectiveStyle.ghost,
|
|
16
16
|
'Btn-square': resolvedProps.square,
|
|
17
17
|
'Btn-block': resolvedProps.block,
|
|
18
|
-
'Btn-disabled':
|
|
18
|
+
'Btn-disabled': inactive,
|
|
19
19
|
'Btn-forceFocus': resolvedProps.forceFocus,
|
|
20
20
|
'Btn-forceHover': resolvedProps.forceHover,
|
|
21
21
|
'Btn-forceActive': resolvedProps.forceActive,
|
|
22
22
|
},
|
|
23
23
|
]"
|
|
24
|
-
:disabled="
|
|
24
|
+
:disabled="isButton ? inactive : undefined"
|
|
25
|
+
:aria-disabled="!isButton && inactive ? 'true' : undefined"
|
|
26
|
+
:tabindex="!isButton && inactive ? -1 : undefined"
|
|
25
27
|
:title="resolvedProps.title ?? resolvedProps.label"
|
|
26
|
-
:href="resolvedProps.href"
|
|
28
|
+
:href="inactive ? undefined : resolvedProps.href"
|
|
29
|
+
@click.capture="onClickCapture"
|
|
27
30
|
@mouseenter="hover = true"
|
|
28
31
|
@mouseleave="hover = false"
|
|
29
32
|
@mousedown="active = true"
|
|
@@ -122,6 +125,14 @@ export default {
|
|
|
122
125
|
|
|
123
126
|
computed: {
|
|
124
127
|
|
|
128
|
+
isButton() {
|
|
129
|
+
return this.resolvedProps.tagName === 'button';
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
inactive() {
|
|
133
|
+
return this.resolvedProps.disabled || this.blocked;
|
|
134
|
+
},
|
|
135
|
+
|
|
125
136
|
baseStyle() {
|
|
126
137
|
const { resolvedProps } = this;
|
|
127
138
|
return {
|
|
@@ -162,6 +173,18 @@ export default {
|
|
|
162
173
|
|
|
163
174
|
},
|
|
164
175
|
|
|
176
|
+
methods: {
|
|
177
|
+
|
|
178
|
+
/** Only a `<button>` ignores clicks when disabled: stop them on any other tag (links, router links). */
|
|
179
|
+
onClickCapture(ev) {
|
|
180
|
+
if (this.inactive) {
|
|
181
|
+
ev.preventDefault();
|
|
182
|
+
ev.stopImmediatePropagation();
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
},
|
|
187
|
+
|
|
165
188
|
};
|
|
166
189
|
</script>
|
|
167
190
|
|
|
@@ -41,11 +41,11 @@ export default {
|
|
|
41
41
|
--Bubble-arrow-offset: var(--sp2);
|
|
42
42
|
--Bubble-radius: var(--radius-m);
|
|
43
43
|
--Bubble-shadow: var(--shadow-light);
|
|
44
|
-
--Bubble-
|
|
44
|
+
--Bubble-filter: drop-shadow(0 1px 3px var(--Bubble-shadow));
|
|
45
45
|
|
|
46
46
|
position: absolute;
|
|
47
47
|
z-index: 10;
|
|
48
|
-
filter:
|
|
48
|
+
filter: var(--Bubble-filter);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.Body {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
'Checkbox-forceHover': resolvedProps.forceHover,
|
|
16
16
|
}
|
|
17
17
|
]"
|
|
18
|
-
tabindex="0"
|
|
18
|
+
:tabindex="resolvedProps.disabled ? -1 : 0"
|
|
19
19
|
@mouseenter="hover = true"
|
|
20
20
|
@mouseleave="hover = false"
|
|
21
21
|
@focusin="focus = true"
|
|
@@ -152,7 +152,7 @@ export default {
|
|
|
152
152
|
|
|
153
153
|
--Checkbox-box-shadow: 0 1px 3px var(--Checkbox-shadow) inset, 0 0 5px -1px var(--Checkbox-shadow) inset;
|
|
154
154
|
--Checkbox-shadow: var(--shadow-light);
|
|
155
|
-
--Checkbox-mark-
|
|
155
|
+
--Checkbox-mark-text-shadow: 0 1px 1px var(--text-shadow-auto);
|
|
156
156
|
|
|
157
157
|
display: inline-flex;
|
|
158
158
|
align-items: center;
|
|
@@ -172,7 +172,7 @@ export default {
|
|
|
172
172
|
|
|
173
173
|
font-size: var(--Checkbox-size);
|
|
174
174
|
color: var(--tone-fill-text);
|
|
175
|
-
text-shadow: var(--Checkbox-mark-
|
|
175
|
+
text-shadow: var(--Checkbox-mark-text-shadow);
|
|
176
176
|
box-shadow: var(--Checkbox-box-shadow);
|
|
177
177
|
|
|
178
178
|
cursor: pointer;
|
|
@@ -250,7 +250,7 @@ export default {
|
|
|
250
250
|
|
|
251
251
|
.Checkbox-flat {
|
|
252
252
|
--Checkbox-box-shadow: none;
|
|
253
|
-
--Checkbox-shadow:
|
|
254
|
-
--Checkbox-mark-
|
|
253
|
+
--Checkbox-shadow: transparent;
|
|
254
|
+
--Checkbox-mark-text-shadow: none;
|
|
255
255
|
}
|
|
256
256
|
</style>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
v-if="resolvedProps.labelStyle === 'tab'"
|
|
24
24
|
class="Label TabLabel"
|
|
25
25
|
:label="resolvedProps.label"
|
|
26
|
-
:tone="
|
|
26
|
+
:tone="effectiveStyle.tone" />
|
|
27
27
|
<div
|
|
28
28
|
v-if="resolvedProps.labelStyle === 'text'"
|
|
29
29
|
class="Label TextLabel">
|
|
@@ -210,7 +210,6 @@ export default {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
.InputBase-flat {
|
|
213
|
-
--InputBase-shadow: none;
|
|
214
213
|
--InputBase-box-shadow: none;
|
|
215
214
|
}
|
|
216
215
|
|
|
@@ -28,12 +28,15 @@ export default {
|
|
|
28
28
|
gap: var(--input-border-size);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
/* Joined edges: a control's own frame, or the frame inside a wrapper (`InputText` frames its field in `.InputBase`) */
|
|
32
|
+
.InputGroup:deep(> .InputElement:not(:first-child)),
|
|
33
|
+
.InputGroup:deep(> :not(:first-child) > .InputElement) {
|
|
32
34
|
border-start-start-radius: 0;
|
|
33
35
|
border-end-start-radius: 0;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
.InputGroup:deep(> .InputElement:not(:last-child))
|
|
38
|
+
.InputGroup:deep(> .InputElement:not(:last-child)),
|
|
39
|
+
.InputGroup:deep(> :not(:last-child) > .InputElement) {
|
|
37
40
|
border-start-end-radius: 0;
|
|
38
41
|
border-end-end-radius: 0;
|
|
39
42
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
:aria-valuemax="resolvedProps.max"
|
|
22
22
|
:aria-valuenow="currentValue"
|
|
23
23
|
:aria-disabled="resolvedProps.disabled || undefined"
|
|
24
|
-
tabindex="0"
|
|
24
|
+
:tabindex="resolvedProps.disabled ? -1 : 0"
|
|
25
25
|
:style="{ '--Slider-ratio': ratio }"
|
|
26
26
|
@pointerdown="onPointerDown"
|
|
27
27
|
@keydown="onKeydown"
|
package/src/components/Tab.vue
CHANGED
|
@@ -67,14 +67,14 @@ export default {
|
|
|
67
67
|
--Tab-text: var(--tone-fill-text);
|
|
68
68
|
|
|
69
69
|
--Tab-shadow: var(--shadow-medium);
|
|
70
|
-
--Tab-
|
|
70
|
+
--Tab-filter: drop-shadow(0 0 .5px var(--Tab-shadow));
|
|
71
71
|
|
|
72
72
|
display: flex;
|
|
73
73
|
cursor: pointer;
|
|
74
74
|
position: relative;
|
|
75
75
|
|
|
76
76
|
color: var(--Tab-text);
|
|
77
|
-
filter:
|
|
77
|
+
filter: var(--Tab-filter);
|
|
78
78
|
|
|
79
79
|
font-size: var(--Tab-font-size);
|
|
80
80
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
'Toggle-forceHover': resolvedProps.forceHover,
|
|
16
16
|
}
|
|
17
17
|
]"
|
|
18
|
-
tabindex="0"
|
|
18
|
+
:tabindex="resolvedProps.disabled ? -1 : 0"
|
|
19
19
|
@mouseenter="hover = true"
|
|
20
20
|
@mouseleave="hover = false"
|
|
21
21
|
@focusin="focus = true"
|
|
@@ -220,7 +220,7 @@ export default {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
.Toggle-flat {
|
|
223
|
-
--Toggle-shadow:
|
|
223
|
+
--Toggle-shadow: transparent;
|
|
224
224
|
--Toggle-box-shadow: none;
|
|
225
225
|
}
|
|
226
226
|
|
package/src/helpers/props.ts
CHANGED
|
@@ -6,12 +6,14 @@ function hasOwnProp(source: Record<string, unknown>, key: string): boolean {
|
|
|
6
6
|
return Object.prototype.hasOwnProperty.call(source, key);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Whether the parent set the prop. A bound `undefined` (`:tone="item.tone"`) counts as unset,
|
|
11
|
+
* so `$nightshade.defaults` still reach it.
|
|
12
|
+
*/
|
|
9
13
|
function hasExplicitProp(instance: any, key: string): boolean {
|
|
10
14
|
const vnodeProps = instance?.$?.vnode?.props || {};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
return hasOwnProp(vnodeProps, toKebabCase(key));
|
|
15
|
+
const name = hasOwnProp(vnodeProps, key) ? key : toKebabCase(key);
|
|
16
|
+
return hasOwnProp(vnodeProps, name) && vnodeProps[name] !== undefined;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export const nightshadeMixin = {
|