jh-componentj 0.2.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.
Files changed (37) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +61 -0
  3. package/dist/tvjs-xp.js +2375 -0
  4. package/dist/tvjs-xp.min.js +5 -0
  5. package/dist/tvjs-xp.min.js.LICENSE.txt +6 -0
  6. package/package.json +69 -0
  7. package/src/Main.vue +170 -0
  8. package/src/apps/App1.vue +71 -0
  9. package/src/apps/App2.vue +155 -0
  10. package/src/components/AppTag.vue +48 -0
  11. package/src/components/Chartbox.vue +87 -0
  12. package/src/components/Codepane.vue +260 -0
  13. package/src/components/Multiselect.vue +106 -0
  14. package/src/components/MyVueComponent.vue +26 -0
  15. package/src/components/StdInput.vue +70 -0
  16. package/src/components/Window.vue +95 -0
  17. package/src/components/dragg.js +32 -0
  18. package/src/extensions/chart-link/main.js +299 -0
  19. package/src/extensions/chart-link/shared.js +10 -0
  20. package/src/extensions/chart-link/utils.js +17 -0
  21. package/src/extensions/chart-link/x.json +11 -0
  22. package/src/extensions/grid-resize/Splitter.vue +80 -0
  23. package/src/extensions/grid-resize/main.js +152 -0
  24. package/src/extensions/grid-resize/utils.js +25 -0
  25. package/src/extensions/grid-resize/x.json +11 -0
  26. package/src/extensions/legend-buttons/AddWin.vue +91 -0
  27. package/src/extensions/legend-buttons/main.js +156 -0
  28. package/src/extensions/legend-buttons/x.json +11 -0
  29. package/src/extensions/settings-win/SettingsWin.vue +76 -0
  30. package/src/extensions/settings-win/main.js +39 -0
  31. package/src/extensions/settings-win/utils.js +19 -0
  32. package/src/extensions/settings-win/x.json +11 -0
  33. package/src/index.html +19 -0
  34. package/src/index_dev.js +27 -0
  35. package/src/index_prod.js +28 -0
  36. package/src/main.js +14 -0
  37. package/src/stuff/utils.js +16 -0
