@descope/web-components-ui 1.0.40 → 1.0.42

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.
Files changed (36) hide show
  1. package/dist/cjs/index.cjs.js +35 -18
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +416 -343
  4. package/dist/index.esm.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/components/descope-button/index.js +3 -3
  7. package/src/components/descope-checkbox/index.js +2 -2
  8. package/src/components/descope-combo/index.js +12 -12
  9. package/src/components/descope-container/Container.js +57 -51
  10. package/src/components/descope-container/index.js +1 -1
  11. package/src/components/descope-date-picker/index.js +13 -7
  12. package/src/components/descope-email-field/index.js +2 -2
  13. package/src/components/descope-number-field/index.js +2 -2
  14. package/src/components/descope-password-field/index.js +2 -2
  15. package/src/components/descope-switch-toggle/index.js +2 -2
  16. package/src/components/descope-text-area/index.js +2 -2
  17. package/src/components/descope-text-field/index.js +3 -3
  18. package/src/componentsHelpers/componentNameValidationMixin.js +21 -17
  19. package/src/componentsHelpers/createProxy/helpers.js +31 -27
  20. package/src/componentsHelpers/createStyleMixin/helpers.js +65 -47
  21. package/src/componentsHelpers/createStyleMixin/index.js +76 -55
  22. package/src/componentsHelpers/draggableMixin.js +25 -26
  23. package/src/constants.js +1 -1
  24. package/src/dev/index.js +4 -3
  25. package/src/helpers.js +8 -6
  26. package/src/index.cjs.js +1 -1
  27. package/src/index.js +13 -13
  28. package/src/index.umd.js +11 -5
  29. package/src/theme/components/button.js +37 -37
  30. package/src/theme/components/container.js +10 -12
  31. package/src/theme/components/textArea.js +3 -3
  32. package/src/theme/components/textField.js +1 -1
  33. package/src/theme/globals.js +44 -36
  34. package/src/theme/index.js +2 -2
  35. package/src/themeHelpers/index.js +45 -30
  36. package/src/themeHelpers/processColors.js +10 -7
@@ -1,57 +1,63 @@
1
- import { getComponentName, createStyleMixin, draggableMixin, compose, componentNameValidationMixin } from "../../componentsHelpers";
1
+ import {
2
+ getComponentName,
3
+ createStyleMixin,
4
+ draggableMixin,
5
+ compose,
6
+ componentNameValidationMixin
7
+ } from '../../componentsHelpers';
2
8
 
3
- export const componentName = getComponentName("container");
9
+ export const componentName = getComponentName('container');
4
10
 
5
11
  class RawContainer extends HTMLElement {
6
- static get componentName() {
7
- return componentName
8
- }
9
- constructor() {
10
- super();
11
- const template = document.createElement('template');
12
- template.innerHTML = `<slot></slot>`;
13
-
14
- this.attachShadow({ mode: 'open' });
15
- this.shadowRoot.appendChild(template.content.cloneNode(true));
16
-
17
- this.baseSelector = ':host > slot'
18
- }
12
+ static get componentName() {
13
+ return componentName;
14
+ }
15
+ constructor() {
16
+ super();
17
+ const template = document.createElement('template');
18
+ template.innerHTML = `<slot></slot>`;
19
+
20
+ this.attachShadow({ mode: 'open' });
21
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
22
+
23
+ this.baseSelector = ':host > slot';
24
+ }
19
25
  }
20
26
 
