@onecx/integration-interface 6.15.1 → 6.16.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.
- package/package.json +3 -3
- package/src/index.d.ts +3 -0
- package/src/index.js +3 -0
- package/src/index.js.map +1 -1
- package/src/lib/declarations.d.ts +5 -0
- package/src/lib/declarations.js +4 -0
- package/src/lib/declarations.js.map +1 -0
- package/src/lib/services/icon.service.d.ts +15 -0
- package/src/lib/services/icon.service.js +57 -0
- package/src/lib/services/icon.service.js.map +1 -0
- package/src/lib/topics/icons/v1/icon.model.d.ts +15 -0
- package/src/lib/topics/icons/v1/icon.model.js +3 -0
- package/src/lib/topics/icons/v1/icon.model.js.map +1 -0
- package/src/lib/topics/icons/v1/icon.topic.d.ts +5 -0
- package/src/lib/topics/icons/v1/icon.topic.js +11 -0
- package/src/lib/topics/icons/v1/icon.topic.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onecx/integration-interface",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.16.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"peerDependencies": {
|
|
10
10
|
"tslib": "^2.6.3",
|
|
11
11
|
"rxjs": "^7.8.1",
|
|
12
|
-
"@onecx/accelerator": "^6.
|
|
13
|
-
"@onecx/nx-migration-utils": "^6.
|
|
12
|
+
"@onecx/accelerator": "^6.16.1",
|
|
13
|
+
"@onecx/nx-migration-utils": "^6.16.1",
|
|
14
14
|
"@nx/devkit": "^20.3.0",
|
|
15
15
|
"@phenomnomnominal/tsquery": "^6",
|
|
16
16
|
"typescript": "^5.5.4"
|
package/src/index.d.ts
CHANGED
|
@@ -35,3 +35,6 @@ export * from './lib/topics/parameters/v1/parameters.topic';
|
|
|
35
35
|
export * from './lib/topics/image-repository/image-repository.model';
|
|
36
36
|
export * from './lib/topics/image-repository/image-repository.topic';
|
|
37
37
|
export * from './lib/services/image-repository.service';
|
|
38
|
+
export * from './lib/topics/icons/v1/icon.model';
|
|
39
|
+
export * from './lib/topics/icons/v1/icon.topic';
|
|
40
|
+
export * from './lib/services/icon.service';
|
package/src/index.js
CHANGED
|
@@ -38,4 +38,7 @@ tslib_1.__exportStar(require("./lib/topics/parameters/v1/parameters.topic"), exp
|
|
|
38
38
|
tslib_1.__exportStar(require("./lib/topics/image-repository/image-repository.model"), exports);
|
|
39
39
|
tslib_1.__exportStar(require("./lib/topics/image-repository/image-repository.topic"), exports);
|
|
40
40
|
tslib_1.__exportStar(require("./lib/services/image-repository.service"), exports);
|
|
41
|
+
tslib_1.__exportStar(require("./lib/topics/icons/v1/icon.model"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./lib/topics/icons/v1/icon.topic"), exports);
|
|
43
|
+
tslib_1.__exportStar(require("./lib/services/icon.service"), exports);
|
|
41
44
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/integration-interface/src/index.ts"],"names":[],"mappings":";;;AAAA,wFAA6D;AAC7D,qFAA0D;AAC1D,0FAA+D;AAC/D,uFAA4D;AAE5D,0FAA+D;AAE/D,8FAAmE;AAEnE,4FAAiE;AACjE,oFAAyD;AACzD,6FAAkE;AAElE,0FAA+D;AAC/D,0FAA+D;AAE/D,4FAAiE;AAEjE,oGAAyE;AACzE,0GAA+E;AAC/E,4FAAiE;AACjE,wFAA6D;AAC7D,2FAAgE;AAEhE,iGAAsE;AAEtE,gFAAqD;AACrD,gFAAqD;AAErD,mGAAwE;AACxE,yGAA8E;AAC9E,uFAA4D;AAC5D,oGAAyE;AAEzE,wFAA6D;AAE7D,gGAAqE;AACrE,gGAAqE;AAErE,8EAAmD;AACnD,kFAAuD;AACvD,sFAA2D;AAC3D,yFAA8D;AAE9D,kGAAuE;AACvE,kGAAuE;AAEvE,sFAA2D;AAE3D,+FAAoE;AACpE,+FAAoE;AACpE,kFAAuD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/integration-interface/src/index.ts"],"names":[],"mappings":";;;AAAA,wFAA6D;AAC7D,qFAA0D;AAC1D,0FAA+D;AAC/D,uFAA4D;AAE5D,0FAA+D;AAE/D,8FAAmE;AAEnE,4FAAiE;AACjE,oFAAyD;AACzD,6FAAkE;AAElE,0FAA+D;AAC/D,0FAA+D;AAE/D,4FAAiE;AAEjE,oGAAyE;AACzE,0GAA+E;AAC/E,4FAAiE;AACjE,wFAA6D;AAC7D,2FAAgE;AAEhE,iGAAsE;AAEtE,gFAAqD;AACrD,gFAAqD;AAErD,mGAAwE;AACxE,yGAA8E;AAC9E,uFAA4D;AAC5D,oGAAyE;AAEzE,wFAA6D;AAE7D,gGAAqE;AACrE,gGAAqE;AAErE,8EAAmD;AACnD,kFAAuD;AACvD,sFAA2D;AAC3D,yFAA8D;AAE9D,kGAAuE;AACvE,kGAAuE;AAEvE,sFAA2D;AAE3D,+FAAoE;AACpE,+FAAoE;AACpE,kFAAuD;AAGvD,2EAAgD;AAChD,2EAAgD;AAChD,sEAA2C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["../../../../../libs/integration-interface/src/lib/declarations.ts"],"names":[],"mappings":";;AAOA,kBAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IconClassType } from '../topics/icons/v1/icon.model';
|
|
2
|
+
import { IconTopic } from '../topics/icons/v1/icon.topic';
|
|
3
|
+
import '../declarations';
|
|
4
|
+
export declare function ensureIconCache(): void;
|
|
5
|
+
export declare function generateClassName(name: string, classType: IconClassType): string;
|
|
6
|
+
export declare function normalizeIconName(name: string): string;
|
|
7
|
+
export declare class IconService {
|
|
8
|
+
private _iconTopic$;
|
|
9
|
+
get iconTopic(): IconTopic;
|
|
10
|
+
set iconTopic(source: IconTopic);
|
|
11
|
+
constructor();
|
|
12
|
+
requestIcon(name: string, classType?: IconClassType): string;
|
|
13
|
+
requestIconAsync(name: string, classType?: IconClassType): Promise<string | null>;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IconService = void 0;
|
|
4
|
+
exports.ensureIconCache = ensureIconCache;
|
|
5
|
+
exports.generateClassName = generateClassName;
|
|
6
|
+
exports.normalizeIconName = normalizeIconName;
|
|
7
|
+
const rxjs_1 = require("rxjs");
|
|
8
|
+
const icon_topic_1 = require("../topics/icons/v1/icon.topic");
|
|
9
|
+
const accelerator_1 = require("@onecx/accelerator");
|
|
10
|
+
require("../declarations");
|
|
11
|
+
const DEFAULT_CLASS_TYPE = 'background-before';
|
|
12
|
+
function ensureIconCache() {
|
|
13
|
+
(0, accelerator_1.ensureProperty)(globalThis, ['onecxIcons'], {});
|
|
14
|
+
}
|
|
15
|
+
function generateClassName(name, classType) {
|
|
16
|
+
const safeName = normalizeIconName(name);
|
|
17
|
+
return `onecx-theme-icon-${classType}-${safeName}`;
|
|
18
|
+
}
|
|
19
|
+
function normalizeIconName(name) {
|
|
20
|
+
return name.replaceAll(/[^a-zA-Z0-9_-]+/g, '-');
|
|
21
|
+
}
|
|
22
|
+
class IconService {
|
|
23
|
+
_iconTopic$;
|
|
24
|
+
get iconTopic() {
|
|
25
|
+
this._iconTopic$ ??= new icon_topic_1.IconTopic();
|
|
26
|
+
return this._iconTopic$;
|
|
27
|
+
}
|
|
28
|
+
set iconTopic(source) {
|
|
29
|
+
this._iconTopic$ = source;
|
|
30
|
+
}
|
|
31
|
+
constructor() {
|
|
32
|
+
ensureIconCache();
|
|
33
|
+
}
|
|
34
|
+
requestIcon(name, classType = DEFAULT_CLASS_TYPE) {
|
|
35
|
+
const className = generateClassName(name, classType);
|
|
36
|
+
if (globalThis.onecxIcons && !(name in globalThis.onecxIcons)) {
|
|
37
|
+
(0, accelerator_1.ensureProperty)(globalThis, ['onecxIcons', name], undefined);
|
|
38
|
+
this.iconTopic.publish({ type: 'IconRequested', name });
|
|
39
|
+
}
|
|
40
|
+
return className;
|
|
41
|
+
}
|
|
42
|
+
async requestIconAsync(name, classType = DEFAULT_CLASS_TYPE) {
|
|
43
|
+
const className = this.requestIcon(name, classType);
|
|
44
|
+
const cached = globalThis.onecxIcons?.[name];
|
|
45
|
+
if (cached === null)
|
|
46
|
+
return null;
|
|
47
|
+
if (cached)
|
|
48
|
+
return className;
|
|
49
|
+
await (0, rxjs_1.firstValueFrom)(this.iconTopic.pipe((0, rxjs_1.filter)(e => e.type === 'IconsReceived'), (0, rxjs_1.map)(() => globalThis.onecxIcons?.[name]), (0, rxjs_1.filter)(v => v !== undefined)));
|
|
50
|
+
return globalThis.onecxIcons?.[name] ? className : null;
|
|
51
|
+
}
|
|
52
|
+
destroy() {
|
|
53
|
+
this.iconTopic.destroy();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.IconService = IconService;
|
|
57
|
+
//# sourceMappingURL=icon.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.service.js","sourceRoot":"","sources":["../../../../../../libs/integration-interface/src/lib/services/icon.service.ts"],"names":[],"mappings":";;;AASA,0CAEC;AAED,8CAGC;AAED,8CAEC;AApBD,+BAAmD;AAEnD,8DAA0D;AAC1D,oDAAoD;AACpD,2BAAyB;AAEzB,MAAM,kBAAkB,GAAkB,mBAAmB,CAAA;AAG7D,SAAgB,eAAe;IAC7B,IAAA,4BAAc,EAAC,UAAU,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAA;AAChD,CAAC;AAED,SAAgB,iBAAiB,CAAC,IAAY,EAAE,SAAwB;IACtE,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAA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A;QAE5B,MAAM,IAAA,qBAAc,EAClB,IAAI,CAAC,SAAS,CAAC,IAAI,CACjB,IAAA,aAAM,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,EACvC,IAAA,UAAG,EAAC,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,EACxC,IAAA,aAAM,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAC7B,CACF,CAAA;QAED,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;IACzD,CAAC;IAED,OAAO;QACL,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;CACF;AAjDD,kCAiDC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface IconCache {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
body: string;
|
|
5
|
+
parent?: string | null;
|
|
6
|
+
}
|
|
7
|
+
export type IconClassType = 'svg' | 'background' | 'background-before';
|
|
8
|
+
export interface IconRequested {
|
|
9
|
+
type: 'IconRequested';
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IconsReceived {
|
|
13
|
+
type: 'IconsReceived';
|
|
14
|
+
}
|
|
15
|
+
export type Icon = IconRequested | IconsReceived;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.model.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/icons/v1/icon.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IconTopic = void 0;
|
|
4
|
+
const accelerator_1 = require("@onecx/accelerator");
|
|
5
|
+
class IconTopic extends accelerator_1.Topic {
|
|
6
|
+
constructor() {
|
|
7
|
+
super('icon', 1, false);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.IconTopic = IconTopic;
|
|
11
|
+
//# sourceMappingURL=icon.topic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.topic.js","sourceRoot":"","sources":["../../../../../../../../libs/integration-interface/src/lib/topics/icons/v1/icon.topic.ts"],"names":[],"mappings":";;;AAAA,oDAA0C;AAG1C,MAAa,SAAU,SAAQ,mBAAW;IACxC;QACE,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;CACF;AAJD,8BAIC"}
|