@descope/sdk-mixins 0.2.43 → 0.2.44
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/index.cjs.js +38 -38
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +916 -632
- package/dist/index.esm.js +38 -38
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -24,9 +24,9 @@ const loggerMixin = createSingletonMixin((superclass) => { var _LoggerMixinClass
|
|
|
24
24
|
_LoggerMixinClass_wrapLogger = function _LoggerMixinClass_wrapLogger(logger) {
|
|
25
25
|
return logLevels.reduce((acc, logLevel) => {
|
|
26
26
|
acc[logLevel] = (...args) => {
|
|
27
|
-
var
|
|
27
|
+
var _b;
|
|
28
28
|
this.onLogEvent(logLevel, args);
|
|
29
|
-
(
|
|
29
|
+
(_b = logger[logLevel]) === null || _b === void 0 ? void 0 : _b.call(logger, ...args);
|
|
30
30
|
};
|
|
31
31
|
return acc;
|
|
32
32
|
}, {});
|
|
@@ -49,9 +49,9 @@ const initLifecycleMixin = createSingletonMixin((superclass) => { var _InitLifec
|
|
|
49
49
|
_InitLifecycleMixinClass_isInit.set(this, true);
|
|
50
50
|
}
|
|
51
51
|
connectedCallback() {
|
|
52
|
-
var
|
|
53
|
-
(
|
|
54
|
-
if ((
|
|
52
|
+
var _b, _c;
|
|
53
|
+
(_b = super.connectedCallback) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
54
|
+
if ((_c = this.shadowRoot) === null || _c === void 0 ? void 0 : _c.isConnected) {
|
|
55
55
|
// the init function is running once, on the first time the component is connected
|
|
56
56
|
if (__classPrivateFieldGet(this, _InitLifecycleMixinClass_isInit, "f")) {
|
|
57
57
|
__classPrivateFieldSet(this, _InitLifecycleMixinClass_isInit, false, "f");
|
|
@@ -87,11 +87,11 @@ const observeAttributesMixin = createSingletonMixin((superclass) => {
|
|
|
87
87
|
_ObserveAttributesMixinClass_observeMappings.set(this, {});
|
|
88
88
|
}
|
|
89
89
|
async init() {
|
|
90
|
-
var
|
|
91
|
-
await ((
|
|
90
|
+
var _b;
|
|
91
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
92
92
|
attributesObserver(this, (attrName) => {
|
|
93
|
-
var
|
|
94
|
-
(
|
|
93
|
+
var _b;
|
|
94
|
+
(_b = __classPrivateFieldGet(this, _ObserveAttributesMixinClass_observeMappings, "f")[attrName]) === null || _b === void 0 ? void 0 : _b.forEach((cb) => {
|
|
95
95
|
cb(attrName, this.getAttribute(attrName));
|
|
96
96
|
});
|
|
97
97
|
});
|
|
@@ -126,8 +126,8 @@ const createValidateAttributesMixin = (mappings) => (superclass) => {
|
|
|
126
126
|
this.observeAttributes(mappingsNames, __classPrivateFieldGet(this, _ValidateAttributesMixinClass_instances, "m", _ValidateAttributesMixinClass_handleError).bind(this));
|
|
127
127
|
}
|
|
128
128
|
async init() {
|
|
129
|
-
var
|
|
130
|
-
await ((
|
|
129
|
+
var _b;
|
|
130
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
131
131
|
// check attributes initial values
|
|
132
132
|
mappingsNames.forEach((attr) => __classPrivateFieldGet(this, _ValidateAttributesMixinClass_instances, "m", _ValidateAttributesMixinClass_handleError).call(this, attr, this.getAttribute(attr)));
|
|
133
133
|
}
|
|
@@ -231,8 +231,8 @@ const debuggerMixin = createSingletonMixin((superclass) => { var _DebuggerMixinC
|
|
|
231
231
|
_DebuggerMixinClass_instances.add(this);
|
|
232
232
|
_DebuggerMixinClass_debuggerEle.set(this, void 0);
|
|
233
233
|
this.attributeChangedCallback = (attrName, oldValue, newValue) => {
|
|
234
|
-
var
|
|
235
|
-
(
|
|
234
|
+
var _b;
|
|
235
|
+
(_b = super.attributeChangedCallback) === null || _b === void 0 ? void 0 : _b.call(this, attrName, oldValue, newValue);
|
|
236
236
|
if (attrName === 'debug') {
|
|
237
237
|
__classPrivateFieldGet(this, _DebuggerMixinClass_instances, "m", _DebuggerMixinClass_handleDebugMode).call(this);
|
|
238
238
|
}
|
|
@@ -242,23 +242,23 @@ const debuggerMixin = createSingletonMixin((superclass) => { var _DebuggerMixinC
|
|
|
242
242
|
return this.getAttribute('debug') === 'true';
|
|
243
243
|
}
|
|
244
244
|
onLogEvent(logLevel, args) {
|
|
245
|
-
var
|
|
246
|
-
(
|
|
245
|
+
var _b;
|
|
246
|
+
(_b = super.onLogEvent) === null || _b === void 0 ? void 0 : _b.call(this, logLevel, args);
|
|
247
247
|
if (logLevel === 'error') {
|
|
248
248
|
__classPrivateFieldGet(this, _DebuggerMixinClass_instances, "m", _DebuggerMixinClass_updateDebuggerMessages).call(this, args[0] || 'Error', args[1]);
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
async init() {
|
|
252
|
-
var
|
|
253
|
-
await ((
|
|
252
|
+
var _b;
|
|
253
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
254
254
|
__classPrivateFieldGet(this, _DebuggerMixinClass_instances, "m", _DebuggerMixinClass_handleDebugMode).call(this);
|
|
255
255
|
}
|
|
256
256
|
},
|
|
257
257
|
_DebuggerMixinClass_debuggerEle = new WeakMap(),
|
|
258
258
|
_DebuggerMixinClass_instances = new WeakSet(),
|
|
259
259
|
_DebuggerMixinClass_disableDebugger = function _DebuggerMixinClass_disableDebugger() {
|
|
260
|
-
var
|
|
261
|
-
(
|
|
260
|
+
var _b;
|
|
261
|
+
(_b = __classPrivateFieldGet(this, _DebuggerMixinClass_debuggerEle, "f")) === null || _b === void 0 ? void 0 : _b.remove();
|
|
262
262
|
__classPrivateFieldSet(this, _DebuggerMixinClass_debuggerEle, null, "f");
|
|
263
263
|
},
|
|
264
264
|
_DebuggerMixinClass_enableDebugger = async function _DebuggerMixinClass_enableDebugger() {
|
|
@@ -283,9 +283,9 @@ const debuggerMixin = createSingletonMixin((superclass) => { var _DebuggerMixinC
|
|
|
283
283
|
__classPrivateFieldGet(this, _DebuggerMixinClass_instances, "m", _DebuggerMixinClass_disableDebugger).call(this);
|
|
284
284
|
},
|
|
285
285
|
_DebuggerMixinClass_updateDebuggerMessages = function _DebuggerMixinClass_updateDebuggerMessages(title, description) {
|
|
286
|
-
var
|
|
286
|
+
var _b;
|
|
287
287
|
if (title)
|
|
288
|
-
(
|
|
288
|
+
(_b = __classPrivateFieldGet(this, _DebuggerMixinClass_debuggerEle, "f")) === null || _b === void 0 ? void 0 : _b.updateData({ title, description });
|
|
289
289
|
},
|
|
290
290
|
_a; });
|
|
291
291
|
|
|
@@ -339,9 +339,9 @@ const descopeUiMixin = createSingletonMixin((superclass) => {
|
|
|
339
339
|
_DescopeUiMixinClass_getComponentsVersion =
|
|
340
340
|
// eslint-disable-next-line class-methods-use-this
|
|
341
341
|
async function _DescopeUiMixinClass_getComponentsVersion() {
|
|
342
|
-
var
|
|
342
|
+
var _b;
|
|
343
343
|
const config = await this.config;
|
|
344
|
-
const componentsVersion = (
|
|
344
|
+
const componentsVersion = (_b = config === null || config === void 0 ? void 0 : config.projectConfig) === null || _b === void 0 ? void 0 : _b.componentsVersion;
|
|
345
345
|
if (!componentsVersion) {
|
|
346
346
|
this.logger.error('Could not get components version');
|
|
347
347
|
}
|
|
@@ -520,9 +520,9 @@ const modalMixin = createSingletonMixin((superclass) => {
|
|
|
520
520
|
});
|
|
521
521
|
}
|
|
522
522
|
async init() {
|
|
523
|
-
var
|
|
523
|
+
var _b;
|
|
524
524
|
this.loadDescopeUiComponents([MODAL_ELE_TAG]);
|
|
525
|
-
await ((
|
|
525
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
526
526
|
}
|
|
527
527
|
},
|
|
528
528
|
_ModalMixinClass_ModalDriverWrapper = new WeakMap(),
|
|
@@ -567,8 +567,8 @@ const notificationsMixin = createSingletonMixin((superclass) => {
|
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
async init() {
|
|
570
|
-
var
|
|
571
|
-
await ((
|
|
570
|
+
var _b;
|
|
571
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
572
572
|
this.loadDescopeUiComponents([NOTIFICATION_ELE_TAG]);
|
|
573
573
|
}
|
|
574
574
|
},
|
|
@@ -620,18 +620,18 @@ const themeMixin = createSingletonMixin((superclass) => {
|
|
|
620
620
|
_ThemeMixinClass__themeResource.set(this, void 0);
|
|
621
621
|
}
|
|
622
622
|
get theme() {
|
|
623
|
-
var
|
|
623
|
+
var _b, _c;
|
|
624
624
|
const theme = this.getAttribute('theme');
|
|
625
625
|
if (theme === 'os') {
|
|
626
626
|
const isOsDark = window.matchMedia &&
|
|
627
|
-
((
|
|
627
|
+
((_c = (_b = window.matchMedia) === null || _b === void 0 ? void 0 : _b.call(window, '(prefers-color-scheme: dark)')) === null || _c === void 0 ? void 0 : _c.matches);
|
|
628
628
|
return isOsDark ? 'dark' : 'light';
|
|
629
629
|
}
|
|
630
630
|
return theme || 'light';
|
|
631
631
|
}
|
|
632
632
|
async init() {
|
|
633
|
-
var
|
|
634
|
-
await ((
|
|
633
|
+
var _b;
|
|
634
|
+
await ((_b = super.init) === null || _b === void 0 ? void 0 : _b.call(this));
|
|
635
635
|
__classPrivateFieldGet(this, _ThemeMixinClass_instances, "m", _ThemeMixinClass_loadGlobalStyle).call(this);
|
|
636
636
|
__classPrivateFieldGet(this, _ThemeMixinClass_instances, "m", _ThemeMixinClass_loadComponentsStyle).call(this);
|
|
637
637
|
__classPrivateFieldGet(this, _ThemeMixinClass_instances, "m", _ThemeMixinClass_loadFonts).call(this);
|
|
@@ -683,32 +683,32 @@ const themeMixin = createSingletonMixin((superclass) => {
|
|
|
683
683
|
return __classPrivateFieldGet(this, _ThemeMixinClass__themeResource, "f");
|
|
684
684
|
},
|
|
685
685
|
_ThemeMixinClass_loadGlobalStyle = async function _ThemeMixinClass_loadGlobalStyle() {
|
|
686
|
-
var
|
|
686
|
+
var _b, _c;
|
|
687
687
|
const theme = await __classPrivateFieldGet(this, _ThemeMixinClass_instances, "a", _ThemeMixinClass_themeResource_get);
|
|
688
688
|
if (!theme)
|
|
689
689
|
return;
|
|
690
690
|
const styleEle = document.createElement('style');
|
|
691
691
|
styleEle.innerText =
|
|
692
|
-
(((
|
|
692
|
+
(((_b = theme === null || theme === void 0 ? void 0 : theme.light) === null || _b === void 0 ? void 0 : _b.globals) || '') + (((_c = theme === null || theme === void 0 ? void 0 : theme.dark) === null || _c === void 0 ? void 0 : _c.globals) || '');
|
|
693
693
|
this.shadowRoot.appendChild(styleEle);
|
|
694
694
|
},
|
|
695
695
|
_ThemeMixinClass_loadComponentsStyle = async function _ThemeMixinClass_loadComponentsStyle() {
|
|
696
|
-
var
|
|
696
|
+
var _b, _c;
|
|
697
697
|
const theme = Object.assign({}, (await __classPrivateFieldGet(this, _ThemeMixinClass_instances, "a", _ThemeMixinClass_themeResource_get)));
|
|
698
698
|
if (!theme)
|
|
699
699
|
return;
|
|
700
700
|
const descopeUi = await this.descopeUi;
|
|
701
701
|
if (descopeUi === null || descopeUi === void 0 ? void 0 : descopeUi.componentsThemeManager) {
|
|
702
702
|
descopeUi.componentsThemeManager.themes = {
|
|
703
|
-
light: (
|
|
704
|
-
dark: (
|
|
703
|
+
light: (_b = theme === null || theme === void 0 ? void 0 : theme.light) === null || _b === void 0 ? void 0 : _b.components,
|
|
704
|
+
dark: (_c = theme === null || theme === void 0 ? void 0 : theme.dark) === null || _c === void 0 ? void 0 : _c.components,
|
|
705
705
|
};
|
|
706
706
|
}
|
|
707
707
|
},
|
|
708
708
|
_ThemeMixinClass_loadFonts = async function _ThemeMixinClass_loadFonts() {
|
|
709
|
-
var
|
|
709
|
+
var _b, _c;
|
|
710
710
|
const { projectConfig } = await this.config;
|
|
711
|
-
const fonts = (
|
|
711
|
+
const fonts = (_c = (_b = projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.cssTemplate) === null || _b === void 0 ? void 0 : _b[this.theme]) === null || _c === void 0 ? void 0 : _c.fonts;
|
|
712
712
|
if (fonts) {
|
|
713
713
|
Object.values(fonts).forEach((font) => {
|
|
714
714
|
if (font.url) {
|