@buerli.io/core 1.0.1-beta.2 → 1.1.0-beta.7

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateMessage = exports.showMessage = exports.init = exports.getPlugin = exports.getDrawing = exports.api = exports.createGraphicItem = exports.BuerliScope = exports.BuerliMessageScope = void 0;
3
+ exports.closeMessage = exports.updateMessage = exports.showMessage = exports.init = exports.getPlugin = exports.getDrawing = exports.api = exports.createGraphicItem = exports.BuerliScope = exports.BuerliMessageScope = void 0;
4
4
  const store_1 = require("./store");
5
5
  function getDrawing(id) {
6
6
  const { drawing } = store_1.api.getState();
@@ -28,6 +28,10 @@ function updateMessage(id, message) {
28
28
  store_1.api.getState().message.api.update(id, message);
29
29
  }
30
30
  exports.updateMessage = updateMessage;
31
+ function closeMessage(id) {
32
+ store_1.api.getState().message.api.close(id);
33
+ }
34
+ exports.closeMessage = closeMessage;
31
35
  var message_1 = require("./states/message");
32
36
  Object.defineProperty(exports, "BuerliMessageScope", { enumerable: true, get: function () { return message_1.BuerliMessageScope; } });
33
37
  var selection_1 = require("./states/selection");
@@ -22,4 +22,11 @@ const messageApi = (set, get, api) => ({
22
22
  const msg = get().message;
23
23
  set({ message: Object.assign(Object.assign({}, msg), { data: Object.assign({ id }, message), timestamp: Date.now() }) });
24
24
  },
25
+ close(id) {
26
+ var _a;
27
+ const msg = get().message;
28
+ if (((_a = msg.data) === null || _a === void 0 ? void 0 : _a.id) === id) {
29
+ set({ message: Object.assign(Object.assign({}, msg), { data: null, timestamp: Date.now() }) });
30
+ }
31
+ },
25
32
  });
@@ -20,7 +20,10 @@ function showMessage(message) {
20
20
  function updateMessage(id, message) {
21
21
  api.getState().message.api.update(id, message);
22
22
  }
23
+ function closeMessage(id) {
24
+ api.getState().message.api.close(id);
25
+ }
23
26
  export { BuerliMessageScope } from './states/message';
24
27
  export { BuerliScope, createGraphicItem } from './states/selection';
25
28
  export { api } from './store';
26
- export { getDrawing, getPlugin, init, showMessage, updateMessage };
29
+ export { getDrawing, getPlugin, init, showMessage, updateMessage, closeMessage };
@@ -18,4 +18,11 @@ const messageApi = (set, get, api) => ({
18
18
  const msg = get().message;
19
19
  set({ message: Object.assign(Object.assign({}, msg), { data: Object.assign({ id }, message), timestamp: Date.now() }) });
20
20
  },
21
+ close(id) {
22
+ var _a;
23
+ const msg = get().message;
24
+ if (((_a = msg.data) === null || _a === void 0 ? void 0 : _a.id) === id) {
25
+ set({ message: Object.assign(Object.assign({}, msg), { data: null, timestamp: Date.now() }) });
26
+ }
27
+ },
21
28
  });
@@ -10,7 +10,8 @@ declare function getPlugin(drawingId: DrawingID, pluginId: PluginID): PluginStat
10
10
  declare function init(options?: Partial<BuerliState['options']>): void;
11
11
  declare function showMessage(message: Message): MessageID;
12
12
  declare function updateMessage(id: MessageID, message: Message): void;
13
+ declare function closeMessage(id: MessageID): void;
13
14
  export { BuerliMessageScope } from './states/message';
14
15
  export { BuerliScope, createGraphicItem } from './states/selection';
15
16
  export { api } from './store';
16
- export { getDrawing, getPlugin, init, showMessage, updateMessage };
17
+ export { getDrawing, getPlugin, init, showMessage, updateMessage, closeMessage };
@@ -12,6 +12,7 @@ export declare type Message = {
12
12
  type?: 'error' | 'success' | 'info' | 'warning' | 'busy';
13
13
  source?: 'client' | 'server';
14
14
  drawingId?: DrawingID;
15
+ duration?: number;
15
16
  };
16
17
  export declare type MessageState = {
17
18
  message: {
@@ -26,5 +27,6 @@ export declare const getInitialMessageState: (set: StoreApi<BuerliState>['setSta
26
27
  declare const messageApi: (set: StoreApi<BuerliState>['setState'], get: StoreApi<BuerliState>['getState'], api: StoreApi<BuerliState>) => {
27
28
  show(message: Message): MessageID;
28
29
  update(id: MessageID, message: Message): void;
30
+ close(id: MessageID): void;
29
31
  };
30
32
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/core",
3
- "version": "1.0.1-beta.2",
3
+ "version": "1.1.0-beta.7",
4
4
  "description": "buerli state management",
5
5
  "author": "AWV Informatik AG <info@awv-informatik.ch>",
6
6
  "license": "ISC",
@@ -33,7 +33,7 @@
33
33
  "typescript": "4.8.4"
34
34
  },
35
35
  "dependencies": {
36
- "@classcad/api-js": "https://awvstatic.com/classcad/download/release/21.0.0/classcad-api-js-21.0.0.tgz",
36
+ "@classcad/api-js": "https://awvstatic.com/classcad/download/release/21.2.0/js/classcad-api-js-21.2.0.tgz",
37
37
  "fast-json-patch": "^3.1.1",
38
38
  "jsonpatch": "^3.1.0",
39
39
  "uuid": "^9.0.0",