@nvidia-elements/forms 2.0.13 → 2.0.15
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 +75 -0
- package/dist/custom-elements.json +31 -0
- package/dist/index.js +1 -1
- package/dist/internal/controllers/state-active.controller.js +2 -2
- package/dist/internal/controllers/state-active.controller.js.map +1 -1
- package/dist/internal/controllers/type-popover-trigger.controller.js.map +1 -1
- package/dist/internal/controllers/type-submit.controller.js +36 -17
- package/dist/internal/controllers/type-submit.controller.js.map +1 -1
- package/dist/internal/utils.js.map +1 -1
- package/dist/mixins/button.js +31 -31
- package/dist/mixins/button.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,78 @@
|
|
|
1
|
+
## [2.0.15](https://github.com/NVIDIA/elements/compare/@nvidia-elements/forms-v2.0.14...@nvidia-elements/forms-v2.0.15) (2026-12-01)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **code:** add code block header and footer support ([d0893df](https://github.com/NVIDIA/elements/commit/d0893df36cebcf70e8cb6f80d1736bb5dd5458c0))
|
|
6
|
+
* **code:** add code textarea and migrate syntax highlighting to lezer ([b53f94e](https://github.com/NVIDIA/elements/commit/b53f94ec61805082fb2c9cb6b08196570ff3cf44))
|
|
7
|
+
* **core:** dot shapes and color support ([4d0622f](https://github.com/NVIDIA/elements/commit/4d0622f072ad4d5dfe73dbfa7736ed565119c13e))
|
|
8
|
+
* **core:** expose dashboard layouts as objects ([f508745](https://github.com/NVIDIA/elements/commit/f508745ad6291d3839efafa76a8d9601e4f5f6e1))
|
|
9
|
+
* **core:** expose workspace layouts as objects ([2d16a58](https://github.com/NVIDIA/elements/commit/2d16a58250234b05f98d6c54e524f6e8b3d39935))
|
|
10
|
+
* **core:** meter ([1628b4b](https://github.com/NVIDIA/elements/commit/1628b4b6d9a3c07de945907cb6319be496021c37))
|
|
11
|
+
* **lint:** meter ([0905529](https://github.com/NVIDIA/elements/commit/090552971692fcefd2fddc2954fbf27bed02ec74))
|
|
12
|
+
* **viewport:** add standalone cdn bundle ([6f2b62e](https://github.com/NVIDIA/elements/commit/6f2b62ebb8f9981171aafe0683c37b46c59be207))
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **ci:** keep multiline types on one api table row ([d3a8650](https://github.com/NVIDIA/elements/commit/d3a86504de2553ef06ba18e40670589355b81132))
|
|
17
|
+
* **ci:** preserve complex types in framework declarations ([c33a319](https://github.com/NVIDIA/elements/commit/c33a3191c4287695daace5edec8a971fe115f564))
|
|
18
|
+
* **ci:** preserve textarea closing tags in example metadata ([ee4ede2](https://github.com/NVIDIA/elements/commit/ee4ede22f4623972ba4a9609ce5e441e9ec35415))
|
|
19
|
+
* **cli:** update bun to 1.4.5 ([6a5fa40](https://github.com/NVIDIA/elements/commit/6a5fa40a5ecac6740828c49a48ce6163e5bfdbfb))
|
|
20
|
+
* **code:** update @lezer/common to 1.5.7 ([d84cd11](https://github.com/NVIDIA/elements/commit/d84cd1152dfcefd6816acf5240f87ad494cb2180))
|
|
21
|
+
* **code:** update @lezer/javascript to 1.5.7 ([312bf4a](https://github.com/NVIDIA/elements/commit/312bf4a9f11c603e49eb5d0458529f3c42490f2e))
|
|
22
|
+
* **code:** update element metadata ([1019c12](https://github.com/NVIDIA/elements/commit/1019c1265c74f75306a13e396f01aaba38e2aa6d))
|
|
23
|
+
* **core:** alert status for toggletip close ([b19221c](https://github.com/NVIDIA/elements/commit/b19221cc02f003528d9bae1f9a981784c39ebed9))
|
|
24
|
+
* **core:** animation duration support for fixed value progress ring ([47e6309](https://github.com/NVIDIA/elements/commit/47e63097e888e81da735d16a0721c4f6ba201c54))
|
|
25
|
+
* **core:** drop obsolete css.escape feature probe ([7813a28](https://github.com/NVIDIA/elements/commit/7813a28dd012e8e126daeac0a7dbe79961156bc4))
|
|
26
|
+
* **core:** drop overridden webkit focus ring fallback ([0697e24](https://github.com/NVIDIA/elements/commit/0697e245b9019de3749322e7cacca500ae41f248))
|
|
27
|
+
* **core:** preserve modal autofocus during keyboard activation ([2885523](https://github.com/NVIDIA/elements/commit/28855234cfd464e308e113f86ab63da8924f1ebb))
|
|
28
|
+
* **core:** refresh control associations when the native input changes ([ad4a091](https://github.com/NVIDIA/elements/commit/ad4a091467260bd926f88f20529590ba4464e847))
|
|
29
|
+
* **core:** remove forced dashboard scrollbars and header text truncation ([b61ba9b](https://github.com/NVIDIA/elements/commit/b61ba9b3ccf044916a2dcad3fb85933cb4981bcc))
|
|
30
|
+
* **core:** update container values ([d00ce2d](https://github.com/NVIDIA/elements/commit/d00ce2d361795d9eb0b05f0c61ae54b04714a214))
|
|
31
|
+
* **core:** update element metadata ([bd1bf1c](https://github.com/NVIDIA/elements/commit/bd1bf1cbc5830b36dc9f6a594ba64ab57d84e4cb))
|
|
32
|
+
* **docs:** load required bundles in editable example previews ([83d5eab](https://github.com/NVIDIA/elements/commit/83d5eab8f361faa7aa71000b6829aa48910b55a6))
|
|
33
|
+
* **docs:** preserve spacing in api descriptions ([86e466b](https://github.com/NVIDIA/elements/commit/86e466bfd358e49098f3228b32878664a11c887c))
|
|
34
|
+
* **forms:** match native button keyboard activation timing ([cb14179](https://github.com/NVIDIA/elements/commit/cb141794e823b222b347a50cc92d903400d8f32b))
|
|
35
|
+
* **foundations:** update element metadata ([7fafe6f](https://github.com/NVIDIA/elements/commit/7fafe6f701e149d6a33d5227f31a76d646ff432f))
|
|
36
|
+
* **lint:** accept empty values for attributes that declare them ([63811bf](https://github.com/NVIDIA/elements/commit/63811bf2a655c6d9d5fc6bed385f24cb4a450bb6))
|
|
37
|
+
* **lint:** flag deprecated code block language values ([5db13cf](https://github.com/NVIDIA/elements/commit/5db13cf366b99689a0600d3d38412a955be1b84c))
|
|
38
|
+
* **markdown:** update element metadata ([9f5ce31](https://github.com/NVIDIA/elements/commit/9f5ce31d156a7d7f38af7eb3f8ad57cc5898ab6a))
|
|
39
|
+
* **media:** update element metadata ([26c0659](https://github.com/NVIDIA/elements/commit/26c0659c408e0f1fb94bb8f0810a4d86272bd900))
|
|
40
|
+
* **monaco:** keep css asset imports out of public declarations ([38dd1cf](https://github.com/NVIDIA/elements/commit/38dd1cf5c011eaea82e59e3bf0b79601b38944c5))
|
|
41
|
+
* **monaco:** update element metadata ([94a8c95](https://github.com/NVIDIA/elements/commit/94a8c959f44d62bb3d29371937aec640f890f1df))
|
|
42
|
+
* **pi:** update typebox to 1.4.7 ([10ebae6](https://github.com/NVIDIA/elements/commit/10ebae6d20abd93c7f196a98ea681a4f0464818c))
|
|
43
|
+
* **themes:** layer container values and missing tests ([327981f](https://github.com/NVIDIA/elements/commit/327981ff5b80483bb31a1b091f31ffaf0696796b))
|
|
44
|
+
* **viewport:** update element metadata ([f33d24e](https://github.com/NVIDIA/elements/commit/f33d24e985aad1b03419399a5e56b1543ae2f5f2))
|
|
45
|
+
|
|
46
|
+
## [2.0.14](https://github.com/NVIDIA/elements/compare/@nvidia-elements/forms-v2.0.13...@nvidia-elements/forms-v2.0.14) (2026-11-16)
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
* **core:** add dashboard ([83e5ced](https://github.com/NVIDIA/elements/commit/83e5ced893821ab74cad106473c92ecb04443949))
|
|
51
|
+
* **core:** iframe sandbox options ([849eb85](https://github.com/NVIDIA/elements/commit/849eb854b9f96692d2607f2db4aee62b7487b05f))
|
|
52
|
+
* **core:** support for grid virtual-list ([32fd01e](https://github.com/NVIDIA/elements/commit/32fd01e61b004bb07c0a54ce7cb6c747b09eaa55))
|
|
53
|
+
* **foundations:** add placement translation keys ([a3d4d53](https://github.com/NVIDIA/elements/commit/a3d4d5386df3c71e3d273c1175b140fab04efc9d))
|
|
54
|
+
* **foundations:** virtual-list ([aa4ef9e](https://github.com/NVIDIA/elements/commit/aa4ef9e20dd0ec9e4ce8a4be69c6678f11c86b12))
|
|
55
|
+
* **styles:** add text shimmer support ([c96b621](https://github.com/NVIDIA/elements/commit/c96b6215099331152632805a18d9638230cb3da6))
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* **core:** drop obsolete panel transition prefix ([dead5e0](https://github.com/NVIDIA/elements/commit/dead5e0cc7cb0202e83f64cd8242755e06ac91db))
|
|
60
|
+
* **core:** drop obsolete progress appearance prefixes ([2192b3c](https://github.com/NVIDIA/elements/commit/2192b3c42e09842685e90c2ce5440b2005c9f7bb))
|
|
61
|
+
* **core:** drop obsolete scoped registry polyfill ([520e03b](https://github.com/NVIDIA/elements/commit/520e03b0244592f100edcfedc45ea2871d1cecc5))
|
|
62
|
+
* **core:** improve icon registry bundling performance ([64db7b9](https://github.com/NVIDIA/elements/commit/64db7b972645a624e11dd97249c49a6b0b2d60f7))
|
|
63
|
+
* **core:** improve workspace performance ([3a580b8](https://github.com/NVIDIA/elements/commit/3a580b889927a3df365f149b19a4de07bd69bc10))
|
|
64
|
+
* **core:** refactor to use foundations internals ([6405764](https://github.com/NVIDIA/elements/commit/6405764abcd16224406fdc57a811cd745ec54971))
|
|
65
|
+
* **core:** size overlays with the dynamic viewport ([3458d95](https://github.com/NVIDIA/elements/commit/3458d9566cbf6740ced6cdf9650296e0cadfe336))
|
|
66
|
+
* **forms:** use keydown for button active state ([486875c](https://github.com/NVIDIA/elements/commit/486875c082a15f2bc7a72a091759a93cfa3f8a2b))
|
|
67
|
+
* **foundations:** add shared decorator ([fa642a4](https://github.com/NVIDIA/elements/commit/fa642a4c81c7e0ec2f00d646452bcd7d595b1e34))
|
|
68
|
+
* **lint:** add new nve-text values ([80c106e](https://github.com/NVIDIA/elements/commit/80c106e33b4d057d2f5907882b490b4a46890742))
|
|
69
|
+
* **markdown:** update to use foundations internals ([33f1490](https://github.com/NVIDIA/elements/commit/33f149046c791aad70e35b439869fd4d05efe6ed))
|
|
70
|
+
* **media:** update icon imports ([7d95c48](https://github.com/NVIDIA/elements/commit/7d95c485bfbdaa180d858fc1ecf51941342e2cdf))
|
|
71
|
+
* **media:** update to use foundations internals ([24d2296](https://github.com/NVIDIA/elements/commit/24d2296596c18955cfe8723f0e1c67ccc53cbfeb))
|
|
72
|
+
* **pi:** update typebox to 1.4.6 ([e2635d1](https://github.com/NVIDIA/elements/commit/e2635d17980a706b044d9a3d814334de489aa72a))
|
|
73
|
+
* **starters:** update [@angular](https://github.com/angular) packages to 22.2.6 ([39be6b3](https://github.com/NVIDIA/elements/commit/39be6b3fbef2498f8898210bdc58d94ba2eb42d7))
|
|
74
|
+
* **viewport:** update to use foundations internals ([a5510ec](https://github.com/NVIDIA/elements/commit/a5510ec63d0933d0d8b245c6160e0b3bf2e1f1bc))
|
|
75
|
+
|
|
1
76
|
## [2.0.13](https://github.com/NVIDIA/elements/compare/@nvidia-elements/forms-v2.0.12...@nvidia-elements/forms-v2.0.13) (2026-11-07)
|
|
2
77
|
|
|
3
78
|
### Features
|
|
@@ -822,6 +822,22 @@
|
|
|
822
822
|
"values": []
|
|
823
823
|
}
|
|
824
824
|
},
|
|
825
|
+
{
|
|
826
|
+
"kind": "field",
|
|
827
|
+
"name": "#spacePressed",
|
|
828
|
+
"privacy": "private",
|
|
829
|
+
"type": {
|
|
830
|
+
"text": "boolean",
|
|
831
|
+
"_sourceAliases": [],
|
|
832
|
+
"values": [
|
|
833
|
+
{
|
|
834
|
+
"value": "boolean",
|
|
835
|
+
"description": ""
|
|
836
|
+
}
|
|
837
|
+
]
|
|
838
|
+
},
|
|
839
|
+
"default": "false"
|
|
840
|
+
},
|
|
825
841
|
{
|
|
826
842
|
"kind": "field",
|
|
827
843
|
"name": "defaultType",
|
|
@@ -845,6 +861,21 @@
|
|
|
845
861
|
"name": "#removeSubmitBehavior",
|
|
846
862
|
"privacy": "private"
|
|
847
863
|
},
|
|
864
|
+
{
|
|
865
|
+
"kind": "field",
|
|
866
|
+
"name": "#clearSpacePress",
|
|
867
|
+
"privacy": "private"
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
"kind": "field",
|
|
871
|
+
"name": "#onSubmitKeydown",
|
|
872
|
+
"privacy": "private"
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
"kind": "field",
|
|
876
|
+
"name": "#onSubmitKeypress",
|
|
877
|
+
"privacy": "private"
|
|
878
|
+
},
|
|
848
879
|
{
|
|
849
880
|
"kind": "field",
|
|
850
881
|
"name": "#onSubmitKeyup",
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,10 @@ var t = class {
|
|
|
5
5
|
this.host = e, this.host.addController(this);
|
|
6
6
|
}
|
|
7
7
|
hostConnected() {
|
|
8
|
-
e(this.host), this.host.addEventListener("
|
|
8
|
+
e(this.host), this.host.addEventListener("keydown", this.#e), this.host.addEventListener("mousedown", this.#e), this.host.addEventListener("keyup", this.#t), this.host.addEventListener("blur", this.#t), this.host.addEventListener("mouseup", this.#t);
|
|
9
9
|
}
|
|
10
10
|
hostDisconnected() {
|
|
11
|
-
this.host.removeEventListener("
|
|
11
|
+
this.host.removeEventListener("keydown", this.#e), this.host.removeEventListener("mousedown", this.#e), this.host.removeEventListener("keyup", this.#t), this.host.removeEventListener("blur", this.#t), this.host.removeEventListener("mouseup", this.#t);
|
|
12
12
|
}
|
|
13
13
|
#e = (e) => {
|
|
14
14
|
!this.host.disabled && this.#n(e) && this.host._internals.states.add("active"), e instanceof KeyboardEvent && e.code === "Space" && e.target === this.host && e.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-active.controller.js","names":["StateActiveController","host","attachInternals","#onActive","#onInactive","#isValidActiveEvent","event"],"sources":["../../../src/internal/controllers/state-active.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { attachInternals } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype Active = ReactiveElement & { disabled: boolean; _internals?: ElementInternals };\n\nexport class StateActiveController<T extends Active> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n attachInternals(this.host);\n this.host.addEventListener('
|
|
1
|
+
{"version":3,"file":"state-active.controller.js","names":["StateActiveController","host","attachInternals","#onActive","#onInactive","#isValidActiveEvent","event"],"sources":["../../../src/internal/controllers/state-active.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { attachInternals } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype Active = ReactiveElement & { disabled: boolean; _internals?: ElementInternals };\n\nexport class StateActiveController<T extends Active> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n attachInternals(this.host);\n this.host.addEventListener('keydown', this.#onActive as EventListener);\n this.host.addEventListener('mousedown', this.#onActive as EventListener);\n this.host.addEventListener('keyup', this.#onInactive);\n this.host.addEventListener('blur', this.#onInactive);\n this.host.addEventListener('mouseup', this.#onInactive);\n }\n\n hostDisconnected() {\n this.host.removeEventListener('keydown', this.#onActive as EventListener);\n this.host.removeEventListener('mousedown', this.#onActive as EventListener);\n this.host.removeEventListener('keyup', this.#onInactive);\n this.host.removeEventListener('blur', this.#onInactive);\n this.host.removeEventListener('mouseup', this.#onInactive);\n }\n\n #onActive = (event: KeyboardEvent | PointerEvent) => {\n if (!this.host.disabled && this.#isValidActiveEvent(event)) {\n this.host._internals!.states.add('active');\n }\n\n if (event instanceof KeyboardEvent && event.code === 'Space' && event.target === this.host) {\n event.preventDefault();\n }\n };\n\n #onInactive = () => {\n this.host._internals!.states.delete('active');\n };\n\n #isValidActiveEvent(event: KeyboardEvent | PointerEvent) {\n return event instanceof KeyboardEvent ? event.code === 'Space' || event.code === 'Enter' : true;\n }\n}\n"],"mappings":";;AAQA,IAAaA,IAAb,MAAmF;CACjF,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAMd,AALAC,EAAgB,KAAK,IAAI,GACzB,KAAK,KAAK,iBAAiB,WAAW,KAAKC,EAA0B,GACrE,KAAK,KAAK,iBAAiB,aAAa,KAAKA,EAA0B,GACvE,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAW,GACpD,KAAK,KAAK,iBAAiB,QAAQ,KAAKA,EAAW,GACnD,KAAK,KAAK,iBAAiB,WAAW,KAAKA,EAAW;CACxD;CAEA,mBAAmB;EAKjB,AAJA,KAAK,KAAK,oBAAoB,WAAW,KAAKD,EAA0B,GACxE,KAAK,KAAK,oBAAoB,aAAa,KAAKA,EAA0B,GAC1E,KAAK,KAAK,oBAAoB,SAAS,KAAKC,EAAW,GACvD,KAAK,KAAK,oBAAoB,QAAQ,KAAKA,EAAW,GACtD,KAAK,KAAK,oBAAoB,WAAW,KAAKA,EAAW;CAC3D;CAEA,MAAa,MAAwC;EAKnD,AAJI,CAAC,KAAK,KAAK,YAAY,KAAKC,GAAoBC,CAAK,KACvD,KAAK,KAAK,WAAY,OAAO,IAAI,QAAQ,GAGvCA,aAAiB,iBAAiBA,EAAM,SAAS,WAAWA,EAAM,WAAW,KAAK,QACpFA,EAAM,eAAe;CAEzB;CAEA,WAAoB;EAClB,KAAK,KAAK,WAAY,OAAO,OAAO,QAAQ;CAC9C;CAEA,GAAoB,GAAqC;EACvD,OAAOA,aAAiB,gBAAgBA,EAAM,SAAS,WAAWA,EAAM,SAAS,UAAU;CAC7F;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-popover-trigger.controller.js","names":["TypePopoverTriggerController","host","#onClick","popoverTargetElement","controllerResolvedTarget","#resolvedPopoverTarget","resolvedPopoverTarget","getFlattenedDOMTree","element","event","#resolvePopoverTarget","#invokePopover","#handoverInterest","getHostAnchor","source","#getPopoverSource","loseInterest"],"sources":["../../../src/internal/controllers/type-popover-trigger.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PopoverTargetAction } from '../types/button.js';\nimport { getFlattenedDOMTree, getHostAnchor } from '../utils.js';\nimport type { PopoverAnchorElement } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype InterestEvent = Event & { source: HTMLElement };\n\ntype PopoverTriggerHost = ReactiveElement & {\n disabled: boolean;\n interestForElement: HTMLElement | null;\n popoverTargetAction?: PopoverTargetAction;\n popoverTargetElement: HTMLElement | null;\n};\n\nexport class TypePopoverTriggerController<T extends PopoverTriggerHost> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n this.host.addEventListener('click', this.#onClick);\n }\n\n hostDisconnected() {\n this.host.removeEventListener('click', this.#onClick);\n }\n\n #resolvedPopoverTarget: HTMLElement | null | undefined;\n\n #resolvePopoverTarget() {\n const popoverTargetElement = this.host.popoverTargetElement;\n const controllerResolvedTarget = popoverTargetElement === this.#resolvedPopoverTarget;\n\n if (!this.host.getAttribute('popovertarget')) {\n this.#resolvedPopoverTarget = undefined;\n if (controllerResolvedTarget) {\n this.host.popoverTargetElement = null;\n return null;\n }\n\n return popoverTargetElement;\n }\n\n if (popoverTargetElement && !controllerResolvedTarget) {\n return popoverTargetElement;\n }\n\n const resolvedPopoverTarget =\n getFlattenedDOMTree(this.host.getRootNode()).find(\n element => element.id === this.host.getAttribute('popovertarget')\n ) ?? null;\n if (resolvedPopoverTarget !== popoverTargetElement) {\n this.host.popoverTargetElement = resolvedPopoverTarget;\n }\n this.#resolvedPopoverTarget = resolvedPopoverTarget;\n\n return resolvedPopoverTarget;\n }\n\n #onClick = (event: MouseEvent) => {\n if (event.defaultPrevented || this.host.disabled) {\n return;\n }\n\n const popoverTargetElement = this.#resolvePopoverTarget();\n if (!popoverTargetElement) {\n return;\n }\n\n if (this.#invokePopover(popoverTargetElement)) {\n this.#handoverInterest();\n }\n };\n\n #getPopoverSource(popoverTargetElement: HTMLElement) {\n if ((popoverTargetElement as PopoverAnchorElement).anchor) {\n return getHostAnchor(popoverTargetElement
|
|
1
|
+
{"version":3,"file":"type-popover-trigger.controller.js","names":["TypePopoverTriggerController","host","#onClick","popoverTargetElement","controllerResolvedTarget","#resolvedPopoverTarget","resolvedPopoverTarget","getFlattenedDOMTree","element","event","#resolvePopoverTarget","#invokePopover","#handoverInterest","getHostAnchor","source","#getPopoverSource","loseInterest"],"sources":["../../../src/internal/controllers/type-popover-trigger.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PopoverTargetAction } from '../types/button.js';\nimport { getFlattenedDOMTree, getHostAnchor } from '../utils.js';\nimport type { PopoverAnchorElement } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype InterestEvent = Event & { source: HTMLElement };\n\ntype PopoverTriggerHost = ReactiveElement & {\n disabled: boolean;\n interestForElement: HTMLElement | null;\n popoverTargetAction?: PopoverTargetAction;\n popoverTargetElement: HTMLElement | null;\n};\n\nexport class TypePopoverTriggerController<T extends PopoverTriggerHost> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n this.host.addEventListener('click', this.#onClick);\n }\n\n hostDisconnected() {\n this.host.removeEventListener('click', this.#onClick);\n }\n\n #resolvedPopoverTarget: HTMLElement | null | undefined;\n\n #resolvePopoverTarget() {\n const popoverTargetElement = this.host.popoverTargetElement;\n const controllerResolvedTarget = popoverTargetElement === this.#resolvedPopoverTarget;\n\n if (!this.host.getAttribute('popovertarget')) {\n this.#resolvedPopoverTarget = undefined;\n if (controllerResolvedTarget) {\n this.host.popoverTargetElement = null;\n return null;\n }\n\n return popoverTargetElement;\n }\n\n if (popoverTargetElement && !controllerResolvedTarget) {\n return popoverTargetElement;\n }\n\n const resolvedPopoverTarget =\n getFlattenedDOMTree(this.host.getRootNode()).find(\n element => element.id === this.host.getAttribute('popovertarget')\n ) ?? null;\n if (resolvedPopoverTarget !== popoverTargetElement) {\n this.host.popoverTargetElement = resolvedPopoverTarget;\n }\n this.#resolvedPopoverTarget = resolvedPopoverTarget;\n\n return resolvedPopoverTarget;\n }\n\n #onClick = (event: MouseEvent) => {\n if (event.defaultPrevented || this.host.disabled) {\n return;\n }\n\n const popoverTargetElement = this.#resolvePopoverTarget();\n if (!popoverTargetElement) {\n return;\n }\n\n if (this.#invokePopover(popoverTargetElement)) {\n this.#handoverInterest();\n }\n };\n\n #getPopoverSource(popoverTargetElement: HTMLElement) {\n if ((popoverTargetElement as PopoverAnchorElement).anchor) {\n return getHostAnchor(popoverTargetElement);\n }\n\n return this.host as HTMLElement;\n }\n\n #invokePopover(popoverTargetElement: HTMLElement) {\n if (this.host.popoverTargetAction === 'hide') {\n popoverTargetElement.hidePopover();\n return false;\n }\n\n const source = this.#getPopoverSource(popoverTargetElement);\n if (this.host.popoverTargetAction === 'show') {\n popoverTargetElement.showPopover({ source });\n } else {\n popoverTargetElement.togglePopover({ source });\n }\n\n return popoverTargetElement.matches(':popover-open');\n }\n\n #handoverInterest() {\n if (this.host.interestForElement) {\n const loseInterest = new Event('loseinterest', { cancelable: true }) as InterestEvent;\n loseInterest.source = this.host;\n this.host.interestForElement.dispatchEvent(loseInterest);\n }\n }\n}\n"],"mappings":";;AAiBA,IAAaA,IAAb,MAAsG;CACpG,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EACd,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAQ;CACnD;CAEA,mBAAmB;EACjB,KAAK,KAAK,oBAAoB,SAAS,KAAKA,EAAQ;CACtD;CAEA;CAEA,KAAwB;EACtB,IAAMC,IAAuB,KAAK,KAAK,sBACjCC,IAA2BD,MAAyB,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function t(e) {
|
|
4
|
+
return e.key === " " || e.key === "Enter" || e.code === "Space" || e.code === "Enter";
|
|
5
|
+
}
|
|
6
|
+
var n = class {
|
|
4
7
|
#e;
|
|
5
8
|
#t;
|
|
6
9
|
#n;
|
|
10
|
+
#r = !1;
|
|
7
11
|
constructor(e) {
|
|
8
12
|
this.host = e, this.host.addController(this);
|
|
9
13
|
}
|
|
@@ -11,39 +15,54 @@ var t = class {
|
|
|
11
15
|
return this.#e;
|
|
12
16
|
}
|
|
13
17
|
hostUpdated() {
|
|
14
|
-
this.#
|
|
18
|
+
this.#i(), this.#a(), !this.host.readOnly && !this.host.disabled ? (this.host.addEventListener("click", this.#u), this.host.addEventListener("keydown", this.#s), this.host.addEventListener("keypress", this.#c), this.host.addEventListener("keyup", this.#l), this.host.addEventListener("blur", this.#o)) : this.#o();
|
|
15
19
|
}
|
|
16
20
|
hostDisconnected() {
|
|
17
|
-
this.#
|
|
21
|
+
this.#a(), this.#m(), this.#o();
|
|
18
22
|
}
|
|
19
|
-
#
|
|
23
|
+
#i() {
|
|
20
24
|
!this.host.type && !this.host.hasAttribute("type") && this.host.form instanceof HTMLFormElement && (this.#e = "submit");
|
|
21
25
|
}
|
|
22
|
-
#
|
|
23
|
-
this.host.removeEventListener("click", this.#
|
|
26
|
+
#a() {
|
|
27
|
+
this.host.removeEventListener("click", this.#u), this.host.removeEventListener("keydown", this.#s), this.host.removeEventListener("keypress", this.#c), this.host.removeEventListener("keyup", this.#l), this.host.removeEventListener("blur", this.#o);
|
|
24
28
|
}
|
|
25
|
-
#
|
|
26
|
-
|
|
29
|
+
#o = () => {
|
|
30
|
+
this.#r = !1;
|
|
31
|
+
};
|
|
32
|
+
#s = (e) => {
|
|
33
|
+
e.isTrusted && e.target === this.host && e.key === " " && (this.#r = this.host.matches(":focus"));
|
|
34
|
+
};
|
|
35
|
+
#c = (e) => {
|
|
36
|
+
e.isTrusted && e.target === this.host && e.key === "Enter" && !e.defaultPrevented && this.host.click();
|
|
37
|
+
};
|
|
38
|
+
#l = (e) => {
|
|
39
|
+
if (!e.isTrusted) {
|
|
40
|
+
t(e) && this.host.click();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (e.key !== " " || e.target !== this.host) return;
|
|
44
|
+
let n = this.#r;
|
|
45
|
+
this.#o(), n && !e.defaultPrevented && this.host.click();
|
|
27
46
|
};
|
|
28
|
-
#
|
|
29
|
-
this.host.disabled ? e(t) : this.host.type === "submit" && this.host.form instanceof HTMLFormElement ? this.#
|
|
47
|
+
#u = (t) => {
|
|
48
|
+
this.host.disabled ? e(t) : this.host.type === "submit" && this.host.form instanceof HTMLFormElement ? this.#d(this.host.form) : this.host.type === "reset" && this.host.form instanceof HTMLFormElement && this.host.form.reset();
|
|
30
49
|
};
|
|
31
|
-
#
|
|
32
|
-
this.#
|
|
50
|
+
#d(e) {
|
|
51
|
+
this.#m(), this.#p(), this.#n = e, e.addEventListener("submit", this.#f, { once: !0 }), this.#t?.remove(), e.appendChild(this.#t), e.requestSubmit(this.#t);
|
|
33
52
|
}
|
|
34
|
-
#
|
|
53
|
+
#f = () => {
|
|
35
54
|
let e = this.#t;
|
|
36
55
|
this.#n = void 0, setTimeout(() => {
|
|
37
56
|
e?.remove(), this.#t === e && (this.#t = void 0);
|
|
38
57
|
}, 0);
|
|
39
58
|
};
|
|
40
|
-
#
|
|
59
|
+
#p() {
|
|
41
60
|
this.#t || (this.#t = globalThis.document.createElement("button"), this.#t.type = "submit", this.#t.style.display = "none"), this.#t.name = this.host.name ?? "", this.#t.value = this.host.value ?? "";
|
|
42
61
|
}
|
|
43
|
-
#
|
|
44
|
-
this.#n?.removeEventListener("submit", this.#
|
|
62
|
+
#m() {
|
|
63
|
+
this.#n?.removeEventListener("submit", this.#f), this.#n = void 0, this.#t?.remove(), this.#t = void 0;
|
|
45
64
|
}
|
|
46
65
|
};
|
|
47
|
-
export {
|
|
66
|
+
export { n as TypeSubmitController };
|
|
48
67
|
|
|
49
68
|
//# sourceMappingURL=type-submit.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-submit.controller.js","names":["TypeSubmitController","host","#defaultType","#setButtonType","#removeSubmitBehavior","#onSubmitClick","#onSubmitKeyup","#removeSubmitter","
|
|
1
|
+
{"version":3,"file":"type-submit.controller.js","names":["isActivationKey","event","TypeSubmitController","host","#defaultType","#setButtonType","#removeSubmitBehavior","#onSubmitClick","#onSubmitKeydown","#onSubmitKeypress","#onSubmitKeyup","#clearSpacePress","#removeSubmitter","#spacePressed","pressedHere","stopEvent","#requestSubmit","#createSubmitter","#submitterForm","form","#onSubmit","#submitter","submitter"],"sources":["../../../src/internal/controllers/type-submit.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { stopEvent } from '../utils.js';\nimport type { ButtonType } from '../types/button.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype SubmitHost = ReactiveElement & {\n disabled: boolean;\n form: HTMLFormElement | null | string;\n name?: string;\n readOnly: boolean;\n type?: ButtonType;\n value?: string;\n};\n\nfunction isActivationKey(event: KeyboardEvent) {\n return event.key === ' ' || event.key === 'Enter' || event.code === 'Space' || event.code === 'Enter';\n}\n\nexport class TypeSubmitController<T extends SubmitHost> implements ReactiveController {\n #defaultType: ButtonType | undefined;\n #submitter: HTMLButtonElement | undefined;\n #submitterForm: HTMLFormElement | undefined;\n #spacePressed = false;\n\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n get defaultType() {\n return this.#defaultType;\n }\n\n hostUpdated() {\n this.#setButtonType();\n this.#removeSubmitBehavior();\n if (!this.host.readOnly && !this.host.disabled) {\n this.host.addEventListener('click', this.#onSubmitClick);\n this.host.addEventListener('keydown', this.#onSubmitKeydown);\n this.host.addEventListener('keypress', this.#onSubmitKeypress);\n this.host.addEventListener('keyup', this.#onSubmitKeyup);\n this.host.addEventListener('blur', this.#clearSpacePress);\n } else {\n this.#clearSpacePress();\n }\n }\n\n hostDisconnected() {\n this.#removeSubmitBehavior();\n this.#removeSubmitter();\n this.#clearSpacePress();\n }\n\n #setButtonType() {\n if (!this.host.type && !this.host.hasAttribute('type') && this.host.form instanceof HTMLFormElement) {\n this.#defaultType = 'submit';\n }\n }\n\n #removeSubmitBehavior() {\n this.host.removeEventListener('click', this.#onSubmitClick);\n this.host.removeEventListener('keydown', this.#onSubmitKeydown);\n this.host.removeEventListener('keypress', this.#onSubmitKeypress);\n this.host.removeEventListener('keyup', this.#onSubmitKeyup);\n this.host.removeEventListener('blur', this.#clearSpacePress);\n }\n\n #clearSpacePress = () => {\n this.#spacePressed = false;\n };\n\n #onSubmitKeydown = (event: KeyboardEvent) => {\n if (event.isTrusted && event.target === this.host && event.key === ' ') {\n this.#spacePressed = this.host.matches(':focus');\n }\n };\n\n #onSubmitKeypress = (event: KeyboardEvent) => {\n // Chromium activates Enter on keypress. Clicking on keydown can redirect keypress to a newly focused control.\n if (event.isTrusted && event.target === this.host && event.key === 'Enter' && !event.defaultPrevented) {\n this.host.click();\n }\n };\n\n #onSubmitKeyup = (event: KeyboardEvent) => {\n if (!event.isTrusted) {\n // Keep the existing keyboard event behavior for programmatic callers.\n if (isActivationKey(event)) this.host.click();\n return;\n }\n if (event.key !== ' ' || event.target !== this.host) return;\n\n // Focus can move here while Space is still held on another control.\n const pressedHere = this.#spacePressed;\n this.#clearSpacePress();\n if (pressedHere && !event.defaultPrevented) this.host.click();\n };\n\n #onSubmitClick = (event: Event) => {\n if (this.host.disabled) {\n stopEvent(event);\n return;\n }\n\n if (this.host.type === 'submit' && this.host.form instanceof HTMLFormElement) {\n this.#requestSubmit(this.host.form);\n } else if (this.host.type === 'reset' && this.host.form instanceof HTMLFormElement) {\n this.host.form.reset();\n }\n };\n\n #requestSubmit(form: HTMLFormElement) {\n this.#removeSubmitter();\n this.#createSubmitter();\n this.#submitterForm = form;\n form.addEventListener('submit', this.#onSubmit, { once: true });\n this.#submitter?.remove();\n form.appendChild(this.#submitter!);\n form.requestSubmit(this.#submitter);\n }\n\n #onSubmit = () => {\n const submitter = this.#submitter;\n this.#submitterForm = undefined;\n setTimeout(() => {\n submitter?.remove();\n if (this.#submitter === submitter) {\n this.#submitter = undefined;\n }\n }, 0);\n };\n\n #createSubmitter() {\n if (!this.#submitter) {\n this.#submitter = globalThis.document.createElement('button');\n this.#submitter.type = 'submit';\n this.#submitter.style.display = 'none';\n }\n\n this.#submitter.name = this.host.name ?? '';\n this.#submitter.value = this.host.value ?? '';\n }\n\n #removeSubmitter() {\n this.#submitterForm?.removeEventListener('submit', this.#onSubmit);\n this.#submitterForm = undefined;\n this.#submitter?.remove();\n this.#submitter = undefined;\n }\n}\n"],"mappings":";;AAgBA,SAASA,EAAgB,GAAsB;CAC7C,OAAOC,EAAM,QAAQ,OAAOA,EAAM,QAAQ,WAAWA,EAAM,SAAS,WAAWA,EAAM,SAAS;AAChG;AAEA,IAAaC,IAAb,MAAsF;CACpF;CACA;CACA;CACA,KAAgB;CAEhB,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,IAAI,cAAc;EAChB,OAAO,KAAKC;CACd;CAEA,cAAc;EAGZ,AAFA,KAAKC,GAAe,GACpB,KAAKC,GAAsB,GACvB,CAAC,KAAK,KAAK,YAAY,CAAC,KAAK,KAAK,YACpC,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAc,GACvD,KAAK,KAAK,iBAAiB,WAAW,KAAKC,EAAgB,GAC3D,KAAK,KAAK,iBAAiB,YAAY,KAAKC,EAAiB,GAC7D,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAc,GACvD,KAAK,KAAK,iBAAiB,QAAQ,KAAKC,EAAgB,KAExD,KAAKA,GAAiB;CAE1B;CAEA,mBAAmB;EAGjB,AAFA,KAAKL,GAAsB,GAC3B,KAAKM,GAAiB,GACtB,KAAKD,GAAiB;CAC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K,MAAM;CAEzB;CAEA,GAAe,GAAuB;EAOpC,AANA,KAAKJ,GAAiB,GACtB,KAAKK,GAAiB,GACtB,KAAKC,KAAiBC,GACtBA,EAAK,iBAAiB,UAAU,KAAKC,IAAW,EAAE,MAAM,GAAK,CAAC,GAC9D,KAAKC,IAAY,OAAO,GACxBF,EAAK,YAAY,KAAKE,EAAW,GACjCF,EAAK,cAAc,KAAKE,EAAU;CACpC;CAEA,WAAkB;EAChB,IAAMC,IAAY,KAAKD;EAEvB,AADA,KAAKH,KAAiB,KAAA,GACtB,iBAAiB;GAEf,AADAI,GAAW,OAAO,GACd,KAAKD,OAAeC,MACtB,KAAKD,KAAa,KAAA;EAEtB,GAAG,CAAC;CACN;CAEA,KAAmB;EAQjB,AAPK,KAAKA,OACR,KAAKA,KAAa,WAAW,SAAS,cAAc,QAAQ,GAC5D,KAAKA,GAAW,OAAO,UACvB,KAAKA,GAAW,MAAM,UAAU,SAGlC,KAAKA,GAAW,OAAO,KAAK,KAAK,QAAQ,IACzC,KAAKA,GAAW,QAAQ,KAAK,KAAK,SAAS;CAC7C;CAEA,KAAmB;EAIjB,AAHA,KAAKH,IAAgB,oBAAoB,UAAU,KAAKE,EAAS,GACjE,KAAKF,KAAiB,KAAA,GACtB,KAAKG,IAAY,OAAO,GACxB,KAAKA,KAAa,KAAA;CACpB;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["isObjectLiteral","item","proto","attachInternals","element","toggleState","force","internals","state","getFlattenedDOMTree","getChildren","node","p","i","depth","getHostAnchor","anchor","host","getStringValue","value","hasAttributeValue","attribute","isFormElement","removeEmptyTextNode","setAttributeValue","stopEvent","event","isDocumentNode","isElementWithShadowRoot","isSlotElement","slotted"],"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()
|
|
1
|
+
{"version":3,"file":"utils.js","names":["isObjectLiteral","item","proto","attachInternals","element","toggleState","force","internals","state","getFlattenedDOMTree","getChildren","node","p","i","depth","getHostAnchor","anchor","host","getStringValue","value","hasAttributeValue","attribute","isFormElement","removeEmptyTextNode","setAttributeValue","stopEvent","event","isDocumentNode","isElementWithShadowRoot","isSlotElement","slotted"],"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();\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 };\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;\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 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,SAAgBA,EAAgB,GAAe;CAC7C,IAAI,CAACC,KAAQ,OAAOA,KAAS,Y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
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import { TypeAnchorController as e } from "../internal/controllers/type-anchor.controller.js";
|
|
2
|
+
import { TypeButtonController as t } from "../internal/controllers/type-button.controller.js";
|
|
3
|
+
import { TypeCommandController as n } from "../internal/controllers/type-command.controller.js";
|
|
4
|
+
import { TypeInterestInvokerController as r } from "../internal/controllers/type-interest-invoker.controller.js";
|
|
5
|
+
import { TypeSubmitController as i } from "../internal/controllers/type-submit.controller.js";
|
|
6
|
+
import { TypePopoverTriggerController as a } from "../internal/controllers/type-popover-trigger.controller.js";
|
|
7
|
+
import { StateActiveController as o } from "../internal/controllers/state-active.controller.js";
|
|
8
|
+
import { StateCurrentController as s } from "../internal/controllers/state-current.controller.js";
|
|
9
|
+
import { StateDisabledController as c } from "../internal/controllers/state-disabled.controller.js";
|
|
10
|
+
import { StateExpandedController as l } from "../internal/controllers/state-expanded.controller.js";
|
|
11
|
+
import { StatePressedController as u } from "../internal/controllers/state-pressed.controller.js";
|
|
12
|
+
import { StateReadOnlyController as d } from "../internal/controllers/state-readonly.controller.js";
|
|
13
|
+
import { StateSelectedController as f } from "../internal/controllers/state-selected.controller.js";
|
|
14
|
+
import { attachInternals as p, getFlattenedDOMTree as m, getStringValue as h, hasAttributeValue as g, isFormElement as _, setAttributeValue as v } from "../internal/utils.js";
|
|
15
15
|
// src/mixins/button.ts
|
|
16
16
|
var y = {
|
|
17
17
|
commandfor: "commandForElement",
|
|
@@ -20,12 +20,12 @@ var y = {
|
|
|
20
20
|
};
|
|
21
21
|
function b(b) {
|
|
22
22
|
return class x extends b {
|
|
23
|
-
constructor(...
|
|
24
|
-
super(...
|
|
23
|
+
constructor(...m) {
|
|
24
|
+
super(...m), this.#n = !1, this.#r = {
|
|
25
25
|
commandForElement: null,
|
|
26
26
|
interestForElement: null,
|
|
27
27
|
popoverTargetElement: null
|
|
28
|
-
}, this.#a = null, this.#o = !1, this.#c = /* @__PURE__ */ new Map(), this.#d = !1, this.#p = !1, this._internals =
|
|
28
|
+
}, this.#a = null, this.#o = !1, this.#c = /* @__PURE__ */ new Map(), this.#d = !1, this.#p = !1, this._internals = p(this), this._typeAnchorController = new e(this), this._typeButtonController = new t(this), this._typeSubmitController = new i(this), this._typeCommandController = new n(this), this._typeInterestInvokerController = new r(this), this._typePopoverTriggerController = new a(this), this._stateActiveController = new o(this), this._stateDisabledController = new c(this), this._stateExpandedController = new l(this), this._statePressedController = new u(this), this._stateSelectedController = new f(this), this._stateCurrentController = new s(this), this._stateReadOnlyController = new d(this);
|
|
29
29
|
}
|
|
30
30
|
static {
|
|
31
31
|
this.formAssociated = !0;
|
|
@@ -110,7 +110,7 @@ function b(b) {
|
|
|
110
110
|
if (this.#a && typeof this.#a != "string") return this.#a;
|
|
111
111
|
if (typeof this.#a == "string" && globalThis.document !== void 0) {
|
|
112
112
|
let e = this.getRootNode(), t = e.getElementById ? e.getElementById(this.#a) : null;
|
|
113
|
-
return
|
|
113
|
+
return _(t) ? t : null;
|
|
114
114
|
}
|
|
115
115
|
return this._internals?.form ?? null;
|
|
116
116
|
}
|
|
@@ -211,7 +211,7 @@ function b(b) {
|
|
|
211
211
|
this._controllers ??= /* @__PURE__ */ new Set(), this._controllers.add(e);
|
|
212
212
|
}
|
|
213
213
|
connectedCallback() {
|
|
214
|
-
super.connectedCallback?.(), this._controllers?.forEach((e) => e.hostConnected?.()),
|
|
214
|
+
super.connectedCallback?.(), this._controllers?.forEach((e) => e.hostConnected?.()), p(this), this.#o = !0, this.#N(), this.#_(), this.#g();
|
|
215
215
|
}
|
|
216
216
|
disconnectedCallback() {
|
|
217
217
|
this._controllers?.forEach((e) => e.hostDisconnected?.()), super.disconnectedCallback?.();
|
|
@@ -242,7 +242,7 @@ function b(b) {
|
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
#y(e, t, n) {
|
|
245
|
-
e !== "commandfor" && e !== "interestfor" && e !== "popovertarget" && (e === "form" && (
|
|
245
|
+
e !== "commandfor" && e !== "interestfor" && e !== "popovertarget" && (e === "form" && (_(this.#a) && n === null || (this.#a = n, this.#j("form", t))), e === "popovertargetaction" ? this.#D({
|
|
246
246
|
property: "popoverTargetAction",
|
|
247
247
|
value: n,
|
|
248
248
|
reflect: !1
|
|
@@ -262,15 +262,15 @@ function b(b) {
|
|
|
262
262
|
return this.#r[y[e]] ?? this.#S(this.getAttribute(e));
|
|
263
263
|
}
|
|
264
264
|
#S(e) {
|
|
265
|
-
return e ?
|
|
265
|
+
return e ? m(this.getRootNode()).find((t) => t.id === e) ?? null : null;
|
|
266
266
|
}
|
|
267
267
|
#C(e, t) {
|
|
268
|
-
let n = y[e],
|
|
269
|
-
|
|
268
|
+
let n = y[e], r = this[n];
|
|
269
|
+
r === t && g(this, e, t ? "" : null) || (v(this, e, t ? "" : null), this.#r[n] = t, this.#j(n, r), this.#g());
|
|
270
270
|
}
|
|
271
|
-
#w({ property: e, value: t, reflect: n, attribute:
|
|
272
|
-
let
|
|
273
|
-
(
|
|
271
|
+
#w({ property: e, value: t, reflect: n, attribute: r = e }) {
|
|
272
|
+
let i = this.#T(e);
|
|
273
|
+
(i !== t || n && !g(this, r, t ? "" : null)) && (this.#E(e, t), n && this.#A(r, t ? "" : null) || (this.#j(e, i), this.#g()));
|
|
274
274
|
}
|
|
275
275
|
#T(e) {
|
|
276
276
|
return {
|
|
@@ -284,9 +284,9 @@ function b(b) {
|
|
|
284
284
|
#E(e, t) {
|
|
285
285
|
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);
|
|
286
286
|
}
|
|
287
|
-
#D({ property: e, value: t, attribute:
|
|
288
|
-
let
|
|
289
|
-
(
|
|
287
|
+
#D({ property: e, value: t, attribute: n = e, reflect: r = !0 }) {
|
|
288
|
+
let i = this.#O(e), a = h(t);
|
|
289
|
+
(i !== a || r && !g(this, n, a)) && (this.#k(e, a), r && this.#A(n, a) || (this.#j(e, i), this.#g()));
|
|
290
290
|
}
|
|
291
291
|
#O(e) {
|
|
292
292
|
return {
|
|
@@ -309,7 +309,7 @@ function b(b) {
|
|
|
309
309
|
})[e]?.();
|
|
310
310
|
}
|
|
311
311
|
#A(e, t) {
|
|
312
|
-
return !this.isConnected && !this.#o ? (this.hasAttribute(e) || this.#c.set(e, t), !0) : (
|
|
312
|
+
return !this.isConnected && !this.#o ? (this.hasAttribute(e) || this.#c.set(e, t), !0) : (v(this, e, t), !1);
|
|
313
313
|
}
|
|
314
314
|
#j(e, t) {
|
|
315
315
|
this.requestUpdate?.(e, t);
|
|
@@ -318,7 +318,7 @@ function b(b) {
|
|
|
318
318
|
return this.updateComplete ?? Promise.resolve();
|
|
319
319
|
}
|
|
320
320
|
#N() {
|
|
321
|
-
this.#c.forEach((e, t) =>
|
|
321
|
+
this.#c.forEach((e, t) => v(this, t, e)), this.#c.clear();
|
|
322
322
|
}
|
|
323
323
|
};
|
|
324
324
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["ELEMENT_TARGET_PROPERTIES","ButtonFormControlMixin","ButtonFormControlBase","SuperClass","_args","#disabled","#elementTargets","#form","#hasConnected","#pendingAttributeReflections","#readOnly","#syncQueued","attachInternals","TypeAnchorController","TypeButtonController","TypeSubmitController","TypeCommandController","TypeInterestInvokerController","TypePopoverTriggerController","StateActiveController","StateDisabledController","StateExpandedController","StatePressedController","StateSelectedController","StateCurrentController","StateReadOnlyController","#pressed","#setBooleanState","value","#expanded","oldValue","form","#requestHostUpdate","#queueBehaviorSync","rootNode","isFormElement","#name","#setStringState","#value","#type","#selected","#current","#getElementTarget","#setElementTarget","#popoverTargetAction","#command","controller","#flushPendingAttributeReflections","#syncBehavior","changedProperties","name","newValue","#handleBooleanAttributeChange","#handleElementTargetAttributeChange","#handleStringAttributeChange","#getHostUpdateComplete","property","oldTarget","#getElementById","attribute","id","getFlattenedDOMTree","element","hasAttributeValue","setAttributeValue","#getBooleanValue","reflect","#setBooleanValue","#reflectAttribute","#getStringValue","nextValue","getStringValue","#setStringValue"],"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 {\n ButtonFormControlMixinInstance,\n ButtonType,\n CurrentState,\n PopoverTargetAction\n} from '../internal/types/button.js';\n/** @public */\nexport type {\n ButtonFormControlMixinInstance,\n ButtonType,\n CurrentState,\n PopoverTargetAction\n} from '../internal/types/button.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;\n/** @public\n * @public\n */\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 * @public\n */\n/** @public */\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 || (this._typeAnchorController?.readOnly ?? false);\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":";;;;;;;;;;;;;;;AAiEA,IAAMA,IAA4B;CAChC,YAAY;CACZ,aAAa;CACb,eAAe;AACjB;AAqBA,SAAgBC,EACd,GACqC;CACrC,OAAO,MAAMC,UAA8BC,EAAW;;GA+Mf,A,aA1MzB,KAAAE,KAAA,IACyD,KAAAC,KAAA;IACnE,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;GACxB,GAEyC,KAAAC,KAAA,MACzB,KAAAC,KAAA,IAEe,KAAAC,qBAAA,IAAI,IAA2B,GAGlD,KAAAC,KAAA,IAEE,KAAAC,KAAA,IAID,KAAA,aAAAC,EAAgB,IAAI,GA2KC,KAAA,wBAAA,IAAIC,EAAqB,IAAI,GAC7B,KAAA,wBAAA,IAAIC,EAAqB,IAAI,GAC7B,KAAA,wBAAA,IAAIC,EAAqB,IAAI,GAC5B,KAAA,yBAAA,IAAIC,EAAsB,IAAI,GACtB,KAAA,iCAAA,IAAIC,EAA8B,IAAI,GACvC,KAAA,gCAAA,IAAIC,EAA6B,IAAI,GAC5C,KAAA,yBAAA,IAAIC,EAAsB,IAAI,GAC5B,KAAA,2BAAA,IAAIC,EAAwB,IAAI,GAChC,KAAA,2BAAA,IAAIC,EAAwB,IAAI,GACjC,KAAA,0BAAA,IAAIC,EAAuB,IAAI,GAC9B,KAAA,2BAAA,IAAIC,EAAwB,IAAI,GACjC,KAAA,0BAAA,IAAIC,EAAuB,IAAI,GAC9B,KAAA,2BAAA,IAAIC,EAAwB,IAAI;;;GA9M7C,KAAA,iBAAA;;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;IAC7C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA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AKF,GAAkBT,GAAWW,CAAS,OAG1D,KAAKtC,GAAmBwB,GAAU1B,CAAQ,GAC1C,KAAKG,GAAmB;EAC1B;EAEA,GAAgB,GAAkB;GAChC,OAAO;IACL,SAAS,KAAKY;IACd,SAAS,KAAKJ;IACd,MAAM,KAAKL;IACX,qBAAqB,KAAKQ;IAC1B,MAAM,KAAKL;IACX,OAAO,KAAKD;GACd,EAAEkB;EACJ;EAEA,GAAgB,GAAkB,GAAsB;GAStD,CAAA;IAPE,eAAgB,KAAKX,KAAWjB,KAAS,KAAA;IACzC,eAAgB,KAAKa,KAAWb;IAChC,YAAa,KAAKQ,KAAQR,KAAS,KAAA;IACnC,2BAA4B,KAAKgB,KAAuBhB;IACxD,YAAa,KAAKW,KAAQX;IAC1B,aAAc,KAAKU,KAASV,KAAS,KAAA;GAEvC,EAAA,CAAQ4B,EAAS,GAAG;EACtB;EAEA,GAAkB,GAAmB,GAAsB;GASzD,OARI,CAAC,KAAK,eAAe,CAAC,KAAKhD,MACxB,KAAK,aAAamD,CAAS,KAC9B,KAAKlD,GAA6B,IAAIkD,GAAW/B,CAAK,GAEjD,OAGToC,EAAkB,MAAML,GAAW/B,CAAK,GACjC;EACT;EAEA,GAAmB,GAAe,GAAoB;GACpD,KAAK,gBAAgBsB,GAAMpB,CAAQ;EACrC;EAEA,KAAyB;GACvB,OAAO,KAAK,kBAAkB,QAAQ,QAAQ;EAChD;EAEA,KAAoC;GAElC,AADA,KAAKrB,GAA6B,SAAS,GAAO,MAAcuD,EAAkB,MAAML,GAAW/B,CAAK,CAAC,GACzG,KAAKnB,GAA6B,MAAM;EAC1C;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"button.js","names":["ELEMENT_TARGET_PROPERTIES","ButtonFormControlMixin","ButtonFormControlBase","SuperClass","_args","#disabled","#elementTargets","#form","#hasConnected","#pendingAttributeReflections","#readOnly","#syncQueued","attachInternals","TypeAnchorController","TypeButtonController","TypeSubmitController","TypeCommandController","TypeInterestInvokerController","TypePopoverTriggerController","StateActiveController","StateDisabledController","StateExpandedController","StatePressedController","StateSelectedController","StateCurrentController","StateReadOnlyController","#pressed","#setBooleanState","value","#expanded","oldValue","form","#requestHostUpdate","#queueBehaviorSync","rootNode","isFormElement","#name","#setStringState","#value","#type","#selected","#current","#getElementTarget","#setElementTarget","#popoverTargetAction","#command","controller","#flushPendingAttributeReflections","#syncBehavior","changedProperties","name","newValue","#handleBooleanAttributeChange","#handleElementTargetAttributeChange","#handleStringAttributeChange","#getHostUpdateComplete","property","oldTarget","#getElementById","attribute","id","getFlattenedDOMTree","element","hasAttributeValue","setAttributeValue","#getBooleanValue","reflect","#setBooleanValue","#reflectAttribute","#getStringValue","nextValue","getStringValue","#setStringValue"],"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 {\n ButtonFormControlMixinInstance,\n ButtonType,\n CurrentState,\n PopoverTargetAction\n} from '../internal/types/button.js';\n/** @public */\nexport type {\n ButtonFormControlMixinInstance,\n ButtonType,\n CurrentState,\n PopoverTargetAction\n} from '../internal/types/button.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;\n/** @public\n * @public\n */\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 * @public\n */\n/** @public */\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 || (this._typeAnchorController?.readOnly ?? false);\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":";;;;;;;;;;;;;;;AAiEA,IAAMA,IAA4B;CAChC,YAAY;CACZ,aAAa;CACb,eAAe;AACjB;AAqBA,SAAgBC,EACd,GACqC;CACrC,OAAO,MAAMC,UAA8BC,EAAW;;GA+Mf,A,aA1MzB,KAAAE,KAAA,IACyD,KAAAC,KAAA;IACnE,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;GACxB,GAEyC,KAAAC,KAAA,MACzB,KAAAC,KAAA,IAEe,KAAAC,qBAAA,IAAI,IAA2B,GAGlD,KAAAC,KAAA,IAEE,KAAAC,KAAA,IAID,KAAA,aAAAC,EAAgB,IAAI,GA2KC,KAAA,wBAAA,IAAIC,EAAqB,IAAI,GAC7B,KAAA,wBAAA,IAAIC,EAAqB,IAAI,GAC7B,KAAA,wBAAA,IAAIC,EAAqB,IAAI,GAC5B,KAAA,yBAAA,IAAIC,EAAsB,IAAI,GACtB,KAAA,iCAAA,IAAIC,EAA8B,IAAI,GACvC,KAAA,gCAAA,IAAIC,EAA6B,IAAI,GAC5C,KAAA,yBAAA,IAAIC,EAAsB,IAAI,GAC5B,KAAA,2BAAA,IAAIC,EAAwB,IAAI,GAChC,KAAA,2BAAA,IAAIC,EAAwB,IAAI,GACjC,KAAA,0BAAA,IAAIC,EAAuB,IAAI,GAC9B,KAAA,2BAAA,IAAIC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ElC,AADA,KAAKrB,GAA6B,SAAS,GAAO,MAAcuD,EAAkB,MAAML,GAAW/B,CAAK,CAAC,GACzG,KAAKnB,GAA6B,MAAM;EAC1C;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nvidia-elements/forms",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"release": {
|
|
5
5
|
"extends": "../../release.config.js"
|
|
6
6
|
},
|
|
@@ -85,22 +85,22 @@
|
|
|
85
85
|
"sideEffects": [],
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@eslint/js": "10.0.1",
|
|
88
|
-
"@nvidia-elements/styles": "2.
|
|
88
|
+
"@nvidia-elements/styles": "2.2.0",
|
|
89
89
|
"@internals/testing": "0.0.0",
|
|
90
90
|
"@internals/eslint": "0.0.0",
|
|
91
91
|
"@internals/vite": "0.0.0",
|
|
92
|
-
"@nvidia-elements/lint": "2.
|
|
92
|
+
"@nvidia-elements/lint": "2.10.1",
|
|
93
93
|
"@typescript/lib-dom": "npm:@types/web@0.0.312",
|
|
94
|
-
"@vitest/browser": "5.1.
|
|
95
|
-
"@vitest/coverage-istanbul": "5.1.
|
|
94
|
+
"@vitest/browser": "5.1.1",
|
|
95
|
+
"@vitest/coverage-istanbul": "5.1.1",
|
|
96
96
|
"axe-core": "4.14.0",
|
|
97
|
-
"eslint": "10.
|
|
97
|
+
"eslint": "10.15.0",
|
|
98
98
|
"lit": "3.3.3",
|
|
99
99
|
"publint": "0.3.25",
|
|
100
100
|
"typescript": "6.0.3",
|
|
101
101
|
"typescript-7": "npm:typescript@7.0.2",
|
|
102
|
-
"vite": "8.3.
|
|
103
|
-
"vitest": "5.1.
|
|
102
|
+
"vite": "8.3.8",
|
|
103
|
+
"vitest": "5.1.1"
|
|
104
104
|
},
|
|
105
105
|
"wireit": {
|
|
106
106
|
"dev": {
|