@lynx-js/web-elements 0.8.7 → 0.8.9

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.8.9
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: layoutchange event result `detail.top` and `detail.left` was `0` incorrectly ([#1887](https://github.com/lynx-family/lynx-stack/pull/1887))
8
+
9
+ - textarea placeholder inherits font-size by default ([#1874](https://github.com/lynx-family/lynx-stack/pull/1874))
10
+
11
+ - feat: support <x-text text="content"></x-text> ([#1881](https://github.com/lynx-family/lynx-stack/pull/1881))
12
+
13
+ - Updated dependencies []:
14
+ - @lynx-js/web-elements-template@0.8.9
15
+
16
+ ## 0.8.8
17
+
18
+ ### Patch Changes
19
+
20
+ - fix: ([#1837](https://github.com/lynx-family/lynx-stack/pull/1837))
21
+
22
+ 1. `LynxView.updateData()` cannot trigger `dataProcessor`.
23
+
24
+ 2. **This is a break change:** The second parameter of `LynxView.updateData()` has been changed from `UpdateDataType` to `string`, which is the `processorName` (default is `default` which will use `defaultDataProcessor`). This change is to better align with Native. The current complete type is as follows:
25
+
26
+ ```ts
27
+ LynxView.updateData(data: Cloneable, processorName?: string | undefined, callback?: (() => void) | undefined): void
28
+ ```
29
+
30
+ - Updated dependencies []:
31
+ - @lynx-js/web-elements-template@0.8.8
32
+
3
33
  ## 0.8.7
4
34
 
5
35
  ### Patch Changes
@@ -46,13 +46,13 @@ let XSwiperCircular = (() => {
46
46
  #getCircularFirstSlot = genDomGetter(() => this.#dom.shadowRoot, '#circular-start').bind(this);
47
47
  #getCircularLastSlot = genDomGetter(() => this.#dom.shadowRoot, '#circular-end').bind(this);
48
48
  #changeEventHandler(eventLikeObject) {
49
- const numberOfChlidren = this.#dom.childElementCount;
50
- if (numberOfChlidren > 2) {
49
+ const numberOfChildren = this.#dom.childElementCount;
50
+ if (numberOfChildren > 2) {
51
51
  const { current, isDragged, __isFirstLayout } = eventLikeObject.detail;
52
52
  if (current === 0
53
- || current === numberOfChlidren - 1
53
+ || current === numberOfChildren - 1
54
54
  || current === 2
55
- || current === numberOfChlidren - 2) {
55
+ || current === numberOfChildren - 2) {
56
56
  /**
57
57
  * for current = 0
58
58
  * start:[lastElement]
@@ -77,7 +77,7 @@ let XSwiperCircular = (() => {
77
77
  lastElement.setAttribute('slot', 'circular-start');
78
78
  targetElement = firstElement;
79
79
  }
80
- else if (current === numberOfChlidren - 1) {
80
+ else if (current === numberOfChildren - 1) {
81
81
  elementsAtStart.forEach((e) => e.removeAttribute('slot'));
82
82
  firstElement.setAttribute('slot', 'circular-end');
83
83
  targetElement = lastElement;
@@ -7,10 +7,11 @@ import { __esDecorate, __runInitializers } from "tslib";
7
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
+ import { RawTextAttributes } from './RawText.js';
10
11
  import { CommonEventsAndMethods, layoutChangeTarget, } from '../common/CommonEventsAndMethods.js';
11
12
  import { templateXText } from '@lynx-js/web-elements-template';
12
13
  let XText = (() => {
13
- let _classDecorators = [Component('x-text', [CommonEventsAndMethods, XTextTruncation], templateXText)];
14
+ let _classDecorators = [Component('x-text', [CommonEventsAndMethods, XTextTruncation, RawTextAttributes], templateXText)];
14
15
  let _classDescriptor;
15
16
  let _classExtraInitializers = [];
16
17
  let _classThis;
@@ -29,9 +29,10 @@ let CommonEventsAndMethods = (() => {
29
29
  if (!this.#resizeObserver) {
30
30
  this.#resizeObserver = new ResizeObserver(([entry]) => {
31
31
  if (entry) {
32
- // The layoutchange event is the border box of the element
33
- const { width, height, left, right, top, bottom } = entry.contentRect;
34
32
  const id = this.#dom.id;
33
+ // Reuse getBoundingClientRect to get left and top, because ResizeObserver-contentRect is calculated based on padding box
34
+ const { top, bottom, left, right, width, height } = entry.target
35
+ .getBoundingClientRect();
35
36
  this.#dom.dispatchEvent(new CustomEvent('layoutchange', {
36
37
  detail: {
37
38
  width,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.8.7",
3
+ "version": "0.8.9",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -101,7 +101,7 @@
101
101
  ],
102
102
  "dependencies": {
103
103
  "@lynx-js/web-elements-reactive": "0.2.2",
104
- "@lynx-js/web-elements-template": "0.8.7"
104
+ "@lynx-js/web-elements-template": "0.8.9"
105
105
  },
106
106
  "devDependencies": {
107
107
  "tslib": "^2.8.1"
@@ -5,6 +5,7 @@
5
5
  */
6
6
  x-input {
7
7
  display: contents;
8
+ font-size: 14px;
8
9
  }
9
10
 
10
11
  x-input::part(form) {
@@ -32,13 +33,12 @@ x-input::part(input), x-input::part(form) {
32
33
 
33
34
  x-input::part(input) {
34
35
  --placeholder-color: grey;
35
- --placeholder-font-size: 14px;
36
36
  --placeholder-font-weight: normal;
37
37
  }
38
38
 
39
39
  x-input::part(input)::placeholder {
40
40
  color: var(--placeholder-color);
41
41
  font-family: var(--placeholder-font-family);
42
- font-size: var(--placeholder-font-size);
42
+ font-size: var(--placeholder-font-size, inherit);
43
43
  font-weight: var(--placeholder-font-weight);
44
44
  }
@@ -240,7 +240,8 @@ inline-text > lynx-wrapper > raw-text {
240
240
  display: contents !important;
241
241
  }
242
242
 
243
- raw-text:not(:defined)::before {
243
+ raw-text:not(:defined)::before,
244
+ x-text:not(:has(x-text, raw-text)):not(:defined)::before {
244
245
  content: attr(text);
245
246
  display: contents;
246
247
  }
@@ -5,6 +5,7 @@
5
5
  */
6
6
  x-textarea {
7
7
  display: contents;
8
+ font-size: 14px;
8
9
  }
9
10
 
10
11
  x-textarea::part(form) {
@@ -32,7 +33,6 @@ x-textarea::part(textarea), x-textarea::part(form) {
32
33
  }
33
34
  x-textarea::part(textarea) {
34
35
  --placeholder-color: grey;
35
- --placeholder-font-size: 14px;
36
36
  --placeholder-font-weight: normal;
37
37
  --placeholder-font-family: inherit;
38
38
  resize: none;
@@ -40,7 +40,7 @@ x-textarea::part(textarea) {
40
40
 
41
41
  x-textarea::part(textarea)::placeholder {
42
42
  color: var(--placeholder-color);
43
- font-size: var(--placeholder-font-size);
43
+ font-size: var(--placeholder-font-size, inherit);
44
44
  font-weight: var(--placeholder-font-weight);
45
45
  font-family: var(--placeholder-font-family);
46
46
  }