@lvl99dotcom/edaha-editor 0.0.0-stage → 0.3.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/LICENSE +201 -0
- package/README.md +13 -2
- package/dist/client/assets/index-BwcJ6yrI.js +1578 -0
- package/dist/client/assets/index-D2Y17Fm-.css +1 -0
- package/dist/client/index.html +21 -0
- package/dist/editor/index.d.ts +69 -0
- package/dist/editor/index.js +125 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/server/app/index.d.ts +98 -0
- package/dist/server/app/index.js +390 -0
- package/dist/server/articleIndex/index.d.ts +126 -0
- package/dist/server/articleIndex/index.js +352 -0
- package/dist/server/convert/index.d.ts +38 -0
- package/dist/server/convert/index.js +180 -0
- package/dist/server/files/index.d.ts +66 -0
- package/dist/server/files/index.js +256 -0
- package/dist/server/store/index.d.ts +287 -0
- package/dist/server/store/index.js +693 -0
- package/dist/server/types/index.d.ts +251 -0
- package/dist/server/types/index.js +15 -0
- package/package.json +59 -3
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import type { ArticleStatus } from "@lvl99dotcom/edaha.md/generator/types";
|
|
2
|
+
import type { MetadataDefinitions, MetadataProblem } from "@lvl99dotcom/edaha.md/generator/metadata";
|
|
3
|
+
import type { MetadataGroup } from "@lvl99dotcom/edaha.md/generator/metadataGroups";
|
|
4
|
+
import type { EmbedOptionSchemas } from "@lvl99dotcom/edaha.md/embeds";
|
|
5
|
+
export type { ArticleStatus } from "@lvl99dotcom/edaha.md/generator/types";
|
|
6
|
+
export type { MetadataDefinitions, MetadataProblem, } from "@lvl99dotcom/edaha.md/generator/metadata";
|
|
7
|
+
export type { MetadataGroup } from "@lvl99dotcom/edaha.md/generator/metadataGroups";
|
|
8
|
+
/** Where an article is saved */
|
|
9
|
+
export interface ArticleLocation {
|
|
10
|
+
type: string;
|
|
11
|
+
slug: string;
|
|
12
|
+
}
|
|
13
|
+
/** An article in the editor's article list */
|
|
14
|
+
export interface ArticleSummary {
|
|
15
|
+
type: string;
|
|
16
|
+
slug: string;
|
|
17
|
+
/** The article title, or its folder name if it can't be read */
|
|
18
|
+
title: string;
|
|
19
|
+
status: ArticleStatus;
|
|
20
|
+
/** ISO 8601 date (empty if it can't be read) */
|
|
21
|
+
date: string;
|
|
22
|
+
/** Why the article can't be read, if it can't */
|
|
23
|
+
error?: string | undefined;
|
|
24
|
+
/** The author's name, if the article names one */
|
|
25
|
+
author?: string | undefined;
|
|
26
|
+
/** The article's tags */
|
|
27
|
+
tags: string[];
|
|
28
|
+
/** When its article.md file last changed (ISO 8601) */
|
|
29
|
+
updated: string;
|
|
30
|
+
/** Problems with its custom metadata, if it has any */
|
|
31
|
+
problems?: MetadataProblem[] | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** What articles are sorted by: their title, type, status, date, or when their file last changed */
|
|
34
|
+
export type ArticleSort = "title" | "type" | "status" | "date" | "updated";
|
|
35
|
+
/**
|
|
36
|
+
* Which way articles are sorted: ascending (A to Z, oldest first) or descending (Z to A, newest first). Each sort has
|
|
37
|
+
* its own default (see `DEFAULT_ORDERS`).
|
|
38
|
+
*/
|
|
39
|
+
export type ArticleOrder = "asc" | "desc";
|
|
40
|
+
/** Each sort's default order: titles, types and statuses A to Z, dates newest first */
|
|
41
|
+
export declare const DEFAULT_ORDERS: Readonly<Record<ArticleSort, ArticleOrder>>;
|
|
42
|
+
/** Which articles with metadata problems to find: those with errors, with warnings, or with either */
|
|
43
|
+
export type ProblemFilter = "errors" | "warnings" | "any";
|
|
44
|
+
/**
|
|
45
|
+
* The custom metadata fields, which each configured type uses (a list, `false` for none, or all when missing), and the
|
|
46
|
+
* groups the editor shows settings in, in order
|
|
47
|
+
*/
|
|
48
|
+
export interface MetadataInfo {
|
|
49
|
+
definitions: MetadataDefinitions;
|
|
50
|
+
types: Record<string, string[] | false>;
|
|
51
|
+
groups: MetadataGroup[];
|
|
52
|
+
}
|
|
53
|
+
/** A search of the article index; every part is optional */
|
|
54
|
+
export interface ArticleQuery {
|
|
55
|
+
/** Text the title contains (ignoring case and accents) */
|
|
56
|
+
search?: string | undefined;
|
|
57
|
+
type?: string | undefined;
|
|
58
|
+
/** The author's name */
|
|
59
|
+
author?: string | undefined;
|
|
60
|
+
tag?: string | undefined;
|
|
61
|
+
status?: ArticleStatus | undefined;
|
|
62
|
+
/** Only articles with metadata errors, warnings, or either */
|
|
63
|
+
problems?: ProblemFilter | undefined;
|
|
64
|
+
/** Default: "date" */
|
|
65
|
+
sort?: ArticleSort | undefined;
|
|
66
|
+
/** Default: the sort's own default (see `DEFAULT_ORDERS`) */
|
|
67
|
+
order?: ArticleOrder | undefined;
|
|
68
|
+
/** The page to show, from 1 (default: 1) */
|
|
69
|
+
page?: number | undefined;
|
|
70
|
+
/** Articles per page, at most `MAX_PER_PAGE` (default: `MAX_PER_PAGE`) */
|
|
71
|
+
perPage?: number | undefined;
|
|
72
|
+
}
|
|
73
|
+
/** A page of articles found by an `ArticleQuery` */
|
|
74
|
+
export interface ArticlePage {
|
|
75
|
+
articles: ArticleSummary[];
|
|
76
|
+
/** How many articles were found in all */
|
|
77
|
+
total: number;
|
|
78
|
+
/** The page shown, from 1 */
|
|
79
|
+
page: number;
|
|
80
|
+
/** How many pages there are (at least 1) */
|
|
81
|
+
pages: number;
|
|
82
|
+
perPage: number;
|
|
83
|
+
}
|
|
84
|
+
/** The kind of a file, by its extension */
|
|
85
|
+
export type FileKind = "image" | "document" | "archive" | "video" | "audio" | "other";
|
|
86
|
+
/** A file in an article's folder, as the article index lists it */
|
|
87
|
+
export interface IndexedFile {
|
|
88
|
+
/** The article's type and slug */
|
|
89
|
+
type: string;
|
|
90
|
+
slug: string;
|
|
91
|
+
/** The file's name in the article's folder */
|
|
92
|
+
name: string;
|
|
93
|
+
kind: FileKind;
|
|
94
|
+
/** Its size in bytes */
|
|
95
|
+
size: number;
|
|
96
|
+
/** When it last changed (ISO 8601) */
|
|
97
|
+
updated: string;
|
|
98
|
+
}
|
|
99
|
+
/** A file, as the file browser shows it */
|
|
100
|
+
export interface FileSummary extends IndexedFile {
|
|
101
|
+
/** Its path on the website, e.g. "/news/welcome/photo.png" */
|
|
102
|
+
url: string;
|
|
103
|
+
}
|
|
104
|
+
/** What files are sorted by: their name, kind, size, or location (article type and slug) */
|
|
105
|
+
export type FileSort = "name" | "kind" | "size" | "location";
|
|
106
|
+
/** Each file sort's default order: sizes largest first, the others A to Z */
|
|
107
|
+
export declare const DEFAULT_FILE_ORDERS: Readonly<Record<FileSort, ArticleOrder>>;
|
|
108
|
+
/** A search of the article folders' files; every part is optional */
|
|
109
|
+
export interface FileQuery {
|
|
110
|
+
/** Text the name contains (ignoring case) */
|
|
111
|
+
search?: string | undefined;
|
|
112
|
+
kind?: FileKind | undefined;
|
|
113
|
+
/** The article type the files are in */
|
|
114
|
+
type?: string | undefined;
|
|
115
|
+
/** Default: "location" */
|
|
116
|
+
sort?: FileSort | undefined;
|
|
117
|
+
/** Default: the sort's own default (see `DEFAULT_FILE_ORDERS`) */
|
|
118
|
+
order?: ArticleOrder | undefined;
|
|
119
|
+
/** The page to show, from 1 (default: 1) */
|
|
120
|
+
page?: number | undefined;
|
|
121
|
+
/** Files per page, at most 50 (default: 50) */
|
|
122
|
+
perPage?: number | undefined;
|
|
123
|
+
}
|
|
124
|
+
/** A page of files found by a `FileQuery` */
|
|
125
|
+
export interface FilePage {
|
|
126
|
+
files: FileSummary[];
|
|
127
|
+
total: number;
|
|
128
|
+
page: number;
|
|
129
|
+
pages: number;
|
|
130
|
+
perPage: number;
|
|
131
|
+
}
|
|
132
|
+
/** What the file browser's filters can choose from: the kinds of files and the article types they are in */
|
|
133
|
+
export interface FileFilters {
|
|
134
|
+
kinds: FileKind[];
|
|
135
|
+
types: string[];
|
|
136
|
+
}
|
|
137
|
+
/** The result of replacing or deleting a file: the replacement's name, and the articles whose references changed */
|
|
138
|
+
export interface FileChange {
|
|
139
|
+
name?: string | undefined;
|
|
140
|
+
articles: ArticleLocation[];
|
|
141
|
+
}
|
|
142
|
+
/** A type's most recently changed articles, for the editor's nav */
|
|
143
|
+
export interface RecentArticles {
|
|
144
|
+
type: string;
|
|
145
|
+
articles: ArticleSummary[];
|
|
146
|
+
/** How many articles the type has in all */
|
|
147
|
+
total: number;
|
|
148
|
+
}
|
|
149
|
+
/** What the article browser's filters can choose from: the types, authors and tags articles use */
|
|
150
|
+
export interface ArticleFilters {
|
|
151
|
+
types: string[];
|
|
152
|
+
authors: string[];
|
|
153
|
+
tags: string[];
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The website, as the editor needs it: its name, the author of articles that don't name one (undefined for none), and
|
|
157
|
+
* the types with their own default author (`false` for none)
|
|
158
|
+
*/
|
|
159
|
+
export interface SiteInfo {
|
|
160
|
+
name: string;
|
|
161
|
+
author?: EditorAuthor | undefined;
|
|
162
|
+
types: Record<string, EditorAuthor | false>;
|
|
163
|
+
}
|
|
164
|
+
/** An author as edited */
|
|
165
|
+
export interface EditorAuthor {
|
|
166
|
+
name: string;
|
|
167
|
+
email?: string | undefined;
|
|
168
|
+
url?: string | undefined;
|
|
169
|
+
}
|
|
170
|
+
/** An attachment as edited (URLs relative to the article folder, or absolute) */
|
|
171
|
+
export interface EditorAttachment {
|
|
172
|
+
url: string;
|
|
173
|
+
thumbnail?: string | undefined;
|
|
174
|
+
mimeType?: string | undefined;
|
|
175
|
+
name?: string | undefined;
|
|
176
|
+
}
|
|
177
|
+
/** An article's editable data, as saved by the editor */
|
|
178
|
+
export interface EditorArticleData {
|
|
179
|
+
type: string;
|
|
180
|
+
slug: string;
|
|
181
|
+
status: ArticleStatus;
|
|
182
|
+
/** ISO 8601 date */
|
|
183
|
+
date: string;
|
|
184
|
+
title: string;
|
|
185
|
+
/** The template to render the article with (undefined for the default, "single") */
|
|
186
|
+
template?: string | undefined;
|
|
187
|
+
/** The article's author, `false` for none, or undefined for its type's or the website's default */
|
|
188
|
+
author?: EditorAuthor | false | undefined;
|
|
189
|
+
excerpt?: string | undefined;
|
|
190
|
+
thumbnail?: string | undefined;
|
|
191
|
+
tags: string[];
|
|
192
|
+
attachments: EditorAttachment[];
|
|
193
|
+
/** The article body as editor HTML (readmore as `<hr class="readmore">`, embeds as `<div class="embed">URL</div>`) */
|
|
194
|
+
bodyHtml: string;
|
|
195
|
+
/**
|
|
196
|
+
* Every other setting, by key: the custom metadata values, and settings the type doesn't use or nobody defined (kept
|
|
197
|
+
* as they are). Default: none
|
|
198
|
+
*/
|
|
199
|
+
meta?: Record<string, unknown> | undefined;
|
|
200
|
+
}
|
|
201
|
+
/** An article as loaded into the editor */
|
|
202
|
+
export interface EditorArticle extends EditorArticleData {
|
|
203
|
+
/** Files in the article's folder (except article.md) */
|
|
204
|
+
files: string[];
|
|
205
|
+
/** Problems with its custom metadata as saved (none if left out) */
|
|
206
|
+
problems?: MetadataProblem[] | undefined;
|
|
207
|
+
}
|
|
208
|
+
/** The result of uploading a file into an article's folder */
|
|
209
|
+
export interface UploadResult {
|
|
210
|
+
/** The saved file name (relative to the article folder) */
|
|
211
|
+
name: string;
|
|
212
|
+
/** Where the editor can show the file */
|
|
213
|
+
url: string;
|
|
214
|
+
}
|
|
215
|
+
/** An embed plugin, for the editor's lists of embeds */
|
|
216
|
+
export interface EmbedInfo {
|
|
217
|
+
/** Its key, e.g. "youtube" for `<!-- embed:youtube -->` */
|
|
218
|
+
key: string;
|
|
219
|
+
/** Its name, e.g. "YouTube video" */
|
|
220
|
+
name: string;
|
|
221
|
+
/** What it embeds, if it says */
|
|
222
|
+
description?: string | undefined;
|
|
223
|
+
/** What its content is, shown under the content's label in the embed dialog, if it says */
|
|
224
|
+
info?: string | undefined;
|
|
225
|
+
/** Whether a block can have no content (see EmbedPlugin.contentOptional) */
|
|
226
|
+
contentOptional?: boolean | undefined;
|
|
227
|
+
/** Its SVG icon (markup), if it has one */
|
|
228
|
+
icon?: string | undefined;
|
|
229
|
+
/** Its options' fields (see EmbedPlugin.options), if it has options */
|
|
230
|
+
options?: EmbedOptionSchemas | undefined;
|
|
231
|
+
}
|
|
232
|
+
/** Why an embed block's content isn't valid for its plugin (none when it is) */
|
|
233
|
+
export interface EmbedValidation {
|
|
234
|
+
errors: string[];
|
|
235
|
+
}
|
|
236
|
+
/** An embed block's frame in the editor's body */
|
|
237
|
+
export interface EmbedFrame {
|
|
238
|
+
/** The frame page's URL, e.g. "/embed-frame/<id>/", or "" when the content isn't valid */
|
|
239
|
+
url: string;
|
|
240
|
+
/** Why the content isn't valid for its plugin, if it isn't (the website leaves the block out) */
|
|
241
|
+
errors: string[];
|
|
242
|
+
/** Why the block couldn't be embedded otherwise, e.g. its plugin is missing (it then shows as it is written) */
|
|
243
|
+
warnings: string[];
|
|
244
|
+
}
|
|
245
|
+
/** An article type's labels from the config file */
|
|
246
|
+
export interface ArticleTypeLabels {
|
|
247
|
+
/** e.g. "Article" */
|
|
248
|
+
labelSingle: string;
|
|
249
|
+
/** e.g. "Articles" */
|
|
250
|
+
labelPlural: string;
|
|
251
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Each sort's default order: titles, types and statuses A to Z, dates newest first */
|
|
2
|
+
export const DEFAULT_ORDERS = {
|
|
3
|
+
title: "asc",
|
|
4
|
+
type: "asc",
|
|
5
|
+
status: "asc",
|
|
6
|
+
date: "desc",
|
|
7
|
+
updated: "desc",
|
|
8
|
+
};
|
|
9
|
+
/** Each file sort's default order: sizes largest first, the others A to Z */
|
|
10
|
+
export const DEFAULT_FILE_ORDERS = {
|
|
11
|
+
name: "asc",
|
|
12
|
+
kind: "asc",
|
|
13
|
+
size: "desc",
|
|
14
|
+
location: "asc",
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvl99dotcom/edaha-editor",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Local WYSIWYG article editor for edaha.md sites.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"blog",
|
|
7
|
+
"static-site-generator",
|
|
8
|
+
"markdown",
|
|
9
|
+
"editor",
|
|
10
|
+
"wysiwyg"
|
|
11
|
+
],
|
|
12
|
+
"author": "Matt Scheurich <matt@lvl99.com>",
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/lvl99/edaha.md.git",
|
|
17
|
+
"directory": "packages/edaha-editor"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/lvl99/edaha.md#readme",
|
|
20
|
+
"bugs": "https://github.com/lvl99/edaha.md/issues",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=22"
|
|
24
|
+
},
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@hono/node-server": "^2.1.5",
|
|
42
|
+
"@lvl99dotcom/edaha.md": "^0.3.0",
|
|
43
|
+
"hono": "^4.13.13",
|
|
44
|
+
"mime-types": "^3.0.2",
|
|
45
|
+
"turndown": "^7.2.4",
|
|
46
|
+
"yaml": "^2.9.1"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@material-symbols/svg-400": "0.48.1",
|
|
50
|
+
"@tiptap/core": "^3.32.0",
|
|
51
|
+
"@tiptap/extension-bubble-menu": "^3.34.0",
|
|
52
|
+
"@tiptap/extension-details": "3.32.0",
|
|
53
|
+
"@tiptap/extension-image": "^3.32.0",
|
|
54
|
+
"@tiptap/extension-table": "^3.32.0",
|
|
55
|
+
"@tiptap/pm": "^3.32.0",
|
|
56
|
+
"@tiptap/starter-kit": "^3.32.0",
|
|
57
|
+
"lit": "^3.3.3"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "node scripts/build.ts"
|
|
61
|
+
}
|
|
6
62
|
}
|