21
27
  const Container = compose(
22
- createStyleMixin({
23
- // todo: do we want to change the mapping structure to this? ['aa', 'aaa', {'color': [{ selector: '::part(label)' }]}],
24
- mappings: {
25
- 'height': {},
26
- 'width': {},
27
-
28
- 'verticalPadding': [
29
- { property: 'padding-top' },
30
- { property: 'padding-bottom' }
31
- ],
32
- 'horizontalPadding': [
33
- { property: 'padding-left' },
34
- { property: 'padding-right' }
35
- ],
36
-
37
- 'display': {},
38
- 'flexDirection': {},
39
- 'justifyContent': {},
40
- 'alignItems': {},
41
- 'gap': {},
42
-
43
- 'backgroundColor': {},
44
- 'borderRadius': {},
45
-
46
- 'borderColor': {},
47
- 'borderStyle': {},
48
- 'borderWidth': {},
49
-
50
- 'boxShadow': {},
51
- },
52
- }),
53
- draggableMixin,
54
- componentNameValidationMixin,
55
- )(RawContainer)
56
-
57
- export default Container
28
+ createStyleMixin({
29
+ // todo: do we want to change the mapping structure to this? ['aa', 'aaa', {'color': [{ selector: '::part(label)' }]}],
30
+ mappings: {
31
+ height: {},
32
+ width: {},
33
+
34
+ verticalPadding: [
35
+ { property: 'padding-top' },
36
+ { property: 'padding-bottom' }
37
+ ],
38
+ horizontalPadding: [
39
+ { property: 'padding-left' },
40
+ { property: 'padding-right' }
41
+ ],
42
+
43
+ display: {},
44
+ flexDirection: {},
45
+ justifyContent: {},
46
+ alignItems: {},
47
+ gap: {},
48
+
49
+ backgroundColor: {},
50
+ borderRadius: {},
51
+
52
+ borderColor: {},
53
+ borderStyle: {},
54
+ borderWidth: {},
55
+
56
+ boxShadow: {}
57
+ }
58
+ }),
59
+ draggableMixin,
60
+ componentNameValidationMixin
61
+ )(RawContainer);
62
+
63
+ export default Container;
@@ -2,4 +2,4 @@ import Container, { componentName } from './Container';
2
2
 
3
3
  customElements.define(componentName, Container);
4
4
 
5
- export { Container }
5
+ export { Container };
@@ -1,7 +1,13 @@
1
- import "@vaadin/date-picker";
2
- import { getComponentName, draggableMixin, createProxy, compose, componentNameValidationMixin } from "../../componentsHelpers";
1
+ import '@vaadin/date-picker';
2
+ import {
3
+ getComponentName,
4
+ draggableMixin,
5
+ createProxy,
6
+ compose,
7
+ componentNameValidationMixin
8
+ } from '../../componentsHelpers';
3
9
 
4
- const componentName = getComponentName("date-picker");
10
+ const componentName = getComponentName('date-picker');
5
11
 
