@teleporthq/teleport-plugin-react-jss 0.18.0
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 +21 -0
- package/README.md +14 -0
- package/__tests__/component-referenced.ts +88 -0
- package/__tests__/index.ts +57 -0
- package/__tests__/mocks.ts +35 -0
- package/__tests__/referenced-styles.ts +118 -0
- package/__tests__/style-sheet.ts +122 -0
- package/dist/cjs/index.d.ts +14 -0
- package/dist/cjs/index.js +247 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/style-sheet.d.ts +6 -0
- package/dist/cjs/style-sheet.js +129 -0
- package/dist/cjs/style-sheet.js.map +1 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/dist/cjs/utils.d.ts +12 -0
- package/dist/cjs/utils.js +93 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/index.d.ts +14 -0
- package/dist/esm/index.js +224 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/style-sheet.d.ts +6 -0
- package/dist/esm/style-sheet.js +106 -0
- package/dist/esm/style-sheet.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/utils.d.ts +12 -0
- package/dist/esm/utils.js +67 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +33 -0
- package/src/index.ts +302 -0
- package/src/style-sheet.ts +97 -0
- package/src/utils.ts +111 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
teleport-plugin-react-jss
|
|
4
|
+
|
|
5
|
+
Plugin is responsible for generating styles from
|
|
6
|
+
- Styles defined on individual nodes.
|
|
7
|
+
- Styles defined in the project's global stylesheet.
|
|
8
|
+
- Styles present in the component style sheeet.
|
|
9
|
+
*/
|
|
10
|
+
var __assign = (this && this.__assign) || function () {
|
|
11
|
+
__assign = Object.assign || function(t) {
|
|
12
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
13
|
+
s = arguments[i];
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
return __assign.apply(this, arguments);
|
|
20
|
+
};
|
|
21
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
50
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
51
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
52
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
53
|
+
function step(op) {
|
|
54
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
55
|
+
while (_) try {
|
|
56
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
57
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
58
|
+
switch (op[0]) {
|
|
59
|
+
case 0: case 1: t = op; break;
|
|
60
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
61
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
62
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
63
|
+
default:
|
|
64
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
65
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
66
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
67
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
68
|
+
if (t[2]) _.ops.pop();
|
|
69
|
+
_.trys.pop(); continue;
|
|
70
|
+
}
|
|
71
|
+
op = body.call(thisArg, _);
|
|
72
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
73
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
|
+
exports.createStyleSheetPlugin = exports.createReactJSSPlugin = void 0;
|
|
78
|
+
var types = __importStar(require("@babel/types"));
|
|
79
|
+
var teleport_shared_1 = require("@teleporthq/teleport-shared");
|
|
80
|
+
var teleport_plugin_common_1 = require("@teleporthq/teleport-plugin-common");
|
|
81
|
+
var teleport_types_1 = require("@teleporthq/teleport-types");
|
|
82
|
+
var utils_1 = require("./utils");
|
|
83
|
+
var style_sheet_1 = require("./style-sheet");
|
|
84
|
+
Object.defineProperty(exports, "createStyleSheetPlugin", { enumerable: true, get: function () { return style_sheet_1.createStyleSheetPlugin; } });
|
|
85
|
+
var EXPORT_IDENTIFIER = 'createUseStyles';
|
|
86
|
+
var createReactJSSPlugin = function (config) {
|
|
87
|
+
var _a = config || {}, _b = _a.componentChunkName, componentChunkName = _b === void 0 ? 'jsx-component' : _b, _c = _a.importChunkName, importChunkName = _c === void 0 ? 'import-local' : _c, _d = _a.styleChunkName, styleChunkName = _d === void 0 ? 'jss-style-definition' : _d, _e = _a.jssDeclarationName, jssDeclarationName = _e === void 0 ? 'useStyles' : _e, _f = _a.classAttributeName, classAttributeName = _f === void 0 ? 'className' : _f, _g = _a.styleObjectImportName, styleObjectImportName = _g === void 0 ? 'classes' : _g;
|
|
88
|
+
var reactJSSPlugin = function (structure) { return __awaiter(void 0, void 0, void 0, function () {
|
|
89
|
+
var uidl, chunks, dependencies, options, projectStyleSet, node, _a, componentStyleSheet, componentChunk, jssStyleMap, mediaStyles, tokensUsed, propsPrefix, jsxNodesLookup, isProjectReferenced, propsUsed, astContent, parser, astNode, isPropsInjected;
|
|
90
|
+
var _b;
|
|
91
|
+
return __generator(this, function (_c) {
|
|
92
|
+
uidl = structure.uidl, chunks = structure.chunks, dependencies = structure.dependencies, options = structure.options;
|
|
93
|
+
projectStyleSet = options.projectStyleSet;
|
|
94
|
+
node = uidl.node, _a = uidl.styleSetDefinitions, componentStyleSheet = _a === void 0 ? {} : _a;
|
|
95
|
+
componentChunk = chunks.find(function (chunkItem) { return chunkItem.name === componentChunkName; });
|
|
96
|
+
if (!componentChunk) {
|
|
97
|
+
return [2 /*return*/, structure];
|
|
98
|
+
}
|
|
99
|
+
jssStyleMap = {};
|
|
100
|
+
mediaStyles = {};
|
|
101
|
+
tokensUsed = [];
|
|
102
|
+
propsPrefix = componentChunk.meta.dynamicRefPrefix.prop;
|
|
103
|
+
jsxNodesLookup = componentChunk.meta.nodesLookup || {};
|
|
104
|
+
isProjectReferenced = false;
|
|
105
|
+
propsUsed = [];
|
|
106
|
+
teleport_shared_1.UIDLUtils.traverseElements(node, function (element) {
|
|
107
|
+
var style = element.style, key = element.key, referencedStyles = element.referencedStyles;
|
|
108
|
+
if (!style && !referencedStyles) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
var jsxTag = jsxNodesLookup[key];
|
|
112
|
+
if (!jsxTag) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
var className = teleport_shared_1.StringUtils.camelCaseToDashCase(key);
|
|
116
|
+
var classNamesToAppend = new Set();
|
|
117
|
+
var nodeStyleIdentifier = types.memberExpression(types.identifier(styleObjectImportName), types.identifier("'" + className + "'"), true);
|
|
118
|
+
if (Object.keys(style || {}).length > 0) {
|
|
119
|
+
jssStyleMap[className] = utils_1.generateStylesFromStyleObj(style, tokensUsed, propsUsed);
|
|
120
|
+
classNamesToAppend.add(nodeStyleIdentifier);
|
|
121
|
+
}
|
|
122
|
+
if (referencedStyles && Object.keys(referencedStyles || {}).length > 0) {
|
|
123
|
+
Object.values(referencedStyles).forEach(function (styleRef) {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
switch (styleRef.content.mapType) {
|
|
126
|
+
case 'inlined': {
|
|
127
|
+
var conditions = styleRef.content.conditions;
|
|
128
|
+
var condition = conditions[0];
|
|
129
|
+
if (Object.keys(styleRef.content.styles || {}).length === 0) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (condition.conditionType === 'screen-size') {
|
|
133
|
+
mediaStyles[condition.maxWidth] = __assign(__assign({}, mediaStyles[condition.maxWidth]), (_a = {}, _a[className] = utils_1.generateStylesFromStyleObj(styleRef.content.styles, tokensUsed, propsUsed), _a));
|
|
134
|
+
}
|
|
135
|
+
if (condition.conditionType === 'element-state') {
|
|
136
|
+
jssStyleMap[className] = __assign(__assign({}, jssStyleMap[className]), (_b = {}, _b["&:" + condition.content] = utils_1.generateStylesFromStyleObj(styleRef.content.styles, tokensUsed, propsUsed), _b));
|
|
137
|
+
}
|
|
138
|
+
classNamesToAppend.add(nodeStyleIdentifier);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
case 'component-referenced': {
|
|
142
|
+
var classContent = styleRef.content.content;
|
|
143
|
+
if (classContent.type === 'static') {
|
|
144
|
+
classNamesToAppend.add(types.identifier("'" + classContent.content + "'"));
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (classContent.type === 'dynamic' &&
|
|
148
|
+
classContent.content.referenceType === 'prop') {
|
|
149
|
+
classNamesToAppend.add(types.memberExpression(types.identifier(styleObjectImportName), types.memberExpression(types.identifier(propsPrefix), types.identifier(classContent.content.id)), true));
|
|
150
|
+
}
|
|
151
|
+
if (classContent.type === 'dynamic' &&
|
|
152
|
+
classContent.content.referenceType === 'comp') {
|
|
153
|
+
classNamesToAppend.add(types.memberExpression(types.identifier(styleObjectImportName), types.identifier("'" + classContent.content.id + "'"), true));
|
|
154
|
+
}
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
case 'project-referenced': {
|
|
158
|
+
if (!projectStyleSet) {
|
|
159
|
+
throw new teleport_types_1.PluginReactJSS("Project Style Sheet is missing, but the node is referring to it " + JSON.stringify(element, null, 2));
|
|
160
|
+
}
|
|
161
|
+
var content = styleRef.content;
|
|
162
|
+
var referedStyle = projectStyleSet.styleSetDefinitions[content.referenceId];
|
|
163
|
+
if (!referedStyle) {
|
|
164
|
+
throw new teleport_types_1.PluginReactJSS("Style used from global stylesheet is missing - " + content.referenceId);
|
|
165
|
+
}
|
|
166
|
+
classNamesToAppend.add(types.memberExpression(types.identifier('projectStyles'), types.identifier("'" + content.referenceId + "'"), true));
|
|
167
|
+
isProjectReferenced = true;
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
default: {
|
|
171
|
+
throw new teleport_types_1.PluginReactJSS("\n We support only inlined and project-referenced styles as of now, received " + JSON.stringify(styleRef.content, null, 2) + "\n ");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
teleport_plugin_common_1.ASTUtils.addMultipleDynamicAttributesToJSXTag(jsxTag, classAttributeName, Array.from(classNamesToAppend));
|
|
177
|
+
});
|
|
178
|
+
if (Object.keys(componentStyleSheet).length > 0) {
|
|
179
|
+
utils_1.generateStylesFromStyleSetDefinitions({
|
|
180
|
+
styleSetDefinitions: componentStyleSheet,
|
|
181
|
+
styleSet: jssStyleMap,
|
|
182
|
+
mediaStyles: mediaStyles,
|
|
183
|
+
tokensUsed: tokensUsed,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
astContent = componentChunk.content;
|
|
187
|
+
parser = new teleport_plugin_common_1.ParsedASTNode(astContent);
|
|
188
|
+
astNode = parser.ast
|
|
189
|
+
.declarations[0];
|
|
190
|
+
if (astNode.type === 'VariableDeclarator') {
|
|
191
|
+
isPropsInjected = (_b = astNode.init.params) === null || _b === void 0 ? void 0 : _b.some(function (prop) { return prop.name === propsPrefix; });
|
|
192
|
+
if (!isPropsInjected && propsUsed.length > 0) {
|
|
193
|
+
;
|
|
194
|
+
astNode.init.params.push(types.identifier(propsPrefix));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (tokensUsed.length > 0) {
|
|
198
|
+
dependencies.TOKENS = {
|
|
199
|
+
type: 'local',
|
|
200
|
+
path: "" + projectStyleSet.path + projectStyleSet.fileName,
|
|
201
|
+
meta: {
|
|
202
|
+
namedImport: true,
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
if (isProjectReferenced) {
|
|
207
|
+
dependencies.useProjectStyles = {
|
|
208
|
+
type: 'local',
|
|
209
|
+
path: "" + projectStyleSet.path + projectStyleSet.fileName,
|
|
210
|
+
meta: {
|
|
211
|
+
namedImport: true,
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
astNode.init.body.body.unshift(utils_1.createStylesHookDecleration('projectStyles', 'useProjectStyles'));
|
|
215
|
+
}
|
|
216
|
+
if (!Object.keys(jssStyleMap).length && !Object.keys(mediaStyles).length) {
|
|
217
|
+
return [2 /*return*/, structure];
|
|
218
|
+
}
|
|
219
|
+
;
|
|
220
|
+
astNode.init.body.body.unshift(propsUsed.length > 0
|
|
221
|
+
? utils_1.createStylesHookDecleration(styleObjectImportName, 'useStyles', propsPrefix)
|
|
222
|
+
: utils_1.createStylesHookDecleration(styleObjectImportName, 'useStyles'));
|
|
223
|
+
dependencies[EXPORT_IDENTIFIER] = {
|
|
224
|
+
type: 'package',
|
|
225
|
+
path: 'react-jss',
|
|
226
|
+
version: '10.4.0',
|
|
227
|
+
meta: {
|
|
228
|
+
namedImport: true,
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
chunks.push({
|
|
232
|
+
type: teleport_types_1.ChunkType.AST,
|
|
233
|
+
fileType: teleport_types_1.FileType.JS,
|
|
234
|
+
name: styleChunkName,
|
|
235
|
+
linkAfter: [importChunkName],
|
|
236
|
+
content: teleport_plugin_common_1.ASTBuilders.createConstAssignment(jssDeclarationName, types.callExpression(types.identifier(EXPORT_IDENTIFIER), [
|
|
237
|
+
utils_1.convertMediaAndStylesToObject(jssStyleMap, mediaStyles),
|
|
238
|
+
])),
|
|
239
|
+
});
|
|
240
|
+
return [2 /*return*/, structure];
|
|
241
|
+
});
|
|
242
|
+
}); };
|
|
243
|
+
return reactJSSPlugin;
|
|
244
|
+
};
|
|
245
|
+
exports.createReactJSSPlugin = createReactJSSPlugin;
|
|
246
|
+
exports.default = exports.createReactJSSPlugin();
|
|
247
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;EAOE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,kDAAqC;AACrC,+DAAoE;AACpE,6EAAyF;AACzF,6DAMmC;AACnC,iCAKgB;AAChB,6CAAsD;AAkR7C,uGAlRA,oCAAsB,OAkRA;AAxQ/B,IAAM,iBAAiB,GAAG,iBAAiB,CAAA;AAEpC,IAAM,oBAAoB,GAAsC,UAAC,MAAM;IACtE,IAAA,KAOF,MAAM,IAAI,EAAE,EANd,0BAAoC,EAApC,kBAAkB,mBAAG,eAAe,KAAA,EACpC,uBAAgC,EAAhC,eAAe,mBAAG,cAAc,KAAA,EAChC,sBAAuC,EAAvC,cAAc,mBAAG,sBAAsB,KAAA,EACvC,0BAAgC,EAAhC,kBAAkB,mBAAG,WAAW,KAAA,EAChC,0BAAgC,EAAhC,kBAAkB,mBAAG,WAAW,KAAA,EAChC,6BAAiC,EAAjC,qBAAqB,mBAAG,SAAS,KACnB,CAAA;IAEhB,IAAM,cAAc,GAAoB,UAAO,SAAS;;;;YAC9C,IAAI,GAAoC,SAAS,KAA7C,EAAE,MAAM,GAA4B,SAAS,OAArC,EAAE,YAAY,GAAc,SAAS,aAAvB,EAAE,OAAO,GAAK,SAAS,QAAd,CAAc;YACjD,eAAe,GAAK,OAAO,gBAAZ,CAAY;YAC3B,IAAI,GAAoD,IAAI,KAAxD,EAAE,KAAkD,IAAI,oBAAT,EAAxB,mBAAmB,mBAAG,EAAE,KAAA,CAAS;YAE9D,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,UAAC,SAA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AY,CAAC,iBAAiB,CAAC,GAAG;gBAChC,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAE;oBACJ,WAAW,EAAE,IAAI;iBAClB;aACF,CAAA;YAED,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,0BAAS,CAAC,GAAG;gBACnB,QAAQ,EAAE,yBAAQ,CAAC,EAAE;gBACrB,IAAI,EAAE,cAAc;gBACpB,SAAS,EAAE,CAAC,eAAe,CAAC;gBAC5B,OAAO,EAAE,oCAAW,CAAC,qBAAqB,CACxC,kBAAkB,EAClB,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;oBACxD,qCAA6B,CAAC,WAAW,EAAE,WAAW,CAAC;iBACxD,CAAC,CACH;aACF,CAAC,CAAA;YAEF,sBAAO,SAAS,EAAA;;SACjB,CAAA;IAED,OAAO,cAAc,CAAA;AACvB,CAAC,CAAA;AApQY,QAAA,oBAAoB,wBAoQhC;AAID,kBAAe,4BAAoB,EAAE,CAAA"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
31
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
32
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
33
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
|
+
function step(op) {
|
|
35
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
+
while (_) try {
|
|
37
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
38
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
|
+
switch (op[0]) {
|
|
40
|
+
case 0: case 1: t = op; break;
|
|
41
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
42
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
43
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
44
|
+
default:
|
|
45
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
46
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
47
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49
|
+
if (t[2]) _.ops.pop();
|
|
50
|
+
_.trys.pop(); continue;
|
|
51
|
+
}
|
|
52
|
+
op = body.call(thisArg, _);
|
|
53
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
54
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
exports.createStyleSheetPlugin = void 0;
|
|
59
|
+
var types = __importStar(require("@babel/types"));
|
|
60
|
+
var teleport_plugin_common_1 = require("@teleporthq/teleport-plugin-common");
|
|
61
|
+
var teleport_types_1 = require("@teleporthq/teleport-types");
|
|
62
|
+
var teleport_shared_1 = require("@teleporthq/teleport-shared");
|
|
63
|
+
var utils_1 = require("./utils");
|
|
64
|
+
var createStyleSheetPlugin = function (config) {
|
|
65
|
+
var fileName = (config || { fileName: 'style' }).fileName;
|
|
66
|
+
var styleSheetPlugin = function (structure) { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var uidl, chunks, dependencies, _a, styleSetDefinitions, _b, _c, _d, tokens, tokensMap, styleSet, mediaStyles;
|
|
68
|
+
return __generator(this, function (_e) {
|
|
69
|
+
uidl = structure.uidl, chunks = structure.chunks, dependencies = structure.dependencies;
|
|
70
|
+
_a = uidl.styleSetDefinitions, styleSetDefinitions = _a === void 0 ? {} : _a, _b = uidl.designLanguage, _c = _b === void 0 ? {} : _b, _d = _c.tokens, tokens = _d === void 0 ? {} : _d;
|
|
71
|
+
if (Object.keys(styleSetDefinitions).length === 0 && Object.keys(tokens).length === 0) {
|
|
72
|
+
return [2 /*return*/, structure];
|
|
73
|
+
}
|
|
74
|
+
tokensMap = Object.keys(tokens || {}).reduce(function (acc, key) {
|
|
75
|
+
var style = tokens[key];
|
|
76
|
+
var name = teleport_shared_1.StringUtils.capitalize(teleport_shared_1.StringUtils.dashCaseToCamelCase(key));
|
|
77
|
+
acc[name] = style.content;
|
|
78
|
+
return acc;
|
|
79
|
+
}, {});
|
|
80
|
+
styleSet = {};
|
|
81
|
+
mediaStyles = {};
|
|
82
|
+
if (Object.keys(styleSetDefinitions).length > 0) {
|
|
83
|
+
utils_1.generateStylesFromStyleSetDefinitions({
|
|
84
|
+
styleSetDefinitions: styleSetDefinitions,
|
|
85
|
+
styleSet: styleSet,
|
|
86
|
+
mediaStyles: mediaStyles,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
uidl.outputOptions = uidl.outputOptions || {};
|
|
90
|
+
uidl.outputOptions.fileName = fileName;
|
|
91
|
+
dependencies.createUseStyles = {
|
|
92
|
+
type: 'package',
|
|
93
|
+
path: 'react-jss',
|
|
94
|
+
version: '10.4.0',
|
|
95
|
+
meta: {
|
|
96
|
+
namedImport: true,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
if (Object.keys(tokens).length > 0) {
|
|
100
|
+
chunks.push({
|
|
101
|
+
name: 'tokens-chunk',
|
|
102
|
+
type: teleport_types_1.ChunkType.AST,
|
|
103
|
+
fileType: teleport_types_1.FileType.JS,
|
|
104
|
+
content: types.exportNamedDeclaration(types.variableDeclaration('const', [
|
|
105
|
+
types.variableDeclarator(types.identifier('TOKENS'), teleport_plugin_common_1.ASTUtils.objectToObjectExpression(tokensMap)),
|
|
106
|
+
])),
|
|
107
|
+
linkAfter: ['import-local'],
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
if (Object.keys(styleSet).length > 0) {
|
|
111
|
+
chunks.push({
|
|
112
|
+
name: fileName,
|
|
113
|
+
type: teleport_types_1.ChunkType.AST,
|
|
114
|
+
fileType: teleport_types_1.FileType.JS,
|
|
115
|
+
content: types.exportNamedDeclaration(types.variableDeclaration('const', [
|
|
116
|
+
types.variableDeclarator(types.identifier('useProjectStyles'), types.callExpression(types.identifier('createUseStyles'), [
|
|
117
|
+
utils_1.convertMediaAndStylesToObject(styleSet, mediaStyles),
|
|
118
|
+
])),
|
|
119
|
+
])),
|
|
120
|
+
linkAfter: ['tokens-chunk'],
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return [2 /*return*/, structure];
|
|
124
|
+
});
|
|
125
|
+
}); };
|
|
126
|
+
return styleSheetPlugin;
|
|
127
|
+
};
|
|
128
|
+
exports.createStyleSheetPlugin = createStyleSheetPlugin;
|
|
129
|
+
//# sourceMappingURL=style-sheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-sheet.js","sourceRoot":"","sources":["../../src/style-sheet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAqC;AACrC,6EAA6D;AAC7D,6DAKmC;AACnC,+DAAyD;AACzD,iCAA8F;AAMvF,IAAM,sBAAsB,GAA6C,UAAC,MAAM;IAC7E,IAAA,QAAQ,GAAK,CAAA,MAAM,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA,SAApC,CAAoC;IACpD,IAAM,gBAAgB,GAAoB,UAAO,SAAS;;;YAChD,IAAI,GAA2B,SAAS,KAApC,EAAE,MAAM,GAAmB,SAAS,OAA5B,EAAE,YAAY,GAAK,SAAS,aAAd,CAAc;YACxC,KAAmE,IAAI,oBAA/C,EAAxB,mBAAmB,mBAAG,EAAE,KAAA,EAAE,KAAyC,IAAI,eAAT,EAApC,qBAAkC,EAAE,KAAA,EAAlB,cAA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ib.es2015.d.ts","../../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../../node_modules/@babel/types/lib/index.d.ts","../../../teleport-types/dist/cjs/uidl.d.ts","../../../teleport-types/dist/cjs/generators.d.ts","../../../teleport-types/dist/cjs/errors.d.ts","../../../teleport-types/dist/cjs/vuidl.d.ts","../../../teleport-types/dist/cjs/index.d.ts","../../../teleport-shared/dist/cjs/constants/index.d.ts","../../../teleport-shared/dist/cjs/utils/string-utils.d.ts","../../../teleport-shared/dist/cjs/utils/uidl-utils.d.ts","../../../teleport-shared/dist/cjs/index.d.ts","../../../teleport-plugin-common/dist/cjs/builders/ast-builders.d.ts","../../../teleport-plugin-common/dist/cjs/utils/parsed-ast.d.ts","../../../teleport-plugin-common/dist/cjs/builders/style-builders.d.ts","../../../teleport-plugin-common/dist/cjs/builders/hast-builders.d.ts","../../../teleport-plugin-common/dist/cjs/utils/ast-utils.d.ts","../../../teleport-plugin-common/dist/cjs/utils/style-utils.d.ts","../../../teleport-plugin-common/dist/cjs/utils/hast-utils.d.ts","../../../teleport-plugin-common/dist/cjs/node-handlers/node-to-html/types.d.ts","../../../teleport-plugin-common/dist/cjs/node-handlers/node-to-html/index.d.ts","../../../teleport-plugin-common/dist/cjs/node-handlers/node-to-jsx/types.d.ts","../../../teleport-plugin-common/dist/cjs/node-handlers/node-to-jsx/index.d.ts","../../../teleport-plugin-common/dist/cjs/index.d.ts","../../src/utils.ts","../../src/style-sheet.ts","../../src/index.ts","../../../../node_modules/@types/node/assert/strict.d.ts","../../../../node_modules/@types/node/globals.d.ts","../../../../node_modules/@types/node/async_hooks.d.ts","../../../../node_modules/@types/node/buffer.d.ts","../../../../node_modules/@types/node/child_process.d.ts","../../../../node_modules/@types/node/cluster.d.ts","../../../../node_modules/@types/node/console.d.ts","../../../../node_modules/@types/node/constants.d.ts","../../../../node_modules/@types/node/crypto.d.ts","../../../../node_modules/@types/node/dgram.d.ts","../../../../node_modules/@types/node/diagnostic_channel.d.ts","../../../../node_modules/@types/node/dns.d.ts","../../../../node_modules/@types/node/dns/promises.d.ts","../../../../node_modules/@types/node/domain.d.ts","../../../../node_modules/@types/node/events.d.ts","../../../../node_modules/@types/node/fs.d.ts","../../../../node_modules/@types/node/fs/promises.d.ts","../../../../node_modules/@types/node/http.d.ts","../../../../node_modules/@types/node/http2.d.ts","../../../../node_modules/@types/node/https.d.ts","../../../../node_modules/@types/node/inspector.d.ts","../../../../node_modules/@types/node/module.d.ts","../../../../node_modules/@types/node/net.d.ts","../../../../node_modules/@types/node/os.d.ts","../../../../node_modules/@types/node/path.d.ts","../../../../node_modules/@types/node/perf_hooks.d.ts","../../../../node_modules/@types/node/process.d.ts","../../../../node_modules/@types/node/punycode.d.ts","../../../../node_modules/@types/node/querystring.d.ts","../../../../node_modules/@types/node/readline.d.ts","../../../../node_modules/@types/node/repl.d.ts","../../../../node_modules/@types/node/stream.d.ts","../../../../node_modules/@types/node/stream/promises.d.ts","../../../../node_modules/@types/node/string_decoder.d.ts","../../../../node_modules/@types/node/timers.d.ts","../../../../node_modules/@types/node/timers/promises.d.ts","../../../../node_modules/@types/node/tls.d.ts","../../../../node_modules/@types/node/trace_events.d.ts","../../../../node_modules/@types/node/tty.d.ts","../../../../node_modules/@types/node/url.d.ts","../../../../node_modules/@types/node/util.d.ts","../../../../node_modules/@types/node/util/types.d.ts","../../../../node_modules/@types/node/v8.d.ts","../../../../node_modules/@types/node/vm.d.ts","../../../../node_modules/@types/node/worker_threads.d.ts","../../../../node_modules/@types/node/zlib.d.ts","../../../../node_modules/@types/node/globals.global.d.ts","../../../../node_modules/@types/node/wasi.d.ts","../../../../node_modules/@types/node/ts3.6/base.d.ts","../../../../node_modules/@types/node/assert.d.ts","../../../../node_modules/@types/node/base.d.ts","../../../../node_modules/@types/node/index.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/types.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/diffLines.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/printDiffs.d.ts","../../../../node_modules/@types/jest/node_modules/jest-diff/build/index.d.ts","../../../../node_modules/@types/jest/node_modules/pretty-format/build/types.d.ts","../../../../node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","../../../../node_modules/@types/jest/index.d.ts","../../../../node_modules/@types/jest/ts3.2/index.d.ts"],"fileInfos":[{"version":"ac3a8c4040e183ce38da69d23b96939112457d1936198e6542672b7963cf0fce","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06",{"version":"1dad4fe1561d99dfd6709127608b99a76e5c2643626c800434f99c48038567ee","affectsGlobalScope":true},{"version":"cce43d02223f8049864f8568bed322c39424013275cd3bcc3f51492d8b546cb3","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"8dff1b4c2df638fcd976cbb0e636f23ab5968e836cd45084cc31d47d1ab19c49","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"8f4c9f651c8294a2eb1cbd12581fe25bfb901ab1d474bb93cd38c7e2f4be7a30","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"60761e6ea886034af0f294f025a7199360ce4e2c8ba4ec6408bc049cf9b89799","affectsGlobalScope":true},{"version":"506b80b9951c9381dc5f11897b31fca5e2a65731d96ddefa19687fbc26b23c6e","affectsGlobalScope":true},"a17ba25a194979a88bfd925e849d76b63f68c4160b69a99c5d723eac5ffddaf0","d1e076bd03d792a96993f458172927e0c5ac3cb8e1b566f54f925e6ef19bbebb","6a55786dc1b8e3c25bc00e1700a7eb297e20bccae7d4bb5e4a020b97daa2052f","eccf9c0b6e420c47b3e3eb87e8f0dc9df312a9583a6cce96756b18ebff176b70","75ecadee387dde7be130c85ed277fdfcee3923e452260ffaf217ebaefe7bd305","cd619820771edb23926bb084906215ab9c491255fa707488d15748b38909b747","28b22326000119f53de35f67ce3096ef475a2224274162b1283ef8718e1efdb5","18aecf77d74ed15ae1e875a0d43f2aa85387794fc447b2bc3c8ab7e2224d0ac6","fcd80368105181b1be66006da7c16a58ed993845e7b37d33302387f18e889001","d2ff55204dd4868d11a163c207d4fbe8d99cbf8cb36fa90d2a2f0bfc802b4d38","b0900ff47d065c568038fc21d06685e58b7932750f22c49bb5cc4c18bdd35aa3","634d90459c22c0d82376bd48246b99b4a33fe56bc94c15874d1dac1e8a577d75","d31e0e12717950d419acb7b2337e6d413055ea58b2457353fa6886e833e13253","cb33f5a5c73598b92f9aa13a0cf4d0df2dc38f05da11e4ad2fd8f0a735b3b09e","822be0f43855257db7fdf49aa362cc47fa9101b482fad0a6291ca914670ba6d2","cf4ba36b05e7a6194696ffcace1710d29bb681b77a20b9b09460707ea3fcecd5","79fb51af7dc378dfaa66da7791d2c91560a151fa74da9f466d9fb60f5f9ccb39","c84d0840044a735055b7911998976dab071cde1ee160f551f2d845aea5630e2e","3465b9608c725b6a4c35b154f636011da24525a137d73976f1222c624cd9ce40","3594cd8018f215116e41c6f05c6fc9e6845a60c74753cdd1a9521d52f9ac0f2a","50ffd0c3b71cdca0f2c5004b39d876a494648c953079f07d257d679a7b95d40a","0772ec3b64f51bbe952d514e28b9aa3355a5322d1c242d93b3e67292dc7bae7c","f04e50bceae96802c35ad23eb63fece282aa91517f4c115d69684c9b52483216","8b14983b08f4c83e9e945cbbb6f6226514760e99cc978eac091b6dae547773e4","a00f7fa3781a50b0d27ff01373c5280ffe2037e872608e30101197bc2995ffe6","c7bdc99177a2a94d25fb13722adaaf5b3291bf70b4d1b27584ba189dd3889ba3",{"version":"d1c92b66c4105659fcad4eb76a1481f7311033e117d0678a1ec545e8ddb8d4c6","affectsGlobalScope":true},"e23424b97418eca3226fd24de079f1203eb70360622e4e093af2aff14d4be6ec","dee93c07b4df5e26010dc9ec4cdf4d6e4076bb4474d2a8371529217c8b2740a4","d55bc773f71c50f55decb39b64a5d8b9889a7c9e94305b36656ebf30e4f47469","04eaa93bd75f937f9184dcb95a7983800c5770cf8ddd8ac0f3734dc02f5b20ef",{"version":"c8155caf28fc7b0a564156a5df28ad8a844a3bd32d331d148d8f3ce88025c870","affectsGlobalScope":true},"45ac321f2e15d268fd74a90ddaa6467dcaaff2c5b13f95b4b85831520fb7a491","dfc747ab8dd5f623055a4c26fd35e8cceca869fd3f1cf09701c941ca3679665a","c9f5f2920ff61d7158417b8440d5181ddc34a3dfef811a5677dd8a9fb91471e9","5cc0a492da3602510b8f5ed1852b1e0390002780d8758fbc8c0cd023ca7085f8","ec7dafafe751a5121f8f1c80201ebe7e7238c47e6329280a73c4d1ca4bb7fa28","64debeb10e4b7ae4ec9e89bfb4e04c6101ab98c3cc806d14e5488607cfec2753",{"version":"2866a528b2708aa272ec3eaafd3c980abb23aec1ef831cfc5eb2186b98c37ce5","affectsGlobalScope":true},{"version":"a5782d6cea81fe43d2db7ed41e789458c933ab3ab60602f7b5b14c4da3370496","affectsGlobalScope":true},"b86b7ff709a82ef3cba2184136c025989958bad483ffb13e4ca35d720245adf4","6194335ee3353f7226ba31f31d6301d0c6be87228419c0a08976ccd9d4f1213e","5a173b7da4e6d073f9c18a02f387816a934614e7af306193995935fbb95f10b8","b447e123210c68f205f67b20c996c04a1eb64b0e591c5e06e164cd3d3a869b28","13257840c0850d4ebd7c2b17604a9e006f752de76c2400ebc752bc465c330452","42176966283d3835c34278b9b5c0f470d484c0c0c6a55c20a2c916a1ce69b6e8","0cff7901aedfe78e314f7d44088f07e2afa1b6e4f0473a4169b8456ca2fb245d","c55776aa1db2b963a5fb820c0650362e721cba51ebf83b069696f2501378c0f3","e2236264a811ed1d09a2487a433e8f5216ae62378cf233954ae220cf886f6717","3ec1e108d587a5661ec790db607f482605ba9f3830e118ce578e3ffa3c42e22b","100b3bb9d39d2b1b5340f1bf45a52e94ef1692b45232b4ba00fac5c3cc56d331",{"version":"ec1a29ddaecb683aa360df0bd98ab5d4171d2d549554f7c5ab2a5c183a3dcb67","affectsGlobalScope":true},"7f77304372efe3c9967e5f9ea2061f1b4bf41dc3cda3c83cdd676f2e5af6b7e6","992c6f6be16c0a1d2eec13ece33adeea2c747ba27fcd078353a8f4bb5b4fea58","2597718d91e306949d89e285bf34c44192014ef541c3bd7cbb825c022749e974","a6b0abdb67d63ebe964ba5fee31bc3daf10c12eecd46b24d778426010c04c67e","ac4801ebc2355ba32329070123b1cd15891bf71b41dcaf9e75b4744832126a59","fd2298fba0640e7295e7bd545e2dfbfcccbb00c27019e501c87965a02bbdebf6","4fd3c4debadce3e9ab9dec3eb45f7f5e2e3d4ad65cf975a6d938d883cfb25a50","71ddd49185b68f27bfac127ef5d22cb2672c278e53e5370d9020ef50ca9c377d","b1ea7a6eaa7608e0e0529aebd323b526a79c6c05a4e519ae5c779675004dcdf1","9fcb033a6208485d8f3fadde31eb5cbcaf99149cff3e40c0dc53ebc6d0dff4e9","7df562288f949945cf69c21cd912100c2afedeeb7cdb219085f7f4b46cb7dde4","9d16690485ff1eb4f6fc57aebe237728fd8e03130c460919da3a35f4d9bd97f5","dcc6910d95a3625fd2b0487fda055988e46ab46c357a1b3618c27b4a8dd739c9","f4149f1aa299474c7040a35fe8f8ac2ad078cc1b190415adc1fff3ed52d490ea","3730099ed008776216268a97771de31753ef71e0a7d0ec650f588cba2a06ce44","8d649dbc429d7139a1d9a14ea2bf8af1dc089e0a879447539587463d4b6c248c","60c9e27816ec8ac8df7240598bb086e95b47edfb454c5cbf4003c812e0ed6e39","e361aecf17fc4034b4c122a1564471cdcd22ef3a51407803cb5a5fc020c04d02","4926467de88a92a4fc9971d8c6f21b91eca1c0e7fc2a46cc4638ab9440c73875",{"version":"2708349d5a11a5c2e5f3a0765259ebe7ee00cdcc8161cb9990cb4910328442a1","affectsGlobalScope":true},"fc0ae4a8ad3c762b96f9d2c3700cb879a373458cb0bf3175478e3b4f85f7ef2f","fabbec378e1ddd86fcf2662e716c2b8318acedb664ee3a4cba6f9e8ee8269cf1","b3593bd345ebea5e4d0a894c03251a3774b34df3d6db57075c18e089a599ba76","e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","efd55e8ca79171bf26c0d0e30221cb8ee1f5a31dd0c791ec4b2e886f42bab124","e222104af6cb9415238ad358488b74d76eceeff238c1268ec6e85655b05341da","69da61a7b5093dac77fa3bec8be95dcf9a74c95a0e9161edb98bb24e30e439d2","eba230221317c985ab1953ccc3edc517f248b37db4fef7875cb2c8d08aff7be7","b83e796810e475da3564c6515bc0ae9577070596a33d89299b7d99f94ecfd921","b4439890c168d646357928431100daac5cbdee1d345a34e6bf6eca9f3abe22bc","5d72971a459517c44c1379dab9ed248e87a61ba0a1e0f25c9d67e1e640cd9a09","02d734976af36f4273d930bea88b3e62adf6b078cf120c1c63d49aa8d8427c5c",{"version":"f624e578325b8c58e55b30c998b1f4c3ec1b61a9fa66373da4250c89b7880d44","affectsGlobalScope":true},{"version":"d3002f620eab4bf6476c9da5c0efb2041d46f7df8b3032a5631bd206abef2c75","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"module":1,"noImplicitAny":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","sourceMap":true,"target":1},"fileIdsList":[[110,112],[106,107],[106,107,108,109],[111],[113],[103],[102,103],[57,62],[68,69,76,85],[58,68,76],[94],[62,69,77],[85,90],[65,68,76],[66],[65],[68],[68,70,85,93],[68,69,85],[76,85,93],[68,69,71,76,85,90,93],[71,90,93],[104],[93],[65,68,85],[78],[56],[92],[83,94,97],[68,86],[85],[88],[62,76],[54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101],[76],[82],[95],[57,62,68,70,79,85,93,97],[29,34],[34],[29,34,40],[39,40,41,42,43,44,45,46,47,48,49],[34,46],[29,34,48],[29,34,38,50,51,52],[29,34,38,50,51],[29,34,38,50],[35,36,37],[30],[30,31,32,33]],"referencedMap":[[113,1],[108,2],[110,3],[109,2],[112,4],[114,5],[54,6],[104,7],[57,8],[58,9],[59,10],[60,11],[61,12],[62,13],[63,14],[65,15],[66,16],[67,17],[68,17],[69,18],[70,19],[71,20],[72,21],[73,22],[105,23],[74,17],[75,24],[76,25],[78,26],[79,27],[80,28],[83,17],[84,29],[85,30],[86,31],[88,17],[89,32],[90,33],[102,34],[92,35],[93,36],[94,37],[96,31],[98,38],[99,31],[39,39],[42,40],[41,41],[50,42],[47,43],[46,40],[49,44],[48,39],[43,41],[45,40],[44,40],[53,45],[52,46],[51,47],[35,40],[38,48],[37,40],[31,49],[34,50],[33,49]],"exportedModulesMap":[[113,1],[108,2],[110,3],[109,2],[112,4],[114,5],[54,6],[104,7],[57,8],[58,9],[59,10],[60,11],[61,12],[62,13],[63,14],[65,15],[66,16],[67,17],[68,17],[69,18],[70,19],[71,20],[72,21],[73,22],[105,23],[74,17],[75,24],[76,25],[78,26],[79,27],[80,28],[83,17],[84,29],[85,30],[86,31],[88,17],[89,32],[90,33],[102,34],[92,35],[93,36],[94,37],[96,31],[98,38],[99,31],[39,39],[42,40],[41,41],[50,42],[47,43],[46,40],[49,44],[48,39],[43,41],[45,40],[44,40],[53,45],[52,46],[51,47],[35,40],[38,48],[37,40],[31,49],[34,50],[33,49]],"semanticDiagnosticsPerFile":[29,113,106,108,110,109,107,112,111,114,103,54,56,104,57,58,59,60,61,62,63,64,65,66,67,68,69,70,55,100,71,72,73,105,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,102,92,93,94,95,96,97,101,98,99,6,8,7,2,9,10,11,12,13,14,15,16,3,4,20,17,18,19,21,22,23,5,24,25,26,27,1,28,39,42,41,50,47,46,49,48,43,45,40,44,53,52,51,35,38,36,37,32,31,34,30,33]},"version":"4.3.5"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as types from '@babel/types';
|
|
2
|
+
import { UIDLStyleSetDefinition, UIDLStyleValue } from '@teleporthq/teleport-types';
|
|
3
|
+
export declare const generateStylesFromStyleSetDefinitions: (params: {
|
|
4
|
+
styleSetDefinitions: Record<string, UIDLStyleSetDefinition>;
|
|
5
|
+
styleSet: Record<string, unknown>;
|
|
6
|
+
mediaStyles: Record<string, Record<string, unknown>>;
|
|
7
|
+
tokensUsed?: string[];
|
|
8
|
+
formatClassName?: boolean;
|
|
9
|
+
}) => void;
|
|
10
|
+
export declare const generateStylesFromStyleObj: (style: Record<string, UIDLStyleValue>, tokensUsed?: string[], propsUsed?: string[]) => Record<string, any>;
|
|
11
|
+
export declare const createStylesHookDecleration: (assignee: string, hookName: string, dynamicValueIdentifier?: string) => types.VariableDeclaration;
|
|
12
|
+
export declare const convertMediaAndStylesToObject: (styleSet: Record<string, unknown>, mediaStyles: Record<string, Record<string, unknown>>) => types.ObjectExpression;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.convertMediaAndStylesToObject = exports.createStylesHookDecleration = exports.generateStylesFromStyleObj = exports.generateStylesFromStyleSetDefinitions = void 0;
|
|
34
|
+
var types = __importStar(require("@babel/types"));
|
|
35
|
+
var teleport_shared_1 = require("@teleporthq/teleport-shared");
|
|
36
|
+
var teleport_plugin_common_1 = require("@teleporthq/teleport-plugin-common");
|
|
37
|
+
var generateStylesFromStyleSetDefinitions = function (params) {
|
|
38
|
+
var styleSetDefinitions = params.styleSetDefinitions, styleSet = params.styleSet, tokensUsed = params.tokensUsed, _a = params.formatClassName, formatClassName = _a === void 0 ? false : _a, _b = params.mediaStyles, mediaStyles = _b === void 0 ? {} : _b;
|
|
39
|
+
Object.keys(styleSetDefinitions).forEach(function (styleId) {
|
|
40
|
+
var style = styleSetDefinitions[styleId];
|
|
41
|
+
var className = formatClassName ? teleport_shared_1.StringUtils.dashCaseToCamelCase(styleId) : styleId;
|
|
42
|
+
var _a = style.conditions, conditions = _a === void 0 ? [] : _a, content = style.content;
|
|
43
|
+
styleSet[className] = exports.generateStylesFromStyleObj(content, tokensUsed);
|
|
44
|
+
if (conditions.length > 0) {
|
|
45
|
+
conditions.forEach(function (styleRef) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
if (Object.keys(styleRef.content).length === 0) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (styleRef.type === 'screen-size') {
|
|
51
|
+
mediaStyles[styleRef.meta.maxWidth] = __assign(__assign({}, mediaStyles[styleRef.meta.maxWidth]), (_a = {}, _a[className] = exports.generateStylesFromStyleObj(styleRef.content, tokensUsed), _a));
|
|
52
|
+
}
|
|
53
|
+
if (styleRef.type === 'element-state') {
|
|
54
|
+
styleSet[className] = __assign(__assign({}, (styleSet[className] || {})), (_b = {},
|
|
55
|
+
_b["&:" + styleRef.meta.state] = exports.generateStylesFromStyleObj(styleRef.content, tokensUsed),
|
|
56
|
+
_b));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
exports.generateStylesFromStyleSetDefinitions = generateStylesFromStyleSetDefinitions;
|
|
63
|
+
var generateStylesFromStyleObj = function (style, tokensUsed, propsUsed) {
|
|
64
|
+
return teleport_shared_1.UIDLUtils.transformDynamicStyles(style, function (styleValue) {
|
|
65
|
+
switch (styleValue.content.referenceType) {
|
|
66
|
+
case 'prop':
|
|
67
|
+
propsUsed === null || propsUsed === void 0 ? void 0 : propsUsed.push(styleValue.content.id);
|
|
68
|
+
return new teleport_plugin_common_1.ParsedASTNode(teleport_plugin_common_1.ASTBuilders.createArrowFunctionWithMemberExpression('props', styleValue.content.id));
|
|
69
|
+
case 'token':
|
|
70
|
+
var token = teleport_shared_1.StringUtils.capitalize(teleport_shared_1.StringUtils.dashCaseToCamelCase(styleValue.content.id));
|
|
71
|
+
tokensUsed === null || tokensUsed === void 0 ? void 0 : tokensUsed.push(token);
|
|
72
|
+
return new teleport_plugin_common_1.ParsedASTNode(types.memberExpression(types.identifier('TOKENS'), types.identifier(token)));
|
|
73
|
+
default:
|
|
74
|
+
throw new Error("Error running transformDynamicStyles in reactJSSComponentStyleChunksPlugin. Unsupported styleValue.content.referenceType value " + styleValue.content.referenceType);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
exports.generateStylesFromStyleObj = generateStylesFromStyleObj;
|
|
79
|
+
var createStylesHookDecleration = function (assignee, hookName, dynamicValueIdentifier) {
|
|
80
|
+
return types.variableDeclaration('const', [
|
|
81
|
+
types.variableDeclarator(types.identifier(assignee), types.callExpression(types.identifier(hookName), dynamicValueIdentifier ? [types.identifier(dynamicValueIdentifier)] : [])),
|
|
82
|
+
]);
|
|
83
|
+
};
|
|
84
|
+
exports.createStylesHookDecleration = createStylesHookDecleration;
|
|
85
|
+
var convertMediaAndStylesToObject = function (styleSet, mediaStyles) {
|
|
86
|
+
var styles = teleport_plugin_common_1.ASTUtils.objectToObjectExpression(styleSet);
|
|
87
|
+
Object.keys(mediaStyles).forEach(function (mediaKey) {
|
|
88
|
+
styles.properties.push(types.objectProperty(types.identifier("'@media(max-width: " + mediaKey + "px)'"), teleport_plugin_common_1.ASTUtils.objectToObjectExpression(mediaStyles[mediaKey])));
|
|
89
|
+
}, []);
|
|
90
|
+
return styles;
|
|
91
|
+
};
|
|
92
|
+
exports.convertMediaAndStylesToObject = convertMediaAndStylesToObject;
|
|
93
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAqC;AACrC,+DAAoE;AACpE,6EAAyF;AAGlF,IAAM,qCAAqC,GAAG,UAAC,MAMrD;IAEG,IAAA,mBAAmB,GAKjB,MAAM,oBALW,EACnB,QAAQ,GAIN,MAAM,SAJA,EACR,UAAU,GAGR,MAAM,WAHE,EACV,KAEE,MAAM,gBAFe,EAAvB,eAAe,mBAAG,KAAK,KAAA,EACvB,KACE,MAAM,YADQ,EAAhB,WAAW,mBAAG,EAAE,KAAA,CACR;IACV,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,UAAC,OAAO;QAC/C,IAAM,KAAK,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;QAC1C,IAAM,SAAS,GAAG,eAAe,CAAC,CAAC,CAAC,6BAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;QAC9E,IAAA,KAA6B,KAAK,WAAnB,EAAf,UAAU,mBAAG,EAAE,KAAA,EAAE,OAAO,GAAK,KAAK,QAAV,CAAU;QAC1C,QAAQ,CAAC,SAAS,CAA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AAgB;QAChD,MAAM,CAAC,UAAU,CAAC,IAAI,CACpB,KAAK,CAAC,cAAc,CAClB,KAAK,CAAC,UAAU,CAAC,wBAAsB,QAAQ,SAAM,CAAC,EACtD,iCAAQ,CAAC,wBAAwB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CACzD,CACF,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAhBY,QAAA,6BAA6B,iCAgBzC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentPluginFactory, ComponentPlugin } from '@teleporthq/teleport-types';
|
|
2
|
+
import { createStyleSheetPlugin } from './style-sheet';
|
|
3
|
+
interface JSSConfig {
|
|
4
|
+
styleChunkName?: string;
|
|
5
|
+
importChunkName?: string;
|
|
6
|
+
componentChunkName: string;
|
|
7
|
+
jssDeclarationName?: string;
|
|
8
|
+
classAttributeName?: string;
|
|
9
|
+
styleObjectImportName?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const createReactJSSPlugin: ComponentPluginFactory<JSSConfig>;
|
|
12
|
+
export { createStyleSheetPlugin };
|
|
13
|
+
declare const _default: ComponentPlugin;
|
|
14
|
+
export default _default;
|