neo.mjs 6.20.0 → 6.21.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.
- package/apps/ServiceWorker.mjs +2 -2
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +1 -1
- package/resources/scss/src/code/LivePreview.scss +4 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/code/LivePreview.mjs +101 -6
- package/src/component/Helix.mjs +10 -7
- package/src/main/DomEvents.mjs +2 -2
- package/src/main/mixin/TouchDomEvents.mjs +6 -1
package/apps/ServiceWorker.mjs
CHANGED
package/package.json
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
.neo-code-live-preview {
|
2
|
-
margin-bottom: 2em;
|
2
|
+
margin-bottom : 2em;
|
3
|
+
transition-duration : .3s;
|
4
|
+
transition-property : height, left, top, width;
|
5
|
+
transition-timing-function: ease-out;
|
3
6
|
|
4
7
|
.live-preview-container {
|
5
8
|
border-radius: calc(var(--cmp-tab-strip-height) + var(--cmp-button-borderradius));
|
package/src/DefaultConfig.mjs
CHANGED
@@ -260,12 +260,12 @@ const DefaultConfig = {
|
|
260
260
|
useVdomWorker: true,
|
261
261
|
/**
|
262
262
|
* buildScripts/injectPackageVersion.mjs will update this value
|
263
|
-
* @default '6.
|
263
|
+
* @default '6.21.0'
|
264
264
|
* @memberOf! module:Neo
|
265
265
|
* @name config.version
|
266
266
|
* @type String
|
267
267
|
*/
|
268
|
-
version: '6.
|
268
|
+
version: '6.21.0'
|
269
269
|
};
|
270
270
|
|
271
271
|
Object.assign(DefaultConfig, {
|
package/src/code/LivePreview.mjs
CHANGED
@@ -44,6 +44,10 @@ class LivePreview extends Container {
|
|
44
44
|
* @member {Boolean} disableRunSource=false
|
45
45
|
*/
|
46
46
|
disableRunSource: false,
|
47
|
+
/**
|
48
|
+
* @member {Boolean} enableFullscreen=true
|
49
|
+
*/
|
50
|
+
enableFullscreen: true,
|
47
51
|
/**
|
48
52
|
* @member {Number} height=400
|
49
53
|
*/
|
@@ -127,6 +131,73 @@ class LivePreview extends Container {
|
|
127
131
|
return this.beforeSetEnumValue(value, oldValue, 'activeView')
|
128
132
|
}
|
129
133
|
|
134
|
+
/**
|
135
|
+
* @param {Object} data
|
136
|
+
*/
|
137
|
+
async collapseExpand(data) {
|
138
|
+
let me = this,
|
139
|
+
button = data.component,
|
140
|
+
collapse = button.iconCls === 'fas fa-compress',
|
141
|
+
{vdom} = me,
|
142
|
+
rect;
|
143
|
+
|
144
|
+
button.iconCls = collapse ? 'fas fa-expand' : 'fas fa-compress';
|
145
|
+
|
146
|
+
if (collapse) {
|
147
|
+
button.iconCls = 'fas fa-expand';
|
148
|
+
|
149
|
+
rect = me.collapseRect;
|
150
|
+
|
151
|
+
delete me.collapseRect;
|
152
|
+
|
153
|
+
Object.assign(vdom.style, {
|
154
|
+
height : rect.height + 'px',
|
155
|
+
left : rect.x + 'px',
|
156
|
+
top : rect.y + 'px',
|
157
|
+
width : rect.width + 'px'
|
158
|
+
});
|
159
|
+
|
160
|
+
me.update();
|
161
|
+
|
162
|
+
await me.timeout(300);
|
163
|
+
|
164
|
+
Object.assign(vdom.style, {
|
165
|
+
position: null,
|
166
|
+
zIndex : null
|
167
|
+
})
|
168
|
+
} else {
|
169
|
+
button.iconCls = 'fas fa-compress';
|
170
|
+
|
171
|
+
rect = await me.getDomRect(me.id);
|
172
|
+
|
173
|
+
me.collapseRect = rect;
|
174
|
+
|
175
|
+
vdom.style = vdom.style || {};
|
176
|
+
|
177
|
+
Object.assign(vdom.style, {
|
178
|
+
height : rect.height + 'px',
|
179
|
+
left : rect.x + 'px',
|
180
|
+
position: 'fixed',
|
181
|
+
top : rect.y + 'px',
|
182
|
+
width : rect.width + 'px',
|
183
|
+
zIndex : 100
|
184
|
+
});
|
185
|
+
|
186
|
+
me.update();
|
187
|
+
|
188
|
+
await me.timeout(50);
|
189
|
+
|
190
|
+
Object.assign(vdom.style, {
|
191
|
+
height: '100%',
|
192
|
+
left : 0,
|
193
|
+
top : 0,
|
194
|
+
width : '100%'
|
195
|
+
})
|
196
|
+
}
|
197
|
+
|
198
|
+
me.update()
|
199
|
+
}
|
200
|
+
|
130
201
|
/**
|
131
202
|
*
|
132
203
|
*/
|
@@ -269,12 +340,20 @@ class LivePreview extends Container {
|
|
269
340
|
* @param {Number} data.value
|
270
341
|
*/
|
271
342
|
onActiveIndexChange(data) {
|
343
|
+
let me = this,
|
344
|
+
collapseExpandButton = me.getReference('collapse-expand-button'),
|
345
|
+
hidden = data.value !== 1;
|
346
|
+
|
272
347
|
if (data.item.reference === 'preview') {
|
273
|
-
|
348
|
+
me.doRunSource()
|
274
349
|
}
|
275
350
|
|
276
|
-
|
277
|
-
|
351
|
+
if (collapseExpandButton) {
|
352
|
+
collapseExpandButton.hidden = hidden
|
353
|
+
}
|
354
|
+
|
355
|
+
me.getReference('popout-window-button').hidden = hidden
|
356
|
+
me.disableRunSource = false;
|
278
357
|
}
|
279
358
|
|
280
359
|
/**
|
@@ -284,18 +363,34 @@ class LivePreview extends Container {
|
|
284
363
|
super.onConstructed();
|
285
364
|
|
286
365
|
let me = this,
|
366
|
+
items = [],
|
287
367
|
{tabContainer} = me;
|
288
368
|
|
289
|
-
|
290
|
-
|
369
|
+
if (me.enableFullscreen) {
|
370
|
+
items.push({
|
371
|
+
handler : me.collapseExpand.bind(me),
|
372
|
+
hidden : tabContainer.activeIndex !== 1,
|
373
|
+
iconCls : 'fas fa-expand',
|
374
|
+
reference: 'collapse-expand-button',
|
375
|
+
ui : 'ghost'
|
376
|
+
})
|
377
|
+
}
|
378
|
+
|
379
|
+
items.push({
|
291
380
|
handler : me.popoutPreview.bind(me),
|
292
381
|
hidden : tabContainer.activeIndex !== 1,
|
293
382
|
iconCls : 'far fa-window-maximize',
|
294
383
|
reference: 'popout-window-button',
|
295
|
-
style : {marginLeft: 'auto'},
|
296
384
|
ui : 'ghost'
|
297
385
|
});
|
298
386
|
|
387
|
+
items[0].style = {marginLeft: 'auto'};
|
388
|
+
|
389
|
+
// we want to add a normal (non-header) button
|
390
|
+
tabContainer.getTabBar().add(items);
|
391
|
+
|
392
|
+
tabContainer.getTabBar().update();
|
393
|
+
|
299
394
|
tabContainer.on('activeIndexChange', me.onActiveIndexChange, me);
|
300
395
|
|
301
396
|
// changing the activeView initially will not trigger our onActiveIndexChange() logic
|
package/src/component/Helix.mjs
CHANGED
@@ -841,13 +841,6 @@ class Helix extends Component {
|
|
841
841
|
}
|
842
842
|
}
|
843
843
|
|
844
|
-
/**
|
845
|
-
* @param {Object} data
|
846
|
-
*/
|
847
|
-
onTouchMove(data) {
|
848
|
-
this.onMouseWheel(data)
|
849
|
-
}
|
850
|
-
|
851
844
|
/**
|
852
845
|
* @param {String[]} value
|
853
846
|
* @param {String[]} oldValue
|
@@ -879,6 +872,16 @@ class Helix extends Component {
|
|
879
872
|
this.createItems()
|
880
873
|
}
|
881
874
|
|
875
|
+
/**
|
876
|
+
* @param {Object} data
|
877
|
+
*/
|
878
|
+
onTouchMove(data) {
|
879
|
+
data.deltaX *= 1.5;
|
880
|
+
data.deltaY *= 3;
|
881
|
+
|
882
|
+
this.onMouseWheel(data)
|
883
|
+
}
|
884
|
+
|
882
885
|
/**
|
883
886
|
* @protected
|
884
887
|
*/
|
package/src/main/DomEvents.mjs
CHANGED
@@ -27,7 +27,7 @@ const touchEvents = [
|
|
27
27
|
{name: 'touchend', handler: 'onTouchEnd'},
|
28
28
|
{name: 'touchenter', handler: 'onTouchEnter'},
|
29
29
|
{name: 'touchleave', handler: 'onTouchLeave'},
|
30
|
-
{name: 'touchmove', handler: 'onTouchMove'},
|
30
|
+
{name: 'touchmove', handler: 'onTouchMove', options: {passive: false}},
|
31
31
|
{name: 'touchstart', handler: 'onTouchStart'}
|
32
32
|
];
|
33
33
|
|
@@ -612,7 +612,7 @@ class DomEvents extends Base {
|
|
612
612
|
*/
|
613
613
|
onScroll(event) {
|
614
614
|
let {clientHeight, clientWidth, scrollLeft, scrollTop} = event.target;
|
615
|
-
|
615
|
+
event.preventDefault();
|
616
616
|
this.sendMessageToApp({
|
617
617
|
...this.getEventData(event),
|
618
618
|
clientHeight,
|