@lynx-js/web-elements 0.7.1 → 0.7.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,50 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.7.3
4
+
5
+ ### Patch Changes
6
+
7
+ - refactor: allow elements to be rendered before :defined ([#855](https://github.com/lynx-family/lynx-stack/pull/855))
8
+
9
+ Before this commit, we don't allow developers to render these elements before they're defined.
10
+
11
+ In this commit, we will remove these restrictions.
12
+
13
+ - fix: remove the style `contain: content` of x-foldview-ng, otherwise it will cause the `position: fixed` elements to be positioned incorrectly after scrolling. ([#878](https://github.com/lynx-family/lynx-stack/pull/878))
14
+
15
+ - fix: x-list should observe property list-type change. ([#862](https://github.com/lynx-family/lynx-stack/pull/862))
16
+
17
+ Before this commit, list-type only works when it was first assigned.
18
+
19
+ use `requestAnimationFrame` instead of `queueMicrotask` to layoutListItem, this is because it may cause crashes in webkit.
20
+
21
+ - fix: list-item should support linear layout. ([#859](https://github.com/lynx-family/lynx-stack/pull/859))
22
+
23
+ - Updated dependencies []:
24
+ - @lynx-js/web-elements-template@0.7.3
25
+
26
+ ## 0.7.2
27
+
28
+ ### Patch Changes
29
+
30
+ - refactor: split shadowroot templates into a package ([#811](https://github.com/lynx-family/lynx-stack/pull/811))
31
+
32
+ We're going to implement Lynx Web Platform's SSR based on the `shadowrootmode`.
33
+
34
+ `https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/shadowRootMode`
35
+
36
+ (chrome 111, firefox 123, safari 16.4)
37
+
38
+ This means those modern browsers are able to show the correct layout before the web components are defined.
39
+
40
+ To make this work, we have to split the shadowroot template string into a new package `@lynx-js/web-elements-template`.
41
+
42
+ No features affected.
43
+
44
+ - Updated dependencies [[`ae9652a`](https://github.com/lynx-family/lynx-stack/commit/ae9652a7a1d6247959bb41e7d76793300eddb741), [`ae9652a`](https://github.com/lynx-family/lynx-stack/commit/ae9652a7a1d6247959bb41e7d76793300eddb741)]:
45
+ - @lynx-js/web-elements-template@0.7.2
46
+ - @lynx-js/web-elements-reactive@0.2.2
47
+
3
48
  ## 0.7.1
4
49
 
5
50
  ### Patch Changes
@@ -9,8 +9,9 @@ import { FadeEdgeLengthAttribute } from './FadeEdgeLengthAttribute.js';
9
9
  import { ScrollAttributes } from './ScrollAttributes.js';
10
10
  import { ScrollViewEvents } from './ScrollViewEvents.js';
11
11
  import { ScrollIntoView } from './ScrollIntoView.js';
12
- import { Component, html } from '@lynx-js/web-elements-reactive';
12
+ import { Component } from '@lynx-js/web-elements-reactive';
13
13
  import { scrollContainerDom } from '../common/constants.js';
14
+ import { templateScrollView } from '@lynx-js/web-elements-template';
14
15
  let ScrollView = (() => {
15
16
  let _classDecorators = [Component('scroll-view', [
16
17
  CommonEventsAndMethods,
@@ -18,89 +19,7 @@ let ScrollView = (() => {
18
19
  FadeEdgeLengthAttribute,
19
20
  ScrollViewEvents,
20
21
  ScrollIntoView,
21
- ], html ` <style>
22
- .placeholder-dom {
23
- display: none;
24
- flex: 0 0 0;
25
- align-self: stretch;
26
- min-height: 0;
27
- min-width: 0;
28
- }
29
- .mask {
30
- z-index: 1;
31
- position: sticky;
32
- }
33
- .observer-container {
34
- flex-direction: inherit;
35
- overflow: visible;
36
- }
37
- .observer {
38
- display: flex;
39
- }
40
- ::-webkit-scrollbar {
41
- display: none;
42
- }
43
-
44
- @keyframes topFading {
45
- 0% {
46
- box-shadow: transparent 0px 0px 0px 0px;
47
- }
48
- 5% {
49
- box-shadow: var(--scroll-view-bg-color) 0px 0px
50
- var(--scroll-view-fading-edge-length)
51
- var(--scroll-view-fading-edge-length);
52
- }
53
- 100% {
54
- box-shadow: var(--scroll-view-bg-color) 0px 0px
55
- var(--scroll-view-fading-edge-length)
56
- var(--scroll-view-fading-edge-length);
57
- }
58
- }
59
- @keyframes botFading {
60
- 0% {
61
- box-shadow: var(--scroll-view-bg-color) 0px 0px
62
- var(--scroll-view-fading-edge-length)
63
- var(--scroll-view-fading-edge-length);
64
- }
65
- 95% {
66
- box-shadow: var(--scroll-view-bg-color) 0px 0px
67
- var(--scroll-view-fading-edge-length)
68
- var(--scroll-view-fading-edge-length);
69
- }
70
- 100% {
71
- box-shadow: transparent 0px 0px 0px 0px;
72
- }
73
- }
74
- </style>
75
- <div
76
- class="mask placeholder-dom"
77
- id="top-fade-mask"
78
- part="top-fade-mask"
79
- ></div>
80
- <div
81
- class="observer-container placeholder-dom"
82
- part="upper-threshold-observer"
83
- >
84
- <div
85
- class="observer placeholder-dom"
86
- id="upper-threshold-observer"
87
- ></div>
88
- </div>
89
- <slot></slot>
90
- <div
91
- class="observer-container placeholder-dom"
92
- part="lower-threshold-observer"
93
- >
94
- <div
95
- class="observer placeholder-dom"
96
- id="lower-threshold-observer"
97
- ></div>
98
- </div>
99
- <div
100
- class="mask placeholder-dom"
101
- id="bot-fade-mask"
102
- part="bot-fade-mask"
103
- ></div>`)];
22
+ ], templateScrollView)];
104
23
  let _classDescriptor;
105
24
  let _classExtraInitializers = [];
106
25
  let _classThis;
@@ -4,14 +4,15 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Component, html, genDomGetter, bindToAttribute, } from '@lynx-js/web-elements-reactive';
7
+ import { Component, genDomGetter, bindToAttribute, } from '@lynx-js/web-elements-reactive';
8
8
  import { XAudioAttribute } from './XAudioAttribute.js';
9
9
  import { XAudioEvents } from './XAudioEvents.js';
10
10
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
11
11
  import { commonComponentEventSetting } from '../common/commonEventInitConfiguration.js';
12
12
  import { XAudioErrorCode, audioPlaybackStateMap, getAudioState, xAudioBlob, xAudioSrc, } from './utils.js';
13
+ import { templateXAudioTT } from '@lynx-js/web-elements-template';
13
14
  let XAudioTT = (() => {
14
- let _classDecorators = [Component('x-audio-tt', [CommonEventsAndMethods, XAudioAttribute, XAudioEvents], html `<audio id="audio"></audio>`)];
15
+ let _classDecorators = [Component('x-audio-tt', [CommonEventsAndMethods, XAudioAttribute, XAudioEvents], templateXAudioTT)];
15
16
  let _classDescriptor;
16
17
  let _classExtraInitializers = [];
17
18
  let _classThis;
@@ -4,13 +4,14 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Component, html } from '@lynx-js/web-elements-reactive';
7
+ import { Component } from '@lynx-js/web-elements-reactive';
8
8
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { DropShadow } from './DropShadow.js';
10
10
  import { ImageSrc } from './ImageSrc.js';
11
11
  import { ImageEvents } from './ImageEvents.js';
12
+ import { templateFilterImage } from '@lynx-js/web-elements-template';
12
13
  let FilterImage = (() => {
13
- let _classDecorators = [Component('filter-image', [CommonEventsAndMethods, ImageSrc, DropShadow, ImageEvents], html ` <img part="img" alt="" id="img" /> `)];
14
+ let _classDecorators = [Component('filter-image', [CommonEventsAndMethods, ImageSrc, DropShadow, ImageEvents], templateFilterImage({}))];
14
15
  let _classDescriptor;
15
16
  let _classExtraInitializers = [];
16
17
  let _classThis;
@@ -4,12 +4,13 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Component, html } from '@lynx-js/web-elements-reactive';
7
+ import { Component } from '@lynx-js/web-elements-reactive';
8
8
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { ImageSrc } from './ImageSrc.js';
10
10
  import { ImageEvents } from './ImageEvents.js';
11
+ import { templateXImage } from '@lynx-js/web-elements-template';
11
12
  let XImage = (() => {
12
- let _classDecorators = [Component('x-image', [CommonEventsAndMethods, ImageSrc, ImageEvents], html ` <img part="img" alt="" id="img" /> `)];
13
+ let _classDecorators = [Component('x-image', [CommonEventsAndMethods, ImageSrc, ImageEvents], templateXImage({}))];
13
14
  let _classDescriptor;
14
15
  let _classExtraInitializers = [];
15
16
  let _classThis;
@@ -4,12 +4,13 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Component, genDomGetter, html } from '@lynx-js/web-elements-reactive';
7
+ import { Component, genDomGetter } from '@lynx-js/web-elements-reactive';
8
8
  import { InputBaseAttributes } from './InputBaseAttributes.js';
9
9
  import { Placeholder } from './Placeholder.js';
10
10
  import { XInputAttribute } from './XInputAttribute.js';
11
11
  import { XInputEvents } from './XInputEvents.js';
12
12
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
13
+ import { templateXInput } from '@lynx-js/web-elements-template';
13
14
  let XInput = (() => {
14
15
  let _classDecorators = [Component('x-input', [
15
16
  CommonEventsAndMethods,
@@ -17,24 +18,7 @@ let XInput = (() => {
17
18
  XInputAttribute,
18
19
  InputBaseAttributes,
19
20
  XInputEvents,
20
- ], html ` <style>
21
- #input:focus {
22
- outline: none;
23
- }
24
- #form {
25
- display: none;
26
- }
27
- </style>
28
- <form id="form" part="form" method="dialog">
29
- <input
30
- id="input"
31
- part="input"
32
- step="any"
33
- type="text"
34
- inputmode="text"
35
- spell-check="true"
36
- />
37
- </form>`)];
21
+ ], templateXInput)];
38
22
  let _classDescriptor;
39
23
  let _classExtraInitializers = [];
40
24
  let _classThis;
@@ -4,50 +4,15 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Component, genDomGetter, html } from '@lynx-js/web-elements-reactive';
7
+ import { Component, genDomGetter } from '@lynx-js/web-elements-reactive';
8
8
  import { XListAttributes } from './XListAttributes.js';
9
9
  import { XListEvents } from './XListEvents.js';
10
10
  import { XListWaterfall } from './XListWaterfall.js';
11
11
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
12
12
  import { commonComponentEventSetting } from '../common/commonEventInitConfiguration.js';
13
+ import { templateXList } from '@lynx-js/web-elements-template';
13
14
  let XList = (() => {
14
- let _classDecorators = [Component('x-list', [CommonEventsAndMethods, XListAttributes, XListEvents, XListWaterfall], html `<style>
15
- .placeholder-dom {
16
- display: none;
17
- flex: 0 0 0;
18
- align-self: stretch;
19
- min-height: 0;
20
- min-width: 0;
21
- }
22
- .observer-container {
23
- flex-direction: inherit;
24
- overflow: visible;
25
- }
26
- .observer {
27
- display: flex;
28
- }
29
- </style>
30
- <div id="content" part="content">
31
- <div
32
- class="observer-container placeholder-dom"
33
- part="upper-threshold-observer"
34
- >
35
- <div
36
- class="observer placeholder-dom"
37
- id="upper-threshold-observer"
38
- ></div>
39
- </div>
40
- <slot part="slot"></slot>
41
- <div
42
- class="observer-container placeholder-dom"
43
- part="lower-threshold-observer"
44
- >
45
- <div
46
- class="observer placeholder-dom"
47
- id="lower-threshold-observer"
48
- ></div>
49
- </div>
50
- </div>`)];
15
+ let _classDecorators = [Component('x-list', [CommonEventsAndMethods, XListAttributes, XListEvents, XListWaterfall], templateXList)];
51
16
  let _classDescriptor;
52
17
  let _classExtraInitializers = [];
53
18
  let _classThis;
@@ -5,7 +5,6 @@ import { __esDecorate, __runInitializers } from "tslib";
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { bindToStyle, boostedQueueMicrotask, registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
8
- const WATERFALL_SLOT = 'waterfall-slot';
9
8
  let XListAttributes = (() => {
10
9
  let _private_handlerStickyOffset_decorators;
11
10
  let _private_handlerStickyOffset_initializers = [];
@@ -2,7 +2,6 @@ import { type AttributeReactiveClass } from '@lynx-js/web-elements-reactive';
2
2
  import type { XList } from './XList.js';
3
3
  export declare class XListWaterfall implements InstanceType<AttributeReactiveClass<typeof HTMLElement>> {
4
4
  #private;
5
- static observedAttributes: never[];
5
+ static observedAttributes: string[];
6
6
  constructor(dom: XList);
7
- connectedCallback(): void;
8
7
  }
@@ -1,144 +1,169 @@
1
+ import { __esDecorate, __runInitializers, __setFunctionName } from "tslib";
1
2
  /*
2
3
  // Copyright 2024 The Lynx Authors. All rights reserved.
3
4
  // Licensed under the Apache License Version 2.0 that can be found in the
4
5
  // LICENSE file in the root directory of this source tree.
5
6
  */
6
- import { boostedQueueMicrotask, genDomGetter, } from '@lynx-js/web-elements-reactive';
7
+ import { genDomGetter, registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
7
8
  const WATERFALL_SLOT = 'waterfall-slot';
8
9
  const WATERFALL_STYLE = 'waterfall-style';
9
- export class XListWaterfall {
10
- static observedAttributes = [];
11
- #dom;
12
- #getListContainer = genDomGetter(() => this.#dom.shadowRoot, '#content');
13
- #getLowerThresholdObserver = genDomGetter(() => this.#dom.shadowRoot, 'div[part="lower-threshold-observer"]');
14
- #resizeObserver;
15
- #childrenObserver;
16
- #createWaterfallContainer = () => {
17
- const waterfallSlot = document.createElement('slot');
18
- waterfallSlot.setAttribute('name', `${WATERFALL_SLOT}`);
19
- this.#dom.shadowRoot?.querySelector('[part=upper-threshold-observer]')
20
- ?.insertAdjacentElement('afterend', waterfallSlot);
21
- };
22
- #layoutListItem = (spanCount, isScrollVertical) => {
23
- const measurements = new Array(spanCount).fill(0);
24
- for (let i = 0; i < this.#dom.children.length; i++) {
25
- const listItem = this.#dom.children[i];
26
- const mainAxisGap = getComputedStyle(listItem).getPropertyValue('--list-main-axis-gap');
27
- const crossAxisGap = getComputedStyle(listItem).getPropertyValue('--list-cross-axis-gap');
28
- const increasedMeasurement = isScrollVertical
29
- ? listItem.getBoundingClientRect().height + parseFloat(mainAxisGap)
30
- : listItem.getBoundingClientRect().width + parseFloat(mainAxisGap);
31
- if (listItem.getAttribute('full-span') !== null) {
32
- let longestMeasurement = measurements[0];
33
- // Find the longest track.
34
- for (let j = 1; j < spanCount; j++) {
35
- if (measurements[j] > longestMeasurement) {
36
- longestMeasurement = measurements[j];
10
+ let XListWaterfall = (() => {
11
+ let _instanceExtraInitializers = [];
12
+ let _private_handlerListType_decorators;
13
+ let _private_handlerListType_descriptor;
14
+ return class XListWaterfall {
15
+ static {
16
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
17
+ _private_handlerListType_decorators = [registerAttributeHandler('list-type', true)];
18
+ __esDecorate(this, _private_handlerListType_descriptor = { value: __setFunctionName(function (newVal) {
19
+ if (newVal === 'waterfall') {
20
+ const spanCount = parseFloat(this.#dom.getAttribute('span-count')
21
+ || this.#dom.getAttribute('column-count')
22
+ || '') || 1;
23
+ const scrollOrientation = this.#dom.getAttribute('scroll-orientation')
24
+ || 'vertical';
25
+ this.#createWaterfallContainer();
26
+ if (!this.#resizeObserver) {
27
+ this.#resizeObserverInit(spanCount, scrollOrientation === 'vertical');
28
+ }
29
+ if (!this.#childrenObserver) {
30
+ this.#childrenObserver = new MutationObserver((mutationList) => {
31
+ const mutation = mutationList?.[0];
32
+ if (mutation?.type === 'childList') {
33
+ this.#resizeObserverInit(spanCount, scrollOrientation === 'vertical');
34
+ }
35
+ });
36
+ this.#childrenObserver.observe(this.#dom, {
37
+ childList: true,
38
+ });
39
+ }
40
+ }
41
+ else {
42
+ this.#resizeObserver?.disconnect();
43
+ this.#resizeObserver = undefined;
44
+ this.#childrenObserver?.disconnect();
45
+ this.#childrenObserver = undefined;
46
+ for (let i = 0; i < this.#dom.children.length; i++) {
47
+ const listItem = this.#dom.children[i];
48
+ listItem.removeAttribute('slot');
49
+ }
50
+ this.#dom.shadowRoot?.querySelector(`slot[name=${WATERFALL_SLOT}]`)
51
+ ?.remove();
52
+ }
53
+ }, "#handlerListType") }, _private_handlerListType_decorators, { kind: "method", name: "#handlerListType", static: false, private: true, access: { has: obj => #handlerListType in obj, get: obj => obj.#handlerListType }, metadata: _metadata }, null, _instanceExtraInitializers);
54
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
55
+ }
56
+ static observedAttributes = ['list-type'];
57
+ #dom = __runInitializers(this, _instanceExtraInitializers);
58
+ #getListContainer = genDomGetter(() => this.#dom.shadowRoot, '#content');
59
+ #getLowerThresholdObserver = genDomGetter(() => this.#dom.shadowRoot, 'div[part="lower-threshold-observer"]');
60
+ #resizeObserver;
61
+ #childrenObserver;
62
+ #createWaterfallContainer = () => {
63
+ const waterfallSlot = document.createElement('slot');
64
+ waterfallSlot.setAttribute('name', `${WATERFALL_SLOT}`);
65
+ this.#dom.shadowRoot?.querySelector('[part=upper-threshold-observer]')
66
+ ?.insertAdjacentElement('afterend', waterfallSlot);
67
+ };
68
+ #layoutListItem = (spanCount, isScrollVertical) => {
69
+ const measurements = new Array(spanCount).fill(0);
70
+ for (let i = 0; i < this.#dom.children.length; i++) {
71
+ const listItem = this.#dom.children[i];
72
+ const mainAxisGap = getComputedStyle(listItem).getPropertyValue('--list-main-axis-gap');
73
+ const crossAxisGap = getComputedStyle(listItem).getPropertyValue('--list-cross-axis-gap');
74
+ const increasedMeasurement = isScrollVertical
75
+ ? listItem.getBoundingClientRect().height + parseFloat(mainAxisGap)
76
+ : listItem.getBoundingClientRect().width + parseFloat(mainAxisGap);
77
+ if (listItem.getAttribute('full-span') !== null) {
78
+ let longestMeasurement = measurements[0];
79
+ // Find the longest track.
80
+ for (let j = 1; j < spanCount; j++) {
81
+ if (measurements[j] > longestMeasurement) {
82
+ longestMeasurement = measurements[j];
83
+ }
84
+ }
85
+ for (let j = 0; j < spanCount; j++) {
86
+ measurements[j] = longestMeasurement + increasedMeasurement;
87
+ }
88
+ if (isScrollVertical) {
89
+ listItem.setAttribute(`${WATERFALL_STYLE}-left`, '0');
90
+ listItem.setAttribute(`${WATERFALL_STYLE}-top`, `${longestMeasurement}px`);
91
+ }
92
+ else {
93
+ listItem.setAttribute(`${WATERFALL_STYLE}-left`, `${longestMeasurement}px`);
94
+ listItem.setAttribute(`${WATERFALL_STYLE}-top`, '0');
37
95
  }
38
- }
39
- for (let j = 0; j < spanCount; j++) {
40
- measurements[j] = longestMeasurement + increasedMeasurement;
41
- }
42
- if (isScrollVertical) {
43
- listItem.setAttribute(`${WATERFALL_STYLE}-left`, '0');
44
- listItem.setAttribute(`${WATERFALL_STYLE}-top`, `${longestMeasurement}px`);
45
96
  }
46
97
  else {
47
- listItem.setAttribute(`${WATERFALL_STYLE}-left`, `${longestMeasurement}px`);
48
- listItem.setAttribute(`${WATERFALL_STYLE}-top`, '0');
49
- }
50
- }
51
- else {
52
- let shortestIndex = 0;
53
- let shortestMeasurement = measurements[0];
54
- // Find the shortest track.
55
- for (let j = 1; j < spanCount; j++) {
56
- if (measurements[j] < shortestMeasurement) {
57
- shortestIndex = j;
58
- shortestMeasurement = measurements[j];
98
+ let shortestIndex = 0;
99
+ let shortestMeasurement = measurements[0];
100
+ // Find the shortest track.
101
+ for (let j = 1; j < spanCount; j++) {
102
+ if (measurements[j] < shortestMeasurement) {
103
+ shortestIndex = j;
104
+ shortestMeasurement = measurements[j];
105
+ }
59
106
  }
107
+ const crossOffset = `calc(${shortestIndex} * (100% - ${crossAxisGap} * (${spanCount} - 1))/ ${spanCount} + ${Math.max(0, shortestIndex)} * ${crossAxisGap})`;
108
+ if (isScrollVertical) {
109
+ listItem.setAttribute(`${WATERFALL_STYLE}-left`, crossOffset);
110
+ listItem.setAttribute(`${WATERFALL_STYLE}-top`, `${shortestMeasurement}px`);
111
+ }
112
+ else {
113
+ listItem.setAttribute(`${WATERFALL_STYLE}-left`, `${shortestMeasurement}px`);
114
+ listItem.setAttribute(`${WATERFALL_STYLE}-top`, crossOffset);
115
+ }
116
+ measurements[shortestIndex] += increasedMeasurement;
60
117
  }
61
- const crossOffset = `calc(${shortestIndex} * (100% - ${crossAxisGap} * (${spanCount} - 1))/ ${spanCount} + ${Math.max(0, shortestIndex)} * ${crossAxisGap})`;
62
- if (isScrollVertical) {
63
- listItem.setAttribute(`${WATERFALL_STYLE}-left`, crossOffset);
64
- listItem.setAttribute(`${WATERFALL_STYLE}-top`, `${shortestMeasurement}px`);
118
+ }
119
+ for (let i = 0; i < this.#dom.children.length; i++) {
120
+ const listItem = this.#dom.children[i];
121
+ listItem.style.setProperty('left', listItem.getAttribute(`${WATERFALL_STYLE}-left`));
122
+ listItem.style.setProperty('top', listItem.getAttribute(`${WATERFALL_STYLE}-top`));
123
+ listItem.setAttribute('slot', WATERFALL_SLOT);
124
+ }
125
+ // The reasons why it is not unified in #updateScrollToLowerEventSwitches is:
126
+ // It is impossible to ensure that list-item is not rendered, so it will cause incorrect listContent.scrollHeight/scrollWidth as height/width.
127
+ const enableScrollToLower = this.#dom.getAttribute('x-enable-scrolltolower-event');
128
+ if (enableScrollToLower !== null && enableScrollToLower !== 'false') {
129
+ const lower = this.#getLowerThresholdObserver();
130
+ const scrollOrientation = this.#dom.getAttribute('scroll-orientation')
131
+ || 'vertical';
132
+ const listContent = this.#getListContainer();
133
+ if (scrollOrientation === 'vertical') {
134
+ lower.style.setProperty('top',
135
+ // Firefox cannot trigger the bottom IntersectionObserver
136
+ `${String(listContent.scrollHeight - 1)}px`, 'important');
137
+ // Firefox needs this
138
+ lower.style.setProperty('bottom', 'unset', 'important');
65
139
  }
66
140
  else {
67
- listItem.setAttribute(`${WATERFALL_STYLE}-left`, `${shortestMeasurement}px`);
68
- listItem.setAttribute(`${WATERFALL_STYLE}-top`, crossOffset);
141
+ lower.style.setProperty('left',
142
+ // Firefox cannot trigger the bottom IntersectionObserver
143
+ `${String(listContent.scrollHeight - 1)}px`);
144
+ // Firefox needs this
145
+ lower.style.setProperty('right', 'unset');
69
146
  }
70
- measurements[shortestIndex] += increasedMeasurement;
71
147
  }
148
+ };
149
+ constructor(dom) {
150
+ this.#dom = dom;
72
151
  }
73
- for (let i = 0; i < this.#dom.children.length; i++) {
74
- const listItem = this.#dom.children[i];
75
- listItem.style.setProperty('left', listItem.getAttribute(`${WATERFALL_STYLE}-left`));
76
- listItem.style.setProperty('top', listItem.getAttribute(`${WATERFALL_STYLE}-top`));
77
- listItem.setAttribute('slot', WATERFALL_SLOT);
78
- }
79
- // The reasons why it is not unified in #updateScrollToLowerEventSwitches is:
80
- // It is impossible to ensure that list-item is not rendered, so it will cause incorrect listContent.scrollHeight/scrollWidth as height/width.
81
- const enableScrollToLower = this.#dom.getAttribute('x-enable-scrolltolower-event');
82
- if (enableScrollToLower !== null && enableScrollToLower !== 'false') {
83
- const lower = this.#getLowerThresholdObserver();
84
- const scrollOrientation = this.#dom.getAttribute('scroll-orientation')
85
- || 'vertical';
86
- const listContent = this.#getListContainer();
87
- if (scrollOrientation === 'vertical') {
88
- lower.style.setProperty('top',
89
- // Firefox cannot trigger the bottom IntersectionObserver
90
- `${String(listContent.scrollHeight - 1)}px`, 'important');
91
- // Firefox needs this
92
- lower.style.setProperty('bottom', 'unset', 'important');
93
- }
94
- else {
95
- lower.style.setProperty('left',
96
- // Firefox cannot trigger the bottom IntersectionObserver
97
- `${String(listContent.scrollHeight - 1)}px`);
98
- // Firefox needs this
99
- lower.style.setProperty('right', 'unset');
100
- }
101
- }
102
- };
103
- constructor(dom) {
104
- this.#dom = dom;
105
- }
106
- #resizeObserverInit = (spanCount, isScrollVertical) => {
107
- this.#resizeObserver?.disconnect();
108
- this.#resizeObserver = new ResizeObserver(() => {
109
- // may cause: Resizeobserver loop completed with undelivered notifications
110
- // https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors
111
- boostedQueueMicrotask(() => {
112
- this.#layoutListItem(spanCount, isScrollVertical);
152
+ #resizeObserverInit = (spanCount, isScrollVertical) => {
153
+ this.#resizeObserver?.disconnect();
154
+ this.#resizeObserver = new ResizeObserver(() => {
155
+ // may cause: Resizeobserver loop completed with undelivered notifications
156
+ // https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors
157
+ requestAnimationFrame(() => {
158
+ this.#layoutListItem(spanCount, isScrollVertical);
159
+ });
113
160
  });
114
- });
115
- Array.from(this.#dom.children).forEach(element => {
116
- this.#resizeObserver?.observe(element);
117
- });
161
+ Array.from(this.#dom.children).forEach(element => {
162
+ this.#resizeObserver?.observe(element);
163
+ });
164
+ };
165
+ get #handlerListType() { return _private_handlerListType_descriptor.value; }
118
166
  };
119
- connectedCallback() {
120
- if (this.#dom.getAttribute('list-type') === 'waterfall') {
121
- const spanCount = parseFloat(this.#dom.getAttribute('span-count')
122
- || this.#dom.getAttribute('column-count')
123
- || '') || 1;
124
- const scrollOrientation = this.#dom.getAttribute('scroll-orientation')
125
- || 'vertical';
126
- this.#createWaterfallContainer();
127
- if (!this.#resizeObserver) {
128
- this.#resizeObserverInit(spanCount, scrollOrientation === 'vertical');
129
- }
130
- if (!this.#childrenObserver) {
131
- this.#childrenObserver = new MutationObserver((mutationList) => {
132
- const mutation = mutationList?.[0];
133
- if (mutation?.type === 'childList') {
134
- this.#resizeObserverInit(spanCount, scrollOrientation === 'vertical');
135
- }
136
- });
137
- this.#childrenObserver.observe(this.#dom, {
138
- childList: true,
139
- });
140
- }
141
- }
142
- }
143
- }
167
+ })();
168
+ export { XListWaterfall };
144
169
  //# sourceMappingURL=XListWaterfall.js.map
@@ -4,27 +4,12 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
+ import { templateXOverlayNg } from '@lynx-js/web-elements-template';
7
8
  import { layoutChangeTarget, CommonEventsAndMethods, } from '../common/CommonEventsAndMethods.js';
8
9
  import { XOverlayAttributes } from './XOverlayAttributes.js';
9
- import { Component, html } from '@lynx-js/web-elements-reactive';
10
+ import { Component } from '@lynx-js/web-elements-reactive';
10
11
  let XOverlayNg = (() => {
11
- let _classDecorators = [Component('x-overlay-ng', [CommonEventsAndMethods, XOverlayAttributes], html `
12
- <style>
13
- #dialog[open] {
14
- top: 0;
15
- left: 0;
16
- right: 0;
17
- bottom: 0;
18
- position: fixed;
19
- }
20
- #dialog::backdrop {
21
- background-color: transparent;
22
- }
23
- </style>
24
- <dialog id="dialog" part="dialog">
25
- <slot></slot>
26
- </dialog>
27
- `)];
12
+ let _classDecorators = [Component('x-overlay-ng', [CommonEventsAndMethods, XOverlayAttributes], templateXOverlayNg)];
28
13
  let _classDescriptor;
29
14
  let _classExtraInitializers = [];
30
15
  let _classThis;
@@ -4,59 +4,13 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Component, genDomGetter, html } from '@lynx-js/web-elements-reactive';
7
+ import { Component, genDomGetter } from '@lynx-js/web-elements-reactive';
8
8
  import { XRefreshViewEventsEmitter } from './XRefreshViewEventsEmitter.js';
9
9
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
10
10
  import { scrollContainerDom } from '../common/constants.js';
11
+ import { templateXRefreshView } from '@lynx-js/web-elements-template';
11
12
  let XRefreshView = (() => {
12
- let _classDecorators = [Component('x-refresh-view', [CommonEventsAndMethods, XRefreshViewEventsEmitter], html `
13
- <style>
14
- .bounce-container {
15
- overflow: scroll;
16
- overscroll-behavior: contain;
17
- scroll-snap-type: y mandatory;
18
- scroll-behavior: smooth;
19
- scrollbar-width: none;
20
- }
21
- .overflow-placeholder {
22
- min-height: 30%;
23
- min-width: 100%;
24
- flex-shrink: 0;
25
- scroll-snap-align: none;
26
- }
27
- .not-shrink {
28
- height: 100%;
29
- width: 100%;
30
- min-height: 100%;
31
- min-width: 100%;
32
- flex-shrink: 0;
33
- }
34
- .vertical {
35
- display: flex;
36
- flex-direction: column;
37
- }
38
- #content {
39
- scroll-snap-align: center;
40
- }
41
- </style>
42
- <div id="container" part="container" class="bounce-container not-shrink vertical">
43
- <div
44
- id="placeholder-top"
45
- class="overflow-placeholder bounce-item"
46
- part="placeholder-top"
47
- ></div>
48
- <slot name="header"></slot>
49
- <div id="content" part="content" class="not-shrink vertical">
50
- <slot part="slot"></slot>
51
- </div>
52
- <slot name="footer"></slot>
53
- <div
54
- id="placeholder-bot"
55
- class="overflow-placeholder bounce-item"
56
- part="placeholder-bot"
57
- ></div>
58
- </div>
59
- `)];
13
+ let _classDecorators = [Component('x-refresh-view', [CommonEventsAndMethods, XRefreshViewEventsEmitter], templateXRefreshView)];
60
14
  let _classDescriptor;
61
15
  let _classExtraInitializers = [];
62
16
  let _classThis;
@@ -4,13 +4,14 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Component, genDomGetter, html } from '@lynx-js/web-elements-reactive';
7
+ import { Component, genDomGetter } from '@lynx-js/web-elements-reactive';
8
8
  import { XSwipeEvents } from './XSwiperEvents.js';
9
9
  import { XSwiperAutoScroll } from './XSwiperAutoScroll.js';
10
10
  import { XSwiperCircular } from './XSwiperCircular.js';
11
11
  import { XSwiperIndicator } from './XSwiperIndicator.js';
12
12
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
13
13
  import { scrollContainerDom } from '../common/constants.js';
14
+ import { templateXSwiper } from '@lynx-js/web-elements-template';
14
15
  let XSwiper = (() => {
15
16
  let _classDecorators = [Component('x-swiper', [
16
17
  CommonEventsAndMethods,
@@ -18,53 +19,7 @@ let XSwiper = (() => {
18
19
  XSwipeEvents,
19
20
  XSwiperCircular,
20
21
  XSwiperAutoScroll,
21
- ], html ` <style>
22
- #bounce-padding {
23
- display: none;
24
- flex: 0 0 0;
25
- align-self: stretch;
26
- scroll-snap-align: none;
27
- flex-basis: 100%;
28
- }
29
- #content {
30
- position: relative;
31
- display: flex;
32
- flex: 0 0 100%;
33
- flex-direction: inherit;
34
- flex-wrap: inherit;
35
- align-self: stretch;
36
- justify-content: inherit;
37
- align-items: inherit;
38
- overflow: inherit;
39
- scrollbar-width: none;
40
- scroll-snap-align: start;
41
- scroll-snap-type: inherit;
42
- }
43
- div::-webkit-scrollbar {
44
- display: none;
45
- }
46
- #indicator-container {
47
- display: none;
48
- }
49
- @keyframes indicator-dot {
50
- 30%,
51
- 70% {
52
- background-color: var(--indicator-color);
53
- }
54
- 31%,
55
- 69% {
56
- background-color: var(--indicator-active-color);
57
- }
58
- }
59
- </style>
60
- <style id="indicator-style"></style>
61
- <div id="bounce-padding" part="bounce-padding"></div>
62
- <div id="indicator-container" part="indicator-container"></div>
63
- <div id="content" part="content">
64
- <slot part="slot-start" name="circular-start" id="circular-start"></slot>
65
- <slot part="slot"></slot>
66
- <slot part="slot-end" name="circular-end" id="circular-end"></slot>
67
- </div>`)];
22
+ ], templateXSwiper)];
68
23
  let _classDescriptor;
69
24
  let _classExtraInitializers = [];
70
25
  let _classThis;
@@ -4,7 +4,8 @@ import { __esDecorate, __runInitializers, __setFunctionName } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Component, genDomGetter, html, registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
7
+ import { Component, genDomGetter, registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
8
+ import { templateInlineImage } from '@lynx-js/web-elements-template';
8
9
  let InlineImageAttributes = (() => {
9
10
  let _instanceExtraInitializers = [];
10
11
  let _private_handleSrc_decorators;
@@ -35,7 +36,7 @@ export { InlineImageAttributes };
35
36
  * @deprecated you can use `x-image` instead in `x-text`.
36
37
  */
37
38
  let InlineImage = (() => {
38
- let _classDecorators = [Component('inline-image', [InlineImageAttributes], html ` <img id="img" part="img" /> `)];
39
+ let _classDecorators = [Component('inline-image', [InlineImageAttributes], templateInlineImage({}))];
39
40
  let _classDescriptor;
40
41
  let _classExtraInitializers = [];
41
42
  let _classThis;
@@ -4,12 +4,13 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Component, html } from '@lynx-js/web-elements-reactive';
7
+ import { Component } from '@lynx-js/web-elements-reactive';
8
8
  import { XTextTruncation } from './XTextTruncation.js';
9
9
  import { ScrollIntoView } from '../ScrollView/ScrollIntoView.js';
10
10
  import { CommonEventsAndMethods, layoutChangeTarget, } from '../common/CommonEventsAndMethods.js';
11
+ import { templateXText } from '@lynx-js/web-elements-template';
11
12
  let XText = (() => {
12
- let _classDecorators = [Component('x-text', [CommonEventsAndMethods, XTextTruncation], html `<div id="inner-box" part="inner-box"><slot part="slot"></slot><slot name="inline-truncation"></slot></div>`)];
13
+ let _classDecorators = [Component('x-text', [CommonEventsAndMethods, XTextTruncation], templateXText)];
13
14
  let _classDescriptor;
14
15
  let _classExtraInitializers = [];
15
16
  let _classThis;
@@ -4,12 +4,13 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { Component, genDomGetter, html } from '@lynx-js/web-elements-reactive';
7
+ import { Component, genDomGetter } from '@lynx-js/web-elements-reactive';
8
8
  import { Placeholder } from './Placeholder.js';
9
9
  import { TextareaBaseAttributes } from './TextareaBaseAttributes.js';
10
10
  import { XTextareaAttributes } from './XTextareaAttributes.js';
11
11
  import { XTextareaEvents } from './XTextareaEvents.js';
12
12
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
13
+ import { templateXTextarea } from '@lynx-js/web-elements-template';
13
14
  // x-textarea
14
15
  let XTextarea = (() => {
15
16
  let _classDecorators = [Component('x-textarea', [
@@ -18,16 +19,7 @@ let XTextarea = (() => {
18
19
  TextareaBaseAttributes,
19
20
  XTextareaAttributes,
20
21
  XTextareaEvents,
21
- ], html `<style>
22
- #textarea:focus,
23
- #textarea:focus-visible {
24
- border: inherit;
25
- outline: inherit;
26
- }
27
- </style>
28
- <form id="form" part="form" method="dialog">
29
- <textarea id="textarea" part="textarea"></textarea>
30
- </form> `)];
22
+ ], templateXTextarea)];
31
23
  let _classDescriptor;
32
24
  let _classExtraInitializers = [];
33
25
  let _classThis;
@@ -4,40 +4,13 @@ import { __esDecorate, __runInitializers } from "tslib";
4
4
  // Licensed under the Apache License Version 2.0 that can be found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { boostedQueueMicrotask, Component, html, } from '@lynx-js/web-elements-reactive';
7
+ import { boostedQueueMicrotask, Component, } from '@lynx-js/web-elements-reactive';
8
8
  import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { XViewpagerNgEvents } from './XViewpagerNgEvents.js';
10
10
  import { scrollContainerDom } from '../common/constants.js';
11
+ import { templateXViewpageNg } from '@lynx-js/web-elements-template';
11
12
  let XViewpagerNg = (() => {
12
- let _classDecorators = [Component('x-viewpager-ng', [CommonEventsAndMethods, XViewpagerNgEvents], html `
13
- <style>
14
- #bounce-padding {
15
- display: none;
16
- flex: 0 0 0;
17
- align-self: stretch;
18
- scroll-snap-align: none;
19
- flex-basis: 100%;
20
- }
21
- #content {
22
- flex: 0 0 100%;
23
- flex-direction: row;
24
- align-self: stretch;
25
- display: inherit;
26
- justify-content: inherit;
27
- align-items: inherit;
28
- overflow: inherit;
29
- scrollbar-width: none;
30
- scroll-snap-type: inherit;
31
- }
32
- #content::-webkit-scrollbar {
33
- display: none;
34
- }
35
- </style>
36
- <div id="bounce-padding" part="bounce-padding"></div>
37
- <div id="content" part="content">
38
- <slot></slot>
39
- </div>
40
- `)];
13
+ let _classDecorators = [Component('x-viewpager-ng', [CommonEventsAndMethods, XViewpagerNgEvents], templateXViewpageNg)];
41
14
  let _classDescriptor;
42
15
  let _classExtraInitializers = [];
43
16
  let _classThis;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -100,7 +100,8 @@
100
100
  "**/*.css"
101
101
  ],
102
102
  "dependencies": {
103
- "@lynx-js/web-elements-reactive": "0.2.1"
103
+ "@lynx-js/web-elements-reactive": "0.2.2",
104
+ "@lynx-js/web-elements-template": "0.7.3"
104
105
  },
105
106
  "devDependencies": {
106
107
  "tslib": "^2.8.1"
@@ -9,7 +9,6 @@ x-foldview-ng {
9
9
  overflow-x: clip;
10
10
  overflow-x: hidden;
11
11
  overscroll-behavior: contain;
12
- contain: content;
13
12
  --foldview-header-height: 0px;
14
13
  scrollbar-width: none;
15
14
  }
@@ -13,9 +13,7 @@ x-image, filter-image {
13
13
  }
14
14
 
15
15
  x-image > *,
16
- filter-image > *,
17
- x-image:not(:defined),
18
- filter-image:not(:defined) {
16
+ filter-image > * {
19
17
  display: none;
20
18
  }
21
19
 
@@ -4,10 +4,6 @@
4
4
  // LICENSE file in the root directory of this source tree.
5
5
  */
6
6
  x-input {
7
- display: none;
8
- }
9
-
10
- x-input:defined {
11
7
  display: contents;
12
8
  }
13
9
 
@@ -59,6 +59,7 @@ list-item {
59
59
  display: none;
60
60
  content-visibility: auto;
61
61
  flex: 0 0 auto !important;
62
+ position: static;
62
63
  }
63
64
 
64
65
  x-list > list-item, x-list > lynx-wrapper > list-item {
@@ -3,9 +3,6 @@
3
3
  // Licensed under the Apache License Version 2.0 that can be found in the
4
4
  // LICENSE file in the root directory of this source tree.
5
5
  */
6
- x-overlay-ng:not(:defined) {
7
- display: none;
8
- }
9
6
  x-overlay-ng::part(dialog) {
10
7
  padding: 0;
11
8
  border: 0;
@@ -18,9 +18,6 @@ x-refresh-view {
18
18
  min-height: 0;
19
19
  border-style: solid;
20
20
  }
21
- x-refresh-view:not(:defined) {
22
- display: none;
23
- }
24
21
 
25
22
  x-refresh-view::part(container),
26
23
  x-refresh-view::part(content),
@@ -15,9 +15,6 @@ x-text:not(x-text > x-text):not(x-text > lynx-wrapper > x-text) {
15
15
  --lynx-color: canvastext;
16
16
  --lynx-text-bg-color: initial;
17
17
  }
18
- x-text:not(:defined) {
19
- display: none;
20
- }
21
18
 
22
19
  x-text > * {
23
20
  display: none;
@@ -41,36 +38,35 @@ inline-text, inline-image, inline-truncation {
41
38
  }
42
39
 
43
40
  /* nested components */
44
- x-text > x-text:defined,
45
- x-text > inline-text:defined,
46
- x-text > x-text:defined,
47
- inline-text > inline-text:defined,
48
- inline-truncation > inline-text:defined,
49
- inline-truncation > x-text:defined,
50
- x-text > lynx-wrapper > x-text:defined,
51
- x-text > lynx-wrapper > inline-text:defined,
52
- x-text > lynx-wrapper > x-text:defined,
53
- inline-text > lynx-wrapper > inline-text:defined,
54
- x-text > lynx-wrapper > x:defined,
55
- inline-truncation > lynx-wrapper > inline-text:defined,
56
- inline-truncation > lynx-wrapper > x-text:defined {
41
+ x-text > x-text,
42
+ x-text > inline-text,
43
+ inline-text > inline-text,
44
+ inline-truncation > inline-text,
45
+ inline-truncation > x-text,
46
+ x-text > lynx-wrapper > x-text,
47
+ x-text > lynx-wrapper > inline-text,
48
+ x-text > lynx-wrapper > x-text,
49
+ inline-text > lynx-wrapper > inline-text,
50
+ x-text > lynx-wrapper > *,
51
+ inline-truncation > lynx-wrapper > inline-text,
52
+ inline-truncation > lynx-wrapper > x-text {
57
53
  display: inline;
58
54
  background-clip: inherit;
59
55
  -webkit-background-clip: inherit;
60
56
  }
61
57
 
62
- x-text > inline-image:defined,
63
- x-text > x-image:defined,
64
- inline-truncation > inline-image:defined,
65
- inline-truncation > x-image:defined,
66
- inline-text > inline-image:defined,
67
- inline-text > x-image:defined,
68
- x-text > lynx-wrapper > inline-image:defined,
69
- x-text > lynx-wrapper > x-image:defined,
70
- inline-truncation > lynx-wrapper > inline-image:defined,
71
- inline-truncation > lynx-wrapper > x-image:defined,
72
- inline-text > lynx-wrapper > inline-image:defined,
73
- inline-text > lynx-wrapper > x-image:defined {
58
+ x-text > inline-image,
59
+ x-text > x-image,
60
+ inline-truncation > inline-image,
61
+ inline-truncation > x-image,
62
+ inline-text > inline-image,
63
+ inline-text > x-image,
64
+ x-text > lynx-wrapper > inline-image,
65
+ x-text > lynx-wrapper > x-image,
66
+ inline-truncation > lynx-wrapper > inline-image,
67
+ inline-truncation > lynx-wrapper > x-image,
68
+ inline-text > lynx-wrapper > inline-image,
69
+ inline-text > lynx-wrapper > x-image {
74
70
  display: contents !important;
75
71
  }
76
72
  x-text > x-view, x-text > lynx-wrapper > x-view {
@@ -230,7 +226,7 @@ x-text[text-maxline][tail-color-convert="false"]::part(inner-box) {
230
226
  }
231
227
 
232
228
  raw-text {
233
- display: none;
229
+ display: none; /* raw-text only works in x-text */
234
230
  white-space-collapse: preserve-breaks;
235
231
  }
236
232
  x-text > raw-text,
@@ -239,3 +235,8 @@ x-text > lynx-wrapper > raw-text,
239
235
  inline-text > lynx-wrapper > raw-text {
240
236
  display: contents !important;
241
237
  }
238
+
239
+ raw-text:not(:defined)::before {
240
+ content: attr(text);
241
+ display: contents;
242
+ }
@@ -4,10 +4,6 @@
4
4
  // LICENSE file in the root directory of this source tree.
5
5
  */
6
6
  x-textarea {
7
- display: none;
8
- }
9
-
10
- x-textarea:defined {
11
7
  display: contents;
12
8
  }
13
9
 
@@ -7,9 +7,9 @@ x-viewpager-ng, x-viewpager-item-ng {
7
7
  display: none;
8
8
  }
9
9
 
10
- x-viewpager-ng:defined,
11
- x-viewpager-ng > x-viewpager-item-ng:defined,
12
- x-viewpager-ng > lynx-wrapper > x-viewpager-item-ng:defined {
10
+ x-viewpager-ng,
11
+ x-viewpager-ng > x-viewpager-item-ng,
12
+ x-viewpager-ng > lynx-wrapper > x-viewpager-item-ng {
13
13
  display: flex;
14
14
  }
15
15
 
@@ -146,7 +146,8 @@ x-refresh-header,
146
146
  x-refresh-view,
147
147
  x-swiper-item,
148
148
  x-viewpager-item-ng,
149
- x-viewpager-ng {
149
+ x-viewpager-ng,
150
+ list-item {
150
151
  /*
151
152
  --lynx-display-toggle is compile-time generated.
152
153
  */
@@ -195,7 +196,8 @@ x-refresh-header,
195
196
  x-refresh-view,
196
197
  x-swiper-item,
197
198
  x-viewpager-item-ng,
198
- x-viewpager-ng {
199
+ x-viewpager-ng,
200
+ list-item {
199
201
  flex-wrap: var(--lynx-display-linear, nowrap)
200
202
  var(
201
203
  --lynx-display-flex,