@lynx-js/web-elements 0.7.5 → 0.7.6
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/CHANGELOG.md +19 -0
- package/dist/XFoldViewNg/XFoldviewHeaderNg.d.ts +1 -0
- package/dist/XFoldViewNg/XFoldviewHeaderNg.js +6 -2
- package/dist/XFoldViewNg/XFoldviewToolbarNg.d.ts +1 -0
- package/dist/XFoldViewNg/XFoldviewToolbarNg.js +6 -2
- package/dist/XInput/XInputEvents.js +16 -8
- package/dist/XTextarea/XTextareaEvents.js +16 -8
- package/dist/common/getCombinedParentElement.d.ts +1 -0
- package/dist/common/getCombinedParentElement.js +11 -0
- package/package.json +2 -2
- package/src/XCanvas/x-canvas.css +1 -1
- package/src/XText/x-text.css +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @lynx-js/web-elements
|
|
2
2
|
|
|
3
|
+
## 0.7.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: incorrect syntax for x-canvas part ([#1067](https://github.com/lynx-family/lynx-stack/pull/1067))
|
|
8
|
+
|
|
9
|
+
- feat: x-input && x-textarea add attribute input-filter, which can filter input value. ([#1037](https://github.com/lynx-family/lynx-stack/pull/1037))
|
|
10
|
+
|
|
11
|
+
- fix: incorrect top style of x-foldview-slot-ng if the toolbar is wrapped in lynx-wrapper ([#1101](https://github.com/lynx-family/lynx-stack/pull/1101))
|
|
12
|
+
|
|
13
|
+
- perf: add loading="lazy" for image element ([#1056](https://github.com/lynx-family/lynx-stack/pull/1056))
|
|
14
|
+
|
|
15
|
+
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#loading
|
|
16
|
+
|
|
17
|
+
- fix: --lynx-color will be removed, and if color contains `gradient` it will be processed as transparent. ([#1069](https://github.com/lynx-family/lynx-stack/pull/1069))
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`62d1078`](https://github.com/lynx-family/lynx-stack/commit/62d1078e67f2aba216a0d97bf1ad9ece624e498e)]:
|
|
20
|
+
- @lynx-js/web-elements-template@0.7.6
|
|
21
|
+
|
|
3
22
|
## 0.7.5
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -7,6 +7,7 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
7
7
|
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
8
|
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
9
9
|
import { resizeObserver } from './XFoldviewNg.js';
|
|
10
|
+
import { getCombinedDirectParentElement } from '../common/getCombinedParentElement.js';
|
|
10
11
|
let XFoldviewHeaderNg = (() => {
|
|
11
12
|
let _classDecorators = [Component('x-foldview-header-ng', [
|
|
12
13
|
CommonEventsAndMethods,
|
|
@@ -24,11 +25,14 @@ let XFoldviewHeaderNg = (() => {
|
|
|
24
25
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
25
26
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
26
27
|
}
|
|
28
|
+
#parentResizeObserver = undefined;
|
|
27
29
|
connectedCallback() {
|
|
28
|
-
|
|
30
|
+
const parentElement = getCombinedDirectParentElement(this, 'X-FOLDVIEW-NG');
|
|
31
|
+
this.#parentResizeObserver = parentElement?.[resizeObserver];
|
|
32
|
+
this.#parentResizeObserver?.observe(this);
|
|
29
33
|
}
|
|
30
34
|
dispose() {
|
|
31
|
-
this
|
|
35
|
+
this.#parentResizeObserver?.unobserve(this);
|
|
32
36
|
}
|
|
33
37
|
};
|
|
34
38
|
return XFoldviewHeaderNg = _classThis;
|
|
@@ -7,6 +7,7 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
7
7
|
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
8
|
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
9
9
|
import { resizeObserver } from './XFoldviewNg.js';
|
|
10
|
+
import { getCombinedDirectParentElement } from '../common/getCombinedParentElement.js';
|
|
10
11
|
let XFoldviewToolbarNg = (() => {
|
|
11
12
|
let _classDecorators = [Component('x-foldview-toolbar-ng', [
|
|
12
13
|
CommonEventsAndMethods,
|
|
@@ -24,11 +25,14 @@ let XFoldviewToolbarNg = (() => {
|
|
|
24
25
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
25
26
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
26
27
|
}
|
|
28
|
+
#parentResizeObserver = undefined;
|
|
27
29
|
connectedCallback() {
|
|
28
|
-
|
|
30
|
+
const parentElement = getCombinedDirectParentElement(this, 'X-FOLDVIEW-NG');
|
|
31
|
+
this.#parentResizeObserver = parentElement?.[resizeObserver];
|
|
32
|
+
this.#parentResizeObserver?.observe(this);
|
|
29
33
|
}
|
|
30
34
|
dispose() {
|
|
31
|
-
this
|
|
35
|
+
this.#parentResizeObserver?.unobserve(this);
|
|
32
36
|
}
|
|
33
37
|
};
|
|
34
38
|
return XFoldviewToolbarNg = _classThis;
|
|
@@ -19,7 +19,7 @@ let XInputEvents = (() => {
|
|
|
19
19
|
return class XInputEvents {
|
|
20
20
|
static {
|
|
21
21
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
22
|
-
_private_handleEnableInputEvent_decorators = [registerEventEnableStatusChangeHandler('input')];
|
|
22
|
+
_private_handleEnableInputEvent_decorators = [registerAttributeHandler('input-filter', true), registerEventEnableStatusChangeHandler('input')];
|
|
23
23
|
_private_handleSendComposingInput_decorators = [registerAttributeHandler('send-composing-input', true)];
|
|
24
24
|
_private_handleEnableSelectionEvent_decorators = [registerEventEnableStatusChangeHandler('selection')];
|
|
25
25
|
__esDecorate(this, _private_handleEnableInputEvent_descriptor = { value: __setFunctionName(function (status) {
|
|
@@ -48,7 +48,7 @@ let XInputEvents = (() => {
|
|
|
48
48
|
}, "#handleEnableSelectionEvent") }, _private_handleEnableSelectionEvent_decorators, { kind: "method", name: "#handleEnableSelectionEvent", static: false, private: true, access: { has: obj => #handleEnableSelectionEvent in obj, get: obj => obj.#handleEnableSelectionEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
49
49
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
50
50
|
}
|
|
51
|
-
static observedAttributes = ['send-composing-input'];
|
|
51
|
+
static observedAttributes = ['send-composing-input', 'input-filter'];
|
|
52
52
|
#dom = __runInitializers(this, _instanceExtraInitializers);
|
|
53
53
|
#sendComposingInput = false;
|
|
54
54
|
#getInputElement = genDomGetter(() => this.#dom.shadowRoot, '#input');
|
|
@@ -66,16 +66,20 @@ let XInputEvents = (() => {
|
|
|
66
66
|
};
|
|
67
67
|
#teleportInput = (event) => {
|
|
68
68
|
const input = this.#getInputElement();
|
|
69
|
-
const
|
|
69
|
+
const inputFilter = this.#dom.getAttribute('input-filter');
|
|
70
|
+
const filterValue = inputFilter
|
|
71
|
+
? input.value.replace(new RegExp(inputFilter, 'g'), '')
|
|
72
|
+
: input.value;
|
|
70
73
|
const isComposing = event.isComposing;
|
|
74
|
+
input.value = filterValue;
|
|
71
75
|
if (isComposing && !this.#sendComposingInput)
|
|
72
76
|
return;
|
|
73
77
|
this.#dom.dispatchEvent(new CustomEvent('input', {
|
|
74
78
|
...commonComponentEventSetting,
|
|
75
79
|
detail: {
|
|
76
|
-
value,
|
|
80
|
+
value: filterValue,
|
|
77
81
|
/** @deprecated */
|
|
78
|
-
textLength:
|
|
82
|
+
textLength: filterValue.length,
|
|
79
83
|
/** @deprecated */
|
|
80
84
|
cursor: input.selectionStart,
|
|
81
85
|
isComposing,
|
|
@@ -86,15 +90,19 @@ let XInputEvents = (() => {
|
|
|
86
90
|
};
|
|
87
91
|
#teleportCompositionendInput = () => {
|
|
88
92
|
const input = this.#getInputElement();
|
|
89
|
-
const
|
|
93
|
+
const inputFilter = this.#dom.getAttribute('input-filter');
|
|
94
|
+
const filterValue = inputFilter
|
|
95
|
+
? input.value.replace(new RegExp(inputFilter, 'g'), '')
|
|
96
|
+
: input.value;
|
|
97
|
+
input.value = filterValue;
|
|
90
98
|
// if #sendComposingInput set true, #teleportInput will send detail
|
|
91
99
|
if (!this.#sendComposingInput) {
|
|
92
100
|
this.#dom.dispatchEvent(new CustomEvent('input', {
|
|
93
101
|
...commonComponentEventSetting,
|
|
94
102
|
detail: {
|
|
95
|
-
value,
|
|
103
|
+
value: filterValue,
|
|
96
104
|
/** @deprecated */
|
|
97
|
-
textLength:
|
|
105
|
+
textLength: filterValue.length,
|
|
98
106
|
/** @deprecated */
|
|
99
107
|
cursor: input.selectionStart,
|
|
100
108
|
isComposing: false,
|
|
@@ -19,7 +19,7 @@ let XTextareaEvents = (() => {
|
|
|
19
19
|
return class XTextareaEvents {
|
|
20
20
|
static {
|
|
21
21
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
22
|
-
_private_handleEnableConfirmEvent_decorators = [registerEventEnableStatusChangeHandler('input')];
|
|
22
|
+
_private_handleEnableConfirmEvent_decorators = [registerAttributeHandler('input-filter', true), registerEventEnableStatusChangeHandler('input')];
|
|
23
23
|
_private_handleSendComposingInput_decorators = [registerAttributeHandler('send-composing-input', true)];
|
|
24
24
|
_private_handleEnableSelectionEvent_decorators = [registerEventEnableStatusChangeHandler('selection')];
|
|
25
25
|
__esDecorate(this, _private_handleEnableConfirmEvent_descriptor = { value: __setFunctionName(function (status) {
|
|
@@ -48,7 +48,7 @@ let XTextareaEvents = (() => {
|
|
|
48
48
|
}, "#handleEnableSelectionEvent") }, _private_handleEnableSelectionEvent_decorators, { kind: "method", name: "#handleEnableSelectionEvent", static: false, private: true, access: { has: obj => #handleEnableSelectionEvent in obj, get: obj => obj.#handleEnableSelectionEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
49
49
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
50
50
|
}
|
|
51
|
-
static observedAttributes = ['send-composing-input'];
|
|
51
|
+
static observedAttributes = ['send-composing-input', 'input-filter'];
|
|
52
52
|
#dom = __runInitializers(this, _instanceExtraInitializers);
|
|
53
53
|
#sendComposingInput = false;
|
|
54
54
|
#getTextareaElement = genDomGetter(() => this.#dom.shadowRoot, '#textarea');
|
|
@@ -66,16 +66,20 @@ let XTextareaEvents = (() => {
|
|
|
66
66
|
};
|
|
67
67
|
#teleportInput = (event) => {
|
|
68
68
|
const input = this.#getTextareaElement();
|
|
69
|
-
const
|
|
69
|
+
const inputFilter = this.#dom.getAttribute('input-filter');
|
|
70
|
+
const filterValue = inputFilter
|
|
71
|
+
? input.value.replace(new RegExp(inputFilter, 'g'), '')
|
|
72
|
+
: input.value;
|
|
70
73
|
const isComposing = event.isComposing;
|
|
74
|
+
input.value = filterValue;
|
|
71
75
|
if (isComposing && !this.#sendComposingInput)
|
|
72
76
|
return;
|
|
73
77
|
this.#dom.dispatchEvent(new CustomEvent('input', {
|
|
74
78
|
...commonComponentEventSetting,
|
|
75
79
|
detail: {
|
|
76
|
-
value,
|
|
80
|
+
value: filterValue,
|
|
77
81
|
/** @deprecated */
|
|
78
|
-
textLength:
|
|
82
|
+
textLength: filterValue.length,
|
|
79
83
|
/** @deprecated */
|
|
80
84
|
cursor: input.selectionStart,
|
|
81
85
|
isComposing,
|
|
@@ -86,15 +90,19 @@ let XTextareaEvents = (() => {
|
|
|
86
90
|
};
|
|
87
91
|
#teleportCompositionendInput = () => {
|
|
88
92
|
const input = this.#getTextareaElement();
|
|
89
|
-
const
|
|
93
|
+
const inputFilter = this.#dom.getAttribute('input-filter');
|
|
94
|
+
const filterValue = inputFilter
|
|
95
|
+
? input.value.replace(new RegExp(inputFilter, 'g'), '')
|
|
96
|
+
: input.value;
|
|
97
|
+
input.value = filterValue;
|
|
90
98
|
// if #sendComposingInput set true, #teleportInput will send detail
|
|
91
99
|
if (!this.#sendComposingInput) {
|
|
92
100
|
this.#dom.dispatchEvent(new CustomEvent('input', {
|
|
93
101
|
...commonComponentEventSetting,
|
|
94
102
|
detail: {
|
|
95
|
-
value,
|
|
103
|
+
value: filterValue,
|
|
96
104
|
/** @deprecated */
|
|
97
|
-
textLength:
|
|
105
|
+
textLength: filterValue.length,
|
|
98
106
|
/** @deprecated */
|
|
99
107
|
cursor: input.selectionStart,
|
|
100
108
|
isComposing: false,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCombinedDirectParentElement: <T extends HTMLElement>(element: HTMLElement, parentTagName: string) => T | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const getCombinedDirectParentElement = (element, parentTagName) => {
|
|
2
|
+
let parentElement = element.parentElement;
|
|
3
|
+
if (parentElement?.tagName === 'LYNX-WRAPPER') {
|
|
4
|
+
parentElement = parentElement.parentElement;
|
|
5
|
+
}
|
|
6
|
+
if (parentElement?.tagName === parentTagName) {
|
|
7
|
+
return parentElement;
|
|
8
|
+
}
|
|
9
|
+
return;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=getCombinedParentElement.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-elements",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
],
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"@lynx-js/web-elements-reactive": "0.2.2",
|
|
104
|
-
"@lynx-js/web-elements-template": "0.7.
|
|
104
|
+
"@lynx-js/web-elements-template": "0.7.6"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"tslib": "^2.8.1"
|
package/src/XCanvas/x-canvas.css
CHANGED
package/src/XText/x-text.css
CHANGED
|
@@ -8,11 +8,15 @@ x-text {
|
|
|
8
8
|
display: flex;
|
|
9
9
|
overflow-wrap: break-word;
|
|
10
10
|
align-items: stretch;
|
|
11
|
-
color: var(--lynx-color);
|
|
12
11
|
background-image: var(--lynx-text-bg-color);
|
|
12
|
+
color: initial;
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
x-text > x-text, x-text > lynx-wrapper > x-text {
|
|
16
|
+
color: inherit;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
x-text:not(x-text > x-text):not(x-text > lynx-wrapper > x-text) {
|
|
15
|
-
--lynx-color: canvastext;
|
|
16
20
|
--lynx-text-bg-color: initial;
|
|
17
21
|
}
|
|
18
22
|
|