1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.replaceValuesWithVariableNames = replaceValuesWithVariableNames;
|
7 | exports.default = void 0;
|
8 |
|
9 | var _formatVariableName = require("./formatVariableName.js");
|
10 |
|
11 | /*
|
12 | * The MIT License (MIT)
|
13 | *
|
14 | * Copyright (c) 2015 - present Instructure, Inc.
|
15 | *
|
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
17 | * of this software and associated documentation files (the "Software"), to deal
|
18 | * in the Software without restriction, including without limitation the rights
|
19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
20 | * copies of the Software, and to permit persons to whom the Software is
|
21 | * furnished to do so, subject to the following conditions:
|
22 | *
|
23 | * The above copyright notice and this permission notice shall be included in all
|
24 | * copies or substantial portions of the Software.
|
25 | *
|
26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
29 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
32 | * SOFTWARE.
|
33 | */
|
34 |
|
35 | /**
|
36 | * ---
|
37 | * category: utilities/themes
|
38 | * ---
|
39 | * Replace the variables values with the CSS variable
|
40 | * @param {Object} variables
|
41 | * @param {String} prefix a prefix to add to the variable names
|
42 | * @returns {Object} the theme variables object with CSS variables in place of values
|
43 | */
|
44 | function replaceValuesWithVariableNames(variables, prefix) {
|
45 | var map = {};
|
46 | Object.keys(variables || {}).forEach(function (variableName) {
|
47 | map[variableName] = "var(".concat((0, _formatVariableName.formatVariableName)(variableName, prefix), ")");
|
48 | });
|
49 | return map;
|
50 | }
|
51 |
|
52 | var _default = replaceValuesWithVariableNames;
|
53 | exports.default = _default; |
\ | No newline at end of file |