tokenami 0.0.87 → 0.0.88
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/LICENSE +1 -1
- package/dist/cli.js +31 -11
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/LICENSE
CHANGED
package/dist/cli.js
CHANGED
|
@@ -872,15 +872,32 @@ function generatePlaceholderLayers(prefix) {
|
|
|
872
872
|
function generateLayerStyles(styles) {
|
|
873
873
|
const groupedBySelectors = /* @__PURE__ */ new Map();
|
|
874
874
|
for (const [template, selectors] of Object.entries(styles)) {
|
|
875
|
-
const
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
875
|
+
const { pseudoElements, otherSelectors } = separateSelectors(selectors);
|
|
876
|
+
if (otherSelectors.length > 0) {
|
|
877
|
+
const groupedSelector = otherSelectors.sort().join(",");
|
|
878
|
+
const existingStyles = groupedBySelectors.get(groupedSelector) || "";
|
|
879
|
+
const newStyles = template.replace(SELECTOR_TAG, groupedSelector);
|
|
880
|
+
groupedBySelectors.set(groupedSelector, existingStyles + " " + newStyles);
|
|
881
|
+
}
|
|
882
|
+
for (const pseudoElement of pseudoElements) {
|
|
883
|
+
const existingStyles = groupedBySelectors.get(pseudoElement) || "";
|
|
884
|
+
const newStyles = template.replace(SELECTOR_TAG, pseudoElement);
|
|
885
|
+
groupedBySelectors.set(pseudoElement, existingStyles + " " + newStyles);
|
|
886
|
+
}
|
|
879
887
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
888
|
+
return Array.from(groupedBySelectors.values()).join(" ");
|
|
889
|
+
}
|
|
890
|
+
function separateSelectors(selectors) {
|
|
891
|
+
const pseudoElements = [];
|
|
892
|
+
const otherSelectors = [];
|
|
893
|
+
for (const selector of selectors) {
|
|
894
|
+
if (isPseudoElementSelector(selector)) {
|
|
895
|
+
pseudoElements.push(selector);
|
|
896
|
+
} else {
|
|
897
|
+
otherSelectors.push(selector);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
return { pseudoElements, otherSelectors };
|
|
884
901
|
}
|
|
885
902
|
function getPropertyConfigs(tokenProperties, config) {
|
|
886
903
|
let propertyConfigs = /* @__PURE__ */ new Map();
|
|
@@ -1003,11 +1020,14 @@ function hashVariantProperty(variant, property) {
|
|
|
1003
1020
|
return `--_${Tokenami2.hash(variant + property)}`;
|
|
1004
1021
|
}
|
|
1005
1022
|
function isElementSelector(selector = "") {
|
|
1006
|
-
return isCombinatorSelector(selector) ||
|
|
1023
|
+
return isCombinatorSelector(selector) || isPseudoElementSelector(selector) || selector === "&";
|
|
1007
1024
|
}
|
|
1008
1025
|
function isCombinatorSelector(selector = "") {
|
|
1009
1026
|
return isChildSelector(selector) || /(.+)\s\&/.test(selector);
|
|
1010
1027
|
}
|
|
1028
|
+
function isPseudoElementSelector(selector = "") {
|
|
1029
|
+
return /::/.test(selector);
|
|
1030
|
+
}
|
|
1011
1031
|
function isChildSelector(selector = "") {
|
|
1012
1032
|
return /&\s(.+)/.test(selector);
|
|
1013
1033
|
}
|
|
@@ -1034,7 +1054,7 @@ function getParsedSelectors(propertySelector, selectorConfig, elementSelectors)
|
|
|
1034
1054
|
|
|
1035
1055
|
// package.json
|
|
1036
1056
|
var package_default = {
|
|
1037
|
-
version: "0.0.
|
|
1057
|
+
version: "0.0.87"};
|
|
1038
1058
|
|
|
1039
1059
|
// src/ts-plugin/error-codes.ts
|
|
1040
1060
|
var INVALID_PROPERTY = 2353;
|
|
@@ -1114,7 +1134,7 @@ var TokenamiDiagnostics = class {
|
|
|
1114
1134
|
}
|
|
1115
1135
|
if (ts.isObjectLiteralExpression(value)) {
|
|
1116
1136
|
return this.#validateComposeConfig(value, sourceFile);
|
|
1117
|
-
} else if (value.getText().length > 0 && !ts.isIdentifier(key) && !ts.isStringLiteral(value) && !ts.isNumericLiteral(value) && !(ts.isPrefixUnaryExpression(value) && value.operator === ts.SyntaxKind.MinusToken && ts.isNumericLiteral(value.operand))) {
|
|
1137
|
+
} else if (value.getText(sourceFile).length > 0 && !ts.isIdentifier(key) && !ts.isStringLiteral(value) && !ts.isNumericLiteral(value) && !(ts.isPrefixUnaryExpression(value) && value.operator === ts.SyntaxKind.MinusToken && ts.isNumericLiteral(value.operand))) {
|
|
1118
1138
|
const start = value.getStart(sourceFile);
|
|
1119
1139
|
const length = value.getWidth(sourceFile);
|
|
1120
1140
|
return [{ ...diagnostic, start, length }];
|
package/dist/index.cjs
CHANGED
|
@@ -123,7 +123,7 @@ var TokenamiDiagnostics = class {
|
|
|
123
123
|
}
|
|
124
124
|
if (ts__default.default.isObjectLiteralExpression(value)) {
|
|
125
125
|
return this.#validateComposeConfig(value, sourceFile);
|
|
126
|
-
} else if (value.getText().length > 0 && !ts__default.default.isIdentifier(key) && !ts__default.default.isStringLiteral(value) && !ts__default.default.isNumericLiteral(value) && !(ts__default.default.isPrefixUnaryExpression(value) && value.operator === ts__default.default.SyntaxKind.MinusToken && ts__default.default.isNumericLiteral(value.operand))) {
|
|
126
|
+
} else if (value.getText(sourceFile).length > 0 && !ts__default.default.isIdentifier(key) && !ts__default.default.isStringLiteral(value) && !ts__default.default.isNumericLiteral(value) && !(ts__default.default.isPrefixUnaryExpression(value) && value.operator === ts__default.default.SyntaxKind.MinusToken && ts__default.default.isNumericLiteral(value.operand))) {
|
|
127
127
|
const start = value.getStart(sourceFile);
|
|
128
128
|
const length = value.getWidth(sourceFile);
|
|
129
129
|
return [{ ...diagnostic, start, length }];
|
package/dist/index.js
CHANGED
|
@@ -99,7 +99,7 @@ var TokenamiDiagnostics = class {
|
|
|
99
99
|
}
|
|
100
100
|
if (ts.isObjectLiteralExpression(value)) {
|
|
101
101
|
return this.#validateComposeConfig(value, sourceFile);
|
|
102
|
-
} else if (value.getText().length > 0 && !ts.isIdentifier(key) && !ts.isStringLiteral(value) && !ts.isNumericLiteral(value) && !(ts.isPrefixUnaryExpression(value) && value.operator === ts.SyntaxKind.MinusToken && ts.isNumericLiteral(value.operand))) {
|
|
102
|
+
} else if (value.getText(sourceFile).length > 0 && !ts.isIdentifier(key) && !ts.isStringLiteral(value) && !ts.isNumericLiteral(value) && !(ts.isPrefixUnaryExpression(value) && value.operator === ts.SyntaxKind.MinusToken && ts.isNumericLiteral(value.operand))) {
|
|
103
103
|
const start = value.getStart(sourceFile);
|
|
104
104
|
const length = value.getWidth(sourceFile);
|
|
105
105
|
return [{ ...diagnostic, start, length }];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokenami",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.88",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@stitches/stringify": "^1.2.8",
|
|
48
|
-
"@tokenami/config": "0.0.
|
|
49
|
-
"@tokenami/ds": "0.0.
|
|
48
|
+
"@tokenami/config": "0.0.88",
|
|
49
|
+
"@tokenami/ds": "0.0.88",
|
|
50
50
|
"acorn": "^8.11.3",
|
|
51
51
|
"acorn-walk": "^8.3.2",
|
|
52
52
|
"browserslist": "^4.24.4",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"typescript": ">= 5"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "59517a01e2d410298f97cc9157ca92f7f5024712"
|
|
71
71
|
}
|