@descope/web-components-ui 1.0.298 → 1.0.299

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[657],{2663:(e,t,s)=>{s.d(t,{T:()=>i});var n=s(3346);const i=e=>{class t extends((0,n.s)({componentName:e,baseSelector:":host > slot"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <style>\n :host {\n display: inline-block;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n </style>\n <slot part="text-wrapper"></slot>\n ',this.textSlot=this.shadowRoot.querySelector("slot")}}return t}},1655:(e,t,s)=>{s.r(t),s.d(t,{EnrichedTextClass:()=>g});var n=s(4569),i=s(4978),r=s(2061),o=s(4567),l=s(5753),a=s(2663);const d={a:"descope-link"},h=e=>e.map((e=>{const t=(e=>d[e.tag]||e.tag)(e);return(e=>"image"===e?.children?.[0].type)(e)?(e.children[0].attrs.push(["style","width:100%"]),{...e,tag:t}):e?.children?.length>0?{...e,tag:t,children:h(e.children)}:{...e,tag:t}})),c=e=>{const t=document.getSelection().toString(),s=e.clipboardData||window.clipboardData;s.setData("text/plain",t),s.setData("text/html",t),e.preventDefault()},p=(0,o.iY)("enriched-text"),u=(0,a.T)(p),g=(0,r.qC)((0,i.yk)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostDirection:{selector:()=>":host",property:"direction"},fontSize:{},fontFamily:{},fontWeight:{},textColor:{property:"color"},textLineHeight:{property:"line-height"},marginReset:{selector:"*",property:"margin"},textAlign:{}}}),i.e4,i.Ae,(e=>class extends e{static get observedAttributes(){return["disabled-rules","line-break"]}get lineBreak(){return this.getAttribute("line-break")}get disabledRules(){return(this.getAttribute("disabled-rules")||"").split(",").filter(Boolean)}init(){super.init(),this.#e(),this.textSlot.addEventListener("slotchange",this.#t.bind(this))}attributeChangedCallback(e,t,s){super.attributeChangedCallback?.(e,t,s),"disabled-rules"===e&&s!==t&&(this.#e(s),this.#t())}#e(){this.processor=(0,n.Z)({breaks:this.lineBreak}).disable(this.disabledRules)}#t(){const e=this.textSlot.assignedNodes({flatten:!0})?.[0];if(e&&e.nodeType===Node.TEXT_NODE){const t=this.processor.parse(e.textContent,{references:void 0}),s=this.processor.renderer.render(h(t),{breaks:this.lineBreak});if(s!==e.textContent){const t=document.createElement("div");t.classList.add("enriched-text"),t.innerHTML=`\n <style>\n .enriched-text > * { margin:0 }\n .enriched-text > *:not(:only-child):not(:last-child) {\n margin-bottom: var(${g.cssVarList.textLineHeight})\n }\n </style>\n ${s}`,t.addEventListener("copy",c),e.parentNode.replaceChild(t,e)}}}}),l.y)(u);customElements.define(p,g)},5753:(e,t,s)=>{s.d(t,{y:()=>i});var n=s(4567);const i=e=>class extends e{get hideWhenEmpty(){return"true"===this.getAttribute("hide-when-empty")}init(){super.init(),(0,n.P$)(this,(()=>{const e=!!this.childNodes.length;this.style.display=!e&&this.hideWhenEmpty?"none":""}))}}}}]);
1
+ "use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[657],{2663:(e,t,n)=>{n.d(t,{T:()=>i});var s=n(3346);const i=e=>{class t extends((0,s.s)({componentName:e,baseSelector:":host > slot"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <style>\n :host {\n display: inline-block;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n </style>\n <slot part="text-wrapper"></slot>\n ',this.textSlot=this.shadowRoot.querySelector("slot")}}return t}},1655:(e,t,n)=>{n.r(t),n.d(t,{EnrichedTextClass:()=>g});var s=n(4569),i=n(4978),r=n(2061),o=n(4567),l=n(5753),a=n(2663);const d={a:"descope-link"},h=e=>e.map((e=>{const t=(e=>d[e.tag]||e.tag)(e);return(e=>"image"===e?.children?.[0].type)(e)?(e.children[0].attrs.push(["style","width:100%"]),{...e,tag:t}):e?.children?.length>0?{...e,tag:t,children:h(e.children)}:{...e,tag:t}})),c=e=>{const t=document.getSelection().toString(),n=e.clipboardData||window.clipboardData;n.setData("text/plain",t),n.setData("text/html",t),e.preventDefault()},p=(0,o.iY)("enriched-text"),u=(0,a.T)(p),g=(0,r.qC)((0,i.yk)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostDirection:{selector:()=>":host",property:"direction"},fontSize:{},fontFamily:{},fontWeight:{},textColor:{property:"color"},textLineHeight:{property:"line-height"},marginReset:{selector:"*",property:"margin"},textAlign:{}}}),i.e4,i.Ae,(e=>class extends e{static get observedAttributes(){return["disabled-rules","line-break","readonly"]}get lineBreak(){return this.getAttribute("line-break")}get disabledRules(){return(this.getAttribute("disabled-rules")||"").split(",").filter(Boolean)}init(){super.init(),this.#e(),this.textSlot.addEventListener("slotchange",this.#t.bind(this))}attributeChangedCallback(e,t,n){super.attributeChangedCallback?.(e,t,n),"disabled-rules"===e&&n!==t&&(this.#e(n),this.#t()),"readonly"===e&&this.onReadOnlyChange(null!==n)}#e(){this.processor=(0,s.Z)({breaks:this.lineBreak}).disable(this.disabledRules)}#t(){const e=this.textSlot.assignedNodes({flatten:!0})?.[0];if(e&&e.nodeType===Node.TEXT_NODE){const t=this.processor.parse(e.textContent,{references:void 0}),n=this.processor.renderer.render(h(t),{breaks:this.lineBreak});if(n!==e.textContent){const t=document.createElement("div");t.classList.add("enriched-text"),t.innerHTML=`\n <style>\n .enriched-text > * { margin:0 }\n .enriched-text > *:not(:only-child):not(:last-child) {\n margin-bottom: var(${g.cssVarList.textLineHeight})\n }\n </style>\n ${n}`,t.addEventListener("copy",c),e.parentNode.replaceChild(t,e)}}}onReadOnlyChange(e){this.setAttribute("inert",e)}}),l.y)(u);customElements.define(p,g)},5753:(e,t,n)=>{n.d(t,{y:()=>i});var s=n(4567);const i=e=>class extends e{get hideWhenEmpty(){return"true"===this.getAttribute("hide-when-empty")}init(){super.init(),(0,s.P$)(this,(()=>{const e=!!this.childNodes.length;this.style.display=!e&&this.hideWhenEmpty?"none":""}))}}}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/web-components-ui",
3
- "version": "1.0.298",
3
+ "version": "1.0.299",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -13,7 +13,7 @@ const BaseEnrichedTextClass = createBaseTextClass(componentName);
13
13
  const EnrichedTextMixin = (superclass) =>
14
14
  class EnrichedTextMixinClass extends superclass {
15
15
  static get observedAttributes() {
16
- return ['disabled-rules', 'line-break'];
16
+ return ['disabled-rules', 'line-break', 'readonly'];
17
17
  }
18
18
 
19
19
  get lineBreak() {
@@ -39,6 +39,10 @@ const EnrichedTextMixin = (superclass) =>
39
39
  this.#parseChildren();
40
40
  }
41
41
  }
42
+
43
+ if (attrName === 'readonly') {
44
+ this.onReadOnlyChange(newValue !== null);
45
+ }
42
46
  }
43
47
 
44
48
  #initProcessor() {
@@ -64,6 +68,10 @@ const EnrichedTextMixin = (superclass) =>
64
68
  }
65
69
  }
66
70
  }
71
+
72
+ onReadOnlyChange(val) {
73
+ this.setAttribute('inert', val);
74
+ }
67
75
  };
68
76
 
69
77
  export const EnrichedTextClass = compose(