6
12
  const DatePicker = compose(
7
13
  draggableMixin,
@@ -9,12 +15,12 @@ const DatePicker = compose(
9
15
  )(
10
16
  createProxy({
11
17
  componentName,
12
- slots: ["prefix", "suffix"],
13
- wrappedEleName: "vaadin-date-picker",
14
- style: ``,
18
+ slots: ['prefix', 'suffix'],
19
+ wrappedEleName: 'vaadin-date-picker',
20
+ style: ``
15
21
  })
16
22
  );
17
23
 
18
24
  customElements.define(componentName, DatePicker);
19
25
 
20
- export { DatePicker }
26
+ export { DatePicker };
@@ -1,5 +1,5 @@
1
- import "@vaadin/email-field";
2
- import EmailField, { componentName } from "./EmailField";
1
+ import '@vaadin/email-field';
2
+ import EmailField, { componentName } from './EmailField';
3
3
 
4
4
  customElements.define(componentName, EmailField);
5
5
 
@@ -1,5 +1,5 @@
1
- import "@vaadin/number-field";
2
- import NumberField, { componentName } from "./NumberField";
1
+ import '@vaadin/number-field';
2
+ import NumberField, { componentName } from './NumberField';
3
3
 
4
4
  customElements.define(componentName, NumberField);
5
5
 
@@ -1,5 +1,5 @@
1
- import "@vaadin/password-field";
2
- import PasswordField, { componentName } from "./PasswordField";
1
+ import '@vaadin/password-field';
2
+ import PasswordField, { componentName } from './PasswordField';
3
3
 
4
4
  customElements.define(componentName, PasswordField);
5
5
 
@@ -1,5 +1,5 @@
1
- import "@vaadin/checkbox";
2
- import SwitchToggle, { componentName } from "./SwitchToggle";
1
+ import '@vaadin/checkbox';
2
+ import SwitchToggle, { componentName } from './SwitchToggle';
3
3
 
4
4
  customElements.define(componentName, SwitchToggle);
5
5
 
@@ -1,5 +1,5 @@
1
- import "@vaadin/text-area";
2
- import TextArea, { componentName } from "./TextArea";
1
+ import '@vaadin/text-area';
2
+ import TextArea, { componentName } from './TextArea';
3
3
 
4
4
  customElements.define(componentName, TextArea);
5
5
 
@@ -1,6 +1,6 @@
1
- import "@vaadin/text-field";
2
- import TextField, { componentName } from "./TextField";
1
+ import '@vaadin/text-field';
2
+ import TextField, { componentName } from './TextField';
3
3
 
4
4
  customElements.define(componentName, TextField);
5
5
 
6
- export { TextField }
6
+ export { TextField };
@@ -1,21 +1,25 @@
1
1
  export const componentNameValidationMixin = (superclass) =>
2
- class DraggableMixinClass extends superclass {
3
- #checkComponentName() {
4
- const currentComponentName = this.shadowRoot.host.tagName.toLowerCase();
2
+ class DraggableMixinClass extends superclass {
3
+ #checkComponentName() {
4
+ const currentComponentName = this.shadowRoot.host.tagName.toLowerCase();
5
5
 
6
- if (!superclass.componentName) {
7
- throw Error(`component name is not defined on super class, make sure you have a static get for "componentName"`)
8
- }
6
+ if (!superclass.componentName) {
7
+ throw Error(
8
+ `component name is not defined on super class, make sure you have a static get for "componentName"`
9
+ );
10
+ }
9
11
 
10
- if (currentComponentName !== superclass.componentName) {
11
- throw Error(`component name mismatch, expected "${superclass.componentName}", current "${currentComponentName}"`)
12
- }
13
- }
12
+ if (currentComponentName !== superclass.componentName) {
13
+ throw Error(
14
+ `component name mismatch, expected "${superclass.componentName}", current "${currentComponentName}"`
15
+ );
16
+ }
17
+ }
14
18
 
15
- connectedCallback() {
16
- super.connectedCallback?.();
17
- if (this.shadowRoot.isConnected) {
18
- this.#checkComponentName()
19
- }
20
- }
21
- }
19
+ connectedCallback() {
20
+ super.connectedCallback?.();
21
+ if (this.shadowRoot.isConnected) {
22
+ this.#checkComponentName();
23
+ }
24
+ }
25
+ };
@@ -1,33 +1,37 @@
1
-
2
1
  const observeAttributes = (ele, callback, excludeAttrs) => {
3
- // sync all attrs on init
4
- callback(...Array.from(ele.attributes).map(attr => attr.name));
2
+ // sync all attrs on init
3
+ callback(...Array.from(ele.attributes).map((attr) => attr.name));
5
4
 
6
- const observer = new MutationObserver((mutationsList) => {
7
- for (const mutation of mutationsList) {
8
- if (mutation.type === "attributes" && !excludeAttrs.includes(mutation.attributeName)) {
9
- callback(mutation.attributeName);
10
- }
11
- }
12
- });
5
+ const observer = new MutationObserver((mutationsList) => {
6
+ for (const mutation of mutationsList) {
7
+ if (
8
+ mutation.type === 'attributes' &&
9
+ !excludeAttrs.includes(mutation.attributeName)
10
+ ) {
11
+ callback(mutation.attributeName);
12
+ }
13
+ }
14
+ });
13
15
 
14
- observer.observe(ele, { attributes: true });
15
- }
16
+ observer.observe(ele, { attributes: true });
17
+ };
16
18
 
17
- const createSyncAttrsCb = (srcEle, targetEle) => (...attrNames) => {
18
- attrNames.forEach(attrName => {
19
- const srcAttrVal = srcEle.getAttribute(attrName);
20
- if (srcAttrVal !== null) {
21
- if (targetEle.getAttribute(attrName) !== srcAttrVal) {
22
- targetEle.setAttribute(attrName, srcAttrVal);
23
- }
24
- } else {
25
- targetEle.removeAttribute(attrName);
26
- }
27
- })
28
- }
19
+ const createSyncAttrsCb =
20
+ (srcEle, targetEle) =>
21
+ (...attrNames) => {
22
+ attrNames.forEach((attrName) => {
23
+ const srcAttrVal = srcEle.getAttribute(attrName);
24
+ if (srcAttrVal !== null) {
25
+ if (targetEle.getAttribute(attrName) !== srcAttrVal) {
26
+ targetEle.setAttribute(attrName, srcAttrVal);
27
+ }
28
+ } else {
29
+ targetEle.removeAttribute(attrName);
30
+ }
31
+ });
32
+ };
29
33
 
30
34
  export const syncAttrs = (ele1, ele2, excludeAttrs) => {
31
- observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), excludeAttrs)
32
- observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), excludeAttrs)
33
- }
35
+ observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), excludeAttrs);
36
+ observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), excludeAttrs);
37
+ };
@@ -1,68 +1,86 @@
1
- import { getCssVarName, kebabCase } from "../../helpers"
1
+ import { getCssVarName, kebabCase } from '../../helpers';
2
2
 
