@duskmoon-dev/el-button 1.9.0 → 1.9.2
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/README.md +31 -7
- package/dist/cjs/index.js +56 -1
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/register.js +56 -1
- package/dist/cjs/register.js.map +3 -3
- package/dist/esm/index.js +56 -1
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/register.js +56 -1
- package/dist/esm/register.js.map +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/el-dm-button.d.ts +9 -0
- package/dist/types/el-dm-button.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -64,13 +64,15 @@ import '@duskmoon-dev/el-button/register';
|
|
|
64
64
|
|
|
65
65
|
## Attributes
|
|
66
66
|
|
|
67
|
-
| Attribute
|
|
68
|
-
|
|
|
69
|
-
| `variant`
|
|
70
|
-
| `size`
|
|
71
|
-
| `disabled`
|
|
72
|
-
| `type`
|
|
73
|
-
| `loading`
|
|
67
|
+
| Attribute | Type | Default | Description |
|
|
68
|
+
| ----------------- | ------- | --------- | -------------------------------------------- |
|
|
69
|
+
| `variant` | string | `primary` | Button variant |
|
|
70
|
+
| `size` | string | `md` | Button size |
|
|
71
|
+
| `disabled` | boolean | `false` | Disable the button |
|
|
72
|
+
| `type` | string | `button` | Button type (button, submit, reset) |
|
|
73
|
+
| `loading` | boolean | `false` | Show loading spinner |
|
|
74
|
+
| `aria-label` | string | — | Accessible name for an icon-only button |
|
|
75
|
+
| `aria-labelledby` | string | — | IDs of label elements in the host's DOM tree |
|
|
74
76
|
|
|
75
77
|
## Slots
|
|
76
78
|
|
|
@@ -116,6 +118,28 @@ import '@duskmoon-dev/el-button/register';
|
|
|
116
118
|
<el-dm-button loading>Submitting...</el-dm-button>
|
|
117
119
|
```
|
|
118
120
|
|
|
121
|
+
### Accessible Icon Buttons
|
|
122
|
+
|
|
123
|
+
Set `aria-label` on an icon-only button. The label is synchronized with the native button,
|
|
124
|
+
including changes made after rendering.
|
|
125
|
+
|
|
126
|
+
```html
|
|
127
|
+
<el-dm-button aria-label="Remove email">
|
|
128
|
+
<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
129
|
+
<path d="M5 5L19 19M19 5L5 19" />
|
|
130
|
+
</svg>
|
|
131
|
+
</el-dm-button>
|
|
132
|
+
|
|
133
|
+
<span id="remove-email-label">Remove email</span>
|
|
134
|
+
<el-dm-button aria-labelledby="remove-email-label">×</el-dm-button>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`aria-labelledby` resolves IDs in the host's document or containing shadow root and takes
|
|
138
|
+
precedence over `aria-label` when a target exists. Browsers supporting ARIA element references
|
|
139
|
+
use the referenced elements directly; older browsers use their text content or `aria-label`.
|
|
140
|
+
Label text changes and replacement label elements are synchronized. Without either attribute,
|
|
141
|
+
the slotted content provides the accessible name.
|
|
142
|
+
|
|
119
143
|
### Form Submit
|
|
120
144
|
|
|
121
145
|
```html
|
package/dist/cjs/index.js
CHANGED
|
@@ -96,6 +96,9 @@ var styles = import_el_base.css`
|
|
|
96
96
|
`;
|
|
97
97
|
|
|
98
98
|
class ElDmButton extends import_el_base.BaseElement {
|
|
99
|
+
static get observedAttributes() {
|
|
100
|
+
return [...super.observedAttributes, "aria-label", "aria-labelledby"];
|
|
101
|
+
}
|
|
99
102
|
static properties = {
|
|
100
103
|
variant: { type: String, reflect: true },
|
|
101
104
|
size: { type: String, reflect: true },
|
|
@@ -103,6 +106,7 @@ class ElDmButton extends import_el_base.BaseElement {
|
|
|
103
106
|
type: { type: String, reflect: true, default: "button" },
|
|
104
107
|
loading: { type: Boolean, reflect: true }
|
|
105
108
|
};
|
|
109
|
+
_labelObserver;
|
|
106
110
|
constructor() {
|
|
107
111
|
super();
|
|
108
112
|
this.attachStyles(styles);
|
|
@@ -157,6 +161,57 @@ class ElDmButton extends import_el_base.BaseElement {
|
|
|
157
161
|
connectedCallback() {
|
|
158
162
|
super.connectedCallback();
|
|
159
163
|
this.addEventListener("click", this._handleClick.bind(this));
|
|
164
|
+
this._observeLabels();
|
|
165
|
+
}
|
|
166
|
+
disconnectedCallback() {
|
|
167
|
+
super.disconnectedCallback();
|
|
168
|
+
this._labelObserver?.disconnect();
|
|
169
|
+
}
|
|
170
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
171
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
172
|
+
if (oldValue === newValue || !this.isConnected)
|
|
173
|
+
return;
|
|
174
|
+
if (name === "aria-label" || name === "aria-labelledby") {
|
|
175
|
+
this._syncLabel();
|
|
176
|
+
if (name === "aria-labelledby")
|
|
177
|
+
this._observeLabels();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
update() {
|
|
181
|
+
super.update();
|
|
182
|
+
this._syncLabel();
|
|
183
|
+
}
|
|
184
|
+
_observeLabels() {
|
|
185
|
+
this._labelObserver?.disconnect();
|
|
186
|
+
if (!this.getAttribute("aria-labelledby")?.trim())
|
|
187
|
+
return;
|
|
188
|
+
this._labelObserver ??= new MutationObserver(() => this._syncLabel());
|
|
189
|
+
this._labelObserver.observe(this.getRootNode(), {
|
|
190
|
+
subtree: true,
|
|
191
|
+
childList: true,
|
|
192
|
+
characterData: true,
|
|
193
|
+
attributes: true,
|
|
194
|
+
attributeFilter: ["id", "aria-label"]
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
_syncLabel() {
|
|
198
|
+
const button = this.shadowRoot.querySelector("button");
|
|
199
|
+
if (!button)
|
|
200
|
+
return;
|
|
201
|
+
const root = this.getRootNode();
|
|
202
|
+
const ids = this.getAttribute("aria-labelledby")?.trim().split(/\s+/) ?? [];
|
|
203
|
+
const labels = ids.map((id) => root.getElementById?.(id)).filter((label) => !!label);
|
|
204
|
+
let name = this.getAttribute("aria-label");
|
|
205
|
+
if ("ariaLabelledByElements" in button) {
|
|
206
|
+
button.ariaLabelledByElements = labels;
|
|
207
|
+
} else if (labels.length) {
|
|
208
|
+
name = labels.map((label) => label.getAttribute("aria-label") ?? label.textContent).join(" ");
|
|
209
|
+
}
|
|
210
|
+
if (name === null) {
|
|
211
|
+
button.removeAttribute("aria-label");
|
|
212
|
+
} else {
|
|
213
|
+
button.setAttribute("aria-label", name);
|
|
214
|
+
}
|
|
160
215
|
}
|
|
161
216
|
_getButtonClasses() {
|
|
162
217
|
const classes = ["btn"];
|
|
@@ -198,5 +253,5 @@ function register() {
|
|
|
198
253
|
}
|
|
199
254
|
}
|
|
200
255
|
|
|
201
|
-
//# debugId=
|
|
256
|
+
//# debugId=CFB3AE22BE4CA34164756E2164756E21
|
|
202
257
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/el-dm-button.ts", "../../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * DuskMoon Button Element\n *\n * A customizable button component with multiple variants and sizes.\n * Uses styles from @duskmoon-dev/core for consistent theming.\n *\n * @element el-dm-button\n *\n * @attr {string} variant - Button variant: primary, secondary, tertiary, ghost, outline, success, warning, error, info\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {boolean} disabled - Whether the button is disabled\n * @attr {string} type - Button type: button, submit, reset\n * @attr {boolean} loading - Whether the button is in loading state\n *\n * @slot - Default slot for button content\n * @slot prefix - Content before the main text\n * @slot suffix - Content after the main text\n *\n * @csspart button - The native button element\n * @csspart content - The content wrapper\n * @csspart prefix - The prefix slot wrapper\n * @csspart suffix - The suffix slot wrapper\n *\n * @fires click - Fired when button is clicked (native event)\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\nimport { css as buttonCSS } from '@duskmoon-dev/core/components/button';\n\n// Map of variant attribute values to CSS classes\nconst VARIANT_CLASSES: Record<string, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n tertiary: 'btn-tertiary',\n ghost: 'btn-ghost',\n outline: 'btn-outline',\n // Semantic colors\n success: 'btn-success',\n warning: 'btn-warning',\n error: 'btn-error',\n info: 'btn-info',\n};\n\n// Map of size attribute values to CSS classes\nconst SIZE_CLASSES: Record<string, string> = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'ghost'\n | 'outline'\n | 'success'\n | 'warning'\n | 'error'\n | 'info';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';\n\n// Strip @layer wrapper for Shadow DOM compatibility and add host styles\nconst coreStyles = buttonCSS.replace(/@layer\\s+components\\s*\\{/, '').replace(/\\}\\s*$/, '');\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n /* Import core button styles */\n ${coreStyles}\n\n /* Web component specific adjustments */\n .btn {\n font-family: inherit;\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n ::slotted(*) {\n display: inline-flex;\n align-items: center;\n }\n`;\n\nexport class ElDmButton extends BaseElement {\n static properties = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n type: { type: String, reflect: true, default: 'button' },\n loading: { type: Boolean, reflect: true },\n };\n\n /** Button variant */\n declare variant: ButtonVariant;\n\n /** Button size */\n declare size: ButtonSize;\n\n /** Whether the button is disabled */\n declare disabled: boolean;\n\n /** Button type (button, submit, reset) */\n declare type: 'button' | 'submit' | 'reset';\n\n /** Whether the button is in loading state */\n declare loading: boolean;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n /**\n * Handle click events\n */\n private _handleClick(event: MouseEvent): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n // Handle form submission\n if (this.type === 'submit') {\n const form = this._getAssociatedForm();\n if (form) {\n const submitter = this.ownerDocument.createElement('button');\n submitter.type = 'submit';\n submitter.hidden = true;\n\n for (const attribute of [\n 'name',\n 'value',\n 'formaction',\n 'formenctype',\n 'formmethod',\n 'formnovalidate',\n 'formtarget',\n ]) {\n if (this.hasAttribute(attribute)) {\n submitter.setAttribute(attribute, this.getAttribute(attribute) ?? '');\n }\n }\n\n form.appendChild(submitter);\n try {\n form.requestSubmit(submitter);\n } finally {\n submitter.remove();\n }\n }\n } else if (this.type === 'reset') {\n const form = this._getAssociatedForm();\n if (form) {\n form.reset();\n }\n }\n }\n\n private _getAssociatedForm(): HTMLFormElement | null {\n const formId = this.getAttribute('form');\n if (formId) {\n const form = this.ownerDocument.getElementById(formId);\n return form?.tagName === 'FORM' ? (form as HTMLFormElement) : null;\n }\n\n return this.closest('form');\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n }\n\n /**\n * Build CSS class string for the button\n */\n private _getButtonClasses(): string {\n const classes = ['btn'];\n\n // Add variant class (default to primary)\n const variantClass = VARIANT_CLASSES[this.variant] || 'btn-primary';\n classes.push(variantClass);\n\n // Add size class if specified\n if (this.size && SIZE_CLASSES[this.size]) {\n classes.push(SIZE_CLASSES[this.size]);\n }\n\n // Add loading class\n if (this.loading) {\n classes.push('btn-loading');\n }\n\n return classes.join(' ');\n }\n\n render(): string {\n const isDisabled = this.disabled || this.loading;\n const buttonClasses = this._getButtonClasses();\n\n return `\n <button\n class=\"${buttonClasses}\"\n part=\"button\"\n type=\"${this.type || 'button'}\"\n ${isDisabled ? 'disabled' : ''}\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n >\n <span class=\"content\" part=\"content\">\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\" part=\"suffix\"></slot>\n </span>\n </button>\n `;\n }\n}\n",
|
|
5
|
+
"/**\n * DuskMoon Button Element\n *\n * A customizable button component with multiple variants and sizes.\n * Uses styles from @duskmoon-dev/core for consistent theming.\n *\n * @element el-dm-button\n *\n * @attr {string} variant - Button variant: primary, secondary, tertiary, ghost, outline, success, warning, error, info\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {boolean} disabled - Whether the button is disabled\n * @attr {string} type - Button type: button, submit, reset\n * @attr {boolean} loading - Whether the button is in loading state\n * @attr {string} aria-label - Accessible name for the native button\n * @attr {string} aria-labelledby - IDs of elements naming the button in the host's DOM tree\n *\n * @slot - Default slot for button content\n * @slot prefix - Content before the main text\n * @slot suffix - Content after the main text\n *\n * @csspart button - The native button element\n * @csspart content - The content wrapper\n * @csspart prefix - The prefix slot wrapper\n * @csspart suffix - The suffix slot wrapper\n *\n * @fires click - Fired when button is clicked (native event)\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\nimport { css as buttonCSS } from '@duskmoon-dev/core/components/button';\n\n// Map of variant attribute values to CSS classes\nconst VARIANT_CLASSES: Record<string, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n tertiary: 'btn-tertiary',\n ghost: 'btn-ghost',\n outline: 'btn-outline',\n // Semantic colors\n success: 'btn-success',\n warning: 'btn-warning',\n error: 'btn-error',\n info: 'btn-info',\n};\n\n// Map of size attribute values to CSS classes\nconst SIZE_CLASSES: Record<string, string> = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'ghost'\n | 'outline'\n | 'success'\n | 'warning'\n | 'error'\n | 'info';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';\n\n// Strip @layer wrapper for Shadow DOM compatibility and add host styles\nconst coreStyles = buttonCSS.replace(/@layer\\s+components\\s*\\{/, '').replace(/\\}\\s*$/, '');\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n /* Import core button styles */\n ${coreStyles}\n\n /* Web component specific adjustments */\n .btn {\n font-family: inherit;\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n ::slotted(*) {\n display: inline-flex;\n align-items: center;\n }\n`;\n\nexport class ElDmButton extends BaseElement {\n static get observedAttributes(): string[] {\n return [...super.observedAttributes, 'aria-label', 'aria-labelledby'];\n }\n\n static properties = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n type: { type: String, reflect: true, default: 'button' },\n loading: { type: Boolean, reflect: true },\n };\n\n /** Button variant */\n declare variant: ButtonVariant;\n\n /** Button size */\n declare size: ButtonSize;\n\n /** Whether the button is disabled */\n declare disabled: boolean;\n\n /** Button type (button, submit, reset) */\n declare type: 'button' | 'submit' | 'reset';\n\n /** Whether the button is in loading state */\n declare loading: boolean;\n\n private _labelObserver?: MutationObserver;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n /**\n * Handle click events\n */\n private _handleClick(event: MouseEvent): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n // Handle form submission\n if (this.type === 'submit') {\n const form = this._getAssociatedForm();\n if (form) {\n const submitter = this.ownerDocument.createElement('button');\n submitter.type = 'submit';\n submitter.hidden = true;\n\n for (const attribute of [\n 'name',\n 'value',\n 'formaction',\n 'formenctype',\n 'formmethod',\n 'formnovalidate',\n 'formtarget',\n ]) {\n if (this.hasAttribute(attribute)) {\n submitter.setAttribute(attribute, this.getAttribute(attribute) ?? '');\n }\n }\n\n form.appendChild(submitter);\n try {\n form.requestSubmit(submitter);\n } finally {\n submitter.remove();\n }\n }\n } else if (this.type === 'reset') {\n const form = this._getAssociatedForm();\n if (form) {\n form.reset();\n }\n }\n }\n\n private _getAssociatedForm(): HTMLFormElement | null {\n const formId = this.getAttribute('form');\n if (formId) {\n const form = this.ownerDocument.getElementById(formId);\n return form?.tagName === 'FORM' ? (form as HTMLFormElement) : null;\n }\n\n return this.closest('form');\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this._observeLabels();\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this._labelObserver?.disconnect();\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (oldValue === newValue || !this.isConnected) return;\n if (name === 'aria-label' || name === 'aria-labelledby') {\n this._syncLabel();\n if (name === 'aria-labelledby') this._observeLabels();\n }\n }\n\n protected update(): void {\n super.update();\n this._syncLabel();\n }\n\n private _observeLabels(): void {\n this._labelObserver?.disconnect();\n if (!this.getAttribute('aria-labelledby')?.trim()) return;\n this._labelObserver ??= new MutationObserver(() => this._syncLabel());\n this._labelObserver.observe(this.getRootNode(), {\n subtree: true,\n childList: true,\n characterData: true,\n attributes: true,\n attributeFilter: ['id', 'aria-label'],\n });\n }\n\n private _syncLabel(): void {\n const button = this.shadowRoot.querySelector('button');\n if (!button) return;\n\n const root = this.getRootNode() as Document | ShadowRoot;\n const ids = this.getAttribute('aria-labelledby')?.trim().split(/\\s+/) ?? [];\n const labels = ids\n .map((id) => root.getElementById?.(id))\n .filter((label): label is HTMLElement => !!label);\n let name = this.getAttribute('aria-label');\n\n // ID references cannot cross into a shadow root; element references can.\n if ('ariaLabelledByElements' in button) {\n button.ariaLabelledByElements = labels;\n } else if (labels.length) {\n name = labels.map((label) => label.getAttribute('aria-label') ?? label.textContent).join(' ');\n }\n\n if (name === null) {\n button.removeAttribute('aria-label');\n } else {\n button.setAttribute('aria-label', name);\n }\n }\n\n /**\n * Build CSS class string for the button\n */\n private _getButtonClasses(): string {\n const classes = ['btn'];\n\n // Add variant class (default to primary)\n const variantClass = VARIANT_CLASSES[this.variant] || 'btn-primary';\n classes.push(variantClass);\n\n // Add size class if specified\n if (this.size && SIZE_CLASSES[this.size]) {\n classes.push(SIZE_CLASSES[this.size]);\n }\n\n // Add loading class\n if (this.loading) {\n classes.push('btn-loading');\n }\n\n return classes.join(' ');\n }\n\n render(): string {\n const isDisabled = this.disabled || this.loading;\n const buttonClasses = this._getButtonClasses();\n\n return `\n <button\n class=\"${buttonClasses}\"\n part=\"button\"\n type=\"${this.type || 'button'}\"\n ${isDisabled ? 'disabled' : ''}\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n >\n <span class=\"content\" part=\"content\">\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\" part=\"suffix\"></slot>\n </span>\n </button>\n `;\n }\n}\n",
|
|
6
6
|
"/**\n * @duskmoon-dev/el-button\n *\n * DuskMoon Button custom element\n */\n\nimport { ElDmButton } from './el-dm-button.js';\n\nexport { ElDmButton };\n\n/**\n * Register the el-dm-button custom element\n *\n * @example\n * ```ts\n * import { register } from '@duskmoon-dev/el-button';\n * register();\n * ```\n */\nexport function register(): void {\n if (!customElements.get('el-dm-button')) {\n customElements.define('el-dm-button', ElDmButton);\n }\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BiC,IAAjC;AACiC,IAAjC;AAGA,IAAM,kBAA0C;AAAA,EAC9C,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EAET,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACR;AAGA,IAAM,eAAuC;AAAA,EAC3C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAeA,IAAM,aAAa,kBAAU,QAAQ,4BAA4B,EAAE,EAAE,QAAQ,UAAU,EAAE;AAEzF,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWX;AAAA;AAAA;AA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SAAS;AAAA,MAChB,QAAQ,KAAK,aAAa;AAAA,IAC5B;AAAA,IAEA,OAAO,QAAQ,KAAK,GAAG;AAAA;AAAA,EAGzB,MAAM,GAAW;AAAA,IACf,MAAM,aAAa,KAAK,YAAY,KAAK;AAAA,IACzC,MAAM,gBAAgB,KAAK,kBAAkB;AAAA,IAE7C,OAAO;AAAA;AAAA,iBAEM;AAAA;AAAA,gBAED,KAAK,QAAQ;AAAA,UACnB,aAAa,aAAa;AAAA,qBACf,KAAK,UAAU,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU7C;;;ACrRO,SAAS,QAAQ,GAAS;AAAA,EAC/B,IAAI,CAAC,eAAe,IAAI,cAAc,GAAG;AAAA,IACvC,eAAe,OAAO,gBAAgB,UAAU;AAAA,EAClD;AAAA;",
|
|
9
|
+
"debugId": "CFB3AE22BE4CA34164756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/cjs/register.js
CHANGED
|
@@ -95,6 +95,9 @@ var styles = import_el_base.css`
|
|
|
95
95
|
`;
|
|
96
96
|
|
|
97
97
|
class ElDmButton extends import_el_base.BaseElement {
|
|
98
|
+
static get observedAttributes() {
|
|
99
|
+
return [...super.observedAttributes, "aria-label", "aria-labelledby"];
|
|
100
|
+
}
|
|
98
101
|
static properties = {
|
|
99
102
|
variant: { type: String, reflect: true },
|
|
100
103
|
size: { type: String, reflect: true },
|
|
@@ -102,6 +105,7 @@ class ElDmButton extends import_el_base.BaseElement {
|
|
|
102
105
|
type: { type: String, reflect: true, default: "button" },
|
|
103
106
|
loading: { type: Boolean, reflect: true }
|
|
104
107
|
};
|
|
108
|
+
_labelObserver;
|
|
105
109
|
constructor() {
|
|
106
110
|
super();
|
|
107
111
|
this.attachStyles(styles);
|
|
@@ -156,6 +160,57 @@ class ElDmButton extends import_el_base.BaseElement {
|
|
|
156
160
|
connectedCallback() {
|
|
157
161
|
super.connectedCallback();
|
|
158
162
|
this.addEventListener("click", this._handleClick.bind(this));
|
|
163
|
+
this._observeLabels();
|
|
164
|
+
}
|
|
165
|
+
disconnectedCallback() {
|
|
166
|
+
super.disconnectedCallback();
|
|
167
|
+
this._labelObserver?.disconnect();
|
|
168
|
+
}
|
|
169
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
170
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
171
|
+
if (oldValue === newValue || !this.isConnected)
|
|
172
|
+
return;
|
|
173
|
+
if (name === "aria-label" || name === "aria-labelledby") {
|
|
174
|
+
this._syncLabel();
|
|
175
|
+
if (name === "aria-labelledby")
|
|
176
|
+
this._observeLabels();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
update() {
|
|
180
|
+
super.update();
|
|
181
|
+
this._syncLabel();
|
|
182
|
+
}
|
|
183
|
+
_observeLabels() {
|
|
184
|
+
this._labelObserver?.disconnect();
|
|
185
|
+
if (!this.getAttribute("aria-labelledby")?.trim())
|
|
186
|
+
return;
|
|
187
|
+
this._labelObserver ??= new MutationObserver(() => this._syncLabel());
|
|
188
|
+
this._labelObserver.observe(this.getRootNode(), {
|
|
189
|
+
subtree: true,
|
|
190
|
+
childList: true,
|
|
191
|
+
characterData: true,
|
|
192
|
+
attributes: true,
|
|
193
|
+
attributeFilter: ["id", "aria-label"]
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
_syncLabel() {
|
|
197
|
+
const button = this.shadowRoot.querySelector("button");
|
|
198
|
+
if (!button)
|
|
199
|
+
return;
|
|
200
|
+
const root = this.getRootNode();
|
|
201
|
+
const ids = this.getAttribute("aria-labelledby")?.trim().split(/\s+/) ?? [];
|
|
202
|
+
const labels = ids.map((id) => root.getElementById?.(id)).filter((label) => !!label);
|
|
203
|
+
let name = this.getAttribute("aria-label");
|
|
204
|
+
if ("ariaLabelledByElements" in button) {
|
|
205
|
+
button.ariaLabelledByElements = labels;
|
|
206
|
+
} else if (labels.length) {
|
|
207
|
+
name = labels.map((label) => label.getAttribute("aria-label") ?? label.textContent).join(" ");
|
|
208
|
+
}
|
|
209
|
+
if (name === null) {
|
|
210
|
+
button.removeAttribute("aria-label");
|
|
211
|
+
} else {
|
|
212
|
+
button.setAttribute("aria-label", name);
|
|
213
|
+
}
|
|
159
214
|
}
|
|
160
215
|
_getButtonClasses() {
|
|
161
216
|
const classes = ["btn"];
|
|
@@ -200,5 +255,5 @@ function register() {
|
|
|
200
255
|
// src/register.ts
|
|
201
256
|
register();
|
|
202
257
|
|
|
203
|
-
//# debugId=
|
|
258
|
+
//# debugId=3D8E71480740F01D64756E2164756E21
|
|
204
259
|
//# sourceMappingURL=register.js.map
|
package/dist/cjs/register.js.map
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/el-dm-button.ts", "../../src/index.ts", "../../src/register.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * DuskMoon Button Element\n *\n * A customizable button component with multiple variants and sizes.\n * Uses styles from @duskmoon-dev/core for consistent theming.\n *\n * @element el-dm-button\n *\n * @attr {string} variant - Button variant: primary, secondary, tertiary, ghost, outline, success, warning, error, info\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {boolean} disabled - Whether the button is disabled\n * @attr {string} type - Button type: button, submit, reset\n * @attr {boolean} loading - Whether the button is in loading state\n *\n * @slot - Default slot for button content\n * @slot prefix - Content before the main text\n * @slot suffix - Content after the main text\n *\n * @csspart button - The native button element\n * @csspart content - The content wrapper\n * @csspart prefix - The prefix slot wrapper\n * @csspart suffix - The suffix slot wrapper\n *\n * @fires click - Fired when button is clicked (native event)\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\nimport { css as buttonCSS } from '@duskmoon-dev/core/components/button';\n\n// Map of variant attribute values to CSS classes\nconst VARIANT_CLASSES: Record<string, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n tertiary: 'btn-tertiary',\n ghost: 'btn-ghost',\n outline: 'btn-outline',\n // Semantic colors\n success: 'btn-success',\n warning: 'btn-warning',\n error: 'btn-error',\n info: 'btn-info',\n};\n\n// Map of size attribute values to CSS classes\nconst SIZE_CLASSES: Record<string, string> = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'ghost'\n | 'outline'\n | 'success'\n | 'warning'\n | 'error'\n | 'info';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';\n\n// Strip @layer wrapper for Shadow DOM compatibility and add host styles\nconst coreStyles = buttonCSS.replace(/@layer\\s+components\\s*\\{/, '').replace(/\\}\\s*$/, '');\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n /* Import core button styles */\n ${coreStyles}\n\n /* Web component specific adjustments */\n .btn {\n font-family: inherit;\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n ::slotted(*) {\n display: inline-flex;\n align-items: center;\n }\n`;\n\nexport class ElDmButton extends BaseElement {\n static properties = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n type: { type: String, reflect: true, default: 'button' },\n loading: { type: Boolean, reflect: true },\n };\n\n /** Button variant */\n declare variant: ButtonVariant;\n\n /** Button size */\n declare size: ButtonSize;\n\n /** Whether the button is disabled */\n declare disabled: boolean;\n\n /** Button type (button, submit, reset) */\n declare type: 'button' | 'submit' | 'reset';\n\n /** Whether the button is in loading state */\n declare loading: boolean;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n /**\n * Handle click events\n */\n private _handleClick(event: MouseEvent): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n // Handle form submission\n if (this.type === 'submit') {\n const form = this._getAssociatedForm();\n if (form) {\n const submitter = this.ownerDocument.createElement('button');\n submitter.type = 'submit';\n submitter.hidden = true;\n\n for (const attribute of [\n 'name',\n 'value',\n 'formaction',\n 'formenctype',\n 'formmethod',\n 'formnovalidate',\n 'formtarget',\n ]) {\n if (this.hasAttribute(attribute)) {\n submitter.setAttribute(attribute, this.getAttribute(attribute) ?? '');\n }\n }\n\n form.appendChild(submitter);\n try {\n form.requestSubmit(submitter);\n } finally {\n submitter.remove();\n }\n }\n } else if (this.type === 'reset') {\n const form = this._getAssociatedForm();\n if (form) {\n form.reset();\n }\n }\n }\n\n private _getAssociatedForm(): HTMLFormElement | null {\n const formId = this.getAttribute('form');\n if (formId) {\n const form = this.ownerDocument.getElementById(formId);\n return form?.tagName === 'FORM' ? (form as HTMLFormElement) : null;\n }\n\n return this.closest('form');\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n }\n\n /**\n * Build CSS class string for the button\n */\n private _getButtonClasses(): string {\n const classes = ['btn'];\n\n // Add variant class (default to primary)\n const variantClass = VARIANT_CLASSES[this.variant] || 'btn-primary';\n classes.push(variantClass);\n\n // Add size class if specified\n if (this.size && SIZE_CLASSES[this.size]) {\n classes.push(SIZE_CLASSES[this.size]);\n }\n\n // Add loading class\n if (this.loading) {\n classes.push('btn-loading');\n }\n\n return classes.join(' ');\n }\n\n render(): string {\n const isDisabled = this.disabled || this.loading;\n const buttonClasses = this._getButtonClasses();\n\n return `\n <button\n class=\"${buttonClasses}\"\n part=\"button\"\n type=\"${this.type || 'button'}\"\n ${isDisabled ? 'disabled' : ''}\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n >\n <span class=\"content\" part=\"content\">\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\" part=\"suffix\"></slot>\n </span>\n </button>\n `;\n }\n}\n",
|
|
5
|
+
"/**\n * DuskMoon Button Element\n *\n * A customizable button component with multiple variants and sizes.\n * Uses styles from @duskmoon-dev/core for consistent theming.\n *\n * @element el-dm-button\n *\n * @attr {string} variant - Button variant: primary, secondary, tertiary, ghost, outline, success, warning, error, info\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {boolean} disabled - Whether the button is disabled\n * @attr {string} type - Button type: button, submit, reset\n * @attr {boolean} loading - Whether the button is in loading state\n * @attr {string} aria-label - Accessible name for the native button\n * @attr {string} aria-labelledby - IDs of elements naming the button in the host's DOM tree\n *\n * @slot - Default slot for button content\n * @slot prefix - Content before the main text\n * @slot suffix - Content after the main text\n *\n * @csspart button - The native button element\n * @csspart content - The content wrapper\n * @csspart prefix - The prefix slot wrapper\n * @csspart suffix - The suffix slot wrapper\n *\n * @fires click - Fired when button is clicked (native event)\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\nimport { css as buttonCSS } from '@duskmoon-dev/core/components/button';\n\n// Map of variant attribute values to CSS classes\nconst VARIANT_CLASSES: Record<string, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n tertiary: 'btn-tertiary',\n ghost: 'btn-ghost',\n outline: 'btn-outline',\n // Semantic colors\n success: 'btn-success',\n warning: 'btn-warning',\n error: 'btn-error',\n info: 'btn-info',\n};\n\n// Map of size attribute values to CSS classes\nconst SIZE_CLASSES: Record<string, string> = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'ghost'\n | 'outline'\n | 'success'\n | 'warning'\n | 'error'\n | 'info';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';\n\n// Strip @layer wrapper for Shadow DOM compatibility and add host styles\nconst coreStyles = buttonCSS.replace(/@layer\\s+components\\s*\\{/, '').replace(/\\}\\s*$/, '');\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n /* Import core button styles */\n ${coreStyles}\n\n /* Web component specific adjustments */\n .btn {\n font-family: inherit;\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n ::slotted(*) {\n display: inline-flex;\n align-items: center;\n }\n`;\n\nexport class ElDmButton extends BaseElement {\n static get observedAttributes(): string[] {\n return [...super.observedAttributes, 'aria-label', 'aria-labelledby'];\n }\n\n static properties = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n type: { type: String, reflect: true, default: 'button' },\n loading: { type: Boolean, reflect: true },\n };\n\n /** Button variant */\n declare variant: ButtonVariant;\n\n /** Button size */\n declare size: ButtonSize;\n\n /** Whether the button is disabled */\n declare disabled: boolean;\n\n /** Button type (button, submit, reset) */\n declare type: 'button' | 'submit' | 'reset';\n\n /** Whether the button is in loading state */\n declare loading: boolean;\n\n private _labelObserver?: MutationObserver;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n /**\n * Handle click events\n */\n private _handleClick(event: MouseEvent): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n // Handle form submission\n if (this.type === 'submit') {\n const form = this._getAssociatedForm();\n if (form) {\n const submitter = this.ownerDocument.createElement('button');\n submitter.type = 'submit';\n submitter.hidden = true;\n\n for (const attribute of [\n 'name',\n 'value',\n 'formaction',\n 'formenctype',\n 'formmethod',\n 'formnovalidate',\n 'formtarget',\n ]) {\n if (this.hasAttribute(attribute)) {\n submitter.setAttribute(attribute, this.getAttribute(attribute) ?? '');\n }\n }\n\n form.appendChild(submitter);\n try {\n form.requestSubmit(submitter);\n } finally {\n submitter.remove();\n }\n }\n } else if (this.type === 'reset') {\n const form = this._getAssociatedForm();\n if (form) {\n form.reset();\n }\n }\n }\n\n private _getAssociatedForm(): HTMLFormElement | null {\n const formId = this.getAttribute('form');\n if (formId) {\n const form = this.ownerDocument.getElementById(formId);\n return form?.tagName === 'FORM' ? (form as HTMLFormElement) : null;\n }\n\n return this.closest('form');\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this._observeLabels();\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this._labelObserver?.disconnect();\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (oldValue === newValue || !this.isConnected) return;\n if (name === 'aria-label' || name === 'aria-labelledby') {\n this._syncLabel();\n if (name === 'aria-labelledby') this._observeLabels();\n }\n }\n\n protected update(): void {\n super.update();\n this._syncLabel();\n }\n\n private _observeLabels(): void {\n this._labelObserver?.disconnect();\n if (!this.getAttribute('aria-labelledby')?.trim()) return;\n this._labelObserver ??= new MutationObserver(() => this._syncLabel());\n this._labelObserver.observe(this.getRootNode(), {\n subtree: true,\n childList: true,\n characterData: true,\n attributes: true,\n attributeFilter: ['id', 'aria-label'],\n });\n }\n\n private _syncLabel(): void {\n const button = this.shadowRoot.querySelector('button');\n if (!button) return;\n\n const root = this.getRootNode() as Document | ShadowRoot;\n const ids = this.getAttribute('aria-labelledby')?.trim().split(/\\s+/) ?? [];\n const labels = ids\n .map((id) => root.getElementById?.(id))\n .filter((label): label is HTMLElement => !!label);\n let name = this.getAttribute('aria-label');\n\n // ID references cannot cross into a shadow root; element references can.\n if ('ariaLabelledByElements' in button) {\n button.ariaLabelledByElements = labels;\n } else if (labels.length) {\n name = labels.map((label) => label.getAttribute('aria-label') ?? label.textContent).join(' ');\n }\n\n if (name === null) {\n button.removeAttribute('aria-label');\n } else {\n button.setAttribute('aria-label', name);\n }\n }\n\n /**\n * Build CSS class string for the button\n */\n private _getButtonClasses(): string {\n const classes = ['btn'];\n\n // Add variant class (default to primary)\n const variantClass = VARIANT_CLASSES[this.variant] || 'btn-primary';\n classes.push(variantClass);\n\n // Add size class if specified\n if (this.size && SIZE_CLASSES[this.size]) {\n classes.push(SIZE_CLASSES[this.size]);\n }\n\n // Add loading class\n if (this.loading) {\n classes.push('btn-loading');\n }\n\n return classes.join(' ');\n }\n\n render(): string {\n const isDisabled = this.disabled || this.loading;\n const buttonClasses = this._getButtonClasses();\n\n return `\n <button\n class=\"${buttonClasses}\"\n part=\"button\"\n type=\"${this.type || 'button'}\"\n ${isDisabled ? 'disabled' : ''}\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n >\n <span class=\"content\" part=\"content\">\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\" part=\"suffix\"></slot>\n </span>\n </button>\n `;\n }\n}\n",
|
|
6
6
|
"/**\n * @duskmoon-dev/el-button\n *\n * DuskMoon Button custom element\n */\n\nimport { ElDmButton } from './el-dm-button.js';\n\nexport { ElDmButton };\n\n/**\n * Register the el-dm-button custom element\n *\n * @example\n * ```ts\n * import { register } from '@duskmoon-dev/el-button';\n * register();\n * ```\n */\nexport function register(): void {\n if (!customElements.get('el-dm-button')) {\n customElements.define('el-dm-button', ElDmButton);\n }\n}\n",
|
|
7
7
|
"/**\n * Auto-register el-dm-button custom element\n *\n * @example\n * ```ts\n * import '@duskmoon-dev/el-button/register';\n *\n * // Now you can use <el-dm-button> in HTML\n * ```\n */\nimport { register } from './index.js';\n\nregister();\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BiC,IAAjC;AACiC,IAAjC;AAGA,IAAM,kBAA0C;AAAA,EAC9C,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EAET,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACR;AAGA,IAAM,eAAuC;AAAA,EAC3C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAeA,IAAM,aAAa,kBAAU,QAAQ,4BAA4B,EAAE,EAAE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A,IAGzB,IAAI,KAAK,QAAQ,aAAa,KAAK,OAAO;AAAA,MACxC,QAAQ,KAAK,aAAa,KAAK,KAAK;AAAA,IACtC;AAAA,IAGA,IAAI,KAAK,SAAS;AAAA,MAChB,QAAQ,KAAK,aAAa;AAAA,IAC5B;AAAA,IAEA,OAAO,QAAQ,KAAK,GAAG;AAAA;AAAA,EAGzB,MAAM,GAAW;AAAA,IACf,MAAM,aAAa,KAAK,YAAY,KAAK;AAAA,IACzC,MAAM,gBAAgB,KAAK,kBAAkB;AAAA,IAE7C,OAAO;AAAA;AAAA,iBAEM;AAAA;AAAA,gBAED,KAAK,QAAQ;AAAA,UACnB,aAAa,aAAa;AAAA,qBACf,KAAK,UAAU,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU7C;;;ACrRO,SAAS,QAAQ,GAAS;AAAA,EAC/B,IAAI,CAAC,eAAe,IAAI,cAAc,GAAG;AAAA,IACvC,eAAe,OAAO,gBAAgB,UAAU;AAAA,EAClD;AAAA;;;ACVF,SAAS;",
|
|
10
|
+
"debugId": "3D8E71480740F01D64756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -50,6 +50,9 @@ var styles = css`
|
|
|
50
50
|
`;
|
|
51
51
|
|
|
52
52
|
class ElDmButton extends BaseElement {
|
|
53
|
+
static get observedAttributes() {
|
|
54
|
+
return [...super.observedAttributes, "aria-label", "aria-labelledby"];
|
|
55
|
+
}
|
|
53
56
|
static properties = {
|
|
54
57
|
variant: { type: String, reflect: true },
|
|
55
58
|
size: { type: String, reflect: true },
|
|
@@ -57,6 +60,7 @@ class ElDmButton extends BaseElement {
|
|
|
57
60
|
type: { type: String, reflect: true, default: "button" },
|
|
58
61
|
loading: { type: Boolean, reflect: true }
|
|
59
62
|
};
|
|
63
|
+
_labelObserver;
|
|
60
64
|
constructor() {
|
|
61
65
|
super();
|
|
62
66
|
this.attachStyles(styles);
|
|
@@ -111,6 +115,57 @@ class ElDmButton extends BaseElement {
|
|
|
111
115
|
connectedCallback() {
|
|
112
116
|
super.connectedCallback();
|
|
113
117
|
this.addEventListener("click", this._handleClick.bind(this));
|
|
118
|
+
this._observeLabels();
|
|
119
|
+
}
|
|
120
|
+
disconnectedCallback() {
|
|
121
|
+
super.disconnectedCallback();
|
|
122
|
+
this._labelObserver?.disconnect();
|
|
123
|
+
}
|
|
124
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
125
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
126
|
+
if (oldValue === newValue || !this.isConnected)
|
|
127
|
+
return;
|
|
128
|
+
if (name === "aria-label" || name === "aria-labelledby") {
|
|
129
|
+
this._syncLabel();
|
|
130
|
+
if (name === "aria-labelledby")
|
|
131
|
+
this._observeLabels();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
update() {
|
|
135
|
+
super.update();
|
|
136
|
+
this._syncLabel();
|
|
137
|
+
}
|
|
138
|
+
_observeLabels() {
|
|
139
|
+
this._labelObserver?.disconnect();
|
|
140
|
+
if (!this.getAttribute("aria-labelledby")?.trim())
|
|
141
|
+
return;
|
|
142
|
+
this._labelObserver ??= new MutationObserver(() => this._syncLabel());
|
|
143
|
+
this._labelObserver.observe(this.getRootNode(), {
|
|
144
|
+
subtree: true,
|
|
145
|
+
childList: true,
|
|
146
|
+
characterData: true,
|
|
147
|
+
attributes: true,
|
|
148
|
+
attributeFilter: ["id", "aria-label"]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
_syncLabel() {
|
|
152
|
+
const button = this.shadowRoot.querySelector("button");
|
|
153
|
+
if (!button)
|
|
154
|
+
return;
|
|
155
|
+
const root = this.getRootNode();
|
|
156
|
+
const ids = this.getAttribute("aria-labelledby")?.trim().split(/\s+/) ?? [];
|
|
157
|
+
const labels = ids.map((id) => root.getElementById?.(id)).filter((label) => !!label);
|
|
158
|
+
let name = this.getAttribute("aria-label");
|
|
159
|
+
if ("ariaLabelledByElements" in button) {
|
|
160
|
+
button.ariaLabelledByElements = labels;
|
|
161
|
+
} else if (labels.length) {
|
|
162
|
+
name = labels.map((label) => label.getAttribute("aria-label") ?? label.textContent).join(" ");
|
|
163
|
+
}
|
|
164
|
+
if (name === null) {
|
|
165
|
+
button.removeAttribute("aria-label");
|
|
166
|
+
} else {
|
|
167
|
+
button.setAttribute("aria-label", name);
|
|
168
|
+
}
|
|
114
169
|
}
|
|
115
170
|
_getButtonClasses() {
|
|
116
171
|
const classes = ["btn"];
|
|
@@ -156,5 +211,5 @@ export {
|
|
|
156
211
|
register
|
|
157
212
|
};
|
|
158
213
|
|
|
159
|
-
//# debugId=
|
|
214
|
+
//# debugId=49B0F782575339A764756E2164756E21
|
|
160
215
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/el-dm-button.ts", "../../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * DuskMoon Button Element\n *\n * A customizable button component with multiple variants and sizes.\n * Uses styles from @duskmoon-dev/core for consistent theming.\n *\n * @element el-dm-button\n *\n * @attr {string} variant - Button variant: primary, secondary, tertiary, ghost, outline, success, warning, error, info\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {boolean} disabled - Whether the button is disabled\n * @attr {string} type - Button type: button, submit, reset\n * @attr {boolean} loading - Whether the button is in loading state\n *\n * @slot - Default slot for button content\n * @slot prefix - Content before the main text\n * @slot suffix - Content after the main text\n *\n * @csspart button - The native button element\n * @csspart content - The content wrapper\n * @csspart prefix - The prefix slot wrapper\n * @csspart suffix - The suffix slot wrapper\n *\n * @fires click - Fired when button is clicked (native event)\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\nimport { css as buttonCSS } from '@duskmoon-dev/core/components/button';\n\n// Map of variant attribute values to CSS classes\nconst VARIANT_CLASSES: Record<string, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n tertiary: 'btn-tertiary',\n ghost: 'btn-ghost',\n outline: 'btn-outline',\n // Semantic colors\n success: 'btn-success',\n warning: 'btn-warning',\n error: 'btn-error',\n info: 'btn-info',\n};\n\n// Map of size attribute values to CSS classes\nconst SIZE_CLASSES: Record<string, string> = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'ghost'\n | 'outline'\n | 'success'\n | 'warning'\n | 'error'\n | 'info';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';\n\n// Strip @layer wrapper for Shadow DOM compatibility and add host styles\nconst coreStyles = buttonCSS.replace(/@layer\\s+components\\s*\\{/, '').replace(/\\}\\s*$/, '');\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n /* Import core button styles */\n ${coreStyles}\n\n /* Web component specific adjustments */\n .btn {\n font-family: inherit;\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n ::slotted(*) {\n display: inline-flex;\n align-items: center;\n }\n`;\n\nexport class ElDmButton extends BaseElement {\n static properties = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n type: { type: String, reflect: true, default: 'button' },\n loading: { type: Boolean, reflect: true },\n };\n\n /** Button variant */\n declare variant: ButtonVariant;\n\n /** Button size */\n declare size: ButtonSize;\n\n /** Whether the button is disabled */\n declare disabled: boolean;\n\n /** Button type (button, submit, reset) */\n declare type: 'button' | 'submit' | 'reset';\n\n /** Whether the button is in loading state */\n declare loading: boolean;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n /**\n * Handle click events\n */\n private _handleClick(event: MouseEvent): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n // Handle form submission\n if (this.type === 'submit') {\n const form = this._getAssociatedForm();\n if (form) {\n const submitter = this.ownerDocument.createElement('button');\n submitter.type = 'submit';\n submitter.hidden = true;\n\n for (const attribute of [\n 'name',\n 'value',\n 'formaction',\n 'formenctype',\n 'formmethod',\n 'formnovalidate',\n 'formtarget',\n ]) {\n if (this.hasAttribute(attribute)) {\n submitter.setAttribute(attribute, this.getAttribute(attribute) ?? '');\n }\n }\n\n form.appendChild(submitter);\n try {\n form.requestSubmit(submitter);\n } finally {\n submitter.remove();\n }\n }\n } else if (this.type === 'reset') {\n const form = this._getAssociatedForm();\n if (form) {\n form.reset();\n }\n }\n }\n\n private _getAssociatedForm(): HTMLFormElement | null {\n const formId = this.getAttribute('form');\n if (formId) {\n const form = this.ownerDocument.getElementById(formId);\n return form?.tagName === 'FORM' ? (form as HTMLFormElement) : null;\n }\n\n return this.closest('form');\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n }\n\n /**\n * Build CSS class string for the button\n */\n private _getButtonClasses(): string {\n const classes = ['btn'];\n\n // Add variant class (default to primary)\n const variantClass = VARIANT_CLASSES[this.variant] || 'btn-primary';\n classes.push(variantClass);\n\n // Add size class if specified\n if (this.size && SIZE_CLASSES[this.size]) {\n classes.push(SIZE_CLASSES[this.size]);\n }\n\n // Add loading class\n if (this.loading) {\n classes.push('btn-loading');\n }\n\n return classes.join(' ');\n }\n\n render(): string {\n const isDisabled = this.disabled || this.loading;\n const buttonClasses = this._getButtonClasses();\n\n return `\n <button\n class=\"${buttonClasses}\"\n part=\"button\"\n type=\"${this.type || 'button'}\"\n ${isDisabled ? 'disabled' : ''}\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n >\n <span class=\"content\" part=\"content\">\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\" part=\"suffix\"></slot>\n </span>\n </button>\n `;\n }\n}\n",
|
|
5
|
+
"/**\n * DuskMoon Button Element\n *\n * A customizable button component with multiple variants and sizes.\n * Uses styles from @duskmoon-dev/core for consistent theming.\n *\n * @element el-dm-button\n *\n * @attr {string} variant - Button variant: primary, secondary, tertiary, ghost, outline, success, warning, error, info\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {boolean} disabled - Whether the button is disabled\n * @attr {string} type - Button type: button, submit, reset\n * @attr {boolean} loading - Whether the button is in loading state\n * @attr {string} aria-label - Accessible name for the native button\n * @attr {string} aria-labelledby - IDs of elements naming the button in the host's DOM tree\n *\n * @slot - Default slot for button content\n * @slot prefix - Content before the main text\n * @slot suffix - Content after the main text\n *\n * @csspart button - The native button element\n * @csspart content - The content wrapper\n * @csspart prefix - The prefix slot wrapper\n * @csspart suffix - The suffix slot wrapper\n *\n * @fires click - Fired when button is clicked (native event)\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\nimport { css as buttonCSS } from '@duskmoon-dev/core/components/button';\n\n// Map of variant attribute values to CSS classes\nconst VARIANT_CLASSES: Record<string, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n tertiary: 'btn-tertiary',\n ghost: 'btn-ghost',\n outline: 'btn-outline',\n // Semantic colors\n success: 'btn-success',\n warning: 'btn-warning',\n error: 'btn-error',\n info: 'btn-info',\n};\n\n// Map of size attribute values to CSS classes\nconst SIZE_CLASSES: Record<string, string> = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'ghost'\n | 'outline'\n | 'success'\n | 'warning'\n | 'error'\n | 'info';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';\n\n// Strip @layer wrapper for Shadow DOM compatibility and add host styles\nconst coreStyles = buttonCSS.replace(/@layer\\s+components\\s*\\{/, '').replace(/\\}\\s*$/, '');\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n /* Import core button styles */\n ${coreStyles}\n\n /* Web component specific adjustments */\n .btn {\n font-family: inherit;\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n ::slotted(*) {\n display: inline-flex;\n align-items: center;\n }\n`;\n\nexport class ElDmButton extends BaseElement {\n static get observedAttributes(): string[] {\n return [...super.observedAttributes, 'aria-label', 'aria-labelledby'];\n }\n\n static properties = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n type: { type: String, reflect: true, default: 'button' },\n loading: { type: Boolean, reflect: true },\n };\n\n /** Button variant */\n declare variant: ButtonVariant;\n\n /** Button size */\n declare size: ButtonSize;\n\n /** Whether the button is disabled */\n declare disabled: boolean;\n\n /** Button type (button, submit, reset) */\n declare type: 'button' | 'submit' | 'reset';\n\n /** Whether the button is in loading state */\n declare loading: boolean;\n\n private _labelObserver?: MutationObserver;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n /**\n * Handle click events\n */\n private _handleClick(event: MouseEvent): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n // Handle form submission\n if (this.type === 'submit') {\n const form = this._getAssociatedForm();\n if (form) {\n const submitter = this.ownerDocument.createElement('button');\n submitter.type = 'submit';\n submitter.hidden = true;\n\n for (const attribute of [\n 'name',\n 'value',\n 'formaction',\n 'formenctype',\n 'formmethod',\n 'formnovalidate',\n 'formtarget',\n ]) {\n if (this.hasAttribute(attribute)) {\n submitter.setAttribute(attribute, this.getAttribute(attribute) ?? '');\n }\n }\n\n form.appendChild(submitter);\n try {\n form.requestSubmit(submitter);\n } finally {\n submitter.remove();\n }\n }\n } else if (this.type === 'reset') {\n const form = this._getAssociatedForm();\n if (form) {\n form.reset();\n }\n }\n }\n\n private _getAssociatedForm(): HTMLFormElement | null {\n const formId = this.getAttribute('form');\n if (formId) {\n const form = this.ownerDocument.getElementById(formId);\n return form?.tagName === 'FORM' ? (form as HTMLFormElement) : null;\n }\n\n return this.closest('form');\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this._observeLabels();\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this._labelObserver?.disconnect();\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (oldValue === newValue || !this.isConnected) return;\n if (name === 'aria-label' || name === 'aria-labelledby') {\n this._syncLabel();\n if (name === 'aria-labelledby') this._observeLabels();\n }\n }\n\n protected update(): void {\n super.update();\n this._syncLabel();\n }\n\n private _observeLabels(): void {\n this._labelObserver?.disconnect();\n if (!this.getAttribute('aria-labelledby')?.trim()) return;\n this._labelObserver ??= new MutationObserver(() => this._syncLabel());\n this._labelObserver.observe(this.getRootNode(), {\n subtree: true,\n childList: true,\n characterData: true,\n attributes: true,\n attributeFilter: ['id', 'aria-label'],\n });\n }\n\n private _syncLabel(): void {\n const button = this.shadowRoot.querySelector('button');\n if (!button) return;\n\n const root = this.getRootNode() as Document | ShadowRoot;\n const ids = this.getAttribute('aria-labelledby')?.trim().split(/\\s+/) ?? [];\n const labels = ids\n .map((id) => root.getElementById?.(id))\n .filter((label): label is HTMLElement => !!label);\n let name = this.getAttribute('aria-label');\n\n // ID references cannot cross into a shadow root; element references can.\n if ('ariaLabelledByElements' in button) {\n button.ariaLabelledByElements = labels;\n } else if (labels.length) {\n name = labels.map((label) => label.getAttribute('aria-label') ?? label.textContent).join(' ');\n }\n\n if (name === null) {\n button.removeAttribute('aria-label');\n } else {\n button.setAttribute('aria-label', name);\n }\n }\n\n /**\n * Build CSS class string for the button\n */\n private _getButtonClasses(): string {\n const classes = ['btn'];\n\n // Add variant class (default to primary)\n const variantClass = VARIANT_CLASSES[this.variant] || 'btn-primary';\n classes.push(variantClass);\n\n // Add size class if specified\n if (this.size && SIZE_CLASSES[this.size]) {\n classes.push(SIZE_CLASSES[this.size]);\n }\n\n // Add loading class\n if (this.loading) {\n classes.push('btn-loading');\n }\n\n return classes.join(' ');\n }\n\n render(): string {\n const isDisabled = this.disabled || this.loading;\n const buttonClasses = this._getButtonClasses();\n\n return `\n <button\n class=\"${buttonClasses}\"\n part=\"button\"\n type=\"${this.type || 'button'}\"\n ${isDisabled ? 'disabled' : ''}\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n >\n <span class=\"content\" part=\"content\">\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\" part=\"suffix\"></slot>\n </span>\n </button>\n `;\n }\n}\n",
|
|
6
6
|
"/**\n * @duskmoon-dev/el-button\n *\n * DuskMoon Button custom element\n */\n\nimport { ElDmButton } from './el-dm-button.js';\n\nexport { ElDmButton };\n\n/**\n * Register the el-dm-button custom element\n *\n * @example\n * ```ts\n * import { register } from '@duskmoon-dev/el-button';\n * register();\n * ```\n */\nexport function register(): void {\n if (!customElements.get('el-dm-button')) {\n customElements.define('el-dm-button', ElDmButton);\n }\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mappings": ";AA4BA;AACA,gBAAS;AAGT,IAAM,kBAA0C;AAAA,EAC9C,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EAET,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACR;AAGA,IAAM,eAAuC;AAAA,EAC3C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAeA,IAAM,aAAa,UAAU,QAAQ,4BAA4B,EAAE,EAAE,QAAQ,UAAU,EAAE;AAEzF,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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A,OAAO,QAAQ,KAAK,GAAG;AAAA;AAAA,EAGzB,MAAM,GAAW;AAAA,IACf,MAAM,aAAa,KAAK,YAAY,KAAK;AAAA,IACzC,MAAM,gBAAgB,KAAK,kBAAkB;AAAA,IAE7C,OAAO;AAAA;AAAA,iBAEM;AAAA;AAAA,gBAED,KAAK,QAAQ;AAAA,UACnB,aAAa,aAAa;AAAA,qBACf,KAAK,UAAU,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU7C;;;ACrRO,SAAS,QAAQ,GAAS;AAAA,EAC/B,IAAI,CAAC,eAAe,IAAI,cAAc,GAAG;AAAA,IACvC,eAAe,OAAO,gBAAgB,UAAU;AAAA,EAClD;AAAA;",
|
|
9
|
+
"debugId": "49B0F782575339A764756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/esm/register.js
CHANGED
|
@@ -50,6 +50,9 @@ var styles = css`
|
|
|
50
50
|
`;
|
|
51
51
|
|
|
52
52
|
class ElDmButton extends BaseElement {
|
|
53
|
+
static get observedAttributes() {
|
|
54
|
+
return [...super.observedAttributes, "aria-label", "aria-labelledby"];
|
|
55
|
+
}
|
|
53
56
|
static properties = {
|
|
54
57
|
variant: { type: String, reflect: true },
|
|
55
58
|
size: { type: String, reflect: true },
|
|
@@ -57,6 +60,7 @@ class ElDmButton extends BaseElement {
|
|
|
57
60
|
type: { type: String, reflect: true, default: "button" },
|
|
58
61
|
loading: { type: Boolean, reflect: true }
|
|
59
62
|
};
|
|
63
|
+
_labelObserver;
|
|
60
64
|
constructor() {
|
|
61
65
|
super();
|
|
62
66
|
this.attachStyles(styles);
|
|
@@ -111,6 +115,57 @@ class ElDmButton extends BaseElement {
|
|
|
111
115
|
connectedCallback() {
|
|
112
116
|
super.connectedCallback();
|
|
113
117
|
this.addEventListener("click", this._handleClick.bind(this));
|
|
118
|
+
this._observeLabels();
|
|
119
|
+
}
|
|
120
|
+
disconnectedCallback() {
|
|
121
|
+
super.disconnectedCallback();
|
|
122
|
+
this._labelObserver?.disconnect();
|
|
123
|
+
}
|
|
124
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
125
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
126
|
+
if (oldValue === newValue || !this.isConnected)
|
|
127
|
+
return;
|
|
128
|
+
if (name === "aria-label" || name === "aria-labelledby") {
|
|
129
|
+
this._syncLabel();
|
|
130
|
+
if (name === "aria-labelledby")
|
|
131
|
+
this._observeLabels();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
update() {
|
|
135
|
+
super.update();
|
|
136
|
+
this._syncLabel();
|
|
137
|
+
}
|
|
138
|
+
_observeLabels() {
|
|
139
|
+
this._labelObserver?.disconnect();
|
|
140
|
+
if (!this.getAttribute("aria-labelledby")?.trim())
|
|
141
|
+
return;
|
|
142
|
+
this._labelObserver ??= new MutationObserver(() => this._syncLabel());
|
|
143
|
+
this._labelObserver.observe(this.getRootNode(), {
|
|
144
|
+
subtree: true,
|
|
145
|
+
childList: true,
|
|
146
|
+
characterData: true,
|
|
147
|
+
attributes: true,
|
|
148
|
+
attributeFilter: ["id", "aria-label"]
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
_syncLabel() {
|
|
152
|
+
const button = this.shadowRoot.querySelector("button");
|
|
153
|
+
if (!button)
|
|
154
|
+
return;
|
|
155
|
+
const root = this.getRootNode();
|
|
156
|
+
const ids = this.getAttribute("aria-labelledby")?.trim().split(/\s+/) ?? [];
|
|
157
|
+
const labels = ids.map((id) => root.getElementById?.(id)).filter((label) => !!label);
|
|
158
|
+
let name = this.getAttribute("aria-label");
|
|
159
|
+
if ("ariaLabelledByElements" in button) {
|
|
160
|
+
button.ariaLabelledByElements = labels;
|
|
161
|
+
} else if (labels.length) {
|
|
162
|
+
name = labels.map((label) => label.getAttribute("aria-label") ?? label.textContent).join(" ");
|
|
163
|
+
}
|
|
164
|
+
if (name === null) {
|
|
165
|
+
button.removeAttribute("aria-label");
|
|
166
|
+
} else {
|
|
167
|
+
button.setAttribute("aria-label", name);
|
|
168
|
+
}
|
|
114
169
|
}
|
|
115
170
|
_getButtonClasses() {
|
|
116
171
|
const classes = ["btn"];
|
|
@@ -155,5 +210,5 @@ function register() {
|
|
|
155
210
|
// src/register.ts
|
|
156
211
|
register();
|
|
157
212
|
|
|
158
|
-
//# debugId=
|
|
213
|
+
//# debugId=E4E6D343E423469F64756E2164756E21
|
|
159
214
|
//# sourceMappingURL=register.js.map
|
package/dist/esm/register.js.map
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/el-dm-button.ts", "../../src/index.ts", "../../src/register.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * DuskMoon Button Element\n *\n * A customizable button component with multiple variants and sizes.\n * Uses styles from @duskmoon-dev/core for consistent theming.\n *\n * @element el-dm-button\n *\n * @attr {string} variant - Button variant: primary, secondary, tertiary, ghost, outline, success, warning, error, info\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {boolean} disabled - Whether the button is disabled\n * @attr {string} type - Button type: button, submit, reset\n * @attr {boolean} loading - Whether the button is in loading state\n *\n * @slot - Default slot for button content\n * @slot prefix - Content before the main text\n * @slot suffix - Content after the main text\n *\n * @csspart button - The native button element\n * @csspart content - The content wrapper\n * @csspart prefix - The prefix slot wrapper\n * @csspart suffix - The suffix slot wrapper\n *\n * @fires click - Fired when button is clicked (native event)\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\nimport { css as buttonCSS } from '@duskmoon-dev/core/components/button';\n\n// Map of variant attribute values to CSS classes\nconst VARIANT_CLASSES: Record<string, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n tertiary: 'btn-tertiary',\n ghost: 'btn-ghost',\n outline: 'btn-outline',\n // Semantic colors\n success: 'btn-success',\n warning: 'btn-warning',\n error: 'btn-error',\n info: 'btn-info',\n};\n\n// Map of size attribute values to CSS classes\nconst SIZE_CLASSES: Record<string, string> = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'ghost'\n | 'outline'\n | 'success'\n | 'warning'\n | 'error'\n | 'info';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';\n\n// Strip @layer wrapper for Shadow DOM compatibility and add host styles\nconst coreStyles = buttonCSS.replace(/@layer\\s+components\\s*\\{/, '').replace(/\\}\\s*$/, '');\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n /* Import core button styles */\n ${coreStyles}\n\n /* Web component specific adjustments */\n .btn {\n font-family: inherit;\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n ::slotted(*) {\n display: inline-flex;\n align-items: center;\n }\n`;\n\nexport class ElDmButton extends BaseElement {\n static properties = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n type: { type: String, reflect: true, default: 'button' },\n loading: { type: Boolean, reflect: true },\n };\n\n /** Button variant */\n declare variant: ButtonVariant;\n\n /** Button size */\n declare size: ButtonSize;\n\n /** Whether the button is disabled */\n declare disabled: boolean;\n\n /** Button type (button, submit, reset) */\n declare type: 'button' | 'submit' | 'reset';\n\n /** Whether the button is in loading state */\n declare loading: boolean;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n /**\n * Handle click events\n */\n private _handleClick(event: MouseEvent): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n // Handle form submission\n if (this.type === 'submit') {\n const form = this._getAssociatedForm();\n if (form) {\n const submitter = this.ownerDocument.createElement('button');\n submitter.type = 'submit';\n submitter.hidden = true;\n\n for (const attribute of [\n 'name',\n 'value',\n 'formaction',\n 'formenctype',\n 'formmethod',\n 'formnovalidate',\n 'formtarget',\n ]) {\n if (this.hasAttribute(attribute)) {\n submitter.setAttribute(attribute, this.getAttribute(attribute) ?? '');\n }\n }\n\n form.appendChild(submitter);\n try {\n form.requestSubmit(submitter);\n } finally {\n submitter.remove();\n }\n }\n } else if (this.type === 'reset') {\n const form = this._getAssociatedForm();\n if (form) {\n form.reset();\n }\n }\n }\n\n private _getAssociatedForm(): HTMLFormElement | null {\n const formId = this.getAttribute('form');\n if (formId) {\n const form = this.ownerDocument.getElementById(formId);\n return form?.tagName === 'FORM' ? (form as HTMLFormElement) : null;\n }\n\n return this.closest('form');\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n }\n\n /**\n * Build CSS class string for the button\n */\n private _getButtonClasses(): string {\n const classes = ['btn'];\n\n // Add variant class (default to primary)\n const variantClass = VARIANT_CLASSES[this.variant] || 'btn-primary';\n classes.push(variantClass);\n\n // Add size class if specified\n if (this.size && SIZE_CLASSES[this.size]) {\n classes.push(SIZE_CLASSES[this.size]);\n }\n\n // Add loading class\n if (this.loading) {\n classes.push('btn-loading');\n }\n\n return classes.join(' ');\n }\n\n render(): string {\n const isDisabled = this.disabled || this.loading;\n const buttonClasses = this._getButtonClasses();\n\n return `\n <button\n class=\"${buttonClasses}\"\n part=\"button\"\n type=\"${this.type || 'button'}\"\n ${isDisabled ? 'disabled' : ''}\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n >\n <span class=\"content\" part=\"content\">\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\" part=\"suffix\"></slot>\n </span>\n </button>\n `;\n }\n}\n",
|
|
5
|
+
"/**\n * DuskMoon Button Element\n *\n * A customizable button component with multiple variants and sizes.\n * Uses styles from @duskmoon-dev/core for consistent theming.\n *\n * @element el-dm-button\n *\n * @attr {string} variant - Button variant: primary, secondary, tertiary, ghost, outline, success, warning, error, info\n * @attr {string} size - Button size: xs, sm, md, lg\n * @attr {boolean} disabled - Whether the button is disabled\n * @attr {string} type - Button type: button, submit, reset\n * @attr {boolean} loading - Whether the button is in loading state\n * @attr {string} aria-label - Accessible name for the native button\n * @attr {string} aria-labelledby - IDs of elements naming the button in the host's DOM tree\n *\n * @slot - Default slot for button content\n * @slot prefix - Content before the main text\n * @slot suffix - Content after the main text\n *\n * @csspart button - The native button element\n * @csspart content - The content wrapper\n * @csspart prefix - The prefix slot wrapper\n * @csspart suffix - The suffix slot wrapper\n *\n * @fires click - Fired when button is clicked (native event)\n */\n\nimport { BaseElement, css } from '@duskmoon-dev/el-base';\nimport { css as buttonCSS } from '@duskmoon-dev/core/components/button';\n\n// Map of variant attribute values to CSS classes\nconst VARIANT_CLASSES: Record<string, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n tertiary: 'btn-tertiary',\n ghost: 'btn-ghost',\n outline: 'btn-outline',\n // Semantic colors\n success: 'btn-success',\n warning: 'btn-warning',\n error: 'btn-error',\n info: 'btn-info',\n};\n\n// Map of size attribute values to CSS classes\nconst SIZE_CLASSES: Record<string, string> = {\n xs: 'btn-xs',\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'ghost'\n | 'outline'\n | 'success'\n | 'warning'\n | 'error'\n | 'info';\nexport type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';\n\n// Strip @layer wrapper for Shadow DOM compatibility and add host styles\nconst coreStyles = buttonCSS.replace(/@layer\\s+components\\s*\\{/, '').replace(/\\}\\s*$/, '');\n\nconst styles = css`\n :host {\n display: inline-flex;\n vertical-align: middle;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n /* Import core button styles */\n ${coreStyles}\n\n /* Web component specific adjustments */\n .btn {\n font-family: inherit;\n }\n\n .content {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\n }\n\n ::slotted(*) {\n display: inline-flex;\n align-items: center;\n }\n`;\n\nexport class ElDmButton extends BaseElement {\n static get observedAttributes(): string[] {\n return [...super.observedAttributes, 'aria-label', 'aria-labelledby'];\n }\n\n static properties = {\n variant: { type: String, reflect: true },\n size: { type: String, reflect: true },\n disabled: { type: Boolean, reflect: true },\n type: { type: String, reflect: true, default: 'button' },\n loading: { type: Boolean, reflect: true },\n };\n\n /** Button variant */\n declare variant: ButtonVariant;\n\n /** Button size */\n declare size: ButtonSize;\n\n /** Whether the button is disabled */\n declare disabled: boolean;\n\n /** Button type (button, submit, reset) */\n declare type: 'button' | 'submit' | 'reset';\n\n /** Whether the button is in loading state */\n declare loading: boolean;\n\n private _labelObserver?: MutationObserver;\n\n constructor() {\n super();\n this.attachStyles(styles);\n }\n\n /**\n * Handle click events\n */\n private _handleClick(event: MouseEvent): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n // Handle form submission\n if (this.type === 'submit') {\n const form = this._getAssociatedForm();\n if (form) {\n const submitter = this.ownerDocument.createElement('button');\n submitter.type = 'submit';\n submitter.hidden = true;\n\n for (const attribute of [\n 'name',\n 'value',\n 'formaction',\n 'formenctype',\n 'formmethod',\n 'formnovalidate',\n 'formtarget',\n ]) {\n if (this.hasAttribute(attribute)) {\n submitter.setAttribute(attribute, this.getAttribute(attribute) ?? '');\n }\n }\n\n form.appendChild(submitter);\n try {\n form.requestSubmit(submitter);\n } finally {\n submitter.remove();\n }\n }\n } else if (this.type === 'reset') {\n const form = this._getAssociatedForm();\n if (form) {\n form.reset();\n }\n }\n }\n\n private _getAssociatedForm(): HTMLFormElement | null {\n const formId = this.getAttribute('form');\n if (formId) {\n const form = this.ownerDocument.getElementById(formId);\n return form?.tagName === 'FORM' ? (form as HTMLFormElement) : null;\n }\n\n return this.closest('form');\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleClick.bind(this));\n this._observeLabels();\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this._labelObserver?.disconnect();\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (oldValue === newValue || !this.isConnected) return;\n if (name === 'aria-label' || name === 'aria-labelledby') {\n this._syncLabel();\n if (name === 'aria-labelledby') this._observeLabels();\n }\n }\n\n protected update(): void {\n super.update();\n this._syncLabel();\n }\n\n private _observeLabels(): void {\n this._labelObserver?.disconnect();\n if (!this.getAttribute('aria-labelledby')?.trim()) return;\n this._labelObserver ??= new MutationObserver(() => this._syncLabel());\n this._labelObserver.observe(this.getRootNode(), {\n subtree: true,\n childList: true,\n characterData: true,\n attributes: true,\n attributeFilter: ['id', 'aria-label'],\n });\n }\n\n private _syncLabel(): void {\n const button = this.shadowRoot.querySelector('button');\n if (!button) return;\n\n const root = this.getRootNode() as Document | ShadowRoot;\n const ids = this.getAttribute('aria-labelledby')?.trim().split(/\\s+/) ?? [];\n const labels = ids\n .map((id) => root.getElementById?.(id))\n .filter((label): label is HTMLElement => !!label);\n let name = this.getAttribute('aria-label');\n\n // ID references cannot cross into a shadow root; element references can.\n if ('ariaLabelledByElements' in button) {\n button.ariaLabelledByElements = labels;\n } else if (labels.length) {\n name = labels.map((label) => label.getAttribute('aria-label') ?? label.textContent).join(' ');\n }\n\n if (name === null) {\n button.removeAttribute('aria-label');\n } else {\n button.setAttribute('aria-label', name);\n }\n }\n\n /**\n * Build CSS class string for the button\n */\n private _getButtonClasses(): string {\n const classes = ['btn'];\n\n // Add variant class (default to primary)\n const variantClass = VARIANT_CLASSES[this.variant] || 'btn-primary';\n classes.push(variantClass);\n\n // Add size class if specified\n if (this.size && SIZE_CLASSES[this.size]) {\n classes.push(SIZE_CLASSES[this.size]);\n }\n\n // Add loading class\n if (this.loading) {\n classes.push('btn-loading');\n }\n\n return classes.join(' ');\n }\n\n render(): string {\n const isDisabled = this.disabled || this.loading;\n const buttonClasses = this._getButtonClasses();\n\n return `\n <button\n class=\"${buttonClasses}\"\n part=\"button\"\n type=\"${this.type || 'button'}\"\n ${isDisabled ? 'disabled' : ''}\n aria-busy=\"${this.loading ? 'true' : 'false'}\"\n >\n <span class=\"content\" part=\"content\">\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <slot></slot>\n <slot name=\"suffix\" part=\"suffix\"></slot>\n </span>\n </button>\n `;\n }\n}\n",
|
|
6
6
|
"/**\n * @duskmoon-dev/el-button\n *\n * DuskMoon Button custom element\n */\n\nimport { ElDmButton } from './el-dm-button.js';\n\nexport { ElDmButton };\n\n/**\n * Register the el-dm-button custom element\n *\n * @example\n * ```ts\n * import { register } from '@duskmoon-dev/el-button';\n * register();\n * ```\n */\nexport function register(): void {\n if (!customElements.get('el-dm-button')) {\n customElements.define('el-dm-button', ElDmButton);\n }\n}\n",
|
|
7
7
|
"/**\n * Auto-register el-dm-button custom element\n *\n * @example\n * ```ts\n * import '@duskmoon-dev/el-button/register';\n *\n * // Now you can use <el-dm-button> in HTML\n * ```\n */\nimport { register } from './index.js';\n\nregister();\n"
|
|
8
8
|
],
|
|
9
|
-
"mappings": ";
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": ";AA4BA;AACA,gBAAS;AAGT,IAAM,kBAA0C;AAAA,EAC9C,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EAET,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACR;AAGA,IAAM,eAAuC;AAAA,EAC3C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAeA,IAAM,aAAa,UAAU,QAAQ,4BAA4B,EAAE,EAAE,QAAQ,UAAU,EAAE;AAEzF,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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A;AAAA,EAGzB,MAAM,GAAW;AAAA,IACf,MAAM,aAAa,KAAK,YAAY,KAAK;AAAA,IACzC,MAAM,gBAAgB,KAAK,kBAAkB;AAAA,IAE7C,OAAO;AAAA;AAAA,iBAEM;AAAA;AAAA,gBAED,KAAK,QAAQ;AAAA,UACnB,aAAa,aAAa;AAAA,qBACf,KAAK,UAAU,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU7C;;;ACrRO,SAAS,QAAQ,GAAS;AAAA,EAC/B,IAAI,CAAC,eAAe,IAAI,cAAc,GAAG;AAAA,IACvC,eAAe,OAAO,gBAAgB,UAAU;AAAA,EAClD;AAAA;;;ACVF,SAAS;",
|
|
10
|
+
"debugId": "E4E6D343E423469F64756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"fileNames":["../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/duskmoon-core.d.ts","../../../packages/base/dist/types/base-element.d.ts","../../../packages/base/dist/types/styles.d.ts","../../../packages/base/dist/types/animations.d.ts","../../../packages/base/dist/types/themes.d.ts","../../../packages/base/dist/types/mixins.d.ts","../../../packages/base/dist/types/types.d.ts","../../../packages/base/dist/types/validation.d.ts","../../../packages/base/dist/types/performance.d.ts","../../../packages/base/dist/types/index.d.ts","../../../node_modules/.bun/@duskmoon-dev+core@1.20.3+e83bd97e7d41411e/node_modules/@duskmoon-dev/core/dist/esm/components/button.d.ts","../src/el-dm-button.ts","../src/index.ts","../src/register.ts"],"fileIdsList":[[60,69],[71],[72],[61,62,63,64,65,66,67,68],[61],[66]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},"089e5f6343a272f3dc70f597665b75c8574b02ac052fdf962ccea821459d7aa8","42526b6de804c10fd86f1cf55a6c660a74ee448e381f0f78356f223b75982280","28914adcfb92fa94199e1c887da7d67a7d9d736d9571627d6b02e55ff82f577b","b0a69607a92876948c2a42e3aa6703b0d724699468ed7e3c6e2a237d119a9db9","cdacb8e4ac607a46494d1187e073382c43e7269e8bf698502a285a8ccb470925","f5091ebbd718ea236a7f503df569deb07aff0621aa8f73ed90e419de88f006aa","d3a328c0eccf652bc8b6c14515a8b848a558b9d684e15a7c0c2e15de5016df57","1b5193795ee478857bf1115fed004151284dd4da883a5a4f22e62631c3b414ad","3be01044afc63501423c361deb531d3e95f5c2677f1f7a628802bd346988d62c","78d8d1ca7d54a437702c8a8c08764b6a49f2cf2ca357d0e459bfe89a06abf50a",{"version":"19b7efc08946f1d211f3813e8249d24a9e76da7c019f21a82ac1c8a3467f77f4","impliedFormat":99},{"version":"c70a48bb7d821295f1638612191532abaed1cfb855e5cdd2d3e433bd71129f93","signature":"e57e4470b7f674d1b11e1ba74b94dd9c9cd40d39f1e2cc6115df6d20dff73277"},{"version":"080d2316ae4700d08af27b08d91f52c0654838e3accf412db2907bd65b33007e","signature":"b483a056dc804e003c84649170ec937784561dc4300d25d9bce2cd8c055af419"},{"version":"cde445f39cdec3f697751fd4ab0476fe832132ac09b4760c0357f267e86c277b","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"}],"root":[60,[71,73]],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":99,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"referencedMap":[[71,1],[72,2],[73,3],[69,4],[65,5],[67,6]],"latestChangedDtsFile":"./types/register.d.ts","version":"6.0.3"}
|
|
1
|
+
{"fileNames":["../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/duskmoon-core.d.ts","../../../packages/base/dist/types/base-element.d.ts","../../../packages/base/dist/types/styles.d.ts","../../../packages/base/dist/types/animations.d.ts","../../../packages/base/dist/types/themes.d.ts","../../../packages/base/dist/types/mixins.d.ts","../../../packages/base/dist/types/types.d.ts","../../../packages/base/dist/types/validation.d.ts","../../../packages/base/dist/types/performance.d.ts","../../../packages/base/dist/types/index.d.ts","../../../node_modules/.bun/@duskmoon-dev+core@1.20.3+e83bd97e7d41411e/node_modules/@duskmoon-dev/core/dist/esm/components/button.d.ts","../src/el-dm-button.ts","../src/index.ts","../src/register.ts"],"fileIdsList":[[60,69],[71],[72],[61,62,63,64,65,66,67,68],[61],[66]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},"089e5f6343a272f3dc70f597665b75c8574b02ac052fdf962ccea821459d7aa8","42526b6de804c10fd86f1cf55a6c660a74ee448e381f0f78356f223b75982280","28914adcfb92fa94199e1c887da7d67a7d9d736d9571627d6b02e55ff82f577b","b0a69607a92876948c2a42e3aa6703b0d724699468ed7e3c6e2a237d119a9db9","cdacb8e4ac607a46494d1187e073382c43e7269e8bf698502a285a8ccb470925","f5091ebbd718ea236a7f503df569deb07aff0621aa8f73ed90e419de88f006aa","d3a328c0eccf652bc8b6c14515a8b848a558b9d684e15a7c0c2e15de5016df57","1b5193795ee478857bf1115fed004151284dd4da883a5a4f22e62631c3b414ad","3be01044afc63501423c361deb531d3e95f5c2677f1f7a628802bd346988d62c","78d8d1ca7d54a437702c8a8c08764b6a49f2cf2ca357d0e459bfe89a06abf50a",{"version":"19b7efc08946f1d211f3813e8249d24a9e76da7c019f21a82ac1c8a3467f77f4","impliedFormat":99},{"version":"71668038a381462bce305bbb5c3c99ac1097ff2cb30447307fe256515e4208fc","signature":"145b09b360d24ec4d35413d7c0dc50e02716fa91126c83543e4d3382d96865ff"},{"version":"080d2316ae4700d08af27b08d91f52c0654838e3accf412db2907bd65b33007e","signature":"b483a056dc804e003c84649170ec937784561dc4300d25d9bce2cd8c055af419"},{"version":"cde445f39cdec3f697751fd4ab0476fe832132ac09b4760c0357f267e86c277b","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"}],"root":[60,[71,73]],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":99,"outDir":"./types","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"referencedMap":[[71,1],[72,2],[73,3],[69,4],[65,5],[67,6]],"latestChangedDtsFile":"./types/register.d.ts","version":"6.0.3"}
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* @attr {boolean} disabled - Whether the button is disabled
|
|
12
12
|
* @attr {string} type - Button type: button, submit, reset
|
|
13
13
|
* @attr {boolean} loading - Whether the button is in loading state
|
|
14
|
+
* @attr {string} aria-label - Accessible name for the native button
|
|
15
|
+
* @attr {string} aria-labelledby - IDs of elements naming the button in the host's DOM tree
|
|
14
16
|
*
|
|
15
17
|
* @slot - Default slot for button content
|
|
16
18
|
* @slot prefix - Content before the main text
|
|
@@ -27,6 +29,7 @@ import { BaseElement } from '@duskmoon-dev/el-base';
|
|
|
27
29
|
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'outline' | 'success' | 'warning' | 'error' | 'info';
|
|
28
30
|
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
29
31
|
export declare class ElDmButton extends BaseElement {
|
|
32
|
+
static get observedAttributes(): string[];
|
|
30
33
|
static properties: {
|
|
31
34
|
variant: {
|
|
32
35
|
type: StringConstructor;
|
|
@@ -60,6 +63,7 @@ export declare class ElDmButton extends BaseElement {
|
|
|
60
63
|
type: 'button' | 'submit' | 'reset';
|
|
61
64
|
/** Whether the button is in loading state */
|
|
62
65
|
loading: boolean;
|
|
66
|
+
private _labelObserver?;
|
|
63
67
|
constructor();
|
|
64
68
|
/**
|
|
65
69
|
* Handle click events
|
|
@@ -67,6 +71,11 @@ export declare class ElDmButton extends BaseElement {
|
|
|
67
71
|
private _handleClick;
|
|
68
72
|
private _getAssociatedForm;
|
|
69
73
|
connectedCallback(): void;
|
|
74
|
+
disconnectedCallback(): void;
|
|
75
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
76
|
+
protected update(): void;
|
|
77
|
+
private _observeLabels;
|
|
78
|
+
private _syncLabel;
|
|
70
79
|
/**
|
|
71
80
|
* Build CSS class string for the button
|
|
72
81
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"el-dm-button.d.ts","sourceRoot":"","sources":["../../src/el-dm-button.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"el-dm-button.d.ts","sourceRoot":"","sources":["../../src/el-dm-button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,WAAW,EAAO,MAAM,uBAAuB,CAAC;AAyBzD,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,WAAW,GACX,UAAU,GACV,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,MAAM,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAmCnD,qBAAa,UAAW,SAAQ,WAAW;IACzC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,MAAM,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;MAMf;IAEF,qBAAqB;IACb,OAAO,EAAE,aAAa,CAAC;IAE/B,kBAAkB;IACV,IAAI,EAAE,UAAU,CAAC;IAEzB,qCAAqC;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAE1B,0CAA0C;IAClC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IAE5C,6CAA6C;IACrC,OAAO,EAAE,OAAO,CAAC;IAEzB,OAAO,CAAC,cAAc,CAAC,CAAmB;;IAO1C;;OAEG;IACH,OAAO,CAAC,YAAY;IA4CpB,OAAO,CAAC,kBAAkB;IAU1B,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAK5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAS9F,SAAS,CAAC,MAAM,IAAI,IAAI;IAKxB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,UAAU;IAyBlB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoBzB,MAAM,IAAI,MAAM;CAoBjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duskmoon-dev/el-button",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"release:dry-run": "bun publish --dry-run"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@duskmoon-dev/el-base": "1.9.
|
|
42
|
+
"@duskmoon-dev/el-base": "1.9.2",
|
|
43
43
|
"@duskmoon-dev/core": "1.20.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|