@brevitaz/brv-text-editor 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23918,9 +23918,9 @@ ${prefix}
23918
23918
  history: true
23919
23919
  };
23920
23920
  const RTE_THEMES = {
23921
- /** Default — UnleashTeams teal/cyan palette */
23921
+ /** Default — Teal palette */
23922
23922
  unleashteams: {},
23923
- /** Warm Basecamp-inspired palette */
23923
+ /** Warm earthy palette */
23924
23924
  classic: {
23925
23925
  "--rte-color-primary": "#1a6b3c",
23926
23926
  "--rte-color-primary-hover": "#f0fdf4",
@@ -24739,17 +24739,6 @@ ${prefix}
24739
24739
  )
24740
24740
  );
24741
24741
  }
24742
- function formatHtml(html) {
24743
- let indent = 0;
24744
- return html.replace(/></g, ">\n<").split("\n").map((line) => {
24745
- const closing = line.match(/^<\//);
24746
- const selfClose = line.match(/\/>$/) || line.match(/^<(br|hr|img|input)/);
24747
- if (closing) indent = Math.max(0, indent - 2);
24748
- const result = " ".repeat(indent) + line.trim();
24749
- if (!closing && !selfClose && line.match(/^<[^/]/)) indent += 2;
24750
- return result;
24751
- }).join("\n");
24752
- }
24753
24742
  function EmojiReaction({ emoji: emoji2 }) {
24754
24743
  const [count, setCount] = React$1.useState(0);
24755
24744
  const [active, setActive] = React$1.useState(false);
@@ -24784,30 +24773,13 @@ ${prefix}
24784
24773
  }
24785
24774
  function RichTextPreview({
24786
24775
  html = "",
24787
- author = { name: "Anonymous", initials: "A", avatarColor: "#065666" },
24788
- timestamp = "",
24789
- onDismiss,
24790
24776
  showReactions = true,
24791
24777
  reactions = ["👍", "❤️", "🎉", "🙌"],
24792
24778
  theme = "unleashteams",
24793
24779
  themeVars = {}
24794
24780
  }) {
24795
- const [tab, setTab] = React$1.useState("preview");
24796
24781
  const presetVars = RTE_THEMES[theme] ?? {};
24797
24782
  const resolvedVars = { ...presetVars, ...themeVars };
24798
- const tabStyle = (active) => ({
24799
- padding: "6px 14px",
24800
- border: "none",
24801
- borderBottom: active ? "2px solid var(--rte-color-primary)" : "2px solid transparent",
24802
- background: "none",
24803
- cursor: "pointer",
24804
- fontSize: 13,
24805
- fontFamily: "var(--rte-font-family)",
24806
- fontWeight: active ? 600 : 400,
24807
- color: active ? "var(--rte-color-primary)" : "var(--rte-text-muted)",
24808
- transition: "color 0.15s, border-color 0.15s",
24809
- marginBottom: -1
24810
- });
24811
24783
  return /* @__PURE__ */ React.createElement(
24812
24784
  "div",
24813
24785
  {
@@ -24827,98 +24799,14 @@ ${prefix}
24827
24799
  }
24828
24800
  },
24829
24801
  /* @__PURE__ */ React.createElement(
24830
- "div",
24831
- {
24832
- style: {
24833
- padding: "14px 18px 0",
24834
- display: "flex",
24835
- alignItems: "flex-start",
24836
- justifyContent: "space-between",
24837
- gap: 10
24838
- }
24839
- },
24840
- /* @__PURE__ */ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10 } }, /* @__PURE__ */ React.createElement(
24841
- "div",
24842
- {
24843
- style: {
24844
- width: 34,
24845
- height: 34,
24846
- borderRadius: "50%",
24847
- background: author.avatarColor ?? "var(--rte-color-primary)",
24848
- display: "flex",
24849
- alignItems: "center",
24850
- justifyContent: "center",
24851
- fontSize: 13,
24852
- fontWeight: 700,
24853
- color: "#fff",
24854
- flexShrink: 0,
24855
- fontFamily: "var(--rte-font-family)"
24856
- }
24857
- },
24858
- author.initials
24859
- ), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { style: { fontSize: 14, fontWeight: 600, color: "var(--rte-text)", lineHeight: 1.3, fontFamily: "var(--rte-font-family)" } }, author.name), /* @__PURE__ */ React.createElement("div", { style: { fontSize: 11, color: "var(--rte-text-muted)", fontFamily: "var(--rte-font-family)" } }, timestamp))),
24860
- onDismiss && /* @__PURE__ */ React.createElement(
24861
- "button",
24862
- {
24863
- onClick: onDismiss,
24864
- title: "Dismiss",
24865
- style: {
24866
- border: "none",
24867
- background: "none",
24868
- cursor: "pointer",
24869
- color: "var(--rte-btn-disabled-color)",
24870
- fontSize: 20,
24871
- lineHeight: 1,
24872
- padding: "2px 4px",
24873
- borderRadius: "var(--rte-radius-sm)",
24874
- transition: "color 0.1s"
24875
- },
24876
- onMouseEnter: (e) => e.currentTarget.style.color = "var(--rte-text-muted)",
24877
- onMouseLeave: (e) => e.currentTarget.style.color = "var(--rte-btn-disabled-color)"
24878
- },
24879
- "×"
24880
- )
24881
- ),
24882
- /* @__PURE__ */ React.createElement(
24883
- "div",
24884
- {
24885
- style: {
24886
- display: "flex",
24887
- gap: 0,
24888
- padding: "10px 18px 0",
24889
- borderBottom: "1px solid var(--rte-border-toolbar)"
24890
- }
24891
- },
24892
- /* @__PURE__ */ React.createElement("button", { style: tabStyle(tab === "preview"), onClick: () => setTab("preview") }, "Preview"),
24893
- /* @__PURE__ */ React.createElement("button", { style: tabStyle(tab === "source"), onClick: () => setTab("source") }, "HTML source")
24894
- ),
24895
- tab === "preview" ? /* @__PURE__ */ React.createElement(
24896
24802
  "div",
24897
24803
  {
24898
24804
  className: "rtp-content",
24899
24805
  dangerouslySetInnerHTML: { __html: html },
24900
- style: { padding: "18px 22px 20px" }
24806
+ style: { padding: "14px 22px 20px" }
24901
24807
  }
24902
- ) : /* @__PURE__ */ React.createElement(
24903
- "pre",
24904
- {
24905
- style: {
24906
- margin: 0,
24907
- padding: "16px 18px",
24908
- fontSize: 12,
24909
- fontFamily: "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace",
24910
- whiteSpace: "pre-wrap",
24911
- wordBreak: "break-all",
24912
- color: "var(--rte-text-muted)",
24913
- background: "var(--rte-surface-subtle)",
24914
- maxHeight: 320,
24915
- overflowY: "auto",
24916
- lineHeight: 1.6
24917
- }
24918
- },
24919
- formatHtml(html)
24920
24808
  ),
24921
- tab === "preview" && showReactions && reactions.length > 0 && /* @__PURE__ */ React.createElement(
24809
+ showReactions && reactions.length > 0 && /* @__PURE__ */ React.createElement(
24922
24810
  "div",
24923
24811
  {
24924
24812
  style: {