godown 3.13.3 → 3.14.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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "godown",
3
- "version": "3.13.3",
3
+ "version": "3.14.0",
4
4
  "description": "Web Components Library",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@oxc-project/runtime": "^0.76.0",
8
- "fmtime": "^0.0.3",
9
- "lit": "^3.0.0",
7
+ "@oxc-project/runtime": "^0.80.0",
8
+ "fmtime": "^0.1.0",
9
+ "lit": "^3.3.1",
10
10
  "sharekit": "^1.1.1",
11
11
  "@godown/element": "^2.0.0"
12
12
  },
@@ -93,15 +93,23 @@ class Tabs extends GlobalStyle {
93
93
  ringType: RingType = "border";
94
94
 
95
95
  /**
96
- * If it is "select", the indicator moves from the selected content to the hover position.
96
+ * If "select", the indicator moves from the selected content to the hover position.
97
97
  *
98
- * If it is "previous", the indicator moves from the last moved position to the hover position.
98
+ * If "previous", the indicator moves from the last moved position to the hover position.
99
99
  *
100
- * If "none", the indicator will not move.
100
+ * If "none", the indicator does not move.
101
101
  */
102
102
  @property()
103
103
  beginning: "selected" | "previous" | "none" = "selected";
104
104
 
105
+ /**
106
+ * If "remain", the indicator remain on the selected item.
107
+ *
108
+ * If "none", the indicator dose not display.
109
+ */
110
+ @property()
111
+ ending: "remain" | "none" = "remain";
112
+
105
113
  /**
106
114
  * The behavior of the indicator:
107
115
  *
@@ -138,6 +146,7 @@ class Tabs extends GlobalStyle {
138
146
  }
139
147
 
140
148
  render(): TemplateResult<1> {
149
+ const isRemain = this.ending === "remain";
141
150
  return html`
142
151
  <ul
143
152
  part="root"
@@ -147,7 +156,7 @@ class Tabs extends GlobalStyle {
147
156
  ${this.tabs?.map(
148
157
  (tab, index) => html`
149
158
  <li
150
- part="${tokenList("item", this.index === index && "selected")}"
159
+ part="${tokenList("item", isRemain && this.index === index && "selected")}"
151
160
  @mouseenter=${() => {
152
161
  this.move(this.previousIndex, index);
153
162
  this.previousIndex = index;
@@ -163,9 +172,13 @@ class Tabs extends GlobalStyle {
163
172
  `;
164
173
  }
165
174
 
175
+ protected get _finalIndex() {
176
+ return this.ending === "none" && this.beginning === "selected" ? this.index : -1;
177
+ }
178
+
166
179
  connectedCallback(): void {
167
180
  super.connectedCallback();
168
- this.previousIndex = this.beginning === "selected" ? this.index : -1;
181
+ this.previousIndex = this._finalIndex;
169
182
  }
170
183
 
171
184
  protected _handleMouseLeave(): void {
@@ -173,7 +186,7 @@ class Tabs extends GlobalStyle {
173
186
  if (lastItem) {
174
187
  lastItem.part.remove(hoverToken);
175
188
  }
176
- this.previousIndex = this.beginning === "selected" ? this.index : -1;
189
+ this.previousIndex = this._finalIndex;
177
190
  }
178
191
 
179
192
  move(sourceIndex: number, targetIndex: number): void {
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "godown",
4
- "version": "3.13.3",
4
+ "version": "3.14.0",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1069,9 +1069,14 @@
1069
1069
  { "name": "ringType", "type": "RingType" },
1070
1070
  {
1071
1071
  "name": "beginning",
1072
- "description": "If it is \"select\", the indicator moves from the selected content to the hover position.\n\nIf it is \"previous\", the indicator moves from the last moved position to the hover position.\n\nIf \"none\", the indicator will not move.",
1072
+ "description": "If \"select\", the indicator moves from the selected content to the hover position.\n\nIf \"previous\", the indicator moves from the last moved position to the hover position.\n\nIf \"none\", the indicator does not move.",
1073
1073
  "type": "\"selected\" | \"previous\" | \"none\""
1074
1074
  },
1075
+ {
1076
+ "name": "ending",
1077
+ "description": "If \"remain\", the indicator remain on the selected item.\n\nIf \"none\", the indicator dose not display.",
1078
+ "type": "\"remain\" | \"none\""
1079
+ },
1075
1080
  {
1076
1081
  "name": "indicator",
1077
1082
  "description": "The behavior of the indicator:\n\nIf \"background\", its size will be consistent with that of a single tab.\n\nIf \"underline\", an underline will be displayed at the bottom of the tab.",