@revolist/ui 4.0.4-rc → 4.0.5-rc

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 (192) hide show
  1. package/OWNERSHIP.md +1 -1
  2. package/README.md +16 -0
  3. package/_chunks/arrow-up-Cw8hW9vp.js +4 -0
  4. package/_chunks/badge.view-D30pMUfi.js +14 -0
  5. package/_chunks/calculator-CDWOuAcp.js +4 -0
  6. package/_chunks/{calendar-xpZ0v3xf.js → calendar-DsXIhybL.js} +19 -19
  7. package/_chunks/chart-frame-CuZABXVI.js +141 -0
  8. package/_chunks/check-BwI7iCAm.js +4 -0
  9. package/_chunks/choice-chips-BhP8MZjs.js +126 -0
  10. package/_chunks/{color-palette-D8vyPfld.js → color-palette-DMJUChWC.js} +20 -22
  11. package/_chunks/color-picker-B4TQvxxB.js +143 -0
  12. package/_chunks/{component-C_T2VN5u.js → component-qKctqdzk.js} +281 -265
  13. package/_chunks/configurator-actions-C19O1rda.js +155 -0
  14. package/_chunks/configurator-field-icon-CmcM_sPs.js +53 -0
  15. package/_chunks/{control-AHKXD5Eu.js → control-BkWukVt9.js} +13 -13
  16. package/_chunks/{controls-DsNi8V8I.js → controls-BLQnWEd7.js} +147 -155
  17. package/_chunks/{date-control-DrVFX13g.js → date-control-Cgw5PwlZ.js} +1 -1
  18. package/_chunks/date-time-B8rK5gpC.js +784 -0
  19. package/_chunks/{dialog.parts-CKGkC5zP.js → dialog.parts-BSbvnEwX.js} +21 -21
  20. package/_chunks/{duration-CL68Em0o.js → duration-DwFXonEV.js} +1 -4
  21. package/_chunks/editor-popup-BaaxL89T.js +81 -0
  22. package/_chunks/field-configurator-1eQP0tKy.js +223 -0
  23. package/_chunks/icon-toolbar-xbqa0hu9.js +128 -0
  24. package/_chunks/magnifying-glass-CvrTDSkB.js +4 -0
  25. package/_chunks/minus-BOAR3A1C.js +4 -0
  26. package/_chunks/mount-D1i5DLRn.js +266 -0
  27. package/_chunks/native-control-DO0d1kgx.js +636 -0
  28. package/_chunks/{number-input-BKwA5FnM.js → number-input-s9ddPwX6.js} +7 -7
  29. package/_chunks/{picker-h1P5RUgp.js → picker-AY05b41W.js} +2 -2
  30. package/_chunks/plus-CbGRkIGl.js +4 -0
  31. package/_chunks/popover-controller-D-AvKQ7B.js +102 -0
  32. package/_chunks/{popup-CT2uD3go.js → popup-UXGCiv3n.js} +97 -97
  33. package/_chunks/{rating-choice-DZgmaic0.js → rating-choice-BEs_QFZC.js} +1 -1
  34. package/_chunks/{reorder-list-CSlqAGHw.js → reorder-list-A49l172e.js} +1 -1
  35. package/_chunks/request-trail-DCOfa5zw.js +753 -0
  36. package/_chunks/rich-text-xfMWadGi.js +842 -0
  37. package/_chunks/rotate-left-BF6G883o.js +4 -0
  38. package/_chunks/title-tooltip-Cw6LOZhb.js +11 -0
  39. package/_chunks/tooltip-D4xkio5G.js +54 -0
  40. package/_chunks/tooltip-owner-DjdvqKzz.js +19 -0
  41. package/_chunks/tooltip-session-B6X6x8G_.js +110 -0
  42. package/_chunks/tooltip-text-BXsUEmBH.js +12 -0
  43. package/_chunks/top-layer-popup-CNSDdfJV.js +59 -0
  44. package/ai/_chat.scss +28 -3
  45. package/ai/_style.scss +55 -2
  46. package/ai/chat.d.ts +3 -1
  47. package/ai/components.d.ts +13 -2
  48. package/ai/index.d.ts +1 -0
  49. package/ai/index.js +3 -3
  50. package/ai/mount.d.ts +17 -1
  51. package/ai/results/_style.scss +80 -0
  52. package/ai/results/index.d.ts +11 -0
  53. package/ai/results/metrics.d.ts +5 -0
  54. package/ai/results/table.d.ts +5 -0
  55. package/ai/results/text.d.ts +5 -0
  56. package/ai/results/types.d.ts +29 -0
  57. package/ai/transcript.d.ts +2 -0
  58. package/ai/translations.d.ts +1 -1
  59. package/assignee/index.js +2 -2
  60. package/avatar/index.js +32 -31
  61. package/badge.view.d.ts +8 -0
  62. package/brush-range/component.js +28 -27
  63. package/buttons/svg-button.d.ts +1 -1
  64. package/buttons/svg-button.js +16 -16
  65. package/calendar/_calendar.scss +2 -2
  66. package/calendar/calendar.js +1 -1
  67. package/calendar/index.js +2 -2
  68. package/choice-chips/index.d.ts +3 -1
  69. package/choice-chips/index.js +1 -1
  70. package/color-palette/color-palette.js +1 -1
  71. package/color-palette/color-palette.style.scss +1 -1
  72. package/color-palette/color-picker.js +2 -2
  73. package/component-catalog.d.ts +6 -1
  74. package/configurator-actions.d.ts +67 -0
  75. package/configurator-actions.js +1 -0
  76. package/configurator-aggregation-list.d.ts +14 -0
  77. package/configurator-aggregation-list.js +61 -0
  78. package/configurator-drop-zone.d.ts +38 -0
  79. package/configurator-drop-zone.js +64 -0
  80. package/configurator-field-icon.d.ts +10 -0
  81. package/configurator-field-icon.js +1 -0
  82. package/configurator-focus.d.ts +4 -0
  83. package/configurator-focus.js +39 -0
  84. package/configurator-sections.d.ts +42 -0
  85. package/configurator-sections.js +71 -0
  86. package/control-presentation.js +24 -19
  87. package/controls.d.ts +1 -2
  88. package/controls.js +4 -3
  89. package/core/editor-popup.js +1 -1
  90. package/core/popover-controller.d.ts +35 -0
  91. package/core/popup-ownership.d.ts +2 -0
  92. package/core/title-tooltip.d.ts +2 -0
  93. package/core/tooltip-session.d.ts +29 -0
  94. package/core/tooltip-surface.d.ts +13 -0
  95. package/core/tooltip-text.d.ts +6 -0
  96. package/core/tooltip.d.ts +35 -0
  97. package/core/top-layer-popup.d.ts +4 -0
  98. package/core/top-layer-popup.js +1 -23
  99. package/date-time/index.js +1 -1
  100. package/date-time/style.scss +50 -7
  101. package/date-time/time-selection.d.ts +3 -1
  102. package/dialog/dialog.dom.js +8 -8
  103. package/dialog/dialog.parts.js +1 -1
  104. package/distribution-chart/_distribution-chart.scss +1 -57
  105. package/distribution-chart/area-chart.js +1 -1
  106. package/distribution-chart/bar-chart.js +1 -1
  107. package/distribution-chart/line-chart.js +1 -1
  108. package/dropdown/content.js +1 -1
  109. package/dropdown/control.js +1 -1
  110. package/dropdown/index.js +2 -2
  111. package/dropdown/lookup-field.js +2 -1
  112. package/dropdown/popup.d.ts +2 -2
  113. package/dropdown/popup.js +1 -1
  114. package/duration/index.js +1 -1
  115. package/editor-actions.js +1 -1
  116. package/field-configurator.d.ts +19 -0
  117. package/field-configurator.js +4 -170
  118. package/field-expansion.d.ts +9 -0
  119. package/filter/filters/slider/_slider.scss +0 -17
  120. package/filter/filters/slider/control.js +2 -0
  121. package/filter/filters/slider/runtime.js +49 -22
  122. package/filter/filters/slider/single.js +1 -1
  123. package/filter-badge.js +1 -1
  124. package/filter-controls.js +1 -1
  125. package/form-controls/index.js +6 -6
  126. package/form-controls/presentation.js +12 -12
  127. package/formatting/control-tooltip.d.ts +2 -27
  128. package/formatting/index.js +22 -21
  129. package/formatting/styles.scss +2 -47
  130. package/framework.js +215 -208
  131. package/history-controls.js +27 -1
  132. package/icon-toolbar.d.ts +58 -0
  133. package/icon-toolbar.js +1 -0
  134. package/masked-input/index.js +1 -1
  135. package/native-control.d.ts +1 -2
  136. package/native-control.js +1 -1
  137. package/native-styles.css +1 -1
  138. package/native.js +45 -42
  139. package/number-input/index.js +1 -1
  140. package/package.json +36 -1
  141. package/pagination.js +1 -1
  142. package/pdf-viewer/index.js +1 -1
  143. package/pickers.d.ts +5 -1
  144. package/preact-mount.js +1 -1
  145. package/preact.d.ts +7 -0
  146. package/preact.js +68 -61
  147. package/rating-choice.js +1 -1
  148. package/react.d.ts +5 -0
  149. package/react.js +67 -65
  150. package/reorder-list.js +1 -1
  151. package/resource-picker/resource-picker-popup.js +1 -1
  152. package/resource-picker/resource-picker.js +4 -4
  153. package/rich-text/engine.d.ts +1 -0
  154. package/rich-text/format-html.d.ts +2 -0
  155. package/rich-text/index.d.ts +4 -0
  156. package/rich-text/index.js +1 -1
  157. package/rich-text/model.d.ts +2 -0
  158. package/rich-text/style.scss +165 -70
  159. package/rich-text/syntax.d.ts +5 -0
  160. package/rich-text/translations.d.ts +2 -0
  161. package/select.d.ts +3 -1
  162. package/select.js +1 -1
  163. package/status-feedback/exit-snapshot.js +4 -4
  164. package/status-feedback/popover.js +4 -4
  165. package/styles/_compositions.scss +3 -3
  166. package/styles/_field-configurator.scss +146 -0
  167. package/styles/_fields-grid.scss +35 -0
  168. package/styles/_primitives.scss +25 -18
  169. package/styles/configurator-actions.scss +141 -0
  170. package/styles/legacy-pagination.css +19 -2
  171. package/styles.css +1 -1
  172. package/surfaces.d.ts +3 -0
  173. package/surfaces.js +34 -131
  174. package/surfaces.view.d.ts +4 -34
  175. package/svelte.js +1 -1
  176. package/switch/index.js +15 -14
  177. package/time-grid.js +37 -36
  178. package/timeline-track/index.js +2 -2
  179. package/ui.css +1 -1
  180. package/vue.d.ts +24 -9
  181. package/vue.js +118 -116
  182. package/_chunks/chart-frame-Cmc7xU1i.js +0 -130
  183. package/_chunks/choice-chips-CHQTUdLs.js +0 -110
  184. package/_chunks/color-picker-CudqPYZo.js +0 -138
  185. package/_chunks/control-tooltip-uscKfAnV.js +0 -100
  186. package/_chunks/date-time-qIhp5vaX.js +0 -768
  187. package/_chunks/editor-popup-WDdtVDNA.js +0 -81
  188. package/_chunks/history-controls-B3u3INEK.js +0 -27
  189. package/_chunks/mount-DQ1cpppK.js +0 -257
  190. package/_chunks/native-control-C_yok8_-.js +0 -605
  191. package/_chunks/request-trail-DSlFix6i.js +0 -618
  192. package/_chunks/rich-text-CH7gIqOS.js +0 -636
