nv-radio-btn-bw 1.0.0 → 1.0.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/TEST/tst.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>自定义单选按钮元素</title>
7
7
  <script>
8
8
  // 定义自定义元素类
9
- class NvRadioButton extends HTMLElement {
9
+ class NvRadioBtn extends HTMLElement {
10
10
  constructor() {
11
11
  super();
12
12
 
@@ -363,8 +363,8 @@
363
363
  }
364
364
 
365
365
  // 注册自定义元素
366
- if (!customElements.get('nv-radio-button')) {
367
- customElements.define('nv-radio-button', NvRadioButton);
366
+ if (!customElements.get('nv-radio-btn')) {
367
+ customElements.define('nv-radio-btn', NvRadioBtn);
368
368
  }
369
369
  </script>
370
370
  <style>
@@ -430,7 +430,7 @@
430
430
  <div class="demo-section">
431
431
  <h2>基本测试</h2>
432
432
  <div class="button-group">
433
- <nv-radio-button id="btn1"></nv-radio-button>
433
+ <nv-radio-btn id="btn1"></nv-radio-btn>
434
434
  <div>
435
435
  <div>默认按钮 (60px × 60px)</div>
436
436
  <div>当前状态: <span id="statusText">选中</span></div>
package/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * 自定义单选按钮元素的 TypeScript 类型声明
3
- * 对应自定义元素: <nv-radio-button>
3
+ * 对应自定义元素: <nv-radio-btn>
4
4
  */
5
5
 
6
6
  /**
7
7
  * 单选按钮事件详情接口
8
8
  */
9
- interface NvRadioButtonEventDetail {
9
+ interface NvRadioBtnEventDetail {
10
10
  /** 事件时间戳 */
11
11
  timestamp: number;
12
12
  /** 事件源元素 */
13
- element: NvRadioButtonElement;
13
+ element: NvRadioBtnElement;
14
14
  /** 是否选中(仅点击事件有) */
15
15
  selected?: boolean;
16
16
  }
@@ -18,31 +18,31 @@ interface NvRadioButtonEventDetail {
18
18
  /**
19
19
  * 单选按钮点击事件
20
20
  */
21
- interface NvRadioButtonClickEvent extends CustomEvent<NvRadioButtonEventDetail> {
21
+ interface NvRadioBtnClickEvent extends CustomEvent<NvRadioBtnEventDetail> {
22
22
  /** 事件目标 */
23
- readonly target: NvRadioButtonElement;
23
+ readonly target: NvRadioBtnElement;
24
24
  }
25
25
 
26
26
  /**
27
27
  * 单选按钮选中事件
28
28
  */
29
- interface NvRadioButtonSelectEvent extends CustomEvent<NvRadioButtonEventDetail> {
29
+ interface NvRadioBtnSelectEvent extends CustomEvent<NvRadioBtnEventDetail> {
30
30
  /** 事件目标 */
31
- readonly target: NvRadioButtonElement;
31
+ readonly target: NvRadioBtnElement;
32
32
  }
33
33
 
34
34
  /**
35
35
  * 单选按钮取消选中事件
36
36
  */
37
- interface NvRadioButtonUnselectEvent extends CustomEvent<NvRadioButtonEventDetail> {
37
+ interface NvRadioBtnUnselectEvent extends CustomEvent<NvRadioBtnEventDetail> {
38
38
  /** 事件目标 */
39
- readonly target: NvRadioButtonElement;
39
+ readonly target: NvRadioBtnElement;
40
40
  }
41
41
 
42
42
  /**
43
43
  * 单选按钮状态接口
44
44
  */
45
- interface NvRadioButtonState {
45
+ interface NvRadioBtnState {
46
46
  /** 宽度 */
47
47
  width: string;
48
48
  /** 高度 */
@@ -58,7 +58,7 @@ interface NvRadioButtonState {
58
58
  /**
59
59
  * 单选按钮元素接口
60
60
  */
61
- interface NvRadioButtonElement extends HTMLElement {
61
+ interface NvRadioBtnElement extends HTMLElement {
62
62
  /**
63
63
  * 按钮宽度
64
64
  * @example "60px"
@@ -93,7 +93,7 @@ interface NvRadioButtonElement extends HTMLElement {
93
93
  * 设置回调函数
94
94
  * @param cb 回调函数,参数为按钮实例
95
95
  */
96
- setCallback(cb: (self: NvRadioButtonElement) => Promise<void> | void): void;
96
+ setCallback(cb: (self: NvRadioBtnElement) => Promise<void> | void): void;
97
97
 
98
98
  /**
99
99
  * 显示中心颜色
@@ -138,7 +138,7 @@ interface NvRadioButtonElement extends HTMLElement {
138
138
  * 获取当前状态
139
139
  * @returns 包含按钮状态的对象
140
140
  */
141
- getState(): NvRadioButtonState;
141
+ getState(): NvRadioBtnState;
142
142
 
143
143
  /**
144
144
  * 点击事件监听器
@@ -148,7 +148,7 @@ interface NvRadioButtonElement extends HTMLElement {
148
148
  */
149
149
  addEventListener(
150
150
  type: "nv-radio-btn-click",
151
- listener: (this: NvRadioButtonElement, ev: NvRadioButtonClickEvent) => any,
151
+ listener: (this: NvRadioBtnElement, ev: NvRadioBtnClickEvent) => any,
152
152
  options?: boolean | AddEventListenerOptions
153
153
  ): void;
154
154
 
@@ -160,7 +160,7 @@ interface NvRadioButtonElement extends HTMLElement {
160
160
  */
161
161
  addEventListener(
162
162
  type: "nv-radio-btn-select",
163
- listener: (this: NvRadioButtonElement, ev: NvRadioButtonSelectEvent) => any,
163
+ listener: (this: NvRadioBtnElement, ev: NvRadioBtnSelectEvent) => any,
164
164
  options?: boolean | AddEventListenerOptions
165
165
  ): void;
166
166
 
@@ -172,7 +172,7 @@ interface NvRadioButtonElement extends HTMLElement {
172
172
  */
173
173
  addEventListener(
174
174
  type: "nv-radio-btn-unselect",
175
- listener: (this: NvRadioButtonElement, ev: NvRadioButtonUnselectEvent) => any,
175
+ listener: (this: NvRadioBtnElement, ev: NvRadioBtnUnselectEvent) => any,
176
176
  options?: boolean | AddEventListenerOptions
177
177
  ): void;
178
178
 
@@ -189,7 +189,7 @@ interface NvRadioButtonElement extends HTMLElement {
189
189
  /**
190
190
  * 单选按钮类定义
191
191
  */
192
- declare class NvRadioButton extends HTMLElement implements NvRadioButtonElement {
192
+ declare class NvRadioBtn extends HTMLElement implements NvRadioBtnElement {
193
193
  /** 监听属性变化 */
194
194
  static get observedAttributes(): string[];
195
195
 
@@ -206,7 +206,7 @@ declare class NvRadioButton extends HTMLElement implements NvRadioButtonElement
206
206
  innerColor: string;
207
207
 
208
208
  /** 设置回调函数 */
209
- setCallback(cb: (self: NvRadioButtonElement) => Promise<void> | void): void;
209
+ setCallback(cb: (self: NvRadioBtnElement) => Promise<void> | void): void;
210
210
 
211
211
  /** 显示中心颜色 */
212
212
  slct(): void;
@@ -230,7 +230,7 @@ declare class NvRadioButton extends HTMLElement implements NvRadioButtonElement
230
230
  setInnerColor(color: string): void;
231
231
 
232
232
  /** 获取当前状态 */
233
- getState(): NvRadioButtonState;
233
+ getState(): NvRadioBtnState;
234
234
 
235
235
  /**
236
236
  * 属性变化回调
@@ -259,7 +259,7 @@ declare global {
259
259
  * 扩展 HTMLElementTagNameMap 以支持自定义元素
260
260
  */
261
261
  interface HTMLElementTagNameMap {
262
- "nv-radio-button": NvRadioButtonElement;
262
+ "nv-radio-btn": NvRadioBtnElement;
263
263
  }
264
264
 
265
265
  /**
@@ -269,7 +269,7 @@ declare global {
269
269
  /**
270
270
  * 单选按钮自定义元素类
271
271
  */
272
- NvRadioButton: typeof NvRadioButton;
272
+ NvRadioBtn: typeof NvRadioBtn;
273
273
  }
274
274
 
275
275
  /**
@@ -278,19 +278,19 @@ declare global {
278
278
  interface Document {
279
279
  addEventListener(
280
280
  type: "nv-radio-btn-click",
281
- listener: (this: Document, ev: NvRadioButtonClickEvent) => any,
281
+ listener: (this: Document, ev: NvRadioBtnClickEvent) => any,
282
282
  options?: boolean | AddEventListenerOptions
283
283
  ): void;
284
284
 
285
285
  addEventListener(
286
286
  type: "nv-radio-btn-select",
287
- listener: (this: Document, ev: NvRadioButtonSelectEvent) => any,
287
+ listener: (this: Document, ev: NvRadioBtnSelectEvent) => any,
288
288
  options?: boolean | AddEventListenerOptions
289
289
  ): void;
290
290
 
291
291
  addEventListener(
292
292
  type: "nv-radio-btn-unselect",
293
- listener: (this: Document, ev: NvRadioButtonUnselectEvent) => any,
293
+ listener: (this: Document, ev: NvRadioBtnUnselectEvent) => any,
294
294
  options?: boolean | AddEventListenerOptions
295
295
  ): void;
296
296
  }
@@ -299,10 +299,10 @@ declare global {
299
299
  /**
300
300
  * 导出单选按钮类
301
301
  */
302
- export { NvRadioButton };
302
+ export { NvRadioBtn };
303
303
 
304
304
  /**
305
305
  * 默认导出单选按钮类型
306
306
  */
307
- export default NvRadioButton;
307
+ export default NvRadioBtn;
308
308
 
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- class NvRadioButton extends HTMLElement {
1
+ class NvRadioBtn extends HTMLElement {
2
2
  constructor() {
3
3
  super();
4
4
 
@@ -355,10 +355,10 @@ class NvRadioButton extends HTMLElement {
355
355
  }
356
356
 
357
357
  // 注册自定义元素
358
- if (!customElements.get('nv-radio-button')) {
359
- customElements.define('nv-radio-button', NvRadioButton);
358
+ if (!customElements.get('nv-radio-btn')) {
359
+ customElements.define('nv-radio-btn', NvRadioBtn);
360
360
  }
361
361
 
362
362
  module.exports = {
363
- NvRadioButton
363
+ NvRadioBtn
364
364
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nv-radio-btn-bw",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"