@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.
@@ -4619,14 +4619,14 @@ const onClipboardCopy = (e) => {
4619
4619
  e.preventDefault();
4620
4620
  };
4621
4621
 
4622
- const componentName$z = getComponentName('markdown-content');
4622
+ const componentName$z = getComponentName('enriched-text');
4623
4623
 
4624
- const BaseMarkdownContentClass = createBaseTextClass(componentName$z);
4624
+ const BaseEnrichedTextClass = createBaseTextClass(componentName$z);
4625
4625
 
4626
- const markdownContentMixin = (superclass) =>
4627
- class MarkdownContentMixinClass extends superclass {
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.#initMarkdown();
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.#initMarkdown(newValue);
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
- #initMarkdown() {
4658
- this.markdown = markdownit({ breaks: this.lineBreak }).disable(this.disabledRules);
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.markdown.parse(node.textContent, { references: undefined });
4666
- const result = this.markdown.renderer.render(enrichTokens(tokens), {
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('markdown-wrapper');
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 MarkdownContentClass = compose(
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
- markdownContentMixin,
4706
+ EnrichedTextMixin,
4699
4707
  hideWhenEmptyMixin
4700
- )(BaseMarkdownContentClass);
4708
+ )(BaseEnrichedTextClass);
4701
4709
 
4702
4710
  function getStyleReset() {
4703
4711
  return `
4704
4712
  <style>
4705
- .markdown-wrapper > * { margin:0 }
4706
- .markdown-wrapper > *:not(:only-child):not(:last-child) {
4707
- margin-bottom: var(${MarkdownContentClass.cssVarList.textLineHeight})
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 = MarkdownContentClass.cssVarList;
4722
+ const vars$q = EnrichedTextClass.cssVarList;
4715
4723
 
4716
- const markdownContent = {
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 markdownContent$1 = /*#__PURE__*/Object.freeze({
4799
+ var EnrichedText$1 = /*#__PURE__*/Object.freeze({
4792
4800
  __proto__: null,
4793
- default: markdownContent,
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
- markdownContent: markdownContent$1,
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;