yapp 5.0.8 → 5.0.11
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.md +53 -121
- package/example.js +254 -283
- package/lib/div/gutter.js +2 -2
- package/lib/div/lineNumbers.js +2 -2
- package/lib/div/pretty.js +2 -2
- package/lib/div/syntax.js +2 -2
- package/lib/example/yapp.js +6 -26
- package/lib/prettyPrinter.js +2 -2
- package/lib/renderYappStyles.js +2 -4
- package/lib/richTextarea.js +3 -13
- package/lib/style/firaCode.js +4 -2
- package/lib/style/yapp.js +3 -2
- package/lib/utilities/configuration.js +24 -0
- package/lib/yapp.js +7 -7
- package/package.json +1 -1
- package/src/div/gutter.js +0 -6
- package/src/div/lineNumbers.js +4 -10
- package/src/div/pretty.js +0 -4
- package/src/div/syntax.js +0 -4
- package/src/example/yapp.js +2 -8
- package/src/prettyPrinter.js +0 -4
- package/src/renderYappStyles.js +1 -3
- package/src/richTextarea.js +0 -35
- package/src/style/firaCode.js +3 -1
- package/src/style/yapp.js +52 -13
- package/src/utilities/{properties.js → configuration.js} +2 -2
- package/src/yapp.js +5 -5
- package/lib/utilities/properties.js +0 -24
package/src/div/syntax.js
CHANGED
|
@@ -100,15 +100,11 @@ export default withStyle(SyntaxDiv)`
|
|
|
100
100
|
user-select: none;
|
|
101
101
|
pointer-events: none;
|
|
102
102
|
|
|
103
|
-
color: inherit;
|
|
104
103
|
font-size: inherit;
|
|
105
104
|
line-height: inherit;
|
|
106
105
|
font-family: inherit;
|
|
107
106
|
font-weight: inherit;
|
|
108
|
-
caret-color: inherit;
|
|
109
|
-
border-color: inherit;
|
|
110
107
|
text-rendering: inherit;
|
|
111
|
-
background-color: inherit;
|
|
112
108
|
font-feature-settings: inherit;
|
|
113
109
|
|
|
114
110
|
`;
|
package/src/example/yapp.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import withStyle from "easy-with-style"; ///
|
|
4
|
-
|
|
5
3
|
import Yapp from "../index"; ///
|
|
6
4
|
|
|
7
|
-
export default
|
|
5
|
+
export default class extends Yapp {
|
|
8
6
|
static defaultProperties = {
|
|
9
7
|
editable: true,
|
|
10
8
|
autoHeight: false,
|
|
11
9
|
fancyScrollbars: true
|
|
12
10
|
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
border-color: #666;
|
|
16
|
-
|
|
17
|
-
`;
|
|
11
|
+
}
|
package/src/prettyPrinter.js
CHANGED
|
@@ -99,15 +99,11 @@ export default withStyle(PrettyPrinter)`
|
|
|
99
99
|
grid-template-areas: "gutter pretty-rich-textarea";
|
|
100
100
|
grid-template-columns: min-content auto;
|
|
101
101
|
|
|
102
|
-
color: inherit;
|
|
103
102
|
font-size: inherit;
|
|
104
103
|
line-height: inherit;
|
|
105
104
|
font-family: inherit;
|
|
106
105
|
font-weight: inherit;
|
|
107
|
-
caret-color: inherit;
|
|
108
|
-
border-color: inherit;
|
|
109
106
|
text-rendering: inherit;
|
|
110
|
-
background-color: transparent;
|
|
111
107
|
font-feature-settings: inherit;
|
|
112
108
|
|
|
113
109
|
`;
|
package/src/renderYappStyles.js
CHANGED
|
@@ -6,11 +6,9 @@ import yappStyle from "./style/yapp"
|
|
|
6
6
|
import syntaxStyle from "./style/syntax"
|
|
7
7
|
import firaCodeStyle from "./style/firaCode"
|
|
8
8
|
|
|
9
|
-
import { DEFAULT_HOST } from "./defaults";
|
|
10
|
-
|
|
11
9
|
const { renderStyle } = withStyle;
|
|
12
10
|
|
|
13
|
-
export function renderYappStyles(host
|
|
11
|
+
export function renderYappStyles(host) {
|
|
14
12
|
renderStyle(yappStyle);
|
|
15
13
|
|
|
16
14
|
renderStyle(syntaxStyle);
|
package/src/richTextarea.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
5
|
import { RichTextarea } from "easy-richtextarea";
|
|
6
|
-
import { scrollbarThickness, scrollbarThumbBorderRadius } from "./styles";
|
|
7
|
-
import { scrollbarColour, selectionColour, backgroundColour, selectionBackgroundColour } from "./scheme/colour";
|
|
8
6
|
|
|
9
7
|
export default withStyle(class extends RichTextarea {
|
|
10
8
|
didMount() {
|
|
@@ -76,48 +74,15 @@ export default withStyle(class extends RichTextarea {
|
|
|
76
74
|
overflow-wrap: normal;
|
|
77
75
|
background-color: transparent;
|
|
78
76
|
|
|
79
|
-
::selection {
|
|
80
|
-
color: ${selectionColour};
|
|
81
|
-
background-color: ${selectionBackgroundColour};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
77
|
.hidden-scrollbars {
|
|
85
78
|
overflow: hidden;
|
|
86
79
|
}
|
|
87
80
|
|
|
88
|
-
.fancy-scrollbars {
|
|
89
|
-
scrollbar-color: ${scrollbarColour} transparent;
|
|
90
|
-
scrollbar-gutter: auto;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.fancy-scrollbars::-webkit-scrollbar {
|
|
94
|
-
width: ${scrollbarThickness};
|
|
95
|
-
height: ${scrollbarThickness};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.fancy-scrollbars::-webkit-scrollbar-track {
|
|
99
|
-
display: none;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.fancy-scrollbars::-webkit-scrollbar-thumb {
|
|
103
|
-
border: 2px solid ${backgroundColour};
|
|
104
|
-
border-radius: ${scrollbarThumbBorderRadius};
|
|
105
|
-
background-color: ${scrollbarColour};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.fancy-scrollbars::-webkit-scrollbar-corner {
|
|
109
|
-
display: none;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
color: transparent;
|
|
113
81
|
font-size: inherit;
|
|
114
82
|
line-height: inherit;
|
|
115
83
|
font-family: inherit;
|
|
116
84
|
font-weight: inherit;
|
|
117
|
-
caret-color: inherit;
|
|
118
|
-
border-color: initial;
|
|
119
85
|
text-rendering: inherit;
|
|
120
|
-
background-color: transparent;
|
|
121
86
|
font-feature-settings: inherit;
|
|
122
87
|
|
|
123
88
|
`;
|
package/src/style/firaCode.js
CHANGED
package/src/style/yapp.js
CHANGED
|
@@ -1,33 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { scrollbarThickness, scrollbarThumbBorderRadius } from "../styles";
|
|
4
|
+
import { colour, caretColour, borderColour, scrollbarColour, selectionColour, backgroundColour, selectionBackgroundColour } from "../scheme/colour";
|
|
4
5
|
|
|
5
6
|
const yappStyle = `
|
|
6
7
|
|
|
7
8
|
.yapp {
|
|
8
9
|
width: 100%;
|
|
9
10
|
height: 100%;
|
|
10
|
-
border: 1px solid;
|
|
11
|
+
border: 1px solid ${borderColour};
|
|
12
|
+
background-color: ${backgroundColour};
|
|
11
13
|
|
|
12
|
-
color: ${colour};
|
|
13
14
|
font-size: 13px;
|
|
14
15
|
line-height: 20px;
|
|
15
16
|
font-family: "Menlo", "Lucida Sans Typewriter", monospace;
|
|
16
17
|
font-weight: normal;
|
|
17
|
-
caret-color: ${caretColour};
|
|
18
|
-
border-color: ${borderColour};
|
|
19
18
|
text-rendering: initial;
|
|
20
|
-
background-color: ${backgroundColour};
|
|
21
19
|
font-feature-settings: initial;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.yapp.fira-code {
|
|
23
|
+
font-family: "Fira Code";
|
|
24
|
+
text-rendering: optimizeLegibility;
|
|
25
|
+
font-feature-settings: "calt" 1;
|
|
26
|
+
}
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
.yapp>.pretty-printer>.gutter {
|
|
29
|
+
border-right: 1px dotted ${borderColour};
|
|
30
|
+
}
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
.yapp>.pretty-printer>.gutter>.line-numbers {
|
|
33
|
+
color: ${colour};
|
|
34
|
+
margin: 0 6px 0 6px;
|
|
35
|
+
text-align: right;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.yapp>.pretty-printer textarea.rich {
|
|
39
|
+
caret-color: ${caretColour};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.yapp>.pretty-printer textarea.rich::selection {
|
|
43
|
+
color: ${selectionColour};
|
|
44
|
+
background-color: ${selectionBackgroundColour};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.yapp>.pretty-printer textarea.rich.fancy-scrollbars {
|
|
48
|
+
scrollbar-color: ${scrollbarColour} transparent;
|
|
49
|
+
scrollbar-gutter: auto;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.yapp>.pretty-printer textarea.rich.fancy-scrollbars::-webkit-scrollbar {
|
|
53
|
+
width: ${scrollbarThickness};
|
|
54
|
+
height: ${scrollbarThickness};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.yapp>.pretty-printer textarea.rich.fancy-scrollbars::-webkit-scrollbar-track {
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.yapp>.pretty-printer textarea.rich.fancy-scrollbars::-webkit-scrollbar-thumb {
|
|
62
|
+
border: 2px solid ${backgroundColour};
|
|
63
|
+
border-radius: ${scrollbarThumbBorderRadius};
|
|
64
|
+
background-color: ${scrollbarColour};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.yapp>.pretty-printer textarea.rich.fancy-scrollbars::-webkit-scrollbar-corner {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
31
70
|
|
|
32
71
|
`;
|
|
33
72
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export function
|
|
3
|
+
export function propertiesFromContentAndConfiguration(content, configuration) {
|
|
4
4
|
const text = content, ///
|
|
5
5
|
childElements = [{
|
|
6
6
|
getText: () => text,
|
|
7
7
|
}],
|
|
8
|
-
properties = Object.assign({},
|
|
8
|
+
properties = Object.assign({}, configuration, { ///
|
|
9
9
|
childElements
|
|
10
10
|
});
|
|
11
11
|
|
package/src/yapp.js
CHANGED
|
@@ -7,8 +7,8 @@ import PrettyPrinter from "./prettyPrinter";
|
|
|
7
7
|
|
|
8
8
|
import { pluginFromProperties } from "./utilities/plugin";
|
|
9
9
|
import { getScrollbarThickness } from "./utilities/scrollbar";
|
|
10
|
-
import { propertiesFromContentAndOptions } from "./utilities/properties";
|
|
11
10
|
import { CONTENT_CHANGE_CUSTOM_EVENT_TYPE } from "./customEventTypes";
|
|
11
|
+
import { propertiesFromContentAndConfiguration } from "./utilities/configuration";
|
|
12
12
|
import { lineCountFromContent, contentFromChildElements } from "./utilities/content";
|
|
13
13
|
import { DEFAULT_EDITABLE, DEFAULT_FIRA_CODE, DEFAULT_AUTO_HEIGHT, DEFAULT_HIDDEN_GUTTER, DEFAULT_HIDDEN_SCROLLBARS, DEFAULT_FANCY_SCROLLBARS } from "./defaults";
|
|
14
14
|
|
|
@@ -171,16 +171,16 @@ export default class Yapp extends Element {
|
|
|
171
171
|
return yapp;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
static
|
|
175
|
-
if (
|
|
176
|
-
|
|
174
|
+
static fromContentAndConfiguration(Class, content, configuration) {
|
|
175
|
+
if (configuration === undefined) {
|
|
176
|
+
configuration = content; ///
|
|
177
177
|
|
|
178
178
|
content = Class; ///
|
|
179
179
|
|
|
180
180
|
Class = Yapp;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
const properties =
|
|
183
|
+
const properties = propertiesFromContentAndConfiguration(content, configuration),
|
|
184
184
|
plugin = pluginFromProperties(properties),
|
|
185
185
|
yapp = Element.fromClass(Class, properties, plugin);
|
|
186
186
|
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "propertiesFromContentAndOptions", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return propertiesFromContentAndOptions;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
function propertiesFromContentAndOptions(content, options) {
|
|
12
|
-
var text = content, childElements = [
|
|
13
|
-
{
|
|
14
|
-
getText: function() {
|
|
15
|
-
return text;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
], properties = Object.assign({}, options, {
|
|
19
|
-
childElements: childElements
|
|
20
|
-
});
|
|
21
|
-
return properties;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvcHJvcGVydGllcy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIHByb3BlcnRpZXNGcm9tQ29udGVudEFuZE9wdGlvbnMoY29udGVudCwgb3B0aW9ucykge1xuICBjb25zdCB0ZXh0ID0gY29udGVudCwgLy8vXG4gICAgICAgIGNoaWxkRWxlbWVudHMgPSBbe1xuICAgICAgICAgIGdldFRleHQ6ICgpID0+IHRleHQsXG4gICAgICAgIH1dLFxuICAgICAgICBwcm9wZXJ0aWVzID0gT2JqZWN0LmFzc2lnbih7fSwgb3B0aW9ucywgeyAvLy9cbiAgICAgICAgICBjaGlsZEVsZW1lbnRzXG4gICAgICAgIH0pO1xuXG4gIHJldHVybiBwcm9wZXJ0aWVzO1xufVxuIl0sIm5hbWVzIjpbInByb3BlcnRpZXNGcm9tQ29udGVudEFuZE9wdGlvbnMiLCJjb250ZW50Iiwib3B0aW9ucyIsInRleHQiLCJjaGlsZEVsZW1lbnRzIiwiZ2V0VGV4dCIsInByb3BlcnRpZXMiLCJPYmplY3QiLCJhc3NpZ24iXSwibWFwcGluZ3MiOiJBQUFBOzs7OytCQUVnQkE7OztlQUFBQTs7O0FBQVQsU0FBU0EsZ0NBQWdDQyxPQUFPLEVBQUVDLE9BQU87SUFDOUQsSUFBTUMsT0FBT0YsU0FDUEcsZ0JBQWdCO1FBQUM7WUFDZkMsU0FBUzt1QkFBTUY7O1FBQ2pCO0tBQUUsRUFDRkcsYUFBYUMsT0FBT0MsTUFBTSxDQUFDLENBQUMsR0FBR04sU0FBUztRQUN0Q0UsZUFBQUE7SUFDRjtJQUVOLE9BQU9FO0FBQ1QifQ==
|