@bikdotai/bik-component-library 0.0.839-beta.6 → 0.0.839-beta.7

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 (127) hide show
  1. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  2. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +20 -44
  4. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js +1 -1
  6. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js +1 -1
  8. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +2 -2
  10. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +1 -1
  12. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/DiscardModal.js +1 -1
  14. package/dist/cjs/components/agent-builder/components/DiscardModal.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
  16. package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
  18. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/components/MentionPicker.js +13 -13
  20. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +4 -4
  22. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  23. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +6 -6
  24. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  25. package/dist/cjs/components/agent-builder/components/StepSectionHeader.js +1 -1
  26. package/dist/cjs/components/agent-builder/components/StepSectionHeader.js.map +1 -1
  27. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  28. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  29. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  30. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  31. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +1 -3
  32. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  33. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  34. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  35. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
  36. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  37. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +3 -5
  38. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  39. package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
  40. package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
  41. package/dist/cjs/components/agent-listing/AgentTable.js +1 -1
  42. package/dist/cjs/components/agent-listing/AgentTable.js.map +1 -1
  43. package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
  44. package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
  45. package/dist/cjs/components/agent-listing/DeleteAgentModal.js +1 -1
  46. package/dist/cjs/components/agent-listing/DeleteAgentModal.js.map +1 -1
  47. package/dist/cjs/components/button/Button.styled.js +0 -1
  48. package/dist/cjs/components/button/Button.styled.js.map +1 -1
  49. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  50. package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
  51. package/dist/cjs/editor/BikEditor.js +1 -1
  52. package/dist/cjs/editor/BikEditor.js.map +1 -1
  53. package/dist/cjs/editor/BikEditor.styles.js +54 -97
  54. package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
  55. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js +3 -3
  56. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  57. package/dist/esm/components/agent-builder/AgentBuilder.js +102 -106
  58. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  59. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +0 -3
  60. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +82 -110
  61. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  62. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js +21 -29
  63. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  64. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js +26 -27
  65. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  66. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +25 -25
  67. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  68. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +23 -24
  69. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  70. package/dist/esm/components/agent-builder/components/DiscardModal.d.ts +1 -3
  71. package/dist/esm/components/agent-builder/components/DiscardModal.js +16 -25
  72. package/dist/esm/components/agent-builder/components/DiscardModal.js.map +1 -1
  73. package/dist/esm/components/agent-builder/components/GoLiveModal.js +34 -36
  74. package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
  75. package/dist/esm/components/agent-builder/components/MentionEditor.js +19 -19
  76. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  77. package/dist/esm/components/agent-builder/components/MentionPicker.js +60 -64
  78. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  79. package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +0 -2
  80. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +105 -111
  81. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  82. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +4 -13
  83. package/dist/esm/components/agent-builder/components/SelectableListSection.js +148 -173
  84. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  85. package/dist/esm/components/agent-builder/components/StepSectionHeader.js +7 -7
  86. package/dist/esm/components/agent-builder/components/StepSectionHeader.js.map +1 -1
  87. package/dist/esm/components/agent-builder/constants/tools.js +1 -1
  88. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  89. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +103 -104
  90. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  91. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +98 -102
  92. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  93. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +142 -144
  94. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  95. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +79 -23
  96. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  97. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +23 -35
  98. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  99. package/dist/esm/components/agent-listing/AgentListing.js +65 -70
  100. package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
  101. package/dist/esm/components/agent-listing/AgentTable.d.ts +0 -2
  102. package/dist/esm/components/agent-listing/AgentTable.js +15 -16
  103. package/dist/esm/components/agent-listing/AgentTable.js.map +1 -1
  104. package/dist/esm/components/agent-listing/AgentTableRow.js +11 -11
  105. package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
  106. package/dist/esm/components/agent-listing/DeleteAgentModal.js +8 -8
  107. package/dist/esm/components/agent-listing/DeleteAgentModal.js.map +1 -1
  108. package/dist/esm/components/button/Button.styled.js +19 -25
  109. package/dist/esm/components/button/Button.styled.js.map +1 -1
  110. package/dist/esm/components/dropdown/Dropdown.js +13 -18
  111. package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
  112. package/dist/esm/editor/BikEditor.js +160 -173
  113. package/dist/esm/editor/BikEditor.js.map +1 -1
  114. package/dist/esm/editor/BikEditor.styles.d.ts +3 -20
  115. package/dist/esm/editor/BikEditor.styles.js +57 -102
  116. package/dist/esm/editor/BikEditor.styles.js.map +1 -1
  117. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.d.ts +8 -5
  118. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js +68 -87
  119. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  120. package/package.json +1 -1
  121. package/dist/cjs/components/agent-listing/AgentTableShimmer.js +0 -2
  122. package/dist/cjs/components/agent-listing/AgentTableShimmer.js.map +0 -1
  123. package/dist/esm/components/agent-builder/__fixtures__/agentValue.d.ts +0 -11
  124. package/dist/esm/components/agent-listing/AgentTableShimmer.d.ts +0 -12
  125. package/dist/esm/components/agent-listing/AgentTableShimmer.js +0 -20
  126. package/dist/esm/components/agent-listing/AgentTableShimmer.js.map +0 -1
  127. package/dist/esm/components/agent-listing/__fixtures__/agents.d.ts +0 -3
