efront 3.14.11 → 3.15.1

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.
@@ -173,7 +173,7 @@ function checkRefered(scope) {
173
173
  if (right.length) {
174
174
  var key = createExpressKey(right);
175
175
  var iswrite = false;
176
- iswrite = !!o.kind || !!e && e.type === STAMP && /=$/.test(e.text);
176
+ iswrite = !!o.kind || !!e && e.type === STAMP && /(?<![\!\=])\=$/.test(e.text);
177
177
  if (key) map[key] = map[key] | 1 + iswrite;
178
178
  }
179
179
  }
@@ -11,9 +11,10 @@ var rgb4v = function (r, g, b, v) {
11
11
  };
12
12
 
13
13
 
14
+ var number_sort = (a, b) => a - b;
14
15
 
15
16
  var rgb4h = function (r, g, b, h) {
16
- var [p, q, s] = [r, g, b].sort();
17
+ var [p, q, s] = [r, g, b].sort(number_sort);
17
18
  var m = s - p;
18
19
  h = (h % 360 + 360) % 360;
19
20
  if (h < 60) {
@@ -1,5 +1,5 @@
1
1
  function extendTouchEvent(e) {
2
- var touch = e.touches[0];
2
+ var touch = e.changedTouches[0];
3
3
  for (var k in touch) {
4
4
  if (!(k in e)) e[k] = touch[k];
5
5
  }
@@ -265,7 +265,7 @@ function main(page, items, active, direction = 'y') {
265
265
  };
266
266
  var open1 = function (event) {
267
267
  if (event.which === 3) event.preventDefault();
268
- if (istoolbar) open.call(this, event.button ? 20 : 600);
268
+ if (istoolbar) open.call(this, event.which === 3 ? 20 : 600);
269
269
  };
270
270
  if (!page.children.length || page.menutype === 1) {
271
271
  page.menutype = 1;
@@ -316,7 +316,8 @@ function main(page, items, active, direction = 'y') {
316
316
  a.menu = item;
317
317
  on("mouseleave")(a, cancel);
318
318
  on("mouseenter")(a, open);
319
- if (istoolbar) on("mousedown")(a, open1);
319
+ on("pointermove")(a, open);
320
+ if (istoolbar) on("pointerdown")(a, open1);
320
321
  on("click")(a, fire);
321
322
  return a;
322
323
  });
@@ -347,7 +348,8 @@ function main(page, items, active, direction = 'y') {
347
348
  elem.menu = this.src[index];
348
349
  on("mouseleave")(elem, cancel);
349
350
  on("mouseenter")(elem, open);
350
- if (istoolbar) on("mousedown")(elem, open1);
351
+ on("pointermove")(elem, cancel);
352
+ if (istoolbar) on("pointerdown")(elem, open1);
351
353
  on("click")(elem, fire);
352
354
  return elem;
353
355
  }, direction);
@@ -35,6 +35,7 @@ function moveupon(target, { start, move, end }, initialEvent) {
35
35
  };
36
36
  var cancel = function (event) {
37
37
  if (event.touches && event.touches.length) return;
38
+ if (event.touches) extendTouchEvent(event);
38
39
  removeAllListeners();
39
40
  if (isFunction(offmouseup)) offmouseup();
40
41
  if (isFunction(offtouchcancel)) offtouchcancel();
package/coms/zimoli/on.js CHANGED
@@ -330,10 +330,49 @@ if (is_addEventListener_enabled) {
330
330
  }, true);
331
331
  });
332
332
  }
