@rindo/core 1.8.12 → 2.5.2

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 (608) hide show
  1. package/LICENSE.md +27 -27
  2. package/bin/cli.ts +20 -0
  3. package/bin/rindo +51 -22
  4. package/cli/index.cjs +1263 -0
  5. package/cli/index.d.ts +15 -0
  6. package/cli/index.js +1237 -0
  7. package/cli/package.json +14 -0
  8. package/compiler/lib.d.ts +24 -0
  9. package/compiler/lib.dom.d.ts +20230 -0
  10. package/compiler/lib.dom.iterable.d.ts +351 -0
  11. package/compiler/lib.es2015.collection.d.ts +89 -0
  12. package/compiler/lib.es2015.core.d.ts +517 -0
  13. package/compiler/lib.es2015.d.ts +30 -0
  14. package/compiler/lib.es2015.generator.d.ts +79 -0
  15. package/compiler/lib.es2015.iterable.d.ts +505 -0
  16. package/compiler/lib.es2015.promise.d.ts +150 -0
  17. package/compiler/lib.es2015.proxy.d.ts +41 -0
  18. package/compiler/lib.es2015.reflect.d.ts +123 -0
  19. package/compiler/lib.es2015.symbol.d.ts +48 -0
  20. package/compiler/lib.es2015.symbol.wellknown.d.ts +324 -0
  21. package/compiler/lib.es2016.array.include.d.ts +118 -0
  22. package/compiler/lib.es2016.d.ts +22 -0
  23. package/compiler/lib.es2016.full.d.ts +25 -0
  24. package/compiler/lib.es2017.d.ts +26 -0
  25. package/compiler/lib.es2017.full.d.ts +25 -0
  26. package/compiler/lib.es2017.intl.d.ts +32 -0
  27. package/compiler/lib.es2017.object.d.ts +51 -0
  28. package/compiler/lib.es2017.sharedmemory.d.ts +137 -0
  29. package/compiler/lib.es2017.string.d.ts +47 -0
  30. package/compiler/lib.es2017.typedarrays.d.ts +55 -0
  31. package/compiler/lib.es2018.asyncgenerator.d.ts +79 -0
  32. package/compiler/lib.es2018.asynciterable.d.ts +45 -0
  33. package/compiler/lib.es2018.d.ts +26 -0
  34. package/compiler/lib.es2018.full.d.ts +25 -0
  35. package/compiler/lib.es2018.intl.d.ts +61 -0
  36. package/compiler/lib.es2018.promise.d.ts +32 -0
  37. package/compiler/lib.es2018.regexp.d.ts +39 -0
  38. package/compiler/lib.es2019.array.d.ts +85 -0
  39. package/compiler/lib.es2019.d.ts +25 -0
  40. package/compiler/lib.es2019.full.d.ts +25 -0
  41. package/compiler/lib.es2019.object.d.ts +35 -0
  42. package/compiler/lib.es2019.string.d.ts +33 -0
  43. package/compiler/lib.es2019.symbol.d.ts +26 -0
  44. package/compiler/lib.es2020.bigint.d.ts +728 -0
  45. package/compiler/lib.es2020.d.ts +27 -0
  46. package/compiler/lib.es2020.full.d.ts +25 -0
  47. package/compiler/lib.es2020.intl.d.ts +310 -0
  48. package/compiler/lib.es2020.promise.d.ts +50 -0
  49. package/compiler/lib.es2020.sharedmemory.d.ts +99 -0
  50. package/compiler/lib.es2020.string.d.ts +30 -0
  51. package/compiler/lib.es2020.symbol.wellknown.d.ts +39 -0
  52. package/compiler/lib.es5.d.ts +4435 -0
  53. package/compiler/lib.es6.d.ts +25 -0
  54. package/compiler/lib.esnext.d.ts +25 -0
  55. package/compiler/lib.esnext.full.d.ts +25 -0
  56. package/compiler/lib.esnext.intl.d.ts +32 -0
  57. package/compiler/lib.esnext.promise.d.ts +43 -0
  58. package/compiler/lib.esnext.string.d.ts +35 -0
  59. package/compiler/lib.esnext.weakref.d.ts +75 -0
  60. package/compiler/lib.scripthost.d.ts +327 -0
  61. package/compiler/lib.webworker.d.ts +6042 -0
  62. package/compiler/lib.webworker.importscripts.d.ts +26 -0
  63. package/compiler/lib.webworker.iterable.d.ts +166 -0
  64. package/compiler/package.json +8 -6
  65. package/compiler/rindo.d.ts +95 -0
  66. package/compiler/rindo.js +65051 -6657
  67. package/compiler/rindo.min.js +4 -0
  68. package/dependencies.json +103 -0
  69. package/dev-server/client/app-error.d.ts +18 -0
  70. package/dev-server/client/events.d.ts +6 -0
  71. package/dev-server/client/hmr-components.d.ts +1 -0
  72. package/dev-server/client/hmr-external-styles.d.ts +1 -0
  73. package/dev-server/client/hmr-images.d.ts +1 -0
  74. package/dev-server/client/hmr-inline-styles.d.ts +1 -0
  75. package/dev-server/client/hmr-util.d.ts +9 -0
  76. package/dev-server/client/hmr-window.d.ts +10 -0
  77. package/dev-server/client/index.d.ts +6 -0
  78. package/dev-server/client/index.js +808 -0
  79. package/dev-server/client/logger.d.ts +5 -0
  80. package/dev-server/client/package.json +8 -0
  81. package/dev-server/client/progress.d.ts +3 -0
  82. package/dev-server/client/status.d.ts +4 -0
  83. package/dev-server/connector.html +6 -0
  84. package/dev-server/index.d.ts +3 -0
  85. package/dev-server/index.js +264 -0
  86. package/dev-server/open-in-editor-api.js +1 -0
  87. package/dev-server/package.json +8 -0
  88. package/dev-server/server-process.js +1738 -0
  89. package/dev-server/server-worker-thread.js +39 -0
  90. package/{dist/dev-server → dev-server}/templates/directory-index.html +132 -132
  91. package/{dist/dev-server → dev-server}/templates/initial-load.html +160 -160
  92. package/dev-server/ws.js +1 -0
  93. package/internal/app-data/index.cjs +90 -0
  94. package/internal/app-data/index.d.ts +4 -0
  95. package/internal/{client/build-conditionals.mjs → app-data/index.js} +25 -21
  96. package/internal/app-data/package.json +15 -0
  97. package/internal/client/css-shim.js +4 -0
  98. package/internal/client/{dom.rindo-client.mjs → dom.js} +73 -137
  99. package/{dist/client/index.mjs → internal/client/index.js} +863 -789
  100. package/internal/client/package.json +8 -0
  101. package/internal/client/patch-browser.js +120 -0
  102. package/internal/client/patch-esm.js +23 -0
  103. package/internal/client/polyfills/core-js.js +11 -10
  104. package/internal/client/polyfills/css-shim.js +1 -656
  105. package/internal/client/polyfills/dom.js +79 -146
  106. package/internal/client/polyfills/es5-html-element.js +1 -18
  107. package/internal/client/polyfills/index.js +34 -35
  108. package/internal/client/{shadow-css.rindo-client.mjs → shadow-css.js} +20 -17
  109. package/internal/hydrate/index.js +1097 -0
  110. package/internal/hydrate/package.json +7 -0
  111. package/internal/hydrate/runner.d.ts +217 -0
  112. package/internal/hydrate/runner.js +777 -0
  113. package/internal/hydrate/shadow-css.js +146 -0
  114. package/internal/index.d.ts +4 -18
  115. package/internal/index.js +1 -1
  116. package/internal/package.json +9 -6
  117. package/internal/rindo-core/index.cjs +1 -0
  118. package/internal/rindo-core/index.d.ts +51 -0
  119. package/internal/rindo-core/index.js +15 -0
  120. package/internal/rindo-ext-modules.d.ts +41 -0
  121. package/internal/rindo-private.d.ts +2128 -0
  122. package/internal/rindo-public-compiler.d.ts +2170 -0
  123. package/{dist/declarations/docs.d.ts → internal/rindo-public-docs.d.ts} +13 -1
  124. package/internal/rindo-public-runtime.d.ts +1555 -0
  125. package/internal/testing/index.js +1055 -0
  126. package/internal/testing/package.json +7 -0
  127. package/internal/testing/shadow-css.js +146 -0
  128. package/mock-doc/index.cjs +4610 -0
  129. package/mock-doc/index.d.ts +916 -0
  130. package/mock-doc/index.js +4574 -2
  131. package/mock-doc/package.json +15 -10
  132. package/package.json +132 -186
  133. package/readme.md +21 -174
  134. package/screenshot/compare/build/app.css +1 -1
  135. package/screenshot/compare/build/app.esm.js +1 -1
  136. package/screenshot/compare/build/app.js +33 -818
  137. package/screenshot/compare/build/{p-113f7459.js → p-081b0641.js} +1 -1
  138. package/screenshot/compare/build/p-227a1e18.entry.js +1 -0
  139. package/screenshot/compare/build/p-2c298727.entry.js +1 -0
  140. package/screenshot/compare/build/p-5479268c.entry.js +1 -0
  141. package/screenshot/compare/build/p-573ec8a4.entry.js +1 -0
  142. package/screenshot/compare/build/p-6ba08604.entry.js +1 -0
  143. package/screenshot/compare/build/p-6bc63295.entry.js +1 -0
  144. package/screenshot/compare/build/p-7a3759fd.entry.js +1 -0
  145. package/screenshot/compare/build/{p-ejpsp3kx.js → p-7b4e3ba7.js} +1 -1
  146. package/screenshot/compare/build/p-988eb362.css +1 -0
  147. package/screenshot/compare/build/p-9b6a9315.js +1 -0
  148. package/screenshot/compare/build/p-b4cc611c.entry.js +1 -0
  149. package/screenshot/compare/build/p-d1bf53f5.entry.js +1 -0
  150. package/screenshot/compare/build/{p-efb0eac6.js → p-e2efe0df.js} +1 -1
  151. package/screenshot/compare/build/p-e8ca6d97.entry.js +1 -0
  152. package/screenshot/compare/build/p-ec2f13e0.entry.js +1 -0
  153. package/screenshot/compare/build/p-f0b99977.entry.js +1 -0
  154. package/screenshot/compare/build/p-f4745c2f.entry.js +1 -0
  155. package/screenshot/compare/build/p-fbbae598.js +1 -0
  156. package/screenshot/compare/host.config.json +14 -14
  157. package/screenshot/compare/index.html +1 -1
  158. package/{dist/screenshot → screenshot}/connector-base.d.ts +1 -1
  159. package/{dist/screenshot → screenshot}/connector-local.d.ts +1 -1
  160. package/screenshot/connector.js +2 -3
  161. package/{dist/screenshot → screenshot}/index.d.ts +1 -1
  162. package/screenshot/index.js +659 -2
  163. package/screenshot/local-connector.js +2 -3
  164. package/screenshot/package.json +15 -13
  165. package/screenshot/pixel-match.js +62 -49
  166. package/screenshot/screenshot-compare.d.ts +3 -0
  167. package/{dist/screenshot → screenshot}/screenshot-fs.d.ts +1 -1
  168. package/sys/deno/index.js +1785 -0
  169. package/sys/deno/node-compat.js +2654 -0
  170. package/sys/deno/worker.js +44 -0
  171. package/sys/node/autoprefixer.js +8 -0
  172. package/sys/node/glob.js +1 -0
  173. package/sys/node/graceful-fs.js +1 -0
  174. package/sys/node/index.d.ts +18 -0
  175. package/sys/node/index.js +1386 -2
  176. package/sys/node/node-fetch.js +1 -0
  177. package/sys/node/package.json +8 -5
  178. package/sys/node/prompts.js +1 -0
  179. package/sys/node/worker.js +52 -0
  180. package/{dist/testing → testing}/index.d.ts +5 -6
  181. package/testing/index.js +4017 -2
  182. package/testing/jest/jest-config.d.ts +5 -0
  183. package/{dist/testing → testing}/jest/jest-environment.d.ts +4 -2
  184. package/{dist/testing → testing}/jest/jest-preprocessor.d.ts +1 -0
  185. package/{dist/testing → testing}/jest/jest-runner.d.ts +1 -1
  186. package/{dist/testing → testing}/jest/jest-screenshot.d.ts +1 -1
  187. package/{dist/testing → testing}/jest/jest-serializer.d.ts +1 -1
  188. package/testing/jest-environment.js +3 -3
  189. package/testing/jest-preprocessor.js +3 -3
  190. package/testing/jest-preset.js +32 -40
  191. package/testing/jest-runner.js +3 -3
  192. package/testing/jest-setuptestframework.js +3 -3
  193. package/{dist/testing → testing}/matchers/events.d.ts +9 -1
  194. package/{dist/testing → testing}/matchers/index.d.ts +3 -1
  195. package/{dist/testing → testing}/matchers/screenshot.d.ts +1 -1
  196. package/testing/mock-fetch.d.ts +11 -0
  197. package/testing/mocks.d.ts +14 -0
  198. package/testing/package.json +8 -6
  199. package/testing/puppeteer/index.d.ts +2 -0
  200. package/{dist/testing → testing}/puppeteer/puppeteer-browser.d.ts +3 -3
  201. package/{dist/testing → testing}/puppeteer/puppeteer-declarations.d.ts +18 -18
  202. package/{dist/testing → testing}/puppeteer/puppeteer-element.d.ts +7 -5
  203. package/testing/puppeteer/puppeteer-emulate.d.ts +2 -0
  204. package/{dist/testing → testing}/puppeteer/puppeteer-events.d.ts +9 -9
  205. package/testing/puppeteer/puppeteer-page.d.ts +2 -0
  206. package/testing/puppeteer/puppeteer-screenshot.d.ts +4 -0
  207. package/testing/reset-build-conditionals.d.ts +2 -0
  208. package/testing/spec-page.d.ts +2 -0
  209. package/testing/test-transpile.d.ts +2 -0
  210. package/{dist/testing → testing}/testing-logger.d.ts +10 -8
  211. package/testing/testing-sys.d.ts +1 -0
  212. package/{dist/testing → testing}/testing-utils.d.ts +3 -2
  213. package/testing/testing.d.ts +2 -0
  214. package/build-conditionals/index.d.ts +0 -2
  215. package/build-conditionals/index.mjs +0 -66
  216. package/build-conditionals/package.json +0 -6
  217. package/compiler/index.js +0 -2
  218. package/dist/cli/index.js +0 -6068
  219. package/dist/client/css-shim-14a9812e.js +0 -656
  220. package/dist/client/css-shim-69821662.js +0 -658
  221. package/dist/client/declarations/rindo.core.d.ts +0 -1347
  222. package/dist/client/dom-68c8fe31.js +0 -139
  223. package/dist/client/dom-af01458a.js +0 -137
  224. package/dist/client/index.js +0 -2937
  225. package/dist/client/polyfills/core-js.js +0 -10
  226. package/dist/client/polyfills/css-shim.js +0 -656
  227. package/dist/client/polyfills/dom.js +0 -146
  228. package/dist/client/polyfills/es5-html-element.js +0 -18
  229. package/dist/client/polyfills/index.js +0 -35
  230. package/dist/client/polyfills/promise.js +0 -9
  231. package/dist/client/polyfills/system.js +0 -6
  232. package/dist/client/shadow-css-6ef31c68.js +0 -386
  233. package/dist/client/shadow-css-8fd1a9e4.js +0 -388
  234. package/dist/compiler/app-core/app-es5-disabled.d.ts +0 -2
  235. package/dist/compiler/app-core/app-polyfills.d.ts +0 -3
  236. package/dist/compiler/app-core/build-conditionals.d.ts +0 -6
  237. package/dist/compiler/app-core/bundle-app-core.d.ts +0 -6
  238. package/dist/compiler/app-core/component-styles.d.ts +0 -4
  239. package/dist/compiler/app-core/format-component-runtime-meta.d.ts +0 -4
  240. package/dist/compiler/app-core/optimize-module.d.ts +0 -7
  241. package/dist/compiler/browser/build-conditionals-client.d.ts +0 -3
  242. package/dist/compiler/browser/compile-options.d.ts +0 -12
  243. package/dist/compiler/browser/compile.d.ts +0 -2
  244. package/dist/compiler/browser/create-compiler.d.ts +0 -14
  245. package/dist/compiler/browser/index.d.ts +0 -11
  246. package/dist/compiler/build/build-ctx.d.ts +0 -74
  247. package/dist/compiler/build/build-finish.d.ts +0 -3
  248. package/dist/compiler/build/build-hmr.d.ts +0 -2
  249. package/dist/compiler/build/build-results.d.ts +0 -2
  250. package/dist/compiler/build/build-stats.d.ts +0 -3
  251. package/dist/compiler/build/build.d.ts +0 -2
  252. package/dist/compiler/build/cache-stats.d.ts +0 -4
  253. package/dist/compiler/build/compiler-build-id.d.ts +0 -6
  254. package/dist/compiler/build/compiler-ctx.d.ts +0 -44
  255. package/dist/compiler/build/init-index-html.d.ts +0 -2
  256. package/dist/compiler/build/validate-files.d.ts +0 -2
  257. package/dist/compiler/build/write-build.d.ts +0 -2
  258. package/dist/compiler/cache.d.ts +0 -22
  259. package/dist/compiler/compiler.d.ts +0 -27
  260. package/dist/compiler/component-hydrate/bundle-hydrate-factory.d.ts +0 -3
  261. package/dist/compiler/component-hydrate/generate-hydrate-app.d.ts +0 -2
  262. package/dist/compiler/component-hydrate/hydrate-factory-closure.d.ts +0 -2
  263. package/dist/compiler/component-hydrate/update-to-hydrate-components.d.ts +0 -2
  264. package/dist/compiler/component-hydrate/write-hydrate-outputs.d.ts +0 -3
  265. package/dist/compiler/component-lazy/generate-cjs.d.ts +0 -3
  266. package/dist/compiler/component-lazy/generate-esm-browser.d.ts +0 -3
  267. package/dist/compiler/component-lazy/generate-esm.d.ts +0 -3
  268. package/dist/compiler/component-lazy/generate-lazy-app.d.ts +0 -3
  269. package/dist/compiler/component-lazy/generate-lazy-module.d.ts +0 -4
  270. package/dist/compiler/component-lazy/generate-system.d.ts +0 -3
  271. package/dist/compiler/component-lazy/update-to-lazy-component.d.ts +0 -2
  272. package/dist/compiler/component-lazy/write-lazy-entry-module.d.ts +0 -2
  273. package/dist/compiler/component-native/update-to-native-component.d.ts +0 -2
  274. package/dist/compiler/config/config-reload.d.ts +0 -3
  275. package/dist/compiler/config/config-utils.d.ts +0 -4
  276. package/dist/compiler/config/validate-config.d.ts +0 -4
  277. package/dist/compiler/config/validate-copy.d.ts +0 -2
  278. package/dist/compiler/config/validate-dev-server.d.ts +0 -2
  279. package/dist/compiler/config/validate-docs.d.ts +0 -2
  280. package/dist/compiler/config/validate-namespace.d.ts +0 -3
  281. package/dist/compiler/config/validate-output-stats.d.ts +0 -2
  282. package/dist/compiler/config/validate-outputs-angular.d.ts +0 -2
  283. package/dist/compiler/config/validate-outputs-custom.d.ts +0 -2
  284. package/dist/compiler/config/validate-outputs-dist-module.d.ts +0 -2
  285. package/dist/compiler/config/validate-outputs-dist.d.ts +0 -2
  286. package/dist/compiler/config/validate-outputs-hydrate-script.d.ts +0 -2
  287. package/dist/compiler/config/validate-outputs-www.d.ts +0 -2
  288. package/dist/compiler/config/validate-outputs.d.ts +0 -2
  289. package/dist/compiler/config/validate-paths.d.ts +0 -2
  290. package/dist/compiler/config/validate-plugins.d.ts +0 -2
  291. package/dist/compiler/config/validate-prerender.d.ts +0 -2
  292. package/dist/compiler/config/validate-rollup-config.d.ts +0 -2
  293. package/dist/compiler/config/validate-service-worker.d.ts +0 -2
  294. package/dist/compiler/config/validate-testing.d.ts +0 -2
  295. package/dist/compiler/config/validate-workers.d.ts +0 -2
  296. package/dist/compiler/copy/assets-copy-tasks.d.ts +0 -3
  297. package/dist/compiler/copy/hashed-copy.d.ts +0 -2
  298. package/dist/compiler/copy/local-copy-tasks.d.ts +0 -3
  299. package/dist/compiler/docs/constants.d.ts +0 -2
  300. package/dist/compiler/docs/custom/index.d.ts +0 -2
  301. package/dist/compiler/docs/docs.d.ts +0 -2
  302. package/dist/compiler/docs/generate-doc-data.d.ts +0 -3
  303. package/dist/compiler/docs/json/index.d.ts +0 -3
  304. package/dist/compiler/docs/readme/docs-util.d.ts +0 -13
  305. package/dist/compiler/docs/readme/index.d.ts +0 -3
  306. package/dist/compiler/docs/readme/markdown-css-props.d.ts +0 -2
  307. package/dist/compiler/docs/readme/markdown-dependencies.d.ts +0 -2
  308. package/dist/compiler/docs/readme/markdown-events.d.ts +0 -2
  309. package/dist/compiler/docs/readme/markdown-methods.d.ts +0 -2
  310. package/dist/compiler/docs/readme/markdown-props.d.ts +0 -2
  311. package/dist/compiler/docs/readme/markdown-slots.d.ts +0 -2
  312. package/dist/compiler/docs/readme/markdown-usage.d.ts +0 -6
  313. package/dist/compiler/docs/readme/output-docs.d.ts +0 -3
  314. package/dist/compiler/docs/style-docs.d.ts +0 -2
  315. package/dist/compiler/docs/vscode/index.d.ts +0 -2
  316. package/dist/compiler/entries/component-bundles.d.ts +0 -3
  317. package/dist/compiler/entries/component-graph.d.ts +0 -2
  318. package/dist/compiler/entries/default-bundles.d.ts +0 -3
  319. package/dist/compiler/entries/entry-modules.d.ts +0 -6
  320. package/dist/compiler/entries/resolve-component-dependencies.d.ts +0 -2
  321. package/dist/compiler/events.d.ts +0 -15
  322. package/dist/compiler/fs-watch/fs-watch-init.d.ts +0 -2
  323. package/dist/compiler/fs-watch/fs-watch-log.d.ts +0 -2
  324. package/dist/compiler/fs-watch/fs-watch-rebuild.d.ts +0 -7
  325. package/dist/compiler/html/inject-module-preloads.d.ts +0 -3
  326. package/dist/compiler/html/inject-sw-script.d.ts +0 -4
  327. package/dist/compiler/html/inline-esm-import.d.ts +0 -2
  328. package/dist/compiler/html/inline-style-sheets.d.ts +0 -2
  329. package/dist/compiler/html/update-global-styles-link.d.ts +0 -2
  330. package/dist/compiler/html/used-components.d.ts +0 -2
  331. package/dist/compiler/html/utils.d.ts +0 -2
  332. package/dist/compiler/html/validate-manifest-json.d.ts +0 -2
  333. package/dist/compiler/index.d.ts +0 -10
  334. package/dist/compiler/index.js +0 -18008
  335. package/dist/compiler/output-targets/empty-dir.d.ts +0 -6
  336. package/dist/compiler/output-targets/index.d.ts +0 -2
  337. package/dist/compiler/output-targets/output-angular.d.ts +0 -4
  338. package/dist/compiler/output-targets/output-app.d.ts +0 -4
  339. package/dist/compiler/output-targets/output-collection.d.ts +0 -3
  340. package/dist/compiler/output-targets/output-copy.d.ts +0 -2
  341. package/dist/compiler/output-targets/output-custom.d.ts +0 -2
  342. package/dist/compiler/output-targets/output-docs.d.ts +0 -2
  343. package/dist/compiler/output-targets/output-hydrate.d.ts +0 -2
  344. package/dist/compiler/output-targets/output-lazy-loader.d.ts +0 -2
  345. package/dist/compiler/output-targets/output-module.d.ts +0 -4
  346. package/dist/compiler/output-targets/output-prerender.d.ts +0 -2
  347. package/dist/compiler/output-targets/output-service-workers.d.ts +0 -2
  348. package/dist/compiler/output-targets/output-types.d.ts +0 -2
  349. package/dist/compiler/output-targets/output-utils.d.ts +0 -54
  350. package/dist/compiler/output-targets/output-www.d.ts +0 -2
  351. package/dist/compiler/plugin/plugin.d.ts +0 -6
  352. package/dist/compiler/prerender/crawl-urls.d.ts +0 -3
  353. package/dist/compiler/prerender/host-config.d.ts +0 -12
  354. package/dist/compiler/prerender/prerender-config.d.ts +0 -2
  355. package/dist/compiler/prerender/prerender-main.d.ts +0 -2
  356. package/dist/compiler/prerender/prerender-queue.d.ts +0 -3
  357. package/dist/compiler/prerender/prerender-template-html.d.ts +0 -2
  358. package/dist/compiler/prerender/prerendered-write-path.d.ts +0 -2
  359. package/dist/compiler/prerender/robots-txt.d.ts +0 -2
  360. package/dist/compiler/prerender/sitemap-xml.d.ts +0 -3
  361. package/dist/compiler/rollup-plugins/component-entry.d.ts +0 -3
  362. package/dist/compiler/rollup-plugins/css-transformer.d.ts +0 -3
  363. package/dist/compiler/rollup-plugins/global-scripts.d.ts +0 -4
  364. package/dist/compiler/rollup-plugins/image-plugin.d.ts +0 -3
  365. package/dist/compiler/rollup-plugins/in-memory-fs-read.d.ts +0 -3
  366. package/dist/compiler/rollup-plugins/loader.d.ts +0 -4
  367. package/dist/compiler/rollup-plugins/plugin-helper.d.ts +0 -5
  368. package/dist/compiler/rollup-plugins/rindo-build-conditionals.d.ts +0 -7
  369. package/dist/compiler/rollup-plugins/rindo-client.d.ts +0 -3
  370. package/dist/compiler/rollup-plugins/rindo-external-runtime.d.ts +0 -2
  371. package/dist/compiler/rollup-plugins/rindo-hydrate.d.ts +0 -3
  372. package/dist/compiler/rollup-plugins/rindo-public-plugin.d.ts +0 -2
  373. package/dist/compiler/service-worker/generate-sw.d.ts +0 -7
  374. package/dist/compiler/service-worker/service-worker-util.d.ts +0 -2
  375. package/dist/compiler/style/cached-styles.d.ts +0 -5
  376. package/dist/compiler/style/component-styles.d.ts +0 -2
  377. package/dist/compiler/style/css-imports.d.ts +0 -9
  378. package/dist/compiler/style/css-to-esm.d.ts +0 -5
  379. package/dist/compiler/style/generate-styles.d.ts +0 -2
  380. package/dist/compiler/style/global-styles.d.ts +0 -3
  381. package/dist/compiler/style/normalize-styles.d.ts +0 -2
  382. package/dist/compiler/style/optimize-css.d.ts +0 -2
  383. package/dist/compiler/style/scope-css.d.ts +0 -3
  384. package/dist/compiler/style/style-utils.d.ts +0 -10
  385. package/dist/compiler/transformers/add-component-meta-proxy.d.ts +0 -3
  386. package/dist/compiler/transformers/add-component-meta-static.d.ts +0 -4
  387. package/dist/compiler/transformers/add-imports.d.ts +0 -3
  388. package/dist/compiler/transformers/collections/add-external-import.d.ts +0 -2
  389. package/dist/compiler/transformers/collections/parse-collection-components.d.ts +0 -2
  390. package/dist/compiler/transformers/collections/parse-collection-deprecated.d.ts +0 -2
  391. package/dist/compiler/transformers/collections/parse-collection-manifest.d.ts +0 -7
  392. package/dist/compiler/transformers/collections/parse-collection-module.d.ts +0 -2
  393. package/dist/compiler/transformers/component-build-conditionals.d.ts +0 -2
  394. package/dist/compiler/transformers/component-hydrate/hydrate-component.d.ts +0 -3
  395. package/dist/compiler/transformers/component-hydrate/hydrate-runtime-cmp-meta.d.ts +0 -3
  396. package/dist/compiler/transformers/component-hydrate/tranform-to-hydrate-component.d.ts +0 -2
  397. package/dist/compiler/transformers/component-lazy/lazy-component.d.ts +0 -3
  398. package/dist/compiler/transformers/component-lazy/lazy-constructor.d.ts +0 -3
  399. package/dist/compiler/transformers/component-lazy/lazy-element-getter.d.ts +0 -3
  400. package/dist/compiler/transformers/component-lazy/transform-lazy-component.d.ts +0 -4
  401. package/dist/compiler/transformers/component-native/native-component.d.ts +0 -3
  402. package/dist/compiler/transformers/component-native/native-connected-callback.d.ts +0 -3
  403. package/dist/compiler/transformers/component-native/native-constructor.d.ts +0 -3
  404. package/dist/compiler/transformers/component-native/native-element-getter.d.ts +0 -3
  405. package/dist/compiler/transformers/component-native/native-static-style.d.ts +0 -3
  406. package/dist/compiler/transformers/component-native/tranform-to-native-component.d.ts +0 -4
  407. package/dist/compiler/transformers/core-runtime-apis.d.ts +0 -30
  408. package/dist/compiler/transformers/create-event.d.ts +0 -3
  409. package/dist/compiler/transformers/decorators-to-static/component-decorator.d.ts +0 -3
  410. package/dist/compiler/transformers/decorators-to-static/convert-decorators.d.ts +0 -3
  411. package/dist/compiler/transformers/decorators-to-static/decorator-utils.d.ts +0 -10
  412. package/dist/compiler/transformers/decorators-to-static/element-decorator.d.ts +0 -3
  413. package/dist/compiler/transformers/decorators-to-static/event-decorator.d.ts +0 -4
  414. package/dist/compiler/transformers/decorators-to-static/listen-decorator.d.ts +0 -6
  415. package/dist/compiler/transformers/decorators-to-static/method-decorator.d.ts +0 -3
  416. package/dist/compiler/transformers/decorators-to-static/prop-decorator.d.ts +0 -4
  417. package/dist/compiler/transformers/decorators-to-static/state-decorator.d.ts +0 -3
  418. package/dist/compiler/transformers/decorators-to-static/style-to-static.d.ts +0 -3
  419. package/dist/compiler/transformers/decorators-to-static/watch-decorator.d.ts +0 -3
  420. package/dist/compiler/transformers/define-custom-element.d.ts +0 -3
  421. package/dist/compiler/transformers/host-data-transform.d.ts +0 -3
  422. package/dist/compiler/transformers/legacy-props.d.ts +0 -3
  423. package/dist/compiler/transformers/remove-static-meta-properties.d.ts +0 -2
  424. package/dist/compiler/transformers/reserved-public-members.d.ts +0 -3
  425. package/dist/compiler/transformers/rindo-import-path.d.ts +0 -3
  426. package/dist/compiler/transformers/static-to-meta/call-expression.d.ts +0 -3
  427. package/dist/compiler/transformers/static-to-meta/class-methods.d.ts +0 -3
  428. package/dist/compiler/transformers/static-to-meta/component.d.ts +0 -3
  429. package/dist/compiler/transformers/static-to-meta/element-ref.d.ts +0 -2
  430. package/dist/compiler/transformers/static-to-meta/encapsulation.d.ts +0 -3
  431. package/dist/compiler/transformers/static-to-meta/events.d.ts +0 -3
  432. package/dist/compiler/transformers/static-to-meta/import.d.ts +0 -3
  433. package/dist/compiler/transformers/static-to-meta/listeners.d.ts +0 -3
  434. package/dist/compiler/transformers/static-to-meta/methods.d.ts +0 -3
  435. package/dist/compiler/transformers/static-to-meta/props.d.ts +0 -3
  436. package/dist/compiler/transformers/static-to-meta/states.d.ts +0 -3
  437. package/dist/compiler/transformers/static-to-meta/string-literal.d.ts +0 -3
  438. package/dist/compiler/transformers/static-to-meta/styles.d.ts +0 -3
  439. package/dist/compiler/transformers/static-to-meta/vdom.d.ts +0 -3
  440. package/dist/compiler/transformers/static-to-meta/visitor.d.ts +0 -3
  441. package/dist/compiler/transformers/static-to-meta/watchers.d.ts +0 -3
  442. package/dist/compiler/transformers/style-imports.d.ts +0 -3
  443. package/dist/compiler/transformers/transform-utils.d.ts +0 -31
  444. package/dist/compiler/transformers/update-component-class.d.ts +0 -3
  445. package/dist/compiler/transformers/update-rindo-core-import.d.ts +0 -3
  446. package/dist/compiler/transformers/watcher-meta-transform.d.ts +0 -3
  447. package/dist/compiler/transpile/compiler-options.d.ts +0 -4
  448. package/dist/compiler/transpile/transpile-app.d.ts +0 -2
  449. package/dist/compiler/transpile/transpile-module.d.ts +0 -5
  450. package/dist/compiler/transpile/transpile-service.d.ts +0 -3
  451. package/dist/compiler/transpile/transpile-to-es5-main.d.ts +0 -2
  452. package/dist/compiler/transpile/validate-types-main.d.ts +0 -2
  453. package/dist/compiler/types/generate-app-types.d.ts +0 -2
  454. package/dist/compiler/types/generate-component-types.d.ts +0 -8
  455. package/dist/compiler/types/generate-event-types.d.ts +0 -2
  456. package/dist/compiler/types/generate-method-types.d.ts +0 -2
  457. package/dist/compiler/types/generate-prop-types.d.ts +0 -2
  458. package/dist/compiler/types/generate-types.d.ts +0 -2
  459. package/dist/compiler/types/rindo-types.d.ts +0 -3
  460. package/dist/compiler/types/types-utils.d.ts +0 -4
  461. package/dist/compiler/types/update-import-refs.d.ts +0 -11
  462. package/dist/compiler/types/validate-package-json.d.ts +0 -9
  463. package/dist/declarations/assets.d.ts +0 -17
  464. package/dist/declarations/browser-compile.d.ts +0 -47
  465. package/dist/declarations/build-conditionals.d.ts +0 -91
  466. package/dist/declarations/build-events.d.ts +0 -19
  467. package/dist/declarations/build.d.ts +0 -247
  468. package/dist/declarations/cache.d.ts +0 -11
  469. package/dist/declarations/collection-manifest.d.ts +0 -106
  470. package/dist/declarations/collection.d.ts +0 -139
  471. package/dist/declarations/compiler.d.ts +0 -53
  472. package/dist/declarations/component-compiler-meta.d.ts +0 -198
  473. package/dist/declarations/component-constructor.d.ts +0 -61
  474. package/dist/declarations/component-interfaces.d.ts +0 -123
  475. package/dist/declarations/config.d.ts +0 -409
  476. package/dist/declarations/css-var-shim.d.ts +0 -9
  477. package/dist/declarations/decorators.d.ts +0 -150
  478. package/dist/declarations/dev-server.d.ts +0 -135
  479. package/dist/declarations/diagnostics.d.ts +0 -21
  480. package/dist/declarations/entry.d.ts +0 -28
  481. package/dist/declarations/events.d.ts +0 -13
  482. package/dist/declarations/file-system.d.ts +0 -91
  483. package/dist/declarations/fs-watch.d.ts +0 -15
  484. package/dist/declarations/host-element.d.ts +0 -53
  485. package/dist/declarations/hydrate.d.ts +0 -99
  486. package/dist/declarations/in-memory-fs.d.ts +0 -59
  487. package/dist/declarations/index.d.ts +0 -45
  488. package/dist/declarations/jsdoc.d.ts +0 -16
  489. package/dist/declarations/jsx.d.ts +0 -1050
  490. package/dist/declarations/logger.d.ts +0 -25
  491. package/dist/declarations/minify-js.d.ts +0 -11
  492. package/dist/declarations/module.d.ts +0 -35
  493. package/dist/declarations/optimize-css.d.ts +0 -12
  494. package/dist/declarations/output-targets.d.ts +0 -189
  495. package/dist/declarations/plugin.d.ts +0 -23
  496. package/dist/declarations/prerender.d.ts +0 -79
  497. package/dist/declarations/render.d.ts +0 -62
  498. package/dist/declarations/runtime.d.ts +0 -92
  499. package/dist/declarations/screenshots.d.ts +0 -192
  500. package/dist/declarations/server.d.ts +0 -19
  501. package/dist/declarations/style.d.ts +0 -35
  502. package/dist/declarations/system.d.ts +0 -174
  503. package/dist/declarations/testing.d.ts +0 -523
  504. package/dist/declarations/transpile.d.ts +0 -24
  505. package/dist/declarations/types.d.ts +0 -24
  506. package/dist/declarations/vdom.d.ts +0 -55
  507. package/dist/declarations/worker.d.ts +0 -33
  508. package/dist/dev-server/content-type-db.json +0 -1
  509. package/dist/dev-server/index.js +0 -887
  510. package/dist/dev-server/static/app-error.css +0 -257
  511. package/dist/dev-server/static/dev-server-client.html +0 -13
  512. package/dist/hydrate/index.d.ts +0 -101
  513. package/dist/hydrate/index.mjs +0 -1281
  514. package/dist/hydrate/platform.mjs +0 -347
  515. package/dist/index.d.ts +0 -99
  516. package/dist/index.js +0 -1
  517. package/dist/mock-doc/index.d.ts +0 -851
  518. package/dist/mock-doc/index.js +0 -3982
  519. package/dist/mock-doc/index.mjs +0 -3954
  520. package/dist/runtime/index.js +0 -2576
  521. package/dist/runtime/index.mjs +0 -2521
  522. package/dist/runtime/shadow-css-6ef31c68.js +0 -386
  523. package/dist/runtime/shadow-css-8fd1a9e4.js +0 -388
  524. package/dist/screenshot/index.js +0 -520
  525. package/dist/sys/node/graceful-fs.js +0 -975
  526. package/dist/sys/node/index.js +0 -33545
  527. package/dist/sys/node/node-fetch.js +0 -1779
  528. package/dist/sys/node/open-in-editor.js +0 -734
  529. package/dist/sys/node/sys-worker.js +0 -67035
  530. package/dist/sys/node/websocket.js +0 -3728
  531. package/dist/testing/build-conditionals.d.ts +0 -4
  532. package/dist/testing/build-conditionals.js +0 -43
  533. package/dist/testing/core.d.ts +0 -35
  534. package/dist/testing/core.js +0 -52
  535. package/dist/testing/index.js +0 -40511
  536. package/dist/testing/jest/jest-config.d.ts +0 -4
  537. package/dist/testing/mock-fetch.d.ts +0 -46
  538. package/dist/testing/mocks.d.ts +0 -12
  539. package/dist/testing/platform.d.ts +0 -23
  540. package/dist/testing/platform.js +0 -321
  541. package/dist/testing/puppeteer/puppeteer-emulate.d.ts +0 -2
  542. package/dist/testing/puppeteer/puppeteer-find.d.ts +0 -5
  543. package/dist/testing/puppeteer/puppeteer-page.d.ts +0 -2
  544. package/dist/testing/puppeteer/puppeteer-screenshot.d.ts +0 -4
  545. package/dist/testing/spec-page.d.ts +0 -5
  546. package/dist/testing/task-queue.d.ts +0 -15
  547. package/dist/testing/test-transpile.d.ts +0 -5
  548. package/dist/testing/testing-fs.d.ts +0 -31
  549. package/dist/testing/testing-sys.d.ts +0 -19
  550. package/dist/testing/testing.d.ts +0 -12
  551. package/dist/utils/index.js +0 -1575
  552. package/dist/utils/index.mjs +0 -1511
  553. package/internal/client/css-shim.rindo-client.mjs +0 -656
  554. package/internal/client/index.mjs +0 -2859
  555. package/internal/client/polyfills/promise.js +0 -9
  556. package/internal/images.d.ts +0 -5
  557. package/runtime/package.json +0 -5
  558. package/screenshot/compare/build/p-020f8d73.js +0 -1
  559. package/screenshot/compare/build/p-09qdknbg.system.entry.js +0 -1
  560. package/screenshot/compare/build/p-0a13mpsc.system.entry.js +0 -1
  561. package/screenshot/compare/build/p-168ec2c4.system.js +0 -1
  562. package/screenshot/compare/build/p-2ab1fdf1.system.js +0 -1
  563. package/screenshot/compare/build/p-2pxcsgrj.entry.js +0 -1
  564. package/screenshot/compare/build/p-42fb7034.system.js +0 -1
  565. package/screenshot/compare/build/p-54d9d7c2.system.js +0 -1
  566. package/screenshot/compare/build/p-67c1f911.js +0 -1
  567. package/screenshot/compare/build/p-68613371.system.js +0 -1
  568. package/screenshot/compare/build/p-7dvsjpu0.entry.js +0 -1
  569. package/screenshot/compare/build/p-aa67fb06.js +0 -1
  570. package/screenshot/compare/build/p-aeb3cec1.system.js +0 -1
  571. package/screenshot/compare/build/p-b6e44a24.js +0 -1
  572. package/screenshot/compare/build/p-c1c25b8a.js +0 -1
  573. package/screenshot/compare/build/p-c9bopbjy.system.entry.js +0 -1
  574. package/screenshot/compare/build/p-c9iqz1pp.system.entry.js +0 -1
  575. package/screenshot/compare/build/p-dizjz8rg.entry.js +0 -1
  576. package/screenshot/compare/build/p-dnta0rwp.system.entry.js +0 -1
  577. package/screenshot/compare/build/p-e9670d22.system.js +0 -1
  578. package/screenshot/compare/build/p-ei9jkpd0.system.entry.js +0 -1
  579. package/screenshot/compare/build/p-ejwcppol.entry.js +0 -1
  580. package/screenshot/compare/build/p-f6612d5d.system.js +0 -1
  581. package/screenshot/compare/build/p-foiivsfc.css +0 -1
  582. package/screenshot/compare/build/p-gpjjyogx.entry.js +0 -1
  583. package/screenshot/compare/build/p-howklem2.system.entry.js +0 -1
  584. package/screenshot/compare/build/p-knv9wvoc.entry.js +0 -1
  585. package/screenshot/compare/build/p-nsqsfhhy.entry.js +0 -1
  586. package/screenshot/compare/build/p-ojt278pp.entry.js +0 -1
  587. package/screenshot/compare/build/p-oywass99.entry.js +0 -1
  588. package/screenshot/compare/build/p-q3ujhub6.entry.js +0 -1
  589. package/screenshot/compare/build/p-qw4xnmxv.entry.js +0 -1
  590. package/screenshot/compare/build/p-t1wvevhc.system.entry.js +0 -1
  591. package/screenshot/compare/build/p-tnjarrex.system.entry.js +0 -1
  592. package/screenshot/compare/build/p-vhfpd6kk.system.entry.js +0 -1
  593. package/screenshot/compare/build/p-vk6rhemd.system.entry.js +0 -1
  594. package/screenshot/compare/build/p-w6bnm16k.entry.js +0 -1
  595. package/screenshot/compare/build/p-xje6d7zl.system.entry.js +0 -1
  596. package/screenshot/compare/build/p-y5jlrcha.system.entry.js +0 -1
  597. package/screenshot/compare/build/p-yh170wkt.entry.js +0 -1
  598. package/testing/jest.preprocessor.js +0 -7
  599. /package/{dist/dev-server → dev-server}/static/favicon.ico +0 -0
  600. /package/{dist/sys/node → dev-server}/visualstudio.vbs +0 -0
  601. /package/{dist/sys/node → dev-server}/xdg-open +0 -0
  602. /package/{dist/compiler/polyfills.d.ts → screenshot/compare/build/index.esm.js} +0 -0
  603. /package/{dist/screenshot → screenshot}/pixel-match.d.ts +0 -0
  604. /package/{dist/testing → testing}/jest/jest-setup-test-framework.d.ts +0 -0
  605. /package/{dist/testing → testing}/matchers/attributes.d.ts +0 -0
  606. /package/{dist/testing → testing}/matchers/class-list.d.ts +0 -0
  607. /package/{dist/testing → testing}/matchers/html.d.ts +0 -0
  608. /package/{dist/testing → testing}/matchers/text.d.ts +0 -0
