@descope/flow-components 2.1.17 → 2.2.0

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/index.cjs.js CHANGED
@@ -80964,16 +80964,25 @@ function requireIndex_cjs () {
80964
80964
  };
80965
80965
  getThemeVars$1(globals);
80966
80966
 
80967
- const createCssVar$1 = (varName, fallback) => `var(${varName}${fallback ? `, ${fallback}` : ''})`;
80967
+ const getOverrideCssVarName$1 = (origVarName) => `${origVarName}__override`;
80968
+
80969
+ const createCssVar$1 = (varName, fallback, createOverride = false) => {
80970
+ const ret = `var(${varName}${fallback ? `, ${fallback}` : ''})`;
80971
+
80972
+ if (!createOverride) return ret;
80973
+
80974
+ // we are generating an override css var to allow override with fallback to the default var
80975
+ const overrideVarName = getOverrideCssVarName$1(varName);
80976
+ return `var(${overrideVarName}, ${ret})`;
80977
+ };
80968
80978
 
80969
80979
  const createCssSelector$1 = (baseSelector = '', relativeSelectorOrSelectorFn = '') =>
80970
80980
  isFunction(relativeSelectorOrSelectorFn)
80971
80981
  ? relativeSelectorOrSelectorFn(baseSelector)
80972
- : `${baseSelector}${
80973
- /^[A-Za-z]/.test(relativeSelectorOrSelectorFn)
80974
- ? ` ${relativeSelectorOrSelectorFn}`
80975
- : relativeSelectorOrSelectorFn
80976
- }`;
80982
+ : `${baseSelector}${/^[A-Za-z]/.test(relativeSelectorOrSelectorFn)
80983
+ ? ` ${relativeSelectorOrSelectorFn}`
80984
+ : relativeSelectorOrSelectorFn
80985
+ }`;
80977
80986
 
