@faiwer/react 0.8.3 → 0.9.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.
Files changed (239) hide show
  1. package/README.md +20 -14
  2. package/dist/core/Children.d.ts +11 -0
  3. package/dist/core/Children.d.ts.map +1 -0
  4. package/dist/core/Children.js +35 -0
  5. package/dist/core/Children.js.map +1 -0
  6. package/dist/core/actions/applyAction.d.ts.map +1 -1
  7. package/dist/core/actions/applyAction.js +2 -0
  8. package/dist/core/actions/applyAction.js.map +1 -1
  9. package/dist/core/actions/createComment.action.d.ts +2 -2
  10. package/dist/core/actions/createComment.action.d.ts.map +1 -1
  11. package/dist/core/actions/createComment.action.js +1 -8
  12. package/dist/core/actions/createComment.action.js.map +1 -1
  13. package/dist/core/actions/createContainer.action.d.ts +7 -0
  14. package/dist/core/actions/createContainer.action.d.ts.map +1 -0
  15. package/dist/core/actions/createContainer.action.js +28 -0
  16. package/dist/core/actions/createContainer.action.js.map +1 -0
  17. package/dist/core/actions/createTag.action.d.ts +2 -1
  18. package/dist/core/actions/createTag.action.d.ts.map +1 -1
  19. package/dist/core/actions/createTag.action.js +107 -5
  20. package/dist/core/actions/createTag.action.js.map +1 -1
  21. package/dist/core/actions/createText.action.d.ts.map +1 -1
  22. package/dist/core/actions/createText.action.js +2 -5
  23. package/dist/core/actions/createText.action.js.map +1 -1
  24. package/dist/core/actions/dom/attributes.d.ts +4 -0
  25. package/dist/core/actions/dom/attributes.d.ts.map +1 -0
  26. package/dist/core/actions/dom/attributes.js +56 -0
  27. package/dist/core/actions/dom/attributes.js.map +1 -0
  28. package/dist/core/actions/dom/css.d.ts +6 -0
  29. package/dist/core/actions/dom/css.d.ts.map +1 -0
  30. package/dist/core/actions/dom/css.js +54 -0
  31. package/dist/core/actions/dom/css.js.map +1 -0
  32. package/dist/core/actions/dom/events.d.ts +3 -0
  33. package/dist/core/actions/dom/events.d.ts.map +1 -0
  34. package/dist/core/actions/dom/events.js +45 -0
  35. package/dist/core/actions/dom/events.js.map +1 -0
  36. package/dist/core/actions/dom/svg.d.ts +7 -0
  37. package/dist/core/actions/dom/svg.d.ts.map +1 -0
  38. package/dist/core/actions/dom/svg.js +76 -0
  39. package/dist/core/actions/dom/svg.js.map +1 -0
  40. package/dist/core/actions/dom/value.d.ts +17 -0
  41. package/dist/core/actions/dom/value.d.ts.map +1 -0
  42. package/dist/core/actions/dom/value.js +204 -0
  43. package/dist/core/actions/dom/value.js.map +1 -0
  44. package/dist/core/actions/helpers.d.ts +18 -11
  45. package/dist/core/actions/helpers.d.ts.map +1 -1
  46. package/dist/core/actions/helpers.js +78 -68
  47. package/dist/core/actions/helpers.js.map +1 -1
  48. package/dist/core/actions/relayout.action.d.ts +2 -1
  49. package/dist/core/actions/relayout.action.d.ts.map +1 -1
  50. package/dist/core/actions/relayout.action.js +119 -30
  51. package/dist/core/actions/relayout.action.js.map +1 -1
  52. package/dist/core/actions/remove.action.d.ts +3 -2
  53. package/dist/core/actions/remove.action.d.ts.map +1 -1
  54. package/dist/core/actions/remove.action.js +22 -18
  55. package/dist/core/actions/remove.action.js.map +1 -1
  56. package/dist/core/actions/replace.action.d.ts +1 -1
  57. package/dist/core/actions/replace.action.d.ts.map +1 -1
  58. package/dist/core/actions/replace.action.js +36 -11
  59. package/dist/core/actions/replace.action.js.map +1 -1
  60. package/dist/core/actions/setAttr.action.d.ts +1 -1
  61. package/dist/core/actions/setAttr.action.d.ts.map +1 -1
  62. package/dist/core/actions/setAttr.action.js +55 -87
  63. package/dist/core/actions/setAttr.action.js.map +1 -1
  64. package/dist/core/actions/setProps.action.d.ts.map +1 -1
  65. package/dist/core/actions/setProps.action.js +2 -1
  66. package/dist/core/actions/setProps.action.js.map +1 -1
  67. package/dist/core/actions/setRef.action.d.ts +1 -1
  68. package/dist/core/actions/setRef.action.d.ts.map +1 -1
  69. package/dist/core/actions/setRef.action.js +5 -6
  70. package/dist/core/actions/setRef.action.js.map +1 -1
  71. package/dist/core/actions/setText.action.d.ts.map +1 -1
  72. package/dist/core/actions/setText.action.js +3 -3
  73. package/dist/core/actions/setText.action.js.map +1 -1
  74. package/dist/core/classComponent.d.ts +33 -0
  75. package/dist/core/classComponent.d.ts.map +1 -0
  76. package/dist/core/classComponent.js +127 -0
  77. package/dist/core/classComponent.js.map +1 -0
  78. package/dist/core/compact.d.ts +10 -29
  79. package/dist/core/compact.d.ts.map +1 -1
  80. package/dist/core/compact.js +12 -100
  81. package/dist/core/compact.js.map +1 -1
  82. package/dist/core/components.d.ts +2 -2
  83. package/dist/core/components.d.ts.map +1 -1
  84. package/dist/core/components.js +22 -5
  85. package/dist/core/components.js.map +1 -1
  86. package/dist/core/createElement.d.ts +9 -9
  87. package/dist/core/createElement.d.ts.map +1 -1
  88. package/dist/core/createElement.js +19 -3
  89. package/dist/core/createElement.js.map +1 -1
  90. package/dist/core/createRoot.js.map +1 -1
  91. package/dist/core/reactNodeToFiberNode.d.ts.map +1 -1
  92. package/dist/core/reactNodeToFiberNode.js +6 -1
  93. package/dist/core/reactNodeToFiberNode.js.map +1 -1
  94. package/dist/core/reconciliation/app.js +3 -3
  95. package/dist/core/reconciliation/app.js.map +1 -1
  96. package/dist/core/reconciliation/collect/fromApp.d.ts.map +1 -1
  97. package/dist/core/reconciliation/collect/fromApp.js +3 -27
  98. package/dist/core/reconciliation/collect/fromApp.js.map +1 -1
  99. package/dist/core/reconciliation/collect/fromChildrenPair.d.ts.map +1 -1
  100. package/dist/core/reconciliation/collect/fromChildrenPair.js +24 -15
  101. package/dist/core/reconciliation/collect/fromChildrenPair.js.map +1 -1
  102. package/dist/core/reconciliation/collect/fromComponent.d.ts +2 -2
  103. package/dist/core/reconciliation/collect/fromComponent.d.ts.map +1 -1
  104. package/dist/core/reconciliation/collect/fromComponent.js +4 -8
  105. package/dist/core/reconciliation/collect/fromComponent.js.map +1 -1
  106. package/dist/core/reconciliation/collect/fromFiberPair.d.ts.map +1 -1
  107. package/dist/core/reconciliation/collect/fromFiberPair.js +6 -4
  108. package/dist/core/reconciliation/collect/fromFiberPair.js.map +1 -1
  109. package/dist/core/reconciliation/collect/fromNewFiber.d.ts.map +1 -1
  110. package/dist/core/reconciliation/collect/fromNewFiber.js +7 -15
  111. package/dist/core/reconciliation/collect/fromNewFiber.js.map +1 -1
  112. package/dist/core/reconciliation/effects.d.ts.map +1 -1
  113. package/dist/core/reconciliation/effects.js +0 -5
  114. package/dist/core/reconciliation/effects.js.map +1 -1
  115. package/dist/core/reconciliation/errors/ReactError.d.ts +7 -0
  116. package/dist/core/reconciliation/errors/ReactError.d.ts.map +1 -0
  117. package/dist/core/reconciliation/errors/ReactError.js +26 -0
  118. package/dist/core/reconciliation/errors/ReactError.js.map +1 -0
  119. package/dist/core/reconciliation/errors/stack.d.ts +9 -0
  120. package/dist/core/reconciliation/errors/stack.d.ts.map +1 -0
  121. package/dist/core/reconciliation/errors/stack.js +80 -0
  122. package/dist/core/reconciliation/errors/stack.js.map +1 -0
  123. package/dist/core/reconciliation/fibers.d.ts +7 -0
  124. package/dist/core/reconciliation/fibers.d.ts.map +1 -1
  125. package/dist/core/reconciliation/fibers.js +9 -2
  126. package/dist/core/reconciliation/fibers.js.map +1 -1
  127. package/dist/core/reconciliation/heap.d.ts +18 -0
  128. package/dist/core/reconciliation/heap.d.ts.map +1 -0
  129. package/dist/core/reconciliation/heap.js +81 -0
  130. package/dist/core/reconciliation/heap.js.map +1 -0
  131. package/dist/core/reconciliation/invalidateFiber.d.ts.map +1 -1
  132. package/dist/core/reconciliation/invalidateFiber.js +10 -4
  133. package/dist/core/reconciliation/invalidateFiber.js.map +1 -1
  134. package/dist/core/reconciliation/mount.d.ts.map +1 -1
  135. package/dist/core/reconciliation/mount.js +17 -7
  136. package/dist/core/reconciliation/mount.js.map +1 -1
  137. package/dist/core/reconciliation/postCommit.d.ts +1 -1
  138. package/dist/core/reconciliation/postCommit.d.ts.map +1 -1
  139. package/dist/core/reconciliation/postCommit.js +19 -4
  140. package/dist/core/reconciliation/postCommit.js.map +1 -1
  141. package/dist/core/reconciliation/queue.d.ts +21 -0
  142. package/dist/core/reconciliation/queue.d.ts.map +1 -0
  143. package/dist/core/reconciliation/queue.js +55 -0
  144. package/dist/core/reconciliation/queue.js.map +1 -0
  145. package/dist/core/reconciliation/render.js +5 -5
  146. package/dist/core/reconciliation/render.js.map +1 -1
  147. package/dist/core/reconciliation/runFiberComponents.d.ts.map +1 -1
  148. package/dist/core/reconciliation/runFiberComponents.js +2 -1
  149. package/dist/core/reconciliation/runFiberComponents.js.map +1 -1
  150. package/dist/core/reconciliation/typeGuards.d.ts +9 -1
  151. package/dist/core/reconciliation/typeGuards.d.ts.map +1 -1
  152. package/dist/core/reconciliation/typeGuards.js +25 -0
  153. package/dist/core/reconciliation/typeGuards.js.map +1 -1
  154. package/dist/core/reconciliation/validateApp.d.ts +3 -0
  155. package/dist/core/reconciliation/validateApp.d.ts.map +1 -0
  156. package/dist/core/reconciliation/validateApp.js +74 -0
  157. package/dist/core/reconciliation/validateApp.js.map +1 -0
  158. package/dist/hooks/helpers.d.ts +2 -2
  159. package/dist/hooks/helpers.d.ts.map +1 -1
  160. package/dist/hooks/helpers.js +3 -2
  161. package/dist/hooks/helpers.js.map +1 -1
  162. package/dist/hooks/index.d.ts +1 -1
  163. package/dist/hooks/index.d.ts.map +1 -1
  164. package/dist/hooks/index.js +1 -1
  165. package/dist/hooks/index.js.map +1 -1
  166. package/dist/hooks/useContext.d.ts.map +1 -1
  167. package/dist/hooks/useContext.js +16 -0
  168. package/dist/hooks/useContext.js.map +1 -1
  169. package/dist/hooks/useEffect.d.ts +2 -1
  170. package/dist/hooks/useEffect.d.ts.map +1 -1
  171. package/dist/hooks/useEffect.js +1 -1
  172. package/dist/hooks/useEffect.js.map +1 -1
  173. package/dist/hooks/useRef.d.ts +8 -3
  174. package/dist/hooks/useRef.d.ts.map +1 -1
  175. package/dist/hooks/useRef.js +27 -0
  176. package/dist/hooks/useRef.js.map +1 -1
  177. package/dist/hooks/useState.d.ts +1 -1
  178. package/dist/hooks/useState.d.ts.map +1 -1
  179. package/dist/hooks/useState.js +24 -1
  180. package/dist/hooks/useState.js.map +1 -1
  181. package/dist/index.d.ts +8 -1
  182. package/dist/index.d.ts.map +1 -1
  183. package/dist/index.js +5 -0
  184. package/dist/index.js.map +1 -1
  185. package/dist/jsx-dev-runtime.d.ts +4 -4
  186. package/dist/jsx-dev-runtime.d.ts.map +1 -1
  187. package/dist/jsx-dev-runtime.js +4 -4
  188. package/dist/jsx-dev-runtime.js.map +1 -1
  189. package/dist/jsx-runtime.d.ts +3 -3
  190. package/dist/jsx-runtime.d.ts.map +1 -1
  191. package/dist/jsx-runtime.js +3 -3
  192. package/dist/jsx-runtime.js.map +1 -1
  193. package/dist/jsx.d.ts +176 -36
  194. package/dist/mocks.d.ts +21 -0
  195. package/dist/mocks.d.ts.map +1 -0
  196. package/dist/mocks.js +27 -0
  197. package/dist/mocks.js.map +1 -0
  198. package/dist/react.d.ts +46 -0
  199. package/dist/types/actions.d.ts +12 -4
  200. package/dist/types/actions.d.ts.map +1 -1
  201. package/dist/types/app.d.ts +17 -2
  202. package/dist/types/app.d.ts.map +1 -1
  203. package/dist/types/attributes.d.ts +42 -0
  204. package/dist/types/attributes.d.ts.map +1 -0
  205. package/dist/types/attributes.js +2 -0
  206. package/dist/types/attributes.js.map +1 -0
  207. package/dist/types/common.d.ts +13 -0
  208. package/dist/types/common.d.ts.map +1 -0
  209. package/dist/types/common.js +2 -0
  210. package/dist/types/common.js.map +1 -0
  211. package/dist/types/component.d.ts +5 -1
  212. package/dist/types/component.d.ts.map +1 -1
  213. package/dist/types/context.d.ts +3 -2
  214. package/dist/types/context.d.ts.map +1 -1
  215. package/dist/types/core.d.ts +17 -13
  216. package/dist/types/core.d.ts.map +1 -1
  217. package/dist/types/dom.d.ts +23 -27
  218. package/dist/types/dom.d.ts.map +1 -1
  219. package/dist/types/events.d.ts +31 -0
  220. package/dist/types/events.d.ts.map +1 -0
  221. package/dist/types/events.js +2 -0
  222. package/dist/types/events.js.map +1 -0
  223. package/dist/types/fiber.d.ts +31 -11
  224. package/dist/types/fiber.d.ts.map +1 -1
  225. package/dist/types/fiber.js +5 -1
  226. package/dist/types/fiber.js.map +1 -1
  227. package/dist/types/hooks.d.ts +8 -5
  228. package/dist/types/hooks.d.ts.map +1 -1
  229. package/dist/types/react.d.ts +35 -0
  230. package/dist/types/react.d.ts.map +1 -0
  231. package/dist/types/react.js +2 -0
  232. package/dist/types/react.js.map +1 -0
  233. package/dist/types/refs.d.ts +5 -8
  234. package/dist/types/refs.d.ts.map +1 -1
  235. package/package.json +15 -3
  236. package/dist/core/reconciliation/validateTree.d.ts +0 -6
  237. package/dist/core/reconciliation/validateTree.d.ts.map +0 -1
  238. package/dist/core/reconciliation/validateTree.js +0 -48
  239. package/dist/core/reconciliation/validateTree.js.map +0 -1
