piral-core 0.15.7-beta.5147 → 0.15.7-beta.5155

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,7 @@
1
1
  export * from './action';
2
2
  export * from './actions';
3
3
  export * from './globalState';
4
+ export * from './piletApi';
4
5
  export * from './media';
5
6
  export * from './routes';
6
7
  export * from './setter';
@@ -1,6 +1,7 @@
1
1
  export * from './action';
2
2
  export * from './actions';
3
3
  export * from './globalState';
4
+ export * from './piletApi';
4
5
  export * from './media';
5
6
  export * from './routes';
6
7
  export * from './setter';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Uses the global state context to retrieve the pilet API stored
3
+ * for the root pilet. This allows interaction with the pilet API
4
+ * from the app shell.
5
+ * @returns The pilet API object of the root pilet.
6
+ */
7
+ export declare function usePiletApi(): import("piral-base").PiletApi;
@@ -0,0 +1,14 @@
1
+ import { useState } from "react";
2
+ import { useGlobalStateContext } from "./globalState";
3
+ /**
4
+ * Uses the global state context to retrieve the pilet API stored
5
+ * for the root pilet. This allows interaction with the pilet API
6
+ * from the app shell.
7
+ * @returns The pilet API object of the root pilet.
8
+ */
9
+ export function usePiletApi() {
10
+ const context = useGlobalStateContext();
11
+ const [api] = useState(() => Object.values(context.apis).shift());
12
+ return api;
13
+ }
14
+ //# sourceMappingURL=piletApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"piletApi.js","sourceRoot":"","sources":["../../src/hooks/piletApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,OAAO,GAAG,qBAAqB,EAAE,CAAC;IACxC,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAClE,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export * from './action';
2
2
  export * from './actions';
3
3
  export * from './globalState';
4
+ export * from './piletApi';
4
5
  export * from './media';
5
6
  export * from './routes';
6
7
  export * from './setter';
@@ -4,6 +4,7 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./action"), exports);
5
5
  tslib_1.__exportStar(require("./actions"), exports);
6
6
  tslib_1.__exportStar(require("./globalState"), exports);
7
+ tslib_1.__exportStar(require("./piletApi"), exports);
7
8
  tslib_1.__exportStar(require("./media"), exports);
8
9
  tslib_1.__exportStar(require("./routes"), exports);
9
10
  tslib_1.__exportStar(require("./setter"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,oDAA0B;AAC1B,wDAA8B;AAC9B,kDAAwB;AACxB,mDAAyB;AACzB,mDAAyB;AACzB,uDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,oDAA0B;AAC1B,wDAA8B;AAC9B,qDAA2B;AAC3B,kDAAwB;AACxB,mDAAyB;AACzB,mDAAyB;AACzB,uDAA6B"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Uses the global state context to retrieve the pilet API stored
3
+ * for the root pilet. This allows interaction with the pilet API
4
+ * from the app shell.
5
+ * @returns The pilet API object of the root pilet.
6
+ */
7
+ export declare function usePiletApi(): import("piral-base").PiletApi;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePiletApi = void 0;
4
+ const react_1 = require("react");
5
+ const globalState_1 = require("./globalState");
6
+ /**
7
+ * Uses the global state context to retrieve the pilet API stored
8
+ * for the root pilet. This allows interaction with the pilet API
9
+ * from the app shell.
10
+ * @returns The pilet API object of the root pilet.
11
+ */
12
+ function usePiletApi() {
13
+ const context = (0, globalState_1.useGlobalStateContext)();
14
+ const [api] = (0, react_1.useState)(() => Object.values(context.apis).shift());
15
+ return api;
16
+ }
17
+ exports.usePiletApi = usePiletApi;
18
+ //# sourceMappingURL=piletApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"piletApi.js","sourceRoot":"","sources":["../../src/hooks/piletApi.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,+CAAsD;AAEtD;;;;;GAKG;AACH,SAAgB,WAAW;IACzB,MAAM,OAAO,GAAG,IAAA,mCAAqB,GAAE,CAAC;IACxC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAClE,OAAO,GAAG,CAAC;AACb,CAAC;AAJD,kCAIC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-core",
3
- "version": "0.15.7-beta.5147",
3
+ "version": "0.15.7-beta.5155",
4
4
  "description": "The core library for creating a Piral instance.",
5
5
  "keywords": [
6
6
  "portal",
@@ -72,8 +72,8 @@
72
72
  "test": "echo \"Error: run tests from root\" && exit 1"
73
73
  },
74
74
  "dependencies": {
75
- "piral-base": "0.15.7-beta.5147",
76
- "piral-debug-utils": "0.15.7-beta.5147",
75
+ "piral-base": "0.15.7-beta.5155",
76
+ "piral-debug-utils": "0.15.7-beta.5155",
77
77
  "zustand": "^3.0.0"
78
78
  },
79
79
  "peerDependencies": {
@@ -99,5 +99,5 @@
99
99
  "react-router-dom",
100
100
  "tslib"
101
101
  ],
102
- "gitHead": "8833e0913487f5b11446b6dfdf5354e9154cbded"
102
+ "gitHead": "f4d7b20a348a2474a0b7c5bfbb265e544732865c"
103
103
  }
@@ -1,6 +1,7 @@
1
1
  export * from './action';
2
2
  export * from './actions';
3
3
  export * from './globalState';
4
+ export * from './piletApi';
4
5
  export * from './media';
5
6
  export * from './routes';
6
7
  export * from './setter';
@@ -0,0 +1,14 @@
1
+ import { useState } from "react";
2
+ import { useGlobalStateContext } from "./globalState";
3
+
4
+ /**
5
+ * Uses the global state context to retrieve the pilet API stored
6
+ * for the root pilet. This allows interaction with the pilet API
7
+ * from the app shell.
8
+ * @returns The pilet API object of the root pilet.
9
+ */
10
+ export function usePiletApi() {
11
+ const context = useGlobalStateContext();
12
+ const [api] = useState(() => Object.values(context.apis).shift());
13
+ return api;
14
+ }