@figma-vars/hooks 1.1.1 → 1.2.0
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/contexts/FigmaTokenContext.d.ts +39 -1
- package/dist/figma-vars-hooks.js +661 -775
- package/dist/figma-vars-hooks.umd.cjs +6 -6
- package/dist/hooks/useFigmaToken.d.ts +11 -0
- package/dist/hooks/useVariableCollections.d.ts +20 -7
- package/dist/hooks/useVariableModes.d.ts +12 -4
- package/dist/hooks/useVariables.d.ts +18 -7
- package/dist/index.d.ts +4 -6
- package/dist/mutations/bulkUpdateVariables.d.ts +25 -7
- package/dist/mutations/createVariable.d.ts +26 -7
- package/dist/mutations/deleteVariable.d.ts +19 -7
- package/dist/mutations/updateVariable.d.ts +26 -7
- package/dist/types/figma.d.ts +63 -0
- package/dist/types/hooks.d.ts +6 -13
- package/dist/types/mutations.d.ts +54 -16
- package/dist/utils/fetcher.d.ts +13 -0
- package/dist/utils/filterVariables.d.ts +26 -0
- package/package.json +1 -1
- package/dist/utils/authHelpers.d.ts +0 -4
- package/dist/utils/fetchHelpers.d.ts +0 -10
|
@@ -1,11 +1,49 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* The shape of the context provided by `FigmaVarsProvider`.
|
|
5
|
+
*/
|
|
2
6
|
interface FigmaTokenContextType {
|
|
7
|
+
/** The Figma Personal Access Token. */
|
|
3
8
|
token: string | null;
|
|
9
|
+
/** The key of the Figma file to access. */
|
|
10
|
+
fileKey: string | null;
|
|
4
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Props for the `FigmaVarsProvider` component.
|
|
14
|
+
*/
|
|
5
15
|
interface FigmaVarsProviderProps {
|
|
16
|
+
/** The React children to render within the provider. */
|
|
6
17
|
children: ReactNode;
|
|
18
|
+
/** The Figma Personal Access Token. Can be sourced from anywhere (e.g., env variables, localStorage). */
|
|
7
19
|
token: string | null;
|
|
20
|
+
/** The key of the Figma file to be accessed by the hooks. */
|
|
21
|
+
fileKey: string | null;
|
|
8
22
|
}
|
|
9
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A React Context Provider that makes the Figma token and file key available to all `figma-vars-hooks`.
|
|
25
|
+
* Wrap your application or component tree with this provider.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import { FigmaVarsProvider } from '@figma-vars/hooks';
|
|
30
|
+
*
|
|
31
|
+
* const App = () => (
|
|
32
|
+
* <FigmaVarsProvider
|
|
33
|
+
* token="your-figma-token"
|
|
34
|
+
* fileKey="your-figma-file-key"
|
|
35
|
+
* >
|
|
36
|
+
* <YourComponentThatUsesTheHooks />
|
|
37
|
+
* </FigmaVarsProvider>
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const FigmaVarsProvider: ({ children, token, fileKey, }: FigmaVarsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
* A hook to access the Figma token and file key from the context.
|
|
45
|
+
* Throws an error if used outside of a `FigmaVarsProvider`.
|
|
46
|
+
* @returns The Figma token and file key.
|
|
47
|
+
*/
|
|
10
48
|
export declare const useFigmaTokenContext: () => FigmaTokenContextType;
|
|
11
49
|
export {};
|