@blaze-cms/plugin-admin-core-ui 0.146.0-node18-tooltips.37 → 0.146.0-node18-core-styles-tooltips.45

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +83 -19
  2. package/package.json +8 -9
  3. package/lib-es/components/Header/Header.js +0 -28
  4. package/lib-es/components/Header/Header.js.map +0 -1
  5. package/lib-es/components/Header/components/Language/Language.js +0 -14
  6. package/lib-es/components/Header/components/Language/Language.js.map +0 -1
  7. package/lib-es/components/Header/components/Language/index.js +0 -3
  8. package/lib-es/components/Header/components/Language/index.js.map +0 -1
  9. package/lib-es/components/Header/components/Logo/Logo.js +0 -29
  10. package/lib-es/components/Header/components/Logo/Logo.js.map +0 -1
  11. package/lib-es/components/Header/components/Logo/index.js +0 -3
  12. package/lib-es/components/Header/components/Logo/index.js.map +0 -1
  13. package/lib-es/components/Header/components/Menu/Menu.js +0 -33
  14. package/lib-es/components/Header/components/Menu/Menu.js.map +0 -1
  15. package/lib-es/components/Header/components/Menu/index.js +0 -3
  16. package/lib-es/components/Header/components/Menu/index.js.map +0 -1
  17. package/lib-es/components/Header/components/index.js +0 -5
  18. package/lib-es/components/Header/components/index.js.map +0 -1
  19. package/lib-es/components/Header/index.js +0 -3
  20. package/lib-es/components/Header/index.js.map +0 -1
  21. package/lib-es/components/Layout/Background.js +0 -16
  22. package/lib-es/components/Layout/Background.js.map +0 -1
  23. package/lib-es/components/Layout/Layout.js +0 -48
  24. package/lib-es/components/Layout/Layout.js.map +0 -1
  25. package/lib-es/components/Layout/components/Grid/Grid.js +0 -29
  26. package/lib-es/components/Layout/components/Grid/Grid.js.map +0 -1
  27. package/lib-es/components/Layout/components/Grid/index.js +0 -3
  28. package/lib-es/components/Layout/components/Grid/index.js.map +0 -1
  29. package/lib-es/components/Layout/components/index.js +0 -3
  30. package/lib-es/components/Layout/components/index.js.map +0 -1
  31. package/lib-es/components/Menu/Icons/ChevronDown.js +0 -19
  32. package/lib-es/components/Menu/Icons/ChevronDown.js.map +0 -1
  33. package/lib-es/components/Menu/Icons/ChevronUp.js +0 -19
  34. package/lib-es/components/Menu/Icons/ChevronUp.js.map +0 -1
  35. package/lib-es/components/Menu/Items/MenuActionItem.js +0 -34
  36. package/lib-es/components/Menu/Items/MenuActionItem.js.map +0 -1
  37. package/lib-es/components/Menu/Items/MenuItem.js +0 -64
  38. package/lib-es/components/Menu/Items/MenuItem.js.map +0 -1
  39. package/lib-es/components/Menu/Items/MenuLinkItem.js +0 -31
  40. package/lib-es/components/Menu/Items/MenuLinkItem.js.map +0 -1
  41. package/lib-es/components/Menu/Menu.js +0 -40
  42. package/lib-es/components/Menu/Menu.js.map +0 -1
  43. package/lib-es/components/Menu/Section/MenuSection.js +0 -18
  44. package/lib-es/components/Menu/Section/MenuSection.js.map +0 -1
  45. package/lib-es/components/Menu/Section/MenuSectionCollapsible.js +0 -71
  46. package/lib-es/components/Menu/Section/MenuSectionCollapsible.js.map +0 -1
  47. package/lib-es/components/Menu/Section/MenuSectionItem.js +0 -30
  48. package/lib-es/components/Menu/Section/MenuSectionItem.js.map +0 -1
  49. package/lib-es/components/Menu/Section/MenuSectionItems.js +0 -20
  50. package/lib-es/components/Menu/Section/MenuSectionItems.js.map +0 -1
  51. package/lib-es/components/Menu/index.js +0 -3
  52. package/lib-es/components/Menu/index.js.map +0 -1
  53. package/lib-es/components/SideBar/SideBar.js +0 -71
  54. package/lib-es/components/SideBar/SideBar.js.map +0 -1
  55. package/lib-es/components/SideBar/components/SideBlock.js +0 -48
  56. package/lib-es/components/SideBar/components/SideBlock.js.map +0 -1
  57. package/lib-es/components/SideBar/components/SideBlockItem.js +0 -19
  58. package/lib-es/components/SideBar/components/SideBlockItem.js.map +0 -1
  59. package/lib-es/components/SideBar/components/index.js +0 -3
  60. package/lib-es/components/SideBar/components/index.js.map +0 -1
  61. package/lib-es/components/SideBar/index.js +0 -3
  62. package/lib-es/components/SideBar/index.js.map +0 -1
  63. package/lib-es/components/index.js +0 -3
  64. package/lib-es/components/index.js.map +0 -1
  65. package/lib-es/constants.js +0 -15
  66. package/lib-es/constants.js.map +0 -1
  67. package/lib-es/containers/Home/Home.js +0 -5
  68. package/lib-es/containers/Home/Home.js.map +0 -1
  69. package/lib-es/containers/index.js +0 -3
  70. package/lib-es/containers/index.js.map +0 -1
  71. package/lib-es/index.js +0 -32
  72. package/lib-es/index.js.map +0 -1
  73. package/lib-es/utils/get-menu-items-resolver.js +0 -14
  74. package/lib-es/utils/get-menu-items-resolver.js.map +0 -1
  75. package/lib-es/utils/menu-handler-singleton.js +0 -66
  76. package/lib-es/utils/menu-handler-singleton.js.map +0 -1
  77. package/lib-es/utils/menu-handler.js +0 -49
  78. package/lib-es/utils/menu-handler.js.map +0 -1
