@youcan/celeste 0.6.30 → 0.6.32

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.
Files changed (101) hide show
  1. package/dist/celeste.css +483 -264
  2. package/dist/cjs/alert.js +2 -2
  3. package/dist/cjs/chunks/index.js +229 -2
  4. package/dist/cjs/chunks/index2.js +1457 -0
  5. package/dist/cjs/chunks/index3.js +16457 -0
  6. package/dist/cjs/chunks/sonner.js +1154 -0
  7. package/dist/cjs/config.js +136 -0
  8. package/dist/cjs/extra-settings.js +155 -0
  9. package/dist/cjs/index.js +75 -0
  10. package/dist/cjs/label.js +2 -2
  11. package/dist/cjs/link-bubble.js +228 -0
  12. package/dist/cjs/link-button.js +2 -2
  13. package/dist/cjs/rich-editor.js +4996 -0
  14. package/dist/cjs/select-icon.js +2 -2
  15. package/dist/cjs/sonner-alert.js +41 -0
  16. package/dist/cjs/sonner.js +3 -0
  17. package/dist/cjs/text-input-affix.js +2 -2
  18. package/dist/cjs/types.js +1 -0
  19. package/dist/components/index.d.ts +2 -0
  20. package/dist/components/rich-editor/config.d.ts +33 -0
  21. package/dist/components/rich-editor/extra-settings.d.ts +6 -0
  22. package/dist/components/rich-editor/index.d.ts +2 -0
  23. package/dist/components/rich-editor/link-bubble.d.ts +11 -0
  24. package/dist/components/rich-editor/rich-editor.d.ts +55 -0
  25. package/dist/components/rich-editor/types.d.ts +19 -0
  26. package/dist/components/sonner/index.d.ts +4 -0
  27. package/dist/components/sonner/sonner-alert.d.ts +13 -0
  28. package/dist/components/sonner/sonner.d.ts +5 -0
  29. package/dist/es/alert.js +2 -2
  30. package/dist/es/checkbox-label.js +1 -1
  31. package/dist/es/chunks/index.js +277 -50
  32. package/dist/es/chunks/index2.js +1457 -0
  33. package/dist/es/chunks/index3.js +16458 -0
  34. package/dist/es/chunks/sonner.js +1155 -0
  35. package/dist/es/combobox-group.js +1 -1
  36. package/dist/es/combobox-input.js +1 -1
  37. package/dist/es/combobox-item.js +1 -1
  38. package/dist/es/combobox-list.js +1 -1
  39. package/dist/es/combobox-root.js +1 -1
  40. package/dist/es/combobox-separator.js +1 -1
  41. package/dist/es/combobox-trigger.js +1 -1
  42. package/dist/es/command-group.js +1 -1
  43. package/dist/es/command-input.js +1 -1
  44. package/dist/es/command-item.js +1 -1
  45. package/dist/es/command-list.js +1 -1
  46. package/dist/es/command-root.js +1 -1
  47. package/dist/es/command-separator.js +1 -1
  48. package/dist/es/config.js +136 -0
  49. package/dist/es/dropdown-menu-group.js +1 -1
  50. package/dist/es/dropdown-menu-item.js +1 -1
  51. package/dist/es/dropdown-menu-label.js +1 -1
  52. package/dist/es/dropdown-menu-separator.js +1 -1
  53. package/dist/es/dropdown-menu-trigger.js +1 -1
  54. package/dist/es/dropdown-menu.js +1 -1
  55. package/dist/es/dropdown.js +1 -1
  56. package/dist/es/extra-settings.js +156 -0
  57. package/dist/es/index.js +94 -19
  58. package/dist/es/label.js +3 -3
  59. package/dist/es/link-bubble.js +229 -0
  60. package/dist/es/link-button.js +2 -2
  61. package/dist/es/modal-content.js +1 -1
  62. package/dist/es/modal-header.js +1 -1
  63. package/dist/es/popover-content.js +1 -1
  64. package/dist/es/popover-trigger.js +1 -1
  65. package/dist/es/rich-editor.js +4997 -0
  66. package/dist/es/scroll-bar.js +1 -1
  67. package/dist/es/segmented-control-item.js +1 -1
  68. package/dist/es/segmented-control.js +1 -1
  69. package/dist/es/select-content.js +1 -1
  70. package/dist/es/select-icon.js +2 -2
  71. package/dist/es/select-item.js +1 -1
  72. package/dist/es/select-trigger.js +1 -1
  73. package/dist/es/select-value.js +1 -1
  74. package/dist/es/sonner-alert.js +42 -0
  75. package/dist/es/sonner.js +4 -0
  76. package/dist/es/tab-menu-content.js +1 -1
  77. package/dist/es/tab-menu-item.js +1 -1
  78. package/dist/es/tab-menu-list.js +1 -1
  79. package/dist/es/tab-menu.js +1 -1
  80. package/dist/es/text-input-affix.js +2 -2
  81. package/dist/es/tooltip.js +1 -1
  82. package/dist/es/types.js +1 -0
  83. package/dist/index.d.ts +1 -0
  84. package/dist/utils/index.d.ts +3 -0
  85. package/dist/utils/sonner.d.ts +19 -0
  86. package/package.json +15 -4
  87. package/src/components/index.ts +2 -0
  88. package/src/components/rich-editor/config.ts +150 -0
  89. package/src/components/rich-editor/extra-settings.vue +151 -0
  90. package/src/components/rich-editor/index.ts +2 -0
  91. package/src/components/rich-editor/link-bubble.vue +288 -0
  92. package/src/components/rich-editor/rich-editor.vue +428 -0
  93. package/src/components/rich-editor/stories/rich-editor.stories.ts +87 -0
  94. package/src/components/rich-editor/types.ts +21 -0
  95. package/src/components/sonner/index.ts +5 -0
  96. package/src/components/sonner/sonner-alert.vue +54 -0
  97. package/src/components/sonner/sonner.vue +13 -0
  98. package/src/components/sonner/stories/sonner.stories.ts +194 -0
  99. package/src/index.ts +1 -0
  100. package/src/utils/index.ts +3 -0
  101. package/src/utils/sonner.ts +72 -0
