@elaraai/east-ui-components 0.0.1-beta.4 → 0.0.1-beta.5
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/README.md +2 -1
- package/dist/component.d.ts.map +1 -1
- package/dist/index.cjs +163 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +165 -3
- package/dist/index.js.map +1 -1
- package/dist/typography/code/index.d.ts +22 -0
- package/dist/typography/code/index.d.ts.map +1 -0
- package/dist/typography/code-block/index.d.ts +35 -0
- package/dist/typography/code-block/index.d.ts.map +1 -0
- package/dist/typography/heading/index.d.ts +22 -0
- package/dist/typography/heading/index.d.ts.map +1 -0
- package/dist/typography/highlight/index.d.ts +27 -0
- package/dist/typography/highlight/index.d.ts.map +1 -0
- package/dist/typography/index.d.ts +7 -0
- package/dist/typography/index.d.ts.map +1 -1
- package/dist/typography/link/index.d.ts +22 -0
- package/dist/typography/link/index.d.ts.map +1 -0
- package/dist/typography/list/index.d.ts +22 -0
- package/dist/typography/list/index.d.ts.map +1 -0
- package/dist/typography/mark/index.d.ts +22 -0
- package/dist/typography/mark/index.d.ts.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ All East UI components are supported:
|
|
|
90
90
|
| Category | Components |
|
|
91
91
|
|----------|------------|
|
|
92
92
|
| **Layout** | Box, Stack, HStack, VStack, Grid, Splitter, Separator |
|
|
93
|
-
| **Typography** | Text |
|
|
93
|
+
| **Typography** | Text, Code, Heading, Link, Highlight, Mark, List, CodeBlock |
|
|
94
94
|
| **Buttons** | Button, IconButton |
|
|
95
95
|
| **Forms** | Input (String, Integer, Float, DateTime), Select, Checkbox, Switch, Slider, Textarea, TagsInput, FileUpload, Field, Fieldset |
|
|
96
96
|
| **Collections** | Table, DataList, TreeView |
|
|
@@ -117,6 +117,7 @@ Dual-licensed:
|
|
|
117
117
|
|
|
118
118
|
## Links
|
|
119
119
|
|
|
120
|
+
- **Live Showcase**: [https://elaraai.github.io/east-ui/](https://elaraai.github.io/east-ui/)
|
|
120
121
|
- **Website**: [https://elaraai.com/](https://elaraai.com/)
|
|
121
122
|
- **East UI**: [https://www.npmjs.com/package/@elaraai/east-ui](https://www.npmjs.com/package/@elaraai/east-ui)
|
|
122
123
|
- **East Repository**: [https://github.com/elaraai/East](https://github.com/elaraai/East)
|
package/dist/component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAsEnD,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;CACvC;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gEAyF4B,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ const React = require("react");
|
|
|
8
8
|
const east = require("@elaraai/east");
|
|
9
9
|
const eastUi = require("@elaraai/east-ui");
|
|
10
10
|
const react = require("@chakra-ui/react");
|
|
11
|
+
const shiki = require("shiki");
|
|
11
12
|
const reactDom = require("react-dom");
|
|
12
13
|
function _interopNamespaceDefault(e3) {
|
|
13
14
|
const n2 = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -54,6 +55,160 @@ const EastChakraText = React.memo(function EastChakraText2({ value }) {
|
|
|
54
55
|
const props = React.useMemo(() => toChakraText(value), [value]);
|
|
55
56
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Text, { ...props, children: value.value });
|
|
56
57
|
}, (prev, next) => textEqual(prev.value, next.value));
|
|
58
|
+
const codeEqual = east.equalFor(eastUi.Code.Types.Code);
|
|
59
|
+
function toChakraCode(value) {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
return {
|
|
62
|
+
variant: (_a = getSomeorUndefined(value.variant)) == null ? void 0 : _a.type,
|
|
63
|
+
colorPalette: getSomeorUndefined(value.colorPalette),
|
|
64
|
+
size: (_b = getSomeorUndefined(value.size)) == null ? void 0 : _b.type
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const EastChakraCode = React.memo(function EastChakraCode2({ value }) {
|
|
68
|
+
const props = React.useMemo(() => toChakraCode(value), [value]);
|
|
69
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Code, { ...props, children: value.value });
|
|
70
|
+
}, (prev, next) => codeEqual(prev.value, next.value));
|
|
71
|
+
const headingEqual = east.equalFor(eastUi.Heading.Types.Heading);
|
|
72
|
+
function toChakraHeading(value) {
|
|
73
|
+
var _a, _b, _c;
|
|
74
|
+
return {
|
|
75
|
+
size: (_a = getSomeorUndefined(value.size)) == null ? void 0 : _a.type,
|
|
76
|
+
as: (_b = getSomeorUndefined(value.as)) == null ? void 0 : _b.type,
|
|
77
|
+
color: getSomeorUndefined(value.color),
|
|
78
|
+
textAlign: (_c = getSomeorUndefined(value.textAlign)) == null ? void 0 : _c.type
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const EastChakraHeading = React.memo(function EastChakraHeading2({ value }) {
|
|
82
|
+
const props = React.useMemo(() => toChakraHeading(value), [value]);
|
|
83
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Heading, { ...props, children: value.value });
|
|
84
|
+
}, (prev, next) => headingEqual(prev.value, next.value));
|
|
85
|
+
const linkEqual = east.equalFor(eastUi.Link.Types.Link);
|
|
86
|
+
function toChakraLink(value) {
|
|
87
|
+
var _a;
|
|
88
|
+
const external2 = getSomeorUndefined(value.external);
|
|
89
|
+
return {
|
|
90
|
+
href: value.href,
|
|
91
|
+
variant: (_a = getSomeorUndefined(value.variant)) == null ? void 0 : _a.type,
|
|
92
|
+
colorPalette: getSomeorUndefined(value.colorPalette),
|
|
93
|
+
...external2 ? { target: "_blank", rel: "noopener noreferrer" } : {}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const EastChakraLink = React.memo(function EastChakraLink2({ value }) {
|
|
97
|
+
const props = React.useMemo(() => toChakraLink(value), [value]);
|
|
98
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Link, { ...props, children: value.value });
|
|
99
|
+
}, (prev, next) => linkEqual(prev.value, next.value));
|
|
100
|
+
const highlightEqual = east.equalFor(eastUi.Highlight.Types.Highlight);
|
|
101
|
+
function toChakraHighlight(value) {
|
|
102
|
+
const color2 = getSomeorUndefined(value.color);
|
|
103
|
+
return {
|
|
104
|
+
query: value.query,
|
|
105
|
+
styles: color2 ? { bg: color2 } : void 0
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const EastChakraHighlight = React.memo(function EastChakraHighlight2({ value }) {
|
|
109
|
+
const props = React.useMemo(() => toChakraHighlight(value), [value]);
|
|
110
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Highlight, { query: props.query, styles: props.styles, children: value.value });
|
|
111
|
+
}, (prev, next) => highlightEqual(prev.value, next.value));
|
|
112
|
+
const markEqual = east.equalFor(eastUi.Mark.Types.Mark);
|
|
113
|
+
function toChakraMark(value) {
|
|
114
|
+
var _a;
|
|
115
|
+
return {
|
|
116
|
+
variant: (_a = getSomeorUndefined(value.variant)) == null ? void 0 : _a.type,
|
|
117
|
+
colorPalette: getSomeorUndefined(value.colorPalette)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const EastChakraMark = React.memo(function EastChakraMark2({ value }) {
|
|
121
|
+
const props = React.useMemo(() => toChakraMark(value), [value]);
|
|
122
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Mark, { ...props, children: value.value });
|
|
123
|
+
}, (prev, next) => markEqual(prev.value, next.value));
|
|
124
|
+
const listEqual = east.equalFor(eastUi.List.Types.List);
|
|
125
|
+
function toChakraList(value) {
|
|
126
|
+
var _a;
|
|
127
|
+
const variant = (_a = getSomeorUndefined(value.variant)) == null ? void 0 : _a.type;
|
|
128
|
+
return {
|
|
129
|
+
as: variant === "ordered" ? "ol" : "ul",
|
|
130
|
+
gap: getSomeorUndefined(value.gap),
|
|
131
|
+
colorPalette: getSomeorUndefined(value.colorPalette),
|
|
132
|
+
ps: "5"
|
|
133
|
+
// Padding-start for bullet/number markers
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const EastChakraList = React.memo(function EastChakraList2({ value }) {
|
|
137
|
+
const props = React.useMemo(() => toChakraList(value), [value]);
|
|
138
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.List.Root, { ...props, children: value.items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(react.List.Item, { children: item }, index)) });
|
|
139
|
+
}, (prev, next) => listEqual(prev.value, next.value));
|
|
140
|
+
const codeBlockEqual = east.equalFor(eastUi.CodeBlock.Types.CodeBlock);
|
|
141
|
+
let highlighterPromise = null;
|
|
142
|
+
function getHighlighter() {
|
|
143
|
+
if (!highlighterPromise) {
|
|
144
|
+
highlighterPromise = shiki.createHighlighter({
|
|
145
|
+
langs: [
|
|
146
|
+
"typescript",
|
|
147
|
+
"javascript",
|
|
148
|
+
"json",
|
|
149
|
+
"html",
|
|
150
|
+
"css",
|
|
151
|
+
"python",
|
|
152
|
+
"rust",
|
|
153
|
+
"go",
|
|
154
|
+
"sql",
|
|
155
|
+
"bash",
|
|
156
|
+
"markdown",
|
|
157
|
+
"yaml",
|
|
158
|
+
"xml"
|
|
159
|
+
],
|
|
160
|
+
themes: ["github-dark"]
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return highlighterPromise;
|
|
164
|
+
}
|
|
165
|
+
const shikiAdapter = react.createShikiAdapter({
|
|
166
|
+
load: getHighlighter,
|
|
167
|
+
theme: "github-dark"
|
|
168
|
+
});
|
|
169
|
+
function toCodeBlockProps(value) {
|
|
170
|
+
const languageVariant = getSomeorUndefined(value.language);
|
|
171
|
+
const language = languageVariant == null ? void 0 : languageVariant.type;
|
|
172
|
+
const highlightLinesBigint = getSomeorUndefined(value.highlightLines);
|
|
173
|
+
const highlightLines = highlightLinesBigint == null ? void 0 : highlightLinesBigint.map((n2) => Number(n2));
|
|
174
|
+
return {
|
|
175
|
+
language,
|
|
176
|
+
showLineNumbers: getSomeorUndefined(value.showLineNumbers),
|
|
177
|
+
highlightLines,
|
|
178
|
+
maxHeight: getSomeorUndefined(value.maxHeight),
|
|
179
|
+
showCopyButton: getSomeorUndefined(value.showCopyButton),
|
|
180
|
+
title: getSomeorUndefined(value.title)
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const EastChakraCodeBlock = React.memo(function EastChakraCodeBlock2({ value }) {
|
|
184
|
+
const props = React.useMemo(() => toCodeBlockProps(value), [value]);
|
|
185
|
+
const meta = React.useMemo(() => {
|
|
186
|
+
const result = {};
|
|
187
|
+
if (props.showLineNumbers !== void 0) {
|
|
188
|
+
result.showLineNumbers = props.showLineNumbers;
|
|
189
|
+
}
|
|
190
|
+
if (props.highlightLines !== void 0) {
|
|
191
|
+
result.highlightLines = props.highlightLines;
|
|
192
|
+
}
|
|
193
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
194
|
+
}, [props.showLineNumbers, props.highlightLines]);
|
|
195
|
+
const showHeader = props.title || props.showCopyButton;
|
|
196
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.CodeBlock.AdapterProvider, { value: shikiAdapter, children: /* @__PURE__ */ jsxRuntime.jsx(react.Box, { maxHeight: props.maxHeight, overflow: "auto", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
197
|
+
react.CodeBlock.Root,
|
|
198
|
+
{
|
|
199
|
+
code: value.code,
|
|
200
|
+
language: props.language,
|
|
201
|
+
meta,
|
|
202
|
+
children: [
|
|
203
|
+
showHeader && /* @__PURE__ */ jsxRuntime.jsxs(react.CodeBlock.Header, { children: [
|
|
204
|
+
props.title && /* @__PURE__ */ jsxRuntime.jsx(react.CodeBlock.Title, { children: props.title }),
|
|
205
|
+
props.showCopyButton && /* @__PURE__ */ jsxRuntime.jsx(react.CodeBlock.CopyTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.IconButton, { variant: "ghost", size: "2xs", children: /* @__PURE__ */ jsxRuntime.jsx(react.CodeBlock.CopyIndicator, {}) }) })
|
|
206
|
+
] }),
|
|
207
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.CodeBlock.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(react.CodeBlock.Code, { children: /* @__PURE__ */ jsxRuntime.jsx(react.CodeBlock.CodeText, {}) }) })
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
) }) });
|
|
211
|
+
}, (prev, next) => codeBlockEqual(prev.value, next.value));
|
|
57
212
|
const buttonEqual = east.equalFor(eastUi.Button.Types.Button);
|
|
58
213
|
function toChakraButton(value) {
|
|
59
214
|
var _a, _b, _c;
|
|
@@ -55190,7 +55345,7 @@ const EastChakraHoverCard = React.memo(function EastChakraHoverCard2({ value })
|
|
|
55190
55345
|
closeDelay,
|
|
55191
55346
|
children: [
|
|
55192
55347
|
/* @__PURE__ */ jsxRuntime.jsx(react.HoverCard.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: /* @__PURE__ */ jsxRuntime.jsx(EastChakraComponent, { value: value.trigger }) }) }),
|
|
55193
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(react.HoverCard.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.HoverCard.Content, { children: [
|
|
55348
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(react.HoverCard.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.HoverCard.Content, { width: "fit-content", maxWidth: "unset", children: [
|
|
55194
55349
|
hasArrow && /* @__PURE__ */ jsxRuntime.jsx(react.HoverCard.Arrow, {}),
|
|
55195
55350
|
value.body.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraComponent, { value: child }, index))
|
|
55196
55351
|
] }) }) })
|
|
@@ -55328,6 +55483,13 @@ const EastChakraComponent = React.memo(function EastChakraComponent2({ value })
|
|
|
55328
55483
|
return east.match(value, {
|
|
55329
55484
|
// Typography
|
|
55330
55485
|
Text: (v2) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraText, { value: v2 }),
|
|
55486
|
+
Code: (v2) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraCode, { value: v2 }),
|
|
55487
|
+
Heading: (v2) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraHeading, { value: v2 }),
|
|
55488
|
+
Link: (v2) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraLink, { value: v2 }),
|
|
55489
|
+
Highlight: (v2) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraHighlight, { value: v2 }),
|
|
55490
|
+
Mark: (v2) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraMark, { value: v2 }),
|
|
55491
|
+
List: (v2) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraList, { value: v2 }),
|
|
55492
|
+
CodeBlock: (v2) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraCodeBlock, { value: v2 }),
|
|
55331
55493
|
// Buttons
|
|
55332
55494
|
Button: (v2) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraButton, { value: v2 }),
|
|
55333
55495
|
IconButton: (v2) => /* @__PURE__ */ jsxRuntime.jsx(EastChakraIconButton, { value: v2 }),
|