@depup/gatsby 5.16.1-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1361) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +142 -0
  3. package/adapters.js +31 -0
  4. package/apis.json +73 -0
  5. package/cache-dir/.eslintrc.json +10 -0
  6. package/cache-dir/api-runner-browser-plugins.js +14 -0
  7. package/cache-dir/api-runner-browser.js +52 -0
  8. package/cache-dir/api-runner-ssr.js +88 -0
  9. package/cache-dir/api-ssr-docs.js +207 -0
  10. package/cache-dir/app.js +249 -0
  11. package/cache-dir/blank.css +0 -0
  12. package/cache-dir/commonjs/api-runner-browser-plugins.js +17 -0
  13. package/cache-dir/commonjs/api-runner-browser-plugins.js.map +1 -0
  14. package/cache-dir/commonjs/api-runner-browser.js +49 -0
  15. package/cache-dir/commonjs/api-runner-browser.js.map +1 -0
  16. package/cache-dir/commonjs/api-runner-ssr.js +88 -0
  17. package/cache-dir/commonjs/api-runner-ssr.js.map +1 -0
  18. package/cache-dir/commonjs/api-ssr-docs.js +210 -0
  19. package/cache-dir/commonjs/api-ssr-docs.js.map +1 -0
  20. package/cache-dir/commonjs/app.js +197 -0
  21. package/cache-dir/commonjs/app.js.map +1 -0
  22. package/cache-dir/commonjs/context-utils.js +25 -0
  23. package/cache-dir/commonjs/context-utils.js.map +1 -0
  24. package/cache-dir/commonjs/create-content-digest-browser-shim.js +4 -0
  25. package/cache-dir/commonjs/create-content-digest-browser-shim.js.map +1 -0
  26. package/cache-dir/commonjs/css-to-object.js +21 -0
  27. package/cache-dir/commonjs/css-to-object.js.map +1 -0
  28. package/cache-dir/commonjs/debug-log.js +11 -0
  29. package/cache-dir/commonjs/debug-log.js.map +1 -0
  30. package/cache-dir/commonjs/default-html.js +33 -0
  31. package/cache-dir/commonjs/default-html.js.map +1 -0
  32. package/cache-dir/commonjs/dev-loader.js +247 -0
  33. package/cache-dir/commonjs/dev-loader.js.map +1 -0
  34. package/cache-dir/commonjs/develop-static-entry.js +129 -0
  35. package/cache-dir/commonjs/develop-static-entry.js.map +1 -0
  36. package/cache-dir/commonjs/dummy.js +8 -0
  37. package/cache-dir/commonjs/dummy.js.map +1 -0
  38. package/cache-dir/commonjs/emitter.js +10 -0
  39. package/cache-dir/commonjs/emitter.js.map +1 -0
  40. package/cache-dir/commonjs/ensure-resources.js +107 -0
  41. package/cache-dir/commonjs/ensure-resources.js.map +1 -0
  42. package/cache-dir/commonjs/error-overlay-handler.js +35 -0
  43. package/cache-dir/commonjs/error-overlay-handler.js.map +1 -0
  44. package/cache-dir/commonjs/fast-refresh-overlay/components/accordion.js +80 -0
  45. package/cache-dir/commonjs/fast-refresh-overlay/components/accordion.js.map +1 -0
  46. package/cache-dir/commonjs/fast-refresh-overlay/components/build-error.js +44 -0
  47. package/cache-dir/commonjs/fast-refresh-overlay/components/build-error.js.map +1 -0
  48. package/cache-dir/commonjs/fast-refresh-overlay/components/code-frame.js +38 -0
  49. package/cache-dir/commonjs/fast-refresh-overlay/components/code-frame.js.map +1 -0
  50. package/cache-dir/commonjs/fast-refresh-overlay/components/dev-ssr-error.js +52 -0
  51. package/cache-dir/commonjs/fast-refresh-overlay/components/dev-ssr-error.js.map +1 -0
  52. package/cache-dir/commonjs/fast-refresh-overlay/components/error-boundary.js +31 -0
  53. package/cache-dir/commonjs/fast-refresh-overlay/components/error-boundary.js.map +1 -0
  54. package/cache-dir/commonjs/fast-refresh-overlay/components/getserverdata-error.js +47 -0
  55. package/cache-dir/commonjs/fast-refresh-overlay/components/getserverdata-error.js.map +1 -0
  56. package/cache-dir/commonjs/fast-refresh-overlay/components/graphql-errors.js +77 -0
  57. package/cache-dir/commonjs/fast-refresh-overlay/components/graphql-errors.js.map +1 -0
  58. package/cache-dir/commonjs/fast-refresh-overlay/components/hooks.js +93 -0
  59. package/cache-dir/commonjs/fast-refresh-overlay/components/hooks.js.map +1 -0
  60. package/cache-dir/commonjs/fast-refresh-overlay/components/overlay.js +147 -0
  61. package/cache-dir/commonjs/fast-refresh-overlay/components/overlay.js.map +1 -0
  62. package/cache-dir/commonjs/fast-refresh-overlay/components/runtime-errors.js +110 -0
  63. package/cache-dir/commonjs/fast-refresh-overlay/components/runtime-errors.js.map +1 -0
  64. package/cache-dir/commonjs/fast-refresh-overlay/components/use-id.js +50 -0
  65. package/cache-dir/commonjs/fast-refresh-overlay/components/use-id.js.map +1 -0
  66. package/cache-dir/commonjs/fast-refresh-overlay/helpers/focus-trap.js +2879 -0
  67. package/cache-dir/commonjs/fast-refresh-overlay/helpers/focus-trap.js.map +1 -0
  68. package/cache-dir/commonjs/fast-refresh-overlay/helpers/keys.js +84 -0
  69. package/cache-dir/commonjs/fast-refresh-overlay/helpers/keys.js.map +1 -0
  70. package/cache-dir/commonjs/fast-refresh-overlay/helpers/lock-body.js +48 -0
  71. package/cache-dir/commonjs/fast-refresh-overlay/helpers/lock-body.js.map +1 -0
  72. package/cache-dir/commonjs/fast-refresh-overlay/helpers/match.js +44 -0
  73. package/cache-dir/commonjs/fast-refresh-overlay/helpers/match.js.map +1 -0
  74. package/cache-dir/commonjs/fast-refresh-overlay/index.js +182 -0
  75. package/cache-dir/commonjs/fast-refresh-overlay/index.js.map +1 -0
  76. package/cache-dir/commonjs/fast-refresh-overlay/style.js +418 -0
  77. package/cache-dir/commonjs/fast-refresh-overlay/style.js.map +1 -0
  78. package/cache-dir/commonjs/fast-refresh-overlay/utils.js +75 -0
  79. package/cache-dir/commonjs/fast-refresh-overlay/utils.js.map +1 -0
  80. package/cache-dir/commonjs/find-path.js +145 -0
  81. package/cache-dir/commonjs/find-path.js.map +1 -0
  82. package/cache-dir/commonjs/gatsby-browser-entry.js +52 -0
  83. package/cache-dir/commonjs/gatsby-browser-entry.js.map +1 -0
  84. package/cache-dir/commonjs/head/components/fire-callback-in-effect.js +18 -0
  85. package/cache-dir/commonjs/head/components/fire-callback-in-effect.js.map +1 -0
  86. package/cache-dir/commonjs/head/components/head-components.js +72 -0
  87. package/cache-dir/commonjs/head/components/head-components.js.map +1 -0
  88. package/cache-dir/commonjs/head/constants.js +13 -0
  89. package/cache-dir/commonjs/head/constants.js.map +1 -0
  90. package/cache-dir/commonjs/head/head-export-handler-for-browser.js +144 -0
  91. package/cache-dir/commonjs/head/head-export-handler-for-browser.js.map +1 -0
  92. package/cache-dir/commonjs/head/head-export-handler-for-ssr.js +225 -0
  93. package/cache-dir/commonjs/head/head-export-handler-for-ssr.js.map +1 -0
  94. package/cache-dir/commonjs/head/utils.js +264 -0
  95. package/cache-dir/commonjs/head/utils.js.map +1 -0
  96. package/cache-dir/commonjs/loader.js +861 -0
  97. package/cache-dir/commonjs/loader.js.map +1 -0
  98. package/cache-dir/commonjs/loading-indicator/index.js +25 -0
  99. package/cache-dir/commonjs/loading-indicator/index.js.map +1 -0
  100. package/cache-dir/commonjs/loading-indicator/indicator.js +63 -0
  101. package/cache-dir/commonjs/loading-indicator/indicator.js.map +1 -0
  102. package/cache-dir/commonjs/loading-indicator/style.js +103 -0
  103. package/cache-dir/commonjs/loading-indicator/style.js.map +1 -0
  104. package/cache-dir/commonjs/navigation.js +260 -0
  105. package/cache-dir/commonjs/navigation.js.map +1 -0
  106. package/cache-dir/commonjs/normalize-page-path.js +22 -0
  107. package/cache-dir/commonjs/normalize-page-path.js.map +1 -0
  108. package/cache-dir/commonjs/page-renderer.js +59 -0
  109. package/cache-dir/commonjs/page-renderer.js.map +1 -0
  110. package/cache-dir/commonjs/pages.json +1 -0
  111. package/cache-dir/commonjs/polyfill-entry.js +7 -0
  112. package/cache-dir/commonjs/polyfill-entry.js.map +1 -0
  113. package/cache-dir/commonjs/prefetch.js +67 -0
  114. package/cache-dir/commonjs/prefetch.js.map +1 -0
  115. package/cache-dir/commonjs/production-app.js +256 -0
  116. package/cache-dir/commonjs/production-app.js.map +1 -0
  117. package/cache-dir/commonjs/public-page-renderer-dev.js +26 -0
  118. package/cache-dir/commonjs/public-page-renderer-dev.js.map +1 -0
  119. package/cache-dir/commonjs/public-page-renderer-prod.js +30 -0
  120. package/cache-dir/commonjs/public-page-renderer-prod.js.map +1 -0
  121. package/cache-dir/commonjs/public-page-renderer.js +11 -0
  122. package/cache-dir/commonjs/public-page-renderer.js.map +1 -0
  123. package/cache-dir/commonjs/query-result-store.js +160 -0
  124. package/cache-dir/commonjs/query-result-store.js.map +1 -0
  125. package/cache-dir/commonjs/react-dom-utils.js +34 -0
  126. package/cache-dir/commonjs/react-dom-utils.js.map +1 -0
  127. package/cache-dir/commonjs/react-lifecycles-compat.js +4 -0
  128. package/cache-dir/commonjs/react-lifecycles-compat.js.map +1 -0
  129. package/cache-dir/commonjs/redirect-utils.js +25 -0
  130. package/cache-dir/commonjs/redirect-utils.js.map +1 -0
  131. package/cache-dir/commonjs/redirects.json +1 -0
  132. package/cache-dir/commonjs/register-service-worker.js +66 -0
  133. package/cache-dir/commonjs/register-service-worker.js.map +1 -0
  134. package/cache-dir/commonjs/root.js +105 -0
  135. package/cache-dir/commonjs/root.js.map +1 -0
  136. package/cache-dir/commonjs/route-announcer-props.js +24 -0
  137. package/cache-dir/commonjs/route-announcer-props.js.map +1 -0
  138. package/cache-dir/commonjs/server-utils/writable-as-promise.js +42 -0
  139. package/cache-dir/commonjs/server-utils/writable-as-promise.js.map +1 -0
  140. package/cache-dir/commonjs/shadow-portal.js +36 -0
  141. package/cache-dir/commonjs/shadow-portal.js.map +1 -0
  142. package/cache-dir/commonjs/slice/context.js +15 -0
  143. package/cache-dir/commonjs/slice/context.js.map +1 -0
  144. package/cache-dir/commonjs/slice/inline-slice.js +34 -0
  145. package/cache-dir/commonjs/slice/inline-slice.js.map +1 -0
  146. package/cache-dir/commonjs/slice/server-slice-renderer.js +29 -0
  147. package/cache-dir/commonjs/slice/server-slice-renderer.js.map +1 -0
  148. package/cache-dir/commonjs/slice/server-slice.js +54 -0
  149. package/cache-dir/commonjs/slice/server-slice.js.map +1 -0
  150. package/cache-dir/commonjs/slice.js +124 -0
  151. package/cache-dir/commonjs/slice.js.map +1 -0
  152. package/cache-dir/commonjs/socketIo.js +62 -0
  153. package/cache-dir/commonjs/socketIo.js.map +1 -0
  154. package/cache-dir/commonjs/ssr-builtin-trackers/child_process.js +8 -0
  155. package/cache-dir/commonjs/ssr-builtin-trackers/child_process.js.map +1 -0
  156. package/cache-dir/commonjs/ssr-builtin-trackers/fs.js +7 -0
  157. package/cache-dir/commonjs/ssr-builtin-trackers/fs.js.map +1 -0
  158. package/cache-dir/commonjs/ssr-builtin-trackers/http.js +9 -0
  159. package/cache-dir/commonjs/ssr-builtin-trackers/http.js.map +1 -0
  160. package/cache-dir/commonjs/ssr-builtin-trackers/http2.js +7 -0
  161. package/cache-dir/commonjs/ssr-builtin-trackers/http2.js.map +1 -0
  162. package/cache-dir/commonjs/ssr-builtin-trackers/https.js +9 -0
  163. package/cache-dir/commonjs/ssr-builtin-trackers/https.js.map +1 -0
  164. package/cache-dir/commonjs/ssr-builtin-trackers/tracking-unsafe-module-wrapper.js +55 -0
  165. package/cache-dir/commonjs/ssr-builtin-trackers/tracking-unsafe-module-wrapper.js.map +1 -0
  166. package/cache-dir/commonjs/ssr-develop-static-entry.js +366 -0
  167. package/cache-dir/commonjs/ssr-develop-static-entry.js.map +1 -0
  168. package/cache-dir/commonjs/static-entry.js +544 -0
  169. package/cache-dir/commonjs/static-entry.js.map +1 -0
  170. package/cache-dir/commonjs/static-query.js +74 -0
  171. package/cache-dir/commonjs/static-query.js.map +1 -0
  172. package/cache-dir/commonjs/strip-prefix.js +22 -0
  173. package/cache-dir/commonjs/strip-prefix.js.map +1 -0
  174. package/cache-dir/context-utils.js +29 -0
  175. package/cache-dir/create-content-digest-browser-shim.js +1 -0
  176. package/cache-dir/css-to-object.js +19 -0
  177. package/cache-dir/debug-log.js +13 -0
  178. package/cache-dir/default-html.js +36 -0
  179. package/cache-dir/dev-loader.js +280 -0
  180. package/cache-dir/develop-static-entry.js +129 -0
  181. package/cache-dir/dummy.js +2 -0
  182. package/cache-dir/emitter.js +4 -0
  183. package/cache-dir/ensure-resources.js +119 -0
  184. package/cache-dir/error-overlay-handler.js +36 -0
  185. package/cache-dir/fast-refresh-overlay/components/accordion.js +83 -0
  186. package/cache-dir/fast-refresh-overlay/components/build-error.js +46 -0
  187. package/cache-dir/fast-refresh-overlay/components/code-frame.js +38 -0
  188. package/cache-dir/fast-refresh-overlay/components/dev-ssr-error.js +66 -0
  189. package/cache-dir/fast-refresh-overlay/components/error-boundary.js +28 -0
  190. package/cache-dir/fast-refresh-overlay/components/getserverdata-error.js +53 -0
  191. package/cache-dir/fast-refresh-overlay/components/graphql-errors.js +100 -0
  192. package/cache-dir/fast-refresh-overlay/components/hooks.js +102 -0
  193. package/cache-dir/fast-refresh-overlay/components/overlay.js +143 -0
  194. package/cache-dir/fast-refresh-overlay/components/runtime-errors.js +139 -0
  195. package/cache-dir/fast-refresh-overlay/components/use-id.js +56 -0
  196. package/cache-dir/fast-refresh-overlay/helpers/focus-trap.js +3561 -0
  197. package/cache-dir/fast-refresh-overlay/helpers/keys.js +80 -0
  198. package/cache-dir/fast-refresh-overlay/helpers/lock-body.js +52 -0
  199. package/cache-dir/fast-refresh-overlay/helpers/match.js +42 -0
  200. package/cache-dir/fast-refresh-overlay/index.js +147 -0
  201. package/cache-dir/fast-refresh-overlay/style.js +413 -0
  202. package/cache-dir/fast-refresh-overlay/utils.js +81 -0
  203. package/cache-dir/find-path.js +160 -0
  204. package/cache-dir/gatsby-browser-entry.js +27 -0
  205. package/cache-dir/head/components/fire-callback-in-effect.js +12 -0
  206. package/cache-dir/head/components/head-components.js +86 -0
  207. package/cache-dir/head/constants.js +15 -0
  208. package/cache-dir/head/head-export-handler-for-browser.js +170 -0
  209. package/cache-dir/head/head-export-handler-for-ssr.js +237 -0
  210. package/cache-dir/head/utils.js +287 -0
  211. package/cache-dir/loader.js +977 -0
  212. package/cache-dir/loading-indicator/index.js +19 -0
  213. package/cache-dir/loading-indicator/indicator.js +65 -0
  214. package/cache-dir/loading-indicator/style.js +99 -0
  215. package/cache-dir/navigation.js +257 -0
  216. package/cache-dir/normalize-page-path.js +17 -0
  217. package/cache-dir/page-renderer.js +59 -0
  218. package/cache-dir/page-ssr/index.d.ts +76 -0
  219. package/cache-dir/pages.json +1 -0
  220. package/cache-dir/polyfill-entry.js +5 -0
  221. package/cache-dir/prefetch.js +80 -0
  222. package/cache-dir/production-app.js +340 -0
  223. package/cache-dir/public-page-renderer-dev.js +21 -0
  224. package/cache-dir/public-page-renderer-prod.js +25 -0
  225. package/cache-dir/public-page-renderer.js +9 -0
  226. package/cache-dir/query-engine/index.d.ts +31 -0
  227. package/cache-dir/query-result-store.js +197 -0
  228. package/cache-dir/react-dom-utils.js +38 -0
  229. package/cache-dir/react-lifecycles-compat.js +1 -0
  230. package/cache-dir/redirect-utils.js +22 -0
  231. package/cache-dir/redirects.json +1 -0
  232. package/cache-dir/register-service-worker.js +64 -0
  233. package/cache-dir/root.js +147 -0
  234. package/cache-dir/route-announcer-props.js +18 -0
  235. package/cache-dir/server-utils/writable-as-promise.js +41 -0
  236. package/cache-dir/shadow-portal.js +28 -0
  237. package/cache-dir/slice/context.js +13 -0
  238. package/cache-dir/slice/inline-slice.js +34 -0
  239. package/cache-dir/slice/server-slice-renderer.js +28 -0
  240. package/cache-dir/slice/server-slice.js +52 -0
  241. package/cache-dir/slice.js +158 -0
  242. package/cache-dir/socketIo.js +58 -0
  243. package/cache-dir/ssr-builtin-trackers/child_process.js +4 -0
  244. package/cache-dir/ssr-builtin-trackers/fs.js +3 -0
  245. package/cache-dir/ssr-builtin-trackers/http.js +3 -0
  246. package/cache-dir/ssr-builtin-trackers/http2.js +3 -0
  247. package/cache-dir/ssr-builtin-trackers/https.js +3 -0
  248. package/cache-dir/ssr-builtin-trackers/tracking-unsafe-module-wrapper.js +64 -0
  249. package/cache-dir/ssr-develop-static-entry.js +428 -0
  250. package/cache-dir/static-entry.js +594 -0
  251. package/cache-dir/static-query.js +91 -0
  252. package/cache-dir/strip-prefix.js +20 -0
  253. package/changes.json +454 -0
  254. package/cli.js +3 -0
  255. package/dist/bin/gatsby.js +5 -0
  256. package/dist/bin/gatsby.js.map +1 -0
  257. package/dist/bootstrap/__mocks__/get-config/ts/gatsby-config.d.ts +3 -0
  258. package/dist/bootstrap/__mocks__/resolve-module-exports.d.ts +1 -0
  259. package/dist/bootstrap/create-graphql-runner.d.ts +10 -0
  260. package/dist/bootstrap/create-graphql-runner.js +71 -0
  261. package/dist/bootstrap/create-graphql-runner.js.map +1 -0
  262. package/dist/bootstrap/get-config-file.d.ts +4 -0
  263. package/dist/bootstrap/get-config-file.js +152 -0
  264. package/dist/bootstrap/get-config-file.js.map +1 -0
  265. package/dist/bootstrap/index.d.ts +12 -0
  266. package/dist/bootstrap/index.js +56 -0
  267. package/dist/bootstrap/index.js.map +1 -0
  268. package/dist/bootstrap/load-config/index.d.ts +7 -0
  269. package/dist/bootstrap/load-config/index.js +73 -0
  270. package/dist/bootstrap/load-config/index.js.map +1 -0
  271. package/dist/bootstrap/load-plugins/index.d.ts +3 -0
  272. package/dist/bootstrap/load-plugins/index.js +79 -0
  273. package/dist/bootstrap/load-plugins/index.js.map +1 -0
  274. package/dist/bootstrap/load-plugins/load-internal-plugins.d.ts +2 -0
  275. package/dist/bootstrap/load-plugins/load-internal-plugins.js +105 -0
  276. package/dist/bootstrap/load-plugins/load-internal-plugins.js.map +1 -0
  277. package/dist/bootstrap/load-plugins/process-plugin.d.ts +2 -0
  278. package/dist/bootstrap/load-plugins/process-plugin.js +81 -0
  279. package/dist/bootstrap/load-plugins/process-plugin.js.map +1 -0
  280. package/dist/bootstrap/load-plugins/resolve-plugin.d.ts +13 -0
  281. package/dist/bootstrap/load-plugins/resolve-plugin.js +75 -0
  282. package/dist/bootstrap/load-plugins/resolve-plugin.js.map +1 -0
  283. package/dist/bootstrap/load-plugins/types.d.ts +48 -0
  284. package/dist/bootstrap/load-plugins/types.js +4 -0
  285. package/dist/bootstrap/load-plugins/types.js.map +1 -0
  286. package/dist/bootstrap/load-plugins/utils/check-local-plugin.d.ts +8 -0
  287. package/dist/bootstrap/load-plugins/utils/check-local-plugin.js +38 -0
  288. package/dist/bootstrap/load-plugins/utils/check-local-plugin.js.map +1 -0
  289. package/dist/bootstrap/load-plugins/utils/create-hash.d.ts +1 -0
  290. package/dist/bootstrap/load-plugins/utils/create-hash.js +20 -0
  291. package/dist/bootstrap/load-plugins/utils/create-hash.js.map +1 -0
  292. package/dist/bootstrap/load-plugins/utils/create-id.d.ts +10 -0
  293. package/dist/bootstrap/load-plugins/utils/create-id.js +16 -0
  294. package/dist/bootstrap/load-plugins/utils/create-id.js.map +1 -0
  295. package/dist/bootstrap/load-plugins/utils/flatten-plugins.d.ts +2 -0
  296. package/dist/bootstrap/load-plugins/utils/flatten-plugins.js +41 -0
  297. package/dist/bootstrap/load-plugins/utils/flatten-plugins.js.map +1 -0
  298. package/dist/bootstrap/load-plugins/utils/get-api.d.ts +12 -0
  299. package/dist/bootstrap/load-plugins/utils/get-api.js +12 -0
  300. package/dist/bootstrap/load-plugins/utils/get-api.js.map +1 -0
  301. package/dist/bootstrap/load-plugins/utils/normalize.d.ts +5 -0
  302. package/dist/bootstrap/load-plugins/utils/normalize.js +33 -0
  303. package/dist/bootstrap/load-plugins/utils/normalize.js.map +1 -0
  304. package/dist/bootstrap/load-plugins/validate.d.ts +41 -0
  305. package/dist/bootstrap/load-plugins/validate.js +369 -0
  306. package/dist/bootstrap/load-plugins/validate.js.map +1 -0
  307. package/dist/bootstrap/load-themes/index.d.ts +17 -0
  308. package/dist/bootstrap/load-themes/index.js +186 -0
  309. package/dist/bootstrap/load-themes/index.js.map +1 -0
  310. package/dist/bootstrap/log-line-function.d.ts +0 -0
  311. package/dist/bootstrap/log-line-function.js +19 -0
  312. package/dist/bootstrap/log-line-function.js.map +1 -0
  313. package/dist/bootstrap/prefer-default.d.ts +1 -0
  314. package/dist/bootstrap/prefer-default.js +7 -0
  315. package/dist/bootstrap/prefer-default.js.map +1 -0
  316. package/dist/bootstrap/redirects-writer.d.ts +2 -0
  317. package/dist/bootstrap/redirects-writer.js +59 -0
  318. package/dist/bootstrap/redirects-writer.js.map +1 -0
  319. package/dist/bootstrap/remove-stale-jobs.d.ts +2 -0
  320. package/dist/bootstrap/remove-stale-jobs.js +31 -0
  321. package/dist/bootstrap/remove-stale-jobs.js.map +1 -0
  322. package/dist/bootstrap/requires-writer.d.ts +11 -0
  323. package/dist/bootstrap/requires-writer.js +260 -0
  324. package/dist/bootstrap/requires-writer.js.map +1 -0
  325. package/dist/bootstrap/resolve-js-file-path.d.ts +14 -0
  326. package/dist/bootstrap/resolve-js-file-path.js +58 -0
  327. package/dist/bootstrap/resolve-js-file-path.js.map +1 -0
  328. package/dist/bootstrap/resolve-module-exports.d.ts +20 -0
  329. package/dist/bootstrap/resolve-module-exports.js +188 -0
  330. package/dist/bootstrap/resolve-module-exports.js.map +1 -0
  331. package/dist/bootstrap/schema-hot-reloader.d.ts +3 -0
  332. package/dist/bootstrap/schema-hot-reloader.js +60 -0
  333. package/dist/bootstrap/schema-hot-reloader.js.map +1 -0
  334. package/dist/cache/cache-fs.d.ts +1 -0
  335. package/dist/cache/cache-fs.js +270 -0
  336. package/dist/cache/cache-fs.js.map +1 -0
  337. package/dist/cache/json-file-store.d.ts +8 -0
  338. package/dist/cache/json-file-store.js +144 -0
  339. package/dist/cache/json-file-store.js.map +1 -0
  340. package/dist/cache/wrap-callback.d.ts +0 -0
  341. package/dist/cache/wrap-callback.js +49 -0
  342. package/dist/cache/wrap-callback.js.map +1 -0
  343. package/dist/commands/build-html.d.ts +69 -0
  344. package/dist/commands/build-html.js +652 -0
  345. package/dist/commands/build-html.js.map +1 -0
  346. package/dist/commands/build-javascript.d.ts +4 -0
  347. package/dist/commands/build-javascript.js +18 -0
  348. package/dist/commands/build-javascript.js.map +1 -0
  349. package/dist/commands/build-utils.d.ts +8 -0
  350. package/dist/commands/build-utils.js +186 -0
  351. package/dist/commands/build-utils.js.map +1 -0
  352. package/dist/commands/build.d.ts +1 -0
  353. package/dist/commands/build.js +505 -0
  354. package/dist/commands/build.js.map +1 -0
  355. package/dist/commands/clean.d.ts +1 -0
  356. package/dist/commands/clean.js +29 -0
  357. package/dist/commands/clean.js.map +1 -0
  358. package/dist/commands/develop-process.d.ts +1 -0
  359. package/dist/commands/develop-process.js +120 -0
  360. package/dist/commands/develop-process.js.map +1 -0
  361. package/dist/commands/develop-static.d.ts +3 -0
  362. package/dist/commands/develop-static.js +22 -0
  363. package/dist/commands/develop-static.js.map +1 -0
  364. package/dist/commands/develop.d.ts +2 -0
  365. package/dist/commands/develop.js +273 -0
  366. package/dist/commands/develop.js.map +1 -0
  367. package/dist/commands/feedback.d.ts +1 -0
  368. package/dist/commands/feedback.js +17 -0
  369. package/dist/commands/feedback.js.map +1 -0
  370. package/dist/commands/repl.d.ts +1 -0
  371. package/dist/commands/repl.js +58 -0
  372. package/dist/commands/repl.js.map +1 -0
  373. package/dist/commands/serve.d.ts +1 -0
  374. package/dist/commands/serve.js +282 -0
  375. package/dist/commands/serve.js.map +1 -0
  376. package/dist/commands/types.d.ts +54 -0
  377. package/dist/commands/types.js +23 -0
  378. package/dist/commands/types.js.map +1 -0
  379. package/dist/constants.d.ts +1 -0
  380. package/dist/constants.js +7 -0
  381. package/dist/constants.js.map +1 -0
  382. package/dist/datastore/common/iterable.d.ts +51 -0
  383. package/dist/datastore/common/iterable.js +217 -0
  384. package/dist/datastore/common/iterable.js.map +1 -0
  385. package/dist/datastore/common/query.d.ts +69 -0
  386. package/dist/datastore/common/query.js +219 -0
  387. package/dist/datastore/common/query.js.map +1 -0
  388. package/dist/datastore/datastore.d.ts +2 -0
  389. package/dist/datastore/datastore.js +23 -0
  390. package/dist/datastore/datastore.js.map +1 -0
  391. package/dist/datastore/in-memory/in-memory-datastore.d.ts +2 -0
  392. package/dist/datastore/in-memory/in-memory-datastore.js +75 -0
  393. package/dist/datastore/in-memory/in-memory-datastore.js.map +1 -0
  394. package/dist/datastore/in-memory/indexing.d.ts +80 -0
  395. package/dist/datastore/in-memory/indexing.js +994 -0
  396. package/dist/datastore/in-memory/indexing.js.map +1 -0
  397. package/dist/datastore/in-memory/run-fast-filters.d.ts +27 -0
  398. package/dist/datastore/in-memory/run-fast-filters.js +276 -0
  399. package/dist/datastore/in-memory/run-fast-filters.js.map +1 -0
  400. package/dist/datastore/index.d.ts +20 -0
  401. package/dist/datastore/index.js +34 -0
  402. package/dist/datastore/index.js.map +1 -0
  403. package/dist/datastore/lmdb/lmdb-datastore.d.ts +14 -0
  404. package/dist/datastore/lmdb/lmdb-datastore.js +261 -0
  405. package/dist/datastore/lmdb/lmdb-datastore.js.map +1 -0
  406. package/dist/datastore/lmdb/query/common.d.ts +23 -0
  407. package/dist/datastore/lmdb/query/common.js +127 -0
  408. package/dist/datastore/lmdb/query/common.js.map +1 -0
  409. package/dist/datastore/lmdb/query/create-index.d.ts +25 -0
  410. package/dist/datastore/lmdb/query/create-index.js +239 -0
  411. package/dist/datastore/lmdb/query/create-index.js.map +1 -0
  412. package/dist/datastore/lmdb/query/filter-using-index.d.ts +43 -0
  413. package/dist/datastore/lmdb/query/filter-using-index.js +577 -0
  414. package/dist/datastore/lmdb/query/filter-using-index.js.map +1 -0
  415. package/dist/datastore/lmdb/query/run-query.d.ts +9 -0
  416. package/dist/datastore/lmdb/query/run-query.js +285 -0
  417. package/dist/datastore/lmdb/query/run-query.js.map +1 -0
  418. package/dist/datastore/lmdb/query/suggest-index.d.ts +15 -0
  419. package/dist/datastore/lmdb/query/suggest-index.js +93 -0
  420. package/dist/datastore/lmdb/query/suggest-index.js.map +1 -0
  421. package/dist/datastore/lmdb/updates/nodes-by-type.d.ts +3 -0
  422. package/dist/datastore/lmdb/updates/nodes-by-type.js +21 -0
  423. package/dist/datastore/lmdb/updates/nodes-by-type.js.map +1 -0
  424. package/dist/datastore/lmdb/updates/nodes.d.ts +5 -0
  425. package/dist/datastore/lmdb/updates/nodes.js +33 -0
  426. package/dist/datastore/lmdb/updates/nodes.js.map +1 -0
  427. package/dist/datastore/types.d.ts +47 -0
  428. package/dist/datastore/types.js +4 -0
  429. package/dist/datastore/types.js.map +1 -0
  430. package/dist/internal-plugins/bundle-optimisations/gatsby-node.js +42 -0
  431. package/dist/internal-plugins/bundle-optimisations/gatsby-node.js.map +1 -0
  432. package/dist/internal-plugins/bundle-optimisations/index.js +3 -0
  433. package/dist/internal-plugins/bundle-optimisations/index.js.map +1 -0
  434. package/dist/internal-plugins/bundle-optimisations/package.json +10 -0
  435. package/dist/internal-plugins/bundle-optimisations/polyfills/fetch.js +4 -0
  436. package/dist/internal-plugins/bundle-optimisations/polyfills/fetch.js.map +1 -0
  437. package/dist/internal-plugins/bundle-optimisations/polyfills/no-op.js +3 -0
  438. package/dist/internal-plugins/bundle-optimisations/polyfills/no-op.js.map +1 -0
  439. package/dist/internal-plugins/bundle-optimisations/polyfills/object-assign.js +4 -0
  440. package/dist/internal-plugins/bundle-optimisations/polyfills/object-assign.js.map +1 -0
  441. package/dist/internal-plugins/bundle-optimisations/polyfills/whatwg-fetch.js +6 -0
  442. package/dist/internal-plugins/bundle-optimisations/polyfills/whatwg-fetch.js.map +1 -0
  443. package/dist/internal-plugins/dev-404-page/gatsby-node.js +30 -0
  444. package/dist/internal-plugins/dev-404-page/gatsby-node.js.map +1 -0
  445. package/dist/internal-plugins/dev-404-page/index.js +3 -0
  446. package/dist/internal-plugins/dev-404-page/index.js.map +1 -0
  447. package/dist/internal-plugins/dev-404-page/package.json +11 -0
  448. package/dist/internal-plugins/dev-404-page/raw_dev-404-page.js +262 -0
  449. package/dist/internal-plugins/functions/api-function-webpack-loader.d.ts +3 -0
  450. package/dist/internal-plugins/functions/api-function-webpack-loader.js +74 -0
  451. package/dist/internal-plugins/functions/api-function-webpack-loader.js.map +1 -0
  452. package/dist/internal-plugins/functions/config.d.ts +20 -0
  453. package/dist/internal-plugins/functions/config.js +96 -0
  454. package/dist/internal-plugins/functions/config.js.map +1 -0
  455. package/dist/internal-plugins/functions/gatsby-node.d.ts +3 -0
  456. package/dist/internal-plugins/functions/gatsby-node.js +452 -0
  457. package/dist/internal-plugins/functions/gatsby-node.js.map +1 -0
  458. package/dist/internal-plugins/functions/index.js +3 -0
  459. package/dist/internal-plugins/functions/index.js.map +1 -0
  460. package/dist/internal-plugins/functions/middleware.d.ts +11 -0
  461. package/dist/internal-plugins/functions/middleware.js +160 -0
  462. package/dist/internal-plugins/functions/middleware.js.map +1 -0
  463. package/dist/internal-plugins/functions/package.json +11 -0
  464. package/dist/internal-plugins/internal-data-bridge/gatsby-node.js +191 -0
  465. package/dist/internal-plugins/internal-data-bridge/gatsby-node.js.map +1 -0
  466. package/dist/internal-plugins/internal-data-bridge/index.js +3 -0
  467. package/dist/internal-plugins/internal-data-bridge/index.js.map +1 -0
  468. package/dist/internal-plugins/internal-data-bridge/package.json +11 -0
  469. package/dist/internal-plugins/load-babel-config/gatsby-node.js +37 -0
  470. package/dist/internal-plugins/load-babel-config/gatsby-node.js.map +1 -0
  471. package/dist/internal-plugins/load-babel-config/index.js +3 -0
  472. package/dist/internal-plugins/load-babel-config/index.js.map +1 -0
  473. package/dist/internal-plugins/load-babel-config/package.json +11 -0
  474. package/dist/internal-plugins/partytown/gatsby-browser.js +23 -0
  475. package/dist/internal-plugins/partytown/gatsby-browser.js.map +1 -0
  476. package/dist/internal-plugins/partytown/gatsby-node.d.ts +2 -0
  477. package/dist/internal-plugins/partytown/gatsby-node.js +60 -0
  478. package/dist/internal-plugins/partytown/gatsby-node.js.map +1 -0
  479. package/dist/internal-plugins/partytown/gatsby-ssr.js +39 -0
  480. package/dist/internal-plugins/partytown/gatsby-ssr.js.map +1 -0
  481. package/dist/internal-plugins/partytown/index.js +3 -0
  482. package/dist/internal-plugins/partytown/index.js.map +1 -0
  483. package/dist/internal-plugins/partytown/package.json +12 -0
  484. package/dist/internal-plugins/partytown/proxy.d.ts +3 -0
  485. package/dist/internal-plugins/partytown/proxy.js +26 -0
  486. package/dist/internal-plugins/partytown/proxy.js.map +1 -0
  487. package/dist/internal-plugins/partytown/utils/get-forwards.d.ts +2 -0
  488. package/dist/internal-plugins/partytown/utils/get-forwards.js +8 -0
  489. package/dist/internal-plugins/partytown/utils/get-forwards.js.map +1 -0
  490. package/dist/internal-plugins/partytown/utils/inject-partytown-snippet.d.ts +2 -0
  491. package/dist/internal-plugins/partytown/utils/inject-partytown-snippet.js +28 -0
  492. package/dist/internal-plugins/partytown/utils/inject-partytown-snippet.js.map +1 -0
  493. package/dist/internal-plugins/prod-404-500/gatsby-node.js +50 -0
  494. package/dist/internal-plugins/prod-404-500/gatsby-node.js.map +1 -0
  495. package/dist/internal-plugins/prod-404-500/index.js +3 -0
  496. package/dist/internal-plugins/prod-404-500/index.js.map +1 -0
  497. package/dist/internal-plugins/prod-404-500/package.json +11 -0
  498. package/dist/internal-plugins/webpack-theme-component-shadowing/create-page.js +31 -0
  499. package/dist/internal-plugins/webpack-theme-component-shadowing/create-page.js.map +1 -0
  500. package/dist/internal-plugins/webpack-theme-component-shadowing/gatsby-node.js +31 -0
  501. package/dist/internal-plugins/webpack-theme-component-shadowing/gatsby-node.js.map +1 -0
  502. package/dist/internal-plugins/webpack-theme-component-shadowing/index.js +273 -0
  503. package/dist/internal-plugins/webpack-theme-component-shadowing/index.js.map +1 -0
  504. package/dist/internal-plugins/webpack-theme-component-shadowing/package.json +11 -0
  505. package/dist/internal.d.ts +5 -0
  506. package/dist/internal.js +34 -0
  507. package/dist/internal.js.map +1 -0
  508. package/dist/joi-schemas/joi.d.ts +5 -0
  509. package/dist/joi-schemas/joi.js +122 -0
  510. package/dist/joi-schemas/joi.js.map +1 -0
  511. package/dist/query/error-parser.d.ts +19 -0
  512. package/dist/query/error-parser.js +163 -0
  513. package/dist/query/error-parser.js.map +1 -0
  514. package/dist/query/file-parser.js +584 -0
  515. package/dist/query/file-parser.js.map +1 -0
  516. package/dist/query/graphql-errors-codeframe.d.ts +1 -0
  517. package/dist/query/graphql-errors-codeframe.js +20 -0
  518. package/dist/query/graphql-errors-codeframe.js.map +1 -0
  519. package/dist/query/graphql-errors.js +278 -0
  520. package/dist/query/graphql-errors.js.map +1 -0
  521. package/dist/query/graphql-runner.d.ts +39 -0
  522. package/dist/query/graphql-runner.js +221 -0
  523. package/dist/query/graphql-runner.js.map +1 -0
  524. package/dist/query/graphql-span-tracer.d.ts +19 -0
  525. package/dist/query/graphql-span-tracer.js +63 -0
  526. package/dist/query/graphql-span-tracer.js.map +1 -0
  527. package/dist/query/index.d.ts +32 -0
  528. package/dist/query/index.js +301 -0
  529. package/dist/query/index.js.map +1 -0
  530. package/dist/query/query-compiler.js +433 -0
  531. package/dist/query/query-compiler.js.map +1 -0
  532. package/dist/query/query-runner.d.ts +13 -0
  533. package/dist/query/query-runner.js +176 -0
  534. package/dist/query/query-runner.js.map +1 -0
  535. package/dist/query/query-watcher.d.ts +17 -0
  536. package/dist/query/query-watcher.js +250 -0
  537. package/dist/query/query-watcher.js.map +1 -0
  538. package/dist/query/transform-document.d.ts +6 -0
  539. package/dist/query/transform-document.js +131 -0
  540. package/dist/query/transform-document.js.map +1 -0
  541. package/dist/query/types.d.ts +35 -0
  542. package/dist/query/types.js +4 -0
  543. package/dist/query/types.js.map +1 -0
  544. package/dist/query/utils.d.ts +4 -0
  545. package/dist/query/utils.js +20 -0
  546. package/dist/query/utils.js.map +1 -0
  547. package/dist/redux/actions/add-page-dependency.d.ts +7 -0
  548. package/dist/redux/actions/add-page-dependency.js +52 -0
  549. package/dist/redux/actions/add-page-dependency.js.map +1 -0
  550. package/dist/redux/actions/index.d.ts +16 -0
  551. package/dist/redux/actions/index.js +21 -0
  552. package/dist/redux/actions/index.js.map +1 -0
  553. package/dist/redux/actions/internal.d.ts +124 -0
  554. package/dist/redux/actions/internal.js +394 -0
  555. package/dist/redux/actions/internal.js.map +1 -0
  556. package/dist/redux/actions/public.js +1354 -0
  557. package/dist/redux/actions/public.js.map +1 -0
  558. package/dist/redux/actions/restricted.d.ts +332 -0
  559. package/dist/redux/actions/restricted.js +521 -0
  560. package/dist/redux/actions/restricted.js.map +1 -0
  561. package/dist/redux/index.d.ts +20 -0
  562. package/dist/redux/index.js +125 -0
  563. package/dist/redux/index.js.map +1 -0
  564. package/dist/redux/persist.d.ts +5 -0
  565. package/dist/redux/persist.js +191 -0
  566. package/dist/redux/persist.js.map +1 -0
  567. package/dist/redux/plugin-runner.d.ts +1 -0
  568. package/dist/redux/plugin-runner.js +45 -0
  569. package/dist/redux/plugin-runner.js.map +1 -0
  570. package/dist/redux/reducers/adapter.d.ts +6 -0
  571. package/dist/redux/reducers/adapter.js +22 -0
  572. package/dist/redux/reducers/adapter.js.map +1 -0
  573. package/dist/redux/reducers/babelrc.d.ts +9 -0
  574. package/dist/redux/reducers/babelrc.js +104 -0
  575. package/dist/redux/reducers/babelrc.js.map +1 -0
  576. package/dist/redux/reducers/components-using-slices.d.ts +2 -0
  577. package/dist/redux/reducers/components-using-slices.js +15 -0
  578. package/dist/redux/reducers/components-using-slices.js.map +1 -0
  579. package/dist/redux/reducers/components.d.ts +2 -0
  580. package/dist/redux/reducers/components.js +104 -0
  581. package/dist/redux/reducers/components.js.map +1 -0
  582. package/dist/redux/reducers/config.d.ts +2 -0
  583. package/dist/redux/reducers/config.js +16 -0
  584. package/dist/redux/reducers/config.js.map +1 -0
  585. package/dist/redux/reducers/definitions.d.ts +2 -0
  586. package/dist/redux/reducers/definitions.js +14 -0
  587. package/dist/redux/reducers/definitions.js.map +1 -0
  588. package/dist/redux/reducers/flattened-plugins.d.ts +17 -0
  589. package/dist/redux/reducers/flattened-plugins.js +14 -0
  590. package/dist/redux/reducers/flattened-plugins.js.map +1 -0
  591. package/dist/redux/reducers/functions.d.ts +2 -0
  592. package/dist/redux/reducers/functions.js +14 -0
  593. package/dist/redux/reducers/functions.js.map +1 -0
  594. package/dist/redux/reducers/html.d.ts +25 -0
  595. package/dist/redux/reducers/html.js +384 -0
  596. package/dist/redux/reducers/html.js.map +1 -0
  597. package/dist/redux/reducers/index.d.ts +45 -0
  598. package/dist/redux/reducers/index.js +86 -0
  599. package/dist/redux/reducers/index.js.map +1 -0
  600. package/dist/redux/reducers/inference-metadata.d.ts +7 -0
  601. package/dist/redux/reducers/inference-metadata.js +174 -0
  602. package/dist/redux/reducers/inference-metadata.js.map +1 -0
  603. package/dist/redux/reducers/jobs.d.ts +5 -0
  604. package/dist/redux/reducers/jobs.js +65 -0
  605. package/dist/redux/reducers/jobs.js.map +1 -0
  606. package/dist/redux/reducers/jobsv2.d.ts +6 -0
  607. package/dist/redux/reducers/jobsv2.js +88 -0
  608. package/dist/redux/reducers/jobsv2.js.map +1 -0
  609. package/dist/redux/reducers/last-action.d.ts +2 -0
  610. package/dist/redux/reducers/last-action.js +7 -0
  611. package/dist/redux/reducers/last-action.js.map +1 -0
  612. package/dist/redux/reducers/node-manifest.d.ts +2 -0
  613. package/dist/redux/reducers/node-manifest.js +58 -0
  614. package/dist/redux/reducers/node-manifest.js.map +1 -0
  615. package/dist/redux/reducers/nodes-by-type.d.ts +2 -0
  616. package/dist/redux/reducers/nodes-by-type.js +53 -0
  617. package/dist/redux/reducers/nodes-by-type.js.map +1 -0
  618. package/dist/redux/reducers/nodes-touched.d.ts +3 -0
  619. package/dist/redux/reducers/nodes-touched.js +18 -0
  620. package/dist/redux/reducers/nodes-touched.js.map +1 -0
  621. package/dist/redux/reducers/nodes.d.ts +2 -0
  622. package/dist/redux/reducers/nodes.js +30 -0
  623. package/dist/redux/reducers/nodes.js.map +1 -0
  624. package/dist/redux/reducers/page-data-stats.d.ts +2 -0
  625. package/dist/redux/reducers/page-data-stats.js +15 -0
  626. package/dist/redux/reducers/page-data-stats.js.map +1 -0
  627. package/dist/redux/reducers/pages.d.ts +2 -0
  628. package/dist/redux/reducers/pages.js +43 -0
  629. package/dist/redux/reducers/pages.js.map +1 -0
  630. package/dist/redux/reducers/pending-page-data-writes.d.ts +5 -0
  631. package/dist/redux/reducers/pending-page-data-writes.js +66 -0
  632. package/dist/redux/reducers/pending-page-data-writes.js.map +1 -0
  633. package/dist/redux/reducers/program.d.ts +2 -0
  634. package/dist/redux/reducers/program.js +62 -0
  635. package/dist/redux/reducers/program.js.map +1 -0
  636. package/dist/redux/reducers/queries.d.ts +26 -0
  637. package/dist/redux/reducers/queries.js +403 -0
  638. package/dist/redux/reducers/queries.js.map +1 -0
  639. package/dist/redux/reducers/redirects.d.ts +2 -0
  640. package/dist/redux/reducers/redirects.js +39 -0
  641. package/dist/redux/reducers/redirects.js.map +1 -0
  642. package/dist/redux/reducers/remote-file-allowed-urls.d.ts +2 -0
  643. package/dist/redux/reducers/remote-file-allowed-urls.js +19 -0
  644. package/dist/redux/reducers/remote-file-allowed-urls.js.map +1 -0
  645. package/dist/redux/reducers/resolved-nodes.d.ts +2 -0
  646. package/dist/redux/reducers/resolved-nodes.js +45 -0
  647. package/dist/redux/reducers/resolved-nodes.js.map +1 -0
  648. package/dist/redux/reducers/schema-customization.d.ts +23 -0
  649. package/dist/redux/reducers/schema-customization.js +103 -0
  650. package/dist/redux/reducers/schema-customization.js.map +1 -0
  651. package/dist/redux/reducers/schema.d.ts +3 -0
  652. package/dist/redux/reducers/schema.js +17 -0
  653. package/dist/redux/reducers/schema.js.map +1 -0
  654. package/dist/redux/reducers/set-request-headers.d.ts +7 -0
  655. package/dist/redux/reducers/set-request-headers.js +24 -0
  656. package/dist/redux/reducers/set-request-headers.js.map +1 -0
  657. package/dist/redux/reducers/slices-by-template.d.ts +2 -0
  658. package/dist/redux/reducers/slices-by-template.js +16 -0
  659. package/dist/redux/reducers/slices-by-template.js.map +1 -0
  660. package/dist/redux/reducers/slices.d.ts +2 -0
  661. package/dist/redux/reducers/slices.js +22 -0
  662. package/dist/redux/reducers/slices.js.map +1 -0
  663. package/dist/redux/reducers/stateful-source-plugins.d.ts +5 -0
  664. package/dist/redux/reducers/stateful-source-plugins.js +20 -0
  665. package/dist/redux/reducers/stateful-source-plugins.js.map +1 -0
  666. package/dist/redux/reducers/static-queries-by-template.d.ts +2 -0
  667. package/dist/redux/reducers/static-queries-by-template.js +19 -0
  668. package/dist/redux/reducers/static-queries-by-template.js.map +1 -0
  669. package/dist/redux/reducers/static-query-components.d.ts +2 -0
  670. package/dist/redux/reducers/static-query-components.js +18 -0
  671. package/dist/redux/reducers/static-query-components.js.map +1 -0
  672. package/dist/redux/reducers/status.d.ts +7 -0
  673. package/dist/redux/reducers/status.js +57 -0
  674. package/dist/redux/reducers/status.js.map +1 -0
  675. package/dist/redux/reducers/telemetry.d.ts +2 -0
  676. package/dist/redux/reducers/telemetry.js +46 -0
  677. package/dist/redux/reducers/telemetry.js.map +1 -0
  678. package/dist/redux/reducers/type-owners.d.ts +5 -0
  679. package/dist/redux/reducers/type-owners.js +102 -0
  680. package/dist/redux/reducers/type-owners.js.map +1 -0
  681. package/dist/redux/reducers/visited-page.d.ts +2 -0
  682. package/dist/redux/reducers/visited-page.js +31 -0
  683. package/dist/redux/reducers/visited-page.js.map +1 -0
  684. package/dist/redux/reducers/webpack-compilation-hash.d.ts +2 -0
  685. package/dist/redux/reducers/webpack-compilation-hash.js +14 -0
  686. package/dist/redux/reducers/webpack-compilation-hash.js.map +1 -0
  687. package/dist/redux/reducers/webpack.d.ts +2 -0
  688. package/dist/redux/reducers/webpack.js +27 -0
  689. package/dist/redux/reducers/webpack.js.map +1 -0
  690. package/dist/redux/save-state.js +19 -0
  691. package/dist/redux/save-state.js.map +1 -0
  692. package/dist/redux/types.d.ts +1337 -0
  693. package/dist/redux/types.js +326 -0
  694. package/dist/redux/types.js.map +1 -0
  695. package/dist/schema/context.d.ts +14 -0
  696. package/dist/schema/context.js +38 -0
  697. package/dist/schema/context.js.map +1 -0
  698. package/dist/schema/extensions/index.js +205 -0
  699. package/dist/schema/extensions/index.js.map +1 -0
  700. package/dist/schema/graphql-engine/bootstrap.d.ts +2 -0
  701. package/dist/schema/graphql-engine/bootstrap.js +12 -0
  702. package/dist/schema/graphql-engine/bootstrap.js.map +1 -0
  703. package/dist/schema/graphql-engine/bundle-webpack.d.ts +5 -0
  704. package/dist/schema/graphql-engine/bundle-webpack.js +446 -0
  705. package/dist/schema/graphql-engine/bundle-webpack.js.map +1 -0
  706. package/dist/schema/graphql-engine/entry.d.ts +23 -0
  707. package/dist/schema/graphql-engine/entry.js +204 -0
  708. package/dist/schema/graphql-engine/entry.js.map +1 -0
  709. package/dist/schema/graphql-engine/lmdb-bundling-patch.d.ts +1 -0
  710. package/dist/schema/graphql-engine/lmdb-bundling-patch.js +72 -0
  711. package/dist/schema/graphql-engine/lmdb-bundling-patch.js.map +1 -0
  712. package/dist/schema/graphql-engine/platform-and-arch-check.d.ts +0 -0
  713. package/dist/schema/graphql-engine/platform-and-arch-check.js +6 -0
  714. package/dist/schema/graphql-engine/platform-and-arch-check.js.map +1 -0
  715. package/dist/schema/graphql-engine/print-plugins.d.ts +2 -0
  716. package/dist/schema/graphql-engine/print-plugins.js +145 -0
  717. package/dist/schema/graphql-engine/print-plugins.js.map +1 -0
  718. package/dist/schema/graphql-engine/sharp-bundling-patch.d.ts +1 -0
  719. package/dist/schema/graphql-engine/sharp-bundling-patch.js +8 -0
  720. package/dist/schema/graphql-engine/sharp-bundling-patch.js.map +1 -0
  721. package/dist/schema/graphql-engine/shims/gatsby-sharp.js +10 -0
  722. package/dist/schema/graphql-engine/shims/gatsby-sharp.js.map +1 -0
  723. package/dist/schema/graphql-engine/shims/no-op-module.js +3 -0
  724. package/dist/schema/graphql-engine/shims/no-op-module.js.map +1 -0
  725. package/dist/schema/graphql-engine/shims/ts-node.js +17 -0
  726. package/dist/schema/graphql-engine/shims/ts-node.js.map +1 -0
  727. package/dist/schema/graphql-engine/standalone-regenerate.d.ts +2 -0
  728. package/dist/schema/graphql-engine/standalone-regenerate.js +73 -0
  729. package/dist/schema/graphql-engine/standalone-regenerate.js.map +1 -0
  730. package/dist/schema/index.js +189 -0
  731. package/dist/schema/index.js.map +1 -0
  732. package/dist/schema/infer/add-inferred-fields.js +413 -0
  733. package/dist/schema/infer/add-inferred-fields.js.map +1 -0
  734. package/dist/schema/infer/build-example-data.d.ts +5 -0
  735. package/dist/schema/infer/build-example-data.js +199 -0
  736. package/dist/schema/infer/build-example-data.js.map +1 -0
  737. package/dist/schema/infer/index.js +121 -0
  738. package/dist/schema/infer/index.js.map +1 -0
  739. package/dist/schema/infer/inference-metadata.d.ts +72 -0
  740. package/dist/schema/infer/inference-metadata.js +280 -0
  741. package/dist/schema/infer/inference-metadata.js.map +1 -0
  742. package/dist/schema/infer/is-file.d.ts +1 -0
  743. package/dist/schema/infer/is-file.js +65 -0
  744. package/dist/schema/infer/is-file.js.map +1 -0
  745. package/dist/schema/infer/type-conflict-reporter.d.ts +28 -0
  746. package/dist/schema/infer/type-conflict-reporter.js +104 -0
  747. package/dist/schema/infer/type-conflict-reporter.js.map +1 -0
  748. package/dist/schema/node-model.js +784 -0
  749. package/dist/schema/node-model.js.map +1 -0
  750. package/dist/schema/print.d.ts +20 -0
  751. package/dist/schema/print.js +279 -0
  752. package/dist/schema/print.js.map +1 -0
  753. package/dist/schema/resolvers.d.ts +40 -0
  754. package/dist/schema/resolvers.js +569 -0
  755. package/dist/schema/resolvers.js.map +1 -0
  756. package/dist/schema/schema-composer.d.ts +3 -0
  757. package/dist/schema/schema-composer.js +31 -0
  758. package/dist/schema/schema-composer.js.map +1 -0
  759. package/dist/schema/schema.js +1295 -0
  760. package/dist/schema/schema.js.map +1 -0
  761. package/dist/schema/type-definitions.d.ts +47 -0
  762. package/dist/schema/type-definitions.js +4 -0
  763. package/dist/schema/type-definitions.js.map +1 -0
  764. package/dist/schema/types/built-in-types.d.ts +5 -0
  765. package/dist/schema/types/built-in-types.js +139 -0
  766. package/dist/schema/types/built-in-types.js.map +1 -0
  767. package/dist/schema/types/date.d.ts +37 -0
  768. package/dist/schema/types/date.js +225 -0
  769. package/dist/schema/types/date.js.map +1 -0
  770. package/dist/schema/types/derived-types.d.ts +45 -0
  771. package/dist/schema/types/derived-types.js +108 -0
  772. package/dist/schema/types/derived-types.js.map +1 -0
  773. package/dist/schema/types/filter.d.ts +12 -0
  774. package/dist/schema/types/filter.js +105 -0
  775. package/dist/schema/types/filter.js.map +1 -0
  776. package/dist/schema/types/media.d.ts +2 -0
  777. package/dist/schema/types/media.js +10 -0
  778. package/dist/schema/types/media.js.map +1 -0
  779. package/dist/schema/types/node-interface.d.ts +14 -0
  780. package/dist/schema/types/node-interface.js +103 -0
  781. package/dist/schema/types/node-interface.js.map +1 -0
  782. package/dist/schema/types/pagination.d.ts +16 -0
  783. package/dist/schema/types/pagination.js +198 -0
  784. package/dist/schema/types/pagination.js.map +1 -0
  785. package/dist/schema/types/remote-file-interface.d.ts +3 -0
  786. package/dist/schema/types/remote-file-interface.js +34 -0
  787. package/dist/schema/types/remote-file-interface.js.map +1 -0
  788. package/dist/schema/types/sort.d.ts +24 -0
  789. package/dist/schema/types/sort.js +178 -0
  790. package/dist/schema/types/sort.js.map +1 -0
  791. package/dist/schema/types/type-builders.d.ts +36 -0
  792. package/dist/schema/types/type-builders.js +61 -0
  793. package/dist/schema/types/type-builders.js.map +1 -0
  794. package/dist/schema/types/type-defs.js +86 -0
  795. package/dist/schema/types/type-defs.js.map +1 -0
  796. package/dist/schema/types/utils.d.ts +33 -0
  797. package/dist/schema/types/utils.js +153 -0
  798. package/dist/schema/types/utils.js.map +1 -0
  799. package/dist/schema/utils.d.ts +28 -0
  800. package/dist/schema/utils.js +149 -0
  801. package/dist/schema/utils.js.map +1 -0
  802. package/dist/services/build-schema.d.ts +2 -0
  803. package/dist/services/build-schema.js +24 -0
  804. package/dist/services/build-schema.js.map +1 -0
  805. package/dist/services/calculate-dirty-queries.d.ts +5 -0
  806. package/dist/services/calculate-dirty-queries.js +44 -0
  807. package/dist/services/calculate-dirty-queries.js.map +1 -0
  808. package/dist/services/create-pages.d.ts +5 -0
  809. package/dist/services/create-pages.js +108 -0
  810. package/dist/services/create-pages.js.map +1 -0
  811. package/dist/services/customize-schema.d.ts +2 -0
  812. package/dist/services/customize-schema.js +26 -0
  813. package/dist/services/customize-schema.js.map +1 -0
  814. package/dist/services/extract-queries.d.ts +2 -0
  815. package/dist/services/extract-queries.js +24 -0
  816. package/dist/services/extract-queries.js.map +1 -0
  817. package/dist/services/graphql-typegen.d.ts +2 -0
  818. package/dist/services/graphql-typegen.js +46 -0
  819. package/dist/services/graphql-typegen.js.map +1 -0
  820. package/dist/services/index.d.ts +19 -0
  821. package/dist/services/index.js +68 -0
  822. package/dist/services/index.js.map +1 -0
  823. package/dist/services/initialize.d.ts +14 -0
  824. package/dist/services/initialize.js +519 -0
  825. package/dist/services/initialize.js.map +1 -0
  826. package/dist/services/listen-for-mutations.d.ts +2 -0
  827. package/dist/services/listen-for-mutations.js +59 -0
  828. package/dist/services/listen-for-mutations.js.map +1 -0
  829. package/dist/services/listen-to-webpack.d.ts +3 -0
  830. package/dist/services/listen-to-webpack.js +17 -0
  831. package/dist/services/listen-to-webpack.js.map +1 -0
  832. package/dist/services/post-bootstrap.d.ts +2 -0
  833. package/dist/services/post-bootstrap.js +29 -0
  834. package/dist/services/post-bootstrap.js.map +1 -0
  835. package/dist/services/recompile.d.ts +3 -0
  836. package/dist/services/recompile.js +67 -0
  837. package/dist/services/recompile.js.map +1 -0
  838. package/dist/services/run-mutation-batch.d.ts +2 -0
  839. package/dist/services/run-mutation-batch.js +12 -0
  840. package/dist/services/run-mutation-batch.js.map +1 -0
  841. package/dist/services/run-page-queries.d.ts +2 -0
  842. package/dist/services/run-page-queries.js +38 -0
  843. package/dist/services/run-page-queries.js.map +1 -0
  844. package/dist/services/run-slice-queries.d.ts +2 -0
  845. package/dist/services/run-slice-queries.js +40 -0
  846. package/dist/services/run-slice-queries.js.map +1 -0
  847. package/dist/services/run-static-queries.d.ts +2 -0
  848. package/dist/services/run-static-queries.js +38 -0
  849. package/dist/services/run-static-queries.js.map +1 -0
  850. package/dist/services/source-nodes.d.ts +5 -0
  851. package/dist/services/source-nodes.js +47 -0
  852. package/dist/services/source-nodes.js.map +1 -0
  853. package/dist/services/start-webpack-server.d.ts +9 -0
  854. package/dist/services/start-webpack-server.js +103 -0
  855. package/dist/services/start-webpack-server.js.map +1 -0
  856. package/dist/services/types.d.ts +53 -0
  857. package/dist/services/types.js +4 -0
  858. package/dist/services/types.js.map +1 -0
  859. package/dist/services/write-out-redirects.d.ts +2 -0
  860. package/dist/services/write-out-redirects.js +20 -0
  861. package/dist/services/write-out-redirects.js.map +1 -0
  862. package/dist/services/write-out-requires.d.ts +2 -0
  863. package/dist/services/write-out-requires.js +27 -0
  864. package/dist/services/write-out-requires.js.map +1 -0
  865. package/dist/state-machines/data-layer/actions.d.ts +11 -0
  866. package/dist/state-machines/data-layer/actions.js +38 -0
  867. package/dist/state-machines/data-layer/actions.js.map +1 -0
  868. package/dist/state-machines/data-layer/index.d.ts +24 -0
  869. package/dist/state-machines/data-layer/index.js +152 -0
  870. package/dist/state-machines/data-layer/index.js.map +1 -0
  871. package/dist/state-machines/data-layer/services.d.ts +3 -0
  872. package/dist/state-machines/data-layer/services.js +14 -0
  873. package/dist/state-machines/data-layer/services.js.map +1 -0
  874. package/dist/state-machines/data-layer/types.d.ts +27 -0
  875. package/dist/state-machines/data-layer/types.js +4 -0
  876. package/dist/state-machines/data-layer/types.js.map +1 -0
  877. package/dist/state-machines/develop/actions.d.ts +68 -0
  878. package/dist/state-machines/develop/actions.js +259 -0
  879. package/dist/state-machines/develop/actions.js.map +1 -0
  880. package/dist/state-machines/develop/index.d.ts +5 -0
  881. package/dist/state-machines/develop/index.js +372 -0
  882. package/dist/state-machines/develop/index.js.map +1 -0
  883. package/dist/state-machines/develop/services.d.ts +3 -0
  884. package/dist/state-machines/develop/services.js +22 -0
  885. package/dist/state-machines/develop/services.js.map +1 -0
  886. package/dist/state-machines/index.d.ts +7 -0
  887. package/dist/state-machines/index.js +21 -0
  888. package/dist/state-machines/index.js.map +1 -0
  889. package/dist/state-machines/query-running/actions.d.ts +9 -0
  890. package/dist/state-machines/query-running/actions.js +55 -0
  891. package/dist/state-machines/query-running/actions.js.map +1 -0
  892. package/dist/state-machines/query-running/index.d.ts +7 -0
  893. package/dist/state-machines/query-running/index.js +142 -0
  894. package/dist/state-machines/query-running/index.js.map +1 -0
  895. package/dist/state-machines/query-running/services.d.ts +3 -0
  896. package/dist/state-machines/query-running/services.js +17 -0
  897. package/dist/state-machines/query-running/services.js.map +1 -0
  898. package/dist/state-machines/query-running/types.d.ts +26 -0
  899. package/dist/state-machines/query-running/types.js +4 -0
  900. package/dist/state-machines/query-running/types.js.map +1 -0
  901. package/dist/state-machines/waiting/actions.d.ts +11 -0
  902. package/dist/state-machines/waiting/actions.js +36 -0
  903. package/dist/state-machines/waiting/actions.js.map +1 -0
  904. package/dist/state-machines/waiting/index.d.ts +12 -0
  905. package/dist/state-machines/waiting/index.js +145 -0
  906. package/dist/state-machines/waiting/index.js.map +1 -0
  907. package/dist/state-machines/waiting/services.d.ts +3 -0
  908. package/dist/state-machines/waiting/services.js +10 -0
  909. package/dist/state-machines/waiting/services.js.map +1 -0
  910. package/dist/state-machines/waiting/types.d.ts +12 -0
  911. package/dist/state-machines/waiting/types.js +4 -0
  912. package/dist/state-machines/waiting/types.js.map +1 -0
  913. package/dist/types.d.ts +9 -0
  914. package/dist/types.js +4 -0
  915. package/dist/types.js.map +1 -0
  916. package/dist/utils/adapter/constants.d.ts +5 -0
  917. package/dist/utils/adapter/constants.js +31 -0
  918. package/dist/utils/adapter/constants.js.map +1 -0
  919. package/dist/utils/adapter/create-headers.d.ts +10 -0
  920. package/dist/utils/adapter/create-headers.js +94 -0
  921. package/dist/utils/adapter/create-headers.js.map +1 -0
  922. package/dist/utils/adapter/get-route-path.d.ts +3 -0
  923. package/dist/utils/adapter/get-route-path.js +22 -0
  924. package/dist/utils/adapter/get-route-path.js.map +1 -0
  925. package/dist/utils/adapter/init.d.ts +3 -0
  926. package/dist/utils/adapter/init.js +183 -0
  927. package/dist/utils/adapter/init.js.map +1 -0
  928. package/dist/utils/adapter/manager.d.ts +9 -0
  929. package/dist/utils/adapter/manager.js +554 -0
  930. package/dist/utils/adapter/manager.js.map +1 -0
  931. package/dist/utils/adapter/no-op-manager.d.ts +2 -0
  932. package/dist/utils/adapter/no-op-manager.js +18 -0
  933. package/dist/utils/adapter/no-op-manager.js.map +1 -0
  934. package/dist/utils/adapter/types.d.ts +282 -0
  935. package/dist/utils/adapter/types.js +4 -0
  936. package/dist/utils/adapter/types.js.map +1 -0
  937. package/dist/utils/api-browser-docs.d.ts +272 -0
  938. package/dist/utils/api-browser-docs.js +318 -0
  939. package/dist/utils/api-browser-docs.js.map +1 -0
  940. package/dist/utils/api-node-docs.d.ts +470 -0
  941. package/dist/utils/api-node-docs.js +519 -0
  942. package/dist/utils/api-node-docs.js.map +1 -0
  943. package/dist/utils/api-node-helpers-docs.js +322 -0
  944. package/dist/utils/api-node-helpers-docs.js.map +1 -0
  945. package/dist/utils/api-runner-error-parser.d.ts +5 -0
  946. package/dist/utils/api-runner-error-parser.js +63 -0
  947. package/dist/utils/api-runner-error-parser.js.map +1 -0
  948. package/dist/utils/api-runner-node.js +663 -0
  949. package/dist/utils/api-runner-node.js.map +1 -0
  950. package/dist/utils/app-data.d.ts +2 -0
  951. package/dist/utils/app-data.js +15 -0
  952. package/dist/utils/app-data.js.map +1 -0
  953. package/dist/utils/assert-store.d.ts +2 -0
  954. package/dist/utils/assert-store.js +12 -0
  955. package/dist/utils/assert-store.js.map +1 -0
  956. package/dist/utils/babel/babel-module-exports-helpers.d.ts +22 -0
  957. package/dist/utils/babel/babel-module-exports-helpers.js +48 -0
  958. package/dist/utils/babel/babel-module-exports-helpers.js.map +1 -0
  959. package/dist/utils/babel/babel-plugin-add-slice-placeholder-location.d.ts +10 -0
  960. package/dist/utils/babel/babel-plugin-add-slice-placeholder-location.js +48 -0
  961. package/dist/utils/babel/babel-plugin-add-slice-placeholder-location.js.map +1 -0
  962. package/dist/utils/babel/babel-plugin-remove-api.d.ts +5 -0
  963. package/dist/utils/babel/babel-plugin-remove-api.js +148 -0
  964. package/dist/utils/babel/babel-plugin-remove-api.js.map +1 -0
  965. package/dist/utils/babel/find-slices.d.ts +8 -0
  966. package/dist/utils/babel/find-slices.js +68 -0
  967. package/dist/utils/babel/find-slices.js.map +1 -0
  968. package/dist/utils/babel-loader-helpers.d.ts +19 -0
  969. package/dist/utils/babel-loader-helpers.js +158 -0
  970. package/dist/utils/babel-loader-helpers.js.map +1 -0
  971. package/dist/utils/babel-loader.d.ts +8 -0
  972. package/dist/utils/babel-loader.js +158 -0
  973. package/dist/utils/babel-loader.js.map +1 -0
  974. package/dist/utils/babel-parse-to-ast.d.ts +4 -0
  975. package/dist/utils/babel-parse-to-ast.js +34 -0
  976. package/dist/utils/babel-parse-to-ast.js.map +1 -0
  977. package/dist/utils/batcher.d.ts +15 -0
  978. package/dist/utils/batcher.js +46 -0
  979. package/dist/utils/batcher.js.map +1 -0
  980. package/dist/utils/browserslist.d.ts +2 -0
  981. package/dist/utils/browserslist.js +38 -0
  982. package/dist/utils/browserslist.js.map +1 -0
  983. package/dist/utils/cache-lmdb.d.ts +19 -0
  984. package/dist/utils/cache-lmdb.js +88 -0
  985. package/dist/utils/cache-lmdb.js.map +1 -0
  986. package/dist/utils/cache.d.ts +17 -0
  987. package/dist/utils/cache.js +77 -0
  988. package/dist/utils/cache.js.map +1 -0
  989. package/dist/utils/call-deferred-api.d.ts +8 -0
  990. package/dist/utils/call-deferred-api.js +35 -0
  991. package/dist/utils/call-deferred-api.js.map +1 -0
  992. package/dist/utils/changed-pages.d.ts +6 -0
  993. package/dist/utils/changed-pages.js +45 -0
  994. package/dist/utils/changed-pages.js.map +1 -0
  995. package/dist/utils/clear-require-cache.d.ts +1 -0
  996. package/dist/utils/clear-require-cache.js +24 -0
  997. package/dist/utils/clear-require-cache.js.map +1 -0
  998. package/dist/utils/client-assets-for-template.d.ts +9 -0
  999. package/dist/utils/client-assets-for-template.js +141 -0
  1000. package/dist/utils/client-assets-for-template.js.map +1 -0
  1001. package/dist/utils/create-node-id.d.ts +24 -0
  1002. package/dist/utils/create-node-id.js +67 -0
  1003. package/dist/utils/create-node-id.js.map +1 -0
  1004. package/dist/utils/create-schema-customization.d.ts +6 -0
  1005. package/dist/utils/create-schema-customization.js +25 -0
  1006. package/dist/utils/create-schema-customization.js.map +1 -0
  1007. package/dist/utils/detect-node-mutations.d.ts +4 -0
  1008. package/dist/utils/detect-node-mutations.js +134 -0
  1009. package/dist/utils/detect-node-mutations.js.map +1 -0
  1010. package/dist/utils/detect-port-in-use-and-prompt.d.ts +1 -0
  1011. package/dist/utils/detect-port-in-use-and-prompt.js +31 -0
  1012. package/dist/utils/detect-port-in-use-and-prompt.js.map +1 -0
  1013. package/dist/utils/dev-ssr/parse-error.d.ts +22 -0
  1014. package/dist/utils/dev-ssr/parse-error.js +119 -0
  1015. package/dist/utils/dev-ssr/parse-error.js.map +1 -0
  1016. package/dist/utils/dev-ssr/render-dev-html-child.d.ts +13 -0
  1017. package/dist/utils/dev-ssr/render-dev-html-child.js +47 -0
  1018. package/dist/utils/dev-ssr/render-dev-html-child.js.map +1 -0
  1019. package/dist/utils/dev-ssr/render-dev-html.d.ts +23 -0
  1020. package/dist/utils/dev-ssr/render-dev-html.js +227 -0
  1021. package/dist/utils/dev-ssr/render-dev-html.js.map +1 -0
  1022. package/dist/utils/develop-preload-headers.d.ts +7 -0
  1023. package/dist/utils/develop-preload-headers.js +64 -0
  1024. package/dist/utils/develop-preload-headers.js.map +1 -0
  1025. package/dist/utils/did-you-mean.d.ts +3 -0
  1026. package/dist/utils/did-you-mean.js +21 -0
  1027. package/dist/utils/did-you-mean.js.map +1 -0
  1028. package/dist/utils/engine-context.d.ts +5 -0
  1029. package/dist/utils/engine-context.js +19 -0
  1030. package/dist/utils/engine-context.js.map +1 -0
  1031. package/dist/utils/engines-fs-provider.d.ts +9 -0
  1032. package/dist/utils/engines-fs-provider.js +24 -0
  1033. package/dist/utils/engines-fs-provider.js.map +1 -0
  1034. package/dist/utils/engines-helpers.d.ts +10 -0
  1035. package/dist/utils/engines-helpers.js +48 -0
  1036. package/dist/utils/engines-helpers.js.map +1 -0
  1037. package/dist/utils/ensure-file-content.d.ts +1 -0
  1038. package/dist/utils/ensure-file-content.js +19 -0
  1039. package/dist/utils/ensure-file-content.js.map +1 -0
  1040. package/dist/utils/eslint/required.js +10 -0
  1041. package/dist/utils/eslint/required.js.map +1 -0
  1042. package/dist/utils/eslint-config.d.ts +3 -0
  1043. package/dist/utils/eslint-config.js +136 -0
  1044. package/dist/utils/eslint-config.js.map +1 -0
  1045. package/dist/utils/eslint-rules/limited-exports-page-templates.d.ts +1 -0
  1046. package/dist/utils/eslint-rules/limited-exports-page-templates.js +183 -0
  1047. package/dist/utils/eslint-rules/limited-exports-page-templates.js.map +1 -0
  1048. package/dist/utils/eslint-rules/no-anonymous-exports-page-templates.d.ts +1 -0
  1049. package/dist/utils/eslint-rules/no-anonymous-exports-page-templates.js +75 -0
  1050. package/dist/utils/eslint-rules/no-anonymous-exports-page-templates.js.map +1 -0
  1051. package/dist/utils/eslint-rules-helpers.d.ts +4 -0
  1052. package/dist/utils/eslint-rules-helpers.js +22 -0
  1053. package/dist/utils/eslint-rules-helpers.js.map +1 -0
  1054. package/dist/utils/express-middlewares.d.ts +4 -0
  1055. package/dist/utils/express-middlewares.js +57 -0
  1056. package/dist/utils/express-middlewares.js.map +1 -0
  1057. package/dist/utils/extract-undefined-global.d.ts +4 -0
  1058. package/dist/utils/extract-undefined-global.js +15 -0
  1059. package/dist/utils/extract-undefined-global.js.map +1 -0
  1060. package/dist/utils/fast-refresh-module.d.ts +22 -0
  1061. package/dist/utils/fast-refresh-module.js +53 -0
  1062. package/dist/utils/fast-refresh-module.js.map +1 -0
  1063. package/dist/utils/feedback.d.ts +5 -0
  1064. package/dist/utils/feedback.js +159 -0
  1065. package/dist/utils/feedback.js.map +1 -0
  1066. package/dist/utils/find-page-by-path.d.ts +2 -0
  1067. package/dist/utils/find-page-by-path.js +96 -0
  1068. package/dist/utils/find-page-by-path.js.map +1 -0
  1069. package/dist/utils/flags.d.ts +41 -0
  1070. package/dist/utils/flags.js +92 -0
  1071. package/dist/utils/flags.js.map +1 -0
  1072. package/dist/utils/gatsby-cloud-config.d.ts +4 -0
  1073. package/dist/utils/gatsby-cloud-config.js +15 -0
  1074. package/dist/utils/gatsby-cloud-config.js.map +1 -0
  1075. package/dist/utils/gatsby-dependents.d.ts +8 -0
  1076. package/dist/utils/gatsby-dependents.js +51 -0
  1077. package/dist/utils/gatsby-dependents.js.map +1 -0
  1078. package/dist/utils/gatsby-webpack-stats-extractor.d.ts +7 -0
  1079. package/dist/utils/gatsby-webpack-stats-extractor.js +136 -0
  1080. package/dist/utils/gatsby-webpack-stats-extractor.js.map +1 -0
  1081. package/dist/utils/gatsby-webpack-virtual-modules.d.ts +6 -0
  1082. package/dist/utils/gatsby-webpack-virtual-modules.js +45 -0
  1083. package/dist/utils/gatsby-webpack-virtual-modules.js.map +1 -0
  1084. package/dist/utils/get-cache.d.ts +2 -0
  1085. package/dist/utils/get-cache.js +18 -0
  1086. package/dist/utils/get-cache.js.map +1 -0
  1087. package/dist/utils/get-latest-gatsby-files.d.ts +8 -0
  1088. package/dist/utils/get-latest-gatsby-files.js +93 -0
  1089. package/dist/utils/get-latest-gatsby-files.js.map +1 -0
  1090. package/dist/utils/get-page-data.d.ts +3 -0
  1091. package/dist/utils/get-page-data.js +88 -0
  1092. package/dist/utils/get-page-data.js.map +1 -0
  1093. package/dist/utils/get-public-path.d.ts +5 -0
  1094. package/dist/utils/get-public-path.js +19 -0
  1095. package/dist/utils/get-public-path.js.map +1 -0
  1096. package/dist/utils/get-server-data.d.ts +19 -0
  1097. package/dist/utils/get-server-data.js +29 -0
  1098. package/dist/utils/get-server-data.js.map +1 -0
  1099. package/dist/utils/get-ssl-cert.d.ts +9 -0
  1100. package/dist/utils/get-ssl-cert.js +95 -0
  1101. package/dist/utils/get-ssl-cert.js.map +1 -0
  1102. package/dist/utils/get-static-dir.d.ts +12 -0
  1103. package/dist/utils/get-static-dir.js +60 -0
  1104. package/dist/utils/get-static-dir.js.map +1 -0
  1105. package/dist/utils/get-value-at.d.ts +1 -0
  1106. package/dist/utils/get-value-at.js +22 -0
  1107. package/dist/utils/get-value-at.js.map +1 -0
  1108. package/dist/utils/graphql-typegen/file-writes.d.ts +5 -0
  1109. package/dist/utils/graphql-typegen/file-writes.js +63 -0
  1110. package/dist/utils/graphql-typegen/file-writes.js.map +1 -0
  1111. package/dist/utils/graphql-typegen/ts-codegen.d.ts +5 -0
  1112. package/dist/utils/graphql-typegen/ts-codegen.js +136 -0
  1113. package/dist/utils/graphql-typegen/ts-codegen.js.map +1 -0
  1114. package/dist/utils/graphql-typegen/utils.d.ts +11 -0
  1115. package/dist/utils/graphql-typegen/utils.js +70 -0
  1116. package/dist/utils/graphql-typegen/utils.js.map +1 -0
  1117. package/dist/utils/handle-flags.d.ts +8 -0
  1118. package/dist/utils/handle-flags.js +212 -0
  1119. package/dist/utils/handle-flags.js.map +1 -0
  1120. package/dist/utils/import-gatsby-plugin.d.ts +11 -0
  1121. package/dist/utils/import-gatsby-plugin.js +40 -0
  1122. package/dist/utils/import-gatsby-plugin.js.map +1 -0
  1123. package/dist/utils/is-32-bit-integer.d.ts +1 -0
  1124. package/dist/utils/is-32-bit-integer.js +8 -0
  1125. package/dist/utils/is-32-bit-integer.js.map +1 -0
  1126. package/dist/utils/is-near-match.d.ts +1 -0
  1127. package/dist/utils/is-near-match.js +10 -0
  1128. package/dist/utils/is-near-match.js.map +1 -0
  1129. package/dist/utils/jobs/manager.d.ts +34 -0
  1130. package/dist/utils/jobs/manager.js +313 -0
  1131. package/dist/utils/jobs/manager.js.map +1 -0
  1132. package/dist/utils/jobs/types.d.ts +63 -0
  1133. package/dist/utils/jobs/types.js +32 -0
  1134. package/dist/utils/jobs/types.js.map +1 -0
  1135. package/dist/utils/jobs/worker-messaging.d.ts +10 -0
  1136. package/dist/utils/jobs/worker-messaging.js +114 -0
  1137. package/dist/utils/jobs/worker-messaging.js.map +1 -0
  1138. package/dist/utils/js-chunk-names.d.ts +1 -0
  1139. package/dist/utils/js-chunk-names.js +72 -0
  1140. package/dist/utils/js-chunk-names.js.map +1 -0
  1141. package/dist/utils/loading-indicator.d.ts +3 -0
  1142. package/dist/utils/loading-indicator.js +44 -0
  1143. package/dist/utils/loading-indicator.js.map +1 -0
  1144. package/dist/utils/local-eslint-config-finder.d.ts +1 -0
  1145. package/dist/utils/local-eslint-config-finder.js +31 -0
  1146. package/dist/utils/local-eslint-config-finder.js.map +1 -0
  1147. package/dist/utils/merge-gatsby-config.d.ts +28 -0
  1148. package/dist/utils/merge-gatsby-config.js +43 -0
  1149. package/dist/utils/merge-gatsby-config.js.map +1 -0
  1150. package/dist/utils/mett.d.ts +10 -0
  1151. package/dist/utils/mett.js +42 -0
  1152. package/dist/utils/mett.js.map +1 -0
  1153. package/dist/utils/module-resolver.d.ts +2 -0
  1154. package/dist/utils/module-resolver.js +24 -0
  1155. package/dist/utils/module-resolver.js.map +1 -0
  1156. package/dist/utils/node-manifest.d.ts +46 -0
  1157. package/dist/utils/node-manifest.js +367 -0
  1158. package/dist/utils/node-manifest.js.map +1 -0
  1159. package/dist/utils/nodes.d.ts +13 -0
  1160. package/dist/utils/nodes.js +62 -0
  1161. package/dist/utils/nodes.js.map +1 -0
  1162. package/dist/utils/normalize-path.d.ts +2 -0
  1163. package/dist/utils/normalize-path.js +11 -0
  1164. package/dist/utils/normalize-path.js.map +1 -0
  1165. package/dist/utils/page-data-helpers.d.ts +23 -0
  1166. package/dist/utils/page-data-helpers.js +76 -0
  1167. package/dist/utils/page-data-helpers.js.map +1 -0
  1168. package/dist/utils/page-data.d.ts +39 -0
  1169. package/dist/utils/page-data.js +366 -0
  1170. package/dist/utils/page-data.js.map +1 -0
  1171. package/dist/utils/page-mode.d.ts +18 -0
  1172. package/dist/utils/page-mode.js +124 -0
  1173. package/dist/utils/page-mode.js.map +1 -0
  1174. package/dist/utils/page-ssr-module/bundle-webpack.d.ts +18 -0
  1175. package/dist/utils/page-ssr-module/bundle-webpack.js +209 -0
  1176. package/dist/utils/page-ssr-module/bundle-webpack.js.map +1 -0
  1177. package/dist/utils/page-ssr-module/entry.d.ts +61 -0
  1178. package/dist/utils/page-ssr-module/entry.js +344 -0
  1179. package/dist/utils/page-ssr-module/entry.js.map +1 -0
  1180. package/dist/utils/page-ssr-module/lambda.d.ts +3 -0
  1181. package/dist/utils/page-ssr-module/lambda.js +401 -0
  1182. package/dist/utils/page-ssr-module/lambda.js.map +1 -0
  1183. package/dist/utils/parcel/compile-gatsby-files.d.ts +26 -0
  1184. package/dist/utils/parcel/compile-gatsby-files.js +271 -0
  1185. package/dist/utils/parcel/compile-gatsby-files.js.map +1 -0
  1186. package/dist/utils/path.d.ts +5 -0
  1187. package/dist/utils/path.js +55 -0
  1188. package/dist/utils/path.js.map +1 -0
  1189. package/dist/utils/prepare-regex.d.ts +1 -0
  1190. package/dist/utils/prepare-regex.js +13 -0
  1191. package/dist/utils/prepare-regex.js.map +1 -0
  1192. package/dist/utils/prepare-urls.d.ts +7 -0
  1193. package/dist/utils/prepare-urls.js +58 -0
  1194. package/dist/utils/prepare-urls.js.map +1 -0
  1195. package/dist/utils/print-instructions.d.ts +2 -0
  1196. package/dist/utils/print-instructions.js +42 -0
  1197. package/dist/utils/print-instructions.js.map +1 -0
  1198. package/dist/utils/rank-route.d.ts +1 -0
  1199. package/dist/utils/rank-route.js +26 -0
  1200. package/dist/utils/rank-route.js.map +1 -0
  1201. package/dist/utils/reach-router-add-basecontext-export-loader.d.ts +1 -0
  1202. package/dist/utils/reach-router-add-basecontext-export-loader.js +23 -0
  1203. package/dist/utils/reach-router-add-basecontext-export-loader.js.map +1 -0
  1204. package/dist/utils/report-once.d.ts +1 -0
  1205. package/dist/utils/report-once.js +17 -0
  1206. package/dist/utils/report-once.js.map +1 -0
  1207. package/dist/utils/sanitize-node.d.ts +12 -0
  1208. package/dist/utils/sanitize-node.js +87 -0
  1209. package/dist/utils/sanitize-node.js.map +1 -0
  1210. package/dist/utils/show-experiment-notice.d.ts +6 -0
  1211. package/dist/utils/show-experiment-notice.js +51 -0
  1212. package/dist/utils/show-experiment-notice.js.map +1 -0
  1213. package/dist/utils/slices/stitching.d.ts +4 -0
  1214. package/dist/utils/slices/stitching.js +92 -0
  1215. package/dist/utils/slices/stitching.js.map +1 -0
  1216. package/dist/utils/slices.d.ts +2 -0
  1217. package/dist/utils/slices.js +9 -0
  1218. package/dist/utils/slices.js.map +1 -0
  1219. package/dist/utils/source-nodes-api-runner.d.ts +8 -0
  1220. package/dist/utils/source-nodes-api-runner.js +23 -0
  1221. package/dist/utils/source-nodes-api-runner.js.map +1 -0
  1222. package/dist/utils/source-nodes.d.ts +11 -0
  1223. package/dist/utils/source-nodes.js +150 -0
  1224. package/dist/utils/source-nodes.js.map +1 -0
  1225. package/dist/utils/stack-trace-utils.d.ts +24 -0
  1226. package/dist/utils/stack-trace-utils.js +113 -0
  1227. package/dist/utils/stack-trace-utils.js.map +1 -0
  1228. package/dist/utils/start-server.d.ts +22 -0
  1229. package/dist/utils/start-server.js +722 -0
  1230. package/dist/utils/start-server.js.map +1 -0
  1231. package/dist/utils/state-machine-logging.d.ts +4 -0
  1232. package/dist/utils/state-machine-logging.js +47 -0
  1233. package/dist/utils/state-machine-logging.js.map +1 -0
  1234. package/dist/utils/static-query-utils.d.ts +13 -0
  1235. package/dist/utils/static-query-utils.js +57 -0
  1236. package/dist/utils/static-query-utils.js.map +1 -0
  1237. package/dist/utils/test-import-error.d.ts +1 -0
  1238. package/dist/utils/test-import-error.js +18 -0
  1239. package/dist/utils/test-import-error.js.map +1 -0
  1240. package/dist/utils/tracer/index.d.ts +12 -0
  1241. package/dist/utils/tracer/index.js +42 -0
  1242. package/dist/utils/tracer/index.js.map +1 -0
  1243. package/dist/utils/tracer/jaeger-local.d.ts +4 -0
  1244. package/dist/utils/tracer/jaeger-local.js +32 -0
  1245. package/dist/utils/tracer/jaeger-local.js.map +1 -0
  1246. package/dist/utils/tracer/zipkin-local.d.ts +11 -0
  1247. package/dist/utils/tracer/zipkin-local.js +87 -0
  1248. package/dist/utils/tracer/zipkin-local.js.map +1 -0
  1249. package/dist/utils/tracer/zipkin-types.d.js +14 -0
  1250. package/dist/utils/tracer/zipkin-types.d.js.map +1 -0
  1251. package/dist/utils/validate-component.d.ts +23 -0
  1252. package/dist/utils/validate-component.js +99 -0
  1253. package/dist/utils/validate-component.js.map +1 -0
  1254. package/dist/utils/validate-engines/child.d.ts +1 -0
  1255. package/dist/utils/validate-engines/child.js +74 -0
  1256. package/dist/utils/validate-engines/child.js.map +1 -0
  1257. package/dist/utils/validate-engines/index.d.ts +2 -0
  1258. package/dist/utils/validate-engines/index.js +48 -0
  1259. package/dist/utils/validate-engines/index.js.map +1 -0
  1260. package/dist/utils/wait-until-jobs-complete.d.ts +2 -0
  1261. package/dist/utils/wait-until-jobs-complete.js +30 -0
  1262. package/dist/utils/wait-until-jobs-complete.js.map +1 -0
  1263. package/dist/utils/webpack/bundle.d.ts +9 -0
  1264. package/dist/utils/webpack/bundle.js +41 -0
  1265. package/dist/utils/webpack/bundle.js.map +1 -0
  1266. package/dist/utils/webpack/get-ssr-chunk-hashes.d.ts +9 -0
  1267. package/dist/utils/webpack/get-ssr-chunk-hashes.js +55 -0
  1268. package/dist/utils/webpack/get-ssr-chunk-hashes.js.map +1 -0
  1269. package/dist/utils/webpack/loaders/client-components-requires-writer-loader.d.ts +1 -0
  1270. package/dist/utils/webpack/loaders/client-components-requires-writer-loader.js +22 -0
  1271. package/dist/utils/webpack/loaders/client-components-requires-writer-loader.js.map +1 -0
  1272. package/dist/utils/webpack/loaders/partial-hydration-reference-loader.d.ts +1 -0
  1273. package/dist/utils/webpack/loaders/partial-hydration-reference-loader.js +127 -0
  1274. package/dist/utils/webpack/loaders/partial-hydration-reference-loader.js.map +1 -0
  1275. package/dist/utils/webpack/loaders/webpack-remove-exports-loader.d.ts +1 -0
  1276. package/dist/utils/webpack/loaders/webpack-remove-exports-loader.js +40 -0
  1277. package/dist/utils/webpack/loaders/webpack-remove-exports-loader.js.map +1 -0
  1278. package/dist/utils/webpack/plugins/cache-folder-resolver.d.ts +25 -0
  1279. package/dist/utils/webpack/plugins/cache-folder-resolver.js +111 -0
  1280. package/dist/utils/webpack/plugins/cache-folder-resolver.js.map +1 -0
  1281. package/dist/utils/webpack/plugins/corejs-resolver.d.ts +12 -0
  1282. package/dist/utils/webpack/plugins/corejs-resolver.js +66 -0
  1283. package/dist/utils/webpack/plugins/corejs-resolver.js.map +1 -0
  1284. package/dist/utils/webpack/plugins/force-css-hmr-for-edge-cases.d.ts +22 -0
  1285. package/dist/utils/webpack/plugins/force-css-hmr-for-edge-cases.js +88 -0
  1286. package/dist/utils/webpack/plugins/force-css-hmr-for-edge-cases.js.map +1 -0
  1287. package/dist/utils/webpack/plugins/partial-hydration.d.ts +26 -0
  1288. package/dist/utils/webpack/plugins/partial-hydration.js +362 -0
  1289. package/dist/utils/webpack/plugins/partial-hydration.js.map +1 -0
  1290. package/dist/utils/webpack/plugins/static-query-mapper.d.ts +13 -0
  1291. package/dist/utils/webpack/plugins/static-query-mapper.js +235 -0
  1292. package/dist/utils/webpack/plugins/static-query-mapper.js.map +1 -0
  1293. package/dist/utils/webpack/plugins/webpack-logging.d.ts +12 -0
  1294. package/dist/utils/webpack/plugins/webpack-logging.js +51 -0
  1295. package/dist/utils/webpack/plugins/webpack-logging.js.map +1 -0
  1296. package/dist/utils/webpack/utils/create-normalized-module-key.d.ts +12 -0
  1297. package/dist/utils/webpack/utils/create-normalized-module-key.js +25 -0
  1298. package/dist/utils/webpack/utils/create-normalized-module-key.js.map +1 -0
  1299. package/dist/utils/webpack/utils/is-file-inside-compilations.d.ts +7 -0
  1300. package/dist/utils/webpack/utils/is-file-inside-compilations.js +37 -0
  1301. package/dist/utils/webpack/utils/is-file-inside-compilations.js.map +1 -0
  1302. package/dist/utils/webpack-error-utils.d.ts +24 -0
  1303. package/dist/utils/webpack-error-utils.js +112 -0
  1304. package/dist/utils/webpack-error-utils.js.map +1 -0
  1305. package/dist/utils/webpack-plugins.d.ts +46 -0
  1306. package/dist/utils/webpack-plugins.js +61 -0
  1307. package/dist/utils/webpack-plugins.js.map +1 -0
  1308. package/dist/utils/webpack-status.d.ts +3 -0
  1309. package/dist/utils/webpack-status.js +21 -0
  1310. package/dist/utils/webpack-status.js.map +1 -0
  1311. package/dist/utils/webpack-utils.d.ts +121 -0
  1312. package/dist/utils/webpack-utils.js +574 -0
  1313. package/dist/utils/webpack-utils.js.map +1 -0
  1314. package/dist/utils/webpack.config.js +804 -0
  1315. package/dist/utils/webpack.config.js.map +1 -0
  1316. package/dist/utils/websocket-manager.d.ts +39 -0
  1317. package/dist/utils/websocket-manager.js +183 -0
  1318. package/dist/utils/websocket-manager.js.map +1 -0
  1319. package/dist/utils/worker/child/index.d.ts +5 -0
  1320. package/dist/utils/worker/child/index.js +35 -0
  1321. package/dist/utils/worker/child/index.js.map +1 -0
  1322. package/dist/utils/worker/child/load-config-and-plugins.d.ts +2 -0
  1323. package/dist/utils/worker/child/load-config-and-plugins.js +28 -0
  1324. package/dist/utils/worker/child/load-config-and-plugins.js.map +1 -0
  1325. package/dist/utils/worker/child/queries.d.ts +7 -0
  1326. package/dist/utils/worker/child/queries.js +84 -0
  1327. package/dist/utils/worker/child/queries.js.map +1 -0
  1328. package/dist/utils/worker/child/render-html.d.ts +49 -0
  1329. package/dist/utils/worker/child/render-html.js +562 -0
  1330. package/dist/utils/worker/child/render-html.js.map +1 -0
  1331. package/dist/utils/worker/child/schema.d.ts +2 -0
  1332. package/dist/utils/worker/child/schema.js +41 -0
  1333. package/dist/utils/worker/child/schema.js.map +1 -0
  1334. package/dist/utils/worker/child/state.d.ts +2 -0
  1335. package/dist/utils/worker/child/state.js +13 -0
  1336. package/dist/utils/worker/child/state.js.map +1 -0
  1337. package/dist/utils/worker/messaging.d.ts +16 -0
  1338. package/dist/utils/worker/messaging.js +9 -0
  1339. package/dist/utils/worker/messaging.js.map +1 -0
  1340. package/dist/utils/worker/pool.d.ts +10 -0
  1341. package/dist/utils/worker/pool.js +122 -0
  1342. package/dist/utils/worker/pool.js.map +1 -0
  1343. package/dist/utils/worker/reporter.d.ts +3 -0
  1344. package/dist/utils/worker/reporter.js +26 -0
  1345. package/dist/utils/worker/reporter.js.map +1 -0
  1346. package/dist/utils/worker/types.d.ts +3 -0
  1347. package/dist/utils/worker/types.js +4 -0
  1348. package/dist/utils/worker/types.js.map +1 -0
  1349. package/graphql.d.ts +2 -0
  1350. package/graphql.js +6 -0
  1351. package/index.d.ts +1906 -0
  1352. package/internal.d.ts +4 -0
  1353. package/internal.js +5 -0
  1354. package/ipc.json +3 -0
  1355. package/package.json +744 -0
  1356. package/reporter.d.ts +4 -0
  1357. package/reporter.js +3 -0
  1358. package/scripts/postinstall.js +7 -0
  1359. package/utils.js +1 -0
  1360. package/webpack.d.ts +3 -0
  1361. package/webpack.js +3 -0
@@ -0,0 +1,3561 @@
1
+ /* eslint-disable */
2
+ // Adapted from https://github.com/medialize/ally.js
3
+ // License: MIT
4
+ // Copyright (c) 2015 Rodney Rehm
5
+ //
6
+ // Entrypoint: ally.js/maintain/tab-focus
7
+
8
+ import _platform from 'platform'
9
+ import cssEscape from 'css.escape'
10
+
11
+ // input may be undefined, selector-tring, Node, NodeList, HTMLCollection, array of Nodes
12
+ // yes, to some extent this is a bad replica of jQuery's constructor function
13
+ function nodeArray(input) {
14
+ if (!input) {
15
+ return []
16
+ }
17
+
18
+ if (Array.isArray(input)) {
19
+ return input
20
+ }
21
+
22
+ // instanceof Node - does not work with iframes
23
+ if (input.nodeType !== undefined) {
24
+ return [input]
25
+ }
26
+
27
+ if (typeof input === 'string') {
28
+ input = document.querySelectorAll(input)
29
+ }
30
+
31
+ if (input.length !== undefined) {
32
+ return [].slice.call(input, 0)
33
+ }
34
+
35
+ throw new TypeError('unexpected input ' + String(input))
36
+ }
37
+
38
+ function contextToElement(_ref) {
39
+ var context = _ref.context,
40
+ _ref$label = _ref.label,
41
+ label = _ref$label === undefined ? 'context-to-element' : _ref$label,
42
+ resolveDocument = _ref.resolveDocument,
43
+ defaultToDocument = _ref.defaultToDocument
44
+
45
+ var element = nodeArray(context)[0]
46
+
47
+ if (resolveDocument && element && element.nodeType === Node.DOCUMENT_NODE) {
48
+ element = element.documentElement
49
+ }
50
+
51
+ if (!element && defaultToDocument) {
52
+ return document.documentElement
53
+ }
54
+
55
+ if (!element) {
56
+ throw new TypeError(label + ' requires valid options.context')
57
+ }
58
+
59
+ if (
60
+ element.nodeType !== Node.ELEMENT_NODE &&
61
+ element.nodeType !== Node.DOCUMENT_FRAGMENT_NODE
62
+ ) {
63
+ throw new TypeError(label + ' requires options.context to be an Element')
64
+ }
65
+
66
+ return element
67
+ }
68
+
69
+ function getShadowHost() {
70
+ var _ref =
71
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
72
+ context = _ref.context
73
+
74
+ var element = contextToElement({
75
+ label: 'get/shadow-host',
76
+ context: context,
77
+ })
78
+
79
+ // walk up to the root
80
+ var container = null
81
+
82
+ while (element) {
83
+ container = element
84
+ element = element.parentNode
85
+ }
86
+
87
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeType
88
+ // NOTE: Firefox 34 does not expose ShadowRoot.host (but 37 does)
89
+ if (
90
+ container.nodeType === container.DOCUMENT_FRAGMENT_NODE &&
91
+ container.host
92
+ ) {
93
+ // the root is attached to a fragment node that has a host
94
+ return container.host
95
+ }
96
+
97
+ return null
98
+ }
99
+
100
+ function getDocument(node) {
101
+ if (!node) {
102
+ return document
103
+ }
104
+
105
+ if (node.nodeType === Node.DOCUMENT_NODE) {
106
+ return node
107
+ }
108
+
109
+ return node.ownerDocument || document
110
+ }
111
+
112
+ function isActiveElement(context) {
113
+ var element = contextToElement({
114
+ label: 'is/active-element',
115
+ resolveDocument: true,
116
+ context: context,
117
+ })
118
+
119
+ var _document = getDocument(element)
120
+ if (_document.activeElement === element) {
121
+ return true
122
+ }
123
+
124
+ var shadowHost = getShadowHost({ context: element })
125
+ if (shadowHost && shadowHost.shadowRoot.activeElement === element) {
126
+ return true
127
+ }
128
+
129
+ return false
130
+ }
131
+
132
+ // [elem, elem.parent, elem.parent.parent, …, html]
133
+ // will not contain the shadowRoot (DOCUMENT_FRAGMENT_NODE) and shadowHost
134
+ function getParents() {
135
+ var _ref =
136
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
137
+ context = _ref.context
138
+
139
+ var list = []
140
+ var element = contextToElement({
141
+ label: 'get/parents',
142
+ context: context,
143
+ })
144
+
145
+ while (element) {
146
+ list.push(element)
147
+ // IE does know support parentElement on SVGElement
148
+ element = element.parentNode
149
+ if (element && element.nodeType !== Node.ELEMENT_NODE) {
150
+ element = null
151
+ }
152
+ }
153
+
154
+ return list
155
+ }
156
+
157
+ // Element.prototype.matches may be available at a different name
158
+ // https://developer.mozilla.org/en/docs/Web/API/Element/matches
159
+
160
+ var names = [
161
+ 'matches',
162
+ 'webkitMatchesSelector',
163
+ 'mozMatchesSelector',
164
+ 'msMatchesSelector',
165
+ ]
166
+ var name = null
167
+
168
+ function findMethodName(element) {
169
+ names.some(function (_name) {
170
+ if (!element[_name]) {
171
+ return false
172
+ }
173
+
174
+ name = _name
175
+ return true
176
+ })
177
+ }
178
+
179
+ function elementMatches(element, selector) {
180
+ if (!name) {
181
+ findMethodName(element)
182
+ }
183
+
184
+ return element[name](selector)
185
+ }
186
+
187
+ // deep clone of original platform
188
+ var platform = JSON.parse(JSON.stringify(_platform))
189
+
190
+ // operating system
191
+ var os = platform.os.family || ''
192
+ var ANDROID = os === 'Android'
193
+ var WINDOWS = os.slice(0, 7) === 'Windows'
194
+ var OSX = os === 'OS X'
195
+ var IOS = os === 'iOS'
196
+
197
+ // layout
198
+ var BLINK = platform.layout === 'Blink'
199
+ var GECKO = platform.layout === 'Gecko'
200
+ var TRIDENT = platform.layout === 'Trident'
201
+ var EDGE = platform.layout === 'EdgeHTML'
202
+ var WEBKIT = platform.layout === 'WebKit'
203
+
204
+ // browser version (not layout engine version!)
205
+ var version = parseFloat(platform.version)
206
+ var majorVersion = Math.floor(version)
207
+ platform.majorVersion = majorVersion
208
+
209
+ platform.is = {
210
+ // operating system
211
+ ANDROID: ANDROID,
212
+ WINDOWS: WINDOWS,
213
+ OSX: OSX,
214
+ IOS: IOS,
215
+ // layout
216
+ BLINK: BLINK, // "Chrome", "Chrome Mobile", "Opera"
217
+ GECKO: GECKO, // "Firefox"
218
+ TRIDENT: TRIDENT, // "Internet Explorer"
219
+ EDGE: EDGE, // "Microsoft Edge"
220
+ WEBKIT: WEBKIT, // "Safari"
221
+ // INTERNET EXPLORERS
222
+ IE9: TRIDENT && majorVersion === 9,
223
+ IE10: TRIDENT && majorVersion === 10,
224
+ IE11: TRIDENT && majorVersion === 11,
225
+ }
226
+
227
+ function before() {
228
+ var data = {
229
+ // remember what had focus to restore after test
230
+ activeElement: document.activeElement,
231
+ // remember scroll positions to restore after test
232
+ windowScrollTop: window.scrollTop,
233
+ windowScrollLeft: window.scrollLeft,
234
+ bodyScrollTop: document.body.scrollTop,
235
+ bodyScrollLeft: document.body.scrollLeft,
236
+ }
237
+
238
+ // wrap tests in an element hidden from screen readers to prevent them
239
+ // from announcing focus, which can be quite irritating to the user
240
+ var iframe = document.createElement('iframe')
241
+ iframe.setAttribute(
242
+ 'style',
243
+ 'position:absolute; position:fixed; top:0; left:-2px; width:1px; height:1px; overflow:hidden;'
244
+ )
245
+ iframe.setAttribute('aria-live', 'off')
246
+ iframe.setAttribute('aria-busy', 'true')
247
+ iframe.setAttribute('aria-hidden', 'true')
248
+ document.body.appendChild(iframe)
249
+
250
+ var _window = iframe.contentWindow
251
+ var _document = _window.document
252
+
253
+ _document.open()
254
+ _document.close()
255
+ var wrapper = _document.createElement('div')
256
+ _document.body.appendChild(wrapper)
257
+
258
+ data.iframe = iframe
259
+ data.wrapper = wrapper
260
+ data.window = _window
261
+ data.document = _document
262
+
263
+ return data
264
+ }
265
+
266
+ // options.element:
267
+ // {string} element name
268
+ // {function} callback(wrapper, document) to generate an element
269
+ // options.mutate: (optional)
270
+ // {function} callback(element, wrapper, document) to manipulate element prior to focus-test.
271
+ // Can return DOMElement to define focus target (default: element)
272
+ // options.validate: (optional)
273
+ // {function} callback(element, focusTarget, document) to manipulate test-result
274
+ function test(data, options) {
275
+ // make sure we operate on a clean slate
276
+ data.wrapper.innerHTML = ''
277
+ // create dummy element to test focusability of
278
+ var element =
279
+ typeof options.element === 'string'
280
+ ? data.document.createElement(options.element)
281
+ : options.element(data.wrapper, data.document)
282
+ // allow callback to further specify dummy element
283
+ // and optionally define element to focus
284
+ var focus =
285
+ options.mutate && options.mutate(element, data.wrapper, data.document)
286
+ if (!focus && focus !== false) {
287
+ focus = element
288
+ }
289
+ // element needs to be part of the DOM to be focusable
290
+ !element.parentNode && data.wrapper.appendChild(element)
291
+ // test if the element with invalid tabindex can be focused
292
+ focus && focus.focus && focus.focus()
293
+ // validate test's result
294
+ return options.validate
295
+ ? options.validate(element, focus, data.document)
296
+ : data.document.activeElement === focus
297
+ }
298
+
299
+ function after(data) {
300
+ // restore focus to what it was before test and cleanup
301
+ if (data.activeElement === document.body) {
302
+ document.activeElement &&
303
+ document.activeElement.blur &&
304
+ document.activeElement.blur()
305
+ if (platform.is.IE10) {
306
+ // IE10 does not redirect focus to <body> when the activeElement is removed
307
+ document.body.focus()
308
+ }
309
+ } else {
310
+ data.activeElement && data.activeElement.focus && data.activeElement.focus()
311
+ }
312
+
313
+ document.body.removeChild(data.iframe)
314
+
315
+ // restore scroll position
316
+ window.scrollTop = data.windowScrollTop
317
+ window.scrollLeft = data.windowScrollLeft
318
+ document.body.scrollTop = data.bodyScrollTop
319
+ document.body.scrollLeft = data.bodyScrollLeft
320
+ }
321
+
322
+ function detectFocus(tests) {
323
+ var data = before()
324
+
325
+ var results = {}
326
+ Object.keys(tests).map(function (key) {
327
+ results[key] = test(data, tests[key])
328
+ })
329
+
330
+ after(data)
331
+ return results
332
+ }
333
+
334
+ // this file is overwritten by `npm run build:pre`
335
+ var version$1 = '1.4.1'
336
+
337
+ /*
338
+ Facility to cache test results in localStorage.
339
+
340
+ USAGE:
341
+ cache.get('key');
342
+ cache.set('key', 'value');
343
+ */
344
+
345
+ function readLocalStorage(key) {
346
+ // allow reading from storage to retrieve previous support results
347
+ // even while the document does not have focus
348
+ var data = void 0
349
+
350
+ try {
351
+ data = window.localStorage && window.localStorage.getItem(key)
352
+ data = data ? JSON.parse(data) : {}
353
+ } catch (e) {
354
+ data = {}
355
+ }
356
+
357
+ return data
358
+ }
359
+
360
+ function writeLocalStorage(key, value) {
361
+ if (!document.hasFocus()) {
362
+ // if the document does not have focus when tests are executed, focus() may
363
+ // not be handled properly and events may not be dispatched immediately.
364
+ // This can happen when a document is reloaded while Developer Tools have focus.
365
+ try {
366
+ window.localStorage && window.localStorage.removeItem(key)
367
+ } catch (e) {
368
+ // ignore
369
+ }
370
+
371
+ return
372
+ }
373
+
374
+ try {
375
+ window.localStorage &&
376
+ window.localStorage.setItem(key, JSON.stringify(value))
377
+ } catch (e) {
378
+ // ignore
379
+ }
380
+ }
381
+
382
+ var userAgent =
383
+ (typeof window !== 'undefined' && window.navigator.userAgent) || ''
384
+ var cacheKey = 'ally-supports-cache'
385
+ var cache = readLocalStorage(cacheKey)
386
+
387
+ // update the cache if ally or the user agent changed (newer version, etc)
388
+ if (cache.userAgent !== userAgent || cache.version !== version$1) {
389
+ cache = {}
390
+ }
391
+
392
+ cache.userAgent = userAgent
393
+ cache.version = version$1
394
+
395
+ var cache$1 = {
396
+ get: function get() {
397
+ return cache
398
+ },
399
+ set: function set(values) {
400
+ Object.keys(values).forEach(function (key) {
401
+ cache[key] = values[key]
402
+ })
403
+
404
+ cache.time = new Date().toISOString()
405
+ writeLocalStorage(cacheKey, cache)
406
+ },
407
+ }
408
+
409
+ function cssShadowPiercingDeepCombinator() {
410
+ var combinator = void 0
411
+
412
+ // see https://dev.w3.org/csswg/css-scoping-1/#deep-combinator
413
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1117572
414
+ // https://code.google.com/p/chromium/issues/detail?id=446051
415
+ try {
416
+ document.querySelector('html >>> :first-child')
417
+ combinator = '>>>'
418
+ } catch (noArrowArrowArrow) {
419
+ try {
420
+ // old syntax supported at least up to Chrome 41
421
+ // https://code.google.com/p/chromium/issues/detail?id=446051
422
+ document.querySelector('html /deep/ :first-child')
423
+ combinator = '/deep/'
424
+ } catch (noDeep) {
425
+ combinator = ''
426
+ }
427
+ }
428
+
429
+ return combinator
430
+ }
431
+
432
+ var gif =
433
+ 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
434
+
435
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
436
+ var focusAreaImgTabindex = {
437
+ element: 'div',
438
+ mutate: function mutate(element) {
439
+ element.innerHTML =
440
+ '<map name="image-map-tabindex-test">' +
441
+ '<area shape="rect" coords="63,19,144,45"></map>' +
442
+ '<img usemap="#image-map-tabindex-test" tabindex="-1" alt="" src="' +
443
+ gif +
444
+ '">'
445
+
446
+ return element.querySelector('area')
447
+ },
448
+ }
449
+
450
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
451
+ var focusAreaTabindex = {
452
+ element: 'div',
453
+ mutate: function mutate(element) {
454
+ element.innerHTML =
455
+ '<map name="image-map-tabindex-test">' +
456
+ '<area href="#void" tabindex="-1" shape="rect" coords="63,19,144,45"></map>' +
457
+ '<img usemap="#image-map-tabindex-test" alt="" src="' +
458
+ gif +
459
+ '">'
460
+
461
+ return false
462
+ },
463
+ validate: function validate(element, focusTarget, _document) {
464
+ if (platform.is.GECKO) {
465
+ // fixes https://github.com/medialize/ally.js/issues/35
466
+ // Firefox loads the DataURI asynchronously, causing a false-negative
467
+ return true
468
+ }
469
+
470
+ var focus = element.querySelector('area')
471
+ focus.focus()
472
+ return _document.activeElement === focus
473
+ },
474
+ }
475
+
476
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
477
+ var focusAreaWithoutHref = {
478
+ element: 'div',
479
+ mutate: function mutate(element) {
480
+ element.innerHTML =
481
+ '<map name="image-map-area-href-test">' +
482
+ '<area shape="rect" coords="63,19,144,45"></map>' +
483
+ '<img usemap="#image-map-area-href-test" alt="" src="' +
484
+ gif +
485
+ '">'
486
+
487
+ return element.querySelector('area')
488
+ },
489
+ validate: function validate(element, focusTarget, _document) {
490
+ if (platform.is.GECKO) {
491
+ // fixes https://github.com/medialize/ally.js/issues/35
492
+ // Firefox loads the DataURI asynchronously, causing a false-negative
493
+ return true
494
+ }
495
+
496
+ return _document.activeElement === focusTarget
497
+ },
498
+ }
499
+
500
+ var focusAudioWithoutControls = {
501
+ name: 'can-focus-audio-without-controls',
502
+ element: 'audio',
503
+ mutate: function mutate(element) {
504
+ try {
505
+ // invalid media file can trigger warning in console, data-uri to prevent HTTP request
506
+ element.setAttribute('src', gif)
507
+ } catch (e) {
508
+ // IE9 may throw "Error: Not implemented"
509
+ }
510
+ },
511
+ }
512
+
513
+ var invalidGif =
514
+ 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'
515
+
516
+ // NOTE: https://github.com/medialize/ally.js/issues/35
517
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
518
+ var focusBrokenImageMap = {
519
+ element: 'div',
520
+ mutate: function mutate(element) {
521
+ element.innerHTML =
522
+ '<map name="broken-image-map-test"><area href="#void" shape="rect" coords="63,19,144,45"></map>' +
523
+ '<img usemap="#broken-image-map-test" alt="" src="' +
524
+ invalidGif +
525
+ '">'
526
+
527
+ return element.querySelector('area')
528
+ },
529
+ }
530
+
531
+ // Children of focusable elements with display:flex are focusable in IE10-11
532
+ var focusChildrenOfFocusableFlexbox = {
533
+ element: 'div',
534
+ mutate: function mutate(element) {
535
+ element.setAttribute('tabindex', '-1')
536
+ element.setAttribute(
537
+ 'style',
538
+ 'display: -webkit-flex; display: -ms-flexbox; display: flex;'
539
+ )
540
+ element.innerHTML = '<span style="display: block;">hello</span>'
541
+ return element.querySelector('span')
542
+ },
543
+ }
544
+
545
+ // fieldset[tabindex=0][disabled] should not be focusable, but Blink and WebKit disagree
546
+ // @specification https://www.w3.org/TR/html5/disabled-elements.html#concept-element-disabled
547
+ // @browser-issue Chromium https://crbug.com/453847
548
+ // @browser-issue WebKit https://bugs.webkit.org/show_bug.cgi?id=141086
549
+ var focusFieldsetDisabled = {
550
+ element: 'fieldset',
551
+ mutate: function mutate(element) {
552
+ element.setAttribute('tabindex', 0)
553
+ element.setAttribute('disabled', 'disabled')
554
+ },
555
+ }
556
+
557
+ var focusFieldset = {
558
+ element: 'fieldset',
559
+ mutate: function mutate(element) {
560
+ element.innerHTML = '<legend>legend</legend><p>content</p>'
561
+ },
562
+ }
563
+
564
+ // elements with display:flex are focusable in IE10-11
565
+ var focusFlexboxContainer = {
566
+ element: 'span',
567
+ mutate: function mutate(element) {
568
+ element.setAttribute(
569
+ 'style',
570
+ 'display: -webkit-flex; display: -ms-flexbox; display: flex;'
571
+ )
572
+ element.innerHTML = '<span style="display: block;">hello</span>'
573
+ },
574
+ }
575
+
576
+ // form[tabindex=0][disabled] should be focusable as the
577
+ // specification doesn't know the disabled attribute on the form element
578
+ // @specification https://www.w3.org/TR/html5/forms.html#the-form-element
579
+ var focusFormDisabled = {
580
+ element: 'form',
581
+ mutate: function mutate(element) {
582
+ element.setAttribute('tabindex', 0)
583
+ element.setAttribute('disabled', 'disabled')
584
+ },
585
+ }
586
+
587
+ // NOTE: https://github.com/medialize/ally.js/issues/35
588
+ // fixes https://github.com/medialize/ally.js/issues/20
589
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-ismap
590
+ var focusImgIsmap = {
591
+ element: 'a',
592
+ mutate: function mutate(element) {
593
+ element.href = '#void'
594
+ element.innerHTML = '<img ismap src="' + gif + '" alt="">'
595
+ return element.querySelector('img')
596
+ },
597
+ }
598
+
599
+ // NOTE: https://github.com/medialize/ally.js/issues/35
600
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
601
+ var focusImgUsemapTabindex = {
602
+ element: 'div',
603
+ mutate: function mutate(element) {
604
+ element.innerHTML =
605
+ '<map name="image-map-tabindex-test"><area href="#void" shape="rect" coords="63,19,144,45"></map>' +
606
+ '<img usemap="#image-map-tabindex-test" tabindex="-1" alt="" ' +
607
+ 'src="' +
608
+ gif +
609
+ '">'
610
+
611
+ return element.querySelector('img')
612
+ },
613
+ }
614
+
615
+ var focusInHiddenIframe = {
616
+ element: function element(wrapper, _document) {
617
+ var iframe = _document.createElement('iframe')
618
+
619
+ // iframe must be part of the DOM before accessing the contentWindow is possible
620
+ wrapper.appendChild(iframe)
621
+
622
+ // create the iframe's default document (<html><head></head><body></body></html>)
623
+ var iframeDocument = iframe.contentWindow.document
624
+ iframeDocument.open()
625
+ iframeDocument.close()
626
+ return iframe
627
+ },
628
+ mutate: function mutate(iframe) {
629
+ iframe.style.visibility = 'hidden'
630
+
631
+ var iframeDocument = iframe.contentWindow.document
632
+ var input = iframeDocument.createElement('input')
633
+ iframeDocument.body.appendChild(input)
634
+ return input
635
+ },
636
+ validate: function validate(iframe) {
637
+ var iframeDocument = iframe.contentWindow.document
638
+ var focus = iframeDocument.querySelector('input')
639
+ return iframeDocument.activeElement === focus
640
+ },
641
+ }
642
+
643
+ var result = !platform.is.WEBKIT
644
+
645
+ function focusInZeroDimensionObject() {
646
+ return result
647
+ }
648
+
649
+ // Firefox allows *any* value and treats invalid values like tabindex="-1"
650
+ // @browser-issue Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
651
+ var focusInvalidTabindex = {
652
+ element: 'div',
653
+ mutate: function mutate(element) {
654
+ element.setAttribute('tabindex', 'invalid-value')
655
+ },
656
+ }
657
+
658
+ var focusLabelTabindex = {
659
+ element: 'label',
660
+ mutate: function mutate(element) {
661
+ element.setAttribute('tabindex', '-1')
662
+ },
663
+ validate: function validate(element, focusTarget, _document) {
664
+ // force layout in Chrome 49, otherwise the element won't be focusable
665
+ /* eslint-disable no-unused-vars */
666
+ var variableToPreventDeadCodeElimination = element.offsetHeight
667
+ /* eslint-enable no-unused-vars */
668
+ element.focus()
669
+ return _document.activeElement === element
670
+ },
671
+ }
672
+
673
+ var svg =
674
+ 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtb' +
675
+ 'G5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBpZD0ic3ZnIj48dGV4dCB4PSIxMCIgeT0iMjAiIGlkPSJ' +
676
+ 'zdmctbGluay10ZXh0Ij50ZXh0PC90ZXh0Pjwvc3ZnPg=='
677
+
678
+ // Note: IE10 on BrowserStack does not like this test
679
+
680
+ var focusObjectSvgHidden = {
681
+ element: 'object',
682
+ mutate: function mutate(element) {
683
+ element.setAttribute('type', 'image/svg+xml')
684
+ element.setAttribute('data', svg)
685
+ element.setAttribute('width', '200')
686
+ element.setAttribute('height', '50')
687
+ element.style.visibility = 'hidden'
688
+ },
689
+ }
690
+
691
+ // Note: IE10 on BrowserStack does not like this test
692
+
693
+ var focusObjectSvg = {
694
+ name: 'can-focus-object-svg',
695
+ element: 'object',
696
+ mutate: function mutate(element) {
697
+ element.setAttribute('type', 'image/svg+xml')
698
+ element.setAttribute('data', svg)
699
+ element.setAttribute('width', '200')
700
+ element.setAttribute('height', '50')
701
+ },
702
+ validate: function validate(element, focusTarget, _document) {
703
+ if (platform.is.GECKO) {
704
+ // Firefox seems to be handling the object creation asynchronously and thereby produces a false negative test result.
705
+ // Because we know Firefox is able to focus object elements referencing SVGs, we simply cheat by sniffing the user agent string
706
+ return true
707
+ }
708
+
709
+ return _document.activeElement === element
710
+ },
711
+ }
712
+
713
+ // Every Environment except IE9 considers SWF objects focusable
714
+ var result$1 = !platform.is.IE9
715
+
716
+ function focusObjectSwf() {
717
+ return result$1
718
+ }
719
+
720
+ var focusRedirectImgUsemap = {
721
+ element: 'div',
722
+ mutate: function mutate(element) {
723
+ element.innerHTML =
724
+ '<map name="focus-redirect-img-usemap"><area href="#void" shape="rect" coords="63,19,144,45"></map>' +
725
+ '<img usemap="#focus-redirect-img-usemap" alt="" ' +
726
+ 'src="' +
727
+ gif +
728
+ '">'
729
+
730
+ // focus the <img>, not the <div>
731
+ return element.querySelector('img')
732
+ },
733
+ validate: function validate(element, focusTarget, _document) {
734
+ var target = element.querySelector('area')
735
+ return _document.activeElement === target
736
+ },
737
+ }
738
+
739
+ // see https://jsbin.com/nenirisage/edit?html,js,console,output
740
+
741
+ var focusRedirectLegend = {
742
+ element: 'fieldset',
743
+ mutate: function mutate(element) {
744
+ element.innerHTML =
745
+ '<legend>legend</legend><input tabindex="-1"><input tabindex="0">'
746
+ // take care of focus in validate();
747
+ return false
748
+ },
749
+ validate: function validate(element, focusTarget, _document) {
750
+ var focusable = element.querySelector('input[tabindex="-1"]')
751
+ var tabbable = element.querySelector('input[tabindex="0"]')
752
+
753
+ // Firefox requires this test to focus the <fieldset> first, while this is not necessary in
754
+ // https://jsbin.com/nenirisage/edit?html,js,console,output
755
+ element.focus()
756
+
757
+ element.querySelector('legend').focus()
758
+ return (
759
+ (_document.activeElement === focusable && 'focusable') ||
760
+ (_document.activeElement === tabbable && 'tabbable') ||
761
+ ''
762
+ )
763
+ },
764
+ }
765
+
766
+ // https://github.com/medialize/ally.js/issues/21
767
+ var focusScrollBody = {
768
+ element: 'div',
769
+ mutate: function mutate(element) {
770
+ element.setAttribute('style', 'width: 100px; height: 50px; overflow: auto;')
771
+ element.innerHTML =
772
+ '<div style="width: 500px; height: 40px;">scrollable content</div>'
773
+ return element.querySelector('div')
774
+ },
775
+ }
776
+
777
+ // https://github.com/medialize/ally.js/issues/21
778
+ var focusScrollContainerWithoutOverflow = {
779
+ element: 'div',
780
+ mutate: function mutate(element) {
781
+ element.setAttribute('style', 'width: 100px; height: 50px;')
782
+ element.innerHTML =
783
+ '<div style="width: 500px; height: 40px;">scrollable content</div>'
784
+ },
785
+ }
786
+
787
+ // https://github.com/medialize/ally.js/issues/21
788
+ var focusScrollContainer = {
789
+ element: 'div',
790
+ mutate: function mutate(element) {
791
+ element.setAttribute('style', 'width: 100px; height: 50px; overflow: auto;')
792
+ element.innerHTML =
793
+ '<div style="width: 500px; height: 40px;">scrollable content</div>'
794
+ },
795
+ }
796
+
797
+ var focusSummary = {
798
+ element: 'details',
799
+ mutate: function mutate(element) {
800
+ element.innerHTML = '<summary>foo</summary><p>content</p>'
801
+ return element.firstElementChild
802
+ },
803
+ }
804
+
805
+ function makeFocusableForeignObject() {
806
+ var fragment = document.createElement('div')
807
+ fragment.innerHTML =
808
+ '<svg><foreignObject width="30" height="30">\n <input type="text"/>\n </foreignObject></svg>'
809
+
810
+ return fragment.firstChild.firstChild
811
+ }
812
+
813
+ function focusSvgForeignObjectHack(element) {
814
+ // Edge13, Edge14: foreignObject focus hack
815
+ // https://jsbin.com/kunehinugi/edit?html,js,output
816
+ // https://jsbin.com/fajagi/3/edit?html,js,output
817
+ var isSvgElement =
818
+ element.ownerSVGElement || element.nodeName.toLowerCase() === 'svg'
819
+ if (!isSvgElement) {
820
+ return false
821
+ }
822
+
823
+ // inject and focus an <input> element into the SVG element to receive focus
824
+ var foreignObject = makeFocusableForeignObject()
825
+ element.appendChild(foreignObject)
826
+ var input = foreignObject.querySelector('input')
827
+ input.focus()
828
+
829
+ // upon disabling the activeElement, IE and Edge
830
+ // will not shift focus to <body> like all the other
831
+ // browsers, but instead find the first focusable
832
+ // ancestor and shift focus to that
833
+ input.disabled = true
834
+
835
+ // clean up
836
+ element.removeChild(foreignObject)
837
+ return true
838
+ }
839
+
840
+ function generate(element) {
841
+ return (
842
+ '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
843
+ element +
844
+ '</svg>'
845
+ )
846
+ }
847
+
848
+ function focus(element) {
849
+ if (element.focus) {
850
+ return
851
+ }
852
+
853
+ try {
854
+ HTMLElement.prototype.focus.call(element)
855
+ } catch (e) {
856
+ focusSvgForeignObjectHack(element)
857
+ }
858
+ }
859
+
860
+ function validate(element, focusTarget, _document) {
861
+ focus(focusTarget)
862
+ return _document.activeElement === focusTarget
863
+ }
864
+
865
+ var focusSvgFocusableAttribute = {
866
+ element: 'div',
867
+ mutate: function mutate(element) {
868
+ element.innerHTML = generate('<text focusable="true">a</text>')
869
+ return element.querySelector('text')
870
+ },
871
+ validate: validate,
872
+ }
873
+
874
+ var focusSvgTabindexAttribute = {
875
+ element: 'div',
876
+ mutate: function mutate(element) {
877
+ element.innerHTML = generate('<text tabindex="0">a</text>')
878
+ return element.querySelector('text')
879
+ },
880
+ validate: validate,
881
+ }
882
+
883
+ var focusSvgNegativeTabindexAttribute = {
884
+ element: 'div',
885
+ mutate: function mutate(element) {
886
+ element.innerHTML = generate('<text tabindex="-1">a</text>')
887
+ return element.querySelector('text')
888
+ },
889
+ validate: validate,
890
+ }
891
+
892
+ var focusSvgUseTabindex = {
893
+ element: 'div',
894
+ mutate: function mutate(element) {
895
+ element.innerHTML = generate(
896
+ [
897
+ '<g id="ally-test-target"><a xlink:href="#void"><text>link</text></a></g>',
898
+ '<use xlink:href="#ally-test-target" x="0" y="0" tabindex="-1" />',
899
+ ].join('')
900
+ )
901
+
902
+ return element.querySelector('use')
903
+ },
904
+ validate: validate,
905
+ }
906
+
907
+ var focusSvgForeignobjectTabindex = {
908
+ element: 'div',
909
+ mutate: function mutate(element) {
910
+ element.innerHTML = generate(
911
+ '<foreignObject tabindex="-1"><input type="text" /></foreignObject>'
912
+ )
913
+ // Safari 8's quersSelector() can't identify foreignObject, but getElementyByTagName() can
914
+ return (
915
+ element.querySelector('foreignObject') ||
916
+ element.getElementsByTagName('foreignObject')[0]
917
+ )
918
+ },
919
+ validate: validate,
920
+ }
921
+
922
+ // Firefox seems to be handling the SVG-document-in-iframe creation asynchronously
923
+ // and thereby produces a false negative test result. Thus the test is pointless
924
+ // and we resort to UA sniffing once again.
925
+ // see http://jsbin.com/vunadohoko/1/edit?js,console,output
926
+
927
+ var result$2 = Boolean(
928
+ platform.is.GECKO &&
929
+ typeof SVGElement !== 'undefined' &&
930
+ SVGElement.prototype.focus
931
+ )
932
+
933
+ function focusSvgInIframe() {
934
+ return result$2
935
+ }
936
+
937
+ var focusSvg = {
938
+ element: 'div',
939
+ mutate: function mutate(element) {
940
+ element.innerHTML = generate('')
941
+ return element.firstChild
942
+ },
943
+ validate: validate,
944
+ }
945
+
946
+ // Firefox allows *any* value and treats invalid values like tabindex="-1"
947
+ // @browser-issue Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
948
+ var focusTabindexTrailingCharacters = {
949
+ element: 'div',
950
+ mutate: function mutate(element) {
951
+ element.setAttribute('tabindex', '3x')
952
+ },
953
+ }
954
+
955
+ var focusTable = {
956
+ element: 'table',
957
+ mutate: function mutate(element, wrapper, _document) {
958
+ // IE9 has a problem replacing TBODY contents with innerHTML.
959
+ // https://stackoverflow.com/a/8097055/515124
960
+ // element.innerHTML = '<tr><td>cell</td></tr>';
961
+ var fragment = _document.createDocumentFragment()
962
+ fragment.innerHTML = '<tr><td>cell</td></tr>'
963
+ element.appendChild(fragment)
964
+ },
965
+ }
966
+
967
+ var focusVideoWithoutControls = {
968
+ element: 'video',
969
+ mutate: function mutate(element) {
970
+ try {
971
+ // invalid media file can trigger warning in console, data-uri to prevent HTTP request
972
+ element.setAttribute('src', gif)
973
+ } catch (e) {
974
+ // IE9 may throw "Error: Not implemented"
975
+ }
976
+ },
977
+ }
978
+
979
+ // https://jsbin.com/vafaba/3/edit?html,js,console,output
980
+ var result$3 = platform.is.GECKO || platform.is.TRIDENT || platform.is.EDGE
981
+
982
+ function tabsequenceAreaAtImgPosition() {
983
+ return result$3
984
+ }
985
+
986
+ var testCallbacks = {
987
+ cssShadowPiercingDeepCombinator: cssShadowPiercingDeepCombinator,
988
+ focusInZeroDimensionObject: focusInZeroDimensionObject,
989
+ focusObjectSwf: focusObjectSwf,
990
+ focusSvgInIframe: focusSvgInIframe,
991
+ tabsequenceAreaAtImgPosition: tabsequenceAreaAtImgPosition,
992
+ }
993
+
994
+ var testDescriptions = {
995
+ focusAreaImgTabindex: focusAreaImgTabindex,
996
+ focusAreaTabindex: focusAreaTabindex,
997
+ focusAreaWithoutHref: focusAreaWithoutHref,
998
+ focusAudioWithoutControls: focusAudioWithoutControls,
999
+ focusBrokenImageMap: focusBrokenImageMap,
1000
+ focusChildrenOfFocusableFlexbox: focusChildrenOfFocusableFlexbox,
1001
+ focusFieldsetDisabled: focusFieldsetDisabled,
1002
+ focusFieldset: focusFieldset,
1003
+ focusFlexboxContainer: focusFlexboxContainer,
1004
+ focusFormDisabled: focusFormDisabled,
1005
+ focusImgIsmap: focusImgIsmap,
1006
+ focusImgUsemapTabindex: focusImgUsemapTabindex,
1007
+ focusInHiddenIframe: focusInHiddenIframe,
1008
+ focusInvalidTabindex: focusInvalidTabindex,
1009
+ focusLabelTabindex: focusLabelTabindex,
1010
+ focusObjectSvg: focusObjectSvg,
1011
+ focusObjectSvgHidden: focusObjectSvgHidden,
1012
+ focusRedirectImgUsemap: focusRedirectImgUsemap,
1013
+ focusRedirectLegend: focusRedirectLegend,
1014
+ focusScrollBody: focusScrollBody,
1015
+ focusScrollContainerWithoutOverflow: focusScrollContainerWithoutOverflow,
1016
+ focusScrollContainer: focusScrollContainer,
1017
+ focusSummary: focusSummary,
1018
+ focusSvgFocusableAttribute: focusSvgFocusableAttribute,
1019
+ focusSvgTabindexAttribute: focusSvgTabindexAttribute,
1020
+ focusSvgNegativeTabindexAttribute: focusSvgNegativeTabindexAttribute,
1021
+ focusSvgUseTabindex: focusSvgUseTabindex,
1022
+ focusSvgForeignobjectTabindex: focusSvgForeignobjectTabindex,
1023
+ focusSvg: focusSvg,
1024
+ focusTabindexTrailingCharacters: focusTabindexTrailingCharacters,
1025
+ focusTable: focusTable,
1026
+ focusVideoWithoutControls: focusVideoWithoutControls,
1027
+ }
1028
+
1029
+ function executeTests() {
1030
+ var results = detectFocus(testDescriptions)
1031
+ Object.keys(testCallbacks).forEach(function (key) {
1032
+ results[key] = testCallbacks[key]()
1033
+ })
1034
+
1035
+ return results
1036
+ }
1037
+
1038
+ var supportsCache = null
1039
+
1040
+ function _supports() {
1041
+ if (supportsCache) {
1042
+ return supportsCache
1043
+ }
1044
+
1045
+ supportsCache = cache$1.get()
1046
+ if (!supportsCache.time) {
1047
+ cache$1.set(executeTests())
1048
+ supportsCache = cache$1.get()
1049
+ }
1050
+
1051
+ return supportsCache
1052
+ }
1053
+
1054
+ var supports = void 0
1055
+
1056
+ // https://www.w3.org/TR/html5/infrastructure.html#rules-for-parsing-integers
1057
+ // NOTE: all browsers agree to allow trailing spaces as well
1058
+ var validIntegerPatternNoTrailing = /^\s*(-|\+)?[0-9]+\s*$/
1059
+ var validIntegerPatternWithTrailing = /^\s*(-|\+)?[0-9]+.*$/
1060
+
1061
+ function isValidTabindex(context) {
1062
+ if (!supports) {
1063
+ supports = _supports()
1064
+ }
1065
+
1066
+ var validIntegerPattern = supports.focusTabindexTrailingCharacters
1067
+ ? validIntegerPatternWithTrailing
1068
+ : validIntegerPatternNoTrailing
1069
+
1070
+ var element = contextToElement({
1071
+ label: 'is/valid-tabindex',
1072
+ resolveDocument: true,
1073
+ context: context,
1074
+ })
1075
+
1076
+ // Edge 14 has a capitalization problem on SVG elements,
1077
+ // see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9282058/
1078
+ var hasTabindex = element.hasAttribute('tabindex')
1079
+ var hasTabIndex = element.hasAttribute('tabIndex')
1080
+
1081
+ if (!hasTabindex && !hasTabIndex) {
1082
+ return false
1083
+ }
1084
+
1085
+ // older Firefox and Internet Explorer don't support tabindex on SVG elements
1086
+ var isSvgElement =
1087
+ element.ownerSVGElement || element.nodeName.toLowerCase() === 'svg'
1088
+ if (isSvgElement && !supports.focusSvgTabindexAttribute) {
1089
+ return false
1090
+ }
1091
+
1092
+ // @browser-issue Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
1093
+ if (supports.focusInvalidTabindex) {
1094
+ return true
1095
+ }
1096
+
1097
+ // an element matches the tabindex selector even if its value is invalid
1098
+ var tabindex = element.getAttribute(hasTabindex ? 'tabindex' : 'tabIndex')
1099
+ // IE11 parses tabindex="" as the value "-32768"
1100
+ // @browser-issue Trident https://connect.microsoft.com/IE/feedback/details/1072965
1101
+ if (tabindex === '-32768') {
1102
+ return false
1103
+ }
1104
+
1105
+ return Boolean(tabindex && validIntegerPattern.test(tabindex))
1106
+ }
1107
+
1108
+ function tabindexValue(element) {
1109
+ if (!isValidTabindex(element)) {
1110
+ return null
1111
+ }
1112
+
1113
+ // Edge 14 has a capitalization problem on SVG elements,
1114
+ // see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9282058/
1115
+ var hasTabindex = element.hasAttribute('tabindex')
1116
+ var attributeName = hasTabindex ? 'tabindex' : 'tabIndex'
1117
+
1118
+ // @browser-issue Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054
1119
+ var tabindex = parseInt(element.getAttribute(attributeName), 10)
1120
+ return isNaN(tabindex) ? -1 : tabindex
1121
+ }
1122
+
1123
+ // this is a shared utility file for focus-relevant.js and tabbable.js
1124
+ // separate testing of this file's functions is not necessary,
1125
+ // as they're implicitly tested by way of the consumers
1126
+
1127
+ function isUserModifyWritable(style) {
1128
+ // https://www.w3.org/TR/1999/WD-css3-userint-19990916#user-modify
1129
+ // https://github.com/medialize/ally.js/issues/17
1130
+ var userModify = style.webkitUserModify || ''
1131
+ return Boolean(userModify && userModify.indexOf('write') !== -1)
1132
+ }
1133
+
1134
+ function hasCssOverflowScroll(style) {
1135
+ return [
1136
+ style.getPropertyValue('overflow'),
1137
+ style.getPropertyValue('overflow-x'),
1138
+ style.getPropertyValue('overflow-y'),
1139
+ ].some(function (overflow) {
1140
+ return overflow === 'auto' || overflow === 'scroll'
1141
+ })
1142
+ }
1143
+
1144
+ function hasCssDisplayFlex(style) {
1145
+ return style.display.indexOf('flex') > -1
1146
+ }
1147
+
1148
+ function isScrollableContainer(element, nodeName, parentNodeName, parentStyle) {
1149
+ if (nodeName !== 'div' && nodeName !== 'span') {
1150
+ // Internet Explorer advances scrollable containers and bodies to focusable
1151
+ // only if the scrollable container is <div> or <span> - this does *not*
1152
+ // happen for <section>, <article>, …
1153
+ return false
1154
+ }
1155
+
1156
+ if (
1157
+ parentNodeName &&
1158
+ parentNodeName !== 'div' &&
1159
+ parentNodeName !== 'span' &&
1160
+ !hasCssOverflowScroll(parentStyle)
1161
+ ) {
1162
+ return false
1163
+ }
1164
+
1165
+ return (
1166
+ element.offsetHeight < element.scrollHeight ||
1167
+ element.offsetWidth < element.scrollWidth
1168
+ )
1169
+ }
1170
+
1171
+ var supports$1 = void 0
1172
+
1173
+ function isFocusRelevantRules() {
1174
+ var _ref =
1175
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1176
+ context = _ref.context,
1177
+ _ref$except = _ref.except,
1178
+ except =
1179
+ _ref$except === undefined
1180
+ ? {
1181
+ flexbox: false,
1182
+ scrollable: false,
1183
+ shadow: false,
1184
+ }
1185
+ : _ref$except
1186
+
1187
+ if (!supports$1) {
1188
+ supports$1 = _supports()
1189
+ }
1190
+
1191
+ var element = contextToElement({
1192
+ label: 'is/focus-relevant',
1193
+ resolveDocument: true,
1194
+ context: context,
1195
+ })
1196
+
1197
+ if (!except.shadow && element.shadowRoot) {
1198
+ // a ShadowDOM host receives focus when the focus moves to its content
1199
+ return true
1200
+ }
1201
+
1202
+ var nodeName = element.nodeName.toLowerCase()
1203
+
1204
+ if (nodeName === 'input' && element.type === 'hidden') {
1205
+ // input[type="hidden"] supports.cannot be focused
1206
+ return false
1207
+ }
1208
+
1209
+ if (
1210
+ nodeName === 'input' ||
1211
+ nodeName === 'select' ||
1212
+ nodeName === 'button' ||
1213
+ nodeName === 'textarea'
1214
+ ) {
1215
+ return true
1216
+ }
1217
+
1218
+ if (nodeName === 'legend' && supports$1.focusRedirectLegend) {
1219
+ // specifics filtered in is/focusable
1220
+ return true
1221
+ }
1222
+
1223
+ if (nodeName === 'label') {
1224
+ // specifics filtered in is/focusable
1225
+ return true
1226
+ }
1227
+
1228
+ if (nodeName === 'area') {
1229
+ // specifics filtered in is/focusable
1230
+ return true
1231
+ }
1232
+
1233
+ if (nodeName === 'a' && element.hasAttribute('href')) {
1234
+ return true
1235
+ }
1236
+
1237
+ if (nodeName === 'object' && element.hasAttribute('usemap')) {
1238
+ // object[usemap] is not focusable in any browser
1239
+ return false
1240
+ }
1241
+
1242
+ if (nodeName === 'object') {
1243
+ var svgType = element.getAttribute('type')
1244
+ if (!supports$1.focusObjectSvg && svgType === 'image/svg+xml') {
1245
+ // object[type="image/svg+xml"] is not focusable in Internet Explorer
1246
+ return false
1247
+ } else if (
1248
+ !supports$1.focusObjectSwf &&
1249
+ svgType === 'application/x-shockwave-flash'
1250
+ ) {
1251
+ // object[type="application/x-shockwave-flash"] is not focusable in Internet Explorer 9
1252
+ return false
1253
+ }
1254
+ }
1255
+
1256
+ if (nodeName === 'iframe' || nodeName === 'object') {
1257
+ // browsing context containers
1258
+ return true
1259
+ }
1260
+
1261
+ if (nodeName === 'embed' || nodeName === 'keygen') {
1262
+ // embed is considered focus-relevant but not focusable
1263
+ // see https://github.com/medialize/ally.js/issues/82
1264
+ return true
1265
+ }
1266
+
1267
+ if (element.hasAttribute('contenteditable')) {
1268
+ // also see CSS property user-modify below
1269
+ return true
1270
+ }
1271
+
1272
+ if (
1273
+ nodeName === 'audio' &&
1274
+ (supports$1.focusAudioWithoutControls || element.hasAttribute('controls'))
1275
+ ) {
1276
+ return true
1277
+ }
1278
+
1279
+ if (
1280
+ nodeName === 'video' &&
1281
+ (supports$1.focusVideoWithoutControls || element.hasAttribute('controls'))
1282
+ ) {
1283
+ return true
1284
+ }
1285
+
1286
+ if (supports$1.focusSummary && nodeName === 'summary') {
1287
+ return true
1288
+ }
1289
+
1290
+ var validTabindex = isValidTabindex(element)
1291
+
1292
+ if (nodeName === 'img' && element.hasAttribute('usemap')) {
1293
+ // Gecko, Trident and Edge do not allow an image with an image map and tabindex to be focused,
1294
+ // it appears the tabindex is overruled so focus is still forwarded to the <map>
1295
+ return (
1296
+ (validTabindex && supports$1.focusImgUsemapTabindex) ||
1297
+ supports$1.focusRedirectImgUsemap
1298
+ )
1299
+ }
1300
+
1301
+ if (supports$1.focusTable && (nodeName === 'table' || nodeName === 'td')) {
1302
+ // IE10-11 supports.can focus <table> and <td>
1303
+ return true
1304
+ }
1305
+
1306
+ if (supports$1.focusFieldset && nodeName === 'fieldset') {
1307
+ // IE10-11 supports.can focus <fieldset>
1308
+ return true
1309
+ }
1310
+
1311
+ var isSvgElement = nodeName === 'svg'
1312
+ var isSvgContent = element.ownerSVGElement
1313
+ var focusableAttribute = element.getAttribute('focusable')
1314
+ var tabindex = tabindexValue(element)
1315
+
1316
+ if (
1317
+ nodeName === 'use' &&
1318
+ tabindex !== null &&
1319
+ !supports$1.focusSvgUseTabindex
1320
+ ) {
1321
+ // <use> cannot be made focusable by adding a tabindex attribute anywhere but Blink and WebKit
1322
+ return false
1323
+ }
1324
+
1325
+ if (nodeName === 'foreignobject') {
1326
+ // <use> can only be made focusable in Blink and WebKit
1327
+ return tabindex !== null && supports$1.focusSvgForeignobjectTabindex
1328
+ }
1329
+
1330
+ if (elementMatches(element, 'svg a') && element.hasAttribute('xlink:href')) {
1331
+ return true
1332
+ }
1333
+
1334
+ if (
1335
+ (isSvgElement || isSvgContent) &&
1336
+ element.focus &&
1337
+ !supports$1.focusSvgNegativeTabindexAttribute &&
1338
+ tabindex < 0
1339
+ ) {
1340
+ // Firefox 51 and 52 treat any natively tabbable SVG element with
1341
+ // tabindex="-1" as tabbable and everything else as inert
1342
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=1302340
1343
+ return false
1344
+ }
1345
+
1346
+ if (isSvgElement) {
1347
+ return (
1348
+ validTabindex ||
1349
+ supports$1.focusSvg ||
1350
+ supports$1.focusSvgInIframe ||
1351
+ // Internet Explorer understands the focusable attribute introduced in SVG Tiny 1.2
1352
+ Boolean(
1353
+ supports$1.focusSvgFocusableAttribute &&
1354
+ focusableAttribute &&
1355
+ focusableAttribute === 'true'
1356
+ )
1357
+ )
1358
+ }
1359
+
1360
+ if (isSvgContent) {
1361
+ if (supports$1.focusSvgTabindexAttribute && validTabindex) {
1362
+ return true
1363
+ }
1364
+
1365
+ if (supports$1.focusSvgFocusableAttribute) {
1366
+ // Internet Explorer understands the focusable attribute introduced in SVG Tiny 1.2
1367
+ return focusableAttribute === 'true'
1368
+ }
1369
+ }
1370
+
1371
+ // https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute
1372
+ if (validTabindex) {
1373
+ return true
1374
+ }
1375
+
1376
+ var style = window.getComputedStyle(element, null)
1377
+ if (isUserModifyWritable(style)) {
1378
+ return true
1379
+ }
1380
+
1381
+ if (
1382
+ supports$1.focusImgIsmap &&
1383
+ nodeName === 'img' &&
1384
+ element.hasAttribute('ismap')
1385
+ ) {
1386
+ // IE10-11 considers the <img> in <a href><img ismap> focusable
1387
+ // https://github.com/medialize/ally.js/issues/20
1388
+ var hasLinkParent = getParents({ context: element }).some(function (
1389
+ parent
1390
+ ) {
1391
+ return (
1392
+ parent.nodeName.toLowerCase() === 'a' && parent.hasAttribute('href')
1393
+ )
1394
+ })
1395
+
1396
+ if (hasLinkParent) {
1397
+ return true
1398
+ }
1399
+ }
1400
+
1401
+ // https://github.com/medialize/ally.js/issues/21
1402
+ if (!except.scrollable && supports$1.focusScrollContainer) {
1403
+ if (supports$1.focusScrollContainerWithoutOverflow) {
1404
+ // Internet Explorer does will consider the scrollable area focusable
1405
+ // if the element is a <div> or a <span> and it is in fact scrollable,
1406
+ // regardless of the CSS overflow property
1407
+ if (isScrollableContainer(element, nodeName)) {
1408
+ return true
1409
+ }
1410
+ } else if (hasCssOverflowScroll(style)) {
1411
+ // Firefox requires proper overflow setting, IE does not necessarily
1412
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
1413
+ return true
1414
+ }
1415
+ }
1416
+
1417
+ if (
1418
+ !except.flexbox &&
1419
+ supports$1.focusFlexboxContainer &&
1420
+ hasCssDisplayFlex(style)
1421
+ ) {
1422
+ // elements with display:flex are focusable in IE10-11
1423
+ return true
1424
+ }
1425
+
1426
+ var parent = element.parentElement
1427
+ if (!except.scrollable && parent) {
1428
+ var parentNodeName = parent.nodeName.toLowerCase()
1429
+ var parentStyle = window.getComputedStyle(parent, null)
1430
+ if (
1431
+ supports$1.focusScrollBody &&
1432
+ isScrollableContainer(parent, nodeName, parentNodeName, parentStyle)
1433
+ ) {
1434
+ // scrollable bodies are focusable Internet Explorer
1435
+ // https://github.com/medialize/ally.js/issues/21
1436
+ return true
1437
+ }
1438
+
1439
+ // Children of focusable elements with display:flex are focusable in IE10-11
1440
+ if (supports$1.focusChildrenOfFocusableFlexbox) {
1441
+ if (hasCssDisplayFlex(parentStyle)) {
1442
+ return true
1443
+ }
1444
+ }
1445
+ }
1446
+
1447
+ // NOTE: elements marked as inert are not focusable,
1448
+ // but that property is not exposed to the DOM
1449
+ // https://www.w3.org/TR/html5/editing.html#inert
1450
+
1451
+ return false
1452
+ }
1453
+
1454
+ // bind exceptions to an iterator callback
1455
+ isFocusRelevantRules.except = function () {
1456
+ var except =
1457
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}
1458
+
1459
+ var isFocusRelevant = function isFocusRelevant(context) {
1460
+ return isFocusRelevantRules({
1461
+ context: context,
1462
+ except: except,
1463
+ })
1464
+ }
1465
+
1466
+ isFocusRelevant.rules = isFocusRelevantRules
1467
+ return isFocusRelevant
1468
+ }
1469
+
1470
+ // provide isFocusRelevant(context) as default iterator callback
1471
+ var isFocusRelevant = isFocusRelevantRules.except({})
1472
+
1473
+ function findIndex(array, callback) {
1474
+ // attempt to use native or polyfilled Array#findIndex first
1475
+ if (array.findIndex) {
1476
+ return array.findIndex(callback)
1477
+ }
1478
+
1479
+ var length = array.length
1480
+
1481
+ // shortcut if the array is empty
1482
+ if (length === 0) {
1483
+ return -1
1484
+ }
1485
+
1486
+ // otherwise loop over array
1487
+ for (var i = 0; i < length; i++) {
1488
+ if (callback(array[i], i, array)) {
1489
+ return i
1490
+ }
1491
+ }
1492
+
1493
+ return -1
1494
+ }
1495
+
1496
+ function getContentDocument(node) {
1497
+ try {
1498
+ // works on <object> and <iframe>
1499
+ return (
1500
+ node.contentDocument ||
1501
+ // works on <object> and <iframe>
1502
+ (node.contentWindow && node.contentWindow.document) ||
1503
+ // works on <object> and <iframe> that contain SVG
1504
+ (node.getSVGDocument && node.getSVGDocument()) ||
1505
+ null
1506
+ )
1507
+ } catch (e) {
1508
+ // SecurityError: Failed to read the 'contentDocument' property from 'HTMLObjectElement'
1509
+ // also IE may throw member not found exception e.g. on <object type="image/png">
1510
+ return null
1511
+ }
1512
+ }
1513
+
1514
+ function getWindow(node) {
1515
+ var _document = getDocument(node)
1516
+ return _document.defaultView || window
1517
+ }
1518
+
1519
+ var shadowPrefix = void 0
1520
+
1521
+ function selectInShadows(selector) {
1522
+ if (typeof shadowPrefix !== 'string') {
1523
+ var operator = cssShadowPiercingDeepCombinator()
1524
+ if (operator) {
1525
+ shadowPrefix = ', html ' + operator + ' '
1526
+ }
1527
+ }
1528
+
1529
+ if (!shadowPrefix) {
1530
+ return selector
1531
+ }
1532
+
1533
+ return (
1534
+ selector +
1535
+ shadowPrefix +
1536
+ selector
1537
+ .replace(/\s*,\s*/g, ',')
1538
+ .split(',')
1539
+ .join(shadowPrefix)
1540
+ )
1541
+ }
1542
+
1543
+ var selector = void 0
1544
+
1545
+ function findDocumentHostElement(_window) {
1546
+ if (!selector) {
1547
+ selector = selectInShadows('object, iframe')
1548
+ }
1549
+
1550
+ if (_window._frameElement !== undefined) {
1551
+ return _window._frameElement
1552
+ }
1553
+
1554
+ _window._frameElement = null
1555
+
1556
+ var potentialHosts = _window.parent.document.querySelectorAll(selector)
1557
+ ;[].some.call(potentialHosts, function (element) {
1558
+ var _document = getContentDocument(element)
1559
+ if (_document !== _window.document) {
1560
+ return false
1561
+ }
1562
+
1563
+ _window._frameElement = element
1564
+ return true
1565
+ })
1566
+
1567
+ return _window._frameElement
1568
+ }
1569
+
1570
+ function getFrameElement(element) {
1571
+ var _window = getWindow(element)
1572
+ if (!_window.parent || _window.parent === _window) {
1573
+ // if there is no parent browsing context,
1574
+ // we're not going to get a frameElement either way
1575
+ return null
1576
+ }
1577
+
1578
+ try {
1579
+ // see https://developer.mozilla.org/en-US/docs/Web/API/Window/frameElement
1580
+ // does not work within <embed> anywhere, and not within in <object> in IE
1581
+ return _window.frameElement || findDocumentHostElement(_window)
1582
+ } catch (e) {
1583
+ return null
1584
+ }
1585
+ }
1586
+
1587
+ // https://www.w3.org/TR/html5/rendering.html#being-rendered
1588
+ // <area> is not rendered, but we *consider* it visible to simplfiy this function's usage
1589
+ var notRenderedElementsPattern = /^(area)$/
1590
+
1591
+ function computedStyle(element, property) {
1592
+ return window.getComputedStyle(element, null).getPropertyValue(property)
1593
+ }
1594
+
1595
+ function notDisplayed(_path) {
1596
+ return _path.some(function (element) {
1597
+ // display:none is not visible (optimized away at layout)
1598
+ return computedStyle(element, 'display') === 'none'
1599
+ })
1600
+ }
1601
+
1602
+ function notVisible(_path) {
1603
+ // https://github.com/jquery/jquery-ui/blob/master/ui/core.js#L109-L114
1604
+ // NOTE: a nested element can reverse visibility:hidden|collapse by explicitly setting visibility:visible
1605
+ // NOTE: visibility can be ["", "visible", "hidden", "collapse"]
1606
+ var hidden = findIndex(_path, function (element) {
1607
+ var visibility = computedStyle(element, 'visibility')
1608
+ return visibility === 'hidden' || visibility === 'collapse'
1609
+ })
1610
+
1611
+ if (hidden === -1) {
1612
+ // there is no hidden element
1613
+ return false
1614
+ }
1615
+
1616
+ var visible = findIndex(_path, function (element) {
1617
+ return computedStyle(element, 'visibility') === 'visible'
1618
+ })
1619
+
1620
+ if (visible === -1) {
1621
+ // there is no visible element (but a hidden element)
1622
+ return true
1623
+ }
1624
+
1625
+ if (hidden < visible) {
1626
+ // there is a hidden element and it's closer than the first visible element
1627
+ return true
1628
+ }
1629
+
1630
+ // there may be a hidden element, but the closest element is visible
1631
+ return false
1632
+ }
1633
+
1634
+ function collapsedParent(_path) {
1635
+ var offset = 1
1636
+ if (_path[0].nodeName.toLowerCase() === 'summary') {
1637
+ offset = 2
1638
+ }
1639
+
1640
+ return _path.slice(offset).some(function (element) {
1641
+ // "content children" of a closed details element are not visible
1642
+ return (
1643
+ element.nodeName.toLowerCase() === 'details' && element.open === false
1644
+ )
1645
+ })
1646
+ }
1647
+
1648
+ function isVisibleRules() {
1649
+ var _ref =
1650
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1651
+ context = _ref.context,
1652
+ _ref$except = _ref.except,
1653
+ except =
1654
+ _ref$except === undefined
1655
+ ? {
1656
+ notRendered: false,
1657
+ cssDisplay: false,
1658
+ cssVisibility: false,
1659
+ detailsElement: false,
1660
+ browsingContext: false,
1661
+ }
1662
+ : _ref$except
1663
+
1664
+ var element = contextToElement({
1665
+ label: 'is/visible',
1666
+ resolveDocument: true,
1667
+ context: context,
1668
+ })
1669
+
1670
+ var nodeName = element.nodeName.toLowerCase()
1671
+ if (!except.notRendered && notRenderedElementsPattern.test(nodeName)) {
1672
+ return true
1673
+ }
1674
+
1675
+ var _path = getParents({ context: element })
1676
+
1677
+ // in Internet Explorer <audio> has a default display: none, where others have display: inline
1678
+ // but IE allows focusing <audio style="display:none">, but not <div display:none><audio>
1679
+ // this is irrelevant to other browsers, as the controls attribute is required to make <audio> focusable
1680
+ var isAudioWithoutControls =
1681
+ nodeName === 'audio' && !element.hasAttribute('controls')
1682
+ if (
1683
+ !except.cssDisplay &&
1684
+ notDisplayed(isAudioWithoutControls ? _path.slice(1) : _path)
1685
+ ) {
1686
+ return false
1687
+ }
1688
+
1689
+ if (!except.cssVisibility && notVisible(_path)) {
1690
+ return false
1691
+ }
1692
+
1693
+ if (!except.detailsElement && collapsedParent(_path)) {
1694
+ return false
1695
+ }
1696
+
1697
+ if (!except.browsingContext) {
1698
+ // elements within a browsing context are affected by the
1699
+ // browsing context host element's visibility and tabindex
1700
+ var frameElement = getFrameElement(element)
1701
+ var _isVisible = isVisibleRules.except(except)
1702
+ if (frameElement && !_isVisible(frameElement)) {
1703
+ return false
1704
+ }
1705
+ }
1706
+
1707
+ return true
1708
+ }
1709
+
1710
+ // bind exceptions to an iterator callback
1711
+ isVisibleRules.except = function () {
1712
+ var except =
1713
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}
1714
+
1715
+ var isVisible = function isVisible(context) {
1716
+ return isVisibleRules({
1717
+ context: context,
1718
+ except: except,
1719
+ })
1720
+ }
1721
+
1722
+ isVisible.rules = isVisibleRules
1723
+ return isVisible
1724
+ }
1725
+
1726
+ // provide isVisible(context) as default iterator callback
1727
+ var isVisible = isVisibleRules.except({})
1728
+
1729
+ function getMapByName(name, _document) {
1730
+ // apparently getElementsByName() also considers id attribute in IE & opera
1731
+ // https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
1732
+ var map = _document.querySelector('map[name="' + cssEscape(name) + '"]')
1733
+ return map || null
1734
+ }
1735
+
1736
+ function getImageOfArea(element) {
1737
+ var map = element.parentElement
1738
+
1739
+ if (!map.name || map.nodeName.toLowerCase() !== 'map') {
1740
+ return null
1741
+ }
1742
+
1743
+ // NOTE: image maps can also be applied to <object> with image content,
1744
+ // but no browser supports this at the moment
1745
+
1746
+ // HTML5 specifies HTMLMapElement.images to be an HTMLCollection of all
1747
+ // <img> and <object> referencing the <map> element, but no browser implements this
1748
+ // https://www.w3.org/TR/html5/embedded-content-0.html#the-map-element
1749
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLMapElement
1750
+ // the image must be valid and loaded for the map to take effect
1751
+ var _document = getDocument(element)
1752
+ return (
1753
+ _document.querySelector('img[usemap="#' + cssEscape(map.name) + '"]') ||
1754
+ null
1755
+ )
1756
+ }
1757
+
1758
+ var supports$2 = void 0
1759
+
1760
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map
1761
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
1762
+ // https://github.com/jquery/jquery-ui/blob/master/ui/core.js#L88-L107
1763
+ function isValidArea(context) {
1764
+ if (!supports$2) {
1765
+ supports$2 = _supports()
1766
+ }
1767
+
1768
+ var element = contextToElement({
1769
+ label: 'is/valid-area',
1770
+ context: context,
1771
+ })
1772
+
1773
+ var nodeName = element.nodeName.toLowerCase()
1774
+ if (nodeName !== 'area') {
1775
+ return false
1776
+ }
1777
+
1778
+ var hasTabindex = element.hasAttribute('tabindex')
1779
+ if (!supports$2.focusAreaTabindex && hasTabindex) {
1780
+ // Blink and WebKit do not consider <area tabindex="-1" href="#void"> focusable
1781
+ return false
1782
+ }
1783
+
1784
+ var img = getImageOfArea(element)
1785
+ if (!img || !isVisible(img)) {
1786
+ return false
1787
+ }
1788
+
1789
+ // Firefox only allows fully loaded images to reference image maps
1790
+ // https://stereochro.me/ideas/detecting-broken-images-js
1791
+ if (
1792
+ !supports$2.focusBrokenImageMap &&
1793
+ (!img.complete ||
1794
+ !img.naturalHeight ||
1795
+ img.offsetWidth <= 0 ||
1796
+ img.offsetHeight <= 0)
1797
+ ) {
1798
+ return false
1799
+ }
1800
+
1801
+ // Firefox supports.can focus area elements even if they don't have an href attribute
1802
+ if (!supports$2.focusAreaWithoutHref && !element.href) {
1803
+ // Internet explorer supports.can focus area elements without href if either
1804
+ // the area element or the image element has a tabindex attribute
1805
+ return (
1806
+ (supports$2.focusAreaTabindex && hasTabindex) ||
1807
+ (supports$2.focusAreaImgTabindex && img.hasAttribute('tabindex'))
1808
+ )
1809
+ }
1810
+
1811
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-usemap
1812
+ var childOfInteractive = getParents({ context: img })
1813
+ .slice(1)
1814
+ .some(function (_element) {
1815
+ var name = _element.nodeName.toLowerCase()
1816
+ return name === 'button' || name === 'a'
1817
+ })
1818
+
1819
+ if (childOfInteractive) {
1820
+ return false
1821
+ }
1822
+
1823
+ return true
1824
+ }
1825
+
1826
+ var supports$3 = void 0
1827
+
1828
+ // https://www.w3.org/TR/html5/disabled-elements.html#concept-element-disabled
1829
+ var disabledElementsPattern = void 0
1830
+ var disabledElements = {
1831
+ input: true,
1832
+ select: true,
1833
+ textarea: true,
1834
+ button: true,
1835
+ fieldset: true,
1836
+ form: true,
1837
+ }
1838
+
1839
+ function isNativeDisabledSupported(context) {
1840
+ if (!supports$3) {
1841
+ supports$3 = _supports()
1842
+
1843
+ if (supports$3.focusFieldsetDisabled) {
1844
+ delete disabledElements.fieldset
1845
+ }
1846
+
1847
+ if (supports$3.focusFormDisabled) {
1848
+ delete disabledElements.form
1849
+ }
1850
+
1851
+ disabledElementsPattern = new RegExp(
1852
+ '^(' + Object.keys(disabledElements).join('|') + ')$'
1853
+ )
1854
+ }
1855
+
1856
+ var element = contextToElement({
1857
+ label: 'is/native-disabled-supported',
1858
+ context: context,
1859
+ })
1860
+
1861
+ var nodeName = element.nodeName.toLowerCase()
1862
+ return Boolean(disabledElementsPattern.test(nodeName))
1863
+ }
1864
+
1865
+ var supports$4 = void 0
1866
+
1867
+ function isDisabledFieldset(element) {
1868
+ var nodeName = element.nodeName.toLowerCase()
1869
+ return nodeName === 'fieldset' && element.disabled
1870
+ }
1871
+
1872
+ function isDisabledForm(element) {
1873
+ var nodeName = element.nodeName.toLowerCase()
1874
+ return nodeName === 'form' && element.disabled
1875
+ }
1876
+
1877
+ function isDisabled(context) {
1878
+ if (!supports$4) {
1879
+ supports$4 = _supports()
1880
+ }
1881
+
1882
+ var element = contextToElement({
1883
+ label: 'is/disabled',
1884
+ context: context,
1885
+ })
1886
+
1887
+ if (element.hasAttribute('data-ally-disabled')) {
1888
+ // treat ally's element/disabled like the DOM native element.disabled
1889
+ return true
1890
+ }
1891
+
1892
+ if (!isNativeDisabledSupported(element)) {
1893
+ // non-form elements do not support the disabled attribute
1894
+ return false
1895
+ }
1896
+
1897
+ if (element.disabled) {
1898
+ // the element itself is disabled
1899
+ return true
1900
+ }
1901
+
1902
+ var parents = getParents({ context: element })
1903
+ if (parents.some(isDisabledFieldset)) {
1904
+ // a parental <fieldset> is disabld and inherits the state onto this element
1905
+ return true
1906
+ }
1907
+
1908
+ if (!supports$4.focusFormDisabled && parents.some(isDisabledForm)) {
1909
+ // a parental <form> is disabld and inherits the state onto this element
1910
+ return true
1911
+ }
1912
+
1913
+ return false
1914
+ }
1915
+
1916
+ function isOnlyTabbableRules() {
1917
+ var _ref =
1918
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1919
+ context = _ref.context,
1920
+ _ref$except = _ref.except,
1921
+ except =
1922
+ _ref$except === undefined
1923
+ ? {
1924
+ onlyFocusableBrowsingContext: false,
1925
+ visible: false,
1926
+ }
1927
+ : _ref$except
1928
+
1929
+ var element = contextToElement({
1930
+ label: 'is/only-tabbable',
1931
+ resolveDocument: true,
1932
+ context: context,
1933
+ })
1934
+
1935
+ if (!except.visible && !isVisible(element)) {
1936
+ return false
1937
+ }
1938
+
1939
+ if (
1940
+ !except.onlyFocusableBrowsingContext &&
1941
+ (platform.is.GECKO || platform.is.TRIDENT || platform.is.EDGE)
1942
+ ) {
1943
+ var frameElement = getFrameElement(element)
1944
+ if (frameElement) {
1945
+ if (tabindexValue(frameElement) < 0) {
1946
+ // iframe[tabindex="-1"] and object[tabindex="-1"] inherit the
1947
+ // tabbable demotion onto elements of their browsing contexts
1948
+ return false
1949
+ }
1950
+ }
1951
+ }
1952
+
1953
+ var nodeName = element.nodeName.toLowerCase()
1954
+ var tabindex = tabindexValue(element)
1955
+
1956
+ if (nodeName === 'label' && platform.is.GECKO) {
1957
+ // Firefox cannot focus, but tab to: label[tabindex=0]
1958
+ return tabindex !== null && tabindex >= 0
1959
+ }
1960
+
1961
+ // SVG Elements were keyboard focusable but not script focusable before Firefox 51.
1962
+ // Firefox 51 added the focus management DOM API (.focus and .blur) to SVGElement,
1963
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=778654
1964
+ if (platform.is.GECKO && element.ownerSVGElement && !element.focus) {
1965
+ if (nodeName === 'a' && element.hasAttribute('xlink:href')) {
1966
+ // any focusable child of <svg> cannot be focused, but tabbed to
1967
+ if (platform.is.GECKO) {
1968
+ return true
1969
+ }
1970
+ }
1971
+ }
1972
+
1973
+ return false
1974
+ }
1975
+
1976
+ // bind exceptions to an iterator callback
1977
+ isOnlyTabbableRules.except = function () {
1978
+ var except =
1979
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}
1980
+
1981
+ var isOnlyTabbable = function isOnlyTabbable(context) {
1982
+ return isOnlyTabbableRules({
1983
+ context: context,
1984
+ except: except,
1985
+ })
1986
+ }
1987
+
1988
+ isOnlyTabbable.rules = isOnlyTabbableRules
1989
+ return isOnlyTabbable
1990
+ }
1991
+
1992
+ // provide isOnlyTabbable(context) as default iterator callback
1993
+ var isOnlyTabbable = isOnlyTabbableRules.except({})
1994
+
1995
+ var supports$5 = void 0
1996
+
1997
+ function isOnlyFocusRelevant(element) {
1998
+ var nodeName = element.nodeName.toLowerCase()
1999
+ if (nodeName === 'embed' || nodeName === 'keygen') {
2000
+ // embed is considered focus-relevant but not focusable
2001
+ // see https://github.com/medialize/ally.js/issues/82
2002
+ return true
2003
+ }
2004
+
2005
+ var _tabindex = tabindexValue(element)
2006
+ if (element.shadowRoot && _tabindex === null) {
2007
+ // ShadowDOM host elements *may* receive focus
2008
+ // even though they are not considered focuable
2009
+ return true
2010
+ }
2011
+
2012
+ if (nodeName === 'label') {
2013
+ // <label tabindex="0"> is only tabbable in Firefox, not script-focusable
2014
+ // there's no way to make an element focusable other than by adding a tabindex,
2015
+ // and focus behavior of the label element seems hard-wired to ignore tabindex
2016
+ // in some browsers (like Gecko, Blink and WebKit)
2017
+ return !supports$5.focusLabelTabindex || _tabindex === null
2018
+ }
2019
+
2020
+ if (nodeName === 'legend') {
2021
+ return _tabindex === null
2022
+ }
2023
+
2024
+ if (
2025
+ supports$5.focusSvgFocusableAttribute &&
2026
+ (element.ownerSVGElement || nodeName === 'svg')
2027
+ ) {
2028
+ // Internet Explorer understands the focusable attribute introduced in SVG Tiny 1.2
2029
+ var focusableAttribute = element.getAttribute('focusable')
2030
+ return focusableAttribute && focusableAttribute === 'false'
2031
+ }
2032
+
2033
+ if (nodeName === 'img' && element.hasAttribute('usemap')) {
2034
+ // Gecko, Trident and Edge do not allow an image with an image map and tabindex to be focused,
2035
+ // it appears the tabindex is overruled so focus is still forwarded to the <map>
2036
+ return _tabindex === null || !supports$5.focusImgUsemapTabindex
2037
+ }
2038
+
2039
+ if (nodeName === 'area') {
2040
+ // all <area>s are considered relevant,
2041
+ // but only the valid <area>s are focusable
2042
+ return !isValidArea(element)
2043
+ }
2044
+
2045
+ return false
2046
+ }
2047
+
2048
+ function isFocusableRules() {
2049
+ var _ref =
2050
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2051
+ context = _ref.context,
2052
+ _ref$except = _ref.except,
2053
+ except =
2054
+ _ref$except === undefined
2055
+ ? {
2056
+ disabled: false,
2057
+ visible: false,
2058
+ onlyTabbable: false,
2059
+ }
2060
+ : _ref$except
2061
+
2062
+ if (!supports$5) {
2063
+ supports$5 = _supports()
2064
+ }
2065
+
2066
+ var _isOnlyTabbable = isOnlyTabbable.rules.except({
2067
+ onlyFocusableBrowsingContext: true,
2068
+ visible: except.visible,
2069
+ })
2070
+
2071
+ var element = contextToElement({
2072
+ label: 'is/focusable',
2073
+ resolveDocument: true,
2074
+ context: context,
2075
+ })
2076
+
2077
+ var focusRelevant = isFocusRelevant.rules({
2078
+ context: element,
2079
+ except: except,
2080
+ })
2081
+
2082
+ if (!focusRelevant || isOnlyFocusRelevant(element)) {
2083
+ return false
2084
+ }
2085
+
2086
+ if (!except.disabled && isDisabled(element)) {
2087
+ return false
2088
+ }
2089
+
2090
+ if (!except.onlyTabbable && _isOnlyTabbable(element)) {
2091
+ // some elements may be keyboard focusable, but not script focusable
2092
+ return false
2093
+ }
2094
+
2095
+ // elements that are not rendered, cannot be focused
2096
+ if (!except.visible) {
2097
+ var visibilityOptions = {
2098
+ context: element,
2099
+ except: {},
2100
+ }
2101
+
2102
+ if (supports$5.focusInHiddenIframe) {
2103
+ // WebKit and Blink can focus content in hidden <iframe> and <object>
2104
+ visibilityOptions.except.browsingContext = true
2105
+ }
2106
+
2107
+ if (supports$5.focusObjectSvgHidden) {
2108
+ // Blink allows focusing the object element, even if it has visibility: hidden;
2109
+ // @browser-issue Blink https://code.google.com/p/chromium/issues/detail?id=586191
2110
+ var _nodeName2 = element.nodeName.toLowerCase()
2111
+ if (_nodeName2 === 'object') {
2112
+ visibilityOptions.except.cssVisibility = true
2113
+ }
2114
+ }
2115
+
2116
+ if (!isVisible.rules(visibilityOptions)) {
2117
+ return false
2118
+ }
2119
+ }
2120
+
2121
+ var frameElement = getFrameElement(element)
2122
+ if (frameElement) {
2123
+ var _nodeName = frameElement.nodeName.toLowerCase()
2124
+ if (_nodeName === 'object' && !supports$5.focusInZeroDimensionObject) {
2125
+ if (!frameElement.offsetWidth || !frameElement.offsetHeight) {
2126
+ // WebKit can not focus content in <object> if it doesn't have dimensions
2127
+ return false
2128
+ }
2129
+ }
2130
+ }
2131
+
2132
+ var nodeName = element.nodeName.toLowerCase()
2133
+ if (
2134
+ nodeName === 'svg' &&
2135
+ supports$5.focusSvgInIframe &&
2136
+ !frameElement &&
2137
+ element.getAttribute('tabindex') === null
2138
+ ) {
2139
+ return false
2140
+ }
2141
+
2142
+ return true
2143
+ }
2144
+
2145
+ // bind exceptions to an iterator callback
2146
+ isFocusableRules.except = function () {
2147
+ var except =
2148
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}
2149
+
2150
+ var isFocusable = function isFocusable(context) {
2151
+ return isFocusableRules({
2152
+ context: context,
2153
+ except: except,
2154
+ })
2155
+ }
2156
+
2157
+ isFocusable.rules = isFocusableRules
2158
+ return isFocusable
2159
+ }
2160
+
2161
+ // provide isFocusRelevant(context) as default iterator callback
2162
+ var isFocusable = isFocusableRules.except({})
2163
+
2164
+ function createFilter(condition) {
2165
+ // see https://developer.mozilla.org/en-US/docs/Web/API/NodeFilter
2166
+ var filter = function filter(node) {
2167
+ if (node.shadowRoot) {
2168
+ // return ShadowRoot elements regardless of them being focusable,
2169
+ // so they can be walked recursively later
2170
+ return NodeFilter.FILTER_ACCEPT
2171
+ }
2172
+
2173
+ if (condition(node)) {
2174
+ // finds elements that could have been found by document.querySelectorAll()
2175
+ return NodeFilter.FILTER_ACCEPT
2176
+ }
2177
+
2178
+ return NodeFilter.FILTER_SKIP
2179
+ }
2180
+ // IE requires a function, Browsers require {acceptNode: function}
2181
+ // see http://www.bennadel.com/blog/2607-finding-html-comment-nodes-in-the-dom-using-treewalker.htm
2182
+ filter.acceptNode = filter
2183
+ return filter
2184
+ }
2185
+
2186
+ var PossiblyFocusableFilter = createFilter(isFocusRelevant)
2187
+
2188
+ function queryFocusableStrict() {
2189
+ var _ref =
2190
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2191
+ context = _ref.context,
2192
+ includeContext = _ref.includeContext,
2193
+ includeOnlyTabbable = _ref.includeOnlyTabbable,
2194
+ strategy = _ref.strategy
2195
+
2196
+ if (!context) {
2197
+ context = document.documentElement
2198
+ }
2199
+
2200
+ var _isFocusable = isFocusable.rules.except({
2201
+ onlyTabbable: includeOnlyTabbable,
2202
+ })
2203
+
2204
+ var _document = getDocument(context)
2205
+ // see https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalker
2206
+ var walker = _document.createTreeWalker(
2207
+ // root element to start search in
2208
+ context,
2209
+ // element type filter
2210
+ NodeFilter.SHOW_ELEMENT,
2211
+ // custom NodeFilter filter
2212
+ strategy === 'all' ? PossiblyFocusableFilter : createFilter(_isFocusable),
2213
+ // deprecated, but IE requires it
2214
+ false
2215
+ )
2216
+
2217
+ var list = []
2218
+
2219
+ while (walker.nextNode()) {
2220
+ if (walker.currentNode.shadowRoot) {
2221
+ if (_isFocusable(walker.currentNode)) {
2222
+ list.push(walker.currentNode)
2223
+ }
2224
+
2225
+ list = list.concat(
2226
+ queryFocusableStrict({
2227
+ context: walker.currentNode.shadowRoot,
2228
+ includeOnlyTabbable: includeOnlyTabbable,
2229
+ strategy: strategy,
2230
+ })
2231
+ )
2232
+ } else {
2233
+ list.push(walker.currentNode)
2234
+ }
2235
+ }
2236
+
2237
+ // add context if requested and focusable
2238
+ if (includeContext) {
2239
+ if (strategy === 'all') {
2240
+ if (isFocusRelevant(context)) {
2241
+ list.unshift(context)
2242
+ }
2243
+ } else if (_isFocusable(context)) {
2244
+ list.unshift(context)
2245
+ }
2246
+ }
2247
+
2248
+ return list
2249
+ }
2250
+
2251
+ // NOTE: this selector MUST *never* be used directly,
2252
+ var supports$6 = void 0
2253
+
2254
+ var selector$1 = void 0
2255
+
2256
+ function selector$2() {
2257
+ if (!supports$6) {
2258
+ supports$6 = _supports()
2259
+ }
2260
+
2261
+ if (typeof selector$1 === 'string') {
2262
+ return selector$1
2263
+ }
2264
+
2265
+ // https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute
2266
+ selector$1 =
2267
+ '' +
2268
+ // IE11 supports.can focus <table> and <td>
2269
+ (supports$6.focusTable ? 'table, td,' : '') +
2270
+ // IE11 supports.can focus <fieldset>
2271
+ (supports$6.focusFieldset ? 'fieldset,' : '') +
2272
+ // Namespace problems of [xlink:href] explained in https://stackoverflow.com/a/23047888/515124
2273
+ // svg a[*|href] does not match in IE9, but since we're filtering
2274
+ // through is/focusable we can include all <a> from SVG
2275
+ 'svg a,' +
2276
+ // may behave as 'svg, svg *,' in chrome as *every* svg element with a focus event listener is focusable
2277
+ // navigational elements
2278
+ 'a[href],' +
2279
+ // validity determined by is/valid-area.js
2280
+ 'area[href],' +
2281
+ // validity determined by is/disabled.js
2282
+ 'input, select, textarea, button,' +
2283
+ // browsing context containers
2284
+ 'iframe, object, embed,' +
2285
+ // interactive content
2286
+ 'keygen,' +
2287
+ (supports$6.focusAudioWithoutControls ? 'audio,' : 'audio[controls],') +
2288
+ (supports$6.focusVideoWithoutControls ? 'video,' : 'video[controls],') +
2289
+ (supports$6.focusSummary ? 'summary,' : '') +
2290
+ // validity determined by is/valid-tabindex.js
2291
+ '[tabindex],' +
2292
+ // editing hosts
2293
+ '[contenteditable]'
2294
+
2295
+ // where ShadowDOM is supported, we also want the shadowed focusable elements (via ">>>" or "/deep/")
2296
+ selector$1 = selectInShadows(selector$1)
2297
+
2298
+ return selector$1
2299
+ }
2300
+
2301
+ function queryFocusableQuick() {
2302
+ var _ref =
2303
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2304
+ context = _ref.context,
2305
+ includeContext = _ref.includeContext,
2306
+ includeOnlyTabbable = _ref.includeOnlyTabbable
2307
+
2308
+ var _selector = selector$2()
2309
+ var elements = context.querySelectorAll(_selector)
2310
+ // the selector potentially matches more than really is focusable
2311
+
2312
+ var _isFocusable = isFocusable.rules.except({
2313
+ onlyTabbable: includeOnlyTabbable,
2314
+ })
2315
+
2316
+ var result = [].filter.call(elements, _isFocusable)
2317
+
2318
+ // add context if requested and focusable
2319
+ if (includeContext && _isFocusable(context)) {
2320
+ result.unshift(context)
2321
+ }
2322
+
2323
+ return result
2324
+ }
2325
+
2326
+ function queryFocusable() {
2327
+ var _ref =
2328
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2329
+ context = _ref.context,
2330
+ includeContext = _ref.includeContext,
2331
+ includeOnlyTabbable = _ref.includeOnlyTabbable,
2332
+ _ref$strategy = _ref.strategy,
2333
+ strategy = _ref$strategy === undefined ? 'quick' : _ref$strategy
2334
+
2335
+ var element = contextToElement({
2336
+ label: 'query/focusable',
2337
+ resolveDocument: true,
2338
+ defaultToDocument: true,
2339
+ context: context,
2340
+ })
2341
+
2342
+ var options = {
2343
+ context: element,
2344
+ includeContext: includeContext,
2345
+ includeOnlyTabbable: includeOnlyTabbable,
2346
+ strategy: strategy,
2347
+ }
2348
+
2349
+ if (strategy === 'quick') {
2350
+ return queryFocusableQuick(options)
2351
+ } else if (strategy === 'strict' || strategy === 'all') {
2352
+ return queryFocusableStrict(options)
2353
+ }
2354
+
2355
+ throw new TypeError(
2356
+ 'query/focusable requires option.strategy to be one of ["quick", "strict", "all"]'
2357
+ )
2358
+ }
2359
+
2360
+ var supports$7 = void 0
2361
+
2362
+ // Internet Explorer 11 considers fieldset, table, td focusable, but not tabbable
2363
+ // Internet Explorer 11 considers body to have [tabindex=0], but does not allow tabbing to it
2364
+ var focusableElementsPattern = /^(fieldset|table|td|body)$/
2365
+
2366
+ function isTabbableRules() {
2367
+ var _ref =
2368
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2369
+ context = _ref.context,
2370
+ _ref$except = _ref.except,
2371
+ except =
2372
+ _ref$except === undefined
2373
+ ? {
2374
+ flexbox: false,
2375
+ scrollable: false,
2376
+ shadow: false,
2377
+ visible: false,
2378
+ onlyTabbable: false,
2379
+ }
2380
+ : _ref$except
2381
+
2382
+ if (!supports$7) {
2383
+ supports$7 = _supports()
2384
+ }
2385
+
2386
+ var element = contextToElement({
2387
+ label: 'is/tabbable',
2388
+ resolveDocument: true,
2389
+ context: context,
2390
+ })
2391
+
2392
+ if (platform.is.BLINK && platform.is.ANDROID && platform.majorVersion > 42) {
2393
+ // External keyboard support worked fine in CHrome 42, but stopped working in Chrome 45.
2394
+ // The on-screen keyboard does not provide a way to focus the next input element (like iOS does).
2395
+ // That leaves us with no option to advance focus by keyboard, ergo nothing is tabbable (keyboard focusable).
2396
+ return false
2397
+ }
2398
+
2399
+ var frameElement = getFrameElement(element)
2400
+ if (frameElement) {
2401
+ if (platform.is.WEBKIT && platform.is.IOS) {
2402
+ // iOS only does not consider anything from another browsing context keyboard focusable
2403
+ return false
2404
+ }
2405
+
2406
+ // iframe[tabindex="-1"] and object[tabindex="-1"] inherit the
2407
+ // tabbable demotion onto elements of their browsing contexts
2408
+ if (tabindexValue(frameElement) < 0) {
2409
+ return false
2410
+ }
2411
+
2412
+ if (
2413
+ !except.visible &&
2414
+ (platform.is.BLINK || platform.is.WEBKIT) &&
2415
+ !isVisible(frameElement)
2416
+ ) {
2417
+ // Blink and WebKit consider elements in hidden browsing contexts focusable, but not tabbable
2418
+ return false
2419
+ }
2420
+
2421
+ // Webkit and Blink don't consider anything in <object> tabbable
2422
+ // Blink fixed that fixed in Chrome 54, Opera 41
2423
+ var frameNodeName = frameElement.nodeName.toLowerCase()
2424
+ if (frameNodeName === 'object') {
2425
+ var isFixedBlink =
2426
+ (platform.name === 'Chrome' && platform.majorVersion >= 54) ||
2427
+ (platform.name === 'Opera' && platform.majorVersion >= 41)
2428
+
2429
+ if (platform.is.WEBKIT || (platform.is.BLINK && !isFixedBlink)) {
2430
+ return false
2431
+ }
2432
+ }
2433
+ }
2434
+
2435
+ var nodeName = element.nodeName.toLowerCase()
2436
+ var _tabindex = tabindexValue(element)
2437
+ var tabindex = _tabindex === null ? null : _tabindex >= 0
2438
+
2439
+ if (
2440
+ platform.is.EDGE &&
2441
+ platform.majorVersion >= 14 &&
2442
+ frameElement &&
2443
+ element.ownerSVGElement &&
2444
+ _tabindex < 0
2445
+ ) {
2446
+ // Edge 14+ considers <a xlink:href="…" tabindex="-1"> keyboard focusable
2447
+ // if the element is in a nested browsing context
2448
+ return true
2449
+ }
2450
+
2451
+ var hasTabbableTabindexOrNone = tabindex !== false
2452
+ var hasTabbableTabindex = _tabindex !== null && _tabindex >= 0
2453
+
2454
+ // NOTE: Firefox 31 considers [contenteditable] to have [tabindex=-1], but allows tabbing to it
2455
+ // fixed in Firefox 40 the latest - https://bugzilla.mozilla.org/show_bug.cgi?id=1185657
2456
+ if (element.hasAttribute('contenteditable')) {
2457
+ // tabbing can still be disabled by explicitly providing [tabindex="-1"]
2458
+ return hasTabbableTabindexOrNone
2459
+ }
2460
+
2461
+ if (focusableElementsPattern.test(nodeName) && tabindex !== true) {
2462
+ return false
2463
+ }
2464
+
2465
+ if (platform.is.WEBKIT && platform.is.IOS) {
2466
+ // iOS only considers a hand full of elements tabbable (keyboard focusable)
2467
+ // this holds true even with external keyboards
2468
+ var potentiallyTabbable =
2469
+ (nodeName === 'input' && element.type === 'text') ||
2470
+ element.type === 'password' ||
2471
+ nodeName === 'select' ||
2472
+ nodeName === 'textarea' ||
2473
+ element.hasAttribute('contenteditable')
2474
+
2475
+ if (!potentiallyTabbable) {
2476
+ var style = window.getComputedStyle(element, null)
2477
+ potentiallyTabbable = isUserModifyWritable(style)
2478
+ }
2479
+
2480
+ if (!potentiallyTabbable) {
2481
+ return false
2482
+ }
2483
+ }
2484
+
2485
+ if (nodeName === 'use' && _tabindex !== null) {
2486
+ if (
2487
+ platform.is.BLINK ||
2488
+ (platform.is.WEBKIT && platform.majorVersion === 9)
2489
+ ) {
2490
+ // In Chrome and Safari 9 the <use> element is keyboard focusable even for tabindex="-1"
2491
+ return true
2492
+ }
2493
+ }
2494
+
2495
+ if (elementMatches(element, 'svg a') && element.hasAttribute('xlink:href')) {
2496
+ if (hasTabbableTabindexOrNone) {
2497
+ // in Trident and Gecko SVGElement does not handle the tabIndex property properly
2498
+ return true
2499
+ }
2500
+
2501
+ if (element.focus && !supports$7.focusSvgNegativeTabindexAttribute) {
2502
+ // Firefox 51 and 52 treat any natively tabbable SVG element with
2503
+ // tabindex="-1" as tabbable and everything else as inert
2504
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=1302340
2505
+ return true
2506
+ }
2507
+ }
2508
+
2509
+ if (
2510
+ nodeName === 'svg' &&
2511
+ supports$7.focusSvgInIframe &&
2512
+ hasTabbableTabindexOrNone
2513
+ ) {
2514
+ return true
2515
+ }
2516
+
2517
+ if (platform.is.TRIDENT || platform.is.EDGE) {
2518
+ if (nodeName === 'svg') {
2519
+ if (supports$7.focusSvg) {
2520
+ // older Internet Explorers consider <svg> keyboard focusable
2521
+ // unless they have focsable="false", but then they wouldn't
2522
+ // be focusable and thus not even reach this filter
2523
+ return true
2524
+ }
2525
+
2526
+ // elements that have [focusable] are automatically keyboard focusable regardless of the attribute's value
2527
+ return element.hasAttribute('focusable') || hasTabbableTabindex
2528
+ }
2529
+
2530
+ if (element.ownerSVGElement) {
2531
+ if (supports$7.focusSvgTabindexAttribute && hasTabbableTabindex) {
2532
+ return true
2533
+ }
2534
+
2535
+ // elements that have [focusable] are automatically keyboard focusable regardless of the attribute's value
2536
+ return element.hasAttribute('focusable')
2537
+ }
2538
+ }
2539
+ if (element.tabIndex === undefined) {
2540
+ return Boolean(except.onlyTabbable)
2541
+ }
2542
+
2543
+ if (nodeName === 'audio') {
2544
+ if (!element.hasAttribute('controls')) {
2545
+ // In Internet Explorer the <audio> element is focusable, but not tabbable, and tabIndex property is wrong
2546
+ return false
2547
+ } else if (platform.is.BLINK) {
2548
+ // In Chrome <audio controls tabindex="-1"> remains keyboard focusable
2549
+ return true
2550
+ }
2551
+ }
2552
+
2553
+ if (nodeName === 'video') {
2554
+ if (!element.hasAttribute('controls')) {
2555
+ if (platform.is.TRIDENT || platform.is.EDGE) {
2556
+ // In Internet Explorer and Edge the <video> element is focusable, but not tabbable, and tabIndex property is wrong
2557
+ return false
2558
+ }
2559
+ } else if (platform.is.BLINK || platform.is.GECKO) {
2560
+ // In Chrome and Firefox <video controls tabindex="-1"> remains keyboard focusable
2561
+ return true
2562
+ }
2563
+ }
2564
+
2565
+ if (nodeName === 'object') {
2566
+ if (platform.is.BLINK || platform.is.WEBKIT) {
2567
+ // In all Blink and WebKit based browsers <embed> and <object> are never keyboard focusable, even with tabindex="0" set
2568
+ return false
2569
+ }
2570
+ }
2571
+
2572
+ if (nodeName === 'iframe') {
2573
+ // In Internet Explorer all iframes are only focusable
2574
+ // In WebKit, Blink and Gecko iframes may be tabbable depending on content.
2575
+ // Since we can't reliably investigate iframe documents because of the
2576
+ // SameOriginPolicy, we're declaring everything only focusable.
2577
+ return false
2578
+ }
2579
+
2580
+ if (!except.scrollable && platform.is.GECKO) {
2581
+ // Firefox considers scrollable containers keyboard focusable,
2582
+ // even though their tabIndex property is -1
2583
+ var _style = window.getComputedStyle(element, null)
2584
+ if (hasCssOverflowScroll(_style)) {
2585
+ return hasTabbableTabindexOrNone
2586
+ }
2587
+ }
2588
+
2589
+ if (platform.is.TRIDENT || platform.is.EDGE) {
2590
+ // IE and Edge degrade <area> to script focusable, if the image
2591
+ // using the <map> has been given tabindex="-1"
2592
+ if (nodeName === 'area') {
2593
+ var img = getImageOfArea(element)
2594
+ if (img && tabindexValue(img) < 0) {
2595
+ return false
2596
+ }
2597
+ }
2598
+
2599
+ var _style2 = window.getComputedStyle(element, null)
2600
+ if (isUserModifyWritable(_style2)) {
2601
+ // prevent being swallowed by the overzealous isScrollableContainer() below
2602
+ return element.tabIndex >= 0
2603
+ }
2604
+
2605
+ if (!except.flexbox && hasCssDisplayFlex(_style2)) {
2606
+ if (_tabindex !== null) {
2607
+ return hasTabbableTabindex
2608
+ }
2609
+
2610
+ return (
2611
+ isFocusRelevantWithoutFlexbox(element) &&
2612
+ isTabbableWithoutFlexbox(element)
2613
+ )
2614
+ }
2615
+
2616
+ // IE considers scrollable containers script focusable only,
2617
+ // even though their tabIndex property is 0
2618
+ if (isScrollableContainer(element, nodeName)) {
2619
+ return false
2620
+ }
2621
+
2622
+ var parent = element.parentElement
2623
+ if (parent) {
2624
+ var parentNodeName = parent.nodeName.toLowerCase()
2625
+ var parentStyle = window.getComputedStyle(parent, null)
2626
+ // IE considers scrollable bodies script focusable only,
2627
+ if (
2628
+ isScrollableContainer(parent, nodeName, parentNodeName, parentStyle)
2629
+ ) {
2630
+ return false
2631
+ }
2632
+
2633
+ // Children of focusable elements with display:flex are focusable in IE10-11,
2634
+ // even though their tabIndex property suggests otherwise
2635
+ if (hasCssDisplayFlex(parentStyle)) {
2636
+ // value of tabindex takes precedence
2637
+ return hasTabbableTabindex
2638
+ }
2639
+ }
2640
+ }
2641
+
2642
+ // https://www.w3.org/WAI/PF/aria-practices/#focus_tabindex
2643
+ return element.tabIndex >= 0
2644
+ }
2645
+
2646
+ // bind exceptions to an iterator callback
2647
+ isTabbableRules.except = function () {
2648
+ var except =
2649
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}
2650
+
2651
+ var isTabbable = function isTabbable(context) {
2652
+ return isTabbableRules({
2653
+ context: context,
2654
+ except: except,
2655
+ })
2656
+ }
2657
+
2658
+ isTabbable.rules = isTabbableRules
2659
+ return isTabbable
2660
+ }
2661
+
2662
+ var isFocusRelevantWithoutFlexbox = isFocusRelevant.rules.except({
2663
+ flexbox: true,
2664
+ })
2665
+ var isTabbableWithoutFlexbox = isTabbableRules.except({ flexbox: true })
2666
+
2667
+ // provide isTabbable(context) as default iterator callback
2668
+ var isTabbable = isTabbableRules.except({})
2669
+
2670
+ function queryTabbable() {
2671
+ var _ref =
2672
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2673
+ context = _ref.context,
2674
+ includeContext = _ref.includeContext,
2675
+ includeOnlyTabbable = _ref.includeOnlyTabbable,
2676
+ strategy = _ref.strategy
2677
+
2678
+ var _isTabbable = isTabbable.rules.except({
2679
+ onlyTabbable: includeOnlyTabbable,
2680
+ })
2681
+
2682
+ return queryFocusable({
2683
+ context: context,
2684
+ includeContext: includeContext,
2685
+ includeOnlyTabbable: includeOnlyTabbable,
2686
+ strategy: strategy,
2687
+ }).filter(_isTabbable)
2688
+ }
2689
+
2690
+ // sorts a list of elements according to their order in the DOM
2691
+
2692
+ function compareDomPosition(a, b) {
2693
+ return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING
2694
+ ? -1
2695
+ : 1
2696
+ }
2697
+
2698
+ function sortDomOrder(elements) {
2699
+ return elements.sort(compareDomPosition)
2700
+ }
2701
+
2702
+ function getFirstSuccessorOffset(list, target) {
2703
+ // find the first element that comes AFTER the target element
2704
+ return findIndex(list, function (element) {
2705
+ return (
2706
+ target.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_FOLLOWING
2707
+ )
2708
+ })
2709
+ }
2710
+
2711
+ function findInsertionOffsets(list, elements, resolveElement) {
2712
+ // instead of mutating the elements list directly, remember position and map
2713
+ // to inject later, when we can do this more efficiently
2714
+ var insertions = []
2715
+ elements.forEach(function (element) {
2716
+ var replace = true
2717
+ var offset = list.indexOf(element)
2718
+
2719
+ if (offset === -1) {
2720
+ // element is not in target list
2721
+ offset = getFirstSuccessorOffset(list, element)
2722
+ replace = false
2723
+ }
2724
+
2725
+ if (offset === -1) {
2726
+ // there is no successor in the tabsequence,
2727
+ // meaning the image must be the last element
2728
+ offset = list.length
2729
+ }
2730
+
2731
+ // allow the consumer to replace the injected element
2732
+ var injections = nodeArray(
2733
+ resolveElement ? resolveElement(element) : element
2734
+ )
2735
+ if (!injections.length) {
2736
+ // we can't inject zero elements
2737
+ return
2738
+ }
2739
+
2740
+ insertions.push({
2741
+ offset: offset,
2742
+ replace: replace,
2743
+ elements: injections,
2744
+ })
2745
+ })
2746
+
2747
+ return insertions
2748
+ }
2749
+
2750
+ function insertElementsAtOffsets(list, insertions) {
2751
+ // remember the number of elements we have already injected
2752
+ // so we account for the caused index offset
2753
+ var inserted = 0
2754
+ // make sure that we insert the elements in sequence,
2755
+ // otherwise the offset compensation won't work
2756
+ insertions.sort(function (a, b) {
2757
+ return a.offset - b.offset
2758
+ })
2759
+ insertions.forEach(function (insertion) {
2760
+ // array.splice has an annoying function signature :(
2761
+ var remove = insertion.replace ? 1 : 0
2762
+ var args = [insertion.offset + inserted, remove].concat(insertion.elements)
2763
+ list.splice.apply(list, args)
2764
+ inserted += insertion.elements.length - remove
2765
+ })
2766
+ }
2767
+
2768
+ function mergeInDomOrder() {
2769
+ var _ref =
2770
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2771
+ list = _ref.list,
2772
+ elements = _ref.elements,
2773
+ resolveElement = _ref.resolveElement
2774
+
2775
+ // operate on a copy so we don't mutate the original array
2776
+ var _list = list.slice(0)
2777
+ // make sure the elements we're injecting are provided in DOM order
2778
+ var _elements = nodeArray(elements).slice(0)
2779
+ sortDomOrder(_elements)
2780
+ // find the offsets within the target array (list) at which to inject
2781
+ // each individual element (from elements)
2782
+ var insertions = findInsertionOffsets(_list, _elements, resolveElement)
2783
+ // actually inject the elements into the target array at the identified positions
2784
+ insertElementsAtOffsets(_list, insertions)
2785
+ return _list
2786
+ }
2787
+
2788
+ var _createClass = (function () {
2789
+ function defineProperties(target, props) {
2790
+ for (var i = 0; i < props.length; i++) {
2791
+ var descriptor = props[i]
2792
+ descriptor.enumerable = descriptor.enumerable || false
2793
+ descriptor.configurable = true
2794
+ if ('value' in descriptor) descriptor.writable = true
2795
+ Object.defineProperty(target, descriptor.key, descriptor)
2796
+ }
2797
+ }
2798
+ return function (Constructor, protoProps, staticProps) {
2799
+ if (protoProps) defineProperties(Constructor.prototype, protoProps)
2800
+ if (staticProps) defineProperties(Constructor, staticProps)
2801
+ return Constructor
2802
+ }
2803
+ })()
2804
+
2805
+ function _classCallCheck(instance, Constructor) {
2806
+ if (!(instance instanceof Constructor)) {
2807
+ throw new TypeError('Cannot call a class as a function')
2808
+ }
2809
+ }
2810
+
2811
+ var Maps = (function () {
2812
+ function Maps(context) {
2813
+ _classCallCheck(this, Maps)
2814
+
2815
+ this._document = getDocument(context)
2816
+ this.maps = {}
2817
+ }
2818
+
2819
+ _createClass(Maps, [
2820
+ {
2821
+ key: 'getAreasFor',
2822
+ value: function getAreasFor(name) {
2823
+ if (!this.maps[name]) {
2824
+ // the map is not defined within the context, so we
2825
+ // have to go find it elsewhere in the document
2826
+ this.addMapByName(name)
2827
+ }
2828
+
2829
+ return this.maps[name]
2830
+ },
2831
+ },
2832
+ {
2833
+ key: 'addMapByName',
2834
+ value: function addMapByName(name) {
2835
+ var map = getMapByName(name, this._document)
2836
+ if (!map) {
2837
+ // if there is no map, the img[usemap] wasn't doing anything anyway
2838
+ return
2839
+ }
2840
+
2841
+ this.maps[map.name] = queryTabbable({ context: map })
2842
+ },
2843
+ },
2844
+ {
2845
+ key: 'extractAreasFromList',
2846
+ value: function extractAreasFromList(elements) {
2847
+ // remove all <area> elements from the elements list,
2848
+ // but put them the map for later retrieval
2849
+ return elements.filter(function (element) {
2850
+ var nodeName = element.nodeName.toLowerCase()
2851
+ if (nodeName !== 'area') {
2852
+ return true
2853
+ }
2854
+
2855
+ var map = element.parentNode
2856
+ if (!this.maps[map.name]) {
2857
+ this.maps[map.name] = []
2858
+ }
2859
+
2860
+ this.maps[map.name].push(element)
2861
+ return false
2862
+ }, this)
2863
+ },
2864
+ },
2865
+ ])
2866
+
2867
+ return Maps
2868
+ })()
2869
+
2870
+ function sortArea(elements, context) {
2871
+ // images - unless they are focusable themselves, likely not
2872
+ // part of the elements list, so we'll have to find them and
2873
+ // sort them into the elements list manually
2874
+ var usemaps = context.querySelectorAll('img[usemap]')
2875
+ var maps = new Maps(context)
2876
+
2877
+ // remove all <area> elements from the elements list,
2878
+ // but put them the map for later retrieval
2879
+ var _elements = maps.extractAreasFromList(elements)
2880
+
2881
+ if (!usemaps.length) {
2882
+ // the context does not contain any <area>s so no need
2883
+ // to replace anything, just remove any maps
2884
+ return _elements
2885
+ }
2886
+
2887
+ return mergeInDomOrder({
2888
+ list: _elements,
2889
+ elements: usemaps,
2890
+ resolveElement: function resolveElement(image) {
2891
+ var name = image.getAttribute('usemap').slice(1)
2892
+ return maps.getAreasFor(name)
2893
+ },
2894
+ })
2895
+ }
2896
+
2897
+ var _createClass$1 = (function () {
2898
+ function defineProperties(target, props) {
2899
+ for (var i = 0; i < props.length; i++) {
2900
+ var descriptor = props[i]
2901
+ descriptor.enumerable = descriptor.enumerable || false
2902
+ descriptor.configurable = true
2903
+ if ('value' in descriptor) descriptor.writable = true
2904
+ Object.defineProperty(target, descriptor.key, descriptor)
2905
+ }
2906
+ }
2907
+ return function (Constructor, protoProps, staticProps) {
2908
+ if (protoProps) defineProperties(Constructor.prototype, protoProps)
2909
+ if (staticProps) defineProperties(Constructor, staticProps)
2910
+ return Constructor
2911
+ }
2912
+ })()
2913
+
2914
+ function _classCallCheck$1(instance, Constructor) {
2915
+ if (!(instance instanceof Constructor)) {
2916
+ throw new TypeError('Cannot call a class as a function')
2917
+ }
2918
+ }
2919
+
2920
+ var Shadows = (function () {
2921
+ function Shadows(context, sortElements) {
2922
+ _classCallCheck$1(this, Shadows)
2923
+
2924
+ // document context we're working with
2925
+ this.context = context
2926
+ // callback that sorts an array of elements
2927
+ this.sortElements = sortElements
2928
+ // reference to create unique IDs for each ShadowHost
2929
+ this.hostCounter = 1
2930
+ // reference map for child-ShadowHosts of a ShadowHost
2931
+ this.inHost = {}
2932
+ // reference map for child-ShadowHost of the document
2933
+ this.inDocument = []
2934
+ // reference map for ShadowHosts
2935
+ this.hosts = {}
2936
+ // reference map for tabbable elements of a ShadowHost
2937
+ this.elements = {}
2938
+ }
2939
+
2940
+ // remember which hosts we have to sort within later
2941
+
2942
+ _createClass$1(Shadows, [
2943
+ {
2944
+ key: '_registerHost',
2945
+ value: function _registerHost(host) {
2946
+ if (host._sortingId) {
2947
+ return
2948
+ }
2949
+
2950
+ // make the ShadowHost identifiable (see cleanup() for undo)
2951
+ host._sortingId = 'shadow-' + this.hostCounter++
2952
+ this.hosts[host._sortingId] = host
2953
+
2954
+ // hosts may contain other hosts
2955
+ var parentHost = getShadowHost({ context: host })
2956
+ if (parentHost) {
2957
+ this._registerHost(parentHost)
2958
+ this._registerHostParent(host, parentHost)
2959
+ } else {
2960
+ this.inDocument.push(host)
2961
+ }
2962
+ },
2963
+
2964
+ // remember which host is the child of which other host
2965
+ },
2966
+ {
2967
+ key: '_registerHostParent',
2968
+ value: function _registerHostParent(host, parent) {
2969
+ if (!this.inHost[parent._sortingId]) {
2970
+ this.inHost[parent._sortingId] = []
2971
+ }
2972
+
2973
+ this.inHost[parent._sortingId].push(host)
2974
+ },
2975
+
2976
+ // remember which elements a host contains
2977
+ },
2978
+ {
2979
+ key: '_registerElement',
2980
+ value: function _registerElement(element, host) {
2981
+ if (!this.elements[host._sortingId]) {
2982
+ this.elements[host._sortingId] = []
2983
+ }
2984
+
2985
+ this.elements[host._sortingId].push(element)
2986
+ },
2987
+
2988
+ // remove shadowed elements from the sequence and register
2989
+ // the ShadowHosts they belong to so we know what to sort
2990
+ // later on
2991
+ },
2992
+ {
2993
+ key: 'extractElements',
2994
+ value: function extractElements(elements) {
2995
+ return elements.filter(function (element) {
2996
+ var host = getShadowHost({ context: element })
2997
+ if (!host) {
2998
+ return true
2999
+ }
3000
+
3001
+ this._registerHost(host)
3002
+ this._registerElement(element, host)
3003
+ return false
3004
+ }, this)
3005
+ },
3006
+
3007
+ // inject hosts into the sequence, sort everything,
3008
+ // and recoursively replace hosts by its descendants
3009
+ },
3010
+ {
3011
+ key: 'sort',
3012
+ value: function sort(elements) {
3013
+ var _elements = this._injectHosts(elements)
3014
+ _elements = this._replaceHosts(_elements)
3015
+ this._cleanup()
3016
+ return _elements
3017
+ },
3018
+
3019
+ // merge ShadowHosts into the element lists of other ShadowHosts
3020
+ // or the document, then sort the individual lists
3021
+ },
3022
+ {
3023
+ key: '_injectHosts',
3024
+ value: function _injectHosts(elements) {
3025
+ Object.keys(this.hosts).forEach(function (_sortingId) {
3026
+ var _list = this.elements[_sortingId]
3027
+ var _elements = this.inHost[_sortingId]
3028
+ var _context = this.hosts[_sortingId].shadowRoot
3029
+ this.elements[_sortingId] = this._merge(_list, _elements, _context)
3030
+ }, this)
3031
+
3032
+ return this._merge(elements, this.inDocument, this.context)
3033
+ },
3034
+ },
3035
+ {
3036
+ key: '_merge',
3037
+ value: function _merge(list, elements, context) {
3038
+ var merged = mergeInDomOrder({
3039
+ list: list,
3040
+ elements: elements,
3041
+ })
3042
+
3043
+ return this.sortElements(merged, context)
3044
+ },
3045
+ },
3046
+ {
3047
+ key: '_replaceHosts',
3048
+ value: function _replaceHosts(elements) {
3049
+ return mergeInDomOrder({
3050
+ list: elements,
3051
+ elements: this.inDocument,
3052
+ resolveElement: this._resolveHostElement.bind(this),
3053
+ })
3054
+ },
3055
+ },
3056
+ {
3057
+ key: '_resolveHostElement',
3058
+ value: function _resolveHostElement(host) {
3059
+ var merged = mergeInDomOrder({
3060
+ list: this.elements[host._sortingId],
3061
+ elements: this.inHost[host._sortingId],
3062
+ resolveElement: this._resolveHostElement.bind(this),
3063
+ })
3064
+
3065
+ var _tabindex = tabindexValue(host)
3066
+ if (_tabindex !== null && _tabindex > -1) {
3067
+ return [host].concat(merged)
3068
+ }
3069
+
3070
+ return merged
3071
+ },
3072
+ },
3073
+ {
3074
+ key: '_cleanup',
3075
+ value: function _cleanup() {
3076
+ // remove those identifers we put on the ShadowHost to avoid using Map()
3077
+ Object.keys(this.hosts).forEach(function (key) {
3078
+ delete this.hosts[key]._sortingId
3079
+ }, this)
3080
+ },
3081
+ },
3082
+ ])
3083
+
3084
+ return Shadows
3085
+ })()
3086
+
3087
+ function sortShadowed(elements, context, sortElements) {
3088
+ var shadows = new Shadows(context, sortElements)
3089
+ var _elements = shadows.extractElements(elements)
3090
+
3091
+ if (_elements.length === elements.length) {
3092
+ // no shadowed content found, no need to continue
3093
+ return sortElements(elements)
3094
+ }
3095
+
3096
+ return shadows.sort(_elements)
3097
+ }
3098
+
3099
+ function sortTabindex(elements) {
3100
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.tabIndex
3101
+ // elements with tabIndex "0" (including tabbableElements without tabIndex) should be navigated in the order they appear.
3102
+ // elements with a positive tabIndex:
3103
+ // Elements that have identical tabIndexes should be navigated in the order they appear.
3104
+ // Navigation proceeds from the lowest tabIndex to the highest tabIndex.
3105
+
3106
+ // NOTE: sort implementation may be unstable and thus mess up DOM order,
3107
+ // that's why we build a map that's being sorted instead. If we were able to rely
3108
+ // on a stable sorting algorithm, sortTabindex() could be as simple as
3109
+ // elements.sort(function(a, b) { return a.tabIndex - b.tabIndex; });
3110
+ // at this time Chrome does not use a stable sorting algorithm
3111
+ // see http://blog.rodneyrehm.de/archives/14-Sorting-Were-Doing-It-Wrong.html#stability
3112
+
3113
+ // NOTE: compareDocumentPosition seemed like more overhead than just sorting this with buckets
3114
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node.compareDocumentPosition
3115
+
3116
+ var map = {}
3117
+ var indexes = []
3118
+ var normal = elements.filter(function (element) {
3119
+ // in Trident and Gecko SVGElement does not know about the tabIndex property
3120
+ var tabIndex = element.tabIndex
3121
+ if (tabIndex === undefined) {
3122
+ tabIndex = tabindexValue(element)
3123
+ }
3124
+
3125
+ // extract elements that don't need sorting
3126
+ if (tabIndex <= 0 || tabIndex === null || tabIndex === undefined) {
3127
+ return true
3128
+ }
3129
+
3130
+ if (!map[tabIndex]) {
3131
+ // create sortable bucket for dom-order-preservation of elements with the same tabIndex
3132
+ map[tabIndex] = []
3133
+ // maintain a list of unique tabIndexes
3134
+ indexes.push(tabIndex)
3135
+ }
3136
+
3137
+ // sort element into the proper bucket
3138
+ map[tabIndex].push(element)
3139
+ // element moved to sorting map, so not "normal" anymore
3140
+ return false
3141
+ })
3142
+
3143
+ // sort the tabindex ascending,
3144
+ // then resolve them to their appropriate buckets,
3145
+ // then flatten the array of arrays to an array
3146
+ var _elements = indexes
3147
+ .sort()
3148
+ .map(function (tabIndex) {
3149
+ return map[tabIndex]
3150
+ })
3151
+ .reduceRight(function (previous, current) {
3152
+ return current.concat(previous)
3153
+ }, normal)
3154
+
3155
+ return _elements
3156
+ }
3157
+
3158
+ var supports$8 = void 0
3159
+
3160
+ function moveContextToBeginning(elements, context) {
3161
+ var pos = elements.indexOf(context)
3162
+ if (pos > 0) {
3163
+ var tmp = elements.splice(pos, 1)
3164
+ return tmp.concat(elements)
3165
+ }
3166
+
3167
+ return elements
3168
+ }
3169
+
3170
+ function sortElements(elements, _context) {
3171
+ if (supports$8.tabsequenceAreaAtImgPosition) {
3172
+ // Some browsers sort <area> in DOM order, some place the <area>s
3173
+ // where the <img> referecing them would've been in DOM order.
3174
+ // https://github.com/medialize/ally.js/issues/5
3175
+ elements = sortArea(elements, _context)
3176
+ }
3177
+
3178
+ elements = sortTabindex(elements)
3179
+ return elements
3180
+ }
3181
+
3182
+ function queryTabsequence() {
3183
+ var _ref =
3184
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3185
+ context = _ref.context,
3186
+ includeContext = _ref.includeContext,
3187
+ includeOnlyTabbable = _ref.includeOnlyTabbable,
3188
+ strategy = _ref.strategy
3189
+
3190
+ if (!supports$8) {
3191
+ supports$8 = _supports()
3192
+ }
3193
+
3194
+ var _context = nodeArray(context)[0] || document.documentElement
3195
+ var elements = queryTabbable({
3196
+ context: _context,
3197
+ includeContext: includeContext,
3198
+ includeOnlyTabbable: includeOnlyTabbable,
3199
+ strategy: strategy,
3200
+ })
3201
+
3202
+ if (document.body.createShadowRoot && platform.is.BLINK) {
3203
+ // sort tabindex localized to shadow dom
3204
+ // see https://github.com/medialize/ally.js/issues/6
3205
+ elements = sortShadowed(elements, _context, sortElements)
3206
+ } else {
3207
+ elements = sortElements(elements, _context)
3208
+ }
3209
+
3210
+ if (includeContext) {
3211
+ // if we include the context itself, it has to be the first
3212
+ // element of the sequence
3213
+ elements = moveContextToBeginning(elements, _context)
3214
+ }
3215
+
3216
+ return elements
3217
+ }
3218
+
3219
+ // codes mostly cloned from https://github.com/keithamus/jwerty/blob/master/jwerty.js
3220
+ // deliberately not exposing characters like <,.-#* because they vary *wildly*
3221
+ // across keyboard layouts and may cause various problems
3222
+ // (e.g. "*" is "Shift +" on a German Mac keyboard)
3223
+ // (e.g. "@" is "Alt L" on a German Mac keyboard)
3224
+
3225
+ var keycode = {
3226
+ // Element Focus
3227
+ tab: 9,
3228
+
3229
+ // Navigation
3230
+ left: 37,
3231
+ up: 38,
3232
+ right: 39,
3233
+ down: 40,
3234
+ pageUp: 33,
3235
+ 'page-up': 33,
3236
+ pageDown: 34,
3237
+ 'page-down': 34,
3238
+ end: 35,
3239
+ home: 36,
3240
+
3241
+ // Action
3242
+ enter: 13,
3243
+ escape: 27,
3244
+ space: 32,
3245
+
3246
+ // Modifier
3247
+ shift: 16,
3248
+ capsLock: 20,
3249
+ 'caps-lock': 20,
3250
+ ctrl: 17,
3251
+ alt: 18,
3252
+ meta: 91,
3253
+ // in firefox: 224
3254
+ // on mac (chrome): meta-left=91, meta-right=93
3255
+ // on win (IE11): meta-left=91, meta-right=92
3256
+ pause: 19,
3257
+
3258
+ // Content Manipulation
3259
+ insert: 45,
3260
+ delete: 46,
3261
+ backspace: 8,
3262
+
3263
+ // the same logical key may be identified through different keyCodes
3264
+ _alias: {
3265
+ 91: [92, 93, 224],
3266
+ },
3267
+ }
3268
+
3269
+ // Function keys (112 - 137)
3270
+ // NOTE: not every keyboard knows F13+
3271
+ for (var n = 1; n < 26; n++) {
3272
+ keycode['f' + n] = n + 111
3273
+ }
3274
+
3275
+ // Number keys (48-57, numpad 96-105)
3276
+ // NOTE: not every keyboard knows num-0+
3277
+ for (var _n = 0; _n < 10; _n++) {
3278
+ var code = _n + 48
3279
+ var numCode = _n + 96
3280
+ keycode[_n] = code
3281
+ keycode['num-' + _n] = numCode
3282
+ keycode._alias[code] = [numCode]
3283
+ }
3284
+
3285
+ // Latin characters (65 - 90)
3286
+ for (var _n2 = 0; _n2 < 26; _n2++) {
3287
+ var _code = _n2 + 65
3288
+ var name$1 = String.fromCharCode(_code).toLowerCase()
3289
+ keycode[name$1] = _code
3290
+ }
3291
+
3292
+ var modifier = {
3293
+ alt: 'altKey',
3294
+ ctrl: 'ctrlKey',
3295
+ meta: 'metaKey',
3296
+ shift: 'shiftKey',
3297
+ }
3298
+
3299
+ var modifierSequence = Object.keys(modifier).map(function (name) {
3300
+ return modifier[name]
3301
+ })
3302
+
3303
+ function createExpectedModifiers(ignoreModifiers) {
3304
+ var value = ignoreModifiers ? null : false
3305
+ return {
3306
+ altKey: value,
3307
+ ctrlKey: value,
3308
+ metaKey: value,
3309
+ shiftKey: value,
3310
+ }
3311
+ }
3312
+
3313
+ function resolveModifiers(modifiers) {
3314
+ var ignoreModifiers = modifiers.indexOf('*') !== -1
3315
+ var expected = createExpectedModifiers(ignoreModifiers)
3316
+
3317
+ modifiers.forEach(function (token) {
3318
+ if (token === '*') {
3319
+ // we've already covered the all-in operator
3320
+ return
3321
+ }
3322
+
3323
+ // we want the modifier pressed
3324
+ var value = true
3325
+ var operator = token.slice(0, 1)
3326
+ if (operator === '?') {
3327
+ // we don't care if the modifier is pressed
3328
+ value = null
3329
+ } else if (operator === '!') {
3330
+ // we do not want the modifier pressed
3331
+ value = false
3332
+ }
3333
+
3334
+ if (value !== true) {
3335
+ // compensate for the modifier's operator
3336
+ token = token.slice(1)
3337
+ }
3338
+
3339
+ var propertyName = modifier[token]
3340
+ if (!propertyName) {
3341
+ throw new TypeError('Unknown modifier "' + token + '"')
3342
+ }
3343
+
3344
+ expected[propertyName] = value
3345
+ })
3346
+
3347
+ return expected
3348
+ }
3349
+
3350
+ function resolveKey(key) {
3351
+ var code = keycode[key] || parseInt(key, 10)
3352
+ if (!code || typeof code !== 'number' || isNaN(code)) {
3353
+ throw new TypeError('Unknown key "' + key + '"')
3354
+ }
3355
+
3356
+ return [code].concat(keycode._alias[code] || [])
3357
+ }
3358
+
3359
+ function matchModifiers(expected, event) {
3360
+ // returns true on match
3361
+ return !modifierSequence.some(function (prop) {
3362
+ // returns true on mismatch
3363
+ return (
3364
+ typeof expected[prop] === 'boolean' &&
3365
+ Boolean(event[prop]) !== expected[prop]
3366
+ )
3367
+ })
3368
+ }
3369
+
3370
+ function keyBinding(text) {
3371
+ return text.split(/\s+/).map(function (_text) {
3372
+ var tokens = _text.split('+')
3373
+ var _modifiers = resolveModifiers(tokens.slice(0, -1))
3374
+ var _keyCodes = resolveKey(tokens.slice(-1))
3375
+ return {
3376
+ keyCodes: _keyCodes,
3377
+ modifiers: _modifiers,
3378
+ matchModifiers: matchModifiers.bind(null, _modifiers),
3379
+ }
3380
+ })
3381
+ }
3382
+
3383
+ // Node.compareDocumentPosition is available since IE9
3384
+ // see https://developer.mozilla.org/en-US/docs/Web/API/Node.compareDocumentPosition
3385
+
3386
+ // callback returns true when element is contained by parent or is the parent suited for use with Array.some()
3387
+ /*
3388
+ USAGE:
3389
+ var isChildOf = getParentComparator({parent: someNode});
3390
+ listOfElements.some(isChildOf)
3391
+ */
3392
+
3393
+ function getParentComparator() {
3394
+ var _ref =
3395
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3396
+ parent = _ref.parent,
3397
+ element = _ref.element,
3398
+ includeSelf = _ref.includeSelf
3399
+
3400
+ if (parent) {
3401
+ return function isChildOf(node) {
3402
+ return Boolean(
3403
+ (includeSelf && node === parent) ||
3404
+ parent.compareDocumentPosition(node) &
3405
+ Node.DOCUMENT_POSITION_CONTAINED_BY
3406
+ )
3407
+ }
3408
+ } else if (element) {
3409
+ return function isParentOf(node) {
3410
+ return Boolean(
3411
+ (includeSelf && element === node) ||
3412
+ node.compareDocumentPosition(element) &
3413
+ Node.DOCUMENT_POSITION_CONTAINED_BY
3414
+ )
3415
+ }
3416
+ }
3417
+
3418
+ throw new TypeError(
3419
+ 'util/compare-position#getParentComparator required either options.parent or options.element'
3420
+ )
3421
+ }
3422
+
3423
+ // Bug 286933 - Key events in the autocomplete popup should be hidden from page scripts
3424
+ // @browser-issue Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=286933
3425
+
3426
+ function whenKey() {
3427
+ var map =
3428
+ arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}
3429
+
3430
+ var bindings = {}
3431
+
3432
+ var context = nodeArray(map.context)[0] || document.documentElement
3433
+ delete map.context
3434
+ var filter = nodeArray(map.filter)
3435
+ delete map.filter
3436
+
3437
+ var mapKeys = Object.keys(map)
3438
+ if (!mapKeys.length) {
3439
+ throw new TypeError('when/key requires at least one option key')
3440
+ }
3441
+
3442
+ var registerBinding = function registerBinding(event) {
3443
+ event.keyCodes.forEach(function (code) {
3444
+ if (!bindings[code]) {
3445
+ bindings[code] = []
3446
+ }
3447
+
3448
+ bindings[code].push(event)
3449
+ })
3450
+ }
3451
+
3452
+ mapKeys.forEach(function (text) {
3453
+ if (typeof map[text] !== 'function') {
3454
+ throw new TypeError(
3455
+ 'when/key requires option["' + text + '"] to be a function'
3456
+ )
3457
+ }
3458
+
3459
+ var addCallback = function addCallback(event) {
3460
+ event.callback = map[text]
3461
+ return event
3462
+ }
3463
+
3464
+ keyBinding(text).map(addCallback).forEach(registerBinding)
3465
+ })
3466
+
3467
+ var handleKeyDown = function handleKeyDown(event) {
3468
+ if (event.defaultPrevented) {
3469
+ return
3470
+ }
3471
+
3472
+ if (filter.length) {
3473
+ // ignore elements within the exempted sub-trees
3474
+ var isParentOfElement = getParentComparator({
3475
+ element: event.target,
3476
+ includeSelf: true,
3477
+ })
3478
+ if (filter.some(isParentOfElement)) {
3479
+ return
3480
+ }
3481
+ }
3482
+
3483
+ var key = event.keyCode || event.which
3484
+ if (!bindings[key]) {
3485
+ return
3486
+ }
3487
+
3488
+ bindings[key].forEach(function (_event) {
3489
+ if (!_event.matchModifiers(event)) {
3490
+ return
3491
+ }
3492
+
3493
+ _event.callback.call(context, event, disengage)
3494
+ })
3495
+ }
3496
+
3497
+ context.addEventListener('keydown', handleKeyDown, false)
3498
+
3499
+ var disengage = function disengage() {
3500
+ context.removeEventListener('keydown', handleKeyDown, false)
3501
+ }
3502
+
3503
+ return { disengage: disengage }
3504
+ }
3505
+
3506
+ export default function ({ context } = {}) {
3507
+ if (!context) {
3508
+ context = document.documentElement
3509
+ }
3510
+
3511
+ // Make sure the supports tests are run before intercepting the Tab key,
3512
+ // or IE10 and IE11 will fail to process the first Tab key event. Not
3513
+ // limiting this warm-up to IE because it may be a problem elsewhere, too.
3514
+ queryTabsequence()
3515
+
3516
+ return whenKey({
3517
+ // Safari on OSX may require ALT+TAB to reach links,
3518
+ // see https://github.com/medialize/ally.js/issues/146
3519
+ '?alt+?shift+tab': function altShiftTab(event) {
3520
+ // we're completely taking over the Tab key handling
3521
+ event.preventDefault()
3522
+
3523
+ var sequence = queryTabsequence({
3524
+ context: context,
3525
+ })
3526
+
3527
+ var backward = event.shiftKey
3528
+ var first = sequence[0]
3529
+ var last = sequence[sequence.length - 1]
3530
+
3531
+ // wrap around first to last, last to first
3532
+ var source = backward ? first : last
3533
+ var target = backward ? last : first
3534
+ if (isActiveElement(source)) {
3535
+ target.focus()
3536
+ return
3537
+ }
3538
+
3539
+ // find current position in tabsequence
3540
+ var currentIndex = void 0
3541
+ var found = sequence.some(function (element, index) {
3542
+ if (!isActiveElement(element)) {
3543
+ return false
3544
+ }
3545
+
3546
+ currentIndex = index
3547
+ return true
3548
+ })
3549
+
3550
+ if (!found) {
3551
+ // redirect to first as we're not in our tabsequence
3552
+ first.focus()
3553
+ return
3554
+ }
3555
+
3556
+ // shift focus to previous/next element in the sequence
3557
+ var offset = backward ? -1 : 1
3558
+ sequence[currentIndex + offset].focus()
3559
+ },
3560
+ })
3561
+ }