package/dist/cjs/alert.js CHANGED
@@ -107,5 +107,5 @@ const _sfc_main = /* @__PURE__ */ Mo.defineComponent({
107
107
  };
108
108
  }
109
109
  });
110
- const alert = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-a07f0877"]]);
111
- module.exports = alert;
110
+ const Alert = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-a07f0877"]]);
111
+ module.exports = Alert;
@@ -18,6 +18,8 @@ function _interopNamespaceDefault(e) {
18
18
  }
19
19
  const Mo__namespace = /* @__PURE__ */ _interopNamespaceDefault(Mo);
20
20
  const sides = ["top", "right", "bottom", "left"];
21
+ const alignments = ["start", "end"];
22
+ const placements = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
21
23
  const min = Math.min;
22
24
  const max = Math.max;
23
25
  const round = Math.round;
@@ -402,6 +404,102 @@ const arrow$2 = (options) => ({
402
404
  };
403
405
  }
404
406
  });
407
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
408
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement);
409
+ return allowedPlacementsSortedByAlignment.filter((placement) => {
410
+ if (alignment) {
411
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
412
+ }
413
+ return true;
414
+ });
415
+ }
416
+ const autoPlacement$1 = function(options) {
417
+ if (options === void 0) {
418
+ options = {};
419
+ }
420
+ return {
421
+ name: "autoPlacement",
422
+ options,
423
+ async fn(state) {
424
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
425
+ const {
426
+ rects,
427
+ middlewareData,
428
+ placement,
429
+ platform: platform2,
430
+ elements
431
+ } = state;
432
+ const {
433
+ crossAxis = false,
434
+ alignment,
435
+ allowedPlacements = placements,
436
+ autoAlignment = true,
437
+ ...detectOverflowOptions
438
+ } = evaluate(options, state);
439
+ const placements$1 = alignment !== void 0 || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
440
+ const overflow = await detectOverflow(state, detectOverflowOptions);
441
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
442
+ const currentPlacement = placements$1[currentIndex];
443
+ if (currentPlacement == null) {
444
+ return {};
445
+ }
446
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
447
+ if (placement !== currentPlacement) {
448
+ return {
449
+ reset: {
450
+ placement: placements$1[0]
451
+ }
452
+ };
453
+ }
454
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
455
+ const allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || [], {
456
+ placement: currentPlacement,
457
+ overflows: currentOverflows
458
+ }];
459
+ const nextPlacement = placements$1[currentIndex + 1];
460
+ if (nextPlacement) {
461
+ return {
462
+ data: {
463
+ index: currentIndex + 1,
464
+ overflows: allOverflows
465
+ },
466
+ reset: {
467
+ placement: nextPlacement
468
+ }
469
+ };
470
+ }
471
+ const placementsSortedByMostSpace = allOverflows.map((d) => {
472
+ const alignment2 = getAlignment(d.placement);
473
+ return [d.placement, alignment2 && crossAxis ? (
474
+ // Check along the mainAxis and main crossAxis side.
475
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0)
476
+ ) : (
477
+ // Check only the mainAxis.
478
+ d.overflows[0]
479
+ ), d.overflows];
480
+ }).sort((a2, b) => a2[1] - b[1]);
481
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter((d) => d[2].slice(
482
+ 0,
483
+ // Aligned placements should not check their opposite crossAxis
484
+ // side.
485
+ getAlignment(d[0]) ? 2 : 3
486
+ ).every((v) => v <= 0));
487
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
488
+ if (resetPlacement !== placement) {
489
+ return {
490
+ data: {
491
+ index: currentIndex + 1,
492
+ overflows: allOverflows
493
+ },
494
+ reset: {
495
+ placement: resetPlacement
496
+ }
497
+ };
498
+ }
499
+ return {};
500
+ }
501
+ };
502
+ };
405
503
  const flip$1 = function(options) {
406
504
  if (options === void 0) {
407
505
  options = {};
@@ -440,7 +538,7 @@ const flip$1 = function(options) {
440
538
  if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
441
539
  fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
442
540
  }
443
- const placements = [initialPlacement, ...fallbackPlacements];
541
+ const placements2 = [initialPlacement, ...fallbackPlacements];
444
542
  const overflow = await detectOverflow(state, detectOverflowOptions);
445
543
  const overflows = [];
446
544
  let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
@@ -458,7 +556,7 @@ const flip$1 = function(options) {
458
556
  if (!overflows.every((side2) => side2 <= 0)) {
459
557
  var _middlewareData$flip2, _overflowsData$filter;
460
558
  const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
461
- const nextPlacement = placements[nextIndex];
559
+ const nextPlacement = placements2[nextIndex];
462
560
  if (nextPlacement) {
463
561
  return {
464
562
  data: {
@@ -566,6 +664,124 @@ const hide$1 = function(options) {
566
664
  }
567
665
  };
568
666
  };
667
+ function getBoundingRect(rects) {
668
+ const minX = min(...rects.map((rect) => rect.left));
669
+ const minY = min(...rects.map((rect) => rect.top));
670
+ const maxX = max(...rects.map((rect) => rect.right));
671
+ const maxY = max(...rects.map((rect) => rect.bottom));
672
+ return {
673
+ x: minX,
674
+ y: minY,
675
+ width: maxX - minX,
676
+ height: maxY - minY
677
+ };
678
+ }
679
+ function getRectsByLine(rects) {
680
+ const sortedRects = rects.slice().sort((a2, b) => a2.y - b.y);
681
+ const groups = [];
682
+ let prevRect = null;
683
+ for (let i = 0; i < sortedRects.length; i++) {
684
+ const rect = sortedRects[i];
685
+ if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
686
+ groups.push([rect]);
687
+ } else {
688
+ groups[groups.length - 1].push(rect);
689
+ }
690
+ prevRect = rect;
691
+ }
692
+ return groups.map((rect) => rectToClientRect(getBoundingRect(rect)));
693
+ }
694
+ const inline$1 = function(options) {
695
+ if (options === void 0) {
696
+ options = {};
697
+ }
698
+ return {
699
+ name: "inline",
700
+ options,
701
+ async fn(state) {
702
+ const {
703
+ placement,
704
+ elements,
705
+ rects,
706
+ platform: platform2,
707
+ strategy
708
+ } = state;
709
+ const {
710
+ padding = 2,
711
+ x,
712
+ y
713
+ } = evaluate(options, state);
714
+ const nativeClientRects = Array.from(await (platform2.getClientRects == null ? void 0 : platform2.getClientRects(elements.reference)) || []);
715
+ const clientRects = getRectsByLine(nativeClientRects);
716
+ const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
717
+ const paddingObject = getPaddingObject(padding);
718
+ function getBoundingClientRect2() {
719
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
720
+ return clientRects.find((rect) => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
721
+ }
722
+ if (clientRects.length >= 2) {
723
+ if (getSideAxis(placement) === "y") {
724
+ const firstRect = clientRects[0];
725
+ const lastRect = clientRects[clientRects.length - 1];
726
+ const isTop = getSide(placement) === "top";
727
+ const top2 = firstRect.top;
728
+ const bottom2 = lastRect.bottom;
729
+ const left2 = isTop ? firstRect.left : lastRect.left;
730
+ const right2 = isTop ? firstRect.right : lastRect.right;
731
+ const width2 = right2 - left2;
732
+ const height2 = bottom2 - top2;
733
+ return {
734
+ top: top2,
735
+ bottom: bottom2,
736
+ left: left2,
737
+ right: right2,
738
+ width: width2,
739
+ height: height2,
740
+ x: left2,
741
+ y: top2
742
+ };
743
+ }
744
+ const isLeftSide = getSide(placement) === "left";
745
+ const maxRight = max(...clientRects.map((rect) => rect.right));
746
+ const minLeft = min(...clientRects.map((rect) => rect.left));
747
+ const measureRects = clientRects.filter((rect) => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
748
+ const top = measureRects[0].top;
749
+ const bottom = measureRects[measureRects.length - 1].bottom;
750
+ const left = minLeft;
751
+ const right = maxRight;
752
+ const width = right - left;
753
+ const height = bottom - top;
754
+ return {
755
+ top,
756
+ bottom,
757
+ left,
758
+ right,
759
+ width,
760
+ height,
761
+ x: left,
762
+ y: top
763
+ };
764
+ }
765
+ return fallback;
766
+ }
767
+ const resetRects = await platform2.getElementRects({
768
+ reference: {
769
+ getBoundingClientRect: getBoundingClientRect2
770
+ },
771
+ floating: elements.floating,
772
+ strategy
773
+ });
774
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
775
+ return {
776
+ reset: {
777
+ rects: resetRects
778
+ }
779
+ };
780
+ }
781
+ return {};
782
+ }
783
+ };
784
+ };
569
785
  async function convertValueToCoords(state, options) {
570
786
  const {
571
787
  placement,
@@ -1565,11 +1781,13 @@ function autoUpdate(reference, floating, update, options) {
1565
1781
  };
1566
1782
  }
1567
1783
  const offset = offset$1;
1784
+ const autoPlacement = autoPlacement$1;
1568
1785
  const shift = shift$1;
1569
1786
  const flip = flip$1;
1570
1787
  const size = size$1;
1571
1788
  const hide = hide$1;
1572
1789
  const arrow$1 = arrow$2;
1790
+ const inline = inline$1;
1573
1791
  const limitShift = limitShift$1;
1574
1792
  const computePosition = (reference, floating, options) => {
1575
1793
  const cache = /* @__PURE__ */ new Map();
@@ -9030,18 +9248,24 @@ exports.Yy = Yy;
9030
9248
  exports.Zv = Zv;
9031
9249
  exports._s = _s;
9032
9250
  exports.ag = ag;
9251
+ exports.arrow = arrow$1;
9252
+ exports.autoPlacement = autoPlacement;
9033
9253
  exports.bg = bg;
9034
9254
  exports.bh = bh;
9035
9255
  exports.bs = bs;
9036
9256
  exports.ch = ch;
9257
+ exports.computePosition = computePosition;
9037
9258
  exports.eg = eg;
9038
9259
  exports.eu = eu;
9039
9260
  exports.fh = fh;
9261
+ exports.flip = flip;
9040
9262
  exports.gg = gg;
9041
9263
  exports.gs = gs;
9042
9264
  exports.hg = hg;
9043
9265
  exports.hh = hh;
9266
+ exports.hide = hide;
9044
9267
  exports.ih = ih;
9268
+ exports.inline = inline;
9045
9269
  exports.jg = jg;
9046
9270
  exports.jv = jv;
9047
9271
  exports.jy = jy;
@@ -9050,12 +9274,15 @@ exports.lv = lv;
9050
9274
  exports.mg = mg;
9051
9275
  exports.ng = ng;
9052
9276
  exports.nm = nm;
9277
+ exports.offset = offset;
9053
9278
  exports.og = og;
9054
9279
  exports.ph = ph;
9055
9280
  exports.qv = qv;
9056
9281
  exports.qy = qy;
9057
9282
  exports.rh = rh;
9058
9283
  exports.sh = sh;
9284
+ exports.shift = shift;
9285
+ exports.size = size;
9059
9286
  exports.sv = sv;
9060
9287
  exports.tg = tg;
9061
9288
  exports.tm = tm;