@semcore/notice-bubble 3.2.1 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [3.2.2] - 2021-8-26
6
+
7
+ ### Fixed
8
+
9
+ - Remove `console.log`.
10
+
5
11
  ## [3.2.1] - 2021-8-26
6
12
 
7
13
  ### Changed
@@ -60,18 +60,18 @@ var style = (
60
60
  /*__reshadow_css_start__*/
61
61
  _core.sstyled.insert(
62
62
  /*__inner_css_start__*/
63
- ".___SInfo_ia073_gg_,.___SView_ia073_gg_,.___SWarning_ia073_gg_{position:relative;margin-bottom:12px;padding:12px 24px 12px 12px;width:100%;min-height:42px;border-radius:3px;overflow:hidden;box-sizing:border-box}.___SInfo_ia073_gg_{background:#333}.___SWarning_ia073_gg_{background:#ff7f00}.___SMessage_ia073_gg_{font-size:12px;color:#fff;line-height:1.5}.___SDismiss_ia073_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#757575}.___SDismiss_ia073_gg_:hover{color:#ccc}.___SAction_ia073_gg_{margin-top:8px}.___SNoticeBubble_ia073_gg_{width:300px;position:fixed;z-index:1010;right:10px;top:10px}@media (max-width:767px){.___SNoticeBubble_ia073_gg_{width:calc(100% - 20px)}}"
63
+ ".___SInfo_1t051_gg_,.___SView_1t051_gg_,.___SWarning_1t051_gg_{position:relative;margin-bottom:12px;padding:12px 24px 12px 12px;width:100%;min-height:42px;border-radius:3px;overflow:hidden;box-sizing:border-box}.___SInfo_1t051_gg_{background:#333}.___SWarning_1t051_gg_{background:#ff7f00}.___SMessage_1t051_gg_{font-size:12px;color:#fff;line-height:1.5}.___SDismiss_1t051_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#757575}.___SDismiss_1t051_gg_:hover{color:#ccc}.___SAction_1t051_gg_{margin-top:8px}.___SNoticeBubble_1t051_gg_{width:300px;position:fixed;z-index:1010;right:10px;top:10px}@media (max-width:767px){.___SNoticeBubble_1t051_gg_{width:calc(100% - 20px)}}"
64
64
  /*__inner_css_end__*/
65
65
  , "1nxod8h_gg_")
66
66
  /*__reshadow_css_end__*/
67
67
  , {
68
- "__SInfo": "___SInfo_ia073_gg_",
69
- "__SView": "___SView_ia073_gg_",
70
- "__SWarning": "___SWarning_ia073_gg_",
71
- "__SMessage": "___SMessage_ia073_gg_",
72
- "__SDismiss": "___SDismiss_ia073_gg_",
73
- "__SAction": "___SAction_ia073_gg_",
74
- "__SNoticeBubble": "___SNoticeBubble_ia073_gg_"
68
+ "__SInfo": "___SInfo_1t051_gg_",
69
+ "__SView": "___SView_1t051_gg_",
70
+ "__SWarning": "___SWarning_1t051_gg_",
71
+ "__SMessage": "___SMessage_1t051_gg_",
72
+ "__SDismiss": "___SDismiss_1t051_gg_",
73
+ "__SAction": "___SAction_1t051_gg_",
74
+ "__SNoticeBubble": "___SNoticeBubble_1t051_gg_"
75
75
  });
