@ui-sdk/vue 0.0.0-stage → 0.1.0-beta.1
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/LICENSE +202 -0
- package/README.md +10 -2
- package/dist/accordion.d.ts +561 -0
- package/dist/accordion.js +24 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +7 -0
- package/dist/alert-dialog.d.ts +231 -0
- package/dist/alert-dialog.js +33 -0
- package/dist/async-options.d.ts +18 -0
- package/dist/async-options.js +40 -0
- package/dist/autocomplete.d.ts +384 -0
- package/dist/autocomplete.js +344 -0
- package/dist/avatar.d.ts +40 -0
- package/dist/avatar.js +28 -0
- package/dist/button.d.ts +52 -0
- package/dist/button.js +43 -0
- package/dist/calendar-context.d.ts +10 -0
- package/dist/calendar-context.js +7 -0
- package/dist/calendar.d.ts +311 -0
- package/dist/calendar.js +349 -0
- package/dist/carousel.d.ts +236 -0
- package/dist/carousel.js +204 -0
- package/dist/checkbox.d.ts +211 -0
- package/dist/checkbox.js +151 -0
- package/dist/children.d.ts +41 -0
- package/dist/children.js +135 -0
- package/dist/collapsible.d.ts +54 -0
- package/dist/collapsible.js +18 -0
- package/dist/color-picker.d.ts +187 -0
- package/dist/color-picker.js +158 -0
- package/dist/color.d.ts +2 -0
- package/dist/color.js +21 -0
- package/dist/combobox.d.ts +517 -0
- package/dist/combobox.js +531 -0
- package/dist/command.d.ts +322 -0
- package/dist/command.js +345 -0
- package/dist/controller-target.d.ts +49 -0
- package/dist/controller-target.js +112 -0
- package/dist/create-parts.d.ts +126 -0
- package/dist/create-parts.js +206 -0
- package/dist/date-input.d.ts +133 -0
- package/dist/date-input.js +31 -0
- package/dist/date-picker.d.ts +328 -0
- package/dist/date-picker.js +354 -0
- package/dist/date.d.ts +2 -0
- package/dist/date.js +59 -0
- package/dist/dialog-parts.d.ts +259 -0
- package/dist/dialog-parts.js +300 -0
- package/dist/dialog.d.ts +251 -0
- package/dist/dialog.js +25 -0
- package/dist/drawer.d.ts +304 -0
- package/dist/drawer.js +373 -0
- package/dist/editor-context.d.ts +4 -0
- package/dist/editor-context.js +5 -0
- package/dist/field-context.d.ts +26 -0
- package/dist/field-context.js +44 -0
- package/dist/field.d.ts +154 -0
- package/dist/field.js +240 -0
- package/dist/file-input.d.ts +212 -0
- package/dist/file-input.js +255 -0
- package/dist/form-inputs.d.ts +16 -0
- package/dist/form-inputs.js +25 -0
- package/dist/gesture.d.ts +1 -0
- package/dist/gesture.js +15 -0
- package/dist/history.d.ts +2 -0
- package/dist/history.js +11 -0
- package/dist/hover-card.d.ts +137 -0
- package/dist/hover-card.js +153 -0
- package/dist/image-cropper.d.ts +74 -0
- package/dist/image-cropper.js +36 -0
- package/dist/image.d.ts +2 -0
- package/dist/image.js +5 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +60 -0
- package/dist/input.d.ts +120 -0
- package/dist/input.js +73 -0
- package/dist/item-icon.d.ts +34 -0
- package/dist/item-icon.js +63 -0
- package/dist/label.d.ts +16 -0
- package/dist/label.js +8 -0
- package/dist/lifecycle.d.ts +11 -0
- package/dist/lifecycle.js +91 -0
- package/dist/list-items.d.ts +38 -0
- package/dist/list-items.js +59 -0
- package/dist/list-text.d.ts +7 -0
- package/dist/list-text.js +15 -0
- package/dist/listbox.d.ts +273 -0
- package/dist/listbox.js +126 -0
- package/dist/menu.d.ts +678 -0
- package/dist/menu.js +607 -0
- package/dist/menubar-context.d.ts +5 -0
- package/dist/menubar-context.js +5 -0
- package/dist/menubar.d.ts +61 -0
- package/dist/menubar.js +48 -0
- package/dist/meter.d.ts +41 -0
- package/dist/meter.js +37 -0
- package/dist/navigation-menu.d.ts +228 -0
- package/dist/navigation-menu.js +195 -0
- package/dist/number-input.d.ts +176 -0
- package/dist/number-input.js +231 -0
- package/dist/number.d.ts +2 -0
- package/dist/number.js +39 -0
- package/dist/nuxt/entries.json +977 -0
- package/dist/nuxt/module.d.ts +18 -0
- package/dist/nuxt/module.js +31 -0
- package/dist/nuxt/registrations.d.ts +22 -0
- package/dist/nuxt/registrations.js +22 -0
- package/dist/observe.d.ts +2 -0
- package/dist/observe.js +7 -0
- package/dist/otp-input.d.ts +142 -0
- package/dist/otp-input.js +130 -0
- package/dist/overlays.d.ts +40 -0
- package/dist/overlays.js +118 -0
- package/dist/pagination.d.ts +201 -0
- package/dist/pagination.js +146 -0
- package/dist/password-input.d.ts +144 -0
- package/dist/password-input.js +134 -0
- package/dist/popover.d.ts +211 -0
- package/dist/popover.js +258 -0
- package/dist/popup.d.ts +60 -0
- package/dist/popup.js +89 -0
- package/dist/preferences.d.ts +44 -0
- package/dist/preferences.js +102 -0
- package/dist/primitive.d.ts +2 -0
- package/dist/primitive.js +11 -0
- package/dist/progress.d.ts +41 -0
- package/dist/progress.js +37 -0
- package/dist/radio.d.ts +164 -0
- package/dist/radio.js +145 -0
- package/dist/rating.d.ts +149 -0
- package/dist/rating.js +146 -0
- package/dist/renderless.d.ts +4 -0
- package/dist/renderless.js +28 -0
- package/dist/resizable.d.ts +54 -0
- package/dist/resizable.js +22 -0
- package/dist/scroll-area.d.ts +72 -0
- package/dist/scroll-area.js +77 -0
- package/dist/segmented-control.d.ts +151 -0
- package/dist/segmented-control.js +110 -0
- package/dist/segmented-input.d.ts +76 -0
- package/dist/segmented-input.js +115 -0
- package/dist/select.d.ts +458 -0
- package/dist/select.js +468 -0
- package/dist/separator.d.ts +14 -0
- package/dist/separator.js +8 -0
- package/dist/shortcuts.d.ts +32 -0
- package/dist/shortcuts.js +56 -0
- package/dist/slider.d.ts +65 -0
- package/dist/slider.js +194 -0
- package/dist/switch.d.ts +103 -0
- package/dist/switch.js +71 -0
- package/dist/tabs.d.ts +338 -0
- package/dist/tabs.js +27 -0
- package/dist/text-control.d.ts +89 -0
- package/dist/text-control.js +51 -0
- package/dist/text-match.d.ts +2 -0
- package/dist/text-match.js +7 -0
- package/dist/textarea.d.ts +106 -0
- package/dist/textarea.js +68 -0
- package/dist/time-input.d.ts +131 -0
- package/dist/time-input.js +32 -0
- package/dist/timeline.d.ts +81 -0
- package/dist/timeline.js +30 -0
- package/dist/toast-parts.d.ts +203 -0
- package/dist/toast-parts.js +270 -0
- package/dist/toast.d.ts +2 -0
- package/dist/toast.js +21 -0
- package/dist/toggle-props.d.ts +22 -0
- package/dist/toggle-props.js +14 -0
- package/dist/toggle.d.ts +199 -0
- package/dist/toggle.js +129 -0
- package/dist/token-input.d.ts +136 -0
- package/dist/token-input.js +214 -0
- package/dist/toolbar-context.d.ts +7 -0
- package/dist/toolbar-context.js +20 -0
- package/dist/toolbar.d.ts +120 -0
- package/dist/toolbar.js +77 -0
- package/dist/tooltip.d.ts +160 -0
- package/dist/tooltip.js +224 -0
- package/dist/tree.d.ts +300 -0
- package/dist/tree.js +209 -0
- package/dist/trigger-menu.d.ts +452 -0
- package/dist/trigger-menu.js +254 -0
- package/dist/use-primitive.d.ts +132 -0
- package/dist/use-primitive.js +462 -0
- package/dist/waterfall.d.ts +201 -0
- package/dist/waterfall.js +171 -0
- package/docs/README.md +89 -0
- package/docs/agents.md +1523 -0
- package/docs/components/accordion.md +1369 -0
- package/docs/components/alert-dialog.md +799 -0
- package/docs/components/autocomplete.md +1857 -0
- package/docs/components/avatar.md +272 -0
- package/docs/components/button.md +435 -0
- package/docs/components/calendar.md +1589 -0
- package/docs/components/carousel.md +1171 -0
- package/docs/components/checkbox.md +1008 -0
- package/docs/components/collapsible.md +536 -0
- package/docs/components/color-picker.md +706 -0
- package/docs/components/combobox.md +3504 -0
- package/docs/components/command.md +1481 -0
- package/docs/components/date-input.md +536 -0
- package/docs/components/date-picker.md +1244 -0
- package/docs/components/dialog.md +1397 -0
- package/docs/components/drawer.md +1166 -0
- package/docs/components/field.md +538 -0
- package/docs/components/file-input.md +611 -0
- package/docs/components/hover-card.md +505 -0
- package/docs/components/image-cropper.md +556 -0
- package/docs/components/input.md +306 -0
- package/docs/components/label.md +203 -0
- package/docs/components/listbox.md +1004 -0
- package/docs/components/menu.md +1229 -0
- package/docs/components/menubar.md +443 -0
- package/docs/components/meter.md +315 -0
- package/docs/components/navigation-menu.md +1523 -0
- package/docs/components/number-input.md +1029 -0
- package/docs/components/otp-input.md +512 -0
- package/docs/components/pagination.md +613 -0
- package/docs/components/password-input.md +649 -0
- package/docs/components/popover.md +1448 -0
- package/docs/components/preferences.md +208 -0
- package/docs/components/progress.md +423 -0
- package/docs/components/radio.md +785 -0
- package/docs/components/rating.md +416 -0
- package/docs/components/resizable.md +910 -0
- package/docs/components/scroll-area.md +915 -0
- package/docs/components/segmented-control.md +435 -0
- package/docs/components/select.md +2015 -0
- package/docs/components/separator.md +229 -0
- package/docs/components/slider.md +1084 -0
- package/docs/components/switch.md +565 -0
- package/docs/components/tabs.md +944 -0
- package/docs/components/textarea.md +299 -0
- package/docs/components/time-input.md +224 -0
- package/docs/components/timeline.md +654 -0
- package/docs/components/toast.md +1224 -0
- package/docs/components/toggle.md +500 -0
- package/docs/components/token-input.md +953 -0
- package/docs/components/toolbar.md +739 -0
- package/docs/components/tooltip.md +818 -0
- package/docs/components/tree.md +1306 -0
- package/docs/components/trigger-menu.md +1223 -0
- package/docs/components/waterfall.md +717 -0
- package/docs/controllers.md +71 -0
- package/docs/core.md +8027 -0
- package/docs/custom-parts.md +89 -0
- package/docs/first-component.md +83 -0
- package/docs/forms.md +122 -0
- package/docs/installation.md +72 -0
- package/docs/introduction.md +32 -0
- package/docs/lists-and-menus.md +122 -0
- package/docs/llms.txt +1502 -0
- package/docs/parts-and-composition.md +85 -0
- package/docs/popups.md +108 -0
- package/docs/rendering.md +56 -0
- package/docs/server-rendering.md +180 -0
- package/docs/state-and-events.md +100 -0
- package/docs/styling-and-animation.md +148 -0
- package/docs/utilities/async-options.md +348 -0
- package/docs/utilities/shortcuts.md +159 -0
- package/package.json +352 -3
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { Anchor, ChangeDetails, DismissAttemptDetails, Side } from "@ui-sdk/core";
|
|
2
|
+
import { type PopoverController, type PopoverDismissReason, type PopoverFinalFocus, type PopoverInitialFocus, type PopoverOpenChangeReason, type PopoverPayloadChangeReason } from "@ui-sdk/core/popover";
|
|
3
|
+
import { type PropType } from "vue";
|
|
4
|
+
import { type PartSlots } from "./use-primitive.js";
|
|
5
|
+
type OpenDetails = ChangeDetails<PopoverOpenChangeReason>;
|
|
6
|
+
type PayloadDetails = ChangeDetails<PopoverPayloadChangeReason>;
|
|
7
|
+
/**
|
|
8
|
+
* Rich content in a floating panel, opened from a button. Put its trigger and content inside.
|
|
9
|
+
* @stable
|
|
10
|
+
*/
|
|
11
|
+
declare const Popover: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
12
|
+
open: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: undefined;
|
|
15
|
+
};
|
|
16
|
+
modelValue: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
defaultOpen: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
modal: {
|
|
25
|
+
type: PropType<boolean | "trap-focus">;
|
|
26
|
+
default: undefined;
|
|
27
|
+
};
|
|
28
|
+
openOnHover: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
delay: NumberConstructor;
|
|
33
|
+
closeDelay: NumberConstructor;
|
|
34
|
+
presentation: PropType<"auto" | "popover" | "sheet">;
|
|
35
|
+
controller: PropType<PopoverController<any>>;
|
|
36
|
+
dismissible: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
debug: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
container: PropType<Element | DocumentFragment | null>;
|
|
45
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
48
|
+
"update:open": (_open: boolean) => true;
|
|
49
|
+
"update:modelValue": (_open: boolean) => true;
|
|
50
|
+
openChange: (_open: boolean, _details: OpenDetails) => true;
|
|
51
|
+
openChangeComplete: (_open: boolean) => true;
|
|
52
|
+
dismissAttempt: (_details: DismissAttemptDetails<PopoverDismissReason>) => true;
|
|
53
|
+
payloadChange: (_payload: unknown, _details: PayloadDetails) => true;
|
|
54
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
55
|
+
open: {
|
|
56
|
+
type: BooleanConstructor;
|
|
57
|
+
default: undefined;
|
|
58
|
+
};
|
|
59
|
+
modelValue: {
|
|
60
|
+
type: BooleanConstructor;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
defaultOpen: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
67
|
+
modal: {
|
|
68
|
+
type: PropType<boolean | "trap-focus">;
|
|
69
|
+
default: undefined;
|
|
70
|
+
};
|
|
71
|
+
openOnHover: {
|
|
72
|
+
type: BooleanConstructor;
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
delay: NumberConstructor;
|
|
76
|
+
closeDelay: NumberConstructor;
|
|
77
|
+
presentation: PropType<"auto" | "popover" | "sheet">;
|
|
78
|
+
controller: PropType<PopoverController<any>>;
|
|
79
|
+
dismissible: {
|
|
80
|
+
type: BooleanConstructor;
|
|
81
|
+
default: undefined;
|
|
82
|
+
};
|
|
83
|
+
debug: {
|
|
84
|
+
type: BooleanConstructor;
|
|
85
|
+
default: undefined;
|
|
86
|
+
};
|
|
87
|
+
container: PropType<Element | DocumentFragment | null>;
|
|
88
|
+
}>> & Readonly<{
|
|
89
|
+
"onUpdate:modelValue"?: ((_open: boolean) => any) | undefined;
|
|
90
|
+
"onUpdate:open"?: ((_open: boolean) => any) | undefined;
|
|
91
|
+
onOpenChange?: ((_open: boolean, _details: OpenDetails) => any) | undefined;
|
|
92
|
+
onOpenChangeComplete?: ((_open: boolean) => any) | undefined;
|
|
93
|
+
onPayloadChange?: ((_payload: unknown, _details: PayloadDetails) => any) | undefined;
|
|
94
|
+
onDismissAttempt?: ((_details: DismissAttemptDetails<PopoverDismissReason>) => any) | undefined;
|
|
95
|
+
}>, {
|
|
96
|
+
open: boolean;
|
|
97
|
+
debug: boolean;
|
|
98
|
+
defaultOpen: boolean;
|
|
99
|
+
modal: boolean | "trap-focus";
|
|
100
|
+
openOnHover: boolean;
|
|
101
|
+
dismissible: boolean;
|
|
102
|
+
modelValue: boolean;
|
|
103
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
104
|
+
/**
|
|
105
|
+
* The button that opens the popover. A trigger outside the popover connects through `controller`.
|
|
106
|
+
* @stable
|
|
107
|
+
*/
|
|
108
|
+
declare const PopoverTrigger: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
109
|
+
disabled: {
|
|
110
|
+
type: BooleanConstructor;
|
|
111
|
+
default: undefined;
|
|
112
|
+
};
|
|
113
|
+
focusableWhenDisabled: {
|
|
114
|
+
type: BooleanConstructor;
|
|
115
|
+
default: undefined;
|
|
116
|
+
};
|
|
117
|
+
payload: PropType<unknown>;
|
|
118
|
+
shortcut: StringConstructor;
|
|
119
|
+
controller: PropType<PopoverController<any>>;
|
|
120
|
+
}>, () => unknown, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
121
|
+
disabled: {
|
|
122
|
+
type: BooleanConstructor;
|
|
123
|
+
default: undefined;
|
|
124
|
+
};
|
|
125
|
+
focusableWhenDisabled: {
|
|
126
|
+
type: BooleanConstructor;
|
|
127
|
+
default: undefined;
|
|
128
|
+
};
|
|
129
|
+
payload: PropType<unknown>;
|
|
130
|
+
shortcut: StringConstructor;
|
|
131
|
+
controller: PropType<PopoverController<any>>;
|
|
132
|
+
}>> & Readonly<{}>, {
|
|
133
|
+
disabled: boolean;
|
|
134
|
+
focusableWhenDisabled: boolean;
|
|
135
|
+
}, PartSlots<import("@ui-sdk/core/popover").PopoverPrimitive, "trigger">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "button">;
|
|
136
|
+
/**
|
|
137
|
+
* The panel itself, positioned against its trigger, named by its title and described by its description.
|
|
138
|
+
* @stable
|
|
139
|
+
*/
|
|
140
|
+
declare const PopoverContent: import("./popup.js").PayloadPart<import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
141
|
+
side: PropType<Side>;
|
|
142
|
+
align: PropType<"start" | "center" | "end">;
|
|
143
|
+
sideOffset: NumberConstructor;
|
|
144
|
+
alignOffset: NumberConstructor;
|
|
145
|
+
collisionPadding: NumberConstructor;
|
|
146
|
+
arrowPadding: NumberConstructor;
|
|
147
|
+
anchor: PropType<Anchor | string | null>;
|
|
148
|
+
initialFocus: PropType<PopoverInitialFocus>;
|
|
149
|
+
finalFocus: PropType<PopoverFinalFocus>;
|
|
150
|
+
keepMounted: {
|
|
151
|
+
type: BooleanConstructor;
|
|
152
|
+
default: undefined;
|
|
153
|
+
};
|
|
154
|
+
container: PropType<Element | DocumentFragment | null>;
|
|
155
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
156
|
+
[key: string]: any;
|
|
157
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
158
|
+
[key: string]: any;
|
|
159
|
+
}>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
160
|
+
side: PropType<Side>;
|
|
161
|
+
align: PropType<"start" | "center" | "end">;
|
|
162
|
+
sideOffset: NumberConstructor;
|
|
163
|
+
alignOffset: NumberConstructor;
|
|
164
|
+
collisionPadding: NumberConstructor;
|
|
165
|
+
arrowPadding: NumberConstructor;
|
|
166
|
+
anchor: PropType<Anchor | string | null>;
|
|
167
|
+
initialFocus: PropType<PopoverInitialFocus>;
|
|
168
|
+
finalFocus: PropType<PopoverFinalFocus>;
|
|
169
|
+
keepMounted: {
|
|
170
|
+
type: BooleanConstructor;
|
|
171
|
+
default: undefined;
|
|
172
|
+
};
|
|
173
|
+
container: PropType<Element | DocumentFragment | null>;
|
|
174
|
+
}>> & Readonly<{}>, {
|
|
175
|
+
keepMounted: boolean;
|
|
176
|
+
}, PartSlots<import("@ui-sdk/core/popover").PopoverPrimitive, "content">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">>;
|
|
177
|
+
/**
|
|
178
|
+
* The popover's title, which names it. A level 2 heading by default.
|
|
179
|
+
* @stable
|
|
180
|
+
*/
|
|
181
|
+
declare const PopoverTitle: Pick<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, "h2">;
|
|
182
|
+
/**
|
|
183
|
+
* Describes the popover while it's rendered. A paragraph by default.
|
|
184
|
+
* @stable
|
|
185
|
+
*/
|
|
186
|
+
declare const PopoverDescription: Pick<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, "p">;
|
|
187
|
+
/**
|
|
188
|
+
* A button that closes the popover.
|
|
189
|
+
* @stable
|
|
190
|
+
*/
|
|
191
|
+
declare const PopoverClose: Pick<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, "button">;
|
|
192
|
+
/**
|
|
193
|
+
* An arrow on the panel's edge that points at its trigger.
|
|
194
|
+
* @stable
|
|
195
|
+
*/
|
|
196
|
+
declare const PopoverArrow: Pick<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core").PopupPartState>>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core").PopupPartState>>>, "div">;
|
|
197
|
+
/**
|
|
198
|
+
* Shows a trigger's shortcut, like ⌘I, inside the trigger. Hidden from screen readers, which hear
|
|
199
|
+
* aria-keyshortcuts.
|
|
200
|
+
* @stable
|
|
201
|
+
*/
|
|
202
|
+
declare const PopoverShortcut: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
203
|
+
shortcut: StringConstructor;
|
|
204
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
205
|
+
[key: string]: any;
|
|
206
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
207
|
+
shortcut: StringConstructor;
|
|
208
|
+
}>> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/popover").PopoverPrimitive, "shortcut">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "span">;
|
|
209
|
+
export { createPopoverController } from "@ui-sdk/core/popover";
|
|
210
|
+
export type { PopoverApi, PopoverArrowState, PopoverContentProps, PopoverContentState, PopoverController, PopoverDismissReason, PopoverFinalFocus, PopoverInitialFocus, PopoverOpenChangeReason, PopoverOptions, PopoverPayloadChangeReason, PopoverPrimitive, PopoverShortcutProps, PopoverShortcutState, PopoverTriggerProps, PopoverTriggerState, } from "@ui-sdk/core/popover";
|
|
211
|
+
export { Popover, PopoverArrow, PopoverClose, PopoverContent, PopoverDescription, PopoverShortcut, PopoverTitle, PopoverTrigger, };
|
package/dist/popover.js
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// src/popover.ts
|
|
2
|
+
import {
|
|
3
|
+
popover as popoverPrimitive
|
|
4
|
+
} from "@ui-sdk/core/popover";
|
|
5
|
+
import {
|
|
6
|
+
defineComponent,
|
|
7
|
+
h,
|
|
8
|
+
inject,
|
|
9
|
+
onMounted,
|
|
10
|
+
provide,
|
|
11
|
+
ref,
|
|
12
|
+
useId
|
|
13
|
+
} from "vue";
|
|
14
|
+
import { slotContent } from "./children.js";
|
|
15
|
+
import {
|
|
16
|
+
containerProp,
|
|
17
|
+
renderPopup,
|
|
18
|
+
renderUnbound,
|
|
19
|
+
sheetViewport,
|
|
20
|
+
useConnectedPart,
|
|
21
|
+
useControllerEntry,
|
|
22
|
+
useControllerTarget,
|
|
23
|
+
usePopupContainer,
|
|
24
|
+
withPayload
|
|
25
|
+
} from "./popup.js";
|
|
26
|
+
import { createParts, withElement } from "./create-parts.js";
|
|
27
|
+
import {
|
|
28
|
+
optionalBoolean,
|
|
29
|
+
orModel,
|
|
30
|
+
useHandle,
|
|
31
|
+
usePart,
|
|
32
|
+
usePrimitive,
|
|
33
|
+
useScope
|
|
34
|
+
} from "./use-primitive.js";
|
|
35
|
+
import { renderless } from "./renderless.js";
|
|
36
|
+
import { createPopoverController } from "@ui-sdk/core/popover";
|
|
37
|
+
var ContainerKey = /* @__PURE__ */ Symbol("popover-container");
|
|
38
|
+
var TriggerKey = /* @__PURE__ */ Symbol("popover-trigger");
|
|
39
|
+
var parts = createParts(popoverPrimitive, {
|
|
40
|
+
title: "h2",
|
|
41
|
+
description: "p",
|
|
42
|
+
close: "button",
|
|
43
|
+
arrow: "div"
|
|
44
|
+
});
|
|
45
|
+
var Popover = /* @__PURE__ */ renderless(
|
|
46
|
+
defineComponent({
|
|
47
|
+
name: "Popover",
|
|
48
|
+
props: {
|
|
49
|
+
open: optionalBoolean,
|
|
50
|
+
modelValue: optionalBoolean,
|
|
51
|
+
defaultOpen: optionalBoolean,
|
|
52
|
+
modal: {
|
|
53
|
+
type: [Boolean, String],
|
|
54
|
+
default: void 0
|
|
55
|
+
},
|
|
56
|
+
openOnHover: optionalBoolean,
|
|
57
|
+
delay: Number,
|
|
58
|
+
closeDelay: Number,
|
|
59
|
+
presentation: String,
|
|
60
|
+
controller: Object,
|
|
61
|
+
dismissible: optionalBoolean,
|
|
62
|
+
debug: optionalBoolean,
|
|
63
|
+
container: containerProp
|
|
64
|
+
},
|
|
65
|
+
emits: {
|
|
66
|
+
"update:open": (_open) => true,
|
|
67
|
+
"update:modelValue": (_open) => true,
|
|
68
|
+
openChange: (_open, _details) => true,
|
|
69
|
+
openChangeComplete: (_open) => true,
|
|
70
|
+
dismissAttempt: (_details) => true,
|
|
71
|
+
payloadChange: (_payload, _details) => true
|
|
72
|
+
},
|
|
73
|
+
setup(props, { slots, emit }) {
|
|
74
|
+
provide(ContainerKey, () => props.container);
|
|
75
|
+
const popover = usePrimitive(popoverPrimitive, () => ({
|
|
76
|
+
...props,
|
|
77
|
+
open: orModel(props.open, props.modelValue),
|
|
78
|
+
container: void 0,
|
|
79
|
+
onOpenChange: (open, details) => {
|
|
80
|
+
emit("openChange", open, details);
|
|
81
|
+
if (details.canceled) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
emit("update:open", open);
|
|
85
|
+
emit("update:modelValue", open);
|
|
86
|
+
},
|
|
87
|
+
onOpenChangeComplete: (open) => emit("openChangeComplete", open),
|
|
88
|
+
onDismissAttempt: (details) => emit("dismissAttempt", details),
|
|
89
|
+
onPayloadChange: (payload, details) => emit("payloadChange", payload, details)
|
|
90
|
+
}));
|
|
91
|
+
useControllerEntry(() => props.controller, popover);
|
|
92
|
+
return () => slots.default?.();
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
var PopoverTrigger = withElement(
|
|
97
|
+
"button",
|
|
98
|
+
defineComponent({
|
|
99
|
+
name: "PopoverTrigger",
|
|
100
|
+
inheritAttrs: false,
|
|
101
|
+
props: {
|
|
102
|
+
disabled: optionalBoolean,
|
|
103
|
+
focusableWhenDisabled: optionalBoolean,
|
|
104
|
+
payload: null,
|
|
105
|
+
// A keyboard shortcut that presses the trigger, like "mod+i".
|
|
106
|
+
shortcut: String,
|
|
107
|
+
// Connects a trigger outside the popover to the popover with this controller.
|
|
108
|
+
controller: Object
|
|
109
|
+
},
|
|
110
|
+
slots: Object,
|
|
111
|
+
setup(props, { slots, attrs }) {
|
|
112
|
+
const connected = useControllerTarget(
|
|
113
|
+
popoverPrimitive,
|
|
114
|
+
() => props.controller
|
|
115
|
+
);
|
|
116
|
+
provide(TriggerKey, {
|
|
117
|
+
shortcut: () => props.shortcut,
|
|
118
|
+
popover: connected
|
|
119
|
+
});
|
|
120
|
+
const id = useId();
|
|
121
|
+
const part = () => ({
|
|
122
|
+
id,
|
|
123
|
+
disabled: props.disabled,
|
|
124
|
+
focusableWhenDisabled: props.focusableWhenDisabled,
|
|
125
|
+
payload: props.payload,
|
|
126
|
+
shortcut: props.shortcut
|
|
127
|
+
});
|
|
128
|
+
return useConnectedPart(
|
|
129
|
+
connected,
|
|
130
|
+
(popover) => usePart(popover, "trigger", part, void 0, "button"),
|
|
131
|
+
// Until the popover it names mounts, a trigger outside the popover is a plain button.
|
|
132
|
+
() => renderUnbound(
|
|
133
|
+
"button",
|
|
134
|
+
{
|
|
135
|
+
type: "button",
|
|
136
|
+
disabled: props.disabled && !props.focusableWhenDisabled,
|
|
137
|
+
"aria-disabled": props.disabled && props.focusableWhenDisabled || void 0,
|
|
138
|
+
...attrs
|
|
139
|
+
},
|
|
140
|
+
{ slots, state: { open: false, disabled: !!props.disabled } }
|
|
141
|
+
)
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
var PopoverContent = withPayload(
|
|
147
|
+
withElement(
|
|
148
|
+
"div",
|
|
149
|
+
defineComponent({
|
|
150
|
+
name: "PopoverContent",
|
|
151
|
+
inheritAttrs: false,
|
|
152
|
+
props: {
|
|
153
|
+
side: String,
|
|
154
|
+
align: String,
|
|
155
|
+
sideOffset: Number,
|
|
156
|
+
alignOffset: Number,
|
|
157
|
+
collisionPadding: Number,
|
|
158
|
+
arrowPadding: Number,
|
|
159
|
+
anchor: [Object, String],
|
|
160
|
+
initialFocus: [
|
|
161
|
+
String,
|
|
162
|
+
Object,
|
|
163
|
+
Function
|
|
164
|
+
],
|
|
165
|
+
finalFocus: [String, Object, Function],
|
|
166
|
+
keepMounted: optionalBoolean,
|
|
167
|
+
// Renders the popup into this element instead of in place.
|
|
168
|
+
container: containerProp
|
|
169
|
+
},
|
|
170
|
+
slots: Object,
|
|
171
|
+
setup(props) {
|
|
172
|
+
const popover = useHandle(popoverPrimitive);
|
|
173
|
+
const fromRoot = inject(ContainerKey, () => void 0);
|
|
174
|
+
const target = usePopupContainer(() => props.container ?? fromRoot());
|
|
175
|
+
const content = () => {
|
|
176
|
+
const { container, ...content2 } = props;
|
|
177
|
+
return content2;
|
|
178
|
+
};
|
|
179
|
+
const part = usePart(popover, "content", content);
|
|
180
|
+
return () => {
|
|
181
|
+
const element = part();
|
|
182
|
+
if (!element) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
return renderPopup(sheetViewport(popover, element), target());
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
})
|
|
189
|
+
)
|
|
190
|
+
);
|
|
191
|
+
var PopoverTitle = parts.Title;
|
|
192
|
+
var PopoverDescription = parts.Description;
|
|
193
|
+
var PopoverClose = parts.Close;
|
|
194
|
+
var PopoverArrow = parts.Arrow;
|
|
195
|
+
var ShortcutBinding = defineComponent({
|
|
196
|
+
name: "PopoverShortcutBinding",
|
|
197
|
+
inheritAttrs: false,
|
|
198
|
+
props: {
|
|
199
|
+
popover: { type: Object, required: true },
|
|
200
|
+
shortcut: String
|
|
201
|
+
},
|
|
202
|
+
setup(props, { slots }) {
|
|
203
|
+
return usePart(
|
|
204
|
+
props.popover,
|
|
205
|
+
"shortcut",
|
|
206
|
+
() => ({ shortcut: props.shortcut }),
|
|
207
|
+
void 0,
|
|
208
|
+
{
|
|
209
|
+
tag: "span",
|
|
210
|
+
children: (state) => slotContent(slots.default, { state }) ?? state.text
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
var PopoverShortcut = withElement(
|
|
216
|
+
"span",
|
|
217
|
+
defineComponent({
|
|
218
|
+
name: "PopoverShortcut",
|
|
219
|
+
inheritAttrs: false,
|
|
220
|
+
props: {
|
|
221
|
+
// The keys to show. Inside a trigger, its shortcut.
|
|
222
|
+
shortcut: String
|
|
223
|
+
},
|
|
224
|
+
slots: Object,
|
|
225
|
+
setup(props, { slots, attrs }) {
|
|
226
|
+
const context = useScope(popoverPrimitive)?.handle;
|
|
227
|
+
const trigger = inject(TriggerKey, null);
|
|
228
|
+
if (!context && !trigger) {
|
|
229
|
+
throw new Error("Popover parts must be used inside <Popover>.");
|
|
230
|
+
}
|
|
231
|
+
const mounted = ref(!!context);
|
|
232
|
+
onMounted(() => mounted.value = true);
|
|
233
|
+
return () => {
|
|
234
|
+
const popover = context ?? (mounted.value ? trigger?.popover() : void 0);
|
|
235
|
+
if (!popover) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
const shortcut = props.shortcut ?? trigger?.shortcut();
|
|
239
|
+
return h(
|
|
240
|
+
ShortcutBinding,
|
|
241
|
+
{ ...attrs, key: popover.instance.id, popover, shortcut },
|
|
242
|
+
slots
|
|
243
|
+
);
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
);
|
|
248
|
+
export {
|
|
249
|
+
Popover,
|
|
250
|
+
PopoverArrow,
|
|
251
|
+
PopoverClose,
|
|
252
|
+
PopoverContent,
|
|
253
|
+
PopoverDescription,
|
|
254
|
+
PopoverShortcut,
|
|
255
|
+
PopoverTitle,
|
|
256
|
+
PopoverTrigger,
|
|
257
|
+
createPopoverController
|
|
258
|
+
};
|
package/dist/popup.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Primitive } from "@ui-sdk/core";
|
|
2
|
+
import { type PropType, type VNode } from "vue";
|
|
3
|
+
import type { PrimitiveHandle, StateSlotFunctions } from "./use-primitive.js";
|
|
4
|
+
type PopupContainer = Element | DocumentFragment | null | undefined;
|
|
5
|
+
declare const containerProp: PropType<Element | DocumentFragment | null>;
|
|
6
|
+
declare function usePopupContainer(own: () => PopupContainer): () => PopupContainer;
|
|
7
|
+
declare function renderPopup(element: VNode | VNode[], container: PopupContainer): VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}>[];
|
|
12
|
+
/**
|
|
13
|
+
* Wraps a popup's content in the full-screen viewport a sheet sits in, while
|
|
14
|
+
* its `viewport` slot is present: always for a drawer, and for a popup while
|
|
15
|
+
* it presents as a sheet. The viewport is what goes into the top layer. Its
|
|
16
|
+
* attributes are a subset of the content's, so the content's render keeps it current.
|
|
17
|
+
*/
|
|
18
|
+
declare function sheetViewport(popup: PrimitiveHandle<Primitive>, element: VNode | VNode[]): VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}>[];
|
|
23
|
+
/**
|
|
24
|
+
* Where an input renders while its popup presents as a sheet: in a header the
|
|
25
|
+
* content renders at its top. The root calls `provideSheetHeader()`, the
|
|
26
|
+
* content renders the header with `useSheetHeader()`, and the input renders
|
|
27
|
+
* into it with `useInSheetHeader()`, so there's one input at a time.
|
|
28
|
+
*/
|
|
29
|
+
declare function provideSheetHeader(): void;
|
|
30
|
+
/** Call in the content's `setup`. Returns the render step for the header, while the popup's `header` slot is present. */
|
|
31
|
+
declare function useSheetHeader(popup: PrimitiveHandle<Primitive>): () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}> | null;
|
|
34
|
+
/** Call in the input's `setup`. Returns the render step that moves the input into the sheet's header while there is one. */
|
|
35
|
+
declare function useInSheetHeader(): (element: VNode | VNode[]) => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}>[];
|
|
40
|
+
type Component = new (...args: any[]) => {
|
|
41
|
+
$slots: object;
|
|
42
|
+
};
|
|
43
|
+
type SlotState<Part extends Component> = InstanceType<Part>["$slots"] extends {
|
|
44
|
+
default?: (scope: {
|
|
45
|
+
state: infer State;
|
|
46
|
+
}) => unknown;
|
|
47
|
+
} ? State : never;
|
|
48
|
+
type PayloadPart<Part extends Component> = Part & (new <Payload = unknown>(...args: any[]) => Omit<InstanceType<Part>, "$slots"> & {
|
|
49
|
+
$slots: Readonly<StateSlotFunctions<SlotState<Part> & {
|
|
50
|
+
payload: Payload | undefined;
|
|
51
|
+
}>>;
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Types a popup's content part by its payload: `const DayContent =
|
|
55
|
+
* TooltipContent<Day>` is the same component, with a `Day` as its state's
|
|
56
|
+
* payload. The payload's type is the app's; the part hands its state on as it is.
|
|
57
|
+
*/
|
|
58
|
+
declare const withPayload: <Part extends Component>(part: Part) => PayloadPart<Part>;
|
|
59
|
+
export { provideConnected, renderUnbound, useConnectedHandle, useConnectedPart, useControllerEntry, useControllerTarget, } from "./controller-target.js";
|
|
60
|
+
export { containerProp, type PayloadPart, type PopupContainer, provideSheetHeader, renderPopup, sheetViewport, useInSheetHeader, usePopupContainer, useSheetHeader, withPayload, };
|
package/dist/popup.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/popup.ts
|
|
2
|
+
import { portalTarget } from "@ui-sdk/core/renderer";
|
|
3
|
+
import {
|
|
4
|
+
Teleport,
|
|
5
|
+
defineComponent,
|
|
6
|
+
h,
|
|
7
|
+
inject,
|
|
8
|
+
provide,
|
|
9
|
+
shallowRef
|
|
10
|
+
} from "vue";
|
|
11
|
+
import { useKeptAway } from "./lifecycle.js";
|
|
12
|
+
import {
|
|
13
|
+
provideConnected,
|
|
14
|
+
renderUnbound,
|
|
15
|
+
useConnectedHandle,
|
|
16
|
+
useConnectedPart,
|
|
17
|
+
useControllerEntry,
|
|
18
|
+
useControllerTarget
|
|
19
|
+
} from "./controller-target.js";
|
|
20
|
+
var containerProp = Object;
|
|
21
|
+
var InheritedContainer = /* @__PURE__ */ Symbol("popup-container");
|
|
22
|
+
function usePopupContainer(own) {
|
|
23
|
+
const inherited = inject(InheritedContainer, () => void 0);
|
|
24
|
+
return () => own() ?? inherited();
|
|
25
|
+
}
|
|
26
|
+
var ContainerScope = defineComponent({
|
|
27
|
+
name: "PopupContainerScope",
|
|
28
|
+
props: { container: Object },
|
|
29
|
+
setup(props, { slots }) {
|
|
30
|
+
provide(InheritedContainer, () => props.container);
|
|
31
|
+
return () => slots.default?.();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var PopupTeleport = defineComponent({
|
|
35
|
+
name: "PopupTeleport",
|
|
36
|
+
props: {
|
|
37
|
+
to: {
|
|
38
|
+
type: Object,
|
|
39
|
+
required: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
slots: Object,
|
|
43
|
+
setup(props, { slots }) {
|
|
44
|
+
const isAway = useKeptAway();
|
|
45
|
+
return () => h(
|
|
46
|
+
Teleport,
|
|
47
|
+
{ to: props.to, disabled: isAway.value },
|
|
48
|
+
slots.default()
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
function renderPopup(element, container) {
|
|
53
|
+
const target = portalTarget(container);
|
|
54
|
+
const content = container ? [h(ContainerScope, { container }, () => element)] : [].concat(element);
|
|
55
|
+
return target ? h(PopupTeleport, { to: target }, () => content) : content.length === 1 ? content[0] : content;
|
|
56
|
+
}
|
|
57
|
+
function sheetViewport(popup, element) {
|
|
58
|
+
return popup.present("viewport") ? h("div", popup.slot("viewport", {}), [].concat(element)) : element;
|
|
59
|
+
}
|
|
60
|
+
var SheetHeaderKey = /* @__PURE__ */ Symbol("sheet-header");
|
|
61
|
+
function provideSheetHeader() {
|
|
62
|
+
provide(SheetHeaderKey, shallowRef(null));
|
|
63
|
+
}
|
|
64
|
+
function useSheetHeader(popup) {
|
|
65
|
+
const header = inject(SheetHeaderKey, { value: null });
|
|
66
|
+
const ref = (el) => header.value = el ?? null;
|
|
67
|
+
return () => popup.present("header") ? h("div", popup.slot("header", {}, { ref })) : null;
|
|
68
|
+
}
|
|
69
|
+
function useInSheetHeader() {
|
|
70
|
+
const header = inject(SheetHeaderKey, { value: null });
|
|
71
|
+
return (element) => header.value ? h(Teleport, { to: header.value }, [].concat(element)) : element;
|
|
72
|
+
}
|
|
73
|
+
var withPayload = (part) => part;
|
|
74
|
+
export {
|
|
75
|
+
containerProp,
|
|
76
|
+
provideConnected,
|
|
77
|
+
provideSheetHeader,
|
|
78
|
+
renderPopup,
|
|
79
|
+
renderUnbound,
|
|
80
|
+
sheetViewport,
|
|
81
|
+
useConnectedHandle,
|
|
82
|
+
useConnectedPart,
|
|
83
|
+
useControllerEntry,
|
|
84
|
+
useControllerTarget,
|
|
85
|
+
useInSheetHeader,
|
|
86
|
+
usePopupContainer,
|
|
87
|
+
useSheetHeader,
|
|
88
|
+
withPayload
|
|
89
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type PreferenceLike } from "@ui-sdk/core";
|
|
2
|
+
import { type PropType, type SlotsType, type VNode } from "vue";
|
|
3
|
+
/**
|
|
4
|
+
* Shows preferences on `data-*` attributes, so CSS styles by them from the
|
|
5
|
+
* first paint: global ones on `<html>`, the rest on its own element, which
|
|
6
|
+
* has `display: contents`. On the server it renders one inline script as its
|
|
7
|
+
* first child, which puts every saved value on its attribute as the page
|
|
8
|
+
* loads, before hydration. Content that reads a preference, through
|
|
9
|
+
* `usePreference`, catches up after hydration.
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
|
+
declare const Preferences: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
+
/** The preferences to show, from `createPreference` or `createColorScheme`. */
|
|
14
|
+
preferences: {
|
|
15
|
+
type: PropType<readonly PreferenceLike[]>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
/** The nonce your Content Security Policy gives inline scripts. */
|
|
19
|
+
nonce: StringConstructor;
|
|
20
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
/** The preferences to show, from `createPreference` or `createColorScheme`. */
|
|
24
|
+
preferences: {
|
|
25
|
+
type: PropType<readonly PreferenceLike[]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
/** The nonce your Content Security Policy gives inline scripts. */
|
|
29
|
+
nonce: StringConstructor;
|
|
30
|
+
}>> & Readonly<{}>, {}, SlotsType<{
|
|
31
|
+
default?: () => VNode[];
|
|
32
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
33
|
+
/**
|
|
34
|
+
* A preference's state, like `{ value: "dark" }`, or a color scheme's, as a
|
|
35
|
+
* computed ref. It's the server's until mounted, so the page hydrates without
|
|
36
|
+
* a mismatch, and the saved value right after.
|
|
37
|
+
* @experimental
|
|
38
|
+
*/
|
|
39
|
+
declare function usePreference<State>(preference: {
|
|
40
|
+
get: () => State;
|
|
41
|
+
initialState: State;
|
|
42
|
+
subscribe: (listener: () => void) => () => void;
|
|
43
|
+
}): import("vue").ComputedRef<any>;
|
|
44
|
+
export { Preferences, usePreference };
|