jpf-mobx 1.0.45 → 1.0.47

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.
Files changed (167) hide show
  1. package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.d.ts +16 -16
  2. package/dist/controls/codeMirror/HtmlEditor/HtmlEditor.js +121 -121
  3. package/dist/controls/codeMirror/JsonEditor/JsonEditor.d.ts +16 -16
  4. package/dist/controls/codeMirror/JsonEditor/JsonEditor.js +105 -105
  5. package/dist/controls/codeMirror/index.d.ts +2 -2
  6. package/dist/controls/codeMirror/index.js +2 -2
  7. package/dist/controls/custom/FileSelector/FileSelector.d.ts +19 -19
  8. package/dist/controls/custom/FileSelector/FileSelector.js +46 -46
  9. package/dist/controls/custom/LabeledControl/LabeledControl.d.ts +16 -16
  10. package/dist/controls/custom/LabeledControl/LabeledControl.js +36 -36
  11. package/dist/controls/custom/ListItem/ListItem.d.ts +38 -38
  12. package/dist/controls/custom/ListItem/ListItem.js +64 -64
  13. package/dist/controls/custom/index.d.ts +3 -3
  14. package/dist/controls/custom/index.js +3 -3
  15. package/dist/controls/html/Button/Button.d.ts +16 -16
  16. package/dist/controls/html/Button/Button.js +49 -49
  17. package/dist/controls/html/Div/Div.d.ts +15 -15
  18. package/dist/controls/html/Div/Div.js +24 -24
  19. package/dist/controls/html/Image/Image.d.ts +17 -17
  20. package/dist/controls/html/Image/Image.js +29 -29
  21. package/dist/controls/html/Input/Input.d.ts +35 -35
  22. package/dist/controls/html/Input/Input.js +176 -176
  23. package/dist/controls/html/Select/Select.d.ts +31 -31
  24. package/dist/controls/html/Select/Select.js +113 -113
  25. package/dist/controls/html/Select/Select.js.map +1 -1
  26. package/dist/controls/html/Span/Span.d.ts +12 -12
  27. package/dist/controls/html/Span/Span.js +22 -22
  28. package/dist/controls/html/index.d.ts +6 -6
  29. package/dist/controls/html/index.js +6 -6
  30. package/dist/controls/index.d.ts +14 -14
  31. package/dist/controls/index.js +14 -14
  32. package/dist/controls/jsonViewAwesome/index.d.ts +1 -1
  33. package/dist/controls/jsonViewAwesome/index.js +1 -1
  34. package/dist/controls/jsonViewAwesome/jsonFormatter/JsonFormatter.d.ts +29 -29
  35. package/dist/controls/jsonViewAwesome/jsonFormatter/JsonFormatter.js +67 -67
  36. package/dist/controls/kendo/Chart/Chart.d.ts +20 -20
  37. package/dist/controls/kendo/Chart/Chart.js +68 -68
  38. package/dist/controls/kendo/Culture/Culture.d.ts +1 -1
  39. package/dist/controls/kendo/Culture/Culture.js +25 -25
  40. package/dist/controls/kendo/DataSource/DataSource.d.ts +4 -4
  41. package/dist/controls/kendo/DataSource/DataSource.js +1 -1
  42. package/dist/controls/kendo/Dialog/Dialog.d.ts +14 -14
  43. package/dist/controls/kendo/Dialog/Dialog.js +48 -48
  44. package/dist/controls/kendo/Editor/Editor.d.ts +19 -19
  45. package/dist/controls/kendo/Editor/Editor.js +105 -105
  46. package/dist/controls/kendo/Grid/Grid.d.ts +54 -54
  47. package/dist/controls/kendo/Grid/Grid.js +211 -211
  48. package/dist/controls/kendo/Menu/Menu.d.ts +15 -0
  49. package/dist/controls/kendo/Menu/Menu.js +92 -0
  50. package/dist/controls/kendo/Menu/Menu.js.map +1 -1
  51. package/dist/controls/kendo/Tree/Tree.d.ts +17 -0
  52. package/dist/controls/kendo/Tree/Tree.js +108 -0
  53. package/dist/controls/kendo/Tree/Tree.js.map +1 -1
  54. package/dist/controls/kendo/index.d.ts +8 -3
  55. package/dist/controls/kendo/index.js +8 -3
  56. package/dist/controls/kendo/index.js.map +1 -1
  57. package/dist/controls/leaflet/LabelControl/LabelControl.d.ts +12 -12
  58. package/dist/controls/leaflet/LabelControl/LabelControl.js +33 -33
  59. package/dist/controls/leaflet/Map/Map.d.ts +45 -0
  60. package/dist/controls/leaflet/Map/Map.js +121 -0
  61. package/dist/controls/leaflet/Map/Map.js.map +1 -1
  62. package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.d.ts +8 -8
  63. package/dist/controls/leaflet/OpenStreetMapTileLayer/OpenStreetMapTileLayer.js +13 -13
  64. package/dist/controls/leaflet/PointerEvent/PointerEvent.d.ts +2 -2
  65. package/dist/controls/leaflet/PointerEvent/PointerEvent.js +7 -7
  66. package/dist/controls/leaflet/index.d.ts +4 -3
  67. package/dist/controls/leaflet/index.js +4 -3
  68. package/dist/controls/leaflet/index.js.map +1 -1
  69. package/dist/controls/svg/Circle/Circle.d.ts +12 -12
  70. package/dist/controls/svg/Circle/Circle.js +20 -20
  71. package/dist/controls/svg/Ellipse/Ellipse.d.ts +13 -13
  72. package/dist/controls/svg/Ellipse/Ellipse.js +21 -21
  73. package/dist/controls/svg/ForeignObject/ForeignObject.d.ts +15 -15
  74. package/dist/controls/svg/ForeignObject/ForeignObject.js +22 -22
  75. package/dist/controls/svg/Group/Group.d.ts +15 -15
  76. package/dist/controls/svg/Group/Group.js +22 -22
  77. package/dist/controls/svg/Line/Line.d.ts +13 -13
  78. package/dist/controls/svg/Line/Line.js +21 -21
  79. package/dist/controls/svg/Pattern/Pattern.d.ts +22 -22
  80. package/dist/controls/svg/Pattern/Pattern.js +23 -23
  81. package/dist/controls/svg/Polygon/Polygon.d.ts +11 -11
  82. package/dist/controls/svg/Polygon/Polygon.js +20 -20
  83. package/dist/controls/svg/Polyline/Polyline.d.ts +11 -11
  84. package/dist/controls/svg/Polyline/Polyline.js +19 -19
  85. package/dist/controls/svg/Rectangle/Rectangle.d.ts +13 -13
  86. package/dist/controls/svg/Rectangle/Rectangle.js +21 -21
  87. package/dist/controls/svg/Svg/Svg.d.ts +17 -17
  88. package/dist/controls/svg/Svg/Svg.js +24 -24
  89. package/dist/controls/svg/Text/Text.d.ts +14 -14
  90. package/dist/controls/svg/Text/Text.js +22 -22
  91. package/dist/controls/svg/Title/Title.d.ts +10 -10
  92. package/dist/controls/svg/Title/Title.js +16 -16
  93. package/dist/controls/svg/index.d.ts +13 -13
  94. package/dist/controls/svg/index.js +13 -13
  95. package/dist/controls/svg/svg.d.ts +6 -6
  96. package/dist/controls/svg/svg.js +12 -12
  97. package/dist/framework/attributes.d.ts +90 -90
  98. package/dist/framework/attributes.js +1 -1
  99. package/dist/framework/element.d.ts +63 -63
  100. package/dist/framework/element.js +157 -157
  101. package/dist/framework/element.js.map +1 -1
  102. package/dist/framework/event.d.ts +80 -80
  103. package/dist/framework/event.js +25 -25
  104. package/dist/framework/observable.d.ts +28 -27
  105. package/dist/framework/observable.js +118 -107
  106. package/dist/framework/observable.js.map +1 -1
  107. package/dist/framework/properties.d.ts +41 -41
  108. package/dist/framework/properties.js +274 -274
  109. package/dist/framework/properties.js.map +1 -1
  110. package/dist/framework/root.d.ts +9 -9
  111. package/dist/framework/root.js +37 -37
  112. package/dist/framework/style.d.ts +656 -656
  113. package/dist/framework/style.js +153 -153
  114. package/dist/framework/types.d.ts +87 -87
  115. package/dist/framework/types.js +1 -1
  116. package/dist/framework/userAgent.d.ts +31 -31
  117. package/dist/framework/userAgent.js +46 -46
  118. package/dist/index.d.ts +13 -13
  119. package/dist/index.js +13 -13
  120. package/dist/utilities/blob/blob.d.ts +1 -1
  121. package/dist/utilities/blob/blob.js +17 -17
  122. package/dist/utilities/cookie/cookie.d.ts +3 -3
  123. package/dist/utilities/cookie/cookie.js +26 -26
  124. package/dist/utilities/dataReaderTable/dataReaderTable.d.ts +9 -9
  125. package/dist/utilities/dataReaderTable/dataReaderTable.js +23 -23
  126. package/dist/utilities/fetch/fetch.d.ts +8 -8
  127. package/dist/utilities/fetch/fetch.js +137 -137
  128. package/dist/utilities/float/float.d.ts +1 -1
  129. package/dist/utilities/float/float.js +3 -3
  130. package/dist/utilities/formData/formData.d.ts +1 -1
  131. package/dist/utilities/formData/formData.js +11 -11
  132. package/dist/utilities/html/html.d.ts +1 -1
  133. package/dist/utilities/html/html.js +7 -7
  134. package/dist/utilities/htmlElement/htmlElement.d.ts +1 -1
  135. package/dist/utilities/htmlElement/htmlElement.js +16 -16
  136. package/dist/utilities/image/image.d.ts +1 -1
  137. package/dist/utilities/image/image.js +1 -1
  138. package/dist/utilities/index.d.ts +36 -36
  139. package/dist/utilities/index.js +36 -36
  140. package/dist/utilities/integer/integer.d.ts +3 -3
  141. package/dist/utilities/integer/integer.js +27 -27
  142. package/dist/utilities/key/key.d.ts +2 -2
  143. package/dist/utilities/key/key.js +6 -6
  144. package/dist/utilities/navigator/navigator.d.ts +1 -1
  145. package/dist/utilities/navigator/navigator.js +8 -8
  146. package/dist/utilities/notification/notification.d.ts +5 -5
  147. package/dist/utilities/notification/notification.js +66 -66
  148. package/dist/utilities/querystring/querystring.d.ts +6 -6
  149. package/dist/utilities/querystring/querystring.js +53 -53
  150. package/dist/utilities/router/router.d.ts +19 -19
  151. package/dist/utilities/router/router.js +80 -80
  152. package/dist/utilities/stylesheet/stylesheet.d.ts +2 -2
  153. package/dist/utilities/stylesheet/stylesheet.js +47 -47
  154. package/dist/utilities/uniqueId/uniqueId.d.ts +1 -1
  155. package/dist/utilities/uniqueId/uniqueId.js +4 -4
  156. package/dist/utilities/webSocket/webSocket.d.ts +1 -1
  157. package/dist/utilities/webSocket/webSocket.js +54 -54
  158. package/package.json +4 -4
  159. package/src/controls/html/Select/Select.ts +1 -1
  160. package/src/controls/kendo/Menu/Menu.ts +130 -125
  161. package/src/controls/kendo/Tree/Tree.ts +152 -147
  162. package/src/controls/kendo/index.ts +5 -5
  163. package/src/controls/leaflet/Map/Map.ts +197 -180
  164. package/src/controls/leaflet/index.ts +1 -1
  165. package/src/framework/element.ts +2 -2
  166. package/src/framework/observable.ts +26 -12
  167. package/src/framework/properties.ts +19 -19
