highmark-markdown 0.0.206 → 0.0.209
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/example.js +9414 -7797
- package/lib/constants.js +13 -1
- package/lib/defaultMarkdownStyle.js +14 -0
- package/lib/example/constants.js +5 -1
- package/lib/example/view/div/preview.js +5 -3
- package/lib/example/view/div/sizeable/left.js +2 -2
- package/lib/example/view/textarea/{bnf.js → css.js} +17 -17
- package/lib/example/view/textarea/{lexicalEntries.js → markdownStyle.js} +25 -19
- package/lib/example/view/xmp.js +2 -2
- package/lib/example/view.js +30 -21
- package/lib/example.js +9 -2
- package/lib/index.js +25 -1
- package/lib/markdownStyle/bnf.js +14 -0
- package/lib/markdownStyle/entries.js +50 -0
- package/lib/markdownStyle/lexer.js +162 -0
- package/lib/{example/view/div/sizeable/right.js → markdownStyle/parser.js} +46 -34
- package/lib/style/declaration.js +72 -0
- package/lib/style/declarations.js +89 -0
- package/lib/style/division.js +83 -0
- package/lib/style/ruleSet.js +85 -0
- package/lib/style/ruleSets.js +89 -0
- package/lib/style/selector.js +131 -0
- package/lib/style/selectors.js +134 -0
- package/lib/style/selectorsList.js +128 -0
- package/lib/styleElement/markdown/default.js +163 -0
- package/lib/styleElement/markdown.js +195 -0
- package/lib/styleElement.js +100 -0
- package/lib/utilities/content.js +29 -4
- package/lib/utilities/css.js +51 -0
- package/lib/utilities/entries.js +24 -0
- package/lib/utilities/query.js +27 -1
- package/package.json +1 -1
- package/src/constants.js +3 -0
- package/src/defaultMarkdownStyle.js +143 -0
- package/src/example/constants.js +1 -0
- package/src/example/view/div/preview.js +5 -2
- package/src/example/view/div/sizeable/left.js +1 -1
- package/src/example/view/textarea/{bnf.js → css.js} +10 -10
- package/src/example/view/textarea/markdownStyle.js +41 -0
- package/src/example/view/xmp.js +0 -3
- package/src/example/view.js +52 -48
- package/src/example.js +10 -1
- package/src/index.js +6 -0
- package/src/markdownStyle/bnf.js +81 -0
- package/src/markdownStyle/entries.js +39 -0
- package/src/markdownStyle/lexer.js +43 -0
- package/src/markdownStyle/parser.js +15 -0
- package/src/style/declaration.js +42 -0
- package/src/style/declarations.js +64 -0
- package/src/style/division.js +46 -0
- package/src/style/ruleSet.js +48 -0
- package/src/style/ruleSets.js +57 -0
- package/src/style/selector.js +126 -0
- package/src/style/selectors.js +121 -0
- package/src/style/selectorsList.js +95 -0
- package/src/styleElement/markdown/default.js +28 -0
- package/src/styleElement/markdown.js +48 -0
- package/src/styleElement.js +49 -0
- package/src/utilities/content.js +27 -0
- package/src/utilities/css.js +41 -0
- package/src/utilities/entries.js +23 -0
- package/src/utilities/query.js +29 -0
- package/lib/example/view/textarea/parseTree.js +0 -183
- package/src/example/view/div/sizeable/right.js +0 -19
- package/src/example/view/textarea/lexicalEntries.js +0 -36
- package/src/example/view/textarea/parseTree.js +0 -50
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import defaultMarkdownStyle from "../../defaultMarkdownStyle";
|
|
4
|
+
import MarkdownStyleElement from "../../styleElement/markdown";
|
|
5
|
+
|
|
6
|
+
export default class DefaultMarkdownStyleElement extends MarkdownStyleElement {
|
|
7
|
+
update(defaultMarkdownStyle) {
|
|
8
|
+
const markdownStyle = defaultMarkdownStyle; ///
|
|
9
|
+
|
|
10
|
+
super.update(markdownStyle)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
reset() {
|
|
14
|
+
this.update(defaultMarkdownStyle)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static fromSelectorsString(Class, selectorsString) {
|
|
18
|
+
if (selectorsString === undefined) {
|
|
19
|
+
selectorsString = Class; ///
|
|
20
|
+
|
|
21
|
+
Class = DefaultMarkdownStyleElement; ///
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const defaultMarkdownStyleElement = MarkdownStyleElement.fromSelectorsString(Class, selectorsString);
|
|
25
|
+
|
|
26
|
+
defaultMarkdownStyleElement.reset();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import StyleElement from "../styleElement";
|
|
4
|
+
import SelectorsList from "../style/selectorsList";
|
|
5
|
+
|
|
6
|
+
import { EMPTY_STRING } from "../constants";
|
|
7
|
+
import { createDOMElement } from "../styleElement";
|
|
8
|
+
import { cssFromMarkdownStyleAndSelectorsList } from "../utilities/css";
|
|
9
|
+
|
|
10
|
+
export default class MarkdownStyleElement extends StyleElement {
|
|
11
|
+
constructor(domElement, selectorsList) {
|
|
12
|
+
super(domElement);
|
|
13
|
+
|
|
14
|
+
this.selectorsList = selectorsList;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getSelectorsList() {
|
|
18
|
+
return this.selectorsList;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
update(markdownStyle = null) {
|
|
22
|
+
const css = cssFromMarkdownStyleAndSelectorsList(markdownStyle, this.selectorsList);
|
|
23
|
+
|
|
24
|
+
this.setCSS(css);
|
|
25
|
+
|
|
26
|
+
return css;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
reset() {
|
|
30
|
+
const markdownStyle = EMPTY_STRING;
|
|
31
|
+
|
|
32
|
+
this.update(markdownStyle)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static fromSelectorsString(Class, selectorString) {
|
|
36
|
+
if (selectorString === undefined) {
|
|
37
|
+
selectorString = Class; ///
|
|
38
|
+
|
|
39
|
+
Class = MarkdownStyleElement; ///
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const domElement = createDOMElement(),
|
|
43
|
+
selectorsList = SelectorsList.fromSelectorsString(selectorString),
|
|
44
|
+
markdownStyleElement = new Class(domElement, selectorsList);
|
|
45
|
+
|
|
46
|
+
return markdownStyleElement;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { HEAD, STYLE } from "./constants";
|
|
4
|
+
|
|
5
|
+
export default class StyleElement {
|
|
6
|
+
constructor(domElement) {
|
|
7
|
+
this.domElement = domElement;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
getDOMElement() {
|
|
11
|
+
return this.domElement;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
setDOMElement(domElement) {
|
|
15
|
+
this.domElement = domElement;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getInnerHTML() { return this.domElement.innerHTML; }
|
|
19
|
+
|
|
20
|
+
setInnerHTML(innerHTML) { this.domElement.innerHTML = innerHTML; }
|
|
21
|
+
|
|
22
|
+
setCSS(css) {
|
|
23
|
+
const innerHTML = `
|
|
24
|
+
${css}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
this.setInnerHTML(innerHTML);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
remove() { this.domElement.remove(); }
|
|
31
|
+
|
|
32
|
+
static fromNothing() {
|
|
33
|
+
const domElement = createDOMElement(),
|
|
34
|
+
styleElement = new StyleElement(domElement);
|
|
35
|
+
|
|
36
|
+
return styleElement;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function createDOMElement() {
|
|
41
|
+
const headDOMElement = document.querySelector(HEAD),
|
|
42
|
+
styleDOMElement = document.createElement(STYLE);
|
|
43
|
+
|
|
44
|
+
headDOMElement.appendChild(styleDOMElement);
|
|
45
|
+
|
|
46
|
+
const domElement = styleDOMElement; ///
|
|
47
|
+
|
|
48
|
+
return domElement;
|
|
49
|
+
}
|
package/src/utilities/content.js
CHANGED
|
@@ -67,6 +67,33 @@ export function contentFromMarkdownNodes(markdownNodes, context, leftTrimmed, ri
|
|
|
67
67
|
return content;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
export function contentFromNodeAndTokens(node, tokens, offset = 0) {
|
|
71
|
+
const firstSignificantToken = node.getFirstSignificantToken(),
|
|
72
|
+
lastSignificantToken = node.getLastSignificantToken(),
|
|
73
|
+
firstToken = firstSignificantToken, ///
|
|
74
|
+
lastToken = lastSignificantToken, ///
|
|
75
|
+
firstTokenIndex = tokens.indexOf(firstToken) + offset, ///
|
|
76
|
+
lastTokenIndex = tokens.indexOf(lastToken);
|
|
77
|
+
|
|
78
|
+
let content = EMPTY_STRING;
|
|
79
|
+
|
|
80
|
+
for (let index = firstTokenIndex; index <= lastTokenIndex; index++) {
|
|
81
|
+
const token = tokens[index],
|
|
82
|
+
tokenContent = token.getContent();
|
|
83
|
+
|
|
84
|
+
content += tokenContent;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return content;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function remainingContentFromNodeTokensAndOffset(node, tokens, offset) {
|
|
91
|
+
const content = contentFromNodeAndTokens(node, tokens, offset),
|
|
92
|
+
remainingContent = content; ///
|
|
93
|
+
|
|
94
|
+
return remainingContent;
|
|
95
|
+
}
|
|
96
|
+
|
|
70
97
|
function tokenContentFromToken(token) {
|
|
71
98
|
let tokenContent = token.getContent();
|
|
72
99
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Division from "../style/division";
|
|
4
|
+
import SelectorsList from "../style/selectorsList";
|
|
5
|
+
import MarkdownStyleLexer from "../markdownStyle/lexer";
|
|
6
|
+
import MarkdownStyleParser from "../markdownStyle/parser";
|
|
7
|
+
|
|
8
|
+
import { EMPTY_STRING } from "../constants";
|
|
9
|
+
|
|
10
|
+
const markdownStyleLexer = MarkdownStyleLexer.fromNothing(),
|
|
11
|
+
markdownStyleParser = MarkdownStyleParser.fromNothing();
|
|
12
|
+
|
|
13
|
+
export function cssFromMarkdownStyleAndSelectorsList(markdownStyle, selectorsList) {
|
|
14
|
+
let css = EMPTY_STRING;
|
|
15
|
+
|
|
16
|
+
const lexer = markdownStyleLexer, ///
|
|
17
|
+
parser = markdownStyleParser, ///
|
|
18
|
+
content = markdownStyle, ///
|
|
19
|
+
tokens = lexer.tokenise(content),
|
|
20
|
+
node = parser.parse(tokens);
|
|
21
|
+
|
|
22
|
+
if (node !== null) {
|
|
23
|
+
const division = Division.fromNodeTokensAndSelectorsList(node, tokens, selectorsList);
|
|
24
|
+
|
|
25
|
+
css = division.asCSS();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return css;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function cssFromMarkdownStyleAndSelectorString(markdownStyle, selectorString) {
|
|
32
|
+
const selectorsList = SelectorsList.fromSelectorsString(selectorString),
|
|
33
|
+
css = cssFromMarkdownStyleAndSelectorsList(markdownStyle, selectorsList);
|
|
34
|
+
|
|
35
|
+
return css;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
cssFromMarkdownStyleAndSelectorsList,
|
|
40
|
+
cssFromMarkdownStyleAndSelectorString
|
|
41
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function ruleNamesExpressionFromElementMap(elementMap) {
|
|
4
|
+
const ruleNames = Object.keys(elementMap);
|
|
5
|
+
|
|
6
|
+
ruleNames.reverse();
|
|
7
|
+
|
|
8
|
+
const ruleNamesExpression = ruleNames.reduce((ruleNamesExpression, ruleName) => {
|
|
9
|
+
const { tagName } = elementMap[ruleName];
|
|
10
|
+
|
|
11
|
+
if (tagName !== null) {
|
|
12
|
+
ruleNamesExpression = (ruleNamesExpression === null) ?
|
|
13
|
+
ruleName :
|
|
14
|
+
`${ruleNamesExpression}|${ruleName}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return ruleNamesExpression;
|
|
18
|
+
}, null);
|
|
19
|
+
|
|
20
|
+
return ruleNamesExpression
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
package/src/utilities/query.js
CHANGED
|
@@ -11,6 +11,35 @@ const linkMarkdownNodesQuery = Query.fromExpression(`//link`),
|
|
|
11
11
|
footnoteMarkdownNodesQuery = Query.fromExpression(`//footnote`),
|
|
12
12
|
referenceMarkdownNodesQuery = Query.fromExpression(`//reference`);
|
|
13
13
|
|
|
14
|
+
export function nodeQuery(expression) {
|
|
15
|
+
const query = Query.fromExpression(expression);
|
|
16
|
+
|
|
17
|
+
return function(node) {
|
|
18
|
+
const nodes = query.execute(node),
|
|
19
|
+
nodesLength = nodes.length;
|
|
20
|
+
|
|
21
|
+
if (nodesLength > 0) {
|
|
22
|
+
const firstNode = first(nodes);
|
|
23
|
+
|
|
24
|
+
node = firstNode; ///
|
|
25
|
+
} else {
|
|
26
|
+
node = null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return node;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function nodesQuery(expression) {
|
|
34
|
+
const query = Query.fromExpression(expression);
|
|
35
|
+
|
|
36
|
+
return function(node) {
|
|
37
|
+
const nodes = query.execute(node);
|
|
38
|
+
|
|
39
|
+
return nodes;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
14
43
|
export function linkMarkdownNodesFromNode(node, linkMarkdownNodes = []) {
|
|
15
44
|
nodesFromNodeAndQuery(node, linkMarkdownNodesQuery, linkMarkdownNodes);
|
|
16
45
|
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _easywithstyle = /*#__PURE__*/ _interop_require_default(require("easy-with-style"));
|
|
12
|
-
var _textarea = /*#__PURE__*/ _interop_require_default(require("../textarea"));
|
|
13
|
-
var _constants = require("../../constants");
|
|
14
|
-
function _assert_this_initialized(self) {
|
|
15
|
-
if (self === void 0) {
|
|
16
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
17
|
-
}
|
|
18
|
-
return self;
|
|
19
|
-
}
|
|
20
|
-
function _class_call_check(instance, Constructor) {
|
|
21
|
-
if (!(instance instanceof Constructor)) {
|
|
22
|
-
throw new TypeError("Cannot call a class as a function");
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function _defineProperties(target, props) {
|
|
26
|
-
for(var i = 0; i < props.length; i++){
|
|
27
|
-
var descriptor = props[i];
|
|
28
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
29
|
-
descriptor.configurable = true;
|
|
30
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
31
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
35
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
36
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
37
|
-
return Constructor;
|
|
38
|
-
}
|
|
39
|
-
function _define_property(obj, key, value) {
|
|
40
|
-
if (key in obj) {
|
|
41
|
-
Object.defineProperty(obj, key, {
|
|
42
|
-
value: value,
|
|
43
|
-
enumerable: true,
|
|
44
|
-
configurable: true,
|
|
45
|
-
writable: true
|
|
46
|
-
});
|
|
47
|
-
} else {
|
|
48
|
-
obj[key] = value;
|
|
49
|
-
}
|
|
50
|
-
return obj;
|
|
51
|
-
}
|
|
52
|
-
function _get_prototype_of(o) {
|
|
53
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
54
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
55
|
-
};
|
|
56
|
-
return _get_prototype_of(o);
|
|
57
|
-
}
|
|
58
|
-
function _inherits(subClass, superClass) {
|
|
59
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
60
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
61
|
-
}
|
|
62
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
63
|
-
constructor: {
|
|
64
|
-
value: subClass,
|
|
65
|
-
writable: true,
|
|
66
|
-
configurable: true
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
70
|
-
}
|
|
71
|
-
function _interop_require_default(obj) {
|
|
72
|
-
return obj && obj.__esModule ? obj : {
|
|
73
|
-
default: obj
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function _possible_constructor_return(self, call) {
|
|
77
|
-
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
78
|
-
return call;
|
|
79
|
-
}
|
|
80
|
-
return _assert_this_initialized(self);
|
|
81
|
-
}
|
|
82
|
-
function _set_prototype_of(o, p) {
|
|
83
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
84
|
-
o.__proto__ = p;
|
|
85
|
-
return o;
|
|
86
|
-
};
|
|
87
|
-
return _set_prototype_of(o, p);
|
|
88
|
-
}
|
|
89
|
-
function _tagged_template_literal(strings, raw) {
|
|
90
|
-
if (!raw) {
|
|
91
|
-
raw = strings.slice(0);
|
|
92
|
-
}
|
|
93
|
-
return Object.freeze(Object.defineProperties(strings, {
|
|
94
|
-
raw: {
|
|
95
|
-
value: Object.freeze(raw)
|
|
96
|
-
}
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
function _type_of(obj) {
|
|
100
|
-
"@swc/helpers - typeof";
|
|
101
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
102
|
-
}
|
|
103
|
-
function _is_native_reflect_construct() {
|
|
104
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
105
|
-
if (Reflect.construct.sham) return false;
|
|
106
|
-
if (typeof Proxy === "function") return true;
|
|
107
|
-
try {
|
|
108
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
109
|
-
return true;
|
|
110
|
-
} catch (e) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function _create_super(Derived) {
|
|
115
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
116
|
-
return function _createSuperInternal() {
|
|
117
|
-
var Super = _get_prototype_of(Derived), result;
|
|
118
|
-
if (hasNativeReflectConstruct) {
|
|
119
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
120
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
121
|
-
} else {
|
|
122
|
-
result = Super.apply(this, arguments);
|
|
123
|
-
}
|
|
124
|
-
return _possible_constructor_return(this, result);
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function _templateObject() {
|
|
128
|
-
var data = _tagged_template_literal([
|
|
129
|
-
"\n\n height: 36rem;\n \n"
|
|
130
|
-
]);
|
|
131
|
-
_templateObject = function _templateObject() {
|
|
132
|
-
return data;
|
|
133
|
-
};
|
|
134
|
-
return data;
|
|
135
|
-
}
|
|
136
|
-
var ParseTreeTextarea = /*#__PURE__*/ function(Textarea) {
|
|
137
|
-
_inherits(ParseTreeTextarea, Textarea);
|
|
138
|
-
var _super = _create_super(ParseTreeTextarea);
|
|
139
|
-
function ParseTreeTextarea() {
|
|
140
|
-
_class_call_check(this, ParseTreeTextarea);
|
|
141
|
-
return _super.apply(this, arguments);
|
|
142
|
-
}
|
|
143
|
-
_create_class(ParseTreeTextarea, [
|
|
144
|
-
{
|
|
145
|
-
key: "setParseTree",
|
|
146
|
-
value: function setParseTree(parseTree) {
|
|
147
|
-
if (parseTree !== null) {
|
|
148
|
-
parseTree.shiftLine(); //
|
|
149
|
-
var parseTreeString = parseTree.asString(), value = parseTreeString; ///
|
|
150
|
-
this.setValue(value);
|
|
151
|
-
} else {
|
|
152
|
-
this.clearParseTree();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
key: "clearParseTree",
|
|
158
|
-
value: function clearParseTree() {
|
|
159
|
-
var value = _constants.EMPTY_STRING;
|
|
160
|
-
this.setValue(value);
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
key: "parentContext",
|
|
165
|
-
value: function parentContext() {
|
|
166
|
-
var setParseTree = this.setParseTree.bind(this), clearParseTree = this.clearParseTree.bind(this);
|
|
167
|
-
return {
|
|
168
|
-
setParseTree: setParseTree,
|
|
169
|
-
clearParseTree: clearParseTree
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
]);
|
|
174
|
-
return ParseTreeTextarea;
|
|
175
|
-
}(_textarea.default);
|
|
176
|
-
_define_property(ParseTreeTextarea, "defaultProperties", {
|
|
177
|
-
readOnly: true,
|
|
178
|
-
className: "parse-tree",
|
|
179
|
-
spellCheck: "false"
|
|
180
|
-
});
|
|
181
|
-
var _default = (0, _easywithstyle.default)(ParseTreeTextarea)(_templateObject());
|
|
182
|
-
|
|
183
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9leGFtcGxlL3ZpZXcvdGV4dGFyZWEvcGFyc2VUcmVlLmpzIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5pbXBvcnQgd2l0aFN0eWxlIGZyb20gXCJlYXN5LXdpdGgtc3R5bGVcIjsgIC8vL1xuXG5pbXBvcnQgVGV4dGFyZWEgZnJvbSBcIi4uL3RleHRhcmVhXCI7XG5cbmltcG9ydCB7IEVNUFRZX1NUUklORyB9IGZyb20gXCIuLi8uLi9jb25zdGFudHNcIjtcblxuY2xhc3MgUGFyc2VUcmVlVGV4dGFyZWEgZXh0ZW5kcyBUZXh0YXJlYSB7XG4gIHNldFBhcnNlVHJlZShwYXJzZVRyZWUpIHtcbiAgICBpZiAocGFyc2VUcmVlICE9PSBudWxsKSB7XG4gIC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xrQkFBa0JGLFVBQVVHLFFBQVEsSUFDcENDLFFBQVFGLGlCQUFrQixHQUFHO29CQUVuQyxJQUFJLENBQUNHLFFBQVEsQ0FBQ0Q7Z0JBQ2hCLE9BQU87b0JBQ0wsSUFBSSxDQUFDRSxjQUFjO2dCQUNyQjtZQUNGOzs7WUFFQUEsS0FBQUE7bUJBQUFBLFNBQUFBO2dCQUNFLElBQU1GLFFBQVFHLHVCQUFZO2dCQUUxQixJQUFJLENBQUNGLFFBQVEsQ0FBQ0Q7WUFDaEI7OztZQUVBSSxLQUFBQTttQkFBQUEsU0FBQUE7Z0JBQ0UsSUFBTVQsZUFBZSxJQUFJLENBQUNBLFlBQVksQ0FBQ1UsSUFBSSxDQUFDLElBQUksR0FDMUNILGlCQUFpQixJQUFJLENBQUNBLGNBQWMsQ0FBQ0csSUFBSSxDQUFDLElBQUk7Z0JBRXBELE9BQVE7b0JBQ05WLGNBQUFBO29CQUNBTyxnQkFBQUE7Z0JBQ0Y7WUFDRjs7O1dBNUJJUjtFQUEwQlksaUJBQVE7QUE4QnRDLGlCQTlCSVosbUJBOEJHYSxxQkFBb0I7SUFDekJDLFVBQVU7SUFDVkMsV0FBVztJQUNYQyxZQUFZO0FBQ2Q7SUFHRixXQUFlQyxJQUFBQSxzQkFBUyxFQUFDakIifQ==
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import withStyle from "easy-with-style"; ///
|
|
4
|
-
|
|
5
|
-
import { SizeableDiv } from "easy-layout";
|
|
6
|
-
|
|
7
|
-
class RightSizeableDiv extends SizeableDiv {
|
|
8
|
-
static defaultProperties = {
|
|
9
|
-
className: "right"
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default withStyle(RightSizeableDiv)`
|
|
14
|
-
|
|
15
|
-
height: 32rem;
|
|
16
|
-
position: relative;
|
|
17
|
-
min-height: 12rem;
|
|
18
|
-
|
|
19
|
-
`;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import withStyle from "easy-with-style"; ///
|
|
4
|
-
|
|
5
|
-
import Textarea from "../textarea";
|
|
6
|
-
|
|
7
|
-
import { DOUBLE_SPACE } from "../../constants";
|
|
8
|
-
|
|
9
|
-
class LexicalEntriesTextarea extends Textarea {
|
|
10
|
-
setLexicalEntries(lexicalEntries) {
|
|
11
|
-
const lexicalEntriesString = JSON.stringify(lexicalEntries, null, DOUBLE_SPACE),
|
|
12
|
-
value = lexicalEntriesString; ///
|
|
13
|
-
|
|
14
|
-
this.setValue(value);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
parentContext() {
|
|
18
|
-
const setLexicalEntries = this.setLexicalEntries.bind(this);
|
|
19
|
-
|
|
20
|
-
return ({
|
|
21
|
-
setLexicalEntries
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static defaultProperties = {
|
|
26
|
-
readOnly: true,
|
|
27
|
-
className: "lexical-entries",
|
|
28
|
-
spellCheck: "false"
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default withStyle(LexicalEntriesTextarea)`
|
|
33
|
-
|
|
34
|
-
height: 12rem;
|
|
35
|
-
|
|
36
|
-
`;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import withStyle from "easy-with-style"; ///
|
|
4
|
-
|
|
5
|
-
import Textarea from "../textarea";
|
|
6
|
-
|
|
7
|
-
import { EMPTY_STRING } from "../../constants";
|
|
8
|
-
|
|
9
|
-
class ParseTreeTextarea extends Textarea {
|
|
10
|
-
setParseTree(parseTree) {
|
|
11
|
-
if (parseTree !== null) {
|
|
12
|
-
parseTree.shiftLine(); //
|
|
13
|
-
|
|
14
|
-
const parseTreeString = parseTree.asString(),
|
|
15
|
-
value = parseTreeString; ///
|
|
16
|
-
|
|
17
|
-
this.setValue(value);
|
|
18
|
-
} else {
|
|
19
|
-
this.clearParseTree();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
clearParseTree() {
|
|
24
|
-
const value = EMPTY_STRING;
|
|
25
|
-
|
|
26
|
-
this.setValue(value);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
parentContext() {
|
|
30
|
-
const setParseTree = this.setParseTree.bind(this),
|
|
31
|
-
clearParseTree = this.clearParseTree.bind(this);
|
|
32
|
-
|
|
33
|
-
return ({
|
|
34
|
-
setParseTree,
|
|
35
|
-
clearParseTree
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
static defaultProperties = {
|
|
40
|
-
readOnly: true,
|
|
41
|
-
className: "parse-tree",
|
|
42
|
-
spellCheck: "false"
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default withStyle(ParseTreeTextarea)`
|
|
47
|
-
|
|
48
|
-
height: 36rem;
|
|
49
|
-
|
|
50
|
-
`;
|