@@ -1,15 +1,19 @@
1
- import { BUILD, NAMESPACE } from '@rindo/core/build-conditionals';
2
- let queueCongestion = 0;
3
- let queuePending = false;
4
- let i = 0;
5
1
  let scopeId;
6
2
  let contentRef;
7
3
  let hostTagName;
4
+ let customError;
5
+ let i = 0;
8
6
  let useNativeShadowDom = false;
9
7
  let checkSlotFallbackVisibility = false;
10
8
  let checkSlotRelocate = false;
11
9
  let isSvgMode = false;
12
- let renderingElement = null;
10
+ let renderingRef = null;
11
+ let queueCongestion = 0;
12
+ let queuePending = false;
13
+ /*
14
+ Rindo Client Platform v2.5.2 | MIT Licensed | https://rindojs.web.app
15
+ */
16
+ import { BUILD, NAMESPACE } from '@rindo/core/internal/app-data';
13
17
  const win = typeof window !== 'undefined' ? window : {};
14
18
  const CSS = BUILD.cssVarShim ? win.CSS : null;
15
19
  const doc = win.document || { head: {} };
@@ -18,297 +22,106 @@ const H = (win.HTMLElement || class {
18
22
  const plt = {
19
23
  $flags$: 0,
20
24
  $resourcesUrl$: '',
21
- jmp: (h) => h(),
22
- raf: (h) => requestAnimationFrame(h),
25
+ jmp: h => h(),
26
+ raf: h => requestAnimationFrame(h),
23
27
  ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
24
28
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
29
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
25
30
  };
26
- const supportsShadowDom = BUILD.shadowDomShim ? (BUILD.shadowDom) ? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)() : false : true;
31
+ const supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom
32
+ ? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
33
+ : true;
27
34
  const supportsListenerOptions = /*@__PURE__*/ (() => {
28
35
  let supportsListenerOptions = false;
29
36
  try {
30
37
  doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
31
- get() { supportsListenerOptions = true; }
38
+ get() {
39
+ supportsListenerOptions = true;
40
+ },
32
41
  }));
33
42
  }
