@box-kite/react 2.0.0 → 2.1.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.
- package/.claude/rules/box-kite-rules.md +16 -0
- package/.claude/skills/box-kite/SKILL.md +16 -0
- package/.claude/skills/box-kite/references/components.md +8 -3
- package/.claude/skills/box-kite/references/patterns.md +23 -0
- package/.cursor/rules/box-kite.mdc +16 -0
- package/AGENTS.md +19 -0
- package/BOX_AI_CONTEXT.md +562 -1
- package/BOX_KITE_AI_CONTEXT.md +562 -1
- package/README.md +39 -7
- package/catalog.cjs +1 -0
- package/catalog.d.ts +8 -0
- package/catalog.mjs +2333 -0
- package/client.cjs +1 -1
- package/client.mjs +40 -42
- package/components/agent.cjs +1 -0
- package/components/agent.d.ts +215 -0
- package/components/agent.mjs +405 -0
- package/components/chart.d.ts +1 -0
- package/components/dashboard.cjs +1 -0
- package/components/dashboard.d.ts +121 -0
- package/components/dashboard.mjs +690 -0
- package/components/dataGrid/components/dataGridBody.d.ts +2 -1
- package/components/dataGrid/components/dataGridDetailRow.d.ts +13 -2
- package/components/dataGrid/components/dataGridGroupRow.d.ts +13 -2
- package/components/dataGrid/components/dataGridRow.d.ts +13 -2
- package/components/dataGrid/contracts/dataGridContract.d.ts +66 -2
- package/components/dataGrid/models/cellModel.d.ts +3 -0
- package/components/dataGrid/models/editModel.d.ts +27 -0
- package/components/dataGrid/models/exportModel.d.ts +2 -1
- package/components/dataGrid/models/gridModel.d.ts +3 -0
- package/components/dataGrid/models/rangeModel.d.ts +119 -0
- package/components/dataGrid/models/viewportModel.d.ts +23 -2
- package/components/dataGrid/useGridNavigation.d.ts +10 -2
- package/components/dataGrid.cjs +4 -1
- package/components/dataGrid.d.ts +3 -0
- package/components/dataGrid.mjs +1056 -765
- package/components/markdown.cjs +1 -0
- package/components/markdown.d.ts +55 -0
- package/components/markdown.mjs +179 -0
- package/components/semantics.d.ts +29 -29
- package/components/skeleton.cjs +1 -0
- package/components/skeleton.d.ts +34 -0
- package/components/skeleton.mjs +25 -0
- package/dashboardSchema.cjs +1 -0
- package/dashboardSchema.mjs +78 -0
- package/docs/a11y.md +2 -3
- package/docs/catalog.md +451 -0
- package/docs/components.md +4 -0
- package/docs/index.md +3 -0
- package/docs/interop.md +237 -0
- package/docs/mcp.md +69 -0
- package/docs/props.md +3 -3
- package/interop.cjs +1 -0
- package/interop.d.ts +51 -0
- package/interop.mjs +454 -0
- package/mcp/src/data.d.ts +88 -0
- package/mcp/src/data.test.d.ts +1 -0
- package/mcp/src/engine.d.ts +23 -0
- package/mcp/src/index.d.ts +1 -0
- package/mcp/src/search.d.ts +26 -0
- package/mcp/src/search.test.d.ts +1 -0
- package/mcp/src/server.d.ts +18 -0
- package/mcp/src/server.test.d.ts +1 -0
- package/mcp/src/styles.d.ts +27 -0
- package/mcp/src/styles.test.d.ts +1 -0
- package/mcp/src/tools.d.ts +18 -0
- package/mcp/src/vocabulary.d.ts +41 -0
- package/package.json +124 -17
- package/react/spec/renderSpec.d.ts +51 -0
- package/react/spec/specBoundary.d.ts +25 -0
- package/react/spec/specRegistry.d.ts +42 -0
- package/react/spec/specRenderer.d.ts +10 -0
- package/registry/blocks/dashboard-shell/dashboard-shell.d.ts +22 -0
- package/registry/blocks/dashboard-shell/dashboard-stats.d.ts +13 -0
- package/registry/blocks/data-grid/invoice-rows.d.ts +15 -0
- package/registry/blocks/data-grid/invoices-grid.d.ts +1 -0
- package/registry/blocks/settings-form/settings-form.d.ts +17 -0
- package/spec.cjs +2 -0
- package/spec.d.ts +12 -0
- package/spec.mjs +382 -0
- package/specData.cjs +1 -0
- package/specData.mjs +69 -0
- package/specDefs.cjs +1 -0
- package/specDefs.mjs +33 -0
- package/specSchema.cjs +1 -0
- package/specSchema.mjs +88 -0
- package/utils/agent/agentUtils.d.ts +81 -0
- package/utils/catalog/catalogContracts.d.ts +19 -0
- package/utils/catalog/catalogManifest.d.ts +8 -0
- package/utils/dashboard/dashboardSchema.d.ts +18 -0
- package/utils/dashboard/dashboardUtils.d.ts +97 -0
- package/utils/interop/a2uiInterop.d.ts +82 -0
- package/utils/interop/assistantUiInterop.d.ts +34 -0
- package/utils/interop/toolInterop.d.ts +30 -0
- package/utils/spec/specData.d.ts +19 -0
- package/utils/spec/specDefs.d.ts +11 -0
- package/utils/spec/specProps.d.ts +15 -0
- package/utils/spec/specSchema.d.ts +23 -0
- package/utils/spec/specTypes.d.ts +71 -0
- package/utils/spec/specValidate.d.ts +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../rolldown-runtime.cjs"),t=require("./semantics.cjs");let n=require("react"),r=require("react/jsx-runtime"),i=require("@box-kite/react");i=e.t(i,1);function a(e){let t=/(?:^|\s)language-([\w+-]+)/.exec(e??``);return t?t[1]:``}var o=(e,t)=>function({children:n}){return(0,r.jsx)(e,{component:`markdown.heading`,variant:`level${t}`,children:n})};function s({children:e}){return(0,r.jsx)(t.P,{component:`markdown.paragraph`,children:e})}function c({children:e,href:n,title:i}){return(0,r.jsx)(t.Link,{component:`markdown.link`,props:{href:n,title:i,rel:`noreferrer`},children:e})}function l({children:e}){return(0,r.jsx)(t.Ul,{component:`markdown.list`,children:e})}function u({children:e,start:n}){return(0,r.jsx)(t.Ol,{component:`markdown.list`,variant:{ordered:!0},props:{start:n},children:e})}function d({children:e}){return(0,r.jsx)(t.Li,{component:`markdown.item`,children:e})}function f({children:e}){return(0,r.jsx)(i.default,{tag:`blockquote`,component:`markdown.quote`,children:e})}function p({children:e}){return(0,r.jsx)(i.default,{tag:`code`,component:`markdown.code`,children:e})}function m({children:e}){let t=(0,n.isValidElement)(e)?e.props:void 0,o=a(t?.className);return(0,r.jsxs)(i.default,{tag:`pre`,component:`markdown.codeBlock`,children:[o!==``&&(0,r.jsx)(i.default,{tag:`span`,component:`markdown.codeBlock.language`,children:o}),(0,r.jsx)(i.default,{tag:`code`,component:`markdown.codeBlock.code`,children:t?t.children:e})]})}function h(){return(0,r.jsx)(i.default,{tag:`hr`,component:`markdown.rule`})}function g({src:e,alt:n,title:i}){return(0,r.jsx)(t.Img,{component:`markdown.image`,props:{src:e,alt:n,title:i}})}function _({children:e}){return(0,r.jsx)(i.default,{component:`markdown.tableWrap`,children:(0,r.jsx)(i.default,{tag:`table`,component:`markdown.table`,children:e})})}var v=(e,t)=>function({children:n}){return(0,r.jsx)(i.default,{tag:e,display:t,children:n})};function y({children:e}){return(0,r.jsx)(i.default,{tag:`tr`,component:`markdown.row`,children:e})}var b=(e,t)=>function({children:n}){return(0,r.jsx)(i.default,{tag:e,component:`markdown.cell`,variant:{header:t},children:n})},x=e=>function({children:t}){return(0,r.jsx)(i.default,{tag:e,component:`markdown.inline`,variant:e===`del`?{struck:!0}:{strong:e===`strong`},children:t})};function S({checked:e}){return(0,r.jsx)(i.default,{tag:`input`,component:`markdown.checkbox`,disabled:!0,props:{type:`checkbox`,defaultChecked:e===!0}})}var C={h1:o(t.H1,1),h2:o(t.H2,2),h3:o(t.H3,3),h4:o(t.H4,4),h5:o(t.H5,5),h6:o(t.H6,6),p:s,a:c,ul:l,ol:u,li:d,blockquote:f,code:p,pre:m,hr:h,img:g,table:_,thead:v(`thead`,`table-header-group`),tbody:v(`tbody`,`table-row-group`),tr:y,th:b(`th`,!0),td:b(`td`,!1),strong:x(`strong`),em:x(`em`),del:x(`del`),input:S};exports.default=C,exports.markdownComponents=C;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Box Kite's half of a markdown renderer: the `components` map that `react-markdown`, `streamdown` and
|
|
4
|
+
* every other renderer built on that shape already takes, with the engine's own classes in it.
|
|
5
|
+
*
|
|
6
|
+
* The dependency is deliberately **not** taken. Streamdown — the hardened streaming renderer this would
|
|
7
|
+
* otherwise wrap — asks a project for a Tailwind `@source` line pointing into its `dist/` and for
|
|
8
|
+
* shadcn's design tokens in a global stylesheet, which is the one thing this library exists not to need;
|
|
9
|
+
* and a parser is a choice an app has usually already made. So what ships is the half that is ours, and
|
|
10
|
+
* it works with whichever renderer is already there.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* What a renderer hands one of these components. A superset of what any single node uses, which is what
|
|
14
|
+
* makes the map assignable to `react-markdown`'s own `Components` type without importing it.
|
|
15
|
+
*/
|
|
16
|
+
export interface MarkdownNodeProps {
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
/** A fenced block's `language-ts`, and nothing else the map reads. */
|
|
19
|
+
className?: string;
|
|
20
|
+
href?: string;
|
|
21
|
+
src?: string;
|
|
22
|
+
alt?: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
/** A task list's box. `null` is a list item that is not one. */
|
|
25
|
+
checked?: boolean | null;
|
|
26
|
+
/** Where an ordered list starts, when the source said. */
|
|
27
|
+
start?: number;
|
|
28
|
+
}
|
|
29
|
+
export type MarkdownComponents = Record<string, ComponentType<MarkdownNodeProps>>;
|
|
30
|
+
/**
|
|
31
|
+
* Markdown rendered with Box components — the map a renderer takes, so an agent's prose is themed,
|
|
32
|
+
* restylable and needs no stylesheet.
|
|
33
|
+
*
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import Markdown from 'react-markdown';
|
|
36
|
+
* import { markdownComponents } from '@box-kite/react/components/markdown';
|
|
37
|
+
*
|
|
38
|
+
* <Box component="markdown">
|
|
39
|
+
* <Markdown components={markdownComponents}>{message}</Markdown>
|
|
40
|
+
* </Box>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* **It is a constant, not a factory, and that matters while streaming.** A map built inside render is a
|
|
44
|
+
* new set of component *types* every token, and React unmounts and rebuilds the whole tree for each one.
|
|
45
|
+
* Override a node by spreading — `{ ...markdownComponents, h1: MyHeading }` — at module scope.
|
|
46
|
+
*
|
|
47
|
+
* **Whether a URL is safe is the renderer's**, not this map's: by the time a component is called the href
|
|
48
|
+
* has already been parsed, so `urlTransform` (react-markdown) or `defaultUrlTransform` (Streamdown) is
|
|
49
|
+
* where a `javascript:` link is refused. What is set here is `rel="noreferrer"`, which costs nothing.
|
|
50
|
+
*
|
|
51
|
+
* Wrapping the renderer in `<Box component="markdown">` is what gives the block its size and colour; the
|
|
52
|
+
* nodes inherit from it, so restyling the prose is one place.
|
|
53
|
+
*/
|
|
54
|
+
export declare const markdownComponents: MarkdownComponents;
|
|
55
|
+
export default markdownComponents;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { H1 as e, H2 as t, H3 as n, H4 as r, H5 as i, H6 as a, Img as o, Li as s, Link as c, Ol as l, P as u, Ul as d } from "./semantics.mjs";
|
|
2
|
+
import { isValidElement as f } from "react";
|
|
3
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
4
|
+
import h from "@box-kite/react";
|
|
5
|
+
//#region src/components/markdown.tsx
|
|
6
|
+
function g(e) {
|
|
7
|
+
let t = /(?:^|\s)language-([\w+-]+)/.exec(e ?? "");
|
|
8
|
+
return t ? t[1] : "";
|
|
9
|
+
}
|
|
10
|
+
var _ = (e, t) => function({ children: n }) {
|
|
11
|
+
return /* @__PURE__ */ p(e, {
|
|
12
|
+
component: "markdown.heading",
|
|
13
|
+
variant: `level${t}`,
|
|
14
|
+
children: n
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
function v({ children: e }) {
|
|
18
|
+
return /* @__PURE__ */ p(u, {
|
|
19
|
+
component: "markdown.paragraph",
|
|
20
|
+
children: e
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function y({ children: e, href: t, title: n }) {
|
|
24
|
+
return /* @__PURE__ */ p(c, {
|
|
25
|
+
component: "markdown.link",
|
|
26
|
+
props: {
|
|
27
|
+
href: t,
|
|
28
|
+
title: n,
|
|
29
|
+
rel: "noreferrer"
|
|
30
|
+
},
|
|
31
|
+
children: e
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function b({ children: e }) {
|
|
35
|
+
return /* @__PURE__ */ p(d, {
|
|
36
|
+
component: "markdown.list",
|
|
37
|
+
children: e
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function x({ children: e, start: t }) {
|
|
41
|
+
return /* @__PURE__ */ p(l, {
|
|
42
|
+
component: "markdown.list",
|
|
43
|
+
variant: { ordered: !0 },
|
|
44
|
+
props: { start: t },
|
|
45
|
+
children: e
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function S({ children: e }) {
|
|
49
|
+
return /* @__PURE__ */ p(s, {
|
|
50
|
+
component: "markdown.item",
|
|
51
|
+
children: e
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function C({ children: e }) {
|
|
55
|
+
return /* @__PURE__ */ p(h, {
|
|
56
|
+
tag: "blockquote",
|
|
57
|
+
component: "markdown.quote",
|
|
58
|
+
children: e
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function w({ children: e }) {
|
|
62
|
+
return /* @__PURE__ */ p(h, {
|
|
63
|
+
tag: "code",
|
|
64
|
+
component: "markdown.code",
|
|
65
|
+
children: e
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function T({ children: e }) {
|
|
69
|
+
let t = f(e) ? e.props : void 0, n = g(t?.className);
|
|
70
|
+
return /* @__PURE__ */ m(h, {
|
|
71
|
+
tag: "pre",
|
|
72
|
+
component: "markdown.codeBlock",
|
|
73
|
+
children: [n !== "" && /* @__PURE__ */ p(h, {
|
|
74
|
+
tag: "span",
|
|
75
|
+
component: "markdown.codeBlock.language",
|
|
76
|
+
children: n
|
|
77
|
+
}), /* @__PURE__ */ p(h, {
|
|
78
|
+
tag: "code",
|
|
79
|
+
component: "markdown.codeBlock.code",
|
|
80
|
+
children: t ? t.children : e
|
|
81
|
+
})]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function E() {
|
|
85
|
+
return /* @__PURE__ */ p(h, {
|
|
86
|
+
tag: "hr",
|
|
87
|
+
component: "markdown.rule"
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function D({ src: e, alt: t, title: n }) {
|
|
91
|
+
return /* @__PURE__ */ p(o, {
|
|
92
|
+
component: "markdown.image",
|
|
93
|
+
props: {
|
|
94
|
+
src: e,
|
|
95
|
+
alt: t,
|
|
96
|
+
title: n
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function O({ children: e }) {
|
|
101
|
+
return /* @__PURE__ */ p(h, {
|
|
102
|
+
component: "markdown.tableWrap",
|
|
103
|
+
children: /* @__PURE__ */ p(h, {
|
|
104
|
+
tag: "table",
|
|
105
|
+
component: "markdown.table",
|
|
106
|
+
children: e
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
var k = (e, t) => function({ children: n }) {
|
|
111
|
+
return /* @__PURE__ */ p(h, {
|
|
112
|
+
tag: e,
|
|
113
|
+
display: t,
|
|
114
|
+
children: n
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
function A({ children: e }) {
|
|
118
|
+
return /* @__PURE__ */ p(h, {
|
|
119
|
+
tag: "tr",
|
|
120
|
+
component: "markdown.row",
|
|
121
|
+
children: e
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
var j = (e, t) => function({ children: n }) {
|
|
125
|
+
return /* @__PURE__ */ p(h, {
|
|
126
|
+
tag: e,
|
|
127
|
+
component: "markdown.cell",
|
|
128
|
+
variant: { header: t },
|
|
129
|
+
children: n
|
|
130
|
+
});
|
|
131
|
+
}, M = (e) => function({ children: t }) {
|
|
132
|
+
return /* @__PURE__ */ p(h, {
|
|
133
|
+
tag: e,
|
|
134
|
+
component: "markdown.inline",
|
|
135
|
+
variant: e === "del" ? { struck: !0 } : { strong: e === "strong" },
|
|
136
|
+
children: t
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
function N({ checked: e }) {
|
|
140
|
+
return /* @__PURE__ */ p(h, {
|
|
141
|
+
tag: "input",
|
|
142
|
+
component: "markdown.checkbox",
|
|
143
|
+
disabled: !0,
|
|
144
|
+
props: {
|
|
145
|
+
type: "checkbox",
|
|
146
|
+
defaultChecked: e === !0
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
var P = {
|
|
151
|
+
h1: _(e, 1),
|
|
152
|
+
h2: _(t, 2),
|
|
153
|
+
h3: _(n, 3),
|
|
154
|
+
h4: _(r, 4),
|
|
155
|
+
h5: _(i, 5),
|
|
156
|
+
h6: _(a, 6),
|
|
157
|
+
p: v,
|
|
158
|
+
a: y,
|
|
159
|
+
ul: b,
|
|
160
|
+
ol: x,
|
|
161
|
+
li: S,
|
|
162
|
+
blockquote: C,
|
|
163
|
+
code: w,
|
|
164
|
+
pre: T,
|
|
165
|
+
hr: E,
|
|
166
|
+
img: D,
|
|
167
|
+
table: O,
|
|
168
|
+
thead: k("thead", "table-header-group"),
|
|
169
|
+
tbody: k("tbody", "table-row-group"),
|
|
170
|
+
tr: A,
|
|
171
|
+
th: j("th", !0),
|
|
172
|
+
td: j("td", !1),
|
|
173
|
+
strong: M("strong"),
|
|
174
|
+
em: M("em"),
|
|
175
|
+
del: M("del"),
|
|
176
|
+
input: N
|
|
177
|
+
};
|
|
178
|
+
//#endregion
|
|
179
|
+
export { P as default, P as markdownComponents };
|