isomorfeus-preact 10.9.0 → 22.9.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +14 -3
  3. data/README.md +23 -39
  4. data/lib/browser/delegate_native.rb +94 -72
  5. data/lib/browser/document.rb +38 -0
  6. data/lib/browser/element.rb +160 -176
  7. data/lib/browser/event.rb +99 -94
  8. data/lib/browser/history.rb +40 -20
  9. data/lib/browser/location.rb +59 -0
  10. data/lib/browser/window.rb +58 -0
  11. data/lib/data_uri/open_uri.rb +18 -0
  12. data/lib/data_uri/uri.rb +61 -0
  13. data/lib/data_uri.rb +4 -0
  14. data/lib/isomorfeus/preact/config.rb +42 -54
  15. data/lib/isomorfeus/preact/imports.rb +5 -20
  16. data/lib/isomorfeus/preact/ssr.rb +34 -0
  17. data/lib/isomorfeus/preact/thread_local_component_cache.rb +9 -11
  18. data/lib/isomorfeus/preact/version.rb +5 -0
  19. data/lib/isomorfeus/preact/view_helper.rb +72 -0
  20. data/lib/isomorfeus/props/validator.rb +19 -11
  21. data/lib/isomorfeus/top_level.rb +55 -33
  22. data/lib/isomorfeus-preact.rb +78 -103
  23. data/lib/link.rb +52 -0
  24. data/lib/lucid_app.rb +117 -0
  25. data/lib/lucid_component.rb +154 -0
  26. data/lib/nano_css.rb +282 -465
  27. data/lib/preact/component.rb +222 -0
  28. data/lib/preact/component_resolution.rb +49 -83
  29. data/lib/preact/context.rb +68 -0
  30. data/lib/preact/elements.rb +2 -9
  31. data/lib/preact/module_component_resolution.rb +50 -0
  32. data/lib/preact/prop_declaration_mixin.rb +73 -0
  33. data/lib/preact.rb +1548 -257
  34. data/lib/redirect.rb +34 -0
  35. data/lib/route.rb +15 -0
  36. data/lib/router.rb +145 -0
  37. data/lib/switch.rb +70 -0
  38. data/opal/iso_uri.rb +29 -0
  39. data/opal/uri/common.rb +18 -0
  40. data/opal/uri/generic.rb +47 -0
  41. metadata +45 -309
  42. data/lib/isomorfeus/preact/memcached_component_cache.rb +0 -19
  43. data/lib/isomorfeus/preact/redis_component_cache.rb +0 -19
  44. data/lib/isomorfeus/preact/ssr/history.rb +0 -23
  45. data/lib/isomorfeus/preact/ssr/render_core.rb +0 -117
  46. data/lib/isomorfeus/preact/ssr/top_level.rb +0 -37
  47. data/lib/isomorfeus/preact_view_helper.rb +0 -129
  48. data/lib/isomorfeus_preact/lucid_app/api.rb +0 -38
  49. data/lib/isomorfeus_preact/lucid_app/base.rb +0 -7
  50. data/lib/isomorfeus_preact/lucid_app/mixin.rb +0 -14
  51. data/lib/isomorfeus_preact/lucid_app/native_component_constructor.rb +0 -101
  52. data/lib/isomorfeus_preact/lucid_component/api.rb +0 -123
  53. data/lib/isomorfeus_preact/lucid_component/app_store_proxy.rb +0 -32
  54. data/lib/isomorfeus_preact/lucid_component/base.rb +0 -7
  55. data/lib/isomorfeus_preact/lucid_component/class_store_proxy.rb +0 -37
  56. data/lib/isomorfeus_preact/lucid_component/initializer.rb +0 -9
  57. data/lib/isomorfeus_preact/lucid_component/mixin.rb +0 -13
  58. data/lib/isomorfeus_preact/lucid_component/native_component_constructor.rb +0 -87
  59. data/lib/isomorfeus_preact/lucid_component/styles_wrapper.rb +0 -40
  60. data/lib/isomorfeus_preact/lucid_func/base.rb +0 -7
  61. data/lib/isomorfeus_preact/lucid_func/initializer.rb +0 -8
  62. data/lib/isomorfeus_preact/lucid_func/mixin.rb +0 -10
  63. data/lib/isomorfeus_preact/lucid_func/native_component_constructor.rb +0 -56
  64. data/lib/isomorfeus_preact/preact/function_component/api.rb +0 -164
  65. data/lib/isomorfeus_preact/preact/function_component/base.rb +0 -7
  66. data/lib/isomorfeus_preact/preact/function_component/initializer.rb +0 -6
  67. data/lib/isomorfeus_preact/preact/function_component/mixin.rb +0 -8
  68. data/lib/isomorfeus_preact/preact/function_component/native_component_constructor.rb +0 -47
  69. data/lib/lucid_app/context.rb +0 -24
  70. data/lib/lucid_prop_declaration/mixin.rb +0 -126
  71. data/lib/preact/component/api.rb +0 -137
  72. data/lib/preact/component/base.rb +0 -7
  73. data/lib/preact/component/callbacks.rb +0 -111
  74. data/lib/preact/component/initializer.rb +0 -7
  75. data/lib/preact/component/mixin.rb +0 -11
  76. data/lib/preact/component/native_component_constructor.rb +0 -77
  77. data/lib/preact/context_wrapper.rb +0 -48
  78. data/lib/preact/native_constant_wrapper.rb +0 -29
  79. data/lib/preact/option_hooks.rb +0 -98
  80. data/lib/preact/params.rb +0 -16
  81. data/lib/preact/props.rb +0 -69
  82. data/lib/preact/ref.rb +0 -17
  83. data/lib/preact/state.rb +0 -87
  84. data/lib/preact/version.rb +0 -3
  85. data/node_modules/.package-lock.json +0 -38
  86. data/node_modules/preact/LICENSE +0 -21
  87. data/node_modules/preact/README.md +0 -188
  88. data/node_modules/preact/compat/LICENSE +0 -21
  89. data/node_modules/preact/compat/client.js +0 -19
  90. data/node_modules/preact/compat/client.mjs +0 -17
  91. data/node_modules/preact/compat/dist/compat.js +0 -2
  92. data/node_modules/preact/compat/dist/compat.js.map +0 -1
  93. data/node_modules/preact/compat/dist/compat.mjs +0 -2
  94. data/node_modules/preact/compat/dist/compat.module.js +0 -2
  95. data/node_modules/preact/compat/dist/compat.module.js.map +0 -1
  96. data/node_modules/preact/compat/dist/compat.umd.js +0 -2
  97. data/node_modules/preact/compat/dist/compat.umd.js.map +0 -1
  98. data/node_modules/preact/compat/jsx-dev-runtime.js +0 -3
  99. data/node_modules/preact/compat/jsx-dev-runtime.mjs +0 -3
  100. data/node_modules/preact/compat/jsx-runtime.js +0 -3
  101. data/node_modules/preact/compat/jsx-runtime.mjs +0 -3
  102. data/node_modules/preact/compat/package.json +0 -49
  103. data/node_modules/preact/compat/scheduler.js +0 -15
  104. data/node_modules/preact/compat/scheduler.mjs +0 -23
  105. data/node_modules/preact/compat/server.browser.js +0 -4
  106. data/node_modules/preact/compat/server.js +0 -15
  107. data/node_modules/preact/compat/server.mjs +0 -4
  108. data/node_modules/preact/compat/src/Children.js +0 -21
  109. data/node_modules/preact/compat/src/PureComponent.js +0 -15
  110. data/node_modules/preact/compat/src/forwardRef.js +0 -44
  111. data/node_modules/preact/compat/src/index.d.ts +0 -164
  112. data/node_modules/preact/compat/src/index.js +0 -223
  113. data/node_modules/preact/compat/src/internal.d.ts +0 -47
  114. data/node_modules/preact/compat/src/memo.js +0 -34
  115. data/node_modules/preact/compat/src/portals.js +0 -82
  116. data/node_modules/preact/compat/src/render.js +0 -238
  117. data/node_modules/preact/compat/src/suspense-list.d.ts +0 -14
  118. data/node_modules/preact/compat/src/suspense-list.js +0 -126
  119. data/node_modules/preact/compat/src/suspense.d.ts +0 -15
  120. data/node_modules/preact/compat/src/suspense.js +0 -270
  121. data/node_modules/preact/compat/src/util.js +0 -28
  122. data/node_modules/preact/compat/test-utils.js +0 -1
  123. data/node_modules/preact/debug/LICENSE +0 -21
  124. data/node_modules/preact/debug/dist/debug.js +0 -2
  125. data/node_modules/preact/debug/dist/debug.js.map +0 -1
  126. data/node_modules/preact/debug/dist/debug.mjs +0 -2
  127. data/node_modules/preact/debug/dist/debug.module.js +0 -2
  128. data/node_modules/preact/debug/dist/debug.module.js.map +0 -1
  129. data/node_modules/preact/debug/dist/debug.umd.js +0 -2
  130. data/node_modules/preact/debug/dist/debug.umd.js.map +0 -1
  131. data/node_modules/preact/debug/package.json +0 -26
  132. data/node_modules/preact/debug/src/check-props.js +0 -54
  133. data/node_modules/preact/debug/src/component-stack.js +0 -146
  134. data/node_modules/preact/debug/src/constants.js +0 -3
  135. data/node_modules/preact/debug/src/debug.js +0 -437
  136. data/node_modules/preact/debug/src/index.js +0 -6
  137. data/node_modules/preact/debug/src/internal.d.ts +0 -82
  138. data/node_modules/preact/debug/src/util.js +0 -11
  139. data/node_modules/preact/devtools/LICENSE +0 -21
  140. data/node_modules/preact/devtools/dist/devtools.js +0 -2
  141. data/node_modules/preact/devtools/dist/devtools.js.map +0 -1
  142. data/node_modules/preact/devtools/dist/devtools.mjs +0 -2
  143. data/node_modules/preact/devtools/dist/devtools.module.js +0 -2
  144. data/node_modules/preact/devtools/dist/devtools.module.js.map +0 -1
  145. data/node_modules/preact/devtools/dist/devtools.umd.js +0 -2
  146. data/node_modules/preact/devtools/dist/devtools.umd.js.map +0 -1
  147. data/node_modules/preact/devtools/package.json +0 -25
  148. data/node_modules/preact/devtools/src/devtools.js +0 -10
  149. data/node_modules/preact/devtools/src/index.d.ts +0 -8
  150. data/node_modules/preact/devtools/src/index.js +0 -15
  151. data/node_modules/preact/dist/preact.js +0 -2
  152. data/node_modules/preact/dist/preact.js.map +0 -1
  153. data/node_modules/preact/dist/preact.min.js +0 -2
  154. data/node_modules/preact/dist/preact.min.js.map +0 -1
  155. data/node_modules/preact/dist/preact.mjs +0 -2
  156. data/node_modules/preact/dist/preact.module.js +0 -2
  157. data/node_modules/preact/dist/preact.module.js.map +0 -1
  158. data/node_modules/preact/dist/preact.umd.js +0 -2
  159. data/node_modules/preact/dist/preact.umd.js.map +0 -1
  160. data/node_modules/preact/hooks/LICENSE +0 -21
  161. data/node_modules/preact/hooks/dist/hooks.js +0 -2
  162. data/node_modules/preact/hooks/dist/hooks.js.map +0 -1
  163. data/node_modules/preact/hooks/dist/hooks.mjs +0 -2
  164. data/node_modules/preact/hooks/dist/hooks.module.js +0 -2
  165. data/node_modules/preact/hooks/dist/hooks.module.js.map +0 -1
  166. data/node_modules/preact/hooks/dist/hooks.umd.js +0 -2
  167. data/node_modules/preact/hooks/dist/hooks.umd.js.map +0 -1
  168. data/node_modules/preact/hooks/package.json +0 -35
  169. data/node_modules/preact/hooks/src/index.d.ts +0 -139
  170. data/node_modules/preact/hooks/src/index.js +0 -417
  171. data/node_modules/preact/hooks/src/internal.d.ts +0 -78
  172. data/node_modules/preact/jsx-runtime/LICENSE +0 -21
  173. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.js +0 -2
  174. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.js.map +0 -1
  175. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs +0 -2
  176. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js +0 -2
  177. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js.map +0 -1
  178. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js +0 -2
  179. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +0 -1
  180. data/node_modules/preact/jsx-runtime/package.json +0 -28
  181. data/node_modules/preact/jsx-runtime/src/index.d.ts +0 -50
  182. data/node_modules/preact/jsx-runtime/src/index.js +0 -77
  183. data/node_modules/preact/package.json +0 -304
  184. data/node_modules/preact/src/cjs.js +0 -3
  185. data/node_modules/preact/src/clone-element.js +0 -34
  186. data/node_modules/preact/src/component.js +0 -225
  187. data/node_modules/preact/src/constants.js +0 -3
  188. data/node_modules/preact/src/create-context.js +0 -68
  189. data/node_modules/preact/src/create-element.js +0 -98
  190. data/node_modules/preact/src/diff/catch-error.js +0 -40
  191. data/node_modules/preact/src/diff/children.js +0 -335
  192. data/node_modules/preact/src/diff/index.js +0 -533
  193. data/node_modules/preact/src/diff/props.js +0 -158
  194. data/node_modules/preact/src/index.d.ts +0 -317
  195. data/node_modules/preact/src/index.js +0 -13
  196. data/node_modules/preact/src/internal.d.ts +0 -155
  197. data/node_modules/preact/src/jsx.d.ts +0 -1014
  198. data/node_modules/preact/src/options.js +0 -16
  199. data/node_modules/preact/src/render.js +0 -75
  200. data/node_modules/preact/src/util.js +0 -27
  201. data/node_modules/preact/test-utils/dist/testUtils.js +0 -2
  202. data/node_modules/preact/test-utils/dist/testUtils.js.map +0 -1
  203. data/node_modules/preact/test-utils/dist/testUtils.mjs +0 -2
  204. data/node_modules/preact/test-utils/dist/testUtils.module.js +0 -2
  205. data/node_modules/preact/test-utils/dist/testUtils.module.js.map +0 -1
  206. data/node_modules/preact/test-utils/dist/testUtils.umd.js +0 -2
  207. data/node_modules/preact/test-utils/dist/testUtils.umd.js.map +0 -1
  208. data/node_modules/preact/test-utils/package.json +0 -28
  209. data/node_modules/preact/test-utils/src/index.d.ts +0 -3
  210. data/node_modules/preact/test-utils/src/index.js +0 -118
  211. data/node_modules/preact-render-to-string/LICENSE +0 -21
  212. data/node_modules/preact-render-to-string/README.md +0 -102
  213. data/node_modules/preact-render-to-string/dist/commonjs.js +0 -2
  214. data/node_modules/preact-render-to-string/dist/commonjs.js.map +0 -1
  215. data/node_modules/preact-render-to-string/dist/index.d.ts +0 -16
  216. data/node_modules/preact-render-to-string/dist/index.js +0 -1
  217. data/node_modules/preact-render-to-string/dist/index.js.map +0 -1
  218. data/node_modules/preact-render-to-string/dist/index.mjs +0 -2
  219. data/node_modules/preact-render-to-string/dist/index.module.js +0 -2
  220. data/node_modules/preact-render-to-string/dist/index.module.js.map +0 -1
  221. data/node_modules/preact-render-to-string/dist/jsx-entry.js +0 -2
  222. data/node_modules/preact-render-to-string/dist/jsx-entry.js.map +0 -1
  223. data/node_modules/preact-render-to-string/dist/jsx.d.ts +0 -13
  224. data/node_modules/preact-render-to-string/dist/jsx.js +0 -1
  225. data/node_modules/preact-render-to-string/dist/jsx.js.map +0 -1
  226. data/node_modules/preact-render-to-string/dist/jsx.mjs +0 -2
  227. data/node_modules/preact-render-to-string/dist/jsx.modern.js +0 -2
  228. data/node_modules/preact-render-to-string/dist/jsx.modern.js.map +0 -1
  229. data/node_modules/preact-render-to-string/dist/jsx.module.js +0 -2
  230. data/node_modules/preact-render-to-string/dist/jsx.module.js.map +0 -1
  231. data/node_modules/preact-render-to-string/dist/preact-render-to-string-tests.d.ts +0 -1
  232. data/node_modules/preact-render-to-string/jsx.js +0 -1
  233. data/node_modules/preact-render-to-string/package.json +0 -142
  234. data/node_modules/preact-render-to-string/src/index.d.ts +0 -16
  235. data/node_modules/preact-render-to-string/src/index.js +0 -462
  236. data/node_modules/preact-render-to-string/src/jsx.d.ts +0 -13
  237. data/node_modules/preact-render-to-string/src/jsx.js +0 -76
  238. data/node_modules/preact-render-to-string/src/polyfills.js +0 -8
  239. data/node_modules/preact-render-to-string/src/preact-render-to-string-tests.d.ts +0 -1
  240. data/node_modules/preact-render-to-string/src/util.js +0 -78
  241. data/node_modules/preact-render-to-string/typings.json +0 -5
  242. data/node_modules/pretty-format/.npmignore +0 -3
  243. data/node_modules/pretty-format/LICENSE.md +0 -15
  244. data/node_modules/pretty-format/README.md +0 -94
  245. data/node_modules/pretty-format/index.js +0 -343
  246. data/node_modules/pretty-format/package.json +0 -26
  247. data/node_modules/pretty-format/plugins/ReactElement.js +0 -74
  248. data/node_modules/pretty-format/plugins/ReactTestComponent.js +0 -58
  249. data/node_modules/pretty-format/printString.js +0 -7
  250. data/node_modules/wouter-preact/cjs/index.js +0 -180
  251. data/node_modules/wouter-preact/cjs/matcher.js +0 -72
  252. data/node_modules/wouter-preact/cjs/package.json +0 -1
  253. data/node_modules/wouter-preact/cjs/react-deps.js +0 -75
  254. data/node_modules/wouter-preact/cjs/static-location.js +0 -21
  255. data/node_modules/wouter-preact/cjs/use-location.js +0 -94
  256. data/node_modules/wouter-preact/index.d.ts +0 -110
  257. data/node_modules/wouter-preact/index.js +0 -178
  258. data/node_modules/wouter-preact/matcher.d.ts +0 -30
  259. data/node_modules/wouter-preact/matcher.js +0 -66
  260. data/node_modules/wouter-preact/package.json +0 -33
  261. data/node_modules/wouter-preact/react-deps.js +0 -15
  262. data/node_modules/wouter-preact/static-location.d.ts +0 -16
  263. data/node_modules/wouter-preact/static-location.js +0 -17
  264. data/node_modules/wouter-preact/use-location.d.ts +0 -43
  265. data/node_modules/wouter-preact/use-location.js +0 -86
  266. data/package.json +0 -8
