@lynx-js/web-elements 0.7.0 → 0.7.2

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,35 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - refactor: split shadowroot templates into a package ([#811](https://github.com/lynx-family/lynx-stack/pull/811))
8
+
9
+ We're going to implement Lynx Web Platform's SSR based on the `shadowrootmode`.
10
+
11
+ `https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/shadowRootMode`
12
+
13
+ (chrome 111, firefox 123, safari 16.4)
14
+
15
+ This means those modern browsers are able to show the correct layout before the web components are defined.
16
+
17
+ To make this work, we have to split the shadowroot template string into a new package `@lynx-js/web-elements-template`.
18
+
19
+ No features affected.
20
+
21
+ - Updated dependencies [[`ae9652a`](https://github.com/lynx-family/lynx-stack/commit/ae9652a7a1d6247959bb41e7d76793300eddb741), [`ae9652a`](https://github.com/lynx-family/lynx-stack/commit/ae9652a7a1d6247959bb41e7d76793300eddb741)]:
22
+ - @lynx-js/web-elements-template@0.7.2
23
+ - @lynx-js/web-elements-reactive@0.2.2
24
+
25
+ ## 0.7.1
26
+
27
+ ### Patch Changes
28
+
29
+ - fix(web): x-swiper-item threshold updated to 20 ([#639](https://github.com/lynx-family/lynx-stack/pull/639))
30
+
31
+ - fix: In React19, setter and getter functions are treated as properties, making it impossible to retrieve the current value via attributes. ([#639](https://github.com/lynx-family/lynx-stack/pull/639))
32
+
3
33
  ## 0.7.0
4
34
 
5
35
  ### Minor 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;
@@ -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;
@@ -2,8 +2,8 @@ import { scrollContainerDom } from '../common/constants.js';
2
2
  export declare class XSwiper extends HTMLElement {
3
3
  #private;
4
4
  static notToFilterFalseAttributes: Set<string>;
5
- get current(): number;
6
- set current(newval: number);
5
+ get currentIndex(): number;
6
+ set currentIndex(newval: number);
7
7
  get snapDistance(): number;
8
8
  get isVertical(): boolean;
9
9
  get circularPlay(): boolean;
@@ -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;
@@ -136,12 +91,12 @@ let XSwiper = (() => {
136
91
  minOffsetToMid,
137
92
  };
138
93
  }
139
- get current() {
94
+ get currentIndex() {
140
95
  return this.#getNeatestElementIndexAndDistanceToMid().current;
141
96
  }
142
- set current(newval) {
97
+ set currentIndex(newval) {
143
98
  // When current is specified and current is updated in bindchange, there is no need to respond to the update of current
144
- if (this.current === newval) {
99
+ if (this.currentIndex === newval) {
145
100
  return;
146
101
  }
147
102
  const smooth = this.getAttribute('smooth-scroll') === null; // smooth-scroll default true, it is set to be false
@@ -186,29 +141,29 @@ let XSwiper = (() => {
186
141
  return this.getAttribute('circular') !== null;
187
142
  }
188
143
  scrollToNext() {
189
- const current = this.current;
144
+ const current = this.currentIndex;
190
145
  const count = this.childElementCount;
191
146
  if (current === count - 1) {
192
147
  const circularPlay = this.circularPlay;
193
148
  if (circularPlay) {
194
- this.current = 0;
149
+ this.currentIndex = 0;
195
150
  }
196
151
  }
197
152
  else {
198
- this.current += 1;
153
+ this.currentIndex += 1;
199
154
  }
200
155
  }
201
156
  scrollToPrevious() {
202
- const current = this.current;
157
+ const current = this.currentIndex;
203
158
  const count = this.childElementCount;
204
159
  if (current === 0) {
205
160
  const circularPlay = this.circularPlay;
206
161
  if (circularPlay) {
207
- this.current = count - 1;
162
+ this.currentIndex = count - 1;
208
163
  }
209
164
  }
210
165
  else {
211
- this.current == count - 1;
166
+ this.currentIndex = count - 1;
212
167
  }
213
168
  }
214
169
  connectedCallback() {
@@ -19,7 +19,7 @@ let XSwiperAutoScroll = (() => {
19
19
  __esDecorate(this, _private_handleCurrentChange_descriptor = { value: __setFunctionName(function (newVal) {
20
20
  const newval = Number(newVal);
21
21
  if (!Number.isNaN(newval)) {
22
- this.#dom.current = newval;
22
+ this.#dom.currentIndex = newval;
23
23
  }
24
24
  }, "#handleCurrentChange") }, _private_handleCurrentChange_decorators, { kind: "method", name: "#handleCurrentChange", static: false, private: true, access: { has: obj => #handleCurrentChange in obj, get: obj => obj.#handleCurrentChange }, metadata: _metadata }, null, _instanceExtraInitializers);
25
25
  __esDecorate(this, _private_handleAutoplay_descriptor = { value: __setFunctionName(function () {
@@ -21,7 +21,7 @@ let XSwiperCircular = (() => {
21
21
  if (newVal !== null) {
22
22
  this.#changeEventHandler({
23
23
  detail: {
24
- current: this.#dom.current,
24
+ current: this.#dom.currentIndex,
25
25
  isDragged: false,
26
26
  __isFirstLayout: true,
27
27
  },
@@ -77,7 +77,7 @@ let XSwipeEvents = (() => {
77
77
  > pageLength / 4
78
78
  || currentScrollDistance < 10
79
79
  || Math.abs(currentScrollDistance - totalScrollDistance) <= pageLength) {
80
- const current = this.#dom.current;
80
+ const current = this.#dom.currentIndex;
81
81
  if (current !== this.#current) {
82
82
  this.#dom.dispatchEvent(new CustomEvent('change', {
83
83
  ...commonComponentEventSetting,
@@ -103,7 +103,7 @@ let XSwiperIndicator = (() => {
103
103
  }
104
104
  }).bind(this));
105
105
  boostedQueueMicrotask(() => {
106
- this.#getIndicatorContainer().children[this.#dom.current]?.style.setProperty('background-color', 'var(--indicator-active-color)', 'important');
106
+ this.#getIndicatorContainer().children[this.#dom.currentIndex]?.style.setProperty('background-color', 'var(--indicator-active-color)', 'important');
107
107
  });
108
108
  }
109
109
  }
@@ -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.0",
3
+ "version": "0.7.2",
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.2"
104
105
  },
105
106
  "devDependencies": {
106
107
  "tslib": "^2.8.1"
@@ -74,7 +74,7 @@ x-swiper-item {
74
74
  flex-basis: var(--lynx-linear-weight-basis) !important;
75
75
  }
76
76
 
77
- x-swiper-item:nth-child(n+5) {
77
+ x-swiper-item:nth-child(n+20) {
78
78
  contain: strict;
79
79
  content-visibility: auto;
80
80
  }