@fecp/mobile 1.0.9 → 1.0.10

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.
@@ -0,0 +1,125 @@
1
+ (function() {
2
+ if (typeof window === "undefined") {
3
+ return;
4
+ }
5
+ var eventTarget;
6
+ var supportTouch = "ontouchstart" in window;
7
+ if (!document.createTouch) {
8
+ document.createTouch = function(view, target, identifier, pageX, pageY, screenX, screenY) {
9
+ return new Touch(
10
+ target,
11
+ identifier,
12
+ {
13
+ pageX,
14
+ pageY,
15
+ screenX,
16
+ screenY,
17
+ clientX: pageX - window.pageXOffset,
18
+ clientY: pageY - window.pageYOffset
19
+ },
20
+ 0,
21
+ 0
22
+ );
23
+ };
24
+ }
25
+ if (!document.createTouchList) {
26
+ document.createTouchList = function() {
27
+ var touchList = TouchList();
28
+ for (var i = 0; i < arguments.length; i++) {
29
+ touchList[i] = arguments[i];
30
+ }
31
+ touchList.length = arguments.length;
32
+ return touchList;
33
+ };
34
+ }
35
+ if (!Element.prototype.matches) {
36
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
37
+ }
38
+ if (!Element.prototype.closest) {
39
+ Element.prototype.closest = function(s) {
40
+ var el = this;
41
+ do {
42
+ if (el.matches(s)) return el;
43
+ el = el.parentElement || el.parentNode;
44
+ } while (el !== null && el.nodeType === 1);
45
+ return null;
46
+ };
47
+ }
48
+ var Touch = function Touch2(target, identifier, pos, deltaX, deltaY) {
49
+ deltaX = deltaX || 0;
50
+ deltaY = deltaY || 0;
51
+ this.identifier = identifier;
52
+ this.target = target;
53
+ this.clientX = pos.clientX + deltaX;
54
+ this.clientY = pos.clientY + deltaY;
55
+ this.screenX = pos.screenX + deltaX;
56
+ this.screenY = pos.screenY + deltaY;
57
+ this.pageX = pos.pageX + deltaX;
58
+ this.pageY = pos.pageY + deltaY;
59
+ };
60
+ function TouchList() {
61
+ var touchList = [];
62
+ touchList["item"] = function(index) {
63
+ return this[index] || null;
64
+ };
65
+ touchList["identifiedTouch"] = function(id) {
66
+ return this[id + 1] || null;
67
+ };
68
+ return touchList;
69
+ }
70
+ var initiated = false;
71
+ function onMouse(touchType) {
72
+ return function(ev) {
73
+ if (ev.type === "mousedown") {
74
+ initiated = true;
75
+ }
76
+ if (ev.type === "mouseup") {
77
+ initiated = false;
78
+ }
79
+ if (ev.type === "mousemove" && !initiated) {
80
+ return;
81
+ }
82
+ if (ev.type === "mousedown" || !eventTarget || eventTarget && !eventTarget.dispatchEvent) {
83
+ eventTarget = ev.target;
84
+ }
85
+ if (eventTarget.closest("[data-no-touch-simulate]") == null) {
86
+ triggerTouch(touchType, ev);
87
+ }
88
+ if (ev.type === "mouseup") {
89
+ eventTarget = null;
90
+ }
91
+ };
92
+ }
93
+ function triggerTouch(eventName, mouseEv) {
94
+ var touchEvent = document.createEvent("Event");
95
+ touchEvent.initEvent(eventName, true, true);
96
+ touchEvent.altKey = mouseEv.altKey;
97
+ touchEvent.ctrlKey = mouseEv.ctrlKey;
98
+ touchEvent.metaKey = mouseEv.metaKey;
99
+ touchEvent.shiftKey = mouseEv.shiftKey;
100
+ touchEvent.touches = getActiveTouches(mouseEv);
101
+ touchEvent.targetTouches = getActiveTouches(mouseEv);
102
+ touchEvent.changedTouches = createTouchList(mouseEv);
103
+ eventTarget.dispatchEvent(touchEvent);
104
+ }
105
+ function createTouchList(mouseEv) {
106
+ var touchList = TouchList();
107
+ touchList.push(new Touch(eventTarget, 1, mouseEv, 0, 0));
108
+ return touchList;
109
+ }
110
+ function getActiveTouches(mouseEv) {
111
+ if (mouseEv.type === "mouseup") {
112
+ return TouchList();
113
+ }
114
+ return createTouchList(mouseEv);
115
+ }
116
+ function TouchEmulator() {
117
+ window.addEventListener("mousedown", onMouse("touchstart"), true);
118
+ window.addEventListener("mousemove", onMouse("touchmove"), true);
119
+ window.addEventListener("mouseup", onMouse("touchend"), true);
120
+ }
121
+ TouchEmulator["multiTouchOffset"] = 75;
122
+ if (!supportTouch) {
123
+ new TouchEmulator();
124
+ }
125
+ })();
@@ -1,4 +1,5 @@
1
1
  import * as all from "./src/components/all.mjs";
2
+ import "../../node_modules/.pnpm/@vant_touch-emulator@1.4.0/node_modules/@vant/touch-emulator/dist/index.mjs";
2
3
  import { MobileButton } from "./src/components/base/button/index.mjs";
3
4
  import { MobileCell } from "./src/components/base/cell/index.mjs";
