@elaraai/east-ui 0.0.1-beta.4 → 0.0.1-beta.6
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 +3 -2
- package/dist/src/collections/gantt/index.d.ts +515 -0
- package/dist/src/collections/gantt/index.d.ts.map +1 -1
- package/dist/src/collections/table/index.d.ts +412 -0
- package/dist/src/collections/table/index.d.ts.map +1 -1
- package/dist/src/component.d.ts +103 -0
- package/dist/src/component.d.ts.map +1 -1
- package/dist/src/component.js +15 -1
- package/dist/src/component.js.map +1 -1
- package/dist/src/container/card/index.d.ts +206 -0
- package/dist/src/container/card/index.d.ts.map +1 -1
- package/dist/src/disclosure/accordion/index.d.ts +412 -0
- package/dist/src/disclosure/accordion/index.d.ts.map +1 -1
- package/dist/src/disclosure/carousel/index.d.ts +206 -0
- package/dist/src/disclosure/carousel/index.d.ts.map +1 -1
- package/dist/src/disclosure/tabs/index.d.ts +412 -0
- package/dist/src/disclosure/tabs/index.d.ts.map +1 -1
- package/dist/src/forms/field/index.d.ts +206 -0
- package/dist/src/forms/field/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/layout/box/index.d.ts +206 -0
- package/dist/src/layout/box/index.d.ts.map +1 -1
- package/dist/src/layout/grid/index.d.ts +412 -0
- package/dist/src/layout/grid/index.d.ts.map +1 -1
- package/dist/src/layout/splitter/index.d.ts +412 -0
- package/dist/src/layout/splitter/index.d.ts.map +1 -1
- package/dist/src/layout/stack/index.d.ts +206 -0
- package/dist/src/layout/stack/index.d.ts.map +1 -1
- package/dist/src/overlays/dialog/index.d.ts +412 -0
- package/dist/src/overlays/dialog/index.d.ts.map +1 -1
- package/dist/src/overlays/drawer/index.d.ts +412 -0
- package/dist/src/overlays/drawer/index.d.ts.map +1 -1
- package/dist/src/overlays/hover-card/index.d.ts +412 -0
- package/dist/src/overlays/hover-card/index.d.ts.map +1 -1
- package/dist/src/overlays/menu/index.d.ts +206 -0
- package/dist/src/overlays/menu/index.d.ts.map +1 -1
- package/dist/src/overlays/popover/index.d.ts +412 -0
- package/dist/src/overlays/popover/index.d.ts.map +1 -1
- package/dist/src/overlays/toggle-tip/index.d.ts +206 -0
- package/dist/src/overlays/toggle-tip/index.d.ts.map +1 -1
- package/dist/src/overlays/tooltip/index.d.ts +206 -0
- package/dist/src/overlays/tooltip/index.d.ts.map +1 -1
- package/dist/src/typography/code/index.d.ts +61 -0
- package/dist/src/typography/code/index.d.ts.map +1 -0
- package/dist/src/typography/code/index.js +65 -0
- package/dist/src/typography/code/index.js.map +1 -0
- package/dist/src/typography/code/types.d.ts +56 -0
- package/dist/src/typography/code/types.d.ts.map +1 -0
- package/dist/src/typography/code/types.js +39 -0
- package/dist/src/typography/code/types.js.map +1 -0
- package/dist/src/typography/code-block/index.d.ts +86 -0
- package/dist/src/typography/code-block/index.d.ts.map +1 -0
- package/dist/src/typography/code-block/index.js +78 -0
- package/dist/src/typography/code-block/index.js.map +1 -0
- package/dist/src/typography/code-block/types.d.ts +100 -0
- package/dist/src/typography/code-block/types.d.ts.map +1 -0
- package/dist/src/typography/code-block/types.js +70 -0
- package/dist/src/typography/code-block/types.js.map +1 -0
- package/dist/src/typography/heading/index.d.ts +92 -0
- package/dist/src/typography/heading/index.d.ts.map +1 -0
- package/dist/src/typography/heading/index.js +73 -0
- package/dist/src/typography/heading/index.js.map +1 -0
- package/dist/src/typography/heading/types.d.ts +108 -0
- package/dist/src/typography/heading/types.d.ts.map +1 -0
- package/dist/src/typography/heading/types.js +76 -0
- package/dist/src/typography/heading/types.js.map +1 -0
- package/dist/src/typography/highlight/index.d.ts +48 -0
- package/dist/src/typography/highlight/index.d.ts.map +1 -0
- package/dist/src/typography/highlight/index.js +60 -0
- package/dist/src/typography/highlight/index.js.map +1 -0
- package/dist/src/typography/highlight/types.d.ts +26 -0
- package/dist/src/typography/highlight/types.d.ts.map +1 -0
- package/dist/src/typography/highlight/types.js +21 -0
- package/dist/src/typography/highlight/types.js.map +1 -0
- package/dist/src/typography/index.d.ts +16 -159
- package/dist/src/typography/index.d.ts.map +1 -1
- package/dist/src/typography/index.js +24 -167
- package/dist/src/typography/index.js.map +1 -1
- package/dist/src/typography/link/index.d.ts +56 -0
- package/dist/src/typography/link/index.d.ts.map +1 -0
- package/dist/src/typography/link/index.js +66 -0
- package/dist/src/typography/link/index.js.map +1 -0
- package/dist/src/typography/link/types.d.ts +49 -0
- package/dist/src/typography/link/types.d.ts.map +1 -0
- package/dist/src/typography/link/types.js +38 -0
- package/dist/src/typography/link/types.js.map +1 -0
- package/dist/src/typography/list/index.d.ts +59 -0
- package/dist/src/typography/list/index.d.ts.map +1 -0
- package/dist/src/typography/list/index.js +61 -0
- package/dist/src/typography/list/index.js.map +1 -0
- package/dist/src/typography/list/types.d.ts +47 -0
- package/dist/src/typography/list/types.d.ts.map +1 -0
- package/dist/src/typography/list/types.js +36 -0
- package/dist/src/typography/list/types.js.map +1 -0
- package/dist/src/typography/mark/index.d.ts +57 -0
- package/dist/src/typography/mark/index.d.ts.map +1 -0
- package/dist/src/typography/mark/index.js +58 -0
- package/dist/src/typography/mark/index.js.map +1 -0
- package/dist/src/typography/mark/types.d.ts +49 -0
- package/dist/src/typography/mark/types.d.ts.map +1 -0
- package/dist/src/typography/mark/types.js +38 -0
- package/dist/src/typography/mark/types.js.map +1 -0
- package/dist/src/typography/text/index.d.ts +122 -0
- package/dist/src/typography/text/index.d.ts.map +1 -0
- package/dist/src/typography/text/index.js +130 -0
- package/dist/src/typography/text/index.js.map +1 -0
- package/dist/src/typography/{types.d.ts → text/types.d.ts} +2 -2
- package/dist/src/typography/text/types.d.ts.map +1 -0
- package/dist/src/typography/{types.js → text/types.js} +1 -1
- package/dist/src/typography/text/types.js.map +1 -0
- package/package.json +2 -2
- package/dist/src/typography/types.d.ts.map +0 -1
- package/dist/src/typography/types.js.map +0 -1
|
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CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;QAC7E,YAAY,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;QAC/F,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;KACvE,CAAC,EAAE,eAAe,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,eAAe;KAC3B;CACK,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { type SubtypeExprOrValue, OptionType, StringType, StructType, VariantType, NullType } from "@elaraai/east";
|
|
6
|
+
import { SizeType, type SizeLiteral } from "../../style.js";
|
|
7
|
+
/**
|
|
8
|
+
* Code variant type for different code display styles.
|
|
9
|
+
*
|
|
10
|
+
* @property subtle - Subtle background with colored text
|
|
11
|
+
* @property surface - Surface-level styling
|
|
12
|
+
* @property outline - Transparent background with colored border
|
|
13
|
+
*/
|
|
14
|
+
export declare const CodeVariantType: VariantType<{
|
|
15
|
+
subtle: NullType;
|
|
16
|
+
surface: NullType;
|
|
17
|
+
outline: NullType;
|
|
18
|
+
}>;
|
|
19
|
+
export type CodeVariantType = typeof CodeVariantType;
|
|
20
|
+
export type CodeVariantLiteral = "subtle" | "surface" | "outline";
|
|
21
|
+
/**
|
|
22
|
+
* The concrete East type for Code component data.
|
|
23
|
+
*
|
|
24
|
+
* @property value - The code text to display
|
|
25
|
+
* @property variant - Visual style variant
|
|
26
|
+
* @property colorPalette - Color scheme for the code
|
|
27
|
+
* @property size - Size of the code text
|
|
28
|
+
*/
|
|
29
|
+
export declare const CodeType: StructType<{
|
|
30
|
+
value: StringType;
|
|
31
|
+
variant: OptionType<VariantType<{
|
|
32
|
+
subtle: NullType;
|
|
33
|
+
surface: NullType;
|
|
34
|
+
outline: NullType;
|
|
35
|
+
}>>;
|
|
36
|
+
colorPalette: OptionType<StringType>;
|
|
37
|
+
size: OptionType<VariantType<{
|
|
38
|
+
xs: NullType;
|
|
39
|
+
sm: NullType;
|
|
40
|
+
md: NullType;
|
|
41
|
+
lg: NullType;
|
|
42
|
+
}>>;
|
|
43
|
+
}>;
|
|
44
|
+
export type CodeType = typeof CodeType;
|
|
45
|
+
/**
|
|
46
|
+
* Style configuration for Code components.
|
|
47
|
+
*/
|
|
48
|
+
export type CodeStyle = {
|
|
49
|
+
/** Visual style variant */
|
|
50
|
+
variant?: SubtypeExprOrValue<CodeVariantType> | CodeVariantLiteral;
|
|
51
|
+
/** Color palette (e.g., "gray", "blue") */
|
|
52
|
+
colorPalette?: SubtypeExprOrValue<StringType>;
|
|
53
|
+
/** Size of the code text */
|
|
54
|
+
size?: SubtypeExprOrValue<SizeType> | SizeLiteral;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/typography/code/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,KAAK,kBAAkB,EACvB,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAM5D;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;EAI1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC;AACrD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAMlE;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;EAKnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC;AAMvC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACpB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,GAAG,kBAAkB,CAAC;IACnE,2CAA2C;IAC3C,YAAY,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC9C,4BAA4B;IAC5B,IAAI,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC;CACrD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { OptionType, StringType, StructType, VariantType, NullType, } from "@elaraai/east";
|
|
6
|
+
import { SizeType } from "../../style.js";
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Code Variant Type
|
|
9
|
+
// ============================================================================
|
|
10
|
+
/**
|
|
11
|
+
* Code variant type for different code display styles.
|
|
12
|
+
*
|
|
13
|
+
* @property subtle - Subtle background with colored text
|
|
14
|
+
* @property surface - Surface-level styling
|
|
15
|
+
* @property outline - Transparent background with colored border
|
|
16
|
+
*/
|
|
17
|
+
export const CodeVariantType = VariantType({
|
|
18
|
+
subtle: NullType,
|
|
19
|
+
surface: NullType,
|
|
20
|
+
outline: NullType,
|
|
21
|
+
});
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Code Type
|
|
24
|
+
// ============================================================================
|
|
25
|
+
/**
|
|
26
|
+
* The concrete East type for Code component data.
|
|
27
|
+
*
|
|
28
|
+
* @property value - The code text to display
|
|
29
|
+
* @property variant - Visual style variant
|
|
30
|
+
* @property colorPalette - Color scheme for the code
|
|
31
|
+
* @property size - Size of the code text
|
|
32
|
+
*/
|
|
33
|
+
export const CodeType = StructType({
|
|
34
|
+
value: StringType,
|
|
35
|
+
variant: OptionType(CodeVariantType),
|
|
36
|
+
colorPalette: OptionType(StringType),
|
|
37
|
+
size: OptionType(SizeType),
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/typography/code/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,QAAQ,GACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAoB,MAAM,gBAAgB,CAAC;AAE5D,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;IACvC,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,QAAQ;CACpB,CAAC,CAAC;AAKH,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;IAC/B,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,UAAU,CAAC,eAAe,CAAC;IACpC,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC;IACpC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC;CAC7B,CAAC,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { type SubtypeExprOrValue, type ExprType, StringType } from "@elaraai/east";
|
|
6
|
+
import { UIComponentType } from "../../component.js";
|
|
7
|
+
import { type CodeBlockStyle } from "./types.js";
|
|
8
|
+
export { CodeBlockType, CodeLanguageType, type CodeBlockStyle, type CodeLanguage } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Creates a CodeBlock component for displaying code with syntax highlighting.
|
|
11
|
+
*
|
|
12
|
+
* @param code - The code content to display
|
|
13
|
+
* @param style - Optional styling configuration
|
|
14
|
+
* @returns An East expression representing the code block component
|
|
15
|
+
*/
|
|
16
|
+
declare function createCodeBlock(code: SubtypeExprOrValue<StringType>, style?: CodeBlockStyle): ExprType<UIComponentType>;
|
|
17
|
+
/**
|
|
18
|
+
* CodeBlock component for displaying code blocks with syntax highlighting.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Use `CodeBlock.Root(code, style)` to create code blocks with optional
|
|
22
|
+
* syntax highlighting, line numbers, and line highlighting.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { East } from "@elaraai/east";
|
|
27
|
+
* import { CodeBlock, UIComponentType } from "@elaraai/east-ui";
|
|
28
|
+
*
|
|
29
|
+
* const example = East.function([], UIComponentType, $ => {
|
|
30
|
+
* return CodeBlock.Root(
|
|
31
|
+
* `function hello() {\n console.log("Hello!");\n}`,
|
|
32
|
+
* {
|
|
33
|
+
* language: "typescript",
|
|
34
|
+
* showLineNumbers: true,
|
|
35
|
+
* highlightLines: [2],
|
|
36
|
+
* }
|
|
37
|
+
* );
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const CodeBlock: {
|
|
42
|
+
readonly Root: typeof createCodeBlock;
|
|
43
|
+
readonly Types: {
|
|
44
|
+
readonly CodeBlock: import("@elaraai/east").StructType<{
|
|
45
|
+
code: StringType;
|
|
46
|
+
language: import("@elaraai/east").OptionType<import("@elaraai/east").VariantType<{
|
|
47
|
+
typescript: import("@elaraai/east").NullType;
|
|
48
|
+
javascript: import("@elaraai/east").NullType;
|
|
49
|
+
json: import("@elaraai/east").NullType;
|
|
50
|
+
html: import("@elaraai/east").NullType;
|
|
51
|
+
css: import("@elaraai/east").NullType;
|
|
52
|
+
python: import("@elaraai/east").NullType;
|
|
53
|
+
rust: import("@elaraai/east").NullType;
|
|
54
|
+
go: import("@elaraai/east").NullType;
|
|
55
|
+
sql: import("@elaraai/east").NullType;
|
|
56
|
+
bash: import("@elaraai/east").NullType;
|
|
57
|
+
markdown: import("@elaraai/east").NullType;
|
|
58
|
+
yaml: import("@elaraai/east").NullType;
|
|
59
|
+
xml: import("@elaraai/east").NullType;
|
|
60
|
+
plaintext: import("@elaraai/east").NullType;
|
|
61
|
+
}>>;
|
|
62
|
+
showLineNumbers: import("@elaraai/east").OptionType<import("@elaraai/east").BooleanType>;
|
|
63
|
+
highlightLines: import("@elaraai/east").OptionType<import("@elaraai/east").ArrayType<import("@elaraai/east").IntegerType>>;
|
|
64
|
+
maxHeight: import("@elaraai/east").OptionType<StringType>;
|
|
65
|
+
showCopyButton: import("@elaraai/east").OptionType<import("@elaraai/east").BooleanType>;
|
|
66
|
+
title: import("@elaraai/east").OptionType<StringType>;
|
|
67
|
+
}>;
|
|
68
|
+
readonly Language: import("@elaraai/east").VariantType<{
|
|
69
|
+
typescript: import("@elaraai/east").NullType;
|
|
70
|
+
javascript: import("@elaraai/east").NullType;
|
|
71
|
+
json: import("@elaraai/east").NullType;
|
|
72
|
+
html: import("@elaraai/east").NullType;
|
|
73
|
+
css: import("@elaraai/east").NullType;
|
|
74
|
+
python: import("@elaraai/east").NullType;
|
|
75
|
+
rust: import("@elaraai/east").NullType;
|
|
76
|
+
go: import("@elaraai/east").NullType;
|
|
77
|
+
sql: import("@elaraai/east").NullType;
|
|
78
|
+
bash: import("@elaraai/east").NullType;
|
|
79
|
+
markdown: import("@elaraai/east").NullType;
|
|
80
|
+
yaml: import("@elaraai/east").NullType;
|
|
81
|
+
xml: import("@elaraai/east").NullType;
|
|
82
|
+
plaintext: import("@elaraai/east").NullType;
|
|
83
|
+
}>;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/typography/code-block/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EAEb,UAAU,EAEb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAmC,KAAK,cAAc,EAAqB,MAAM,YAAY,CAAC;AAGrG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAMrG;;;;;;GAMG;AACH,iBAAS,eAAe,CACpB,IAAI,EAAE,kBAAkB,CAAC,UAAU,CAAC,EACpC,KAAK,CAAC,EAAE,cAAc,GACvB,QAAQ,CAAC,eAAe,CAAC,CA6B3B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMZ,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { East, StringType, variant, } from "@elaraai/east";
|
|
6
|
+
import { UIComponentType } from "../../component.js";
|
|
7
|
+
import { CodeBlockType, CodeLanguageType } from "./types.js";
|
|
8
|
+
// Re-export types
|
|
9
|
+
export { CodeBlockType, CodeLanguageType } from "./types.js";
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// CodeBlock Component
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Creates a CodeBlock component for displaying code with syntax highlighting.
|
|
15
|
+
*
|
|
16
|
+
* @param code - The code content to display
|
|
17
|
+
* @param style - Optional styling configuration
|
|
18
|
+
* @returns An East expression representing the code block component
|
|
19
|
+
*/
|
|
20
|
+
function createCodeBlock(code, style) {
|
|
21
|
+
const showLineNumbersValue = style?.showLineNumbers !== undefined
|
|
22
|
+
? (typeof style.showLineNumbers === "boolean"
|
|
23
|
+
? style.showLineNumbers
|
|
24
|
+
: style.showLineNumbers)
|
|
25
|
+
: undefined;
|
|
26
|
+
const showCopyButtonValue = style?.showCopyButton !== undefined
|
|
27
|
+
? (typeof style.showCopyButton === "boolean"
|
|
28
|
+
? style.showCopyButton
|
|
29
|
+
: style.showCopyButton)
|
|
30
|
+
: undefined;
|
|
31
|
+
// Convert string language to variant
|
|
32
|
+
const languageValue = style?.language !== undefined
|
|
33
|
+
? (typeof style.language === "string"
|
|
34
|
+
? East.value(variant(style.language, null), CodeLanguageType)
|
|
35
|
+
: style.language)
|
|
36
|
+
: undefined;
|
|
37
|
+
return East.value(variant("CodeBlock", {
|
|
38
|
+
code: code,
|
|
39
|
+
language: languageValue !== undefined ? variant("some", languageValue) : variant("none", null),
|
|
40
|
+
showLineNumbers: showLineNumbersValue !== undefined ? variant("some", showLineNumbersValue) : variant("none", null),
|
|
41
|
+
highlightLines: style?.highlightLines ? variant("some", style.highlightLines) : variant("none", null),
|
|
42
|
+
maxHeight: style?.maxHeight ? variant("some", style.maxHeight) : variant("none", null),
|
|
43
|
+
showCopyButton: showCopyButtonValue !== undefined ? variant("some", showCopyButtonValue) : variant("none", null),
|
|
44
|
+
title: style?.title ? variant("some", style.title) : variant("none", null),
|
|
45
|
+
}), UIComponentType);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* CodeBlock component for displaying code blocks with syntax highlighting.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* Use `CodeBlock.Root(code, style)` to create code blocks with optional
|
|
52
|
+
* syntax highlighting, line numbers, and line highlighting.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { East } from "@elaraai/east";
|
|
57
|
+
* import { CodeBlock, UIComponentType } from "@elaraai/east-ui";
|
|
58
|
+
*
|
|
59
|
+
* const example = East.function([], UIComponentType, $ => {
|
|
60
|
+
* return CodeBlock.Root(
|
|
61
|
+
* `function hello() {\n console.log("Hello!");\n}`,
|
|
62
|
+
* {
|
|
63
|
+
* language: "typescript",
|
|
64
|
+
* showLineNumbers: true,
|
|
65
|
+
* highlightLines: [2],
|
|
66
|
+
* }
|
|
67
|
+
* );
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export const CodeBlock = {
|
|
72
|
+
Root: createCodeBlock,
|
|
73
|
+
Types: {
|
|
74
|
+
CodeBlock: CodeBlockType,
|
|
75
|
+
Language: CodeLanguageType,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/typography/code-block/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGH,IAAI,EACJ,UAAU,EACV,OAAO,GACV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAA0C,MAAM,YAAY,CAAC;AAErG,kBAAkB;AAClB,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAA0C,MAAM,YAAY,CAAC;AAErG,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E;;;;;;GAMG;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cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;QACrG,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;QACtF,cAAc,EAAE,mBAAmB,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;QAChH,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;KAC7E,CAAC,EAAE,eAAe,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE;QACH,SAAS,EAAE,aAAa;QACxB,QAAQ,EAAE,gBAAgB;KAC7B;CACK,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { type SubtypeExprOrValue, OptionType, StringType, StructType, BooleanType, ArrayType, IntegerType, VariantType, NullType } from "@elaraai/east";
|
|
6
|
+
/**
|
|
7
|
+
* Programming language variant type for syntax highlighting.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* These languages are pre-registered with the syntax highlighter.
|
|
11
|
+
* Create instances using `variant("typescript", null)` or the string shorthand.
|
|
12
|
+
*
|
|
13
|
+
* @property typescript - TypeScript language
|
|
14
|
+
* @property javascript - JavaScript language
|
|
15
|
+
* @property json - JSON format
|
|
16
|
+
* @property html - HTML markup
|
|
17
|
+
* @property css - CSS styles
|
|
18
|
+
* @property python - Python language
|
|
19
|
+
* @property rust - Rust language
|
|
20
|
+
* @property go - Go language
|
|
21
|
+
* @property sql - SQL queries
|
|
22
|
+
* @property bash - Bash/shell scripts
|
|
23
|
+
* @property markdown - Markdown text
|
|
24
|
+
* @property yaml - YAML configuration
|
|
25
|
+
* @property xml - XML markup
|
|
26
|
+
* @property plaintext - Plain text (no highlighting)
|
|
27
|
+
*/
|
|
28
|
+
export declare const CodeLanguageType: VariantType<{
|
|
29
|
+
typescript: NullType;
|
|
30
|
+
javascript: NullType;
|
|
31
|
+
json: NullType;
|
|
32
|
+
html: NullType;
|
|
33
|
+
css: NullType;
|
|
34
|
+
python: NullType;
|
|
35
|
+
rust: NullType;
|
|
36
|
+
go: NullType;
|
|
37
|
+
sql: NullType;
|
|
38
|
+
bash: NullType;
|
|
39
|
+
markdown: NullType;
|
|
40
|
+
yaml: NullType;
|
|
41
|
+
xml: NullType;
|
|
42
|
+
plaintext: NullType;
|
|
43
|
+
}>;
|
|
44
|
+
export type CodeLanguageType = typeof CodeLanguageType;
|
|
45
|
+
/** String literal union for language shortcuts */
|
|
46
|
+
export type CodeLanguage = "typescript" | "javascript" | "json" | "html" | "css" | "python" | "rust" | "go" | "sql" | "bash" | "markdown" | "yaml" | "xml" | "plaintext";
|
|
47
|
+
/**
|
|
48
|
+
* The concrete East type for CodeBlock component data.
|
|
49
|
+
*
|
|
50
|
+
* @property code - The code content to display
|
|
51
|
+
* @property language - Programming language for syntax highlighting
|
|
52
|
+
* @property showLineNumbers - Whether to show line numbers
|
|
53
|
+
* @property highlightLines - Line numbers to highlight
|
|
54
|
+
* @property maxHeight - Maximum height with scroll
|
|
55
|
+
* @property showCopyButton - Whether to show copy-to-clipboard button
|
|
56
|
+
* @property title - Optional title displayed in the header (e.g., filename)
|
|
57
|
+
*/
|
|
58
|
+
export declare const CodeBlockType: StructType<{
|
|
59
|
+
code: StringType;
|
|
60
|
+
language: OptionType<VariantType<{
|
|
61
|
+
typescript: NullType;
|
|
62
|
+
javascript: NullType;
|
|
63
|
+
json: NullType;
|
|
64
|
+
html: NullType;
|
|
65
|
+
css: NullType;
|
|
66
|
+
python: NullType;
|
|
67
|
+
rust: NullType;
|
|
68
|
+
go: NullType;
|
|
69
|
+
sql: NullType;
|
|
70
|
+
bash: NullType;
|
|
71
|
+
markdown: NullType;
|
|
72
|
+
yaml: NullType;
|
|
73
|
+
xml: NullType;
|
|
74
|
+
plaintext: NullType;
|
|
75
|
+
}>>;
|
|
76
|
+
showLineNumbers: OptionType<BooleanType>;
|
|
77
|
+
highlightLines: OptionType<ArrayType<IntegerType>>;
|
|
78
|
+
maxHeight: OptionType<StringType>;
|
|
79
|
+
showCopyButton: OptionType<BooleanType>;
|
|
80
|
+
title: OptionType<StringType>;
|
|
81
|
+
}>;
|
|
82
|
+
export type CodeBlockType = typeof CodeBlockType;
|
|
83
|
+
/**
|
|
84
|
+
* Style configuration for CodeBlock components.
|
|
85
|
+
*/
|
|
86
|
+
export type CodeBlockStyle = {
|
|
87
|
+
/** Programming language for syntax highlighting */
|
|
88
|
+
language?: SubtypeExprOrValue<CodeLanguageType> | CodeLanguage;
|
|
89
|
+
/** Whether to show line numbers */
|
|
90
|
+
showLineNumbers?: SubtypeExprOrValue<BooleanType> | boolean;
|
|
91
|
+
/** Line numbers to highlight */
|
|
92
|
+
highlightLines?: SubtypeExprOrValue<ArrayType<IntegerType>>;
|
|
93
|
+
/** Maximum height with scroll (e.g., "400px") */
|
|
94
|
+
maxHeight?: SubtypeExprOrValue<StringType>;
|
|
95
|
+
/** Whether to show copy-to-clipboard button */
|
|
96
|
+
showCopyButton?: SubtypeExprOrValue<BooleanType> | boolean;
|
|
97
|
+
/** Optional title displayed in the header (e.g., filename) */
|
|
98
|
+
title?: SubtypeExprOrValue<StringType>;
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/typography/code-block/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,KAAK,kBAAkB,EACvB,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,QAAQ,EACX,MAAM,eAAe,CAAC;AAMvB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAe3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC;AAEvD,kDAAkD;AAClD,MAAM,MAAM,YAAY,GAClB,YAAY,GACZ,YAAY,GACZ,MAAM,GACN,MAAM,GACN,KAAK,GACL,QAAQ,GACR,MAAM,GACN,IAAI,GACJ,KAAK,GACL,MAAM,GACN,UAAU,GACV,MAAM,GACN,KAAK,GACL,WAAW,CAAC;AAMlB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;EAQxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC;AAMjD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,YAAY,CAAC;IAC/D,mCAAmC;IACnC,eAAe,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC;IAC5D,gCAAgC;IAChC,cAAc,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5D,iDAAiD;IACjD,SAAS,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC3C,+CAA+C;IAC/C,cAAc,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC;IAC3D,8DAA8D;IAC9D,KAAK,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;CAC1C,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { OptionType, StringType, StructType, BooleanType, ArrayType, IntegerType, VariantType, NullType, } from "@elaraai/east";
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Language Type
|
|
8
|
+
// ============================================================================
|
|
9
|
+
/**
|
|
10
|
+
* Programming language variant type for syntax highlighting.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* These languages are pre-registered with the syntax highlighter.
|
|
14
|
+
* Create instances using `variant("typescript", null)` or the string shorthand.
|
|
15
|
+
*
|
|
16
|
+
* @property typescript - TypeScript language
|
|
17
|
+
* @property javascript - JavaScript language
|
|
18
|
+
* @property json - JSON format
|
|
19
|
+
* @property html - HTML markup
|
|
20
|
+
* @property css - CSS styles
|
|
21
|
+
* @property python - Python language
|
|
22
|
+
* @property rust - Rust language
|
|
23
|
+
* @property go - Go language
|
|
24
|
+
* @property sql - SQL queries
|
|
25
|
+
* @property bash - Bash/shell scripts
|
|
26
|
+
* @property markdown - Markdown text
|
|
27
|
+
* @property yaml - YAML configuration
|
|
28
|
+
* @property xml - XML markup
|
|
29
|
+
* @property plaintext - Plain text (no highlighting)
|
|
30
|
+
*/
|
|
31
|
+
export const CodeLanguageType = VariantType({
|
|
32
|
+
typescript: NullType,
|
|
33
|
+
javascript: NullType,
|
|
34
|
+
json: NullType,
|
|
35
|
+
html: NullType,
|
|
36
|
+
css: NullType,
|
|
37
|
+
python: NullType,
|
|
38
|
+
rust: NullType,
|
|
39
|
+
go: NullType,
|
|
40
|
+
sql: NullType,
|
|
41
|
+
bash: NullType,
|
|
42
|
+
markdown: NullType,
|
|
43
|
+
yaml: NullType,
|
|
44
|
+
xml: NullType,
|
|
45
|
+
plaintext: NullType,
|
|
46
|
+
});
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// CodeBlock Type
|
|
49
|
+
// ============================================================================
|
|
50
|
+
/**
|
|
51
|
+
* The concrete East type for CodeBlock component data.
|
|
52
|
+
*
|
|
53
|
+
* @property code - The code content to display
|
|
54
|
+
* @property language - Programming language for syntax highlighting
|
|
55
|
+
* @property showLineNumbers - Whether to show line numbers
|
|
56
|
+
* @property highlightLines - Line numbers to highlight
|
|
57
|
+
* @property maxHeight - Maximum height with scroll
|
|
58
|
+
* @property showCopyButton - Whether to show copy-to-clipboard button
|
|
59
|
+
* @property title - Optional title displayed in the header (e.g., filename)
|
|
60
|
+
*/
|
|
61
|
+
export const CodeBlockType = StructType({
|
|
62
|
+
code: StringType,
|
|
63
|
+
language: OptionType(CodeLanguageType),
|
|
64
|
+
showLineNumbers: OptionType(BooleanType),
|
|
65
|
+
highlightLines: OptionType(ArrayType(IntegerType)),
|
|
66
|
+
maxHeight: OptionType(StringType),
|
|
67
|
+
showCopyButton: OptionType(BooleanType),
|
|
68
|
+
title: OptionType(StringType),
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/typography/code-block/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEH,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,QAAQ,GACX,MAAM,eAAe,CAAC;AAEvB,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;IACxC,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,QAAQ;IACd,EAAE,EAAE,QAAQ;IACZ,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,QAAQ;IACb,SAAS,EAAE,QAAQ;CACtB,CAAC,CAAC;AAqBH,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACpC,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;IACtC,eAAe,EAAE,UAAU,CAAC,WAAW,CAAC;IACxC,cAAc,EAAE,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAClD,SAAS,EAAE,UAAU,CAAC,UAAU,CAAC;IACjC,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC;IACvC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC;CAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { type SubtypeExprOrValue, type ExprType, StringType } from "@elaraai/east";
|
|
6
|
+
import { UIComponentType } from "../../component.js";
|
|
7
|
+
import { type HeadingStyle } from "./types.js";
|
|
8
|
+
export { HeadingType, HeadingSizeType, HeadingAsType, type HeadingStyle } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Creates a Heading component for semantic headings.
|
|
11
|
+
*
|
|
12
|
+
* @param value - The heading text
|
|
13
|
+
* @param style - Optional styling configuration
|
|
14
|
+
* @returns An East expression representing the heading component
|
|
15
|
+
*/
|
|
16
|
+
declare function createHeading(value: SubtypeExprOrValue<StringType>, style?: HeadingStyle): ExprType<UIComponentType>;
|
|
17
|
+
/**
|
|
18
|
+
* Heading component for semantic HTML headings.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Use `Heading.Root(value, style)` to create headings with semantic HTML elements.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { East } from "@elaraai/east";
|
|
26
|
+
* import { Heading, UIComponentType } from "@elaraai/east-ui";
|
|
27
|
+
*
|
|
28
|
+
* const example = East.function([], UIComponentType, $ => {
|
|
29
|
+
* return Heading.Root("Welcome", {
|
|
30
|
+
* size: "2xl",
|
|
31
|
+
* as: "h1",
|
|
32
|
+
* color: "blue.600",
|
|
33
|
+
* });
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const Heading: {
|
|
38
|
+
readonly Root: typeof createHeading;
|
|
39
|
+
readonly Types: {
|
|
40
|
+
readonly Heading: import("@elaraai/east").StructType<{
|
|
41
|
+
value: StringType;
|
|
42
|
+
size: import("@elaraai/east").OptionType<import("@elaraai/east").VariantType<{
|
|
43
|
+
xs: import("@elaraai/east").NullType;
|
|
44
|
+
sm: import("@elaraai/east").NullType;
|
|
45
|
+
md: import("@elaraai/east").NullType;
|
|
46
|
+
lg: import("@elaraai/east").NullType;
|
|
47
|
+
xl: import("@elaraai/east").NullType;
|
|
48
|
+
"2xl": import("@elaraai/east").NullType;
|
|
49
|
+
"3xl": import("@elaraai/east").NullType;
|
|
50
|
+
"4xl": import("@elaraai/east").NullType;
|
|
51
|
+
"5xl": import("@elaraai/east").NullType;
|
|
52
|
+
"6xl": import("@elaraai/east").NullType;
|
|
53
|
+
}>>;
|
|
54
|
+
as: import("@elaraai/east").OptionType<import("@elaraai/east").VariantType<{
|
|
55
|
+
h1: import("@elaraai/east").NullType;
|
|
56
|
+
h2: import("@elaraai/east").NullType;
|
|
57
|
+
h3: import("@elaraai/east").NullType;
|
|
58
|
+
h4: import("@elaraai/east").NullType;
|
|
59
|
+
h5: import("@elaraai/east").NullType;
|
|
60
|
+
h6: import("@elaraai/east").NullType;
|
|
61
|
+
}>>;
|
|
62
|
+
color: import("@elaraai/east").OptionType<StringType>;
|
|
63
|
+
textAlign: import("@elaraai/east").OptionType<import("@elaraai/east").VariantType<{
|
|
64
|
+
left: import("@elaraai/east").NullType;
|
|
65
|
+
center: import("@elaraai/east").NullType;
|
|
66
|
+
right: import("@elaraai/east").NullType;
|
|
67
|
+
justify: import("@elaraai/east").NullType;
|
|
68
|
+
}>>;
|
|
69
|
+
}>;
|
|
70
|
+
readonly Size: import("@elaraai/east").VariantType<{
|
|
71
|
+
xs: import("@elaraai/east").NullType;
|
|
72
|
+
sm: import("@elaraai/east").NullType;
|
|
73
|
+
md: import("@elaraai/east").NullType;
|
|
74
|
+
lg: import("@elaraai/east").NullType;
|
|
75
|
+
xl: import("@elaraai/east").NullType;
|
|
76
|
+
"2xl": import("@elaraai/east").NullType;
|
|
77
|
+
"3xl": import("@elaraai/east").NullType;
|
|
78
|
+
"4xl": import("@elaraai/east").NullType;
|
|
79
|
+
"5xl": import("@elaraai/east").NullType;
|
|
80
|
+
"6xl": import("@elaraai/east").NullType;
|
|
81
|
+
}>;
|
|
82
|
+
readonly As: import("@elaraai/east").VariantType<{
|
|
83
|
+
h1: import("@elaraai/east").NullType;
|
|
84
|
+
h2: import("@elaraai/east").NullType;
|
|
85
|
+
h3: import("@elaraai/east").NullType;
|
|
86
|
+
h4: import("@elaraai/east").NullType;
|
|
87
|
+
h5: import("@elaraai/east").NullType;
|
|
88
|
+
h6: import("@elaraai/east").NullType;
|
|
89
|
+
}>;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/typography/heading/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EAEb,UAAU,EAEb,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAA+C,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAG5F,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAM5F;;;;;;GAMG;AACH,iBAAS,aAAa,CAClB,KAAK,EAAE,kBAAkB,CAAC,UAAU,CAAC,EACrC,KAAK,CAAC,EAAE,YAAY,GACrB,QAAQ,CAAC,eAAe,CAAC,CA0B3B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOV,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { East, StringType, variant, } from "@elaraai/east";
|
|
6
|
+
import { TextAlignType } from "../../style.js";
|
|
7
|
+
import { UIComponentType } from "../../component.js";
|
|
8
|
+
import { HeadingType, HeadingSizeType, HeadingAsType } from "./types.js";
|
|
9
|
+
// Re-export types
|
|
10
|
+
export { HeadingType, HeadingSizeType, HeadingAsType } from "./types.js";
|
|
11
|
+
// ============================================================================
|
|
12
|
+
// Heading Component
|
|
13
|
+
// ============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Creates a Heading component for semantic headings.
|
|
16
|
+
*
|
|
17
|
+
* @param value - The heading text
|
|
18
|
+
* @param style - Optional styling configuration
|
|
19
|
+
* @returns An East expression representing the heading component
|
|
20
|
+
*/
|
|
21
|
+
function createHeading(value, style) {
|
|
22
|
+
const sizeValue = style?.size
|
|
23
|
+
? (typeof style.size === "string"
|
|
24
|
+
? East.value(variant(style.size, null), HeadingSizeType)
|
|
25
|
+
: style.size)
|
|
26
|
+
: undefined;
|
|
27
|
+
const asValue = style?.as
|
|
28
|
+
? (typeof style.as === "string"
|
|
29
|
+
? East.value(variant(style.as, null), HeadingAsType)
|
|
30
|
+
: style.as)
|
|
31
|
+
: undefined;
|
|
32
|
+
const textAlignValue = style?.textAlign
|
|
33
|
+
? (typeof style.textAlign === "string"
|
|
34
|
+
? East.value(variant(style.textAlign, null), TextAlignType)
|
|
35
|
+
: style.textAlign)
|
|
36
|
+
: undefined;
|
|
37
|
+
return East.value(variant("Heading", {
|
|
38
|
+
value: value,
|
|
39
|
+
size: sizeValue ? variant("some", sizeValue) : variant("none", null),
|
|
40
|
+
as: asValue ? variant("some", asValue) : variant("none", null),
|
|
41
|
+
color: style?.color ? variant("some", style.color) : variant("none", null),
|
|
42
|
+
textAlign: textAlignValue ? variant("some", textAlignValue) : variant("none", null),
|
|
43
|
+
}), UIComponentType);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Heading component for semantic HTML headings.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* Use `Heading.Root(value, style)` to create headings with semantic HTML elements.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { East } from "@elaraai/east";
|
|
54
|
+
* import { Heading, UIComponentType } from "@elaraai/east-ui";
|
|
55
|
+
*
|
|
56
|
+
* const example = East.function([], UIComponentType, $ => {
|
|
57
|
+
* return Heading.Root("Welcome", {
|
|
58
|
+
* size: "2xl",
|
|
59
|
+
* as: "h1",
|
|
60
|
+
* color: "blue.600",
|
|
61
|
+
* });
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export const Heading = {
|
|
66
|
+
Root: createHeading,
|
|
67
|
+
Types: {
|
|
68
|
+
Heading: HeadingType,
|
|
69
|
+
Size: HeadingSizeType,
|
|
70
|
+
As: HeadingAsType,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/typography/heading/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGH,IAAI,EACJ,UAAU,EACV,OAAO,GACV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAqB,MAAM,YAAY,CAAC;AAE5F,kBAAkB;AAClB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAqB,MAAM,YAAY,CAAC;AAE5F,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;;;;GAMG;AACH,SAAS,aAAa,CAClB,KAAqC,EACrC,KAAoB;IAEpB,MAAM,SAAS,GAAG,KAAK,EAAE,IAAI;QACzB,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,eAAe,CAAC;YACxD,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QACjB,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,OAAO,GAAG,KAAK,EAAE,EAAE;QACrB,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ;YAC3B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,aAAa,CAAC;YACpD,C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