@front10/helpers 2.0.25 → 2.0.26

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.
@@ -34,19 +34,19 @@ exports.getValueFromPath = getValueFromPath;
34
34
  var getFromPalette = function getFromPalette(path, tokenTheme) {
35
35
  var palette = tokenTheme && tokenTheme.palette || {};
36
36
  var newPath = path;
37
- var withImportant = false;
38
- var position = newPath.indexOf("@palette:");
39
- var color = newPath.substring(position + 9).trim();
40
-
41
- if (color.endsWith("!important")) {
42
- newPath = newPath.replace("!important", "");
43
- withImportant = true;
44
- color = color.substring(0, color.length - 11).trim();
37
+ var regex = /@palette:([^\s]+)/g;
38
+ var matches;
39
+ var keys = [];
40
+
41
+ while ((matches = regex.exec(newPath)) !== null) {
42
+ keys.push(matches[1]);
45
43
  }
46
44
 
47
- var result = palette && palette[color] || null;
48
- var evaluator = result && newPath.replace("@palette:".concat(color), result);
49
- return result && withImportant ? "".concat(evaluator, "!important") : evaluator;
45
+ keys.forEach(function (element) {
46
+ var result = palette && palette[element] || null;
47
+ newPath = newPath.replace("@palette:".concat(element), result);
48
+ });
49
+ return newPath;
50
50
  };
51
51
 
52
52
  exports.getFromPalette = getFromPalette;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@front10/helpers",
3
- "version": "2.0.25",
3
+ "version": "2.0.26",
4
4
  "description": "Helpers for front10 components",
5
5
  "source": "src/index.js",
6
6
  "main": "dist/front10-helpers.js",
7
7
  "scripts": {
8
8
  "transpile": "babel src -d dist --copy-files",
9
+ "transpile-to-everymundo": "yarn run transpile && cp -R dist/ ../air-modules/node_modules/@front10/helpers/dist/",
9
10
  "prepublishOnly": "npm run transpile",
10
11
  "build": "microbundle",
11
12
  "ci:deploy:prod": "now -A prod.now.json --prod --token=$NOW_TOKEN "