@preply/ds-rn-core
Advanced tools
Comparing version 0.16.0 to 0.16.1-beta.32f8450e8c3141a168eb53d9cba2892b8a252732.135
@@ -11,2 +11,3 @@ export { colorSchemes } from './color-scheme/colorSchemes.js'; | ||
export { useToken } from './token/hooks/useToken.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7In0= | ||
export { useGetToken } from './token/hooks/useGetToken.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OyJ9 |
@@ -1,6 +0,5 @@ | ||
import { TOKEN_ID_FIELD } from '@preply/ds-core'; | ||
import { getToken } from '../private/getToken.js'; | ||
import { useTheme } from '../../theme/hooks/useTheme.js'; | ||
import { useColorScheme } from '../../color-scheme/hooks/useColorScheme.js'; | ||
const ERROR_MESSAGE = 'Please check the last call of useToken(). Are you using indexes? Example: "tokens.action.size[size]". Make sure it resolves to a token.'; | ||
function useToken(token) { | ||
@@ -12,17 +11,6 @@ const { theme } = useTheme(); | ||
} | ||
if (!token) { | ||
throw new Error(`No token provided. ${ERROR_MESSAGE}`); | ||
} | ||
if (!Array.isArray(token)) { | ||
throw new Error(`Value provided is not a token. ${ERROR_MESSAGE}`); | ||
} | ||
const value = theme.getToken(token, colorScheme); | ||
if (typeof value === 'undefined') { | ||
const id = token[TOKEN_ID_FIELD]; | ||
throw new Error(`Token ${id} not found`); | ||
} | ||
return value; | ||
return getToken(token, theme, colorScheme); | ||
} | ||
export { useToken }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJ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YSBUaGVtZVByb3ZpZGVyJyk7XG4gICAgfVxuXG4gICAgcmV0dXJuIGdldFRva2VuKHRva2VuLCB0aGVtZSwgY29sb3JTY2hlbWUpIGFzIFQ7XG59XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztTQU1nQixRQUFRLENBQXVCLEtBQVk7SUFDdkQsTUFBTSxFQUFFLEtBQUssRUFBRSxHQUFHLFFBQVEsRUFBRSxDQUFDO0lBQzdCLE1BQU0sRUFBRSxXQUFXLEVBQUUsR0FBRyxjQUFjLEVBQUUsQ0FBQztJQUV6QyxJQUFJLENBQUMsS0FBSyxFQUFFO1FBQ1IsTUFBTSxJQUFJLEtBQUssQ0FBQyxnREFBZ0QsQ0FBQyxDQUFDO0tBQ3JFO0lBRUQsT0FBTyxRQUFRLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRSxXQUFXLENBQU0sQ0FBQztBQUNwRDs7OzsifQ== |
export { useToken } from './hooks/useToken'; | ||
export { useGetToken } from './hooks/useGetToken'; |
export { useToken } from './hooks/useToken.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= | ||
export { useGetToken } from './hooks/useGetToken.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOyJ9 |
{ | ||
"name": "@preply/ds-rn-core", | ||
"version": "0.16.0", | ||
"version": "0.16.1-beta.32f8450e8c3141a168eb53d9cba2892b8a252732.135+32f8450", | ||
"publishConfig": { | ||
@@ -21,3 +21,3 @@ "access": "public" | ||
"dependencies": { | ||
"@preply/ds-core": "0.16.0" | ||
"@preply/ds-core": "^0.16.1-beta.32f8450e8c3141a168eb53d9cba2892b8a252732.135+32f8450" | ||
}, | ||
@@ -29,3 +29,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "f6b4319a034d82279247121cf37643c5ee93cf90" | ||
"gitHead": "32f8450e8c3141a168eb53d9cba2892b8a252732" | ||
} |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
40542
40
420
1
+ Added@preply/ds-core@0.16.1-beta.fcd62fd93212d750cc3040e42a66ec999ce1719d.140(transitive)
- Removed@preply/ds-core@0.16.0(transitive)
Updated@preply/ds-core@^0.16.1-beta.32f8450e8c3141a168eb53d9cba2892b8a252732.135+32f8450