@lynx-js/web-elements 0.5.4 → 0.7.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 (59) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/dist/ScrollView/ScrollAttributes.js +4 -4
  3. package/dist/ScrollView/ScrollView.js +3 -3
  4. package/dist/XAudioTT/XAudioTT.js +2 -2
  5. package/dist/XCanvas/XCanvas.js +2 -2
  6. package/dist/XFoldViewNg/XFoldviewHeaderNg.d.ts +2 -0
  7. package/dist/XFoldViewNg/XFoldviewHeaderNg.js +9 -4
  8. package/dist/XFoldViewNg/XFoldviewNg.d.ts +13 -2
  9. package/dist/XFoldViewNg/XFoldviewNg.js +43 -5
  10. package/dist/XFoldViewNg/XFoldviewNgEvents.d.ts +1 -1
  11. package/dist/XFoldViewNg/XFoldviewNgEvents.js +17 -5
  12. package/dist/XFoldViewNg/XFoldviewSlotDragNg.js +2 -2
  13. package/dist/XFoldViewNg/XFoldviewSlotNg.d.ts +1 -0
  14. package/dist/XFoldViewNg/XFoldviewSlotNg.js +8 -2
  15. package/dist/XFoldViewNg/XFoldviewSlotNgTouchEventsHandler.js +51 -37
  16. package/dist/XFoldViewNg/XFoldviewToolbarNg.d.ts +2 -0
  17. package/dist/XFoldViewNg/XFoldviewToolbarNg.js +9 -2
  18. package/dist/XImage/FilterImage.js +2 -2
  19. package/dist/XImage/XImage.js +2 -2
  20. package/dist/XInput/XInput.js +2 -2
  21. package/dist/XList/ListItem.js +2 -2
  22. package/dist/XList/XList.js +4 -3
  23. package/dist/XList/XListAttributes.js +1 -0
  24. package/dist/XList/XListEvents.js +5 -3
  25. package/dist/XList/XListWaterfall.d.ts +8 -0
  26. package/dist/XList/XListWaterfall.js +144 -0
  27. package/dist/XOverlayNg/XOverlayNg.d.ts +2 -0
  28. package/dist/XOverlayNg/XOverlayNg.js +5 -2
  29. package/dist/XRefreshView/XRefreshFooter.js +2 -2
  30. package/dist/XRefreshView/XRefreshHeader.js +2 -2
  31. package/dist/XRefreshView/XRefreshView.js +2 -2
  32. package/dist/XSvg/XSvg.js +2 -2
  33. package/dist/XSwiper/SwiperItem.js +2 -2
  34. package/dist/XSwiper/XSwiper.js +2 -2
  35. package/dist/XText/RawText.js +4 -4
  36. package/dist/XText/XText.d.ts +2 -0
  37. package/dist/XText/XText.js +3 -3
  38. package/dist/XText/XTextTruncation.js +6 -9
  39. package/dist/XTextarea/XTextarea.js +2 -2
  40. package/dist/XView/XBlurView.js +2 -2
  41. package/dist/XView/XView.d.ts +2 -0
  42. package/dist/XView/XView.js +5 -3
  43. package/dist/XViewpagerNg/XViewpagerItemNg.js +2 -2
  44. package/dist/XViewpagerNg/XViewpagerNg.js +2 -2
  45. package/dist/common/CommonEventsAndMethods.d.ts +31 -2
  46. package/dist/common/CommonEventsAndMethods.js +198 -7
  47. package/dist/index.d.ts +1 -1
  48. package/dist/index.js +1 -1
  49. package/package.json +1 -1
  50. package/src/ScrollView/scroll-view.css +0 -1
  51. package/src/XFoldViewNg/x-foldview-ng.css +0 -3
  52. package/src/XImage/x-image.css +1 -0
  53. package/src/XList/x-list.css +67 -5
  54. package/src/XText/x-text.css +13 -45
  55. package/src/common-css/linear.css +10 -8
  56. package/dist/XFoldViewNg/XFoldviewHeaderNgFeatures.d.ts +0 -9
  57. package/dist/XFoldViewNg/XFoldviewHeaderNgFeatures.js +0 -32
  58. package/dist/common/Exposure.d.ts +0 -32
  59. package/dist/common/Exposure.js +0 -202
