@khanacademy/wonder-blocks-core 5.0.3 → 5.1.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/CHANGELOG.md +16 -0
- package/dist/components/id-provider.js.flow +1 -2
- package/dist/components/render-state-context.js.flow +1 -2
- package/dist/components/render-state-root.d.ts +1 -1
- package/dist/components/render-state-root.js.flow +2 -3
- package/dist/components/unique-id-provider.js.flow +1 -2
- package/dist/components/with-ssr-placeholder.js.flow +1 -2
- package/dist/es/index.js +61 -105
- package/dist/hooks/use-force-update.js.flow +1 -2
- package/dist/hooks/use-is-mounted.js.flow +1 -2
- package/dist/hooks/use-latest-ref.d.ts +12 -0
- package/dist/hooks/use-latest-ref.js.flow +16 -0
- package/dist/hooks/use-on-mount-effect.js.flow +1 -2
- package/dist/hooks/use-online.js.flow +1 -2
- package/dist/hooks/use-render-state.js.flow +1 -2
- package/dist/hooks/use-unique-id.js.flow +1 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +61 -104
- package/dist/index.js.flow +2 -2
- package/dist/util/add-style.d.ts +182 -2
- package/dist/util/add-style.js.flow +10 -19
- package/dist/util/{add-styles.flowtest.js.flow → add-styles.typestest.js.flow} +1 -1
- package/dist/util/aria-types.js.flow +1 -2
- package/dist/util/server.js.flow +1 -2
- package/dist/util/ssr-id-factory.js.flow +1 -2
- package/dist/util/types.js.flow +1 -2
- package/dist/util/unique-id-factory.js.flow +1 -2
- package/dist/util/util.js.flow +1 -2
- package/package.json +2 -2
- package/src/components/render-state-root.tsx +3 -9
- package/src/components/view.tsx +5 -5
- package/src/hooks/__tests__/use-force-update.test.tsx +1 -1
- package/src/hooks/__tests__/use-latest-ref.test.ts +40 -0
- package/src/hooks/use-latest-ref.js.flow +16 -0
- package/src/hooks/use-latest-ref.ts +17 -0
- package/src/index.ts +1 -0
- package/src/util/__tests__/add-style.test.tsx +21 -1
- package/src/util/add-style.js.flow +13 -0
- package/src/util/add-style.tsx +214 -11
- package/tsconfig.tsbuildinfo +1 -1
- /package/dist/util/{add-styles.flowtest.d.ts → add-styles.typestest.d.ts} +0 -0
- /package/src/util/{add-styles.flowtest.tsx → add-styles.typestest.tsx} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-core
|
|
2
2
|
|
|
3
|
+
## 5.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3c400719: Add useLatestRef hook to wonder-blocks-core
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- a6164ed0: Don't use React.FC<> for functional components
|
|
12
|
+
|
|
13
|
+
## 5.0.4
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- c20f48f3: Don't transpile classes when building bundles
|
|
18
|
+
|
|
3
19
|
## 5.0.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import * as React from "react";
|
|
9
8
|
import type { IIdentifierFactory } from "../util/types";
|
|
10
9
|
declare type Props = {|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import * as React from "react";
|
|
9
8
|
declare export var RenderState: {|
|
|
10
9
|
+Root: "root",
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import * as React from "react";
|
|
9
8
|
declare type Props = {|
|
|
10
9
|
children: React.Node,
|
|
@@ -14,5 +13,5 @@ declare type Props = {|
|
|
|
14
13
|
*/
|
|
15
14
|
throwIfNested?: boolean,
|
|
16
15
|
|};
|
|
17
|
-
declare var RenderStateRoot: React.
|
|
16
|
+
declare var RenderStateRoot: (x: Props) => React.Element<any>;
|
|
18
17
|
declare export { RenderStateRoot };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import * as React from "react";
|
|
9
8
|
import type { IIdentifierFactory } from "../util/types";
|
|
10
9
|
declare type Props = {|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import * as React from "react";
|
|
9
8
|
import { RenderState } from "./render-state-context";
|
|
10
9
|
|
package/dist/es/index.js
CHANGED
|
@@ -30,27 +30,13 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
30
30
|
return target;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function _setPrototypeOf(o, p) {
|
|
34
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
35
|
-
o.__proto__ = p;
|
|
36
|
-
return o;
|
|
37
|
-
};
|
|
38
|
-
return _setPrototypeOf(o, p);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function _inheritsLoose(subClass, superClass) {
|
|
42
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
43
|
-
subClass.prototype.constructor = subClass;
|
|
44
|
-
_setPrototypeOf(subClass, superClass);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
33
|
function flatten(list) {
|
|
48
34
|
const result = [];
|
|
49
35
|
if (!list) {
|
|
50
36
|
return result;
|
|
51
37
|
} else if (Array.isArray(list)) {
|
|
52
38
|
for (const item of list) {
|
|
53
|
-
result.push
|
|
39
|
+
result.push(...flatten(item));
|
|
54
40
|
}
|
|
55
41
|
} else {
|
|
56
42
|
result.push(list);
|
|
@@ -83,7 +69,7 @@ function processStyleList(style) {
|
|
|
83
69
|
inlineStyles.push(child);
|
|
84
70
|
}
|
|
85
71
|
});
|
|
86
|
-
const inlineStylesObject = Object.assign
|
|
72
|
+
const inlineStylesObject = Object.assign({}, ...inlineStyles);
|
|
87
73
|
if (inlineStyles.length > 0 && !shouldInlineStyles) {
|
|
88
74
|
const inlineStylesStyleSheet = StyleSheet.create({
|
|
89
75
|
inlineStyles: inlineStylesObject
|
|
@@ -92,7 +78,7 @@ function processStyleList(style) {
|
|
|
92
78
|
}
|
|
93
79
|
return {
|
|
94
80
|
style: shouldInlineStyles ? inlineStylesObject : {},
|
|
95
|
-
className: css
|
|
81
|
+
className: css(...stylesheetStyles)
|
|
96
82
|
};
|
|
97
83
|
}
|
|
98
84
|
|
|
@@ -108,13 +94,8 @@ const styles$1 = StyleSheet.create({
|
|
|
108
94
|
marginBottom: 0
|
|
109
95
|
}
|
|
110
96
|
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
function Text() {
|
|
114
|
-
return _React$Component.apply(this, arguments) || this;
|
|
115
|
-
}
|
|
116
|
-
var _proto = Text.prototype;
|
|
117
|
-
_proto.render = function render() {
|
|
97
|
+
class Text extends React.Component {
|
|
98
|
+
render() {
|
|
118
99
|
const _this$props = this.props,
|
|
119
100
|
{
|
|
120
101
|
children,
|
|
@@ -130,16 +111,15 @@ let Text = function (_React$Component) {
|
|
|
130
111
|
className: styleAttributes.className,
|
|
131
112
|
"data-test-id": testId
|
|
132
113
|
}), children);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
}(React.Component);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
136
116
|
Text.defaultProps = {
|
|
137
117
|
tag: "span"
|
|
138
118
|
};
|
|
139
119
|
|
|
140
120
|
const _excluded$1 = ["className", "style"];
|
|
141
121
|
function addStyle(Component, defaultStyle) {
|
|
142
|
-
|
|
122
|
+
return React.forwardRef((props, ref) => {
|
|
143
123
|
const {
|
|
144
124
|
className,
|
|
145
125
|
style
|
|
@@ -151,11 +131,11 @@ function addStyle(Component, defaultStyle) {
|
|
|
151
131
|
style: inlineStyles
|
|
152
132
|
} = processStyleList([reset, defaultStyle, style]);
|
|
153
133
|
return React.createElement(Component, _extends({}, otherProps, {
|
|
134
|
+
ref: ref,
|
|
154
135
|
className: [aphroditeClassName, className].filter(Boolean).join(" "),
|
|
155
136
|
style: inlineStyles
|
|
156
137
|
}));
|
|
157
|
-
};
|
|
158
|
-
return StyleComponent;
|
|
138
|
+
});
|
|
159
139
|
}
|
|
160
140
|
const overrides = StyleSheet.create({
|
|
161
141
|
button: {
|
|
@@ -188,13 +168,8 @@ const StyledArticle = addStyle("article", styles.default);
|
|
|
188
168
|
const StyledAside = addStyle("aside", styles.default);
|
|
189
169
|
const StyledNav = addStyle("nav", styles.default);
|
|
190
170
|
const StyledSection = addStyle("section", styles.default);
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
function View() {
|
|
194
|
-
return _React$Component.apply(this, arguments) || this;
|
|
195
|
-
}
|
|
196
|
-
var _proto = View.prototype;
|
|
197
|
-
_proto.render = function render() {
|
|
171
|
+
class View extends React.Component {
|
|
172
|
+
render() {
|
|
198
173
|
const _this$props = this.props,
|
|
199
174
|
{
|
|
200
175
|
testId,
|
|
@@ -218,9 +193,8 @@ let View = function (_React$Component) {
|
|
|
218
193
|
default:
|
|
219
194
|
throw Error(`${tag} is not an allowed value for the 'tag' prop`);
|
|
220
195
|
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
}(React.Component);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
224
198
|
View.defaultProps = {
|
|
225
199
|
tag: "div"
|
|
226
200
|
};
|
|
@@ -232,26 +206,22 @@ const RenderState = {
|
|
|
232
206
|
};
|
|
233
207
|
const RenderStateContext = React.createContext(RenderState.Root);
|
|
234
208
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
240
|
-
_this.state = {
|
|
209
|
+
class WithSSRPlaceholder extends React.Component {
|
|
210
|
+
constructor(...args) {
|
|
211
|
+
super(...args);
|
|
212
|
+
this.state = {
|
|
241
213
|
mounted: false
|
|
242
214
|
};
|
|
243
|
-
|
|
244
|
-
return _this;
|
|
215
|
+
this._isTheRootComponent = false;
|
|
245
216
|
}
|
|
246
|
-
|
|
247
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
217
|
+
componentDidMount() {
|
|
248
218
|
if (this._isTheRootComponent) {
|
|
249
219
|
this.setState({
|
|
250
220
|
mounted: true
|
|
251
221
|
});
|
|
252
222
|
}
|
|
253
|
-
}
|
|
254
|
-
|
|
223
|
+
}
|
|
224
|
+
_renderAsRootComponent() {
|
|
255
225
|
const {
|
|
256
226
|
mounted
|
|
257
227
|
} = this.state;
|
|
@@ -271,8 +241,8 @@ let WithSSRPlaceholder = function (_React$Component) {
|
|
|
271
241
|
}, placeholder());
|
|
272
242
|
}
|
|
273
243
|
return null;
|
|
274
|
-
}
|
|
275
|
-
|
|
244
|
+
}
|
|
245
|
+
_maybeRender(renderState) {
|
|
276
246
|
const {
|
|
277
247
|
children,
|
|
278
248
|
placeholder
|
|
@@ -293,15 +263,14 @@ let WithSSRPlaceholder = function (_React$Component) {
|
|
|
293
263
|
console.log(`We got a render state we don't understand: "${(_JSON$stringify = JSON.stringify(renderState)) != null ? _JSON$stringify : ""}"`);
|
|
294
264
|
return this._maybeRender(RenderState.Root);
|
|
295
265
|
}
|
|
296
|
-
}
|
|
297
|
-
|
|
266
|
+
}
|
|
267
|
+
render() {
|
|
298
268
|
return React.createElement(RenderStateContext.Consumer, null, value => this._maybeRender(value));
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
}(React.Component);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
302
271
|
|
|
303
|
-
|
|
304
|
-
|
|
272
|
+
class UniqueIDFactory {
|
|
273
|
+
constructor(scope) {
|
|
305
274
|
this._uniqueFactoryName = void 0;
|
|
306
275
|
this.get = key => {
|
|
307
276
|
const normalizedKey = key.toLowerCase();
|
|
@@ -317,39 +286,30 @@ let UniqueIDFactory = function () {
|
|
|
317
286
|
}
|
|
318
287
|
this._uniqueFactoryName = `uid-${normalizedScope}-${UniqueIDFactory._factoryUniquenessCounter++}`;
|
|
319
288
|
}
|
|
320
|
-
|
|
321
|
-
_proto._hasValidIdChars = function _hasValidIdChars(value) {
|
|
289
|
+
_hasValidIdChars(value) {
|
|
322
290
|
if (typeof value !== "string") {
|
|
323
291
|
return false;
|
|
324
292
|
}
|
|
325
293
|
const invalidCharsReplaced = value.replace(/[^\d\w-]/g, "-");
|
|
326
294
|
return value === invalidCharsReplaced;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
}();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
330
297
|
UniqueIDFactory._factoryUniquenessCounter = 0;
|
|
331
298
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
var _proto = SsrIDFactory.prototype;
|
|
335
|
-
_proto.get = function get(id) {
|
|
299
|
+
class SsrIDFactory {
|
|
300
|
+
get(id) {
|
|
336
301
|
return id;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
}();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
340
304
|
SsrIDFactory.Default = new SsrIDFactory();
|
|
341
305
|
var SsrIDFactory$1 = SsrIDFactory.Default;
|
|
342
306
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
348
|
-
_this._idFactory = void 0;
|
|
349
|
-
return _this;
|
|
307
|
+
class UniqueIDProvider extends React.Component {
|
|
308
|
+
constructor(...args) {
|
|
309
|
+
super(...args);
|
|
310
|
+
this._idFactory = void 0;
|
|
350
311
|
}
|
|
351
|
-
|
|
352
|
-
_proto._performRender = function _performRender(firstRender) {
|
|
312
|
+
_performRender(firstRender) {
|
|
353
313
|
const {
|
|
354
314
|
children,
|
|
355
315
|
mockOnFirstRender,
|
|
@@ -365,22 +325,16 @@ let UniqueIDProvider = function (_React$Component) {
|
|
|
365
325
|
this._idFactory = new UniqueIDFactory(scope);
|
|
366
326
|
}
|
|
367
327
|
return children(this._idFactory);
|
|
368
|
-
}
|
|
369
|
-
|
|
328
|
+
}
|
|
329
|
+
render() {
|
|
370
330
|
return React.createElement(WithSSRPlaceholder, {
|
|
371
331
|
placeholder: () => this._performRender(true)
|
|
372
332
|
}, () => this._performRender(false));
|
|
373
|
-
};
|
|
374
|
-
return UniqueIDProvider;
|
|
375
|
-
}(React.Component);
|
|
376
|
-
|
|
377
|
-
let IDProvider = function (_React$Component) {
|
|
378
|
-
_inheritsLoose(IDProvider, _React$Component);
|
|
379
|
-
function IDProvider() {
|
|
380
|
-
return _React$Component.apply(this, arguments) || this;
|
|
381
333
|
}
|
|
382
|
-
|
|
383
|
-
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
class IDProvider extends React.Component {
|
|
337
|
+
renderChildren(ids) {
|
|
384
338
|
const {
|
|
385
339
|
id,
|
|
386
340
|
children
|
|
@@ -390,8 +344,8 @@ let IDProvider = function (_React$Component) {
|
|
|
390
344
|
throw new Error("Did not get an identifier factory nor a id prop");
|
|
391
345
|
}
|
|
392
346
|
return children(uniqueId);
|
|
393
|
-
}
|
|
394
|
-
|
|
347
|
+
}
|
|
348
|
+
render() {
|
|
395
349
|
const {
|
|
396
350
|
id,
|
|
397
351
|
scope
|
|
@@ -404,9 +358,8 @@ let IDProvider = function (_React$Component) {
|
|
|
404
358
|
mockOnFirstRender: true
|
|
405
359
|
}, ids => this.renderChildren(ids));
|
|
406
360
|
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
}(React.Component);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
410
363
|
IDProvider.defaultId = "wb-id";
|
|
411
364
|
|
|
412
365
|
let serverSide = false;
|
|
@@ -469,6 +422,12 @@ const useIsMounted = () => {
|
|
|
469
422
|
return React.useCallback(() => isMounted.current, []);
|
|
470
423
|
};
|
|
471
424
|
|
|
425
|
+
function useLatestRef(value) {
|
|
426
|
+
const ref = React.useRef(value);
|
|
427
|
+
ref.current = value;
|
|
428
|
+
return ref;
|
|
429
|
+
}
|
|
430
|
+
|
|
472
431
|
const useOnline = () => {
|
|
473
432
|
const forceUpdate = useForceUpdate();
|
|
474
433
|
useEffect$1(() => {
|
|
@@ -489,7 +448,7 @@ const {
|
|
|
489
448
|
} = React;
|
|
490
449
|
const RenderStateRoot = ({
|
|
491
450
|
children,
|
|
492
|
-
throwIfNested
|
|
451
|
+
throwIfNested: _throwIfNested = true
|
|
493
452
|
}) => {
|
|
494
453
|
const [firstRender, setFirstRender] = useState(true);
|
|
495
454
|
const renderState = useRenderState();
|
|
@@ -497,7 +456,7 @@ const RenderStateRoot = ({
|
|
|
497
456
|
setFirstRender(false);
|
|
498
457
|
}, []);
|
|
499
458
|
if (renderState !== RenderState.Root) {
|
|
500
|
-
if (
|
|
459
|
+
if (_throwIfNested) {
|
|
501
460
|
throw new Error("There's already a <RenderStateRoot> above this instance in " + "the render tree. This instance should be removed.");
|
|
502
461
|
}
|
|
503
462
|
return children;
|
|
@@ -507,8 +466,5 @@ const RenderStateRoot = ({
|
|
|
507
466
|
value: value
|
|
508
467
|
}, children);
|
|
509
468
|
};
|
|
510
|
-
RenderStateRoot.defaultProps = {
|
|
511
|
-
throwIfNested: true
|
|
512
|
-
};
|
|
513
469
|
|
|
514
|
-
export { IDProvider, RenderState, RenderStateRoot, server as Server, Text, UniqueIDProvider, View, WithSSRPlaceholder, addStyle, useForceUpdate, useIsMounted, useOnMountEffect, useOnline, useRenderState, useUniqueIdWithMock, useUniqueIdWithoutMock };
|
|
470
|
+
export { IDProvider, RenderState, RenderStateRoot, server as Server, Text, UniqueIDProvider, View, WithSSRPlaceholder, addStyle, useForceUpdate, useIsMounted, useLatestRef, useOnMountEffect, useOnline, useRenderState, useUniqueIdWithMock, useUniqueIdWithoutMock };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Return a ref that always contains the `value` passed.
|
|
4
|
+
*
|
|
5
|
+
* The useLatestRef hook returns a ref that always contains the `value` passed
|
|
6
|
+
* to the hook during the most recent render.
|
|
7
|
+
*
|
|
8
|
+
* It can be used to wrap a possibly-changing prop in a stable value that can
|
|
9
|
+
* be passed to useEffect without causing unnecessary re-renders. See the
|
|
10
|
+
* Storybook docs for a usage example.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useLatestRef<T>(value: T): React.RefObject<T>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for useLatestRef
|
|
3
|
+
* @flow
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Return a ref that always contains the `value` passed.
|
|
8
|
+
*
|
|
9
|
+
* The useLatestRef hook returns a ref that always contains the `value` passed
|
|
10
|
+
* to the hook during the most recent render.
|
|
11
|
+
*
|
|
12
|
+
* It can be used to wrap a possibly-changing prop in a stable value that can
|
|
13
|
+
* be passed to useEffect without causing unnecessary re-renders. See the
|
|
14
|
+
* Storybook docs for a usage example.
|
|
15
|
+
*/
|
|
16
|
+
declare export function useLatestRef<T>(value: T): {|current: T|};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Flowtype definitions for
|
|
2
|
+
* Flowtype definitions for data
|
|
3
3
|
* Generated by Flowgen from a Typescript Definition
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
import { RenderState } from "../components/render-state-context";
|
|
9
8
|
declare export var useRenderState: () => $ElementType<
|
|
10
9
|
typeof RenderState,
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { default as Server } from "./util/server";
|
|
|
9
9
|
export { useUniqueIdWithMock, useUniqueIdWithoutMock, } from "./hooks/use-unique-id";
|
|
10
10
|
export { useForceUpdate } from "./hooks/use-force-update";
|
|
11
11
|
export { useIsMounted } from "./hooks/use-is-mounted";
|
|
12
|
+
export { useLatestRef } from "./hooks/use-latest-ref";
|
|
12
13
|
export { useOnMountEffect } from "./hooks/use-on-mount-effect";
|
|
13
14
|
export { useOnline } from "./hooks/use-online";
|
|
14
15
|
export { useRenderState } from "./hooks/use-render-state";
|