@nvidia-elements/forms 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/custom-elements.json +86 -2
- package/dist/index.js +1 -1
- package/dist/internal/controllers/state-active.controller.d.ts +1 -1
- package/dist/internal/controllers/state-current.controller.d.ts +1 -1
- package/dist/internal/controllers/state-disabled.controller.d.ts +1 -1
- package/dist/internal/controllers/state-expanded.controller.d.ts +1 -1
- package/dist/internal/controllers/state-pressed.controller.d.ts +1 -1
- package/dist/internal/controllers/state-readonly.controller.d.ts +1 -1
- package/dist/internal/controllers/state-selected.controller.d.ts +1 -1
- package/dist/internal/controllers/type-anchor.controller.d.ts +1 -1
- package/dist/internal/controllers/type-anchor.controller.js.map +1 -1
- package/dist/internal/controllers/type-button.controller.d.ts +1 -1
- package/dist/internal/controllers/type-command.controller.d.ts +5 -2
- package/dist/internal/controllers/type-command.controller.js +10 -9
- package/dist/internal/controllers/type-command.controller.js.map +1 -1
- package/dist/internal/controllers/type-interest-invoker.controller.d.ts +1 -1
- package/dist/internal/controllers/type-interest-invoker.controller.js +32 -21
- package/dist/internal/controllers/type-interest-invoker.controller.js.map +1 -1
- package/dist/internal/controllers/type-popover-trigger.controller.d.ts +2 -3
- package/dist/internal/controllers/type-popover-trigger.controller.js +2 -2
- package/dist/internal/controllers/type-popover-trigger.controller.js.map +1 -1
- package/dist/internal/controllers/type-submit.controller.d.ts +2 -2
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +2 -0
- package/dist/internal/schema.d.ts +1 -1
- package/dist/internal/schema.js +1 -1
- package/dist/internal/schema.js.map +1 -1
- package/dist/internal/utils.js.map +1 -1
- package/dist/mixins/button.d.ts +1 -1
- package/dist/mixins/button.js +133 -143
- package/dist/mixins/button.js.map +1 -1
- package/dist/mixins/button.types.d.ts +1 -6
- package/dist/mixins/checkbox.d.ts +2 -2
- package/dist/mixins/control.d.ts +1 -1
- package/dist/mixins/control.js.map +1 -1
- package/dist/mixins/select.d.ts +2 -2
- package/dist/mixins/select.js.map +1 -1
- package/dist/mixins/slider.d.ts +2 -2
- package/dist/mixins/slider.js.map +1 -1
- package/dist/validators/index.d.ts +1 -1
- package/package.json +16 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../src/internal/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function isObjectLiteral(item: unknown) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) {\n return false;\n }\n const proto = Object.getPrototypeOf(item);\n return proto === null || proto === Object.prototype;\n}\n\nexport function attachInternals(element: HTMLElement & { _internals?: ElementInternals }) {\n if (element._internals === undefined) {\n element._internals = element.attachInternals() as unknown as ElementInternals;\n }\n\n return element._internals;\n}\n\nexport function toggleState(internals: ElementInternals, state: string, force: boolean) {\n if (force) {\n internals.states.add(state);\n } else {\n internals.states.delete(state);\n }\n}\n\nexport type PopoverAnchorElement = HTMLElement & { anchor?: HTMLElement | string; _activeTrigger?: HTMLElement };\n\nexport function getFlattenedDOMTree(node: Node, depth = 10): HTMLElement[] {\n return (\n Array.from(getChildren(node)).reduce(\n (p: unknown[], n: Node) => [\n ...p,\n [n, [...Array.from(getChildren(n)).map(i => [i, getFlattenedDOMTree(i, depth)])]]\n ],\n []\n ) as unknown as HTMLElement[]\n ).flat(depth);\n}\n\nexport function getHostAnchor(host: PopoverAnchorElement) {\n const anchor = host.anchor ?? host._activeTrigger;\n\n if (typeof anchor === 'string' && anchor.length) {\n if (!host.parentNode) {\n return globalThis.document.body;\n }\n\n return (\n getFlattenedDOMTree(host.parentNode as Node).find(element => element.id === anchor) ?? globalThis.document.body\n );\n }\n\n if (anchor instanceof HTMLElement && anchor !== globalThis.document.body) {\n return anchor;\n }\n\n return globalThis.document.body;\n}\n\nexport function getStringValue(value: unknown) {\n if (typeof value === 'string' && value.length) {\n return value;\n }\n\n return value === '' ? '' : null;\n}\n\nexport function hasAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n return value === null ? !element.hasAttribute(attribute) : element.getAttribute(attribute) === value;\n}\n\nexport function isFormElement(value: unknown): value is HTMLFormElement {\n return typeof HTMLFormElement !== 'undefined' && value instanceof HTMLFormElement;\n}\n\nexport function onKeys(events: string[], event: KeyboardEvent, callback: () => void) {\n if (events.includes(event.code)) {\n callback();\n }\n}\n\nexport function removeEmptyTextNode(node: Node) {\n if ((node as Text)?.wholeText?.trim() === '') {\n node.parentNode?.removeChild(node);\n }\n}\n\nexport function setAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(attribute);\n } else {\n element.setAttribute(attribute, value);\n }\n}\n\nexport function stopEvent(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nfunction getChildren(node: Node): Element[] {\n if (isDocumentNode(node)) {\n return Array.from(node.documentElement.children);\n }\n\n if (isElementWithShadowRoot(node)) {\n return Array.from(node.shadowRoot.children);\n }\n\n if (isSlotElement(node)) {\n const slotted = node.assignedElements();\n return slotted.length ? slotted : Array.from(node.children);\n }\n\n return Array.from((node as HTMLElement).children ?? []);\n}\n\nfunction isDocumentNode(node: Node): node is Document {\n return typeof Document !== 'undefined' && node instanceof Document && Boolean(node.documentElement);\n}\n\nfunction isElementWithShadowRoot(node: Node): node is HTMLElement & { shadowRoot: ShadowRoot } {\n return typeof HTMLElement !== 'undefined' && node instanceof HTMLElement && Boolean(node.shadowRoot);\n}\n\nfunction isSlotElement(node: Node): node is HTMLSlotElement {\n return typeof HTMLSlotElement !== 'undefined' && node instanceof HTMLSlotElement && Boolean(node.assignedElements);\n}\n"],"mappings":";AAGA,SAAgB,EAAgB,GAAe;CAC7C,IAAI,CAAC,KAAQ,OAAO,KAAS,YAAY,MAAM,QAAQ,CAAI,GACzD,OAAO;CAET,IAAM,IAAQ,OAAO,eAAe,CAAI;CACxC,OAAO,MAAU,QAAQ,MAAU,OAAO;AAC5C;AAEA,SAAgB,EAAgB,GAA0D;CAKxF,OAJI,EAAQ,eAAe,KAAA,MACzB,EAAQ,aAAa,EAAQ,gBAAgB,IAGxC,EAAQ;AACjB;AAEA,SAAgB,EAAY,GAA6B,GAAe,GAAgB;CACtF,AAAI,IACF,EAAU,OAAO,IAAI,CAAK,IAE1B,EAAU,OAAO,OAAO,CAAK;AAEjC;AAIA,SAAgB,EAAoB,GAAY,IAAQ,IAAmB;CACzE,OACE,MAAM,KAAK,EAAY,CAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/internal/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function isObjectLiteral(item: unknown) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) {\n return false;\n }\n const proto = Object.getPrototypeOf(item);\n return proto === null || proto === Object.prototype;\n}\n\nexport function attachInternals(element: HTMLElement & { _internals?: ElementInternals }) {\n if (element._internals === undefined) {\n element._internals = element.attachInternals() as unknown as ElementInternals;\n }\n\n return element._internals;\n}\n\nexport function toggleState(internals: ElementInternals, state: string, force: boolean) {\n if (force) {\n internals.states.add(state);\n } else {\n internals.states.delete(state);\n }\n}\n\nexport type PopoverAnchorElement = HTMLElement & { anchor?: HTMLElement | string; _activeTrigger?: HTMLElement };\n\nexport function getFlattenedDOMTree(node: Node, depth = 10): HTMLElement[] {\n return (\n Array.from(getChildren(node)).reduce(\n (p: unknown[], n: Node) => [\n ...p,\n [n, [...Array.from(getChildren(n)).map(i => [i, getFlattenedDOMTree(i, depth)])]]\n ],\n []\n ) as unknown as HTMLElement[]\n ).flat(depth);\n}\n\nexport function getHostAnchor(host: PopoverAnchorElement) {\n const anchor = host.anchor ?? host._activeTrigger;\n\n if (typeof anchor === 'string' && anchor.length) {\n if (!host.parentNode) {\n return globalThis.document.body;\n }\n\n return (\n getFlattenedDOMTree(host.parentNode as Node).find(element => element.id === anchor) ?? globalThis.document.body\n );\n }\n\n if (anchor instanceof HTMLElement && anchor !== globalThis.document.body) {\n return anchor;\n }\n\n return globalThis.document.body;\n}\n\nexport function getStringValue(value: unknown) {\n if (typeof value === 'string' && value.length) {\n return value;\n }\n\n return value === '' ? '' : null;\n}\n\nexport function hasAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n return value === null ? !element.hasAttribute(attribute) : element.getAttribute(attribute) === value;\n}\n\nexport function isFormElement(value: unknown): value is HTMLFormElement {\n return typeof HTMLFormElement !== 'undefined' && value instanceof HTMLFormElement;\n}\n\nexport function onKeys(events: string[], event: KeyboardEvent, callback: () => void) {\n if (events.includes(event.code)) {\n callback();\n }\n}\n\nexport function removeEmptyTextNode(node: Node) {\n if ((node as Text)?.wholeText?.trim() === '') {\n node.parentNode?.removeChild(node);\n }\n}\n\nexport function setAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(attribute);\n } else {\n element.setAttribute(attribute, value);\n }\n}\n\nexport function stopEvent(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nfunction getChildren(node: Node): Element[] {\n if (isDocumentNode(node)) {\n return Array.from(node.documentElement.children);\n }\n\n if (isElementWithShadowRoot(node)) {\n return Array.from(node.shadowRoot.children);\n }\n\n if (isSlotElement(node)) {\n const slotted = node.assignedElements();\n return slotted.length ? slotted : Array.from(node.children);\n }\n\n return Array.from((node as HTMLElement).children ?? []);\n}\n\nfunction isDocumentNode(node: Node): node is Document {\n return typeof Document !== 'undefined' && node instanceof Document && Boolean(node.documentElement);\n}\n\nfunction isElementWithShadowRoot(node: Node): node is HTMLElement & { shadowRoot: ShadowRoot } {\n return typeof HTMLElement !== 'undefined' && node instanceof HTMLElement && Boolean(node.shadowRoot);\n}\n\nfunction isSlotElement(node: Node): node is HTMLSlotElement {\n return typeof HTMLSl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 @@
|
|
|
1
|
-
import { ButtonFormControlMixinInstance } from './button.types.js';
|
|
1
|
+
import type { ButtonFormControlMixinInstance } from './button.types.js';
|
|
2
2
|
export type { ButtonFormControlMixinInstance, ButtonType, CurrentState, PopoverTargetAction } from './button.types.js';
|
|
3
3
|
interface ButtonFormControlHost {
|
|
4
4
|
connectedCallback?(): void;
|
package/dist/mixins/button.js
CHANGED
|
@@ -1,22 +1,31 @@
|
|
|
1
|
-
import { attachInternals as e,
|
|
2
|
-
import { TypeAnchorController as
|
|
3
|
-
import { TypeButtonController as
|
|
4
|
-
import { TypeCommandController as
|
|
5
|
-
import { TypeInterestInvokerController as
|
|
6
|
-
import { TypeSubmitController as
|
|
7
|
-
import { TypePopoverTriggerController as
|
|
8
|
-
import { StateActiveController as
|
|
9
|
-
import { StateCurrentController as
|
|
10
|
-
import { StateDisabledController as
|
|
11
|
-
import { StateExpandedController as
|
|
12
|
-
import { StatePressedController as
|
|
13
|
-
import { StateReadOnlyController as
|
|
14
|
-
import { StateSelectedController as
|
|
1
|
+
import { attachInternals as e, getFlattenedDOMTree as t, getStringValue as n, hasAttributeValue as r, isFormElement as i, setAttributeValue as a } from "../internal/utils.js";
|
|
2
|
+
import { TypeAnchorController as o } from "../internal/controllers/type-anchor.controller.js";
|
|
3
|
+
import { TypeButtonController as s } from "../internal/controllers/type-button.controller.js";
|
|
4
|
+
import { TypeCommandController as c } from "../internal/controllers/type-command.controller.js";
|
|
5
|
+
import { TypeInterestInvokerController as l } from "../internal/controllers/type-interest-invoker.controller.js";
|
|
6
|
+
import { TypeSubmitController as u } from "../internal/controllers/type-submit.controller.js";
|
|
7
|
+
import { TypePopoverTriggerController as d } from "../internal/controllers/type-popover-trigger.controller.js";
|
|
8
|
+
import { StateActiveController as f } from "../internal/controllers/state-active.controller.js";
|
|
9
|
+
import { StateCurrentController as p } from "../internal/controllers/state-current.controller.js";
|
|
10
|
+
import { StateDisabledController as m } from "../internal/controllers/state-disabled.controller.js";
|
|
11
|
+
import { StateExpandedController as h } from "../internal/controllers/state-expanded.controller.js";
|
|
12
|
+
import { StatePressedController as g } from "../internal/controllers/state-pressed.controller.js";
|
|
13
|
+
import { StateReadOnlyController as _ } from "../internal/controllers/state-readonly.controller.js";
|
|
14
|
+
import { StateSelectedController as v } from "../internal/controllers/state-selected.controller.js";
|
|
15
15
|
//#region src/mixins/button.ts
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
var y = {
|
|
17
|
+
commandfor: "commandForElement",
|
|
18
|
+
interestfor: "interestForElement",
|
|
19
|
+
popovertarget: "popoverTargetElement"
|
|
20
|
+
};
|
|
21
|
+
function b(b) {
|
|
22
|
+
return class x extends b {
|
|
18
23
|
constructor(...t) {
|
|
19
|
-
super(...t), this.#
|
|
24
|
+
super(...t), this.#n = !1, this.#r = {
|
|
25
|
+
commandForElement: null,
|
|
26
|
+
interestForElement: null,
|
|
27
|
+
popoverTargetElement: null
|
|
28
|
+
}, this.#a = null, this.#o = !1, this.#c = /* @__PURE__ */ new Map(), this.#d = !1, this.#p = !1, this._internals = e(this), this._typeAnchorController = new o(this), this._typeButtonController = new s(this), this._typeSubmitController = new u(this), this._typeCommandController = new c(this), this._typeInterestInvokerController = new l(this), this._typePopoverTriggerController = new d(this), this._stateActiveController = new f(this), this._stateDisabledController = new m(this), this._stateExpandedController = new h(this), this._statePressedController = new g(this), this._stateSelectedController = new v(this), this._stateCurrentController = new p(this), this._stateReadOnlyController = new _(this);
|
|
20
29
|
}
|
|
21
30
|
static {
|
|
22
31
|
this.formAssociated = !0;
|
|
@@ -37,11 +46,6 @@ function v(v) {
|
|
|
37
46
|
#p;
|
|
38
47
|
#m;
|
|
39
48
|
#h;
|
|
40
|
-
#g;
|
|
41
|
-
#_;
|
|
42
|
-
#v;
|
|
43
|
-
#y;
|
|
44
|
-
#b;
|
|
45
49
|
static get observedAttributes() {
|
|
46
50
|
return (super.observedAttributes ?? []).concat([
|
|
47
51
|
"pressed",
|
|
@@ -62,30 +66,30 @@ function v(v) {
|
|
|
62
66
|
]);
|
|
63
67
|
}
|
|
64
68
|
get pressed() {
|
|
65
|
-
return this.#
|
|
69
|
+
return this.#u;
|
|
66
70
|
}
|
|
67
71
|
set pressed(e) {
|
|
68
|
-
this.#
|
|
72
|
+
this.#w({
|
|
69
73
|
property: "pressed",
|
|
70
74
|
value: !!e,
|
|
71
75
|
reflect: !0
|
|
72
76
|
});
|
|
73
77
|
}
|
|
74
78
|
get expanded() {
|
|
75
|
-
return this.#
|
|
79
|
+
return this.#i;
|
|
76
80
|
}
|
|
77
81
|
set expanded(e) {
|
|
78
|
-
this.#
|
|
82
|
+
this.#w({
|
|
79
83
|
property: "expanded",
|
|
80
84
|
value: !!e,
|
|
81
85
|
reflect: !0
|
|
82
86
|
});
|
|
83
87
|
}
|
|
84
88
|
get readOnly() {
|
|
85
|
-
return this.#
|
|
89
|
+
return this.#d || !!this._typeAnchorController?.readOnly;
|
|
86
90
|
}
|
|
87
91
|
set readOnly(e) {
|
|
88
|
-
this.#
|
|
92
|
+
this.#w({
|
|
89
93
|
property: "readOnly",
|
|
90
94
|
value: !!e,
|
|
91
95
|
reflect: !0,
|
|
@@ -100,245 +104,231 @@ function v(v) {
|
|
|
100
104
|
}
|
|
101
105
|
set form(e) {
|
|
102
106
|
let t = this.form;
|
|
103
|
-
this.#
|
|
107
|
+
this.#a = e, typeof e == "string" ? this.setAttribute("form", e) : this.removeAttribute("form"), this.#j("form", t), this.#g();
|
|
104
108
|
}
|
|
105
109
|
get form() {
|
|
106
|
-
if (this.#
|
|
107
|
-
if (typeof this.#
|
|
108
|
-
let e = this.getRootNode(), t = e.getElementById ? e.getElementById(this.#
|
|
109
|
-
return
|
|
110
|
+
if (this.#a && typeof this.#a != "string") return this.#a;
|
|
111
|
+
if (typeof this.#a == "string" && globalThis.document !== void 0) {
|
|
112
|
+
let e = this.getRootNode(), t = e.getElementById ? e.getElementById(this.#a) : null;
|
|
113
|
+
return i(t) ? t : null;
|
|
110
114
|
}
|
|
111
115
|
return this._internals?.form ?? null;
|
|
112
116
|
}
|
|
113
117
|
get name() {
|
|
114
|
-
return this.#
|
|
118
|
+
return this.#s;
|
|
115
119
|
}
|
|
116
120
|
set name(e) {
|
|
117
|
-
this.#
|
|
121
|
+
this.#D({
|
|
118
122
|
property: "name",
|
|
119
123
|
value: e
|
|
120
124
|
});
|
|
121
125
|
}
|
|
122
126
|
get value() {
|
|
123
|
-
return this.#
|
|
127
|
+
return this.#h;
|
|
124
128
|
}
|
|
125
129
|
set value(e) {
|
|
126
|
-
this.#
|
|
130
|
+
this.#D({
|
|
127
131
|
property: "value",
|
|
128
132
|
value: e
|
|
129
133
|
});
|
|
130
134
|
}
|
|
131
135
|
get type() {
|
|
132
|
-
return this.#
|
|
136
|
+
return this.#m ?? this._typeSubmitController?.defaultType;
|
|
133
137
|
}
|
|
134
138
|
set type(e) {
|
|
135
|
-
this.#
|
|
139
|
+
this.#D({
|
|
136
140
|
property: "type",
|
|
137
141
|
value: e
|
|
138
142
|
});
|
|
139
143
|
}
|
|
140
144
|
get disabled() {
|
|
141
|
-
return this.#
|
|
145
|
+
return this.#n;
|
|
142
146
|
}
|
|
143
147
|
set disabled(e) {
|
|
144
|
-
this.#
|
|
148
|
+
this.#w({
|
|
145
149
|
property: "disabled",
|
|
146
150
|
value: !!e,
|
|
147
151
|
reflect: !0
|
|
148
152
|
});
|
|
149
153
|
}
|
|
150
154
|
get selected() {
|
|
151
|
-
return this.#
|
|
155
|
+
return this.#f;
|
|
152
156
|
}
|
|
153
157
|
set selected(e) {
|
|
154
|
-
this.#
|
|
158
|
+
this.#w({
|
|
155
159
|
property: "selected",
|
|
156
160
|
value: !!e,
|
|
157
161
|
reflect: !0
|
|
158
162
|
});
|
|
159
163
|
}
|
|
160
164
|
get current() {
|
|
161
|
-
return this.#
|
|
165
|
+
return this.#t;
|
|
162
166
|
}
|
|
163
167
|
set current(e) {
|
|
164
|
-
this.#
|
|
168
|
+
this.#D({
|
|
165
169
|
property: "current",
|
|
166
170
|
value: e
|
|
167
171
|
});
|
|
168
172
|
}
|
|
169
173
|
get popoverTargetElement() {
|
|
170
|
-
return this.#
|
|
174
|
+
return this.#x("popovertarget");
|
|
171
175
|
}
|
|
172
176
|
set popoverTargetElement(e) {
|
|
173
|
-
|
|
174
|
-
this.#p = e, this.#M("popoverTargetElement", t), this.#x();
|
|
175
|
-
}
|
|
176
|
-
get popovertarget() {
|
|
177
|
-
return this.#m;
|
|
178
|
-
}
|
|
179
|
-
set popovertarget(e) {
|
|
180
|
-
this.#O({
|
|
181
|
-
property: "popovertarget",
|
|
182
|
-
value: e
|
|
183
|
-
});
|
|
177
|
+
this.#C("popovertarget", e);
|
|
184
178
|
}
|
|
185
179
|
get popoverTargetAction() {
|
|
186
|
-
return this.#
|
|
180
|
+
return this.#l === "show" || this.#l === "hide" ? this.#l : "toggle";
|
|
187
181
|
}
|
|
188
182
|
set popoverTargetAction(e) {
|
|
189
|
-
this.#
|
|
183
|
+
this.#D({
|
|
190
184
|
property: "popoverTargetAction",
|
|
191
185
|
value: e,
|
|
192
186
|
attribute: "popovertargetaction"
|
|
193
187
|
});
|
|
194
188
|
}
|
|
195
189
|
get commandForElement() {
|
|
196
|
-
return this.#
|
|
190
|
+
return this.#x("commandfor");
|
|
197
191
|
}
|
|
198
192
|
set commandForElement(e) {
|
|
199
|
-
|
|
200
|
-
this.#t = e, this.#M("commandForElement", t), this.#x();
|
|
201
|
-
}
|
|
202
|
-
get commandfor() {
|
|
203
|
-
return this.#n;
|
|
204
|
-
}
|
|
205
|
-
set commandfor(e) {
|
|
206
|
-
this.#O({
|
|
207
|
-
property: "commandfor",
|
|
208
|
-
value: e
|
|
209
|
-
});
|
|
193
|
+
this.#C("commandfor", e);
|
|
210
194
|
}
|
|
211
195
|
get command() {
|
|
212
196
|
return this.#e;
|
|
213
197
|
}
|
|
214
198
|
set command(e) {
|
|
215
|
-
this.#
|
|
199
|
+
this.#D({
|
|
216
200
|
property: "command",
|
|
217
201
|
value: e
|
|
218
202
|
});
|
|
219
203
|
}
|
|
220
204
|
get interestForElement() {
|
|
221
|
-
return this.#
|
|
205
|
+
return this.#x("interestfor");
|
|
222
206
|
}
|
|
223
207
|
set interestForElement(e) {
|
|
224
|
-
|
|
225
|
-
this.#c = e, this.#M("interestForElement", t), this.#x();
|
|
226
|
-
}
|
|
227
|
-
get interestfor() {
|
|
228
|
-
return this.#l;
|
|
229
|
-
}
|
|
230
|
-
set interestfor(e) {
|
|
231
|
-
this.#O({
|
|
232
|
-
property: "interestfor",
|
|
233
|
-
value: e
|
|
234
|
-
});
|
|
208
|
+
this.#C("interestfor", e);
|
|
235
209
|
}
|
|
236
210
|
addController(e) {
|
|
237
211
|
this._controllers ??= /* @__PURE__ */ new Set(), this._controllers.add(e);
|
|
238
212
|
}
|
|
239
213
|
connectedCallback() {
|
|
240
|
-
super.connectedCallback?.(), this._controllers?.forEach((e) => e.hostConnected?.()), e(this), this.#
|
|
214
|
+
super.connectedCallback?.(), this._controllers?.forEach((e) => e.hostConnected?.()), e(this), this.#o = !0, this.#N(), this.#_(), this.#g();
|
|
241
215
|
}
|
|
242
216
|
disconnectedCallback() {
|
|
243
217
|
this._controllers?.forEach((e) => e.hostDisconnected?.()), super.disconnectedCallback?.();
|
|
244
218
|
}
|
|
245
219
|
updated(e) {
|
|
246
|
-
Object.getPrototypeOf(
|
|
220
|
+
Object.getPrototypeOf(x.prototype).updated?.call(this, e), this.#p = !1, this.#_();
|
|
247
221
|
}
|
|
248
222
|
attributeChangedCallback(e, t, n) {
|
|
249
|
-
super.attributeChangedCallback?.(e, t, n), t !== n && (this.#
|
|
223
|
+
super.attributeChangedCallback?.(e, t, n), t !== n && (this.#v(e, n), this.#b(e, t), this.#y(e, t, n));
|
|
250
224
|
}
|
|
251
|
-
#
|
|
252
|
-
!this.isConnected || this.#
|
|
253
|
-
this.#
|
|
225
|
+
#g() {
|
|
226
|
+
!this.isConnected || this.#p || (this.#p = !0, this.#M().then(() => {
|
|
227
|
+
this.#p && (this.#p = !1, this.isConnected && this.#_());
|
|
254
228
|
}));
|
|
255
229
|
}
|
|
256
|
-
#
|
|
230
|
+
#_() {
|
|
257
231
|
this._controllers?.forEach((e) => e.hostUpdated?.());
|
|
258
232
|
}
|
|
259
|
-
#
|
|
260
|
-
(e === "pressed" || e === "expanded" || e === "selected" || e === "disabled") && this.#
|
|
233
|
+
#v(e, t) {
|
|
234
|
+
(e === "pressed" || e === "expanded" || e === "selected" || e === "disabled") && this.#w({
|
|
261
235
|
property: e,
|
|
262
236
|
value: t !== null,
|
|
263
237
|
reflect: !1
|
|
264
|
-
}), e === "readonly" && this.#
|
|
238
|
+
}), e === "readonly" && this.#w({
|
|
265
239
|
property: "readOnly",
|
|
266
240
|
value: t !== null,
|
|
267
241
|
reflect: !1
|
|
268
242
|
});
|
|
269
243
|
}
|
|
270
|
-
#
|
|
271
|
-
e === "
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
244
|
+
#y(e, t, n) {
|
|
245
|
+
if (!(e === "commandfor" || e === "interestfor" || e === "popovertarget")) {
|
|
246
|
+
if (e === "form" && (i(this.#a) && n === null || (this.#a = n, this.#j("form", t))), e === "popovertargetaction") {
|
|
247
|
+
this.#D({
|
|
248
|
+
property: "popoverTargetAction",
|
|
249
|
+
value: n,
|
|
250
|
+
reflect: !1
|
|
251
|
+
});
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
this.#D({
|
|
255
|
+
property: e,
|
|
256
|
+
value: n,
|
|
257
|
+
reflect: !1
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
#b(e, t) {
|
|
262
|
+
let n = y[e];
|
|
263
|
+
if (!n) return;
|
|
264
|
+
let r = this.#r[n] ?? this.#S(t);
|
|
265
|
+
this.#r[n] = null, this.#j(n, r), this.#g();
|
|
280
266
|
}
|
|
281
|
-
#
|
|
282
|
-
|
|
283
|
-
a === t && (!r || n(this, i, t ? "" : null)) || (this.#D(e, t), !(r && this.#j(i, t ? "" : null)) && (this.#M(e, a), this.#x()));
|
|
267
|
+
#x(e) {
|
|
268
|
+
return this.#r[y[e]] ?? this.#S(this.getAttribute(e));
|
|
284
269
|
}
|
|
285
|
-
#
|
|
270
|
+
#S(e) {
|
|
271
|
+
return e ? t(this.getRootNode()).find((t) => t.id === e) ?? null : null;
|
|
272
|
+
}
|
|
273
|
+
#C(e, t) {
|
|
274
|
+
let n = y[e], i = this[n];
|
|
275
|
+
i === t && r(this, e, t ? "" : null) || (a(this, e, t ? "" : null), this.#r[n] = t, this.#j(n, i), this.#g());
|
|
276
|
+
}
|
|
277
|
+
#w({ property: e, value: t, reflect: n, attribute: i = e }) {
|
|
278
|
+
let a = this.#T(e);
|
|
279
|
+
a === t && (!n || r(this, i, t ? "" : null)) || (this.#E(e, t), !(n && this.#A(i, t ? "" : null)) && (this.#j(e, a), this.#g()));
|
|
280
|
+
}
|
|
281
|
+
#T(e) {
|
|
286
282
|
return {
|
|
287
|
-
disabled: this.#
|
|
288
|
-
expanded: this.#
|
|
289
|
-
pressed: this.#
|
|
290
|
-
readOnly: this.#
|
|
291
|
-
selected: this.#
|
|
283
|
+
disabled: this.#n,
|
|
284
|
+
expanded: this.#i,
|
|
285
|
+
pressed: this.#u,
|
|
286
|
+
readOnly: this.#d,
|
|
287
|
+
selected: this.#f
|
|
292
288
|
}[e];
|
|
293
289
|
}
|
|
294
|
-
#
|
|
295
|
-
e === "disabled" ? this.#
|
|
290
|
+
#E(e, t) {
|
|
291
|
+
e === "disabled" ? this.#n = t : e === "expanded" ? this.#i = t : e === "pressed" ? this.#u = t : e === "readOnly" ? this.#d = t : e === "selected" && (this.#f = t);
|
|
296
292
|
}
|
|
297
|
-
#
|
|
298
|
-
let o = this.#
|
|
299
|
-
o === s && (!a ||
|
|
293
|
+
#D({ property: e, value: t, attribute: i = e, reflect: a = !0 }) {
|
|
294
|
+
let o = this.#O(e), s = n(t);
|
|
295
|
+
o === s && (!a || r(this, i, s)) || (this.#k(e, s), !(a && this.#A(i, s)) && (this.#j(e, o), this.#g()));
|
|
300
296
|
}
|
|
301
|
-
#
|
|
297
|
+
#O(e) {
|
|
302
298
|
return {
|
|
303
299
|
command: this.#e,
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
popovertarget: this.#m,
|
|
310
|
-
type: this.#y,
|
|
311
|
-
value: this.#b
|
|
300
|
+
current: this.#t,
|
|
301
|
+
name: this.#s,
|
|
302
|
+
popoverTargetAction: this.#l,
|
|
303
|
+
type: this.#m,
|
|
304
|
+
value: this.#h
|
|
312
305
|
}[e];
|
|
313
306
|
}
|
|
314
|
-
#
|
|
307
|
+
#k(e, t) {
|
|
315
308
|
({
|
|
316
309
|
command: () => this.#e = t ?? void 0,
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
popovertarget: () => this.#m = t ?? void 0,
|
|
323
|
-
type: () => this.#y = t,
|
|
324
|
-
value: () => this.#b = t ?? void 0
|
|
310
|
+
current: () => this.#t = t,
|
|
311
|
+
name: () => this.#s = t ?? void 0,
|
|
312
|
+
popoverTargetAction: () => this.#l = t,
|
|
313
|
+
type: () => this.#m = t,
|
|
314
|
+
value: () => this.#h = t ?? void 0
|
|
325
315
|
})[e]?.();
|
|
326
316
|
}
|
|
327
|
-
#
|
|
328
|
-
return !this.isConnected && !this.#
|
|
317
|
+
#A(e, t) {
|
|
318
|
+
return !this.isConnected && !this.#o ? (this.hasAttribute(e) || this.#c.set(e, t), !0) : (a(this, e, t), !1);
|
|
329
319
|
}
|
|
330
|
-
#
|
|
320
|
+
#j(e, t) {
|
|
331
321
|
this.requestUpdate?.(e, t);
|
|
332
322
|
}
|
|
333
|
-
#
|
|
323
|
+
#M() {
|
|
334
324
|
return this.updateComplete ?? Promise.resolve();
|
|
335
325
|
}
|
|
336
|
-
#
|
|
337
|
-
this.#
|
|
326
|
+
#N() {
|
|
327
|
+
this.#c.forEach((e, t) => a(this, t, e)), this.#c.clear();
|
|
338
328
|
}
|
|
339
329
|
};
|
|
340
330
|
}
|
|
341
331
|
//#endregion
|
|
342
|
-
export {
|
|
332
|
+
export { b as ButtonFormControlMixin };
|
|
343
333
|
|
|
344
334
|
//# sourceMappingURL=button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["#pressed","#setBooleanState","#expanded","#readOnly","#form","#requestHostUpdate","#queueBehaviorSync","#name","#setStringState","#value","#type","#disabled","#selected","#current","#popoverTargetElement","#popovertarget","#popoverTargetAction","#commandForElement","#commandfor","#command","#interestForElement","#interestfor","#hasConnected","#flushPendingAttributeReflections","#syncBehavior","#syncQueued","#handleBooleanAttributeChange","#handleStringAttributeChange","#getHostUpdateComplete","#getBooleanValue","#setBooleanValue","#reflectAttribute","#getStringValue","#setStringValue","#pendingAttributeReflections"],"sources":["../../src/mixins/button.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { TypeAnchorController } from '../internal/controllers/type-anchor.controller.js';\nimport { TypeButtonController } from '../internal/controllers/type-button.controller.js';\nimport { TypeCommandController } from '../internal/controllers/type-command.controller.js';\nimport { TypeInterestInvokerController } from '../internal/controllers/type-interest-invoker.controller.js';\nimport { TypeSubmitController } from '../internal/controllers/type-submit.controller.js';\nimport { TypePopoverTriggerController } from '../internal/controllers/type-popover-trigger.controller.js';\nimport { StateActiveController } from '../internal/controllers/state-active.controller.js';\nimport { StateCurrentController } from '../internal/controllers/state-current.controller.js';\nimport { StateDisabledController } from '../internal/controllers/state-disabled.controller.js';\nimport { StateExpandedController } from '../internal/controllers/state-expanded.controller.js';\nimport { StatePressedController } from '../internal/controllers/state-pressed.controller.js';\nimport { StateReadOnlyController } from '../internal/controllers/state-readonly.controller.js';\nimport { StateSelectedController } from '../internal/controllers/state-selected.controller.js';\nimport type { ReactiveController } from '../internal/controllers/types.js';\nimport {\n attachInternals,\n getStringValue,\n hasAttributeValue,\n isFormElement,\n setAttributeValue\n} from '../internal/utils.js';\nimport type { ButtonFormControlMixinInstance, ButtonType, CurrentState, PopoverTargetAction } from './button.types.js';\nexport type { ButtonFormControlMixinInstance, ButtonType, CurrentState, PopoverTargetAction } from './button.types.js';\n\ntype ChangedProperties = Map<PropertyKey, unknown>;\ninterface ButtonFormControlHost {\n connectedCallback?(): void;\n disconnectedCallback?(): void;\n attributeChangedCallback?(name: string, oldValue: string | null, newValue: string | null): void;\n requestUpdate?(name?: string, oldValue?: unknown): void;\n updateComplete?: Promise<unknown>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Constructor = (new (...args: any[]) => HTMLElement & ButtonFormControlHost) & { observedAttributes?: string[] };\n\ninterface BooleanStateOptions {\n property: string;\n value: boolean;\n reflect: boolean;\n attribute?: string;\n}\n\ninterface StringStateOptions {\n property: string;\n value: unknown;\n attribute?: string;\n reflect?: boolean;\n}\n\ntype ButtonFormControlConstructor<TBase extends Constructor> = new (\n ...args: ConstructorParameters<TBase>\n) => InstanceType<TBase> & ButtonFormControlMixinInstance;\nexport type ButtonFormControlMixinReturn<TBase extends Constructor> = ButtonFormControlConstructor<TBase> & {\n formAssociated: boolean;\n observedAttributes: string[];\n} & Omit<TBase, 'prototype'>;\n\n/**\n * @description A mixin that adds native button-style form, command, popover, and interaction behavior.\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/button/\n */\nexport function ButtonFormControlMixin<TBase extends Constructor>(\n SuperClass: TBase\n): ButtonFormControlMixinReturn<TBase> {\n return class ButtonFormControlBase extends SuperClass {\n static formAssociated = true;\n\n #command: string | undefined;\n #commandForElement: HTMLElement | null = null;\n #commandfor: string | null = null;\n #current: CurrentState | undefined;\n #disabled = false;\n #expanded: boolean | undefined;\n #form: string | HTMLFormElement | null = null;\n #hasConnected = false;\n #interestForElement: HTMLElement | null = null;\n #interestfor: string | null = null;\n #name: string | undefined;\n #pendingAttributeReflections = new Map<string, string | null>();\n #popoverTargetAction: PopoverTargetAction | undefined;\n #popoverTargetElement: HTMLElement | null = null;\n #popovertarget: string | undefined;\n #pressed: boolean | undefined;\n #readOnly = false;\n #selected: boolean | undefined;\n #syncQueued = false;\n #type: ButtonType | undefined;\n #value: string | undefined;\n\n _internals = attachInternals(this);\n\n static get observedAttributes() {\n return (super.observedAttributes ?? []).concat([\n 'pressed',\n 'expanded',\n 'readonly',\n 'form',\n 'name',\n 'value',\n 'type',\n 'disabled',\n 'selected',\n 'current',\n 'popovertarget',\n 'popovertargetaction',\n 'commandfor',\n 'command',\n 'interestfor'\n ]);\n }\n\n get pressed(): boolean {\n return this.#pressed as boolean;\n }\n\n set pressed(value: boolean | unknown) {\n this.#setBooleanState({ property: 'pressed', value: Boolean(value), reflect: true });\n }\n\n get expanded(): boolean {\n return this.#expanded as boolean;\n }\n\n set expanded(value: boolean | unknown) {\n this.#setBooleanState({ property: 'expanded', value: Boolean(value), reflect: true });\n }\n\n get readOnly(): boolean {\n return this.#readOnly || Boolean(this._typeAnchorController?.readOnly);\n }\n\n set readOnly(value: boolean | unknown) {\n this.#setBooleanState({ property: 'readOnly', value: Boolean(value), reflect: true, attribute: 'readonly' });\n }\n\n get readonly(): boolean {\n return this.readOnly;\n }\n\n set readonly(value: boolean) {\n this.readOnly = value;\n }\n\n set form(form: string | HTMLFormElement | null) {\n const oldValue = this.form;\n this.#form = form;\n if (typeof form === 'string') {\n this.setAttribute('form', form);\n } else {\n this.removeAttribute('form');\n }\n this.#requestHostUpdate('form', oldValue);\n this.#queueBehaviorSync();\n }\n\n get form(): HTMLFormElement | null | string {\n if (this.#form && typeof this.#form !== 'string') {\n return this.#form;\n }\n\n if (typeof this.#form === 'string' && typeof globalThis.document !== 'undefined') {\n const rootNode = this.getRootNode() as Document | ShadowRoot;\n const form = rootNode.getElementById ? rootNode.getElementById(this.#form) : null;\n return isFormElement(form) ? form : null;\n }\n\n return this._internals?.form ?? null;\n }\n\n get name(): string {\n return this.#name as string;\n }\n\n set name(value: string | unknown) {\n this.#setStringState({ property: 'name', value });\n }\n\n get value(): string {\n return this.#value as string;\n }\n\n set value(value: string | unknown) {\n this.#setStringState({ property: 'value', value });\n }\n\n get type(): ButtonType {\n return (this.#type ?? this._typeSubmitController?.defaultType) as ButtonType;\n }\n\n set type(value: ButtonType | unknown) {\n this.#setStringState({ property: 'type', value });\n }\n\n get disabled(): boolean {\n return this.#disabled;\n }\n\n set disabled(value: boolean | unknown) {\n this.#setBooleanState({ property: 'disabled', value: Boolean(value), reflect: true });\n }\n\n get selected(): boolean {\n return this.#selected as boolean;\n }\n\n set selected(value: boolean | unknown) {\n this.#setBooleanState({ property: 'selected', value: Boolean(value), reflect: true });\n }\n\n get current(): CurrentState {\n return this.#current as CurrentState;\n }\n\n set current(value: CurrentState | unknown) {\n this.#setStringState({ property: 'current', value });\n }\n\n get popoverTargetElement(): HTMLElement | null {\n return this.#popoverTargetElement;\n }\n\n set popoverTargetElement(value: HTMLElement | null) {\n const oldValue = this.#popoverTargetElement;\n this.#popoverTargetElement = value;\n this.#requestHostUpdate('popoverTargetElement', oldValue);\n this.#queueBehaviorSync();\n }\n\n get popovertarget(): string {\n return this.#popovertarget as string;\n }\n\n set popovertarget(value: string | unknown) {\n this.#setStringState({ property: 'popovertarget', value });\n }\n\n get popoverTargetAction(): PopoverTargetAction {\n return this.#popoverTargetAction as PopoverTargetAction;\n }\n\n set popoverTargetAction(value: PopoverTargetAction | unknown) {\n this.#setStringState({ property: 'popoverTargetAction', value, attribute: 'popovertargetaction' });\n }\n\n get commandForElement(): HTMLElement | null {\n return this.#commandForElement;\n }\n\n set commandForElement(value: HTMLElement | null) {\n const oldValue = this.#commandForElement;\n this.#commandForElement = value;\n this.#requestHostUpdate('commandForElement', oldValue);\n this.#queueBehaviorSync();\n }\n\n get commandfor(): string | null {\n return this.#commandfor;\n }\n\n set commandfor(value: string | null | unknown) {\n this.#setStringState({ property: 'commandfor', value });\n }\n\n get command(): string {\n return this.#command as string;\n }\n\n set command(value: string | unknown) {\n this.#setStringState({ property: 'command', value });\n }\n\n get interestForElement(): HTMLElement | null {\n return this.#interestForElement;\n }\n\n set interestForElement(value: HTMLElement | null) {\n const oldValue = this.#interestForElement;\n this.#interestForElement = value;\n this.#requestHostUpdate('interestForElement', oldValue);\n this.#queueBehaviorSync();\n }\n\n get interestfor(): string | null {\n return this.#interestfor;\n }\n\n set interestfor(value: string | null | unknown) {\n this.#setStringState({ property: 'interestfor', value });\n }\n\n protected _controllers?: Set<ReactiveController>;\n protected _typeAnchorController = new TypeAnchorController(this);\n protected _typeButtonController = new TypeButtonController(this);\n protected _typeSubmitController = new TypeSubmitController(this);\n protected _typeCommandController = new TypeCommandController(this);\n protected _typeInterestInvokerController = new TypeInterestInvokerController(this);\n protected _typePopoverTriggerController = new TypePopoverTriggerController(this);\n protected _stateActiveController = new StateActiveController(this);\n protected _stateDisabledController = new StateDisabledController(this);\n protected _stateExpandedController = new StateExpandedController(this);\n protected _statePressedController = new StatePressedController(this);\n protected _stateSelectedController = new StateSelectedController(this);\n protected _stateCurrentController = new StateCurrentController(this);\n protected _stateReadOnlyController = new StateReadOnlyController(this);\n\n addController(controller: ReactiveController) {\n this._controllers ??= new Set<ReactiveController>();\n this._controllers.add(controller);\n }\n\n connectedCallback() {\n super.connectedCallback?.();\n this._controllers?.forEach(controller => controller.hostConnected?.());\n attachInternals(this);\n this.#hasConnected = true;\n this.#flushPendingAttributeReflections();\n\n this.#syncBehavior();\n this.#queueBehaviorSync();\n }\n\n disconnectedCallback() {\n this._controllers?.forEach(controller => controller.hostDisconnected?.());\n super.disconnectedCallback?.();\n }\n\n protected updated(changedProperties: ChangedProperties) {\n const superUpdated = Object.getPrototypeOf(ButtonFormControlBase.prototype).updated as\n | ((changedProperties: ChangedProperties) => void)\n | undefined;\n superUpdated?.call(this, changedProperties);\n this.#syncQueued = false;\n this.#syncBehavior();\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n\n if (oldValue === newValue) {\n return;\n }\n\n this.#handleBooleanAttributeChange(name, newValue);\n this.#handleStringAttributeChange(name, oldValue, newValue);\n }\n\n #queueBehaviorSync() {\n if (!this.isConnected || this.#syncQueued) {\n return;\n }\n\n this.#syncQueued = true;\n void this.#getHostUpdateComplete().then(() => {\n if (!this.#syncQueued) return;\n this.#syncQueued = false;\n if (this.isConnected) this.#syncBehavior();\n });\n }\n\n #syncBehavior() {\n this._controllers?.forEach(controller => controller.hostUpdated?.());\n }\n\n #handleBooleanAttributeChange(name: string, newValue: string | null) {\n if (name === 'pressed' || name === 'expanded' || name === 'selected' || name === 'disabled') {\n this.#setBooleanState({ property: name, value: newValue !== null, reflect: false });\n }\n\n if (name === 'readonly') {\n this.#setBooleanState({ property: 'readOnly', value: newValue !== null, reflect: false });\n }\n }\n\n #handleStringAttributeChange(name: string, oldValue: string | null, newValue: string | null) {\n if (name === 'form') {\n if (!(isFormElement(this.#form) && newValue === null)) {\n this.#form = newValue;\n this.#requestHostUpdate('form', oldValue);\n }\n }\n\n if (name === 'popovertargetaction') {\n this.#setStringState({ property: 'popoverTargetAction', value: newValue, reflect: false });\n }\n\n this.#setStringState({ property: name, value: newValue, reflect: false });\n }\n\n #setBooleanState({ property, value, reflect, attribute = property }: BooleanStateOptions) {\n const oldValue = this.#getBooleanValue(property);\n if (oldValue === value && (!reflect || hasAttributeValue(this, attribute, value ? '' : null))) {\n return;\n }\n\n this.#setBooleanValue(property, value);\n if (reflect && this.#reflectAttribute(attribute, value ? '' : null)) {\n return;\n }\n this.#requestHostUpdate(property, oldValue);\n this.#queueBehaviorSync();\n }\n\n #getBooleanValue(property: string) {\n return {\n disabled: this.#disabled,\n expanded: this.#expanded,\n pressed: this.#pressed,\n readOnly: this.#readOnly,\n selected: this.#selected\n }[property];\n }\n\n #setBooleanValue(property: string, value: boolean) {\n if (property === 'disabled') {\n this.#disabled = value;\n } else if (property === 'expanded') {\n this.#expanded = value;\n } else if (property === 'pressed') {\n this.#pressed = value;\n } else if (property === 'readOnly') {\n this.#readOnly = value;\n } else if (property === 'selected') {\n this.#selected = value;\n }\n }\n\n #setStringState({ property, value, attribute = property, reflect = true }: StringStateOptions) {\n const oldValue = this.#getStringValue(property);\n const nextValue = getStringValue(value);\n if (oldValue === nextValue && (!reflect || hasAttributeValue(this, attribute, nextValue))) {\n return;\n }\n\n this.#setStringValue(property, nextValue);\n if (reflect && this.#reflectAttribute(attribute, nextValue)) {\n return;\n }\n this.#requestHostUpdate(property, oldValue);\n this.#queueBehaviorSync();\n }\n\n #getStringValue(property: string) {\n return {\n command: this.#command,\n commandfor: this.#commandfor,\n current: this.#current,\n interestfor: this.#interestfor,\n name: this.#name,\n popoverTargetAction: this.#popoverTargetAction,\n popovertarget: this.#popovertarget,\n type: this.#type,\n value: this.#value\n }[property];\n }\n\n #setStringValue(property: string, value: string | null) {\n const setters: Record<string, () => void> = {\n command: () => (this.#command = value ?? undefined),\n commandfor: () => (this.#commandfor = value),\n current: () => (this.#current = value as CurrentState),\n interestfor: () => (this.#interestfor = value),\n name: () => (this.#name = value ?? undefined),\n popoverTargetAction: () => (this.#popoverTargetAction = value as PopoverTargetAction),\n popovertarget: () => (this.#popovertarget = value ?? undefined),\n type: () => (this.#type = value as ButtonType),\n value: () => (this.#value = value ?? undefined)\n };\n setters[property]?.();\n }\n\n #reflectAttribute(attribute: string, value: string | null) {\n if (!this.isConnected && !this.#hasConnected) {\n if (!this.hasAttribute(attribute)) {\n this.#pendingAttributeReflections.set(attribute, value);\n }\n return true;\n }\n\n setAttributeValue(this, attribute, value);\n return false;\n }\n\n #requestHostUpdate(name?: string, oldValue?: unknown) {\n this.requestUpdate?.(name, oldValue);\n }\n\n #getHostUpdateComplete() {\n return this.updateComplete ?? Promise.resolve();\n }\n\n #flushPendingAttributeReflections() {\n this.#pendingAttributeReflections.forEach((value, attribute) => setAttributeValue(this, attribute, value));\n this.#pendingAttributeReflections.clear();\n }\n } as unknown as ButtonFormControlMixinReturn<TBase>;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiEA,SAAgB,EACd,GACqC;CACrC,OAAO,MAAM,UAA8B,EAAW;;0BAIX,gBACZ,gBAEjB,cAE6B,gBACzB,cAC0B,gBACZ,gCAEC,IAAI,IAA2B,aAElB,gBAGhC,cAEE,sBAID,EAAgB,IAAI,gCA0MC,IAAI,EAAqB,IAAI,gCAC7B,IAAI,EAAqB,IAAI,gCAC7B,IAAI,EAAqB,IAAI,iCAC5B,IAAI,EAAsB,IAAI,yCACtB,IAAI,EAA8B,IAAI,wCACvC,IAAI,EAA6B,IAAI,iCAC5C,IAAI,EAAsB,IAAI,mCAC5B,IAAI,EAAwB,IAAI,mCAChC,IAAI,EAAwB,IAAI,kCACjC,IAAI,EAAuB,IAAI,mCAC9B,IAAI,EAAwB,IAAI,kCACjC,IAAI,EAAuB,IAAI,mCAC9B,IAAI,EAAwB,IAAI;;;yBA9O7C;;EAExB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAIA,WAAW,qBAAqB;GAC9B,QAAQ,MAAM,sBAAsB,CAAC,GAAG,OAAO;IAC7C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF,CAAC;EACH;EAEA,IAAI,UAAmB;GACrB,OAAO,KAAKA;EACd;EAEA,IAAI,QAAQ,GAA0B;GACpC,KAAKC,GAAiB;IAAE,UAAU;IAAW,OAAO,EAAQ;IAAQ,SAAS;GAAK,CAAC;EACrF;EAEA,IAAI,WAAoB;GACtB,OAAO,KAAKC;EACd;EAEA,IAAI,SAAS,GAA0B;GACrC,KAAKD,GAAiB;IAAE,UAAU;IAAY,OAAO,EAAQ;IAAQ,SAAS;GAAK,CAAC;EACtF;EAEA,I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AQ;EACrC;EAEA,KAAyB;GACvB,OAAO,KAAK,kBAAkB,QAAQ,QAAQ;EAChD;EAEA,KAAoC;GAElC,AADA,KAAKA,GAA6B,SAAS,GAAO,MAAc,EAAkB,MAAM,GAAW,CAAK,CAAC,GACzG,KAAKA,GAA6B,MAAM;EAC1C;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"button.js","names":["#pressed","#setBooleanState","#expanded","#readOnly","#form","#requestHostUpdate","#queueBehaviorSync","#name","#setStringState","#value","#type","#disabled","#selected","#current","#getElementTarget","#setElementTarget","#popoverTargetAction","#command","#hasConnected","#flushPendingAttributeReflections","#syncBehavior","#syncQueued","#handleBooleanAttributeChange","#handleElementTargetAttributeChange","#handleStringAttributeChange","#getHostUpdateComplete","#elementTargets","#getElementById","#getBooleanValue","#setBooleanValue","#reflectAttribute","#getStringValue","#setStringValue","#pendingAttributeReflections"],"sources":["../../src/mixins/button.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { TypeAnchorController } from '../internal/controllers/type-anchor.controller.js';\nimport { TypeButtonController } from '../internal/controllers/type-button.controller.js';\nimport { TypeCommandController } from '../internal/controllers/type-command.controller.js';\nimport { TypeInterestInvokerController } from '../internal/controllers/type-interest-invoker.controller.js';\nimport { TypeSubmitController } from '../internal/controllers/type-submit.controller.js';\nimport { TypePopoverTriggerController } from '../internal/controllers/type-popover-trigger.controller.js';\nimport { StateActiveController } from '../internal/controllers/state-active.controller.js';\nimport { StateCurrentController } from '../internal/controllers/state-current.controller.js';\nimport { StateDisabledController } from '../internal/controllers/state-disabled.controller.js';\nimport { StateExpandedController } from '../internal/controllers/state-expanded.controller.js';\nimport { StatePressedController } from '../internal/controllers/state-pressed.controller.js';\nimport { StateReadOnlyController } from '../internal/controllers/state-readonly.controller.js';\nimport { StateSelectedController } from '../internal/controllers/state-selected.controller.js';\nimport type { ReactiveController } from '../internal/controllers/types.js';\nimport {\n attachInternals,\n getFlattenedDOMTree,\n getStringValue,\n hasAttributeValue,\n isFormElement,\n setAttributeValue\n} from '../internal/utils.js';\nimport type { ButtonFormControlMixinInstance, ButtonType, CurrentState, PopoverTargetAction } from './button.types.js';\nexport type { ButtonFormControlMixinInstance, ButtonType, CurrentState, PopoverTargetAction } from './button.types.js';\n\ntype ChangedProperties = Map<PropertyKey, unknown>;\ninterface ButtonFormControlHost {\n connectedCallback?(): void;\n disconnectedCallback?(): void;\n attributeChangedCallback?(name: string, oldValue: string | null, newValue: string | null): void;\n requestUpdate?(name?: string, oldValue?: unknown): void;\n updateComplete?: Promise<unknown>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Constructor = (new (...args: any[]) => HTMLElement & ButtonFormControlHost) & { observedAttributes?: string[] };\n\ninterface BooleanStateOptions {\n property: string;\n value: boolean;\n reflect: boolean;\n attribute?: string;\n}\n\ninterface StringStateOptions {\n property: string;\n value: unknown;\n attribute?: string;\n reflect?: boolean;\n}\n\nconst ELEMENT_TARGET_PROPERTIES = {\n commandfor: 'commandForElement',\n interestfor: 'interestForElement',\n popovertarget: 'popoverTargetElement'\n} as const;\ntype ElementTargetAttribute = keyof typeof ELEMENT_TARGET_PROPERTIES;\ntype ElementTargetProperty = (typeof ELEMENT_TARGET_PROPERTIES)[ElementTargetAttribute];\n\ntype ButtonFormControlConstructor<TBase extends Constructor> = new (\n ...args: ConstructorParameters<TBase>\n) => InstanceType<TBase> & ButtonFormControlMixinInstance;\nexport type ButtonFormControlMixinReturn<TBase extends Constructor> = ButtonFormControlConstructor<TBase> & {\n formAssociated: boolean;\n observedAttributes: string[];\n} & Omit<TBase, 'prototype'>;\n\n/**\n * @description A mixin that adds native button-style form, command, popover, and interaction behavior.\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/button/\n */\nexport function ButtonFormControlMixin<TBase extends Constructor>(\n SuperClass: TBase\n): ButtonFormControlMixinReturn<TBase> {\n return class ButtonFormControlBase extends SuperClass {\n static formAssociated = true;\n\n #command: string | undefined;\n #current: CurrentState | undefined;\n #disabled = false;\n #elementTargets: Record<ElementTargetProperty, HTMLElement | null> = {\n commandForElement: null,\n interestForElement: null,\n popoverTargetElement: null\n };\n #expanded: boolean | undefined;\n #form: string | HTMLFormElement | null = null;\n #hasConnected = false;\n #name: string | undefined;\n #pendingAttributeReflections = new Map<string, string | null>();\n #popoverTargetAction: PopoverTargetAction | undefined;\n #pressed: boolean | undefined;\n #readOnly = false;\n #selected: boolean | undefined;\n #syncQueued = false;\n #type: ButtonType | undefined;\n #value: string | undefined;\n\n _internals = attachInternals(this);\n\n static get observedAttributes() {\n return (super.observedAttributes ?? []).concat([\n 'pressed',\n 'expanded',\n 'readonly',\n 'form',\n 'name',\n 'value',\n 'type',\n 'disabled',\n 'selected',\n 'current',\n 'popovertarget',\n 'popovertargetaction',\n 'commandfor',\n 'command',\n 'interestfor'\n ]);\n }\n\n get pressed(): boolean {\n return this.#pressed as boolean;\n }\n\n set pressed(value: boolean | unknown) {\n this.#setBooleanState({ property: 'pressed', value: Boolean(value), reflect: true });\n }\n\n get expanded(): boolean {\n return this.#expanded as boolean;\n }\n\n set expanded(value: boolean | unknown) {\n this.#setBooleanState({ property: 'expanded', value: Boolean(value), reflect: true });\n }\n\n get readOnly(): boolean {\n return this.#readOnly || Boolean(this._typeAnchorController?.readOnly);\n }\n\n set readOnly(value: boolean | unknown) {\n this.#setBooleanState({ property: 'readOnly', value: Boolean(value), reflect: true, attribute: 'readonly' });\n }\n\n get readonly(): boolean {\n return this.readOnly;\n }\n\n set readonly(value: boolean) {\n this.readOnly = value;\n }\n\n set form(form: string | HTMLFormElement | null) {\n const oldValue = this.form;\n this.#form = form;\n if (typeof form === 'string') {\n this.setAttribute('form', form);\n } else {\n this.removeAttribute('form');\n }\n this.#requestHostUpdate('form', oldValue);\n this.#queueBehaviorSync();\n }\n\n get form(): HTMLFormElement | null | string {\n if (this.#form && typeof this.#form !== 'string') {\n return this.#form;\n }\n\n if (typeof this.#form === 'string' && typeof globalThis.document !== 'undefined') {\n const rootNode = this.getRootNode() as Document | ShadowRoot;\n const form = rootNode.getElementById ? rootNode.getElementById(this.#form) : null;\n return isFormElement(form) ? form : null;\n }\n\n return this._internals?.form ?? null;\n }\n\n get name(): string {\n return this.#name as string;\n }\n\n set name(value: string | unknown) {\n this.#setStringState({ property: 'name', value });\n }\n\n get value(): string {\n return this.#value as string;\n }\n\n set value(value: string | unknown) {\n this.#setStringState({ property: 'value', value });\n }\n\n get type(): ButtonType {\n return (this.#type ?? this._typeSubmitController?.defaultType) as ButtonType;\n }\n\n set type(value: ButtonType | unknown) {\n this.#setStringState({ property: 'type', value });\n }\n\n get disabled(): boolean {\n return this.#disabled;\n }\n\n set disabled(value: boolean | unknown) {\n this.#setBooleanState({ property: 'disabled', value: Boolean(value), reflect: true });\n }\n\n get selected(): boolean {\n return this.#selected as boolean;\n }\n\n set selected(value: boolean | unknown) {\n this.#setBooleanState({ property: 'selected', value: Boolean(value), reflect: true });\n }\n\n get current(): CurrentState {\n return this.#current as CurrentState;\n }\n\n set current(value: CurrentState | unknown) {\n this.#setStringState({ property: 'current', value });\n }\n\n get popoverTargetElement(): HTMLElement | null {\n return this.#getElementTarget('popovertarget');\n }\n\n set popoverTargetElement(value: HTMLElement | null) {\n this.#setElementTarget('popovertarget', value);\n }\n\n get popoverTargetAction(): PopoverTargetAction {\n return this.#popoverTargetAction === 'show' || this.#popoverTargetAction === 'hide'\n ? this.#popoverTargetAction\n : 'toggle';\n }\n\n set popoverTargetAction(value: PopoverTargetAction | unknown) {\n this.#setStringState({ property: 'popoverTargetAction', value, attribute: 'popovertargetaction' });\n }\n\n get commandForElement(): HTMLElement | null {\n return this.#getElementTarget('commandfor');\n }\n\n set commandForElement(value: HTMLElement | null) {\n this.#setElementTarget('commandfor', value);\n }\n\n get command(): string {\n return this.#command as string;\n }\n\n set command(value: string | unknown) {\n this.#setStringState({ property: 'command', value });\n }\n\n get interestForElement(): HTMLElement | null {\n return this.#getElementTarget('interestfor');\n }\n\n set interestForElement(value: HTMLElement | null) {\n this.#setElementTarget('interestfor', value);\n }\n\n protected _controllers?: Set<ReactiveController>;\n protected _typeAnchorController = new TypeAnchorController(this);\n protected _typeButtonController = new TypeButtonController(this);\n protected _typeSubmitController = new TypeSubmitController(this);\n protected _typeCommandController = new TypeCommandController(this);\n protected _typeInterestInvokerController = new TypeInterestInvokerController(this);\n protected _typePopoverTriggerController = new TypePopoverTriggerController(this);\n protected _stateActiveController = new StateActiveController(this);\n protected _stateDisabledController = new StateDisabledController(this);\n protected _stateExpandedController = new StateExpandedController(this);\n protected _statePressedController = new StatePressedController(this);\n protected _stateSelectedController = new StateSelectedController(this);\n protected _stateCurrentController = new StateCurrentController(this);\n protected _stateReadOnlyController = new StateReadOnlyController(this);\n\n addController(controller: ReactiveController) {\n this._controllers ??= new Set<ReactiveController>();\n this._controllers.add(controller);\n }\n\n connectedCallback() {\n super.connectedCallback?.();\n this._controllers?.forEach(controller => controller.hostConnected?.());\n attachInternals(this);\n this.#hasConnected = true;\n this.#flushPendingAttributeReflections();\n\n this.#syncBehavior();\n this.#queueBehaviorSync();\n }\n\n disconnectedCallback() {\n this._controllers?.forEach(controller => controller.hostDisconnected?.());\n super.disconnectedCallback?.();\n }\n\n protected updated(changedProperties: ChangedProperties) {\n const superUpdated = Object.getPrototypeOf(ButtonFormControlBase.prototype).updated as\n | ((changedProperties: ChangedProperties) => void)\n | undefined;\n superUpdated?.call(this, changedProperties);\n this.#syncQueued = false;\n this.#syncBehavior();\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {\n super.attributeChangedCallback?.(name, oldValue, newValue);\n\n if (oldValue === newValue) {\n return;\n }\n\n this.#handleBooleanAttributeChange(name, newValue);\n this.#handleElementTargetAttributeChange(name, oldValue);\n this.#handleStringAttributeChange(name, oldValue, newValue);\n }\n\n #queueBehaviorSync() {\n if (!this.isConnected || this.#syncQueued) {\n return;\n }\n\n this.#syncQueued = true;\n void this.#getHostUpdateComplete().then(() => {\n if (!this.#syncQueued) return;\n this.#syncQueued = false;\n if (this.isConnected) this.#syncBehavior();\n });\n }\n\n #syncBehavior() {\n this._controllers?.forEach(controller => controller.hostUpdated?.());\n }\n\n #handleBooleanAttributeChange(name: string, newValue: string | null) {\n if (name === 'pressed' || name === 'expanded' || name === 'selected' || name === 'disabled') {\n this.#setBooleanState({ property: name, value: newValue !== null, reflect: false });\n }\n\n if (name === 'readonly') {\n this.#setBooleanState({ property: 'readOnly', value: newValue !== null, reflect: false });\n }\n }\n\n #handleStringAttributeChange(name: string, oldValue: string | null, newValue: string | null) {\n if (name === 'commandfor' || name === 'interestfor' || name === 'popovertarget') {\n return;\n }\n\n if (name === 'form') {\n if (!(isFormElement(this.#form) && newValue === null)) {\n this.#form = newValue;\n this.#requestHostUpdate('form', oldValue);\n }\n }\n\n if (name === 'popovertargetaction') {\n this.#setStringState({ property: 'popoverTargetAction', value: newValue, reflect: false });\n return;\n }\n\n this.#setStringState({ property: name, value: newValue, reflect: false });\n }\n\n #handleElementTargetAttributeChange(name: string, oldValue: string | null) {\n const property = ELEMENT_TARGET_PROPERTIES[name as ElementTargetAttribute];\n if (!property) {\n return;\n }\n\n const oldTarget = this.#elementTargets[property] ?? this.#getElementById(oldValue);\n this.#elementTargets[property] = null;\n this.#requestHostUpdate(property, oldTarget);\n this.#queueBehaviorSync();\n }\n\n #getElementTarget(attribute: ElementTargetAttribute) {\n return (\n this.#elementTargets[ELEMENT_TARGET_PROPERTIES[attribute]] ?? this.#getElementById(this.getAttribute(attribute))\n );\n }\n\n #getElementById(id: string | null) {\n return id ? (getFlattenedDOMTree(this.getRootNode()).find(element => element.id === id) ?? null) : null;\n }\n\n #setElementTarget(attribute: ElementTargetAttribute, value: HTMLElement | null) {\n const property = ELEMENT_TARGET_PROPERTIES[attribute];\n const oldValue = this[property];\n if (oldValue === value && hasAttributeValue(this, attribute, value ? '' : null)) {\n return;\n }\n setAttributeValue(this, attribute, value ? '' : null);\n this.#elementTargets[property] = value;\n this.#requestHostUpdate(property, oldValue);\n this.#queueBehaviorSync();\n }\n\n #setBooleanState({ property, value, reflect, attribute = property }: BooleanStateOptions) {\n const oldValue = this.#getBooleanValue(property);\n if (oldValue === value && (!reflect || hasAttributeValue(this, attribute, value ? '' : null))) {\n return;\n }\n\n this.#setBooleanValue(property, value);\n if (reflect && this.#reflectAttribute(attribute, value ? '' : null)) {\n return;\n }\n this.#requestHostUpdate(property, oldValue);\n this.#queueBehaviorSync();\n }\n\n #getBooleanValue(property: string) {\n return {\n disabled: this.#disabled,\n expanded: this.#expanded,\n pressed: this.#pressed,\n readOnly: this.#readOnly,\n selected: this.#selected\n }[property];\n }\n\n #setBooleanValue(property: string, value: boolean) {\n if (property === 'disabled') {\n this.#disabled = value;\n } else if (property === 'expanded') {\n this.#expanded = value;\n } else if (property === 'pressed') {\n this.#pressed = value;\n } else if (property === 'readOnly') {\n this.#readOnly = value;\n } else if (property === 'selected') {\n this.#selected = value;\n }\n }\n\n #setStringState({ property, value, attribute = property, reflect = true }: StringStateOptions) {\n const oldValue = this.#getStringValue(property);\n const nextValue = getStringValue(value);\n if (oldValue === nextValue && (!reflect || hasAttributeValue(this, attribute, nextValue))) {\n return;\n }\n\n this.#setStringValue(property, nextValue);\n if (reflect && this.#reflectAttribute(attribute, nextValue)) {\n return;\n }\n this.#requestHostUpdate(property, oldValue);\n this.#queueBehaviorSync();\n }\n\n #getStringValue(property: string) {\n return {\n command: this.#command,\n current: this.#current,\n name: this.#name,\n popoverTargetAction: this.#popoverTargetAction,\n type: this.#type,\n value: this.#value\n }[property];\n }\n\n #setStringValue(property: string, value: string | null) {\n const setters: Record<string, () => void> = {\n command: () => (this.#command = value ?? undefined),\n current: () => (this.#current = value as CurrentState),\n name: () => (this.#name = value ?? undefined),\n popoverTargetAction: () => (this.#popoverTargetAction = value as PopoverTargetAction),\n type: () => (this.#type = value as ButtonType),\n value: () => (this.#value = value ?? undefined)\n };\n setters[property]?.();\n }\n\n #reflectAttribute(attribute: string, value: string | null) {\n if (!this.isConnected && !this.#hasConnected) {\n if (!this.hasAttribute(attribute)) {\n this.#pendingAttributeReflections.set(attribute, value);\n }\n return true;\n }\n\n setAttributeValue(this, attribute, value);\n return false;\n }\n\n #requestHostUpdate(name?: string, oldValue?: unknown) {\n this.requestUpdate?.(name, oldValue);\n }\n\n #getHostUpdateComplete() {\n return this.updateComplete ?? Promise.resolve();\n }\n\n #flushPendingAttributeReflections() {\n this.#pendingAttributeReflections.forEach((value, attribute) => setAttributeValue(this, attribute, value));\n this.#pendingAttributeReflections.clear();\n }\n } as unknown as ButtonFormControlMixinReturn<TBase>;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsDA,IAAM,IAA4B;CAChC,YAAY;CACZ,aAAa;CACb,eAAe;AACjB;AAgBA,SAAgB,EACd,GACqC;CACrC,OAAO,MAAM,UAA8B,EAAW;;0BAKxC,cACyD;IACnE,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;GACxB,aAEyC,gBACzB,8BAEe,IAAI,IAA2B,aAGlD,cAEE,sBAID,EAAgB,IAAI,gCA2KC,IAAI,EAAqB,IAAI,gCAC7B,IAAI,EAAqB,IAAI,gCAC7B,IAAI,EAAqB,IAAI,iCAC5B,IAAI,EAAsB,IAAI,yCACtB,IAAI,EAA8B,IAAI,wCACvC,IAAI,EAA6B,IAAI,iCAC5C,IAAI,EAAsB,IAAI,mCAC5B,IAAI,EAAwB,IAAI,mCAChC,IAAI,EAAwB,IAAI,kCACjC,IAAI,EAAuB,IAAI,mCAC9B,IAAI,EAAwB,IAAI,kCACjC,IAAI,EAAuB,IAAI,mCAC9B,IAAI,EAAwB,IAAI;;;yBA9M7C;;EAExB;EACA;EACA;EACA;EAKA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAIA,WAAW,qBAAqB;GAC9B,QAAQ,MAAM,sBAAsB,CAAC,EAAA,CAAG,OAAO;IAC7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C1B,MAAM,KAAKN;IACX,OAAO,KAAKD;GACd,EAAE;EACJ;EAEA,GAAgB,GAAkB,GAAsB;GAStD,CAAA;IAPE,eAAgB,KAAKQ,KAAW,KAAS,KAAA;IACzC,eAAgB,KAAKJ,KAAW;IAChC,YAAa,KAAKN,KAAQ,KAAS,KAAA;IACnC,2BAA4B,KAAKS,KAAuB;IACxD,YAAa,KAAKN,KAAQ;IAC1B,aAAc,KAAKD,KAAS,KAAS,KAAA;GAEvC,EAAA,CAAQ,EAAS,GAAG;EACtB;EAEA,GAAkB,GAAmB,GAAsB;GASzD,OARI,CAAC,KAAK,eAAe,CAAC,KAAKS,MACxB,KAAK,aAAa,CAAS,KAC9B,KAAKe,GAA6B,IAAI,GAAW,CAAK,GAEjD,OAGT,EAAkB,MAAM,GAAW,CAAK,GACjC;EACT;EAEA,GAAmB,GAAe,GAAoB;GACpD,KAAK,gBAAgB,GAAM,CAAQ;EACrC;EAEA,KAAyB;GACvB,OAAO,KAAK,kBAAkB,QAAQ,QAAQ;EAChD;EAEA,KAAoC;GAElC,AADA,KAAKA,GAA6B,SAAS,GAAO,MAAc,EAAkB,MAAM,GAAW,CAAK,CAAC,GACzG,KAAKA,GAA6B,MAAM;EAC1C;CACF;AACF"}
|
|
@@ -75,15 +75,10 @@ export interface ButtonFormControlMixinInstance {
|
|
|
75
75
|
/**
|
|
76
76
|
* Establishes a relationship between a popover and its invoker button.
|
|
77
77
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetElement
|
|
78
|
-
*/
|
|
79
|
-
popoverTargetElement: HTMLElement | null;
|
|
80
|
-
/**
|
|
81
|
-
* The id reference of the element that receives the popover.
|
|
82
|
-
* https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#popovertarget
|
|
83
78
|
* @attr popovertarget
|
|
84
79
|
* @reflect
|
|
85
80
|
*/
|
|
86
|
-
|
|
81
|
+
popoverTargetElement: HTMLElement | null;
|
|
87
82
|
/**
|
|
88
83
|
* The popover target action to perform on the popover target element.
|
|
89
84
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/popoverTargetAction
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormControlValue } from '../internal/types.js';
|
|
2
|
-
import { FormControlMixinInstance } from './index.js';
|
|
1
|
+
import type { FormControlValue } from '../internal/types.js';
|
|
2
|
+
import { type FormControlMixinInstance } from './index.js';
|
|
3
3
|
type Constructor = (new (...args: any[]) => HTMLElement & {
|
|
4
4
|
connectedCallback?(): void;
|
|
5
5
|
disconnectedCallback?(): void;
|
package/dist/mixins/control.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormControlMetadata, FormControlValue } from '../internal/types.js';
|
|
1
|
+
import type { FormControlMetadata, FormControlValue } from '../internal/types.js';
|
|
2
2
|
type Constructor = (new (...args: any[]) => HTMLElement & {
|
|
3
3
|
connectedCallback?(): void;
|
|
4
4
|
disconnectedCallback?(): void;
|