@@ -1,81 +0,0 @@
1
- import { calculateAnchoredPopoverPosition as e } from "../core/anchored-popover.js";
2
- import { t } from "./jsxRuntime.module-F6UFnpT-.js";
3
- import { hideTopLayerPopup as n, showTopLayerPopup as r } from "../core/top-layer-popup.js";
4
- import { createPreactElement as i, releasePreactElement as a } from "../preact-mount.js";
5
- import { t as o } from "./editor-commit-Bq3wSgvr.js";
6
- //#region src/core/editor-popup-position.ts
7
- function s(t, n, r, i = 4, a = 8) {
8
- let o = Math.max(0, r.height - a - t.bottom - i), s = Math.max(0, t.top - a - i), c = n.height <= o || o >= s ? "below" : "above", l = c === "below" ? o : s, u = Math.min(n.height, l);
9
- return {
10
- ...e(t, n, r, i, a),
11
- placementY: c,
12
- maxHeight: l,
13
- top: c === "below" ? t.bottom + i : t.top - u - i
14
- };
15
- }
16
- //#endregion
17
- //#region src/core/editor-popup.tsx
18
- var c = /* @__PURE__ */ new WeakMap();
19
- function l(e, l, u) {
20
- let d = e.ownerDocument, f = d.defaultView;
21
- c.get(d)?.close();
22
- let p = !1, m, h = (e) => (m = e, () => {
23
- m === e && (m = void 0);
24
- }), g = () => {
25
- p || (p = !0, T.disconnect(), w?.disconnect(), d.removeEventListener("pointerdown", v, !0), d.removeEventListener("keydown", y, !0), d.removeEventListener("scroll", b, !0), f.removeEventListener("resize", g), n(x, S), a(x), x.remove(), c.get(d)?.element === x && c.delete(d), u.onClose?.(), e.isConnected && e.focus({ preventScroll: !0 }));
26
- }, _ = (e) => e ? x.contains(e) ? !0 : [...x.querySelectorAll("[aria-controls]")].some((t) => t.getAttribute("aria-controls")?.split(" ").some((t) => d.getElementById(t)?.contains(e))) : !1, v = (t) => {
27
- _(t.target) || e.contains(t.target) || (u.isAvailable && !u.isAvailable() ? g() : m?.() === !1 ? (t.preventDefault(), t.stopPropagation()) : g());
28
- }, y = (e) => {
29
- if (e.key === "Escape") {
30
- if (x.querySelector("[aria-expanded=\"true\"]")) return;
31
- e.preventDefault(), e.stopPropagation(), g();
32
- }
33
- if (e.key === "Tab" && x.contains(e.target)) {
34
- let t = [...x.querySelectorAll("button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[contenteditable=\"true\"],[tabindex=\"0\"]")].filter((e) => e.tabIndex >= 0 && e.getClientRects().length), n = t[0], r = t.at(-1);
35
- e.shiftKey && d.activeElement === n ? (e.preventDefault(), r?.focus()) : !e.shiftKey && d.activeElement === r && (e.preventDefault(), n?.focus());
36
- }
37
- }, b = (t) => {
38
- let n = t.target;
39
- _(n) || n && (n.contains(e) || E?.contains(n)) && C();
40
- }, x = i(d, /* @__PURE__ */ t("div", {
41
- class: `rv-editor-popup ${u.className ?? ""}`,
42
- role: "dialog",
43
- "aria-label": u.label,
44
- onKeyDown: (e) => e.stopPropagation(),
45
- onKeyUp: (e) => e.stopPropagation(),
46
- onMouseDown: (e) => e.stopPropagation(),
47
- onClick: (e) => e.stopPropagation(),
48
- children: /* @__PURE__ */ t(o.Provider, {
49
- value: h,
50
- children: l(g)
51
- })
52
- }));
53
- x.style.direction = f.getComputedStyle(e).direction, (e.closest("dialog, [role=\"dialog\"], [role=\"menu\"]") ?? e.closest("revo-grid") ?? d.body).append(x);
54
- let S = r(x, "block"), C = () => {
55
- x.style.maxHeight = "";
56
- let t = s(e.getBoundingClientRect(), x.getBoundingClientRect(), {
57
- width: f.innerWidth,
58
- height: f.innerHeight
59
- });
60
- x.style.maxHeight = `${t.maxHeight}px`, x.style.left = `${t.left}px`, x.style.top = `${t.top}px`, x.dataset.placement = t.placementY;
61
- };
62
- C();
63
- let w = typeof f.ResizeObserver == "function" ? new f.ResizeObserver(C) : void 0;
64
- w?.observe(x), w?.observe(e);
65
- let T = new MutationObserver(() => {
66
- (!e.isConnected || !x.isConnected || u.isAvailable && !u.isAvailable()) && g();
67
- });
68
- T.observe(d.body, {
69
- childList: !0,
70
- subtree: !0
71
- });
72
- let E = e.closest("revo-grid");
73
- E && u.isAvailable && T.observe(E, { attributes: !0 }), d.addEventListener("pointerdown", v, !0), d.addEventListener("keydown", y, !0), d.addEventListener("scroll", b, !0), f.addEventListener("resize", g);
74
- let D = {
75
- element: x,
76
- close: g
77
- };
78
- return c.set(d, D), x.querySelector("[autofocus],input,textarea,button,[tabindex=\"0\"]")?.focus({ preventScroll: !0 }), D;
79
- }
80
- //#endregion
81
- export { l as t };
@@ -1,27 +0,0 @@
1
- import { t as e } from "./jsxRuntime.module-F6UFnpT-.js";
2
- import { SvgButton as t } from "../buttons/svg-button.js";
3
- import "./rotate-right-Iha5ScJ1.js";
4
- //#endregion
5
- //#region src/history-controls.tsx
6
- function n({ onUndo: n, onRedo: r, canUndo: i, canRedo: a, undoLabel: o = "Undo", redoLabel: s = "Redo", label: c = "History", undoCount: l, redoCount: u }) {
7
- return /* @__PURE__ */ e("div", {
8
- class: "rv-history-controls",
9
- role: "group",
10
- "aria-label": c,
11
- children: [n && /* @__PURE__ */ e(t, {
12
- icon: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M24 192l144 0c9.7 0 18.5-5.8 22.2-14.8s1.7-19.3-5.2-26.2l-46.7-46.7c75.3-58.6 184.3-53.3 253.5 15.9 75 75 75 196.5 0 271.5s-196.5 75-271.5 0c-10.2-10.2-19-21.3-26.4-33-9.5-14.9-29.3-19.3-44.2-9.8s-19.3 29.3-9.8 44.2C49.7 408.7 61.4 423.5 75 437 175 537 337 537 437 437S537 175 437 75C342.8-19.3 193.3-24.7 92.7 58.8L41 7C34.1 .2 23.8-1.9 14.8 1.8S0 14.3 0 24L0 168c0 13.3 10.7 24 24 24z\"/></svg>",
13
- label: o,
14
- badge: l,
15
- disabled: !i,
16
- onClick: n
17
- }), r && /* @__PURE__ */ e(t, {
18
- icon: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M488 192l-144 0c-9.7 0-18.5-5.8-22.2-14.8s-1.7-19.3 5.2-26.2l46.7-46.7c-75.3-58.6-184.3-53.3-253.5 15.9-75 75-75 196.5 0 271.5s196.5 75 271.5 0c8.2-8.2 15.5-16.9 21.9-26.1 10.1-14.5 30.1-18 44.6-7.9s18 30.1 7.9 44.6c-8.5 12.2-18.2 23.8-29.1 34.7-100 100-262.1 100-362 0S-25 175 75 75c94.3-94.3 243.7-99.6 344.3-16.2L471 7c6.9-6.9 17.2-8.9 26.2-5.2S512 14.3 512 24l0 144c0 13.3-10.7 24-24 24z\"/></svg>",
19
- label: s,
20
- badge: u,
21
- disabled: !a,
22
- onClick: r
23
- })]
24
- });
25
- }
26
- //#endregion
27
- export { n as t };
@@ -1,257 +0,0 @@
1
- import { i as e, r as t } from "./preact.module-BBM36DnO.js";
2
- import { c as n, i as r, t as i } from "./hooks.module-CG3gN83z.js";
3
- import { t as a } from "./jsxRuntime.module-F6UFnpT-.js";
4
- import { n as o } from "./controls-DsNi8V8I.js";
5
- import { _ as s, c, h as l, i as u, m as d, n as f, o as p, p as m, r as h, t as g, u as _, v, x as y } from "./request-trail-DSlFix6i.js";
6
- import { t as b } from "./history-controls-B3u3INEK.js";
7
- import { n as x } from "./render-m5eMMwFR.js";
8
- //#region src/ai/transcript.ts
9
- var S = (e) => new TextEncoder().encode(JSON.stringify(e)).byteLength, C = (e) => {
10
- if (!e) return "";
11
- if (S(e) <= 16384) return e;
12
- let t = 0, n = Math.min(e.length, 16384);
13
- for (; t < n;) {
14
- let r = Math.ceil((t + n) / 2);
15
- S(e.slice(0, r) + "…") <= 16384 ? t = r : n = r - 1;
16
- }
17
- return /[\uD800-\uDBFF]/.test(e.charAt(t - 1)) && t--, e.slice(0, t) + "…";
18
- }, w = class {
19
- messages = [];
20
- epoch = 0;
21
- initialized = !1;
22
- requestId;
23
- ignoredRequest;
24
- currentId;
25
- active = !1;
26
- lastPhase;
27
- key = "";
28
- sequence = 0;
29
- update(e) {
30
- if (this.initialized ||= (this.epoch = e.chatKey ?? 0, !0), (e.chatKey ?? 0) !== this.epoch) {
31
- this.epoch = e.chatKey ?? 0, this.messages = [], this.requestId = void 0, this.ignoredRequest = e.request?.id, this.currentId = void 0, this.active = !1, this.key = "", this.lastPhase = void 0;
32
- return;
33
- }
34
- if (e.phase === "idle" || e.request?.id === this.ignoredRequest && this.ignoredRequest !== void 0) return;
35
- let t = e.request, n = !!t && t.id !== this.requestId, r = {
36
- text: C(e.message),
37
- phase: e.phase,
38
- details: e.phase === "completed" && e.resultDetails ? C(e.resultDetails) : void 0,
39
- pending: !!e.pendingAction
40
- }, i = JSON.stringify([t?.id, r]);
41
- if (!n && i === this.key || !n && !r.text && !r.pending) return;
42
- let a = this.messages.find((e) => e.id === this.currentId), o = this.lastPhase === "completed" && e.phase === "understanding" && a?.from === "assistant";
43
- if (n) {
44
- this.requestId = t.id, this.ignoredRequest = void 0;
45
- let e = "turn:" + ++this.sequence;
46
- this.currentId = e + ":assistant", this.messages = [
47
- ...this.messages,
48
- {
49
- id: e + ":user",
50
- group: e,
51
- from: "user",
52
- text: C(t.prompt)
53
- },
54
- {
55
- id: this.currentId,
56
- group: e,
57
- from: "assistant",
58
- ...r
59
- }
60
- ];
61
- } else if ((this.active || o) && a) this.messages = this.messages.map((e) => e.id === this.currentId ? {
62
- ...e,
63
- ...r
64
- } : e);
65
- else {
66
- let e = "system:" + ++this.sequence;
67
- this.currentId = e, this.messages = [...this.messages, {
68
- id: e,
69
- group: e,
70
- from: "system",
71
- ...r
72
- }];
73
- }
74
- for (this.active = e.phase === "understanding" || e.phase === "applying" || !!e.pendingAction, this.lastPhase = e.phase, this.key = i; this.messages.length > 50 || S(this.messages) > 65536;) {
75
- let e = this.messages[0].group;
76
- this.messages = this.messages.filter((t) => t.group !== e);
77
- }
78
- }
79
- clear() {
80
- this.messages = [], this.requestId = void 0, this.currentId = void 0, this.active = !1, this.key = "";
81
- }
82
- };
83
- //#endregion
84
- //#region src/ai/mount.tsx
85
- function T(S, C) {
86
- let T = (e) => y(e, C.translations), E = !1, D = C.suggestions ?? [], O, k = v(C.promptHistory?.items ?? []), A = new w(), j = C.mode === "chat", M = [], N = 0, P = !1, F = "";
87
- function I(e) {
88
- if (e.phase === "idle" || !e.message || e.pendingAction) return;
89
- let t = e.phase === "understanding" || e.phase === "applying", n = JSON.stringify([
90
- e.phase,
91
- e.message,
92
- e.matchedRows,
93
- e.resultDetails
94
- ]);
95
- if (n === F) return;
96
- let r = M.at(-1), i = {
97
- id: P && r ? r.id : String(++N),
98
- title: e.message,
99
- busy: t,
100
- tone: e.phase === "error" ? "danger" : e.phase === "completed" ? "success" : "neutral",
101
- description: e.phase === "completed" && e.matchedRows !== void 0 ? C.countLabel?.(e.matchedRows) ?? T("{count} matching rows").replace("{count}", e.matchedRows.toLocaleString()) : void 0,
102
- detail: e.phase === "completed" ? e.resultDetails : void 0
103
- };
104
- M = [...P && r ? M.slice(0, -1) : M, i].slice(-50), P = t, F = n;
105
- }
106
- function L({ state: t }) {
107
- let [y, w] = r(""), [E, O] = r(k), [N, P] = r(!1), F = i();
108
- n(() => {
109
- w(""), F.current = void 0;
110
- }, [t.chatKey]);
111
- let I = t.phase === "understanding" || t.phase === "applying", L = !!t.pendingAction, z = t.steps ?? [], B = i(!1);
112
- n(() => {
113
- B.current && !L && !I && S.querySelector("textarea")?.focus(), B.current = L || I && B.current;
114
- }, [L, I]), n(() => {
115
- if (I || L || t.phase === "idle" || F.current === void 0) return;
116
- let e = F.current;
117
- F.current = void 0, t.phase === "completed" && w((t) => t.trim() === e ? "" : t);
118
- }, [t]);
119
- let V = (e) => {
120
- F.current = e.trim(), C.promptHistory && (k = v([...k, e]), O(k), C.promptHistory.onChange?.([...k])), C.onSubmit(e);
121
- }, H = j ? h : l, U = /* @__PURE__ */ a(s, {
122
- items: t.choices?.length ? t.choices : t.suggestions?.length ? t.suggestions : D,
123
- onSelect: (e) => {
124
- I || L || (w(e), V(e));
125
- },
126
- disabled: I || L
127
- }), W = /* @__PURE__ */ a(H, {
128
- label: C.prompt?.label ?? "Ask AI to change this view",
129
- ...C.prompt,
130
- value: y,
131
- onValueChange: w,
132
- onSubmit: V,
133
- onStop: C.onStop,
134
- busy: I,
135
- promptHistory: C.promptHistory ? E : void 0,
136
- disabled: L,
137
- hint: z.length ? "" : C.prompt?.hint,
138
- actions: /* @__PURE__ */ a(g, {
139
- ...C.trail,
140
- items: z,
141
- onRemove: (e) => C.onRemoveStep?.(e),
142
- onClear: C.onReset,
143
- onEmpty: () => S.querySelector("textarea")?.focus(),
144
- disabled: I || L,
145
- removalsDisabled: !C.onRemoveStep || t.canEditSteps === !1,
146
- clearDescription: C.trail?.clearDescription ?? "Restore the starting view",
147
- clearLabel: C.trail?.clearLabel ?? C.resetLabel ?? "Clear all",
148
- changedMessage: !I && z.length > 0 && t.canEditSteps === !1 ? C.trail?.changedMessage ?? "The view changed manually. Start a new request to continue." : void 0
149
- })
150
- }), G = t.pendingAction && /* @__PURE__ */ a(d, {
151
- ...t.pendingAction,
152
- disabled: I || !C.onApplyAction,
153
- onApply: () => C.onApplyAction?.(),
154
- onCancel: () => C.onCancelAction?.()
155
- }), K = /* @__PURE__ */ a("div", {
156
- class: "rv-ai-result-actions",
157
- children: [
158
- (C.onUndoData || C.onRedoData) && /* @__PURE__ */ a(b, {
159
- onUndo: C.onUndoData,
160
- onRedo: C.onRedoData,
161
- canUndo: !I && !L && !!t.canUndoData,
162
- canRedo: !I && !L && !!t.canRedoData,
163
- undoLabel: T("Undo data change"),
164
- redoLabel: T("Redo data change"),
165
- label: T("Data history")
166
- }),
167
- /* @__PURE__ */ a(o, {
168
- disabled: I || L || !t.canRestore,
169
- onClick: C.onRestore,
170
- size: "compact",
171
- children: T(C.restoreLabel ?? "Restore previous view")
172
- }),
173
- !z.length && /* @__PURE__ */ a(o, {
174
- disabled: I || L,
175
- onClick: C.onReset,
176
- size: "compact",
177
- variant: "ghost",
178
- children: T(C.resetLabel ?? "Reset view")
179
- }),
180
- j && /* @__PURE__ */ a(o, {
181
- size: "compact",
182
- variant: "ghost",
183
- disabled: I || L || !C.onClearChat || !A.messages.length,
184
- onClick: () => C.onClearChat?.(),
185
- children: T("Clear chat")
186
- })
187
- ]
188
- });
189
- return /* @__PURE__ */ a(m, {
190
- translations: C.translations,
191
- label: C.label,
192
- busy: I,
193
- footer: C.footer,
194
- children: j ? /* @__PURE__ */ a(f, {
195
- className: "rv-ai-mounted-chat",
196
- children: [
197
- /* @__PURE__ */ a(u, {
198
- busy: I,
199
- children: A.messages.map((e) => /* @__PURE__ */ a(p, {
200
- from: e.from,
201
- isStreaming: e.phase === "understanding" || e.phase === "applying",
202
- children: [
203
- e.from === "user" ? /* @__PURE__ */ a(c, { children: e.text }) : /* @__PURE__ */ a(c, { children: e.phase === "understanding" || e.phase === "applying" || e.phase === "error" || e.phase === "cancelled" ? /* @__PURE__ */ a(_, {
204
- title: e.text,
205
- status: e.phase === "understanding" || e.phase === "applying" ? "running" : e.phase === "error" ? "error" : "cancelled"
206
- }) : e.text }),
207
- e.details && /* @__PURE__ */ a("pre", {
208
- class: "rv-ai-chat-result",
209
- children: e.details
210
- }),
211
- e.id === A.messages.at(-1)?.id && e.pending && G
212
- ]
213
- }, e.id))
214
- }),
215
- U,
216
- W,
217
- K
218
- ]
219
- }) : /* @__PURE__ */ a(e, { children: [
220
- U,
221
- W,
222
- G,
223
- !!M.length && /* @__PURE__ */ a(x, {
224
- className: "rv-ai-activity",
225
- title: T("Activity"),
226
- compact: !0,
227
- autoDismissMs: C.activityDurationMs,
228
- onDismissItem: (e) => {
229
- M = M.filter((t) => t.id !== e), R();
230
- },
231
- collapsed: N,
232
- onCollapsedChange: P,
233
- collapseLabel: T("Collapse activity"),
234
- expandLabel: T("Expand activity"),
235
- items: M
236
- }),
237
- K
238
- ] })
239
- });
240
- }
241
- let R = () => {
242
- !E && O && t(/* @__PURE__ */ a(L, { state: O }), S);
243
- };
244
- return {
245
- update(e) {
246
- j ? A.update(e) : I(e), O = e, R();
247
- },
248
- setSuggestions(e) {
249
- D = [...e], R();
250
- },
251
- destroy() {
252
- E || (E = !0, k = [], A.clear(), t(null, S));
253
- }
254
- };
255
- }
256
- //#endregion
257
- export { T as t };