@@ -1,16 +1,16 @@
1
- import { Element } from "../../../framework/element";
2
- import { Properties, IProperties } from "../../../framework/properties";
3
- import { ObservableValue } from "../../../framework/observable";
4
- export interface IHtmlEditorProperties extends IProperties {
5
- value?: string | ObservableValue<string>;
6
- }
7
- export declare class HtmlEditorElement extends Element<IHtmlEditorProperties> {
8
- constructor(properties: IHtmlEditorProperties);
9
- private editor;
10
- build(): void;
11
- }
12
- export declare function htmlEditorElement(properties: IHtmlEditorProperties): HtmlEditorElement;
13
- export declare class HtmlEditorProperties extends Properties implements IHtmlEditorProperties {
14
- constructor(properties: HtmlEditorProperties);
15
- value?: string | ObservableValue<string>;
16
- }
1
+ import { Element } from "../../../framework/element";
2
+ import { Properties, IProperties } from "../../../framework/properties";
3
+ import { ObservableValue } from "../../../framework/observable";
4
+ export interface IHtmlEditorProperties extends IProperties {
5
+ value?: string | ObservableValue<string>;
6
+ }
7
+ export declare class HtmlEditorElement extends Element<IHtmlEditorProperties> {
8
+ constructor(properties: IHtmlEditorProperties);
9
+ private editor;
10
+ build(): void;
11
+ }
12
+ export declare function htmlEditorElement(properties: IHtmlEditorProperties): HtmlEditorElement;
13
+ export declare class HtmlEditorProperties extends Properties implements IHtmlEditorProperties {
14
+ constructor(properties: HtmlEditorProperties);
15
+ value?: string | ObservableValue<string>;
16
+ }
@@ -1,122 +1,122 @@
1
- import { Element, registerElement } from "../../../framework/element";
2
- import { Properties, extendProperties } from "../../../framework/properties";
3
- import { isSubscribable, unwrap, reaction } from "../../../framework/observable";
4
- import { EditorView, basicSetup } from "codemirror";
5
- import { EditorState } from "@codemirror/state";
6
- import { keymap } from "@codemirror/view";
7
- import { html } from "@codemirror/lang-html";
8
- import { indentWithTab } from "@codemirror/commands";
9
- import { foldAll } from "@codemirror/language";
10
- import { buttonElement } from "../../html/Button/Button";
11
- import { prettifyHtml } from "../../../utilities/html/html";
12
- import { divElement } from "../../html/Div/Div";
13
- export class HtmlEditorElement extends Element {
14
- constructor(properties) {
15
- super({
16
- tagName: "div",
17
- properties: extendProperties(properties, {
18
- elementType: "HtmlEditor",
19
- }, {
20
- attributes: {
21
- tabindex: 1
22
- },
23
- style: {
24
- display: "flex",
25
- flexDirection: "column",
26
- border: "1px solid #a3d0e4"
27
- }
28
- })
29
- });
30
- }
31
- editor;
32
- build() {
33
- super.build();
34
- const properties = this.properties;
35
- const foldAllButton = buttonElement({
36
- content: "Collapse all",
37
- style: {
38
- margin: "3px"
39
- },
40
- eventListeners: {
41
- click: {
42
- listener: () => {
43
- foldAll(this.editor);
44
- }
45
- }
46
- }
47
- });
48
- const formatButton = buttonElement({
49
- content: "Format",
50
- style: {
51
- margin: "3px"
52
- },
53
- eventListeners: {
54
- click: {
55
- listener: () => {
56
- var formattedHtml = prettifyHtml(this.editor.state.doc.toString());
57
- this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: formattedHtml } });
58
- }
59
- }
60
- }
61
- });
62
- const saveButton = buttonElement({
63
- content: "Save",
64
- style: {
65
- margin: "3px"
66
- },
67
- eventListeners: {
68
- click: {
69
- listener: () => {
70
- if (isSubscribable(properties.value)) {
71
- properties.value.set(this.editor.state.doc.toString());
72
- }
73
- }
74
- }
75
- }
76
- });
77
- const buttons = divElement({
78
- style: {
79
- display: "flex"
80
- },
81
- children: [
82
- foldAllButton,
83
- formatButton,
84
- saveButton
85
- ]
86
- });
87
- this.element.appendChild(buttons.render());
88
- const state = EditorState.create({
89
- extensions: [
90
- basicSetup,
91
- html(),
92
- EditorView.lineWrapping,
93
- keymap.of([indentWithTab])
94
- ]
95
- });
96
- this.editor = new EditorView({
97
- state: state,
98
- parent: this.element,
99
- });
100
- this.editor.dom.style.overflow = "auto";
101
- this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: unwrap(properties.value) } });
102
- if (isSubscribable(properties.value)) {
103
- this.disposers.push(reaction(() => {
104
- return unwrap(properties.value);
105
- }, (html) => {
106
- this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: html } });
107
- }));
108
- }
109
- }
110
- }
111
- export function htmlEditorElement(properties) {
112
- return new HtmlEditorElement(properties);
113
- }
114
- export class HtmlEditorProperties extends Properties {
115
- constructor(properties) {
116
- super();
117
- this.setProperties(this, properties);
118
- }
119
- value;
120
- }
121
- registerElement(HtmlEditorProperties.prototype.constructor, HtmlEditorElement);
1
+ import { Element, registerElement } from "../../../framework/element";
2
+ import { Properties, extendProperties } from "../../../framework/properties";
3
+ import { isSubscribable, unwrap, reaction } from "../../../framework/observable";
4
+ import { EditorView, basicSetup } from "codemirror";
5
+ import { EditorState } from "@codemirror/state";
6
+ import { keymap } from "@codemirror/view";
7
+ import { html } from "@codemirror/lang-html";
8
+ import { indentWithTab } from "@codemirror/commands";
9
+ import { foldAll } from "@codemirror/language";
10
+ import { buttonElement } from "../../html/Button/Button";
11
+ import { prettifyHtml } from "../../../utilities/html/html";
12
+ import { divElement } from "../../html/Div/Div";
13
+ export class HtmlEditorElement extends Element {
14
+ constructor(properties) {
15
+ super({
16
+ tagName: "div",
17
+ properties: extendProperties(properties, {
18
+ elementType: "HtmlEditor",
19
+ }, {
20
+ attributes: {
21
+ tabindex: 1
22
+ },
23
+ style: {
24
+ display: "flex",
25
+ flexDirection: "column",
26
+ border: "1px solid #a3d0e4"
27
+ }
28
+ })
29
+ });
30
+ }
31
+ editor;
32
+ build() {
33
+ super.build();
34
+ const properties = this.properties;
35
+ const foldAllButton = buttonElement({
36
+ content: "Collapse all",
37
+ style: {
38
+ margin: "3px"
39
+ },
40
+ eventListeners: {
41
+ click: {
42
+ listener: () => {
43
+ foldAll(this.editor);
44
+ }
45
+ }
46
+ }
47
+ });
48
+ const formatButton = buttonElement({
49
+ content: "Format",
50
+ style: {
51
+ margin: "3px"
52
+ },
53
+ eventListeners: {
54
+ click: {
55
+ listener: () => {
56
+ var formattedHtml = prettifyHtml(this.editor.state.doc.toString());
57
+ this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: formattedHtml } });
58
+ }
59
+ }
60
+ }
61
+ });
62
+ const saveButton = buttonElement({
63
+ content: "Save",
64
+ style: {
65
+ margin: "3px"
66
+ },
67
+ eventListeners: {
68
+ click: {
69
+ listener: () => {
70
+ if (isSubscribable(properties.value)) {
71
+ properties.value.set(this.editor.state.doc.toString());
72
+ }
73
+ }
74
+ }
75
+ }
76
+ });
77
+ const buttons = divElement({
78
+ style: {
79
+ display: "flex"
80
+ },
81
+ children: [
82
+ foldAllButton,
83
+ formatButton,
84
+ saveButton
85
+ ]
86
+ });
87
+ this.element.appendChild(buttons.render());
88
+ const state = EditorState.create({
89
+ extensions: [
90
+ basicSetup,
91
+ html(),
92
+ EditorView.lineWrapping,
93
+ keymap.of([indentWithTab])
94
+ ]
95
+ });
96
+ this.editor = new EditorView({
97
+ state: state,
98
+ parent: this.element,
99
+ });
100
+ this.editor.dom.style.overflow = "auto";
101
+ this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: unwrap(properties.value) } });
102
+ if (isSubscribable(properties.value)) {
103
+ this.disposers.push(reaction(() => {
104
+ return unwrap(properties.value);
105
+ }, (html) => {
106
+ this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: html } });
107
+ }));
108
+ }
109
+ }
110
+ }
111
+ export function htmlEditorElement(properties) {
112
+ return new HtmlEditorElement(properties);
113
+ }
114
+ export class HtmlEditorProperties extends Properties {
115
+ constructor(properties) {
116
+ super();
117
+ this.setProperties(this, properties);
118
+ }
119
+ value;
120
+ }
121
+ registerElement(HtmlEditorProperties.prototype.constructor, HtmlEditorElement);
122
122
  //# sourceMappingURL=HtmlEditor.js.map
