@lynx-js/web-elements-canary 0.5.2 → 0.5.3-canary-20250331-b8bb3d49
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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lynx-js/web-elements
|
|
2
2
|
|
|
3
|
+
## 0.5.3-canary-20250331103529-b8bb3d499969b630b745b82953d1f1739d4b1edf
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: add `layoutchange` event support for x-view and x-text ([#408](https://github.com/lynx-family/lynx-stack/pull/408))
|
|
8
|
+
|
|
3
9
|
## 0.5.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -280,8 +286,8 @@
|
|
|
280
286
|
For compating usage, `@lynx-js/web-elements-compat/LinearContainer` is provided.
|
|
281
287
|
|
|
282
288
|
```javascript
|
|
283
|
-
import
|
|
284
|
-
import
|
|
289
|
+
import "@lynx-js/web-elements-compat/LinearContainer";
|
|
290
|
+
import "@lynx-js/web-elements/all";
|
|
285
291
|
```
|
|
286
292
|
|
|
287
293
|
- f8d1d98: break: rename the `blur` and `focus` event to `lynxblur` and `lynxfocus` for x-input element
|
|
@@ -303,11 +309,11 @@
|
|
|
303
309
|
There is also a simple way to use this feature
|
|
304
310
|
|
|
305
311
|
```javascript
|
|
306
|
-
import { LynxCard } from
|
|
307
|
-
import { loadElement } from
|
|
308
|
-
import
|
|
309
|
-
import
|
|
310
|
-
import
|
|
312
|
+
import { LynxCard } from "@lynx-js/web-core";
|
|
313
|
+
import { loadElement } from "@lynx-js/web-elements/lazy";
|
|
314
|
+
import "@lynx-js/web-elements/index.css";
|
|
315
|
+
import "@lynx-js/web-core/index.css";
|
|
316
|
+
import "./index.css";
|
|
311
317
|
|
|
312
318
|
const lynxcard = new LynxCard({
|
|
313
319
|
...beforeConfigs,
|
package/dist/XText/XText.js
CHANGED
|
@@ -8,8 +8,9 @@ import { Component, html } from '@lynx-js/web-elements-reactive';
|
|
|
8
8
|
import { LynxExposure } from '../common/Exposure.js';
|
|
9
9
|
import { XTextTruncation } from './XTextTruncation.js';
|
|
10
10
|
import { ScrollIntoView } from '../ScrollView/ScrollIntoView.js';
|
|
11
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
11
12
|
let XText = (() => {
|
|
12
|
-
let _classDecorators = [Component('x-text', [LynxExposure, XTextTruncation], html `<div id="inner-box" part="inner-box"><slot></slot><slot name="inline-truncation"></slot></div>`)];
|
|
13
|
+
let _classDecorators = [Component('x-text', [LynxExposure, CommonEventsAndMethods, XTextTruncation], html `<div id="inner-box" part="inner-box"><slot></slot><slot name="inline-truncation"></slot></div>`)];
|
|
13
14
|
let _classDescriptor;
|
|
14
15
|
let _classExtraInitializers = [];
|
|
15
16
|
let _classThis;
|
package/dist/XView/XView.js
CHANGED
|
@@ -7,8 +7,9 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
7
7
|
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
8
|
import { ScrollIntoView } from '../ScrollView/ScrollIntoView.js';
|
|
9
9
|
import { LynxExposure } from '../common/Exposure.js';
|
|
10
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
10
11
|
let XView = (() => {
|
|
11
|
-
let _classDecorators = [Component('x-view', [LynxExposure])];
|
|
12
|
+
let _classDecorators = [Component('x-view', [LynxExposure, CommonEventsAndMethods])];
|
|
12
13
|
let _classDescriptor;
|
|
13
14
|
let _classExtraInitializers = [];
|
|
14
15
|
let _classThis;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
5
|
+
import { commonComponentEventSetting } from './commonEventInitConfiguration.js';
|
|
6
|
+
import { registerEventEnableStatusChangeHandler } from '@lynx-js/web-elements-reactive';
|
|
7
|
+
let CommonEventsAndMethods = (() => {
|
|
8
|
+
let ___handleScrollUpperThresholdEventEnabled_decorators;
|
|
9
|
+
let ___handleScrollUpperThresholdEventEnabled_initializers = [];
|
|
10
|
+
let ___handleScrollUpperThresholdEventEnabled_extraInitializers = [];
|
|
11
|
+
return class CommonEventsAndMethods {
|
|
12
|
+
static {
|
|
13
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
14
|
+
___handleScrollUpperThresholdEventEnabled_decorators = [registerEventEnableStatusChangeHandler('layoutchange')];
|
|
15
|
+
__esDecorate(null, null, ___handleScrollUpperThresholdEventEnabled_decorators, { kind: "field", name: "__handleScrollUpperThresholdEventEnabled", static: false, private: false, access: { has: obj => "__handleScrollUpperThresholdEventEnabled" in obj, get: obj => obj.__handleScrollUpperThresholdEventEnabled, set: (obj, value) => { obj.__handleScrollUpperThresholdEventEnabled = value; } }, metadata: _metadata }, ___handleScrollUpperThresholdEventEnabled_initializers, ___handleScrollUpperThresholdEventEnabled_extraInitializers);
|
|
16
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
17
|
+
}
|
|
18
|
+
static observedAttributes = [];
|
|
19
|
+
#dom;
|
|
20
|
+
#observing = false;
|
|
21
|
+
#resizeObserver;
|
|
22
|
+
constructor(currentElement) {
|
|
23
|
+
__runInitializers(this, ___handleScrollUpperThresholdEventEnabled_extraInitializers);
|
|
24
|
+
this.#dom = currentElement;
|
|
25
|
+
}
|
|
26
|
+
__handleScrollUpperThresholdEventEnabled = __runInitializers(this, ___handleScrollUpperThresholdEventEnabled_initializers, (enabled) => {
|
|
27
|
+
if (enabled) {
|
|
28
|
+
if (!this.#resizeObserver) {
|
|
29
|
+
this.#resizeObserver = new ResizeObserver(([entry]) => {
|
|
30
|
+
if (entry) {
|
|
31
|
+
// The layoutchange event is the border box of the element
|
|
32
|
+
const { width, height, left, right, top, bottom } = entry.contentRect;
|
|
33
|
+
const id = this.#dom.id;
|
|
34
|
+
this.#dom.dispatchEvent(new CustomEvent('layoutchange', {
|
|
35
|
+
detail: {
|
|
36
|
+
width,
|
|
37
|
+
height,
|
|
38
|
+
left,
|
|
39
|
+
right,
|
|
40
|
+
top,
|
|
41
|
+
bottom,
|
|
42
|
+
id,
|
|
43
|
+
},
|
|
44
|
+
...commonComponentEventSetting,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
if (!this.#observing) {
|
|
49
|
+
this.#resizeObserver.observe(this.#dom);
|
|
50
|
+
this.#observing = true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.#resizeObserver?.disconnect();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
})();
|
|
60
|
+
export { CommonEventsAndMethods };
|
|
61
|
+
//# sourceMappingURL=CommonEventsAndMethods.js.map
|