ember-primitives 0.61.1 → 0.63.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/accordion/content.d.ts +2 -1
- package/declarations/components/accordion/content.d.ts.map +1 -1
- package/declarations/components/accordion/header.d.ts +2 -1
- package/declarations/components/accordion/header.d.ts.map +1 -1
- package/declarations/components/accordion/item.d.ts +7 -0
- package/declarations/components/accordion/item.d.ts.map +1 -1
- package/declarations/components/accordion/public.d.ts +3 -3
- package/declarations/components/accordion/public.d.ts.map +1 -1
- package/declarations/components/accordion/trigger.d.ts +2 -1
- package/declarations/components/accordion/trigger.d.ts.map +1 -1
- package/declarations/components/command-palette.d.ts +329 -0
- package/declarations/components/command-palette.d.ts.map +1 -0
- package/declarations/components/dialog.d.ts +65 -7
- package/declarations/components/dialog.d.ts.map +1 -1
- package/declarations/components/drawer.d.ts +14 -6
- package/declarations/components/drawer.d.ts.map +1 -1
- package/declarations/components/link.d.ts.map +1 -1
- package/declarations/components/menu.d.ts.map +1 -1
- package/declarations/components/one-time-password/otp.d.ts +1 -1
- package/declarations/components/one-time-password/utils.d.ts.map +1 -1
- package/declarations/components/rating/range.d.ts +1 -0
- package/declarations/components/rating/range.d.ts.map +1 -1
- package/declarations/components/rating/rating.d.ts +1 -1
- package/declarations/components/rating/rating.d.ts.map +1 -1
- package/declarations/components/rating/stars.d.ts.map +1 -1
- package/declarations/components/rating/state.d.ts +1 -0
- package/declarations/components/rating/state.d.ts.map +1 -1
- package/declarations/components/slider.d.ts +2 -0
- package/declarations/components/slider.d.ts.map +1 -1
- package/declarations/components/switch.d.ts +5 -1
- package/declarations/components/switch.d.ts.map +1 -1
- package/declarations/components/tabs.d.ts +30 -1
- package/declarations/components/tabs.d.ts.map +1 -1
- package/declarations/components/zoetrope/index.d.ts.map +1 -1
- package/declarations/index.d.ts +2 -1
- package/declarations/index.d.ts.map +1 -1
- package/dist/components/accordion.js +12 -4
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/command-palette.js +370 -0
- package/dist/components/command-palette.js.map +1 -0
- package/dist/components/dialog.js +59 -3
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/drawer.js +9 -2
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/link.js.map +1 -1
- package/dist/components/menu.js +5 -1
- package/dist/components/menu.js.map +1 -1
- package/dist/components/one-time-password.js +1 -1
- package/dist/components/rating.js +1 -1
- package/dist/components/slider.js +6 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/switch.js.map +1 -1
- package/dist/components/tabs.js +18 -5
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/zoetrope/styles.css +6 -1
- package/dist/components/zoetrope.js +1 -1
- package/dist/{index-gRO4Cvlf.js → index-B-yrfUe9.js} +10 -3
- package/dist/index-B-yrfUe9.js.map +1 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/{otp-H5a4B4yu.js → otp-C8c1EIw6.js} +27 -15
- package/dist/otp-C8c1EIw6.js.map +1 -0
- package/dist/{rating-BrIiwDLw.js → rating-CKWhrr-L.js} +9 -5
- package/dist/rating-CKWhrr-L.js.map +1 -0
- package/package.json +2 -1
- package/src/components/accordion/content.gts +4 -2
- package/src/components/accordion/header.gts +8 -2
- package/src/components/accordion/item.gts +18 -2
- package/src/components/accordion/public.ts +12 -3
- package/src/components/accordion/trigger.gts +5 -3
- package/src/components/command-palette.gts +741 -0
- package/src/components/dialog.gts +86 -4
- package/src/components/drawer.gts +15 -3
- package/src/components/link.gts +1 -0
- package/src/components/menu.gts +7 -0
- package/src/components/one-time-password/input.gts +1 -1
- package/src/components/one-time-password/otp.gts +1 -1
- package/src/components/one-time-password/utils.ts +26 -13
- package/src/components/rating/range.gts +3 -0
- package/src/components/rating/rating.gts +7 -2
- package/src/components/rating/stars.gts +0 -1
- package/src/components/rating/state.gts +9 -0
- package/src/components/slider.gts +8 -0
- package/src/components/switch.gts +5 -2
- package/src/components/tabs.gts +35 -4
- package/src/components/zoetrope/index.gts +12 -3
- package/src/components/zoetrope/styles.css +6 -1
- package/src/index.ts +2 -1
- package/dist/index-gRO4Cvlf.js.map +0 -1
- package/dist/otp-H5a4B4yu.js.map +0 -1
- package/dist/rating-BrIiwDLw.js.map +0 -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"/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/content.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/content.gts"],"names":[],"mappings":"AAoCA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAI3C,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAErE,UAAU,SAAU,SAAQ,iCAAiC;IAC3D,IAAI,EAAE;QACJ,UAAU,EAAE,OAAO,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;CACH;AAED,qBAAa,gBAAiB,SAAQ,SAAS,CAAC,SAAS,CAAC;IAyBxD,IAAI,QAAQ,YAEX;CACF;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -2,7 +2,8 @@ import type { AccordionHeaderExternalSignature } from "./public.ts";
|
|
|
2
2
|
import type { TOC } from "@ember/component/template-only";
|
|
3
3
|
interface Signature extends AccordionHeaderExternalSignature {
|
|
4
4
|
Args: {
|
|
5
|
-
|
|
5
|
+
triggerId: string;
|
|
6
|
+
contentId: string;
|
|
6
7
|
isExpanded: boolean;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
toggleItem: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/header.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/header.gts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAE1D,UAAU,SAAU,SAAQ,gCAAgC;IAC1D,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,OAAO,CAAC;QACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,UAAU,EAAE,MAAM,IAAI,CAAC;KACxB,CAAC;CACH;AAED,eAAO,MAAM,eAAe,EAAE,GAAG,CAAC,SAAS,CAoBzC,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -9,6 +9,13 @@ interface Signature extends AccordionItemExternalSignature {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
export declare class AccordionItem extends Component<Signature> {
|
|
12
|
+
/**
|
|
13
|
+
* `@value` only has to be unique within one accordion.
|
|
14
|
+
* Element ids have to be unique across the document.
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
triggerId: string;
|
|
18
|
+
contentId: string;
|
|
12
19
|
get isExpanded(): boolean;
|
|
13
20
|
toggleItem: () => void;
|
|
14
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/item.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/item.gts"],"names":[],"mappings":"AAuEA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAO3C,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAElE,wBAAgB,YAAY,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,CAExD;AAED,UAAU,SAAU,SAAQ,8BAA8B;IACxD,IAAI,EAAE,8BAA8B,CAAC,MAAM,CAAC,GAAG;QAC7C,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;KACrC,CAAC;CACH;AAED,qBAAa,aAAc,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrD;;;OAGG;IACH,EAAE,SAA+C;IACjD,SAAS,SAAyB;IAClC,SAAS,SAAyB;IAsBlC,IAAI,UAAU,IAAI,OAAO,CAMxB;IAED,UAAU,QAAO,IAAI,CAInB;CACH;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -26,7 +26,7 @@ export interface AccordionHeaderExternalSignature {
|
|
|
26
26
|
/**
|
|
27
27
|
* The AccordionTrigger component.
|
|
28
28
|
*/
|
|
29
|
-
Trigger: WithBoundArgs<typeof Trigger, '
|
|
29
|
+
Trigger: WithBoundArgs<typeof Trigger, 'triggerId' | 'contentId' | 'isExpanded' | 'disabled' | 'toggleItem'>;
|
|
30
30
|
}
|
|
31
31
|
];
|
|
32
32
|
};
|
|
@@ -43,11 +43,11 @@ export interface AccordionItemExternalSignature {
|
|
|
43
43
|
/**
|
|
44
44
|
* The AccordionHeader component.
|
|
45
45
|
*/
|
|
46
|
-
Header: WithBoundArgs<typeof Header, '
|
|
46
|
+
Header: WithBoundArgs<typeof Header, 'triggerId' | 'contentId' | 'isExpanded' | 'disabled' | 'toggleItem'>;
|
|
47
47
|
/**
|
|
48
48
|
* The AccordionContent component.
|
|
49
49
|
*/
|
|
50
|
-
Content: WithBoundArgs<typeof Content, '
|
|
50
|
+
Content: WithBoundArgs<typeof Content, 'triggerId' | 'contentId' | 'isExpanded' | 'disabled'>;
|
|
51
51
|
}
|
|
52
52
|
];
|
|
53
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/public.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,gCAAgC;IAC/C;;;OAGG;IACH,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE;QACN,OAAO,EAAE;YACP;gBACE;;mBAEG;gBACH,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/public.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE;QACN,OAAO,EAAE,EAAE,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,gCAAgC;IAC/C;;;OAGG;IACH,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE;QACN,OAAO,EAAE;YACP;gBACE;;mBAEG;gBACH,OAAO,EAAE,aAAa,CACpB,OAAO,OAAO,EACd,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,CACrE,CAAC;aACH;SACF,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE;QACN,OAAO,EAAE;YACP;gBACE;;mBAEG;gBACH,UAAU,EAAE,OAAO,CAAC;gBACpB;;mBAEG;gBACH,MAAM,EAAE,aAAa,CACnB,OAAO,MAAM,EACb,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,CACrE,CAAC;gBACF;;mBAEG;gBACH,OAAO,EAAE,aAAa,CACpB,OAAO,OAAO,EACd,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,CACtD,CAAC;aACH;SACF,CAAC;KACH,CAAC;IACF,IAAI,EAAE;QACJ;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH"}
|
|
@@ -3,7 +3,8 @@ import type { TOC } from "@ember/component/template-only";
|
|
|
3
3
|
interface Signature extends AccordionTriggerExternalSignature {
|
|
4
4
|
Args: {
|
|
5
5
|
isExpanded: boolean;
|
|
6
|
-
|
|
6
|
+
triggerId: string;
|
|
7
|
+
contentId: string;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
toggleItem: () => void;
|
|
9
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/trigger.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/trigger.gts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAE1D,UAAU,SAAU,SAAQ,iCAAiC;IAC3D,IAAI,EAAE;QACJ,UAAU,EAAE,OAAO,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,UAAU,EAAE,MAAM,IAAI,CAAC;KACxB,CAAC;CACH;AAED,eAAO,MAAM,gBAAgB,EAAE,GAAG,CAAC,SAAS,CAyB1C,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,329 @@
|
|
|
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
|
+
* What a screen reader announces when the number of results changes.
|
|
182
|
+
*
|
|
183
|
+
* Defaults to "1 result" and "3 results".
|
|
184
|
+
*/
|
|
185
|
+
resultsText?: (count: number) => string;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* No blocks: this form renders the rows. Passing one is an error.
|
|
189
|
+
*/
|
|
190
|
+
Blocks: Record<string, never>;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The composed form: you render the rows.
|
|
194
|
+
*/
|
|
195
|
+
export interface BlockSignature {
|
|
196
|
+
Args: {
|
|
197
|
+
/**
|
|
198
|
+
* The text in the input.
|
|
199
|
+
*
|
|
200
|
+
* The state is managed internally, so this does not need to be a
|
|
201
|
+
* maintained value, but whenever it changes, the input reflects it. Pair
|
|
202
|
+
* it with `@onQueryChange` to keep the query somewhere else, such as a
|
|
203
|
+
* query param.
|
|
204
|
+
*/
|
|
205
|
+
query?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Called with the input's text every time it changes.
|
|
208
|
+
*/
|
|
209
|
+
onQueryChange?: (query: string) => void;
|
|
210
|
+
/**
|
|
211
|
+
* A key combination that calls `@onOpen` from anywhere on the page, such
|
|
212
|
+
* as `"mod+k"`. `mod` is <kbd>Meta</kbd> on macOS and <kbd>Control</kbd>
|
|
213
|
+
* everywhere else.
|
|
214
|
+
*
|
|
215
|
+
* Needs `@onOpen` to have anything to do. No listener is installed
|
|
216
|
+
* without both.
|
|
217
|
+
*/
|
|
218
|
+
hotkey?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Called when `@hotkey` is pressed. Hand it the `open` of whatever the
|
|
221
|
+
* palette is in:
|
|
222
|
+
*
|
|
223
|
+
* ```hbs
|
|
224
|
+
* <CommandPalette @hotkey="mod+k" @onOpen={{d.open}} />
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
onOpen?: () => void;
|
|
228
|
+
/**
|
|
229
|
+
* Not for this form: the rows come from the block.
|
|
230
|
+
*/
|
|
231
|
+
items?: never;
|
|
232
|
+
/**
|
|
233
|
+
* Not for this form: set it on `Input` yourself.
|
|
234
|
+
*/
|
|
235
|
+
placeholder?: never;
|
|
236
|
+
/**
|
|
237
|
+
* Not for this form: the rows are yours, and so is announcing them.
|
|
238
|
+
*/
|
|
239
|
+
resultsText?: never;
|
|
240
|
+
/**
|
|
241
|
+
* Called every time a row is chosen. Hand it `close` to make a modal
|
|
242
|
+
* palette close itself.
|
|
243
|
+
*
|
|
244
|
+
* The rows are yours here, so there is no entry to hand back. Which row
|
|
245
|
+
* was chosen is `event.target.closest("[role=option]")`.
|
|
246
|
+
*/
|
|
247
|
+
onSelect?: (event: Event) => void;
|
|
248
|
+
};
|
|
249
|
+
Blocks: {
|
|
250
|
+
default: [
|
|
251
|
+
{
|
|
252
|
+
/**
|
|
253
|
+
* The current text of the input.
|
|
254
|
+
*/
|
|
255
|
+
query: string;
|
|
256
|
+
/**
|
|
257
|
+
* Sets the text of the input, for a "clear" button or a suggestion.
|
|
258
|
+
*/
|
|
259
|
+
setQuery: (query: string) => void;
|
|
260
|
+
/**
|
|
261
|
+
* The `<input>`, wired as a combobox over `List`.
|
|
262
|
+
*
|
|
263
|
+
* It needs a name: pass `aria-label`, or an `id` and a `<label>`.
|
|
264
|
+
*/
|
|
265
|
+
Input: WithBoundArgs<typeof Input, "listId" | "activeId" | "query" | "onInput" | "onKeydown">;
|
|
266
|
+
/**
|
|
267
|
+
* The listbox the rows are rendered into.
|
|
268
|
+
*/
|
|
269
|
+
List: WithBoundArgs<typeof List, "id" | "register" | "onPointerMove" | "onClick" | "Item" | "LinkItem">;
|
|
270
|
+
}
|
|
271
|
+
];
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
export type Signature = ItemsSignature | BlockSignature;
|
|
275
|
+
export declare class CommandPalette extends Component<Signature> {
|
|
276
|
+
#private;
|
|
277
|
+
listId: string;
|
|
278
|
+
/**
|
|
279
|
+
* Which row is active, as an id rather than an element or a focus state.
|
|
280
|
+
*
|
|
281
|
+
* This is unusual for this library, where keyboard navigation means tabster
|
|
282
|
+
* moving focus. A combobox cannot do that: focus has to stay in the
|
|
283
|
+
* `<input>` or the reader stops being able to type. So nothing among the
|
|
284
|
+
* rows is ever focused, there is no focus for tabster to track, and what
|
|
285
|
+
* moves instead is `aria-activedescendant` -- which is an id, on the input,
|
|
286
|
+
* pointing at a row. Holding the id is holding exactly what that attribute
|
|
287
|
+
* needs.
|
|
288
|
+
*
|
|
289
|
+
* Tabster still does the finding, in `#find`. This only remembers which of
|
|
290
|
+
* the rows it landed on.
|
|
291
|
+
*/
|
|
292
|
+
activeId: string | undefined;
|
|
293
|
+
_query: string;
|
|
294
|
+
constructor(owner: Owner, args: Signature["Args"]);
|
|
295
|
+
get placeholder(): string;
|
|
296
|
+
get resultsText(): string;
|
|
297
|
+
/**
|
|
298
|
+
* Whether `@items` was passed, not whether it has anything in it: an empty
|
|
299
|
+
* array is falsy in a template, and a palette whose results have gone away
|
|
300
|
+
* still has to render the input they would be typed into.
|
|
301
|
+
*/
|
|
302
|
+
get hasItems(): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* `@items` and a block are two ways to say the same thing, and saying both
|
|
305
|
+
* means one of them is being quietly ignored.
|
|
306
|
+
*/
|
|
307
|
+
get bothGiven(): string;
|
|
308
|
+
get query(): string;
|
|
309
|
+
set query(value: string);
|
|
310
|
+
registerList: import("ember-modifier").FunctionBasedModifier<{
|
|
311
|
+
Args: {
|
|
312
|
+
Positional: unknown[];
|
|
313
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
314
|
+
};
|
|
315
|
+
Element: HTMLElement;
|
|
316
|
+
}>;
|
|
317
|
+
setQuery: (query: string) => void;
|
|
318
|
+
handleInput: (event: Event) => void;
|
|
319
|
+
handlePointerMove: (event: PointerEvent) => void;
|
|
320
|
+
handleKeydown: (event: KeyboardEvent) => void;
|
|
321
|
+
handleHotkey: (event: KeyboardEvent) => void;
|
|
322
|
+
/**
|
|
323
|
+
* Choosing is delegated, so a row is markup rather than a listener, and
|
|
324
|
+
* `@onSelect` is reached the same way however the rows were rendered.
|
|
325
|
+
*/
|
|
326
|
+
handleClick: (event: MouseEvent) => void;
|
|
327
|
+
}
|
|
328
|
+
export default CommandPalette;
|
|
329
|
+
//# 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":"AAquBA;;;;;;;;;;;;;GAaG;AACH,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAgB3C,OAAO,EAAQ,KAAK,SAAS,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,KAAK,EAAE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AAO,KAAK,UAMzB;IAEF,iBAAiB,GAAI,OAAO,YAAY,UAUtC;IAEF,aAAa,GAAI,OAAO,aAAa,UAoCnC;IAEF,YAAY,GAAI,OAAO,aAAa,UAQlC;IAkBF;;;OAGG;IACH,WAAW,GAAI,OAAO,UAAU,UAmB9B;CA4GH;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import Component from "@glimmer/component";
|
|
2
2
|
import type { TOC } from "@ember/component/template-only";
|
|
3
3
|
import type { ModifierLike, WithBoundArgs } from "@glint/template";
|
|
4
|
+
interface RegisterSignature {
|
|
5
|
+
Element: HTMLDialogElement;
|
|
6
|
+
Args: {
|
|
7
|
+
Named: {
|
|
8
|
+
open: boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}
|
|
4
12
|
declare const DialogElement: TOC<{
|
|
5
13
|
Element: HTMLDialogElement;
|
|
6
14
|
Args: {
|
|
@@ -15,9 +23,7 @@ declare const DialogElement: TOC<{
|
|
|
15
23
|
/**
|
|
16
24
|
* @internal
|
|
17
25
|
*/
|
|
18
|
-
register: ModifierLike<
|
|
19
|
-
Element: HTMLDialogElement;
|
|
20
|
-
}>;
|
|
26
|
+
register: ModifierLike<RegisterSignature>;
|
|
21
27
|
};
|
|
22
28
|
Blocks: {
|
|
23
29
|
default: [];
|
|
@@ -101,11 +107,13 @@ declare class ModalDialog extends Component<Signature> {
|
|
|
101
107
|
}>;
|
|
102
108
|
dialogElement: HTMLDialogElement | undefined;
|
|
103
109
|
register: import("ember-modifier").FunctionBasedModifier<{
|
|
110
|
+
Element: HTMLDialogElement;
|
|
104
111
|
Args: {
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
Named: {
|
|
113
|
+
open: boolean | undefined;
|
|
114
|
+
};
|
|
115
|
+
Positional: [];
|
|
107
116
|
};
|
|
108
|
-
Element: HTMLDialogElement;
|
|
109
117
|
}>;
|
|
110
118
|
/**
|
|
111
119
|
* Closes the dialog -- this will throw an error in development if the dialog element was not rendered
|
|
@@ -123,7 +131,57 @@ declare class ModalDialog extends Component<Signature> {
|
|
|
123
131
|
*/
|
|
124
132
|
open: () => void;
|
|
125
133
|
}
|
|
134
|
+
export interface SimpleSignature {
|
|
135
|
+
Element: HTMLDialogElement;
|
|
136
|
+
Blocks: {
|
|
137
|
+
default: [
|
|
138
|
+
{
|
|
139
|
+
/**
|
|
140
|
+
* Opens the dialog, modally.
|
|
141
|
+
*/
|
|
142
|
+
open: () => void;
|
|
143
|
+
/**
|
|
144
|
+
* Closes the dialog.
|
|
145
|
+
*/
|
|
146
|
+
close: () => void;
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* A modal `<dialog>` around whatever you put in it, and the two things needed
|
|
153
|
+
* to drive it.
|
|
154
|
+
*
|
|
155
|
+
* ```gjs
|
|
156
|
+
* <Dialog as |d|>
|
|
157
|
+
* <CommandPalette @onSelect={{d.close}} @onOpen={{d.open}} @hotkey="mod+k" />
|
|
158
|
+
* </Dialog>
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* The element is here, so a trigger cannot be: whatever opens this either
|
|
162
|
+
* lives inside it, or is a key combination. For a dialog opened by a button
|
|
163
|
+
* beside it, use `<Modal>`, which hands you the element to place.
|
|
164
|
+
*
|
|
165
|
+
* <kbd>Escape</kbd> closes it and focus returns to whatever opened it, which
|
|
166
|
+
* is the `<dialog>` element's own behaviour. Set `closedby` to change which
|
|
167
|
+
* actions dismiss it.
|
|
168
|
+
*/
|
|
169
|
+
export declare class Dialog extends Component<SimpleSignature> {
|
|
170
|
+
#private;
|
|
171
|
+
register: import("ember-modifier").FunctionBasedModifier<{
|
|
172
|
+
Args: {
|
|
173
|
+
Positional: unknown[];
|
|
174
|
+
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
175
|
+
};
|
|
176
|
+
Element: HTMLDialogElement;
|
|
177
|
+
}>;
|
|
178
|
+
/**
|
|
179
|
+
* `showModal` on an open dialog, and `close` on a closed one, are both
|
|
180
|
+
* no-ops per spec, so neither needs guarding here.
|
|
181
|
+
*/
|
|
182
|
+
open: () => void;
|
|
183
|
+
close: () => void;
|
|
184
|
+
}
|
|
126
185
|
export declare const Modal: typeof ModalDialog;
|
|
127
|
-
export declare const Dialog: typeof ModalDialog;
|
|
128
186
|
export default ModalDialog;
|
|
129
187
|
//# 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":"AA4TA,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,UAAU,iBAAiB;IACzB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,OAAO,GAAG,SAAS,CAAA;SAAE,CAAA;KAAE,CAAC;CAChD;AAED,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,iBAAiB,CAAC,CAAC;KAC3C,CAAC;IACF,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB,CASC,CAAC;AAEH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE;QACJ;;;;;WAKG;QACH,IAAI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,MAAO,SAAQ,SAAS,CAAC,eAAe,CAAC;;IAQpD,QAAQ;;;;;;OAML;IAEH;;;OAGG;IACH,IAAI,aAEF;IAEF,KAAK,aAEH;CAcH;AAED,eAAO,MAAM,KAAK,oBAAc,CAAC;AAEjC,eAAe,WAAW,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import Component from "@glimmer/component";
|
|
2
2
|
import type { TOC } from "@ember/component/template-only";
|
|
3
3
|
import type { ModifierLike, WithBoundArgs } from "@glint/template";
|
|
4
|
+
interface RegisterSignature {
|
|
5
|
+
Element: HTMLDialogElement;
|
|
6
|
+
Args: {
|
|
7
|
+
Named: {
|
|
8
|
+
open: boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}
|
|
4
12
|
declare const DrawerElement: TOC<{
|
|
5
13
|
Element: HTMLDialogElement;
|
|
6
14
|
Args: {
|
|
@@ -15,9 +23,7 @@ declare const DrawerElement: TOC<{
|
|
|
15
23
|
/**
|
|
16
24
|
* @internal
|
|
17
25
|
*/
|
|
18
|
-
register: ModifierLike<
|
|
19
|
-
Element: HTMLDialogElement;
|
|
20
|
-
}>;
|
|
26
|
+
register: ModifierLike<RegisterSignature>;
|
|
21
27
|
};
|
|
22
28
|
Blocks: {
|
|
23
29
|
default: [];
|
|
@@ -101,11 +107,13 @@ declare class DrawerDialog extends Component<Signature> {
|
|
|
101
107
|
}>;
|
|
102
108
|
drawerElement: HTMLDialogElement | undefined;
|
|
103
109
|
register: import("ember-modifier").FunctionBasedModifier<{
|
|
110
|
+
Element: HTMLDialogElement;
|
|
104
111
|
Args: {
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
Named: {
|
|
113
|
+
open: boolean | undefined;
|
|
114
|
+
};
|
|
115
|
+
Positional: [];
|
|
107
116
|
};
|
|
108
|
-
Element: HTMLDialogElement;
|
|
109
117
|
}>;
|
|
110
118
|
/**
|
|
111
119
|
* Closes the drawer -- this will throw an error in development if the drawer element was not rendered
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/components/drawer.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/components/drawer.gts"],"names":[],"mappings":"AAqPA,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,UAAU,iBAAiB;IACzB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,OAAO,GAAG,SAAS,CAAA;SAAE,CAAA;KAAE,CAAC;CAChD;AAED,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,iBAAiB,CAAC,CAAC;KAC3C,CAAC;IACF,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB,CASC,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;YACP;gBACE;;mBAEG;gBACH,MAAM,EAAE,OAAO,CAAC;gBAEhB;;;mBAGG;gBACH,KAAK,EAAE,MAAM,IAAI,CAAC;gBAElB;;;mBAGG;gBACH,IAAI,EAAE,MAAM,IAAI,CAAC;gBAEjB;;;;;;;;;;;;;;mBAcG;gBACH,YAAY,EAAE,YAAY,CAAC;oBAAE,OAAO,EAAE,WAAW,CAAA;iBAAE,CAAC,CAAC;gBAErD;;;mBAGG;gBACH,MAAM,EAAE,aAAa,CAAC,OAAO,aAAa,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC;aAC9E;SACF,CAAC;KACH,CAAC;CACH;AAED,cAAM,YAAa,SAAQ,SAAS,CAAC,SAAS,CAAC;;IAab,OAAO,EAAE,OAAO,CAAC;IAEjD,IAAI,MAAM,IAMM,OAAO,CADtB;IACD,IAAI,MAAM,CAAC,GAAG,EAAE,OAAO,EAEtB;IAGD,OAAO;;;;;;OAQJ;IAEc,aAAa,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAE9D,QAAQ;;;;sBAzIe,OAAO,GAAG,SAAS;;;;OAiKvC;IAEH;;OAEG;IACH,KAAK,aAkBH;IAEF;;;;;OAKG;IACH,WAAW,aAUT;IAEF;;OAEG;IACH,IAAI,aAkBF;CACH;AAED,eAAO,MAAM,MAAM,qBAAe,CAAC;AAEnC,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/components/link.gts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/components/link.gts"],"names":[],"mappings":"AAyLA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAE1D,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE;QACJ;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QACb;;;;;;;;;;;;;;;;;;;;;;WAsBG;QACH,wBAAwB,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,CAAC;QAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;WA2BG;QACH,gBAAgB,CAAC,EAAE,IAAI,CAAC;KACzB,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE;YACP;gBACE;;;;;;;;;;;;;;;;;;;;;;;;mBAwBG;gBACH,UAAU,EAAE,OAAO,CAAC;gBACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAmCG;gBACH,QAAQ,EAAE,OAAO,CAAC;aACnB;SACF,CAAC;KACH,CAAC;CACH;AAED;;;;;GAKG;AACH,eAAO,MAAM,IAAI,EAAE,GAAG,CAAC,SAAS,CA8C9B,CAAC;AAEH,eAAe,IAAI,CAAC"}
|