@@ -1,8 +1,8 @@
1
- import { Extension as p } from "../../../node_modules/@tiptap/core/dist/index.js";
2
- import { Plugin as u, PluginKey as d, TextSelection as h } from "@tiptap/pm/state";
3
- import { Decoration as m, DecorationSet as f } from "@tiptap/pm/view";
4
- import { tokenizeJson as g } from "./tokenizeJson.js";
5
- const k = {
1
+ import { Extension as h } from "../../../node_modules/@tiptap/core/dist/index.js";
2
+ import { Plugin as d, PluginKey as p, TextSelection as m } from "@tiptap/pm/state";
3
+ import { Decoration as u, DecorationSet as g } from "@tiptap/pm/view";
4
+ import { tokenizeJson as k } from "./tokenizeJson.js";
5
+ const y = {
6
6
  key: "bik-json-key",
7
7
  string: "bik-json-string",
8
8
  number: "bik-json-number",
@@ -10,40 +10,11 @@ const k = {
10
10
  null: "bik-json-null",
11
11
  punctuation: "bik-json-punct"
12
12
  };
13
- function b(r) {
14
- return r.length === 0 ? 0 : r.split(`
15
- `).length;
13
+ function f(s) {
14
+ const t = document.createElement("span");
15
+ return t.className = "bik-json-lineno", t.textContent = String(s), t.setAttribute("contenteditable", "false"), t;
16
16
  }
17
- class y {
18
- dom;
19
- contentDOM;
20
- gutter;
21
- constructor(n) {
22
- const t = document.createElement("pre"), e = document.createElement("div");
23
- e.className = "bik-json-gutter", e.contentEditable = "false";
24
- const o = document.createElement("code");
25
- t.appendChild(e), t.appendChild(o), this.dom = t, this.contentDOM = o, this.gutter = e, this.renderGutter(n);
26
- }
27
- renderGutter(n) {
28
- const t = b(n.textContent);
29
- if (this.gutter.childElementCount === t)
30
- return;
31
- const e = [];
32
- for (let o = 1; o <= t; o++) {
33
- const s = document.createElement("span");
34
- s.className = "bik-json-lineno", s.textContent = String(o), e.push(s);
35
- }
36
- this.gutter.replaceChildren(...e);
37
- }
38
- update(n) {
39
- return n.type.name !== "codeBlock" ? !1 : (this.renderGutter(n), !0);
40
- }
41
- // The gutter is ours to manage — never let ProseMirror parse it as content.
42
- ignoreMutation(n) {
43
- return this.gutter === n.target || this.gutter.contains(n.target);
44
- }
45
- }
46
- const E = p.create({
17
+ const w = h.create({
47
18
  name: "jsonHighlight",
48
19
  // Above CodeBlock (default 100) so our Backspace handler runs first and can
49
20
  // veto CodeBlock's own "clearNodes at start" shortcut (which would lift the
@@ -58,15 +29,15 @@ const E = p.create({
58
29
  // deleting a leading `\n` from line 2+) still works — those have
59
30
  // parentOffset > 0.
60
31
  Backspace: () => {
61
- const { selection: r } = this.editor.state, { empty: n, $from: t } = r;
62
- return n && t.parent.type.name === "codeBlock" && t.parentOffset === 0;
32
+ const { selection: s } = this.editor.state, { empty: t, $from: e } = s;
33
+ return t && e.parent.type.name === "codeBlock" && e.parentOffset === 0;
63
34
  }
64
35
  };
65
36
  },
66
37
  addProseMirrorPlugins() {
67
38
  return [
68
- new u({
69
- key: new d("jsonHighlightGuard"),
39
+ new d({
40
+ key: new p("jsonHighlightGuard"),
70
41
  // jsonMode invariant: the whole document is ONE codeBlock. Several
71
42
  // default Backspace paths can lift it to a plain paragraph — and one
72
43
  // of them, TipTap core's `clearDocument` appendTransaction (fired when
@@ -75,70 +46,80 @@ const E = p.create({
75
46
  // A paragraph has no gutter and no monospace rule, so the line numbers
76
47
  // and font vanish. Re-wrap the content back into a codeBlock whenever
77
48
  // something lifts it, restoring the invariant.
78
- appendTransaction(r, n, t) {
79
- if (!r.some((a) => a.docChanged))
49
+ appendTransaction(s, t, e) {
50
+ if (!s.some((a) => a.docChanged))
80
51
  return null;
81
- const { doc: e, schema: o } = t, s = o.nodes.codeBlock;
82
- if (!s || e.childCount === 1 && e.firstChild?.type === s)
52
+ const { doc: r, schema: i } = e, o = i.nodes.codeBlock;
53
+ if (!o || r.childCount === 1 && r.firstChild?.type === o)
83
54
  return null;
84
- let c = !1;
85
- if (e.forEach((a) => {
86
- a.type === s && (c = !0);
87
- }), c)
55
+ let l = !1;
56
+ if (r.forEach((a) => {
57
+ a.type === o && (l = !0);
58
+ }), l)
88
59
  return null;
89
- const l = e.textBetween(0, e.content.size, `
90
- `), i = t.tr;
91
- return i.replaceWith(
60
+ const n = r.textBetween(0, r.content.size, `
61
+ `), c = e.tr;
62
+ return c.replaceWith(
92
63
  0,
93
- e.content.size,
94
- s.create(null, l ? o.text(l) : null)
95
- ), i.setSelection(h.create(i.doc, 1)), i;
64
+ r.content.size,
65
+ o.create(null, n ? i.text(n) : null)
66
+ ), c.setSelection(m.create(c.doc, 1)), c;
96
67
  }
97
68
  }),
98
- new u({
99
- key: new d("jsonHighlight"),
69
+ new d({
70
+ key: new p("jsonHighlight"),
100
71
  props: {
101
- // The gutter is a node view, not a widget decoration — see
102
- // JsonCodeBlockView for why (MAP-7286).
103
- nodeViews: {
104
- codeBlock: (r) => new y(r)
105
- },
106
72
  // Paste beautify: if the clipboard text is valid JSON, drop in a
107
73
  // pretty-printed version (2-space indent, matching the Beautify
108
74
  // button) instead of the raw blob. Non-JSON pastes fall through to
109
75
  // the default handler untouched.
110
- handlePaste(r, n) {
111
- const t = n.clipboardData?.getData("text/plain");
112
- if (!t || !t.trim())
76
+ handlePaste(s, t) {
77
+ const e = t.clipboardData?.getData("text/plain");
78
+ if (!e || !e.trim())
113
79
  return !1;
114
- let e;
80
+ let r;
115
81
  try {
116
- e = JSON.parse(t);
82
+ r = JSON.parse(e);
117
83
  } catch {
118
84
  return !1;
119
85
  }
120
- const o = JSON.stringify(e, null, 2);
121
- if (o === t)
86
+ const i = JSON.stringify(r, null, 2);
87
+ if (i === e)
122
88
  return !1;
123
- const { state: s, dispatch: c } = r, { from: l, to: i } = s.selection;
124
- return c(s.tr.insertText(o, l, i).scrollIntoView()), !0;
89
+ const { state: o, dispatch: l } = s, { from: n, to: c } = o.selection;
90
+ return l(o.tr.insertText(i, n, c).scrollIntoView()), !0;
125
91
  },
126
- // Inline token colours only. Recolouring an inline span does not
127
- // disturb the caret (unlike the old gutter widgets).
128
- decorations(r) {
129
- const n = [];
130
- return r.doc.descendants((t, e) => {
131
- if (t.type.name !== "codeBlock") return;
132
- const o = t.textContent;
133
- if (o.length === 0) return;
134
- const s = e + 1;
135
- for (const c of g(o))
136
- n.push(
137
- m.inline(s + c.start, s + c.end, {
138
- class: k[c.type]
92
+ decorations(s) {
93
+ const t = [];
94
+ return s.doc.descendants((e, r) => {
95
+ if (e.type.name !== "codeBlock") return;
96
+ const i = e.textContent, o = r + 1;
97
+ for (const n of k(i))
98
+ t.push(
99
+ u.inline(o + n.start, o + n.end, {
100
+ class: y[n.type]
101
+ })
102
+ );
103
+ let l = 1;
104
+ t.push(
105
+ u.widget(o, () => f(1), {
106
+ side: -1,
107
+ key: "ln-1"
108
+ })
109
+ );
110
+ for (let n = 0; n < i.length; n++) {
111
+ if (i[n] !== `
112
+ `) continue;
113
+ l += 1;
114
+ const c = l;
115
+ t.push(
116
+ u.widget(o + n + 1, () => f(c), {
117
+ side: -1,
118
+ key: `ln-${c}`
139
119
  })
140
120
  );
141
- }), f.create(r.doc, n);
121
+ }
122
+ }), g.create(s.doc, t);
142
123
  }
143
124
  }
144
125
  })
@@ -146,6 +127,6 @@ const E = p.create({
146
127
  }
147
128
  });
148
129
  export {
149
- E as JsonHighlightExtension
130
+ w as JsonHighlightExtension
150
131
  };
151
132
  //# sourceMappingURL=JsonHighlightExtension.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"JsonHighlightExtension.js","sources":["../../../../../src/editor/extensions/jsonHighlight/JsonHighlightExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model';\nimport { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';\nimport type { NodeView } from '@tiptap/pm/view';\nimport { Decoration, DecorationSet } from '@tiptap/pm/view';\nimport { JsonTokenType, tokenizeJson } from './tokenizeJson';\n\nconst CLASS_BY_TYPE: Record<JsonTokenType, string> = {\n\tkey: 'bik-json-key',\n\tstring: 'bik-json-string',\n\tnumber: 'bik-json-number',\n\tboolean: 'bik-json-boolean',\n\tnull: 'bik-json-null',\n\tpunctuation: 'bik-json-punct',\n};\n\n/** Visual line count of a code block's text (0 when empty → no gutter). */\nfunction lineCount(text: string): number {\n\treturn text.length === 0 ? 0 : text.split('\\n').length;\n}\n\n/**\n * Node view for the JSON `codeBlock` that renders the line-number gutter as a\n * `contenteditable=false` sibling of the editable `<code>` — NOT as ProseMirror\n * widget decorations.\n *\n * Why: widget decorations are re-inserted into the content flow on every\n * decoration recompute (i.e. every keystroke). Re-inserting a node next to the\n * caret reset the contenteditable selection to the line start, so typing a JSON\n * key and then its `:` dropped the caret to the start of the line (MAP-7286).\n * A node view lets us update the gutter DOM independently of `contentDOM`, so\n * the caret is never touched — and we only rebuild it when the line count\n * actually changes.\n */\nclass JsonCodeBlockView implements NodeView {\n\tdom: HTMLPreElement;\n\tcontentDOM: HTMLElement;\n\tprivate gutter: HTMLElement;\n\n\tconstructor(node: ProseMirrorNode) {\n\t\tconst pre = document.createElement('pre');\n\t\tconst gutter = document.createElement('div');\n\t\tgutter.className = 'bik-json-gutter';\n\t\tgutter.contentEditable = 'false';\n\t\tconst code = document.createElement('code');\n\t\t// Gutter is absolutely positioned into the reserved left padding, so its\n\t\t// order relative to <code> doesn't affect the code layout.\n\t\tpre.appendChild(gutter);\n\t\tpre.appendChild(code);\n\n\t\tthis.dom = pre;\n\t\tthis.contentDOM = code;\n\t\tthis.gutter = gutter;\n\t\tthis.renderGutter(node);\n\t}\n\n\tprivate renderGutter(node: ProseMirrorNode): void {\n\t\tconst count = lineCount(node.textContent);\n\t\t// Nothing to do while the line count is unchanged — this is the common case\n\t\t// (typing within a line) and skipping it avoids touching the gutter DOM.\n\t\tif (this.gutter.childElementCount === count) {\n\t\t\treturn;\n\t\t}\n\t\tconst numbers: HTMLElement[] = [];\n\t\tfor (let n = 1; n <= count; n++) {\n\t\t\tconst span = document.createElement('span');\n\t\t\tspan.className = 'bik-json-lineno';\n\t\t\tspan.textContent = String(n);\n\t\t\tnumbers.push(span);\n\t\t}\n\t\tthis.gutter.replaceChildren(...numbers);\n\t}\n\n\tupdate(node: ProseMirrorNode): boolean {\n\t\tif (node.type.name !== 'codeBlock') {\n\t\t\treturn false;\n\t\t}\n\t\tthis.renderGutter(node);\n\t\treturn true;\n\t}\n\n\t// The gutter is ours to manage — never let ProseMirror parse it as content.\n\tignoreMutation(mutation: MutationRecord | { target: Node }): boolean {\n\t\treturn (\n\t\t\tthis.gutter === mutation.target || this.gutter.contains(mutation.target)\n\t\t);\n\t}\n}\n\n/**\n * Colours JSON tokens inside `codeBlock` nodes and renders a line-number gutter\n * (via {@link JsonCodeBlockView}). A code block stores its whole multi-line body\n * in a single text node, so token offsets map 1:1 onto document positions\n * (`nodeStart + offset`) — no cross-node bookkeeping needed.\n *\n * Purely decorative: the document text is never rewritten, so undo/redo,\n * character count and the cursor all behave exactly as with plain text.\n */\nexport const JsonHighlightExtension = Extension.create({\n\tname: 'jsonHighlight',\n\t// Above CodeBlock (default 100) so our Backspace handler runs first and can\n\t// veto CodeBlock's own \"clearNodes at start\" shortcut (which would lift the\n\t// block to a paragraph).\n\tpriority: 1000,\n\taddKeyboardShortcuts() {\n\t\treturn {\n\t\t\t// In JSON mode the document is a single code block. A Backspace at its very\n\t\t\t// start would lift it to a plain paragraph (killing the highlight, the\n\t\t\t// line-number gutter and the monospace font). There's nothing to delete\n\t\t\t// before the caret there anyway, so swallow it. Mid-text Backspace (and\n\t\t\t// deleting a leading `\\n` from line 2+) still works — those have\n\t\t\t// parentOffset > 0.\n\t\t\tBackspace: () => {\n\t\t\t\tconst { selection } = this.editor.state;\n\t\t\t\tconst { empty, $from } = selection;\n\t\t\t\treturn (\n\t\t\t\t\tempty &&\n\t\t\t\t\t$from.parent.type.name === 'codeBlock' &&\n\t\t\t\t\t$from.parentOffset === 0\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t},\n\taddProseMirrorPlugins() {\n\t\treturn [\n\t\t\tnew Plugin({\n\t\t\t\tkey: new PluginKey('jsonHighlightGuard'),\n\t\t\t\t// jsonMode invariant: the whole document is ONE codeBlock. Several\n\t\t\t\t// default Backspace paths can lift it to a plain paragraph — and one\n\t\t\t\t// of them, TipTap core's `clearDocument` appendTransaction (fired when\n\t\t\t\t// the whole doc is selected then deleted, e.g. Cmd-A → Backspace),\n\t\t\t\t// runs AFTER our Backspace shortcut, so a keymap veto can't stop it.\n\t\t\t\t// A paragraph has no gutter and no monospace rule, so the line numbers\n\t\t\t\t// and font vanish. Re-wrap the content back into a codeBlock whenever\n\t\t\t\t// something lifts it, restoring the invariant.\n\t\t\t\tappendTransaction(transactions, _oldState, newState) {\n\t\t\t\t\tif (!transactions.some((tr) => tr.docChanged)) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tconst { doc, schema } = newState;\n\t\t\t\t\tconst codeBlock = schema.nodes['codeBlock'];\n\t\t\t\t\tif (!codeBlock) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\t// Common case: already a single codeBlock → nothing to do.\n\t\t\t\t\tif (doc.childCount === 1 && doc.firstChild?.type === codeBlock) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\t// If a codeBlock survives anywhere, leave it alone (don't fight\n\t\t\t\t\t// legitimate multi-node edits that shouldn't happen in jsonMode).\n\t\t\t\t\tlet hasCodeBlock = false;\n\t\t\t\t\tdoc.forEach((node) => {\n\t\t\t\t\t\tif (node.type === codeBlock) {\n\t\t\t\t\t\t\thasCodeBlock = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif (hasCodeBlock) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\t// A lift happened: rebuild a single codeBlock from the text\n\t\t\t\t\t// (block boundaries preserved as newlines, matching JSON lines).\n\t\t\t\t\tconst text = doc.textBetween(0, doc.content.size, '\\n');\n\t\t\t\t\tconst tr = newState.tr;\n\t\t\t\t\ttr.replaceWith(\n\t\t\t\t\t\t0,\n\t\t\t\t\t\tdoc.content.size,\n\t\t\t\t\t\tcodeBlock.create(null, text ? schema.text(text) : null),\n\t\t\t\t\t);\n\t\t\t\t\ttr.setSelection(TextSelection.create(tr.doc, 1));\n\t\t\t\t\treturn tr;\n\t\t\t\t},\n\t\t\t}),\n\t\t\tnew Plugin({\n\t\t\t\tkey: new PluginKey('jsonHighlight'),\n\t\t\t\tprops: {\n\t\t\t\t\t// The gutter is a node view, not a widget decoration — see\n\t\t\t\t\t// JsonCodeBlockView for why (MAP-7286).\n\t\t\t\t\tnodeViews: {\n\t\t\t\t\t\tcodeBlock: (node) => new JsonCodeBlockView(node),\n\t\t\t\t\t},\n\t\t\t\t\t// Paste beautify: if the clipboard text is valid JSON, drop in a\n\t\t\t\t\t// pretty-printed version (2-space indent, matching the Beautify\n\t\t\t\t\t// button) instead of the raw blob. Non-JSON pastes fall through to\n\t\t\t\t\t// the default handler untouched.\n\t\t\t\t\thandlePaste(view, event) {\n\t\t\t\t\t\tconst raw = event.clipboardData?.getData('text/plain');\n\t\t\t\t\t\tif (!raw || !raw.trim()) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet value: unknown;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvalue = JSON.parse(raw);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst pretty = JSON.stringify(value, null, 2);\n\t\t\t\t\t\t// No-op if it was already beautified (avoids a redundant tx).\n\t\t\t\t\t\tif (pretty === raw) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst { state, dispatch } = view;\n\t\t\t\t\t\tconst { from, to } = state.selection;\n\t\t\t\t\t\tdispatch(state.tr.insertText(pretty, from, to).scrollIntoView());\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t},\n\t\t\t\t\t// Inline token colours only. Recolouring an inline span does not\n\t\t\t\t\t// disturb the caret (unlike the old gutter widgets).\n\t\t\t\t\tdecorations(state) {\n\t\t\t\t\t\tconst decorations: Decoration[] = [];\n\t\t\t\t\t\tstate.doc.descendants((node, pos) => {\n\t\t\t\t\t\t\tif (node.type.name !== 'codeBlock') return;\n\t\t\t\t\t\t\tconst text = node.textContent;\n\t\t\t\t\t\t\tif (text.length === 0) return;\n\t\t\t\t\t\t\t// +1: step past the code-block node boundary into its text.\n\t\t\t\t\t\t\tconst base = pos + 1;\n\t\t\t\t\t\t\tfor (const tok of tokenizeJson(text)) {\n\t\t\t\t\t\t\t\tdecorations.push(\n\t\t\t\t\t\t\t\t\tDecoration.inline(base + tok.start, base + tok.end, {\n\t\t\t\t\t\t\t\t\t\tclass: CLASS_BY_TYPE[tok.type],\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn DecorationSet.create(state.doc, decorations);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t];\n\t},\n});\n"],"names":["CLASS_BY_TYPE","lineCount","text","JsonCodeBlockView","node","pre","gutter","code","count","numbers","n","span","mutation","JsonHighlightExtension","Extension","selection","empty","$from","Plugin","PluginKey","transactions","_oldState","newState","tr","doc","schema","codeBlock","hasCodeBlock","TextSelection","view","event","raw","value","pretty","state","dispatch","from","to","decorations","pos","base","tok","tokenizeJson","Decoration","DecorationSet"],"mappings":";;;;AAOA,MAAMA,IAA+C;AAAA,EACpD,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AACd;AAGA,SAASC,EAAUC,GAAsB;AACxC,SAAOA,EAAK,WAAW,IAAI,IAAIA,EAAK,MAAM;AAAA,CAAI,EAAE;AACjD;AAeA,MAAMC,EAAsC;AAAA,EAC3C;AAAA,EACA;AAAA,EACQ;AAAA,EAER,YAAYC,GAAuB;AAClC,UAAMC,IAAM,SAAS,cAAc,KAAK,GAClCC,IAAS,SAAS,cAAc,KAAK;AAC3C,IAAAA,EAAO,YAAY,mBACnBA,EAAO,kBAAkB;AACzB,UAAMC,IAAO,SAAS,cAAc,MAAM;AAG1C,IAAAF,EAAI,YAAYC,CAAM,GACtBD,EAAI,YAAYE,CAAI,GAEpB,KAAK,MAAMF,GACX,KAAK,aAAaE,GAClB,KAAK,SAASD,GACd,KAAK,aAAaF,CAAI;AAAA,EACvB;AAAA,EAEQ,aAAaA,GAA6B;AACjD,UAAMI,IAAQP,EAAUG,EAAK,WAAW;AAGxC,QAAI,KAAK,OAAO,sBAAsBI;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A;AAAA,UAGA,YAAYH,GAAO;AAClB,kBAAMI,IAA4B,CAAA;AAClC,mBAAAJ,EAAM,IAAI,YAAY,CAAC9B,GAAMmC,MAAQ;AACpC,kBAAInC,EAAK,KAAK,SAAS,YAAa;AACpC,oBAAMF,IAAOE,EAAK;AAClB,kBAAIF,EAAK,WAAW,EAAG;AAEvB,oBAAMsC,IAAOD,IAAM;AACnB,yBAAWE,KAAOC,EAAaxC,CAAI;AAClC,gBAAAoC,EAAY;AAAA,kBACXK,EAAW,OAAOH,IAAOC,EAAI,OAAOD,IAAOC,EAAI,KAAK;AAAA,oBACnD,OAAOzC,EAAcyC,EAAI,IAAI;AAAA,kBAAA,CAC7B;AAAA,gBAAA;AAAA,YAGJ,CAAC,GACMG,EAAc,OAAOV,EAAM,KAAKI,CAAW;AAAA,UACnD;AAAA,QAAA;AAAA,MACD,CACA;AAAA,IAAA;AAAA,EAEH;AACD,CAAC;"}
1
+ {"version":3,"file":"JsonHighlightExtension.js","sources":["../../../../../src/editor/extensions/jsonHighlight/JsonHighlightExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';\nimport { Decoration, DecorationSet } from '@tiptap/pm/view';\nimport { JsonTokenType, tokenizeJson } from './tokenizeJson';\n\nconst CLASS_BY_TYPE: Record<JsonTokenType, string> = {\n\tkey: 'bik-json-key',\n\tstring: 'bik-json-string',\n\tnumber: 'bik-json-number',\n\tboolean: 'bik-json-boolean',\n\tnull: 'bik-json-null',\n\tpunctuation: 'bik-json-punct',\n};\n\n/** Line-number widget rendered in the hanging gutter at each line start. */\nfunction lineNumberWidget(n: number): HTMLElement {\n\tconst span = document.createElement('span');\n\tspan.className = 'bik-json-lineno';\n\tspan.textContent = String(n);\n\tspan.setAttribute('contenteditable', 'false');\n\treturn span;\n}\n\n/**\n * Colours JSON tokens inside `codeBlock` nodes and renders a line-number gutter.\n * A code block stores its whole multi-line body in a single text node, so token\n * offsets map 1:1 onto document positions (`nodeStart + offset`) — no cross-node\n * bookkeeping needed, and lines are just the `\\n`-separated runs of that text.\n *\n * Purely decorative: the document text is never rewritten, so undo/redo,\n * character count and the cursor all behave exactly as with plain text. The\n * gutter numbers are `side: -1` widgets that hang into the code block's left\n * padding (see `.bik-json-lineno` in BikEditor.styles.ts), so they never enter\n * the document text or shift character offsets.\n */\nexport const JsonHighlightExtension = Extension.create({\n\tname: 'jsonHighlight',\n\t// Above CodeBlock (default 100) so our Backspace handler runs first and can\n\t// veto CodeBlock's own \"clearNodes at start\" shortcut (which would lift the\n\t// block to a paragraph).\n\tpriority: 1000,\n\taddKeyboardShortcuts() {\n\t\treturn {\n\t\t\t// In JSON mode the document is a single code block. A Backspace at its very\n\t\t\t// start would lift it to a plain paragraph (killing the highlight, the\n\t\t\t// line-number gutter and the monospace font). There's nothing to delete\n\t\t\t// before the caret there anyway, so swallow it. Mid-text Backspace (and\n\t\t\t// deleting a leading `\\n` from line 2+) still works — those have\n\t\t\t// parentOffset > 0.\n\t\t\tBackspace: () => {\n\t\t\t\tconst { selection } = this.editor.state;\n\t\t\t\tconst { empty, $from } = selection;\n\t\t\t\treturn (\n\t\t\t\t\tempty &&\n\t\t\t\t\t$from.parent.type.name === 'codeBlock' &&\n\t\t\t\t\t$from.parentOffset === 0\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t},\n\taddProseMirrorPlugins() {\n\t\treturn [\n\t\t\tnew Plugin({\n\t\t\t\tkey: new PluginKey('jsonHighlightGuard'),\n\t\t\t\t// jsonMode invariant: the whole document is ONE codeBlock. Several\n\t\t\t\t// default Backspace paths can lift it to a plain paragraph — and one\n\t\t\t\t// of them, TipTap core's `clearDocument` appendTransaction (fired when\n\t\t\t\t// the whole doc is selected then deleted, e.g. Cmd-A → Backspace),\n\t\t\t\t// runs AFTER our Backspace shortcut, so a keymap veto can't stop it.\n\t\t\t\t// A paragraph has no gutter and no monospace rule, so the line numbers\n\t\t\t\t// and font vanish. Re-wrap the content back into a codeBlock whenever\n\t\t\t\t// something lifts it, restoring the invariant.\n\t\t\t\tappendTransaction(transactions, _oldState, newState) {\n\t\t\t\t\tif (!transactions.some((tr) => tr.docChanged)) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tconst { doc, schema } = newState;\n\t\t\t\t\tconst codeBlock = schema.nodes['codeBlock'];\n\t\t\t\t\tif (!codeBlock) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\t// Common case: already a single codeBlock → nothing to do.\n\t\t\t\t\tif (doc.childCount === 1 && doc.firstChild?.type === codeBlock) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\t// If a codeBlock survives anywhere, leave it alone (don't fight\n\t\t\t\t\t// legitimate multi-node edits that shouldn't happen in jsonMode).\n\t\t\t\t\tlet hasCodeBlock = false;\n\t\t\t\t\tdoc.forEach((node) => {\n\t\t\t\t\t\tif (node.type === codeBlock) {\n\t\t\t\t\t\t\thasCodeBlock = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif (hasCodeBlock) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\t// A lift happened: rebuild a single codeBlock from the text\n\t\t\t\t\t// (block boundaries preserved as newlines, matching JSON lines).\n\t\t\t\t\tconst text = doc.textBetween(0, doc.content.size, '\\n');\n\t\t\t\t\tconst tr = newState.tr;\n\t\t\t\t\ttr.replaceWith(\n\t\t\t\t\t\t0,\n\t\t\t\t\t\tdoc.content.size,\n\t\t\t\t\t\tcodeBlock.create(null, text ? schema.text(text) : null),\n\t\t\t\t\t);\n\t\t\t\t\ttr.setSelection(TextSelection.create(tr.doc, 1));\n\t\t\t\t\treturn tr;\n\t\t\t\t},\n\t\t\t}),\n\t\t\tnew Plugin({\n\t\t\t\tkey: new PluginKey('jsonHighlight'),\n\t\t\t\tprops: {\n\t\t\t\t\t// Paste beautify: if the clipboard text is valid JSON, drop in a\n\t\t\t\t\t// pretty-printed version (2-space indent, matching the Beautify\n\t\t\t\t\t// button) instead of the raw blob. Non-JSON pastes fall through to\n\t\t\t\t\t// the default handler untouched.\n\t\t\t\t\thandlePaste(view, event) {\n\t\t\t\t\t\tconst raw = event.clipboardData?.getData('text/plain');\n\t\t\t\t\t\tif (!raw || !raw.trim()) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet value: unknown;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvalue = JSON.parse(raw);\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst pretty = JSON.stringify(value, null, 2);\n\t\t\t\t\t\t// No-op if it was already beautified (avoids a redundant tx).\n\t\t\t\t\t\tif (pretty === raw) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst { state, dispatch } = view;\n\t\t\t\t\t\tconst { from, to } = state.selection;\n\t\t\t\t\t\tdispatch(state.tr.insertText(pretty, from, to).scrollIntoView());\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t},\n\t\t\t\t\tdecorations(state) {\n\t\t\t\t\t\tconst decorations: Decoration[] = [];\n\t\t\t\t\t\tstate.doc.descendants((node, pos) => {\n\t\t\t\t\t\t\tif (node.type.name !== 'codeBlock') return;\n\t\t\t\t\t\t\tconst text = node.textContent;\n\t\t\t\t\t\t\t// +1: step past the code-block node boundary into its text.\n\t\t\t\t\t\t\tconst base = pos + 1;\n\n\t\t\t\t\t\t\tfor (const tok of tokenizeJson(text)) {\n\t\t\t\t\t\t\t\tdecorations.push(\n\t\t\t\t\t\t\t\t\tDecoration.inline(base + tok.start, base + tok.end, {\n\t\t\t\t\t\t\t\t\t\tclass: CLASS_BY_TYPE[tok.type],\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// One line number per `\\n`-separated line (line 1 at offset 0,\n\t\t\t\t\t\t\t// then one after every newline). `white-space: pre` on the block\n\t\t\t\t\t\t\t// disables wrapping, so logical lines == visual lines.\n\t\t\t\t\t\t\tlet line = 1;\n\t\t\t\t\t\t\tdecorations.push(\n\t\t\t\t\t\t\t\tDecoration.widget(base, () => lineNumberWidget(1), {\n\t\t\t\t\t\t\t\t\tside: -1,\n\t\t\t\t\t\t\t\t\tkey: 'ln-1',\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tfor (let i = 0; i < text.length; i++) {\n\t\t\t\t\t\t\t\tif (text[i] !== '\\n') continue;\n\t\t\t\t\t\t\t\tline += 1;\n\t\t\t\t\t\t\t\tconst n = line;\n\t\t\t\t\t\t\t\tdecorations.push(\n\t\t\t\t\t\t\t\t\tDecoration.widget(base + i + 1, () => lineNumberWidget(n), {\n\t\t\t\t\t\t\t\t\t\tside: -1,\n\t\t\t\t\t\t\t\t\t\tkey: `ln-${n}`,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn DecorationSet.create(state.doc, decorations);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t];\n\t},\n});\n"],"names":["CLASS_BY_TYPE","lineNumberWidget","n","span","JsonHighlightExtension","Extension","selection","empty","$from","Plugin","PluginKey","transactions","_oldState","newState","tr","doc","schema","codeBlock","hasCodeBlock","node","text","TextSelection","view","event","raw","value","pretty","state","dispatch","from","to","decorations","pos","base","tok","tokenizeJson","Decoration","line","i","DecorationSet"],"mappings":";;;;AAKA,MAAMA,IAA+C;AAAA,EACpD,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AACd;AAGA,SAASC,EAAiBC,GAAwB;AACjD,QAAMC,IAAO,SAAS,cAAc,MAAM;AAC1C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D,MAAM;AAAA,kBACN,KAAK;AAAA,gBAAA,CACL;AAAA,cAAA;AAEF,uBAASqC,IAAI,GAAGA,IAAIlB,EAAK,QAAQkB,KAAK;AACrC,oBAAIlB,EAAKkB,CAAC,MAAM;AAAA,EAAM;AACtB,gBAAAD,KAAQ;AACR,sBAAMnC,IAAImC;AACV,gBAAAN,EAAY;AAAA,kBACXK,EAAW,OAAOH,IAAOK,IAAI,GAAG,MAAMrC,EAAiBC,CAAC,GAAG;AAAA,oBAC1D,MAAM;AAAA,oBACN,KAAK,MAAMA,CAAC;AAAA,kBAAA,CACZ;AAAA,gBAAA;AAAA,cAEH;AAAA,YACD,CAAC,GACMqC,EAAc,OAAOZ,EAAM,KAAKI,CAAW;AAAA,UACnD;AAAA,QAAA;AAAA,MACD,CACA;AAAA,IAAA;AAAA,EAEH;AACD,CAAC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.839-beta.6",
3
+ "version": "0.0.839-beta.7",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../shimmer/ShimmerComponent/BikShimmer.js"),r=require("./AgentListing.styled.js"),x=require("./AgentTable.js"),l=(i,t="16px",n="4px")=>e.jsx(s.BikShimmer,{boxes:[{width:i,height:t,borderRadius:n,marginTop:"0"}]}),a=({rows:i=5})=>e.jsx(r.TableCard,{"data-test":"agent-table-shimmer",children:e.jsxs(r.TableScroll,{children:[e.jsx(x.AgentTableHeader,{}),Array.from({length:i},(t,n)=>e.jsxs(r.BodyGridRow,{children:[e.jsx(r.Cell,{children:l("60%")}),e.jsx(r.Cell,{children:l("70%")}),e.jsx(r.Cell,{align:"right",children:l("48px")}),e.jsx(r.Cell,{children:l("64px","24px","999px")}),e.jsx(r.Cell,{align:"center",children:l("72px","24px")})]},n))]})});exports.AgentTableShimmer=a;
2
- //# sourceMappingURL=AgentTableShimmer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentTableShimmer.js","sources":["../../../../src/components/agent-listing/AgentTableShimmer.tsx"],"sourcesContent":["import React from 'react';\nimport BikShimmer from '@src/components/shimmer/ShimmerComponent/BikShimmer';\nimport {\n\tBodyGridRow,\n\tCell,\n\tTableCard,\n\tTableScroll,\n} from './AgentListing.styled';\nimport { AgentTableHeader } from './AgentTable';\n\ninterface AgentTableShimmerProps {\n\t/** Shimmer row count — pass the page size so the refetch keeps the page height. */\n\trows?: number;\n}\n\nconst box = (width: string, height = '16px', borderRadius = '4px') => (\n\t<BikShimmer boxes={[{ width, height, borderRadius, marginTop: '0' }]} />\n);\n\n/**\n * Table-shaped loading state: the real column header + shimmer rows matching the\n * listing grid, so a refetch (page/page-size/sort/search change) shimmers in place\n * instead of collapsing to the initial full-page loader.\n */\nexport const AgentTableShimmer: React.FC<AgentTableShimmerProps> = ({\n\trows = 5,\n}) => (\n\t<TableCard data-test=\"agent-table-shimmer\">\n\t\t<TableScroll>\n\t\t\t<AgentTableHeader />\n\n\t\t\t{Array.from({ length: rows }, (_, i) => (\n\t\t\t\t<BodyGridRow key={i}>\n\t\t\t\t\t<Cell>{box('60%')}</Cell>\n\t\t\t\t\t<Cell>{box('70%')}</Cell>\n\t\t\t\t\t<Cell align=\"right\">{box('48px')}</Cell>\n\t\t\t\t\t<Cell>{box('64px', '24px', '999px')}</Cell>\n\t\t\t\t\t<Cell align=\"center\">{box('72px', '24px')}</Cell>\n\t\t\t\t</BodyGridRow>\n\t\t\t))}\n\t\t</TableScroll>\n\t</TableCard>\n);\n"],"names":["box","width","height","borderRadius","jsx","BikShimmer","AgentTableShimmer","rows","TableCard","TableScroll","AgentTableHeader","_","i","jsxs","BodyGridRow","Cell"],"mappings":"+OAeMA,EAAM,CAACC,EAAeC,EAAS,OAAQC,EAAe,QAC3DC,EAAAA,IAACC,EAAAA,WAAA,CAAW,MAAO,CAAC,CAAE,MAAAJ,EAAO,OAAAC,EAAQ,aAAAC,EAAc,UAAW,GAAA,CAAK,EAAG,EAQ1DG,EAAsD,CAAC,CACnE,KAAAC,EAAO,CACR,IACCH,EAAAA,IAACI,YAAA,CAAU,YAAU,sBACpB,gBAACC,cAAA,CACA,SAAA,CAAAL,EAAAA,IAACM,EAAAA,iBAAA,EAAiB,EAEjB,MAAM,KAAK,CAAE,OAAQH,CAAA,EAAQ,CAACI,EAAGC,IACjCC,EAAAA,KAACC,EAAAA,YAAA,CACA,SAAA,CAAAV,EAAAA,IAACW,EAAAA,KAAA,CAAM,SAAAf,EAAI,KAAK,CAAA,CAAE,EAClBI,EAAAA,IAACW,EAAAA,KAAA,CAAM,SAAAf,EAAI,KAAK,CAAA,CAAE,QACjBe,EAAAA,KAAA,CAAK,MAAM,QAAS,SAAAf,EAAI,MAAM,EAAE,QAChCe,EAAAA,KAAA,CAAM,SAAAf,EAAI,OAAQ,OAAQ,OAAO,EAAE,QACnCe,EAAAA,KAAA,CAAK,MAAM,SAAU,SAAAf,EAAI,OAAQ,MAAM,CAAA,CAAE,CAAA,CAAA,EALzBY,CAMlB,CACA,CAAA,CAAA,CACF,CAAA,CACD"}
@@ -1,11 +0,0 @@
1
- import { AgentValue, ParamsBlob } from '../AgentBuilder.model';
2
- /** A minimal, valid empty draft (every required field present). */
3
- export declare const emptyAgent: () => AgentValue;
4
- /** A fully-filled, all-steps-valid draft. */
5
- export declare const filledAgent: () => AgentValue;
6
- /** A catalog tool fixture with every AgentToolDoc field. */
7
- export declare const tool: (tool_id: string, display_name: string, source?: AgentToolDoc) => AgentToolDoc;
8
- /** A backend email-tool params template (mirrors the story seed). */
9
- export declare const EMAIL_TEMPLATE: ParamsBlob;
10
- /** A backend slack-tool params template. */
11
- export declare const SLACK_TEMPLATE: ParamsBlob;
@@ -1,12 +0,0 @@
1
- import { default as React } from 'react';
2
- interface AgentTableShimmerProps {
3
- /** Shimmer row count — pass the page size so the refetch keeps the page height. */
4
- rows?: number;
5
- }
6
- /**
7
- * Table-shaped loading state: the real column header + shimmer rows matching the
8
- * listing grid, so a refetch (page/page-size/sort/search change) shimmers in place
9
- * instead of collapsing to the initial full-page loader.
10
- */
11
- export declare const AgentTableShimmer: React.FC<AgentTableShimmerProps>;
12
- export {};
@@ -1,20 +0,0 @@
1
- import { jsx as r, jsxs as t } from "react/jsx-runtime";
2
- import { BikShimmer as m } from "../shimmer/ShimmerComponent/BikShimmer.js";
3
- import { TableCard as a, TableScroll as p, BodyGridRow as d, Cell as e } from "./AgentListing.styled.js";
4
- import { AgentTableHeader as h } from "./AgentTable.js";
5
- const i = (l, o = "16px", n = "4px") => /* @__PURE__ */ r(m, { boxes: [{ width: l, height: o, borderRadius: n, marginTop: "0" }] }), b = ({
6
- rows: l = 5
7
- }) => /* @__PURE__ */ r(a, { "data-test": "agent-table-shimmer", children: /* @__PURE__ */ t(p, { children: [
8
- /* @__PURE__ */ r(h, {}),
9
- Array.from({ length: l }, (o, n) => /* @__PURE__ */ t(d, { children: [
10
- /* @__PURE__ */ r(e, { children: i("60%") }),
11
- /* @__PURE__ */ r(e, { children: i("70%") }),
12
- /* @__PURE__ */ r(e, { align: "right", children: i("48px") }),
13
- /* @__PURE__ */ r(e, { children: i("64px", "24px", "999px") }),
14
- /* @__PURE__ */ r(e, { align: "center", children: i("72px", "24px") })
15
- ] }, n))
16
- ] }) });
17
- export {
18
- b as AgentTableShimmer
19
- };
20
- //# sourceMappingURL=AgentTableShimmer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentTableShimmer.js","sources":["../../../../src/components/agent-listing/AgentTableShimmer.tsx"],"sourcesContent":["import React from 'react';\nimport BikShimmer from '@src/components/shimmer/ShimmerComponent/BikShimmer';\nimport {\n\tBodyGridRow,\n\tCell,\n\tTableCard,\n\tTableScroll,\n} from './AgentListing.styled';\nimport { AgentTableHeader } from './AgentTable';\n\ninterface AgentTableShimmerProps {\n\t/** Shimmer row count — pass the page size so the refetch keeps the page height. */\n\trows?: number;\n}\n\nconst box = (width: string, height = '16px', borderRadius = '4px') => (\n\t<BikShimmer boxes={[{ width, height, borderRadius, marginTop: '0' }]} />\n);\n\n/**\n * Table-shaped loading state: the real column header + shimmer rows matching the\n * listing grid, so a refetch (page/page-size/sort/search change) shimmers in place\n * instead of collapsing to the initial full-page loader.\n */\nexport const AgentTableShimmer: React.FC<AgentTableShimmerProps> = ({\n\trows = 5,\n}) => (\n\t<TableCard data-test=\"agent-table-shimmer\">\n\t\t<TableScroll>\n\t\t\t<AgentTableHeader />\n\n\t\t\t{Array.from({ length: rows }, (_, i) => (\n\t\t\t\t<BodyGridRow key={i}>\n\t\t\t\t\t<Cell>{box('60%')}</Cell>\n\t\t\t\t\t<Cell>{box('70%')}</Cell>\n\t\t\t\t\t<Cell align=\"right\">{box('48px')}</Cell>\n\t\t\t\t\t<Cell>{box('64px', '24px', '999px')}</Cell>\n\t\t\t\t\t<Cell align=\"center\">{box('72px', '24px')}</Cell>\n\t\t\t\t</BodyGridRow>\n\t\t\t))}\n\t\t</TableScroll>\n\t</TableCard>\n);\n"],"names":["box","width","height","borderRadius","jsx","BikShimmer","AgentTableShimmer","rows","TableCard","TableScroll","AgentTableHeader","_","i","jsxs","BodyGridRow","Cell"],"mappings":";;;;AAeA,MAAMA,IAAM,CAACC,GAAeC,IAAS,QAAQC,IAAe,UAC3D,gBAAAC,EAACC,GAAA,EAAW,OAAO,CAAC,EAAE,OAAAJ,GAAO,QAAAC,GAAQ,cAAAC,GAAc,WAAW,IAAA,CAAK,GAAG,GAQ1DG,IAAsD,CAAC;AAAA,EACnE,MAAAC,IAAO;AACR,MACC,gBAAAH,EAACI,GAAA,EAAU,aAAU,uBACpB,4BAACC,GAAA,EACA,UAAA;AAAA,EAAA,gBAAAL,EAACM,GAAA,EAAiB;AAAA,EAEjB,MAAM,KAAK,EAAE,QAAQH,EAAA,GAAQ,CAACI,GAAGC,MACjC,gBAAAC,EAACC,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAV,EAACW,GAAA,EAAM,UAAAf,EAAI,KAAK,EAAA,CAAE;AAAA,IAClB,gBAAAI,EAACW,GAAA,EAAM,UAAAf,EAAI,KAAK,EAAA,CAAE;AAAA,sBACjBe,GAAA,EAAK,OAAM,SAAS,UAAAf,EAAI,MAAM,GAAE;AAAA,sBAChCe,GAAA,EAAM,UAAAf,EAAI,QAAQ,QAAQ,OAAO,GAAE;AAAA,sBACnCe,GAAA,EAAK,OAAM,UAAU,UAAAf,EAAI,QAAQ,MAAM,EAAA,CAAE;AAAA,EAAA,EAAA,GALzBY,CAMlB,CACA;AAAA,EAAA,CACF,EAAA,CACD;"}
@@ -1,3 +0,0 @@
1
- import { AgentListItem } from '../AgentListing.model';
2
- /** Sample listing rows covering every trigger kind + status. */
3
- export declare const SAMPLE_AGENTS: AgentListItem[];