@panomc/sdk 1.0.0-dev.5 → 1.0.0-dev.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.
- package/package.json +5 -1
- package/src/api/plugin.js +20 -3
- package/src/components/index.js +2 -1
- package/src/internal/pano-context.js +10 -0
- package/src/svelte.js +6 -0
- package/src/types.js +40 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panomc/sdk",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.7",
|
|
4
4
|
"author": "PanoMC",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/PanoMC/sdk"
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"./variables": {
|
|
48
48
|
"svelte": "./src/variables.js",
|
|
49
49
|
"default": "./src/variables.js"
|
|
50
|
+
},
|
|
51
|
+
"./svelte": {
|
|
52
|
+
"svelte": "./src/svelte.js",
|
|
53
|
+
"default": "./src/svelte.js"
|
|
50
54
|
}
|
|
51
55
|
},
|
|
52
56
|
"files": [
|
package/src/api/plugin.js
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import { createPluginContext } from "./plugin-context.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import('../types.js').Pano} Pano
|
|
5
|
+
* @typedef {import('../types.js').PanoPluginContext} PanoPluginContext
|
|
6
|
+
*/
|
|
7
|
+
|
|
3
8
|
export class PanoPlugin {
|
|
4
9
|
static isPanoPlugin = true;
|
|
10
|
+
|
|
11
|
+
/** @type {Pano} */
|
|
12
|
+
pano;
|
|
13
|
+
|
|
14
|
+
/** @type {PanoPluginContext} */
|
|
15
|
+
contextApi;
|
|
16
|
+
|
|
17
|
+
/** @type {any} */
|
|
18
|
+
context;
|
|
19
|
+
|
|
5
20
|
constructor({ pluginId, scope } = {}) {
|
|
6
21
|
if (!pluginId) {
|
|
7
22
|
throw new Error("[PanoPlugin] pluginId is required");
|
|
@@ -14,9 +29,11 @@ export class PanoPlugin {
|
|
|
14
29
|
this._unsubscribers = [];
|
|
15
30
|
}
|
|
16
31
|
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @param {Pano} pano
|
|
34
|
+
*/
|
|
35
|
+
onLoad(pano) { }
|
|
36
|
+
onUnload() { }
|
|
20
37
|
|
|
21
38
|
/** plugin context helper */
|
|
22
39
|
setContext(partial) {
|
package/src/components/index.js
CHANGED
|
@@ -15,4 +15,5 @@ export const CardFiltersItem = components.CardFiltersItem;
|
|
|
15
15
|
export const CardHeader = components.CardHeader;
|
|
16
16
|
export const CardMenu = components.CardMenu;
|
|
17
17
|
export const CardMenuItem = components.CardMenuItem;
|
|
18
|
-
export const Date = components.Date;
|
|
18
|
+
export const Date = components.Date;
|
|
19
|
+
export const NoContent = components.NoContent;
|
|
@@ -10,6 +10,13 @@ function getStore() {
|
|
|
10
10
|
return globalThis[GLOBAL_KEY];
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {import('../types.js').Pano} Pano
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {Partial<Pano>} partial
|
|
19
|
+
*/
|
|
13
20
|
export function setPanoContext(partial) {
|
|
14
21
|
const store = getStore();
|
|
15
22
|
|
|
@@ -29,6 +36,9 @@ export function setPanoContext(partial) {
|
|
|
29
36
|
});
|
|
30
37
|
}
|
|
31
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @returns {{ context: Pano, subscribe: (fn: (ctx: Pano) => void) => () => void }}
|
|
41
|
+
*/
|
|
32
42
|
export function getPanoContext() {
|
|
33
43
|
const store = getStore();
|
|
34
44
|
|
package/src/svelte.js
ADDED
package/src/types.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} Pano
|
|
3
|
+
* @property {boolean} isPanel
|
|
4
|
+
* @property {any} page - SvelteKit page store
|
|
5
|
+
* @property {string} base
|
|
6
|
+
* @property {any} navigating - SvelteKit navigating store
|
|
7
|
+
* @property {boolean} browser
|
|
8
|
+
* @property {Object} ui
|
|
9
|
+
* @property {Object} ui.page
|
|
10
|
+
* @property {function({path: string, component: any, layout?: any, resetLayout?: boolean}): void} ui.page.register
|
|
11
|
+
* @property {Object} ui.nav
|
|
12
|
+
* @property {Object} ui.nav.site
|
|
13
|
+
* @property {function(function(any[]): any[]): void} ui.nav.site.editNavLinks
|
|
14
|
+
* @property {Object} utils
|
|
15
|
+
* @property {Object} utils.api
|
|
16
|
+
* @property {any} utils.api.ApiUtil
|
|
17
|
+
* @property {function(Record<string, any>): string} utils.api.buildQueryParams
|
|
18
|
+
* @property {string} utils.api.NETWORK_ERROR
|
|
19
|
+
* @property {Object} utils.api.networkErrorBody
|
|
20
|
+
* @property {string} utils.api.networkErrorBody.result
|
|
21
|
+
* @property {string} utils.api.networkErrorBody.error
|
|
22
|
+
* @property {Object} utils.language
|
|
23
|
+
* @property {any} utils.language.init
|
|
24
|
+
* @property {any} utils.language._ - i18n store or function
|
|
25
|
+
* @property {Object} utils.tooltip
|
|
26
|
+
* @property {any} utils.tooltip.tooltip
|
|
27
|
+
* @property {any} utils.toast
|
|
28
|
+
* @property {Record<string, any>} components
|
|
29
|
+
* @property {Record<string, any>} variables
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {Object} PanoPluginContext
|
|
34
|
+
* @property {any} context
|
|
35
|
+
* @property {function(any): void} set
|
|
36
|
+
* @property {function(function(any): void): function(): void} subscribe
|
|
37
|
+
* @property {function(): void} [destroy]
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
export { }
|