@viewfly/scoped-css 0.5.4 → 0.6.1
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/bundles/css-modules.d.ts +1 -2
- package/bundles/index.esm.js +5 -13
- package/bundles/index.js +4 -12
- package/package.json +3 -3
package/bundles/css-modules.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function withScopedCSS(cssNamespace: string | string[], render: () => JSXInternal.JSXNode): () => JSXInternal.JSXNode;
|
|
1
|
+
export declare function withScopedCSS(cssNamespace: string | string[], render: () => JSXInternal.ViewNode): () => JSXInternal.ViewNode;
|
package/bundles/index.esm.js
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSXNodeFactory } from '@viewfly/core';
|
|
2
2
|
|
|
3
3
|
function withScopedCSS(cssNamespace, render) {
|
|
4
4
|
if (!cssNamespace) {
|
|
5
5
|
return render;
|
|
6
6
|
}
|
|
7
7
|
return function () {
|
|
8
|
-
const
|
|
9
|
-
const oldCreateComponent = JSXComponent.createInstance;
|
|
8
|
+
const oldCreateNote = JSXNodeFactory.createNode;
|
|
10
9
|
const spaces = Array.isArray(cssNamespace) ? cssNamespace : [cssNamespace];
|
|
11
|
-
|
|
10
|
+
JSXNodeFactory.createNode = function (name, props, key) {
|
|
12
11
|
for (const scopedId of spaces) {
|
|
13
12
|
props[scopedId] = '';
|
|
14
13
|
}
|
|
15
|
-
return
|
|
16
|
-
};
|
|
17
|
-
JSXComponent.createInstance = function (type, props, factory, key) {
|
|
18
|
-
for (const scopedId of spaces) {
|
|
19
|
-
props[scopedId] = '';
|
|
20
|
-
}
|
|
21
|
-
return oldCreateComponent.apply(JSXComponent, [type, props, factory, key]);
|
|
14
|
+
return oldCreateNote.apply(JSXNodeFactory, [name, props, key]);
|
|
22
15
|
};
|
|
23
16
|
const vDom = render();
|
|
24
|
-
|
|
25
|
-
JSXComponent.createInstance = oldCreateComponent;
|
|
17
|
+
JSXNodeFactory.createNode = oldCreateNote;
|
|
26
18
|
return vDom;
|
|
27
19
|
};
|
|
28
20
|
}
|
package/bundles/index.js
CHANGED
|
@@ -7,24 +7,16 @@ function withScopedCSS(cssNamespace, render) {
|
|
|
7
7
|
return render;
|
|
8
8
|
}
|
|
9
9
|
return function () {
|
|
10
|
-
const
|
|
11
|
-
const oldCreateComponent = core.JSXComponent.createInstance;
|
|
10
|
+
const oldCreateNote = core.JSXNodeFactory.createNode;
|
|
12
11
|
const spaces = Array.isArray(cssNamespace) ? cssNamespace : [cssNamespace];
|
|
13
|
-
core.
|
|
12
|
+
core.JSXNodeFactory.createNode = function (name, props, key) {
|
|
14
13
|
for (const scopedId of spaces) {
|
|
15
14
|
props[scopedId] = '';
|
|
16
15
|
}
|
|
17
|
-
return
|
|
18
|
-
};
|
|
19
|
-
core.JSXComponent.createInstance = function (type, props, factory, key) {
|
|
20
|
-
for (const scopedId of spaces) {
|
|
21
|
-
props[scopedId] = '';
|
|
22
|
-
}
|
|
23
|
-
return oldCreateComponent.apply(core.JSXComponent, [type, props, factory, key]);
|
|
16
|
+
return oldCreateNote.apply(core.JSXNodeFactory, [name, props, key]);
|
|
24
17
|
};
|
|
25
18
|
const vDom = render();
|
|
26
|
-
core.
|
|
27
|
-
core.JSXComponent.createInstance = oldCreateComponent;
|
|
19
|
+
core.JSXNodeFactory.createNode = oldCreateNote;
|
|
28
20
|
return vDom;
|
|
29
21
|
};
|
|
30
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/scoped-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "A library for supporting scoped style sheets in the Viewfly framework。",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"keywords": [],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@viewfly/core": "^0.
|
|
15
|
+
"@viewfly/core": "^0.6.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@rollup/plugin-commonjs": "^25.0.3",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"bugs": {
|
|
33
33
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "95ed600209322e44d2bd7d2eb62a1868629d9d68"
|
|
36
36
|
}
|