@node-projects/web-component-designer 0.1.157 → 0.1.158

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.
@@ -1,3 +1,5 @@
1
1
  export declare function convertCssUnitToPixel(cssValue: string, target: HTMLElement, percentTarget: 'width' | 'height'): number;
2
2
  export declare function getCssUnit(cssValue: string): string;
3
3
  export declare function convertCssUnit(cssValue: string | number, target: HTMLElement, percentTarget: 'width' | 'height', unit: string): string;
4
+ export declare function splitCssGridColumnSizes(sizes: String): string[];
5
+ export declare function getExpandedCssGridColumnSizes(sizes: String): string[];
@@ -102,3 +102,34 @@ export function convertCssUnit(cssValue, target, percentTarget, unit) {
102
102
  function getOriginalSizeBeforeTransformation(element) {
103
103
  return { width: element.offsetWidth, height: element.offsetHeight };
104
104
  }
105
+ export function splitCssGridColumnSizes(sizes) {
106
+ const parts = sizes.split(' ');
107
+ const ret = [];
108
+ for (let i = 0; i < parts.length; i++) {
109
+ let p = parts[i];
110
+ if (p.startsWith('repeat(')) {
111
+ while (!p.includes(")")) {
112
+ i++;
113
+ if (!parts[i])
114
+ continue;
115
+ p += parts[i];
116
+ }
117
+ }
118
+ ret.push(p);
119
+ }
120
+ return ret;
121
+ }
122
+ export function getExpandedCssGridColumnSizes(sizes) {
123
+ const parts = splitCssGridColumnSizes(sizes);
124
+ const ret = [];
125
+ for (let p of parts) {
126
+ if (p.startsWith('repeat(')) {
127
+ const prt = p.split(',');
128
+ for (let i = 0; i < parseInt(prt[0].substring(7)); i++)
129
+ ret.push(prt[1].substring(0, prt[1].length - 1));
130
+ }
131
+ else
132
+ ret.push(p);
133
+ }
134
+ return ret.map(x => getCssUnit(x));
135
+ }
@@ -149,6 +149,12 @@ export class NativeElementsPropertiesService extends AbstractPropertiesService {
149
149
  type: "string",
150
150
  service: this,
151
151
  propertyType: PropertyType.propertyAndAttribute
152
+ },
153
+ {
154
+ name: "alt",
155
+ type: "string",
156
+ service: this,
157
+ propertyType: PropertyType.propertyAndAttribute
152
158
  }
153
159
  ];
154
160
  iframeProperties = [
@@ -1,5 +1,5 @@
1
1
  import { EventNames } from "../../../../../enums/EventNames.js";
2
- import { convertCssUnit, convertCssUnitToPixel, getCssUnit } from "../../../../helper/CssUnitConverter.js";
2
+ import { convertCssUnit, convertCssUnitToPixel, getCssUnit, getExpandedCssGridColumnSizes } from "../../../../helper/CssUnitConverter.js";
3
3
  import { calculateGridInformation } from "../../../../helper/GridHelper.js";
4
4
  import { getElementCombinedTransform } from "../../../../helper/TransformHelper.js";
5
5
  import { AbstractExtension } from '../AbstractExtension.js';
@@ -75,9 +75,8 @@ export class EditGridColumnRowSizesExtension extends AbstractExtension {
75
75
  this._hasChanged = false;
76
76
  const realStyle = this.extendedItem.getStyleFromSheetOrLocalOrComputed(templatePropertyName);
77
77
  const initialParts = this._initialSizes.split(' ');
78
- const parts = realStyle.split(' ');
79
- let units = parts.map(x => getCssUnit(x));
80
- if (parts.length != initialParts.length) {
78
+ let units = getExpandedCssGridColumnSizes(realStyle);
79
+ if (units.length != initialParts.length) {
81
80
  units = initialParts.map(x => getCssUnit(x));
82
81
  }
83
82
  this.extendedItem.element.style[templatePropertyName] = '';
@@ -65,15 +65,15 @@ export class GridToolbarExtension extends BasicStackedToolbarExtension {
65
65
  if (!rows)
66
66
  return;
67
67
  const cg = this.extendedItem.openGroup('change grid type');
68
- await this.extendedItem.updateStyleInSheetOrLocalAsync('grid-template-columns', '1fr '.repeat(parseInt(columns)).trim());
69
- await this.extendedItem.updateStyleInSheetOrLocalAsync('grid-template-rows', '1fr '.repeat(parseInt(rows)).trim());
68
+ await this.extendedItem.updateStyleInSheetOrLocalAsync('grid-template-columns', 'repeat(' + columns + ', 1fr)');
69
+ await this.extendedItem.updateStyleInSheetOrLocalAsync('grid-template-rows', 'repeat(' + rows + ', 1fr)');
70
70
  cg.commit();
71
71
  }
72
72
  else {
73
73
  const parts = gridTypeEl.value.split('x');
74
74
  const cg = this.extendedItem.openGroup('change grid type');
75
- await this.extendedItem.updateStyleInSheetOrLocalAsync('grid-template-columns', '1fr '.repeat(parseInt(parts[0])).trim());
76
- await this.extendedItem.updateStyleInSheetOrLocalAsync('grid-template-rows', '1fr '.repeat(parseInt(parts[1])).trim());
75
+ await this.extendedItem.updateStyleInSheetOrLocalAsync('grid-template-columns', 'repeat(' + parts[0] + ', 1fr)');
76
+ await this.extendedItem.updateStyleInSheetOrLocalAsync('grid-template-rows', 'repeat(' + parts[1] + ', 1fr)');
77
77
  cg.commit();
78
78
  }
79
79
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A WYSIWYG designer webcomponent for html components",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.1.157",
4
+ "version": "0.1.158",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",