isomorfeus-preact 10.6.14 → 10.6.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isomorfeus-preact.rb +3 -3
  3. data/lib/isomorfeus_preact/lucid_component/api.rb +1 -1
  4. data/lib/isomorfeus_preact/lucid_component/initializer.rb +2 -2
  5. data/lib/isomorfeus_preact/lucid_func/initializer.rb +1 -1
  6. data/lib/isomorfeus_preact/preact/function_component/initializer.rb +1 -1
  7. data/lib/preact/component/api.rb +1 -1
  8. data/lib/preact/component/callbacks.rb +6 -6
  9. data/lib/preact/component/initializer.rb +2 -2
  10. data/lib/preact/component/native_component_constructor.rb +1 -1
  11. data/lib/preact/props.rb +51 -0
  12. data/lib/preact/state.rb +67 -0
  13. data/lib/preact/version.rb +1 -1
  14. data/lib/preact.rb +2 -2
  15. data/node_modules/.package-lock.json +3 -3
  16. data/node_modules/preact/LICENSE +21 -21
  17. data/node_modules/preact/README.md +187 -187
  18. data/node_modules/preact/compat/dist/compat.js +1 -1
  19. data/node_modules/preact/compat/dist/compat.js.map +1 -1
  20. data/node_modules/preact/compat/dist/compat.mjs +1 -1
  21. data/node_modules/preact/compat/dist/compat.module.js +1 -1
  22. data/node_modules/preact/compat/dist/compat.module.js.map +1 -1
  23. data/node_modules/preact/compat/dist/compat.umd.js +1 -1
  24. data/node_modules/preact/compat/dist/compat.umd.js.map +1 -1
  25. data/node_modules/preact/compat/jsx-dev-runtime.js +1 -1
  26. data/node_modules/preact/compat/jsx-dev-runtime.mjs +1 -1
  27. data/node_modules/preact/compat/jsx-runtime.js +1 -1
  28. data/node_modules/preact/compat/jsx-runtime.mjs +1 -1
  29. data/node_modules/preact/compat/package.json +19 -19
  30. data/node_modules/preact/compat/scheduler.js +15 -15
  31. data/node_modules/preact/compat/scheduler.mjs +23 -23
  32. data/node_modules/preact/compat/server.js +15 -15
  33. data/node_modules/preact/compat/server.mjs +4 -4
  34. data/node_modules/preact/compat/src/Children.js +21 -21
  35. data/node_modules/preact/compat/src/PureComponent.js +15 -15
  36. data/node_modules/preact/compat/src/forwardRef.js +51 -51
  37. data/node_modules/preact/compat/src/index.d.ts +141 -141
  38. data/node_modules/preact/compat/src/index.js +187 -187
  39. data/node_modules/preact/compat/src/internal.d.ts +47 -47
  40. data/node_modules/preact/compat/src/memo.js +34 -34
  41. data/node_modules/preact/compat/src/portals.js +80 -80
  42. data/node_modules/preact/compat/src/render.js +229 -230
  43. data/node_modules/preact/compat/src/suspense-list.d.ts +14 -14
  44. data/node_modules/preact/compat/src/suspense-list.js +126 -126
  45. data/node_modules/preact/compat/src/suspense.d.ts +15 -15
  46. data/node_modules/preact/compat/src/suspense.js +270 -270
  47. data/node_modules/preact/compat/src/util.js +28 -28
  48. data/node_modules/preact/compat/test-utils.js +1 -1
  49. data/node_modules/preact/debug/dist/debug.js.map +1 -1
  50. data/node_modules/preact/debug/dist/debug.module.js.map +1 -1
  51. data/node_modules/preact/debug/dist/debug.umd.js.map +1 -1
  52. data/node_modules/preact/debug/package.json +18 -18
  53. data/node_modules/preact/debug/src/check-props.js +54 -54
  54. data/node_modules/preact/debug/src/component-stack.js +146 -146
  55. data/node_modules/preact/debug/src/constants.js +3 -3
  56. data/node_modules/preact/debug/src/debug.js +442 -442
  57. data/node_modules/preact/debug/src/index.js +6 -6
  58. data/node_modules/preact/debug/src/internal.d.ts +82 -82
  59. data/node_modules/preact/debug/src/util.js +11 -11
  60. data/node_modules/preact/devtools/dist/devtools.js +1 -1
  61. data/node_modules/preact/devtools/dist/devtools.js.map +1 -1
  62. data/node_modules/preact/devtools/dist/devtools.mjs +1 -1
  63. data/node_modules/preact/devtools/dist/devtools.module.js +1 -1
  64. data/node_modules/preact/devtools/dist/devtools.module.js.map +1 -1
  65. data/node_modules/preact/devtools/dist/devtools.umd.js +1 -1
  66. data/node_modules/preact/devtools/dist/devtools.umd.js.map +1 -1
  67. data/node_modules/preact/devtools/package.json +16 -16
  68. data/node_modules/preact/devtools/src/devtools.js +10 -10
  69. data/node_modules/preact/devtools/src/index.d.ts +8 -8
  70. data/node_modules/preact/devtools/src/index.js +15 -15
  71. data/node_modules/preact/dist/preact.js.map +1 -1
  72. data/node_modules/preact/dist/preact.min.js.map +1 -1
  73. data/node_modules/preact/dist/preact.module.js.map +1 -1
  74. data/node_modules/preact/dist/preact.umd.js.map +1 -1
  75. data/node_modules/preact/hooks/dist/hooks.js +1 -1
  76. data/node_modules/preact/hooks/dist/hooks.js.map +1 -1
  77. data/node_modules/preact/hooks/dist/hooks.mjs +1 -1
  78. data/node_modules/preact/hooks/dist/hooks.module.js +1 -1
  79. data/node_modules/preact/hooks/dist/hooks.module.js.map +1 -1
  80. data/node_modules/preact/hooks/dist/hooks.umd.js +1 -1
  81. data/node_modules/preact/hooks/dist/hooks.umd.js.map +1 -1
  82. data/node_modules/preact/hooks/package.json +26 -26
  83. data/node_modules/preact/hooks/src/index.d.ts +139 -139
  84. data/node_modules/preact/hooks/src/index.js +386 -388
  85. data/node_modules/preact/hooks/src/internal.d.ts +75 -75
  86. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -1
  87. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -1
  88. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
  89. data/node_modules/preact/jsx-runtime/package.json +19 -19
  90. data/node_modules/preact/jsx-runtime/src/index.d.ts +50 -50
  91. data/node_modules/preact/jsx-runtime/src/index.js +77 -77
  92. data/node_modules/preact/package.json +291 -287
  93. data/node_modules/preact/src/cjs.js +3 -3
  94. data/node_modules/preact/src/clone-element.js +34 -34
  95. data/node_modules/preact/src/component.js +225 -225
  96. data/node_modules/preact/src/constants.js +3 -3
  97. data/node_modules/preact/src/create-context.js +68 -68
  98. data/node_modules/preact/src/create-element.js +98 -98
  99. data/node_modules/preact/src/diff/catch-error.js +38 -38
  100. data/node_modules/preact/src/diff/children.js +335 -335
  101. data/node_modules/preact/src/diff/index.js +516 -516
  102. data/node_modules/preact/src/diff/props.js +158 -158
  103. data/node_modules/preact/src/index.d.ts +310 -310
  104. data/node_modules/preact/src/index.js +13 -13
  105. data/node_modules/preact/src/internal.d.ts +146 -146
  106. data/node_modules/preact/src/jsx.d.ts +1005 -1005
  107. data/node_modules/preact/src/options.js +16 -16
  108. data/node_modules/preact/src/render.js +75 -75
  109. data/node_modules/preact/src/util.js +27 -27
  110. data/node_modules/preact/test-utils/dist/testUtils.js.map +1 -1
  111. data/node_modules/preact/test-utils/dist/testUtils.module.js.map +1 -1
  112. data/node_modules/preact/test-utils/dist/testUtils.umd.js.map +1 -1
  113. data/node_modules/preact/test-utils/package.json +19 -19
  114. data/node_modules/preact/test-utils/src/index.d.ts +3 -3
  115. data/node_modules/preact/test-utils/src/index.js +117 -117
  116. data/package.json +1 -1
  117. metadata +4 -4
  118. data/lib/preact/component/props.rb +0 -55
  119. data/lib/preact/component/state.rb +0 -58