3
- const createCssVarFallback = (first, ...rest) => `var(${first}${rest.length ? ` , ${createCssVarFallback(...rest)}` : ''})`;
3
+ const createCssVarFallback = (first, ...rest) =>
4
+ `var(${first}${rest.length ? ` , ${createCssVarFallback(...rest)}` : ''})`;
4
5
 
5
- const createCssSelector = (baseSelector = '', relativeSelectorOrSelectorFn = '') =>
6
- typeof relativeSelectorOrSelectorFn === 'function' ?
7
- relativeSelectorOrSelectorFn(baseSelector) :
8
- `${baseSelector}${relativeSelectorOrSelectorFn}`;
6
+ const createCssSelector = (
7
+ baseSelector = '',
8
+ relativeSelectorOrSelectorFn = ''
9
+ ) =>
10
+ typeof relativeSelectorOrSelectorFn === 'function'
11
+ ? relativeSelectorOrSelectorFn(baseSelector)
12
+ : `${baseSelector}${relativeSelectorOrSelectorFn}`;
9
13
 
10
14
  class StyleBuilder {
11
- constructor() {
12
- this.styleMap = new Map()
13
- }
14
-
15
- add(selector, property, value) {
16
- if (!this.styleMap.has(selector)) {
17
- this.styleMap.set(selector, [])
18
- }
19
-
20
- this.styleMap.set(selector, [...this.styleMap.get(selector), { property, value }])
21
- }
22
-
23
- toString() {
24
- return Array.from(this.styleMap.entries()).reduce((style, [selector, propValArr]) =>
25
- style += `${selector} { \n${propValArr.map(({ property, value }) => `${property}: ${value}`).join(';\n')} \n}\n\n`
26
- , '')
27
- }
15
+ constructor() {
16
+ this.styleMap = new Map();
17
+ }
18
+
19
+ add(selector, property, value) {
20
+ if (!this.styleMap.has(selector)) {
21
+ this.styleMap.set(selector, []);
22
+ }
23
+
24
+ this.styleMap.set(selector, [
25
+ ...this.styleMap.get(selector),
26
+ { property, value }
27
+ ]);
28
+ }
29
+
30
+ toString() {
31
+ return Array.from(this.styleMap.entries()).reduce(
32
+ (style, [selector, propValArr]) =>
33
+ (style += `${selector} { \n${propValArr
34
+ .map(({ property, value }) => `${property}: ${value}`)
35
+ .join(';\n')} \n}\n\n`),
36
+ ''
37
+ );
38
+ }
28
39
  }
29
40
 
30
41
  const normalizeConfig = (attr, config) => {
31
- const defaultMapping = { selector: '', property: kebabCase(attr) }
42
+ const defaultMapping = { selector: '', property: kebabCase(attr) };
32
43
 
33
- if (!config || !Object.keys(config).length) return [defaultMapping];
44
+ if (!config || !Object.keys(config).length) return [defaultMapping];
34
45
 
35
- if (Array.isArray(config)) return config.map(entry => Object.assign({}, defaultMapping, entry));
46
+ if (Array.isArray(config))
47
+ return config.map((entry) => Object.assign({}, defaultMapping, entry));
36
48
 
37
- return [Object.assign({}, defaultMapping, config)];
38
- }
49
+ return [Object.assign({}, defaultMapping, config)];
50
+ };
39
51
 
40
52
  export const createStyle = (componentName, baseSelector, mappings) => {
41
- const style = new StyleBuilder();
53
+ const style = new StyleBuilder();
42
54
 
43
- Object.keys(mappings).forEach((attr) => {
44
- const attrConfig = normalizeConfig(attr, mappings[attr])
55
+ Object.keys(mappings).forEach((attr) => {
56
+ const attrConfig = normalizeConfig(attr, mappings[attr]);
45
57
 
46
- const cssVarName = getCssVarName(componentName, attr)
58
+ const cssVarName = getCssVarName(componentName, attr);
47
59
 
48
- attrConfig.forEach(({ selector: relativeSelectorOrSelectorFn, property }) => {
49
- style.add(
50
- createCssSelector(baseSelector, relativeSelectorOrSelectorFn),
51
- property,
52
- createCssVarFallback(cssVarName)
53
- )
54
- })
55
- })
60
+ attrConfig.forEach(
61
+ ({ selector: relativeSelectorOrSelectorFn, property }) => {
62
+ style.add(
63
+ createCssSelector(baseSelector, relativeSelectorOrSelectorFn),
64
+ property,
65
+ createCssVarFallback(cssVarName)
66
+ );
67
+ }
68
+ );
69
+ });
56
70
 
57
- return style.toString();
58
- }
71
+ return style.toString();
72
+ };
59
73
 
