@valkyrianlabs/payload-markdown 1.3.1
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 +21 -0
- package/README.md +222 -0
- package/dist/blocks/MarkdownBlock/Component.d.ts +2 -0
- package/dist/blocks/MarkdownBlock/Component.js +13 -0
- package/dist/blocks/MarkdownBlock/Component.js.map +1 -0
- package/dist/blocks/MarkdownBlock/config.d.ts +2 -0
- package/dist/blocks/MarkdownBlock/config.js +20 -0
- package/dist/blocks/MarkdownBlock/config.js.map +1 -0
- package/dist/blocks/MarkdownBlock/types.d.js +3 -0
- package/dist/blocks/MarkdownBlock/types.d.js.map +1 -0
- package/dist/components/MarkdownRenderer/Component.client.d.ts +5 -0
- package/dist/components/MarkdownRenderer/Component.client.js +163 -0
- package/dist/components/MarkdownRenderer/Component.client.js.map +1 -0
- package/dist/components/MarkdownRenderer/Component.d.ts +3 -0
- package/dist/components/MarkdownRenderer/Component.js +87 -0
- package/dist/components/MarkdownRenderer/Component.js.map +1 -0
- package/dist/components/MarkdownRenderer/index.css +69 -0
- package/dist/components/MarkdownRenderer/index.module.css +45 -0
- package/dist/components/MarkdownRenderer/index.module.scss +43 -0
- package/dist/components/MarkdownRenderer/index.scss +83 -0
- package/dist/components/MarkdownRenderer/types.d.js +5 -0
- package/dist/components/MarkdownRenderer/types.d.js.map +1 -0
- package/dist/core/codeConfig.d.ts +6 -0
- package/dist/core/codeConfig.js +45 -0
- package/dist/core/codeConfig.js.map +1 -0
- package/dist/core/codeToHtml.d.ts +5 -0
- package/dist/core/codeToHtml.js +180 -0
- package/dist/core/codeToHtml.js.map +1 -0
- package/dist/core/plugins/rehypeApplyLayoutClasses.d.ts +4 -0
- package/dist/core/plugins/rehypeApplyLayoutClasses.js +72 -0
- package/dist/core/plugins/rehypeApplyLayoutClasses.js.map +1 -0
- package/dist/core/plugins/rehypeStripAuthoredInlineStyles.d.ts +3 -0
- package/dist/core/plugins/rehypeStripAuthoredInlineStyles.js +17 -0
- package/dist/core/plugins/rehypeStripAuthoredInlineStyles.js.map +1 -0
- package/dist/core/plugins/remarkCompileLayouts.d.ts +3 -0
- package/dist/core/plugins/remarkCompileLayouts.js +169 -0
- package/dist/core/plugins/remarkCompileLayouts.js.map +1 -0
- package/dist/core/plugins/remarkHeadingAnchorsAndToc.d.ts +3 -0
- package/dist/core/plugins/remarkHeadingAnchorsAndToc.js +68 -0
- package/dist/core/plugins/remarkHeadingAnchorsAndToc.js.map +1 -0
- package/dist/core/plugins/remarkLayoutDirectives.d.ts +3 -0
- package/dist/core/plugins/remarkLayoutDirectives.js +26 -0
- package/dist/core/plugins/remarkLayoutDirectives.js.map +1 -0
- package/dist/core/plugins/remarkLayoutSentinels.d.ts +3 -0
- package/dist/core/plugins/remarkLayoutSentinels.js +184 -0
- package/dist/core/plugins/remarkLayoutSentinels.js.map +1 -0
- package/dist/core/plugins/remarkLiftLayoutDirectives.d.ts +3 -0
- package/dist/core/plugins/remarkLiftLayoutDirectives.js +93 -0
- package/dist/core/plugins/remarkLiftLayoutDirectives.js.map +1 -0
- package/dist/core/plugins/remarkNormalizeLayoutSyntax.d.ts +3 -0
- package/dist/core/plugins/remarkValidateDirectiveThemes.d.ts +4 -0
- package/dist/core/plugins/remarkValidateDirectiveThemes.js +28 -0
- package/dist/core/plugins/remarkValidateDirectiveThemes.js.map +1 -0
- package/dist/core/renderMarkdown.d.ts +2 -0
- package/dist/core/renderMarkdown.js +270 -0
- package/dist/core/renderMarkdown.js.map +1 -0
- package/dist/core/types.d.js +7 -0
- package/dist/core/types.d.js.map +1 -0
- package/dist/core/types.d.ts +238 -0
- package/dist/core/types.js +5 -0
- package/dist/core/types.js.map +1 -0
- package/dist/directives/attributes.d.ts +14 -0
- package/dist/directives/attributes.js +121 -0
- package/dist/directives/attributes.js.map +1 -0
- package/dist/directives/definitions/callout.d.ts +6 -0
- package/dist/directives/definitions/callout.js +107 -0
- package/dist/directives/definitions/callout.js.map +1 -0
- package/dist/directives/definitions/card.d.ts +4 -0
- package/dist/directives/definitions/card.js +120 -0
- package/dist/directives/definitions/card.js.map +1 -0
- package/dist/directives/definitions/cards.d.ts +7 -0
- package/dist/directives/definitions/cards.js +72 -0
- package/dist/directives/definitions/cards.js.map +1 -0
- package/dist/directives/definitions/cell.d.ts +4 -0
- package/dist/directives/definitions/cell.js +44 -0
- package/dist/directives/definitions/cell.js.map +1 -0
- package/dist/directives/definitions/columns.d.ts +4 -0
- package/dist/directives/definitions/columns.js +89 -0
- package/dist/directives/definitions/columns.js.map +1 -0
- package/dist/directives/definitions/details.d.ts +2 -0
- package/dist/directives/definitions/details.js +76 -0
- package/dist/directives/definitions/details.js.map +1 -0
- package/dist/directives/definitions/section.d.ts +2 -0
- package/dist/directives/definitions/section.js +32 -0
- package/dist/directives/definitions/section.js.map +1 -0
- package/dist/directives/definitions/steps.d.ts +2 -0
- package/dist/directives/definitions/steps.js +242 -0
- package/dist/directives/definitions/steps.js.map +1 -0
- package/dist/directives/definitions/tab.d.ts +8 -0
- package/dist/directives/definitions/tab.js +59 -0
- package/dist/directives/definitions/tab.js.map +1 -0
- package/dist/directives/definitions/tabs.d.ts +2 -0
- package/dist/directives/definitions/tabs.js +197 -0
- package/dist/directives/definitions/tabs.js.map +1 -0
- package/dist/directives/definitions/toc.d.ts +7 -0
- package/dist/directives/definitions/toc.js +59 -0
- package/dist/directives/definitions/toc.js.map +1 -0
- package/dist/directives/diagnostics.d.ts +8 -0
- package/dist/directives/diagnostics.js +167 -0
- package/dist/directives/diagnostics.js.map +1 -0
- package/dist/directives/headingAnchors.d.ts +9 -0
- package/dist/directives/headingAnchors.js +54 -0
- package/dist/directives/headingAnchors.js.map +1 -0
- package/dist/directives/index.d.ts +5 -0
- package/dist/directives/index.js +6 -0
- package/dist/directives/index.js.map +1 -0
- package/dist/directives/registry.d.ts +20 -0
- package/dist/directives/registry.js +152 -0
- package/dist/directives/registry.js.map +1 -0
- package/dist/directives/renderData.d.ts +3 -0
- package/dist/directives/renderData.js +11 -0
- package/dist/directives/renderData.js.map +1 -0
- package/dist/directives/themes.d.ts +25 -0
- package/dist/directives/themes.js +274 -0
- package/dist/directives/themes.js.map +1 -0
- package/dist/directives/types.d.ts +72 -0
- package/dist/directives/types.js +3 -0
- package/dist/directives/types.js.map +1 -0
- package/dist/editor/MarkdownCodeMirror/Component.client.d.ts +8 -0
- package/dist/editor/MarkdownCodeMirror/Component.client.js +78 -0
- package/dist/editor/MarkdownCodeMirror/Component.client.js.map +1 -0
- package/dist/editor/MarkdownCodeMirror/Component.d.ts +9 -0
- package/dist/editor/MarkdownCodeMirror/Component.js +10 -0
- package/dist/editor/MarkdownCodeMirror/Component.js.map +1 -0
- package/dist/editor/MarkdownCodeMirror.d.ts +8 -0
- package/dist/editor/MarkdownCodeMirror.js +74 -0
- package/dist/editor/MarkdownCodeMirror.js.map +1 -0
- package/dist/editor/MarkdownEditor.d.ts +10 -0
- package/dist/editor/MarkdownEditor.js +22 -0
- package/dist/editor/MarkdownEditor.js.map +1 -0
- package/dist/editor/directives/completions.d.ts +5 -0
- package/dist/editor/directives/completions.js +93 -0
- package/dist/editor/directives/completions.js.map +1 -0
- package/dist/editor/directives/diagnostics.d.ts +1 -0
- package/dist/editor/directives/diagnostics.js +12 -0
- package/dist/editor/directives/diagnostics.js.map +1 -0
- package/dist/editor/themes/payload.d.ts +27 -0
- package/dist/editor/themes/payload.js +269 -0
- package/dist/editor/themes/payload.js.map +1 -0
- package/dist/editor/themes/support/highlighters.d.ts +20 -0
- package/dist/editor/themes/support/highlighters.js +1141 -0
- package/dist/editor/themes/support/highlighters.js.map +1 -0
- package/dist/editor/themes/support/lang.d.ts +40 -0
- package/dist/editor/themes/support/lang.js +201 -0
- package/dist/editor/themes/support/lang.js.map +1 -0
- package/dist/exports/advanced.d.ts +3 -0
- package/dist/exports/advanced.js +5 -0
- package/dist/exports/advanced.js.map +1 -0
- package/dist/exports/client.d.ts +1 -0
- package/dist/exports/client.js +2 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/server.d.ts +3 -0
- package/dist/exports/server.js +5 -0
- package/dist/exports/server.js.map +1 -0
- package/dist/field/BlocksParams/config.d.ts +7 -0
- package/dist/field/BlocksParams/config.js +149 -0
- package/dist/field/BlocksParams/config.js.map +1 -0
- package/dist/field/CodeBlock/config.d.ts +7 -0
- package/dist/field/CodeBlock/config.js +321 -0
- package/dist/field/CodeBlock/config.js.map +1 -0
- package/dist/field/CodeBlockConfig/config.d.ts +7 -0
- package/dist/field/CodeBlockConfig/config.js +306 -0
- package/dist/field/CodeBlockConfig/config.js.map +1 -0
- package/dist/field/CodeBlockParams/config.d.ts +7 -0
- package/dist/field/CodeBlockParams/config.js +321 -0
- package/dist/field/CodeBlockParams/config.js.map +1 -0
- package/dist/field/Config/config.d.ts +7 -0
- package/dist/field/Config/config.js +149 -0
- package/dist/field/Config/config.js.map +1 -0
- package/dist/field/MarkdownField/Component.d.ts +2 -0
- package/dist/field/MarkdownField/Component.js +42 -0
- package/dist/field/MarkdownField/Component.js.map +1 -0
- package/dist/field/MarkdownField/config.d.ts +3 -0
- package/dist/field/MarkdownField/config.js +20 -0
- package/dist/field/MarkdownField/config.js.map +1 -0
- package/dist/field/Tailwind/config.d.ts +9 -0
- package/dist/field/Tailwind/config.js +13 -0
- package/dist/field/Tailwind/config.js.map +1 -0
- package/dist/field/TailwindField/config.d.ts +9 -0
- package/dist/field/TailwindField/config.js +13 -0
- package/dist/field/TailwindField/config.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime/index.d.ts +36 -0
- package/dist/runtime/index.js +124 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/styles/directiveSurface.d.ts +11 -0
- package/dist/styles/directiveSurface.js +38 -0
- package/dist/styles/directiveSurface.js.map +1 -0
- package/dist/types/core.d.ts +285 -0
- package/dist/types/core.js +5 -0
- package/dist/types/core.js.map +1 -0
- package/dist/types/layoutToken.d.ts +1 -0
- package/dist/types/layoutToken.js +3 -0
- package/dist/types/layoutToken.js.map +1 -0
- package/dist/types/mdast.d.js +5 -0
- package/dist/types/mdast.d.js.map +1 -0
- package/dist/types.d.js +3 -0
- package/dist/types.d.js.map +1 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +181 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { markdown } from '@codemirror/lang-markdown';
|
|
2
|
+
import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
3
|
+
import { EditorView } from '@codemirror/view';
|
|
4
|
+
import { tags as t, Tag } from '@lezer/highlight';
|
|
5
|
+
import { supportedLangHighlight } from './support/highlighters.js';
|
|
6
|
+
import { languages } from './support/lang.js';
|
|
7
|
+
const activeLine = '#6699ff0b', bracketMatch = '#bad0f847', chalky = '#e5c07b', coral = '#e06c75', cursor = '#a5edff', cyan = '#56b6c2', highlightBackground = '#2c313a', invalid = '#ff6b81', ivory = '#c4c9d5', malibu = '#61afef', sage = '#98c379', searchMatch = '#72a1ff59', searchMatchOutline = '#457dff', selection = '#ffffff', selectionBackground = '#3E4451', selectionMatch = '#aafe661a', stone = '#7d8799', tooltipBackground = '#353a42', violet = '#e47cd2', whiskey = '#d19a66';
|
|
8
|
+
export const color = {
|
|
9
|
+
activeLine,
|
|
10
|
+
bracketMatch,
|
|
11
|
+
chalky,
|
|
12
|
+
coral,
|
|
13
|
+
cursor,
|
|
14
|
+
cyan,
|
|
15
|
+
highlightBackground,
|
|
16
|
+
invalid,
|
|
17
|
+
ivory,
|
|
18
|
+
malibu,
|
|
19
|
+
sage,
|
|
20
|
+
searchMatch,
|
|
21
|
+
searchMatchOutline,
|
|
22
|
+
selection,
|
|
23
|
+
selectionBackground,
|
|
24
|
+
selectionMatch,
|
|
25
|
+
stone,
|
|
26
|
+
tooltipBackground,
|
|
27
|
+
violet,
|
|
28
|
+
whiskey
|
|
29
|
+
};
|
|
30
|
+
export const payloadTheme = EditorView.theme({
|
|
31
|
+
'&': {
|
|
32
|
+
backgroundColor: 'transparent',
|
|
33
|
+
color: ivory,
|
|
34
|
+
fontSize: '1.05rem'
|
|
35
|
+
},
|
|
36
|
+
'.cm-content': {
|
|
37
|
+
caretColor: cursor,
|
|
38
|
+
padding: '0.75rem'
|
|
39
|
+
},
|
|
40
|
+
'.cm-scroller': {
|
|
41
|
+
fontFamily: 'monospace'
|
|
42
|
+
},
|
|
43
|
+
'.cm-cursor, .cm-dropCursor': {
|
|
44
|
+
borderLeftColor: cursor
|
|
45
|
+
},
|
|
46
|
+
'.cm-selectionBackground': {
|
|
47
|
+
backgroundColor: selectionBackground
|
|
48
|
+
},
|
|
49
|
+
'.cm-content ::selection': {
|
|
50
|
+
backgroundColor: selectionBackground,
|
|
51
|
+
color: selection
|
|
52
|
+
},
|
|
53
|
+
'.cm-selectionBackground, .cm-content ::selection': {
|
|
54
|
+
color: selection
|
|
55
|
+
},
|
|
56
|
+
'.cm-activeLine': {
|
|
57
|
+
backgroundColor: activeLine
|
|
58
|
+
},
|
|
59
|
+
'.cm-selectionMatch': {
|
|
60
|
+
backgroundColor: selectionMatch
|
|
61
|
+
},
|
|
62
|
+
'&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
|
|
63
|
+
backgroundColor: bracketMatch
|
|
64
|
+
},
|
|
65
|
+
'.cm-gutters': {
|
|
66
|
+
backgroundColor: 'transparent',
|
|
67
|
+
border: 'none',
|
|
68
|
+
color: stone
|
|
69
|
+
},
|
|
70
|
+
'.cm-activeLineGutter': {
|
|
71
|
+
backgroundColor: highlightBackground
|
|
72
|
+
},
|
|
73
|
+
'.cm-searchMatch': {
|
|
74
|
+
backgroundColor: searchMatch,
|
|
75
|
+
outline: `1px solid ${searchMatchOutline}`
|
|
76
|
+
},
|
|
77
|
+
'.cm-searchMatch.cm-searchMatch-selected': {
|
|
78
|
+
backgroundColor: '#6199ff2f'
|
|
79
|
+
},
|
|
80
|
+
'.cm-foldPlaceholder': {
|
|
81
|
+
backgroundColor: 'transparent',
|
|
82
|
+
border: 'none',
|
|
83
|
+
color: ivory
|
|
84
|
+
},
|
|
85
|
+
'.cm-tooltip': {
|
|
86
|
+
backgroundColor: tooltipBackground,
|
|
87
|
+
border: 'none',
|
|
88
|
+
color: ivory
|
|
89
|
+
},
|
|
90
|
+
'.cm-tooltip .cm-tooltip-arrow:before': {
|
|
91
|
+
borderBottomColor: 'transparent',
|
|
92
|
+
borderTopColor: 'transparent'
|
|
93
|
+
},
|
|
94
|
+
'.cm-tooltip .cm-tooltip-arrow:after': {
|
|
95
|
+
borderBottomColor: tooltipBackground,
|
|
96
|
+
borderTopColor: tooltipBackground
|
|
97
|
+
},
|
|
98
|
+
'.cm-tooltip-autocomplete': {
|
|
99
|
+
'& > ul > li[aria-selected]': {
|
|
100
|
+
backgroundColor: highlightBackground,
|
|
101
|
+
color: ivory
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
dark: true
|
|
106
|
+
});
|
|
107
|
+
// Keep custom directive highlighting compatible with keyword semantics
|
|
108
|
+
const mdQualifierTag = Tag.define(t.keyword);
|
|
109
|
+
export const payloadHighlightStyle = HighlightStyle.define([
|
|
110
|
+
// Directives + language keywords
|
|
111
|
+
{
|
|
112
|
+
color: violet,
|
|
113
|
+
tag: [
|
|
114
|
+
mdQualifierTag,
|
|
115
|
+
t.keyword
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
// Names / identifiers that should read warm
|
|
119
|
+
{
|
|
120
|
+
color: coral,
|
|
121
|
+
tag: [
|
|
122
|
+
t.name,
|
|
123
|
+
t.deleted,
|
|
124
|
+
t.character,
|
|
125
|
+
t.propertyName,
|
|
126
|
+
t.macroName
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
// Functions and labels should pop cooler like JetBrains method names
|
|
130
|
+
{
|
|
131
|
+
color: malibu,
|
|
132
|
+
tag: [
|
|
133
|
+
t.function(t.variableName),
|
|
134
|
+
t.function(t.propertyName),
|
|
135
|
+
t.labelName
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
// Constants / enum-like / builtins
|
|
139
|
+
{
|
|
140
|
+
color: whiskey,
|
|
141
|
+
tag: [
|
|
142
|
+
t.color,
|
|
143
|
+
t.constant(t.name),
|
|
144
|
+
t.standard(t.name),
|
|
145
|
+
t.atom,
|
|
146
|
+
t.bool,
|
|
147
|
+
t.special(t.variableName)
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
// Definitions and separators
|
|
151
|
+
{
|
|
152
|
+
color: ivory,
|
|
153
|
+
tag: [
|
|
154
|
+
t.definition(t.name),
|
|
155
|
+
t.separator
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
// Types / classes / annotations / namespaces / numerics
|
|
159
|
+
{
|
|
160
|
+
color: chalky,
|
|
161
|
+
tag: [
|
|
162
|
+
t.typeName,
|
|
163
|
+
t.className,
|
|
164
|
+
t.number,
|
|
165
|
+
t.changed,
|
|
166
|
+
t.annotation,
|
|
167
|
+
t.modifier,
|
|
168
|
+
t.self,
|
|
169
|
+
t.namespace
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
// Operators / escapes / urls / regex / special strings
|
|
173
|
+
{
|
|
174
|
+
color: cyan,
|
|
175
|
+
tag: [
|
|
176
|
+
t.operator,
|
|
177
|
+
t.operatorKeyword,
|
|
178
|
+
t.url,
|
|
179
|
+
t.escape,
|
|
180
|
+
t.regexp,
|
|
181
|
+
t.link,
|
|
182
|
+
t.special(t.string)
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
// Comments + meta
|
|
186
|
+
{
|
|
187
|
+
color: stone,
|
|
188
|
+
tag: [
|
|
189
|
+
t.meta,
|
|
190
|
+
t.comment
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
// Markdown emphasis
|
|
194
|
+
{
|
|
195
|
+
fontWeight: 'bold',
|
|
196
|
+
tag: t.strong
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
fontStyle: 'italic',
|
|
200
|
+
tag: t.emphasis
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
tag: t.strikethrough,
|
|
204
|
+
textDecoration: 'line-through'
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
color: stone,
|
|
208
|
+
tag: t.link,
|
|
209
|
+
textDecoration: 'underline'
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
color: coral,
|
|
213
|
+
fontWeight: 'bold',
|
|
214
|
+
tag: t.heading
|
|
215
|
+
},
|
|
216
|
+
// Strings / inserted text / processing-ish constructs
|
|
217
|
+
{
|
|
218
|
+
color: sage,
|
|
219
|
+
tag: [
|
|
220
|
+
t.processingInstruction,
|
|
221
|
+
t.string,
|
|
222
|
+
t.inserted
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
// Actually-invalid syntax should look wrong
|
|
226
|
+
{
|
|
227
|
+
color: invalid,
|
|
228
|
+
tag: t.invalid
|
|
229
|
+
}
|
|
230
|
+
]);
|
|
231
|
+
const directiveBlock = {
|
|
232
|
+
defineNodes: [
|
|
233
|
+
{
|
|
234
|
+
name: 'DirectiveLine',
|
|
235
|
+
block: true,
|
|
236
|
+
style: mdQualifierTag
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
parseBlock: [
|
|
240
|
+
{
|
|
241
|
+
name: 'DirectiveLine',
|
|
242
|
+
before: 'HTMLBlock',
|
|
243
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
244
|
+
parse (cx, line) {
|
|
245
|
+
const startInLine = line.pos;
|
|
246
|
+
const text = line.text.slice(startInLine);
|
|
247
|
+
if (!text.startsWith(':::')) return false;
|
|
248
|
+
const from = cx.lineStart + startInLine;
|
|
249
|
+
const to = cx.lineStart + line.text.length;
|
|
250
|
+
cx.addElement(cx.elt('DirectiveLine', from, to));
|
|
251
|
+
cx.nextLine();
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
};
|
|
257
|
+
export const payloadMarkdownTheme = [
|
|
258
|
+
payloadTheme,
|
|
259
|
+
syntaxHighlighting(payloadHighlightStyle),
|
|
260
|
+
...supportedLangHighlight,
|
|
261
|
+
markdown({
|
|
262
|
+
codeLanguages: languages,
|
|
263
|
+
extensions: [
|
|
264
|
+
directiveBlock
|
|
265
|
+
]
|
|
266
|
+
})
|
|
267
|
+
];
|
|
268
|
+
|
|
269
|
+
//# sourceMappingURL=payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/themes/payload.ts"],"sourcesContent":["import type { Extension } from '@codemirror/state'\n\nimport { markdown } from '@codemirror/lang-markdown'\nimport { HighlightStyle, syntaxHighlighting } from '@codemirror/language'\nimport { EditorView } from '@codemirror/view'\nimport { tags as t, Tag } from '@lezer/highlight'\n\nimport { supportedLangHighlight } from './support/highlighters.js'\nimport { languages } from './support/lang.js'\n\nconst activeLine = '#6699ff0b',\n bracketMatch = '#bad0f847',\n chalky = '#e5c07b',\n coral = '#e06c75',\n cursor = '#a5edff',\n cyan = '#56b6c2',\n highlightBackground = '#2c313a',\n invalid = '#ff6b81',\n ivory = '#c4c9d5',\n malibu = '#61afef',\n sage = '#98c379',\n searchMatch = '#72a1ff59',\n searchMatchOutline = '#457dff',\n selection = '#ffffff',\n selectionBackground = '#3E4451',\n selectionMatch = '#aafe661a',\n stone = '#7d8799',\n tooltipBackground = '#353a42',\n violet = '#e47cd2',\n whiskey = '#d19a66'\n\nexport const color = {\n activeLine,\n bracketMatch,\n chalky,\n coral,\n cursor,\n cyan,\n highlightBackground,\n invalid,\n ivory,\n malibu,\n sage,\n searchMatch,\n searchMatchOutline,\n selection,\n selectionBackground,\n selectionMatch,\n stone,\n tooltipBackground,\n violet,\n whiskey,\n}\n\nexport const payloadTheme = EditorView.theme(\n {\n '&': {\n backgroundColor: 'transparent',\n color: ivory,\n fontSize: '1.05rem',\n },\n\n '.cm-content': {\n caretColor: cursor,\n padding: '0.75rem',\n },\n\n '.cm-scroller': {\n fontFamily: 'monospace',\n },\n\n '.cm-cursor, .cm-dropCursor': {\n borderLeftColor: cursor,\n },\n\n '.cm-selectionBackground': {\n backgroundColor: selectionBackground,\n },\n\n '.cm-content ::selection': {\n backgroundColor: selectionBackground,\n color: selection,\n },\n\n '.cm-selectionBackground, .cm-content ::selection': {\n color: selection,\n },\n\n '.cm-activeLine': {\n backgroundColor: activeLine,\n },\n\n '.cm-selectionMatch': {\n backgroundColor: selectionMatch,\n },\n\n '&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {\n backgroundColor: bracketMatch,\n },\n\n '.cm-gutters': {\n backgroundColor: 'transparent',\n border: 'none',\n color: stone,\n },\n\n '.cm-activeLineGutter': {\n backgroundColor: highlightBackground,\n },\n\n '.cm-searchMatch': {\n backgroundColor: searchMatch,\n outline: `1px solid ${searchMatchOutline}`,\n },\n\n '.cm-searchMatch.cm-searchMatch-selected': {\n backgroundColor: '#6199ff2f',\n },\n\n '.cm-foldPlaceholder': {\n backgroundColor: 'transparent',\n border: 'none',\n color: ivory,\n },\n\n '.cm-tooltip': {\n backgroundColor: tooltipBackground,\n border: 'none',\n color: ivory,\n },\n\n '.cm-tooltip .cm-tooltip-arrow:before': {\n borderBottomColor: 'transparent',\n borderTopColor: 'transparent',\n },\n\n '.cm-tooltip .cm-tooltip-arrow:after': {\n borderBottomColor: tooltipBackground,\n borderTopColor: tooltipBackground,\n },\n\n '.cm-tooltip-autocomplete': {\n '& > ul > li[aria-selected]': {\n backgroundColor: highlightBackground,\n color: ivory,\n },\n },\n },\n { dark: true },\n)\n\n// Keep custom directive highlighting compatible with keyword semantics\nconst mdQualifierTag = Tag.define(t.keyword)\n\nexport const payloadHighlightStyle = HighlightStyle.define([\n // Directives + language keywords\n { color: violet, tag: [mdQualifierTag, t.keyword] },\n\n // Names / identifiers that should read warm\n { color: coral, tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName] },\n\n // Functions and labels should pop cooler like JetBrains method names\n { color: malibu, tag: [t.function(t.variableName), t.function(t.propertyName), t.labelName] },\n\n // Constants / enum-like / builtins\n {\n color: whiskey,\n tag: [\n t.color,\n t.constant(t.name),\n t.standard(t.name),\n t.atom,\n t.bool,\n t.special(t.variableName),\n ],\n },\n\n // Definitions and separators\n { color: ivory, tag: [t.definition(t.name), t.separator] },\n\n // Types / classes / annotations / namespaces / numerics\n {\n color: chalky,\n tag: [\n t.typeName,\n t.className,\n t.number,\n t.changed,\n t.annotation,\n t.modifier,\n t.self,\n t.namespace,\n ],\n },\n\n // Operators / escapes / urls / regex / special strings\n {\n color: cyan,\n tag: [t.operator, t.operatorKeyword, t.url, t.escape, t.regexp, t.link, t.special(t.string)],\n },\n\n // Comments + meta\n { color: stone, tag: [t.meta, t.comment] },\n\n // Markdown emphasis\n { fontWeight: 'bold', tag: t.strong },\n { fontStyle: 'italic', tag: t.emphasis },\n { tag: t.strikethrough, textDecoration: 'line-through' },\n { color: stone, tag: t.link, textDecoration: 'underline' },\n { color: coral, fontWeight: 'bold', tag: t.heading },\n\n // Strings / inserted text / processing-ish constructs\n { color: sage, tag: [t.processingInstruction, t.string, t.inserted] },\n\n // Actually-invalid syntax should look wrong\n { color: invalid, tag: t.invalid },\n])\n\nconst directiveBlock = {\n defineNodes: [\n {\n name: 'DirectiveLine',\n block: true,\n style: mdQualifierTag,\n },\n ],\n\n parseBlock: [\n {\n name: 'DirectiveLine',\n before: 'HTMLBlock',\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n parse(cx: any, line: any) {\n const startInLine = line.pos\n const text = line.text.slice(startInLine)\n\n if (!text.startsWith(':::')) return false\n\n const from = cx.lineStart + startInLine\n const to = cx.lineStart + line.text.length\n\n cx.addElement(cx.elt('DirectiveLine', from, to))\n cx.nextLine()\n\n return true\n },\n },\n ],\n}\n\nexport const payloadMarkdownTheme: Extension = [\n payloadTheme,\n syntaxHighlighting(payloadHighlightStyle),\n ...supportedLangHighlight,\n markdown({\n codeLanguages: languages,\n extensions: [directiveBlock],\n }),\n]\n"],"names":["markdown","HighlightStyle","syntaxHighlighting","EditorView","tags","t","Tag","supportedLangHighlight","languages","activeLine","bracketMatch","chalky","coral","cursor","cyan","highlightBackground","invalid","ivory","malibu","sage","searchMatch","searchMatchOutline","selection","selectionBackground","selectionMatch","stone","tooltipBackground","violet","whiskey","color","payloadTheme","theme","backgroundColor","fontSize","caretColor","padding","fontFamily","borderLeftColor","border","outline","borderBottomColor","borderTopColor","dark","mdQualifierTag","define","keyword","payloadHighlightStyle","tag","name","deleted","character","propertyName","macroName","function","variableName","labelName","constant","standard","atom","bool","special","definition","separator","typeName","className","number","changed","annotation","modifier","self","namespace","operator","operatorKeyword","url","escape","regexp","link","string","meta","comment","fontWeight","strong","fontStyle","emphasis","strikethrough","textDecoration","heading","processingInstruction","inserted","directiveBlock","defineNodes","block","style","parseBlock","before","parse","cx","line","startInLine","pos","text","slice","startsWith","from","lineStart","to","length","addElement","elt","nextLine","payloadMarkdownTheme","codeLanguages","extensions"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,4BAA2B;AACpD,SAASC,cAAc,EAAEC,kBAAkB,QAAQ,uBAAsB;AACzE,SAASC,UAAU,QAAQ,mBAAkB;AAC7C,SAASC,QAAQC,CAAC,EAAEC,GAAG,QAAQ,mBAAkB;AAEjD,SAASC,sBAAsB,QAAQ,4BAA2B;AAClE,SAASC,SAAS,QAAQ,oBAAmB;AAE7C,MAAMC,aAAa,aACjBC,eAAe,aACfC,SAAS,WACTC,QAAQ,WACRC,SAAS,WACTC,OAAO,WACPC,sBAAsB,WACtBC,UAAU,WACVC,QAAQ,WACRC,SAAS,WACTC,OAAO,WACPC,cAAc,aACdC,qBAAqB,WACrBC,YAAY,WACZC,sBAAsB,WACtBC,iBAAiB,aACjBC,QAAQ,WACRC,oBAAoB,WACpBC,SAAS,WACTC,UAAU;AAEZ,OAAO,MAAMC,QAAQ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IAAI,CAACM,MAAM;gBAE1CV,GAAGW,UAAU,CAACX,GAAGY,GAAG,CAAC,iBAAiBL,MAAME;gBAC5CT,GAAGa,QAAQ;gBAEX,OAAO;YACT;QACF;KACD;AACH;AAEA,OAAO,MAAMC,uBAAkC;IAC7ChF;IACA5B,mBAAmB4C;OAChBvC;IACHP,SAAS;QACP+G,eAAevG;QACfwG,YAAY;YAACvB;SAAe;IAC9B;CACD,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
export declare const angularHighlight: Extension;
|
|
3
|
+
export declare const cppHighlight: Extension;
|
|
4
|
+
export declare const cssHighlight: Extension;
|
|
5
|
+
export declare const goHighlight: Extension;
|
|
6
|
+
export declare const htmlHighlight: Extension;
|
|
7
|
+
export declare const javaHighlight: Extension;
|
|
8
|
+
export declare const javascriptHighlight: Extension;
|
|
9
|
+
export declare const typescriptHighlight: Extension;
|
|
10
|
+
export declare const jsonHighlight: Extension;
|
|
11
|
+
export declare const markdownHighlight: Extension;
|
|
12
|
+
export declare const phpHighlight: Extension;
|
|
13
|
+
export declare const pythonHighlight: Extension;
|
|
14
|
+
export declare const rustHighlight: Extension;
|
|
15
|
+
export declare const sassHighlight: Extension;
|
|
16
|
+
export declare const sqlHighlight: Extension;
|
|
17
|
+
export declare const vueHighlight: Extension;
|
|
18
|
+
export declare const xmlHighlight: Extension;
|
|
19
|
+
export declare const yamlHighlight: Extension;
|
|
20
|
+
export declare const supportedLangHighlight: Extension[];
|