Greasy Fork is available in English.

MooUI

This library allows you to quickly create a menu for your browser game (More for MooMoo.io) script.

Dette scriptet burde ikke installeres direkte. Det er et bibliotek for andre script å inkludere med det nye metadirektivet // @require https://update.greatest.deepsurf.us/scripts/480303/1282926/MooUI.js

  1. /******/
  2. (function() { // webpackBootstrap
  3. /******/
  4. "use strict";
  5. /******/
  6. var __webpack_modules__ = ({
  7. /***/
  8. "./src/configs/templates/columns.ts":
  9. /*!******************************************!*\
  10. !*** ./src/configs/templates/columns.ts ***!
  11. \******************************************/
  12. /***/
  13. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  14. __webpack_require__.r(__webpack_exports__);
  15. var columnsTemplate = {
  16. showDisplay: "block",
  17. warns: {
  18. appendNode: "menu.appendNode is undefined. Without this, the menu will not be added to HTML. MenuID: [m_id]"
  19. },
  20. column: {
  21. defaultX: 20,
  22. defaultY: 20,
  23. defaultWidth: 200,
  24. defaultHeight: 400,
  25. defaultMaxHeight: 400,
  26. dragMouseKey: 0,
  27. header: {
  28. defaultWidth: 200,
  29. defaultHeight: 30,
  30. openMouseKey: 2,
  31. colors: {
  32. main: "rgba(26, 26, 26, 1)",
  33. text: "rgba(255, 255, 255, 1)"
  34. }
  35. },
  36. container: {
  37. showDisplay: "flex",
  38. colors: {
  39. main: "rgba(26, 26, 26, 1)",
  40. text: "rgba(255, 255, 255, 1)"
  41. }
  42. },
  43. optionsContainer: {
  44. showDisplay: "flex",
  45. colors: {
  46. main: "rgba(26, 26, 26, 1)",
  47. text: "rgba(255, 255, 255, 1)"
  48. }
  49. },
  50. checkbox: {
  51. toggleKey: 0,
  52. openOptionsKey: 2
  53. }
  54. }
  55. };
  56. /* harmony default export */
  57. __webpack_exports__["default"] = (columnsTemplate);
  58. /***/
  59. }),
  60. /***/
  61. "./src/menu/Menu.ts":
  62. /*!**************************!*\
  63. !*** ./src/menu/Menu.ts ***!
  64. \**************************/
  65. /***/
  66. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  67. __webpack_require__.r(__webpack_exports__);
  68. /* harmony import */
  69. var _layout_htmlLayout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./layout/htmlLayout */ "./src/menu/layout/htmlLayout.ts");
  70. var Menu = /** @class */ (function() {
  71. function Menu(_a) {
  72. var id = _a.id,
  73. config = _a.config,
  74. toggleKey = _a.toggleKey,
  75. appendNode = _a.appendNode;
  76. this.id = id;
  77. this.config = config;
  78. this.toggleKey = toggleKey;
  79. this.appendNode = appendNode;
  80. if (!this.appendNode) {
  81. console.warn(this.config.warns.appendNode.replace(/\[m_id\]/g, this.id));
  82. }
  83. this.holder = document.createElement("div");
  84. this.showDisplay = this.config.showDisplay;
  85. this.columns = new Map();
  86. this.isMenu = true;
  87. this.modelsActionEvents = new Map();
  88. this.append();
  89. this.hide();
  90. console.log("Menu created.");
  91. }
  92. Object.defineProperty(Menu.prototype, "isVisible", {
  93. get: function() {
  94. return this.holder.style.display === this.showDisplay;
  95. },
  96. enumerable: false,
  97. configurable: true
  98. });
  99. Object.defineProperty(Menu.prototype, "visibleStatus", {
  100. get: function() {
  101. return this.isVisible ? "show" : "hide";
  102. },
  103. enumerable: false,
  104. configurable: true
  105. });
  106. Object.defineProperty(Menu.prototype, "wrapper", {
  107. get: function() {
  108. return this.holder.querySelector(".menu-wrapper");
  109. },
  110. enumerable: false,
  111. configurable: true
  112. });
  113. Menu.prototype.getModel = function(key) {
  114. var model = null;
  115. this.columns.forEach(function(column) {
  116. column.container.models.forEach(function(_model) {
  117. if (!_model.options.size || !_model.options.get(key))
  118. return;
  119. model = _model.options.get(key);
  120. return;
  121. });
  122. column.container.models.get(key) && (model = column.container.models.get(key));
  123. });
  124. return model;
  125. };
  126. Menu.prototype.getModelActive = function(key) {
  127. var _a;
  128. return (_a = this.getModel(key)) === null || _a === void 0 ? void 0 : _a.isActive;
  129. };
  130. Menu.prototype.getModelValue = function(key) {
  131. var _a;
  132. return (_a = this.getModel(key)) === null || _a === void 0 ? void 0 : _a.value;
  133. };
  134. Menu.prototype.setModelActive = function(key, state) {
  135. var model = this.getModel(key);
  136. typeof(model === null || model === void 0 ? void 0 : model.isActive) !== 'undefined' && model.setActive(state);
  137. };
  138. Menu.prototype.setModelValue = function(key, value) {
  139. var model = this.getModel(key);
  140. typeof(model === null || model === void 0 ? void 0 : model.value) !== 'undefined' && model.setValue(value);
  141. };
  142. Menu.prototype.onModelsAction = function(callback) {
  143. this.modelsActionEvents.set(this.modelsActionEvents.size + 1, callback);
  144. };
  145. Menu.prototype.add = function() {
  146. var _this = this;
  147. var columns = [];
  148. for (var _i = 0; _i < arguments.length; _i++) {
  149. columns[_i] = arguments[_i];
  150. }
  151. if (!columns.length)
  152. return;
  153. for (var _a = 0, columns_1 = columns; _a < columns_1.length; _a++) {
  154. var column = columns_1[_a];
  155. column.id = this.columns.size + 1;
  156. column.build();
  157. column.setTo(column.width * (column.id - 1) + 10 * (column.id), column.y);
  158. this.wrapper.appendChild(column.element);
  159. this.columns.set(column.id, column);
  160. column.container.models.forEach(function(model) {
  161. model.on("click", function(state) {
  162. _this.modelsActionEvents.forEach(function(callback) {
  163. callback(model.key, state, "click", model);
  164. });
  165. });
  166. if (model.options.size) {
  167. model.options.forEach(function(option) {
  168. var _loop_1 = function(event_1) {
  169. if (option.events.has(event_1)) {
  170. option.on(event_1, function(value) {
  171. _this.modelsActionEvents.forEach(function(callback) {
  172. callback(option.key, value, event_1, option);
  173. });
  174. });
  175. }
  176. };
  177. for (var _i = 0, _a = ["click", "change", "input"]; _i < _a.length; _i++) {
  178. var event_1 = _a[_i];
  179. _loop_1(event_1);
  180. }
  181. });
  182. }
  183. return;
  184. });
  185. console.log("Menu \"".concat(column.header.text, "\" has been added"));
  186. }
  187. };
  188. Menu.prototype.destroy = function() {};
  189. Menu.prototype.show = function() {
  190. this.holder.style.display = this.showDisplay;
  191. };
  192. Menu.prototype.hide = function() {
  193. this.holder.style.display = "none";
  194. };
  195. Menu.prototype.toggle = function() {
  196. if (this.isVisible)
  197. return this.hide();
  198. this.show();
  199. };
  200. Menu.prototype.build = function() {
  201. this.holder.classList.add("menu-holder", "absolute", "wh-100", "no-pointer");
  202. this.holder.insertAdjacentHTML("beforeend", _layout_htmlLayout__WEBPACK_IMPORTED_MODULE_0__["default"]);
  203. this.initEvents();
  204. };
  205. Menu.prototype.initEvents = function() {
  206. var _this = this;
  207. var isPressed = false;
  208. var isMatchesToggleKey = function(event) {
  209. for (var _i = 0, _a = Object.entries(_this.toggleKey); _i < _a.length; _i++) {
  210. var entrie = _a[_i];
  211. if (event[entrie[0]] !== entrie[1])
  212. continue;
  213. return true;
  214. }
  215. return false;
  216. };
  217. window.addEventListener("keydown", function(event) {
  218. if (!isMatchesToggleKey(event) || isPressed)
  219. return;
  220. _this.toggle();
  221. isPressed = true;
  222. });
  223. window.addEventListener("keyup", function(event) {
  224. if (!isMatchesToggleKey(event))
  225. return;
  226. isPressed = false;
  227. });
  228. };
  229. Menu.prototype.append = function() {
  230. var _this = this;
  231. var appendNode = this.appendNode;
  232. if (typeof appendNode === 'string') {
  233. if (!/whenload/.test(appendNode))
  234. return;
  235. var constructType = /\(\w+\)/.exec(appendNode)[0].replace(/(\(|\))/g, "");
  236. var appendChild = appendNode.split(":")[1];
  237. switch (constructType) {
  238. case "Node": {
  239. appendNode = eval(appendChild);
  240. }
  241. break;
  242. case "Selector": {
  243. appendNode = document.querySelector(appendChild);
  244. }
  245. break;
  246. }
  247. return window.addEventListener("DOMContentLoaded", function() {
  248. return appendNode.appendChild(_this.holder);
  249. });
  250. }
  251. appendNode.appendChild(this.holder);
  252. this.build();
  253. };
  254. return Menu;
  255. }());
  256. /* harmony default export */
  257. __webpack_exports__["default"] = (Menu);
  258. /***/
  259. }),
  260. /***/
  261. "./src/menu/column/Column.ts":
  262. /*!***********************************!*\
  263. !*** ./src/menu/column/Column.ts ***!
  264. \***********************************/
  265. /***/
  266. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  267. __webpack_require__.r(__webpack_exports__);
  268. /* harmony import */
  269. var _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../configs/templates/columns */ "./src/configs/templates/columns.ts");
  270. /* harmony import */
  271. var _Container__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./Container */ "./src/menu/column/Container.ts");
  272. /* harmony import */
  273. var _DragSystem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./DragSystem */ "./src/menu/column/DragSystem.ts");
  274. /* harmony import */
  275. var _Header__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./Header */ "./src/menu/column/Header.ts");
  276. var __extends = (undefined && undefined.__extends) || (function() {
  277. var extendStatics = function(d, b) {
  278. extendStatics = Object.setPrototypeOf ||
  279. ({
  280. __proto__: []
  281. }
  282. instanceof Array && function(d, b) {
  283. d.__proto__ = b;
  284. }) ||
  285. function(d, b) {
  286. for (var p in b)
  287. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  288. };
  289. return extendStatics(d, b);
  290. };
  291. return function(d, b) {
  292. if (typeof b !== "function" && b !== null)
  293. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  294. extendStatics(d, b);
  295.  
  296. function __() {
  297. this.constructor = d;
  298. }
  299. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  300. };
  301. })();
  302.  
  303. function hexToRGBA(hex, alpha) {
  304. var r = parseInt(hex.slice(1, 3), 16);
  305. var g = parseInt(hex.slice(3, 5), 16);
  306. var b = parseInt(hex.slice(5, 7), 16);
  307. return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(alpha, ")");
  308. }
  309. var Column = /** @class */ (function(_super) {
  310. __extends(Column, _super);
  311.  
  312. function Column() {
  313. var _this = this;
  314. var element = document.createElement("div");
  315. var config = _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__["default"].column;
  316. var container = new _Container__WEBPACK_IMPORTED_MODULE_1__["default"](element, config.defaultX, config.defaultY, config.header.defaultWidth, "auto");
  317. var header = new _Header__WEBPACK_IMPORTED_MODULE_3__["default"](element, config.defaultX, config.defaultY, config.header.defaultWidth, config.header.defaultHeight, container);
  318. _this = _super.call(this, header.element, element, config.defaultX, config.defaultY, config.defaultWidth, config.defaultHeight, header.width, header.height) || this;
  319. _this.id = NaN;
  320. _this.element = element;
  321. _this.config = config;
  322. _this.header = header;
  323. _this.container = container;
  324. return _this;
  325. }
  326. Column.prototype.setMaxHeight = function(maxHeight) {
  327. this.container.maxHeight = Math.abs(maxHeight - this.header.height);
  328. this.container.updateStyles();
  329. this.updateStyles();
  330. return this;
  331. };
  332. Column.prototype.setSize = function(width, height) {
  333. this.width = width;
  334. this.height = height;
  335. this.updateStyles();
  336. return this;
  337. };
  338. Column.prototype.setHeaderShadowActive = function(state) {
  339. this.header.isShadowActive = state;
  340. return this;
  341. };
  342. Column.prototype.setHeaderIconURL = function(iconURL) {
  343. this.header.iconURL = iconURL;
  344. return this;
  345. };
  346. Column.prototype.setHeaderSize = function(width, height) {
  347. this.header.width = width;
  348. this.header.height = height;
  349. this.header.updateStyles();
  350. return this;
  351. };
  352. Column.prototype.setHeaderText = function(value) {
  353. this.header.text = value === null || value === void 0 ? void 0 : value.toString();
  354. this.header.updateStyles();
  355. return this;
  356. };
  357. Column.prototype.setHeaderBgColor = function(hex) {
  358. this.header.bgColor = hexToRGBA(hex === null || hex === void 0 ? void 0 : hex.toString(), 1);
  359. this.header.updateStyles();
  360. return this;
  361. };
  362. Column.prototype.setHeaderTextColor = function(hex) {
  363. this.header.textColor = hexToRGBA(hex === null || hex === void 0 ? void 0 : hex.toString(), 1);
  364. this.header.updateStyles();
  365. return this;
  366. };
  367. Column.prototype.setContainerBgColor = function(hex) {
  368. this.container.bgColor = hexToRGBA(hex === null || hex === void 0 ? void 0 : hex.toString(), 1);
  369. this.container.updateStyles();
  370. return this;
  371. };
  372. Column.prototype.setContainerTextColor = function(hex) {
  373. this.container.textColor = hexToRGBA(hex === null || hex === void 0 ? void 0 : hex.toString(), 1);
  374. this.container.updateStyles();
  375. return this;
  376. };
  377. Column.prototype.updateStyles = function() {
  378. this.element.style.width = "".concat(this.width, "px");
  379. this.element.style.height = "".concat(this.height, "px");
  380. this.element.style.maxHeight = "".concat(this.maxHeight, "px");
  381. };
  382. Column.prototype.add = function(uiModel) {
  383. return this.container.add(uiModel);
  384. };
  385. Column.prototype.build = function() {
  386. this.element.classList.add("menu-column", "absolute", "flex", "fcolumn");
  387. this.element.oncontextmenu = function() {
  388. return false;
  389. };
  390. this.updateStyles();
  391. this.header.build();
  392. this.container.build();
  393. this.setMaxHeight(this.height);
  394. this._initEvents();
  395. };
  396. return Column;
  397. }(_DragSystem__WEBPACK_IMPORTED_MODULE_2__["default"]));
  398. /* harmony default export */
  399. __webpack_exports__["default"] = (Column);
  400. /***/
  401. }),
  402. /***/
  403. "./src/menu/column/Container.ts":
  404. /*!**************************************!*\
  405. !*** ./src/menu/column/Container.ts ***!
  406. \**************************************/
  407. /***/
  408. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  409. __webpack_require__.r(__webpack_exports__);
  410. /* harmony import */
  411. var _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../configs/templates/columns */ "./src/configs/templates/columns.ts");
  412. /* harmony import */
  413. var _StyleSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./StyleSystem */ "./src/menu/column/StyleSystem.ts");
  414. var __extends = (undefined && undefined.__extends) || (function() {
  415. var extendStatics = function(d, b) {
  416. extendStatics = Object.setPrototypeOf ||
  417. ({
  418. __proto__: []
  419. }
  420. instanceof Array && function(d, b) {
  421. d.__proto__ = b;
  422. }) ||
  423. function(d, b) {
  424. for (var p in b)
  425. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  426. };
  427. return extendStatics(d, b);
  428. };
  429. return function(d, b) {
  430. if (typeof b !== "function" && b !== null)
  431. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  432. extendStatics(d, b);
  433.  
  434. function __() {
  435. this.constructor = d;
  436. }
  437. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  438. };
  439. })();
  440. var Container = /** @class */ (function(_super) {
  441. __extends(Container, _super);
  442.  
  443. function Container(parent, x, y, width, height) {
  444. var _this = this;
  445. var element = document.createElement("container");
  446. var config = _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__["default"].column;
  447. _this = _super.call(this, element, config.container.colors) || this;
  448. _this.parent = parent;
  449. _this.x = x;
  450. _this.y = y;
  451. _this.width = width;
  452. _this.height = height;
  453. _this.parent = parent;
  454. _this.x = x;
  455. _this.y = y;
  456. _this.width = width;
  457. _this.height = height;
  458. _this.element = element;
  459. _this.config = config;
  460. _this.maxHeight = 0;
  461. _this.models = new Map();
  462. return _this;
  463. }
  464. Object.defineProperty(Container.prototype, "isVisible", {
  465. get: function() {
  466. return this.element.style.display === this.config.container.showDisplay;
  467. },
  468. enumerable: false,
  469. configurable: true
  470. });
  471. Object.defineProperty(Container.prototype, "visibleStatus", {
  472. get: function() {
  473. return this.isVisible ? "show" : "hide";
  474. },
  475. enumerable: false,
  476. configurable: true
  477. });
  478. Container.prototype.show = function() {
  479. this.element.style.display = this.config.container.showDisplay;
  480. };
  481. Container.prototype.hide = function() {
  482. this.element.style.display = "none";
  483. };
  484. Container.prototype.toggle = function() {
  485. if (this.isVisible)
  486. return this.hide();
  487. this.show();
  488. };
  489. Container.prototype.add = function(uiModel) {
  490. if (!uiModel.key)
  491. return;
  492. uiModel.setParent(this.element);
  493. return this.models.set(uiModel.key, uiModel).get(uiModel.key);
  494. };
  495. Container.prototype.updateStyles = function() {
  496. var _this = this;
  497. this._updateStyles(this.width, this.height);
  498. this.element.style.maxHeight = "".concat(this.maxHeight, "px");
  499. this.models.forEach(function(model) {
  500. model.bgColor = _this.bgColor;
  501. model.textColor = _this.textColor;
  502. model._updateStyles("intial", "auto");
  503. if (model.options.size) {
  504. model.optionsContainer.bgColor = _this.bgColor;
  505. model.optionsContainer.textColor = _this.textColor;
  506. model.optionsContainer.updateStyles();
  507. }
  508. });
  509. };
  510. Container.prototype.build = function() {
  511. this.element.classList.add("column-container", "flex", "fcolumn", "all-pointer");
  512. this.parent.appendChild(this.element);
  513. this.models.forEach(function(model) {
  514. model.build();
  515. });
  516. this.hide();
  517. this.updateStyles();
  518. };
  519. return Container;
  520. }(_StyleSystem__WEBPACK_IMPORTED_MODULE_1__["default"]));
  521. /* harmony default export */
  522. __webpack_exports__["default"] = (Container);
  523. /***/
  524. }),
  525. /***/
  526. "./src/menu/column/DragSystem.ts":
  527. /*!***************************************!*\
  528. !*** ./src/menu/column/DragSystem.ts ***!
  529. \***************************************/
  530. /***/
  531. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  532. __webpack_require__.r(__webpack_exports__);
  533. /* harmony import */
  534. var _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../configs/templates/columns */ "./src/configs/templates/columns.ts");
  535. var DragSystem = /** @class */ (function() {
  536. function DragSystem(targetNode, node, x, y, width, height, collisionWidth, collisionHeight) {
  537. this.targetNode = targetNode;
  538. this.node = node;
  539. this.x = x;
  540. this.y = y;
  541. this.width = width;
  542. this.height = height;
  543. this.collisionWidth = collisionWidth;
  544. this.collisionHeight = collisionHeight;
  545. this.targetNode = targetNode;
  546. this.node = node;
  547. this.x = x;
  548. this.y = y;
  549. this.width = width;
  550. this.height = height;
  551. this.collisionWidth = collisionWidth;
  552. this.collisionHeight = collisionHeight;
  553. this._config = _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__["default"].column;
  554. this.isDragging = false;
  555. this.setTo(this.x, this.y);
  556. }
  557. DragSystem.prototype.fixXY = function() {
  558. this.x <= 0 && (this.x = 0);
  559. this.y <= 0 && (this.y = 0);
  560. this.x + this.collisionWidth >= window.innerWidth && (this.x = window.innerWidth - this.collisionWidth);
  561. this.y + this.collisionHeight >= window.innerHeight && (this.y = window.innerHeight - this.collisionHeight);
  562. };
  563. DragSystem.prototype.setTo = function(x, y, checkCollision) {
  564. typeof checkCollision === 'undefined' && (checkCollision = true);
  565. this.x = x;
  566. this.y = y;
  567. checkCollision && this.fixXY();
  568. this.node.style.left = "".concat(this.x, "px");
  569. this.node.style.top = "".concat(this.y, "px");
  570. };
  571. DragSystem.prototype._initEvents = function() {
  572. var _this = this;
  573. var mousePressed = false;
  574. this.targetNode.addEventListener("mousedown", function(event) {
  575. if (mousePressed || event.button !== _this._config.dragMouseKey)
  576. return;
  577. _this.isDragging = true;
  578. mousePressed = true;
  579. });
  580. window.addEventListener("mouseup", function(event) {
  581. if (event.button !== _this._config.dragMouseKey)
  582. return;
  583. _this.isDragging = false;
  584. mousePressed = false;
  585. });
  586. window.addEventListener("mousemove", function(event) {
  587. if (!_this.isDragging)
  588. return;
  589. var x = event.clientX - parseInt(_this.targetNode.style.width) / 2;
  590. var y = event.clientY - parseInt(_this.targetNode.style.height) / 2;
  591. _this.setTo(x, y);
  592. });
  593. window.addEventListener("resize", function() {
  594. _this.setTo(_this.x, _this.y);
  595. });
  596. };
  597. return DragSystem;
  598. }());
  599. /* harmony default export */
  600. __webpack_exports__["default"] = (DragSystem);
  601. /***/
  602. }),
  603. /***/
  604. "./src/menu/column/Header.ts":
  605. /*!***********************************!*\
  606. !*** ./src/menu/column/Header.ts ***!
  607. \***********************************/
  608. /***/
  609. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  610. __webpack_require__.r(__webpack_exports__);
  611. /* harmony import */
  612. var _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../configs/templates/columns */ "./src/configs/templates/columns.ts");
  613. /* harmony import */
  614. var _StyleSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./StyleSystem */ "./src/menu/column/StyleSystem.ts");
  615. var __extends = (undefined && undefined.__extends) || (function() {
  616. var extendStatics = function(d, b) {
  617. extendStatics = Object.setPrototypeOf ||
  618. ({
  619. __proto__: []
  620. }
  621. instanceof Array && function(d, b) {
  622. d.__proto__ = b;
  623. }) ||
  624. function(d, b) {
  625. for (var p in b)
  626. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  627. };
  628. return extendStatics(d, b);
  629. };
  630. return function(d, b) {
  631. if (typeof b !== "function" && b !== null)
  632. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  633. extendStatics(d, b);
  634.  
  635. function __() {
  636. this.constructor = d;
  637. }
  638. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  639. };
  640. })();
  641. var Header = /** @class */ (function(_super) {
  642. __extends(Header, _super);
  643.  
  644. function Header(parent, x, y, width, height, targetContainer) {
  645. var _this = this;
  646. var element = document.createElement("header");
  647. var config = _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__["default"].column;
  648. _this = _super.call(this, element, config.header.colors) || this;
  649. _this.parent = parent;
  650. _this.x = x;
  651. _this.y = y;
  652. _this.width = width;
  653. _this.height = height;
  654. _this.targetContainer = targetContainer;
  655. _this.parent = parent;
  656. _this.x = x;
  657. _this.y = y;
  658. _this.width = width;
  659. _this.height = height;
  660. _this.targetContainer = targetContainer;
  661. _this.element = element;
  662. _this.config = config;
  663. _this.text = "ColumnMenu";
  664. _this.iconURL = "";
  665. return _this;
  666. }
  667. Object.defineProperty(Header.prototype, "textElement", {
  668. get: function() {
  669. return this.element.querySelector(".header-text");
  670. },
  671. enumerable: false,
  672. configurable: true
  673. });
  674. Object.defineProperty(Header.prototype, "iconElement", {
  675. get: function() {
  676. return this.element.querySelector(".header-icon");
  677. },
  678. enumerable: false,
  679. configurable: true
  680. });
  681. Object.defineProperty(Header.prototype, "html", {
  682. get: function() {
  683. return "\n ".concat(/^https?\:\/{2}/.test(this.iconURL) ? "<img class=\"header-icon\" src=\"".concat(this.iconURL, "\">") : "", "\n <span class=\"header-text\">").concat(this.text, "</span>\n ");
  684. },
  685. enumerable: false,
  686. configurable: true
  687. });
  688. Header.prototype.updateStyles = function() {
  689. this._updateStyles(this.width, this.height);
  690. if (this.iconElement instanceof HTMLImageElement) {
  691. this.iconElement.src !== this.iconURL && (this.iconElement.src = this.iconURL);
  692. }
  693. if (this.textElement instanceof HTMLSpanElement) {
  694. this.textElement.innerText = this.text;
  695. }
  696. };
  697. Header.prototype.initEvents = function() {
  698. var _this = this;
  699. var mousePressed = false;
  700. this.element.addEventListener("mousedown", function(event) {
  701. if (mousePressed || event.button !== _this.config.header.openMouseKey)
  702. return;
  703. _this.targetContainer.toggle();
  704. mousePressed = true;
  705. });
  706. window.addEventListener("mouseup", function(event) {
  707. if (event.button !== _this.config.header.openMouseKey)
  708. return;
  709. mousePressed = false;
  710. });
  711. };
  712. Header.prototype.build = function() {
  713. this.element.classList.add("column-header", "flex", "fcenter", "all-pointer");
  714. this.parent.appendChild(this.element);
  715. this.element.insertAdjacentHTML("beforeend", this.html);
  716. this.updateStyles();
  717. this.initEvents();
  718. };
  719. return Header;
  720. }(_StyleSystem__WEBPACK_IMPORTED_MODULE_1__["default"]));
  721. /* harmony default export */
  722. __webpack_exports__["default"] = (Header);
  723. /***/
  724. }),
  725. /***/
  726. "./src/menu/column/StyleSystem.ts":
  727. /*!****************************************!*\
  728. !*** ./src/menu/column/StyleSystem.ts ***!
  729. \****************************************/
  730. /***/
  731. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  732. __webpack_require__.r(__webpack_exports__);
  733. var StyleSystem = /** @class */ (function() {
  734. function StyleSystem(node, colors) {
  735. this.node = node;
  736. this.colors = colors;
  737. this.node = node;
  738. this.colors = colors;
  739. this.bgColor = this.colors.main;
  740. this.textColor = this.colors.text;
  741. this.isShadowActive = false;
  742. }
  743. Object.defineProperty(StyleSystem.prototype, "alphaReg", {
  744. get: function() {
  745. return /\,\s?\d(\.\d+)?\)/gm;
  746. },
  747. enumerable: false,
  748. configurable: true
  749. });
  750. Object.defineProperty(StyleSystem.prototype, "onlyRGBReg", {
  751. get: function() {
  752. return /(?!\d+\)$)\d+/ig;
  753. },
  754. enumerable: false,
  755. configurable: true
  756. });
  757. StyleSystem.prototype.getBorderColor = function() {
  758. return this.bgColor.replace(this.alphaReg, ",1)").replace(this.onlyRGBReg, function(value) {
  759. var offset = 1;
  760. return value >> offset <= 255 && value >> offset >= 0 ? value >> offset : value;
  761. });
  762. };
  763. StyleSystem.prototype.getBackgroundColor = function() {
  764. return this.bgColor.replace(this.alphaReg, ",0.7)");
  765. };
  766. StyleSystem.prototype._updateStyles = function(width, height) {
  767. var backgroundColor = this.getBackgroundColor();
  768. var borderColor = this.getBorderColor();
  769. this.node.style.width = typeof width === 'number' ? "".concat(width, "px") : width;
  770. this.node.style.height = typeof height === 'number' ? "".concat(height, "px") : height;
  771. this.node.style.backgroundColor = backgroundColor;
  772. this.node.style.borderColor = borderColor;
  773. this.node.style.boxShadow = this.isShadowActive ? "inset 0px 0px 6px 2px ".concat(borderColor) : "";
  774. this.node.style.color = this.textColor;
  775. };
  776. return StyleSystem;
  777. }());
  778. /* harmony default export */
  779. __webpack_exports__["default"] = (StyleSystem);
  780. /***/
  781. }),
  782. /***/
  783. "./src/menu/column/models/Checkbox.ts":
  784. /*!********************************************!*\
  785. !*** ./src/menu/column/models/Checkbox.ts ***!
  786. \********************************************/
  787. /***/
  788. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  789. __webpack_require__.r(__webpack_exports__);
  790. /* harmony import */
  791. var _UIModel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./UIModel */ "./src/menu/column/models/UIModel.ts");
  792. var __extends = (undefined && undefined.__extends) || (function() {
  793. var extendStatics = function(d, b) {
  794. extendStatics = Object.setPrototypeOf ||
  795. ({
  796. __proto__: []
  797. }
  798. instanceof Array && function(d, b) {
  799. d.__proto__ = b;
  800. }) ||
  801. function(d, b) {
  802. for (var p in b)
  803. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  804. };
  805. return extendStatics(d, b);
  806. };
  807. return function(d, b) {
  808. if (typeof b !== "function" && b !== null)
  809. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  810. extendStatics(d, b);
  811.  
  812. function __() {
  813. this.constructor = d;
  814. }
  815. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  816. };
  817. })();
  818. var Checkbox = /** @class */ (function(_super) {
  819. __extends(Checkbox, _super);
  820.  
  821. function Checkbox(_a) {
  822. var key = _a.key,
  823. name = _a.name,
  824. description = _a.description,
  825. _b = _a.options,
  826. options = _b === void 0 ? [] : _b,
  827. _c = _a.isActive,
  828. isActive = _c === void 0 ? false : _c,
  829. _d = _a.isDisabled,
  830. isDisabled = _d === void 0 ? false : _d;
  831. var _this = this;
  832. var element = document.createElement("box");
  833. _this = _super.call(this, {
  834. key: key,
  835. name: name,
  836. description: description,
  837. options: options,
  838. node: element
  839. }) || this;
  840. _this.isActive = isActive;
  841. _this.isDisabled = isDisabled;
  842. _this.element = element;
  843. _this.events = new Map([
  844. ["click", new Map()]
  845. ]);
  846. return _this;
  847. }
  848. Object.defineProperty(Checkbox.prototype, "html", {
  849. get: function() {
  850. return "\n <span class=\"ui-model-text\">".concat(this.name, "</span>\n ");
  851. },
  852. enumerable: false,
  853. configurable: true
  854. });
  855. Checkbox.prototype.on = function(event, callback) {
  856. var eventMap = this.events.get(event);
  857. eventMap.set(eventMap.size + 1, callback);
  858. };
  859. Checkbox.prototype.setActive = function(activeState) {
  860. this.isActive = activeState;
  861. this.updateClasses();
  862. };
  863. Checkbox.prototype.setDisabled = function(activeState) {
  864. this.isDisabled = activeState;
  865. this.updateClasses();
  866. };
  867. Checkbox.prototype.toggle = function() {
  868. var _this = this;
  869. this.setActive(!this.isActive);
  870. var eventMap = this.events.get("click");
  871. eventMap.forEach(function(callback) {
  872. callback(_this.isActive, _this.element);
  873. });
  874. return this.isActive;
  875. };
  876. Checkbox.prototype.initEvents = function() {
  877. var _this = this;
  878. var mousePressed = false;
  879. this.element.addEventListener("mousedown", function(event) {
  880. if (mousePressed)
  881. return;
  882. if (event.button === _this.config.checkbox.toggleKey && !_this.isDisabled) {
  883. _this.toggle();
  884. }
  885. if (event.button === _this.config.checkbox.openOptionsKey) {
  886. _this.toggleOptions();
  887. }
  888. mousePressed = true;
  889. });
  890. window.addEventListener("mouseup", function(event) {
  891. if (event.button !== _this.config.checkbox.toggleKey &&
  892. event.button !== _this.config.checkbox.openOptionsKey)
  893. return;
  894. mousePressed = false;
  895. });
  896. };
  897. Checkbox.prototype.updateClasses = function() {
  898. var activeClass = function(isActive) {
  899. return isActive ? "active" : "inactive";
  900. };
  901. this.element.classList.remove(activeClass(!this.isActive));
  902. this.element.classList.add(activeClass(this.isActive));
  903. if (this.isDisabled) {
  904. this.element.classList.add("disabled");
  905. } else {
  906. this.element.classList.remove("disabled");
  907. }
  908. this.options.size && this.element.classList.add("has-options");
  909. };
  910. Checkbox.prototype.build = function() {
  911. this.element.classList.add("ui-model", "checkbox-model");
  912. this.updateClasses();
  913. this.parent.appendChild(this.element);
  914. this.element.insertAdjacentHTML("beforeend", this.html);
  915. this.initOptions();
  916. this.initEvents();
  917. this.element.title = "".concat(this.description);
  918. };
  919. return Checkbox;
  920. }(_UIModel__WEBPACK_IMPORTED_MODULE_0__["default"]));
  921. /* harmony default export */
  922. __webpack_exports__["default"] = (Checkbox);
  923. /***/
  924. }),
  925. /***/
  926. "./src/menu/column/models/UIModel.ts":
  927. /*!*******************************************!*\
  928. !*** ./src/menu/column/models/UIModel.ts ***!
  929. \*******************************************/
  930. /***/
  931. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  932. __webpack_require__.r(__webpack_exports__);
  933. /* harmony import */
  934. var _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../configs/templates/columns */ "./src/configs/templates/columns.ts");
  935. /* harmony import */
  936. var _StyleSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../StyleSystem */ "./src/menu/column/StyleSystem.ts");
  937. /* harmony import */
  938. var _option_OptionsContainer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./option/OptionsContainer */ "./src/menu/column/models/option/OptionsContainer.ts");
  939. var __extends = (undefined && undefined.__extends) || (function() {
  940. var extendStatics = function(d, b) {
  941. extendStatics = Object.setPrototypeOf ||
  942. ({
  943. __proto__: []
  944. }
  945. instanceof Array && function(d, b) {
  946. d.__proto__ = b;
  947. }) ||
  948. function(d, b) {
  949. for (var p in b)
  950. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  951. };
  952. return extendStatics(d, b);
  953. };
  954. return function(d, b) {
  955. if (typeof b !== "function" && b !== null)
  956. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  957. extendStatics(d, b);
  958.  
  959. function __() {
  960. this.constructor = d;
  961. }
  962. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  963. };
  964. })();
  965. var UIModel = /** @class */ (function(_super) {
  966. __extends(UIModel, _super);
  967.  
  968. function UIModel(_a) {
  969. var key = _a.key,
  970. name = _a.name,
  971. description = _a.description,
  972. options = _a.options,
  973. node = _a.node;
  974. var _this = this;
  975. var config = _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__["default"].column;
  976. _this = _super.call(this, node, config.container.colors) || this;
  977. _this.key = key;
  978. _this.name = name;
  979. _this.description = description;
  980. _this.options = new Map(options.map(function(option) {
  981. return [option.key, option];
  982. }));
  983. _this.config = config;
  984. _this.parent = null;
  985. return _this;
  986. }
  987. UIModel.prototype.setParent = function(parentElement) {
  988. this.parent = parentElement;
  989. };
  990. UIModel.prototype.showOptions = function() {
  991. this.optionsContainer.show();
  992. };
  993. UIModel.prototype.hideOptions = function() {
  994. this.optionsContainer.hide();
  995. };
  996. UIModel.prototype.toggleOptions = function() {
  997. if (!this.node.classList.contains("has-options"))
  998. return;
  999. if (this.node.classList.contains("show-options")) {
  1000. this.node.classList.remove("show-options");
  1001. return this.hideOptions();
  1002. }
  1003. this.node.classList.add("show-options");
  1004. this.showOptions();
  1005. };
  1006. UIModel.prototype.initOptions = function() {
  1007. var _this = this;
  1008. this._updateStyles("initial", "auto");
  1009. if (this.options.size) {
  1010. this.optionsContainer = new _option_OptionsContainer__WEBPACK_IMPORTED_MODULE_2__["default"](this.node, this.key);
  1011. }
  1012. this.options.forEach(function(option) {
  1013. _this.optionsContainer.add(option);
  1014. });
  1015. if (this.options.size) {
  1016. this.optionsContainer.build();
  1017. }
  1018. };
  1019. return UIModel;
  1020. }(_StyleSystem__WEBPACK_IMPORTED_MODULE_1__["default"]));
  1021. /* harmony default export */
  1022. __webpack_exports__["default"] = (UIModel);
  1023. /***/
  1024. }),
  1025. /***/
  1026. "./src/menu/column/models/option/Option.ts":
  1027. /*!*************************************************!*\
  1028. !*** ./src/menu/column/models/option/Option.ts ***!
  1029. \*************************************************/
  1030. /***/
  1031. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1032. __webpack_require__.r(__webpack_exports__);
  1033. /* harmony import */
  1034. var _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../configs/templates/columns */ "./src/configs/templates/columns.ts");
  1035. /* harmony import */
  1036. var _StyleSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../../StyleSystem */ "./src/menu/column/StyleSystem.ts");
  1037. var __extends = (undefined && undefined.__extends) || (function() {
  1038. var extendStatics = function(d, b) {
  1039. extendStatics = Object.setPrototypeOf ||
  1040. ({
  1041. __proto__: []
  1042. }
  1043. instanceof Array && function(d, b) {
  1044. d.__proto__ = b;
  1045. }) ||
  1046. function(d, b) {
  1047. for (var p in b)
  1048. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  1049. };
  1050. return extendStatics(d, b);
  1051. };
  1052. return function(d, b) {
  1053. if (typeof b !== "function" && b !== null)
  1054. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  1055. extendStatics(d, b);
  1056.  
  1057. function __() {
  1058. this.constructor = d;
  1059. }
  1060. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1061. };
  1062. })();
  1063. var Option = /** @class */ (function(_super) {
  1064. __extends(Option, _super);
  1065.  
  1066. function Option(_a) {
  1067. var key = _a.key,
  1068. name = _a.name,
  1069. description = _a.description,
  1070. node = _a.node;
  1071. var _this = this;
  1072. var config = _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__["default"].column;
  1073. _this = _super.call(this, node, config.container.colors) || this;
  1074. _this.key = key;
  1075. _this.name = name;
  1076. _this.description = description;
  1077. _this.config = config;
  1078. _this.parent = null;
  1079. return _this;
  1080. }
  1081. Option.prototype.setParent = function(parentElement) {
  1082. this.parent = parentElement;
  1083. };
  1084. return Option;
  1085. }(_StyleSystem__WEBPACK_IMPORTED_MODULE_1__["default"]));
  1086. /* harmony default export */
  1087. __webpack_exports__["default"] = (Option);
  1088. /***/
  1089. }),
  1090. /***/
  1091. "./src/menu/column/models/option/OptionCheckbox.ts":
  1092. /*!*********************************************************!*\
  1093. !*** ./src/menu/column/models/option/OptionCheckbox.ts ***!
  1094. \*********************************************************/
  1095. /***/
  1096. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1097. __webpack_require__.r(__webpack_exports__);
  1098. /* harmony import */
  1099. var _Option__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Option */ "./src/menu/column/models/option/Option.ts");
  1100. var __extends = (undefined && undefined.__extends) || (function() {
  1101. var extendStatics = function(d, b) {
  1102. extendStatics = Object.setPrototypeOf ||
  1103. ({
  1104. __proto__: []
  1105. }
  1106. instanceof Array && function(d, b) {
  1107. d.__proto__ = b;
  1108. }) ||
  1109. function(d, b) {
  1110. for (var p in b)
  1111. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  1112. };
  1113. return extendStatics(d, b);
  1114. };
  1115. return function(d, b) {
  1116. if (typeof b !== "function" && b !== null)
  1117. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  1118. extendStatics(d, b);
  1119.  
  1120. function __() {
  1121. this.constructor = d;
  1122. }
  1123. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1124. };
  1125. })();
  1126. var OptionCheckbox = /** @class */ (function(_super) {
  1127. __extends(OptionCheckbox, _super);
  1128.  
  1129. function OptionCheckbox(_a) {
  1130. var key = _a.key,
  1131. name = _a.name,
  1132. description = _a.description,
  1133. _b = _a.isActive,
  1134. isActive = _b === void 0 ? false : _b,
  1135. _c = _a.isDisabled,
  1136. isDisabled = _c === void 0 ? false : _c;
  1137. var _this = this;
  1138. var element = document.createElement("box");
  1139. _this = _super.call(this, {
  1140. key: key,
  1141. name: name,
  1142. description: description,
  1143. node: element
  1144. }) || this;
  1145. _this.isActive = isActive;
  1146. _this.isDisabled = isDisabled;
  1147. _this.element = element;
  1148. _this.events = new Map([
  1149. ["click", new Map()]
  1150. ]);
  1151. return _this;
  1152. }
  1153. Object.defineProperty(OptionCheckbox.prototype, "html", {
  1154. get: function() {
  1155. return "\n <span class=\"ui-option-text\">".concat(this.name, "</span>\n ");
  1156. },
  1157. enumerable: false,
  1158. configurable: true
  1159. });
  1160. OptionCheckbox.prototype.on = function(event, callback) {
  1161. var eventMap = this.events.get(event);
  1162. eventMap.set(eventMap.size + 1, callback);
  1163. };
  1164. OptionCheckbox.prototype.setActive = function(activeState) {
  1165. this.isActive = activeState;
  1166. this.updateClasses();
  1167. };
  1168. OptionCheckbox.prototype.setDisabled = function(activeState) {
  1169. this.isDisabled = activeState;
  1170. this.updateClasses();
  1171. };
  1172. OptionCheckbox.prototype.toggle = function() {
  1173. var _this = this;
  1174. this.setActive(!this.isActive);
  1175. var eventMap = this.events.get("click");
  1176. eventMap.forEach(function(callback) {
  1177. callback(_this.isActive, _this.element);
  1178. });
  1179. return this.isActive;
  1180. };
  1181. OptionCheckbox.prototype.initEvents = function() {
  1182. var _this = this;
  1183. var mousePressed = false;
  1184. this.element.addEventListener("mousedown", function(event) {
  1185. if (mousePressed)
  1186. return;
  1187. if (event.button === _this.config.checkbox.toggleKey && !_this.isDisabled) {
  1188. _this.toggle();
  1189. }
  1190. mousePressed = true;
  1191. });
  1192. window.addEventListener("mouseup", function(event) {
  1193. if (event.button !== _this.config.checkbox.toggleKey &&
  1194. event.button !== _this.config.checkbox.openOptionsKey)
  1195. return;
  1196. mousePressed = false;
  1197. });
  1198. };
  1199. OptionCheckbox.prototype.updateClasses = function() {
  1200. var activeClass = function(isActive) {
  1201. return isActive ? "active" : "inactive";
  1202. };
  1203. this.element.classList.remove(activeClass(!this.isActive));
  1204. this.element.classList.add(activeClass(this.isActive));
  1205. if (this.isDisabled) {
  1206. this.element.classList.add("disabled");
  1207. } else {
  1208. this.element.classList.remove("disabled");
  1209. }
  1210. };
  1211. OptionCheckbox.prototype.build = function() {
  1212. this.element.classList.add("ui-model", "checkbox-model");
  1213. this.updateClasses();
  1214. this.parent.appendChild(this.element);
  1215. this.element.insertAdjacentHTML("beforeend", this.html);
  1216. this.initEvents();
  1217. this.element.title = "".concat(this.description);
  1218. };
  1219. return OptionCheckbox;
  1220. }(_Option__WEBPACK_IMPORTED_MODULE_0__["default"]));
  1221. /* harmony default export */
  1222. __webpack_exports__["default"] = (OptionCheckbox);
  1223. /***/
  1224. }),
  1225. /***/
  1226. "./src/menu/column/models/option/OptionIColor.ts":
  1227. /*!*******************************************************!*\
  1228. !*** ./src/menu/column/models/option/OptionIColor.ts ***!
  1229. \*******************************************************/
  1230. /***/
  1231. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1232. __webpack_require__.r(__webpack_exports__);
  1233. /* harmony import */
  1234. var _Option__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Option */ "./src/menu/column/models/option/Option.ts");
  1235. var __extends = (undefined && undefined.__extends) || (function() {
  1236. var extendStatics = function(d, b) {
  1237. extendStatics = Object.setPrototypeOf ||
  1238. ({
  1239. __proto__: []
  1240. }
  1241. instanceof Array && function(d, b) {
  1242. d.__proto__ = b;
  1243. }) ||
  1244. function(d, b) {
  1245. for (var p in b)
  1246. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  1247. };
  1248. return extendStatics(d, b);
  1249. };
  1250. return function(d, b) {
  1251. if (typeof b !== "function" && b !== null)
  1252. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  1253. extendStatics(d, b);
  1254.  
  1255. function __() {
  1256. this.constructor = d;
  1257. }
  1258. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1259. };
  1260. })();
  1261. var OptionIColor = /** @class */ (function(_super) {
  1262. __extends(OptionIColor, _super);
  1263.  
  1264. function OptionIColor(_a) {
  1265. var key = _a.key,
  1266. name = _a.name,
  1267. description = _a.description,
  1268. _b = _a.value,
  1269. value = _b === void 0 ? "" : _b,
  1270. _c = _a.isDisabled,
  1271. isDisabled = _c === void 0 ? false : _c;
  1272. var _this = this;
  1273. var element = document.createElement("box");
  1274. element.setAttribute("data-name", name);
  1275. _this = _super.call(this, {
  1276. key: key,
  1277. name: name,
  1278. description: description,
  1279. node: element
  1280. }) || this;
  1281. _this.value = value;
  1282. _this.isDisabled = isDisabled;
  1283. _this.element = element;
  1284. _this.inputElement = null;
  1285. _this.events = new Map([
  1286. ["change", new Map()],
  1287. ["input", new Map()]
  1288. ]);
  1289. return _this;
  1290. }
  1291. Object.defineProperty(OptionIColor.prototype, "html", {
  1292. get: function() {
  1293. return "\n <input type=\"color\" class=\"ui-option-input-color\">\n ";
  1294. },
  1295. enumerable: false,
  1296. configurable: true
  1297. });
  1298. OptionIColor.prototype.on = function(event, callback) {
  1299. var eventMap = this.events.get(event);
  1300. eventMap.set(eventMap.size + 1, callback);
  1301. };
  1302. OptionIColor.prototype.setValue = function(value) {
  1303. this.value = value;
  1304. this.inputElement.value = this.value;
  1305. };
  1306. OptionIColor.prototype.setDisabled = function(activeState) {
  1307. this.isDisabled = activeState;
  1308. this.updateClasses();
  1309. };
  1310. OptionIColor.prototype.onChange = function(event) {
  1311. var _this = this;
  1312. this.setValue(this.inputElement.value);
  1313. var eventMap = this.events.get("change");
  1314. eventMap.forEach(function(callback) {
  1315. callback(_this.value, event, _this.inputElement);
  1316. });
  1317. return this.value;
  1318. };
  1319. OptionIColor.prototype.onInput = function(event) {
  1320. this.onChange(event);
  1321. };
  1322. OptionIColor.prototype.initEvents = function() {
  1323. this.inputElement.addEventListener("change", this.onInput.bind(this));
  1324. this.inputElement.addEventListener("focus", this.onInput.bind(this));
  1325. this.inputElement.addEventListener("input", this.onInput.bind(this));
  1326. };
  1327. OptionIColor.prototype.updateClasses = function() {
  1328. if (this.isDisabled) {
  1329. this.element.classList.add("disabled");
  1330. this.inputElement.disabled = true;
  1331. } else {
  1332. this.element.classList.remove("disabled");
  1333. this.inputElement.disabled = false;
  1334. }
  1335. };
  1336. OptionIColor.prototype.build = function() {
  1337. this.element.classList.add("ui-model", "input-color-model", "inactive");
  1338. this.parent.appendChild(this.element);
  1339. this.element.insertAdjacentHTML("beforeend", this.html);
  1340. this.inputElement = this.element.querySelector("input");
  1341. this.setValue(this.value);
  1342. this.updateClasses();
  1343. this.initEvents();
  1344. this.element.title = "".concat(this.description);
  1345. };
  1346. return OptionIColor;
  1347. }(_Option__WEBPACK_IMPORTED_MODULE_0__["default"]));
  1348. /* harmony default export */
  1349. __webpack_exports__["default"] = (OptionIColor);
  1350. /***/
  1351. }),
  1352. /***/
  1353. "./src/menu/column/models/option/OptionIRange.ts":
  1354. /*!*******************************************************!*\
  1355. !*** ./src/menu/column/models/option/OptionIRange.ts ***!
  1356. \*******************************************************/
  1357. /***/
  1358. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1359. __webpack_require__.r(__webpack_exports__);
  1360. /* harmony import */
  1361. var _Option__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Option */ "./src/menu/column/models/option/Option.ts");
  1362. var __extends = (undefined && undefined.__extends) || (function() {
  1363. var extendStatics = function(d, b) {
  1364. extendStatics = Object.setPrototypeOf ||
  1365. ({
  1366. __proto__: []
  1367. }
  1368. instanceof Array && function(d, b) {
  1369. d.__proto__ = b;
  1370. }) ||
  1371. function(d, b) {
  1372. for (var p in b)
  1373. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  1374. };
  1375. return extendStatics(d, b);
  1376. };
  1377. return function(d, b) {
  1378. if (typeof b !== "function" && b !== null)
  1379. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  1380. extendStatics(d, b);
  1381.  
  1382. function __() {
  1383. this.constructor = d;
  1384. }
  1385. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1386. };
  1387. })();
  1388. var OptionIRange = /** @class */ (function(_super) {
  1389. __extends(OptionIRange, _super);
  1390.  
  1391. function OptionIRange(_a) {
  1392. var key = _a.key,
  1393. name = _a.name,
  1394. description = _a.description,
  1395. _b = _a.min,
  1396. min = _b === void 0 ? 0 : _b,
  1397. _c = _a.max,
  1398. max = _c === void 0 ? 100 : _c,
  1399. _d = _a.value,
  1400. value = _d === void 0 ? "" : _d,
  1401. _e = _a.fixValue,
  1402. fixValue = _e === void 0 ? 0 : _e,
  1403. _f = _a.isDisabled,
  1404. isDisabled = _f === void 0 ? false : _f;
  1405. var _this = this;
  1406. var element = document.createElement("box");
  1407. element.setAttribute("data-name", name);
  1408. _this = _super.call(this, {
  1409. key: key,
  1410. name: name,
  1411. description: description,
  1412. node: element
  1413. }) || this;
  1414. _this.min = min;
  1415. _this.max = max;
  1416. _this.value = value;
  1417. _this.fixValue = fixValue;
  1418. _this.isDisabled = isDisabled;
  1419. _this.element = element;
  1420. _this.inputElement = null;
  1421. _this.events = new Map([
  1422. ["input", new Map()]
  1423. ]);
  1424. return _this;
  1425. }
  1426. Object.defineProperty(OptionIRange.prototype, "html", {
  1427. get: function() {
  1428. return "\n <div class=\"ui-input-range-holder\">\n <div class=\"ui-input-range-info\">\n <span>".concat(this.name, "</span>\n <span id=\"").concat(this.key, "_value\">").concat(this.value, "</span>\n </div>\n \n <input type=\"range\" class=\"ui-option-input-range\" min=\"").concat(this.min, "\" max=\"").concat(this.max, "\">\n </div>\n ");
  1429. },
  1430. enumerable: false,
  1431. configurable: true
  1432. });
  1433. OptionIRange.prototype.on = function(event, callback) {
  1434. var eventMap = this.events.get(event);
  1435. eventMap.set(eventMap.size + 1, callback);
  1436. };
  1437. OptionIRange.prototype.setValue = function(value) {
  1438. var valueInfo = document.getElementById("".concat(this.key, "_value"));
  1439. this.value = value;
  1440. this.inputElement.value = this.value;
  1441. valueInfo && (valueInfo.innerText = this.value);
  1442. };
  1443. OptionIRange.prototype.setDisabled = function(activeState) {
  1444. this.isDisabled = activeState;
  1445. this.updateClasses();
  1446. };
  1447. OptionIRange.prototype.onInput = function() {
  1448. var _this = this;
  1449. var eventMap = this.events.get("input");
  1450. eventMap.forEach(function(callback) {
  1451. callback(_this.value, _this.inputElement);
  1452. });
  1453. return this.value;
  1454. };
  1455. OptionIRange.prototype.updateBackgroundSize = function() {
  1456. var value = +this.value;
  1457. var min = +this.min;
  1458. var max = +this.max;
  1459. this.inputElement.style.backgroundSize = (value - min) * 100 / (max - min) + '% 100%';
  1460. };
  1461. OptionIRange.prototype.getValueByMouseX = function(mouseX) {
  1462. var rect = this.element.getBoundingClientRect();
  1463. var min = +this.min;
  1464. var max = +this.max;
  1465. var newValue = ((mouseX / rect.width) * max).toFixed(this.fixValue);
  1466. return Math.min(Math.max(+newValue, min), max);
  1467. };
  1468. OptionIRange.prototype.updateInputValue = function(event) {
  1469. var value = this.getValueByMouseX(event.offsetX);
  1470. this.setValue(value);
  1471. this.onInput();
  1472. this.inputElement.dispatchEvent(new InputEvent("input"));
  1473. };
  1474. OptionIRange.prototype.initEvents = function() {
  1475. var _this = this;
  1476. var menuHolder = document.querySelector(".menu-holder");
  1477. var isPressed = false;
  1478. this.updateBackgroundSize();
  1479. this.element.addEventListener("mousedown", function(event) {
  1480. isPressed = true;
  1481. });
  1482. window.addEventListener("mouseup", function(event) {
  1483. if (!isPressed)
  1484. return;
  1485. isPressed = false;
  1486. });
  1487. menuHolder.addEventListener("mousemove", function(event) {
  1488. if (!isPressed)
  1489. return;
  1490. _this.updateInputValue(event);
  1491. });
  1492. this.inputElement.addEventListener("input", function() {
  1493. _this.updateBackgroundSize();
  1494. });
  1495. };
  1496. OptionIRange.prototype.updateClasses = function() {
  1497. if (this.isDisabled) {
  1498. this.element.classList.add("disabled");
  1499. this.inputElement.disabled = true;
  1500. } else {
  1501. this.element.classList.remove("disabled");
  1502. this.inputElement.disabled = false;
  1503. }
  1504. };
  1505. OptionIRange.prototype.build = function() {
  1506. this.element.classList.add("ui-model", "input-range-model", "inactive");
  1507. this.parent.appendChild(this.element);
  1508. this.element.insertAdjacentHTML("beforeend", this.html);
  1509. this.inputElement = this.element.querySelector("input");
  1510. this.setValue(this.value);
  1511. this.updateClasses();
  1512. this.initEvents();
  1513. this.element.title = "".concat(this.description);
  1514. };
  1515. return OptionIRange;
  1516. }(_Option__WEBPACK_IMPORTED_MODULE_0__["default"]));
  1517. /* harmony default export */
  1518. __webpack_exports__["default"] = (OptionIRange);
  1519. /***/
  1520. }),
  1521. /***/
  1522. "./src/menu/column/models/option/OptionIText.ts":
  1523. /*!******************************************************!*\
  1524. !*** ./src/menu/column/models/option/OptionIText.ts ***!
  1525. \******************************************************/
  1526. /***/
  1527. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1528. __webpack_require__.r(__webpack_exports__);
  1529. /* harmony import */
  1530. var _Option__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Option */ "./src/menu/column/models/option/Option.ts");
  1531. var __extends = (undefined && undefined.__extends) || (function() {
  1532. var extendStatics = function(d, b) {
  1533. extendStatics = Object.setPrototypeOf ||
  1534. ({
  1535. __proto__: []
  1536. }
  1537. instanceof Array && function(d, b) {
  1538. d.__proto__ = b;
  1539. }) ||
  1540. function(d, b) {
  1541. for (var p in b)
  1542. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  1543. };
  1544. return extendStatics(d, b);
  1545. };
  1546. return function(d, b) {
  1547. if (typeof b !== "function" && b !== null)
  1548. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  1549. extendStatics(d, b);
  1550.  
  1551. function __() {
  1552. this.constructor = d;
  1553. }
  1554. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1555. };
  1556. })();
  1557. var OptionIText = /** @class */ (function(_super) {
  1558. __extends(OptionIText, _super);
  1559.  
  1560. function OptionIText(_a) {
  1561. var key = _a.key,
  1562. name = _a.name,
  1563. description = _a.description,
  1564. _b = _a.value,
  1565. value = _b === void 0 ? "" : _b,
  1566. _c = _a.isDisabled,
  1567. isDisabled = _c === void 0 ? false : _c;
  1568. var _this = this;
  1569. var element = document.createElement("box");
  1570. _this = _super.call(this, {
  1571. key: key,
  1572. name: name,
  1573. description: description,
  1574. node: element
  1575. }) || this;
  1576. _this.value = value;
  1577. _this.isDisabled = isDisabled;
  1578. _this.element = element;
  1579. _this.inputElement = null;
  1580. _this.events = new Map([
  1581. ["input", new Map()]
  1582. ]);
  1583. return _this;
  1584. }
  1585. Object.defineProperty(OptionIText.prototype, "html", {
  1586. get: function() {
  1587. return "\n <input class=\"ui-option-input-text\" placeholder=\"".concat(this.name, "\">\n ");
  1588. },
  1589. enumerable: false,
  1590. configurable: true
  1591. });
  1592. OptionIText.prototype.on = function(event, callback) {
  1593. var eventMap = this.events.get(event);
  1594. eventMap.set(eventMap.size + 1, callback);
  1595. };
  1596. OptionIText.prototype.setValue = function(value) {
  1597. this.value = value;
  1598. this.inputElement.value = this.value;
  1599. };
  1600. OptionIText.prototype.setDisabled = function(activeState) {
  1601. this.isDisabled = activeState;
  1602. this.updateClasses();
  1603. };
  1604. OptionIText.prototype.onInput = function(event) {
  1605. var _this = this;
  1606. this.setValue(this.inputElement.value);
  1607. var eventMap = this.events.get("input");
  1608. eventMap.forEach(function(callback) {
  1609. callback(_this.value, event, _this.inputElement);
  1610. });
  1611. return this.value;
  1612. };
  1613. OptionIText.prototype.initEvents = function() {
  1614. this.inputElement.addEventListener("input", this.onInput.bind(this));
  1615. };
  1616. OptionIText.prototype.updateClasses = function() {
  1617. if (this.isDisabled) {
  1618. this.element.classList.add("disabled");
  1619. this.inputElement.disabled = true;
  1620. } else {
  1621. this.element.classList.remove("disabled");
  1622. this.inputElement.disabled = false;
  1623. }
  1624. };
  1625. OptionIText.prototype.build = function() {
  1626. this.element.classList.add("ui-model", "input-text-model", "inactive");
  1627. this.parent.appendChild(this.element);
  1628. this.element.insertAdjacentHTML("beforeend", this.html);
  1629. this.inputElement = this.element.querySelector("input");
  1630. this.setValue(this.value);
  1631. this.updateClasses();
  1632. this.initEvents();
  1633. this.element.title = "".concat(this.description);
  1634. };
  1635. return OptionIText;
  1636. }(_Option__WEBPACK_IMPORTED_MODULE_0__["default"]));
  1637. /* harmony default export */
  1638. __webpack_exports__["default"] = (OptionIText);
  1639. /***/
  1640. }),
  1641. /***/
  1642. "./src/menu/column/models/option/OptionsContainer.ts":
  1643. /*!***********************************************************!*\
  1644. !*** ./src/menu/column/models/option/OptionsContainer.ts ***!
  1645. \***********************************************************/
  1646. /***/
  1647. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1648. __webpack_require__.r(__webpack_exports__);
  1649. /* harmony import */
  1650. var _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../../../../configs/templates/columns */ "./src/configs/templates/columns.ts");
  1651. /* harmony import */
  1652. var _StyleSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../../StyleSystem */ "./src/menu/column/StyleSystem.ts");
  1653. var __extends = (undefined && undefined.__extends) || (function() {
  1654. var extendStatics = function(d, b) {
  1655. extendStatics = Object.setPrototypeOf ||
  1656. ({
  1657. __proto__: []
  1658. }
  1659. instanceof Array && function(d, b) {
  1660. d.__proto__ = b;
  1661. }) ||
  1662. function(d, b) {
  1663. for (var p in b)
  1664. if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
  1665. };
  1666. return extendStatics(d, b);
  1667. };
  1668. return function(d, b) {
  1669. if (typeof b !== "function" && b !== null)
  1670. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  1671. extendStatics(d, b);
  1672.  
  1673. function __() {
  1674. this.constructor = d;
  1675. }
  1676. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1677. };
  1678. })();
  1679. var OptionsContainer = /** @class */ (function(_super) {
  1680. __extends(OptionsContainer, _super);
  1681.  
  1682. function OptionsContainer(parent, parentKey) {
  1683. var _this = this;
  1684. var element = document.createElement("container");
  1685. var config = _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__["default"].column;
  1686. _this = _super.call(this, element, config.container.colors) || this;
  1687. _this.parent = parent;
  1688. _this.parentKey = parentKey;
  1689. _this.element = element;
  1690. _this.config = config;
  1691. _this.models = new Map();
  1692. return _this;
  1693. }
  1694. Object.defineProperty(OptionsContainer.prototype, "isVisible", {
  1695. get: function() {
  1696. return this.element.style.display === this.config.optionsContainer.showDisplay;
  1697. },
  1698. enumerable: false,
  1699. configurable: true
  1700. });
  1701. Object.defineProperty(OptionsContainer.prototype, "visibleStatus", {
  1702. get: function() {
  1703. return this.isVisible ? "show" : "hide";
  1704. },
  1705. enumerable: false,
  1706. configurable: true
  1707. });
  1708. OptionsContainer.prototype.show = function() {
  1709. this.element.style.display = this.config.container.showDisplay;
  1710. };
  1711. OptionsContainer.prototype.hide = function() {
  1712. this.element.style.display = "none";
  1713. };
  1714. OptionsContainer.prototype.toggle = function() {
  1715. if (this.isVisible)
  1716. return this.hide();
  1717. this.show();
  1718. };
  1719. OptionsContainer.prototype.add = function(option) {
  1720. return this.models.set(option.key, option).get(option.key);
  1721. };
  1722. OptionsContainer.prototype.updateStyles = function() {
  1723. var _this = this;
  1724. this._updateStyles("100%", "auto");
  1725. this.models.forEach(function(model) {
  1726. model.bgColor = _this.bgColor;
  1727. model.textColor = _this.textColor;
  1728. model._updateStyles("intial", "auto");
  1729. });
  1730. };
  1731. OptionsContainer.prototype.build = function() {
  1732. var _this = this;
  1733. this.element.classList.add("options-container", "flex", "fcolumn");
  1734. this.element.id = "".concat(this.parentKey, "_container");
  1735. this.parent.insertAdjacentHTML("afterend", this.element.outerHTML);
  1736. this.element = this.parent.nextElementSibling;
  1737. this.node = this.element;
  1738. this.models.forEach(function(model) {
  1739. model.setParent(_this.element);
  1740. model.build();
  1741. });
  1742. this.hide();
  1743. this.updateStyles();
  1744. };
  1745. return OptionsContainer;
  1746. }(_StyleSystem__WEBPACK_IMPORTED_MODULE_1__["default"]));
  1747. /* harmony default export */
  1748. __webpack_exports__["default"] = (OptionsContainer);
  1749. /***/
  1750. }),
  1751. /***/
  1752. "./src/menu/layout/cssLayout.ts":
  1753. /*!**************************************!*\
  1754. !*** ./src/menu/layout/cssLayout.ts ***!
  1755. \**************************************/
  1756. /***/
  1757. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1758. __webpack_require__.r(__webpack_exports__);
  1759. var cssLayout = "\n.menu-holder {\n z-index: 99999999;\n}\n\n.ui-input-range-holder {\n display: flex;\n flex-direction: column;\n width: 100%;\n gap: 1.5px;\n cursor: default;\n}\n\n.ui-input-range-info {\n display: flex;\n justify-content: space-between;\n pointer-events: none;\n cursor: default;\n}\n\n.ui-option-input-range {\n -webkit-appearance: none;\n appearance: none;\n cursor: pointer;\n height: 3px;\n width: 100%;\n filter: invert(.2);\n background-image: linear-gradient(currentColor, currentColor);\n background-size: 0% 100%;\n background-repeat: no-repeat;\n margin: 0;\n padding: 0;\n}\n\n.ui-option-input-range::-webkit-slider-runnable-track {\n display: none;\n height: 0;\n}\n \n.ui-option-input-range::-moz-range-track {\n display: none;\n height: 0;\n}\n\n.ui-option-input-text {\n width: initial;\n height: initial;\n background: none;\n border: none;\n outline: 0;\n padding: 0;\n color: currentColor;\n font-size: 14px;\n}\n\n.ui-option-input-color {\n -webkit-appearance: none;\n width: 100%;\n height: 100%;\n background: none;\n border: none;\n outline: 0;\n padding: 0;\n overflow: hidden;\n height: 22.5px !important;\n}\n\n.ui-option-input-color::-webkit-color-swatch-wrapper {\n padding: 0; \n}\n\n.ui-option-input-color::-webkit-color-swatch {\n border: none;\n}\n\n.input-color-model {\n padding: 0 !important;\n}\n\n.input-color-model::before {\n content: attr(data-name);\n position: absolute;\n color: currentColor;\n pointer-events: none;\n left: 6.5px;\n}\n\n.input-text-model, .input-color-model {\n cursor: default !important;\n}\n\n.options-container {\n border: 1.5px solid;\n border-top: none;\n box-sizing: border-box;\n padding: 2.5px;\n gap: 2.5px;\n margin-top: -2.5px;\n}\n\n.options-container::-webkit-scrollbar {\n width: 6px;\n}\n\n.options-container::-webkit-scrollbar-thumb {\n box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);\n}\n\n.ui-model {\n display: flex;\n align-items: center;\n width: initial;\n height: 20px !important;\n cursor: pointer;\n border: 1.5px solid;\n font-size: 16px;\n gap: 5px;\n padding: 2px 5px;\n color: inherit !important;\n}\n\n.ui-model.has-options::before {\n content: \">\";\n transform: rotate(0deg) scaleY(1.35);\n cursor: pointer;\n}\n\n.ui-model.has-options.show-options::before {\n transform: rotate(90deg) scaleY(1.35);\n}\n\n.ui-model.disabled {\n cursor: default;\n filter: invert(.15);\n}\n\n.ui-model.active, \n.ui-model.active > .ui-model-text,\n.ui-model.active > .ui-option-text,\n.ui-model.active > .ui-model.has-options::before {\n filter: invert(0);\n}\n\n.ui-model.inactive {\n filter: invert(.075);\n}\n\n.ui-model.inactive > .ui-model-text,\n.ui-model.inactive > .ui-option-text,\n.ui-model.inactive.has-options::before {\n filter: invert(.3);\n}\n\n.column-container {\n border: 1.5px solid;\n border-top: none;\n box-sizing: border-box;\n padding: 2.5px;\n gap: 2.5px;\n overflow-y: auto;\n}\n\n.column-container::-webkit-scrollbar {\n width: 6px;\n}\n\n.column-container::-webkit-scrollbar-thumb {\n box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);\n}\n\n.column-header {\n cursor: pointer;\n border: 1px solid;\n box-sizing: border-box;\n transition: .1s filter;\n}\n\n.column-header:hover {\n filter: grayscale(0.15);\n}\n\n.header-text {\n font-size: 16px;\n font-weight: 1000;\n}\n\n.no-pointer {\n pointer-events: none;\n}\n\n.all-pointer {\n pointer-events: all;\n}\n\n.wh-inherit {\n width: inherit;\n height: inherit;\n}\n\n.absolute {\n position: absolute;\n top: 0;\n left: 0;\n}\n\n.wh-100 {\n width: 100%;\n height: 100%;\n}\n\n.flex {\n display: flex;\n}\n\n.flex.fcolumn {\n flex-direction: column\n}\n\n.flex.fcenter {\n align-items: center;\n justify-content: center;\n}\n";
  1760. /* harmony default export */
  1761. __webpack_exports__["default"] = (cssLayout);
  1762. /***/
  1763. }),
  1764. /***/
  1765. "./src/menu/layout/htmlLayout.ts":
  1766. /*!***************************************!*\
  1767. !*** ./src/menu/layout/htmlLayout.ts ***!
  1768. \***************************************/
  1769. /***/
  1770. (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  1771. __webpack_require__.r(__webpack_exports__);
  1772. /* harmony import */
  1773. var _cssLayout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./cssLayout */ "./src/menu/layout/cssLayout.ts");
  1774. var htmlLayout = "\n<style>".concat(_cssLayout__WEBPACK_IMPORTED_MODULE_0__["default"].toString(), "</style>\n\n<div class=\"menu-wrapper wh-inherit flex\">\n\n</div>\n");
  1775. /* harmony default export */
  1776. __webpack_exports__["default"] = (htmlLayout);
  1777. /***/
  1778. })
  1779. /******/
  1780. });
  1781. /************************************************************************/
  1782. /******/ // The module cache
  1783. /******/
  1784. var __webpack_module_cache__ = {};
  1785. /******/
  1786. /******/ // The require function
  1787. /******/
  1788. function __webpack_require__(moduleId) {
  1789. /******/ // Check if module is in cache
  1790. /******/
  1791. var cachedModule = __webpack_module_cache__[moduleId];
  1792. /******/
  1793. if (cachedModule !== undefined) {
  1794. /******/
  1795. return cachedModule.exports;
  1796. /******/
  1797. }
  1798. /******/ // Create a new module (and put it into the cache)
  1799. /******/
  1800. var module = __webpack_module_cache__[moduleId] = {
  1801. /******/ // no module.id needed
  1802. /******/ // no module.loaded needed
  1803. /******/
  1804. exports: {}
  1805. /******/
  1806. };
  1807. /******/
  1808. /******/ // Execute the module function
  1809. /******/
  1810. __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  1811. /******/
  1812. /******/ // Return the exports of the module
  1813. /******/
  1814. return module.exports;
  1815. /******/
  1816. }
  1817. /******/
  1818. /************************************************************************/
  1819. /******/
  1820. /* webpack/runtime/make namespace object */
  1821. /******/
  1822. ! function() {
  1823. /******/ // define __esModule on exports
  1824. /******/
  1825. __webpack_require__.r = function(exports) {
  1826. /******/
  1827. if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  1828. /******/
  1829. Object.defineProperty(exports, Symbol.toStringTag, {
  1830. value: 'Module'
  1831. });
  1832. /******/
  1833. }
  1834. /******/
  1835. Object.defineProperty(exports, '__esModule', {
  1836. value: true
  1837. });
  1838. /******/
  1839. };
  1840. /******/
  1841. }();
  1842. /******/
  1843. /************************************************************************/
  1844. var __webpack_exports__ = {};
  1845. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  1846. ! function() {
  1847. /*!**********************!*\
  1848. !*** ./src/index.ts ***!
  1849. \**********************/
  1850. __webpack_require__.r(__webpack_exports__);
  1851. /* harmony import */
  1852. var _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./configs/templates/columns */ "./src/configs/templates/columns.ts");
  1853. /* harmony import */
  1854. var _menu_Menu__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./menu/Menu */ "./src/menu/Menu.ts");
  1855. /* harmony import */
  1856. var _menu_column_Column__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./menu/column/Column */ "./src/menu/column/Column.ts");
  1857. /* harmony import */
  1858. var _menu_column_models_Checkbox__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./menu/column/models/Checkbox */ "./src/menu/column/models/Checkbox.ts");
  1859. /* harmony import */
  1860. var _menu_column_models_option_OptionCheckbox__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./menu/column/models/option/OptionCheckbox */ "./src/menu/column/models/option/OptionCheckbox.ts");
  1861. /* harmony import */
  1862. var _menu_column_models_option_OptionIColor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ./menu/column/models/option/OptionIColor */ "./src/menu/column/models/option/OptionIColor.ts");
  1863. /* harmony import */
  1864. var _menu_column_models_option_OptionIRange__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__( /*! ./menu/column/models/option/OptionIRange */ "./src/menu/column/models/option/OptionIRange.ts");
  1865. /* harmony import */
  1866. var _menu_column_models_option_OptionIText__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__( /*! ./menu/column/models/option/OptionIText */ "./src/menu/column/models/option/OptionIText.ts");
  1867. var MooUI = (function() {
  1868. this.list = new Map();
  1869. this.Column = _menu_column_Column__WEBPACK_IMPORTED_MODULE_2__["default"];
  1870. this.Checkbox = _menu_column_models_Checkbox__WEBPACK_IMPORTED_MODULE_3__["default"];
  1871. this.OptionCheckbox = _menu_column_models_option_OptionCheckbox__WEBPACK_IMPORTED_MODULE_4__["default"];
  1872. this.OptionIText = _menu_column_models_option_OptionIText__WEBPACK_IMPORTED_MODULE_7__["default"];
  1873. this.OptionIColor = _menu_column_models_option_OptionIColor__WEBPACK_IMPORTED_MODULE_5__["default"];
  1874. this.OptionIRange = _menu_column_models_option_OptionIRange__WEBPACK_IMPORTED_MODULE_6__["default"];
  1875. this.createMenu = function(_a) {
  1876. var _this = this;
  1877. var toggleKey = _a.toggleKey,
  1878. appendNode = _a.appendNode;
  1879. var id = this.list.size + 1;
  1880. var menu = new _menu_Menu__WEBPACK_IMPORTED_MODULE_1__["default"]({
  1881. id: id,
  1882. config: _configs_templates_columns__WEBPACK_IMPORTED_MODULE_0__["default"],
  1883. toggleKey: toggleKey,
  1884. appendNode: appendNode
  1885. });
  1886. menu.destroy = function() {
  1887. menu.holder.remove();
  1888. _this.list.delete(menu.id);
  1889. };
  1890. return this.list.set(id, menu).get(id);
  1891. };
  1892. this.eachAllMenu = function(callback, predicate) {
  1893. typeof predicate === 'undefined' && (predicate = function() {
  1894. return true;
  1895. });
  1896. Array.from(this.list.values()).filter(function(item) {
  1897. return item.isMenu && predicate(item);
  1898. }).forEach(function(menu) {
  1899. return callback(menu);
  1900. });
  1901. };
  1902. this.toggleAllMenu = function(action) {
  1903. this.eachAllMenu(function(menu) {
  1904. menu[action]();
  1905. }, function(menu) {
  1906. return action === "show" ? !menu.isVisible : menu.isVisible;
  1907. });
  1908. };
  1909. this.showAllMenu = function() {
  1910. this.toggleAllMenu("show");
  1911. };
  1912. this.hideAllMenu = function() {
  1913. this.toggleAllMenu("hide");
  1914. };
  1915. console.log("MooUI.js v1.0.0");
  1916. return this;
  1917. }).call(Object.create({}));
  1918. window.MooUI = MooUI;
  1919. }();
  1920. /******/
  1921. })();
  1922. //# sourceMappingURL=bundle.js.map