@descope/web-components-ui 1.0.297 → 1.0.299
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.
- package/dist/cjs/index.cjs.js +32 -24
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +33 -25
- 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} +26 -18
- 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,14 +4619,14 @@ 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
|
-
return ['disabled-rules', 'line-break'];
|
|
4629
|
+
return ['disabled-rules', 'line-break', 'readonly'];
|
|
4630
4630
|
}
|
|
4631
4631
|
|
|
4632
4632
|
get lineBreak() {
|
|
@@ -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,32 @@ 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
|
+
|
|
4656
|
+
if (attrName === 'readonly') {
|
|
4657
|
+
this.onReadOnlyChange(newValue !== null);
|
|
4658
|
+
}
|
|
4655
4659
|
}
|
|
4656
4660
|
|
|
4657
|
-
#
|
|
4658
|
-
this.
|
|
4661
|
+
#initProcessor() {
|
|
4662
|
+
this.processor = markdownit({ breaks: this.lineBreak }).disable(this.disabledRules);
|
|
4659
4663
|
}
|
|
4660
4664
|
|
|
4661
4665
|
#parseChildren() {
|
|
4662
4666
|
const node = this.textSlot.assignedNodes({ flatten: true })?.[0];
|
|
4663
4667
|
|
|
4664
4668
|
if (node && node.nodeType === Node.TEXT_NODE) {
|
|
4665
|
-
const tokens = this.
|
|
4666
|
-
const result = this.
|
|
4669
|
+
const tokens = this.processor.parse(node.textContent, { references: undefined });
|
|
4670
|
+
const result = this.processor.renderer.render(enrichTokens(tokens), {
|
|
4667
4671
|
breaks: this.lineBreak,
|
|
4668
4672
|
});
|
|
4669
4673
|
|
|
4670
4674
|
if (result !== node.textContent) {
|
|
4671
4675
|
const span = document.createElement('div');
|
|
4672
|
-
span.classList.add('
|
|
4676
|
+
span.classList.add('enriched-text');
|
|
4673
4677
|
// eslint-disable-next-line no-use-before-define
|
|
4674
4678
|
span.innerHTML = `${getStyleReset()}${result}`;
|
|
4675
4679
|
span.addEventListener('copy', onClipboardCopy);
|
|
@@ -4677,9 +4681,13 @@ const markdownContentMixin = (superclass) =>
|
|
|
4677
4681
|
}
|
|
4678
4682
|
}
|
|
4679
4683
|
}
|
|
4684
|
+
|
|
4685
|
+
onReadOnlyChange(val) {
|
|
4686
|
+
this.setAttribute('inert', val);
|
|
4687
|
+
}
|
|
4680
4688
|
};
|
|
4681
4689
|
|
|
4682
|
-
const
|
|
4690
|
+
const EnrichedTextClass = compose(
|
|
4683
4691
|
createStyleMixin({
|
|
4684
4692
|
mappings: {
|
|
4685
4693
|
hostWidth: { selector: () => ':host', property: 'width' },
|
|
@@ -4695,25 +4703,25 @@ const MarkdownContentClass = compose(
|
|
|
4695
4703
|
}),
|
|
4696
4704
|
draggableMixin,
|
|
4697
4705
|
componentNameValidationMixin,
|
|
4698
|
-
|
|
4706
|
+
EnrichedTextMixin,
|
|
4699
4707
|
hideWhenEmptyMixin
|
|
4700
|
-
)(
|
|
4708
|
+
)(BaseEnrichedTextClass);
|
|
4701
4709
|
|
|
4702
4710
|
function getStyleReset() {
|
|
4703
4711
|
return `
|
|
4704
4712
|
<style>
|
|
4705
|
-
.
|
|
4706
|
-
.
|
|
4707
|
-
margin-bottom: var(${
|
|
4713
|
+
.enriched-text > * { margin:0 }
|
|
4714
|
+
.enriched-text > *:not(:only-child):not(:last-child) {
|
|
4715
|
+
margin-bottom: var(${EnrichedTextClass.cssVarList.textLineHeight})
|
|
4708
4716
|
}
|
|
4709
4717
|
</style>
|
|
4710
4718
|
`;
|
|
4711
4719
|
}
|
|
4712
4720
|
|
|
4713
4721
|
const globalRefs$i = getThemeRefs(globals);
|
|
4714
|
-
const vars$q =
|
|
4722
|
+
const vars$q = EnrichedTextClass.cssVarList;
|
|
4715
4723
|
|
|
4716
|
-
const
|
|
4724
|
+
const EnrichedText = {
|
|
4717
4725
|
[vars$q.hostDirection]: globalRefs$i.direction,
|
|
4718
4726
|
|
|
4719
4727
|
[vars$q.fontSize]: globalRefs$i.typography.body1.size,
|
|
@@ -4788,9 +4796,9 @@ const markdownContent = {
|
|
|
4788
4796
|
},
|
|
4789
4797
|
};
|
|
4790
4798
|
|
|
4791
|
-
var
|
|
4799
|
+
var EnrichedText$1 = /*#__PURE__*/Object.freeze({
|
|
4792
4800
|
__proto__: null,
|
|
4793
|
-
default:
|
|
4801
|
+
default: EnrichedText,
|
|
4794
4802
|
vars: vars$q
|
|
4795
4803
|
});
|
|
4796
4804
|
|
|
@@ -11448,7 +11456,7 @@ const components = {
|
|
|
11448
11456
|
totpImage,
|
|
11449
11457
|
notpImage,
|
|
11450
11458
|
text: text$3,
|
|
11451
|
-
|
|
11459
|
+
EnrichedText: EnrichedText$1,
|
|
11452
11460
|
link: link$1,
|
|
11453
11461
|
divider: divider$1,
|
|
11454
11462
|
passcode: passcode$1,
|
|
@@ -11799,6 +11807,7 @@ exports.CheckboxClass = CheckboxClass;
|
|
|
11799
11807
|
exports.ContainerClass = ContainerClass;
|
|
11800
11808
|
exports.DividerClass = DividerClass;
|
|
11801
11809
|
exports.EmailFieldClass = EmailFieldClass;
|
|
11810
|
+
exports.EnrichedTextClass = EnrichedTextClass;
|
|
11802
11811
|
exports.GridClass = GridClass;
|
|
11803
11812
|
exports.ImageClass = ImageClass;
|
|
11804
11813
|
exports.LinkClass = LinkClass;
|
|
@@ -11806,7 +11815,6 @@ exports.LoaderLinearClass = LoaderLinearClass;
|
|
|
11806
11815
|
exports.LoaderRadialClass = LoaderRadialClass;
|
|
11807
11816
|
exports.LogoClass = LogoClass;
|
|
11808
11817
|
exports.MappingsFieldClass = MappingsFieldClass;
|
|
11809
|
-
exports.MarkdownContentClass = MarkdownContentClass;
|
|
11810
11818
|
exports.ModalClass = ModalClass;
|
|
11811
11819
|
exports.MultiSelectComboBoxClass = MultiSelectComboBoxClass;
|
|
11812
11820
|
exports.NewPasswordClass = NewPasswordClass;
|