@descope/web-components-ui 1.0.359 → 1.0.360
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +42 -101
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +41 -101
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/descope-enriched-text-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-enriched-text/EnrichedTextClass.js +1 -0
- package/src/helpers/themeHelpers/index.js +1 -1
- package/src/theme/components/enrichedText.js +14 -75
- package/src/theme/components/index.js +2 -2
- package/src/theme/components/text.js +1 -0
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[5158],{20409:(e,t,r)=>{r.r(t),r.d(t,{EnrichedTextClass:()=>d});var n=r(84569),o=r(94978),s=r(2061),i=r(54567);const l=["blockquote","list","image","table","code","hr","backticks","fence","reference","heading","lheading","html_block"];var a=r(33346);const c=(0,i.iY)("enriched-text");class h extends((0,a.s)({componentName:c,baseSelector:":host > div"})){#e;#t;constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <style>\n :host {\n display: inline-block;\n line-height: 1em;\n word-break: break-word;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n *, *:last-child {\n margin: 0;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p {\n margin-bottom: 1em;\n }\n a {\n cursor: pointer;\n }\n blockquote {\n padding: 0 2em;\n }\n u {\n text-decoration: underline\n }\n s {\n color: currentColor;\n }\n </style>\n <slot part="text-wrapper" style="display:none"></slot>\n <div class="content"></div>\n ',this.textSlot=this.shadowRoot.querySelector("slot"),this.#r(),(0,i.P$)(this,this.#n.bind(this))}static get observedAttributes(){return["readonly","link-target-blank"]}attributeChangedCallback(e,t,r){super.attributeChangedCallback?.(e,t,r),r!==t&&("readonly"===e&&this.onReadOnlyChange("true"===r),"link-target-blank"===e&&this.#r())}customUnderlineRenderer(){this.processor.renderer.rules.em_open=(e,t,r,n,o)=>("_"===e[t].markup&&(e[t].tag="u"),this.#t(e,t,r,n,o)),this.processor.renderer.rules.em_close=(e,t,r,n,o)=>("_"===e[t].markup&&(e[t].tag="u"),this.#t(e,t,r,n,o))}#o(){this.linkTargetBlank?this.processor.renderer.rules.link_open=(e,t,r,n,o)=>(e[t].attrSet("target","_blank"),this.#e(e,t,r,n,o)):this.processor.renderer.rules.link_open=this.#e}#s(){this.processor&&this.processor.disable(l)}#i(){this.#s()}#l(){this.#e=this.processor.renderer.rules.link_open||((e,t,r,n,o)=>o.renderToken(e,t,r)),this.#t=this.processor.renderer.rules.em_open||((e,t,r,n,o)=>o.renderToken(e,t,r))}#r(){this.processor=new n.Z("commonmark",{html:!0}),this.#l(),this.#i(),this.#o(),this.customUnderlineRenderer()}get linkTargetBlank(){return"true"===this.getAttribute("link-target-blank")}get contentNode(){return this.shadowRoot.querySelector(".content")}#n(){if(!this.processor)return;let e=(e=>{const t=document.createElement("textarea");return t.innerHTML=e,t.value})(this.innerHTML);try{const t=this.processor.parse(e,{references:void 0});e=this.processor.renderer.render(t,{html:!0,breaks:!0})}catch(e){console.warn("Not parsing invalid markdown token")}this.contentNode.innerHTML=e}onReadOnlyChange(e){e?this.contentNode.setAttribute("inert",e):this.contentNode.removeAttribute("inert")}}const d=(0,s.qC)((0,o.yk)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostDirection:{selector:()=>":host",property:"direction"},fontSize:{},fontFamily:{},fontWeight:{},fontWeightBold:[{selector:()=>":host strong",property:"font-weight"},{selector:()=>":host b",property:"font-weight"}],textColor:{property:"color"},textLineHeight:{property:"line-height"},textAlign:{},linkColor:{selector:"a",property:"color"},linkTextDecoration:{selector:"a",property:"text-decoration"},linkHoverTextDecoration:{selector:"a:hover",property:"text-decoration"},minHeight:{},minWidth:{}}}),(0,o.yk)({componentNameOverride:(0,i.iY)("link")}),o.e4,o.Ae)(h);customElements.define(c,d)}}]);
|
1
|
+
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[5158],{20409:(e,t,r)=>{r.r(t),r.d(t,{EnrichedTextClass:()=>d});var n=r(84569),o=r(94978),s=r(2061),i=r(54567);const l=["blockquote","list","image","table","code","hr","backticks","fence","reference","heading","lheading","html_block"];var a=r(33346);const c=(0,i.iY)("enriched-text");class h extends((0,a.s)({componentName:c,baseSelector:":host > div"})){#e;#t;constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n <style>\n :host {\n display: inline-block;\n line-height: 1em;\n word-break: break-word;\n }\n :host > slot {\n width: 100%;\n display: inline-block;\n }\n *, *:last-child {\n margin: 0;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p {\n margin-bottom: 1em;\n }\n a {\n cursor: pointer;\n }\n blockquote {\n padding: 0 2em;\n }\n u {\n text-decoration: underline\n }\n s {\n color: currentColor;\n }\n </style>\n <slot part="text-wrapper" style="display:none"></slot>\n <div class="content"></div>\n ',this.textSlot=this.shadowRoot.querySelector("slot"),this.#r(),(0,i.P$)(this,this.#n.bind(this))}static get observedAttributes(){return["readonly","link-target-blank"]}attributeChangedCallback(e,t,r){super.attributeChangedCallback?.(e,t,r),r!==t&&("readonly"===e&&this.onReadOnlyChange("true"===r),"link-target-blank"===e&&this.#r())}customUnderlineRenderer(){this.processor.renderer.rules.em_open=(e,t,r,n,o)=>("_"===e[t].markup&&(e[t].tag="u"),this.#t(e,t,r,n,o)),this.processor.renderer.rules.em_close=(e,t,r,n,o)=>("_"===e[t].markup&&(e[t].tag="u"),this.#t(e,t,r,n,o))}#o(){this.linkTargetBlank?this.processor.renderer.rules.link_open=(e,t,r,n,o)=>(e[t].attrSet("target","_blank"),this.#e(e,t,r,n,o)):this.processor.renderer.rules.link_open=this.#e}#s(){this.processor&&this.processor.disable(l)}#i(){this.#s()}#l(){this.#e=this.processor.renderer.rules.link_open||((e,t,r,n,o)=>o.renderToken(e,t,r)),this.#t=this.processor.renderer.rules.em_open||((e,t,r,n,o)=>o.renderToken(e,t,r))}#r(){this.processor=new n.Z("commonmark",{html:!0}),this.#l(),this.#i(),this.#o(),this.customUnderlineRenderer()}get linkTargetBlank(){return"true"===this.getAttribute("link-target-blank")}get contentNode(){return this.shadowRoot.querySelector(".content")}#n(){if(!this.processor)return;let e=(e=>{const t=document.createElement("textarea");return t.innerHTML=e,t.value})(this.innerHTML);try{const t=this.processor.parse(e,{references:void 0});e=this.processor.renderer.render(t,{html:!0,breaks:!0})}catch(e){console.warn("Not parsing invalid markdown token")}this.contentNode.innerHTML=e}onReadOnlyChange(e){e?this.contentNode.setAttribute("inert",e):this.contentNode.removeAttribute("inert")}}const d=(0,s.qC)((0,o.yk)({mappings:{hostWidth:{selector:()=>":host",property:"width"},hostDirection:{selector:()=>":host",property:"direction"},fontSize:{},fontFamily:{},fontWeight:{},fontWeightBold:[{selector:()=>":host strong",property:"font-weight"},{selector:()=>":host b",property:"font-weight"}],textColor:{property:"color"},textLineHeight:{property:"line-height"},textAlign:{},linkColor:{selector:"a",property:"color"},linkTextDecoration:{selector:"a",property:"text-decoration"},linkHoverTextDecoration:{selector:"a:hover",property:"text-decoration"},minHeight:{},minWidth:{}}}),(0,o.yk)({componentNameOverride:(0,i.iY)("link")}),(0,o.yk)({componentNameOverride:(0,i.iY)("text")}),o.e4,o.Ae)(h);customElements.define(c,d)}}]);
|
package/package.json
CHANGED
@@ -195,6 +195,7 @@ export const EnrichedTextClass = compose(
|
|
195
195
|
},
|
196
196
|
}),
|
197
197
|
createStyleMixin({ componentNameOverride: getComponentName('link') }),
|
198
|
+
createStyleMixin({ componentNameOverride: getComponentName('text') }),
|
198
199
|
draggableMixin,
|
199
200
|
componentNameValidationMixin
|
200
201
|
)(EnrichedText);
|
@@ -148,7 +148,7 @@ export const themeToStyle = ({ globals, components }, themeName) => ({
|
|
148
148
|
components: createComponentsTheme(components),
|
149
149
|
});
|
150
150
|
|
151
|
-
const useVar = (varName) => `var(${varName})`;
|
151
|
+
export const useVar = (varName) => `var(${varName})`;
|
152
152
|
|
153
153
|
export const createHelperVars = (theme, prefix) => {
|
154
154
|
const res = transformTheme(theme, [], (path, value) => {
|
@@ -1,93 +1,32 @@
|
|
1
1
|
import globals from '../globals';
|
2
|
-
import { getThemeRefs } from '../../helpers/themeHelpers';
|
2
|
+
import { getThemeRefs, useVar } from '../../helpers/themeHelpers';
|
3
3
|
import { EnrichedTextClass } from '../../components/descope-enriched-text/EnrichedTextClass';
|
4
|
-
import {
|
4
|
+
import { vars as textCompVars } from './text';
|
5
|
+
import { vars as linkCompVars } from './link';
|
5
6
|
|
6
7
|
const globalRefs = getThemeRefs(globals);
|
7
8
|
const vars = EnrichedTextClass.cssVarList;
|
8
9
|
|
9
|
-
const
|
10
|
+
const enrichedText = {
|
10
11
|
[vars.hostDirection]: globalRefs.direction,
|
12
|
+
[vars.hostWidth]: useVar(textCompVars.hostWidth),
|
11
13
|
|
12
|
-
[vars.
|
13
|
-
[vars.
|
14
|
-
[vars.
|
15
|
-
[vars.fontFamily]: globalRefs.typography.body1.font,
|
14
|
+
[vars.textLineHeight]: useVar(textCompVars.textLineHeight),
|
15
|
+
[vars.textColor]: useVar(textCompVars.textColor),
|
16
|
+
[vars.textAlign]: useVar(textCompVars.textAlign),
|
16
17
|
|
17
|
-
[vars.
|
18
|
-
[vars.
|
19
|
-
[vars.
|
18
|
+
[vars.fontSize]: useVar(textCompVars.fontSize),
|
19
|
+
[vars.fontWeight]: useVar(textCompVars.fontWeight),
|
20
|
+
[vars.fontFamily]: useVar(textCompVars.fontFamily),
|
20
21
|
|
21
|
-
[vars.linkColor]:
|
22
|
+
[vars.linkColor]: useVar(linkCompVars.textColor),
|
22
23
|
[vars.linkTextDecoration]: 'none',
|
23
24
|
[vars.linkHoverTextDecoration]: 'underline',
|
24
25
|
|
26
|
+
[vars.fontWeightBold]: '900',
|
25
27
|
[vars.minWidth]: '0.25em',
|
26
28
|
[vars.minHeight]: '1.35em',
|
27
|
-
|
28
|
-
mode: {
|
29
|
-
primary: {
|
30
|
-
[vars.textColor]: globalRefs.colors.surface.contrast,
|
31
|
-
},
|
32
|
-
secondary: {
|
33
|
-
[vars.textColor]: globalRefs.colors.surface.dark,
|
34
|
-
},
|
35
|
-
error: {
|
36
|
-
[vars.textColor]: globalRefs.colors.error.main,
|
37
|
-
},
|
38
|
-
success: {
|
39
|
-
[vars.textColor]: globalRefs.colors.success.main,
|
40
|
-
},
|
41
|
-
},
|
42
|
-
|
43
|
-
variant: {
|
44
|
-
h1: {
|
45
|
-
[vars.fontSize]: globalRefs.typography.h1.size,
|
46
|
-
[vars.fontWeight]: globalRefs.typography.h1.weight,
|
47
|
-
[vars.fontFamily]: globalRefs.typography.h1.font,
|
48
|
-
},
|
49
|
-
h2: {
|
50
|
-
[vars.fontSize]: globalRefs.typography.h2.size,
|
51
|
-
[vars.fontWeight]: globalRefs.typography.h2.weight,
|
52
|
-
[vars.fontFamily]: globalRefs.typography.h2.font,
|
53
|
-
},
|
54
|
-
h3: {
|
55
|
-
[vars.fontSize]: globalRefs.typography.h3.size,
|
56
|
-
[vars.fontWeight]: globalRefs.typography.h3.weight,
|
57
|
-
[vars.fontFamily]: globalRefs.typography.h3.font,
|
58
|
-
},
|
59
|
-
subtitle1: {
|
60
|
-
[vars.fontSize]: globalRefs.typography.subtitle1.size,
|
61
|
-
[vars.fontWeight]: globalRefs.typography.subtitle1.weight,
|
62
|
-
[vars.fontFamily]: globalRefs.typography.subtitle1.font,
|
63
|
-
},
|
64
|
-
subtitle2: {
|
65
|
-
[vars.fontSize]: globalRefs.typography.subtitle2.size,
|
66
|
-
[vars.fontWeight]: globalRefs.typography.subtitle2.weight,
|
67
|
-
[vars.fontFamily]: globalRefs.typography.subtitle2.font,
|
68
|
-
},
|
69
|
-
body1: {
|
70
|
-
[vars.fontSize]: globalRefs.typography.body1.size,
|
71
|
-
[vars.fontWeight]: globalRefs.typography.body1.weight,
|
72
|
-
[vars.fontFamily]: globalRefs.typography.body1.font,
|
73
|
-
},
|
74
|
-
body2: {
|
75
|
-
[vars.fontSize]: globalRefs.typography.body2.size,
|
76
|
-
[vars.fontWeight]: globalRefs.typography.body2.weight,
|
77
|
-
[vars.fontFamily]: globalRefs.typography.body2.font,
|
78
|
-
},
|
79
|
-
},
|
80
|
-
|
81
|
-
textAlign: {
|
82
|
-
right: { [vars.textAlign]: 'right' },
|
83
|
-
left: { [vars.textAlign]: 'left' },
|
84
|
-
center: { [vars.textAlign]: 'center' },
|
85
|
-
},
|
86
|
-
|
87
|
-
_fullWidth: {
|
88
|
-
[vars.hostWidth]: '100%',
|
89
|
-
},
|
90
29
|
};
|
91
30
|
|
92
|
-
export default
|
31
|
+
export default enrichedText;
|
93
32
|
export { vars };
|
@@ -11,7 +11,7 @@ import * as logo from './logo';
|
|
11
11
|
import * as totpImage from './totpImage';
|
12
12
|
import * as notpImage from './notpImage';
|
13
13
|
import * as text from './text';
|
14
|
-
import * as
|
14
|
+
import * as enrichedText from './enrichedText';
|
15
15
|
import * as link from './link';
|
16
16
|
import * as divider from './divider';
|
17
17
|
import * as passcode from './passcode';
|
@@ -56,7 +56,7 @@ const components = {
|
|
56
56
|
totpImage,
|
57
57
|
notpImage,
|
58
58
|
text,
|
59
|
-
|
59
|
+
enrichedText,
|
60
60
|
link,
|
61
61
|
divider,
|
62
62
|
passcode,
|