@@ -1,16 +0,0 @@
1
- import { _catchError } from './diff/catch-error';
2
-
3
- /**
4
- * The `option` object can potentially contain callback functions
5
- * that are called during various stages of our renderer. This is the
6
- * foundation on which all our addons like `preact/debug`, `preact/compat`,
7
- * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`
8
- * for a full list of available option hooks (most editors/IDEs allow you to
9
- * ctrl+click or cmd+click on mac the type definition below).
10
- * @type {import('./internal').Options}
11
- */
12
- const options = {
13
- _catchError
14
- };
15
-
16
- export default options;
@@ -1,75 +0,0 @@
1
- import { EMPTY_OBJ } from './constants';
2
- import { commitRoot, diff } from './diff/index';
3
- import { createElement, Fragment } from './create-element';
4
- import options from './options';
5
- import { slice } from './util';
6
-
7
- /**
8
- * Render a Preact virtual node into a DOM element
9
- * @param {import('./internal').ComponentChild} vnode The virtual node to render
10
- * @param {import('./internal').PreactElement} parentDom The DOM element to
11
- * render into
12
- * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an
13
- * existing DOM tree rooted at `replaceNode`
14
- */
15
- export function render(vnode, parentDom, replaceNode) {
16
- if (options._root) options._root(vnode, parentDom);
17
-
18
- // We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in
19
- // hydration mode or not by passing the `hydrate` function instead of a DOM
20
- // element..
21
- let isHydrating = typeof replaceNode === 'function';
22
-
23
- // To be able to support calling `render()` multiple times on the same
24
- // DOM node, we need to obtain a reference to the previous tree. We do
25
- // this by assigning a new `_children` property to DOM nodes which points
26
- // to the last rendered tree. By default this property is not present, which
27
- // means that we are mounting a new tree for the first time.
28
- let oldVNode = isHydrating
29
- ? null
30
- : (replaceNode && replaceNode._children) || parentDom._children;
31
-
32
- vnode = (
33
- (!isHydrating && replaceNode) ||
34
- parentDom
35
- )._children = createElement(Fragment, null, [vnode]);
36
-
37
- // List of effects that need to be called after diffing.
38
- let commitQueue = [];
39
- diff(
40
- parentDom,
41
- // Determine the new vnode tree and store it on the DOM element on
42
- // our custom `_children` property.
43
- vnode,
44
- oldVNode || EMPTY_OBJ,
45
- EMPTY_OBJ,
46
- parentDom.ownerSVGElement !== undefined,
47
- !isHydrating && replaceNode
48
- ? [replaceNode]
49
- : oldVNode
50
- ? null
51
- : parentDom.firstChild
52
- ? slice.call(parentDom.childNodes)
53
- : null,
54
- commitQueue,
55
- !isHydrating && replaceNode
56
- ? replaceNode
57
- : oldVNode
58
- ? oldVNode._dom
59
- : parentDom.firstChild,
60
- isHydrating
61
- );
62
-
63
- // Flush all queued effects
64
- commitRoot(commitQueue, vnode);
65
- }
66
-
67
- /**
68
- * Update an existing DOM element with data from a Preact virtual node
69
- * @param {import('./internal').ComponentChild} vnode The virtual node to render
70
- * @param {import('./internal').PreactElement} parentDom The DOM element to
71
- * update
72
- */
73
- export function hydrate(vnode, parentDom) {
74
- render(vnode, parentDom, hydrate);
75
- }
@@ -1,27 +0,0 @@
1
- import { EMPTY_ARR } from "./constants";
2
-
3
- /**
4
- * Assign properties from `props` to `obj`
5
- * @template O, P The obj and props types
6
- * @param {O} obj The object to copy properties to
7
- * @param {P} props The object to copy properties from
8
- * @returns {O & P}
9
- */
10
- export function assign(obj, props) {
11
- // @ts-ignore We change the type of `obj` to be `O & P`
12
- for (let i in props) obj[i] = props[i];
13
- return /** @type {O & P} */ (obj);
14
- }
15
-
16
- /**
17
- * Remove a child node from its parent if attached. This is a workaround for
18
- * IE11 which doesn't support `Element.prototype.remove()`. Using this function
19
- * is smaller than including a dedicated polyfill.
20
- * @param {Node} node The node to remove
21
- */
22
- export function removeNode(node) {
23
- let parentNode = node.parentNode;
24
- if (parentNode) parentNode.removeChild(node);
25
- }
26
-
27
- export const slice = EMPTY_ARR.slice;
@@ -1,2 +0,0 @@
1
- var r=require("preact");function n(){return r.options.t=r.options.debounceRendering,r.options.debounceRendering=function(n){return r.options.o=n},function(){return r.options.o&&r.options.o()}}var t=function(r){return null!=r&&"function"==typeof r.then},e=0;function o(){r.options.o&&(r.options.o(),delete r.options.o),void 0!==r.options.t?(r.options.debounceRendering=r.options.t,delete r.options.t):r.options.debounceRendering=void 0}exports.setupRerender=n,exports.act=function(u){if(++e>1){var i=u();return t(i)?i.then(function(){--e}):(--e,Promise.resolve())}var f,c,a=r.options.requestAnimationFrame,l=n();r.options.requestAnimationFrame=function(r){return f=r};var v,p,s=function(){try{for(l();f;)c=f,f=null,c(),l()}catch(r){v||(v=r)}finally{o()}r.options.requestAnimationFrame=a,--e};try{p=u()}catch(r){v=r}if(t(p))return p.then(s,function(r){throw s(),r});if(s(),v)throw v;return Promise.resolve()},exports.teardown=o;
2
- //# sourceMappingURL=testUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testUtils.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\tconst result = cb();\n\t\tif (isThenable(result)) {\n\t\t\treturn result.then(() => {\n\t\t\t\t--actDepth;\n\t\t\t});\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flush, toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => (flush = fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flush) {\n\t\t\t\ttoFlush = flush;\n\t\t\t\tflush = null;\n\n\t\t\t\ttoFlush();\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","teardown","undefined","result","Promise","resolve","flush","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","fc","err","finish","e"],"mappings":"wBAMA,SAAgBA,WACfC,UAAQC,EAA2BD,UAAQE,kBAC3CF,UAAQE,kBAAoB,SAAAC,UAAOH,UAAQI,EAAqBD,GACzD,kBAAMH,UAAQI,GAAsBJ,UAAQI,KAGpD,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,MAGtDC,EAAW,EAyFf,SAAgBC,IACXT,UAAQI,IAEXJ,UAAQI,WACDJ,UAAQI,QAG+B,IAApCJ,UAAQC,GAClBD,UAAQE,kBAAoBF,UAAQC,SAC7BD,UAAQC,GAEfD,UAAQE,uBAAoBQ,sCAzFvB,SAAaP,QACbK,EAAW,EAAG,KAObG,EAASR,WACXE,EAAWM,GACPA,EAAOJ,KAAK,aAChBC,OAGFA,EACKI,QAAQC,eAOZC,EAAOC,EAJLC,EAAgChB,UAAQiB,sBACxCC,EAAWnB,IAMjBC,UAAQiB,sBAAwB,SAAAE,UAAOL,EAAQK,OAwB3CC,EACAT,EAvBEU,EAAS,mBAEbH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,IAEA,MAAOI,GACHF,IACJA,EAAME,WAGPb,IAGDT,UAAQiB,sBAAwBD,IAC9BR,OAOFG,EAASR,IACR,MAAOmB,GACRF,EAAME,KAGHjB,EAAWM,UACPA,EAAOJ,KAAKc,EAAQ,SAAAD,SAC1BC,IACMD,OAORC,IACID,QACGA,SAEAR,QAAQC"}
@@ -1,2 +0,0 @@
1
- import{options as n}from"preact";function r(){return n.t=n.debounceRendering,n.debounceRendering=function(r){return n.o=r},function(){return n.o&&n.o()}}var t=function(n){return null!=n&&"function"==typeof n.then},o=0;function u(u){if(++o>1){var e=u();return t(e)?e.then(function(){--o}):(--o,Promise.resolve())}var f,c,a=n.requestAnimationFrame,l=r();n.requestAnimationFrame=function(n){return f=n};var v,d,h=function(){try{for(l();f;)c=f,f=null,c(),l()}catch(n){v||(v=n)}finally{i()}n.requestAnimationFrame=a,--o};try{d=u()}catch(n){v=n}if(t(d))return d.then(h,function(n){throw h(),n});if(h(),v)throw v;return Promise.resolve()}function i(){n.o&&(n.o(),delete n.o),void 0!==n.t?(n.debounceRendering=n.t,delete n.t):n.debounceRendering=void 0}export{r as setupRerender,u as act,i as teardown};
2
- //# sourceMappingURL=testUtils.module.js.map
@@ -1,2 +0,0 @@
1
- import{options as n}from"preact";function r(){return n.t=n.debounceRendering,n.debounceRendering=function(r){return n.o=r},function(){return n.o&&n.o()}}var t=function(n){return null!=n&&"function"==typeof n.then},o=0;function u(u){if(++o>1){var e=u();return t(e)?e.then(function(){--o}):(--o,Promise.resolve())}var f,c,a=n.requestAnimationFrame,l=r();n.requestAnimationFrame=function(n){return f=n};var v,d,h=function(){try{for(l();f;)c=f,f=null,c(),l()}catch(n){v||(v=n)}finally{i()}n.requestAnimationFrame=a,--o};try{d=u()}catch(n){v=n}if(t(d))return d.then(h,function(n){throw h(),n});if(h(),v)throw v;return Promise.resolve()}function i(){n.o&&(n.o(),delete n.o),void 0!==n.t?(n.debounceRendering=n.t,delete n.t):n.debounceRendering=void 0}export{r as setupRerender,u as act,i as teardown};
2
- //# sourceMappingURL=testUtils.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testUtils.module.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\tconst result = cb();\n\t\tif (isThenable(result)) {\n\t\t\treturn result.then(() => {\n\t\t\t\t--actDepth;\n\t\t\t});\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flush, toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => (flush = fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flush) {\n\t\t\t\ttoFlush = flush;\n\t\t\t\tflush = null;\n\n\t\t\t\ttoFlush();\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","act","result","Promise","resolve","flush","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","fc","err","finish","e","teardown","undefined"],"mappings":"iCAMA,SAAgBA,WACfC,EAAQC,EAA2BD,EAAQE,kBAC3CF,EAAQE,kBAAoB,SAAAC,UAAOH,EAAQI,EAAqBD,GACzD,kBAAMH,EAAQI,GAAsBJ,EAAQI,KAGpD,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,MAGtDC,EAAW,EAWR,SAASC,EAAIN,QACbK,EAAW,EAAG,KAObE,EAASP,WACXE,EAAWK,GACPA,EAAOH,KAAK,aAChBC,OAGFA,EACKG,QAAQC,eAOZC,EAAOC,EAJLC,EAAgCf,EAAQgB,sBACxCC,EAAWlB,IAMjBC,EAAQgB,sBAAwB,SAAAE,UAAOL,EAAQK,OAwB3CC,EACAT,EAvBEU,EAAS,mBAEbH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,IAEA,MAAOI,GACHF,IACJA,EAAME,WAGPC,IAGDtB,EAAQgB,sBAAwBD,IAC9BP,OAOFE,EAASP,IACR,MAAOkB,GACRF,EAAME,KAGHhB,EAAWK,UACPA,EAAOH,KAAKa,EAAQ,SAAAD,SAC1BC,IACMD,OAORC,IACID,QACGA,SAEAR,QAAQC,UAMhB,SAAgBU,IACXtB,EAAQI,IAEXJ,EAAQI,WACDJ,EAAQI,QAG+B,IAApCJ,EAAQC,GAClBD,EAAQE,kBAAoBF,EAAQC,SAC7BD,EAAQC,GAEfD,EAAQE,uBAAoBqB"}
@@ -1,2 +0,0 @@
1
- !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t(n.preactTestUtils={},n.preact)}(this,function(n,t){function e(){return t.options.t=t.options.debounceRendering,t.options.debounceRendering=function(n){return t.options.o=n},function(){return t.options.o&&t.options.o()}}var r=function(n){return null!=n&&"function"==typeof n.then},o=0;function i(){t.options.o&&(t.options.o(),delete t.options.o),void 0!==t.options.t?(t.options.debounceRendering=t.options.t,delete t.options.t):t.options.debounceRendering=void 0}n.setupRerender=e,n.act=function(n){if(++o>1){var f=n();return r(f)?f.then(function(){--o}):(--o,Promise.resolve())}var u,c,d=t.options.requestAnimationFrame,a=e();t.options.requestAnimationFrame=function(n){return u=n};var l,p,y=function(){try{for(a();u;)c=u,u=null,c(),a()}catch(n){l||(l=n)}finally{i()}t.options.requestAnimationFrame=d,--o};try{p=n()}catch(n){l=n}if(r(p))return p.then(y,function(n){throw y(),n});if(y(),l)throw l;return Promise.resolve()},n.teardown=i});
2
- //# sourceMappingURL=testUtils.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testUtils.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\tconst result = cb();\n\t\tif (isThenable(result)) {\n\t\t\treturn result.then(() => {\n\t\t\t\t--actDepth;\n\t\t\t});\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flush, toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => (flush = fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flush) {\n\t\t\t\ttoFlush = flush;\n\t\t\t\tflush = null;\n\n\t\t\t\ttoFlush();\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","teardown","undefined","result","Promise","resolve","flush","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","fc","err","finish","e"],"mappings":"2NAMO,SAASA,WACfC,UAAQC,EAA2BD,UAAQE,kBAC3CF,UAAQE,kBAAoB,SAAAC,UAAOH,UAAQI,EAAqBD,GACzD,kBAAMH,UAAQI,GAAsBJ,UAAQI,KAGpD,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,MAGtDC,EAAW,EAyFR,SAASC,IACXT,UAAQI,IAEXJ,UAAQI,WACDJ,UAAQI,QAG+B,IAApCJ,UAAQC,GAClBD,UAAQE,kBAAoBF,UAAQC,SAC7BD,UAAQC,GAEfD,UAAQE,uBAAoBQ,0BAzFvB,SAAaP,QACbK,EAAW,EAAG,KAObG,EAASR,WACXE,EAAWM,GACPA,EAAOJ,KAAK,aAChBC,OAGFA,EACKI,QAAQC,eAOZC,EAAOC,EAJLC,EAAgChB,UAAQiB,sBACxCC,EAAWnB,IAMjBC,UAAQiB,sBAAwB,SAAAE,UAAOL,EAAQK,OAwB3CC,EACAT,EAvBEU,EAAS,mBAEbH,IACOJ,GACNC,EAAUD,EACVA,EAAQ,KAERC,IACAG,IAEA,MAAOI,GACHF,IACJA,EAAME,WAGPb,IAGDT,UAAQiB,sBAAwBD,IAC9BR,OAOFG,EAASR,IACR,MAAOmB,GACRF,EAAME,KAGHjB,EAAWM,UACPA,EAAOJ,KAAKc,EAAQ,SAAAD,SAC1BC,IACMD,OAORC,IACID,QACGA,SAEAR,QAAQC"}
@@ -1,28 +0,0 @@
1
- {
2
- "name": "test-utils",
3
- "amdName": "preactTestUtils",
4
- "version": "0.1.0",
5
- "private": true,
6
- "description": "Test-utils for Preact",
7
- "main": "dist/testUtils.js",
8
- "module": "dist/testUtils.module.js",
9
- "umd:main": "dist/testUtils.umd.js",
10
- "source": "src/index.js",
11
- "license": "MIT",
12
- "types": "src/index.d.ts",
13
- "peerDependencies": {
14
- "preact": "^10.0.0"
15
- },
16
- "mangle": {
17
- "regex": "^_"
18
- },
19
- "exports": {
20
- ".": {
21
- "types": "./src/index.d.ts",
22
- "browser": "./dist/testUtils.module.js",
23
- "umd": "./dist/testUtils.umd.js",
24
- "import": "./dist/testUtils.mjs",
25
- "require": "./dist/testUtils.js"
26
- }
27
- }
28
- }
@@ -1,3 +0,0 @@
1
- export function setupRerender(): () => void;
2
- export function act(callback: () => void | Promise<void>): Promise<void>;
3
- export function teardown(): void;
@@ -1,118 +0,0 @@
1
- import { options } from 'preact';
2
-
3
- /**
4
- * Setup a rerender function that will drain the queue of pending renders
5
- * @returns {() => void}
6
- */
7
- export function setupRerender() {
8
- options.__test__previousDebounce = options.debounceRendering;
9
- options.debounceRendering = cb => (options.__test__drainQueue = cb);
10
- return () => options.__test__drainQueue && options.__test__drainQueue();
11
- }
12
-
13
- const isThenable = value => value != null && typeof value.then == 'function';
14
-
15
- /** Depth of nested calls to `act`. */
16
- let actDepth = 0;
17
-
18
- /**
19
- * Run a test function, and flush all effects and rerenders after invoking it.
20
- *
21
- * Returns a Promise which resolves "immediately" if the callback is
22
- * synchronous or when the callback's result resolves if it is asynchronous.
23
- *
24
- * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.
25
- * @return {Promise<void>}
26
- */
27
- export function act(cb) {
28
- if (++actDepth > 1) {
29
- // If calls to `act` are nested, a flush happens only when the
30
- // outermost call returns. In the inner call, we just execute the
31
- // callback and return since the infrastructure for flushing has already
32
- // been set up.
33
- //
34
- // If an exception occurs, the outermost `act` will handle cleanup.
35
- const result = cb();
36
- if (isThenable(result)) {
37
- return result.then(() => {
38
- --actDepth;
39
- });
40
- }
41
- --actDepth;
42
- return Promise.resolve();
43
- }
44
-
45
- const previousRequestAnimationFrame = options.requestAnimationFrame;
46
- const rerender = setupRerender();
47
-
48
- /** @type {() => void} */
49
- let flush, toFlush;
50
-
51
- // Override requestAnimationFrame so we can flush pending hooks.
52
- options.requestAnimationFrame = fc => (flush = fc);
53
-
54
- const finish = () => {
55
- try {
56
- rerender();
57
- while (flush) {
58
- toFlush = flush;
59
- flush = null;
60
-
61
- toFlush();
62
- rerender();
63
- }
64
- } catch (e) {
65
- if (!err) {
66
- err = e;
67
- }
68
- } finally {
69
- teardown();
70
- }
71
-
72
- options.requestAnimationFrame = previousRequestAnimationFrame;
73
- --actDepth;
74
- };
75
-
76
- let err;
77
- let result;
78
-
79
- try {
80
- result = cb();
81
- } catch (e) {
82
- err = e;
83
- }
84
-
85
- if (isThenable(result)) {
86
- return result.then(finish, err => {
87
- finish();
88
- throw err;
89
- });
90
- }
91
-
92
- // nb. If the callback is synchronous, effects must be flushed before
93
- // `act` returns, so that the caller does not have to await the result,
94
- // even though React recommends this.
95
- finish();
96
- if (err) {
97
- throw err;
98
- }
99
- return Promise.resolve();
100
- }
101
-
102
- /**
103
- * Teardown test environment and reset preact's internal state
104
- */
105
- export function teardown() {
106
- if (options.__test__drainQueue) {
107
- // Flush any pending updates leftover by test
108
- options.__test__drainQueue();
109
- delete options.__test__drainQueue;
110
- }
111
-
112
- if (typeof options.__test__previousDebounce != 'undefined') {
113
- options.debounceRendering = options.__test__previousDebounce;
114
- delete options.__test__previousDebounce;
115
- } else {
116
- options.debounceRendering = undefined;
117
- }
118
- }
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Jason Miller
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,102 +0,0 @@
1
- # preact-render-to-string
2
-
3
- [![NPM](http://img.shields.io/npm/v/preact-render-to-string.svg)](https://www.npmjs.com/package/preact-render-to-string)
4
- [![Build status](https://github.com/preactjs/preact-render-to-string/actions/workflows/ci.yml/badge.svg)](https://github.com/preactjs/preact-render-to-string/actions/workflows/ci.yml)
5
-
6
- Render JSX and [Preact] components to an HTML string.
7
-
8
- Works in Node & the browser, making it useful for universal/isomorphic rendering.
9
-
10
- \>\> **[Cute Fox-Related Demo](http://codepen.io/developit/pen/dYZqjE?editors=001)** _(@ CodePen)_ <<
11
-
12
-
13
- ---
14
-
15
-
16
- ### Render JSX/VDOM to HTML
17
-
18
- ```js
19
- import render from 'preact-render-to-string';
20
- import { h } from 'preact';
21
- /** @jsx h */
22
-
23
- let vdom = <div class="foo">content</div>;
24
-
25
- let html = render(vdom);
26
- console.log(html);
27
- // <div class="foo">content</div>
28
- ```
29
-
30
-
31
- ### Render Preact Components to HTML
32
-
33
- ```js
34
- import render from 'preact-render-to-string';
35
- import { h, Component } from 'preact';
36
- /** @jsx h */
37
-
38
- // Classical components work
39
- class Fox extends Component {
40
- render({ name }) {
41
- return <span class="fox">{ name }</span>;
42
- }
43
- }
44
-
45
- // ... and so do pure functional components:
46
- const Box = ({ type, children }) => (
47
- <div class={`box box-${type}`}>{ children }</div>
48
- );
49
-
50
- let html = render(
51
- <Box type="open">
52
- <Fox name="Finn" />
53
- </Box>
54
- );
55
-
56
- console.log(html);
57
- // <div class="box box-open"><span class="fox">Finn</span></div>
58
- ```
59
-
60
-
61
- ---
62
-
63
-
64
- ### Render JSX / Preact / Whatever via Express!
65
-
66
- ```js
67
- import express from 'express';
68
- import { h } from 'preact';
69
- import render from 'preact-render-to-string';
70
- /** @jsx h */
71
-
72
- // silly example component:
73
- const Fox = ({ name }) => (
74
- <div class="fox">
75
- <h5>{ name }</h5>
76
- <p>This page is all about {name}.</p>
77
- </div>
78
- );
79
-
80
- // basic HTTP server via express:
81
- const app = express();
82
- app.listen(8080);
83
-
84
- // on each request, render and return a component:
85
- app.get('/:fox', (req, res) => {
86
- let html = render(<Fox name={req.params.fox} />);
87
- // send it back wrapped up as an HTML5 document:
88
- res.send(`<!DOCTYPE html><html><body>${html}</body></html>`);
89
- });
90
- ```
91
-
92
-
93
- ---
94
-
95
-
96
- ### License
97
-
98
- [MIT]
99
-
100
-
101
- [Preact]: https://github.com/developit/preact
102
- [MIT]: http://choosealicense.com/licenses/mit/
@@ -1,2 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((e||self).preactRenderToString={},e.preact)}(this,function(e,t){var n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,r=/[&<>"]/;function o(e){var t=String(e);return r.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t}var i=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},a=function(e,t,n){return String(e).length>(t||40)||!n&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var r in e){var o=e[r];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==r[0]?r:l[r]||(l[r]=r.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===n.test(r)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var n in t)e[n]=t[n];return e}function p(e,t){return Array.isArray(t)?t.reduce(p,e):null!=t&&!1!==t&&e.push(t),e}var u={shallow:!0},c=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,d=/[\s\n\\/='"\0<>]/;function v(){this.__d=!0}y.render=y;var g=function(e,t){return y(e,t,u)},h=[];function y(e,n,r){n=n||{},r=r||{};var o=t.options.__s;t.options.__s=!0;var i=m(e,n,r);return t.options.__c&&t.options.__c(e,h),h.length=0,t.options.__s=o,i}function m(e,n,r,l,u,g){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return o(e);var h=r.pretty,y=h&&"string"==typeof h?h:"\t";if(Array.isArray(e)){for(var x="",b=0;b<e.length;b++)h&&b>0&&(x+="\n"),x+=m(e[b],n,r,l,u,g);return x}var S,w=e.type,k=e.props,O=!1;if("function"==typeof w){if(O=!0,!r.shallow||!l&&!1!==r.renderRootComponent){if(w===t.Fragment){var T=[];return p(T,e.props.children),m(T,n,r,!1!==r.shallowHighOrder,u,g)}var C,A=e.__c={__v:e,context:n,props:e.props,setState:v,forceUpdate:v,__d:!0,__h:[]};t.options.__b&&t.options.__b(e);var j=t.options.__r;if(w.prototype&&"function"==typeof w.prototype.render){var F=w.contextType,H=F&&n[F.__c],M=null!=F?H?H.props.value:F.__:n;(A=e.__c=new w(k,M)).__v=e,A._dirty=A.__d=!0,A.props=k,null==A.state&&(A.state={}),null==A._nextState&&null==A.__s&&(A._nextState=A.__s=A.state),A.context=M,w.getDerivedStateFromProps?A.state=f(f({},A.state),w.getDerivedStateFromProps(A.props,A.state)):A.componentWillMount&&(A.componentWillMount(),A.state=A._nextState!==A.state?A._nextState:A.__s!==A.state?A.__s:A.state),j&&j(e),C=A.render(A.props,A.state,A.context)}else for(var $=w.contextType,L=$&&n[$.__c],R=null!=$?L?L.props.value:$.__:n,E=0;A.__d&&E++<25;)A.__d=!1,j&&j(e),C=w.call(e.__c,k,R);return A.getChildContext&&(n=f(f({},n),A.getChildContext())),t.options.diffed&&t.options.diffed(e),m(C,n,r,!1!==r.shallowHighOrder,u,g)}w=(S=w).displayName||S!==Function&&S.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var n=-1,r=c.length;r--;)if(c[r]===e){n=r;break}n<0&&(n=c.push(e)-1),t="UnnamedComponent"+n}return t}(S)}var q,D,N="<"+w;if(k){var P=Object.keys(k);r&&!0===r.sortAttributes&&P.sort();for(var U=0;U<P.length;U++){var W=P[U],z=k[W];if("children"!==W){if(!d.test(W)&&(r&&r.allAttributes||"key"!==W&&"ref"!==W&&"__self"!==W&&"__source"!==W)){if("defaultValue"===W)W="value";else if("className"===W){if(void 0!==k.class)continue;W="class"}else u&&W.match(/^xlink:?./)&&(W=W.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===W){if(k.for)continue;W="for"}"style"===W&&z&&"object"==typeof z&&(z=s(z)),"a"===W[0]&&"r"===W[1]&&"boolean"==typeof z&&(z=String(z));var I=r.attributeHook&&r.attributeHook(W,z,n,r,O);if(I||""===I)N+=I;else if("dangerouslySetInnerHTML"===W)D=z&&z.__html;else if("textarea"===w&&"value"===W)q=z;else if((z||0===z||""===z)&&"function"!=typeof z){if(!(!0!==z&&""!==z||(z=W,r&&r.xml))){N+=" "+W;continue}if("value"===W){if("select"===w){g=z;continue}"option"===w&&g==z&&void 0===k.selected&&(N+=" selected")}N+=" "+W+'="'+o(z)+'"'}}}else q=z}}if(h){var V=N.replace(/\n\s*/," ");V===N||~V.indexOf("\n")?h&&~N.indexOf("\n")&&(N+="\n"):N=V}if(N+=">",d.test(w))throw new Error(w+" is not a valid HTML tag name in "+N);var Z,B=_.test(w)||r.voidElements&&r.voidElements.test(w),G=[];if(D)h&&a(D)&&(D="\n"+y+i(D,y)),N+=D;else if(null!=q&&p(Z=[],q).length){for(var J=h&&~N.indexOf("\n"),K=!1,Q=0;Q<Z.length;Q++){var X=Z[Q];if(null!=X&&!1!==X){var Y=m(X,n,r,!0,"svg"===w||"foreignObject"!==w&&u,g);if(h&&!J&&a(Y)&&(J=!0),Y)if(h){var ee=Y.length>0&&"<"!=Y[0];K&&ee?G[G.length-1]+=Y:G.push(Y),K=ee}else G.push(Y)}}if(h&&J)for(var te=G.length;te--;)G[te]="\n"+y+i(G[te],y)}if(G.length||D)N+=G.join("");else if(r&&r.xml)return N.substring(0,N.length-1)+" />";return!B||Z||D?(h&&~N.indexOf("\n")&&(N+="\n"),N+="</"+w+">"):N=N.replace(/>$/," />"),N}y.shallowRender=g,e.default=y,e.render=y,e.renderToStaticMarkup=y,e.renderToString=y,e.shallowRender=g});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/util.js","../src/index.js"],"sourcesContent":["// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;\n\nconst ENCODED_ENTITIES = /[&<>\"]/;\n\nexport function encodeEntities(input) {\n\tconst s = String(input);\n\tif (!ENCODED_ENTITIES.test(s)) {\n\t\treturn s;\n\t}\n\treturn s\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\n}\n\nexport let indent = (s, char) =>\n\tString(s).replace(/(\\n+)/g, '$1' + (char || '\\t'));\n\nexport let isLargeString = (s, length, ignoreLines) =>\n\tString(s).length > (length || 40) ||\n\t(!ignoreLines && String(s).indexOf('\\n') !== -1) ||\n\tString(s).indexOf('<') !== -1;\n\nconst JS_TO_CSS = {};\n\n// Convert an Object style to a CSSText string\nexport function styleObjToCss(s) {\n\tlet str = '';\n\tfor (let prop in s) {\n\t\tlet val = s[prop];\n\t\tif (val != null && val !== '') {\n\t\t\tif (str) str += ' ';\n\t\t\t// str += jsToCss(prop);\n\t\t\tstr +=\n\t\t\t\tprop[0] == '-'\n\t\t\t\t\t? prop\n\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t (JS_TO_CSS[prop] = prop.replace(/([A-Z])/g, '-$1').toLowerCase());\n\t\t\tstr += ': ';\n\t\t\tstr += val;\n\t\t\tif (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) {\n\t\t\t\tstr += 'px';\n\t\t\t}\n\t\t\tstr += ';';\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/**\n * Get flattened children from the children prop\n * @param {Array} accumulator\n * @param {any} children A `props.children` opaque object.\n * @returns {Array} accumulator\n * @private\n */\nexport function getChildren(accumulator, children) {\n\tif (Array.isArray(children)) {\n\t\tchildren.reduce(getChildren, accumulator);\n\t} else if (children != null && children !== false) {\n\t\taccumulator.push(children);\n\t}\n\treturn accumulator;\n}\n","import {\n\tencodeEntities,\n\tindent,\n\tisLargeString,\n\tstyleObjToCss,\n\tassign,\n\tgetChildren\n} from './util';\nimport { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nconst SHALLOW = { shallow: true };\n\n// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.\nconst UNNAMED = [];\n\nconst VOID_ELEMENTS = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n\nconst UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\n\nfunction markAsDirty() {\n\tthis.__d = true;\n}\n\n/** Render Preact JSX + Components to an HTML string.\n *\t@name render\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n *\t@param {Object} [options={}]\tRendering options\n *\t@param {Boolean} [options.shallow=false]\tIf `true`, renders nested Components as HTML elements (`<Foo a=\"b\" />`).\n *\t@param {Boolean} [options.xml=false]\t\tIf `true`, uses self-closing tags for elements without children.\n *\t@param {Boolean} [options.pretty=false]\t\tIf `true`, adds whitespace for readability\n *\t@param {RegExp|undefined} [options.voidElements] RegeEx that matches elements that are considered void (self-closing)\n */\nrenderToString.render = renderToString;\n\n/** Only render elements, leaving Components inline as `<ComponentName ... />`.\n *\tThis method is just a convenience alias for `render(vnode, context, { shallow:true })`\n *\t@name shallow\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n */\nlet shallowRender = (vnode, context) => renderToString(vnode, context, SHALLOW);\n\nconst EMPTY_ARR = [];\nfunction renderToString(vnode, context, opts) {\n\tcontext = context || {};\n\topts = opts || {};\n\n\t// Performance optimization: `renderToString` is synchronous and we\n\t// therefore don't execute any effects. To do that we pass an empty\n\t// array to `options._commit` (`__c`). But we can go one step further\n\t// and avoid a lot of dirty checks and allocations by setting\n\t// `options._skipEffects` (`__s`) too.\n\tconst previousSkipEffects = options.__s;\n\toptions.__s = true;\n\n\tconst res = _renderToString(vnode, context, opts);\n\n\t// options._commit, we don't schedule any effects in this library right now,\n\t// so we can pass an empty queue to this hook.\n\tif (options.__c) options.__c(vnode, EMPTY_ARR);\n\tEMPTY_ARR.length = 0;\n\toptions.__s = previousSkipEffects;\n\treturn res;\n}\n\n/** The default export is an alias of `render()`. */\nfunction _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {\n\tif (vnode == null || typeof vnode === 'boolean') {\n\t\treturn '';\n\t}\n\n\t// #text nodes\n\tif (typeof vnode !== 'object') {\n\t\treturn encodeEntities(vnode);\n\t}\n\n\tlet pretty = opts.pretty,\n\t\tindentChar = pretty && typeof pretty === 'string' ? pretty : '\\t';\n\n\tif (Array.isArray(vnode)) {\n\t\tlet rendered = '';\n\t\tfor (let i = 0; i < vnode.length; i++) {\n\t\t\tif (pretty && i > 0) rendered += '\\n';\n\t\t\trendered += _renderToString(\n\t\t\t\tvnode[i],\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\tinner,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t\treturn rendered;\n\t}\n\n\tlet nodeName = vnode.type,\n\t\tprops = vnode.props,\n\t\tisComponent = false;\n\n\t// components\n\tif (typeof nodeName === 'function') {\n\t\tisComponent = true;\n\t\tif (opts.shallow && (inner || opts.renderRootComponent === false)) {\n\t\t\tnodeName = getComponentName(nodeName);\n\t\t} else if (nodeName === Fragment) {\n\t\t\tconst children = [];\n\t\t\tgetChildren(children, vnode.props.children);\n\t\t\treturn _renderToString(\n\t\t\t\tchildren,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t} else {\n\t\t\tlet rendered;\n\n\t\t\tlet c = (vnode.__c = {\n\t\t\t\t__v: vnode,\n\t\t\t\tcontext,\n\t\t\t\tprops: vnode.props,\n\t\t\t\t// silently drop state updates\n\t\t\t\tsetState: markAsDirty,\n\t\t\t\tforceUpdate: markAsDirty,\n\t\t\t\t__d: true,\n\t\t\t\t// hooks\n\t\t\t\t__h: []\n\t\t\t});\n\n\t\t\t// options._diff\n\t\t\tif (options.__b) options.__b(vnode);\n\n\t\t\t// options._render\n\t\t\tlet renderHook = options.__r;\n\n\t\t\tif (\n\t\t\t\t!nodeName.prototype ||\n\t\t\t\ttypeof nodeName.prototype.render !== 'function'\n\t\t\t) {\n\t\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t\t// the context value as `this.context` just for this component.\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// If a hook invokes setState() to invalidate the component during rendering,\n\t\t\t\t// re-render it up to 25 times to allow \"settling\" of memoized states.\n\t\t\t\t// Note:\n\t\t\t\t// This will need to be updated for Preact 11 to use internal.flags rather than component._dirty:\n\t\t\t\t// https://github.com/preactjs/preact/blob/d4ca6fdb19bc715e49fd144e69f7296b2f4daa40/src/diff/component.js#L35-L44\n\t\t\t\tlet count = 0;\n\t\t\t\twhile (c.__d && count++ < 25) {\n\t\t\t\t\tc.__d = false;\n\n\t\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\t\t// stateless functional components\n\t\t\t\t\trendered = nodeName.call(vnode.__c, props, cctx);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// class-based components\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// c = new nodeName(props, context);\n\t\t\t\tc = vnode.__c = new nodeName(props, cctx);\n\t\t\t\tc.__v = vnode;\n\t\t\t\t// turn off stateful re-rendering:\n\t\t\t\tc._dirty = c.__d = true;\n\t\t\t\tc.props = props;\n\t\t\t\tif (c.state == null) c.state = {};\n\n\t\t\t\tif (c._nextState == null && c.__s == null) {\n\t\t\t\t\tc._nextState = c.__s = c.state;\n\t\t\t\t}\n\n\t\t\t\tc.context = cctx;\n\t\t\t\tif (nodeName.getDerivedStateFromProps)\n\t\t\t\t\tc.state = assign(\n\t\t\t\t\t\tassign({}, c.state),\n\t\t\t\t\t\tnodeName.getDerivedStateFromProps(c.props, c.state)\n\t\t\t\t\t);\n\t\t\t\telse if (c.componentWillMount) {\n\t\t\t\t\tc.componentWillMount();\n\n\t\t\t\t\t// If the user called setState in cWM we need to flush pending,\n\t\t\t\t\t// state updates. This is the same behaviour in React.\n\t\t\t\t\tc.state =\n\t\t\t\t\t\tc._nextState !== c.state\n\t\t\t\t\t\t\t? c._nextState\n\t\t\t\t\t\t\t: c.__s !== c.state\n\t\t\t\t\t\t\t? c.__s\n\t\t\t\t\t\t\t: c.state;\n\t\t\t\t}\n\n\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\trendered = c.render(c.props, c.state, c.context);\n\t\t\t}\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tcontext = assign(assign({}, context), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (options.diffed) options.diffed(vnode);\n\t\t\treturn _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t}\n\n\t// render JSX to HTML\n\tlet s = '<' + nodeName,\n\t\tpropChildren,\n\t\thtml;\n\n\tif (props) {\n\t\tlet attrs = Object.keys(props);\n\n\t\t// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)\n\t\tif (opts && opts.sortAttributes === true) attrs.sort();\n\n\t\tfor (let i = 0; i < attrs.length; i++) {\n\t\t\tlet name = attrs[i],\n\t\t\t\tv = props[name];\n\t\t\tif (name === 'children') {\n\t\t\t\tpropChildren = v;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (UNSAFE_NAME.test(name)) continue;\n\n\t\t\tif (\n\t\t\t\t!(opts && opts.allAttributes) &&\n\t\t\t\t(name === 'key' ||\n\t\t\t\t\tname === 'ref' ||\n\t\t\t\t\tname === '__self' ||\n\t\t\t\t\tname === '__source')\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif (name === 'defaultValue') {\n\t\t\t\tname = 'value';\n\t\t\t} else if (name === 'className') {\n\t\t\t\tif (typeof props.class !== 'undefined') continue;\n\t\t\t\tname = 'class';\n\t\t\t} else if (isSvgMode && name.match(/^xlink:?./)) {\n\t\t\t\tname = name.toLowerCase().replace(/^xlink:?/, 'xlink:');\n\t\t\t}\n\n\t\t\tif (name === 'htmlFor') {\n\t\t\t\tif (props.for) continue;\n\t\t\t\tname = 'for';\n\t\t\t}\n\n\t\t\tif (name === 'style' && v && typeof v === 'object') {\n\t\t\t\tv = styleObjToCss(v);\n\t\t\t}\n\n\t\t\t// always use string values instead of booleans for aria attributes\n\t\t\t// also see https://github.com/preactjs/preact/pull/2347/files\n\t\t\tif (name[0] === 'a' && name['1'] === 'r' && typeof v === 'boolean') {\n\t\t\t\tv = String(v);\n\t\t\t}\n\n\t\t\tlet hooked =\n\t\t\t\topts.attributeHook &&\n\t\t\t\topts.attributeHook(name, v, context, opts, isComponent);\n\t\t\tif (hooked || hooked === '') {\n\t\t\t\ts += hooked;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (name === 'dangerouslySetInnerHTML') {\n\t\t\t\thtml = v && v.__html;\n\t\t\t} else if (nodeName === 'textarea' && name === 'value') {\n\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\tpropChildren = v;\n\t\t\t} else if ((v || v === 0 || v === '') && typeof v !== 'function') {\n\t\t\t\tif (v === true || v === '') {\n\t\t\t\t\tv = name;\n\t\t\t\t\t// in non-xml mode, allow boolean attributes\n\t\t\t\t\tif (!opts || !opts.xml) {\n\t\t\t\t\t\ts += ' ' + name;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (name === 'value') {\n\t\t\t\t\tif (nodeName === 'select') {\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t// If we're looking at an <option> and it's the currently selected one\n\t\t\t\t\t\tnodeName === 'option' &&\n\t\t\t\t\t\tselectValue == v &&\n\t\t\t\t\t\t// and the <option> doesn't already have a selected attribute on it\n\t\t\t\t\t\ttypeof props.selected === 'undefined'\n\t\t\t\t\t) {\n\t\t\t\t\t\ts += ` selected`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts += ` ${name}=\"${encodeEntities(v)}\"`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// account for >1 multiline attribute\n\tif (pretty) {\n\t\tlet sub = s.replace(/\\n\\s*/, ' ');\n\t\tif (sub !== s && !~sub.indexOf('\\n')) s = sub;\n\t\telse if (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t}\n\n\ts += '>';\n\n\tif (UNSAFE_NAME.test(nodeName))\n\t\tthrow new Error(`${nodeName} is not a valid HTML tag name in ${s}`);\n\n\tlet isVoid =\n\t\tVOID_ELEMENTS.test(nodeName) ||\n\t\t(opts.voidElements && opts.voidElements.test(nodeName));\n\tlet pieces = [];\n\n\tlet children;\n\tif (html) {\n\t\t// if multiline, indent.\n\t\tif (pretty && isLargeString(html)) {\n\t\t\thtml = '\\n' + indentChar + indent(html, indentChar);\n\t\t}\n\t\ts += html;\n\t} else if (\n\t\tpropChildren != null &&\n\t\tgetChildren((children = []), propChildren).length\n\t) {\n\t\tlet hasLarge = pretty && ~s.indexOf('\\n');\n\t\tlet lastWasText = false;\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tlet child = children[i];\n\n\t\t\tif (child != null && child !== false) {\n\t\t\t\tlet childSvgMode =\n\t\t\t\t\t\tnodeName === 'svg'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: nodeName === 'foreignObject'\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: isSvgMode,\n\t\t\t\t\tret = _renderToString(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\topts,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tchildSvgMode,\n\t\t\t\t\t\tselectValue\n\t\t\t\t\t);\n\n\t\t\t\tif (pretty && !hasLarge && isLargeString(ret)) hasLarge = true;\n\n\t\t\t\t// Skip if we received an empty string\n\t\t\t\tif (ret) {\n\t\t\t\t\tif (pretty) {\n\t\t\t\t\t\tlet isText = ret.length > 0 && ret[0] != '<';\n\n\t\t\t\t\t\t// We merge adjacent text nodes, otherwise each piece would be printed\n\t\t\t\t\t\t// on a new line.\n\t\t\t\t\t\tif (lastWasText && isText) {\n\t\t\t\t\t\t\tpieces[pieces.length - 1] += ret;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastWasText = isText;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pretty && hasLarge) {\n\t\t\tfor (let i = pieces.length; i--; ) {\n\t\t\t\tpieces[i] = '\\n' + indentChar + indent(pieces[i], indentChar);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pieces.length || html) {\n\t\ts += pieces.join('');\n\t} else if (opts && opts.xml) {\n\t\treturn s.substring(0, s.length - 1) + ' />';\n\t}\n\n\tif (isVoid && !children && !html) {\n\t\ts = s.replace(/>$/, ' />');\n\t} else {\n\t\tif (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t\ts += `</${nodeName}>`;\n\t}\n\n\treturn s;\n}\n\nfunction getComponentName(component) {\n\treturn (\n\t\tcomponent.displayName ||\n\t\t(component !== Function && component.name) ||\n\t\tgetFallbackComponentName(component)\n\t);\n}\n\nfunction getFallbackComponentName(component) {\n\tlet str = Function.prototype.toString.call(component),\n\t\tname = (str.match(/^\\s*function\\s+([^( ]+)/) || '')[1];\n\tif (!name) {\n\t\t// search for an existing indexed name for the given component:\n\t\tlet index = -1;\n\t\tfor (let i = UNNAMED.length; i--; ) {\n\t\t\tif (UNNAMED[i] === component) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// not found, create a new indexed name:\n\t\tif (index < 0) {\n\t\t\tindex = UNNAMED.push(component) - 1;\n\t\t}\n\t\tname = `UnnamedComponent${index}`;\n\t}\n\treturn name;\n}\nrenderToString.shallowRender = shallowRender;\n\nexport default renderToString;\n\nexport {\n\trenderToString as render,\n\trenderToString as renderToStaticMarkup,\n\trenderToString,\n\tshallowRender\n};\n"],"names":["IS_NON_DIMENSIONAL","ENCODED_ENTITIES","encodeEntities","input","s","String","test","replace","indent","char","isLargeString","length","ignoreLines","indexOf","JS_TO_CSS","styleObjToCss","str","prop","val","toLowerCase","undefined","assign","obj","props","i","getChildren","accumulator","children","Array","isArray","reduce","push","SHALLOW","shallow","UNNAMED","VOID_ELEMENTS","UNSAFE_NAME","markAsDirty","this","__d","renderToString","render","shallowRender","vnode","context","EMPTY_ARR","opts","previousSkipEffects","options","__s","res","_renderToString","__c","inner","isSvgMode","selectValue","pretty","indentChar","rendered","component","nodeName","type","isComponent","renderRootComponent","Fragment","shallowHighOrder","c","__v","setState","forceUpdate","__h","__b","renderHook","__r","prototype","cxType","contextType","provider","cctx","value","__","_dirty","state","_nextState","getDerivedStateFromProps","componentWillMount","count","call","getChildContext","diffed","displayName","Function","name","toString","match","index","getFallbackComponentName","propChildren","html","attrs","Object","keys","sortAttributes","sort","v","allAttributes","hooked","attributeHook","__html","xml","selected","sub","Error","isVoid","voidElements","pieces","hasLarge","lastWasText","child","ret","isText","join","substring"],"mappings":"wRACaA,EAAqB,kEAE5BC,EAAmB,kBAETC,EAAeC,GAC9B,IAAMC,EAAIC,OAAOF,GACjB,OAAKF,EAAiBK,KAAKF,GAGpBA,EACLG,QAAQ,KAAM,SACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,UANRH,MASEI,EAAS,SAACJ,EAAGK,UACvBJ,OAAOD,GAAGG,QAAQ,SAAU,MAAQE,GAAQ,QAElCC,EAAgB,SAACN,EAAGO,EAAQC,UACtCP,OAAOD,GAAGO,QAAUA,GAAU,MAC5BC,IAA4C,IAA7BP,OAAOD,GAAGS,QAAQ,QACP,IAA5BR,OAAOD,GAAGS,QAAQ,MAEbC,EAAY,YAGFC,EAAcX,GAC7B,IAAIY,EAAM,GACV,IAAK,IAAIC,KAAQb,EAAG,CACnB,IAAIc,EAAMd,EAAEa,GACD,MAAPC,GAAuB,KAARA,IACdF,IAAKA,GAAO,KAEhBA,GACY,KAAXC,EAAK,GACFA,EACAH,EAAUG,KACTH,EAAUG,GAAQA,EAAKV,QAAQ,WAAY,OAAOY,eACvDH,GAAO,KACPA,GAAOE,EACY,iBAARA,IAAsD,IAAlClB,EAAmBM,KAAKW,KACtDD,GAAO,MAERA,GAAO,KAGT,OAA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ES,QAAQ,QAAOT,GAAK,MACrCA,QAAUwD,OAHVxD,EAAIA,EAAEG,QAAQ,KAAM,OAMdH,EA+BRoC,EAAeE,cAAgBA"}
@@ -1,16 +0,0 @@
1
- import { VNode } from 'preact';
2
-
3
- interface Options {
4
- shallow?: boolean;
5
- xml?: boolean;
6
- pretty?: boolean | string;
7
- }
8
-
9
- export function render(vnode: VNode, context?: any, options?: Options): string;
10
- export function renderToString(
11
- vnode: VNode,
12
- context?: any,
13
- options?: Options
14
- ): string;
15
- export function shallowRender(vnode: VNode, context?: any): string;
16
- export default render;
@@ -1 +0,0 @@
1
- module.exports = require('./commonjs').default;
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/util.js","../src/index.js"],"sourcesContent":["// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;\n\nconst ENCODED_ENTITIES = /[&<>\"]/;\n\nexport function encodeEntities(input) {\n\tconst s = String(input);\n\tif (!ENCODED_ENTITIES.test(s)) {\n\t\treturn s;\n\t}\n\treturn s\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\n}\n\nexport let indent = (s, char) =>\n\tString(s).replace(/(\\n+)/g, '$1' + (char || '\\t'));\n\nexport let isLargeString = (s, length, ignoreLines) =>\n\tString(s).length > (length || 40) ||\n\t(!ignoreLines && String(s).indexOf('\\n') !== -1) ||\n\tString(s).indexOf('<') !== -1;\n\nconst JS_TO_CSS = {};\n\n// Convert an Object style to a CSSText string\nexport function styleObjToCss(s) {\n\tlet str = '';\n\tfor (let prop in s) {\n\t\tlet val = s[prop];\n\t\tif (val != null && val !== '') {\n\t\t\tif (str) str += ' ';\n\t\t\t// str += jsToCss(prop);\n\t\t\tstr +=\n\t\t\t\tprop[0] == '-'\n\t\t\t\t\t? prop\n\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t (JS_TO_CSS[prop] = prop.replace(/([A-Z])/g, '-$1').toLowerCase());\n\t\t\tstr += ': ';\n\t\t\tstr += val;\n\t\t\tif (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) {\n\t\t\t\tstr += 'px';\n\t\t\t}\n\t\t\tstr += ';';\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/**\n * Get flattened children from the children prop\n * @param {Array} accumulator\n * @param {any} children A `props.children` opaque object.\n * @returns {Array} accumulator\n * @private\n */\nexport function getChildren(accumulator, children) {\n\tif (Array.isArray(children)) {\n\t\tchildren.reduce(getChildren, accumulator);\n\t} else if (children != null && children !== false) {\n\t\taccumulator.push(children);\n\t}\n\treturn accumulator;\n}\n","import {\n\tencodeEntities,\n\tindent,\n\tisLargeString,\n\tstyleObjToCss,\n\tassign,\n\tgetChildren\n} from './util';\nimport { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nconst SHALLOW = { shallow: true };\n\n// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.\nconst UNNAMED = [];\n\nconst VOID_ELEMENTS = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n\nconst UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\n\nfunction markAsDirty() {\n\tthis.__d = true;\n}\n\n/** Render Preact JSX + Components to an HTML string.\n *\t@name render\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n *\t@param {Object} [options={}]\tRendering options\n *\t@param {Boolean} [options.shallow=false]\tIf `true`, renders nested Components as HTML elements (`<Foo a=\"b\" />`).\n *\t@param {Boolean} [options.xml=false]\t\tIf `true`, uses self-closing tags for elements without children.\n *\t@param {Boolean} [options.pretty=false]\t\tIf `true`, adds whitespace for readability\n *\t@param {RegExp|undefined} [options.voidElements] RegeEx that matches elements that are considered void (self-closing)\n */\nrenderToString.render = renderToString;\n\n/** Only render elements, leaving Components inline as `<ComponentName ... />`.\n *\tThis method is just a convenience alias for `render(vnode, context, { shallow:true })`\n *\t@name shallow\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n */\nlet shallowRender = (vnode, context) => renderToString(vnode, context, SHALLOW);\n\nconst EMPTY_ARR = [];\nfunction renderToString(vnode, context, opts) {\n\tcontext = context || {};\n\topts = opts || {};\n\n\t// Performance optimization: `renderToString` is synchronous and we\n\t// therefore don't execute any effects. To do that we pass an empty\n\t// array to `options._commit` (`__c`). But we can go one step further\n\t// and avoid a lot of dirty checks and allocations by setting\n\t// `options._skipEffects` (`__s`) too.\n\tconst previousSkipEffects = options.__s;\n\toptions.__s = true;\n\n\tconst res = _renderToString(vnode, context, opts);\n\n\t// options._commit, we don't schedule any effects in this library right now,\n\t// so we can pass an empty queue to this hook.\n\tif (options.__c) options.__c(vnode, EMPTY_ARR);\n\tEMPTY_ARR.length = 0;\n\toptions.__s = previousSkipEffects;\n\treturn res;\n}\n\n/** The default export is an alias of `render()`. */\nfunction _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {\n\tif (vnode == null || typeof vnode === 'boolean') {\n\t\treturn '';\n\t}\n\n\t// #text nodes\n\tif (typeof vnode !== 'object') {\n\t\treturn encodeEntities(vnode);\n\t}\n\n\tlet pretty = opts.pretty,\n\t\tindentChar = pretty && typeof pretty === 'string' ? pretty : '\\t';\n\n\tif (Array.isArray(vnode)) {\n\t\tlet rendered = '';\n\t\tfor (let i = 0; i < vnode.length; i++) {\n\t\t\tif (pretty && i > 0) rendered += '\\n';\n\t\t\trendered += _renderToString(\n\t\t\t\tvnode[i],\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\tinner,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t\treturn rendered;\n\t}\n\n\tlet nodeName = vnode.type,\n\t\tprops = vnode.props,\n\t\tisComponent = false;\n\n\t// components\n\tif (typeof nodeName === 'function') {\n\t\tisComponent = true;\n\t\tif (opts.shallow && (inner || opts.renderRootComponent === false)) {\n\t\t\tnodeName = getComponentName(nodeName);\n\t\t} else if (nodeName === Fragment) {\n\t\t\tconst children = [];\n\t\t\tgetChildren(children, vnode.props.children);\n\t\t\treturn _renderToString(\n\t\t\t\tchildren,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t} else {\n\t\t\tlet rendered;\n\n\t\t\tlet c = (vnode.__c = {\n\t\t\t\t__v: vnode,\n\t\t\t\tcontext,\n\t\t\t\tprops: vnode.props,\n\t\t\t\t// silently drop state updates\n\t\t\t\tsetState: markAsDirty,\n\t\t\t\tforceUpdate: markAsDirty,\n\t\t\t\t__d: true,\n\t\t\t\t// hooks\n\t\t\t\t__h: []\n\t\t\t});\n\n\t\t\t// options._diff\n\t\t\tif (options.__b) options.__b(vnode);\n\n\t\t\t// options._render\n\t\t\tlet renderHook = options.__r;\n\n\t\t\tif (\n\t\t\t\t!nodeName.prototype ||\n\t\t\t\ttypeof nodeName.prototype.render !== 'function'\n\t\t\t) {\n\t\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t\t// the context value as `this.context` just for this component.\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// If a hook invokes setState() to invalidate the component during rendering,\n\t\t\t\t// re-render it up to 25 times to allow \"settling\" of memoized states.\n\t\t\t\t// Note:\n\t\t\t\t// This will need to be updated for Preact 11 to use internal.flags rather than component._dirty:\n\t\t\t\t// https://github.com/preactjs/preact/blob/d4ca6fdb19bc715e49fd144e69f7296b2f4daa40/src/diff/component.js#L35-L44\n\t\t\t\tlet count = 0;\n\t\t\t\twhile (c.__d && count++ < 25) {\n\t\t\t\t\tc.__d = false;\n\n\t\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\t\t// stateless functional components\n\t\t\t\t\trendered = nodeName.call(vnode.__c, props, cctx);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// class-based components\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// c = new nodeName(props, context);\n\t\t\t\tc = vnode.__c = new nodeName(props, cctx);\n\t\t\t\tc.__v = vnode;\n\t\t\t\t// turn off stateful re-rendering:\n\t\t\t\tc._dirty = c.__d = true;\n\t\t\t\tc.props = props;\n\t\t\t\tif (c.state == null) c.state = {};\n\n\t\t\t\tif (c._nextState == null && c.__s == null) {\n\t\t\t\t\tc._nextState = c.__s = c.state;\n\t\t\t\t}\n\n\t\t\t\tc.context = cctx;\n\t\t\t\tif (nodeName.getDerivedStateFromProps)\n\t\t\t\t\tc.state = assign(\n\t\t\t\t\t\tassign({}, c.state),\n\t\t\t\t\t\tnodeName.getDerivedStateFromProps(c.props, c.state)\n\t\t\t\t\t);\n\t\t\t\telse if (c.componentWillMount) {\n\t\t\t\t\tc.componentWillMount();\n\n\t\t\t\t\t// If the user called setState in cWM we need to flush pending,\n\t\t\t\t\t// state updates. This is the same behaviour in React.\n\t\t\t\t\tc.state =\n\t\t\t\t\t\tc._nextState !== c.state\n\t\t\t\t\t\t\t? c._nextState\n\t\t\t\t\t\t\t: c.__s !== c.state\n\t\t\t\t\t\t\t? c.__s\n\t\t\t\t\t\t\t: c.state;\n\t\t\t\t}\n\n\t\t\t\tif (renderHook) renderHook(vnode);\n\n\t\t\t\trendered = c.render(c.props, c.state, c.context);\n\t\t\t}\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tcontext = assign(assign({}, context), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (options.diffed) options.diffed(vnode);\n\t\t\treturn _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t}\n\n\t// render JSX to HTML\n\tlet s = '<' + nodeName,\n\t\tpropChildren,\n\t\thtml;\n\n\tif (props) {\n\t\tlet attrs = Object.keys(props);\n\n\t\t// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)\n\t\tif (opts && opts.sortAttributes === true) attrs.sort();\n\n\t\tfor (let i = 0; i < attrs.length; i++) {\n\t\t\tlet name = attrs[i],\n\t\t\t\tv = props[name];\n\t\t\tif (name === 'children') {\n\t\t\t\tpropChildren = v;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (UNSAFE_NAME.test(name)) continue;\n\n\t\t\tif (\n\t\t\t\t!(opts && opts.allAttributes) &&\n\t\t\t\t(name === 'key' ||\n\t\t\t\t\tname === 'ref' ||\n\t\t\t\t\tname === '__self' ||\n\t\t\t\t\tname === '__source')\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif (name === 'defaultValue') {\n\t\t\t\tname = 'value';\n\t\t\t} else if (name === 'className') {\n\t\t\t\tif (typeof props.class !== 'undefined') continue;\n\t\t\t\tname = 'class';\n\t\t\t} else if (isSvgMode && name.match(/^xlink:?./)) {\n\t\t\t\tname = name.toLowerCase().replace(/^xlink:?/, 'xlink:');\n\t\t\t}\n\n\t\t\tif (name === 'htmlFor') {\n\t\t\t\tif (props.for) continue;\n\t\t\t\tname = 'for';\n\t\t\t}\n\n\t\t\tif (name === 'style' && v && typeof v === 'object') {\n\t\t\t\tv = styleObjToCss(v);\n\t\t\t}\n\n\t\t\t// always use string values instead of booleans for aria attributes\n\t\t\t// also see https://github.com/preactjs/preact/pull/2347/files\n\t\t\tif (name[0] === 'a' && name['1'] === 'r' && typeof v === 'boolean') {\n\t\t\t\tv = String(v);\n\t\t\t}\n\n\t\t\tlet hooked =\n\t\t\t\topts.attributeHook &&\n\t\t\t\topts.attributeHook(name, v, context, opts, isComponent);\n\t\t\tif (hooked || hooked === '') {\n\t\t\t\ts += hooked;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (name === 'dangerouslySetInnerHTML') {\n\t\t\t\thtml = v && v.__html;\n\t\t\t} else if (nodeName === 'textarea' && name === 'value') {\n\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\tpropChildren = v;\n\t\t\t} else if ((v || v === 0 || v === '') && typeof v !== 'function') {\n\t\t\t\tif (v === true || v === '') {\n\t\t\t\t\tv = name;\n\t\t\t\t\t// in non-xml mode, allow boolean attributes\n\t\t\t\t\tif (!opts || !opts.xml) {\n\t\t\t\t\t\ts += ' ' + name;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (name === 'value') {\n\t\t\t\t\tif (nodeName === 'select') {\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t// If we're looking at an <option> and it's the currently selected one\n\t\t\t\t\t\tnodeName === 'option' &&\n\t\t\t\t\t\tselectValue == v &&\n\t\t\t\t\t\t// and the <option> doesn't already have a selected attribute on it\n\t\t\t\t\t\ttypeof props.selected === 'undefined'\n\t\t\t\t\t) {\n\t\t\t\t\t\ts += ` selected`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts += ` ${name}=\"${encodeEntities(v)}\"`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// account for >1 multiline attribute\n\tif (pretty) {\n\t\tlet sub = s.replace(/\\n\\s*/, ' ');\n\t\tif (sub !== s && !~sub.indexOf('\\n')) s = sub;\n\t\telse if (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t}\n\n\ts += '>';\n\n\tif (UNSAFE_NAME.test(nodeName))\n\t\tthrow new Error(`${nodeName} is not a valid HTML tag name in ${s}`);\n\n\tlet isVoid =\n\t\tVOID_ELEMENTS.test(nodeName) ||\n\t\t(opts.voidElements && opts.voidElements.test(nodeName));\n\tlet pieces = [];\n\n\tlet children;\n\tif (html) {\n\t\t// if multiline, indent.\n\t\tif (pretty && isLargeString(html)) {\n\t\t\thtml = '\\n' + indentChar + indent(html, indentChar);\n\t\t}\n\t\ts += html;\n\t} else if (\n\t\tpropChildren != null &&\n\t\tgetChildren((children = []), propChildren).length\n\t) {\n\t\tlet hasLarge = pretty && ~s.indexOf('\\n');\n\t\tlet lastWasText = false;\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tlet child = children[i];\n\n\t\t\tif (child != null && child !== false) {\n\t\t\t\tlet childSvgMode =\n\t\t\t\t\t\tnodeName === 'svg'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: nodeName === 'foreignObject'\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: isSvgMode,\n\t\t\t\t\tret = _renderToString(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\topts,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tchildSvgMode,\n\t\t\t\t\t\tselectValue\n\t\t\t\t\t);\n\n\t\t\t\tif (pretty && !hasLarge && isLargeString(ret)) hasLarge = true;\n\n\t\t\t\t// Skip if we received an empty string\n\t\t\t\tif (ret) {\n\t\t\t\t\tif (pretty) {\n\t\t\t\t\t\tlet isText = ret.length > 0 && ret[0] != '<';\n\n\t\t\t\t\t\t// We merge adjacent text nodes, otherwise each piece would be printed\n\t\t\t\t\t\t// on a new line.\n\t\t\t\t\t\tif (lastWasText && isText) {\n\t\t\t\t\t\t\tpieces[pieces.length - 1] += ret;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastWasText = isText;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pretty && hasLarge) {\n\t\t\tfor (let i = pieces.length; i--; ) {\n\t\t\t\tpieces[i] = '\\n' + indentChar + indent(pieces[i], indentChar);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pieces.length || html) {\n\t\ts += pieces.join('');\n\t} else if (opts && opts.xml) {\n\t\treturn s.substring(0, s.length - 1) + ' />';\n\t}\n\n\tif (isVoid && !children && !html) {\n\t\ts = s.replace(/>$/, ' />');\n\t} else {\n\t\tif (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t\ts += `</${nodeName}>`;\n\t}\n\n\treturn s;\n}\n\nfunction getComponentName(component) {\n\treturn (\n\t\tcomponent.displayName ||\n\t\t(component !== Function && component.name) ||\n\t\tgetFallbackComponentName(component)\n\t);\n}\n\nfunction getFallbackComponentName(component) {\n\tlet str = Function.prototype.toString.call(component),\n\t\tname = (str.match(/^\\s*function\\s+([^( ]+)/) || '')[1];\n\tif (!name) {\n\t\t// search for an existing indexed name for the given component:\n\t\tlet index = -1;\n\t\tfor (let i = UNNAMED.length; i--; ) {\n\t\t\tif (UNNAMED[i] === component) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// not found, create a new indexed name:\n\t\tif (index < 0) {\n\t\t\tindex = UNNAMED.push(component) - 1;\n\t\t}\n\t\tname = `UnnamedComponent${index}`;\n\t}\n\treturn name;\n}\nrenderToString.shallowRender = shallowRender;\n\nexport default renderToString;\n\nexport {\n\trenderToString as render,\n\trenderToString as renderToStaticMarkup,\n\trenderToString,\n\tshallowRender\n};\n"],"names":["IS_NON_DIMENSIONAL","ENCODED_ENTITIES","encodeEntities","input","s","String","test","replace","indent","char","isLargeString","length","ignoreLines","indexOf","JS_TO_CSS","styleObjToCss","str","prop","val","toLowerCase","undefined","assign","obj","props","i","getChildren","accumulator","children","Array","isArray","reduce","push","SHALLOW","shallow","UNNAMED","VOID_ELEMENTS","UNSAFE_NAME","markAsDirty","this","__d","renderToString","render","shallowRender","vnode","context","EMPTY_ARR","opts","previousSkipEffects","options","__s","res","_renderToString","__c","inner","isSvgMode","selectValue","pretty","indentChar","rendered","component","nodeName","type","isComponent","renderRootComponent","Fragment","shallowHighOrder","c","__v","setState","forceUpdate","__h","__b","renderHook","__r","prototype","cxType","contextType","provider","cctx","value","__","_dirty","state","_nextState","getDerivedStateFromProps","componentWillMount","count","call","getChildContext","diffed","displayName","Function","name","toString","match","index","getFallbackComponentName","propChildren","html","attrs","Object","keys","sortAttributes","sort","v","allAttributes","hooked","attributeHook","__html","xml","selected","sub","Error","isVoid","voidElements","pieces","hasLarge","lastWasText","child","ret","isText","join","substring"],"mappings":"wRACaA,EAAqB,kEAE5BC,EAAmB,kBAETC,EAAeC,GAC9B,IAAMC,EAAIC,OAAOF,GACjB,OAAKF,EAAiBK,KAAKF,GAGpBA,EACLG,QAAQ,KAAM,SACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,UANRH,MASEI,EAAS,SAACJ,EAAGK,UACvBJ,OAAOD,GAAGG,QAAQ,SAAU,MAAQE,GAAQ,QAElCC,EAAgB,SAACN,EAAGO,EAAQC,UACtCP,OAAOD,GAAGO,QAAUA,GAAU,MAC5BC,IAA4C,IAA7BP,OAAOD,GAAGS,QAAQ,QACP,IAA5BR,OAAOD,GAAGS,QAAQ,MAEbC,EAAY,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