4
5
  import { MobileCellGroup } from "./src/components/base/cellGroup/index.mjs";
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ (function() {
3
+ if (typeof window === "undefined") {
4
+ return;
5
+ }
6
+ var eventTarget;
7
+ var supportTouch = "ontouchstart" in window;
8
+ if (!document.createTouch) {
9
+ document.createTouch = function(view, target, identifier, pageX, pageY, screenX, screenY) {
10
+ return new Touch(
11
+ target,
12
+ identifier,
13
+ {
14
+ pageX,
15
+ pageY,
16
+ screenX,
17
+ screenY,
18
+ clientX: pageX - window.pageXOffset,
19
+ clientY: pageY - window.pageYOffset
20
+ },
21
+ 0,
22
+ 0
23
+ );
24
+ };
25
+ }
26
+ if (!document.createTouchList) {
27
+ document.createTouchList = function() {
28
+ var touchList = TouchList();
29
+ for (var i = 0; i < arguments.length; i++) {
30
+ touchList[i] = arguments[i];
31
+ }
32
+ touchList.length = arguments.length;
33
+ return touchList;
34
+ };
35
+ }
36
+ if (!Element.prototype.matches) {
37
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
38
+ }
39
+ if (!Element.prototype.closest) {
40
+ Element.prototype.closest = function(s) {
41
+ var el = this;
42
+ do {
43
+ if (el.matches(s)) return el;
44
+ el = el.parentElement || el.parentNode;
45
+ } while (el !== null && el.nodeType === 1);
46
+ return null;
47
+ };
48
+ }
49
+ var Touch = function Touch2(target, identifier, pos, deltaX, deltaY) {
50
+ deltaX = deltaX || 0;
51
+ deltaY = deltaY || 0;
52
+ this.identifier = identifier;
53
+ this.target = target;
54
+ this.clientX = pos.clientX + deltaX;
55
+ this.clientY = pos.clientY + deltaY;
56
+ this.screenX = pos.screenX + deltaX;
57
+ this.screenY = pos.screenY + deltaY;
58
+ this.pageX = pos.pageX + deltaX;
59
+ this.pageY = pos.pageY + deltaY;
60
+ };
61
+ function TouchList() {
62
+ var touchList = [];
63
+ touchList["item"] = function(index) {
64
+ return this[index] || null;
65
+ };
66
+ touchList["identifiedTouch"] = function(id) {
67
+ return this[id + 1] || null;
68
+ };
69
+ return touchList;
70
+ }
71
+ var initiated = false;
72
+ function onMouse(touchType) {
73
+ return function(ev) {
74
+ if (ev.type === "mousedown") {
75
+ initiated = true;
76
+ }
77
+ if (ev.type === "mouseup") {
78
+ initiated = false;
79
+ }
80
+ if (ev.type === "mousemove" && !initiated) {
81
+ return;
82
+ }
83
+ if (ev.type === "mousedown" || !eventTarget || eventTarget && !eventTarget.dispatchEvent) {
84
+ eventTarget = ev.target;
85
+ }
86
+ if (eventTarget.closest("[data-no-touch-simulate]") == null) {
87
+ triggerTouch(touchType, ev);
88
+ }
89
+ if (ev.type === "mouseup") {
90
+ eventTarget = null;
91
+ }
92
+ };
93
+ }
94
+ function triggerTouch(eventName, mouseEv) {
95
+ var touchEvent = document.createEvent("Event");
96
+ touchEvent.initEvent(eventName, true, true);
97
+ touchEvent.altKey = mouseEv.altKey;
98
+ touchEvent.ctrlKey = mouseEv.ctrlKey;
99
+ touchEvent.metaKey = mouseEv.metaKey;
100
+ touchEvent.shiftKey = mouseEv.shiftKey;
101
+ touchEvent.touches = getActiveTouches(mouseEv);
102
+ touchEvent.targetTouches = getActiveTouches(mouseEv);
103
+ touchEvent.changedTouches = createTouchList(mouseEv);
104
+ eventTarget.dispatchEvent(touchEvent);
105
+ }
106
+ function createTouchList(mouseEv) {
107
+ var touchList = TouchList();
108
+ touchList.push(new Touch(eventTarget, 1, mouseEv, 0, 0));
109
+ return touchList;
110
+ }
111
+ function getActiveTouches(mouseEv) {
112
+ if (mouseEv.type === "mouseup") {
113
+ return TouchList();
114
+ }
115
+ return createTouchList(mouseEv);
116
+ }
117
+ function TouchEmulator() {
118
+ window.addEventListener("mousedown", onMouse("touchstart"), true);
119
+ window.addEventListener("mousemove", onMouse("touchmove"), true);
120
+ window.addEventListener("mouseup", onMouse("touchend"), true);
121
+ }
122
+ TouchEmulator["multiTouchOffset"] = 75;
123
+ if (!supportTouch) {
124
+ new TouchEmulator();
125
+ }
126
+ })();
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const all = require("./src/components/all.js");
4
+ require("../../node_modules/.pnpm/@vant_touch-emulator@1.4.0/node_modules/@vant/touch-emulator/dist/index.js");
4
5
  const index$1 = require("./src/components/base/button/index.js");
5
6
  const index$2 = require("./src/components/base/cell/index.js");
6
7
  const index$3 = require("./src/components/base/cellGroup/index.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fecp/mobile",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "main": "lib/packages/mobile/index.js",
5
5
  "module": "es/packages/mobile/index.mjs",
6
6
  "files": [