@@ -1,16 +1,16 @@
1
- import { Element } from "../../../framework/element";
2
- import { Properties, IProperties } from "../../../framework/properties";
3
- import { ObservableValue } from "../../../framework/observable";
4
- export interface IJsonEditorProperties extends IProperties {
5
- value?: string | ObservableValue<string>;
6
- }
7
- export declare class JsonEditorElement extends Element<IJsonEditorProperties> {
8
- constructor(properties: IJsonEditorProperties);
9
- private editor;
10
- build(): void;
11
- }
12
- export declare function jsonEditorElement(properties: IJsonEditorProperties): JsonEditorElement;
13
- export declare class JsonEditorProperties extends Properties implements IJsonEditorProperties {
14
- constructor(properties: JsonEditorProperties);
15
- value?: string | ObservableValue<string>;
16
- }
1
+ import { Element } from "../../../framework/element";
2
+ import { Properties, IProperties } from "../../../framework/properties";
3
+ import { ObservableValue } from "../../../framework/observable";
4
+ export interface IJsonEditorProperties extends IProperties {
5
+ value?: string | ObservableValue<string>;
6
+ }
7
+ export declare class JsonEditorElement extends Element<IJsonEditorProperties> {
8
+ constructor(properties: IJsonEditorProperties);
9
+ private editor;
10
+ build(): void;
11
+ }
12
+ export declare function jsonEditorElement(properties: IJsonEditorProperties): JsonEditorElement;
13
+ export declare class JsonEditorProperties extends Properties implements IJsonEditorProperties {
14
+ constructor(properties: JsonEditorProperties);
15
+ value?: string | ObservableValue<string>;
16
+ }
@@ -1,106 +1,106 @@
1
- import { Element, registerElement } from "../../../framework/element";
2
- import { Properties, extendProperties } from "../../../framework/properties";
3
- import { isSubscribable, unwrap, reaction } from "../../../framework/observable";
4
- import { EditorView, basicSetup } from "codemirror";
5
- import { EditorState } from "@codemirror/state";
6
- import { keymap } from "@codemirror/view";
7
- import { json } from "@codemirror/lang-json";
8
- import { indentWithTab } from "@codemirror/commands";
9
- import { foldAll } from "@codemirror/language";
10
- import { buttonElement } from "../../html/Button/Button";
11
- import { divElement } from "../../html/Div/Div";
12
- export class JsonEditorElement extends Element {
13
- constructor(properties) {
14
- super({
15
- tagName: "div",
16
- properties: extendProperties(properties, {
17
- elementType: "JsonEditor"
18
- }, {
19
- attributes: {
20
- tabindex: 1
21
- },
22
- style: {
23
- display: "flex",
24
- flexDirection: "column",
25
- border: "1px solid #a3d0e4"
26
- }
27
- })
28
- });
29
- }
30
- editor;
31
- build() {
32
- super.build();
33
- const properties = this.properties;
34
- const foldAllButton = buttonElement({
35
- content: "Collapse all",
36
- style: {
37
- margin: "3px"
38
- },
39
- eventListeners: {
40
- click: {
41
- listener: () => {
42
- foldAll(this.editor);
43
- }
44
- }
45
- }
46
- });
47
- const saveButton = buttonElement({
48
- content: "Save",
49
- style: {
50
- margin: "3px"
51
- },
52
- eventListeners: {
53
- click: {
54
- listener: () => {
55
- if (isSubscribable(properties.value)) {
56
- properties.value.set(this.editor.state.doc.toString());
57
- }
58
- }
59
- }
60
- }
61
- });
62
- const buttons = divElement({
63
- style: {
64
- display: "flex"
65
- },
66
- children: [
67
- foldAllButton,
68
- saveButton
69
- ]
70
- });
71
- this.element.appendChild(buttons.render());
72
- const state = EditorState.create({
73
- extensions: [
74
- basicSetup,
75
- json(),
76
- EditorView.lineWrapping,
77
- keymap.of([indentWithTab])
78
- ]
79
- });
80
- this.editor = new EditorView({
81
- state: state,
82
- parent: this.element,
83
- });
84
- this.editor.dom.style.overflow = "auto";
85
- this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: unwrap(properties.value) } });
86
- if (isSubscribable(properties.value)) {
87
- this.disposers.push(reaction(() => {
88
- return unwrap(properties.value);
89
- }, (html) => {
90
- this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: html } });
91
- }));
92
- }
93
- }
94
- }
95
- export function jsonEditorElement(properties) {
96
- return new JsonEditorElement(properties);
97
- }
98
- export class JsonEditorProperties extends Properties {
99
- constructor(properties) {
100
- super();
101
- this.setProperties(this, properties);
102
- }
103
- value;
104
- }
105
- registerElement(JsonEditorProperties.prototype.constructor, JsonEditorElement);
1
+ import { Element, registerElement } from "../../../framework/element";
2
+ import { Properties, extendProperties } from "../../../framework/properties";
3
+ import { isSubscribable, unwrap, reaction } from "../../../framework/observable";
4
+ import { EditorView, basicSetup } from "codemirror";
5
+ import { EditorState } from "@codemirror/state";
6
+ import { keymap } from "@codemirror/view";
7
+ import { json } from "@codemirror/lang-json";
8
+ import { indentWithTab } from "@codemirror/commands";
9
+ import { foldAll } from "@codemirror/language";
10
+ import { buttonElement } from "../../html/Button/Button";
11
+ import { divElement } from "../../html/Div/Div";
12
+ export class JsonEditorElement extends Element {
13
+ constructor(properties) {
14
+ super({
15
+ tagName: "div",
16
+ properties: extendProperties(properties, {
17
+ elementType: "JsonEditor"
18
+ }, {
19
+ attributes: {
20
+ tabindex: 1
21
+ },
22
+ style: {
23
+ display: "flex",
24
+ flexDirection: "column",
25
+ border: "1px solid #a3d0e4"
26
+ }
27
+ })
28
+ });
29
+ }
30
+ editor;
31
+ build() {
32
+ super.build();
33
+ const properties = this.properties;
34
+ const foldAllButton = buttonElement({
35
+ content: "Collapse all",
36
+ style: {
37
+ margin: "3px"
38
+ },
39
+ eventListeners: {
40
+ click: {
41
+ listener: () => {
42
+ foldAll(this.editor);
43
+ }
44
+ }
45
+ }
46
+ });
47
+ const saveButton = buttonElement({
48
+ content: "Save",
49
+ style: {
50
+ margin: "3px"
51
+ },
52
+ eventListeners: {
53
+ click: {
54
+ listener: () => {
55
+ if (isSubscribable(properties.value)) {
56
+ properties.value.set(this.editor.state.doc.toString());
57
+ }
58
+ }
59
+ }
60
+ }
61
+ });
62
+ const buttons = divElement({
63
+ style: {
64
+ display: "flex"
65
+ },
66
+ children: [
67
+ foldAllButton,
68
+ saveButton
69
+ ]
70
+ });
71
+ this.element.appendChild(buttons.render());
72
+ const state = EditorState.create({
73
+ extensions: [
74
+ basicSetup,
75
+ json(),
76
+ EditorView.lineWrapping,
77
+ keymap.of([indentWithTab])
78
+ ]
79
+ });
80
+ this.editor = new EditorView({
81
+ state: state,
82
+ parent: this.element,
83
+ });
84
+ this.editor.dom.style.overflow = "auto";
85
+ this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: unwrap(properties.value) } });
86
+ if (isSubscribable(properties.value)) {
87
+ this.disposers.push(reaction(() => {
88
+ return unwrap(properties.value);
89
+ }, (html) => {
90
+ this.editor.dispatch({ changes: { from: 0, to: this.editor.state.doc.length, insert: html } });
91
+ }));
92
+ }
93
+ }
94
+ }
95
+ export function jsonEditorElement(properties) {
96
+ return new JsonEditorElement(properties);
97
+ }
98
+ export class JsonEditorProperties extends Properties {
99
+ constructor(properties) {
100
+ super();
101
+ this.setProperties(this, properties);
102
+ }
103
+ value;
104
+ }
105
+ registerElement(JsonEditorProperties.prototype.constructor, JsonEditorElement);
106
106
  //# sourceMappingURL=JsonEditor.js.map
@@ -1,2 +1,2 @@
1
- export * from "./HtmlEditor/HtmlEditor";
2
- export * from "./JsonEditor/JsonEditor";
1
+ export * from "./HtmlEditor/HtmlEditor";
2
+ export * from "./JsonEditor/JsonEditor";
@@ -1,3 +1,3 @@
1
- export * from "./HtmlEditor/HtmlEditor";
2
- export * from "./JsonEditor/JsonEditor";
1
+ export * from "./HtmlEditor/HtmlEditor";
2
+ export * from "./JsonEditor/JsonEditor";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,19 +1,19 @@
1
- import { Properties, IProperties } from "../../../framework/properties";
2
- import { Element } from "../../../framework/element";
3
- import { ButtonProperties } from "../../html/Button/Button";
4
- import { InputProperties } from "../../html/Input/Input";
5
- export interface IFileSelectorProperties extends IProperties {
6
- button?: ButtonProperties;
7
- inputFile: InputProperties<FileList>;
8
- }
9
- declare class FileSelectorElement extends Element<IFileSelectorProperties> {
10
- constructor(properties: IFileSelectorProperties);
11
- protected build(): void;
12
- }
13
- export declare function fileSelectorElement(properties: IFileSelectorProperties): FileSelectorElement;
14
- export declare class FileSelectorProperties extends Properties implements IFileSelectorProperties {
15
- constructor(properties: IFileSelectorProperties);
16
- button?: ButtonProperties;
17
- inputFile: InputProperties<FileList>;
18
- }
19
- export {};
1
+ import { Properties, IProperties } from "../../../framework/properties";
2
+ import { Element } from "../../../framework/element";
3
+ import { ButtonProperties } from "../../html/Button/Button";
4
+ import { InputProperties } from "../../html/Input/Input";
5
+ export interface IFileSelectorProperties extends IProperties {
6
+ button?: ButtonProperties;
7
+ inputFile: InputProperties<FileList>;
8
+ }
9
+ declare class FileSelectorElement extends Element<IFileSelectorProperties> {
10
+ constructor(properties: IFileSelectorProperties);
11
+ protected build(): void;
12
+ }
13
+ export declare function fileSelectorElement(properties: IFileSelectorProperties): FileSelectorElement;
14
+ export declare class FileSelectorProperties extends Properties implements IFileSelectorProperties {
15
+ constructor(properties: IFileSelectorProperties);
16
+ button?: ButtonProperties;
17
+ inputFile: InputProperties<FileList>;
18
+ }
19
+ export {};