@@ -0,0 +1,260 @@
1
+ <template>
2
+ <div class="code-pane" :style="{
3
+ background: colors.back,
4
+ borderColor: colors.border,
5
+ width: width + 'px',
6
+ height: height + 'px',
7
+ top: `calc(50% - ${height/2+20}px)`,
8
+ left: `calc(50% - ${width/2}px)`,
9
+ boxShadow: `0 0 15px 1px ${colors.shadow || '#0b0e145e'}`
10
+ }">
11
+ <codemirror v-model="code" :options="options"
12
+ @input="on_change" ref="cm"/>
13
+ <span class="close thick code-close"
14
+ @click="$emit('close-code')"></span>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+
20
+ import { codemirror } from 'vue-codemirror'
21
+ import 'codemirror/mode/javascript/javascript'
22
+ import 'codemirror/mode/htmlmixed/htmlmixed'
23
+ import 'codemirror/lib/codemirror.css'
24
+ import 'codemirror/theme/dracula.css'
25
+ import 'codemirror/addon/scroll/simplescrollbars.js'
26
+ import 'codemirror/addon/scroll/simplescrollbars.css'
27
+
28
+ export default {
29
+ name: 'Codepane',
30
+ components: {
31
+ codemirror
32
+ },
33
+ props: ['colors', 'height', 'width', 'bundle', 'src'],
34
+ mounted() {
35
+ this.reset_style()
36
+ },
37
+ computed: {
38
+ style() {
39
+ return `
40
+ .CodeMirror {
41
+ height: ${this.$props.height}px !important;
42
+ }
43
+ .cm-s-dracula.CodeMirror,
44
+ .cm-s-dracula
45
+ .CodeMirror-gutters {
46
+ background-color: ${this.$props.colors.cmBack} !important;
47
+ color: ${this.$props.colors.cmCode} !important;
48
+ }
49
+ .cm-property {
50
+ color: ${this.$props.colors.cmProperty} !important;
51
+ }
52
+ .cm-s-dracula .CodeMirror-linenumber {
53
+ color: ${this.$props.colors.cmLineNumber};
54
+ }
55
+ .cm-comment {
56
+ color: ${this.$props.colors.cmComment} !important;
57
+ }
58
+ .cm-attribute {
59
+ color: ${this.$props.colors.cmAttribute} !important;
60
+ }
61
+ .cm-tag,
62
+ .cm-keyword {
63
+ color: ${this.$props.colors.cmKeyword} !important;
64
+ }
65
+ .CodeMirror-cursor {
66
+ border-left: solid thin ${this.$props.colors.text} !important;
67
+ }
68
+ .CodeMirror-selected {
69
+ background: ${this.$props.colors.selection} !important;
70
+ }
71
+ `
72
+ }
73
+ },
74
+ methods: {
75
+ reset_style() {
76
+ var stbr = document.getElementById('code-mirror-custom')
77
+ if (stbr) {
78
+ var sheetParent = stbr.parentNode
79
+ sheetParent.removeChild(stbr)
80
+ }
81
+
82
+
83
+ var sheet = document.createElement('style')
84
+ sheet.setAttribute("id", "code-mirror-custom");
85
+ sheet.innerHTML = this.style
86
+ document.body.appendChild(sheet)
87
+ },
88
+ on_change(text) {
89
+ this.$emit('src-changed', text)
90
+ },
91
+ },
92
+ watch: {
93
+ width() {
94
+ if (!this.$refs.cm) return
95
+ this.$refs.cm.refresh()
96
+ },
97
+ colors() {
98
+ this.reset_style()
99
+ }
100
+ },
101
+ data() {
102
+ return {
103
+ code: this.$props.src,
104
+ options: {
105
+ mode: 'text/javascript',
106
+ tabSize: 4,
107
+ styleActiveLine: true,
108
+ lineNumbers: true,
109
+ line: true,
110
+ foldGutter: true,
111
+ styleSelectedText: true,
112
+ runmode: 'colorize',
113
+ matchBrackets: true,
114
+ showCursorWhenSelecting: true,
115
+ theme: "dracula",
116
+ extraKeys: {
117
+ "Ctrl": "autocomplete"
118
+ },
119
+ hintOptions: {
120
+ completeSingle: false
121
+ },
122
+ scrollbarStyle: 'simple'
123
+ }
124
+ }
125
+ }
126
+ }
127
+ </script>
128
+
129
+ <style>
130
+ .code-pane {
131
+ position: absolute;
132
+ height: 100%;
133
+ border: 1px solid;
134
+ z-index: 200;
135
+ }
136
+ .CodeMirror {
137
+ font-size: 14px;
138
+ }
139
+
140
+ .cm-tag,
141
+ .cm-keyword {
142
+ /*color: #dddcdc !important;*/
143
+ /*color: #e27777 !important;*/
144
+ color: #6dc59f !important;
145
+ }
146
+ .cm-variable,
147
+ .cm-variable-2,
148
+ .cm-def {
149
+ /*color: #50fa7b !important;*/
150
+ color: #3b9e64 !important;
151
+ /* specific keyword #d0ca95 */
152
+ }
153
+
154
+ .cm-string {
155
+ color: #9faabb !important;
156
+ }
157
+ .cm-string-2 {
158
+ color: #9faabb !important;
159
+ }
160
+ .cm-operator {
161
+ color: /*#e54150*/ #9a9a9a !important;
162
+ }
163
+ .cm-property {
164
+ color: #35a776 !important;
165
+ }
166
+ .cm-number {
167
+ color: #fbab66 !important;
168
+ }
169
+ .cm-comment {
170
+ color: #9098af63 !important;
171
+ }
172
+ .cm-s-dracula.CodeMirror,
173
+ .cm-s-dracula
174
+ .CodeMirror-gutters {
175
+ background-color: /*#121827*/ #1b202dfa !important;
176
+ }
177
+
178
+ .CodeMirror-simplescroll-vertical,
179
+ .CodeMirror-simplescroll-horizontal {
180
+ background: none;
181
+ }
182
+ .CodeMirror-simplescroll-horizontal div,
183
+ .CodeMirror-simplescroll-vertical div {
184
+ border-radius: 20px;
185
+ border: none;
186
+ background: #7b7b7b;
187
+ opacity: 0.35;
188
+ right: 1px;
189
+ }
190
+ .CodeMirror-simplescroll-horizontal div:hover,
191
+ .CodeMirror-simplescroll-vertical div:hover {
192
+ filter: brightness(1.5);
193
+ }
194
+ .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
195
+ background: none;
196
+ }
197
+ .CodeMirror-simplescroll-horizontal {
198
+ bottom: 3px;
199
+ }
200
+
201
+ .code-close {
202
+ z-index: 1001;
203
+ right: 10px;
204
+ top: 10px;
205
+ position: absolute !important;
206
+ cursor: pointer;
207
+ opacity: 0.75;
208
+ }
209
+
210
+ .code-close:hover {
211
+ opacity: 1;
212
+ }
213
+
214
+ .close {
215
+ position: relative;
216
+ display: inline-block;
217
+ width: 25px;
218
+ height: 25px;
219
+ overflow: hidden;
220
+ }
221
+ .close:hover::before, .close:hover::after {
222
+ }
223
+ .close::before, .close::after {
224
+ content: '';
225
+ position: absolute;
226
+ height: 2px;
227
+ width: 100%;
228
+ top: 50%;
229
+ left: 0;
230
+ margin-top: -1px;
231
+ background: #88888888;
232
+ }
233
+ .close::before {
234
+ -webkit-transform: rotate(45deg);
235
+ -moz-transform: rotate(45deg);
236
+ -ms-transform: rotate(45deg);
237
+ -o-transform: rotate(45deg);
238
+ transform: rotate(45deg);
239
+ }
240
+ .close::after {
241
+ -webkit-transform: rotate(-45deg);
242
+ -moz-transform: rotate(-45deg);
243
+ -ms-transform: rotate(-45deg);
244
+ -o-transform: rotate(-45deg);
245
+ transform: rotate(-45deg);
246
+ }
247
+ .close.big {
248
+ -webkit-transform: scale(3);
249
+ -moz-transform: scale(3);
250
+ -ms-transform: scale(3);
251
+ -o-transform: scale(3);
252
+ transform: scale(3);
253
+ }
254
+
255
+ .close.thick::before, .close.thick::after {
256
+ height: 2px;
257
+ margin-top: -2px;
258
+ }
259
+
260
+ </style>
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <div id="list1" class="dropdown-check-list" tabindex="100">
3
+ <span class="anchor">Extensions</span>
4
+ <ul class="items">
5
+ <li v-for="name of list">
6
+ <input type="checkbox" v-model="checks[name]" @input="on_switch" />
7
+ {{ name }}
8
+ </li>
9
+ </ul>
10
+ </div>
11
+ </template>
12
+ <script>
13
+ export default {
14
+ name: "Multiselect",
15
+ props: ["list"],
16
+ mounted() {
17
+ var checkList = document.getElementById("list1");
18
+ checkList.getElementsByClassName("anchor")[0].onclick = () => {
19
+ if (checkList.classList.contains("visible"))
20
+ checkList.classList.remove("visible");
21
+ else checkList.classList.add("visible");
22
+ };
23
+ for (var n of this.$props.list) {
24
+ this.$set(this.checks, n, true);
25
+ }
26
+ },
27
+ methods: {
28
+ on_switch() {
29
+ setTimeout(() => {
30
+ this.$emit("onstate", this.checks);
31
+ });
32
+ },
33
+ },
34
+ data() {
35
+ return {
36
+ checks: {},
37
+ };
38
+ },
39
+ };
40
+ </script>
41
+ <style>
42
+ .dropdown-check-list {
43
+ display: inline-block;
44
+ position: absolute;
45
+ top: 12px;
46
+ right: 100px;
47
+ z-index: 1000;
48
+ background: inherit;
49
+ outline: none;
50
+ user-select: none;
51
+ }
52
+
53
+ .dropdown-check-list .anchor {
54
+ position: relative;
55
+ cursor: pointer;
56
+ display: inline-block;
57
+ padding: 5px 50px 5px 10px;
58
+ border: 1px dotted #a5a5a554;
59
+ width: 150px;
60
+ border-radius: 3px;
61
+ }
62
+
63
+ .dropdown-check-list .anchor:after {
64
+ position: absolute;
65
+ content: "";
66
+ border-left: 1px solid #fff;
67
+ border-top: 1px solid #fff;
68
+ padding: 3px;
69
+ right: 10px;
70
+ top: 25%;
71
+ -moz-transform: rotate(-135deg);
72
+ -ms-transform: rotate(-135deg);
73
+ -o-transform: rotate(-135deg);
74
+ -webkit-transform: rotate(-135deg);
75
+ transform: rotate(-135deg);
76
+ }
77
+
78
+ .dropdown-check-list .anchor:active:after {
79
+ right: 9px;
80
+ }
81
+
82
+ .dropdown-check-list ul.items {
83
+ padding: 2px;
84
+ display: none;
85
+ margin: 0;
86
+ border: 1px dotted #a5a5a554;
87
+ border-top: none;
88
+ }
89
+
90
+ .dropdown-check-list ul.items li {
91
+ list-style: none;
92
+ }
93
+
94
+ .dropdown-check-list ul.items li input {
95
+ vertical-align: sub;
96
+ margin-right: 5px;
97
+ }
98
+ .dropdown-check-list.visible .anchor {
99
+ color: #0094ff;
100
+ }
101
+
102
+ .dropdown-check-list.visible .items {
103
+ display: block;
104
+ padding: 5px;
105
+ }
106
+ </style>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <div>
3
+ <h2>{{ message }}</h2>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ data() {
10
+ return {
11
+ message: "Hello from Vue!",
12
+ };
13
+ },
14
+ mounted() {
15
+ if (window.vueData) {
16
+ this.message = window.vueData.message; // Use data passed from React
17
+ }
18
+ },
19
+ };
20
+ </script>
21
+
22
+ <style scoped>
23
+ h2 {
24
+ color: blue;
25
+ }
26
+ </style>
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <span>
3
+ <input
4
+ v-if="type === 'text' || !type"
5
+ :value="value"
6
+ class="tvjs-std-input"
7
+ :style="style"
8
+ :placeholder="name"
9
+ @change="$emit('change', $event.target.value)"
10
+ @input="$emit('input', $event.target.value)"
11
+ />
12
+ <select
13
+ v-else-if="type === 'select'"
14
+ class="tvjs-std-input"
15
+ :style="style"
16
+ :value="value"
17
+ @input="$emit('input', $event.target.value)"
18
+ >
19
+ <option v-for="opt in list">{{ opt }}</option>
20
+ </select>
21
+ </span>
22
+ </template>
23
+
24
+ <script>
25
+ export default {
26
+ name: "StdInput",
27
+ props: ["value", "name", "type", "list", "colors"],
28
+ methods: {},
29
+ computed: {
30
+ style() {
31
+ return {
32
+ //background: this.$props.colors.back,
33
+ //color: this.$props.colors.text
34
+ };
35
+ },
36
+ },
37
+ data() {
38
+ return {};
39
+ },
40
+ };
41
+ </script>
42
+
43
+ <style>
44
+ .tvjs-std-input {
45
+ margin: 5px;
46
+ background-color: #161b27;
47
+ border: 1px dotted #353940;
48
+ height: 22px;
49
+ border-radius: 3px;
50
+ padding: 2px 0px 3px 10px;
51
+ color: whitesmoke;
52
+ font-size: 1.2em;
53
+ outline: none;
54
+ width: 100px;
55
+ }
56
+
57
+ select.tvjs-std-input {
58
+ height: 29px;
59
+ -moz-appearance: none;
60
+ }
61
+
62
+ select.tvjs-std-input {
63
+ display: none; /*hide original SELECT element: */
64
+ }
65
+
66
+ .tvjs-std-input::placeholder {
67
+ color: #8e909a;
68
+ opacity: 0.25;
69
+ }
70
+ </style>
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <div class="tvjs-x-window" :style="style" ref="win">
3
+ <div class="tvjs-x-window-head">
4
+ <div class="tvjs-x-window-title"
5
+ @mousedown="onMouseDown">
6
+ {{title}}
7
+ </div>
8
+ <div class="tvjs-x-window-close"
9
+ @click="$emit('close')">
10
+
11
+ </div>
12
+ </div>
13
+ <div class="tvjs-x-window-body">
14
+ <slot></slot>
15
+ </div>
16
+ </div>
17
+ </template>
18
+ <script>
19
+
20
+ import Dragg from './dragg.js'
21
+
22
+ export default {
23
+ name: 'Window',
24
+ mixins: [Dragg],
25
+ props: ['title', 'tv'],
26
+ mounted() {
27
+ this.ww = this.$refs.win.clientWidth
28
+ this.wh = this.$refs.win.clientHeight
29
+ this.x = this.tvw * 0.5 - this.ww * 0.5
30
+ this.y = this.tvh * 0.5 - this.wh * 0.5
31
+ },
32
+ computed: {
33
+ style() {
34
+ return {
35
+ top: `${this.y}px`,
36
+ left: `${this.x}px`
37
+ }
38
+ },
39
+ tvw() {
40
+ return this.$props.tv.width
41
+ },
42
+ tvh() {
43
+ return this.$props.tv.height
44
+ }
45
+ },
46
+ data() {
47
+ return {
48
+ ww: 0,
49
+ wh: 0,
50
+ x: 0,
51
+ y: 0
52
+ }
53
+ }
54
+ }
55
+ </script>
56
+ <style>
57
+ .tvjs-x-window {
58
+ position: absolute;
59
+ background: #1b202def;
60
+ border-radius: 3px;
61
+ pointer-events: all;
62
+ padding-left: 7px;
63
+ z-index: 100;
64
+ color: #dedddd;
65
+ }
66
+ .tvjs-x-window-head {
67
+ font-size: 2em;
68
+ user-select: none;
69
+ display: flex;
70
+ flex-direction: row;
71
+ flex-wrap: nowrap;
72
+ justify-content: flex-start;
73
+ align-content: center;
74
+ align-items: center;
75
+ height: 36px;
76
+ padding: 10px;
77
+ cursor: grab;
78
+ }
79
+
80
+ .tvjs-x-window-body {
81
+ padding: 10px;
82
+ font-size: 1.1em;
83
+ }
84
+ .tvjs-x-window-title {
85
+ width: 300px;
86
+ user-select: none;
87
+ }
88
+ .tvjs-x-window-close {
89
+ width: 26px;
90
+ cursor: pointer;
91
+ margin: -1em;
92
+ padding: 1em;
93
+ font-size: 0.75em;
94
+ }
95
+ </style>
@@ -0,0 +1,32 @@
1
+ export default {
2
+ methods: {
3
+ onMouseDown(e) {
4
+ e = e || window.event
5
+ e.preventDefault()
6
+ this.drag.offset_x = e.clientX - this.x
7
+ this.drag.offset_y = e.clientY - this.y
8
+ document.onmouseup = this.stopdrag
9
+ document.onmousemove = this.ondrag
10
+ },
11
+
12
+ ondrag(e) {
13
+ e = e || window.event
14
+ e.preventDefault()
15
+ this.x = e.clientX - this.drag.offset_x
16
+ this.y = e.clientY - this.drag.offset_y
17
+ },
18
+
19
+ stopdrag() {
20
+ document.onmouseup = null
21
+ document.onmousemove = null
22
+ }
23
+ },
24
+ data() {
25
+ return {
26
+ drag: {
27
+ offset_x: 0,
28
+ offset_y: 0
29
+ }
30
+ }
31
+ }
32
+ }