@@ -1,126 +1,126 @@
1
- import { Component, toChildArray } from 'preact';
2
- import { suspended } from './suspense.js';
3
-
4
- // Indexes to linked list nodes (nodes are stored as arrays to save bytes).
5
- const SUSPENDED_COUNT = 0;
6
- const RESOLVED_COUNT = 1;
7
- const NEXT_NODE = 2;
8
-
9
- // Having custom inheritance instead of a class here saves a lot of bytes.
10
- export function SuspenseList() {
11
- this._next = null;
12
- this._map = null;
13
- }
14
-
15
- // Mark one of child's earlier suspensions as resolved.
16
- // Some pending callbacks may become callable due to this
17
- // (e.g. the last suspended descendant gets resolved when
18
- // revealOrder === 'together'). Process those callbacks as well.
19
- const resolve = (list, child, node) => {
20
- if (++node[RESOLVED_COUNT] === node[SUSPENDED_COUNT]) {
21
- // The number a child (or any of its descendants) has been suspended
22
- // matches the number of times it's been resolved. Therefore we
23
- // mark the child as completely resolved by deleting it from ._map.
24
- // This is used to figure out when *all* children have been completely
25
- // resolved when revealOrder is 'together'.
26
- list._map.delete(child);
27
- }
28
-
29
- // If revealOrder is falsy then we can do an early exit, as the
30
- // callbacks won't get queued in the node anyway.
31
- // If revealOrder is 'together' then also do an early exit
32
- // if all suspended descendants have not yet been resolved.
33
- if (
34
- !list.props.revealOrder ||
35
- (list.props.revealOrder[0] === 't' && list._map.size)
36
- ) {
37
- return;
38
- }
39
-
40
- // Walk the currently suspended children in order, calling their
41
- // stored callbacks on the way. Stop if we encounter a child that
42
- // has not been completely resolved yet.
43
- node = list._next;
44
- while (node) {
45
- while (node.length > 3) {
46
- node.pop()();
47
- }
48
- if (node[RESOLVED_COUNT] < node[SUSPENDED_COUNT]) {
49
- break;
50
- }
51
- list._next = node = node[NEXT_NODE];
52
- }
53
- };
54
-
55
- // Things we do here to save some bytes but are not proper JS inheritance:
56
- // - call `new Component()` as the prototype
57
- // - do not set `Suspense.prototype.constructor` to `Suspense`
58
- SuspenseList.prototype = new Component();
59
-
60
- SuspenseList.prototype._suspended = function(child) {
61
- const list = this;
62
- const delegated = suspended(list._vnode);
63
-
64
- let node = list._map.get(child);
65
- node[SUSPENDED_COUNT]++;
66
-
67
- return unsuspend => {
68
- const wrappedUnsuspend = () => {
69
- if (!list.props.revealOrder) {
70
- // Special case the undefined (falsy) revealOrder, as there
71
- // is no need to coordinate a specific order or unsuspends.
72
- unsuspend();
73
- } else {
74
- node.push(unsuspend);
75
- resolve(list, child, node);
76
- }
77
- };
78
- if (delegated) {
79
- delegated(wrappedUnsuspend);
80
- } else {
81
- wrappedUnsuspend();
82
- }
83
- };
84
- };
85
-
86
- SuspenseList.prototype.render = function(props) {
87
- this._next = null;
88
- this._map = new Map();
89
-
90
- const children = toChildArray(props.children);
91
- if (props.revealOrder && props.revealOrder[0] === 'b') {
92
- // If order === 'backwards' (or, well, anything starting with a 'b')
93
- // then flip the child list around so that the last child will be
94
- // the first in the linked list.
95
- children.reverse();
96
- }
97
- // Build the linked list. Iterate through the children in reverse order
98
- // so that `_next` points to the first linked list node to be resolved.
99
- for (let i = children.length; i--; ) {
100
- // Create a new linked list node as an array of form:
101
- // [suspended_count, resolved_count, next_node]
102
- // where suspended_count and resolved_count are numeric counters for
103
- // keeping track how many times a node has been suspended and resolved.
104
- //
105
- // Note that suspended_count starts from 1 instead of 0, so we can block
106
- // processing callbacks until componentDidMount has been called. In a sense
107
- // node is suspended at least until componentDidMount gets called!
108
- //
109
- // Pending callbacks are added to the end of the node:
110
- // [suspended_count, resolved_count, next_node, callback_0, callback_1, ...]
111
- this._map.set(children[i], (this._next = [1, 0, this._next]));
112
- }
113
- return props.children;
114
- };
115
-
116
- SuspenseList.prototype.componentDidUpdate = SuspenseList.prototype.componentDidMount = function() {
117
- // Iterate through all children after mounting for two reasons:
118
- // 1. As each node[SUSPENDED_COUNT] starts from 1, this iteration increases
119
- // each node[RELEASED_COUNT] by 1, therefore balancing the counters.
120
- // The nodes can now be completely consumed from the linked list.
121
- // 2. Handle nodes that might have gotten resolved between render and
122
- // componentDidMount.
123
- this._map.forEach((node, child) => {
124
- resolve(this, child, node);
125
- });
126
- };
1
+ import { Component, toChildArray } from 'preact';
2
+ import { suspended } from './suspense.js';
3
+
4
+ // Indexes to linked list nodes (nodes are stored as arrays to save bytes).
5
+ const SUSPENDED_COUNT = 0;
6
+ const RESOLVED_COUNT = 1;
7
+ const NEXT_NODE = 2;
8
+
9
+ // Having custom inheritance instead of a class here saves a lot of bytes.
10
+ export function SuspenseList() {
11
+ this._next = null;
12
+ this._map = null;
13
+ }
14
+
15
+ // Mark one of child's earlier suspensions as resolved.
16
+ // Some pending callbacks may become callable due to this
17
+ // (e.g. the last suspended descendant gets resolved when
18
+ // revealOrder === 'together'). Process those callbacks as well.
19
+ const resolve = (list, child, node) => {
20
+ if (++node[RESOLVED_COUNT] === node[SUSPENDED_COUNT]) {
21
+ // The number a child (or any of its descendants) has been suspended
22
+ // matches the number of times it's been resolved. Therefore we
23
+ // mark the child as completely resolved by deleting it from ._map.
24
+ // This is used to figure out when *all* children have been completely
25
+ // resolved when revealOrder is 'together'.
26
+ list._map.delete(child);
27
+ }
28
+
29
+ // If revealOrder is falsy then we can do an early exit, as the
30
+ // callbacks won't get queued in the node anyway.
31
+ // If revealOrder is 'together' then also do an early exit
32
+ // if all suspended descendants have not yet been resolved.
33
+ if (
34
+ !list.props.revealOrder ||
35
+ (list.props.revealOrder[0] === 't' && list._map.size)
36
+ ) {
37
+ return;
38
+ }
39
+
40
+ // Walk the currently suspended children in order, calling their
41
+ // stored callbacks on the way. Stop if we encounter a child that
42
+ // has not been completely resolved yet.
43
+ node = list._next;
44
+ while (node) {
45
+ while (node.length > 3) {
46
+ node.pop()();
47
+ }
48
+ if (node[RESOLVED_COUNT] < node[SUSPENDED_COUNT]) {
49
+ break;
50
+ }
51
+ list._next = node = node[NEXT_NODE];
52
+ }
53
+ };
54
+
55
+ // Things we do here to save some bytes but are not proper JS inheritance:
56
+ // - call `new Component()` as the prototype
57
+ // - do not set `Suspense.prototype.constructor` to `Suspense`
58
+ SuspenseList.prototype = new Component();
59
+
60
+ SuspenseList.prototype._suspended = function(child) {
61
+ const list = this;
62
+ const delegated = suspended(list._vnode);
63
+
64
+ let node = list._map.get(child);
65
+ node[SUSPENDED_COUNT]++;
66
+
67
+ return unsuspend => {
68
+ const wrappedUnsuspend = () => {
69
+ if (!list.props.revealOrder) {
70
+ // Special case the undefined (falsy) revealOrder, as there
71
+ // is no need to coordinate a specific order or unsuspends.
72
+ unsuspend();
73
+ } else {
74
+ node.push(unsuspend);
75
+ resolve(list, child, node);
76
+ }
77
+ };
78
+ if (delegated) {
79
+ delegated(wrappedUnsuspend);
80
+ } else {
81
+ wrappedUnsuspend();
82
+ }
83
+ };
84
+ };
85
+
86
+ SuspenseList.prototype.render = function(props) {
87
+ this._next = null;
88
+ this._map = new Map();
89
+
90
+ const children = toChildArray(props.children);
91
+ if (props.revealOrder && props.revealOrder[0] === 'b') {
92
+ // If order === 'backwards' (or, well, anything starting with a 'b')
93
+ // then flip the child list around so that the last child will be
94
+ // the first in the linked list.
95
+ children.reverse();
96
+ }
97
+ // Build the linked list. Iterate through the children in reverse order
98
+ // so that `_next` points to the first linked list node to be resolved.
99
+ for (let i = children.length; i--; ) {
100
+ // Create a new linked list node as an array of form:
101
+ // [suspended_count, resolved_count, next_node]
102
+ // where suspended_count and resolved_count are numeric counters for
103
+ // keeping track how many times a node has been suspended and resolved.
104
+ //
105
+ // Note that suspended_count starts from 1 instead of 0, so we can block
106
+ // processing callbacks until componentDidMount has been called. In a sense
107
+ // node is suspended at least until componentDidMount gets called!
108
+ //
109
+ // Pending callbacks are added to the end of the node:
110
+ // [suspended_count, resolved_count, next_node, callback_0, callback_1, ...]
111
+ this._map.set(children[i], (this._next = [1, 0, this._next]));
112
+ }
113
+ return props.children;
114
+ };
115
+
116
+ SuspenseList.prototype.componentDidUpdate = SuspenseList.prototype.componentDidMount = function() {
117
+ // Iterate through all children after mounting for two reasons:
118
+ // 1. As each node[SUSPENDED_COUNT] starts from 1, this iteration increases
119
+ // each node[RELEASED_COUNT] by 1, therefore balancing the counters.
120
+ // The nodes can now be completely consumed from the linked list.
121
+ // 2. Handle nodes that might have gotten resolved between render and
122
+ // componentDidMount.
123
+ this._map.forEach((node, child) => {
124
+ resolve(this, child, node);
125
+ });
126
+ };
@@ -1,15 +1,15 @@
1
- import { Component, ComponentChild, ComponentChildren } from '../../src';
2
-
3
- //
4
- // Suspense/lazy
5
- // -----------------------------------
6
- export function lazy<T>(loader: () => Promise<{ default: T } | T>): T;
7
-
8
- export interface SuspenseProps {
9
- children?: ComponentChildren;
10
- fallback: ComponentChildren;
11
- }
12
-
13
- export class Suspense extends Component<SuspenseProps> {
14
- render(): ComponentChild;
15
- }
1
+ import { Component, ComponentChild, ComponentChildren } from '../../src';
2
+
3
+ //
4
+ // Suspense/lazy
5
+ // -----------------------------------
6
+ export function lazy<T>(loader: () => Promise<{ default: T } | T>): T;
7
+
8
+ export interface SuspenseProps {
9
+ children?: ComponentChildren;
10
+ fallback: ComponentChildren;
11
+ }
12
+
13
+ export class Suspense extends Component<SuspenseProps> {
14
+ render(): ComponentChild;
15
+ }