@swisper.ai/web-chat-ui 0.2.4 → 0.2.6
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/dist/components/chat-artifact/chat-artifact.d.ts +52 -0
- package/dist/components/chat-artifact/chat-artifact.d.ts.map +1 -0
- package/dist/components/chat-artifact/chat-artifact.stories.d.ts +18 -0
- package/dist/components/chat-artifact/chat-artifact.stories.d.ts.map +1 -0
- package/dist/components/chat-artifact/index.d.ts +2 -0
- package/dist/components/chat-artifact/index.d.ts.map +1 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +2 -0
- package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +316 -261
- package/dist/index.es.js.map +1 -1
- package/package.json +4 -4
- package/src/components/chat-artifact/chat-artifact.json +118 -0
- package/src/components/chat-artifact/chat-artifact.stories.tsx +212 -0
- package/src/components/chat-artifact/chat-artifact.tsx +151 -0
- package/src/components/chat-artifact/index.ts +14 -0
- package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +14 -0
- package/src/components/index.ts +1 -0
package/dist/index.es.js
CHANGED
|
@@ -2483,8 +2483,63 @@ function Qa({ children: e, error: t, className: n }) {
|
|
|
2483
2483
|
});
|
|
2484
2484
|
}
|
|
2485
2485
|
//#endregion
|
|
2486
|
+
//#region src/components/chat-artifact/chat-artifact.tsx
|
|
2487
|
+
function $a({ asChild: e = !1, className: t, children: n, ...r }) {
|
|
2488
|
+
return /* @__PURE__ */ H(e ? W : "button", {
|
|
2489
|
+
role: "group",
|
|
2490
|
+
"data-slot": "chat-artifact",
|
|
2491
|
+
"data-testid": "chat-artifact",
|
|
2492
|
+
className: M("cursor-pointer", "max-w-80", "flex flex-row items-center gap-8", "p-8 rounded-promptbox-attachment", "bg-promptbox-attachment-background", "hover:bg-promptbox-attachment-background-hover", "active:bg-promptbox-attachment-background-pressed", "outline-none", "focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary-focus-visible", t),
|
|
2493
|
+
...r,
|
|
2494
|
+
children: n
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
function eo({ className: e, children: t }) {
|
|
2498
|
+
return /* @__PURE__ */ H("span", {
|
|
2499
|
+
"data-slot": "chat-artifact-icon",
|
|
2500
|
+
"data-testid": "chat-artifact-icon",
|
|
2501
|
+
className: M("inline-flex shrink-0 items-center justify-center", "text-icon-fill-inverse inline-flex size-promptbox-attachment-size-icon-container items-center justify-center", "bg-secondary-hover", "rounded-[8px] p-8 [&_svg]:size-[24px]", e),
|
|
2502
|
+
children: t
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
function to({ className: e, children: t }) {
|
|
2506
|
+
return /* @__PURE__ */ H("div", {
|
|
2507
|
+
"data-slot": "chat-artifact-content",
|
|
2508
|
+
"data-testid": "chat-artifact-content",
|
|
2509
|
+
className: M("flex-1 min-w-0", "flex flex-col", "text-left", "overflow-hidden", e),
|
|
2510
|
+
children: t
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2513
|
+
function no({ className: e, children: t }) {
|
|
2514
|
+
return /* @__PURE__ */ H(A, {
|
|
2515
|
+
variant: "body-sm",
|
|
2516
|
+
"data-slot": "chat-artifact-title",
|
|
2517
|
+
"data-testid": "chat-artifact-title",
|
|
2518
|
+
className: M("min-w-0 w-full truncate", e),
|
|
2519
|
+
children: t
|
|
2520
|
+
});
|
|
2521
|
+
}
|
|
2522
|
+
function ro({ className: e, children: t }) {
|
|
2523
|
+
return /* @__PURE__ */ H(A, {
|
|
2524
|
+
variant: "caption-md",
|
|
2525
|
+
"data-slot": "chat-artifact-caption",
|
|
2526
|
+
"data-testid": "chat-artifact-caption",
|
|
2527
|
+
className: M("min-w-0 w-full truncate", "text-text-tertiary", e),
|
|
2528
|
+
children: t
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
function io({ className: e, children: t }) {
|
|
2532
|
+
return /* @__PURE__ */ H("div", {
|
|
2533
|
+
role: "group",
|
|
2534
|
+
"data-slot": "chat-artifact-actions",
|
|
2535
|
+
"data-testid": "chat-artifact-actions",
|
|
2536
|
+
className: M("ml-auto shrink-0", "flex items-center gap-8", e),
|
|
2537
|
+
children: t
|
|
2538
|
+
});
|
|
2539
|
+
}
|
|
2540
|
+
//#endregion
|
|
2486
2541
|
//#region src/components/canvas-shell/canvas-shell.tsx
|
|
2487
|
-
function
|
|
2542
|
+
function ao({ className: e, children: t, ...n }) {
|
|
2488
2543
|
return /* @__PURE__ */ H(re, {
|
|
2489
2544
|
isCollapsible: !1,
|
|
2490
2545
|
children: /* @__PURE__ */ H(ee, {
|
|
@@ -2495,7 +2550,7 @@ function $a({ className: e, children: t, ...n }) {
|
|
|
2495
2550
|
})
|
|
2496
2551
|
});
|
|
2497
2552
|
}
|
|
2498
|
-
function
|
|
2553
|
+
function oo({ className: e, children: t, hasBorder: n = !0, ...r }) {
|
|
2499
2554
|
return /* @__PURE__ */ H(ne, {
|
|
2500
2555
|
"data-slot": "canvas-shell-header",
|
|
2501
2556
|
hasBorder: n,
|
|
@@ -2504,7 +2559,7 @@ function eo({ className: e, children: t, hasBorder: n = !0, ...r }) {
|
|
|
2504
2559
|
children: t
|
|
2505
2560
|
});
|
|
2506
2561
|
}
|
|
2507
|
-
function
|
|
2562
|
+
function so({ className: e, children: t, ...n }) {
|
|
2508
2563
|
return /* @__PURE__ */ H(D, {
|
|
2509
2564
|
"data-slot": "canvas-shell-title",
|
|
2510
2565
|
className: e,
|
|
@@ -2512,7 +2567,7 @@ function to({ className: e, children: t, ...n }) {
|
|
|
2512
2567
|
children: t
|
|
2513
2568
|
});
|
|
2514
2569
|
}
|
|
2515
|
-
function
|
|
2570
|
+
function co({ className: e, children: t, ...n }) {
|
|
2516
2571
|
return /* @__PURE__ */ H(te, {
|
|
2517
2572
|
"data-slot": "canvas-shell-close-trigger",
|
|
2518
2573
|
className: e,
|
|
@@ -2520,7 +2575,7 @@ function no({ className: e, children: t, ...n }) {
|
|
|
2520
2575
|
children: t
|
|
2521
2576
|
});
|
|
2522
2577
|
}
|
|
2523
|
-
function
|
|
2578
|
+
function lo({ className: e, children: t, isFullScreen: n, labels: r, ...i }) {
|
|
2524
2579
|
return /* @__PURE__ */ H(C, {
|
|
2525
2580
|
"data-slot": "canvas-shell-full-screen-trigger",
|
|
2526
2581
|
"aria-pressed": n,
|
|
@@ -2530,7 +2585,7 @@ function ro({ className: e, children: t, isFullScreen: n, labels: r, ...i }) {
|
|
|
2530
2585
|
children: t || /* @__PURE__ */ H(Lt, {})
|
|
2531
2586
|
});
|
|
2532
2587
|
}
|
|
2533
|
-
function
|
|
2588
|
+
function uo({ className: e, children: t, menuClassName: n, onOpenChange: r, ...i }) {
|
|
2534
2589
|
let [a, o] = V(!1);
|
|
2535
2590
|
function s(e) {
|
|
2536
2591
|
o(e), r?.(e);
|
|
@@ -2554,8 +2609,8 @@ function io({ className: e, children: t, menuClassName: n, onOpenChange: r, ...i
|
|
|
2554
2609
|
})]
|
|
2555
2610
|
});
|
|
2556
2611
|
}
|
|
2557
|
-
var
|
|
2558
|
-
function
|
|
2612
|
+
var fo = le;
|
|
2613
|
+
function po({ className: e, children: t, bodyClassName: n, hasPadding: r = !0, hasScroll: i = !0, ...a }) {
|
|
2559
2614
|
return /* @__PURE__ */ H(T, {
|
|
2560
2615
|
"data-slot": "canvas-shell-content",
|
|
2561
2616
|
"data-has-scroll": i,
|
|
@@ -2570,7 +2625,7 @@ function oo({ className: e, children: t, bodyClassName: n, hasPadding: r = !0, h
|
|
|
2570
2625
|
})
|
|
2571
2626
|
});
|
|
2572
2627
|
}
|
|
2573
|
-
function
|
|
2628
|
+
function mo({ className: e, children: t, ...n }) {
|
|
2574
2629
|
return /* @__PURE__ */ H(E, {
|
|
2575
2630
|
"data-slot": "canvas-shell-footer",
|
|
2576
2631
|
className: e,
|
|
@@ -2580,7 +2635,7 @@ function so({ className: e, children: t, ...n }) {
|
|
|
2580
2635
|
}
|
|
2581
2636
|
//#endregion
|
|
2582
2637
|
//#region src/components/new-chat-trigger/new-chat-trigger.tsx
|
|
2583
|
-
var
|
|
2638
|
+
var ho = P(({ asChild: e = !1, children: t, onClick: n, ...r }, i) => {
|
|
2584
2639
|
let { goToNewChat: a } = X(), o = e ? W : "button";
|
|
2585
2640
|
function s(e) {
|
|
2586
2641
|
n?.(e), a();
|
|
@@ -2593,10 +2648,10 @@ var co = P(({ asChild: e = !1, children: t, onClick: n, ...r }, i) => {
|
|
|
2593
2648
|
children: t
|
|
2594
2649
|
});
|
|
2595
2650
|
});
|
|
2596
|
-
|
|
2651
|
+
ho.displayName = "NewChatTrigger";
|
|
2597
2652
|
//#endregion
|
|
2598
2653
|
//#region src/components/chat-thinking-process/chat-thinking-process.tsx
|
|
2599
|
-
var
|
|
2654
|
+
var go = P(function({ children: e, className: t, defaultOpen: r = !1, isStreaming: i = !1, ...a }, o) {
|
|
2600
2655
|
return /* @__PURE__ */ H(n, {
|
|
2601
2656
|
defaultOpen: r,
|
|
2602
2657
|
asChild: !0,
|
|
@@ -2611,8 +2666,8 @@ var lo = P(function({ children: e, className: t, defaultOpen: r = !1, isStreamin
|
|
|
2611
2666
|
})
|
|
2612
2667
|
});
|
|
2613
2668
|
});
|
|
2614
|
-
|
|
2615
|
-
function
|
|
2669
|
+
go.displayName = "ChatThinkingProcess";
|
|
2670
|
+
function _o({ children: e, className: t, ...n }) {
|
|
2616
2671
|
return /* @__PURE__ */ U(a, {
|
|
2617
2672
|
"data-slot": "chat-thinking-process-trigger",
|
|
2618
2673
|
"data-testid": "chat-thinking-process-trigger",
|
|
@@ -2621,7 +2676,7 @@ function uo({ children: e, className: t, ...n }) {
|
|
|
2621
2676
|
children: [e, /* @__PURE__ */ H("style", { children: "\n @keyframes shimmer {\n 100% {\n mask-position: left;\n }\n }\n " })]
|
|
2622
2677
|
});
|
|
2623
2678
|
}
|
|
2624
|
-
function
|
|
2679
|
+
function vo({ children: e, className: t, ...n }) {
|
|
2625
2680
|
return /* @__PURE__ */ H("span", {
|
|
2626
2681
|
"data-slot": "chat-thinking-process-trigger-icon",
|
|
2627
2682
|
"data-testid": "chat-thinking-process-trigger-icon",
|
|
@@ -2630,7 +2685,7 @@ function fo({ children: e, className: t, ...n }) {
|
|
|
2630
2685
|
children: e
|
|
2631
2686
|
});
|
|
2632
2687
|
}
|
|
2633
|
-
function
|
|
2688
|
+
function yo({ children: e, className: t, ...n }) {
|
|
2634
2689
|
return /* @__PURE__ */ H(A, {
|
|
2635
2690
|
asChild: !0,
|
|
2636
2691
|
variant: "body-sm",
|
|
@@ -2643,7 +2698,7 @@ function po({ children: e, className: t, ...n }) {
|
|
|
2643
2698
|
})
|
|
2644
2699
|
});
|
|
2645
2700
|
}
|
|
2646
|
-
function
|
|
2701
|
+
function bo({ className: e, ...t }) {
|
|
2647
2702
|
return /* @__PURE__ */ H(r, {
|
|
2648
2703
|
"data-slot": "chat-thinking-process-trigger-arrow",
|
|
2649
2704
|
"data-testid": "chat-thinking-process-trigger-arrow",
|
|
@@ -2651,7 +2706,7 @@ function mo({ className: e, ...t }) {
|
|
|
2651
2706
|
...t
|
|
2652
2707
|
});
|
|
2653
2708
|
}
|
|
2654
|
-
function
|
|
2709
|
+
function xo({ children: e, className: t, itemsClassName: n, rowClassName: r, markerClassName: a, connectorClassName: o, previewClassName: s, hasLastMessagePreview: c = !0, ...l }) {
|
|
2655
2710
|
let { lastItemContent: u, lastItemIndex: d } = z(() => {
|
|
2656
2711
|
let t = fe.Children.toArray(e);
|
|
2657
2712
|
return {
|
|
@@ -2666,7 +2721,7 @@ function ho({ children: e, className: t, itemsClassName: n, rowClassName: r, mar
|
|
|
2666
2721
|
className: M("pt-8", t),
|
|
2667
2722
|
children: [c && u && /* @__PURE__ */ H($t, {
|
|
2668
2723
|
mode: "wait",
|
|
2669
|
-
children: /* @__PURE__ */ H(
|
|
2724
|
+
children: /* @__PURE__ */ H(So, {
|
|
2670
2725
|
contentId: d,
|
|
2671
2726
|
className: s,
|
|
2672
2727
|
children: u
|
|
@@ -2697,7 +2752,7 @@ function ho({ children: e, className: t, itemsClassName: n, rowClassName: r, mar
|
|
|
2697
2752
|
})]
|
|
2698
2753
|
});
|
|
2699
2754
|
}
|
|
2700
|
-
function
|
|
2755
|
+
function So({ children: e, className: t, contentId: n }) {
|
|
2701
2756
|
return /* @__PURE__ */ H(en.div, {
|
|
2702
2757
|
"data-slot": "chat-thinking-process-content-preview",
|
|
2703
2758
|
"data-testid": "chat-thinking-process-content-preview",
|
|
@@ -2712,7 +2767,7 @@ function go({ children: e, className: t, contentId: n }) {
|
|
|
2712
2767
|
children: e
|
|
2713
2768
|
}, n);
|
|
2714
2769
|
}
|
|
2715
|
-
function
|
|
2770
|
+
function Co({ children: e, className: t, ...n }) {
|
|
2716
2771
|
return /* @__PURE__ */ H("div", {
|
|
2717
2772
|
"data-slot": "chat-thinking-process-content-item",
|
|
2718
2773
|
"data-testid": "chat-thinking-process-content-item",
|
|
@@ -2723,14 +2778,14 @@ function _o({ children: e, className: t, ...n }) {
|
|
|
2723
2778
|
}
|
|
2724
2779
|
//#endregion
|
|
2725
2780
|
//#region src/components/deprecated-empty-state.ts
|
|
2726
|
-
var
|
|
2781
|
+
var wo = s, To = u, Eo = d, Do = l, Oo = c, ko = {
|
|
2727
2782
|
paragraph: "editor-paragraph",
|
|
2728
2783
|
text: {
|
|
2729
2784
|
bold: "editor-text-bold",
|
|
2730
2785
|
italic: "editor-text-italic",
|
|
2731
2786
|
underline: "editor-text-underline"
|
|
2732
2787
|
}
|
|
2733
|
-
},
|
|
2788
|
+
}, Ao = class e extends et {
|
|
2734
2789
|
__src;
|
|
2735
2790
|
__altText;
|
|
2736
2791
|
static getType() {
|
|
@@ -2768,7 +2823,7 @@ var vo = s, yo = u, bo = d, xo = l, So = c, Co = {
|
|
|
2768
2823
|
return { img: () => ({
|
|
2769
2824
|
conversion: (e) => {
|
|
2770
2825
|
let t = e.getAttribute("src") || "", n = e.getAttribute("alt") || "";
|
|
2771
|
-
return t ? { node:
|
|
2826
|
+
return t ? { node: jo(t, n) } : null;
|
|
2772
2827
|
},
|
|
2773
2828
|
priority: 0
|
|
2774
2829
|
}) };
|
|
@@ -2783,21 +2838,21 @@ var vo = s, yo = u, bo = d, xo = l, So = c, Co = {
|
|
|
2783
2838
|
};
|
|
2784
2839
|
}
|
|
2785
2840
|
static importJSON(e) {
|
|
2786
|
-
return
|
|
2841
|
+
return jo(e.src, e.altText);
|
|
2787
2842
|
}
|
|
2788
2843
|
isInline() {
|
|
2789
2844
|
return !1;
|
|
2790
2845
|
}
|
|
2791
2846
|
};
|
|
2792
|
-
function
|
|
2793
|
-
return new
|
|
2847
|
+
function jo(e, t) {
|
|
2848
|
+
return new Ao(e, t);
|
|
2794
2849
|
}
|
|
2795
|
-
function
|
|
2796
|
-
return e instanceof
|
|
2850
|
+
function Mo(e) {
|
|
2851
|
+
return e instanceof Ao;
|
|
2797
2852
|
}
|
|
2798
2853
|
//#endregion
|
|
2799
2854
|
//#region src/components/rich-text-area/transformers.ts
|
|
2800
|
-
function
|
|
2855
|
+
function No(e) {
|
|
2801
2856
|
let t = /font-size\s*:\s*([^;]+)/i, n = /font-family\s*:\s*([^;]+)/i, r = /(?<![\w-])color\s*:\s*([^;]+)/i, i = t.exec(e), a = n.exec(e), o = r.exec(e);
|
|
2802
2857
|
return {
|
|
2803
2858
|
fontSize: i ? i[1].trim() : null,
|
|
@@ -2805,7 +2860,7 @@ function Do(e) {
|
|
|
2805
2860
|
color: o ? o[1].trim() : null
|
|
2806
2861
|
};
|
|
2807
2862
|
}
|
|
2808
|
-
var
|
|
2863
|
+
var Po = {
|
|
2809
2864
|
type: "text-match",
|
|
2810
2865
|
trigger: "",
|
|
2811
2866
|
regExp: /./,
|
|
@@ -2813,14 +2868,14 @@ var Oo = {
|
|
|
2813
2868
|
dependencies: [],
|
|
2814
2869
|
export: (e) => {
|
|
2815
2870
|
if (!J(e)) return null;
|
|
2816
|
-
let t = e.getStyle() ?? "", n = e.getTextContent(), r =
|
|
2871
|
+
let t = e.getStyle() ?? "", n = e.getTextContent(), r = No(t);
|
|
2817
2872
|
if (r.fontSize || r.fontFamily || r.color) {
|
|
2818
2873
|
let e = "";
|
|
2819
2874
|
return r.fontSize && (e += `font-size: ${r.fontSize};`), r.fontFamily && (e += `font-family: ${r.fontFamily};`), r.color && (e += `color: ${r.color};`), `<span style="${e}">${n}</span>`;
|
|
2820
2875
|
}
|
|
2821
2876
|
return null;
|
|
2822
2877
|
}
|
|
2823
|
-
},
|
|
2878
|
+
}, Fo = {
|
|
2824
2879
|
type: "text-match",
|
|
2825
2880
|
trigger: "",
|
|
2826
2881
|
regExp: /<span\s+style="([^"]+)">(.+?)<\/span>/,
|
|
@@ -2830,7 +2885,7 @@ var Oo = {
|
|
|
2830
2885
|
let [, n, r] = t, i = Ue(r);
|
|
2831
2886
|
return i.setFormat(e.getFormat()), i.setStyle(n), e.replace(i), i;
|
|
2832
2887
|
}
|
|
2833
|
-
},
|
|
2888
|
+
}, Io = {
|
|
2834
2889
|
type: "text-match",
|
|
2835
2890
|
trigger: "",
|
|
2836
2891
|
regExp: /<ins>(.*?)<\/ins>/,
|
|
@@ -2841,15 +2896,15 @@ var Oo = {
|
|
|
2841
2896
|
return n.setFormat(e.getFormat()), n.hasFormat("underline") || n.toggleFormat("underline"), e.replace(n), n;
|
|
2842
2897
|
},
|
|
2843
2898
|
export: (e) => !J(e) || !e.hasFormat("underline") ? null : `<ins>${e.getTextContent()}</ins>`
|
|
2844
|
-
},
|
|
2899
|
+
}, Lo = (e) => {
|
|
2845
2900
|
let t = /text-align:\s*(\w+)/i.exec(e);
|
|
2846
2901
|
return t ? t[1].trim() : null;
|
|
2847
|
-
},
|
|
2902
|
+
}, Ro = {
|
|
2848
2903
|
type: "element",
|
|
2849
2904
|
dependencies: [],
|
|
2850
2905
|
regExp: /<div\s+style="([^"]+)">(.*?)<\/div>/,
|
|
2851
2906
|
replace: (e, t, n) => {
|
|
2852
|
-
let r =
|
|
2907
|
+
let r = Lo(n[1]);
|
|
2853
2908
|
if (!r) return !1;
|
|
2854
2909
|
if (!n[2]) return;
|
|
2855
2910
|
let i = t[0];
|
|
@@ -2860,39 +2915,39 @@ var Oo = {
|
|
|
2860
2915
|
let n = e.getFormatType();
|
|
2861
2916
|
return !n || n === "left" ? null : `<div style="text-align: ${n}">${t(e)}</div>`;
|
|
2862
2917
|
}
|
|
2863
|
-
},
|
|
2918
|
+
}, zo = {
|
|
2864
2919
|
type: "text-match",
|
|
2865
2920
|
trigger: "",
|
|
2866
2921
|
regExp: /./,
|
|
2867
2922
|
importRegExp: /./,
|
|
2868
|
-
dependencies: [
|
|
2869
|
-
export: (e) =>
|
|
2870
|
-
},
|
|
2923
|
+
dependencies: [Ao],
|
|
2924
|
+
export: (e) => Mo(e) ? `<img src="${e.__src}" alt="${e.__altText}" />` : null
|
|
2925
|
+
}, Bo = {
|
|
2871
2926
|
type: "text-match",
|
|
2872
2927
|
trigger: "",
|
|
2873
2928
|
regExp: /<img\s+src="([^"]+)"\s+alt="([^"]*)"[^>]*\/?>/,
|
|
2874
2929
|
importRegExp: /<img\s+src="([^"]+)"\s+alt="([^"]*)"[^>]*\/?>/,
|
|
2875
|
-
dependencies: [
|
|
2930
|
+
dependencies: [Ao],
|
|
2876
2931
|
replace: (e, t) => {
|
|
2877
|
-
let [, n, r] = t, i =
|
|
2932
|
+
let [, n, r] = t, i = jo(n, r);
|
|
2878
2933
|
e.replace(i);
|
|
2879
2934
|
}
|
|
2880
|
-
},
|
|
2935
|
+
}, Vo = [
|
|
2881
2936
|
...ze,
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
],
|
|
2937
|
+
Po,
|
|
2938
|
+
Io,
|
|
2939
|
+
Ro,
|
|
2940
|
+
zo
|
|
2941
|
+
], Ho = [
|
|
2887
2942
|
...ze,
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2943
|
+
Fo,
|
|
2944
|
+
Io,
|
|
2945
|
+
Ro,
|
|
2946
|
+
Bo
|
|
2892
2947
|
];
|
|
2893
2948
|
//#endregion
|
|
2894
2949
|
//#region src/components/rich-text-area/html-config.ts
|
|
2895
|
-
function
|
|
2950
|
+
function Uo(e) {
|
|
2896
2951
|
let t = e.nodeName.toLowerCase();
|
|
2897
2952
|
if (t !== "h1" && t !== "h2" && t !== "h3" && t !== "h4" && t !== "h5" && t !== "h6") return null;
|
|
2898
2953
|
let n = Me(t), r = e.getAttribute("style") ?? "";
|
|
@@ -2902,22 +2957,22 @@ function Lo(e) {
|
|
|
2902
2957
|
}
|
|
2903
2958
|
return { node: n };
|
|
2904
2959
|
}
|
|
2905
|
-
function
|
|
2960
|
+
function Wo(e) {
|
|
2906
2961
|
if (e.getAttribute("__lexicallisttype") === "check" || e.classList.contains("contains-task-list")) return !0;
|
|
2907
2962
|
for (let t of e.childNodes) if (ut(t) && t.hasAttribute("aria-checked")) return !0;
|
|
2908
2963
|
return !1;
|
|
2909
2964
|
}
|
|
2910
|
-
function
|
|
2965
|
+
function Go(e) {
|
|
2911
2966
|
let t = e.nodeName.toLowerCase(), n = null;
|
|
2912
2967
|
if (t === "ol") {
|
|
2913
2968
|
let t = e.start;
|
|
2914
2969
|
n = we("number", t);
|
|
2915
|
-
} else t === "ul" && (n =
|
|
2970
|
+
} else t === "ul" && (n = Wo(e) ? we("check") : we("bullet"));
|
|
2916
2971
|
if (!n) return null;
|
|
2917
2972
|
let r = e.getAttribute("style") ?? "";
|
|
2918
2973
|
return n.setStyle(r), { node: n };
|
|
2919
2974
|
}
|
|
2920
|
-
function
|
|
2975
|
+
function Ko(e) {
|
|
2921
2976
|
if (e.classList.contains("task-list-item")) {
|
|
2922
2977
|
for (let t of e.children) if (t.tagName === "INPUT") {
|
|
2923
2978
|
let n = t;
|
|
@@ -2931,8 +2986,8 @@ function Bo(e) {
|
|
|
2931
2986
|
return n.setStyle(r), { node: n };
|
|
2932
2987
|
}
|
|
2933
2988
|
var Z = 4;
|
|
2934
|
-
function
|
|
2935
|
-
let { color: t, fontSize: n, fontFamily: r } =
|
|
2989
|
+
function qo(e) {
|
|
2990
|
+
let { color: t, fontSize: n, fontFamily: r } = No(e.getAttribute("style") ?? "");
|
|
2936
2991
|
if (!t && !n && !r) return null;
|
|
2937
2992
|
let i = e.style;
|
|
2938
2993
|
return {
|
|
@@ -2946,59 +3001,59 @@ function Vo(e) {
|
|
|
2946
3001
|
node: null
|
|
2947
3002
|
};
|
|
2948
3003
|
}
|
|
2949
|
-
var
|
|
3004
|
+
var Jo = {
|
|
2950
3005
|
h1: () => ({
|
|
2951
|
-
conversion:
|
|
3006
|
+
conversion: Uo,
|
|
2952
3007
|
priority: Z
|
|
2953
3008
|
}),
|
|
2954
3009
|
h2: () => ({
|
|
2955
|
-
conversion:
|
|
3010
|
+
conversion: Uo,
|
|
2956
3011
|
priority: Z
|
|
2957
3012
|
}),
|
|
2958
3013
|
h3: () => ({
|
|
2959
|
-
conversion:
|
|
3014
|
+
conversion: Uo,
|
|
2960
3015
|
priority: Z
|
|
2961
3016
|
}),
|
|
2962
3017
|
h4: () => ({
|
|
2963
|
-
conversion:
|
|
3018
|
+
conversion: Uo,
|
|
2964
3019
|
priority: Z
|
|
2965
3020
|
}),
|
|
2966
3021
|
h5: () => ({
|
|
2967
|
-
conversion:
|
|
3022
|
+
conversion: Uo,
|
|
2968
3023
|
priority: Z
|
|
2969
3024
|
}),
|
|
2970
3025
|
h6: () => ({
|
|
2971
|
-
conversion:
|
|
3026
|
+
conversion: Uo,
|
|
2972
3027
|
priority: Z
|
|
2973
3028
|
}),
|
|
2974
3029
|
ul: () => ({
|
|
2975
|
-
conversion:
|
|
3030
|
+
conversion: Go,
|
|
2976
3031
|
priority: Z
|
|
2977
3032
|
}),
|
|
2978
3033
|
ol: () => ({
|
|
2979
|
-
conversion:
|
|
3034
|
+
conversion: Go,
|
|
2980
3035
|
priority: Z
|
|
2981
3036
|
}),
|
|
2982
3037
|
li: () => ({
|
|
2983
|
-
conversion:
|
|
3038
|
+
conversion: Ko,
|
|
2984
3039
|
priority: Z
|
|
2985
3040
|
}),
|
|
2986
3041
|
span: () => ({
|
|
2987
|
-
conversion:
|
|
3042
|
+
conversion: qo,
|
|
2988
3043
|
priority: Z
|
|
2989
3044
|
})
|
|
2990
3045
|
};
|
|
2991
|
-
function
|
|
3046
|
+
function Yo(e) {
|
|
2992
3047
|
return (t, n) => {
|
|
2993
3048
|
let r = e.prototype.exportDOM.call(n, t), i = n.getStyle();
|
|
2994
3049
|
return r.element && i && r.element.setAttribute("style", i), r;
|
|
2995
3050
|
};
|
|
2996
3051
|
}
|
|
2997
|
-
var
|
|
2998
|
-
[Ne,
|
|
2999
|
-
[Ee,
|
|
3000
|
-
[Te,
|
|
3001
|
-
]),
|
|
3052
|
+
var Xo = /* @__PURE__ */ new Map([
|
|
3053
|
+
[Ne, Yo(Ne)],
|
|
3054
|
+
[Ee, Yo(Ee)],
|
|
3055
|
+
[Te, Yo(Te)]
|
|
3056
|
+
]), Zo = class e extends tt {
|
|
3002
3057
|
static getType() {
|
|
3003
3058
|
return "div-block";
|
|
3004
3059
|
}
|
|
@@ -3015,7 +3070,7 @@ var Wo = /* @__PURE__ */ new Map([
|
|
|
3015
3070
|
}
|
|
3016
3071
|
static importDOM() {
|
|
3017
3072
|
return { div: () => ({
|
|
3018
|
-
conversion:
|
|
3073
|
+
conversion: Qo,
|
|
3019
3074
|
priority: 4
|
|
3020
3075
|
}) };
|
|
3021
3076
|
}
|
|
@@ -3027,7 +3082,7 @@ var Wo = /* @__PURE__ */ new Map([
|
|
|
3027
3082
|
} : e;
|
|
3028
3083
|
}
|
|
3029
3084
|
static importJSON(e) {
|
|
3030
|
-
let t =
|
|
3085
|
+
let t = $o().updateFromJSON(e);
|
|
3031
3086
|
return e.style !== void 0 && t.setStyle(e.style), t;
|
|
3032
3087
|
}
|
|
3033
3088
|
updateFromJSON(e) {
|
|
@@ -3046,26 +3101,26 @@ var Wo = /* @__PURE__ */ new Map([
|
|
|
3046
3101
|
return !1;
|
|
3047
3102
|
}
|
|
3048
3103
|
};
|
|
3049
|
-
function
|
|
3050
|
-
let t =
|
|
3104
|
+
function Qo(e) {
|
|
3105
|
+
let t = $o(), n = e.getAttribute("style") ?? "";
|
|
3051
3106
|
if (t.setStyle(n), e.style) {
|
|
3052
3107
|
let n = e.style.textAlign;
|
|
3053
3108
|
(n === "left" || n === "right" || n === "center" || n === "justify" || n === "start" || n === "end") && t.setFormat(n), dt(e, t);
|
|
3054
3109
|
}
|
|
3055
3110
|
return { node: t };
|
|
3056
3111
|
}
|
|
3057
|
-
function
|
|
3058
|
-
return new
|
|
3112
|
+
function $o() {
|
|
3113
|
+
return new Zo();
|
|
3059
3114
|
}
|
|
3060
3115
|
//#endregion
|
|
3061
3116
|
//#region src/components/rich-text-area/plugins/value-plugin.tsx
|
|
3062
|
-
var
|
|
3063
|
-
function
|
|
3117
|
+
var es = 50;
|
|
3118
|
+
function ts({ onChange: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
3064
3119
|
let r = F((r, i, a) => {
|
|
3065
3120
|
if (!a.has("focus") && e) try {
|
|
3066
3121
|
r.read(() => {
|
|
3067
|
-
let r = t === "html" ? on(i) : Le(
|
|
3068
|
-
n && (n.current.push(r), n.current.splice(0, n.current.length -
|
|
3122
|
+
let r = t === "html" ? on(i) : Le(Vo);
|
|
3123
|
+
n && (n.current.push(r), n.current.splice(0, n.current.length - es)), e(r);
|
|
3069
3124
|
});
|
|
3070
3125
|
} catch {}
|
|
3071
3126
|
}, [
|
|
@@ -3081,7 +3136,7 @@ function Q() {
|
|
|
3081
3136
|
let [e] = Fe();
|
|
3082
3137
|
return e;
|
|
3083
3138
|
}
|
|
3084
|
-
function
|
|
3139
|
+
function ns() {
|
|
3085
3140
|
let [e] = Fe();
|
|
3086
3141
|
return F(() => {
|
|
3087
3142
|
let t = "";
|
|
@@ -3092,7 +3147,7 @@ function Xo() {
|
|
|
3092
3147
|
}
|
|
3093
3148
|
//#endregion
|
|
3094
3149
|
//#region src/components/rich-text-area/plugins/disabled-plugin.tsx
|
|
3095
|
-
function
|
|
3150
|
+
function rs({ isDisabled: e }) {
|
|
3096
3151
|
let t = Q();
|
|
3097
3152
|
return L(() => {
|
|
3098
3153
|
t.setEditable(!e);
|
|
@@ -3100,7 +3155,7 @@ function Zo({ isDisabled: e }) {
|
|
|
3100
3155
|
}
|
|
3101
3156
|
//#endregion
|
|
3102
3157
|
//#region src/components/rich-text-area/plugins/controlled-plugin.tsx
|
|
3103
|
-
function
|
|
3158
|
+
function is({ controlledRef: e }) {
|
|
3104
3159
|
let t = B(null);
|
|
3105
3160
|
return _e(e, () => ({ focus: () => {
|
|
3106
3161
|
Promise.resolve().then(() => {
|
|
@@ -3110,11 +3165,11 @@ function Qo({ controlledRef: e }) {
|
|
|
3110
3165
|
}
|
|
3111
3166
|
//#endregion
|
|
3112
3167
|
//#region src/components/rich-text-area/utils/index.ts
|
|
3113
|
-
function
|
|
3168
|
+
function as(e) {
|
|
3114
3169
|
let t = e.getRootElement();
|
|
3115
3170
|
t && (t.scrollTop = t.scrollHeight);
|
|
3116
3171
|
}
|
|
3117
|
-
function
|
|
3172
|
+
function os() {
|
|
3118
3173
|
let e = G().getLastDescendant();
|
|
3119
3174
|
if (e && J(e)) {
|
|
3120
3175
|
let t = He(), n = e.getTextContentSize();
|
|
@@ -3128,7 +3183,7 @@ function es() {
|
|
|
3128
3183
|
}
|
|
3129
3184
|
}
|
|
3130
3185
|
}
|
|
3131
|
-
function
|
|
3186
|
+
function ss(e, t) {
|
|
3132
3187
|
let n = new DOMParser().parseFromString(t, "text/html");
|
|
3133
3188
|
return sn(e, n).map((e) => {
|
|
3134
3189
|
if (J(e)) {
|
|
@@ -3138,12 +3193,12 @@ function ts(e, t) {
|
|
|
3138
3193
|
return e;
|
|
3139
3194
|
});
|
|
3140
3195
|
}
|
|
3141
|
-
function
|
|
3196
|
+
function cs(e, t) {
|
|
3142
3197
|
let n = G();
|
|
3143
|
-
n.clear(),
|
|
3198
|
+
n.clear(), ss(e, t).forEach((e) => n.append(e));
|
|
3144
3199
|
}
|
|
3145
|
-
function
|
|
3146
|
-
let n = K(), r =
|
|
3200
|
+
function ls(e, t) {
|
|
3201
|
+
let n = K(), r = ss(e, t);
|
|
3147
3202
|
if (q(n)) n.insertNodes(r);
|
|
3148
3203
|
else {
|
|
3149
3204
|
let e = G();
|
|
@@ -3152,7 +3207,7 @@ function rs(e, t) {
|
|
|
3152
3207
|
}
|
|
3153
3208
|
//#endregion
|
|
3154
3209
|
//#region src/components/rich-text-area/plugins/controlled-value-plugin.tsx
|
|
3155
|
-
function
|
|
3210
|
+
function us({ value: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
3156
3211
|
let r = Q(), i = B(), a = B(!!e?.trim()), o = ue("desktop");
|
|
3157
3212
|
return L(() => {
|
|
3158
3213
|
if (!r || e === i.current) return;
|
|
@@ -3162,20 +3217,20 @@ function is({ value: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
|
3162
3217
|
}
|
|
3163
3218
|
let s = "";
|
|
3164
3219
|
if (r.getEditorState().read(() => {
|
|
3165
|
-
s = t === "html" ? on(r) : Le(
|
|
3220
|
+
s = t === "html" ? on(r) : Le(Vo);
|
|
3166
3221
|
}), e !== void 0 && e !== s) {
|
|
3167
3222
|
if (e === "") {
|
|
3168
3223
|
r.update(() => {
|
|
3169
|
-
Be(ot), t === "html" ? G().clear() : Ie("",
|
|
3224
|
+
Be(ot), t === "html" ? G().clear() : Ie("", Ho), os();
|
|
3170
3225
|
}, { discrete: !0 }), Promise.resolve().then(() => {
|
|
3171
3226
|
o ? r.focus() : r.blur();
|
|
3172
3227
|
});
|
|
3173
3228
|
return;
|
|
3174
3229
|
}
|
|
3175
3230
|
r.update(() => {
|
|
3176
|
-
Be(ot), t === "html" ?
|
|
3231
|
+
Be(ot), t === "html" ? cs(r, e) : Ie(e, Ho), os();
|
|
3177
3232
|
}), a.current && (a.current = !1, Promise.resolve().then(() => {
|
|
3178
|
-
requestAnimationFrame(() =>
|
|
3233
|
+
requestAnimationFrame(() => as(r));
|
|
3179
3234
|
})), o && Promise.resolve().then(() => {
|
|
3180
3235
|
r.focus();
|
|
3181
3236
|
});
|
|
@@ -3190,7 +3245,7 @@ function is({ value: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
|
3190
3245
|
}
|
|
3191
3246
|
//#endregion
|
|
3192
3247
|
//#region src/components/rich-text-area/plugins/blur-plugin.tsx
|
|
3193
|
-
function
|
|
3248
|
+
function ds({ onBlur: e }) {
|
|
3194
3249
|
let t = Q();
|
|
3195
3250
|
return L(() => {
|
|
3196
3251
|
if (!e) return;
|
|
@@ -3206,7 +3261,7 @@ function as({ onBlur: e }) {
|
|
|
3206
3261
|
}
|
|
3207
3262
|
//#endregion
|
|
3208
3263
|
//#region src/components/rich-text-area/plugins/focus-plugin.tsx
|
|
3209
|
-
function
|
|
3264
|
+
function fs({ onFocusChange: e }) {
|
|
3210
3265
|
let t = Q();
|
|
3211
3266
|
return L(() => {
|
|
3212
3267
|
if (!e) return;
|
|
@@ -3225,66 +3280,66 @@ function os({ onFocusChange: e }) {
|
|
|
3225
3280
|
}
|
|
3226
3281
|
//#endregion
|
|
3227
3282
|
//#region src/components/rich-text-area/plugins/image-drop-plugin.tsx
|
|
3228
|
-
var
|
|
3283
|
+
var ps = ct("INSERT_IMAGE_COMMAND"), ms = "helvetiq:insert-image", hs = class extends CustomEvent {
|
|
3229
3284
|
constructor(e) {
|
|
3230
|
-
super(
|
|
3285
|
+
super(ms, { detail: e });
|
|
3231
3286
|
}
|
|
3232
3287
|
};
|
|
3233
|
-
function
|
|
3288
|
+
function gs() {
|
|
3234
3289
|
let e = Q();
|
|
3235
|
-
return L(() => e.registerCommand(
|
|
3236
|
-
let e =
|
|
3290
|
+
return L(() => e.registerCommand(ps, (t) => (e.update(() => {
|
|
3291
|
+
let e = jo(t.src, t.altText);
|
|
3237
3292
|
Ge([e]);
|
|
3238
3293
|
}), !0), Qe), [e]), L(() => {
|
|
3239
3294
|
if (!e.getRootElement()) return;
|
|
3240
3295
|
function t(t) {
|
|
3241
3296
|
let n = t;
|
|
3242
|
-
e.dispatchCommand(
|
|
3297
|
+
e.dispatchCommand(ps, n.detail);
|
|
3243
3298
|
}
|
|
3244
|
-
return document.addEventListener(
|
|
3245
|
-
document.removeEventListener(
|
|
3299
|
+
return document.addEventListener(ms, t), () => {
|
|
3300
|
+
document.removeEventListener(ms, t);
|
|
3246
3301
|
};
|
|
3247
3302
|
}, [e]), null;
|
|
3248
3303
|
}
|
|
3249
3304
|
//#endregion
|
|
3250
3305
|
//#region src/components/rich-text-area/plugins/html-paste-plugin.tsx
|
|
3251
|
-
var
|
|
3306
|
+
var _s = ct("PASTE_HTML_COMMAND"), vs = ct("INSERT_HTML_COMMAND"), ys = "helvetiq:paste-html", bs = "helvetiq:insert-html", xs = class extends CustomEvent {
|
|
3252
3307
|
constructor(e) {
|
|
3253
|
-
super(
|
|
3308
|
+
super(ys, { detail: e });
|
|
3254
3309
|
}
|
|
3255
|
-
},
|
|
3310
|
+
}, Ss = class extends CustomEvent {
|
|
3256
3311
|
constructor(e) {
|
|
3257
|
-
super(
|
|
3312
|
+
super(bs, { detail: e });
|
|
3258
3313
|
}
|
|
3259
3314
|
};
|
|
3260
|
-
function
|
|
3315
|
+
function Cs() {
|
|
3261
3316
|
let e = Q();
|
|
3262
|
-
return L(() => e.registerCommand(
|
|
3317
|
+
return L(() => e.registerCommand(_s, (t) => (e.update(() => {
|
|
3263
3318
|
let n = G();
|
|
3264
3319
|
n.clear();
|
|
3265
3320
|
let r = new DOMParser().parseFromString(t.html, "text/html"), i = sn(e, r);
|
|
3266
3321
|
n.append(...i);
|
|
3267
|
-
}), !0), Qe), [e]), L(() => e.registerCommand(
|
|
3322
|
+
}), !0), Qe), [e]), L(() => e.registerCommand(vs, (t) => (e.update(() => {
|
|
3268
3323
|
let n = new DOMParser().parseFromString(t.html, "text/html"), r = sn(e, n);
|
|
3269
3324
|
Ge(r);
|
|
3270
3325
|
}), !0), Qe), [e]), L(() => {
|
|
3271
3326
|
if (!e.getRootElement()) return;
|
|
3272
3327
|
function t(t) {
|
|
3273
3328
|
let n = t;
|
|
3274
|
-
e.dispatchCommand(
|
|
3329
|
+
e.dispatchCommand(_s, n.detail);
|
|
3275
3330
|
}
|
|
3276
3331
|
function n(t) {
|
|
3277
3332
|
let n = t;
|
|
3278
|
-
e.dispatchCommand(
|
|
3333
|
+
e.dispatchCommand(vs, n.detail);
|
|
3279
3334
|
}
|
|
3280
|
-
return document.addEventListener(
|
|
3281
|
-
document.removeEventListener(
|
|
3335
|
+
return document.addEventListener(ys, t), document.addEventListener(bs, n), () => {
|
|
3336
|
+
document.removeEventListener(ys, t), document.removeEventListener(bs, n);
|
|
3282
3337
|
};
|
|
3283
3338
|
}, [e]), null;
|
|
3284
3339
|
}
|
|
3285
3340
|
//#endregion
|
|
3286
3341
|
//#region src/components/rich-text-area/plugins/markdown-plain-paste-plugin.tsx
|
|
3287
|
-
function
|
|
3342
|
+
function ws() {
|
|
3288
3343
|
let e = Q();
|
|
3289
3344
|
return L(() => e.registerCommand(it, (t) => {
|
|
3290
3345
|
let { clipboardData: n } = t;
|
|
@@ -3306,10 +3361,10 @@ function vs() {
|
|
|
3306
3361
|
}
|
|
3307
3362
|
//#endregion
|
|
3308
3363
|
//#region src/components/rich-text-area/plugins/file-attachment-plugin.tsx
|
|
3309
|
-
var
|
|
3310
|
-
function
|
|
3364
|
+
var Ts = ct("ATTACH_FILE_COMMAND");
|
|
3365
|
+
function Es({ acceptedFiles: e = [], isMultiple: t = !1, onFileAttach: n }) {
|
|
3311
3366
|
let r = Q(), i = B(null);
|
|
3312
|
-
L(() => r.registerCommand(
|
|
3367
|
+
L(() => r.registerCommand(Ts, () => (i.current?.click(), !0), Qe), [r]);
|
|
3313
3368
|
function a(e) {
|
|
3314
3369
|
let r = Array.from(e.target.files ?? []);
|
|
3315
3370
|
if (t) n?.(r);
|
|
@@ -3331,18 +3386,18 @@ function bs({ acceptedFiles: e = [], isMultiple: t = !1, onFileAttach: n }) {
|
|
|
3331
3386
|
}
|
|
3332
3387
|
//#endregion
|
|
3333
3388
|
//#region src/components/rich-text-area/styled.tsx
|
|
3334
|
-
var
|
|
3389
|
+
var Ds = P(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ H("div", {
|
|
3335
3390
|
ref: r,
|
|
3336
3391
|
className: M("w-full resize-none border-none outline-none bg-transparent font-[inherit] text-[inherit] flex items-center [&_.editor-paragraph]:m-0 [&_.editor-paragraph]:min-h-[26px] [&_.editor-text-bold]:font-bold [&_.editor-text-italic]:italic [&_.editor-text-underline]:underline", e),
|
|
3337
3392
|
...n,
|
|
3338
3393
|
children: t
|
|
3339
3394
|
}));
|
|
3340
|
-
|
|
3395
|
+
Ds.displayName = "Wrapper";
|
|
3341
3396
|
//#endregion
|
|
3342
3397
|
//#region src/components/rich-text-area/rich-text-area.tsx
|
|
3343
|
-
var
|
|
3398
|
+
var Os = {
|
|
3344
3399
|
namespace: "helvetiq",
|
|
3345
|
-
theme:
|
|
3400
|
+
theme: ko,
|
|
3346
3401
|
editable: !0,
|
|
3347
3402
|
nodes: [
|
|
3348
3403
|
Ee,
|
|
@@ -3351,25 +3406,25 @@ var Ss = {
|
|
|
3351
3406
|
Pe,
|
|
3352
3407
|
ye,
|
|
3353
3408
|
xe,
|
|
3354
|
-
|
|
3355
|
-
|
|
3409
|
+
Ao,
|
|
3410
|
+
Zo,
|
|
3356
3411
|
rn,
|
|
3357
3412
|
nn,
|
|
3358
3413
|
an
|
|
3359
3414
|
],
|
|
3360
3415
|
html: {
|
|
3361
|
-
import:
|
|
3362
|
-
export:
|
|
3416
|
+
import: Jo,
|
|
3417
|
+
export: Xo
|
|
3363
3418
|
},
|
|
3364
3419
|
onError: (e) => {
|
|
3365
3420
|
console.error("Lexical error:", e);
|
|
3366
3421
|
}
|
|
3367
3422
|
};
|
|
3368
|
-
function
|
|
3423
|
+
function ks({ children: e, name: t, value: n, source: r = "markdown", className: i, containerClassName: a, placeholderClassName: o, placeholder: s = "", isDisabled: c = !1, onChange: l, onBlur: u, onKeyDown: d, onFocusChange: f, forwardedRef: p, ...m }) {
|
|
3369
3424
|
let h = B([]);
|
|
3370
3425
|
return /* @__PURE__ */ H(De, {
|
|
3371
|
-
initialConfig:
|
|
3372
|
-
children: /* @__PURE__ */ U(
|
|
3426
|
+
initialConfig: Os,
|
|
3427
|
+
children: /* @__PURE__ */ U(Ds, {
|
|
3373
3428
|
"data-slot": "rich-text-area",
|
|
3374
3429
|
"data-testid": "rich-text-area",
|
|
3375
3430
|
"aria-disabled": c,
|
|
@@ -3400,36 +3455,36 @@ function Cs({ children: e, name: t, value: n, source: r = "markdown", className:
|
|
|
3400
3455
|
}),
|
|
3401
3456
|
ErrorBoundary: ke
|
|
3402
3457
|
}),
|
|
3403
|
-
/* @__PURE__ */ H(
|
|
3404
|
-
/* @__PURE__ */ H(
|
|
3458
|
+
/* @__PURE__ */ H(rs, { isDisabled: c }),
|
|
3459
|
+
/* @__PURE__ */ H(us, {
|
|
3405
3460
|
value: n,
|
|
3406
3461
|
source: r,
|
|
3407
3462
|
emittedValuesRef: h
|
|
3408
3463
|
}),
|
|
3409
|
-
/* @__PURE__ */ H(
|
|
3464
|
+
/* @__PURE__ */ H(ts, {
|
|
3410
3465
|
onChange: l,
|
|
3411
3466
|
source: r,
|
|
3412
3467
|
emittedValuesRef: h
|
|
3413
3468
|
}),
|
|
3414
|
-
/* @__PURE__ */ H(
|
|
3469
|
+
/* @__PURE__ */ H(ds, { onBlur: u }),
|
|
3415
3470
|
/* @__PURE__ */ H(Ae, {}),
|
|
3416
|
-
/* @__PURE__ */ H(
|
|
3417
|
-
/* @__PURE__ */ H(
|
|
3471
|
+
/* @__PURE__ */ H(is, { controlledRef: p ?? null }),
|
|
3472
|
+
/* @__PURE__ */ H(fs, { onFocusChange: f }),
|
|
3418
3473
|
/* @__PURE__ */ H(tn, {}),
|
|
3419
|
-
r === "markdown" && /* @__PURE__ */ H(
|
|
3474
|
+
r === "markdown" && /* @__PURE__ */ H(ws, {}),
|
|
3420
3475
|
e
|
|
3421
3476
|
]
|
|
3422
3477
|
})
|
|
3423
3478
|
});
|
|
3424
3479
|
}
|
|
3425
|
-
var
|
|
3480
|
+
var As = P((e, t) => /* @__PURE__ */ H(ks, {
|
|
3426
3481
|
...e,
|
|
3427
3482
|
forwardedRef: t
|
|
3428
3483
|
}));
|
|
3429
|
-
|
|
3484
|
+
As.displayName = "RichTextArea";
|
|
3430
3485
|
//#endregion
|
|
3431
3486
|
//#region src/components/rich-text-field/constants.ts
|
|
3432
|
-
var
|
|
3487
|
+
var js = "Arial, sans-serif", Ms = [
|
|
3433
3488
|
{
|
|
3434
3489
|
value: "Arial, sans-serif",
|
|
3435
3490
|
label: "Arial"
|
|
@@ -3466,7 +3521,7 @@ var Ts = "Arial, sans-serif", Es = [
|
|
|
3466
3521
|
value: "\"Brush Script MT\", cursive",
|
|
3467
3522
|
label: "Brush Script MT"
|
|
3468
3523
|
}
|
|
3469
|
-
],
|
|
3524
|
+
], Ns = js, Ps = [
|
|
3470
3525
|
{
|
|
3471
3526
|
label: "10",
|
|
3472
3527
|
value: "10"
|
|
@@ -3495,10 +3550,10 @@ var Ts = "Arial, sans-serif", Es = [
|
|
|
3495
3550
|
label: "48",
|
|
3496
3551
|
value: "48"
|
|
3497
3552
|
}
|
|
3498
|
-
],
|
|
3553
|
+
], Fs = "left", Is = "#000000";
|
|
3499
3554
|
//#endregion
|
|
3500
3555
|
//#region src/components/rich-text-field/components/toolbar-select.tsx
|
|
3501
|
-
function
|
|
3556
|
+
function Ls({ className: e, selectItemClassName: t, ...n }) {
|
|
3502
3557
|
return /* @__PURE__ */ H(oe, {
|
|
3503
3558
|
fullWidth: !1,
|
|
3504
3559
|
size: "small",
|
|
@@ -3509,10 +3564,10 @@ function js({ className: e, selectItemClassName: t, ...n }) {
|
|
|
3509
3564
|
}
|
|
3510
3565
|
//#endregion
|
|
3511
3566
|
//#region src/components/rich-text-field/components/alignment-select.tsx
|
|
3512
|
-
function
|
|
3567
|
+
function Rs(e) {
|
|
3513
3568
|
return e === "center" || e === "right" ? e : e === "end" ? "right" : "left";
|
|
3514
3569
|
}
|
|
3515
|
-
var
|
|
3570
|
+
var zs = {
|
|
3516
3571
|
left: {
|
|
3517
3572
|
label: "Left",
|
|
3518
3573
|
icon: /* @__PURE__ */ H(Et, { fontSize: "inherit" })
|
|
@@ -3526,8 +3581,8 @@ var Ns = {
|
|
|
3526
3581
|
icon: /* @__PURE__ */ H(Dt, { fontSize: "inherit" })
|
|
3527
3582
|
}
|
|
3528
3583
|
};
|
|
3529
|
-
function
|
|
3530
|
-
let t = Q(), [n, r] = V(
|
|
3584
|
+
function Bs({ className: e }) {
|
|
3585
|
+
let t = Q(), [n, r] = V(Fs), i = z(() => Object.entries(zs).map(([e, { label: t, icon: n }]) => ({
|
|
3531
3586
|
value: e,
|
|
3532
3587
|
label: t,
|
|
3533
3588
|
icon: n
|
|
@@ -3535,7 +3590,7 @@ function Ps({ className: e }) {
|
|
|
3535
3590
|
let e = K();
|
|
3536
3591
|
if (q(e)) {
|
|
3537
3592
|
let t = e.anchor.getNode(), n = t.getParent(), i = Ke(t) ? t : n;
|
|
3538
|
-
Ke(i) && r(
|
|
3593
|
+
Ke(i) && r(Rs(i.getFormatType() || "left"));
|
|
3539
3594
|
}
|
|
3540
3595
|
}, []);
|
|
3541
3596
|
L(() => un(t.registerUpdateListener(({ editorState: e }) => {
|
|
@@ -3546,7 +3601,7 @@ function Ps({ className: e }) {
|
|
|
3546
3601
|
function o(e) {
|
|
3547
3602
|
t.dispatchCommand(nt, e);
|
|
3548
3603
|
}
|
|
3549
|
-
return /* @__PURE__ */ H(
|
|
3604
|
+
return /* @__PURE__ */ H(Ls, {
|
|
3550
3605
|
shouldShowOnlyIcon: !0,
|
|
3551
3606
|
options: i,
|
|
3552
3607
|
value: n,
|
|
@@ -3569,10 +3624,10 @@ function $({ className: e, children: t, isActive: n, isDisabled: r = !1, ...i })
|
|
|
3569
3624
|
}
|
|
3570
3625
|
//#endregion
|
|
3571
3626
|
//#region src/components/rich-text-field/components/attachment-button.tsx
|
|
3572
|
-
function
|
|
3627
|
+
function Vs(e) {
|
|
3573
3628
|
let t = Q();
|
|
3574
3629
|
function n() {
|
|
3575
|
-
t.dispatchCommand(
|
|
3630
|
+
t.dispatchCommand(Ts, void 0);
|
|
3576
3631
|
}
|
|
3577
3632
|
return /* @__PURE__ */ H($, {
|
|
3578
3633
|
"data-testid": "attachment-button",
|
|
@@ -3584,76 +3639,76 @@ function Fs(e) {
|
|
|
3584
3639
|
}
|
|
3585
3640
|
//#endregion
|
|
3586
3641
|
//#region src/components/rich-text-field/utils.ts
|
|
3587
|
-
function
|
|
3642
|
+
function Hs(e) {
|
|
3588
3643
|
let t;
|
|
3589
3644
|
for (let n of hn(e, { silent: !0 })) n.type === "declaration" && n.value && (t ||= {}, t[n.property] = n.value);
|
|
3590
|
-
return t ||
|
|
3645
|
+
return t || Us;
|
|
3591
3646
|
}
|
|
3592
|
-
var
|
|
3593
|
-
function
|
|
3594
|
-
return typeof e == "string" ?
|
|
3647
|
+
var Us = Object.freeze({});
|
|
3648
|
+
function Ws(e) {
|
|
3649
|
+
return typeof e == "string" ? Hs(e) : Us;
|
|
3595
3650
|
}
|
|
3596
|
-
function
|
|
3651
|
+
function Gs(e) {
|
|
3597
3652
|
let t = [];
|
|
3598
3653
|
for (let [n, r] of Object.entries(e)) n && r && t.push(`${n}: ${r};`);
|
|
3599
3654
|
return t.sort().join(" ");
|
|
3600
3655
|
}
|
|
3601
|
-
function
|
|
3656
|
+
function Ks(e, t) {
|
|
3602
3657
|
return e === t || !e && !t;
|
|
3603
3658
|
}
|
|
3604
|
-
function
|
|
3659
|
+
function qs(e, t) {
|
|
3605
3660
|
if (e === t) return !0;
|
|
3606
|
-
for (let n in e) if (!(n in t &&
|
|
3661
|
+
for (let n in e) if (!(n in t && Ks(e[n], t[n]))) return !1;
|
|
3607
3662
|
for (let n in t) if (!(n in e)) return !1;
|
|
3608
3663
|
return !0;
|
|
3609
3664
|
}
|
|
3610
|
-
var
|
|
3611
|
-
isEqual:
|
|
3612
|
-
parse:
|
|
3613
|
-
unparse:
|
|
3665
|
+
var Js = lt("style", {
|
|
3666
|
+
isEqual: qs,
|
|
3667
|
+
parse: Ws,
|
|
3668
|
+
unparse: Gs
|
|
3614
3669
|
});
|
|
3615
|
-
function
|
|
3616
|
-
return Xe(e,
|
|
3670
|
+
function Ys(e, t) {
|
|
3671
|
+
return Xe(e, Js, t);
|
|
3617
3672
|
}
|
|
3618
|
-
function
|
|
3619
|
-
return e ===
|
|
3673
|
+
function Xs(e, t) {
|
|
3674
|
+
return e === Us || e === t ? t : {
|
|
3620
3675
|
...e,
|
|
3621
3676
|
...t
|
|
3622
3677
|
};
|
|
3623
3678
|
}
|
|
3624
3679
|
ct("PATCH_TEXT_STYLE_COMMAND");
|
|
3625
|
-
function
|
|
3680
|
+
function Zs(e) {
|
|
3626
3681
|
let t = K();
|
|
3627
3682
|
if (!t) {
|
|
3628
3683
|
let e = We();
|
|
3629
3684
|
if (!e) return !1;
|
|
3630
3685
|
t = e.clone(), Ye(t);
|
|
3631
3686
|
}
|
|
3632
|
-
let n = typeof e == "function" ? e : (t) =>
|
|
3687
|
+
let n = typeof e == "function" ? e : (t) => Xs(t, e);
|
|
3633
3688
|
if (q(t) && t.isCollapsed()) {
|
|
3634
3689
|
let e = t.focus.getNode();
|
|
3635
|
-
J(e) &&
|
|
3636
|
-
} else dn((e) =>
|
|
3690
|
+
J(e) && Ys(e, n);
|
|
3691
|
+
} else dn((e) => Ys(e, n));
|
|
3637
3692
|
return !0;
|
|
3638
3693
|
}
|
|
3639
|
-
function
|
|
3694
|
+
function Qs(e) {
|
|
3640
3695
|
let t = e.anchor, n = e.focus, r = e.anchor.getNode(), i = e.focus.getNode();
|
|
3641
3696
|
return r === i ? r : e.isBackward() ? pn(n) ? r : i : pn(t) ? r : i;
|
|
3642
3697
|
}
|
|
3643
|
-
var
|
|
3698
|
+
var $s = (e, t, n, r) => {
|
|
3644
3699
|
e.update(() => {
|
|
3645
3700
|
if (r && Be(ot), e.isEditable()) {
|
|
3646
3701
|
let e = K();
|
|
3647
3702
|
e !== null && mn(e, { "font-size": t + "px" });
|
|
3648
3703
|
}
|
|
3649
3704
|
});
|
|
3650
|
-
},
|
|
3651
|
-
function
|
|
3652
|
-
let e = I(
|
|
3705
|
+
}, ec = (e) => e.startsWith("http") ? e : `https://${e}`, tc = N(null);
|
|
3706
|
+
function nc() {
|
|
3707
|
+
let e = I(tc);
|
|
3653
3708
|
if (!e) throw Error("\"useRichTextFieldContext\" must be used within a RichTextFieldContextProvider");
|
|
3654
3709
|
return e;
|
|
3655
3710
|
}
|
|
3656
|
-
function
|
|
3711
|
+
function rc(e) {
|
|
3657
3712
|
let t = e.trim(), n = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);
|
|
3658
3713
|
if (n) {
|
|
3659
3714
|
let e = n[1];
|
|
@@ -3668,18 +3723,18 @@ function Zs(e) {
|
|
|
3668
3723
|
let e = (e) => Math.max(0, Math.min(255, e)), [t, n, i] = r.slice(1, 4).map((t) => e(Number.parseInt(t, 10))), a = (e) => e.toString(16).padStart(2, "0");
|
|
3669
3724
|
return `#${a(t)}${a(n)}${a(i)}`;
|
|
3670
3725
|
}
|
|
3671
|
-
return
|
|
3726
|
+
return Is;
|
|
3672
3727
|
}
|
|
3673
|
-
function
|
|
3674
|
-
let t = Q(), [n, r] = V(
|
|
3728
|
+
function ic({ children: e }) {
|
|
3729
|
+
let t = Q(), [n, r] = V(Ns), [i, a] = V("16"), [o, s] = V(!1), [c, l] = V(!1), [u, d] = V(!1), [f, p] = V(Is), [m, h] = V(!1), g = F(() => {
|
|
3675
3730
|
let e = K();
|
|
3676
3731
|
if (q(e)) {
|
|
3677
|
-
r(fn(e, "font-family",
|
|
3732
|
+
r(fn(e, "font-family", Ns));
|
|
3678
3733
|
let t = fn(e, "font-size", "16px");
|
|
3679
3734
|
a(t ? t.replace("px", "") : "16"), s(e.hasFormat("bold")), l(e.hasFormat("italic")), d(e.hasFormat("underline"));
|
|
3680
3735
|
let n = fn(e, "color", "#000000") || "#000000";
|
|
3681
|
-
p(
|
|
3682
|
-
let i =
|
|
3736
|
+
p(rc(n));
|
|
3737
|
+
let i = Qs(e), o = i.getParent(), c = be(o) || be(i);
|
|
3683
3738
|
h(c);
|
|
3684
3739
|
}
|
|
3685
3740
|
}, []);
|
|
@@ -3695,7 +3750,7 @@ function Qs({ children: e }) {
|
|
|
3695
3750
|
t !== null && mn(t, { "font-family": e });
|
|
3696
3751
|
});
|
|
3697
3752
|
}, [t]), v = F((e) => {
|
|
3698
|
-
|
|
3753
|
+
$s(t, e, null, !1);
|
|
3699
3754
|
}, [t]), y = F(() => {
|
|
3700
3755
|
t.dispatchCommand(rt, "bold");
|
|
3701
3756
|
}, [t]), b = F(() => {
|
|
@@ -3709,7 +3764,7 @@ function Qs({ children: e }) {
|
|
|
3709
3764
|
t !== null && mn(t, { color: e });
|
|
3710
3765
|
});
|
|
3711
3766
|
}, [t]), ee = F(() => {
|
|
3712
|
-
m ? (h(!1), t.dispatchCommand(Se, null)) : (h(!0), t.dispatchCommand(Se,
|
|
3767
|
+
m ? (h(!1), t.dispatchCommand(Se, null)) : (h(!0), t.dispatchCommand(Se, ec("https://")));
|
|
3713
3768
|
}, [m, h]), C = z(() => ({
|
|
3714
3769
|
fontFamily: n,
|
|
3715
3770
|
fontSize: i,
|
|
@@ -3741,15 +3796,15 @@ function Qs({ children: e }) {
|
|
|
3741
3796
|
x,
|
|
3742
3797
|
ee
|
|
3743
3798
|
]);
|
|
3744
|
-
return /* @__PURE__ */ H(
|
|
3799
|
+
return /* @__PURE__ */ H(tc.Provider, {
|
|
3745
3800
|
value: C,
|
|
3746
3801
|
children: e
|
|
3747
3802
|
});
|
|
3748
3803
|
}
|
|
3749
3804
|
//#endregion
|
|
3750
3805
|
//#region src/components/rich-text-field/components/bold-button.tsx
|
|
3751
|
-
function
|
|
3752
|
-
let { isBold: t, onBold: n } =
|
|
3806
|
+
function ac({ ...e }) {
|
|
3807
|
+
let { isBold: t, onBold: n } = nc();
|
|
3753
3808
|
return /* @__PURE__ */ H($, {
|
|
3754
3809
|
"data-testid": "bold-button",
|
|
3755
3810
|
"aria-label": "Format Bold",
|
|
@@ -3761,12 +3816,12 @@ function $s({ ...e }) {
|
|
|
3761
3816
|
}
|
|
3762
3817
|
//#endregion
|
|
3763
3818
|
//#region src/components/rich-text-field/components/clean-format-button.tsx
|
|
3764
|
-
function
|
|
3819
|
+
function oc({ ...e }) {
|
|
3765
3820
|
let t = Q(), n = F(() => {
|
|
3766
3821
|
t.update(() => {
|
|
3767
3822
|
let e = K();
|
|
3768
3823
|
if (q(e)) {
|
|
3769
|
-
|
|
3824
|
+
Zs(() => Us);
|
|
3770
3825
|
for (let t of e.extract()) J(t) && (t.setFormat(0), t.setStyle(""), ln(t).setFormat(""));
|
|
3771
3826
|
}
|
|
3772
3827
|
});
|
|
@@ -3781,7 +3836,7 @@ function ec({ ...e }) {
|
|
|
3781
3836
|
}
|
|
3782
3837
|
//#endregion
|
|
3783
3838
|
//#region src/components/rich-text-field/components/image-button.tsx
|
|
3784
|
-
function
|
|
3839
|
+
function sc({ ...e }) {
|
|
3785
3840
|
return /* @__PURE__ */ H($, {
|
|
3786
3841
|
"data-testid": "image-button",
|
|
3787
3842
|
"aria-label": "Add Image",
|
|
@@ -3791,8 +3846,8 @@ function tc({ ...e }) {
|
|
|
3791
3846
|
}
|
|
3792
3847
|
//#endregion
|
|
3793
3848
|
//#region src/components/rich-text-field/components/italic-button.tsx
|
|
3794
|
-
function
|
|
3795
|
-
let { isItalic: t, onItalic: n } =
|
|
3849
|
+
function cc({ ...e }) {
|
|
3850
|
+
let { isItalic: t, onItalic: n } = nc();
|
|
3796
3851
|
return /* @__PURE__ */ H($, {
|
|
3797
3852
|
"data-testid": "italic-button",
|
|
3798
3853
|
"aria-label": "Format Italics",
|
|
@@ -3804,7 +3859,7 @@ function nc({ ...e }) {
|
|
|
3804
3859
|
}
|
|
3805
3860
|
//#endregion
|
|
3806
3861
|
//#region src/components/rich-text-field/components/link-button.tsx
|
|
3807
|
-
function
|
|
3862
|
+
function lc({ isActive: e, ...t }) {
|
|
3808
3863
|
return /* @__PURE__ */ H($, {
|
|
3809
3864
|
"data-testid": "link-button",
|
|
3810
3865
|
"aria-label": "Add Link",
|
|
@@ -3814,9 +3869,9 @@ function rc({ isActive: e, ...t }) {
|
|
|
3814
3869
|
}
|
|
3815
3870
|
//#endregion
|
|
3816
3871
|
//#region src/components/rich-text-field/components/size-select.tsx
|
|
3817
|
-
function
|
|
3818
|
-
let { fontSize: t, onFontSize: n } =
|
|
3819
|
-
return /* @__PURE__ */ H(
|
|
3872
|
+
function uc({ className: e }) {
|
|
3873
|
+
let { fontSize: t, onFontSize: n } = nc(), r = z(() => [...Ps], []);
|
|
3874
|
+
return /* @__PURE__ */ H(Ls, {
|
|
3820
3875
|
"data-testid": "size-select",
|
|
3821
3876
|
options: r,
|
|
3822
3877
|
value: t,
|
|
@@ -3826,8 +3881,8 @@ function ic({ className: e }) {
|
|
|
3826
3881
|
}
|
|
3827
3882
|
//#endregion
|
|
3828
3883
|
//#region src/components/rich-text-field/components/text-color-button.tsx
|
|
3829
|
-
function
|
|
3830
|
-
let { textColor: n, onTextColor: r } =
|
|
3884
|
+
function dc({ wrapperClassName: e, ...t }) {
|
|
3885
|
+
let { textColor: n, onTextColor: r } = nc(), i = n === Is;
|
|
3831
3886
|
function a(e) {
|
|
3832
3887
|
r(e.target.value);
|
|
3833
3888
|
}
|
|
@@ -3861,9 +3916,9 @@ function ac({ wrapperClassName: e, ...t }) {
|
|
|
3861
3916
|
}
|
|
3862
3917
|
//#endregion
|
|
3863
3918
|
//#region src/components/rich-text-field/components/typography-select.tsx
|
|
3864
|
-
function
|
|
3865
|
-
let { fontFamily: t, onFontFamily: n } =
|
|
3866
|
-
return /* @__PURE__ */ H(
|
|
3919
|
+
function fc({ className: e }) {
|
|
3920
|
+
let { fontFamily: t, onFontFamily: n } = nc(), r = z(() => [...Ms], []);
|
|
3921
|
+
return /* @__PURE__ */ H(Ls, {
|
|
3867
3922
|
"data-testid": "typography-select",
|
|
3868
3923
|
options: r,
|
|
3869
3924
|
value: t,
|
|
@@ -3873,8 +3928,8 @@ function oc({ className: e }) {
|
|
|
3873
3928
|
}
|
|
3874
3929
|
//#endregion
|
|
3875
3930
|
//#region src/components/rich-text-field/components/underline-button.tsx
|
|
3876
|
-
function
|
|
3877
|
-
let { isUnderline: t, onUnderline: n } =
|
|
3931
|
+
function pc({ ...e }) {
|
|
3932
|
+
let { isUnderline: t, onUnderline: n } = nc();
|
|
3878
3933
|
return /* @__PURE__ */ H($, {
|
|
3879
3934
|
"data-testid": "underline-button",
|
|
3880
3935
|
"aria-label": "Format Underline",
|
|
@@ -3886,24 +3941,24 @@ function sc({ ...e }) {
|
|
|
3886
3941
|
}
|
|
3887
3942
|
//#endregion
|
|
3888
3943
|
//#region src/components/rich-text-field/components/formatting-toolbar-plugin.tsx
|
|
3889
|
-
var
|
|
3890
|
-
/* @__PURE__ */ H(
|
|
3891
|
-
/* @__PURE__ */ H(
|
|
3944
|
+
var mc = ({ hasAttachments: e }) => /* @__PURE__ */ U(ve, { children: [
|
|
3945
|
+
/* @__PURE__ */ H(fc, {}),
|
|
3946
|
+
/* @__PURE__ */ H(uc, {}),
|
|
3892
3947
|
/* @__PURE__ */ H(o, { orientation: "vertical" }),
|
|
3893
|
-
/* @__PURE__ */ H($s, {}),
|
|
3894
|
-
/* @__PURE__ */ H(nc, {}),
|
|
3895
|
-
/* @__PURE__ */ H(sc, {}),
|
|
3896
3948
|
/* @__PURE__ */ H(ac, {}),
|
|
3949
|
+
/* @__PURE__ */ H(cc, {}),
|
|
3950
|
+
/* @__PURE__ */ H(pc, {}),
|
|
3951
|
+
/* @__PURE__ */ H(dc, {}),
|
|
3897
3952
|
/* @__PURE__ */ H(o, { orientation: "vertical" }),
|
|
3898
|
-
/* @__PURE__ */ H(
|
|
3899
|
-
/* @__PURE__ */ H(
|
|
3900
|
-
/* @__PURE__ */ H(
|
|
3953
|
+
/* @__PURE__ */ H(lc, { isDisabled: !0 }),
|
|
3954
|
+
/* @__PURE__ */ H(Vs, { isDisabled: !e }),
|
|
3955
|
+
/* @__PURE__ */ H(sc, { isDisabled: !0 }),
|
|
3901
3956
|
/* @__PURE__ */ H(o, { orientation: "vertical" }),
|
|
3902
|
-
/* @__PURE__ */ H(
|
|
3957
|
+
/* @__PURE__ */ H(Bs, {}),
|
|
3903
3958
|
/* @__PURE__ */ H(o, { orientation: "vertical" }),
|
|
3904
|
-
/* @__PURE__ */ H(
|
|
3959
|
+
/* @__PURE__ */ H(oc, {})
|
|
3905
3960
|
] });
|
|
3906
|
-
function
|
|
3961
|
+
function hc({ className: e, children: t = mc, hasAttachments: n = !1 }) {
|
|
3907
3962
|
return /* @__PURE__ */ H("div", {
|
|
3908
3963
|
"data-testid": "formatting-toolbar",
|
|
3909
3964
|
"data-slot": "rich-text-field-toolbar",
|
|
@@ -3913,9 +3968,9 @@ function lc({ className: e, children: t = cc, hasAttachments: n = !1 }) {
|
|
|
3913
3968
|
}
|
|
3914
3969
|
//#endregion
|
|
3915
3970
|
//#region src/components/rich-text-field/rich-text-field.tsx
|
|
3916
|
-
var
|
|
3971
|
+
var gc = P(({ children: e, className: t, placeholderClassName: n, containerClassName: r, toolbarPlacement: i = "top", toolbarChildren: a, toolbarClassName: o, isMultipleAttachments: s, enableAttachments: c, acceptedFiles: l, onFileAttach: u, ...d }, f) => {
|
|
3917
3972
|
let p = i === "top";
|
|
3918
|
-
return /* @__PURE__ */ U(
|
|
3973
|
+
return /* @__PURE__ */ U(As, {
|
|
3919
3974
|
ref: f,
|
|
3920
3975
|
"data-testid": "rich-text-field",
|
|
3921
3976
|
"data-slot": "rich-text-field",
|
|
@@ -3924,21 +3979,21 @@ var uc = P(({ children: e, className: t, placeholderClassName: n, containerClass
|
|
|
3924
3979
|
containerClassName: M("h-rich-text-field-height", "rounded-rich-text-field-toolbar", p ? "pt-rich-text-field-toolbar-height" : "pb-rich-text-field-toolbar-height", r),
|
|
3925
3980
|
className: M("p-rich-text-field-editor-padding", "bg-rich-text-field-background", "size-full", t),
|
|
3926
3981
|
...d,
|
|
3927
|
-
children: [/* @__PURE__ */ H(
|
|
3982
|
+
children: [/* @__PURE__ */ H(ic, { children: /* @__PURE__ */ H(hc, {
|
|
3928
3983
|
hasAttachments: c,
|
|
3929
3984
|
className: M("absolute right-0 w-full", p ? "top-0" : "bottom-0", o),
|
|
3930
3985
|
children: a
|
|
3931
|
-
}) }), /* @__PURE__ */ H(
|
|
3986
|
+
}) }), /* @__PURE__ */ H(Es, {
|
|
3932
3987
|
acceptedFiles: l,
|
|
3933
3988
|
onFileAttach: u,
|
|
3934
3989
|
isMultiple: s
|
|
3935
3990
|
})]
|
|
3936
3991
|
});
|
|
3937
3992
|
});
|
|
3938
|
-
|
|
3993
|
+
gc.displayName = "RichTextField";
|
|
3939
3994
|
//#endregion
|
|
3940
3995
|
//#region src/components/topmenu/topmenu.tsx
|
|
3941
|
-
var
|
|
3996
|
+
var _c = gn("flex shrink-0 items-center justify-end", {
|
|
3942
3997
|
variants: {
|
|
3943
3998
|
size: {
|
|
3944
3999
|
md: ["px-[4px]", "rounded-overlay-tools-wrapper bg-overlay-tools-background-base"],
|
|
@@ -3963,7 +4018,7 @@ var dc = gn("flex shrink-0 items-center justify-end", {
|
|
|
3963
4018
|
hasBorder: !0
|
|
3964
4019
|
}
|
|
3965
4020
|
});
|
|
3966
|
-
function
|
|
4021
|
+
function vc({ className: e, children: t, ...n }) {
|
|
3967
4022
|
return /* @__PURE__ */ H("div", {
|
|
3968
4023
|
"data-slot": "topmenu",
|
|
3969
4024
|
role: "group",
|
|
@@ -3972,11 +4027,11 @@ function fc({ className: e, children: t, ...n }) {
|
|
|
3972
4027
|
children: t
|
|
3973
4028
|
});
|
|
3974
4029
|
}
|
|
3975
|
-
function
|
|
4030
|
+
function yc({ className: e, size: t, hasBorder: n, children: r, ...i }) {
|
|
3976
4031
|
return /* @__PURE__ */ H("div", {
|
|
3977
4032
|
"data-slot": "topmenu-actions",
|
|
3978
4033
|
"data-size": t ?? "lg",
|
|
3979
|
-
className: M(
|
|
4034
|
+
className: M(_c({
|
|
3980
4035
|
size: t,
|
|
3981
4036
|
hasBorder: n
|
|
3982
4037
|
}), e),
|
|
@@ -3986,42 +4041,42 @@ function pc({ className: e, size: t, hasBorder: n, children: r, ...i }) {
|
|
|
3986
4041
|
}
|
|
3987
4042
|
//#endregion
|
|
3988
4043
|
//#region src/domain/actions/constants.ts
|
|
3989
|
-
var
|
|
4044
|
+
var bc = "swisper";
|
|
3990
4045
|
//#endregion
|
|
3991
4046
|
//#region src/domain/actions/utils/index.ts
|
|
3992
|
-
function
|
|
3993
|
-
let n = `${
|
|
4047
|
+
function xc(e, t) {
|
|
4048
|
+
let n = `${bc}://action/${e}`;
|
|
3994
4049
|
return t ? `${n}?${new URLSearchParams(t).toString()}` : n;
|
|
3995
4050
|
}
|
|
3996
|
-
function
|
|
3997
|
-
return `[${t}](${
|
|
4051
|
+
function Sc({ action: e, label: t, params: n }) {
|
|
4052
|
+
return `[${t}](${xc(e, n)})`;
|
|
3998
4053
|
}
|
|
3999
|
-
function
|
|
4054
|
+
function Cc(e) {
|
|
4000
4055
|
if (!e?.startsWith("swisper://")) return !1;
|
|
4001
4056
|
let t = new URL(e);
|
|
4002
4057
|
return t.protocol === "swisper:" && t.hostname === "action" && t.pathname.startsWith("/") && t.pathname.split("/").length === 2;
|
|
4003
4058
|
}
|
|
4004
|
-
function
|
|
4059
|
+
function wc(e) {
|
|
4005
4060
|
let t;
|
|
4006
4061
|
try {
|
|
4007
4062
|
t = new URL(e);
|
|
4008
4063
|
} catch {
|
|
4009
4064
|
return null;
|
|
4010
4065
|
}
|
|
4011
|
-
return
|
|
4066
|
+
return Cc(e) ? {
|
|
4012
4067
|
option: t.pathname.replace("/", ""),
|
|
4013
4068
|
payload: Object.fromEntries(t.searchParams.entries())
|
|
4014
4069
|
} : null;
|
|
4015
4070
|
}
|
|
4016
|
-
function
|
|
4071
|
+
function Tc(e) {
|
|
4017
4072
|
for (let t of e) if (t.type === "text" && typeof t.value == "string") return t.value;
|
|
4018
4073
|
return null;
|
|
4019
4074
|
}
|
|
4020
|
-
function
|
|
4075
|
+
function Ec(e) {
|
|
4021
4076
|
let t = yn().use(vn).use(_n).parse(e), n = null;
|
|
4022
4077
|
return bn(t, (e) => {
|
|
4023
4078
|
if (e.type !== "link") return;
|
|
4024
|
-
let t =
|
|
4079
|
+
let t = wc(e.url), r = Tc(e.children);
|
|
4025
4080
|
if (t && r) {
|
|
4026
4081
|
n = {
|
|
4027
4082
|
label: r,
|
|
@@ -4035,23 +4090,23 @@ function bc(e) {
|
|
|
4035
4090
|
}
|
|
4036
4091
|
//#endregion
|
|
4037
4092
|
//#region src/domain/actions/hooks/index.ts
|
|
4038
|
-
function
|
|
4039
|
-
return z(() => e.map((e) =>
|
|
4093
|
+
function Dc(e) {
|
|
4094
|
+
return z(() => e.map((e) => Ec(e) || { label: e }).filter((e) => e !== null), [e]);
|
|
4040
4095
|
}
|
|
4041
4096
|
//#endregion
|
|
4042
4097
|
//#region src/hooks/use-chat-stream-message.ts
|
|
4043
|
-
function
|
|
4098
|
+
function Oc(e) {
|
|
4044
4099
|
return JSON.parse(e);
|
|
4045
4100
|
}
|
|
4046
|
-
function
|
|
4101
|
+
function kc(e) {
|
|
4047
4102
|
return e instanceof Error ? e.name === "AbortError" || e.name === "TimeoutError" : !1;
|
|
4048
4103
|
}
|
|
4049
|
-
function
|
|
4104
|
+
function Ac(e, t) {
|
|
4050
4105
|
return e instanceof Error ? e : Error(t);
|
|
4051
4106
|
}
|
|
4052
|
-
function
|
|
4107
|
+
function jc() {
|
|
4053
4108
|
return { streamMessage: F(async ({ stream: e, abortController: t, timeout: n = 2e4, tokenParser: r, onChunkReceived: i, onAbort: a, onFinish: o, onError: s }) => {
|
|
4054
|
-
let c = r ??
|
|
4109
|
+
let c = r ?? Oc, l, u = !1, d = () => {
|
|
4055
4110
|
l !== void 0 && (clearTimeout(l), l = void 0);
|
|
4056
4111
|
}, f = (e) => {
|
|
4057
4112
|
u || (u = !0, d(), a?.(e));
|
|
@@ -4078,7 +4133,7 @@ function Tc() {
|
|
|
4078
4133
|
}
|
|
4079
4134
|
});
|
|
4080
4135
|
for (t?.signal.addEventListener("abort", () => {
|
|
4081
|
-
let e =
|
|
4136
|
+
let e = Ac(t.signal.reason, "Stream aborted");
|
|
4082
4137
|
f(e);
|
|
4083
4138
|
}, { once: !0 }), p(); !u;) {
|
|
4084
4139
|
let { value: t, done: n } = await e.read(), i = r.decode(t, { stream: !0 });
|
|
@@ -4087,8 +4142,8 @@ function Tc() {
|
|
|
4087
4142
|
d(), !u && !t?.signal.aborted && o?.(n);
|
|
4088
4143
|
} catch (e) {
|
|
4089
4144
|
let n = e;
|
|
4090
|
-
if (u || t?.signal.aborted ||
|
|
4091
|
-
u || f(
|
|
4145
|
+
if (u || t?.signal.aborted || kc(n)) {
|
|
4146
|
+
u || f(Ac(n, "Stream aborted"));
|
|
4092
4147
|
return;
|
|
4093
4148
|
}
|
|
4094
4149
|
t?.abort(n), console.error("Error while reading stream:", n), s?.(n);
|
|
@@ -4097,7 +4152,7 @@ function Tc() {
|
|
|
4097
4152
|
}
|
|
4098
4153
|
//#endregion
|
|
4099
4154
|
//#region src/hooks/use-on-chat-changed.ts
|
|
4100
|
-
function
|
|
4155
|
+
function Mc(e) {
|
|
4101
4156
|
let { chatId: t, isNewChat: n } = X(), r = B(n), i = B(t), a = B(e);
|
|
4102
4157
|
a.current = e, r.current = n, L(() => {
|
|
4103
4158
|
i.current !== t && (a.current({
|
|
@@ -4109,19 +4164,19 @@ function Ec(e) {
|
|
|
4109
4164
|
}
|
|
4110
4165
|
//#endregion
|
|
4111
4166
|
//#region src/hooks/use-current-chat-id.ts
|
|
4112
|
-
function
|
|
4167
|
+
function Nc() {
|
|
4113
4168
|
let { chatId: e } = X();
|
|
4114
4169
|
return e;
|
|
4115
4170
|
}
|
|
4116
4171
|
//#endregion
|
|
4117
4172
|
//#region src/hooks/use-is-current-chat-new.ts
|
|
4118
|
-
function
|
|
4173
|
+
function Pc() {
|
|
4119
4174
|
let { isNewChat: e } = X();
|
|
4120
4175
|
return e;
|
|
4121
4176
|
}
|
|
4122
4177
|
//#endregion
|
|
4123
4178
|
//#region src/hooks/use-loaded-chat-ids.ts
|
|
4124
|
-
function
|
|
4179
|
+
function Fc() {
|
|
4125
4180
|
let { loadedChatIdsRef: e } = X();
|
|
4126
4181
|
return {
|
|
4127
4182
|
getIsChatLoaded: F((t) => e.current?.has(t) ?? !1, []),
|
|
@@ -4135,7 +4190,7 @@ function kc() {
|
|
|
4135
4190
|
}
|
|
4136
4191
|
//#endregion
|
|
4137
4192
|
//#region src/hooks/use-chat-prompt-placeholder.ts
|
|
4138
|
-
function
|
|
4193
|
+
function Ic() {
|
|
4139
4194
|
let { promptPlaceholder: e, setPromptPlaceholder: t, clearPromptPlaceholder: n } = X();
|
|
4140
4195
|
return {
|
|
4141
4196
|
promptPlaceholder: e,
|
|
@@ -4144,6 +4199,6 @@ function Ac() {
|
|
|
4144
4199
|
};
|
|
4145
4200
|
}
|
|
4146
4201
|
//#endregion
|
|
4147
|
-
export {
|
|
4202
|
+
export { cs as $replaceEditorHTMLContent, ls as $replaceEditorSelectionHTMLContent, os as $setSelectionToEnd, Bs as AlignmentSelect, Vs as AttachmentButton, ac as BoldButton, bc as CHAT_ACTION_PROTOCOL, ao as CanvasShell, co as CanvasShellCloseTrigger, po as CanvasShellContent, mo as CanvasShellFooter, lo as CanvasShellFullScreenTrigger, oo as CanvasShellHeader, uo as CanvasShellOptionsButton, so as CanvasShellTitle, $a as ChatArtifact, io as ChatArtifactActions, ro as ChatArtifactCaption, to as ChatArtifactContent, eo as ChatArtifactIcon, no as ChatArtifactTitle, Gn as ChatCard, An as ChatCardActionButton, kn as ChatCardActions, Hn as ChatCardAttribute, Un as ChatCardAttributeLabel, Wn as ChatCardAttributeValue, Vn as ChatCardAttributes, Nn as ChatCardBody, jn as ChatCardCollapsibleButton, Xn as ChatCardContainer, Pn as ChatCardContent, In as ChatCardFooter, zn as ChatCardFooterActions, Ln as ChatCardFooterNotes, Rn as ChatCardFooterPrice, Bn as ChatCardForm, wn as ChatCardHeader, En as ChatCardHeaderContent, Tn as ChatCardIcon, Mn as ChatCardMedia, Fn as ChatCardPreview, On as ChatCardSubTitle, Dn as ChatCardTitle, nr as ChatContainer, ir as ChatContainerPrompt, ar as ChatContainerWelcome, ui as ChatConversationProvider, wr as ChatInput, Er as ChatInputTextarea, kr as ChatList, Nr as ChatListEmptyState, Pr as ChatListError, Rr as ChatListItem, Lr as ChatListItems, Fr as ChatListLoadMore, Mr as ChatListSkeleton, ei as ChatMessage, ni as ChatMessageActions, bi as ChatMessageAttachmentCard, wi as ChatMessageAttachmentCardActions, xi as ChatMessageAttachmentCardContent, Ei as ChatMessageAttachmentCardIcon, Ci as ChatMessageAttachmentCardPreview, Si as ChatMessageAttachmentCardTitle, ti as ChatMessageContent, _i as ChatMessageListGroup, Ni as ChatMessageResponse, Pi as ChatMessageToolbar, Ii as ChatMessageToolbarActionButton, Fi as ChatMessageToolbarActions, Li as ChatMessageToolbarTimestamp, mi as ChatMessages, hi as ChatMessagesList, yi as ChatMessagesScrollButton, Ki as ChatNotificationCard, ea as ChatNotificationCardActions, na as ChatNotificationCardButtons, oa as ChatNotificationCardCloseButton, sa as ChatNotificationCardContent, ua as ChatNotificationCardContentActions, la as ChatNotificationCardContentDescription, ca as ChatNotificationCardContentTitle, aa as ChatNotificationCardDeleteButton, pa as ChatNotificationCardDescription, da as ChatNotificationCardExpandButton, qi as ChatNotificationCardHead, Ji as ChatNotificationCardHeader, Yi as ChatNotificationCardHeaderIcon, $i as ChatNotificationCardHeaderStatus, Xi as ChatNotificationCardHeaderTitle, Zi as ChatNotificationCardHeaderTitleLabel, fa as ChatNotificationCardIcon, ra as ChatNotificationCardReadActionButton, ia as ChatNotificationCardSnoozeButton, ma as ChatNotificationCardTimeStamp, ta as ChatNotificationCardTimestamp, ha as ChatNotificationPopup, _a as ChatNotificationPopupContent, ga as ChatNotificationPopupTrigger, Kr as ChatPromptBox, Qr as ChatPromptBoxActionsLeft, $r as ChatPromptBoxActionsRight, Xr as ChatPromptBoxContent, Zr as ChatPromptBoxInput, Yr as ChatPromptBoxToolbar, ai as ChatProvider, va as ChatReplies, ya as ChatReply, ba as ChatReplyLabel, xa as ChatReplyValue, Ta as ChatSuggestion, ka as ChatSuggestionAction, Oa as ChatSuggestionActions, Da as ChatSuggestionLabel, Ea as ChatSuggestionLabelIcon, wa as ChatSuggestions, go as ChatThinkingProcess, xo as ChatThinkingProcessContent, Co as ChatThinkingProcessContentItem, _o as ChatThinkingProcessTrigger, bo as ChatThinkingProcessTriggerArrow, vo as ChatThinkingProcessTriggerIcon, yo as ChatThinkingProcessTriggerLabel, Ka as ChatThread, Xa as ChatThreadAnswer, Qa as ChatThreadErrorState, Ja as ChatThreadGroup, Wa as ChatThreadProvider, Ya as ChatThreadQuestion, oc as CleanFormatButton, Yn as EditableChatCardContextProvider, wo as EmptyState, Oo as EmptyStateActionRow, Do as EmptyStateDescription, To as EmptyStateIcon, Eo as EmptyStateTitle, hc as FormattingToolbarPlugin, Cs as HtmlPastePlugin, vs as INSERT_HTML_COMMAND, bs as INSERT_HTML_EVENT, ps as INSERT_IMAGE_COMMAND, ms as INSERT_IMAGE_EVENT_NAME, hs as ImageAddedEvent, sc as ImageButton, gs as ImageDropPlugin, Ss as InsertHtmlEvent, cc as ItalicButton, lc as LinkButton, ji as MarkdownViewer, ho as NewChatTrigger, _s as PASTE_HTML_COMMAND, ys as PASTE_HTML_EVENT, xs as PasteHtmlEvent, As as RichTextArea, gc as RichTextField, uc as SizeSelect, dc as TextColorButton, $ as ToolbarButton, vc as TopMenu, yc as TopMenuActions, fc as TypographySelect, pc as UnderlineButton, fo as canvasShellContentPadding, Sc as createChatActionLink, Ec as extractChatActionFromLink, Ui as formatSnoozeDate, Oi as getAttachmentIcon, Ri as getSnoozeUntilDate, Cc as isChatActionURL, as as scrollRichTextAreaToBottom, Dc as useChatActions, X as useChatContext, li as useChatConversationContext, Sr as useChatInputContext, Or as useChatListContext, Fc as useChatLoadedIds, Gi as useChatNotificationCardContext, Ic as useChatPromptPlaceholder, jc as useChatStreamMessage, Ca as useChatSuggestionContext, za as useChatThread, Qt as useChatThreadScrollable, Nc as useCurrentChatId, Kn as useEditChatCard, Jn as useEditableChatCardContext, Pc as useIsCurrentChatNew, Mc as useOnChatChanged, Q as useRichTextAreaEditor, ns as useRichTextAreaSelectedText };
|
|
4148
4203
|
|
|
4149
4204
|
//# sourceMappingURL=index.es.js.map
|