34
43
  catch (e) { }
35
44
  return supportsListenerOptions;
36
45
  })();
37
46
  const promiseResolve = (v) => Promise.resolve(v);
38
- const supportsConstructibleStylesheets = BUILD.constructableCSS ? /*@__PURE__*/ (() => {
39
- try {
40
- new CSSStyleSheet();
41
- return true;
42
- }
43
- catch (e) { }
44
- return false;
45
- })() : false;
46
- const Context = {};
47
- const hostRefs = new WeakMap();
48
- const getHostRef = (ref) => hostRefs.get(ref);
49
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
50
- const registerHost = (elm) => {
51
- const hostRef = {
52
- $flags$: 0,
53
- $hostElement$: elm,
54
- $instanceValues$: new Map()
55
- };
56
- if (BUILD.isDev) {
57
- hostRef.$renderCount$ = 0;
58
- }
59
- if (BUILD.method && BUILD.lazyLoad) {
60
- hostRef.$onInstancePromise$ = new Promise(r => hostRef.$onInstanceResolve$ = r);
61
- }
62
- if (BUILD.asyncLoading) {
63
- hostRef.$onReadyPromise$ = new Promise(r => hostRef.$onReadyResolve$ = r);
64
- elm['s-p'] = [];
65
- elm['s-rc'] = [];
66
- }
67
- return hostRefs.set(elm, hostRef);
68
- };
69
- const isMemberInElement = (elm, memberName) => memberName in elm;
70
- const RINDO_DEV_MODE = ['%c[RINDO-DEV-MODE]', 'color:#4c47ff;font-weight: bold'];
71
- const consoleDevError = (...m) => console.error(...RINDO_DEV_MODE, ...m);
72
- const consoleDevWarn = (...m) => console.warn(...RINDO_DEV_MODE, ...m);
73
- const consoleDevInfo = (...m) => console.info(...RINDO_DEV_MODE, ...m);
74
- const consoleError = (e) => console.error(e);
75
- const moduleCache = /*@__PURE__*/ new Map();
76
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
77
- // loadModuleImport
78
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
79
- const bundleId = ((BUILD.mode && typeof cmpMeta.$lazyBundleIds$ !== 'string')
80
- ? cmpMeta.$lazyBundleIds$[hostRef.$modeName$]
81
- : cmpMeta.$lazyBundleIds$);
82
- const module = !BUILD.hotModuleReplacement ? moduleCache.get(bundleId) : false;
83
- if (module) {
84
- return module[exportName];
85
- }
86
- return import(
87
- /* webpackInclude: /\.entry\.js$/ */
88
- /* webpackExclude: /\.system\.entry\.js$/ */
89
- /* webpackMode: "lazy" */
90
- `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? '?s-hmr=' + hmrVersionId : ''}`).then(importedModule => {
91
- if (!BUILD.hotModuleReplacement) {
92
- moduleCache.set(bundleId, importedModule);
93
- }
94
- return importedModule[exportName];
95
- }, consoleError);
96
- };
97
- const styles = new Map();
98
- const queueDomReads = [];
99
- const queueDomWrites = [];
100
- const queueDomWritesLow = [];
101
- const queueTask = (queue, write) => (cb) => {
102
- queue.push(cb);
103
- if (!queuePending) {
104
- queuePending = true;
105
- if (write && plt.$flags$ & 4 /* queueSync */) {
106
- nextTick(flush);
107
- }
108
- else {
109
- plt.raf(flush);
110
- }
111
- }
112
- };
113
- const consume = (queue) => {
114
- for (let i = 0; i < queue.length; i++) {
115
- try {
116
- queue[i](performance.now());
117
- }
118
- catch (e) {
119
- consoleError(e);
120
- }
121
- }
122
- queue.length = 0;
123
- };
124
- const consumeTimeout = (queue, timeout) => {
125
- let i = 0;
126
- let ts = 0;
127
- while (i < queue.length && (ts = performance.now()) < timeout) {
47
+ const supportsConstructibleStylesheets = BUILD.constructableCSS
48
+ ? /*@__PURE__*/ (() => {
128
49
  try {
129
- queue[i++](ts);
130
- }
131
- catch (e) {
132
- consoleError(e);
50
+ new CSSStyleSheet();
51
+ return typeof new CSSStyleSheet().replace === 'function';
133
52
  }
134
- }
135
- if (i === queue.length) {
136
- queue.length = 0;
137
- }
138
- else if (i !== 0) {
139
- queue.splice(0, i);
140
- }
141
- };
142
- const flush = () => {
143
- queueCongestion++;
144
- // always force a bunch of medium callbacks to run, but still have
145
- // a throttle on how many can run in a certain time
146
- // DOM READS!!!
147
- consume(queueDomReads);
148
- const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
149
- ? performance.now() + (10 * Math.ceil(queueCongestion * (1.0 / 22.0)))
150
- : Infinity;
151
- // DOM WRITES!!!
152
- consumeTimeout(queueDomWrites, timeout);
153
- consumeTimeout(queueDomWritesLow, timeout);
154
- if (queueDomWrites.length > 0) {
155
- queueDomWritesLow.push(...queueDomWrites);
156
- queueDomWrites.length = 0;
157
- }
158
- if (queuePending = ((queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length) > 0)) {
159
- // still more to do yet, but we've run out of time
160
- // let's let this thing cool off and try again in the next tick
161
- plt.raf(flush);
162
- }
163
- else {
164
- queueCongestion = 0;
165
- }
166
- };
167
- const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
168
- const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
169
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
170
- const Build = {
171
- isDev: BUILD.isDev ? true : false,
172
- isBrowser: true
173
- };
174
- /**
175
- * Default style mode id
176
- */
177
- /**
178
- * Reusable empty obj/array
179
- * Don't add values to these!!
180
- */
181
- const EMPTY_OBJ = {};
182
- /**
183
- * Namespaces
184
- */
185
- const SVG_NS = 'http://www.w3.org/2000/svg';
186
- const HTML_NS = 'http://www.w3.org/1999/xhtml';
187
- const isDef = (v) => v != null;
188
- const isComplexType = (o) => {
189
- // https://jsperf.com/typeof-fn-object/5
190
- o = typeof o;
191
- return o === 'object' || o === 'function';
192
- };
193
- const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
194
- const patchEsm = () => {
195
- // @ts-ignore
196
- if (BUILD.cssVarShim && !(CSS && CSS.supports && CSS.supports('color', 'var(--c)'))) {
197
- // @ts-ignore
198
- return import(/* webpackChunkName: "rindo-polyfills-css-shim" */ './css-shim-14a9812e.js').then(() => {
199
- if (plt.$cssShim$ = win.__cssshim) {
200
- return plt.$cssShim$.i();
53
+ catch (e) { }
54
+ return false;
55
+ })()
56
+ : false;
57
+ const Context = {};
58
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
59
+ if (BUILD.hostListener && listeners) {
60
+ // this is called immediately within the element's constructor
61
+ // initialize our event listeners on the host element
62
+ // we do this now so that we can listen to events that may
63
+ // have fired even before the instance is ready
64
+ if (BUILD.hostListenerTargetParent) {
65
+ // this component may have event listeners that should be attached to the parent
66
+ if (attachParentListeners) {
67
+ // this is being ran from within the connectedCallback
68
+ // which is important so that we know the host element actually has a parent element
69
+ // filter out the listeners to only have the ones that ARE being attached to the parent
70
+ listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
201
71
  }
202
72
  else {
203
- // for better minification
204
- return 0;
205
- }
73
+ // this is being ran from within the component constructor
74
+ // everything BUT the parent element listeners should be attached at this time
75
+ // filter out the listeners that are NOT being attached to the parent
76
+ listeners = listeners.filter(([flags]) => !(flags & 32 /* TargetParent */));
77
+ }
78
+ }
79
+ listeners.map(([flags, name, method]) => {
80
+ const target = BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
81
+ const handler = hostListenerProxy(hostRef, method);
82
+ const opts = hostListenerOpts(flags);
83
+ plt.ael(target, name, handler, opts);
84
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
206
85
  });
207
86
  }
208
- return promiseResolve();
209
87
  };
210
- const patchBrowser = () => {
211
- // NOTE!! This fn cannot use async/await!
212
- if (BUILD.isDev) {
213
- consoleDevInfo('Rindo is running in the development mode.');
214
- }
215
- if (BUILD.cssVarShim) {
216
- // shim css vars
217
- plt.$cssShim$ = win.__cssshim;
218
- }
219
- if (BUILD.cloneNodeFix) {
220
- // opted-in to polyfill cloneNode() for slot polyfilled components
221
- patchCloneNodeFix(H.prototype);
222
- }
223
- if (BUILD.profile && !performance.mark) {
224
- // not all browsers support performance.mark/measure (Safari 10)
225
- performance.mark = performance.measure = () => { };
226
- performance.getEntriesByName = () => [];
227
- }
228
- // @ts-ignore
229
- const scriptElm = (BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim) ?
230
- Array.from(doc.querySelectorAll('script')).find(s => (new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
231
- s.getAttribute('data-rindo-namespace') === NAMESPACE)) : null;
232
- const importMeta = import.meta.url;
233
- const opts = BUILD.scriptDataOpts ? scriptElm['data-opts'] || {} : {};
234
- if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
235
- // Safari < v11 support: This IF is true if it's Safari below v11.
236
- // This fn cannot use async/await since Safari didn't support it until v11,
237
- // however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
238
- // so both the ESM file and nomodule file would get downloaded. Only Safari
239
- // has 'onbeforeload' in the script, and "history.scrollRestoration" was added
240
- // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
241
- // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
242
- return { then() { } };
243
- }
244
- if (!BUILD.safari10 && importMeta !== '') {
245
- opts.resourcesUrl = new URL('.', importMeta).href;
246
- }
247
- else if (BUILD.dynamicImportShim || BUILD.safari10) {
248
- opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
249
- patchDynamicImport(opts.resourcesUrl, scriptElm);
250
- if (BUILD.dynamicImportShim && !win.customElements) {
251
- // module support, but no custom elements support (Old Edge)
252
- // @ts-ignore
253
- return import(/* webpackChunkName: "rindo-polyfills-dom" */ './dom-af01458a.js').then(() => opts);
254
- }
255
- }
256
- return promiseResolve(opts);
257
- };
258
- const patchDynamicImport = (base, orgScriptElm) => {
259
- const importFunctionName = getDynamicImportFunction(NAMESPACE);
88
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
260
89
  try {
261
- // test if this browser supports dynamic imports
262
- // There is a caching issue in V8, that breaks using import() in Function
263
- // By generating a random string, we can workaround it
264
- // Check https://bugs.chromium.org/p/v8/issues/detail?id=9558 for more info
265
- win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
90
+ if (BUILD.lazyLoad) {
91
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
92
+ // instance is ready, let's call it's member method for this event
93
+ hostRef.$lazyInstance$[methodName](ev);
94
+ }
95
+ else {
96
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
97
+ }
98
+ }
99
+ else {
100
+ hostRef.$hostElement$[methodName](ev);
101
+ }
266
102
  }
267
103
  catch (e) {
268
- // this shim is specifically for browsers that do support "esm" imports
269
- // however, they do NOT support "dynamic" imports
270
- // basically this code is for old Edge, v18 and below
271
- const moduleMap = new Map();
272
- win[importFunctionName] = (src) => {
273
- const url = new URL(src, base).href;
274
- let mod = moduleMap.get(url);
275
- if (!mod) {
276
- const script = doc.createElement('script');
277
- script.type = 'module';
278
- script.crossOrigin = orgScriptElm.crossOrigin;
279
- script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], { type: 'application/javascript' }));
280
- mod = new Promise(resolve => {
281
- script.onload = () => {
282
- resolve(win[importFunctionName].m);
283
- script.remove();
284
- };
285
- });
286
- moduleMap.set(url, mod);
287
- doc.head.appendChild(script);
288
- }
289
- return mod;
290
- };
104
+ consoleError(e);
291
105
  }
