@lynx-js/web-elements 0.4.0 → 0.5.1

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,26 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`082ad97`](https://github.com/lynx-family/lynx-stack/commit/082ad97510c212aa00a9395044bb6fc39a82940a)]:
8
+ - @lynx-js/web-elements-reactive@0.2.1
9
+
10
+ ## 0.5.0
11
+
12
+ ### Minor Changes
13
+
14
+ - feat: 1. list adds support for the `sticky` attribute. Now sticky-offset, sticky-top, and sticky-bottom will only take effect when `sticky` is `true`. ([#257](https://github.com/lynx-family/lynx-stack/pull/257))
15
+
16
+ 2. Added support for `list-main-axis-gap`, `list-cross-axis-gap`.
17
+
18
+ - feat(web): The list element supports list-type with **flow**. ([#240](https://github.com/lynx-family/lynx-stack/pull/240))
19
+
20
+ It supports all attributes and events under single, and also provides `full-span`.
21
+
22
+ For detailed usage, please refer to the official website.
23
+
3
24
  ## 0.4.0
4
25
 
5
26
  ### Minor Changes
@@ -9,21 +9,29 @@ let XListAttributes = (() => {
9
9
  let _private_handlerStickyOffset_decorators;
10
10
  let _private_handlerStickyOffset_initializers = [];
11
11
  let _private_handlerStickyOffset_extraInitializers = [];
12
+ let _private_handlerCount_decorators;
13
+ let _private_handlerCount_initializers = [];
14
+ let _private_handlerCount_extraInitializers = [];
12
15
  return class XListAttributes {
13
16
  static {
14
17
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
15
18
  _private_handlerStickyOffset_decorators = [registerAttributeHandler('sticky-offset', true)];
19
+ _private_handlerCount_decorators = [registerAttributeHandler('span-count', true), registerAttributeHandler('column-count', true)];
16
20
  __esDecorate(null, null, _private_handlerStickyOffset_decorators, { kind: "field", name: "#handlerStickyOffset", static: false, private: true, access: { has: obj => #handlerStickyOffset in obj, get: obj => obj.#handlerStickyOffset, set: (obj, value) => { obj.#handlerStickyOffset = value; } }, metadata: _metadata }, _private_handlerStickyOffset_initializers, _private_handlerStickyOffset_extraInitializers);
21
+ __esDecorate(null, null, _private_handlerCount_decorators, { kind: "field", name: "#handlerCount", static: false, private: true, access: { has: obj => #handlerCount in obj, get: obj => obj.#handlerCount, set: (obj, value) => { obj.#handlerCount = value; } }, metadata: _metadata }, _private_handlerCount_initializers, _private_handlerCount_extraInitializers);
17
22
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
18
23
  }
19
24
  static observedAttributes = [
20
25
  'sticky-offset',
21
26
  'initial-scroll-index',
27
+ 'span-count',
28
+ 'column-count',
22
29
  ];
23
30
  #dom;
24
31
  #handlerStickyOffset = __runInitializers(this, _private_handlerStickyOffset_initializers, bindToStyle(() => this.#dom, '--list-item-sticky-offset', (v) => `${parseFloat(v)}px`));
32
+ #handlerCount = (__runInitializers(this, _private_handlerStickyOffset_extraInitializers), __runInitializers(this, _private_handlerCount_initializers, bindToStyle(() => this.#dom, '--list-item-span-count', (v) => `${parseFloat(v)}`)));
25
33
  constructor(dom) {
26
- __runInitializers(this, _private_handlerStickyOffset_extraInitializers);
34
+ __runInitializers(this, _private_handlerCount_extraInitializers);
27
35
  this.#dom = dom;
28
36
  }
29
37
  connectedCallback() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -100,7 +100,7 @@
100
100
  "**/*.css"
101
101
  ],
102
102
  "dependencies": {
103
- "@lynx-js/web-elements-reactive": "0.2.0"
103
+ "@lynx-js/web-elements-reactive": "0.2.1"
104
104
  },
105
105
  "devDependencies": {
106
106
  "tslib": "^2.8.1"
@@ -7,6 +7,9 @@ x-list {
7
7
  contain: layout;
8
8
  scrollbar-width: none;
9
9
  --list-item-sticky-offset: 0;
10
+ --list-item-span-count: 0;
11
+ --list-main-axis-gap: 0;
12
+ --list-cross-axis-gap: 0;
10
13
  }
11
14
 
12
15
  x-list > *:not(list-item) {
@@ -28,6 +31,8 @@ x-list::part(content) {
28
31
  overflow: inherit;
29
32
  position: relative;
30
33
  content-visibility: auto;
34
+ row-gap: inherit;
35
+ column-gap: inherit;
31
36
  }
32
37
 
33
38
  x-list::part(content), x-list::part(slot) {
@@ -60,74 +65,68 @@ x-list > list-item, x-list > lynx-wrapper > list-item {
60
65
  display: flex;
61
66
  }
62
67
 
63
- x-list[list-type="single"] {
64
- display: flex;
65
- flex-direction: column;
66
- align-items: stretch;
68
+ x-list {
67
69
  overflow-y: scroll !important;
68
70
  overflow-x: clip !important;
69
71
  }
70
72
 
71
- x-list[list-type="single"][scroll-orientation="horizontal"] {
72
- flex-direction: row;
73
+ x-list[scroll-orientation="horizontal"] {
73
74
  overflow-x: scroll !important;
74
75
  overflow-y: clip !important;
75
76
  }
76
77
 
77
- x-list[list-type="single"][enable-scroll="false"] {
78
+ x-list[enable-scroll="false"] {
78
79
  overflow-y: hidden !important;
79
80
  }
80
81
 
81
- x-list[list-type="single"][scroll-orientation="horizontal"][enable-scroll="false"] {
82
+ x-list[scroll-orientation="horizontal"][enable-scroll="false"] {
82
83
  overflow-x: hidden !important;
83
84
  }
84
85
 
85
- list-item[sticky-top], list-item[sticky-bottom] {
86
+ x-list[sticky="true"] list-item[sticky-top],
87
+ x-list[sticky="true"] list-item[sticky-bottom] {
86
88
  position: sticky;
87
89
  z-index: 1;
88
90
  }
89
91
 
90
- x-list[list-type="single"] > list-item[sticky-top],
91
- x-list[list-type="single"] > lynx-wrapper > list-item[sticky-top] {
92
+ x-list[sticky="true"] > list-item[sticky-top],
93
+ x-list[sticky="true"] > lynx-wrapper > list-item[sticky-top] {
92
94
  top: var(--list-item-sticky-offset);
93
95
  }
94
96
 
95
- x-list[list-type="single"] > list-item[sticky-bottom],
96
- x-list[list-type="single"] > lynx-wrapper > list-item[sticky-bottom] {
97
+ x-list[sticky="true"] > list-item[sticky-bottom],
98
+ x-list[sticky="true"] > lynx-wrapper > list-item[sticky-bottom] {
97
99
  bottom: var(--list-item-sticky-offset);
98
100
  }
99
101
 
100
- x-list[list-type="single"][scroll-orientation="horizontal"]
101
- > list-item[sticky-top],
102
- x-list[list-type="single"][scroll-orientation="horizontal"]
102
+ x-list[sticky="true"][scroll-orientation="horizontal"] > list-item[sticky-top],
103
+ x-list[sticky="true"][scroll-orientation="horizontal"]
103
104
  > lynx-wrapper
104
105
  > list-item[sticky-top] {
105
106
  top: unset;
106
107
  left: var(--list-item-sticky-offset);
107
108
  }
108
109
 
109
- x-list[list-type="single"][scroll-orientation="horizontal"]
110
+ x-list[sticky="true"][scroll-orientation="horizontal"]
110
111
  > list-item[sticky-bottom],
111
- x-list[list-type="single"][scroll-orientation="horizontal"]
112
+ x-list[sticky="true"][scroll-orientation="horizontal"]
112
113
  > lynx-wrapper
113
114
  > list-item[sticky-bottom] {
114
115
  bottom: unset;
115
116
  right: var(--list-item-sticky-offset);
116
117
  }
117
118
 
118
- x-list[list-type="single"][item-snap],
119
- x-list[list-type="single"][paging-enabled] {
119
+ x-list[item-snap], x-list[paging-enabled] {
120
120
  scroll-snap-type: y mandatory;
121
121
  scroll-snap-stop: always;
122
122
  }
123
123
 
124
- x-list[list-type="single"][item-snap][scroll-orientation="horizontal"],
125
- x-list[list-type="single"][paging-enabled][scroll-orientation="horizontal"] {
124
+ x-list[item-snap][scroll-orientation="horizontal"],
125
+ x-list[paging-enabled][scroll-orientation="horizontal"] {
126
126
  scroll-snap-type: x mandatory;
127
127
  }
128
128
 
129
- x-list[list-type="single"][item-snap] > list-item,
130
- x-list[list-type="single"][item-snap] > lynx-wrapper > list-item {
129
+ x-list[item-snap] > list-item, x-list[item-snap] > lynx-wrapper > list-item {
131
130
  scroll-snap-align: start;
132
131
  }
133
132
 
@@ -145,3 +144,50 @@ x-list::part(lower-threshold-observer) {
145
144
  x-list[vertical-orientation="false"]::part(lower-threshold-observer) {
146
145
  flex-direction: row-reverse;
147
146
  }
147
+
148
+ /* list-type single */
149
+ x-list[list-type="single"] {
150
+ display: flex;
151
+ flex-direction: column;
152
+ align-items: stretch;
153
+ row-gap: var(--list-main-axis-gap);
154
+ column-gap: var(--list-cross-axis-gap);
155
+ }
156
+
157
+ x-list[list-type="single"][scroll-orientation="horizontal"] {
158
+ flex-direction: row;
159
+ row-gap: var(--list-cross-axis-gap);
160
+ column-gap: var(--list-main-axis-gap);
161
+ }
162
+
163
+ /* list-type flow */
164
+ x-list[list-type="flow"]::part(content) {
165
+ display: grid;
166
+ grid-template-columns: repeat(var(--list-item-span-count), 1fr);
167
+ grid-auto-rows: min-content;
168
+ justify-items: stretch;
169
+ align-items: start;
170
+ grid-row-gap: var(--list-main-axis-gap);
171
+ grid-column-gap: var(--list-cross-axis-gap);
172
+ }
173
+
174
+ x-list[list-type="flow"][scroll-orientation="horizontal"]::part(content) {
175
+ grid-template-rows: repeat(var(--list-item-span-count), 1fr);
176
+ grid-auto-flow: column;
177
+ grid-auto-columns: min-content;
178
+ justify-items: start;
179
+ align-items: stretch;
180
+ grid-row-gap: var(--list-cross-axis-gap);
181
+ grid-column-gap: var(--list-main-axis-gap);
182
+ }
183
+
184
+ x-list[list-type="flow"] list-item[full-span]:not([full-span="false"]) {
185
+ grid-column-start: 1;
186
+ grid-column-end: calc(var(--list-item-span-count) + 1);
187
+ }
188
+
189
+ x-list[list-type="flow"][scroll-orientation="horizontal"]
190
+ list-item[full-span]:not([full-span="false"]) {
191
+ grid-row-start: 1;
192
+ grid-row-end: calc(var(--list-item-span-count) + 1);
193
+ }