@descope/web-components-ui 1.0.340 → 1.0.342

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.
@@ -3541,18 +3541,26 @@ const componentName$O = getComponentName('password');
3541
3541
 
3542
3542
  const customMixin$9 = (superclass) =>
3543
3543
  class PasswordFieldMixinClass extends superclass {
3544
- hidePasswordVisibility(input) {
3545
- // handle input element's type
3546
- input.setAttribute('type', 'password');
3547
- // handle vaadin's `password-visible` attribute
3548
- this.setAttribute('password-visible', 'false');
3544
+ init() {
3545
+ super.init?.();
3546
+
3547
+ this.handleCaretOnVisibilityChange();
3549
3548
  }
3550
3549
 
3551
- showPasswordVisibility(input) {
3552
- // handle input element's type
3553
- input.setAttribute('type', 'text');
3554
- // handle vaadin's `password-visible` attribute
3555
- this.setAttribute('password-visible', 'true');
3550
+ get caretPosition() {
3551
+ return this.value?.length || 0;
3552
+ }
3553
+
3554
+ handleCaretOnVisibilityChange() {
3555
+ const origTogglePasswordVisibility = this.baseElement._togglePasswordVisibility.bind(
3556
+ this.baseElement
3557
+ );
3558
+ this.baseElement._togglePasswordVisibility = () => {
3559
+ setTimeout(() => {
3560
+ origTogglePasswordVisibility();
3561
+ this.inputElement.setSelectionRange(this.caretPosition, this.caretPosition);
3562
+ });
3563
+ };
3556
3564
  }
3557
3565
 
3558
3566
  getAutocompleteType() {
@@ -4959,25 +4967,30 @@ var text$3 = /*#__PURE__*/Object.freeze({
4959
4967
  vars: vars$v
4960
4968
  });
4961
4969
 
4962
- const textRuleSet = {
4963
- components: {
4964
- core: {
4965
- rules: ['block', 'inline'],
4966
- },
4967
- block: {
4968
- rules: ['blockquote', 'code', 'heading', 'list', 'paragraph', 'list'],
4969
- },
4970
- inline: {
4971
- rules: ['backticks', 'strikethrough', 'link', 'emphasis', 'strikethrough', 'newline', 'text'],
4972
- },
4973
- },
4974
- };
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 */
4975
4986
 
4976
4987
  const componentName$C = getComponentName('enriched-text');
4977
4988
 
4978
4989
  let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName: componentName$C, baseSelector: ':host > div' }) {
4979
4990
  #origLinkRenderer;
4980
4991
 
4992
+ #origEmRenderer;
4993
+
4981
4994
  constructor() {
4982
4995
  super();
4983
4996
 
@@ -4986,6 +4999,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
4986
4999
  :host {
4987
5000
  display: inline-block;
4988
5001
  line-height: 1em;
5002
+ word-break: break-all;
4989
5003
  }
4990
5004
  :host > slot {
4991
5005
  width: 100%;
@@ -5013,6 +5027,12 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
5013
5027
  blockquote {
5014
5028
  padding: 0 2em;
5015
5029
  }
5030
+ u {
5031
+ text-decoration: underline
5032
+ }
5033
+ s {
5034
+ color: currentColor;
5035
+ }
5016
5036
  </style>
5017
5037
  <slot part="text-wrapper" style="display:none"></slot>
5018
5038
  <div class="content"></div>
@@ -5043,6 +5063,18 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
5043
5063
  }
5044
5064
  }
5045
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
+
5046
5078
  #customizeLinkRenderer() {
5047
5079
  if (this.linkTargetBlank) {
5048
5080
  this.processor.renderer.rules.link_open = (tokens, idx, options, env, self) => {
@@ -5056,23 +5088,25 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
5056
5088
  }
5057
5089
  }
5058
5090
 
5059
- #enableCustomRules() {
5091
+ #disableCustomRules() {
5060
5092
  if (!this.processor) {
5061
5093
  return;
5062
5094
  }
5063
-
5064
- const customRuleSet = textRuleSet;
5065
- this.processor.configure(customRuleSet || {});
5095
+ this.processor.disable(disableRules);
5066
5096
  }
5067
5097
 
5068
5098
  #updateProcessorRules() {
5069
- this.#enableCustomRules();
5099
+ this.#disableCustomRules();
5070
5100
  }
5071
5101
 
5072
5102
  #storeOrigRenderers() {
5073
5103
  const defaultLinkRenderer = (tokens, idx, options, _, self) =>
5074
5104
  self.renderToken(tokens, idx, options);
5075
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;
5076
5110
  }
5077
5111
 
5078
5112
  #initProcessor() {
@@ -5080,6 +5114,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
5080
5114
  this.#storeOrigRenderers();
5081
5115
  this.#updateProcessorRules();
5082
5116
  this.#customizeLinkRenderer();
5117
+ this.customUnderlineRenderer();
5083
5118
  }
5084
5119
 
5085
5120
  get linkTargetBlank() {
@@ -5098,7 +5133,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
5098
5133
  let html = this.textContent;
5099
5134
 
5100
5135
  try {
5101
- const tokens = this.processor.parse(this.textContent, { references: undefined });
5136
+ const tokens = this.processor.parse(html, { references: undefined });
5102
5137
  html = this.processor.renderer.render(tokens, { breaks: true });
5103
5138
  } catch (e) {
5104
5139
  // eslint-disable-next-line no-console
@@ -5125,10 +5160,12 @@ const EnrichedTextClass = compose(
5125
5160
  fontSize: {},
5126
5161
  fontFamily: {},
5127
5162
  fontWeight: {},
5163
+ fontWeightBold: { selector: () => ':host strong', property: 'font-weight' },
5128
5164
  textColor: { property: 'color' },
5129
5165
  textLineHeight: { property: 'line-height' },
5130
5166
  textAlign: {},
5131
5167
  linkColor: { selector: 'a', property: 'color' },
5168
+ minHeight: {},
5132
5169
  },
5133
5170
  }),
5134
5171
  createStyleMixin({ componentNameOverride: getComponentName('link') }),
@@ -5212,6 +5249,7 @@ const EnrichedText = {
5212
5249
 
5213
5250
  [vars$u.fontSize]: globalRefs$l.typography.body1.size,
5214
5251
  [vars$u.fontWeight]: globalRefs$l.typography.body1.weight,
5252
+ [vars$u.fontWeightBold]: '900',
5215
5253
  [vars$u.fontFamily]: globalRefs$l.typography.body1.font,
5216
5254
 
5217
5255
  [vars$u.textLineHeight]: '1.35em',
@@ -5220,6 +5258,9 @@ const EnrichedText = {
5220
5258
 
5221
5259
  [vars$u.linkColor]: `var(${LinkClass.cssVarList.textColor})`,
5222
5260
 
5261
+ [vars$u.minWidth]: '0.25em',
5262
+ [vars$u.minHeight]: '1.35em',
5263
+
5223
5264
  mode: {
5224
5265
  primary: {
5225
5266
  [vars$u.textColor]: globalRefs$l.colors.surface.contrast,