80978
80987
  let StyleBuilder$1 = class StyleBuilder {
80979
80988
  constructor() {
@@ -81013,6 +81022,7 @@ function requireIndex_cjs () {
81013
81022
 
81014
81023
  const createStyle$1 = (componentName, baseSelector, mappings) => {
81015
81024
  const style = new StyleBuilder$1();
81025
+ // we generate all the fallback vars recursively
81016
81026
  const createFallbackVar = (fallback, origVarName) => {
81017
81027
  if (!fallback) return '';
81018
81028
  if (typeof fallback === 'string') return fallback;
@@ -81032,7 +81042,7 @@ function requireIndex_cjs () {
81032
81042
  style.add(
81033
81043
  createCssSelector$1(baseSelector, relativeSelectorOrSelectorFn),
81034
81044
  isFunction(property) ? property() : property,
81035
- createCssVar$1(cssVarName, fallbackValue) + (important ? '!important' : '')
81045
+ createCssVar$1(cssVarName, fallbackValue, true) + (important ? '!important' : '')
81036
81046
  );
81037
81047
  }
81038
81048
  );
@@ -81059,6 +81069,8 @@ function requireIndex_cjs () {
81059
81069
  return Object.assign(
81060
81070
  acc,
81061
81071
  { [attr]: varName },
81072
+ // we are exposing the override css var names, the convention is to add 'Override' suffix to the attribute name
81073
+ { [attr + 'Override']: getOverrideCssVarName$1(varName) },
81062
81074
  getFallbackVarsNames$1(attr, varName, mappings[attr])
81063
81075
  );
81064
81076
  }, {});
@@ -82969,7 +82981,17 @@ function requireIndex_cjs () {
82969
82981
  vars: vars$12
82970
82982
  });
82971
82983
 
82972
- const createCssVar = (varName, fallback) => `var(${varName}${fallback ? `, ${fallback}` : ''})`;
82984
+ const getOverrideCssVarName = (origVarName) => `${origVarName}__override`;
82985
+
82986
+ const createCssVar = (varName, fallback, createOverride = false) => {
82987
+ const ret = `var(${varName}${fallback ? `, ${fallback}` : ''})`;
82988
+
82989
+ if (!createOverride) return ret;
82990
+
82991
+ // we are generating an override css var to allow override with fallback to the default var
82992
+ const overrideVarName = getOverrideCssVarName(varName);
82993
+ return `var(${overrideVarName}, ${ret})`;
82994
+ };
82973
82995
 
82974
82996
  const createCssSelector = (baseSelector = '', relativeSelectorOrSelectorFn = '') =>
82975
82997
  isFunction$1(relativeSelectorOrSelectorFn)
@@ -83018,6 +83040,7 @@ function requireIndex_cjs () {
83018
83040
 
83019
83041
  const createStyle = (componentName, baseSelector, mappings) => {
83020
83042
  const style = new StyleBuilder();
83043
+ // we generate all the fallback vars recursively
83021
83044
  const createFallbackVar = (fallback, origVarName) => {
83022
83045
  if (!fallback) return '';
83023
83046
  if (typeof fallback === 'string') return fallback;
@@ -83037,7 +83060,7 @@ function requireIndex_cjs () {
83037
83060
  style.add(
83038
83061
  createCssSelector(baseSelector, relativeSelectorOrSelectorFn),
83039
83062
  isFunction$1(property) ? property() : property,
83040
- createCssVar(cssVarName, fallbackValue) + (important ? '!important' : '')
83063
+ createCssVar(cssVarName, fallbackValue, true) + (important ? '!important' : '')
83041
83064
  );
83042
83065
  }
83043
83066
  );
@@ -83064,6 +83087,8 @@ function requireIndex_cjs () {
83064
83087
  return Object.assign(
83065
83088
  acc,
83066
83089
  { [attr]: varName },
83090
+ // we are exposing the override css var names, the convention is to add 'Override' suffix to the attribute name
83091
+ { [attr + 'Override']: getOverrideCssVarName(varName) },
83067
83092
  getFallbackVarsNames(attr, varName, mappings[attr])
83068
83093
  );
83069
83094
  }, {});
@@ -85635,6 +85660,230 @@ function requireIndex_cjs () {
85635
85660
  vars: vars$Y
85636
85661
  });
85637
85662
 
85663
+ const disableRules = [
85664
+ 'blockquote',
85665
+ 'list',
85666
+ 'image',
85667
+ 'table',
85668
+ 'code',
85669
+ 'hr',
85670
+ 'backticks',
85671
+ 'fence',
85672
+ 'reference',
85673
+ 'heading',
85674
+ 'lheading',
85675
+ 'html_block',
85676
+ ];
85677
+
85678
+ const decodeHTML = (html) => {
85679
+ const textArea = document.createElement('textarea');
85680
+ textArea.innerHTML = html;
85681
+ return textArea.value;
85682
+ };
85683
+
85684
+ /* eslint-disable no-param-reassign */
85685
+
85686
+
85687
+ const componentName$16 = getComponentName('enriched-text');
85688
+
85689
+ class EnrichedText extends createBaseClass$1({ componentName: componentName$16, baseSelector: ':host > div' }) {
85690
+ #origLinkRenderer;
85691
+
85692
+ #origEmRenderer;
85693
+
85694
+ constructor() {
85695
+ super();
85696
+
85697
+ this.attachShadow({ mode: 'open' }).innerHTML = `
85698
+ <div class="content"></div>
85699
+ `;
85700
+
85701
+ injectStyle(
85702
+ `
85703
+ :host {
85704
+ line-height: 1em;
85705
+ word-break: break-word;
85706
+ }
85707
+ :host > slot {
85708
+ width: 100%;
85709
+ display: inline-block;
85710
+ }
85711
+ *, *:last-child {
85712
+ margin: 0;
85713
+ }
85714
+ h1,
85715
+ h2,
85716
+ h3,
85717
+ h4,
85718
+ h5,
85719
+ h6,
85720
+ p {
85721
+ margin-bottom: 1em;
85722
+ }
85723
+ a {
85724
+ cursor: pointer;
85725
+ }
85726
+ blockquote {
85727
+ padding: 0 2em;
85728
+ }
85729
+ u {
85730
+ text-decoration: underline
85731
+ }
85732
+ s {
85733
+ color: currentColor;
85734
+ }
85735
+ `,
85736
+ this
85737
+ );
85738
+
85739
+ this.#initProcessor();
85740
+
85741
+ observeChildren(this, this.#parseChildren.bind(this));
85742
+ }
85743
+
85744
+ static get observedAttributes() {
85745
+ return ['readonly', 'link-target-blank'];
85746
+ }
85747
+
85748
+ attributeChangedCallback(attrName, oldValue, newValue) {
85749
+ super.attributeChangedCallback?.(attrName, oldValue, newValue);
85750
+
85751
+ if (newValue !== oldValue) {
85752
+ if (attrName === 'readonly') {
85753
+ this.onReadOnlyChange(newValue === 'true');
85754
+ }
85755
+
85756
+ if (attrName === 'link-target-blank') {
85757
+ this.#initProcessor();
85758
+ }
85759
+ }
85760
+ }
85761
+
85762
+ // We're overriding the rule for em with single underscore to perform as underline. (_underline_)
85763
+ customUnderlineRenderer() {
85764
+ this.processor.renderer.rules.em_open = (tokens, idx, options, env, self) => {
85765
+ if (tokens[idx].markup === '_') tokens[idx].tag = 'u';
85766
+ return this.#origEmRenderer(tokens, idx, options, env, self);
85767
+ };
85768
+ this.processor.renderer.rules.em_close = (tokens, idx, options, env, self) => {
85769
+ if (tokens[idx].markup === '_') tokens[idx].tag = 'u';
85770
+ return this.#origEmRenderer(tokens, idx, options, env, self);
85771
+ };
85772
+ }
85773
+
85774
+ #customizeLinkRenderer() {
85775
+ if (this.linkTargetBlank) {
85776
+ this.processor.renderer.rules.link_open = (tokens, idx, options, env, self) => {
85777
+ // Add a new `target` attribute, or replace the value of the existing one.
85778
+ tokens[idx].attrSet('target', '_blank');
85779
+ // Pass the token to the default renderer.
85780
+ return this.#origLinkRenderer(tokens, idx, options, env, self);
85781
+ };
85782
+ } else {
85783
+ this.processor.renderer.rules.link_open = this.#origLinkRenderer;
85784
+ }
85785
+ }
85786
+
85787
+ #disableCustomRules() {
85788
+ if (!this.processor) {
85789
+ return;
85790
+ }
85791
+ this.processor.disable(disableRules);
85792
+ }
85793
+
85794
+ #updateProcessorRules() {
85795
+ this.#disableCustomRules();
85796
+ }
85797
+
85798
+ #storeOrigRenderers() {
85799
+ const defaultLinkRenderer = (tokens, idx, options, _, self) =>
85800
+ self.renderToken(tokens, idx, options);
85801
+ this.#origLinkRenderer = this.processor.renderer.rules.link_open || defaultLinkRenderer;
85802
+
85803
+ const defaultStrongRenderer = (tokens, idx, options, _, self) =>
85804
+ self.renderToken(tokens, idx, options);
85805
+ this.#origEmRenderer = this.processor.renderer.rules.em_open || defaultStrongRenderer;
85806
+ }
85807
+
85808
+ #initProcessor() {
85809
+ this.processor = new MarkdownIt('commonmark', { html: true });
85810
+ this.#storeOrigRenderers();
85811
+ this.#updateProcessorRules();
85812
+ this.#customizeLinkRenderer();
85813
+ this.customUnderlineRenderer();
85814
+ }
85815
+
85816
+ get linkTargetBlank() {
85817
+ return this.getAttribute('link-target-blank') === 'true';
85818
+ }
85819
+
85820
+ get contentNode() {
85821
+ return this.shadowRoot.querySelector('.content');
85822
+ }
85823
+
85824
+ #parseChildren() {
85825
+ if (!this.processor) {
85826
+ return;
85827
+ }
85828
+
85829
+ let html = decodeHTML(this.innerHTML);
85830
+
85831
+ if (!html?.trim() && this.isConnected) {
85832
+ this.setAttribute('empty', 'true');
85833
+ } else {
85834
+ this.removeAttribute('empty');
85835
+ }
85836
+
85837
+ try {
85838
+ const tokens = this.processor.parse(html, { references: undefined });
85839
+ html = this.processor.renderer.render(tokens, { html: true, breaks: true });
85840
+ } catch (e) {
85841
+ // eslint-disable-next-line no-console
85842
+ console.warn('Not parsing invalid markdown token');
85843
+ }
85844
+
85845
+ this.contentNode.innerHTML = html;
85846
+ this.contentNode.firstChild?.setAttribute('part', 'content');
85847
+ }
85848
+
85849
+ onReadOnlyChange(isReadOnly) {
85850
+ if (isReadOnly) {
85851
+ this.contentNode.setAttribute('inert', isReadOnly);
85852
+ } else {
85853
+ this.contentNode.removeAttribute('inert');
85854
+ }
85855
+ }
85856
+ }
85857
+
85858
+ const EnrichedTextClass = compose(
85859
+ createStyleMixin$1({
85860
+ mappings: {
85861
+ hostWidth: { selector: () => ':host', property: 'width' },
85862
+ hostDisplay: { selector: () => ':host', property: 'display', fallback: 'inline-block' },
85863
+ hostDirection: { selector: () => ':host', property: 'direction' },
85864
+ fontSize: {},
85865
+ fontFamily: {},
85866
+ fontWeight: {},
85867
+ fontWeightBold: [
85868
+ { selector: () => ':host strong', property: 'font-weight' },
85869
+ { selector: () => ':host b', property: 'font-weight' },
85870
+ ],
85871
+ textColor: { property: 'color' },
85872
+ textLineHeight: { property: 'line-height' },
85873
+ textAlign: {},
85874
+ linkColor: { selector: 'a', property: 'color' },
85875
+ linkTextDecoration: { selector: 'a', property: 'text-decoration' },
85876
+ linkHoverTextDecoration: { selector: 'a:hover', property: 'text-decoration' },
85877
+ minHeight: {},
85878
+ minWidth: {},
85879
+ },
85880
+ }),
85881
+ createStyleMixin$1({ componentNameOverride: getComponentName('link') }),
85882
+ createStyleMixin$1({ componentNameOverride: getComponentName('text') }),
85883
+ draggableMixin$1,
85884
+ componentNameValidationMixin$1
85885
+ )(EnrichedText);
85886
+
85638
85887
  const createBaseInputClass = (...args) =>
