@lynx-js/web-elements 0.10.0 → 0.11.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/compat/LinearContainer/LinearContainer.d.ts +3 -1
  3. package/dist/compat/LinearContainer/LinearContainer.js +4 -39
  4. package/dist/compat/index.d.ts +1 -0
  5. package/dist/compat/index.js +2 -0
  6. package/dist/element-reactive/component.d.ts +1 -1
  7. package/dist/element-reactive/component.js +37 -26
  8. package/dist/elements/ScrollView/ScrollView.js +2 -0
  9. package/dist/elements/XFoldViewNg/XFoldviewHeaderNg.js +2 -0
  10. package/dist/elements/XFoldViewNg/XFoldviewNg.js +2 -0
  11. package/dist/elements/XFoldViewNg/XFoldviewSlotDragNg.js +2 -0
  12. package/dist/elements/XFoldViewNg/XFoldviewSlotNg.js +2 -0
  13. package/dist/elements/XFoldViewNg/XFoldviewToolbarNg.js +2 -0
  14. package/dist/elements/XList/ListItem.d.ts +1 -0
  15. package/dist/elements/XList/ListItem.js +3 -0
  16. package/dist/elements/XRefreshView/XRefreshFooter.js +2 -0
  17. package/dist/elements/XRefreshView/XRefreshHeader.js +2 -0
  18. package/dist/elements/XRefreshView/XRefreshView.js +2 -1
  19. package/dist/elements/XSwiper/SwiperItem.js +5 -1
  20. package/dist/elements/XView/XView.js +2 -0
  21. package/dist/elements/XViewpagerNg/XViewpagerItemNg.js +2 -0
  22. package/dist/elements/XViewpagerNg/XViewpagerNg.js +2 -1
  23. package/dist/elements/XWebView/XWebView.d.ts +10 -0
  24. package/dist/elements/XWebView/XWebView.js +128 -0
  25. package/dist/elements/XWebView/XWebViewAttribute.d.ts +8 -0
  26. package/dist/elements/XWebView/XWebViewAttribute.js +36 -0
  27. package/dist/elements/XWebView/index.d.ts +18 -0
  28. package/dist/elements/XWebView/index.js +22 -0
  29. package/dist/elements/all.d.ts +1 -0
  30. package/dist/elements/all.js +1 -0
  31. package/dist/elements/htmlTemplates.d.ts +1 -0
  32. package/dist/elements/htmlTemplates.js +8 -0
  33. package/index.css +16 -1
  34. package/package.json +25 -31
  35. package/src/compat/LinearContainer/linear-compat.css +66 -66
  36. package/src/elements/XList/x-list.css +20 -8
  37. package/src/elements/XWebView/x-webview.css +5 -0
  38. package/src/elements/common-css/linear.css +0 -1
  39. package/elements.css +0 -18
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat: integrate the LinearContainer Compat plugin ([#2100](https://github.com/lynx-family/lynx-stack/pull/2100))
8
+
9
+ **This is a BREAKING CHANGE**
10
+
11
+ Now we integrated the `LinearCompat` into @lynx-js/web-elements. Developers can safely remove the following imports:
12
+
13
+ ```js
14
+ import '@lynx-js/web-elements/compat/LinearContainer';
15
+ ```
16
+
17
+ ```js
18
+ import '@lynx-js/web-elements-compat/LinearContainer';
19
+ ```
20
+
21
+ ### Patch Changes
22
+
23
+ - fix: list-item `contain` property changes from `size` to `layout paint`, because the size of the `list-item` can be expanded by its children. ([#2043](https://github.com/lynx-family/lynx-stack/pull/2043))
24
+
25
+ - Use the scoped `@lynx-js/source-field` for source build resolution. ([#2096](https://github.com/lynx-family/lynx-stack/pull/2096))
26
+
27
+ ## 0.10.1
28
+
29
+ ### Patch Changes
30
+
31
+ - feat: implement x-webview component ([#2061](https://github.com/lynx-family/lynx-stack/pull/2061))
32
+
33
+ - feat: support `recyclable="false"` on `list-item` and enable overflow visibility ([#2069](https://github.com/lynx-family/lynx-stack/pull/2069))
34
+
3
35
  ## 0.10.0
4
36
 
5
37
  ### Minor Changes
@@ -1,8 +1,10 @@
1
1
  import { type AttributeReactiveClass } from '../../element-reactive/index.js';
2
2
  import '../../../src/compat/LinearContainer/linear-compat.css';
3
- export declare class LinearContainer implements InstanceType<AttributeReactiveClass<typeof HTMLElement>> {
3
+ declare class LinearContainerImpl implements InstanceType<AttributeReactiveClass<typeof HTMLElement>> {
4
4
  #private;
5
5
  static readonly observedAttributes: never[];
6
6
  static readonly observedCSSProperties: string[];
7
7
  constructor(currentElement: HTMLElement);
8
8
  }
9
+ export declare const LinearContainer: typeof LinearContainerImpl | undefined;
10
+ export {};
@@ -50,7 +50,7 @@ import '../../../src/compat/LinearContainer/linear-compat.css';
50
50
  const supportContainerStyleQuery = CSS.supports('width:1rex')
51
51
  && CSS.supports('transition-behavior:allow-discrete')
52
52
  && CSS.supports('content-visibility: auto');
53
- export class LinearContainer {
53
+ class LinearContainerImpl {
54
54
  static observedAttributes = [];
55
55
  static observedCSSProperties = [
56
56
  '--lynx-display',
@@ -68,42 +68,7 @@ export class LinearContainer {
68
68
  #setComputedDisplay = bindToAttribute(() => this.#dom, 'lynx-computed-display');
69
69
  #setLinearOrientation = bindToAttribute(() => this.#dom, 'lynx-linear-orientation');
70
70
  }
71
- /**
72
- * remove this once firefox supports @container style()
73
- * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@container
74
- * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1795622
75
- */
76
- if (!supportContainerStyleQuery) {
77
- const targetElements = new Set([
78
- 'x-view',
79
- 'scroll-view',
80
- 'x-foldview-header-ng',
81
- 'x-foldview-ng',
82
- 'x-foldview-slot-drag-ng',
83
- 'x-foldview-slot-ng',
84
- 'x-foldview-toolbar-ng',
85
- 'x-refresh-footer',
86
- 'x-refresh-header',
87
- 'x-refresh-view',
88
- 'x-swiper-item',
89
- 'x-viewpager-item-ng',
90
- 'x-viewpager-ng',
91
- ]);
92
- const realDefine = customElements.define.bind(customElements);
93
- const fakeDefine = (name, cls, options) => {
94
- if (targetElements.has(name)) {
95
- cls.registerPlugin?.(LinearContainer);
96
- targetElements.delete(name);
97
- }
98
- realDefine(name, cls, options);
99
- };
100
- customElements.define = fakeDefine;
101
- for (const tag of targetElements) {
102
- (customElements.whenDefined(tag)).then((cls) => {
103
- if (targetElements.has(tag)) {
104
- cls.registerPlugin?.(LinearContainer);
105
- }
106
- });
107
- }
108
- }
71
+ export const LinearContainer = supportContainerStyleQuery
72
+ ? undefined
73
+ : LinearContainerImpl;
109
74
  //# sourceMappingURL=LinearContainer.js.map
@@ -0,0 +1 @@
1
+ export { LinearContainer } from './LinearContainer/LinearContainer.js';
@@ -0,0 +1,2 @@
1
+ export { LinearContainer } from './LinearContainer/LinearContainer.js';
2
+ //# sourceMappingURL=index.js.map
@@ -40,4 +40,4 @@ export type AttributeReactiveObject = {
40
40
  dispose?(): void;
41
41
  connectedCallback?(): void;
42
42
  };
43
- export declare function Component<T extends WebComponentClass>(tag: string, attributeReactiveClasses: AttributeReactiveClass<T>[], template?: string): (target: T, context: ClassDecoratorContext<T>) => T;
43
+ export declare function Component<T extends WebComponentClass>(tag: string, attributeReactiveClassesOptional: (AttributeReactiveClass<T> | undefined)[], template?: string): (target: T, context: ClassDecoratorContext<T>) => T;
@@ -7,8 +7,9 @@ function convertStyleWithPriority(value, priority) {
7
7
  return value;
8
8
  }
9
9
  }
10
- export function Component(tag, attributeReactiveClasses, template) {
10
+ export function Component(tag, attributeReactiveClassesOptional, template) {
11
11
  let templateElement;
12
+ const attributeReactiveClasses = attributeReactiveClassesOptional.filter((e) => Boolean(e));
12
13
  return (target, { addInitializer }) => {
13
14
  const observedStyleProperties = new Set([
14
15
  ...attributeReactiveClasses
@@ -158,52 +159,62 @@ export function Component(tag, attributeReactiveClasses, template) {
158
159
  });
159
160
  }
160
161
  #eventListenerMap = {};
161
- addEventListener(type, listener, options) {
162
- super.addEventListener(type, listener, options);
163
- this.#eventListenerMap[type] ??= {
162
+ enableEvent(eventName) {
163
+ this.#eventListenerMap[eventName] ??= {
164
164
  count: 0,
165
165
  listenerCount: new WeakMap(),
166
166
  captureListenerCount: new WeakMap(),
167
167
  };
168
- const targetEventInfo = this.#eventListenerMap[type];
169
- const capture = typeof options === 'object' ? options.capture : options;
170
- const targetMap = capture
171
- ? targetEventInfo.captureListenerCount
172
- : targetEventInfo.listenerCount;
173
- const currentListenerCount = targetMap.get(listener) ?? 0;
174
- targetMap.set(listener, currentListenerCount + 1);
168
+ const targetEventInfo = this.#eventListenerMap[eventName];
175
169
  if (targetEventInfo.count === 0) {
176
170
  // trigger eventStatusChangeHandler
177
171
  for (const oneReactive of this.#attributeReactives) {
178
- const handler = oneReactive.eventStatusChangedHandler?.[type];
172
+ const handler = oneReactive.eventStatusChangedHandler?.[eventName];
179
173
  if (handler) {
180
- handler.call(oneReactive, true, type);
174
+ handler.call(oneReactive, true, eventName);
181
175
  }
182
176
  }
183
177
  }
184
178
  targetEventInfo.count++;
185
179
  }
180
+ disableEvent(eventName) {
181
+ const targetEventInfo = this.#eventListenerMap[eventName];
182
+ if (targetEventInfo && targetEventInfo.count > 0) {
183
+ targetEventInfo.count--;
184
+ if (targetEventInfo.count === 0) {
185
+ // trigger eventStatusChangeHandler
186
+ for (const oneReactive of this.#attributeReactives) {
187
+ const handler = oneReactive.eventStatusChangedHandler?.[eventName];
188
+ if (handler) {
189
+ handler.call(oneReactive, false, eventName);
190
+ }
191
+ }
192
+ }
193
+ }
194
+ }
195
+ addEventListener(type, listener, options) {
196
+ super.addEventListener(type, listener, options);
197
+ this.enableEvent(type);
198
+ const targetEventInfo = this.#eventListenerMap[type];
199
+ const capture = typeof options === 'object' ? options.capture : options;
200
+ const targetMap = capture
201
+ ? targetEventInfo.captureListenerCount
202
+ : targetEventInfo.listenerCount;
203
+ const currentListenerCount = targetMap.get(listener) ?? 0;
204
+ targetMap.set(listener, currentListenerCount + 1);
205
+ }
186
206
  removeEventListener(type, listener, options) {
187
207
  super.removeEventListener(type, listener, options);
188
208
  const capture = typeof options === 'object' ? options.capture : options;
189
209
  const targetEventInfo = this.#eventListenerMap[type];
190
210
  if (targetEventInfo && targetEventInfo.count > 0) {
191
211
  const targetMap = capture
192
- ? targetEventInfo?.captureListenerCount
193
- : targetEventInfo?.listenerCount;
212
+ ? targetEventInfo.captureListenerCount
213
+ : targetEventInfo.listenerCount;
194
214
  const currentListenerCount = targetMap.get(listener);
195
215
  if (currentListenerCount === 1) {
196
- targetEventInfo.listenerCount.delete(listener);
197
- targetEventInfo.count--;
198
- if (targetEventInfo.count === 0) {
199
- // trigger eventStatusChangeHandler
200
- for (const oneReactive of this.#attributeReactives) {
201
- const handler = oneReactive.eventStatusChangedHandler?.[type];
202
- if (handler) {
203
- handler.call(oneReactive, false, type);
204
- }
205
- }
206
- }
216
+ targetMap.delete(listener);
217
+ this.disableEvent(type);
207
218
  }
208
219
  }
209
220
  }
@@ -12,8 +12,10 @@ import { ScrollIntoView } from './ScrollIntoView.js';
12
12
  import { Component } from '../../element-reactive/index.js';
13
13
  import { scrollContainerDom } from '../common/constants.js';
14
14
  import { templateScrollView } from '../htmlTemplates.js';
15
+ import { LinearContainer } from '../../compat/index.js';
15
16
  let ScrollView = (() => {
16
17
  let _classDecorators = [Component('scroll-view', [
18
+ LinearContainer,
17
19
  CommonEventsAndMethods,
18
20
  ScrollAttributes,
19
21
  FadeEdgeLengthAttribute,
@@ -8,8 +8,10 @@ import { Component } from '../../element-reactive/index.js';
8
8
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { resizeObserver } from './XFoldviewNg.js';
10
10
  import { getCombinedDirectParentElement } from '../common/getCombinedParentElement.js';
11
+ import { LinearContainer } from '../../compat/index.js';
11
12
  let XFoldviewHeaderNg = (() => {
12
13
  let _classDecorators = [Component('x-foldview-header-ng', [
14
+ LinearContainer,
13
15
  CommonEventsAndMethods,
14
16
  ])];
15
17
  let _classDescriptor;
@@ -8,12 +8,14 @@ import { Component } from '../../element-reactive/index.js';
8
8
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { XFoldviewNgEvents } from './XFoldviewNgEvents.js';
10
10
  import { scrollContainerDom } from '../common/constants.js';
11
+ import { LinearContainer } from '../../compat/index.js';
11
12
  export const scrollableLength = Symbol('scrollableLength');
12
13
  export const isHeaderShowing = Symbol('isHeaderShowing');
13
14
  export const resizeObserver = Symbol('resizeObserver');
14
15
  export const slotKid = Symbol('slotKid');
15
16
  let XFoldviewNg = (() => {
16
17
  let _classDecorators = [Component('x-foldview-ng', [
18
+ LinearContainer,
17
19
  CommonEventsAndMethods,
18
20
  XFoldviewNgEvents,
19
21
  ])];
@@ -6,8 +6,10 @@ import { __esDecorate, __runInitializers } from "tslib";
6
6
  */
7
7
  import { Component } from '../../element-reactive/index.js';
8
8
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
+ import { LinearContainer } from '../../compat/index.js';
9
10
  let XFoldviewSlotDragNg = (() => {
10
11
  let _classDecorators = [Component('x-foldview-slot-drag-ng', [
12
+ LinearContainer,
11
13
  CommonEventsAndMethods,
12
14
  ])];
13
15
  let _classDescriptor;
@@ -8,8 +8,10 @@ import { Component } from '../../element-reactive/index.js';
8
8
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { XFoldviewSlotNgTouchEventsHandler } from './XFoldviewSlotNgTouchEventsHandler.js';
10
10
  import { slotKid } from './XFoldviewNg.js';
11
+ import { LinearContainer } from '../../compat/index.js';
11
12
  let XFoldviewSlotNg = (() => {
12
13
  let _classDecorators = [Component('x-foldview-slot-ng', [
14
+ LinearContainer,
13
15
  CommonEventsAndMethods,
14
16
  XFoldviewSlotNgTouchEventsHandler,
15
17
  ])];
@@ -8,8 +8,10 @@ import { Component } from '../../element-reactive/index.js';
8
8
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { resizeObserver } from './XFoldviewNg.js';
10
10
  import { getCombinedDirectParentElement } from '../common/getCombinedParentElement.js';
11
+ import { LinearContainer } from '../../compat/index.js';
11
12
  let XFoldviewToolbarNg = (() => {
12
13
  let _classDecorators = [Component('x-foldview-toolbar-ng', [
14
+ LinearContainer,
13
15
  CommonEventsAndMethods,
14
16
  ])];
15
17
  let _classDescriptor;
@@ -1,2 +1,3 @@
1
1
  export declare class ListItem extends HTMLElement {
2
+ static readonly notToFilterFalseAttributes: Set<string>;
2
3
  }
@@ -23,6 +23,9 @@ let ListItem = (() => {
23
23
  __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
24
24
  ListItem = _classThis = _classDescriptor.value;
25
25
  if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
26
+ }
27
+ static notToFilterFalseAttributes = new Set(['recyclable']);
28
+ static {
26
29
  __runInitializers(_classThis, _classExtraInitializers);
27
30
  }
28
31
  };
@@ -7,8 +7,10 @@ import { __esDecorate, __runInitializers } from "tslib";
7
7
  import { Component } from '../../element-reactive/index.js';
8
8
  import { XRefreshSubElementIntersectionObserver } from './XRefreshSubElementIntersectionObserver.js';
9
9
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
10
+ import { LinearContainer } from '../../compat/index.js';
10
11
  let XRefreshFooter = (() => {
11
12
  let _classDecorators = [Component('x-refresh-footer', [
13
+ LinearContainer,
12
14
  CommonEventsAndMethods,
13
15
  XRefreshSubElementIntersectionObserver,
14
16
  ])];
@@ -7,8 +7,10 @@ import { __esDecorate, __runInitializers } from "tslib";
7
7
  import { Component } from '../../element-reactive/index.js';
8
8
  import { XRefreshSubElementIntersectionObserver } from './XRefreshSubElementIntersectionObserver.js';
9
9
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
10
+ import { LinearContainer } from '../../compat/index.js';
10
11
  let XRefreshHeader = (() => {
11
12
  let _classDecorators = [Component('x-refresh-header', [
13
+ LinearContainer,
12
14
  CommonEventsAndMethods,
13
15
  XRefreshSubElementIntersectionObserver,
14
16
  ])];
@@ -9,8 +9,9 @@ import { XRefreshViewEventsEmitter } from './XRefreshViewEventsEmitter.js';
9
9
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
10
10
  import { scrollContainerDom } from '../common/constants.js';
11
11
  import { templateXRefreshView } from '../htmlTemplates.js';
12
+ import { LinearContainer } from '../../compat/index.js';
12
13
  let XRefreshView = (() => {
13
- let _classDecorators = [Component('x-refresh-view', [CommonEventsAndMethods, XRefreshViewEventsEmitter], templateXRefreshView)];
14
+ let _classDecorators = [Component('x-refresh-view', [LinearContainer, CommonEventsAndMethods, XRefreshViewEventsEmitter], templateXRefreshView)];
14
15
  let _classDescriptor;
15
16
  let _classExtraInitializers = [];
16
17
  let _classThis;
@@ -6,8 +6,12 @@ import { __esDecorate, __runInitializers } from "tslib";
6
6
  */
7
7
  import { Component } from '../../element-reactive/index.js';
8
8
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
+ import { LinearContainer } from '../../compat/index.js';
9
10
  let SwiperItem = (() => {
10
- let _classDecorators = [Component('x-swiper-item', [CommonEventsAndMethods])];
11
+ let _classDecorators = [Component('x-swiper-item', [
12
+ LinearContainer,
13
+ CommonEventsAndMethods,
14
+ ])];
11
15
  let _classDescriptor;
12
16
  let _classExtraInitializers = [];
13
17
  let _classThis;
@@ -7,8 +7,10 @@ import { __esDecorate, __runInitializers } from "tslib";
7
7
  import { Component } from '../../element-reactive/index.js';
8
8
  import { ScrollIntoView } from '../ScrollView/ScrollIntoView.js';
9
9
  import { CommonEventsAndMethods, layoutChangeTarget, } from '../common/CommonEventsAndMethods.js';
10
+ import { LinearContainer } from '../../compat/index.js';
10
11
  let XView = (() => {
11
12
  let _classDecorators = [Component('x-view', [
13
+ LinearContainer,
12
14
  CommonEventsAndMethods,
13
15
  ])];
14
16
  let _classDescriptor;
@@ -6,8 +6,10 @@ import { __esDecorate, __runInitializers } from "tslib";
6
6
  */
7
7
  import { Component } from '../../element-reactive/index.js';
8
8
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
+ import { LinearContainer } from '../../compat/index.js';
9
10
  let XViewpagerItemNg = (() => {
10
11
  let _classDecorators = [Component('x-viewpager-item-ng', [
12
+ LinearContainer,
11
13
  CommonEventsAndMethods,
12
14
  ])];
13
15
  let _classDescriptor;
@@ -9,8 +9,9 @@ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { XViewpagerNgEvents } from './XViewpagerNgEvents.js';
10
10
  import { scrollContainerDom } from '../common/constants.js';
11
11
  import { templateXViewpageNg } from '../htmlTemplates.js';
12
+ import { LinearContainer } from '../../compat/index.js';
12
13
  let XViewpagerNg = (() => {
13
- let _classDecorators = [Component('x-viewpager-ng', [CommonEventsAndMethods, XViewpagerNgEvents], templateXViewpageNg)];
14
+ let _classDecorators = [Component('x-viewpager-ng', [LinearContainer, CommonEventsAndMethods, XViewpagerNgEvents], templateXViewpageNg)];
14
15
  let _classDescriptor;
15
16
  let _classExtraInitializers = [];
16
17
  let _classThis;
@@ -0,0 +1,10 @@
1
+ export declare class XWebView extends HTMLElement {
2
+ #private;
3
+ connectedCallback(): void;
4
+ disconnectedCallback(): void;
5
+ get src(): string | null;
6
+ set src(val: string | null);
7
+ get html(): string | null;
8
+ set html(val: string | null);
9
+ reload(): void;
10
+ }
@@ -0,0 +1,128 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ /*
3
+ // Copyright 2024 The Lynx Authors. All rights reserved.
4
+ // Licensed under the Apache License Version 2.0 that can be found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { Component, genDomGetter } from '../../element-reactive/index.js';
8
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
+ import { templateXWebView } from '../htmlTemplates.js';
10
+ import { XWebViewAttribute } from './XWebViewAttribute.js';
11
+ let XWebView = (() => {
12
+ let _classDecorators = [Component('x-webview', [CommonEventsAndMethods, XWebViewAttribute], templateXWebView)];
13
+ let _classDescriptor;
14
+ let _classExtraInitializers = [];
15
+ let _classThis;
16
+ let _classSuper = HTMLElement;
17
+ var XWebView = class extends _classSuper {
18
+ static { _classThis = this; }
19
+ static {
20
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
21
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
22
+ XWebView = _classThis = _classDescriptor.value;
23
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
24
+ __runInitializers(_classThis, _classExtraInitializers);
25
+ }
26
+ #getWebView = genDomGetter(() => this.shadowRoot, '#webview');
27
+ /**
28
+ * @internal
29
+ */
30
+ #handleLoad = () => {
31
+ this.dispatchEvent(new CustomEvent('load', {
32
+ bubbles: true,
33
+ composed: true,
34
+ detail: {
35
+ url: this.#getWebView().src,
36
+ },
37
+ }));
38
+ this.dispatchEvent(new CustomEvent('bindload', {
39
+ bubbles: true,
40
+ composed: true,
41
+ detail: {
42
+ url: this.#getWebView().src,
43
+ },
44
+ }));
45
+ };
46
+ /**
47
+ * @internal
48
+ */
49
+ #handleError = (e) => {
50
+ this.dispatchEvent(new CustomEvent('error', {
51
+ bubbles: true,
52
+ composed: true,
53
+ detail: {
54
+ errorMsg: e.message || 'unknown error',
55
+ },
56
+ }));
57
+ this.dispatchEvent(new CustomEvent('binderror', {
58
+ bubbles: true,
59
+ composed: true,
60
+ detail: {
61
+ errorMsg: e.message || 'unknown error',
62
+ },
63
+ }));
64
+ };
65
+ /**
66
+ * @internal
67
+ */
68
+ #handleMessage = (e) => {
69
+ if (e.source !== this.#getWebView().contentWindow) {
70
+ return;
71
+ }
72
+ this.dispatchEvent(new CustomEvent('message', {
73
+ bubbles: true,
74
+ composed: true,
75
+ detail: {
76
+ msg: e.data, // compatible with bindmessage
77
+ data: e.data, // standard CustomEvent
78
+ },
79
+ }));
80
+ this.dispatchEvent(new CustomEvent('bindmessage', {
81
+ bubbles: true,
82
+ composed: true,
83
+ detail: {
84
+ msg: e.data,
85
+ },
86
+ }));
87
+ };
88
+ connectedCallback() {
89
+ this.#getWebView().addEventListener('load', this.#handleLoad);
90
+ this.#getWebView().addEventListener('error', this.#handleError);
91
+ window.addEventListener('message', this.#handleMessage);
92
+ }
93
+ disconnectedCallback() {
94
+ this.#getWebView().removeEventListener('load', this.#handleLoad);
95
+ this.#getWebView().removeEventListener('error', this.#handleError);
96
+ window.removeEventListener('message', this.#handleMessage);
97
+ }
98
+ get src() {
99
+ return this.getAttribute('src');
100
+ }
101
+ set src(val) {
102
+ if (val === null) {
103
+ this.removeAttribute('src');
104
+ }
105
+ else {
106
+ this.setAttribute('src', val);
107
+ }
108
+ }
109
+ get html() {
110
+ return this.getAttribute('html');
111
+ }
112
+ set html(val) {
113
+ if (val === null) {
114
+ this.removeAttribute('html');
115
+ }
116
+ else {
117
+ this.setAttribute('html', val);
118
+ }
119
+ }
120
+ reload() {
121
+ // eslint-disable-next-line no-self-assign
122
+ this.#getWebView().src = this.#getWebView().src;
123
+ }
124
+ };
125
+ return XWebView = _classThis;
126
+ })();
127
+ export { XWebView };
128
+ //# sourceMappingURL=XWebView.js.map
@@ -0,0 +1,8 @@
1
+ import { type AttributeReactiveClass } from '../../element-reactive/index.js';
2
+ export declare class XWebViewAttribute implements InstanceType<AttributeReactiveClass<typeof HTMLElement>> {
3
+ #private;
4
+ static observedAttributes: string[];
5
+ constructor(dom: HTMLElement);
6
+ _handleSrc: (this: void, newVal: string | null) => void;
7
+ _handleHtml: (this: void, newVal: string | null) => void;
8
+ }
@@ -0,0 +1,36 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ /*
3
+ // Copyright 2024 The Lynx Authors. All rights reserved.
4
+ // Licensed under the Apache License Version 2.0 that can be found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { bindToAttribute, genDomGetter, registerAttributeHandler, } from '../../element-reactive/index.js';
8
+ let XWebViewAttribute = (() => {
9
+ let __handleSrc_decorators;
10
+ let __handleSrc_initializers = [];
11
+ let __handleSrc_extraInitializers = [];
12
+ let __handleHtml_decorators;
13
+ let __handleHtml_initializers = [];
14
+ let __handleHtml_extraInitializers = [];
15
+ return class XWebViewAttribute {
16
+ static {
17
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
18
+ __handleSrc_decorators = [registerAttributeHandler('src', true)];
19
+ __handleHtml_decorators = [registerAttributeHandler('html', true)];
20
+ __esDecorate(null, null, __handleSrc_decorators, { kind: "field", name: "_handleSrc", static: false, private: false, access: { has: obj => "_handleSrc" in obj, get: obj => obj._handleSrc, set: (obj, value) => { obj._handleSrc = value; } }, metadata: _metadata }, __handleSrc_initializers, __handleSrc_extraInitializers);
21
+ __esDecorate(null, null, __handleHtml_decorators, { kind: "field", name: "_handleHtml", static: false, private: false, access: { has: obj => "_handleHtml" in obj, get: obj => obj._handleHtml, set: (obj, value) => { obj._handleHtml = value; } }, metadata: _metadata }, __handleHtml_initializers, __handleHtml_extraInitializers);
22
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
23
+ }
24
+ static observedAttributes = ['src', 'html'];
25
+ #dom;
26
+ #getWebView = genDomGetter(() => this.#dom.shadowRoot, '#webview');
27
+ constructor(dom) {
28
+ __runInitializers(this, __handleHtml_extraInitializers);
29
+ this.#dom = dom;
30
+ }
31
+ _handleSrc = __runInitializers(this, __handleSrc_initializers, bindToAttribute(this.#getWebView, 'src'));
32
+ _handleHtml = (__runInitializers(this, __handleSrc_extraInitializers), __runInitializers(this, __handleHtml_initializers, bindToAttribute(this.#getWebView, 'srcdoc')));
33
+ };
34
+ })();
35
+ export { XWebViewAttribute };
36
+ //# sourceMappingURL=XWebViewAttribute.js.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @module elements/XWebView
3
+ *
4
+ * `x-webview` provides a web container that allows loading web pages.
5
+ *
6
+ * Attributes:
7
+ * - `src`: The URL of the web page to load.
8
+ * - `html`: The HTML content to load (via srcdoc).
9
+ *
10
+ * Events:
11
+ * - `bindload`: Fired when the page loads. Detail: `{ url }`.
12
+ * - `binderror`: Fired when an error occurs. Detail: `{ errorMsg }`.
13
+ * - `bindmessage`: Fired when a message is received from the page. Detail: `{ msg }`.
14
+ *
15
+ * Methods:
16
+ * - `reload()`: Reloads the current page.
17
+ */
18
+ export { XWebView } from './XWebView.js';
@@ -0,0 +1,22 @@
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
+ /**
5
+ * @module elements/XWebView
6
+ *
7
+ * `x-webview` provides a web container that allows loading web pages.
8
+ *
9
+ * Attributes:
10
+ * - `src`: The URL of the web page to load.
11
+ * - `html`: The HTML content to load (via srcdoc).
12
+ *
13
+ * Events:
14
+ * - `bindload`: Fired when the page loads. Detail: `{ url }`.
15
+ * - `binderror`: Fired when an error occurs. Detail: `{ errorMsg }`.
16
+ * - `bindmessage`: Fired when a message is received from the page. Detail: `{ msg }`.
17
+ *
18
+ * Methods:
19
+ * - `reload()`: Reloads the current page.
20
+ */
21
+ export { XWebView } from './XWebView.js';
22
+ //# sourceMappingURL=index.js.map
@@ -15,3 +15,4 @@ import './XView/index.js';
15
15
  import './XViewpagerNg/index.js';
16
16
  import './XList/index.js';
17
17
  import './XList/ListItem.js';
18
+ import './XWebView/index.js';
@@ -15,4 +15,5 @@ import './XView/index.js';
15
15
  import './XViewpagerNg/index.js';
16
16
  import './XList/index.js';
17
17
  import './XList/ListItem.js';
18
+ import './XWebView/index.js';
18
19
  //# sourceMappingURL=all.js.map
@@ -17,4 +17,5 @@ export declare const templateInlineImage: (attributes: {
17
17
  }) => string;
18
18
  export declare const templateXTextarea = "<style>\n #textarea:focus,\n #textarea:focus-visible {\n border: inherit;\n outline: inherit;\n }\n</style>\n<form id=\"form\" part=\"form\" method=\"dialog\">\n <textarea id=\"textarea\" part=\"textarea\"></textarea>\n</form>";
19
19
  export declare const templateXViewpageNg = "<style>\n #bounce-padding {\n display: none;\n flex: 0 0 0;\n align-self: stretch;\n scroll-snap-align: none;\n flex-basis: 100%;\n }\n #content {\n flex: 0 0 100%;\n flex-direction: row;\n align-self: stretch;\n display: inherit;\n justify-content: inherit;\n align-items: inherit;\n overflow: inherit;\n scrollbar-width: none;\n scroll-snap-type: inherit;\n }\n #content::-webkit-scrollbar {\n display: none;\n }\n</style>\n<div id=\"bounce-padding\" part=\"bounce-padding\"></div>\n<div id=\"content\" part=\"content\">\n <slot></slot>\n</div>";
20
+ export declare const templateXWebView = "<style>\n iframe {\n width: 100%;\n height: 100%;\n border: none;\n }\n</style>\n<iframe id=\"webview\" part=\"webview\"></iframe>";
20
21
  export declare const templateXSvg: () => string;
@@ -326,6 +326,14 @@ export const templateXViewpageNg = `<style>
326
326
  <div id="content" part="content">
327
327
  <slot></slot>
328
328
  </div>`;
329
+ export const templateXWebView = `<style>
330
+ iframe {
331
+ width: 100%;
332
+ height: 100%;
333
+ border: none;
334
+ }
335
+ </style>
336
+ <iframe id="webview" part="webview"></iframe>`;
329
337
  export const templateXSvg = () => {
330
338
  return `<img part="img" alt="" loading="lazy" id="img" /> `;
331
339
  };
package/index.css CHANGED
@@ -2,5 +2,20 @@
2
2
  Licensed under the Apache License Version 2.0 that can be found in the
3
3
  LICENSE file in the root directory of this source tree.
4
4
  */
5
+ @import url("./src/compat/LinearContainer/linear-compat.css");
5
6
  @import url("./src/elements/common-css/linear.css");
6
- @import url("./elements.css");
7
+ @import url("./src/elements/LynxWrapper/lynx-wrapper.css");
8
+ @import url("./src/elements/XText/x-text.css");
9
+ @import url("./src/elements/ScrollView/scroll-view.css");
10
+ @import url("./src/elements/XFoldViewNg/x-foldview-ng.css");
11
+ @import url("./src/elements/XViewpagerNg/x-viewpager-ng.css");
12
+ @import url("./src/elements/XCanvas/x-canvas.css");
13
+ @import url("./src/elements/XSvg/x-svg.css");
14
+ @import url("./src/elements/XImage/x-image.css");
15
+ @import url("./src/elements/XInput/x-input.css");
16
+ @import url("./src/elements/XOverlayNg/x-overlay-ng.css");
17
+ @import url("./src/elements/XRefreshView/x-refresh-view.css");
18
+ @import url("./src/elements/XSwiper/x-swiper.css");
19
+ @import url("./src/elements/XTextarea/x-textarea.css");
20
+ @import url("./src/elements/XList/x-list.css");
21
+ @import url("./src/elements/XWebView/x-webview.css");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,106 +18,100 @@
18
18
  "./index.css": {
19
19
  "default": "./index.css"
20
20
  },
21
- "./elements.css": {
22
- "default": "./elements.css"
23
- },
24
21
  "./all": {
25
- "source": "./src/elements/all.ts",
22
+ "@lynx-js/source-field": "./src/elements/all.ts",
26
23
  "types": "./dist/elements/all.d.ts",
27
24
  "default": "./dist/elements/all.js"
28
25
  },
29
26
  "./LynxWrapper": {
30
- "source": "./src/elements/LynxWrapper/index.ts",
27
+ "@lynx-js/source-field": "./src/elements/LynxWrapper/index.ts",
31
28
  "types": "./dist/elements/LynxWrapper/index.d.ts",
32
29
  "default": "./dist/elements/LynxWrapper/index.js"
33
30
  },
34
31
  "./ScrollView": {
35
- "source": "./src/elements/ScrollView/index.ts",
32
+ "@lynx-js/source-field": "./src/elements/ScrollView/index.ts",
36
33
  "types": "./dist/elements/ScrollView/index.d.ts",
37
34
  "default": "./dist/elements/ScrollView/index.js"
38
35
  },
39
36
  "./XAudioTT": {
40
- "source": "./src/elements/XAudioTT/index.ts",
37
+ "@lynx-js/source-field": "./src/elements/XAudioTT/index.ts",
41
38
  "types": "./dist/elements/XAudioTT/index.d.ts",
42
39
  "default": "./dist/elements/XAudioTT/index.js"
43
40
  },
44
41
  "./XCanvas": {
45
- "source": "./src/elements/XCanvas/index.ts",
42
+ "@lynx-js/source-field": "./src/elements/XCanvas/index.ts",
46
43
  "types": "./dist/elements/XCanvas/index.d.ts",
47
44
  "default": "./dist/elements/XCanvas/index.js"
48
45
  },
49
46
  "./XFoldViewNg": {
50
- "source": "./src/elements/XFoldViewNg/index.ts",
47
+ "@lynx-js/source-field": "./src/elements/XFoldViewNg/index.ts",
51
48
  "types": "./dist/elements/XFoldViewNg/index.d.ts",
52
49
  "default": "./dist/elements/XFoldViewNg/index.js"
53
50
  },
54
51
  "./XImage": {
55
- "source": "./src/elements/XImage/index.ts",
52
+ "@lynx-js/source-field": "./src/elements/XImage/index.ts",
56
53
  "types": "./dist/elements/XImage/index.d.ts",
57
54
  "default": "./dist/elements/XImage/index.js"
58
55
  },
59
56
  "./XInput": {
60
- "source": "./src/elements/XInput/index.ts",
57
+ "@lynx-js/source-field": "./src/elements/XInput/index.ts",
61
58
  "types": "./dist/elements/XInput/index.d.ts",
62
59
  "default": "./dist/elements/XInput/index.js"
63
60
  },
64
61
  "./XOverlayNg": {
65
- "source": "./src/elements/XOverlayNg/index.ts",
62
+ "@lynx-js/source-field": "./src/elements/XOverlayNg/index.ts",
66
63
  "types": "./dist/elements/XOverlayNg/index.d.ts",
67
64
  "default": "./dist/elements/XOverlayNg/index.js"
68
65
  },
69
66
  "./XRefreshView": {
70
- "source": "./src/elements/XRefreshView/index.ts",
67
+ "@lynx-js/source-field": "./src/elements/XRefreshView/index.ts",
71
68
  "types": "./dist/elements/XRefreshView/index.d.ts",
72
69
  "default": "./dist/elements/XRefreshView/index.js"
73
70
  },
74
71
  "./XSvg": {
75
- "source": "./src/elements/XSvg/index.ts",
72
+ "@lynx-js/source-field": "./src/elements/XSvg/index.ts",
76
73
  "types": "./dist/elements/XSvg/index.d.ts",
77
74
  "default": "./dist/elements/XSvg/index.js"
78
75
  },
79
76
  "./XSwiper": {
80
- "source": "./src/elements/XSwiper/index.ts",
77
+ "@lynx-js/source-field": "./src/elements/XSwiper/index.ts",
81
78
  "types": "./dist/elements/XSwiper/index.d.ts",
82
79
  "default": "./dist/elements/XSwiper/index.js"
83
80
  },
84
81
  "./XText": {
85
- "source": "./src/elements/XText/index.ts",
82
+ "@lynx-js/source-field": "./src/elements/XText/index.ts",
86
83
  "types": "./dist/elements/XText/index.d.ts",
87
84
  "default": "./dist/elements/XText/index.js"
88
85
  },
89
86
  "./XTextarea": {
90
- "source": "./src/elements/XTextarea/index.ts",
87
+ "@lynx-js/source-field": "./src/elements/XTextarea/index.ts",
91
88
  "types": "./dist/elements/XTextarea/index.d.ts",
92
89
  "default": "./dist/elements/XTextarea/index.js"
93
90
  },
94
91
  "./XView": {
95
- "source": "./src/elements/XView/index.ts",
92
+ "@lynx-js/source-field": "./src/elements/XView/index.ts",
96
93
  "types": "./dist/elements/XView/index.d.ts",
97
94
  "default": "./dist/elements/XView/index.js"
98
95
  },
99
96
  "./XViewpagerNg": {
100
- "source": "./src/elements/XViewpagerNg/index.ts",
97
+ "@lynx-js/source-field": "./src/elements/XViewpagerNg/index.ts",
101
98
  "types": "./dist/elements/XViewpagerNg/index.d.ts",
102
99
  "default": "./dist/elements/XViewpagerNg/index.js"
103
100
  },
104
101
  "./XList": {
105
- "source": "./src/elements/XList/index.ts",
102
+ "@lynx-js/source-field": "./src/elements/XList/index.ts",
106
103
  "types": "./dist/elements/XList/index.d.ts",
107
104
  "default": "./dist/elements/XList/index.js"
108
105
  },
106
+ "./XWebView": {
107
+ "@lynx-js/source-field": "./src/elements/XWebView/index.ts",
108
+ "types": "./dist/elements/XWebView/index.d.ts",
109
+ "default": "./dist/elements/XWebView/index.js"
110
+ },
109
111
  "./html-templates": {
110
- "source": "./src/elements/htmlTemplates.ts",
112
+ "@lynx-js/source-field": "./src/elements/htmlTemplates.ts",
111
113
  "types": "./dist/elements/htmlTemplates.d.ts",
112
114
  "default": "./dist/elements/htmlTemplates.js"
113
- },
114
- "./compat/LinearContainer": {
115
- "source": "./src/compat/LinearContainer/LinearContainer.ts",
116
- "types": "./dist/compat/LinearContainer/LinearContainer.d.ts",
117
- "default": "./dist/compat/LinearContainer/LinearContainer.js"
118
- },
119
- "./compat/LinearContainer/linear-compat.css": {
120
- "default": "./src/compat/LinearContainer/linear-compat.css"
121
115
  }
122
116
  },
123
117
  "main": "dist/index.js",
@@ -134,7 +128,7 @@
134
128
  ],
135
129
  "devDependencies": {
136
130
  "@playwright/test": "^1.57.0",
137
- "@rsbuild/core": "1.6.13",
131
+ "@rsbuild/core": "1.7.1",
138
132
  "@rsbuild/plugin-source-build": "^1.0.3",
139
133
  "nyc": "^17.1.0",
140
134
  "tslib": "^2.8.1",
@@ -47,78 +47,78 @@
47
47
  --flex-wrap: nowrap;
48
48
  --align-self: auto;
49
49
  }
50
- }
51
- [lynx-computed-display="linear"] {
52
- flex-wrap: nowrap !important;
53
- flex-direction: column;
54
- justify-content: flex-start;
55
- }
50
+ [lynx-computed-display="linear"] {
51
+ flex-wrap: nowrap !important;
52
+ flex-direction: column;
53
+ justify-content: flex-start;
54
+ }
56
55
 
57
- [lynx-computed-display="flex"] {
58
- flex-direction: var(--flex-direction);
59
- justify-content: var(--justify-content);
60
- flex-wrap: var(--flex-wrap);
61
- }
56
+ [lynx-computed-display="flex"] {
57
+ flex-direction: var(--flex-direction);
58
+ justify-content: var(--justify-content);
59
+ flex-wrap: var(--flex-wrap);
60
+ }
62
61
 
63
- [lynx-computed-display="flex"] > *,
64
- [lynx-computed-display="flex"] > lynx-wrapper > * {
65
- flex: var(
66
- --flex,
67
- var(--flex-grow) var(--flex-shrink) var(--flex-basis)
68
- );
69
- }
70
- [lynx-computed-display="linear"] > *,
71
- [lynx-computed-display="linear"] > lynx-wrapper > * {
72
- flex-shrink: 0 !important;
73
- flex-grow: calc(
74
- var(--lynx-linear-weight) /
75
- calc(
76
- var(--lynx-linear-weight-sum) +
77
- (
78
- 1 - clamp(0, var(--lynx-linear-weight-sum) * 999999, 1)
62
+ [lynx-computed-display="flex"] > *,
63
+ [lynx-computed-display="flex"] > lynx-wrapper > * {
64
+ flex: var(
65
+ --flex,
66
+ var(--flex-grow) var(--flex-shrink) var(--flex-basis)
67
+ );
68
+ }
69
+ [lynx-computed-display="linear"] > *,
70
+ [lynx-computed-display="linear"] > lynx-wrapper > * {
71
+ flex-shrink: 0 !important;
72
+ flex-grow: calc(
73
+ var(--lynx-linear-weight) /
74
+ calc(
75
+ var(--lynx-linear-weight-sum) +
76
+ (
77
+ 1 - clamp(0, var(--lynx-linear-weight-sum) * 999999, 1)
78
+ )
79
79
  )
80
- )
81
- ) !important;
82
- flex-basis: var(--lynx-linear-weight-basis) !important;
83
- }
80
+ ) !important;
81
+ flex-basis: var(--lynx-linear-weight-basis) !important;
82
+ }
84
83
 
85
- [lynx-computed-display="linear"][lynx-linear-orientation="vertical"] {
86
- flex-direction: column !important;
87
- justify-content: var(--justify-content-column);
88
- }
84
+ [lynx-computed-display="linear"][lynx-linear-orientation="vertical"] {
85
+ flex-direction: column !important;
86
+ justify-content: var(--justify-content-column);
87
+ }
89
88
 
90
- [lynx-computed-display="linear"][lynx-linear-orientation="horizontal"] {
91
- flex-direction: row !important;
92
- justify-content: var(--justify-content-row);
93
- }
89
+ [lynx-computed-display="linear"][lynx-linear-orientation="horizontal"] {
90
+ flex-direction: row !important;
91
+ justify-content: var(--justify-content-row);
92
+ }
94
93
 
95
- [lynx-computed-display="linear"][lynx-linear-orientation="vertical-reverse"] {
96
- flex-direction: column-reverse !important;
97
- justify-content: var(--justify-content-column-reverse);
98
- }
94
+ [lynx-computed-display="linear"][lynx-linear-orientation="vertical-reverse"] {
95
+ flex-direction: column-reverse !important;
96
+ justify-content: var(--justify-content-column-reverse);
97
+ }
99
98
 
100
- [lynx-computed-display="linear"][lynx-linear-orientation="horizontal-reverse"] {
101
- flex-direction: row-reverse !important;
102
- justify-content: var(--justify-content-row-reverse);
103
- }
99
+ [lynx-computed-display="linear"][lynx-linear-orientation="horizontal-reverse"] {
100
+ flex-direction: row-reverse !important;
101
+ justify-content: var(--justify-content-row-reverse);
102
+ }
104
103
 
105
- [lynx-computed-display="linear"][lynx-linear-orientation="vertical"] > *,
106
- [lynx-computed-display="linear"][lynx-linear-orientation="vertical-reverse"],
107
- [lynx-computed-display="linear"][lynx-linear-orientation="vertical"]
108
- > lynx-wrapper
109
- > *,
110
- [lynx-computed-display="linear"][lynx-linear-orientation="vertical-reverse"]
111
- > lynx-wrapper
112
- > * {
113
- align-self: var(--align-self-column);
114
- }
115
- [lynx-computed-display="linear"][lynx-linear-orientation="horizontal"] > *,
116
- [lynx-computed-display="linear"][lynx-linear-orientation="horizontal-reverse"],
117
- [lynx-computed-display="linear"][lynx-linear-orientation="horizontal"]
118
- > lynx-wrapper
119
- > *,
120
- [lynx-computed-display="linear"][lynx-linear-orientation="horizontal-reverse"]
121
- > lynx-wrapper
122
- > * {
123
- align-self: var(--align-self-row);
104
+ [lynx-computed-display="linear"][lynx-linear-orientation="vertical"] > *,
105
+ [lynx-computed-display="linear"][lynx-linear-orientation="vertical-reverse"],
106
+ [lynx-computed-display="linear"][lynx-linear-orientation="vertical"]
107
+ > lynx-wrapper
108
+ > *,
109
+ [lynx-computed-display="linear"][lynx-linear-orientation="vertical-reverse"]
110
+ > lynx-wrapper
111
+ > * {
112
+ align-self: var(--align-self-column);
113
+ }
114
+ [lynx-computed-display="linear"][lynx-linear-orientation="horizontal"] > *,
115
+ [lynx-computed-display="linear"][lynx-linear-orientation="horizontal-reverse"],
116
+ [lynx-computed-display="linear"][lynx-linear-orientation="horizontal"]
117
+ > lynx-wrapper
118
+ > *,
119
+ [lynx-computed-display="linear"][lynx-linear-orientation="horizontal-reverse"]
120
+ > lynx-wrapper
121
+ > * {
122
+ align-self: var(--align-self-row);
123
+ }
124
124
  }
@@ -17,7 +17,8 @@ x-list > *:not(list-item) {
17
17
  display: none;
18
18
  }
19
19
 
20
- x-list::part(content), x-list[list-type="waterfall"]::part(waterfall-content) {
20
+ x-list::part(content),
21
+ x-list[list-type="waterfall"]::part(waterfall-content) {
21
22
  display: flex;
22
23
  flex: 0 0 auto;
23
24
  flex-wrap: nowrap;
@@ -36,15 +37,18 @@ x-list::part(content), x-list[list-type="waterfall"]::part(waterfall-content) {
36
37
  column-gap: inherit;
37
38
  }
38
39
 
39
- x-list::part(content), x-list::part(slot) {
40
+ x-list::part(content),
41
+ x-list::part(slot) {
40
42
  --lynx-display: inherit;
41
43
  }
42
44
 
43
- x-list, x-list::part(content) {
45
+ x-list,
46
+ x-list::part(content) {
44
47
  scrollbar-width: none;
45
48
  }
46
49
 
47
- x-list::-webkit-scrollbar, x-list::part(content)::-webkit-scrollbar {
50
+ x-list::-webkit-scrollbar,
51
+ x-list::part(content)::-webkit-scrollbar {
48
52
  display: none;
49
53
  }
50
54
 
@@ -61,15 +65,21 @@ list-item {
61
65
  content-visibility: auto;
62
66
  flex: 0 0 auto !important;
63
67
  position: static;
64
- contain: size;
68
+ contain: layout paint;
65
69
  contain-intrinsic-size: none auto var(--estimated-main-axis-size-px, 100cqh);
66
70
  }
67
71
 
72
+ list-item[recyclable="false"] {
73
+ content-visibility: visible;
74
+ contain: initial;
75
+ }
76
+
68
77
  x-list[scroll-orientation="horizontal"] list-item {
69
78
  contain-intrinsic-size: auto var(--estimated-main-axis-size-px, 100cqw) none;
70
79
  }
71
80
 
72
- x-list > list-item, x-list > lynx-wrapper > list-item {
81
+ x-list > list-item,
82
+ x-list > lynx-wrapper > list-item {
73
83
  display: flex;
74
84
  }
75
85
 
@@ -124,7 +134,8 @@ x-list[sticky="true"][scroll-orientation="horizontal"]
124
134
  right: var(--list-item-sticky-offset);
125
135
  }
126
136
 
127
- x-list[item-snap], x-list[paging-enabled] {
137
+ x-list[item-snap],
138
+ x-list[paging-enabled] {
128
139
  scroll-snap-type: y mandatory;
129
140
  scroll-snap-stop: always;
130
141
  }
@@ -134,7 +145,8 @@ x-list[paging-enabled][scroll-orientation="horizontal"] {
134
145
  scroll-snap-type: x mandatory;
135
146
  }
136
147
 
137
- x-list[item-snap] > list-item, x-list[item-snap] > lynx-wrapper > list-item {
148
+ x-list[item-snap] > list-item,
149
+ x-list[item-snap] > lynx-wrapper > list-item {
138
150
  scroll-snap-align: start;
139
151
  }
140
152
 
@@ -0,0 +1,5 @@
1
+ x-webview {
2
+ display: flex;
3
+ flex-direction: column;
4
+ overflow: hidden;
5
+ }
@@ -258,7 +258,6 @@ list-item {
258
258
  *
259
259
  * update this once firefox supports this.
260
260
  *
261
- * If you want to be fully compatible with chrome below 117, you need to use @lynx-js/web-elements/compat/LinearContainer.
262
261
  */
263
262
  @supports (content-visibility: auto) and
264
263
  (transition-behavior: allow-discrete) and (width: 1rex) {
package/elements.css DELETED
@@ -1,18 +0,0 @@
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
- */
5
- @import url("./src/elements/LynxWrapper/lynx-wrapper.css");
6
- @import url("./src/elements/XText/x-text.css");
7
- @import url("./src/elements/ScrollView/scroll-view.css");
8
- @import url("./src/elements/XFoldViewNg/x-foldview-ng.css");
9
- @import url("./src/elements/XViewpagerNg/x-viewpager-ng.css");
10
- @import url("./src/elements/XCanvas/x-canvas.css");
11
- @import url("./src/elements/XSvg/x-svg.css");
12
- @import url("./src/elements/XImage/x-image.css");
13
- @import url("./src/elements/XInput/x-input.css");
14
- @import url("./src/elements/XOverlayNg/x-overlay-ng.css");
15
- @import url("./src/elements/XRefreshView/x-refresh-view.css");
16
- @import url("./src/elements/XSwiper/x-swiper.css");
17
- @import url("./src/elements/XTextarea/x-textarea.css");
18
- @import url("./src/elements/XList/x-list.css");