jarkup-ts 0.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.
@@ -0,0 +1,204 @@
1
+ export type InlineComponentMap = {
2
+ Text: Text;
3
+ Icon: Icon;
4
+ };
5
+ export type BlockComponentMap = {
6
+ Heading: Heading;
7
+ Paragraph: Paragraph;
8
+ ListItem: ListItem;
9
+ List: List;
10
+ BlockQuote: BlockQuote;
11
+ Callout: Callout;
12
+ Divider: Divider;
13
+ Toggle: Toggle;
14
+ Bookmark: Bookmark;
15
+ File: File;
16
+ Image: Image;
17
+ CodeBlock: CodeBlock;
18
+ Katex: Katex;
19
+ Table: Table;
20
+ TableRow: TableRow;
21
+ TableCell: TableCell;
22
+ };
23
+ export type ComponentMap = InlineComponentMap & BlockComponentMap;
24
+ export type InlineComponentType = keyof InlineComponentMap;
25
+ export type BlockComponentType = keyof BlockComponentMap;
26
+ export type ComponentType = keyof ComponentMap;
27
+ export type InlineComponent = InlineComponentMap[keyof InlineComponentMap];
28
+ export type BlockComponent = BlockComponentMap[keyof BlockComponentMap];
29
+ export type Component = ComponentMap[keyof ComponentMap];
30
+ export interface ComponentBase<T extends ComponentType = ComponentType, P = Record<any, any>> {
31
+ type: T;
32
+ props?: P;
33
+ slots?: Record<string, ComponentBase | ComponentBase[]>;
34
+ }
35
+ export interface InlineComponentBase<T extends InlineComponentType = InlineComponentType, P = Record<any, any>> extends ComponentBase<T, P> {
36
+ type: T;
37
+ props?: P;
38
+ slots?: undefined;
39
+ }
40
+ export interface BlockComponentBase<T extends BlockComponentType = BlockComponentType, P = Record<any, any>> extends ComponentBase<T, P> {
41
+ type: T;
42
+ props?: P;
43
+ slots?: Record<string, Component | Component[]>;
44
+ }
45
+ export interface Text extends InlineComponentBase<"Text"> {
46
+ type: "Text";
47
+ props: {
48
+ text: string;
49
+ color?: string;
50
+ backgroundColor?: string;
51
+ bold?: boolean;
52
+ italic?: boolean;
53
+ underline?: boolean;
54
+ strikethrough?: boolean;
55
+ katex?: boolean;
56
+ code?: boolean;
57
+ ruby?: string;
58
+ href?: string;
59
+ favicon?: string;
60
+ };
61
+ slots?: undefined;
62
+ }
63
+ export interface Icon extends InlineComponentBase<"Icon"> {
64
+ type: "Icon";
65
+ props: {
66
+ src: string;
67
+ alt?: string;
68
+ };
69
+ slots?: undefined;
70
+ }
71
+ export interface Heading extends BlockComponentBase<"Heading"> {
72
+ type: "Heading";
73
+ props: {
74
+ level: 1 | 2 | 3 | 4 | 5 | 6;
75
+ };
76
+ slots: {
77
+ default: InlineComponent[];
78
+ };
79
+ }
80
+ export interface Paragraph extends BlockComponentBase<"Paragraph"> {
81
+ type: "Paragraph";
82
+ props?: undefined;
83
+ slots: {
84
+ default: InlineComponent[];
85
+ };
86
+ }
87
+ export interface ListItem extends BlockComponentBase<"ListItem"> {
88
+ type: "ListItem";
89
+ props?: undefined;
90
+ slots: {
91
+ default: InlineComponent[];
92
+ };
93
+ }
94
+ export interface List extends BlockComponentBase<"List"> {
95
+ type: "List";
96
+ props?: {
97
+ listStyle?: "unordered" | "ordered";
98
+ };
99
+ slots: {
100
+ default: ListItem[];
101
+ };
102
+ }
103
+ export interface BlockQuote extends BlockComponentBase<"BlockQuote"> {
104
+ type: "BlockQuote";
105
+ props?: {
106
+ cite?: string;
107
+ };
108
+ slots: {
109
+ default: Component[];
110
+ };
111
+ }
112
+ export interface Callout extends BlockComponentBase<"Callout"> {
113
+ type: "Callout";
114
+ props?: {
115
+ type?: "note" | "tip" | "important" | "warning" | "caution";
116
+ };
117
+ slots: {
118
+ default: Component[];
119
+ };
120
+ }
121
+ export interface Divider extends BlockComponentBase<"Divider"> {
122
+ type: "Divider";
123
+ props?: undefined;
124
+ slots?: undefined;
125
+ }
126
+ export interface Toggle extends BlockComponentBase<"Toggle"> {
127
+ type: "Toggle";
128
+ props?: undefined;
129
+ slots: {
130
+ default: Component[];
131
+ summary: InlineComponent[];
132
+ };
133
+ }
134
+ export interface Bookmark extends BlockComponentBase<"Bookmark"> {
135
+ type: "Bookmark";
136
+ props: {
137
+ url: string;
138
+ title?: string;
139
+ description?: string;
140
+ image?: string;
141
+ };
142
+ slots?: undefined;
143
+ }
144
+ export interface File extends BlockComponentBase<"File"> {
145
+ type: "File";
146
+ props: {
147
+ src: string;
148
+ name?: string;
149
+ };
150
+ slots?: undefined;
151
+ }
152
+ export interface Image extends BlockComponentBase<"Image"> {
153
+ type: "Image";
154
+ props: {
155
+ src: string;
156
+ alt?: string;
157
+ };
158
+ slots?: undefined;
159
+ }
160
+ export interface CodeBlock extends BlockComponentBase<"CodeBlock"> {
161
+ type: "CodeBlock";
162
+ props: {
163
+ code: string;
164
+ language: string;
165
+ };
166
+ slots: {
167
+ default: InlineComponent[];
168
+ };
169
+ }
170
+ export interface Katex extends BlockComponentBase<"Katex"> {
171
+ type: "Katex";
172
+ props: {
173
+ expression: string;
174
+ };
175
+ slots?: undefined;
176
+ }
177
+ export interface Table extends BlockComponentBase<"Table"> {
178
+ type: "Table";
179
+ props?: {
180
+ hasColumnHeader?: boolean;
181
+ hasRowHeader?: boolean;
182
+ caption?: string;
183
+ };
184
+ slots: {
185
+ header?: TableRow[];
186
+ body: TableRow[];
187
+ };
188
+ }
189
+ export interface TableRow extends BlockComponentBase<"TableRow"> {
190
+ type: "TableRow";
191
+ props?: undefined;
192
+ slots: {
193
+ default: TableCell[];
194
+ };
195
+ }
196
+ export interface TableCell extends BlockComponentBase<"TableCell"> {
197
+ type: "TableCell";
198
+ props?: {
199
+ isHeader?: boolean;
200
+ };
201
+ slots: {
202
+ default: InlineComponent[];
203
+ };
204
+ }
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "jarkup-ts",
3
+ "version": "0.1.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "type": "module",
8
+ "author": "Chomolungma Shirayuki",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git@github.com:46ki75/jarkup.git"
12
+ },
13
+ "homepage": "https://github.com/46ki75/jarkup",
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts"
21
+ }
22
+ },
23
+ "devDependencies": {
24
+ "typescript": "^5.8.3"
25
+ },
26
+ "scripts": {
27
+ "build": "tsc"
28
+ }
29
+ }