@descope/web-components-ui 1.0.341 → 1.0.343
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +53 -19
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +53 -19
- 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 +2 -3
- package/src/components/descope-enriched-text/EnrichedTextClass.js +36 -7
- package/src/components/descope-enriched-text/consts.js +14 -13
- package/src/theme/components/enrichedText.js +4 -0
package/dist/cjs/index.cjs.js
CHANGED
@@ -4967,25 +4967,30 @@ var text$3 = /*#__PURE__*/Object.freeze({
|
|
4967
4967
|
vars: vars$v
|
4968
4968
|
});
|
4969
4969
|
|
4970
|
-
const
|
4971
|
-
|
4972
|
-
|
4973
|
-
|
4974
|
-
|
4975
|
-
|
4976
|
-
|
4977
|
-
|
4978
|
-
|
4979
|
-
|
4980
|
-
|
4981
|
-
|
4982
|
-
|
4970
|
+
const disableRules = [
|
4971
|
+
'blockquote',
|
4972
|
+
'list',
|
4973
|
+
'image',
|
4974
|
+
'table',
|
4975
|
+
'code',
|
4976
|
+
'hr',
|
4977
|
+
'backticks',
|
4978
|
+
'fence',
|
4979
|
+
'reference',
|
4980
|
+
'heading',
|
4981
|
+
'lheading',
|
4982
|
+
'html_block',
|
4983
|
+
];
|
4984
|
+
|
4985
|
+
/* eslint-disable no-param-reassign */
|
4983
4986
|
|
4984
4987
|
const componentName$C = getComponentName('enriched-text');
|
4985
4988
|
|
4986
4989
|
let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName: componentName$C, baseSelector: ':host > div' }) {
|
4987
4990
|
#origLinkRenderer;
|
4988
4991
|
|
4992
|
+
#origEmRenderer;
|
4993
|
+
|
4989
4994
|
constructor() {
|
4990
4995
|
super();
|
4991
4996
|
|
@@ -4994,6 +4999,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
4994
4999
|
:host {
|
4995
5000
|
display: inline-block;
|
4996
5001
|
line-height: 1em;
|
5002
|
+
word-break: break-all;
|
4997
5003
|
}
|
4998
5004
|
:host > slot {
|
4999
5005
|
width: 100%;
|
@@ -5021,6 +5027,12 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
5021
5027
|
blockquote {
|
5022
5028
|
padding: 0 2em;
|
5023
5029
|
}
|
5030
|
+
u {
|
5031
|
+
text-decoration: underline
|
5032
|
+
}
|
5033
|
+
s {
|
5034
|
+
color: currentColor;
|
5035
|
+
}
|
5024
5036
|
</style>
|
5025
5037
|
<slot part="text-wrapper" style="display:none"></slot>
|
5026
5038
|
<div class="content"></div>
|
@@ -5051,6 +5063,18 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
5051
5063
|
}
|
5052
5064
|
}
|
5053
5065
|
|
5066
|
+
// We're overriding the rule for em with single underscore to perform as underline. (_underline_)
|
5067
|
+
customUnderlineRenderer() {
|
5068
|
+
this.processor.renderer.rules.em_open = (tokens, idx, options, env, self) => {
|
5069
|
+
if (tokens[idx].markup === '_') tokens[idx].tag = 'u';
|
5070
|
+
return this.#origEmRenderer(tokens, idx, options, env, self);
|
5071
|
+
};
|
5072
|
+
this.processor.renderer.rules.em_close = (tokens, idx, options, env, self) => {
|
5073
|
+
if (tokens[idx].markup === '_') tokens[idx].tag = 'u';
|
5074
|
+
return this.#origEmRenderer(tokens, idx, options, env, self);
|
5075
|
+
};
|
5076
|
+
}
|
5077
|
+
|
5054
5078
|
#customizeLinkRenderer() {
|
5055
5079
|
if (this.linkTargetBlank) {
|
5056
5080
|
this.processor.renderer.rules.link_open = (tokens, idx, options, env, self) => {
|
@@ -5064,23 +5088,25 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
5064
5088
|
}
|
5065
5089
|
}
|
5066
5090
|
|
5067
|
-
#
|
5091
|
+
#disableCustomRules() {
|
5068
5092
|
if (!this.processor) {
|
5069
5093
|
return;
|
5070
5094
|
}
|
5071
|
-
|
5072
|
-
const customRuleSet = textRuleSet;
|
5073
|
-
this.processor.configure(customRuleSet || {});
|
5095
|
+
this.processor.disable(disableRules);
|
5074
5096
|
}
|
5075
5097
|
|
5076
5098
|
#updateProcessorRules() {
|
5077
|
-
this.#
|
5099
|
+
this.#disableCustomRules();
|
5078
5100
|
}
|
5079
5101
|
|
5080
5102
|
#storeOrigRenderers() {
|
5081
5103
|
const defaultLinkRenderer = (tokens, idx, options, _, self) =>
|
5082
5104
|
self.renderToken(tokens, idx, options);
|
5083
5105
|
this.#origLinkRenderer = this.processor.renderer.rules.link_open || defaultLinkRenderer;
|
5106
|
+
|
5107
|
+
const defaultStrongRenderer = (tokens, idx, options, _, self) =>
|
5108
|
+
self.renderToken(tokens, idx, options);
|
5109
|
+
this.#origEmRenderer = this.processor.renderer.rules.em_open || defaultStrongRenderer;
|
5084
5110
|
}
|
5085
5111
|
|
5086
5112
|
#initProcessor() {
|
@@ -5088,6 +5114,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
5088
5114
|
this.#storeOrigRenderers();
|
5089
5115
|
this.#updateProcessorRules();
|
5090
5116
|
this.#customizeLinkRenderer();
|
5117
|
+
this.customUnderlineRenderer();
|
5091
5118
|
}
|
5092
5119
|
|
5093
5120
|
get linkTargetBlank() {
|
@@ -5106,7 +5133,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
5106
5133
|
let html = this.textContent;
|
5107
5134
|
|
5108
5135
|
try {
|
5109
|
-
const tokens = this.processor.parse(
|
5136
|
+
const tokens = this.processor.parse(html, { references: undefined });
|
5110
5137
|
html = this.processor.renderer.render(tokens, { breaks: true });
|
5111
5138
|
} catch (e) {
|
5112
5139
|
// eslint-disable-next-line no-console
|
@@ -5133,10 +5160,13 @@ const EnrichedTextClass = compose(
|
|
5133
5160
|
fontSize: {},
|
5134
5161
|
fontFamily: {},
|
5135
5162
|
fontWeight: {},
|
5163
|
+
fontWeightBold: { selector: () => ':host strong', property: 'font-weight' },
|
5136
5164
|
textColor: { property: 'color' },
|
5137
5165
|
textLineHeight: { property: 'line-height' },
|
5138
5166
|
textAlign: {},
|
5139
5167
|
linkColor: { selector: 'a', property: 'color' },
|
5168
|
+
minHeight: {},
|
5169
|
+
minWidth: {},
|
5140
5170
|
},
|
5141
5171
|
}),
|
5142
5172
|
createStyleMixin({ componentNameOverride: getComponentName('link') }),
|
@@ -5220,6 +5250,7 @@ const EnrichedText = {
|
|
5220
5250
|
|
5221
5251
|
[vars$u.fontSize]: globalRefs$l.typography.body1.size,
|
5222
5252
|
[vars$u.fontWeight]: globalRefs$l.typography.body1.weight,
|
5253
|
+
[vars$u.fontWeightBold]: '900',
|
5223
5254
|
[vars$u.fontFamily]: globalRefs$l.typography.body1.font,
|
5224
5255
|
|
5225
5256
|
[vars$u.textLineHeight]: '1.35em',
|
@@ -5228,6 +5259,9 @@ const EnrichedText = {
|
|
5228
5259
|
|
5229
5260
|
[vars$u.linkColor]: `var(${LinkClass.cssVarList.textColor})`,
|
5230
5261
|
|
5262
|
+
[vars$u.minWidth]: '0.25em',
|
5263
|
+
[vars$u.minHeight]: '1.35em',
|
5264
|
+
|
5231
5265
|
mode: {
|
5232
5266
|
primary: {
|
5233
5267
|
[vars$u.textColor]: globalRefs$l.colors.surface.contrast,
|