60
74
  export const createCssVarsList = (componentName, mappings) =>
61
- Object.keys(mappings).reduce(
62
- (acc, attr) => Object.assign(acc, { [attr]: getCssVarName(componentName, attr) }),
63
- {}
64
- )
75
+ Object.keys(mappings).reduce(
76
+ (acc, attr) =>
77
+ Object.assign(acc, { [attr]: getCssVarName(componentName, attr) }),
78
+ {}
79
+ );
65
80
 
66
81
  // match the host selector with the inner element selector
67
82
  // e.g. when we want to set the same size for the host & the inner element this can be useful
68
- export const matchHostStyle = (mappingObj) => [mappingObj, {...mappingObj, selector: () => `:host${mappingObj.selector || ''}`}];
83
+ export const matchHostStyle = (mappingObj) => [
84
+ mappingObj,
85
+ { ...mappingObj, selector: () => `:host${mappingObj.selector || ''}` }
86
+ ];
@@ -1,58 +1,79 @@
1
1
  import { getCssVarName, kebabCaseJoin } from '../../helpers';
2
2
  import { createStyle, createCssVarsList } from './helpers';
3
3
 
4
- export const createStyleMixin = ({ mappings = {} }) => (superclass) => {
5
- const styleAttributes = Object.keys(mappings).map(key => kebabCaseJoin('st', key))
6
- return class CustomStyleMixinClass extends superclass {
7
- static get observedAttributes() {
8
- const superAttrs = superclass.observedAttributes || []
9
- return [...superAttrs, ...styleAttributes]
10
- }
11
-
12
- static get cssVarList() {
13
- return createCssVarsList(superclass.componentName, mappings)
14
- }
15
-
16
- #styleEle = null;
17
-
18
- constructor() {
19
- super();
20
-
21
- this.#createComponentStyle()
22
- this.#createAttrOverrideStyle()
23
- }
24
-
25
- #createAttrOverrideStyle() {
26
- this.#styleEle = document.createElement('style');
27
- this.#styleEle.id = 'style-mixin-overrides'
28
-
29
- this.#styleEle.innerText = '* {}'
30
- this.shadowRoot.prepend(this.#styleEle);
31
- }
32
-
33
- #updateAttrOverrideStyle(attrName, value) {
34
- const style = this.#styleEle.sheet.cssRules[0].style;
35
- const varName = getCssVarName(superclass.componentName, attrName.replace(/^st-/, ''))
36
-
37
- if (value)
38
- style.setProperty(varName, value)
39
- else
40
- style.removeProperty(varName)
41
- }
42
-
43
- #createComponentStyle() {
44
- const themeStyle = document.createElement('style');
45
- themeStyle.id = 'style-mixin-component'
46
- themeStyle.innerHTML = createStyle(superclass.componentName, this.baseSelector, mappings)
47
- this.shadowRoot.prepend(themeStyle);
48
- }
49
-
50
- attributeChangedCallback(attrName, oldValue, newValue) {
51
- super.attributeChangedCallback?.(attrName, oldValue, newValue);
52
-
53
- if (styleAttributes.includes(attrName)) {
54
- this.#updateAttrOverrideStyle(attrName, newValue)
55
- }
56
- }
57
- }
58
- }
4
+ export const createStyleMixin =
5
+ ({ mappings = {} }) =>
6
+ (superclass) => {
7
+ const styleAttributes = Object.keys(mappings).map((key) =>
8
+ kebabCaseJoin('st', key)
9
+ );
10
+ return class CustomStyleMixinClass extends superclass {
11
+ static get observedAttributes() {
12
+ const superAttrs = superclass.observedAttributes || [];
13
+ return [...superAttrs, ...styleAttributes];
14
+ }
15
+
16
+ static get cssVarList() {
17
+ return createCssVarsList(superclass.componentName, mappings);
18
+ }
19
+
20
+ #styleEle = null;
21
+
22
+ constructor() {
23
+ super();
24
+
25
+ this.#createComponentStyle();
26
+ this.#createAttrOverrideStyle();
27
+ }
28
+
29
+ #createAttrOverrideStyle() {
30
+ this.#styleEle = document.createElement('style');
31
+ this.#styleEle.id = 'style-mixin-overrides';
32
+
33
+ this.#styleEle.innerText = '* {}';
34
+ this.shadowRoot.prepend(this.#styleEle);
35
+ }
36
+
37
+ #updateAttrOverrideStyle(attrName, value) {
38
+ const style = this.#styleEle.sheet.cssRules[0].style;
39
+ const varName = getCssVarName(
40
+ superclass.componentName,
41
+ attrName.replace(/^st-/, '')
42
+ );
43
+
44
+ if (value) style.setProperty(varName, value);
45
+ else style.removeProperty(varName);
46
+ }
47
+
48
+ #createComponentStyle() {
49
+ const themeStyle = document.createElement('style');
50
+ themeStyle.id = 'style-mixin-component';
51
+ themeStyle.innerHTML = createStyle(
52
+ superclass.componentName,
53
+ this.baseSelector,
54
+ mappings
55
+ );
56
+ this.shadowRoot.prepend(themeStyle);
57
+ }
58
+
59
+ attributeChangedCallback(attrName, oldValue, newValue) {
60
+ super.attributeChangedCallback?.(attrName, oldValue, newValue);
61
+
62
+ if (styleAttributes.includes(attrName)) {
63
+ this.#updateAttrOverrideStyle(attrName, newValue);
64
+ }
65
+ }
66
+
67
+ // we need to see if this is needed
68
+ // connectedCallback() {
69
+ // super.connectedCallback?.();
70
+ // if (this.shadowRoot.isConnected) {
71
+ // Array.from(this.attributes).forEach(attr => {
72
+ // if (styleAttributes.includes(attr.nodeName)) {
73
+ // this.#updateAttrOverrideStyle(attr.nodeName, attr.value)
74
+ // }
75
+ // });
76
+ // }
77
+ // }
78
+ };
79
+ };
@@ -1,32 +1,31 @@
1
1
  export const draggableMixin = (superclass) =>
