@destyler/popper 0.0.3 → 0.0.4

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.
@@ -1,5 +1,628 @@
1
- export { DestylerPopperAnchor, DestylerPopperAnchorProps, DestylerPopperArrow, DestylerPopperArrowProps, DestylerPopperContent, DestylerPopperContentProps, DestylerPopperRoot } from './index.cjs';
2
- import 'vue';
3
- import '@destyler/primitive';
4
- import '@destyler/shared';
5
- import '@floating-ui/vue';
1
+ import * as vue from 'vue';
2
+ import { PropType, Ref } from 'vue';
3
+ import * as _destyler_primitive from '@destyler/primitive';
4
+ import { Measurable, ExtractPublicPropTypes } from '@destyler/shared';
5
+ import * as _floating_ui_vue from '@floating-ui/vue';
6
+
7
+ declare const PopperRoot: vue.DefineComponent<{}, void, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
8
+
9
+ declare const popperAnchorProps: {
10
+ readonly element: {
11
+ readonly type: PropType<Measurable>;
12
+ readonly required: false;
13
+ };
14
+ readonly as: {
15
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
16
+ readonly required: false;
17
+ readonly default: "div";
18
+ };
19
+ readonly asChild: {
20
+ readonly type: PropType<boolean>;
21
+ readonly required: false;
22
+ readonly default: false;
23
+ };
24
+ };
25
+ type PopperAnchorProps = ExtractPublicPropTypes<typeof popperAnchorProps>;
26
+ declare const PopperAnchor: vue.DefineComponent<{
27
+ readonly element: {
28
+ readonly type: PropType<Measurable>;
29
+ readonly required: false;
30
+ };
31
+ readonly as: {
32
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
33
+ readonly required: false;
34
+ readonly default: "div";
35
+ };
36
+ readonly asChild: {
37
+ readonly type: PropType<boolean>;
38
+ readonly required: false;
39
+ readonly default: false;
40
+ };
41
+ }, {
42
+ forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
43
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
44
+ readonly element: {
45
+ readonly type: PropType<Measurable>;
46
+ readonly required: false;
47
+ };
48
+ readonly as: {
49
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
50
+ readonly required: false;
51
+ readonly default: "div";
52
+ };
53
+ readonly asChild: {
54
+ readonly type: PropType<boolean>;
55
+ readonly required: false;
56
+ readonly default: false;
57
+ };
58
+ }>>, {
59
+ readonly as: _destyler_primitive.AsTag | vue.Component;
60
+ readonly asChild: boolean;
61
+ }, {}>;
62
+
63
+ declare const SIDE_OPTIONS: readonly ["top", "right", "bottom", "left"];
64
+ type Side = (typeof SIDE_OPTIONS)[number];
65
+
66
+ interface PopperContentContext {
67
+ placedSide: Ref<Side>;
68
+ onArrowChange: (arrow: HTMLElement | undefined) => void;
69
+ arrowX?: Ref<number>;
70
+ arrowY?: Ref<number>;
71
+ shouldHideArrow: Ref<boolean>;
72
+ }
73
+ declare const popperContentProps: {
74
+ /**
75
+ * The preferred side of the trigger to render against when open.
76
+ * Will be reversed when collisions occur and avoidCollisions
77
+ * is enabled.
78
+ *
79
+ * @default bottom
80
+ */
81
+ readonly side: {
82
+ readonly type: PropType<"top" | "right" | "bottom" | "left">;
83
+ readonly required: false;
84
+ readonly default: "bottom";
85
+ };
86
+ /**
87
+ * The distance in pixels from the trigger.
88
+ *
89
+ * @default 0
90
+ */
91
+ readonly sideOffset: {
92
+ readonly type: PropType<number>;
93
+ readonly required: false;
94
+ readonly default: 0;
95
+ };
96
+ /**
97
+ * The preferred alignment against the trigger.
98
+ * May change when collisions occur.
99
+ *
100
+ * @default center
101
+ */
102
+ readonly align: {
103
+ readonly type: PropType<"start" | "center" | "end">;
104
+ readonly required: false;
105
+ readonly default: "center";
106
+ };
107
+ /**
108
+ * An offset in pixels from the `start` or `end` alignment options.
109
+ *
110
+ * @default 0
111
+ */
112
+ readonly alignOffset: {
113
+ readonly type: PropType<number>;
114
+ readonly required: false;
115
+ readonly default: 0;
116
+ };
117
+ /**
118
+ * When `true`, overrides the side andalign preferences
119
+ * to prevent collisions with boundary edges.
120
+ *
121
+ * @default true
122
+ */
123
+ readonly avoidCollisions: {
124
+ readonly type: PropType<boolean>;
125
+ readonly required: false;
126
+ readonly default: true;
127
+ };
128
+ /**
129
+ * The element used as the collision boundary. By default
130
+ * this is the viewport, though you can provide additional
131
+ * element(s) to be included in this check.
132
+ *
133
+ * @default () => []
134
+ */
135
+ readonly collisionBoundary: {
136
+ readonly type: PropType<Element | (Element | null)[] | null>;
137
+ readonly required: false;
138
+ readonly default: () => never[];
139
+ };
140
+ /**
141
+ * The distance in pixels from the boundary edges where collision
142
+ * detection should occur. Accepts a number (same for all sides),
143
+ * or a partial padding object, for example: { top: 20, left: 20 }.
144
+ *
145
+ * @default 0
146
+ */
147
+ readonly collisionPadding: {
148
+ readonly type: PropType<number | Partial<Record<"top" | "right" | "bottom" | "left", number>>>;
149
+ readonly required: false;
150
+ readonly default: 0;
151
+ };
152
+ /**
153
+ * The distance in pixels from the boundary edges where collision
154
+ * detection should occur. Accepts a number (same for all sides),
155
+ * or a partial padding object, for example: { top: 20, left: 20 }.
156
+ *
157
+ * @default 0
158
+ */
159
+ readonly arrowPadding: {
160
+ readonly type: PropType<number>;
161
+ readonly required: false;
162
+ readonly default: 0;
163
+ };
164
+ /**
165
+ * The sticky behavior on the align axis. `partial` will keep the
166
+ * content in the boundary as long as the trigger is at least partially
167
+ * in the boundary whilst "always" will keep the content in the boundary
168
+ * regardless.
169
+ *
170
+ * @default partial
171
+ */
172
+ readonly sticky: {
173
+ readonly type: PropType<"partial" | "always">;
174
+ readonly required: false;
175
+ readonly default: "partial";
176
+ };
177
+ /**
178
+ * Whether to hide the content when the trigger becomes fully occluded.
179
+ *
180
+ * @default false
181
+ */
182
+ readonly hideWhenDetached: {
183
+ readonly type: PropType<boolean>;
184
+ readonly required: false;
185
+ readonly default: false;
186
+ };
187
+ /**
188
+ * Strategy to update the position of the floating element on every animation frame.
189
+ *
190
+ * @default optimized
191
+ */
192
+ readonly updatePositionStrategy: {
193
+ readonly type: PropType<"always" | "optimized">;
194
+ readonly required: false;
195
+ readonly default: "optimized";
196
+ };
197
+ /**
198
+ * Force content to be position within the viewport.
199
+ *
200
+ * Might overlap the reference element, which may not be desired.
201
+ *
202
+ * @default false
203
+ */
204
+ readonly prioritizePosition: {
205
+ readonly type: PropType<boolean>;
206
+ readonly required: false;
207
+ readonly default: false;
208
+ };
209
+ readonly as: {
210
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
211
+ readonly required: false;
212
+ readonly default: "div";
213
+ };
214
+ readonly asChild: {
215
+ readonly type: PropType<boolean>;
216
+ readonly required: false;
217
+ readonly default: false;
218
+ };
219
+ };
220
+ type PopperContentProps = ExtractPublicPropTypes<typeof popperContentProps>;
221
+ declare const popperContentEmits: {
222
+ placed: () => boolean;
223
+ };
224
+ declare const PopperContent: vue.DefineComponent<{
225
+ /**
226
+ * The preferred side of the trigger to render against when open.
227
+ * Will be reversed when collisions occur and avoidCollisions
228
+ * is enabled.
229
+ *
230
+ * @default bottom
231
+ */
232
+ readonly side: {
233
+ readonly type: PropType<"top" | "right" | "bottom" | "left">;
234
+ readonly required: false;
235
+ readonly default: "bottom";
236
+ };
237
+ /**
238
+ * The distance in pixels from the trigger.
239
+ *
240
+ * @default 0
241
+ */
242
+ readonly sideOffset: {
243
+ readonly type: PropType<number>;
244
+ readonly required: false;
245
+ readonly default: 0;
246
+ };
247
+ /**
248
+ * The preferred alignment against the trigger.
249
+ * May change when collisions occur.
250
+ *
251
+ * @default center
252
+ */
253
+ readonly align: {
254
+ readonly type: PropType<"start" | "center" | "end">;
255
+ readonly required: false;
256
+ readonly default: "center";
257
+ };
258
+ /**
259
+ * An offset in pixels from the `start` or `end` alignment options.
260
+ *
261
+ * @default 0
262
+ */
263
+ readonly alignOffset: {
264
+ readonly type: PropType<number>;
265
+ readonly required: false;
266
+ readonly default: 0;
267
+ };
268
+ /**
269
+ * When `true`, overrides the side andalign preferences
270
+ * to prevent collisions with boundary edges.
271
+ *
272
+ * @default true
273
+ */
274
+ readonly avoidCollisions: {
275
+ readonly type: PropType<boolean>;
276
+ readonly required: false;
277
+ readonly default: true;
278
+ };
279
+ /**
280
+ * The element used as the collision boundary. By default
281
+ * this is the viewport, though you can provide additional
282
+ * element(s) to be included in this check.
283
+ *
284
+ * @default () => []
285
+ */
286
+ readonly collisionBoundary: {
287
+ readonly type: PropType<Element | (Element | null)[] | null>;
288
+ readonly required: false;
289
+ readonly default: () => never[];
290
+ };
291
+ /**
292
+ * The distance in pixels from the boundary edges where collision
293
+ * detection should occur. Accepts a number (same for all sides),
294
+ * or a partial padding object, for example: { top: 20, left: 20 }.
295
+ *
296
+ * @default 0
297
+ */
298
+ readonly collisionPadding: {
299
+ readonly type: PropType<number | Partial<Record<"top" | "right" | "bottom" | "left", number>>>;
300
+ readonly required: false;
301
+ readonly default: 0;
302
+ };
303
+ /**
304
+ * The distance in pixels from the boundary edges where collision
305
+ * detection should occur. Accepts a number (same for all sides),
306
+ * or a partial padding object, for example: { top: 20, left: 20 }.
307
+ *
308
+ * @default 0
309
+ */
310
+ readonly arrowPadding: {
311
+ readonly type: PropType<number>;
312
+ readonly required: false;
313
+ readonly default: 0;
314
+ };
315
+ /**
316
+ * The sticky behavior on the align axis. `partial` will keep the
317
+ * content in the boundary as long as the trigger is at least partially
318
+ * in the boundary whilst "always" will keep the content in the boundary
319
+ * regardless.
320
+ *
321
+ * @default partial
322
+ */
323
+ readonly sticky: {
324
+ readonly type: PropType<"partial" | "always">;
325
+ readonly required: false;
326
+ readonly default: "partial";
327
+ };
328
+ /**
329
+ * Whether to hide the content when the trigger becomes fully occluded.
330
+ *
331
+ * @default false
332
+ */
333
+ readonly hideWhenDetached: {
334
+ readonly type: PropType<boolean>;
335
+ readonly required: false;
336
+ readonly default: false;
337
+ };
338
+ /**
339
+ * Strategy to update the position of the floating element on every animation frame.
340
+ *
341
+ * @default optimized
342
+ */
343
+ readonly updatePositionStrategy: {
344
+ readonly type: PropType<"always" | "optimized">;
345
+ readonly required: false;
346
+ readonly default: "optimized";
347
+ };
348
+ /**
349
+ * Force content to be position within the viewport.
350
+ *
351
+ * Might overlap the reference element, which may not be desired.
352
+ *
353
+ * @default false
354
+ */
355
+ readonly prioritizePosition: {
356
+ readonly type: PropType<boolean>;
357
+ readonly required: false;
358
+ readonly default: false;
359
+ };
360
+ readonly as: {
361
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
362
+ readonly required: false;
363
+ readonly default: "div";
364
+ };
365
+ readonly asChild: {
366
+ readonly type: PropType<boolean>;
367
+ readonly required: false;
368
+ readonly default: false;
369
+ };
370
+ }, {
371
+ floatingRef: Ref<HTMLElement | undefined>;
372
+ floatingStyles: Readonly<Ref<{
373
+ position: _floating_ui_vue.Strategy;
374
+ top: string;
375
+ left: string;
376
+ transform?: string | undefined;
377
+ willChange?: string | undefined;
378
+ }>>;
379
+ isPositioned: Readonly<Ref<boolean>>;
380
+ contentZIndex: Ref<string>;
381
+ middlewareData: Readonly<Ref<_floating_ui_vue.MiddlewareData>>;
382
+ forwardRef: (ref: Element | vue.ComponentPublicInstance | null) => void;
383
+ placedSide: vue.ComputedRef<"top" | "right" | "bottom" | "left">;
384
+ placedAlign: vue.ComputedRef<"start" | "center" | "end">;
385
+ attrStyle: any;
386
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
387
+ placed: () => boolean;
388
+ }, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
389
+ /**
390
+ * The preferred side of the trigger to render against when open.
391
+ * Will be reversed when collisions occur and avoidCollisions
392
+ * is enabled.
393
+ *
394
+ * @default bottom
395
+ */
396
+ readonly side: {
397
+ readonly type: PropType<"top" | "right" | "bottom" | "left">;
398
+ readonly required: false;
399
+ readonly default: "bottom";
400
+ };
401
+ /**
402
+ * The distance in pixels from the trigger.
403
+ *
404
+ * @default 0
405
+ */
406
+ readonly sideOffset: {
407
+ readonly type: PropType<number>;
408
+ readonly required: false;
409
+ readonly default: 0;
410
+ };
411
+ /**
412
+ * The preferred alignment against the trigger.
413
+ * May change when collisions occur.
414
+ *
415
+ * @default center
416
+ */
417
+ readonly align: {
418
+ readonly type: PropType<"start" | "center" | "end">;
419
+ readonly required: false;
420
+ readonly default: "center";
421
+ };
422
+ /**
423
+ * An offset in pixels from the `start` or `end` alignment options.
424
+ *
425
+ * @default 0
426
+ */
427
+ readonly alignOffset: {
428
+ readonly type: PropType<number>;
429
+ readonly required: false;
430
+ readonly default: 0;
431
+ };
432
+ /**
433
+ * When `true`, overrides the side andalign preferences
434
+ * to prevent collisions with boundary edges.
435
+ *
436
+ * @default true
437
+ */
438
+ readonly avoidCollisions: {
439
+ readonly type: PropType<boolean>;
440
+ readonly required: false;
441
+ readonly default: true;
442
+ };
443
+ /**
444
+ * The element used as the collision boundary. By default
445
+ * this is the viewport, though you can provide additional
446
+ * element(s) to be included in this check.
447
+ *
448
+ * @default () => []
449
+ */
450
+ readonly collisionBoundary: {
451
+ readonly type: PropType<Element | (Element | null)[] | null>;
452
+ readonly required: false;
453
+ readonly default: () => never[];
454
+ };
455
+ /**
456
+ * The distance in pixels from the boundary edges where collision
457
+ * detection should occur. Accepts a number (same for all sides),
458
+ * or a partial padding object, for example: { top: 20, left: 20 }.
459
+ *
460
+ * @default 0
461
+ */
462
+ readonly collisionPadding: {
463
+ readonly type: PropType<number | Partial<Record<"top" | "right" | "bottom" | "left", number>>>;
464
+ readonly required: false;
465
+ readonly default: 0;
466
+ };
467
+ /**
468
+ * The distance in pixels from the boundary edges where collision
469
+ * detection should occur. Accepts a number (same for all sides),
470
+ * or a partial padding object, for example: { top: 20, left: 20 }.
471
+ *
472
+ * @default 0
473
+ */
474
+ readonly arrowPadding: {
475
+ readonly type: PropType<number>;
476
+ readonly required: false;
477
+ readonly default: 0;
478
+ };
479
+ /**
480
+ * The sticky behavior on the align axis. `partial` will keep the
481
+ * content in the boundary as long as the trigger is at least partially
482
+ * in the boundary whilst "always" will keep the content in the boundary
483
+ * regardless.
484
+ *
485
+ * @default partial
486
+ */
487
+ readonly sticky: {
488
+ readonly type: PropType<"partial" | "always">;
489
+ readonly required: false;
490
+ readonly default: "partial";
491
+ };
492
+ /**
493
+ * Whether to hide the content when the trigger becomes fully occluded.
494
+ *
495
+ * @default false
496
+ */
497
+ readonly hideWhenDetached: {
498
+ readonly type: PropType<boolean>;
499
+ readonly required: false;
500
+ readonly default: false;
501
+ };
502
+ /**
503
+ * Strategy to update the position of the floating element on every animation frame.
504
+ *
505
+ * @default optimized
506
+ */
507
+ readonly updatePositionStrategy: {
508
+ readonly type: PropType<"always" | "optimized">;
509
+ readonly required: false;
510
+ readonly default: "optimized";
511
+ };
512
+ /**
513
+ * Force content to be position within the viewport.
514
+ *
515
+ * Might overlap the reference element, which may not be desired.
516
+ *
517
+ * @default false
518
+ */
519
+ readonly prioritizePosition: {
520
+ readonly type: PropType<boolean>;
521
+ readonly required: false;
522
+ readonly default: false;
523
+ };
524
+ readonly as: {
525
+ readonly type: PropType<_destyler_primitive.AsTag | vue.Component>;
526
+ readonly required: false;
527
+ readonly default: "div";
528
+ };
529
+ readonly asChild: {
530
+ readonly type: PropType<boolean>;
531
+ readonly required: false;
532
+ readonly default: false;
533
+ };
534
+ }>> & {
535
+ onPlaced?: (() => any) | undefined;
536
+ }, {
537
+ readonly as: _destyler_primitive.AsTag | vue.Component;
538
+ readonly asChild: boolean;
539
+ readonly side: "top" | "right" | "bottom" | "left";
540
+ readonly align: "start" | "center" | "end";
541
+ readonly sideOffset: number;
542
+ readonly alignOffset: number;
543
+ readonly avoidCollisions: boolean;
544
+ readonly collisionBoundary: Element | (Element | null)[] | null;
545
+ readonly collisionPadding: number | Partial<Record<"top" | "right" | "bottom" | "left", number>>;
546
+ readonly arrowPadding: number;
547
+ readonly sticky: "partial" | "always";
548
+ readonly hideWhenDetached: boolean;
549
+ readonly updatePositionStrategy: "always" | "optimized";
550
+ readonly prioritizePosition: boolean;
551
+ }, {}>;
552
+
553
+ declare const popperArrowProps: {
554
+ readonly as: {
555
+ readonly default: "svg";
556
+ readonly type: vue.PropType<vue.Component<any, any, any, vue.ComputedOptions, vue.MethodOptions, {}, any> | _destyler_primitive.AsTag>;
557
+ readonly required: false;
558
+ };
559
+ readonly width: {
560
+ readonly type: vue.PropType<number>;
561
+ readonly required: false;
562
+ readonly default: 10;
563
+ };
564
+ readonly height: {
565
+ readonly type: vue.PropType<number>;
566
+ readonly required: false;
567
+ readonly default: 5;
568
+ };
569
+ readonly asChild: {
570
+ readonly type: vue.PropType<boolean>;
571
+ readonly required: false;
572
+ readonly default: false;
573
+ };
574
+ };
575
+ type PopperArrowProps = ExtractPublicPropTypes<typeof popperArrowProps>;
576
+ declare const PopperArrow: vue.DefineComponent<{
577
+ readonly as: {
578
+ readonly default: "svg";
579
+ readonly type: vue.PropType<vue.Component<any, any, any, vue.ComputedOptions, vue.MethodOptions, {}, any> | _destyler_primitive.AsTag>;
580
+ readonly required: false;
581
+ };
582
+ readonly width: {
583
+ readonly type: vue.PropType<number>;
584
+ readonly required: false;
585
+ readonly default: 10;
586
+ };
587
+ readonly height: {
588
+ readonly type: vue.PropType<number>;
589
+ readonly required: false;
590
+ readonly default: 5;
591
+ };
592
+ readonly asChild: {
593
+ readonly type: vue.PropType<boolean>;
594
+ readonly required: false;
595
+ readonly default: false;
596
+ };
597
+ }, {
598
+ contentContext: PopperContentContext;
599
+ baseSide: vue.ComputedRef<"top" | "right" | "bottom" | "left">;
600
+ }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
601
+ readonly as: {
602
+ readonly default: "svg";
603
+ readonly type: vue.PropType<vue.Component<any, any, any, vue.ComputedOptions, vue.MethodOptions, {}, any> | _destyler_primitive.AsTag>;
604
+ readonly required: false;
605
+ };
606
+ readonly width: {
607
+ readonly type: vue.PropType<number>;
608
+ readonly required: false;
609
+ readonly default: 10;
610
+ };
611
+ readonly height: {
612
+ readonly type: vue.PropType<number>;
613
+ readonly required: false;
614
+ readonly default: 5;
615
+ };
616
+ readonly asChild: {
617
+ readonly type: vue.PropType<boolean>;
618
+ readonly required: false;
619
+ readonly default: false;
620
+ };
621
+ }>>, {
622
+ readonly as: vue.Component<any, any, any, vue.ComputedOptions, vue.MethodOptions, {}, any> | _destyler_primitive.AsTag;
623
+ readonly asChild: boolean;
624
+ readonly width: number;
625
+ readonly height: number;
626
+ }, {}>;
627
+
628
+ export { PopperAnchor, type PopperAnchorProps, PopperArrow, type PopperArrowProps, PopperContent, type PopperContentProps, PopperRoot, popperAnchorProps, popperArrowProps, popperContentEmits, popperContentProps };