@@ -9,10 +9,10 @@ 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
- import { LynxExposure } from '../common/Exposure.js';
12
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
13
13
  let XInput = (() => {
14
14
  let _classDecorators = [Component('x-input', [
15
- LynxExposure,
15
+ CommonEventsAndMethods,
16
16
  Placeholder,
17
17
  XInputAttribute,
18
18
  InputBaseAttributes,
@@ -5,9 +5,9 @@ import { __esDecorate, __runInitializers } from "tslib";
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Component } from '@lynx-js/web-elements-reactive';
8
- import { LynxExposure } from '../common/Exposure.js';
8
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  let ListItem = (() => {
10
- let _classDecorators = [Component('list-item', [LynxExposure])];
10
+ let _classDecorators = [Component('list-item', [CommonEventsAndMethods])];
11
11
  let _classDescriptor;
12
12
  let _classExtraInitializers = [];
13
13
  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 { boostedQueueMicrotask, Component, genDomGetter, html, } from '@lynx-js/web-elements-reactive';
7
+ import { Component, genDomGetter, html } from '@lynx-js/web-elements-reactive';
8
8
  import { XListAttributes } from './XListAttributes.js';
9
9
  import { XListEvents } from './XListEvents.js';
10
- import { LynxExposure } from '../common/Exposure.js';
10
+ import { XListWaterfall } from './XListWaterfall.js';
11
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
11
12
  import { commonComponentEventSetting } from '../common/commonEventInitConfiguration.js';
12
13
  let XList = (() => {
13
- let _classDecorators = [Component('x-list', [LynxExposure, XListAttributes, XListEvents], html `<style>
14
+ let _classDecorators = [Component('x-list', [CommonEventsAndMethods, XListAttributes, XListEvents, XListWaterfall], html `<style>
14
15
  .placeholder-dom {
15
16
  display: none;
16
17
  flex: 0 0 0;
@@ -5,6 +5,7 @@ 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';
8
9
  let XListAttributes = (() => {
9
10
  let _private_handlerStickyOffset_decorators;
10
11
  let _private_handlerStickyOffset_initializers = [];
@@ -101,6 +101,7 @@ let XListEvents = (() => {
101
101
  #getUpperThresholdObserverDom = genDomGetter(() => this.#dom.shadowRoot, '#upper-threshold-observer');
102
102
  #getLowerThresholdObserverDom = genDomGetter(() => this.#dom.shadowRoot, '#lower-threshold-observer');
103
103
  #getScrollDetail() {
104
+ const needVisibleItemInfo = this.#dom.getAttribute('need-visible-item-info') !== null;
104
105
  const { scrollTop, scrollLeft, scrollHeight, scrollWidth } = this
105
106
  .#getListContainer();
106
107
  const detail = {
@@ -110,6 +111,9 @@ let XListEvents = (() => {
110
111
  scrollWidth,
111
112
  deltaX: scrollLeft - this.#prevX,
112
113
  deltaY: scrollTop - this.#prevY,
114
+ attachedCells: needVisibleItemInfo
115
+ ? this.#dom.getVisibleCells()
116
+ : undefined,
113
117
  };
114
118
  this.#prevX = scrollLeft;
115
119
  this.#prevY = scrollTop;
@@ -276,9 +280,7 @@ let XListEvents = (() => {
276
280
  }
277
281
  this.#dom.dispatchEvent(new CustomEvent('lynxscroll', {
278
282
  ...commonComponentEventSetting,
279
- detail: {
280
- type: 'scroll',
281
- },
283
+ detail: this.#getScrollDetail(),
282
284
  }));
283
285
  };
284
286
  #handleScrollEventsSwitches = __runInitializers(this, _private_handleScrollEventsSwitches_initializers, (enabled, name) => {
@@ -0,0 +1,8 @@
1
+ import { type AttributeReactiveClass } from '@lynx-js/web-elements-reactive';
2
+ import type { XList } from './XList.js';
3
+ export declare class XListWaterfall implements InstanceType<AttributeReactiveClass<typeof HTMLElement>> {
4
+ #private;
5
+ static observedAttributes: never[];
6
+ constructor(dom: XList);
7
+ connectedCallback(): void;
8
+ }
@@ -0,0 +1,144 @@
1
+ /*
2
+ // Copyright 2024 The Lynx Authors. All rights reserved.
3
+ // Licensed under the Apache License Version 2.0 that can be found in the
4
+ // LICENSE file in the root directory of this source tree.
5
+ */
6
+ import { boostedQueueMicrotask, genDomGetter, } from '@lynx-js/web-elements-reactive';
7
+ const WATERFALL_SLOT = 'waterfall-slot';
8
+ 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];
37
+ }
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
+ }
46
+ 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];
59
+ }
60
+ }
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`);
65
+ }
66
+ else {
67
+ listItem.setAttribute(`${WATERFALL_STYLE}-left`, `${shortestMeasurement}px`);
68
+ listItem.setAttribute(`${WATERFALL_STYLE}-top`, crossOffset);
69
+ }
70
+ measurements[shortestIndex] += increasedMeasurement;
71
+ }
72
+ }
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);
113
+ });
114
+ });
115
+ Array.from(this.#dom.children).forEach(element => {
116
+ this.#resizeObserver?.observe(element);
117
+ });
118
+ };
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
+ }
144
+ //# sourceMappingURL=XListWaterfall.js.map
@@ -1,2 +1,4 @@
1
+ import { layoutChangeTarget } from '../common/CommonEventsAndMethods.js';
1
2
  export declare class XOverlayNg extends HTMLElement {
3
+ get [layoutChangeTarget](): HTMLElement;
2
4
  }
@@ -4,11 +4,11 @@ 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 { LynxExposure } from '../common/Exposure.js';
7
+ import { layoutChangeTarget, CommonEventsAndMethods, } from '../common/CommonEventsAndMethods.js';
8
8
  import { XOverlayAttributes } from './XOverlayAttributes.js';
9
9
  import { Component, html } from '@lynx-js/web-elements-reactive';
10
10
  let XOverlayNg = (() => {
11
- let _classDecorators = [Component('x-overlay-ng', [LynxExposure, XOverlayAttributes], html `
11
+ let _classDecorators = [Component('x-overlay-ng', [CommonEventsAndMethods, XOverlayAttributes], html `
12
12
  <style>
13
13
  #dialog[open] {
14
14
  top: 0;
@@ -38,6 +38,9 @@ let XOverlayNg = (() => {
38
38
  if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
39
39
  __runInitializers(_classThis, _classExtraInitializers);
40
40
  }
41
+ get [layoutChangeTarget]() {
42
+ return this.shadowRoot.firstElementChild;
43
+ }
41
44
  };
42
45
  return XOverlayNg = _classThis;
43
46
  })();
@@ -6,10 +6,10 @@ import { __esDecorate, __runInitializers } from "tslib";
6
6
  */
7
7
  import { Component } from '@lynx-js/web-elements-reactive';
8
8
  import { XRefreshSubElementIntersectionObserver } from './XRefreshSubElementIntersectionObserver.js';
9
- import { LynxExposure } from '../common/Exposure.js';
9
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
10
10
  let XRefreshFooter = (() => {
11
11
  let _classDecorators = [Component('x-refresh-footer', [
12
- LynxExposure,
12
+ CommonEventsAndMethods,
13
13
  XRefreshSubElementIntersectionObserver,
14
14
  ])];
15
15
  let _classDescriptor;
@@ -6,10 +6,10 @@ import { __esDecorate, __runInitializers } from "tslib";
6
6
  */
7
7
  import { Component } from '@lynx-js/web-elements-reactive';
8
8
  import { XRefreshSubElementIntersectionObserver } from './XRefreshSubElementIntersectionObserver.js';
9
- import { LynxExposure } from '../common/Exposure.js';
9
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
10
10
  let XRefreshHeader = (() => {
11
11
  let _classDecorators = [Component('x-refresh-header', [
12
- LynxExposure,
12
+ CommonEventsAndMethods,
13
13
  XRefreshSubElementIntersectionObserver,
14
14
  ])];
15
15
  let _classDescriptor;
@@ -6,10 +6,10 @@ import { __esDecorate, __runInitializers } from "tslib";
6
6
  */
7
7
  import { Component, genDomGetter, html } from '@lynx-js/web-elements-reactive';
8
8
  import { XRefreshViewEventsEmitter } from './XRefreshViewEventsEmitter.js';
9
- import { LynxExposure } from '../common/Exposure.js';
9
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
10
10
  import { scrollContainerDom } from '../common/constants.js';
11
11
  let XRefreshView = (() => {
12
- let _classDecorators = [Component('x-refresh-view', [LynxExposure, XRefreshViewEventsEmitter], html `
12
+ let _classDecorators = [Component('x-refresh-view', [CommonEventsAndMethods, XRefreshViewEventsEmitter], html `
13
13
  <style>
14
14
  .bounce-container {
15
15
  overflow: scroll;
package/dist/XSvg/XSvg.js CHANGED
@@ -5,7 +5,7 @@ import { __esDecorate, __runInitializers } from "tslib";
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Component, bindToStyle, registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
8
- import { LynxExposure } from '../common/Exposure.js';
8
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { commonComponentEventSetting } from '../common/commonEventInitConfiguration.js';
10
10
  let XSvgFeatures = (() => {
11
11
  let _private_handleSrc_decorators;
@@ -57,7 +57,7 @@ let XSvgFeatures = (() => {
57
57
  })();
58
58
  export { XSvgFeatures };
59
59
  let XSvg = (() => {
60
- let _classDecorators = [Component('x-svg', [LynxExposure, XSvgFeatures])];
60
+ let _classDecorators = [Component('x-svg', [CommonEventsAndMethods, XSvgFeatures])];
61
61
  let _classDescriptor;
62
62
  let _classExtraInitializers = [];
63
63
  let _classThis;
@@ -5,9 +5,9 @@ import { __esDecorate, __runInitializers } from "tslib";
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Component } from '@lynx-js/web-elements-reactive';
8
- import { LynxExposure } from '../common/Exposure.js';
8
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  let SwiperItem = (() => {
10
- let _classDecorators = [Component('x-swiper-item', [LynxExposure])];
10
+ let _classDecorators = [Component('x-swiper-item', [CommonEventsAndMethods])];
11
11
  let _classDescriptor;
12
12
  let _classExtraInitializers = [];
13
13
  let _classThis;
@@ -9,11 +9,11 @@ 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
- import { LynxExposure } from '../common/Exposure.js';
12
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
13
13
  import { scrollContainerDom } from '../common/constants.js';
14
14
  let XSwiper = (() => {
15
15
  let _classDecorators = [Component('x-swiper', [
16
- LynxExposure,
16
+ CommonEventsAndMethods,
17
17
  XSwiperIndicator,
18
18
  XSwipeEvents,
19
19
  XSwiperCircular,
@@ -14,17 +14,17 @@ let RawTextAttributes = (() => {
14
14
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
15
15
  _private_handleText_decorators = [registerAttributeHandler('text', true)];
16
16
  __esDecorate(this, _private_handleText_descriptor = { value: __setFunctionName(function (newVal) {
17
+ this.#text?.remove();
17
18
  if (newVal) {
18
- this.#dom.innerHTML = newVal;
19
- }
20
- else {
21
- this.#dom.innerHTML = '';
19
+ this.#text = new Text(newVal);
20
+ this.#dom.append(this.#text);
22
21
  }
23
22
  }, "#handleText") }, _private_handleText_decorators, { kind: "method", name: "#handleText", static: false, private: true, access: { has: obj => #handleText in obj, get: obj => obj.#handleText }, metadata: _metadata }, null, _instanceExtraInitializers);
24
23
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
25
24
  }
26
25
  static observedAttributes = ['text'];
27
26
  #dom = __runInitializers(this, _instanceExtraInitializers);
27
+ #text;
28
28
  constructor(currentElement) {
29
29
  this.#dom = currentElement;
30
30
  }
@@ -1,5 +1,7 @@
1
+ import { layoutChangeTarget } from '../common/CommonEventsAndMethods.js';
1
2
  export declare class XText extends HTMLElement {
2
3
  static readonly notToFilterFalseAttributes: Set<string>;
3
4
  superScrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
4
5
  scrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
6
+ [layoutChangeTarget]: this;
5
7
  }
@@ -5,12 +5,11 @@ import { __esDecorate, __runInitializers } from "tslib";
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Component, html } from '@lynx-js/web-elements-reactive';
8
- import { LynxExposure } from '../common/Exposure.js';
9
8
  import { XTextTruncation } from './XTextTruncation.js';
10
9
  import { ScrollIntoView } from '../ScrollView/ScrollIntoView.js';
11
- import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
10
+ import { CommonEventsAndMethods, layoutChangeTarget, } from '../common/CommonEventsAndMethods.js';
12
11
  let XText = (() => {
13
- let _classDecorators = [Component('x-text', [LynxExposure, CommonEventsAndMethods, XTextTruncation], html `<div id="inner-box" part="inner-box"><slot></slot><slot name="inline-truncation"></slot></div>`)];
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>`)];
14
13
  let _classDescriptor;
15
14
  let _classExtraInitializers = [];
16
15
  let _classThis;
@@ -40,6 +39,7 @@ let XText = (() => {
40
39
  super.scrollIntoView(arg);
41
40
  }
42
41
  }
42
+ [layoutChangeTarget] = this;
43
43
  static {
44
44
  __runInitializers(_classThis, _classExtraInitializers);
45
45
  }
@@ -127,20 +127,19 @@ let XTextTruncation = (() => {
127
127
  if (this.#scheduledTextLayout)
128
128
  return;
129
129
  this.#scheduledTextLayout = true;
130
- boostedQueueMicrotask(() => {
131
- this.#layoutTextInner();
130
+ boostedQueueMicrotask(async () => {
131
+ await this.#layoutTextInner();
132
132
  this.#startObservers();
133
- queueMicrotask(() => {
134
- this.#scheduledTextLayout = false;
135
- });
133
+ this.#scheduledTextLayout = false;
136
134
  });
137
135
  }
138
- #layoutTextInner() {
136
+ async #layoutTextInner() {
139
137
  this.#inplaceEllipsisNode?.parentElement?.removeChild(this.#inplaceEllipsisNode);
140
138
  this.#revertTruncatedTextNodes();
141
139
  if (!this.#doExpensiveLineLayoutCalculation && isNaN(this.#maxLength)) {
142
140
  return;
143
141
  }
142
+ await document.fonts.ready;
144
143
  const parentBondingRect = this.#getInnerBox().getBoundingClientRect();
145
144
  this.#textMeasure = new TextRenderingMeasureTool(this.#dom, parentBondingRect);
146
145
  const measure = this.#textMeasure;
@@ -338,9 +337,7 @@ let XTextTruncation = (() => {
338
337
  connectedCallback() {
339
338
  this.#componentConnected = true;
340
339
  this.#handleEnableLayoutEvent(this.#enableLayoutEvent);
341
- document.fonts.ready.then(() => {
342
- this.#handleAttributeChange();
343
- });
340
+ this.#handleAttributeChange();
344
341
  boostedQueueMicrotask(() => {
345
342
  this.#sendLayoutEvent();
346
343
  });
@@ -9,11 +9,11 @@ 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
- import { LynxExposure } from '../common/Exposure.js';
12
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
13
13
  // x-textarea
14
14
  let XTextarea = (() => {
15
15
  let _classDecorators = [Component('x-textarea', [
16
- LynxExposure,
16
+ CommonEventsAndMethods,
17
17
  Placeholder,
18
18
  TextareaBaseAttributes,
19
19
  XTextareaAttributes,
@@ -5,10 +5,10 @@ import { __esDecorate, __runInitializers } from "tslib";
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Component } from '@lynx-js/web-elements-reactive';
8
- import { LynxExposure } from '../common/Exposure.js';
8
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { BlurRadius } from './BlurRadius.js';
10
10
  let XBlurView = (() => {
11
- let _classDecorators = [Component('x-blur-view', [LynxExposure, BlurRadius], `<style id="dynamic-style"></style><slot></slot>`)];
11
+ let _classDecorators = [Component('x-blur-view', [CommonEventsAndMethods, BlurRadius], `<style id="dynamic-style"></style><slot></slot>`)];
12
12
  let _classDescriptor;
13
13
  let _classExtraInitializers = [];
14
14
  let _classThis;
@@ -1,4 +1,6 @@
1
+ import { layoutChangeTarget } from '../common/CommonEventsAndMethods.js';
1
2
  export declare class XView extends HTMLElement {
2
3
  superScrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
3
4
  scrollIntoView(arg?: boolean | ScrollIntoViewOptions | undefined): void;
5
+ [layoutChangeTarget]: this;
4
6
  }
@@ -6,10 +6,11 @@ import { __esDecorate, __runInitializers } from "tslib";
6
6
  */
7
7
  import { Component } from '@lynx-js/web-elements-reactive';
8
8
  import { ScrollIntoView } from '../ScrollView/ScrollIntoView.js';
9
- import { LynxExposure } from '../common/Exposure.js';
10
- import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
+ import { CommonEventsAndMethods, layoutChangeTarget, } from '../common/CommonEventsAndMethods.js';
11
10
  let XView = (() => {
12
- let _classDecorators = [Component('x-view', [LynxExposure, CommonEventsAndMethods])];
11
+ let _classDecorators = [Component('x-view', [
12
+ CommonEventsAndMethods,
13
+ ])];
13
14
  let _classDescriptor;
14
15
  let _classExtraInitializers = [];
15
16
  let _classThis;
@@ -39,6 +40,7 @@ let XView = (() => {
39
40
  super.scrollIntoView(arg);
40
41
  }
41
42
  }
43
+ [layoutChangeTarget] = this;
42
44
  };
43
45
  return XView = _classThis;
44
46
  })();
@@ -5,10 +5,10 @@ import { __esDecorate, __runInitializers } from "tslib";
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { Component } from '@lynx-js/web-elements-reactive';
8
- import { LynxExposure } from '../common/Exposure.js';
8
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  let XViewpagerItemNg = (() => {
10
10
  let _classDecorators = [Component('x-viewpager-item-ng', [
11
- LynxExposure,
11
+ CommonEventsAndMethods,
12
12
  ])];
13
13
  let _classDescriptor;
14
14
  let _classExtraInitializers = [];
@@ -5,11 +5,11 @@ import { __esDecorate, __runInitializers } from "tslib";
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { boostedQueueMicrotask, Component, html, } from '@lynx-js/web-elements-reactive';
8
- import { LynxExposure } from '../common/Exposure.js';
8
+ import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
9
9
  import { XViewpagerNgEvents } from './XViewpagerNgEvents.js';
10
10
  import { scrollContainerDom } from '../common/constants.js';
11
11
  let XViewpagerNg = (() => {
12
- let _classDecorators = [Component('x-viewpager-ng', [LynxExposure, XViewpagerNgEvents], html `
12
+ let _classDecorators = [Component('x-viewpager-ng', [CommonEventsAndMethods, XViewpagerNgEvents], html `
13
13
  <style>
14
14
  #bounce-padding {
15
15
  display: none;
@@ -1,6 +1,35 @@
1
+ export declare const layoutChangeTarget: unique symbol;
2
+ export interface ExposureParameters {
3
+ exposureID: string | null;
4
+ exposureArea: string | null;
5
+ exposureScene: string | null;
6
+ exposureScreenMarginTop: string | null;
7
+ exposureScreenMarginRight: string | null;
8
+ exposureScreenMarginBottom: string | null;
9
+ exposureScreenMarginLeft: string | null;
10
+ exposureUIMarginTop: string | null;
11
+ exposureUIMarginRight: string | null;
12
+ exposureUIMarginBottom: string | null;
13
+ exposureUIMarginLeft: string | null;
14
+ }
15
+ export interface ExposureEvent {
16
+ 'exposure-id': string;
17
+ 'exposure-scene': string;
18
+ exposureID: string;
19
+ exposureScene: string;
20
+ }
1
21
  export declare class CommonEventsAndMethods {
2
22
  #private;
3
- static readonly observedAttributes: never[];
4
- constructor(currentElement: HTMLElement);
23
+ static readonly observedAttributes: string[];
24
+ constructor(currentElement: HTMLElement & {
25
+ [layoutChangeTarget]?: HTMLElement;
26
+ });
27
+ onExposureParamsChanged: () => void;
28
+ onExposureIdChanged(_: string | null, oldValue: string | null): void;
29
+ attributeChangedHandler: this;
30
+ eventStatusChangedHandler: {
31
+ uiappear: (status: boolean) => void;
32
+ uidisappear: (status: boolean) => void;
33
+ };
5
34
  __handleScrollUpperThresholdEventEnabled: (enabled: boolean) => void;
6
35
  }