85639
85888
  compose$1(
85640
85889
  inputValidationMixin,
@@ -85643,9 +85892,9 @@ function requireIndex_cjs () {
85643
85892
  inputEventsDispatchingMixin
85644
85893
  )(createBaseClass(...args));
85645
85894
 
85646
- const componentName$16 = getComponentName$1('boolean-field-internal');
85895
+ const componentName$15 = getComponentName$1('boolean-field-internal');
85647
85896
 
85648
- createBaseInputClass({ componentName: componentName$16, baseSelector: 'div' });
85897
+ createBaseInputClass({ componentName: componentName$15, baseSelector: 'div' });
85649
85898
 
85650
85899
  const booleanFieldMixin = (superclass) =>
85651
85900
  class BooleanFieldMixinClass extends superclass {
@@ -85654,14 +85903,14 @@ function requireIndex_cjs () {
85654
85903
 
85655
85904
  const template = document.createElement('template');
85656
85905
  template.innerHTML = `
85657
- <${componentName$16}
85906
+ <${componentName$15}
85658
85907
  tabindex="-1"
85659
85908
  slot="input"
85660
- ></${componentName$16}>
85909
+ ></${componentName$15}>
85661
85910
  `;
85662
85911
 
85663
85912
  this.baseElement.appendChild(template.content.cloneNode(true));
85664
- this.inputElement = this.shadowRoot.querySelector(componentName$16);
85913
+ this.inputElement = this.shadowRoot.querySelector(componentName$15);
85665
85914
  this.checkbox = this.inputElement.querySelector('vaadin-checkbox');
85666
85915
 
85667
85916
  forwardAttrs$1(this, this.inputElement, {
@@ -85681,7 +85930,7 @@ function requireIndex_cjs () {
85681
85930
  }
85682
85931
  };
85683
85932
 
85684
- var commonStyles = `
85933
+ var commonStyles = (cssVarList) => `
85685
85934
  :host {
85686
85935
  display: inline-flex;
85687
85936
  }
@@ -85728,9 +85977,18 @@ descope-boolean-field-internal {
85728
85977
  -webkit-mask-image: none;
85729
85978
  min-height: initial;
85730
85979
  }
85980
+
85981
+ descope-enriched-text[empty] {
85982
+ ${EnrichedTextClass.cssVarList.hostDisplay}: none;
85983
+ }
85984
+
85985
+ descope-enriched-text {
85986
+ ${EnrichedTextClass.cssVarList.hostDirection}: var(${cssVarList.hostDirection});
85987
+ }
85988
+
85731
85989
  `;
85732
85990
 
85733
- const componentName$15 = getComponentName$1('checkbox');
85991
+ const componentName$14 = getComponentName$1('checkbox');
85734
85992
 
85735
85993
  const {
85736
85994
  host: host$s,
@@ -85743,7 +86001,9 @@ descope-boolean-field-internal {
85743
86001
  errorMessage: errorMessage$a,
85744
86002
  } = {
85745
86003
  host: { selector: () => ':host' },
85746
- requiredIndicator: { selector: '[required] vaadin-checkbox [slot="label"]:not(:empty)::after' },
86004
+ requiredIndicator: {
86005
+ selector: '[required] vaadin-checkbox [slot="label"]:not(:empty)::part(content)::after',
86006
+ },
85747
86007
  component: { selector: 'vaadin-checkbox' },
85748
86008
  checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
85749
86009
  checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
@@ -85789,6 +86049,16 @@ descope-boolean-field-internal {
85789
86049
  inputOutlineColor: { ...checkboxElement, property: 'outline-color' },
85790
86050
  inputOutlineStyle: { ...checkboxElement, property: 'outline-style' },
85791
86051
 
86052
+ inputContainerPadding: { ...component$1, property: 'padding' },
86053
+ inputContainerBorderRadius: { ...component$1, property: 'border-radius' },
86054
+ inputContainerBorderWidth: { ...component$1, property: 'border-width' },
86055
+ inputContainerBorderColor: { ...component$1, property: 'border-color' },
86056
+ inputContainerBorderStyle: { ...component$1, property: 'border-style' },
86057
+ inputContainerOutlineWidth: { ...component$1, property: 'outline-width' },
86058
+ inputContainerOutlineOffset: { ...component$1, property: 'outline-offset' },
86059
+ inputContainerOutlineColor: { ...component$1, property: 'outline-color' },
86060
+ inputContainerOutlineStyle: { ...component$1, property: 'outline-style' },
86061
+
85792
86062
  inputSize: [
85793
86063
  { ...checkboxElement, property: 'width' },
85794
86064
  { ...checkboxElement, property: 'height' },
@@ -85806,7 +86076,7 @@ descope-boolean-field-internal {
85806
86076
  slots: [],
85807
86077
  wrappedEleName: 'vaadin-text-field',
85808
86078
  style: () => `
85809
- ${commonStyles}
86079
+ ${commonStyles(CheckboxClass.cssVarList)}
85810
86080
  ${useHostExternalPadding(CheckboxClass.cssVarList)}
85811
86081
 
85812
86082
  :host {
@@ -85848,7 +86118,7 @@ descope-boolean-field-internal {
85848
86118
  }
85849
86119
  `,
85850
86120
  excludeAttrsSync: ['label', 'tabindex', 'style'],
85851
- componentName: componentName$15,
86121
+ componentName: componentName$14,
85852
86122
  })
85853
86123
  );
85854
86124
 
@@ -85893,7 +86163,7 @@ descope-boolean-field-internal {
85893
86163
  vars: vars$X
85894
86164
  });
85895
86165
 
85896
- const componentName$14 = getComponentName$1('switch-toggle');
86166
+ const componentName$13 = getComponentName$1('switch-toggle');
85897
86167
 
85898
86168
  const {
85899
86169
  host: host$r,
@@ -85906,7 +86176,9 @@ descope-boolean-field-internal {
85906
86176
  errorMessage: errorMessage$9,
85907
86177
  } = {
85908
86178
  host: { selector: () => ':host' },
85909
- requiredIndicator: { selector: '[required] vaadin-checkbox [slot="label"]:not(:empty)::after' },
86179
+ requiredIndicator: {
86180
+ selector: '[required] vaadin-checkbox [slot="label"]:not(:empty)::part(content)::after',
86181
+ },
85910
86182
  component: { selector: 'vaadin-checkbox' },
85911
86183
  checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
85912
86184
  checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
@@ -85979,7 +86251,7 @@ descope-boolean-field-internal {
85979
86251
  slots: [],
85980
86252
  wrappedEleName: 'vaadin-text-field',
85981
86253
  style: () => `
85982
- ${commonStyles}
86254
+ ${commonStyles(SwitchToggleClass.cssVarList)}
85983
86255
  ${useHostExternalPadding(SwitchToggleClass.cssVarList)}
85984
86256
 
85985
86257
  :host {
@@ -86035,7 +86307,7 @@ descope-boolean-field-internal {
86035
86307
  }
86036
86308
  `,
86037
86309
  excludeAttrsSync: ['label', 'tabindex', 'style'],
86038
- componentName: componentName$14,
86310
+ componentName: componentName$13,
86039
86311
  })
86040
86312
  );
86041
86313
 
@@ -86116,9 +86388,9 @@ descope-boolean-field-internal {
86116
86388
  vars: vars$W
86117
86389
  });
86118
86390
 
86119
- const componentName$13 = getComponentName$1('container');
86391
+ const componentName$12 = getComponentName$1('container');
86120
86392
 
86121
- class RawContainer extends createBaseClass({ componentName: componentName$13, baseSelector: 'slot' }) {
86393
+ class RawContainer extends createBaseClass({ componentName: componentName$12, baseSelector: 'slot' }) {
86122
86394
  constructor() {
86123
86395
  super();
86124
86396
 
@@ -86203,7 +86475,7 @@ descope-boolean-field-internal {
86203
86475
  horizontalAlignment,
86204
86476
  shadowColor: '#00000020', // if we want to support transparency vars, we should use different color format
86205
86477
  },
86206
- componentName$13
86478
+ componentName$12
86207
86479
  );
86208
86480
 
86209
86481
  const { shadowColor: shadowColor$4 } = helperRefs$4;
@@ -86368,10 +86640,10 @@ descope-boolean-field-internal {
86368
86640
  return CssVarImageClass;
86369
86641
  };
86370
86642
 
86371
- const componentName$12 = getComponentName$1('logo');
86643
+ const componentName$11 = getComponentName$1('logo');
86372
86644
 
86373
86645
  const LogoClass = createCssVarImageClass({
86374
- componentName: componentName$12,
86646
+ componentName: componentName$11,
86375
86647
  varName: 'url',
86376
86648
  fallbackVarName: 'fallbackUrl',
86377
86649
  });
@@ -86388,10 +86660,10 @@ descope-boolean-field-internal {
86388
86660
  vars: vars$U
86389
86661
  });
86390
86662
 
86391
- const componentName$11 = getComponentName$1('totp-image');
86663
+ const componentName$10 = getComponentName$1('totp-image');
86392
86664
 
86393
86665
  const TotpImageClass = createCssVarImageClass({
86394
- componentName: componentName$11,
86666
+ componentName: componentName$10,
86395
86667
  varName: 'url',
86396
86668
  fallbackVarName: 'fallbackUrl',
86397
86669
  });
@@ -86408,10 +86680,10 @@ descope-boolean-field-internal {
86408
86680
  vars: vars$T
86409
86681
  });
86410
86682
 
86411
- const componentName$10 = getComponentName$1('notp-image');
86683
+ const componentName$$ = getComponentName$1('notp-image');
86412
86684
 
86413
86685
  const NotpImageClass = createCssVarImageClass({
86414
- componentName: componentName$10,
86686
+ componentName: componentName$$,
86415
86687
  varName: 'url',
86416
86688
  fallbackVarName: 'fallbackUrl',
86417
86689
  });
@@ -86428,10 +86700,10 @@ descope-boolean-field-internal {
86428
86700
  vars: vars$S
86429
86701
  });
86430
86702
 
86431
- const componentName$$ = getComponentName('text');
86703
+ const componentName$_ = getComponentName('text');
86432
86704
 
86433
86705
  class RawText extends createBaseClass$1({
86434
- componentName: componentName$$,
86706
+ componentName: componentName$_,
86435
86707
  baseSelector: ':host > slot',
86436
86708
  }) {
86437
86709
  constructor() {
@@ -86503,7 +86775,7 @@ descope-boolean-field-internal {
86503
86775
  const text$3 = {
86504
86776
  [vars$R.hostDirection]: globalRefs$A.direction,
86505
86777
  [vars$R.textLineHeight]: '1.35em',
86506
- [vars$R.textAlign]: 'left',
86778
+ [vars$R.textAlign]: 'start',
86507
86779
  [vars$R.textColor]: globalRefs$A.colors.surface.dark,
86508
86780
 
86509
86781
  variant: {
@@ -86600,229 +86872,6 @@ descope-boolean-field-internal {
86600
86872
  vars: vars$R
86601
86873
  });
86602
86874
 
86603
- const disableRules = [
86604
- 'blockquote',
86605
- 'list',
86606
- 'image',
86607
- 'table',
86608
- 'code',
86609
- 'hr',
86610
- 'backticks',
86611
- 'fence',
86612
- 'reference',
86613
- 'heading',
86614
- 'lheading',
86615
- 'html_block',
86616
- ];
86617
-
86618
- const decodeHTML = (html) => {
86619
- const textArea = document.createElement('textarea');
86620
- textArea.innerHTML = html;
86621
- return textArea.value;
86622
- };
86623
-
86624
- /* eslint-disable no-param-reassign */
86625
-
86626
-
86627
- const componentName$_ = getComponentName('enriched-text');
86628
-
86629
- class EnrichedText extends createBaseClass$1({ componentName: componentName$_, baseSelector: ':host > div' }) {
86630
- #origLinkRenderer;
86631
-
86632
- #origEmRenderer;
86633
-
86634
- constructor() {
86635
- super();
86636
-
86637
- this.attachShadow({ mode: 'open' }).innerHTML = `
86638
- <div class="content"></div>
86639
- `;
86640
-
86641
- injectStyle(
86642
- `
86643
- :host {
86644
- line-height: 1em;
86645
- word-break: break-word;
86646
- }
86647
- :host > slot {
86648
- width: 100%;
86649
- display: inline-block;
86650
- }
86651
- *, *:last-child {
86652
- margin: 0;
86653
- }
86654
- h1,
86655
- h2,
86656
- h3,
86657
- h4,
86658
- h5,
86659
- h6,
86660
- p {
86661
- margin-bottom: 1em;
86662
- }
86663
- a {
86664
- cursor: pointer;
86665
- }
86666
- blockquote {
86667
- padding: 0 2em;
86668
- }
86669
- u {
86670
- text-decoration: underline
86671
- }
86672
- s {
86673
- color: currentColor;
86674
- }
86675
- `,
86676
- this
86677
- );
86678
-
86679
- this.#initProcessor();
86680
-
86681
- observeChildren(this, this.#parseChildren.bind(this));
86682
- }
86683
-
86684
- static get observedAttributes() {
86685
- return ['readonly', 'link-target-blank'];
86686
- }
86687
-
86688
- attributeChangedCallback(attrName, oldValue, newValue) {
86689
- super.attributeChangedCallback?.(attrName, oldValue, newValue);
86690
-
86691
- if (newValue !== oldValue) {
86692
- if (attrName === 'readonly') {
86693
- this.onReadOnlyChange(newValue === 'true');
86694
- }
86695
-
86696
- if (attrName === 'link-target-blank') {
86697
- this.#initProcessor();
86698
- }
86699
- }
86700
- }
86701
-
86702
- // We're overriding the rule for em with single underscore to perform as underline. (_underline_)
86703
- customUnderlineRenderer() {
86704
- this.processor.renderer.rules.em_open = (tokens, idx, options, env, self) => {
86705
- if (tokens[idx].markup === '_') tokens[idx].tag = 'u';
86706
- return this.#origEmRenderer(tokens, idx, options, env, self);
86707
- };
86708
- this.processor.renderer.rules.em_close = (tokens, idx, options, env, self) => {
86709
- if (tokens[idx].markup === '_') tokens[idx].tag = 'u';
86710
- return this.#origEmRenderer(tokens, idx, options, env, self);
86711
- };
86712
- }
86713
-
86714
- #customizeLinkRenderer() {
86715
- if (this.linkTargetBlank) {
86716
- this.processor.renderer.rules.link_open = (tokens, idx, options, env, self) => {
86717
- // Add a new `target` attribute, or replace the value of the existing one.
86718
- tokens[idx].attrSet('target', '_blank');
86719
- // Pass the token to the default renderer.
86720
- return this.#origLinkRenderer(tokens, idx, options, env, self);
86721
- };
86722
- } else {
86723
- this.processor.renderer.rules.link_open = this.#origLinkRenderer;
86724
- }
86725
- }
86726
-
86727
- #disableCustomRules() {
86728
- if (!this.processor) {
86729
- return;
86730
- }
86731
- this.processor.disable(disableRules);
86732
- }
86733
-
86734
- #updateProcessorRules() {
86735
- this.#disableCustomRules();
86736
- }
86737
-
86738
- #storeOrigRenderers() {
86739
- const defaultLinkRenderer = (tokens, idx, options, _, self) =>
86740
- self.renderToken(tokens, idx, options);
86741
- this.#origLinkRenderer = this.processor.renderer.rules.link_open || defaultLinkRenderer;
86742
-
86743
- const defaultStrongRenderer = (tokens, idx, options, _, self) =>
86744
- self.renderToken(tokens, idx, options);
86745
- this.#origEmRenderer = this.processor.renderer.rules.em_open || defaultStrongRenderer;
86746
- }
86747
-
86748
- #initProcessor() {
86749
- this.processor = new MarkdownIt('commonmark', { html: true });
86750
- this.#storeOrigRenderers();
86751
- this.#updateProcessorRules();
86752
- this.#customizeLinkRenderer();
86753
- this.customUnderlineRenderer();
86754
- }
86755
-
86756
- get linkTargetBlank() {
86757
- return this.getAttribute('link-target-blank') === 'true';
86758
- }
86759
-
86760
- get contentNode() {
86761
- return this.shadowRoot.querySelector('.content');
86762
- }
86763
-
86764
- #parseChildren() {
86765
- if (!this.processor) {
86766
- return;
86767
- }
86768
-
86769
- let html = decodeHTML(this.innerHTML);
86770
-
86771
- if (!html?.trim() && this.isConnected) {
86772
- this.setAttribute('empty', 'true');
86773
- } else {
86774
- this.removeAttribute('empty');
86775
- }
86776
-
86777
- try {
86778
- const tokens = this.processor.parse(html, { references: undefined });
86779
- html = this.processor.renderer.render(tokens, { html: true, breaks: true });
86780
- } catch (e) {
86781
- // eslint-disable-next-line no-console
86782
- console.warn('Not parsing invalid markdown token');
86783
- }
86784
-
86785
- this.contentNode.innerHTML = html;
86786
- }
86787
-
86788
- onReadOnlyChange(isReadOnly) {
86789
- if (isReadOnly) {
86790
- this.contentNode.setAttribute('inert', isReadOnly);
86791
- } else {
86792
- this.contentNode.removeAttribute('inert');
86793
- }
86794
- }
86795
- }
86796
-
86797
- const EnrichedTextClass = compose(
86798
- createStyleMixin$1({
86799
- mappings: {
86800
- hostWidth: { selector: () => ':host', property: 'width' },
86801
- hostDisplay: { selector: () => ':host', property: 'display', fallback: 'inline-block' },
86802
- hostDirection: { selector: () => ':host', property: 'direction' },
86803
- fontSize: {},
86804
- fontFamily: {},
86805
- fontWeight: {},
86806
- fontWeightBold: [
86807
- { selector: () => ':host strong', property: 'font-weight' },
86808
- { selector: () => ':host b', property: 'font-weight' },
86809
- ],
86810
- textColor: { property: 'color' },
86811
- textLineHeight: { property: 'line-height' },
86812
- textAlign: {},
86813
- linkColor: { selector: 'a', property: 'color' },
86814
- linkTextDecoration: { selector: 'a', property: 'text-decoration' },
86815
- linkHoverTextDecoration: { selector: 'a:hover', property: 'text-decoration' },
86816
- minHeight: {},
86817
- minWidth: {},
86818
- },
86819
- }),
86820
- createStyleMixin$1({ componentNameOverride: getComponentName('link') }),
86821
- createStyleMixin$1({ componentNameOverride: getComponentName('text') }),
86822
- draggableMixin$1,
86823
- componentNameValidationMixin$1
86824
- )(EnrichedText);
86825
-
86826
86875
  const componentName$Z = getComponentName('link');
86827
86876
 
86828
86877
  class RawLink extends createBaseClass$1({ componentName: componentName$Z, baseSelector: ':host a' }) {
@@ -97634,125 +97683,9 @@ descope-boolean-field-internal {
97634
97683
  vars: vars$l
97635
97684
  });
97636
97685
 
97637
- const componentName$n = getComponentName('apps-list');
97638
-
97639
- const itemRenderer$4 = ({ name, icon, url }, _, ref) => `
97640
- <a ${url ? `href="${url}" title="${url}"` : ''} target="_blank">
97641
- <descope-list-item>
97642
- <descope-avatar
97643
- ${icon ? `img="${icon}"` : ''}
97644
- ${name ? `display-name="${name}" abbr=${limitAbbreviation(name)}` : ''}
97645
- size=${ref.size}
97646
- ></descope-avatar>
97647
- <descope-text
97648
- variant="body1"
97649
- mode="primary"
97650
- >${name}</descope-text>
97651
- </descope-list-item>
97652
- </a>
97653
- `;
97686
+ const componentName$n = getComponentName('list-item');
97654
97687
 
97655
97688
  const customMixin$3 = (superclass) =>
97656
- class AppsListMixinClass extends superclass {
97657
- get size() {
97658
- return this.getAttribute('size') || 'sm';
97659
- }
97660
- };
97661
-
97662
- const AppsListClass = compose(
97663
- createStyleMixin$1({
97664
- mappings: {
97665
- maxHeight: { selector: () => ':host' },
97666
- minHeight: { selector: () => ':host' },
97667
- hostDirection: { selector: () => ':host', property: 'direction' },
97668
- itemsFontWeight: {
97669
- selector: TextClass.componentName,
97670
- property: TextClass.cssVarList.fontWeight,
97671
- },
97672
- itemsFontSize: {
97673
- selector: TextClass.componentName,
97674
- property: TextClass.cssVarList.fontSize,
97675
- },
97676
- itemsTextAlign: {
97677
- selector: TextClass.componentName,
97678
- property: TextClass.cssVarList.textAlign,
97679
- },
97680
- },
97681
- }),
97682
- createDynamicDataMixin$1({ itemRenderer: itemRenderer$4, rerenderAttrsList: ['size'] }),
97683
- draggableMixin$1,
97684
- componentNameValidationMixin$1,
97685
- customMixin$3
97686
- )(
97687
- createProxy$1({
97688
- slots: ['empty-state'],
97689
- wrappedEleName: 'descope-list',
97690
- excludeAttrsSync: ['tabindex', 'class', 'empty', 'style'],
97691
- componentName: componentName$n,
97692
- style: () => `
97693
- :host {
97694
- width: 100%;
97695
- display: inline-flex;
97696
- }
97697
-
97698
- descope-text::part(text-wrapper) {
97699
- display: -webkit-box;
97700
- -webkit-line-clamp: 2;
97701
- -webkit-box-orient: vertical;
97702
- overflow: hidden;
97703
- }
97704
-
97705
- a {
97706
- text-decoration: none;
97707
- }
97708
-
97709
- descope-text {
97710
- ${TextClass.cssVarList.hostDirection}: var(${AppsListClass.cssVarList.hostDirection});
97711
- }
97712
- `,
97713
- })
97714
- );
97715
-
97716
- const vars$k = AppsListClass.cssVarList;
97717
- const globalRefs$a = getThemeRefs$1(globals);
97718
-
97719
- const defaultHeight = '400px';
97720
-
97721
- const appsList = {
97722
- [vars$k.itemsFontWeight]: 'normal',
97723
- [vars$k.itemsTextAlign]: 'start',
97724
- [vars$k.hostDirection]: globalRefs$a.direction,
97725
- [vars$k.maxHeight]: defaultHeight,
97726
-
97727
- _empty: {
97728
- [vars$k.minHeight]: defaultHeight,
97729
- },
97730
-
97731
- size: {
97732
- xs: {
97733
- [vars$k.itemsFontSize]: '14px',
97734
- },
97735
- sm: {
97736
- [vars$k.itemsFontSize]: '14px',
97737
- },
97738
- md: {
97739
- [vars$k.itemsFontSize]: '16px',
97740
- },
97741
- lg: {
97742
- [vars$k.itemsFontSize]: '20px',
97743
- },
97744
- },
97745
- };
97746
-
97747
- var appsList$1 = /*#__PURE__*/Object.freeze({
97748
- __proto__: null,
97749
- default: appsList,
97750
- vars: vars$k
97751
- });
97752
-
97753
- const componentName$m = getComponentName('list-item');
97754
-
97755
- const customMixin$2 = (superclass) =>
97756
97689
  class ListItemMixinClass extends superclass {
97757
97690
  constructor() {
97758
97691
  super();
@@ -97805,14 +97738,14 @@ descope-boolean-field-internal {
97805
97738
  }),
97806
97739
  draggableMixin$1,
97807
97740
  componentNameValidationMixin$1,
97808
- customMixin$2,
97741
+ customMixin$3,
97809
97742
  activeableMixin,
97810
- )(createBaseClass$1({ componentName: componentName$m, baseSelector: 'slot' }));
97743
+ )(createBaseClass$1({ componentName: componentName$n, baseSelector: 'slot' }));
97811
97744
 
97812
- const componentName$l = getComponentName('list');
97745
+ const componentName$m = getComponentName('list');
97813
97746
 
97814
97747
  class RawList extends createBaseClass$1({
97815
- componentName: componentName$l,
97748
+ componentName: componentName$m,
97816
97749
  baseSelector: '.wrapper',
97817
97750
  }) {
97818
97751
  static get observedAttributes() {
@@ -97980,13 +97913,194 @@ descope-boolean-field-internal {
97980
97913
  componentNameValidationMixin$1,
97981
97914
  )(RawList);
97982
97915
 
97916
+ const componentName$l = getComponentName('apps-list');
97917
+
97918
+ const itemRenderer$4 = ({ name, icon, url }, _, ref) => `
97919
+ <a ${url ? `href="${url}" title="${url}"` : ''} target="_blank">
97920
+ <descope-list-item>
97921
+ <descope-avatar
97922
+ ${icon ? `img="${icon}"` : ''}
97923
+ ${name ? `display-name="${name}" abbr=${limitAbbreviation(name)}` : ''}
97924
+ size="${ref.logoSize || ref.size}"
97925
+ ></descope-avatar>
97926
+ <descope-text
97927
+ variant="${ref.itemTextVariant}"
97928
+ mode="primary"
97929
+ >${name}</descope-text>
97930
+ </descope-list-item>
97931
+ </a>
97932
+ `;
97933
+
97934
+ const customMixin$2 = (superclass) =>
97935
+ class AppsListMixinClass extends superclass {
97936
+ // size controls both item logo size and font size
97937
+ get size() {
97938
+ return this.getAttribute('size') || 'sm';
97939
+ }
97940
+
97941
+ get itemTextVariant() {
97942
+ return this.getAttribute('item-text-variant') || 'body1';
97943
+ }
97944
+
97945
+ get logoSize() {
97946
+ return this.getAttribute('logo-size');
97947
+ }
97948
+ };
97949
+
97950
+ const AppsListClass = compose(
97951
+ createStyleMixin$1({
97952
+ mappings: {
97953
+ maxHeight: { selector: () => ':host' },
97954
+ minHeight: { selector: () => ':host' },
97955
+ hostDirection: { selector: () => ':host', property: 'direction' },
97956
+ itemsFontWeight: {
97957
+ selector: TextClass.componentName,
97958
+ property: TextClass.cssVarList.fontWeightOverride,
97959
+ },
97960
+ itemsFontSize: {
97961
+ selector: TextClass.componentName,
97962
+ property: TextClass.cssVarList.fontSizeOverride,
97963
+ },
97964
+ itemsTextAlign: {
97965
+ selector: TextClass.componentName,
97966
+ property: TextClass.cssVarList.textAlign,
97967
+ },
97968
+ itemBackgroundColor: {
97969
+ selector: ListItemClass.componentName,
97970
+ property: ListItemClass.cssVarList.backgroundColor,
97971
+ },
97972
+ backgroundColor: {
97973
+ selector: ListClass.componentName,
97974
+ property: ListClass.cssVarList.backgroundColorOverride,
97975
+ },
97976
+ itemBorderStyle: {
97977
+ selector: ListItemClass.componentName,
97978
+ property: ListItemClass.cssVarList.borderStyleOverride,
97979
+ },
97980
+ itemBorderColor: {
97981
+ selector: ListItemClass.componentName,
97982
+ property: ListItemClass.cssVarList.borderColorOverride,
97983
+ },
97984
+ itemBorderWidth: {
97985
+ selector: ListItemClass.componentName,
97986
+ property: ListItemClass.cssVarList.borderWidthOverride,
97987
+ },
97988
+ itemVerticalPadding: {
97989
+ selector: ListItemClass.componentName,
97990
+ property: ListItemClass.cssVarList.verticalPaddingOverride,
97991
+ },
97992
+ itemHorizontalPadding: {
97993
+ selector: ListItemClass.componentName,
97994
+ property: ListItemClass.cssVarList.horizontalPaddingOverride,
97995
+ },
97996
+ itemAlignment: [
97997
+ { selector: ListItemClass.componentName, property: ListItemClass.cssVarList.alignItemsOverride },
97998
+ { selector: TextClass.componentName, property: TextClass.cssVarList.textAlign },
97999
+ ]
98000
+ },
98001
+ }),
98002
+ createDynamicDataMixin$1({ itemRenderer: itemRenderer$4, rerenderAttrsList: ['size', 'item-text-variant', 'logo-size'] }),
98003
+ draggableMixin$1,
98004
+ componentNameValidationMixin$1,
98005
+ customMixin$2
98006
+ )(
98007
+ createProxy$1({
98008
+ slots: ['empty-state'],
98009
+ wrappedEleName: 'descope-list',
98010
+ excludeAttrsSync: ['tabindex', 'class', 'empty', 'style'],
98011
+ componentName: componentName$l,
98012
+ style: () => `
98013
+ :host {
98014
+ width: 100%;
98015
+ display: inline-flex;
98016
+ }
98017
+
98018
+ descope-text::part(text-wrapper) {
98019
+ display: -webkit-box;
98020
+ -webkit-line-clamp: 2;
98021
+ -webkit-box-orient: vertical;
98022
+ overflow: hidden;
98023
+ }
98024
+
98025
+ a {
98026
+ text-decoration: none;
98027
+ }
98028
+
98029
+ descope-text {
98030
+ ${TextClass.cssVarList.hostDirection}: var(${AppsListClass.cssVarList.hostDirection});
98031
+ max-width: 100%;
98032
+ }
98033
+ `,
98034
+ })
98035
+ );
98036
+
98037
+ const vars$k = AppsListClass.cssVarList;
98038
+ const globalRefs$a = getThemeRefs$1(globals);
98039
+
98040
+ const defaultHeight = '400px';
98041
+
98042
+ const appsList = {
98043
+ [vars$k.itemsFontWeight]: 'normal',
98044
+ [vars$k.itemsTextAlign]: 'start',
98045
+ [vars$k.hostDirection]: globalRefs$a.direction,
98046
+ [vars$k.maxHeight]: defaultHeight,
98047
+
98048
+ _empty: {
98049
+ [vars$k.minHeight]: defaultHeight,
98050
+ },
98051
+
98052
+ size: {
98053
+ xs: {
98054
+ [vars$k.itemsFontSize]: '14px',
98055
+ },
98056
+ sm: {
98057
+ [vars$k.itemsFontSize]: '14px',
98058
+ },
98059
+ md: {
98060
+ [vars$k.itemsFontSize]: '16px',
98061
+ },
98062
+ lg: {
98063
+ [vars$k.itemsFontSize]: '20px',
98064
+ },
98065
+ },
98066
+
98067
+ itemPadding: {
98068
+ xs: {
98069
+ [vars$k.itemVerticalPadding]: globalRefs$a.spacing.xs,
98070
+ [vars$k.itemHorizontalPadding]: globalRefs$a.spacing.xs,
98071
+ },
98072
+ sm: {
98073
+ [vars$k.itemVerticalPadding]: globalRefs$a.spacing.sm,
98074
+ [vars$k.itemHorizontalPadding]: globalRefs$a.spacing.sm,
98075
+ },
98076
+ md: {
98077
+ [vars$k.itemVerticalPadding]: globalRefs$a.spacing.md,
98078
+ [vars$k.itemHorizontalPadding]: globalRefs$a.spacing.md,
98079
+ },
98080
+ lg: {
98081
+ [vars$k.itemVerticalPadding]: globalRefs$a.spacing.lg,
98082
+ [vars$k.itemHorizontalPadding]: globalRefs$a.spacing.lg,
98083
+ },
98084
+ xl: {
98085
+ [vars$k.itemVerticalPadding]: globalRefs$a.spacing.xl,
98086
+ [vars$k.itemHorizontalPadding]: globalRefs$a.spacing.xl,
98087
+ },
98088
+ },
98089
+ };
98090
+
98091
+ var appsList$1 = /*#__PURE__*/Object.freeze({
98092
+ __proto__: null,
98093
+ default: appsList,
98094
+ vars: vars$k
98095
+ });
98096
+
97983
98097
  const globalRefs$9 = getThemeRefs$1(globals);
97984
98098
 
97985
98099
  const compVars$3 = ListClass.cssVarList;
97986
98100
 
97987
98101
  const [helperTheme$1, helperRefs$1, helperVars$1] = createHelperVars$1(
97988
98102
  { shadowColor: '#00000020' },
97989
- componentName$l
98103
+ componentName$m
97990
98104
  );
97991
98105
 
97992
98106
  const { shadowColor: shadowColor$1 } = helperRefs$1;
@@ -103486,7 +103600,7 @@ const List = React__default.default.forwardRef(({ emptyState, children, ...props
103486
103600
 
103487
103601
  const ListItem = React__default.default.forwardRef((props, ref) => (React__default.default.createElement("descope-list-item", { ...props, ref: ref })));
103488
103602
 
103489
- const AppsList = React__default.default.forwardRef(({ emptyState, data, ...props }, ref) => (React__default.default.createElement("descope-apps-list", { data: data ? JSON.stringify(data) : undefined, ...props, ref: ref },
103603
+ const AppsList = React__default.default.forwardRef(({ emptyState, data, variant, ...props }, ref) => (React__default.default.createElement("descope-apps-list", { data: data ? JSON.stringify(data) : undefined, variant: variant !== 'list' ? 'tiles' : 'list', ...props, ref: ref },
103490
103604
  React__default.default.createElement("div", { slot: "empty-state" }, emptyState))));
103491
103605
 
103492
103606
  const ScopesList = React__default.default.forwardRef(({ data, ...props }, ref) => (React__default.default.createElement("descope-scopes-list", { data: data ? JSON.stringify(data) : undefined, ...props, ref: ref })));