@modern-js/plugin-tailwindcss 0.0.0-next-20240729121302 → 0.0.0-next-20240730030918
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.
|
@@ -35,16 +35,13 @@ __export(plugin_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(plugin_exports);
|
|
37
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
-
var import_merge = require("@modern-js/runtime-utils/merge");
|
|
39
38
|
var import_react = __toESM(require("react"));
|
|
40
39
|
const DesignTokenContext = /* @__PURE__ */ import_react.default.createContext({});
|
|
41
40
|
const useDesignTokens = () => (0, import_react.useContext)(DesignTokenContext);
|
|
42
|
-
const designTokenPlugin = (
|
|
41
|
+
const designTokenPlugin = (options = {}) => ({
|
|
43
42
|
name: "@modern-js/plugin-design-token",
|
|
44
|
-
setup: (
|
|
45
|
-
|
|
46
|
-
const pluginConfig = api.useRuntimeConfigContext();
|
|
47
|
-
const { options } = (0, import_merge.merge)(pluginConfig.designToken || {}, userConfig);
|
|
43
|
+
setup: () => ({
|
|
44
|
+
hoc({ App, config }, next) {
|
|
48
45
|
const DesignTokenAppWrapper = (props) => {
|
|
49
46
|
const { token = {}, useStyledComponentsThemeProvider = false, useDesignTokenContext = false } = options;
|
|
50
47
|
if (useStyledComponentsThemeProvider && useDesignTokenContext) {
|
|
@@ -79,7 +76,10 @@ const designTokenPlugin = (userConfig) => ({
|
|
|
79
76
|
});
|
|
80
77
|
}
|
|
81
78
|
};
|
|
82
|
-
return
|
|
79
|
+
return next({
|
|
80
|
+
App: DesignTokenAppWrapper,
|
|
81
|
+
config
|
|
82
|
+
});
|
|
83
83
|
}
|
|
84
84
|
})
|
|
85
85
|
});
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { merge } from "@modern-js/runtime-utils/merge";
|
|
4
3
|
import React, { useContext } from "react";
|
|
5
4
|
var DesignTokenContext = /* @__PURE__ */ React.createContext({});
|
|
6
5
|
var useDesignTokens = function() {
|
|
7
6
|
return useContext(DesignTokenContext);
|
|
8
7
|
};
|
|
9
|
-
var designTokenPlugin = function(
|
|
8
|
+
var designTokenPlugin = function() {
|
|
9
|
+
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
10
10
|
return {
|
|
11
11
|
name: "@modern-js/plugin-design-token",
|
|
12
|
-
setup: function(
|
|
12
|
+
setup: function() {
|
|
13
13
|
return {
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
var options = merge(pluginConfig.designToken || {}, userConfig).options;
|
|
14
|
+
hoc: function hoc(param, next) {
|
|
15
|
+
var App = param.App, config = param.config;
|
|
17
16
|
var DesignTokenAppWrapper = function(props) {
|
|
18
17
|
var _options_token = options.token, token = _options_token === void 0 ? {} : _options_token, _options_useStyledComponentsThemeProvider = options.useStyledComponentsThemeProvider, useStyledComponentsThemeProvider = _options_useStyledComponentsThemeProvider === void 0 ? false : _options_useStyledComponentsThemeProvider, _options_useDesignTokenContext = options.useDesignTokenContext, useDesignTokenContext = _options_useDesignTokenContext === void 0 ? false : _options_useDesignTokenContext;
|
|
19
18
|
if (useStyledComponentsThemeProvider && useDesignTokenContext) {
|
|
@@ -40,7 +39,10 @@ var designTokenPlugin = function(userConfig) {
|
|
|
40
39
|
return /* @__PURE__ */ _jsx(App, _object_spread({}, props));
|
|
41
40
|
}
|
|
42
41
|
};
|
|
43
|
-
return
|
|
42
|
+
return next({
|
|
43
|
+
App: DesignTokenAppWrapper,
|
|
44
|
+
config
|
|
45
|
+
});
|
|
44
46
|
}
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { merge } from "@modern-js/runtime-utils/merge";
|
|
3
2
|
import React, { useContext } from "react";
|
|
4
3
|
const DesignTokenContext = /* @__PURE__ */ React.createContext({});
|
|
5
4
|
const useDesignTokens = () => useContext(DesignTokenContext);
|
|
6
|
-
const designTokenPlugin = (
|
|
5
|
+
const designTokenPlugin = (options = {}) => ({
|
|
7
6
|
name: "@modern-js/plugin-design-token",
|
|
8
|
-
setup: (
|
|
9
|
-
|
|
10
|
-
const pluginConfig = api.useRuntimeConfigContext();
|
|
11
|
-
const { options } = merge(pluginConfig.designToken || {}, userConfig);
|
|
7
|
+
setup: () => ({
|
|
8
|
+
hoc({ App, config }, next) {
|
|
12
9
|
const DesignTokenAppWrapper = (props) => {
|
|
13
10
|
const { token = {}, useStyledComponentsThemeProvider = false, useDesignTokenContext = false } = options;
|
|
14
11
|
if (useStyledComponentsThemeProvider && useDesignTokenContext) {
|
|
@@ -43,7 +40,10 @@ const designTokenPlugin = (userConfig) => ({
|
|
|
43
40
|
});
|
|
44
41
|
}
|
|
45
42
|
};
|
|
46
|
-
return
|
|
43
|
+
return next({
|
|
44
|
+
App: DesignTokenAppWrapper,
|
|
45
|
+
config
|
|
46
|
+
});
|
|
47
47
|
}
|
|
48
48
|
})
|
|
49
49
|
});
|
|
@@ -2,12 +2,9 @@ import type { Plugin } from '@modern-js/runtime';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export declare const DesignTokenContext: React.Context<any>;
|
|
4
4
|
export declare const useDesignTokens: () => IDesignTokens;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export declare const designTokenPlugin: (userConfig: DesignTokenConfig) => Plugin;
|
|
5
|
+
export declare const designTokenPlugin: (options?: {
|
|
6
|
+
token?: Record<string, any>;
|
|
7
|
+
useStyledComponentsThemeProvider?: boolean;
|
|
8
|
+
useDesignTokenContext?: boolean;
|
|
9
|
+
}) => Plugin;
|
|
13
10
|
export default designTokenPlugin;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "0.0.0-next-
|
|
18
|
+
"version": "0.0.0-next-20240730030918",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -49,9 +49,8 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"babel-plugin-macros": "3.1.0",
|
|
51
51
|
"@swc/helpers": "0.5.3",
|
|
52
|
-
"@modern-js/utils": "0.0.0-next-
|
|
53
|
-
"@modern-js/
|
|
54
|
-
"@modern-js/node-bundle-require": "0.0.0-next-20240729121302"
|
|
52
|
+
"@modern-js/utils": "0.0.0-next-20240730030918",
|
|
53
|
+
"@modern-js/node-bundle-require": "0.0.0-next-20240730030918"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
56
|
"@types/jest": "^29",
|
|
@@ -61,17 +60,17 @@
|
|
|
61
60
|
"jest": "^29",
|
|
62
61
|
"react": "^18",
|
|
63
62
|
"postcss": "^8.4.35",
|
|
64
|
-
"@modern-js/
|
|
65
|
-
"@modern-js/
|
|
66
|
-
"@modern-js/
|
|
67
|
-
"@modern-js/
|
|
68
|
-
"@scripts/build": "0.0.0-next-
|
|
69
|
-
"@modern-js/app-tools": "0.0.0-next-
|
|
70
|
-
"@scripts/jest-config": "0.0.0-next-
|
|
63
|
+
"@modern-js/core": "0.0.0-next-20240730030918",
|
|
64
|
+
"@modern-js/module-tools": "0.0.0-next-20240730030918",
|
|
65
|
+
"@modern-js/types": "0.0.0-next-20240730030918",
|
|
66
|
+
"@modern-js/runtime": "0.0.0-next-20240730030918",
|
|
67
|
+
"@scripts/build": "0.0.0-next-20240730030918",
|
|
68
|
+
"@modern-js/app-tools": "0.0.0-next-20240730030918",
|
|
69
|
+
"@scripts/jest-config": "0.0.0-next-20240730030918"
|
|
71
70
|
},
|
|
72
71
|
"peerDependencies": {
|
|
73
72
|
"tailwindcss": ">= 2.0.0 || >= 3.0.0",
|
|
74
|
-
"@modern-js/runtime": "0.0.0-next-
|
|
73
|
+
"@modern-js/runtime": "0.0.0-next-20240730030918"
|
|
75
74
|
},
|
|
76
75
|
"peerDependenciesMeta": {
|
|
77
76
|
"@modern-js/runtime": {
|