orgnote-api 0.0.17 → 0.0.20
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.org +3 -3
- package/api.ts +87 -0
- package/index.ts +4 -0
- package/models/command.ts +30 -0
- package/models/completion.ts +30 -0
- package/models/extension.ts +45 -0
- package/models/index.ts +8 -0
- package/models/modal.ts +4 -0
- package/models/note.ts +24 -0
- package/models/theme-variables.ts +194 -0
- package/models/widget-type.ts +5 -0
- package/models/widget.ts +59 -0
- package/package.json +4 -9
- package/remote-api/.gitignore +4 -0
- package/remote-api/.npmignore +1 -0
- package/remote-api/.openapi-generator/FILES +9 -0
- package/remote-api/.openapi-generator/VERSION +1 -0
- package/remote-api/.openapi-generator-ignore +23 -0
- package/remote-api/api.ts +2040 -0
- package/remote-api/base.ts +72 -0
- package/remote-api/common.ts +150 -0
- package/remote-api/configuration.ts +101 -0
- package/remote-api/git_push.sh +57 -0
- package/remote-api/index.ts +18 -0
package/README.org
CHANGED
|
@@ -33,7 +33,7 @@ You can find all available methods here. They are currently undocumented.
|
|
|
33
33
|
- [[https://github.com/artawower/orgnote][OrgNote entrypoint]]
|
|
34
34
|
- [[https://org-note.com/][Official website]]
|
|
35
35
|
- [[https://github.com/Artawower/orgnote-client][Org Note client]]
|
|
36
|
-
- [[
|
|
36
|
+
- [[https://github.com/Artawower/orgnote-extensions][Repository with collection of extensions]]
|
|
37
37
|
- [[https://github.com/Artawower/org-mode-ast][Typescript abstract syntax tree for org mode.]]
|
|
38
38
|
|
|
39
39
|
* Extension structure
|
|
@@ -84,8 +84,8 @@ with =ExtensionManifest=
|
|
|
84
84
|
* Extensions example
|
|
85
85
|
/Themes/
|
|
86
86
|
- [[https://github.com/Artawower/orgnote-atom-one-dark][Atom One Dark theme (pure js)]]
|
|
87
|
-
/UI/
|
|
88
|
-
- Colorful Headlines (typescript + API package)
|
|
87
|
+
/UI/
|
|
88
|
+
- [[https://github.com/Artawower/orgnote-colorful-headlines][Colorful Headlines (typescript + API package)]]
|
|
89
89
|
|
|
90
90
|
* Contribute guide
|
|
91
91
|
Any contribution is very much appreciated! Please read the [[./CONTRIBUTE.org][style guide]] before contributing to avoid misunderstandings!
|
package/api.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Command,
|
|
3
|
+
CSSVariable,
|
|
4
|
+
ThemeVariable,
|
|
5
|
+
Note,
|
|
6
|
+
InlineEmbeddedWidget,
|
|
7
|
+
MultilineEmbeddedWidget,
|
|
8
|
+
OrgLineClass,
|
|
9
|
+
} from './models';
|
|
10
|
+
import type { NavigationFailure } from 'vue-router';
|
|
11
|
+
import { WidgetType } from './models/widget-type';
|
|
12
|
+
import type { Component } from 'vue';
|
|
13
|
+
import { EmbeddedWidget } from './models';
|
|
14
|
+
|
|
15
|
+
export type WidgetMeta =
|
|
16
|
+
| ({ type: WidgetType.Inline } & InlineEmbeddedWidget)
|
|
17
|
+
| ({ type: WidgetType.Multiline } & MultilineEmbeddedWidget)
|
|
18
|
+
| ({ type: WidgetType.LineClass } & OrgLineClass);
|
|
19
|
+
|
|
20
|
+
export interface OrgNoteApi {
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
getExtension?<T>(config: string): T;
|
|
23
|
+
|
|
24
|
+
system: {
|
|
25
|
+
reload: (params?: { verbose: boolean }) => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
navigation: {
|
|
28
|
+
openNote: (id: string) => Promise<void | NavigationFailure>;
|
|
29
|
+
editNote: (id: string) => Promise<void | NavigationFailure>;
|
|
30
|
+
};
|
|
31
|
+
ui: {
|
|
32
|
+
applyTheme: (theme: { [key in ThemeVariable]: string | number }) => void;
|
|
33
|
+
applyCssVariables: (styles: {
|
|
34
|
+
[key in CSSVariable]: string | number;
|
|
35
|
+
}) => void;
|
|
36
|
+
setThemeByMode: (themeName?: string) => void;
|
|
37
|
+
setDarkTheme: (themeName?: string) => void;
|
|
38
|
+
setLightTheme: (themeName?: string) => void;
|
|
39
|
+
applyStyles: (scopeName: string, styles: string) => void;
|
|
40
|
+
removeStyles: (scopeName: string) => void;
|
|
41
|
+
resetTheme: () => void;
|
|
42
|
+
};
|
|
43
|
+
interaction: {
|
|
44
|
+
confirm: (title: string, message: string) => Promise<boolean>;
|
|
45
|
+
};
|
|
46
|
+
currentNote: {
|
|
47
|
+
get: () => Note;
|
|
48
|
+
};
|
|
49
|
+
editor: {
|
|
50
|
+
widgets: {
|
|
51
|
+
add: (...widgetMeta: WidgetMeta[]) => void;
|
|
52
|
+
createEmbeddedWidget: (
|
|
53
|
+
cmp: Component,
|
|
54
|
+
props: { [key: string]: unknown }
|
|
55
|
+
) => EmbeddedWidget;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
commands: {
|
|
59
|
+
add(...commands: Command[]): void;
|
|
60
|
+
// delete(...commands: Command[]): void;
|
|
61
|
+
// update(...commands: Command[]): void;
|
|
62
|
+
};
|
|
63
|
+
configuration: () => OrgNoteConfig;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface OrgNoteConfig {
|
|
67
|
+
editor: {
|
|
68
|
+
showSpecialSymbols: boolean;
|
|
69
|
+
showPropertyDrawer: boolean;
|
|
70
|
+
};
|
|
71
|
+
common: {
|
|
72
|
+
developerMode: boolean;
|
|
73
|
+
maximumLogsCount: number;
|
|
74
|
+
};
|
|
75
|
+
completion: {
|
|
76
|
+
showGroup: boolean;
|
|
77
|
+
defaultCompletionLimit: number;
|
|
78
|
+
};
|
|
79
|
+
ui: {
|
|
80
|
+
theme: 'light' | 'dark';
|
|
81
|
+
darkThemeName?: string;
|
|
82
|
+
lightThemeName?: string;
|
|
83
|
+
};
|
|
84
|
+
extensions: {
|
|
85
|
+
sources: string[];
|
|
86
|
+
};
|
|
87
|
+
}
|
package/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const DEFAULT_KEYBINDING_GROUP = 'default';
|
|
2
|
+
|
|
3
|
+
export type CommandGroup =
|
|
4
|
+
| 'settings'
|
|
5
|
+
| 'editor'
|
|
6
|
+
| 'global'
|
|
7
|
+
| 'note-detail'
|
|
8
|
+
| 'completion'
|
|
9
|
+
| string;
|
|
10
|
+
|
|
11
|
+
export interface CommandHandlerParams {
|
|
12
|
+
event?: KeyboardEvent;
|
|
13
|
+
data?: unknown;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface Command {
|
|
18
|
+
// TODO: add support for multiple key sequences
|
|
19
|
+
keySequence?: string | string[];
|
|
20
|
+
description?: string;
|
|
21
|
+
command?: string;
|
|
22
|
+
title?: string | (() => string);
|
|
23
|
+
icon?: string | (() => string);
|
|
24
|
+
/* Where is this command available, default value is global */
|
|
25
|
+
group?: CommandGroup;
|
|
26
|
+
allowOnInput?: boolean;
|
|
27
|
+
ignorePrompt?: boolean;
|
|
28
|
+
/* arguments depend on the current scope */
|
|
29
|
+
handler: (params?: CommandHandlerParams) => unknown | Promise<unknown>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface CompletionCandidate<T = unknown> {
|
|
2
|
+
icon?: string | (() => string);
|
|
3
|
+
group?: string;
|
|
4
|
+
title?: string | (() => string);
|
|
5
|
+
description?: string;
|
|
6
|
+
command: string;
|
|
7
|
+
data: T;
|
|
8
|
+
/* Command handler could be used instead of command string */
|
|
9
|
+
commandHandler?: (data: T) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface CompletionSearchResult<T = unknown> {
|
|
13
|
+
total?: number;
|
|
14
|
+
result: CompletionCandidate<T>[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type CandidateGetterFn<T = unknown> = (
|
|
18
|
+
filter: string,
|
|
19
|
+
limit?: number,
|
|
20
|
+
offset?: number
|
|
21
|
+
) => CompletionSearchResult<T> | Promise<CompletionSearchResult<T>>;
|
|
22
|
+
|
|
23
|
+
export interface CompletionConfigs<T = unknown> {
|
|
24
|
+
searchAutocompletions?: string[];
|
|
25
|
+
itemsGetter: CandidateGetterFn<T>;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
itemHeight?: string;
|
|
28
|
+
searchText?: string;
|
|
29
|
+
onClicked?: (candidate: CompletionCandidate<T>) => void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { OrgNoteApi } from '../api';
|
|
2
|
+
|
|
3
|
+
export interface ExtensionManifest {
|
|
4
|
+
/* Should be unique in the extension repo */
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
category: 'theme' | 'extension' | 'language pack' | 'other';
|
|
8
|
+
/* OrgNote api semver, 0.13.4 for example */
|
|
9
|
+
apiVersion?: string;
|
|
10
|
+
author?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
keywords?: string[];
|
|
13
|
+
// Repository url
|
|
14
|
+
sourceType: 'git' | 'file' | 'builtin';
|
|
15
|
+
/* Default value is README.org */
|
|
16
|
+
readmeFilePath?: string;
|
|
17
|
+
/* WIP */
|
|
18
|
+
permissions?: Array<'files' | 'personal info' | '*' | 'third party'>;
|
|
19
|
+
reloadRequired?: boolean;
|
|
20
|
+
sourceUrl?: string;
|
|
21
|
+
sponsor?: string[];
|
|
22
|
+
development?: boolean;
|
|
23
|
+
icon?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Extension {
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
|
|
29
|
+
onMounted: (api: OrgNoteApi) => Promise<void>;
|
|
30
|
+
onUnmounted?: (api: OrgNoteApi) => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ExtensionMeta {
|
|
34
|
+
manifest: ExtensionManifest;
|
|
35
|
+
uploaded?: boolean;
|
|
36
|
+
active?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface StoredExtension extends ExtensionMeta {
|
|
40
|
+
module?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ActiveExtension extends ExtensionMeta {
|
|
44
|
+
module: Extension;
|
|
45
|
+
}
|
package/models/index.ts
ADDED
package/models/modal.ts
ADDED
package/models/note.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ModelsPublicNote, ModelsPublicUser } from '../remote-api';
|
|
2
|
+
|
|
3
|
+
export interface NotesFilter {
|
|
4
|
+
searchText?: string;
|
|
5
|
+
userId?: string;
|
|
6
|
+
limit?: number;
|
|
7
|
+
offset?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface NotePreview {
|
|
11
|
+
id: ModelsPublicNote['id'];
|
|
12
|
+
meta: ModelsPublicNote['meta'];
|
|
13
|
+
createdAt: ModelsPublicNote['createdAt'];
|
|
14
|
+
updatedAt: ModelsPublicNote['updatedAt'];
|
|
15
|
+
filePath: ModelsPublicNote['filePath'];
|
|
16
|
+
isMy: ModelsPublicNote['isMy'];
|
|
17
|
+
author?: ModelsPublicUser;
|
|
18
|
+
bookmarked?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface Note extends ModelsPublicNote {
|
|
22
|
+
deleted?: Date;
|
|
23
|
+
bookmarked?: boolean;
|
|
24
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is generated by the script `collect-css-variables.js`.
|
|
3
|
+
* Do not edit it manually.
|
|
4
|
+
**/
|
|
5
|
+
|
|
6
|
+
export enum ThemeVariable {
|
|
7
|
+
red = 'red',
|
|
8
|
+
orange = 'orange',
|
|
9
|
+
green = 'green',
|
|
10
|
+
teal = 'teal',
|
|
11
|
+
yellow = 'yellow',
|
|
12
|
+
blue = 'blue',
|
|
13
|
+
darkBlue = 'darkBlue',
|
|
14
|
+
magenta = 'magenta',
|
|
15
|
+
violet = 'violet',
|
|
16
|
+
cyan = 'cyan',
|
|
17
|
+
darkCyan = 'darkCyan',
|
|
18
|
+
white = 'white',
|
|
19
|
+
bg = 'bg',
|
|
20
|
+
bgAlt = 'bgAlt',
|
|
21
|
+
bgAlt2 = 'bgAlt2',
|
|
22
|
+
fg = 'fg',
|
|
23
|
+
fgAlt = 'fgAlt',
|
|
24
|
+
base0 = 'base0',
|
|
25
|
+
base1 = 'base1',
|
|
26
|
+
base2 = 'base2',
|
|
27
|
+
base3 = 'base3',
|
|
28
|
+
base4 = 'base4',
|
|
29
|
+
base5 = 'base5',
|
|
30
|
+
base6 = 'base6',
|
|
31
|
+
base7 = 'base7',
|
|
32
|
+
base8 = 'base8',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export enum CSSVariable {
|
|
36
|
+
bg = 'bg',
|
|
37
|
+
fg = 'fg',
|
|
38
|
+
dur = 'dur',
|
|
39
|
+
easyTableHeaderBackgroundColor = 'easyTableHeaderBackgroundColor',
|
|
40
|
+
easyTableHeaderFontColor = 'easyTableHeaderFontColor',
|
|
41
|
+
easyTableBodyRowBackgroundColor = 'easyTableBodyRowBackgroundColor',
|
|
42
|
+
easyTableBodyRowFontColor = 'easyTableBodyRowFontColor',
|
|
43
|
+
easyTableBodyRowHoverBackgroundColor = 'easyTableBodyRowHoverBackgroundColor',
|
|
44
|
+
easyTableFooterBackgroundColor = 'easyTableFooterBackgroundColor',
|
|
45
|
+
easyTableFooterFontColor = 'easyTableFooterFontColor',
|
|
46
|
+
easyTableBodyRowHoverFontColor = 'easyTableBodyRowHoverFontColor',
|
|
47
|
+
easyTableRowBorder = 'easyTableRowBorder',
|
|
48
|
+
easyTableBorder = 'easyTableBorder',
|
|
49
|
+
easyTableMessageFontColor = 'easyTableMessageFontColor',
|
|
50
|
+
btnFlatSize = 'btnFlatSize',
|
|
51
|
+
btnFlatBorder = 'btnFlatBorder',
|
|
52
|
+
btnFlatBorderRadius = 'btnFlatBorderRadius',
|
|
53
|
+
btnFlatBoxShadow = 'btnFlatBoxShadow',
|
|
54
|
+
btnMainColor = 'btnMainColor',
|
|
55
|
+
btnSocialSize = 'btnSocialSize',
|
|
56
|
+
btnSocialBackground = 'btnSocialBackground',
|
|
57
|
+
checkboxColor = 'checkboxColor',
|
|
58
|
+
editorFontFamily = 'editorFontFamily',
|
|
59
|
+
flexGapMd = 'flexGapMd',
|
|
60
|
+
flexGapSm = 'flexGapSm',
|
|
61
|
+
inlineCodeBackground = 'inlineCodeBackground',
|
|
62
|
+
inlineCodeFontColor = 'inlineCodeFontColor',
|
|
63
|
+
scrollBarWidth = 'scrollBarWidth',
|
|
64
|
+
scrollBarColor = 'scrollBarColor',
|
|
65
|
+
fontSizeSm = 'fontSizeSm',
|
|
66
|
+
fontSizeMd = 'fontSizeMd',
|
|
67
|
+
fontSizeLg = 'fontSizeLg',
|
|
68
|
+
headlineMargin = 'headlineMargin',
|
|
69
|
+
paragraphFontSize = 'paragraphFontSize',
|
|
70
|
+
mainFontFamily = 'mainFontFamily',
|
|
71
|
+
editorFontFamilyMain = 'editorFontFamilyMain',
|
|
72
|
+
paragraphFontFamily = 'paragraphFontFamily',
|
|
73
|
+
headlineFontFamily = 'headlineFontFamily',
|
|
74
|
+
codeFontFamily = 'codeFontFamily',
|
|
75
|
+
descriptionFontFamily = 'descriptionFontFamily',
|
|
76
|
+
descriptionFontSize = 'descriptionFontSize',
|
|
77
|
+
descriptionFontStyle = 'descriptionFontStyle',
|
|
78
|
+
descriptionFontColor = 'descriptionFontColor',
|
|
79
|
+
descriptionPadding = 'descriptionPadding',
|
|
80
|
+
codeFontSize = 'codeFontSize',
|
|
81
|
+
headlineFontWeight = 'headlineFontWeight',
|
|
82
|
+
fontColorAction = 'fontColorAction',
|
|
83
|
+
fontSm = 'fontSm',
|
|
84
|
+
fontMd = 'fontMd',
|
|
85
|
+
fontLg = 'fontLg',
|
|
86
|
+
ulFontSize = 'ulFontSize',
|
|
87
|
+
ulLineHeight = 'ulLineHeight',
|
|
88
|
+
ulFontFamily = 'ulFontFamily',
|
|
89
|
+
topBarHeight = 'topBarHeight',
|
|
90
|
+
contentMaxWidth = 'contentMaxWidth',
|
|
91
|
+
modelineHeight = 'modelineHeight',
|
|
92
|
+
modelinePadding = 'modelinePadding',
|
|
93
|
+
modelineBackground = 'modelineBackground',
|
|
94
|
+
cardBackgroundColor = 'cardBackgroundColor',
|
|
95
|
+
shadowMain = 'shadowMain',
|
|
96
|
+
sidebarWidth = 'sidebarWidth',
|
|
97
|
+
actionPaneOpenedWidth = 'actionPaneOpenedWidth',
|
|
98
|
+
footerHeight = 'footerHeight',
|
|
99
|
+
publicPreviewImageWidth = 'publicPreviewImageWidth',
|
|
100
|
+
publicPreviewImageHeight = 'publicPreviewImageHeight',
|
|
101
|
+
publicPreviewMaxHeight = 'publicPreviewMaxHeight',
|
|
102
|
+
completionItemMinHeight = 'completionItemMinHeight',
|
|
103
|
+
completionItemPadding = 'completionItemPadding',
|
|
104
|
+
completionItemMargin = 'completionItemMargin',
|
|
105
|
+
completionItemHoverBackground = 'completionItemHoverBackground',
|
|
106
|
+
completionItemHoverColor = 'completionItemHoverColor',
|
|
107
|
+
completionFloatTop = 'completionFloatTop',
|
|
108
|
+
completionBorderRadius = 'completionBorderRadius',
|
|
109
|
+
completionWidth = 'completionWidth',
|
|
110
|
+
completionMaxWidth = 'completionMaxWidth',
|
|
111
|
+
completionBorder = 'completionBorder',
|
|
112
|
+
completionBoxShadow = 'completionBoxShadow',
|
|
113
|
+
completionInputHeight = 'completionInputHeight',
|
|
114
|
+
completionContainerMargin = 'completionContainerMargin',
|
|
115
|
+
menuPadding = 'menuPadding',
|
|
116
|
+
fileUploaderBorderWidth = 'fileUploaderBorderWidth',
|
|
117
|
+
fileUploaderBorderStyle = 'fileUploaderBorderStyle',
|
|
118
|
+
fileUploaderBorderColor = 'fileUploaderBorderColor',
|
|
119
|
+
fileUploaderBg = 'fileUploaderBg',
|
|
120
|
+
fileUploaderOpacity = 'fileUploaderOpacity',
|
|
121
|
+
notePreviewLinkMaxWidth = 'notePreviewLinkMaxWidth',
|
|
122
|
+
notePreviewLinkHeight = 'notePreviewLinkHeight',
|
|
123
|
+
btnActionShadow = 'btnActionShadow',
|
|
124
|
+
btnActionBorder = 'btnActionBorder',
|
|
125
|
+
btnActionBorderColor = 'btnActionBorderColor',
|
|
126
|
+
btnActionPadding = 'btnActionPadding',
|
|
127
|
+
btnActionRadius = 'btnActionRadius',
|
|
128
|
+
btnActionFireColor = 'btnActionFireColor',
|
|
129
|
+
btnActionFireBorderColor = 'btnActionFireBorderColor',
|
|
130
|
+
btnActionMd = 'btnActionMd',
|
|
131
|
+
btnActionSm = 'btnActionSm',
|
|
132
|
+
btnActionLg = 'btnActionLg',
|
|
133
|
+
btnActionColor = 'btnActionColor',
|
|
134
|
+
btnActionBg = 'btnActionBg',
|
|
135
|
+
miniBufferBackground = 'miniBufferBackground',
|
|
136
|
+
miniBufferFontColor = 'miniBufferFontColor',
|
|
137
|
+
miniBufferBorderTop = 'miniBufferBorderTop',
|
|
138
|
+
miniBufferMaxHeight = 'miniBufferMaxHeight',
|
|
139
|
+
tagHoverBackground = 'tagHoverBackground',
|
|
140
|
+
tagHoverColor = 'tagHoverColor',
|
|
141
|
+
toolbarBorderTop = 'toolbarBorderTop',
|
|
142
|
+
toolbarHoverColor = 'toolbarHoverColor',
|
|
143
|
+
headerbarHeight = 'headerbarHeight',
|
|
144
|
+
headerbarBorderRadius = 'headerbarBorderRadius',
|
|
145
|
+
headerbarBackgroundColor = 'headerbarBackgroundColor',
|
|
146
|
+
headerbarColor = 'headerbarColor',
|
|
147
|
+
headerbarBorder = 'headerbarBorder',
|
|
148
|
+
fileItemBgHover = 'fileItemBgHover',
|
|
149
|
+
fileItemColorHover = 'fileItemColorHover',
|
|
150
|
+
fileItemHeight = 'fileItemHeight',
|
|
151
|
+
iconBtnColor = 'iconBtnColor',
|
|
152
|
+
iconBtnHoverColor = 'iconBtnHoverColor',
|
|
153
|
+
modalMaxHeight = 'modalMaxHeight',
|
|
154
|
+
modalMaxWidth = 'modalMaxWidth',
|
|
155
|
+
modalPadding = 'modalPadding',
|
|
156
|
+
blockPaddingSm = 'blockPaddingSm',
|
|
157
|
+
blockPaddingMd = 'blockPaddingMd',
|
|
158
|
+
blockPaddingLg = 'blockPaddingLg',
|
|
159
|
+
blockMarginMd = 'blockMarginMd',
|
|
160
|
+
blockMarginSm = 'blockMarginSm',
|
|
161
|
+
blockBorderRadiusMd = 'blockBorderRadiusMd',
|
|
162
|
+
blockBorderRadiusSm = 'blockBorderRadiusSm',
|
|
163
|
+
itemDefaultRadius = 'itemDefaultRadius',
|
|
164
|
+
searchIcnSize = 'searchIcnSize',
|
|
165
|
+
gapMd = 'gapMd',
|
|
166
|
+
gapSm = 'gapSm',
|
|
167
|
+
gapXs = 'gapXs',
|
|
168
|
+
srcBlockHeaderPaddingY = 'srcBlockHeaderPaddingY',
|
|
169
|
+
srcBlockFooterPaddingY = 'srcBlockFooterPaddingY',
|
|
170
|
+
srcBlockPaddingX = 'srcBlockPaddingX',
|
|
171
|
+
srcBlockPaddingY = 'srcBlockPaddingY',
|
|
172
|
+
srcBlockMarginY = 'srcBlockMarginY',
|
|
173
|
+
pagePadding = 'pagePadding',
|
|
174
|
+
editorLineHeight = 'editorLineHeight',
|
|
175
|
+
editorHeadlineLineHeight = 'editorHeadlineLineHeight',
|
|
176
|
+
editorDefaultLineHeight = 'editorDefaultLineHeight',
|
|
177
|
+
editorPaddingBottom = 'editorPaddingBottom',
|
|
178
|
+
editorCursorColor = 'editorCursorColor',
|
|
179
|
+
editorSelectionBgColor = 'editorSelectionBgColor',
|
|
180
|
+
editorSelectionColor = 'editorSelectionColor',
|
|
181
|
+
editorGutterColor = 'editorGutterColor',
|
|
182
|
+
editorGutterHoverColor = 'editorGutterHoverColor',
|
|
183
|
+
editorFoldPlaceholderColor = 'editorFoldPlaceholderColor',
|
|
184
|
+
editorActiveLineBgColor = 'editorActiveLineBgColor',
|
|
185
|
+
editorCaretColor = 'editorCaretColor',
|
|
186
|
+
orgListItemBulletMarginLeft = 'orgListItemBulletMarginLeft',
|
|
187
|
+
devicePaddingBottom = 'devicePaddingBottom',
|
|
188
|
+
graphNodeColor = 'graphNodeColor',
|
|
189
|
+
graphEdgeColor = 'graphEdgeColor',
|
|
190
|
+
graphActiveColor = 'graphActiveColor',
|
|
191
|
+
inputHeight = 'inputHeight',
|
|
192
|
+
inputLgHeight = 'inputLgHeight',
|
|
193
|
+
borderMain = 'borderMain',
|
|
194
|
+
}
|
package/models/widget.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ChangeSpec } from '@codemirror/state';
|
|
2
|
+
import type { EditorView } from 'codemirror';
|
|
3
|
+
import type { NodeType, OrgNode } from 'org-mode-ast';
|
|
4
|
+
|
|
5
|
+
export type EmbeddedWidget = {
|
|
6
|
+
destroy: () => void;
|
|
7
|
+
refresh?: (...args: unknown[]) => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export interface WidgetBuilderParams {
|
|
11
|
+
wrap: HTMLElement;
|
|
12
|
+
orgNode: OrgNode;
|
|
13
|
+
rootNodeSrc: () => OrgNode;
|
|
14
|
+
onUpdateFn?: (newVal: string) => void;
|
|
15
|
+
editorView: EditorView;
|
|
16
|
+
readonly?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type WidgetBuilder = (params: WidgetBuilderParams) => EmbeddedWidget;
|
|
20
|
+
|
|
21
|
+
export interface CommonEmbeddedWidget {
|
|
22
|
+
satisfied?: (orgNode: OrgNode) => boolean;
|
|
23
|
+
widgetBuilder?: WidgetBuilder;
|
|
24
|
+
viewUpdater?: (orgNode: OrgNode, newVal: string) => ViewUpdateSchema;
|
|
25
|
+
ignoreEvent?: boolean;
|
|
26
|
+
showRangeOffset?: [number, number];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface MultilineEmbeddedWidget extends CommonEmbeddedWidget {
|
|
30
|
+
widgetBuilder: WidgetBuilder;
|
|
31
|
+
suppressEdit?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type MultilineEmbeddedWidgets = {
|
|
35
|
+
[key in NodeType]?: MultilineEmbeddedWidget;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type ViewUpdateSchema = ChangeSpec;
|
|
39
|
+
|
|
40
|
+
export interface InlineEmbeddedWidget extends CommonEmbeddedWidget {
|
|
41
|
+
classBuilder?: (orgNode: OrgNode) => string;
|
|
42
|
+
decorationType: 'mark' | 'widget' | 'replace' | 'line';
|
|
43
|
+
ignoreEditing?: boolean;
|
|
44
|
+
side?: number;
|
|
45
|
+
wrapComponent?: string;
|
|
46
|
+
inclusive?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type InlineEmbeddedWidgets = {
|
|
50
|
+
[key in NodeType]?: InlineEmbeddedWidget;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type EmbeddedWidgetBuilder = (
|
|
54
|
+
wrap: HTMLElement,
|
|
55
|
+
dynamicProps?: { [key: string]: unknown }
|
|
56
|
+
) => EmbeddedWidget;
|
|
57
|
+
|
|
58
|
+
export type OrgLineClass = { class: string | ((orgNode: OrgNode) => string) };
|
|
59
|
+
export type OrgLineClasses = { [key in NodeType]?: OrgLineClass };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orgnote-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "Official API for creating extensions for OrgNote app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"codegen:api": "openapi-generator-cli generate",
|
|
12
12
|
"codegen:css-doc": "node collect-css-variables.cjs --docs",
|
|
13
13
|
"codegen:css-types": "node collect-css-variables.cjs --types",
|
|
14
|
-
"prepublish": "mv -
|
|
14
|
+
"prepublish": "mv -f ./src/* . && rm -rf ./src"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
@@ -22,13 +22,7 @@
|
|
|
22
22
|
".": "./index.ts",
|
|
23
23
|
"./remote-api": "./remote-api/index.ts"
|
|
24
24
|
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"orgnote",
|
|
27
|
-
"org-mode",
|
|
28
|
-
"org-roam",
|
|
29
|
-
"api",
|
|
30
|
-
"extensions"
|
|
31
|
-
],
|
|
25
|
+
"keywords": ["orgnote", "org-mode", "org-roam", "api", "extensions"],
|
|
32
26
|
"author": "darkawower <app.orgnote@gmail.com> (https://org-note.com)",
|
|
33
27
|
"license": "GPL-3.0-or-later",
|
|
34
28
|
"bugs": {
|
|
@@ -39,6 +33,7 @@
|
|
|
39
33
|
"axios": "1.6.7",
|
|
40
34
|
"codemirror": "6.0.1",
|
|
41
35
|
"org-mode-ast": "0.11.2",
|
|
36
|
+
"vue": "^3.4.15",
|
|
42
37
|
"vue-router": "4.2.5"
|
|
43
38
|
},
|
|
44
39
|
"devDependencies": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6.4.0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# OpenAPI Generator Ignore
|
|
2
|
+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
3
|
+
|
|
4
|
+
# Use this file to prevent files from being overwritten by the generator.
|
|
5
|
+
# The patterns follow closely to .gitignore or .dockerignore.
|
|
6
|
+
|
|
7
|
+
# As an example, the C# client generator defines ApiClient.cs.
|
|
8
|
+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
9
|
+
#ApiClient.cs
|
|
10
|
+
|
|
11
|
+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
12
|
+
#foo/*/qux
|
|
13
|
+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
14
|
+
|
|
15
|
+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
16
|
+
#foo/**/qux
|
|
17
|
+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
18
|
+
|
|
19
|
+
# You can also negate patterns with an exclamation (!).
|
|
20
|
+
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
21
|
+
#docs/*.md
|
|
22
|
+
# Then explicitly reverse the ignore rule for a single file:
|
|
23
|
+
#!docs/README.md
|