// npm package
@antv/f6-hammerjs
A javascript library for multi-touch gestures
versions
2
maintainers
51
license
MIT
first publish
2022-02-21
publisher
openwayne
tarball
443,837 B
AUTO-PUBLISHED·1 version indexed·latest published 2024-06-23
// publisher campaignby openwayne
9 caught packages from this accountThis is not an isolated catch. The same publisher has shipped 8 other packages that our pipeline flagged — the shape of a coordinated campaign, not a one-off. Each link below opens that sibling's analysis.
// offending code· @0.0.2· no static-pattern hits
llm: benign · 0.85→ No suspicious destination, no remote-exec shape — 1 known-vendor host(s).
- @0.0.2··AUTO-PUBLISHED·publisher: openwayneheuristic 75/100static flags 0llm benign (0.85) via ollamaosv-flagged:MAL-2026-3904
→ No suspicious destination, no remote-exec shape — 1 known-vendor host(s).
// offending code· no static-pattern hits
--- package.json (entry) --- { "name": "@antv/f6-hammerjs", "title": "Hammer.JS for F6", "description": "A javascript library for multi-touch gestures", "version": "0.0.2", "main": "dist/cjs/index.cjs.js", "module": "dist/esm/index.es.js", "unpkg": "dist/umd/index.umd.js", "license": "MIT", "keywords": [ "touch", "gestures" ], "author": { "name": "openwayne", "email": "openwayne@gmail.com" }, "repository": { "type": "git", "url": "https://github.com/antvis/f6" }, "bugs": { "url": "https://github.com/antvis/f6/issues" }, "dependencies": { "lodash": "^4.17.20" }, "scripts": { "clean": "rimraf dist", "build": "vite build" }, "devDependencies": { "vite": "~5.3.1" } } --- index.js (entry) --- import Hammer from "./hammer"; import assign from "./utils/assign"; import { INPUT_START, INPUT_MOVE, INPUT_END, INPUT_CANCEL, } from "./inputjs/input-consts"; import { STATE_POSSIBLE, STATE_BEGAN, STATE_CHANGED, STATE_ENDED, STATE_RECOGNIZED, STATE_CANCELLED, STATE_FAILED, } from "./recognizerjs/recognizer-consts"; import { DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, } from "./inputjs/input-consts"; import Manager from "./manager"; import Input from "./inputjs/input-constructor"; import TouchAction from "./touchactionjs/touchaction-constructor"; import TouchInput from "./input/touch"; import PointerEventInput from "./input/pointerevent"; import Recognizer from "./recognizerjs/recognizer-constructor"; import AttrRecognizer from "./recognizers/attribute"; import TapRecognizer from "./recognizers/tap"; import PanRecognizer from "./recognizers/pan"; import SwipeRecognizer from "./recognizers/swipe"; import PinchRecognizer from "./recognizers/pinch"; import RotateRecognizer from "./recognizers/rotate"; import PressRecognizer from "./recognizers/press"; im --- bundled output (OSV-MAL flagged — LLM scope expansion) --- --- src/utils/add-event-listeners.js (bundled) --- import each from "./each"; import splitStr from "./split-str"; /** * @private * addEventListener with multiple events at once * @param {EventTarget} target * @param {String} types * @param {Function} handler */ export default function addEventListeners(target, types, handler) { each(splitStr(types), (type) => { target.addEventListener(type, handler, false); }); } export function addManagerListeners(manager, types, handler) { each(splitStr(types), (type) => { manager.on(`origin_input:${type}`, handler); }); } --- src/utils/has-parent.js (bundled) --- /** * @private * find if a node is in the given parent * @method hasParent * @param {HTMLElement} node * @param {HTMLElement} parent * @return {Boolean} found */ export default function hasParent(node, parent) { while (node) { if (node === parent) { return true; } node = node.parentNode; } return false; } --- src/utils/if-undefined.js (bundled) --- /** * @private * use the val2 when val1 is undefined * @param {*} val1 * @param {*} val2 * @returns {*} */ export default function ifUndefined(val1, val2) { return val1 === undefined ? val2 : val1; } --- src/utils/remove-event-listeners.js (bundled) --- import each from "./each"; import splitStr from "./split-str"; /** * @private * removeEventListener with multiple events at once * @param {EventTarget} target * @param {String} types * @param {Function} handler */ export default function removeEventListeners(target, types, handler) { each(splitStr(types), (type) => { target.removeEventListener(type, handler, false); }); } export function removeManagerListeners(manager, types, handler) { each(splitStr(types), (type) => { manager.off(`origin_input:${type}`, handler); }); } --- src/utils/set-timeout-context.js (bundled) --- import bindFn from "./bind-fn"; /** * @private * set a timeout with a given scope * @param {Function} fn * @param {Number} timeout * @param {Object} context * @returns {number} */ export default function setTimeoutContext(fn, timeout, context) { return setTimeout(bindFn(fn, context), timeout); } --- src/utils/utils-consts.js (bundled) --- const TYPE_FUNCTION = "function"; const { round, abs } = Math; const { now } = Date; export { TYPE_FUNCTION, round, abs, now }; --- src/touchactionjs/clean-touch-actions.js (bundled) --- import inStr from "../utils/in-str"; import { TOUCH_ACTION_NONE, TOUCH_ACTION_PAN_X, TOUCH_ACTION_PAN_Y, TOUCH_ACTION_MANIPULATION, TOUCH_ACTION_AUTO, } from "./touchaction-Consts"; /** * @private * when the touchActions are collected they are not a valid value, so we need to clean things up. * * @param {String} actions * @returns {*} */ export default function cleanTouchActions(actions) { // none if (inStr(actions, TOUCH_ACTION_NONE)) { return TOUCH_ACTION_NONE; } let hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); let hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers // for different directions, e.g. horizontal pan but vertical swipe?) // we need none (as otherwise with pan-x pan-y combined none of these // recognizers will work, since the browser would handle all panning if (hasPanX && hasPanY) { return TOUCH_ACTION_NONE; } // pan-x OR pan-y if (hasPanX || hasPanY) { return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; } // manipulation if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { return TOUCH_ACTION_MANIPULATION; } return TOUCH_ACTION_AUTO; } --- src/touchactionjs/touchaction-Consts.js (bundled) --- import getTouchActionProps from "./get-touchaction-props"; // magical touchAction value const TOUCH_ACTION_COMPUTE = "compute"; const TOUCH_ACTION_AUTO = "auto"; const TOUCH_ACTION_MANIPULATION = "manipulation"; // not implemented const TOUCH_ACTION_NONE = "none"; const TOUCH_ACTION_PAN_X = "pan-x"; const TOUCH_ACTION_PAN_Y = "pan-y"; const TOUCH_ACTION_MAP = getTouchActionProps(); export { TOUCH_ACTION_AUTO, TOUCH_ACTION_COMPUTE, TOUCH_ACTION_MANIPULATION, TOUCH_ACTION_NONE, TOUCH_ACTION_PAN_X, TOUCH_ACTION_PAN_Y, TOUCH_ACTION_MAP, }; --- src/touchactionjs/touchaction-constructor.js (bundled) --- import { TOUCH_ACTION_COMPUTE, TOUCH_ACTION_MAP, TOUCH_ACTION_NONE, TOUCH_ACTION_PAN_X, TOUCH_ACTION_PAN_Y, } from "./touchaction-Consts"; import { DIRECTION_VERTICAL, DIRECTION_HORIZONTAL, } from "../inputjs/input-consts"; import each from "../utils/each"; import boolOrFn from "../utils/bool-or-fn"; import inStr from "../utils/in-str"; import cleanTouchActions from "./clean-touch-actions"; /** * @private * Touch Action * sets the touchAction property or uses the js alternative * @param {Manager} manager * @param {String} value * @constructor */ export default class TouchAction { constructor(manager, value) { this.manager = manager; this.set(value); } /** * @private * set the touchAction value on the element or enable the polyfill * @param {String} value */ set(value) { // find out the touch-action by the event handlers if (value === TOUCH_ACTION_COMPUTE) { value = this.compute(); } this.actions = value.toLowerCase().trim(); } /** * @private * just re-set the touchAction value */ update() { this.set(this.manager.options.touchAction); } /** * @private * compute the value for the touchAction property based on the recognizer's settings * @returns {String} value */ compute() { let actions = []; each(this.manager.recognizers, (recognizer) => { if (boolOrFn(recognizer.options.enable, [recognizer])) { actions = actions.concat(recognizer.getTouchAction()); } }); return cleanTouchActions(actions.join(" ")); } /** * @private * this method is called on each input cycle and provides the preventing of the browser behavior * @param {Object} input */ preventDefaults(input) { let { srcEvent } = input; let direction = input.offsetDirection; // if the touch action did prevented once this session if (this.manager.session.prevented) { srcEvent.preventDefault(); return; } let { action --- src/recognizerjs/get-recognizer-by-name-if-manager.js (bundled) --- /** * @private * get a recognizer by name if it is bound to a manager * @param {Recognizer|String} otherRecognizer * @param {Recognizer} recognizer * @returns {Recognizer} */ export default function getRecognizerByNameIfManager( otherRecognizer, recognizer, ) { let { manager } = recognizer; if (manager) { return manager.get(otherRecognizer); } return otherRecognizer; } --- src/recognizerjs/recognizer-constructor.js (bundled) --- import { STATE_POSSIBLE, STATE_ENDED, STATE_FAILED, STATE_RECOGNIZED, STATE_CANCELLED, STATE_BEGAN, STATE_CHANGED, } from "./recognizer-consts"; import assign from "../utils/assign"; import uniqueId from "../utils/unique-id"; import ifUndefined from "../utils/if-undefined"; import invokeArrayArg from "../utils/invoke-array-arg"; import inArray from "../utils/in-array"; import boolOrFn from "../utils/bool-or-fn"; import getRecognizerByNameIfManager from "./get-recognizer-by-name-if-manager"; import stateStr from "./state-str"; /** * @private * Recognizer flow explained; * * All recognizers have the initial state of POSSIBLE when a input session starts. * The definition of a input session is from the first input until the last input, with all it's movement in it. * * Example session for mouse-input: mousedown -> mousemove -> mouseup * * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed * which determines with state it should be. * * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to * POSSIBLE to give it another change on the next cycle. * * Poss
