piral-tracker 1.6.0-beta.7216 → 1.6.0-beta.7243

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/lib/Tracker.js CHANGED
@@ -1,19 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Tracker = void 0;
4
- const React = require("react");
5
- const piral_core_1 = require("piral-core");
1
+ import * as React from 'react';
2
+ import { useGlobalState } from 'piral-core';
6
3
  /**
7
4
  * The tracker component. Integrate this in a layout
8
5
  * where all the registered trackers should be active / running.
9
6
  */
10
- const Tracker = () => {
11
- const trackers = (0, piral_core_1.useGlobalState)((m) => m.registry.trackers);
7
+ export const Tracker = () => {
8
+ const trackers = useGlobalState((m) => m.registry.trackers);
12
9
  return (React.createElement(React.Fragment, null, Object.keys(trackers).map((m) => {
13
10
  const Tracker = trackers[m].component;
14
11
  return React.createElement(Tracker, { key: m });
15
12
  })));
16
13
  };
17
- exports.Tracker = Tracker;
18
- exports.Tracker.displayName = 'Tracker';
14
+ Tracker.displayName = 'Tracker';
19
15
  //# sourceMappingURL=Tracker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tracker.js","sourceRoot":"","sources":["../src/Tracker.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,2CAA4C;AAI5C;;;GAGG;AACI,MAAM,OAAO,GAA2B,GAAG,EAAE;IAClD,MAAM,QAAQ,GAAG,IAAA,2BAAc,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE5D,OAAO,CACL,0CACG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/B,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtC,OAAO,oBAAC,OAAO,IAAC,GAAG,EAAE,CAAC,GAAI,CAAC;IAC7B,CAAC,CAAC,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,OAAO,WAWlB;AACF,eAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"Tracker.js","sourceRoot":"","sources":["../src/Tracker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAA2B,GAAG,EAAE;IAClD,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE5D,OAAO,CACL,0CACG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/B,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtC,OAAO,oBAAC,OAAO,IAAC,GAAG,EAAE,CAAC,GAAI,CAAC;IAC7B,CAAC,CAAC,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AACF,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
package/lib/actions.js CHANGED
@@ -1,25 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unregisterTracker = exports.registerTracker = void 0;
4
- const piral_core_1 = require("piral-core");
5
- function registerTracker(ctx, name, value) {
1
+ import { withKey, withoutKey } from 'piral-core';
2
+ export function registerTracker(ctx, name, value) {
6
3
  ctx.dispatch((state) => ({
7
4
  ...state,
8
5
  registry: {
9
6
  ...state.registry,
10
- trackers: (0, piral_core_1.withKey)(state.registry.trackers, name, value),
7
+ trackers: withKey(state.registry.trackers, name, value),
11
8
  },
12
9
  }));
13
10
  }
14
- exports.registerTracker = registerTracker;
15
- function unregisterTracker(ctx, name) {
11
+ export function unregisterTracker(ctx, name) {
16
12
  ctx.dispatch((state) => ({
17
13
  ...state,
18
14
  registry: {
19
15
  ...state.registry,
20
- trackers: (0, piral_core_1.withoutKey)(state.registry.trackers, name),
16
+ trackers: withoutKey(state.registry.trackers, name),
21
17
  },
22
18
  }));
23
19
  }
24
- exports.unregisterTracker = unregisterTracker;
25
20
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;;AAAA,2CAAqE;AAGrE,SAAgB,eAAe,CAAC,GAAuB,EAAE,IAAY,EAAE,KAA0B;IAC/F,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,QAAQ,EAAE,IAAA,oBAAO,EAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC;SACxD;KACF,CAAC,CAAC,CAAC;AACN,CAAC;AARD,0CAQC;AAED,SAAgB,iBAAiB,CAAC,GAAuB,EAAE,IAAY;IACrE,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,QAAQ,EAAE,IAAA,uBAAU,EAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;SACpD;KACF,CAAC,CAAC,CAAC;AACN,CAAC;AARD,8CAQC"}
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAsB,MAAM,YAAY,CAAC;AAGrE,MAAM,UAAU,eAAe,CAAC,GAAuB,EAAE,IAAY,EAAE,KAA0B;IAC/F,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC;SACxD;KACF,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAuB,EAAE,IAAY;IACrE,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;SACpD;KACF,CAAC,CAAC,CAAC;AACN,CAAC"}
package/lib/create.js CHANGED
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createTrackerApi = void 0;
4
- const actions = require("./actions");
5
- const piral_core_1 = require("piral-core");
1
+ import * as actions from './actions';
2
+ import { buildName, withApi } from 'piral-core';
6
3
  /**
7
4
  * Creates the Pilet API extension for activating tracker support.
8
5
  */
9
- function createTrackerApi(config = {}) {
6
+ export function createTrackerApi(config = {}) {
10
7
  return (context) => {
11
8
  context.defineActions(actions);
12
9
  return (api, target) => {
@@ -18,20 +15,19 @@ function createTrackerApi(config = {}) {
18
15
  arg = name;
19
16
  name = next++;
20
17
  }
21
- const id = (0, piral_core_1.buildName)(pilet, name);
18
+ const id = buildName(pilet, name);
22
19
  context.registerTracker(id, {
23
20
  pilet,
24
- component: (0, piral_core_1.withApi)(context, arg, api, 'tracker'),
21
+ component: withApi(context, arg, api, 'tracker'),
25
22
  });
26
23
  return () => api.unregisterTracker(name);
27
24
  },
28
25
  unregisterTracker(name) {
29
- const id = (0, piral_core_1.buildName)(pilet, name);
26
+ const id = buildName(pilet, name);
30
27
  context.unregisterTracker(id);
31
28
  },
32
29
  };
33
30
  };
34
31
  };
35
32
  }
36
- exports.createTrackerApi = createTrackerApi;
37
33
  //# sourceMappingURL=create.js.map
package/lib/create.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,2CAA6D;AAQ7D;;GAEG;AACH,SAAgB,gBAAgB,CAAC,SAAwB,EAAE;IACzD,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE/B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACrB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;YAC1B,IAAI,IAAI,GAAG,CAAC,CAAC;YAEb,OAAO;gBACL,eAAe,CAAC,IAAI,EAAE,GAAI;oBACxB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;wBAC5B,GAAG,GAAG,IAAI,CAAC;wBACX,IAAI,GAAG,IAAI,EAAE,CAAC;qBACf;oBAED,MAAM,EAAE,GAAG,IAAA,sBAAS,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE;wBAC1B,KAAK;wBACL,SAAS,EAAE,IAAA,oBAAO,EAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC;qBACjD,CAAC,CAAC;oBACH,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBAC3C,CAAC;gBACD,iBAAiB,CAAC,IAAI;oBACpB,MAAM,EAAE,GAAG,IAAA,sBAAS,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;gBAChC,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AA7BD,4CA6BC"}
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AAQ7D;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAwB,EAAE;IACzD,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE/B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACrB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;YAC1B,IAAI,IAAI,GAAG,CAAC,CAAC;YAEb,OAAO;gBACL,eAAe,CAAC,IAAI,EAAE,GAAI;oBACxB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;wBAC5B,GAAG,GAAG,IAAI,CAAC;wBACX,IAAI,GAAG,IAAI,EAAE,CAAC;qBACf;oBAED,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE;wBAC1B,KAAK;wBACL,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC;qBACjD,CAAC,CAAC;oBACH,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBAC3C,CAAC;gBACD,iBAAiB,CAAC,IAAI;oBACpB,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;gBAChC,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
package/lib/index.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./create"), exports);
5
- tslib_1.__exportStar(require("./Tracker"), exports);
6
- tslib_1.__exportStar(require("./types"), exports);
1
+ export * from './create';
2
+ export * from './Tracker';
3
+ export * from './types';
7
4
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,oDAA0B;AAC1B,kDAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
package/lib/types.js CHANGED
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-tracker",
3
- "version": "1.6.0-beta.7216",
3
+ "version": "1.6.0-beta.7243",
4
4
  "description": "Plugin for registering always-on components in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -17,29 +17,16 @@
17
17
  "author": "smapiot",
18
18
  "homepage": "https://piral.io",
19
19
  "license": "MIT",
20
- "module": "esm/index.js",
20
+ "module": "lib/index.js",
21
21
  "main": "lib/index.js",
22
22
  "typings": "lib/index.d.ts",
23
23
  "exports": {
24
- ".": {
25
- "import": "./esm/index.js",
26
- "require": "./lib/index.js"
27
- },
28
- "./esm/*": {
29
- "import": "./esm/*"
30
- },
31
- "./lib/*": {
32
- "require": "./lib/*"
33
- },
34
- "./_/*": {
35
- "import": "./esm/*.js",
36
- "require": "./lib/*.js"
37
- },
24
+ ".": "./lib/index.js",
25
+ "./lib/*": "./lib/*",
38
26
  "./package.json": "./package.json"
39
27
  },
40
28
  "sideEffects": false,
41
29
  "files": [
42
- "esm",
43
30
  "lib",
44
31
  "src",
45
32
  "piral-tracker.min.js"
@@ -53,18 +40,17 @@
53
40
  },
54
41
  "scripts": {
55
42
  "cleanup": "rimraf esm lib piral-tracker.min.js",
56
- "build": "yarn build:bundle && yarn build:commonjs && yarn build:esnext",
43
+ "build": "yarn build:bundle && yarn build:esnext",
57
44
  "build:bundle": "esbuild src/index.ts --outfile=piral-tracker.min.js --bundle --external:piral-core --external:react --minify --global-name=piralTracker",
58
- "build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
59
- "build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
45
+ "build:esnext": "tsc --project tsconfig.json --outDir lib --module esnext",
60
46
  "typedoc": "typedoc --json ../../../docs/types/piral-tracker.json src --exclude \"src/**/*.test.*\"",
61
47
  "test": "echo \"Error: run tests from root\" && exit 1"
62
48
  },
63
49
  "devDependencies": {
64
50
  "@types/react": "^18.0.0",
65
51
  "@types/react-router-dom": "^5.1.6",
66
- "piral-core": "1.6.0-beta.7216",
52
+ "piral-core": "1.6.0-beta.7243",
67
53
  "react": "^18.0.0"
68
54
  },
69
- "gitHead": "bd3742af68fc25af93ed9b37021d2d69a6f40f18"
55
+ "gitHead": "bbb6e4f78c61b6ef753099a5b378ad2708565ce3"
70
56
  }
package/esm/Tracker.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- export interface TrackerProps {
3
- }
4
- /**
5
- * The tracker component. Integrate this in a layout
6
- * where all the registered trackers should be active / running.
7
- */
8
- export declare const Tracker: React.FC<TrackerProps>;
package/esm/Tracker.js DELETED
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
- import { useGlobalState } from 'piral-core';
3
- /**
4
- * The tracker component. Integrate this in a layout
5
- * where all the registered trackers should be active / running.
6
- */
7
- export const Tracker = () => {
8
- const trackers = useGlobalState((m) => m.registry.trackers);
9
- return (React.createElement(React.Fragment, null, Object.keys(trackers).map((m) => {
10
- const Tracker = trackers[m].component;
11
- return React.createElement(Tracker, { key: m });
12
- })));
13
- };
14
- Tracker.displayName = 'Tracker';
15
- //# sourceMappingURL=Tracker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tracker.js","sourceRoot":"","sources":["../src/Tracker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAA2B,GAAG,EAAE;IAClD,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE5D,OAAO,CACL,0CACG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/B,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtC,OAAO,oBAAC,OAAO,IAAC,GAAG,EAAE,CAAC,GAAI,CAAC;IAC7B,CAAC,CAAC,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AACF,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
package/esm/actions.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { GlobalStateContext } from 'piral-core';
2
- import { TrackerRegistration } from './types';
3
- export declare function registerTracker(ctx: GlobalStateContext, name: string, value: TrackerRegistration): void;
4
- export declare function unregisterTracker(ctx: GlobalStateContext, name: string): void;
package/esm/actions.js DELETED
@@ -1,20 +0,0 @@
1
- import { withKey, withoutKey } from 'piral-core';
2
- export function registerTracker(ctx, name, value) {
3
- ctx.dispatch((state) => ({
4
- ...state,
5
- registry: {
6
- ...state.registry,
7
- trackers: withKey(state.registry.trackers, name, value),
8
- },
9
- }));
10
- }
11
- export function unregisterTracker(ctx, name) {
12
- ctx.dispatch((state) => ({
13
- ...state,
14
- registry: {
15
- ...state.registry,
16
- trackers: withoutKey(state.registry.trackers, name),
17
- },
18
- }));
19
- }
20
- //# sourceMappingURL=actions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAsB,MAAM,YAAY,CAAC;AAGrE,MAAM,UAAU,eAAe,CAAC,GAAuB,EAAE,IAAY,EAAE,KAA0B;IAC/F,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC;SACxD;KACF,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAuB,EAAE,IAAY;IACrE,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;SACpD;KACF,CAAC,CAAC,CAAC;AACN,CAAC"}
package/esm/create.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { PiralPlugin } from 'piral-core';
2
- import { PiletTrackerApi } from './types';
3
- /**
4
- * Available configuration options for the tracker plugin.
5
- */
6
- export interface TrackerConfig {
7
- }
8
- /**
9
- * Creates the Pilet API extension for activating tracker support.
10
- */
11
- export declare function createTrackerApi(config?: TrackerConfig): PiralPlugin<PiletTrackerApi>;
package/esm/create.js DELETED
@@ -1,33 +0,0 @@
1
- import * as actions from './actions';
2
- import { buildName, withApi } from 'piral-core';
3
- /**
4
- * Creates the Pilet API extension for activating tracker support.
5
- */
6
- export function createTrackerApi(config = {}) {
7
- return (context) => {
8
- context.defineActions(actions);
9
- return (api, target) => {
10
- const pilet = target.name;
11
- let next = 0;
12
- return {
13
- registerTracker(name, arg) {
14
- if (typeof name !== 'string') {
15
- arg = name;
16
- name = next++;
17
- }
18
- const id = buildName(pilet, name);
19
- context.registerTracker(id, {
20
- pilet,
21
- component: withApi(context, arg, api, 'tracker'),
22
- });
23
- return () => api.unregisterTracker(name);
24
- },
25
- unregisterTracker(name) {
26
- const id = buildName(pilet, name);
27
- context.unregisterTracker(id);
28
- },
29
- };
30
- };
31
- };
32
- }
33
- //# sourceMappingURL=create.js.map
package/esm/create.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AAQ7D;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAwB,EAAE;IACzD,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE/B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACrB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;YAC1B,IAAI,IAAI,GAAG,CAAC,CAAC;YAEb,OAAO;gBACL,eAAe,CAAC,IAAI,EAAE,GAAI;oBACxB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;wBAC5B,GAAG,GAAG,IAAI,CAAC;wBACX,IAAI,GAAG,IAAI,EAAE,CAAC;qBACf;oBAED,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE;wBAC1B,KAAK;wBACL,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC;qBACjD,CAAC,CAAC;oBACH,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBAC3C,CAAC;gBACD,iBAAiB,CAAC,IAAI;oBACpB,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;gBAChC,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
package/esm/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './create';
2
- export * from './Tracker';
3
- export * from './types';
package/esm/index.js DELETED
@@ -1,4 +0,0 @@
1
- export * from './create';
2
- export * from './Tracker';
3
- export * from './types';
4
- //# sourceMappingURL=index.js.map
package/esm/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
package/esm/types.d.ts DELETED
@@ -1,64 +0,0 @@
1
- import type { Dict, WrappedComponent, BaseComponentProps, AnyComponent, BaseRegistration, RegistrationDisposer } from 'piral-core';
2
- declare module 'piral-core/lib/types/custom' {
3
- interface PiletCustomApi extends PiletTrackerApi {
4
- }
5
- interface PiralCustomActions {
6
- /**
7
- * Registers a new tracker.
8
- * @param name The name of the tracker.
9
- * @param value The registration data.
10
- */
11
- registerTracker(name: string, value: TrackerRegistration): void;
12
- /**
13
- * Unregisters an existing tracker.
14
- * @param name The name of the tracker to be removed.
15
- */
16
- unregisterTracker(name: string): void;
17
- }
18
- interface PiralCustomRegistryState {
19
- /**
20
- * The registered trackers.
21
- */
22
- trackers: Dict<TrackerRegistration>;
23
- }
24
- interface PiralCustomErrors {
25
- tracker: TrackerErrorInfoProps;
26
- }
27
- }
28
- export interface TrackerErrorInfoProps {
29
- /**
30
- * The type of the error.
31
- */
32
- type: 'tracker';
33
- /**
34
- * The provided error details.
35
- */
36
- error: any;
37
- /**
38
- * The name of the pilet emitting the error.
39
- */
40
- pilet?: string;
41
- }
42
- export interface TrackerRegistration extends BaseRegistration {
43
- component: WrappedComponent<BaseComponentProps>;
44
- }
45
- export interface PiletTrackerApi {
46
- /**
47
- * Registers a tracker component.
48
- * The name has to be unique within the current pilet.
49
- * @param name The name of the tracker.
50
- * @param Component The component to be mounted permanently.
51
- */
52
- registerTracker(name: string, Component: AnyComponent<BaseComponentProps>): RegistrationDisposer;
53
- /**
54
- * Registers a tracker component.
55
- * @param Component The component to be mounted permamently.
56
- */
57
- registerTracker(Component: AnyComponent<BaseComponentProps>): RegistrationDisposer;
58
- /**
59
- * Unregisters a tracker known by the given name.
60
- * Only previously registered trackers can be unregistered.
61
- * @param name The name of the tracker to unregister.
62
- */
63
- unregisterTracker(name: string): void;
64
- }
package/esm/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
package/esm/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}