@teambit/notifications 0.0.800 → 0.0.803

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.
@@ -169,7 +169,9 @@ class NotificationUI {
169
169
  uiRuntimeExtension.registerHudItem( /*#__PURE__*/_react().default.createElement(this.render, {
170
170
  key: "NotificationUI"
171
171
  }));
172
- uiRuntimeExtension.registerContext(this.renderContext);
172
+ uiRuntimeExtension.registerRenderHooks({
173
+ reactContext: this.renderContext
174
+ });
173
175
  }
174
176
 
175
177
  /** removes/archives a message from the log */
@@ -1 +1 @@
1
- {"version":3,"names":["NotificationUI","provider","uiRuntimeExtension","constructor","message","level","id","v1","dispatch","type","content","time","Date","toISOString","add","MessageLevel","info","warning","error","success","props","messages","useReducer","notificationReducer","children","registerHudItem","registerContext","renderContext","dismiss","UIAspect","UIRuntime","NotificationsAspect","addRuntime"],"sources":["notification.ui.runtime.tsx"],"sourcesContent":["import { UIAspect, UIRuntime, UiUI } from '@teambit/ui';\nimport React, { ReactNode, useReducer } from 'react';\nimport { v1 } from 'uuid';\n\nimport { NotificationContext } from '@teambit/ui-foundation.ui.notifications.notification-context';\nimport {\n NotificationCenter,\n NotificationCenterProps,\n} from '@teambit/ui-foundation.ui.notifications.notification-center';\nimport { MessageLevel, NotificationsStore } from '@teambit/ui-foundation.ui.notifications.store';\nimport { NotificationAction, notificationReducer } from './notification-reducer';\nimport { NotificationsAspect } from './notifications.aspect';\n\n/**\n * extension\n */\nexport default class NotificationUI implements NotificationsStore {\n static dependencies = [UIAspect];\n\n static runtime = UIRuntime;\n\n static async provider([uiRuntimeExtension]: [UiUI]) {\n return new NotificationUI(uiRuntimeExtension);\n }\n\n constructor(uiRuntimeExtension: UiUI) {\n uiRuntimeExtension.registerHudItem(<this.render key=\"NotificationUI\" />);\n uiRuntimeExtension.registerContext(this.renderContext);\n }\n\n private dispatch?: React.Dispatch<NotificationAction>;\n\n /** adds a full message to the log */\n add = (message: string, level: MessageLevel) => {\n const id = v1();\n\n this.dispatch?.({\n type: 'add',\n content: {\n id,\n message,\n level,\n time: new Date().toISOString(),\n },\n });\n\n return id;\n };\n\n /** removes/archives a message from the log */\n dismiss(id: string) {\n this.dispatch?.({\n type: 'dismiss',\n id,\n });\n }\n\n /** adds a message with level \"info\" to the log */\n log = (message: string) => this.add(message, MessageLevel.info);\n /** adds a message with level \"warning\" to the log */\n warn = (message: string) => this.add(message, MessageLevel.warning);\n /** adds a message with level \"error\" to the log */\n error = (message: string) => this.add(message, MessageLevel.error);\n /** adds a message with level \"success\" to the log */\n success = (message: string) => this.add(message, MessageLevel.success);\n\n /** removes all notifications */\n clear = () => {\n this.dispatch?.({\n type: 'clear',\n });\n };\n\n private render = (props: Omit<NotificationCenterProps, 'notifications'>) => {\n // this code assumes a single place of render per instance of NotificationUI\n const [messages, dispatch] = useReducer(notificationReducer, []);\n this.dispatch = dispatch;\n\n return <NotificationCenter {...props} notifications={messages} />;\n };\n\n private renderContext = ({ children }: { children: ReactNode }) => {\n return <NotificationContext.Provider value={this}>{children}</NotificationContext.Provider>;\n };\n}\n\nNotificationsAspect.addRuntime(NotificationUI);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AAEA;AACA;AACA;AACe,MAAMA,cAAN,CAAmD;EAK3C,aAARC,QAAQ,CAAC,CAACC,kBAAD,CAAD,EAA+B;IAClD,OAAO,IAAI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ArC,GAA4CA,QAA5C,CAAP;IACD,CA1DqC;IACpCtB,kBAAkB,CAACuB,eAAnB,eAAmC,oCAAM,MAAN;MAAa,GAAG,EAAC;IAAjB,EAAnC;IACAvB,kBAAkB,CAACwB,eAAnB,CAAmC,KAAKC,aAAxC;EACD;;EAqBD;EACAC,OAAO,CAACtB,EAAD,EAAa;IAAA;;IAClB,wBAAKE,QAAL,+EAAgB;MACdC,IAAI,EAAE,SADQ;MAEdH;IAFc,CAAhB;EAID;EAED;;;AAzCgE;;;gCAA7CN,c,kBACG,CAAC6B,cAAD,C;gCADH7B,c,aAGF8B,e;;AAmEnBC,oCAAA,CAAoBC,UAApB,CAA+BhC,cAA/B"}
1
+ {"version":3,"names":["NotificationUI","provider","uiRuntimeExtension","constructor","message","level","id","v1","dispatch","type","content","time","Date","toISOString","add","MessageLevel","info","warning","error","success","props","messages","useReducer","notificationReducer","children","registerHudItem","registerRenderHooks","reactContext","renderContext","dismiss","UIAspect","UIRuntime","NotificationsAspect","addRuntime"],"sources":["notification.ui.runtime.tsx"],"sourcesContent":["import { UIAspect, UIRuntime, UiUI } from '@teambit/ui';\nimport React, { ReactNode, useReducer } from 'react';\nimport { v1 } from 'uuid';\n\nimport { NotificationContext } from '@teambit/ui-foundation.ui.notifications.notification-context';\nimport {\n NotificationCenter,\n NotificationCenterProps,\n} from '@teambit/ui-foundation.ui.notifications.notification-center';\nimport { MessageLevel, NotificationsStore } from '@teambit/ui-foundation.ui.notifications.store';\nimport { NotificationAction, notificationReducer } from './notification-reducer';\nimport { NotificationsAspect } from './notifications.aspect';\n\n/**\n * extension\n */\nexport default class NotificationUI implements NotificationsStore {\n static dependencies = [UIAspect];\n\n static runtime = UIRuntime;\n\n static async provider([uiRuntimeExtension]: [UiUI]) {\n return new NotificationUI(uiRuntimeExtension);\n }\n\n constructor(uiRuntimeExtension: UiUI) {\n uiRuntimeExtension.registerHudItem(<this.render key=\"NotificationUI\" />);\n uiRuntimeExtension.registerRenderHooks({ reactContext: this.renderContext });\n }\n\n private dispatch?: React.Dispatch<NotificationAction>;\n\n /** adds a full message to the log */\n add = (message: string, level: MessageLevel) => {\n const id = v1();\n\n this.dispatch?.({\n type: 'add',\n content: {\n id,\n message,\n level,\n time: new Date().toISOString(),\n },\n });\n\n return id;\n };\n\n /** removes/archives a message from the log */\n dismiss(id: string) {\n this.dispatch?.({\n type: 'dismiss',\n id,\n });\n }\n\n /** adds a message with level \"info\" to the log */\n log = (message: string) => this.add(message, MessageLevel.info);\n /** adds a message with level \"warning\" to the log */\n warn = (message: string) => this.add(message, MessageLevel.warning);\n /** adds a message with level \"error\" to the log */\n error = (message: string) => this.add(message, MessageLevel.error);\n /** adds a message with level \"success\" to the log */\n success = (message: string) => this.add(message, MessageLevel.success);\n\n /** removes all notifications */\n clear = () => {\n this.dispatch?.({\n type: 'clear',\n });\n };\n\n private render = (props: Omit<NotificationCenterProps, 'notifications'>) => {\n // this code assumes a single place of render per instance of NotificationUI\n const [messages, dispatch] = useReducer(notificationReducer, []);\n this.dispatch = dispatch;\n\n return <NotificationCenter {...props} notifications={messages} />;\n };\n\n private renderContext = ({ children }: { children: ReactNode }) => {\n return <NotificationContext.Provider value={this}>{children}</NotificationContext.Provider>;\n };\n}\n\nNotificationsAspect.addRuntime(NotificationUI);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AAEA;AACA;AACA;AACe,MAAM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EG;IAAF,CAAD,KAA2C;MACjE,oBAAO,+BAAC,kDAAD,CAAqB,QAArB;QAA8B,KAAK,EAAE;MAArC,GAA4CA,QAA5C,CAAP;IACD,CA1DqC;IACpCtB,kBAAkB,CAACuB,eAAnB,eAAmC,oCAAM,MAAN;MAAa,GAAG,EAAC;IAAjB,EAAnC;IACAvB,kBAAkB,CAACwB,mBAAnB,CAAuC;MAAEC,YAAY,EAAE,KAAKC;IAArB,CAAvC;EACD;;EAqBD;EACAC,OAAO,CAACvB,EAAD,EAAa;IAAA;;IAClB,wBAAKE,QAAL,+EAAgB;MACdC,IAAI,EAAE,SADQ;MAEdH;IAFc,CAAhB;EAID;EAED;;;AAzCgE;;;gCAA7CN,c,kBACG,CAAC8B,cAAD,C;gCADH9B,c,aAGF+B,e;;AAmEnBC,oCAAA,CAAoBC,UAApB,CAA+BjC,cAA/B"}
@@ -25,7 +25,7 @@ export default class NotificationUI implements NotificationsStore {
25
25
 
26
26
  constructor(uiRuntimeExtension: UiUI) {
27
27
  uiRuntimeExtension.registerHudItem(<this.render key="NotificationUI" />);
28
- uiRuntimeExtension.registerContext(this.renderContext);
28
+ uiRuntimeExtension.registerRenderHooks({ reactContext: this.renderContext });
29
29
  }
30
30
 
31
31
  private dispatch?: React.Dispatch<NotificationAction>;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/notifications",
3
- "version": "0.0.800",
3
+ "version": "0.0.803",
4
4
  "homepage": "https://bit.dev/teambit/ui-foundation/notifications",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.ui-foundation",
8
8
  "name": "notifications",
9
- "version": "0.0.800"
9
+ "version": "0.0.803"
10
10
  },
11
11
  "dependencies": {
12
12
  "uuid": "8.3.2",
@@ -16,7 +16,7 @@
16
16
  "@teambit/ui-foundation.ui.notifications.store": "0.0.486",
17
17
  "@teambit/ui-foundation.ui.notifications.notification-center": "0.0.498",
18
18
  "@teambit/ui-foundation.ui.notifications.notification-context": "0.0.487",
19
- "@teambit/ui": "0.0.800"
19
+ "@teambit/ui": "0.0.803"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/react": "^17.0.8",
@@ -28,7 +28,7 @@
28
28
  "@types/node": "12.20.4"
29
29
  },
30
30
  "peerDependencies": {
31
- "@teambit/legacy": "1.0.314",
31
+ "@teambit/legacy": "1.0.317",
32
32
  "react-dom": "^16.8.0 || ^17.0.0",
33
33
  "react": "^16.8.0 || ^17.0.0"
34
34
  },