333
+ var invoke = function (event, type, pointerType) {
334
+ var target = event.target;
335
+ var touch = event.changedTouches ? event.changedTouches[0] : event;
336
+ var clickEvent = document.createEvent("MouseEvents");
337
+ clickEvent.touchend = true;
338
+ clickEvent.pointerType = pointerType
339
+ clickEvent.initMouseEvent(type, true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
340
+ dispatch(target, clickEvent);
341
+ };
333
342
 
343
+ (function () {
344
+ var pointeractive = null;
345
+ if ("onpointerdown" in window) return;
346
+ var getPointerType = function (event) {
347
+ return event.type.replace(/(start|move|end|cancel|down|up|leave|out|over|enter)$/i, '');
348
+ };
349
+ var pointerdown = function (event) {
350
+ if (pointeractive) return;
351
+ pointeractive = getPointerType(event);
352
+ invoke(event, 'pointerdown', pointeractive);
353
+ };
354
+ var pointerup = function (event) {
355
+ var pointerType = getPointerType(event);
356
+ if (!pointeractive || pointerType !== pointeractive) return;
357
+ invoke(event, 'pointerup', pointerType);
358
+ };
359
+ var pointermove = function (event) {
360
+ var pointerType = getPointerType(event);
361
+ if (pointeractive && pointerType !== pointeractive) return;
362
+ invoke(event, 'pointermove', pointerType);
363
+ };
364
+ on('mousedown')(window, pointerdown, true);
365
+ on('mouseup')(window, pointerdown, true);
366
+ on('touchstart')(window, pointerdown, true);
367
+ on("touchmove")(window, pointermove, true);
368
+ on("mousemove")(window, pointermove, true);
369
+ on("touchend")(window, pointerup, true);
370
+ on("touchcancel")(window, pointerup, true);
371
+ }());
334
372
 
335
373
  (function () {
336
374
  // fastclick
375
+ if (window.fastclick) return;
337
376
  if (document.efronton) return on = document.efronton;
338
377
  document.efronton = on;
339
378
  var onclick = on("click");
@@ -371,12 +410,7 @@ if (is_addEventListener_enabled) {
371
410
  if (onclick.preventClick) return;
372
411
  needFireClick = true;
373
412
  touchendFired = true;
374
- var target = event.target;
375
- var touch = event.changedTouches[0];
376
- var clickEvent = document.createEvent("MouseEvents");
377
- clickEvent.touchend = true;
378
- clickEvent.initMouseEvent("click", true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
379
- dispatch(target, clickEvent);
413
+ invoke(event, 'click');
380
414
  }, true);
381
415
  window.addEventListener("click", function (event) {
382
416
  if (!isClickWithPointer) return;
@@ -1,7 +1,3 @@
1
- var mountedPictures = [];
2
- on("resize")(window, function () {
3
- mountedPictures.forEach(a => a.update());
4
- });
5
1
  var getstation = function (n, s) {
6
2
  var scale = Math.pow(10, Math.round(Math.log(n) / Math.log(10)));
7
3
  var step;
@@ -18,7 +14,7 @@ var trimCoord = move.trimCoord;
18
14
  var isequal = (a, b) => a === b || Math.abs((a - b) / (a + b)) < 1e-12;
19
15
  function picture_(image = document.createElement("div")) {
20
16
  var image_width, image_height;
21
- var scaled, x, y, min_scale, loaded_scale, locked_scale, click_scale, loaded_x, loaded_y;
17
+ var scaled = 1, x = 0, y = 0, min_scale, loaded_scale, locked_scale, click_scale, loaded_x, loaded_y;
22
18
  var loaded_width, loaded_height;
23
19
  var max_scale = 10 * devicePixelRatio;
24
20
  var shape = function () {
@@ -59,13 +55,6 @@ function picture_(image = document.createElement("div")) {
59
55
  };
60
56
 
61
57
  on("append")(image, loadParams);
62
-
63
- on("append")(image, function () {
64
- mountedPictures.push(image);
65
- });
66
- on("remove")(image, function () {
67
- removeFromList(mountedPictures, image);
68
- });
69
58
  image.init = loadParams;
70
59
  image.locked = false;
71
60
 
@@ -321,8 +310,9 @@ function picture_(image = document.createElement("div")) {
321
310
  } else {
322
311
  shape();
323
312
  }
324
-
325
313
  };
314
+ bind('resize')(image, image.update);
315
+
326
316
  image.rotateTo = function (deg) {
327
317
  rotated = deg;
328
318
  this.update();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.14.11",
3
+ "version": "3.15.1",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {