@rindo/core 1.8.12 → 1.17.4

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 (545) hide show
  1. package/bin/rindo +53 -19
  2. package/cli/index.cjs.js +524 -0
  3. package/cli/index.d.ts +15 -0
  4. package/cli/index.js +500 -0
  5. package/cli/package.json +9 -0
  6. package/compiler/package.json +8 -6
  7. package/compiler/rindo.d.ts +111 -0
  8. package/compiler/rindo.js +62852 -6655
  9. package/compiler/rindo.min.js +17 -0
  10. package/dependencies.json +80 -0
  11. package/dev-server/client/app-error.d.ts +18 -0
  12. package/dev-server/client/events.d.ts +6 -0
  13. package/dev-server/client/hmr-components.d.ts +1 -0
  14. package/dev-server/client/hmr-external-styles.d.ts +1 -0
  15. package/dev-server/client/hmr-images.d.ts +1 -0
  16. package/dev-server/client/hmr-inline-styles.d.ts +1 -0
  17. package/dev-server/client/hmr-util.d.ts +9 -0
  18. package/dev-server/client/hmr-window.d.ts +10 -0
  19. package/dev-server/client/index.d.ts +6 -0
  20. package/dev-server/client/index.js +785 -0
  21. package/dev-server/client/logger.d.ts +5 -0
  22. package/dev-server/client/package.json +8 -0
  23. package/dev-server/client/progress.d.ts +3 -0
  24. package/dev-server/client/status.d.ts +4 -0
  25. package/dev-server/connector.html +6 -0
  26. package/dev-server/content-type-db.json +1 -0
  27. package/dev-server/index.d.ts +6 -0
  28. package/dev-server/index.js +260 -0
  29. package/dev-server/open-in-editor-api.js +1 -0
  30. package/dev-server/package.json +8 -0
  31. package/dev-server/server-worker.js +1570 -0
  32. package/{dist/dev-server → dev-server}/static/favicon.ico +0 -0
  33. package/{dist/dev-server → dev-server}/templates/directory-index.html +132 -132
  34. package/dev-server/templates/initial-load.html +160 -0
  35. package/{dist/sys/node → dev-server}/visualstudio.vbs +0 -0
  36. package/dev-server/ws.js +1 -0
  37. package/{dist/sys/node → dev-server}/xdg-open +0 -0
  38. package/internal/app-data/index.cjs.js +88 -0
  39. package/internal/app-data/index.d.ts +3 -0
  40. package/internal/{client/build-conditionals.mjs → app-data/index.js} +24 -21
  41. package/internal/app-data/package.json +9 -0
  42. package/internal/client/css-shim.js +4 -0
  43. package/internal/client/{dom.rindo-client.mjs → dom.js} +73 -137
  44. package/{dist/client/index.mjs → internal/client/index.js} +736 -736
  45. package/internal/client/package.json +7 -0
  46. package/internal/client/patch.js +136 -0
  47. package/internal/client/polyfills/core-js.js +11 -10
  48. package/internal/client/polyfills/css-shim.js +1 -656
  49. package/internal/client/polyfills/dom.js +79 -146
  50. package/internal/client/polyfills/es5-html-element.js +1 -18
  51. package/internal/client/polyfills/index.js +6 -7
  52. package/internal/client/{shadow-css.rindo-client.mjs → shadow-css.js} +14 -17
  53. package/internal/hydrate/index.js +1073 -0
  54. package/internal/hydrate/package.json +7 -0
  55. package/internal/hydrate/runner.d.ts +205 -0
  56. package/internal/hydrate/runner.js +748 -0
  57. package/internal/hydrate/shadow-css.js +146 -0
  58. package/internal/index.d.ts +4 -18
  59. package/internal/index.js +1 -1
  60. package/internal/package.json +8 -6
  61. package/internal/rindo-core/index.d.ts +2 -0
  62. package/{dist → internal/rindo-core}/index.js +0 -0
  63. package/internal/rindo-ext-modules.d.ts +39 -0
  64. package/internal/rindo-private.d.ts +2183 -0
  65. package/internal/rindo-public-compiler.d.ts +2094 -0
  66. package/{dist/declarations/docs.d.ts → internal/rindo-public-docs.d.ts} +13 -1
  67. package/internal/rindo-public-runtime.d.ts +1552 -0
  68. package/internal/testing/index.js +1032 -0
  69. package/internal/testing/package.json +7 -0
  70. package/internal/testing/shadow-css.js +146 -0
  71. package/mock-doc/index.cjs.js +4500 -0
  72. package/mock-doc/index.d.ts +905 -0
  73. package/mock-doc/index.js +4464 -2
  74. package/mock-doc/package.json +9 -10
  75. package/package.json +84 -137
  76. package/readme.md +3 -82
  77. package/screenshot/compare/build/app.css +1 -1
  78. package/screenshot/compare/build/app.esm.js +1 -1
  79. package/screenshot/compare/build/app.js +27 -812
  80. package/{dist/compiler/polyfills.d.ts → screenshot/compare/build/index.esm.js} +0 -0
  81. package/screenshot/compare/build/{p-113f7459.js → p-081b0641.js} +1 -1
  82. package/screenshot/compare/build/p-227a1e18.entry.js +1 -0
  83. package/screenshot/compare/build/p-2c298727.entry.js +1 -0
  84. package/screenshot/compare/build/p-5479268c.entry.js +1 -0
  85. package/screenshot/compare/build/p-573ec8a4.entry.js +1 -0
  86. package/screenshot/compare/build/p-6ba08604.entry.js +1 -0
  87. package/screenshot/compare/build/p-6bc63295.entry.js +1 -0
  88. package/screenshot/compare/build/p-7a3759fd.entry.js +1 -0
  89. package/screenshot/compare/build/{p-ejpsp3kx.js → p-7b4e3ba7.js} +1 -1
  90. package/screenshot/compare/build/p-988eb362.css +1 -0
  91. package/screenshot/compare/build/p-9b6a9315.js +1 -0
  92. package/screenshot/compare/build/p-b4cc611c.entry.js +1 -0
  93. package/screenshot/compare/build/p-d1bf53f5.entry.js +1 -0
  94. package/screenshot/compare/build/{p-efb0eac6.js → p-e2efe0df.js} +1 -1
  95. package/screenshot/compare/build/p-e8ca6d97.entry.js +1 -0
  96. package/screenshot/compare/build/p-ec2f13e0.entry.js +1 -0
  97. package/screenshot/compare/build/p-f0b99977.entry.js +1 -0
  98. package/screenshot/compare/build/p-f4745c2f.entry.js +1 -0
  99. package/screenshot/compare/build/p-fbbae598.js +1 -0
  100. package/screenshot/compare/host.config.json +14 -14
  101. package/screenshot/compare/index.html +1 -1
  102. package/{dist/screenshot → screenshot}/connector-base.d.ts +1 -1
  103. package/{dist/screenshot → screenshot}/connector-local.d.ts +1 -1
  104. package/screenshot/connector.js +2 -3
  105. package/{dist/screenshot → screenshot}/index.d.ts +1 -1
  106. package/screenshot/index.js +642 -2
  107. package/screenshot/local-connector.js +2 -3
  108. package/screenshot/package.json +8 -13
  109. package/{dist/screenshot → screenshot}/pixel-match.d.ts +0 -0
  110. package/screenshot/pixel-match.js +22 -6
  111. package/screenshot/screenshot-compare.d.ts +3 -0
  112. package/{dist/screenshot → screenshot}/screenshot-fs.d.ts +1 -1
  113. package/sys/node/autoprefixer.js +1 -0
  114. package/sys/node/glob.js +1 -0
  115. package/sys/node/graceful-fs.js +1 -0
  116. package/sys/node/index.d.ts +18 -0
  117. package/sys/node/index.js +1402 -2
  118. package/sys/node/node-fetch.js +1 -0
  119. package/sys/node/package.json +8 -5
  120. package/sys/node/prompts.js +1 -0
  121. package/sys/node/worker.js +33 -0
  122. package/{dist/testing → testing}/index.d.ts +5 -6
  123. package/testing/index.js +3903 -2
  124. package/testing/jest/jest-config.d.ts +92 -0
  125. package/{dist/testing → testing}/jest/jest-environment.d.ts +4 -2
  126. package/{dist/testing → testing}/jest/jest-preprocessor.d.ts +1 -0
  127. package/{dist/testing → testing}/jest/jest-runner.d.ts +1 -1
  128. package/{dist/testing → testing}/jest/jest-screenshot.d.ts +1 -1
  129. package/{dist/testing → testing}/jest/jest-serializer.d.ts +1 -1
  130. package/{dist/testing → testing}/jest/jest-setup-test-framework.d.ts +0 -0
  131. package/testing/jest-environment.js +3 -3
  132. package/testing/jest-preprocessor.js +3 -3
  133. package/testing/jest-preset.js +20 -28
  134. package/testing/jest-runner.js +3 -3
  135. package/testing/jest-setuptestframework.js +3 -3
  136. package/{dist/testing → testing}/matchers/attributes.d.ts +0 -0
  137. package/{dist/testing → testing}/matchers/class-list.d.ts +0 -0
  138. package/{dist/testing → testing}/matchers/events.d.ts +9 -1
  139. package/{dist/testing → testing}/matchers/html.d.ts +0 -0
  140. package/{dist/testing → testing}/matchers/index.d.ts +3 -1
  141. package/{dist/testing → testing}/matchers/screenshot.d.ts +1 -1
  142. package/{dist/testing → testing}/matchers/text.d.ts +0 -0
  143. package/testing/mock-fetch.d.ts +11 -0
  144. package/testing/mocks.d.ts +14 -0
  145. package/testing/package.json +8 -6
  146. package/testing/puppeteer/index.d.ts +2 -0
  147. package/{dist/testing → testing}/puppeteer/puppeteer-browser.d.ts +2 -2
  148. package/{dist/testing → testing}/puppeteer/puppeteer-declarations.d.ts +9 -9
  149. package/{dist/testing → testing}/puppeteer/puppeteer-element.d.ts +5 -3
  150. package/testing/puppeteer/puppeteer-emulate.d.ts +2 -0
  151. package/{dist/testing → testing}/puppeteer/puppeteer-events.d.ts +7 -7
  152. package/testing/puppeteer/puppeteer-page.d.ts +2 -0
  153. package/testing/puppeteer/puppeteer-screenshot.d.ts +4 -0
  154. package/testing/reset-build-conditionals.d.ts +2 -0
  155. package/testing/spec-page.d.ts +2 -0
  156. package/testing/test-transpile.d.ts +2 -0
  157. package/{dist/testing → testing}/testing-logger.d.ts +10 -8
  158. package/testing/testing-sys.d.ts +1 -0
  159. package/{dist/testing → testing}/testing-utils.d.ts +3 -2
  160. package/testing/testing.d.ts +2 -0
  161. package/build-conditionals/index.d.ts +0 -2
  162. package/build-conditionals/index.mjs +0 -66
  163. package/build-conditionals/package.json +0 -6
  164. package/compiler/index.js +0 -2
  165. package/dist/cli/index.js +0 -6068
  166. package/dist/client/css-shim-14a9812e.js +0 -656
  167. package/dist/client/css-shim-69821662.js +0 -658
  168. package/dist/client/declarations/rindo.core.d.ts +0 -1347
  169. package/dist/client/dom-68c8fe31.js +0 -139
  170. package/dist/client/dom-af01458a.js +0 -137
  171. package/dist/client/index.js +0 -2937
  172. package/dist/client/polyfills/core-js.js +0 -10
  173. package/dist/client/polyfills/css-shim.js +0 -656
  174. package/dist/client/polyfills/dom.js +0 -146
  175. package/dist/client/polyfills/es5-html-element.js +0 -18
  176. package/dist/client/polyfills/index.js +0 -35
  177. package/dist/client/polyfills/promise.js +0 -9
  178. package/dist/client/polyfills/system.js +0 -6
  179. package/dist/client/shadow-css-6ef31c68.js +0 -386
  180. package/dist/client/shadow-css-8fd1a9e4.js +0 -388
  181. package/dist/compiler/app-core/app-es5-disabled.d.ts +0 -2
  182. package/dist/compiler/app-core/app-polyfills.d.ts +0 -3
  183. package/dist/compiler/app-core/build-conditionals.d.ts +0 -6
  184. package/dist/compiler/app-core/bundle-app-core.d.ts +0 -6
  185. package/dist/compiler/app-core/component-styles.d.ts +0 -4
  186. package/dist/compiler/app-core/format-component-runtime-meta.d.ts +0 -4
  187. package/dist/compiler/app-core/optimize-module.d.ts +0 -7
  188. package/dist/compiler/browser/build-conditionals-client.d.ts +0 -3
  189. package/dist/compiler/browser/compile-options.d.ts +0 -12
  190. package/dist/compiler/browser/compile.d.ts +0 -2
  191. package/dist/compiler/browser/create-compiler.d.ts +0 -14
  192. package/dist/compiler/browser/index.d.ts +0 -11
  193. package/dist/compiler/build/build-ctx.d.ts +0 -74
  194. package/dist/compiler/build/build-finish.d.ts +0 -3
  195. package/dist/compiler/build/build-hmr.d.ts +0 -2
  196. package/dist/compiler/build/build-results.d.ts +0 -2
  197. package/dist/compiler/build/build-stats.d.ts +0 -3
  198. package/dist/compiler/build/build.d.ts +0 -2
  199. package/dist/compiler/build/cache-stats.d.ts +0 -4
  200. package/dist/compiler/build/compiler-build-id.d.ts +0 -6
  201. package/dist/compiler/build/compiler-ctx.d.ts +0 -44
  202. package/dist/compiler/build/init-index-html.d.ts +0 -2
  203. package/dist/compiler/build/validate-files.d.ts +0 -2
  204. package/dist/compiler/build/write-build.d.ts +0 -2
  205. package/dist/compiler/cache.d.ts +0 -22
  206. package/dist/compiler/compiler.d.ts +0 -27
  207. package/dist/compiler/component-hydrate/bundle-hydrate-factory.d.ts +0 -3
  208. package/dist/compiler/component-hydrate/generate-hydrate-app.d.ts +0 -2
  209. package/dist/compiler/component-hydrate/hydrate-factory-closure.d.ts +0 -2
  210. package/dist/compiler/component-hydrate/update-to-hydrate-components.d.ts +0 -2
  211. package/dist/compiler/component-hydrate/write-hydrate-outputs.d.ts +0 -3
  212. package/dist/compiler/component-lazy/generate-cjs.d.ts +0 -3
  213. package/dist/compiler/component-lazy/generate-esm-browser.d.ts +0 -3
  214. package/dist/compiler/component-lazy/generate-esm.d.ts +0 -3
  215. package/dist/compiler/component-lazy/generate-lazy-app.d.ts +0 -3
  216. package/dist/compiler/component-lazy/generate-lazy-module.d.ts +0 -4
  217. package/dist/compiler/component-lazy/generate-system.d.ts +0 -3
  218. package/dist/compiler/component-lazy/update-to-lazy-component.d.ts +0 -2
  219. package/dist/compiler/component-lazy/write-lazy-entry-module.d.ts +0 -2
  220. package/dist/compiler/component-native/update-to-native-component.d.ts +0 -2
  221. package/dist/compiler/config/config-reload.d.ts +0 -3
  222. package/dist/compiler/config/config-utils.d.ts +0 -4
  223. package/dist/compiler/config/validate-config.d.ts +0 -4
  224. package/dist/compiler/config/validate-copy.d.ts +0 -2
  225. package/dist/compiler/config/validate-dev-server.d.ts +0 -2
  226. package/dist/compiler/config/validate-docs.d.ts +0 -2
  227. package/dist/compiler/config/validate-namespace.d.ts +0 -3
  228. package/dist/compiler/config/validate-output-stats.d.ts +0 -2
  229. package/dist/compiler/config/validate-outputs-angular.d.ts +0 -2
  230. package/dist/compiler/config/validate-outputs-custom.d.ts +0 -2
  231. package/dist/compiler/config/validate-outputs-dist-module.d.ts +0 -2
  232. package/dist/compiler/config/validate-outputs-dist.d.ts +0 -2
  233. package/dist/compiler/config/validate-outputs-hydrate-script.d.ts +0 -2
  234. package/dist/compiler/config/validate-outputs-www.d.ts +0 -2
  235. package/dist/compiler/config/validate-outputs.d.ts +0 -2
  236. package/dist/compiler/config/validate-paths.d.ts +0 -2
  237. package/dist/compiler/config/validate-plugins.d.ts +0 -2
  238. package/dist/compiler/config/validate-prerender.d.ts +0 -2
  239. package/dist/compiler/config/validate-rollup-config.d.ts +0 -2
  240. package/dist/compiler/config/validate-service-worker.d.ts +0 -2
  241. package/dist/compiler/config/validate-testing.d.ts +0 -2
  242. package/dist/compiler/config/validate-workers.d.ts +0 -2
  243. package/dist/compiler/copy/assets-copy-tasks.d.ts +0 -3
  244. package/dist/compiler/copy/hashed-copy.d.ts +0 -2
  245. package/dist/compiler/copy/local-copy-tasks.d.ts +0 -3
  246. package/dist/compiler/docs/constants.d.ts +0 -2
  247. package/dist/compiler/docs/custom/index.d.ts +0 -2
  248. package/dist/compiler/docs/docs.d.ts +0 -2
  249. package/dist/compiler/docs/generate-doc-data.d.ts +0 -3
  250. package/dist/compiler/docs/json/index.d.ts +0 -3
  251. package/dist/compiler/docs/readme/docs-util.d.ts +0 -13
  252. package/dist/compiler/docs/readme/index.d.ts +0 -3
  253. package/dist/compiler/docs/readme/markdown-css-props.d.ts +0 -2
  254. package/dist/compiler/docs/readme/markdown-dependencies.d.ts +0 -2
  255. package/dist/compiler/docs/readme/markdown-events.d.ts +0 -2
  256. package/dist/compiler/docs/readme/markdown-methods.d.ts +0 -2
  257. package/dist/compiler/docs/readme/markdown-props.d.ts +0 -2
  258. package/dist/compiler/docs/readme/markdown-slots.d.ts +0 -2
  259. package/dist/compiler/docs/readme/markdown-usage.d.ts +0 -6
  260. package/dist/compiler/docs/readme/output-docs.d.ts +0 -3
  261. package/dist/compiler/docs/style-docs.d.ts +0 -2
  262. package/dist/compiler/docs/vscode/index.d.ts +0 -2
  263. package/dist/compiler/entries/component-bundles.d.ts +0 -3
  264. package/dist/compiler/entries/component-graph.d.ts +0 -2
  265. package/dist/compiler/entries/default-bundles.d.ts +0 -3
  266. package/dist/compiler/entries/entry-modules.d.ts +0 -6
  267. package/dist/compiler/entries/resolve-component-dependencies.d.ts +0 -2
  268. package/dist/compiler/events.d.ts +0 -15
  269. package/dist/compiler/fs-watch/fs-watch-init.d.ts +0 -2
  270. package/dist/compiler/fs-watch/fs-watch-log.d.ts +0 -2
  271. package/dist/compiler/fs-watch/fs-watch-rebuild.d.ts +0 -7
  272. package/dist/compiler/html/inject-module-preloads.d.ts +0 -3
  273. package/dist/compiler/html/inject-sw-script.d.ts +0 -4
  274. package/dist/compiler/html/inline-esm-import.d.ts +0 -2
  275. package/dist/compiler/html/inline-style-sheets.d.ts +0 -2
  276. package/dist/compiler/html/update-global-styles-link.d.ts +0 -2
  277. package/dist/compiler/html/used-components.d.ts +0 -2
  278. package/dist/compiler/html/utils.d.ts +0 -2
  279. package/dist/compiler/html/validate-manifest-json.d.ts +0 -2
  280. package/dist/compiler/index.d.ts +0 -10
  281. package/dist/compiler/index.js +0 -18008
  282. package/dist/compiler/output-targets/empty-dir.d.ts +0 -6
  283. package/dist/compiler/output-targets/index.d.ts +0 -2
  284. package/dist/compiler/output-targets/output-angular.d.ts +0 -4
  285. package/dist/compiler/output-targets/output-app.d.ts +0 -4
  286. package/dist/compiler/output-targets/output-collection.d.ts +0 -3
  287. package/dist/compiler/output-targets/output-copy.d.ts +0 -2
  288. package/dist/compiler/output-targets/output-custom.d.ts +0 -2
  289. package/dist/compiler/output-targets/output-docs.d.ts +0 -2
  290. package/dist/compiler/output-targets/output-hydrate.d.ts +0 -2
  291. package/dist/compiler/output-targets/output-lazy-loader.d.ts +0 -2
  292. package/dist/compiler/output-targets/output-module.d.ts +0 -4
  293. package/dist/compiler/output-targets/output-prerender.d.ts +0 -2
  294. package/dist/compiler/output-targets/output-service-workers.d.ts +0 -2
  295. package/dist/compiler/output-targets/output-types.d.ts +0 -2
  296. package/dist/compiler/output-targets/output-utils.d.ts +0 -54
  297. package/dist/compiler/output-targets/output-www.d.ts +0 -2
  298. package/dist/compiler/plugin/plugin.d.ts +0 -6
  299. package/dist/compiler/prerender/crawl-urls.d.ts +0 -3
  300. package/dist/compiler/prerender/host-config.d.ts +0 -12
  301. package/dist/compiler/prerender/prerender-config.d.ts +0 -2
  302. package/dist/compiler/prerender/prerender-main.d.ts +0 -2
  303. package/dist/compiler/prerender/prerender-queue.d.ts +0 -3
  304. package/dist/compiler/prerender/prerender-template-html.d.ts +0 -2
  305. package/dist/compiler/prerender/prerendered-write-path.d.ts +0 -2
  306. package/dist/compiler/prerender/robots-txt.d.ts +0 -2
  307. package/dist/compiler/prerender/sitemap-xml.d.ts +0 -3
  308. package/dist/compiler/rollup-plugins/component-entry.d.ts +0 -3
  309. package/dist/compiler/rollup-plugins/css-transformer.d.ts +0 -3
  310. package/dist/compiler/rollup-plugins/global-scripts.d.ts +0 -4
  311. package/dist/compiler/rollup-plugins/image-plugin.d.ts +0 -3
  312. package/dist/compiler/rollup-plugins/in-memory-fs-read.d.ts +0 -3
  313. package/dist/compiler/rollup-plugins/loader.d.ts +0 -4
  314. package/dist/compiler/rollup-plugins/plugin-helper.d.ts +0 -5
  315. package/dist/compiler/rollup-plugins/rindo-build-conditionals.d.ts +0 -7
  316. package/dist/compiler/rollup-plugins/rindo-client.d.ts +0 -3
  317. package/dist/compiler/rollup-plugins/rindo-external-runtime.d.ts +0 -2
  318. package/dist/compiler/rollup-plugins/rindo-hydrate.d.ts +0 -3
  319. package/dist/compiler/rollup-plugins/rindo-public-plugin.d.ts +0 -2
  320. package/dist/compiler/service-worker/generate-sw.d.ts +0 -7
  321. package/dist/compiler/service-worker/service-worker-util.d.ts +0 -2
  322. package/dist/compiler/style/cached-styles.d.ts +0 -5
  323. package/dist/compiler/style/component-styles.d.ts +0 -2
  324. package/dist/compiler/style/css-imports.d.ts +0 -9
  325. package/dist/compiler/style/css-to-esm.d.ts +0 -5
  326. package/dist/compiler/style/generate-styles.d.ts +0 -2
  327. package/dist/compiler/style/global-styles.d.ts +0 -3
  328. package/dist/compiler/style/normalize-styles.d.ts +0 -2
  329. package/dist/compiler/style/optimize-css.d.ts +0 -2
  330. package/dist/compiler/style/scope-css.d.ts +0 -3
  331. package/dist/compiler/style/style-utils.d.ts +0 -10
  332. package/dist/compiler/transformers/add-component-meta-proxy.d.ts +0 -3
  333. package/dist/compiler/transformers/add-component-meta-static.d.ts +0 -4
  334. package/dist/compiler/transformers/add-imports.d.ts +0 -3
  335. package/dist/compiler/transformers/collections/add-external-import.d.ts +0 -2
  336. package/dist/compiler/transformers/collections/parse-collection-components.d.ts +0 -2
  337. package/dist/compiler/transformers/collections/parse-collection-deprecated.d.ts +0 -2
  338. package/dist/compiler/transformers/collections/parse-collection-manifest.d.ts +0 -7
  339. package/dist/compiler/transformers/collections/parse-collection-module.d.ts +0 -2
  340. package/dist/compiler/transformers/component-build-conditionals.d.ts +0 -2
  341. package/dist/compiler/transformers/component-hydrate/hydrate-component.d.ts +0 -3
  342. package/dist/compiler/transformers/component-hydrate/hydrate-runtime-cmp-meta.d.ts +0 -3
  343. package/dist/compiler/transformers/component-hydrate/tranform-to-hydrate-component.d.ts +0 -2
  344. package/dist/compiler/transformers/component-lazy/lazy-component.d.ts +0 -3
  345. package/dist/compiler/transformers/component-lazy/lazy-constructor.d.ts +0 -3
  346. package/dist/compiler/transformers/component-lazy/lazy-element-getter.d.ts +0 -3
  347. package/dist/compiler/transformers/component-lazy/transform-lazy-component.d.ts +0 -4
  348. package/dist/compiler/transformers/component-native/native-component.d.ts +0 -3
  349. package/dist/compiler/transformers/component-native/native-connected-callback.d.ts +0 -3
  350. package/dist/compiler/transformers/component-native/native-constructor.d.ts +0 -3
  351. package/dist/compiler/transformers/component-native/native-element-getter.d.ts +0 -3
  352. package/dist/compiler/transformers/component-native/native-static-style.d.ts +0 -3
  353. package/dist/compiler/transformers/component-native/tranform-to-native-component.d.ts +0 -4
  354. package/dist/compiler/transformers/core-runtime-apis.d.ts +0 -30
  355. package/dist/compiler/transformers/create-event.d.ts +0 -3
  356. package/dist/compiler/transformers/decorators-to-static/component-decorator.d.ts +0 -3
  357. package/dist/compiler/transformers/decorators-to-static/convert-decorators.d.ts +0 -3
  358. package/dist/compiler/transformers/decorators-to-static/decorator-utils.d.ts +0 -10
  359. package/dist/compiler/transformers/decorators-to-static/element-decorator.d.ts +0 -3
  360. package/dist/compiler/transformers/decorators-to-static/event-decorator.d.ts +0 -4
  361. package/dist/compiler/transformers/decorators-to-static/listen-decorator.d.ts +0 -6
  362. package/dist/compiler/transformers/decorators-to-static/method-decorator.d.ts +0 -3
  363. package/dist/compiler/transformers/decorators-to-static/prop-decorator.d.ts +0 -4
  364. package/dist/compiler/transformers/decorators-to-static/state-decorator.d.ts +0 -3
  365. package/dist/compiler/transformers/decorators-to-static/style-to-static.d.ts +0 -3
  366. package/dist/compiler/transformers/decorators-to-static/watch-decorator.d.ts +0 -3
  367. package/dist/compiler/transformers/define-custom-element.d.ts +0 -3
  368. package/dist/compiler/transformers/host-data-transform.d.ts +0 -3
  369. package/dist/compiler/transformers/legacy-props.d.ts +0 -3
  370. package/dist/compiler/transformers/remove-static-meta-properties.d.ts +0 -2
  371. package/dist/compiler/transformers/reserved-public-members.d.ts +0 -3
  372. package/dist/compiler/transformers/rindo-import-path.d.ts +0 -3
  373. package/dist/compiler/transformers/static-to-meta/call-expression.d.ts +0 -3
  374. package/dist/compiler/transformers/static-to-meta/class-methods.d.ts +0 -3
  375. package/dist/compiler/transformers/static-to-meta/component.d.ts +0 -3
  376. package/dist/compiler/transformers/static-to-meta/element-ref.d.ts +0 -2
  377. package/dist/compiler/transformers/static-to-meta/encapsulation.d.ts +0 -3
  378. package/dist/compiler/transformers/static-to-meta/events.d.ts +0 -3
  379. package/dist/compiler/transformers/static-to-meta/import.d.ts +0 -3
  380. package/dist/compiler/transformers/static-to-meta/listeners.d.ts +0 -3
  381. package/dist/compiler/transformers/static-to-meta/methods.d.ts +0 -3
  382. package/dist/compiler/transformers/static-to-meta/props.d.ts +0 -3
  383. package/dist/compiler/transformers/static-to-meta/states.d.ts +0 -3
  384. package/dist/compiler/transformers/static-to-meta/string-literal.d.ts +0 -3
  385. package/dist/compiler/transformers/static-to-meta/styles.d.ts +0 -3
  386. package/dist/compiler/transformers/static-to-meta/vdom.d.ts +0 -3
  387. package/dist/compiler/transformers/static-to-meta/visitor.d.ts +0 -3
  388. package/dist/compiler/transformers/static-to-meta/watchers.d.ts +0 -3
  389. package/dist/compiler/transformers/style-imports.d.ts +0 -3
  390. package/dist/compiler/transformers/transform-utils.d.ts +0 -31
  391. package/dist/compiler/transformers/update-component-class.d.ts +0 -3
  392. package/dist/compiler/transformers/update-rindo-core-import.d.ts +0 -3
  393. package/dist/compiler/transformers/watcher-meta-transform.d.ts +0 -3
  394. package/dist/compiler/transpile/compiler-options.d.ts +0 -4
  395. package/dist/compiler/transpile/transpile-app.d.ts +0 -2
  396. package/dist/compiler/transpile/transpile-module.d.ts +0 -5
  397. package/dist/compiler/transpile/transpile-service.d.ts +0 -3
  398. package/dist/compiler/transpile/transpile-to-es5-main.d.ts +0 -2
  399. package/dist/compiler/transpile/validate-types-main.d.ts +0 -2
  400. package/dist/compiler/types/generate-app-types.d.ts +0 -2
  401. package/dist/compiler/types/generate-component-types.d.ts +0 -8
  402. package/dist/compiler/types/generate-event-types.d.ts +0 -2
  403. package/dist/compiler/types/generate-method-types.d.ts +0 -2
  404. package/dist/compiler/types/generate-prop-types.d.ts +0 -2
  405. package/dist/compiler/types/generate-types.d.ts +0 -2
  406. package/dist/compiler/types/rindo-types.d.ts +0 -3
  407. package/dist/compiler/types/types-utils.d.ts +0 -4
  408. package/dist/compiler/types/update-import-refs.d.ts +0 -11
  409. package/dist/compiler/types/validate-package-json.d.ts +0 -9
  410. package/dist/declarations/assets.d.ts +0 -17
  411. package/dist/declarations/browser-compile.d.ts +0 -47
  412. package/dist/declarations/build-conditionals.d.ts +0 -91
  413. package/dist/declarations/build-events.d.ts +0 -19
  414. package/dist/declarations/build.d.ts +0 -247
  415. package/dist/declarations/cache.d.ts +0 -11
  416. package/dist/declarations/collection-manifest.d.ts +0 -106
  417. package/dist/declarations/collection.d.ts +0 -139
  418. package/dist/declarations/compiler.d.ts +0 -53
  419. package/dist/declarations/component-compiler-meta.d.ts +0 -198
  420. package/dist/declarations/component-constructor.d.ts +0 -61
  421. package/dist/declarations/component-interfaces.d.ts +0 -123
  422. package/dist/declarations/config.d.ts +0 -409
  423. package/dist/declarations/css-var-shim.d.ts +0 -9
  424. package/dist/declarations/decorators.d.ts +0 -150
  425. package/dist/declarations/dev-server.d.ts +0 -135
  426. package/dist/declarations/diagnostics.d.ts +0 -21
  427. package/dist/declarations/entry.d.ts +0 -28
  428. package/dist/declarations/events.d.ts +0 -13
  429. package/dist/declarations/file-system.d.ts +0 -91
  430. package/dist/declarations/fs-watch.d.ts +0 -15
  431. package/dist/declarations/host-element.d.ts +0 -53
  432. package/dist/declarations/hydrate.d.ts +0 -99
  433. package/dist/declarations/in-memory-fs.d.ts +0 -59
  434. package/dist/declarations/index.d.ts +0 -45
  435. package/dist/declarations/jsdoc.d.ts +0 -16
  436. package/dist/declarations/jsx.d.ts +0 -1050
  437. package/dist/declarations/logger.d.ts +0 -25
  438. package/dist/declarations/minify-js.d.ts +0 -11
  439. package/dist/declarations/module.d.ts +0 -35
  440. package/dist/declarations/optimize-css.d.ts +0 -12
  441. package/dist/declarations/output-targets.d.ts +0 -189
  442. package/dist/declarations/plugin.d.ts +0 -23
  443. package/dist/declarations/prerender.d.ts +0 -79
  444. package/dist/declarations/render.d.ts +0 -62
  445. package/dist/declarations/runtime.d.ts +0 -92
  446. package/dist/declarations/screenshots.d.ts +0 -192
  447. package/dist/declarations/server.d.ts +0 -19
  448. package/dist/declarations/style.d.ts +0 -35
  449. package/dist/declarations/system.d.ts +0 -174
  450. package/dist/declarations/testing.d.ts +0 -523
  451. package/dist/declarations/transpile.d.ts +0 -24
  452. package/dist/declarations/types.d.ts +0 -24
  453. package/dist/declarations/vdom.d.ts +0 -55
  454. package/dist/declarations/worker.d.ts +0 -33
  455. package/dist/dev-server/content-type-db.json +0 -1
  456. package/dist/dev-server/index.js +0 -887
  457. package/dist/dev-server/static/app-error.css +0 -257
  458. package/dist/dev-server/static/dev-server-client.html +0 -13
  459. package/dist/dev-server/templates/initial-load.html +0 -160
  460. package/dist/hydrate/index.d.ts +0 -101
  461. package/dist/hydrate/index.mjs +0 -1281
  462. package/dist/hydrate/platform.mjs +0 -347
  463. package/dist/index.d.ts +0 -99
  464. package/dist/mock-doc/index.d.ts +0 -851
  465. package/dist/mock-doc/index.js +0 -3982
  466. package/dist/mock-doc/index.mjs +0 -3954
  467. package/dist/runtime/index.js +0 -2576
  468. package/dist/runtime/index.mjs +0 -2521
  469. package/dist/runtime/shadow-css-6ef31c68.js +0 -386
  470. package/dist/runtime/shadow-css-8fd1a9e4.js +0 -388
  471. package/dist/screenshot/index.js +0 -520
  472. package/dist/sys/node/graceful-fs.js +0 -975
  473. package/dist/sys/node/index.js +0 -33545
  474. package/dist/sys/node/node-fetch.js +0 -1779
  475. package/dist/sys/node/open-in-editor.js +0 -734
  476. package/dist/sys/node/sys-worker.js +0 -67035
  477. package/dist/sys/node/websocket.js +0 -3728
  478. package/dist/testing/build-conditionals.d.ts +0 -4
  479. package/dist/testing/build-conditionals.js +0 -43
  480. package/dist/testing/core.d.ts +0 -35
  481. package/dist/testing/core.js +0 -52
  482. package/dist/testing/index.js +0 -40511
  483. package/dist/testing/jest/jest-config.d.ts +0 -4
  484. package/dist/testing/mock-fetch.d.ts +0 -46
  485. package/dist/testing/mocks.d.ts +0 -12
  486. package/dist/testing/platform.d.ts +0 -23
  487. package/dist/testing/platform.js +0 -321
  488. package/dist/testing/puppeteer/puppeteer-emulate.d.ts +0 -2
  489. package/dist/testing/puppeteer/puppeteer-find.d.ts +0 -5
  490. package/dist/testing/puppeteer/puppeteer-page.d.ts +0 -2
  491. package/dist/testing/puppeteer/puppeteer-screenshot.d.ts +0 -4
  492. package/dist/testing/spec-page.d.ts +0 -5
  493. package/dist/testing/task-queue.d.ts +0 -15
  494. package/dist/testing/test-transpile.d.ts +0 -5
  495. package/dist/testing/testing-fs.d.ts +0 -31
  496. package/dist/testing/testing-sys.d.ts +0 -19
  497. package/dist/testing/testing.d.ts +0 -12
  498. package/dist/utils/index.js +0 -1575
  499. package/dist/utils/index.mjs +0 -1511
  500. package/internal/client/css-shim.rindo-client.mjs +0 -656
  501. package/internal/client/index.mjs +0 -2859
  502. package/internal/client/polyfills/promise.js +0 -9
  503. package/internal/images.d.ts +0 -5
  504. package/runtime/package.json +0 -5
  505. package/screenshot/compare/build/p-020f8d73.js +0 -1
  506. package/screenshot/compare/build/p-09qdknbg.system.entry.js +0 -1
  507. package/screenshot/compare/build/p-0a13mpsc.system.entry.js +0 -1
  508. package/screenshot/compare/build/p-168ec2c4.system.js +0 -1
  509. package/screenshot/compare/build/p-2ab1fdf1.system.js +0 -1
  510. package/screenshot/compare/build/p-2pxcsgrj.entry.js +0 -1
  511. package/screenshot/compare/build/p-42fb7034.system.js +0 -1
  512. package/screenshot/compare/build/p-54d9d7c2.system.js +0 -1
  513. package/screenshot/compare/build/p-67c1f911.js +0 -1
  514. package/screenshot/compare/build/p-68613371.system.js +0 -1
  515. package/screenshot/compare/build/p-7dvsjpu0.entry.js +0 -1
  516. package/screenshot/compare/build/p-aa67fb06.js +0 -1
  517. package/screenshot/compare/build/p-aeb3cec1.system.js +0 -1
  518. package/screenshot/compare/build/p-b6e44a24.js +0 -1
  519. package/screenshot/compare/build/p-c1c25b8a.js +0 -1
  520. package/screenshot/compare/build/p-c9bopbjy.system.entry.js +0 -1
  521. package/screenshot/compare/build/p-c9iqz1pp.system.entry.js +0 -1
  522. package/screenshot/compare/build/p-dizjz8rg.entry.js +0 -1
  523. package/screenshot/compare/build/p-dnta0rwp.system.entry.js +0 -1
  524. package/screenshot/compare/build/p-e9670d22.system.js +0 -1
  525. package/screenshot/compare/build/p-ei9jkpd0.system.entry.js +0 -1
  526. package/screenshot/compare/build/p-ejwcppol.entry.js +0 -1
  527. package/screenshot/compare/build/p-f6612d5d.system.js +0 -1
  528. package/screenshot/compare/build/p-foiivsfc.css +0 -1
  529. package/screenshot/compare/build/p-gpjjyogx.entry.js +0 -1
  530. package/screenshot/compare/build/p-howklem2.system.entry.js +0 -1
  531. package/screenshot/compare/build/p-knv9wvoc.entry.js +0 -1
  532. package/screenshot/compare/build/p-nsqsfhhy.entry.js +0 -1
  533. package/screenshot/compare/build/p-ojt278pp.entry.js +0 -1
  534. package/screenshot/compare/build/p-oywass99.entry.js +0 -1
  535. package/screenshot/compare/build/p-q3ujhub6.entry.js +0 -1
  536. package/screenshot/compare/build/p-qw4xnmxv.entry.js +0 -1
  537. package/screenshot/compare/build/p-t1wvevhc.system.entry.js +0 -1
  538. package/screenshot/compare/build/p-tnjarrex.system.entry.js +0 -1
  539. package/screenshot/compare/build/p-vhfpd6kk.system.entry.js +0 -1
  540. package/screenshot/compare/build/p-vk6rhemd.system.entry.js +0 -1
  541. package/screenshot/compare/build/p-w6bnm16k.entry.js +0 -1
  542. package/screenshot/compare/build/p-xje6d7zl.system.entry.js +0 -1
  543. package/screenshot/compare/build/p-y5jlrcha.system.entry.js +0 -1
  544. package/screenshot/compare/build/p-yh170wkt.entry.js +0 -1
  545. package/testing/jest.preprocessor.js +0 -7
@@ -1,15 +1,18 @@
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 i = 0;
8
5
  let useNativeShadowDom = false;
9
6
  let checkSlotFallbackVisibility = false;
10
7
  let checkSlotRelocate = false;
11
8
  let isSvgMode = false;
12
- let renderingElement = null;
9
+ let renderingRef = null;
10
+ let queueCongestion = 0;
11
+ let queuePending = false;
12
+ /*
13
+ Rindo Client Platform v0.0.0-dev.20221104122636 | MIT Licensed | https://rindojs.web.app
14
+ */
15
+ import { BUILD, NAMESPACE } from '@rindo/core/internal/app-data';
13
16
  const win = typeof window !== 'undefined' ? window : {};
14
17
  const CSS = BUILD.cssVarShim ? win.CSS : null;
15
18
  const doc = win.document || { head: {} };
@@ -18,297 +21,99 @@ const H = (win.HTMLElement || class {
18
21
  const plt = {
19
22
  $flags$: 0,
20
23
  $resourcesUrl$: '',
21
- jmp: (h) => h(),
22
- raf: (h) => requestAnimationFrame(h),
24
+ jmp: h => h(),
25
+ raf: h => requestAnimationFrame(h),
23
26
  ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
24
27
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
28
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
25
29
  };
26
- const supportsShadowDom = BUILD.shadowDomShim ? (BUILD.shadowDom) ? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)() : false : true;
30
+ const supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom ? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)() : true;
27
31
  const supportsListenerOptions = /*@__PURE__*/ (() => {
28
32
  let supportsListenerOptions = false;
29
33
  try {
30
34
  doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
31
- get() { supportsListenerOptions = true; }
35
+ get() {
36
+ supportsListenerOptions = true;
37
+ },
32
38
  }));
33
39
  }
34
40
  catch (e) { }
35
41
  return supportsListenerOptions;
36
42
  })();
37
43
  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) {
44
+ const supportsConstructibleStylesheets = BUILD.constructableCSS
45
+ ? /*@__PURE__*/ (() => {
128
46
  try {
129
- queue[i++](ts);
130
- }
131
- catch (e) {
132
- consoleError(e);
47
+ new CSSStyleSheet();
48
+ return true;
133
49
  }
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();
50
+ catch (e) { }
51
+ return false;
52
+ })()
53
+ : false;
54
+ const Context = {};
55
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
56
+ if (BUILD.hostListener && listeners) {
57
+ // this is called immediately within the element's constructor
58
+ // initialize our event listeners on the host element
59
+ // we do this now so that we can listen to events that may
60
+ // have fired even before the instance is ready
61
+ if (BUILD.hostListenerTargetParent) {
62
+ // this component may have event listeners that should be attached to the parent
63
+ if (attachParentListeners) {
64
+ // this is being ran from within the connectedCallback
65
+ // which is important so that we know the host element actually has a parent element
66
+ // filter out the listeners to only have the ones that ARE being attached to the parent
67
+ listeners = listeners.filter(([flags]) => flags & 16 /* TargetParent */);
201
68
  }
202
69
  else {
203
- // for better minification
204
- return 0;
205
- }
70
+ // this is being ran from within the component constructor
71
+ // everything BUT the parent element listeners should be attached at this time
72
+ // filter out the listeners that are NOT being attached to the parent
73
+ listeners = listeners.filter(([flags]) => !(flags & 16 /* TargetParent */));
74
+ }
75
+ }
76
+ listeners.map(([flags, name, method]) => {
77
+ const target = BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
78
+ const handler = hostListenerProxy(hostRef, method);
79
+ const opts = hostListenerOpts(flags);
80
+ plt.ael(target, name, handler, opts);
81
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
206
82
  });
207
83
  }
208
- return promiseResolve();
209
84
  };
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);
260
- 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()}`);
85
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
86
+ if (BUILD.lazyLoad) {
87
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
88
+ // instance is ready, let's call it's member method for this event
89
+ hostRef.$lazyInstance$[methodName](ev);
90
+ }
91
+ else {
92
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
93
+ }
266
94
  }
267
- 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
- };
95
+ else {
96
+ hostRef.$hostElement$[methodName](ev);
291
97
  }
292
98
  };
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
- };
99
+ const getHostListenerTarget = (elm, flags) => {
100
+ if (BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
101
+ return doc;
102
+ if (BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */)
103
+ return win;
104
+ if (BUILD.hostListenerTargetBody && flags & 32 /* TargetBody */)
105
+ return doc.body;
106
+ if (BUILD.hostListenerTargetParent && flags & 16 /* TargetParent */)
107
+ return elm.parentElement;
108
+ return elm;
311
109
  };
110
+ // prettier-ignore
111
+ const hostListenerOpts = (flags) => supportsListenerOptions
112
+ ? ({
113
+ passive: (flags & 1 /* Passive */) !== 0,
114
+ capture: (flags & 2 /* Capture */) !== 0,
115
+ })
116
+ : (flags & 2 /* Capture */) !== 0;
312
117
  const CONTENT_REF_ID = 'r';
313
118
  const ORG_LOCATION_ID = 'o';
314
119
  const SLOT_NODE_ID = 's';
@@ -319,7 +124,7 @@ const HYDRATE_CHILD_ID = 'c-id';
319
124
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
320
125
  const XLINK_NS = 'http://www.w3.org/1999/xlink';
321
126
  const createTime = (fnName, tagName = '') => {
322
- if (BUILD.profile) {
127
+ if (BUILD.profile && performance.mark) {
323
128
  const key = `st:${fnName}:${tagName}:${i++}`;
324
129
  // Start
325
130
  performance.mark(key);
@@ -327,11 +132,13 @@ const createTime = (fnName, tagName = '') => {
327
132
  return () => performance.measure(`[Rindo] ${fnName}() <${tagName}>`, key);
328
133
  }
329
134
  else {
330
- return () => { return; };
135
+ return () => {
136
+ return;
137
+ };
331
138
  }
332
139
  };
333
140
  const uniqueTime = (key, measureText) => {
334
- if (BUILD.profile) {
141
+ if (BUILD.profile && performance.mark) {
335
142
  if (performance.getEntriesByName(key).length === 0) {
336
143
  performance.mark(key);
337
144
  }
@@ -342,7 +149,9 @@ const uniqueTime = (key, measureText) => {
342
149
  };
343
150
  }
344
151
  else {
345
- return () => { return; };
152
+ return () => {
153
+ return;
154
+ };
346
155
  }
347
156
  };
348
157
  const inspect = (ref) => {
@@ -389,7 +198,7 @@ const inspect = (ref) => {
389
198
  };
390
199
  const installDevTools = () => {
391
200
  if (BUILD.devTools) {
392
- const rindo = win.rindo = win.rindo || {};
201
+ const rindo = (win.rindo = win.rindo || {});
393
202
  const originalInspect = rindo.inspect;
394
203
  rindo.inspect = (ref) => {
395
204
  let result = inspect(ref);
@@ -413,22 +222,21 @@ const registerStyle = (scopeId, cssText, allowCS) => {
413
222
  styles.set(scopeId, style);
414
223
  };
415
224
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
416
- let scopeId = BUILD.mode ? getScopeId(cmpMeta.$tagName$, mode) : getScopeId(cmpMeta.$tagName$);
225
+ let scopeId = getScopeId(cmpMeta, mode);
417
226
  let style = styles.get(scopeId);
227
+ if (!BUILD.attachStyles) {
228
+ return scopeId;
229
+ }
418
230
  // if an element is NOT connected then getRootNode() will return the wrong root node
419
231
  // 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
- }
232
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
425
233
  if (style) {
426
234
  if (typeof style === 'string') {
427
235
  styleContainerNode = styleContainerNode.head || styleContainerNode;
428
236
  let appliedStyles = rootAppliedStyles.get(styleContainerNode);
429
237
  let styleElm;
430
238
  if (!appliedStyles) {
431
- rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
239
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
432
240
  }
433
241
  if (!appliedStyles.has(scopeId)) {
434
242
  if (BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
@@ -467,12 +275,13 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
467
275
  }
468
276
  return scopeId;
469
277
  };
470
- const attachStyles = (elm, cmpMeta, mode) => {
278
+ const attachStyles = (hostRef) => {
279
+ const cmpMeta = hostRef.$cmpMeta$;
280
+ const elm = hostRef.$hostElement$;
281
+ const flags = cmpMeta.$flags$;
471
282
  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 */) {
283
+ const scopeId = addStyle(BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
284
+ if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
476
285
  // only required when we're NOT using native shadow dom (slot)
477
286
  // or this browser doesn't support native shadow dom
478
287
  // and this host element was NOT created with SSR
@@ -482,14 +291,40 @@ const attachStyles = (elm, cmpMeta, mode) => {
482
291
  // DOM WRITE!!
483
292
  elm['s-sc'] = scopeId;
484
293
  elm.classList.add(scopeId + '-h');
485
- if (BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
294
+ if (BUILD.scoped && flags & 2 /* scopedCssEncapsulation */) {
486
295
  elm.classList.add(scopeId + '-s');
487
296
  }
488
297
  }
489
298
  endAttachStyles();
490
299
  };
491
- const getScopeId = (tagName, mode) => 'sc-' + ((BUILD.mode && mode) ? tagName + '-' + mode : tagName);
300
+ const getScopeId = (cmp, mode) => 'sc-' + (BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + '-' + mode : cmp.$tagName$);
492
301
  const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
302
+ // Private
303
+ const computeMode = (elm) => modeResolutionChain.map(h => h(elm)).find(m => !!m);
304
+ // Public
305
+ const setMode = (handler) => modeResolutionChain.push(handler);
306
+ const getMode = (ref) => getHostRef(ref).$modeName$;
307
+ /**
308
+ * Default style mode id
309
+ */
310
+ /**
311
+ * Reusable empty obj/array
312
+ * Don't add values to these!!
313
+ */
314
+ const EMPTY_OBJ = {};
315
+ /**
316
+ * Namespaces
317
+ */
318
+ const SVG_NS = 'http://www.w3.org/2000/svg';
319
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
320
+ const getCurrentDirectory = process.cwd;
321
+ const exit = process.exit;
322
+ const isDef = (v) => v != null;
323
+ const isComplexType = (o) => {
324
+ // https://jsperf.com/typeof-fn-object/5
325
+ o = typeof o;
326
+ return o === 'object' || o === 'function';
327
+ };
493
328
  /**
494
329
  * Production h() function based on Preact by
495
330
  * Jason Miller (@developit)
@@ -515,10 +350,10 @@ const h = (nodeName, vnodeData, ...children) => {
515
350
  walk(child);
516
351
  }
517
352
  else if (child != null && typeof child !== 'boolean') {
518
- if (simple = typeof nodeName !== 'function' && !isComplexType(child)) {
353
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
519
354
  child = String(child);
520
355
  }
521
- else if (BUILD.isDev && child.$flags$ === undefined) {
356
+ else if (BUILD.isDev && typeof nodeName !== 'function' && child.$flags$ === undefined) {
522
357
  consoleDevError(`vNode passed as children has unexpected type.
523
358
  Make sure it's using the correct h() function.
524
359
  Empty objects can also be the cause, look for JSX comments that became objects.`);
@@ -550,11 +385,12 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
550
385
  if (BUILD.vdomClass) {
551
386
  const classData = vnodeData.className || vnodeData.class;
552
387
  if (classData) {
553
- vnodeData.class = typeof classData !== 'object'
554
- ? classData
555
- : Object.keys(classData)
556
- .filter(k => classData[k])
557
- .join(' ');
388
+ vnodeData.class =
389
+ typeof classData !== 'object'
390
+ ? classData
391
+ : Object.keys(classData)
392
+ .filter(k => classData[k])
393
+ .join(' ');
558
394
  }
559
395
  }
560
396
  }
@@ -565,7 +401,7 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
565
401
  }
566
402
  if (BUILD.vdomFunctional && typeof nodeName === 'function') {
567
403
  // nodeName is a functional component
568
- return nodeName(vnodeData, vNodeChildren, vdomFnUtils);
404
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
569
405
  }
570
406
  const vnode = newVNode(nodeName, null);
571
407
  vnode.$attrs$ = vnodeData;
@@ -586,7 +422,7 @@ const newVNode = (tag, text) => {
586
422
  $tag$: tag,
587
423
  $text$: text,
588
424
  $elm$: null,
589
- $children$: null
425
+ $children$: null,
590
426
  };
591
427
  if (BUILD.vdomAttribute) {
592
428
  vnode.$attrs$ = null;
@@ -602,20 +438,31 @@ const newVNode = (tag, text) => {
602
438
  const Host = {};
603
439
  const isHost = (node) => node && node.$tag$ === Host;
604
440
  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
- };
441
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
442
+ map: (children, cb) => children
443
+ .map(convertToPublic)
444
+ .map(cb)
445
+ .map(convertToPrivate),
446
+ };
447
+ const convertToPublic = (node) => ({
448
+ vattrs: node.$attrs$,
449
+ vchildren: node.$children$,
450
+ vkey: node.$key$,
451
+ vname: node.$name$,
452
+ vtag: node.$tag$,
453
+ vtext: node.$text$,
454
+ });
618
455
  const convertToPrivate = (node) => {
456
+ if (typeof node.vtag === 'function') {
457
+ const vnodeData = Object.assign({}, node.vattrs);
458
+ if (node.vkey) {
459
+ vnodeData.key = node.vkey;
460
+ }
461
+ if (node.vname) {
462
+ vnodeData.name = node.vname;
463
+ }
464
+ return h(node.vtag, vnodeData, ...node.vchildren || []);
465
+ }
619
466
  const vnode = newVNode(node.vtag, node.vtext);
620
467
  vnode.$attrs$ = node.vattrs;
621
468
  vnode.$children$ = node.vchildren;
@@ -630,6 +477,9 @@ const validateInputProperties = (vnodeData) => {
630
477
  const maxIndex = props.indexOf('max');
631
478
  const stepIndex = props.indexOf('min');
632
479
  const value = props.indexOf('value');
480
+ if (value === -1) {
481
+ return;
482
+ }
633
483
  if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
634
484
  consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
635
485
  }
@@ -686,11 +536,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
686
536
  newValue(elm);
687
537
  }
688
538
  }
689
- else if (BUILD.vdomListener &&
690
- (BUILD.lazyLoad
691
- ? !isProp
692
- : !elm.__lookupSetter__(memberName)) &&
693
- memberName[0] === 'o' && memberName[1] === 'n') {
539
+ else if (BUILD.vdomListener && (BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === 'o' && memberName[1] === 'n') {
694
540
  // Event Handlers
695
541
  // so if the member name starts with "on" and the 3rd characters is
696
542
  // a capital letter, and it's not already a member on the element,
@@ -764,14 +610,16 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
764
610
  }
765
611
  }
766
612
  if (newValue == null || newValue === false) {
767
- if (BUILD.vdomXlink && xlink) {
768
- elm.removeAttributeNS(XLINK_NS, memberName);
769
- }
770
- else {
771
- elm.removeAttribute(memberName);
613
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
614
+ if (BUILD.vdomXlink && xlink) {
615
+ elm.removeAttributeNS(XLINK_NS, memberName);
616
+ }
617
+ else {
618
+ elm.removeAttribute(memberName);
619
+ }
772
620
  }
773
621
  }
774
- else if ((!isProp || (flags & 4 /* isHost */) || isSvg) && !isComplex) {
622
+ else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
775
623
  newValue = newValue === true ? '' : newValue;
776
624
  if (BUILD.vdomXlink && xlink) {
777
625
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -784,12 +632,12 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
784
632
  }
785
633
  };
786
634
  const parseClassListRegex = /\s/;
787
- const parseClassList = (value) => (!value) ? [] : value.split(parseClassListRegex);
635
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
788
636
  const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
789
637
  // if the element passed in is a shadow root, which is a document fragment
790
638
  // then we want to be adding attrs/props to the shadow root's "host" element
791
639
  // 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$;
640
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
793
641
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
794
642
  const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
795
643
  if (BUILD.updatable) {
@@ -820,14 +668,11 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
820
668
  // scoped css needs to add its scoped id to the parent element
821
669
  parentElm.classList.add(scopeId + '-s');
822
670
  }
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 */;
671
+ newVNode.$flags$ |= newVNode.$children$
672
+ ? // slot element has fallback content
673
+ 2 /* isSlotFallback */
674
+ : // slot element does not have fallback content
675
+ 1 /* isSlotReference */;
831
676
  }
832
677
  }
833
678
  if (BUILD.isDev && newVNode.$elm$) {
@@ -839,16 +684,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
839
684
  }
840
685
  else if (BUILD.slotRelocation && newVNode.$flags$ & 1 /* isSlotReference */) {
841
686
  // create a slot reference node
842
- elm = newVNode.$elm$ = (BUILD.isDebug || BUILD.hydrateServerSide) ? slotReferenceDebugNode(newVNode) : doc.createTextNode('');
687
+ elm = newVNode.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : doc.createTextNode('');
843
688
  }
844
689
  else {
845
690
  if (BUILD.svg && !isSvgMode) {
846
691
  isSvgMode = newVNode.$tag$ === 'svg';
847
692
  }
848
693
  // 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$));
694
+ elm = newVNode.$elm$ = (BUILD.svg
695
+ ? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */ ? 'slot-fb' : newVNode.$tag$)
696
+ : doc.createElement(BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */ ? 'slot-fb' : newVNode.$tag$));
852
697
  if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
853
698
  isSvgMode = false;
854
699
  }
@@ -945,7 +790,7 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
945
790
  };
946
791
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
947
792
  for (; startIdx <= endIdx; ++startIdx) {
948
- if (vnode = vnodes[startIdx]) {
793
+ if ((vnode = vnodes[startIdx])) {
949
794
  elm = vnode.$elm$;
950
795
  callNodeRefs(vnode);
951
796
  if (BUILD.slotRelocation) {
@@ -1063,7 +908,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
1063
908
  }
1064
909
  }
1065
910
  if (oldStartIdx > oldEndIdx) {
1066
- addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
911
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
1067
912
  }
1068
913
  else if (BUILD.updatable && newStartIdx > newEndIdx) {
1069
914
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
@@ -1092,7 +937,7 @@ const referenceNode = (node) => {
1092
937
  };
1093
938
  const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1094
939
  const patch = (oldVNode, newVNode) => {
1095
- const elm = newVNode.$elm$ = oldVNode.$elm$;
940
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
1096
941
  const oldChildren = oldVNode.$children$;
1097
942
  const newChildren = newVNode.$children$;
1098
943
  const tag = newVNode.$tag$;
@@ -1102,11 +947,7 @@ const patch = (oldVNode, newVNode) => {
1102
947
  if (BUILD.svg) {
1103
948
  // test if we're rendering an svg element, or still rendering nodes inside of one
1104
949
  // 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;
950
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1110
951
  }
1111
952
  // element node
1112
953
  if (BUILD.vdomAttribute || BUILD.reflect) {
@@ -1243,10 +1084,10 @@ const relocateSlotContent = (elm) => {
1243
1084
  });
1244
1085
  }
1245
1086
  if (node['s-sr']) {
1246
- relocateNodes.forEach(relocateNode => {
1087
+ relocateNodes.map(relocateNode => {
1247
1088
  if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1248
1089
  relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
1249
- if (relocateNodeData) {
1090
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1250
1091
  relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1251
1092
  }
1252
1093
  }
@@ -1286,10 +1127,14 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1286
1127
  const callNodeRefs = (vNode) => {
1287
1128
  if (BUILD.vdomRef) {
1288
1129
  vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1289
- vNode.$children$ && vNode.$children$.forEach(callNodeRefs);
1130
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
1290
1131
  }
1291
1132
  };
1292
- const renderVdom = (hostElm, hostRef, cmpMeta, renderFnResults) => {
1133
+ const renderVdom = (hostRef, renderFnResults) => {
1134
+ const hostElm = hostRef.$hostElement$;
1135
+ const cmpMeta = hostRef.$cmpMeta$;
1136
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1137
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1293
1138
  hostTagName = hostElm.tagName;
1294
1139
  // <Host> runtime check
1295
1140
  if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
@@ -1304,15 +1149,11 @@ render() {
1304
1149
  <Host>{content}</Host>
1305
1150
  );
1306
1151
  }
1307
- `);
1152
+ `);
1308
1153
  }
1309
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1310
- const rootVnode = isHost(renderFnResults)
1311
- ? renderFnResults
1312
- : h(null, null, renderFnResults);
1313
1154
  if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
1314
1155
  rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1315
- cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]);
1156
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1316
1157
  }
1317
1158
  rootVnode.$tag$ = null;
1318
1159
  rootVnode.$flags$ |= 4 /* isHost */;
@@ -1323,13 +1164,16 @@ render() {
1323
1164
  }
1324
1165
  if (BUILD.slotRelocation) {
1325
1166
  contentRef = hostElm['s-cr'];
1326
- useNativeShadowDom = supportsShadowDom && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1167
+ useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1327
1168
  // always reset
1328
1169
  checkSlotFallbackVisibility = false;
1329
1170
  }
1330
1171
  // synchronous patch
1331
1172
  patch(oldVNode, rootVnode);
1332
1173
  if (BUILD.slotRelocation) {
1174
+ // while we're moving nodes around existing nodes, temporarily disable
1175
+ // the disconnectCallback from working
1176
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1333
1177
  if (checkSlotRelocate) {
1334
1178
  relocateSlotContent(rootVnode.$elm$);
1335
1179
  let relocateData;
@@ -1345,16 +1189,11 @@ render() {
1345
1189
  if (!nodeToRelocate['s-ol']) {
1346
1190
  // add a reference node marking this node's original location
1347
1191
  // keep a reference to this node for later lookups
1348
- orgLocationNode = (BUILD.isDebug || BUILD.hydrateServerSide)
1349
- ? originalLocationDebugNode(nodeToRelocate)
1350
- : doc.createTextNode('');
1192
+ orgLocationNode = BUILD.isDebug || BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode('');
1351
1193
  orgLocationNode['s-nr'] = nodeToRelocate;
1352
1194
  nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1353
1195
  }
1354
1196
  }
1355
- // while we're moving nodes around existing nodes, temporarily disable
1356
- // the disconnectCallback from working
1357
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1358
1197
  for (i = 0; i < relocateNodes.length; i++) {
1359
1198
  relocateData = relocateNodes[i];
1360
1199
  nodeToRelocate = relocateData.$nodeToRelocate$;
@@ -1364,11 +1203,9 @@ render() {
1364
1203
  parentNodeRef = relocateData.$slotRefNode$.parentNode;
1365
1204
  insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1366
1205
  orgLocationNode = nodeToRelocate['s-ol'];
1367
- while (orgLocationNode = orgLocationNode.previousSibling) {
1206
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
1368
1207
  refNode = orgLocationNode['s-nr'];
1369
- if (refNode &&
1370
- refNode['s-sn'] === nodeToRelocate['s-sn'] &&
1371
- parentNodeRef === refNode.parentNode) {
1208
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1372
1209
  refNode = refNode.nextSibling;
1373
1210
  if (!refNode || !refNode['s-nr']) {
1374
1211
  insertBeforeNode = refNode;
@@ -1376,8 +1213,7 @@ render() {
1376
1213
  }
1377
1214
  }
1378
1215
  }
1379
- if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1380
- (nodeToRelocate.nextSibling !== insertBeforeNode)) {
1216
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) || nodeToRelocate.nextSibling !== insertBeforeNode) {
1381
1217
  // we've checked that it's worth while to relocate
1382
1218
  // since that the node to relocate
1383
1219
  // has a different next sibling or parent relocated
@@ -1398,32 +1234,49 @@ render() {
1398
1234
  }
1399
1235
  }
1400
1236
  }
1401
- // done moving nodes around
1402
- // allow the disconnect callback to work again
1403
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1404
1237
  }
1405
1238
  if (checkSlotFallbackVisibility) {
1406
1239
  updateFallbackSlotVisibility(rootVnode.$elm$);
1407
1240
  }
1241
+ // done moving nodes around
1242
+ // allow the disconnect callback to work again
1243
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
1408
1244
  // always reset
1409
1245
  relocateNodes.length = 0;
1410
1246
  }
1411
1247
  };
1412
1248
  // slot comment debug nodes only created with the `--debug` flag
1413
1249
  // 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()})`);
1417
- const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` +
1418
- (nodeToRelocate.localName ?
1419
- `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})` :
1420
- `[${nodeToRelocate.textContent}]`));
1250
+ const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ''}> (host=${hostTagName.toLowerCase()})`);
1251
+ const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})` : `[${nodeToRelocate.textContent}]`));
1252
+ const getElement = (ref) => (BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref);
1253
+ const createEvent = (ref, name, flags) => {
1254
+ const elm = getElement(ref);
1255
+ return {
1256
+ emit: (detail) => {
1257
+ if (BUILD.isDev && !elm.isConnected) {
1258
+ consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
1259
+ }
1260
+ return emitEvent(elm, name, {
1261
+ bubbles: !!(flags & 4 /* Bubbles */),
1262
+ composed: !!(flags & 2 /* Composed */),
1263
+ cancelable: !!(flags & 1 /* Cancellable */),
1264
+ detail,
1265
+ });
1266
+ },
1267
+ };
1268
+ };
1269
+ const emitEvent = (elm, name, opts) => {
1270
+ const ev = plt.ce(name, opts);
1271
+ elm.dispatchEvent(ev);
1272
+ return ev;
1273
+ };
1421
1274
  const attachToAncestor = (hostRef, ancestorComponent) => {
1422
- if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$) {
1423
- ancestorComponent['s-p'].push(new Promise(r => hostRef.$onRenderResolve$ = r));
1275
+ if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1276
+ ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
1424
1277
  }
1425
1278
  };
1426
- const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
1279
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
1427
1280
  if (BUILD.taskQueue && BUILD.updatable) {
1428
1281
  hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1429
1282
  }
@@ -1431,17 +1284,23 @@ const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
1431
1284
  hostRef.$flags$ |= 512 /* needsRerender */;
1432
1285
  return;
1433
1286
  }
1434
- const endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
1435
- const ancestorComponent = hostRef.$ancestorComponent$;
1287
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1288
+ // there is no ancestorc omponent or the ancestor component
1289
+ // has already fired off its lifecycle update then
1290
+ // fire off the initial update
1291
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1292
+ return BUILD.taskQueue ? writeTask(dispatch) : dispatch;
1293
+ };
1294
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1295
+ const elm = hostRef.$hostElement$;
1296
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1436
1297
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1437
- const update = () => updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad);
1438
- attachToAncestor(hostRef, ancestorComponent);
1439
1298
  let promise;
1440
1299
  if (isInitialLoad) {
1441
1300
  if (BUILD.lazyLoad && BUILD.hostListener) {
1442
1301
  hostRef.$flags$ |= 256 /* isListenReady */;
1443
1302
  if (hostRef.$queuedListeners$) {
1444
- hostRef.$queuedListeners$.forEach(([methodName, event]) => safeCall(instance, methodName, event));
1303
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1445
1304
  hostRef.$queuedListeners$ = null;
1446
1305
  }
1447
1306
  }
@@ -1461,22 +1320,18 @@ const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
1461
1320
  promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1462
1321
  }
1463
1322
  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);
1323
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1470
1324
  };
1471
- const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
1325
+ const updateComponent = (hostRef, instance, isInitialLoad) => {
1472
1326
  // updateComponent
1473
- const endUpdate = createTime('update', cmpMeta.$tagName$);
1327
+ const elm = hostRef.$hostElement$;
1328
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1474
1329
  const rc = elm['s-rc'];
1475
1330
  if (BUILD.style && isInitialLoad) {
1476
1331
  // DOM WRITE!
1477
- attachStyles(elm, cmpMeta, hostRef.$modeName$);
1332
+ attachStyles(hostRef);
1478
1333
  }
1479
- const endRender = createTime('render', cmpMeta.$tagName$);
1334
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1480
1335
  if (BUILD.isDev) {
1481
1336
  hostRef.$flags$ |= 1024 /* devOnRender */;
1482
1337
  }
@@ -1485,10 +1340,10 @@ const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
1485
1340
  // looks like we've got child nodes to render into this host element
1486
1341
  // or we need to update the css class/attrs on the host element
1487
1342
  // DOM WRITE!
1488
- renderVdom(elm, hostRef, cmpMeta, callRender(instance, elm));
1343
+ renderVdom(hostRef, callRender(hostRef, instance));
1489
1344
  }
1490
1345
  else {
1491
- elm.textContent = callRender(instance, elm);
1346
+ elm.textContent = callRender(hostRef, instance);
1492
1347
  }
1493
1348
  }
1494
1349
  if (BUILD.cssVarShim && plt.$cssShim$) {
@@ -1498,19 +1353,16 @@ const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
1498
1353
  hostRef.$renderCount$++;
1499
1354
  hostRef.$flags$ &= ~1024 /* devOnRender */;
1500
1355
  }
1501
- if (BUILD.updatable && BUILD.taskQueue) {
1502
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1503
- }
1504
1356
  if (BUILD.hydrateServerSide) {
1505
1357
  try {
1506
1358
  // manually connected child components during server-side hydrate
1507
1359
  serverSideConnected(elm);
1508
1360
  if (isInitialLoad) {
1509
1361
  // using only during server-side hydrate
1510
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1362
+ if (hostRef.$cmpMeta$.$flags$ & 1 /* shadowDomEncapsulation */) {
1511
1363
  elm['s-en'] = '';
1512
1364
  }
1513
- else if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1365
+ else if (hostRef.$cmpMeta$.$flags$ & 2 /* scopedCssEncapsulation */) {
1514
1366
  elm['s-en'] = 'c';
1515
1367
  }
1516
1368
  }
@@ -1519,21 +1371,18 @@ const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
1519
1371
  consoleError(e);
1520
1372
  }
1521
1373
  }
1522
- if (BUILD.updatable || BUILD.lazyLoad) {
1523
- hostRef.$flags$ |= 2 /* hasRendered */;
1524
- }
1525
1374
  if (BUILD.asyncLoading && rc) {
1526
1375
  // ok, so turns out there are some child host elements
1527
1376
  // waiting on this parent element to load
1528
1377
  // let's fire off all update callbacks waiting
1529
- rc.forEach(cb => cb());
1378
+ rc.map(cb => cb());
1530
1379
  elm['s-rc'] = undefined;
1531
1380
  }
1532
1381
  endRender();
1533
1382
  endUpdate();
1534
1383
  if (BUILD.asyncLoading) {
1535
1384
  const childrenPromises = elm['s-p'];
1536
- const postUpdate = () => postUpdateComponent(elm, hostRef, cmpMeta);
1385
+ const postUpdate = () => postUpdateComponent(hostRef);
1537
1386
  if (childrenPromises.length === 0) {
1538
1387
  postUpdate();
1539
1388
  }
@@ -1544,23 +1393,38 @@ const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
1544
1393
  }
1545
1394
  }
1546
1395
  else {
1547
- postUpdateComponent(elm, hostRef, cmpMeta);
1396
+ postUpdateComponent(hostRef);
1548
1397
  }
1549
1398
  };
1550
- const callRender = (instance, elm) => {
1399
+ const callRender = (hostRef, instance) => {
1400
+ // in order for bundlers to correctly treeshake the BUILD object
1401
+ // we need to ensure BUILD is not deoptimized within a try/catch
1402
+ // https://rollupjs.org/guide/en/#treeshake tryCatchDeoptimization
1403
+ const allRenderFn = BUILD.allRenderFn ? true : false;
1404
+ const lazyLoad = BUILD.lazyLoad ? true : false;
1405
+ const taskQueue = BUILD.taskQueue ? true : false;
1406
+ const updatable = BUILD.updatable ? true : false;
1551
1407
  try {
1552
- renderingElement = elm;
1553
- instance = (BUILD.allRenderFn) ? instance.render() : (instance.render && instance.render());
1408
+ renderingRef = instance;
1409
+ instance = allRenderFn ? instance.render() : instance.render && instance.render();
1410
+ if (updatable && taskQueue) {
1411
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1412
+ }
1413
+ if (updatable || lazyLoad) {
1414
+ hostRef.$flags$ |= 2 /* hasRendered */;
1415
+ }
1554
1416
  }
1555
1417
  catch (e) {
1556
1418
  consoleError(e);
1557
1419
  }
1558
- renderingElement = null;
1420
+ renderingRef = null;
1559
1421
  return instance;
1560
1422
  };
1561
- const getRenderingElement = () => renderingElement;
1562
- const postUpdateComponent = (elm, hostRef, cmpMeta) => {
1563
- const endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
1423
+ const getRenderingRef = () => renderingRef;
1424
+ const postUpdateComponent = (hostRef) => {
1425
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1426
+ const elm = hostRef.$hostElement$;
1427
+ const endPostUpdate = createTime('postUpdate', tagName);
1564
1428
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1565
1429
  const ancestorComponent = hostRef.$ancestorComponent$;
1566
1430
  if (BUILD.cmpDidRender) {
@@ -1593,7 +1457,7 @@ const postUpdateComponent = (elm, hostRef, cmpMeta) => {
1593
1457
  if (BUILD.asyncLoading) {
1594
1458
  hostRef.$onReadyResolve$(elm);
1595
1459
  if (!ancestorComponent) {
1596
- appDidLoad(cmpMeta.$tagName$);
1460
+ appDidLoad(tagName);
1597
1461
  }
1598
1462
  }
1599
1463
  }
@@ -1628,7 +1492,7 @@ const postUpdateComponent = (elm, hostRef, cmpMeta) => {
1628
1492
  hostRef.$onRenderResolve$ = undefined;
1629
1493
  }
1630
1494
  if (hostRef.$flags$ & 512 /* needsRerender */) {
1631
- nextTick(() => scheduleUpdate(elm, hostRef, cmpMeta, false));
1495
+ nextTick(() => scheduleUpdate(hostRef, false));
1632
1496
  }
1633
1497
  hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1634
1498
  }
@@ -1636,12 +1500,12 @@ const postUpdateComponent = (elm, hostRef, cmpMeta) => {
1636
1500
  // ( •_•)>⌐■-■
1637
1501
  // (⌐■_■)
1638
1502
  };
1639
- const forceUpdate = (elm, cmpMeta) => {
1503
+ const forceUpdate = (ref) => {
1640
1504
  if (BUILD.updatable) {
1641
- const hostRef = getHostRef(elm);
1505
+ const hostRef = getHostRef(ref);
1642
1506
  const isConnected = hostRef.$hostElement$.isConnected;
1643
1507
  if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1644
- scheduleUpdate(elm, hostRef, cmpMeta, false);
1508
+ scheduleUpdate(hostRef, false);
1645
1509
  }
1646
1510
  // Returns "true" when the forced update was successfully scheduled
1647
1511
  return isConnected;
@@ -1654,11 +1518,11 @@ const appDidLoad = (who) => {
1654
1518
  if (BUILD.cssAnnotations) {
1655
1519
  addHydratedFlag(doc.documentElement);
1656
1520
  }
1657
- if (!BUILD.hydrateServerSide) {
1521
+ if (BUILD.asyncQueue) {
1658
1522
  plt.$flags$ |= 2 /* appLoaded */;
1659
1523
  }
1660
- emitLifecycleEvent(doc, 'appload');
1661
- if (BUILD.profile) {
1524
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1525
+ if (BUILD.profile && performance.measure) {
1662
1526
  performance.measure(`[Rindo] ${NAMESPACE} initial load (by ${who})`, 'st:app:start');
1663
1527
  }
1664
1528
  };
@@ -1678,14 +1542,16 @@ const then = (promise, thenFn) => {
1678
1542
  };
1679
1543
  const emitLifecycleEvent = (elm, lifecycleName) => {
1680
1544
  if (BUILD.lifecycleDOMEvents) {
1681
- elm.dispatchEvent(new CustomEvent('rindo_' + lifecycleName, { 'bubbles': true, 'composed': true }));
1545
+ emitEvent(elm, 'rindo_' + lifecycleName, {
1546
+ bubbles: true,
1547
+ composed: true,
1548
+ detail: {
1549
+ namespace: NAMESPACE,
1550
+ },
1551
+ });
1682
1552
  }
1683
1553
  };
1684
- const addHydratedFlag = (elm) => BUILD.hydratedClass ?
1685
- elm.classList.add('hydrated') :
1686
- BUILD.hydratedAttribute ?
1687
- elm.setAttribute('hydrated', '') :
1688
- undefined;
1554
+ const addHydratedFlag = (elm) => (BUILD.hydratedClass ? elm.classList.add('hydrated') : BUILD.hydratedAttribute ? elm.setAttribute('hydrated', '') : undefined);
1689
1555
  const serverSideConnected = (elm) => {
1690
1556
  const children = elm.children;
1691
1557
  if (children != null) {
@@ -1698,135 +1564,24 @@ const serverSideConnected = (elm) => {
1698
1564
  }
1699
1565
  }
1700
1566
  };
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
1567
  const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1813
1568
  const endHydrate = createTime('hydrateClient', tagName);
1814
1569
  const shadowRoot = hostElm.shadowRoot;
1815
1570
  const childRenderNodes = [];
1816
1571
  const slotNodes = [];
1817
- const shadowRootNodes = (BUILD.shadowDom && shadowRoot ? [] : null);
1818
- const vnode = hostRef.$vnode$ = newVNode(tagName, null);
1572
+ const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
1573
+ const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
1819
1574
  if (!plt.$orgLocNodes$) {
1820
- initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = new Map());
1575
+ initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
1821
1576
  }
1822
1577
  hostElm[HYDRATE_ID] = hostId;
1823
1578
  hostElm.removeAttribute(HYDRATE_ID);
1824
1579
  clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
1825
- childRenderNodes.forEach(c => {
1580
+ childRenderNodes.map(c => {
1826
1581
  const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
1827
1582
  const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1828
1583
  const node = c.$elm$;
1829
- if (orgLocationNode && (supportsShadowDom && orgLocationNode['s-en'] === '')) {
1584
+ if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
1830
1585
  orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1831
1586
  }
1832
1587
  if (!shadowRoot) {
@@ -1839,7 +1594,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1839
1594
  plt.$orgLocNodes$.delete(orgLocationId);
1840
1595
  });
1841
1596
  if (BUILD.shadowDom && shadowRoot) {
1842
- shadowRootNodes.forEach(shadowRootNode => {
1597
+ shadowRootNodes.map(shadowRootNode => {
1843
1598
  if (shadowRootNode) {
1844
1599
  shadowRoot.appendChild(shadowRootNode);
1845
1600
  }
@@ -1871,7 +1626,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
1871
1626
  $children$: null,
1872
1627
  $key$: null,
1873
1628
  $name$: null,
1874
- $text$: null
1629
+ $text$: null,
1875
1630
  };
1876
1631
  childRenderNodes.push(childVNode);
1877
1632
  node.removeAttribute(HYDRATE_CHILD_ID);
@@ -1918,7 +1673,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
1918
1673
  $key$: null,
1919
1674
  $name$: null,
1920
1675
  $tag$: null,
1921
- $text$: null
1676
+ $text$: null,
1922
1677
  };
1923
1678
  if (childNodeType === TEXT_NODE_ID) {
1924
1679
  childVNode.$elm$ = node.nextSibling;
@@ -2020,7 +1775,7 @@ const parsePropertyValue = (propValue, propType) => {
2020
1775
  if (BUILD.propBoolean && propType & 4 /* Boolean */) {
2021
1776
  // per the HTML spec, any string value means it is a boolean true value
2022
1777
  // but we'll cheat here and say that the string "false" is the boolean false
2023
- return (propValue === 'false' ? false : propValue === '' || !!propValue);
1778
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
2024
1779
  }
2025
1780
  if (BUILD.propNumber && propType & 2 /* Number */) {
2026
1781
  // force it to be a number
@@ -2047,7 +1802,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
2047
1802
  const flags = hostRef.$flags$;
2048
1803
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2049
1804
  newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
2050
- if (newVal !== oldVal && (!BUILD.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
1805
+ if ((!BUILD.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
2051
1806
  // gadzooks! the property's value has changed!!
2052
1807
  // set our new value!
2053
1808
  hostRef.$instanceValues$.set(propName, newVal);
@@ -2065,7 +1820,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
2065
1820
  const watchMethods = cmpMeta.$watchers$[propName];
2066
1821
  if (watchMethods) {
2067
1822
  // this instance is watching for when this property changed
2068
- watchMethods.forEach(watchMethodName => {
1823
+ watchMethods.map(watchMethodName => {
2069
1824
  try {
2070
1825
  // fire off each of the watch methods that are watching this property
2071
1826
  instance[watchMethodName](newVal, oldVal, propName);
@@ -2086,7 +1841,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
2086
1841
  // but only if we've already rendered, otherwise just chill out
2087
1842
  // queue that we need to do an update, but don't worry about queuing
2088
1843
  // up millions cuz this function ensures it only runs once
2089
- scheduleUpdate(elm, hostRef, cmpMeta, false);
1844
+ scheduleUpdate(hostRef, false);
2090
1845
  }
2091
1846
  }
2092
1847
  }
@@ -2099,10 +1854,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
2099
1854
  // It's better to have a const than two Object.entries()
2100
1855
  const members = Object.entries(cmpMeta.$members$);
2101
1856
  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 */)))) {
1857
+ members.map(([memberName, [memberFlags]]) => {
1858
+ if ((BUILD.prop || BUILD.state) && (memberFlags & 31 /* Prop */ || ((!BUILD.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
2106
1859
  // proxyComponent - prop
2107
1860
  Object.defineProperty(prototype, memberName, {
2108
1861
  get() {
@@ -2112,7 +1865,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
2112
1865
  set(newValue) {
2113
1866
  if (
2114
1867
  // only during dev time
2115
- (BUILD.isDev) &&
1868
+ BUILD.isDev &&
2116
1869
  // we are proxing the instance (not element)
2117
1870
  (flags & 1 /* isElementConstructor */) === 0 &&
2118
1871
  // the member is a non-mutable prop
@@ -2123,16 +1876,16 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
2123
1876
  setValue(this, memberName, newValue, cmpMeta);
2124
1877
  },
2125
1878
  configurable: true,
2126
- enumerable: true
1879
+ enumerable: true,
2127
1880
  });
2128
1881
  }
2129
- else if (BUILD.lazyLoad && BUILD.method && (flags & 1 /* isElementConstructor */) && (memberFlags & 64 /* Method */)) {
1882
+ else if (BUILD.lazyLoad && BUILD.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
2130
1883
  // proxyComponent - method
2131
1884
  Object.defineProperty(prototype, memberName, {
2132
1885
  value(...args) {
2133
1886
  const ref = getHostRef(this);
2134
1887
  return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
2135
- }
1888
+ },
2136
1889
  });
2137
1890
  }
2138
1891
  });
@@ -2141,9 +1894,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
2141
1894
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
2142
1895
  plt.jmp(() => {
2143
1896
  const propName = attrNameToPropName.get(attrName);
2144
- this[propName] = newValue === null && typeof this[propName] === 'boolean'
2145
- ? false
2146
- : newValue;
1897
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
2147
1898
  });
2148
1899
  };
2149
1900
  // create an array of attributes to observe
@@ -2162,27 +1913,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
2162
1913
  }
2163
1914
  return Cstr;
2164
1915
  };
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
1916
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
2171
1917
  // 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) {
1918
+ if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) && (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1919
+ if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
1920
+ // we haven't initialized this element yet
1921
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
2186
1922
  // lazy loaded components
2187
1923
  // request the component's implementation to be
2188
1924
  // wired up with the host element
@@ -2233,26 +1969,33 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
2233
1969
  fireConnectedCallback(hostRef.$lazyInstance$);
2234
1970
  }
2235
1971
  else {
1972
+ // sync constructor component
2236
1973
  Cstr = elm.constructor;
1974
+ hostRef.$flags$ |= 128 /* isWatchReady */ | 32 /* hasInitializedComponent */;
2237
1975
  }
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$);
1976
+ if (BUILD.style && Cstr.style) {
2241
1977
  // this component has styles but we haven't registered them yet
2242
1978
  let style = Cstr.style;
2243
1979
  if (BUILD.mode && typeof style !== 'string') {
2244
- style = style[hostRef.$modeName$];
1980
+ style = style[(hostRef.$modeName$ = computeMode(elm))];
1981
+ if (BUILD.hydrateServerSide && hostRef.$modeName$) {
1982
+ elm.setAttribute('s-mode', hostRef.$modeName$);
1983
+ }
2245
1984
  }
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));
1985
+ const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
1986
+ if (!styles.has(scopeId)) {
1987
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1988
+ if (!BUILD.hydrateServerSide && BUILD.shadowDom && BUILD.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
1989
+ style = await import('./shadow-css.js').then(m => m.scopeCss(style, scopeId, false));
1990
+ }
1991
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1992
+ endRegisterStyles();
2248
1993
  }
2249
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
2250
- endRegisterStyles();
2251
1994
  }
2252
1995
  }
2253
1996
  // we've successfully created a lazy instance
2254
1997
  const ancestorComponent = hostRef.$ancestorComponent$;
2255
- const schedule = () => scheduleUpdate(elm, hostRef, cmpMeta, true);
1998
+ const schedule = () => scheduleUpdate(hostRef, true);
2256
1999
  if (BUILD.asyncLoading && ancestorComponent && ancestorComponent['s-rc']) {
2257
2000
  // this is the intial load and this component it has an ancestor component
2258
2001
  // but the ancestor component has NOT fired its will update lifecycle yet
@@ -2271,16 +2014,14 @@ const fireConnectedCallback = (instance) => {
2271
2014
  safeCall(instance, 'connectedCallback');
2272
2015
  }
2273
2016
  };
2274
- const connectedCallback = (elm, cmpMeta) => {
2017
+ const connectedCallback = (elm) => {
2275
2018
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2276
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2277
- // connectedCallback
2278
2019
  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$);
2020
+ const cmpMeta = hostRef.$cmpMeta$;
2021
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2022
+ if (BUILD.hostListenerTargetParent) {
2023
+ // only run if we have listeners being attached to a parent
2024
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
2284
2025
  }
2285
2026
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
2286
2027
  // first time this component has connected
@@ -2289,7 +2030,7 @@ const connectedCallback = (elm, cmpMeta) => {
2289
2030
  if (BUILD.hydrateClientSide) {
2290
2031
  hostId = elm.getAttribute(HYDRATE_ID);
2291
2032
  if (hostId) {
2292
- if (BUILD.shadowDom && supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2033
+ if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2293
2034
  const scopeId = BUILD.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode')) : addStyle(elm.shadowRoot, cmpMeta);
2294
2035
  elm.classList.remove(scopeId + '-h', scopeId + '-s');
2295
2036
  }
@@ -2301,9 +2042,7 @@ const connectedCallback = (elm, cmpMeta) => {
2301
2042
  // if the slot polyfill is required we'll need to put some nodes
2302
2043
  // in here to act as original content anchors as we move nodes around
2303
2044
  // 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 */)) {
2045
+ if (BUILD.hydrateServerSide || ((BUILD.slot || BUILD.shadowDom) && cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
2307
2046
  setContentReference(elm);
2308
2047
  }
2309
2048
  }
@@ -2311,11 +2050,11 @@ const connectedCallback = (elm, cmpMeta) => {
2311
2050
  // find the first ancestor component (if there is one) and register
2312
2051
  // this component as one of the actively loading child components for its ancestor
2313
2052
  let ancestorComponent = elm;
2314
- while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
2053
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
2315
2054
  // climb up the ancestors looking for the first
2316
2055
  // 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'])) {
2056
+ if ((BUILD.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute('s-id') && ancestorComponent['s-p']) ||
2057
+ ancestorComponent['s-p']) {
2319
2058
  // we found this components first ancestor component
2320
2059
  // keep a reference to this component's ancestor component
2321
2060
  attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
@@ -2326,7 +2065,7 @@ const connectedCallback = (elm, cmpMeta) => {
2326
2065
  // Lazy properties
2327
2066
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2328
2067
  if (BUILD.prop && BUILD.lazyLoad && !BUILD.hydrateServerSide && cmpMeta.$members$) {
2329
- Object.entries(cmpMeta.$members$).forEach(([memberName, [memberFlags]]) => {
2068
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2330
2069
  if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
2331
2070
  const value = elm[memberName];
2332
2071
  delete elm[memberName];
@@ -2345,7 +2084,14 @@ const connectedCallback = (elm, cmpMeta) => {
2345
2084
  initializeComponent(elm, hostRef, cmpMeta);
2346
2085
  }
2347
2086
  }
2348
- fireConnectedCallback(hostRef.$lazyInstance$);
2087
+ else {
2088
+ // not the first time this has connected
2089
+ // reattach any event listeners to the host
2090
+ // since they would have been removed when disconnected
2091
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2092
+ // fire off connectedCallback() on component instance
2093
+ fireConnectedCallback(hostRef.$lazyInstance$);
2094
+ }
2349
2095
  endConnected();
2350
2096
  }
2351
2097
  };
@@ -2356,9 +2102,7 @@ const setContentReference = (elm) => {
2356
2102
  // let's pick out the inner content for slot projection
2357
2103
  // create a node to represent where the original
2358
2104
  // 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
- : '');
2105
+ const contentRefElm = (elm['s-cr'] = doc.createComment(BUILD.isDebug ? `content-ref (host=${elm.localName})` : ''));
2362
2106
  contentRefElm['s-cn'] = true;
2363
2107
  elm.insertBefore(contentRefElm, elm.firstChild);
2364
2108
  };
@@ -2368,7 +2112,7 @@ const disconnectedCallback = (elm) => {
2368
2112
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2369
2113
  if (BUILD.hostListener) {
2370
2114
  if (hostRef.$rmListeners$) {
2371
- hostRef.$rmListeners$();
2115
+ hostRef.$rmListeners$.map(rmListener => rmListener());
2372
2116
  hostRef.$rmListeners$ = undefined;
2373
2117
  }
2374
2118
  }
@@ -2384,7 +2128,82 @@ const disconnectedCallback = (elm) => {
2384
2128
  }
2385
2129
  }
2386
2130
  };
2387
- function hmrStart(elm, cmpMeta, hmrVersionId) {
2131
+ const defineCustomElement = (Cstr, compactMeta) => {
2132
+ customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
2133
+ };
2134
+ const proxyCustomElement = (Cstr, compactMeta) => {
2135
+ const cmpMeta = {
2136
+ $flags$: compactMeta[0],
2137
+ $tagName$: compactMeta[1],
2138
+ };
2139
+ if (BUILD.member) {
2140
+ cmpMeta.$members$ = compactMeta[2];
2141
+ }
2142
+ if (BUILD.hostListener) {
2143
+ cmpMeta.$listeners$ = compactMeta[3];
2144
+ }
2145
+ if (BUILD.watchCallback) {
2146
+ cmpMeta.$watchers$ = Cstr.$watchers$;
2147
+ }
2148
+ if (BUILD.reflect) {
2149
+ cmpMeta.$attrsToReflect$ = [];
2150
+ }
2151
+ if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2152
+ cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2153
+ }
2154
+ const originalConnectedCallback = Cstr.prototype.connectedCallback;
2155
+ const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
2156
+ Object.assign(Cstr.prototype, {
2157
+ __registerHost() {
2158
+ registerHost(this, cmpMeta);
2159
+ },
2160
+ connectedCallback() {
2161
+ connectedCallback(this);
2162
+ if (BUILD.connectedCallback && originalConnectedCallback) {
2163
+ originalConnectedCallback.call(this);
2164
+ }
2165
+ },
2166
+ disconnectedCallback() {
2167
+ disconnectedCallback(this);
2168
+ if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
2169
+ originalDisconnectedCallback.call(this);
2170
+ }
2171
+ },
2172
+ });
2173
+ Cstr.is = cmpMeta.$tagName$;
2174
+ return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
2175
+ };
2176
+ const forceModeUpdate = (elm) => {
2177
+ if (BUILD.style && BUILD.mode && !BUILD.lazyLoad) {
2178
+ const mode = computeMode(elm);
2179
+ const hostRef = getHostRef(elm);
2180
+ if (hostRef.$modeName$ !== mode) {
2181
+ const cmpMeta = hostRef.$cmpMeta$;
2182
+ const oldScopeId = elm['s-sc'];
2183
+ const scopeId = getScopeId(cmpMeta, mode);
2184
+ const style = elm.constructor.style[mode];
2185
+ const flags = cmpMeta.$flags$;
2186
+ if (style) {
2187
+ if (!styles.has(scopeId)) {
2188
+ registerStyle(scopeId, style, !!(flags & 1 /* shadowDomEncapsulation */));
2189
+ }
2190
+ hostRef.$modeName$ = mode;
2191
+ elm.classList.remove(oldScopeId + '-h', oldScopeId + '-s');
2192
+ attachStyles(hostRef);
2193
+ forceUpdate(elm);
2194
+ }
2195
+ }
2196
+ }
2197
+ };
2198
+ const attachShadow = (el) => {
2199
+ if (supportsShadow) {
2200
+ el.attachShadow({ mode: 'open' });
2201
+ }
2202
+ else {
2203
+ el.shadowRoot = el;
2204
+ }
2205
+ };
2206
+ const hmrStart = (elm, cmpMeta, hmrVersionId) => {
2388
2207
  // ¯\_(ツ)_/¯
2389
2208
  const hostRef = getHostRef(elm);
2390
2209
  // reset state flags to only have been connected
@@ -2400,9 +2219,110 @@ function hmrStart(elm, cmpMeta, hmrVersionId) {
2400
2219
  };
2401
2220
  // re-initialize the component
2402
2221
  initializeComponent(elm, hostRef, cmpMeta, hmrVersionId);
2403
- }
2222
+ };
2223
+ const patchCloneNode = (HostElementPrototype) => {
2224
+ const orgCloneNode = HostElementPrototype.cloneNode;
2225
+ HostElementPrototype.cloneNode = function (deep) {
2226
+ const srcNode = this;
2227
+ const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
2228
+ const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
2229
+ if (BUILD.slot && !isShadowDom && deep) {
2230
+ let i = 0;
2231
+ let slotted, nonRindoNode;
2232
+ 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'];
2233
+ for (; i < srcNode.childNodes.length; i++) {
2234
+ slotted = srcNode.childNodes[i]['s-nr'];
2235
+ nonRindoNode = rindoPrivates.every((privateField) => !srcNode.childNodes[i][privateField]);
2236
+ if (slotted) {
2237
+ if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
2238
+ clonedNode.__appendChild(slotted.cloneNode(true));
2239
+ }
2240
+ else {
2241
+ clonedNode.appendChild(slotted.cloneNode(true));
2242
+ }
2243
+ }
2244
+ if (nonRindoNode) {
2245
+ clonedNode.appendChild(srcNode.childNodes[i].cloneNode(true));
2246
+ }
2247
+ }
2248
+ }
2249
+ return clonedNode;
2250
+ };
2251
+ };
2252
+ const patchSlotAppendChild = (HostElementPrototype) => {
2253
+ HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
2254
+ HostElementPrototype.appendChild = function (newChild) {
2255
+ const slotName = (newChild['s-sn'] = getSlotName(newChild));
2256
+ const slotNode = getHostSlotNode(this.childNodes, slotName);
2257
+ if (slotNode) {
2258
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2259
+ const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2260
+ return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2261
+ }
2262
+ return this.__appendChild(newChild);
2263
+ };
2264
+ };
2265
+ const patchChildSlotNodes = (elm, cmpMeta) => {
2266
+ class FakeNodeList extends Array {
2267
+ item(n) {
2268
+ return this[n];
2269
+ }
2270
+ }
2271
+ if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2272
+ const childNodesFn = elm.__lookupGetter__('childNodes');
2273
+ Object.defineProperty(elm, 'children', {
2274
+ get() {
2275
+ return this.childNodes.map((n) => n.nodeType === 1);
2276
+ },
2277
+ });
2278
+ Object.defineProperty(elm, 'childElementCount', {
2279
+ get() {
2280
+ return elm.children.length;
2281
+ },
2282
+ });
2283
+ Object.defineProperty(elm, 'childNodes', {
2284
+ get() {
2285
+ const childNodes = childNodesFn.call(this);
2286
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 && getHostRef(this).$flags$ & 2 /* hasRendered */) {
2287
+ const result = new FakeNodeList();
2288
+ for (let i = 0; i < childNodes.length; i++) {
2289
+ const slot = childNodes[i]['s-nr'];
2290
+ if (slot) {
2291
+ result.push(slot);
2292
+ }
2293
+ }
2294
+ return result;
2295
+ }
2296
+ return FakeNodeList.from(childNodes);
2297
+ },
2298
+ });
2299
+ }
2300
+ };
2301
+ const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || '';
2302
+ const getHostSlotNode = (childNodes, slotName) => {
2303
+ let i = 0;
2304
+ let childNode;
2305
+ for (; i < childNodes.length; i++) {
2306
+ childNode = childNodes[i];
2307
+ if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
2308
+ return childNode;
2309
+ }
2310
+ childNode = getHostSlotNode(childNode.childNodes, slotName);
2311
+ if (childNode) {
2312
+ return childNode;
2313
+ }
2314
+ }
2315
+ return null;
2316
+ };
2317
+ const getHostSlotChildNodes = (n, slotName) => {
2318
+ const childNodes = [n];
2319
+ while ((n = n.nextSibling) && n['s-sn'] === slotName) {
2320
+ childNodes.push(n);
2321
+ }
2322
+ return childNodes;
2323
+ };
2404
2324
  const bootstrapLazy = (lazyBundles, options = {}) => {
2405
- if (BUILD.profile) {
2325
+ if (BUILD.profile && performance.mark) {
2406
2326
  performance.mark('st:app:start');
2407
2327
  }
2408
2328
  installDevTools();
@@ -2420,8 +2340,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2420
2340
  let i = 0;
2421
2341
  Object.assign(plt, options);
2422
2342
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2423
- if (options.syncQueue) {
2424
- plt.$flags$ |= 4 /* queueSync */;
2343
+ if (BUILD.asyncQueue) {
2344
+ if (options.syncQueue) {
2345
+ plt.$flags$ |= 4 /* queueSync */;
2346
+ }
2425
2347
  }
2426
2348
  if (BUILD.hydrateClientSide) {
2427
2349
  // If the app is already hydrated there is not point to disable the
@@ -2433,7 +2355,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2433
2355
  registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
2434
2356
  }
2435
2357
  }
2436
- lazyBundles.forEach(lazyBundle => lazyBundle[1].forEach(compactMeta => {
2358
+ lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
2437
2359
  const cmpMeta = {
2438
2360
  $flags$: compactMeta[0],
2439
2361
  $tagName$: compactMeta[1],
@@ -2452,23 +2374,23 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2452
2374
  if (BUILD.watchCallback) {
2453
2375
  cmpMeta.$watchers$ = {};
2454
2376
  }
2455
- if (BUILD.shadowDom && !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2377
+ if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2456
2378
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2457
2379
  }
2458
- const tagName = cmpMeta.$tagName$;
2380
+ const tagName = BUILD.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
2459
2381
  const HostElement = class extends HTMLElement {
2460
2382
  // RindoLazyHost
2461
2383
  constructor(self) {
2462
2384
  // @ts-ignore
2463
2385
  super(self);
2464
2386
  self = this;
2465
- registerHost(self);
2387
+ registerHost(self, cmpMeta);
2466
2388
  if (BUILD.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2467
2389
  // this component is using shadow dom
2468
2390
  // and this browser supports shadow dom
2469
2391
  // add the read-only property "shadowRoot" to the host element
2470
2392
  // adding the shadow root build conditionals to minimize runtime
2471
- if (supportsShadowDom) {
2393
+ if (supportsShadow) {
2472
2394
  if (BUILD.shadowDelegatesFocus) {
2473
2395
  self.attachShadow({
2474
2396
  mode: 'open',
@@ -2483,6 +2405,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2483
2405
  self.shadowRoot = self;
2484
2406
  }
2485
2407
  }
2408
+ if (BUILD.slotChildNodesFix) {
2409
+ patchChildSlotNodes(self, cmpMeta);
2410
+ }
2486
2411
  }
2487
2412
  connectedCallback() {
2488
2413
  if (appLoadFallback) {
@@ -2494,31 +2419,39 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2494
2419
  deferredConnectedCallbacks.push(this);
2495
2420
  }
2496
2421
  else {
2497
- plt.jmp(() => connectedCallback(this, cmpMeta));
2422
+ plt.jmp(() => connectedCallback(this));
2498
2423
  }
2499
2424
  }
2500
2425
  disconnectedCallback() {
2501
2426
  plt.jmp(() => disconnectedCallback(this));
2502
2427
  }
2503
2428
  forceUpdate() {
2504
- forceUpdate(this, cmpMeta);
2429
+ if (BUILD.isDev) {
2430
+ consoleDevWarn(`element.forceUpdate() is deprecated, use the "forceUpdate" function from "@rindo/core" instead:
2431
+
2432
+ import { forceUpdate } from ‘@rindo/core’;
2433
+
2434
+ forceUpdate(this);
2435
+ forceUpdate(element);`);
2436
+ }
2437
+ forceUpdate(this);
2505
2438
  }
2506
2439
  componentOnReady() {
2507
2440
  return getHostRef(this).$onReadyPromise$;
2508
2441
  }
2509
2442
  };
2510
2443
  if (BUILD.cloneNodeFix) {
2511
- cloneNodeFix(HostElement.prototype);
2444
+ patchCloneNode(HostElement.prototype);
2512
2445
  }
2513
2446
  if (BUILD.appendChildSlotFix) {
2514
- appendChildSlotFix(HostElement.prototype);
2447
+ patchSlotAppendChild(HostElement.prototype);
2515
2448
  }
2516
2449
  if (BUILD.hotModuleReplacement) {
2517
2450
  HostElement.prototype['s-hmr'] = function (hmrVersionId) {
2518
2451
  hmrStart(this, cmpMeta, hmrVersionId);
2519
2452
  };
2520
2453
  }
2521
- cmpMeta.$lazyBundleIds$ = lazyBundle[0];
2454
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
2522
2455
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
2523
2456
  cmpTags.push(tagName);
2524
2457
  customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
@@ -2531,115 +2464,25 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2531
2464
  }
2532
2465
  // Process deferred connectedCallbacks now all components have been registered
2533
2466
  isBootstrapping = false;
2534
- if (deferredConnectedCallbacks.length > 0) {
2535
- deferredConnectedCallbacks.forEach(host => host.connectedCallback());
2467
+ if (deferredConnectedCallbacks.length) {
2468
+ deferredConnectedCallbacks.map(host => host.connectedCallback());
2536
2469
  }
2537
2470
  else {
2538
2471
  if (BUILD.profile) {
2539
- plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'));
2472
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30, 'timeout')));
2540
2473
  }
2541
2474
  else {
2542
- plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
2475
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
2543
2476
  }
2544
2477
  }
2545
2478
  // Fallback appLoad event
2546
2479
  endBootstrap();
2547
2480
  };
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
2481
  const getAssetPath = (path) => {
2638
2482
  const assetUrl = new URL(path, plt.$resourcesUrl$);
2639
- return (assetUrl.origin !== win.location.origin)
2640
- ? assetUrl.href
2641
- : assetUrl.pathname;
2483
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
2642
2484
  };
2485
+ const setAssetPath = (path) => (plt.$resourcesUrl$ = path);
2643
2486
  const getConnect = (_ref, tagName) => {
2644
2487
  const componentOnReady = () => {
2645
2488
  let elm = doc.querySelector(tagName);
@@ -2650,8 +2493,7 @@ const getConnect = (_ref, tagName) => {
2650
2493
  return typeof elm.componentOnReady === 'function' ? elm.componentOnReady() : Promise.resolve(elm);
2651
2494
  };
2652
2495
  const create = (...args) => {
2653
- return componentOnReady()
2654
- .then(el => el.create(...args));
2496
+ return componentOnReady().then(el => el.create(...args));
2655
2497
  };
2656
2498
  return {
2657
2499
  create,
@@ -2684,18 +2526,18 @@ const getContext = (_elm, context) => {
2684
2526
  tick: {
2685
2527
  then(cb) {
2686
2528
  return nextTick(cb);
2687
- }
2688
- }
2529
+ },
2530
+ },
2689
2531
  };
2690
2532
  }
2691
2533
  return undefined;
2692
2534
  };
2693
- const getElement = (ref) => BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2694
- const insertVdomAnnotations = (doc) => {
2535
+ const insertVdomAnnotations = (doc, staticComponents) => {
2695
2536
  if (doc != null) {
2696
2537
  const docData = {
2697
2538
  hostIds: 0,
2698
- rootLevelIds: 0
2539
+ rootLevelIds: 0,
2540
+ staticComponents: new Set(staticComponents),
2699
2541
  };
2700
2542
  const orgLocationNodes = [];
2701
2543
  parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
@@ -2758,9 +2600,9 @@ const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
2758
2600
  if (node.nodeType === 1 /* ElementNode */) {
2759
2601
  node.childNodes.forEach(childNode => {
2760
2602
  const hostRef = getHostRef(childNode);
2761
- if (hostRef != null) {
2603
+ if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
2762
2604
  const cmpData = {
2763
- nodeIds: 0
2605
+ nodeIds: 0,
2764
2606
  };
2765
2607
  insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
2766
2608
  }
@@ -2781,6 +2623,17 @@ const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
2781
2623
  insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
2782
2624
  });
2783
2625
  }
2626
+ if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute('c-id')) {
2627
+ const parent = hostElm.parentElement;
2628
+ if (parent && parent.childNodes) {
2629
+ const parentChildNodes = Array.from(parent.childNodes);
2630
+ const comment = parentChildNodes.find(node => node.nodeType === 8 /* CommentNode */ && node['s-sr']);
2631
+ if (comment) {
2632
+ const index = parentChildNodes.indexOf(hostElm) - 1;
2633
+ vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}`);
2634
+ }
2635
+ }
2636
+ }
2784
2637
  }
2785
2638
  };
2786
2639
  const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
@@ -2805,7 +2658,7 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
2805
2658
  }
2806
2659
  else if (childElm.nodeType === 8 /* CommentNode */) {
2807
2660
  if (childElm['s-sr']) {
2808
- const slotName = (childElm['s-sn'] || '');
2661
+ const slotName = childElm['s-sn'] || '';
2809
2662
  const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
2810
2663
  childElm.nodeValue = slotNodeId;
2811
2664
  }
@@ -2817,4 +2670,151 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
2817
2670
  });
2818
2671
  }
2819
2672
  };
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 };
2673
+ const hostRefs = new WeakMap();
2674
+ const getHostRef = (ref) => hostRefs.get(ref);
2675
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
2676
+ const registerHost = (elm, cmpMeta) => {
2677
+ const hostRef = {
2678
+ $flags$: 0,
2679
+ $hostElement$: elm,
2680
+ $cmpMeta$: cmpMeta,
2681
+ $instanceValues$: new Map(),
2682
+ };
2683
+ if (BUILD.isDev) {
2684
+ hostRef.$renderCount$ = 0;
2685
+ }
2686
+ if (BUILD.method && BUILD.lazyLoad) {
2687
+ hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
2688
+ }
2689
+ if (BUILD.asyncLoading) {
2690
+ hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
2691
+ elm['s-p'] = [];
2692
+ elm['s-rc'] = [];
2693
+ }
2694
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2695
+ return hostRefs.set(elm, hostRef);
2696
+ };
2697
+ const isMemberInElement = (elm, memberName) => memberName in elm;
2698
+ const RINDO_DEV_MODE = BUILD.isTesting
2699
+ ? ['RINDO:'] // E2E testing
2700
+ : ['%crindo', 'color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px'];
2701
+ const consoleDevError = (...m) => console.error(...RINDO_DEV_MODE, ...m);
2702
+ const consoleDevWarn = (...m) => console.warn(...RINDO_DEV_MODE, ...m);
2703
+ const consoleDevInfo = (...m) => console.info(...RINDO_DEV_MODE, ...m);
2704
+ const consoleError = (e) => console.error(e);
2705
+ const cmpModules = /*@__PURE__*/ new Map();
2706
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2707
+ // loadModuleImport
2708
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
2709
+ const bundleId = cmpMeta.$lazyBundleId$;
2710
+ if (BUILD.isDev && typeof bundleId !== 'string') {
2711
+ consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
2712
+ return undefined;
2713
+ }
2714
+ const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
2715
+ if (module) {
2716
+ return module[exportName];
2717
+ }
2718
+ return import(
2719
+ /* webpackInclude: /\.entry\.js$/ */
2720
+ /* webpackExclude: /\.system\.entry\.js$/ */
2721
+ /* webpackMode: "lazy" */
2722
+ `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? '?s-hmr=' + hmrVersionId : ''}`).then(importedModule => {
2723
+ if (!BUILD.hotModuleReplacement) {
2724
+ cmpModules.set(bundleId, importedModule);
2725
+ }
2726
+ return importedModule[exportName];
2727
+ }, consoleError);
2728
+ };
2729
+ const styles = new Map();
2730
+ const modeResolutionChain = [];
2731
+ const queueDomReads = [];
2732
+ const queueDomWrites = [];
2733
+ const queueDomWritesLow = [];
2734
+ const queueTask = (queue, write) => (cb) => {
2735
+ queue.push(cb);
2736
+ if (!queuePending) {
2737
+ queuePending = true;
2738
+ if (write && plt.$flags$ & 4 /* queueSync */) {
2739
+ nextTick(flush);
2740
+ }
2741
+ else {
2742
+ plt.raf(flush);
2743
+ }
2744
+ }
2745
+ };
2746
+ const consume = (queue) => {
2747
+ for (let i = 0; i < queue.length; i++) {
2748
+ try {
2749
+ queue[i](performance.now());
2750
+ }
2751
+ catch (e) {
2752
+ consoleError(e);
2753
+ }
2754
+ }
2755
+ queue.length = 0;
2756
+ };
2757
+ const consumeTimeout = (queue, timeout) => {
2758
+ let i = 0;
2759
+ let ts = 0;
2760
+ while (i < queue.length && (ts = performance.now()) < timeout) {
2761
+ try {
2762
+ queue[i++](ts);
2763
+ }
2764
+ catch (e) {
2765
+ consoleError(e);
2766
+ }
2767
+ }
2768
+ if (i === queue.length) {
2769
+ queue.length = 0;
2770
+ }
2771
+ else if (i !== 0) {
2772
+ queue.splice(0, i);
2773
+ }
2774
+ };
2775
+ const flush = () => {
2776
+ if (BUILD.asyncQueue) {
2777
+ queueCongestion++;
2778
+ }
2779
+ // always force a bunch of medium callbacks to run, but still have
2780
+ // a throttle on how many can run in a certain time
2781
+ // DOM READS!!!
2782
+ consume(queueDomReads);
2783
+ // DOM WRITES!!!
2784
+ if (BUILD.asyncQueue) {
2785
+ const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */ ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0)) : Infinity;
2786
+ consumeTimeout(queueDomWrites, timeout);
2787
+ consumeTimeout(queueDomWritesLow, timeout);
2788
+ if (queueDomWrites.length > 0) {
2789
+ queueDomWritesLow.push(...queueDomWrites);
2790
+ queueDomWrites.length = 0;
2791
+ }
2792
+ if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
2793
+ // still more to do yet, but we've run out of time
2794
+ // let's let this thing cool off and try again in the next tick
2795
+ plt.raf(flush);
2796
+ }
2797
+ else {
2798
+ queueCongestion = 0;
2799
+ }
2800
+ }
2801
+ else {
2802
+ consume(queueDomWrites);
2803
+ if ((queuePending = queueDomReads.length > 0)) {
2804
+ // still more to do yet, but we've run out of time
2805
+ // let's let this thing cool off and try again in the next tick
2806
+ plt.raf(flush);
2807
+ }
2808
+ }
2809
+ };
2810
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
2811
+ const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
2812
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2813
+ const Build = {
2814
+ isDev: BUILD.isDev ? true : false,
2815
+ isBrowser: true,
2816
+ isServer: false,
2817
+ isTesting: BUILD.isTesting ? true : false,
2818
+ };
2819
+ export { BUILD, NAMESPACE } from '@rindo/core/internal/app-data';
2820
+ export { Build, CSS, Context, 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, setMode, setValue, styles, supportsConstructibleStylesheets, supportsListenerOptions, supportsShadow, win, writeTask };