@@ -1,15 +0,0 @@
1
- const PLUGIN_NAME = 'admin-core-ui';
2
- const LOGO_PROPS = {
3
- src: process.env.BLAZE_ADMIN_HEAD_LOGO_URL || 'https://images.thisisblaze.com/logo-98-148.png'
4
- };
5
- const DEFAULT_LABEL = {
6
- text: 'See more',
7
- icon: 'down'
8
- };
9
- const ACTIVE_LABEL = {
10
- text: 'See less',
11
- icon: 'up'
12
- };
13
- const DOWN_ICON = 'down';
14
- export { PLUGIN_NAME, LOGO_PROPS, ACTIVE_LABEL, DEFAULT_LABEL, DOWN_ICON };
15
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","names":["PLUGIN_NAME","LOGO_PROPS","src","process","env","BLAZE_ADMIN_HEAD_LOGO_URL","DEFAULT_LABEL","text","icon","ACTIVE_LABEL","DOWN_ICON"],"sources":["../src/constants.js"],"sourcesContent":["const PLUGIN_NAME = 'admin-core-ui';\nconst LOGO_PROPS = {\n src: process.env.BLAZE_ADMIN_HEAD_LOGO_URL || 'https://images.thisisblaze.com/logo-98-148.png'\n};\n\nconst DEFAULT_LABEL = {\n text: 'See more',\n icon: 'down'\n};\n\nconst ACTIVE_LABEL = {\n text: 'See less',\n icon: 'up'\n};\n\nconst DOWN_ICON = 'down';\n\nexport { PLUGIN_NAME, LOGO_PROPS, ACTIVE_LABEL, DEFAULT_LABEL, DOWN_ICON };\n"],"mappings":"AAAA,MAAMA,WAAW,GAAG,eAAe;AACnC,MAAMC,UAAU,GAAG;EACjBC,GAAG,EAAEC,OAAO,CAACC,GAAG,CAACC,yBAAyB,IAAI;AAChD,CAAC;AAED,MAAMC,aAAa,GAAG;EACpBC,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE;AACR,CAAC;AAED,MAAMC,YAAY,GAAG;EACnBF,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE;AACR,CAAC;AAED,MAAME,SAAS,GAAG,MAAM;AAExB,SAASV,WAAW,EAAEC,UAAU,EAAEQ,YAAY,EAAEH,aAAa,EAAEI,SAAS","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- const Home = () => /*#__PURE__*/React.createElement("div", null);
3
- Home.displayName = 'Home';
4
- export default Home;
5
- //# sourceMappingURL=Home.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Home.js","names":["React","Home","createElement","displayName"],"sources":["../../../src/containers/Home/Home.js"],"sourcesContent":["import React from 'react';\n\nconst Home = () => <div />;\n\nHome.displayName = 'Home';\n\nexport default Home;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,IAAI,GAAGA,CAAA,kBAAMD,KAAA,CAAAE,aAAA,YAAM,CAAC;AAE1BD,IAAI,CAACE,WAAW,GAAG,MAAM;AAEzB,eAAeF,IAAI","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import Home from './Home/Home';
2
- export default Home;
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["Home"],"sources":["../../src/containers/index.js"],"sourcesContent":["import Home from './Home/Home';\n\nexport default Home;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,aAAa;AAE9B,eAAeA,IAAI","ignoreList":[]}
package/lib-es/index.js DELETED
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import { Layout } from './components';
3
- import pkg from '../package.json';
4
- import { PLUGIN_NAME } from './constants';
5
- import menuHandler from './utils/menu-handler-singleton';
6
- const Home = React.lazy(() => import(/* webpackChunkName: 'Home' */'./containers'));
7
- async function load(app, options = {}) {
8
- const {
9
- menuConfig = {},
10
- homeRoute
11
- } = options;
12
- const home = {
13
- path: '/',
14
- exact: true,
15
- key: 'home',
16
- redirect: homeRoute,
17
- component: Home
18
- };
19
- app.addRoute(home);
20
- menuHandler.setApp(app);
21
- app.setLayout(Layout);
22
- app.events.once('admin:menu:config:load:after', ({
23
- addConfig
24
- }) => addConfig(menuConfig));
25
- return {
26
- name: PLUGIN_NAME,
27
- version: pkg.version
28
- };
29
- }
30
- load.pluginName = PLUGIN_NAME;
31
- export default load;
32
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["React","Layout","pkg","PLUGIN_NAME","menuHandler","Home","lazy","load","app","options","menuConfig","homeRoute","home","path","exact","key","redirect","component","addRoute","setApp","setLayout","events","once","addConfig","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { Layout } from './components';\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\nimport menuHandler from './utils/menu-handler-singleton';\n\nconst Home = React.lazy(() => import(/* webpackChunkName: 'Home' */ './containers'));\n\nasync function load(app, options = {}) {\n const { menuConfig = {}, homeRoute } = options;\n\n const home = {\n path: '/',\n exact: true,\n key: 'home',\n redirect: homeRoute,\n component: Home\n };\n\n app.addRoute(home);\n\n menuHandler.setApp(app);\n\n app.setLayout(Layout);\n\n app.events.once('admin:menu:config:load:after', ({ addConfig }) => addConfig(menuConfig));\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n\nexport default load;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,cAAc;AACrC,OAAOC,GAAG,MAAM,iBAAiB;AACjC,SAASC,WAAW,QAAQ,aAAa;AACzC,OAAOC,WAAW,MAAM,gCAAgC;AAExD,MAAMC,IAAI,GAAGL,KAAK,CAACM,IAAI,CAAC,MAAM,MAAM,CAAC,8BAA+B,cAAc,CAAC,CAAC;AAEpF,eAAeC,IAAIA,CAACC,GAAG,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;EACrC,MAAM;IAAEC,UAAU,GAAG,CAAC,CAAC;IAAEC;EAAU,CAAC,GAAGF,OAAO;EAE9C,MAAMG,IAAI,GAAG;IACXC,IAAI,EAAE,GAAG;IACTC,KAAK,EAAE,IAAI;IACXC,GAAG,EAAE,MAAM;IACXC,QAAQ,EAAEL,SAAS;IACnBM,SAAS,EAAEZ;EACb,CAAC;EAEDG,GAAG,CAACU,QAAQ,CAACN,IAAI,CAAC;EAElBR,WAAW,CAACe,MAAM,CAACX,GAAG,CAAC;EAEvBA,GAAG,CAACY,SAAS,CAACnB,MAAM,CAAC;EAErBO,GAAG,CAACa,MAAM,CAACC,IAAI,CAAC,8BAA8B,EAAE,CAAC;IAAEC;EAAU,CAAC,KAAKA,SAAS,CAACb,UAAU,CAAC,CAAC;EAEzF,OAAO;IACLc,IAAI,EAAErB,WAAW;IACjBsB,OAAO,EAAEvB,GAAG,CAACuB;EACf,CAAC;AACH;AAEAlB,IAAI,CAACmB,UAAU,GAAGvB,WAAW;AAE7B,eAAeI,IAAI","ignoreList":[]}
@@ -1,14 +0,0 @@
1
- import menuHandler from './menu-handler';
2
- export default function getMenuItemsResolver(app) {
3
- return async () => {
4
- const {
5
- addItem,
6
- addSection,
7
- getAll
8
- } = menuHandler();
9
- await app.events.emitAsync('load:menu-section', addSection);
10
- await app.events.emitAsync('load:menu-items', addItem);
11
- return getAll();
12
- };
13
- }
14
- //# sourceMappingURL=get-menu-items-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-menu-items-resolver.js","names":["menuHandler","getMenuItemsResolver","app","addItem","addSection","getAll","events","emitAsync"],"sources":["../../src/utils/get-menu-items-resolver.js"],"sourcesContent":["import menuHandler from './menu-handler';\n\nexport default function getMenuItemsResolver(app) {\n return async () => {\n const { addItem, addSection, getAll } = menuHandler();\n await app.events.emitAsync('load:menu-section', addSection);\n await app.events.emitAsync('load:menu-items', addItem);\n return getAll();\n };\n}\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,gBAAgB;AAExC,eAAe,SAASC,oBAAoBA,CAACC,GAAG,EAAE;EAChD,OAAO,YAAY;IACjB,MAAM;MAAEC,OAAO;MAAEC,UAAU;MAAEC;IAAO,CAAC,GAAGL,WAAW,CAAC,CAAC;IACrD,MAAME,GAAG,CAACI,MAAM,CAACC,SAAS,CAAC,mBAAmB,EAAEH,UAAU,CAAC;IAC3D,MAAMF,GAAG,CAACI,MAAM,CAACC,SAAS,CAAC,iBAAiB,EAAEJ,OAAO,CAAC;IACtD,OAAOE,MAAM,CAAC,CAAC;EACjB,CAAC;AACH","ignoreList":[]}
@@ -1,66 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import merge from 'lodash.merge';
3
- let instance;
4
- export class MenuHandler {
5
- constructor(app) {
6
- _defineProperty(this, "menuSections", new Map());
7
- _defineProperty(this, "menuConfig", void 0);
8
- _defineProperty(this, "app", void 0);
9
- if (instance) {
10
- throw new Error('You can only create one instance!');
11
- }
12
- instance = this;
13
- this.menuConfig = {};
14
- this.app = null;
15
- }
16
- setApp(app) {
17
- this.app = app;
18
- }
19
-
20
- // eslint-disable-next-line no-dupe-class-members
21
- get app() {
22
- return this.app;
23
- }
24
-
25
- // eslint-disable-next-line no-dupe-class-members
26
- get menuConfig() {
27
- return this.menuConfig;
28
- }
29
- addConfig(newConfig) {
30
- this.menuConfig = merge(this.menuConfig, newConfig);
31
- }
32
- async loadConfig() {
33
- const addConfig = newConfig => {
34
- this.addConfig(newConfig);
35
- };
36
- const {
37
- menuConfig
38
- } = this;
39
- if (this.app && this.app.events) {
40
- await this.app.events.emitAsync('admin:menu:config:load', {
41
- addConfig
42
- });
43
- await this.app.events.emitAsync('admin:menu:config:load:after', {
44
- addConfig,
45
- menuConfig
46
- });
47
- }
48
- }
49
- getInstance() {
50
- return this;
51
- }
52
- getAll() {
53
- return Object.entries(this.menuConfig).sort((a, b) => {
54
- if (a[1].order === undefined) {
55
- return 1;
56
- }
57
- if (b[1].order === undefined) {
58
- return -1;
59
- }
60
- return a[1].order > b[1].order ? 1 : -1;
61
- });
62
- }
63
- }
64
- const menuHandler = new MenuHandler();
65
- export default menuHandler;
66
- //# sourceMappingURL=menu-handler-singleton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"menu-handler-singleton.js","names":["merge","instance","MenuHandler","constructor","app","_defineProperty","Map","Error","menuConfig","setApp","addConfig","newConfig","loadConfig","events","emitAsync","getInstance","getAll","Object","entries","sort","a","b","order","undefined","menuHandler"],"sources":["../../src/utils/menu-handler-singleton.js"],"sourcesContent":["import merge from 'lodash.merge';\n\nlet instance;\n\nexport class MenuHandler {\n menuSections = new Map();\n\n menuConfig;\n\n app;\n\n constructor(app) {\n if (instance) {\n throw new Error('You can only create one instance!');\n }\n instance = this;\n this.menuConfig = {};\n this.app = null;\n }\n\n setApp(app) {\n this.app = app;\n }\n\n // eslint-disable-next-line no-dupe-class-members\n get app() {\n return this.app;\n }\n\n // eslint-disable-next-line no-dupe-class-members\n get menuConfig() {\n return this.menuConfig;\n }\n\n addConfig(newConfig) {\n this.menuConfig = merge(this.menuConfig, newConfig);\n }\n\n async loadConfig() {\n const addConfig = newConfig => {\n this.addConfig(newConfig);\n };\n\n const { menuConfig } = this;\n\n if (this.app && this.app.events) {\n await this.app.events.emitAsync('admin:menu:config:load', { addConfig });\n await this.app.events.emitAsync('admin:menu:config:load:after', { addConfig, menuConfig });\n }\n }\n\n getInstance() {\n return this;\n }\n\n getAll() {\n return Object.entries(this.menuConfig).sort((a, b) => {\n if (a[1].order === undefined) {\n return 1;\n }\n if (b[1].order === undefined) {\n return -1;\n }\n return a[1].order > b[1].order ? 1 : -1;\n });\n }\n}\n\nconst menuHandler = new MenuHandler();\nexport default menuHandler;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,cAAc;AAEhC,IAAIC,QAAQ;AAEZ,OAAO,MAAMC,WAAW,CAAC;EAOvBC,WAAWA,CAACC,GAAG,EAAE;IAAAC,eAAA,uBANF,IAAIC,GAAG,CAAC,CAAC;IAAAD,eAAA;IAAAA,eAAA;IAOtB,IAAIJ,QAAQ,EAAE;MACZ,MAAM,IAAIM,KAAK,CAAC,mCAAmC,CAAC;IACtD;IACAN,QAAQ,GAAG,IAAI;IACf,IAAI,CAACO,UAAU,GAAG,CAAC,CAAC;IACpB,IAAI,CAACJ,GAAG,GAAG,IAAI;EACjB;EAEAK,MAAMA,CAACL,GAAG,EAAE;IACV,IAAI,CAACA,GAAG,GAAGA,GAAG;EAChB;;EAEA;EACA,IAAIA,GAAGA,CAAA,EAAG;IACR,OAAO,IAAI,CAACA,GAAG;EACjB;;EAEA;EACA,IAAII,UAAUA,CAAA,EAAG;IACf,OAAO,IAAI,CAACA,UAAU;EACxB;EAEAE,SAASA,CAACC,SAAS,EAAE;IACnB,IAAI,CAACH,UAAU,GAAGR,KAAK,CAAC,IAAI,CAACQ,UAAU,EAAEG,SAAS,CAAC;EACrD;EAEA,MAAMC,UAAUA,CAAA,EAAG;IACjB,MAAMF,SAAS,GAAGC,SAAS,IAAI;MAC7B,IAAI,CAACD,SAAS,CAACC,SAAS,CAAC;IAC3B,CAAC;IAED,MAAM;MAAEH;IAAW,CAAC,GAAG,IAAI;IAE3B,IAAI,IAAI,CAACJ,GAAG,IAAI,IAAI,CAACA,GAAG,CAACS,MAAM,EAAE;MAC/B,MAAM,IAAI,CAACT,GAAG,CAACS,MAAM,CAACC,SAAS,CAAC,wBAAwB,EAAE;QAAEJ;MAAU,CAAC,CAAC;MACxE,MAAM,IAAI,CAACN,GAAG,CAACS,MAAM,CAACC,SAAS,CAAC,8BAA8B,EAAE;QAAEJ,SAAS;QAAEF;MAAW,CAAC,CAAC;IAC5F;EACF;EAEAO,WAAWA,CAAA,EAAG;IACZ,OAAO,IAAI;EACb;EAEAC,MAAMA,CAAA,EAAG;IACP,OAAOC,MAAM,CAACC,OAAO,CAAC,IAAI,CAACV,UAAU,CAAC,CAACW,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;MACpD,IAAID,CAAC,CAAC,CAAC,CAAC,CAACE,KAAK,KAAKC,SAAS,EAAE;QAC5B,OAAO,CAAC;MACV;MACA,IAAIF,CAAC,CAAC,CAAC,CAAC,CAACC,KAAK,KAAKC,SAAS,EAAE;QAC5B,OAAO,CAAC,CAAC;MACX;MACA,OAAOH,CAAC,CAAC,CAAC,CAAC,CAACE,KAAK,GAAGD,CAAC,CAAC,CAAC,CAAC,CAACC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC,CAAC;EACJ;AACF;AAEA,MAAME,WAAW,GAAG,IAAItB,WAAW,CAAC,CAAC;AACrC,eAAesB,WAAW","ignoreList":[]}
@@ -1,49 +0,0 @@
1
- export default function menuHandler() {
2
- const menuSections = new Map();
3
- function getSection(key) {
4
- return menuSections.get(key);
5
- }
6
- function getAll() {
7
- return Array.from(menuSections.entries()).sort(([, {
8
- order: order1
9
- }], [, {
10
- order: order2
11
- }]) => order1 > order2 ? 1 : -1);
12
- }
13
- function addSection(key, {
14
- header,
15
- order
16
- }) {
17
- validateSection(key, order);
18
- const section = {
19
- header,
20
- order,
21
- items: []
22
- };
23
- menuSections.set(key, section);
24
- }
25
- function addItem(item, sectionKey) {
26
- validateItem(sectionKey);
27
- const section = menuSections.get(sectionKey);
28
- section.items.push(item);
29
- }
30
- function validateItem(key) {
31
- if (!menuSections.has(key)) throw new Error(`Section ${key} doesn\'t exist`);
32
- }
33
- function validateSection(key, order) {
34
- if (!key) throw new Error('Section requires a key');
35
- if (menuSections.has(key)) throw new Error(`Section with ${key} has been already added`);
36
- if (Array.from(menuSections.entries()).some(([_, {
37
- order: _order
38
- }]) => _order === order)) {
39
- throw new Error('Section with this order has already been added');
40
- }
41
- }
42
- return {
43
- addSection,
44
- addItem,
45
- getSection,
46
- getAll
47
- };
48
- }
49
- //# sourceMappingURL=menu-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"menu-handler.js","names":["menuHandler","menuSections","Map","getSection","key","get","getAll","Array","from","entries","sort","order","order1","order2","addSection","header","validateSection","section","items","set","addItem","item","sectionKey","validateItem","push","has","Error","some","_","_order"],"sources":["../../src/utils/menu-handler.js"],"sourcesContent":["export default function menuHandler() {\n const menuSections = new Map();\n\n function getSection(key) {\n return menuSections.get(key);\n }\n\n function getAll() {\n return Array.from(menuSections.entries()).sort(\n ([, { order: order1 }], [, { order: order2 }]) => (order1 > order2 ? 1 : -1)\n );\n }\n\n function addSection(key, { header, order }) {\n validateSection(key, order);\n const section = {\n header,\n order,\n items: []\n };\n menuSections.set(key, section);\n }\n\n function addItem(item, sectionKey) {\n validateItem(sectionKey);\n const section = menuSections.get(sectionKey);\n section.items.push(item);\n }\n\n function validateItem(key) {\n if (!menuSections.has(key)) throw new Error(`Section ${key} doesn\\'t exist`);\n }\n\n function validateSection(key, order) {\n if (!key) throw new Error('Section requires a key');\n if (menuSections.has(key)) throw new Error(`Section with ${key} has been already added`);\n if (Array.from(menuSections.entries()).some(([_, { order: _order }]) => _order === order)) {\n throw new Error('Section with this order has already been added');\n }\n }\n\n return {\n addSection,\n addItem,\n getSection,\n getAll\n };\n}\n"],"mappings":"AAAA,eAAe,SAASA,WAAWA,CAAA,EAAG;EACpC,MAAMC,YAAY,GAAG,IAAIC,GAAG,CAAC,CAAC;EAE9B,SAASC,UAAUA,CAACC,GAAG,EAAE;IACvB,OAAOH,YAAY,CAACI,GAAG,CAACD,GAAG,CAAC;EAC9B;EAEA,SAASE,MAAMA,CAAA,EAAG;IAChB,OAAOC,KAAK,CAACC,IAAI,CAACP,YAAY,CAACQ,OAAO,CAAC,CAAC,CAAC,CAACC,IAAI,CAC5C,CAAC,GAAG;MAAEC,KAAK,EAAEC;IAAO,CAAC,CAAC,EAAE,GAAG;MAAED,KAAK,EAAEE;IAAO,CAAC,CAAC,KAAMD,MAAM,GAAGC,MAAM,GAAG,CAAC,GAAG,CAAC,CAC5E,CAAC;EACH;EAEA,SAASC,UAAUA,CAACV,GAAG,EAAE;IAAEW,MAAM;IAAEJ;EAAM,CAAC,EAAE;IAC1CK,eAAe,CAACZ,GAAG,EAAEO,KAAK,CAAC;IAC3B,MAAMM,OAAO,GAAG;MACdF,MAAM;MACNJ,KAAK;MACLO,KAAK,EAAE;IACT,CAAC;IACDjB,YAAY,CAACkB,GAAG,CAACf,GAAG,EAAEa,OAAO,CAAC;EAChC;EAEA,SAASG,OAAOA,CAACC,IAAI,EAAEC,UAAU,EAAE;IACjCC,YAAY,CAACD,UAAU,CAAC;IACxB,MAAML,OAAO,GAAGhB,YAAY,CAACI,GAAG,CAACiB,UAAU,CAAC;IAC5CL,OAAO,CAACC,KAAK,CAACM,IAAI,CAACH,IAAI,CAAC;EAC1B;EAEA,SAASE,YAAYA,CAACnB,GAAG,EAAE;IACzB,IAAI,CAACH,YAAY,CAACwB,GAAG,CAACrB,GAAG,CAAC,EAAE,MAAM,IAAIsB,KAAK,CAAC,WAAWtB,GAAG,iBAAiB,CAAC;EAC9E;EAEA,SAASY,eAAeA,CAACZ,GAAG,EAAEO,KAAK,EAAE;IACnC,IAAI,CAACP,GAAG,EAAE,MAAM,IAAIsB,KAAK,CAAC,wBAAwB,CAAC;IACnD,IAAIzB,YAAY,CAACwB,GAAG,CAACrB,GAAG,CAAC,EAAE,MAAM,IAAIsB,KAAK,CAAC,gBAAgBtB,GAAG,yBAAyB,CAAC;IACxF,IAAIG,KAAK,CAACC,IAAI,CAACP,YAAY,CAACQ,OAAO,CAAC,CAAC,CAAC,CAACkB,IAAI,CAAC,CAAC,CAACC,CAAC,EAAE;MAAEjB,KAAK,EAAEkB;IAAO,CAAC,CAAC,KAAKA,MAAM,KAAKlB,KAAK,CAAC,EAAE;MACzF,MAAM,IAAIe,KAAK,CAAC,gDAAgD,CAAC;IACnE;EACF;EAEA,OAAO;IACLZ,UAAU;IACVM,OAAO;IACPjB,UAAU;IACVG;EACF,CAAC;AACH","ignoreList":[]}