ember-primitives 0.61.1 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/declarations/components/command-palette.d.ts +316 -0
- package/declarations/components/command-palette.d.ts.map +1 -0
- package/declarations/components/dialog.d.ts +51 -1
- package/declarations/components/dialog.d.ts.map +1 -1
- package/declarations/index.d.ts +2 -1
- package/declarations/index.d.ts.map +1 -1
- package/dist/components/command-palette.js +363 -0
- package/dist/components/command-palette.js.map +1 -0
- package/dist/components/dialog.js +50 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/command-palette.gts +719 -0
- package/src/components/dialog.gts +71 -1
- package/src/index.ts +2 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
|
13
13
|
|
|
14
14
|
## Contributors
|
|
15
15
|
|
|
16
|
-
<!-- readme: contributors -start -->
|
|
16
|
+
<!-- readme: contributors/-NullVoxPopuli-ai-agent -start -->
|
|
17
17
|
<table>
|
|
18
18
|
<tbody>
|
|
19
19
|
<tr>
|
|
@@ -112,6 +112,13 @@ See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
|
112
112
|
<sub><b>Martin Muñoz</b></sub>
|
|
113
113
|
</a>
|
|
114
114
|
</td>
|
|
115
|
+
<td align="center">
|
|
116
|
+
<a href="https://github.com/patricklx">
|
|
117
|
+
<img src="https://avatars.githubusercontent.com/u/1332320?v=4" width="100;" alt="patricklx"/>
|
|
118
|
+
<br />
|
|
119
|
+
<sub><b>Patrick Pircher</b></sub>
|
|
120
|
+
</a>
|
|
121
|
+
</td>
|
|
115
122
|
<td align="center">
|
|
116
123
|
<a href="https://github.com/ember-tomster">
|
|
117
124
|
<img src="https://avatars.githubusercontent.com/u/17934356?v=4" width="100;" alt="ember-tomster"/>
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* References:
|
|
3
|
+
* - https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
4
|
+
* - https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-activedescendant
|
|
5
|
+
*
|
|
6
|
+
* A combobox (the input) over a listbox (the results).
|
|
7
|
+
*
|
|
8
|
+
* Focus never leaves the input; `aria-activedescendant` is what moves. This is
|
|
9
|
+
* why there is no tabster mover here: the arrow keys must not move focus, or
|
|
10
|
+
* the user stops being able to type. Tabster still does the finding.
|
|
11
|
+
*
|
|
12
|
+
* Filtering is not this component's job. Render the results you want, in the
|
|
13
|
+
* order you want.
|
|
14
|
+
*/
|
|
15
|
+
import Component from "@glimmer/component";
|
|
16
|
+
import { type Signature as LinkSignature } from './link';
|
|
17
|
+
import type { TOC } from "@ember/component/template-only";
|
|
18
|
+
import type Owner from "@ember/owner";
|
|
19
|
+
import type { ModifierLike, WithBoundArgs } from "@glint/template";
|
|
20
|
+
export interface ItemSignature {
|
|
21
|
+
Element: HTMLDivElement;
|
|
22
|
+
Blocks: {
|
|
23
|
+
default: [];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface PrivateItemSignature {
|
|
27
|
+
Element: ItemSignature["Element"];
|
|
28
|
+
Args: {
|
|
29
|
+
activeId: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
Blocks: ItemSignature["Blocks"];
|
|
32
|
+
}
|
|
33
|
+
declare class Item extends Component<PrivateItemSignature> {
|
|
34
|
+
id: string;
|
|
35
|
+
get isActive(): boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface LinkItemSignature {
|
|
38
|
+
Element: HTMLAnchorElement;
|
|
39
|
+
Args: LinkSignature["Args"];
|
|
40
|
+
Blocks: {
|
|
41
|
+
default: [];
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
interface PrivateLinkItemSignature {
|
|
45
|
+
Element: LinkItemSignature["Element"];
|
|
46
|
+
Args: LinkItemSignature["Args"] & {
|
|
47
|
+
activeId: string | undefined;
|
|
48
|
+
};
|
|
49
|
+
Blocks: LinkItemSignature["Blocks"];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* An option that is also a link. <kbd>Enter</kbd> dispatches a real click on
|
|
53
|
+
* the anchor, so the router navigates exactly as it would have for a mouse.
|
|
54
|
+
*/
|
|
55
|
+
declare class LinkItem extends Component<PrivateLinkItemSignature> {
|
|
56
|
+
id: string;
|
|
57
|
+
get isActive(): boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface ListSignature {
|
|
60
|
+
Element: HTMLDivElement;
|
|
61
|
+
Blocks: {
|
|
62
|
+
default: [
|
|
63
|
+
{
|
|
64
|
+
Item: WithBoundArgs<typeof Item, "activeId">;
|
|
65
|
+
LinkItem: WithBoundArgs<typeof LinkItem, "activeId">;
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
interface PrivateListSignature {
|
|
71
|
+
Element: ListSignature["Element"];
|
|
72
|
+
Args: {
|
|
73
|
+
id: string;
|
|
74
|
+
register: ModifierLike<{
|
|
75
|
+
Element: HTMLElement;
|
|
76
|
+
}>;
|
|
77
|
+
onPointerMove: (event: PointerEvent) => void;
|
|
78
|
+
onClick: (event: MouseEvent) => void;
|
|
79
|
+
Item: ListSignature["Blocks"]["default"][0]["Item"];
|
|
80
|
+
LinkItem: ListSignature["Blocks"]["default"][0]["LinkItem"];
|
|
81
|
+
};
|
|
82
|
+
Blocks: ListSignature["Blocks"];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The pointer is handled here rather than on each option, and on
|
|
86
|
+
* `pointermove` rather than `pointerenter`, so that an option under a resting
|
|
87
|
+
* cursor re-activates when the cursor moves after the keyboard has activated
|
|
88
|
+
* something else. Native menus behave this way.
|
|
89
|
+
*
|
|
90
|
+
* `:hover` cannot do this job. There is one active option, it is what
|
|
91
|
+
* <kbd>Enter</kbd> chooses, and it is what `aria-activedescendant` reports.
|
|
92
|
+
* Hovering while the keyboard has a different option active would light two
|
|
93
|
+
* rows and tell a screen reader about neither, so the pointer sets the same
|
|
94
|
+
* state the arrow keys do instead of painting its own.
|
|
95
|
+
*/
|
|
96
|
+
declare const List: TOC<PrivateListSignature>;
|
|
97
|
+
export interface InputSignature {
|
|
98
|
+
Element: HTMLInputElement;
|
|
99
|
+
}
|
|
100
|
+
interface PrivateInputSignature {
|
|
101
|
+
Element: InputSignature["Element"];
|
|
102
|
+
Args: {
|
|
103
|
+
listId: string;
|
|
104
|
+
activeId: string | undefined;
|
|
105
|
+
query: string;
|
|
106
|
+
onInput: (event: Event) => void;
|
|
107
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
declare const Input: TOC<PrivateInputSignature>;
|
|
111
|
+
/**
|
|
112
|
+
* One entry in the default layout. A bare string is the label.
|
|
113
|
+
*/
|
|
114
|
+
export type PaletteItem = string | {
|
|
115
|
+
label: string;
|
|
116
|
+
description?: string;
|
|
117
|
+
icon?: string;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* The default layout: hand it the rows and it renders the whole palette.
|
|
121
|
+
*/
|
|
122
|
+
export interface ItemsSignature {
|
|
123
|
+
Args: {
|
|
124
|
+
/**
|
|
125
|
+
* The text in the input.
|
|
126
|
+
*
|
|
127
|
+
* The state is managed internally, so this does not need to be a
|
|
128
|
+
* maintained value, but whenever it changes, the input reflects it. Pair
|
|
129
|
+
* it with `@onQueryChange` to keep the query somewhere else, such as a
|
|
130
|
+
* query param.
|
|
131
|
+
*/
|
|
132
|
+
query?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Called with the input's text every time it changes.
|
|
135
|
+
*/
|
|
136
|
+
onQueryChange?: (query: string) => void;
|
|
137
|
+
/**
|
|
138
|
+
* A key combination that calls `@onOpen` from anywhere on the page, such
|
|
139
|
+
* as `"mod+k"`. `mod` is <kbd>Meta</kbd> on macOS and <kbd>Control</kbd>
|
|
140
|
+
* everywhere else.
|
|
141
|
+
*
|
|
142
|
+
* Needs `@onOpen` to have anything to do. No listener is installed
|
|
143
|
+
* without both.
|
|
144
|
+
*/
|
|
145
|
+
hotkey?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Called when `@hotkey` is pressed. Hand it the `open` of whatever the
|
|
148
|
+
* palette is in:
|
|
149
|
+
*
|
|
150
|
+
* ```hbs
|
|
151
|
+
* <CommandPalette @hotkey="mod+k" @onOpen={{d.open}} />
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
onOpen?: () => void;
|
|
155
|
+
/**
|
|
156
|
+
* The entries to render. Each is a string, or an object with a `label`
|
|
157
|
+
* and optionally a `description` and an `icon`.
|
|
158
|
+
*/
|
|
159
|
+
items: PaletteItem[];
|
|
160
|
+
/**
|
|
161
|
+
* Called every time a row is chosen, with the entry that was chosen.
|
|
162
|
+
* This is where a modal palette closes itself:
|
|
163
|
+
*
|
|
164
|
+
* ```hbs
|
|
165
|
+
* <Dialog as |d|>
|
|
166
|
+
* <CommandPalette @items={{this.commands}} @onSelect={{d.close}} />
|
|
167
|
+
* </Dialog>
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* Also where a row's own action goes, since the entry it is handed says
|
|
171
|
+
* which row was chosen.
|
|
172
|
+
*/
|
|
173
|
+
onSelect?: (item: PaletteItem, event: Event) => void;
|
|
174
|
+
/**
|
|
175
|
+
* The input's placeholder, and its accessible name.
|
|
176
|
+
*
|
|
177
|
+
* Defaults to "Search".
|
|
178
|
+
*/
|
|
179
|
+
placeholder?: string;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* No blocks: this form renders the rows. Passing one is an error.
|
|
183
|
+
*/
|
|
184
|
+
Blocks: Record<string, never>;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The composed form: you render the rows.
|
|
188
|
+
*/
|
|
189
|
+
export interface BlockSignature {
|
|
190
|
+
Args: {
|
|
191
|
+
/**
|
|
192
|
+
* The text in the input.
|
|
193
|
+
*
|
|
194
|
+
* The state is managed internally, so this does not need to be a
|
|
195
|
+
* maintained value, but whenever it changes, the input reflects it. Pair
|
|
196
|
+
* it with `@onQueryChange` to keep the query somewhere else, such as a
|
|
197
|
+
* query param.
|
|
198
|
+
*/
|
|
199
|
+
query?: string;
|
|
200
|
+
/**
|
|
201
|
+
* Called with the input's text every time it changes.
|
|
202
|
+
*/
|
|
203
|
+
onQueryChange?: (query: string) => void;
|
|
204
|
+
/**
|
|
205
|
+
* A key combination that calls `@onOpen` from anywhere on the page, such
|
|
206
|
+
* as `"mod+k"`. `mod` is <kbd>Meta</kbd> on macOS and <kbd>Control</kbd>
|
|
207
|
+
* everywhere else.
|
|
208
|
+
*
|
|
209
|
+
* Needs `@onOpen` to have anything to do. No listener is installed
|
|
210
|
+
* without both.
|
|
211
|
+
*/
|
|
212
|
+
hotkey?: string;
|
|
213
|
+
/**
|
|
214
|
+
* Called when `@hotkey` is pressed. Hand it the `open` of whatever the
|
|
215
|
+
* palette is in:
|
|
216
|
+
*
|
|
217
|
+
* ```hbs
|
|
218
|
+
* <CommandPalette @hotkey="mod+k" @onOpen={{d.open}} />
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
onOpen?: () => void;
|
|
222
|
+
/**
|
|
223
|
+
* Not for this form: the rows come from the block.
|
|
224
|
+
*/
|
|
225
|
+
items?: never;
|
|
226
|
+
/**
|
|
227
|
+
* Not for this form: set it on `Input` yourself.
|
|
228
|
+
*/
|
|
229
|
+
placeholder?: never;
|
|
230
|
+
/**
|
|
231
|
+
* Called every time a row is chosen. Hand it `close` to make a modal
|
|
232
|
+
* palette close itself.
|
|
233
|
+
*
|
|
234
|
+
* The rows are yours here, so there is no entry to hand back. Which row
|
|
235
|
+
* was chosen is `event.target.closest("[role=option]")`.
|
|
236
|
+
*/
|
|
237
|
+
onSelect?: (event: Event) => void;
|
|
238
|
+
};
|
|
239
|
+
Blocks: {
|
|
240
|
+
default: [
|
|
241
|
+
{
|
|
242
|
+
/**
|
|
243
|
+
* The current text of the input.
|
|
244
|
+
*/
|
|
245
|
+
query: string;
|
|
246
|
+
/**
|
|
247
|
+
* Sets the text of the input, for a "clear" button or a suggestion.
|
|
248
|
+
*/
|
|
249
|
+
setQuery: (query: string) => void;
|
|
250
|
+
/**
|
|
251
|
+
* The `<input>`, wired as a combobox over `List`.
|
|
252
|
+
*/
|
|
253
|
+
Input: WithBoundArgs<typeof Input, "listId" | "activeId" | "query" | "onInput" | "onKeydown">;
|
|
254
|
+
/**
|
|
255
|
+
* The listbox the rows are rendered into.
|
|
256
|
+
*/
|
|
257
|
+
List: WithBoundArgs<typeof List, "id" | "register" | "onPointerMove" | "onClick" | "Item" | "LinkItem">;
|
|
258
|
+
}
|
|
259
|
+
];
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
export type Signature = ItemsSignature | BlockSignature;
|
|
263
|
+
export declare class CommandPalette extends Component<Signature> {
|
|
264
|
+
#private;
|
|
265
|
+
listId: string;
|
|
266
|
+
/**
|
|
267
|
+
* Which row is active, as an id rather than an element or a focus state.
|
|
268
|
+
*
|
|
269
|
+
* This is unusual for this library, where keyboard navigation means tabster
|
|
270
|
+
* moving focus. A combobox cannot do that: focus has to stay in the
|
|
271
|
+
* `<input>` or the reader stops being able to type. So nothing among the
|
|
272
|
+
* rows is ever focused, there is no focus for tabster to track, and what
|
|
273
|
+
* moves instead is `aria-activedescendant` -- which is an id, on the input,
|
|
274
|
+
* pointing at a row. Holding the id is holding exactly what that attribute
|
|
275
|
+
* needs.
|
|
276
|
+
*
|
|
277
|
+
* Tabster still does the finding, in `#find`. This only remembers which of
|
|
278
|
+
* the rows it landed on.
|
|
279
|
+
*/
|
|
280
|
+
activeId: string | undefined;
|
|
281
|
+
_query: string;
|
|
282
|
+
constructor(owner: Owner, args: Signature["Args"]);
|
|
283
|
+
get placeholder(): string;
|
|
284
|
+
/**
|
|
285
|
+
* Whether `@items` was passed, not whether it has anything in it: an empty
|
|
286
|
+
* array is falsy in a template, and a palette whose results have gone away
|
|
287
|
+
* still has to render the input they would be typed into.
|
|
288
|
+
*/
|
|
289
|
+
get hasItems(): boolean;
|
|
290
|
+
/**
|
|
291
|
+
* `@items` and a block are two ways to say the same thing, and saying both
|
|
292
|
+
* means one of them is being quietly ignored.
|
|
293
|
+
*/
|
|
294
|
+
get bothGiven(): string;
|
|
295
|
+
get query(): string;
|
|
296
|
+
set query(value: string);
|
|
297
|
+
registerList: import("ember-modifier").FunctionBasedModifier<{
|
|
298
|
+
Args: {
|
|
299
|
+
Positional: unknown[];
|
|
300
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
301
|
+
};
|
|
302
|
+
Element: HTMLElement;
|
|
303
|
+
}>;
|
|
304
|
+
setQuery: (query: string) => void;
|
|
305
|
+
handleInput: (event: Event) => void;
|
|
306
|
+
handlePointerMove: (event: PointerEvent) => void;
|
|
307
|
+
handleKeydown: (event: KeyboardEvent) => void;
|
|
308
|
+
handleHotkey: (event: KeyboardEvent) => void;
|
|
309
|
+
/**
|
|
310
|
+
* Choosing is delegated, so a row is markup rather than a listener, and
|
|
311
|
+
* `@onSelect` is reached the same way however the rows were rendered.
|
|
312
|
+
*/
|
|
313
|
+
handleClick: (event: MouseEvent) => void;
|
|
314
|
+
}
|
|
315
|
+
export default CommandPalette;
|
|
316
|
+
//# sourceMappingURL=command-palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-palette.d.ts","sourceRoot":"","sources":["../../src/components/command-palette.gts"],"names":[],"mappings":"AA+sBA;;;;;;;;;;;;;GAaG;AACH,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAgB3C,OAAO,EAAQ,KAAK,SAAS,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,KAAK,MA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"}
|
|
@@ -123,7 +123,57 @@ declare class ModalDialog extends Component<Signature> {
|
|
|
123
123
|
*/
|
|
124
124
|
open: () => void;
|
|
125
125
|
}
|
|
126
|
+
export interface SimpleSignature {
|
|
127
|
+
Element: HTMLDialogElement;
|
|
128
|
+
Blocks: {
|
|
129
|
+
default: [
|
|
130
|
+
{
|
|
131
|
+
/**
|
|
132
|
+
* Opens the dialog, modally.
|
|
133
|
+
*/
|
|
134
|
+
open: () => void;
|
|
135
|
+
/**
|
|
136
|
+
* Closes the dialog.
|
|
137
|
+
*/
|
|
138
|
+
close: () => void;
|
|
139
|
+
}
|
|
140
|
+
];
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A modal `<dialog>` around whatever you put in it, and the two things needed
|
|
145
|
+
* to drive it.
|
|
146
|
+
*
|
|
147
|
+
* ```gjs
|
|
148
|
+
* <Dialog as |d|>
|
|
149
|
+
* <CommandPalette @onSelect={{d.close}} @onOpen={{d.open}} @hotkey="mod+k" />
|
|
150
|
+
* </Dialog>
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
153
|
+
* The element is here, so a trigger cannot be: whatever opens this either
|
|
154
|
+
* lives inside it, or is a key combination. For a dialog opened by a button
|
|
155
|
+
* beside it, use `<Modal>`, which hands you the element to place.
|
|
156
|
+
*
|
|
157
|
+
* <kbd>Escape</kbd> closes it and focus returns to whatever opened it, which
|
|
158
|
+
* is the `<dialog>` element's own behaviour. Set `closedby` to change which
|
|
159
|
+
* actions dismiss it.
|
|
160
|
+
*/
|
|
161
|
+
export declare class Dialog extends Component<SimpleSignature> {
|
|
162
|
+
#private;
|
|
163
|
+
register: import("ember-modifier").FunctionBasedModifier<{
|
|
164
|
+
Args: {
|
|
165
|
+
Positional: unknown[];
|
|
166
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
167
|
+
};
|
|
168
|
+
Element: HTMLDialogElement;
|
|
169
|
+
}>;
|
|
170
|
+
/**
|
|
171
|
+
* `showModal` on an open dialog, and `close` on a closed one, are both
|
|
172
|
+
* no-ops per spec, so neither needs guarding here.
|
|
173
|
+
*/
|
|
174
|
+
open: () => void;
|
|
175
|
+
close: () => void;
|
|
176
|
+
}
|
|
126
177
|
export declare const Modal: typeof ModalDialog;
|
|
127
|
-
export declare const Dialog: typeof ModalDialog;
|
|
128
178
|
export default ModalDialog;
|
|
129
179
|
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.gts"],"names":[],"mappings":"AAgTA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAa3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEnE,QAAA,MAAM,aAAa,EAAE,GAAG,CAAC;IACvB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE;QACJ;;WAEG;QACH,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;QAC1B;;WAEG;QACH,OAAO,EAAE,MAAM,IAAI,CAAC;QAEpB;;WAEG;QACH,QAAQ,EAAE,YAAY,CAAC;YAAE,OAAO,EAAE,iBAAiB,CAAA;SAAE,CAAC,CAAC;KACxD,CAAC;IACF,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB,CAcC,CAAC;AAEH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE;QACJ;;;;;WAKG;QACH,IAAI,CAAC,EAAE,OAAO,CAAC;QACf;;;;;;;;WAQG;QACH,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;KACzC,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE;YAC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package/declarations/index.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ export { Accordion } from './components/accordion';
|
|
|
2
2
|
export type { AccordionContentExternalSignature, AccordionHeaderExternalSignature, AccordionItemExternalSignature, AccordionTriggerExternalSignature, } from './components/accordion/public.ts';
|
|
3
3
|
export { Avatar } from './components/avatar';
|
|
4
4
|
export { Breadcrumb } from './components/breadcrumb';
|
|
5
|
-
export {
|
|
5
|
+
export { CommandPalette } from './components/command-palette';
|
|
6
|
+
export { Dialog, Modal } from './components/dialog';
|
|
6
7
|
export { Drawer } from './components/drawer';
|
|
7
8
|
export { ExternalLink } from './components/external-link';
|
|
8
9
|
export { Form } from './components/form';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,YAAY,EACV,iCAAiC,EACjC,gCAAgC,EAChC,8BAA8B,EAC9B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,YAAY,EACV,iCAAiC,EACjC,gCAAgC,EAChC,8BAA8B,EAC9B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAC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