2
- class DraggableMixinClass extends superclass {
2
+ class DraggableMixinClass extends superclass {
3
+ #styleEle = null;
3
4
 
4
- #styleEle = null;
5
+ static get observedAttributes() {
6
+ const superAttrs = superclass.observedAttributes || [];
7
+ return [...superAttrs, 'draggable'];
8
+ }
5
9
 
6
- static get observedAttributes() {
7
- const superAttrs = superclass.observedAttributes || []
8
- return [...superAttrs, 'draggable']
9
- }
10
+ constructor() {
11
+ super();
10
12
 
11
- constructor() {
12
- super();
13
+ this.#styleEle = document.createElement('style');
14
+ this.#styleEle.innerText = `${this.baseSelector} { cursor: inherit }`;
15
+ }
13
16
 
14
- this.#styleEle = document.createElement('style');
15
- this.#styleEle.innerText = `${this.baseSelector} { cursor: inherit }`;
16
- }
17
+ #handleDraggableStyle(isDraggable) {
18
+ if (isDraggable) {
19
+ this.shadowRoot.appendChild(this.#styleEle);
20
+ } else {
21
+ this.#styleEle.remove();
22
+ }
23
+ }
17
24
 
18
- #handleDraggableStyle(isDraggable) {
19
- if (isDraggable) {
20
- this.shadowRoot.appendChild(this.#styleEle)
21
- } else {
22
- this.#styleEle.remove();
23
- }
24
- }
25
-
26
- attributeChangedCallback(attrName, oldValue, newValue) {
27
- super.attributeChangedCallback?.(attrName, oldValue, newValue);
28
- if (attrName === 'draggable') {
29
- this.#handleDraggableStyle(newValue === 'true')
30
- }
31
- }
32
- }
25
+ attributeChangedCallback(attrName, oldValue, newValue) {
26
+ super.attributeChangedCallback?.(attrName, oldValue, newValue);
27
+ if (attrName === 'draggable') {
28
+ this.#handleDraggableStyle(newValue === 'true');
29
+ }
30
+ }
31
+ };
package/src/constants.js CHANGED
@@ -1 +1 @@
1
- export const DESCOPE_PREFIX = 'descope'
1
+ export const DESCOPE_PREFIX = 'descope';