@tamagui/get-token 1.113.1 → 1.113.2
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/dist/esm/index.native.js +61 -79
- package/dist/esm/index.native.js.map +6 -1
- package/package.json +3 -3
package/dist/esm/index.native.js
CHANGED
|
@@ -1,88 +1,70 @@
|
|
|
1
1
|
import { getTokens, isVariable } from "@tamagui/web";
|
|
2
2
|
var defaultOptions = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}),
|
|
33
|
-
_iteratorNormalCompletion = !0,
|
|
34
|
-
_didIteratorError = !1,
|
|
35
|
-
_iteratorError = void 0;
|
|
3
|
+
shift: 0,
|
|
4
|
+
bounds: [
|
|
5
|
+
0
|
|
6
|
+
]
|
|
7
|
+
}, getSize = function(size, options) {
|
|
8
|
+
return getTokenRelative("size", size, options);
|
|
9
|
+
}, getSpace = function(space, options) {
|
|
10
|
+
return getTokenRelative("space", space, options);
|
|
11
|
+
}, getRadius = function(radius, options) {
|
|
12
|
+
return getTokenRelative("radius", radius, options);
|
|
13
|
+
}, cacheVariables = {}, cacheWholeVariables = {}, cacheKeys = {}, cacheWholeKeys = {}, stepTokenUpOrDown = function(type, current) {
|
|
14
|
+
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : defaultOptions, _options_bounds, _options_bounds1, tokens = getTokens({
|
|
15
|
+
prefixed: !0
|
|
16
|
+
})[type];
|
|
17
|
+
if (!(type in cacheVariables)) {
|
|
18
|
+
cacheKeys[type] = [], cacheVariables[type] = [], cacheWholeKeys[type] = [], cacheWholeVariables[type] = [];
|
|
19
|
+
var sorted = Object.keys(tokens).map(function(k) {
|
|
20
|
+
return tokens[k];
|
|
21
|
+
}).sort(function(a, b) {
|
|
22
|
+
return a.val - b.val;
|
|
23
|
+
}), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
24
|
+
try {
|
|
25
|
+
for (var _iterator = sorted[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
26
|
+
var token = _step.value;
|
|
27
|
+
cacheKeys[type].push(token.key), cacheVariables[type].push(token);
|
|
28
|
+
}
|
|
29
|
+
} catch (err) {
|
|
30
|
+
_didIteratorError = !0, _iteratorError = err;
|
|
31
|
+
} finally {
|
|
36
32
|
try {
|
|
37
|
-
|
|
38
|
-
var token = _step.value;
|
|
39
|
-
cacheKeys[type].push(token.key), cacheVariables[type].push(token);
|
|
40
|
-
}
|
|
41
|
-
} catch (err) {
|
|
42
|
-
_didIteratorError = !0, _iteratorError = err;
|
|
33
|
+
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
43
34
|
} finally {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
if (_didIteratorError)
|
|
36
|
+
throw _iteratorError;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
var sortedExcludingHalfSteps = sorted.filter(function(x) {
|
|
40
|
+
return !x.key.endsWith(".5");
|
|
41
|
+
}), _iteratorNormalCompletion1 = !0, _didIteratorError1 = !1, _iteratorError1 = void 0;
|
|
42
|
+
try {
|
|
43
|
+
for (var _iterator1 = sortedExcludingHalfSteps[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0) {
|
|
44
|
+
var token1 = _step1.value;
|
|
45
|
+
cacheWholeKeys[type].push(token1.key), cacheWholeVariables[type].push(token1);
|
|
49
46
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_iteratorNormalCompletion1 = !0,
|
|
54
|
-
_didIteratorError1 = !1,
|
|
55
|
-
_iteratorError1 = void 0;
|
|
47
|
+
} catch (err) {
|
|
48
|
+
_didIteratorError1 = !0, _iteratorError1 = err;
|
|
49
|
+
} finally {
|
|
56
50
|
try {
|
|
57
|
-
|
|
58
|
-
var token1 = _step1.value;
|
|
59
|
-
cacheWholeKeys[type].push(token1.key), cacheWholeVariables[type].push(token1);
|
|
60
|
-
}
|
|
61
|
-
} catch (err) {
|
|
62
|
-
_didIteratorError1 = !0, _iteratorError1 = err;
|
|
51
|
+
!_iteratorNormalCompletion1 && _iterator1.return != null && _iterator1.return();
|
|
63
52
|
} finally {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} finally {
|
|
67
|
-
if (_didIteratorError1) throw _iteratorError1;
|
|
68
|
-
}
|
|
53
|
+
if (_didIteratorError1)
|
|
54
|
+
throw _iteratorError1;
|
|
69
55
|
}
|
|
70
56
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
},
|
|
86
|
-
getTokenRelative = stepTokenUpOrDown;
|
|
87
|
-
export { getRadius, getSize, getSpace, getTokenRelative, stepTokenUpOrDown };
|
|
88
|
-
//# sourceMappingURL=index.native.js.map
|
|
57
|
+
}
|
|
58
|
+
var isString = typeof current == "string", cache = options.excludeHalfSteps ? isString ? cacheWholeKeys : cacheWholeVariables : isString ? cacheKeys : cacheVariables, tokensOrdered = cache[type], _options_bounds_, min = (_options_bounds_ = (_options_bounds = options.bounds) === null || _options_bounds === void 0 ? void 0 : _options_bounds[0]) !== null && _options_bounds_ !== void 0 ? _options_bounds_ : 0, _options_bounds_1, max = (_options_bounds_1 = (_options_bounds1 = options.bounds) === null || _options_bounds1 === void 0 ? void 0 : _options_bounds1[1]) !== null && _options_bounds_1 !== void 0 ? _options_bounds_1 : tokensOrdered.length - 1, currentIndex = tokensOrdered.indexOf(current), shift = options.shift || 0;
|
|
59
|
+
shift && (current === "$true" || isVariable(current) && current.name === "true") && (shift += shift > 0 ? 1 : -1);
|
|
60
|
+
var index = Math.min(max, Math.max(min, currentIndex + shift)), found = tokensOrdered[index], result = (typeof found == "string" ? tokens[found] : found) || tokens.$true;
|
|
61
|
+
return result;
|
|
62
|
+
}, getTokenRelative = stepTokenUpOrDown;
|
|
63
|
+
export {
|
|
64
|
+
getRadius,
|
|
65
|
+
getSize,
|
|
66
|
+
getSpace,
|
|
67
|
+
getTokenRelative,
|
|
68
|
+
stepTokenUpOrDown
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/core/get-token/src/index.ts"],
|
|
4
|
+
"mappings": "AACA,SAASA,WAAWC,kBAAkB;AAWtC,IAAMC,iBAAkC;EACtCC,OAAO;EACPC,QAAQ;IAAC;;AACX,GAEaC,UAAU,SAACC,MAAoBC,SAAAA;AAC1C,SAAOC,iBAAiB,QAAQF,MAAMC,OAAAA;AACxC,GAEaE,WAAW,SAACC,OAAqBH,SAAAA;AAC5C,SAAOC,iBAAiB,SAASE,OAAOH,OAAAA;AAC1C,GAEaI,YAAY,SAACC,QAAsBL,SAAAA;AAC9C,SAAOC,iBAAiB,UAAUI,QAAQL,OAAAA;AAC5C,GAEMM,iBAA6C,CAAC,GAC9CC,sBAAkD,CAAC,GACnDC,YAAsC,CAAC,GACvCC,iBAA2C,CAAC,GAGrCC,oBAAoB,SAC/BC,MACAC,SAAAA;M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c,KAAKD,MAAAA;MACjC;;AAHK,2BAAA,IAAA,kBAAA;;;SAAA,8BAAA,WAAA,UAAA,QAAA,WAAA,OAAA;;YAAA;gBAAA;;;EAIP;AAEA,MAAMO,WAAW,OAAOnB,WAAY,UAC9BoB,QAAQhC,QAAQiC,mBAClBF,WACEtB,iBACAF,sBACFwB,WACEvB,YACAF,gBAEA4B,gBAAgBF,MAAMrB,IAAAA,GAEhBX,kBAANmC,OAAMnC,oBAAAA,kBAAAA,QAAQH,YAAM,QAAdG,oBAAAA,SAAAA,SAAAA,gBAAiB,CAAA,OAAE,QAAnBA,qBAAAA,SAAAA,mBAAuB,GACvBA,mBAANoC,OAAMpC,qBAAAA,mBAAAA,QAAQH,YAAM,QAAdG,qBAAAA,SAAAA,SAAAA,iBAAiB,CAAA,OAAE,QAAnBA,sBAAAA,SAAAA,oBAAuBkC,cAAcG,SAAS,GACpDC,eAAeJ,cAAcK,QAAQ3B,OAAAA,GAEvChB,QAAQI,QAAQJ,SAAS;AAC7B,EAAIA,UACEgB,YAAY,WAAYlB,WAAWkB,OAAAA,KAAYA,QAAQ4B,SAAS,YAClE5C,SAASA,QAAQ,IAAI,IAAI;AAI7B,MAAM6C,QAAQC,KAAKP,IAAIC,KAAKM,KAAKN,IAAID,KAAKG,eAAe1C,KAAAA,CAAAA,GACnD+C,QAAQT,cAAcO,KAAAA,GAEtBG,UAAU,OAAOD,SAAU,WAAW9B,OAAO8B,KAAAA,IAASA,UAAU9B,OAAO;AAK7E,SAAO+B;AACT,GAEa3C,mBAAmBS;",
|
|
5
|
+
"names": ["getTokens", "isVariable", "defaultOptions", "shift", "bounds", "getSize", "size", "options", "getTokenRelative", "getSpace", "space", "getRadius", "radius", "cacheVariables", "cacheWholeVariables", "cacheKeys", "cacheWholeKeys", "stepTokenUpOrDown", "type", "current", "tokens", "prefixed", "sorted", "Object", "keys", "map", "k", "sort", "a", "b", "val", "token", "push", "key", "sortedExcludingHalfSteps", "filter", "x", "endsWith", "isString", "cache", "excludeHalfSteps", "tokensOrdered", "min", "max", "length", "currentIndex", "indexOf", "name", "index", "Math", "found", "result"]
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/get-token",
|
|
3
|
-
"version": "1.113.
|
|
3
|
+
"version": "1.113.2",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs/index",
|
|
6
6
|
"module": "dist/esm/index",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@tamagui/web": "1.113.
|
|
31
|
+
"@tamagui/web": "1.113.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@tamagui/build": "1.113.
|
|
34
|
+
"@tamagui/build": "1.113.2",
|
|
35
35
|
"react": "^18.2.0 || ^19.0.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|