@plasmicapp/react-web 0.2.403 → 0.2.405
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/all.d.ts +14 -10
- package/dist/index.cjs.js +12 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +12 -15
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/style-tokens.d.ts +14 -10
- package/package.json +8 -8
- package/skinny/dist/index.js +12 -15
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/render/style-tokens.d.ts +14 -10
|
@@ -2,7 +2,10 @@ import React from "react";
|
|
|
2
2
|
import { UseGlobalVariants } from "./global-variants";
|
|
3
3
|
type ClassName = string;
|
|
4
4
|
/**
|
|
5
|
-
* All style token data for this project.
|
|
5
|
+
* All style token data (except overrides) for this project.
|
|
6
|
+
* This data is used as the default context value.
|
|
7
|
+
*
|
|
8
|
+
* We don't include the overrides because the Provider (that wraps the components) decides which project's overrides to apply.
|
|
6
9
|
*
|
|
7
10
|
* Usage:
|
|
8
11
|
*
|
|
@@ -11,9 +14,10 @@ type ClassName = string;
|
|
|
11
14
|
* import { usePlatform } from "./PlasmicGlobalVariant__Platform";
|
|
12
15
|
* import { useTheme } from "./PlasmicGlobalVariant__Theme";
|
|
13
16
|
* import projectcss from "./plasmic.module.css";
|
|
17
|
+
* import depcss from "../dep/plasmic.module.css";
|
|
14
18
|
*
|
|
15
|
-
* const
|
|
16
|
-
* base: projectcss.plasmic_tokens
|
|
19
|
+
* const data: ProjectStyleTokenData = {
|
|
20
|
+
* base: `${projectcss.plasmic_tokens} ${depcss.plasmic_tokens}`,
|
|
17
21
|
* varianted: [
|
|
18
22
|
* {
|
|
19
23
|
* className: projectcss.global_platform_windows,
|
|
@@ -40,7 +44,7 @@ type ClassName = string;
|
|
|
40
44
|
* ```
|
|
41
45
|
*/
|
|
42
46
|
interface ProjectStyleTokenData {
|
|
43
|
-
base
|
|
47
|
+
base?: ClassName;
|
|
44
48
|
varianted: {
|
|
45
49
|
className: ClassName;
|
|
46
50
|
groupName: string;
|
|
@@ -49,14 +53,13 @@ interface ProjectStyleTokenData {
|
|
|
49
53
|
}
|
|
50
54
|
type UseStyleTokens = () => ClassName[];
|
|
51
55
|
/**
|
|
52
|
-
*
|
|
53
|
-
* current project's styles.
|
|
56
|
+
* Creates a useStyleTokens hook for a given project that returns class names for the given project's tokens plus token overrides from StyleTokensProvider if present.
|
|
54
57
|
*
|
|
55
58
|
* Usage:
|
|
56
59
|
* ```
|
|
57
60
|
* // PlasmicStyleTokensProvider.ts
|
|
58
61
|
* export const useStyleTokens = createUseStyleTokens(
|
|
59
|
-
*
|
|
62
|
+
* data,
|
|
60
63
|
* useGlobalVariants,
|
|
61
64
|
* );
|
|
62
65
|
*
|
|
@@ -83,14 +86,15 @@ type UseStyleTokens = () => ClassName[];
|
|
|
83
86
|
*/
|
|
84
87
|
export declare function createUseStyleTokens(tokenData: ProjectStyleTokenData, useGlobalVariants: UseGlobalVariants): UseStyleTokens;
|
|
85
88
|
/**
|
|
86
|
-
* Creates a
|
|
87
|
-
*
|
|
89
|
+
* Creates a StyleTokensProvider for a given project to allow propagating its overrides to components of other projects.
|
|
90
|
+
*
|
|
91
|
+
* To ensure all tokens in the overrides class name resolve properly, the base and varianted class names must be included.
|
|
88
92
|
*
|
|
89
93
|
* Usage:
|
|
90
94
|
* ```
|
|
91
95
|
* // PlasmicStyleTokensProvider.ts
|
|
92
96
|
* export const StyleTokensProvider = createStyleTokensProvider(
|
|
93
|
-
*
|
|
97
|
+
* { base: `${projectcss.plasmic_tokens_override} ${data.base}`, varianted: data.varianted },
|
|
94
98
|
* useGlobalVariants,
|
|
95
99
|
* );
|
|
96
100
|
*
|