solarite 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.
- package/build/build.bat +3 -0
- package/build/build.js +139 -0
- package/build/lib/rollup.min.js +11 -0
- package/build/lib/source-map.min.js +1 -0
- package/build/lib/terser.min.js +1 -0
- package/dist/Solarite-debug.js +4143 -0
- package/dist/Solarite.js +3740 -0
- package/dist/Solarite.min.js +4 -0
- package/docs/index.md +423 -0
- package/docs/js/Playground.js +184 -0
- package/docs/js/codemirror/codemirror6.js +32036 -0
- package/docs/js/codemirror/themeSolarIce.js +312 -0
- package/docs/js/documentation.js +32 -0
- package/docs/js/ui/CodeEditor.js +840 -0
- package/docs/js/ui/DarkToggle.js +52 -0
- package/docs/js/ui/FlexResizer.js +142 -0
- package/docs/js/util/Draggable2.js +151 -0
- package/docs/js/util/Errors.js +9 -0
- package/docs/js/util/Html.js +147 -0
- package/docs/js/util/Icons.js +623 -0
- package/docs/js/util/Input.js +253 -0
- package/docs/js/util/Util.js +88 -0
- package/docs/js/util/delve.js +43 -0
- package/docs/media/FiraCode400.woff2 +0 -0
- package/docs/media/cabin-latin-700.woff2 +0 -0
- package/docs/media/documentation.css +93 -0
- package/docs/media/eternium.css +1123 -0
- package/docs/media/solarite-machine.webp +0 -0
- package/index.html +325 -0
- package/package.json +33 -0
- package/readme.md +3 -0
- package/src/solarite/ExprPath.js +554 -0
- package/src/solarite/MultiValueMap.js +65 -0
- package/src/solarite/NodeGroup.js +706 -0
- package/src/solarite/NodeGroupManager.js +582 -0
- package/src/solarite/Shell.js +307 -0
- package/src/solarite/Solarite.js +19 -0
- package/src/solarite/Template.js +85 -0
- package/src/solarite/Util.js +264 -0
- package/src/solarite/createSolarite.js +267 -0
- package/src/solarite/getArg.js +99 -0
- package/src/solarite/hash.js +101 -0
- package/src/solarite/r.js +143 -0
- package/src/solarite/udomdiff.js +233 -0
- package/src/solarite/watch.js +302 -0
- package/src/solarite/watch2.js +439 -0
- package/src/unused/FastLookupArray.js +54 -0
- package/src/unused/Hashes.js +339 -0
- package/src/unused/InUse.test.js +92 -0
- package/src/unused/InUseMap.js +98 -0
- package/src/unused/LinkedList.js +117 -0
- package/src/unused/LinkedList.test.js +115 -0
- package/src/unused/Perf.js +47 -0
- package/src/unused/Template.js +108 -0
- package/src/util/Errors.js +9 -0
- package/src/util/Util.js +88 -0
- package/src/util/delve.js +43 -0
- package/tests/Benchmark.test.js +319 -0
- package/tests/NodeGroup.test.js +115 -0
- package/tests/Shell.test.js +75 -0
- package/tests/Solarite.test.js +2896 -0
- package/tests/Testimony.js +602 -0
- package/tests/index.html +75 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import {EditorView, HighlightStyle, syntaxHighlighting, tags as t} from './codemirror6.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Use warm colors for xml-like languages, cool colors for other languages.
|
|
6
|
+
* @param lang {string} Can be 'js', 'md', 'htaccess', etc. The file extension.
|
|
7
|
+
* @param isDark
|
|
8
|
+
* @returns {*[]} */
|
|
9
|
+
function themeSolarIce(lang, isDark=false) {
|
|
10
|
+
|
|
11
|
+
// Re-used colors
|
|
12
|
+
const
|
|
13
|
+
stone = "#7d8799",
|
|
14
|
+
text = isDark ? "#aaa" : 'black',
|
|
15
|
+
darkBackground = "#21252b",
|
|
16
|
+
highlightBackground = isDark ? "#2c313a" : '#ddd',
|
|
17
|
+
background = isDark ? "#06090c" : 'white',
|
|
18
|
+
tooltipBackground = "#353a42",
|
|
19
|
+
selection = isDark ? "#234" : '#ccc',
|
|
20
|
+
cursor = "#528bff"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// Editor theme styles.
|
|
24
|
+
const solarIceTheme = EditorView.theme({
|
|
25
|
+
"&": { // parent selector
|
|
26
|
+
color: text,
|
|
27
|
+
backgroundColor: background,
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
".cm-content": {
|
|
31
|
+
caretColor: cursor,
|
|
32
|
+
//fontFamily: 'Hack',
|
|
33
|
+
fontSize: window.outerWidth > 512 ? '13px' : '12px',
|
|
34
|
+
//lineHeight: 1
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
".cm-cursor, .cm-dropCursor": {borderLeftColor: cursor},
|
|
38
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection },
|
|
39
|
+
|
|
40
|
+
".cm-panels": {backgroundColor: darkBackground, color: text},
|
|
41
|
+
".cm-panels.cm-panels-top": {borderBottom: "2px solid black"},
|
|
42
|
+
".cm-panels.cm-panels-bottom": {borderTop: "2px solid black"},
|
|
43
|
+
|
|
44
|
+
".cm-searchMatch": {
|
|
45
|
+
backgroundColor: "#72a1ff59",
|
|
46
|
+
outline: "1px solid #457dff"
|
|
47
|
+
},
|
|
48
|
+
".cm-searchMatch.cm-searchMatch-selected": {
|
|
49
|
+
backgroundColor: "#6199ff2f"
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
".cm-activeLine": {backgroundColor: "transparent"}, // Transparent b/c it's drawn on top of selection. CodeMirror bug.
|
|
53
|
+
".cm-selectionMatch": {backgroundColor: isDark ? "#aafe661a" : '#eee'}, // Mark occurances
|
|
54
|
+
|
|
55
|
+
"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": {
|
|
56
|
+
backgroundColor: "#bad0f847"
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
".cm-gutters": {
|
|
60
|
+
backgroundColor: background,
|
|
61
|
+
color: stone,
|
|
62
|
+
border: "none"
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
":focus-within .cm-activeLineGutter": {
|
|
66
|
+
backgroundColor: highlightBackground
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
".cm-foldPlaceholder": {
|
|
70
|
+
backgroundColor: "transparent",
|
|
71
|
+
border: "none",
|
|
72
|
+
color: "#ddd"
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
".cm-tooltip": {
|
|
76
|
+
border: "none",
|
|
77
|
+
backgroundColor: tooltipBackground
|
|
78
|
+
},
|
|
79
|
+
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
80
|
+
borderTopColor: "transparent",
|
|
81
|
+
borderBottomColor: "transparent"
|
|
82
|
+
},
|
|
83
|
+
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
84
|
+
borderTopColor: tooltipBackground,
|
|
85
|
+
borderBottomColor: tooltipBackground
|
|
86
|
+
},
|
|
87
|
+
".cm-tooltip-autocomplete": {
|
|
88
|
+
"& > ul > li[aria-selected]": {
|
|
89
|
+
backgroundColor: highlightBackground,
|
|
90
|
+
color: text
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, {dark: true})
|
|
94
|
+
|
|
95
|
+
// Code styles
|
|
96
|
+
let styles = [
|
|
97
|
+
|
|
98
|
+
// Universal
|
|
99
|
+
{
|
|
100
|
+
tag: [t.comment],
|
|
101
|
+
color: isDark ? '#0c0' : '#060'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
tag: [t.docComment], // doesn't work?
|
|
105
|
+
color: '#49c',
|
|
106
|
+
fontWeight: 'bold'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
tag: [t.docString], // doesn't work?
|
|
110
|
+
color: '#49c'
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
// Html
|
|
114
|
+
{
|
|
115
|
+
tag: [t.angleBracket, t.documentMeta], // t.meta is the doctype
|
|
116
|
+
color: isDark ? '#b32' : '#e00'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
tag: [t.attributeValue],
|
|
120
|
+
color: isDark ? '#d60' : '#f50'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
tag: [t.character], // html entity
|
|
124
|
+
color: isDark ? '#880' : '#880'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
tag: [t.content], // Text in html
|
|
128
|
+
color: isDark ? '#987' : '#210'
|
|
129
|
+
},
|
|
130
|
+
// Html and css
|
|
131
|
+
{
|
|
132
|
+
tag: [t.tagName], // Tag name selector
|
|
133
|
+
color: lang === 'css'
|
|
134
|
+
? (isDark ? '#26f' : '#00f')
|
|
135
|
+
: (isDark ? '#b32' : '#e00') // html/php
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
tag: [t.attributeName],
|
|
139
|
+
color: lang === 'css'
|
|
140
|
+
? (isDark ? '#469' : '#469')
|
|
141
|
+
: (isDark ? '#885b22' : '#600')
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
// CSS
|
|
145
|
+
{
|
|
146
|
+
tag: [t.atom], // Css value like 'Arial' or 'none'. Keyword 'super' in javascript
|
|
147
|
+
color: lang === 'js'
|
|
148
|
+
? (isDark ? '#26f' : '#00f')
|
|
149
|
+
: (isDark ? '#75f' : '')
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
tag: [t.unit],
|
|
153
|
+
color: isDark ? '#95a' : ''
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
tag: [t.color],
|
|
157
|
+
color: isDark ? '#95a' : '#60b'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
tag: [t.constant(t.name)], // pseudo-selector
|
|
161
|
+
color: isDark ? '#598' : '#18a'
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
// C-like
|
|
165
|
+
{
|
|
166
|
+
tag: [t.keyword, t.modifier, t.self], // public/private/protected, css selector. self=this keyword.
|
|
167
|
+
color: isDark ? '#26f' : '#00f',
|
|
168
|
+
fontWeight: 'bold'
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
tag: [t.bool, t.typeName],
|
|
172
|
+
color: isDark ? '#26f' : '#00f'
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
tag: [t.function(t.name)],
|
|
176
|
+
color: isDark ? '#598' : '#18a'
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
tag: [t.name, t.propertyName],
|
|
180
|
+
color: isDark ? '#469' : '#038'
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
tag: [t.constant],
|
|
184
|
+
color: isDark ? '#598' : '#598'
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
tag: [t.labelName],
|
|
188
|
+
color: isDark ? '#469' : '#057'
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
{
|
|
193
|
+
tag: [t.number],
|
|
194
|
+
color: isDark ? '#95a' : '#60b'
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
tag: [t.string, t.regexp], // t.string also colors html entities
|
|
198
|
+
color: isDark ? '#75f' : '#60b'
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
tag: [t.separator], // '::' or '->' in php
|
|
202
|
+
color: text
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
tag: t.invalid,
|
|
206
|
+
color: 'red',
|
|
207
|
+
textDecoration: 'underline'
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
// Unused
|
|
212
|
+
{
|
|
213
|
+
tag: [],
|
|
214
|
+
color: '#ff0'
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
// Unknown
|
|
218
|
+
// These will show up as yellow so i can figure ot what they are.
|
|
219
|
+
{
|
|
220
|
+
tag: [t.standard(t.name), t.annotation, t.macroName],
|
|
221
|
+
color: '#ff0'
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
// Markdown:
|
|
226
|
+
{
|
|
227
|
+
tag: t.meta,
|
|
228
|
+
fontWeight: "bold",
|
|
229
|
+
color: '#abc'
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
tag: t.strong,
|
|
233
|
+
fontWeight: "bold",
|
|
234
|
+
color: "#ccc"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
tag: t.emphasis,
|
|
238
|
+
fontStyle: "italic",
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
tag: t.strikethrough,
|
|
242
|
+
textDecoration: "line-through",
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
tag: t.link,
|
|
246
|
+
color: '#469',
|
|
247
|
+
textDecoration: "underline"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
tag: t.heading1,
|
|
251
|
+
fontWeight: "900",
|
|
252
|
+
fontSize: '250%',
|
|
253
|
+
color: 'white',
|
|
254
|
+
backgroundColor: '#08f'
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
tag: t.heading2,
|
|
258
|
+
fontWeight: "bold",
|
|
259
|
+
fontSize: '180%',
|
|
260
|
+
color: isDark ? 'white' : 'black',
|
|
261
|
+
textDecoration: 'underline'
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
tag: t.heading3,
|
|
265
|
+
fontWeight: "bold",
|
|
266
|
+
color: isDark ? 'white' : 'black',
|
|
267
|
+
fontSize: '120%',
|
|
268
|
+
textDecoration: 'underline'
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
tag: t.heading4,
|
|
272
|
+
fontWeight: "bold",
|
|
273
|
+
color: isDark ? 'white' : '#102',
|
|
274
|
+
textDecoration: 'underline'
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
tag: t.heading5,
|
|
278
|
+
color: isDark ? '#acf' : '#035',
|
|
279
|
+
textDecoration: 'underline'
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
tag: t.heading6,
|
|
283
|
+
color: isDark ? '#acf' : '#035',
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
tag: t.quote,
|
|
287
|
+
backgroundColor: isDark ? '#2b313b' : '#def',
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
tag: t.monospace,
|
|
291
|
+
backgroundColor: isDark ? '#1b1e22' : '#def',
|
|
292
|
+
}
|
|
293
|
+
];
|
|
294
|
+
|
|
295
|
+
if (lang==='html' || lang==='php')
|
|
296
|
+
styles.push({
|
|
297
|
+
tag: t.processingInstruction, // php tags
|
|
298
|
+
color: isDark ? '#f0f' : '#f0b',
|
|
299
|
+
fontWeight: 'bold'
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
/// The highlighting style for code.
|
|
303
|
+
// List of things that can be syntax colored at:
|
|
304
|
+
// https://lezer.codemirror.net/docs/ref/#highlight.tags
|
|
305
|
+
// codemirror\node_modules\@lezer\highlight\dist\highlight.d.ts
|
|
306
|
+
var solarIceHighlightStyle = HighlightStyle.define(styles)
|
|
307
|
+
|
|
308
|
+
return [solarIceTheme, syntaxHighlighting(solarIceHighlightStyle)]
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
export default themeSolarIce;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Playground from "./Playground.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
// We have to import like this b/c we're not a module.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
9
|
+
|
|
10
|
+
let dt = new DarkToggle();
|
|
11
|
+
dt.setAttribute('style', 'position: fixed; top: 15px; right: 15px; cursor: pointer; transform: scale(2)');
|
|
12
|
+
document.body.append(dt);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Convert all code blocks to use Playground.js
|
|
17
|
+
for (let pre of document.querySelectorAll('pre.ty-contain-cm')) {
|
|
18
|
+
let lines = [];
|
|
19
|
+
for (let preLine of pre.querySelectorAll('pre.CodeMirror-line > span'))
|
|
20
|
+
lines.push(preLine.textContent.replace(/\xa0/g, ' ').replace(/\n$/g, '').replace(/ /g, '\t'))
|
|
21
|
+
|
|
22
|
+
let prefix = `
|
|
23
|
+
<style>
|
|
24
|
+
html[dark] { background: black; color: white }
|
|
25
|
+
body { font: 12px Arial; background: transparent !important }
|
|
26
|
+
</style>`;
|
|
27
|
+
let value = lines.join('\n');
|
|
28
|
+
|
|
29
|
+
let pg = new Playground({value, language: pre.getAttribute('lang'), width: 75, maxHeight: 620, prefix, limitCodeEditorHeight: true})
|
|
30
|
+
pre.replaceWith(pg);
|
|
31
|
+
}
|
|
32
|
+
})
|