@umon752/web-password 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 umon752
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # web-password
2
+
3
+ 一個用於密碼顯示/隱藏切換的 Web Component。
4
+
5
+ ## 安裝
6
+
7
+ ### NPM
8
+
9
+ ```bash
10
+ npm install @umon752/web-password
11
+ ```
12
+
13
+ ### CDN
14
+
15
+ ```html
16
+ <!-- unpkg -->
17
+ <script type="module" src="https://unpkg.com/@umon752/web-password"></script>
18
+
19
+ <!-- 或 jsDelivr -->
20
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@umon752/web-password"></script>
21
+ ```
22
+
23
+ ## 使用方式
24
+
25
+ ### ES Module
26
+
27
+ ```javascript
28
+ import 'web-password';
29
+ ```
30
+
31
+ ### HTML
32
+
33
+ ```html
34
+ <web-password-controller>
35
+ <input type="password" id="password" name="password" placeholder="請輸入密碼">
36
+
37
+ <web-password-button>
38
+ <!-- 密碼可見時顯示 -->
39
+ <div slot="on" aria-label="顯示密碼">👁️</div>
40
+ <!-- 密碼隱藏時顯示 -->
41
+ <div slot="off" aria-label="隱藏密碼">👁️‍🗨️</div>
42
+ </web-password-button>
43
+ </web-password-controller>
44
+ ```
45
+
46
+ ## API
47
+
48
+ ### `<web-password-controller>`
49
+
50
+ 容器元件,用於包裹 `<input>` 和 `<web-password-button>`。
51
+
52
+ #### CSS 變數
53
+
54
+ | 變數名稱 | 預設值 | 說明 |
55
+ |---------|--------|------|
56
+ | `--password-controller-gap` | `8px` | 子元素間距 |
57
+
58
+ ### `<web-password-button>`
59
+
60
+ 密碼顯示/隱藏切換按鈕。
61
+
62
+ #### 屬性 (Attributes)
63
+
64
+ | 屬性名稱 | 類型 | 預設值 | 說明 |
65
+ |---------|------|--------|------|
66
+ | `password-visible` | `'on'` \| `'off'` | `'off'` | 控制密碼顯示狀態 |
67
+
68
+ #### 方法 (Methods)
69
+
70
+ | 方法名稱 | 說明 |
71
+ |---------|------|
72
+ | `on()` | 顯示密碼 |
73
+ | `off()` | 隱藏密碼 |
74
+ | `kill()` | 移除元件並觸發 `web-password-controller:kill` 事件 |
75
+
76
+ #### CSS 變數
77
+
78
+ | 變數名稱 | 預設值 | 說明 |
79
+ |---------|--------|------|
80
+ | `--password-button-width` | `24px` | 按鈕寬度 |
81
+ | `--password-button-height` | `24px` | 按鈕高度 |
82
+
83
+ #### Slots
84
+
85
+ | Slot 名稱 | 說明 |
86
+ |----------|------|
87
+ | `on` | 密碼可見時顯示的內容 |
88
+ | `off` | 密碼隱藏時顯示的內容 |
89
+
90
+ #### 事件 (Events)
91
+
92
+ | 事件名稱 | 說明 |
93
+ |---------|------|
94
+ | `web-password-controller:kill` | 當呼叫 `kill()` 方法時觸發 |
95
+
96
+ ## TypeScript 支援
97
+
98
+ 此套件包含完整的 TypeScript 型別定義。
99
+
100
+ ```typescript
101
+ import { WebPasswordController, WebPasswordButton } from 'web-password';
102
+
103
+ // 型別會自動識別
104
+ const button = document.querySelector('web-password-button');
105
+ button?.on();
106
+ ```
107
+
108
+ ## 瀏覽器支援
109
+
110
+ 支援所有現代瀏覽器(Chrome、Firefox、Safari、Edge)。
111
+
112
+ ## License
113
+
114
+ MIT
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Password Controller Web Component
3
+ */
4
+ declare class WebPasswordController extends HTMLElement {
5
+ constructor();
6
+ connectedCallback(): void;
7
+ }
8
+ /**
9
+ * Password Button Web Component
10
+ * @attr {string} password-visible - 控制顯示或隱藏密碼
11
+ */
12
+ declare class WebPasswordButton extends HTMLElement {
13
+ private clickHandler;
14
+ constructor();
15
+ static get observedAttributes(): string[];
16
+ connectedCallback(): void;
17
+ /**
18
+ * 元件從 DOM 移除時的回調
19
+ */
20
+ disconnectedCallback(): void;
21
+ /**
22
+ * 屬性變更時的回調
23
+ */
24
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
25
+ /**
26
+ * 建立 shadow dom
27
+ */
28
+ private _createShadowDom;
29
+ /**
30
+ * 初始化元件
31
+ */
32
+ private _init;
33
+ /**
34
+ * 綁定事件監聽器
35
+ */
36
+ private _bindEvents;
37
+ /**
38
+ * 清理資源
39
+ */
40
+ private _cleanup;
41
+ /**
42
+ * 更新顯示隱藏狀態
43
+ */
44
+ private _updateVisibility;
45
+ /**
46
+ * 更新 aria-label
47
+ */
48
+ private _updateAriaLabel;
49
+ /**
50
+ * 顯示密碼
51
+ */
52
+ on(): void;
53
+ /**
54
+ * 隱藏密碼
55
+ */
56
+ off(): void;
57
+ /**
58
+ * 移除元素
59
+ */
60
+ kill(): void;
61
+ }
62
+ export { WebPasswordController, WebPasswordButton };
63
+ declare global {
64
+ interface HTMLElementTagNameMap {
65
+ 'web-password-controller': WebPasswordController;
66
+ 'web-password-button': WebPasswordButton;
67
+ }
68
+ interface HTMLElementEventMap {
69
+ 'web-password-controller:kill': CustomEvent<{
70
+ element: WebPasswordButton;
71
+ }>;
72
+ }
73
+ }
74
+ //# sourceMappingURL=web-password.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-password.d.ts","sourceRoot":"","sources":["../src/web-password.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,cAAM,qBAAsB,SAAQ,WAAW;;IAM7C,iBAAiB;CAqBlB;AAID;;;GAGG;AACH,cAAM,iBAAkB,SAAQ,WAAW;IACzC,OAAO,CAAC,YAAY,CAA6B;;IAOjD,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,iBAAiB;IAKjB;;OAEG;IACH,oBAAoB;IAIpB;;OAEG;IACH,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMvF;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA6CxB;;OAEG;IACH,OAAO,CAAC,KAAK;IAgBb;;OAEG;IACH,OAAO,CAAC,WAAW;IAQnB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAOhB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAmBzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;OAEG;IACH,EAAE;IAIF;;OAEG;IACH,GAAG;IAIH;;OAEG;IACH,IAAI;CAWL;AAKD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC;AAGpD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,yBAAyB,EAAE,qBAAqB,CAAC;QACjD,qBAAqB,EAAE,iBAAiB,CAAC;KAC1C;IAED,UAAU,mBAAmB;QAC3B,8BAA8B,EAAE,WAAW,CAAC;YAAE,OAAO,EAAE,iBAAiB,CAAA;SAAE,CAAC,CAAC;KAC7E;CACF"}
@@ -0,0 +1,208 @@
1
+ // 檢查是否已註冊
2
+ if (typeof window === 'undefined' || !window.customElements) {
3
+ console.warn('Web Components are not supported in this environment.');
4
+ throw new Error('Web Components are not supported in this environment.');
5
+ }
6
+ else if (window.customElements.get('web-password-controller')) {
7
+ console.warn('web-password-controller is already registered.');
8
+ throw new Error('web-password-controller is already registered.');
9
+ }
10
+ /**
11
+ * Password Controller Web Component
12
+ */
13
+ class WebPasswordController extends HTMLElement {
14
+ constructor() {
15
+ super();
16
+ this.attachShadow({ mode: 'open' });
17
+ }
18
+ connectedCallback() {
19
+ const sheet = new CSSStyleSheet();
20
+ sheet.replaceSync(`
21
+ :host {
22
+ --password-controller-gap: 8px;
23
+
24
+ display: flex;
25
+ align-items: center;
26
+ gap: var(--password-controller-gap);
27
+ }
28
+ :host([spinner-show]) {
29
+ opacity: 1;
30
+ pointer-events: auto;
31
+ }
32
+ `);
33
+ this.shadowRoot.adoptedStyleSheets = [sheet];
34
+ const slot = document.createElement('slot');
35
+ this.shadowRoot.appendChild(slot);
36
+ }
37
+ }
38
+ customElements.define('web-password-controller', WebPasswordController);
39
+ /**
40
+ * Password Button Web Component
41
+ * @attr {string} password-visible - 控制顯示或隱藏密碼
42
+ */
43
+ class WebPasswordButton extends HTMLElement {
44
+ constructor() {
45
+ super();
46
+ this.clickHandler = null;
47
+ this.attachShadow({ mode: 'open' });
48
+ }
49
+ static get observedAttributes() {
50
+ return ['password-visible'];
51
+ }
52
+ connectedCallback() {
53
+ this._createShadowDom();
54
+ this._init();
55
+ }
56
+ /**
57
+ * 元件從 DOM 移除時的回調
58
+ */
59
+ disconnectedCallback() {
60
+ this._cleanup();
61
+ }
62
+ /**
63
+ * 屬性變更時的回調
64
+ */
65
+ attributeChangedCallback(name, oldValue, newValue) {
66
+ if (name === 'password-visible' && oldValue !== newValue) {
67
+ this._updateVisibility(newValue);
68
+ }
69
+ }
70
+ /**
71
+ * 建立 shadow dom
72
+ */
73
+ _createShadowDom() {
74
+ const sheet = new CSSStyleSheet();
75
+ sheet.replaceSync(`
76
+ :host {
77
+ --password-button-width: 24px;
78
+ --password-button-height: 24px;
79
+
80
+ width: var(--password-button-width);
81
+ height: var(--password-button-height);
82
+ display: flex;
83
+ justify-content: center;
84
+ align-items: center;
85
+ cursor: pointer;
86
+ }
87
+
88
+ :host([password-visible="off"]) slot[name="on"] {
89
+ display: none;
90
+ }
91
+ :host([password-visible="off"]) slot[name="off"] {
92
+ display: block;
93
+ }
94
+ :host([password-visible="on"]) slot[name="on"] {
95
+ display: block;
96
+ }
97
+ :host([password-visible="on"]) slot[name="off"] {
98
+ display: none;
99
+ }
100
+ `);
101
+ this.shadowRoot.adoptedStyleSheets = [sheet];
102
+ const slotOff = document.createElement('slot');
103
+ slotOff.setAttribute('name', 'off');
104
+ slotOff.setAttribute('aria-label', 'invisible password');
105
+ slotOff.textContent = 'invisible password';
106
+ const slotOn = document.createElement('slot');
107
+ slotOn.setAttribute('name', 'on');
108
+ slotOn.setAttribute('aria-label', 'visible password');
109
+ slotOn.textContent = 'visible password';
110
+ this.shadowRoot.appendChild(slotOff);
111
+ this.shadowRoot.appendChild(slotOn);
112
+ }
113
+ /**
114
+ * 初始化元件
115
+ */
116
+ _init() {
117
+ try {
118
+ // 初始設定隱藏狀態
119
+ if (!this.hasAttribute('password-visible') || this.getAttribute('password-visible') === '') {
120
+ this.setAttribute('password-visible', 'off');
121
+ }
122
+ this.setAttribute('role', 'button');
123
+ // 綁定事件
124
+ this._bindEvents();
125
+ }
126
+ catch (error) {
127
+ console.error('Password button initialization error:', error);
128
+ }
129
+ }
130
+ /**
131
+ * 綁定事件監聽器
132
+ */
133
+ _bindEvents() {
134
+ this.clickHandler = () => {
135
+ const isVisible = this.getAttribute('password-visible') === 'on';
136
+ this.setAttribute('password-visible', isVisible ? 'off' : 'on');
137
+ };
138
+ this.addEventListener('click', this.clickHandler);
139
+ }
140
+ /**
141
+ * 清理資源
142
+ */
143
+ _cleanup() {
144
+ // 清理事件監聯器
145
+ if (this.clickHandler) {
146
+ this.removeEventListener('click', this.clickHandler);
147
+ }
148
+ }
149
+ /**
150
+ * 更新顯示隱藏狀態
151
+ */
152
+ _updateVisibility(newValue) {
153
+ const controller = this.closest('web-password-controller');
154
+ const input = controller?.querySelector('input[type="password"], input[type="text"]');
155
+ if (!input) {
156
+ console.warn('No input element found');
157
+ return;
158
+ }
159
+ if (newValue === 'on') {
160
+ input.setAttribute('type', 'text');
161
+ }
162
+ else {
163
+ input.setAttribute('type', 'password');
164
+ }
165
+ // 更新 aria-label
166
+ this._updateAriaLabel(newValue);
167
+ }
168
+ /**
169
+ * 更新 aria-label
170
+ */
171
+ _updateAriaLabel(newValue) {
172
+ const ariaLabel = this.querySelector(`[slot="${newValue}"]`)?.getAttribute('aria-label');
173
+ if (ariaLabel) {
174
+ this.setAttribute('aria-label', ariaLabel);
175
+ }
176
+ }
177
+ // --- Public ---
178
+ /**
179
+ * 顯示密碼
180
+ */
181
+ on() {
182
+ this.setAttribute('password-visible', 'on');
183
+ }
184
+ /**
185
+ * 隱藏密碼
186
+ */
187
+ off() {
188
+ this.setAttribute('password-visible', 'off');
189
+ }
190
+ /**
191
+ * 移除元素
192
+ */
193
+ kill() {
194
+ const killEvent = new CustomEvent('web-password-controller:kill', {
195
+ detail: {
196
+ element: this,
197
+ },
198
+ bubbles: true,
199
+ cancelable: true,
200
+ });
201
+ this.dispatchEvent(killEvent);
202
+ this.remove();
203
+ }
204
+ }
205
+ customElements.define('web-password-button', WebPasswordButton);
206
+ // 匯出類別供外部使用
207
+ export { WebPasswordController, WebPasswordButton };
208
+ //# sourceMappingURL=web-password.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-password.js","sourceRoot":"","sources":["../src/web-password.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;IACtE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AC;QACrC,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACzC,CAAC;QAED,gBAAgB;QAChB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,QAAuB;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,QAAQ,IAAI,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;QACzF,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,iBAAiB;IACjB;;OAEG;IACH,EAAE;QACA,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,GAAG;QACD,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,IAAI;QACF,MAAM,SAAS,GAAG,IAAI,WAAW,CAAC,8BAA8B,EAAE;YAChE,MAAM,EAAE;gBACN,OAAO,EAAE,IAAI;aACd;YACD,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAC9B,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACF;AAED,cAAc,CAAC,MAAM,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;AAEhE,YAAY;AACZ,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@umon752/web-password",
3
+ "version": "1.0.0",
4
+ "description": "A Web Component for password visibility toggle",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "main": "dist/web-password.js",
9
+ "module": "dist/web-password.js",
10
+ "types": "dist/web-password.d.ts",
11
+ "type": "module",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "keywords": [
20
+ "web-components",
21
+ "password",
22
+ "custom-elements",
23
+ "typescript"
24
+ ],
25
+ "author": "YI CHIEH <umon752@gmail.com>",
26
+ "license": "MIT",
27
+ "devDependencies": {
28
+ "typescript": "^5.3.3"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/umon752/web-password"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/umon752/web-password/issues"
36
+ },
37
+ "homepage": "https://github.com/umon752/web-password#readme"
38
+ }