@@ -1,117 +1,85 @@
1
- import { nullthrows } from '../../utils';
2
1
  import { isEventName } from './helpers';
2
+ import { setSvgAttribute } from './dom/svg';
3
+ import { setTagStyles } from './dom/css';
4
+ import { setEventHandler } from './dom/events';
5
+ import { setHtmlAttribute } from './dom/attributes';
6
+ import { changeControlValue, setValueAttr } from './dom/value';
7
+ import { getAppByFiber } from '../reconciliation/app';
8
+ import { nullthrowsForFiber, ReactError, } from '../reconciliation/errors/ReactError';
9
+ import { isSetHtml } from '../reconciliation/typeGuards';
3
10
  /**
4
11
  * Applicable only to DOM tag nodes and handles the following scenarios:
5
12
  * - Removing, adding or updating an attribute
6
13
  * - Removing, adding or replacing an event handler
7
14
  */
8
- export function setAttrAction(fiber, { name, value }) {
15
+ export function setAttrAction(fiber, { name, value, creation }) {
9
16
  if (fiber.type !== 'tag') {
10
- throw new Error(`Can't apply SetAttr to a ${fiber.type} node`);
17
+ throw new ReactError(fiber, `Can't apply SetAttr to a ${fiber.type} node`);
11
18
  }
12
19
  if (fiber.role === 'portal') {
13
- throw new Error(`Can't apply SetAttr to a portal node`);
20
+ throw new ReactError(fiber, `Can't apply SetAttr to a portal node`);
14
21
  }
15
- const element = nullthrows(fiber.element);
16
- if (isEventName(name) || name in fiber.data.events) {
22
+ const element = nullthrowsForFiber(fiber, fiber.element);
23
+ if (isControllableAttrValue(fiber.element, name)) {
24
+ setValueAttr(fiber, name, value);
25
+ }
26
+ else if (name === 'defaultChecked' && element instanceof HTMLInputElement) {
27
+ if (creation) {
28
+ changeControlValue(getAppByFiber(fiber), element, 'checked', value);
29
+ }
30
+ }
31
+ else if (name === 'defaultValue' &&
32
+ (element instanceof HTMLInputElement ||
33
+ element instanceof HTMLTextAreaElement ||
34
+ element instanceof HTMLSelectElement)) {
35
+ if (creation) {
36
+ changeControlValue(getAppByFiber(fiber), element, 'value', value);
37
+ }
38
+ }
39
+ else if (isEventName(name) || name in fiber.data.events) {
17
40
  setEventHandler(fiber, element, name, value);
18
41
  }
19
42
  else if (name === 'style') {
20
43
  setTagStyles(fiber, value);
21
44
  }
45
+ else if (name === 'dangerouslySetInnerHTML' && isSetHtml(value)) {
46
+ element.innerHTML = value.__html;
47
+ }
22
48
  else if (value == null) {
23
49
  element.removeAttribute(name);
24
50
  }
25
51
  else {
26
52
  const strValue = String(value);
53
+ // Without this check, updates like img.src = the-same-src lead to
54
+ // retriggering the onload handler.
27
55
  if (strValue !== element.getAttribute(name)) {
28
- // Without this check, updates like img.src = the-same-src
29
- // lead to retriggering the onload handler.
30
- element.setAttribute(name === 'className' ? 'class' : name, strValue);
56
+ if (element instanceof SVGElement) {
57
+ setSvgAttribute(element, name, strValue);
58
+ }
59
+ else {
60
+ setHtmlAttribute(element, name, value);
61
+ }
31
62
  }
32
63
  }
33
64
  }
34
- const setEventHandler = (fiber, element, name, value) => {
35
- const { events } = fiber.data;
36
- if (value == null || value === false) {
37
- if (events[name]) {
38
- // Event handler was added before but now it's removed.
39
- events[name].handler = null;
40
- }
41
- return;
42
- }
43
- if (typeof value !== 'function') {
44
- throw new Error(`Unsupported format of event handler. It has to be "undefined" or a function`);
45
- }
46
- const eventName = name.slice(2); // onclick -> click.
47
- // Instead of adding and removing event handlers on every render, we can add a
48
- // wrapper that calls `events[eventName]` and update only the internal
49
- // function when it changes.
50
- if (!events[name]) {
51
- events[name] = {
52
- handler: value,
53
- wrapper: (event) => {
54
- // Original React doesn't support stopping propagation on `false` return.
55
- events[name].handler?.(event);
56
- },
57
- };
58
- element.addEventListener(eventName, events[name].wrapper);
59
- }
60
- else {
61
- // The tag is already listening to this event. Just update the internal ref.
62
- events[name].handler = value;
63
- }
64
- };
65
65
  /**
66
- * Handles removing, toggling and adding tag styles.
66
+ * Returns true if the given attribute is the controllable (by React) value of
67
+ * the given HTML control. E.g.:
68
+ * - for input[type=text] the value attributes is "value"
69
+ * - but for input[type="radio"] it's "checked", whereas "value" is just a
70
+ * optional string attribute.
67
71
  */
68
- const setTagStyles = (fiber,
69
- /** Should be a CSS-string (hyphens) or a CSS map (camelCase) */
70
- stylesRaw) => {
71
- if (typeof stylesRaw !== 'string' &&
72
- stylesRaw != null &&
73
- typeof stylesRaw !== 'object') {
74
- throw new Error(`Unsupported format of styles`);
75
- }
76
- const elementStyle = fiber.element.style;
77
- const newStyles = typeof stylesRaw === 'string' ? strToStyles(stylesRaw) : (stylesRaw ?? {});
78
- if (Object.keys(newStyles).length > 0) {
79
- for (const key of Object.keys(fiber.data.styles ?? {})) {
80
- if (!(key in newStyles)) {
81
- if (key.includes('-')) {
82
- elementStyle.removeProperty(key);
83
- }
84
- else if (key in elementStyle) {
85
- // @ts-ignore It's wrongly typed as read-only.
86
- elementStyle[key] = '';
87
- }
88
- }
89
- }
90
- for (const [key, value] of Object.entries(newStyles)) {
91
- if (key.includes('-')) {
92
- elementStyle.setProperty(key, value);
93
- }
94
- else if (key in elementStyle) {
95
- // @ts-ignore It's wrongly typed as read-only.
96
- elementStyle[key] = value;
97
- }
98
- }
72
+ const isControllableAttrValue = (element, name) => {
73
+ if (element instanceof HTMLInputElement) {
74
+ const { type } = element;
75
+ return type === 'radio' || type === 'checkbox'
76
+ ? name === 'checked'
77
+ : name === 'value';
99
78
  }
100
- else {
101
- fiber.element.removeAttribute('style');
79
+ if (element instanceof HTMLTextAreaElement ||
80
+ element instanceof HTMLSelectElement) {
81
+ return name === 'value';
102
82
  }
103
- fiber.data.styles = newStyles;
104
- };
105
- /**
106
- * Converts a string like "color: red; font-size: 12px" to
107
- * { color: 'red', ['font-size']: '12px' }
108
- */
109
- const strToStyles = (css) => {
110
- cssDummy.style.cssText = css;
111
- return Object.fromEntries(Array.from(cssDummy.style).map((k) => [
112
- k,
113
- cssDummy.style.getPropertyValue(k),
114
- ]));
83
+ return false;
115
84
  };
116
- const cssDummy = document.createElement('x-css-dummy');
117
85
  //# sourceMappingURL=setAttr.action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setAttr.action.js","sourceRoot":"","sources":["../../../src/core/actions/setAttr.action.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAgB,EAChB,EAAE,IAAI,EAAE,KAAK,EAAiB,EAC9B;IACA,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE1C,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACnD,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/C,CAA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IAAI,EAAE,KAAK,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;IACH,CAAC;AAAA,CACF;AAED;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,CAC9B,OAAuB,EACvB,IAAY,EACiB,EAAE,CAAC;IAChC,IAAI,OAAO,YAAY,gBAAgB,EAAE,CAAC;QACxC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QACzB,OAAO,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,UAAU;YAC5C,CAAC,CAAC,IAAI,KAAK,SAAS;YACpB,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC;IACvB,CAAC;IAED,IACE,OAAO,YAAY,mBAAmB;QACtC,OAAO,YAAY,iBAAiB,EACpC,CAAC;QACD,OAAO,IAAI,KAAK,OAAO,CAAC;IAC1B,CAAC;IAED,OAAO,KAAK,CAAC;AAAA,CACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"setProps.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setProps.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,cAAc,QASzE"}
1
+ {"version":3,"file":"setProps.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setProps.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,cAAc,QAYzE"}
@@ -1,3 +1,4 @@
1
+ import { ReactError } from '../reconciliation/errors/ReactError';
1
2
  /**
2
3
  * Updates the set of props for the given fiber node. This doesn't make any
3
4
  * DOM changes or run components.
@@ -6,7 +7,7 @@ export function setPropsAction(fiber, { props }) {
6
7
  if (fiber.type !== 'component' &&
7
8
  fiber.type !== 'tag' &&
8
9
  fiber.role !== 'context') {
9
- throw new Error(`setProps action is not applicable to this fiber node`);
10
+ throw new ReactError(fiber, `setProps action is not applicable to this fiber node`);
10
11
  }
11
12
  fiber.props = props;
12
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setProps.action.js","sourceRoot":"","sources":["../../../src/core/actions/setProps.action.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAgB,EAAE,EAAE,KAAK,EAAkB,EAAE;IAC1E,IACE,KAAK,CAAC,IAAI,KAAK,WAAW;QAC1B,KAAK,CAAC,IAAI,KAAK,KAAK;QACpB,KAAK,CAAC,IAAI,KAAK,SAAS,EACxB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;AAAA,CACrB"}
1
+ {"version":3,"file":"setProps.action.js","sourceRoot":"","sources":["../../../src/core/actions/setProps.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAgB,EAAE,EAAE,KAAK,EAAkB,EAAE;IAC1E,IACE,KAAK,CAAC,IAAI,KAAK,WAAW;QAC1B,KAAK,CAAC,IAAI,KAAK,KAAK;QACpB,KAAK,CAAC,IAAI,KAAK,SAAS,EACxB,CAAC;QACD,MAAM,IAAI,UAAU,CAClB,KAAK,EACL,sDAAsD,CACvD,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;AAAA,CACrB"}
@@ -7,5 +7,5 @@ import type { SetRefAction } from '../../types/actions';
7
7
  *
8
8
  * Removing nodes with ref handlers is handled in remove and replace actions.
9
9
  */
10
- export declare function setRefAction(fiber: FiberNode, { ref, dontUnsetRef }: SetRefAction): void;
10
+ export declare function setRefAction(fiber: FiberNode, { ref, dontUnsetRef }: Pick<SetRefAction, 'ref' | 'dontUnsetRef'>): void;
11
11
  //# sourceMappingURL=setRef.action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setRef.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setRef.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAK/D;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,YAAY,QAiCpC"}
1
+ {"version":3,"file":"setRef.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setRef.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAS/D;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,cAAc,CAAC,QAmClE"}
@@ -1,7 +1,7 @@
1
- import { nullthrows } from '../../utils';
2
1
  import { unsetRef } from './helpers';
3
2
  import { scheduleEffect } from '../reconciliation/effects';
4
3
  import { getAppByFiber } from '../reconciliation/app';
4
+ import { nullthrowsForFiber, ReactError, } from '../reconciliation/errors/ReactError';
5
5
  /**
6
6
  * A ref or ref handler for the given node was:
7
7
  * - set up
@@ -11,18 +11,17 @@ import { getAppByFiber } from '../reconciliation/app';
11
11
  */
12
12
  export function setRefAction(fiber, { ref, dontUnsetRef }) {
13
13
  if (fiber.type !== 'tag') {
14
- throw new Error(`setRefAction is not compatible with ${fiber.type} nodes`);
14
+ throw new ReactError(fiber, `setRefAction is not compatible with ${fiber.type} nodes`);
15
15
  }
16
16
  if (fiber.ref &&
17
17
  // It's `true` on the first render of the tag. We shouldn't run `onRef(null)`
18
18
  // in such a case.
19
19
  !dontUnsetRef) {
20
- // ref.current = null | ref(null)
21
- unsetRef(fiber.ref);
20
+ unsetRef(fiber, false);
22
21
  }
23
22
  // Run effects only when the DOM node is already mounted to a real DOM node.
24
23
  scheduleEffect(getAppByFiber(fiber), () => {
25
- const element = nullthrows(fiber.element);
24
+ const element = nullthrowsForFiber(fiber, fiber.element);
26
25
  if (typeof ref === 'function') {
27
26
  ref(element);
28
27
  }
@@ -31,7 +30,7 @@ export function setRefAction(fiber, { ref, dontUnsetRef }) {
31
30
  }
32
31
  },
33
32
  // React calls ref handlers even before it runs layout effects.
34
- 'refs');
33
+ 'refsMount');
35
34
  fiber.ref = ref;
36
35
  return;
37
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setRef.action.js","sourceRoot":"","sources":["../../../src/core/actions/setRef.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAgB,EAChB,EAAE,GAAG,EAAE,YAAY,EAAgB,EACnC;IACA,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC;IAC7E,CAAC;IAED,IACE,KAAK,CAAC,GAAG;QACT,6EAA6E;QAC7E,kBAAkB;QAClB,CAAC,YAAY,EACb,CAAC;QACD,iCAAiC;QACjC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,4EAA4E;IAC5E,cAAc,CACZ,aAAa,CAAC,KAAK,CAAC,EACpB,GAAG,EAAE,CAAC;QACJ,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAgB,CAAC;QACzD,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;YAC9B,GAAG,CAAC,OAAO,CAAC,CAAC;QACf,CAAC;aAAM,IAAI,GAAG,EAAE,CAAC;YACf,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACxB,CAAC;IAAA,CACF;IACD,+DAA+D;IAC/D,MAAM,CACP,CAAC;IAEF,KAAK,CAAC,GAAG,GAAG,GAAuB,CAAC;IACpC,OAAO;AAAA,CACR"}
1
+ {"version":3,"file":"setRef.action.js","sourceRoot":"","sources":["../../../src/core/actions/setRef.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,UAAU,GACX,MAAM,qCAAqC,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAgB,EAChB,EAAE,GAAG,EAAE,YAAY,EAA8C,EACjE;IACA,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,UAAU,CAClB,KAAK,EACL,uCAAuC,KAAK,CAAC,IAAI,QAAQ,CAC1D,CAAC;IACJ,CAAC;IAED,IACE,KAAK,CAAC,GAAG;QACT,6EAA6E;QAC7E,kBAAkB;QAClB,CAAC,YAAY,EACb,CAAC;QACD,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,4EAA4E;IAC5E,cAAc,CACZ,aAAa,CAAC,KAAK,CAAC,EACpB,GAAG,EAAE,CAAC;QACJ,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAgB,CAAC;QACxE,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;YAC9B,GAAG,CAAC,OAAO,CAAC,CAAC;QACf,CAAC;aAAM,IAAI,GAAG,EAAE,CAAC;YACf,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACxB,CAAC;IAAA,CACF;IACD,+DAA+D;IAC/D,WAAW,CACZ,CAAC;IAEF,KAAK,CAAC,GAAG,GAAG,GAAuB,CAAC;IACpC,OAAO;AAAA,CACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"setText.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setText.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,aAAa,QAMtE"}
1
+ {"version":3,"file":"setText.action.d.ts","sourceRoot":"","sources":["../../../src/core/actions/setText.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAMhE;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,aAAa,QAMtE"}
@@ -1,12 +1,12 @@
1
- import { nullthrows } from '../../utils';
1
+ import { nullthrowsForFiber, ReactError, } from '../reconciliation/errors/ReactError';
2
2
  /**
3
3
  * Replaces the text content within a Text DOM node.
4
4
  */
5
5
  export function setTextAction(fiber, { text }) {
6
6
  if (fiber.type !== 'text') {
7
- throw new Error(`Can't apply setText action to non-text node`);
7
+ throw new ReactError(fiber, `Can't apply setText action to non-text node`);
8
8
  }
9
9
  fiber.props = { text };
10
- nullthrows(fiber.element).textContent = text;
10
+ nullthrowsForFiber(fiber, fiber.element).textContent = text;
11
11
  }
12
12
  //# sourceMappingURL=setText.action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setText.action.js","sourceRoot":"","sources":["../../../src/core/actions/setText.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAgB,EAAE,EAAE,IAAI,EAAiB,EAAE;IACvE,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IACD,KAAK,CAAC,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC;IACvB,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC;AAAA,CAC9C"}
1
+ {"version":3,"file":"setText.action.js","sourceRoot":"","sources":["../../../src/core/actions/setText.action.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,UAAU,GACX,MAAM,qCAAqC,CAAC;AAE7C;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAgB,EAAE,EAAE,IAAI,EAAiB,EAAE;IACvE,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE,6CAA6C,CAAC,CAAC;IAC7E,CAAC;IACD,KAAK,CAAC,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC;IACvB,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC;AAAA,CAC7D"}
@@ -0,0 +1,33 @@
1
+ import type { ReactComponent, ReactContext, UnknownProps } from '../types';
2
+ export declare const isComponentClass: (value: unknown) => value is ComponentClass<UnknownProps, UnknownProps>;
3
+ /**
4
+ * A naive implementation of legacy class-based React components. Only the most
5
+ * important methods are implemented. The implementation is very poor. Don't
6
+ * rely on it.
7
+ */
8
+ export declare class Component<Props extends UnknownProps = UnknownProps, State extends UnknownProps = UnknownProps> {
9
+ props: Props;
10
+ state: State;
11
+ context: unknown;
12
+ static defaultProps?: object;
13
+ static contextType?: ReactContext<any>;
14
+ constructor(props: Props);
15
+ setState(_update: Partial<State>): void;
16
+ componentDidMount(): void;
17
+ componentWillUnmount(): void;
18
+ forceUpdate(fn?: () => void): void;
19
+ componentDidUpdate(_prevProps: Props, _prevState: State): void;
20
+ shouldComponentUpdate(_nextProps: Props, _nextState: State, _nextContext?: unknown): boolean;
21
+ render(): JSX.Element;
22
+ componentDidCatch(_error: unknown, _info: unknown): void;
23
+ getSnapshotBeforeUpdate(_prevProps: unknown, _prevState: unknown): unknown;
24
+ static getDerivedStateFromProps(_props: any, _state: any): Partial<any>;
25
+ }
26
+ /**
27
+ * Since I'm too lazy to implement a proper support for this legacy stuff, but
28
+ * some of the 3rd party libraries still rely on it, I've made this converter.
29
+ * It immitate the class-based component's lifecycle using hooks.
30
+ */
31
+ export declare const convertClassComponentToFC: <Props extends UnknownProps, State extends UnknownProps = UnknownProps>(Component: ComponentClass<Props, State>) => ReactComponent<Props>;
32
+ export type ComponentClass<Props extends UnknownProps = UnknownProps, State extends UnknownProps = UnknownProps> = new (props: Props) => Component<Props, State>;
33
+ //# sourceMappingURL=classComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classComponent.d.ts","sourceRoot":"","sources":["../../src/core/classComponent.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACb,MAAM,oBAAoB,CAAC;AAI5B,eAAO,MAAM,gBAAgB,yEAO5B,CAAC;AAEF;;;;GAIG;AAC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EAAE,KAAK,CAAC,CAAC"}
@@ -0,0 +1,127 @@
1
+ import { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from '../hooks';
2
+ import { getCurrentComponentFiber } from './components';
3
+ import { ReactError } from './reconciliation/errors/ReactError';
4
+ export const isComponentClass = (value) => {
5
+ return (value != null &&
6
+ typeof value === 'function' &&
7
+ 'prototype' in value &&
8
+ value.prototype instanceof Component);
9
+ };
10
+ /**
11
+ * A naive implementation of legacy class-based React components. Only the most
12
+ * important methods are implemented. The implementation is very poor. Don't
13
+ * rely on it.
14
+ */
15
+ export class Component {
16
+ props;
17
+ state;
18
+ context;
19
+ static defaultProps;
20
+ static contextType;
21
+ constructor(props) {
22
+ this.props = props;
23
+ }
24
+ // Overriden in `convertClassComponentToFC`.
25
+ setState(_update) { }
26
+ // Could be overridden.
27
+ componentDidMount() { }
28
+ componentWillUnmount() { }
29
+ forceUpdate(fn) {
30
+ this.setState({});
31
+ if (fn) {
32
+ Promise.resolve().then(fn);
33
+ }
34
+ }
35
+ componentDidUpdate(_prevProps, _prevState) { }
36
+ shouldComponentUpdate(_nextProps, _nextState, _nextContext) {
37
+ return true;
38
+ }
39
+ render() {
40
+ throw new ReactError(getCurrentComponentFiber(), `Render method must be overridden`);
41
+ }
42
+ componentDidCatch(_error, _info) {
43
+ throw new ReactError(getCurrentComponentFiber(), `Not implemented`);
44
+ }
45
+ getSnapshotBeforeUpdate(_prevProps, _prevState) {
46
+ throw new ReactError(getCurrentComponentFiber(), `Not implemented`);
47
+ }
48
+ static getDerivedStateFromProps(_props, _state) {
49
+ return {};
50
+ }
51
+ }
52
+ /**
53
+ * Since we're running `convertClassComponentToFC` for the same component each
54
+ * time its JSX.Element was created we need to cache the output wrapper
55
+ * component. Otherwise every parent node's render will remount it.
56
+ */
57
+ const cache = new Map();
58
+ /**
59
+ * Since I'm too lazy to implement a proper support for this legacy stuff, but
60
+ * some of the 3rd party libraries still rely on it, I've made this converter.
61
+ * It immitate the class-based component's lifecycle using hooks.
62
+ */
63
+ export const convertClassComponentToFC = (Component) => {
64
+ if (cache.has(Component)) {
65
+ return cache.get(Component);
66
+ }
67
+ let { defaultProps, contextType, getDerivedStateFromProps } = Component;
68
+ if (getDerivedStateFromProps === Component.prototype.getDerivedStateFromProps) {
69
+ getDerivedStateFromProps = undefined;
70
+ }
71
+ function FromClassComponent(props) {
72
+ const { current: ref } = useRef({
73
+ mounted: false,
74
+ rendered: 0,
75
+ });
76
+ const instance = useMemo(() => new Component({
77
+ ...defaultProps,
78
+ ...props,
79
+ }), []);
80
+ let [state, setState] = useState(() => instance.state ?? {});
81
+ if (getDerivedStateFromProps) {
82
+ // A dirty hack to update the state on the fly.
83
+ const fiber = getCurrentComponentFiber();
84
+ const hookState = fiber.data.hooks.find((h) => h.type === 'state');
85
+ state = hookState.state = {
86
+ ...hookState.state,
87
+ ...getDerivedStateFromProps(props, hookState.state),
88
+ };
89
+ }
90
+ if (!ref.mounted) {
91
+ instance.setState = function classSetState(update) {
92
+ setState((prev) => ({ ...prev, ...update }));
93
+ };
94
+ }
95
+ useLayoutEffect(() => {
96
+ ref.mounted = true;
97
+ instance.componentDidMount();
98
+ return () => {
99
+ instance.componentWillUnmount();
100
+ ref.mounted = false;
101
+ };
102
+ }, []);
103
+ useEffect(() => {
104
+ if (ref.prevProps) {
105
+ instance.componentDidUpdate(ref.prevProps, ref.prevState);
106
+ }
107
+ ref.prevProps = instance.props;
108
+ ref.prevState = instance.state;
109
+ });
110
+ if (contextType) {
111
+ instance.context = useContext(contextType);
112
+ }
113
+ instance.props = {
114
+ ...defaultProps,
115
+ ...props,
116
+ };
117
+ instance.state = state;
118
+ if (!ref.mounted || instance.shouldComponentUpdate(props, instance.state)) {
119
+ ref.prevOutput = instance.render();
120
+ }
121
+ ++ref.rendered;
122
+ return ref.prevOutput;
123
+ }
124
+ cache.set(Component, FromClassComponent);
125
+ return FromClassComponent;
126
+ };
127
+ //# sourceMappingURL=classComponent.js.map
@@ -0,0 +1 @@
1
+ {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C;YAED,GAAG,CAAC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC;YAC/B,GAAG,CAAC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC;QAAA,CAChC,CAAC,CAAC;QAEH,IAAI,WAAW,EAAE,CAAC;YAChB,QAAQ,CAAC,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;QAC7C,CAAC;QAED,QAAQ,CAAC,KAAK,GAAG;YACf,GAAG,YAAY;YACf,GAAG,KAAK;SACT,CAAC;QACF,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;QAEvB,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1E,GAAG,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrC,CAAC;QAED,EAAE,GAAG,CAAC,QAAQ,CAAC;QACf,OAAO,GAAG,CAAC,UAAU,CAAC;IAAA,CACvB;IAED,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,kBAAyB,CAAC,CAAC;IAChD,OAAO,kBAAkB,CAAC;AAAA,CAC3B,CAAC"}
@@ -1,38 +1,19 @@
1
- import { type DomNode, type FiberNode } from '../types';
2
- /**
3
- * Returns true if domNode is <!--r:begin:ID--> where ID is fiber.id
4
- */
5
- export declare const isBeginOf: (domNode: ChildNode, fiber: FiberNode) => domNode is Comment;
1
+ import { containerSym, type DomNode, type FiberNode } from '../types';
2
+ export declare const isAutoContainer: (fiber: FiberNode) => fiber is FiberNode & {
3
+ element: typeof containerSym;
4
+ };
6
5
  /**
7
- * Returns true if the given `fiber` is in solo compact mode. This means it
8
- * doesn't have its own direct DOM element. Instead, its `element` refers to its
9
- * only child's `element`, avoiding the need for <!--brackets-->.
6
+ * Returns true if the given `fiber` is in the single-child mode. This means it
7
+ * its `element` refers to its only child's DOM element.
10
8
  */
11
- export declare const isCompactSingleChild: (fiber: FiberNode) => fiber is FiberNode & {
9
+ export declare const isSingleChildContainer: (fiber: FiberNode) => fiber is FiberNode & {
12
10
  element: DomNode;
13
11
  };
14
12
  /**
15
- * Returns true if the given `fiber` is in none compact mode. This means it
16
- * has no fiber children, and its element is <!--r:empty:id-->
13
+ * Returns true if the given `fiber` is in the empty mode. This means it has no
14
+ * fiber children, and its element is <!--r:empty:id-->
17
15
  */
18
- export declare const isCompactNone: (fiber: FiberNode) => fiber is FiberNode & {
16
+ export declare const isEmptyContainer: (fiber: FiberNode) => fiber is FiberNode & {
19
17
  element: DomNode;
20
18
  };
21
- /**
22
- * If the given fiber node has <!--brackets-->, this function tries to apply one
23
- * of the "compact" optimizations:
24
- *
25
- * - If the node has no children, it replaces the brackets with
26
- * <!--r:empty:id-->
27
- * - If the node has only one child, it removes the brackets and sets
28
- * `fiber.element` to reference its only direct DOM child
29
- *
30
- * It also tries to recursively compact parent nodes when possible.
31
- */
32
- export declare function tryToCompactNode(fiber: FiberNode): void;
33
- /**
34
- * Converts <!--empty--> or the single compact container node into:
35
- * <!--begin-->...children...<!--end-->
36
- */
37
- export declare const unwrapCompactFiber: (fiber: FiberNode) => void;
38
19
  //# sourceMappingURL=compact.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../src/core/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAGxD;;GAEG;AACH,eAAO,MAAM,SAAS,8DAKuC,CAAC;AAgB9D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;CAOE,CAAC;AAEpC;;;GAGG;AACH,eAAO,MAAM,aAAa;;CAMQ,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAiCvD;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,4BAuC9B,CAAC"}
1
+ {"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../src/core/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,KAAK,OAAO,EACZ,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;AAelB,eAAO,MAAM,eAAe;;CAGI,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;CAOA,CAAC;AAEpC;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;CAMK,CAAC"}