@mantou/gem 1.7.0 → 1.7.2
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/dist/gem.es.js +402 -543
- package/dist/gem.umd.js +27 -33
- package/elements/base/dialog.d.ts +9 -7
- package/elements/base/dialog.d.ts.map +1 -1
- package/elements/base/dialog.js +12 -3
- package/elements/base/dialog.js.map +1 -1
- package/elements/base/gesture.d.ts +4 -13
- package/elements/base/gesture.d.ts.map +1 -1
- package/elements/base/gesture.js +152 -135
- package/elements/base/gesture.js.map +1 -1
- package/elements/base/link.d.ts +12 -9
- package/elements/base/link.d.ts.map +1 -1
- package/elements/base/link.js +81 -62
- package/elements/base/link.js.map +1 -1
- package/elements/base/modal-factory.d.ts +104 -80
- package/elements/base/modal-factory.d.ts.map +1 -1
- package/elements/base/modal-factory.js +12 -8
- package/elements/base/modal-factory.js.map +1 -1
- package/elements/base/reflect.js.map +1 -1
- package/elements/base/route.d.ts +12 -5
- package/elements/base/route.d.ts.map +1 -1
- package/elements/base/route.js +17 -5
- package/elements/base/route.js.map +1 -1
- package/elements/base/title.d.ts +3 -1
- package/elements/base/title.d.ts.map +1 -1
- package/elements/base/title.js +14 -16
- package/elements/base/title.js.map +1 -1
- package/elements/base/unsafe.js +1 -1
- package/elements/base/unsafe.js.map +1 -1
- package/elements/base/use.d.ts +1 -1
- package/elements/base/use.d.ts.map +1 -1
- package/elements/base/use.js +28 -20
- package/elements/base/use.js.map +1 -1
- package/helper/i18n.d.ts +4 -4
- package/helper/i18n.d.ts.map +1 -1
- package/helper/i18n.js.map +1 -1
- package/helper/mediaquery.d.ts +16 -18
- package/helper/mediaquery.d.ts.map +1 -1
- package/helper/mediaquery.js +42 -41
- package/helper/mediaquery.js.map +1 -1
- package/helper/request.d.ts +1 -1
- package/helper/request.d.ts.map +1 -1
- package/helper/request.js.map +1 -1
- package/helper/ssr-shim.d.ts +2 -0
- package/helper/ssr-shim.d.ts.map +1 -0
- package/helper/ssr-shim.js +29 -0
- package/helper/ssr-shim.js.map +1 -0
- package/helper/theme.d.ts +2 -2
- package/helper/theme.d.ts.map +1 -1
- package/helper/theme.js +20 -24
- package/helper/theme.js.map +1 -1
- package/index.d.ts +0 -10
- package/index.d.ts.map +1 -1
- package/index.js +0 -7
- package/index.js.map +1 -1
- package/lib/decorators.d.ts +4 -4
- package/lib/decorators.d.ts.map +1 -1
- package/lib/decorators.js +1 -2
- package/lib/decorators.js.map +1 -1
- package/lib/element.d.ts +16 -10
- package/lib/element.d.ts.map +1 -1
- package/lib/element.js +57 -79
- package/lib/element.js.map +1 -1
- package/lib/history.d.ts +1 -1
- package/lib/history.d.ts.map +1 -1
- package/lib/history.js +2 -2
- package/lib/history.js.map +1 -1
- package/lib/store.d.ts +2 -2
- package/lib/store.d.ts.map +1 -1
- package/lib/store.js.map +1 -1
- package/lib/utils.d.ts +8 -32
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +6 -21
- package/lib/utils.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/elements/base/dialog.ts +10 -3
- package/src/elements/base/gesture.ts +52 -46
- package/src/elements/base/link.ts +69 -61
- package/src/elements/base/modal-factory.ts +5 -0
- package/src/elements/base/route.ts +22 -5
- package/src/elements/base/title.ts +8 -11
- package/src/elements/base/unsafe.ts +1 -1
- package/src/elements/base/use.ts +4 -6
- package/src/helper/i18n.ts +3 -3
- package/src/helper/mediaquery.ts +43 -42
- package/src/helper/ssr-shim.ts +29 -0
- package/src/helper/theme.ts +22 -24
- package/src/index.ts +0 -16
- package/src/lib/decorators.ts +1 -2
- package/src/lib/element.ts +56 -71
- package/src/lib/history.ts +2 -1
- package/src/lib/utils.ts +10 -42
- package/src/lib/version.ts +1 -1
- package/src/test/gem-element/decorators.test.ts +6 -6
- package/src/test/history.test.ts +3 -1
- package/src/test/utils.test.ts +8 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GemElement } from '../../lib/element';
|
|
2
2
|
import { Emitter } from '../../lib/decorators';
|
|
3
|
-
export
|
|
3
|
+
export type PanEventDetail = {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
6
6
|
clientX: number;
|
|
@@ -41,6 +41,7 @@ export interface RotateEventDetail {
|
|
|
41
41
|
* @attr touch-action
|
|
42
42
|
*/
|
|
43
43
|
export declare class GemGestureElement extends GemElement {
|
|
44
|
+
#private;
|
|
44
45
|
pan: Emitter<PanEventDetail>;
|
|
45
46
|
pinch: Emitter<PinchEventDetail>;
|
|
46
47
|
rotate: Emitter<RotateEventDetail>;
|
|
@@ -48,19 +49,9 @@ export declare class GemGestureElement extends GemElement {
|
|
|
48
49
|
press: Emitter<null>;
|
|
49
50
|
end: Emitter<null>;
|
|
50
51
|
touchAction: string;
|
|
51
|
-
pressed: boolean;
|
|
52
|
-
pressTimer: number;
|
|
53
|
-
startEventMap: Map<number, PointerEvent>;
|
|
54
|
-
movesMap: Map<number, PanEventDetail[]>;
|
|
55
52
|
constructor();
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
getOtherLastmove(pointerId: number): PanEventDetail | undefined;
|
|
59
|
-
getMovementX(x: number, y: number): number;
|
|
60
|
-
getMovementY(x: number, y: number): number;
|
|
61
|
-
onStart(evt: PointerEvent): void;
|
|
62
|
-
onMove(evt: PointerEvent): void;
|
|
63
|
-
onEnd(evt: PointerEvent): void;
|
|
53
|
+
/** 指针移动事件记录 */
|
|
54
|
+
movesMap: Map<number, PanEventDetail[]>;
|
|
64
55
|
render(): import("lit-html/lib/template-result").TemplateResult;
|
|
65
56
|
}
|
|
66
57
|
//# sourceMappingURL=gesture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gesture.d.ts","sourceRoot":"","sources":["../../src/elements/base/gesture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAsB,OAAO,EAAE,M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;;IAgB/B,eAAe;IACf,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAa;IAkKpD,MAAM;CAYP"}
|
package/elements/base/gesture.js
CHANGED
|
@@ -4,6 +4,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
15
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
16
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
|
+
};
|
|
18
|
+
var _GemGestureElement_pressed, _GemGestureElement_pressTimer, _GemGestureElement_startEventMap, _GemGestureElement_getMoves, _GemGestureElement_getStartEvent, _GemGestureElement_getOtherLastMove, _GemGestureElement_getMovementX, _GemGestureElement_getMovementY, _GemGestureElement_onStart, _GemGestureElement_onMove, _GemGestureElement_onMoveSet, _GemGestureElement_onEnd;
|
|
7
19
|
import { GemElement, html } from '../../lib/element';
|
|
8
20
|
import { attribute, emitter } from '../../lib/decorators';
|
|
9
21
|
function angleAB(a, b, c, { clientX: x1, clientY: y1 }, { clientX: x2, clientY: y2 }, { clientX: x3, clientY: y3 }) {
|
|
@@ -31,156 +43,160 @@ function angleAB(a, b, c, { clientX: x1, clientY: y1 }, { clientX: x2, clientY:
|
|
|
31
43
|
export class GemGestureElement extends GemElement {
|
|
32
44
|
constructor() {
|
|
33
45
|
super();
|
|
34
|
-
this
|
|
35
|
-
this
|
|
36
|
-
this
|
|
46
|
+
_GemGestureElement_pressed.set(this, false); // 触发 press 之后不触发其他事件
|
|
47
|
+
_GemGestureElement_pressTimer.set(this, 0);
|
|
48
|
+
_GemGestureElement_startEventMap.set(this, new Map());
|
|
49
|
+
/** 指针移动事件记录 */
|
|
37
50
|
this.movesMap = new Map();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
getOtherLastmove(pointerId) {
|
|
51
|
-
for (const id of this.movesMap.keys()) {
|
|
52
|
-
if (id !== pointerId) {
|
|
53
|
-
const moves = this.getMoves(id);
|
|
54
|
-
return moves[moves.length - 1] || this.getStartEvent(id);
|
|
51
|
+
_GemGestureElement_getMoves.set(this, (pointerId) => {
|
|
52
|
+
return this.movesMap.get(pointerId) || [];
|
|
53
|
+
});
|
|
54
|
+
_GemGestureElement_getStartEvent.set(this, (pointerId) => {
|
|
55
|
+
return __classPrivateFieldGet(this, _GemGestureElement_startEventMap, "f").get(pointerId);
|
|
56
|
+
});
|
|
57
|
+
_GemGestureElement_getOtherLastMove.set(this, (pointerId) => {
|
|
58
|
+
for (const id of this.movesMap.keys()) {
|
|
59
|
+
if (id !== pointerId) {
|
|
60
|
+
const moves = __classPrivateFieldGet(this, _GemGestureElement_getMoves, "f").call(this, id);
|
|
61
|
+
return moves[moves.length - 1] || __classPrivateFieldGet(this, _GemGestureElement_getStartEvent, "f").call(this, id);
|
|
62
|
+
}
|
|
55
63
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if ((touchAction.includes('pan-right') && x > 0) ||
|
|
61
|
-
(touchAction.includes('pan-left') && x < 0) ||
|
|
62
|
-
touchAction.includes('pan-x') ||
|
|
63
|
-
(((touchAction.includes('pan-down') && y > 0) ||
|
|
64
|
-
(touchAction.includes('pan-up') && y < 0) ||
|
|
65
|
-
touchAction.includes('pan-y')) &&
|
|
66
|
-
Math.abs(y) > Math.abs(x)) // horizontally scrolling
|
|
67
|
-
) {
|
|
68
|
-
return 0;
|
|
69
|
-
}
|
|
70
|
-
return x;
|
|
71
|
-
}
|
|
72
|
-
getMovementY(x, y) {
|
|
73
|
-
const touchAction = this.touchAction;
|
|
74
|
-
if ((touchAction.includes('pan-down') && y > 0) ||
|
|
75
|
-
(touchAction.includes('pan-up') && y < 0) ||
|
|
76
|
-
touchAction.includes('pan-y') ||
|
|
77
|
-
(((touchAction.includes('pan-right') && x > 0) ||
|
|
64
|
+
});
|
|
65
|
+
_GemGestureElement_getMovementX.set(this, (x, y) => {
|
|
66
|
+
const touchAction = this.touchAction;
|
|
67
|
+
if ((touchAction.includes('pan-right') && x > 0) ||
|
|
78
68
|
(touchAction.includes('pan-left') && x < 0) ||
|
|
79
|
-
touchAction.includes('pan-x')
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
onStart(evt) {
|
|
87
|
-
evt.stopPropagation();
|
|
88
|
-
this.setPointerCapture(evt.pointerId);
|
|
89
|
-
this.movesMap.set(evt.pointerId, []);
|
|
90
|
-
this.startEventMap.set(evt.pointerId, evt);
|
|
91
|
-
if (evt.isPrimary) {
|
|
92
|
-
this.pressed = false;
|
|
93
|
-
this.pressTimer = window.setTimeout(() => {
|
|
94
|
-
this.press(null);
|
|
95
|
-
this.pressed = true;
|
|
96
|
-
}, 251);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
onMove(evt) {
|
|
100
|
-
evt.stopPropagation();
|
|
101
|
-
const { pointerId, clientX, clientY, isPrimary, pointerType, timeStamp } = evt;
|
|
102
|
-
if (!this.pressed && this.hasPointerCapture(pointerId)) {
|
|
103
|
-
const moves = this.getMoves(pointerId);
|
|
104
|
-
const startEvent = this.getStartEvent(pointerId);
|
|
105
|
-
const lastMove = moves[moves.length - 1] || startEvent;
|
|
106
|
-
// https://bugs.webkit.org/show_bug.cgi?id=220194
|
|
107
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=1092358
|
|
108
|
-
const movementX = clientX - lastMove.clientX;
|
|
109
|
-
const movementY = clientY - lastMove.clientY;
|
|
110
|
-
const move = {
|
|
111
|
-
x: this.getMovementX(movementX, movementY),
|
|
112
|
-
y: this.getMovementY(movementX, movementY),
|
|
113
|
-
clientX,
|
|
114
|
-
clientY,
|
|
115
|
-
timeStamp,
|
|
116
|
-
isPrimary,
|
|
117
|
-
pointerId,
|
|
118
|
-
};
|
|
119
|
-
moves.push(move);
|
|
120
|
-
this.pan(move);
|
|
121
|
-
if (this.movesMap.size !== 1) {
|
|
122
|
-
const secondaryPoint = this.getOtherLastmove(pointerId);
|
|
123
|
-
const moveLen = Math.sqrt(movementX ** 2 + movementY ** 2);
|
|
124
|
-
const distanceLen = Math.sqrt((lastMove.clientX - secondaryPoint.clientX) ** 2 + (lastMove.clientY - secondaryPoint.clientY) ** 2);
|
|
125
|
-
const newDistanceLen = Math.sqrt((clientX - secondaryPoint.clientX) ** 2 + (clientY - secondaryPoint.clientY) ** 2);
|
|
126
|
-
const x = (lastMove.clientX + secondaryPoint.clientX) / 2;
|
|
127
|
-
const y = (lastMove.clientY + secondaryPoint.clientY) / 2;
|
|
128
|
-
this.pinch({ x, y, scale: newDistanceLen / distanceLen });
|
|
129
|
-
this.rotate({ x, y, rotate: angleAB(newDistanceLen, distanceLen, moveLen, secondaryPoint, lastMove, move) });
|
|
69
|
+
touchAction.includes('pan-x') ||
|
|
70
|
+
(((touchAction.includes('pan-down') && y > 0) ||
|
|
71
|
+
(touchAction.includes('pan-up') && y < 0) ||
|
|
72
|
+
touchAction.includes('pan-y')) &&
|
|
73
|
+
Math.abs(y) > Math.abs(x)) // horizontally scrolling
|
|
74
|
+
) {
|
|
75
|
+
return 0;
|
|
130
76
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
77
|
+
return x;
|
|
78
|
+
});
|
|
79
|
+
_GemGestureElement_getMovementY.set(this, (x, y) => {
|
|
80
|
+
const touchAction = this.touchAction;
|
|
81
|
+
if ((touchAction.includes('pan-down') && y > 0) ||
|
|
82
|
+
(touchAction.includes('pan-up') && y < 0) ||
|
|
83
|
+
touchAction.includes('pan-y') ||
|
|
84
|
+
(((touchAction.includes('pan-right') && x > 0) ||
|
|
85
|
+
(touchAction.includes('pan-left') && x < 0) ||
|
|
86
|
+
touchAction.includes('pan-x')) &&
|
|
87
|
+
Math.abs(x) > Math.abs(y)) // vertical scrolling
|
|
88
|
+
) {
|
|
89
|
+
return 0;
|
|
137
90
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
91
|
+
return y;
|
|
92
|
+
});
|
|
93
|
+
_GemGestureElement_onStart.set(this, (evt) => {
|
|
94
|
+
evt.stopPropagation();
|
|
95
|
+
this.setPointerCapture(evt.pointerId);
|
|
96
|
+
this.movesMap.set(evt.pointerId, []);
|
|
97
|
+
__classPrivateFieldGet(this, _GemGestureElement_startEventMap, "f").set(evt.pointerId, evt);
|
|
98
|
+
if (evt.isPrimary) {
|
|
99
|
+
__classPrivateFieldSet(this, _GemGestureElement_pressed, false, "f");
|
|
100
|
+
__classPrivateFieldSet(this, _GemGestureElement_pressTimer, window.setTimeout(() => {
|
|
101
|
+
this.press(null);
|
|
102
|
+
__classPrivateFieldSet(this, _GemGestureElement_pressed, true, "f");
|
|
103
|
+
}, 251), "f");
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
_GemGestureElement_onMove.set(this, (evt) => {
|
|
107
|
+
const { pointerId, clientX, clientY, isPrimary, pointerType, timeStamp } = evt;
|
|
108
|
+
if (!__classPrivateFieldGet(this, _GemGestureElement_pressed, "f") && this.hasPointerCapture(pointerId)) {
|
|
109
|
+
const moves = __classPrivateFieldGet(this, _GemGestureElement_getMoves, "f").call(this, pointerId);
|
|
110
|
+
const startEvent = __classPrivateFieldGet(this, _GemGestureElement_getStartEvent, "f").call(this, pointerId);
|
|
111
|
+
const lastMove = moves[moves.length - 1] || startEvent;
|
|
112
|
+
// https://bugs.webkit.org/show_bug.cgi?id=220194
|
|
113
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1092358
|
|
114
|
+
const movementX = clientX - lastMove.clientX;
|
|
115
|
+
const movementY = clientY - lastMove.clientY;
|
|
116
|
+
const move = {
|
|
117
|
+
x: __classPrivateFieldGet(this, _GemGestureElement_getMovementX, "f").call(this, movementX, movementY),
|
|
118
|
+
y: __classPrivateFieldGet(this, _GemGestureElement_getMovementY, "f").call(this, movementX, movementY),
|
|
119
|
+
clientX,
|
|
120
|
+
clientY,
|
|
121
|
+
timeStamp,
|
|
122
|
+
isPrimary,
|
|
123
|
+
pointerId,
|
|
124
|
+
};
|
|
125
|
+
moves.push(move);
|
|
126
|
+
this.pan(move);
|
|
127
|
+
if (this.movesMap.size !== 1) {
|
|
128
|
+
const secondaryPoint = __classPrivateFieldGet(this, _GemGestureElement_getOtherLastMove, "f").call(this, pointerId);
|
|
129
|
+
const moveLen = Math.sqrt(movementX ** 2 + movementY ** 2);
|
|
130
|
+
const distanceLen = Math.sqrt((lastMove.clientX - secondaryPoint.clientX) ** 2 + (lastMove.clientY - secondaryPoint.clientY) ** 2);
|
|
131
|
+
const newDistanceLen = Math.sqrt((clientX - secondaryPoint.clientX) ** 2 + (clientY - secondaryPoint.clientY) ** 2);
|
|
132
|
+
const x = (lastMove.clientX + secondaryPoint.clientX) / 2;
|
|
133
|
+
const y = (lastMove.clientY + secondaryPoint.clientY) / 2;
|
|
134
|
+
this.pinch({ x, y, scale: newDistanceLen / distanceLen });
|
|
135
|
+
this.rotate({ x, y, rotate: angleAB(newDistanceLen, distanceLen, moveLen, secondaryPoint, lastMove, move) });
|
|
136
|
+
}
|
|
137
|
+
const accuracy = pointerType === 'touch' ? 5 : 0;
|
|
138
|
+
if (Math.abs(movementX) > accuracy ||
|
|
139
|
+
Math.abs(movementY) > accuracy ||
|
|
140
|
+
Math.abs(move.clientX - startEvent.clientX) > accuracy ||
|
|
141
|
+
Math.abs(move.clientY - startEvent.clientY) > accuracy) {
|
|
142
|
+
window.clearTimeout(__classPrivateFieldGet(this, _GemGestureElement_pressTimer, "f"));
|
|
163
143
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
_GemGestureElement_onMoveSet.set(this, (evt) => {
|
|
147
|
+
evt.stopPropagation();
|
|
148
|
+
evt.getCoalescedEvents().forEach((evt) => __classPrivateFieldGet(this, _GemGestureElement_onMove, "f").call(this, evt));
|
|
149
|
+
});
|
|
150
|
+
_GemGestureElement_onEnd.set(this, (evt) => {
|
|
151
|
+
evt.stopPropagation();
|
|
152
|
+
const { pointerId } = evt;
|
|
153
|
+
window.clearTimeout(__classPrivateFieldGet(this, _GemGestureElement_pressTimer, "f"));
|
|
154
|
+
if (this.movesMap.size === 1) {
|
|
155
|
+
this.end(null);
|
|
156
|
+
}
|
|
157
|
+
// auto release: https://javascript.info/pointer-events#pointer-capturing
|
|
158
|
+
if (!__classPrivateFieldGet(this, _GemGestureElement_pressed, "f") && this.hasPointerCapture(pointerId)) {
|
|
159
|
+
const moves = __classPrivateFieldGet(this, _GemGestureElement_getMoves, "f").call(this, pointerId);
|
|
160
|
+
if (moves.length > 2) {
|
|
161
|
+
const { x, y, timeStamp, clientX, clientY } = moves[moves.length - 1];
|
|
162
|
+
const move2 = moves[moves.length - 3];
|
|
163
|
+
if (Math.abs(x) > 2) {
|
|
164
|
+
if (Math.abs(x) > Math.abs(y)) {
|
|
165
|
+
const speed = Math.abs(move2.clientX - clientX) / (timeStamp - move2.timeStamp);
|
|
166
|
+
if (x > 0) {
|
|
167
|
+
this.swipe({ direction: 'right', speed });
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
this.swipe({ direction: 'left', speed });
|
|
171
|
+
}
|
|
169
172
|
}
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
}
|
|
174
|
+
if (Math.abs(y) > 2) {
|
|
175
|
+
const speed = Math.abs(move2.clientY - clientY) / (timeStamp - move2.timeStamp);
|
|
176
|
+
if (Math.abs(y) > Math.abs(x)) {
|
|
177
|
+
if (y > 0) {
|
|
178
|
+
this.swipe({ direction: 'bottom', speed });
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
this.swipe({ direction: 'top', speed });
|
|
182
|
+
}
|
|
172
183
|
}
|
|
173
184
|
}
|
|
174
185
|
}
|
|
175
186
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
187
|
+
this.movesMap.delete(pointerId);
|
|
188
|
+
__classPrivateFieldGet(this, _GemGestureElement_startEventMap, "f").delete(pointerId);
|
|
189
|
+
});
|
|
190
|
+
this.addEventListener('pointerdown', __classPrivateFieldGet(this, _GemGestureElement_onStart, "f"));
|
|
191
|
+
this.addEventListener('pointermove', __classPrivateFieldGet(this, _GemGestureElement_onMoveSet, "f"));
|
|
192
|
+
this.addEventListener('pointerup', __classPrivateFieldGet(this, _GemGestureElement_onEnd, "f"));
|
|
193
|
+
this.addEventListener('pointercancel', __classPrivateFieldGet(this, _GemGestureElement_onEnd, "f"));
|
|
194
|
+
this.addEventListener('dragstart', (evt) => evt.preventDefault());
|
|
179
195
|
}
|
|
180
196
|
render() {
|
|
181
197
|
return html `
|
|
182
198
|
<style>
|
|
183
|
-
:host {
|
|
199
|
+
:host(:where(:not([hidden]))) {
|
|
184
200
|
display: block;
|
|
185
201
|
user-select: none;
|
|
186
202
|
touch-action: ${this.touchAction || 'none'};
|
|
@@ -190,6 +206,7 @@ export class GemGestureElement extends GemElement {
|
|
|
190
206
|
`;
|
|
191
207
|
}
|
|
192
208
|
}
|
|
209
|
+
_GemGestureElement_pressed = new WeakMap(), _GemGestureElement_pressTimer = new WeakMap(), _GemGestureElement_startEventMap = new WeakMap(), _GemGestureElement_getMoves = new WeakMap(), _GemGestureElement_getStartEvent = new WeakMap(), _GemGestureElement_getOtherLastMove = new WeakMap(), _GemGestureElement_getMovementX = new WeakMap(), _GemGestureElement_getMovementY = new WeakMap(), _GemGestureElement_onStart = new WeakMap(), _GemGestureElement_onMove = new WeakMap(), _GemGestureElement_onMoveSet = new WeakMap(), _GemGestureElement_onEnd = new WeakMap();
|
|
193
210
|
__decorate([
|
|
194
211
|
emitter
|
|
195
212
|
], GemGestureElement.prototype, "pan", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gesture.js","sourceRoot":"","sources":["../../src/elements/base/gesture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gesture.js","sourceRoot":"","sources":["../../src/elements/base/gesture.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAW,MAAM,sBAAsB,CAAC;AA6BnE,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CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAChC,uBAAA,IAAI,wCAAe,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC,EAAC;QA7KA,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,uBAAA,IAAI,kCAAS,CAAC,CAAC;QACpD,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,uBAAA,IAAI,oCAAW,CAAC,CAAC;QACtD,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,uBAAA,IAAI,gCAAO,CAAC,CAAC;QAChD,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,uBAAA,IAAI,gCAAO,CAAC,CAAC;QACpD,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;IACpE,CAAC;IA0KD,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;0BAKW,IAAI,CAAC,WAAW,IAAI,MAAM;;;;KAI/C,CAAC;IACJ,CAAC;CACF;;AAtMU;IAAR,OAAO;8CAA8B;AAC7B;IAAR,OAAO;gDAAkC;AACjC;IAAR,OAAO;iDAAoC;AACnC;IAAR,OAAO;gDAAkC;AACjC;IAAR,OAAO;gDAAsB;AACrB;IAAR,OAAO;8CAAoB;AAEjB;IAAV,SAAS;sDAAqB"}
|
package/elements/base/link.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { RouteItem, RouteOptions } from './route';
|
|
|
14
14
|
* print bug: https://github.com/mantou132/gem/issues/36
|
|
15
15
|
*/
|
|
16
16
|
export declare class GemLinkElement extends GemElement {
|
|
17
|
+
#private;
|
|
17
18
|
href: string;
|
|
18
19
|
target: string;
|
|
19
20
|
path: string;
|
|
@@ -21,16 +22,18 @@ export declare class GemLinkElement extends GemElement {
|
|
|
21
22
|
hash: string;
|
|
22
23
|
docTitle: string;
|
|
23
24
|
hint: 'on' | 'off';
|
|
24
|
-
route
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
route?: RouteItem;
|
|
26
|
+
/**@deprecated */
|
|
27
|
+
options?: RouteOptions;
|
|
28
|
+
routeOptions?: RouteOptions;
|
|
29
|
+
prepare?: () => void | Promise<void>;
|
|
27
30
|
link: string;
|
|
28
31
|
constructor();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
render(): import("lit-html/lib/template-result").TemplateResult;
|
|
33
|
+
/**
|
|
34
|
+
* 如果该元素是外部链接返回 URL,否则返回路径(不包含 basePath)
|
|
35
|
+
*/
|
|
36
|
+
getLocationString(): string;
|
|
34
37
|
}
|
|
35
38
|
/**
|
|
36
39
|
* @attr pattern
|
|
@@ -39,6 +42,6 @@ export declare class GemLinkElement extends GemElement {
|
|
|
39
42
|
export declare class GemActiveLinkElement extends GemLinkElement {
|
|
40
43
|
pattern: string;
|
|
41
44
|
active: boolean;
|
|
42
|
-
|
|
45
|
+
constructor();
|
|
43
46
|
}
|
|
44
47
|
//# sourceMappingURL=link.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/elements/base/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,mBAAmB,CAAC;AAKhE,OAAO,EAAa,SAAS,EAAE,YAAY,EAAmC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/elements/base/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,mBAAmB,CAAC;AAKhE,OAAO,EAAa,SAAS,EAAE,YAAY,EAAmC,MAAM,SAAS,CAAC;AAM9F;;;;;;;;;;;;GAYG;AACH,qBACa,cAAe,SAAQ,UAAU;;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC;IAGpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAC5B,iBAAiB;IACP,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC,IAAI,EAAE,MAAM,CAAC;;IA4EnB,MAAM;IA2BN;;OAEG;IACH,iBAAiB;CAmBlB;AAED;;;GAGG;AACH,qBACa,oBAAqB,SAAQ,cAAc;IAC3C,OAAO,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;;CAUxB"}
|