@descope/flow-components 2.0.514 → 2.0.516

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.
Files changed (2) hide show
  1. package/dist/index.cjs.js +52 -14
  2. package/package.json +3 -3
package/dist/index.cjs.js CHANGED
@@ -77660,19 +77660,19 @@ function requireIndex_cjs () {
77660
77660
 
77661
77661
  const createSyncAttrsCb =
77662
77662
  (srcEle, targetEle, mapAttrs = {}) =>
77663
- (attrNames) => {
77664
- attrNames.forEach((attrName) => {
77665
- const targetAttrName = mapAttrs[attrName] || attrName;
77666
- const srcAttrVal = srcEle.getAttribute(attrName);
77667
- if (srcAttrVal !== null) {
77668
- if (targetEle.getAttribute(targetAttrName) !== srcAttrVal) {
77669
- targetEle.setAttribute(targetAttrName, srcAttrVal);
77663
+ (attrNames) => {
77664
+ attrNames.forEach((attrName) => {
77665
+ const targetAttrName = mapAttrs[attrName] || attrName;
77666
+ const srcAttrVal = srcEle.getAttribute(attrName);
77667
+ if (srcAttrVal !== null) {
77668
+ if (targetEle.getAttribute(targetAttrName) !== srcAttrVal) {
77669
+ targetEle.setAttribute(targetAttrName, srcAttrVal);
77670
+ }
77671
+ } else {
77672
+ targetEle.removeAttribute(targetAttrName);
77670
77673
  }
77671
- } else {
77672
- targetEle.removeAttribute(targetAttrName);
77673
- }
77674
- });
77675
- };
77674
+ });
77675
+ };
77676
77676
 
77677
77677
  const syncAttrs = (ele1, ele2, options) => {
77678
77678
  observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), options);
@@ -77709,8 +77709,16 @@ function requireIndex_cjs () {
77709
77709
  Object.defineProperties(target, config);
77710
77710
  };
77711
77711
 
77712
- const injectStyle = (cssString, ref, {prepend = false} = {}) => {
77713
- const style = new CSSStyleSheet();
77712
+ const injectStyle = (cssString, ref, { prepend = false } = {}) => {
77713
+
77714
+ let style;
77715
+ try {
77716
+ style = new CSSStyleSheet();
77717
+ } catch (e) {
77718
+ // fallback for browsers that don't support CSSStyleSheet
77719
+ return generateStyleTagFallback(cssString, ref, { prepend });
77720
+ }
77721
+
77714
77722
  const _ref = ref?.shadowRoot || ref;
77715
77723
  if (cssString) {
77716
77724
  style.replaceSync(cssString);
@@ -77725,6 +77733,36 @@ function requireIndex_cjs () {
77725
77733
  return style;
77726
77734
  };
77727
77735
 
77736
+ // we should mimic the CSSStyleSheet API for the fns we are using
77737
+ class CSSStyleSheetMock {
77738
+ constructor(cssString, ref, { prepend = false } = {}) {
77739
+ this.styleEle = document.createElement('style');
77740
+ this.styleEle.textContent = cssString;
77741
+ this.styleEle.setAttribute('nonce', window.DESCOPE_NONCE);
77742
+ this.ref = ref?.shadowRoot || ref;
77743
+
77744
+ if (!this.ref) {
77745
+ return
77746
+ }
77747
+
77748
+ if (prepend) {
77749
+ this.ref.prepend(this.styleEle);
77750
+ } else {
77751
+ this.ref.append(this.styleEle);
77752
+ }
77753
+ }
77754
+
77755
+ replaceSync(cssString) {
77756
+ this.styleEle.textContent = cssString;
77757
+ }
77758
+
77759
+ get cssRules() {
77760
+ return this.styleEle.sheet?.cssRules;
77761
+ }
77762
+ }
77763
+
77764
+ const generateStyleTagFallback = (cssString, ref, { prepend = false } = {}) => new CSSStyleSheetMock(cssString, ref, { prepend });
77765
+
77728
77766
  class ComponentsThemeManager {
77729
77767
  static mountOnPropName = 'DescopeThemeManager';
77730
77768
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/flow-components",
3
- "version": "2.0.514",
3
+ "version": "2.0.516",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -68,7 +68,7 @@
68
68
  "eslint-config-airbnb-typescript": "18.0.0",
69
69
  "eslint-config-prettier": "10.1.1",
70
70
  "eslint-config-standard": "17.1.0",
71
- "eslint-import-resolver-typescript": "4.3.1",
71
+ "eslint-import-resolver-typescript": "4.3.2",
72
72
  "eslint-plugin-import": "2.31.0",
73
73
  "eslint-plugin-jest": "28.11.0",
74
74
  "eslint-plugin-jest-dom": "5.5.0",
@@ -104,7 +104,7 @@
104
104
  "typescript": "^5.7.2"
105
105
  },
106
106
  "dependencies": {
107
- "@descope/web-components-ui": "1.72.0"
107
+ "@descope/web-components-ui": "1.74.0"
108
108
  },
109
109
  "peerDependencies": {
110
110
  "react": ">= 18"