292
106
  };
293
- const patchCloneNodeFix = (HTMLElementPrototype) => {
294
- const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
295
- HTMLElementPrototype.cloneNode = function (deep) {
296
- if (this.nodeName === 'TEMPLATE') {
297
- return nativeCloneNodeFn.call(this, deep);
298
- }
299
- const clonedNode = nativeCloneNodeFn.call(this, false);
300
- const srcChildNodes = this.childNodes;
301
- if (deep) {
302
- for (let i = 0; i < srcChildNodes.length; i++) {
303
- // Node.ATTRIBUTE_NODE === 2, and checking because IE11
304
- if (srcChildNodes[i].nodeType !== 2) {
305
- clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
306
- }
307
- }
308
- }
309
- return clonedNode;
310
- };
107
+ const getHostListenerTarget = (elm, flags) => {
108
+ if (BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
109
+ return doc;
110
+ if (BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */)
111
+ return win;
112
+ if (BUILD.hostListenerTargetBody && flags & 16 /* TargetBody */)
113
+ return doc.body;
114
+ if (BUILD.hostListenerTargetParent && flags & 32 /* TargetParent */)
115
+ return elm.parentElement;
116
+ return elm;
311
117
  };
118
+ // prettier-ignore
119
+ const hostListenerOpts = (flags) => supportsListenerOptions
120
+ ? ({
121
+ passive: (flags & 1 /* Passive */) !== 0,
122
+ capture: (flags & 2 /* Capture */) !== 0,
123
+ })
124
+ : (flags & 2 /* Capture */) !== 0;
312
125
  const CONTENT_REF_ID = 'r';
313
126
  const ORG_LOCATION_ID = 'o';
314
127
  const SLOT_NODE_ID = 's';
@@ -319,7 +132,7 @@ const HYDRATE_CHILD_ID = 'c-id';
319
132
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
320
133
  const XLINK_NS = 'http://www.w3.org/1999/xlink';
321
134
  const createTime = (fnName, tagName = '') => {
322
- if (BUILD.profile) {
135
+ if (BUILD.profile && performance.mark) {
323
136
  const key = `st:${fnName}:${tagName}:${i++}`;
324
137
  // Start
325
138
  performance.mark(key);
@@ -327,11 +140,13 @@ const createTime = (fnName, tagName = '') => {
327
140
  return () => performance.measure(`[Rindo] ${fnName}() <${tagName}>`, key);
328
141
  }
329
142
  else {
330
- return () => { return; };
143
+ return () => {
144
+ return;
145
+ };
331
146
  }
332
147
  };
333
148
  const uniqueTime = (key, measureText) => {
334
- if (BUILD.profile) {
149
+ if (BUILD.profile && performance.mark) {
335
150
  if (performance.getEntriesByName(key).length === 0) {
336
151
  performance.mark(key);
337
152
  }
@@ -342,7 +157,9 @@ const uniqueTime = (key, measureText) => {
342
157
  };
343
158
  }
344
159
  else {
345
- return () => { return; };
160
+ return () => {
161
+ return;
162
+ };
346
163
  }
347
164
  };
348
165
  const inspect = (ref) => {
@@ -389,7 +206,7 @@ const inspect = (ref) => {
389
206
  };
390
207
  const installDevTools = () => {
391
208
  if (BUILD.devTools) {
392
- const rindo = win.rindo = win.rindo || {};
209
+ const rindo = (win.rindo = win.rindo || {});
393
210
  const originalInspect = rindo.inspect;
394
211
  rindo.inspect = (ref) => {
395
212
  let result = inspect(ref);
@@ -413,25 +230,26 @@ const registerStyle = (scopeId, cssText, allowCS) => {
413
230
  styles.set(scopeId, style);
414
231
  };
415
232
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
416
- let scopeId = BUILD.mode ? getScopeId(cmpMeta.$tagName$, mode) : getScopeId(cmpMeta.$tagName$);
233
+ let scopeId = getScopeId(cmpMeta, mode);
417
234
  let style = styles.get(scopeId);
235
+ if (!BUILD.attachStyles) {
236
+ return scopeId;
237
+ }
418
238
  // if an element is NOT connected then getRootNode() will return the wrong root node
419
239
  // so the fallback is to always use the document for the root node in those cases
420
- styleContainerNode = (styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc);
421
- if (BUILD.mode && !style) {
422
- scopeId = getScopeId(cmpMeta.$tagName$);
423
- style = styles.get(scopeId);
424
- }
240
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
425
241
  if (style) {
426
242
  if (typeof style === 'string') {
427
243
  styleContainerNode = styleContainerNode.head || styleContainerNode;
428
244
  let appliedStyles = rootAppliedStyles.get(styleContainerNode);
429
245
  let styleElm;
430
246
  if (!appliedStyles) {
431
- rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
247
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
432
248
  }
433
249
  if (!appliedStyles.has(scopeId)) {
434
- if (BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
250
+ if (BUILD.hydrateClientSide &&
251
+ styleContainerNode.host &&
252
+ (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
435
253
  // This is only happening on native shadow-dom, do not needs CSS var shim
436
254
  styleElm.innerHTML = style;
437
255
  }
@@ -467,12 +285,13 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
467
285
  }
468
286
  return scopeId;
469
287
  };
470
- const attachStyles = (elm, cmpMeta, mode) => {
288
+ const attachStyles = (hostRef) => {
289
+ const cmpMeta = hostRef.$cmpMeta$;
290
+ const elm = hostRef.$hostElement$;
291
+ const flags = cmpMeta.$flags$;
471
292
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
472
- const scopeId = addStyle((BUILD.shadowDom && supportsShadowDom && elm.shadowRoot)
473
- ? elm.shadowRoot
474
- : elm.getRootNode(), cmpMeta, mode, elm);
475
- if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */) {
293
+ const scopeId = addStyle(BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
294
+ if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
476
295
  // only required when we're NOT using native shadow dom (slot)
477
296
  // or this browser doesn't support native shadow dom
478
297
  // and this host element was NOT created with SSR
@@ -482,14 +301,38 @@ const attachStyles = (elm, cmpMeta, mode) => {
482
301
  // DOM WRITE!!
483
302
  elm['s-sc'] = scopeId;
484
303
  elm.classList.add(scopeId + '-h');
485
- if (BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
304
+ if (BUILD.scoped && flags & 2 /* scopedCssEncapsulation */) {
486
305
  elm.classList.add(scopeId + '-s');
487
306
  }
488
307
  }
489
308
  endAttachStyles();
490
309
  };
491
- const getScopeId = (tagName, mode) => 'sc-' + ((BUILD.mode && mode) ? tagName + '-' + mode : tagName);
310
+ const getScopeId = (cmp, mode) => 'sc-' + (BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + '-' + mode : cmp.$tagName$);
492
311
  const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
312
+ // Private
313
+ const computeMode = (elm) => modeResolutionChain.map(h => h(elm)).find(m => !!m);
314
+ // Public
315
+ const setMode = (handler) => modeResolutionChain.push(handler);
316
+ const getMode = (ref) => getHostRef(ref).$modeName$;
317
+ /**
318
+ * Default style mode id
319
+ */
320
+ /**
321
+ * Reusable empty obj/array
322
+ * Don't add values to these!!
323
+ */
324
+ const EMPTY_OBJ = {};
325
+ /**
326
+ * Namespaces
327
+ */
328
+ const SVG_NS = 'http://www.w3.org/2000/svg';
329
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
330
+ const isDef = (v) => v != null;
331
+ const isComplexType = (o) => {
332
+ // https://jsperf.com/typeof-fn-object/5
333
+ o = typeof o;
334
+ return o === 'object' || o === 'function';
335
+ };
493
336
  /**
494
337
  * Production h() function based on Preact by
495
338
  * Jason Miller (@developit)
@@ -515,12 +358,12 @@ const h = (nodeName, vnodeData, ...children) => {
515
358
  walk(child);
516
359
  }
517
360
  else if (child != null && typeof child !== 'boolean') {
518
- if (simple = typeof nodeName !== 'function' && !isComplexType(child)) {
361
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
519
362
  child = String(child);
520
363
  }
521
- else if (BUILD.isDev && child.$flags$ === undefined) {
522
- consoleDevError(`vNode passed as children has unexpected type.
523
- Make sure it's using the correct h() function.
364
+ else if (BUILD.isDev && typeof nodeName !== 'function' && child.$flags$ === undefined) {
365
+ consoleDevError(`vNode passed as children has unexpected type.
366
+ Make sure it's using the correct h() function.
524
367
  Empty objects can also be the cause, look for JSX comments that became objects.`);
525
368
  }
526
369
  if (simple && lastSimple) {
@@ -550,22 +393,23 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
550
393
  if (BUILD.vdomClass) {
551
394
  const classData = vnodeData.className || vnodeData.class;
552
395
  if (classData) {
553
- vnodeData.class = typeof classData !== 'object'
554
- ? classData
555
- : Object.keys(classData)
556
- .filter(k => classData[k])
557
- .join(' ');
396
+ vnodeData.class =
397
+ typeof classData !== 'object'
398
+ ? classData
399
+ : Object.keys(classData)
400
+ .filter(k => classData[k])
401
+ .join(' ');
558
402
  }
559
403
  }
560
404
  }
561
405
  if (BUILD.isDev && vNodeChildren.some(isHost)) {
562
- consoleDevError(`The <Host> must be the single root component. Make sure:
563
- - You are NOT using hostData() and <Host> in the same component.
406
+ consoleDevError(`The <Host> must be the single root component. Make sure:
407
+ - You are NOT using hostData() and <Host> in the same component.
564
408
  - <Host> is used once, and it's the single root component of the render() function.`);
565
409
  }
566
410
  if (BUILD.vdomFunctional && typeof nodeName === 'function') {
567
411
  // nodeName is a functional component
568
- return nodeName(vnodeData, vNodeChildren, vdomFnUtils);
412
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
569
413
  }
570
414
  const vnode = newVNode(nodeName, null);
571
415
  vnode.$attrs$ = vnodeData;
@@ -586,7 +430,7 @@ const newVNode = (tag, text) => {
586
430
  $tag$: tag,
587
431
  $text$: text,
588
432
  $elm$: null,
589
- $children$: null
433
+ $children$: null,
590
434
  };
591
435
  if (BUILD.vdomAttribute) {
592
436
  vnode.$attrs$ = null;
@@ -602,20 +446,28 @@ const newVNode = (tag, text) => {
602
446
  const Host = {};
603
447
  const isHost = (node) => node && node.$tag$ === Host;
604
448
  const vdomFnUtils = {
605
- 'forEach': (children, cb) => children.map(convertToPublic).forEach(cb),
606
- 'map': (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
607
- };
608
- const convertToPublic = (node) => {
609
- return {
610
- vattrs: node.$attrs$,
611
- vchildren: node.$children$,
612
- vkey: node.$key$,
613
- vname: node.$name$,
614
- vtag: node.$tag$,
615
- vtext: node.$text$
616
- };
617
- };
449
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
450
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
451
+ };
452
+ const convertToPublic = (node) => ({
453
+ vattrs: node.$attrs$,
454
+ vchildren: node.$children$,
455
+ vkey: node.$key$,
456
+ vname: node.$name$,
457
+ vtag: node.$tag$,
458
+ vtext: node.$text$,
459
+ });
618
460
  const convertToPrivate = (node) => {
461
+ if (typeof node.vtag === 'function') {
462
+ const vnodeData = Object.assign({}, node.vattrs);
463
+ if (node.vkey) {
464
+ vnodeData.key = node.vkey;
465
+ }
466
+ if (node.vname) {
467
+ vnodeData.name = node.vname;
468
+ }
469
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
470
+ }
619
471
  const vnode = newVNode(node.vtag, node.vtext);
620
472
  vnode.$attrs$ = node.vattrs;
621
473
  vnode.$children$ = node.vchildren;
@@ -630,6 +482,9 @@ const validateInputProperties = (vnodeData) => {
630
482
  const maxIndex = props.indexOf('max');
631
483
  const stepIndex = props.indexOf('min');
632
484
  const value = props.indexOf('value');
485
+ if (value === -1) {
486
+ return;
487
+ }
633
488
  if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
634
489
  consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
635
490
  }
@@ -687,10 +542,9 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
687
542
  }
688
543
  }
689
544
  else if (BUILD.vdomListener &&
690
- (BUILD.lazyLoad
691
- ? !isProp
692
- : !elm.__lookupSetter__(memberName)) &&
693
- memberName[0] === 'o' && memberName[1] === 'n') {
545
+ (BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) &&
546
+ memberName[0] === 'o' &&
547
+ memberName[1] === 'n') {
694
548
  // Event Handlers
695
549
  // so if the member name starts with "on" and the 3rd characters is
696
550
  // a capital letter, and it's not already a member on the element,
@@ -764,14 +618,16 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
764
618
  }
765
619
  }
766
620
  if (newValue == null || newValue === false) {
767
- if (BUILD.vdomXlink && xlink) {
768
- elm.removeAttributeNS(XLINK_NS, memberName);
769
- }
770
- else {
771
- elm.removeAttribute(memberName);
621
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
622
+ if (BUILD.vdomXlink && xlink) {
623
+ elm.removeAttributeNS(XLINK_NS, memberName);
624
+ }
625
+ else {
626
+ elm.removeAttribute(memberName);
627
+ }
772
628
  }
773
629
  }
774
- else if ((!isProp || (flags & 4 /* isHost */) || isSvg) && !isComplex) {
630
+ else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
775
631
  newValue = newValue === true ? '' : newValue;
776
632
  if (BUILD.vdomXlink && xlink) {
777
633
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -784,12 +640,14 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
784
640
  }
785
641
  };
786
642
  const parseClassListRegex = /\s/;
787
- const parseClassList = (value) => (!value) ? [] : value.split(parseClassListRegex);
643
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
788
644
  const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
789
645
  // if the element passed in is a shadow root, which is a document fragment
790
646
  // then we want to be adding attrs/props to the shadow root's "host" element
791
647
  // if it's not a shadow root, then we add attrs/props to the same element
792
- const elm = (newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host) ? newVnode.$elm$.host : newVnode.$elm$;
648
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
649
+ ? newVnode.$elm$.host
650
+ : newVnode.$elm$;
793
651
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
794
652
  const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
795
653
  if (BUILD.updatable) {
@@ -820,18 +678,15 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
820
678
  // scoped css needs to add its scoped id to the parent element
821
679
  parentElm.classList.add(scopeId + '-s');
822
680
  }
823
- newVNode.$flags$ |= (newVNode.$children$)
824
- // slot element has fallback content
825
- // still create an element that "mocks" the slot element
826
- ? 2 /* isSlotFallback */
827
- // slot element does not have fallback content
828
- // create an html comment we'll use to always reference
829
- // where actual slot content should sit next to
830
- : 1 /* isSlotReference */;
681
+ newVNode.$flags$ |= newVNode.$children$
682
+ ? // slot element has fallback content
683
+ 2 /* isSlotFallback */
684
+ : // slot element does not have fallback content
685
+ 1 /* isSlotReference */;
831
686
  }
832
687
  }
833
688
  if (BUILD.isDev && newVNode.$elm$) {
834
- consoleError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${newVNode.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://rindojs.web.app/docs/templating-jsx#avoid-shared-jsx-nodes`);
689
+ consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${newVNode.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://rindojs.web.app/docs/templating-jsx#avoid-shared-jsx-nodes`);
835
690
  }
836
691
  if (BUILD.vdomText && newVNode.$text$ !== null) {
837
692
  // create text node
@@ -839,16 +694,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
839
694
  }
840
695
  else if (BUILD.slotRelocation && newVNode.$flags$ & 1 /* isSlotReference */) {
841
696
  // create a slot reference node
842
- elm = newVNode.$elm$ = (BUILD.isDebug || BUILD.hydrateServerSide) ? slotReferenceDebugNode(newVNode) : doc.createTextNode('');
697
+ elm = newVNode.$elm$ =
698
+ BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : doc.createTextNode('');
843
699
  }
844
700
  else {
845
701
  if (BUILD.svg && !isSvgMode) {
846
702
  isSvgMode = newVNode.$tag$ === 'svg';
847
703
  }
848
704
  // create element
849
- elm = newVNode.$elm$ = ((BUILD.svg)
850
- ? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, (BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */) ? 'slot-fb' : newVNode.$tag$)
851
- : doc.createElement((BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */) ? 'slot-fb' : newVNode.$tag$));
705
+ elm = newVNode.$elm$ = (BUILD.svg
706
+ ? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */
707
+ ? 'slot-fb'
708
+ : newVNode.$tag$)
709
+ : doc.createElement(BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */
710
+ ? 'slot-fb'
711
+ : newVNode.$tag$));
852
712
  if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
853
713
  isSvgMode = false;
854
714
  }
@@ -945,7 +805,7 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
945
805
  };
946
806
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
947
807
  for (; startIdx <= endIdx; ++startIdx) {
948
- if (vnode = vnodes[startIdx]) {
808
+ if ((vnode = vnodes[startIdx])) {
949
809
  elm = vnode.$elm$;
950
810
  callNodeRefs(vnode);
951
811
  if (BUILD.slotRelocation) {
@@ -1063,7 +923,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
1063
923
  }
1064
924
  }
1065
925
  if (oldStartIdx > oldEndIdx) {
1066
- addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
926
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
1067
927
  }
1068
928
  else if (BUILD.updatable && newStartIdx > newEndIdx) {
1069
929
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
@@ -1092,7 +952,7 @@ const referenceNode = (node) => {
1092
952
  };
1093
953
  const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1094
954
  const patch = (oldVNode, newVNode) => {
1095
- const elm = newVNode.$elm$ = oldVNode.$elm$;
955
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
1096
956
  const oldChildren = oldVNode.$children$;
1097
957
  const newChildren = newVNode.$children$;
1098
958
  const tag = newVNode.$tag$;
@@ -1102,11 +962,7 @@ const patch = (oldVNode, newVNode) => {
1102
962
  if (BUILD.svg) {
1103
963
  // test if we're rendering an svg element, or still rendering nodes inside of one
1104
964
  // only add this to the when the compiler sees we're using an svg somewhere
1105
- isSvgMode = (tag === 'svg')
1106
- ? true
1107
- : (tag === 'foreignObject')
1108
- ? false
1109
- : isSvgMode;
965
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1110
966
  }
1111
967
  // element node
1112
968
  if (BUILD.vdomAttribute || BUILD.reflect) {
@@ -1170,24 +1026,22 @@ const updateFallbackSlotVisibility = (elm) => {
1170
1026
  // then hide it if there are other slots in the light dom
1171
1027
  childNode.hidden = false;
1172
1028
  for (j = 0; j < ilen; j++) {
1173
- if (childNodes[j]['s-hn'] !== childNode['s-hn']) {
1174
- // this sibling node is from a different component
1175
- nodeType = childNodes[j].nodeType;
1176
- if (slotNameAttr !== '') {
1177
- // this is a named fallback slot node
1178
- if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1179
- childNode.hidden = true;
1180
- break;
1181
- }
1029
+ nodeType = childNodes[j].nodeType;
1030
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
1031
+ // this sibling node is from a different component OR is a named fallback slot node
1032
+ if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1033
+ childNode.hidden = true;
1034
+ break;
1182
1035
  }
1183
- else {
1184
- // this is a default fallback slot node
1185
- // any element or text node (with content)
1186
- // should hide the default fallback slot node
1187
- if (nodeType === 1 /* ElementNode */ || (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
1188
- childNode.hidden = true;
1189
- break;
1190
- }
1036
+ }
1037
+ else {
1038
+ // this is a default fallback slot node
1039
+ // any element or text node (with content)
1040
+ // should hide the default fallback slot node
1041
+ if (nodeType === 1 /* ElementNode */ ||
1042
+ (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
1043
+ childNode.hidden = true;
1044
+ break;
1191
1045
  }
1192
1046
  }
1193
1047
  }
@@ -1211,7 +1065,7 @@ const relocateSlotContent = (elm) => {
1211
1065
  let ilen = childNodes.length;
1212
1066
  for (; i < ilen; i++) {
1213
1067
  childNode = childNodes[i];
1214
- if (childNode['s-sr'] && (node = childNode['s-cr'])) {
1068
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1215
1069
  // first got the content reference comment node
1216
1070
  // then we got it's parent, which is where all the host content is in now
1217
1071
  hostContentNodes = node.parentNode.childNodes;
@@ -1243,10 +1097,10 @@ const relocateSlotContent = (elm) => {
1243
1097
  });
1244
1098
  }
1245
1099
  if (node['s-sr']) {
1246
- relocateNodes.forEach(relocateNode => {
1100
+ relocateNodes.map(relocateNode => {
1247
1101
  if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1248
1102
  relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
1249
- if (relocateNodeData) {
1103
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1250
1104
  relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1251
1105
  }
1252
1106
  }
@@ -1286,33 +1140,33 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1286
1140
  const callNodeRefs = (vNode) => {
1287
1141
  if (BUILD.vdomRef) {
1288
1142
  vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1289
- vNode.$children$ && vNode.$children$.forEach(callNodeRefs);
1143
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
1290
1144
  }
1291
1145
  };
1292
- const renderVdom = (hostElm, hostRef, cmpMeta, renderFnResults) => {
1146
+ const renderVdom = (hostRef, renderFnResults) => {
1147
+ const hostElm = hostRef.$hostElement$;
1148
+ const cmpMeta = hostRef.$cmpMeta$;
1149
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1150
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1293
1151
  hostTagName = hostElm.tagName;
1294
1152
  // <Host> runtime check
1295
1153
  if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
1296
- throw new Error(`The <Host> must be the single root component.
1297
- Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1298
-
1299
- The render() function should look like this instead:
1300
-
1301
- render() {
1302
- // Do not return an array
1303
- return (
1304
- <Host>{content}</Host>
1305
- );
1306
- }
1307
- `);
1154
+ throw new Error(`The <Host> must be the single root component.
1155
+ Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1156
+
1157
+ The render() function should look like this instead:
1158
+
1159
+ render() {
1160
+ // Do not return an array
1161
+ return (
1162
+ <Host>{content}</Host>
1163
+ );
1164
+ }
1165
+ `);
1308
1166
  }
1309
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1310
- const rootVnode = isHost(renderFnResults)
1311
- ? renderFnResults
1312
- : h(null, null, renderFnResults);
1313
1167
  if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
1314
1168
  rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1315
- cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]);
1169
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1316
1170
  }
1317
1171
  rootVnode.$tag$ = null;
1318
1172
  rootVnode.$flags$ |= 4 /* isHost */;
@@ -1323,13 +1177,16 @@ render() {
1323
1177
  }
1324
1178
  if (BUILD.slotRelocation) {
1325
1179
  contentRef = hostElm['s-cr'];
1326
- useNativeShadowDom = supportsShadowDom && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1180
+ useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1327
1181
  // always reset
1328
1182
  checkSlotFallbackVisibility = false;
1329
1183
  }
1330
1184
  // synchronous patch
1331
1185
  patch(oldVNode, rootVnode);
1332
1186
  if (BUILD.slotRelocation) {
1187
+ // while we're moving nodes around existing nodes, temporarily disable
1188
+ // the disconnectCallback from working
1189
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1333
1190
  if (checkSlotRelocate) {
1334
1191
  relocateSlotContent(rootVnode.$elm$);
1335
1192
  let relocateData;
@@ -1345,16 +1202,14 @@ render() {
1345
1202
  if (!nodeToRelocate['s-ol']) {
1346
1203
  // add a reference node marking this node's original location
1347
1204
  // keep a reference to this node for later lookups
1348
- orgLocationNode = (BUILD.isDebug || BUILD.hydrateServerSide)
1349
- ? originalLocationDebugNode(nodeToRelocate)
1350
- : doc.createTextNode('');
1205
+ orgLocationNode =
1206
+ BUILD.isDebug || BUILD.hydrateServerSide
1207
+ ? originalLocationDebugNode(nodeToRelocate)
1208
+ : doc.createTextNode('');
1351
1209
  orgLocationNode['s-nr'] = nodeToRelocate;
1352
1210
  nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1353
1211
  }
1354
1212
  }
1355
- // while we're moving nodes around existing nodes, temporarily disable
1356
- // the disconnectCallback from working
1357
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1358
1213
  for (i = 0; i < relocateNodes.length; i++) {
1359
1214
  relocateData = relocateNodes[i];
1360
1215
  nodeToRelocate = relocateData.$nodeToRelocate$;
@@ -1364,11 +1219,9 @@ render() {
1364
1219
  parentNodeRef = relocateData.$slotRefNode$.parentNode;
1365
1220
  insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1366
1221
  orgLocationNode = nodeToRelocate['s-ol'];
1367
- while (orgLocationNode = orgLocationNode.previousSibling) {
1222
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
1368
1223
  refNode = orgLocationNode['s-nr'];
1369
- if (refNode &&
1370
- refNode['s-sn'] === nodeToRelocate['s-sn'] &&
1371
- parentNodeRef === refNode.parentNode) {
1224
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1372
1225
  refNode = refNode.nextSibling;
1373
1226
  if (!refNode || !refNode['s-nr']) {
1374
1227
  insertBeforeNode = refNode;
@@ -1377,7 +1230,7 @@ render() {
1377
1230
  }
1378
1231
  }
1379
1232
  if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1380
- (nodeToRelocate.nextSibling !== insertBeforeNode)) {
1233
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
1381
1234
  // we've checked that it's worth while to relocate
1382
1235
  // since that the node to relocate
1383
1236
  // has a different next sibling or parent relocated
@@ -1398,32 +1251,52 @@ render() {
1398
1251
  }
1399
1252
  }
1400
1253
  }
1401
- // done moving nodes around
1402
- // allow the disconnect callback to work again
1403
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1404
1254
  }
1405
1255
  if (checkSlotFallbackVisibility) {
1406
1256
  updateFallbackSlotVisibility(rootVnode.$elm$);
1407
1257
  }
1258
+ // done moving nodes around
1259
+ // allow the disconnect callback to work again
1260
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
1408
1261
  // always reset
1409
1262
  relocateNodes.length = 0;
1410
1263
  }
1411
1264
  };
1412
1265
  // slot comment debug nodes only created with the `--debug` flag
1413
1266
  // otherwise these nodes are text nodes w/out content
1414
- const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ?
1415
- (' name="' + slotVNode.$name$) + '"' :
1416
- ''}> (host=${hostTagName.toLowerCase()})`);
1267
+ const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ''}> (host=${hostTagName.toLowerCase()})`);
1417
1268
  const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
1418
- (nodeToRelocate.localName ?
1419
- `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})` :
1420
- `[${nodeToRelocate.textContent}]`));
1269
+ (nodeToRelocate.localName
1270
+ ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})`
1271
+ : `[${nodeToRelocate.textContent}]`));
1272
+ const getElement = (ref) => (BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref);
1273
+ const createEvent = (ref, name, flags) => {
1274
+ const elm = getElement(ref);
1275
+ return {
1276
+ emit: (detail) => {
1277
+ if (BUILD.isDev && !elm.isConnected) {
1278
+ consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
1279
+ }
1280
+ return emitEvent(elm, name, {
1281
+ bubbles: !!(flags & 4 /* Bubbles */),
1282
+ composed: !!(flags & 2 /* Composed */),
1283
+ cancelable: !!(flags & 1 /* Cancellable */),
1284
+ detail,
1285
+ });
1286
+ },
1287
+ };
1288
+ };
1289
+ const emitEvent = (elm, name, opts) => {
1290
+ const ev = plt.ce(name, opts);
1291
+ elm.dispatchEvent(ev);
1292
+ return ev;
1293
+ };
1421
1294
  const attachToAncestor = (hostRef, ancestorComponent) => {
1422
- if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$) {
1423
- ancestorComponent['s-p'].push(new Promise(r => hostRef.$onRenderResolve$ = r));
1295
+ if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1296
+ ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
1424
1297
  }
1425
1298
  };
1426
- const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
1299
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
1427
1300
  if (BUILD.taskQueue && BUILD.updatable) {
1428
1301
  hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1429
1302
  }
@@ -1431,17 +1304,23 @@ const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
1431
1304
  hostRef.$flags$ |= 512 /* needsRerender */;
1432
1305
  return;
1433
1306
  }
1434
- const endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
1435
- const ancestorComponent = hostRef.$ancestorComponent$;
1307
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1308
+ // there is no ancestor component or the ancestor component
1309
+ // has already fired off its lifecycle update then
1310
+ // fire off the initial update
1311
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1312
+ return BUILD.taskQueue ? writeTask(dispatch) : dispatch();
1313
+ };
1314
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1315
+ const elm = hostRef.$hostElement$;
1316
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1436
1317
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1437
- const update = () => updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad);
1438
- attachToAncestor(hostRef, ancestorComponent);
1439
1318
  let promise;
1440
1319
  if (isInitialLoad) {
1441
1320
  if (BUILD.lazyLoad && BUILD.hostListener) {
1442
1321
  hostRef.$flags$ |= 256 /* isListenReady */;
1443
1322
  if (hostRef.$queuedListeners$) {
1444
- hostRef.$queuedListeners$.forEach(([methodName, event]) => safeCall(instance, methodName, event));
1323
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1445
1324
  hostRef.$queuedListeners$ = null;
1446
1325
  }
1447
1326
  }
@@ -1461,35 +1340,26 @@ const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
1461
1340
  promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1462
1341
  }
1463
1342
  endSchedule();
1464
- // there is no ancestorc omponent or the ancestor component
1465
- // has already fired off its lifecycle update then
1466
- // fire off the initial update
1467
- return then(promise, BUILD.taskQueue
1468
- ? () => writeTask(update)
1469
- : update);
1343
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1470
1344
  };
1471
- const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
1345
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1472
1346
  // updateComponent
1473
- const endUpdate = createTime('update', cmpMeta.$tagName$);
1347
+ const elm = hostRef.$hostElement$;
1348
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1474
1349
  const rc = elm['s-rc'];
1475
1350
  if (BUILD.style && isInitialLoad) {
1476
1351
  // DOM WRITE!
1477
- attachStyles(elm, cmpMeta, hostRef.$modeName$);
1352
+ attachStyles(hostRef);
1478
1353
  }
1479
- const endRender = createTime('render', cmpMeta.$tagName$);
1354
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1480
1355
  if (BUILD.isDev) {
1481
1356
  hostRef.$flags$ |= 1024 /* devOnRender */;
1482
1357
  }
1483
- if (BUILD.hasRenderFn || BUILD.reflect) {
1484
- if (BUILD.vdomRender || BUILD.reflect) {
1485
- // looks like we've got child nodes to render into this host element
1486
- // or we need to update the css class/attrs on the host element
1487
- // DOM WRITE!
1488
- renderVdom(elm, hostRef, cmpMeta, callRender(instance, elm));
1489
- }
1490
- else {
1491
- elm.textContent = callRender(instance, elm);
1492
- }
1358
+ if (BUILD.hydrateServerSide) {
1359
+ await callRender(hostRef, instance, elm);
1360
+ }
1361
+ else {
1362
+ callRender(hostRef, instance, elm);
1493
1363
  }
1494
1364
  if (BUILD.cssVarShim && plt.$cssShim$) {
1495
1365
  plt.$cssShim$.updateHost(elm);
@@ -1498,42 +1368,36 @@ const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
1498
1368
  hostRef.$renderCount$++;
1499
1369
  hostRef.$flags$ &= ~1024 /* devOnRender */;
1500
1370
  }
1501
- if (BUILD.updatable && BUILD.taskQueue) {
1502
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1503
- }
1504
1371
  if (BUILD.hydrateServerSide) {
1505
1372
  try {
1506
1373
  // manually connected child components during server-side hydrate
1507
1374
  serverSideConnected(elm);
1508
1375
  if (isInitialLoad) {
1509
1376
  // using only during server-side hydrate
1510
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1377
+ if (hostRef.$cmpMeta$.$flags$ & 1 /* shadowDomEncapsulation */) {
1511
1378
  elm['s-en'] = '';
1512
1379
  }
1513
- else if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1380
+ else if (hostRef.$cmpMeta$.$flags$ & 2 /* scopedCssEncapsulation */) {
1514
1381
  elm['s-en'] = 'c';
1515
1382
  }
1516
1383
  }
1517
1384
  }
1518
1385
  catch (e) {
1519
- consoleError(e);
1386
+ consoleError(e, elm);
1520
1387
  }
1521
1388
  }
1522
- if (BUILD.updatable || BUILD.lazyLoad) {
1523
- hostRef.$flags$ |= 2 /* hasRendered */;
1524
- }
1525
1389
  if (BUILD.asyncLoading && rc) {
1526
1390
  // ok, so turns out there are some child host elements
1527
1391
  // waiting on this parent element to load
1528
1392
  // let's fire off all update callbacks waiting
1529
- rc.forEach(cb => cb());
1393
+ rc.map(cb => cb());
1530
1394
  elm['s-rc'] = undefined;
1531
1395
  }
1532
1396
  endRender();
1533
1397
  endUpdate();
1534
1398
  if (BUILD.asyncLoading) {
1535
1399
  const childrenPromises = elm['s-p'];
1536
- const postUpdate = () => postUpdateComponent(elm, hostRef, cmpMeta);
1400
+ const postUpdate = () => postUpdateComponent(hostRef);
1537
1401
  if (childrenPromises.length === 0) {
1538
1402
  postUpdate();
1539
1403
  }
@@ -1544,23 +1408,54 @@ const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
1544
1408
  }
1545
1409
  }
1546
1410
  else {
1547
- postUpdateComponent(elm, hostRef, cmpMeta);
1411
+ postUpdateComponent(hostRef);
1548
1412
  }
1549
1413
  };
1550
- const callRender = (instance, elm) => {
1414
+ const callRender = (hostRef, instance, elm) => {
1415
+ // in order for bundlers to correctly treeshake the BUILD object
1416
+ // we need to ensure BUILD is not deoptimized within a try/catch
1417
+ // https://rollupjs.org/guide/en/#treeshake tryCatchDeoptimization
1418
+ const allRenderFn = BUILD.allRenderFn ? true : false;
1419
+ const lazyLoad = BUILD.lazyLoad ? true : false;
1420
+ const taskQueue = BUILD.taskQueue ? true : false;
1421
+ const updatable = BUILD.updatable ? true : false;
1551
1422
  try {
1552
- renderingElement = elm;
1553
- instance = (BUILD.allRenderFn) ? instance.render() : (instance.render && instance.render());
1423
+ renderingRef = instance;
1424
+ instance = allRenderFn ? instance.render() : instance.render && instance.render();
1425
+ if (updatable && taskQueue) {
1426
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1427
+ }
1428
+ if (updatable || lazyLoad) {
1429
+ hostRef.$flags$ |= 2 /* hasRendered */;
1430
+ }
1431
+ if (BUILD.hasRenderFn || BUILD.reflect) {
1432
+ if (BUILD.vdomRender || BUILD.reflect) {
1433
+ // looks like we've got child nodes to render into this host element
1434
+ // or we need to update the css class/attrs on the host element
1435
+ // DOM WRITE!
1436
+ if (BUILD.hydrateServerSide) {
1437
+ return Promise.resolve(instance).then(value => renderVdom(hostRef, value));
1438
+ }
1439
+ else {
1440
+ renderVdom(hostRef, instance);
1441
+ }
1442
+ }
1443
+ else {
1444
+ elm.textContent = instance;
1445
+ }
1446
+ }
1554
1447
  }
1555
1448
  catch (e) {
1556
- consoleError(e);
1449
+ consoleError(e, hostRef.$hostElement$);
1557
1450
  }
1558
- renderingElement = null;
1559
- return instance;
1451
+ renderingRef = null;
1452
+ return null;
1560
1453
  };
1561
- const getRenderingElement = () => renderingElement;
1562
- const postUpdateComponent = (elm, hostRef, cmpMeta) => {
1563
- const endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
1454
+ const getRenderingRef = () => renderingRef;
1455
+ const postUpdateComponent = (hostRef) => {
1456
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1457
+ const elm = hostRef.$hostElement$;
1458
+ const endPostUpdate = createTime('postUpdate', tagName);
1564
1459
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1565
1460
  const ancestorComponent = hostRef.$ancestorComponent$;
1566
1461
  if (BUILD.cmpDidRender) {
@@ -1593,7 +1488,7 @@ const postUpdateComponent = (elm, hostRef, cmpMeta) => {
1593
1488
  if (BUILD.asyncLoading) {
1594
1489
  hostRef.$onReadyResolve$(elm);
1595
1490
  if (!ancestorComponent) {
1596
- appDidLoad(cmpMeta.$tagName$);
1491
+ appDidLoad(tagName);
1597
1492
  }
1598
1493
  }
1599
1494
  }
@@ -1628,7 +1523,7 @@ const postUpdateComponent = (elm, hostRef, cmpMeta) => {
1628
1523
  hostRef.$onRenderResolve$ = undefined;
1629
1524
  }
1630
1525
  if (hostRef.$flags$ & 512 /* needsRerender */) {
1631
- nextTick(() => scheduleUpdate(elm, hostRef, cmpMeta, false));
1526
+ nextTick(() => scheduleUpdate(hostRef, false));
1632
1527
  }
1633
1528
  hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1634
1529
  }
@@ -1636,12 +1531,13 @@ const postUpdateComponent = (elm, hostRef, cmpMeta) => {
1636
1531
  // ( •_•)>⌐■-■
1637
1532
  // (⌐■_■)
1638
1533
  };
1639
- const forceUpdate = (elm, cmpMeta) => {
1534
+ const forceUpdate = (ref) => {
1640
1535
  if (BUILD.updatable) {
1641
- const hostRef = getHostRef(elm);
1536
+ const hostRef = getHostRef(ref);
1642
1537
  const isConnected = hostRef.$hostElement$.isConnected;
1643
- if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1644
- scheduleUpdate(elm, hostRef, cmpMeta, false);
1538
+ if (isConnected &&
1539
+ (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1540
+ scheduleUpdate(hostRef, false);
1645
1541
  }
1646
1542
  // Returns "true" when the forced update was successfully scheduled
1647
1543
  return isConnected;
@@ -1654,11 +1550,11 @@ const appDidLoad = (who) => {
1654
1550
  if (BUILD.cssAnnotations) {
1655
1551
  addHydratedFlag(doc.documentElement);
1656
1552
  }
1657
- if (!BUILD.hydrateServerSide) {
1553
+ if (BUILD.asyncQueue) {
1658
1554
  plt.$flags$ |= 2 /* appLoaded */;
1659
1555
  }
1660
- emitLifecycleEvent(doc, 'appload');
1661
- if (BUILD.profile) {
1556
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1557
+ if (BUILD.profile && performance.measure) {
1662
1558
  performance.measure(`[Rindo] ${NAMESPACE} initial load (by ${who})`, 'st:app:start');
1663
1559
  }
1664
1560
  };
@@ -1678,14 +1574,20 @@ const then = (promise, thenFn) => {
1678
1574
  };
1679
1575
  const emitLifecycleEvent = (elm, lifecycleName) => {
1680
1576
  if (BUILD.lifecycleDOMEvents) {
1681
- elm.dispatchEvent(new CustomEvent('rindo_' + lifecycleName, { 'bubbles': true, 'composed': true }));
1577
+ emitEvent(elm, 'rindo_' + lifecycleName, {
1578
+ bubbles: true,
1579
+ composed: true,
1580
+ detail: {
1581
+ namespace: NAMESPACE,
1582
+ },
1583
+ });
1682
1584
  }
1683
1585
  };
1684
- const addHydratedFlag = (elm) => BUILD.hydratedClass ?
1685
- elm.classList.add('hydrated') :
1686
- BUILD.hydratedAttribute ?
1687
- elm.setAttribute('hydrated', '') :
1688
- undefined;
1586
+ const addHydratedFlag = (elm) => BUILD.hydratedClass
1587
+ ? elm.classList.add('hydrated')
1588
+ : BUILD.hydratedAttribute
1589
+ ? elm.setAttribute('hydrated', '')
1590
+ : undefined;
1689
1591
  const serverSideConnected = (elm) => {
1690
1592
  const children = elm.children;
1691
1593
  if (children != null) {
@@ -1698,135 +1600,24 @@ const serverSideConnected = (elm) => {
1698
1600
  }
1699
1601
  }
1700
1602
  };
1701
- const cloneNodeFix = (HostElementPrototype) => {
1702
- const orgCloneNode = HostElementPrototype.cloneNode;
1703
- HostElementPrototype.cloneNode = function (deep) {
1704
- const srcNode = this;
1705
- const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadowDom : false;
1706
- const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
1707
- if (BUILD.slot && !isShadowDom && deep) {
1708
- let i = 0;
1709
- let slotted, nonRindoNode;
1710
- let rindoPrivates = ['s-id', 's-cr', 's-lr', 's-rc', 's-sc', 's-p', 's-cn', 's-sr', 's-sn', 's-hn', 's-ol', 's-nr', 's-si'];
1711
- for (; i < srcNode.childNodes.length; i++) {
1712
- slotted = srcNode.childNodes[i]['s-nr'];
1713
- nonRindoNode = rindoPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
1714
- if (slotted) {
1715
- if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
1716
- clonedNode.__appendChild(slotted.cloneNode(true));
1717
- }
1718
- else {
1719
- clonedNode.appendChild(slotted.cloneNode(true));
1720
- }
1721
- }
1722
- if (nonRindoNode) {
1723
- clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
1724
- }
1725
- }
1726
- }
1727
- return clonedNode;
1728
- };
1729
- };
1730
- const appendChildSlotFix = (HostElementPrototype) => {
1731
- HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
1732
- HostElementPrototype.appendChild = function (newChild) {
1733
- const slotName = newChild['s-sn'] = getSlotName(newChild);
1734
- const slotNode = getHostSlotNode(this, slotName);
1735
- if (slotNode) {
1736
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
1737
- const appendAfter = slotChildNodes[slotChildNodes.length - 1];
1738
- return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
1739
- }
1740
- return this.__appendChild(newChild);
1741
- };
1742
- };
1743
- const getSlotName = (node) => (node['s-sn']) ||
1744
- (node.nodeType === 1 && node.getAttribute('slot')) || '';
1745
- const getHostSlotNode = (elm, slotName) => {
1746
- let childNodes = elm.childNodes;
1747
- let i = 0;
1748
- let childNode;
1749
- for (; i < childNodes.length; i++) {
1750
- childNode = childNodes[i];
1751
- if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
1752
- return childNode;
1753
- }
1754
- childNode = getHostSlotNode(childNode, slotName);
1755
- if (childNode) {
1756
- return childNode;
1757
- }
1758
- }
1759
- return null;
1760
- };
1761
- const getHostSlotChildNodes = (n, slotName) => {
1762
- const childNodes = [n];
1763
- while ((n = n.nextSibling) && n['s-sn'] === slotName) {
1764
- childNodes.push(n);
1765
- }
1766
- return childNodes;
1767
- };
1768
- const addEventListeners = (elm, hostRef, listeners) => {
1769
- hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || [];
1770
- const removeFns = listeners.map(([flags, name, method]) => {
1771
- const target = (BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm);
1772
- const handler = hostListenerProxy(hostRef, method);
1773
- const opts = hostListenerOpts(flags);
1774
- plt.ael(target, name, handler, opts);
1775
- return () => plt.rel(target, name, handler, opts);
1776
- });
1777
- return () => removeFns.forEach(fn => fn());
1778
- };
1779
- const hostListenerProxy = (hostRef, methodName) => {
1780
- return (ev) => {
1781
- if (BUILD.lazyLoad) {
1782
- if (hostRef.$flags$ & 256 /* isListenReady */) {
1783
- // instance is ready, let's call it's member method for this event
1784
- hostRef.$lazyInstance$[methodName](ev);
1785
- }
1786
- else {
1787
- hostRef.$queuedListeners$.push([methodName, ev]);
1788
- }
1789
- }
1790
- else {
1791
- hostRef.$hostElement$[methodName](ev);
1792
- }
1793
- };
1794
- };
1795
- const getHostListenerTarget = (elm, flags) => {
1796
- if (BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
1797
- return doc;
1798
- if (BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */)
1799
- return win;
1800
- if (BUILD.hostListenerTargetBody && flags & 32 /* TargetBody */)
1801
- return doc.body;
1802
- if (BUILD.hostListenerTargetParent && flags & 16 /* TargetParent */)
1803
- return elm.parentElement;
1804
- return elm;
1805
- };
1806
- const hostListenerOpts = (flags) => supportsListenerOptions ?
1807
- {
1808
- 'passive': (flags & 1 /* Passive */) !== 0,
1809
- 'capture': (flags & 2 /* Capture */) !== 0,
1810
- }
1811
- : (flags & 2 /* Capture */) !== 0;
1812
1603
  const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1813
1604
  const endHydrate = createTime('hydrateClient', tagName);
1814
1605
  const shadowRoot = hostElm.shadowRoot;
1815
1606
  const childRenderNodes = [];
1816
1607
  const slotNodes = [];
1817
- const shadowRootNodes = (BUILD.shadowDom && shadowRoot ? [] : null);
1818
- const vnode = hostRef.$vnode$ = newVNode(tagName, null);
1608
+ const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
1609
+ const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
1819
1610
  if (!plt.$orgLocNodes$) {
1820
- initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = new Map());
1611
+ initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
1821
1612
  }
1822
1613
  hostElm[HYDRATE_ID] = hostId;
1823
1614
  hostElm.removeAttribute(HYDRATE_ID);
1824
1615
  clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
1825
- childRenderNodes.forEach(c => {
1616
+ childRenderNodes.map(c => {
1826
1617
  const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
1827
1618
  const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1828
1619
  const node = c.$elm$;
1829
- if (orgLocationNode && (supportsShadowDom && orgLocationNode['s-en'] === '')) {
1620
+ if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
1830
1621
  orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1831
1622
  }
1832
1623
  if (!shadowRoot) {
@@ -1839,7 +1630,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1839
1630
  plt.$orgLocNodes$.delete(orgLocationId);
1840
1631
  });
1841
1632
  if (BUILD.shadowDom && shadowRoot) {
1842
- shadowRootNodes.forEach(shadowRootNode => {
1633
+ shadowRootNodes.map(shadowRootNode => {
1843
1634
  if (shadowRootNode) {
1844
1635
  shadowRoot.appendChild(shadowRootNode);
1845
1636
  }
@@ -1871,7 +1662,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
1871
1662
  $children$: null,
1872
1663
  $key$: null,
1873
1664
  $name$: null,
1874
- $text$: null
1665
+ $text$: null,
1875
1666
  };
1876
1667
  childRenderNodes.push(childVNode);
1877
1668
  node.removeAttribute(HYDRATE_CHILD_ID);
@@ -1918,7 +1709,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
1918
1709
  $key$: null,
1919
1710
  $name$: null,
1920
1711
  $tag$: null,
1921
- $text$: null
1712
+ $text$: null,
1922
1713
  };
1923
1714
  if (childNodeType === TEXT_NODE_ID) {
1924
1715
  childVNode.$elm$ = node.nextSibling;
@@ -2020,7 +1811,7 @@ const parsePropertyValue = (propValue, propType) => {
2020
1811
  if (BUILD.propBoolean && propType & 4 /* Boolean */) {
2021
1812
  // per the HTML spec, any string value means it is a boolean true value
2022
1813
  // but we'll cheat here and say that the string "false" is the boolean false
2023
- return (propValue === 'false' ? false : propValue === '' || !!propValue);
1814
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
2024
1815
  }
2025
1816
  if (BUILD.propNumber && propType & 2 /* Number */) {
2026
1817
  // force it to be a number
@@ -2047,7 +1838,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
2047
1838
  const flags = hostRef.$flags$;
2048
1839
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2049
1840
  newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
2050
- if (newVal !== oldVal && (!BUILD.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
1841
+ if ((!BUILD.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
2051
1842
  // gadzooks! the property's value has changed!!
2052
1843
  // set our new value!
2053
1844
  hostRef.$instanceValues$.set(propName, newVal);
@@ -2065,18 +1856,19 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
2065
1856
  const watchMethods = cmpMeta.$watchers$[propName];
2066
1857
  if (watchMethods) {
2067
1858
  // this instance is watching for when this property changed
2068
- watchMethods.forEach(watchMethodName => {
1859
+ watchMethods.map(watchMethodName => {
2069
1860
  try {
2070
1861
  // fire off each of the watch methods that are watching this property
2071
1862
  instance[watchMethodName](newVal, oldVal, propName);
2072
1863
  }
2073
1864
  catch (e) {
2074
- consoleError(e);
1865
+ consoleError(e, elm);
2075
1866
  }
2076
1867
  });
2077
1868
  }
2078
1869
  }
2079
- if (BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1870
+ if (BUILD.updatable &&
1871
+ (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
2080
1872
  if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
2081
1873
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
2082
1874
  return;
@@ -2086,7 +1878,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
2086
1878
  // but only if we've already rendered, otherwise just chill out
2087
1879
  // queue that we need to do an update, but don't worry about queuing
2088
1880
  // up millions cuz this function ensures it only runs once
2089
- scheduleUpdate(elm, hostRef, cmpMeta, false);
1881
+ scheduleUpdate(hostRef, false);
2090
1882
  }
2091
1883
  }
2092
1884
  }
@@ -2099,10 +1891,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
2099
1891
  // It's better to have a const than two Object.entries()
2100
1892
  const members = Object.entries(cmpMeta.$members$);
2101
1893
  const prototype = Cstr.prototype;
2102
- members.forEach(([memberName, [memberFlags]]) => {
2103
- if ((BUILD.prop || BUILD.state) && ((memberFlags & 31 /* Prop */) ||
2104
- ((!BUILD.lazyLoad || flags & 2 /* proxyState */) &&
2105
- (memberFlags & 32 /* State */)))) {
1894
+ members.map(([memberName, [memberFlags]]) => {
1895
+ if ((BUILD.prop || BUILD.state) &&
1896
+ (memberFlags & 31 /* Prop */ ||
1897
+ ((!BUILD.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
2106
1898
  // proxyComponent - prop
2107
1899
  Object.defineProperty(prototype, memberName, {
2108
1900
  get() {
@@ -2110,29 +1902,38 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
2110
1902
  return getValue(this, memberName);
2111
1903
  },
2112
1904
  set(newValue) {
2113
- if (
2114
1905
  // only during dev time
2115
- (BUILD.isDev) &&
2116
- // we are proxing the instance (not element)
1906
+ if (BUILD.isDev) {
1907
+ const ref = getHostRef(this);
1908
+ if (
1909
+ // we are proxying the instance (not element)
2117
1910
  (flags & 1 /* isElementConstructor */) === 0 &&
2118
- // the member is a non-mutable prop
2119
- (memberFlags & (31 /* Prop */ | 1024 /* Mutable */)) === 31 /* Prop */) {
2120
- consoleDevWarn(`@Prop() "${memberName}" on "${cmpMeta.$tagName$}" cannot be modified.\nFurther information: https://rindojs.web.app/docs/properties#prop-mutability`);
1911
+ // the element is not constructing
1912
+ (ref.$flags$ & 8 /* isConstructingInstance */) === 0 &&
1913
+ // the member is a prop
1914
+ (memberFlags & 31 /* Prop */) !== 0 &&
1915
+ // the member is not mutable
1916
+ (memberFlags & 1024 /* Mutable */) === 0) {
1917
+ consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.\nMore information: https://rindojs.web.app/docs/properties#prop-mutability`);
1918
+ }
2121
1919
  }
2122
1920
  // proxyComponent, set value
2123
1921
  setValue(this, memberName, newValue, cmpMeta);
2124
1922
  },
2125
1923
  configurable: true,
2126
- enumerable: true
1924
+ enumerable: true,
2127
1925
  });
2128
1926
  }
2129
- else if (BUILD.lazyLoad && BUILD.method && (flags & 1 /* isElementConstructor */) && (memberFlags & 64 /* Method */)) {
1927
+ else if (BUILD.lazyLoad &&
1928
+ BUILD.method &&
1929
+ flags & 1 /* isElementConstructor */ &&
1930
+ memberFlags & 64 /* Method */) {
2130
1931
  // proxyComponent - method
2131
1932
  Object.defineProperty(prototype, memberName, {
2132
1933
  value(...args) {
2133
1934
  const ref = getHostRef(this);
2134
1935
  return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
2135
- }
1936
+ },
2136
1937
  });
2137
1938
  }
2138
1939
  });
@@ -2141,9 +1942,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
2141
1942
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
2142
1943
  plt.jmp(() => {
2143
1944
  const propName = attrNameToPropName.get(attrName);
2144
- this[propName] = newValue === null && typeof this[propName] === 'boolean'
2145
- ? false
2146
- : newValue;
1945
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
2147
1946
  });
2148
1947
  };
2149
1948
  // create an array of attributes to observe
@@ -2162,27 +1961,13 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
2162
1961
  }
2163
1962
  return Cstr;
2164
1963
  };
2165
- const modeResolutionChain = [];
2166
- const computeMode = (elm) => modeResolutionChain.map(h => h(elm)).find(m => !!m);
2167
- // Public
2168
- const setMode = (handler) => modeResolutionChain.push(handler);
2169
- const getMode = (ref) => getHostRef(ref).$modeName$;
2170
1964
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
2171
1965
  // initializeComponent
2172
- if ((BUILD.lazyLoad || BUILD.style) && (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
2173
- // we haven't initialized this element yet
2174
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
2175
- if (BUILD.mode && hostRef.$modeName$ == null) {
2176
- // initializeComponent
2177
- // looks like mode wasn't set as a property directly yet
2178
- // first check if there's an attribute
2179
- // next check the app's global
2180
- hostRef.$modeName$ = typeof cmpMeta.$lazyBundleIds$ !== 'string' ? computeMode(elm) : '';
2181
- }
2182
- if (BUILD.hydrateServerSide && hostRef.$modeName$) {
2183
- elm.setAttribute('s-mode', hostRef.$modeName$);
2184
- }
2185
- if (BUILD.lazyLoad) {
1966
+ if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) &&
1967
+ (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1968
+ if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
1969
+ // we haven't initialized this element yet
1970
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
2186
1971
  // lazy loaded components
2187
1972
  // request the component's implementation to be
2188
1973
  // wired up with the host element
@@ -2233,26 +2018,36 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
2233
2018
  fireConnectedCallback(hostRef.$lazyInstance$);
2234
2019
  }
2235
2020
  else {
2021
+ // sync constructor component
2236
2022
  Cstr = elm.constructor;
2023
+ hostRef.$flags$ |= 128 /* isWatchReady */ | 32 /* hasInitializedComponent */;
2237
2024
  }
2238
- const scopeId = BUILD.mode ? getScopeId(cmpMeta.$tagName$, hostRef.$modeName$) : getScopeId(cmpMeta.$tagName$);
2239
- if (BUILD.style && !styles.has(scopeId) && Cstr.style) {
2240
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
2025
+ if (BUILD.style && Cstr.style) {
2241
2026
  // this component has styles but we haven't registered them yet
2242
2027
  let style = Cstr.style;
2243
2028
  if (BUILD.mode && typeof style !== 'string') {
2244
- style = style[hostRef.$modeName$];
2029
+ style = style[(hostRef.$modeName$ = computeMode(elm))];
2030
+ if (BUILD.hydrateServerSide && hostRef.$modeName$) {
2031
+ elm.setAttribute('s-mode', hostRef.$modeName$);
2032
+ }
2245
2033
  }
2246
- if (!BUILD.hydrateServerSide && BUILD.shadowDom && BUILD.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2247
- style = await import('./shadow-css-6ef31c68.js').then(m => m.scopeCss(style, scopeId, false));
2034
+ const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
2035
+ if (!styles.has(scopeId)) {
2036
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
2037
+ if (!BUILD.hydrateServerSide &&
2038
+ BUILD.shadowDom &&
2039
+ BUILD.shadowDomShim &&
2040
+ cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2041
+ style = await import('./shadow-css.js').then(m => m.scopeCss(style, scopeId, false));
2042
+ }
2043
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
2044
+ endRegisterStyles();
2248
2045
  }
2249
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
2250
- endRegisterStyles();
2251
2046
  }
2252
2047
  }
2253
2048
  // we've successfully created a lazy instance
2254
2049
  const ancestorComponent = hostRef.$ancestorComponent$;
2255
- const schedule = () => scheduleUpdate(elm, hostRef, cmpMeta, true);
2050
+ const schedule = () => scheduleUpdate(hostRef, true);
2256
2051
  if (BUILD.asyncLoading && ancestorComponent && ancestorComponent['s-rc']) {
2257
2052
  // this is the intial load and this component it has an ancestor component
2258
2053
  // but the ancestor component has NOT fired its will update lifecycle yet
@@ -2271,16 +2066,14 @@ const fireConnectedCallback = (instance) => {
2271
2066
  safeCall(instance, 'connectedCallback');
2272
2067
  }
2273
2068
  };
2274
- const connectedCallback = (elm, cmpMeta) => {
2069
+ const connectedCallback = (elm) => {
2275
2070
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2276
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2277
- // connectedCallback
2278
2071
  const hostRef = getHostRef(elm);
2279
- if (BUILD.hostListener && cmpMeta.$listeners$) {
2280
- // initialize our event listeners on the host element
2281
- // we do this now so that we can listening to events that may
2282
- // have fired even before the instance is ready
2283
- hostRef.$rmListeners$ = addEventListeners(elm, hostRef, cmpMeta.$listeners$);
2072
+ const cmpMeta = hostRef.$cmpMeta$;
2073
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2074
+ if (BUILD.hostListenerTargetParent) {
2075
+ // only run if we have listeners being attached to a parent
2076
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
2284
2077
  }
2285
2078
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
2286
2079
  // first time this component has connected
@@ -2289,8 +2082,10 @@ const connectedCallback = (elm, cmpMeta) => {
2289
2082
  if (BUILD.hydrateClientSide) {
2290
2083
  hostId = elm.getAttribute(HYDRATE_ID);
2291
2084
  if (hostId) {
2292
- if (BUILD.shadowDom && supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2293
- const scopeId = BUILD.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode')) : addStyle(elm.shadowRoot, cmpMeta);
2085
+ if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2086
+ const scopeId = BUILD.mode
2087
+ ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode'))
2088
+ : addStyle(elm.shadowRoot, cmpMeta);
2294
2089
  elm.classList.remove(scopeId + '-h', scopeId + '-s');
2295
2090
  }
2296
2091
  initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
@@ -2301,9 +2096,9 @@ const connectedCallback = (elm, cmpMeta) => {
2301
2096
  // if the slot polyfill is required we'll need to put some nodes
2302
2097
  // in here to act as original content anchors as we move nodes around
2303
2098
  // host element has been connected to the DOM
2304
- if ((BUILD.hydrateServerSide) ||
2305
- (BUILD.slot && cmpMeta.$flags$ & 4 /* hasSlotRelocation */) ||
2306
- (BUILD.shadowDom && cmpMeta.$flags$ & 8 /* needsShadowDomShim */)) {
2099
+ if (BUILD.hydrateServerSide ||
2100
+ ((BUILD.slot || BUILD.shadowDom) &&
2101
+ cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
2307
2102
  setContentReference(elm);
2308
2103
  }
2309
2104
  }
@@ -2311,11 +2106,14 @@ const connectedCallback = (elm, cmpMeta) => {
2311
2106
  // find the first ancestor component (if there is one) and register
2312
2107
  // this component as one of the actively loading child components for its ancestor
2313
2108
  let ancestorComponent = elm;
2314
- while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
2109
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
2315
2110
  // climb up the ancestors looking for the first
2316
2111
  // component that hasn't finished its lifecycle update yet
2317
- if ((BUILD.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute('s-id')) ||
2318
- (ancestorComponent['s-p'])) {
2112
+ if ((BUILD.hydrateClientSide &&
2113
+ ancestorComponent.nodeType === 1 /* ElementNode */ &&
2114
+ ancestorComponent.hasAttribute('s-id') &&
2115
+ ancestorComponent['s-p']) ||
2116
+ ancestorComponent['s-p']) {
2319
2117
  // we found this components first ancestor component
2320
2118
  // keep a reference to this component's ancestor component
2321
2119
  attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
@@ -2326,7 +2124,7 @@ const connectedCallback = (elm, cmpMeta) => {
2326
2124
  // Lazy properties
2327
2125
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2328
2126
  if (BUILD.prop && BUILD.lazyLoad && !BUILD.hydrateServerSide && cmpMeta.$members$) {
2329
- Object.entries(cmpMeta.$members$).forEach(([memberName, [memberFlags]]) => {
2127
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2330
2128
  if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
2331
2129
  const value = elm[memberName];
2332
2130
  delete elm[memberName];
@@ -2345,7 +2143,14 @@ const connectedCallback = (elm, cmpMeta) => {
2345
2143
  initializeComponent(elm, hostRef, cmpMeta);
2346
2144
  }
2347
2145
  }
2348
- fireConnectedCallback(hostRef.$lazyInstance$);
2146
+ else {
2147
+ // not the first time this has connected
2148
+ // reattach any event listeners to the host
2149
+ // since they would have been removed when disconnected
2150
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2151
+ // fire off connectedCallback() on component instance
2152
+ fireConnectedCallback(hostRef.$lazyInstance$);
2153
+ }
2349
2154
  endConnected();
2350
2155
  }
2351
2156
  };
@@ -2356,9 +2161,7 @@ const setContentReference = (elm) => {
2356
2161
  // let's pick out the inner content for slot projection
2357
2162
  // create a node to represent where the original
2358
2163
  // content was first placed, which is useful later on
2359
- const contentRefElm = elm['s-cr'] = doc.createComment(BUILD.isDebug
2360
- ? `content-ref (host=${elm.localName})`
2361
- : '');
2164
+ const contentRefElm = (elm['s-cr'] = doc.createComment(BUILD.isDebug ? `content-ref (host=${elm.localName})` : ''));
2362
2165
  contentRefElm['s-cn'] = true;
2363
2166
  elm.insertBefore(contentRefElm, elm.firstChild);
2364
2167
  };
@@ -2368,7 +2171,7 @@ const disconnectedCallback = (elm) => {
2368
2171
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2369
2172
  if (BUILD.hostListener) {
2370
2173
  if (hostRef.$rmListeners$) {
2371
- hostRef.$rmListeners$();
2174
+ hostRef.$rmListeners$.map(rmListener => rmListener());
2372
2175
  hostRef.$rmListeners$ = undefined;
2373
2176
  }
2374
2177
  }
@@ -2384,7 +2187,82 @@ const disconnectedCallback = (elm) => {
2384
2187
  }
2385
2188
  }
2386
2189
  };
2387
- function hmrStart(elm, cmpMeta, hmrVersionId) {
2190
+ const defineCustomElement = (Cstr, compactMeta) => {
2191
+ customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
2192
+ };
2193
+ const proxyCustomElement = (Cstr, compactMeta) => {
2194
+ const cmpMeta = {
2195
+ $flags$: compactMeta[0],
2196
+ $tagName$: compactMeta[1],
2197
+ };
2198
+ if (BUILD.member) {
2199
+ cmpMeta.$members$ = compactMeta[2];
2200
+ }
2201
+ if (BUILD.hostListener) {
2202
+ cmpMeta.$listeners$ = compactMeta[3];
2203
+ }
2204
+ if (BUILD.watchCallback) {
2205
+ cmpMeta.$watchers$ = Cstr.$watchers$;
2206
+ }
2207
+ if (BUILD.reflect) {
2208
+ cmpMeta.$attrsToReflect$ = [];
2209
+ }
2210
+ if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2211
+ cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2212
+ }
2213
+ const originalConnectedCallback = Cstr.prototype.connectedCallback;
2214
+ const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
2215
+ Object.assign(Cstr.prototype, {
2216
+ __registerHost() {
2217
+ registerHost(this, cmpMeta);
2218
+ },
2219
+ connectedCallback() {
2220
+ connectedCallback(this);
2221
+ if (BUILD.connectedCallback && originalConnectedCallback) {
2222
+ originalConnectedCallback.call(this);
2223
+ }
2224
+ },
2225
+ disconnectedCallback() {
2226
+ disconnectedCallback(this);
2227
+ if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
2228
+ originalDisconnectedCallback.call(this);
2229
+ }
2230
+ },
2231
+ });
2232
+ Cstr.is = cmpMeta.$tagName$;
2233
+ return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
2234
+ };
2235
+ const forceModeUpdate = (elm) => {
2236
+ if (BUILD.style && BUILD.mode && !BUILD.lazyLoad) {
2237
+ const mode = computeMode(elm);
2238
+ const hostRef = getHostRef(elm);
2239
+ if (hostRef.$modeName$ !== mode) {
2240
+ const cmpMeta = hostRef.$cmpMeta$;
2241
+ const oldScopeId = elm['s-sc'];
2242
+ const scopeId = getScopeId(cmpMeta, mode);
2243
+ const style = elm.constructor.style[mode];
2244
+ const flags = cmpMeta.$flags$;
2245
+ if (style) {
2246
+ if (!styles.has(scopeId)) {
2247
+ registerStyle(scopeId, style, !!(flags & 1 /* shadowDomEncapsulation */));
2248
+ }
2249
+ hostRef.$modeName$ = mode;
2250
+ elm.classList.remove(oldScopeId + '-h', oldScopeId + '-s');
2251
+ attachStyles(hostRef);
2252
+ forceUpdate(elm);
2253
+ }
2254
+ }
2255
+ }
2256
+ };
2257
+ const attachShadow = (el) => {
2258
+ if (supportsShadow) {
2259
+ el.attachShadow({ mode: 'open' });
2260
+ }
2261
+ else {
2262
+ el.shadowRoot = el;
2263
+ }
2264
+ };
2265
+ const hmrStart = (elm, cmpMeta, hmrVersionId) => {
2388
2266
  // ¯\_(ツ)_/¯
2389
2267
  const hostRef = getHostRef(elm);
2390
2268
  // reset state flags to only have been connected
@@ -2400,9 +2278,125 @@ function hmrStart(elm, cmpMeta, hmrVersionId) {
2400
2278
  };
2401
2279
  // re-initialize the component
2402
2280
  initializeComponent(elm, hostRef, cmpMeta, hmrVersionId);
2403
- }
2281
+ };
2282
+ const patchCloneNode = (HostElementPrototype) => {
2283
+ const orgCloneNode = HostElementPrototype.cloneNode;
2284
+ HostElementPrototype.cloneNode = function (deep) {
2285
+ const srcNode = this;
2286
+ const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
2287
+ const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
2288
+ if (BUILD.slot && !isShadowDom && deep) {
2289
+ let i = 0;
2290
+ let slotted, nonRindoNode;
2291
+ let rindoPrivates = [
2292
+ 's-id',
2293
+ 's-cr',
2294
+ 's-lr',
2295
+ 's-rc',
2296
+ 's-sc',
2297
+ 's-p',
2298
+ 's-cn',
2299
+ 's-sr',
2300
+ 's-sn',
2301
+ 's-hn',
2302
+ 's-ol',
2303
+ 's-nr',
2304
+ 's-si',
2305
+ ];
2306
+ for (; i < srcNode.childNodes.length; i++) {
2307
+ slotted = srcNode.childNodes[i]['s-nr'];
2308
+ nonRindoNode = rindoPrivates.every(privateField => !srcNode.childNodes[i][privateField]);
2309
+ if (slotted) {
2310
+ if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
2311
+ clonedNode.__appendChild(slotted.cloneNode(true));
2312
+ }
2313
+ else {
2314
+ clonedNode.appendChild(slotted.cloneNode(true));
2315
+ }
2316
+ }
2317
+ if (nonRindoNode) {
2318
+ clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
2319
+ }
2320
+ }
2321
+ }
2322
+ return clonedNode;
2323
+ };
2324
+ };
2325
+ const patchSlotAppendChild = (HostElementPrototype) => {
2326
+ HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
2327
+ HostElementPrototype.appendChild = function (newChild) {
2328
+ const slotName = (newChild['s-sn'] = getSlotName(newChild));
2329
+ const slotNode = getHostSlotNode(this.childNodes, slotName);
2330
+ if (slotNode) {
2331
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2332
+ const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2333
+ return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2334
+ }
2335
+ return this.__appendChild(newChild);
2336
+ };
2337
+ };
2338
+ const patchChildSlotNodes = (elm, cmpMeta) => {
2339
+ class FakeNodeList extends Array {
2340
+ item(n) {
2341
+ return this[n];
2342
+ }
2343
+ }
2344
+ if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2345
+ const childNodesFn = elm.__lookupGetter__('childNodes');
2346
+ Object.defineProperty(elm, 'children', {
2347
+ get() {
2348
+ return this.childNodes.map((n) => n.nodeType === 1);
2349
+ },
2350
+ });
2351
+ Object.defineProperty(elm, 'childElementCount', {
2352
+ get() {
2353
+ return elm.children.length;
2354
+ },
2355
+ });
2356
+ Object.defineProperty(elm, 'childNodes', {
2357
+ get() {
2358
+ const childNodes = childNodesFn.call(this);
2359
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 &&
2360
+ getHostRef(this).$flags$ & 2 /* hasRendered */) {
2361
+ const result = new FakeNodeList();
2362
+ for (let i = 0; i < childNodes.length; i++) {
2363
+ const slot = childNodes[i]['s-nr'];
2364
+ if (slot) {
2365
+ result.push(slot);
2366
+ }
2367
+ }
2368
+ return result;
2369
+ }
2370
+ return FakeNodeList.from(childNodes);
2371
+ },
2372
+ });
2373
+ }
2374
+ };
2375
+ const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || '';
2376
+ const getHostSlotNode = (childNodes, slotName) => {
2377
+ let i = 0;
2378
+ let childNode;
2379
+ for (; i < childNodes.length; i++) {
2380
+ childNode = childNodes[i];
2381
+ if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
2382
+ return childNode;
2383
+ }
2384
+ childNode = getHostSlotNode(childNode.childNodes, slotName);
2385
+ if (childNode) {
2386
+ return childNode;
2387
+ }
2388
+ }
2389
+ return null;
2390
+ };
2391
+ const getHostSlotChildNodes = (n, slotName) => {
2392
+ const childNodes = [n];
2393
+ while ((n = n.nextSibling) && n['s-sn'] === slotName) {
2394
+ childNodes.push(n);
2395
+ }
2396
+ return childNodes;
2397
+ };
2404
2398
  const bootstrapLazy = (lazyBundles, options = {}) => {
2405
- if (BUILD.profile) {
2399
+ if (BUILD.profile && performance.mark) {
2406
2400
  performance.mark('st:app:start');
2407
2401
  }
2408
2402
  installDevTools();
@@ -2420,8 +2414,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2420
2414
  let i = 0;
2421
2415
  Object.assign(plt, options);
2422
2416
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2423
- if (options.syncQueue) {
2424
- plt.$flags$ |= 4 /* queueSync */;
2417
+ if (BUILD.asyncQueue) {
2418
+ if (options.syncQueue) {
2419
+ plt.$flags$ |= 4 /* queueSync */;
2420
+ }
2425
2421
  }
2426
2422
  if (BUILD.hydrateClientSide) {
2427
2423
  // If the app is already hydrated there is not point to disable the
@@ -2433,7 +2429,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2433
2429
  registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
2434
2430
  }
2435
2431
  }
2436
- lazyBundles.forEach(lazyBundle => lazyBundle[1].forEach(compactMeta => {
2432
+ lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
2437
2433
  const cmpMeta = {
2438
2434
  $flags$: compactMeta[0],
2439
2435
  $tagName$: compactMeta[1],
@@ -2452,23 +2448,25 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2452
2448
  if (BUILD.watchCallback) {
2453
2449
  cmpMeta.$watchers$ = {};
2454
2450
  }
2455
- if (BUILD.shadowDom && !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2451
+ if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2456
2452
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2457
2453
  }
2458
- const tagName = cmpMeta.$tagName$;
2454
+ const tagName = BUILD.transformTagName && options.transformTagName
2455
+ ? options.transformTagName(cmpMeta.$tagName$)
2456
+ : cmpMeta.$tagName$;
2459
2457
  const HostElement = class extends HTMLElement {
2460
2458
  // RindoLazyHost
2461
2459
  constructor(self) {
2462
2460
  // @ts-ignore
2463
2461
  super(self);
2464
2462
  self = this;
2465
- registerHost(self);
2463
+ registerHost(self, cmpMeta);
2466
2464
  if (BUILD.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2467
2465
  // this component is using shadow dom
2468
2466
  // and this browser supports shadow dom
2469
2467
  // add the read-only property "shadowRoot" to the host element
2470
2468
  // adding the shadow root build conditionals to minimize runtime
2471
- if (supportsShadowDom) {
2469
+ if (supportsShadow) {
2472
2470
  if (BUILD.shadowDelegatesFocus) {
2473
2471
  self.attachShadow({
2474
2472
  mode: 'open',
@@ -2483,6 +2481,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2483
2481
  self.shadowRoot = self;
2484
2482
  }
2485
2483
  }
2484
+ if (BUILD.slotChildNodesFix) {
2485
+ patchChildSlotNodes(self, cmpMeta);
2486
+ }
2486
2487
  }
2487
2488
  connectedCallback() {
2488
2489
  if (appLoadFallback) {
@@ -2494,31 +2495,28 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2494
2495
  deferredConnectedCallbacks.push(this);
2495
2496
  }
2496
2497
  else {
2497
- plt.jmp(() => connectedCallback(this, cmpMeta));
2498
+ plt.jmp(() => connectedCallback(this));
2498
2499
  }
2499
2500
  }
2500
2501
  disconnectedCallback() {
2501
2502
  plt.jmp(() => disconnectedCallback(this));
2502
2503
  }
2503
- forceUpdate() {
2504
- forceUpdate(this, cmpMeta);
2505
- }
2506
2504
  componentOnReady() {
2507
2505
  return getHostRef(this).$onReadyPromise$;
2508
2506
  }
2509
2507
  };
2510
2508
  if (BUILD.cloneNodeFix) {
2511
- cloneNodeFix(HostElement.prototype);
2509
+ patchCloneNode(HostElement.prototype);
2512
2510
  }
2513
2511
  if (BUILD.appendChildSlotFix) {
2514
- appendChildSlotFix(HostElement.prototype);
2512
+ patchSlotAppendChild(HostElement.prototype);
2515
2513
  }
2516
2514
  if (BUILD.hotModuleReplacement) {
2517
2515
  HostElement.prototype['s-hmr'] = function (hmrVersionId) {
2518
2516
  hmrStart(this, cmpMeta, hmrVersionId);
2519
2517
  };
2520
2518
  }
2521
- cmpMeta.$lazyBundleIds$ = lazyBundle[0];
2519
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
2522
2520
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
2523
2521
  cmpTags.push(tagName);
2524
2522
  customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
@@ -2531,115 +2529,25 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2531
2529
  }
2532
2530
  // Process deferred connectedCallbacks now all components have been registered
2533
2531
  isBootstrapping = false;
2534
- if (deferredConnectedCallbacks.length > 0) {
2535
- deferredConnectedCallbacks.forEach(host => host.connectedCallback());
2532
+ if (deferredConnectedCallbacks.length) {
2533
+ deferredConnectedCallbacks.map(host => host.connectedCallback());
2536
2534
  }
2537
2535
  else {
2538
2536
  if (BUILD.profile) {
2539
- plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'));
2537
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30, 'timeout')));
2540
2538
  }
2541
2539
  else {
2542
- plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
2540
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
2543
2541
  }
2544
2542
  }
2545
2543
  // Fallback appLoad event
2546
2544
  endBootstrap();
2547
2545
  };
2548
- const defineCustomElement = (Cstr, compactMeta) => {
2549
- customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
2550
- };
2551
- const proxyCustomElement = (Cstr, compactMeta) => {
2552
- const cmpMeta = {
2553
- $flags$: compactMeta[0],
2554
- $tagName$: compactMeta[1],
2555
- };
2556
- if (BUILD.member) {
2557
- cmpMeta.$members$ = compactMeta[2];
2558
- }
2559
- if (BUILD.hostListener) {
2560
- cmpMeta.$listeners$ = compactMeta[3];
2561
- }
2562
- if (BUILD.watchCallback) {
2563
- cmpMeta.$watchers$ = Cstr.$watchers$;
2564
- }
2565
- if (BUILD.reflect) {
2566
- cmpMeta.$attrsToReflect$ = [];
2567
- }
2568
- if (BUILD.shadowDom && !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2569
- cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2570
- }
2571
- Object.assign(Cstr.prototype, {
2572
- forceUpdate() {
2573
- forceUpdate(this, cmpMeta);
2574
- },
2575
- connectedCallback() {
2576
- connectedCallback(this, cmpMeta);
2577
- },
2578
- disconnectedCallback() {
2579
- disconnectedCallback(this);
2580
- }
2581
- });
2582
- return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
2583
- };
2584
- const attachShadow = (el) => {
2585
- if (supportsShadowDom) {
2586
- el.attachShadow({ mode: 'open' });
2587
- }
2588
- else {
2589
- el.shadowRoot = el;
2590
- }
2591
- };
2592
- const proxyNative = (Cstr, compactMeta) => {
2593
- const cmpMeta = {
2594
- $flags$: compactMeta[0],
2595
- $tagName$: compactMeta[1],
2596
- $members$: compactMeta[2],
2597
- $listeners$: compactMeta[3],
2598
- $watchers$: Cstr.$watchers$
2599
- };
2600
- if (BUILD.reflect) {
2601
- cmpMeta.$attrsToReflect$ = [];
2602
- }
2603
- if (BUILD.shadowDom && !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2604
- cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2605
- }
2606
- Object.assign(Cstr.prototype, {
2607
- forceUpdate() {
2608
- forceUpdate(this, cmpMeta);
2609
- },
2610
- connectedCallback() {
2611
- connectedCallback(this, cmpMeta);
2612
- },
2613
- disconnectedCallback() {
2614
- disconnectedCallback(this);
2615
- }
2616
- });
2617
- return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
2618
- };
2619
- const createEvent = (ref, name, flags) => {
2620
- const elm = getElement(ref);
2621
- return {
2622
- emit: (detail) => {
2623
- if (BUILD.isDev && !elm.isConnected) {
2624
- consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2625
- }
2626
- const ev = new (BUILD.hydrateServerSide ? win.CustomEvent : CustomEvent)(name, {
2627
- bubbles: !!(flags & 4 /* Bubbles */),
2628
- composed: !!(flags & 2 /* Composed */),
2629
- cancelable: !!(flags & 1 /* Cancellable */),
2630
- detail
2631
- });
2632
- elm.dispatchEvent(ev);
2633
- return ev;
2634
- }
2635
- };
2636
- };
2637
2546
  const getAssetPath = (path) => {
2638
2547
  const assetUrl = new URL(path, plt.$resourcesUrl$);
2639
- return (assetUrl.origin !== win.location.origin)
2640
- ? assetUrl.href
2641
- : assetUrl.pathname;
2548
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
2642
2549
  };
2550
+ const setAssetPath = (path) => (plt.$resourcesUrl$ = path);
2643
2551
  const getConnect = (_ref, tagName) => {
2644
2552
  const componentOnReady = () => {
2645
2553
  let elm = doc.querySelector(tagName);
@@ -2650,8 +2558,7 @@ const getConnect = (_ref, tagName) => {
2650
2558
  return typeof elm.componentOnReady === 'function' ? elm.componentOnReady() : Promise.resolve(elm);
2651
2559
  };
2652
2560
  const create = (...args) => {
2653
- return componentOnReady()
2654
- .then(el => el.create(...args));
2561
+ return componentOnReady().then(el => el.create(...args));
2655
2562
  };
2656
2563
  return {
2657
2564
  create,
@@ -2684,18 +2591,18 @@ const getContext = (_elm, context) => {
2684
2591
  tick: {
2685
2592
  then(cb) {
2686
2593
  return nextTick(cb);
2687
- }
2688
- }
2594
+ },
2595
+ },
2689
2596
  };
2690
2597
  }
2691
2598
  return undefined;
2692
2599
  };
2693
- const getElement = (ref) => BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2694
- const insertVdomAnnotations = (doc) => {
2600
+ const insertVdomAnnotations = (doc, staticComponents) => {
2695
2601
  if (doc != null) {
2696
2602
  const docData = {
2697
2603
  hostIds: 0,
2698
- rootLevelIds: 0
2604
+ rootLevelIds: 0,
2605
+ staticComponents: new Set(staticComponents),
2699
2606
  };
2700
2607
  const orgLocationNodes = [];
2701
2608
  parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
@@ -2758,9 +2665,9 @@ const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
2758
2665
  if (node.nodeType === 1 /* ElementNode */) {
2759
2666
  node.childNodes.forEach(childNode => {
2760
2667
  const hostRef = getHostRef(childNode);
2761
- if (hostRef != null) {
2668
+ if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
2762
2669
  const cmpData = {
2763
- nodeIds: 0
2670
+ nodeIds: 0,
2764
2671
  };
2765
2672
  insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
2766
2673
  }
@@ -2781,6 +2688,17 @@ const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
2781
2688
  insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
2782
2689
  });
2783
2690
  }
2691
+ if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute('c-id')) {
2692
+ const parent = hostElm.parentElement;
2693
+ if (parent && parent.childNodes) {
2694
+ const parentChildNodes = Array.from(parent.childNodes);
2695
+ const comment = parentChildNodes.find(node => node.nodeType === 8 /* CommentNode */ && node['s-sr']);
2696
+ if (comment) {
2697
+ const index = parentChildNodes.indexOf(hostElm) - 1;
2698
+ vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}`);
2699
+ }
2700
+ }
2701
+ }
2784
2702
  }
2785
2703
  };
2786
2704
  const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
@@ -2797,7 +2715,8 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
2797
2715
  }
2798
2716
  else if (childElm.nodeType === 3 /* TextNode */) {
2799
2717
  const parentNode = childElm.parentNode;
2800
- if (parentNode.nodeName !== 'STYLE') {
2718
+ const nodeName = parentNode.nodeName;
2719
+ if (nodeName !== 'STYLE' && nodeName !== 'SCRIPT') {
2801
2720
  const textNodeId = `${TEXT_NODE_ID}.${childId}`;
2802
2721
  const commentBeforeTextNode = doc.createComment(textNodeId);
2803
2722
  parentNode.insertBefore(commentBeforeTextNode, childElm);
@@ -2805,7 +2724,7 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
2805
2724
  }
2806
2725
  else if (childElm.nodeType === 8 /* CommentNode */) {
2807
2726
  if (childElm['s-sr']) {
2808
- const slotName = (childElm['s-sn'] || '');
2727
+ const slotName = childElm['s-sn'] || '';
2809
2728
  const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
2810
2729
  childElm.nodeValue = slotNodeId;
2811
2730
  }
@@ -2817,4 +2736,159 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
2817
2736
  });
2818
2737
  }
2819
2738
  };
2820
- export { Build, CSS, Context, H, H as HTMLElement, Host, RINDO_DEV_MODE, attachShadow, bootstrapLazy, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, doc, forceUpdate, getAssetPath, getConnect, getContext, getElement, getHostRef, getMode, getRenderingElement, getValue, h, insertVdomAnnotations, isMemberInElement, loadModule, moduleCache, nextTick, parsePropertyValue, patchBrowser, patchCloneNodeFix, patchDynamicImport, patchEsm, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, proxyNative, readTask, registerHost, registerInstance, renderVdom, setMode, setValue, styles, supportsConstructibleStylesheets, supportsListenerOptions, supportsShadowDom, win, writeTask };
2739
+ const setPlatformOptions = (opts) => Object.assign(plt, opts);
2740
+ const Fragment = (_, children) => children;
2741
+ const hostRefs = new WeakMap();
2742
+ const getHostRef = (ref) => hostRefs.get(ref);
2743
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
2744
+ const registerHost = (elm, cmpMeta) => {
2745
+ const hostRef = {
2746
+ $flags$: 0,
2747
+ $hostElement$: elm,
2748
+ $cmpMeta$: cmpMeta,
2749
+ $instanceValues$: new Map(),
2750
+ };
2751
+ if (BUILD.isDev) {
2752
+ hostRef.$renderCount$ = 0;
2753
+ }
2754
+ if (BUILD.method && BUILD.lazyLoad) {
2755
+ hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
2756
+ }
2757
+ if (BUILD.asyncLoading) {
2758
+ hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
2759
+ elm['s-p'] = [];
2760
+ elm['s-rc'] = [];
2761
+ }
2762
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2763
+ return hostRefs.set(elm, hostRef);
2764
+ };
2765
+ const isMemberInElement = (elm, memberName) => memberName in elm;
2766
+ const consoleError = (e, el) => (customError || console.error)(e, el);
2767
+ const RINDO_DEV_MODE = BUILD.isTesting
2768
+ ? ['RINDO:'] // E2E testing
2769
+ : [
2770
+ '%crindo',
2771
+ 'color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px',
2772
+ ];
2773
+ const consoleDevError = (...m) => console.error(...RINDO_DEV_MODE, ...m);
2774
+ const consoleDevWarn = (...m) => console.warn(...RINDO_DEV_MODE, ...m);
2775
+ const consoleDevInfo = (...m) => console.info(...RINDO_DEV_MODE, ...m);
2776
+ const setErrorHandler = (handler) => (customError = handler);
2777
+ const cmpModules = /*@__PURE__*/ new Map();
2778
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2779
+ // loadModuleImport
2780
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
2781
+ const bundleId = cmpMeta.$lazyBundleId$;
2782
+ if (BUILD.isDev && typeof bundleId !== 'string') {
2783
+ consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
2784
+ return undefined;
2785
+ }
2786
+ const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
2787
+ if (module) {
2788
+ return module[exportName];
2789
+ }
2790
+ return import(
2791
+ /* webpackInclude: /\.entry\.js$/ */
2792
+ /* webpackExclude: /\.system\.entry\.js$/ */
2793
+ /* webpackMode: "lazy" */
2794
+ `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? '?s-hmr=' + hmrVersionId : ''}`).then(importedModule => {
2795
+ if (!BUILD.hotModuleReplacement) {
2796
+ cmpModules.set(bundleId, importedModule);
2797
+ }
2798
+ return importedModule[exportName];
2799
+ }, consoleError);
2800
+ };
2801
+ const styles = new Map();
2802
+ const modeResolutionChain = [];
2803
+ const queueDomReads = [];
2804
+ const queueDomWrites = [];
2805
+ const queueDomWritesLow = [];
2806
+ const queueTask = (queue, write) => (cb) => {
2807
+ queue.push(cb);
2808
+ if (!queuePending) {
2809
+ queuePending = true;
2810
+ if (write && plt.$flags$ & 4 /* queueSync */) {
2811
+ nextTick(flush);
2812
+ }
2813
+ else {
2814
+ plt.raf(flush);
2815
+ }
2816
+ }
2817
+ };
2818
+ const consume = (queue) => {
2819
+ for (let i = 0; i < queue.length; i++) {
2820
+ try {
2821
+ queue[i](performance.now());
2822
+ }
2823
+ catch (e) {
2824
+ consoleError(e);
2825
+ }
2826
+ }
2827
+ queue.length = 0;
2828
+ };
2829
+ const consumeTimeout = (queue, timeout) => {
2830
+ let i = 0;
2831
+ let ts = 0;
2832
+ while (i < queue.length && (ts = performance.now()) < timeout) {
2833
+ try {
2834
+ queue[i++](ts);
2835
+ }
2836
+ catch (e) {
2837
+ consoleError(e);
2838
+ }
2839
+ }
2840
+ if (i === queue.length) {
2841
+ queue.length = 0;
2842
+ }
2843
+ else if (i !== 0) {
2844
+ queue.splice(0, i);
2845
+ }
2846
+ };
2847
+ const flush = () => {
2848
+ if (BUILD.asyncQueue) {
2849
+ queueCongestion++;
2850
+ }
2851
+ // always force a bunch of medium callbacks to run, but still have
2852
+ // a throttle on how many can run in a certain time
2853
+ // DOM READS!!!
2854
+ consume(queueDomReads);
2855
+ // DOM WRITES!!!
2856
+ if (BUILD.asyncQueue) {
2857
+ const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
2858
+ ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0))
2859
+ : Infinity;
2860
+ consumeTimeout(queueDomWrites, timeout);
2861
+ consumeTimeout(queueDomWritesLow, timeout);
2862
+ if (queueDomWrites.length > 0) {
2863
+ queueDomWritesLow.push(...queueDomWrites);
2864
+ queueDomWrites.length = 0;
2865
+ }
2866
+ if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
2867
+ // still more to do yet, but we've run out of time
2868
+ // let's let this thing cool off and try again in the next tick
2869
+ plt.raf(flush);
2870
+ }
2871
+ else {
2872
+ queueCongestion = 0;
2873
+ }
2874
+ }
2875
+ else {
2876
+ consume(queueDomWrites);
2877
+ if ((queuePending = queueDomReads.length > 0)) {
2878
+ // still more to do yet, but we've run out of time
2879
+ // let's let this thing cool off and try again in the next tick
2880
+ plt.raf(flush);
2881
+ }
2882
+ }
2883
+ };
2884
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
2885
+ const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
2886
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2887
+ const Build = {
2888
+ isDev: BUILD.isDev ? true : false,
2889
+ isBrowser: true,
2890
+ isServer: false,
2891
+ isTesting: BUILD.isTesting ? true : false,
2892
+ };
2893
+ export { BUILD, Env, NAMESPACE } from '@rindo/core/internal/app-data';
2894
+ export { Build, CSS, Context, Fragment, H, H as HTMLElement, Host, RINDO_DEV_MODE, addHostEventListeners, attachShadow, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, doc, forceModeUpdate, forceUpdate, getAssetPath, getConnect, getContext, getElement, getHostRef, getMode, getRenderingRef, getValue, h, insertVdomAnnotations, isMemberInElement, loadModule, modeResolutionChain, nextTick, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, renderVdom, setAssetPath, setErrorHandler, setMode, setPlatformOptions, setValue, styles, supportsConstructibleStylesheets, supportsListenerOptions, supportsShadow, win, writeTask };