76
76
  var animationNotice = (
77
77
  /*__reshadow_css_start__*/
@@ -44,16 +44,9 @@ var NoticeBubbleManager = /*#__PURE__*/function () {
44
44
  return _objectSpread(_objectSpread({
45
45
  type: 'info'
46
46
  }, props), {}, {
47
- // onClose: function(e) {
48
- // return callAllEventHandlers(props.onClose, () => {
49
- // if (this.props.visible === undefined) {
50
- // manager.remove(this.props.uid);
51
- // }
52
- // })(e);
53
- // },
54
47
  onClose: (0, _assignProps.callAllEventHandlers)(props.onClose, function () {
55
48
  if (props.visible === undefined) {
56
- console.log(manager.remove(props.uid));
49
+ manager.remove(props.uid);
57
50
  }
58
51
  })
59
52
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/NoticeBubbleManager.js"],"names":["EVENT_NAME","NoticeBubbleManager","emitter","EventEmitter","fn","subscribe","props","manager","type","onClose","visible","undefined","console","log","remove","uid","emit","items","counter","item","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AAL,CAAYS,IAAZ,CAAiB,IAAjB,EAAuBR,GAAvB;AAHH,OAAP;AAKD;;;WAED,gBAAOA,GAAP,EAAYT,KAAZ,EAAmB;AACjB,UAAMkB,KAAK,GAAG,KAAKP,KAAL,CAAWQ,SAAX,CAAqB,UAACN,IAAD;AAAA,eAAUA,IAAI,CAACJ,GAAL,KAAaA,GAAvB;AAAA,OAArB,CAAd;;AACA,UAAIS,KAAK,KAAK,CAAC,CAAf,EAAkB;AAChB,aAAKP,KAAL,CAAWO,KAAX,IAAoB,KAAKJ,UAAL,iCACf,KAAKH,KAAL,CAAWO,KAAX,CADe,GAEflB,KAFe,EAApB;AAIA,aAAKU,IAAL;AACA,eAAO,IAAP;AACD;;AACD,aAAO,KAAP;AACD;;;WAED,gBAAOD,GAAP,EAAY;AACV,UAAMS,KAAK,GAAG,KAAKP,KAAL,CAAWQ,SAAX,CAAqB,UAACN,IAAD;AAAA,eAAUA,IAAI,CAACJ,GAAL,KAAaA,GAAvB;AAAA,OAArB,CAAd;;AACA,UAAIS,KAAK,KAAK,CAAC,CAAf,EAAkB;AAChB,aAAKP,KAAL,CAAWS,MAAX,CAAkBF,KAAlB,EAAyB,CAAzB;AACA,aAAKR,IAAL;AACA,eAAO,IAAP;AACD;;AACD,aAAO,KAAP;AACD;;;;;;;eAIY,IAAIf,mBAAJ,E","sourcesContent":["import EventEmitter from '@semcore/utils/lib/eventEmitter';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\nconst EVENT_NAME = 'CHANGE';\n\nclass NoticeBubbleManager {\n items = [];\n emitter = null;\n counter = 0;\n\n constructor() {\n this.emitter = new EventEmitter();\n }\n\n addListener(fn) {\n return this.emitter.subscribe(EVENT_NAME, fn);\n }\n\n createItem(props) {\n const manager = this;\n\n return {\n type: 'info',\n ...props,\n // onClose: function(e) {\n // return callAllEventHandlers(props.onClose, () => {\n // if (this.props.visible === undefined) {\n // manager.remove(this.props.uid);\n // }\n // })(e);\n // },\n onClose: callAllEventHandlers(props.onClose, () => {\n if (props.visible === undefined) {\n console.log(manager.remove(props.uid));\n }\n }),\n };\n }\n\n emit() {\n this.emitter.emit(EVENT_NAME, this.items);\n }\n\n add(props) {\n const uid = this.counter++\n const item = this.createItem({uid, ...props});\n this.items.push(item);\n this.emit();\n return {\n uid,\n update: this.update.bind(this, uid),\n remove: this.remove.bind(this, uid),\n };\n }\n\n update(uid, props) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index] = this.createItem({\n ...this.items[index],\n ...props,\n });\n this.emit();\n return true;\n }\n return false;\n }\n\n remove(uid) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items.splice(index, 1);\n this.emit();\n return true;\n }\n return false;\n }\n}\n\nexport { NoticeBubbleManager };\nexport default new NoticeBubbleManager();\n"],"file":"NoticeBubbleManager.js"}
1
+ {"version":3,"sources":["../../src/NoticeBubbleManager.js"],"names":["EVENT_NAME","NoticeBubbleManager","emitter","EventEmitter","fn","subscribe","props","manager","type","onClose","visible","undefined","remove","uid","emit","items","counter","item","createItem","push","update","bind","index","findIndex","splice"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA,IAAMA,UAAU,GAAG,QAAnB;;IAEMC,mB;AAKJ,iCAAc;AAAA;AAAA,oDAJN,EAIM;AAAA,sDAHJ,IAGI;AAAA,sDAFJ,CAEI;AACZ,SAAKC,OAAL,GAAe,IAAIC,wBAAJ,EAAf;AACD;;;;WAED,qBAAYC,EAAZ,EAAgB;AACd,aAAO,KAAKF,OAAL,CAAaG,SAAb,CAAuBL,UAAvB,EAAmCI,EAAnC,CAAP;AACD;;;WAED,oBAAWE,KAAX,EAAkB;AAChB,UAAMC,OAAO,GAAG,IAAhB;AAEA;AACEC,QAAAA,IAAI,EAAE;AADR,SAEKF,KAFL;AAGEG,QAAAA,OAAO,EAAE,uCAAqBH,KAAK,CAACG,OAA3B,EAAoC,YAAM;AACjD,cAAIH,KAAK,CAACI,O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Ad;;AACA,UAAIS,KAAK,KAAK,CAAC,CAAf,EAAkB;AAChB,aAAKP,KAAL,CAAWS,MAAX,CAAkBF,KAAlB,EAAyB,CAAzB;AACA,aAAKR,IAAL;AACA,eAAO,IAAP;AACD;;AACD,aAAO,KAAP;AACD;;;;;;;eAIY,IAAIb,mBAAJ,E","sourcesContent":["import EventEmitter from '@semcore/utils/lib/eventEmitter';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\nconst EVENT_NAME = 'CHANGE';\n\nclass NoticeBubbleManager {\n items = [];\n emitter = null;\n counter = 0;\n\n constructor() {\n this.emitter = new EventEmitter();\n }\n\n addListener(fn) {\n return this.emitter.subscribe(EVENT_NAME, fn);\n }\n\n createItem(props) {\n const manager = this;\n\n return {\n type: 'info',\n ...props,\n onClose: callAllEventHandlers(props.onClose, () => {\n if (props.visible === undefined) {\n manager.remove(props.uid);\n }\n }),\n };\n }\n\n emit() {\n this.emitter.emit(EVENT_NAME, this.items);\n }\n\n add(props) {\n const uid = this.counter++;\n const item = this.createItem({ uid, ...props });\n this.items.push(item);\n this.emit();\n return {\n uid,\n update: this.update.bind(this, uid),\n remove: this.remove.bind(this, uid),\n };\n }\n\n update(uid, props) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index] = this.createItem({\n ...this.items[index],\n ...props,\n });\n this.emit();\n return true;\n }\n return false;\n }\n\n remove(uid) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items.splice(index, 1);\n this.emit();\n return true;\n }\n return false;\n }\n}\n\nexport { NoticeBubbleManager };\nexport default new NoticeBubbleManager();\n"],"file":"NoticeBubbleManager.js"}
@@ -34,18 +34,18 @@ var style = (
34
34
  /*__reshadow_css_start__*/
35
35
  _sstyled.insert(
36
36
  /*__inner_css_start__*/
37
- ".___SInfo_ia073_gg_,.___SView_ia073_gg_,.___SWarning_ia073_gg_{position:relative;margin-bottom:12px;padding:12px 24px 12px 12px;width:100%;min-height:42px;border-radius:3px;overflow:hidden;box-sizing:border-box}.___SInfo_ia073_gg_{background:#333}.___SWarning_ia073_gg_{background:#ff7f00}.___SMessage_ia073_gg_{font-size:12px;color:#fff;line-height:1.5}.___SDismiss_ia073_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#757575}.___SDismiss_ia073_gg_:hover{color:#ccc}.___SAction_ia073_gg_{margin-top:8px}.___SNoticeBubble_ia073_gg_{width:300px;position:fixed;z-index:1010;right:10px;top:10px}@media (max-width:767px){.___SNoticeBubble_ia073_gg_{width:calc(100% - 20px)}}"
37
+ ".___SInfo_1t051_gg_,.___SView_1t051_gg_,.___SWarning_1t051_gg_{position:relative;margin-bottom:12px;padding:12px 24px 12px 12px;width:100%;min-height:42px;border-radius:3px;overflow:hidden;box-sizing:border-box}.___SInfo_1t051_gg_{background:#333}.___SWarning_1t051_gg_{background:#ff7f00}.___SMessage_1t051_gg_{font-size:12px;color:#fff;line-height:1.5}.___SDismiss_1t051_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#757575}.___SDismiss_1t051_gg_:hover{color:#ccc}.___SAction_1t051_gg_{margin-top:8px}.___SNoticeBubble_1t051_gg_{width:300px;position:fixed;z-index:1010;right:10px;top:10px}@media (max-width:767px){.___SNoticeBubble_1t051_gg_{width:calc(100% - 20px)}}"
38
38
  /*__inner_css_end__*/
39
39
  , "1nxod8h_gg_")
40
40
  /*__reshadow_css_end__*/
41
41
  , {
42
- "__SInfo": "___SInfo_ia073_gg_",
43
- "__SView": "___SView_ia073_gg_",
44
- "__SWarning": "___SWarning_ia073_gg_",
45
- "__SMessage": "___SMessage_ia073_gg_",
46
- "__SDismiss": "___SDismiss_ia073_gg_",
47
- "__SAction": "___SAction_ia073_gg_",
48
- "__SNoticeBubble": "___SNoticeBubble_ia073_gg_"
42
+ "__SInfo": "___SInfo_1t051_gg_",
43
+ "__SView": "___SView_1t051_gg_",
44
+ "__SWarning": "___SWarning_1t051_gg_",
45
+ "__SMessage": "___SMessage_1t051_gg_",
46
+ "__SDismiss": "___SDismiss_1t051_gg_",
47
+ "__SAction": "___SAction_1t051_gg_",
48
+ "__SNoticeBubble": "___SNoticeBubble_1t051_gg_"
49
49
  });
50
50
  var animationNotice = (
51
51
  /*__reshadow_css_start__*/
@@ -35,16 +35,9 @@ var NoticeBubbleManager = /*#__PURE__*/function () {
35
35
  return _objectSpread(_objectSpread({
36
36
  type: 'info'
37
37
  }, props), {}, {
38
- // onClose: function(e) {
39
- // return callAllEventHandlers(props.onClose, () => {
40
- // if (this.props.visible === undefined) {
41
- // manager.remove(this.props.uid);
42
- // }
43
- // })(e);
44
- // },
45
38
  onClose: callAllEventHandlers(props.onClose, function () {
46
39
  if (props.visible === undefined) {
47
- console.log(manager.remove(props.uid));
40
+ manager.remove(props.uid);
48
41
  }
49
42
  })
50
43
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/NoticeBubbleManager.js"],"names":["EventEmitter","callAllEventHandlers","EVENT_NAME","NoticeBubbleManager","emitter","fn","subscribe","props","manager","type","onClose","visible","undefined","console","log","remove","uid","emit","items","counter","item","createItem","push","update","bind","index","findIndex","splice"],"mappings":";;;;;;;;AAAA,OAAOA,YAAP,MAAyB,iCAAzB;AACA,SAASC,oBAAT,QAAqC,gCAArC;AAEA,IAAMC,UAAU,GAAG,QAAnB;;IAEMC,mB;AAKJ,iCAAc;AAAA;;AAAA,mCAJN,EAIM;;AAAA,qCAHJ,IAGI;;AAAA,qCAFJ,CAEI;;AACZ,SAAKC,OAAL,GAAe,IAAIJ,YAAJ,EAAf;AACD;;;;WAED,qBAAYK,EAAZ,EAAgB;AACd,aAAO,KAAKD,OAAL,CAAaE,SAAb,CAAuBJ,UAAvB,EAAmCG,EAAnC,CAAP;AACD;;;WAED,oBAAWE,KAAX,EAAkB;AAChB,UAAMC,OAAO,GAAG,IAAhB;AAEA;AACEC,QAAAA,IAAI,EAAE;AADR,SAEKF,KAFL;AAGE;AACA;AACA;AACA;AACA;AACA;AAC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AY;AACV,UAAMS,KAAK,GAAG,KAAKP,KAAL,CAAWQ,SAAX,CAAqB,UAACN,IAAD;AAAA,eAAUA,IAAI,CAACJ,GAAL,KAAaA,GAAvB;AAAA,OAArB,CAAd;;AACA,UAAIS,KAAK,KAAK,CAAC,CAAf,EAAkB;AAChB,aAAKP,KAAL,CAAWS,MAAX,CAAkBF,KAAlB,EAAyB,CAAzB;AACA,aAAKR,IAAL;AACA,eAAO,IAAP;AACD;;AACD,aAAO,KAAP;AACD;;;;;;AAGH,SAASd,mBAAT;AACA,eAAe,IAAIA,mBAAJ,EAAf","sourcesContent":["import EventEmitter from '@semcore/utils/lib/eventEmitter';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\nconst EVENT_NAME = 'CHANGE';\n\nclass NoticeBubbleManager {\n items = [];\n emitter = null;\n counter = 0;\n\n constructor() {\n this.emitter = new EventEmitter();\n }\n\n addListener(fn) {\n return this.emitter.subscribe(EVENT_NAME, fn);\n }\n\n createItem(props) {\n const manager = this;\n\n return {\n type: 'info',\n ...props,\n // onClose: function(e) {\n // return callAllEventHandlers(props.onClose, () => {\n // if (this.props.visible === undefined) {\n // manager.remove(this.props.uid);\n // }\n // })(e);\n // },\n onClose: callAllEventHandlers(props.onClose, () => {\n if (props.visible === undefined) {\n console.log(manager.remove(props.uid));\n }\n }),\n };\n }\n\n emit() {\n this.emitter.emit(EVENT_NAME, this.items);\n }\n\n add(props) {\n const uid = this.counter++\n const item = this.createItem({uid, ...props});\n this.items.push(item);\n this.emit();\n return {\n uid,\n update: this.update.bind(this, uid),\n remove: this.remove.bind(this, uid),\n };\n }\n\n update(uid, props) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index] = this.createItem({\n ...this.items[index],\n ...props,\n });\n this.emit();\n return true;\n }\n return false;\n }\n\n remove(uid) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items.splice(index, 1);\n this.emit();\n return true;\n }\n return false;\n }\n}\n\nexport { NoticeBubbleManager };\nexport default new NoticeBubbleManager();\n"],"file":"NoticeBubbleManager.js"}
1
+ {"version":3,"sources":["../../src/NoticeBubbleManager.js"],"names":["EventEmitter","callAllEventHandlers","EVENT_NAME","NoticeBubbleManager","emitter","fn","subscribe","props","manager","type","onClose","visible","undefined","remove","uid","emit","items","counter","item","createItem","push","update","bind","index","findIndex","splice"],"mappings":";;;;;;;;AAAA,OAAOA,YAAP,MAAyB,iCAAzB;AACA,SAASC,oBAAT,QAAqC,gCAArC;AAEA,IAAMC,UAAU,GAAG,QAAnB;;IAEMC,mB;AAKJ,iCAAc;AAAA;;AAAA,mCAJN,EAIM;;AAAA,qCAHJ,IAGI;;AAAA,qCAFJ,CAEI;;AACZ,SAAKC,OAAL,GAAe,IAAIJ,YAAJ,EAAf;AACD;;;;WAED,qBAAYK,EAAZ,EAAgB;AACd,aAAO,KAAKD,OAAL,CAAaE,SAAb,CAAuBJ,UAAvB,EAAmCG,EAAnC,CAAP;AACD;;;WAED,oBAAWE,KAAX,EAAkB;AAChB,UAAMC,OAAO,GAAG,IAAhB;AAEA;AACEC,QAAAA,IAAI,EAAE;AADR,SAEKF,KAFL;AAGEG,QAAAA,OAAO,EAAET,oBAAoB,CAACM,KAAK,CAACG,OAAP,EAAgB,YAAM;AACjD,cAAIH,KAAK,CAACI,OAAN,KAAkBC,SAAtB,EAAiC;AAC/BJ,YAAAA,OAAO,CAACK,MAAR,CAAeN,KAAK,CAACO,GAArB;AACD;AACF,SAJ4B;AAH/B;AASD;;;WAED,gBAAO;AACL,WAAKV,OAAL,CAAaW,IAAb,CAAkBb,UAAlB,EAA8B,KAAKc,KAAnC;AACD;;;WAED,aAAIT,KAAJ,EAAW;AACT,UAAMO,GAAG,GAAG,KAAKG,OAAL,EAAZ;AACA,UAAMC,IAAI,GAAG,KAAKC,UAAL;AAAkBL,QAAAA,GAAG,EAAHA;AAAlB,SAA0BP,KAA1B,EAAb;AACA,WAAKS,KAAL,CAAWI,IAAX,CAAgBF,IAAhB;AACA,WAAKH,IAAL;AACA,aAAO;AACLD,QAAAA,GAAG,EAAHA,GADK;AAELO,QAAAA,MAAM,EAAE,KAAKA,MAAL,CAAYC,IAAZ,CAAiB,IAAjB,EAAuBR,GAAvB,CAFH;AAGLD,QAAAA,MAAM,EAAE,KAAKA,MAAL,CAAYS,IAAZ,CAAiB,IAAjB,EAAuBR,GAAvB;AAHH,OAAP;AAKD;;;WAED,gBAAOA,GAAP,EAAYP,KAAZ,EAAmB;AACjB,UAAMgB,KAAK,GAAG,KAAKP,KAAL,CAAWQ,SAAX,CAAqB,UAACN,IAAD;AAAA,eAAUA,IAAI,CAACJ,GAAL,KAAaA,GAAvB;AAAA,OAArB,CAAd;;AACA,UAAIS,KAAK,KAAK,CAAC,CAAf,EAAkB;AAChB,aAAKP,KAAL,CAAWO,KAAX,IAAoB,KAAKJ,UAAL,iCACf,KAAKH,KAAL,CAAWO,KAAX,CADe,GAEfhB,KAFe,EAApB;AAIA,aAAKQ,IAAL;AACA,eAAO,IAAP;AACD;;AACD,aAAO,KAAP;AACD;;;WAED,gBAAOD,GAAP,EAAY;AACV,UAAMS,KAAK,GAAG,KAAKP,KAAL,CAAWQ,SAAX,CAAqB,UAACN,IAAD;AAAA,eAAUA,IAAI,CAACJ,GAAL,KAAaA,GAAvB;AAAA,OAArB,CAAd;;AACA,UAAIS,KAAK,KAAK,CAAC,CAAf,EAAkB;AAChB,aAAKP,KAAL,CAAWS,MAAX,CAAkBF,KAAlB,EAAyB,CAAzB;AACA,aAAKR,IAAL;AACA,eAAO,IAAP;AACD;;AACD,aAAO,KAAP;AACD;;;;;;AAGH,SAASZ,mBAAT;AACA,eAAe,IAAIA,mBAAJ,EAAf","sourcesContent":["import EventEmitter from '@semcore/utils/lib/eventEmitter';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\nconst EVENT_NAME = 'CHANGE';\n\nclass NoticeBubbleManager {\n items = [];\n emitter = null;\n counter = 0;\n\n constructor() {\n this.emitter = new EventEmitter();\n }\n\n addListener(fn) {\n return this.emitter.subscribe(EVENT_NAME, fn);\n }\n\n createItem(props) {\n const manager = this;\n\n return {\n type: 'info',\n ...props,\n onClose: callAllEventHandlers(props.onClose, () => {\n if (props.visible === undefined) {\n manager.remove(props.uid);\n }\n }),\n };\n }\n\n emit() {\n this.emitter.emit(EVENT_NAME, this.items);\n }\n\n add(props) {\n const uid = this.counter++;\n const item = this.createItem({ uid, ...props });\n this.items.push(item);\n this.emit();\n return {\n uid,\n update: this.update.bind(this, uid),\n remove: this.remove.bind(this, uid),\n };\n }\n\n update(uid, props) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index] = this.createItem({\n ...this.items[index],\n ...props,\n });\n this.emit();\n return true;\n }\n return false;\n }\n\n remove(uid) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items.splice(index, 1);\n this.emit();\n return true;\n }\n return false;\n }\n}\n\nexport { NoticeBubbleManager };\nexport default new NoticeBubbleManager();\n"],"file":"NoticeBubbleManager.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/notice-bubble",
3
3
  "description": "SEMRush NoticeBubble Component",
4
- "version": "3.2.1",
4
+ "version": "3.2.2",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -22,16 +22,9 @@ class NoticeBubbleManager {
22
22
  return {
23
23
  type: 'info',
24
24
  ...props,
25
- // onClose: function(e) {
26
- // return callAllEventHandlers(props.onClose, () => {
27
- // if (this.props.visible === undefined) {
28
- // manager.remove(this.props.uid);
29
- // }
30
- // })(e);
31
- // },
32
25
  onClose: callAllEventHandlers(props.onClose, () => {
33
26
  if (props.visible === undefined) {
34
- console.log(manager.remove(props.uid));
27
+ manager.remove(props.uid);
35
28
  }
36
29
  }),
37
30
  };
@@ -42,8 +35,8 @@ class NoticeBubbleManager {
42
35
  }
43
36
 
44
37
  add(props) {
45
- const uid = this.counter++
46
- const item = this.createItem({uid, ...props});
38
+ const uid = this.counter++;
39
+ const item = this.createItem({ uid, ...props });
47
40
  this.items.push(item);
48
41
  this.emit();
49
42
  return {