@node-projects/web-component-designer 0.0.57 → 0.0.58
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.
|
@@ -14,7 +14,7 @@ export class CssEntry {
|
|
|
14
14
|
}
|
|
15
15
|
export class CssAttributeParser {
|
|
16
16
|
entries = [];
|
|
17
|
-
parse(text) {
|
|
17
|
+
parse(text, quoteType = '\'') {
|
|
18
18
|
this.entries = [];
|
|
19
19
|
let name = '';
|
|
20
20
|
let value = '';
|
|
@@ -38,7 +38,7 @@ export class CssAttributeParser {
|
|
|
38
38
|
token = Token.Name;
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
if (c ===
|
|
41
|
+
if (c === quoteType) {
|
|
42
42
|
token = Token.InQuote;
|
|
43
43
|
}
|
|
44
44
|
value += c;
|
|
@@ -51,10 +51,13 @@ export class CssAttributeParser {
|
|
|
51
51
|
c = text[n];
|
|
52
52
|
value += c;
|
|
53
53
|
}
|
|
54
|
-
if (c ===
|
|
54
|
+
else if (c === quoteType) {
|
|
55
55
|
value += c;
|
|
56
56
|
token = Token.Value;
|
|
57
57
|
}
|
|
58
|
+
else {
|
|
59
|
+
value += c;
|
|
60
|
+
}
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
if (name.trim() !== '') {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export function CalculateGridInformation(designItem) {
|
|
2
|
+
//todo:
|
|
3
|
+
//same name should combine columns/rows
|
|
2
4
|
let itemRect = designItem.element.getBoundingClientRect();
|
|
3
5
|
const computedStyle = getComputedStyle(designItem.element);
|
|
4
6
|
const rows = computedStyle.gridTemplateRows.split(' ');
|
|
5
7
|
const columns = computedStyle.gridTemplateColumns.split(' ');
|
|
8
|
+
const paddingLeft = Number.parseFloat(computedStyle.paddingLeft);
|
|
9
|
+
const paddingTop = Number.parseFloat(computedStyle.paddingTop);
|
|
6
10
|
let y = 0;
|
|
7
11
|
let xGap = 0;
|
|
8
12
|
let yGap = 0;
|
|
@@ -81,12 +85,12 @@ export function CalculateGridInformation(designItem) {
|
|
|
81
85
|
for (let yIdx = 0; yIdx < columns.length; yIdx++) {
|
|
82
86
|
const c = columns[yIdx];
|
|
83
87
|
if (x > 0 && xGap) {
|
|
84
|
-
retVal.gaps.push({ x: x + xOffset, y: y + yOffset, width: xGap, height: currY });
|
|
88
|
+
retVal.gaps.push({ x: x + xOffset + paddingLeft, y: y + yOffset + paddingTop, width: xGap, height: currY });
|
|
85
89
|
x += xGap;
|
|
86
90
|
}
|
|
87
91
|
const currX = Number.parseFloat(c.replace('px', ''));
|
|
88
92
|
if (y > 0 && yGap) {
|
|
89
|
-
retVal.gaps.push({ x: x + xOffset, y: y + yOffset - yGap, width: currX, height: yGap });
|
|
93
|
+
retVal.gaps.push({ x: x + xOffset + paddingLeft, y: y + yOffset - yGap + paddingTop, width: currX, height: yGap });
|
|
90
94
|
}
|
|
91
95
|
let name = null;
|
|
92
96
|
if (areas) {
|
|
@@ -95,7 +99,7 @@ export function CalculateGridInformation(designItem) {
|
|
|
95
99
|
name = nm;
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
|
-
const cell = { x: x + xOffset, y: y + yOffset, width: currX, height: currY, name: name };
|
|
102
|
+
const cell = { x: x + xOffset + paddingLeft, y: y + yOffset + paddingTop, width: currX, height: currY, name: name };
|
|
99
103
|
cellList.push(cell);
|
|
100
104
|
x += currX;
|
|
101
105
|
cl++;
|