neo.mjs 6.10.3 → 6.10.4
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/apps/ServiceWorker.mjs +2 -2
- package/apps/learnneo/view/LivePreview.mjs +28 -15
- package/apps/learnneo/view/home/HeaderToolbar.mjs +16 -6
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +1 -1
- package/resources/data/deck/learnneo/p/stylesheet.md +4 -1
- package/resources/design-tokens/json/component.json +22 -0
- package/resources/design-tokens/json/core.json +4 -0
- package/resources/design-tokens/json/semantic.json +8 -0
- package/resources/scss/src/tooltip/Base.scss +10 -6
- package/resources/scss/theme-dark/tooltip/Base.scss +10 -0
- package/resources/scss/theme-light/tooltip/Base.scss +10 -0
- package/resources/scss/theme-neo-light/button/Base.scss +23 -19
- package/resources/scss/theme-neo-light/design-tokens/Component.scss +6 -0
- package/resources/scss/theme-neo-light/design-tokens/Core.scss +2 -0
- package/resources/scss/theme-neo-light/design-tokens/Semantic.scss +4 -2
- package/resources/scss/theme-neo-light/tooltip/Base.scss +13 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/Main.mjs +1 -1
- package/src/core/Observable.mjs +15 -15
- package/src/main/addon/WindowPosition.mjs +56 -28
- package/src/worker/App.mjs +26 -1
- package/src/worker/Canvas.mjs +4 -4
package/apps/ServiceWorker.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import Base
|
1
|
+
import Base from '../../../src/container/Base.mjs';
|
2
2
|
import TabContainer from '../../../src/tab/Container.mjs';
|
3
|
-
import TextArea
|
3
|
+
import TextArea from '../../../src/form/field/TextArea.mjs';
|
4
4
|
|
5
5
|
/**
|
6
6
|
* @class LearnNeo.view.LivePreview
|
@@ -22,7 +22,9 @@ class LivePreview extends Base {
|
|
22
22
|
* @member {Object[]} items
|
23
23
|
*/
|
24
24
|
items: [{
|
25
|
-
module: TabContainer,
|
25
|
+
module : TabContainer,
|
26
|
+
reference: 'tab-container',
|
27
|
+
|
26
28
|
items: [{
|
27
29
|
module: TextArea,
|
28
30
|
hideLabel: true,
|
@@ -38,15 +40,7 @@ class LivePreview extends Base {
|
|
38
40
|
reference: 'preview',
|
39
41
|
ntype: 'container'
|
40
42
|
}]
|
41
|
-
}]
|
42
|
-
listeners: {
|
43
|
-
activeIndexChange: () => console.log('activeIndexChange')
|
44
|
-
}
|
45
|
-
}
|
46
|
-
onConstructed() {
|
47
|
-
console.log('constructed');
|
48
|
-
this.on('activeIndexChange', () => console.log('onConstructed'));
|
49
|
-
super.onConstructed();
|
43
|
+
}]
|
50
44
|
}
|
51
45
|
|
52
46
|
afterSetValue(value, oldValue) {
|
@@ -55,6 +49,14 @@ class LivePreview extends Base {
|
|
55
49
|
}
|
56
50
|
}
|
57
51
|
|
52
|
+
onConstructed() {
|
53
|
+
super.onConstructed();
|
54
|
+
|
55
|
+
let me = this;
|
56
|
+
|
57
|
+
me.getReference('tab-container').on('activeIndexChange', me.onActiveIndexChange, me)
|
58
|
+
}
|
59
|
+
|
58
60
|
doIt(button) {
|
59
61
|
let source = this.getReference('source').getValue();
|
60
62
|
|
@@ -92,7 +94,7 @@ class LivePreview extends Base {
|
|
92
94
|
});
|
93
95
|
var params = [];
|
94
96
|
var vars = [];
|
95
|
-
// Figure out the parts of the source we'll be running.
|
97
|
+
// Figure out the parts of the source we'll be running.
|
96
98
|
// o The promises/import() corresponding to the user's import statements
|
97
99
|
// o The vars holding the name of the imported module based on the module name for each import
|
98
100
|
// o The rest of the user-provided source
|
@@ -105,8 +107,8 @@ class LivePreview extends Base {
|
|
105
107
|
// const Button = ButtonModule.default;
|
106
108
|
// // Class declaration goes here...
|
107
109
|
// });
|
108
|
-
// Making the promise part of the eval seems weird, but it made it easier to
|
109
|
-
// set up the import vars.
|
110
|
+
// Making the promise part of the eval seems weird, but it made it easier to
|
111
|
+
// set up the import vars.
|
110
112
|
|
111
113
|
let promises = moduleNameAndPath.map(item => {
|
112
114
|
params.push(`${item.moduleName}Module`);
|
@@ -164,6 +166,17 @@ class LivePreview extends Base {
|
|
164
166
|
}
|
165
167
|
return null
|
166
168
|
}
|
169
|
+
|
170
|
+
/**
|
171
|
+
* @param {Object} data
|
172
|
+
* @param {Neo.component.Base} data.item
|
173
|
+
* @param {Number} data.oldValue
|
174
|
+
* @param {String} data.source
|
175
|
+
* @param {Number} data.value
|
176
|
+
*/
|
177
|
+
onActiveIndexChange(data) {
|
178
|
+
console.log('onActiveIndexChange', data)
|
179
|
+
}
|
167
180
|
}
|
168
181
|
|
169
182
|
Neo.applyClassConfig(LivePreview);
|
@@ -25,19 +25,29 @@ class HeaderToolbar extends Base {
|
|
25
25
|
text : 'neo.mjs'
|
26
26
|
}, '->', {
|
27
27
|
text: 'Docs',
|
28
|
-
ui : '
|
28
|
+
ui : 'ghost'
|
29
29
|
}, {
|
30
30
|
text: 'Learn',
|
31
|
-
ui : '
|
31
|
+
ui : 'ghost'
|
32
32
|
}, {
|
33
33
|
cls : ['github-button'],
|
34
34
|
iconCls: 'fa-brands fa-github',
|
35
|
-
ui : '
|
36
|
-
url : 'https://github.com/neomjs/neo'
|
35
|
+
ui : 'ghost',
|
36
|
+
url : 'https://github.com/neomjs/neo',
|
37
|
+
tooltip: {
|
38
|
+
html: 'GitHub',
|
39
|
+
showDelay: '0',
|
40
|
+
hideDelay: '0'
|
41
|
+
}
|
37
42
|
}, {
|
38
43
|
iconCls: 'fa-brands fa-slack',
|
39
|
-
ui : '
|
40
|
-
url : 'https://join.slack.com/t/neomjs/shared_invite/zt-6c50ueeu-3E1~M4T9xkNnb~M_prEEOA'
|
44
|
+
ui : 'ghost',
|
45
|
+
url : 'https://join.slack.com/t/neomjs/shared_invite/zt-6c50ueeu-3E1~M4T9xkNnb~M_prEEOA',
|
46
|
+
tooltip: {
|
47
|
+
html: 'Join Slack',
|
48
|
+
showDelay: '0',
|
49
|
+
hideDelay: '0'
|
50
|
+
}
|
41
51
|
}]
|
42
52
|
}
|
43
53
|
}
|
package/package.json
CHANGED
@@ -18,7 +18,6 @@ and information is lost.
|
|
18
18
|
<br>
|
19
19
|
|
20
20
|
To show highlighted Neo.mjs source code use
|
21
|
-
<pre>
|
22
21
|
<pre data-javascript>
|
23
22
|
// Source code goes here
|
24
23
|
</pre>
|
@@ -52,3 +51,7 @@ This is the item contents.
|
|
52
51
|
This is the item contents.
|
53
52
|
</details>
|
54
53
|
|
54
|
+
<pre data-neo>
|
55
|
+
let a = 1;
|
56
|
+
</pre>
|
57
|
+
|
@@ -319,6 +319,28 @@
|
|
319
319
|
}
|
320
320
|
}
|
321
321
|
}
|
322
|
+
},
|
323
|
+
"tooltip": {
|
324
|
+
"height": {
|
325
|
+
"value": "{height.24}",
|
326
|
+
"type": "sizing"
|
327
|
+
},
|
328
|
+
"spacinghorizontal": {
|
329
|
+
"value": "{sem.spacing.xsmall}",
|
330
|
+
"type": "spacing"
|
331
|
+
},
|
332
|
+
"fg": {
|
333
|
+
"value": "{sem.color.fg.neutral.inverted}",
|
334
|
+
"type": "color"
|
335
|
+
},
|
336
|
+
"bg": {
|
337
|
+
"value": "{sem.color.bg.neutral.contrast}",
|
338
|
+
"type": "color"
|
339
|
+
},
|
340
|
+
"borderradius": {
|
341
|
+
"value": "{sem.borderradius.medium}",
|
342
|
+
"type": "borderRadius"
|
343
|
+
}
|
322
344
|
}
|
323
345
|
}
|
324
346
|
}
|
@@ -40,6 +40,10 @@
|
|
40
40
|
"disabled": {
|
41
41
|
"value": "{gray.200}",
|
42
42
|
"type": "color"
|
43
|
+
},
|
44
|
+
"contrast": {
|
45
|
+
"value": "{gray.900}",
|
46
|
+
"type": "color"
|
43
47
|
}
|
44
48
|
},
|
45
49
|
"primary": {
|
@@ -82,6 +86,10 @@
|
|
82
86
|
"disabled": {
|
83
87
|
"value": "{gray.300}",
|
84
88
|
"type": "color"
|
89
|
+
},
|
90
|
+
"inverted": {
|
91
|
+
"value": "{white}",
|
92
|
+
"type": "color"
|
85
93
|
}
|
86
94
|
},
|
87
95
|
"primary": {
|
@@ -1,7 +1,11 @@
|
|
1
1
|
.neo-tooltip {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
background-color: var(--tooltip-bg);
|
3
|
+
border : var(--tooltip-border);
|
4
|
+
border-radius : var(--tooltip-borderradius);
|
5
|
+
box-shadow : var(--tooltip-boxshadow);
|
6
|
+
color : var(--tooltip-color);
|
7
|
+
font-size : var(--tooltip-fontsize);
|
8
|
+
height : var(--tooltip-height);
|
9
|
+
padding : var(--tooltip-padding);
|
10
|
+
position : absolute;
|
11
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
:root .neo-theme-neo-light { // .neo-tooltip
|
2
|
+
--tooltip-bg : black;
|
3
|
+
--tooltip-border : grey;
|
4
|
+
--tooltip-borderradius : 4px;
|
5
|
+
--tooltip-boxshadow : none;
|
6
|
+
--tooltip-color : white;
|
7
|
+
--tooltip-fontsize : 14px;
|
8
|
+
--tooltip-height : 24px;
|
9
|
+
--tooltip-padding : 2px 8px 0;
|
10
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
:root .neo-theme-neo-light { // .neo-tooltip
|
2
|
+
--tooltip-bg : white;
|
3
|
+
--tooltip-border : lightgrey;
|
4
|
+
--tooltip-borderradius : 4px;
|
5
|
+
--tooltip-boxshadow : none;
|
6
|
+
--tooltip-color : black;
|
7
|
+
--tooltip-fontsize : 14px;
|
8
|
+
--tooltip-height : 24px;
|
9
|
+
--tooltip-padding : 2px 8px 0;
|
10
|
+
}
|
@@ -45,28 +45,28 @@ $border-width : 1px;
|
|
45
45
|
--button-use-gradients : false;
|
46
46
|
|
47
47
|
// {module: Button; ui: --ghost}
|
48
|
-
--button-ghost-background-color : var(--button-
|
49
|
-
--button-ghost-background-color-active :
|
50
|
-
--button-ghost-background-color-disabled :
|
51
|
-
--button-ghost-background-color-hover : var(--button-
|
48
|
+
--button-ghost-background-color : var(--cmp-button-ghost-bg-default);
|
49
|
+
--button-ghost-background-color-active : var(--cmp-button-ghost-bg-active);
|
50
|
+
--button-ghost-background-color-disabled : var(--cmp-button-ghost-bg-disabled);
|
51
|
+
--button-ghost-background-color-hover : var(--cmp-button-ghost-bg-hover);
|
52
52
|
--button-ghost-background-image : none;
|
53
|
-
--button-ghost-badge-background-color :
|
54
|
-
--button-ghost-badge-color :
|
55
|
-
--button-ghost-border :
|
56
|
-
--button-ghost-border-active :
|
53
|
+
--button-ghost-badge-background-color : transparent;
|
54
|
+
--button-ghost-badge-color : transparent;
|
55
|
+
--button-ghost-border : none;
|
56
|
+
--button-ghost-border-active : none;
|
57
57
|
--button-ghost-border-disabled : inherit;
|
58
|
-
--button-ghost-border-hover :
|
59
|
-
--button-ghost-border-pressed :
|
60
|
-
--button-ghost-glyph-color : var(--button-
|
61
|
-
--button-ghost-glyph-color-active :
|
62
|
-
--button-ghost-glyph-color-disabled :
|
63
|
-
--button-ghost-glyph-color-hover :
|
64
|
-
--button-ghost-opacity-disabled :
|
58
|
+
--button-ghost-border-hover : none;
|
59
|
+
--button-ghost-border-pressed : none;
|
60
|
+
--button-ghost-glyph-color : var(--cmp-button-ghost-fg-default);
|
61
|
+
--button-ghost-glyph-color-active : inherit;
|
62
|
+
--button-ghost-glyph-color-disabled : var(--cmp-button-ghost-fg-disabled);
|
63
|
+
--button-ghost-glyph-color-hover : inherit;
|
64
|
+
--button-ghost-opacity-disabled : inherit;
|
65
65
|
--button-ghost-ripple-background-color : inherit;
|
66
|
-
--button-ghost-text-color : var(--button-
|
67
|
-
--button-ghost-text-color-active :
|
68
|
-
--button-ghost-text-color-disabled :
|
69
|
-
--button-ghost-text-color-hover :
|
66
|
+
--button-ghost-text-color : var(--cmp-button-ghost-fg-default);
|
67
|
+
--button-ghost-text-color-active : inherit;
|
68
|
+
--button-ghost-text-color-disabled : var(--cmp-button-ghost-fg-disabled);
|
69
|
+
--button-ghost-text-color-hover : inherit;
|
70
70
|
|
71
71
|
// {module: Button; ui: --secondary}
|
72
72
|
--button-secondary-background-color : var(--cmp-button-secondary-bg-default);
|
@@ -116,3 +116,7 @@ $border-width : 1px;
|
|
116
116
|
--button-tertiary-text-color-disabled : inherit;
|
117
117
|
--button-tertiary-text-color-hover : var(--button-text-color);
|
118
118
|
}
|
119
|
+
|
120
|
+
.neo-button {
|
121
|
+
min-width: var(--cmp-button-height);
|
122
|
+
}
|
@@ -70,4 +70,10 @@
|
|
70
70
|
--cmp-tab-unselected-bg-active : var(--sem-color-bg-neutral-active);
|
71
71
|
--cmp-tab-unselected-bg-default : transparent;
|
72
72
|
--cmp-tab-unselected-bg-hover : var(--sem-color-bg-neutral-hover);
|
73
|
+
|
74
|
+
--cmp-tooltip-bg : var(--sem-color-bg-neutral-contrast);
|
75
|
+
--cmp-tooltip-borderradius : var(--sem-borderradius-medium);
|
76
|
+
--cmp-tooltip-fg : var(--sem-color-fg-neutral-inverted);
|
77
|
+
--cmp-tooltip-height : var(--height-24);
|
78
|
+
--cmp-tooltip-spacinghorizontal : var(--sem-spacing-xsmall);
|
73
79
|
}
|
@@ -6,6 +6,7 @@
|
|
6
6
|
--core-fontfamily-mono : 'Source Code Pro';
|
7
7
|
--core-fontfamily-sans : 'Source Sans 3';
|
8
8
|
--core-fontfamily-serif : 'Source Serif Pro';
|
9
|
+
--core-fontsize-label : 1rem;
|
9
10
|
--core-fontsize-body : 16px;
|
10
11
|
--core-fontsize-h1 : 2.5rem;
|
11
12
|
--core-fontsize-h2 : 1.75rem;
|
@@ -42,6 +43,7 @@
|
|
42
43
|
--height-48 : 48px;
|
43
44
|
--height-56 : 56px;
|
44
45
|
--height-8 : 8px;
|
46
|
+
--height-24 : 24px;
|
45
47
|
--purple-100 : #efe3ff;
|
46
48
|
--purple-200 : #d0aaff;
|
47
49
|
--purple-300 : #b071ff;
|
@@ -3,11 +3,11 @@
|
|
3
3
|
--sem-borderradius-medium : var(--borderradius-4);
|
4
4
|
--sem-borderradius-none : var(--borderradius-0);
|
5
5
|
--sem-borderwidth-focus : 3px;
|
6
|
-
--sem-color-bg-neutral-active :
|
6
|
+
--sem-color-bg-neutral-active : rgba(0, 0, 0, .1);
|
7
7
|
--sem-color-bg-neutral-default : var(--gray-50);
|
8
8
|
--sem-color-bg-neutral-disabled : var(--gray-200);
|
9
9
|
--sem-color-bg-neutral-highlighted : var(--white);
|
10
|
-
--sem-color-bg-neutral-hover :
|
10
|
+
--sem-color-bg-neutral-hover :rgba(0, 0, 0, .05);
|
11
11
|
--sem-color-bg-primary-active : var(--green-600);
|
12
12
|
--sem-color-bg-primary-background : var(--green-50);
|
13
13
|
--sem-color-bg-primary-default : var(--green-400);
|
@@ -64,4 +64,6 @@
|
|
64
64
|
--sem-typo-label-regular-fontFamily : var(--core-fontfamily-sans);
|
65
65
|
--sem-typo-label-regular-fontSize : var(--core-fontsize-body);
|
66
66
|
--sem-typo-label-regular-fontWeight : var(--core-fontweight-regular);
|
67
|
+
--sem-color-bg-neutral-contrast : var(--gray-900);
|
68
|
+
--sem-color-fg-neutral-inverted : var(--white);
|
67
69
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
:root .neo-theme-neo-light { // .neo-tooltip
|
2
|
+
--tooltip-bg : var(--cmp-tooltip-bg);
|
3
|
+
--tooltip-border : none;
|
4
|
+
--tooltip-borderradius : var(--cmp-tooltip-borderradius);
|
5
|
+
--tooltip-boxshadow : none;
|
6
|
+
--tooltip-color : var(--cmp-tooltip-fg);
|
7
|
+
--tooltip-fontsize : 14px;
|
8
|
+
--tooltip-height : var(--cmp-tooltip-height);
|
9
|
+
--tooltip-padding : 2px var(--cmp-tooltip-spacinghorizontal) 0;
|
10
|
+
}
|
11
|
+
|
12
|
+
|
13
|
+
// 3px 3px 4px rgba(0,0,0, .6);
|
package/src/DefaultConfig.mjs
CHANGED
@@ -236,12 +236,12 @@ const DefaultConfig = {
|
|
236
236
|
useVdomWorker: true,
|
237
237
|
/**
|
238
238
|
* buildScripts/injectPackageVersion.mjs will update this value
|
239
|
-
* @default '6.10.
|
239
|
+
* @default '6.10.4'
|
240
240
|
* @memberOf! module:Neo
|
241
241
|
* @name config.version
|
242
242
|
* @type String
|
243
243
|
*/
|
244
|
-
version: '6.10.
|
244
|
+
version: '6.10.4'
|
245
245
|
};
|
246
246
|
|
247
247
|
Object.assign(DefaultConfig, {
|
package/src/Main.mjs
CHANGED
package/src/core/Observable.mjs
CHANGED
@@ -91,6 +91,21 @@ class Observable extends Base {
|
|
91
91
|
return null;
|
92
92
|
}
|
93
93
|
|
94
|
+
/**
|
95
|
+
* Call the passed function, or a function by *name* which exists in the passed scope's
|
96
|
+
* or this component's ownership chain.
|
97
|
+
* @param {Function|String} fn A function, or the name of a function to find in the passed scope object/
|
98
|
+
* @param {Object} scope The scope to find the function in if it is specified as a string.
|
99
|
+
* @param {Array} args Arguments to pass to the callback.
|
100
|
+
*/
|
101
|
+
callback(fn, scope=this, args) {
|
102
|
+
if (fn) {
|
103
|
+
const handler = this.resolveCallback(fn, scope);
|
104
|
+
|
105
|
+
handler.fn.apply(handler.scope, args);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
94
109
|
/**
|
95
110
|
* @param name
|
96
111
|
*/
|
@@ -127,21 +142,6 @@ class Observable extends Base {
|
|
127
142
|
}
|
128
143
|
}
|
129
144
|
|
130
|
-
/**
|
131
|
-
* Call the passed function, or a function by *name* which exists in the passed scope's
|
132
|
-
* or this component's ownership chain.
|
133
|
-
* @param {Function|String} fn A function, or the name of a function to find in the passed scope object/
|
134
|
-
* @param {Object} scope The scope to find the function in if it is specified as a string.
|
135
|
-
* @param {Array} args Arguments to pass to the callback.
|
136
|
-
*/
|
137
|
-
callback(fn, scope=this, args) {
|
138
|
-
if (fn) {
|
139
|
-
const handler = this.resolveCallback(fn, scope);
|
140
|
-
|
141
|
-
handler.fn.apply(handler.scope, args);
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
145
|
/**
|
146
146
|
* @param {Object} config
|
147
147
|
*/
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import Base from '../../core/Base.mjs';
|
2
2
|
|
3
3
|
/**
|
4
|
-
*
|
5
4
|
* @class Neo.main.addon.WindowPosition
|
6
5
|
* @extends Neo.core.Base
|
7
6
|
* @singleton
|
@@ -13,14 +12,22 @@ class WindowPosition extends Base {
|
|
13
12
|
* @protected
|
14
13
|
*/
|
15
14
|
className: 'Neo.main.addon.WindowPosition',
|
15
|
+
/**
|
16
|
+
* @member {Boolean} adjustWindowPositions=true
|
17
|
+
*/
|
18
|
+
adjustWindowPositions: true,
|
16
19
|
/**
|
17
20
|
* @member {String|null} intervalId=null
|
18
21
|
*/
|
19
22
|
intervalId: null,
|
20
23
|
/**
|
21
|
-
* @member {Number} intervalTime=
|
24
|
+
* @member {Number} intervalTime=20
|
22
25
|
*/
|
23
26
|
intervalTime: 20,
|
27
|
+
/**
|
28
|
+
* @member {Boolean} observeResize_=true
|
29
|
+
*/
|
30
|
+
observeResize_: true,
|
24
31
|
/**
|
25
32
|
* Remote method access for other workers
|
26
33
|
* @member {Object} remote
|
@@ -29,6 +36,7 @@ class WindowPosition extends Base {
|
|
29
36
|
remote: {
|
30
37
|
app: [
|
31
38
|
'registerWindow',
|
39
|
+
'setConfigs',
|
32
40
|
'setDock',
|
33
41
|
'unregisterWindow'
|
34
42
|
]
|
@@ -65,8 +73,21 @@ class WindowPosition extends Base {
|
|
65
73
|
me.screenLeft = win.screenLeft;
|
66
74
|
me.screenTop = win.screenTop;
|
67
75
|
|
68
|
-
win.addEventListener('mouseout', me.onMouseOut.bind(me))
|
69
|
-
|
76
|
+
win.addEventListener('mouseout', me.onMouseOut.bind(me))
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Triggered after the observeResize config got changed
|
81
|
+
* @param {Boolean} value
|
82
|
+
* @param {Boolean} oldValue
|
83
|
+
* @protected
|
84
|
+
*/
|
85
|
+
afterSetObserveResize(value, oldValue) {
|
86
|
+
let me = this;
|
87
|
+
|
88
|
+
if (value) {
|
89
|
+
window[value ? 'addEventListener' : 'removeEventListener']('resize', me.onResize.bind(me))
|
90
|
+
}
|
70
91
|
}
|
71
92
|
|
72
93
|
/**
|
@@ -82,8 +103,8 @@ class WindowPosition extends Base {
|
|
82
103
|
windowName: key,
|
83
104
|
x : position.left,
|
84
105
|
y : position.top
|
85
|
-
})
|
86
|
-
})
|
106
|
+
})
|
107
|
+
})
|
87
108
|
}
|
88
109
|
|
89
110
|
/**
|
@@ -100,7 +121,7 @@ class WindowPosition extends Base {
|
|
100
121
|
if (me.screenLeft !== screenLeft || me.screenTop !== screenTop) {
|
101
122
|
winData = Neo.Main.getWindowData();
|
102
123
|
|
103
|
-
me.adjustPositions();
|
124
|
+
me.adjustWindowPositions && me.adjustPositions();
|
104
125
|
|
105
126
|
Manager.sendMessage('app', {
|
106
127
|
action: 'windowPositionChange',
|
@@ -111,7 +132,7 @@ class WindowPosition extends Base {
|
|
111
132
|
});
|
112
133
|
|
113
134
|
me.screenLeft = screenLeft;
|
114
|
-
me.screenTop = screenTop
|
135
|
+
me.screenTop = screenTop
|
115
136
|
}
|
116
137
|
}
|
117
138
|
|
@@ -124,7 +145,7 @@ class WindowPosition extends Base {
|
|
124
145
|
*/
|
125
146
|
dockDirectionChange(oldValue, newValue) {
|
126
147
|
return (oldValue === 'bottom' || oldValue === 'top') && (newValue === 'left' || newValue === 'right')
|
127
|
-
|| (newValue === 'bottom' || newValue === 'top') && (oldValue === 'left' || oldValue === 'right')
|
148
|
+
|| (newValue === 'bottom' || newValue === 'top') && (oldValue === 'left' || oldValue === 'right')
|
128
149
|
}
|
129
150
|
|
130
151
|
/**
|
@@ -134,29 +155,26 @@ class WindowPosition extends Base {
|
|
134
155
|
let win = window,
|
135
156
|
left, top;
|
136
157
|
|
137
|
-
switch
|
158
|
+
switch(data.dock) {
|
138
159
|
case 'bottom':
|
139
160
|
left = win.screenLeft;
|
140
161
|
top = win.outerHeight + win.screenTop - 50;
|
141
|
-
break
|
162
|
+
break
|
142
163
|
case 'left':
|
143
164
|
left = win.screenLeft - data.size;
|
144
165
|
top = win.screenTop + 28;
|
145
|
-
break
|
166
|
+
break
|
146
167
|
case 'right':
|
147
168
|
left = win.outerWidth + win.screenLeft;
|
148
169
|
top = win.screenTop + 28;
|
149
|
-
break
|
170
|
+
break
|
150
171
|
case 'top':
|
151
172
|
left = win.screenLeft;
|
152
173
|
top = win.screenTop - data.size + 78;
|
153
|
-
break
|
174
|
+
break
|
154
175
|
}
|
155
176
|
|
156
|
-
return {
|
157
|
-
left: left,
|
158
|
-
top : top
|
159
|
-
};
|
177
|
+
return {left, top}
|
160
178
|
}
|
161
179
|
|
162
180
|
/**
|
@@ -167,11 +185,11 @@ class WindowPosition extends Base {
|
|
167
185
|
|
168
186
|
if (!event.toElement) {
|
169
187
|
if (!me.intervalId) {
|
170
|
-
me.intervalId = setInterval(me.checkMovement.bind(me), me.intervalTime)
|
188
|
+
me.intervalId = setInterval(me.checkMovement.bind(me), me.intervalTime)
|
171
189
|
}
|
172
190
|
} else if (me.intervalId) {
|
173
191
|
clearInterval(me.intervalId);
|
174
|
-
me.intervalId = null
|
192
|
+
me.intervalId = null
|
175
193
|
}
|
176
194
|
}
|
177
195
|
|
@@ -188,21 +206,21 @@ class WindowPosition extends Base {
|
|
188
206
|
case 'bottom':
|
189
207
|
case 'top':
|
190
208
|
width = win.outerWidth;
|
191
|
-
break
|
209
|
+
break
|
192
210
|
case 'left':
|
193
211
|
case 'right':
|
194
212
|
height = win.outerHeight - 28;
|
195
|
-
break
|
213
|
+
break
|
196
214
|
}
|
197
215
|
|
198
216
|
Neo.Main.windowResizeTo({
|
199
217
|
height : height,
|
200
218
|
width : width,
|
201
219
|
windowName: key
|
202
|
-
})
|
220
|
+
})
|
203
221
|
});
|
204
222
|
|
205
|
-
me.adjustPositions()
|
223
|
+
me.adjustWindowPositions && me.adjustPositions()
|
206
224
|
}
|
207
225
|
|
208
226
|
/**
|
@@ -212,7 +230,17 @@ class WindowPosition extends Base {
|
|
212
230
|
* @param {Number} data.size
|
213
231
|
*/
|
214
232
|
registerWindow(data) {
|
215
|
-
this.windows[data.name] = data
|
233
|
+
this.windows[data.name] = data
|
234
|
+
}
|
235
|
+
|
236
|
+
/**
|
237
|
+
* Set configs from within the app worker
|
238
|
+
* @param {Object} data
|
239
|
+
* @param {String} data.appName
|
240
|
+
*/
|
241
|
+
setConfigs(data) {
|
242
|
+
delete data.appName;
|
243
|
+
this.set(data)
|
216
244
|
}
|
217
245
|
|
218
246
|
/**
|
@@ -239,14 +267,14 @@ class WindowPosition extends Base {
|
|
239
267
|
height : dock === 'bottom' || dock === 'top' ? win.size : window.outerHeight - 28,
|
240
268
|
width : dock === 'left' || dock === 'right' ? win.size : window.outerWidth,
|
241
269
|
windowName: name
|
242
|
-
})
|
270
|
+
})
|
243
271
|
}
|
244
272
|
|
245
273
|
Neo.Main.windowMoveTo({
|
246
274
|
windowName: name,
|
247
275
|
x : position.left,
|
248
276
|
y : position.top
|
249
|
-
})
|
277
|
+
})
|
250
278
|
}
|
251
279
|
}
|
252
280
|
|
@@ -255,7 +283,7 @@ class WindowPosition extends Base {
|
|
255
283
|
* @param {String} data.name
|
256
284
|
*/
|
257
285
|
unregisterWindow(data) {
|
258
|
-
delete this.windows[data.name]
|
286
|
+
delete this.windows[data.name]
|
259
287
|
}
|
260
288
|
}
|
261
289
|
|
package/src/worker/App.mjs
CHANGED
@@ -29,6 +29,7 @@ class App extends Base {
|
|
29
29
|
main: [
|
30
30
|
'createNeoInstance',
|
31
31
|
'destroyNeoInstance',
|
32
|
+
'fireEvent',
|
32
33
|
'setConfigs'
|
33
34
|
]
|
34
35
|
},
|
@@ -189,6 +190,30 @@ class App extends Base {
|
|
189
190
|
return false
|
190
191
|
}
|
191
192
|
|
193
|
+
/**
|
194
|
+
* Fires a custom event based on core.Observable on any app realm based Neo instance from main
|
195
|
+
* @param {Object} data
|
196
|
+
* @param {String} data.id
|
197
|
+
* @param {String} data.name
|
198
|
+
*/
|
199
|
+
fireEvent(data) {
|
200
|
+
let instance = Neo.get(data.id),
|
201
|
+
name;
|
202
|
+
|
203
|
+
if (instance) {
|
204
|
+
name = data.name;
|
205
|
+
|
206
|
+
delete data.id;
|
207
|
+
delete data.name;
|
208
|
+
|
209
|
+
instance.fire(name, data);
|
210
|
+
|
211
|
+
return true
|
212
|
+
}
|
213
|
+
|
214
|
+
return false
|
215
|
+
}
|
216
|
+
|
192
217
|
/**
|
193
218
|
* Only needed for the SharedWorkers context
|
194
219
|
* @param {String} eventName
|
@@ -196,7 +221,7 @@ class App extends Base {
|
|
196
221
|
*/
|
197
222
|
fireMainViewsEvent(eventName, data) {
|
198
223
|
this.ports.forEach(port => {
|
199
|
-
Neo.apps[port.appName].
|
224
|
+
Neo.apps[port.appName].mainView.fire(eventName, data)
|
200
225
|
})
|
201
226
|
}
|
202
227
|
|
package/src/worker/Canvas.mjs
CHANGED
@@ -45,7 +45,7 @@ class Canvas extends Base {
|
|
45
45
|
|
46
46
|
me.sendMessage('app', {action: 'registerPort', transfer: port2}, [port2]);
|
47
47
|
|
48
|
-
me.channelPorts.app = port1
|
48
|
+
me.channelPorts.app = port1
|
49
49
|
}
|
50
50
|
|
51
51
|
/**
|
@@ -58,7 +58,7 @@ class Canvas extends Base {
|
|
58
58
|
action : 'reply',
|
59
59
|
replyId: data.id,
|
60
60
|
success: true
|
61
|
-
})
|
61
|
+
})
|
62
62
|
}
|
63
63
|
|
64
64
|
/**
|
@@ -75,8 +75,8 @@ class Canvas extends Base {
|
|
75
75
|
/* webpackMode: "lazy" */
|
76
76
|
`../../${path}/canvas.mjs`
|
77
77
|
).then(module => {
|
78
|
-
module.onStart()
|
79
|
-
})
|
78
|
+
module.onStart()
|
79
|
+
})
|
80
80
|
}
|
81
81
|
}
|
82
82
|
|