@akinon/app-shared 0.2.3 → 0.3.1

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.
@@ -0,0 +1,2 @@
1
+ export declare const EVENTS: {};
2
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,IAAK,CAAC"}
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h={},o=async t=>{const s=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(t))),n=[],a=new DataView(s);for(let e=0;e<a.byteLength;e+=4)n.push(("00000000"+a.getUint32(e).toString(16)).slice(-8));return n.join("")},i=async t=>(await o(t)).slice(0,7);exports.EVENTS=h;exports.getShortSha256=i;exports.hashValue=o;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
+ export * from './events';
2
+ export * from './sha256';
1
3
  export * from './types';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1,14 @@
1
-
1
+ const c = {}, o = async (t) => {
2
+ const n = await crypto.subtle.digest(
3
+ "SHA-256",
4
+ new TextEncoder().encode(JSON.stringify(t))
5
+ ), s = [], a = new DataView(n);
6
+ for (let e = 0; e < a.byteLength; e += 4)
7
+ s.push(("00000000" + a.getUint32(e).toString(16)).slice(-8));
8
+ return s.join("");
9
+ }, h = async (t) => (await o(t)).slice(0, 7);
10
+ export {
11
+ c as EVENTS,
12
+ h as getShortSha256,
13
+ o as hashValue
14
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ *
3
+ * @param val
4
+ * @returns
5
+ */
6
+ export declare const hashValue: (val: any) => Promise<string>;
7
+ /**
8
+ * Returns the first 7 chars of hashed value. Sohuld be unique.
9
+ *
10
+ * @param val - Any object or value to hash with SHA256.
11
+ */
12
+ export declare const getShortSha256: (val: any) => Promise<string>;
13
+ //# sourceMappingURL=sha256.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.d.ts","sourceRoot":"","sources":["../src/sha256.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAe,GAAG,oBAYvC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAe,GAAG,oBAG5C,CAAC"}
package/dist/types.d.ts CHANGED
@@ -53,11 +53,15 @@ export interface ApplicationConfig {
53
53
  *
54
54
  * @typedef {Object} FullpageApplicationConfig
55
55
  * @extends ApplicationConfig
56
- * @property {Page[]} [menu] - Optionally redefined from `ApplicationConfig` to highlight its
57
- * importance in full-page applications for defining the navigation menu.
56
+ * @property {ShellNavigation} [navigation] - - Navigation object for the
57
+ * client itself. Provides a way for main applications to trigger navigation on
58
+ * fullpage applications.
59
+ * @property {Page[]} [menu] - List of menu items that should be handled by
60
+ * shell applications.
58
61
  */
59
62
  export interface FullpageApplicationConfig extends ApplicationConfig {
60
- menu?: Page[];
63
+ navigation?: ShellNavigation;
64
+ menu: Page[];
61
65
  }
62
66
  /**
63
67
  * Configuration settings for plugin applications, which are smaller applications or widgets
@@ -75,7 +79,7 @@ export interface FullpageApplicationConfig extends ApplicationConfig {
75
79
  * the host environment.
76
80
  */
77
81
  export interface PluginApplicationConfig extends ApplicationConfig {
78
- placeholderId: string;
82
+ placeholderId: string | string[];
79
83
  }
80
84
  /**
81
85
  * A flexible data structure for storing application data, with string keys and any type of value.
@@ -102,13 +106,32 @@ export interface ApplicationActions {
102
106
  [key: string]: (...args: any[]) => any;
103
107
  };
104
108
  }
109
+ export interface ApplicationNavigationPayload {
110
+ path: string;
111
+ id: number;
112
+ }
105
113
  /**
106
114
  * Provides a mechanism for navigating within the application.
107
115
  * @typedef {Object} ApplicationNavigation
108
116
  * @property {Function} navigate - A function that performs navigation to the specified URL.
109
117
  */
110
118
  export interface ApplicationNavigation {
111
- navigate: (url: string) => void;
119
+ navigate: ({ id, path }: ApplicationNavigationPayload) => void;
120
+ }
121
+ export interface ShellNavigationPayload {
122
+ path: string;
123
+ }
124
+ export interface ShellNavigation {
125
+ navigate: (payload: ShellNavigationPayload) => void;
126
+ }
127
+ /**
128
+ * Defines the structure of an application's parameters.
129
+ * @typedef {Object} ApplicationParams
130
+ * @property {string} [key] - The key of the parameter.
131
+ * @property {string | number | boolean | string[] | number[]} [value] - The value of the parameter.
132
+ */
133
+ export interface ApplicationParams {
134
+ [key: string]: string | number | boolean | string[] | number[];
112
135
  }
113
136
  /**
114
137
  * Represents a custom event with flexible data structure for storing event-specific data.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO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AO,EAAE,MAAM,KAAK,IAAI,CAAC;IAE5D,OAAO,EAAE;QAGP,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;KACxC,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,4BAA4B,KAAK,IAAI,CAAC;CAChE;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,CAAC;CACrD;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;CAChE;AAED;;;GAGG;AAEH,MAAM,MAAM,eAAe,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/app-shared",
3
3
  "description": "Shared utilities and helper functions for app-shell and app-client packages.",
4
- "version": "0.2.3",
4
+ "version": "0.3.1",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "main": "dist/index.js",