@vaadin/field-base 24.2.0-dev.f254716fe → 24.3.0-alpha2
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/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +5 -5
- package/src/input-control-mixin.d.ts +1 -1
- package/src/input-control-mixin.js +1 -1
- package/src/input-field-mixin.d.ts +1 -1
- package/src/input-mixin.js +1 -0
- package/src/slot-styles-mixin.d.ts +0 -21
- package/src/slot-styles-mixin.js +0 -76
package/index.d.ts
CHANGED
|
@@ -7,6 +7,5 @@ export { InputMixin } from './src/input-mixin.js';
|
|
|
7
7
|
export { LabelledInputController } from './src/labelled-input-controller.js';
|
|
8
8
|
export { LabelMixin } from './src/label-mixin.js';
|
|
9
9
|
export { PatternMixin } from './src/pattern-mixin.js';
|
|
10
|
-
export { SlotStylesMixin } from './src/slot-styles-mixin.js';
|
|
11
10
|
export { TextAreaController } from './src/text-area-controller.js';
|
|
12
11
|
export { ValidateMixin } from './src/validate-mixin.js';
|
package/index.js
CHANGED
|
@@ -7,6 +7,5 @@ export { InputMixin } from './src/input-mixin.js';
|
|
|
7
7
|
export { LabelledInputController } from './src/labelled-input-controller.js';
|
|
8
8
|
export { LabelMixin } from './src/label-mixin.js';
|
|
9
9
|
export { PatternMixin } from './src/pattern-mixin.js';
|
|
10
|
-
export { SlotStylesMixin } from './src/slot-styles-mixin.js';
|
|
11
10
|
export { TextAreaController } from './src/text-area-controller.js';
|
|
12
11
|
export { ValidateMixin } from './src/validate-mixin.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/field-base",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.3.0-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
34
34
|
"@polymer/polymer": "^3.0.0",
|
|
35
|
-
"@vaadin/a11y-base": "24.
|
|
36
|
-
"@vaadin/component-base": "24.
|
|
35
|
+
"@vaadin/a11y-base": "24.3.0-alpha2",
|
|
36
|
+
"@vaadin/component-base": "24.3.0-alpha2",
|
|
37
37
|
"lit": "^2.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@esm-bundle/chai": "^4.3.4",
|
|
41
|
-
"@vaadin/testing-helpers": "^0.
|
|
41
|
+
"@vaadin/testing-helpers": "^0.5.0",
|
|
42
42
|
"sinon": "^13.0.2"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "0fd437292fa2a2f65e29b424d2456909ad2d684b"
|
|
45
45
|
}
|
|
@@ -10,12 +10,12 @@ import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
|
10
10
|
import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
11
11
|
import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
|
|
12
12
|
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
13
|
+
import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
13
14
|
import type { ClearButtonMixinClass } from './clear-button-mixin.js';
|
|
14
15
|
import type { FieldMixinClass } from './field-mixin.js';
|
|
15
16
|
import type { InputConstraintsMixinClass } from './input-constraints-mixin.js';
|
|
16
17
|
import type { InputMixinClass } from './input-mixin.js';
|
|
17
18
|
import type { LabelMixinClass } from './label-mixin.js';
|
|
18
|
-
import type { SlotStylesMixinClass } from './slot-styles-mixin.js';
|
|
19
19
|
import type { ValidateMixinClass } from './validate-mixin.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -7,10 +7,10 @@ import { DelegateFocusMixin } from '@vaadin/a11y-base/src/delegate-focus-mixin.j
|
|
|
7
7
|
import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
8
8
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
9
9
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
10
|
+
import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
10
11
|
import { ClearButtonMixin } from './clear-button-mixin.js';
|
|
11
12
|
import { FieldMixin } from './field-mixin.js';
|
|
12
13
|
import { InputConstraintsMixin } from './input-constraints-mixin.js';
|
|
13
|
-
import { SlotStylesMixin } from './slot-styles-mixin.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* A mixin to provide shared logic for the editable form input controls.
|
|
@@ -10,13 +10,13 @@ import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
|
10
10
|
import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
11
11
|
import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
|
|
12
12
|
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
13
|
+
import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
13
14
|
import type { ClearButtonMixinClass } from './clear-button-mixin.js';
|
|
14
15
|
import type { FieldMixinClass } from './field-mixin.js';
|
|
15
16
|
import type { InputConstraintsMixinClass } from './input-constraints-mixin.js';
|
|
16
17
|
import type { InputControlMixinClass } from './input-control-mixin.js';
|
|
17
18
|
import type { InputMixinClass } from './input-mixin.js';
|
|
18
19
|
import type { LabelMixinClass } from './label-mixin.js';
|
|
19
|
-
import type { SlotStylesMixinClass } from './slot-styles-mixin.js';
|
|
20
20
|
import type { ValidateMixinClass } from './validate-mixin.js';
|
|
21
21
|
|
|
22
22
|
/**
|
package/src/input-mixin.js
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Mixin to insert styles into the outer scope to handle slotted components.
|
|
10
|
-
* This is useful e.g. to hide native `<input type="number">` controls.
|
|
11
|
-
*/
|
|
12
|
-
export declare function SlotStylesMixin<T extends Constructor<HTMLElement>>(
|
|
13
|
-
base: T,
|
|
14
|
-
): Constructor<SlotStylesMixinClass> & T;
|
|
15
|
-
|
|
16
|
-
export declare class SlotStylesMixinClass {
|
|
17
|
-
/**
|
|
18
|
-
* List of styles to insert into root.
|
|
19
|
-
*/
|
|
20
|
-
protected readonly slotStyles: string[];
|
|
21
|
-
}
|
package/src/slot-styles-mixin.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
|
7
|
-
|
|
8
|
-
const stylesMap = new WeakMap();
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Get all the styles inserted into root.
|
|
12
|
-
* @param {DocumentOrShadowRoot} root
|
|
13
|
-
* @return {Set<string>}
|
|
14
|
-
*/
|
|
15
|
-
function getRootStyles(root) {
|
|
16
|
-
if (!stylesMap.has(root)) {
|
|
17
|
-
stylesMap.set(root, new Set());
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return stylesMap.get(root);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Insert styles into the root.
|
|
25
|
-
* @param {string} styles
|
|
26
|
-
* @param {DocumentOrShadowRoot} root
|
|
27
|
-
*/
|
|
28
|
-
function insertStyles(styles, root) {
|
|
29
|
-
const style = document.createElement('style');
|
|
30
|
-
style.textContent = styles;
|
|
31
|
-
|
|
32
|
-
if (root === document) {
|
|
33
|
-
document.head.appendChild(style);
|
|
34
|
-
} else {
|
|
35
|
-
root.insertBefore(style, root.firstChild);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Mixin to insert styles into the outer scope to handle slotted components.
|
|
41
|
-
* This is useful e.g. to hide native `<input type="number">` controls.
|
|
42
|
-
*
|
|
43
|
-
* @polymerMixin
|
|
44
|
-
*/
|
|
45
|
-
export const SlotStylesMixin = dedupingMixin(
|
|
46
|
-
(superclass) =>
|
|
47
|
-
class SlotStylesMixinClass extends superclass {
|
|
48
|
-
/**
|
|
49
|
-
* List of styles to insert into root.
|
|
50
|
-
* @protected
|
|
51
|
-
*/
|
|
52
|
-
get slotStyles() {
|
|
53
|
-
return {};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** @protected */
|
|
57
|
-
connectedCallback() {
|
|
58
|
-
super.connectedCallback();
|
|
59
|
-
|
|
60
|
-
this.__applySlotStyles();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** @private */
|
|
64
|
-
__applySlotStyles() {
|
|
65
|
-
const root = this.getRootNode();
|
|
66
|
-
const rootStyles = getRootStyles(root);
|
|
67
|
-
|
|
68
|
-
this.slotStyles.forEach((styles) => {
|
|
69
|
-
if (!rootStyles.has(styles)) {
|
|
70
|
-
insertStyles(styles, root);
|
|
71
|
-
rootStyles.add(styles);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
);
|