cloudcmd 19.4.1 → 19.5.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.
- package/ChangeLog +11 -0
- package/HELP.md +3 -1
- package/README.md +1 -1
- package/common/cloudfunc.js +1 -2
- package/common/entity.js +2 -0
- package/dist/cloudcmd.common.css +1 -1
- package/dist/cloudcmd.common.css.map +1 -1
- package/dist/cloudcmd.common.js +598 -587
- package/dist/cloudcmd.common.js.map +1 -1
- package/dist/sw.js +1 -1
- package/dist-dev/cloudcmd.common.css +1 -1
- package/dist-dev/cloudcmd.common.js +64 -64
- package/dist-dev/sw.js +1 -1
- package/package.json +3 -3
- package/server/route.js +1 -1
package/dist/sw.js
CHANGED
|
@@ -311,7 +311,7 @@ const respondWith = currify((f, e) => {
|
|
|
311
311
|
e.respondWith(f(e));
|
|
312
312
|
});
|
|
313
313
|
const getPathName = url => new URL(url).pathname;
|
|
314
|
-
const date = "Wed Feb 18 2026
|
|
314
|
+
const date = "Wed Feb 18 2026 19:57:19 GMT+0200 (Eastern European Standard Time)";
|
|
315
315
|
const NAME = `cloudcmd: ${date}`;
|
|
316
316
|
const createRequest = a => new Request(a, {
|
|
317
317
|
credentials: 'same-origin'
|
|
@@ -1078,61 +1078,6 @@ eval("{\n\nconst findit = __webpack_require__(/*! domfs-findit */ \"./node_modul
|
|
|
1078
1078
|
|
|
1079
1079
|
/***/ },
|
|
1080
1080
|
|
|
1081
|
-
/***/ "./node_modules/rendy/lib/rendy.js"
|
|
1082
|
-
/*!*****************************************!*\
|
|
1083
|
-
!*** ./node_modules/rendy/lib/rendy.js ***!
|
|
1084
|
-
\*****************************************/
|
|
1085
|
-
(module) {
|
|
1086
|
-
|
|
1087
|
-
"use strict";
|
|
1088
|
-
eval("{\n\nconst isString = (a) => typeof a === 'string';\nconst constant = (a) => () => a;\nconst {keys} = Object;\n\nmodule.exports = (template, values, modifiers) => {\n check(template, values);\n \n let result = template;\n \n const names = !modifiers ? keys(values) : template.match(/{{(.*?)}}/g);\n \n for (const key of names) {\n const [parsedKey, value] = parseValue(key, values, modifiers);\n const str = constant(value);\n \n while (result.includes(parsedKey))\n result = result.replace(parsedKey, str);\n }\n \n if (result.includes('{{'))\n result = result.replace(/{{.*?}}/g, '');\n \n return result;\n};\n\nfunction check(template, values) {\n if (!isString(template))\n throw Error('template should be a string!');\n \n if (typeof values !== 'object')\n throw Error('values should be an object!');\n}\n\nfunction parseValue(key, values, modifiers) {\n if (!modifiers)\n return [\n `{{ ${key} }}`,\n values[key],\n ];\n \n const preparedKey = key\n .replaceAll('{{', '')\n .replaceAll('}}', '')\n .replaceAll(' ', '');\n \n const value = values[preparedKey] || '';\n \n if (!preparedKey.includes('|'))\n return [key, value];\n \n const [name, modifierName] = preparedKey.split('|');\n const fn = modifiers[modifierName];\n const currentValue = values[name];\n \n if (!fn)\n return [key, currentValue];\n \n return [key, fn(currentValue)];\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/rendy/lib/rendy.js\n}");
|
|
1089
|
-
|
|
1090
|
-
/***/ },
|
|
1091
|
-
|
|
1092
|
-
/***/ "./node_modules/supermenu/lib/build-items.js"
|
|
1093
|
-
/*!***************************************************!*\
|
|
1094
|
-
!*** ./node_modules/supermenu/lib/build-items.js ***!
|
|
1095
|
-
\***************************************************/
|
|
1096
|
-
(module, __unused_webpack_exports, __webpack_require__) {
|
|
1097
|
-
|
|
1098
|
-
"use strict";
|
|
1099
|
-
eval("{\n\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst TEMPLATE = __webpack_require__(/*! ./template */ \"./node_modules/supermenu/lib/template.js\");\n\nconst isObj = (a) => typeof a === 'object';\nconst DATA_MENU = 'data-menu=\"js-submenu\"';\n\nconst {entries} = Object;\n\nmodule.exports = function buildItems(menuData, menuFuncs, options, path = '') {\n let items = '';\n \n if (path)\n path += '.';\n \n for (const [name, data] of entries(menuData)) {\n let nameIcon;\n let subitems = '';\n let className = '';\n let attribute = '';\n \n const pathName = path + name;\n \n if (!isObj(data)) {\n menuFuncs[pathName] = data;\n } else {\n subitems = rendy(TEMPLATE.MAIN, {\n items: buildItems(data, menuFuncs, options, pathName),\n });\n \n className = ' menu-submenu';\n attribute = ` ${DATA_MENU}`;\n }\n \n if (options.icon) {\n nameIcon = name\n .replace(/\\(|\\)/g, '')\n .replace(/\\s/g, '-')\n .toLowerCase();\n \n className += ` icon icon-${nameIcon}`;\n }\n \n items += rendy(TEMPLATE.ITEM, {\n name,\n subitems,\n className,\n attribute,\n path: pathName,\n });\n }\n \n return items;\n};\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/supermenu/lib/build-items.js\n}");
|
|
1100
|
-
|
|
1101
|
-
/***/ },
|
|
1102
|
-
|
|
1103
|
-
/***/ "./node_modules/supermenu/lib/element-funcs.js"
|
|
1104
|
-
/*!*****************************************************!*\
|
|
1105
|
-
!*** ./node_modules/supermenu/lib/element-funcs.js ***!
|
|
1106
|
-
\*****************************************************/
|
|
1107
|
-
(module) {
|
|
1108
|
-
|
|
1109
|
-
"use strict";
|
|
1110
|
-
eval("{\n\nmodule.exports = class ElementFuncsProto {\n getItem(element) {\n if (this.isName(element))\n return element.parentElement;\n \n return element;\n }\n \n getName(element) {\n if (!element)\n return null;\n \n if (this.isName(element))\n return element;\n \n return element.querySelector('[data-menu-path]');\n }\n \n isName(element) {\n if (!element)\n return false;\n \n return element.hasAttribute('data-menu-path');\n }\n \n isItem(element) {\n return this.checkElementsName(element, 'js-menu-item');\n }\n \n isMenu(element) {\n return this.checkElementsName(element, 'js-menu');\n }\n \n checkElementsName(element, nameElement, attribute) {\n if (!attribute)\n attribute = 'data-name';\n \n if (element) {\n const name = element.getAttribute(attribute);\n \n if (name === nameElement)\n return true;\n }\n \n return false;\n }\n \n isSubMenu(element) {\n const attribute = 'data-menu';\n const value = 'js-submenu';\n const item = this.getItem(element);\n \n return this.checkElementsName(item, value, attribute);\n }\n};\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/supermenu/lib/element-funcs.js\n}");
|
|
1111
|
-
|
|
1112
|
-
/***/ },
|
|
1113
|
-
|
|
1114
|
-
/***/ "./node_modules/supermenu/lib/supermenu.js"
|
|
1115
|
-
/*!*************************************************!*\
|
|
1116
|
-
!*** ./node_modules/supermenu/lib/supermenu.js ***!
|
|
1117
|
-
\*************************************************/
|
|
1118
|
-
(module, __unused_webpack_exports, __webpack_require__) {
|
|
1119
|
-
|
|
1120
|
-
"use strict";
|
|
1121
|
-
eval("{\n\n__webpack_require__(/*! ../css/supermenu.css */ \"./node_modules/supermenu/css/supermenu.css\");\n\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst buildItems = __webpack_require__(/*! ./build-items */ \"./node_modules/supermenu/lib/build-items.js\");\nconst ElementFuncsProto = __webpack_require__(/*! ./element-funcs */ \"./node_modules/supermenu/lib/element-funcs.js\");\nconst isFn = (a) => typeof a === 'function';\nconst isNumber = (a) => typeof a === 'number';\nconst exec = (f, ...a) => isFn(f) && f(...a);\n\nmodule.exports = Supermenu;\n\nfunction Supermenu(element, options, menuData) {\n if (!(this instanceof Supermenu))\n return new Supermenu(element, options, menuData);\n \n const ElementFuncs = new ElementFuncsProto();\n \n let Options = {};\n let Element;\n let ElementHeight;\n let ElementWidth;\n let ElementEvent;\n \n if (menuData) {\n Element = ElementEvent = element;\n Options = options;\n } else if (options) {\n Element = ElementEvent = element;\n menuData = options;\n } else {\n Element = document.body;\n ElementEvent = window;\n menuData = element;\n }\n \n const MenuFuncs = {};\n const ElementMenu = createMenu(menuData);\n \n ElementEvent.addEventListener('click', onClick);\n \n function createMenu(menuData) {\n const items = buildItems(menuData, MenuFuncs, Options);\n \n const menu = createElement('ul', {\n dataName: 'js-menu',\n className: 'menu menu-hidden',\n innerHTML: items,\n parent: Element,\n uniq: false,\n });\n \n return menu;\n }\n \n this.show = showMenuElement;\n this.hide = hideMenuElement;\n \n this.addContextMenuListener = () => {\n ElementEvent.addEventListener('contextmenu', onContextMenu);\n };\n \n this.removeContextMenuListener = () => {\n ElementEvent.addEventListener('contextmenu', onContextMenu);\n };\n \n this.remove = removeElement;\n \n function removeElement() {\n ElementEvent.removeEventListener('click', onClick);\n ElementEvent.removeEventListener('contextmenu', onContextMenu);\n \n Element.removeChild(ElementMenu);\n }\n \n function checkElement(target, position) {\n let element = ElementFuncs.getItem(target);\n let isName = ElementFuncs.isName(element);\n let isItem = ElementFuncs.isItem(element);\n let isSub = ElementFuncs.isSubMenu(element);\n \n if (!isName || !isItem) {\n element = document.elementFromPoint(position.x, position.y);\n isSub = ElementFuncs.isSubMenu(element);\n isName = ElementFuncs.isName(element);\n isItem = ElementFuncs.isItem(element);\n }\n \n return {\n name: isName,\n item: isItem,\n sub: isSub,\n };\n }\n \n function onClick(event, checkResult) {\n event.stopPropagation();\n \n const {\n afterClick,\n beforeClick,\n beforeHide,\n afterHide,\n name,\n } = Options;\n \n const element = event.target;\n \n const is = checkResult || checkElement(element, {\n x: event.clientX,\n y: event.clientY,\n });\n \n const notClick = exec(beforeClick, name);\n \n if (is.sub)\n return event.preventDefault();\n \n exec(beforeHide);\n hideMenuElement();\n exec(afterHide);\n \n if (!notClick && (is.name || is.item)) {\n const itemData = getMenuItemData(element);\n \n exec(itemData);\n exec(afterClick);\n }\n }\n \n function onContextMenu(event) {\n event.preventDefault();\n \n const element = event.target;\n const x = event.clientX;\n const y = event.clientY;\n \n const is = checkElement(element, {\n x,\n y,\n });\n \n if (is.name || is.item || is.sub)\n return onClick(event, is);\n \n hideMenuElement();\n showMenuElement(x, y);\n }\n \n function setMenuPosition(x, y) {\n const isNumberX = isNumber(x);\n const isNumberY = isNumber(y);\n const heightMenu = getMenuHeight();\n const widthMenu = getMenuWidth();\n const heightInner = window.innerHeight;\n const widthInner = window.innerWidth;\n \n if (widthInner < widthMenu + x) {\n x -= widthMenu;\n \n if (x < 0)\n x = 0;\n }\n \n if (heightInner < heightMenu + y) {\n y -= heightMenu;\n \n if (y < 0)\n y = 0;\n }\n \n if (isNumberX)\n ElementMenu.style.left = `${x}px`;\n \n if (isNumberY)\n ElementMenu.style.top = y - 14 + 'px';\n }\n \n function showMenuElement(x, y) {\n const {\n name,\n beforeShow,\n afterShow,\n } = Options;\n \n const params = {\n x,\n y,\n name,\n };\n \n const isShow = exec(beforeShow, params);\n \n if (isShow || isShow !== false) {\n ElementMenu.classList.remove('menu-hidden');\n setMenuPosition(params.x, params.y);\n exec(afterShow, params);\n }\n }\n \n function hideMenuElement() {\n const notHide = exec(Options.beforeClose);\n \n if (!notHide)\n ElementMenu.classList.add('menu-hidden');\n }\n \n function getMenuItemData(element) {\n const nameElement = ElementFuncs.getName(element);\n \n if (!nameElement)\n return null;\n \n const path = nameElement.getAttribute('data-menu-path');\n \n return MenuFuncs[path];\n }\n \n function getMenuHeight() {\n if (!ElementHeight) {\n const {height} = getComputedStyle(ElementMenu);\n \n ElementHeight = parseInt(height, 10);\n }\n \n return ElementHeight;\n }\n \n function getMenuWidth() {\n if (!ElementWidth) {\n const {width} = getComputedStyle(ElementMenu);\n \n ElementWidth = parseInt(width, 10);\n }\n \n return ElementWidth;\n }\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/supermenu/lib/supermenu.js\n}");
|
|
1122
|
-
|
|
1123
|
-
/***/ },
|
|
1124
|
-
|
|
1125
|
-
/***/ "./node_modules/supermenu/lib/template.js"
|
|
1126
|
-
/*!************************************************!*\
|
|
1127
|
-
!*** ./node_modules/supermenu/lib/template.js ***!
|
|
1128
|
-
\************************************************/
|
|
1129
|
-
(module) {
|
|
1130
|
-
|
|
1131
|
-
"use strict";
|
|
1132
|
-
eval("{\n\nmodule.exports.MAIN = '<ul data-name=\"js-menu\" class=\"menu menu-hidden\">{{ items }}</ul>';\nmodule.exports.ITEM = '<li data-name=\"js-menu-item\" class=\"menu-item{{ className }}\"{{ attribute }}>' +\n '<label data-menu-path=\"{{ path }}\">{{ name }}</label>' +\n '{{ subitems }}' +\n '</li>';\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/supermenu/lib/template.js\n}");
|
|
1133
|
-
|
|
1134
|
-
/***/ },
|
|
1135
|
-
|
|
1136
1081
|
/***/ "./node_modules/@cloudcmd/modal/lib/get-class-name.js"
|
|
1137
1082
|
/*!************************************************************!*\
|
|
1138
1083
|
!*** ./node_modules/@cloudcmd/modal/lib/get-class-name.js ***!
|
|
@@ -1195,7 +1140,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1195
1140
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1196
1141
|
|
|
1197
1142
|
"use strict";
|
|
1198
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudCmd: () => (/* binding */ createCloudCmd)\n/* harmony export */ });\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var emitify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\n/* harmony import */ var inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var format_io__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\n/* harmony import */ var just_pascal_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.mjs\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _sw_register_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./sw/register.js */ \"./client/sw/register.js\");\n/* harmony import */ var _get_json_from_file_table_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./get-json-from-file-table.js */ \"./client/get-json-from-file-table.js\");\n/* harmony import */ var _key_index_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./key/index.js */ \"./client/key/index.js\");\n/* harmony import */ var _load_module_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./load-module.js */ \"./client/load-module.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst noJS = a => a.replace(/.js$/, '');\nconst isDev = \"development\" === 'development';\ninherits__WEBPACK_IMPORTED_MODULE_2__(CloudCmdProto, emitify__WEBPACK_IMPORTED_MODULE_1__);\nconst createCloudCmd = ({\n DOM,\n Listeners\n}) => {\n return new CloudCmdProto({\n DOM,\n Listeners\n });\n};\nload_js__WEBPACK_IMPORTED_MODULE_4__.addErrorListener((e, src) => {\n const msg = `file ${src} could not be loaded`;\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.error(msg);\n});\nfunction CloudCmdProto({\n DOM,\n Listeners\n}) {\n emitify__WEBPACK_IMPORTED_MODULE_1__.call(this);\n const CloudCmd = this;\n const Info = DOM.CurrentInfo;\n const {\n Storage,\n Files\n } = DOM;\n this.log = () => {\n if (!isDev) return;\n };\n this.prefix = '';\n this.prefixSocket = '';\n this.prefixURL = '';\n this.MIN_ONE_PANEL_WIDTH = DOM.getCSSVar('min-one-panel-width');\n this.HOST = location.origin || location.protocol + '//' + location.host;\n this.sort = {\n left: 'name',\n right: 'name'\n };\n this.order = {\n left: 'asc',\n right: 'asc'\n };\n this.changeDir = async (path, overrides = {}) => {\n const {\n isRefresh,\n panel,\n history = true,\n noCurrent,\n currentName\n } = overrides;\n const refresh = isRefresh;\n let panelChanged;\n if (!noCurrent && panel && panel !== Info.panel) {\n DOM.changePanel();\n panelChanged = true;\n }\n let imgPosition;\n if (panelChanged || refresh || !history) imgPosition = 'top';\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load(imgPosition, panel);\n\n /* загружаем содержимое каталога */\n await ajaxLoad((0,format_io__WEBPACK_IMPORTED_MODULE_6__.addSlashToEnd)(path), {\n refresh,\n history,\n noCurrent,\n currentName,\n showDotFiles: CloudCmd.config('showDotFiles')\n }, panel);\n };\n\n /**\n * Конструктор CloudClient, который\n * выполняет весь функционал по\n * инициализации\n */\n this.init = async (prefix, config) => {\n CloudCmd.prefix = prefix;\n CloudCmd.prefixURL = `${prefix}${_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.apiURL}`;\n CloudCmd.prefixSocket = config.prefixSocket;\n CloudCmd.DIR_DIST = `${prefix}/dist`;\n CloudCmd.DIR_MODULES = `${this.DIR_DIST}/modules`;\n CloudCmd.config = key => config[key];\n CloudCmd.config.if = currify__WEBPACK_IMPORTED_MODULE_8__((key, fn, a) => config[key] && fn(a));\n CloudCmd._config = (key, value) => {\n /*\n * should be called from config.js only\n * after successful update on server\n */\n if (key === 'password') return;\n config[key] = value;\n };\n if (config.oneFilePanel) CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity;\n if (!document.body.scrollIntoViewIfNeeded) await load_js__WEBPACK_IMPORTED_MODULE_4__.js(`${CloudCmd.DIR_MODULES}/polyfill.js`);\n await initModules();\n await baseInit();\n CloudCmd.route(location.hash);\n };\n this.route = path => {\n const query = path.split('/');\n if (!path) return;\n const [kebabModule] = query;\n const module = noJS((0,just_pascal_case__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(kebabModule.slice(1)));\n const [, file] = query;\n const current = DOM.getCurrentByName(file);\n if (file && !current) {\n const msg = (0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.formatMsg)('set current file', file, 'error');\n CloudCmd.log(msg);\n return;\n }\n DOM.setCurrentFile(current);\n CloudCmd.execFromModule(module, 'show');\n };\n this.logOut = async () => {\n const url = CloudCmd.prefix + '/logout';\n const error = () => document.location.reload();\n const {\n prefix\n } = CloudCmd;\n await DOM.Storage.clear();\n (0,_sw_register_js__WEBPACK_IMPORTED_MODULE_11__.unregisterSW)(prefix);\n DOM.load.ajax({\n url,\n error\n });\n };\n const initModules = async () => {\n CloudCmd.Key = _key_index_js__WEBPACK_IMPORTED_MODULE_13__.Key;\n CloudCmd.Key.bind();\n const [, modules] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, 'modules');\n const showLoad = _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load;\n const doBefore = {\n edit: showLoad,\n menu: showLoad\n };\n const load = (name, path, dobefore) => {\n (0,_load_module_js__WEBPACK_IMPORTED_MODULE_14__.loadModule)({\n name,\n path,\n dobefore\n });\n };\n if (!modules) return;\n for (const module of modules.local) {\n load(null, module, doBefore[module]);\n }\n };\n async function saveCurrentName(currentName) {\n await Storage.set('current-name', currentName);\n }\n async function baseInit() {\n const files = DOM.getFiles();\n CloudCmd.on('current-file', DOM.updateCurrentInfo);\n CloudCmd.on('current-name', saveCurrentName);\n const name = await Storage.get('current-name');\n const currentFile = name && DOM.getCurrentByName(name) || files[0];\n\n /* выделяем строку с первым файлом */\n if (files) DOM.setCurrentFile(currentFile, {\n // when hash is present\n // it should be handled with this.route\n // overwre otherwise\n history: !location.hash\n });\n const dirPath = DOM.getCurrentDirPath();\n Listeners.init();\n const panels = getPanels();\n panels.forEach(Listeners.setOnPanel);\n Listeners.initKeysPanel();\n if (!CloudCmd.config('dirStorage')) return;\n const data = await Storage.get(dirPath);\n if (!data) await Storage.setJson(dirPath, (0,_get_json_from_file_table_js__WEBPACK_IMPORTED_MODULE_12__.getJsonFromFileTable)());\n }\n function getPanels() {\n const panels = ['left'];\n if (CloudCmd.config('oneFilePanel')) return panels;\n return [...panels, 'right'];\n }\n this.execFromModule = async (moduleName, funcName, ...args) => {\n await CloudCmd[moduleName]();\n const func = CloudCmd[moduleName][funcName];\n func(...args);\n };\n this.refresh = async (options = {}) => {\n const {\n panel = Info.panel,\n currentName\n } = options;\n const path = DOM.getCurrentDirPath(panel);\n const isRefresh = true;\n const history = false;\n const noCurrent = options === null || options === void 0 ? void 0 : options.noCurrent;\n await CloudCmd.changeDir(path, {\n isRefresh,\n history,\n panel,\n noCurrent,\n currentName\n });\n };\n\n /**\n * Функция загружает json-данные о Файловой Системе\n * через ajax-запрос.\n * @param path - каталог для чтения\n * @param options\n * { refresh, history } - необходимость обновить данные о каталоге\n * @param panel\n *\n */\n async function ajaxLoad(path, options = {}, panel) {\n const {\n RESTful\n } = DOM;\n CloudCmd.log(`reading dir: \"${path}\";`);\n const dirStorage = CloudCmd.config('dirStorage');\n const json = dirStorage && (await Storage.getJson(path));\n const name = options.currentName || Info.name;\n const {\n noCurrent,\n refresh\n } = options;\n if (!refresh && json) return await createFileTable(json, panel, options);\n const position = DOM.getPanelPosition(panel);\n const sort = CloudCmd.sort[position];\n const order = CloudCmd.order[position];\n const query = rendy__WEBPACK_IMPORTED_MODULE_3__('?sort={{ sort }}&order={{ order }}', {\n sort,\n order\n });\n const [, newObj] = await RESTful.read(path + query, 'json');\n if (!newObj)\n // that's OK, error handled by RESTful\n return;\n options.sort = sort;\n options.order = order;\n await createFileTable(newObj, panel, options);\n if (refresh && !noCurrent) DOM.setCurrentByName(name);\n if (!CloudCmd.config('dirStorage')) return;\n Storage.setJson(path, newObj);\n }\n\n /**\n * Функция строит файловую таблицу\n * @param data - данные о файлах\n * @param panelParam\n * @param options - history, noCurrent, showDotFiles\n */\n async function createFileTable(data, panelParam, options) {\n const {\n history,\n noCurrent,\n showDotFiles\n } = options;\n const names = ['file', 'path', 'link', 'pathLink'];\n const [error, [file, path, link, pathLink]] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, names);\n if (error) return DOM.Dialog.alert(error.responseText);\n const panel = panelParam || DOM.getPanel();\n const {\n prefix\n } = CloudCmd;\n const {\n dir,\n name\n } = Info;\n const {\n childNodes\n } = panel;\n let i = childNodes.length;\n while (i--) panel.removeChild(panel.lastChild);\n panel.innerHTML = (0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.buildFromJSON)({\n sort: options.sort,\n order: options.order,\n data,\n id: panel.id,\n prefix,\n showDotFiles,\n template: {\n file,\n path,\n pathLink,\n link\n }\n });\n Listeners.setOnPanel(panel);\n if (!noCurrent) {\n let current;\n if (name === '..' && dir !== '/') current = DOM.getCurrentByName(dir);\n if (!current) [current] = DOM.getFiles(panel);\n DOM.setCurrentFile(current, {\n history\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n }\n }\n this.goToParentDir = async () => {\n const {\n dir,\n dirPath,\n parentDirPath,\n panel\n } = Info;\n if (dirPath === parentDirPath) return;\n const path = parentDirPath;\n await CloudCmd.changeDir(path);\n const current = DOM.getCurrentByName(dir);\n const [first] = DOM.getFiles(panel);\n DOM.setCurrentFile(current || first, {\n history\n });\n };\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/client.js\n}");
|
|
1143
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudCmd: () => (/* binding */ createCloudCmd)\n/* harmony export */ });\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var emitify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\n/* harmony import */ var inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var format_io__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\n/* harmony import */ var just_pascal_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.mjs\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _sw_register_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./sw/register.js */ \"./client/sw/register.js\");\n/* harmony import */ var _get_json_from_file_table_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./get-json-from-file-table.js */ \"./client/get-json-from-file-table.js\");\n/* harmony import */ var _key_index_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./key/index.js */ \"./client/key/index.js\");\n/* harmony import */ var _load_module_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./load-module.js */ \"./client/load-module.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst noJS = a => a.replace(/.js$/, '');\nconst isDev = \"development\" === 'development';\ninherits__WEBPACK_IMPORTED_MODULE_2__(CloudCmdProto, emitify__WEBPACK_IMPORTED_MODULE_1__);\nconst createCloudCmd = ({\n DOM,\n Listeners\n}) => {\n return new CloudCmdProto({\n DOM,\n Listeners\n });\n};\nload_js__WEBPACK_IMPORTED_MODULE_4__.addErrorListener((e, src) => {\n const msg = `file ${src} could not be loaded`;\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.error(msg);\n});\nfunction CloudCmdProto({\n DOM,\n Listeners\n}) {\n emitify__WEBPACK_IMPORTED_MODULE_1__.call(this);\n const CloudCmd = this;\n const Info = DOM.CurrentInfo;\n const {\n Storage,\n Files\n } = DOM;\n this.log = () => {\n if (!isDev) return;\n };\n this.prefix = '';\n this.prefixSocket = '';\n this.prefixURL = '';\n this.MIN_ONE_PANEL_WIDTH = DOM.getCSSVar('min-one-panel-width');\n this.HOST = location.origin || location.protocol + '//' + location.host;\n this.sort = {\n left: 'name',\n right: 'name'\n };\n this.order = {\n left: 'asc',\n right: 'asc'\n };\n this.changeDir = async (path, overrides = {}) => {\n const {\n isRefresh,\n panel,\n history = true,\n noCurrent,\n currentName\n } = overrides;\n const refresh = isRefresh;\n let panelChanged;\n if (!noCurrent && panel && panel !== Info.panel) {\n DOM.changePanel();\n panelChanged = true;\n }\n let imgPosition;\n if (panelChanged || refresh || !history) imgPosition = 'top';\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load(imgPosition, panel);\n\n /* загружаем содержимое каталога */\n await ajaxLoad((0,format_io__WEBPACK_IMPORTED_MODULE_6__.addSlashToEnd)(path), {\n refresh,\n history,\n noCurrent,\n currentName,\n showDotFiles: CloudCmd.config('showDotFiles')\n }, panel);\n };\n\n /**\n * Конструктор CloudClient, который\n * выполняет весь функционал по\n * инициализации\n */\n this.init = async (prefix, config) => {\n CloudCmd.prefix = prefix;\n CloudCmd.prefixURL = `${prefix}${_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.apiURL}`;\n CloudCmd.prefixSocket = config.prefixSocket;\n CloudCmd.DIR_DIST = `${prefix}/dist`;\n CloudCmd.DIR_MODULES = `${this.DIR_DIST}/modules`;\n CloudCmd.config = key => config[key];\n CloudCmd.config.if = currify__WEBPACK_IMPORTED_MODULE_8__((key, fn, a) => config[key] && fn(a));\n CloudCmd._config = (key, value) => {\n /*\n * should be called from config.js only\n * after successful update on server\n */\n if (key === 'password') return;\n config[key] = value;\n };\n if (config.oneFilePanel) CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity;\n if (!document.body.scrollIntoViewIfNeeded) await load_js__WEBPACK_IMPORTED_MODULE_4__.js(`${CloudCmd.DIR_MODULES}/polyfill.js`);\n await initModules();\n await baseInit();\n CloudCmd.route(location.hash);\n };\n this.route = path => {\n const query = path.split('/');\n if (!path) return;\n const [kebabModule] = query;\n const module = noJS((0,just_pascal_case__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(kebabModule.slice(1)));\n const [, file] = query;\n const current = DOM.getCurrentByName(file);\n if (file && !current) {\n const msg = (0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.formatMsg)('set current file', file, 'error');\n CloudCmd.log(msg);\n return;\n }\n DOM.setCurrentFile(current);\n CloudCmd.execFromModule(module, 'show');\n };\n this.logOut = async () => {\n const url = CloudCmd.prefix + '/logout';\n const error = () => document.location.reload();\n const {\n prefix\n } = CloudCmd;\n await DOM.Storage.clear();\n (0,_sw_register_js__WEBPACK_IMPORTED_MODULE_11__.unregisterSW)(prefix);\n DOM.load.ajax({\n url,\n error\n });\n };\n const initModules = async () => {\n CloudCmd.Key = _key_index_js__WEBPACK_IMPORTED_MODULE_13__.Key;\n CloudCmd.Key.bind();\n const [, modules] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, 'modules');\n const showLoad = _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load;\n const doBefore = {\n edit: showLoad,\n menu: showLoad\n };\n const load = (name, path, dobefore) => {\n (0,_load_module_js__WEBPACK_IMPORTED_MODULE_14__.loadModule)({\n name,\n path,\n dobefore\n });\n };\n if (!modules) return;\n for (const module of modules.local) {\n load(null, module, doBefore[module]);\n }\n };\n async function saveCurrentName(currentName) {\n await Storage.set('current-name', currentName);\n }\n async function baseInit() {\n const files = DOM.getFiles();\n CloudCmd.on('current-file', DOM.updateCurrentInfo);\n CloudCmd.on('current-name', saveCurrentName);\n const name = await Storage.get('current-name');\n const currentFile = name && DOM.getCurrentByName(name) || files[0];\n\n /* выделяем строку с первым файлом */\n if (files) DOM.setCurrentFile(currentFile, {\n // when hash is present\n // it should be handled with this.route\n // overwre otherwise\n history: !location.hash\n });\n const dirPath = DOM.getCurrentDirPath();\n Listeners.init();\n const panels = getPanels();\n panels.forEach(Listeners.setOnPanel);\n Listeners.initKeysPanel();\n if (!CloudCmd.config('dirStorage')) return;\n const data = await Storage.get(dirPath);\n if (!data) await Storage.setJson(dirPath, (0,_get_json_from_file_table_js__WEBPACK_IMPORTED_MODULE_12__.getJsonFromFileTable)());\n }\n function getPanels() {\n const panels = ['left'];\n if (CloudCmd.config('oneFilePanel')) return panels;\n return [...panels, 'right'];\n }\n this.execFromModule = async (moduleName, funcName, ...args) => {\n await CloudCmd[moduleName]();\n const func = CloudCmd[moduleName][funcName];\n func(...args);\n };\n this.refresh = async (options = {}) => {\n const {\n panel = Info.panel,\n currentName\n } = options;\n const path = DOM.getCurrentDirPath(panel);\n const isRefresh = true;\n const history = false;\n const noCurrent = options === null || options === void 0 ? void 0 : options.noCurrent;\n await CloudCmd.changeDir(path, {\n isRefresh,\n history,\n panel,\n noCurrent,\n currentName\n });\n };\n\n /**\n * Функция загружает json-данные о Файловой Системе\n * через ajax-запрос.\n * @param path - каталог для чтения\n * @param options\n * { refresh, history } - необходимость обновить данные о каталоге\n * @param panel\n *\n */\n async function ajaxLoad(path, options = {}, panel) {\n const {\n RESTful\n } = DOM;\n CloudCmd.log(`reading dir: \"${path}\";`);\n const dirStorage = CloudCmd.config('dirStorage');\n const json = dirStorage && (await Storage.getJson(path));\n const name = options.currentName || Info.name;\n const {\n noCurrent,\n refresh\n } = options;\n if (!refresh && json) return await createFileTable(json, panel, options);\n const position = DOM.getPanelPosition(panel);\n const sort = CloudCmd.sort[position];\n const order = CloudCmd.order[position];\n const query = (0,rendy__WEBPACK_IMPORTED_MODULE_3__.rendy)('?sort={{ sort }}&order={{ order }}', {\n sort,\n order\n });\n const [, newObj] = await RESTful.read(path + query, 'json');\n if (!newObj)\n // that's OK, error handled by RESTful\n return;\n options.sort = sort;\n options.order = order;\n await createFileTable(newObj, panel, options);\n if (refresh && !noCurrent) DOM.setCurrentByName(name);\n if (!CloudCmd.config('dirStorage')) return;\n Storage.setJson(path, newObj);\n }\n\n /**\n * Функция строит файловую таблицу\n * @param data - данные о файлах\n * @param panelParam\n * @param options - history, noCurrent, showDotFiles\n */\n async function createFileTable(data, panelParam, options) {\n const {\n history,\n noCurrent,\n showDotFiles\n } = options;\n const names = ['file', 'path', 'link', 'pathLink'];\n const [error, [file, path, link, pathLink]] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_5__.tryToCatch)(Files.get, names);\n if (error) return DOM.Dialog.alert(error.responseText);\n const panel = panelParam || DOM.getPanel();\n const {\n prefix\n } = CloudCmd;\n const {\n dir,\n name\n } = Info;\n const {\n childNodes\n } = panel;\n let i = childNodes.length;\n while (i--) panel.removeChild(panel.lastChild);\n panel.innerHTML = (0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_9__.buildFromJSON)({\n sort: options.sort,\n order: options.order,\n data,\n id: panel.id,\n prefix,\n showDotFiles,\n template: {\n file,\n path,\n pathLink,\n link\n }\n });\n Listeners.setOnPanel(panel);\n if (!noCurrent) {\n let current;\n if (name === '..' && dir !== '/') current = DOM.getCurrentByName(dir);\n if (!current) [current] = DOM.getFiles(panel);\n DOM.setCurrentFile(current, {\n history\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n }\n }\n this.goToParentDir = async () => {\n const {\n dir,\n dirPath,\n parentDirPath,\n panel\n } = Info;\n if (dirPath === parentDirPath) return;\n const path = parentDirPath;\n await CloudCmd.changeDir(path);\n const current = DOM.getCurrentByName(dir);\n const [first] = DOM.getFiles(panel);\n DOM.setCurrentFile(current || first, {\n history\n });\n };\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/client.js\n}");
|
|
1199
1144
|
|
|
1200
1145
|
/***/ },
|
|
1201
1146
|
|
|
@@ -1360,7 +1305,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1360
1305
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1361
1306
|
|
|
1362
1307
|
"use strict";
|
|
1363
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadRemote: () => (/* binding */ loadRemote)\n/* harmony export */ });\n/* harmony import */ var node_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:util */ \"./node_modules/util/util.js\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nconst loadRemote = (0,node_util__WEBPACK_IMPORTED_MODULE_0__.callbackify)(async (name, options) => {\n const {\n prefix,\n config\n } = CloudCmd;\n const o = options;\n if (o.name && window[o.name]) return;\n const modules = await _dom_files__WEBPACK_IMPORTED_MODULE_6__.get('modules');\n const online = config('online') && navigator.onLine;\n const module = (0,_common_util__WEBPACK_IMPORTED_MODULE_5__.findObjByNameInArr)(modules.remote, name);\n const isArray = itype__WEBPACK_IMPORTED_MODULE_2__.array(module.local);\n const {\n version\n } = module;\n let remoteTmpls;\n let local;\n if (isArray) {\n remoteTmpls = module.remote;\n ({\n local\n } = module);\n } else {\n remoteTmpls = [module.remote];\n local = [module.local];\n }\n const localURL = local.map(url => prefix + url);\n const remoteURL = remoteTmpls.map(tmpl => {\n return rendy__WEBPACK_IMPORTED_MODULE_1__(tmpl, {\n version\n });\n });\n if (online) {\n const [e] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_4__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_3__.parallel, remoteURL);\n if (!e) return;\n }\n await load_js__WEBPACK_IMPORTED_MODULE_3__.parallel(localURL);\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/load-remote.js\n}");
|
|
1308
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadRemote: () => (/* binding */ loadRemote)\n/* harmony export */ });\n/* harmony import */ var node_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:util */ \"./node_modules/util/util.js\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var itype__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* global CloudCmd */\n\n\n\n\n\n\n\nconst loadRemote = (0,node_util__WEBPACK_IMPORTED_MODULE_0__.callbackify)(async (name, options) => {\n const {\n prefix,\n config\n } = CloudCmd;\n const o = options;\n if (o.name && window[o.name]) return;\n const modules = await _dom_files__WEBPACK_IMPORTED_MODULE_6__.get('modules');\n const online = config('online') && navigator.onLine;\n const module = (0,_common_util__WEBPACK_IMPORTED_MODULE_5__.findObjByNameInArr)(modules.remote, name);\n const isArray = itype__WEBPACK_IMPORTED_MODULE_2__.array(module.local);\n const {\n version\n } = module;\n let remoteTmpls;\n let local;\n if (isArray) {\n remoteTmpls = module.remote;\n ({\n local\n } = module);\n } else {\n remoteTmpls = [module.remote];\n local = [module.local];\n }\n const localURL = local.map(url => prefix + url);\n const remoteURL = remoteTmpls.map(tmpl => {\n return (0,rendy__WEBPACK_IMPORTED_MODULE_1__.rendy)(tmpl, {\n version\n });\n });\n if (online) {\n const [e] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_4__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_3__.parallel, remoteURL);\n if (!e) return;\n }\n await load_js__WEBPACK_IMPORTED_MODULE_3__.parallel(localURL);\n});\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/dom/load-remote.js\n}");
|
|
1364
1309
|
|
|
1365
1310
|
/***/ },
|
|
1366
1311
|
|
|
@@ -1602,7 +1547,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1602
1547
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1603
1548
|
|
|
1604
1549
|
"use strict";
|
|
1605
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_config_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css/config.css */ \"./css/config.css\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var squad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! squad */ \"./node_modules/squad/lib/squad.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _input_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./input.js */ \"./client/modules/config/input.js\");\n/* global CloudCmd, DOM, io */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n Dialog,\n setTitle\n} = DOM;\nconst Name = 'Config';\nconst loadSocket = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_5__.promisify)(DOM.loadSocket);\nconst showLoad = () => {\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.show.load('top');\n};\nconst addKey = currify__WEBPACK_IMPORTED_MODULE_2__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_9__.addKey(input, fn);\n return input;\n});\nconst addChange = currify__WEBPACK_IMPORTED_MODULE_2__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_9__.add('change', input, fn);\n return input;\n});\nconst Config = {};\nlet Template;\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_7__.css;\nasync function init() {\n if (!CloudCmd.config('configDialog')) return;\n showLoad();\n const {\n DIR_DIST\n } = CloudCmd;\n [Template] = await Promise.all([_dom_files__WEBPACK_IMPORTED_MODULE_10__.get('config-tmpl'), loadSocket(), loadCSS(`${DIR_DIST}/config.css`), CloudCmd.View()]);\n initSocket();\n}\nconst {\n config,\n Key\n} = CloudCmd;\nlet Element;\nfunction getHost() {\n const {\n host,\n origin,\n protocol\n } = location;\n return origin || `${protocol}//${host}`;\n}\nfunction initSocket() {\n const href = getHost();\n const {\n prefixSocket,\n prefix\n } = CloudCmd;\n const ONE_MINUTE = 60 * 1000;\n const socket = io.connect(href + prefixSocket + '/config', {\n reconnectionAttempts: Infinity,\n reconnectionDelay: ONE_MINUTE,\n path: `${prefix}/socket.io`\n });\n const save = data => {\n onSave(data);\n socket.send(data);\n };\n authCheck(socket);\n socket.on('connect', () => {\n Config.save = save;\n });\n socket.on('message', onSave);\n socket.on('log', CloudCmd.log);\n socket.on('disconnect', () => {\n Config.save = saveHttp;\n });\n socket.on('err', Dialog.alert);\n}\nfunction authCheck(socket) {\n socket.emit('auth', config('username'), config('password'));\n socket.on('reject', wraptile__WEBPACK_IMPORTED_MODULE_3__(Dialog.alert, 'Wrong credentials!'));\n}\nConfig.save = saveHttp;\nasync function show() {\n if (!CloudCmd.config('configDialog')) return;\n await fillTemplate();\n}\nasync function fillTemplate() {\n const [error, config] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_6__.tryToCatch)(_dom_files__WEBPACK_IMPORTED_MODULE_10__.get, 'config');\n if (error) return Dialog.alert('Could not load config!');\n const {\n editor,\n menu,\n packer,\n columns,\n theme,\n configAuth,\n ...obj\n } = _input_js__WEBPACK_IMPORTED_MODULE_13__.convert(config);\n obj[`${menu}-selected`] = 'selected';\n obj[`${editor}-selected`] = 'selected';\n obj[`${packer}-selected`] = 'selected';\n obj[`${columns}-selected`] = 'selected';\n obj[`${theme}-selected`] = 'selected';\n obj.configAuth = configAuth ? '' : 'hidden';\n const innerHTML = rendy__WEBPACK_IMPORTED_MODULE_1__(Template, obj);\n Element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_8__('form', {\n className: 'config',\n innerHTML\n });\n const inputs = document.querySelectorAll('input, select', Element);\n const [inputFirst] = inputs;\n let afterShow;\n if (inputFirst) {\n onAuthChange(inputFirst.checked);\n afterShow = inputFirst.focus.bind(inputFirst);\n }\n const getTarget = ({\n target\n }) => target;\n const handleChange = squad__WEBPACK_IMPORTED_MODULE_4__(onChange, getTarget);\n Array.from(inputs).map(addKey(onKey)).map(addChange(handleChange));\n const autoSize = true;\n CloudCmd.View.show(Element, {\n autoSize,\n afterShow\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nasync function onChange(el) {\n const obj = {};\n const name = _input_js__WEBPACK_IMPORTED_MODULE_13__.getName(el);\n const data = _input_js__WEBPACK_IMPORTED_MODULE_13__.getValue(name, Element);\n if (name === 'name') onNameChange(data);else if (name === 'auth') onAuthChange(data);\n obj[name] = data;\n await Config.save(obj);\n}\nfunction onSave(obj) {\n for (const name of Object.keys(obj)) {\n const data = obj[name];\n CloudCmd._config(name, data);\n _input_js__WEBPACK_IMPORTED_MODULE_13__.setValue(name, data, Element);\n }\n}\nasync function saveHttp(obj) {\n const {\n RESTful\n } = DOM;\n const [e] = await RESTful.Config.write(obj);\n if (e) return;\n onSave(obj);\n}\nfunction onAuthChange(checked) {\n const elUsername = _input_js__WEBPACK_IMPORTED_MODULE_13__.getElementByName('username', Element);\n const elPassword = _input_js__WEBPACK_IMPORTED_MODULE_13__.getElementByName('password', Element);\n elUsername.disabled = !checked;\n elPassword.disabled = !checked;\n}\nfunction onNameChange(name) {\n setTitle((0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__.getTitle)({\n name\n }));\n}\nasync function onKey({\n keyCode,\n target\n}) {\n switch (keyCode) {\n case Key.ESC:\n return hide();\n case Key.ENTER:\n return await onChange(target);\n }\n}\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/config/index.js\n}");
|
|
1550
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_config_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css/config.css */ \"./css/config.css\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var squad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! squad */ \"./node_modules/squad/lib/squad.js\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _input_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./input.js */ \"./client/modules/config/input.js\");\n/* global CloudCmd, DOM, io */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst {\n Dialog,\n setTitle\n} = DOM;\nconst Name = 'Config';\nconst loadSocket = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_5__.promisify)(DOM.loadSocket);\nconst showLoad = () => {\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.show.load('top');\n};\nconst addKey = currify__WEBPACK_IMPORTED_MODULE_2__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_9__.addKey(input, fn);\n return input;\n});\nconst addChange = currify__WEBPACK_IMPORTED_MODULE_2__((fn, input) => {\n _dom_events__WEBPACK_IMPORTED_MODULE_9__.add('change', input, fn);\n return input;\n});\nconst Config = {};\nlet Template;\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_7__.css;\nasync function init() {\n if (!CloudCmd.config('configDialog')) return;\n showLoad();\n const {\n DIR_DIST\n } = CloudCmd;\n [Template] = await Promise.all([_dom_files__WEBPACK_IMPORTED_MODULE_10__.get('config-tmpl'), loadSocket(), loadCSS(`${DIR_DIST}/config.css`), CloudCmd.View()]);\n initSocket();\n}\nconst {\n config,\n Key\n} = CloudCmd;\nlet Element;\nfunction getHost() {\n const {\n host,\n origin,\n protocol\n } = location;\n return origin || `${protocol}//${host}`;\n}\nfunction initSocket() {\n const href = getHost();\n const {\n prefixSocket,\n prefix\n } = CloudCmd;\n const ONE_MINUTE = 60 * 1000;\n const socket = io.connect(href + prefixSocket + '/config', {\n reconnectionAttempts: Infinity,\n reconnectionDelay: ONE_MINUTE,\n path: `${prefix}/socket.io`\n });\n const save = data => {\n onSave(data);\n socket.send(data);\n };\n authCheck(socket);\n socket.on('connect', () => {\n Config.save = save;\n });\n socket.on('message', onSave);\n socket.on('log', CloudCmd.log);\n socket.on('disconnect', () => {\n Config.save = saveHttp;\n });\n socket.on('err', Dialog.alert);\n}\nfunction authCheck(socket) {\n socket.emit('auth', config('username'), config('password'));\n socket.on('reject', wraptile__WEBPACK_IMPORTED_MODULE_3__(Dialog.alert, 'Wrong credentials!'));\n}\nConfig.save = saveHttp;\nasync function show() {\n if (!CloudCmd.config('configDialog')) return;\n await fillTemplate();\n}\nasync function fillTemplate() {\n const [error, config] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_6__.tryToCatch)(_dom_files__WEBPACK_IMPORTED_MODULE_10__.get, 'config');\n if (error) return Dialog.alert('Could not load config!');\n const {\n editor,\n menu,\n packer,\n columns,\n theme,\n configAuth,\n ...obj\n } = _input_js__WEBPACK_IMPORTED_MODULE_13__.convert(config);\n obj[`${menu}-selected`] = 'selected';\n obj[`${editor}-selected`] = 'selected';\n obj[`${packer}-selected`] = 'selected';\n obj[`${columns}-selected`] = 'selected';\n obj[`${theme}-selected`] = 'selected';\n obj.configAuth = configAuth ? '' : 'hidden';\n const innerHTML = (0,rendy__WEBPACK_IMPORTED_MODULE_1__.rendy)(Template, obj);\n Element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_8__('form', {\n className: 'config',\n innerHTML\n });\n const inputs = document.querySelectorAll('input, select', Element);\n const [inputFirst] = inputs;\n let afterShow;\n if (inputFirst) {\n onAuthChange(inputFirst.checked);\n afterShow = inputFirst.focus.bind(inputFirst);\n }\n const getTarget = ({\n target\n }) => target;\n const handleChange = squad__WEBPACK_IMPORTED_MODULE_4__(onChange, getTarget);\n Array.from(inputs).map(addKey(onKey)).map(addChange(handleChange));\n const autoSize = true;\n CloudCmd.View.show(Element, {\n autoSize,\n afterShow\n });\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nasync function onChange(el) {\n const obj = {};\n const name = _input_js__WEBPACK_IMPORTED_MODULE_13__.getName(el);\n const data = _input_js__WEBPACK_IMPORTED_MODULE_13__.getValue(name, Element);\n if (name === 'name') onNameChange(data);else if (name === 'auth') onAuthChange(data);\n obj[name] = data;\n await Config.save(obj);\n}\nfunction onSave(obj) {\n for (const name of Object.keys(obj)) {\n const data = obj[name];\n CloudCmd._config(name, data);\n _input_js__WEBPACK_IMPORTED_MODULE_13__.setValue(name, data, Element);\n }\n}\nasync function saveHttp(obj) {\n const {\n RESTful\n } = DOM;\n const [e] = await RESTful.Config.write(obj);\n if (e) return;\n onSave(obj);\n}\nfunction onAuthChange(checked) {\n const elUsername = _input_js__WEBPACK_IMPORTED_MODULE_13__.getElementByName('username', Element);\n const elPassword = _input_js__WEBPACK_IMPORTED_MODULE_13__.getElementByName('password', Element);\n elUsername.disabled = !checked;\n elPassword.disabled = !checked;\n}\nfunction onNameChange(name) {\n setTitle((0,_common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__.getTitle)({\n name\n }));\n}\nasync function onKey({\n keyCode,\n target\n}) {\n switch (keyCode) {\n case Key.ESC:\n return hide();\n case Key.ENTER:\n return await onChange(target);\n }\n}\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/config/index.js\n}");
|
|
1606
1551
|
|
|
1607
1552
|
/***/ },
|
|
1608
1553
|
|
|
@@ -1646,7 +1591,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1646
1591
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1647
1592
|
|
|
1648
1593
|
"use strict";
|
|
1649
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ isChanged: () => (/* binding */ isChanged),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var format_io__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n/* global CloudCmd, DOM*/\n\n\n\n\nCloudCmd.EditFile = {\n init,\n show,\n hide,\n isChanged\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog,\n Images\n} = DOM;\nconst {\n config\n} = CloudCmd;\nlet Menu;\nlet MSG_CHANGED;\nconst isLoading = (0,fullstore__WEBPACK_IMPORTED_MODULE_1__.fullstore)();\nconst ConfigView = {\n beforeClose: async () => {\n execon__WEBPACK_IMPORTED_MODULE_2__.ifExist(Menu, 'hide');\n await isChanged();\n }\n};\nasync function init() {\n isLoading(true);\n await CloudCmd.Edit();\n const editor = CloudCmd.Edit.getEditor();\n authCheck(editor);\n setListeners(editor);\n isLoading(false);\n}\nfunction getName() {\n const {\n name,\n isDir\n } = Info;\n if (isDir) return `${name}.json`;\n return name;\n}\nasync function show(options) {\n if (isLoading()) return;\n const optionsEdit = {\n ...ConfigView,\n ...options\n };\n if (CloudCmd.config('showFileName')) optionsEdit.title = Info.name;\n Images.show.load();\n CloudCmd.Edit.getEditor().setOption('keyMap', 'default');\n const [error, data] = await Info.getData();\n if (error) {\n Images.hide();\n return CloudCmd.Edit;\n }\n const {\n path\n } = Info;\n const name = getName();\n setMsgChanged(name);\n CloudCmd.Edit.getEditor().setValueFirst(path, data).setModeForPath(name).enableKey();\n CloudCmd.Edit.show(optionsEdit);\n return CloudCmd.Edit;\n}\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction setListeners(editor) {\n const element = CloudCmd.Edit.getElement();\n DOM.Events.addOnce('contextmenu', element, setMenu);\n editor.on('save', value => {\n DOM.setCurrentSize(format_io__WEBPACK_IMPORTED_MODULE_0__.size(value));\n });\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction setMenu(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n event.preventDefault();\n if (Menu) return;\n const options = {\n beforeShow: params => {\n params.x -= 18;\n params.y -= 27;\n },\n afterClick: () => {\n CloudCmd.Edit.getEditor().focus();\n }\n };\n const element = CloudCmd.Edit.getElement();\n Menu = supermenu__WEBPACK_IMPORTED_MODULE_3__(element, options, getMenuData());\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\nfunction getMenuData() {\n const editor = CloudCmd.Edit.getEditor();\n return {\n 'Save Ctrl+S': () => {\n editor.save();\n },\n 'Go To Line Ctrl+G': () => {\n editor.goToLine();\n },\n 'Cut Ctrl+X': () => {\n editor.cutToClipboard();\n },\n 'Copy Ctrl+C': () => {\n editor.copyToClipboard();\n },\n 'Paste Ctrl+V': () => {\n editor.pasteFromClipboard();\n },\n 'Delete Del': () => {\n editor.remove('right');\n },\n 'Select All Ctrl+A': () => {\n editor.selectAll();\n },\n 'Close Esc': hide\n };\n}\nfunction setMsgChanged(name) {\n MSG_CHANGED = `Do you want to save changes to ${name}?`;\n}\nasync function isChanged() {\n const editor = CloudCmd.Edit.getEditor();\n const is = editor.isChanged();\n if (!is) return;\n const [cancel] = await Dialog.confirm(MSG_CHANGED);\n if (cancel) return;\n editor.save();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-file.js\n}");
|
|
1594
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ isChanged: () => (/* binding */ isChanged),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var format_io__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n/* global CloudCmd, DOM*/\n\n\n\n\nCloudCmd.EditFile = {\n init,\n show,\n hide,\n isChanged\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog,\n Images\n} = DOM;\nconst {\n config\n} = CloudCmd;\nlet Menu;\nlet MSG_CHANGED;\nconst isLoading = (0,fullstore__WEBPACK_IMPORTED_MODULE_1__.fullstore)();\nconst ConfigView = {\n beforeClose: async () => {\n execon__WEBPACK_IMPORTED_MODULE_2__.ifExist(Menu, 'hide');\n await isChanged();\n }\n};\nasync function init() {\n isLoading(true);\n await CloudCmd.Edit();\n const editor = CloudCmd.Edit.getEditor();\n authCheck(editor);\n setListeners(editor);\n isLoading(false);\n}\nfunction getName() {\n const {\n name,\n isDir\n } = Info;\n if (isDir) return `${name}.json`;\n return name;\n}\nasync function show(options) {\n if (isLoading()) return;\n const optionsEdit = {\n ...ConfigView,\n ...options\n };\n if (CloudCmd.config('showFileName')) optionsEdit.title = Info.name;\n Images.show.load();\n CloudCmd.Edit.getEditor().setOption('keyMap', 'default');\n const [error, data] = await Info.getData();\n if (error) {\n Images.hide();\n return CloudCmd.Edit;\n }\n const {\n path\n } = Info;\n const name = getName();\n setMsgChanged(name);\n CloudCmd.Edit.getEditor().setValueFirst(path, data).setModeForPath(name).enableKey();\n CloudCmd.Edit.show(optionsEdit);\n return CloudCmd.Edit;\n}\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction setListeners(editor) {\n const element = CloudCmd.Edit.getElement();\n DOM.Events.addOnce('contextmenu', element, setMenu);\n editor.on('save', value => {\n DOM.setCurrentSize(format_io__WEBPACK_IMPORTED_MODULE_0__.size(value));\n });\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction setMenu(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n event.preventDefault();\n if (Menu) return;\n const options = {\n beforeShow: params => {\n params.x -= 18;\n params.y -= 27;\n },\n afterClick: () => {\n CloudCmd.Edit.getEditor().focus();\n }\n };\n const element = CloudCmd.Edit.getElement();\n Menu = (0,supermenu__WEBPACK_IMPORTED_MODULE_3__.supermenu)(element, options, getMenuData());\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\nfunction getMenuData() {\n const editor = CloudCmd.Edit.getEditor();\n return {\n 'Save Ctrl+S': () => {\n editor.save();\n },\n 'Go To Line Ctrl+G': () => {\n editor.goToLine();\n },\n 'Cut Ctrl+X': () => {\n editor.cutToClipboard();\n },\n 'Copy Ctrl+C': () => {\n editor.copyToClipboard();\n },\n 'Paste Ctrl+V': () => {\n editor.pasteFromClipboard();\n },\n 'Delete Del': () => {\n editor.remove('right');\n },\n 'Select All Ctrl+A': () => {\n editor.selectAll();\n },\n 'Close Esc': hide\n };\n}\nfunction setMsgChanged(name) {\n MSG_CHANGED = `Do you want to save changes to ${name}?`;\n}\nasync function isChanged() {\n const editor = CloudCmd.Edit.getEditor();\n const is = editor.isChanged();\n if (!is) return;\n const [cancel] = await Dialog.confirm(MSG_CHANGED);\n if (cancel) return;\n editor.save();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-file.js\n}");
|
|
1650
1595
|
|
|
1651
1596
|
/***/ },
|
|
1652
1597
|
|
|
@@ -1668,7 +1613,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1668
1613
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1669
1614
|
|
|
1670
1615
|
"use strict";
|
|
1671
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ isChanged: () => (/* binding */ isChanged),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n/* harmony import */ var multi_rename__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multi-rename */ \"./node_modules/multi-rename/lib/multi-rename.js\");\n\n\n\n\nconst {\n CloudCmd,\n DOM\n} = globalThis;\nCloudCmd.EditNames = {\n init,\n show,\n hide,\n isChanged\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog\n} = DOM;\nlet Menu;\nconst ConfigView = {\n beforeClose: async () => {\n execon__WEBPACK_IMPORTED_MODULE_1__.ifExist(Menu, 'hide');\n DOM.Events.remove('keydown', keyListener);\n await isChanged();\n }\n};\nasync function init() {\n await CloudCmd.Edit();\n setListeners();\n}\nfunction show(options) {\n const names = getActiveNames().join('\\n');\n const config = {\n ...ConfigView,\n ...options\n };\n if (Info.name === '..' && names.length === 1) return Dialog.alert.noFiles();\n DOM.Events.addKey(keyListener);\n CloudCmd.Edit.getEditor().setValueFirst('edit-names', names).setMode().setOption('keyMap', 'default').disableKey();\n CloudCmd.Edit.show(config);\n return CloudCmd.Edit;\n}\nasync function keyListener(event) {\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const ctrlMeta = ctrl || meta;\n const {\n Key\n } = CloudCmd;\n if (ctrlMeta && event.keyCode === Key.S) {\n hide();\n } else if (ctrlMeta && event.keyCode === Key.P) {\n const [, pattern] = await Dialog.prompt('Apply pattern:', '[n][e]');\n pattern && applyPattern(pattern);\n }\n}\nfunction applyPattern(pattern) {\n const newNames = (0,multi_rename__WEBPACK_IMPORTED_MODULE_3__.multiRename)(pattern, getActiveNames());\n const editor = CloudCmd.Edit.getEditor();\n editor.setValue(newNames.join('\\n'));\n}\nfunction getActiveNames() {\n return DOM.getFilenames(DOM.getActiveFiles());\n}\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction setListeners() {\n const element = CloudCmd.Edit.getElement();\n DOM.Events.addOnce('contextmenu', element, setMenu);\n}\nasync function applyNames() {\n const dir = Info.dirPath;\n const from = getActiveNames();\n const nameIndex = from.indexOf(Info.name);\n const editor = CloudCmd.Edit.getEditor();\n const to = editor.getValue().split('\\n');\n const root = CloudCmd.config('root');\n const response = rename(dir, from, to, root);\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(refresh, to, nameIndex, response);\n if (error) alert(error);\n}\nfunction refresh(to, nameIndex, res) {\n if (res.status === 404) {\n const error = res.text();\n throw error;\n }\n const currentName = to[nameIndex];\n CloudCmd.refresh({\n currentName\n });\n}\nfunction getDir(root, dir) {\n if (root === '/') return dir;\n return root + dir;\n}\nfunction rename(path, from, to, root) {\n const dir = getDir(root, path);\n const {\n prefix\n } = CloudCmd;\n return fetch(`${prefix}/rename`, {\n method: 'put',\n credentials: 'include',\n body: JSON.stringify({\n from,\n to,\n dir\n })\n });\n}\nfunction setMenu(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n event.preventDefault();\n if (Menu) return;\n const editor = CloudCmd.Edit.getEditor();\n const options = {\n beforeShow: params => {\n params.x -= 18;\n params.y -= 27;\n },\n afterClick: () => {\n editor.focus();\n }\n };\n const menuData = {\n 'Save Ctrl+S': async () => {\n await applyNames();\n hide();\n },\n 'Go To Line Ctrl+G': () => {\n editor.goToLine();\n },\n 'Cut Ctrl+X': () => {\n editor.cutToClipboard();\n },\n 'Copy Ctrl+C': () => {\n editor.copyToClipboard();\n },\n 'Paste Ctrl+V': () => {\n editor.pasteFromClipboard();\n },\n 'Delete Del': () => {\n editor.remove('right');\n },\n 'Select All Ctrl+A': () => {\n editor.selectAll();\n },\n 'Close Esc': hide\n };\n const element = CloudCmd.Edit.getElement();\n Menu = supermenu__WEBPACK_IMPORTED_MODULE_2__(element, options, menuData);\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\nasync function isChanged() {\n const editor = CloudCmd.Edit.getEditor();\n const msg = 'Apply new names?';\n if (!editor.isChanged()) return;\n const [cancel] = await Dialog.confirm(msg);\n !cancel && (await applyNames());\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-names.js\n}");
|
|
1616
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ isChanged: () => (/* binding */ isChanged),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n/* harmony import */ var multi_rename__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multi-rename */ \"./node_modules/multi-rename/lib/multi-rename.js\");\n\n\n\n\nconst {\n CloudCmd,\n DOM\n} = globalThis;\nCloudCmd.EditNames = {\n init,\n show,\n hide,\n isChanged\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog\n} = DOM;\nlet Menu;\nconst ConfigView = {\n beforeClose: async () => {\n execon__WEBPACK_IMPORTED_MODULE_1__.ifExist(Menu, 'hide');\n DOM.Events.remove('keydown', keyListener);\n await isChanged();\n }\n};\nasync function init() {\n await CloudCmd.Edit();\n setListeners();\n}\nfunction show(options) {\n const names = getActiveNames().join('\\n');\n const config = {\n ...ConfigView,\n ...options\n };\n if (Info.name === '..' && names.length === 1) return Dialog.alert.noFiles();\n DOM.Events.addKey(keyListener);\n CloudCmd.Edit.getEditor().setValueFirst('edit-names', names).setMode().setOption('keyMap', 'default').disableKey();\n CloudCmd.Edit.show(config);\n return CloudCmd.Edit;\n}\nasync function keyListener(event) {\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const ctrlMeta = ctrl || meta;\n const {\n Key\n } = CloudCmd;\n if (ctrlMeta && event.keyCode === Key.S) {\n hide();\n } else if (ctrlMeta && event.keyCode === Key.P) {\n const [, pattern] = await Dialog.prompt('Apply pattern:', '[n][e]');\n pattern && applyPattern(pattern);\n }\n}\nfunction applyPattern(pattern) {\n const newNames = (0,multi_rename__WEBPACK_IMPORTED_MODULE_3__.multiRename)(pattern, getActiveNames());\n const editor = CloudCmd.Edit.getEditor();\n editor.setValue(newNames.join('\\n'));\n}\nfunction getActiveNames() {\n return DOM.getFilenames(DOM.getActiveFiles());\n}\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction setListeners() {\n const element = CloudCmd.Edit.getElement();\n DOM.Events.addOnce('contextmenu', element, setMenu);\n}\nasync function applyNames() {\n const dir = Info.dirPath;\n const from = getActiveNames();\n const nameIndex = from.indexOf(Info.name);\n const editor = CloudCmd.Edit.getEditor();\n const to = editor.getValue().split('\\n');\n const root = CloudCmd.config('root');\n const response = rename(dir, from, to, root);\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.tryToCatch)(refresh, to, nameIndex, response);\n if (error) alert(error);\n}\nfunction refresh(to, nameIndex, res) {\n if (res.status === 404) {\n const error = res.text();\n throw error;\n }\n const currentName = to[nameIndex];\n CloudCmd.refresh({\n currentName\n });\n}\nfunction getDir(root, dir) {\n if (root === '/') return dir;\n return root + dir;\n}\nfunction rename(path, from, to, root) {\n const dir = getDir(root, path);\n const {\n prefix\n } = CloudCmd;\n return fetch(`${prefix}/rename`, {\n method: 'put',\n credentials: 'include',\n body: JSON.stringify({\n from,\n to,\n dir\n })\n });\n}\nfunction setMenu(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n event.preventDefault();\n if (Menu) return;\n const editor = CloudCmd.Edit.getEditor();\n const options = {\n beforeShow: params => {\n params.x -= 18;\n params.y -= 27;\n },\n afterClick: () => {\n editor.focus();\n }\n };\n const menuData = {\n 'Save Ctrl+S': async () => {\n await applyNames();\n hide();\n },\n 'Go To Line Ctrl+G': () => {\n editor.goToLine();\n },\n 'Cut Ctrl+X': () => {\n editor.cutToClipboard();\n },\n 'Copy Ctrl+C': () => {\n editor.copyToClipboard();\n },\n 'Paste Ctrl+V': () => {\n editor.pasteFromClipboard();\n },\n 'Delete Del': () => {\n editor.remove('right');\n },\n 'Select All Ctrl+A': () => {\n editor.selectAll();\n },\n 'Close Esc': hide\n };\n const element = CloudCmd.Edit.getElement();\n Menu = (0,supermenu__WEBPACK_IMPORTED_MODULE_2__.supermenu)(element, options, menuData);\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\nasync function isChanged() {\n const editor = CloudCmd.Edit.getEditor();\n const msg = 'Apply new names?';\n if (!editor.isChanged()) return;\n const [cancel] = await Dialog.confirm(msg);\n !cancel && (await applyNames());\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/edit-names.js\n}");
|
|
1672
1617
|
|
|
1673
1618
|
/***/ },
|
|
1674
1619
|
|
|
@@ -1723,7 +1668,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1723
1668
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1724
1669
|
|
|
1725
1670
|
"use strict";
|
|
1726
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudMenu: () => (/* binding */ createCloudMenu)\n/* harmony export */ });\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n\nconst noop = () => {};\nconst {\n CloudCmd\n} = globalThis;\nconst createCloudMenu = async (fm, options, menuData) => {\n const createMenu = await loadMenu();\n const menu = await createMenu(fm, options, menuData);\n menu.addContextMenuListener = menu.addContextMenuListener || noop;\n return menu;\n};\nasync function loadMenu() {\n if (CloudCmd.config('menu') === 'aleman') {\n const {\n prefix\n } = CloudCmd;\n const {\n host,\n protocol\n } = globalThis.location;\n const url = `${protocol}//${host}${prefix}/node_modules/aleman/menu/menu.js`;\n const {\n createMenu\n } = await import(/* webpackIgnore: true */url);\n return createMenu;\n }\n return createSupermenu;\n}\nfunction createSupermenu(name, options, menuData) {\n const element = document.querySelector('[data-name=\"js-fm\"]');\n return supermenu__WEBPACK_IMPORTED_MODULE_0__(element, options, menuData);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/menu/cloudmenu.js\n}");
|
|
1671
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudMenu: () => (/* binding */ createCloudMenu)\n/* harmony export */ });\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n\nconst noop = () => {};\nconst {\n CloudCmd\n} = globalThis;\nconst createCloudMenu = async (fm, options, menuData) => {\n const createMenu = await loadMenu();\n const menu = await createMenu(fm, options, menuData);\n menu.addContextMenuListener = menu.addContextMenuListener || noop;\n return menu;\n};\nasync function loadMenu() {\n if (CloudCmd.config('menu') === 'aleman') {\n const {\n prefix\n } = CloudCmd;\n const {\n host,\n protocol\n } = globalThis.location;\n const url = `${protocol}//${host}${prefix}/node_modules/aleman/menu/menu.js`;\n const {\n createMenu\n } = await import(/* webpackIgnore: true */url);\n return createMenu;\n }\n return createSupermenu;\n}\nfunction createSupermenu(name, options, menuData) {\n const element = document.querySelector('[data-name=\"js-fm\"]');\n return (0,supermenu__WEBPACK_IMPORTED_MODULE_0__.supermenu)(element, options, menuData);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/menu/cloudmenu.js\n}");
|
|
1727
1672
|
|
|
1728
1673
|
/***/ },
|
|
1729
1674
|
|
|
@@ -1910,7 +1855,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1910
1855
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1911
1856
|
|
|
1912
1857
|
"use strict";
|
|
1913
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _Config: () => (/* binding */ _Config),\n/* harmony export */ _createIframe: () => (/* binding */ _createIframe),\n/* harmony export */ _initConfig: () => (/* binding */ _initConfig),\n/* harmony export */ _viewHtml: () => (/* binding */ _viewHtml),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_view_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #css/view.css */ \"./css/view.css\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @cloudcmd/modal */ \"./node_modules/@cloudcmd/modal/lib/modal.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./types.js */ \"./client/modules/view/types.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst CloudCmd = globalThis.CloudCmd || {};\nconst DOM = globalThis.DOM || {};\nconst isString = a => typeof a === 'string';\nconst {\n assign\n} = Object;\nconst {\n isArray\n} = Array;\nconst lifo = currify__WEBPACK_IMPORTED_MODULE_2__((fn, el, cb, name) => fn(name, el, cb));\nconst series = wraptile__WEBPACK_IMPORTED_MODULE_3__((...a) => {\n for (const f of a) f();\n});\nconst isFn = a => typeof a === 'function';\nconst noop = () => {};\nconst addEvent = lifo(_dom_events__WEBPACK_IMPORTED_MODULE_10__.add);\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_5__.css;\nlet Loading = false;\nconst Name = 'View';\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Key\n} = CloudCmd;\nconst basename = a => a.split('/').pop();\nlet El;\nlet TemplateAudio;\nlet Overlay;\nconst Config = {\n beforeShow: () => {\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.hide();\n Key.unsetBind();\n },\n beforeClose: () => {\n _dom_events__WEBPACK_IMPORTED_MODULE_10__.rmKey(listener);\n Key.setBind();\n },\n afterShow: () => {\n El.focus();\n },\n onOverlayClick,\n afterClose: noop,\n autoSize: false,\n helpers: {\n title: {}\n }\n};\nconst _Config = Config;\nasync function init() {\n await loadAll();\n const events = ['click', 'contextmenu'];\n events.forEach(addEvent(Overlay, onOverlayClick));\n}\nasync function show(data, options = {}) {\n const prefixURL = CloudCmd.prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__.FS;\n if (Loading) return;\n if (!options || options.bindKeys !== false) _dom_events__WEBPACK_IMPORTED_MODULE_10__.addKey(listener);\n El = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('div', {\n className: 'view',\n notAppend: true\n });\n El.tabIndex = 0;\n if (data) {\n if (isArray(data)) El.append(...data);else El.append(data);\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(El, initConfig(options));\n return;\n }\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.show.load();\n const path = prefixURL + Info.path;\n const type = options.raw ? '' : await (0,_types_js__WEBPACK_IMPORTED_MODULE_14__.getType)(path);\n switch (type) {\n default:\n return await viewFile();\n case 'markdown':\n return await CloudCmd.Markdown.show(Info.path);\n case 'html':\n return viewHtml(path);\n case 'image':\n return viewImage(Info.path, prefixURL);\n case 'media':\n return await viewMedia(path);\n case 'pdf':\n return viewPDF(path);\n }\n}\nconst _createIframe = createIframe;\nfunction createIframe(src, overrides = {}) {\n const {\n createElement = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__\n } = overrides;\n const element = createElement('iframe', {\n src,\n width: '100%',\n height: '100%'\n });\n element.addEventListener('load', () => {\n element.contentWindow.addEventListener('keydown', listener);\n });\n return element;\n}\nconst _viewHtml = viewHtml;\nfunction viewHtml(src, overrides = {}) {\n const {\n modal = _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__\n } = overrides;\n modal.open(createIframe(src), Config);\n}\nfunction viewPDF(src) {\n const element = createIframe(src);\n const options = assign({}, Config);\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(element, options);\n}\nasync function viewMedia(path) {\n const [e, element] = await getMediaElement(path);\n if (e) return alert(e);\n const allConfig = {\n ...Config,\n ...{\n autoSize: true,\n afterShow: () => {\n element.querySelector('audio, video').focus();\n }\n }\n };\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(element, allConfig);\n}\nasync function viewFile() {\n const [error, data] = await Info.getData();\n if (error) return _dom_images__WEBPACK_IMPORTED_MODULE_12__.hide();\n const element = document.createTextNode(data);\n const options = Config;\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n El.append(element);\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(El, options);\n}\nconst copy = a => assign({}, a);\nconst _initConfig = initConfig;\nfunction initConfig(options) {\n const config = copy(Config);\n if (!options) return config;\n const names = Object.keys(options);\n for (const name of names) {\n const isConfig = Boolean(config[name]);\n const item = options[name];\n if (!isFn(item) || !isConfig) {\n config[name] = options[name];\n continue;\n }\n const fn = config[name];\n config[name] = series(fn, item);\n }\n return config;\n}\nfunction hide() {\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.close();\n}\nfunction viewImage(path, prefixURL) {\n const isSupportedImage = a => (0,_types_js__WEBPACK_IMPORTED_MODULE_14__.isImage)(a) || a === path;\n const makeTitle = path => ({\n href: `${prefixURL}${path}`,\n title: (0,_common_entity__WEBPACK_IMPORTED_MODULE_13__.encode)(basename(path))\n });\n const names = Info.files.map(DOM.getCurrentPath).filter(isSupportedImage);\n const titles = names.map(makeTitle);\n const index = names.indexOf(Info.path);\n const imageConfig = {\n index,\n autoSize: true,\n arrows: true,\n keys: true,\n helpers: {\n title: {}\n }\n };\n const config = {\n ...Config,\n ...imageConfig\n };\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(titles, config);\n}\nasync function getMediaElement(src) {\n check(src);\n const [error, template] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_4__.tryToCatch)(_dom_files__WEBPACK_IMPORTED_MODULE_9__.get, 'view/media-tmpl');\n if (error) return [error];\n const {\n name\n } = Info;\n if (!TemplateAudio) TemplateAudio = template;\n const is = (0,_types_js__WEBPACK_IMPORTED_MODULE_14__.isAudio)(name);\n const type = is ? 'audio' : 'video';\n const innerHTML = rendy__WEBPACK_IMPORTED_MODULE_1__(TemplateAudio, {\n src,\n type,\n name\n });\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('div', {\n innerHTML\n });\n return [null, element];\n}\nfunction check(src) {\n if (!isString(src)) throw Error('src should be a string!');\n}\nasync function loadAll() {\n const {\n DIR_DIST\n } = CloudCmd;\n (0,_common_util__WEBPACK_IMPORTED_MODULE_8__.time)(`${Name} load`);\n Loading = true;\n await loadCSS(`${DIR_DIST}/view.css`);\n Loading = false;\n}\nfunction onOverlayClick(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n setCurrentByPosition(position);\n}\nfunction setCurrentByPosition(position) {\n const element = DOM.getCurrentByPosition(position);\n if (!element) return;\n const {\n files,\n filesPassive\n } = Info;\n const isFiles = files.includes(element);\n const isFilesPassive = filesPassive.includes(element);\n if (!isFiles && !isFilesPassive) return;\n const isCurrent = DOM.isCurrentFile(element);\n if (isCurrent) return;\n DOM.setCurrentFile(element);\n}\nfunction listener({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/view/index.js\n}");
|
|
1858
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _Config: () => (/* binding */ _Config),\n/* harmony export */ _createIframe: () => (/* binding */ _createIframe),\n/* harmony export */ _initConfig: () => (/* binding */ _initConfig),\n/* harmony export */ _viewHtml: () => (/* binding */ _viewHtml),\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_view_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! #css/view.css */ \"./css/view.css\");\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @cloudcmd/modal */ \"./node_modules/@cloudcmd/modal/lib/modal.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _common_util__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! #common/util */ \"./common/util.js\");\n/* harmony import */ var _dom_files__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/files */ \"./client/dom/files.js\");\n/* harmony import */ var _dom_events__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/events */ \"./client/dom/events/index.js\");\n/* harmony import */ var _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! #common/cloudfunc */ \"./common/cloudfunc.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./types.js */ \"./client/modules/view/types.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst CloudCmd = globalThis.CloudCmd || {};\nconst DOM = globalThis.DOM || {};\nconst isString = a => typeof a === 'string';\nconst {\n assign\n} = Object;\nconst {\n isArray\n} = Array;\nconst lifo = currify__WEBPACK_IMPORTED_MODULE_2__((fn, el, cb, name) => fn(name, el, cb));\nconst series = wraptile__WEBPACK_IMPORTED_MODULE_3__((...a) => {\n for (const f of a) f();\n});\nconst isFn = a => typeof a === 'function';\nconst noop = () => {};\nconst addEvent = lifo(_dom_events__WEBPACK_IMPORTED_MODULE_10__.add);\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_5__.css;\nlet Loading = false;\nconst Name = 'View';\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Key\n} = CloudCmd;\nconst basename = a => a.split('/').pop();\nlet El;\nlet TemplateAudio;\nlet Overlay;\nconst Config = {\n beforeShow: () => {\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.hide();\n Key.unsetBind();\n },\n beforeClose: () => {\n _dom_events__WEBPACK_IMPORTED_MODULE_10__.rmKey(listener);\n Key.setBind();\n },\n afterShow: () => {\n El.focus();\n },\n onOverlayClick,\n afterClose: noop,\n autoSize: false,\n helpers: {\n title: {}\n }\n};\nconst _Config = Config;\nasync function init() {\n await loadAll();\n const events = ['click', 'contextmenu'];\n events.forEach(addEvent(Overlay, onOverlayClick));\n}\nasync function show(data, options = {}) {\n const prefixURL = CloudCmd.prefixURL + _common_cloudfunc__WEBPACK_IMPORTED_MODULE_11__.FS;\n if (Loading) return;\n if (!options || options.bindKeys !== false) _dom_events__WEBPACK_IMPORTED_MODULE_10__.addKey(listener);\n El = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('div', {\n className: 'view',\n notAppend: true\n });\n El.tabIndex = 0;\n if (data) {\n if (isArray(data)) El.append(...data);else El.append(data);\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(El, initConfig(options));\n return;\n }\n _dom_images__WEBPACK_IMPORTED_MODULE_12__.show.load();\n const path = prefixURL + Info.path;\n const type = options.raw ? '' : await (0,_types_js__WEBPACK_IMPORTED_MODULE_14__.getType)(path);\n switch (type) {\n default:\n return await viewFile();\n case 'markdown':\n return await CloudCmd.Markdown.show(Info.path);\n case 'html':\n return viewHtml(path);\n case 'image':\n return viewImage(Info.path, prefixURL);\n case 'media':\n return await viewMedia(path);\n case 'pdf':\n return viewPDF(path);\n }\n}\nconst _createIframe = createIframe;\nfunction createIframe(src, overrides = {}) {\n const {\n createElement = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__\n } = overrides;\n const element = createElement('iframe', {\n src,\n width: '100%',\n height: '100%'\n });\n element.addEventListener('load', () => {\n element.contentWindow.addEventListener('keydown', listener);\n });\n return element;\n}\nconst _viewHtml = viewHtml;\nfunction viewHtml(src, overrides = {}) {\n const {\n modal = _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__\n } = overrides;\n modal.open(createIframe(src), Config);\n}\nfunction viewPDF(src) {\n const element = createIframe(src);\n const options = assign({}, Config);\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(element, options);\n}\nasync function viewMedia(path) {\n const [e, element] = await getMediaElement(path);\n if (e) return alert(e);\n const allConfig = {\n ...Config,\n ...{\n autoSize: true,\n afterShow: () => {\n element.querySelector('audio, video').focus();\n }\n }\n };\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(element, allConfig);\n}\nasync function viewFile() {\n const [error, data] = await Info.getData();\n if (error) return _dom_images__WEBPACK_IMPORTED_MODULE_12__.hide();\n const element = document.createTextNode(data);\n const options = Config;\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n El.append(element);\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(El, options);\n}\nconst copy = a => assign({}, a);\nconst _initConfig = initConfig;\nfunction initConfig(options) {\n const config = copy(Config);\n if (!options) return config;\n const names = Object.keys(options);\n for (const name of names) {\n const isConfig = Boolean(config[name]);\n const item = options[name];\n if (!isFn(item) || !isConfig) {\n config[name] = options[name];\n continue;\n }\n const fn = config[name];\n config[name] = series(fn, item);\n }\n return config;\n}\nfunction hide() {\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.close();\n}\nfunction viewImage(path, prefixURL) {\n const isSupportedImage = a => (0,_types_js__WEBPACK_IMPORTED_MODULE_14__.isImage)(a) || a === path;\n const makeTitle = path => ({\n href: `${prefixURL}${path}`,\n title: (0,_common_entity__WEBPACK_IMPORTED_MODULE_13__.encode)(basename(path))\n });\n const names = Info.files.map(DOM.getCurrentPath).filter(isSupportedImage);\n const titles = names.map(makeTitle);\n const index = names.indexOf(Info.path);\n const imageConfig = {\n index,\n autoSize: true,\n arrows: true,\n keys: true,\n helpers: {\n title: {}\n }\n };\n const config = {\n ...Config,\n ...imageConfig\n };\n _cloudcmd_modal__WEBPACK_IMPORTED_MODULE_6__.open(titles, config);\n}\nasync function getMediaElement(src) {\n check(src);\n const [error, template] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_4__.tryToCatch)(_dom_files__WEBPACK_IMPORTED_MODULE_9__.get, 'view/media-tmpl');\n if (error) return [error];\n const {\n name\n } = Info;\n if (!TemplateAudio) TemplateAudio = template;\n const is = (0,_types_js__WEBPACK_IMPORTED_MODULE_14__.isAudio)(name);\n const type = is ? 'audio' : 'video';\n const innerHTML = (0,rendy__WEBPACK_IMPORTED_MODULE_1__.rendy)(TemplateAudio, {\n src,\n type,\n name\n });\n const element = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_7__('div', {\n innerHTML\n });\n return [null, element];\n}\nfunction check(src) {\n if (!isString(src)) throw Error('src should be a string!');\n}\nasync function loadAll() {\n const {\n DIR_DIST\n } = CloudCmd;\n (0,_common_util__WEBPACK_IMPORTED_MODULE_8__.time)(`${Name} load`);\n Loading = true;\n await loadCSS(`${DIR_DIST}/view.css`);\n Loading = false;\n}\nfunction onOverlayClick(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n setCurrentByPosition(position);\n}\nfunction setCurrentByPosition(position) {\n const element = DOM.getCurrentByPosition(position);\n if (!element) return;\n const {\n files,\n filesPassive\n } = Info;\n const isFiles = files.includes(element);\n const isFilesPassive = filesPassive.includes(element);\n if (!isFiles && !isFilesPassive) return;\n const isCurrent = DOM.isCurrentFile(element);\n if (isCurrent) return;\n DOM.setCurrentFile(element);\n}\nfunction listener({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/view/index.js\n}");
|
|
1914
1859
|
|
|
1915
1860
|
/***/ },
|
|
1916
1861
|
|
|
@@ -1954,7 +1899,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1954
1899
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1955
1900
|
|
|
1956
1901
|
"use strict";
|
|
1957
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FS: () => (/* binding */ FS),\n/* harmony export */ MAX_FILE_SIZE: () => (/* binding */ MAX_FILE_SIZE),\n/* harmony export */ _getDataName: () => (/* binding */ _getDataName),\n/* harmony export */ _getSize: () => (/* binding */ _getSize),\n/* harmony export */ apiURL: () => (/* binding */ apiURL),\n/* harmony export */ buildFromJSON: () => (/* binding */ buildFromJSON),\n/* harmony export */ formatMsg: () => (/* binding */ formatMsg),\n/* harmony export */ getDotDot: () => (/* binding */ getDotDot),\n/* harmony export */ getHeaderField: () => (/* binding */ getHeaderField),\n/* harmony export */ getPathLink: () => (/* binding */ getPathLink),\n/* harmony export */ getTitle: () => (/* binding */ getTitle)\n/* harmony export */ });\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n\n\n\n\nconst getHeaderField = currify__WEBPACK_IMPORTED_MODULE_1__(_getHeaderField);\n\n/* КОНСТАНТЫ (общие для клиента и сервера)*/\n/* название программы */\nconst NAME = 'Cloud Commander';\nconst FS = '/fs';\nconst Path = (0,fullstore__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\nPath('/');\nconst filterOutDotFiles = ({\n showDotFiles\n}) => ({\n name\n}) => {\n if (showDotFiles) return true;\n return !name.startsWith('.');\n};\nconst apiURL = '/api/v1';\nconst MAX_FILE_SIZE = 500 * 1024;\nconst formatMsg = (msg, name, status) => {\n status = status || 'ok';\n name = name || '';\n if (name) name = `(\"${name}\")`;\n return `${msg}: ${status}${name}`;\n};\n\n/**\n * Функция возвращает заголовок веб страницы\n * @path\n */\nconst getTitle = options => {\n options = options || {};\n const {\n path = Path(),\n name\n } = options;\n const array = [name || NAME, path];\n return array.filter(Boolean).join(' - ');\n};\n\n/** Функция получает адреса каждого каталога в пути\n * возвращаеться массив каталогов\n * @param url - адрес каталога\n */\nfunction getPathLink(url, prefix, template) {\n if (!url) throw Error('url could not be empty!');\n if (!template) throw Error('template could not be empty!');\n const names = url.split('/').slice(1, -1);\n const allNames = ['/', ...names];\n const lines = [];\n const n = allNames.length;\n let path = '/';\n for (let i = 0; i < n; i++) {\n const name = allNames[i];\n const isLast = i === n - 1;\n if (i) path += `${name}/`;\n if (i && isLast) {\n lines.push(`${name}/`);\n continue;\n }\n const slash = i ? '/' : '';\n lines.push(rendy__WEBPACK_IMPORTED_MODULE_0__(template, {\n path,\n name,\n slash,\n prefix\n }));\n }\n return lines.join('');\n}\nfunction _getDataName(name) {\n const encoded = btoa(encodeURI(name));\n return `data-name=\"js-file-${encoded}\" `;\n}\n\n/**\n * Функция строит таблицу файлв из JSON-информации о файлах\n * @param params - информация о файлах\n *\n */\nconst buildFromJSON = params => {\n const {\n prefix,\n template,\n sort = 'name',\n order = 'asc',\n showDotFiles\n } = params;\n const templateFile = template.file;\n const templateLink = template.link;\n const json = params.data;\n const path = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(json.path);\n const {\n files\n } = json;\n\n /*\n * Строим путь каталога в котором мы находимся\n * со всеми подкаталогами\n */\n const htmlPath = getPathLink(path, prefix, template.pathLink);\n let fileTable = rendy__WEBPACK_IMPORTED_MODULE_0__(template.path, {\n link: prefix + FS + path,\n fullPath: path,\n path: htmlPath\n });\n const owner = 'owner';\n const mode = 'mode';\n const getFieldName = getHeaderField(sort, order);\n const name = getFieldName('name');\n const size = getFieldName('size');\n const date = getFieldName('date');\n const header = rendy__WEBPACK_IMPORTED_MODULE_0__(templateFile, {\n tag: 'div',\n attribute: 'data-name=\"js-fm-header\" ',\n className: 'fm-header',\n type: '',\n name,\n size,\n date,\n owner,\n mode\n });\n\n /* сохраняем путь */\n Path(path);\n fileTable += `${header}<ul data-name=\"js-files\" class=\"files\">`;\n\n /* Если мы не в корне */\n if (path !== '/') {\n const dotDot = getDotDot(path);\n const link = prefix + FS + dotDot;\n const linkResult = rendy__WEBPACK_IMPORTED_MODULE_0__(template.link, {\n link,\n title: '..',\n name: '..'\n });\n const dataName = _getDataName('..');\n const attribute = `draggable=\"true\" ${dataName}`;\n\n /* Сохраняем путь к каталогу верхнего уровня*/\n fileTable += rendy__WEBPACK_IMPORTED_MODULE_0__(template.file, {\n tag: 'li',\n attribute,\n className: '',\n type: 'directory',\n name: linkResult,\n size: '<dir>',\n date: '--.--.----',\n owner: '.',\n mode: '--- --- ---'\n });\n }\n fileTable += files.filter(filterOutDotFiles({\n showDotFiles\n })).map(updateField).map(file => {\n const name = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(file.name);\n const link = prefix + FS + path + name;\n const {\n type,\n mode,\n date,\n owner,\n size\n } = file;\n const linkResult = rendy__WEBPACK_IMPORTED_MODULE_0__(templateLink, {\n link,\n title: name,\n name,\n attribute: getAttribute(file.type)\n });\n const dataName = _getDataName(file.name);\n const attribute = `draggable=\"true\" ${dataName}`;\n return rendy__WEBPACK_IMPORTED_MODULE_0__(templateFile, {\n tag: 'li',\n attribute,\n className: '',\n type,\n name: linkResult,\n size,\n date,\n owner,\n mode\n });\n }).join('');\n fileTable += '</ul>';\n return fileTable;\n};\nconst updateField = file => ({\n ...file,\n date: file.date || '--.--.----',\n owner: file.owner || 'root',\n size: getSize(file)\n});\nfunction getAttribute(type) {\n if (type === 'directory') return '';\n return 'target=\"_blank\" ';\n}\nconst _getSize = getSize;\nfunction getSize({\n size,\n type\n}) {\n if (type === 'directory') return '<dir>';\n if (/link/.test(type)) return '<link>';\n return size;\n}\nfunction _getHeaderField(sort, order, name) {\n const arrow = order === 'asc' ? '↑' : '↓';\n if (sort !== name) return name;\n if (sort === 'name' && order === 'asc') return name;\n return `${name}${arrow}`;\n}\nfunction getDotDot(path) {\n // убираем последний слеш и каталог в котором мы сейчас находимся\n const lastSlash = path.substr(path, path.lastIndexOf('/'));\n const dotDot = lastSlash.substr(lastSlash, lastSlash.lastIndexOf('/'));\n if (!dotDot) return '/';\n return dotDot;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/cloudfunc.js\n}");
|
|
1902
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FS: () => (/* binding */ FS),\n/* harmony export */ MAX_FILE_SIZE: () => (/* binding */ MAX_FILE_SIZE),\n/* harmony export */ _getDataName: () => (/* binding */ _getDataName),\n/* harmony export */ _getSize: () => (/* binding */ _getSize),\n/* harmony export */ apiURL: () => (/* binding */ apiURL),\n/* harmony export */ buildFromJSON: () => (/* binding */ buildFromJSON),\n/* harmony export */ formatMsg: () => (/* binding */ formatMsg),\n/* harmony export */ getDotDot: () => (/* binding */ getDotDot),\n/* harmony export */ getHeaderField: () => (/* binding */ getHeaderField),\n/* harmony export */ getPathLink: () => (/* binding */ getPathLink),\n/* harmony export */ getTitle: () => (/* binding */ getTitle)\n/* harmony export */ });\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n\n\n\n\nconst getHeaderField = currify__WEBPACK_IMPORTED_MODULE_1__(_getHeaderField);\n\n/* КОНСТАНТЫ (общие для клиента и сервера)*/\n/* название программы */\nconst NAME = 'Cloud Commander';\nconst FS = '/fs';\nconst Path = (0,fullstore__WEBPACK_IMPORTED_MODULE_2__[\"default\"])();\nPath('/');\nconst filterOutDotFiles = ({\n showDotFiles\n}) => ({\n name\n}) => {\n if (showDotFiles) return true;\n return !name.startsWith('.');\n};\nconst apiURL = '/api/v1';\nconst MAX_FILE_SIZE = 500 * 1024;\nconst formatMsg = (msg, name, status) => {\n status = status || 'ok';\n name = name || '';\n if (name) name = `(\"${name}\")`;\n return `${msg}: ${status}${name}`;\n};\n\n/**\n * Функция возвращает заголовок веб страницы\n * @path\n */\nconst getTitle = options => {\n options = options || {};\n const {\n path = Path(),\n name\n } = options;\n const array = [name || NAME, path];\n return array.filter(Boolean).join(' - ');\n};\n\n/** Функция получает адреса каждого каталога в пути\n * возвращаеться массив каталогов\n * @param url - адрес каталога\n */\nfunction getPathLink(url, prefix, template) {\n if (!url) throw Error('url could not be empty!');\n if (!template) throw Error('template could not be empty!');\n const names = url.split('/').slice(1, -1);\n const allNames = ['/', ...names];\n const lines = [];\n const n = allNames.length;\n let path = '/';\n for (let i = 0; i < n; i++) {\n const name = allNames[i];\n const isLast = i === n - 1;\n if (i) path += `${name}/`;\n if (i && isLast) {\n lines.push(`${name}/`);\n continue;\n }\n const slash = i ? '/' : '';\n lines.push((0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(template, {\n path,\n name,\n slash,\n prefix\n }));\n }\n return lines.join('');\n}\nfunction _getDataName(name) {\n const encoded = btoa(encodeURI(name));\n return `data-name=\"js-file-${encoded}\" `;\n}\n\n/**\n * Функция строит таблицу файлв из JSON-информации о файлах\n * @param params - информация о файлах\n *\n */\nconst buildFromJSON = params => {\n const {\n prefix,\n template,\n sort = 'name',\n order = 'asc',\n showDotFiles\n } = params;\n const templateFile = template.file;\n const templateLink = template.link;\n const json = params.data;\n const path = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(json.path);\n const {\n files\n } = json;\n\n /*\n * Строим путь каталога в котором мы находимся\n * со всеми подкаталогами\n */\n const htmlPath = getPathLink(path, prefix, template.pathLink);\n let fileTable = (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(template.path, {\n link: prefix + FS + path,\n fullPath: path,\n path: htmlPath\n });\n const owner = 'owner';\n const mode = 'mode';\n const getFieldName = getHeaderField(sort, order);\n const name = getFieldName('name');\n const size = getFieldName('size');\n const date = getFieldName('date');\n const header = (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(templateFile, {\n tag: 'div',\n attribute: 'data-name=\"js-fm-header\" ',\n className: 'fm-header',\n type: '',\n name,\n size,\n date,\n owner,\n mode\n });\n\n /* сохраняем путь */\n Path(path);\n fileTable += `${header}<ul data-name=\"js-files\" class=\"files\">`;\n\n /* Если мы не в корне */\n if (path !== '/') {\n const dotDot = getDotDot(path);\n const link = prefix + FS + dotDot;\n const linkResult = (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(template.link, {\n link,\n title: '..',\n name: '..'\n });\n const dataName = _getDataName('..');\n const attribute = `draggable=\"true\" ${dataName}`;\n\n /* Сохраняем путь к каталогу верхнего уровня*/\n fileTable += (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(template.file, {\n tag: 'li',\n attribute,\n className: '',\n type: 'directory',\n name: linkResult,\n size: '<dir>',\n date: '--.--.----',\n owner: '.',\n mode: '--- --- ---'\n });\n }\n fileTable += files.filter(filterOutDotFiles({\n showDotFiles\n })).map(updateField).map(file => {\n const name = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(file.name);\n const link = prefix + FS + path + name;\n const {\n type,\n mode,\n date,\n owner,\n size\n } = file;\n const linkResult = (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(templateLink, {\n link,\n title: name,\n name,\n attribute: getAttribute(file.type)\n });\n const dataName = _getDataName(file.name);\n const attribute = `draggable=\"true\" ${dataName}`;\n return (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(templateFile, {\n tag: 'li',\n attribute,\n className: '',\n type,\n name: linkResult,\n size,\n date,\n owner,\n mode\n });\n }).join('');\n fileTable += '</ul>';\n return fileTable;\n};\nconst updateField = file => ({\n ...file,\n date: file.date || '--.--.----',\n owner: file.owner || 'root',\n size: getSize(file)\n});\nfunction getAttribute(type) {\n if (type === 'directory') return '';\n return 'target=\"_blank\" ';\n}\nconst _getSize = getSize;\nfunction getSize({\n size,\n type\n}) {\n if (type === 'directory') return '<dir>';\n if (/link/.test(type)) return '<link>';\n return size;\n}\nfunction _getHeaderField(sort, order, name) {\n const arrow = order === 'asc' ? '↑' : '↓';\n if (sort !== name) return name;\n if (sort === 'name' && order === 'asc') return name;\n return `${name}${arrow}`;\n}\nfunction getDotDot(path) {\n // убираем последний слеш и каталог в котором мы сейчас находимся\n const lastSlash = path.substr(path, path.lastIndexOf('/'));\n const dotDot = lastSlash.substr(lastSlash, lastSlash.lastIndexOf('/'));\n if (!dotDot) return '/';\n return dotDot;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/cloudfunc.js\n}");
|
|
1958
1903
|
|
|
1959
1904
|
/***/ },
|
|
1960
1905
|
|
|
@@ -1965,7 +1910,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1965
1910
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1966
1911
|
|
|
1967
1912
|
"use strict";
|
|
1968
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\nconst Entities = {\n '<': '<',\n '>': '>',\n '"': '\"'\n};\nconst keys = Object.keys(Entities);\nconst encode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(char, 'g');\n str = str.replace(reg, code);\n }\n return str;\n};\nconst decode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(code, 'g');\n str = str.replace(reg, char);\n }\n return str;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/entity.js\n}");
|
|
1913
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ decode: () => (/* binding */ decode),\n/* harmony export */ encode: () => (/* binding */ encode)\n/* harmony export */ });\nconst Entities = {\n '<': '<',\n '>': '>',\n '"': '\"',\n '{': '{',\n '}': '}'\n};\nconst keys = Object.keys(Entities);\nconst encode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(char, 'g');\n str = str.replace(reg, code);\n }\n return str;\n};\nconst decode = str => {\n for (const code of keys) {\n const char = Entities[code];\n const reg = RegExp(code, 'g');\n str = str.replace(reg, char);\n }\n return str;\n};\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/entity.js\n}");
|
|
1969
1914
|
|
|
1970
1915
|
/***/ },
|
|
1971
1916
|
|
|
@@ -2057,6 +2002,17 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
2057
2002
|
|
|
2058
2003
|
/***/ },
|
|
2059
2004
|
|
|
2005
|
+
/***/ "./node_modules/rendy/lib/rendy.js"
|
|
2006
|
+
/*!*****************************************!*\
|
|
2007
|
+
!*** ./node_modules/rendy/lib/rendy.js ***!
|
|
2008
|
+
\*****************************************/
|
|
2009
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2010
|
+
|
|
2011
|
+
"use strict";
|
|
2012
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ rendy: () => (/* binding */ rendy)\n/* harmony export */ });\nconst isString = (a) => typeof a === 'string';\nconst constant = (a) => () => a;\nconst {keys} = Object;\n\nconst rendy = (template, values, modifiers) => {\n check(template, values);\n \n let result = template;\n const names = !modifiers ? keys(values) : template.match(/{{(.*?)}}/g);\n \n for (const key of names) {\n const [parsedKey, value] = parseValue(key, values, modifiers);\n const str = constant(value);\n \n while (result.includes(parsedKey))\n result = result.replace(parsedKey, str);\n }\n \n if (result.includes('{{'))\n result = result.replace(/{{.*?}}/g, '');\n \n return result;\n};\n\nfunction check(template, values) {\n if (!isString(template))\n throw Error('template should be a string!');\n \n if (typeof values !== 'object')\n throw Error('values should be an object!');\n}\n\nfunction parseValue(key, values, modifiers) {\n if (!modifiers)\n return [\n `{{ ${key} }}`,\n values[key],\n ];\n \n const preparedKey = key\n .replaceAll('{{', '')\n .replaceAll('}}', '')\n .replaceAll(' ', '');\n \n const value = values[preparedKey] || '';\n \n if (!preparedKey.includes('|'))\n return [key, value];\n \n const [name, modifierName] = preparedKey.split('|');\n const fn = modifiers[modifierName];\n const currentValue = values[name];\n \n if (!fn)\n return [key, currentValue];\n \n return [key, fn(currentValue)];\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/rendy/lib/rendy.js\n}");
|
|
2013
|
+
|
|
2014
|
+
/***/ },
|
|
2015
|
+
|
|
2060
2016
|
/***/ "./node_modules/scroll-into-view-if-needed/dist/index.js"
|
|
2061
2017
|
/*!***************************************************************!*\
|
|
2062
2018
|
!*** ./node_modules/scroll-into-view-if-needed/dist/index.js ***!
|
|
@@ -2079,6 +2035,50 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
2079
2035
|
|
|
2080
2036
|
/***/ },
|
|
2081
2037
|
|
|
2038
|
+
/***/ "./node_modules/supermenu/lib/build-items.js"
|
|
2039
|
+
/*!***************************************************!*\
|
|
2040
|
+
!*** ./node_modules/supermenu/lib/build-items.js ***!
|
|
2041
|
+
\***************************************************/
|
|
2042
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2043
|
+
|
|
2044
|
+
"use strict";
|
|
2045
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ buildItems)\n/* harmony export */ });\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var _template_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./template.js */ \"./node_modules/supermenu/lib/template.js\");\n\n\n\nconst isObj = (a) => typeof a === 'object';\nconst DATA_MENU = 'data-menu=\"js-submenu\"';\n\nconst {entries} = Object;\n\nfunction buildItems(menuData, menuFuncs, options, path = '') {\n let items = '';\n \n if (path)\n path += '.';\n \n for (const [name, data] of entries(menuData)) {\n let nameIcon;\n let subitems = '';\n let className = '';\n let attribute = '';\n \n const pathName = path + name;\n \n if (!isObj(data)) {\n menuFuncs[pathName] = data;\n } else {\n subitems = (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(_template_js__WEBPACK_IMPORTED_MODULE_1__.MAIN, {\n items: buildItems(data, menuFuncs, options, pathName),\n });\n \n className = ' menu-submenu';\n attribute = ` ${DATA_MENU}`;\n }\n \n if (options.icon) {\n nameIcon = name\n .replace(/[()]/g, '')\n .replace(/\\s/g, '-')\n .toLowerCase();\n \n className += ` icon icon-${nameIcon}`;\n }\n \n items += (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(_template_js__WEBPACK_IMPORTED_MODULE_1__.ITEM, {\n name,\n subitems,\n className,\n attribute,\n path: pathName,\n });\n }\n \n return items;\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/supermenu/lib/build-items.js\n}");
|
|
2046
|
+
|
|
2047
|
+
/***/ },
|
|
2048
|
+
|
|
2049
|
+
/***/ "./node_modules/supermenu/lib/element-funcs.js"
|
|
2050
|
+
/*!*****************************************************!*\
|
|
2051
|
+
!*** ./node_modules/supermenu/lib/element-funcs.js ***!
|
|
2052
|
+
\*****************************************************/
|
|
2053
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2054
|
+
|
|
2055
|
+
"use strict";
|
|
2056
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ ElementFuncsProto)\n/* harmony export */ });\nclass ElementFuncsProto {\n getItem(element) {\n if (this.isName(element))\n return element.parentElement;\n \n return element;\n }\n \n getName(element) {\n if (!element)\n return null;\n \n if (this.isName(element))\n return element;\n \n return element.querySelector('[data-menu-path]');\n }\n \n isName(element) {\n if (!element)\n return false;\n \n return element.hasAttribute('data-menu-path');\n }\n \n isItem(element) {\n return this.checkElementsName(element, 'js-menu-item');\n }\n \n isMenu(element) {\n return this.checkElementsName(element, 'js-menu');\n }\n \n checkElementsName(element, nameElement, attribute) {\n if (!attribute)\n attribute = 'data-name';\n \n if (element) {\n const name = element.getAttribute(attribute);\n \n if (name === nameElement)\n return true;\n }\n \n return false;\n }\n \n isSubMenu(element) {\n const attribute = 'data-menu';\n const value = 'js-submenu';\n const item = this.getItem(element);\n \n return this.checkElementsName(item, value, attribute);\n }\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/supermenu/lib/element-funcs.js\n}");
|
|
2057
|
+
|
|
2058
|
+
/***/ },
|
|
2059
|
+
|
|
2060
|
+
/***/ "./node_modules/supermenu/lib/supermenu.js"
|
|
2061
|
+
/*!*************************************************!*\
|
|
2062
|
+
!*** ./node_modules/supermenu/lib/supermenu.js ***!
|
|
2063
|
+
\*************************************************/
|
|
2064
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2065
|
+
|
|
2066
|
+
"use strict";
|
|
2067
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ supermenu: () => (/* binding */ supermenu)\n/* harmony export */ });\n/* harmony import */ var _css_supermenu_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../css/supermenu.css */ \"./node_modules/supermenu/css/supermenu.css\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var _build_items_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./build-items.js */ \"./node_modules/supermenu/lib/build-items.js\");\n/* harmony import */ var _element_funcs_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./element-funcs.js */ \"./node_modules/supermenu/lib/element-funcs.js\");\n\n\n\n\n\nconst isNumber = (a) => typeof a === 'number';\nconst exec = (f, ...a) => f?.(...a);\n\nfunction supermenu(element, options, menuData) {\n if (!(this instanceof supermenu))\n return new supermenu(element, options, menuData);\n \n const ElementFuncs = new _element_funcs_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n \n let Options = {};\n let Element;\n let ElementHeight;\n let ElementWidth;\n let ElementEvent;\n \n if (menuData) {\n Element = element;\n ElementEvent = Element;\n Options = options;\n } else if (options) {\n Element = element;\n ElementEvent = Element;\n menuData = options;\n } else {\n Element = document.body;\n ElementEvent = window;\n menuData = element;\n }\n \n const MenuFuncs = {};\n const ElementMenu = createMenu(menuData);\n \n ElementEvent.addEventListener('click', onClick);\n \n function createMenu(menuData) {\n const items = (0,_build_items_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(menuData, MenuFuncs, Options);\n \n const menu = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_1__('ul', {\n dataName: 'js-menu',\n className: 'menu menu-hidden',\n innerHTML: items,\n parent: Element,\n uniq: false,\n });\n \n return menu;\n }\n \n this.show = showMenuElement;\n this.hide = hideMenuElement;\n \n this.addContextMenuListener = () => {\n ElementEvent.addEventListener('contextmenu', onContextMenu);\n };\n \n this.removeContextMenuListener = () => {\n ElementEvent.addEventListener('contextmenu', onContextMenu);\n };\n \n this.remove = removeElement;\n \n function removeElement() {\n ElementEvent.removeEventListener('click', onClick);\n ElementEvent.removeEventListener('contextmenu', onContextMenu);\n \n Element.removeChild(ElementMenu);\n }\n \n function checkElement(target, position) {\n let element = ElementFuncs.getItem(target);\n let isName = ElementFuncs.isName(element);\n let isItem = ElementFuncs.isItem(element);\n let isSub = ElementFuncs.isSubMenu(element);\n \n if (!isName || !isItem) {\n element = document.elementFromPoint(position.x, position.y);\n isSub = ElementFuncs.isSubMenu(element);\n isName = ElementFuncs.isName(element);\n isItem = ElementFuncs.isItem(element);\n }\n \n return {\n name: isName,\n item: isItem,\n sub: isSub,\n };\n }\n \n function onClick(event, checkResult) {\n event.stopPropagation();\n \n const {\n afterClick,\n beforeClick,\n beforeHide,\n afterHide,\n name,\n } = Options;\n \n const element = event.target;\n \n const is = checkResult || checkElement(element, {\n x: event.clientX,\n y: event.clientY,\n });\n \n const notClick = exec(beforeClick, name);\n \n if (is.sub)\n return event.preventDefault();\n \n exec(beforeHide);\n hideMenuElement();\n exec(afterHide);\n \n if (!notClick && (is.name || is.item)) {\n const itemData = getMenuItemData(element);\n \n exec(itemData);\n exec(afterClick);\n }\n }\n \n function onContextMenu(event) {\n event.preventDefault();\n \n const element = event.target;\n const x = event.clientX;\n const y = event.clientY;\n \n const is = checkElement(element, {\n x,\n y,\n });\n \n if (is.name || is.item || is.sub)\n return onClick(event, is);\n \n hideMenuElement();\n showMenuElement(x, y);\n }\n \n function setMenuPosition(x, y) {\n const isNumberX = isNumber(x);\n const isNumberY = isNumber(y);\n const heightMenu = getMenuHeight();\n const widthMenu = getMenuWidth();\n const heightInner = globalThis.innerHeight;\n const widthInner = globalThis.innerWidth;\n \n if (widthInner < widthMenu + x) {\n x -= widthMenu;\n \n if (x < 0)\n x = 0;\n }\n \n if (heightInner < heightMenu + y) {\n y -= heightMenu;\n \n if (y < 0)\n y = 0;\n }\n \n if (isNumberX)\n ElementMenu.style.left = `${x}px`;\n \n if (isNumberY)\n ElementMenu.style.top = y - 14 + 'px';\n }\n \n function showMenuElement(x, y) {\n const {\n name,\n beforeShow,\n afterShow,\n } = Options;\n \n const params = {\n x,\n y,\n name,\n };\n \n const isShow = exec(beforeShow, params);\n \n if (isShow || isShow !== false) {\n ElementMenu.classList.remove('menu-hidden');\n setMenuPosition(params.x, params.y);\n exec(afterShow, params);\n }\n }\n \n function hideMenuElement() {\n const notHide = exec(Options.beforeClose);\n \n if (!notHide)\n ElementMenu.classList.add('menu-hidden');\n }\n \n function getMenuItemData(element) {\n const nameElement = ElementFuncs.getName(element);\n \n if (!nameElement)\n return null;\n \n const path = nameElement.getAttribute('data-menu-path');\n \n return MenuFuncs[path];\n }\n \n function getMenuHeight() {\n if (!ElementHeight) {\n const {height} = getComputedStyle(ElementMenu);\n \n ElementHeight = parseInt(height, 10);\n }\n \n return ElementHeight;\n }\n \n function getMenuWidth() {\n if (!ElementWidth) {\n const {width} = getComputedStyle(ElementMenu);\n \n ElementWidth = parseInt(width, 10);\n }\n \n return ElementWidth;\n }\n}\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/supermenu/lib/supermenu.js\n}");
|
|
2068
|
+
|
|
2069
|
+
/***/ },
|
|
2070
|
+
|
|
2071
|
+
/***/ "./node_modules/supermenu/lib/template.js"
|
|
2072
|
+
/*!************************************************!*\
|
|
2073
|
+
!*** ./node_modules/supermenu/lib/template.js ***!
|
|
2074
|
+
\************************************************/
|
|
2075
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2076
|
+
|
|
2077
|
+
"use strict";
|
|
2078
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ITEM: () => (/* binding */ ITEM),\n/* harmony export */ MAIN: () => (/* binding */ MAIN)\n/* harmony export */ });\nconst MAIN = '<ul data-name=\"js-menu\" class=\"menu menu-hidden\">{{ items }}</ul>';\nconst ITEM = '<li data-name=\"js-menu-item\" class=\"menu-item{{ className }}\"{{ attribute }}>' +\n '<label data-menu-path=\"{{ path }}\">{{ name }}</label>' +\n '{{ subitems }}' +\n '</li>';\n\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/supermenu/lib/template.js\n}");
|
|
2079
|
+
|
|
2080
|
+
/***/ },
|
|
2081
|
+
|
|
2082
2082
|
/***/ "./node_modules/try-catch/lib/try-catch.js"
|
|
2083
2083
|
/*!*************************************************!*\
|
|
2084
2084
|
!*** ./node_modules/try-catch/lib/try-catch.js ***!
|
package/dist-dev/sw.js
CHANGED
|
@@ -37,7 +37,7 @@ eval("{// shim for using process in browser\nvar process = module.exports = {};\
|
|
|
37
37
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
38
38
|
|
|
39
39
|
"use strict";
|
|
40
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\n\n\nconst isDev = \"development\" === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify__WEBPACK_IMPORTED_MODULE_2__((f, e) => e.waitUntil(f()));\nconst respondWith = currify__WEBPACK_IMPORTED_MODULE_2__((f, e) => {\n const {\n request\n } = e;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n if (url.endsWith('/') || /\\^\\/fs/.test(pathname)) return;\n if (!isGet(request)) return;\n if (!isBasic(request)) return;\n if (pathname.startsWith('/api')) return;\n if (/^socket.io/.test(pathname)) return;\n e.respondWith(f(e));\n});\nconst getPathName = url => new URL(url).pathname;\nconst date = \"Wed Feb 18 2026
|
|
40
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\n\n\nconst isDev = \"development\" === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify__WEBPACK_IMPORTED_MODULE_2__((f, e) => e.waitUntil(f()));\nconst respondWith = currify__WEBPACK_IMPORTED_MODULE_2__((f, e) => {\n const {\n request\n } = e;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n if (url.endsWith('/') || /\\^\\/fs/.test(pathname)) return;\n if (!isGet(request)) return;\n if (!isBasic(request)) return;\n if (pathname.startsWith('/api')) return;\n if (/^socket.io/.test(pathname)) return;\n e.respondWith(f(e));\n});\nconst getPathName = url => new URL(url).pathname;\nconst date = \"Wed Feb 18 2026 19:57:21 GMT+0200 (Eastern European Standard Time)\";\nconst NAME = `cloudcmd: ${date}`;\nconst createRequest = a => new Request(a, {\n credentials: 'same-origin'\n});\nconst getRequest = (a, request) => {\n if (a !== '/') return request;\n return createRequest('/');\n};\nglobalThis.addEventListener('install', wait(onInstall));\nglobalThis.addEventListener('fetch', respondWith(onFetch));\nglobalThis.addEventListener('activate', wait(onActivate));\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n await globalThis.clients.claim();\n const keys = await caches.keys();\n const deleteCache = caches.delete.bind(caches);\n await Promise.all(keys.map(deleteCache));\n}\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n await globalThis.skipWaiting();\n}\nasync function onFetch(event) {\n const {\n request\n } = event;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n const newRequest = getRequest(pathname, event.request);\n const cache = await caches.open(NAME);\n const response = await cache.match(request);\n if (!isDev && response) return response;\n const [e, resp] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_1__.tryToCatch)(fetch, newRequest, {\n credentials: 'same-origin'\n });\n if (e) return new Response(e.message);\n await addToCache(request, resp.clone());\n return resp;\n}\nasync function addToCache(request, response) {\n const cache = await caches.open(NAME);\n return cache.put(request, response);\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/sw/sw.js\n}");
|
|
41
41
|
|
|
42
42
|
/***/ },
|
|
43
43
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcmd",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "File manager for the web with console and editor",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"pullout": "^5.0.0",
|
|
133
133
|
"putout": "^42.0.5",
|
|
134
134
|
"redzip": "^4.0.0",
|
|
135
|
-
"rendy": "^
|
|
135
|
+
"rendy": "^5.0.0",
|
|
136
136
|
"restafary": "^13.0.1",
|
|
137
137
|
"restbox": "^4.0.0",
|
|
138
138
|
"shortdate": "^2.0.0",
|
|
@@ -209,7 +209,7 @@
|
|
|
209
209
|
"serve-once": "^3.0.1",
|
|
210
210
|
"smalltalk": "^5.0.0",
|
|
211
211
|
"style-loader": "^4.0.0",
|
|
212
|
-
"supermenu": "^
|
|
212
|
+
"supermenu": "^5.0.0",
|
|
213
213
|
"supertape": "^12.0.0",
|
|
214
214
|
"tar-stream": "^3.0.0",
|
|
215
215
|
"unionfs": "^4.0.0",
|
package/server/route.js
CHANGED
|
@@ -2,7 +2,7 @@ import {createRequire} from 'node:module';
|
|
|
2
2
|
import {extname} from 'node:path';
|
|
3
3
|
import * as _win32 from 'win32';
|
|
4
4
|
import ponse from 'ponse';
|
|
5
|
-
import rendy from 'rendy';
|
|
5
|
+
import {rendy} from 'rendy';
|
|
6
6
|
import format from 'format-io';
|
|
7
7
|
import currify from 'currify';
|
|
8
8
|
import wraptile from 'wraptile';
|