@descope/web-components-ui 1.0.341 → 1.0.342

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -3644,25 +3644,30 @@ const PasswordClass = compose(
3644
3644
 
3645
3645
  customElements.define(componentName$D, PasswordClass);
3646
3646
 
3647
- const textRuleSet = {
3648
- components: {
3649
- core: {
3650
- rules: ['block', 'inline'],
3651
- },
3652
- block: {
3653
- rules: ['blockquote', 'code', 'heading', 'list', 'paragraph', 'list'],
3654
- },
3655
- inline: {
3656
- rules: ['backticks', 'strikethrough', 'link', 'emphasis', 'strikethrough', 'newline', 'text'],
3657
- },
3658
- },
3659
- };
3647
+ const disableRules = [
3648
+ 'blockquote',
3649
+ 'list',
3650
+ 'image',
3651
+ 'table',
3652
+ 'code',
3653
+ 'hr',
3654
+ 'backticks',
3655
+ 'fence',
3656
+ 'reference',
3657
+ 'heading',
3658
+ 'lheading',
3659
+ 'html_block',
3660
+ ];
3661
+
3662
+ /* eslint-disable no-param-reassign */
3660
3663
 
3661
3664
  const componentName$C = getComponentName('enriched-text');
3662
3665
 
3663
3666
  let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName: componentName$C, baseSelector: ':host > div' }) {
3664
3667
  #origLinkRenderer;
3665
3668
 
3669
+ #origEmRenderer;
3670
+
3666
3671
  constructor() {
3667
3672
  super();
3668
3673
 
@@ -3671,6 +3676,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
3671
3676
  :host {
3672
3677
  display: inline-block;
3673
3678
  line-height: 1em;
3679
+ word-break: break-all;
3674
3680
  }
3675
3681
  :host > slot {
3676
3682
  width: 100%;
@@ -3698,6 +3704,12 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
3698
3704
  blockquote {
3699
3705
  padding: 0 2em;
3700
3706
  }
3707
+ u {
3708
+ text-decoration: underline
3709
+ }
3710
+ s {
3711
+ color: currentColor;
3712
+ }
3701
3713
  </style>
3702
3714
  <slot part="text-wrapper" style="display:none"></slot>
3703
3715
  <div class="content"></div>
@@ -3728,6 +3740,18 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
3728
3740
  }
3729
3741
  }
3730
3742
 
3743
+ // We're overriding the rule for em with single underscore to perform as underline. (_underline_)
3744
+ customUnderlineRenderer() {
3745
+ this.processor.renderer.rules.em_open = (tokens, idx, options, env, self) => {
3746
+ if (tokens[idx].markup === '_') tokens[idx].tag = 'u';
3747
+ return this.#origEmRenderer(tokens, idx, options, env, self);
3748
+ };
3749
+ this.processor.renderer.rules.em_close = (tokens, idx, options, env, self) => {
3750
+ if (tokens[idx].markup === '_') tokens[idx].tag = 'u';
3751
+ return this.#origEmRenderer(tokens, idx, options, env, self);
3752
+ };
3753
+ }
3754
+
3731
3755
  #customizeLinkRenderer() {
3732
3756
  if (this.linkTargetBlank) {
3733
3757
  this.processor.renderer.rules.link_open = (tokens, idx, options, env, self) => {
@@ -3741,23 +3765,25 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
3741
3765
  }
3742
3766
  }
3743
3767
 
3744
- #enableCustomRules() {
3768
+ #disableCustomRules() {
3745
3769
  if (!this.processor) {
3746
3770
  return;
3747
3771
  }
3748
-
3749
- const customRuleSet = textRuleSet;
3750
- this.processor.configure(customRuleSet || {});
3772
+ this.processor.disable(disableRules);
3751
3773
  }
3752
3774
 
3753
3775
  #updateProcessorRules() {
3754
- this.#enableCustomRules();
3776
+ this.#disableCustomRules();
3755
3777
  }
3756
3778
 
3757
3779
  #storeOrigRenderers() {
3758
3780
  const defaultLinkRenderer = (tokens, idx, options, _, self) =>
3759
3781
  self.renderToken(tokens, idx, options);
3760
3782
  this.#origLinkRenderer = this.processor.renderer.rules.link_open || defaultLinkRenderer;
3783
+
3784
+ const defaultStrongRenderer = (tokens, idx, options, _, self) =>
3785
+ self.renderToken(tokens, idx, options);
3786
+ this.#origEmRenderer = this.processor.renderer.rules.em_open || defaultStrongRenderer;
3761
3787
  }
3762
3788
 
3763
3789
  #initProcessor() {
@@ -3765,6 +3791,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
3765
3791
  this.#storeOrigRenderers();
3766
3792
  this.#updateProcessorRules();
3767
3793
  this.#customizeLinkRenderer();
3794
+ this.customUnderlineRenderer();
3768
3795
  }
3769
3796
 
3770
3797
  get linkTargetBlank() {
@@ -3783,7 +3810,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
3783
3810
  let html = this.textContent;
3784
3811
 
3785
3812
  try {
3786
- const tokens = this.processor.parse(this.textContent, { references: undefined });
3813
+ const tokens = this.processor.parse(html, { references: undefined });
3787
3814
  html = this.processor.renderer.render(tokens, { breaks: true });
3788
3815
  } catch (e) {
3789
3816
  // eslint-disable-next-line no-console
@@ -3810,10 +3837,12 @@ const EnrichedTextClass = compose(
3810
3837
  fontSize: {},
3811
3838
  fontFamily: {},
3812
3839
  fontWeight: {},
3840
+ fontWeightBold: { selector: () => ':host strong', property: 'font-weight' },
3813
3841
  textColor: { property: 'color' },
3814
3842
  textLineHeight: { property: 'line-height' },
3815
3843
  textAlign: {},
3816
3844
  linkColor: { selector: 'a', property: 'color' },
3845
+ minHeight: {},
3817
3846
  },
3818
3847
  }),
3819
3848
  createStyleMixin({ componentNameOverride: getComponentName('link') }),
@@ -12713,6 +12742,7 @@ const EnrichedText = {
12713
12742
 
12714
12743
  [vars$u.fontSize]: globalRefs$l.typography.body1.size,
12715
12744
  [vars$u.fontWeight]: globalRefs$l.typography.body1.weight,
12745
+ [vars$u.fontWeightBold]: '900',
12716
12746
  [vars$u.fontFamily]: globalRefs$l.typography.body1.font,
12717
12747
 
12718
12748
  [vars$u.textLineHeight]: '1.35em',
@@ -12721,6 +12751,9 @@ const EnrichedText = {
12721
12751
 
12722
12752
  [vars$u.linkColor]: `var(${LinkClass.cssVarList.textColor})`,
12723
12753
 
12754
+ [vars$u.minWidth]: '0.25em',
12755
+ [vars$u.minHeight]: '1.35em',
12756
+
12724
12757
  mode: {
12725
12758
  primary: {
12726
12759
  [vars$u.textColor]: globalRefs$l.colors.surface.contrast,