@descope/web-components-ui 1.0.297 → 1.0.298
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +23 -23
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +24 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/text-components-descope-enriched-text-index-js.js +1 -0
- package/package.json +1 -1
- package/src/components/text-components/{descope-markdown-content/MarkdownContentClass.js → descope-enriched-text/EnrichedTextClass.js} +17 -17
- package/src/components/text-components/descope-enriched-text/index.js +5 -0
- package/src/index.cjs.js +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/theme/components/{markdownContent.js → enrichedText.js} +4 -4
- package/src/theme/components/index.js +2 -2
- package/dist/umd/text-components-descope-markdown-content-index-js.js +0 -1
- package/src/components/text-components/descope-markdown-content/index.js +0 -5
- /package/src/components/text-components/{descope-markdown-content → descope-enriched-text}/helpers.js +0 -0
package/dist/cjs/index.cjs.js
CHANGED
@@ -4619,12 +4619,12 @@ const onClipboardCopy = (e) => {
|
|
4619
4619
|
e.preventDefault();
|
4620
4620
|
};
|
4621
4621
|
|
4622
|
-
const componentName$z = getComponentName('
|
4622
|
+
const componentName$z = getComponentName('enriched-text');
|
4623
4623
|
|
4624
|
-
const
|
4624
|
+
const BaseEnrichedTextClass = createBaseTextClass(componentName$z);
|
4625
4625
|
|
4626
|
-
const
|
4627
|
-
class
|
4626
|
+
const EnrichedTextMixin = (superclass) =>
|
4627
|
+
class EnrichedTextMixinClass extends superclass {
|
4628
4628
|
static get observedAttributes() {
|
4629
4629
|
return ['disabled-rules', 'line-break'];
|
4630
4630
|
}
|
@@ -4639,7 +4639,7 @@ const markdownContentMixin = (superclass) =>
|
|
4639
4639
|
|
4640
4640
|
init() {
|
4641
4641
|
super.init();
|
4642
|
-
this.#
|
4642
|
+
this.#initProcessor();
|
4643
4643
|
this.textSlot.addEventListener('slotchange', this.#parseChildren.bind(this));
|
4644
4644
|
}
|
4645
4645
|
|
@@ -4648,28 +4648,28 @@ const markdownContentMixin = (superclass) =>
|
|
4648
4648
|
|
4649
4649
|
if (attrName === 'disabled-rules') {
|
4650
4650
|
if (newValue !== oldValue) {
|
4651
|
-
this.#
|
4651
|
+
this.#initProcessor(newValue);
|
4652
4652
|
this.#parseChildren();
|
4653
4653
|
}
|
4654
4654
|
}
|
4655
4655
|
}
|
4656
4656
|
|
4657
|
-
#
|
4658
|
-
this.
|
4657
|
+
#initProcessor() {
|
4658
|
+
this.processor = markdownit({ breaks: this.lineBreak }).disable(this.disabledRules);
|
4659
4659
|
}
|
4660
4660
|
|
4661
4661
|
#parseChildren() {
|
4662
4662
|
const node = this.textSlot.assignedNodes({ flatten: true })?.[0];
|
4663
4663
|
|
4664
4664
|
if (node && node.nodeType === Node.TEXT_NODE) {
|
4665
|
-
const tokens = this.
|
4666
|
-
const result = this.
|
4665
|
+
const tokens = this.processor.parse(node.textContent, { references: undefined });
|
4666
|
+
const result = this.processor.renderer.render(enrichTokens(tokens), {
|
4667
4667
|
breaks: this.lineBreak,
|
4668
4668
|
});
|
4669
4669
|
|
4670
4670
|
if (result !== node.textContent) {
|
4671
4671
|
const span = document.createElement('div');
|
4672
|
-
span.classList.add('
|
4672
|
+
span.classList.add('enriched-text');
|
4673
4673
|
// eslint-disable-next-line no-use-before-define
|
4674
4674
|
span.innerHTML = `${getStyleReset()}${result}`;
|
4675
4675
|
span.addEventListener('copy', onClipboardCopy);
|
@@ -4679,7 +4679,7 @@ const markdownContentMixin = (superclass) =>
|
|
4679
4679
|
}
|
4680
4680
|
};
|
4681
4681
|
|
4682
|
-
const
|
4682
|
+
const EnrichedTextClass = compose(
|
4683
4683
|
createStyleMixin({
|
4684
4684
|
mappings: {
|
4685
4685
|
hostWidth: { selector: () => ':host', property: 'width' },
|
@@ -4695,25 +4695,25 @@ const MarkdownContentClass = compose(
|
|
4695
4695
|
}),
|
4696
4696
|
draggableMixin,
|
4697
4697
|
componentNameValidationMixin,
|
4698
|
-
|
4698
|
+
EnrichedTextMixin,
|
4699
4699
|
hideWhenEmptyMixin
|
4700
|
-
)(
|
4700
|
+
)(BaseEnrichedTextClass);
|
4701
4701
|
|
4702
4702
|
function getStyleReset() {
|
4703
4703
|
return `
|
4704
4704
|
<style>
|
4705
|
-
.
|
4706
|
-
.
|
4707
|
-
margin-bottom: var(${
|
4705
|
+
.enriched-text > * { margin:0 }
|
4706
|
+
.enriched-text > *:not(:only-child):not(:last-child) {
|
4707
|
+
margin-bottom: var(${EnrichedTextClass.cssVarList.textLineHeight})
|
4708
4708
|
}
|
4709
4709
|
</style>
|
4710
4710
|
`;
|
4711
4711
|
}
|
4712
4712
|
|
4713
4713
|
const globalRefs$i = getThemeRefs(globals);
|
4714
|
-
const vars$q =
|
4714
|
+
const vars$q = EnrichedTextClass.cssVarList;
|
4715
4715
|
|
4716
|
-
const
|
4716
|
+
const EnrichedText = {
|
4717
4717
|
[vars$q.hostDirection]: globalRefs$i.direction,
|
4718
4718
|
|
4719
4719
|
[vars$q.fontSize]: globalRefs$i.typography.body1.size,
|
@@ -4788,9 +4788,9 @@ const markdownContent = {
|
|
4788
4788
|
},
|
4789
4789
|
};
|
4790
4790
|
|
4791
|
-
var
|
4791
|
+
var EnrichedText$1 = /*#__PURE__*/Object.freeze({
|
4792
4792
|
__proto__: null,
|
4793
|
-
default:
|
4793
|
+
default: EnrichedText,
|
4794
4794
|
vars: vars$q
|
4795
4795
|
});
|
4796
4796
|
|
@@ -11448,7 +11448,7 @@ const components = {
|
|
11448
11448
|
totpImage,
|
11449
11449
|
notpImage,
|
11450
11450
|
text: text$3,
|
11451
|
-
|
11451
|
+
EnrichedText: EnrichedText$1,
|
11452
11452
|
link: link$1,
|
11453
11453
|
divider: divider$1,
|
11454
11454
|
passcode: passcode$1,
|
@@ -11799,6 +11799,7 @@ exports.CheckboxClass = CheckboxClass;
|
|
11799
11799
|
exports.ContainerClass = ContainerClass;
|
11800
11800
|
exports.DividerClass = DividerClass;
|
11801
11801
|
exports.EmailFieldClass = EmailFieldClass;
|
11802
|
+
exports.EnrichedTextClass = EnrichedTextClass;
|
11802
11803
|
exports.GridClass = GridClass;
|
11803
11804
|
exports.ImageClass = ImageClass;
|
11804
11805
|
exports.LinkClass = LinkClass;
|
@@ -11806,7 +11807,6 @@ exports.LoaderLinearClass = LoaderLinearClass;
|
|
11806
11807
|
exports.LoaderRadialClass = LoaderRadialClass;
|
11807
11808
|
exports.LogoClass = LogoClass;
|
11808
11809
|
exports.MappingsFieldClass = MappingsFieldClass;
|
11809
|
-
exports.MarkdownContentClass = MarkdownContentClass;
|
11810
11810
|
exports.ModalClass = ModalClass;
|
11811
11811
|
exports.MultiSelectComboBoxClass = MultiSelectComboBoxClass;
|
11812
11812
|
exports.NewPasswordClass = NewPasswordClass;
|