@openelement/ui 1.0.0-alpha.6 → 1.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/package.json +8 -3
- package/src/component-recipes.js +60 -60
- package/src/generated-manifest.json +2 -2
- package/src/index.d.ts +15 -43
- package/src/index.js +15 -50
- package/src/instance-state.d.ts +16 -2
- package/src/instance-state.js +30 -24
- package/src/manifest.d.ts +5 -9
- package/src/manifest.js +6 -11
- package/src/open-badge.d.ts +113 -159
- package/src/open-badge.js +185 -239
- package/src/open-button.d.ts +296 -898
- package/src/open-button.js +1129 -1322
- package/src/open-callout.d.ts +225 -366
- package/src/open-callout.js +471 -569
- package/src/open-card.d.ts +114 -144
- package/src/open-card.js +182 -251
- package/src/open-code-block.d.ts +165 -168
- package/src/open-code-block.js +300 -366
- package/src/open-dialog.d.ts +241 -424
- package/src/open-dialog.js +626 -823
- package/src/open-dropdown.d.ts +195 -252
- package/src/open-dropdown.js +351 -471
- package/src/open-input.d.ts +404 -1420
- package/src/open-input.js +1788 -2095
- package/src/open-props-tokens.d.ts +5 -5
- package/src/open-props-tokens.js +13 -8
- package/src/open-tabs.d.ts +163 -191
- package/src/open-tabs.js +291 -361
- package/src/open-theme-toggle.d.ts +171 -287
- package/src/open-theme-toggle.js +513 -754
- package/src/register.d.ts +4 -1
- package/src/register.js +27 -58
package/src/open-dropdown.js
CHANGED
|
@@ -1,395 +1,299 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { readInstanceState, writeInstanceState } from "./instance-state.js";
|
|
2
|
+
import { deepActiveElement, nextInstanceId, overlayRecipe, recipe } from "./component-recipes.js";
|
|
3
|
+
import { OpenElement, computed } from "@openelement/element";
|
|
4
|
+
//#region src/open-dropdown.tsx
|
|
5
5
|
const __partProgram = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
"path": [
|
|
212
|
-
0,
|
|
213
|
-
1
|
|
214
|
-
]
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
"id": "p2",
|
|
218
|
-
"kind": "sink",
|
|
219
|
-
"part": 2,
|
|
220
|
-
"node": "e3",
|
|
221
|
-
"path": [
|
|
222
|
-
0,
|
|
223
|
-
1
|
|
224
|
-
]
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
"id": "e4",
|
|
228
|
-
"kind": "element",
|
|
229
|
-
"tag": "slot",
|
|
230
|
-
"path": [
|
|
231
|
-
0,
|
|
232
|
-
1,
|
|
233
|
-
0
|
|
234
|
-
]
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
|
-
"metadata": {
|
|
238
|
-
"tag": "open-dropdown",
|
|
239
|
-
"className": "OpenDropdown",
|
|
240
|
-
"sourceFile": "open-dropdown.tsx",
|
|
241
|
-
"properties": [
|
|
242
|
-
{
|
|
243
|
-
"name": "anchorName",
|
|
244
|
-
"attribute": null,
|
|
245
|
-
"type": "string",
|
|
246
|
-
"converter": "string",
|
|
247
|
-
"reflect": false,
|
|
248
|
-
"default": ""
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
"name": "anchorStyle",
|
|
252
|
-
"attribute": null,
|
|
253
|
-
"type": "string",
|
|
254
|
-
"converter": "string",
|
|
255
|
-
"reflect": false,
|
|
256
|
-
"default": null,
|
|
257
|
-
"computed": true,
|
|
258
|
-
"deps": [
|
|
259
|
-
"anchorName"
|
|
260
|
-
]
|
|
261
|
-
}
|
|
262
|
-
],
|
|
263
|
-
"observedAttributes": [],
|
|
264
|
-
"cem": {
|
|
265
|
-
"tagName": "open-dropdown",
|
|
266
|
-
"className": "OpenDropdown",
|
|
267
|
-
"declaration": {
|
|
268
|
-
"name": "OpenDropdown",
|
|
269
|
-
"module": "open-dropdown.tsx"
|
|
270
|
-
},
|
|
271
|
-
"attributes": [],
|
|
272
|
-
"members": [
|
|
273
|
-
{
|
|
274
|
-
"name": "anchorName",
|
|
275
|
-
"fieldName": "anchorName",
|
|
276
|
-
"type": "string",
|
|
277
|
-
"attribute": null,
|
|
278
|
-
"reflect": false
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
"name": "anchorStyle",
|
|
282
|
-
"fieldName": "anchorStyle",
|
|
283
|
-
"type": "string",
|
|
284
|
-
"attribute": null,
|
|
285
|
-
"reflect": false
|
|
286
|
-
}
|
|
287
|
-
]
|
|
288
|
-
}
|
|
289
|
-
}
|
|
6
|
+
"version": 1,
|
|
7
|
+
"tag": "open-dropdown",
|
|
8
|
+
"root": {
|
|
9
|
+
"id": "root",
|
|
10
|
+
"kind": "shadow-open",
|
|
11
|
+
"nodes": ["e0"]
|
|
12
|
+
},
|
|
13
|
+
"template": [{
|
|
14
|
+
"k": "el",
|
|
15
|
+
"id": "e0",
|
|
16
|
+
"tag": "div",
|
|
17
|
+
"attrs": [],
|
|
18
|
+
"children": [{
|
|
19
|
+
"k": "el",
|
|
20
|
+
"id": "e1",
|
|
21
|
+
"tag": "span",
|
|
22
|
+
"attrs": [["class", "trigger"], ["part", "trigger"]],
|
|
23
|
+
"children": [{
|
|
24
|
+
"k": "el",
|
|
25
|
+
"id": "e2",
|
|
26
|
+
"tag": "slot",
|
|
27
|
+
"attrs": [["name", "trigger"]],
|
|
28
|
+
"children": []
|
|
29
|
+
}]
|
|
30
|
+
}, {
|
|
31
|
+
"k": "el",
|
|
32
|
+
"id": "e3",
|
|
33
|
+
"tag": "div",
|
|
34
|
+
"attrs": [
|
|
35
|
+
["class", "overlay content"],
|
|
36
|
+
["part", "content"],
|
|
37
|
+
["popover", "auto"]
|
|
38
|
+
],
|
|
39
|
+
"children": [{
|
|
40
|
+
"k": "el",
|
|
41
|
+
"id": "e4",
|
|
42
|
+
"tag": "slot",
|
|
43
|
+
"attrs": [],
|
|
44
|
+
"children": []
|
|
45
|
+
}]
|
|
46
|
+
}]
|
|
47
|
+
}],
|
|
48
|
+
"parts": [
|
|
49
|
+
{
|
|
50
|
+
"k": "event",
|
|
51
|
+
"event": "pointerdown",
|
|
52
|
+
"handler": "onTriggerPointerDown",
|
|
53
|
+
"action": {
|
|
54
|
+
"kind": "method",
|
|
55
|
+
"name": "onTriggerPointerDown"
|
|
56
|
+
},
|
|
57
|
+
"path": [0, 0],
|
|
58
|
+
"index": 0,
|
|
59
|
+
"location": {
|
|
60
|
+
"id": "p0",
|
|
61
|
+
"kind": "sink",
|
|
62
|
+
"path": [0, 0],
|
|
63
|
+
"node": "e1"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"k": "event",
|
|
68
|
+
"event": "click",
|
|
69
|
+
"handler": "toggle",
|
|
70
|
+
"action": {
|
|
71
|
+
"kind": "method",
|
|
72
|
+
"name": "toggle"
|
|
73
|
+
},
|
|
74
|
+
"path": [0, 0],
|
|
75
|
+
"index": 1,
|
|
76
|
+
"location": {
|
|
77
|
+
"id": "p1",
|
|
78
|
+
"kind": "sink",
|
|
79
|
+
"path": [0, 0],
|
|
80
|
+
"node": "e1"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"k": "style",
|
|
85
|
+
"signal": "anchorStyle",
|
|
86
|
+
"path": [0, 1],
|
|
87
|
+
"index": 2,
|
|
88
|
+
"location": {
|
|
89
|
+
"id": "p2",
|
|
90
|
+
"kind": "sink",
|
|
91
|
+
"path": [0, 1],
|
|
92
|
+
"node": "e3"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"regions": [],
|
|
97
|
+
"dependencies": [{
|
|
98
|
+
"signal": "anchorStyle",
|
|
99
|
+
"owner": {
|
|
100
|
+
"kind": "part",
|
|
101
|
+
"index": 2
|
|
102
|
+
},
|
|
103
|
+
"location": "p2"
|
|
104
|
+
}],
|
|
105
|
+
"locations": [
|
|
106
|
+
{
|
|
107
|
+
"id": "e0",
|
|
108
|
+
"kind": "element",
|
|
109
|
+
"tag": "div",
|
|
110
|
+
"path": [0]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"id": "e1",
|
|
114
|
+
"kind": "element",
|
|
115
|
+
"tag": "span",
|
|
116
|
+
"path": [0, 0]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "p0",
|
|
120
|
+
"kind": "sink",
|
|
121
|
+
"part": 0,
|
|
122
|
+
"node": "e1",
|
|
123
|
+
"path": [0, 0]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"id": "p1",
|
|
127
|
+
"kind": "sink",
|
|
128
|
+
"part": 1,
|
|
129
|
+
"node": "e1",
|
|
130
|
+
"path": [0, 0]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"id": "e2",
|
|
134
|
+
"kind": "element",
|
|
135
|
+
"tag": "slot",
|
|
136
|
+
"path": [
|
|
137
|
+
0,
|
|
138
|
+
0,
|
|
139
|
+
0
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"id": "e3",
|
|
144
|
+
"kind": "element",
|
|
145
|
+
"tag": "div",
|
|
146
|
+
"path": [0, 1]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"id": "p2",
|
|
150
|
+
"kind": "sink",
|
|
151
|
+
"part": 2,
|
|
152
|
+
"node": "e3",
|
|
153
|
+
"path": [0, 1]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "e4",
|
|
157
|
+
"kind": "element",
|
|
158
|
+
"tag": "slot",
|
|
159
|
+
"path": [
|
|
160
|
+
0,
|
|
161
|
+
1,
|
|
162
|
+
0
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"metadata": {
|
|
167
|
+
"tag": "open-dropdown",
|
|
168
|
+
"className": "OpenDropdown",
|
|
169
|
+
"sourceFile": "open-dropdown.tsx",
|
|
170
|
+
"properties": [{
|
|
171
|
+
"name": "anchorName",
|
|
172
|
+
"attribute": null,
|
|
173
|
+
"type": "string",
|
|
174
|
+
"converter": "string",
|
|
175
|
+
"reflect": false,
|
|
176
|
+
"default": ""
|
|
177
|
+
}, {
|
|
178
|
+
"name": "anchorStyle",
|
|
179
|
+
"attribute": null,
|
|
180
|
+
"type": "string",
|
|
181
|
+
"converter": "string",
|
|
182
|
+
"reflect": false,
|
|
183
|
+
"default": null,
|
|
184
|
+
"computed": true,
|
|
185
|
+
"deps": ["anchorName"]
|
|
186
|
+
}],
|
|
187
|
+
"observedAttributes": [],
|
|
188
|
+
"cem": {
|
|
189
|
+
"tagName": "open-dropdown",
|
|
190
|
+
"className": "OpenDropdown",
|
|
191
|
+
"declaration": {
|
|
192
|
+
"name": "OpenDropdown",
|
|
193
|
+
"module": "open-dropdown.tsx"
|
|
194
|
+
},
|
|
195
|
+
"attributes": [],
|
|
196
|
+
"members": [{
|
|
197
|
+
"name": "anchorName",
|
|
198
|
+
"fieldName": "anchorName",
|
|
199
|
+
"type": "string",
|
|
200
|
+
"attribute": null,
|
|
201
|
+
"reflect": false
|
|
202
|
+
}, {
|
|
203
|
+
"name": "anchorStyle",
|
|
204
|
+
"fieldName": "anchorStyle",
|
|
205
|
+
"type": "string",
|
|
206
|
+
"attribute": null,
|
|
207
|
+
"reflect": false
|
|
208
|
+
}]
|
|
209
|
+
}
|
|
210
|
+
}
|
|
290
211
|
};
|
|
291
|
-
const __compiledProperties = [
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
"deps": [
|
|
309
|
-
"anchorName"
|
|
310
|
-
]
|
|
311
|
-
}
|
|
312
|
-
];
|
|
212
|
+
const __compiledProperties = [{
|
|
213
|
+
"name": "anchorName",
|
|
214
|
+
"attribute": null,
|
|
215
|
+
"type": "string",
|
|
216
|
+
"converter": "string",
|
|
217
|
+
"reflect": false,
|
|
218
|
+
"default": ""
|
|
219
|
+
}, {
|
|
220
|
+
"name": "anchorStyle",
|
|
221
|
+
"attribute": null,
|
|
222
|
+
"type": "string",
|
|
223
|
+
"converter": "string",
|
|
224
|
+
"reflect": false,
|
|
225
|
+
"default": null,
|
|
226
|
+
"computed": true,
|
|
227
|
+
"deps": ["anchorName"]
|
|
228
|
+
}];
|
|
313
229
|
const __elementMetadata = {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
"name": "anchorStyle",
|
|
358
|
-
"fieldName": "anchorStyle",
|
|
359
|
-
"type": "string",
|
|
360
|
-
"attribute": null,
|
|
361
|
-
"reflect": false
|
|
362
|
-
}
|
|
363
|
-
]
|
|
364
|
-
}
|
|
230
|
+
"tag": "open-dropdown",
|
|
231
|
+
"className": "OpenDropdown",
|
|
232
|
+
"sourceFile": "open-dropdown.tsx",
|
|
233
|
+
"properties": [{
|
|
234
|
+
"name": "anchorName",
|
|
235
|
+
"attribute": null,
|
|
236
|
+
"type": "string",
|
|
237
|
+
"converter": "string",
|
|
238
|
+
"reflect": false,
|
|
239
|
+
"default": ""
|
|
240
|
+
}, {
|
|
241
|
+
"name": "anchorStyle",
|
|
242
|
+
"attribute": null,
|
|
243
|
+
"type": "string",
|
|
244
|
+
"converter": "string",
|
|
245
|
+
"reflect": false,
|
|
246
|
+
"default": null,
|
|
247
|
+
"computed": true,
|
|
248
|
+
"deps": ["anchorName"]
|
|
249
|
+
}],
|
|
250
|
+
"observedAttributes": [],
|
|
251
|
+
"cem": {
|
|
252
|
+
"tagName": "open-dropdown",
|
|
253
|
+
"className": "OpenDropdown",
|
|
254
|
+
"declaration": {
|
|
255
|
+
"name": "OpenDropdown",
|
|
256
|
+
"module": "open-dropdown.tsx"
|
|
257
|
+
},
|
|
258
|
+
"attributes": [],
|
|
259
|
+
"members": [{
|
|
260
|
+
"name": "anchorName",
|
|
261
|
+
"fieldName": "anchorName",
|
|
262
|
+
"type": "string",
|
|
263
|
+
"attribute": null,
|
|
264
|
+
"reflect": false
|
|
265
|
+
}, {
|
|
266
|
+
"name": "anchorStyle",
|
|
267
|
+
"fieldName": "anchorStyle",
|
|
268
|
+
"type": "string",
|
|
269
|
+
"attribute": null,
|
|
270
|
+
"reflect": false
|
|
271
|
+
}]
|
|
272
|
+
}
|
|
365
273
|
};
|
|
366
274
|
const __observedAttributes = [];
|
|
367
275
|
const __compiledProps = {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
276
|
+
anchorName: {
|
|
277
|
+
type: String,
|
|
278
|
+
default: "",
|
|
279
|
+
reflect: false,
|
|
280
|
+
attribute: false
|
|
281
|
+
},
|
|
282
|
+
anchorStyle: {
|
|
283
|
+
type: Object,
|
|
284
|
+
default: void 0,
|
|
285
|
+
reflect: false,
|
|
286
|
+
attribute: false
|
|
287
|
+
}
|
|
380
288
|
};
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
};
|
|
390
|
-
static styles = [
|
|
391
|
-
overlayRecipe,
|
|
392
|
-
recipe(`
|
|
289
|
+
var OpenDropdown = class extends OpenElement {
|
|
290
|
+
static __partProgram = __partProgram;
|
|
291
|
+
static __compiledProperties = __compiledProperties;
|
|
292
|
+
static __elementMetadata = __elementMetadata;
|
|
293
|
+
static props = __compiledProps;
|
|
294
|
+
static observedAttributes = __observedAttributes;
|
|
295
|
+
static __computedFields = { anchorStyle: (__s) => computed(() => __s.anchorName.value === "" ? "" : `position-anchor: ${__s.anchorName.value}`) };
|
|
296
|
+
static styles = [overlayRecipe, recipe(`
|
|
393
297
|
:host {
|
|
394
298
|
display: inline-block;
|
|
395
299
|
}
|
|
@@ -413,89 +317,65 @@ export class OpenDropdown extends OpenElement {
|
|
|
413
317
|
padding: var(--size-2);
|
|
414
318
|
font-family: var(--font-sans);
|
|
415
319
|
}
|
|
416
|
-
`)
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
onTriggerPointerDown() {
|
|
479
|
-
const content = this.shadowRoot?.querySelector('.content');
|
|
480
|
-
writeInstanceState(this, 'openAtPointerDown', content?.matches(':popover-open') ?? false);
|
|
481
|
-
}
|
|
482
|
-
toggle() {
|
|
483
|
-
// A mouse click on the trigger is preceded by a pointerdown that natively
|
|
484
|
-
// light-dismisses an open popover; the click that follows must not re-open
|
|
485
|
-
// it. Keyboard/programmatic clicks have no pointerdown and toggle normally.
|
|
486
|
-
const wasOpen = readInstanceState(this, 'openAtPointerDown', ()=>false);
|
|
487
|
-
writeInstanceState(this, 'openAtPointerDown', false);
|
|
488
|
-
if (wasOpen) return;
|
|
489
|
-
const content = this.shadowRoot?.querySelector('.content');
|
|
490
|
-
if (!content) return;
|
|
491
|
-
// watchFocusReturn's synchronous 'beforetoggle' listener is the single
|
|
492
|
-
// owner of the return-focus capture (#1226); it runs inside
|
|
493
|
-
// togglePopover() before the open flip, so nothing can move focus between
|
|
494
|
-
// this call and the capture.
|
|
495
|
-
content.togglePopover();
|
|
496
|
-
}
|
|
497
|
-
render() {
|
|
498
|
-
throw new Error('[open:compiled-element] open-dropdown is compiled to a Part Program; the runtime JSX render path is not available.');
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
export { __partProgram, __elementMetadata };
|
|
320
|
+
`)];
|
|
321
|
+
anchorName = "";
|
|
322
|
+
onDsdHydrated() {
|
|
323
|
+
this.syncAnchorName();
|
|
324
|
+
this.watchFocusReturn();
|
|
325
|
+
}
|
|
326
|
+
onCsrRendered() {
|
|
327
|
+
this.syncAnchorName();
|
|
328
|
+
this.watchFocusReturn();
|
|
329
|
+
}
|
|
330
|
+
watchFocusReturn() {
|
|
331
|
+
if (readInstanceState(this, "focusWired", () => false)) return;
|
|
332
|
+
writeInstanceState(this, "focusWired", true);
|
|
333
|
+
const content = this.shadowRoot?.querySelector(".content");
|
|
334
|
+
if (!content) return;
|
|
335
|
+
content.addEventListener("focusin", () => {
|
|
336
|
+
writeInstanceState(this, "popoverHadFocus", true);
|
|
337
|
+
});
|
|
338
|
+
content.addEventListener("beforetoggle", (event) => {
|
|
339
|
+
if (event.newState !== "open") return;
|
|
340
|
+
writeInstanceState(this, "popoverHadFocus", false);
|
|
341
|
+
writeInstanceState(this, "previouslyFocused", deepActiveElement());
|
|
342
|
+
});
|
|
343
|
+
content.addEventListener("toggle", (event) => {
|
|
344
|
+
if (event.newState !== "closed") return;
|
|
345
|
+
const hadFocus = readInstanceState(this, "popoverHadFocus", () => false);
|
|
346
|
+
const previous = readInstanceState(this, "previouslyFocused", () => null);
|
|
347
|
+
writeInstanceState(this, "previouslyFocused", null);
|
|
348
|
+
if (!hadFocus || !previous?.isConnected) return;
|
|
349
|
+
queueMicrotask(() => {
|
|
350
|
+
if (!previous.isConnected) return;
|
|
351
|
+
const active = deepActiveElement();
|
|
352
|
+
if (active === previous) return;
|
|
353
|
+
const focusInside = active !== null && (this.contains(active) || content.contains(active));
|
|
354
|
+
const dropped = !active || active === document.body || active === document.documentElement;
|
|
355
|
+
if (!focusInside && !dropped) return;
|
|
356
|
+
previous.focus();
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
syncAnchorName() {
|
|
361
|
+
if (this.anchorName === "") this.anchorName = `--open-dropdown-trigger-${nextInstanceId()}`;
|
|
362
|
+
this.style.setProperty("anchor-name", this.anchorName);
|
|
363
|
+
}
|
|
364
|
+
onTriggerPointerDown() {
|
|
365
|
+
const content = this.shadowRoot?.querySelector(".content");
|
|
366
|
+
writeInstanceState(this, "openAtPointerDown", content?.matches(":popover-open") ?? false);
|
|
367
|
+
}
|
|
368
|
+
toggle() {
|
|
369
|
+
const wasOpen = readInstanceState(this, "openAtPointerDown", () => false);
|
|
370
|
+
writeInstanceState(this, "openAtPointerDown", false);
|
|
371
|
+
if (wasOpen) return;
|
|
372
|
+
const content = this.shadowRoot?.querySelector(".content");
|
|
373
|
+
if (!content) return;
|
|
374
|
+
content.togglePopover();
|
|
375
|
+
}
|
|
376
|
+
render() {
|
|
377
|
+
throw new Error("[open:compiled-element] open-dropdown is compiled to a Part Program; the runtime JSX render path is not available.");
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
//#endregion
|
|
381
|
+
export { OpenDropdown, __elementMetadata, __partProgram };
|