Skip to content

Commit d540815

Browse files
Henrikof
andcommitted
Feature/revert breaking change (#1252)
* Revert breaking change * Format * Add update one * use more exact type for update method options * Update changelog.md Co-authored-by: Oleg Isonen <[email protected]>
1 parent caaa314 commit d540815

File tree

4 files changed

+40
-23
lines changed

4 files changed

+40
-23
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Since you are interested in what happens next, in case, you work for a for-profit company that benefits from using the project, please consider supporting it on https://opencollective.com/jss.
44

5+
### Bug fixes
6+
7+
- [jss] Fix breaking change that was introduced in `10.0.1` ([1252](https://github.com/cssinjs/jss/pull/1252))
8+
59
---
610

711
## 10.0.1 (2019-12-28)

packages/jss/.size-snapshot.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
{
22
"dist/jss.js": {
3-
"bundled": 61586,
4-
"minified": 22810,
5-
"gzipped": 6874
3+
"bundled": 61836,
4+
"minified": 22817,
5+
"gzipped": 6879
66
},
77
"dist/jss.min.js": {
8-
"bundled": 60209,
9-
"minified": 22041,
10-
"gzipped": 6515
8+
"bundled": 60459,
9+
"minified": 22048,
10+
"gzipped": 6518
1111
},
1212
"dist/jss.cjs.js": {
13-
"bundled": 56353,
14-
"minified": 24710,
15-
"gzipped": 6870
13+
"bundled": 56577,
14+
"minified": 24717,
15+
"gzipped": 6872
1616
},
1717
"dist/jss.esm.js": {
18-
"bundled": 55821,
19-
"minified": 24275,
20-
"gzipped": 6779,
18+
"bundled": 56045,
19+
"minified": 24282,
20+
"gzipped": 6781,
2121
"treeshaked": {
2222
"rollup": {
23-
"code": 20038,
23+
"code": 20045,
2424
"import_statements": 352
2525
},
2626
"webpack": {
27-
"code": 21505
27+
"code": 21512
2828
}
2929
}
3030
}

packages/jss/src/RuleList.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import type {
99
JssStyle,
1010
Classes,
1111
KeyframesMap,
12-
UpdateArguments
12+
UpdateArguments,
13+
UpdateOptions
1314
} from './types'
1415
import escape from './utils/escape'
1516

@@ -191,7 +192,7 @@ export default class RuleList {
191192
/**
192193
* Execute plugins, update rule props.
193194
*/
194-
updateOne(rule: Rule, data: Object, options?: Object = defaultUpdateOptions) {
195+
updateOne(rule: Rule, data: Object, options?: UpdateOptions = defaultUpdateOptions) {
195196
const {
196197
jss: {plugins},
197198
sheet

packages/jss/src/StyleSheet.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import type {
1010
Classes,
1111
KeyframesMap,
1212
JssStyles,
13-
Renderer
13+
Renderer,
14+
UpdateArguments,
15+
UpdateOptions
1416
} from './types'
1517

1618
export default class StyleSheet {
@@ -30,10 +32,6 @@ export default class StyleSheet {
3032

3133
queue: ?Array<Rule>
3234

33-
update: typeof RuleList.prototype.update
34-
35-
updateOne: typeof RuleList.prototype.updateOne
36-
3735
constructor(styles: JssStyles, options: StyleSheetOptions) {
3836
this.attached = false
3937
this.deployed = false
@@ -50,8 +48,6 @@ export default class StyleSheet {
5048
this.renderer = new options.Renderer(this)
5149
}
5250
this.rules = new RuleList(this.options)
53-
this.update = this.rules.update.bind(this.rules)
54-
this.updateOne = this.rules.updateOne.bind(this.rules)
5551

5652
for (const name in styles) {
5753
this.rules.add(name, styles[name])
@@ -185,6 +181,22 @@ export default class StyleSheet {
185181
return this
186182
}
187183

184+
/**
185+
* Update the function values with a new data.
186+
*/
187+
update(...args: UpdateArguments): this {
188+
this.rules.update(...args)
189+
return this
190+
}
191+
192+
/**
193+
* Updates a single rule.
194+
*/
195+
updateOne(rule: Rule, data: Object, options?: UpdateOptions): this {
196+
this.rules.updateOne(rule, data, options)
197+
return this
198+
}
199+
188200
/**
189201
* Convert rules to a CSS string.
190202
*/

0 commit comments

Comments
 (0)