From 9e64a070c91ba6e4cedd2ec2c44c6800fa0e3842 Mon Sep 17 00:00:00 2001 From: Aaron Bushnell Date: Fri, 1 Feb 2019 13:17:26 -0500 Subject: [PATCH] Remove source maps from build --- .gitignore | 2 +- CHANGELOG.md | 5 +++++ composer.json | 2 +- src/resources/visor.map | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) delete mode 100644 src/resources/visor.map diff --git a/.gitignore b/.gitignore index 4670b73..799ad9a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ /build/* /yarn-error.log .cache -.map +*.map # MISC FILES .cache diff --git a/CHANGELOG.md b/CHANGELOG.md index 81db57b..2020ceb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Release Notes for Visor +## 2.0.4 - 2019-02-01 + +### Fixed +- Remove source maps from build + ## 2.0.3 - 2019-02-01 ### Fixed diff --git a/composer.json b/composer.json index b8f5f78..284ba8d 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "trendyminds/visor", "description": "A simple admin overlay to get to the relevant areas of the Craft CMS control panel", "type": "craft-plugin", - "version": "2.0.3", + "version": "2.0.4", "keywords": [ "craft", "cms", diff --git a/src/resources/visor.map b/src/resources/visor.map deleted file mode 100644 index b83efa4..0000000 --- a/src/resources/visor.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["../node_modules/hotkeys-js/dist/hotkeys.esm.js","visor.js"],"names":["hotkeys","isff","navigator","userAgent","toLowerCase","indexOf","addEvent","object","event","method","addEventListener","attachEvent","window","getMods","modifier","key","mods","slice","length","i","getKeys","index","keys","replace","split","lastIndexOf","splice","compareArray","a1","a2","arr1","arr2","isIndex","_keyMap","backspace","tab","clear","enter","return","esc","escape","space","left","up","right","down","del","delete","ins","insert","home","end","pageup","pagedown","capslock","_modifier","shift","alt","option","ctrl","control","cmd","command","_downKeys","modifierMap","_mods","_handlers","k","_scope","isBindElement","code","x","toUpperCase","charCodeAt","setScope","scope","getScope","getPressedKeyCodes","filter","target","srcElement","tagName","isContentEditable","isPressed","keyCode","deleteScope","newScope","handlers","Object","prototype","hasOwnProperty","call","clearModifier","which","charCode","unbind","multipleKeys","obj","r","eventHandler","handler","modifiersMatch","y","shortcut","preventDefault","returnValue","stopPropagation","cancelBubble","dispatch","asterisk","push","e","_i","element","document","undefined","toString","_api","a","_hotkeys","noConflict","deep","Visor","isOpen","$toggle","querySelectorAll","$modal","querySelector","handleToggle","bind","open","close","events","forEach","classList","remove","add"],"mappings":";AAwZeA,aAAAA,OAAAA,eAAAA,QAAAA,aAAAA,CAAAA,OAAAA,IAAAA,QAAAA,aAAAA,EA9Yf,IAAIC,EAA4B,oBAAdC,WAA4BA,UAAUC,UAAUC,cAAcC,QAAQ,WAAa,EAGrG,SAASC,EAASC,EAAQC,EAAOC,GAC3BF,EAAOG,iBACTH,EAAOG,iBAAiBF,EAAOC,GAAQ,GAC9BF,EAAOI,aAChBJ,EAAOI,YAAY,KAAOH,EAAO,WAC/BC,EAAOG,OAAOJ,SAMpB,SAASK,EAAQC,EAAUC,GAEpB,IADDC,IAAAA,EAAOD,EAAIE,MAAM,EAAGF,EAAIG,OAAS,GAC5BC,EAAI,EAAGA,EAAIH,EAAKE,OAAQC,IAC/BH,EAAKG,GAAKL,EAASE,EAAKG,GAAGf,eACrBY,OAAAA,EAIV,SAASI,EAAQL,GACVA,IAAKA,EAAM,IAOTM,IAJHC,IAAAA,GADJP,EAAMA,EAAIQ,QAAQ,MAAO,KACVC,MAAM,KACjBH,EAAQC,EAAKG,YAAY,IAGtBJ,GAAS,GACdC,EAAKD,EAAQ,IAAM,IACnBC,EAAKI,OAAOL,EAAO,GACnBA,EAAQC,EAAKG,YAAY,IAGpBH,OAAAA,EAIT,SAASK,EAAaC,EAAIC,GAKnB,IAJDC,IAAAA,EAAOF,EAAGV,QAAUW,EAAGX,OAASU,EAAKC,EACrCE,EAAOH,EAAGV,QAAUW,EAAGX,OAASW,EAAKD,EACrCI,GAAU,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H,IAAAA,EA6CN,WA5CgB,SAAA,IAAA,EAAA,KAAA,GACPC,KAAAA,QAAS,EACTC,KAAAA,QAAUV,SAASW,iBAAiB,uBACpCC,KAAAA,OAASZ,SAASa,cAAc,gBAEhCC,KAAAA,aAAe,KAAKA,aAAaC,KAAK,MACtCC,KAAAA,KAAO,KAAKA,KAAKD,KAAK,MACtBE,KAAAA,MAAQ,KAAKA,MAAMF,KAAK,MAExBG,KAAAA,SAmCT,OAAA,EAAA,EAAA,CAAA,CAAA,IAAA,SAhCW,MAAA,WAAA,IAAA,EAAA,KACFR,KAAAA,QAAQS,QAAQ,SAAAT,GACnBA,EAAQlH,iBAAiB,QAAS,EAAKsH,iBAGjC,EAAA,EAAA,SAAA,IAAK,KAAKA,eACV,EAAA,EAAA,SAAA,MAAO,KAAKG,SA0BxB,CAAA,IAAA,eAvBiB,MAAA,WACT,OAAA,KAAKR,OACA,KAAKQ,QAGP,KAAKD,SAkBhB,CAAA,IAAA,QAfU,MAAA,WAIC,OAHFP,KAAAA,QAAS,EACTG,KAAAA,OAAOQ,UAAUC,OAAO,YAEtB,IAWX,CAAA,IAAA,OARS,MAAA,WAIE,OAHFZ,KAAAA,QAAS,EACTG,KAAAA,OAAOQ,UAAUE,IAAI,YAEnB,MAIX,EAAA,GAAA,IAAId","file":"visor.map","sourceRoot":"../../resources","sourcesContent":["/*!\n * hotkeys-js v3.4.3\n * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.\n * \n * Copyright (c) 2019 kenny wong \n * http://jaywcjlove.github.io/hotkeys\n * \n * Licensed under the MIT license.\n */\n\nvar isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false;\n\n// 绑定事件\nfunction addEvent(object, event, method) {\n if (object.addEventListener) {\n object.addEventListener(event, method, false);\n } else if (object.attachEvent) {\n object.attachEvent('on' + event, function () {\n method(window.event);\n });\n }\n}\n\n// 修饰键转换成对应的键码\nfunction getMods(modifier, key) {\n var mods = key.slice(0, key.length - 1);\n for (var i = 0; i < mods.length; i++) {\n mods[i] = modifier[mods[i].toLowerCase()];\n }return mods;\n}\n\n// 处理传的key字符串转换成数组\nfunction getKeys(key) {\n if (!key) key = '';\n\n key = key.replace(/\\s/g, ''); // 匹配任何空白字符,包括空格、制表符、换页符等等\n var keys = key.split(','); // 同时设置多个快捷键,以','分割\n var index = keys.lastIndexOf('');\n\n // 快捷键可能包含',',需特殊处理\n for (; index >= 0;) {\n keys[index - 1] += ',';\n keys.splice(index, 1);\n index = keys.lastIndexOf('');\n }\n\n return keys;\n}\n\n// 比较修饰键的数组\nfunction compareArray(a1, a2) {\n var arr1 = a1.length >= a2.length ? a1 : a2;\n var arr2 = a1.length >= a2.length ? a2 : a1;\n var isIndex = true;\n\n for (var i = 0; i < arr1.length; i++) {\n if (arr2.indexOf(arr1[i]) === -1) isIndex = false;\n }\n return isIndex;\n}\n\nvar _keyMap = { // 特殊键\n backspace: 8,\n tab: 9,\n clear: 12,\n enter: 13,\n return: 13,\n esc: 27,\n escape: 27,\n space: 32,\n left: 37,\n up: 38,\n right: 39,\n down: 40,\n del: 46,\n delete: 46,\n ins: 45,\n insert: 45,\n home: 36,\n end: 35,\n pageup: 33,\n pagedown: 34,\n capslock: 20,\n '⇪': 20,\n ',': 188,\n '.': 190,\n '/': 191,\n '`': 192,\n '-': isff ? 173 : 189,\n '=': isff ? 61 : 187,\n ';': isff ? 59 : 186,\n '\\'': 222,\n '[': 219,\n ']': 221,\n '\\\\': 220\n};\n\nvar _modifier = { // 修饰键\n '⇧': 16,\n shift: 16,\n '⌥': 18,\n alt: 18,\n option: 18,\n '⌃': 17,\n ctrl: 17,\n control: 17,\n '⌘': isff ? 224 : 91,\n cmd: isff ? 224 : 91,\n command: isff ? 224 : 91\n};\nvar _downKeys = []; // 记录摁下的绑定键\nvar modifierMap = {\n 16: 'shiftKey',\n 18: 'altKey',\n 17: 'ctrlKey'\n};\nvar _mods = { 16: false, 18: false, 17: false };\nvar _handlers = {};\n\n// F1~F12 特殊键\nfor (var k = 1; k < 20; k++) {\n _keyMap['f' + k] = 111 + k;\n}\n\n// 兼容Firefox处理\nmodifierMap[isff ? 224 : 91] = 'metaKey';\n_mods[isff ? 224 : 91] = false;\n\nvar _scope = 'all'; // 默认热键范围\nvar isBindElement = false; // 是否绑定节点\n\n// 返回键码\nvar code = function code(x) {\n return _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);\n};\n\n// 设置获取当前范围(默认为'所有')\nfunction setScope(scope) {\n _scope = scope || 'all';\n}\n// 获取当前范围\nfunction getScope() {\n return _scope || 'all';\n}\n// 获取摁下绑定键的键值\nfunction getPressedKeyCodes() {\n return _downKeys.slice(0);\n}\n\n// 表单控件控件判断 返回 Boolean\nfunction filter(event) {\n var target = event.target || event.srcElement;\n var tagName = target.tagName;\n // 忽略这些情况下快捷键无效\n\n return !(tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA' || target.isContentEditable);\n}\n\n// 判断摁下的键是否为某个键,返回true或者false\nfunction isPressed(keyCode) {\n if (typeof keyCode === 'string') {\n keyCode = code(keyCode); // 转换成键码\n }\n return _downKeys.indexOf(keyCode) !== -1;\n}\n\n// 循环删除handlers中的所有 scope(范围)\nfunction deleteScope(scope, newScope) {\n var handlers = void 0;\n var i = void 0;\n\n // 没有指定scope,获取scope\n if (!scope) scope = getScope();\n\n for (var key in _handlers) {\n if (Object.prototype.hasOwnProperty.call(_handlers, key)) {\n handlers = _handlers[key];\n for (i = 0; i < handlers.length;) {\n if (handlers[i].scope === scope) handlers.splice(i, 1);else i++;\n }\n }\n }\n\n // 如果scope被删除,将scope重置为all\n if (getScope() === scope) setScope(newScope || 'all');\n}\n\n// 清除修饰键\nfunction clearModifier(event) {\n var key = event.keyCode || event.which || event.charCode;\n var i = _downKeys.indexOf(key);\n\n // 从列表中清除按压过的键\n if (i >= 0) _downKeys.splice(i, 1);\n\n // 修饰键 shiftKey altKey ctrlKey (command||metaKey) 清除\n if (key === 93 || key === 224) key = 91;\n if (key in _mods) {\n _mods[key] = false;\n\n // 将修饰键重置为false\n for (var k in _modifier) {\n if (_modifier[k] === key) hotkeys[k] = false;\n }\n }\n}\n\n// 解除绑定某个范围的快捷键\nfunction unbind(key, scope, method) {\n var multipleKeys = getKeys(key);\n var keys = void 0;\n var mods = [];\n var obj = void 0;\n // 通过函数判断,是否解除绑定\n // https://github.com/jaywcjlove/hotkeys/issues/44\n if (typeof scope === 'function') {\n method = scope;\n scope = 'all';\n }\n\n for (var i = 0; i < multipleKeys.length; i++) {\n // 将组合快捷键拆分为数组\n keys = multipleKeys[i].split('+');\n\n // 记录每个组合键中的修饰键的键码 返回数组\n if (keys.length > 1) mods = getMods(_modifier, keys);\n\n // 获取除修饰键外的键值key\n key = keys[keys.length - 1];\n key = key === '*' ? '*' : code(key);\n\n // 判断是否传入范围,没有就获取范围\n if (!scope) scope = getScope();\n\n // 如何key不在 _handlers 中返回不做处理\n if (!_handlers[key]) return;\n\n // 清空 handlers 中数据,\n // 让触发快捷键键之后没有事件执行到达解除快捷键绑定的目的\n for (var r = 0; r < _handlers[key].length; r++) {\n obj = _handlers[key][r];\n // 通过函数判断,是否解除绑定,函数相等直接返回\n if (method && obj.method !== method) return;\n // 判断是否在范围内并且键值相同\n if (obj.scope === scope && compareArray(obj.mods, mods)) {\n _handlers[key][r] = {};\n }\n }\n }\n}\n\n// 对监听对应快捷键的回调函数进行处理\nfunction eventHandler(event, handler, scope) {\n var modifiersMatch = void 0;\n\n // 看它是否在当前范围\n if (handler.scope === scope || handler.scope === 'all') {\n // 检查是否匹配修饰符(如果有返回true)\n modifiersMatch = handler.mods.length > 0;\n\n for (var y in _mods) {\n if (Object.prototype.hasOwnProperty.call(_mods, y)) {\n if (!_mods[y] && handler.mods.indexOf(+y) > -1 || _mods[y] && handler.mods.indexOf(+y) === -1) modifiersMatch = false;\n }\n }\n\n // 调用处理程序,如果是修饰键不做处理\n if (handler.mods.length === 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91] || modifiersMatch || handler.shortcut === '*') {\n if (handler.method(event, handler) === false) {\n if (event.preventDefault) event.preventDefault();else event.returnValue = false;\n if (event.stopPropagation) event.stopPropagation();\n if (event.cancelBubble) event.cancelBubble = true;\n }\n }\n }\n}\n\n// 处理keydown事件\nfunction dispatch(event) {\n var asterisk = _handlers['*'];\n var key = event.keyCode || event.which || event.charCode;\n\n // 搜集绑定的键\n if (_downKeys.indexOf(key) === -1) _downKeys.push(key);\n\n // Gecko(Firefox)的command键值224,在Webkit(Chrome)中保持一致\n // Webkit左右command键值不一样\n if (key === 93 || key === 224) key = 91;\n\n if (key in _mods) {\n _mods[key] = true;\n\n // 将特殊字符的key注册到 hotkeys 上\n for (var k in _modifier) {\n if (_modifier[k] === key) hotkeys[k] = true;\n }\n\n if (!asterisk) return;\n }\n\n // 将modifierMap里面的修饰键绑定到event中\n for (var e in _mods) {\n if (Object.prototype.hasOwnProperty.call(_mods, e)) {\n _mods[e] = event[modifierMap[e]];\n }\n }\n\n // 表单控件过滤 默认表单控件不触发快捷键\n if (!hotkeys.filter.call(this, event)) return;\n\n // 获取范围 默认为all\n var scope = getScope();\n\n // 对任何快捷键都需要做的处理\n if (asterisk) {\n for (var i = 0; i < asterisk.length; i++) {\n if (asterisk[i].scope === scope) eventHandler(event, asterisk[i], scope);\n }\n }\n // key 不在_handlers中返回\n if (!(key in _handlers)) return;\n\n for (var _i = 0; _i < _handlers[key].length; _i++) {\n // 找到处理内容\n eventHandler(event, _handlers[key][_i], scope);\n }\n}\n\nfunction hotkeys(key, option, method) {\n var keys = getKeys(key); // 需要处理的快捷键列表\n var mods = [];\n var scope = 'all'; // scope默认为all,所有范围都有效\n var element = document; // 快捷键事件绑定节点\n var i = 0;\n\n // 对为设定范围的判断\n if (method === undefined && typeof option === 'function') {\n method = option;\n }\n\n if (Object.prototype.toString.call(option) === '[object Object]') {\n if (option.scope) scope = option.scope; // eslint-disable-line\n if (option.element) element = option.element; // eslint-disable-line\n }\n\n if (typeof option === 'string') scope = option;\n\n // 对于每个快捷键进行处理\n for (; i < keys.length; i++) {\n key = keys[i].split('+'); // 按键列表\n mods = [];\n\n // 如果是组合快捷键取得组合快捷键\n if (key.length > 1) mods = getMods(_modifier, key);\n\n // 将非修饰键转化为键码\n key = key[key.length - 1];\n key = key === '*' ? '*' : code(key); // *表示匹配所有快捷键\n\n // 判断key是否在_handlers中,不在就赋一个空数组\n if (!(key in _handlers)) _handlers[key] = [];\n\n _handlers[key].push({\n scope: scope,\n mods: mods,\n shortcut: keys[i],\n method: method,\n key: keys[i]\n });\n }\n // 在全局document上设置快捷键\n if (typeof element !== 'undefined' && !isBindElement) {\n isBindElement = true;\n addEvent(element, 'keydown', function (e) {\n dispatch(e);\n });\n addEvent(element, 'keyup', function (e) {\n clearModifier(e);\n });\n }\n}\n\nvar _api = {\n setScope: setScope,\n getScope: getScope,\n deleteScope: deleteScope,\n getPressedKeyCodes: getPressedKeyCodes,\n isPressed: isPressed,\n filter: filter,\n unbind: unbind\n};\nfor (var a in _api) {\n if (Object.prototype.hasOwnProperty.call(_api, a)) {\n hotkeys[a] = _api[a];\n }\n}\n\nif (typeof window !== 'undefined') {\n var _hotkeys = window.hotkeys;\n hotkeys.noConflict = function (deep) {\n if (deep && window.hotkeys === hotkeys) {\n window.hotkeys = _hotkeys;\n }\n return hotkeys;\n };\n window.hotkeys = hotkeys;\n}\n\nexport default hotkeys;\n","import hotkeys from \"hotkeys-js\";\nimport \"./visor.css\";\n\nclass Visor {\n constructor() {\n this.isOpen = false;\n this.$toggle = document.querySelectorAll(\"[data-visor-toggle]\");\n this.$modal = document.querySelector(\"[data-visor]\");\n\n this.handleToggle = this.handleToggle.bind(this);\n this.open = this.open.bind(this);\n this.close = this.close.bind(this);\n\n this.events();\n }\n\n events() {\n this.$toggle.forEach($toggle => {\n $toggle.addEventListener(\"click\", this.handleToggle)\n });\n\n hotkeys(\"`\", this.handleToggle);\n hotkeys(\"esc\", this.close);\n }\n\n handleToggle() {\n if (this.isOpen) {\n return this.close();\n }\n\n return this.open();\n }\n\n close() {\n this.isOpen = false;\n this.$modal.classList.remove(\"is-open\");\n\n return true;\n }\n\n open() {\n this.isOpen = true;\n this.$modal.classList.add(\"is-open\");\n\n return true;\n }\n}\n\nnew Visor();\n"]} \ No newline at end of file