@tamagui/get-token 1.88.1 → 1.88.3
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/cjs/index.js +1 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.native.js +32 -7
- package/dist/esm/index.native.js.map +2 -2
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -26,7 +26,6 @@ const defaultOptions = {
|
|
|
26
26
|
shift: 0,
|
|
27
27
|
bounds: [0]
|
|
28
28
|
}, getSize = (size, options) => getTokenRelative("size", size, options), getSpace = (space, options) => getTokenRelative("space", space, options), getRadius = (radius, options) => getTokenRelative("radius", radius, options), cacheVariables = {}, cacheWholeVariables = {}, cacheKeys = {}, cacheWholeKeys = {}, stepTokenUpOrDown = (type, current, options = defaultOptions) => {
|
|
29
|
-
var _a, _b;
|
|
30
29
|
const tokens = (0, import_web2.getTokens)({ prefixed: !0 })[type];
|
|
31
30
|
if (!(type in cacheVariables)) {
|
|
32
31
|
cacheKeys[type] = [], cacheVariables[type] = [], cacheWholeKeys[type] = [], cacheWholeVariables[type] = [];
|
|
@@ -37,18 +36,10 @@ const defaultOptions = {
|
|
|
37
36
|
for (const token of sortedExcludingHalfSteps)
|
|
38
37
|
cacheWholeKeys[type].push(token.key), cacheWholeVariables[type].push(token);
|
|
39
38
|
}
|
|
40
|
-
const isString = typeof current == "string", tokensOrdered = (options.excludeHalfSteps ? isString ? cacheWholeKeys : cacheWholeVariables : isString ? cacheKeys : cacheVariables)[type], min =
|
|
39
|
+
const isString = typeof current == "string", tokensOrdered = (options.excludeHalfSteps ? isString ? cacheWholeKeys : cacheWholeVariables : isString ? cacheKeys : cacheVariables)[type], min = options.bounds?.[0] ?? 0, max = options.bounds?.[1] ?? tokensOrdered.length - 1, currentIndex = tokensOrdered.indexOf(current);
|
|
41
40
|
let shift = options.shift || 0;
|
|
42
41
|
shift && (current === "$true" || (0, import_web.isVariable)(current) && current.name === "true") && (shift += shift > 0 ? 1 : -1);
|
|
43
42
|
const index = Math.min(max, Math.max(min, currentIndex + shift)), found = tokensOrdered[index];
|
|
44
43
|
return (typeof found == "string" ? tokens[found] : found) || tokens.$true;
|
|
45
44
|
}, getTokenRelative = stepTokenUpOrDown;
|
|
46
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
-
0 && (module.exports = {
|
|
48
|
-
getRadius,
|
|
49
|
-
getSize,
|
|
50
|
-
getSpace,
|
|
51
|
-
getTokenRelative,
|
|
52
|
-
stepTokenUpOrDown
|
|
53
|
-
});
|
|
54
45
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAyD,yBACzDA,cAA0B;AAW1B,MAAM,iBAAkC;AAAA,EACtC,OAAO;AAAA,EACP,QAAQ,CAAC,CAAC;AACZ,GAEa,UAAU,CAAC,MAAoB,YACnC,iBAAiB,QAAQ,MAAM,OAAO,GAGlC,WAAW,CAAC,OAAqB,YACrC,iBAAiB,SAAS,OAAO,OAAO,GAGpC,YAAY,CAAC,QAAsB,YACvC,iBAAiB,UAAU,QAAQ,OAAO,GAG7C,iBAA6C,CAAC,GAC9C,sBAAkD,CAAC,GACnD,YAAsC,CAAC,GACvC,iBAA2C,CAAC,GAGrC,oBAAoB,CAC/B,MACA,SACA,UAA2B,mBACN;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAyD,yBACzDA,cAA0B;AAW1B,MAAM,iBAAkC;AAAA,EACtC,OAAO;AAAA,EACP,QAAQ,CAAC,CAAC;AACZ,GAEa,UAAU,CAAC,MAAoB,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K,QAAQ,SAAS,YAClE,SAAS,QAAQ,IAAI,IAAI;AAI7B,QAAM,QAAQ,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,eAAe,KAAK,CAAC,GACzD,QAAQ,cAAc,KAAK;AAOjC,UALgB,OAAO,SAAU,WAAW,OAAO,KAAK,IAAI,UAAU,OAAO;AAM/E,GAEa,mBAAmB;",
|
|
5
5
|
"names": ["import_web"]
|
|
6
6
|
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var src_exports = {};
|
|
17
|
+
__export(src_exports, {
|
|
18
|
+
getRadius: () => getRadius,
|
|
19
|
+
getSize: () => getSize,
|
|
20
|
+
getSpace: () => getSpace,
|
|
21
|
+
getTokenRelative: () => getTokenRelative,
|
|
22
|
+
stepTokenUpOrDown: () => stepTokenUpOrDown
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(src_exports);
|
|
25
|
+
var import_web = require("@tamagui/web"), import_web2 = require("@tamagui/web");
|
|
3
26
|
const defaultOptions = {
|
|
4
27
|
shift: 0,
|
|
5
28
|
bounds: [0]
|
|
6
29
|
}, getSize = (size, options) => getTokenRelative("size", size, options), getSpace = (space, options) => getTokenRelative("space", space, options), getRadius = (radius, options) => getTokenRelative("radius", radius, options), cacheVariables = {}, cacheWholeVariables = {}, cacheKeys = {}, cacheWholeKeys = {}, stepTokenUpOrDown = (type, current, options = defaultOptions) => {
|
|
7
|
-
|
|
30
|
+
var _a, _b;
|
|
31
|
+
const tokens = (0, import_web2.getTokens)({ prefixed: !0 })[type];
|
|
8
32
|
if (!(type in cacheVariables)) {
|
|
9
33
|
cacheKeys[type] = [], cacheVariables[type] = [], cacheWholeKeys[type] = [], cacheWholeVariables[type] = [];
|
|
10
34
|
const sorted = Object.keys(tokens).map((k) => tokens[k]).sort((a, b) => a.val - b.val);
|
|
@@ -14,17 +38,18 @@ const defaultOptions = {
|
|
|
14
38
|
for (const token of sortedExcludingHalfSteps)
|
|
15
39
|
cacheWholeKeys[type].push(token.key), cacheWholeVariables[type].push(token);
|
|
16
40
|
}
|
|
17
|
-
const isString = typeof current == "string", tokensOrdered = (options.excludeHalfSteps ? isString ? cacheWholeKeys : cacheWholeVariables : isString ? cacheKeys : cacheVariables)[type], min = options.bounds
|
|
41
|
+
const isString = typeof current == "string", tokensOrdered = (options.excludeHalfSteps ? isString ? cacheWholeKeys : cacheWholeVariables : isString ? cacheKeys : cacheVariables)[type], min = ((_a = options.bounds) == null ? void 0 : _a[0]) ?? 0, max = ((_b = options.bounds) == null ? void 0 : _b[1]) ?? tokensOrdered.length - 1, currentIndex = tokensOrdered.indexOf(current);
|
|
18
42
|
let shift = options.shift || 0;
|
|
19
|
-
shift && (current === "$true" || isVariable(current) && current.name === "true") && (shift += shift > 0 ? 1 : -1);
|
|
43
|
+
shift && (current === "$true" || (0, import_web.isVariable)(current) && current.name === "true") && (shift += shift > 0 ? 1 : -1);
|
|
20
44
|
const index = Math.min(max, Math.max(min, currentIndex + shift)), found = tokensOrdered[index];
|
|
21
45
|
return (typeof found == "string" ? tokens[found] : found) || tokens.$true;
|
|
22
46
|
}, getTokenRelative = stepTokenUpOrDown;
|
|
23
|
-
export
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
24
49
|
getRadius,
|
|
25
50
|
getSize,
|
|
26
51
|
getSpace,
|
|
27
52
|
getTokenRelative,
|
|
28
53
|
stepTokenUpOrDown
|
|
29
|
-
};
|
|
54
|
+
});
|
|
30
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": []
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAyD,yBACzDA,cAA0B;AAW1B,MAAM,iBAAkC;AAAA,EACtC,OAAO;AAAA,EACP,QAAQ,CAAC,CAAC;AACZ,GAEa,UAAU,CAAC,MAAoB,YACnC,iBAAiB,QAAQ,MAAM,OAAO,GAGlC,WAAW,CAAC,OAAqB,YACrC,iBAAiB,SAAS,OAAO,OAAO,GAGpC,YAAY,CAAC,QAAsB,YACvC,iBAAiB,UAAU,QAAQ,OAAO,GAG7C,iBAA6C,CAAC,GAC9C,sBAAkD,CAAC,GACnD,YAAsC,CAAC,GACvC,iBAA2C,CAAC,GAGrC,oBAAoB,CAC/B,MACA,SACA,UAA2B,mBACN;AAvCvB;AAwCE,QAAM,aAAS,uBAAU,EAAE,UAAU,GAAK,CAAC,EAAE,IAAI;AAEjD,MAAI,EAAE,QAAQ,iBAAiB;AAC7B,cAAU,IAAI,IAAI,CAAC,GACnB,eAAe,IAAI,IAAI,CAAC,GACxB,eAAe,IAAI,IAAI,CAAC,GACxB,oBAAoB,IAAI,IAAI,CAAC;AAE7B,UAAM,SAAS,OAAO,KAAK,MAAM,EAC9B,IAAI,CAAC,MAAM,OAAO,CAAC,CAAC,EACpB,KAAK,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG;AAE/B,eAAW,SAAS;AAClB,gBAAU,IAAI,EAAE,KAAK,MAAM,GAAG,GAC9B,eAAe,IAAI,EAAE,KAAK,KAAK;AAGjC,UAAM,2BAA2B,OAAO,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,SAAS,IAAI,CAAC;AAC3E,eAAW,SAAS;AAClB,qBAAe,IAAI,EAAE,KAAK,MAAM,GAAG,GACnC,oBAAoB,IAAI,EAAE,KAAK,KAAK;AAAA,EAExC;AAEA,QAAM,WAAW,OAAO,WAAY,UAS9B,iBARQ,QAAQ,mBAClB,WACE,iBACA,sBACF,WACE,YACA,gBAEsB,IAAI,GAE1B,QAAM,aAAQ,WAAR,mBAAiB,OAAM,GAC7B,QAAM,aAAQ,WAAR,mBAAiB,OAAM,cAAc,SAAS,GACpD,eAAe,cAAc,QAAQ,OAAc;AAEzD,MAAI,QAAQ,QAAQ,SAAS;AAC7B,EAAI,UACE,YAAY,eAAY,uBAAW,OAAO,KAAK,QAAQ,SAAS,YAClE,SAAS,QAAQ,IAAI,IAAI;AAI7B,QAAM,QAAQ,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,eAAe,KAAK,CAAC,GACzD,QAAQ,cAAc,KAAK;AAOjC,UALgB,OAAO,SAAU,WAAW,OAAO,KAAK,IAAI,UAAU,OAAO;AAM/E,GAEa,mBAAmB;",
|
|
5
|
+
"names": ["import_web"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/get-token",
|
|
3
|
-
"version": "1.88.
|
|
3
|
+
"version": "1.88.3",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs/index",
|
|
6
6
|
"module": "dist/esm/index",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"clean:build": "tamagui-build clean:build"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tamagui/web": "1.88.
|
|
21
|
+
"@tamagui/web": "1.88.3"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@tamagui/build": "1.88.
|
|
24
|
+
"@tamagui/build": "1.88.3",
|
|
25
25
|
"react": "^18.2.0",
|
|
26
26
|
"react-native": "^0.72.6"
|
|
27
27
|
},
|