@ostendis/grapesjs-preset-ostendis-adv 1.3.4 → 1.3.5

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.
@@ -22669,13 +22669,12 @@ __webpack_require__.r(__webpack_exports__);
22669
22669
  },
22670
22670
  style: {
22671
22671
  'box-sizing': 'border-box',
22672
- padding: '0',
22673
- height: '20px',
22672
+ 'height': '20px',
22674
22673
  'max-width': '100%',
22675
- border: '0px solid #666666',
22676
- background: 'linear-gradient(to right, #3b5998 66%, #CCCCCC 66%)',
22674
+ 'background': 'linear-gradient(to right, #3b5998 66%, #CCCCCC 66%)',
22677
22675
  },
22678
22676
  traits: [
22677
+ 'id',
22679
22678
  {
22680
22679
  name: 'percent',
22681
22680
  type: 'number',
@@ -22716,6 +22715,8 @@ __webpack_require__.r(__webpack_exports__);
22716
22715
  this.set('percent', p, { silent: true });
22717
22716
  this.set('bgcolor', b, { silent: true });
22718
22717
  this.set('fcolor', f, { silent: true });
22718
+ // Clean up stale background properties from saved HTML
22719
+ this.cleanupBackgroundStyles();
22719
22720
  const update = () => this.updateScale();
22720
22721
  this.on('change:percent', update);
22721
22722
  this.on('change:bgcolor', update);
@@ -22724,35 +22725,43 @@ __webpack_require__.r(__webpack_exports__);
22724
22725
  onRender() {
22725
22726
  this.updateScale();
22726
22727
  },
22727
- updateScale() {
22728
- let p = parseInt(this.get('percent'));
22729
- const f = this.get('fcolor') || '#3b5998';
22730
- const b = this.get('bgcolor') || '#CCCCCC';
22731
- if (isNaN(p))
22732
- p = 0;
22733
- p = Math.max(0, Math.min(100, p));
22734
- this.setAttributes({
22735
- 'data-scale': 'true',
22736
- 'data-percent': p.toString(),
22737
- 'data-fcolor': f,
22738
- 'data-bgcolor': b,
22739
- 'aria-label': `${p} %`,
22740
- }, { silent: true });
22728
+ cleanupBackgroundStyles() {
22741
22729
  const styles = this.getStyle() || {};
22742
- // Remove conflicting background properties from saved HTML
22743
- [
22744
- 'background-image',
22745
- 'background-position-x',
22746
- 'background-position-y',
22747
- 'background-size',
22748
- 'background-repeat',
22749
- 'background-attachment',
22750
- 'background-origin',
22751
- 'background-clip',
22752
- 'background-color',
22753
- ].forEach((prop) => delete styles[prop]);
22754
- styles['background'] = `linear-gradient(to right, ${f} ${p}%, ${b} ${p}%)`;
22755
- this.setStyle(styles);
22730
+ // Remove stale background-image that conflicts with gradient
22731
+ delete styles['background-image'];
22732
+ delete styles['background-position-x'];
22733
+ delete styles['background-position-y'];
22734
+ delete styles['background-size'];
22735
+ delete styles['background-repeat'];
22736
+ delete styles['background-attachment'];
22737
+ delete styles['background-origin'];
22738
+ delete styles['background-clip'];
22739
+ delete styles['background-color'];
22740
+ this.setStyle(styles, { silent: true });
22741
+ },
22742
+ updateScale() {
22743
+ try {
22744
+ let p = parseInt(this.get('percent'));
22745
+ const f = this.get('fcolor') || '#3b5998';
22746
+ const b = this.get('bgcolor') || '#CCCCCC';
22747
+ if (isNaN(p))
22748
+ p = 0;
22749
+ p = Math.max(0, Math.min(100, p));
22750
+ this.setAttributes({
22751
+ 'data-scale': 'true',
22752
+ 'data-percent': p.toString(),
22753
+ 'data-fcolor': f,
22754
+ 'data-bgcolor': b,
22755
+ 'aria-label': `${p} %`,
22756
+ }, { silent: true });
22757
+ const styles = this.getStyle() || {};
22758
+ // Apply gradient with validated colors
22759
+ styles['background'] = `linear-gradient(to right, ${f} ${p}%, ${b} ${p}%)`;
22760
+ this.setStyle(styles);
22761
+ }
22762
+ catch (error) {
22763
+ console.warn('Scale component update failed:', error);
22764
+ }
22756
22765
  },
22757
22766
  },
22758
22767
  });