@c8y/bootstrap 1019.0.3
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/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './resolvers/options-resolver';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ApplicationRemotePlugins } from '@c8y/client';
|
|
2
|
+
export declare function loadOptions(): Promise<any>;
|
|
3
|
+
export declare function getAllMFRemotes(options: Array<{
|
|
4
|
+
remotes?: object;
|
|
5
|
+
}>): ApplicationRemotePlugins;
|
|
6
|
+
export declare function loginOptions(): Promise<unknown>;
|
|
7
|
+
export declare function loadUrlOptions(): any;
|
|
8
|
+
export declare function clearUrlOptionsCache(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Apply the given options to the C8Y_APP object in the window and update the document elements.
|
|
11
|
+
* @param options - An object containing configuration options for the C8Y_APP object.
|
|
12
|
+
* @returns - The updated options object.
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyOptions(options: Record<string, unknown>): Record<string, unknown>;
|
|
15
|
+
export declare function setVersion(options: any): void;
|
|
16
|
+
export declare function updateTitle({ globalTitle }: {
|
|
17
|
+
globalTitle: any;
|
|
18
|
+
}, document: any): void;
|
|
19
|
+
export declare function updateFavicon({ faviconUrl }: {
|
|
20
|
+
faviconUrl?: string;
|
|
21
|
+
}, document: any): void;
|
|
22
|
+
export declare function updateBrandingUrl({ brandingUrl }: {
|
|
23
|
+
brandingUrl: any;
|
|
24
|
+
}, document: any): void;
|
|
25
|
+
export declare function updateCss({ brandingCssVars, extraCssUrls }: {
|
|
26
|
+
brandingCssVars: any;
|
|
27
|
+
extraCssUrls: any;
|
|
28
|
+
}, document: any): void;
|
|
29
|
+
export declare function updateTranslations(options: any): void;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { forEach, get, reduce, union } from 'lodash';
|
|
2
|
+
import chroma from 'chroma-js';
|
|
3
|
+
let staticOptionsCache;
|
|
4
|
+
let urlOptionsCache;
|
|
5
|
+
export async function loadOptions() {
|
|
6
|
+
const urlOptions = loadUrlOptions(); // used for debugging or preview
|
|
7
|
+
const staticOptions = loadStaticOptions();
|
|
8
|
+
const dynamicOptions = await loadDynamicOptions();
|
|
9
|
+
const localDynamicOptions = await loadLocalDynamicOptions();
|
|
10
|
+
const previewOptions = loadPreviewOptions();
|
|
11
|
+
// languages are to be merged and not replaced
|
|
12
|
+
const languages = {
|
|
13
|
+
...(staticOptions.languages || {}),
|
|
14
|
+
...(localDynamicOptions.languages || {}),
|
|
15
|
+
...(dynamicOptions.languages || {}),
|
|
16
|
+
...(urlOptions.languages || {})
|
|
17
|
+
};
|
|
18
|
+
let remotes;
|
|
19
|
+
if (urlOptions?.forceUrlRemotes) {
|
|
20
|
+
remotes = getAllMFRemotes([urlOptions]);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
remotes = getAllMFRemotes([
|
|
24
|
+
staticOptions,
|
|
25
|
+
localDynamicOptions,
|
|
26
|
+
dynamicOptions,
|
|
27
|
+
urlOptions,
|
|
28
|
+
previewOptions
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
const options = {
|
|
32
|
+
versions: {
|
|
33
|
+
ng1: __VERSION_NG1__,
|
|
34
|
+
ngx: __VERSION_NGX__,
|
|
35
|
+
package: __VERSION_PACKAGE__
|
|
36
|
+
},
|
|
37
|
+
...staticOptions,
|
|
38
|
+
...localDynamicOptions,
|
|
39
|
+
...dynamicOptions,
|
|
40
|
+
...urlOptions,
|
|
41
|
+
...previewOptions,
|
|
42
|
+
remotes,
|
|
43
|
+
languages,
|
|
44
|
+
remoteModules: []
|
|
45
|
+
};
|
|
46
|
+
options.C8Y_INSTANCE_OPTIONS = { ...options }; // for compatability with c8yBase.getOptions in ng1-modules
|
|
47
|
+
// If no shades are defined, we auto generate shades. This was implemented with the
|
|
48
|
+
// re-design in 10.17. Branding editor should later define the shades. So long we
|
|
49
|
+
// auto generate shades out of the primary color and based on the referenceShades.
|
|
50
|
+
const shouldApplyShadeColors = hasBrandPrimary(options.brandingCssVars) && !hasAnyBrandShade(options.brandingCssVars);
|
|
51
|
+
if (shouldApplyShadeColors) {
|
|
52
|
+
options.brandingCssVars = getShadeColorBrandingCssVars(options.brandingCssVars);
|
|
53
|
+
}
|
|
54
|
+
return options;
|
|
55
|
+
}
|
|
56
|
+
function getShadeColorBrandingCssVars(brandingCssVars) {
|
|
57
|
+
const shades = generateShades(brandingCssVars['brand-primary']);
|
|
58
|
+
let i = 1;
|
|
59
|
+
for (const shade of shades) {
|
|
60
|
+
brandingCssVars['c8y-brand-' + i + '0'] = shade;
|
|
61
|
+
i++;
|
|
62
|
+
}
|
|
63
|
+
return brandingCssVars;
|
|
64
|
+
}
|
|
65
|
+
function generateShades(inputColor) {
|
|
66
|
+
const referenceShades = [
|
|
67
|
+
'#134158',
|
|
68
|
+
'#1C5569',
|
|
69
|
+
'#058192',
|
|
70
|
+
'#22A6AA',
|
|
71
|
+
'#3CC1B7',
|
|
72
|
+
'#8ADBD5',
|
|
73
|
+
'#C5EDEA',
|
|
74
|
+
'#EBF9F8'
|
|
75
|
+
];
|
|
76
|
+
// Calculate the luminance of the reference shades
|
|
77
|
+
const referenceLuminances = referenceShades.map(color => chroma(color).luminance());
|
|
78
|
+
// Generate shades of the input color with the same luminance as the reference shades
|
|
79
|
+
const generatedShades = referenceLuminances.map(luminance => chroma(inputColor).luminance(luminance).hex());
|
|
80
|
+
// Calculate the distance between the input color and each color in the generatedShades array
|
|
81
|
+
const distances = generatedShades.map(color => chroma.deltaE(inputColor, color));
|
|
82
|
+
// Find the index of the color with the smallest distance
|
|
83
|
+
const index = distances.indexOf(Math.min(...distances));
|
|
84
|
+
generatedShades[index] = inputColor;
|
|
85
|
+
return generatedShades;
|
|
86
|
+
}
|
|
87
|
+
function hasBrandPrimary(brandingCssVars) {
|
|
88
|
+
return !!brandingCssVars?.['brand-primary'];
|
|
89
|
+
}
|
|
90
|
+
function hasAnyBrandShade(brandingCssVars) {
|
|
91
|
+
if (!brandingCssVars) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return !!Object.keys(brandingCssVars).some(value => /brand-[1-8]0/.test(value));
|
|
95
|
+
}
|
|
96
|
+
export function getAllMFRemotes(options) {
|
|
97
|
+
return reduce(options, (allRemotes, mfRemote) => {
|
|
98
|
+
const { remotes } = mfRemote;
|
|
99
|
+
forEach(remotes, (remoteModules, remoteContextPath) => {
|
|
100
|
+
const currentRemotes = get(allRemotes, remoteContextPath, []);
|
|
101
|
+
allRemotes[remoteContextPath] = union(currentRemotes, remoteModules);
|
|
102
|
+
});
|
|
103
|
+
return allRemotes;
|
|
104
|
+
}, {});
|
|
105
|
+
}
|
|
106
|
+
function loadStaticOptions() {
|
|
107
|
+
if (!staticOptionsCache) {
|
|
108
|
+
staticOptionsCache =
|
|
109
|
+
JSON.parse(document.querySelector('#static-options').innerText) || {};
|
|
110
|
+
}
|
|
111
|
+
return { ...staticOptionsCache, ...loadUrlOptions() };
|
|
112
|
+
}
|
|
113
|
+
export async function loginOptions() {
|
|
114
|
+
const hostName = location.origin;
|
|
115
|
+
return await requestRemoteOptions(hostName + '/tenant/loginOptions');
|
|
116
|
+
}
|
|
117
|
+
export function loadUrlOptions() {
|
|
118
|
+
if (!urlOptionsCache) {
|
|
119
|
+
const query = location.search.substr(1).split('&');
|
|
120
|
+
urlOptionsCache = query.reduce((options, keyValuePair) => {
|
|
121
|
+
if (keyValuePair) {
|
|
122
|
+
if (keyValuePair.match(/=/)) {
|
|
123
|
+
const [key, value] = keyValuePair.split(/=/);
|
|
124
|
+
try {
|
|
125
|
+
options[key] = JSON.parse(decodeURIComponent(value));
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
console.warn(`Failed to parse option ${key}: ${error}`);
|
|
129
|
+
options[key] = value;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
options[keyValuePair] = true;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return options;
|
|
137
|
+
}, {});
|
|
138
|
+
}
|
|
139
|
+
return urlOptionsCache;
|
|
140
|
+
}
|
|
141
|
+
export function clearUrlOptionsCache() {
|
|
142
|
+
urlOptionsCache = undefined;
|
|
143
|
+
}
|
|
144
|
+
async function loadLocalDynamicOptions() {
|
|
145
|
+
const remoteOptions = await requestRemoteOptions(`cumulocity.json?nocache=${String(Math.random()).substr(2)}`);
|
|
146
|
+
return remoteOptions;
|
|
147
|
+
}
|
|
148
|
+
async function loadDynamicOptions() {
|
|
149
|
+
let { dynamicOptionsUrl } = loadStaticOptions();
|
|
150
|
+
let remoteOptions = {};
|
|
151
|
+
if (dynamicOptionsUrl) {
|
|
152
|
+
dynamicOptionsUrl = dynamicOptionsUrl.match(/\?/)
|
|
153
|
+
? dynamicOptionsUrl
|
|
154
|
+
: `${dynamicOptionsUrl}?nocache=${String(Math.random()).substr(2)}`;
|
|
155
|
+
remoteOptions = await requestRemoteOptions(dynamicOptionsUrl);
|
|
156
|
+
}
|
|
157
|
+
return remoteOptions;
|
|
158
|
+
}
|
|
159
|
+
function loadPreviewOptions() {
|
|
160
|
+
if (window.C8Y_PREVIEW) {
|
|
161
|
+
return window.C8Y_PREVIEW;
|
|
162
|
+
}
|
|
163
|
+
return {};
|
|
164
|
+
}
|
|
165
|
+
async function requestRemoteOptions(url) {
|
|
166
|
+
return new Promise((resolve, reject) => {
|
|
167
|
+
const request = new XMLHttpRequest();
|
|
168
|
+
let options = {};
|
|
169
|
+
const onload = () => {
|
|
170
|
+
if (request.status >= 200 && request.status < 400) {
|
|
171
|
+
try {
|
|
172
|
+
options = JSON.parse(request.responseText);
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
// do nothing
|
|
176
|
+
}
|
|
177
|
+
Object.keys(options).forEach(key => {
|
|
178
|
+
const value = options[key];
|
|
179
|
+
if (typeof value === 'string') {
|
|
180
|
+
try {
|
|
181
|
+
const parsed = JSON.parse(value);
|
|
182
|
+
if (typeof parsed === 'object') {
|
|
183
|
+
options[key] = parsed;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
catch (e) {
|
|
187
|
+
// do nothing
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
resolve(options);
|
|
193
|
+
};
|
|
194
|
+
request.open('GET', url, true);
|
|
195
|
+
request.setRequestHeader('UseXBasic', 'true');
|
|
196
|
+
request.onload = onload;
|
|
197
|
+
request.onerror = e => reject(e);
|
|
198
|
+
request.send();
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Update the window object with the given options and modules.
|
|
203
|
+
* @param windowObj - The global window object.
|
|
204
|
+
* @param c8yAppVarName - The variable name used for the C8Y_APP object.
|
|
205
|
+
* @param options - An object containing configuration options for the C8Y_APP object.
|
|
206
|
+
* @param modulesToCopy - An array of angularjs modules to be added to the C8Y_APP object.
|
|
207
|
+
* @returns - The updated window object.
|
|
208
|
+
*/
|
|
209
|
+
function updateWindowObject(windowObj, c8yAppVarName, options) {
|
|
210
|
+
windowObj.C8Y_APP = windowObj[c8yAppVarName] = { modules: [], ...options };
|
|
211
|
+
return windowObj;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Apply the given options to the C8Y_APP object in the window and update the document elements.
|
|
215
|
+
* @param options - An object containing configuration options for the C8Y_APP object.
|
|
216
|
+
* @returns - The updated options object.
|
|
217
|
+
*/
|
|
218
|
+
export function applyOptions(options) {
|
|
219
|
+
const c8yAppVarName = options['c8yAppVarName'] || 'C8Y_APP';
|
|
220
|
+
const updatedWindow = updateWindowObject(window, c8yAppVarName, options);
|
|
221
|
+
options = updatedWindow[c8yAppVarName];
|
|
222
|
+
setVersion(options);
|
|
223
|
+
updateTitle(options, document);
|
|
224
|
+
updateFavicon(options, document);
|
|
225
|
+
updateBrandingUrl(options, document);
|
|
226
|
+
updateCss(options, document);
|
|
227
|
+
updateTranslations(options);
|
|
228
|
+
return options;
|
|
229
|
+
}
|
|
230
|
+
export function setVersion(options) {
|
|
231
|
+
const { c8yVersionName = 'UI_VERSION' } = options;
|
|
232
|
+
window[c8yVersionName] = options.versions.ng1 || options.versions.ngx;
|
|
233
|
+
}
|
|
234
|
+
export function updateTitle({ globalTitle }, document) {
|
|
235
|
+
if (!globalTitle) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const titleEl = document.querySelector('title');
|
|
239
|
+
titleEl.innerText = `${globalTitle} - ${titleEl.innerText}`;
|
|
240
|
+
}
|
|
241
|
+
export function updateFavicon({ faviconUrl = 'favicon.ico' }, document) {
|
|
242
|
+
const link = document.createElement('link');
|
|
243
|
+
link.setAttribute('rel', 'icon');
|
|
244
|
+
link.setAttribute('href', faviconUrl);
|
|
245
|
+
document.querySelector('head').appendChild(link);
|
|
246
|
+
}
|
|
247
|
+
export function updateBrandingUrl({ brandingUrl }, document) {
|
|
248
|
+
if (!brandingUrl) {
|
|
249
|
+
if (__ENTRY_BRANDING__) {
|
|
250
|
+
/**
|
|
251
|
+
* Added ngGlobalStyle. Without it, the Angular webpack configuration only uses less-loader for project styles (c8y/style package).
|
|
252
|
+
* After adding ngGlobalStyle, the rest of the loaders: postcss, css, and mini-css-extract will be applied to the project styles.
|
|
253
|
+
*/
|
|
254
|
+
import(/* webpackChunkName: "branding" */ `${__ENTRY_BRANDING__}?ngGlobalStyle`);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
throw new Error('Branding definition missing.');
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
const link = document.createElement('link');
|
|
262
|
+
link.setAttribute('rel', 'stylesheet');
|
|
263
|
+
link.setAttribute('href', brandingUrl);
|
|
264
|
+
document.querySelector('head').appendChild(link);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
export function updateCss({ brandingCssVars, extraCssUrls }, document) {
|
|
268
|
+
if (Array.isArray(extraCssUrls)) {
|
|
269
|
+
extraCssUrls.forEach(url => {
|
|
270
|
+
const link = document.createElement('link');
|
|
271
|
+
link.setAttribute('rel', 'stylesheet');
|
|
272
|
+
link.setAttribute('href', url);
|
|
273
|
+
document.querySelector('head').appendChild(link);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
if (brandingCssVars) {
|
|
277
|
+
const vars = Object.keys(brandingCssVars).map(key => `--${key}: ${brandingCssVars[key]};`);
|
|
278
|
+
const style = document.createElement('style');
|
|
279
|
+
style.appendChild(document.createTextNode(`:root{\n${vars.join('\n')}\n}`));
|
|
280
|
+
document.querySelector('body').appendChild(style);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
export function updateTranslations(options) {
|
|
284
|
+
if (options?.i18nExtra) {
|
|
285
|
+
options.langsDetails = { ...options.langsDetails, ...options.i18nExtra };
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=options-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options-resolver.js","sourceRoot":"","sources":["../../resolvers/options-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,MAAM,MAAM,WAAW,CAAC;AAG/B,IAAI,kBAAkB,CAAC;AACvB,IAAI,eAAe,CAAC;AAapB,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,MAAM,UAAU,GAAG,cAAc,EAAE,CAAC,CAAC,gCAAgC;IACrE,MAAM,aAAa,GAAG,iBAAiB,EAAE,CAAC;IAC1C,MAAM,cAAc,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAClD,MAAM,mBAAm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,SAAS,EAAE;QACtB,OAAO,CAAC,YAAY,GAAG,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;KAC1E;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@c8y/bootstrap",
|
|
3
|
+
"version": "1019.0.3",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"author": "Cumulocity",
|
|
6
|
+
"description": "Bootstrap layer",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=14"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "rimraf dist && tsc -p ./tsconfig.json"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/"
|
|
20
|
+
],
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"typescript": "4.9.5"
|
|
23
|
+
},
|
|
24
|
+
"builders": "./dist/builders.json",
|
|
25
|
+
"keywords": [
|
|
26
|
+
"Cumulocity",
|
|
27
|
+
"IoT",
|
|
28
|
+
"m2m",
|
|
29
|
+
"devkit",
|
|
30
|
+
"tools"
|
|
31
|
+
],
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"chroma-js": "2.4.2",
|
|
34
|
+
"lodash": "4.17.21"
|
|
35
|
+
}
|
|
36
|
+
}
|