@lynx-js/web-elements 0.6.0 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fix: ([#629](https://github.com/lynx-family/lynx-stack/pull/629))
8
+
9
+ - typo of `initial-scroll-offset` in scroll-view.
10
+ - scroll-view's `initial-scroll-index` is changed to `initial-scroll-to-index`.
11
+
12
+ ### Patch Changes
13
+
14
+ - fix: x-image border-radius setting has no effect. ([#638](https://github.com/lynx-family/lynx-stack/pull/638))
15
+
16
+ - perf: late evaluate document.font.ready ([#604](https://github.com/lynx-family/lynx-stack/pull/604))
17
+
18
+ - perf: improve raw-text performance ([#601](https://github.com/lynx-family/lynx-stack/pull/601))
19
+
20
+ - fix: the scroll-x field of scroll-view needs to be handled correctly. ([#635](https://github.com/lynx-family/lynx-stack/pull/635))
21
+
22
+ Before this, scroll-x of '' would result in no scrolling along x-axis.
23
+
24
+ - feat: x-list supports `need-visible-item-info`, now you can get visible cells info in `scroll`、`scrolltoupper`、`scrolltolower` event. ([#595](https://github.com/lynx-family/lynx-stack/pull/595))
25
+
3
26
  ## 0.6.0
4
27
 
5
28
  ### Minor Changes
@@ -14,8 +14,8 @@ let ScrollAttributes = (() => {
14
14
  return class ScrollAttributes {
15
15
  static {
16
16
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
17
- _private_handleInitialScrollOffset_decorators = [registerAttributeHandler('scroll-top', false), registerAttributeHandler('scroll-left', false), registerAttributeHandler('nitial-scroll-offset', false)];
18
- _private_handleInitialScrollIndex_decorators = [registerAttributeHandler('scroll-to-index', false), registerAttributeHandler('initial-scroll-index', false)];
17
+ _private_handleInitialScrollOffset_decorators = [registerAttributeHandler('scroll-top', false), registerAttributeHandler('scroll-left', false), registerAttributeHandler('initial-scroll-offset', false)];
18
+ _private_handleInitialScrollIndex_decorators = [registerAttributeHandler('scroll-to-index', false), registerAttributeHandler('initial-scroll-to-index', false)];
19
19
  __esDecorate(this, _private_handleInitialScrollOffset_descriptor = { value: __setFunctionName(function (newVal, _, attributeName) {
20
20
  if (newVal) {
21
21
  const scrollValue = parseFloat(newVal);
@@ -49,7 +49,7 @@ let ScrollAttributes = (() => {
49
49
  const scrollValue = parseFloat(newVal);
50
50
  const childrenElement = this.#dom.children.item(scrollValue);
51
51
  if (childrenElement && childrenElement instanceof HTMLElement) {
52
- const scrollX = !!this.#dom.getAttribute('scroll-x');
52
+ const scrollX = this.#dom.getAttribute('scroll-x') !== null;
53
53
  requestAnimationFrame(() => {
54
54
  if (scrollX) {
55
55
  this.#dom.scrollLeft = childrenElement.offsetLeft;
@@ -69,7 +69,7 @@ let ScrollAttributes = (() => {
69
69
  'scroll-left',
70
70
  'initial-scroll-offset',
71
71
  'scroll-to-index',
72
- 'initial-scroll-index',
72
+ 'initial-scroll-to-index',
73
73
  ];
74
74
  constructor(dom) {
75
75
  this.#dom = dom;
@@ -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) => {
@@ -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
  }
@@ -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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -68,6 +68,7 @@ x-image[auto-size]::part(img) {
68
68
  min-width: inherit;
69
69
  min-height: inherit;
70
70
  border: inherit;
71
+ border-radius: inherit;
71
72
  max-width: 100%;
72
73
  max-height: 100%;
73
74
  position: inherit;
@@ -196,14 +196,16 @@ x-refresh-view,
196
196
  x-swiper-item,
197
197
  x-viewpager-item-ng,
198
198
  x-viewpager-ng {
199
- flex-wrap: var(--lynx-display-linear, nowrap) var(
200
- --lynx-display-flex,
201
- var(--flex-wrap)
202
- );
203
- flex-direction: var(--lynx-display-linear, var(--linear-flex-direction)) var(
204
- --lynx-display-flex,
205
- var(--flex-direction)
206
- );
199
+ flex-wrap: var(--lynx-display-linear, nowrap)
200
+ var(
201
+ --lynx-display-flex,
202
+ var(--flex-wrap)
203
+ );
204
+ flex-direction: var(--lynx-display-linear, var(--linear-flex-direction))
205
+ var(
206
+ --lynx-display-flex,
207
+ var(--flex-direction)
208
+ );
207
209
  justify-content: var(--lynx-display-linear, var(--linear-justify-content));
208
210
  }
209
211