@panomc/sdk 1.0.0-dev.7 → 1.0.0-dev.9
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/README.md +3 -3
- package/package.json +1 -1
- package/src/api/plugin-context.js +3 -3
- package/src/api/plugin.js +6 -6
- package/src/components/index.js +5 -4
- package/src/index.js +3 -3
- package/src/internal/index.js +1 -1
- package/src/internal/pano-context.js +4 -4
- package/src/svelte.js +1 -1
- package/src/toasts/index.js +2 -2
- package/src/types.js +1 -1
- package/src/utils/api.js +2 -2
- package/src/utils/component.js +9 -9
- package/src/utils/language.js +2 -2
- package/src/utils/tooltip.js +1 -1
- package/src/variables.js +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Pano Common Assets
|
|
2
|
-
|
|
3
|
-
Pano common assets repository.
|
|
1
|
+
# Pano Common Assets
|
|
2
|
+
|
|
3
|
+
Pano common assets repository.
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const GLOBAL_KEY =
|
|
1
|
+
const GLOBAL_KEY = '__PANO_PLUGIN_CONTEXTS__';
|
|
2
2
|
|
|
3
3
|
function getStore() {
|
|
4
4
|
if (!globalThis[GLOBAL_KEY]) {
|
|
@@ -9,7 +9,7 @@ function getStore() {
|
|
|
9
9
|
|
|
10
10
|
export function createPluginContext(pluginId) {
|
|
11
11
|
if (!pluginId) {
|
|
12
|
-
throw new Error(
|
|
12
|
+
throw new Error('[PanoSDK] pluginId is required');
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const store = getStore();
|
|
@@ -27,7 +27,7 @@ export function createPluginContext(pluginId) {
|
|
|
27
27
|
context: pluginStore.context,
|
|
28
28
|
|
|
29
29
|
set(partial) {
|
|
30
|
-
if (typeof partial !==
|
|
30
|
+
if (typeof partial !== 'object' || partial === null) return;
|
|
31
31
|
|
|
32
32
|
Object.assign(pluginStore.context, partial);
|
|
33
33
|
|
package/src/api/plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createPluginContext } from
|
|
1
|
+
import { createPluginContext } from './plugin-context.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @typedef {import('../types.js').Pano} Pano
|
|
@@ -19,7 +19,7 @@ export class PanoPlugin {
|
|
|
19
19
|
|
|
20
20
|
constructor({ pluginId, scope } = {}) {
|
|
21
21
|
if (!pluginId) {
|
|
22
|
-
throw new Error(
|
|
22
|
+
throw new Error('[PanoPlugin] pluginId is required');
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// plugin-scoped context
|
|
@@ -29,11 +29,11 @@ export class PanoPlugin {
|
|
|
29
29
|
this._unsubscribers = [];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
* @param {Pano} pano
|
|
32
|
+
/**
|
|
33
|
+
* @param {Pano} pano
|
|
34
34
|
*/
|
|
35
|
-
onLoad(pano) {
|
|
36
|
-
onUnload() {
|
|
35
|
+
onLoad(pano) {}
|
|
36
|
+
onUnload() {}
|
|
37
37
|
|
|
38
38
|
/** plugin context helper */
|
|
39
39
|
setContext(partial) {
|
package/src/components/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getPanoContext } from
|
|
1
|
+
import { getPanoContext } from '../internal/index.js';
|
|
2
2
|
|
|
3
|
-
const panoContext = getPanoContext()
|
|
4
|
-
const components = panoContext.context.components
|
|
3
|
+
const panoContext = getPanoContext();
|
|
4
|
+
const components = panoContext.context.components;
|
|
5
5
|
|
|
6
6
|
export const PageActions = components.PageActions;
|
|
7
7
|
export const PageLoader = components.PageLoader;
|
|
@@ -16,4 +16,5 @@ export const CardHeader = components.CardHeader;
|
|
|
16
16
|
export const CardMenu = components.CardMenu;
|
|
17
17
|
export const CardMenuItem = components.CardMenuItem;
|
|
18
18
|
export const Date = components.Date;
|
|
19
|
-
export const NoContent = components.NoContent;
|
|
19
|
+
export const NoContent = components.NoContent;
|
|
20
|
+
export const Editor = components.Editor;
|
package/src/index.js
CHANGED
package/src/internal/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './pano-context.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const GLOBAL_KEY =
|
|
1
|
+
const GLOBAL_KEY = '__PANO_CONTEXT__';
|
|
2
2
|
|
|
3
3
|
function getStore() {
|
|
4
4
|
if (!globalThis[GLOBAL_KEY]) {
|
|
@@ -20,8 +20,8 @@ function getStore() {
|
|
|
20
20
|
export function setPanoContext(partial) {
|
|
21
21
|
const store = getStore();
|
|
22
22
|
|
|
23
|
-
if (typeof partial !==
|
|
24
|
-
console.warn(
|
|
23
|
+
if (typeof partial !== 'object' || partial === null) {
|
|
24
|
+
console.warn('[PanoSDK] setPanoContext expects an object');
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -31,7 +31,7 @@ export function setPanoContext(partial) {
|
|
|
31
31
|
try {
|
|
32
32
|
fn(store.context);
|
|
33
33
|
} catch (e) {
|
|
34
|
-
console.error(
|
|
34
|
+
console.error('[PanoSDK] listener error', e);
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
}
|
package/src/svelte.js
CHANGED
package/src/toasts/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPanoContext } from
|
|
1
|
+
import { getPanoContext } from '../internal/index.js';
|
|
2
2
|
|
|
3
3
|
const panoContext = getPanoContext();
|
|
4
4
|
const toastStuff = panoContext.context.utils.toast;
|
|
@@ -6,4 +6,4 @@ const toastStuff = panoContext.context.utils.toast;
|
|
|
6
6
|
const showToast = toastStuff.show;
|
|
7
7
|
const limitTitle = toastStuff.limitTitle;
|
|
8
8
|
|
|
9
|
-
export { showToast, limitTitle };
|
|
9
|
+
export { showToast, limitTitle };
|
package/src/types.js
CHANGED
package/src/utils/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPanoContext } from
|
|
1
|
+
import { getPanoContext } from '../internal/index.js';
|
|
2
2
|
|
|
3
3
|
const panoContext = getPanoContext();
|
|
4
4
|
const apiStuff = panoContext.context.utils.api;
|
|
@@ -11,4 +11,4 @@ const buildQueryParams = apiStuff.buildQueryParams;
|
|
|
11
11
|
|
|
12
12
|
export { ApiUtil, NETWORK_ERROR, networkErrorBody, buildQueryParams };
|
|
13
13
|
|
|
14
|
-
export default ApiUtil
|
|
14
|
+
export default ApiUtil;
|
package/src/utils/component.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mount, unmount, hydrate } from
|
|
1
|
+
import { mount, unmount, hydrate } from 'svelte';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Wraps a dynamic component import to include the correct Svelte runtime mount/unmount methods.
|
|
@@ -8,13 +8,13 @@ import { mount, unmount, hydrate } from "svelte";
|
|
|
8
8
|
* @returns {() => Promise<any>} - Wrapped importer
|
|
9
9
|
*/
|
|
10
10
|
export function viewComponent(importer) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
11
|
+
return async () => {
|
|
12
|
+
const module = await importer();
|
|
13
|
+
return {
|
|
14
|
+
...module,
|
|
15
|
+
mount: (options) => mount(module.default, options),
|
|
16
|
+
unmount: (instance) => unmount(instance),
|
|
17
|
+
hydrate: (options) => hydrate(module.default, options),
|
|
19
18
|
};
|
|
19
|
+
};
|
|
20
20
|
}
|
package/src/utils/language.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPanoContext } from
|
|
1
|
+
import { getPanoContext } from '../internal/index.js';
|
|
2
2
|
|
|
3
3
|
const panoContext = getPanoContext();
|
|
4
4
|
const languageStuff = panoContext.context.utils.language;
|
|
@@ -22,5 +22,5 @@ export {
|
|
|
22
22
|
loadLanguage,
|
|
23
23
|
changeLanguage,
|
|
24
24
|
getLanguageByLocale,
|
|
25
|
-
_
|
|
25
|
+
_,
|
|
26
26
|
};
|
package/src/utils/tooltip.js
CHANGED
package/src/variables.js
CHANGED