govuk_publishing_components 12.19.0 → 12.20.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.
- checksums.yaml +4 -4
- data/app/views/govuk_publishing_components/components/_error_alert.html.erb +2 -1
- data/app/views/govuk_publishing_components/components/_error_summary.html.erb +10 -9
- data/app/views/govuk_publishing_components/components/docs/error_alert.yml +6 -0
- data/app/views/govuk_publishing_components/components/docs/error_summary.yml +8 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/preact/README.md +14 -2
- data/node_modules/preact/dist/preact.d.ts +26 -10
- data/node_modules/preact/dist/preact.dev.js +21 -12
- data/node_modules/preact/dist/preact.dev.js.map +1 -1
- data/node_modules/preact/dist/preact.js +17 -11
- data/node_modules/preact/dist/preact.js.flow +14 -2
- data/node_modules/preact/dist/preact.js.map +1 -1
- data/node_modules/preact/dist/preact.min.js +1 -1
- data/node_modules/preact/dist/preact.min.js.map +1 -1
- data/node_modules/preact/dist/preact.mjs +22 -13
- data/node_modules/preact/dist/preact.mjs.map +1 -1
- data/node_modules/preact/package.json +31 -40
- data/node_modules/preact/src/dom/index.js +3 -2
- data/node_modules/preact/src/preact.d.ts +26 -10
- data/node_modules/preact/src/preact.js +6 -0
- data/node_modules/preact/src/preact.js.flow +14 -2
- data/node_modules/preact/src/render-queue.js +2 -3
- data/node_modules/preact/src/util.js +11 -0
- data/node_modules/preact/src/vdom/component.js +5 -5
- data/node_modules/preact/src/vdom/diff.js +3 -2
- metadata +2 -2
@@ -10,6 +10,17 @@ export function extend(obj, props) {
|
|
10
10
|
return obj;
|
11
11
|
}
|
12
12
|
|
13
|
+
/** Invoke or update a ref, depending on whether it is a function or object ref.
|
14
|
+
* @param {object|function} [ref=null]
|
15
|
+
* @param {any} [value]
|
16
|
+
*/
|
17
|
+
export function applyRef(ref, value) {
|
18
|
+
if (ref!=null) {
|
19
|
+
if (typeof ref=='function') ref(value);
|
20
|
+
else ref.current = value;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
13
24
|
/**
|
14
25
|
* Call a function asynchronously, as soon as possible. Makes
|
15
26
|
* use of HTML Promise to schedule the callback if available,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { SYNC_RENDER, NO_RENDER, FORCE_RENDER, ASYNC_RENDER, ATTR_KEY } from '../constants';
|
2
2
|
import options from '../options';
|
3
|
-
import { extend } from '../util';
|
3
|
+
import { extend, applyRef } from '../util';
|
4
4
|
import { enqueueRender } from '../render-queue';
|
5
5
|
import { getNodeProps } from './index';
|
6
6
|
import { diff, mounts, diffLevel, flushMounts, recollectNodeTree, removeChildren } from './diff';
|
@@ -52,7 +52,7 @@ export function setComponentProps(component, props, renderMode, context, mountAl
|
|
52
52
|
}
|
53
53
|
}
|
54
54
|
|
55
|
-
|
55
|
+
applyRef(component.__ref, component);
|
56
56
|
}
|
57
57
|
|
58
58
|
|
@@ -189,7 +189,7 @@ export function renderComponent(component, renderMode, mountAll, isChild) {
|
|
189
189
|
}
|
190
190
|
|
191
191
|
if (!isUpdate || mountAll) {
|
192
|
-
mounts.
|
192
|
+
mounts.push(component);
|
193
193
|
}
|
194
194
|
else if (!skip) {
|
195
195
|
// Ensure that pending componentDidMount() hooks of child components
|
@@ -282,7 +282,7 @@ export function unmountComponent(component) {
|
|
282
282
|
unmountComponent(inner);
|
283
283
|
}
|
284
284
|
else if (base) {
|
285
|
-
if (base[ATTR_KEY]
|
285
|
+
if (base[ATTR_KEY]!=null) applyRef(base[ATTR_KEY].ref, null);
|
286
286
|
|
287
287
|
component.nextBase = base;
|
288
288
|
|
@@ -292,5 +292,5 @@ export function unmountComponent(component) {
|
|
292
292
|
removeChildren(base);
|
293
293
|
}
|
294
294
|
|
295
|
-
|
295
|
+
applyRef(component.__ref, null);
|
296
296
|
}
|
@@ -4,6 +4,7 @@ import { buildComponentFromVNode } from './component';
|
|
4
4
|
import { createNode, setAccessor } from '../dom/index';
|
5
5
|
import { unmountComponent } from './component';
|
6
6
|
import options from '../options';
|
7
|
+
import { applyRef } from '../util';
|
7
8
|
import { removeNode } from '../dom/index';
|
8
9
|
|
9
10
|
/**
|
@@ -24,7 +25,7 @@ let hydrating = false;
|
|
24
25
|
/** Invoke queued componentDidMount lifecycle methods */
|
25
26
|
export function flushMounts() {
|
26
27
|
let c;
|
27
|
-
while ((c=mounts.
|
28
|
+
while ((c = mounts.shift())) {
|
28
29
|
if (options.afterMount) options.afterMount(c);
|
29
30
|
if (c.componentDidMount) c.componentDidMount();
|
30
31
|
}
|
@@ -284,7 +285,7 @@ export function recollectNodeTree(node, unmountOnly) {
|
|
284
285
|
else {
|
285
286
|
// If the node's VNode had a ref function, invoke it with null here.
|
286
287
|
// (this is part of the React spec, and smart for unsetting references)
|
287
|
-
if (node[ATTR_KEY]!=null
|
288
|
+
if (node[ATTR_KEY]!=null) applyRef(node[ATTR_KEY].ref, null);
|
288
289
|
|
289
290
|
if (unmountOnly===false || node[ATTR_KEY]==null) {
|
290
291
|
removeNode(node);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.
|
4
|
+
version: 12.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govspeak
|