@everymatrix/general-styling-wrapper 1.32.4 → 1.33.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/dist/cjs/general-styling-wrapper.cjs.entry.js +88 -0
- package/dist/cjs/general-styling-wrapper.cjs.js +19 -0
- package/dist/cjs/index-821c995f.js +1396 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/general-styling-wrapper/general-styling-wrapper.css +3 -0
- package/dist/collection/components/general-styling-wrapper/general-styling-wrapper.js +146 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/device.utils.js +0 -0
- package/dist/collection/utils/locale.utils.js +15 -0
- package/dist/components/general-styling-wrapper.d.ts +11 -0
- package/dist/components/general-styling-wrapper.js +106 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/general-styling-wrapper.entry.js +84 -0
- package/dist/esm/general-styling-wrapper.js +17 -0
- package/dist/esm/index-764451bb.js +1370 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/general-styling-wrapper/general-styling-wrapper.esm.js +1 -0
- package/dist/general-styling-wrapper/index.esm.js +0 -0
- package/dist/general-styling-wrapper/p-789f8087.js +1 -0
- package/dist/general-styling-wrapper/p-a7ea48d0.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-styling-wrapper/.stencil/packages/general-styling-wrapper/stencil.config.d.ts +2 -0
- package/dist/types/components/general-styling-wrapper/general-styling-wrapper.d.ts +26 -0
- package/dist/types/components.d.ts +70 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/device.utils.d.ts +0 -0
- package/dist/types/utils/locale.utils.d.ts +8 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +2 -3
- package/LICENSE +0 -21
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-821c995f.js');
|
|
6
|
+
|
|
7
|
+
const mergeTranslations = (url, target) => {
|
|
8
|
+
return new Promise((resolve) => {
|
|
9
|
+
fetch(url)
|
|
10
|
+
.then((res) => res.json())
|
|
11
|
+
.then((data) => {
|
|
12
|
+
Object.keys(data).forEach((item) => {
|
|
13
|
+
target[item] = target[item] ? target[item] : {};
|
|
14
|
+
for (let key in data[item]) {
|
|
15
|
+
target[item][key] = data[item][key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
resolve(true);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const generalStylingWrapperCss = ":host{display:block}";
|
|
24
|
+
|
|
25
|
+
const GeneralStylingWrapper = class {
|
|
26
|
+
constructor(hostRef) {
|
|
27
|
+
index.registerInstance(this, hostRef);
|
|
28
|
+
/**
|
|
29
|
+
* Client custom styling via inline styles
|
|
30
|
+
*/
|
|
31
|
+
this.clientStyling = '';
|
|
32
|
+
/**
|
|
33
|
+
* Client custom styling via url
|
|
34
|
+
*/
|
|
35
|
+
this.clientStylingUrl = '';
|
|
36
|
+
/**
|
|
37
|
+
* Translation via url
|
|
38
|
+
*/
|
|
39
|
+
this.translationUrl = '';
|
|
40
|
+
this.stylingAppends = false;
|
|
41
|
+
this.setClientStyling = () => {
|
|
42
|
+
let sheet = document.createElement('style');
|
|
43
|
+
sheet.innerHTML = this.clientStyling;
|
|
44
|
+
this.el.prepend(sheet);
|
|
45
|
+
};
|
|
46
|
+
this.setClientStylingURL = () => {
|
|
47
|
+
let url = new URL(this.clientStylingUrl);
|
|
48
|
+
let cssFile = document.createElement('style');
|
|
49
|
+
fetch(url.href)
|
|
50
|
+
.then((res) => res.text())
|
|
51
|
+
.then((data) => {
|
|
52
|
+
cssFile.innerHTML = data;
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
this.el.prepend(cssFile);
|
|
55
|
+
}, 1);
|
|
56
|
+
})
|
|
57
|
+
.catch((err) => {
|
|
58
|
+
console.log('error ', err);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
componentDidRender() {
|
|
63
|
+
// start custom styling area
|
|
64
|
+
if (!this.stylingAppends) {
|
|
65
|
+
if (this.clientStyling)
|
|
66
|
+
this.setClientStyling();
|
|
67
|
+
if (this.clientStylingUrl)
|
|
68
|
+
this.setClientStylingURL();
|
|
69
|
+
this.stylingAppends = true;
|
|
70
|
+
}
|
|
71
|
+
// end custom styling area
|
|
72
|
+
}
|
|
73
|
+
async componentWillLoad() {
|
|
74
|
+
const promises = [];
|
|
75
|
+
if (this.translationUrl) {
|
|
76
|
+
const translationPromise = mergeTranslations(this.translationUrl, this.targetTranslations);
|
|
77
|
+
promises.push(translationPromise);
|
|
78
|
+
}
|
|
79
|
+
return await Promise.all(promises);
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
return (index.h("div", { class: "StyleShell" }, index.h("slot", { name: "mainContent" })));
|
|
83
|
+
}
|
|
84
|
+
get el() { return index.getElement(this); }
|
|
85
|
+
};
|
|
86
|
+
GeneralStylingWrapper.style = generalStylingWrapperCss;
|
|
87
|
+
|
|
88
|
+
exports.general_styling_wrapper = GeneralStylingWrapper;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-821c995f.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('general-styling-wrapper.cjs.js', document.baseURI).href));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
return index.bootstrapLazy([["general-styling-wrapper.cjs",[[4,"general-styling-wrapper",{"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"translationUrl":[1,"translation-url"],"targetTranslations":[16]}]]]], options);
|
|
19
|
+
});
|