@lynx-js/web-elements 0.5.1 → 0.5.3

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,19 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.5.3
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
+
9
+ ## 0.5.2
10
+
11
+ ### Patch Changes
12
+
13
+ - fix: When list with list-type: flow, scrolltoupper, scrolltolower were specified, there was a blank block. ([#379](https://github.com/lynx-family/lynx-stack/pull/379))
14
+
15
+ - fix: do not show scroll bar ([#406](https://github.com/lynx-family/lynx-stack/pull/406))
16
+
3
17
  ## 0.5.1
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -4,33 +4,29 @@ It provides the custom-element implementation of Lynx Elements in Web.
4
4
 
5
5
  So far, support compared to Lynx Elements on the client:
6
6
 
7
- | Elements | Whether support | Details |
8
- | -------------- | --------------- | -------------------------------------------------------------------------------- |
9
- | Elements | | |
10
- | canvas | ❌ | No |
11
- | image | ✅ | Full Support |
12
- | list | ✅ | Only single layout type is supported, flow and waterfall will be supported later |
13
- | scroll-view | ✅ | Full Support |
14
- | text | ✅ | Full Support |
15
- | view | ✅ | Full Support |
16
- | X-Elements | | |
17
- | svg | ✅ | Full Support |
18
- | x-blur-view | ✅ | Full Support |
19
- | x-input | ✅ | Full Support |
20
- | x-textarea | ✅ | Full Support |
21
- | x-swiper | ✅ | Full Support |
22
- | x-viewpager-ng | ✅ | Full Support |
23
- | x-foldview-ng | ✅ | Full Support |
24
- | x-refresh-view | ✅ | Full Support |
25
- | x-overlay-ng | ✅ | Full Support |
26
- | x-audio-tt | ✅ | Full Support |
7
+ | Elements | Whether support | Details |
8
+ | -------------- | --------------- | ------------------------------------------------------------------------------ |
9
+ | Elements | | |
10
+ | canvas | ❌ | No |
11
+ | image | ✅ | Full Support |
12
+ | list | ✅ | list-type with single and flow are available, and waterfall is being supported |
13
+ | scroll-view | ✅ | Full Support |
14
+ | text | ✅ | Full Support |
15
+ | view | ✅ | Full Support |
16
+ | X-Elements | | |
17
+ | svg | ✅ | Full Support |
18
+ | x-blur-view | ✅ | Full Support |
19
+ | x-input | ✅ | Full Support |
20
+ | x-textarea | ✅ | Full Support |
21
+ | x-swiper | ✅ | Full Support |
22
+ | x-viewpager-ng | ✅ | Full Support |
23
+ | x-foldview-ng | ✅ | Full Support |
24
+ | x-refresh-view | ✅ | Full Support |
25
+ | x-overlay-ng | ✅ | Full Support |
26
+ | x-audio-tt | ✅ | Full Support |
27
27
 
28
28
  ## Usage
29
29
 
30
- Normally, you don't need to import `@lynx-js/web-elements` directly, because the `@lynx-js/web-core` has included it.
31
-
32
- But if you want to use it separately, you can import it like this:
33
-
34
30
  ```javascript
35
31
  import '@lynx-js/web-elements/all';
36
32
  import '@lynx-js/web-elements/index.css';
@@ -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;
@@ -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,6 @@
1
+ export declare class CommonEventsAndMethods {
2
+ #private;
3
+ static readonly observedAttributes: never[];
4
+ constructor(currentElement: HTMLElement);
5
+ __handleScrollUpperThresholdEventEnabled: (enabled: boolean) => void;
6
+ }
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -191,3 +191,17 @@ x-list[list-type="flow"][scroll-orientation="horizontal"]
191
191
  grid-row-start: 1;
192
192
  grid-row-end: calc(var(--list-item-span-count) + 1);
193
193
  }
194
+
195
+ x-list[list-type="flow"][x-enable-scrolltoupper-event]::part(upper-threshold-observer),
196
+ x-list[list-type="flow"][x-enable-scrolltoupperedge-event]::part(upper-threshold-observer),
197
+ x-list[list-type="flow"][x-enable-scrolltolower-event]::part(lower-threshold-observer),
198
+ x-list[list-type="flow"][x-enable-scrolltoloweredge-event]::part(lower-threshold-observer) {
199
+ grid-column: 1 / calc(var(--list-item-span-count) + 1);
200
+ }
201
+
202
+ x-list[list-type="flow"][scroll-orientation="horizontal"][x-enable-scrolltoupper-event]::part(upper-threshold-observer),
203
+ x-list[list-type="flow"][scroll-orientation="horizontal"][x-enable-scrolltoupperedge-event]::part(upper-threshold-observer),
204
+ x-list[list-type="flow"][scroll-orientation="horizontal"][x-enable-scrolltolower-event]::part(lower-threshold-observer),
205
+ x-list[list-type="flow"][scroll-orientation="horizontal"][x-enable-scrolltoloweredge-event]::part(lower-threshold-observer) {
206
+ grid-row: 1 / calc(var(--list-item-span-count) + 1);
207
+ }
@@ -124,6 +124,11 @@ list-item {
124
124
  min-width: 0;
125
125
  min-height: 0;
126
126
  border-style: solid;
127
+ scrollbar-width: none;
128
+ }
129
+
130
+ x-view::--webkit-scrollbar {
131
+ display: none;
127
132
  }
128
133
 
129
134
  /**